From 5269ec3c66bd3a0f7aa1e9867b394313924cc223 Mon Sep 17 00:00:00 2001 From: Anand Shukla Date: Mon, 3 Jun 2024 20:23:50 +0530 Subject: [PATCH] Initial Sample. --- ...QL Authentications.postman_collection.json | 167 + graphql-subscription-express/index.html | 34 + .../node_modules/.bin/mime | 1 + .../node_modules/.package-lock.json | 726 ++ .../node_modules/accepts/HISTORY.md | 243 + .../node_modules/accepts/LICENSE | 23 + .../node_modules/accepts/README.md | 140 + .../node_modules/accepts/index.js | 238 + .../node_modules/accepts/package.json | 47 + .../node_modules/array-flatten/LICENSE | 21 + .../node_modules/array-flatten/README.md | 43 + .../array-flatten/array-flatten.js | 64 + .../node_modules/array-flatten/package.json | 39 + .../node_modules/body-parser/HISTORY.md | 665 ++ .../node_modules/body-parser/LICENSE | 23 + .../node_modules/body-parser/README.md | 465 + .../node_modules/body-parser/SECURITY.md | 25 + .../node_modules/body-parser/index.js | 156 + .../node_modules/body-parser/lib/read.js | 205 + .../body-parser/lib/types/json.js | 247 + .../node_modules/body-parser/lib/types/raw.js | 101 + .../body-parser/lib/types/text.js | 121 + .../body-parser/lib/types/urlencoded.js | 284 + .../node_modules/body-parser/package.json | 56 + .../node_modules/bytes/History.md | 97 + .../node_modules/bytes/LICENSE | 23 + .../node_modules/bytes/Readme.md | 152 + .../node_modules/bytes/index.js | 170 + .../node_modules/bytes/package.json | 42 + .../node_modules/call-bind/.eslintignore | 1 + .../node_modules/call-bind/.eslintrc | 16 + .../call-bind/.github/FUNDING.yml | 12 + .../node_modules/call-bind/.nycrc | 9 + .../node_modules/call-bind/CHANGELOG.md | 93 + .../node_modules/call-bind/LICENSE | 21 + .../node_modules/call-bind/README.md | 64 + .../node_modules/call-bind/callBound.js | 15 + .../node_modules/call-bind/index.js | 35 + .../node_modules/call-bind/package.json | 95 + .../node_modules/call-bind/test/callBound.js | 54 + .../node_modules/call-bind/test/index.js | 80 + .../content-disposition/HISTORY.md | 60 + .../node_modules/content-disposition/LICENSE | 22 + .../content-disposition/README.md | 142 + .../node_modules/content-disposition/index.js | 458 + .../content-disposition/package.json | 44 + .../node_modules/content-type/HISTORY.md | 29 + .../node_modules/content-type/LICENSE | 22 + .../node_modules/content-type/README.md | 94 + .../node_modules/content-type/index.js | 225 + .../node_modules/content-type/package.json | 42 + .../node_modules/cookie-signature/.npmignore | 4 + .../node_modules/cookie-signature/History.md | 38 + .../node_modules/cookie-signature/Readme.md | 42 + .../node_modules/cookie-signature/index.js | 51 + .../cookie-signature/package.json | 18 + .../node_modules/cookie/HISTORY.md | 147 + .../node_modules/cookie/LICENSE | 24 + .../node_modules/cookie/README.md | 317 + .../node_modules/cookie/SECURITY.md | 25 + .../node_modules/cookie/index.js | 274 + .../node_modules/cookie/package.json | 44 + .../node_modules/debug/.coveralls.yml | 1 + .../node_modules/debug/.eslintrc | 11 + .../node_modules/debug/.npmignore | 9 + .../node_modules/debug/.travis.yml | 14 + .../node_modules/debug/CHANGELOG.md | 362 + .../node_modules/debug/LICENSE | 19 + .../node_modules/debug/Makefile | 50 + .../node_modules/debug/README.md | 312 + .../node_modules/debug/component.json | 19 + .../node_modules/debug/karma.conf.js | 70 + .../node_modules/debug/node.js | 1 + .../node_modules/debug/package.json | 49 + .../node_modules/debug/src/browser.js | 185 + .../node_modules/debug/src/debug.js | 202 + .../node_modules/debug/src/index.js | 10 + .../node_modules/debug/src/inspector-log.js | 15 + .../node_modules/debug/src/node.js | 248 + .../define-data-property/.eslintrc | 24 + .../define-data-property/.github/FUNDING.yml | 12 + .../node_modules/define-data-property/.nycrc | 13 + .../define-data-property/CHANGELOG.md | 70 + .../node_modules/define-data-property/LICENSE | 21 + .../define-data-property/README.md | 67 + .../define-data-property/index.d.ts | 12 + .../define-data-property/index.js | 56 + .../define-data-property/package.json | 106 + .../define-data-property/test/index.js | 392 + .../define-data-property/tsconfig.json | 59 + .../node_modules/depd/History.md | 103 + .../node_modules/depd/LICENSE | 22 + .../node_modules/depd/Readme.md | 280 + .../node_modules/depd/index.js | 538 + .../node_modules/depd/lib/browser/index.js | 77 + .../node_modules/depd/package.json | 45 + .../node_modules/destroy/LICENSE | 23 + .../node_modules/destroy/README.md | 63 + .../node_modules/destroy/index.js | 209 + .../node_modules/destroy/package.json | 48 + .../node_modules/ee-first/LICENSE | 22 + .../node_modules/ee-first/README.md | 80 + .../node_modules/ee-first/index.js | 95 + .../node_modules/ee-first/package.json | 29 + .../node_modules/encodeurl/HISTORY.md | 14 + .../node_modules/encodeurl/LICENSE | 22 + .../node_modules/encodeurl/README.md | 128 + .../node_modules/encodeurl/index.js | 60 + .../node_modules/encodeurl/package.json | 40 + .../node_modules/es-define-property/.eslintrc | 13 + .../es-define-property/.github/FUNDING.yml | 12 + .../node_modules/es-define-property/.nycrc | 9 + .../es-define-property/CHANGELOG.md | 15 + .../node_modules/es-define-property/LICENSE | 21 + .../node_modules/es-define-property/README.md | 49 + .../es-define-property/index.d.ts | 3 + .../node_modules/es-define-property/index.js | 16 + .../es-define-property/package.json | 81 + .../es-define-property/test/index.js | 55 + .../es-define-property/tsconfig.json | 50 + .../node_modules/es-errors/.eslintrc | 5 + .../es-errors/.github/FUNDING.yml | 12 + .../node_modules/es-errors/CHANGELOG.md | 40 + .../node_modules/es-errors/LICENSE | 21 + .../node_modules/es-errors/README.md | 55 + .../node_modules/es-errors/eval.d.ts | 3 + .../node_modules/es-errors/eval.js | 4 + .../node_modules/es-errors/index.d.ts | 3 + .../node_modules/es-errors/index.js | 4 + .../node_modules/es-errors/package.json | 80 + .../node_modules/es-errors/range.d.ts | 3 + .../node_modules/es-errors/range.js | 4 + .../node_modules/es-errors/ref.d.ts | 3 + .../node_modules/es-errors/ref.js | 4 + .../node_modules/es-errors/syntax.d.ts | 3 + .../node_modules/es-errors/syntax.js | 4 + .../node_modules/es-errors/test/index.js | 19 + .../node_modules/es-errors/tsconfig.json | 49 + .../node_modules/es-errors/type.d.ts | 3 + .../node_modules/es-errors/type.js | 4 + .../node_modules/es-errors/uri.d.ts | 3 + .../node_modules/es-errors/uri.js | 4 + .../node_modules/escape-html/LICENSE | 24 + .../node_modules/escape-html/Readme.md | 43 + .../node_modules/escape-html/index.js | 78 + .../node_modules/escape-html/package.json | 24 + .../node_modules/etag/HISTORY.md | 83 + .../node_modules/etag/LICENSE | 22 + .../node_modules/etag/README.md | 159 + .../node_modules/etag/index.js | 131 + .../node_modules/etag/package.json | 47 + .../node_modules/express/History.md | 3615 +++++++ .../node_modules/express/LICENSE | 24 + .../node_modules/express/Readme.md | 166 + .../node_modules/express/index.js | 11 + .../node_modules/express/lib/application.js | 661 ++ .../node_modules/express/lib/express.js | 116 + .../express/lib/middleware/init.js | 43 + .../express/lib/middleware/query.js | 47 + .../node_modules/express/lib/request.js | 525 + .../node_modules/express/lib/response.js | 1178 +++ .../node_modules/express/lib/router/index.js | 673 ++ .../node_modules/express/lib/router/layer.js | 181 + .../node_modules/express/lib/router/route.js | 230 + .../node_modules/express/lib/utils.js | 303 + .../node_modules/express/lib/view.js | 182 + .../node_modules/express/package.json | 98 + .../node_modules/finalhandler/HISTORY.md | 195 + .../node_modules/finalhandler/LICENSE | 22 + .../node_modules/finalhandler/README.md | 147 + .../node_modules/finalhandler/SECURITY.md | 25 + .../node_modules/finalhandler/index.js | 336 + .../node_modules/finalhandler/package.json | 46 + .../node_modules/forwarded/HISTORY.md | 21 + .../node_modules/forwarded/LICENSE | 22 + .../node_modules/forwarded/README.md | 57 + .../node_modules/forwarded/index.js | 90 + .../node_modules/forwarded/package.json | 45 + .../node_modules/fresh/HISTORY.md | 70 + .../node_modules/fresh/LICENSE | 23 + .../node_modules/fresh/README.md | 119 + .../node_modules/fresh/index.js | 137 + .../node_modules/fresh/package.json | 46 + .../node_modules/function-bind/.eslintrc | 21 + .../function-bind/.github/FUNDING.yml | 12 + .../function-bind/.github/SECURITY.md | 3 + .../node_modules/function-bind/.nycrc | 13 + .../node_modules/function-bind/CHANGELOG.md | 136 + .../node_modules/function-bind/LICENSE | 20 + .../node_modules/function-bind/README.md | 46 + .../function-bind/implementation.js | 84 + .../node_modules/function-bind/index.js | 5 + .../node_modules/function-bind/package.json | 87 + .../node_modules/function-bind/test/.eslintrc | 9 + .../node_modules/function-bind/test/index.js | 252 + .../node_modules/get-intrinsic/.eslintrc | 38 + .../get-intrinsic/.github/FUNDING.yml | 12 + .../node_modules/get-intrinsic/.nycrc | 9 + .../node_modules/get-intrinsic/CHANGELOG.md | 143 + .../node_modules/get-intrinsic/LICENSE | 21 + .../node_modules/get-intrinsic/README.md | 71 + .../node_modules/get-intrinsic/index.js | 359 + .../node_modules/get-intrinsic/package.json | 93 + .../get-intrinsic/test/GetIntrinsic.js | 274 + .../node_modules/gopd/.eslintrc | 16 + .../node_modules/gopd/.github/FUNDING.yml | 12 + .../node_modules/gopd/CHANGELOG.md | 25 + .../node_modules/gopd/LICENSE | 21 + .../node_modules/gopd/README.md | 40 + .../node_modules/gopd/index.js | 16 + .../node_modules/gopd/package.json | 71 + .../node_modules/gopd/test/index.js | 35 + .../node_modules/graphql-ws/LICENSE.md | 9 + .../node_modules/graphql-ws/PROTOCOL.md | 251 + .../node_modules/graphql-ws/README.md | 39 + .../node_modules/graphql-ws/lib/client.d.mts | 407 + .../node_modules/graphql-ws/lib/client.d.ts | 407 + .../node_modules/graphql-ws/lib/client.js | 575 ++ .../node_modules/graphql-ws/lib/client.mjs | 556 ++ .../node_modules/graphql-ws/lib/common.d.mts | 201 + .../node_modules/graphql-ws/lib/common.d.ts | 201 + .../node_modules/graphql-ws/lib/common.js | 185 + .../node_modules/graphql-ws/lib/common.mjs | 178 + .../node_modules/graphql-ws/lib/index.d.mts | 3 + .../node_modules/graphql-ws/lib/index.d.ts | 3 + .../node_modules/graphql-ws/lib/index.js | 19 + .../node_modules/graphql-ws/lib/index.mjs | 3 + .../node_modules/graphql-ws/lib/server.d.mts | 417 + .../node_modules/graphql-ws/lib/server.d.ts | 417 + .../node_modules/graphql-ws/lib/server.js | 309 + .../node_modules/graphql-ws/lib/server.mjs | 304 + .../lib/use/@fastify/websocket.d.mts | 36 + .../lib/use/@fastify/websocket.d.ts | 36 + .../graphql-ws/lib/use/@fastify/websocket.js | 126 + .../graphql-ws/lib/use/@fastify/websocket.mjs | 122 + .../node_modules/graphql-ws/lib/use/bun.d.mts | 60 + .../node_modules/graphql-ws/lib/use/bun.d.ts | 60 + .../node_modules/graphql-ws/lib/use/bun.js | 97 + .../node_modules/graphql-ws/lib/use/bun.mjs | 92 + .../graphql-ws/lib/use/deno.d.mts | 56 + .../node_modules/graphql-ws/lib/use/deno.d.ts | 56 + .../node_modules/graphql-ws/lib/use/deno.js | 88 + .../node_modules/graphql-ws/lib/use/deno.mjs | 83 + .../lib/use/fastify-websocket.d.mts | 40 + .../graphql-ws/lib/use/fastify-websocket.d.ts | 40 + .../graphql-ws/lib/use/fastify-websocket.js | 25 + .../graphql-ws/lib/use/fastify-websocket.mjs | 21 + .../graphql-ws/lib/use/uWebSockets.d.mts | 67 + .../graphql-ws/lib/use/uWebSockets.d.ts | 67 + .../graphql-ws/lib/use/uWebSockets.js | 141 + .../graphql-ws/lib/use/uWebSockets.mjs | 137 + .../node_modules/graphql-ws/lib/use/ws.d.mts | 38 + .../node_modules/graphql-ws/lib/use/ws.d.ts | 38 + .../node_modules/graphql-ws/lib/use/ws.js | 119 + .../node_modules/graphql-ws/lib/use/ws.mjs | 115 + .../node_modules/graphql-ws/lib/utils.d.mts | 23 + .../node_modules/graphql-ws/lib/utils.d.ts | 23 + .../node_modules/graphql-ws/lib/utils.js | 54 + .../node_modules/graphql-ws/lib/utils.mjs | 45 + .../node_modules/graphql-ws/package.json | 152 + .../node_modules/graphql-ws/umd/graphql-ws.js | 800 ++ .../graphql-ws/umd/graphql-ws.min.js | 1 + .../graphql-ws/umd/graphql-ws.min.js.gz | Bin 0 -> 3841 bytes .../node_modules/graphql/LICENSE | 21 + .../graphql/NotSupportedTSVersion.d.ts | 1 + .../node_modules/graphql/README.md | 158 + .../graphql/error/GraphQLError.d.ts | 142 + .../graphql/error/GraphQLError.js | 267 + .../graphql/error/GraphQLError.mjs | 253 + .../node_modules/graphql/error/index.d.ts | 8 + .../node_modules/graphql/error/index.js | 41 + .../node_modules/graphql/error/index.mjs | 3 + .../graphql/error/locatedError.d.ts | 13 + .../graphql/error/locatedError.js | 40 + .../graphql/error/locatedError.mjs | 32 + .../graphql/error/syntaxError.d.ts | 11 + .../node_modules/graphql/error/syntaxError.js | 19 + .../graphql/error/syntaxError.mjs | 12 + .../graphql/execution/collectFields.d.ts | 45 + .../graphql/execution/collectFields.js | 229 + .../graphql/execution/collectFields.mjs | 213 + .../graphql/execution/execute.d.ts | 185 + .../node_modules/graphql/execution/execute.js | 1037 ++ .../graphql/execution/execute.mjs | 1009 ++ .../node_modules/graphql/execution/index.d.ts | 18 + .../node_modules/graphql/execution/index.js | 73 + .../node_modules/graphql/execution/index.mjs | 13 + .../graphql/execution/mapAsyncIterator.d.ts | 9 + .../graphql/execution/mapAsyncIterator.js | 68 + .../graphql/execution/mapAsyncIterator.mjs | 61 + .../graphql/execution/subscribe.d.ts | 72 + .../graphql/execution/subscribe.js | 244 + .../graphql/execution/subscribe.mjs | 222 + .../graphql/execution/values.d.ts | 79 + .../node_modules/graphql/execution/values.js | 300 + .../node_modules/graphql/execution/values.mjs | 263 + .../node_modules/graphql/graphql.d.ts | 67 + .../node_modules/graphql/graphql.js | 96 + .../node_modules/graphql/graphql.mjs | 122 + .../node_modules/graphql/index.d.ts | 413 + .../node_modules/graphql/index.js | 1269 +++ .../node_modules/graphql/index.mjs | 255 + .../node_modules/graphql/jsutils/Maybe.d.ts | 2 + .../node_modules/graphql/jsutils/Maybe.js | 5 + .../node_modules/graphql/jsutils/Maybe.mjs | 1 + .../node_modules/graphql/jsutils/ObjMap.d.ts | 16 + .../node_modules/graphql/jsutils/ObjMap.js | 5 + .../node_modules/graphql/jsutils/ObjMap.mjs | 1 + .../node_modules/graphql/jsutils/Path.d.ts | 20 + .../node_modules/graphql/jsutils/Path.js | 33 + .../node_modules/graphql/jsutils/Path.mjs | 25 + .../graphql/jsutils/PromiseOrValue.d.ts | 1 + .../graphql/jsutils/PromiseOrValue.js | 5 + .../graphql/jsutils/PromiseOrValue.mjs | 1 + .../graphql/jsutils/devAssert.d.ts | 1 + .../node_modules/graphql/jsutils/devAssert.js | 14 + .../graphql/jsutils/devAssert.mjs | 7 + .../graphql/jsutils/didYouMean.d.ts | 8 + .../graphql/jsutils/didYouMean.js | 38 + .../graphql/jsutils/didYouMean.mjs | 32 + .../node_modules/graphql/jsutils/groupBy.d.ts | 7 + .../node_modules/graphql/jsutils/groupBy.js | 26 + .../node_modules/graphql/jsutils/groupBy.mjs | 19 + .../graphql/jsutils/identityFunc.d.ts | 4 + .../graphql/jsutils/identityFunc.js | 13 + .../graphql/jsutils/identityFunc.mjs | 6 + .../node_modules/graphql/jsutils/inspect.d.ts | 4 + .../node_modules/graphql/jsutils/inspect.js | 121 + .../node_modules/graphql/jsutils/inspect.mjs | 115 + .../graphql/jsutils/instanceOf.d.ts | 16 + .../graphql/jsutils/instanceOf.js | 60 + .../graphql/jsutils/instanceOf.mjs | 52 + .../graphql/jsutils/invariant.d.ts | 4 + .../node_modules/graphql/jsutils/invariant.js | 16 + .../graphql/jsutils/invariant.mjs | 9 + .../graphql/jsutils/isAsyncIterable.d.ts | 7 + .../graphql/jsutils/isAsyncIterable.js | 18 + .../graphql/jsutils/isAsyncIterable.mjs | 11 + .../graphql/jsutils/isIterableObject.d.ts | 20 + .../graphql/jsutils/isIterableObject.js | 32 + .../graphql/jsutils/isIterableObject.mjs | 25 + .../graphql/jsutils/isObjectLike.d.ts | 7 + .../graphql/jsutils/isObjectLike.js | 14 + .../graphql/jsutils/isObjectLike.mjs | 7 + .../graphql/jsutils/isPromise.d.ts | 5 + .../node_modules/graphql/jsutils/isPromise.js | 17 + .../graphql/jsutils/isPromise.mjs | 10 + .../node_modules/graphql/jsutils/keyMap.d.ts | 32 + .../node_modules/graphql/jsutils/keyMap.js | 43 + .../node_modules/graphql/jsutils/keyMap.mjs | 36 + .../graphql/jsutils/keyValMap.d.ts | 23 + .../node_modules/graphql/jsutils/keyValMap.js | 33 + .../graphql/jsutils/keyValMap.mjs | 26 + .../graphql/jsutils/mapValue.d.ts | 9 + .../node_modules/graphql/jsutils/mapValue.js | 20 + .../node_modules/graphql/jsutils/mapValue.mjs | 13 + .../graphql/jsutils/memoize3.d.ts | 9 + .../node_modules/graphql/jsutils/memoize3.js | 41 + .../node_modules/graphql/jsutils/memoize3.mjs | 34 + .../graphql/jsutils/naturalCompare.d.ts | 8 + .../graphql/jsutils/naturalCompare.js | 69 + .../graphql/jsutils/naturalCompare.mjs | 61 + .../graphql/jsutils/printPathArray.d.ts | 6 + .../graphql/jsutils/printPathArray.js | 17 + .../graphql/jsutils/printPathArray.mjs | 10 + .../graphql/jsutils/promiseForObject.d.ts | 11 + .../graphql/jsutils/promiseForObject.js | 25 + .../graphql/jsutils/promiseForObject.mjs | 18 + .../graphql/jsutils/promiseReduce.d.ts | 13 + .../graphql/jsutils/promiseReduce.js | 27 + .../graphql/jsutils/promiseReduce.mjs | 20 + .../graphql/jsutils/suggestionList.d.ts | 8 + .../graphql/jsutils/suggestionList.js | 139 + .../graphql/jsutils/suggestionList.mjs | 130 + .../node_modules/graphql/jsutils/toError.d.ts | 4 + .../node_modules/graphql/jsutils/toError.js | 25 + .../node_modules/graphql/jsutils/toError.mjs | 18 + .../graphql/jsutils/toObjMap.d.ts | 5 + .../node_modules/graphql/jsutils/toObjMap.js | 24 + .../node_modules/graphql/jsutils/toObjMap.mjs | 17 + .../node_modules/graphql/language/ast.d.ts | 537 + .../node_modules/graphql/language/ast.js | 224 + .../node_modules/graphql/language/ast.mjs | 208 + .../graphql/language/blockString.d.ts | 28 + .../graphql/language/blockString.js | 195 + .../graphql/language/blockString.mjs | 178 + .../graphql/language/characterClasses.d.ts | 47 + .../graphql/language/characterClasses.js | 75 + .../graphql/language/characterClasses.mjs | 64 + .../graphql/language/directiveLocation.d.ts | 33 + .../graphql/language/directiveLocation.js | 39 + .../graphql/language/directiveLocation.mjs | 33 + .../node_modules/graphql/language/index.d.ts | 97 + .../node_modules/graphql/language/index.js | 215 + .../node_modules/graphql/language/index.mjs | 29 + .../node_modules/graphql/language/kinds.d.ts | 66 + .../node_modules/graphql/language/kinds.js | 63 + .../node_modules/graphql/language/kinds.mjs | 57 + .../node_modules/graphql/language/lexer.d.ts | 45 + .../node_modules/graphql/language/lexer.js | 1006 ++ .../node_modules/graphql/language/lexer.mjs | 902 ++ .../graphql/language/location.d.ts | 16 + .../node_modules/graphql/language/location.js | 38 + .../graphql/language/location.mjs | 30 + .../node_modules/graphql/language/parser.d.ts | 564 ++ .../node_modules/graphql/language/parser.js | 1567 +++ .../node_modules/graphql/language/parser.mjs | 1524 +++ .../graphql/language/predicates.d.ts | 33 + .../graphql/language/predicates.js | 109 + .../graphql/language/predicates.mjs | 81 + .../graphql/language/printLocation.d.ts | 14 + .../graphql/language/printLocation.js | 74 + .../graphql/language/printLocation.mjs | 66 + .../graphql/language/printString.d.ts | 5 + .../graphql/language/printString.js | 183 + .../graphql/language/printString.mjs | 176 + .../graphql/language/printer.d.ts | 6 + .../node_modules/graphql/language/printer.js | 351 + .../node_modules/graphql/language/printer.mjs | 339 + .../node_modules/graphql/language/source.d.ts | 25 + .../node_modules/graphql/language/source.js | 65 + .../node_modules/graphql/language/source.mjs | 50 + .../graphql/language/tokenKind.d.ts | 35 + .../graphql/language/tokenKind.js | 43 + .../graphql/language/tokenKind.mjs | 37 + .../graphql/language/visitor.d.ts | 194 + .../node_modules/graphql/language/visitor.js | 377 + .../node_modules/graphql/language/visitor.mjs | 361 + .../node_modules/graphql/package.json | 39 + .../graphql/subscription/index.d.ts | 19 + .../graphql/subscription/index.js | 19 + .../graphql/subscription/index.mjs | 19 + .../node_modules/graphql/type/assertName.d.ts | 10 + .../node_modules/graphql/type/assertName.js | 59 + .../node_modules/graphql/type/assertName.mjs | 44 + .../node_modules/graphql/type/definition.d.ts | 923 ++ .../node_modules/graphql/type/definition.js | 1339 +++ .../node_modules/graphql/type/definition.mjs | 1177 +++ .../node_modules/graphql/type/directives.d.ts | 86 + .../node_modules/graphql/type/directives.js | 224 + .../node_modules/graphql/type/directives.mjs | 190 + .../node_modules/graphql/type/index.d.ts | 150 + .../node_modules/graphql/type/index.js | 547 ++ .../node_modules/graphql/type/index.mjs | 103 + .../graphql/type/introspection.d.ts | 30 + .../graphql/type/introspection.js | 617 ++ .../graphql/type/introspection.mjs | 551 ++ .../node_modules/graphql/type/scalars.d.ts | 19 + .../node_modules/graphql/type/scalars.js | 369 + .../node_modules/graphql/type/scalars.mjs | 309 + .../node_modules/graphql/type/schema.d.ts | 170 + .../node_modules/graphql/type/schema.js | 402 + .../node_modules/graphql/type/schema.mjs | 381 + .../node_modules/graphql/type/validate.d.ts | 17 + .../node_modules/graphql/type/validate.js | 676 ++ .../node_modules/graphql/type/validate.mjs | 651 ++ .../graphql/utilities/TypeInfo.d.ts | 67 + .../graphql/utilities/TypeInfo.js | 418 + .../graphql/utilities/TypeInfo.mjs | 395 + .../graphql/utilities/assertValidName.d.ts | 13 + .../graphql/utilities/assertValidName.js | 51 + .../graphql/utilities/assertValidName.mjs | 40 + .../graphql/utilities/astFromValue.d.ts | 28 + .../graphql/utilities/astFromValue.js | 190 + .../graphql/utilities/astFromValue.mjs | 177 + .../graphql/utilities/buildASTSchema.d.ts | 35 + .../graphql/utilities/buildASTSchema.js | 115 + .../graphql/utilities/buildASTSchema.mjs | 97 + .../graphql/utilities/buildClientSchema.d.ts | 19 + .../graphql/utilities/buildClientSchema.js | 386 + .../graphql/utilities/buildClientSchema.mjs | 363 + .../graphql/utilities/coerceInputValue.d.ts | 16 + .../graphql/utilities/coerceInputValue.js | 189 + .../graphql/utilities/coerceInputValue.mjs | 167 + .../graphql/utilities/concatAST.d.ts | 9 + .../graphql/utilities/concatAST.js | 26 + .../graphql/utilities/concatAST.mjs | 19 + .../graphql/utilities/extendSchema.d.ts | 40 + .../graphql/utilities/extendSchema.js | 798 ++ .../graphql/utilities/extendSchema.mjs | 789 ++ .../utilities/findBreakingChanges.d.ts | 53 + .../graphql/utilities/findBreakingChanges.js | 547 ++ .../graphql/utilities/findBreakingChanges.mjs | 519 + .../utilities/getIntrospectionQuery.d.ts | 182 + .../utilities/getIntrospectionQuery.js | 142 + .../utilities/getIntrospectionQuery.mjs | 135 + .../graphql/utilities/getOperationAST.d.ts | 11 + .../graphql/utilities/getOperationAST.js | 43 + .../graphql/utilities/getOperationAST.mjs | 36 + .../utilities/getOperationRootType.d.ts | 15 + .../graphql/utilities/getOperationRootType.js | 67 + .../utilities/getOperationRootType.mjs | 54 + .../node_modules/graphql/utilities/index.d.ts | 61 + .../node_modules/graphql/utilities/index.js | 233 + .../node_modules/graphql/utilities/index.mjs | 55 + .../utilities/introspectionFromSchema.d.ts | 18 + .../utilities/introspectionFromSchema.js | 42 + .../utilities/introspectionFromSchema.mjs | 30 + .../utilities/lexicographicSortSchema.d.ts | 9 + .../utilities/lexicographicSortSchema.js | 177 + .../utilities/lexicographicSortSchema.mjs | 172 + .../graphql/utilities/printSchema.d.ts | 5 + .../graphql/utilities/printSchema.js | 333 + .../graphql/utilities/printSchema.mjs | 309 + .../graphql/utilities/separateOperations.d.ts | 11 + .../graphql/utilities/separateOperations.js | 88 + .../graphql/utilities/separateOperations.mjs | 80 + .../graphql/utilities/sortValueNode.d.ts | 9 + .../graphql/utilities/sortValueNode.js | 47 + .../graphql/utilities/sortValueNode.mjs | 39 + .../utilities/stripIgnoredCharacters.d.ts | 62 + .../utilities/stripIgnoredCharacters.js | 121 + .../utilities/stripIgnoredCharacters.mjs | 104 + .../graphql/utilities/typeComparators.d.ts | 32 + .../graphql/utilities/typeComparators.js | 116 + .../graphql/utilities/typeComparators.mjs | 106 + .../graphql/utilities/typeFromAST.d.ts | 32 + .../graphql/utilities/typeFromAST.js | 27 + .../graphql/utilities/typeFromAST.mjs | 18 + .../utilities/typedQueryDocumentNode.d.ts | 22 + .../utilities/typedQueryDocumentNode.js | 5 + .../utilities/typedQueryDocumentNode.mjs | 1 + .../graphql/utilities/valueFromAST.d.ts | 29 + .../graphql/utilities/valueFromAST.js | 185 + .../graphql/utilities/valueFromAST.mjs | 172 + .../utilities/valueFromASTUntyped.d.ts | 23 + .../graphql/utilities/valueFromASTUntyped.js | 61 + .../graphql/utilities/valueFromASTUntyped.mjs | 53 + .../graphql/validation/ValidationContext.d.ts | 95 + .../graphql/validation/ValidationContext.js | 232 + .../graphql/validation/ValidationContext.mjs | 212 + .../graphql/validation/index.d.ts | 40 + .../node_modules/graphql/validation/index.js | 317 + .../node_modules/graphql/validation/index.mjs | 68 + .../rules/ExecutableDefinitionsRule.d.ts | 13 + .../rules/ExecutableDefinitionsRule.js | 46 + .../rules/ExecutableDefinitionsRule.mjs | 34 + .../rules/FieldsOnCorrectTypeRule.d.ts | 13 + .../rules/FieldsOnCorrectTypeRule.js | 145 + .../rules/FieldsOnCorrectTypeRule.mjs | 127 + .../rules/FragmentsOnCompositeTypesRule.d.ts | 14 + .../rules/FragmentsOnCompositeTypesRule.js | 69 + .../rules/FragmentsOnCompositeTypesRule.mjs | 53 + .../rules/KnownArgumentNamesRule.d.ts | 23 + .../rules/KnownArgumentNamesRule.js | 120 + .../rules/KnownArgumentNamesRule.mjs | 102 + .../validation/rules/KnownDirectivesRule.d.ts | 16 + .../validation/rules/KnownDirectivesRule.js | 167 + .../validation/rules/KnownDirectivesRule.mjs | 150 + .../rules/KnownFragmentNamesRule.d.ts | 13 + .../rules/KnownFragmentNamesRule.js | 36 + .../rules/KnownFragmentNamesRule.mjs | 26 + .../validation/rules/KnownTypeNamesRule.d.ts | 16 + .../validation/rules/KnownTypeNamesRule.js | 89 + .../validation/rules/KnownTypeNamesRule.mjs | 77 + .../rules/LoneAnonymousOperationRule.d.ts | 13 + .../rules/LoneAnonymousOperationRule.js | 42 + .../rules/LoneAnonymousOperationRule.mjs | 34 + .../rules/LoneSchemaDefinitionRule.d.ts | 10 + .../rules/LoneSchemaDefinitionRule.js | 67 + .../rules/LoneSchemaDefinitionRule.mjs | 57 + .../rules/NoFragmentCyclesRule.d.ts | 13 + .../validation/rules/NoFragmentCyclesRule.js | 85 + .../validation/rules/NoFragmentCyclesRule.mjs | 78 + .../rules/NoUndefinedVariablesRule.d.ts | 13 + .../rules/NoUndefinedVariablesRule.js | 52 + .../rules/NoUndefinedVariablesRule.mjs | 45 + .../rules/NoUnusedFragmentsRule.d.ts | 13 + .../validation/rules/NoUnusedFragmentsRule.js | 61 + .../rules/NoUnusedFragmentsRule.mjs | 51 + .../rules/NoUnusedVariablesRule.d.ts | 13 + .../validation/rules/NoUnusedVariablesRule.js | 57 + .../rules/NoUnusedVariablesRule.mjs | 50 + .../OverlappingFieldsCanBeMergedRule.d.ts | 14 + .../rules/OverlappingFieldsCanBeMergedRule.js | 820 ++ .../OverlappingFieldsCanBeMergedRule.mjs | 805 ++ .../rules/PossibleFragmentSpreadsRule.d.ts | 12 + .../rules/PossibleFragmentSpreadsRule.js | 95 + .../rules/PossibleFragmentSpreadsRule.mjs | 73 + .../rules/PossibleTypeExtensionsRule.d.ts | 10 + .../rules/PossibleTypeExtensionsRule.js | 171 + .../rules/PossibleTypeExtensionsRule.mjs | 148 + .../rules/ProvidedRequiredArgumentsRule.d.ts | 20 + .../rules/ProvidedRequiredArgumentsRule.js | 162 + .../rules/ProvidedRequiredArgumentsRule.mjs | 142 + .../validation/rules/ScalarLeafsRule.d.ts | 9 + .../validation/rules/ScalarLeafsRule.js | 55 + .../validation/rules/ScalarLeafsRule.mjs | 46 + .../rules/SingleFieldSubscriptionsRule.d.ts | 13 + .../rules/SingleFieldSubscriptionsRule.js | 86 + .../rules/SingleFieldSubscriptionsRule.mjs | 77 + .../UniqueArgumentDefinitionNamesRule.d.ts | 11 + .../UniqueArgumentDefinitionNamesRule.js | 92 + .../UniqueArgumentDefinitionNamesRule.mjs | 81 + .../rules/UniqueArgumentNamesRule.d.ts | 13 + .../rules/UniqueArgumentNamesRule.js | 55 + .../rules/UniqueArgumentNamesRule.mjs | 44 + .../rules/UniqueDirectiveNamesRule.d.ts | 10 + .../rules/UniqueDirectiveNamesRule.js | 54 + .../rules/UniqueDirectiveNamesRule.mjs | 47 + .../UniqueDirectivesPerLocationRule.d.ts | 16 + .../rules/UniqueDirectivesPerLocationRule.js | 95 + .../rules/UniqueDirectivesPerLocationRule.mjs | 85 + .../rules/UniqueEnumValueNamesRule.d.ts | 10 + .../rules/UniqueEnumValueNamesRule.js | 75 + .../rules/UniqueEnumValueNamesRule.mjs | 64 + .../rules/UniqueFieldDefinitionNamesRule.d.ts | 10 + .../rules/UniqueFieldDefinitionNamesRule.js | 87 + .../rules/UniqueFieldDefinitionNamesRule.mjs | 79 + .../rules/UniqueFragmentNamesRule.d.ts | 12 + .../rules/UniqueFragmentNamesRule.js | 41 + .../rules/UniqueFragmentNamesRule.mjs | 34 + .../rules/UniqueInputFieldNamesRule.d.ts | 13 + .../rules/UniqueInputFieldNamesRule.js | 54 + .../rules/UniqueInputFieldNamesRule.mjs | 46 + .../rules/UniqueOperationNamesRule.d.ts | 12 + .../rules/UniqueOperationNamesRule.js | 46 + .../rules/UniqueOperationNamesRule.mjs | 39 + .../rules/UniqueOperationTypesRule.d.ts | 10 + .../rules/UniqueOperationTypesRule.js | 71 + .../rules/UniqueOperationTypesRule.mjs | 64 + .../validation/rules/UniqueTypeNamesRule.d.ts | 10 + .../validation/rules/UniqueTypeNamesRule.js | 57 + .../validation/rules/UniqueTypeNamesRule.mjs | 47 + .../rules/UniqueVariableNamesRule.d.ts | 10 + .../rules/UniqueVariableNamesRule.js | 49 + .../rules/UniqueVariableNamesRule.mjs | 41 + .../rules/ValuesOfCorrectTypeRule.d.ts | 13 + .../rules/ValuesOfCorrectTypeRule.js | 192 + .../rules/ValuesOfCorrectTypeRule.mjs | 173 + .../rules/VariablesAreInputTypesRule.d.ts | 13 + .../rules/VariablesAreInputTypesRule.js | 46 + .../rules/VariablesAreInputTypesRule.mjs | 33 + .../rules/VariablesInAllowedPositionRule.d.ts | 12 + .../rules/VariablesInAllowedPositionRule.js | 116 + .../rules/VariablesInAllowedPositionRule.mjs | 97 + .../rules/custom/NoDeprecatedCustomRule.d.ts | 15 + .../rules/custom/NoDeprecatedCustomRule.js | 131 + .../rules/custom/NoDeprecatedCustomRule.mjs | 117 + .../NoSchemaIntrospectionCustomRule.d.ts | 15 + .../custom/NoSchemaIntrospectionCustomRule.js | 41 + .../NoSchemaIntrospectionCustomRule.mjs | 32 + .../graphql/validation/specifiedRules.d.ts | 12 + .../graphql/validation/specifiedRules.js | 160 + .../graphql/validation/specifiedRules.mjs | 123 + .../graphql/validation/validate.d.ts | 61 + .../graphql/validation/validate.js | 151 + .../graphql/validation/validate.mjs | 133 + .../node_modules/graphql/version.d.ts | 13 + .../node_modules/graphql/version.js | 25 + .../node_modules/graphql/version.mjs | 17 + .../has-property-descriptors/.eslintrc | 13 + .../.github/FUNDING.yml | 12 + .../has-property-descriptors/.nycrc | 9 + .../has-property-descriptors/CHANGELOG.md | 35 + .../has-property-descriptors/LICENSE | 21 + .../has-property-descriptors/README.md | 43 + .../has-property-descriptors/index.js | 22 + .../has-property-descriptors/package.json | 77 + .../has-property-descriptors/test/index.js | 57 + .../node_modules/has-proto/.eslintrc | 5 + .../has-proto/.github/FUNDING.yml | 12 + .../node_modules/has-proto/CHANGELOG.md | 38 + .../node_modules/has-proto/LICENSE | 21 + .../node_modules/has-proto/README.md | 38 + .../node_modules/has-proto/index.d.ts | 3 + .../node_modules/has-proto/index.js | 15 + .../node_modules/has-proto/package.json | 78 + .../node_modules/has-proto/test/index.js | 19 + .../node_modules/has-proto/tsconfig.json | 49 + .../node_modules/has-symbols/.eslintrc | 11 + .../has-symbols/.github/FUNDING.yml | 12 + .../node_modules/has-symbols/.nycrc | 9 + .../node_modules/has-symbols/CHANGELOG.md | 75 + .../node_modules/has-symbols/LICENSE | 21 + .../node_modules/has-symbols/README.md | 46 + .../node_modules/has-symbols/index.js | 13 + .../node_modules/has-symbols/package.json | 101 + .../node_modules/has-symbols/shams.js | 42 + .../node_modules/has-symbols/test/index.js | 22 + .../has-symbols/test/shams/core-js.js | 28 + .../test/shams/get-own-property-symbols.js | 28 + .../node_modules/has-symbols/test/tests.js | 56 + .../node_modules/hasown/.eslintrc | 5 + .../node_modules/hasown/.github/FUNDING.yml | 12 + .../node_modules/hasown/.nycrc | 13 + .../node_modules/hasown/CHANGELOG.md | 40 + .../node_modules/hasown/LICENSE | 21 + .../node_modules/hasown/README.md | 40 + .../node_modules/hasown/index.d.ts | 3 + .../node_modules/hasown/index.js | 8 + .../node_modules/hasown/package.json | 92 + .../node_modules/hasown/tsconfig.json | 6 + .../node_modules/http-errors/HISTORY.md | 180 + .../node_modules/http-errors/LICENSE | 23 + .../node_modules/http-errors/README.md | 169 + .../node_modules/http-errors/index.js | 289 + .../node_modules/http-errors/package.json | 50 + .../node_modules/iconv-lite/Changelog.md | 162 + .../node_modules/iconv-lite/LICENSE | 21 + .../node_modules/iconv-lite/README.md | 156 + .../iconv-lite/encodings/dbcs-codec.js | 555 ++ .../iconv-lite/encodings/dbcs-data.js | 176 + .../iconv-lite/encodings/index.js | 22 + .../iconv-lite/encodings/internal.js | 188 + .../iconv-lite/encodings/sbcs-codec.js | 72 + .../encodings/sbcs-data-generated.js | 451 + .../iconv-lite/encodings/sbcs-data.js | 174 + .../encodings/tables/big5-added.json | 122 + .../iconv-lite/encodings/tables/cp936.json | 264 + .../iconv-lite/encodings/tables/cp949.json | 273 + .../iconv-lite/encodings/tables/cp950.json | 177 + .../iconv-lite/encodings/tables/eucjp.json | 182 + .../encodings/tables/gb18030-ranges.json | 1 + .../encodings/tables/gbk-added.json | 55 + .../iconv-lite/encodings/tables/shiftjis.json | 125 + .../iconv-lite/encodings/utf16.js | 177 + .../node_modules/iconv-lite/encodings/utf7.js | 290 + .../iconv-lite/lib/bom-handling.js | 52 + .../iconv-lite/lib/extend-node.js | 217 + .../node_modules/iconv-lite/lib/index.d.ts | 24 + .../node_modules/iconv-lite/lib/index.js | 153 + .../node_modules/iconv-lite/lib/streams.js | 121 + .../node_modules/iconv-lite/package.json | 46 + .../node_modules/inherits/LICENSE | 16 + .../node_modules/inherits/README.md | 42 + .../node_modules/inherits/inherits.js | 9 + .../node_modules/inherits/inherits_browser.js | 27 + .../node_modules/inherits/package.json | 29 + .../node_modules/ipaddr.js/LICENSE | 19 + .../node_modules/ipaddr.js/README.md | 233 + .../node_modules/ipaddr.js/ipaddr.min.js | 1 + .../node_modules/ipaddr.js/lib/ipaddr.js | 673 ++ .../node_modules/ipaddr.js/lib/ipaddr.js.d.ts | 68 + .../node_modules/ipaddr.js/package.json | 35 + .../node_modules/media-typer/HISTORY.md | 22 + .../node_modules/media-typer/LICENSE | 22 + .../node_modules/media-typer/README.md | 81 + .../node_modules/media-typer/index.js | 270 + .../node_modules/media-typer/package.json | 26 + .../node_modules/merge-descriptors/HISTORY.md | 21 + .../node_modules/merge-descriptors/LICENSE | 23 + .../node_modules/merge-descriptors/README.md | 48 + .../node_modules/merge-descriptors/index.js | 60 + .../merge-descriptors/package.json | 32 + .../node_modules/methods/HISTORY.md | 29 + .../node_modules/methods/LICENSE | 24 + .../node_modules/methods/README.md | 51 + .../node_modules/methods/index.js | 69 + .../node_modules/methods/package.json | 36 + .../node_modules/mime-db/HISTORY.md | 507 + .../node_modules/mime-db/LICENSE | 23 + .../node_modules/mime-db/README.md | 100 + .../node_modules/mime-db/db.json | 8519 ++++++++++++++++ .../node_modules/mime-db/index.js | 12 + .../node_modules/mime-db/package.json | 60 + .../node_modules/mime-types/HISTORY.md | 397 + .../node_modules/mime-types/LICENSE | 23 + .../node_modules/mime-types/README.md | 113 + .../node_modules/mime-types/index.js | 188 + .../node_modules/mime-types/package.json | 44 + .../node_modules/mime/.npmignore | 0 .../node_modules/mime/CHANGELOG.md | 164 + .../node_modules/mime/LICENSE | 21 + .../node_modules/mime/README.md | 90 + .../node_modules/mime/cli.js | 8 + .../node_modules/mime/mime.js | 108 + .../node_modules/mime/package.json | 44 + .../node_modules/mime/src/build.js | 53 + .../node_modules/mime/src/test.js | 60 + .../node_modules/mime/types.json | 1 + .../node_modules/ms/index.js | 152 + .../node_modules/ms/license.md | 21 + .../node_modules/ms/package.json | 37 + .../node_modules/ms/readme.md | 51 + .../node_modules/negotiator/HISTORY.md | 108 + .../node_modules/negotiator/LICENSE | 24 + .../node_modules/negotiator/README.md | 203 + .../node_modules/negotiator/index.js | 82 + .../node_modules/negotiator/lib/charset.js | 169 + .../node_modules/negotiator/lib/encoding.js | 184 + .../node_modules/negotiator/lib/language.js | 179 + .../node_modules/negotiator/lib/mediaType.js | 294 + .../node_modules/negotiator/package.json | 42 + .../node_modules/object-inspect/.eslintrc | 53 + .../object-inspect/.github/FUNDING.yml | 12 + .../node_modules/object-inspect/.nycrc | 13 + .../node_modules/object-inspect/CHANGELOG.md | 389 + .../node_modules/object-inspect/LICENSE | 21 + .../object-inspect/example/all.js | 23 + .../object-inspect/example/circular.js | 6 + .../node_modules/object-inspect/example/fn.js | 5 + .../object-inspect/example/inspect.js | 10 + .../node_modules/object-inspect/index.js | 524 + .../object-inspect/package-support.json | 20 + .../node_modules/object-inspect/package.json | 99 + .../object-inspect/readme.markdown | 86 + .../object-inspect/test-core-js.js | 26 + .../object-inspect/test/bigint.js | 58 + .../object-inspect/test/browser/dom.js | 15 + .../object-inspect/test/circular.js | 16 + .../node_modules/object-inspect/test/deep.js | 12 + .../object-inspect/test/element.js | 53 + .../node_modules/object-inspect/test/err.js | 48 + .../node_modules/object-inspect/test/fakes.js | 29 + .../node_modules/object-inspect/test/fn.js | 76 + .../object-inspect/test/global.js | 17 + .../node_modules/object-inspect/test/has.js | 15 + .../node_modules/object-inspect/test/holes.js | 15 + .../object-inspect/test/indent-option.js | 271 + .../object-inspect/test/inspect.js | 139 + .../object-inspect/test/lowbyte.js | 12 + .../object-inspect/test/number.js | 58 + .../object-inspect/test/quoteStyle.js | 17 + .../object-inspect/test/toStringTag.js | 40 + .../node_modules/object-inspect/test/undef.js | 12 + .../object-inspect/test/values.js | 211 + .../object-inspect/util.inspect.js | 1 + .../node_modules/on-finished/HISTORY.md | 98 + .../node_modules/on-finished/LICENSE | 23 + .../node_modules/on-finished/README.md | 162 + .../node_modules/on-finished/index.js | 234 + .../node_modules/on-finished/package.json | 39 + .../node_modules/parseurl/HISTORY.md | 58 + .../node_modules/parseurl/LICENSE | 24 + .../node_modules/parseurl/README.md | 133 + .../node_modules/parseurl/index.js | 158 + .../node_modules/parseurl/package.json | 40 + .../node_modules/path-to-regexp/History.md | 36 + .../node_modules/path-to-regexp/LICENSE | 21 + .../node_modules/path-to-regexp/Readme.md | 35 + .../node_modules/path-to-regexp/index.js | 129 + .../node_modules/path-to-regexp/package.json | 30 + .../node_modules/proxy-addr/HISTORY.md | 161 + .../node_modules/proxy-addr/LICENSE | 22 + .../node_modules/proxy-addr/README.md | 139 + .../node_modules/proxy-addr/index.js | 327 + .../node_modules/proxy-addr/package.json | 47 + .../node_modules/qs/.editorconfig | 43 + .../node_modules/qs/.eslintrc | 38 + .../node_modules/qs/.github/FUNDING.yml | 12 + .../node_modules/qs/.nycrc | 13 + .../node_modules/qs/CHANGELOG.md | 546 ++ .../node_modules/qs/LICENSE.md | 29 + .../node_modules/qs/README.md | 625 ++ .../node_modules/qs/dist/qs.js | 2054 ++++ .../node_modules/qs/lib/formats.js | 23 + .../node_modules/qs/lib/index.js | 11 + .../node_modules/qs/lib/parse.js | 263 + .../node_modules/qs/lib/stringify.js | 326 + .../node_modules/qs/lib/utils.js | 252 + .../node_modules/qs/package.json | 77 + .../node_modules/qs/test/parse.js | 855 ++ .../node_modules/qs/test/stringify.js | 909 ++ .../node_modules/qs/test/utils.js | 136 + .../node_modules/range-parser/HISTORY.md | 56 + .../node_modules/range-parser/LICENSE | 23 + .../node_modules/range-parser/README.md | 84 + .../node_modules/range-parser/index.js | 162 + .../node_modules/range-parser/package.json | 44 + .../node_modules/raw-body/HISTORY.md | 308 + .../node_modules/raw-body/LICENSE | 22 + .../node_modules/raw-body/README.md | 223 + .../node_modules/raw-body/SECURITY.md | 24 + .../node_modules/raw-body/index.d.ts | 87 + .../node_modules/raw-body/index.js | 336 + .../node_modules/raw-body/package.json | 49 + .../node_modules/safe-buffer/LICENSE | 21 + .../node_modules/safe-buffer/README.md | 584 ++ .../node_modules/safe-buffer/index.d.ts | 187 + .../node_modules/safe-buffer/index.js | 65 + .../node_modules/safe-buffer/package.json | 51 + .../node_modules/safer-buffer/LICENSE | 21 + .../safer-buffer/Porting-Buffer.md | 268 + .../node_modules/safer-buffer/Readme.md | 156 + .../node_modules/safer-buffer/dangerous.js | 58 + .../node_modules/safer-buffer/package.json | 34 + .../node_modules/safer-buffer/safer.js | 77 + .../node_modules/safer-buffer/tests.js | 406 + .../node_modules/send/HISTORY.md | 521 + .../node_modules/send/LICENSE | 23 + .../node_modules/send/README.md | 327 + .../node_modules/send/SECURITY.md | 24 + .../node_modules/send/index.js | 1143 +++ .../send/node_modules/ms/index.js | 162 + .../send/node_modules/ms/license.md | 21 + .../send/node_modules/ms/package.json | 38 + .../send/node_modules/ms/readme.md | 59 + .../node_modules/send/package.json | 62 + .../node_modules/serve-static/HISTORY.md | 471 + .../node_modules/serve-static/LICENSE | 25 + .../node_modules/serve-static/README.md | 257 + .../node_modules/serve-static/index.js | 210 + .../node_modules/serve-static/package.json | 42 + .../set-function-length/.eslintrc | 27 + .../set-function-length/.github/FUNDING.yml | 12 + .../node_modules/set-function-length/.nycrc | 13 + .../set-function-length/CHANGELOG.md | 70 + .../node_modules/set-function-length/LICENSE | 21 + .../set-function-length/README.md | 56 + .../node_modules/set-function-length/env.d.ts | 9 + .../node_modules/set-function-length/env.js | 25 + .../set-function-length/index.d.ts | 7 + .../node_modules/set-function-length/index.js | 42 + .../set-function-length/package.json | 102 + .../set-function-length/tsconfig.json | 9 + .../node_modules/setprototypeof/LICENSE | 13 + .../node_modules/setprototypeof/README.md | 31 + .../node_modules/setprototypeof/index.d.ts | 2 + .../node_modules/setprototypeof/index.js | 17 + .../node_modules/setprototypeof/package.json | 38 + .../node_modules/setprototypeof/test/index.js | 24 + .../node_modules/side-channel/.editorconfig | 9 + .../node_modules/side-channel/.eslintrc | 11 + .../side-channel/.github/FUNDING.yml | 12 + .../node_modules/side-channel/.nycrc | 13 + .../node_modules/side-channel/CHANGELOG.md | 95 + .../node_modules/side-channel/LICENSE | 21 + .../node_modules/side-channel/README.md | 2 + .../node_modules/side-channel/index.d.ts | 27 + .../node_modules/side-channel/index.js | 129 + .../node_modules/side-channel/package.json | 84 + .../node_modules/side-channel/test/index.js | 83 + .../node_modules/side-channel/tsconfig.json | 50 + .../node_modules/statuses/HISTORY.md | 82 + .../node_modules/statuses/LICENSE | 23 + .../node_modules/statuses/README.md | 136 + .../node_modules/statuses/codes.json | 65 + .../node_modules/statuses/index.js | 146 + .../node_modules/statuses/package.json | 49 + .../node_modules/toidentifier/HISTORY.md | 9 + .../node_modules/toidentifier/LICENSE | 21 + .../node_modules/toidentifier/README.md | 61 + .../node_modules/toidentifier/index.js | 32 + .../node_modules/toidentifier/package.json | 38 + .../node_modules/type-is/HISTORY.md | 259 + .../node_modules/type-is/LICENSE | 23 + .../node_modules/type-is/README.md | 170 + .../node_modules/type-is/index.js | 266 + .../node_modules/type-is/package.json | 45 + .../node_modules/unpipe/HISTORY.md | 4 + .../node_modules/unpipe/LICENSE | 22 + .../node_modules/unpipe/README.md | 43 + .../node_modules/unpipe/index.js | 69 + .../node_modules/unpipe/package.json | 27 + .../node_modules/utils-merge/.npmignore | 9 + .../node_modules/utils-merge/LICENSE | 20 + .../node_modules/utils-merge/README.md | 34 + .../node_modules/utils-merge/index.js | 23 + .../node_modules/utils-merge/package.json | 40 + .../node_modules/vary/HISTORY.md | 39 + .../node_modules/vary/LICENSE | 22 + .../node_modules/vary/README.md | 101 + .../node_modules/vary/index.js | 149 + .../node_modules/vary/package.json | 43 + .../node_modules/ws/LICENSE | 20 + .../node_modules/ws/README.md | 548 ++ .../node_modules/ws/browser.js | 8 + .../node_modules/ws/index.js | 13 + .../node_modules/ws/lib/buffer-util.js | 131 + .../node_modules/ws/lib/constants.js | 12 + .../node_modules/ws/lib/event-target.js | 292 + .../node_modules/ws/lib/extension.js | 203 + .../node_modules/ws/lib/limiter.js | 55 + .../node_modules/ws/lib/permessage-deflate.js | 514 + .../node_modules/ws/lib/receiver.js | 704 ++ .../node_modules/ws/lib/sender.js | 477 + .../node_modules/ws/lib/stream.js | 159 + .../node_modules/ws/lib/subprotocol.js | 62 + .../node_modules/ws/lib/validation.js | 130 + .../node_modules/ws/lib/websocket-server.js | 539 + .../node_modules/ws/lib/websocket.js | 1336 +++ .../node_modules/ws/package.json | 69 + .../node_modules/ws/wrapper.mjs | 8 + .../package-lock.json | 736 ++ graphql-subscription-express/package.json | 17 + graphql-subscription-express/server.js | 31 + .../subscriptionClient.js | 93 + .../graphql-subscription-client.js | 161 + .../node_modules/.bin/loose-envify | 1 + .../node_modules/.package-lock.json | 297 + .../@apollo/client/.changeset/README.md | 8 + .../@apollo/client/.changeset/config.json | 14 + .../node_modules/@apollo/client/CHANGELOG.md | 3734 +++++++ .../node_modules/@apollo/client/LICENSE | 22 + .../node_modules/@apollo/client/README.md | 51 + .../@apollo/client/apollo-client.cjs | 8661 +++++++++++++++++ .../@apollo/client/apollo-client.cjs.map | 1 + .../@apollo/client/apollo-client.min.cjs | 1 + .../@apollo/client/cache/cache.cjs | 2567 +++++ .../@apollo/client/cache/cache.cjs.map | 1 + .../@apollo/client/cache/cache.cjs.native.js | 2567 +++++ .../@apollo/client/cache/core/cache.d.ts | 52 + .../@apollo/client/cache/core/cache.js | 109 + .../@apollo/client/cache/core/cache.js.map | 1 + .../client/cache/core/types/Cache.d.ts | 62 + .../@apollo/client/cache/core/types/Cache.js | 4 + .../client/cache/core/types/Cache.js.map | 1 + .../client/cache/core/types/DataProxy.d.ts | 149 + .../client/cache/core/types/DataProxy.js | 2 + .../client/cache/core/types/DataProxy.js.map | 1 + .../client/cache/core/types/common.d.ts | 62 + .../@apollo/client/cache/core/types/common.js | 29 + .../client/cache/core/types/common.js.map | 1 + .../@apollo/client/cache/index.d.ts | 20 + .../@apollo/client/cache/index.js | 13 + .../@apollo/client/cache/index.js.map | 1 + .../client/cache/inmemory/entityStore.d.ts | 92 + .../client/cache/inmemory/entityStore.js | 671 ++ .../client/cache/inmemory/entityStore.js.map | 1 + .../client/cache/inmemory/fixPolyfills.d.ts | 1 + .../client/cache/inmemory/fixPolyfills.js | 10 + .../client/cache/inmemory/fixPolyfills.js.map | 1 + .../cache/inmemory/fixPolyfills.native.d.ts | 2 + .../cache/inmemory/fixPolyfills.native.js | 61 + .../cache/inmemory/fixPolyfills.native.js.map | 1 + .../cache/inmemory/fragmentRegistry.d.ts | 9 + .../client/cache/inmemory/fragmentRegistry.js | 140 + .../cache/inmemory/fragmentRegistry.js.map | 1 + .../client/cache/inmemory/helpers.d.ts | 28 + .../@apollo/client/cache/inmemory/helpers.js | 96 + .../client/cache/inmemory/helpers.js.map | 1 + .../client/cache/inmemory/inMemoryCache.d.ts | 63 + .../client/cache/inmemory/inMemoryCache.js | 472 + .../cache/inmemory/inMemoryCache.js.map | 1 + .../client/cache/inmemory/key-extractor.d.ts | 9 + .../client/cache/inmemory/key-extractor.js | 192 + .../cache/inmemory/key-extractor.js.map | 1 + .../client/cache/inmemory/object-canon.d.ts | 12 + .../client/cache/inmemory/object-canon.js | 181 + .../client/cache/inmemory/object-canon.js.map | 1 + .../client/cache/inmemory/policies.d.ts | 97 + .../@apollo/client/cache/inmemory/policies.js | 601 ++ .../client/cache/inmemory/policies.js.map | 1 + .../client/cache/inmemory/reactiveVars.d.ts | 18 + .../client/cache/inmemory/reactiveVars.js | 83 + .../client/cache/inmemory/reactiveVars.js.map | 1 + .../client/cache/inmemory/readFromStore.d.ts | 40 + .../client/cache/inmemory/readFromStore.js | 329 + .../cache/inmemory/readFromStore.js.map | 1 + .../@apollo/client/cache/inmemory/types.d.ts | 126 + .../@apollo/client/cache/inmemory/types.js | 2 + .../client/cache/inmemory/types.js.map | 1 + .../client/cache/inmemory/writeToStore.d.ts | 37 + .../client/cache/inmemory/writeToStore.js | 529 + .../client/cache/inmemory/writeToStore.js.map | 1 + .../@apollo/client/cache/package.json | 8 + .../@apollo/client/config/jest/setup.d.ts | 3 + .../@apollo/client/config/jest/setup.js | 25 + .../@apollo/client/config/jest/setup.js.map | 1 + .../@apollo/client/core/ApolloClient.d.ts | 430 + .../@apollo/client/core/ApolloClient.js | 508 + .../@apollo/client/core/ApolloClient.js.map | 1 + .../@apollo/client/core/LocalState.d.ts | 65 + .../@apollo/client/core/LocalState.js | 356 + .../@apollo/client/core/LocalState.js.map | 1 + .../@apollo/client/core/ObservableQuery.d.ts | 130 + .../@apollo/client/core/ObservableQuery.js | 803 ++ .../client/core/ObservableQuery.js.map | 1 + .../@apollo/client/core/QueryInfo.d.ts | 61 + .../@apollo/client/core/QueryInfo.js | 403 + .../@apollo/client/core/QueryInfo.js.map | 1 + .../@apollo/client/core/QueryManager.d.ts | 132 + .../@apollo/client/core/QueryManager.js | 1123 +++ .../@apollo/client/core/QueryManager.js.map | 1 + .../node_modules/@apollo/client/core/core.cjs | 2642 +++++ .../@apollo/client/core/core.cjs.map | 1 + .../@apollo/client/core/core.cjs.native.js | 2642 +++++ .../@apollo/client/core/equalByQuery.d.ts | 4 + .../@apollo/client/core/equalByQuery.js | 87 + .../@apollo/client/core/equalByQuery.js.map | 1 + .../@apollo/client/core/index.d.ts | 22 + .../node_modules/@apollo/client/core/index.js | 35 + .../@apollo/client/core/index.js.map | 1 + .../@apollo/client/core/networkStatus.d.ts | 51 + .../@apollo/client/core/networkStatus.js | 56 + .../@apollo/client/core/networkStatus.js.map | 1 + .../@apollo/client/core/package.json | 8 + .../@apollo/client/core/types.d.ts | 86 + .../node_modules/@apollo/client/core/types.js | 2 + .../@apollo/client/core/types.js.map | 1 + .../client/core/watchQueryOptions.d.ts | 450 + .../@apollo/client/core/watchQueryOptions.js | 2 + .../client/core/watchQueryOptions.js.map | 1 + .../node_modules/@apollo/client/dev/dev.cjs | 553 ++ .../@apollo/client/dev/dev.cjs.map | 1 + .../@apollo/client/dev/dev.cjs.native.js | 553 ++ .../@apollo/client/dev/index.d.ts | 4 + .../node_modules/@apollo/client/dev/index.js | 4 + .../@apollo/client/dev/index.js.map | 1 + .../@apollo/client/dev/loadDevMessages.d.ts | 2 + .../@apollo/client/dev/loadDevMessages.js | 6 + .../@apollo/client/dev/loadDevMessages.js.map | 1 + .../client/dev/loadErrorMessageHandler.d.ts | 3 + .../client/dev/loadErrorMessageHandler.js | 26 + .../client/dev/loadErrorMessageHandler.js.map | 1 + .../@apollo/client/dev/loadErrorMessages.d.ts | 2 + .../@apollo/client/dev/loadErrorMessages.js | 6 + .../client/dev/loadErrorMessages.js.map | 1 + .../@apollo/client/dev/package.json | 8 + .../@apollo/client/errors/errors.cjs | 51 + .../@apollo/client/errors/errors.cjs.map | 1 + .../client/errors/errors.cjs.native.js | 51 + .../@apollo/client/errors/index.d.ts | 39 + .../@apollo/client/errors/index.js | 55 + .../@apollo/client/errors/index.js.map | 1 + .../@apollo/client/errors/package.json | 8 + .../node_modules/@apollo/client/index.d.ts | 3 + .../node_modules/@apollo/client/index.js | 3 + .../node_modules/@apollo/client/index.js.map | 1 + .../@apollo/client/invariantErrorCodes.d.ts | 13 + .../@apollo/client/invariantErrorCodes.js | 528 + .../@apollo/client/invariantErrorCodes.js.map | 1 + .../client/link/batch-http/batch-http.cjs | 160 + .../client/link/batch-http/batch-http.cjs.map | 1 + .../link/batch-http/batch-http.cjs.native.js | 160 + .../client/link/batch-http/batchHttpLink.d.ts | 21 + .../client/link/batch-http/batchHttpLink.js | 187 + .../link/batch-http/batchHttpLink.js.map | 1 + .../@apollo/client/link/batch-http/index.d.ts | 2 + .../@apollo/client/link/batch-http/index.js | 2 + .../client/link/batch-http/index.js.map | 1 + .../client/link/batch-http/package.json | 8 + .../@apollo/client/link/batch/batch.cjs | 159 + .../@apollo/client/link/batch/batch.cjs.map | 1 + .../client/link/batch/batch.cjs.native.js | 159 + .../@apollo/client/link/batch/batchLink.d.ts | 42 + .../@apollo/client/link/batch/batchLink.js | 32 + .../client/link/batch/batchLink.js.map | 1 + .../@apollo/client/link/batch/batching.d.ts | 27 + .../@apollo/client/link/batch/batching.js | 148 + .../@apollo/client/link/batch/batching.js.map | 1 + .../@apollo/client/link/batch/index.d.ts | 2 + .../@apollo/client/link/batch/index.js | 2 + .../@apollo/client/link/batch/index.js.map | 1 + .../@apollo/client/link/batch/package.json | 8 + .../@apollo/client/link/context/context.cjs | 38 + .../client/link/context/context.cjs.map | 1 + .../client/link/context/context.cjs.native.js | 38 + .../@apollo/client/link/context/index.d.ts | 6 + .../@apollo/client/link/context/index.js | 32 + .../@apollo/client/link/context/index.js.map | 1 + .../@apollo/client/link/context/package.json | 8 + .../@apollo/client/link/core/ApolloLink.d.ts | 32 + .../@apollo/client/link/core/ApolloLink.js | 101 + .../client/link/core/ApolloLink.js.map | 1 + .../@apollo/client/link/core/concat.d.ts | 3 + .../@apollo/client/link/core/concat.js | 3 + .../@apollo/client/link/core/concat.js.map | 1 + .../@apollo/client/link/core/core.cjs | 115 + .../@apollo/client/link/core/core.cjs.map | 1 + .../client/link/core/core.cjs.native.js | 115 + .../@apollo/client/link/core/empty.d.ts | 3 + .../@apollo/client/link/core/empty.js | 3 + .../@apollo/client/link/core/empty.js.map | 1 + .../@apollo/client/link/core/execute.d.ts | 3 + .../@apollo/client/link/core/execute.js | 3 + .../@apollo/client/link/core/execute.js.map | 1 + .../@apollo/client/link/core/from.d.ts | 3 + .../@apollo/client/link/core/from.js | 3 + .../@apollo/client/link/core/from.js.map | 1 + .../@apollo/client/link/core/index.d.ts | 9 + .../@apollo/client/link/core/index.js | 9 + .../@apollo/client/link/core/index.js.map | 1 + .../@apollo/client/link/core/package.json | 8 + .../@apollo/client/link/core/split.d.ts | 3 + .../@apollo/client/link/core/split.js | 3 + .../@apollo/client/link/core/split.js.map | 1 + .../@apollo/client/link/core/types.d.ts | 56 + .../@apollo/client/link/core/types.js | 2 + .../@apollo/client/link/core/types.js.map | 1 + .../@apollo/client/link/error/error.cjs | 90 + .../@apollo/client/link/error/error.cjs.map | 1 + .../client/link/error/error.cjs.native.js | 90 + .../@apollo/client/link/error/index.d.ts | 28 + .../@apollo/client/link/error/index.js | 86 + .../@apollo/client/link/error/index.js.map | 1 + .../@apollo/client/link/error/package.json | 8 + .../@apollo/client/link/http/HttpLink.d.ts | 7 + .../@apollo/client/link/http/HttpLink.js | 15 + .../@apollo/client/link/http/HttpLink.js.map | 1 + .../client/link/http/checkFetcher.d.ts | 2 + .../@apollo/client/link/http/checkFetcher.js | 7 + .../client/link/http/checkFetcher.js.map | 1 + .../client/link/http/createHttpLink.d.ts | 4 + .../client/link/http/createHttpLink.js | 156 + .../client/link/http/createHttpLink.js.map | 1 + .../link/http/createSignalIfSupported.d.ts | 13 + .../link/http/createSignalIfSupported.js | 13 + .../link/http/createSignalIfSupported.js.map | 1 + .../@apollo/client/link/http/http.cjs | 631 ++ .../@apollo/client/link/http/http.cjs.map | 1 + .../client/link/http/http.cjs.native.js | 631 ++ .../@apollo/client/link/http/index.d.ts | 14 + .../@apollo/client/link/http/index.js | 12 + .../@apollo/client/link/http/index.js.map | 1 + .../client/link/http/iterators/async.d.ts | 6 + .../client/link/http/iterators/async.js | 18 + .../client/link/http/iterators/async.js.map | 1 + .../link/http/iterators/nodeStream.d.ts | 8 + .../client/link/http/iterators/nodeStream.js | 75 + .../link/http/iterators/nodeStream.js.map | 1 + .../client/link/http/iterators/promise.d.ts | 6 + .../client/link/http/iterators/promise.js | 32 + .../client/link/http/iterators/promise.js.map | 1 + .../client/link/http/iterators/reader.d.ts | 6 + .../client/link/http/iterators/reader.js | 19 + .../client/link/http/iterators/reader.js.map | 1 + .../@apollo/client/link/http/package.json | 8 + .../link/http/parseAndCheckHttpResponse.d.ts | 13 + .../link/http/parseAndCheckHttpResponse.js | 187 + .../http/parseAndCheckHttpResponse.js.map | 1 + .../client/link/http/responseIterator.d.ts | 7 + .../client/link/http/responseIterator.js | 48 + .../client/link/http/responseIterator.js.map | 1 + .../client/link/http/rewriteURIForGET.d.ts | 9 + .../client/link/http/rewriteURIForGET.js | 53 + .../client/link/http/rewriteURIForGET.js.map | 1 + .../link/http/selectHttpOptionsAndBody.d.ts | 103 + .../link/http/selectHttpOptionsAndBody.js | 102 + .../link/http/selectHttpOptionsAndBody.js.map | 1 + .../@apollo/client/link/http/selectURI.d.ts | 3 + .../@apollo/client/link/http/selectURI.js | 14 + .../@apollo/client/link/http/selectURI.js.map | 1 + .../link/http/serializeFetchParameter.d.ts | 6 + .../link/http/serializeFetchParameter.js | 14 + .../link/http/serializeFetchParameter.js.map | 1 + .../client/link/persisted-queries/index.d.ts | 48 + .../client/link/persisted-queries/index.js | 219 + .../link/persisted-queries/index.js.map | 1 + .../link/persisted-queries/package.json | 8 + .../persisted-queries/persisted-queries.cjs | 194 + .../persisted-queries.cjs.map | 1 + .../persisted-queries.cjs.native.js | 194 + .../client/link/remove-typename/index.d.ts | 3 + .../client/link/remove-typename/index.js | 2 + .../client/link/remove-typename/index.js.map | 1 + .../client/link/remove-typename/package.json | 8 + .../link/remove-typename/remove-typename.cjs | 100 + .../remove-typename/remove-typename.cjs.map | 1 + .../remove-typename.cjs.native.js | 100 + .../removeTypenameFromVariables.d.ts | 19 + .../removeTypenameFromVariables.js | 92 + .../removeTypenameFromVariables.js.map | 1 + .../client/link/retry/delayFunction.d.ts | 40 + .../client/link/retry/delayFunction.js | 18 + .../client/link/retry/delayFunction.js.map | 1 + .../@apollo/client/link/retry/index.d.ts | 2 + .../@apollo/client/link/retry/index.js | 2 + .../@apollo/client/link/retry/index.js.map | 1 + .../@apollo/client/link/retry/package.json | 8 + .../@apollo/client/link/retry/retry.cjs | 111 + .../@apollo/client/link/retry/retry.cjs.map | 1 + .../client/link/retry/retry.cjs.native.js | 111 + .../client/link/retry/retryFunction.d.ts | 30 + .../client/link/retry/retryFunction.js | 9 + .../client/link/retry/retryFunction.js.map | 1 + .../@apollo/client/link/retry/retryLink.d.ts | 24 + .../@apollo/client/link/retry/retryLink.js | 92 + .../client/link/retry/retryLink.js.map | 1 + .../@apollo/client/link/schema/index.d.ts | 36 + .../@apollo/client/link/schema/index.js | 55 + .../@apollo/client/link/schema/index.js.map | 1 + .../@apollo/client/link/schema/package.json | 8 + .../@apollo/client/link/schema/schema.cjs | 61 + .../@apollo/client/link/schema/schema.cjs.map | 1 + .../client/link/schema/schema.cjs.native.js | 61 + .../client/link/subscriptions/index.d.ts | 10 + .../client/link/subscriptions/index.js | 77 + .../client/link/subscriptions/index.js.map | 1 + .../client/link/subscriptions/package.json | 8 + .../link/subscriptions/subscriptions.cjs | 50 + .../link/subscriptions/subscriptions.cjs.map | 1 + .../subscriptions/subscriptions.cjs.native.js | 50 + .../client/link/utils/createOperation.d.ts | 3 + .../client/link/utils/createOperation.js | 23 + .../client/link/utils/createOperation.js.map | 1 + .../link/utils/filterOperationVariables.d.ts | 5 + .../link/utils/filterOperationVariables.js | 23 + .../utils/filterOperationVariables.js.map | 1 + .../@apollo/client/link/utils/fromError.d.ts | 3 + .../@apollo/client/link/utils/fromError.js | 7 + .../client/link/utils/fromError.js.map | 1 + .../client/link/utils/fromPromise.d.ts | 3 + .../@apollo/client/link/utils/fromPromise.js | 12 + .../client/link/utils/fromPromise.js.map | 1 + .../@apollo/client/link/utils/index.d.ts | 11 + .../@apollo/client/link/utils/index.js | 10 + .../@apollo/client/link/utils/index.js.map | 1 + .../@apollo/client/link/utils/package.json | 8 + .../client/link/utils/throwServerError.d.ts | 7 + .../client/link/utils/throwServerError.js | 9 + .../client/link/utils/throwServerError.js.map | 1 + .../@apollo/client/link/utils/toPromise.d.ts | 3 + .../@apollo/client/link/utils/toPromise.js | 19 + .../client/link/utils/toPromise.js.map | 1 + .../client/link/utils/transformOperation.d.ts | 3 + .../client/link/utils/transformOperation.js | 18 + .../link/utils/transformOperation.js.map | 1 + .../@apollo/client/link/utils/utils.cjs | 134 + .../@apollo/client/link/utils/utils.cjs.map | 1 + .../client/link/utils/utils.cjs.native.js | 134 + .../client/link/utils/validateOperation.d.ts | 3 + .../client/link/utils/validateOperation.js | 18 + .../link/utils/validateOperation.js.map | 1 + .../@apollo/client/link/ws/index.d.ts | 31 + .../@apollo/client/link/ws/index.js | 22 + .../@apollo/client/link/ws/index.js.map | 1 + .../@apollo/client/link/ws/package.json | 8 + .../@apollo/client/link/ws/ws.cjs | 28 + .../@apollo/client/link/ws/ws.cjs.map | 1 + .../@apollo/client/link/ws/ws.cjs.native.js | 28 + .../node_modules/@apollo/client/main.cjs | 16 + .../node_modules/@apollo/client/main.cjs.map | 1 + .../@apollo/client/main.cjs.native.js | 16 + .../node_modules/@apollo/client/package.json | 161 + .../client/react/components/Mutation.d.ts | 18 + .../client/react/components/Mutation.js | 28 + .../client/react/components/Mutation.js.map | 1 + .../client/react/components/Query.d.ts | 18 + .../@apollo/client/react/components/Query.js | 29 + .../client/react/components/Query.js.map | 1 + .../client/react/components/Subscription.d.ts | 18 + .../client/react/components/Subscription.js | 23 + .../react/components/Subscription.js.map | 1 + .../client/react/components/components.cjs | 81 + .../react/components/components.cjs.map | 1 + .../react/components/components.cjs.native.js | 81 + .../client/react/components/index.d.ts | 5 + .../@apollo/client/react/components/index.js | 5 + .../client/react/components/index.js.map | 1 + .../client/react/components/package.json | 8 + .../client/react/components/types.d.ts | 21 + .../@apollo/client/react/components/types.js | 2 + .../client/react/components/types.js.map | 1 + .../client/react/context/ApolloConsumer.d.ts | 7 + .../client/react/context/ApolloConsumer.js | 11 + .../react/context/ApolloConsumer.js.map | 1 + .../client/react/context/ApolloContext.d.ts | 15 + .../client/react/context/ApolloContext.js | 29 + .../client/react/context/ApolloContext.js.map | 1 + .../client/react/context/ApolloProvider.d.ts | 8 + .../client/react/context/ApolloProvider.js | 15 + .../react/context/ApolloProvider.js.map | 1 + .../@apollo/client/react/context/context.cjs | 64 + .../client/react/context/context.cjs.map | 1 + .../react/context/context.cjs.native.js | 64 + .../@apollo/client/react/context/index.d.ts | 8 + .../@apollo/client/react/context/index.js | 5 + .../@apollo/client/react/context/index.js.map | 1 + .../@apollo/client/react/context/package.json | 8 + .../@apollo/client/react/hoc/graphql.d.ts | 11 + .../@apollo/client/react/hoc/graphql.js | 22 + .../@apollo/client/react/hoc/graphql.js.map | 1 + .../@apollo/client/react/hoc/hoc-utils.d.ts | 18 + .../@apollo/client/react/hoc/hoc-utils.js | 48 + .../@apollo/client/react/hoc/hoc-utils.js.map | 1 + .../@apollo/client/react/hoc/hoc.cjs | 316 + .../@apollo/client/react/hoc/hoc.cjs.map | 1 + .../client/react/hoc/hoc.cjs.native.js | 316 + .../@apollo/client/react/hoc/index.d.ts | 8 + .../@apollo/client/react/hoc/index.js | 8 + .../@apollo/client/react/hoc/index.js.map | 1 + .../client/react/hoc/mutation-hoc.d.ts | 12 + .../@apollo/client/react/hoc/mutation-hoc.js | 75 + .../client/react/hoc/mutation-hoc.js.map | 1 + .../@apollo/client/react/hoc/package.json | 8 + .../@apollo/client/react/hoc/query-hoc.d.ts | 10 + .../@apollo/client/react/hoc/query-hoc.js | 81 + .../@apollo/client/react/hoc/query-hoc.js.map | 1 + .../client/react/hoc/subscription-hoc.d.ts | 10 + .../client/react/hoc/subscription-hoc.js | 90 + .../client/react/hoc/subscription-hoc.js.map | 1 + .../@apollo/client/react/hoc/types.d.ts | 43 + .../@apollo/client/react/hoc/types.js | 2 + .../@apollo/client/react/hoc/types.js.map | 1 + .../@apollo/client/react/hoc/withApollo.d.ts | 9 + .../@apollo/client/react/hoc/withApollo.js | 48 + .../client/react/hoc/withApollo.js.map | 1 + .../@apollo/client/react/hooks/constants.d.ts | 3 + .../@apollo/client/react/hooks/constants.js | 2 + .../client/react/hooks/constants.js.map | 1 + .../@apollo/client/react/hooks/hooks.cjs | 1045 ++ .../@apollo/client/react/hooks/hooks.cjs.map | 1 + .../client/react/hooks/hooks.cjs.native.js | 1045 ++ .../@apollo/client/react/hooks/index.d.ts | 21 + .../@apollo/client/react/hooks/index.js | 15 + .../@apollo/client/react/hooks/index.js.map | 1 + .../client/react/hooks/internal/__use.d.ts | 4 + .../client/react/hooks/internal/__use.js | 22 + .../client/react/hooks/internal/__use.js.map | 1 + .../client/react/hooks/internal/index.d.ts | 6 + .../client/react/hooks/internal/index.js | 7 + .../client/react/hooks/internal/index.js.map | 1 + .../react/hooks/internal/useDeepMemo.d.ts | 3 + .../react/hooks/internal/useDeepMemo.js | 10 + .../react/hooks/internal/useDeepMemo.js.map | 1 + .../internal/useIsomorphicLayoutEffect.d.ts | 4 + .../internal/useIsomorphicLayoutEffect.js | 9 + .../internal/useIsomorphicLayoutEffect.js.map | 1 + .../react/hooks/internal/useLazyRef.d.ts | 4 + .../client/react/hooks/internal/useLazyRef.js | 10 + .../react/hooks/internal/useLazyRef.js.map | 1 + .../react/hooks/internal/useRenderGuard.d.ts | 2 + .../react/hooks/internal/useRenderGuard.js | 17 + .../hooks/internal/useRenderGuard.js.map | 1 + .../@apollo/client/react/hooks/package.json | 8 + .../client/react/hooks/useApolloClient.d.ts | 18 + .../client/react/hooks/useApolloClient.js | 25 + .../client/react/hooks/useApolloClient.js.map | 1 + .../react/hooks/useBackgroundQuery.d.ts | 64 + .../client/react/hooks/useBackgroundQuery.js | 52 + .../react/hooks/useBackgroundQuery.js.map | 1 + .../client/react/hooks/useFragment.d.ts | 28 + .../@apollo/client/react/hooks/useFragment.js | 48 + .../client/react/hooks/useFragment.js.map | 1 + .../client/react/hooks/useLazyQuery.d.ts | 41 + .../client/react/hooks/useLazyQuery.js | 107 + .../client/react/hooks/useLazyQuery.js.map | 1 + .../client/react/hooks/useLoadableQuery.d.ts | 97 + .../client/react/hooks/useLoadableQuery.js | 59 + .../react/hooks/useLoadableQuery.js.map | 1 + .../client/react/hooks/useMutation.d.ts | 53 + .../@apollo/client/react/hooks/useMutation.js | 163 + .../client/react/hooks/useMutation.js.map | 1 + .../@apollo/client/react/hooks/useQuery.d.ts | 87 + .../@apollo/client/react/hooks/useQuery.js | 467 + .../client/react/hooks/useQuery.js.map | 1 + .../react/hooks/useQueryRefHandlers.d.ts | 36 + .../client/react/hooks/useQueryRefHandlers.js | 48 + .../react/hooks/useQueryRefHandlers.js.map | 1 + .../client/react/hooks/useReactiveVar.d.ts | 20 + .../client/react/hooks/useReactiveVar.js | 33 + .../client/react/hooks/useReactiveVar.js.map | 1 + .../client/react/hooks/useReadQuery.d.ts | 29 + .../client/react/hooks/useReadQuery.js | 29 + .../client/react/hooks/useReadQuery.js.map | 1 + .../client/react/hooks/useSubscription.d.ts | 91 + .../client/react/hooks/useSubscription.js | 239 + .../client/react/hooks/useSubscription.js.map | 1 + .../client/react/hooks/useSuspenseQuery.d.ts | 54 + .../client/react/hooks/useSuspenseQuery.js | 131 + .../react/hooks/useSuspenseQuery.js.map | 1 + .../react/hooks/useSyncExternalStore.d.ts | 4 + .../react/hooks/useSyncExternalStore.js | 103 + .../react/hooks/useSyncExternalStore.js.map | 1 + .../@apollo/client/react/index.d.ts | 10 + .../@apollo/client/react/index.js | 7 + .../@apollo/client/react/index.js.map | 1 + .../react/internal/cache/QueryReference.d.ts | 100 + .../react/internal/cache/QueryReference.js | 279 + .../internal/cache/QueryReference.js.map | 1 + .../react/internal/cache/SuspenseCache.d.ts | 23 + .../react/internal/cache/SuspenseCache.js | 25 + .../react/internal/cache/SuspenseCache.js.map | 1 + .../internal/cache/getSuspenseCache.d.ts | 16 + .../react/internal/cache/getSuspenseCache.js | 10 + .../internal/cache/getSuspenseCache.js.map | 1 + .../client/react/internal/cache/types.d.ts | 10 + .../client/react/internal/cache/types.js | 2 + .../client/react/internal/cache/types.js.map | 1 + .../@apollo/client/react/internal/index.d.ts | 6 + .../@apollo/client/react/internal/index.js | 3 + .../client/react/internal/index.js.map | 1 + .../client/react/internal/internal.cjs | 284 + .../client/react/internal/internal.cjs.map | 1 + .../react/internal/internal.cjs.native.js | 284 + .../client/react/internal/package.json | 8 + .../@apollo/client/react/package.json | 8 + .../@apollo/client/react/parser/index.d.ts | 18 + .../@apollo/client/react/parser/index.js | 109 + .../@apollo/client/react/parser/index.js.map | 1 + .../@apollo/client/react/parser/package.json | 8 + .../@apollo/client/react/parser/parser.cjs | 122 + .../client/react/parser/parser.cjs.map | 1 + .../client/react/parser/parser.cjs.native.js | 122 + .../query-preloader/createQueryPreloader.d.ts | 285 + .../query-preloader/createQueryPreloader.js | 32 + .../createQueryPreloader.js.map | 1 + .../@apollo/client/react/react.cjs | 34 + .../@apollo/client/react/react.cjs.map | 1 + .../@apollo/client/react/react.cjs.native.js | 34 + .../client/react/ssr/RenderPromises.d.ts | 22 + .../client/react/ssr/RenderPromises.js | 112 + .../client/react/ssr/RenderPromises.js.map | 1 + .../client/react/ssr/getDataFromTree.d.ts | 13 + .../client/react/ssr/getDataFromTree.js | 49 + .../client/react/ssr/getDataFromTree.js.map | 1 + .../@apollo/client/react/ssr/index.d.ts | 4 + .../@apollo/client/react/ssr/index.js | 4 + .../@apollo/client/react/ssr/index.js.map | 1 + .../@apollo/client/react/ssr/package.json | 8 + .../react/ssr/renderToStringWithData.d.ts | 3 + .../react/ssr/renderToStringWithData.js | 9 + .../react/ssr/renderToStringWithData.js.map | 1 + .../@apollo/client/react/ssr/ssr.cjs | 157 + .../@apollo/client/react/ssr/ssr.cjs.map | 1 + .../client/react/ssr/ssr.cjs.native.js | 157 + .../@apollo/client/react/types/types.d.ts | 756 ++ .../react/types/types.documentation.d.ts | 559 ++ .../client/react/types/types.documentation.js | 2 + .../react/types/types.documentation.js.map | 1 + .../@apollo/client/react/types/types.js | 2 + .../@apollo/client/react/types/types.js.map | 1 + .../@apollo/client/testing/core/core.cjs | 353 + .../@apollo/client/testing/core/core.cjs.map | 1 + .../client/testing/core/core.cjs.native.js | 353 + .../@apollo/client/testing/core/index.d.ts | 9 + .../@apollo/client/testing/core/index.js | 8 + .../@apollo/client/testing/core/index.js.map | 1 + .../@apollo/client/testing/core/itAsync.d.ts | 6 + .../@apollo/client/testing/core/itAsync.js | 23 + .../client/testing/core/itAsync.js.map | 1 + .../testing/core/mocking/mockClient.d.ts | 5 + .../client/testing/core/mocking/mockClient.js | 16 + .../testing/core/mocking/mockClient.js.map | 1 + .../testing/core/mocking/mockFetch.d.ts | 24 + .../client/testing/core/mocking/mockFetch.js | 87 + .../testing/core/mocking/mockFetch.js.map | 1 + .../client/testing/core/mocking/mockLink.d.ts | 33 + .../client/testing/core/mocking/mockLink.js | 180 + .../testing/core/mocking/mockLink.js.map | 1 + .../core/mocking/mockQueryManager.d.ts | 5 + .../testing/core/mocking/mockQueryManager.js | 16 + .../core/mocking/mockQueryManager.js.map | 1 + .../core/mocking/mockSubscriptionLink.d.ts | 25 + .../core/mocking/mockSubscriptionLink.js | 62 + .../core/mocking/mockSubscriptionLink.js.map | 1 + .../testing/core/mocking/mockWatchQuery.d.ts | 5 + .../testing/core/mocking/mockWatchQuery.js | 15 + .../core/mocking/mockWatchQuery.js.map | 1 + .../testing/core/observableToPromise.d.ts | 29 + .../testing/core/observableToPromise.js | 74 + .../testing/core/observableToPromise.js.map | 1 + .../@apollo/client/testing/core/package.json | 8 + .../testing/core/subscribeAndCount.d.ts | 3 + .../client/testing/core/subscribeAndCount.js | 21 + .../testing/core/subscribeAndCount.js.map | 1 + .../@apollo/client/testing/core/wait.d.ts | 3 + .../@apollo/client/testing/core/wait.js | 16 + .../@apollo/client/testing/core/wait.js.map | 1 + .../client/testing/core/withConsoleSpy.d.ts | 7 + .../client/testing/core/withConsoleSpy.js | 45 + .../client/testing/core/withConsoleSpy.js.map | 1 + .../@apollo/client/testing/core/wrap.d.ts | 4 + .../@apollo/client/testing/core/wrap.js | 30 + .../@apollo/client/testing/core/wrap.js.map | 1 + .../@apollo/client/testing/index.d.ts | 5 + .../@apollo/client/testing/index.js | 4 + .../@apollo/client/testing/index.js.map | 1 + .../testing/internal/ObservableStream.d.ts | 26 + .../testing/internal/ObservableStream.js | 109 + .../testing/internal/ObservableStream.js.map | 1 + .../disposables/disableActWarnings.d.ts | 10 + .../disposables/disableActWarnings.js | 15 + .../disposables/disableActWarnings.js.map | 1 + .../testing/internal/disposables/index.d.ts | 4 + .../testing/internal/disposables/index.js | 4 + .../testing/internal/disposables/index.js.map | 1 + .../internal/disposables/spyOnConsole.d.ts | 11 + .../internal/disposables/spyOnConsole.js | 35 + .../internal/disposables/spyOnConsole.js.map | 1 + .../internal/disposables/withCleanup.d.ts | 4 + .../internal/disposables/withCleanup.js | 14 + .../internal/disposables/withCleanup.js.map | 1 + .../client/testing/internal/index.d.ts | 8 + .../@apollo/client/testing/internal/index.js | 6 + .../client/testing/internal/index.js.map | 1 + .../testing/internal/profile/Render.d.ts | 171 + .../client/testing/internal/profile/Render.js | 144 + .../testing/internal/profile/Render.js.map | 1 + .../testing/internal/profile/context.d.ts | 10 + .../testing/internal/profile/context.js | 14 + .../testing/internal/profile/context.js.map | 1 + .../testing/internal/profile/index.d.ts | 4 + .../client/testing/internal/profile/index.js | 2 + .../testing/internal/profile/index.js.map | 1 + .../testing/internal/profile/profile.d.ts | 109 + .../testing/internal/profile/profile.js | 296 + .../testing/internal/profile/profile.js.map | 1 + .../testing/internal/profile/traces.d.ts | 7 + .../client/testing/internal/profile/traces.js | 30 + .../testing/internal/profile/traces.js.map | 1 + .../testing/internal/renderHelpers.d.ts | 12 + .../client/testing/internal/renderHelpers.js | 22 + .../testing/internal/renderHelpers.js.map | 1 + .../testing/internal/scenarios/index.d.ts | 41 + .../testing/internal/scenarios/index.js | 48 + .../testing/internal/scenarios/index.js.map | 1 + .../testing/matchers/ProfiledComponent.d.ts | 8 + .../testing/matchers/ProfiledComponent.js | 110 + .../testing/matchers/ProfiledComponent.js.map | 1 + .../client/testing/matchers/index.d.ts | 2 + .../@apollo/client/testing/matchers/index.js | 15 + .../client/testing/matchers/index.js.map | 1 + .../client/testing/matchers/toBeDisposed.d.ts | 3 + .../client/testing/matchers/toBeDisposed.js | 26 + .../testing/matchers/toBeDisposed.js.map | 1 + .../matchers/toBeGarbageCollected.d.ts | 8 + .../testing/matchers/toBeGarbageCollected.js | 48 + .../matchers/toBeGarbageCollected.js.map | 1 + .../toHaveSuspenseCacheEntryUsing.d.ts | 11 + .../matchers/toHaveSuspenseCacheEntryUsing.js | 24 + .../toHaveSuspenseCacheEntryUsing.js.map | 1 + .../testing/matchers/toMatchDocument.d.ts | 4 + .../testing/matchers/toMatchDocument.js | 33 + .../testing/matchers/toMatchDocument.js.map | 1 + .../@apollo/client/testing/package.json | 8 + .../client/testing/react/MockedProvider.d.ts | 33 + .../client/testing/react/MockedProvider.js | 42 + .../testing/react/MockedProvider.js.map | 1 + .../@apollo/client/testing/testing.cjs | 64 + .../@apollo/client/testing/testing.cjs.map | 1 + .../client/testing/testing.cjs.native.js | 64 + .../client/utilities/caching/caches.d.ts | 34 + .../client/utilities/caching/caches.js | 64 + .../client/utilities/caching/caches.js.map | 1 + .../utilities/caching/getMemoryInternals.d.ts | 76 + .../utilities/caching/getMemoryInternals.js | 112 + .../caching/getMemoryInternals.js.map | 1 + .../client/utilities/caching/index.d.ts | 4 + .../@apollo/client/utilities/caching/index.js | 3 + .../client/utilities/caching/index.js.map | 1 + .../client/utilities/caching/sizes.d.ts | 311 + .../@apollo/client/utilities/caching/sizes.js | 27 + .../client/utilities/caching/sizes.js.map | 1 + .../client/utilities/common/arrays.d.ts | 3 + .../@apollo/client/utilities/common/arrays.js | 6 + .../client/utilities/common/arrays.js.map | 1 + .../client/utilities/common/canUse.d.ts | 7 + .../@apollo/client/utilities/common/canUse.js | 25 + .../client/utilities/common/canUse.js.map | 1 + .../utilities/common/canonicalStringify.d.ts | 21 + .../utilities/common/canonicalStringify.js | 84 + .../common/canonicalStringify.js.map | 1 + .../client/utilities/common/cloneDeep.d.ts | 5 + .../client/utilities/common/cloneDeep.js | 38 + .../client/utilities/common/cloneDeep.js.map | 1 + .../client/utilities/common/compact.d.ts | 7 + .../client/utilities/common/compact.js | 23 + .../client/utilities/common/compact.js.map | 1 + .../utilities/common/errorHandling.d.ts | 4 + .../client/utilities/common/errorHandling.js | 19 + .../utilities/common/errorHandling.js.map | 1 + .../utilities/common/incrementalResult.d.ts | 7 + .../utilities/common/incrementalResult.js | 39 + .../utilities/common/incrementalResult.js.map | 1 + .../client/utilities/common/makeUniqueId.d.ts | 2 + .../client/utilities/common/makeUniqueId.js | 9 + .../utilities/common/makeUniqueId.js.map | 1 + .../utilities/common/maybeDeepFreeze.d.ts | 2 + .../utilities/common/maybeDeepFreeze.js | 36 + .../utilities/common/maybeDeepFreeze.js.map | 1 + .../client/utilities/common/mergeDeep.d.ts | 14 + .../client/utilities/common/mergeDeep.js | 89 + .../client/utilities/common/mergeDeep.js.map | 1 + .../client/utilities/common/mergeOptions.d.ts | 5 + .../client/utilities/common/mergeOptions.js | 8 + .../utilities/common/mergeOptions.js.map | 1 + .../client/utilities/common/objects.d.ts | 3 + .../client/utilities/common/objects.js | 10 + .../client/utilities/common/objects.js.map | 1 + .../client/utilities/common/omitDeep.d.ts | 3 + .../client/utilities/common/omitDeep.js | 41 + .../client/utilities/common/omitDeep.js.map | 1 + .../utilities/common/stringifyForDisplay.d.ts | 2 + .../utilities/common/stringifyForDisplay.js | 11 + .../common/stringifyForDisplay.js.map | 1 + .../utilities/common/stripTypename.d.ts | 2 + .../client/utilities/common/stripTypename.js | 5 + .../utilities/common/stripTypename.js.map | 1 + .../client/utilities/globals/global.d.ts | 8 + .../client/utilities/globals/global.js | 14 + .../client/utilities/globals/global.js.map | 1 + .../client/utilities/globals/globals.cjs | 111 + .../client/utilities/globals/globals.cjs.map | 1 + .../utilities/globals/globals.cjs.native.js | 111 + .../client/utilities/globals/index.d.ts | 11 + .../@apollo/client/utilities/globals/index.js | 14 + .../client/utilities/globals/index.js.map | 1 + .../utilities/globals/invariantWrappers.d.ts | 64 + .../utilities/globals/invariantWrappers.js | 76 + .../globals/invariantWrappers.js.map | 1 + .../client/utilities/globals/maybe.d.ts | 2 + .../@apollo/client/utilities/globals/maybe.js | 7 + .../client/utilities/globals/maybe.js.map | 1 + .../client/utilities/globals/package.json | 8 + .../utilities/graphql/DocumentTransform.d.ts | 50 + .../utilities/graphql/DocumentTransform.js | 94 + .../graphql/DocumentTransform.js.map | 1 + .../client/utilities/graphql/directives.d.ts | 18 + .../client/utilities/graphql/directives.js | 78 + .../utilities/graphql/directives.js.map | 1 + .../client/utilities/graphql/fragments.d.ts | 34 + .../client/utilities/graphql/fragments.js | 103 + .../client/utilities/graphql/fragments.js.map | 1 + .../client/utilities/graphql/getFromAST.d.ts | 15 + .../client/utilities/graphql/getFromAST.js | 89 + .../utilities/graphql/getFromAST.js.map | 1 + .../client/utilities/graphql/operations.d.ts | 5 + .../client/utilities/graphql/operations.js | 15 + .../utilities/graphql/operations.js.map | 1 + .../client/utilities/graphql/print.d.ts | 5 + .../@apollo/client/utilities/graphql/print.js | 21 + .../client/utilities/graphql/print.js.map | 1 + .../client/utilities/graphql/storeUtils.d.ts | 51 + .../client/utilities/graphql/storeUtils.js | 213 + .../utilities/graphql/storeUtils.js.map | 1 + .../client/utilities/graphql/transform.d.ts | 27 + .../client/utilities/graphql/transform.js | 482 + .../client/utilities/graphql/transform.js.map | 1 + .../@apollo/client/utilities/index.d.ts | 45 + .../@apollo/client/utilities/index.js | 34 + .../@apollo/client/utilities/index.js.map | 1 + .../client/utilities/observables/Concast.d.ts | 28 + .../client/utilities/observables/Concast.js | 216 + .../utilities/observables/Concast.js.map | 1 + .../utilities/observables/Observable.d.ts | 6 + .../utilities/observables/Observable.js | 17 + .../utilities/observables/Observable.js.map | 1 + .../utilities/observables/asyncMap.d.ts | 3 + .../client/utilities/observables/asyncMap.js | 44 + .../utilities/observables/asyncMap.js.map | 1 + .../utilities/observables/iteration.d.ts | 3 + .../client/utilities/observables/iteration.js | 9 + .../utilities/observables/iteration.js.map | 1 + .../utilities/observables/subclassing.d.ts | 3 + .../utilities/observables/subclassing.js | 27 + .../utilities/observables/subclassing.js.map | 1 + .../@apollo/client/utilities/package.json | 8 + .../client/utilities/policies/pagination.d.ts | 28 + .../client/utilities/policies/pagination.js | 200 + .../utilities/policies/pagination.js.map | 1 + .../client/utilities/promises/decoration.d.ts | 17 + .../client/utilities/promises/decoration.js | 39 + .../utilities/promises/decoration.js.map | 1 + .../utilities/subscriptions/relay/index.d.ts | 6 + .../utilities/subscriptions/relay/index.js | 43 + .../subscriptions/relay/index.js.map | 1 + .../subscriptions/relay/package.json | 8 + .../utilities/subscriptions/relay/relay.cjs | 369 + .../subscriptions/relay/relay.cjs.map | 1 + .../subscriptions/relay/relay.cjs.native.js | 369 + .../utilities/subscriptions/shared.d.ts | 9 + .../client/utilities/subscriptions/shared.js | 7 + .../utilities/subscriptions/shared.js.map | 1 + .../utilities/subscriptions/urql/index.d.ts | 7 + .../utilities/subscriptions/urql/index.js | 40 + .../utilities/subscriptions/urql/index.js.map | 1 + .../utilities/subscriptions/urql/package.json | 8 + .../utilities/subscriptions/urql/urql.cjs | 365 + .../utilities/subscriptions/urql/urql.cjs.map | 1 + .../subscriptions/urql/urql.cjs.native.js | 365 + .../client/utilities/types/DeepOmit.d.ts | 10 + .../client/utilities/types/DeepOmit.js | 2 + .../client/utilities/types/DeepOmit.js.map | 1 + .../client/utilities/types/DeepPartial.d.ts | 12 + .../client/utilities/types/DeepPartial.js | 6 + .../client/utilities/types/DeepPartial.js.map | 1 + .../client/utilities/types/IsStrictlyAny.d.ts | 5 + .../client/utilities/types/IsStrictlyAny.js | 2 + .../utilities/types/IsStrictlyAny.js.map | 1 + .../types/OnlyRequiredProperties.d.ts | 7 + .../utilities/types/OnlyRequiredProperties.js | 2 + .../types/OnlyRequiredProperties.js.map | 1 + .../client/utilities/types/Primitive.d.ts | 2 + .../client/utilities/types/Primitive.js | 2 + .../client/utilities/types/Primitive.js.map | 1 + .../@apollo/client/utilities/types/TODO.d.ts | 3 + .../@apollo/client/utilities/types/TODO.js | 2 + .../client/utilities/types/TODO.js.map | 1 + .../@apollo/client/utilities/utilities.cjs | 1730 ++++ .../client/utilities/utilities.cjs.map | 1 + .../client/utilities/utilities.cjs.native.js | 1730 ++++ .../node_modules/@apollo/client/version.d.ts | 2 + .../node_modules/@apollo/client/version.js | 2 + .../@apollo/client/version.js.map | 1 + .../@graphql-typed-document-node/core/LICENSE | 9 + .../core/package.json | 15 + .../core/typings/index.d.ts | 29 + .../node_modules/@wry/caches/LICENSE | 21 + .../node_modules/@wry/caches/README.md | 9 + .../node_modules/@wry/caches/lib/bundle.cjs | 245 + .../@wry/caches/lib/bundle.cjs.map | 1 + .../@wry/caches/lib/bundle.cjs.native.js | 245 + .../node_modules/@wry/caches/lib/common.d.ts | 8 + .../node_modules/@wry/caches/lib/common.js | 2 + .../@wry/caches/lib/common.js.map | 1 + .../node_modules/@wry/caches/lib/index.d.ts | 3 + .../node_modules/@wry/caches/lib/index.js | 3 + .../node_modules/@wry/caches/lib/index.js.map | 1 + .../node_modules/@wry/caches/lib/strong.d.ts | 16 + .../node_modules/@wry/caches/lib/strong.js | 86 + .../@wry/caches/lib/strong.js.map | 1 + .../node_modules/@wry/caches/lib/weak.d.ts | 22 + .../node_modules/@wry/caches/lib/weak.js | 143 + .../node_modules/@wry/caches/lib/weak.js.map | 1 + .../node_modules/@wry/caches/package.json | 41 + .../node_modules/@wry/caches/rollup.config.js | 1 + .../node_modules/@wry/caches/src/common.ts | 8 + .../node_modules/@wry/caches/src/index.ts | 3 + .../node_modules/@wry/caches/src/strong.ts | 121 + .../@wry/caches/src/tests/main.ts | 2 + .../@wry/caches/src/tests/strong.ts | 108 + .../@wry/caches/src/tests/weak.ts | 170 + .../node_modules/@wry/caches/src/weak.ts | 200 + .../node_modules/@wry/context/README.md | 4 + .../node_modules/@wry/context/lib/bundle.cjs | 235 + .../@wry/context/lib/bundle.cjs.map | 1 + .../@wry/context/lib/bundle.cjs.native.js | 235 + .../node_modules/@wry/context/lib/index.d.ts | 7 + .../node_modules/@wry/context/lib/index.js | 64 + .../@wry/context/lib/index.js.map | 1 + .../node_modules/@wry/context/lib/slot.d.ts | 12 + .../node_modules/@wry/context/lib/slot.js | 163 + .../node_modules/@wry/context/lib/slot.js.map | 1 + .../node_modules/@wry/context/package.json | 39 + .../@wry/context/rollup.config.js | 1 + .../node_modules/@wry/context/src/index.ts | 87 + .../node_modules/@wry/context/src/slot.ts | 183 + .../@wry/context/src/tests/main.ts | 478 + .../node_modules/@wry/equality/LICENSE | 21 + .../node_modules/@wry/equality/README.md | 4 + .../node_modules/@wry/equality/lib/bundle.cjs | 202 + .../@wry/equality/lib/bundle.cjs.map | 1 + .../@wry/equality/lib/bundle.cjs.native.js | 202 + .../node_modules/@wry/equality/lib/index.d.ts | 5 + .../node_modules/@wry/equality/lib/index.js | 197 + .../@wry/equality/lib/index.js.map | 1 + .../node_modules/@wry/equality/package.json | 36 + .../@wry/equality/rollup.config.js | 21 + .../node_modules/@wry/equality/src/index.ts | 218 + .../@wry/equality/src/tests/main.ts | 411 + .../node_modules/@wry/trie/README.md | 4 + .../node_modules/@wry/trie/lib/bundle.cjs | 89 + .../node_modules/@wry/trie/lib/bundle.cjs.map | 1 + .../@wry/trie/lib/bundle.cjs.native.js | 89 + .../node_modules/@wry/trie/lib/index.d.ts | 16 + .../node_modules/@wry/trie/lib/index.js | 82 + .../node_modules/@wry/trie/lib/index.js.map | 1 + .../node_modules/@wry/trie/package.json | 45 + .../node_modules/@wry/trie/rollup.config.js | 1 + .../node_modules/@wry/trie/src/index.ts | 104 + .../node_modules/@wry/trie/src/tests/main.ts | 207 + .../node_modules/graphql-tag/CHANGELOG.md | 236 + .../node_modules/graphql-tag/LICENSE | 21 + .../node_modules/graphql-tag/README.md | 251 + .../graphql-tag/lib/graphql-tag.umd.js | 136 + .../graphql-tag/lib/graphql-tag.umd.js.flow | 7 + .../graphql-tag/lib/graphql-tag.umd.js.map | 1 + .../node_modules/graphql-tag/lib/index.d.ts | 15 + .../graphql-tag/lib/index.d.ts.map | 1 + .../node_modules/graphql-tag/lib/index.js | 121 + .../node_modules/graphql-tag/lib/index.js.map | 1 + .../node_modules/graphql-tag/lib/tests.cjs.js | 409 + .../graphql-tag/lib/tests.cjs.js.map | 1 + .../node_modules/graphql-tag/lib/tests.d.ts | 2 + .../graphql-tag/lib/tests.d.ts.map | 1 + .../node_modules/graphql-tag/lib/tests.js | 288 + .../node_modules/graphql-tag/lib/tests.js.map | 1 + .../node_modules/graphql-tag/loader.js | 190 + .../node_modules/graphql-tag/main.js | 3 + .../node_modules/graphql-tag/package.json | 59 + .../graphql-tag/src/index.js.flow | 7 + .../node_modules/graphql-tag/src/index.ts | 174 + .../node_modules/graphql-tag/src/tests.ts | 491 + .../node_modules/graphql-ws/LICENSE.md | 9 + .../node_modules/graphql-ws/PROTOCOL.md | 251 + .../node_modules/graphql-ws/README.md | 39 + .../node_modules/graphql-ws/lib/client.d.mts | 407 + .../node_modules/graphql-ws/lib/client.d.ts | 407 + .../node_modules/graphql-ws/lib/client.js | 575 ++ .../node_modules/graphql-ws/lib/client.mjs | 556 ++ .../node_modules/graphql-ws/lib/common.d.mts | 201 + .../node_modules/graphql-ws/lib/common.d.ts | 201 + .../node_modules/graphql-ws/lib/common.js | 185 + .../node_modules/graphql-ws/lib/common.mjs | 178 + .../node_modules/graphql-ws/lib/index.d.mts | 3 + .../node_modules/graphql-ws/lib/index.d.ts | 3 + .../node_modules/graphql-ws/lib/index.js | 19 + .../node_modules/graphql-ws/lib/index.mjs | 3 + .../node_modules/graphql-ws/lib/server.d.mts | 417 + .../node_modules/graphql-ws/lib/server.d.ts | 417 + .../node_modules/graphql-ws/lib/server.js | 301 + .../node_modules/graphql-ws/lib/server.mjs | 296 + .../lib/use/@fastify/websocket.d.mts | 36 + .../lib/use/@fastify/websocket.d.ts | 36 + .../graphql-ws/lib/use/@fastify/websocket.js | 126 + .../graphql-ws/lib/use/@fastify/websocket.mjs | 122 + .../node_modules/graphql-ws/lib/use/bun.d.mts | 60 + .../node_modules/graphql-ws/lib/use/bun.d.ts | 60 + .../node_modules/graphql-ws/lib/use/bun.js | 97 + .../node_modules/graphql-ws/lib/use/bun.mjs | 92 + .../graphql-ws/lib/use/deno.d.mts | 56 + .../node_modules/graphql-ws/lib/use/deno.d.ts | 56 + .../node_modules/graphql-ws/lib/use/deno.js | 88 + .../node_modules/graphql-ws/lib/use/deno.mjs | 83 + .../lib/use/fastify-websocket.d.mts | 40 + .../graphql-ws/lib/use/fastify-websocket.d.ts | 40 + .../graphql-ws/lib/use/fastify-websocket.js | 25 + .../graphql-ws/lib/use/fastify-websocket.mjs | 21 + .../graphql-ws/lib/use/uWebSockets.d.mts | 67 + .../graphql-ws/lib/use/uWebSockets.d.ts | 67 + .../graphql-ws/lib/use/uWebSockets.js | 141 + .../graphql-ws/lib/use/uWebSockets.mjs | 137 + .../node_modules/graphql-ws/lib/use/ws.d.mts | 38 + .../node_modules/graphql-ws/lib/use/ws.d.ts | 38 + .../node_modules/graphql-ws/lib/use/ws.js | 119 + .../node_modules/graphql-ws/lib/use/ws.mjs | 115 + .../node_modules/graphql-ws/lib/utils.d.mts | 23 + .../node_modules/graphql-ws/lib/utils.d.ts | 23 + .../node_modules/graphql-ws/lib/utils.js | 54 + .../node_modules/graphql-ws/lib/utils.mjs | 45 + .../node_modules/graphql-ws/package.json | 152 + .../node_modules/graphql-ws/umd/graphql-ws.js | 800 ++ .../graphql-ws/umd/graphql-ws.min.js | 1 + .../graphql-ws/umd/graphql-ws.min.js.gz | Bin 0 -> 3841 bytes .../node_modules/graphql/LICENSE | 21 + .../graphql/NotSupportedTSVersion.d.ts | 1 + .../node_modules/graphql/README.md | 158 + .../graphql/error/GraphQLError.d.ts | 142 + .../graphql/error/GraphQLError.js | 267 + .../graphql/error/GraphQLError.mjs | 253 + .../node_modules/graphql/error/index.d.ts | 8 + .../node_modules/graphql/error/index.js | 41 + .../node_modules/graphql/error/index.mjs | 3 + .../graphql/error/locatedError.d.ts | 13 + .../graphql/error/locatedError.js | 40 + .../graphql/error/locatedError.mjs | 32 + .../graphql/error/syntaxError.d.ts | 11 + .../node_modules/graphql/error/syntaxError.js | 19 + .../graphql/error/syntaxError.mjs | 12 + .../graphql/execution/collectFields.d.ts | 45 + .../graphql/execution/collectFields.js | 229 + .../graphql/execution/collectFields.mjs | 213 + .../graphql/execution/execute.d.ts | 185 + .../node_modules/graphql/execution/execute.js | 1037 ++ .../graphql/execution/execute.mjs | 1009 ++ .../node_modules/graphql/execution/index.d.ts | 18 + .../node_modules/graphql/execution/index.js | 73 + .../node_modules/graphql/execution/index.mjs | 13 + .../graphql/execution/mapAsyncIterator.d.ts | 9 + .../graphql/execution/mapAsyncIterator.js | 68 + .../graphql/execution/mapAsyncIterator.mjs | 61 + .../graphql/execution/subscribe.d.ts | 72 + .../graphql/execution/subscribe.js | 244 + .../graphql/execution/subscribe.mjs | 222 + .../graphql/execution/values.d.ts | 79 + .../node_modules/graphql/execution/values.js | 300 + .../node_modules/graphql/execution/values.mjs | 263 + .../node_modules/graphql/graphql.d.ts | 67 + .../node_modules/graphql/graphql.js | 96 + .../node_modules/graphql/graphql.mjs | 122 + .../node_modules/graphql/index.d.ts | 413 + .../node_modules/graphql/index.js | 1269 +++ .../node_modules/graphql/index.mjs | 255 + .../node_modules/graphql/jsutils/Maybe.d.ts | 2 + .../node_modules/graphql/jsutils/Maybe.js | 5 + .../node_modules/graphql/jsutils/Maybe.mjs | 1 + .../node_modules/graphql/jsutils/ObjMap.d.ts | 16 + .../node_modules/graphql/jsutils/ObjMap.js | 5 + .../node_modules/graphql/jsutils/ObjMap.mjs | 1 + .../node_modules/graphql/jsutils/Path.d.ts | 20 + .../node_modules/graphql/jsutils/Path.js | 33 + .../node_modules/graphql/jsutils/Path.mjs | 25 + .../graphql/jsutils/PromiseOrValue.d.ts | 1 + .../graphql/jsutils/PromiseOrValue.js | 5 + .../graphql/jsutils/PromiseOrValue.mjs | 1 + .../graphql/jsutils/devAssert.d.ts | 1 + .../node_modules/graphql/jsutils/devAssert.js | 14 + .../graphql/jsutils/devAssert.mjs | 7 + .../graphql/jsutils/didYouMean.d.ts | 8 + .../graphql/jsutils/didYouMean.js | 38 + .../graphql/jsutils/didYouMean.mjs | 32 + .../node_modules/graphql/jsutils/groupBy.d.ts | 7 + .../node_modules/graphql/jsutils/groupBy.js | 26 + .../node_modules/graphql/jsutils/groupBy.mjs | 19 + .../graphql/jsutils/identityFunc.d.ts | 4 + .../graphql/jsutils/identityFunc.js | 13 + .../graphql/jsutils/identityFunc.mjs | 6 + .../node_modules/graphql/jsutils/inspect.d.ts | 4 + .../node_modules/graphql/jsutils/inspect.js | 121 + .../node_modules/graphql/jsutils/inspect.mjs | 115 + .../graphql/jsutils/instanceOf.d.ts | 16 + .../graphql/jsutils/instanceOf.js | 60 + .../graphql/jsutils/instanceOf.mjs | 52 + .../graphql/jsutils/invariant.d.ts | 4 + .../node_modules/graphql/jsutils/invariant.js | 16 + .../graphql/jsutils/invariant.mjs | 9 + .../graphql/jsutils/isAsyncIterable.d.ts | 7 + .../graphql/jsutils/isAsyncIterable.js | 18 + .../graphql/jsutils/isAsyncIterable.mjs | 11 + .../graphql/jsutils/isIterableObject.d.ts | 20 + .../graphql/jsutils/isIterableObject.js | 32 + .../graphql/jsutils/isIterableObject.mjs | 25 + .../graphql/jsutils/isObjectLike.d.ts | 7 + .../graphql/jsutils/isObjectLike.js | 14 + .../graphql/jsutils/isObjectLike.mjs | 7 + .../graphql/jsutils/isPromise.d.ts | 5 + .../node_modules/graphql/jsutils/isPromise.js | 17 + .../graphql/jsutils/isPromise.mjs | 10 + .../node_modules/graphql/jsutils/keyMap.d.ts | 32 + .../node_modules/graphql/jsutils/keyMap.js | 43 + .../node_modules/graphql/jsutils/keyMap.mjs | 36 + .../graphql/jsutils/keyValMap.d.ts | 23 + .../node_modules/graphql/jsutils/keyValMap.js | 33 + .../graphql/jsutils/keyValMap.mjs | 26 + .../graphql/jsutils/mapValue.d.ts | 9 + .../node_modules/graphql/jsutils/mapValue.js | 20 + .../node_modules/graphql/jsutils/mapValue.mjs | 13 + .../graphql/jsutils/memoize3.d.ts | 9 + .../node_modules/graphql/jsutils/memoize3.js | 41 + .../node_modules/graphql/jsutils/memoize3.mjs | 34 + .../graphql/jsutils/naturalCompare.d.ts | 8 + .../graphql/jsutils/naturalCompare.js | 69 + .../graphql/jsutils/naturalCompare.mjs | 61 + .../graphql/jsutils/printPathArray.d.ts | 6 + .../graphql/jsutils/printPathArray.js | 17 + .../graphql/jsutils/printPathArray.mjs | 10 + .../graphql/jsutils/promiseForObject.d.ts | 11 + .../graphql/jsutils/promiseForObject.js | 25 + .../graphql/jsutils/promiseForObject.mjs | 18 + .../graphql/jsutils/promiseReduce.d.ts | 13 + .../graphql/jsutils/promiseReduce.js | 27 + .../graphql/jsutils/promiseReduce.mjs | 20 + .../graphql/jsutils/suggestionList.d.ts | 8 + .../graphql/jsutils/suggestionList.js | 139 + .../graphql/jsutils/suggestionList.mjs | 130 + .../node_modules/graphql/jsutils/toError.d.ts | 4 + .../node_modules/graphql/jsutils/toError.js | 25 + .../node_modules/graphql/jsutils/toError.mjs | 18 + .../graphql/jsutils/toObjMap.d.ts | 5 + .../node_modules/graphql/jsutils/toObjMap.js | 24 + .../node_modules/graphql/jsutils/toObjMap.mjs | 17 + .../node_modules/graphql/language/ast.d.ts | 537 + .../node_modules/graphql/language/ast.js | 224 + .../node_modules/graphql/language/ast.mjs | 208 + .../graphql/language/blockString.d.ts | 28 + .../graphql/language/blockString.js | 195 + .../graphql/language/blockString.mjs | 178 + .../graphql/language/characterClasses.d.ts | 47 + .../graphql/language/characterClasses.js | 75 + .../graphql/language/characterClasses.mjs | 64 + .../graphql/language/directiveLocation.d.ts | 33 + .../graphql/language/directiveLocation.js | 39 + .../graphql/language/directiveLocation.mjs | 33 + .../node_modules/graphql/language/index.d.ts | 97 + .../node_modules/graphql/language/index.js | 215 + .../node_modules/graphql/language/index.mjs | 29 + .../node_modules/graphql/language/kinds.d.ts | 66 + .../node_modules/graphql/language/kinds.js | 63 + .../node_modules/graphql/language/kinds.mjs | 57 + .../node_modules/graphql/language/lexer.d.ts | 45 + .../node_modules/graphql/language/lexer.js | 1006 ++ .../node_modules/graphql/language/lexer.mjs | 902 ++ .../graphql/language/location.d.ts | 16 + .../node_modules/graphql/language/location.js | 38 + .../graphql/language/location.mjs | 30 + .../node_modules/graphql/language/parser.d.ts | 564 ++ .../node_modules/graphql/language/parser.js | 1567 +++ .../node_modules/graphql/language/parser.mjs | 1524 +++ .../graphql/language/predicates.d.ts | 33 + .../graphql/language/predicates.js | 109 + .../graphql/language/predicates.mjs | 81 + .../graphql/language/printLocation.d.ts | 14 + .../graphql/language/printLocation.js | 74 + .../graphql/language/printLocation.mjs | 66 + .../graphql/language/printString.d.ts | 5 + .../graphql/language/printString.js | 183 + .../graphql/language/printString.mjs | 176 + .../graphql/language/printer.d.ts | 6 + .../node_modules/graphql/language/printer.js | 351 + .../node_modules/graphql/language/printer.mjs | 339 + .../node_modules/graphql/language/source.d.ts | 25 + .../node_modules/graphql/language/source.js | 65 + .../node_modules/graphql/language/source.mjs | 50 + .../graphql/language/tokenKind.d.ts | 35 + .../graphql/language/tokenKind.js | 43 + .../graphql/language/tokenKind.mjs | 37 + .../graphql/language/visitor.d.ts | 194 + .../node_modules/graphql/language/visitor.js | 377 + .../node_modules/graphql/language/visitor.mjs | 361 + .../node_modules/graphql/package.json | 39 + .../graphql/subscription/index.d.ts | 19 + .../graphql/subscription/index.js | 19 + .../graphql/subscription/index.mjs | 19 + .../node_modules/graphql/type/assertName.d.ts | 10 + .../node_modules/graphql/type/assertName.js | 59 + .../node_modules/graphql/type/assertName.mjs | 44 + .../node_modules/graphql/type/definition.d.ts | 923 ++ .../node_modules/graphql/type/definition.js | 1339 +++ .../node_modules/graphql/type/definition.mjs | 1177 +++ .../node_modules/graphql/type/directives.d.ts | 86 + .../node_modules/graphql/type/directives.js | 224 + .../node_modules/graphql/type/directives.mjs | 190 + .../node_modules/graphql/type/index.d.ts | 150 + .../node_modules/graphql/type/index.js | 547 ++ .../node_modules/graphql/type/index.mjs | 103 + .../graphql/type/introspection.d.ts | 30 + .../graphql/type/introspection.js | 617 ++ .../graphql/type/introspection.mjs | 551 ++ .../node_modules/graphql/type/scalars.d.ts | 19 + .../node_modules/graphql/type/scalars.js | 369 + .../node_modules/graphql/type/scalars.mjs | 309 + .../node_modules/graphql/type/schema.d.ts | 170 + .../node_modules/graphql/type/schema.js | 402 + .../node_modules/graphql/type/schema.mjs | 381 + .../node_modules/graphql/type/validate.d.ts | 17 + .../node_modules/graphql/type/validate.js | 676 ++ .../node_modules/graphql/type/validate.mjs | 651 ++ .../graphql/utilities/TypeInfo.d.ts | 67 + .../graphql/utilities/TypeInfo.js | 418 + .../graphql/utilities/TypeInfo.mjs | 395 + .../graphql/utilities/assertValidName.d.ts | 13 + .../graphql/utilities/assertValidName.js | 51 + .../graphql/utilities/assertValidName.mjs | 40 + .../graphql/utilities/astFromValue.d.ts | 28 + .../graphql/utilities/astFromValue.js | 190 + .../graphql/utilities/astFromValue.mjs | 177 + .../graphql/utilities/buildASTSchema.d.ts | 35 + .../graphql/utilities/buildASTSchema.js | 115 + .../graphql/utilities/buildASTSchema.mjs | 97 + .../graphql/utilities/buildClientSchema.d.ts | 19 + .../graphql/utilities/buildClientSchema.js | 386 + .../graphql/utilities/buildClientSchema.mjs | 363 + .../graphql/utilities/coerceInputValue.d.ts | 16 + .../graphql/utilities/coerceInputValue.js | 189 + .../graphql/utilities/coerceInputValue.mjs | 167 + .../graphql/utilities/concatAST.d.ts | 9 + .../graphql/utilities/concatAST.js | 26 + .../graphql/utilities/concatAST.mjs | 19 + .../graphql/utilities/extendSchema.d.ts | 40 + .../graphql/utilities/extendSchema.js | 798 ++ .../graphql/utilities/extendSchema.mjs | 789 ++ .../utilities/findBreakingChanges.d.ts | 53 + .../graphql/utilities/findBreakingChanges.js | 547 ++ .../graphql/utilities/findBreakingChanges.mjs | 519 + .../utilities/getIntrospectionQuery.d.ts | 182 + .../utilities/getIntrospectionQuery.js | 142 + .../utilities/getIntrospectionQuery.mjs | 135 + .../graphql/utilities/getOperationAST.d.ts | 11 + .../graphql/utilities/getOperationAST.js | 43 + .../graphql/utilities/getOperationAST.mjs | 36 + .../utilities/getOperationRootType.d.ts | 15 + .../graphql/utilities/getOperationRootType.js | 67 + .../utilities/getOperationRootType.mjs | 54 + .../node_modules/graphql/utilities/index.d.ts | 61 + .../node_modules/graphql/utilities/index.js | 233 + .../node_modules/graphql/utilities/index.mjs | 55 + .../utilities/introspectionFromSchema.d.ts | 18 + .../utilities/introspectionFromSchema.js | 42 + .../utilities/introspectionFromSchema.mjs | 30 + .../utilities/lexicographicSortSchema.d.ts | 9 + .../utilities/lexicographicSortSchema.js | 177 + .../utilities/lexicographicSortSchema.mjs | 172 + .../graphql/utilities/printSchema.d.ts | 5 + .../graphql/utilities/printSchema.js | 333 + .../graphql/utilities/printSchema.mjs | 309 + .../graphql/utilities/separateOperations.d.ts | 11 + .../graphql/utilities/separateOperations.js | 88 + .../graphql/utilities/separateOperations.mjs | 80 + .../graphql/utilities/sortValueNode.d.ts | 9 + .../graphql/utilities/sortValueNode.js | 47 + .../graphql/utilities/sortValueNode.mjs | 39 + .../utilities/stripIgnoredCharacters.d.ts | 62 + .../utilities/stripIgnoredCharacters.js | 121 + .../utilities/stripIgnoredCharacters.mjs | 104 + .../graphql/utilities/typeComparators.d.ts | 32 + .../graphql/utilities/typeComparators.js | 116 + .../graphql/utilities/typeComparators.mjs | 106 + .../graphql/utilities/typeFromAST.d.ts | 32 + .../graphql/utilities/typeFromAST.js | 27 + .../graphql/utilities/typeFromAST.mjs | 18 + .../utilities/typedQueryDocumentNode.d.ts | 22 + .../utilities/typedQueryDocumentNode.js | 5 + .../utilities/typedQueryDocumentNode.mjs | 1 + .../graphql/utilities/valueFromAST.d.ts | 29 + .../graphql/utilities/valueFromAST.js | 185 + .../graphql/utilities/valueFromAST.mjs | 172 + .../utilities/valueFromASTUntyped.d.ts | 23 + .../graphql/utilities/valueFromASTUntyped.js | 61 + .../graphql/utilities/valueFromASTUntyped.mjs | 53 + .../graphql/validation/ValidationContext.d.ts | 95 + .../graphql/validation/ValidationContext.js | 232 + .../graphql/validation/ValidationContext.mjs | 212 + .../graphql/validation/index.d.ts | 40 + .../node_modules/graphql/validation/index.js | 317 + .../node_modules/graphql/validation/index.mjs | 68 + .../rules/ExecutableDefinitionsRule.d.ts | 13 + .../rules/ExecutableDefinitionsRule.js | 46 + .../rules/ExecutableDefinitionsRule.mjs | 34 + .../rules/FieldsOnCorrectTypeRule.d.ts | 13 + .../rules/FieldsOnCorrectTypeRule.js | 145 + .../rules/FieldsOnCorrectTypeRule.mjs | 127 + .../rules/FragmentsOnCompositeTypesRule.d.ts | 14 + .../rules/FragmentsOnCompositeTypesRule.js | 69 + .../rules/FragmentsOnCompositeTypesRule.mjs | 53 + .../rules/KnownArgumentNamesRule.d.ts | 23 + .../rules/KnownArgumentNamesRule.js | 120 + .../rules/KnownArgumentNamesRule.mjs | 102 + .../validation/rules/KnownDirectivesRule.d.ts | 16 + .../validation/rules/KnownDirectivesRule.js | 167 + .../validation/rules/KnownDirectivesRule.mjs | 150 + .../rules/KnownFragmentNamesRule.d.ts | 13 + .../rules/KnownFragmentNamesRule.js | 36 + .../rules/KnownFragmentNamesRule.mjs | 26 + .../validation/rules/KnownTypeNamesRule.d.ts | 16 + .../validation/rules/KnownTypeNamesRule.js | 89 + .../validation/rules/KnownTypeNamesRule.mjs | 77 + .../rules/LoneAnonymousOperationRule.d.ts | 13 + .../rules/LoneAnonymousOperationRule.js | 42 + .../rules/LoneAnonymousOperationRule.mjs | 34 + .../rules/LoneSchemaDefinitionRule.d.ts | 10 + .../rules/LoneSchemaDefinitionRule.js | 67 + .../rules/LoneSchemaDefinitionRule.mjs | 57 + .../rules/NoFragmentCyclesRule.d.ts | 13 + .../validation/rules/NoFragmentCyclesRule.js | 85 + .../validation/rules/NoFragmentCyclesRule.mjs | 78 + .../rules/NoUndefinedVariablesRule.d.ts | 13 + .../rules/NoUndefinedVariablesRule.js | 52 + .../rules/NoUndefinedVariablesRule.mjs | 45 + .../rules/NoUnusedFragmentsRule.d.ts | 13 + .../validation/rules/NoUnusedFragmentsRule.js | 61 + .../rules/NoUnusedFragmentsRule.mjs | 51 + .../rules/NoUnusedVariablesRule.d.ts | 13 + .../validation/rules/NoUnusedVariablesRule.js | 57 + .../rules/NoUnusedVariablesRule.mjs | 50 + .../OverlappingFieldsCanBeMergedRule.d.ts | 14 + .../rules/OverlappingFieldsCanBeMergedRule.js | 820 ++ .../OverlappingFieldsCanBeMergedRule.mjs | 805 ++ .../rules/PossibleFragmentSpreadsRule.d.ts | 12 + .../rules/PossibleFragmentSpreadsRule.js | 95 + .../rules/PossibleFragmentSpreadsRule.mjs | 73 + .../rules/PossibleTypeExtensionsRule.d.ts | 10 + .../rules/PossibleTypeExtensionsRule.js | 171 + .../rules/PossibleTypeExtensionsRule.mjs | 148 + .../rules/ProvidedRequiredArgumentsRule.d.ts | 20 + .../rules/ProvidedRequiredArgumentsRule.js | 162 + .../rules/ProvidedRequiredArgumentsRule.mjs | 142 + .../validation/rules/ScalarLeafsRule.d.ts | 9 + .../validation/rules/ScalarLeafsRule.js | 55 + .../validation/rules/ScalarLeafsRule.mjs | 46 + .../rules/SingleFieldSubscriptionsRule.d.ts | 13 + .../rules/SingleFieldSubscriptionsRule.js | 86 + .../rules/SingleFieldSubscriptionsRule.mjs | 77 + .../UniqueArgumentDefinitionNamesRule.d.ts | 11 + .../UniqueArgumentDefinitionNamesRule.js | 92 + .../UniqueArgumentDefinitionNamesRule.mjs | 81 + .../rules/UniqueArgumentNamesRule.d.ts | 13 + .../rules/UniqueArgumentNamesRule.js | 55 + .../rules/UniqueArgumentNamesRule.mjs | 44 + .../rules/UniqueDirectiveNamesRule.d.ts | 10 + .../rules/UniqueDirectiveNamesRule.js | 54 + .../rules/UniqueDirectiveNamesRule.mjs | 47 + .../UniqueDirectivesPerLocationRule.d.ts | 16 + .../rules/UniqueDirectivesPerLocationRule.js | 95 + .../rules/UniqueDirectivesPerLocationRule.mjs | 85 + .../rules/UniqueEnumValueNamesRule.d.ts | 10 + .../rules/UniqueEnumValueNamesRule.js | 75 + .../rules/UniqueEnumValueNamesRule.mjs | 64 + .../rules/UniqueFieldDefinitionNamesRule.d.ts | 10 + .../rules/UniqueFieldDefinitionNamesRule.js | 87 + .../rules/UniqueFieldDefinitionNamesRule.mjs | 79 + .../rules/UniqueFragmentNamesRule.d.ts | 12 + .../rules/UniqueFragmentNamesRule.js | 41 + .../rules/UniqueFragmentNamesRule.mjs | 34 + .../rules/UniqueInputFieldNamesRule.d.ts | 13 + .../rules/UniqueInputFieldNamesRule.js | 54 + .../rules/UniqueInputFieldNamesRule.mjs | 46 + .../rules/UniqueOperationNamesRule.d.ts | 12 + .../rules/UniqueOperationNamesRule.js | 46 + .../rules/UniqueOperationNamesRule.mjs | 39 + .../rules/UniqueOperationTypesRule.d.ts | 10 + .../rules/UniqueOperationTypesRule.js | 71 + .../rules/UniqueOperationTypesRule.mjs | 64 + .../validation/rules/UniqueTypeNamesRule.d.ts | 10 + .../validation/rules/UniqueTypeNamesRule.js | 57 + .../validation/rules/UniqueTypeNamesRule.mjs | 47 + .../rules/UniqueVariableNamesRule.d.ts | 10 + .../rules/UniqueVariableNamesRule.js | 49 + .../rules/UniqueVariableNamesRule.mjs | 41 + .../rules/ValuesOfCorrectTypeRule.d.ts | 13 + .../rules/ValuesOfCorrectTypeRule.js | 192 + .../rules/ValuesOfCorrectTypeRule.mjs | 173 + .../rules/VariablesAreInputTypesRule.d.ts | 13 + .../rules/VariablesAreInputTypesRule.js | 46 + .../rules/VariablesAreInputTypesRule.mjs | 33 + .../rules/VariablesInAllowedPositionRule.d.ts | 12 + .../rules/VariablesInAllowedPositionRule.js | 116 + .../rules/VariablesInAllowedPositionRule.mjs | 97 + .../rules/custom/NoDeprecatedCustomRule.d.ts | 15 + .../rules/custom/NoDeprecatedCustomRule.js | 131 + .../rules/custom/NoDeprecatedCustomRule.mjs | 117 + .../NoSchemaIntrospectionCustomRule.d.ts | 15 + .../custom/NoSchemaIntrospectionCustomRule.js | 41 + .../NoSchemaIntrospectionCustomRule.mjs | 32 + .../graphql/validation/specifiedRules.d.ts | 12 + .../graphql/validation/specifiedRules.js | 160 + .../graphql/validation/specifiedRules.mjs | 123 + .../graphql/validation/validate.d.ts | 61 + .../graphql/validation/validate.js | 151 + .../graphql/validation/validate.mjs | 133 + .../node_modules/graphql/version.d.ts | 13 + .../node_modules/graphql/version.js | 25 + .../node_modules/graphql/version.mjs | 17 + .../hoist-non-react-statics/CHANGELOG.md | 37 + .../hoist-non-react-statics/LICENSE.md | 29 + .../hoist-non-react-statics/README.md | 55 + .../dist/hoist-non-react-statics.cjs.js | 103 + .../dist/hoist-non-react-statics.js | 449 + .../dist/hoist-non-react-statics.min.js | 1 + .../hoist-non-react-statics/package.json | 55 + .../hoist-non-react-statics/src/index.js | 104 + .../node_modules/js-tokens/CHANGELOG.md | 151 + .../node_modules/js-tokens/LICENSE | 21 + .../node_modules/js-tokens/README.md | 240 + .../node_modules/js-tokens/index.js | 23 + .../node_modules/js-tokens/package.json | 30 + .../node_modules/loose-envify/LICENSE | 21 + .../node_modules/loose-envify/README.md | 45 + .../node_modules/loose-envify/cli.js | 16 + .../node_modules/loose-envify/custom.js | 4 + .../node_modules/loose-envify/index.js | 3 + .../node_modules/loose-envify/loose-envify.js | 36 + .../node_modules/loose-envify/package.json | 36 + .../node_modules/loose-envify/replace.js | 65 + .../node_modules/object-assign/index.js | 90 + .../node_modules/object-assign/license | 21 + .../node_modules/object-assign/package.json | 42 + .../node_modules/object-assign/readme.md | 61 + .../optimism/.github/dependabot.yml | 9 + .../optimism/.github/workflows/main.yml | 29 + .../node_modules/optimism/LICENSE | 21 + .../node_modules/optimism/README.md | 3 + .../node_modules/optimism/lib/bundle.cjs | 492 + .../node_modules/optimism/lib/bundle.cjs.map | 1 + .../optimism/lib/bundle.cjs.native.js | 492 + .../node_modules/optimism/lib/context.d.ts | 11 + .../node_modules/optimism/lib/context.js | 8 + .../node_modules/optimism/lib/context.js.map | 1 + .../node_modules/optimism/lib/dep.d.ts | 19 + .../node_modules/optimism/lib/dep.js | 40 + .../node_modules/optimism/lib/dep.js.map | 1 + .../node_modules/optimism/lib/entry.d.ts | 28 + .../node_modules/optimism/lib/entry.js | 301 + .../node_modules/optimism/lib/entry.js.map | 1 + .../node_modules/optimism/lib/helpers.d.ts | 7 + .../node_modules/optimism/lib/helpers.js | 15 + .../node_modules/optimism/lib/helpers.js.map | 1 + .../node_modules/optimism/lib/index.d.ts | 36 + .../node_modules/optimism/lib/index.js | 113 + .../node_modules/optimism/lib/index.js.map | 1 + .../optimism/node_modules/@wry/trie/LICENSE | 21 + .../optimism/node_modules/@wry/trie/README.md | 4 + .../node_modules/@wry/trie/lib/bundle.cjs | 72 + .../node_modules/@wry/trie/lib/bundle.cjs.map | 1 + .../@wry/trie/lib/bundle.cjs.native.js | 72 + .../node_modules/@wry/trie/lib/index.d.ts | 13 + .../node_modules/@wry/trie/lib/index.js | 57 + .../node_modules/@wry/trie/lib/index.js.map | 1 + .../node_modules/@wry/trie/package.json | 46 + .../node_modules/@wry/trie/rollup.config.js | 1 + .../node_modules/@wry/trie/src/index.ts | 74 + .../node_modules/@wry/trie/src/tests/main.ts | 112 + .../node_modules/optimism/package.json | 56 + .../node_modules/optimism/src/context.ts | 16 + .../node_modules/optimism/src/dep.ts | 68 + .../node_modules/optimism/src/entry.ts | 372 + .../node_modules/optimism/src/helpers.ts | 25 + .../node_modules/optimism/src/index.ts | 246 + .../node_modules/optimism/src/tests/api.ts | 968 ++ .../node_modules/optimism/src/tests/cache.ts | 110 + .../optimism/src/tests/context.ts | 208 + .../node_modules/optimism/src/tests/deps.ts | 183 + .../optimism/src/tests/exceptions.ts | 76 + .../optimism/src/tests/key-trie.ts | 90 + .../node_modules/optimism/src/tests/main.ts | 7 + .../optimism/src/tests/performance.ts | 86 + .../optimism/src/tests/test-utils.ts | 14 + .../node_modules/prop-types/LICENSE | 21 + .../node_modules/prop-types/README.md | 302 + .../node_modules/prop-types/checkPropTypes.js | 103 + .../node_modules/prop-types/factory.js | 19 + .../prop-types/factoryWithThrowingShims.js | 65 + .../prop-types/factoryWithTypeCheckers.js | 610 ++ .../node_modules/prop-types/index.js | 19 + .../prop-types/lib/ReactPropTypesSecret.js | 12 + .../node_modules/prop-types/lib/has.js | 1 + .../node_modules/prop-types/package.json | 60 + .../node_modules/prop-types/prop-types.js | 1315 +++ .../node_modules/prop-types/prop-types.min.js | 1 + .../node_modules/react-is/LICENSE | 21 + .../node_modules/react-is/README.md | 104 + .../node_modules/react-is/build-info.json | 8 + .../react-is/cjs/react-is.development.js | 181 + .../react-is/cjs/react-is.production.min.js | 15 + .../node_modules/react-is/index.js | 7 + .../node_modules/react-is/package.json | 27 + .../react-is/umd/react-is.development.js | 181 + .../react-is/umd/react-is.production.min.js | 13 + .../node_modules/react/LICENSE | 21 + .../node_modules/react/README.md | 37 + .../cjs/react-jsx-dev-runtime.development.js | 1296 +++ .../react-jsx-dev-runtime.production.min.js | 10 + .../react-jsx-dev-runtime.profiling.min.js | 10 + .../cjs/react-jsx-runtime.development.js | 1314 +++ .../cjs/react-jsx-runtime.production.min.js | 11 + .../cjs/react-jsx-runtime.profiling.min.js | 11 + .../react/cjs/react.development.js | 2739 ++++++ .../react/cjs/react.production.min.js | 26 + .../cjs/react.shared-subset.development.js | 20 + .../cjs/react.shared-subset.production.min.js | 10 + .../node_modules/react/index.js | 7 + .../node_modules/react/jsx-dev-runtime.js | 7 + .../node_modules/react/jsx-runtime.js | 7 + .../node_modules/react/package.json | 47 + .../node_modules/react/react.shared-subset.js | 7 + .../react/umd/react.development.js | 3342 +++++++ .../react/umd/react.production.min.js | 31 + .../react/umd/react.profiling.min.js | 31 + .../node_modules/rehackt/README.md | 100 + .../node_modules/rehackt/index.d.ts | 3 + .../node_modules/rehackt/index.js | 2 + .../node_modules/rehackt/package.json | 47 + .../node_modules/rehackt/rsc.js | 76 + .../node_modules/response-iterator/LICENSE | 21 + .../node_modules/response-iterator/README.md | 37 + .../response-iterator/dist/cjs/index.js | 30 + .../response-iterator/dist/cjs/index.js.map | 1 + .../dist/cjs/iterators/async.js | 28 + .../dist/cjs/iterators/async.js.map | 1 + .../dist/cjs/iterators/nodeStream.js | 81 + .../dist/cjs/iterators/nodeStream.js.map | 1 + .../dist/cjs/iterators/promise.js | 32 + .../dist/cjs/iterators/promise.js.map | 1 + .../dist/cjs/iterators/reader.js | 19 + .../dist/cjs/iterators/reader.js.map | 1 + .../response-iterator/dist/cjs/package.json | 1 + .../response-iterator/dist/esm/index.mjs | 26 + .../response-iterator/dist/esm/index.mjs.map | 1 + .../dist/esm/iterators/async.mjs | 11 + .../dist/esm/iterators/async.mjs.map | 1 + .../dist/esm/iterators/nodeStream.mjs | 76 + .../dist/esm/iterators/nodeStream.mjs.map | 1 + .../dist/esm/iterators/promise.mjs | 27 + .../dist/esm/iterators/promise.mjs.map | 1 + .../dist/esm/iterators/reader.mjs | 14 + .../dist/esm/iterators/reader.mjs.map | 1 + .../response-iterator/dist/esm/package.json | 1 + .../response-iterator/dist/types/async.d.ts | 1 + .../response-iterator/dist/types/index.d.ts | 4 + .../dist/types/nodeStream.d.ts | 3 + .../response-iterator/dist/types/promise.d.ts | 1 + .../response-iterator/dist/types/reader.d.ts | 1 + .../response-iterator/dist/umd/package.json | 1 + .../dist/umd/response-iterator.js | 174 + .../dist/umd/response-iterator.js.map | 1 + .../dist/umd/response-iterator.min.js | 2 + .../dist/umd/response-iterator.min.js.map | 1 + .../response-iterator/package.json | 83 + .../symbol-observable/CHANGELOG.md | 177 + .../node_modules/symbol-observable/README.md | 70 + .../symbol-observable/es/index.js | 19 + .../symbol-observable/es/ponyfill.js | 34 + .../node_modules/symbol-observable/index.d.ts | 8 + .../node_modules/symbol-observable/index.js | 1 + .../symbol-observable/lib/index.js | 29 + .../symbol-observable/lib/ponyfill.js | 40 + .../node_modules/symbol-observable/license | 22 + .../symbol-observable/package.json | 50 + .../symbol-observable/ponyfill.d.ts | 2 + .../symbol-observable/ponyfill.js | 1 + .../node_modules/ts-invariant/LICENSE | 21 + .../node_modules/ts-invariant/README.md | 19 + .../ts-invariant/lib/invariant.cjs | 60 + .../ts-invariant/lib/invariant.cjs.map | 1 + .../ts-invariant/lib/invariant.cjs.native.js | 60 + .../ts-invariant/lib/invariant.d.ts | 29 + .../ts-invariant/lib/invariant.js | 51 + .../ts-invariant/lib/invariant.js.map | 1 + .../node_modules/ts-invariant/package.json | 47 + .../ts-invariant/process/index.d.ts | 2 + .../ts-invariant/process/index.js | 52 + .../ts-invariant/process/main.cjs | 60 + .../ts-invariant/process/main.cjs.map | 1 + .../ts-invariant/process/main.cjs.native.js | 60 + .../ts-invariant/process/package.json | 12 + .../ts-invariant/rollup.config.js | 74 + .../node_modules/ts-invariant/tsconfig.json | 7 + .../ts-invariant/tsconfig.rollup.json | 6 + .../node_modules/tslib/CopyrightNotice.txt | 15 + .../node_modules/tslib/LICENSE.txt | 12 + .../node_modules/tslib/README.md | 164 + .../node_modules/tslib/SECURITY.md | 41 + .../node_modules/tslib/modules/index.d.ts | 37 + .../node_modules/tslib/modules/index.js | 68 + .../node_modules/tslib/modules/package.json | 3 + .../node_modules/tslib/package.json | 47 + .../node_modules/tslib/tslib.d.ts | 453 + .../node_modules/tslib/tslib.es6.html | 1 + .../node_modules/tslib/tslib.es6.js | 370 + .../node_modules/tslib/tslib.es6.mjs | 370 + .../node_modules/tslib/tslib.html | 1 + .../node_modules/tslib/tslib.js | 421 + graphql-subscription/node_modules/ws/LICENSE | 20 + .../node_modules/ws/README.md | 549 ++ .../node_modules/ws/browser.js | 8 + graphql-subscription/node_modules/ws/index.js | 13 + .../node_modules/ws/lib/buffer-util.js | 131 + .../node_modules/ws/lib/constants.js | 12 + .../node_modules/ws/lib/event-target.js | 292 + .../node_modules/ws/lib/extension.js | 203 + .../node_modules/ws/lib/limiter.js | 55 + .../node_modules/ws/lib/permessage-deflate.js | 514 + .../node_modules/ws/lib/receiver.js | 742 ++ .../node_modules/ws/lib/sender.js | 477 + .../node_modules/ws/lib/stream.js | 159 + .../node_modules/ws/lib/subprotocol.js | 62 + .../node_modules/ws/lib/validation.js | 130 + .../node_modules/ws/lib/websocket-server.js | 539 + .../node_modules/ws/lib/websocket.js | 1336 +++ .../node_modules/ws/package.json | 68 + .../node_modules/ws/wrapper.mjs | 8 + .../zen-observable-ts/.github/dependabot.yml | 9 + .../.github/workflows/node.js.yml | 30 + .../node_modules/zen-observable-ts/LICENSE | 21 + .../node_modules/zen-observable-ts/README.md | 19 + .../node_modules/zen-observable-ts/index.cjs | 1 + .../zen-observable-ts/index.cjs.native.js | 1 + .../zen-observable-ts/module.d.ts | 58 + .../node_modules/zen-observable-ts/module.js | 576 ++ .../zen-observable-ts/package.json | 41 + .../zen-observable-ts/rollup.test.config.js | 14 + .../zen-observable-ts/src/module.js | 1 + .../node_modules/zen-observable/.editorconfig | 7 + .../node_modules/zen-observable/.eslintrc.js | 47 + .../node_modules/zen-observable/LICENSE | 18 + .../node_modules/zen-observable/README.md | 176 + .../node_modules/zen-observable/esm.js | 5 + .../node_modules/zen-observable/extras.js | 1 + .../node_modules/zen-observable/index.js | 1 + .../zen-observable/lib/Observable.js | 617 ++ .../node_modules/zen-observable/lib/extras.js | 132 + .../node_modules/zen-observable/package.json | 23 + .../zen-observable/scripts/babel-plugins.js | 16 + .../zen-observable/scripts/build.js | 7 + .../zen-observable/scripts/mocha-require.js | 3 + .../zen-observable/src/Observable.js | 476 + .../node_modules/zen-observable/src/extras.js | 99 + .../zen-observable/test/concat.js | 30 + .../zen-observable/test/constructor.js | 36 + .../test/extras/combine-latest.js | 43 + .../zen-observable/test/extras/merge.js | 16 + .../zen-observable/test/extras/parse.js | 11 + .../zen-observable/test/extras/zip.js | 21 + .../zen-observable/test/filter.js | 14 + .../zen-observable/test/flat-map.js | 23 + .../zen-observable/test/for-each.js | 70 + .../node_modules/zen-observable/test/from.js | 95 + .../node_modules/zen-observable/test/map.js | 13 + .../zen-observable/test/observer-closed.js | 35 + .../zen-observable/test/observer-complete.js | 143 + .../zen-observable/test/observer-error.js | 145 + .../zen-observable/test/observer-next.js | 137 + .../node_modules/zen-observable/test/of.js | 32 + .../zen-observable/test/properties.js | 31 + .../zen-observable/test/reduce.js | 38 + .../node_modules/zen-observable/test/setup.js | 9 + .../zen-observable/test/species.js | 28 + .../zen-observable/test/subscribe.js | 137 + .../zen-observable/test/subscription.js | 41 + graphql-subscription/package-lock.json | 305 + graphql-subscription/package.json | 8 + graphql-subscription/runsh.sh | 14 + .../standard-api-key-login.html | 56 + 2575 files changed, 282312 insertions(+) create mode 100644 GraphQL Authentications.postman_collection.json create mode 100644 graphql-subscription-express/index.html create mode 120000 graphql-subscription-express/node_modules/.bin/mime create mode 100644 graphql-subscription-express/node_modules/.package-lock.json create mode 100644 graphql-subscription-express/node_modules/accepts/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/accepts/LICENSE create mode 100644 graphql-subscription-express/node_modules/accepts/README.md create mode 100644 graphql-subscription-express/node_modules/accepts/index.js create mode 100644 graphql-subscription-express/node_modules/accepts/package.json create mode 100644 graphql-subscription-express/node_modules/array-flatten/LICENSE create mode 100644 graphql-subscription-express/node_modules/array-flatten/README.md create mode 100644 graphql-subscription-express/node_modules/array-flatten/array-flatten.js create mode 100644 graphql-subscription-express/node_modules/array-flatten/package.json create mode 100644 graphql-subscription-express/node_modules/body-parser/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/body-parser/LICENSE create mode 100644 graphql-subscription-express/node_modules/body-parser/README.md create mode 100644 graphql-subscription-express/node_modules/body-parser/SECURITY.md create mode 100644 graphql-subscription-express/node_modules/body-parser/index.js create mode 100644 graphql-subscription-express/node_modules/body-parser/lib/read.js create mode 100644 graphql-subscription-express/node_modules/body-parser/lib/types/json.js create mode 100644 graphql-subscription-express/node_modules/body-parser/lib/types/raw.js create mode 100644 graphql-subscription-express/node_modules/body-parser/lib/types/text.js create mode 100644 graphql-subscription-express/node_modules/body-parser/lib/types/urlencoded.js create mode 100644 graphql-subscription-express/node_modules/body-parser/package.json create mode 100644 graphql-subscription-express/node_modules/bytes/History.md create mode 100644 graphql-subscription-express/node_modules/bytes/LICENSE create mode 100644 graphql-subscription-express/node_modules/bytes/Readme.md create mode 100644 graphql-subscription-express/node_modules/bytes/index.js create mode 100644 graphql-subscription-express/node_modules/bytes/package.json create mode 100644 graphql-subscription-express/node_modules/call-bind/.eslintignore create mode 100644 graphql-subscription-express/node_modules/call-bind/.eslintrc create mode 100644 graphql-subscription-express/node_modules/call-bind/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/call-bind/.nycrc create mode 100644 graphql-subscription-express/node_modules/call-bind/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/call-bind/LICENSE create mode 100644 graphql-subscription-express/node_modules/call-bind/README.md create mode 100644 graphql-subscription-express/node_modules/call-bind/callBound.js create mode 100644 graphql-subscription-express/node_modules/call-bind/index.js create mode 100644 graphql-subscription-express/node_modules/call-bind/package.json create mode 100644 graphql-subscription-express/node_modules/call-bind/test/callBound.js create mode 100644 graphql-subscription-express/node_modules/call-bind/test/index.js create mode 100644 graphql-subscription-express/node_modules/content-disposition/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/content-disposition/LICENSE create mode 100644 graphql-subscription-express/node_modules/content-disposition/README.md create mode 100644 graphql-subscription-express/node_modules/content-disposition/index.js create mode 100644 graphql-subscription-express/node_modules/content-disposition/package.json create mode 100644 graphql-subscription-express/node_modules/content-type/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/content-type/LICENSE create mode 100644 graphql-subscription-express/node_modules/content-type/README.md create mode 100644 graphql-subscription-express/node_modules/content-type/index.js create mode 100644 graphql-subscription-express/node_modules/content-type/package.json create mode 100644 graphql-subscription-express/node_modules/cookie-signature/.npmignore create mode 100644 graphql-subscription-express/node_modules/cookie-signature/History.md create mode 100644 graphql-subscription-express/node_modules/cookie-signature/Readme.md create mode 100644 graphql-subscription-express/node_modules/cookie-signature/index.js create mode 100644 graphql-subscription-express/node_modules/cookie-signature/package.json create mode 100644 graphql-subscription-express/node_modules/cookie/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/cookie/LICENSE create mode 100644 graphql-subscription-express/node_modules/cookie/README.md create mode 100644 graphql-subscription-express/node_modules/cookie/SECURITY.md create mode 100644 graphql-subscription-express/node_modules/cookie/index.js create mode 100644 graphql-subscription-express/node_modules/cookie/package.json create mode 100644 graphql-subscription-express/node_modules/debug/.coveralls.yml create mode 100644 graphql-subscription-express/node_modules/debug/.eslintrc create mode 100644 graphql-subscription-express/node_modules/debug/.npmignore create mode 100644 graphql-subscription-express/node_modules/debug/.travis.yml create mode 100644 graphql-subscription-express/node_modules/debug/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/debug/LICENSE create mode 100644 graphql-subscription-express/node_modules/debug/Makefile create mode 100644 graphql-subscription-express/node_modules/debug/README.md create mode 100644 graphql-subscription-express/node_modules/debug/component.json create mode 100644 graphql-subscription-express/node_modules/debug/karma.conf.js create mode 100644 graphql-subscription-express/node_modules/debug/node.js create mode 100644 graphql-subscription-express/node_modules/debug/package.json create mode 100644 graphql-subscription-express/node_modules/debug/src/browser.js create mode 100644 graphql-subscription-express/node_modules/debug/src/debug.js create mode 100644 graphql-subscription-express/node_modules/debug/src/index.js create mode 100644 graphql-subscription-express/node_modules/debug/src/inspector-log.js create mode 100644 graphql-subscription-express/node_modules/debug/src/node.js create mode 100644 graphql-subscription-express/node_modules/define-data-property/.eslintrc create mode 100644 graphql-subscription-express/node_modules/define-data-property/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/define-data-property/.nycrc create mode 100644 graphql-subscription-express/node_modules/define-data-property/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/define-data-property/LICENSE create mode 100644 graphql-subscription-express/node_modules/define-data-property/README.md create mode 100644 graphql-subscription-express/node_modules/define-data-property/index.d.ts create mode 100644 graphql-subscription-express/node_modules/define-data-property/index.js create mode 100644 graphql-subscription-express/node_modules/define-data-property/package.json create mode 100644 graphql-subscription-express/node_modules/define-data-property/test/index.js create mode 100644 graphql-subscription-express/node_modules/define-data-property/tsconfig.json create mode 100644 graphql-subscription-express/node_modules/depd/History.md create mode 100644 graphql-subscription-express/node_modules/depd/LICENSE create mode 100644 graphql-subscription-express/node_modules/depd/Readme.md create mode 100644 graphql-subscription-express/node_modules/depd/index.js create mode 100644 graphql-subscription-express/node_modules/depd/lib/browser/index.js create mode 100644 graphql-subscription-express/node_modules/depd/package.json create mode 100644 graphql-subscription-express/node_modules/destroy/LICENSE create mode 100644 graphql-subscription-express/node_modules/destroy/README.md create mode 100644 graphql-subscription-express/node_modules/destroy/index.js create mode 100644 graphql-subscription-express/node_modules/destroy/package.json create mode 100644 graphql-subscription-express/node_modules/ee-first/LICENSE create mode 100644 graphql-subscription-express/node_modules/ee-first/README.md create mode 100644 graphql-subscription-express/node_modules/ee-first/index.js create mode 100644 graphql-subscription-express/node_modules/ee-first/package.json create mode 100644 graphql-subscription-express/node_modules/encodeurl/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/encodeurl/LICENSE create mode 100644 graphql-subscription-express/node_modules/encodeurl/README.md create mode 100644 graphql-subscription-express/node_modules/encodeurl/index.js create mode 100644 graphql-subscription-express/node_modules/encodeurl/package.json create mode 100644 graphql-subscription-express/node_modules/es-define-property/.eslintrc create mode 100644 graphql-subscription-express/node_modules/es-define-property/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/es-define-property/.nycrc create mode 100644 graphql-subscription-express/node_modules/es-define-property/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/es-define-property/LICENSE create mode 100644 graphql-subscription-express/node_modules/es-define-property/README.md create mode 100644 graphql-subscription-express/node_modules/es-define-property/index.d.ts create mode 100644 graphql-subscription-express/node_modules/es-define-property/index.js create mode 100644 graphql-subscription-express/node_modules/es-define-property/package.json create mode 100644 graphql-subscription-express/node_modules/es-define-property/test/index.js create mode 100644 graphql-subscription-express/node_modules/es-define-property/tsconfig.json create mode 100644 graphql-subscription-express/node_modules/es-errors/.eslintrc create mode 100644 graphql-subscription-express/node_modules/es-errors/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/es-errors/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/es-errors/LICENSE create mode 100644 graphql-subscription-express/node_modules/es-errors/README.md create mode 100644 graphql-subscription-express/node_modules/es-errors/eval.d.ts create mode 100644 graphql-subscription-express/node_modules/es-errors/eval.js create mode 100644 graphql-subscription-express/node_modules/es-errors/index.d.ts create mode 100644 graphql-subscription-express/node_modules/es-errors/index.js create mode 100644 graphql-subscription-express/node_modules/es-errors/package.json create mode 100644 graphql-subscription-express/node_modules/es-errors/range.d.ts create mode 100644 graphql-subscription-express/node_modules/es-errors/range.js create mode 100644 graphql-subscription-express/node_modules/es-errors/ref.d.ts create mode 100644 graphql-subscription-express/node_modules/es-errors/ref.js create mode 100644 graphql-subscription-express/node_modules/es-errors/syntax.d.ts create mode 100644 graphql-subscription-express/node_modules/es-errors/syntax.js create mode 100644 graphql-subscription-express/node_modules/es-errors/test/index.js create mode 100644 graphql-subscription-express/node_modules/es-errors/tsconfig.json create mode 100644 graphql-subscription-express/node_modules/es-errors/type.d.ts create mode 100644 graphql-subscription-express/node_modules/es-errors/type.js create mode 100644 graphql-subscription-express/node_modules/es-errors/uri.d.ts create mode 100644 graphql-subscription-express/node_modules/es-errors/uri.js create mode 100644 graphql-subscription-express/node_modules/escape-html/LICENSE create mode 100644 graphql-subscription-express/node_modules/escape-html/Readme.md create mode 100644 graphql-subscription-express/node_modules/escape-html/index.js create mode 100644 graphql-subscription-express/node_modules/escape-html/package.json create mode 100644 graphql-subscription-express/node_modules/etag/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/etag/LICENSE create mode 100644 graphql-subscription-express/node_modules/etag/README.md create mode 100644 graphql-subscription-express/node_modules/etag/index.js create mode 100644 graphql-subscription-express/node_modules/etag/package.json create mode 100644 graphql-subscription-express/node_modules/express/History.md create mode 100644 graphql-subscription-express/node_modules/express/LICENSE create mode 100644 graphql-subscription-express/node_modules/express/Readme.md create mode 100644 graphql-subscription-express/node_modules/express/index.js create mode 100644 graphql-subscription-express/node_modules/express/lib/application.js create mode 100644 graphql-subscription-express/node_modules/express/lib/express.js create mode 100644 graphql-subscription-express/node_modules/express/lib/middleware/init.js create mode 100644 graphql-subscription-express/node_modules/express/lib/middleware/query.js create mode 100644 graphql-subscription-express/node_modules/express/lib/request.js create mode 100644 graphql-subscription-express/node_modules/express/lib/response.js create mode 100644 graphql-subscription-express/node_modules/express/lib/router/index.js create mode 100644 graphql-subscription-express/node_modules/express/lib/router/layer.js create mode 100644 graphql-subscription-express/node_modules/express/lib/router/route.js create mode 100644 graphql-subscription-express/node_modules/express/lib/utils.js create mode 100644 graphql-subscription-express/node_modules/express/lib/view.js create mode 100644 graphql-subscription-express/node_modules/express/package.json create mode 100644 graphql-subscription-express/node_modules/finalhandler/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/finalhandler/LICENSE create mode 100644 graphql-subscription-express/node_modules/finalhandler/README.md create mode 100644 graphql-subscription-express/node_modules/finalhandler/SECURITY.md create mode 100644 graphql-subscription-express/node_modules/finalhandler/index.js create mode 100644 graphql-subscription-express/node_modules/finalhandler/package.json create mode 100644 graphql-subscription-express/node_modules/forwarded/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/forwarded/LICENSE create mode 100644 graphql-subscription-express/node_modules/forwarded/README.md create mode 100644 graphql-subscription-express/node_modules/forwarded/index.js create mode 100644 graphql-subscription-express/node_modules/forwarded/package.json create mode 100644 graphql-subscription-express/node_modules/fresh/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/fresh/LICENSE create mode 100644 graphql-subscription-express/node_modules/fresh/README.md create mode 100644 graphql-subscription-express/node_modules/fresh/index.js create mode 100644 graphql-subscription-express/node_modules/fresh/package.json create mode 100644 graphql-subscription-express/node_modules/function-bind/.eslintrc create mode 100644 graphql-subscription-express/node_modules/function-bind/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/function-bind/.github/SECURITY.md create mode 100644 graphql-subscription-express/node_modules/function-bind/.nycrc create mode 100644 graphql-subscription-express/node_modules/function-bind/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/function-bind/LICENSE create mode 100644 graphql-subscription-express/node_modules/function-bind/README.md create mode 100644 graphql-subscription-express/node_modules/function-bind/implementation.js create mode 100644 graphql-subscription-express/node_modules/function-bind/index.js create mode 100644 graphql-subscription-express/node_modules/function-bind/package.json create mode 100644 graphql-subscription-express/node_modules/function-bind/test/.eslintrc create mode 100644 graphql-subscription-express/node_modules/function-bind/test/index.js create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/.eslintrc create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/.nycrc create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/LICENSE create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/README.md create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/index.js create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/package.json create mode 100644 graphql-subscription-express/node_modules/get-intrinsic/test/GetIntrinsic.js create mode 100644 graphql-subscription-express/node_modules/gopd/.eslintrc create mode 100644 graphql-subscription-express/node_modules/gopd/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/gopd/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/gopd/LICENSE create mode 100644 graphql-subscription-express/node_modules/gopd/README.md create mode 100644 graphql-subscription-express/node_modules/gopd/index.js create mode 100644 graphql-subscription-express/node_modules/gopd/package.json create mode 100644 graphql-subscription-express/node_modules/gopd/test/index.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/LICENSE.md create mode 100644 graphql-subscription-express/node_modules/graphql-ws/PROTOCOL.md create mode 100644 graphql-subscription-express/node_modules/graphql-ws/README.md create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/client.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/client.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/client.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/client.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/common.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/common.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/common.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/common.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/index.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/index.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/server.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/server.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/server.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/server.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.mts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/utils.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/lib/utils.mjs create mode 100644 graphql-subscription-express/node_modules/graphql-ws/package.json create mode 100644 graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.min.js create mode 100644 graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.min.js.gz create mode 100644 graphql-subscription-express/node_modules/graphql/LICENSE create mode 100644 graphql-subscription-express/node_modules/graphql/NotSupportedTSVersion.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/README.md create mode 100644 graphql-subscription-express/node_modules/graphql/error/GraphQLError.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/error/GraphQLError.js create mode 100644 graphql-subscription-express/node_modules/graphql/error/GraphQLError.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/error/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/error/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/error/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/error/locatedError.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/error/locatedError.js create mode 100644 graphql-subscription-express/node_modules/graphql/error/locatedError.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/error/syntaxError.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/error/syntaxError.js create mode 100644 graphql-subscription-express/node_modules/graphql/error/syntaxError.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/execution/collectFields.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/execution/collectFields.js create mode 100644 graphql-subscription-express/node_modules/graphql/execution/collectFields.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/execution/execute.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/execution/execute.js create mode 100644 graphql-subscription-express/node_modules/graphql/execution/execute.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/execution/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/execution/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/execution/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.js create mode 100644 graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/execution/subscribe.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/execution/subscribe.js create mode 100644 graphql-subscription-express/node_modules/graphql/execution/subscribe.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/execution/values.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/execution/values.js create mode 100644 graphql-subscription-express/node_modules/graphql/execution/values.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/graphql.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/graphql.js create mode 100644 graphql-subscription-express/node_modules/graphql/graphql.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/Maybe.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/Maybe.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/Maybe.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/Path.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/Path.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/Path.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/devAssert.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/devAssert.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/devAssert.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/groupBy.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/groupBy.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/groupBy.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/inspect.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/inspect.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/inspect.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/invariant.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/invariant.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/invariant.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isPromise.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isPromise.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/isPromise.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/keyMap.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/keyMap.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/keyMap.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/mapValue.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/mapValue.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/mapValue.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/memoize3.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/memoize3.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/memoize3.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/toError.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/toError.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/toError.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.js create mode 100644 graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/ast.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/ast.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/ast.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/blockString.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/blockString.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/blockString.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/characterClasses.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/characterClasses.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/characterClasses.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/directiveLocation.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/directiveLocation.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/directiveLocation.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/kinds.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/kinds.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/kinds.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/lexer.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/lexer.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/lexer.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/location.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/location.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/location.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/parser.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/parser.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/parser.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/predicates.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/predicates.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/predicates.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/printLocation.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/printLocation.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/printLocation.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/printString.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/printString.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/printString.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/printer.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/printer.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/printer.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/source.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/source.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/source.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/tokenKind.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/tokenKind.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/tokenKind.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/language/visitor.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/language/visitor.js create mode 100644 graphql-subscription-express/node_modules/graphql/language/visitor.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/package.json create mode 100644 graphql-subscription-express/node_modules/graphql/subscription/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/subscription/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/subscription/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/assertName.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/assertName.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/assertName.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/definition.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/definition.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/definition.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/directives.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/directives.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/directives.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/introspection.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/introspection.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/introspection.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/scalars.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/scalars.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/scalars.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/schema.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/schema.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/schema.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/type/validate.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/type/validate.js create mode 100644 graphql-subscription-express/node_modules/graphql/type/validate.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/assertValidName.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/assertValidName.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/assertValidName.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/astFromValue.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/astFromValue.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/astFromValue.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/concatAST.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/concatAST.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/concatAST.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/extendSchema.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/extendSchema.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/extendSchema.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/printSchema.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/printSchema.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/printSchema.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/separateOperations.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/separateOperations.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/separateOperations.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typeComparators.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typeComparators.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typeComparators.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.js create mode 100644 graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/ValidationContext.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/ValidationContext.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/ValidationContext.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/index.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/index.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/index.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/specifiedRules.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/specifiedRules.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/specifiedRules.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/validation/validate.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/validation/validate.js create mode 100644 graphql-subscription-express/node_modules/graphql/validation/validate.mjs create mode 100644 graphql-subscription-express/node_modules/graphql/version.d.ts create mode 100644 graphql-subscription-express/node_modules/graphql/version.js create mode 100644 graphql-subscription-express/node_modules/graphql/version.mjs create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/.eslintrc create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/.nycrc create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/LICENSE create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/README.md create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/index.js create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/package.json create mode 100644 graphql-subscription-express/node_modules/has-property-descriptors/test/index.js create mode 100644 graphql-subscription-express/node_modules/has-proto/.eslintrc create mode 100644 graphql-subscription-express/node_modules/has-proto/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/has-proto/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/has-proto/LICENSE create mode 100644 graphql-subscription-express/node_modules/has-proto/README.md create mode 100644 graphql-subscription-express/node_modules/has-proto/index.d.ts create mode 100644 graphql-subscription-express/node_modules/has-proto/index.js create mode 100644 graphql-subscription-express/node_modules/has-proto/package.json create mode 100644 graphql-subscription-express/node_modules/has-proto/test/index.js create mode 100644 graphql-subscription-express/node_modules/has-proto/tsconfig.json create mode 100644 graphql-subscription-express/node_modules/has-symbols/.eslintrc create mode 100644 graphql-subscription-express/node_modules/has-symbols/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/has-symbols/.nycrc create mode 100644 graphql-subscription-express/node_modules/has-symbols/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/has-symbols/LICENSE create mode 100644 graphql-subscription-express/node_modules/has-symbols/README.md create mode 100644 graphql-subscription-express/node_modules/has-symbols/index.js create mode 100644 graphql-subscription-express/node_modules/has-symbols/package.json create mode 100644 graphql-subscription-express/node_modules/has-symbols/shams.js create mode 100644 graphql-subscription-express/node_modules/has-symbols/test/index.js create mode 100644 graphql-subscription-express/node_modules/has-symbols/test/shams/core-js.js create mode 100644 graphql-subscription-express/node_modules/has-symbols/test/shams/get-own-property-symbols.js create mode 100644 graphql-subscription-express/node_modules/has-symbols/test/tests.js create mode 100644 graphql-subscription-express/node_modules/hasown/.eslintrc create mode 100644 graphql-subscription-express/node_modules/hasown/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/hasown/.nycrc create mode 100644 graphql-subscription-express/node_modules/hasown/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/hasown/LICENSE create mode 100644 graphql-subscription-express/node_modules/hasown/README.md create mode 100644 graphql-subscription-express/node_modules/hasown/index.d.ts create mode 100644 graphql-subscription-express/node_modules/hasown/index.js create mode 100644 graphql-subscription-express/node_modules/hasown/package.json create mode 100644 graphql-subscription-express/node_modules/hasown/tsconfig.json create mode 100644 graphql-subscription-express/node_modules/http-errors/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/http-errors/LICENSE create mode 100644 graphql-subscription-express/node_modules/http-errors/README.md create mode 100644 graphql-subscription-express/node_modules/http-errors/index.js create mode 100644 graphql-subscription-express/node_modules/http-errors/package.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/Changelog.md create mode 100644 graphql-subscription-express/node_modules/iconv-lite/LICENSE create mode 100644 graphql-subscription-express/node_modules/iconv-lite/README.md create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-codec.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-data.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/index.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/internal.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-codec.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data-generated.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/big5-added.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp936.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp949.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp950.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/eucjp.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gbk-added.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/tables/shiftjis.json create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/utf16.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/encodings/utf7.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/lib/bom-handling.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/lib/extend-node.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/lib/index.d.ts create mode 100644 graphql-subscription-express/node_modules/iconv-lite/lib/index.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/lib/streams.js create mode 100644 graphql-subscription-express/node_modules/iconv-lite/package.json create mode 100644 graphql-subscription-express/node_modules/inherits/LICENSE create mode 100644 graphql-subscription-express/node_modules/inherits/README.md create mode 100644 graphql-subscription-express/node_modules/inherits/inherits.js create mode 100644 graphql-subscription-express/node_modules/inherits/inherits_browser.js create mode 100644 graphql-subscription-express/node_modules/inherits/package.json create mode 100644 graphql-subscription-express/node_modules/ipaddr.js/LICENSE create mode 100644 graphql-subscription-express/node_modules/ipaddr.js/README.md create mode 100644 graphql-subscription-express/node_modules/ipaddr.js/ipaddr.min.js create mode 100644 graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js create mode 100644 graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js.d.ts create mode 100644 graphql-subscription-express/node_modules/ipaddr.js/package.json create mode 100644 graphql-subscription-express/node_modules/media-typer/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/media-typer/LICENSE create mode 100644 graphql-subscription-express/node_modules/media-typer/README.md create mode 100644 graphql-subscription-express/node_modules/media-typer/index.js create mode 100644 graphql-subscription-express/node_modules/media-typer/package.json create mode 100644 graphql-subscription-express/node_modules/merge-descriptors/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/merge-descriptors/LICENSE create mode 100644 graphql-subscription-express/node_modules/merge-descriptors/README.md create mode 100644 graphql-subscription-express/node_modules/merge-descriptors/index.js create mode 100644 graphql-subscription-express/node_modules/merge-descriptors/package.json create mode 100644 graphql-subscription-express/node_modules/methods/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/methods/LICENSE create mode 100644 graphql-subscription-express/node_modules/methods/README.md create mode 100644 graphql-subscription-express/node_modules/methods/index.js create mode 100644 graphql-subscription-express/node_modules/methods/package.json create mode 100644 graphql-subscription-express/node_modules/mime-db/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/mime-db/LICENSE create mode 100644 graphql-subscription-express/node_modules/mime-db/README.md create mode 100644 graphql-subscription-express/node_modules/mime-db/db.json create mode 100644 graphql-subscription-express/node_modules/mime-db/index.js create mode 100644 graphql-subscription-express/node_modules/mime-db/package.json create mode 100644 graphql-subscription-express/node_modules/mime-types/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/mime-types/LICENSE create mode 100644 graphql-subscription-express/node_modules/mime-types/README.md create mode 100644 graphql-subscription-express/node_modules/mime-types/index.js create mode 100644 graphql-subscription-express/node_modules/mime-types/package.json create mode 100644 graphql-subscription-express/node_modules/mime/.npmignore create mode 100644 graphql-subscription-express/node_modules/mime/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/mime/LICENSE create mode 100644 graphql-subscription-express/node_modules/mime/README.md create mode 100755 graphql-subscription-express/node_modules/mime/cli.js create mode 100644 graphql-subscription-express/node_modules/mime/mime.js create mode 100644 graphql-subscription-express/node_modules/mime/package.json create mode 100755 graphql-subscription-express/node_modules/mime/src/build.js create mode 100644 graphql-subscription-express/node_modules/mime/src/test.js create mode 100644 graphql-subscription-express/node_modules/mime/types.json create mode 100644 graphql-subscription-express/node_modules/ms/index.js create mode 100644 graphql-subscription-express/node_modules/ms/license.md create mode 100644 graphql-subscription-express/node_modules/ms/package.json create mode 100644 graphql-subscription-express/node_modules/ms/readme.md create mode 100644 graphql-subscription-express/node_modules/negotiator/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/negotiator/LICENSE create mode 100644 graphql-subscription-express/node_modules/negotiator/README.md create mode 100644 graphql-subscription-express/node_modules/negotiator/index.js create mode 100644 graphql-subscription-express/node_modules/negotiator/lib/charset.js create mode 100644 graphql-subscription-express/node_modules/negotiator/lib/encoding.js create mode 100644 graphql-subscription-express/node_modules/negotiator/lib/language.js create mode 100644 graphql-subscription-express/node_modules/negotiator/lib/mediaType.js create mode 100644 graphql-subscription-express/node_modules/negotiator/package.json create mode 100644 graphql-subscription-express/node_modules/object-inspect/.eslintrc create mode 100644 graphql-subscription-express/node_modules/object-inspect/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/object-inspect/.nycrc create mode 100644 graphql-subscription-express/node_modules/object-inspect/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/object-inspect/LICENSE create mode 100644 graphql-subscription-express/node_modules/object-inspect/example/all.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/example/circular.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/example/fn.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/example/inspect.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/index.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/package-support.json create mode 100644 graphql-subscription-express/node_modules/object-inspect/package.json create mode 100644 graphql-subscription-express/node_modules/object-inspect/readme.markdown create mode 100644 graphql-subscription-express/node_modules/object-inspect/test-core-js.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/bigint.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/browser/dom.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/circular.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/deep.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/element.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/err.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/fakes.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/fn.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/global.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/has.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/holes.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/indent-option.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/inspect.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/lowbyte.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/number.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/quoteStyle.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/toStringTag.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/undef.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/test/values.js create mode 100644 graphql-subscription-express/node_modules/object-inspect/util.inspect.js create mode 100644 graphql-subscription-express/node_modules/on-finished/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/on-finished/LICENSE create mode 100644 graphql-subscription-express/node_modules/on-finished/README.md create mode 100644 graphql-subscription-express/node_modules/on-finished/index.js create mode 100644 graphql-subscription-express/node_modules/on-finished/package.json create mode 100644 graphql-subscription-express/node_modules/parseurl/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/parseurl/LICENSE create mode 100644 graphql-subscription-express/node_modules/parseurl/README.md create mode 100644 graphql-subscription-express/node_modules/parseurl/index.js create mode 100644 graphql-subscription-express/node_modules/parseurl/package.json create mode 100644 graphql-subscription-express/node_modules/path-to-regexp/History.md create mode 100644 graphql-subscription-express/node_modules/path-to-regexp/LICENSE create mode 100644 graphql-subscription-express/node_modules/path-to-regexp/Readme.md create mode 100644 graphql-subscription-express/node_modules/path-to-regexp/index.js create mode 100644 graphql-subscription-express/node_modules/path-to-regexp/package.json create mode 100644 graphql-subscription-express/node_modules/proxy-addr/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/proxy-addr/LICENSE create mode 100644 graphql-subscription-express/node_modules/proxy-addr/README.md create mode 100644 graphql-subscription-express/node_modules/proxy-addr/index.js create mode 100644 graphql-subscription-express/node_modules/proxy-addr/package.json create mode 100644 graphql-subscription-express/node_modules/qs/.editorconfig create mode 100644 graphql-subscription-express/node_modules/qs/.eslintrc create mode 100644 graphql-subscription-express/node_modules/qs/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/qs/.nycrc create mode 100644 graphql-subscription-express/node_modules/qs/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/qs/LICENSE.md create mode 100644 graphql-subscription-express/node_modules/qs/README.md create mode 100644 graphql-subscription-express/node_modules/qs/dist/qs.js create mode 100644 graphql-subscription-express/node_modules/qs/lib/formats.js create mode 100644 graphql-subscription-express/node_modules/qs/lib/index.js create mode 100644 graphql-subscription-express/node_modules/qs/lib/parse.js create mode 100644 graphql-subscription-express/node_modules/qs/lib/stringify.js create mode 100644 graphql-subscription-express/node_modules/qs/lib/utils.js create mode 100644 graphql-subscription-express/node_modules/qs/package.json create mode 100644 graphql-subscription-express/node_modules/qs/test/parse.js create mode 100644 graphql-subscription-express/node_modules/qs/test/stringify.js create mode 100644 graphql-subscription-express/node_modules/qs/test/utils.js create mode 100644 graphql-subscription-express/node_modules/range-parser/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/range-parser/LICENSE create mode 100644 graphql-subscription-express/node_modules/range-parser/README.md create mode 100644 graphql-subscription-express/node_modules/range-parser/index.js create mode 100644 graphql-subscription-express/node_modules/range-parser/package.json create mode 100644 graphql-subscription-express/node_modules/raw-body/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/raw-body/LICENSE create mode 100644 graphql-subscription-express/node_modules/raw-body/README.md create mode 100644 graphql-subscription-express/node_modules/raw-body/SECURITY.md create mode 100644 graphql-subscription-express/node_modules/raw-body/index.d.ts create mode 100644 graphql-subscription-express/node_modules/raw-body/index.js create mode 100644 graphql-subscription-express/node_modules/raw-body/package.json create mode 100644 graphql-subscription-express/node_modules/safe-buffer/LICENSE create mode 100644 graphql-subscription-express/node_modules/safe-buffer/README.md create mode 100644 graphql-subscription-express/node_modules/safe-buffer/index.d.ts create mode 100644 graphql-subscription-express/node_modules/safe-buffer/index.js create mode 100644 graphql-subscription-express/node_modules/safe-buffer/package.json create mode 100644 graphql-subscription-express/node_modules/safer-buffer/LICENSE create mode 100644 graphql-subscription-express/node_modules/safer-buffer/Porting-Buffer.md create mode 100644 graphql-subscription-express/node_modules/safer-buffer/Readme.md create mode 100644 graphql-subscription-express/node_modules/safer-buffer/dangerous.js create mode 100644 graphql-subscription-express/node_modules/safer-buffer/package.json create mode 100644 graphql-subscription-express/node_modules/safer-buffer/safer.js create mode 100644 graphql-subscription-express/node_modules/safer-buffer/tests.js create mode 100644 graphql-subscription-express/node_modules/send/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/send/LICENSE create mode 100644 graphql-subscription-express/node_modules/send/README.md create mode 100644 graphql-subscription-express/node_modules/send/SECURITY.md create mode 100644 graphql-subscription-express/node_modules/send/index.js create mode 100644 graphql-subscription-express/node_modules/send/node_modules/ms/index.js create mode 100644 graphql-subscription-express/node_modules/send/node_modules/ms/license.md create mode 100644 graphql-subscription-express/node_modules/send/node_modules/ms/package.json create mode 100644 graphql-subscription-express/node_modules/send/node_modules/ms/readme.md create mode 100644 graphql-subscription-express/node_modules/send/package.json create mode 100644 graphql-subscription-express/node_modules/serve-static/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/serve-static/LICENSE create mode 100644 graphql-subscription-express/node_modules/serve-static/README.md create mode 100644 graphql-subscription-express/node_modules/serve-static/index.js create mode 100644 graphql-subscription-express/node_modules/serve-static/package.json create mode 100644 graphql-subscription-express/node_modules/set-function-length/.eslintrc create mode 100644 graphql-subscription-express/node_modules/set-function-length/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/set-function-length/.nycrc create mode 100644 graphql-subscription-express/node_modules/set-function-length/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/set-function-length/LICENSE create mode 100644 graphql-subscription-express/node_modules/set-function-length/README.md create mode 100644 graphql-subscription-express/node_modules/set-function-length/env.d.ts create mode 100644 graphql-subscription-express/node_modules/set-function-length/env.js create mode 100644 graphql-subscription-express/node_modules/set-function-length/index.d.ts create mode 100644 graphql-subscription-express/node_modules/set-function-length/index.js create mode 100644 graphql-subscription-express/node_modules/set-function-length/package.json create mode 100644 graphql-subscription-express/node_modules/set-function-length/tsconfig.json create mode 100644 graphql-subscription-express/node_modules/setprototypeof/LICENSE create mode 100644 graphql-subscription-express/node_modules/setprototypeof/README.md create mode 100644 graphql-subscription-express/node_modules/setprototypeof/index.d.ts create mode 100644 graphql-subscription-express/node_modules/setprototypeof/index.js create mode 100644 graphql-subscription-express/node_modules/setprototypeof/package.json create mode 100644 graphql-subscription-express/node_modules/setprototypeof/test/index.js create mode 100644 graphql-subscription-express/node_modules/side-channel/.editorconfig create mode 100644 graphql-subscription-express/node_modules/side-channel/.eslintrc create mode 100644 graphql-subscription-express/node_modules/side-channel/.github/FUNDING.yml create mode 100644 graphql-subscription-express/node_modules/side-channel/.nycrc create mode 100644 graphql-subscription-express/node_modules/side-channel/CHANGELOG.md create mode 100644 graphql-subscription-express/node_modules/side-channel/LICENSE create mode 100644 graphql-subscription-express/node_modules/side-channel/README.md create mode 100644 graphql-subscription-express/node_modules/side-channel/index.d.ts create mode 100644 graphql-subscription-express/node_modules/side-channel/index.js create mode 100644 graphql-subscription-express/node_modules/side-channel/package.json create mode 100644 graphql-subscription-express/node_modules/side-channel/test/index.js create mode 100644 graphql-subscription-express/node_modules/side-channel/tsconfig.json create mode 100644 graphql-subscription-express/node_modules/statuses/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/statuses/LICENSE create mode 100644 graphql-subscription-express/node_modules/statuses/README.md create mode 100644 graphql-subscription-express/node_modules/statuses/codes.json create mode 100644 graphql-subscription-express/node_modules/statuses/index.js create mode 100644 graphql-subscription-express/node_modules/statuses/package.json create mode 100644 graphql-subscription-express/node_modules/toidentifier/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/toidentifier/LICENSE create mode 100644 graphql-subscription-express/node_modules/toidentifier/README.md create mode 100644 graphql-subscription-express/node_modules/toidentifier/index.js create mode 100644 graphql-subscription-express/node_modules/toidentifier/package.json create mode 100644 graphql-subscription-express/node_modules/type-is/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/type-is/LICENSE create mode 100644 graphql-subscription-express/node_modules/type-is/README.md create mode 100644 graphql-subscription-express/node_modules/type-is/index.js create mode 100644 graphql-subscription-express/node_modules/type-is/package.json create mode 100644 graphql-subscription-express/node_modules/unpipe/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/unpipe/LICENSE create mode 100644 graphql-subscription-express/node_modules/unpipe/README.md create mode 100644 graphql-subscription-express/node_modules/unpipe/index.js create mode 100644 graphql-subscription-express/node_modules/unpipe/package.json create mode 100644 graphql-subscription-express/node_modules/utils-merge/.npmignore create mode 100644 graphql-subscription-express/node_modules/utils-merge/LICENSE create mode 100644 graphql-subscription-express/node_modules/utils-merge/README.md create mode 100644 graphql-subscription-express/node_modules/utils-merge/index.js create mode 100644 graphql-subscription-express/node_modules/utils-merge/package.json create mode 100644 graphql-subscription-express/node_modules/vary/HISTORY.md create mode 100644 graphql-subscription-express/node_modules/vary/LICENSE create mode 100644 graphql-subscription-express/node_modules/vary/README.md create mode 100644 graphql-subscription-express/node_modules/vary/index.js create mode 100644 graphql-subscription-express/node_modules/vary/package.json create mode 100644 graphql-subscription-express/node_modules/ws/LICENSE create mode 100644 graphql-subscription-express/node_modules/ws/README.md create mode 100644 graphql-subscription-express/node_modules/ws/browser.js create mode 100644 graphql-subscription-express/node_modules/ws/index.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/buffer-util.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/constants.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/event-target.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/extension.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/limiter.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/permessage-deflate.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/receiver.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/sender.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/stream.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/subprotocol.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/validation.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/websocket-server.js create mode 100644 graphql-subscription-express/node_modules/ws/lib/websocket.js create mode 100644 graphql-subscription-express/node_modules/ws/package.json create mode 100644 graphql-subscription-express/node_modules/ws/wrapper.mjs create mode 100644 graphql-subscription-express/package-lock.json create mode 100644 graphql-subscription-express/package.json create mode 100644 graphql-subscription-express/server.js create mode 100644 graphql-subscription-express/subscriptionClient.js create mode 100644 graphql-subscription/graphql-subscription-client.js create mode 120000 graphql-subscription/node_modules/.bin/loose-envify create mode 100644 graphql-subscription/node_modules/.package-lock.json create mode 100644 graphql-subscription/node_modules/@apollo/client/.changeset/README.md create mode 100644 graphql-subscription/node_modules/@apollo/client/.changeset/config.json create mode 100644 graphql-subscription/node_modules/@apollo/client/CHANGELOG.md create mode 100644 graphql-subscription/node_modules/@apollo/client/LICENSE create mode 100644 graphql-subscription/node_modules/@apollo/client/README.md create mode 100644 graphql-subscription/node_modules/@apollo/client/apollo-client.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/apollo-client.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/apollo-client.min.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/cache.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/cache.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/cache.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/cache.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/common.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/cache/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/config/jest/setup.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/config/jest/setup.js create mode 100644 graphql-subscription/node_modules/@apollo/client/config/jest/setup.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/ApolloClient.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/LocalState.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/LocalState.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/LocalState.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/QueryInfo.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/QueryManager.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/QueryManager.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/QueryManager.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/core.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/core/core.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/core.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/equalByQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/networkStatus.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/networkStatus.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/networkStatus.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/core/types.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/types.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/types.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js create mode 100644 graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/dev.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/dev/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/errors/errors.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/errors/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/errors/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/errors/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/errors/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js create mode 100644 graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch-http/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batching.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batching.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/batching.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/batch/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/context/context.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/context/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/context/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/context/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/context/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/concat.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/concat.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/concat.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/core.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/empty.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/empty.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/empty.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/execute.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/execute.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/execute.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/from.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/from.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/from.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/split.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/split.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/split.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/types.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/types.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/core/types.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/error/error.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/error/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/error/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/error/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/error/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/http.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/selectURI.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/persisted-queries/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/schema/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/schema/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/schema/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/schema/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/subscriptions/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/fromError.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/ws/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/link/ws/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/link/ws/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/ws/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/main.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/main.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/main.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Mutation.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Query.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Query.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Query.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Subscription.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/components.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/types.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/types.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/components/types.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/context.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/context/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/types.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/types.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/types.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/constants.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/internal/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/parser/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/parser/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/parser/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/parser/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/react.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/react.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/react.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/types/types.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/react/types/types.js create mode 100644 graphql-subscription/node_modules/@apollo/client/react/types/types.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/wait.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/wait.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/wait.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/wrap.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/testing.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/compact.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/objects.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/global.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/globals/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/package.json create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.map create mode 100644 graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.native.js create mode 100644 graphql-subscription/node_modules/@apollo/client/version.d.ts create mode 100644 graphql-subscription/node_modules/@apollo/client/version.js create mode 100644 graphql-subscription/node_modules/@apollo/client/version.js.map create mode 100644 graphql-subscription/node_modules/@graphql-typed-document-node/core/LICENSE create mode 100644 graphql-subscription/node_modules/@graphql-typed-document-node/core/package.json create mode 100644 graphql-subscription/node_modules/@graphql-typed-document-node/core/typings/index.d.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/LICENSE create mode 100644 graphql-subscription/node_modules/@wry/caches/README.md create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.map create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.native.js create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/common.d.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/common.js create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/common.js.map create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/index.js create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/index.js.map create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/strong.d.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/strong.js create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/strong.js.map create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/weak.d.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/weak.js create mode 100644 graphql-subscription/node_modules/@wry/caches/lib/weak.js.map create mode 100644 graphql-subscription/node_modules/@wry/caches/package.json create mode 100644 graphql-subscription/node_modules/@wry/caches/rollup.config.js create mode 100644 graphql-subscription/node_modules/@wry/caches/src/common.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/src/index.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/src/strong.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/src/tests/main.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/src/tests/strong.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/src/tests/weak.ts create mode 100644 graphql-subscription/node_modules/@wry/caches/src/weak.ts create mode 100644 graphql-subscription/node_modules/@wry/context/README.md create mode 100644 graphql-subscription/node_modules/@wry/context/lib/bundle.cjs create mode 100644 graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.map create mode 100644 graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.native.js create mode 100644 graphql-subscription/node_modules/@wry/context/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/@wry/context/lib/index.js create mode 100644 graphql-subscription/node_modules/@wry/context/lib/index.js.map create mode 100644 graphql-subscription/node_modules/@wry/context/lib/slot.d.ts create mode 100644 graphql-subscription/node_modules/@wry/context/lib/slot.js create mode 100644 graphql-subscription/node_modules/@wry/context/lib/slot.js.map create mode 100644 graphql-subscription/node_modules/@wry/context/package.json create mode 100644 graphql-subscription/node_modules/@wry/context/rollup.config.js create mode 100644 graphql-subscription/node_modules/@wry/context/src/index.ts create mode 100644 graphql-subscription/node_modules/@wry/context/src/slot.ts create mode 100644 graphql-subscription/node_modules/@wry/context/src/tests/main.ts create mode 100644 graphql-subscription/node_modules/@wry/equality/LICENSE create mode 100644 graphql-subscription/node_modules/@wry/equality/README.md create mode 100644 graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs create mode 100644 graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.map create mode 100644 graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.native.js create mode 100644 graphql-subscription/node_modules/@wry/equality/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/@wry/equality/lib/index.js create mode 100644 graphql-subscription/node_modules/@wry/equality/lib/index.js.map create mode 100644 graphql-subscription/node_modules/@wry/equality/package.json create mode 100644 graphql-subscription/node_modules/@wry/equality/rollup.config.js create mode 100644 graphql-subscription/node_modules/@wry/equality/src/index.ts create mode 100644 graphql-subscription/node_modules/@wry/equality/src/tests/main.ts create mode 100644 graphql-subscription/node_modules/@wry/trie/README.md create mode 100644 graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs create mode 100644 graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs.map create mode 100644 graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs.native.js create mode 100644 graphql-subscription/node_modules/@wry/trie/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/@wry/trie/lib/index.js create mode 100644 graphql-subscription/node_modules/@wry/trie/lib/index.js.map create mode 100644 graphql-subscription/node_modules/@wry/trie/package.json create mode 100644 graphql-subscription/node_modules/@wry/trie/rollup.config.js create mode 100644 graphql-subscription/node_modules/@wry/trie/src/index.ts create mode 100644 graphql-subscription/node_modules/@wry/trie/src/tests/main.ts create mode 100644 graphql-subscription/node_modules/graphql-tag/CHANGELOG.md create mode 100644 graphql-subscription/node_modules/graphql-tag/LICENSE create mode 100644 graphql-subscription/node_modules/graphql-tag/README.md create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.map create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/index.d.ts.map create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/index.js create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/index.js.map create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js.map create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/tests.d.ts create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/tests.d.ts.map create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/tests.js create mode 100644 graphql-subscription/node_modules/graphql-tag/lib/tests.js.map create mode 100644 graphql-subscription/node_modules/graphql-tag/loader.js create mode 100644 graphql-subscription/node_modules/graphql-tag/main.js create mode 100644 graphql-subscription/node_modules/graphql-tag/package.json create mode 100644 graphql-subscription/node_modules/graphql-tag/src/index.js.flow create mode 100644 graphql-subscription/node_modules/graphql-tag/src/index.ts create mode 100644 graphql-subscription/node_modules/graphql-tag/src/tests.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/LICENSE.md create mode 100644 graphql-subscription/node_modules/graphql-ws/PROTOCOL.md create mode 100644 graphql-subscription/node_modules/graphql-ws/README.md create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/client.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/client.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/client.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/client.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/common.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/common.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/common.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/common.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/index.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/index.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/index.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/server.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/server.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/server.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/server.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/bun.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/bun.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/deno.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/deno.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/ws.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/use/ws.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/utils.d.mts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/utils.d.ts create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/utils.js create mode 100644 graphql-subscription/node_modules/graphql-ws/lib/utils.mjs create mode 100644 graphql-subscription/node_modules/graphql-ws/package.json create mode 100644 graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.js create mode 100644 graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.min.js create mode 100644 graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.min.js.gz create mode 100644 graphql-subscription/node_modules/graphql/LICENSE create mode 100644 graphql-subscription/node_modules/graphql/NotSupportedTSVersion.d.ts create mode 100644 graphql-subscription/node_modules/graphql/README.md create mode 100644 graphql-subscription/node_modules/graphql/error/GraphQLError.d.ts create mode 100644 graphql-subscription/node_modules/graphql/error/GraphQLError.js create mode 100644 graphql-subscription/node_modules/graphql/error/GraphQLError.mjs create mode 100644 graphql-subscription/node_modules/graphql/error/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/error/index.js create mode 100644 graphql-subscription/node_modules/graphql/error/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/error/locatedError.d.ts create mode 100644 graphql-subscription/node_modules/graphql/error/locatedError.js create mode 100644 graphql-subscription/node_modules/graphql/error/locatedError.mjs create mode 100644 graphql-subscription/node_modules/graphql/error/syntaxError.d.ts create mode 100644 graphql-subscription/node_modules/graphql/error/syntaxError.js create mode 100644 graphql-subscription/node_modules/graphql/error/syntaxError.mjs create mode 100644 graphql-subscription/node_modules/graphql/execution/collectFields.d.ts create mode 100644 graphql-subscription/node_modules/graphql/execution/collectFields.js create mode 100644 graphql-subscription/node_modules/graphql/execution/collectFields.mjs create mode 100644 graphql-subscription/node_modules/graphql/execution/execute.d.ts create mode 100644 graphql-subscription/node_modules/graphql/execution/execute.js create mode 100644 graphql-subscription/node_modules/graphql/execution/execute.mjs create mode 100644 graphql-subscription/node_modules/graphql/execution/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/execution/index.js create mode 100644 graphql-subscription/node_modules/graphql/execution/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.d.ts create mode 100644 graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.js create mode 100644 graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.mjs create mode 100644 graphql-subscription/node_modules/graphql/execution/subscribe.d.ts create mode 100644 graphql-subscription/node_modules/graphql/execution/subscribe.js create mode 100644 graphql-subscription/node_modules/graphql/execution/subscribe.mjs create mode 100644 graphql-subscription/node_modules/graphql/execution/values.d.ts create mode 100644 graphql-subscription/node_modules/graphql/execution/values.js create mode 100644 graphql-subscription/node_modules/graphql/execution/values.mjs create mode 100644 graphql-subscription/node_modules/graphql/graphql.d.ts create mode 100644 graphql-subscription/node_modules/graphql/graphql.js create mode 100644 graphql-subscription/node_modules/graphql/graphql.mjs create mode 100644 graphql-subscription/node_modules/graphql/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/index.js create mode 100644 graphql-subscription/node_modules/graphql/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/Maybe.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/Maybe.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/Maybe.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/ObjMap.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/ObjMap.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/ObjMap.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/Path.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/Path.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/Path.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/devAssert.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/devAssert.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/devAssert.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/didYouMean.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/didYouMean.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/didYouMean.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/groupBy.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/groupBy.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/groupBy.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/identityFunc.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/identityFunc.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/identityFunc.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/inspect.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/inspect.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/inspect.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/instanceOf.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/instanceOf.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/instanceOf.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/invariant.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/invariant.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/invariant.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isIterableObject.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isIterableObject.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isIterableObject.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isObjectLike.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isObjectLike.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isObjectLike.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isPromise.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isPromise.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/isPromise.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/keyMap.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/keyMap.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/keyMap.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/keyValMap.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/keyValMap.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/keyValMap.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/mapValue.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/mapValue.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/mapValue.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/memoize3.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/memoize3.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/memoize3.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/naturalCompare.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/naturalCompare.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/naturalCompare.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/printPathArray.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/printPathArray.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/printPathArray.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/promiseForObject.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/promiseForObject.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/promiseForObject.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/promiseReduce.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/promiseReduce.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/promiseReduce.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/suggestionList.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/suggestionList.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/suggestionList.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/toError.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/toError.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/toError.mjs create mode 100644 graphql-subscription/node_modules/graphql/jsutils/toObjMap.d.ts create mode 100644 graphql-subscription/node_modules/graphql/jsutils/toObjMap.js create mode 100644 graphql-subscription/node_modules/graphql/jsutils/toObjMap.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/ast.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/ast.js create mode 100644 graphql-subscription/node_modules/graphql/language/ast.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/blockString.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/blockString.js create mode 100644 graphql-subscription/node_modules/graphql/language/blockString.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/characterClasses.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/characterClasses.js create mode 100644 graphql-subscription/node_modules/graphql/language/characterClasses.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/directiveLocation.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/directiveLocation.js create mode 100644 graphql-subscription/node_modules/graphql/language/directiveLocation.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/index.js create mode 100644 graphql-subscription/node_modules/graphql/language/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/kinds.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/kinds.js create mode 100644 graphql-subscription/node_modules/graphql/language/kinds.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/lexer.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/lexer.js create mode 100644 graphql-subscription/node_modules/graphql/language/lexer.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/location.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/location.js create mode 100644 graphql-subscription/node_modules/graphql/language/location.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/parser.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/parser.js create mode 100644 graphql-subscription/node_modules/graphql/language/parser.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/predicates.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/predicates.js create mode 100644 graphql-subscription/node_modules/graphql/language/predicates.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/printLocation.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/printLocation.js create mode 100644 graphql-subscription/node_modules/graphql/language/printLocation.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/printString.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/printString.js create mode 100644 graphql-subscription/node_modules/graphql/language/printString.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/printer.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/printer.js create mode 100644 graphql-subscription/node_modules/graphql/language/printer.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/source.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/source.js create mode 100644 graphql-subscription/node_modules/graphql/language/source.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/tokenKind.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/tokenKind.js create mode 100644 graphql-subscription/node_modules/graphql/language/tokenKind.mjs create mode 100644 graphql-subscription/node_modules/graphql/language/visitor.d.ts create mode 100644 graphql-subscription/node_modules/graphql/language/visitor.js create mode 100644 graphql-subscription/node_modules/graphql/language/visitor.mjs create mode 100644 graphql-subscription/node_modules/graphql/package.json create mode 100644 graphql-subscription/node_modules/graphql/subscription/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/subscription/index.js create mode 100644 graphql-subscription/node_modules/graphql/subscription/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/assertName.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/assertName.js create mode 100644 graphql-subscription/node_modules/graphql/type/assertName.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/definition.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/definition.js create mode 100644 graphql-subscription/node_modules/graphql/type/definition.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/directives.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/directives.js create mode 100644 graphql-subscription/node_modules/graphql/type/directives.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/index.js create mode 100644 graphql-subscription/node_modules/graphql/type/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/introspection.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/introspection.js create mode 100644 graphql-subscription/node_modules/graphql/type/introspection.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/scalars.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/scalars.js create mode 100644 graphql-subscription/node_modules/graphql/type/scalars.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/schema.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/schema.js create mode 100644 graphql-subscription/node_modules/graphql/type/schema.mjs create mode 100644 graphql-subscription/node_modules/graphql/type/validate.d.ts create mode 100644 graphql-subscription/node_modules/graphql/type/validate.js create mode 100644 graphql-subscription/node_modules/graphql/type/validate.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/TypeInfo.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/TypeInfo.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/TypeInfo.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/assertValidName.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/assertValidName.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/assertValidName.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/astFromValue.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/astFromValue.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/astFromValue.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/buildASTSchema.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/buildASTSchema.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/buildASTSchema.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/buildClientSchema.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/buildClientSchema.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/buildClientSchema.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/coerceInputValue.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/coerceInputValue.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/coerceInputValue.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/concatAST.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/concatAST.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/concatAST.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/extendSchema.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/extendSchema.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/extendSchema.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/getOperationAST.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/getOperationAST.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/getOperationAST.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/getOperationRootType.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/getOperationRootType.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/getOperationRootType.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/index.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/printSchema.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/printSchema.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/printSchema.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/separateOperations.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/separateOperations.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/separateOperations.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/sortValueNode.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/sortValueNode.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/sortValueNode.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/typeComparators.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/typeComparators.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/typeComparators.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/typeFromAST.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/typeFromAST.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/typeFromAST.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/valueFromAST.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/valueFromAST.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/valueFromAST.mjs create mode 100644 graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.d.ts create mode 100644 graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.js create mode 100644 graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/ValidationContext.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/ValidationContext.js create mode 100644 graphql-subscription/node_modules/graphql/validation/ValidationContext.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/index.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/index.js create mode 100644 graphql-subscription/node_modules/graphql/validation/index.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js create mode 100644 graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/specifiedRules.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/specifiedRules.js create mode 100644 graphql-subscription/node_modules/graphql/validation/specifiedRules.mjs create mode 100644 graphql-subscription/node_modules/graphql/validation/validate.d.ts create mode 100644 graphql-subscription/node_modules/graphql/validation/validate.js create mode 100644 graphql-subscription/node_modules/graphql/validation/validate.mjs create mode 100644 graphql-subscription/node_modules/graphql/version.d.ts create mode 100644 graphql-subscription/node_modules/graphql/version.js create mode 100644 graphql-subscription/node_modules/graphql/version.mjs create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/CHANGELOG.md create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/LICENSE.md create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/README.md create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.js create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.min.js create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/package.json create mode 100644 graphql-subscription/node_modules/hoist-non-react-statics/src/index.js create mode 100644 graphql-subscription/node_modules/js-tokens/CHANGELOG.md create mode 100644 graphql-subscription/node_modules/js-tokens/LICENSE create mode 100644 graphql-subscription/node_modules/js-tokens/README.md create mode 100644 graphql-subscription/node_modules/js-tokens/index.js create mode 100644 graphql-subscription/node_modules/js-tokens/package.json create mode 100644 graphql-subscription/node_modules/loose-envify/LICENSE create mode 100644 graphql-subscription/node_modules/loose-envify/README.md create mode 100755 graphql-subscription/node_modules/loose-envify/cli.js create mode 100644 graphql-subscription/node_modules/loose-envify/custom.js create mode 100644 graphql-subscription/node_modules/loose-envify/index.js create mode 100644 graphql-subscription/node_modules/loose-envify/loose-envify.js create mode 100644 graphql-subscription/node_modules/loose-envify/package.json create mode 100644 graphql-subscription/node_modules/loose-envify/replace.js create mode 100644 graphql-subscription/node_modules/object-assign/index.js create mode 100644 graphql-subscription/node_modules/object-assign/license create mode 100644 graphql-subscription/node_modules/object-assign/package.json create mode 100644 graphql-subscription/node_modules/object-assign/readme.md create mode 100644 graphql-subscription/node_modules/optimism/.github/dependabot.yml create mode 100644 graphql-subscription/node_modules/optimism/.github/workflows/main.yml create mode 100644 graphql-subscription/node_modules/optimism/LICENSE create mode 100644 graphql-subscription/node_modules/optimism/README.md create mode 100644 graphql-subscription/node_modules/optimism/lib/bundle.cjs create mode 100644 graphql-subscription/node_modules/optimism/lib/bundle.cjs.map create mode 100644 graphql-subscription/node_modules/optimism/lib/bundle.cjs.native.js create mode 100644 graphql-subscription/node_modules/optimism/lib/context.d.ts create mode 100644 graphql-subscription/node_modules/optimism/lib/context.js create mode 100644 graphql-subscription/node_modules/optimism/lib/context.js.map create mode 100644 graphql-subscription/node_modules/optimism/lib/dep.d.ts create mode 100644 graphql-subscription/node_modules/optimism/lib/dep.js create mode 100644 graphql-subscription/node_modules/optimism/lib/dep.js.map create mode 100644 graphql-subscription/node_modules/optimism/lib/entry.d.ts create mode 100644 graphql-subscription/node_modules/optimism/lib/entry.js create mode 100644 graphql-subscription/node_modules/optimism/lib/entry.js.map create mode 100644 graphql-subscription/node_modules/optimism/lib/helpers.d.ts create mode 100644 graphql-subscription/node_modules/optimism/lib/helpers.js create mode 100644 graphql-subscription/node_modules/optimism/lib/helpers.js.map create mode 100644 graphql-subscription/node_modules/optimism/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/optimism/lib/index.js create mode 100644 graphql-subscription/node_modules/optimism/lib/index.js.map create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/LICENSE create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/README.md create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.map create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.native.js create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.d.ts create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js.map create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/package.json create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/rollup.config.js create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/index.ts create mode 100644 graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/tests/main.ts create mode 100644 graphql-subscription/node_modules/optimism/package.json create mode 100644 graphql-subscription/node_modules/optimism/src/context.ts create mode 100644 graphql-subscription/node_modules/optimism/src/dep.ts create mode 100644 graphql-subscription/node_modules/optimism/src/entry.ts create mode 100644 graphql-subscription/node_modules/optimism/src/helpers.ts create mode 100644 graphql-subscription/node_modules/optimism/src/index.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/api.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/cache.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/context.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/deps.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/exceptions.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/key-trie.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/main.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/performance.ts create mode 100644 graphql-subscription/node_modules/optimism/src/tests/test-utils.ts create mode 100644 graphql-subscription/node_modules/prop-types/LICENSE create mode 100644 graphql-subscription/node_modules/prop-types/README.md create mode 100644 graphql-subscription/node_modules/prop-types/checkPropTypes.js create mode 100644 graphql-subscription/node_modules/prop-types/factory.js create mode 100644 graphql-subscription/node_modules/prop-types/factoryWithThrowingShims.js create mode 100644 graphql-subscription/node_modules/prop-types/factoryWithTypeCheckers.js create mode 100644 graphql-subscription/node_modules/prop-types/index.js create mode 100644 graphql-subscription/node_modules/prop-types/lib/ReactPropTypesSecret.js create mode 100644 graphql-subscription/node_modules/prop-types/lib/has.js create mode 100644 graphql-subscription/node_modules/prop-types/package.json create mode 100644 graphql-subscription/node_modules/prop-types/prop-types.js create mode 100644 graphql-subscription/node_modules/prop-types/prop-types.min.js create mode 100644 graphql-subscription/node_modules/react-is/LICENSE create mode 100644 graphql-subscription/node_modules/react-is/README.md create mode 100644 graphql-subscription/node_modules/react-is/build-info.json create mode 100644 graphql-subscription/node_modules/react-is/cjs/react-is.development.js create mode 100644 graphql-subscription/node_modules/react-is/cjs/react-is.production.min.js create mode 100644 graphql-subscription/node_modules/react-is/index.js create mode 100644 graphql-subscription/node_modules/react-is/package.json create mode 100644 graphql-subscription/node_modules/react-is/umd/react-is.development.js create mode 100644 graphql-subscription/node_modules/react-is/umd/react-is.production.min.js create mode 100644 graphql-subscription/node_modules/react/LICENSE create mode 100644 graphql-subscription/node_modules/react/README.md create mode 100644 graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.development.js create mode 100644 graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js create mode 100644 graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js create mode 100644 graphql-subscription/node_modules/react/cjs/react-jsx-runtime.development.js create mode 100644 graphql-subscription/node_modules/react/cjs/react-jsx-runtime.production.min.js create mode 100644 graphql-subscription/node_modules/react/cjs/react-jsx-runtime.profiling.min.js create mode 100644 graphql-subscription/node_modules/react/cjs/react.development.js create mode 100644 graphql-subscription/node_modules/react/cjs/react.production.min.js create mode 100644 graphql-subscription/node_modules/react/cjs/react.shared-subset.development.js create mode 100644 graphql-subscription/node_modules/react/cjs/react.shared-subset.production.min.js create mode 100644 graphql-subscription/node_modules/react/index.js create mode 100644 graphql-subscription/node_modules/react/jsx-dev-runtime.js create mode 100644 graphql-subscription/node_modules/react/jsx-runtime.js create mode 100644 graphql-subscription/node_modules/react/package.json create mode 100644 graphql-subscription/node_modules/react/react.shared-subset.js create mode 100644 graphql-subscription/node_modules/react/umd/react.development.js create mode 100644 graphql-subscription/node_modules/react/umd/react.production.min.js create mode 100644 graphql-subscription/node_modules/react/umd/react.profiling.min.js create mode 100644 graphql-subscription/node_modules/rehackt/README.md create mode 100644 graphql-subscription/node_modules/rehackt/index.d.ts create mode 100644 graphql-subscription/node_modules/rehackt/index.js create mode 100644 graphql-subscription/node_modules/rehackt/package.json create mode 100644 graphql-subscription/node_modules/rehackt/rsc.js create mode 100644 graphql-subscription/node_modules/response-iterator/LICENSE create mode 100644 graphql-subscription/node_modules/response-iterator/README.md create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/index.js create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/index.js.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/cjs/package.json create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/esm/package.json create mode 100644 graphql-subscription/node_modules/response-iterator/dist/types/async.d.ts create mode 100644 graphql-subscription/node_modules/response-iterator/dist/types/index.d.ts create mode 100644 graphql-subscription/node_modules/response-iterator/dist/types/nodeStream.d.ts create mode 100644 graphql-subscription/node_modules/response-iterator/dist/types/promise.d.ts create mode 100644 graphql-subscription/node_modules/response-iterator/dist/types/reader.d.ts create mode 100644 graphql-subscription/node_modules/response-iterator/dist/umd/package.json create mode 100644 graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js create mode 100644 graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js.map create mode 100644 graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js create mode 100644 graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js.map create mode 100644 graphql-subscription/node_modules/response-iterator/package.json create mode 100644 graphql-subscription/node_modules/symbol-observable/CHANGELOG.md create mode 100644 graphql-subscription/node_modules/symbol-observable/README.md create mode 100644 graphql-subscription/node_modules/symbol-observable/es/index.js create mode 100644 graphql-subscription/node_modules/symbol-observable/es/ponyfill.js create mode 100644 graphql-subscription/node_modules/symbol-observable/index.d.ts create mode 100644 graphql-subscription/node_modules/symbol-observable/index.js create mode 100644 graphql-subscription/node_modules/symbol-observable/lib/index.js create mode 100644 graphql-subscription/node_modules/symbol-observable/lib/ponyfill.js create mode 100644 graphql-subscription/node_modules/symbol-observable/license create mode 100644 graphql-subscription/node_modules/symbol-observable/package.json create mode 100644 graphql-subscription/node_modules/symbol-observable/ponyfill.d.ts create mode 100644 graphql-subscription/node_modules/symbol-observable/ponyfill.js create mode 100644 graphql-subscription/node_modules/ts-invariant/LICENSE create mode 100644 graphql-subscription/node_modules/ts-invariant/README.md create mode 100644 graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs create mode 100644 graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.map create mode 100644 graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.native.js create mode 100644 graphql-subscription/node_modules/ts-invariant/lib/invariant.d.ts create mode 100644 graphql-subscription/node_modules/ts-invariant/lib/invariant.js create mode 100644 graphql-subscription/node_modules/ts-invariant/lib/invariant.js.map create mode 100644 graphql-subscription/node_modules/ts-invariant/package.json create mode 100644 graphql-subscription/node_modules/ts-invariant/process/index.d.ts create mode 100644 graphql-subscription/node_modules/ts-invariant/process/index.js create mode 100644 graphql-subscription/node_modules/ts-invariant/process/main.cjs create mode 100644 graphql-subscription/node_modules/ts-invariant/process/main.cjs.map create mode 100644 graphql-subscription/node_modules/ts-invariant/process/main.cjs.native.js create mode 100644 graphql-subscription/node_modules/ts-invariant/process/package.json create mode 100644 graphql-subscription/node_modules/ts-invariant/rollup.config.js create mode 100644 graphql-subscription/node_modules/ts-invariant/tsconfig.json create mode 100644 graphql-subscription/node_modules/ts-invariant/tsconfig.rollup.json create mode 100644 graphql-subscription/node_modules/tslib/CopyrightNotice.txt create mode 100644 graphql-subscription/node_modules/tslib/LICENSE.txt create mode 100644 graphql-subscription/node_modules/tslib/README.md create mode 100644 graphql-subscription/node_modules/tslib/SECURITY.md create mode 100644 graphql-subscription/node_modules/tslib/modules/index.d.ts create mode 100644 graphql-subscription/node_modules/tslib/modules/index.js create mode 100644 graphql-subscription/node_modules/tslib/modules/package.json create mode 100644 graphql-subscription/node_modules/tslib/package.json create mode 100644 graphql-subscription/node_modules/tslib/tslib.d.ts create mode 100644 graphql-subscription/node_modules/tslib/tslib.es6.html create mode 100644 graphql-subscription/node_modules/tslib/tslib.es6.js create mode 100644 graphql-subscription/node_modules/tslib/tslib.es6.mjs create mode 100644 graphql-subscription/node_modules/tslib/tslib.html create mode 100644 graphql-subscription/node_modules/tslib/tslib.js create mode 100644 graphql-subscription/node_modules/ws/LICENSE create mode 100644 graphql-subscription/node_modules/ws/README.md create mode 100644 graphql-subscription/node_modules/ws/browser.js create mode 100644 graphql-subscription/node_modules/ws/index.js create mode 100644 graphql-subscription/node_modules/ws/lib/buffer-util.js create mode 100644 graphql-subscription/node_modules/ws/lib/constants.js create mode 100644 graphql-subscription/node_modules/ws/lib/event-target.js create mode 100644 graphql-subscription/node_modules/ws/lib/extension.js create mode 100644 graphql-subscription/node_modules/ws/lib/limiter.js create mode 100644 graphql-subscription/node_modules/ws/lib/permessage-deflate.js create mode 100644 graphql-subscription/node_modules/ws/lib/receiver.js create mode 100644 graphql-subscription/node_modules/ws/lib/sender.js create mode 100644 graphql-subscription/node_modules/ws/lib/stream.js create mode 100644 graphql-subscription/node_modules/ws/lib/subprotocol.js create mode 100644 graphql-subscription/node_modules/ws/lib/validation.js create mode 100644 graphql-subscription/node_modules/ws/lib/websocket-server.js create mode 100644 graphql-subscription/node_modules/ws/lib/websocket.js create mode 100644 graphql-subscription/node_modules/ws/package.json create mode 100644 graphql-subscription/node_modules/ws/wrapper.mjs create mode 100644 graphql-subscription/node_modules/zen-observable-ts/.github/dependabot.yml create mode 100644 graphql-subscription/node_modules/zen-observable-ts/.github/workflows/node.js.yml create mode 100644 graphql-subscription/node_modules/zen-observable-ts/LICENSE create mode 100644 graphql-subscription/node_modules/zen-observable-ts/README.md create mode 100644 graphql-subscription/node_modules/zen-observable-ts/index.cjs create mode 100644 graphql-subscription/node_modules/zen-observable-ts/index.cjs.native.js create mode 100644 graphql-subscription/node_modules/zen-observable-ts/module.d.ts create mode 100644 graphql-subscription/node_modules/zen-observable-ts/module.js create mode 100644 graphql-subscription/node_modules/zen-observable-ts/package.json create mode 100644 graphql-subscription/node_modules/zen-observable-ts/rollup.test.config.js create mode 100644 graphql-subscription/node_modules/zen-observable-ts/src/module.js create mode 100644 graphql-subscription/node_modules/zen-observable/.editorconfig create mode 100644 graphql-subscription/node_modules/zen-observable/.eslintrc.js create mode 100644 graphql-subscription/node_modules/zen-observable/LICENSE create mode 100644 graphql-subscription/node_modules/zen-observable/README.md create mode 100644 graphql-subscription/node_modules/zen-observable/esm.js create mode 100644 graphql-subscription/node_modules/zen-observable/extras.js create mode 100644 graphql-subscription/node_modules/zen-observable/index.js create mode 100644 graphql-subscription/node_modules/zen-observable/lib/Observable.js create mode 100644 graphql-subscription/node_modules/zen-observable/lib/extras.js create mode 100644 graphql-subscription/node_modules/zen-observable/package.json create mode 100644 graphql-subscription/node_modules/zen-observable/scripts/babel-plugins.js create mode 100644 graphql-subscription/node_modules/zen-observable/scripts/build.js create mode 100644 graphql-subscription/node_modules/zen-observable/scripts/mocha-require.js create mode 100644 graphql-subscription/node_modules/zen-observable/src/Observable.js create mode 100644 graphql-subscription/node_modules/zen-observable/src/extras.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/concat.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/constructor.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/extras/combine-latest.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/extras/merge.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/extras/parse.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/extras/zip.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/filter.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/flat-map.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/for-each.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/from.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/map.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/observer-closed.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/observer-complete.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/observer-error.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/observer-next.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/of.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/properties.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/reduce.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/setup.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/species.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/subscribe.js create mode 100644 graphql-subscription/node_modules/zen-observable/test/subscription.js create mode 100644 graphql-subscription/package-lock.json create mode 100644 graphql-subscription/package.json create mode 100755 graphql-subscription/runsh.sh create mode 100644 graphql-subscription/standard-api-key-login.html diff --git a/GraphQL Authentications.postman_collection.json b/GraphQL Authentications.postman_collection.json new file mode 100644 index 0000000..a459d75 --- /dev/null +++ b/GraphQL Authentications.postman_collection.json @@ -0,0 +1,167 @@ +{ + "info": { + "_postman_id": "7bb9858f-4bd4-4869-b69b-62ba97ad8392", + "name": "GraphQL Authentications", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "29186461" + }, + "item": [ + { + "name": "Full Read", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Basic YWRtaW46YWRtaW4=" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "graphql", + "graphql": { + "query": "query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\n ResPartner(\n offset: $offset\n limit: $limit\n order: $order\n domain: $domain\n )\n {\n id\n name\n phone\n email\n is_company\n country_id{\n name\n code\n }\n user_id{\n name\n active\n }\n company_id{\n name\n }\n }\n}\n", + "variables": "{\n \"offset\": 0,\n \"limit\": 5,\n \"order\": \"name,id desc\",\n \"domain\": [[\"is_company\",\"=\",true]]\n}\n" + } + }, + "url": { + "raw": "http://192.168.1.15:8016/gqlapi", + "protocol": "http", + "host": [ + "192", + "168", + "1", + "15" + ], + "port": "8016", + "path": [ + "gqlapi" + ] + } + }, + "response": [] + }, + { + "name": "Auth API Key", + "request": { + "method": "POST", + "header": [ + { + "key": "x-api-key", + "value": "nZ(xta#/(uh#DN,Ce\"=U`iA(y|5Fd]b&" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "graphql", + "graphql": { + "query": "query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\n ResPartner(\n offset: $offset\n limit: $limit\n order: $order\n domain: $domain\n )\n {\n id\n name\n phone\n email\n is_company\n country_id{\n name\n code\n }\n user_id{\n name\n active\n }\n company_id{\n name\n }\n }\n}\n", + "variables": "{\n \"offset\": 0,\n \"limit\": 5,\n \"order\": \"name,id desc\",\n \"domain\": [[\"is_company\",\"=\",true]]\n}\n" + } + }, + "url": { + "raw": "http://192.168.1.15:8016/gqlkey", + "protocol": "http", + "host": [ + "192", + "168", + "1", + "15" + ], + "port": "8016", + "path": [ + "gqlkey" + ] + } + }, + "response": [] + }, + { + "name": "Auth User", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "username", + "value": "admin" + }, + { + "key": "password", + "value": "admin", + "type": "text" + } + ], + "body": { + "mode": "graphql", + "graphql": { + "query": "query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\n ResPartner(\n offset: $offset\n limit: $limit\n order: $order\n domain: $domain\n )\n {\n id\n name\n phone\n email\n is_company\n country_id{\n name\n code\n }\n user_id{\n name\n active\n }\n company_id{\n name\n }\n }\n}\n", + "variables": "{\n \"offset\": 0,\n \"limit\": 5,\n \"order\": \"name,id desc\",\n \"domain\": [[\"is_company\",\"=\",true]]\n}\n" + } + }, + "url": { + "raw": "http://192.168.1.15:8016/gqluser", + "protocol": "http", + "host": [ + "192", + "168", + "1", + "15" + ], + "port": "8016", + "path": [ + "gqluser" + ] + } + }, + "response": [] + }, + { + "name": "Auth Basic", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Basic YWRtaW46YWRtaW4=" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "graphql", + "graphql": { + "query": "query MyQuery($offset: Int, $limit: Int, $order: String, $domain: [[Any]]) {\n ResPartner(\n offset: $offset\n limit: $limit\n order: $order\n domain: $domain\n )\n {\n id\n name\n phone\n email\n is_company\n country_id{\n name\n code\n }\n user_id{\n name\n active\n }\n company_id{\n name\n }\n }\n}\n", + "variables": "{\n \"offset\": 0,\n \"limit\": 5,\n \"order\": \"name,id desc\",\n \"domain\": [[\"is_company\",\"=\",true]]\n}\n" + } + }, + "url": { + "raw": "http://192.168.1.15:8016/gqlapi", + "protocol": "http", + "host": [ + "192", + "168", + "1", + "15" + ], + "port": "8016", + "path": [ + "gqlapi" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/graphql-subscription-express/index.html b/graphql-subscription-express/index.html new file mode 100644 index 0000000..763eae6 --- /dev/null +++ b/graphql-subscription-express/index.html @@ -0,0 +1,34 @@ + + + + + + GraphQL Subscription + + +

GraphQL Subscription Response

+
+ + + + diff --git a/graphql-subscription-express/node_modules/.bin/mime b/graphql-subscription-express/node_modules/.bin/mime new file mode 120000 index 0000000..fbb7ee0 --- /dev/null +++ b/graphql-subscription-express/node_modules/.bin/mime @@ -0,0 +1 @@ +../mime/cli.js \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/.package-lock.json b/graphql-subscription-express/node_modules/.package-lock.json new file mode 100644 index 0000000..933a522 --- /dev/null +++ b/graphql-subscription-express/node_modules/.package-lock.json @@ -0,0 +1,726 @@ +{ + "name": "graphql-express-app", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graphql": { + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/graphql-ws": { + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.16.0.tgz", + "integrity": "sha512-Ju2RCU2dQMgSKtArPbEtsK5gNLnsQyTNIo/T7cZNp96niC1x0KdJNZV0TIoilceBPQwfb5itrGl8pkFeOUMl4A==", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "graphql": ">=0.11 <=16" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ws": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/graphql-subscription-express/node_modules/accepts/HISTORY.md b/graphql-subscription-express/node_modules/accepts/HISTORY.md new file mode 100644 index 0000000..cb5990c --- /dev/null +++ b/graphql-subscription-express/node_modules/accepts/HISTORY.md @@ -0,0 +1,243 @@ +1.3.8 / 2022-02-02 +================== + + * deps: mime-types@~2.1.34 + - deps: mime-db@~1.51.0 + * deps: negotiator@0.6.3 + +1.3.7 / 2019-04-29 +================== + + * deps: negotiator@0.6.2 + - Fix sorting charset, encoding, and language with extra parameters + +1.3.6 / 2019-04-28 +================== + + * deps: mime-types@~2.1.24 + - deps: mime-db@~1.40.0 + +1.3.5 / 2018-02-28 +================== + + * deps: mime-types@~2.1.18 + - deps: mime-db@~1.33.0 + +1.3.4 / 2017-08-22 +================== + + * deps: mime-types@~2.1.16 + - deps: mime-db@~1.29.0 + +1.3.3 / 2016-05-02 +================== + + * deps: mime-types@~2.1.11 + - deps: mime-db@~1.23.0 + * deps: negotiator@0.6.1 + - perf: improve `Accept` parsing speed + - perf: improve `Accept-Charset` parsing speed + - perf: improve `Accept-Encoding` parsing speed + - perf: improve `Accept-Language` parsing speed + +1.3.2 / 2016-03-08 +================== + + * deps: mime-types@~2.1.10 + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + - deps: mime-db@~1.22.0 + +1.3.1 / 2016-01-19 +================== + + * deps: mime-types@~2.1.9 + - deps: mime-db@~1.21.0 + +1.3.0 / 2015-09-29 +================== + + * deps: mime-types@~2.1.7 + - deps: mime-db@~1.19.0 + * deps: negotiator@0.6.0 + - Fix including type extensions in parameters in `Accept` parsing + - Fix parsing `Accept` parameters with quoted equals + - Fix parsing `Accept` parameters with quoted semicolons + - Lazy-load modules from main entry point + - perf: delay type concatenation until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove closures getting spec properties + - perf: remove a closure from media type parsing + - perf: remove property delete from media type parsing + +1.2.13 / 2015-09-06 +=================== + + * deps: mime-types@~2.1.6 + - deps: mime-db@~1.18.0 + +1.2.12 / 2015-07-30 +=================== + + * deps: mime-types@~2.1.4 + - deps: mime-db@~1.16.0 + +1.2.11 / 2015-07-16 +=================== + + * deps: mime-types@~2.1.3 + - deps: mime-db@~1.15.0 + +1.2.10 / 2015-07-01 +=================== + + * deps: mime-types@~2.1.2 + - deps: mime-db@~1.14.0 + +1.2.9 / 2015-06-08 +================== + + * deps: mime-types@~2.1.1 + - perf: fix deopt during mapping + +1.2.8 / 2015-06-07 +================== + + * deps: mime-types@~2.1.0 + - deps: mime-db@~1.13.0 + * perf: avoid argument reassignment & argument slice + * perf: avoid negotiator recursive construction + * perf: enable strict mode + * perf: remove unnecessary bitwise operator + +1.2.7 / 2015-05-10 +================== + + * deps: negotiator@0.5.3 + - Fix media type parameter matching to be case-insensitive + +1.2.6 / 2015-05-07 +================== + + * deps: mime-types@~2.0.11 + - deps: mime-db@~1.9.1 + * deps: negotiator@0.5.2 + - Fix comparing media types with quoted values + - Fix splitting media types with quoted commas + +1.2.5 / 2015-03-13 +================== + + * deps: mime-types@~2.0.10 + - deps: mime-db@~1.8.0 + +1.2.4 / 2015-02-14 +================== + + * Support Node.js 0.6 + * deps: mime-types@~2.0.9 + - deps: mime-db@~1.7.0 + * deps: negotiator@0.5.1 + - Fix preference sorting to be stable for long acceptable lists + +1.2.3 / 2015-01-31 +================== + + * deps: mime-types@~2.0.8 + - deps: mime-db@~1.6.0 + +1.2.2 / 2014-12-30 +================== + + * deps: mime-types@~2.0.7 + - deps: mime-db@~1.5.0 + +1.2.1 / 2014-12-30 +================== + + * deps: mime-types@~2.0.5 + - deps: mime-db@~1.3.1 + +1.2.0 / 2014-12-19 +================== + + * deps: negotiator@0.5.0 + - Fix list return order when large accepted list + - Fix missing identity encoding when q=0 exists + - Remove dynamic building of Negotiator class + +1.1.4 / 2014-12-10 +================== + + * deps: mime-types@~2.0.4 + - deps: mime-db@~1.3.0 + +1.1.3 / 2014-11-09 +================== + + * deps: mime-types@~2.0.3 + - deps: mime-db@~1.2.0 + +1.1.2 / 2014-10-14 +================== + + * deps: negotiator@0.4.9 + - Fix error when media type has invalid parameter + +1.1.1 / 2014-09-28 +================== + + * deps: mime-types@~2.0.2 + - deps: mime-db@~1.1.0 + * deps: negotiator@0.4.8 + - Fix all negotiations to be case-insensitive + - Stable sort preferences of same quality according to client order + +1.1.0 / 2014-09-02 +================== + + * update `mime-types` + +1.0.7 / 2014-07-04 +================== + + * Fix wrong type returned from `type` when match after unknown extension + +1.0.6 / 2014-06-24 +================== + + * deps: negotiator@0.4.7 + +1.0.5 / 2014-06-20 +================== + + * fix crash when unknown extension given + +1.0.4 / 2014-06-19 +================== + + * use `mime-types` + +1.0.3 / 2014-06-11 +================== + + * deps: negotiator@0.4.6 + - Order by specificity when quality is the same + +1.0.2 / 2014-05-29 +================== + + * Fix interpretation when header not in request + * deps: pin negotiator@0.4.5 + +1.0.1 / 2014-01-18 +================== + + * Identity encoding isn't always acceptable + * deps: negotiator@~0.4.0 + +1.0.0 / 2013-12-27 +================== + + * Genesis diff --git a/graphql-subscription-express/node_modules/accepts/LICENSE b/graphql-subscription-express/node_modules/accepts/LICENSE new file mode 100644 index 0000000..0616607 --- /dev/null +++ b/graphql-subscription-express/node_modules/accepts/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/accepts/README.md b/graphql-subscription-express/node_modules/accepts/README.md new file mode 100644 index 0000000..82680c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/accepts/README.md @@ -0,0 +1,140 @@ +# accepts + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). +Extracted from [koa](https://www.npmjs.com/package/koa) for general use. + +In addition to negotiator, it allows: + +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` + as well as `('text/html', 'application/json')`. +- Allows type shorthands such as `json`. +- Returns `false` when no types match +- Treats non-existent headers as `*` + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install accepts +``` + +## API + +```js +var accepts = require('accepts') +``` + +### accepts(req) + +Create a new `Accepts` object for the given `req`. + +#### .charset(charsets) + +Return the first accepted charset. If nothing in `charsets` is accepted, +then `false` is returned. + +#### .charsets() + +Return the charsets that the request accepts, in the order of the client's +preference (most preferred first). + +#### .encoding(encodings) + +Return the first accepted encoding. If nothing in `encodings` is accepted, +then `false` is returned. + +#### .encodings() + +Return the encodings that the request accepts, in the order of the client's +preference (most preferred first). + +#### .language(languages) + +Return the first accepted language. If nothing in `languages` is accepted, +then `false` is returned. + +#### .languages() + +Return the languages that the request accepts, in the order of the client's +preference (most preferred first). + +#### .type(types) + +Return the first accepted type (and it is returned as the same text as what +appears in the `types` array). If nothing in `types` is accepted, then `false` +is returned. + +The `types` array can contain full MIME types or file extensions. Any value +that is not a full MIME types is passed to `require('mime-types').lookup`. + +#### .types() + +Return the types that the request accepts, in the order of the client's +preference (most preferred first). + +## Examples + +### Simple type negotiation + +This simple example shows how to use `accepts` to return a different typed +respond body based on what the client wants to accept. The server lists it's +preferences in order and will get back the best match between the client and +server. + +```js +var accepts = require('accepts') +var http = require('http') + +function app (req, res) { + var accept = accepts(req) + + // the order of this list is significant; should be server preferred order + switch (accept.type(['json', 'html'])) { + case 'json': + res.setHeader('Content-Type', 'application/json') + res.write('{"hello":"world!"}') + break + case 'html': + res.setHeader('Content-Type', 'text/html') + res.write('hello, world!') + break + default: + // the fallback is text/plain, so no need to specify it above + res.setHeader('Content-Type', 'text/plain') + res.write('hello, world!') + break + } + + res.end() +} + +http.createServer(app).listen(3000) +``` + +You can test this out with the cURL program: +```sh +curl -I -H'Accept: text/html' http://localhost:3000/ +``` + +## License + +[MIT](LICENSE) + +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master +[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master +[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci +[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml +[node-version-image]: https://badgen.net/npm/node/accepts +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/accepts +[npm-url]: https://npmjs.org/package/accepts +[npm-version-image]: https://badgen.net/npm/v/accepts diff --git a/graphql-subscription-express/node_modules/accepts/index.js b/graphql-subscription-express/node_modules/accepts/index.js new file mode 100644 index 0000000..e9b2f63 --- /dev/null +++ b/graphql-subscription-express/node_modules/accepts/index.js @@ -0,0 +1,238 @@ +/*! + * accepts + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Negotiator = require('negotiator') +var mime = require('mime-types') + +/** + * Module exports. + * @public + */ + +module.exports = Accepts + +/** + * Create a new Accepts object for the given req. + * + * @param {object} req + * @public + */ + +function Accepts (req) { + if (!(this instanceof Accepts)) { + return new Accepts(req) + } + + this.headers = req.headers + this.negotiator = new Negotiator(req) +} + +/** + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json" or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * this.types('html'); + * // => "html" + * + * // Accept: text/*, application/json + * this.types('html'); + * // => "html" + * this.types('text/html'); + * // => "text/html" + * this.types('json', 'text'); + * // => "json" + * this.types('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * this.types('image/png'); + * this.types('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * this.types(['html', 'json']); + * this.types('html', 'json'); + * // => "json" + * + * @param {String|Array} types... + * @return {String|Array|Boolean} + * @public + */ + +Accepts.prototype.type = +Accepts.prototype.types = function (types_) { + var types = types_ + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i] + } + } + + // no types, return all requested types + if (!types || types.length === 0) { + return this.negotiator.mediaTypes() + } + + // no accept header, return first given type + if (!this.headers.accept) { + return types[0] + } + + var mimes = types.map(extToMime) + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) + var first = accepts[0] + + return first + ? types[mimes.indexOf(first)] + : false +} + +/** + * Return accepted encodings or best fit based on `encodings`. + * + * Given `Accept-Encoding: gzip, deflate` + * an array sorted by quality is returned: + * + * ['gzip', 'deflate'] + * + * @param {String|Array} encodings... + * @return {String|Array} + * @public + */ + +Accepts.prototype.encoding = +Accepts.prototype.encodings = function (encodings_) { + var encodings = encodings_ + + // support flattened arguments + if (encodings && !Array.isArray(encodings)) { + encodings = new Array(arguments.length) + for (var i = 0; i < encodings.length; i++) { + encodings[i] = arguments[i] + } + } + + // no encodings, return all requested encodings + if (!encodings || encodings.length === 0) { + return this.negotiator.encodings() + } + + return this.negotiator.encodings(encodings)[0] || false +} + +/** + * Return accepted charsets or best fit based on `charsets`. + * + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` + * an array sorted by quality is returned: + * + * ['utf-8', 'utf-7', 'iso-8859-1'] + * + * @param {String|Array} charsets... + * @return {String|Array} + * @public + */ + +Accepts.prototype.charset = +Accepts.prototype.charsets = function (charsets_) { + var charsets = charsets_ + + // support flattened arguments + if (charsets && !Array.isArray(charsets)) { + charsets = new Array(arguments.length) + for (var i = 0; i < charsets.length; i++) { + charsets[i] = arguments[i] + } + } + + // no charsets, return all requested charsets + if (!charsets || charsets.length === 0) { + return this.negotiator.charsets() + } + + return this.negotiator.charsets(charsets)[0] || false +} + +/** + * Return accepted languages or best fit based on `langs`. + * + * Given `Accept-Language: en;q=0.8, es, pt` + * an array sorted by quality is returned: + * + * ['es', 'pt', 'en'] + * + * @param {String|Array} langs... + * @return {Array|String} + * @public + */ + +Accepts.prototype.lang = +Accepts.prototype.langs = +Accepts.prototype.language = +Accepts.prototype.languages = function (languages_) { + var languages = languages_ + + // support flattened arguments + if (languages && !Array.isArray(languages)) { + languages = new Array(arguments.length) + for (var i = 0; i < languages.length; i++) { + languages[i] = arguments[i] + } + } + + // no languages, return all requested languages + if (!languages || languages.length === 0) { + return this.negotiator.languages() + } + + return this.negotiator.languages(languages)[0] || false +} + +/** + * Convert extnames to mime. + * + * @param {String} type + * @return {String} + * @private + */ + +function extToMime (type) { + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type +} + +/** + * Check if mime is valid. + * + * @param {String} type + * @return {String} + * @private + */ + +function validMime (type) { + return typeof type === 'string' +} diff --git a/graphql-subscription-express/node_modules/accepts/package.json b/graphql-subscription-express/node_modules/accepts/package.json new file mode 100644 index 0000000..0f2d15d --- /dev/null +++ b/graphql-subscription-express/node_modules/accepts/package.json @@ -0,0 +1,47 @@ +{ + "name": "accepts", + "description": "Higher-level content negotiation", + "version": "1.3.8", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "jshttp/accepts", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "4.3.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.0", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + }, + "keywords": [ + "content", + "negotiation", + "accept", + "accepts" + ] +} diff --git a/graphql-subscription-express/node_modules/array-flatten/LICENSE b/graphql-subscription-express/node_modules/array-flatten/LICENSE new file mode 100644 index 0000000..983fbe8 --- /dev/null +++ b/graphql-subscription-express/node_modules/array-flatten/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/array-flatten/README.md b/graphql-subscription-express/node_modules/array-flatten/README.md new file mode 100644 index 0000000..91fa5b6 --- /dev/null +++ b/graphql-subscription-express/node_modules/array-flatten/README.md @@ -0,0 +1,43 @@ +# Array Flatten + +[![NPM version][npm-image]][npm-url] +[![NPM downloads][downloads-image]][downloads-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] + +> Flatten an array of nested arrays into a single flat array. Accepts an optional depth. + +## Installation + +``` +npm install array-flatten --save +``` + +## Usage + +```javascript +var flatten = require('array-flatten') + +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9]) +//=> [1, 2, 3, 4, 5, 6, 7, 8, 9] + +flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2) +//=> [1, 2, 3, [4, [5], 6], 7, 8, 9] + +(function () { + flatten(arguments) //=> [1, 2, 3] +})(1, [2, 3]) +``` + +## License + +MIT + +[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat +[npm-url]: https://npmjs.org/package/array-flatten +[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat +[downloads-url]: https://npmjs.org/package/array-flatten +[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat +[travis-url]: https://travis-ci.org/blakeembrey/array-flatten +[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat +[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master diff --git a/graphql-subscription-express/node_modules/array-flatten/array-flatten.js b/graphql-subscription-express/node_modules/array-flatten/array-flatten.js new file mode 100644 index 0000000..089117b --- /dev/null +++ b/graphql-subscription-express/node_modules/array-flatten/array-flatten.js @@ -0,0 +1,64 @@ +'use strict' + +/** + * Expose `arrayFlatten`. + */ +module.exports = arrayFlatten + +/** + * Recursive flatten function with depth. + * + * @param {Array} array + * @param {Array} result + * @param {Number} depth + * @return {Array} + */ +function flattenWithDepth (array, result, depth) { + for (var i = 0; i < array.length; i++) { + var value = array[i] + + if (depth > 0 && Array.isArray(value)) { + flattenWithDepth(value, result, depth - 1) + } else { + result.push(value) + } + } + + return result +} + +/** + * Recursive flatten function. Omitting depth is slightly faster. + * + * @param {Array} array + * @param {Array} result + * @return {Array} + */ +function flattenForever (array, result) { + for (var i = 0; i < array.length; i++) { + var value = array[i] + + if (Array.isArray(value)) { + flattenForever(value, result) + } else { + result.push(value) + } + } + + return result +} + +/** + * Flatten an array, with the ability to define a depth. + * + * @param {Array} array + * @param {Number} depth + * @return {Array} + */ +function arrayFlatten (array, depth) { + if (depth == null) { + return flattenForever(array, []) + } + + return flattenWithDepth(array, [], depth) +} diff --git a/graphql-subscription-express/node_modules/array-flatten/package.json b/graphql-subscription-express/node_modules/array-flatten/package.json new file mode 100644 index 0000000..1a24e2a --- /dev/null +++ b/graphql-subscription-express/node_modules/array-flatten/package.json @@ -0,0 +1,39 @@ +{ + "name": "array-flatten", + "version": "1.1.1", + "description": "Flatten an array of nested arrays into a single flat array", + "main": "array-flatten.js", + "files": [ + "array-flatten.js", + "LICENSE" + ], + "scripts": { + "test": "istanbul cover _mocha -- -R spec" + }, + "repository": { + "type": "git", + "url": "git://github.com/blakeembrey/array-flatten.git" + }, + "keywords": [ + "array", + "flatten", + "arguments", + "depth" + ], + "author": { + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/blakeembrey/array-flatten/issues" + }, + "homepage": "https://github.com/blakeembrey/array-flatten", + "devDependencies": { + "istanbul": "^0.3.13", + "mocha": "^2.2.4", + "pre-commit": "^1.0.7", + "standard": "^3.7.3" + } +} diff --git a/graphql-subscription-express/node_modules/body-parser/HISTORY.md b/graphql-subscription-express/node_modules/body-parser/HISTORY.md new file mode 100644 index 0000000..b892491 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/HISTORY.md @@ -0,0 +1,665 @@ +1.20.2 / 2023-02-21 +=================== + + * Fix strict json error message on Node.js 19+ + * deps: content-type@~1.0.5 + - perf: skip value escaping when unnecessary + * deps: raw-body@2.5.2 + +1.20.1 / 2022-10-06 +=================== + + * deps: qs@6.11.0 + * perf: remove unnecessary object clone + +1.20.0 / 2022-04-02 +=================== + + * Fix error message for json parse whitespace in `strict` + * Fix internal error when inflated body exceeds limit + * Prevent loss of async hooks context + * Prevent hanging when request already read + * deps: depd@2.0.0 + - Replace internal `eval` usage with `Function` constructor + - Use instance methods on `process` to check for listeners + * deps: http-errors@2.0.0 + - deps: depd@2.0.0 + - deps: statuses@2.0.1 + * deps: on-finished@2.4.1 + * deps: qs@6.10.3 + * deps: raw-body@2.5.1 + - deps: http-errors@2.0.0 + +1.19.2 / 2022-02-15 +=================== + + * deps: bytes@3.1.2 + * deps: qs@6.9.7 + * Fix handling of `__proto__` keys + * deps: raw-body@2.4.3 + - deps: bytes@3.1.2 + +1.19.1 / 2021-12-10 +=================== + + * deps: bytes@3.1.1 + * deps: http-errors@1.8.1 + - deps: inherits@2.0.4 + - deps: toidentifier@1.0.1 + - deps: setprototypeof@1.2.0 + * deps: qs@6.9.6 + * deps: raw-body@2.4.2 + - deps: bytes@3.1.1 + - deps: http-errors@1.8.1 + * deps: safe-buffer@5.2.1 + * deps: type-is@~1.6.18 + +1.19.0 / 2019-04-25 +=================== + + * deps: bytes@3.1.0 + - Add petabyte (`pb`) support + * deps: http-errors@1.7.2 + - Set constructor name when possible + - deps: setprototypeof@1.1.1 + - deps: statuses@'>= 1.5.0 < 2' + * deps: iconv-lite@0.4.24 + - Added encoding MIK + * deps: qs@6.7.0 + - Fix parsing array brackets after index + * deps: raw-body@2.4.0 + - deps: bytes@3.1.0 + - deps: http-errors@1.7.2 + - deps: iconv-lite@0.4.24 + * deps: type-is@~1.6.17 + - deps: mime-types@~2.1.24 + - perf: prevent internal `throw` on invalid type + +1.18.3 / 2018-05-14 +=================== + + * Fix stack trace for strict json parse error + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: http-errors@~1.6.3 + - deps: depd@~1.1.2 + - deps: setprototypeof@1.1.0 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.23 + - Fix loading encoding with year appended + - Fix deprecation warnings on Node.js 10+ + * deps: qs@6.5.2 + * deps: raw-body@2.3.3 + - deps: http-errors@1.6.3 + - deps: iconv-lite@0.4.23 + * deps: type-is@~1.6.16 + - deps: mime-types@~2.1.18 + +1.18.2 / 2017-09-22 +=================== + + * deps: debug@2.6.9 + * perf: remove argument reassignment + +1.18.1 / 2017-09-12 +=================== + + * deps: content-type@~1.0.4 + - perf: remove argument reassignment + - perf: skip parameter parsing when no parameters + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1 regression + - Update Windows-1255 + * deps: qs@6.5.1 + - Fix parsing & compacting very deep objects + * deps: raw-body@2.3.2 + - deps: iconv-lite@0.4.19 + +1.18.0 / 2017-09-08 +=================== + + * Fix JSON strict violation error to match native parse error + * Include the `body` property on verify errors + * Include the `type` property on all generated errors + * Use `http-errors` to set status code on errors + * deps: bytes@3.0.0 + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: http-errors@~1.6.2 + - deps: depd@1.1.1 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + * deps: qs@6.5.0 + * deps: raw-body@2.3.1 + - Use `http-errors` for standard emitted errors + - deps: bytes@3.0.0 + - deps: iconv-lite@0.4.18 + - perf: skip buffer decoding on overage chunk + * perf: prevent internal `throw` when missing charset + +1.17.2 / 2017-05-17 +=================== + + * deps: debug@2.6.7 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@2.0.0 + * deps: type-is@~1.6.15 + - deps: mime-types@~2.1.15 + +1.17.1 / 2017-03-06 +=================== + + * deps: qs@6.4.0 + - Fix regression parsing keys starting with `[` + +1.17.0 / 2017-03-01 +=================== + + * deps: http-errors@~1.6.1 + - Make `message` property enumerable for `HttpError`s + - deps: setprototypeof@1.0.3 + * deps: qs@6.3.1 + - Fix compacting nested arrays + +1.16.1 / 2017-02-10 +=================== + + * deps: debug@2.6.1 + - Fix deprecation messages in WebStorm and other editors + - Undeprecate `DEBUG_FD` set to `1` or `2` + +1.16.0 / 2017-01-17 +=================== + + * deps: debug@2.6.0 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: http-errors@~1.5.1 + - deps: inherits@2.0.3 + - deps: setprototypeof@1.0.2 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + * deps: qs@6.2.1 + - Fix array parsing from skipping empty values + * deps: raw-body@~2.2.0 + - deps: iconv-lite@0.4.15 + * deps: type-is@~1.6.14 + - deps: mime-types@~2.1.13 + +1.15.2 / 2016-06-19 +=================== + + * deps: bytes@2.4.0 + * deps: content-type@~1.0.2 + - perf: enable strict mode + * deps: http-errors@~1.5.0 + - Use `setprototypeof` module to replace `__proto__` setting + - deps: statuses@'>= 1.3.0 < 2' + - perf: enable strict mode + * deps: qs@6.2.0 + * deps: raw-body@~2.1.7 + - deps: bytes@2.4.0 + - perf: remove double-cleanup on happy path + * deps: type-is@~1.6.13 + - deps: mime-types@~2.1.11 + +1.15.1 / 2016-05-05 +=================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + * deps: raw-body@~2.1.6 + - deps: bytes@2.3.0 + * deps: type-is@~1.6.12 + - deps: mime-types@~2.1.10 + +1.15.0 / 2016-02-10 +=================== + + * deps: http-errors@~1.4.0 + - Add `HttpError` export, for `err instanceof createError.HttpError` + - deps: inherits@2.0.1 + - deps: statuses@'>= 1.2.1 < 2' + * deps: qs@6.1.0 + * deps: type-is@~1.6.11 + - deps: mime-types@~2.1.9 + +1.14.2 / 2015-12-16 +=================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + * deps: qs@5.2.0 + * deps: raw-body@~2.1.5 + - deps: bytes@2.2.0 + - deps: iconv-lite@0.4.13 + * deps: type-is@~1.6.10 + - deps: mime-types@~2.1.8 + +1.14.1 / 2015-09-27 +=================== + + * Fix issue where invalid charset results in 400 when `verify` used + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + * deps: raw-body@~2.1.4 + - Fix masking critical errors from `iconv-lite` + - deps: iconv-lite@0.4.12 + * deps: type-is@~1.6.9 + - deps: mime-types@~2.1.7 + +1.14.0 / 2015-09-16 +=================== + + * Fix JSON strict parse error to match syntax errors + * Provide static `require` analysis in `urlencoded` parser + * deps: depd@~1.1.0 + - Support web browser loading + * deps: qs@5.1.0 + * deps: raw-body@~2.1.3 + - Fix sync callback when attaching data listener causes sync read + * deps: type-is@~1.6.8 + - Fix type error when given invalid type to match against + - deps: mime-types@~2.1.6 + +1.13.3 / 2015-07-31 +=================== + + * deps: type-is@~1.6.6 + - deps: mime-types@~2.1.4 + +1.13.2 / 2015-07-05 +=================== + + * deps: iconv-lite@0.4.11 + * deps: qs@4.0.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix user-visible incompatibilities from 3.1.0 + - Fix various parsing edge cases + * deps: raw-body@~2.1.2 + - Fix error stack traces to skip `makeError` + - deps: iconv-lite@0.4.11 + * deps: type-is@~1.6.4 + - deps: mime-types@~2.1.2 + - perf: enable strict mode + - perf: remove argument reassignment + +1.13.1 / 2015-06-16 +=================== + + * deps: qs@2.4.2 + - Downgraded from 3.1.0 because of user-visible incompatibilities + +1.13.0 / 2015-06-14 +=================== + + * Add `statusCode` property on `Error`s, in addition to `status` + * Change `type` default to `application/json` for JSON parser + * Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser + * Provide static `require` analysis + * Use the `http-errors` module to generate errors + * deps: bytes@2.1.0 + - Slight optimizations + * deps: iconv-lite@0.4.10 + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + - Leading BOM is now removed when decoding + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * deps: qs@3.1.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix various parsing edge cases + - Parsed object now has `null` prototype + * deps: raw-body@~2.1.1 + - Use `unpipe` module for unpiping requests + - deps: iconv-lite@0.4.10 + * deps: type-is@~1.6.3 + - deps: mime-types@~2.1.1 + - perf: reduce try block size + - perf: remove bitwise operations + * perf: enable strict mode + * perf: remove argument reassignment + * perf: remove delete call + +1.12.4 / 2015-05-10 +=================== + + * deps: debug@~2.2.0 + * deps: qs@2.4.2 + - Fix allowing parameters like `constructor` + * deps: on-finished@~2.2.1 + * deps: raw-body@~2.0.1 + - Fix a false-positive when unpiping in Node.js 0.8 + - deps: bytes@2.0.1 + * deps: type-is@~1.6.2 + - deps: mime-types@~2.0.11 + +1.12.3 / 2015-04-15 +=================== + + * Slight efficiency improvement when not debugging + * deps: depd@~1.0.1 + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + * deps: raw-body@1.3.4 + - Fix hanging callback if request aborts during read + - deps: iconv-lite@0.4.8 + +1.12.2 / 2015-03-16 +=================== + + * deps: qs@2.4.1 + - Fix error when parameter `hasOwnProperty` is present + +1.12.1 / 2015-03-15 +=================== + + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: type-is@~1.6.1 + - deps: mime-types@~2.0.10 + +1.12.0 / 2015-02-13 +=================== + + * add `debug` messages + * accept a function for the `type` option + * use `content-type` to parse `Content-Type` headers + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + * deps: raw-body@1.3.3 + - deps: iconv-lite@0.4.7 + * deps: type-is@~1.6.0 + - fix argument reassignment + - fix false-positives in `hasBody` `Transfer-Encoding` check + - support wildcard for both type and subtype (`*/*`) + - deps: mime-types@~2.0.9 + +1.11.0 / 2015-01-30 +=================== + + * make internal `extended: true` depth limit infinity + * deps: type-is@~1.5.6 + - deps: mime-types@~2.0.8 + +1.10.2 / 2015-01-20 +=================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + * deps: raw-body@1.3.2 + - deps: iconv-lite@0.4.6 + +1.10.1 / 2015-01-01 +=================== + + * deps: on-finished@~2.2.0 + * deps: type-is@~1.5.5 + - deps: mime-types@~2.0.7 + +1.10.0 / 2014-12-02 +=================== + + * make internal `extended: true` array limit dynamic + +1.9.3 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + * deps: qs@2.3.3 + - Fix `arrayLimit` behavior + * deps: raw-body@1.3.1 + - deps: iconv-lite@0.4.5 + * deps: type-is@~1.5.3 + - deps: mime-types@~2.0.3 + +1.9.2 / 2014-10-27 +================== + + * deps: qs@2.3.2 + - Fix parsing of mixed objects and values + +1.9.1 / 2014-10-22 +================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + * deps: qs@2.3.0 + - Fix parsing of mixed implicit and explicit arrays + * deps: type-is@~1.5.2 + - deps: mime-types@~2.0.2 + +1.9.0 / 2014-09-24 +================== + + * include the charset in "unsupported charset" error message + * include the encoding in "unsupported content encoding" error message + * deps: depd@~1.0.0 + +1.8.4 / 2014-09-23 +================== + + * fix content encoding to be case-insensitive + +1.8.3 / 2014-09-19 +================== + + * deps: qs@2.2.4 + - Fix issue with object keys starting with numbers truncated + +1.8.2 / 2014-09-15 +================== + + * deps: depd@0.4.5 + +1.8.1 / 2014-09-07 +================== + + * deps: media-typer@0.3.0 + * deps: type-is@~1.5.1 + +1.8.0 / 2014-09-05 +================== + + * make empty-body-handling consistent between chunked requests + - empty `json` produces `{}` + - empty `raw` produces `new Buffer(0)` + - empty `text` produces `''` + - empty `urlencoded` produces `{}` + * deps: qs@2.2.3 + - Fix issue where first empty value in array is discarded + * deps: type-is@~1.5.0 + - fix `hasbody` to be true for `content-length: 0` + +1.7.0 / 2014-09-01 +================== + + * add `parameterLimit` option to `urlencoded` parser + * change `urlencoded` extended array limit to 100 + * respond with 413 when over `parameterLimit` in `urlencoded` + +1.6.7 / 2014-08-29 +================== + + * deps: qs@2.2.2 + - Remove unnecessary cloning + +1.6.6 / 2014-08-27 +================== + + * deps: qs@2.2.0 + - Array parsing fix + - Performance improvements + +1.6.5 / 2014-08-16 +================== + + * deps: on-finished@2.1.0 + +1.6.4 / 2014-08-14 +================== + + * deps: qs@1.2.2 + +1.6.3 / 2014-08-10 +================== + + * deps: qs@1.2.1 + +1.6.2 / 2014-08-07 +================== + + * deps: qs@1.2.0 + - Fix parsing array of objects + +1.6.1 / 2014-08-06 +================== + + * deps: qs@1.1.0 + - Accept urlencoded square brackets + - Accept empty values in implicit array notation + +1.6.0 / 2014-08-05 +================== + + * deps: qs@1.0.2 + - Complete rewrite + - Limits array length to 20 + - Limits object depth to 5 + - Limits parameters to 1,000 + +1.5.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +1.5.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +1.5.0 / 2014-07-20 +================== + + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + * deps: raw-body@1.3.0 + - deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + - Fix `Cannot switch to old mode now` error on Node.js 0.10+ + * deps: type-is@~1.3.2 + +1.4.3 / 2014-06-19 +================== + + * deps: type-is@1.3.1 + - fix global variable leak + +1.4.2 / 2014-06-19 +================== + + * deps: type-is@1.3.0 + - improve type parsing + +1.4.1 / 2014-06-19 +================== + + * fix urlencoded extended deprecation message + +1.4.0 / 2014-06-19 +================== + + * add `text` parser + * add `raw` parser + * check accepted charset in content-type (accepts utf-8) + * check accepted encoding in content-encoding (accepts identity) + * deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed + * deprecate `urlencoded()` without provided `extended` option + * lazy-load urlencoded parsers + * parsers split into files for reduced mem usage + * support gzip and deflate bodies + - set `inflate: false` to turn off + * deps: raw-body@1.2.2 + - Support all encodings from `iconv-lite` + +1.3.1 / 2014-06-11 +================== + + * deps: type-is@1.2.1 + - Switch dependency from mime to mime-types@1.0.0 + +1.3.0 / 2014-05-31 +================== + + * add `extended` option to urlencoded parser + +1.2.2 / 2014-05-27 +================== + + * deps: raw-body@1.1.6 + - assert stream encoding on node.js 0.8 + - assert stream encoding on node.js < 0.10.6 + - deps: bytes@1 + +1.2.1 / 2014-05-26 +================== + + * invoke `next(err)` after request fully read + - prevents hung responses and socket hang ups + +1.2.0 / 2014-05-11 +================== + + * add `verify` option + * deps: type-is@1.2.0 + - support suffix matching + +1.1.2 / 2014-05-11 +================== + + * improve json parser speed + +1.1.1 / 2014-05-11 +================== + + * fix repeated limit parsing with every request + +1.1.0 / 2014-05-10 +================== + + * add `type` option + * deps: pin for safety and consistency + +1.0.2 / 2014-04-14 +================== + + * use `type-is` module + +1.0.1 / 2014-03-20 +================== + + * lower default limits to 100kb diff --git a/graphql-subscription-express/node_modules/body-parser/LICENSE b/graphql-subscription-express/node_modules/body-parser/LICENSE new file mode 100644 index 0000000..386b7b6 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/body-parser/README.md b/graphql-subscription-express/node_modules/body-parser/README.md new file mode 100644 index 0000000..38553bf --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/README.md @@ -0,0 +1,465 @@ +# body-parser + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Node.js body parsing middleware. + +Parse incoming request bodies in a middleware before your handlers, available +under the `req.body` property. + +**Note** As `req.body`'s shape is based on user-controlled input, all +properties and values in this object are untrusted and should be validated +before trusting. For example, `req.body.foo.toString()` may fail in multiple +ways, for example the `foo` property may not be there or may not be a string, +and `toString` may not be a function and instead a string or other user input. + +[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/). + +_This does not handle multipart bodies_, due to their complex and typically +large nature. For multipart bodies, you may be interested in the following +modules: + + * [busboy](https://www.npmjs.org/package/busboy#readme) and + [connect-busboy](https://www.npmjs.org/package/connect-busboy#readme) + * [multiparty](https://www.npmjs.org/package/multiparty#readme) and + [connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme) + * [formidable](https://www.npmjs.org/package/formidable#readme) + * [multer](https://www.npmjs.org/package/multer#readme) + +This module provides the following parsers: + + * [JSON body parser](#bodyparserjsonoptions) + * [Raw body parser](#bodyparserrawoptions) + * [Text body parser](#bodyparsertextoptions) + * [URL-encoded form body parser](#bodyparserurlencodedoptions) + +Other body parsers you might be interested in: + +- [body](https://www.npmjs.org/package/body#readme) +- [co-body](https://www.npmjs.org/package/co-body#readme) + +## Installation + +```sh +$ npm install body-parser +``` + +## API + +```js +var bodyParser = require('body-parser') +``` + +The `bodyParser` object exposes various factories to create middlewares. All +middlewares will populate the `req.body` property with the parsed body when +the `Content-Type` request header matches the `type` option, or an empty +object (`{}`) if there was no body to parse, the `Content-Type` was not matched, +or an error occurred. + +The various errors returned by this module are described in the +[errors section](#errors). + +### bodyParser.json([options]) + +Returns middleware that only parses `json` and only looks at requests where +the `Content-Type` header matches the `type` option. This parser accepts any +Unicode encoding of the body and supports automatic inflation of `gzip` and +`deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). + +#### Options + +The `json` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### reviver + +The `reviver` option is passed directly to `JSON.parse` as the second +argument. You can find more information on this argument +[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter). + +##### strict + +When set to `true`, will only accept arrays and objects; when `false` will +accept anything `JSON.parse` accepts. Defaults to `true`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not a +function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `json`), a mime type (like `application/json`), or +a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a truthy +value. Defaults to `application/json`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.raw([options]) + +Returns middleware that parses all bodies as a `Buffer` and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a `Buffer` object +of the body. + +#### Options + +The `raw` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. +If not a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this +can be an extension name (like `bin`), a mime type (like +`application/octet-stream`), or a mime type with a wildcard (like `*/*` or +`application/*`). If a function, the `type` option is called as `fn(req)` +and the request is parsed if it returns a truthy value. Defaults to +`application/octet-stream`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.text([options]) + +Returns middleware that parses all bodies as a string and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip` and `deflate` encodings. + +A new `body` string containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a string of the +body. + +#### Options + +The `text` function takes an optional `options` object that may contain any of +the following keys: + +##### defaultCharset + +Specify the default character set for the text content if the charset is not +specified in the `Content-Type` header of the request. Defaults to `utf-8`. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `txt`), a mime type (like `text/plain`), or a mime +type with a wildcard (like `*/*` or `text/*`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a +truthy value. Defaults to `text/plain`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.urlencoded([options]) + +Returns middleware that only parses `urlencoded` bodies and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser accepts only UTF-8 encoding of the body and supports automatic +inflation of `gzip` and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This object will contain +key-value pairs, where the value can be a string or array (when `extended` is +`false`), or any type (when `extended` is `true`). + +#### Options + +The `urlencoded` function takes an optional `options` object that may contain +any of the following keys: + +##### extended + +The `extended` option allows to choose between parsing the URL-encoded data +with the `querystring` library (when `false`) or the `qs` library (when +`true`). The "extended" syntax allows for rich objects and arrays to be +encoded into the URL-encoded format, allowing for a JSON-like experience +with URL-encoded. For more information, please +[see the qs library](https://www.npmjs.org/package/qs#readme). + +Defaults to `true`, but using the default has been deprecated. Please +research into the difference between `qs` and `querystring` and choose the +appropriate setting. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### parameterLimit + +The `parameterLimit` option controls the maximum number of parameters that +are allowed in the URL-encoded data. If a request contains more parameters +than this value, a 413 will be returned to the client. Defaults to `1000`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `urlencoded`), a mime type (like +`application/x-www-form-urlencoded`), or a mime type with a wildcard (like +`*/x-www-form-urlencoded`). If a function, the `type` option is called as +`fn(req)` and the request is parsed if it returns a truthy value. Defaults +to `application/x-www-form-urlencoded`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +## Errors + +The middlewares provided by this module create errors using the +[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors +will typically have a `status`/`statusCode` property that contains the suggested +HTTP response code, an `expose` property to determine if the `message` property +should be displayed to the client, a `type` property to determine the type of +error without matching against the `message`, and a `body` property containing +the read body, if available. + +The following are the common errors created, though any error can come through +for various reasons. + +### content encoding unsupported + +This error will occur when the request had a `Content-Encoding` header that +contained an encoding but the "inflation" option was set to `false`. The +`status` property is set to `415`, the `type` property is set to +`'encoding.unsupported'`, and the `charset` property will be set to the +encoding that is unsupported. + +### entity parse failed + +This error will occur when the request contained an entity that could not be +parsed by the middleware. The `status` property is set to `400`, the `type` +property is set to `'entity.parse.failed'`, and the `body` property is set to +the entity value that failed parsing. + +### entity verify failed + +This error will occur when the request contained an entity that could not be +failed verification by the defined `verify` option. The `status` property is +set to `403`, the `type` property is set to `'entity.verify.failed'`, and the +`body` property is set to the entity value that failed verification. + +### request aborted + +This error will occur when the request is aborted by the client before reading +the body has finished. The `received` property will be set to the number of +bytes received before the request was aborted and the `expected` property is +set to the number of expected bytes. The `status` property is set to `400` +and `type` property is set to `'request.aborted'`. + +### request entity too large + +This error will occur when the request body's size is larger than the "limit" +option. The `limit` property will be set to the byte limit and the `length` +property will be set to the request body's length. The `status` property is +set to `413` and the `type` property is set to `'entity.too.large'`. + +### request size did not match content length + +This error will occur when the request's length did not match the length from +the `Content-Length` header. This typically occurs when the request is malformed, +typically when the `Content-Length` header was calculated based on characters +instead of bytes. The `status` property is set to `400` and the `type` property +is set to `'request.size.invalid'`. + +### stream encoding should not be set + +This error will occur when something called the `req.setEncoding` method prior +to this middleware. This module operates directly on bytes only and you cannot +call `req.setEncoding` when using this module. The `status` property is set to +`500` and the `type` property is set to `'stream.encoding.set'`. + +### stream is not readable + +This error will occur when the request is no longer readable when this middleware +attempts to read it. This typically means something other than a middleware from +this module read the request body already and the middleware was also configured to +read the same request. The `status` property is set to `500` and the `type` +property is set to `'stream.not.readable'`. + +### too many parameters + +This error will occur when the content of the request exceeds the configured +`parameterLimit` for the `urlencoded` parser. The `status` property is set to +`413` and the `type` property is set to `'parameters.too.many'`. + +### unsupported charset "BOGUS" + +This error will occur when the request had a charset parameter in the +`Content-Type` header, but the `iconv-lite` module does not support it OR the +parser does not support it. The charset is contained in the message as well +as in the `charset` property. The `status` property is set to `415`, the +`type` property is set to `'charset.unsupported'`, and the `charset` property +is set to the charset that is unsupported. + +### unsupported content encoding "bogus" + +This error will occur when the request had a `Content-Encoding` header that +contained an unsupported encoding. The encoding is contained in the message +as well as in the `encoding` property. The `status` property is set to `415`, +the `type` property is set to `'encoding.unsupported'`, and the `encoding` +property is set to the encoding that is unsupported. + +## Examples + +### Express/Connect top-level generic + +This example demonstrates adding a generic JSON and URL-encoded parser as a +top-level middleware, which will parse the bodies of all incoming requests. +This is the simplest setup. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse application/x-www-form-urlencoded +app.use(bodyParser.urlencoded({ extended: false })) + +// parse application/json +app.use(bodyParser.json()) + +app.use(function (req, res) { + res.setHeader('Content-Type', 'text/plain') + res.write('you posted:\n') + res.end(JSON.stringify(req.body, null, 2)) +}) +``` + +### Express route-specific + +This example demonstrates adding body parsers specifically to the routes that +need them. In general, this is the most recommended way to use body-parser with +Express. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// create application/json parser +var jsonParser = bodyParser.json() + +// create application/x-www-form-urlencoded parser +var urlencodedParser = bodyParser.urlencoded({ extended: false }) + +// POST /login gets urlencoded bodies +app.post('/login', urlencodedParser, function (req, res) { + res.send('welcome, ' + req.body.username) +}) + +// POST /api/users gets JSON bodies +app.post('/api/users', jsonParser, function (req, res) { + // create user in req.body +}) +``` + +### Change accepted type for parsers + +All the parsers accept a `type` option which allows you to change the +`Content-Type` that the middleware will parse. + +```js +var express = require('express') +var bodyParser = require('body-parser') + +var app = express() + +// parse various different custom JSON types as JSON +app.use(bodyParser.json({ type: 'application/*+json' })) + +// parse some custom thing into a Buffer +app.use(bodyParser.raw({ type: 'application/vnd.custom-type' })) + +// parse an HTML body into a string +app.use(bodyParser.text({ type: 'text/html' })) +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci +[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master +[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master +[node-version-image]: https://badgen.net/npm/node/body-parser +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/body-parser +[npm-url]: https://npmjs.org/package/body-parser +[npm-version-image]: https://badgen.net/npm/v/body-parser diff --git a/graphql-subscription-express/node_modules/body-parser/SECURITY.md b/graphql-subscription-express/node_modules/body-parser/SECURITY.md new file mode 100644 index 0000000..9694d42 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policies and Procedures + +## Reporting a Bug + +The Express team and community take all security bugs seriously. Thank you +for improving the security of Express. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your +contributions. + +Report security bugs by emailing the current owner(s) of `body-parser`. This +information can be found in the npm registry using the command +`npm owner ls body-parser`. +If unsure or unable to get the information from the above, open an issue +in the [project issue tracker](https://github.com/expressjs/body-parser/issues) +asking for the current contact information. + +To ensure the timely response to your report, please ensure that the entirety +of the report is contained within the email body and not solely behind a web +link or an attachment. + +At least one owner will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the owners will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. diff --git a/graphql-subscription-express/node_modules/body-parser/index.js b/graphql-subscription-express/node_modules/body-parser/index.js new file mode 100644 index 0000000..bb24d73 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/index.js @@ -0,0 +1,156 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var deprecate = require('depd')('body-parser') + +/** + * Cache of loaded parsers. + * @private + */ + +var parsers = Object.create(null) + +/** + * @typedef Parsers + * @type {function} + * @property {function} json + * @property {function} raw + * @property {function} text + * @property {function} urlencoded + */ + +/** + * Module exports. + * @type {Parsers} + */ + +exports = module.exports = deprecate.function(bodyParser, + 'bodyParser: use individual json/urlencoded middlewares') + +/** + * JSON parser. + * @public + */ + +Object.defineProperty(exports, 'json', { + configurable: true, + enumerable: true, + get: createParserGetter('json') +}) + +/** + * Raw parser. + * @public + */ + +Object.defineProperty(exports, 'raw', { + configurable: true, + enumerable: true, + get: createParserGetter('raw') +}) + +/** + * Text parser. + * @public + */ + +Object.defineProperty(exports, 'text', { + configurable: true, + enumerable: true, + get: createParserGetter('text') +}) + +/** + * URL-encoded parser. + * @public + */ + +Object.defineProperty(exports, 'urlencoded', { + configurable: true, + enumerable: true, + get: createParserGetter('urlencoded') +}) + +/** + * Create a middleware to parse json and urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @deprecated + * @public + */ + +function bodyParser (options) { + // use default type for parsers + var opts = Object.create(options || null, { + type: { + configurable: true, + enumerable: true, + value: undefined, + writable: true + } + }) + + var _urlencoded = exports.urlencoded(opts) + var _json = exports.json(opts) + + return function bodyParser (req, res, next) { + _json(req, res, function (err) { + if (err) return next(err) + _urlencoded(req, res, next) + }) + } +} + +/** + * Create a getter for loading a parser. + * @private + */ + +function createParserGetter (name) { + return function get () { + return loadParser(name) + } +} + +/** + * Load a parser module. + * @private + */ + +function loadParser (parserName) { + var parser = parsers[parserName] + + if (parser !== undefined) { + return parser + } + + // this uses a switch for static require analysis + switch (parserName) { + case 'json': + parser = require('./lib/types/json') + break + case 'raw': + parser = require('./lib/types/raw') + break + case 'text': + parser = require('./lib/types/text') + break + case 'urlencoded': + parser = require('./lib/types/urlencoded') + break + } + + // store to prevent invoking require() + return (parsers[parserName] = parser) +} diff --git a/graphql-subscription-express/node_modules/body-parser/lib/read.js b/graphql-subscription-express/node_modules/body-parser/lib/read.js new file mode 100644 index 0000000..fce6283 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/lib/read.js @@ -0,0 +1,205 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var createError = require('http-errors') +var destroy = require('destroy') +var getBody = require('raw-body') +var iconv = require('iconv-lite') +var onFinished = require('on-finished') +var unpipe = require('unpipe') +var zlib = require('zlib') + +/** + * Module exports. + */ + +module.exports = read + +/** + * Read a request into a buffer and parse. + * + * @param {object} req + * @param {object} res + * @param {function} next + * @param {function} parse + * @param {function} debug + * @param {object} options + * @private + */ + +function read (req, res, next, parse, debug, options) { + var length + var opts = options + var stream + + // flag as parsed + req._body = true + + // read options + var encoding = opts.encoding !== null + ? opts.encoding + : null + var verify = opts.verify + + try { + // get the content stream + stream = contentstream(req, debug, opts.inflate) + length = stream.length + stream.length = undefined + } catch (err) { + return next(err) + } + + // set raw-body options + opts.length = length + opts.encoding = verify + ? null + : encoding + + // assert charset is supported + if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) { + return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase(), + type: 'charset.unsupported' + })) + } + + // read body + debug('read body') + getBody(stream, opts, function (error, body) { + if (error) { + var _error + + if (error.type === 'encoding.unsupported') { + // echo back charset + _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase(), + type: 'charset.unsupported' + }) + } else { + // set status code on error + _error = createError(400, error) + } + + // unpipe from stream and destroy + if (stream !== req) { + unpipe(req) + destroy(stream, true) + } + + // read off entire request + dump(req, function onfinished () { + next(createError(400, _error)) + }) + return + } + + // verify + if (verify) { + try { + debug('verify body') + verify(req, res, body, encoding) + } catch (err) { + next(createError(403, err, { + body: body, + type: err.type || 'entity.verify.failed' + })) + return + } + } + + // parse + var str = body + try { + debug('parse body') + str = typeof body !== 'string' && encoding !== null + ? iconv.decode(body, encoding) + : body + req.body = parse(str) + } catch (err) { + next(createError(400, err, { + body: str, + type: err.type || 'entity.parse.failed' + })) + return + } + + next() + }) +} + +/** + * Get the content stream of the request. + * + * @param {object} req + * @param {function} debug + * @param {boolean} [inflate=true] + * @return {object} + * @api private + */ + +function contentstream (req, debug, inflate) { + var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase() + var length = req.headers['content-length'] + var stream + + debug('content-encoding "%s"', encoding) + + if (inflate === false && encoding !== 'identity') { + throw createError(415, 'content encoding unsupported', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } + + switch (encoding) { + case 'deflate': + stream = zlib.createInflate() + debug('inflate body') + req.pipe(stream) + break + case 'gzip': + stream = zlib.createGunzip() + debug('gunzip body') + req.pipe(stream) + break + case 'identity': + stream = req + stream.length = length + break + default: + throw createError(415, 'unsupported content encoding "' + encoding + '"', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } + + return stream +} + +/** + * Dump the contents of a request. + * + * @param {object} req + * @param {function} callback + * @api private + */ + +function dump (req, callback) { + if (onFinished.isFinished(req)) { + callback(null) + } else { + onFinished(req, callback) + req.resume() + } +} diff --git a/graphql-subscription-express/node_modules/body-parser/lib/types/json.js b/graphql-subscription-express/node_modules/body-parser/lib/types/json.js new file mode 100644 index 0000000..59f3f7e --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/lib/types/json.js @@ -0,0 +1,247 @@ +/*! + * body-parser + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var createError = require('http-errors') +var debug = require('debug')('body-parser:json') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = json + +/** + * RegExp to match the first non-space in a string. + * + * Allowed whitespace is defined in RFC 7159: + * + * ws = *( + * %x20 / ; Space + * %x09 / ; Horizontal tab + * %x0A / ; Line feed or New line + * %x0D ) ; Carriage return + */ + +var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex + +var JSON_SYNTAX_CHAR = '#' +var JSON_SYNTAX_REGEXP = /#+/g + +/** + * Create a middleware to parse JSON bodies. + * + * @param {object} [options] + * @return {function} + * @public + */ + +function json (options) { + var opts = options || {} + + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var inflate = opts.inflate !== false + var reviver = opts.reviver + var strict = opts.strict !== false + var type = opts.type || 'application/json' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { + if (body.length === 0) { + // special-case empty json body, as it's a common client-side mistake + // TODO: maybe make this configurable or part of "strict" option + return {} + } + + if (strict) { + var first = firstchar(body) + + if (first !== '{' && first !== '[') { + debug('strict violation') + throw createStrictSyntaxError(body, first) + } + } + + try { + debug('parse json') + return JSON.parse(body, reviver) + } catch (e) { + throw normalizeJsonSyntaxError(e, { + message: e.message, + stack: e.stack + }) + } + } + + return function jsonParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // assert charset per RFC 7159 sec 8.1 + var charset = getCharset(req) || 'utf-8' + if (charset.slice(0, 4) !== 'utf-') { + debug('invalid charset') + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { + charset: charset, + type: 'charset.unsupported' + })) + return + } + + // read + read(req, res, next, parse, debug, { + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Create strict violation syntax error matching native error. + * + * @param {string} str + * @param {string} char + * @return {Error} + * @private + */ + +function createStrictSyntaxError (str, char) { + var index = str.indexOf(char) + var partial = '' + + if (index !== -1) { + partial = str.substring(0, index) + JSON_SYNTAX_CHAR + + for (var i = index + 1; i < str.length; i++) { + partial += JSON_SYNTAX_CHAR + } + } + + try { + JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation') + } catch (e) { + return normalizeJsonSyntaxError(e, { + message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) { + return str.substring(index, index + placeholder.length) + }), + stack: e.stack + }) + } +} + +/** + * Get the first non-whitespace character in a string. + * + * @param {string} str + * @return {function} + * @private + */ + +function firstchar (str) { + var match = FIRST_CHAR_REGEXP.exec(str) + + return match + ? match[1] + : undefined +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Normalize a SyntaxError for JSON.parse. + * + * @param {SyntaxError} error + * @param {object} obj + * @return {SyntaxError} + */ + +function normalizeJsonSyntaxError (error, obj) { + var keys = Object.getOwnPropertyNames(error) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + if (key !== 'stack' && key !== 'message') { + delete error[key] + } + } + + // replace stack before message for Node.js 0.10 and below + error.stack = obj.stack.replace(error.message, obj.message) + error.message = obj.message + + return error +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/graphql-subscription-express/node_modules/body-parser/lib/types/raw.js b/graphql-subscription-express/node_modules/body-parser/lib/types/raw.js new file mode 100644 index 0000000..f5d1b67 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/lib/types/raw.js @@ -0,0 +1,101 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + */ + +var bytes = require('bytes') +var debug = require('debug')('body-parser:raw') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = raw + +/** + * Create a middleware to parse raw bodies. + * + * @param {object} [options] + * @return {function} + * @api public + */ + +function raw (options) { + var opts = options || {} + + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/octet-stream' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (buf) { + return buf + } + + return function rawParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // read + read(req, res, next, parse, debug, { + encoding: null, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/graphql-subscription-express/node_modules/body-parser/lib/types/text.js b/graphql-subscription-express/node_modules/body-parser/lib/types/text.js new file mode 100644 index 0000000..083a009 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/lib/types/text.js @@ -0,0 +1,121 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var debug = require('debug')('body-parser:text') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = text + +/** + * Create a middleware to parse text bodies. + * + * @param {object} [options] + * @return {function} + * @api public + */ + +function text (options) { + var opts = options || {} + + var defaultCharset = opts.defaultCharset || 'utf-8' + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'text/plain' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (buf) { + return buf + } + + return function textParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // get charset + var charset = getCharset(req) || defaultCharset + + // read + read(req, res, next, parse, debug, { + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/graphql-subscription-express/node_modules/body-parser/lib/types/urlencoded.js b/graphql-subscription-express/node_modules/body-parser/lib/types/urlencoded.js new file mode 100644 index 0000000..b2ca8f1 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/lib/types/urlencoded.js @@ -0,0 +1,284 @@ +/*! + * body-parser + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var createError = require('http-errors') +var debug = require('debug')('body-parser:urlencoded') +var deprecate = require('depd')('body-parser') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = urlencoded + +/** + * Cache of parser modules. + */ + +var parsers = Object.create(null) + +/** + * Create a middleware to parse urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @public + */ + +function urlencoded (options) { + var opts = options || {} + + // notice because option default will flip in next major + if (opts.extended === undefined) { + deprecate('undefined extended: provide extended option') + } + + var extended = opts.extended !== false + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/x-www-form-urlencoded' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate query parser + var queryparse = extended + ? extendedparser(opts) + : simpleparser(opts) + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { + return body.length + ? queryparse(body) + : {} + } + + return function urlencodedParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // assert charset + var charset = getCharset(req) || 'utf-8' + if (charset !== 'utf-8') { + debug('invalid charset') + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { + charset: charset, + type: 'charset.unsupported' + })) + return + } + + // read + read(req, res, next, parse, debug, { + debug: debug, + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the extended query parser. + * + * @param {object} options + */ + +function extendedparser (options) { + var parameterLimit = options.parameterLimit !== undefined + ? options.parameterLimit + : 1000 + var parse = parser('qs') + + if (isNaN(parameterLimit) || parameterLimit < 1) { + throw new TypeError('option parameterLimit must be a positive number') + } + + if (isFinite(parameterLimit)) { + parameterLimit = parameterLimit | 0 + } + + return function queryparse (body) { + var paramCount = parameterCount(body, parameterLimit) + + if (paramCount === undefined) { + debug('too many parameters') + throw createError(413, 'too many parameters', { + type: 'parameters.too.many' + }) + } + + var arrayLimit = Math.max(100, paramCount) + + debug('parse extended urlencoding') + return parse(body, { + allowPrototypes: true, + arrayLimit: arrayLimit, + depth: Infinity, + parameterLimit: parameterLimit + }) + } +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return (contentType.parse(req).parameters.charset || '').toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Count the number of parameters, stopping once limit reached + * + * @param {string} body + * @param {number} limit + * @api private + */ + +function parameterCount (body, limit) { + var count = 0 + var index = 0 + + while ((index = body.indexOf('&', index)) !== -1) { + count++ + index++ + + if (count === limit) { + return undefined + } + } + + return count +} + +/** + * Get parser for module name dynamically. + * + * @param {string} name + * @return {function} + * @api private + */ + +function parser (name) { + var mod = parsers[name] + + if (mod !== undefined) { + return mod.parse + } + + // this uses a switch for static require analysis + switch (name) { + case 'qs': + mod = require('qs') + break + case 'querystring': + mod = require('querystring') + break + } + + // store to prevent invoking require() + parsers[name] = mod + + return mod.parse +} + +/** + * Get the simple query parser. + * + * @param {object} options + */ + +function simpleparser (options) { + var parameterLimit = options.parameterLimit !== undefined + ? options.parameterLimit + : 1000 + var parse = parser('querystring') + + if (isNaN(parameterLimit) || parameterLimit < 1) { + throw new TypeError('option parameterLimit must be a positive number') + } + + if (isFinite(parameterLimit)) { + parameterLimit = parameterLimit | 0 + } + + return function queryparse (body) { + var paramCount = parameterCount(body, parameterLimit) + + if (paramCount === undefined) { + debug('too many parameters') + throw createError(413, 'too many parameters', { + type: 'parameters.too.many' + }) + } + + debug('parse urlencoding') + return parse(body, undefined, undefined, { maxKeys: parameterLimit }) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/graphql-subscription-express/node_modules/body-parser/package.json b/graphql-subscription-express/node_modules/body-parser/package.json new file mode 100644 index 0000000..4637304 --- /dev/null +++ b/graphql-subscription-express/node_modules/body-parser/package.json @@ -0,0 +1,56 @@ +{ + "name": "body-parser", + "description": "Node.js body parsing middleware", + "version": "1.20.2", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "expressjs/body-parser", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "devDependencies": { + "eslint": "8.34.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "methods": "1.1.2", + "mocha": "10.2.0", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "supertest": "6.3.3" + }, + "files": [ + "lib/", + "LICENSE", + "HISTORY.md", + "SECURITY.md", + "index.js" + ], + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/bytes/History.md b/graphql-subscription-express/node_modules/bytes/History.md new file mode 100644 index 0000000..d60ce0e --- /dev/null +++ b/graphql-subscription-express/node_modules/bytes/History.md @@ -0,0 +1,97 @@ +3.1.2 / 2022-01-27 +================== + + * Fix return value for un-parsable strings + +3.1.1 / 2021-11-15 +================== + + * Fix "thousandsSeparator" incorrecting formatting fractional part + +3.1.0 / 2019-01-22 +================== + + * Add petabyte (`pb`) support + +3.0.0 / 2017-08-31 +================== + + * Change "kB" to "KB" in format output + * Remove support for Node.js 0.6 + * Remove support for ComponentJS + +2.5.0 / 2017-03-24 +================== + + * Add option "unit" + +2.4.0 / 2016-06-01 +================== + + * Add option "unitSeparator" + +2.3.0 / 2016-02-15 +================== + + * Drop partial bytes on all parsed units + * Fix non-finite numbers to `.format` to return `null` + * Fix parsing byte string that looks like hex + * perf: hoist regular expressions + +2.2.0 / 2015-11-13 +================== + + * add option "decimalPlaces" + * add option "fixedDecimals" + +2.1.0 / 2015-05-21 +================== + + * add `.format` export + * add `.parse` export + +2.0.2 / 2015-05-20 +================== + + * remove map recreation + * remove unnecessary object construction + +2.0.1 / 2015-05-07 +================== + + * fix browserify require + * remove node.extend dependency + +2.0.0 / 2015-04-12 +================== + + * add option "case" + * add option "thousandsSeparator" + * return "null" on invalid parse input + * support proper round-trip: bytes(bytes(num)) === num + * units no longer case sensitive when parsing + +1.0.0 / 2014-05-05 +================== + + * add negative support. fixes #6 + +0.3.0 / 2014-03-19 +================== + + * added terabyte support + +0.2.1 / 2013-04-01 +================== + + * add .component + +0.2.0 / 2012-10-28 +================== + + * bytes(200).should.eql('200b') + +0.1.0 / 2012-07-04 +================== + + * add bytes to string conversion [yields] diff --git a/graphql-subscription-express/node_modules/bytes/LICENSE b/graphql-subscription-express/node_modules/bytes/LICENSE new file mode 100644 index 0000000..63e95a9 --- /dev/null +++ b/graphql-subscription-express/node_modules/bytes/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012-2014 TJ Holowaychuk +Copyright (c) 2015 Jed Watson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/bytes/Readme.md b/graphql-subscription-express/node_modules/bytes/Readme.md new file mode 100644 index 0000000..5790e23 --- /dev/null +++ b/graphql-subscription-express/node_modules/bytes/Readme.md @@ -0,0 +1,152 @@ +# Bytes utility + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```bash +$ npm install bytes +``` + +## Usage + +```js +var bytes = require('bytes'); +``` + +#### bytes(number|string value, [options]): number|string|null + +Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`. + +**Arguments** + +| Name | Type | Description | +|---------|----------|--------------------| +| value | `number`|`string` | Number value to format or string value to parse | +| options | `Object` | Conversion options for `format` | + +**Returns** + +| Name | Type | Description | +|---------|------------------|-------------------------------------------------| +| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. | + +**Example** + +```js +bytes(1024); +// output: '1KB' + +bytes('1KB'); +// output: 1024 +``` + +#### bytes.format(number value, [options]): string|null + +Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is + rounded. + +**Arguments** + +| Name | Type | Description | +|---------|----------|--------------------| +| value | `number` | Value in bytes | +| options | `Object` | Conversion options | + +**Options** + +| Property | Type | Description | +|-------------------|--------|-----------------------------------------------------------------------------------------| +| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. | +| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` | +| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. | +| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). | +| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. | + +**Returns** + +| Name | Type | Description | +|---------|------------------|-------------------------------------------------| +| results | `string`|`null` | Return null upon error. String value otherwise. | + +**Example** + +```js +bytes.format(1024); +// output: '1KB' + +bytes.format(1000); +// output: '1000B' + +bytes.format(1000, {thousandsSeparator: ' '}); +// output: '1 000B' + +bytes.format(1024 * 1.7, {decimalPlaces: 0}); +// output: '2KB' + +bytes.format(1024, {unitSeparator: ' '}); +// output: '1 KB' +``` + +#### bytes.parse(string|number value): number|null + +Parse the string value into an integer in bytes. If no unit is given, or `value` +is a number, it is assumed the value is in bytes. + +Supported units and abbreviations are as follows and are case-insensitive: + + * `b` for bytes + * `kb` for kilobytes + * `mb` for megabytes + * `gb` for gigabytes + * `tb` for terabytes + * `pb` for petabytes + +The units are in powers of two, not ten. This means 1kb = 1024b according to this parser. + +**Arguments** + +| Name | Type | Description | +|---------------|--------|--------------------| +| value | `string`|`number` | String to parse, or number in bytes. | + +**Returns** + +| Name | Type | Description | +|---------|-------------|-------------------------| +| results | `number`|`null` | Return null upon error. Value in bytes otherwise. | + +**Example** + +```js +bytes.parse('1KB'); +// output: 1024 + +bytes.parse('1024'); +// output: 1024 + +bytes.parse(1024); +// output: 1024 +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci +[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci +[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master +[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master +[downloads-image]: https://badgen.net/npm/dm/bytes +[downloads-url]: https://npmjs.org/package/bytes +[npm-image]: https://badgen.net/npm/v/bytes +[npm-url]: https://npmjs.org/package/bytes diff --git a/graphql-subscription-express/node_modules/bytes/index.js b/graphql-subscription-express/node_modules/bytes/index.js new file mode 100644 index 0000000..6f2d0f8 --- /dev/null +++ b/graphql-subscription-express/node_modules/bytes/index.js @@ -0,0 +1,170 @@ +/*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = bytes; +module.exports.format = format; +module.exports.parse = parse; + +/** + * Module variables. + * @private + */ + +var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; + +var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; + +var map = { + b: 1, + kb: 1 << 10, + mb: 1 << 20, + gb: 1 << 30, + tb: Math.pow(1024, 4), + pb: Math.pow(1024, 5), +}; + +var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; + +/** + * Convert the given value in bytes into a string or parse to string to an integer in bytes. + * + * @param {string|number} value + * @param {{ + * case: [string], + * decimalPlaces: [number] + * fixedDecimals: [boolean] + * thousandsSeparator: [string] + * unitSeparator: [string] + * }} [options] bytes options. + * + * @returns {string|number|null} + */ + +function bytes(value, options) { + if (typeof value === 'string') { + return parse(value); + } + + if (typeof value === 'number') { + return format(value, options); + } + + return null; +} + +/** + * Format the given value in bytes into a string. + * + * If the value is negative, it is kept as such. If it is a float, + * it is rounded. + * + * @param {number} value + * @param {object} [options] + * @param {number} [options.decimalPlaces=2] + * @param {number} [options.fixedDecimals=false] + * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unit=] + * @param {string} [options.unitSeparator=] + * + * @returns {string|null} + * @public + */ + +function format(value, options) { + if (!Number.isFinite(value)) { + return null; + } + + var mag = Math.abs(value); + var thousandsSeparator = (options && options.thousandsSeparator) || ''; + var unitSeparator = (options && options.unitSeparator) || ''; + var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; + var fixedDecimals = Boolean(options && options.fixedDecimals); + var unit = (options && options.unit) || ''; + + if (!unit || !map[unit.toLowerCase()]) { + if (mag >= map.pb) { + unit = 'PB'; + } else if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'KB'; + } else { + unit = 'B'; + } + } + + var val = value / map[unit.toLowerCase()]; + var str = val.toFixed(decimalPlaces); + + if (!fixedDecimals) { + str = str.replace(formatDecimalsRegExp, '$1'); + } + + if (thousandsSeparator) { + str = str.split('.').map(function (s, i) { + return i === 0 + ? s.replace(formatThousandsRegExp, thousandsSeparator) + : s + }).join('.'); + } + + return str + unitSeparator + unit; +} + +/** + * Parse the string value into an integer in bytes. + * + * If no unit is given, it is assumed the value is in bytes. + * + * @param {number|string} val + * + * @returns {number|null} + * @public + */ + +function parse(val) { + if (typeof val === 'number' && !isNaN(val)) { + return val; + } + + if (typeof val !== 'string') { + return null; + } + + // Test if the string passed is valid + var results = parseRegExp.exec(val); + var floatValue; + var unit = 'b'; + + if (!results) { + // Nothing could be extracted from the given string + floatValue = parseInt(val, 10); + unit = 'b' + } else { + // Retrieve the value and the unit + floatValue = parseFloat(results[1]); + unit = results[4].toLowerCase(); + } + + if (isNaN(floatValue)) { + return null; + } + + return Math.floor(map[unit] * floatValue); +} diff --git a/graphql-subscription-express/node_modules/bytes/package.json b/graphql-subscription-express/node_modules/bytes/package.json new file mode 100644 index 0000000..f2b6a8b --- /dev/null +++ b/graphql-subscription-express/node_modules/bytes/package.json @@ -0,0 +1,42 @@ +{ + "name": "bytes", + "description": "Utility to parse a string bytes to bytes and vice-versa", + "version": "3.1.2", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "contributors": [ + "Jed Watson ", + "Théo FIDRY " + ], + "license": "MIT", + "keywords": [ + "byte", + "bytes", + "utility", + "parse", + "parser", + "convert", + "converter" + ], + "repository": "visionmedia/bytes.js", + "devDependencies": { + "eslint": "7.32.0", + "eslint-plugin-markdown": "2.2.1", + "mocha": "9.2.0", + "nyc": "15.1.0" + }, + "files": [ + "History.md", + "LICENSE", + "Readme.md", + "index.js" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --check-leaks --reporter spec", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/call-bind/.eslintignore b/graphql-subscription-express/node_modules/call-bind/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/graphql-subscription-express/node_modules/call-bind/.eslintrc b/graphql-subscription-express/node_modules/call-bind/.eslintrc new file mode 100644 index 0000000..dfa9a6c --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + "no-magic-numbers": 0, + }, +} diff --git a/graphql-subscription-express/node_modules/call-bind/.github/FUNDING.yml b/graphql-subscription-express/node_modules/call-bind/.github/FUNDING.yml new file mode 100644 index 0000000..c70c2ec --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/call-bind +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/call-bind/.nycrc b/graphql-subscription-express/node_modules/call-bind/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/call-bind/CHANGELOG.md b/graphql-subscription-express/node_modules/call-bind/CHANGELOG.md new file mode 100644 index 0000000..c653f70 --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/CHANGELOG.md @@ -0,0 +1,93 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.7](https://github.com/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12 + +### Commits + +- [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03) +- [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590) + +## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05 + +### Commits + +- [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa) +- [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5) +- [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582) + +## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19 + +### Commits + +- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d) +- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871) + +## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19 + +## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19 + +### Commits + +- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453) +- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5) +- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90) +- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4) +- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11) +- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223) +- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5) +- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05) +- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329) +- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958) +- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5) +- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3) +- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91) +- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60) + +## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11 + +### Commits + +- [Fix] properly include the receiver in the bound length [`dbae7bc`](https://github.com/ljharb/call-bind/commit/dbae7bc676c079a0d33c0a43e9ef92cb7b01345d) + +## [v1.0.1](https://github.com/ljharb/call-bind/compare/v1.0.0...v1.0.1) - 2021-01-08 + +### Commits + +- [Tests] migrate tests to Github Actions [`b6db284`](https://github.com/ljharb/call-bind/commit/b6db284c36f8ccd195b88a6764fe84b7223a0da1) +- [meta] do not publish github action workflow files [`ec7fe46`](https://github.com/ljharb/call-bind/commit/ec7fe46e60cfa4764ee943d2755f5e5a366e578e) +- [Fix] preserve original function’s length when possible [`adbceaa`](https://github.com/ljharb/call-bind/commit/adbceaa3cac4b41ea78bb19d7ccdbaaf7e0bdadb) +- [Tests] gather coverage data on every job [`d69e23c`](https://github.com/ljharb/call-bind/commit/d69e23cc65f101ba1d4c19bb07fa8eb0ec624be8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2fd3586`](https://github.com/ljharb/call-bind/commit/2fd3586c5d47b335364c14293114c6b625ae1f71) +- [Deps] update `get-intrinsic` [`f23e931`](https://github.com/ljharb/call-bind/commit/f23e9318cc271c2add8bb38cfded85ee7baf8eee) +- [Deps] update `get-intrinsic` [`72d9f44`](https://github.com/ljharb/call-bind/commit/72d9f44e184465ba8dd3fb48260bbcff234985f2) +- [meta] fix FUNDING.yml [`e723573`](https://github.com/ljharb/call-bind/commit/e723573438c5a68dcec31fb5d96ea6b7e4a93be8) +- [eslint] ignore coverage output [`15e76d2`](https://github.com/ljharb/call-bind/commit/15e76d28a5f43e504696401e5b31ebb78ee1b532) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`8fa4dab`](https://github.com/ljharb/call-bind/commit/8fa4dabb23ba3dd7bb92c9571c1241c08b56e4b6) + +## v1.0.0 - 2020-10-30 + +### Commits + +- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50) +- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df) +- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65) +- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13) +- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4) +- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717) +- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af) +- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650) +- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f) diff --git a/graphql-subscription-express/node_modules/call-bind/LICENSE b/graphql-subscription-express/node_modules/call-bind/LICENSE new file mode 100644 index 0000000..48f05d0 --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/call-bind/README.md b/graphql-subscription-express/node_modules/call-bind/README.md new file mode 100644 index 0000000..48e9047 --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/README.md @@ -0,0 +1,64 @@ +# call-bind [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robustly `.call.bind()` a function. + +## Getting started + +```sh +npm install --save call-bind +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBind = require('call-bind'); +const callBound = require('call-bind/callBound'); + +function f(a, b) { + assert.equal(this, 1); + assert.equal(a, 2); + assert.equal(b, 3); + assert.equal(arguments.length, 2); +} + +const fBound = callBind(f); + +const slice = callBound('Array.prototype.slice'); + +delete Function.prototype.call; +delete Function.prototype.bind; + +fBound(1, 2, 3); + +assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bind +[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg +[deps-svg]: https://david-dm.org/ljharb/call-bind.svg +[deps-url]: https://david-dm.org/ljharb/call-bind +[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bind +[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind +[actions-url]: https://github.com/ljharb/call-bind/actions diff --git a/graphql-subscription-express/node_modules/call-bind/callBound.js b/graphql-subscription-express/node_modules/call-bind/callBound.js new file mode 100644 index 0000000..8374adf --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/callBound.js @@ -0,0 +1,15 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBind = require('./'); + +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; diff --git a/graphql-subscription-express/node_modules/call-bind/index.js b/graphql-subscription-express/node_modules/call-bind/index.js new file mode 100644 index 0000000..01c5b3d --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); +var setFunctionLength = require('set-function-length'); + +var $TypeError = require('es-errors/type'); +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); + +var $defineProperty = require('es-define-property'); +var $max = GetIntrinsic('%Math.max%'); + +module.exports = function callBind(originalFunction) { + if (typeof originalFunction !== 'function') { + throw new $TypeError('a function is required'); + } + var func = $reflectApply(bind, $call, arguments); + return setFunctionLength( + func, + 1 + $max(0, originalFunction.length - (arguments.length - 1)), + true + ); +}; + +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} diff --git a/graphql-subscription-express/node_modules/call-bind/package.json b/graphql-subscription-express/node_modules/call-bind/package.json new file mode 100644 index 0000000..5ba88ff --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/package.json @@ -0,0 +1,95 @@ +{ + "name": "call-bind", + "version": "1.0.7", + "description": "Robustly `.call.bind()` a function", + "main": "index.js", + "exports": { + ".": "./index.js", + "./callBound": "./callBound.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "evalmd README.md", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/call-bind.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "es", + "js", + "callbind", + "callbound", + "call", + "bind", + "bound", + "call-bind", + "call-bound", + "function", + "es-abstract" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/call-bind/issues" + }, + "homepage": "https://github.com/ljharb/call-bind#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" + }, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/graphql-subscription-express/node_modules/call-bind/test/callBound.js b/graphql-subscription-express/node_modules/call-bind/test/callBound.js new file mode 100644 index 0000000..c32319d --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/test/callBound.js @@ -0,0 +1,54 @@ +'use strict'; + +var test = require('tape'); + +var callBound = require('../callBound'); + +test('callBound', function (t) { + // static primitive + t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself'); + t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself'); + + // static non-function object + t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself'); + t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself'); + t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself'); + t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself'); + + // static function + t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself'); + t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself'); + + // prototype primitive + t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself'); + t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself'); + + // prototype function + t.notEqual(callBound('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString does not yield itself'); + t.notEqual(callBound('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% does not yield itself'); + t.equal(callBound('Object.prototype.toString')(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original'); + t.equal(callBound('%Object.prototype.toString%')(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original'); + + t['throws']( + function () { callBound('does not exist'); }, + SyntaxError, + 'nonexistent intrinsic throws' + ); + t['throws']( + function () { callBound('does not exist', true); }, + SyntaxError, + 'allowMissing arg still throws for unknown intrinsic' + ); + + t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { + st['throws']( + function () { callBound('WeakRef'); }, + TypeError, + 'real but absent intrinsic throws' + ); + st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception'); + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/call-bind/test/index.js b/graphql-subscription-express/node_modules/call-bind/test/index.js new file mode 100644 index 0000000..1fd4668 --- /dev/null +++ b/graphql-subscription-express/node_modules/call-bind/test/index.js @@ -0,0 +1,80 @@ +'use strict'; + +var callBind = require('../'); +var bind = require('function-bind'); +var gOPD = require('gopd'); +var hasStrictMode = require('has-strict-mode')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var v = require('es-value-fixtures'); + +var test = require('tape'); + +/* + * older engines have length nonconfigurable + * in io.js v3, it is configurable except on bound functions, hence the .bind() + */ +var functionsHaveConfigurableLengths = !!( + gOPD + && Object.getOwnPropertyDescriptor + && Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable +); + +test('callBind', function (t) { + forEach(v.nonFunctions, function (nonFunction) { + t['throws']( + function () { callBind(nonFunction); }, + TypeError, + inspect(nonFunction) + ' is not a function' + ); + }); + + var sentinel = { sentinel: true }; + var func = function (a, b) { + // eslint-disable-next-line no-invalid-this + return [!hasStrictMode && this === global ? undefined : this, a, b]; + }; + t.equal(func.length, 2, 'original function length is 2'); + t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); + t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args'); + t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args'); + + var bound = callBind(func); + t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); + t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args'); + t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args'); + t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); + + var boundR = callBind(func, sentinel); + t.equal(boundR.length, func.length, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); + t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); + t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); + t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args'); + + var boundArg = callBind(func, sentinel, 1); + t.equal(boundArg.length, func.length - 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); + t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); + t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg'); + t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args'); + + t.test('callBind.apply', function (st) { + var aBound = callBind.apply(func); + st.deepEqual(aBound(sentinel), [sentinel, undefined, undefined], 'apply-bound func with no args'); + st.deepEqual(aBound(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); + st.deepEqual(aBound(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); + + var aBoundArg = callBind.apply(func); + st.deepEqual(aBoundArg(sentinel, [1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with too many args'); + st.deepEqual(aBoundArg(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); + st.deepEqual(aBoundArg(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); + + var aBoundR = callBind.apply(func, sentinel); + st.deepEqual(aBoundR([1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with receiver and too many args'); + st.deepEqual(aBoundR([1, 2], 4), [sentinel, 1, 2], 'apply-bound func with receiver and right args'); + st.deepEqual(aBoundR([1], 4), [sentinel, 1, undefined], 'apply-bound func with receiver and too few args'); + + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/content-disposition/HISTORY.md b/graphql-subscription-express/node_modules/content-disposition/HISTORY.md new file mode 100644 index 0000000..488effa --- /dev/null +++ b/graphql-subscription-express/node_modules/content-disposition/HISTORY.md @@ -0,0 +1,60 @@ +0.5.4 / 2021-12-10 +================== + + * deps: safe-buffer@5.2.1 + +0.5.3 / 2018-12-17 +================== + + * Use `safe-buffer` for improved Buffer API + +0.5.2 / 2016-12-08 +================== + + * Fix `parse` to accept any linear whitespace character + +0.5.1 / 2016-01-17 +================== + + * perf: enable strict mode + +0.5.0 / 2014-10-11 +================== + + * Add `parse` function + +0.4.0 / 2014-09-21 +================== + + * Expand non-Unicode `filename` to the full ISO-8859-1 charset + +0.3.0 / 2014-09-20 +================== + + * Add `fallback` option + * Add `type` option + +0.2.0 / 2014-09-19 +================== + + * Reduce ambiguity of file names with hex escape in buggy browsers + +0.1.2 / 2014-09-19 +================== + + * Fix periodic invalid Unicode filename header + +0.1.1 / 2014-09-19 +================== + + * Fix invalid characters appearing in `filename*` parameter + +0.1.0 / 2014-09-18 +================== + + * Make the `filename` argument optional + +0.0.0 / 2014-09-18 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/content-disposition/LICENSE b/graphql-subscription-express/node_modules/content-disposition/LICENSE new file mode 100644 index 0000000..84441fb --- /dev/null +++ b/graphql-subscription-express/node_modules/content-disposition/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/content-disposition/README.md b/graphql-subscription-express/node_modules/content-disposition/README.md new file mode 100644 index 0000000..3a0bb05 --- /dev/null +++ b/graphql-subscription-express/node_modules/content-disposition/README.md @@ -0,0 +1,142 @@ +# content-disposition + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Create and parse HTTP `Content-Disposition` header + +## Installation + +```sh +$ npm install content-disposition +``` + +## API + +```js +var contentDisposition = require('content-disposition') +``` + +### contentDisposition(filename, options) + +Create an attachment `Content-Disposition` header value using the given file name, +if supplied. The `filename` is optional and if no file name is desired, but you +want to specify `options`, set `filename` to `undefined`. + +```js +res.setHeader('Content-Disposition', contentDisposition('∫ maths.pdf')) +``` + +**note** HTTP headers are of the ISO-8859-1 character set. If you are writing this +header through a means different from `setHeader` in Node.js, you'll want to specify +the `'binary'` encoding in Node.js. + +#### Options + +`contentDisposition` accepts these properties in the options object. + +##### fallback + +If the `filename` option is outside ISO-8859-1, then the file name is actually +stored in a supplemental field for clients that support Unicode file names and +a ISO-8859-1 version of the file name is automatically generated. + +This specifies the ISO-8859-1 file name to override the automatic generation or +disables the generation all together, defaults to `true`. + + - A string will specify the ISO-8859-1 file name to use in place of automatic + generation. + - `false` will disable including a ISO-8859-1 file name and only include the + Unicode version (unless the file name is already ISO-8859-1). + - `true` will enable automatic generation if the file name is outside ISO-8859-1. + +If the `filename` option is ISO-8859-1 and this option is specified and has a +different value, then the `filename` option is encoded in the extended field +and this set as the fallback field, even though they are both ISO-8859-1. + +##### type + +Specifies the disposition type, defaults to `"attachment"`. This can also be +`"inline"`, or any other value (all values except inline are treated like +`attachment`, but can convey additional information if both parties agree to +it). The type is normalized to lower-case. + +### contentDisposition.parse(string) + +```js +var disposition = contentDisposition.parse('attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt') +``` + +Parse a `Content-Disposition` header string. This automatically handles extended +("Unicode") parameters by decoding them and providing them under the standard +parameter name. This will return an object with the following properties (examples +are shown for the string `'attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt'`): + + - `type`: The disposition type (always lower case). Example: `'attachment'` + + - `parameters`: An object of the parameters in the disposition (name of parameter + always lower case and extended versions replace non-extended versions). Example: + `{filename: "€ rates.txt"}` + +## Examples + +### Send a file for download + +```js +var contentDisposition = require('content-disposition') +var destroy = require('destroy') +var fs = require('fs') +var http = require('http') +var onFinished = require('on-finished') + +var filePath = '/path/to/public/plans.pdf' + +http.createServer(function onRequest (req, res) { + // set headers + res.setHeader('Content-Type', 'application/pdf') + res.setHeader('Content-Disposition', contentDisposition(filePath)) + + // send file + var stream = fs.createReadStream(filePath) + stream.pipe(res) + onFinished(res, function () { + destroy(stream) + }) +}) +``` + +## Testing + +```sh +$ npm test +``` + +## References + +- [RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1][rfc-2616] +- [RFC 5987: Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters][rfc-5987] +- [RFC 6266: Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)][rfc-6266] +- [Test Cases for HTTP Content-Disposition header field (RFC 6266) and the Encodings defined in RFCs 2047, 2231 and 5987][tc-2231] + +[rfc-2616]: https://tools.ietf.org/html/rfc2616 +[rfc-5987]: https://tools.ietf.org/html/rfc5987 +[rfc-6266]: https://tools.ietf.org/html/rfc6266 +[tc-2231]: http://greenbytes.de/tech/tc2231/ + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/content-disposition.svg +[npm-url]: https://npmjs.org/package/content-disposition +[node-version-image]: https://img.shields.io/node/v/content-disposition.svg +[node-version-url]: https://nodejs.org/en/download +[coveralls-image]: https://img.shields.io/coveralls/jshttp/content-disposition.svg +[coveralls-url]: https://coveralls.io/r/jshttp/content-disposition?branch=master +[downloads-image]: https://img.shields.io/npm/dm/content-disposition.svg +[downloads-url]: https://npmjs.org/package/content-disposition +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/content-disposition/ci/master?label=ci +[github-actions-ci-url]: https://github.com/jshttp/content-disposition?query=workflow%3Aci diff --git a/graphql-subscription-express/node_modules/content-disposition/index.js b/graphql-subscription-express/node_modules/content-disposition/index.js new file mode 100644 index 0000000..ecec899 --- /dev/null +++ b/graphql-subscription-express/node_modules/content-disposition/index.js @@ -0,0 +1,458 @@ +/*! + * content-disposition + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = contentDisposition +module.exports.parse = parse + +/** + * Module dependencies. + * @private + */ + +var basename = require('path').basename +var Buffer = require('safe-buffer').Buffer + +/** + * RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%") + * @private + */ + +var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g // eslint-disable-line no-control-regex + +/** + * RegExp to match percent encoding escape. + * @private + */ + +var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/ +var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g + +/** + * RegExp to match non-latin1 characters. + * @private + */ + +var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g + +/** + * RegExp to match quoted-pair in RFC 2616 + * + * quoted-pair = "\" CHAR + * CHAR = + * @private + */ + +var QESC_REGEXP = /\\([\u0000-\u007f])/g // eslint-disable-line no-control-regex + +/** + * RegExp to match chars that must be quoted-pair in RFC 2616 + * @private + */ + +var QUOTE_REGEXP = /([\\"])/g + +/** + * RegExp for various RFC 2616 grammar + * + * parameter = token "=" ( token | quoted-string ) + * token = 1* + * separators = "(" | ")" | "<" | ">" | "@" + * | "," | ";" | ":" | "\" | <"> + * | "/" | "[" | "]" | "?" | "=" + * | "{" | "}" | SP | HT + * quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) + * qdtext = > + * quoted-pair = "\" CHAR + * CHAR = + * TEXT = + * LWS = [CRLF] 1*( SP | HT ) + * CRLF = CR LF + * CR = + * LF = + * SP = + * HT = + * CTL = + * OCTET = + * @private + */ + +var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g // eslint-disable-line no-control-regex +var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]+$/ +var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/ + +/** + * RegExp for various RFC 5987 grammar + * + * ext-value = charset "'" [ language ] "'" value-chars + * charset = "UTF-8" / "ISO-8859-1" / mime-charset + * mime-charset = 1*mime-charsetc + * mime-charsetc = ALPHA / DIGIT + * / "!" / "#" / "$" / "%" / "&" + * / "+" / "-" / "^" / "_" / "`" + * / "{" / "}" / "~" + * language = ( 2*3ALPHA [ extlang ] ) + * / 4ALPHA + * / 5*8ALPHA + * extlang = *3( "-" 3ALPHA ) + * value-chars = *( pct-encoded / attr-char ) + * pct-encoded = "%" HEXDIG HEXDIG + * attr-char = ALPHA / DIGIT + * / "!" / "#" / "$" / "&" / "+" / "-" / "." + * / "^" / "_" / "`" / "|" / "~" + * @private + */ + +var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/ + +/** + * RegExp for various RFC 6266 grammar + * + * disposition-type = "inline" | "attachment" | disp-ext-type + * disp-ext-type = token + * disposition-parm = filename-parm | disp-ext-parm + * filename-parm = "filename" "=" value + * | "filename*" "=" ext-value + * disp-ext-parm = token "=" value + * | ext-token "=" ext-value + * ext-token = + * @private + */ + +var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/ // eslint-disable-line no-control-regex + +/** + * Create an attachment Content-Disposition header. + * + * @param {string} [filename] + * @param {object} [options] + * @param {string} [options.type=attachment] + * @param {string|boolean} [options.fallback=true] + * @return {string} + * @public + */ + +function contentDisposition (filename, options) { + var opts = options || {} + + // get type + var type = opts.type || 'attachment' + + // get parameters + var params = createparams(filename, opts.fallback) + + // format into string + return format(new ContentDisposition(type, params)) +} + +/** + * Create parameters object from filename and fallback. + * + * @param {string} [filename] + * @param {string|boolean} [fallback=true] + * @return {object} + * @private + */ + +function createparams (filename, fallback) { + if (filename === undefined) { + return + } + + var params = {} + + if (typeof filename !== 'string') { + throw new TypeError('filename must be a string') + } + + // fallback defaults to true + if (fallback === undefined) { + fallback = true + } + + if (typeof fallback !== 'string' && typeof fallback !== 'boolean') { + throw new TypeError('fallback must be a string or boolean') + } + + if (typeof fallback === 'string' && NON_LATIN1_REGEXP.test(fallback)) { + throw new TypeError('fallback must be ISO-8859-1 string') + } + + // restrict to file base name + var name = basename(filename) + + // determine if name is suitable for quoted string + var isQuotedString = TEXT_REGEXP.test(name) + + // generate fallback name + var fallbackName = typeof fallback !== 'string' + ? fallback && getlatin1(name) + : basename(fallback) + var hasFallback = typeof fallbackName === 'string' && fallbackName !== name + + // set extended filename parameter + if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) { + params['filename*'] = name + } + + // set filename parameter + if (isQuotedString || hasFallback) { + params.filename = hasFallback + ? fallbackName + : name + } + + return params +} + +/** + * Format object to Content-Disposition header. + * + * @param {object} obj + * @param {string} obj.type + * @param {object} [obj.parameters] + * @return {string} + * @private + */ + +function format (obj) { + var parameters = obj.parameters + var type = obj.type + + if (!type || typeof type !== 'string' || !TOKEN_REGEXP.test(type)) { + throw new TypeError('invalid type') + } + + // start with normalized type + var string = String(type).toLowerCase() + + // append parameters + if (parameters && typeof parameters === 'object') { + var param + var params = Object.keys(parameters).sort() + + for (var i = 0; i < params.length; i++) { + param = params[i] + + var val = param.substr(-1) === '*' + ? ustring(parameters[param]) + : qstring(parameters[param]) + + string += '; ' + param + '=' + val + } + } + + return string +} + +/** + * Decode a RFC 5987 field value (gracefully). + * + * @param {string} str + * @return {string} + * @private + */ + +function decodefield (str) { + var match = EXT_VALUE_REGEXP.exec(str) + + if (!match) { + throw new TypeError('invalid extended field value') + } + + var charset = match[1].toLowerCase() + var encoded = match[2] + var value + + // to binary string + var binary = encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode) + + switch (charset) { + case 'iso-8859-1': + value = getlatin1(binary) + break + case 'utf-8': + value = Buffer.from(binary, 'binary').toString('utf8') + break + default: + throw new TypeError('unsupported charset in extended field') + } + + return value +} + +/** + * Get ISO-8859-1 version of string. + * + * @param {string} val + * @return {string} + * @private + */ + +function getlatin1 (val) { + // simple Unicode -> ISO-8859-1 transformation + return String(val).replace(NON_LATIN1_REGEXP, '?') +} + +/** + * Parse Content-Disposition header string. + * + * @param {string} string + * @return {object} + * @public + */ + +function parse (string) { + if (!string || typeof string !== 'string') { + throw new TypeError('argument string is required') + } + + var match = DISPOSITION_TYPE_REGEXP.exec(string) + + if (!match) { + throw new TypeError('invalid type format') + } + + // normalize type + var index = match[0].length + var type = match[1].toLowerCase() + + var key + var names = [] + var params = {} + var value + + // calculate index to start at + index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ';' + ? index - 1 + : index + + // match parameters + while ((match = PARAM_REGEXP.exec(string))) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (names.indexOf(key) !== -1) { + throw new TypeError('invalid duplicate parameter') + } + + names.push(key) + + if (key.indexOf('*') + 1 === key.length) { + // decode extended value + key = key.slice(0, -1) + value = decodefield(value) + + // overwrite existing value + params[key] = value + continue + } + + if (typeof params[key] === 'string') { + continue + } + + if (value[0] === '"') { + // remove quotes and escapes + value = value + .substr(1, value.length - 2) + .replace(QESC_REGEXP, '$1') + } + + params[key] = value + } + + if (index !== -1 && index !== string.length) { + throw new TypeError('invalid parameter format') + } + + return new ContentDisposition(type, params) +} + +/** + * Percent decode a single character. + * + * @param {string} str + * @param {string} hex + * @return {string} + * @private + */ + +function pdecode (str, hex) { + return String.fromCharCode(parseInt(hex, 16)) +} + +/** + * Percent encode a single character. + * + * @param {string} char + * @return {string} + * @private + */ + +function pencode (char) { + return '%' + String(char) + .charCodeAt(0) + .toString(16) + .toUpperCase() +} + +/** + * Quote a string for HTTP. + * + * @param {string} val + * @return {string} + * @private + */ + +function qstring (val) { + var str = String(val) + + return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' +} + +/** + * Encode a Unicode string for HTTP (RFC 5987). + * + * @param {string} val + * @return {string} + * @private + */ + +function ustring (val) { + var str = String(val) + + // percent encode as UTF-8 + var encoded = encodeURIComponent(str) + .replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode) + + return 'UTF-8\'\'' + encoded +} + +/** + * Class for parsed Content-Disposition header for v8 optimization + * + * @public + * @param {string} type + * @param {object} parameters + * @constructor + */ + +function ContentDisposition (type, parameters) { + this.type = type + this.parameters = parameters +} diff --git a/graphql-subscription-express/node_modules/content-disposition/package.json b/graphql-subscription-express/node_modules/content-disposition/package.json new file mode 100644 index 0000000..43c70ce --- /dev/null +++ b/graphql-subscription-express/node_modules/content-disposition/package.json @@ -0,0 +1,44 @@ +{ + "name": "content-disposition", + "description": "Create and parse Content-Disposition header", + "version": "0.5.4", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "content-disposition", + "http", + "rfc6266", + "res" + ], + "repository": "jshttp/content-disposition", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "7.32.0", + "eslint-config-standard": "13.0.1", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "istanbul": "0.4.5", + "mocha": "9.1.3" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/content-type/HISTORY.md b/graphql-subscription-express/node_modules/content-type/HISTORY.md new file mode 100644 index 0000000..4583671 --- /dev/null +++ b/graphql-subscription-express/node_modules/content-type/HISTORY.md @@ -0,0 +1,29 @@ +1.0.5 / 2023-01-29 +================== + + * perf: skip value escaping when unnecessary + +1.0.4 / 2017-09-11 +================== + + * perf: skip parameter parsing when no parameters + +1.0.3 / 2017-09-10 +================== + + * perf: remove argument reassignment + +1.0.2 / 2016-05-09 +================== + + * perf: enable strict mode + +1.0.1 / 2015-02-13 +================== + + * Improve missing `Content-Type` header error message + +1.0.0 / 2015-02-01 +================== + + * Initial implementation, derived from `media-typer@0.3.0` diff --git a/graphql-subscription-express/node_modules/content-type/LICENSE b/graphql-subscription-express/node_modules/content-type/LICENSE new file mode 100644 index 0000000..34b1a2d --- /dev/null +++ b/graphql-subscription-express/node_modules/content-type/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/content-type/README.md b/graphql-subscription-express/node_modules/content-type/README.md new file mode 100644 index 0000000..c1a922a --- /dev/null +++ b/graphql-subscription-express/node_modules/content-type/README.md @@ -0,0 +1,94 @@ +# content-type + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Create and parse HTTP Content-Type header according to RFC 7231 + +## Installation + +```sh +$ npm install content-type +``` + +## API + +```js +var contentType = require('content-type') +``` + +### contentType.parse(string) + +```js +var obj = contentType.parse('image/svg+xml; charset=utf-8') +``` + +Parse a `Content-Type` header. This will return an object with the following +properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): + + - `type`: The media type (the type and subtype, always lower case). + Example: `'image/svg+xml'` + + - `parameters`: An object of the parameters in the media type (name of parameter + always lower case). Example: `{charset: 'utf-8'}` + +Throws a `TypeError` if the string is missing or invalid. + +### contentType.parse(req) + +```js +var obj = contentType.parse(req) +``` + +Parse the `Content-Type` header from the given `req`. Short-cut for +`contentType.parse(req.headers['content-type'])`. + +Throws a `TypeError` if the `Content-Type` header is missing or invalid. + +### contentType.parse(res) + +```js +var obj = contentType.parse(res) +``` + +Parse the `Content-Type` header set on the given `res`. Short-cut for +`contentType.parse(res.getHeader('content-type'))`. + +Throws a `TypeError` if the `Content-Type` header is missing or invalid. + +### contentType.format(obj) + +```js +var str = contentType.format({ + type: 'image/svg+xml', + parameters: { charset: 'utf-8' } +}) +``` + +Format an object into a `Content-Type` header. This will return a string of the +content type for the given object with the following properties (examples are +shown that produce the string `'image/svg+xml; charset=utf-8'`): + + - `type`: The media type (will be lower-cased). Example: `'image/svg+xml'` + + - `parameters`: An object of the parameters in the media type (name of the + parameter will be lower-cased). Example: `{charset: 'utf-8'}` + +Throws a `TypeError` if the object contains an invalid type or parameter names. + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/content-type/master?label=ci +[ci-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/content-type/master +[coveralls-url]: https://coveralls.io/r/jshttp/content-type?branch=master +[node-image]: https://badgen.net/npm/node/content-type +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/content-type +[npm-url]: https://npmjs.org/package/content-type +[npm-version-image]: https://badgen.net/npm/v/content-type diff --git a/graphql-subscription-express/node_modules/content-type/index.js b/graphql-subscription-express/node_modules/content-type/index.js new file mode 100644 index 0000000..41840e7 --- /dev/null +++ b/graphql-subscription-express/node_modules/content-type/index.js @@ -0,0 +1,225 @@ +/*! + * content-type + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 + * + * parameter = token "=" ( token / quoted-string ) + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE + * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text + * obs-text = %x80-FF + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + */ +var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g // eslint-disable-line no-control-regex +var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ // eslint-disable-line no-control-regex +var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ + +/** + * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 + * + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + * obs-text = %x80-FF + */ +var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g // eslint-disable-line no-control-regex + +/** + * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 + */ +var QUOTE_REGEXP = /([\\"])/g + +/** + * RegExp to match type in RFC 7231 sec 3.1.1.1 + * + * media-type = type "/" subtype + * type = token + * subtype = token + */ +var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ + +/** + * Module exports. + * @public + */ + +exports.format = format +exports.parse = parse + +/** + * Format object to media type. + * + * @param {object} obj + * @return {string} + * @public + */ + +function format (obj) { + if (!obj || typeof obj !== 'object') { + throw new TypeError('argument obj is required') + } + + var parameters = obj.parameters + var type = obj.type + + if (!type || !TYPE_REGEXP.test(type)) { + throw new TypeError('invalid type') + } + + var string = type + + // append parameters + if (parameters && typeof parameters === 'object') { + var param + var params = Object.keys(parameters).sort() + + for (var i = 0; i < params.length; i++) { + param = params[i] + + if (!TOKEN_REGEXP.test(param)) { + throw new TypeError('invalid parameter name') + } + + string += '; ' + param + '=' + qstring(parameters[param]) + } + } + + return string +} + +/** + * Parse media type to object. + * + * @param {string|object} string + * @return {Object} + * @public + */ + +function parse (string) { + if (!string) { + throw new TypeError('argument string is required') + } + + // support req/res-like objects as argument + var header = typeof string === 'object' + ? getcontenttype(string) + : string + + if (typeof header !== 'string') { + throw new TypeError('argument string is required to be a string') + } + + var index = header.indexOf(';') + var type = index !== -1 + ? header.slice(0, index).trim() + : header.trim() + + if (!TYPE_REGEXP.test(type)) { + throw new TypeError('invalid media type') + } + + var obj = new ContentType(type.toLowerCase()) + + // parse parameters + if (index !== -1) { + var key + var match + var value + + PARAM_REGEXP.lastIndex = index + + while ((match = PARAM_REGEXP.exec(header))) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value.charCodeAt(0) === 0x22 /* " */) { + // remove quotes + value = value.slice(1, -1) + + // remove escapes + if (value.indexOf('\\') !== -1) { + value = value.replace(QESC_REGEXP, '$1') + } + } + + obj.parameters[key] = value + } + + if (index !== header.length) { + throw new TypeError('invalid parameter format') + } + } + + return obj +} + +/** + * Get content-type from req/res objects. + * + * @param {object} + * @return {Object} + * @private + */ + +function getcontenttype (obj) { + var header + + if (typeof obj.getHeader === 'function') { + // res-like + header = obj.getHeader('content-type') + } else if (typeof obj.headers === 'object') { + // req-like + header = obj.headers && obj.headers['content-type'] + } + + if (typeof header !== 'string') { + throw new TypeError('content-type header is missing from object') + } + + return header +} + +/** + * Quote a string if necessary. + * + * @param {string} val + * @return {string} + * @private + */ + +function qstring (val) { + var str = String(val) + + // no need to quote tokens + if (TOKEN_REGEXP.test(str)) { + return str + } + + if (str.length > 0 && !TEXT_REGEXP.test(str)) { + throw new TypeError('invalid parameter value') + } + + return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' +} + +/** + * Class to represent a content type. + * @private + */ +function ContentType (type) { + this.parameters = Object.create(null) + this.type = type +} diff --git a/graphql-subscription-express/node_modules/content-type/package.json b/graphql-subscription-express/node_modules/content-type/package.json new file mode 100644 index 0000000..9db19f6 --- /dev/null +++ b/graphql-subscription-express/node_modules/content-type/package.json @@ -0,0 +1,42 @@ +{ + "name": "content-type", + "description": "Create and parse HTTP Content-Type header", + "version": "1.0.5", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "content-type", + "http", + "req", + "res", + "rfc7231" + ], + "repository": "jshttp/content-type", + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "8.32.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "10.2.0", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/graphql-subscription-express/node_modules/cookie-signature/.npmignore b/graphql-subscription-express/node_modules/cookie-signature/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie-signature/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/graphql-subscription-express/node_modules/cookie-signature/History.md b/graphql-subscription-express/node_modules/cookie-signature/History.md new file mode 100644 index 0000000..78513cc --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie-signature/History.md @@ -0,0 +1,38 @@ +1.0.6 / 2015-02-03 +================== + +* use `npm test` instead of `make test` to run tests +* clearer assertion messages when checking input + + +1.0.5 / 2014-09-05 +================== + +* add license to package.json + +1.0.4 / 2014-06-25 +================== + + * corrected avoidance of timing attacks (thanks @tenbits!) + +1.0.3 / 2014-01-28 +================== + + * [incorrect] fix for timing attacks + +1.0.2 / 2014-01-28 +================== + + * fix missing repository warning + * fix typo in test + +1.0.1 / 2013-04-15 +================== + + * Revert "Changed underlying HMAC algo. to sha512." + * Revert "Fix for timing attacks on MAC verification." + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/cookie-signature/Readme.md b/graphql-subscription-express/node_modules/cookie-signature/Readme.md new file mode 100644 index 0000000..2559e84 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie-signature/Readme.md @@ -0,0 +1,42 @@ + +# cookie-signature + + Sign and unsign cookies. + +## Example + +```js +var cookie = require('cookie-signature'); + +var val = cookie.sign('hello', 'tobiiscool'); +val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI'); + +var val = cookie.sign('hello', 'tobiiscool'); +cookie.unsign(val, 'tobiiscool').should.equal('hello'); +cookie.unsign(val, 'luna').should.be.false; +``` + +## License + +(The MIT License) + +Copyright (c) 2012 LearnBoost <tj@learnboost.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/cookie-signature/index.js b/graphql-subscription-express/node_modules/cookie-signature/index.js new file mode 100644 index 0000000..b8c9463 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie-signature/index.js @@ -0,0 +1,51 @@ +/** + * Module dependencies. + */ + +var crypto = require('crypto'); + +/** + * Sign the given `val` with `secret`. + * + * @param {String} val + * @param {String} secret + * @return {String} + * @api private + */ + +exports.sign = function(val, secret){ + if ('string' != typeof val) throw new TypeError("Cookie value must be provided as a string."); + if ('string' != typeof secret) throw new TypeError("Secret string must be provided."); + return val + '.' + crypto + .createHmac('sha256', secret) + .update(val) + .digest('base64') + .replace(/\=+$/, ''); +}; + +/** + * Unsign and decode the given `val` with `secret`, + * returning `false` if the signature is invalid. + * + * @param {String} val + * @param {String} secret + * @return {String|Boolean} + * @api private + */ + +exports.unsign = function(val, secret){ + if ('string' != typeof val) throw new TypeError("Signed cookie string must be provided."); + if ('string' != typeof secret) throw new TypeError("Secret string must be provided."); + var str = val.slice(0, val.lastIndexOf('.')) + , mac = exports.sign(str, secret); + + return sha1(mac) == sha1(val) ? str : false; +}; + +/** + * Private + */ + +function sha1(str){ + return crypto.createHash('sha1').update(str).digest('hex'); +} diff --git a/graphql-subscription-express/node_modules/cookie-signature/package.json b/graphql-subscription-express/node_modules/cookie-signature/package.json new file mode 100644 index 0000000..29c4498 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie-signature/package.json @@ -0,0 +1,18 @@ +{ + "name": "cookie-signature", + "version": "1.0.6", + "description": "Sign and unsign cookies", + "keywords": ["cookie", "sign", "unsign"], + "author": "TJ Holowaychuk ", + "license": "MIT", + "repository": { "type": "git", "url": "https://github.com/visionmedia/node-cookie-signature.git"}, + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "scripts": { + "test": "mocha --require should --reporter spec" + }, + "main": "index" +} diff --git a/graphql-subscription-express/node_modules/cookie/HISTORY.md b/graphql-subscription-express/node_modules/cookie/HISTORY.md new file mode 100644 index 0000000..41ae4b0 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie/HISTORY.md @@ -0,0 +1,147 @@ +0.6.0 / 2023-11-06 +================== + + * Add `partitioned` option + +0.5.0 / 2022-04-11 +================== + + * Add `priority` option + * Fix `expires` option to reject invalid dates + * perf: improve default decode speed + * perf: remove slow string split in parse + +0.4.2 / 2022-02-02 +================== + + * perf: read value only when assigning in parse + * perf: remove unnecessary regexp in parse + +0.4.1 / 2020-04-21 +================== + + * Fix `maxAge` option to reject invalid values + +0.4.0 / 2019-05-15 +================== + + * Add `SameSite=None` support + +0.3.1 / 2016-05-26 +================== + + * Fix `sameSite: true` to work with draft-7 clients + - `true` now sends `SameSite=Strict` instead of `SameSite` + +0.3.0 / 2016-05-26 +================== + + * Add `sameSite` option + - Replaces `firstPartyOnly` option, never implemented by browsers + * Improve error message when `encode` is not a function + * Improve error message when `expires` is not a `Date` + +0.2.4 / 2016-05-20 +================== + + * perf: enable strict mode + * perf: use for loop in parse + * perf: use string concatenation for serialization + +0.2.3 / 2015-10-25 +================== + + * Fix cookie `Max-Age` to never be a floating point number + +0.2.2 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.2.1 / 2015-09-17 +================== + + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.2.0 / 2015-08-13 +================== + + * Add `firstPartyOnly` option + * Throw better error for invalid argument to parse + * perf: hoist regular expression + +0.1.5 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.1.4 / 2015-09-17 +================== + + * Throw better error for invalid argument to parse + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.1.3 / 2015-05-19 +================== + + * Reduce the scope of try-catch deopt + * Remove argument reassignments + +0.1.2 / 2014-04-16 +================== + + * Remove unnecessary files from npm package + +0.1.1 / 2014-02-23 +================== + + * Fix bad parse when cookie value contained a comma + * Fix support for `maxAge` of `0` + +0.1.0 / 2013-05-01 +================== + + * Add `decode` option + * Add `encode` option + +0.0.6 / 2013-04-08 +================== + + * Ignore cookie parts missing `=` + +0.0.5 / 2012-10-29 +================== + + * Return raw cookie value if value unescape errors + +0.0.4 / 2012-06-21 +================== + + * Use encode/decodeURIComponent for cookie encoding/decoding + - Improve server/client interoperability + +0.0.3 / 2012-06-06 +================== + + * Only escape special characters per the cookie RFC + +0.0.2 / 2012-06-01 +================== + + * Fix `maxAge` option to not throw error + +0.0.1 / 2012-05-28 +================== + + * Add more tests + +0.0.0 / 2012-05-28 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/cookie/LICENSE b/graphql-subscription-express/node_modules/cookie/LICENSE new file mode 100644 index 0000000..058b6b4 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Roman Shtylman +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/graphql-subscription-express/node_modules/cookie/README.md b/graphql-subscription-express/node_modules/cookie/README.md new file mode 100644 index 0000000..71fdac1 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie/README.md @@ -0,0 +1,317 @@ +# cookie + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install cookie +``` + +## API + +```js +var cookie = require('cookie'); +``` + +### cookie.parse(str, options) + +Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +`cookie.parse` accepts these properties in the options object. + +##### decode + +Specifies a function that will be used to decode a cookie's value. Since the value of a cookie +has a limited character set (and must be a simple string), this function can be used to decode +a previously-encoded cookie value into a JavaScript string or other object. + +The default function is the global `decodeURIComponent`, which will decode any URL-encoded +sequences into their byte representations. + +**note** if an error is thrown from this function, the original, non-decoded cookie value will +be returned as the cookie's value. + +### cookie.serialize(name, value, options) + +Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the +name for the cookie, the `value` argument is the value to set the cookie to, and the `options` +argument is an optional object containing additional serialization options. + +```js +var setCookie = cookie.serialize('foo', 'bar'); +// foo=bar +``` + +#### Options + +`cookie.serialize` accepts these properties in the options object. + +##### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no +domain is set, and most clients will consider the cookie to apply to only the current domain. + +##### encode + +Specifies a function that will be used to encode a cookie's value. Since value of a cookie +has a limited character set (and must be a simple string), this function can be used to encode +a value into a string suited for a cookie's value. + +The default function is the global `encodeURIComponent`, which will encode a JavaScript string +into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. + +##### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1]. +By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and +will delete it on a condition like exiting a web browser application. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### httpOnly + +Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy, +the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not allow client-side +JavaScript to see the cookie in `document.cookie`. + +##### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2]. +The given number will be converted to an integer by rounding down. By default, no maximum age is set. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### partitioned + +Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies) +attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the +`Partitioned` attribute is not set. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +More information about can be found in [the proposal](https://github.com/privacycg/CHIPS). + +##### path + +Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path +is considered the ["default path"][rfc-6265-5.1.4]. + +##### priority + +Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1]. + + - `'low'` will set the `Priority` attribute to `Low`. + - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. + - `'high'` will set the `Priority` attribute to `High`. + +More information about the different priority levels can be found in +[the specification][rfc-west-cookie-priority-00-4.1]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### sameSite + +Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-09-5.4.7]. + + - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + - `false` will not set the `SameSite` attribute. + - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. + - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about the different enforcement levels can be found in +[the specification][rfc-6265bis-09-5.4.7]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### secure + +Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy, +the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to +the server in the future if the browser does not have an HTTPS connection. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require('cookie'); +var escapeHtml = require('escape-html'); +var http = require('http'); +var url = require('url'); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { + httpOnly: true, + maxAge: 60 * 60 * 24 * 7 // 1 week + })); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader('Location', req.headers.referer || '/'); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parse(req.headers.cookie || ''); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader('Content-Type', 'text/html; charset=UTF-8'); + + if (name) { + res.write('

Welcome back, ' + escapeHtml(name) + '!

'); + } else { + res.write('

Hello, new visitor!

'); + } + + res.write('
'); + res.write(' '); + res.end('
'); +} + +http.createServer(onRequest).listen(3000); +``` + +## Testing + +```sh +$ npm test +``` + +## Benchmark + +``` +$ npm run bench + +> cookie@0.5.0 bench +> node benchmark/index.js + + node@18.18.2 + acorn@8.10.0 + ada@2.6.0 + ares@1.19.1 + brotli@1.0.9 + cldr@43.1 + icu@73.2 + llhttp@6.0.11 + modules@108 + napi@9 + nghttp2@1.57.0 + nghttp3@0.7.0 + ngtcp2@0.8.1 + openssl@3.0.10+quic + simdutf@3.2.14 + tz@2023c + undici@5.26.3 + unicode@15.0 + uv@1.44.2 + uvwasi@0.0.18 + v8@10.2.154.26-node.26 + zlib@1.2.13.1-motley + +> node benchmark/parse-top.js + + cookie.parse - top sites + + 14 tests completed. + + parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled) + parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled) + parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled) + parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled) + parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled) + parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled) + parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled) + parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled) + parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled) + parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled) + parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled) + parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled) + parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled) + parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled) + +> node benchmark/parse.js + + cookie.parse - generic + + 6 tests completed. + + simple x 3,214,032 ops/sec ±1.61% (183 runs sampled) + decode x 587,237 ops/sec ±1.16% (187 runs sampled) + unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled) + duplicates x 857,008 ops/sec ±0.89% (187 runs sampled) + 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled) + 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled) +``` + +## References + +- [RFC 6265: HTTP State Management Mechanism][rfc-6265] +- [Same-site Cookies][rfc-6265bis-09-5.4.7] + +[rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/ +[rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1 +[rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7 +[rfc-6265]: https://tools.ietf.org/html/rfc6265 +[rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4 +[rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1 +[rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2 +[rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3 +[rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4 +[rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5 +[rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6 +[rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3 + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci +[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master +[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master +[node-image]: https://badgen.net/npm/node/cookie +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/cookie +[npm-url]: https://npmjs.org/package/cookie +[npm-version-image]: https://badgen.net/npm/v/cookie diff --git a/graphql-subscription-express/node_modules/cookie/SECURITY.md b/graphql-subscription-express/node_modules/cookie/SECURITY.md new file mode 100644 index 0000000..fd4a6c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policies and Procedures + +## Reporting a Bug + +The `cookie` team and community take all security bugs seriously. Thank +you for improving the security of the project. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your +contributions. + +Report security bugs by emailing the current owner(s) of `cookie`. This +information can be found in the npm registry using the command +`npm owner ls cookie`. +If unsure or unable to get the information from the above, open an issue +in the [project issue tracker](https://github.com/jshttp/cookie/issues) +asking for the current contact information. + +To ensure the timely response to your report, please ensure that the entirety +of the report is contained within the email body and not solely behind a web +link or an attachment. + +At least one owner will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the owners will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. diff --git a/graphql-subscription-express/node_modules/cookie/index.js b/graphql-subscription-express/node_modules/cookie/index.js new file mode 100644 index 0000000..03d4c38 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie/index.js @@ -0,0 +1,274 @@ +/*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +exports.parse = parse; +exports.serialize = serialize; + +/** + * Module variables. + * @private + */ + +var __toString = Object.prototype.toString + +/** + * RegExp to match field-content in RFC 7230 sec 3.2 + * + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * obs-text = %x80-FF + */ + +var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; + +/** + * Parse a cookie header. + * + * Parse the given cookie header string into an object + * The object has the various cookies as keys(names) => values + * + * @param {string} str + * @param {object} [options] + * @return {object} + * @public + */ + +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + + var obj = {} + var opt = options || {}; + var dec = opt.decode || decode; + + var index = 0 + while (index < str.length) { + var eqIdx = str.indexOf('=', index) + + // no more cookie pairs + if (eqIdx === -1) { + break + } + + var endIdx = str.indexOf(';', index) + + if (endIdx === -1) { + endIdx = str.length + } else if (endIdx < eqIdx) { + // backtrack on prior semicolon + index = str.lastIndexOf(';', eqIdx - 1) + 1 + continue + } + + var key = str.slice(index, eqIdx).trim() + + // only assign once + if (undefined === obj[key]) { + var val = str.slice(eqIdx + 1, endIdx).trim() + + // quoted values + if (val.charCodeAt(0) === 0x22) { + val = val.slice(1, -1) + } + + obj[key] = tryDecode(val, dec); + } + + index = endIdx + 1 + } + + return obj; +} + +/** + * Serialize data into a cookie header. + * + * Serialize the a name value pair into a cookie string suitable for + * http headers. An optional options object specified cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + * + * @param {string} name + * @param {string} val + * @param {object} [options] + * @return {string} + * @public + */ + +function serialize(name, val, options) { + var opt = options || {}; + var enc = opt.encode || encode; + + if (typeof enc !== 'function') { + throw new TypeError('option encode is invalid'); + } + + if (!fieldContentRegExp.test(name)) { + throw new TypeError('argument name is invalid'); + } + + var value = enc(val); + + if (value && !fieldContentRegExp.test(value)) { + throw new TypeError('argument val is invalid'); + } + + var str = name + '=' + value; + + if (null != opt.maxAge) { + var maxAge = opt.maxAge - 0; + + if (isNaN(maxAge) || !isFinite(maxAge)) { + throw new TypeError('option maxAge is invalid') + } + + str += '; Max-Age=' + Math.floor(maxAge); + } + + if (opt.domain) { + if (!fieldContentRegExp.test(opt.domain)) { + throw new TypeError('option domain is invalid'); + } + + str += '; Domain=' + opt.domain; + } + + if (opt.path) { + if (!fieldContentRegExp.test(opt.path)) { + throw new TypeError('option path is invalid'); + } + + str += '; Path=' + opt.path; + } + + if (opt.expires) { + var expires = opt.expires + + if (!isDate(expires) || isNaN(expires.valueOf())) { + throw new TypeError('option expires is invalid'); + } + + str += '; Expires=' + expires.toUTCString() + } + + if (opt.httpOnly) { + str += '; HttpOnly'; + } + + if (opt.secure) { + str += '; Secure'; + } + + if (opt.partitioned) { + str += '; Partitioned' + } + + if (opt.priority) { + var priority = typeof opt.priority === 'string' + ? opt.priority.toLowerCase() + : opt.priority + + switch (priority) { + case 'low': + str += '; Priority=Low' + break + case 'medium': + str += '; Priority=Medium' + break + case 'high': + str += '; Priority=High' + break + default: + throw new TypeError('option priority is invalid') + } + } + + if (opt.sameSite) { + var sameSite = typeof opt.sameSite === 'string' + ? opt.sameSite.toLowerCase() : opt.sameSite; + + switch (sameSite) { + case true: + str += '; SameSite=Strict'; + break; + case 'lax': + str += '; SameSite=Lax'; + break; + case 'strict': + str += '; SameSite=Strict'; + break; + case 'none': + str += '; SameSite=None'; + break; + default: + throw new TypeError('option sameSite is invalid'); + } + } + + return str; +} + +/** + * URL-decode string value. Optimized to skip native call when no %. + * + * @param {string} str + * @returns {string} + */ + +function decode (str) { + return str.indexOf('%') !== -1 + ? decodeURIComponent(str) + : str +} + +/** + * URL-encode value. + * + * @param {string} val + * @returns {string} + */ + +function encode (val) { + return encodeURIComponent(val) +} + +/** + * Determine if value is a Date. + * + * @param {*} val + * @private + */ + +function isDate (val) { + return __toString.call(val) === '[object Date]' || + val instanceof Date +} + +/** + * Try decoding a string using a decoding function. + * + * @param {string} str + * @param {function} decode + * @private + */ + +function tryDecode(str, decode) { + try { + return decode(str); + } catch (e) { + return str; + } +} diff --git a/graphql-subscription-express/node_modules/cookie/package.json b/graphql-subscription-express/node_modules/cookie/package.json new file mode 100644 index 0000000..0c3f006 --- /dev/null +++ b/graphql-subscription-express/node_modules/cookie/package.json @@ -0,0 +1,44 @@ +{ + "name": "cookie", + "description": "HTTP server cookie parsing and serialization", + "version": "0.6.0", + "author": "Roman Shtylman ", + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "keywords": [ + "cookie", + "cookies" + ], + "repository": "jshttp/cookie", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "8.53.0", + "eslint-plugin-markdown": "3.0.1", + "mocha": "10.2.0", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "top-sites": "1.1.194" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "SECURITY.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "update-bench": "node scripts/update-benchmark.js", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/graphql-subscription-express/node_modules/debug/.coveralls.yml b/graphql-subscription-express/node_modules/debug/.coveralls.yml new file mode 100644 index 0000000..20a7068 --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/.coveralls.yml @@ -0,0 +1 @@ +repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve diff --git a/graphql-subscription-express/node_modules/debug/.eslintrc b/graphql-subscription-express/node_modules/debug/.eslintrc new file mode 100644 index 0000000..8a37ae2 --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/.eslintrc @@ -0,0 +1,11 @@ +{ + "env": { + "browser": true, + "node": true + }, + "rules": { + "no-console": 0, + "no-empty": [1, { "allowEmptyCatch": true }] + }, + "extends": "eslint:recommended" +} diff --git a/graphql-subscription-express/node_modules/debug/.npmignore b/graphql-subscription-express/node_modules/debug/.npmignore new file mode 100644 index 0000000..5f60eec --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/.npmignore @@ -0,0 +1,9 @@ +support +test +examples +example +*.sock +dist +yarn.lock +coverage +bower.json diff --git a/graphql-subscription-express/node_modules/debug/.travis.yml b/graphql-subscription-express/node_modules/debug/.travis.yml new file mode 100644 index 0000000..6c6090c --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/.travis.yml @@ -0,0 +1,14 @@ + +language: node_js +node_js: + - "6" + - "5" + - "4" + +install: + - make node_modules + +script: + - make lint + - make test + - make coveralls diff --git a/graphql-subscription-express/node_modules/debug/CHANGELOG.md b/graphql-subscription-express/node_modules/debug/CHANGELOG.md new file mode 100644 index 0000000..eadaa18 --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/CHANGELOG.md @@ -0,0 +1,362 @@ + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/debug/LICENSE b/graphql-subscription-express/node_modules/debug/LICENSE new file mode 100644 index 0000000..658c933 --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/graphql-subscription-express/node_modules/debug/Makefile b/graphql-subscription-express/node_modules/debug/Makefile new file mode 100644 index 0000000..584da8b --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/Makefile @@ -0,0 +1,50 @@ +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# Path +PATH := node_modules/.bin:$(PATH) +SHELL := /bin/bash + +# applications +NODE ?= $(shell which node) +YARN ?= $(shell which yarn) +PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm)) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +.FORCE: + +install: node_modules + +node_modules: package.json + @NODE_ENV= $(PKG) install + @touch node_modules + +lint: .FORCE + eslint browser.js debug.js index.js node.js + +test-node: .FORCE + istanbul cover node_modules/mocha/bin/_mocha -- test/**.js + +test-browser: .FORCE + mkdir -p dist + + @$(BROWSERIFY) \ + --standalone debug \ + . > dist/debug.js + + karma start --single-run + rimraf dist + +test: .FORCE + concurrently \ + "make test-node" \ + "make test-browser" + +coveralls: + cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + +.PHONY: all install clean distclean diff --git a/graphql-subscription-express/node_modules/debug/README.md b/graphql-subscription-express/node_modules/debug/README.md new file mode 100644 index 0000000..f67be6b --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/README.md @@ -0,0 +1,312 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny node.js debugging utility modelled after node core's debugging technique. + +**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)** + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + + Note that PowerShell uses different syntax to set environment variables. + + ```cmd + $env:DEBUG = "*,-not_this" + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Environment Variables + + When running through Node.js, you can set a few environment variables that will + change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + + __Note:__ The environment variables beginning with `DEBUG_` end up being + converted into an Options object that gets used with `%o`/`%O` formatters. + See the Node.js documentation for + [`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) + for the complete list. + +## Formatters + + + Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + +### Custom formatters + + You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + +## Browser support + You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), + or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), + if you don't want to build it yourself. + + Debug's enable state is currently persisted by `localStorage`. + Consider the situation shown below where you have `worker:a` and `worker:b`, + and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/debug/component.json b/graphql-subscription-express/node_modules/debug/component.json new file mode 100644 index 0000000..9de2641 --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.6.9", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "src/browser.js", + "scripts": [ + "src/browser.js", + "src/debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/graphql-subscription-express/node_modules/debug/karma.conf.js b/graphql-subscription-express/node_modules/debug/karma.conf.js new file mode 100644 index 0000000..103a82d --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/karma.conf.js @@ -0,0 +1,70 @@ +// Karma configuration +// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['mocha', 'chai', 'sinon'], + + + // list of files / patterns to load in the browser + files: [ + 'dist/debug.js', + 'test/*spec.js' + ], + + + // list of files to exclude + exclude: [ + 'src/node.js' + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/graphql-subscription-express/node_modules/debug/node.js b/graphql-subscription-express/node_modules/debug/node.js new file mode 100644 index 0000000..7fc36fe --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/graphql-subscription-express/node_modules/debug/package.json b/graphql-subscription-express/node_modules/debug/package.json new file mode 100644 index 0000000..dc787ba --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/package.json @@ -0,0 +1,49 @@ +{ + "name": "debug", + "version": "2.6.9", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": "TJ Holowaychuk ", + "contributors": [ + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + }, + "devDependencies": { + "browserify": "9.0.3", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^2.11.15", + "eslint": "^3.12.1", + "istanbul": "^0.4.5", + "karma": "^1.3.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-sinon": "^1.0.5", + "mocha": "^3.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "sinon": "^1.17.6", + "sinon-chai": "^2.8.0" + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + } +} diff --git a/graphql-subscription-express/node_modules/debug/src/browser.js b/graphql-subscription-express/node_modules/debug/src/browser.js new file mode 100644 index 0000000..7106924 --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/src/browser.js @@ -0,0 +1,185 @@ +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { + return true; + } + + // is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return; + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit') + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + return window.localStorage; + } catch (e) {} +} diff --git a/graphql-subscription-express/node_modules/debug/src/debug.js b/graphql-subscription-express/node_modules/debug/src/debug.js new file mode 100644 index 0000000..6a5e3fc --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/src/debug.js @@ -0,0 +1,202 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + +exports.formatters = {}; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * @param {String} namespace + * @return {Number} + * @api private + */ + +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function createDebug(namespace) { + + function debug() { + // disabled? + if (!debug.enabled) return; + + var self = debug; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %O + args.unshift('%O'); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); + + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } + + return debug; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + exports.names = []; + exports.skips = []; + + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/graphql-subscription-express/node_modules/debug/src/index.js b/graphql-subscription-express/node_modules/debug/src/index.js new file mode 100644 index 0000000..e12cf4d --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer process, which is node, but we should + * treat as a browser. + */ + +if (typeof process !== 'undefined' && process.type === 'renderer') { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/graphql-subscription-express/node_modules/debug/src/inspector-log.js b/graphql-subscription-express/node_modules/debug/src/inspector-log.js new file mode 100644 index 0000000..60ea6c0 --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/src/inspector-log.js @@ -0,0 +1,15 @@ +module.exports = inspectorLog; + +// black hole +const nullStream = new (require('stream').Writable)(); +nullStream._write = () => {}; + +/** + * Outputs a `console.log()` to the Node.js Inspector console *only*. + */ +function inspectorLog() { + const stdout = console._stdout; + console._stdout = nullStream; + console.log.apply(console, arguments); + console._stdout = stdout; +} diff --git a/graphql-subscription-express/node_modules/debug/src/node.js b/graphql-subscription-express/node_modules/debug/src/node.js new file mode 100644 index 0000000..b15109c --- /dev/null +++ b/graphql-subscription-express/node_modules/debug/src/node.js @@ -0,0 +1,248 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // camel-case + var prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + + // coerce string value into JS value + var val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) val = true; + else if (/^(no|off|false|disabled)$/i.test(val)) val = false; + else if (val === 'null') val = null; + else val = Number(val); + + obj[prop] = val; + return obj; +}, {}); + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; + +if (1 !== fd && 2 !== fd) { + util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')() +} + +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts + ? Boolean(exports.inspectOpts.colors) + : tty.isatty(fd); +} + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +exports.formatters.o = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n').map(function(str) { + return str.trim() + }).join(' '); +}; + +/** + * Map %o to `util.inspect()`, allowing multiple lines if needed. + */ + +exports.formatters.O = function(v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + var name = this.namespace; + var useColors = this.useColors; + + if (useColors) { + var c = this.color; + var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m'; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } +} + +/** + * Invokes `util.format()` with the specified arguments and writes to `stream`. + */ + +function log() { + return stream.write(util.format.apply(util, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init (debug) { + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/graphql-subscription-express/node_modules/define-data-property/.eslintrc b/graphql-subscription-express/node_modules/define-data-property/.eslintrc new file mode 100644 index 0000000..75443e8 --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": 0, + "id-length": 0, + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": "off", + }, + }, + ], +} diff --git a/graphql-subscription-express/node_modules/define-data-property/.github/FUNDING.yml b/graphql-subscription-express/node_modules/define-data-property/.github/FUNDING.yml new file mode 100644 index 0000000..3e17725 --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/define-data-property +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/define-data-property/.nycrc b/graphql-subscription-express/node_modules/define-data-property/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/define-data-property/CHANGELOG.md b/graphql-subscription-express/node_modules/define-data-property/CHANGELOG.md new file mode 100644 index 0000000..4eed75e --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.4](https://github.com/ljharb/define-data-property/compare/v1.1.3...v1.1.4) - 2024-02-13 + +### Commits + +- [Refactor] use `es-define-property` [`90f2f4c`](https://github.com/ljharb/define-data-property/commit/90f2f4cc20298401e71c28e1e08888db12021453) +- [Dev Deps] update `@types/object.getownpropertydescriptors` [`cd929d9`](https://github.com/ljharb/define-data-property/commit/cd929d9a04f5f2fdcfa9d5be140940b91a083153) + +## [v1.1.3](https://github.com/ljharb/define-data-property/compare/v1.1.2...v1.1.3) - 2024-02-12 + +### Commits + +- [types] hand-write d.ts instead of emitting it [`0cbc988`](https://github.com/ljharb/define-data-property/commit/0cbc988203c105f2d97948327c7167ebd33bd318) +- [meta] simplify `exports` [`690781e`](https://github.com/ljharb/define-data-property/commit/690781eed28bbf2d6766237efda0ba6dd591609e) +- [Dev Deps] update `hasown`; clean up DT packages [`6cdfd1c`](https://github.com/ljharb/define-data-property/commit/6cdfd1cb2d91d791bfd18cda5d5cab232fd5d8fc) +- [actions] cleanup [`3142bc6`](https://github.com/ljharb/define-data-property/commit/3142bc6a4bc406a51f5b04f31e98562a27f35ffd) +- [meta] add `funding` [`8474423`](https://github.com/ljharb/define-data-property/commit/847442391a79779af3e0f1bf0b5bb923552b7804) +- [Deps] update `get-intrinsic` [`3e9be00`](https://github.com/ljharb/define-data-property/commit/3e9be00e07784ba34e7c77d8bc0fdbc832ad61de) + +## [v1.1.2](https://github.com/ljharb/define-data-property/compare/v1.1.1...v1.1.2) - 2024-02-05 + +### Commits + +- [Dev Deps] update @types packages, `object-inspect`, `tape`, `typescript` [`df41bf8`](https://github.com/ljharb/define-data-property/commit/df41bf84ca3456be6226055caab44e38e3a7fd2f) +- [Dev Deps] update DT packages, `aud`, `npmignore`, `tape`, typescript` [`fab0e4e`](https://github.com/ljharb/define-data-property/commit/fab0e4ec709ee02b79f42d6db3ee5f26e0a34b8a) +- [Dev Deps] use `hasown` instead of `has` [`aa51ef9`](https://github.com/ljharb/define-data-property/commit/aa51ef93f6403d49d9bb72a807bcdb6e418978c0) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`d89be50`](https://github.com/ljharb/define-data-property/commit/d89be50571175888d391238605122679f7e65ffc) +- [Deps] update `has-property-descriptors` [`7af887c`](https://github.com/ljharb/define-data-property/commit/7af887c9083b59b195b0079e04815cfed9fcee2b) +- [Deps] update `get-intrinsic` [`bb8728e`](https://github.com/ljharb/define-data-property/commit/bb8728ec42cd998505a7157ae24853a560c20646) + +## [v1.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12 + +### Commits + +- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94) +- [Dev Deps] update `@types/es-value-fixtures`, `@types/for-each`, `@types/gopd`, `@types/has-property-descriptors`, `tape`, `typescript` [`7d82dfc`](https://github.com/ljharb/define-data-property/commit/7d82dfc20f778b4465bba06335dd53f6f431aea3) +- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548) +- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0) +- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142) + +## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13 + +### Commits + +- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72) +- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792) + +## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12 + +### Commits + +- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69) +- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7) +- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee) + +## v1.0.0 - 2023-09-12 + +### Commits + +- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196) +- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d) +- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed) +- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e) +- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375) diff --git a/graphql-subscription-express/node_modules/define-data-property/LICENSE b/graphql-subscription-express/node_modules/define-data-property/LICENSE new file mode 100644 index 0000000..b4213ac --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/define-data-property/README.md b/graphql-subscription-express/node_modules/define-data-property/README.md new file mode 100644 index 0000000..f2304da --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/README.md @@ -0,0 +1,67 @@ +# define-data-property [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Define a data property on an object. Will fall back to assignment in an engine without descriptors. + +The three `non*` argument can also be passed `null`, which will use the existing state if available. + +The `loose` argument will mean that if you attempt to set a non-normal data property, in an environment without descriptor support, it will fall back to normal assignment. + +## Usage + +```javascript +var defineDataProperty = require('define-data-property'); +var assert = require('assert'); + +var obj = {}; +defineDataProperty(obj, 'key', 'value'); +defineDataProperty( + obj, + 'key2', + 'value', + true, // nonEnumerable, optional + false, // nonWritable, optional + true, // nonConfigurable, optional + false // loose, optional +); + +assert.deepEqual( + Object.getOwnPropertyDescriptors(obj), + { + key: { + configurable: true, + enumerable: true, + value: 'value', + writable: true, + }, + key2: { + configurable: false, + enumerable: false, + value: 'value', + writable: true, + }, + } +); +``` + +[package-url]: https://npmjs.org/package/define-data-property +[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg +[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg +[deps-url]: https://david-dm.org/ljharb/define-data-property +[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/define-data-property.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg +[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property +[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property +[actions-url]: https://github.com/ljharb/define-data-property/actions diff --git a/graphql-subscription-express/node_modules/define-data-property/index.d.ts b/graphql-subscription-express/node_modules/define-data-property/index.d.ts new file mode 100644 index 0000000..b56a77d --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/index.d.ts @@ -0,0 +1,12 @@ + +declare function defineDataProperty( + obj: Record, + property: keyof typeof obj, + value: typeof obj[typeof property], + nonEnumerable?: boolean | null, + nonWritable?: boolean | null, + nonConfigurable?: boolean | null, + loose?: boolean +): void; + +export = defineDataProperty; \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/define-data-property/index.js b/graphql-subscription-express/node_modules/define-data-property/index.js new file mode 100644 index 0000000..e1a38c0 --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/index.js @@ -0,0 +1,56 @@ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); + +var gopd = require('gopd'); + +/** @type {import('.')} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } + + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; diff --git a/graphql-subscription-express/node_modules/define-data-property/package.json b/graphql-subscription-express/node_modules/define-data-property/package.json new file mode 100644 index 0000000..eec4097 --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/package.json @@ -0,0 +1,106 @@ +{ + "name": "define-data-property", + "version": "1.1.4", + "description": "Define a data property on an object. Will fall back to assignment in an engine without descriptors.", + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/define-data-property.git" + }, + "keywords": [ + "define", + "data", + "property", + "object", + "accessor", + "javascript", + "ecmascript", + "enumerable", + "configurable", + "writable" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/define-data-property/issues" + }, + "homepage": "https://github.com/ljharb/define-data-property#readme", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/get-intrinsic": "^1.2.2", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/object.getownpropertydescriptors": "^2.1.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "hasown": "^2.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "object.getownpropertydescriptors": "^2.1.7", + "reflect.ownkeys": "^1.1.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "types/reflect.ownkeys" + ] + } +} diff --git a/graphql-subscription-express/node_modules/define-data-property/test/index.js b/graphql-subscription-express/node_modules/define-data-property/test/index.js new file mode 100644 index 0000000..68204c6 --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/test/index.js @@ -0,0 +1,392 @@ +'use strict'; + +var test = require('tape'); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var hasOwn = require('hasown'); +var hasPropertyDescriptors = require('has-property-descriptors')(); +var getOwnPropertyDescriptors = require('object.getownpropertydescriptors'); +var ownKeys = require('reflect.ownkeys'); + +var defineDataProperty = require('../'); + +test('defineDataProperty', function (t) { + t.test('argument validation', function (st) { + forEach(v.primitives, function (nonObject) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty(nonObject, 'key', 'value'); }, + TypeError, + 'throws on non-object input: ' + inspect(nonObject) + ); + }); + + forEach(v.nonPropertyKeys, function (nonPropertyKey) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, nonPropertyKey, 'value'); }, + TypeError, + 'throws on non-PropertyKey input: ' + inspect(nonPropertyKey) + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + if (nonBoolean !== null) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', nonBoolean); }, + TypeError, + 'throws on non-boolean nonEnumerable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonWritable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonConfigurable: ' + inspect(nonBoolean) + ); + } + }); + + st.end(); + }); + + t.test('normal data property', function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + st.ok(hasOwn(obj, 'existing'), 'has initial own property'); + st.equal(obj.existing, 'existing property', 'has expected initial value'); + + var res = defineDataProperty(obj, 'added', 'added property'); + st.equal(res, void undefined, 'returns `undefined`'); + st.ok(hasOwn(obj, 'added'), 'has expected own property'); + st.equal(obj.added, 'added property', 'has expected value'); + + defineDataProperty(obj, 'existing', 'new value'); + st.ok(hasOwn(obj, 'existing'), 'still has expected own property'); + st.equal(obj.existing, 'new value', 'has new expected value'); + + defineDataProperty(obj, 'explicit1', 'new value', false); + st.ok(hasOwn(obj, 'explicit1'), 'has expected own property (explicit enumerable)'); + st.equal(obj.explicit1, 'new value', 'has new expected value (explicit enumerable)'); + + defineDataProperty(obj, 'explicit2', 'new value', false, false); + st.ok(hasOwn(obj, 'explicit2'), 'has expected own property (explicit writable)'); + st.equal(obj.explicit2, 'new value', 'has new expected value (explicit writable)'); + + defineDataProperty(obj, 'explicit3', 'new value', false, false, false); + st.ok(hasOwn(obj, 'explicit3'), 'has expected own property (explicit configurable)'); + st.equal(obj.explicit3, 'new value', 'has new expected value (explicit configurable)'); + + st.end(); + }); + + t.test('loose mode', { skip: !hasPropertyDescriptors }, function (st) { + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'added', 'added value 1', true, null, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: !hasPropertyDescriptors, + value: 'added value 1', + writable: true + } + }, + 'in loose mode, obj still adds property 1' + ); + + defineDataProperty(obj, 'added', 'added value 2', false, true, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: true, + value: 'added value 2', + writable: !hasPropertyDescriptors + } + }, + 'in loose mode, obj still adds property 2' + ); + + defineDataProperty(obj, 'added', 'added value 3', false, false, true, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: !hasPropertyDescriptors, + enumerable: true, + value: 'added value 3', + writable: true + } + }, + 'in loose mode, obj still adds property 3' + ); + + st.end(); + }); + + t.test('non-normal data property, ES3', { skip: hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', true); }, + SyntaxError, + 'nonEnumerable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st.deepEqual( + ownKeys(obj), + ['existing'], + 'obj still has expected keys' + ); + st.equal(obj.existing, 'existing property', 'obj still has expected values'); + + st.end(); + }); + + t.test('new non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'nonEnum', null, true); + defineDataProperty(obj, 'nonWrit', null, false, true); + defineDataProperty(obj, 'nonConf', null, false, false, true); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj has expected property descriptors' + ); + + st.end(); + }); + + t.test('existing non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + // test case changing an existing non-normal property + + /** @type {Record} */ + var obj = {}; + Object.defineProperty(obj, 'nonEnum', { configurable: true, enumerable: false, value: null, writable: true }); + Object.defineProperty(obj, 'nonWrit', { configurable: true, enumerable: true, value: null, writable: false }); + Object.defineProperty(obj, 'nonConf', { configurable: false, enumerable: true, value: null, writable: true }); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj initially has expected property descriptors' + ); + + defineDataProperty(obj, 'nonEnum', 'new value', false); + defineDataProperty(obj, 'nonWrit', 'new value', false, false); + st['throws']( + function () { defineDataProperty(obj, 'nonConf', 'new value', false, false, false); }, + TypeError, + 'can not alter a nonconfigurable property' + ); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj ends up with expected property descriptors' + ); + + st.end(); + }); + + t.test('frozen object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var frozen = Object.freeze({ existing: true }); + + st['throws']( + function () { defineDataProperty(frozen, 'existing', 'new value'); }, + TypeError, + 'frozen object can not modify an existing property' + ); + + st['throws']( + function () { defineDataProperty(frozen, 'new', 'new property'); }, + TypeError, + 'frozen object can not add a new property' + ); + + st.end(); + }); + + t.test('sealed object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var sealed = Object.seal({ existing: true }); + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: true, + writable: true + }, + 'existing value on sealed object has expected descriptor' + ); + + defineDataProperty(sealed, 'existing', 'new value'); + + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: 'new value', + writable: true + }, + 'existing value on sealed object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(sealed, 'new', 'new property'); }, + TypeError, + 'sealed object can not add a new property' + ); + + st.end(); + }); + + t.test('nonextensible object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var nonExt = Object.preventExtensions({ existing: true }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: true, + value: true, + writable: true + }, + 'existing value on non-extensible object has expected descriptor' + ); + + defineDataProperty(nonExt, 'existing', 'new value', true); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: false, + value: 'new value', + writable: true + }, + 'existing value on non-extensible object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(nonExt, 'new', 'new property'); }, + TypeError, + 'non-extensible object can not add a new property' + ); + + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/define-data-property/tsconfig.json b/graphql-subscription-express/node_modules/define-data-property/tsconfig.json new file mode 100644 index 0000000..69f060d --- /dev/null +++ b/graphql-subscription-express/node_modules/define-data-property/tsconfig.json @@ -0,0 +1,59 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/graphql-subscription-express/node_modules/depd/History.md b/graphql-subscription-express/node_modules/depd/History.md new file mode 100644 index 0000000..cd9ebaa --- /dev/null +++ b/graphql-subscription-express/node_modules/depd/History.md @@ -0,0 +1,103 @@ +2.0.0 / 2018-10-26 +================== + + * Drop support for Node.js 0.6 + * Replace internal `eval` usage with `Function` constructor + * Use instance methods on `process` to check for listeners + +1.1.2 / 2018-01-11 +================== + + * perf: remove argument reassignment + * Support Node.js 0.6 to 9.x + +1.1.1 / 2017-07-27 +================== + + * Remove unnecessary `Buffer` loading + * Support Node.js 0.6 to 8.x + +1.1.0 / 2015-09-14 +================== + + * Enable strict mode in more places + * Support io.js 3.x + * Support io.js 2.x + * Support web browser loading + - Requires bundler like Browserify or webpack + +1.0.1 / 2015-04-07 +================== + + * Fix `TypeError`s when under `'use strict'` code + * Fix useless type name on auto-generated messages + * Support io.js 1.x + * Support Node.js 0.12 + +1.0.0 / 2014-09-17 +================== + + * No changes + +0.4.5 / 2014-09-09 +================== + + * Improve call speed to functions using the function wrapper + * Support Node.js 0.6 + +0.4.4 / 2014-07-27 +================== + + * Work-around v8 generating empty stack traces + +0.4.3 / 2014-07-26 +================== + + * Fix exception when global `Error.stackTraceLimit` is too low + +0.4.2 / 2014-07-19 +================== + + * Correct call site for wrapped functions and properties + +0.4.1 / 2014-07-19 +================== + + * Improve automatic message generation for function properties + +0.4.0 / 2014-07-19 +================== + + * Add `TRACE_DEPRECATION` environment variable + * Remove non-standard grey color from color output + * Support `--no-deprecation` argument + * Support `--trace-deprecation` argument + * Support `deprecate.property(fn, prop, message)` + +0.3.0 / 2014-06-16 +================== + + * Add `NO_DEPRECATION` environment variable + +0.2.0 / 2014-06-15 +================== + + * Add `deprecate.property(obj, prop, message)` + * Remove `supports-color` dependency for node.js 0.8 + +0.1.0 / 2014-06-15 +================== + + * Add `deprecate.function(fn, message)` + * Add `process.on('deprecation', fn)` emitter + * Automatically generate message when omitted from `deprecate()` + +0.0.1 / 2014-06-15 +================== + + * Fix warning for dynamic calls at singe call site + +0.0.0 / 2014-06-15 +================== + + * Initial implementation diff --git a/graphql-subscription-express/node_modules/depd/LICENSE b/graphql-subscription-express/node_modules/depd/LICENSE new file mode 100644 index 0000000..248de7a --- /dev/null +++ b/graphql-subscription-express/node_modules/depd/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2018 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/depd/Readme.md b/graphql-subscription-express/node_modules/depd/Readme.md new file mode 100644 index 0000000..043d1ca --- /dev/null +++ b/graphql-subscription-express/node_modules/depd/Readme.md @@ -0,0 +1,280 @@ +# depd + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Linux Build][travis-image]][travis-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Deprecate all the things + +> With great modules comes great responsibility; mark things deprecated! + +## Install + +This module is installed directly using `npm`: + +```sh +$ npm install depd +``` + +This module can also be bundled with systems like +[Browserify](http://browserify.org/) or [webpack](https://webpack.github.io/), +though by default this module will alter it's API to no longer display or +track deprecations. + +## API + + + +```js +var deprecate = require('depd')('my-module') +``` + +This library allows you to display deprecation messages to your users. +This library goes above and beyond with deprecation warnings by +introspection of the call stack (but only the bits that it is interested +in). + +Instead of just warning on the first invocation of a deprecated +function and never again, this module will warn on the first invocation +of a deprecated function per unique call site, making it ideal to alert +users of all deprecated uses across the code base, rather than just +whatever happens to execute first. + +The deprecation warnings from this module also include the file and line +information for the call into the module that the deprecated function was +in. + +**NOTE** this library has a similar interface to the `debug` module, and +this module uses the calling file to get the boundary for the call stacks, +so you should always create a new `deprecate` object in each file and not +within some central file. + +### depd(namespace) + +Create a new deprecate function that uses the given namespace name in the +messages and will display the call site prior to the stack entering the +file this function was called from. It is highly suggested you use the +name of your module as the namespace. + +### deprecate(message) + +Call this function from deprecated code to display a deprecation message. +This message will appear once per unique caller site. Caller site is the +first call site in the stack in a different file from the caller of this +function. + +If the message is omitted, a message is generated for you based on the site +of the `deprecate()` call and will display the name of the function called, +similar to the name displayed in a stack trace. + +### deprecate.function(fn, message) + +Call this function to wrap a given function in a deprecation message on any +call to the function. An optional message can be supplied to provide a custom +message. + +### deprecate.property(obj, prop, message) + +Call this function to wrap a given property on object in a deprecation message +on any accessing or setting of the property. An optional message can be supplied +to provide a custom message. + +The method must be called on the object where the property belongs (not +inherited from the prototype). + +If the property is a data descriptor, it will be converted to an accessor +descriptor in order to display the deprecation message. + +### process.on('deprecation', fn) + +This module will allow easy capturing of deprecation errors by emitting the +errors as the type "deprecation" on the global `process`. If there are no +listeners for this type, the errors are written to STDERR as normal, but if +there are any listeners, nothing will be written to STDERR and instead only +emitted. From there, you can write the errors in a different format or to a +logging source. + +The error represents the deprecation and is emitted only once with the same +rules as writing to STDERR. The error has the following properties: + + - `message` - This is the message given by the library + - `name` - This is always `'DeprecationError'` + - `namespace` - This is the namespace the deprecation came from + - `stack` - This is the stack of the call to the deprecated thing + +Example `error.stack` output: + +``` +DeprecationError: my-cool-module deprecated oldfunction + at Object. ([eval]-wrapper:6:22) + at Module._compile (module.js:456:26) + at evalScript (node.js:532:25) + at startup (node.js:80:7) + at node.js:902:3 +``` + +### process.env.NO_DEPRECATION + +As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` +is provided as a quick solution to silencing deprecation warnings from being +output. The format of this is similar to that of `DEBUG`: + +```sh +$ NO_DEPRECATION=my-module,othermod node app.js +``` + +This will suppress deprecations from being output for "my-module" and "othermod". +The value is a list of comma-separated namespaces. To suppress every warning +across all namespaces, use the value `*` for a namespace. + +Providing the argument `--no-deprecation` to the `node` executable will suppress +all deprecations (only available in Node.js 0.8 or higher). + +**NOTE** This will not suppress the deperecations given to any "deprecation" +event listeners, just the output to STDERR. + +### process.env.TRACE_DEPRECATION + +As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` +is provided as a solution to getting more detailed location information in deprecation +warnings by including the entire stack trace. The format of this is the same as +`NO_DEPRECATION`: + +```sh +$ TRACE_DEPRECATION=my-module,othermod node app.js +``` + +This will include stack traces for deprecations being output for "my-module" and +"othermod". The value is a list of comma-separated namespaces. To trace every +warning across all namespaces, use the value `*` for a namespace. + +Providing the argument `--trace-deprecation` to the `node` executable will trace +all deprecations (only available in Node.js 0.8 or higher). + +**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. + +## Display + +![message](files/message.png) + +When a user calls a function in your library that you mark deprecated, they +will see the following written to STDERR (in the given colors, similar colors +and layout to the `debug` module): + +``` +bright cyan bright yellow +| | reset cyan +| | | | +▼ ▼ ▼ ▼ +my-cool-module deprecated oldfunction [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ +| | | | +namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +If the user redirects their STDERR to a file or somewhere that does not support +colors, they see (similar layout to the `debug` module): + +``` +Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ ▲ +| | | | | +timestamp of message namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +## Examples + +### Deprecating all calls to a function + +This will display a deprecated message about "oldfunction" being deprecated +from "my-module" on STDERR. + +```js +var deprecate = require('depd')('my-cool-module') + +// message automatically derived from function name +// Object.oldfunction +exports.oldfunction = deprecate.function(function oldfunction () { + // all calls to function are deprecated +}) + +// specific message +exports.oldfunction = deprecate.function(function () { + // all calls to function are deprecated +}, 'oldfunction') +``` + +### Conditionally deprecating a function call + +This will display a deprecated message about "weirdfunction" being deprecated +from "my-module" on STDERR when called with less than 2 arguments. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } +} +``` + +When calling `deprecate` as a function, the warning is counted per call site +within your own module, so you can display different deprecations depending +on different situations and the users will still get all the warnings: + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } else if (typeof arguments[0] !== 'string') { + // calls with non-string first argument are deprecated + deprecate('weirdfunction non-string first arg') + } +} +``` + +### Deprecating property access + +This will display a deprecated message about "oldprop" being deprecated +from "my-module" on STDERR when accessed. A deprecation will be displayed +when setting the value and when getting the value. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.oldprop = 'something' + +// message automatically derives from property name +deprecate.property(exports, 'oldprop') + +// explicit message +deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') +``` + +## License + +[MIT](LICENSE) + +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/nodejs-depd/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd +[coveralls-image]: https://badgen.net/coveralls/c/github/dougwilson/nodejs-depd/master +[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master +[node-image]: https://badgen.net/npm/node/depd +[node-url]: https://nodejs.org/en/download/ +[npm-downloads-image]: https://badgen.net/npm/dm/depd +[npm-url]: https://npmjs.org/package/depd +[npm-version-image]: https://badgen.net/npm/v/depd +[travis-image]: https://badgen.net/travis/dougwilson/nodejs-depd/master?label=linux +[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd diff --git a/graphql-subscription-express/node_modules/depd/index.js b/graphql-subscription-express/node_modules/depd/index.js new file mode 100644 index 0000000..1bf2fcf --- /dev/null +++ b/graphql-subscription-express/node_modules/depd/index.js @@ -0,0 +1,538 @@ +/*! + * depd + * Copyright(c) 2014-2018 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var relative = require('path').relative + +/** + * Module exports. + */ + +module.exports = depd + +/** + * Get the path to base files on. + */ + +var basePath = process.cwd() + +/** + * Determine if namespace is contained in the string. + */ + +function containsNamespace (str, namespace) { + var vals = str.split(/[ ,]+/) + var ns = String(namespace).toLowerCase() + + for (var i = 0; i < vals.length; i++) { + var val = vals[i] + + // namespace contained + if (val && (val === '*' || val.toLowerCase() === ns)) { + return true + } + } + + return false +} + +/** + * Convert a data descriptor to accessor descriptor. + */ + +function convertDataDescriptorToAccessor (obj, prop, message) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + var value = descriptor.value + + descriptor.get = function getter () { return value } + + if (descriptor.writable) { + descriptor.set = function setter (val) { return (value = val) } + } + + delete descriptor.value + delete descriptor.writable + + Object.defineProperty(obj, prop, descriptor) + + return descriptor +} + +/** + * Create arguments string to keep arity. + */ + +function createArgumentsString (arity) { + var str = '' + + for (var i = 0; i < arity; i++) { + str += ', arg' + i + } + + return str.substr(2) +} + +/** + * Create stack string from stack. + */ + +function createStackString (stack) { + var str = this.name + ': ' + this.namespace + + if (this.message) { + str += ' deprecated ' + this.message + } + + for (var i = 0; i < stack.length; i++) { + str += '\n at ' + stack[i].toString() + } + + return str +} + +/** + * Create deprecate for namespace in caller. + */ + +function depd (namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') + } + + var stack = getStack() + var site = callSiteLocation(stack[1]) + var file = site[0] + + function deprecate (message) { + // call to self as log + log.call(deprecate, message) + } + + deprecate._file = file + deprecate._ignored = isignored(namespace) + deprecate._namespace = namespace + deprecate._traced = istraced(namespace) + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate +} + +/** + * Determine if event emitter has listeners of a given type. + * + * The way to do this check is done three different ways in Node.js >= 0.8 + * so this consolidates them into a minimal set using instance methods. + * + * @param {EventEmitter} emitter + * @param {string} type + * @returns {boolean} + * @private + */ + +function eehaslisteners (emitter, type) { + var count = typeof emitter.listenerCount !== 'function' + ? emitter.listeners(type).length + : emitter.listenerCount(type) + + return count > 0 +} + +/** + * Determine if namespace is ignored. + */ + +function isignored (namespace) { + if (process.noDeprecation) { + // --no-deprecation support + return true + } + + var str = process.env.NO_DEPRECATION || '' + + // namespace ignored + return containsNamespace(str, namespace) +} + +/** + * Determine if namespace is traced. + */ + +function istraced (namespace) { + if (process.traceDeprecation) { + // --trace-deprecation support + return true + } + + var str = process.env.TRACE_DEPRECATION || '' + + // namespace traced + return containsNamespace(str, namespace) +} + +/** + * Display deprecation message. + */ + +function log (message, site) { + var haslisteners = eehaslisteners(process, 'deprecation') + + // abort early if no destination + if (!haslisteners && this._ignored) { + return + } + + var caller + var callFile + var callSite + var depSite + var i = 0 + var seen = false + var stack = getStack() + var file = this._file + + if (site) { + // provided site + depSite = site + callSite = callSiteLocation(stack[1]) + callSite.name = depSite.name + file = callSite[0] + } else { + // get call site + i = 2 + depSite = callSiteLocation(stack[i]) + callSite = depSite + } + + // get caller of deprecated thing in relation to file + for (; i < stack.length; i++) { + caller = callSiteLocation(stack[i]) + callFile = caller[0] + + if (callFile === file) { + seen = true + } else if (callFile === this._file) { + file = this._file + } else if (seen) { + break + } + } + + var key = caller + ? depSite.join(':') + '__' + caller.join(':') + : undefined + + if (key !== undefined && key in this._warned) { + // already warned + return + } + + this._warned[key] = true + + // generate automatic message from call site + var msg = message + if (!msg) { + msg = callSite === depSite || !callSite.name + ? defaultMessage(depSite) + : defaultMessage(callSite) + } + + // emit deprecation if listeners exist + if (haslisteners) { + var err = DeprecationError(this._namespace, msg, stack.slice(i)) + process.emit('deprecation', err) + return + } + + // format and write message + var format = process.stderr.isTTY + ? formatColor + : formatPlain + var output = format.call(this, msg, caller, stack.slice(i)) + process.stderr.write(output + '\n', 'utf8') +} + +/** + * Get call site location as array. + */ + +function callSiteLocation (callSite) { + var file = callSite.getFileName() || '' + var line = callSite.getLineNumber() + var colm = callSite.getColumnNumber() + + if (callSite.isEval()) { + file = callSite.getEvalOrigin() + ', ' + file + } + + var site = [file, line, colm] + + site.callSite = callSite + site.name = callSite.getFunctionName() + + return site +} + +/** + * Generate a default message from the site. + */ + +function defaultMessage (site) { + var callSite = site.callSite + var funcName = site.name + + // make useful anonymous name + if (!funcName) { + funcName = '' + } + + var context = callSite.getThis() + var typeName = context && callSite.getTypeName() + + // ignore useless type name + if (typeName === 'Object') { + typeName = undefined + } + + // make useful type name + if (typeName === 'Function') { + typeName = context.name || typeName + } + + return typeName && callSite.getMethodName() + ? typeName + '.' + funcName + : funcName +} + +/** + * Format deprecation message without color. + */ + +function formatPlain (msg, caller, stack) { + var timestamp = new Date().toUTCString() + + var formatted = timestamp + + ' ' + this._namespace + + ' deprecated ' + msg + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n at ' + stack[i].toString() + } + + return formatted + } + + if (caller) { + formatted += ' at ' + formatLocation(caller) + } + + return formatted +} + +/** + * Format deprecation message with color. + */ + +function formatColor (msg, caller, stack) { + var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan + ' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow + ' \x1b[0m' + msg + '\x1b[39m' // reset + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m' // cyan + } + + return formatted + } + + if (caller) { + formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan + } + + return formatted +} + +/** + * Format call site location. + */ + +function formatLocation (callSite) { + return relative(basePath, callSite[0]) + + ':' + callSite[1] + + ':' + callSite[2] +} + +/** + * Get the stack as array of call sites. + */ + +function getStack () { + var limit = Error.stackTraceLimit + var obj = {} + var prep = Error.prepareStackTrace + + Error.prepareStackTrace = prepareObjectStackTrace + Error.stackTraceLimit = Math.max(10, limit) + + // capture the stack + Error.captureStackTrace(obj) + + // slice this function off the top + var stack = obj.stack.slice(1) + + Error.prepareStackTrace = prep + Error.stackTraceLimit = limit + + return stack +} + +/** + * Capture call site stack from v8. + */ + +function prepareObjectStackTrace (obj, stack) { + return stack +} + +/** + * Return a wrapped function in a deprecation message. + */ + +function wrapfunction (fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') + } + + var args = createArgumentsString(fn.length) + var stack = getStack() + var site = callSiteLocation(stack[1]) + + site.name = fn.name + + // eslint-disable-next-line no-new-func + var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site', + '"use strict"\n' + + 'return function (' + args + ') {' + + 'log.call(deprecate, message, site)\n' + + 'return fn.apply(this, arguments)\n' + + '}')(fn, log, this, message, site) + + return deprecatedfn +} + +/** + * Wrap property in a deprecation message. + */ + +function wrapproperty (obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } + + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + + if (!descriptor) { + throw new TypeError('must call property on owner object') + } + + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } + + var deprecate = this + var stack = getStack() + var site = callSiteLocation(stack[1]) + + // set site name + site.name = prop + + // convert data descriptor + if ('value' in descriptor) { + descriptor = convertDataDescriptorToAccessor(obj, prop, message) + } + + var get = descriptor.get + var set = descriptor.set + + // wrap getter + if (typeof get === 'function') { + descriptor.get = function getter () { + log.call(deprecate, message, site) + return get.apply(this, arguments) + } + } + + // wrap setter + if (typeof set === 'function') { + descriptor.set = function setter () { + log.call(deprecate, message, site) + return set.apply(this, arguments) + } + } + + Object.defineProperty(obj, prop, descriptor) +} + +/** + * Create DeprecationError for deprecation + */ + +function DeprecationError (namespace, message, stack) { + var error = new Error() + var stackString + + Object.defineProperty(error, 'constructor', { + value: DeprecationError + }) + + Object.defineProperty(error, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }) + + Object.defineProperty(error, 'name', { + enumerable: false, + configurable: true, + value: 'DeprecationError', + writable: true + }) + + Object.defineProperty(error, 'namespace', { + configurable: true, + enumerable: false, + value: namespace, + writable: true + }) + + Object.defineProperty(error, 'stack', { + configurable: true, + enumerable: false, + get: function () { + if (stackString !== undefined) { + return stackString + } + + // prepare stack trace + return (stackString = createStackString.call(this, stack)) + }, + set: function setter (val) { + stackString = val + } + }) + + return error +} diff --git a/graphql-subscription-express/node_modules/depd/lib/browser/index.js b/graphql-subscription-express/node_modules/depd/lib/browser/index.js new file mode 100644 index 0000000..6be45cc --- /dev/null +++ b/graphql-subscription-express/node_modules/depd/lib/browser/index.js @@ -0,0 +1,77 @@ +/*! + * depd + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = depd + +/** + * Create deprecate for namespace in caller. + */ + +function depd (namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') + } + + function deprecate (message) { + // no-op in browser + } + + deprecate._file = undefined + deprecate._ignored = true + deprecate._namespace = namespace + deprecate._traced = false + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate +} + +/** + * Return a wrapped function in a deprecation message. + * + * This is a no-op version of the wrapper, which does nothing but call + * validation. + */ + +function wrapfunction (fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') + } + + return fn +} + +/** + * Wrap property in a deprecation message. + * + * This is a no-op version of the wrapper, which does nothing but call + * validation. + */ + +function wrapproperty (obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } + + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + + if (!descriptor) { + throw new TypeError('must call property on owner object') + } + + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } +} diff --git a/graphql-subscription-express/node_modules/depd/package.json b/graphql-subscription-express/node_modules/depd/package.json new file mode 100644 index 0000000..3857e19 --- /dev/null +++ b/graphql-subscription-express/node_modules/depd/package.json @@ -0,0 +1,45 @@ +{ + "name": "depd", + "description": "Deprecate all the things", + "version": "2.0.0", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "deprecate", + "deprecated" + ], + "repository": "dougwilson/nodejs-depd", + "browser": "lib/browser/index.js", + "devDependencies": { + "benchmark": "2.1.4", + "beautify-benchmark": "0.2.4", + "eslint": "5.7.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.14.0", + "eslint-plugin-markdown": "1.0.0-beta.7", + "eslint-plugin-node": "7.0.1", + "eslint-plugin-promise": "4.0.1", + "eslint-plugin-standard": "4.0.0", + "istanbul": "0.4.5", + "mocha": "5.2.0", + "safe-buffer": "5.1.2", + "uid-safe": "2.1.5" + }, + "files": [ + "lib/", + "History.md", + "LICENSE", + "index.js", + "Readme.md" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail test/", + "test-ci": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter spec test/ && istanbul report lcovonly text-summary", + "test-cov": "istanbul cover --print=none node_modules/mocha/bin/_mocha -- --reporter dot test/ && istanbul report lcov text-summary" + } +} diff --git a/graphql-subscription-express/node_modules/destroy/LICENSE b/graphql-subscription-express/node_modules/destroy/LICENSE new file mode 100644 index 0000000..0e2c35f --- /dev/null +++ b/graphql-subscription-express/node_modules/destroy/LICENSE @@ -0,0 +1,23 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com +Copyright (c) 2015-2022 Douglas Christopher Wilson doug@somethingdoug.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/destroy/README.md b/graphql-subscription-express/node_modules/destroy/README.md new file mode 100644 index 0000000..e7701ae --- /dev/null +++ b/graphql-subscription-express/node_modules/destroy/README.md @@ -0,0 +1,63 @@ +# destroy + +[![NPM version][npm-image]][npm-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +Destroy a stream. + +This module is meant to ensure a stream gets destroyed, handling different APIs +and Node.js bugs. + +## API + +```js +var destroy = require('destroy') +``` + +### destroy(stream [, suppress]) + +Destroy the given stream, and optionally suppress any future `error` events. + +In most cases, this is identical to a simple `stream.destroy()` call. The rules +are as follows for a given stream: + + 1. If the `stream` is an instance of `ReadStream`, then call `stream.destroy()` + and add a listener to the `open` event to call `stream.close()` if it is + fired. This is for a Node.js bug that will leak a file descriptor if + `.destroy()` is called before `open`. + 2. If the `stream` is an instance of a zlib stream, then call `stream.destroy()` + and close the underlying zlib handle if open, otherwise call `stream.close()`. + This is for consistency across Node.js versions and a Node.js bug that will + leak a native zlib handle. + 3. If the `stream` is not an instance of `Stream`, then nothing happens. + 4. If the `stream` has a `.destroy()` method, then call it. + +The function returns the `stream` passed in as the argument. + +## Example + +```js +var destroy = require('destroy') + +var fs = require('fs') +var stream = fs.createReadStream('package.json') + +// ... and later +destroy(stream) +``` + +[npm-image]: https://img.shields.io/npm/v/destroy.svg?style=flat-square +[npm-url]: https://npmjs.org/package/destroy +[github-tag]: http://img.shields.io/github/tag/stream-utils/destroy.svg?style=flat-square +[github-url]: https://github.com/stream-utils/destroy/tags +[coveralls-image]: https://img.shields.io/coveralls/stream-utils/destroy.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/stream-utils/destroy?branch=master +[license-image]: http://img.shields.io/npm/l/destroy.svg?style=flat-square +[license-url]: LICENSE.md +[downloads-image]: http://img.shields.io/npm/dm/destroy.svg?style=flat-square +[downloads-url]: https://npmjs.org/package/destroy +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/stream-utils/destroy/ci/master?label=ci&style=flat-square +[github-actions-ci-url]: https://github.com/stream-utils/destroy/actions/workflows/ci.yml diff --git a/graphql-subscription-express/node_modules/destroy/index.js b/graphql-subscription-express/node_modules/destroy/index.js new file mode 100644 index 0000000..7fd5c09 --- /dev/null +++ b/graphql-subscription-express/node_modules/destroy/index.js @@ -0,0 +1,209 @@ +/*! + * destroy + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var EventEmitter = require('events').EventEmitter +var ReadStream = require('fs').ReadStream +var Stream = require('stream') +var Zlib = require('zlib') + +/** + * Module exports. + * @public + */ + +module.exports = destroy + +/** + * Destroy the given stream, and optionally suppress any future `error` events. + * + * @param {object} stream + * @param {boolean} suppress + * @public + */ + +function destroy (stream, suppress) { + if (isFsReadStream(stream)) { + destroyReadStream(stream) + } else if (isZlibStream(stream)) { + destroyZlibStream(stream) + } else if (hasDestroy(stream)) { + stream.destroy() + } + + if (isEventEmitter(stream) && suppress) { + stream.removeAllListeners('error') + stream.addListener('error', noop) + } + + return stream +} + +/** + * Destroy a ReadStream. + * + * @param {object} stream + * @private + */ + +function destroyReadStream (stream) { + stream.destroy() + + if (typeof stream.close === 'function') { + // node.js core bug work-around + stream.on('open', onOpenClose) + } +} + +/** + * Close a Zlib stream. + * + * Zlib streams below Node.js 4.5.5 have a buggy implementation + * of .close() when zlib encountered an error. + * + * @param {object} stream + * @private + */ + +function closeZlibStream (stream) { + if (stream._hadError === true) { + var prop = stream._binding === null + ? '_binding' + : '_handle' + + stream[prop] = { + close: function () { this[prop] = null } + } + } + + stream.close() +} + +/** + * Destroy a Zlib stream. + * + * Zlib streams don't have a destroy function in Node.js 6. On top of that + * simply calling destroy on a zlib stream in Node.js 8+ will result in a + * memory leak. So until that is fixed, we need to call both close AND destroy. + * + * PR to fix memory leak: https://github.com/nodejs/node/pull/23734 + * + * In Node.js 6+8, it's important that destroy is called before close as the + * stream would otherwise emit the error 'zlib binding closed'. + * + * @param {object} stream + * @private + */ + +function destroyZlibStream (stream) { + if (typeof stream.destroy === 'function') { + // node.js core bug work-around + // istanbul ignore if: node.js 0.8 + if (stream._binding) { + // node.js < 0.10.0 + stream.destroy() + if (stream._processing) { + stream._needDrain = true + stream.once('drain', onDrainClearBinding) + } else { + stream._binding.clear() + } + } else if (stream._destroy && stream._destroy !== Stream.Transform.prototype._destroy) { + // node.js >= 12, ^11.1.0, ^10.15.1 + stream.destroy() + } else if (stream._destroy && typeof stream.close === 'function') { + // node.js 7, 8 + stream.destroyed = true + stream.close() + } else { + // fallback + // istanbul ignore next + stream.destroy() + } + } else if (typeof stream.close === 'function') { + // node.js < 8 fallback + closeZlibStream(stream) + } +} + +/** + * Determine if stream has destroy. + * @private + */ + +function hasDestroy (stream) { + return stream instanceof Stream && + typeof stream.destroy === 'function' +} + +/** + * Determine if val is EventEmitter. + * @private + */ + +function isEventEmitter (val) { + return val instanceof EventEmitter +} + +/** + * Determine if stream is fs.ReadStream stream. + * @private + */ + +function isFsReadStream (stream) { + return stream instanceof ReadStream +} + +/** + * Determine if stream is Zlib stream. + * @private + */ + +function isZlibStream (stream) { + return stream instanceof Zlib.Gzip || + stream instanceof Zlib.Gunzip || + stream instanceof Zlib.Deflate || + stream instanceof Zlib.DeflateRaw || + stream instanceof Zlib.Inflate || + stream instanceof Zlib.InflateRaw || + stream instanceof Zlib.Unzip +} + +/** + * No-op function. + * @private + */ + +function noop () {} + +/** + * On drain handler to clear binding. + * @private + */ + +// istanbul ignore next: node.js 0.8 +function onDrainClearBinding () { + this._binding.clear() +} + +/** + * On open handler to close stream. + * @private + */ + +function onOpenClose () { + if (typeof this.fd === 'number') { + // actually close down the fd + this.close() + } +} diff --git a/graphql-subscription-express/node_modules/destroy/package.json b/graphql-subscription-express/node_modules/destroy/package.json new file mode 100644 index 0000000..c85e438 --- /dev/null +++ b/graphql-subscription-express/node_modules/destroy/package.json @@ -0,0 +1,48 @@ +{ + "name": "destroy", + "description": "destroy a stream if possible", + "version": "1.2.0", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com", + "twitter": "https://twitter.com/jongleberry" + }, + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "repository": "stream-utils/destroy", + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.2", + "nyc": "15.1.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + }, + "files": [ + "index.js", + "LICENSE" + ], + "keywords": [ + "stream", + "streams", + "destroy", + "cleanup", + "leak", + "fd" + ] +} diff --git a/graphql-subscription-express/node_modules/ee-first/LICENSE b/graphql-subscription-express/node_modules/ee-first/LICENSE new file mode 100644 index 0000000..a7ae8ee --- /dev/null +++ b/graphql-subscription-express/node_modules/ee-first/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/ee-first/README.md b/graphql-subscription-express/node_modules/ee-first/README.md new file mode 100644 index 0000000..cbd2478 --- /dev/null +++ b/graphql-subscription-express/node_modules/ee-first/README.md @@ -0,0 +1,80 @@ +# EE First + +[![NPM version][npm-image]][npm-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] +[![Gittip][gittip-image]][gittip-url] + +Get the first event in a set of event emitters and event pairs, +then clean up after itself. + +## Install + +```sh +$ npm install ee-first +``` + +## API + +```js +var first = require('ee-first') +``` + +### first(arr, listener) + +Invoke `listener` on the first event from the list specified in `arr`. `arr` is +an array of arrays, with each array in the format `[ee, ...event]`. `listener` +will be called only once, the first time any of the given events are emitted. If +`error` is one of the listened events, then if that fires first, the `listener` +will be given the `err` argument. + +The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the +first argument emitted from an `error` event, if applicable; `ee` is the event +emitter that fired; `event` is the string event name that fired; and `args` is an +array of the arguments that were emitted on the event. + +```js +var ee1 = new EventEmitter() +var ee2 = new EventEmitter() + +first([ + [ee1, 'close', 'end', 'error'], + [ee2, 'error'] +], function (err, ee, event, args) { + // listener invoked +}) +``` + +#### .cancel() + +The group of listeners can be cancelled before being invoked and have all the event +listeners removed from the underlying event emitters. + +```js +var thunk = first([ + [ee1, 'close', 'end', 'error'], + [ee2, 'error'] +], function (err, ee, event, args) { + // listener invoked +}) + +// cancel and clean up +thunk.cancel() +``` + +[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square +[npm-url]: https://npmjs.org/package/ee-first +[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square +[github-url]: https://github.com/jonathanong/ee-first/tags +[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square +[travis-url]: https://travis-ci.org/jonathanong/ee-first +[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master +[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square +[license-url]: LICENSE.md +[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square +[downloads-url]: https://npmjs.org/package/ee-first +[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square +[gittip-url]: https://www.gittip.com/jonathanong/ diff --git a/graphql-subscription-express/node_modules/ee-first/index.js b/graphql-subscription-express/node_modules/ee-first/index.js new file mode 100644 index 0000000..501287c --- /dev/null +++ b/graphql-subscription-express/node_modules/ee-first/index.js @@ -0,0 +1,95 @@ +/*! + * ee-first + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = first + +/** + * Get the first event in a set of event emitters and event pairs. + * + * @param {array} stuff + * @param {function} done + * @public + */ + +function first(stuff, done) { + if (!Array.isArray(stuff)) + throw new TypeError('arg must be an array of [ee, events...] arrays') + + var cleanups = [] + + for (var i = 0; i < stuff.length; i++) { + var arr = stuff[i] + + if (!Array.isArray(arr) || arr.length < 2) + throw new TypeError('each array member must be [ee, events...]') + + var ee = arr[0] + + for (var j = 1; j < arr.length; j++) { + var event = arr[j] + var fn = listener(event, callback) + + // listen to the event + ee.on(event, fn) + // push this listener to the list of cleanups + cleanups.push({ + ee: ee, + event: event, + fn: fn, + }) + } + } + + function callback() { + cleanup() + done.apply(null, arguments) + } + + function cleanup() { + var x + for (var i = 0; i < cleanups.length; i++) { + x = cleanups[i] + x.ee.removeListener(x.event, x.fn) + } + } + + function thunk(fn) { + done = fn + } + + thunk.cancel = cleanup + + return thunk +} + +/** + * Create the event listener. + * @private + */ + +function listener(event, done) { + return function onevent(arg1) { + var args = new Array(arguments.length) + var ee = this + var err = event === 'error' + ? arg1 + : null + + // copy args to prevent arguments escaping scope + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + + done(err, ee, event, args) + } +} diff --git a/graphql-subscription-express/node_modules/ee-first/package.json b/graphql-subscription-express/node_modules/ee-first/package.json new file mode 100644 index 0000000..b6d0b7d --- /dev/null +++ b/graphql-subscription-express/node_modules/ee-first/package.json @@ -0,0 +1,29 @@ +{ + "name": "ee-first", + "description": "return the first event in a set of ee/event pairs", + "version": "1.1.1", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com", + "twitter": "https://twitter.com/jongleberry" + }, + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "repository": "jonathanong/ee-first", + "devDependencies": { + "istanbul": "0.3.9", + "mocha": "2.2.5" + }, + "files": [ + "index.js", + "LICENSE" + ], + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/encodeurl/HISTORY.md b/graphql-subscription-express/node_modules/encodeurl/HISTORY.md new file mode 100644 index 0000000..41313b2 --- /dev/null +++ b/graphql-subscription-express/node_modules/encodeurl/HISTORY.md @@ -0,0 +1,14 @@ +1.0.2 / 2018-01-21 +================== + + * Fix encoding `%` as last character + +1.0.1 / 2016-06-09 +================== + + * Fix encoding unpaired surrogates at start/end of string + +1.0.0 / 2016-06-08 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/encodeurl/LICENSE b/graphql-subscription-express/node_modules/encodeurl/LICENSE new file mode 100644 index 0000000..8812229 --- /dev/null +++ b/graphql-subscription-express/node_modules/encodeurl/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/encodeurl/README.md b/graphql-subscription-express/node_modules/encodeurl/README.md new file mode 100644 index 0000000..127c5a0 --- /dev/null +++ b/graphql-subscription-express/node_modules/encodeurl/README.md @@ -0,0 +1,128 @@ +# encodeurl + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Encode a URL to a percent-encoded form, excluding already-encoded sequences + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install encodeurl +``` + +## API + +```js +var encodeUrl = require('encodeurl') +``` + +### encodeUrl(url) + +Encode a URL to a percent-encoded form, excluding already-encoded sequences. + +This function will take an already-encoded URL and encode all the non-URL +code points (as UTF-8 byte sequences). This function will not encode the +"%" character unless it is not part of a valid sequence (`%20` will be +left as-is, but `%foo` will be encoded as `%25foo`). + +This encode is meant to be "safe" and does not throw errors. It will try as +hard as it can to properly encode the given URL, including replacing any raw, +unpaired surrogate pairs with the Unicode replacement character prior to +encoding. + +This function is _similar_ to the intrinsic function `encodeURI`, except it +will not encode the `%` character if that is part of a valid sequence, will +not encode `[` and `]` (for IPv6 hostnames) and will replace raw, unpaired +surrogate pairs with the Unicode replacement character (instead of throwing). + +## Examples + +### Encode a URL containing user-controled data + +```js +var encodeUrl = require('encodeurl') +var escapeHtml = require('escape-html') + +http.createServer(function onRequest (req, res) { + // get encoded form of inbound url + var url = encodeUrl(req.url) + + // create html message + var body = '

Location ' + escapeHtml(url) + ' not found

' + + // send a 404 + res.statusCode = 404 + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8'))) + res.end(body, 'utf-8') +}) +``` + +### Encode a URL for use in a header field + +```js +var encodeUrl = require('encodeurl') +var escapeHtml = require('escape-html') +var url = require('url') + +http.createServer(function onRequest (req, res) { + // parse inbound url + var href = url.parse(req) + + // set new host for redirect + href.host = 'localhost' + href.protocol = 'https:' + href.slashes = true + + // create location header + var location = encodeUrl(url.format(href)) + + // create html message + var body = '

Redirecting to new site: ' + escapeHtml(location) + '

' + + // send a 301 + res.statusCode = 301 + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8'))) + res.setHeader('Location', location) + res.end(body, 'utf-8') +}) +``` + +## Testing + +```sh +$ npm test +$ npm run lint +``` + +## References + +- [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax][rfc-3986] +- [WHATWG URL Living Standard][whatwg-url] + +[rfc-3986]: https://tools.ietf.org/html/rfc3986 +[whatwg-url]: https://url.spec.whatwg.org/ + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/encodeurl.svg +[npm-url]: https://npmjs.org/package/encodeurl +[node-version-image]: https://img.shields.io/node/v/encodeurl.svg +[node-version-url]: https://nodejs.org/en/download +[travis-image]: https://img.shields.io/travis/pillarjs/encodeurl.svg +[travis-url]: https://travis-ci.org/pillarjs/encodeurl +[coveralls-image]: https://img.shields.io/coveralls/pillarjs/encodeurl.svg +[coveralls-url]: https://coveralls.io/r/pillarjs/encodeurl?branch=master +[downloads-image]: https://img.shields.io/npm/dm/encodeurl.svg +[downloads-url]: https://npmjs.org/package/encodeurl diff --git a/graphql-subscription-express/node_modules/encodeurl/index.js b/graphql-subscription-express/node_modules/encodeurl/index.js new file mode 100644 index 0000000..fc4906c --- /dev/null +++ b/graphql-subscription-express/node_modules/encodeurl/index.js @@ -0,0 +1,60 @@ +/*! + * encodeurl + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = encodeUrl + +/** + * RegExp to match non-URL code points, *after* encoding (i.e. not including "%") + * and including invalid escape sequences. + * @private + */ + +var ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g + +/** + * RegExp to match unmatched surrogate pair. + * @private + */ + +var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g + +/** + * String to replace unmatched surrogate pair with. + * @private + */ + +var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2' + +/** + * Encode a URL to a percent-encoded form, excluding already-encoded sequences. + * + * This function will take an already-encoded URL and encode all the non-URL + * code points. This function will not encode the "%" character unless it is + * not part of a valid sequence (`%20` will be left as-is, but `%foo` will + * be encoded as `%25foo`). + * + * This encode is meant to be "safe" and does not throw errors. It will try as + * hard as it can to properly encode the given URL, including replacing any raw, + * unpaired surrogate pairs with the Unicode replacement character prior to + * encoding. + * + * @param {string} url + * @return {string} + * @public + */ + +function encodeUrl (url) { + return String(url) + .replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE) + .replace(ENCODE_CHARS_REGEXP, encodeURI) +} diff --git a/graphql-subscription-express/node_modules/encodeurl/package.json b/graphql-subscription-express/node_modules/encodeurl/package.json new file mode 100644 index 0000000..b9f25ef --- /dev/null +++ b/graphql-subscription-express/node_modules/encodeurl/package.json @@ -0,0 +1,40 @@ +{ + "name": "encodeurl", + "description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences", + "version": "1.0.2", + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "keywords": [ + "encode", + "encodeurl", + "url" + ], + "repository": "pillarjs/encodeurl", + "devDependencies": { + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.8.0", + "eslint-plugin-node": "5.2.1", + "eslint-plugin-promise": "3.6.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "2.5.3" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/es-define-property/.eslintrc b/graphql-subscription-express/node_modules/es-define-property/.eslintrc new file mode 100644 index 0000000..46f3b12 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/graphql-subscription-express/node_modules/es-define-property/.github/FUNDING.yml b/graphql-subscription-express/node_modules/es-define-property/.github/FUNDING.yml new file mode 100644 index 0000000..4445451 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/es-define-property +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/graphql-subscription-express/node_modules/es-define-property/.nycrc b/graphql-subscription-express/node_modules/es-define-property/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/es-define-property/CHANGELOG.md b/graphql-subscription-express/node_modules/es-define-property/CHANGELOG.md new file mode 100644 index 0000000..4dce2ec --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2024-02-12 + +### Commits + +- Initial implementation, tests, readme, types [`3e154e1`](https://github.com/ljharb/es-define-property/commit/3e154e11a2fee09127220f5e503bf2c0a31dd480) +- Initial commit [`07d98de`](https://github.com/ljharb/es-define-property/commit/07d98de34a4dc31ff5e83a37c0c3f49e0d85cd50) +- npm init [`c4eb634`](https://github.com/ljharb/es-define-property/commit/c4eb6348b0d3886aac36cef34ad2ee0665ea6f3e) +- Only apps should have lockfiles [`7af86ec`](https://github.com/ljharb/es-define-property/commit/7af86ec1d311ec0b17fdfe616a25f64276903856) diff --git a/graphql-subscription-express/node_modules/es-define-property/LICENSE b/graphql-subscription-express/node_modules/es-define-property/LICENSE new file mode 100644 index 0000000..f82f389 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/es-define-property/README.md b/graphql-subscription-express/node_modules/es-define-property/README.md new file mode 100644 index 0000000..9b291bd --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/README.md @@ -0,0 +1,49 @@ +# es-define-property [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +`Object.defineProperty`, but not IE 8's broken one. + +## Example + +```js +const assert = require('assert'); + +const $defineProperty = require('es-define-property'); + +if ($defineProperty) { + assert.equal($defineProperty, Object.defineProperty); +} else if (Object.defineProperty) { + assert.equal($defineProperty, false, 'this is IE 8'); +} else { + assert.equal($defineProperty, false, 'this is an ES3 engine'); +} +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/es-define-property +[npm-version-svg]: https://versionbadg.es/ljharb/es-define-property.svg +[deps-svg]: https://david-dm.org/ljharb/es-define-property.svg +[deps-url]: https://david-dm.org/ljharb/es-define-property +[dev-deps-svg]: https://david-dm.org/ljharb/es-define-property/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-define-property#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/es-define-property.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/es-define-property.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/es-define-property.svg +[downloads-url]: https://npm-stat.com/charts.html?package=es-define-property +[codecov-image]: https://codecov.io/gh/ljharb/es-define-property/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/es-define-property/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-define-property +[actions-url]: https://github.com/ljharb/es-define-property/actions diff --git a/graphql-subscription-express/node_modules/es-define-property/index.d.ts b/graphql-subscription-express/node_modules/es-define-property/index.d.ts new file mode 100644 index 0000000..6012247 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/index.d.ts @@ -0,0 +1,3 @@ +declare const defineProperty: false | typeof Object.defineProperty; + +export = defineProperty; \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/es-define-property/index.js b/graphql-subscription-express/node_modules/es-define-property/index.js new file mode 100644 index 0000000..f32737d --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/index.js @@ -0,0 +1,16 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +/** @type {import('.')} */ +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false; +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = false; + } +} + +module.exports = $defineProperty; diff --git a/graphql-subscription-express/node_modules/es-define-property/package.json b/graphql-subscription-express/node_modules/es-define-property/package.json new file mode 100644 index 0000000..45bc90f --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/package.json @@ -0,0 +1,81 @@ +{ + "name": "es-define-property", + "version": "1.0.0", + "description": "`Object.defineProperty`, but not IE 8's broken one.", + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/es-define-property.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "object", + "define", + "property", + "defineProperty", + "Object.defineProperty" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/es-define-property/issues" + }, + "homepage": "https://github.com/ljharb/es-define-property#readme", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/get-intrinsic": "^1.2.2", + "@types/gopd": "^1.0.3", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "^8.8.0", + "evalmd": "^0.0.19", + "gopd": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/graphql-subscription-express/node_modules/es-define-property/test/index.js b/graphql-subscription-express/node_modules/es-define-property/test/index.js new file mode 100644 index 0000000..dbc054e --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/test/index.js @@ -0,0 +1,55 @@ +'use strict'; + +var $defineProperty = require('../'); + +var test = require('tape'); +var gOPD = require('gopd'); + +test('defineProperty: supported', { skip: !$defineProperty }, function (t) { + t.plan(4); + + t.equal(typeof $defineProperty, 'function', 'defineProperty is supported'); + if ($defineProperty && gOPD) { // this `if` check is just to shut TS up + var o = { a: 1 }; + + $defineProperty(o, 'b', { enumerable: true, value: 2 }); + t.deepEqual( + gOPD(o, 'b'), + { + configurable: false, + enumerable: true, + value: 2, + writable: false + }, + 'property descriptor is as expected' + ); + + $defineProperty(o, 'c', { enumerable: false, value: 3, writable: true }); + t.deepEqual( + gOPD(o, 'c'), + { + configurable: false, + enumerable: false, + value: 3, + writable: true + }, + 'property descriptor is as expected' + ); + } + + t.equal($defineProperty, Object.defineProperty, 'defineProperty is Object.defineProperty'); + + t.end(); +}); + +test('defineProperty: not supported', { skip: !!$defineProperty }, function (t) { + t.notOk($defineProperty, 'defineProperty is not supported'); + + t.match( + typeof $defineProperty, + /^(?:undefined|boolean)$/, + '`typeof defineProperty` is `undefined` or `boolean`' + ); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/es-define-property/tsconfig.json b/graphql-subscription-express/node_modules/es-define-property/tsconfig.json new file mode 100644 index 0000000..fdfa155 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-define-property/tsconfig.json @@ -0,0 +1,50 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + "test/list-exports" + ], +} diff --git a/graphql-subscription-express/node_modules/es-errors/.eslintrc b/graphql-subscription-express/node_modules/es-errors/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/graphql-subscription-express/node_modules/es-errors/.github/FUNDING.yml b/graphql-subscription-express/node_modules/es-errors/.github/FUNDING.yml new file mode 100644 index 0000000..f1b8805 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/es-errors +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/graphql-subscription-express/node_modules/es-errors/CHANGELOG.md b/graphql-subscription-express/node_modules/es-errors/CHANGELOG.md new file mode 100644 index 0000000..204a9e9 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.3.0](https://github.com/ljharb/es-errors/compare/v1.2.1...v1.3.0) - 2024-02-05 + +### Commits + +- [New] add `EvalError` and `URIError` [`1927627`](https://github.com/ljharb/es-errors/commit/1927627ba68cb6c829d307231376c967db53acdf) + +## [v1.2.1](https://github.com/ljharb/es-errors/compare/v1.2.0...v1.2.1) - 2024-02-04 + +### Commits + +- [Fix] add missing `exports` entry [`5bb5f28`](https://github.com/ljharb/es-errors/commit/5bb5f280f98922701109d6ebb82eea2257cecc7e) + +## [v1.2.0](https://github.com/ljharb/es-errors/compare/v1.1.0...v1.2.0) - 2024-02-04 + +### Commits + +- [New] add `ReferenceError` [`6d8cf5b`](https://github.com/ljharb/es-errors/commit/6d8cf5bbb6f3f598d02cf6f30e468ba2caa8e143) + +## [v1.1.0](https://github.com/ljharb/es-errors/compare/v1.0.0...v1.1.0) - 2024-02-04 + +### Commits + +- [New] add base Error [`2983ab6`](https://github.com/ljharb/es-errors/commit/2983ab65f7bc5441276cb021dc3aa03c78881698) + +## v1.0.0 - 2024-02-03 + +### Commits + +- Initial implementation, tests, readme, type [`8f47631`](https://github.com/ljharb/es-errors/commit/8f476317e9ad76f40ad648081829b1a1a3a1288b) +- Initial commit [`ea5d099`](https://github.com/ljharb/es-errors/commit/ea5d099ef18e550509ab9e2be000526afd81c385) +- npm init [`6f5ebf9`](https://github.com/ljharb/es-errors/commit/6f5ebf9cead474dadd72b9e63dad315820a089ae) +- Only apps should have lockfiles [`e1a0aeb`](https://github.com/ljharb/es-errors/commit/e1a0aeb7b80f5cfc56be54d6b2100e915d47def8) +- [meta] add `sideEffects` flag [`a9c7d46`](https://github.com/ljharb/es-errors/commit/a9c7d460a492f1d8a241c836bc25a322a19cc043) diff --git a/graphql-subscription-express/node_modules/es-errors/LICENSE b/graphql-subscription-express/node_modules/es-errors/LICENSE new file mode 100644 index 0000000..f82f389 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/es-errors/README.md b/graphql-subscription-express/node_modules/es-errors/README.md new file mode 100644 index 0000000..8dbfacf --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/README.md @@ -0,0 +1,55 @@ +# es-errors [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A simple cache for a few of the JS Error constructors. + +## Example + +```js +const assert = require('assert'); + +const Base = require('es-errors'); +const Eval = require('es-errors/eval'); +const Range = require('es-errors/range'); +const Ref = require('es-errors/ref'); +const Syntax = require('es-errors/syntax'); +const Type = require('es-errors/type'); +const URI = require('es-errors/uri'); + +assert.equal(Base, Error); +assert.equal(Eval, EvalError); +assert.equal(Range, RangeError); +assert.equal(Ref, ReferenceError); +assert.equal(Syntax, SyntaxError); +assert.equal(Type, TypeError); +assert.equal(URI, URIError); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/es-errors +[npm-version-svg]: https://versionbadg.es/ljharb/es-errors.svg +[deps-svg]: https://david-dm.org/ljharb/es-errors.svg +[deps-url]: https://david-dm.org/ljharb/es-errors +[dev-deps-svg]: https://david-dm.org/ljharb/es-errors/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-errors#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/es-errors.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/es-errors.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/es-errors.svg +[downloads-url]: https://npm-stat.com/charts.html?package=es-errors +[codecov-image]: https://codecov.io/gh/ljharb/es-errors/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/es-errors/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-errors +[actions-url]: https://github.com/ljharb/es-errors/actions diff --git a/graphql-subscription-express/node_modules/es-errors/eval.d.ts b/graphql-subscription-express/node_modules/es-errors/eval.d.ts new file mode 100644 index 0000000..e4210e0 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/eval.d.ts @@ -0,0 +1,3 @@ +declare const EvalError: EvalErrorConstructor; + +export = EvalError; diff --git a/graphql-subscription-express/node_modules/es-errors/eval.js b/graphql-subscription-express/node_modules/es-errors/eval.js new file mode 100644 index 0000000..725ccb6 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/eval.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./eval')} */ +module.exports = EvalError; diff --git a/graphql-subscription-express/node_modules/es-errors/index.d.ts b/graphql-subscription-express/node_modules/es-errors/index.d.ts new file mode 100644 index 0000000..69bdbc9 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/index.d.ts @@ -0,0 +1,3 @@ +declare const Error: ErrorConstructor; + +export = Error; diff --git a/graphql-subscription-express/node_modules/es-errors/index.js b/graphql-subscription-express/node_modules/es-errors/index.js new file mode 100644 index 0000000..cc0c521 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/index.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('.')} */ +module.exports = Error; diff --git a/graphql-subscription-express/node_modules/es-errors/package.json b/graphql-subscription-express/node_modules/es-errors/package.json new file mode 100644 index 0000000..ff8c2a5 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/package.json @@ -0,0 +1,80 @@ +{ + "name": "es-errors", + "version": "1.3.0", + "description": "A simple cache for a few of the JS Error constructors.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./eval": "./eval.js", + "./range": "./range.js", + "./ref": "./ref.js", + "./syntax": "./syntax.js", + "./type": "./type.js", + "./uri": "./uri.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "aud --production", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/es-errors.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "error", + "typeerror", + "syntaxerror", + "rangeerror" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/es-errors/issues" + }, + "homepage": "https://github.com/ljharb/es-errors#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eclint": "^2.8.1", + "eslint": "^8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/graphql-subscription-express/node_modules/es-errors/range.d.ts b/graphql-subscription-express/node_modules/es-errors/range.d.ts new file mode 100644 index 0000000..3a12e86 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/range.d.ts @@ -0,0 +1,3 @@ +declare const RangeError: RangeErrorConstructor; + +export = RangeError; diff --git a/graphql-subscription-express/node_modules/es-errors/range.js b/graphql-subscription-express/node_modules/es-errors/range.js new file mode 100644 index 0000000..2044fe0 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/range.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./range')} */ +module.exports = RangeError; diff --git a/graphql-subscription-express/node_modules/es-errors/ref.d.ts b/graphql-subscription-express/node_modules/es-errors/ref.d.ts new file mode 100644 index 0000000..a13107e --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/ref.d.ts @@ -0,0 +1,3 @@ +declare const ReferenceError: ReferenceErrorConstructor; + +export = ReferenceError; diff --git a/graphql-subscription-express/node_modules/es-errors/ref.js b/graphql-subscription-express/node_modules/es-errors/ref.js new file mode 100644 index 0000000..d7c430f --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/ref.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./ref')} */ +module.exports = ReferenceError; diff --git a/graphql-subscription-express/node_modules/es-errors/syntax.d.ts b/graphql-subscription-express/node_modules/es-errors/syntax.d.ts new file mode 100644 index 0000000..6a0c53c --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/syntax.d.ts @@ -0,0 +1,3 @@ +declare const SyntaxError: SyntaxErrorConstructor; + +export = SyntaxError; diff --git a/graphql-subscription-express/node_modules/es-errors/syntax.js b/graphql-subscription-express/node_modules/es-errors/syntax.js new file mode 100644 index 0000000..5f5fdde --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/syntax.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./syntax')} */ +module.exports = SyntaxError; diff --git a/graphql-subscription-express/node_modules/es-errors/test/index.js b/graphql-subscription-express/node_modules/es-errors/test/index.js new file mode 100644 index 0000000..1ff0277 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/test/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var test = require('tape'); + +var E = require('../'); +var R = require('../range'); +var Ref = require('../ref'); +var S = require('../syntax'); +var T = require('../type'); + +test('errors', function (t) { + t.equal(E, Error); + t.equal(R, RangeError); + t.equal(Ref, ReferenceError); + t.equal(S, SyntaxError); + t.equal(T, TypeError); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/es-errors/tsconfig.json b/graphql-subscription-express/node_modules/es-errors/tsconfig.json new file mode 100644 index 0000000..99dfeb6 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + ], +} diff --git a/graphql-subscription-express/node_modules/es-errors/type.d.ts b/graphql-subscription-express/node_modules/es-errors/type.d.ts new file mode 100644 index 0000000..576fb51 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/type.d.ts @@ -0,0 +1,3 @@ +declare const TypeError: TypeErrorConstructor + +export = TypeError; diff --git a/graphql-subscription-express/node_modules/es-errors/type.js b/graphql-subscription-express/node_modules/es-errors/type.js new file mode 100644 index 0000000..9769e44 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/type.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./type')} */ +module.exports = TypeError; diff --git a/graphql-subscription-express/node_modules/es-errors/uri.d.ts b/graphql-subscription-express/node_modules/es-errors/uri.d.ts new file mode 100644 index 0000000..c3261c9 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/uri.d.ts @@ -0,0 +1,3 @@ +declare const URIError: URIErrorConstructor; + +export = URIError; diff --git a/graphql-subscription-express/node_modules/es-errors/uri.js b/graphql-subscription-express/node_modules/es-errors/uri.js new file mode 100644 index 0000000..e9cd1c7 --- /dev/null +++ b/graphql-subscription-express/node_modules/es-errors/uri.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./uri')} */ +module.exports = URIError; diff --git a/graphql-subscription-express/node_modules/escape-html/LICENSE b/graphql-subscription-express/node_modules/escape-html/LICENSE new file mode 100644 index 0000000..2e70de9 --- /dev/null +++ b/graphql-subscription-express/node_modules/escape-html/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2013 TJ Holowaychuk +Copyright (c) 2015 Andreas Lubbe +Copyright (c) 2015 Tiancheng "Timothy" Gu + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/escape-html/Readme.md b/graphql-subscription-express/node_modules/escape-html/Readme.md new file mode 100644 index 0000000..653d9ea --- /dev/null +++ b/graphql-subscription-express/node_modules/escape-html/Readme.md @@ -0,0 +1,43 @@ + +# escape-html + + Escape string for use in HTML + +## Example + +```js +var escape = require('escape-html'); +var html = escape('foo & bar'); +// -> foo & bar +``` + +## Benchmark + +``` +$ npm run-script bench + +> escape-html@1.0.3 bench nodejs-escape-html +> node benchmark/index.js + + + http_parser@1.0 + node@0.10.33 + v8@3.14.5.9 + ares@1.9.0-DEV + uv@0.10.29 + zlib@1.2.3 + modules@11 + openssl@1.0.1j + + 1 test completed. + 2 tests completed. + 3 tests completed. + + no special characters x 19,435,271 ops/sec ±0.85% (187 runs sampled) + single special character x 6,132,421 ops/sec ±0.67% (194 runs sampled) + many special characters x 3,175,826 ops/sec ±0.65% (193 runs sampled) +``` + +## License + + MIT \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/escape-html/index.js b/graphql-subscription-express/node_modules/escape-html/index.js new file mode 100644 index 0000000..bf9e226 --- /dev/null +++ b/graphql-subscription-express/node_modules/escape-html/index.js @@ -0,0 +1,78 @@ +/*! + * escape-html + * Copyright(c) 2012-2013 TJ Holowaychuk + * Copyright(c) 2015 Andreas Lubbe + * Copyright(c) 2015 Tiancheng "Timothy" Gu + * MIT Licensed + */ + +'use strict'; + +/** + * Module variables. + * @private + */ + +var matchHtmlRegExp = /["'&<>]/; + +/** + * Module exports. + * @public + */ + +module.exports = escapeHtml; + +/** + * Escape special characters in the given string of html. + * + * @param {string} string The string to escape for inserting into HTML + * @return {string} + * @public + */ + +function escapeHtml(string) { + var str = '' + string; + var match = matchHtmlRegExp.exec(str); + + if (!match) { + return str; + } + + var escape; + var html = ''; + var index = 0; + var lastIndex = 0; + + for (index = match.index; index < str.length; index++) { + switch (str.charCodeAt(index)) { + case 34: // " + escape = '"'; + break; + case 38: // & + escape = '&'; + break; + case 39: // ' + escape = '''; + break; + case 60: // < + escape = '<'; + break; + case 62: // > + escape = '>'; + break; + default: + continue; + } + + if (lastIndex !== index) { + html += str.substring(lastIndex, index); + } + + lastIndex = index + 1; + html += escape; + } + + return lastIndex !== index + ? html + str.substring(lastIndex, index) + : html; +} diff --git a/graphql-subscription-express/node_modules/escape-html/package.json b/graphql-subscription-express/node_modules/escape-html/package.json new file mode 100644 index 0000000..57ec7bd --- /dev/null +++ b/graphql-subscription-express/node_modules/escape-html/package.json @@ -0,0 +1,24 @@ +{ + "name": "escape-html", + "description": "Escape string for use in HTML", + "version": "1.0.3", + "license": "MIT", + "keywords": [ + "escape", + "html", + "utility" + ], + "repository": "component/escape-html", + "devDependencies": { + "benchmark": "1.0.0", + "beautify-benchmark": "0.2.4" + }, + "files": [ + "LICENSE", + "Readme.md", + "index.js" + ], + "scripts": { + "bench": "node benchmark/index.js" + } +} diff --git a/graphql-subscription-express/node_modules/etag/HISTORY.md b/graphql-subscription-express/node_modules/etag/HISTORY.md new file mode 100644 index 0000000..222b293 --- /dev/null +++ b/graphql-subscription-express/node_modules/etag/HISTORY.md @@ -0,0 +1,83 @@ +1.8.1 / 2017-09-12 +================== + + * perf: replace regular expression with substring + +1.8.0 / 2017-02-18 +================== + + * Use SHA1 instead of MD5 for ETag hashing + - Improves performance for larger entities + - Works with FIPS 140-2 OpenSSL configuration + +1.7.0 / 2015-06-08 +================== + + * Always include entity length in ETags for hash length extensions + * Generate non-Stats ETags using MD5 only (no longer CRC32) + * Improve stat performance by removing hashing + * Remove base64 padding in ETags to shorten + * Use MD5 instead of MD4 in weak ETags over 1KB + +1.6.0 / 2015-05-10 +================== + + * Improve support for JXcore + * Remove requirement of `atime` in the stats object + * Support "fake" stats objects in environments without `fs` + +1.5.1 / 2014-11-19 +================== + + * deps: crc@3.2.1 + - Minor fixes + +1.5.0 / 2014-10-14 +================== + + * Improve string performance + * Slightly improve speed for weak ETags over 1KB + +1.4.0 / 2014-09-21 +================== + + * Support "fake" stats objects + * Support Node.js 0.6 + +1.3.1 / 2014-09-14 +================== + + * Use the (new and improved) `crc` for crc32 + +1.3.0 / 2014-08-29 +================== + + * Default strings to strong ETags + * Improve speed for weak ETags over 1KB + +1.2.1 / 2014-08-29 +================== + + * Use the (much faster) `buffer-crc32` for crc32 + +1.2.0 / 2014-08-24 +================== + + * Add support for file stat objects + +1.1.0 / 2014-08-24 +================== + + * Add fast-path for empty entity + * Add weak ETag generation + * Shrink size of generated ETags + +1.0.1 / 2014-08-24 +================== + + * Fix behavior of string containing Unicode + +1.0.0 / 2014-05-18 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/etag/LICENSE b/graphql-subscription-express/node_modules/etag/LICENSE new file mode 100644 index 0000000..cab251c --- /dev/null +++ b/graphql-subscription-express/node_modules/etag/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/etag/README.md b/graphql-subscription-express/node_modules/etag/README.md new file mode 100644 index 0000000..09c2169 --- /dev/null +++ b/graphql-subscription-express/node_modules/etag/README.md @@ -0,0 +1,159 @@ +# etag + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Create simple HTTP ETags + +This module generates HTTP ETags (as defined in RFC 7232) for use in +HTTP responses. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install etag +``` + +## API + + + +```js +var etag = require('etag') +``` + +### etag(entity, [options]) + +Generate a strong ETag for the given entity. This should be the complete +body of the entity. Strings, `Buffer`s, and `fs.Stats` are accepted. By +default, a strong ETag is generated except for `fs.Stats`, which will +generate a weak ETag (this can be overwritten by `options.weak`). + + + +```js +res.setHeader('ETag', etag(body)) +``` + +#### Options + +`etag` accepts these properties in the options object. + +##### weak + +Specifies if the generated ETag will include the weak validator mark (that +is, the leading `W/`). The actual entity tag is the same. The default value +is `false`, unless the `entity` is `fs.Stats`, in which case it is `true`. + +## Testing + +```sh +$ npm test +``` + +## Benchmark + +```bash +$ npm run-script bench + +> etag@1.8.1 bench nodejs-etag +> node benchmark/index.js + + http_parser@2.7.0 + node@6.11.1 + v8@5.1.281.103 + uv@1.11.0 + zlib@1.2.11 + ares@1.10.1-DEV + icu@58.2 + modules@48 + openssl@1.0.2k + +> node benchmark/body0-100b.js + + 100B body + + 4 tests completed. + + buffer - strong x 258,647 ops/sec ±1.07% (180 runs sampled) + buffer - weak x 263,812 ops/sec ±0.61% (184 runs sampled) + string - strong x 259,955 ops/sec ±1.19% (185 runs sampled) + string - weak x 264,356 ops/sec ±1.09% (184 runs sampled) + +> node benchmark/body1-1kb.js + + 1KB body + + 4 tests completed. + + buffer - strong x 189,018 ops/sec ±1.12% (182 runs sampled) + buffer - weak x 190,586 ops/sec ±0.81% (186 runs sampled) + string - strong x 144,272 ops/sec ±0.96% (188 runs sampled) + string - weak x 145,380 ops/sec ±1.43% (187 runs sampled) + +> node benchmark/body2-5kb.js + + 5KB body + + 4 tests completed. + + buffer - strong x 92,435 ops/sec ±0.42% (188 runs sampled) + buffer - weak x 92,373 ops/sec ±0.58% (189 runs sampled) + string - strong x 48,850 ops/sec ±0.56% (186 runs sampled) + string - weak x 49,380 ops/sec ±0.56% (190 runs sampled) + +> node benchmark/body3-10kb.js + + 10KB body + + 4 tests completed. + + buffer - strong x 55,989 ops/sec ±0.93% (188 runs sampled) + buffer - weak x 56,148 ops/sec ±0.55% (190 runs sampled) + string - strong x 27,345 ops/sec ±0.43% (188 runs sampled) + string - weak x 27,496 ops/sec ±0.45% (190 runs sampled) + +> node benchmark/body4-100kb.js + + 100KB body + + 4 tests completed. + + buffer - strong x 7,083 ops/sec ±0.22% (190 runs sampled) + buffer - weak x 7,115 ops/sec ±0.26% (191 runs sampled) + string - strong x 3,068 ops/sec ±0.34% (190 runs sampled) + string - weak x 3,096 ops/sec ±0.35% (190 runs sampled) + +> node benchmark/stats.js + + stat + + 4 tests completed. + + real - strong x 871,642 ops/sec ±0.34% (189 runs sampled) + real - weak x 867,613 ops/sec ±0.39% (190 runs sampled) + fake - strong x 401,051 ops/sec ±0.40% (189 runs sampled) + fake - weak x 400,100 ops/sec ±0.47% (188 runs sampled) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/etag.svg +[npm-url]: https://npmjs.org/package/etag +[node-version-image]: https://img.shields.io/node/v/etag.svg +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/jshttp/etag/master.svg +[travis-url]: https://travis-ci.org/jshttp/etag +[coveralls-image]: https://img.shields.io/coveralls/jshttp/etag/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/etag?branch=master +[downloads-image]: https://img.shields.io/npm/dm/etag.svg +[downloads-url]: https://npmjs.org/package/etag diff --git a/graphql-subscription-express/node_modules/etag/index.js b/graphql-subscription-express/node_modules/etag/index.js new file mode 100644 index 0000000..2a585c9 --- /dev/null +++ b/graphql-subscription-express/node_modules/etag/index.js @@ -0,0 +1,131 @@ +/*! + * etag + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = etag + +/** + * Module dependencies. + * @private + */ + +var crypto = require('crypto') +var Stats = require('fs').Stats + +/** + * Module variables. + * @private + */ + +var toString = Object.prototype.toString + +/** + * Generate an entity tag. + * + * @param {Buffer|string} entity + * @return {string} + * @private + */ + +function entitytag (entity) { + if (entity.length === 0) { + // fast-path empty + return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"' + } + + // compute hash of entity + var hash = crypto + .createHash('sha1') + .update(entity, 'utf8') + .digest('base64') + .substring(0, 27) + + // compute length of entity + var len = typeof entity === 'string' + ? Buffer.byteLength(entity, 'utf8') + : entity.length + + return '"' + len.toString(16) + '-' + hash + '"' +} + +/** + * Create a simple ETag. + * + * @param {string|Buffer|Stats} entity + * @param {object} [options] + * @param {boolean} [options.weak] + * @return {String} + * @public + */ + +function etag (entity, options) { + if (entity == null) { + throw new TypeError('argument entity is required') + } + + // support fs.Stats object + var isStats = isstats(entity) + var weak = options && typeof options.weak === 'boolean' + ? options.weak + : isStats + + // validate argument + if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) { + throw new TypeError('argument entity must be string, Buffer, or fs.Stats') + } + + // generate entity tag + var tag = isStats + ? stattag(entity) + : entitytag(entity) + + return weak + ? 'W/' + tag + : tag +} + +/** + * Determine if object is a Stats object. + * + * @param {object} obj + * @return {boolean} + * @api private + */ + +function isstats (obj) { + // genuine fs.Stats + if (typeof Stats === 'function' && obj instanceof Stats) { + return true + } + + // quack quack + return obj && typeof obj === 'object' && + 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' && + 'mtime' in obj && toString.call(obj.mtime) === '[object Date]' && + 'ino' in obj && typeof obj.ino === 'number' && + 'size' in obj && typeof obj.size === 'number' +} + +/** + * Generate a tag for a stat. + * + * @param {object} stat + * @return {string} + * @private + */ + +function stattag (stat) { + var mtime = stat.mtime.getTime().toString(16) + var size = stat.size.toString(16) + + return '"' + size + '-' + mtime + '"' +} diff --git a/graphql-subscription-express/node_modules/etag/package.json b/graphql-subscription-express/node_modules/etag/package.json new file mode 100644 index 0000000..b06ab80 --- /dev/null +++ b/graphql-subscription-express/node_modules/etag/package.json @@ -0,0 +1,47 @@ +{ + "name": "etag", + "description": "Create simple HTTP ETags", + "version": "1.8.1", + "contributors": [ + "Douglas Christopher Wilson ", + "David Björklund " + ], + "license": "MIT", + "keywords": [ + "etag", + "http", + "res" + ], + "repository": "jshttp/etag", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5", + "safe-buffer": "5.1.1", + "seedrandom": "2.4.3" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/express/History.md b/graphql-subscription-express/node_modules/express/History.md new file mode 100644 index 0000000..ac2e7cf --- /dev/null +++ b/graphql-subscription-express/node_modules/express/History.md @@ -0,0 +1,3615 @@ +4.19.2 / 2024-03-25 +========== + + * Improved fix for open redirect allow list bypass + +4.19.1 / 2024-03-20 +========== + + * Allow passing non-strings to res.location with new encoding handling checks + +4.19.0 / 2024-03-20 +========== + + * Prevent open redirect allow list bypass due to encodeurl + * deps: cookie@0.6.0 + +4.18.3 / 2024-02-29 +========== + + * Fix routing requests without method + * deps: body-parser@1.20.2 + - Fix strict json error message on Node.js 19+ + - deps: content-type@~1.0.5 + - deps: raw-body@2.5.2 + * deps: cookie@0.6.0 + - Add `partitioned` option + +4.18.2 / 2022-10-08 +=================== + + * Fix regression routing a large stack in a single route + * deps: body-parser@1.20.1 + - deps: qs@6.11.0 + - perf: remove unnecessary object clone + * deps: qs@6.11.0 + +4.18.1 / 2022-04-29 +=================== + + * Fix hanging on large stack of sync routes + +4.18.0 / 2022-04-25 +=================== + + * Add "root" option to `res.download` + * Allow `options` without `filename` in `res.download` + * Deprecate string and non-integer arguments to `res.status` + * Fix behavior of `null`/`undefined` as `maxAge` in `res.cookie` + * Fix handling very large stacks of sync middleware + * Ignore `Object.prototype` values in settings through `app.set`/`app.get` + * Invoke `default` with same arguments as types in `res.format` + * Support proper 205 responses using `res.send` + * Use `http-errors` for `res.format` error + * deps: body-parser@1.20.0 + - Fix error message for json parse whitespace in `strict` + - Fix internal error when inflated body exceeds limit + - Prevent loss of async hooks context + - Prevent hanging when request already read + - deps: depd@2.0.0 + - deps: http-errors@2.0.0 + - deps: on-finished@2.4.1 + - deps: qs@6.10.3 + - deps: raw-body@2.5.1 + * deps: cookie@0.5.0 + - Add `priority` option + - Fix `expires` option to reject invalid dates + * deps: depd@2.0.0 + - Replace internal `eval` usage with `Function` constructor + - Use instance methods on `process` to check for listeners + * deps: finalhandler@1.2.0 + - Remove set content headers that break response + - deps: on-finished@2.4.1 + - deps: statuses@2.0.1 + * deps: on-finished@2.4.1 + - Prevent loss of async hooks context + * deps: qs@6.10.3 + * deps: send@0.18.0 + - Fix emitted 416 error missing headers property + - Limit the headers removed for 304 response + - deps: depd@2.0.0 + - deps: destroy@1.2.0 + - deps: http-errors@2.0.0 + - deps: on-finished@2.4.1 + - deps: statuses@2.0.1 + * deps: serve-static@1.15.0 + - deps: send@0.18.0 + * deps: statuses@2.0.1 + - Remove code 306 + - Rename `425 Unordered Collection` to standard `425 Too Early` + +4.17.3 / 2022-02-16 +=================== + + * deps: accepts@~1.3.8 + - deps: mime-types@~2.1.34 + - deps: negotiator@0.6.3 + * deps: body-parser@1.19.2 + - deps: bytes@3.1.2 + - deps: qs@6.9.7 + - deps: raw-body@2.4.3 + * deps: cookie@0.4.2 + * deps: qs@6.9.7 + * Fix handling of `__proto__` keys + * pref: remove unnecessary regexp for trust proxy + +4.17.2 / 2021-12-16 +=================== + + * Fix handling of `undefined` in `res.jsonp` + * Fix handling of `undefined` when `"json escape"` is enabled + * Fix incorrect middleware execution with unanchored `RegExp`s + * Fix `res.jsonp(obj, status)` deprecation message + * Fix typo in `res.is` JSDoc + * deps: body-parser@1.19.1 + - deps: bytes@3.1.1 + - deps: http-errors@1.8.1 + - deps: qs@6.9.6 + - deps: raw-body@2.4.2 + - deps: safe-buffer@5.2.1 + - deps: type-is@~1.6.18 + * deps: content-disposition@0.5.4 + - deps: safe-buffer@5.2.1 + * deps: cookie@0.4.1 + - Fix `maxAge` option to reject invalid values + * deps: proxy-addr@~2.0.7 + - Use `req.socket` over deprecated `req.connection` + - deps: forwarded@0.2.0 + - deps: ipaddr.js@1.9.1 + * deps: qs@6.9.6 + * deps: safe-buffer@5.2.1 + * deps: send@0.17.2 + - deps: http-errors@1.8.1 + - deps: ms@2.1.3 + - pref: ignore empty http tokens + * deps: serve-static@1.14.2 + - deps: send@0.17.2 + * deps: setprototypeof@1.2.0 + +4.17.1 / 2019-05-25 +=================== + + * Revert "Improve error message for `null`/`undefined` to `res.status`" + +4.17.0 / 2019-05-16 +=================== + + * Add `express.raw` to parse bodies into `Buffer` + * Add `express.text` to parse bodies into string + * Improve error message for non-strings to `res.sendFile` + * Improve error message for `null`/`undefined` to `res.status` + * Support multiple hosts in `X-Forwarded-Host` + * deps: accepts@~1.3.7 + * deps: body-parser@1.19.0 + - Add encoding MIK + - Add petabyte (`pb`) support + - Fix parsing array brackets after index + - deps: bytes@3.1.0 + - deps: http-errors@1.7.2 + - deps: iconv-lite@0.4.24 + - deps: qs@6.7.0 + - deps: raw-body@2.4.0 + - deps: type-is@~1.6.17 + * deps: content-disposition@0.5.3 + * deps: cookie@0.4.0 + - Add `SameSite=None` support + * deps: finalhandler@~1.1.2 + - Set stricter `Content-Security-Policy` header + - deps: parseurl@~1.3.3 + - deps: statuses@~1.5.0 + * deps: parseurl@~1.3.3 + * deps: proxy-addr@~2.0.5 + - deps: ipaddr.js@1.9.0 + * deps: qs@6.7.0 + - Fix parsing array brackets after index + * deps: range-parser@~1.2.1 + * deps: send@0.17.1 + - Set stricter CSP header in redirect & error responses + - deps: http-errors@~1.7.2 + - deps: mime@1.6.0 + - deps: ms@2.1.1 + - deps: range-parser@~1.2.1 + - deps: statuses@~1.5.0 + - perf: remove redundant `path.normalize` call + * deps: serve-static@1.14.1 + - Set stricter CSP header in redirect response + - deps: parseurl@~1.3.3 + - deps: send@0.17.1 + * deps: setprototypeof@1.1.1 + * deps: statuses@~1.5.0 + - Add `103 Early Hints` + * deps: type-is@~1.6.18 + - deps: mime-types@~2.1.24 + - perf: prevent internal `throw` on invalid type + +4.16.4 / 2018-10-10 +=================== + + * Fix issue where `"Request aborted"` may be logged in `res.sendfile` + * Fix JSDoc for `Router` constructor + * deps: body-parser@1.18.3 + - Fix deprecation warnings on Node.js 10+ + - Fix stack trace for strict json parse error + - deps: depd@~1.1.2 + - deps: http-errors@~1.6.3 + - deps: iconv-lite@0.4.23 + - deps: qs@6.5.2 + - deps: raw-body@2.3.3 + - deps: type-is@~1.6.16 + * deps: proxy-addr@~2.0.4 + - deps: ipaddr.js@1.8.0 + * deps: qs@6.5.2 + * deps: safe-buffer@5.1.2 + +4.16.3 / 2018-03-12 +=================== + + * deps: accepts@~1.3.5 + - deps: mime-types@~2.1.18 + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: encodeurl@~1.0.2 + - Fix encoding `%` as last character + * deps: finalhandler@1.1.1 + - Fix 404 output for bad / missing pathnames + - deps: encodeurl@~1.0.2 + - deps: statuses@~1.4.0 + * deps: proxy-addr@~2.0.3 + - deps: ipaddr.js@1.6.0 + * deps: send@0.16.2 + - Fix incorrect end tag in default error & redirects + - deps: depd@~1.1.2 + - deps: encodeurl@~1.0.2 + - deps: statuses@~1.4.0 + * deps: serve-static@1.13.2 + - Fix incorrect end tag in redirects + - deps: encodeurl@~1.0.2 + - deps: send@0.16.2 + * deps: statuses@~1.4.0 + * deps: type-is@~1.6.16 + - deps: mime-types@~2.1.18 + +4.16.2 / 2017-10-09 +=================== + + * Fix `TypeError` in `res.send` when given `Buffer` and `ETag` header set + * perf: skip parsing of entire `X-Forwarded-Proto` header + +4.16.1 / 2017-09-29 +=================== + + * deps: send@0.16.1 + * deps: serve-static@1.13.1 + - Fix regression when `root` is incorrectly set to a file + - deps: send@0.16.1 + +4.16.0 / 2017-09-28 +=================== + + * Add `"json escape"` setting for `res.json` and `res.jsonp` + * Add `express.json` and `express.urlencoded` to parse bodies + * Add `options` argument to `res.download` + * Improve error message when autoloading invalid view engine + * Improve error messages when non-function provided as middleware + * Skip `Buffer` encoding when not generating ETag for small response + * Use `safe-buffer` for improved Buffer API + * deps: accepts@~1.3.4 + - deps: mime-types@~2.1.16 + * deps: content-type@~1.0.4 + - perf: remove argument reassignment + - perf: skip parameter parsing when no parameters + * deps: etag@~1.8.1 + - perf: replace regular expression with substring + * deps: finalhandler@1.1.0 + - Use `res.headersSent` when available + * deps: parseurl@~1.3.2 + - perf: reduce overhead for full URLs + - perf: unroll the "fast-path" `RegExp` + * deps: proxy-addr@~2.0.2 + - Fix trimming leading / trailing OWS in `X-Forwarded-For` + - deps: forwarded@~0.1.2 + - deps: ipaddr.js@1.5.2 + - perf: reduce overhead when no `X-Forwarded-For` header + * deps: qs@6.5.1 + - Fix parsing & compacting very deep objects + * deps: send@0.16.0 + - Add 70 new types for file extensions + - Add `immutable` option + - Fix missing `` in default error & redirects + - Set charset as "UTF-8" for .js and .json + - Use instance methods on steam to check for listeners + - deps: mime@1.4.1 + - perf: improve path validation speed + * deps: serve-static@1.13.0 + - Add 70 new types for file extensions + - Add `immutable` option + - Set charset as "UTF-8" for .js and .json + - deps: send@0.16.0 + * deps: setprototypeof@1.1.0 + * deps: utils-merge@1.0.1 + * deps: vary@~1.1.2 + - perf: improve header token parsing speed + * perf: re-use options object when generating ETags + * perf: remove dead `.charset` set in `res.jsonp` + +4.15.5 / 2017-09-24 +=================== + + * deps: debug@2.6.9 + * deps: finalhandler@~1.0.6 + - deps: debug@2.6.9 + - deps: parseurl@~1.3.2 + * deps: fresh@0.5.2 + - Fix handling of modified headers with invalid dates + - perf: improve ETag match loop + - perf: improve `If-None-Match` token parsing + * deps: send@0.15.6 + - Fix handling of modified headers with invalid dates + - deps: debug@2.6.9 + - deps: etag@~1.8.1 + - deps: fresh@0.5.2 + - perf: improve `If-Match` token parsing + * deps: serve-static@1.12.6 + - deps: parseurl@~1.3.2 + - deps: send@0.15.6 + - perf: improve slash collapsing + +4.15.4 / 2017-08-06 +=================== + + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: finalhandler@~1.0.4 + - deps: debug@2.6.8 + * deps: proxy-addr@~1.1.5 + - Fix array argument being altered + - deps: ipaddr.js@1.4.0 + * deps: qs@6.5.0 + * deps: send@0.15.4 + - deps: debug@2.6.8 + - deps: depd@~1.1.1 + - deps: http-errors@~1.6.2 + * deps: serve-static@1.12.4 + - deps: send@0.15.4 + +4.15.3 / 2017-05-16 +=================== + + * Fix error when `res.set` cannot add charset to `Content-Type` + * deps: debug@2.6.7 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@2.0.0 + * deps: finalhandler@~1.0.3 + - Fix missing `` in HTML document + - deps: debug@2.6.7 + * deps: proxy-addr@~1.1.4 + - deps: ipaddr.js@1.3.0 + * deps: send@0.15.3 + - deps: debug@2.6.7 + - deps: ms@2.0.0 + * deps: serve-static@1.12.3 + - deps: send@0.15.3 + * deps: type-is@~1.6.15 + - deps: mime-types@~2.1.15 + * deps: vary@~1.1.1 + - perf: hoist regular expression + +4.15.2 / 2017-03-06 +=================== + + * deps: qs@6.4.0 + - Fix regression parsing keys starting with `[` + +4.15.1 / 2017-03-05 +=================== + + * deps: send@0.15.1 + - Fix issue when `Date.parse` does not return `NaN` on invalid date + - Fix strict violation in broken environments + * deps: serve-static@1.12.1 + - Fix issue when `Date.parse` does not return `NaN` on invalid date + - deps: send@0.15.1 + +4.15.0 / 2017-03-01 +=================== + + * Add debug message when loading view engine + * Add `next("router")` to exit from router + * Fix case where `router.use` skipped requests routes did not + * Remove usage of `res._headers` private field + - Improves compatibility with Node.js 8 nightly + * Skip routing when `req.url` is not set + * Use `%o` in path debug to tell types apart + * Use `Object.create` to setup request & response prototypes + * Use `setprototypeof` module to replace `__proto__` setting + * Use `statuses` instead of `http` module for status messages + * deps: debug@2.6.1 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable set to `3` or higher + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: etag@~1.8.0 + - Use SHA1 instead of MD5 for ETag hashing + - Works with FIPS 140-2 OpenSSL configuration + * deps: finalhandler@~1.0.0 + - Fix exception when `err` cannot be converted to a string + - Fully URL-encode the pathname in the 404 + - Only include the pathname in the 404 message + - Send complete HTML document + - Set `Content-Security-Policy: default-src 'self'` header + - deps: debug@2.6.1 + * deps: fresh@0.5.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - perf: delay reading header values until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove duplicate conditional + - perf: remove unnecessary boolean coercions + - perf: skip checking modified time if ETag check failed + - perf: skip parsing `If-None-Match` when no `ETag` header + - perf: use `Date.parse` instead of `new Date` + * deps: qs@6.3.1 + - Fix array parsing from skipping empty values + - Fix compacting nested arrays + * deps: send@0.15.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - Remove usage of `res._headers` private field + - Support `If-Match` and `If-Unmodified-Since` headers + - Use `res.getHeaderNames()` when available + - Use `res.headersSent` when available + - deps: debug@2.6.1 + - deps: etag@~1.8.0 + - deps: fresh@0.5.0 + - deps: http-errors@~1.6.1 + * deps: serve-static@1.12.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - Remove usage of `res._headers` private field + - Send complete HTML document in redirect response + - Set default CSP header in redirect response + - Support `If-Match` and `If-Unmodified-Since` headers + - Use `res.getHeaderNames()` when available + - Use `res.headersSent` when available + - deps: send@0.15.0 + * perf: add fast match path for `*` route + * perf: improve `req.ips` performance + +4.14.1 / 2017-01-28 +=================== + + * deps: content-disposition@0.5.2 + * deps: finalhandler@0.5.1 + - Fix exception when `err.headers` is not an object + - deps: statuses@~1.3.1 + - perf: hoist regular expressions + - perf: remove duplicate validation path + * deps: proxy-addr@~1.1.3 + - deps: ipaddr.js@1.2.0 + * deps: send@0.14.2 + - deps: http-errors@~1.5.1 + - deps: ms@0.7.2 + - deps: statuses@~1.3.1 + * deps: serve-static@~1.11.2 + - deps: send@0.14.2 + * deps: type-is@~1.6.14 + - deps: mime-types@~2.1.13 + +4.14.0 / 2016-06-16 +=================== + + * Add `acceptRanges` option to `res.sendFile`/`res.sendfile` + * Add `cacheControl` option to `res.sendFile`/`res.sendfile` + * Add `options` argument to `req.range` + - Includes the `combine` option + * Encode URL in `res.location`/`res.redirect` if not already encoded + * Fix some redirect handling in `res.sendFile`/`res.sendfile` + * Fix Windows absolute path check using forward slashes + * Improve error with invalid arguments to `req.get()` + * Improve performance for `res.json`/`res.jsonp` in most cases + * Improve `Range` header handling in `res.sendFile`/`res.sendfile` + * deps: accepts@~1.3.3 + - Fix including type extensions in parameters in `Accept` parsing + - Fix parsing `Accept` parameters with quoted equals + - Fix parsing `Accept` parameters with quoted semicolons + - Many performance improvements + - deps: mime-types@~2.1.11 + - deps: negotiator@0.6.1 + * deps: content-type@~1.0.2 + - perf: enable strict mode + * deps: cookie@0.3.1 + - Add `sameSite` option + - Fix cookie `Max-Age` to never be a floating point number + - Improve error message when `encode` is not a function + - Improve error message when `expires` is not a `Date` + - Throw better error for invalid argument to parse + - Throw on invalid values provided to `serialize` + - perf: enable strict mode + - perf: hoist regular expression + - perf: use for loop in parse + - perf: use string concatenation for serialization + * deps: finalhandler@0.5.0 + - Change invalid or non-numeric status code to 500 + - Overwrite status message to match set status code + - Prefer `err.statusCode` if `err.status` is invalid + - Set response headers from `err.headers` object + - Use `statuses` instead of `http` module for status messages + * deps: proxy-addr@~1.1.2 + - Fix accepting various invalid netmasks + - Fix IPv6-mapped IPv4 validation edge cases + - IPv4 netmasks must be contiguous + - IPv6 addresses cannot be used as a netmask + - deps: ipaddr.js@1.1.1 + * deps: qs@6.2.0 + - Add `decoder` option in `parse` function + * deps: range-parser@~1.2.0 + - Add `combine` option to combine overlapping ranges + - Fix incorrectly returning -1 when there is at least one valid range + - perf: remove internal function + * deps: send@0.14.1 + - Add `acceptRanges` option + - Add `cacheControl` option + - Attempt to combine multiple ranges into single range + - Correctly inherit from `Stream` class + - Fix `Content-Range` header in 416 responses when using `start`/`end` options + - Fix `Content-Range` header missing from default 416 responses + - Fix redirect error when `path` contains raw non-URL characters + - Fix redirect when `path` starts with multiple forward slashes + - Ignore non-byte `Range` headers + - deps: http-errors@~1.5.0 + - deps: range-parser@~1.2.0 + - deps: statuses@~1.3.0 + - perf: remove argument reassignment + * deps: serve-static@~1.11.1 + - Add `acceptRanges` option + - Add `cacheControl` option + - Attempt to combine multiple ranges into single range + - Fix redirect error when `req.url` contains raw non-URL characters + - Ignore non-byte `Range` headers + - Use status code 301 for redirects + - deps: send@0.14.1 + * deps: type-is@~1.6.13 + - Fix type error when given invalid type to match against + - deps: mime-types@~2.1.11 + * deps: vary@~1.1.0 + - Only accept valid field names in the `field` argument + * perf: use strict equality when possible + +4.13.4 / 2016-01-21 +=================== + + * deps: content-disposition@0.5.1 + - perf: enable strict mode + * deps: cookie@0.1.5 + - Throw on invalid values provided to `serialize` + * deps: depd@~1.1.0 + - Support web browser loading + - perf: enable strict mode + * deps: escape-html@~1.0.3 + - perf: enable strict mode + - perf: optimize string replacement + - perf: use faster string coercion + * deps: finalhandler@0.4.1 + - deps: escape-html@~1.0.3 + * deps: merge-descriptors@1.0.1 + - perf: enable strict mode + * deps: methods@~1.1.2 + - perf: enable strict mode + * deps: parseurl@~1.3.1 + - perf: enable strict mode + * deps: proxy-addr@~1.0.10 + - deps: ipaddr.js@1.0.5 + - perf: enable strict mode + * deps: range-parser@~1.0.3 + - perf: enable strict mode + * deps: send@0.13.1 + - deps: depd@~1.1.0 + - deps: destroy@~1.0.4 + - deps: escape-html@~1.0.3 + - deps: range-parser@~1.0.3 + * deps: serve-static@~1.10.2 + - deps: escape-html@~1.0.3 + - deps: parseurl@~1.3.0 + - deps: send@0.13.1 + +4.13.3 / 2015-08-02 +=================== + + * Fix infinite loop condition using `mergeParams: true` + * Fix inner numeric indices incorrectly altering parent `req.params` + +4.13.2 / 2015-07-31 +=================== + + * deps: accepts@~1.2.12 + - deps: mime-types@~2.1.4 + * deps: array-flatten@1.1.1 + - perf: enable strict mode + * deps: path-to-regexp@0.1.7 + - Fix regression with escaped round brackets and matching groups + * deps: type-is@~1.6.6 + - deps: mime-types@~2.1.4 + +4.13.1 / 2015-07-05 +=================== + + * deps: accepts@~1.2.10 + - deps: mime-types@~2.1.2 + * deps: qs@4.0.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix various parsing edge cases + * deps: type-is@~1.6.4 + - deps: mime-types@~2.1.2 + - perf: enable strict mode + - perf: remove argument reassignment + +4.13.0 / 2015-06-20 +=================== + + * Add settings to debug output + * Fix `res.format` error when only `default` provided + * Fix issue where `next('route')` in `app.param` would incorrectly skip values + * Fix hiding platform issues with `decodeURIComponent` + - Only `URIError`s are a 400 + * Fix using `*` before params in routes + * Fix using capture groups before params in routes + * Simplify `res.cookie` to call `res.append` + * Use `array-flatten` module for flattening arrays + * deps: accepts@~1.2.9 + - deps: mime-types@~2.1.1 + - perf: avoid argument reassignment & argument slice + - perf: avoid negotiator recursive construction + - perf: enable strict mode + - perf: remove unnecessary bitwise operator + * deps: cookie@0.1.3 + - perf: deduce the scope of try-catch deopt + - perf: remove argument reassignments + * deps: escape-html@1.0.2 + * deps: etag@~1.7.0 + - Always include entity length in ETags for hash length extensions + - Generate non-Stats ETags using MD5 only (no longer CRC32) + - Improve stat performance by removing hashing + - Improve support for JXcore + - Remove base64 padding in ETags to shorten + - Support "fake" stats objects in environments without fs + - Use MD5 instead of MD4 in weak ETags over 1KB + * deps: finalhandler@0.4.0 + - Fix a false-positive when unpiping in Node.js 0.8 + - Support `statusCode` property on `Error` objects + - Use `unpipe` module for unpiping requests + - deps: escape-html@1.0.2 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove argument reassignment + * deps: fresh@0.3.0 + - Add weak `ETag` matching support + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * deps: path-to-regexp@0.1.6 + * deps: send@0.13.0 + - Allow Node.js HTTP server to set `Date` response header + - Fix incorrectly removing `Content-Location` on 304 response + - Improve the default redirect response headers + - Send appropriate headers on default error response + - Use `http-errors` for standard emitted errors + - Use `statuses` instead of `http` module for status messages + - deps: escape-html@1.0.2 + - deps: etag@~1.7.0 + - deps: fresh@0.3.0 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove unnecessary array allocations + * deps: serve-static@~1.10.0 + - Add `fallthrough` option + - Fix reading options from options prototype + - Improve the default redirect response headers + - Malformed URLs now `next()` instead of 400 + - deps: escape-html@1.0.2 + - deps: send@0.13.0 + - perf: enable strict mode + - perf: remove argument reassignment + * deps: type-is@~1.6.3 + - deps: mime-types@~2.1.1 + - perf: reduce try block size + - perf: remove bitwise operations + * perf: enable strict mode + * perf: isolate `app.render` try block + * perf: remove argument reassignments in application + * perf: remove argument reassignments in request prototype + * perf: remove argument reassignments in response prototype + * perf: remove argument reassignments in routing + * perf: remove argument reassignments in `View` + * perf: skip attempting to decode zero length string + * perf: use saved reference to `http.STATUS_CODES` + +4.12.4 / 2015-05-17 +=================== + + * deps: accepts@~1.2.7 + - deps: mime-types@~2.0.11 + - deps: negotiator@0.5.3 + * deps: debug@~2.2.0 + - deps: ms@0.7.1 + * deps: depd@~1.0.1 + * deps: etag@~1.6.0 + - Improve support for JXcore + - Support "fake" stats objects in environments without `fs` + * deps: finalhandler@0.3.6 + - deps: debug@~2.2.0 + - deps: on-finished@~2.2.1 + * deps: on-finished@~2.2.1 + - Fix `isFinished(req)` when data buffered + * deps: proxy-addr@~1.0.8 + - deps: ipaddr.js@1.0.1 + * deps: qs@2.4.2 + - Fix allowing parameters like `constructor` + * deps: send@0.12.3 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: etag@~1.6.0 + - deps: ms@0.7.1 + - deps: on-finished@~2.2.1 + * deps: serve-static@~1.9.3 + - deps: send@0.12.3 + * deps: type-is@~1.6.2 + - deps: mime-types@~2.0.11 + +4.12.3 / 2015-03-17 +=================== + + * deps: accepts@~1.2.5 + - deps: mime-types@~2.0.10 + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: finalhandler@0.3.4 + - deps: debug@~2.1.3 + * deps: proxy-addr@~1.0.7 + - deps: ipaddr.js@0.1.9 + * deps: qs@2.4.1 + - Fix error when parameter `hasOwnProperty` is present + * deps: send@0.12.2 + - Throw errors early for invalid `extensions` or `index` options + - deps: debug@~2.1.3 + * deps: serve-static@~1.9.2 + - deps: send@0.12.2 + * deps: type-is@~1.6.1 + - deps: mime-types@~2.0.10 + +4.12.2 / 2015-03-02 +=================== + + * Fix regression where `"Request aborted"` is logged using `res.sendFile` + +4.12.1 / 2015-03-01 +=================== + + * Fix constructing application with non-configurable prototype properties + * Fix `ECONNRESET` errors from `res.sendFile` usage + * Fix `req.host` when using "trust proxy" hops count + * Fix `req.protocol`/`req.secure` when using "trust proxy" hops count + * Fix wrong `code` on aborted connections from `res.sendFile` + * deps: merge-descriptors@1.0.0 + +4.12.0 / 2015-02-23 +=================== + + * Fix `"trust proxy"` setting to inherit when app is mounted + * Generate `ETag`s for all request responses + - No longer restricted to only responses for `GET` and `HEAD` requests + * Use `content-type` to parse `Content-Type` headers + * deps: accepts@~1.2.4 + - Fix preference sorting to be stable for long acceptable lists + - deps: mime-types@~2.0.9 + - deps: negotiator@0.5.1 + * deps: cookie-signature@1.0.6 + * deps: send@0.12.1 + - Always read the stat size from the file + - Fix mutating passed-in `options` + - deps: mime@1.3.4 + * deps: serve-static@~1.9.1 + - deps: send@0.12.1 + * deps: type-is@~1.6.0 + - fix argument reassignment + - fix false-positives in `hasBody` `Transfer-Encoding` check + - support wildcard for both type and subtype (`*/*`) + - deps: mime-types@~2.0.9 + +4.11.2 / 2015-02-01 +=================== + + * Fix `res.redirect` double-calling `res.end` for `HEAD` requests + * deps: accepts@~1.2.3 + - deps: mime-types@~2.0.8 + * deps: proxy-addr@~1.0.6 + - deps: ipaddr.js@0.1.8 + * deps: type-is@~1.5.6 + - deps: mime-types@~2.0.8 + +4.11.1 / 2015-01-20 +=================== + + * deps: send@0.11.1 + - Fix root path disclosure + * deps: serve-static@~1.8.1 + - Fix redirect loop in Node.js 0.11.14 + - Fix root path disclosure + - deps: send@0.11.1 + +4.11.0 / 2015-01-13 +=================== + + * Add `res.append(field, val)` to append headers + * Deprecate leading `:` in `name` for `app.param(name, fn)` + * Deprecate `req.param()` -- use `req.params`, `req.body`, or `req.query` instead + * Deprecate `app.param(fn)` + * Fix `OPTIONS` responses to include the `HEAD` method properly + * Fix `res.sendFile` not always detecting aborted connection + * Match routes iteratively to prevent stack overflows + * deps: accepts@~1.2.2 + - deps: mime-types@~2.0.7 + - deps: negotiator@0.5.0 + * deps: send@0.11.0 + - deps: debug@~2.1.1 + - deps: etag@~1.5.1 + - deps: ms@0.7.0 + - deps: on-finished@~2.2.0 + * deps: serve-static@~1.8.0 + - deps: send@0.11.0 + +4.10.8 / 2015-01-13 +=================== + + * Fix crash from error within `OPTIONS` response handler + * deps: proxy-addr@~1.0.5 + - deps: ipaddr.js@0.1.6 + +4.10.7 / 2015-01-04 +=================== + + * Fix `Allow` header for `OPTIONS` to not contain duplicate methods + * Fix incorrect "Request aborted" for `res.sendFile` when `HEAD` or 304 + * deps: debug@~2.1.1 + * deps: finalhandler@0.3.3 + - deps: debug@~2.1.1 + - deps: on-finished@~2.2.0 + * deps: methods@~1.1.1 + * deps: on-finished@~2.2.0 + * deps: serve-static@~1.7.2 + - Fix potential open redirect when mounted at root + * deps: type-is@~1.5.5 + - deps: mime-types@~2.0.7 + +4.10.6 / 2014-12-12 +=================== + + * Fix exception in `req.fresh`/`req.stale` without response headers + +4.10.5 / 2014-12-10 +=================== + + * Fix `res.send` double-calling `res.end` for `HEAD` requests + * deps: accepts@~1.1.4 + - deps: mime-types@~2.0.4 + * deps: type-is@~1.5.4 + - deps: mime-types@~2.0.4 + +4.10.4 / 2014-11-24 +=================== + + * Fix `res.sendfile` logging standard write errors + +4.10.3 / 2014-11-23 +=================== + + * Fix `res.sendFile` logging standard write errors + * deps: etag@~1.5.1 + * deps: proxy-addr@~1.0.4 + - deps: ipaddr.js@0.1.5 + * deps: qs@2.3.3 + - Fix `arrayLimit` behavior + +4.10.2 / 2014-11-09 +=================== + + * Correctly invoke async router callback asynchronously + * deps: accepts@~1.1.3 + - deps: mime-types@~2.0.3 + * deps: type-is@~1.5.3 + - deps: mime-types@~2.0.3 + +4.10.1 / 2014-10-28 +=================== + + * Fix handling of URLs containing `://` in the path + * deps: qs@2.3.2 + - Fix parsing of mixed objects and values + +4.10.0 / 2014-10-23 +=================== + + * Add support for `app.set('views', array)` + - Views are looked up in sequence in array of directories + * Fix `res.send(status)` to mention `res.sendStatus(status)` + * Fix handling of invalid empty URLs + * Use `content-disposition` module for `res.attachment`/`res.download` + - Sends standards-compliant `Content-Disposition` header + - Full Unicode support + * Use `path.resolve` in view lookup + * deps: debug@~2.1.0 + - Implement `DEBUG_FD` env variable support + * deps: depd@~1.0.0 + * deps: etag@~1.5.0 + - Improve string performance + - Slightly improve speed for weak ETags over 1KB + * deps: finalhandler@0.3.2 + - Terminate in progress response only on error + - Use `on-finished` to determine request status + - deps: debug@~2.1.0 + - deps: on-finished@~2.1.1 + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + * deps: qs@2.3.0 + - Fix parsing of mixed implicit and explicit arrays + * deps: send@0.10.1 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: etag@~1.5.0 + - deps: on-finished@~2.1.1 + * deps: serve-static@~1.7.1 + - deps: send@0.10.1 + +4.9.8 / 2014-10-17 +================== + + * Fix `res.redirect` body when redirect status specified + * deps: accepts@~1.1.2 + - Fix error when media type has invalid parameter + - deps: negotiator@0.4.9 + +4.9.7 / 2014-10-10 +================== + + * Fix using same param name in array of paths + +4.9.6 / 2014-10-08 +================== + + * deps: accepts@~1.1.1 + - deps: mime-types@~2.0.2 + - deps: negotiator@0.4.8 + * deps: serve-static@~1.6.4 + - Fix redirect loop when index file serving disabled + * deps: type-is@~1.5.2 + - deps: mime-types@~2.0.2 + +4.9.5 / 2014-09-24 +================== + + * deps: etag@~1.4.0 + * deps: proxy-addr@~1.0.3 + - Use `forwarded` npm module + * deps: send@0.9.3 + - deps: etag@~1.4.0 + * deps: serve-static@~1.6.3 + - deps: send@0.9.3 + +4.9.4 / 2014-09-19 +================== + + * deps: qs@2.2.4 + - Fix issue with object keys starting with numbers truncated + +4.9.3 / 2014-09-18 +================== + + * deps: proxy-addr@~1.0.2 + - Fix a global leak when multiple subnets are trusted + - deps: ipaddr.js@0.1.3 + +4.9.2 / 2014-09-17 +================== + + * Fix regression for empty string `path` in `app.use` + * Fix `router.use` to accept array of middleware without path + * Improve error message for bad `app.use` arguments + +4.9.1 / 2014-09-16 +================== + + * Fix `app.use` to accept array of middleware without path + * deps: depd@0.4.5 + * deps: etag@~1.3.1 + * deps: send@0.9.2 + - deps: depd@0.4.5 + - deps: etag@~1.3.1 + - deps: range-parser@~1.0.2 + * deps: serve-static@~1.6.2 + - deps: send@0.9.2 + +4.9.0 / 2014-09-08 +================== + + * Add `res.sendStatus` + * Invoke callback for sendfile when client aborts + - Applies to `res.sendFile`, `res.sendfile`, and `res.download` + - `err` will be populated with request aborted error + * Support IP address host in `req.subdomains` + * Use `etag` to generate `ETag` headers + * deps: accepts@~1.1.0 + - update `mime-types` + * deps: cookie-signature@1.0.5 + * deps: debug@~2.0.0 + * deps: finalhandler@0.2.0 + - Set `X-Content-Type-Options: nosniff` header + - deps: debug@~2.0.0 + * deps: fresh@0.2.4 + * deps: media-typer@0.3.0 + - Throw error when parameter format invalid on parse + * deps: qs@2.2.3 + - Fix issue where first empty value in array is discarded + * deps: range-parser@~1.0.2 + * deps: send@0.9.1 + - Add `lastModified` option + - Use `etag` to generate `ETag` header + - deps: debug@~2.0.0 + - deps: fresh@0.2.4 + * deps: serve-static@~1.6.1 + - Add `lastModified` option + - deps: send@0.9.1 + * deps: type-is@~1.5.1 + - fix `hasbody` to be true for `content-length: 0` + - deps: media-typer@0.3.0 + - deps: mime-types@~2.0.1 + * deps: vary@~1.0.0 + - Accept valid `Vary` header string as `field` + +4.8.8 / 2014-09-04 +================== + + * deps: send@0.8.5 + - Fix a path traversal issue when using `root` + - Fix malicious path detection for empty string path + * deps: serve-static@~1.5.4 + - deps: send@0.8.5 + +4.8.7 / 2014-08-29 +================== + + * deps: qs@2.2.2 + - Remove unnecessary cloning + +4.8.6 / 2014-08-27 +================== + + * deps: qs@2.2.0 + - Array parsing fix + - Performance improvements + +4.8.5 / 2014-08-18 +================== + + * deps: send@0.8.3 + - deps: destroy@1.0.3 + - deps: on-finished@2.1.0 + * deps: serve-static@~1.5.3 + - deps: send@0.8.3 + +4.8.4 / 2014-08-14 +================== + + * deps: qs@1.2.2 + * deps: send@0.8.2 + - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + * deps: serve-static@~1.5.2 + - deps: send@0.8.2 + +4.8.3 / 2014-08-10 +================== + + * deps: parseurl@~1.3.0 + * deps: qs@1.2.1 + * deps: serve-static@~1.5.1 + - Fix parsing of weird `req.originalUrl` values + - deps: parseurl@~1.3.0 + - deps: utils-merge@1.0.0 + +4.8.2 / 2014-08-07 +================== + + * deps: qs@1.2.0 + - Fix parsing array of objects + +4.8.1 / 2014-08-06 +================== + + * fix incorrect deprecation warnings on `res.download` + * deps: qs@1.1.0 + - Accept urlencoded square brackets + - Accept empty values in implicit array notation + +4.8.0 / 2014-08-05 +================== + + * add `res.sendFile` + - accepts a file system path instead of a URL + - requires an absolute path or `root` option specified + * deprecate `res.sendfile` -- use `res.sendFile` instead + * support mounted app as any argument to `app.use()` + * deps: qs@1.0.2 + - Complete rewrite + - Limits array length to 20 + - Limits object depth to 5 + - Limits parameters to 1,000 + * deps: send@0.8.1 + - Add `extensions` option + * deps: serve-static@~1.5.0 + - Add `extensions` option + - deps: send@0.8.1 + +4.7.4 / 2014-08-04 +================== + + * fix `res.sendfile` regression for serving directory index files + * deps: send@0.7.4 + - Fix incorrect 403 on Windows and Node.js 0.11 + - Fix serving index files without root dir + * deps: serve-static@~1.4.4 + - deps: send@0.7.4 + +4.7.3 / 2014-08-04 +================== + + * deps: send@0.7.3 + - Fix incorrect 403 on Windows and Node.js 0.11 + * deps: serve-static@~1.4.3 + - Fix incorrect 403 on Windows and Node.js 0.11 + - deps: send@0.7.3 + +4.7.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + * deps: send@0.7.2 + - deps: depd@0.4.4 + * deps: serve-static@~1.4.2 + +4.7.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + * deps: send@0.7.1 + - deps: depd@0.4.3 + * deps: serve-static@~1.4.1 + +4.7.0 / 2014-07-25 +================== + + * fix `req.protocol` for proxy-direct connections + * configurable query parser with `app.set('query parser', parser)` + - `app.set('query parser', 'extended')` parse with "qs" module + - `app.set('query parser', 'simple')` parse with "querystring" core module + - `app.set('query parser', false)` disable query string parsing + - `app.set('query parser', true)` enable simple parsing + * deprecate `res.json(status, obj)` -- use `res.status(status).json(obj)` instead + * deprecate `res.jsonp(status, obj)` -- use `res.status(status).jsonp(obj)` instead + * deprecate `res.send(status, body)` -- use `res.status(status).send(body)` instead + * deps: debug@1.0.4 + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: finalhandler@0.1.0 + - Respond after request fully read + - deps: debug@1.0.4 + * deps: parseurl@~1.2.0 + - Cache URLs based on original value + - Remove no-longer-needed URL mis-parse work-around + - Simplify the "fast-path" `RegExp` + * deps: send@0.7.0 + - Add `dotfiles` option + - Cap `maxAge` value to 1 year + - deps: debug@1.0.4 + - deps: depd@0.4.2 + * deps: serve-static@~1.4.0 + - deps: parseurl@~1.2.0 + - deps: send@0.7.0 + * perf: prevent multiple `Buffer` creation in `res.send` + +4.6.1 / 2014-07-12 +================== + + * fix `subapp.mountpath` regression for `app.use(subapp)` + +4.6.0 / 2014-07-11 +================== + + * accept multiple callbacks to `app.use()` + * add explicit "Rosetta Flash JSONP abuse" protection + - previous versions are not vulnerable; this is just explicit protection + * catch errors in multiple `req.param(name, fn)` handlers + * deprecate `res.redirect(url, status)` -- use `res.redirect(status, url)` instead + * fix `res.send(status, num)` to send `num` as json (not error) + * remove unnecessary escaping when `res.jsonp` returns JSON response + * support non-string `path` in `app.use(path, fn)` + - supports array of paths + - supports `RegExp` + * router: fix optimization on router exit + * router: refactor location of `try` blocks + * router: speed up standard `app.use(fn)` + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + * deps: finalhandler@0.0.3 + - deps: debug@1.0.3 + * deps: methods@1.1.0 + - add `CONNECT` + * deps: parseurl@~1.1.3 + - faster parsing of href-only URLs + * deps: path-to-regexp@0.1.3 + * deps: send@0.6.0 + - deps: debug@1.0.3 + * deps: serve-static@~1.3.2 + - deps: parseurl@~1.1.3 + - deps: send@0.6.0 + * perf: fix arguments reassign deopt in some `res` methods + +4.5.1 / 2014-07-06 +================== + + * fix routing regression when altering `req.method` + +4.5.0 / 2014-07-04 +================== + + * add deprecation message to non-plural `req.accepts*` + * add deprecation message to `res.send(body, status)` + * add deprecation message to `res.vary()` + * add `headers` option to `res.sendfile` + - use to set headers on successful file transfer + * add `mergeParams` option to `Router` + - merges `req.params` from parent routes + * add `req.hostname` -- correct name for what `req.host` returns + * deprecate things with `depd` module + * deprecate `req.host` -- use `req.hostname` instead + * fix behavior when handling request without routes + * fix handling when `route.all` is only route + * invoke `router.param()` only when route matches + * restore `req.params` after invoking router + * use `finalhandler` for final response handling + * use `media-typer` to alter content-type charset + * deps: accepts@~1.0.7 + * deps: send@0.5.0 + - Accept string for `maxage` (converted by `ms`) + - Include link in default redirect response + * deps: serve-static@~1.3.0 + - Accept string for `maxAge` (converted by `ms`) + - Add `setHeaders` option + - Include HTML link in redirect response + - deps: send@0.5.0 + * deps: type-is@~1.3.2 + +4.4.5 / 2014-06-26 +================== + + * deps: cookie-signature@1.0.4 + - fix for timing attacks + +4.4.4 / 2014-06-20 +================== + + * fix `res.attachment` Unicode filenames in Safari + * fix "trim prefix" debug message in `express:router` + * deps: accepts@~1.0.5 + * deps: buffer-crc32@0.2.3 + +4.4.3 / 2014-06-11 +================== + + * fix persistence of modified `req.params[name]` from `app.param()` + * deps: accepts@1.0.3 + - deps: negotiator@0.4.6 + * deps: debug@1.0.2 + * deps: send@0.4.3 + - Do not throw uncatchable error on file open race condition + - Use `escape-html` for HTML escaping + - deps: debug@1.0.2 + - deps: finished@1.2.2 + - deps: fresh@0.2.2 + * deps: serve-static@1.2.3 + - Do not throw uncatchable error on file open race condition + - deps: send@0.4.3 + +4.4.2 / 2014-06-09 +================== + + * fix catching errors from top-level handlers + * use `vary` module for `res.vary` + * deps: debug@1.0.1 + * deps: proxy-addr@1.0.1 + * deps: send@0.4.2 + - fix "event emitter leak" warnings + - deps: debug@1.0.1 + - deps: finished@1.2.1 + * deps: serve-static@1.2.2 + - fix "event emitter leak" warnings + - deps: send@0.4.2 + * deps: type-is@1.2.1 + +4.4.1 / 2014-06-02 +================== + + * deps: methods@1.0.1 + * deps: send@0.4.1 + - Send `max-age` in `Cache-Control` in correct format + * deps: serve-static@1.2.1 + - use `escape-html` for escaping + - deps: send@0.4.1 + +4.4.0 / 2014-05-30 +================== + + * custom etag control with `app.set('etag', val)` + - `app.set('etag', function(body, encoding){ return '"etag"' })` custom etag generation + - `app.set('etag', 'weak')` weak tag + - `app.set('etag', 'strong')` strong etag + - `app.set('etag', false)` turn off + - `app.set('etag', true)` standard etag + * mark `res.send` ETag as weak and reduce collisions + * update accepts to 1.0.2 + - Fix interpretation when header not in request + * update send to 0.4.0 + - Calculate ETag with md5 for reduced collisions + - Ignore stream errors after request ends + - deps: debug@0.8.1 + * update serve-static to 1.2.0 + - Calculate ETag with md5 for reduced collisions + - Ignore stream errors after request ends + - deps: send@0.4.0 + +4.3.2 / 2014-05-28 +================== + + * fix handling of errors from `router.param()` callbacks + +4.3.1 / 2014-05-23 +================== + + * revert "fix behavior of multiple `app.VERB` for the same path" + - this caused a regression in the order of route execution + +4.3.0 / 2014-05-21 +================== + + * add `req.baseUrl` to access the path stripped from `req.url` in routes + * fix behavior of multiple `app.VERB` for the same path + * fix issue routing requests among sub routers + * invoke `router.param()` only when necessary instead of every match + * proper proxy trust with `app.set('trust proxy', trust)` + - `app.set('trust proxy', 1)` trust first hop + - `app.set('trust proxy', 'loopback')` trust loopback addresses + - `app.set('trust proxy', '10.0.0.1')` trust single IP + - `app.set('trust proxy', '10.0.0.1/16')` trust subnet + - `app.set('trust proxy', '10.0.0.1, 10.0.0.2')` trust list + - `app.set('trust proxy', false)` turn off + - `app.set('trust proxy', true)` trust everything + * set proper `charset` in `Content-Type` for `res.send` + * update type-is to 1.2.0 + - support suffix matching + +4.2.0 / 2014-05-11 +================== + + * deprecate `app.del()` -- use `app.delete()` instead + * deprecate `res.json(obj, status)` -- use `res.json(status, obj)` instead + - the edge-case `res.json(status, num)` requires `res.status(status).json(num)` + * deprecate `res.jsonp(obj, status)` -- use `res.jsonp(status, obj)` instead + - the edge-case `res.jsonp(status, num)` requires `res.status(status).jsonp(num)` + * fix `req.next` when inside router instance + * include `ETag` header in `HEAD` requests + * keep previous `Content-Type` for `res.jsonp` + * support PURGE method + - add `app.purge` + - add `router.purge` + - include PURGE in `app.all` + * update debug to 0.8.0 + - add `enable()` method + - change from stderr to stdout + * update methods to 1.0.0 + - add PURGE + +4.1.2 / 2014-05-08 +================== + + * fix `req.host` for IPv6 literals + * fix `res.jsonp` error if callback param is object + +4.1.1 / 2014-04-27 +================== + + * fix package.json to reflect supported node version + +4.1.0 / 2014-04-24 +================== + + * pass options from `res.sendfile` to `send` + * preserve casing of headers in `res.header` and `res.set` + * support unicode file names in `res.attachment` and `res.download` + * update accepts to 1.0.1 + - deps: negotiator@0.4.0 + * update cookie to 0.1.2 + - Fix for maxAge == 0 + - made compat with expires field + * update send to 0.3.0 + - Accept API options in options object + - Coerce option types + - Control whether to generate etags + - Default directory access to 403 when index disabled + - Fix sending files with dots without root set + - Include file path in etag + - Make "Can't set headers after they are sent." catchable + - Send full entity-body for multi range requests + - Set etags to "weak" + - Support "If-Range" header + - Support multiple index paths + - deps: mime@1.2.11 + * update serve-static to 1.1.0 + - Accept options directly to `send` module + - Resolve relative paths at middleware setup + - Use parseurl to parse the URL from request + - deps: send@0.3.0 + * update type-is to 1.1.0 + - add non-array values support + - add `multipart` as a shorthand + +4.0.0 / 2014-04-09 +================== + + * remove: + - node 0.8 support + - connect and connect's patches except for charset handling + - express(1) - moved to [express-generator](https://github.com/expressjs/generator) + - `express.createServer()` - it has been deprecated for a long time. Use `express()` + - `app.configure` - use logic in your own app code + - `app.router` - is removed + - `req.auth` - use `basic-auth` instead + - `req.accepted*` - use `req.accepts*()` instead + - `res.location` - relative URL resolution is removed + - `res.charset` - include the charset in the content type when using `res.set()` + - all bundled middleware except `static` + * change: + - `app.route` -> `app.mountpath` when mounting an express app in another express app + - `json spaces` no longer enabled by default in development + - `req.accepts*` -> `req.accepts*s` - i.e. `req.acceptsEncoding` -> `req.acceptsEncodings` + - `req.params` is now an object instead of an array + - `res.locals` is no longer a function. It is a plain js object. Treat it as such. + - `res.headerSent` -> `res.headersSent` to match node.js ServerResponse object + * refactor: + - `req.accepts*` with [accepts](https://github.com/expressjs/accepts) + - `req.is` with [type-is](https://github.com/expressjs/type-is) + - [path-to-regexp](https://github.com/component/path-to-regexp) + * add: + - `app.router()` - returns the app Router instance + - `app.route()` - Proxy to the app's `Router#route()` method to create a new route + - Router & Route - public API + +3.21.2 / 2015-07-31 +=================== + + * deps: connect@2.30.2 + - deps: body-parser@~1.13.3 + - deps: compression@~1.5.2 + - deps: errorhandler@~1.4.2 + - deps: method-override@~2.3.5 + - deps: serve-index@~1.7.2 + - deps: type-is@~1.6.6 + - deps: vhost@~3.0.1 + * deps: vary@~1.0.1 + - Fix setting empty header from empty `field` + - perf: enable strict mode + - perf: remove argument reassignments + +3.21.1 / 2015-07-05 +=================== + + * deps: basic-auth@~1.0.3 + * deps: connect@2.30.1 + - deps: body-parser@~1.13.2 + - deps: compression@~1.5.1 + - deps: errorhandler@~1.4.1 + - deps: morgan@~1.6.1 + - deps: pause@0.1.0 + - deps: qs@4.0.0 + - deps: serve-index@~1.7.1 + - deps: type-is@~1.6.4 + +3.21.0 / 2015-06-18 +=================== + + * deps: basic-auth@1.0.2 + - perf: enable strict mode + - perf: hoist regular expression + - perf: parse with regular expressions + - perf: remove argument reassignment + * deps: connect@2.30.0 + - deps: body-parser@~1.13.1 + - deps: bytes@2.1.0 + - deps: compression@~1.5.0 + - deps: cookie@0.1.3 + - deps: cookie-parser@~1.3.5 + - deps: csurf@~1.8.3 + - deps: errorhandler@~1.4.0 + - deps: express-session@~1.11.3 + - deps: finalhandler@0.4.0 + - deps: fresh@0.3.0 + - deps: morgan@~1.6.0 + - deps: serve-favicon@~2.3.0 + - deps: serve-index@~1.7.0 + - deps: serve-static@~1.10.0 + - deps: type-is@~1.6.3 + * deps: cookie@0.1.3 + - perf: deduce the scope of try-catch deopt + - perf: remove argument reassignments + * deps: escape-html@1.0.2 + * deps: etag@~1.7.0 + - Always include entity length in ETags for hash length extensions + - Generate non-Stats ETags using MD5 only (no longer CRC32) + - Improve stat performance by removing hashing + - Improve support for JXcore + - Remove base64 padding in ETags to shorten + - Support "fake" stats objects in environments without fs + - Use MD5 instead of MD4 in weak ETags over 1KB + * deps: fresh@0.3.0 + - Add weak `ETag` matching support + * deps: mkdirp@0.5.1 + - Work in global strict mode + * deps: send@0.13.0 + - Allow Node.js HTTP server to set `Date` response header + - Fix incorrectly removing `Content-Location` on 304 response + - Improve the default redirect response headers + - Send appropriate headers on default error response + - Use `http-errors` for standard emitted errors + - Use `statuses` instead of `http` module for status messages + - deps: escape-html@1.0.2 + - deps: etag@~1.7.0 + - deps: fresh@0.3.0 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove unnecessary array allocations + +3.20.3 / 2015-05-17 +=================== + + * deps: connect@2.29.2 + - deps: body-parser@~1.12.4 + - deps: compression@~1.4.4 + - deps: connect-timeout@~1.6.2 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: errorhandler@~1.3.6 + - deps: finalhandler@0.3.6 + - deps: method-override@~2.3.3 + - deps: morgan@~1.5.3 + - deps: qs@2.4.2 + - deps: response-time@~2.3.1 + - deps: serve-favicon@~2.2.1 + - deps: serve-index@~1.6.4 + - deps: serve-static@~1.9.3 + - deps: type-is@~1.6.2 + * deps: debug@~2.2.0 + - deps: ms@0.7.1 + * deps: depd@~1.0.1 + * deps: proxy-addr@~1.0.8 + - deps: ipaddr.js@1.0.1 + * deps: send@0.12.3 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: etag@~1.6.0 + - deps: ms@0.7.1 + - deps: on-finished@~2.2.1 + +3.20.2 / 2015-03-16 +=================== + + * deps: connect@2.29.1 + - deps: body-parser@~1.12.2 + - deps: compression@~1.4.3 + - deps: connect-timeout@~1.6.1 + - deps: debug@~2.1.3 + - deps: errorhandler@~1.3.5 + - deps: express-session@~1.10.4 + - deps: finalhandler@0.3.4 + - deps: method-override@~2.3.2 + - deps: morgan@~1.5.2 + - deps: qs@2.4.1 + - deps: serve-index@~1.6.3 + - deps: serve-static@~1.9.2 + - deps: type-is@~1.6.1 + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: merge-descriptors@1.0.0 + * deps: proxy-addr@~1.0.7 + - deps: ipaddr.js@0.1.9 + * deps: send@0.12.2 + - Throw errors early for invalid `extensions` or `index` options + - deps: debug@~2.1.3 + +3.20.1 / 2015-02-28 +=================== + + * Fix `req.host` when using "trust proxy" hops count + * Fix `req.protocol`/`req.secure` when using "trust proxy" hops count + +3.20.0 / 2015-02-18 +=================== + + * Fix `"trust proxy"` setting to inherit when app is mounted + * Generate `ETag`s for all request responses + - No longer restricted to only responses for `GET` and `HEAD` requests + * Use `content-type` to parse `Content-Type` headers + * deps: connect@2.29.0 + - Use `content-type` to parse `Content-Type` headers + - deps: body-parser@~1.12.0 + - deps: compression@~1.4.1 + - deps: connect-timeout@~1.6.0 + - deps: cookie-parser@~1.3.4 + - deps: cookie-signature@1.0.6 + - deps: csurf@~1.7.0 + - deps: errorhandler@~1.3.4 + - deps: express-session@~1.10.3 + - deps: http-errors@~1.3.1 + - deps: response-time@~2.3.0 + - deps: serve-index@~1.6.2 + - deps: serve-static@~1.9.1 + - deps: type-is@~1.6.0 + * deps: cookie-signature@1.0.6 + * deps: send@0.12.1 + - Always read the stat size from the file + - Fix mutating passed-in `options` + - deps: mime@1.3.4 + +3.19.2 / 2015-02-01 +=================== + + * deps: connect@2.28.3 + - deps: compression@~1.3.1 + - deps: csurf@~1.6.6 + - deps: errorhandler@~1.3.3 + - deps: express-session@~1.10.2 + - deps: serve-index@~1.6.1 + - deps: type-is@~1.5.6 + * deps: proxy-addr@~1.0.6 + - deps: ipaddr.js@0.1.8 + +3.19.1 / 2015-01-20 +=================== + + * deps: connect@2.28.2 + - deps: body-parser@~1.10.2 + - deps: serve-static@~1.8.1 + * deps: send@0.11.1 + - Fix root path disclosure + +3.19.0 / 2015-01-09 +=================== + + * Fix `OPTIONS` responses to include the `HEAD` method property + * Use `readline` for prompt in `express(1)` + * deps: commander@2.6.0 + * deps: connect@2.28.1 + - deps: body-parser@~1.10.1 + - deps: compression@~1.3.0 + - deps: connect-timeout@~1.5.0 + - deps: csurf@~1.6.4 + - deps: debug@~2.1.1 + - deps: errorhandler@~1.3.2 + - deps: express-session@~1.10.1 + - deps: finalhandler@0.3.3 + - deps: method-override@~2.3.1 + - deps: morgan@~1.5.1 + - deps: serve-favicon@~2.2.0 + - deps: serve-index@~1.6.0 + - deps: serve-static@~1.8.0 + - deps: type-is@~1.5.5 + * deps: debug@~2.1.1 + * deps: methods@~1.1.1 + * deps: proxy-addr@~1.0.5 + - deps: ipaddr.js@0.1.6 + * deps: send@0.11.0 + - deps: debug@~2.1.1 + - deps: etag@~1.5.1 + - deps: ms@0.7.0 + - deps: on-finished@~2.2.0 + +3.18.6 / 2014-12-12 +=================== + + * Fix exception in `req.fresh`/`req.stale` without response headers + +3.18.5 / 2014-12-11 +=================== + + * deps: connect@2.27.6 + - deps: compression@~1.2.2 + - deps: express-session@~1.9.3 + - deps: http-errors@~1.2.8 + - deps: serve-index@~1.5.3 + - deps: type-is@~1.5.4 + +3.18.4 / 2014-11-23 +=================== + + * deps: connect@2.27.4 + - deps: body-parser@~1.9.3 + - deps: compression@~1.2.1 + - deps: errorhandler@~1.2.3 + - deps: express-session@~1.9.2 + - deps: qs@2.3.3 + - deps: serve-favicon@~2.1.7 + - deps: serve-static@~1.5.1 + - deps: type-is@~1.5.3 + * deps: etag@~1.5.1 + * deps: proxy-addr@~1.0.4 + - deps: ipaddr.js@0.1.5 + +3.18.3 / 2014-11-09 +=================== + + * deps: connect@2.27.3 + - Correctly invoke async callback asynchronously + - deps: csurf@~1.6.3 + +3.18.2 / 2014-10-28 +=================== + + * deps: connect@2.27.2 + - Fix handling of URLs containing `://` in the path + - deps: body-parser@~1.9.2 + - deps: qs@2.3.2 + +3.18.1 / 2014-10-22 +=================== + + * Fix internal `utils.merge` deprecation warnings + * deps: connect@2.27.1 + - deps: body-parser@~1.9.1 + - deps: express-session@~1.9.1 + - deps: finalhandler@0.3.2 + - deps: morgan@~1.4.1 + - deps: qs@2.3.0 + - deps: serve-static@~1.7.1 + * deps: send@0.10.1 + - deps: on-finished@~2.1.1 + +3.18.0 / 2014-10-17 +=================== + + * Use `content-disposition` module for `res.attachment`/`res.download` + - Sends standards-compliant `Content-Disposition` header + - Full Unicode support + * Use `etag` module to generate `ETag` headers + * deps: connect@2.27.0 + - Use `http-errors` module for creating errors + - Use `utils-merge` module for merging objects + - deps: body-parser@~1.9.0 + - deps: compression@~1.2.0 + - deps: connect-timeout@~1.4.0 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: express-session@~1.9.0 + - deps: finalhandler@0.3.1 + - deps: method-override@~2.3.0 + - deps: morgan@~1.4.0 + - deps: response-time@~2.2.0 + - deps: serve-favicon@~2.1.6 + - deps: serve-index@~1.5.0 + - deps: serve-static@~1.7.0 + * deps: debug@~2.1.0 + - Implement `DEBUG_FD` env variable support + * deps: depd@~1.0.0 + * deps: send@0.10.0 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: etag@~1.5.0 + +3.17.8 / 2014-10-15 +=================== + + * deps: connect@2.26.6 + - deps: compression@~1.1.2 + - deps: csurf@~1.6.2 + - deps: errorhandler@~1.2.2 + +3.17.7 / 2014-10-08 +=================== + + * deps: connect@2.26.5 + - Fix accepting non-object arguments to `logger` + - deps: serve-static@~1.6.4 + +3.17.6 / 2014-10-02 +=================== + + * deps: connect@2.26.4 + - deps: morgan@~1.3.2 + - deps: type-is@~1.5.2 + +3.17.5 / 2014-09-24 +=================== + + * deps: connect@2.26.3 + - deps: body-parser@~1.8.4 + - deps: serve-favicon@~2.1.5 + - deps: serve-static@~1.6.3 + * deps: proxy-addr@~1.0.3 + - Use `forwarded` npm module + * deps: send@0.9.3 + - deps: etag@~1.4.0 + +3.17.4 / 2014-09-19 +=================== + + * deps: connect@2.26.2 + - deps: body-parser@~1.8.3 + - deps: qs@2.2.4 + +3.17.3 / 2014-09-18 +=================== + + * deps: proxy-addr@~1.0.2 + - Fix a global leak when multiple subnets are trusted + - deps: ipaddr.js@0.1.3 + +3.17.2 / 2014-09-15 +=================== + + * Use `crc` instead of `buffer-crc32` for speed + * deps: connect@2.26.1 + - deps: body-parser@~1.8.2 + - deps: depd@0.4.5 + - deps: express-session@~1.8.2 + - deps: morgan@~1.3.1 + - deps: serve-favicon@~2.1.3 + - deps: serve-static@~1.6.2 + * deps: depd@0.4.5 + * deps: send@0.9.2 + - deps: depd@0.4.5 + - deps: etag@~1.3.1 + - deps: range-parser@~1.0.2 + +3.17.1 / 2014-09-08 +=================== + + * Fix error in `req.subdomains` on empty host + +3.17.0 / 2014-09-08 +=================== + + * Support `X-Forwarded-Host` in `req.subdomains` + * Support IP address host in `req.subdomains` + * deps: connect@2.26.0 + - deps: body-parser@~1.8.1 + - deps: compression@~1.1.0 + - deps: connect-timeout@~1.3.0 + - deps: cookie-parser@~1.3.3 + - deps: cookie-signature@1.0.5 + - deps: csurf@~1.6.1 + - deps: debug@~2.0.0 + - deps: errorhandler@~1.2.0 + - deps: express-session@~1.8.1 + - deps: finalhandler@0.2.0 + - deps: fresh@0.2.4 + - deps: media-typer@0.3.0 + - deps: method-override@~2.2.0 + - deps: morgan@~1.3.0 + - deps: qs@2.2.3 + - deps: serve-favicon@~2.1.3 + - deps: serve-index@~1.2.1 + - deps: serve-static@~1.6.1 + - deps: type-is@~1.5.1 + - deps: vhost@~3.0.0 + * deps: cookie-signature@1.0.5 + * deps: debug@~2.0.0 + * deps: fresh@0.2.4 + * deps: media-typer@0.3.0 + - Throw error when parameter format invalid on parse + * deps: range-parser@~1.0.2 + * deps: send@0.9.1 + - Add `lastModified` option + - Use `etag` to generate `ETag` header + - deps: debug@~2.0.0 + - deps: fresh@0.2.4 + * deps: vary@~1.0.0 + - Accept valid `Vary` header string as `field` + +3.16.10 / 2014-09-04 +==================== + + * deps: connect@2.25.10 + - deps: serve-static@~1.5.4 + * deps: send@0.8.5 + - Fix a path traversal issue when using `root` + - Fix malicious path detection for empty string path + +3.16.9 / 2014-08-29 +=================== + + * deps: connect@2.25.9 + - deps: body-parser@~1.6.7 + - deps: qs@2.2.2 + +3.16.8 / 2014-08-27 +=================== + + * deps: connect@2.25.8 + - deps: body-parser@~1.6.6 + - deps: csurf@~1.4.1 + - deps: qs@2.2.0 + +3.16.7 / 2014-08-18 +=================== + + * deps: connect@2.25.7 + - deps: body-parser@~1.6.5 + - deps: express-session@~1.7.6 + - deps: morgan@~1.2.3 + - deps: serve-static@~1.5.3 + * deps: send@0.8.3 + - deps: destroy@1.0.3 + - deps: on-finished@2.1.0 + +3.16.6 / 2014-08-14 +=================== + + * deps: connect@2.25.6 + - deps: body-parser@~1.6.4 + - deps: qs@1.2.2 + - deps: serve-static@~1.5.2 + * deps: send@0.8.2 + - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + +3.16.5 / 2014-08-11 +=================== + + * deps: connect@2.25.5 + - Fix backwards compatibility in `logger` + +3.16.4 / 2014-08-10 +=================== + + * Fix original URL parsing in `res.location` + * deps: connect@2.25.4 + - Fix `query` middleware breaking with argument + - deps: body-parser@~1.6.3 + - deps: compression@~1.0.11 + - deps: connect-timeout@~1.2.2 + - deps: express-session@~1.7.5 + - deps: method-override@~2.1.3 + - deps: on-headers@~1.0.0 + - deps: parseurl@~1.3.0 + - deps: qs@1.2.1 + - deps: response-time@~2.0.1 + - deps: serve-index@~1.1.6 + - deps: serve-static@~1.5.1 + * deps: parseurl@~1.3.0 + +3.16.3 / 2014-08-07 +=================== + + * deps: connect@2.25.3 + - deps: multiparty@3.3.2 + +3.16.2 / 2014-08-07 +=================== + + * deps: connect@2.25.2 + - deps: body-parser@~1.6.2 + - deps: qs@1.2.0 + +3.16.1 / 2014-08-06 +=================== + + * deps: connect@2.25.1 + - deps: body-parser@~1.6.1 + - deps: qs@1.1.0 + +3.16.0 / 2014-08-05 +=================== + + * deps: connect@2.25.0 + - deps: body-parser@~1.6.0 + - deps: compression@~1.0.10 + - deps: csurf@~1.4.0 + - deps: express-session@~1.7.4 + - deps: qs@1.0.2 + - deps: serve-static@~1.5.0 + * deps: send@0.8.1 + - Add `extensions` option + +3.15.3 / 2014-08-04 +=================== + + * fix `res.sendfile` regression for serving directory index files + * deps: connect@2.24.3 + - deps: serve-index@~1.1.5 + - deps: serve-static@~1.4.4 + * deps: send@0.7.4 + - Fix incorrect 403 on Windows and Node.js 0.11 + - Fix serving index files without root dir + +3.15.2 / 2014-07-27 +=================== + + * deps: connect@2.24.2 + - deps: body-parser@~1.5.2 + - deps: depd@0.4.4 + - deps: express-session@~1.7.2 + - deps: morgan@~1.2.2 + - deps: serve-static@~1.4.2 + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + * deps: send@0.7.2 + - deps: depd@0.4.4 + +3.15.1 / 2014-07-26 +=================== + + * deps: connect@2.24.1 + - deps: body-parser@~1.5.1 + - deps: depd@0.4.3 + - deps: express-session@~1.7.1 + - deps: morgan@~1.2.1 + - deps: serve-index@~1.1.4 + - deps: serve-static@~1.4.1 + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + * deps: send@0.7.1 + - deps: depd@0.4.3 + +3.15.0 / 2014-07-22 +=================== + + * Fix `req.protocol` for proxy-direct connections + * Pass options from `res.sendfile` to `send` + * deps: connect@2.24.0 + - deps: body-parser@~1.5.0 + - deps: compression@~1.0.9 + - deps: connect-timeout@~1.2.1 + - deps: debug@1.0.4 + - deps: depd@0.4.2 + - deps: express-session@~1.7.0 + - deps: finalhandler@0.1.0 + - deps: method-override@~2.1.2 + - deps: morgan@~1.2.0 + - deps: multiparty@3.3.1 + - deps: parseurl@~1.2.0 + - deps: serve-static@~1.4.0 + * deps: debug@1.0.4 + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: parseurl@~1.2.0 + - Cache URLs based on original value + - Remove no-longer-needed URL mis-parse work-around + - Simplify the "fast-path" `RegExp` + * deps: send@0.7.0 + - Add `dotfiles` option + - Cap `maxAge` value to 1 year + - deps: debug@1.0.4 + - deps: depd@0.4.2 + +3.14.0 / 2014-07-11 +=================== + + * add explicit "Rosetta Flash JSONP abuse" protection + - previous versions are not vulnerable; this is just explicit protection + * deprecate `res.redirect(url, status)` -- use `res.redirect(status, url)` instead + * fix `res.send(status, num)` to send `num` as json (not error) + * remove unnecessary escaping when `res.jsonp` returns JSON response + * deps: basic-auth@1.0.0 + - support empty password + - support empty username + * deps: connect@2.23.0 + - deps: debug@1.0.3 + - deps: express-session@~1.6.4 + - deps: method-override@~2.1.0 + - deps: parseurl@~1.1.3 + - deps: serve-static@~1.3.1 + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + * deps: methods@1.1.0 + - add `CONNECT` + * deps: parseurl@~1.1.3 + - faster parsing of href-only URLs + +3.13.0 / 2014-07-03 +=================== + + * add deprecation message to `app.configure` + * add deprecation message to `req.auth` + * use `basic-auth` to parse `Authorization` header + * deps: connect@2.22.0 + - deps: csurf@~1.3.0 + - deps: express-session@~1.6.1 + - deps: multiparty@3.3.0 + - deps: serve-static@~1.3.0 + * deps: send@0.5.0 + - Accept string for `maxage` (converted by `ms`) + - Include link in default redirect response + +3.12.1 / 2014-06-26 +=================== + + * deps: connect@2.21.1 + - deps: cookie-parser@1.3.2 + - deps: cookie-signature@1.0.4 + - deps: express-session@~1.5.2 + - deps: type-is@~1.3.2 + * deps: cookie-signature@1.0.4 + - fix for timing attacks + +3.12.0 / 2014-06-21 +=================== + + * use `media-typer` to alter content-type charset + * deps: connect@2.21.0 + - deprecate `connect(middleware)` -- use `app.use(middleware)` instead + - deprecate `connect.createServer()` -- use `connect()` instead + - fix `res.setHeader()` patch to work with get -> append -> set pattern + - deps: compression@~1.0.8 + - deps: errorhandler@~1.1.1 + - deps: express-session@~1.5.0 + - deps: serve-index@~1.1.3 + +3.11.0 / 2014-06-19 +=================== + + * deprecate things with `depd` module + * deps: buffer-crc32@0.2.3 + * deps: connect@2.20.2 + - deprecate `verify` option to `json` -- use `body-parser` npm module instead + - deprecate `verify` option to `urlencoded` -- use `body-parser` npm module instead + - deprecate things with `depd` module + - use `finalhandler` for final response handling + - use `media-typer` to parse `content-type` for charset + - deps: body-parser@1.4.3 + - deps: connect-timeout@1.1.1 + - deps: cookie-parser@1.3.1 + - deps: csurf@1.2.2 + - deps: errorhandler@1.1.0 + - deps: express-session@1.4.0 + - deps: multiparty@3.2.9 + - deps: serve-index@1.1.2 + - deps: type-is@1.3.1 + - deps: vhost@2.0.0 + +3.10.5 / 2014-06-11 +=================== + + * deps: connect@2.19.6 + - deps: body-parser@1.3.1 + - deps: compression@1.0.7 + - deps: debug@1.0.2 + - deps: serve-index@1.1.1 + - deps: serve-static@1.2.3 + * deps: debug@1.0.2 + * deps: send@0.4.3 + - Do not throw uncatchable error on file open race condition + - Use `escape-html` for HTML escaping + - deps: debug@1.0.2 + - deps: finished@1.2.2 + - deps: fresh@0.2.2 + +3.10.4 / 2014-06-09 +=================== + + * deps: connect@2.19.5 + - fix "event emitter leak" warnings + - deps: csurf@1.2.1 + - deps: debug@1.0.1 + - deps: serve-static@1.2.2 + - deps: type-is@1.2.1 + * deps: debug@1.0.1 + * deps: send@0.4.2 + - fix "event emitter leak" warnings + - deps: finished@1.2.1 + - deps: debug@1.0.1 + +3.10.3 / 2014-06-05 +=================== + + * use `vary` module for `res.vary` + * deps: connect@2.19.4 + - deps: errorhandler@1.0.2 + - deps: method-override@2.0.2 + - deps: serve-favicon@2.0.1 + * deps: debug@1.0.0 + +3.10.2 / 2014-06-03 +=================== + + * deps: connect@2.19.3 + - deps: compression@1.0.6 + +3.10.1 / 2014-06-03 +=================== + + * deps: connect@2.19.2 + - deps: compression@1.0.4 + * deps: proxy-addr@1.0.1 + +3.10.0 / 2014-06-02 +=================== + + * deps: connect@2.19.1 + - deprecate `methodOverride()` -- use `method-override` npm module instead + - deps: body-parser@1.3.0 + - deps: method-override@2.0.1 + - deps: multiparty@3.2.8 + - deps: response-time@2.0.0 + - deps: serve-static@1.2.1 + * deps: methods@1.0.1 + * deps: send@0.4.1 + - Send `max-age` in `Cache-Control` in correct format + +3.9.0 / 2014-05-30 +================== + + * custom etag control with `app.set('etag', val)` + - `app.set('etag', function(body, encoding){ return '"etag"' })` custom etag generation + - `app.set('etag', 'weak')` weak tag + - `app.set('etag', 'strong')` strong etag + - `app.set('etag', false)` turn off + - `app.set('etag', true)` standard etag + * Include ETag in HEAD requests + * mark `res.send` ETag as weak and reduce collisions + * update connect to 2.18.0 + - deps: compression@1.0.3 + - deps: serve-index@1.1.0 + - deps: serve-static@1.2.0 + * update send to 0.4.0 + - Calculate ETag with md5 for reduced collisions + - Ignore stream errors after request ends + - deps: debug@0.8.1 + +3.8.1 / 2014-05-27 +================== + + * update connect to 2.17.3 + - deps: body-parser@1.2.2 + - deps: express-session@1.2.1 + - deps: method-override@1.0.2 + +3.8.0 / 2014-05-21 +================== + + * keep previous `Content-Type` for `res.jsonp` + * set proper `charset` in `Content-Type` for `res.send` + * update connect to 2.17.1 + - fix `res.charset` appending charset when `content-type` has one + - deps: express-session@1.2.0 + - deps: morgan@1.1.1 + - deps: serve-index@1.0.3 + +3.7.0 / 2014-05-18 +================== + + * proper proxy trust with `app.set('trust proxy', trust)` + - `app.set('trust proxy', 1)` trust first hop + - `app.set('trust proxy', 'loopback')` trust loopback addresses + - `app.set('trust proxy', '10.0.0.1')` trust single IP + - `app.set('trust proxy', '10.0.0.1/16')` trust subnet + - `app.set('trust proxy', '10.0.0.1, 10.0.0.2')` trust list + - `app.set('trust proxy', false)` turn off + - `app.set('trust proxy', true)` trust everything + * update connect to 2.16.2 + - deprecate `res.headerSent` -- use `res.headersSent` + - deprecate `res.on("header")` -- use on-headers module instead + - fix edge-case in `res.appendHeader` that would append in wrong order + - json: use body-parser + - urlencoded: use body-parser + - dep: bytes@1.0.0 + - dep: cookie-parser@1.1.0 + - dep: csurf@1.2.0 + - dep: express-session@1.1.0 + - dep: method-override@1.0.1 + +3.6.0 / 2014-05-09 +================== + + * deprecate `app.del()` -- use `app.delete()` instead + * deprecate `res.json(obj, status)` -- use `res.json(status, obj)` instead + - the edge-case `res.json(status, num)` requires `res.status(status).json(num)` + * deprecate `res.jsonp(obj, status)` -- use `res.jsonp(status, obj)` instead + - the edge-case `res.jsonp(status, num)` requires `res.status(status).jsonp(num)` + * support PURGE method + - add `app.purge` + - add `router.purge` + - include PURGE in `app.all` + * update connect to 2.15.0 + * Add `res.appendHeader` + * Call error stack even when response has been sent + * Patch `res.headerSent` to return Boolean + * Patch `res.headersSent` for node.js 0.8 + * Prevent default 404 handler after response sent + * dep: compression@1.0.2 + * dep: connect-timeout@1.1.0 + * dep: debug@^0.8.0 + * dep: errorhandler@1.0.1 + * dep: express-session@1.0.4 + * dep: morgan@1.0.1 + * dep: serve-favicon@2.0.0 + * dep: serve-index@1.0.2 + * update debug to 0.8.0 + * add `enable()` method + * change from stderr to stdout + * update methods to 1.0.0 + - add PURGE + * update mkdirp to 0.5.0 + +3.5.3 / 2014-05-08 +================== + + * fix `req.host` for IPv6 literals + * fix `res.jsonp` error if callback param is object + +3.5.2 / 2014-04-24 +================== + + * update connect to 2.14.5 + * update cookie to 0.1.2 + * update mkdirp to 0.4.0 + * update send to 0.3.0 + +3.5.1 / 2014-03-25 +================== + + * pin less-middleware in generated app + +3.5.0 / 2014-03-06 +================== + + * bump deps + +3.4.8 / 2014-01-13 +================== + + * prevent incorrect automatic OPTIONS responses #1868 @dpatti + * update binary and examples for jade 1.0 #1876 @yossi, #1877 @reqshark, #1892 @matheusazzi + * throw 400 in case of malformed paths @rlidwka + +3.4.7 / 2013-12-10 +================== + + * update connect + +3.4.6 / 2013-12-01 +================== + + * update connect (raw-body) + +3.4.5 / 2013-11-27 +================== + + * update connect + * res.location: remove leading ./ #1802 @kapouer + * res.redirect: fix `res.redirect('toString') #1829 @michaelficarra + * res.send: always send ETag when content-length > 0 + * router: add Router.all() method + +3.4.4 / 2013-10-29 +================== + + * update connect + * update supertest + * update methods + * express(1): replace bodyParser() with urlencoded() and json() #1795 @chirag04 + +3.4.3 / 2013-10-23 +================== + + * update connect + +3.4.2 / 2013-10-18 +================== + + * update connect + * downgrade commander + +3.4.1 / 2013-10-15 +================== + + * update connect + * update commander + * jsonp: check if callback is a function + * router: wrap encodeURIComponent in a try/catch #1735 (@lxe) + * res.format: now includes charset @1747 (@sorribas) + * res.links: allow multiple calls @1746 (@sorribas) + +3.4.0 / 2013-09-07 +================== + + * add res.vary(). Closes #1682 + * update connect + +3.3.8 / 2013-09-02 +================== + + * update connect + +3.3.7 / 2013-08-28 +================== + + * update connect + +3.3.6 / 2013-08-27 +================== + + * Revert "remove charset from json responses. Closes #1631" (causes issues in some clients) + * add: req.accepts take an argument list + +3.3.4 / 2013-07-08 +================== + + * update send and connect + +3.3.3 / 2013-07-04 +================== + + * update connect + +3.3.2 / 2013-07-03 +================== + + * update connect + * update send + * remove .version export + +3.3.1 / 2013-06-27 +================== + + * update connect + +3.3.0 / 2013-06-26 +================== + + * update connect + * add support for multiple X-Forwarded-Proto values. Closes #1646 + * change: remove charset from json responses. Closes #1631 + * change: return actual booleans from req.accept* functions + * fix jsonp callback array throw + +3.2.6 / 2013-06-02 +================== + + * update connect + +3.2.5 / 2013-05-21 +================== + + * update connect + * update node-cookie + * add: throw a meaningful error when there is no default engine + * change generation of ETags with res.send() to GET requests only. Closes #1619 + +3.2.4 / 2013-05-09 +================== + + * fix `req.subdomains` when no Host is present + * fix `req.host` when no Host is present, return undefined + +3.2.3 / 2013-05-07 +================== + + * update connect / qs + +3.2.2 / 2013-05-03 +================== + + * update qs + +3.2.1 / 2013-04-29 +================== + + * add app.VERB() paths array deprecation warning + * update connect + * update qs and remove all ~ semver crap + * fix: accept number as value of Signed Cookie + +3.2.0 / 2013-04-15 +================== + + * add "view" constructor setting to override view behaviour + * add req.acceptsEncoding(name) + * add req.acceptedEncodings + * revert cookie signature change causing session race conditions + * fix sorting of Accept values of the same quality + +3.1.2 / 2013-04-12 +================== + + * add support for custom Accept parameters + * update cookie-signature + +3.1.1 / 2013-04-01 +================== + + * add X-Forwarded-Host support to `req.host` + * fix relative redirects + * update mkdirp + * update buffer-crc32 + * remove legacy app.configure() method from app template. + +3.1.0 / 2013-01-25 +================== + + * add support for leading "." in "view engine" setting + * add array support to `res.set()` + * add node 0.8.x to travis.yml + * add "subdomain offset" setting for tweaking `req.subdomains` + * add `res.location(url)` implementing `res.redirect()`-like setting of Location + * use app.get() for x-powered-by setting for inheritance + * fix colons in passwords for `req.auth` + +3.0.6 / 2013-01-04 +================== + + * add http verb methods to Router + * update connect + * fix mangling of the `res.cookie()` options object + * fix jsonp whitespace escape. Closes #1132 + +3.0.5 / 2012-12-19 +================== + + * add throwing when a non-function is passed to a route + * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses + * revert "add 'etag' option" + +3.0.4 / 2012-12-05 +================== + + * add 'etag' option to disable `res.send()` Etags + * add escaping of urls in text/plain in `res.redirect()` + for old browsers interpreting as html + * change crc32 module for a more liberal license + * update connect + +3.0.3 / 2012-11-13 +================== + + * update connect + * update cookie module + * fix cookie max-age + +3.0.2 / 2012-11-08 +================== + + * add OPTIONS to cors example. Closes #1398 + * fix route chaining regression. Closes #1397 + +3.0.1 / 2012-11-01 +================== + + * update connect + +3.0.0 / 2012-10-23 +================== + + * add `make clean` + * add "Basic" check to req.auth + * add `req.auth` test coverage + * add cb && cb(payload) to `res.jsonp()`. Closes #1374 + * add backwards compat for `res.redirect()` status. Closes #1336 + * add support for `res.json()` to retain previously defined Content-Types. Closes #1349 + * update connect + * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382 + * remove non-primitive string support for `res.send()` + * fix view-locals example. Closes #1370 + * fix route-separation example + +3.0.0rc5 / 2012-09-18 +================== + + * update connect + * add redis search example + * add static-files example + * add "x-powered-by" setting (`app.disable('x-powered-by')`) + * add "application/octet-stream" redirect Accept test case. Closes #1317 + +3.0.0rc4 / 2012-08-30 +================== + + * add `res.jsonp()`. Closes #1307 + * add "verbose errors" option to error-pages example + * add another route example to express(1) so people are not so confused + * add redis online user activity tracking example + * update connect dep + * fix etag quoting. Closes #1310 + * fix error-pages 404 status + * fix jsonp callback char restrictions + * remove old OPTIONS default response + +3.0.0rc3 / 2012-08-13 +================== + + * update connect dep + * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds] + * fix `res.render()` clobbering of "locals" + +3.0.0rc2 / 2012-08-03 +================== + + * add CORS example + * update connect dep + * deprecate `.createServer()` & remove old stale examples + * fix: escape `res.redirect()` link + * fix vhost example + +3.0.0rc1 / 2012-07-24 +================== + + * add more examples to view-locals + * add scheme-relative redirects (`res.redirect("//foo.com")`) support + * update cookie dep + * update connect dep + * update send dep + * fix `express(1)` -h flag, use -H for hogan. Closes #1245 + * fix `res.sendfile()` socket error handling regression + +3.0.0beta7 / 2012-07-16 +================== + + * update connect dep for `send()` root normalization regression + +3.0.0beta6 / 2012-07-13 +================== + + * add `err.view` property for view errors. Closes #1226 + * add "jsonp callback name" setting + * add support for "/foo/:bar*" non-greedy matches + * change `res.sendfile()` to use `send()` module + * change `res.send` to use "response-send" module + * remove `app.locals.use` and `res.locals.use`, use regular middleware + +3.0.0beta5 / 2012-07-03 +================== + + * add "make check" support + * add route-map example + * add `res.json(obj, status)` support back for BC + * add "methods" dep, remove internal methods module + * update connect dep + * update auth example to utilize cores pbkdf2 + * updated tests to use "supertest" + +3.0.0beta4 / 2012-06-25 +================== + + * Added `req.auth` + * Added `req.range(size)` + * Added `res.links(obj)` + * Added `res.send(body, status)` support back for backwards compat + * Added `.default()` support to `res.format()` + * Added 2xx / 304 check to `req.fresh` + * Revert "Added + support to the router" + * Fixed `res.send()` freshness check, respect res.statusCode + +3.0.0beta3 / 2012-06-15 +================== + + * Added hogan `--hjs` to express(1) [nullfirm] + * Added another example to content-negotiation + * Added `fresh` dep + * Changed: `res.send()` always checks freshness + * Fixed: expose connects mime module. Closes #1165 + +3.0.0beta2 / 2012-06-06 +================== + + * Added `+` support to the router + * Added `req.host` + * Changed `req.param()` to check route first + * Update connect dep + +3.0.0beta1 / 2012-06-01 +================== + + * Added `res.format()` callback to override default 406 behaviour + * Fixed `res.redirect()` 406. Closes #1154 + +3.0.0alpha5 / 2012-05-30 +================== + + * Added `req.ip` + * Added `{ signed: true }` option to `res.cookie()` + * Removed `res.signedCookie()` + * Changed: dont reverse `req.ips` + * Fixed "trust proxy" setting check for `req.ips` + +3.0.0alpha4 / 2012-05-09 +================== + + * Added: allow `[]` in jsonp callback. Closes #1128 + * Added `PORT` env var support in generated template. Closes #1118 [benatkin] + * Updated: connect 2.2.2 + +3.0.0alpha3 / 2012-05-04 +================== + + * Added public `app.routes`. Closes #887 + * Added _view-locals_ example + * Added _mvc_ example + * Added `res.locals.use()`. Closes #1120 + * Added conditional-GET support to `res.send()` + * Added: coerce `res.set()` values to strings + * Changed: moved `static()` in generated apps below router + * Changed: `res.send()` only set ETag when not previously set + * Changed connect 2.2.1 dep + * Changed: `make test` now runs unit / acceptance tests + * Fixed req/res proto inheritance + +3.0.0alpha2 / 2012-04-26 +================== + + * Added `make benchmark` back + * Added `res.send()` support for `String` objects + * Added client-side data exposing example + * Added `res.header()` and `req.header()` aliases for BC + * Added `express.createServer()` for BC + * Perf: memoize parsed urls + * Perf: connect 2.2.0 dep + * Changed: make `expressInit()` middleware self-aware + * Fixed: use app.get() for all core settings + * Fixed redis session example + * Fixed session example. Closes #1105 + * Fixed generated express dep. Closes #1078 + +3.0.0alpha1 / 2012-04-15 +================== + + * Added `app.locals.use(callback)` + * Added `app.locals` object + * Added `app.locals(obj)` + * Added `res.locals` object + * Added `res.locals(obj)` + * Added `res.format()` for content-negotiation + * Added `app.engine()` + * Added `res.cookie()` JSON cookie support + * Added "trust proxy" setting + * Added `req.subdomains` + * Added `req.protocol` + * Added `req.secure` + * Added `req.path` + * Added `req.ips` + * Added `req.fresh` + * Added `req.stale` + * Added comma-delimited / array support for `req.accepts()` + * Added debug instrumentation + * Added `res.set(obj)` + * Added `res.set(field, value)` + * Added `res.get(field)` + * Added `app.get(setting)`. Closes #842 + * Added `req.acceptsLanguage()` + * Added `req.acceptsCharset()` + * Added `req.accepted` + * Added `req.acceptedLanguages` + * Added `req.acceptedCharsets` + * Added "json replacer" setting + * Added "json spaces" setting + * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92 + * Added `--less` support to express(1) + * Added `express.response` prototype + * Added `express.request` prototype + * Added `express.application` prototype + * Added `app.path()` + * Added `app.render()` + * Added `res.type()` to replace `res.contentType()` + * Changed: `res.redirect()` to add relative support + * Changed: enable "jsonp callback" by default + * Changed: renamed "case sensitive routes" to "case sensitive routing" + * Rewrite of all tests with mocha + * Removed "root" setting + * Removed `res.redirect('home')` support + * Removed `req.notify()` + * Removed `app.register()` + * Removed `app.redirect()` + * Removed `app.is()` + * Removed `app.helpers()` + * Removed `app.dynamicHelpers()` + * Fixed `res.sendfile()` with non-GET. Closes #723 + * Fixed express(1) public dir for windows. Closes #866 + +2.5.9/ 2012-04-02 +================== + + * Added support for PURGE request method [pbuyle] + * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki] + +2.5.8 / 2012-02-08 +================== + + * Update mkdirp dep. Closes #991 + +2.5.7 / 2012-02-06 +================== + + * Fixed `app.all` duplicate DELETE requests [mscdex] + +2.5.6 / 2012-01-13 +================== + + * Updated hamljs dev dep. Closes #953 + +2.5.5 / 2012-01-08 +================== + + * Fixed: set `filename` on cached templates [matthewleon] + +2.5.4 / 2012-01-02 +================== + + * Fixed `express(1)` eol on 0.4.x. Closes #947 + +2.5.3 / 2011-12-30 +================== + + * Fixed `req.is()` when a charset is present + +2.5.2 / 2011-12-10 +================== + + * Fixed: express(1) LF -> CRLF for windows + +2.5.1 / 2011-11-17 +================== + + * Changed: updated connect to 1.8.x + * Removed sass.js support from express(1) + +2.5.0 / 2011-10-24 +================== + + * Added ./routes dir for generated app by default + * Added npm install reminder to express(1) app gen + * Added 0.5.x support + * Removed `make test-cov` since it wont work with node 0.5.x + * Fixed express(1) public dir for windows. Closes #866 + +2.4.7 / 2011-10-05 +================== + + * Added mkdirp to express(1). Closes #795 + * Added simple _json-config_ example + * Added shorthand for the parsed request's pathname via `req.path` + * Changed connect dep to 1.7.x to fix npm issue... + * Fixed `res.redirect()` __HEAD__ support. [reported by xerox] + * Fixed `req.flash()`, only escape args + * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie] + +2.4.6 / 2011-08-22 +================== + + * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode] + +2.4.5 / 2011-08-19 +================== + + * Added support for routes to handle errors. Closes #809 + * Added `app.routes.all()`. Closes #803 + * Added "basepath" setting to work in conjunction with reverse proxies etc. + * Refactored `Route` to use a single array of callbacks + * Added support for multiple callbacks for `app.param()`. Closes #801 +Closes #805 + * Changed: removed .call(self) for route callbacks + * Dependency: `qs >= 0.3.1` + * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808 + +2.4.4 / 2011-08-05 +================== + + * Fixed `res.header()` intention of a set, even when `undefined` + * Fixed `*`, value no longer required + * Fixed `res.send(204)` support. Closes #771 + +2.4.3 / 2011-07-14 +================== + + * Added docs for `status` option special-case. Closes #739 + * Fixed `options.filename`, exposing the view path to template engines + +2.4.2. / 2011-07-06 +================== + + * Revert "removed jsonp stripping" for XSS + +2.4.1 / 2011-07-06 +================== + + * Added `res.json()` JSONP support. Closes #737 + * Added _extending-templates_ example. Closes #730 + * Added "strict routing" setting for trailing slashes + * Added support for multiple envs in `app.configure()` calls. Closes #735 + * Changed: `res.send()` using `res.json()` + * Changed: when cookie `path === null` don't default it + * Changed; default cookie path to "home" setting. Closes #731 + * Removed _pids/logs_ creation from express(1) + +2.4.0 / 2011-06-28 +================== + + * Added chainable `res.status(code)` + * Added `res.json()`, an explicit version of `res.send(obj)` + * Added simple web-service example + +2.3.12 / 2011-06-22 +================== + + * \#express is now on freenode! come join! + * Added `req.get(field, param)` + * Added links to Japanese documentation, thanks @hideyukisaito! + * Added; the `express(1)` generated app outputs the env + * Added `content-negotiation` example + * Dependency: connect >= 1.5.1 < 2.0.0 + * Fixed view layout bug. Closes #720 + * Fixed; ignore body on 304. Closes #701 + +2.3.11 / 2011-06-04 +================== + + * Added `npm test` + * Removed generation of dummy test file from `express(1)` + * Fixed; `express(1)` adds express as a dep + * Fixed; prune on `prepublish` + +2.3.10 / 2011-05-27 +================== + + * Added `req.route`, exposing the current route + * Added _package.json_ generation support to `express(1)` + * Fixed call to `app.param()` function for optional params. Closes #682 + +2.3.9 / 2011-05-25 +================== + + * Fixed bug-ish with `../' in `res.partial()` calls + +2.3.8 / 2011-05-24 +================== + + * Fixed `app.options()` + +2.3.7 / 2011-05-23 +================== + + * Added route `Collection`, ex: `app.get('/user/:id').remove();` + * Added support for `app.param(fn)` to define param logic + * Removed `app.param()` support for callback with return value + * Removed module.parent check from express(1) generated app. Closes #670 + * Refactored router. Closes #639 + +2.3.6 / 2011-05-20 +================== + + * Changed; using devDependencies instead of git submodules + * Fixed redis session example + * Fixed markdown example + * Fixed view caching, should not be enabled in development + +2.3.5 / 2011-05-20 +================== + + * Added export `.view` as alias for `.View` + +2.3.4 / 2011-05-08 +================== + + * Added `./examples/say` + * Fixed `res.sendfile()` bug preventing the transfer of files with spaces + +2.3.3 / 2011-05-03 +================== + + * Added "case sensitive routes" option. + * Changed; split methods supported per rfc [slaskis] + * Fixed route-specific middleware when using the same callback function several times + +2.3.2 / 2011-04-27 +================== + + * Fixed view hints + +2.3.1 / 2011-04-26 +================== + + * Added `app.match()` as `app.match.all()` + * Added `app.lookup()` as `app.lookup.all()` + * Added `app.remove()` for `app.remove.all()` + * Added `app.remove.VERB()` + * Fixed template caching collision issue. Closes #644 + * Moved router over from connect and started refactor + +2.3.0 / 2011-04-25 +================== + + * Added options support to `res.clearCookie()` + * Added `res.helpers()` as alias of `res.locals()` + * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel * Dependency `connect >= 1.4.0` + * Changed; auto set Content-Type in res.attachement [Aaron Heckmann] + * Renamed "cache views" to "view cache". Closes #628 + * Fixed caching of views when using several apps. Closes #637 + * Fixed gotcha invoking `app.param()` callbacks once per route middleware. +Closes #638 + * Fixed partial lookup precedence. Closes #631 +Shaw] + +2.2.2 / 2011-04-12 +================== + + * Added second callback support for `res.download()` connection errors + * Fixed `filename` option passing to template engine + +2.2.1 / 2011-04-04 +================== + + * Added `layout(path)` helper to change the layout within a view. Closes #610 + * Fixed `partial()` collection object support. + Previously only anything with `.length` would work. + When `.length` is present one must still be aware of holes, + however now `{ collection: {foo: 'bar'}}` is valid, exposes + `keyInCollection` and `keysInCollection`. + + * Performance improved with better view caching + * Removed `request` and `response` locals + * Changed; errorHandler page title is now `Express` instead of `Connect` + +2.2.0 / 2011-03-30 +================== + + * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606 + * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606 + * Added `app.VERB(path)` as alias of `app.lookup.VERB()`. + * Dependency `connect >= 1.2.0` + +2.1.1 / 2011-03-29 +================== + + * Added; expose `err.view` object when failing to locate a view + * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann] + * Fixed; `res.send(undefined)` responds with 204 [aheckmann] + +2.1.0 / 2011-03-24 +================== + + * Added `/_?` partial lookup support. Closes #447 + * Added `request`, `response`, and `app` local variables + * Added `settings` local variable, containing the app's settings + * Added `req.flash()` exception if `req.session` is not available + * Added `res.send(bool)` support (json response) + * Fixed stylus example for latest version + * Fixed; wrap try/catch around `res.render()` + +2.0.0 / 2011-03-17 +================== + + * Fixed up index view path alternative. + * Changed; `res.locals()` without object returns the locals + +2.0.0rc3 / 2011-03-17 +================== + + * Added `res.locals(obj)` to compliment `res.local(key, val)` + * Added `res.partial()` callback support + * Fixed recursive error reporting issue in `res.render()` + +2.0.0rc2 / 2011-03-17 +================== + + * Changed; `partial()` "locals" are now optional + * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01] + * Fixed .filename view engine option [reported by drudge] + * Fixed blog example + * Fixed `{req,res}.app` reference when mounting [Ben Weaver] + +2.0.0rc / 2011-03-14 +================== + + * Fixed; expose `HTTPSServer` constructor + * Fixed express(1) default test charset. Closes #579 [reported by secoif] + * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP] + +2.0.0beta3 / 2011-03-09 +================== + + * Added support for `res.contentType()` literal + The original `res.contentType('.json')`, + `res.contentType('application/json')`, and `res.contentType('json')` + will work now. + * Added `res.render()` status option support back + * Added charset option for `res.render()` + * Added `.charset` support (via connect 1.0.4) + * Added view resolution hints when in development and a lookup fails + * Added layout lookup support relative to the page view. + For example while rendering `./views/user/index.jade` if you create + `./views/user/layout.jade` it will be used in favour of the root layout. + * Fixed `res.redirect()`. RFC states absolute url [reported by unlink] + * Fixed; default `res.send()` string charset to utf8 + * Removed `Partial` constructor (not currently used) + +2.0.0beta2 / 2011-03-07 +================== + + * Added res.render() `.locals` support back to aid in migration process + * Fixed flash example + +2.0.0beta / 2011-03-03 +================== + + * Added HTTPS support + * Added `res.cookie()` maxAge support + * Added `req.header()` _Referrer_ / _Referer_ special-case, either works + * Added mount support for `res.redirect()`, now respects the mount-point + * Added `union()` util, taking place of `merge(clone())` combo + * Added stylus support to express(1) generated app + * Added secret to session middleware used in examples and generated app + * Added `res.local(name, val)` for progressive view locals + * Added default param support to `req.param(name, default)` + * Added `app.disabled()` and `app.enabled()` + * Added `app.register()` support for omitting leading ".", either works + * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539 + * Added `app.param()` to map route params to async/sync logic + * Added; aliased `app.helpers()` as `app.locals()`. Closes #481 + * Added extname with no leading "." support to `res.contentType()` + * Added `cache views` setting, defaulting to enabled in "production" env + * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_. + * Added `req.accepts()` support for extensions + * Changed; `res.download()` and `res.sendfile()` now utilize Connect's + static file server `connect.static.send()`. + * Changed; replaced `connect.utils.mime()` with npm _mime_ module + * Changed; allow `req.query` to be pre-defined (via middleware or other parent + * Changed view partial resolution, now relative to parent view + * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`. + * Fixed `req.param()` bug returning Array.prototype methods. Closes #552 + * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()` + * Fixed; using _qs_ module instead of _querystring_ + * Fixed; strip unsafe chars from jsonp callbacks + * Removed "stream threshold" setting + +1.0.8 / 2011-03-01 +================== + + * Allow `req.query` to be pre-defined (via middleware or other parent app) + * "connect": ">= 0.5.0 < 1.0.0". Closes #547 + * Removed the long deprecated __EXPRESS_ENV__ support + +1.0.7 / 2011-02-07 +================== + + * Fixed `render()` setting inheritance. + Mounted apps would not inherit "view engine" + +1.0.6 / 2011-02-07 +================== + + * Fixed `view engine` setting bug when period is in dirname + +1.0.5 / 2011-02-05 +================== + + * Added secret to generated app `session()` call + +1.0.4 / 2011-02-05 +================== + + * Added `qs` dependency to _package.json_ + * Fixed namespaced `require()`s for latest connect support + +1.0.3 / 2011-01-13 +================== + + * Remove unsafe characters from JSONP callback names [Ryan Grove] + +1.0.2 / 2011-01-10 +================== + + * Removed nested require, using `connect.router` + +1.0.1 / 2010-12-29 +================== + + * Fixed for middleware stacked via `createServer()` + previously the `foo` middleware passed to `createServer(foo)` + would not have access to Express methods such as `res.send()` + or props like `req.query` etc. + +1.0.0 / 2010-11-16 +================== + + * Added; deduce partial object names from the last segment. + For example by default `partial('forum/post', postObject)` will + give you the _post_ object, providing a meaningful default. + * Added http status code string representation to `res.redirect()` body + * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__. + * Added `req.is()` to aid in content negotiation + * Added partial local inheritance [suggested by masylum]. Closes #102 + providing access to parent template locals. + * Added _-s, --session[s]_ flag to express(1) to add session related middleware + * Added _--template_ flag to express(1) to specify the + template engine to use. + * Added _--css_ flag to express(1) to specify the + stylesheet engine to use (or just plain css by default). + * Added `app.all()` support [thanks aheckmann] + * Added partial direct object support. + You may now `partial('user', user)` providing the "user" local, + vs previously `partial('user', { object: user })`. + * Added _route-separation_ example since many people question ways + to do this with CommonJS modules. Also view the _blog_ example for + an alternative. + * Performance; caching view path derived partial object names + * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454 + * Fixed jsonp support; _text/javascript_ as per mailinglist discussion + +1.0.0rc4 / 2010-10-14 +================== + + * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0 + * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware)) + * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass] + * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass] + * Added `partial()` support for array-like collections. Closes #434 + * Added support for swappable querystring parsers + * Added session usage docs. Closes #443 + * Added dynamic helper caching. Closes #439 [suggested by maritz] + * Added authentication example + * Added basic Range support to `res.sendfile()` (and `res.download()` etc) + * Changed; `express(1)` generated app using 2 spaces instead of 4 + * Default env to "development" again [aheckmann] + * Removed _context_ option is no more, use "scope" + * Fixed; exposing _./support_ libs to examples so they can run without installs + * Fixed mvc example + +1.0.0rc3 / 2010-09-20 +================== + + * Added confirmation for `express(1)` app generation. Closes #391 + * Added extending of flash formatters via `app.flashFormatters` + * Added flash formatter support. Closes #411 + * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold" + * Added _stream threshold_ setting for `res.sendfile()` + * Added `res.send()` __HEAD__ support + * Added `res.clearCookie()` + * Added `res.cookie()` + * Added `res.render()` headers option + * Added `res.redirect()` response bodies + * Added `res.render()` status option support. Closes #425 [thanks aheckmann] + * Fixed `res.sendfile()` responding with 403 on malicious path + * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_ + * Fixed; mounted apps settings now inherit from parent app [aheckmann] + * Fixed; stripping Content-Length / Content-Type when 204 + * Fixed `res.send()` 204. Closes #419 + * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402 + * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo] + + +1.0.0rc2 / 2010-08-17 +================== + + * Added `app.register()` for template engine mapping. Closes #390 + * Added `res.render()` callback support as second argument (no options) + * Added callback support to `res.download()` + * Added callback support for `res.sendfile()` + * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()` + * Added "partials" setting to docs + * Added default expresso tests to `express(1)` generated app. Closes #384 + * Fixed `res.sendfile()` error handling, defer via `next()` + * Fixed `res.render()` callback when a layout is used [thanks guillermo] + * Fixed; `make install` creating ~/.node_libraries when not present + * Fixed issue preventing error handlers from being defined anywhere. Closes #387 + +1.0.0rc / 2010-07-28 +================== + + * Added mounted hook. Closes #369 + * Added connect dependency to _package.json_ + + * Removed "reload views" setting and support code + development env never caches, production always caches. + + * Removed _param_ in route callbacks, signature is now + simply (req, res, next), previously (req, res, params, next). + Use _req.params_ for path captures, _req.query_ for GET params. + + * Fixed "home" setting + * Fixed middleware/router precedence issue. Closes #366 + * Fixed; _configure()_ callbacks called immediately. Closes #368 + +1.0.0beta2 / 2010-07-23 +================== + + * Added more examples + * Added; exporting `Server` constructor + * Added `Server#helpers()` for view locals + * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349 + * Added support for absolute view paths + * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363 + * Added Guillermo Rauch to the contributor list + * Added support for "as" for non-collection partials. Closes #341 + * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf] + * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo] + * Fixed instanceof `Array` checks, now `Array.isArray()` + * Fixed express(1) expansion of public dirs. Closes #348 + * Fixed middleware precedence. Closes #345 + * Fixed view watcher, now async [thanks aheckmann] + +1.0.0beta / 2010-07-15 +================== + + * Re-write + - much faster + - much lighter + - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs + +0.14.0 / 2010-06-15 +================== + + * Utilize relative requires + * Added Static bufferSize option [aheckmann] + * Fixed caching of view and partial subdirectories [aheckmann] + * Fixed mime.type() comments now that ".ext" is not supported + * Updated haml submodule + * Updated class submodule + * Removed bin/express + +0.13.0 / 2010-06-01 +================== + + * Added node v0.1.97 compatibility + * Added support for deleting cookies via Request#cookie('key', null) + * Updated haml submodule + * Fixed not-found page, now using charset utf-8 + * Fixed show-exceptions page, now using charset utf-8 + * Fixed view support due to fs.readFile Buffers + * Changed; mime.type() no longer accepts ".type" due to node extname() changes + +0.12.0 / 2010-05-22 +================== + + * Added node v0.1.96 compatibility + * Added view `helpers` export which act as additional local variables + * Updated haml submodule + * Changed ETag; removed inode, modified time only + * Fixed LF to CRLF for setting multiple cookies + * Fixed cookie compilation; values are now urlencoded + * Fixed cookies parsing; accepts quoted values and url escaped cookies + +0.11.0 / 2010-05-06 +================== + + * Added support for layouts using different engines + - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' }) + - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml' + - this.render('page.html.haml', { layout: false }) // no layout + * Updated ext submodule + * Updated haml submodule + * Fixed EJS partial support by passing along the context. Issue #307 + +0.10.1 / 2010-05-03 +================== + + * Fixed binary uploads. + +0.10.0 / 2010-04-30 +================== + + * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s + encoding is set to 'utf8' or 'utf-8'). + * Added "encoding" option to Request#render(). Closes #299 + * Added "dump exceptions" setting, which is enabled by default. + * Added simple ejs template engine support + * Added error response support for text/plain, application/json. Closes #297 + * Added callback function param to Request#error() + * Added Request#sendHead() + * Added Request#stream() + * Added support for Request#respond(304, null) for empty response bodies + * Added ETag support to Request#sendfile() + * Added options to Request#sendfile(), passed to fs.createReadStream() + * Added filename arg to Request#download() + * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request + * Performance enhanced by preventing several calls to toLowerCase() in Router#match() + * Changed; Request#sendfile() now streams + * Changed; Renamed Request#halt() to Request#respond(). Closes #289 + * Changed; Using sys.inspect() instead of JSON.encode() for error output + * Changed; run() returns the http.Server instance. Closes #298 + * Changed; Defaulting Server#host to null (INADDR_ANY) + * Changed; Logger "common" format scale of 0.4f + * Removed Logger "request" format + * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found + * Fixed several issues with http client + * Fixed Logger Content-Length output + * Fixed bug preventing Opera from retaining the generated session id. Closes #292 + +0.9.0 / 2010-04-14 +================== + + * Added DSL level error() route support + * Added DSL level notFound() route support + * Added Request#error() + * Added Request#notFound() + * Added Request#render() callback function. Closes #258 + * Added "max upload size" setting + * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254 + * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js + * Added callback function support to Request#halt() as 3rd/4th arg + * Added preprocessing of route param wildcards using param(). Closes #251 + * Added view partial support (with collections etc.) + * Fixed bug preventing falsey params (such as ?page=0). Closes #286 + * Fixed setting of multiple cookies. Closes #199 + * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml) + * Changed; session cookie is now httpOnly + * Changed; Request is no longer global + * Changed; Event is no longer global + * Changed; "sys" module is no longer global + * Changed; moved Request#download to Static plugin where it belongs + * Changed; Request instance created before body parsing. Closes #262 + * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253 + * Changed; Pre-caching view partials in memory when "cache view partials" is enabled + * Updated support to node --version 0.1.90 + * Updated dependencies + * Removed set("session cookie") in favour of use(Session, { cookie: { ... }}) + * Removed utils.mixin(); use Object#mergeDeep() + +0.8.0 / 2010-03-19 +================== + + * Added coffeescript example app. Closes #242 + * Changed; cache api now async friendly. Closes #240 + * Removed deprecated 'express/static' support. Use 'express/plugins/static' + +0.7.6 / 2010-03-19 +================== + + * Added Request#isXHR. Closes #229 + * Added `make install` (for the executable) + * Added `express` executable for setting up simple app templates + * Added "GET /public/*" to Static plugin, defaulting to /public + * Added Static plugin + * Fixed; Request#render() only calls cache.get() once + * Fixed; Namespacing View caches with "view:" + * Fixed; Namespacing Static caches with "static:" + * Fixed; Both example apps now use the Static plugin + * Fixed set("views"). Closes #239 + * Fixed missing space for combined log format + * Deprecated Request#sendfile() and 'express/static' + * Removed Server#running + +0.7.5 / 2010-03-16 +================== + + * Added Request#flash() support without args, now returns all flashes + * Updated ext submodule + +0.7.4 / 2010-03-16 +================== + + * Fixed session reaper + * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft) + +0.7.3 / 2010-03-16 +================== + + * Added package.json + * Fixed requiring of haml / sass due to kiwi removal + +0.7.2 / 2010-03-16 +================== + + * Fixed GIT submodules (HAH!) + +0.7.1 / 2010-03-16 +================== + + * Changed; Express now using submodules again until a PM is adopted + * Changed; chat example using millisecond conversions from ext + +0.7.0 / 2010-03-15 +================== + + * Added Request#pass() support (finds the next matching route, or the given path) + * Added Logger plugin (default "common" format replaces CommonLogger) + * Removed Profiler plugin + * Removed CommonLogger plugin + +0.6.0 / 2010-03-11 +================== + + * Added seed.yml for kiwi package management support + * Added HTTP client query string support when method is GET. Closes #205 + + * Added support for arbitrary view engines. + For example "foo.engine.html" will now require('engine'), + the exports from this module are cached after the first require(). + + * Added async plugin support + + * Removed usage of RESTful route funcs as http client + get() etc, use http.get() and friends + + * Removed custom exceptions + +0.5.0 / 2010-03-10 +================== + + * Added ext dependency (library of js extensions) + * Removed extname() / basename() utils. Use path module + * Removed toArray() util. Use arguments.values + * Removed escapeRegexp() util. Use RegExp.escape() + * Removed process.mixin() dependency. Use utils.mixin() + * Removed Collection + * Removed ElementCollection + * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com) ;) + +0.4.0 / 2010-02-11 +================== + + * Added flash() example to sample upload app + * Added high level restful http client module (express/http) + * Changed; RESTful route functions double as HTTP clients. Closes #69 + * Changed; throwing error when routes are added at runtime + * Changed; defaulting render() context to the current Request. Closes #197 + * Updated haml submodule + +0.3.0 / 2010-02-11 +================== + + * Updated haml / sass submodules. Closes #200 + * Added flash message support. Closes #64 + * Added accepts() now allows multiple args. fixes #117 + * Added support for plugins to halt. Closes #189 + * Added alternate layout support. Closes #119 + * Removed Route#run(). Closes #188 + * Fixed broken specs due to use(Cookie) missing + +0.2.1 / 2010-02-05 +================== + + * Added "plot" format option for Profiler (for gnuplot processing) + * Added request number to Profiler plugin + * Fixed binary encoding for multipart file uploads, was previously defaulting to UTF8 + * Fixed issue with routes not firing when not files are present. Closes #184 + * Fixed process.Promise -> events.Promise + +0.2.0 / 2010-02-03 +================== + + * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180 + * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174 + * Added expiration support to cache api with reaper. Closes #133 + * Added cache Store.Memory#reap() + * Added Cache; cache api now uses first class Cache instances + * Added abstract session Store. Closes #172 + * Changed; cache Memory.Store#get() utilizing Collection + * Renamed MemoryStore -> Store.Memory + * Fixed use() of the same plugin several time will always use latest options. Closes #176 + +0.1.0 / 2010-02-03 +================== + + * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context + * Updated node support to 0.1.27 Closes #169 + * Updated dirname(__filename) -> __dirname + * Updated libxmljs support to v0.2.0 + * Added session support with memory store / reaping + * Added quick uid() helper + * Added multi-part upload support + * Added Sass.js support / submodule + * Added production env caching view contents and static files + * Added static file caching. Closes #136 + * Added cache plugin with memory stores + * Added support to StaticFile so that it works with non-textual files. + * Removed dirname() helper + * Removed several globals (now their modules must be required) + +0.0.2 / 2010-01-10 +================== + + * Added view benchmarks; currently haml vs ejs + * Added Request#attachment() specs. Closes #116 + * Added use of node's parseQuery() util. Closes #123 + * Added `make init` for submodules + * Updated Haml + * Updated sample chat app to show messages on load + * Updated libxmljs parseString -> parseHtmlString + * Fixed `make init` to work with older versions of git + * Fixed specs can now run independent specs for those who can't build deps. Closes #127 + * Fixed issues introduced by the node url module changes. Closes 126. + * Fixed two assertions failing due to Collection#keys() returning strings + * Fixed faulty Collection#toArray() spec due to keys() returning strings + * Fixed `make test` now builds libxmljs.node before testing + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/express/LICENSE b/graphql-subscription-express/node_modules/express/LICENSE new file mode 100644 index 0000000..aa927e4 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2009-2014 TJ Holowaychuk +Copyright (c) 2013-2014 Roman Shtylman +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/express/Readme.md b/graphql-subscription-express/node_modules/express/Readme.md new file mode 100644 index 0000000..d0f3cf5 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/Readme.md @@ -0,0 +1,166 @@ +[![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](http://expressjs.com/) + + Fast, unopinionated, minimalist web framework for [Node.js](http://nodejs.org). + + [![NPM Version][npm-version-image]][npm-url] + [![NPM Install Size][npm-install-size-image]][npm-install-size-url] + [![NPM Downloads][npm-downloads-image]][npm-downloads-url] + +```js +const express = require('express') +const app = express() + +app.get('/', function (req, res) { + res.send('Hello World') +}) + +app.listen(3000) +``` + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). + +Before installing, [download and install Node.js](https://nodejs.org/en/download/). +Node.js 0.10 or higher is required. + +If this is a brand new project, make sure to create a `package.json` first with +the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file). + +Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```console +$ npm install express +``` + +Follow [our installing guide](http://expressjs.com/en/starter/installing.html) +for more information. + +## Features + + * Robust routing + * Focus on high performance + * Super-high test coverage + * HTTP helpers (redirection, caching, etc) + * View system supporting 14+ template engines + * Content negotiation + * Executable for generating applications quickly + +## Docs & Community + + * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)] + * [#express](https://web.libera.chat/#express) on [Libera Chat](https://libera.chat) IRC + * [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules + * Visit the [Wiki](https://github.com/expressjs/express/wiki) + * [Google Group](https://groups.google.com/group/express-js) for discussion + * [Gitter](https://gitter.im/expressjs/express) for support and discussion + +**PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/expressjs/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/expressjs/express/wiki/New-features-in-4.x). + +## Quick Start + + The quickest way to get started with express is to utilize the executable [`express(1)`](https://github.com/expressjs/generator) to generate an application as shown below: + + Install the executable. The executable's major version will match Express's: + +```console +$ npm install -g express-generator@4 +``` + + Create the app: + +```console +$ express /tmp/foo && cd /tmp/foo +``` + + Install dependencies: + +```console +$ npm install +``` + + Start the server: + +```console +$ npm start +``` + + View the website at: http://localhost:3000 + +## Philosophy + + The Express philosophy is to provide small, robust tooling for HTTP servers, making + it a great solution for single page applications, websites, hybrids, or public + HTTP APIs. + + Express does not force you to use any specific ORM or template engine. With support for over + 14 template engines via [Consolidate.js](https://github.com/tj/consolidate.js), + you can quickly craft your perfect framework. + +## Examples + + To view the examples, clone the Express repo and install the dependencies: + +```console +$ git clone https://github.com/expressjs/express.git --depth 1 +$ cd express +$ npm install +``` + + Then run whichever example you want: + +```console +$ node examples/content-negotiation +``` + +## Contributing + + [![Linux Build][github-actions-ci-image]][github-actions-ci-url] + [![Windows Build][appveyor-image]][appveyor-url] + [![Test Coverage][coveralls-image]][coveralls-url] + +The Express.js project welcomes all constructive contributions. Contributions take many forms, +from code for bug fixes and enhancements, to additions and fixes to documentation, additional +tests, triaging incoming pull requests and issues, and more! + +See the [Contributing Guide](Contributing.md) for more technical details on contributing. + +### Security Issues + +If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md). + +### Running Tests + +To run the test suite, first install the dependencies, then run `npm test`: + +```console +$ npm install +$ npm test +``` + +## People + +The original author of Express is [TJ Holowaychuk](https://github.com/tj) + +The current lead maintainer is [Douglas Christopher Wilson](https://github.com/dougwilson) + +[List of all contributors](https://github.com/expressjs/express/graphs/contributors) + +## License + + [MIT](LICENSE) + +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/express/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/express +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/express/master +[coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master +[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/express/master?label=linux +[github-actions-ci-url]: https://github.com/expressjs/express/actions/workflows/ci.yml +[npm-downloads-image]: https://badgen.net/npm/dm/express +[npm-downloads-url]: https://npmcharts.com/compare/express?minimal=true +[npm-install-size-image]: https://badgen.net/packagephobia/install/express +[npm-install-size-url]: https://packagephobia.com/result?p=express +[npm-url]: https://npmjs.org/package/express +[npm-version-image]: https://badgen.net/npm/v/express diff --git a/graphql-subscription-express/node_modules/express/index.js b/graphql-subscription-express/node_modules/express/index.js new file mode 100644 index 0000000..d219b0c --- /dev/null +++ b/graphql-subscription-express/node_modules/express/index.js @@ -0,0 +1,11 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +module.exports = require('./lib/express'); diff --git a/graphql-subscription-express/node_modules/express/lib/application.js b/graphql-subscription-express/node_modules/express/lib/application.js new file mode 100644 index 0000000..ebb30b5 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/application.js @@ -0,0 +1,661 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var finalhandler = require('finalhandler'); +var Router = require('./router'); +var methods = require('methods'); +var middleware = require('./middleware/init'); +var query = require('./middleware/query'); +var debug = require('debug')('express:application'); +var View = require('./view'); +var http = require('http'); +var compileETag = require('./utils').compileETag; +var compileQueryParser = require('./utils').compileQueryParser; +var compileTrust = require('./utils').compileTrust; +var deprecate = require('depd')('express'); +var flatten = require('array-flatten'); +var merge = require('utils-merge'); +var resolve = require('path').resolve; +var setPrototypeOf = require('setprototypeof') + +/** + * Module variables. + * @private + */ + +var hasOwnProperty = Object.prototype.hasOwnProperty +var slice = Array.prototype.slice; + +/** + * Application prototype. + */ + +var app = exports = module.exports = {}; + +/** + * Variable for trust proxy inheritance back-compat + * @private + */ + +var trustProxyDefaultSymbol = '@@symbol:trust_proxy_default'; + +/** + * Initialize the server. + * + * - setup default configuration + * - setup default middleware + * - setup route reflection methods + * + * @private + */ + +app.init = function init() { + this.cache = {}; + this.engines = {}; + this.settings = {}; + + this.defaultConfiguration(); +}; + +/** + * Initialize application configuration. + * @private + */ + +app.defaultConfiguration = function defaultConfiguration() { + var env = process.env.NODE_ENV || 'development'; + + // default settings + this.enable('x-powered-by'); + this.set('etag', 'weak'); + this.set('env', env); + this.set('query parser', 'extended'); + this.set('subdomain offset', 2); + this.set('trust proxy', false); + + // trust proxy inherit back-compat + Object.defineProperty(this.settings, trustProxyDefaultSymbol, { + configurable: true, + value: true + }); + + debug('booting in %s mode', env); + + this.on('mount', function onmount(parent) { + // inherit trust proxy + if (this.settings[trustProxyDefaultSymbol] === true + && typeof parent.settings['trust proxy fn'] === 'function') { + delete this.settings['trust proxy']; + delete this.settings['trust proxy fn']; + } + + // inherit protos + setPrototypeOf(this.request, parent.request) + setPrototypeOf(this.response, parent.response) + setPrototypeOf(this.engines, parent.engines) + setPrototypeOf(this.settings, parent.settings) + }); + + // setup locals + this.locals = Object.create(null); + + // top-most app is mounted at / + this.mountpath = '/'; + + // default locals + this.locals.settings = this.settings; + + // default configuration + this.set('view', View); + this.set('views', resolve('views')); + this.set('jsonp callback name', 'callback'); + + if (env === 'production') { + this.enable('view cache'); + } + + Object.defineProperty(this, 'router', { + get: function() { + throw new Error('\'app.router\' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.'); + } + }); +}; + +/** + * lazily adds the base router if it has not yet been added. + * + * We cannot add the base router in the defaultConfiguration because + * it reads app settings which might be set after that has run. + * + * @private + */ +app.lazyrouter = function lazyrouter() { + if (!this._router) { + this._router = new Router({ + caseSensitive: this.enabled('case sensitive routing'), + strict: this.enabled('strict routing') + }); + + this._router.use(query(this.get('query parser fn'))); + this._router.use(middleware.init(this)); + } +}; + +/** + * Dispatch a req, res pair into the application. Starts pipeline processing. + * + * If no callback is provided, then default error handlers will respond + * in the event of an error bubbling through the stack. + * + * @private + */ + +app.handle = function handle(req, res, callback) { + var router = this._router; + + // final handler + var done = callback || finalhandler(req, res, { + env: this.get('env'), + onerror: logerror.bind(this) + }); + + // no routes + if (!router) { + debug('no routes defined on app'); + done(); + return; + } + + router.handle(req, res, done); +}; + +/** + * Proxy `Router#use()` to add middleware to the app router. + * See Router#use() documentation for details. + * + * If the _fn_ parameter is an express app, then it will be + * mounted at the _route_ specified. + * + * @public + */ + +app.use = function use(fn) { + var offset = 0; + var path = '/'; + + // default path to '/' + // disambiguate app.use([fn]) + if (typeof fn !== 'function') { + var arg = fn; + + while (Array.isArray(arg) && arg.length !== 0) { + arg = arg[0]; + } + + // first arg is the path + if (typeof arg !== 'function') { + offset = 1; + path = fn; + } + } + + var fns = flatten(slice.call(arguments, offset)); + + if (fns.length === 0) { + throw new TypeError('app.use() requires a middleware function') + } + + // setup router + this.lazyrouter(); + var router = this._router; + + fns.forEach(function (fn) { + // non-express app + if (!fn || !fn.handle || !fn.set) { + return router.use(path, fn); + } + + debug('.use app under %s', path); + fn.mountpath = path; + fn.parent = this; + + // restore .app property on req and res + router.use(path, function mounted_app(req, res, next) { + var orig = req.app; + fn.handle(req, res, function (err) { + setPrototypeOf(req, orig.request) + setPrototypeOf(res, orig.response) + next(err); + }); + }); + + // mounted an app + fn.emit('mount', this); + }, this); + + return this; +}; + +/** + * Proxy to the app `Router#route()` + * Returns a new `Route` instance for the _path_. + * + * Routes are isolated middleware stacks for specific paths. + * See the Route api docs for details. + * + * @public + */ + +app.route = function route(path) { + this.lazyrouter(); + return this._router.route(path); +}; + +/** + * Register the given template engine callback `fn` + * as `ext`. + * + * By default will `require()` the engine based on the + * file extension. For example if you try to render + * a "foo.ejs" file Express will invoke the following internally: + * + * app.engine('ejs', require('ejs').__express); + * + * For engines that do not provide `.__express` out of the box, + * or if you wish to "map" a different extension to the template engine + * you may use this method. For example mapping the EJS template engine to + * ".html" files: + * + * app.engine('html', require('ejs').renderFile); + * + * In this case EJS provides a `.renderFile()` method with + * the same signature that Express expects: `(path, options, callback)`, + * though note that it aliases this method as `ejs.__express` internally + * so if you're using ".ejs" extensions you don't need to do anything. + * + * Some template engines do not follow this convention, the + * [Consolidate.js](https://github.com/tj/consolidate.js) + * library was created to map all of node's popular template + * engines to follow this convention, thus allowing them to + * work seamlessly within Express. + * + * @param {String} ext + * @param {Function} fn + * @return {app} for chaining + * @public + */ + +app.engine = function engine(ext, fn) { + if (typeof fn !== 'function') { + throw new Error('callback function required'); + } + + // get file extension + var extension = ext[0] !== '.' + ? '.' + ext + : ext; + + // store engine + this.engines[extension] = fn; + + return this; +}; + +/** + * Proxy to `Router#param()` with one added api feature. The _name_ parameter + * can be an array of names. + * + * See the Router#param() docs for more details. + * + * @param {String|Array} name + * @param {Function} fn + * @return {app} for chaining + * @public + */ + +app.param = function param(name, fn) { + this.lazyrouter(); + + if (Array.isArray(name)) { + for (var i = 0; i < name.length; i++) { + this.param(name[i], fn); + } + + return this; + } + + this._router.param(name, fn); + + return this; +}; + +/** + * Assign `setting` to `val`, or return `setting`'s value. + * + * app.set('foo', 'bar'); + * app.set('foo'); + * // => "bar" + * + * Mounted servers inherit their parent server's settings. + * + * @param {String} setting + * @param {*} [val] + * @return {Server} for chaining + * @public + */ + +app.set = function set(setting, val) { + if (arguments.length === 1) { + // app.get(setting) + var settings = this.settings + + while (settings && settings !== Object.prototype) { + if (hasOwnProperty.call(settings, setting)) { + return settings[setting] + } + + settings = Object.getPrototypeOf(settings) + } + + return undefined + } + + debug('set "%s" to %o', setting, val); + + // set value + this.settings[setting] = val; + + // trigger matched settings + switch (setting) { + case 'etag': + this.set('etag fn', compileETag(val)); + break; + case 'query parser': + this.set('query parser fn', compileQueryParser(val)); + break; + case 'trust proxy': + this.set('trust proxy fn', compileTrust(val)); + + // trust proxy inherit back-compat + Object.defineProperty(this.settings, trustProxyDefaultSymbol, { + configurable: true, + value: false + }); + + break; + } + + return this; +}; + +/** + * Return the app's absolute pathname + * based on the parent(s) that have + * mounted it. + * + * For example if the application was + * mounted as "/admin", which itself + * was mounted as "/blog" then the + * return value would be "/blog/admin". + * + * @return {String} + * @private + */ + +app.path = function path() { + return this.parent + ? this.parent.path() + this.mountpath + : ''; +}; + +/** + * Check if `setting` is enabled (truthy). + * + * app.enabled('foo') + * // => false + * + * app.enable('foo') + * app.enabled('foo') + * // => true + * + * @param {String} setting + * @return {Boolean} + * @public + */ + +app.enabled = function enabled(setting) { + return Boolean(this.set(setting)); +}; + +/** + * Check if `setting` is disabled. + * + * app.disabled('foo') + * // => true + * + * app.enable('foo') + * app.disabled('foo') + * // => false + * + * @param {String} setting + * @return {Boolean} + * @public + */ + +app.disabled = function disabled(setting) { + return !this.set(setting); +}; + +/** + * Enable `setting`. + * + * @param {String} setting + * @return {app} for chaining + * @public + */ + +app.enable = function enable(setting) { + return this.set(setting, true); +}; + +/** + * Disable `setting`. + * + * @param {String} setting + * @return {app} for chaining + * @public + */ + +app.disable = function disable(setting) { + return this.set(setting, false); +}; + +/** + * Delegate `.VERB(...)` calls to `router.VERB(...)`. + */ + +methods.forEach(function(method){ + app[method] = function(path){ + if (method === 'get' && arguments.length === 1) { + // app.get(setting) + return this.set(path); + } + + this.lazyrouter(); + + var route = this._router.route(path); + route[method].apply(route, slice.call(arguments, 1)); + return this; + }; +}); + +/** + * Special-cased "all" method, applying the given route `path`, + * middleware, and callback to _every_ HTTP method. + * + * @param {String} path + * @param {Function} ... + * @return {app} for chaining + * @public + */ + +app.all = function all(path) { + this.lazyrouter(); + + var route = this._router.route(path); + var args = slice.call(arguments, 1); + + for (var i = 0; i < methods.length; i++) { + route[methods[i]].apply(route, args); + } + + return this; +}; + +// del -> delete alias + +app.del = deprecate.function(app.delete, 'app.del: Use app.delete instead'); + +/** + * Render the given view `name` name with `options` + * and a callback accepting an error and the + * rendered template string. + * + * Example: + * + * app.render('email', { name: 'Tobi' }, function(err, html){ + * // ... + * }) + * + * @param {String} name + * @param {Object|Function} options or fn + * @param {Function} callback + * @public + */ + +app.render = function render(name, options, callback) { + var cache = this.cache; + var done = callback; + var engines = this.engines; + var opts = options; + var renderOptions = {}; + var view; + + // support callback function as second arg + if (typeof options === 'function') { + done = options; + opts = {}; + } + + // merge app.locals + merge(renderOptions, this.locals); + + // merge options._locals + if (opts._locals) { + merge(renderOptions, opts._locals); + } + + // merge options + merge(renderOptions, opts); + + // set .cache unless explicitly provided + if (renderOptions.cache == null) { + renderOptions.cache = this.enabled('view cache'); + } + + // primed cache + if (renderOptions.cache) { + view = cache[name]; + } + + // view + if (!view) { + var View = this.get('view'); + + view = new View(name, { + defaultEngine: this.get('view engine'), + root: this.get('views'), + engines: engines + }); + + if (!view.path) { + var dirs = Array.isArray(view.root) && view.root.length > 1 + ? 'directories "' + view.root.slice(0, -1).join('", "') + '" or "' + view.root[view.root.length - 1] + '"' + : 'directory "' + view.root + '"' + var err = new Error('Failed to lookup view "' + name + '" in views ' + dirs); + err.view = view; + return done(err); + } + + // prime the cache + if (renderOptions.cache) { + cache[name] = view; + } + } + + // render + tryRender(view, renderOptions, done); +}; + +/** + * Listen for connections. + * + * A node `http.Server` is returned, with this + * application (which is a `Function`) as its + * callback. If you wish to create both an HTTP + * and HTTPS server you may do so with the "http" + * and "https" modules as shown here: + * + * var http = require('http') + * , https = require('https') + * , express = require('express') + * , app = express(); + * + * http.createServer(app).listen(80); + * https.createServer({ ... }, app).listen(443); + * + * @return {http.Server} + * @public + */ + +app.listen = function listen() { + var server = http.createServer(this); + return server.listen.apply(server, arguments); +}; + +/** + * Log error using console.error. + * + * @param {Error} err + * @private + */ + +function logerror(err) { + /* istanbul ignore next */ + if (this.get('env') !== 'test') console.error(err.stack || err.toString()); +} + +/** + * Try rendering a view. + * @private + */ + +function tryRender(view, options, callback) { + try { + view.render(options, callback); + } catch (err) { + callback(err); + } +} diff --git a/graphql-subscription-express/node_modules/express/lib/express.js b/graphql-subscription-express/node_modules/express/lib/express.js new file mode 100644 index 0000000..d188a16 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/express.js @@ -0,0 +1,116 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + */ + +var bodyParser = require('body-parser') +var EventEmitter = require('events').EventEmitter; +var mixin = require('merge-descriptors'); +var proto = require('./application'); +var Route = require('./router/route'); +var Router = require('./router'); +var req = require('./request'); +var res = require('./response'); + +/** + * Expose `createApplication()`. + */ + +exports = module.exports = createApplication; + +/** + * Create an express application. + * + * @return {Function} + * @api public + */ + +function createApplication() { + var app = function(req, res, next) { + app.handle(req, res, next); + }; + + mixin(app, EventEmitter.prototype, false); + mixin(app, proto, false); + + // expose the prototype that will get set on requests + app.request = Object.create(req, { + app: { configurable: true, enumerable: true, writable: true, value: app } + }) + + // expose the prototype that will get set on responses + app.response = Object.create(res, { + app: { configurable: true, enumerable: true, writable: true, value: app } + }) + + app.init(); + return app; +} + +/** + * Expose the prototypes. + */ + +exports.application = proto; +exports.request = req; +exports.response = res; + +/** + * Expose constructors. + */ + +exports.Route = Route; +exports.Router = Router; + +/** + * Expose middleware + */ + +exports.json = bodyParser.json +exports.query = require('./middleware/query'); +exports.raw = bodyParser.raw +exports.static = require('serve-static'); +exports.text = bodyParser.text +exports.urlencoded = bodyParser.urlencoded + +/** + * Replace removed middleware with an appropriate error message. + */ + +var removedMiddlewares = [ + 'bodyParser', + 'compress', + 'cookieSession', + 'session', + 'logger', + 'cookieParser', + 'favicon', + 'responseTime', + 'errorHandler', + 'timeout', + 'methodOverride', + 'vhost', + 'csrf', + 'directory', + 'limit', + 'multipart', + 'staticCache' +] + +removedMiddlewares.forEach(function (name) { + Object.defineProperty(exports, name, { + get: function () { + throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.'); + }, + configurable: true + }); +}); diff --git a/graphql-subscription-express/node_modules/express/lib/middleware/init.js b/graphql-subscription-express/node_modules/express/lib/middleware/init.js new file mode 100644 index 0000000..dfd0427 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/middleware/init.js @@ -0,0 +1,43 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var setPrototypeOf = require('setprototypeof') + +/** + * Initialization middleware, exposing the + * request and response to each other, as well + * as defaulting the X-Powered-By header field. + * + * @param {Function} app + * @return {Function} + * @api private + */ + +exports.init = function(app){ + return function expressInit(req, res, next){ + if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express'); + req.res = res; + res.req = req; + req.next = next; + + setPrototypeOf(req, app.request) + setPrototypeOf(res, app.response) + + res.locals = res.locals || Object.create(null); + + next(); + }; +}; + diff --git a/graphql-subscription-express/node_modules/express/lib/middleware/query.js b/graphql-subscription-express/node_modules/express/lib/middleware/query.js new file mode 100644 index 0000000..7e91669 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/middleware/query.js @@ -0,0 +1,47 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + */ + +var merge = require('utils-merge') +var parseUrl = require('parseurl'); +var qs = require('qs'); + +/** + * @param {Object} options + * @return {Function} + * @api public + */ + +module.exports = function query(options) { + var opts = merge({}, options) + var queryparse = qs.parse; + + if (typeof options === 'function') { + queryparse = options; + opts = undefined; + } + + if (opts !== undefined && opts.allowPrototypes === undefined) { + // back-compat for qs module + opts.allowPrototypes = true; + } + + return function query(req, res, next){ + if (!req.query) { + var val = parseUrl(req).query; + req.query = queryparse(val, opts); + } + + next(); + }; +}; diff --git a/graphql-subscription-express/node_modules/express/lib/request.js b/graphql-subscription-express/node_modules/express/lib/request.js new file mode 100644 index 0000000..3f1eeca --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/request.js @@ -0,0 +1,525 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var accepts = require('accepts'); +var deprecate = require('depd')('express'); +var isIP = require('net').isIP; +var typeis = require('type-is'); +var http = require('http'); +var fresh = require('fresh'); +var parseRange = require('range-parser'); +var parse = require('parseurl'); +var proxyaddr = require('proxy-addr'); + +/** + * Request prototype. + * @public + */ + +var req = Object.create(http.IncomingMessage.prototype) + +/** + * Module exports. + * @public + */ + +module.exports = req + +/** + * Return request header. + * + * The `Referrer` header field is special-cased, + * both `Referrer` and `Referer` are interchangeable. + * + * Examples: + * + * req.get('Content-Type'); + * // => "text/plain" + * + * req.get('content-type'); + * // => "text/plain" + * + * req.get('Something'); + * // => undefined + * + * Aliased as `req.header()`. + * + * @param {String} name + * @return {String} + * @public + */ + +req.get = +req.header = function header(name) { + if (!name) { + throw new TypeError('name argument is required to req.get'); + } + + if (typeof name !== 'string') { + throw new TypeError('name must be a string to req.get'); + } + + var lc = name.toLowerCase(); + + switch (lc) { + case 'referer': + case 'referrer': + return this.headers.referrer + || this.headers.referer; + default: + return this.headers[lc]; + } +}; + +/** + * To do: update docs. + * + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single MIME type string + * such as "application/json", an extension name + * such as "json", a comma-delimited list such as "json, html, text/plain", + * an argument list such as `"json", "html", "text/plain"`, + * or an array `["json", "html", "text/plain"]`. When a list + * or array is given, the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * req.accepts('html'); + * // => "html" + * + * // Accept: text/*, application/json + * req.accepts('html'); + * // => "html" + * req.accepts('text/html'); + * // => "text/html" + * req.accepts('json, text'); + * // => "json" + * req.accepts('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * req.accepts('image/png'); + * req.accepts('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * req.accepts(['html', 'json']); + * req.accepts('html', 'json'); + * req.accepts('html, json'); + * // => "json" + * + * @param {String|Array} type(s) + * @return {String|Array|Boolean} + * @public + */ + +req.accepts = function(){ + var accept = accepts(this); + return accept.types.apply(accept, arguments); +}; + +/** + * Check if the given `encoding`s are accepted. + * + * @param {String} ...encoding + * @return {String|Array} + * @public + */ + +req.acceptsEncodings = function(){ + var accept = accepts(this); + return accept.encodings.apply(accept, arguments); +}; + +req.acceptsEncoding = deprecate.function(req.acceptsEncodings, + 'req.acceptsEncoding: Use acceptsEncodings instead'); + +/** + * Check if the given `charset`s are acceptable, + * otherwise you should respond with 406 "Not Acceptable". + * + * @param {String} ...charset + * @return {String|Array} + * @public + */ + +req.acceptsCharsets = function(){ + var accept = accepts(this); + return accept.charsets.apply(accept, arguments); +}; + +req.acceptsCharset = deprecate.function(req.acceptsCharsets, + 'req.acceptsCharset: Use acceptsCharsets instead'); + +/** + * Check if the given `lang`s are acceptable, + * otherwise you should respond with 406 "Not Acceptable". + * + * @param {String} ...lang + * @return {String|Array} + * @public + */ + +req.acceptsLanguages = function(){ + var accept = accepts(this); + return accept.languages.apply(accept, arguments); +}; + +req.acceptsLanguage = deprecate.function(req.acceptsLanguages, + 'req.acceptsLanguage: Use acceptsLanguages instead'); + +/** + * Parse Range header field, capping to the given `size`. + * + * Unspecified ranges such as "0-" require knowledge of your resource length. In + * the case of a byte range this is of course the total number of bytes. If the + * Range header field is not given `undefined` is returned, `-1` when unsatisfiable, + * and `-2` when syntactically invalid. + * + * When ranges are returned, the array has a "type" property which is the type of + * range that is required (most commonly, "bytes"). Each array element is an object + * with a "start" and "end" property for the portion of the range. + * + * The "combine" option can be set to `true` and overlapping & adjacent ranges + * will be combined into a single range. + * + * NOTE: remember that ranges are inclusive, so for example "Range: users=0-3" + * should respond with 4 users when available, not 3. + * + * @param {number} size + * @param {object} [options] + * @param {boolean} [options.combine=false] + * @return {number|array} + * @public + */ + +req.range = function range(size, options) { + var range = this.get('Range'); + if (!range) return; + return parseRange(size, range, options); +}; + +/** + * Return the value of param `name` when present or `defaultValue`. + * + * - Checks route placeholders, ex: _/user/:id_ + * - Checks body params, ex: id=12, {"id":12} + * - Checks query string params, ex: ?id=12 + * + * To utilize request bodies, `req.body` + * should be an object. This can be done by using + * the `bodyParser()` middleware. + * + * @param {String} name + * @param {Mixed} [defaultValue] + * @return {String} + * @public + */ + +req.param = function param(name, defaultValue) { + var params = this.params || {}; + var body = this.body || {}; + var query = this.query || {}; + + var args = arguments.length === 1 + ? 'name' + : 'name, default'; + deprecate('req.param(' + args + '): Use req.params, req.body, or req.query instead'); + + if (null != params[name] && params.hasOwnProperty(name)) return params[name]; + if (null != body[name]) return body[name]; + if (null != query[name]) return query[name]; + + return defaultValue; +}; + +/** + * Check if the incoming request contains the "Content-Type" + * header field, and it contains the given mime `type`. + * + * Examples: + * + * // With Content-Type: text/html; charset=utf-8 + * req.is('html'); + * req.is('text/html'); + * req.is('text/*'); + * // => true + * + * // When Content-Type is application/json + * req.is('json'); + * req.is('application/json'); + * req.is('application/*'); + * // => true + * + * req.is('html'); + * // => false + * + * @param {String|Array} types... + * @return {String|false|null} + * @public + */ + +req.is = function is(types) { + var arr = types; + + // support flattened arguments + if (!Array.isArray(types)) { + arr = new Array(arguments.length); + for (var i = 0; i < arr.length; i++) { + arr[i] = arguments[i]; + } + } + + return typeis(this, arr); +}; + +/** + * Return the protocol string "http" or "https" + * when requested with TLS. When the "trust proxy" + * setting trusts the socket address, the + * "X-Forwarded-Proto" header field will be trusted + * and used if present. + * + * If you're running behind a reverse proxy that + * supplies https for you this may be enabled. + * + * @return {String} + * @public + */ + +defineGetter(req, 'protocol', function protocol(){ + var proto = this.connection.encrypted + ? 'https' + : 'http'; + var trust = this.app.get('trust proxy fn'); + + if (!trust(this.connection.remoteAddress, 0)) { + return proto; + } + + // Note: X-Forwarded-Proto is normally only ever a + // single value, but this is to be safe. + var header = this.get('X-Forwarded-Proto') || proto + var index = header.indexOf(',') + + return index !== -1 + ? header.substring(0, index).trim() + : header.trim() +}); + +/** + * Short-hand for: + * + * req.protocol === 'https' + * + * @return {Boolean} + * @public + */ + +defineGetter(req, 'secure', function secure(){ + return this.protocol === 'https'; +}); + +/** + * Return the remote address from the trusted proxy. + * + * The is the remote address on the socket unless + * "trust proxy" is set. + * + * @return {String} + * @public + */ + +defineGetter(req, 'ip', function ip(){ + var trust = this.app.get('trust proxy fn'); + return proxyaddr(this, trust); +}); + +/** + * When "trust proxy" is set, trusted proxy addresses + client. + * + * For example if the value were "client, proxy1, proxy2" + * you would receive the array `["client", "proxy1", "proxy2"]` + * where "proxy2" is the furthest down-stream and "proxy1" and + * "proxy2" were trusted. + * + * @return {Array} + * @public + */ + +defineGetter(req, 'ips', function ips() { + var trust = this.app.get('trust proxy fn'); + var addrs = proxyaddr.all(this, trust); + + // reverse the order (to farthest -> closest) + // and remove socket address + addrs.reverse().pop() + + return addrs +}); + +/** + * Return subdomains as an array. + * + * Subdomains are the dot-separated parts of the host before the main domain of + * the app. By default, the domain of the app is assumed to be the last two + * parts of the host. This can be changed by setting "subdomain offset". + * + * For example, if the domain is "tobi.ferrets.example.com": + * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. + * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. + * + * @return {Array} + * @public + */ + +defineGetter(req, 'subdomains', function subdomains() { + var hostname = this.hostname; + + if (!hostname) return []; + + var offset = this.app.get('subdomain offset'); + var subdomains = !isIP(hostname) + ? hostname.split('.').reverse() + : [hostname]; + + return subdomains.slice(offset); +}); + +/** + * Short-hand for `url.parse(req.url).pathname`. + * + * @return {String} + * @public + */ + +defineGetter(req, 'path', function path() { + return parse(this).pathname; +}); + +/** + * Parse the "Host" header field to a hostname. + * + * When the "trust proxy" setting trusts the socket + * address, the "X-Forwarded-Host" header field will + * be trusted. + * + * @return {String} + * @public + */ + +defineGetter(req, 'hostname', function hostname(){ + var trust = this.app.get('trust proxy fn'); + var host = this.get('X-Forwarded-Host'); + + if (!host || !trust(this.connection.remoteAddress, 0)) { + host = this.get('Host'); + } else if (host.indexOf(',') !== -1) { + // Note: X-Forwarded-Host is normally only ever a + // single value, but this is to be safe. + host = host.substring(0, host.indexOf(',')).trimRight() + } + + if (!host) return; + + // IPv6 literal support + var offset = host[0] === '[' + ? host.indexOf(']') + 1 + : 0; + var index = host.indexOf(':', offset); + + return index !== -1 + ? host.substring(0, index) + : host; +}); + +// TODO: change req.host to return host in next major + +defineGetter(req, 'host', deprecate.function(function host(){ + return this.hostname; +}, 'req.host: Use req.hostname instead')); + +/** + * Check if the request is fresh, aka + * Last-Modified and/or the ETag + * still match. + * + * @return {Boolean} + * @public + */ + +defineGetter(req, 'fresh', function(){ + var method = this.method; + var res = this.res + var status = res.statusCode + + // GET or HEAD for weak freshness validation only + if ('GET' !== method && 'HEAD' !== method) return false; + + // 2xx or 304 as per rfc2616 14.26 + if ((status >= 200 && status < 300) || 304 === status) { + return fresh(this.headers, { + 'etag': res.get('ETag'), + 'last-modified': res.get('Last-Modified') + }) + } + + return false; +}); + +/** + * Check if the request is stale, aka + * "Last-Modified" and / or the "ETag" for the + * resource has changed. + * + * @return {Boolean} + * @public + */ + +defineGetter(req, 'stale', function stale(){ + return !this.fresh; +}); + +/** + * Check if the request was an _XMLHttpRequest_. + * + * @return {Boolean} + * @public + */ + +defineGetter(req, 'xhr', function xhr(){ + var val = this.get('X-Requested-With') || ''; + return val.toLowerCase() === 'xmlhttprequest'; +}); + +/** + * Helper function for creating a getter on an object. + * + * @param {Object} obj + * @param {String} name + * @param {Function} getter + * @private + */ +function defineGetter(obj, name, getter) { + Object.defineProperty(obj, name, { + configurable: true, + enumerable: true, + get: getter + }); +} diff --git a/graphql-subscription-express/node_modules/express/lib/response.js b/graphql-subscription-express/node_modules/express/lib/response.js new file mode 100644 index 0000000..dd7b3c8 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/response.js @@ -0,0 +1,1178 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var Buffer = require('safe-buffer').Buffer +var contentDisposition = require('content-disposition'); +var createError = require('http-errors') +var deprecate = require('depd')('express'); +var encodeUrl = require('encodeurl'); +var escapeHtml = require('escape-html'); +var http = require('http'); +var isAbsolute = require('./utils').isAbsolute; +var onFinished = require('on-finished'); +var path = require('path'); +var statuses = require('statuses') +var merge = require('utils-merge'); +var sign = require('cookie-signature').sign; +var normalizeType = require('./utils').normalizeType; +var normalizeTypes = require('./utils').normalizeTypes; +var setCharset = require('./utils').setCharset; +var cookie = require('cookie'); +var send = require('send'); +var extname = path.extname; +var mime = send.mime; +var resolve = path.resolve; +var vary = require('vary'); + +/** + * Response prototype. + * @public + */ + +var res = Object.create(http.ServerResponse.prototype) + +/** + * Module exports. + * @public + */ + +module.exports = res + +/** + * Module variables. + * @private + */ + +var charsetRegExp = /;\s*charset\s*=/; +var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/; + +/** + * Set status `code`. + * + * @param {Number} code + * @return {ServerResponse} + * @public + */ + +res.status = function status(code) { + if ((typeof code === 'string' || Math.floor(code) !== code) && code > 99 && code < 1000) { + deprecate('res.status(' + JSON.stringify(code) + '): use res.status(' + Math.floor(code) + ') instead') + } + this.statusCode = code; + return this; +}; + +/** + * Set Link header field with the given `links`. + * + * Examples: + * + * res.links({ + * next: 'http://api.example.com/users?page=2', + * last: 'http://api.example.com/users?page=5' + * }); + * + * @param {Object} links + * @return {ServerResponse} + * @public + */ + +res.links = function(links){ + var link = this.get('Link') || ''; + if (link) link += ', '; + return this.set('Link', link + Object.keys(links).map(function(rel){ + return '<' + links[rel] + '>; rel="' + rel + '"'; + }).join(', ')); +}; + +/** + * Send a response. + * + * Examples: + * + * res.send(Buffer.from('wahoo')); + * res.send({ some: 'json' }); + * res.send('

some html

'); + * + * @param {string|number|boolean|object|Buffer} body + * @public + */ + +res.send = function send(body) { + var chunk = body; + var encoding; + var req = this.req; + var type; + + // settings + var app = this.app; + + // allow status / body + if (arguments.length === 2) { + // res.send(body, status) backwards compat + if (typeof arguments[0] !== 'number' && typeof arguments[1] === 'number') { + deprecate('res.send(body, status): Use res.status(status).send(body) instead'); + this.statusCode = arguments[1]; + } else { + deprecate('res.send(status, body): Use res.status(status).send(body) instead'); + this.statusCode = arguments[0]; + chunk = arguments[1]; + } + } + + // disambiguate res.send(status) and res.send(status, num) + if (typeof chunk === 'number' && arguments.length === 1) { + // res.send(status) will set status message as text string + if (!this.get('Content-Type')) { + this.type('txt'); + } + + deprecate('res.send(status): Use res.sendStatus(status) instead'); + this.statusCode = chunk; + chunk = statuses.message[chunk] + } + + switch (typeof chunk) { + // string defaulting to html + case 'string': + if (!this.get('Content-Type')) { + this.type('html'); + } + break; + case 'boolean': + case 'number': + case 'object': + if (chunk === null) { + chunk = ''; + } else if (Buffer.isBuffer(chunk)) { + if (!this.get('Content-Type')) { + this.type('bin'); + } + } else { + return this.json(chunk); + } + break; + } + + // write strings in utf-8 + if (typeof chunk === 'string') { + encoding = 'utf8'; + type = this.get('Content-Type'); + + // reflect this in content-type + if (typeof type === 'string') { + this.set('Content-Type', setCharset(type, 'utf-8')); + } + } + + // determine if ETag should be generated + var etagFn = app.get('etag fn') + var generateETag = !this.get('ETag') && typeof etagFn === 'function' + + // populate Content-Length + var len + if (chunk !== undefined) { + if (Buffer.isBuffer(chunk)) { + // get length of Buffer + len = chunk.length + } else if (!generateETag && chunk.length < 1000) { + // just calculate length when no ETag + small chunk + len = Buffer.byteLength(chunk, encoding) + } else { + // convert chunk to Buffer and calculate + chunk = Buffer.from(chunk, encoding) + encoding = undefined; + len = chunk.length + } + + this.set('Content-Length', len); + } + + // populate ETag + var etag; + if (generateETag && len !== undefined) { + if ((etag = etagFn(chunk, encoding))) { + this.set('ETag', etag); + } + } + + // freshness + if (req.fresh) this.statusCode = 304; + + // strip irrelevant headers + if (204 === this.statusCode || 304 === this.statusCode) { + this.removeHeader('Content-Type'); + this.removeHeader('Content-Length'); + this.removeHeader('Transfer-Encoding'); + chunk = ''; + } + + // alter headers for 205 + if (this.statusCode === 205) { + this.set('Content-Length', '0') + this.removeHeader('Transfer-Encoding') + chunk = '' + } + + if (req.method === 'HEAD') { + // skip body for HEAD + this.end(); + } else { + // respond + this.end(chunk, encoding); + } + + return this; +}; + +/** + * Send JSON response. + * + * Examples: + * + * res.json(null); + * res.json({ user: 'tj' }); + * + * @param {string|number|boolean|object} obj + * @public + */ + +res.json = function json(obj) { + var val = obj; + + // allow status / body + if (arguments.length === 2) { + // res.json(body, status) backwards compat + if (typeof arguments[1] === 'number') { + deprecate('res.json(obj, status): Use res.status(status).json(obj) instead'); + this.statusCode = arguments[1]; + } else { + deprecate('res.json(status, obj): Use res.status(status).json(obj) instead'); + this.statusCode = arguments[0]; + val = arguments[1]; + } + } + + // settings + var app = this.app; + var escape = app.get('json escape') + var replacer = app.get('json replacer'); + var spaces = app.get('json spaces'); + var body = stringify(val, replacer, spaces, escape) + + // content-type + if (!this.get('Content-Type')) { + this.set('Content-Type', 'application/json'); + } + + return this.send(body); +}; + +/** + * Send JSON response with JSONP callback support. + * + * Examples: + * + * res.jsonp(null); + * res.jsonp({ user: 'tj' }); + * + * @param {string|number|boolean|object} obj + * @public + */ + +res.jsonp = function jsonp(obj) { + var val = obj; + + // allow status / body + if (arguments.length === 2) { + // res.jsonp(body, status) backwards compat + if (typeof arguments[1] === 'number') { + deprecate('res.jsonp(obj, status): Use res.status(status).jsonp(obj) instead'); + this.statusCode = arguments[1]; + } else { + deprecate('res.jsonp(status, obj): Use res.status(status).jsonp(obj) instead'); + this.statusCode = arguments[0]; + val = arguments[1]; + } + } + + // settings + var app = this.app; + var escape = app.get('json escape') + var replacer = app.get('json replacer'); + var spaces = app.get('json spaces'); + var body = stringify(val, replacer, spaces, escape) + var callback = this.req.query[app.get('jsonp callback name')]; + + // content-type + if (!this.get('Content-Type')) { + this.set('X-Content-Type-Options', 'nosniff'); + this.set('Content-Type', 'application/json'); + } + + // fixup callback + if (Array.isArray(callback)) { + callback = callback[0]; + } + + // jsonp + if (typeof callback === 'string' && callback.length !== 0) { + this.set('X-Content-Type-Options', 'nosniff'); + this.set('Content-Type', 'text/javascript'); + + // restrict callback charset + callback = callback.replace(/[^\[\]\w$.]/g, ''); + + if (body === undefined) { + // empty argument + body = '' + } else if (typeof body === 'string') { + // replace chars not allowed in JavaScript that are in JSON + body = body + .replace(/\u2028/g, '\\u2028') + .replace(/\u2029/g, '\\u2029') + } + + // the /**/ is a specific security mitigation for "Rosetta Flash JSONP abuse" + // the typeof check is just to reduce client error noise + body = '/**/ typeof ' + callback + ' === \'function\' && ' + callback + '(' + body + ');'; + } + + return this.send(body); +}; + +/** + * Send given HTTP status code. + * + * Sets the response status to `statusCode` and the body of the + * response to the standard description from node's http.STATUS_CODES + * or the statusCode number if no description. + * + * Examples: + * + * res.sendStatus(200); + * + * @param {number} statusCode + * @public + */ + +res.sendStatus = function sendStatus(statusCode) { + var body = statuses.message[statusCode] || String(statusCode) + + this.statusCode = statusCode; + this.type('txt'); + + return this.send(body); +}; + +/** + * Transfer the file at the given `path`. + * + * Automatically sets the _Content-Type_ response header field. + * The callback `callback(err)` is invoked when the transfer is complete + * or when an error occurs. Be sure to check `res.headersSent` + * if you wish to attempt responding, as the header and some data + * may have already been transferred. + * + * Options: + * + * - `maxAge` defaulting to 0 (can be string converted by `ms`) + * - `root` root directory for relative filenames + * - `headers` object of headers to serve with file + * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them + * + * Other options are passed along to `send`. + * + * Examples: + * + * The following example illustrates how `res.sendFile()` may + * be used as an alternative for the `static()` middleware for + * dynamic situations. The code backing `res.sendFile()` is actually + * the same code, so HTTP cache support etc is identical. + * + * app.get('/user/:uid/photos/:file', function(req, res){ + * var uid = req.params.uid + * , file = req.params.file; + * + * req.user.mayViewFilesFrom(uid, function(yes){ + * if (yes) { + * res.sendFile('/uploads/' + uid + '/' + file); + * } else { + * res.send(403, 'Sorry! you cant see that.'); + * } + * }); + * }); + * + * @public + */ + +res.sendFile = function sendFile(path, options, callback) { + var done = callback; + var req = this.req; + var res = this; + var next = req.next; + var opts = options || {}; + + if (!path) { + throw new TypeError('path argument is required to res.sendFile'); + } + + if (typeof path !== 'string') { + throw new TypeError('path must be a string to res.sendFile') + } + + // support function as second arg + if (typeof options === 'function') { + done = options; + opts = {}; + } + + if (!opts.root && !isAbsolute(path)) { + throw new TypeError('path must be absolute or specify root to res.sendFile'); + } + + // create file stream + var pathname = encodeURI(path); + var file = send(req, pathname, opts); + + // transfer + sendfile(res, file, opts, function (err) { + if (done) return done(err); + if (err && err.code === 'EISDIR') return next(); + + // next() all but write errors + if (err && err.code !== 'ECONNABORTED' && err.syscall !== 'write') { + next(err); + } + }); +}; + +/** + * Transfer the file at the given `path`. + * + * Automatically sets the _Content-Type_ response header field. + * The callback `callback(err)` is invoked when the transfer is complete + * or when an error occurs. Be sure to check `res.headersSent` + * if you wish to attempt responding, as the header and some data + * may have already been transferred. + * + * Options: + * + * - `maxAge` defaulting to 0 (can be string converted by `ms`) + * - `root` root directory for relative filenames + * - `headers` object of headers to serve with file + * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them + * + * Other options are passed along to `send`. + * + * Examples: + * + * The following example illustrates how `res.sendfile()` may + * be used as an alternative for the `static()` middleware for + * dynamic situations. The code backing `res.sendfile()` is actually + * the same code, so HTTP cache support etc is identical. + * + * app.get('/user/:uid/photos/:file', function(req, res){ + * var uid = req.params.uid + * , file = req.params.file; + * + * req.user.mayViewFilesFrom(uid, function(yes){ + * if (yes) { + * res.sendfile('/uploads/' + uid + '/' + file); + * } else { + * res.send(403, 'Sorry! you cant see that.'); + * } + * }); + * }); + * + * @public + */ + +res.sendfile = function (path, options, callback) { + var done = callback; + var req = this.req; + var res = this; + var next = req.next; + var opts = options || {}; + + // support function as second arg + if (typeof options === 'function') { + done = options; + opts = {}; + } + + // create file stream + var file = send(req, path, opts); + + // transfer + sendfile(res, file, opts, function (err) { + if (done) return done(err); + if (err && err.code === 'EISDIR') return next(); + + // next() all but write errors + if (err && err.code !== 'ECONNABORTED' && err.syscall !== 'write') { + next(err); + } + }); +}; + +res.sendfile = deprecate.function(res.sendfile, + 'res.sendfile: Use res.sendFile instead'); + +/** + * Transfer the file at the given `path` as an attachment. + * + * Optionally providing an alternate attachment `filename`, + * and optional callback `callback(err)`. The callback is invoked + * when the data transfer is complete, or when an error has + * occurred. Be sure to check `res.headersSent` if you plan to respond. + * + * Optionally providing an `options` object to use with `res.sendFile()`. + * This function will set the `Content-Disposition` header, overriding + * any `Content-Disposition` header passed as header options in order + * to set the attachment and filename. + * + * This method uses `res.sendFile()`. + * + * @public + */ + +res.download = function download (path, filename, options, callback) { + var done = callback; + var name = filename; + var opts = options || null + + // support function as second or third arg + if (typeof filename === 'function') { + done = filename; + name = null; + opts = null + } else if (typeof options === 'function') { + done = options + opts = null + } + + // support optional filename, where options may be in it's place + if (typeof filename === 'object' && + (typeof options === 'function' || options === undefined)) { + name = null + opts = filename + } + + // set Content-Disposition when file is sent + var headers = { + 'Content-Disposition': contentDisposition(name || path) + }; + + // merge user-provided headers + if (opts && opts.headers) { + var keys = Object.keys(opts.headers) + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + if (key.toLowerCase() !== 'content-disposition') { + headers[key] = opts.headers[key] + } + } + } + + // merge user-provided options + opts = Object.create(opts) + opts.headers = headers + + // Resolve the full path for sendFile + var fullPath = !opts.root + ? resolve(path) + : path + + // send file + return this.sendFile(fullPath, opts, done) +}; + +/** + * Set _Content-Type_ response header with `type` through `mime.lookup()` + * when it does not contain "/", or set the Content-Type to `type` otherwise. + * + * Examples: + * + * res.type('.html'); + * res.type('html'); + * res.type('json'); + * res.type('application/json'); + * res.type('png'); + * + * @param {String} type + * @return {ServerResponse} for chaining + * @public + */ + +res.contentType = +res.type = function contentType(type) { + var ct = type.indexOf('/') === -1 + ? mime.lookup(type) + : type; + + return this.set('Content-Type', ct); +}; + +/** + * Respond to the Acceptable formats using an `obj` + * of mime-type callbacks. + * + * This method uses `req.accepted`, an array of + * acceptable types ordered by their quality values. + * When "Accept" is not present the _first_ callback + * is invoked, otherwise the first match is used. When + * no match is performed the server responds with + * 406 "Not Acceptable". + * + * Content-Type is set for you, however if you choose + * you may alter this within the callback using `res.type()` + * or `res.set('Content-Type', ...)`. + * + * res.format({ + * 'text/plain': function(){ + * res.send('hey'); + * }, + * + * 'text/html': function(){ + * res.send('

hey

'); + * }, + * + * 'application/json': function () { + * res.send({ message: 'hey' }); + * } + * }); + * + * In addition to canonicalized MIME types you may + * also use extnames mapped to these types: + * + * res.format({ + * text: function(){ + * res.send('hey'); + * }, + * + * html: function(){ + * res.send('

hey

'); + * }, + * + * json: function(){ + * res.send({ message: 'hey' }); + * } + * }); + * + * By default Express passes an `Error` + * with a `.status` of 406 to `next(err)` + * if a match is not made. If you provide + * a `.default` callback it will be invoked + * instead. + * + * @param {Object} obj + * @return {ServerResponse} for chaining + * @public + */ + +res.format = function(obj){ + var req = this.req; + var next = req.next; + + var keys = Object.keys(obj) + .filter(function (v) { return v !== 'default' }) + + var key = keys.length > 0 + ? req.accepts(keys) + : false; + + this.vary("Accept"); + + if (key) { + this.set('Content-Type', normalizeType(key).value); + obj[key](req, this, next); + } else if (obj.default) { + obj.default(req, this, next) + } else { + next(createError(406, { + types: normalizeTypes(keys).map(function (o) { return o.value }) + })) + } + + return this; +}; + +/** + * Set _Content-Disposition_ header to _attachment_ with optional `filename`. + * + * @param {String} filename + * @return {ServerResponse} + * @public + */ + +res.attachment = function attachment(filename) { + if (filename) { + this.type(extname(filename)); + } + + this.set('Content-Disposition', contentDisposition(filename)); + + return this; +}; + +/** + * Append additional header `field` with value `val`. + * + * Example: + * + * res.append('Link', ['', '']); + * res.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly'); + * res.append('Warning', '199 Miscellaneous warning'); + * + * @param {String} field + * @param {String|Array} val + * @return {ServerResponse} for chaining + * @public + */ + +res.append = function append(field, val) { + var prev = this.get(field); + var value = val; + + if (prev) { + // concat the new and prev vals + value = Array.isArray(prev) ? prev.concat(val) + : Array.isArray(val) ? [prev].concat(val) + : [prev, val] + } + + return this.set(field, value); +}; + +/** + * Set header `field` to `val`, or pass + * an object of header fields. + * + * Examples: + * + * res.set('Foo', ['bar', 'baz']); + * res.set('Accept', 'application/json'); + * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); + * + * Aliased as `res.header()`. + * + * @param {String|Object} field + * @param {String|Array} val + * @return {ServerResponse} for chaining + * @public + */ + +res.set = +res.header = function header(field, val) { + if (arguments.length === 2) { + var value = Array.isArray(val) + ? val.map(String) + : String(val); + + // add charset to content-type + if (field.toLowerCase() === 'content-type') { + if (Array.isArray(value)) { + throw new TypeError('Content-Type cannot be set to an Array'); + } + if (!charsetRegExp.test(value)) { + var charset = mime.charsets.lookup(value.split(';')[0]); + if (charset) value += '; charset=' + charset.toLowerCase(); + } + } + + this.setHeader(field, value); + } else { + for (var key in field) { + this.set(key, field[key]); + } + } + return this; +}; + +/** + * Get value for header `field`. + * + * @param {String} field + * @return {String} + * @public + */ + +res.get = function(field){ + return this.getHeader(field); +}; + +/** + * Clear cookie `name`. + * + * @param {String} name + * @param {Object} [options] + * @return {ServerResponse} for chaining + * @public + */ + +res.clearCookie = function clearCookie(name, options) { + var opts = merge({ expires: new Date(1), path: '/' }, options); + + return this.cookie(name, '', opts); +}; + +/** + * Set cookie `name` to `value`, with the given `options`. + * + * Options: + * + * - `maxAge` max-age in milliseconds, converted to `expires` + * - `signed` sign the cookie + * - `path` defaults to "/" + * + * Examples: + * + * // "Remember Me" for 15 minutes + * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); + * + * // same as above + * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) + * + * @param {String} name + * @param {String|Object} value + * @param {Object} [options] + * @return {ServerResponse} for chaining + * @public + */ + +res.cookie = function (name, value, options) { + var opts = merge({}, options); + var secret = this.req.secret; + var signed = opts.signed; + + if (signed && !secret) { + throw new Error('cookieParser("secret") required for signed cookies'); + } + + var val = typeof value === 'object' + ? 'j:' + JSON.stringify(value) + : String(value); + + if (signed) { + val = 's:' + sign(val, secret); + } + + if (opts.maxAge != null) { + var maxAge = opts.maxAge - 0 + + if (!isNaN(maxAge)) { + opts.expires = new Date(Date.now() + maxAge) + opts.maxAge = Math.floor(maxAge / 1000) + } + } + + if (opts.path == null) { + opts.path = '/'; + } + + this.append('Set-Cookie', cookie.serialize(name, String(val), opts)); + + return this; +}; + +/** + * Set the location header to `url`. + * + * The given `url` can also be "back", which redirects + * to the _Referrer_ or _Referer_ headers or "/". + * + * Examples: + * + * res.location('/foo/bar').; + * res.location('http://example.com'); + * res.location('../login'); + * + * @param {String} url + * @return {ServerResponse} for chaining + * @public + */ + +res.location = function location(url) { + var loc; + + // "back" is an alias for the referrer + if (url === 'back') { + loc = this.req.get('Referrer') || '/'; + } else { + loc = String(url); + } + + var m = schemaAndHostRegExp.exec(loc); + var pos = m ? m[0].length + 1 : 0; + + // Only encode after host to avoid invalid encoding which can introduce + // vulnerabilities (e.g. `\\` to `%5C`). + loc = loc.slice(0, pos) + encodeUrl(loc.slice(pos)); + + return this.set('Location', loc); +}; + +/** + * Redirect to the given `url` with optional response `status` + * defaulting to 302. + * + * The resulting `url` is determined by `res.location()`, so + * it will play nicely with mounted apps, relative paths, + * `"back"` etc. + * + * Examples: + * + * res.redirect('/foo/bar'); + * res.redirect('http://example.com'); + * res.redirect(301, 'http://example.com'); + * res.redirect('../login'); // /blog/post/1 -> /blog/login + * + * @public + */ + +res.redirect = function redirect(url) { + var address = url; + var body; + var status = 302; + + // allow status / url + if (arguments.length === 2) { + if (typeof arguments[0] === 'number') { + status = arguments[0]; + address = arguments[1]; + } else { + deprecate('res.redirect(url, status): Use res.redirect(status, url) instead'); + status = arguments[1]; + } + } + + // Set location header + address = this.location(address).get('Location'); + + // Support text/{plain,html} by default + this.format({ + text: function(){ + body = statuses.message[status] + '. Redirecting to ' + address + }, + + html: function(){ + var u = escapeHtml(address); + body = '

' + statuses.message[status] + '. Redirecting to ' + u + '

' + }, + + default: function(){ + body = ''; + } + }); + + // Respond + this.statusCode = status; + this.set('Content-Length', Buffer.byteLength(body)); + + if (this.req.method === 'HEAD') { + this.end(); + } else { + this.end(body); + } +}; + +/** + * Add `field` to Vary. If already present in the Vary set, then + * this call is simply ignored. + * + * @param {Array|String} field + * @return {ServerResponse} for chaining + * @public + */ + +res.vary = function(field){ + // checks for back-compat + if (!field || (Array.isArray(field) && !field.length)) { + deprecate('res.vary(): Provide a field name'); + return this; + } + + vary(this, field); + + return this; +}; + +/** + * Render `view` with the given `options` and optional callback `fn`. + * When a callback function is given a response will _not_ be made + * automatically, otherwise a response of _200_ and _text/html_ is given. + * + * Options: + * + * - `cache` boolean hinting to the engine it should cache + * - `filename` filename of the view being rendered + * + * @public + */ + +res.render = function render(view, options, callback) { + var app = this.req.app; + var done = callback; + var opts = options || {}; + var req = this.req; + var self = this; + + // support callback function as second arg + if (typeof options === 'function') { + done = options; + opts = {}; + } + + // merge res.locals + opts._locals = self.locals; + + // default callback to respond + done = done || function (err, str) { + if (err) return req.next(err); + self.send(str); + }; + + // render + app.render(view, opts, done); +}; + +// pipe the send file stream +function sendfile(res, file, options, callback) { + var done = false; + var streaming; + + // request aborted + function onaborted() { + if (done) return; + done = true; + + var err = new Error('Request aborted'); + err.code = 'ECONNABORTED'; + callback(err); + } + + // directory + function ondirectory() { + if (done) return; + done = true; + + var err = new Error('EISDIR, read'); + err.code = 'EISDIR'; + callback(err); + } + + // errors + function onerror(err) { + if (done) return; + done = true; + callback(err); + } + + // ended + function onend() { + if (done) return; + done = true; + callback(); + } + + // file + function onfile() { + streaming = false; + } + + // finished + function onfinish(err) { + if (err && err.code === 'ECONNRESET') return onaborted(); + if (err) return onerror(err); + if (done) return; + + setImmediate(function () { + if (streaming !== false && !done) { + onaborted(); + return; + } + + if (done) return; + done = true; + callback(); + }); + } + + // streaming + function onstream() { + streaming = true; + } + + file.on('directory', ondirectory); + file.on('end', onend); + file.on('error', onerror); + file.on('file', onfile); + file.on('stream', onstream); + onFinished(res, onfinish); + + if (options.headers) { + // set headers on successful transfer + file.on('headers', function headers(res) { + var obj = options.headers; + var keys = Object.keys(obj); + + for (var i = 0; i < keys.length; i++) { + var k = keys[i]; + res.setHeader(k, obj[k]); + } + }); + } + + // pipe + file.pipe(res); +} + +/** + * Stringify JSON, like JSON.stringify, but v8 optimized, with the + * ability to escape characters that can trigger HTML sniffing. + * + * @param {*} value + * @param {function} replacer + * @param {number} spaces + * @param {boolean} escape + * @returns {string} + * @private + */ + +function stringify (value, replacer, spaces, escape) { + // v8 checks arguments.length for optimizing simple call + // https://bugs.chromium.org/p/v8/issues/detail?id=4730 + var json = replacer || spaces + ? JSON.stringify(value, replacer, spaces) + : JSON.stringify(value); + + if (escape && typeof json === 'string') { + json = json.replace(/[<>&]/g, function (c) { + switch (c.charCodeAt(0)) { + case 0x3c: + return '\\u003c' + case 0x3e: + return '\\u003e' + case 0x26: + return '\\u0026' + /* istanbul ignore next: unreachable default */ + default: + return c + } + }) + } + + return json +} diff --git a/graphql-subscription-express/node_modules/express/lib/router/index.js b/graphql-subscription-express/node_modules/express/lib/router/index.js new file mode 100644 index 0000000..abb3a6f --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/router/index.js @@ -0,0 +1,673 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var Route = require('./route'); +var Layer = require('./layer'); +var methods = require('methods'); +var mixin = require('utils-merge'); +var debug = require('debug')('express:router'); +var deprecate = require('depd')('express'); +var flatten = require('array-flatten'); +var parseUrl = require('parseurl'); +var setPrototypeOf = require('setprototypeof') + +/** + * Module variables. + * @private + */ + +var objectRegExp = /^\[object (\S+)\]$/; +var slice = Array.prototype.slice; +var toString = Object.prototype.toString; + +/** + * Initialize a new `Router` with the given `options`. + * + * @param {Object} [options] + * @return {Router} which is a callable function + * @public + */ + +var proto = module.exports = function(options) { + var opts = options || {}; + + function router(req, res, next) { + router.handle(req, res, next); + } + + // mixin Router class functions + setPrototypeOf(router, proto) + + router.params = {}; + router._params = []; + router.caseSensitive = opts.caseSensitive; + router.mergeParams = opts.mergeParams; + router.strict = opts.strict; + router.stack = []; + + return router; +}; + +/** + * Map the given param placeholder `name`(s) to the given callback. + * + * Parameter mapping is used to provide pre-conditions to routes + * which use normalized placeholders. For example a _:user_id_ parameter + * could automatically load a user's information from the database without + * any additional code, + * + * The callback uses the same signature as middleware, the only difference + * being that the value of the placeholder is passed, in this case the _id_ + * of the user. Once the `next()` function is invoked, just like middleware + * it will continue on to execute the route, or subsequent parameter functions. + * + * Just like in middleware, you must either respond to the request or call next + * to avoid stalling the request. + * + * app.param('user_id', function(req, res, next, id){ + * User.find(id, function(err, user){ + * if (err) { + * return next(err); + * } else if (!user) { + * return next(new Error('failed to load user')); + * } + * req.user = user; + * next(); + * }); + * }); + * + * @param {String} name + * @param {Function} fn + * @return {app} for chaining + * @public + */ + +proto.param = function param(name, fn) { + // param logic + if (typeof name === 'function') { + deprecate('router.param(fn): Refactor to use path params'); + this._params.push(name); + return; + } + + // apply param functions + var params = this._params; + var len = params.length; + var ret; + + if (name[0] === ':') { + deprecate('router.param(' + JSON.stringify(name) + ', fn): Use router.param(' + JSON.stringify(name.slice(1)) + ', fn) instead') + name = name.slice(1) + } + + for (var i = 0; i < len; ++i) { + if (ret = params[i](name, fn)) { + fn = ret; + } + } + + // ensure we end up with a + // middleware function + if ('function' !== typeof fn) { + throw new Error('invalid param() call for ' + name + ', got ' + fn); + } + + (this.params[name] = this.params[name] || []).push(fn); + return this; +}; + +/** + * Dispatch a req, res into the router. + * @private + */ + +proto.handle = function handle(req, res, out) { + var self = this; + + debug('dispatching %s %s', req.method, req.url); + + var idx = 0; + var protohost = getProtohost(req.url) || '' + var removed = ''; + var slashAdded = false; + var sync = 0 + var paramcalled = {}; + + // store options for OPTIONS request + // only used if OPTIONS request + var options = []; + + // middleware and routes + var stack = self.stack; + + // manage inter-router variables + var parentParams = req.params; + var parentUrl = req.baseUrl || ''; + var done = restore(out, req, 'baseUrl', 'next', 'params'); + + // setup next layer + req.next = next; + + // for options requests, respond with a default if nothing else responds + if (req.method === 'OPTIONS') { + done = wrap(done, function(old, err) { + if (err || options.length === 0) return old(err); + sendOptionsResponse(res, options, old); + }); + } + + // setup basic req values + req.baseUrl = parentUrl; + req.originalUrl = req.originalUrl || req.url; + + next(); + + function next(err) { + var layerError = err === 'route' + ? null + : err; + + // remove added slash + if (slashAdded) { + req.url = req.url.slice(1) + slashAdded = false; + } + + // restore altered req.url + if (removed.length !== 0) { + req.baseUrl = parentUrl; + req.url = protohost + removed + req.url.slice(protohost.length) + removed = ''; + } + + // signal to exit router + if (layerError === 'router') { + setImmediate(done, null) + return + } + + // no more matching layers + if (idx >= stack.length) { + setImmediate(done, layerError); + return; + } + + // max sync stack + if (++sync > 100) { + return setImmediate(next, err) + } + + // get pathname of request + var path = getPathname(req); + + if (path == null) { + return done(layerError); + } + + // find next matching layer + var layer; + var match; + var route; + + while (match !== true && idx < stack.length) { + layer = stack[idx++]; + match = matchLayer(layer, path); + route = layer.route; + + if (typeof match !== 'boolean') { + // hold on to layerError + layerError = layerError || match; + } + + if (match !== true) { + continue; + } + + if (!route) { + // process non-route handlers normally + continue; + } + + if (layerError) { + // routes do not match with a pending error + match = false; + continue; + } + + var method = req.method; + var has_method = route._handles_method(method); + + // build up automatic options response + if (!has_method && method === 'OPTIONS') { + appendMethods(options, route._options()); + } + + // don't even bother matching route + if (!has_method && method !== 'HEAD') { + match = false; + } + } + + // no match + if (match !== true) { + return done(layerError); + } + + // store route for dispatch on change + if (route) { + req.route = route; + } + + // Capture one-time layer values + req.params = self.mergeParams + ? mergeParams(layer.params, parentParams) + : layer.params; + var layerPath = layer.path; + + // this should be done for the layer + self.process_params(layer, paramcalled, req, res, function (err) { + if (err) { + next(layerError || err) + } else if (route) { + layer.handle_request(req, res, next) + } else { + trim_prefix(layer, layerError, layerPath, path) + } + + sync = 0 + }); + } + + function trim_prefix(layer, layerError, layerPath, path) { + if (layerPath.length !== 0) { + // Validate path is a prefix match + if (layerPath !== path.slice(0, layerPath.length)) { + next(layerError) + return + } + + // Validate path breaks on a path separator + var c = path[layerPath.length] + if (c && c !== '/' && c !== '.') return next(layerError) + + // Trim off the part of the url that matches the route + // middleware (.use stuff) needs to have the path stripped + debug('trim prefix (%s) from url %s', layerPath, req.url); + removed = layerPath; + req.url = protohost + req.url.slice(protohost.length + removed.length) + + // Ensure leading slash + if (!protohost && req.url[0] !== '/') { + req.url = '/' + req.url; + slashAdded = true; + } + + // Setup base URL (no trailing slash) + req.baseUrl = parentUrl + (removed[removed.length - 1] === '/' + ? removed.substring(0, removed.length - 1) + : removed); + } + + debug('%s %s : %s', layer.name, layerPath, req.originalUrl); + + if (layerError) { + layer.handle_error(layerError, req, res, next); + } else { + layer.handle_request(req, res, next); + } + } +}; + +/** + * Process any parameters for the layer. + * @private + */ + +proto.process_params = function process_params(layer, called, req, res, done) { + var params = this.params; + + // captured parameters from the layer, keys and values + var keys = layer.keys; + + // fast track + if (!keys || keys.length === 0) { + return done(); + } + + var i = 0; + var name; + var paramIndex = 0; + var key; + var paramVal; + var paramCallbacks; + var paramCalled; + + // process params in order + // param callbacks can be async + function param(err) { + if (err) { + return done(err); + } + + if (i >= keys.length ) { + return done(); + } + + paramIndex = 0; + key = keys[i++]; + name = key.name; + paramVal = req.params[name]; + paramCallbacks = params[name]; + paramCalled = called[name]; + + if (paramVal === undefined || !paramCallbacks) { + return param(); + } + + // param previously called with same value or error occurred + if (paramCalled && (paramCalled.match === paramVal + || (paramCalled.error && paramCalled.error !== 'route'))) { + // restore value + req.params[name] = paramCalled.value; + + // next param + return param(paramCalled.error); + } + + called[name] = paramCalled = { + error: null, + match: paramVal, + value: paramVal + }; + + paramCallback(); + } + + // single param callbacks + function paramCallback(err) { + var fn = paramCallbacks[paramIndex++]; + + // store updated value + paramCalled.value = req.params[key.name]; + + if (err) { + // store error + paramCalled.error = err; + param(err); + return; + } + + if (!fn) return param(); + + try { + fn(req, res, paramCallback, paramVal, key.name); + } catch (e) { + paramCallback(e); + } + } + + param(); +}; + +/** + * Use the given middleware function, with optional path, defaulting to "/". + * + * Use (like `.all`) will run for any http METHOD, but it will not add + * handlers for those methods so OPTIONS requests will not consider `.use` + * functions even if they could respond. + * + * The other difference is that _route_ path is stripped and not visible + * to the handler function. The main effect of this feature is that mounted + * handlers can operate without any code changes regardless of the "prefix" + * pathname. + * + * @public + */ + +proto.use = function use(fn) { + var offset = 0; + var path = '/'; + + // default path to '/' + // disambiguate router.use([fn]) + if (typeof fn !== 'function') { + var arg = fn; + + while (Array.isArray(arg) && arg.length !== 0) { + arg = arg[0]; + } + + // first arg is the path + if (typeof arg !== 'function') { + offset = 1; + path = fn; + } + } + + var callbacks = flatten(slice.call(arguments, offset)); + + if (callbacks.length === 0) { + throw new TypeError('Router.use() requires a middleware function') + } + + for (var i = 0; i < callbacks.length; i++) { + var fn = callbacks[i]; + + if (typeof fn !== 'function') { + throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn)) + } + + // add the middleware + debug('use %o %s', path, fn.name || '') + + var layer = new Layer(path, { + sensitive: this.caseSensitive, + strict: false, + end: false + }, fn); + + layer.route = undefined; + + this.stack.push(layer); + } + + return this; +}; + +/** + * Create a new Route for the given path. + * + * Each route contains a separate middleware stack and VERB handlers. + * + * See the Route api documentation for details on adding handlers + * and middleware to routes. + * + * @param {String} path + * @return {Route} + * @public + */ + +proto.route = function route(path) { + var route = new Route(path); + + var layer = new Layer(path, { + sensitive: this.caseSensitive, + strict: this.strict, + end: true + }, route.dispatch.bind(route)); + + layer.route = route; + + this.stack.push(layer); + return route; +}; + +// create Router#VERB functions +methods.concat('all').forEach(function(method){ + proto[method] = function(path){ + var route = this.route(path) + route[method].apply(route, slice.call(arguments, 1)); + return this; + }; +}); + +// append methods to a list of methods +function appendMethods(list, addition) { + for (var i = 0; i < addition.length; i++) { + var method = addition[i]; + if (list.indexOf(method) === -1) { + list.push(method); + } + } +} + +// get pathname of request +function getPathname(req) { + try { + return parseUrl(req).pathname; + } catch (err) { + return undefined; + } +} + +// Get get protocol + host for a URL +function getProtohost(url) { + if (typeof url !== 'string' || url.length === 0 || url[0] === '/') { + return undefined + } + + var searchIndex = url.indexOf('?') + var pathLength = searchIndex !== -1 + ? searchIndex + : url.length + var fqdnIndex = url.slice(0, pathLength).indexOf('://') + + return fqdnIndex !== -1 + ? url.substring(0, url.indexOf('/', 3 + fqdnIndex)) + : undefined +} + +// get type for error message +function gettype(obj) { + var type = typeof obj; + + if (type !== 'object') { + return type; + } + + // inspect [[Class]] for objects + return toString.call(obj) + .replace(objectRegExp, '$1'); +} + +/** + * Match path to a layer. + * + * @param {Layer} layer + * @param {string} path + * @private + */ + +function matchLayer(layer, path) { + try { + return layer.match(path); + } catch (err) { + return err; + } +} + +// merge params with parent params +function mergeParams(params, parent) { + if (typeof parent !== 'object' || !parent) { + return params; + } + + // make copy of parent for base + var obj = mixin({}, parent); + + // simple non-numeric merging + if (!(0 in params) || !(0 in parent)) { + return mixin(obj, params); + } + + var i = 0; + var o = 0; + + // determine numeric gaps + while (i in params) { + i++; + } + + while (o in parent) { + o++; + } + + // offset numeric indices in params before merge + for (i--; i >= 0; i--) { + params[i + o] = params[i]; + + // create holes for the merge when necessary + if (i < o) { + delete params[i]; + } + } + + return mixin(obj, params); +} + +// restore obj props after function +function restore(fn, obj) { + var props = new Array(arguments.length - 2); + var vals = new Array(arguments.length - 2); + + for (var i = 0; i < props.length; i++) { + props[i] = arguments[i + 2]; + vals[i] = obj[props[i]]; + } + + return function () { + // restore vals + for (var i = 0; i < props.length; i++) { + obj[props[i]] = vals[i]; + } + + return fn.apply(this, arguments); + }; +} + +// send an OPTIONS response +function sendOptionsResponse(res, options, next) { + try { + var body = options.join(','); + res.set('Allow', body); + res.send(body); + } catch (err) { + next(err); + } +} + +// wrap a function +function wrap(old, fn) { + return function proxy() { + var args = new Array(arguments.length + 1); + + args[0] = old; + for (var i = 0, len = arguments.length; i < len; i++) { + args[i + 1] = arguments[i]; + } + + fn.apply(this, args); + }; +} diff --git a/graphql-subscription-express/node_modules/express/lib/router/layer.js b/graphql-subscription-express/node_modules/express/lib/router/layer.js new file mode 100644 index 0000000..4dc8e86 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/router/layer.js @@ -0,0 +1,181 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var pathRegexp = require('path-to-regexp'); +var debug = require('debug')('express:router:layer'); + +/** + * Module variables. + * @private + */ + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * Module exports. + * @public + */ + +module.exports = Layer; + +function Layer(path, options, fn) { + if (!(this instanceof Layer)) { + return new Layer(path, options, fn); + } + + debug('new %o', path) + var opts = options || {}; + + this.handle = fn; + this.name = fn.name || ''; + this.params = undefined; + this.path = undefined; + this.regexp = pathRegexp(path, this.keys = [], opts); + + // set fast path flags + this.regexp.fast_star = path === '*' + this.regexp.fast_slash = path === '/' && opts.end === false +} + +/** + * Handle the error for the layer. + * + * @param {Error} error + * @param {Request} req + * @param {Response} res + * @param {function} next + * @api private + */ + +Layer.prototype.handle_error = function handle_error(error, req, res, next) { + var fn = this.handle; + + if (fn.length !== 4) { + // not a standard error handler + return next(error); + } + + try { + fn(error, req, res, next); + } catch (err) { + next(err); + } +}; + +/** + * Handle the request for the layer. + * + * @param {Request} req + * @param {Response} res + * @param {function} next + * @api private + */ + +Layer.prototype.handle_request = function handle(req, res, next) { + var fn = this.handle; + + if (fn.length > 3) { + // not a standard request handler + return next(); + } + + try { + fn(req, res, next); + } catch (err) { + next(err); + } +}; + +/** + * Check if this route matches `path`, if so + * populate `.params`. + * + * @param {String} path + * @return {Boolean} + * @api private + */ + +Layer.prototype.match = function match(path) { + var match + + if (path != null) { + // fast path non-ending match for / (any path matches) + if (this.regexp.fast_slash) { + this.params = {} + this.path = '' + return true + } + + // fast path for * (everything matched in a param) + if (this.regexp.fast_star) { + this.params = {'0': decode_param(path)} + this.path = path + return true + } + + // match the path + match = this.regexp.exec(path) + } + + if (!match) { + this.params = undefined; + this.path = undefined; + return false; + } + + // store values + this.params = {}; + this.path = match[0] + + var keys = this.keys; + var params = this.params; + + for (var i = 1; i < match.length; i++) { + var key = keys[i - 1]; + var prop = key.name; + var val = decode_param(match[i]) + + if (val !== undefined || !(hasOwnProperty.call(params, prop))) { + params[prop] = val; + } + } + + return true; +}; + +/** + * Decode param value. + * + * @param {string} val + * @return {string} + * @private + */ + +function decode_param(val) { + if (typeof val !== 'string' || val.length === 0) { + return val; + } + + try { + return decodeURIComponent(val); + } catch (err) { + if (err instanceof URIError) { + err.message = 'Failed to decode param \'' + val + '\''; + err.status = err.statusCode = 400; + } + + throw err; + } +} diff --git a/graphql-subscription-express/node_modules/express/lib/router/route.js b/graphql-subscription-express/node_modules/express/lib/router/route.js new file mode 100644 index 0000000..a65756d --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/router/route.js @@ -0,0 +1,230 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var debug = require('debug')('express:router:route'); +var flatten = require('array-flatten'); +var Layer = require('./layer'); +var methods = require('methods'); + +/** + * Module variables. + * @private + */ + +var slice = Array.prototype.slice; +var toString = Object.prototype.toString; + +/** + * Module exports. + * @public + */ + +module.exports = Route; + +/** + * Initialize `Route` with the given `path`, + * + * @param {String} path + * @public + */ + +function Route(path) { + this.path = path; + this.stack = []; + + debug('new %o', path) + + // route handlers for various http methods + this.methods = {}; +} + +/** + * Determine if the route handles a given method. + * @private + */ + +Route.prototype._handles_method = function _handles_method(method) { + if (this.methods._all) { + return true; + } + + // normalize name + var name = typeof method === 'string' + ? method.toLowerCase() + : method + + if (name === 'head' && !this.methods['head']) { + name = 'get'; + } + + return Boolean(this.methods[name]); +}; + +/** + * @return {Array} supported HTTP methods + * @private + */ + +Route.prototype._options = function _options() { + var methods = Object.keys(this.methods); + + // append automatic head + if (this.methods.get && !this.methods.head) { + methods.push('head'); + } + + for (var i = 0; i < methods.length; i++) { + // make upper case + methods[i] = methods[i].toUpperCase(); + } + + return methods; +}; + +/** + * dispatch req, res into this route + * @private + */ + +Route.prototype.dispatch = function dispatch(req, res, done) { + var idx = 0; + var stack = this.stack; + var sync = 0 + + if (stack.length === 0) { + return done(); + } + var method = typeof req.method === 'string' + ? req.method.toLowerCase() + : req.method + + if (method === 'head' && !this.methods['head']) { + method = 'get'; + } + + req.route = this; + + next(); + + function next(err) { + // signal to exit route + if (err && err === 'route') { + return done(); + } + + // signal to exit router + if (err && err === 'router') { + return done(err) + } + + // max sync stack + if (++sync > 100) { + return setImmediate(next, err) + } + + var layer = stack[idx++] + + // end of layers + if (!layer) { + return done(err) + } + + if (layer.method && layer.method !== method) { + next(err) + } else if (err) { + layer.handle_error(err, req, res, next); + } else { + layer.handle_request(req, res, next); + } + + sync = 0 + } +}; + +/** + * Add a handler for all HTTP verbs to this route. + * + * Behaves just like middleware and can respond or call `next` + * to continue processing. + * + * You can use multiple `.all` call to add multiple handlers. + * + * function check_something(req, res, next){ + * next(); + * }; + * + * function validate_user(req, res, next){ + * next(); + * }; + * + * route + * .all(validate_user) + * .all(check_something) + * .get(function(req, res, next){ + * res.send('hello world'); + * }); + * + * @param {function} handler + * @return {Route} for chaining + * @api public + */ + +Route.prototype.all = function all() { + var handles = flatten(slice.call(arguments)); + + for (var i = 0; i < handles.length; i++) { + var handle = handles[i]; + + if (typeof handle !== 'function') { + var type = toString.call(handle); + var msg = 'Route.all() requires a callback function but got a ' + type + throw new TypeError(msg); + } + + var layer = Layer('/', {}, handle); + layer.method = undefined; + + this.methods._all = true; + this.stack.push(layer); + } + + return this; +}; + +methods.forEach(function(method){ + Route.prototype[method] = function(){ + var handles = flatten(slice.call(arguments)); + + for (var i = 0; i < handles.length; i++) { + var handle = handles[i]; + + if (typeof handle !== 'function') { + var type = toString.call(handle); + var msg = 'Route.' + method + '() requires a callback function but got a ' + type + throw new Error(msg); + } + + debug('%s %o', method, this.path) + + var layer = Layer('/', {}, handle); + layer.method = method; + + this.methods[method] = true; + this.stack.push(layer); + } + + return this; + }; +}); diff --git a/graphql-subscription-express/node_modules/express/lib/utils.js b/graphql-subscription-express/node_modules/express/lib/utils.js new file mode 100644 index 0000000..56e12b9 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/utils.js @@ -0,0 +1,303 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @api private + */ + +var Buffer = require('safe-buffer').Buffer +var contentDisposition = require('content-disposition'); +var contentType = require('content-type'); +var deprecate = require('depd')('express'); +var flatten = require('array-flatten'); +var mime = require('send').mime; +var etag = require('etag'); +var proxyaddr = require('proxy-addr'); +var qs = require('qs'); +var querystring = require('querystring'); + +/** + * Return strong ETag for `body`. + * + * @param {String|Buffer} body + * @param {String} [encoding] + * @return {String} + * @api private + */ + +exports.etag = createETagGenerator({ weak: false }) + +/** + * Return weak ETag for `body`. + * + * @param {String|Buffer} body + * @param {String} [encoding] + * @return {String} + * @api private + */ + +exports.wetag = createETagGenerator({ weak: true }) + +/** + * Check if `path` looks absolute. + * + * @param {String} path + * @return {Boolean} + * @api private + */ + +exports.isAbsolute = function(path){ + if ('/' === path[0]) return true; + if (':' === path[1] && ('\\' === path[2] || '/' === path[2])) return true; // Windows device path + if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path +}; + +/** + * Flatten the given `arr`. + * + * @param {Array} arr + * @return {Array} + * @api private + */ + +exports.flatten = deprecate.function(flatten, + 'utils.flatten: use array-flatten npm module instead'); + +/** + * Normalize the given `type`, for example "html" becomes "text/html". + * + * @param {String} type + * @return {Object} + * @api private + */ + +exports.normalizeType = function(type){ + return ~type.indexOf('/') + ? acceptParams(type) + : { value: mime.lookup(type), params: {} }; +}; + +/** + * Normalize `types`, for example "html" becomes "text/html". + * + * @param {Array} types + * @return {Array} + * @api private + */ + +exports.normalizeTypes = function(types){ + var ret = []; + + for (var i = 0; i < types.length; ++i) { + ret.push(exports.normalizeType(types[i])); + } + + return ret; +}; + +/** + * Generate Content-Disposition header appropriate for the filename. + * non-ascii filenames are urlencoded and a filename* parameter is added + * + * @param {String} filename + * @return {String} + * @api private + */ + +exports.contentDisposition = deprecate.function(contentDisposition, + 'utils.contentDisposition: use content-disposition npm module instead'); + +/** + * Parse accept params `str` returning an + * object with `.value`, `.quality` and `.params`. + * + * @param {String} str + * @return {Object} + * @api private + */ + +function acceptParams (str) { + var parts = str.split(/ *; */); + var ret = { value: parts[0], quality: 1, params: {} } + + for (var i = 1; i < parts.length; ++i) { + var pms = parts[i].split(/ *= */); + if ('q' === pms[0]) { + ret.quality = parseFloat(pms[1]); + } else { + ret.params[pms[0]] = pms[1]; + } + } + + return ret; +} + +/** + * Compile "etag" value to function. + * + * @param {Boolean|String|Function} val + * @return {Function} + * @api private + */ + +exports.compileETag = function(val) { + var fn; + + if (typeof val === 'function') { + return val; + } + + switch (val) { + case true: + case 'weak': + fn = exports.wetag; + break; + case false: + break; + case 'strong': + fn = exports.etag; + break; + default: + throw new TypeError('unknown value for etag function: ' + val); + } + + return fn; +} + +/** + * Compile "query parser" value to function. + * + * @param {String|Function} val + * @return {Function} + * @api private + */ + +exports.compileQueryParser = function compileQueryParser(val) { + var fn; + + if (typeof val === 'function') { + return val; + } + + switch (val) { + case true: + case 'simple': + fn = querystring.parse; + break; + case false: + fn = newObject; + break; + case 'extended': + fn = parseExtendedQueryString; + break; + default: + throw new TypeError('unknown value for query parser function: ' + val); + } + + return fn; +} + +/** + * Compile "proxy trust" value to function. + * + * @param {Boolean|String|Number|Array|Function} val + * @return {Function} + * @api private + */ + +exports.compileTrust = function(val) { + if (typeof val === 'function') return val; + + if (val === true) { + // Support plain true/false + return function(){ return true }; + } + + if (typeof val === 'number') { + // Support trusting hop count + return function(a, i){ return i < val }; + } + + if (typeof val === 'string') { + // Support comma-separated values + val = val.split(',') + .map(function (v) { return v.trim() }) + } + + return proxyaddr.compile(val || []); +} + +/** + * Set the charset in a given Content-Type string. + * + * @param {String} type + * @param {String} charset + * @return {String} + * @api private + */ + +exports.setCharset = function setCharset(type, charset) { + if (!type || !charset) { + return type; + } + + // parse type + var parsed = contentType.parse(type); + + // set charset + parsed.parameters.charset = charset; + + // format type + return contentType.format(parsed); +}; + +/** + * Create an ETag generator function, generating ETags with + * the given options. + * + * @param {object} options + * @return {function} + * @private + */ + +function createETagGenerator (options) { + return function generateETag (body, encoding) { + var buf = !Buffer.isBuffer(body) + ? Buffer.from(body, encoding) + : body + + return etag(buf, options) + } +} + +/** + * Parse an extended query string with qs. + * + * @param {String} str + * @return {Object} + * @private + */ + +function parseExtendedQueryString(str) { + return qs.parse(str, { + allowPrototypes: true + }); +} + +/** + * Return new empty object. + * + * @return {Object} + * @api private + */ + +function newObject() { + return {}; +} diff --git a/graphql-subscription-express/node_modules/express/lib/view.js b/graphql-subscription-express/node_modules/express/lib/view.js new file mode 100644 index 0000000..c08ab4d --- /dev/null +++ b/graphql-subscription-express/node_modules/express/lib/view.js @@ -0,0 +1,182 @@ +/*! + * express + * Copyright(c) 2009-2013 TJ Holowaychuk + * Copyright(c) 2013 Roman Shtylman + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var debug = require('debug')('express:view'); +var path = require('path'); +var fs = require('fs'); + +/** + * Module variables. + * @private + */ + +var dirname = path.dirname; +var basename = path.basename; +var extname = path.extname; +var join = path.join; +var resolve = path.resolve; + +/** + * Module exports. + * @public + */ + +module.exports = View; + +/** + * Initialize a new `View` with the given `name`. + * + * Options: + * + * - `defaultEngine` the default template engine name + * - `engines` template engine require() cache + * - `root` root path for view lookup + * + * @param {string} name + * @param {object} options + * @public + */ + +function View(name, options) { + var opts = options || {}; + + this.defaultEngine = opts.defaultEngine; + this.ext = extname(name); + this.name = name; + this.root = opts.root; + + if (!this.ext && !this.defaultEngine) { + throw new Error('No default engine was specified and no extension was provided.'); + } + + var fileName = name; + + if (!this.ext) { + // get extension from default engine name + this.ext = this.defaultEngine[0] !== '.' + ? '.' + this.defaultEngine + : this.defaultEngine; + + fileName += this.ext; + } + + if (!opts.engines[this.ext]) { + // load engine + var mod = this.ext.slice(1) + debug('require "%s"', mod) + + // default engine export + var fn = require(mod).__express + + if (typeof fn !== 'function') { + throw new Error('Module "' + mod + '" does not provide a view engine.') + } + + opts.engines[this.ext] = fn + } + + // store loaded engine + this.engine = opts.engines[this.ext]; + + // lookup path + this.path = this.lookup(fileName); +} + +/** + * Lookup view by the given `name` + * + * @param {string} name + * @private + */ + +View.prototype.lookup = function lookup(name) { + var path; + var roots = [].concat(this.root); + + debug('lookup "%s"', name); + + for (var i = 0; i < roots.length && !path; i++) { + var root = roots[i]; + + // resolve the path + var loc = resolve(root, name); + var dir = dirname(loc); + var file = basename(loc); + + // resolve the file + path = this.resolve(dir, file); + } + + return path; +}; + +/** + * Render with the given options. + * + * @param {object} options + * @param {function} callback + * @private + */ + +View.prototype.render = function render(options, callback) { + debug('render "%s"', this.path); + this.engine(this.path, options, callback); +}; + +/** + * Resolve the file within the given directory. + * + * @param {string} dir + * @param {string} file + * @private + */ + +View.prototype.resolve = function resolve(dir, file) { + var ext = this.ext; + + // . + var path = join(dir, file); + var stat = tryStat(path); + + if (stat && stat.isFile()) { + return path; + } + + // /index. + path = join(dir, basename(file, ext), 'index' + ext); + stat = tryStat(path); + + if (stat && stat.isFile()) { + return path; + } +}; + +/** + * Return a stat, maybe. + * + * @param {string} path + * @return {fs.Stats} + * @private + */ + +function tryStat(path) { + debug('stat "%s"', path); + + try { + return fs.statSync(path); + } catch (e) { + return undefined; + } +} diff --git a/graphql-subscription-express/node_modules/express/package.json b/graphql-subscription-express/node_modules/express/package.json new file mode 100644 index 0000000..f299d88 --- /dev/null +++ b/graphql-subscription-express/node_modules/express/package.json @@ -0,0 +1,98 @@ +{ + "name": "express", + "description": "Fast, unopinionated, minimalist web framework", + "version": "4.19.2", + "author": "TJ Holowaychuk ", + "contributors": [ + "Aaron Heckmann ", + "Ciaran Jessup ", + "Douglas Christopher Wilson ", + "Guillermo Rauch ", + "Jonathan Ong ", + "Roman Shtylman ", + "Young Jae Sim " + ], + "license": "MIT", + "repository": "expressjs/express", + "homepage": "http://expressjs.com/", + "keywords": [ + "express", + "framework", + "sinatra", + "web", + "http", + "rest", + "restful", + "router", + "app", + "api" + ], + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "devDependencies": { + "after": "0.8.2", + "connect-redis": "3.4.2", + "cookie-parser": "1.4.6", + "cookie-session": "2.0.0", + "ejs": "3.1.9", + "eslint": "8.47.0", + "express-session": "1.17.2", + "hbs": "4.2.0", + "marked": "0.7.0", + "method-override": "3.0.0", + "mocha": "10.2.0", + "morgan": "1.10.0", + "nyc": "15.1.0", + "pbkdf2-password": "1.2.1", + "supertest": "6.3.0", + "vhost": "~3.0.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "files": [ + "LICENSE", + "History.md", + "Readme.md", + "index.js", + "lib/" + ], + "scripts": { + "lint": "eslint .", + "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/" + } +} diff --git a/graphql-subscription-express/node_modules/finalhandler/HISTORY.md b/graphql-subscription-express/node_modules/finalhandler/HISTORY.md new file mode 100644 index 0000000..ec2d38b --- /dev/null +++ b/graphql-subscription-express/node_modules/finalhandler/HISTORY.md @@ -0,0 +1,195 @@ +1.2.0 / 2022-03-22 +================== + + * Remove set content headers that break response + * deps: on-finished@2.4.1 + * deps: statuses@2.0.1 + - Rename `425 Unordered Collection` to standard `425 Too Early` + +1.1.2 / 2019-05-09 +================== + + * Set stricter `Content-Security-Policy` header + * deps: parseurl@~1.3.3 + * deps: statuses@~1.5.0 + +1.1.1 / 2018-03-06 +================== + + * Fix 404 output for bad / missing pathnames + * deps: encodeurl@~1.0.2 + - Fix encoding `%` as last character + * deps: statuses@~1.4.0 + +1.1.0 / 2017-09-24 +================== + + * Use `res.headersSent` when available + +1.0.6 / 2017-09-22 +================== + + * deps: debug@2.6.9 + +1.0.5 / 2017-09-15 +================== + + * deps: parseurl@~1.3.2 + - perf: reduce overhead for full URLs + - perf: unroll the "fast-path" `RegExp` + +1.0.4 / 2017-08-03 +================== + + * deps: debug@2.6.8 + +1.0.3 / 2017-05-16 +================== + + * deps: debug@2.6.7 + - deps: ms@2.0.0 + +1.0.2 / 2017-04-22 +================== + + * deps: debug@2.6.4 + - deps: ms@0.7.3 + +1.0.1 / 2017-03-21 +================== + + * Fix missing `` in HTML document + * deps: debug@2.6.3 + - Fix: `DEBUG_MAX_ARRAY_LENGTH` + +1.0.0 / 2017-02-15 +================== + + * Fix exception when `err` cannot be converted to a string + * Fully URL-encode the pathname in the 404 message + * Only include the pathname in the 404 message + * Send complete HTML document + * Set `Content-Security-Policy: default-src 'self'` header + * deps: debug@2.6.1 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable set to `3` or higher + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + +0.5.1 / 2016-11-12 +================== + + * Fix exception when `err.headers` is not an object + * deps: statuses@~1.3.1 + * perf: hoist regular expressions + * perf: remove duplicate validation path + +0.5.0 / 2016-06-15 +================== + + * Change invalid or non-numeric status code to 500 + * Overwrite status message to match set status code + * Prefer `err.statusCode` if `err.status` is invalid + * Set response headers from `err.headers` object + * Use `statuses` instead of `http` module for status messages + - Includes all defined status messages + +0.4.1 / 2015-12-02 +================== + + * deps: escape-html@~1.0.3 + - perf: enable strict mode + - perf: optimize string replacement + - perf: use faster string coercion + +0.4.0 / 2015-06-14 +================== + + * Fix a false-positive when unpiping in Node.js 0.8 + * Support `statusCode` property on `Error` objects + * Use `unpipe` module for unpiping requests + * deps: escape-html@1.0.2 + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * perf: enable strict mode + * perf: remove argument reassignment + +0.3.6 / 2015-05-11 +================== + + * deps: debug@~2.2.0 + - deps: ms@0.7.1 + +0.3.5 / 2015-04-22 +================== + + * deps: on-finished@~2.2.1 + - Fix `isFinished(req)` when data buffered + +0.3.4 / 2015-03-15 +================== + + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + +0.3.3 / 2015-01-01 +================== + + * deps: debug@~2.1.1 + * deps: on-finished@~2.2.0 + +0.3.2 / 2014-10-22 +================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + +0.3.1 / 2014-10-16 +================== + + * deps: debug@~2.1.0 + - Implement `DEBUG_FD` env variable support + +0.3.0 / 2014-09-17 +================== + + * Terminate in progress response only on error + * Use `on-finished` to determine request status + +0.2.0 / 2014-09-03 +================== + + * Set `X-Content-Type-Options: nosniff` header + * deps: debug@~2.0.0 + +0.1.0 / 2014-07-16 +================== + + * Respond after request fully read + - prevents hung responses and socket hang ups + * deps: debug@1.0.4 + +0.0.3 / 2014-07-11 +================== + + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + +0.0.2 / 2014-06-19 +================== + + * Handle invalid status codes + +0.0.1 / 2014-06-05 +================== + + * deps: debug@1.0.2 + +0.0.0 / 2014-06-05 +================== + + * Extracted from connect/express diff --git a/graphql-subscription-express/node_modules/finalhandler/LICENSE b/graphql-subscription-express/node_modules/finalhandler/LICENSE new file mode 100644 index 0000000..6022106 --- /dev/null +++ b/graphql-subscription-express/node_modules/finalhandler/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2022 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/finalhandler/README.md b/graphql-subscription-express/node_modules/finalhandler/README.md new file mode 100644 index 0000000..81f10ef --- /dev/null +++ b/graphql-subscription-express/node_modules/finalhandler/README.md @@ -0,0 +1,147 @@ +# finalhandler + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Node.js function to invoke as the final step to respond to HTTP request. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install finalhandler +``` + +## API + +```js +var finalhandler = require('finalhandler') +``` + +### finalhandler(req, res, [options]) + +Returns function to be invoked as the final step for the given `req` and `res`. +This function is to be invoked as `fn(err)`. If `err` is falsy, the handler will +write out a 404 response to the `res`. If it is truthy, an error response will +be written out to the `res` or `res` will be terminated if a response has already +started. + +When an error is written, the following information is added to the response: + + * The `res.statusCode` is set from `err.status` (or `err.statusCode`). If + this value is outside the 4xx or 5xx range, it will be set to 500. + * The `res.statusMessage` is set according to the status code. + * The body will be the HTML of the status code message if `env` is + `'production'`, otherwise will be `err.stack`. + * Any headers specified in an `err.headers` object. + +The final handler will also unpipe anything from `req` when it is invoked. + +#### options.env + +By default, the environment is determined by `NODE_ENV` variable, but it can be +overridden by this option. + +#### options.onerror + +Provide a function to be called with the `err` when it exists. Can be used for +writing errors to a central location without excessive function generation. Called +as `onerror(err, req, res)`. + +## Examples + +### always 404 + +```js +var finalhandler = require('finalhandler') +var http = require('http') + +var server = http.createServer(function (req, res) { + var done = finalhandler(req, res) + done() +}) + +server.listen(3000) +``` + +### perform simple action + +```js +var finalhandler = require('finalhandler') +var fs = require('fs') +var http = require('http') + +var server = http.createServer(function (req, res) { + var done = finalhandler(req, res) + + fs.readFile('index.html', function (err, buf) { + if (err) return done(err) + res.setHeader('Content-Type', 'text/html') + res.end(buf) + }) +}) + +server.listen(3000) +``` + +### use with middleware-style functions + +```js +var finalhandler = require('finalhandler') +var http = require('http') +var serveStatic = require('serve-static') + +var serve = serveStatic('public') + +var server = http.createServer(function (req, res) { + var done = finalhandler(req, res) + serve(req, res, done) +}) + +server.listen(3000) +``` + +### keep log of all errors + +```js +var finalhandler = require('finalhandler') +var fs = require('fs') +var http = require('http') + +var server = http.createServer(function (req, res) { + var done = finalhandler(req, res, { onerror: logerror }) + + fs.readFile('index.html', function (err, buf) { + if (err) return done(err) + res.setHeader('Content-Type', 'text/html') + res.end(buf) + }) +}) + +server.listen(3000) + +function logerror (err) { + console.error(err.stack || err.toString()) +} +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/finalhandler.svg +[npm-url]: https://npmjs.org/package/finalhandler +[node-image]: https://img.shields.io/node/v/finalhandler.svg +[node-url]: https://nodejs.org/en/download +[coveralls-image]: https://img.shields.io/coveralls/pillarjs/finalhandler.svg +[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master +[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg +[downloads-url]: https://npmjs.org/package/finalhandler +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/pillarjs/finalhandler/ci/master?label=ci +[github-actions-ci-url]: https://github.com/jshttp/pillarjs/finalhandler?query=workflow%3Aci diff --git a/graphql-subscription-express/node_modules/finalhandler/SECURITY.md b/graphql-subscription-express/node_modules/finalhandler/SECURITY.md new file mode 100644 index 0000000..6e23249 --- /dev/null +++ b/graphql-subscription-express/node_modules/finalhandler/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policies and Procedures + +## Reporting a Bug + +The `finalhandler` team and community take all security bugs seriously. Thank +you for improving the security of Express. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your +contributions. + +Report security bugs by emailing the current owner(s) of `finalhandler`. This +information can be found in the npm registry using the command +`npm owner ls finalhandler`. +If unsure or unable to get the information from the above, open an issue +in the [project issue tracker](https://github.com/pillarjs/finalhandler/issues) +asking for the current contact information. + +To ensure the timely response to your report, please ensure that the entirety +of the report is contained within the email body and not solely behind a web +link or an attachment. + +At least one owner will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the owners will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. diff --git a/graphql-subscription-express/node_modules/finalhandler/index.js b/graphql-subscription-express/node_modules/finalhandler/index.js new file mode 100644 index 0000000..f628e42 --- /dev/null +++ b/graphql-subscription-express/node_modules/finalhandler/index.js @@ -0,0 +1,336 @@ +/*! + * finalhandler + * Copyright(c) 2014-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var debug = require('debug')('finalhandler') +var encodeUrl = require('encodeurl') +var escapeHtml = require('escape-html') +var onFinished = require('on-finished') +var parseUrl = require('parseurl') +var statuses = require('statuses') +var unpipe = require('unpipe') + +/** + * Module variables. + * @private + */ + +var DOUBLE_SPACE_REGEXP = /\x20{2}/g +var NEWLINE_REGEXP = /\n/g + +/* istanbul ignore next */ +var defer = typeof setImmediate === 'function' + ? setImmediate + : function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) } +var isFinished = onFinished.isFinished + +/** + * Create a minimal HTML document. + * + * @param {string} message + * @private + */ + +function createHtmlDocument (message) { + var body = escapeHtml(message) + .replace(NEWLINE_REGEXP, '
') + .replace(DOUBLE_SPACE_REGEXP, '  ') + + return '\n' + + '\n' + + '\n' + + '\n' + + 'Error\n' + + '\n' + + '\n' + + '
' + body + '
\n' + + '\n' + + '\n' +} + +/** + * Module exports. + * @public + */ + +module.exports = finalhandler + +/** + * Create a function to handle the final response. + * + * @param {Request} req + * @param {Response} res + * @param {Object} [options] + * @return {Function} + * @public + */ + +function finalhandler (req, res, options) { + var opts = options || {} + + // get environment + var env = opts.env || process.env.NODE_ENV || 'development' + + // get error callback + var onerror = opts.onerror + + return function (err) { + var headers + var msg + var status + + // ignore 404 on in-flight response + if (!err && headersSent(res)) { + debug('cannot 404 after headers sent') + return + } + + // unhandled error + if (err) { + // respect status code from error + status = getErrorStatusCode(err) + + if (status === undefined) { + // fallback to status code on response + status = getResponseStatusCode(res) + } else { + // respect headers from error + headers = getErrorHeaders(err) + } + + // get error message + msg = getErrorMessage(err, status, env) + } else { + // not found + status = 404 + msg = 'Cannot ' + req.method + ' ' + encodeUrl(getResourceName(req)) + } + + debug('default %s', status) + + // schedule onerror callback + if (err && onerror) { + defer(onerror, err, req, res) + } + + // cannot actually respond + if (headersSent(res)) { + debug('cannot %d after headers sent', status) + req.socket.destroy() + return + } + + // send response + send(req, res, status, headers, msg) + } +} + +/** + * Get headers from Error object. + * + * @param {Error} err + * @return {object} + * @private + */ + +function getErrorHeaders (err) { + if (!err.headers || typeof err.headers !== 'object') { + return undefined + } + + var headers = Object.create(null) + var keys = Object.keys(err.headers) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + headers[key] = err.headers[key] + } + + return headers +} + +/** + * Get message from Error object, fallback to status message. + * + * @param {Error} err + * @param {number} status + * @param {string} env + * @return {string} + * @private + */ + +function getErrorMessage (err, status, env) { + var msg + + if (env !== 'production') { + // use err.stack, which typically includes err.message + msg = err.stack + + // fallback to err.toString() when possible + if (!msg && typeof err.toString === 'function') { + msg = err.toString() + } + } + + return msg || statuses.message[status] +} + +/** + * Get status code from Error object. + * + * @param {Error} err + * @return {number} + * @private + */ + +function getErrorStatusCode (err) { + // check err.status + if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) { + return err.status + } + + // check err.statusCode + if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) { + return err.statusCode + } + + return undefined +} + +/** + * Get resource name for the request. + * + * This is typically just the original pathname of the request + * but will fallback to "resource" is that cannot be determined. + * + * @param {IncomingMessage} req + * @return {string} + * @private + */ + +function getResourceName (req) { + try { + return parseUrl.original(req).pathname + } catch (e) { + return 'resource' + } +} + +/** + * Get status code from response. + * + * @param {OutgoingMessage} res + * @return {number} + * @private + */ + +function getResponseStatusCode (res) { + var status = res.statusCode + + // default status code to 500 if outside valid range + if (typeof status !== 'number' || status < 400 || status > 599) { + status = 500 + } + + return status +} + +/** + * Determine if the response headers have been sent. + * + * @param {object} res + * @returns {boolean} + * @private + */ + +function headersSent (res) { + return typeof res.headersSent !== 'boolean' + ? Boolean(res._header) + : res.headersSent +} + +/** + * Send response. + * + * @param {IncomingMessage} req + * @param {OutgoingMessage} res + * @param {number} status + * @param {object} headers + * @param {string} message + * @private + */ + +function send (req, res, status, headers, message) { + function write () { + // response body + var body = createHtmlDocument(message) + + // response status + res.statusCode = status + res.statusMessage = statuses.message[status] + + // remove any content headers + res.removeHeader('Content-Encoding') + res.removeHeader('Content-Language') + res.removeHeader('Content-Range') + + // response headers + setHeaders(res, headers) + + // security headers + res.setHeader('Content-Security-Policy', "default-src 'none'") + res.setHeader('X-Content-Type-Options', 'nosniff') + + // standard headers + res.setHeader('Content-Type', 'text/html; charset=utf-8') + res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8')) + + if (req.method === 'HEAD') { + res.end() + return + } + + res.end(body, 'utf8') + } + + if (isFinished(req)) { + write() + return + } + + // unpipe everything from the request + unpipe(req) + + // flush the request + onFinished(req, write) + req.resume() +} + +/** + * Set response headers from an object. + * + * @param {OutgoingMessage} res + * @param {object} headers + * @private + */ + +function setHeaders (res, headers) { + if (!headers) { + return + } + + var keys = Object.keys(headers) + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + res.setHeader(key, headers[key]) + } +} diff --git a/graphql-subscription-express/node_modules/finalhandler/package.json b/graphql-subscription-express/node_modules/finalhandler/package.json new file mode 100644 index 0000000..16bf11e --- /dev/null +++ b/graphql-subscription-express/node_modules/finalhandler/package.json @@ -0,0 +1,46 @@ +{ + "name": "finalhandler", + "description": "Node.js final http responder", + "version": "1.2.0", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "repository": "pillarjs/finalhandler", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.2", + "nyc": "15.1.0", + "readable-stream": "2.3.6", + "safe-buffer": "5.2.1", + "supertest": "6.2.2" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "SECURITY.md", + "index.js" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/forwarded/HISTORY.md b/graphql-subscription-express/node_modules/forwarded/HISTORY.md new file mode 100644 index 0000000..381e6aa --- /dev/null +++ b/graphql-subscription-express/node_modules/forwarded/HISTORY.md @@ -0,0 +1,21 @@ +0.2.0 / 2021-05-31 +================== + + * Use `req.socket` over deprecated `req.connection` + +0.1.2 / 2017-09-14 +================== + + * perf: improve header parsing + * perf: reduce overhead when no `X-Forwarded-For` header + +0.1.1 / 2017-09-10 +================== + + * Fix trimming leading / trailing OWS + * perf: hoist regular expression + +0.1.0 / 2014-09-21 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/forwarded/LICENSE b/graphql-subscription-express/node_modules/forwarded/LICENSE new file mode 100644 index 0000000..84441fb --- /dev/null +++ b/graphql-subscription-express/node_modules/forwarded/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/forwarded/README.md b/graphql-subscription-express/node_modules/forwarded/README.md new file mode 100644 index 0000000..fdd220b --- /dev/null +++ b/graphql-subscription-express/node_modules/forwarded/README.md @@ -0,0 +1,57 @@ +# forwarded + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Parse HTTP X-Forwarded-For header + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install forwarded +``` + +## API + +```js +var forwarded = require('forwarded') +``` + +### forwarded(req) + +```js +var addresses = forwarded(req) +``` + +Parse the `X-Forwarded-For` header from the request. Returns an array +of the addresses, including the socket address for the `req`, in reverse +order (i.e. index `0` is the socket address and the last index is the +furthest address, typically the end-user). + +## Testing + +```sh +$ npm test +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/forwarded/master?label=ci +[ci-url]: https://github.com/jshttp/forwarded/actions?query=workflow%3Aci +[npm-image]: https://img.shields.io/npm/v/forwarded.svg +[npm-url]: https://npmjs.org/package/forwarded +[node-version-image]: https://img.shields.io/node/v/forwarded.svg +[node-version-url]: https://nodejs.org/en/download/ +[coveralls-image]: https://img.shields.io/coveralls/jshttp/forwarded/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/forwarded?branch=master +[downloads-image]: https://img.shields.io/npm/dm/forwarded.svg +[downloads-url]: https://npmjs.org/package/forwarded diff --git a/graphql-subscription-express/node_modules/forwarded/index.js b/graphql-subscription-express/node_modules/forwarded/index.js new file mode 100644 index 0000000..b2b6bdd --- /dev/null +++ b/graphql-subscription-express/node_modules/forwarded/index.js @@ -0,0 +1,90 @@ +/*! + * forwarded + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = forwarded + +/** + * Get all addresses in the request, using the `X-Forwarded-For` header. + * + * @param {object} req + * @return {array} + * @public + */ + +function forwarded (req) { + if (!req) { + throw new TypeError('argument req is required') + } + + // simple header parsing + var proxyAddrs = parse(req.headers['x-forwarded-for'] || '') + var socketAddr = getSocketAddr(req) + var addrs = [socketAddr].concat(proxyAddrs) + + // return all addresses + return addrs +} + +/** + * Get the socket address for a request. + * + * @param {object} req + * @return {string} + * @private + */ + +function getSocketAddr (req) { + return req.socket + ? req.socket.remoteAddress + : req.connection.remoteAddress +} + +/** + * Parse the X-Forwarded-For header. + * + * @param {string} header + * @private + */ + +function parse (header) { + var end = header.length + var list = [] + var start = header.length + + // gather addresses, backwards + for (var i = header.length - 1; i >= 0; i--) { + switch (header.charCodeAt(i)) { + case 0x20: /* */ + if (start === end) { + start = end = i + } + break + case 0x2c: /* , */ + if (start !== end) { + list.push(header.substring(start, end)) + } + start = end = i + break + default: + start = i + break + } + } + + // final address + if (start !== end) { + list.push(header.substring(start, end)) + } + + return list +} diff --git a/graphql-subscription-express/node_modules/forwarded/package.json b/graphql-subscription-express/node_modules/forwarded/package.json new file mode 100644 index 0000000..bf9c7d6 --- /dev/null +++ b/graphql-subscription-express/node_modules/forwarded/package.json @@ -0,0 +1,45 @@ +{ + "name": "forwarded", + "description": "Parse HTTP X-Forwarded-For header", + "version": "0.2.0", + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "keywords": [ + "x-forwarded-for", + "http", + "req" + ], + "repository": "jshttp/forwarded", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "deep-equal": "1.0.1", + "eslint": "7.27.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.23.4", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "4.3.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "8.4.0", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/graphql-subscription-express/node_modules/fresh/HISTORY.md b/graphql-subscription-express/node_modules/fresh/HISTORY.md new file mode 100644 index 0000000..4586996 --- /dev/null +++ b/graphql-subscription-express/node_modules/fresh/HISTORY.md @@ -0,0 +1,70 @@ +0.5.2 / 2017-09-13 +================== + + * Fix regression matching multiple ETags in `If-None-Match` + * perf: improve `If-None-Match` token parsing + +0.5.1 / 2017-09-11 +================== + + * Fix handling of modified headers with invalid dates + * perf: improve ETag match loop + +0.5.0 / 2017-02-21 +================== + + * Fix incorrect result when `If-None-Match` has both `*` and ETags + * Fix weak `ETag` matching to match spec + * perf: delay reading header values until needed + * perf: skip checking modified time if ETag check failed + * perf: skip parsing `If-None-Match` when no `ETag` header + * perf: use `Date.parse` instead of `new Date` + +0.4.0 / 2017-02-05 +================== + + * Fix false detection of `no-cache` request directive + * perf: enable strict mode + * perf: hoist regular expressions + * perf: remove duplicate conditional + * perf: remove unnecessary boolean coercions + +0.3.0 / 2015-05-12 +================== + + * Add weak `ETag` matching support + +0.2.4 / 2014-09-07 +================== + + * Support Node.js 0.6 + +0.2.3 / 2014-09-07 +================== + + * Move repository to jshttp + +0.2.2 / 2014-02-19 +================== + + * Revert "Fix for blank page on Safari reload" + +0.2.1 / 2014-01-29 +================== + + * Fix for blank page on Safari reload + +0.2.0 / 2013-08-11 +================== + + * Return stale for `Cache-Control: no-cache` + +0.1.0 / 2012-06-15 +================== + + * Add `If-None-Match: *` support + +0.0.1 / 2012-06-10 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/fresh/LICENSE b/graphql-subscription-express/node_modules/fresh/LICENSE new file mode 100644 index 0000000..1434ade --- /dev/null +++ b/graphql-subscription-express/node_modules/fresh/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk +Copyright (c) 2016-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/fresh/README.md b/graphql-subscription-express/node_modules/fresh/README.md new file mode 100644 index 0000000..1c1c680 --- /dev/null +++ b/graphql-subscription-express/node_modules/fresh/README.md @@ -0,0 +1,119 @@ +# fresh + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +HTTP response freshness testing + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +``` +$ npm install fresh +``` + +## API + + + +```js +var fresh = require('fresh') +``` + +### fresh(reqHeaders, resHeaders) + +Check freshness of the response using request and response headers. + +When the response is still "fresh" in the client's cache `true` is +returned, otherwise `false` is returned to indicate that the client +cache is now stale and the full response should be sent. + +When a client sends the `Cache-Control: no-cache` request header to +indicate an end-to-end reload request, this module will return `false` +to make handling these requests transparent. + +## Known Issues + +This module is designed to only follow the HTTP specifications, not +to work-around all kinda of client bugs (especially since this module +typically does not recieve enough information to understand what the +client actually is). + +There is a known issue that in certain versions of Safari, Safari +will incorrectly make a request that allows this module to validate +freshness of the resource even when Safari does not have a +representation of the resource in the cache. The module +[jumanji](https://www.npmjs.com/package/jumanji) can be used in +an Express application to work-around this issue and also provides +links to further reading on this Safari bug. + +## Example + +### API usage + + + +```js +var reqHeaders = { 'if-none-match': '"foo"' } +var resHeaders = { 'etag': '"bar"' } +fresh(reqHeaders, resHeaders) +// => false + +var reqHeaders = { 'if-none-match': '"foo"' } +var resHeaders = { 'etag': '"foo"' } +fresh(reqHeaders, resHeaders) +// => true +``` + +### Using with Node.js http server + +```js +var fresh = require('fresh') +var http = require('http') + +var server = http.createServer(function (req, res) { + // perform server logic + // ... including adding ETag / Last-Modified response headers + + if (isFresh(req, res)) { + // client has a fresh copy of resource + res.statusCode = 304 + res.end() + return + } + + // send the resource + res.statusCode = 200 + res.end('hello, world!') +}) + +function isFresh (req, res) { + return fresh(req.headers, { + 'etag': res.getHeader('ETag'), + 'last-modified': res.getHeader('Last-Modified') + }) +} + +server.listen(3000) +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/fresh.svg +[npm-url]: https://npmjs.org/package/fresh +[node-version-image]: https://img.shields.io/node/v/fresh.svg +[node-version-url]: https://nodejs.org/en/ +[travis-image]: https://img.shields.io/travis/jshttp/fresh/master.svg +[travis-url]: https://travis-ci.org/jshttp/fresh +[coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/fresh?branch=master +[downloads-image]: https://img.shields.io/npm/dm/fresh.svg +[downloads-url]: https://npmjs.org/package/fresh diff --git a/graphql-subscription-express/node_modules/fresh/index.js b/graphql-subscription-express/node_modules/fresh/index.js new file mode 100644 index 0000000..d154f5a --- /dev/null +++ b/graphql-subscription-express/node_modules/fresh/index.js @@ -0,0 +1,137 @@ +/*! + * fresh + * Copyright(c) 2012 TJ Holowaychuk + * Copyright(c) 2016-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * RegExp to check for no-cache token in Cache-Control. + * @private + */ + +var CACHE_CONTROL_NO_CACHE_REGEXP = /(?:^|,)\s*?no-cache\s*?(?:,|$)/ + +/** + * Module exports. + * @public + */ + +module.exports = fresh + +/** + * Check freshness of the response using request and response headers. + * + * @param {Object} reqHeaders + * @param {Object} resHeaders + * @return {Boolean} + * @public + */ + +function fresh (reqHeaders, resHeaders) { + // fields + var modifiedSince = reqHeaders['if-modified-since'] + var noneMatch = reqHeaders['if-none-match'] + + // unconditional request + if (!modifiedSince && !noneMatch) { + return false + } + + // Always return stale when Cache-Control: no-cache + // to support end-to-end reload requests + // https://tools.ietf.org/html/rfc2616#section-14.9.4 + var cacheControl = reqHeaders['cache-control'] + if (cacheControl && CACHE_CONTROL_NO_CACHE_REGEXP.test(cacheControl)) { + return false + } + + // if-none-match + if (noneMatch && noneMatch !== '*') { + var etag = resHeaders['etag'] + + if (!etag) { + return false + } + + var etagStale = true + var matches = parseTokenList(noneMatch) + for (var i = 0; i < matches.length; i++) { + var match = matches[i] + if (match === etag || match === 'W/' + etag || 'W/' + match === etag) { + etagStale = false + break + } + } + + if (etagStale) { + return false + } + } + + // if-modified-since + if (modifiedSince) { + var lastModified = resHeaders['last-modified'] + var modifiedStale = !lastModified || !(parseHttpDate(lastModified) <= parseHttpDate(modifiedSince)) + + if (modifiedStale) { + return false + } + } + + return true +} + +/** + * Parse an HTTP Date into a number. + * + * @param {string} date + * @private + */ + +function parseHttpDate (date) { + var timestamp = date && Date.parse(date) + + // istanbul ignore next: guard against date.js Date.parse patching + return typeof timestamp === 'number' + ? timestamp + : NaN +} + +/** + * Parse a HTTP token list. + * + * @param {string} str + * @private + */ + +function parseTokenList (str) { + var end = 0 + var list = [] + var start = 0 + + // gather tokens + for (var i = 0, len = str.length; i < len; i++) { + switch (str.charCodeAt(i)) { + case 0x20: /* */ + if (start === end) { + start = end = i + 1 + } + break + case 0x2c: /* , */ + list.push(str.substring(start, end)) + start = end = i + 1 + break + default: + end = i + 1 + break + } + } + + // final token + list.push(str.substring(start, end)) + + return list +} diff --git a/graphql-subscription-express/node_modules/fresh/package.json b/graphql-subscription-express/node_modules/fresh/package.json new file mode 100644 index 0000000..c2fa0f4 --- /dev/null +++ b/graphql-subscription-express/node_modules/fresh/package.json @@ -0,0 +1,46 @@ +{ + "name": "fresh", + "description": "HTTP response freshness testing", + "version": "0.5.2", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "keywords": [ + "fresh", + "http", + "conditional", + "cache" + ], + "repository": "jshttp/fresh", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/function-bind/.eslintrc b/graphql-subscription-express/node_modules/function-bind/.eslintrc new file mode 100644 index 0000000..71a054f --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/.eslintrc @@ -0,0 +1,21 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "indent": [2, 4], + "no-new-func": [1], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + "strict": [0] + }, + }, + ], +} diff --git a/graphql-subscription-express/node_modules/function-bind/.github/FUNDING.yml b/graphql-subscription-express/node_modules/function-bind/.github/FUNDING.yml new file mode 100644 index 0000000..7448219 --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/function-bind +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/function-bind/.github/SECURITY.md b/graphql-subscription-express/node_modules/function-bind/.github/SECURITY.md new file mode 100644 index 0000000..82e4285 --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/graphql-subscription-express/node_modules/function-bind/.nycrc b/graphql-subscription-express/node_modules/function-bind/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/function-bind/CHANGELOG.md b/graphql-subscription-express/node_modules/function-bind/CHANGELOG.md new file mode 100644 index 0000000..f9e6cc0 --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/CHANGELOG.md @@ -0,0 +1,136 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.2](https://github.com/ljharb/function-bind/compare/v1.1.1...v1.1.2) - 2023-10-12 + +### Merged + +- Point to the correct file [`#16`](https://github.com/ljharb/function-bind/pull/16) + +### Commits + +- [Tests] migrate tests to Github Actions [`4f8b57c`](https://github.com/ljharb/function-bind/commit/4f8b57c02f2011fe9ae353d5e74e8745f0988af8) +- [Tests] remove `jscs` [`90eb2ed`](https://github.com/ljharb/function-bind/commit/90eb2edbeefd5b76cd6c3a482ea3454db169b31f) +- [meta] update `.gitignore` [`53fcdc3`](https://github.com/ljharb/function-bind/commit/53fcdc371cd66634d6e9b71c836a50f437e89fed) +- [Tests] up to `node` `v11.10`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9`; use `nvm install-latest-npm`; run audit script in tests [`1fe8f6e`](https://github.com/ljharb/function-bind/commit/1fe8f6e9aed0dfa8d8b3cdbd00c7f5ea0cd2b36e) +- [meta] add `auto-changelog` [`1921fcb`](https://github.com/ljharb/function-bind/commit/1921fcb5b416b63ffc4acad051b6aad5722f777d) +- [Robustness] remove runtime dependency on all builtins except `.apply` [`f743e61`](https://github.com/ljharb/function-bind/commit/f743e61aa6bb2360358c04d4884c9db853d118b7) +- Docs: enable badges; update wording [`503cb12`](https://github.com/ljharb/function-bind/commit/503cb12d998b5f91822776c73332c7adcd6355dd) +- [readme] update badges [`290c5db`](https://github.com/ljharb/function-bind/commit/290c5dbbbda7264efaeb886552a374b869a4bb48) +- [Tests] switch to nyc for coverage [`ea360ba`](https://github.com/ljharb/function-bind/commit/ea360ba907fc2601ed18d01a3827fa2d3533cdf8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`cae5e9e`](https://github.com/ljharb/function-bind/commit/cae5e9e07a5578dc6df26c03ee22851ce05b943c) +- [meta] add `funding` field; create FUNDING.yml [`c9f4274`](https://github.com/ljharb/function-bind/commit/c9f4274aa80ea3aae9657a3938fdba41a3b04ca6) +- [Tests] fix eslint errors from #15 [`f69aaa2`](https://github.com/ljharb/function-bind/commit/f69aaa2beb2fdab4415bfb885760a699d0b9c964) +- [actions] fix permissions [`99a0cd9`](https://github.com/ljharb/function-bind/commit/99a0cd9f3b5bac223a0d572f081834cd73314be7) +- [meta] use `npmignore` to autogenerate an npmignore file [`f03b524`](https://github.com/ljharb/function-bind/commit/f03b524ca91f75a109a5d062f029122c86ecd1ae) +- [Dev Deps] update `@ljharb/eslint‑config`, `eslint`, `tape` [`7af9300`](https://github.com/ljharb/function-bind/commit/7af930023ae2ce7645489532821e4fbbcd7a2280) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`64a9127`](https://github.com/ljharb/function-bind/commit/64a9127ab0bd331b93d6572eaf6e9971967fc08c) +- [Tests] use `aud` instead of `npm audit` [`e75069c`](https://github.com/ljharb/function-bind/commit/e75069c50010a8fcce2a9ce2324934c35fdb4386) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`d03555c`](https://github.com/ljharb/function-bind/commit/d03555ca59dea3b71ce710045e4303b9e2619e28) +- [meta] add `safe-publish-latest` [`9c8f809`](https://github.com/ljharb/function-bind/commit/9c8f8092aed027d7e80c94f517aa892385b64f09) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`baf6893`](https://github.com/ljharb/function-bind/commit/baf6893e27f5b59abe88bc1995e6f6ed1e527397) +- [meta] create SECURITY.md [`4db1779`](https://github.com/ljharb/function-bind/commit/4db17799f1f28ae294cb95e0081ca2b591c3911b) +- [Tests] add `npm run audit` [`c8b38ec`](https://github.com/ljharb/function-bind/commit/c8b38ec40ed3f85dabdee40ed4148f1748375bc2) +- Revert "Point to the correct file" [`05cdf0f`](https://github.com/ljharb/function-bind/commit/05cdf0fa205c6a3c5ba40bbedd1dfa9874f915c9) + +## [v1.1.1](https://github.com/ljharb/function-bind/compare/v1.1.0...v1.1.1) - 2017-08-28 + +### Commits + +- [Tests] up to `node` `v8`; newer npm breaks on older node; fix scripts [`817f7d2`](https://github.com/ljharb/function-bind/commit/817f7d28470fdbff8ef608d4d565dd4d1430bc5e) +- [Dev Deps] update `eslint`, `jscs`, `tape`, `@ljharb/eslint-config` [`854288b`](https://github.com/ljharb/function-bind/commit/854288b1b6f5c555f89aceb9eff1152510262084) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`83e639f`](https://github.com/ljharb/function-bind/commit/83e639ff74e6cd6921285bccec22c1bcf72311bd) +- Only apps should have lockfiles [`5ed97f5`](https://github.com/ljharb/function-bind/commit/5ed97f51235c17774e0832e122abda0f3229c908) +- Use a SPDX-compliant “license” field. [`5feefea`](https://github.com/ljharb/function-bind/commit/5feefea0dc0193993e83e5df01ded424403a5381) + +## [v1.1.0](https://github.com/ljharb/function-bind/compare/v1.0.2...v1.1.0) - 2016-02-14 + +### Commits + +- Update `eslint`, `tape`; use my personal shared `eslint` config [`9c9062a`](https://github.com/ljharb/function-bind/commit/9c9062abbe9dd70b59ea2c3a3c3a81f29b457097) +- Add `npm run eslint` [`dd96c56`](https://github.com/ljharb/function-bind/commit/dd96c56720034a3c1ffee10b8a59a6f7c53e24ad) +- [New] return the native `bind` when available. [`82186e0`](https://github.com/ljharb/function-bind/commit/82186e03d73e580f95ff167e03f3582bed90ed72) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`a3dd767`](https://github.com/ljharb/function-bind/commit/a3dd76720c795cb7f4586b0544efabf8aa107b8b) +- Update `eslint` [`3dae2f7`](https://github.com/ljharb/function-bind/commit/3dae2f7423de30a2d20313ddb1edc19660142fe9) +- Update `tape`, `covert`, `jscs` [`a181eee`](https://github.com/ljharb/function-bind/commit/a181eee0cfa24eb229c6e843a971f36e060a2f6a) +- [Tests] up to `node` `v5.6`, `v4.3` [`964929a`](https://github.com/ljharb/function-bind/commit/964929a6a4ddb36fb128de2bcc20af5e4f22e1ed) +- Test up to `io.js` `v2.1` [`2be7310`](https://github.com/ljharb/function-bind/commit/2be7310f2f74886a7124ca925be411117d41d5ea) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`45f3d68`](https://github.com/ljharb/function-bind/commit/45f3d6865c6ca93726abcef54febe009087af101) +- [Dev Deps] update `tape`, `jscs` [`6e1340d`](https://github.com/ljharb/function-bind/commit/6e1340d94642deaecad3e717825db641af4f8b1f) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`d9bad2b`](https://github.com/ljharb/function-bind/commit/d9bad2b778b1b3a6dd2876087b88b3acf319f8cc) +- Update `eslint` [`935590c`](https://github.com/ljharb/function-bind/commit/935590caa024ab356102e4858e8fc315b2ccc446) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`8c9a1ef`](https://github.com/ljharb/function-bind/commit/8c9a1efd848e5167887aa8501857a0940a480c57) +- Test on `io.js` `v2.2` [`9a3a38c`](https://github.com/ljharb/function-bind/commit/9a3a38c92013aed6e108666e7bd40969b84ac86e) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`69afc26`](https://github.com/ljharb/function-bind/commit/69afc2617405b147dd2a8d8ae73ca9e9283f18b4) +- [Dev Deps] Update `tape`, `eslint` [`36c1be0`](https://github.com/ljharb/function-bind/commit/36c1be0ab12b45fe5df6b0fdb01a5d5137fd0115) +- Update `tape`, `jscs` [`98d8303`](https://github.com/ljharb/function-bind/commit/98d8303cd5ca1c6b8f985469f86b0d44d7d45f6e) +- Update `jscs` [`9633a4e`](https://github.com/ljharb/function-bind/commit/9633a4e9fbf82051c240855166e468ba8ba0846f) +- Update `tape`, `jscs` [`c80ef0f`](https://github.com/ljharb/function-bind/commit/c80ef0f46efc9791e76fa50de4414092ac147831) +- Test up to `io.js` `v3.0` [`7e2c853`](https://github.com/ljharb/function-bind/commit/7e2c8537d52ab9cf5a655755561d8917684c0df4) +- Test on `io.js` `v2.4` [`5a199a2`](https://github.com/ljharb/function-bind/commit/5a199a27ba46795ba5eaf0845d07d4b8232895c9) +- Test on `io.js` `v2.3` [`a511b88`](https://github.com/ljharb/function-bind/commit/a511b8896de0bddf3b56862daa416c701f4d0453) +- Fixing a typo from 822b4e1938db02dc9584aa434fd3a45cb20caf43 [`732d6b6`](https://github.com/ljharb/function-bind/commit/732d6b63a9b33b45230e630dbcac7a10855d3266) +- Update `jscs` [`da52a48`](https://github.com/ljharb/function-bind/commit/da52a4886c06d6490f46ae30b15e4163ba08905d) +- Lock covert to v1.0.0. [`d6150fd`](https://github.com/ljharb/function-bind/commit/d6150fda1e6f486718ebdeff823333d9e48e7430) + +## [v1.0.2](https://github.com/ljharb/function-bind/compare/v1.0.1...v1.0.2) - 2014-10-04 + +## [v1.0.1](https://github.com/ljharb/function-bind/compare/v1.0.0...v1.0.1) - 2014-10-03 + +### Merged + +- make CI build faster [`#3`](https://github.com/ljharb/function-bind/pull/3) + +### Commits + +- Using my standard jscs.json [`d8ee94c`](https://github.com/ljharb/function-bind/commit/d8ee94c993eff0a84cf5744fe6a29627f5cffa1a) +- Adding `npm run lint` [`7571ab7`](https://github.com/ljharb/function-bind/commit/7571ab7dfdbd99b25a1dbb2d232622bd6f4f9c10) +- Using consistent indentation [`e91a1b1`](https://github.com/ljharb/function-bind/commit/e91a1b13a61e99ec1e530e299b55508f74218a95) +- Updating jscs [`7e17892`](https://github.com/ljharb/function-bind/commit/7e1789284bc629bc9c1547a61c9b227bbd8c7a65) +- Using consistent quotes [`c50b57f`](https://github.com/ljharb/function-bind/commit/c50b57fcd1c5ec38320979c837006069ebe02b77) +- Adding keywords [`cb94631`](https://github.com/ljharb/function-bind/commit/cb946314eed35f21186a25fb42fc118772f9ee00) +- Directly export a function expression instead of using a declaration, and relying on hoisting. [`5a33c5f`](https://github.com/ljharb/function-bind/commit/5a33c5f45642de180e0d207110bf7d1843ceb87c) +- Naming npm URL and badge in README; use SVG [`2aef8fc`](https://github.com/ljharb/function-bind/commit/2aef8fcb79d54e63a58ae557c4e60949e05d5e16) +- Naming deps URLs in README [`04228d7`](https://github.com/ljharb/function-bind/commit/04228d766670ee45ca24e98345c1f6a7621065b5) +- Naming travis-ci URLs in README; using SVG [`62c810c`](https://github.com/ljharb/function-bind/commit/62c810c2f54ced956cd4d4ab7b793055addfe36e) +- Make sure functions are invoked correctly (also passing coverage tests) [`2b289b4`](https://github.com/ljharb/function-bind/commit/2b289b4dfbf037ffcfa4dc95eb540f6165e9e43a) +- Removing the strict mode pragmas; they make tests fail. [`1aa701d`](https://github.com/ljharb/function-bind/commit/1aa701d199ddc3782476e8f7eef82679be97b845) +- Adding myself as a contributor [`85fd57b`](https://github.com/ljharb/function-bind/commit/85fd57b0860e5a7af42de9a287f3f265fc6d72fc) +- Adding strict mode pragmas [`915b08e`](https://github.com/ljharb/function-bind/commit/915b08e084c86a722eafe7245e21db74aa21ca4c) +- Adding devDeps URLs to README [`4ccc731`](https://github.com/ljharb/function-bind/commit/4ccc73112c1769859e4ca3076caf4086b3cba2cd) +- Fixing the description. [`a7a472c`](https://github.com/ljharb/function-bind/commit/a7a472cf649af515c635cf560fc478fbe48999c8) +- Using a function expression instead of a function declaration. [`b5d3e4e`](https://github.com/ljharb/function-bind/commit/b5d3e4ea6aaffc63888953eeb1fbc7ff45f1fa14) +- Updating tape [`f086be6`](https://github.com/ljharb/function-bind/commit/f086be6029fb56dde61a258c1340600fa174d1e0) +- Updating jscs [`5f9bdb3`](https://github.com/ljharb/function-bind/commit/5f9bdb375ab13ba48f30852aab94029520c54d71) +- Updating jscs [`9b409ba`](https://github.com/ljharb/function-bind/commit/9b409ba6118e23395a4e5d83ef39152aab9d3bfc) +- Run coverage as part of tests. [`8e1b6d4`](https://github.com/ljharb/function-bind/commit/8e1b6d459f047d1bd4fee814e01247c984c80bd0) +- Run linter as part of tests [`c1ca83f`](https://github.com/ljharb/function-bind/commit/c1ca83f832df94587d09e621beba682fabfaa987) +- Updating covert [`701e837`](https://github.com/ljharb/function-bind/commit/701e83774b57b4d3ef631e1948143f43a72f4bb9) + +## [v1.0.0](https://github.com/ljharb/function-bind/compare/v0.2.0...v1.0.0) - 2014-08-09 + +### Commits + +- Make sure old and unstable nodes don't fail Travis [`27adca3`](https://github.com/ljharb/function-bind/commit/27adca34a4ab6ad67b6dfde43942a1b103ce4d75) +- Fixing an issue when the bound function is called as a constructor in ES3. [`e20122d`](https://github.com/ljharb/function-bind/commit/e20122d267d92ce553859b280cbbea5d27c07731) +- Adding `npm run coverage` [`a2e29c4`](https://github.com/ljharb/function-bind/commit/a2e29c4ecaef9e2f6cd1603e868c139073375502) +- Updating tape [`b741168`](https://github.com/ljharb/function-bind/commit/b741168b12b235b1717ff696087645526b69213c) +- Upgrading tape [`63631a0`](https://github.com/ljharb/function-bind/commit/63631a04c7fbe97cc2fa61829cc27246d6986f74) +- Updating tape [`363cb46`](https://github.com/ljharb/function-bind/commit/363cb46dafb23cb3e347729a22f9448051d78464) + +## v0.2.0 - 2014-03-23 + +### Commits + +- Updating test coverage to match es5-shim. [`aa94d44`](https://github.com/ljharb/function-bind/commit/aa94d44b8f9d7f69f10e060db7709aa7a694e5d4) +- initial [`942ee07`](https://github.com/ljharb/function-bind/commit/942ee07e94e542d91798137bc4b80b926137e066) +- Setting the bound function's length properly. [`079f46a`](https://github.com/ljharb/function-bind/commit/079f46a2d3515b7c0b308c2c13fceb641f97ca25) +- Ensuring that some older browsers will throw when given a regex. [`36ac55b`](https://github.com/ljharb/function-bind/commit/36ac55b87f460d4330253c92870aa26fbfe8227f) +- Removing npm scripts that don't have dependencies [`9d2be60`](https://github.com/ljharb/function-bind/commit/9d2be600002cb8bc8606f8f3585ad3e05868c750) +- Updating tape [`297a4ac`](https://github.com/ljharb/function-bind/commit/297a4acc5464db381940aafb194d1c88f4e678f3) +- Skipping length tests for now. [`d9891ea`](https://github.com/ljharb/function-bind/commit/d9891ea4d2aaffa69f408339cdd61ff740f70565) +- don't take my tea [`dccd930`](https://github.com/ljharb/function-bind/commit/dccd930bfd60ea10cb178d28c97550c3bc8c1e07) diff --git a/graphql-subscription-express/node_modules/function-bind/LICENSE b/graphql-subscription-express/node_modules/function-bind/LICENSE new file mode 100644 index 0000000..62d6d23 --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/graphql-subscription-express/node_modules/function-bind/README.md b/graphql-subscription-express/node_modules/function-bind/README.md new file mode 100644 index 0000000..814c20b --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/README.md @@ -0,0 +1,46 @@ +# function-bind [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] + +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Implementation of function.prototype.bind + +Old versions of phantomjs, Internet Explorer < 9, and node < 0.6 don't support `Function.prototype.bind`. + +## Example + +```js +Function.prototype.bind = require("function-bind") +``` + +## Installation + +`npm install function-bind` + +## Contributors + + - Raynos + +## MIT Licenced + +[package-url]: https://npmjs.org/package/function-bind +[npm-version-svg]: https://versionbadg.es/Raynos/function-bind.svg +[deps-svg]: https://david-dm.org/Raynos/function-bind.svg +[deps-url]: https://david-dm.org/Raynos/function-bind +[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/function-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/function-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/function-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=function-bind +[codecov-image]: https://codecov.io/gh/Raynos/function-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/Raynos/function-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/Raynos/function-bind +[actions-url]: https://github.com/Raynos/function-bind/actions diff --git a/graphql-subscription-express/node_modules/function-bind/implementation.js b/graphql-subscription-express/node_modules/function-bind/implementation.js new file mode 100644 index 0000000..fd4384c --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/implementation.js @@ -0,0 +1,84 @@ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var toStr = Object.prototype.toString; +var max = Math.max; +var funcType = '[object Function]'; + +var concatty = function concatty(a, b) { + var arr = []; + + for (var i = 0; i < a.length; i += 1) { + arr[i] = a[i]; + } + for (var j = 0; j < b.length; j += 1) { + arr[j + a.length] = b[j]; + } + + return arr; +}; + +var slicy = function slicy(arrLike, offset) { + var arr = []; + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { + arr[j] = arrLike[i]; + } + return arr; +}; + +var joiny = function (arr, joiner) { + var str = ''; + for (var i = 0; i < arr.length; i += 1) { + str += arr[i]; + if (i + 1 < arr.length) { + str += joiner; + } + } + return str; +}; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slicy(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + concatty(args, arguments) + ); + if (Object(result) === result) { + return result; + } + return this; + } + return target.apply( + that, + concatty(args, arguments) + ); + + }; + + var boundLength = max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs[i] = '$' + i; + } + + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; diff --git a/graphql-subscription-express/node_modules/function-bind/index.js b/graphql-subscription-express/node_modules/function-bind/index.js new file mode 100644 index 0000000..3bb6b96 --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; diff --git a/graphql-subscription-express/node_modules/function-bind/package.json b/graphql-subscription-express/node_modules/function-bind/package.json new file mode 100644 index 0000000..6185963 --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/package.json @@ -0,0 +1,87 @@ +{ + "name": "function-bind", + "version": "1.1.2", + "description": "Implementation of Function.prototype.bind", + "keywords": [ + "function", + "bind", + "shim", + "es5" + ], + "author": "Raynos ", + "repository": { + "type": "git", + "url": "https://github.com/Raynos/function-bind.git" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "main": "index", + "homepage": "https://github.com/Raynos/function-bind", + "contributors": [ + { + "name": "Raynos" + }, + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "bugs": { + "url": "https://github.com/Raynos/function-bind/issues", + "email": "raynos2@gmail.com" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.3", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.1" + }, + "license": "MIT", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepack": "npmignore --auto --commentLines=autogenerated", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "lint": "eslint --ext=js,mjs .", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/graphql-subscription-express/node_modules/function-bind/test/.eslintrc b/graphql-subscription-express/node_modules/function-bind/test/.eslintrc new file mode 100644 index 0000000..8a56d5b --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/test/.eslintrc @@ -0,0 +1,9 @@ +{ + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "max-statements-per-line": [2, { "max": 2 }], + "no-invalid-this": 0, + "no-magic-numbers": 0, + } +} diff --git a/graphql-subscription-express/node_modules/function-bind/test/index.js b/graphql-subscription-express/node_modules/function-bind/test/index.js new file mode 100644 index 0000000..2edecce --- /dev/null +++ b/graphql-subscription-express/node_modules/function-bind/test/index.js @@ -0,0 +1,252 @@ +// jscs:disable requireUseStrict + +var test = require('tape'); + +var functionBind = require('../implementation'); +var getCurrentContext = function () { return this; }; + +test('functionBind is a function', function (t) { + t.equal(typeof functionBind, 'function'); + t.end(); +}); + +test('non-functions', function (t) { + var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; + t.plan(nonFunctions.length); + for (var i = 0; i < nonFunctions.length; ++i) { + try { functionBind.call(nonFunctions[i]); } catch (ex) { + t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); + } + } + t.end(); +}); + +test('without a context', function (t) { + t.test('binds properly', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }) + }; + namespace.func(1, 2, 3); + st.deepEqual(args, [1, 2, 3]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('binds properly, and still supplies bound arguments', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, undefined, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.deepEqual(args, [1, 2, 3, 4, 5, 6]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('returns properly', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('called as a constructor', function (st) { + var thunkify = function (value) { + return function () { return value; }; + }; + st.test('returns object value', function (sst) { + var expectedReturnValue = [1, 2, 3]; + var Constructor = functionBind.call(thunkify(expectedReturnValue), null); + var result = new Constructor(); + sst.equal(result, expectedReturnValue); + sst.end(); + }); + + st.test('does not return primitive value', function (sst) { + var Constructor = functionBind.call(thunkify(42), null); + var result = new Constructor(); + sst.notEqual(result, 42); + sst.end(); + }); + + st.test('object from bound constructor is instance of original and bound constructor', function (sst) { + var A = function (x) { + this.name = x || 'A'; + }; + var B = functionBind.call(A, null, 'B'); + + var result = new B(); + sst.ok(result instanceof B, 'result is instance of bound constructor'); + sst.ok(result instanceof A, 'result is instance of original constructor'); + sst.end(); + }); + + st.end(); + }); + + t.end(); +}); + +test('with a context', function (t) { + t.test('with no bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext) + }; + namespace.func(1, 2, 3); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); + st.end(); + }); + + t.test('with bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); + st.end(); + }); + + t.test('returns properly', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('passes the correct arguments when called as a constructor', function (st) { + var expected = { name: 'Correct' }; + var namespace = { + Func: functionBind.call(function (arg) { + return arg; + }, { name: 'Incorrect' }) + }; + var returned = new namespace.Func(expected); + st.equal(returned, expected, 'returns the right arg when called as a constructor'); + st.end(); + }); + + t.test('has the new instance\'s context when called as a constructor', function (st) { + var actualContext; + var expectedContext = { foo: 'bar' }; + var namespace = { + Func: functionBind.call(function () { + actualContext = this; + }, expectedContext) + }; + var result = new namespace.Func(); + st.equal(result instanceof namespace.Func, true); + st.notEqual(actualContext, expectedContext); + st.end(); + }); + + t.end(); +}); + +test('bound function length', function (t) { + t.test('sets a correct length without thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); +}); diff --git a/graphql-subscription-express/node_modules/get-intrinsic/.eslintrc b/graphql-subscription-express/node_modules/get-intrinsic/.eslintrc new file mode 100644 index 0000000..8376636 --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/.eslintrc @@ -0,0 +1,38 @@ +{ + "root": true, + + "extends": "@ljharb", + + "env": { + "es6": true, + "es2017": true, + "es2020": true, + "es2021": true, + "es2022": true, + }, + + "rules": { + "array-bracket-newline": 0, + "complexity": 0, + "eqeqeq": [2, "allow-null"], + "func-name-matching": 0, + "id-length": 0, + "max-lines": 0, + "max-lines-per-function": [2, 90], + "max-params": [2, 4], + "max-statements": 0, + "max-statements-per-line": [2, { "max": 2 }], + "multiline-comment-style": 0, + "no-magic-numbers": 0, + "sort-keys": 0, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "new-cap": 0, + }, + }, + ], +} diff --git a/graphql-subscription-express/node_modules/get-intrinsic/.github/FUNDING.yml b/graphql-subscription-express/node_modules/get-intrinsic/.github/FUNDING.yml new file mode 100644 index 0000000..8e8da0d --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/get-intrinsic +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/get-intrinsic/.nycrc b/graphql-subscription-express/node_modules/get-intrinsic/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/get-intrinsic/CHANGELOG.md b/graphql-subscription-express/node_modules/get-intrinsic/CHANGELOG.md new file mode 100644 index 0000000..96d5397 --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/CHANGELOG.md @@ -0,0 +1,143 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.4](https://github.com/ljharb/get-intrinsic/compare/v1.2.3...v1.2.4) - 2024-02-05 + +### Commits + +- [Refactor] use all 7 <+ ES6 Errors from `es-errors` [`bcac811`](https://github.com/ljharb/get-intrinsic/commit/bcac811abdc1c982e12abf848a410d6aae148d14) + +## [v1.2.3](https://github.com/ljharb/get-intrinsic/compare/v1.2.2...v1.2.3) - 2024-02-03 + +### Commits + +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`f11db9c`](https://github.com/ljharb/get-intrinsic/commit/f11db9c4fb97d87bbd53d3c73ac6b3db3613ad3b) +- [Dev Deps] update `aud`, `es-abstract`, `mock-property`, `npmignore` [`b7ac7d1`](https://github.com/ljharb/get-intrinsic/commit/b7ac7d1616fefb03877b1aed0c8f8d61aad32b6c) +- [meta] simplify `exports` [`faa0cc6`](https://github.com/ljharb/get-intrinsic/commit/faa0cc618e2830ffb51a8202490b0c215d965cbc) +- [meta] add missing `engines.node` [`774dd0b`](https://github.com/ljharb/get-intrinsic/commit/774dd0b3e8f741c3f05a6322d124d6087f146af1) +- [Dev Deps] update `tape` [`5828e8e`](https://github.com/ljharb/get-intrinsic/commit/5828e8e4a04e69312e87a36c0ea39428a7a4c3d8) +- [Robustness] use null objects for lookups [`eb9a11f`](https://github.com/ljharb/get-intrinsic/commit/eb9a11fa9eb3e13b193fcc05a7fb814341b1a7b7) +- [meta] add `sideEffects` flag [`89bcc7a`](https://github.com/ljharb/get-intrinsic/commit/89bcc7a42e19bf07b7c21e3094d5ab177109e6d2) + +## [v1.2.2](https://github.com/ljharb/get-intrinsic/compare/v1.2.1...v1.2.2) - 2023-10-20 + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `call-bind`, `es-abstract`, `mock-property`, `object-inspect`, `tape` [`f51bcf2`](https://github.com/ljharb/get-intrinsic/commit/f51bcf26412d58d17ce17c91c9afd0ad271f0762) +- [Refactor] use `hasown` instead of `has` [`18d14b7`](https://github.com/ljharb/get-intrinsic/commit/18d14b799bea6b5765e1cec91890830cbcdb0587) +- [Deps] update `function-bind` [`6e109c8`](https://github.com/ljharb/get-intrinsic/commit/6e109c81e03804cc5e7824fb64353cdc3d8ee2c7) + +## [v1.2.1](https://github.com/ljharb/get-intrinsic/compare/v1.2.0...v1.2.1) - 2023-05-13 + +### Commits + +- [Fix] avoid a crash in envs without `__proto__` [`7bad8d0`](https://github.com/ljharb/get-intrinsic/commit/7bad8d061bf8721733b58b73a2565af2b6756b64) +- [Dev Deps] update `es-abstract` [`c60e6b7`](https://github.com/ljharb/get-intrinsic/commit/c60e6b7b4cf9660c7f27ed970970fd55fac48dc5) + +## [v1.2.0](https://github.com/ljharb/get-intrinsic/compare/v1.1.3...v1.2.0) - 2023-01-19 + +### Commits + +- [actions] update checkout action [`ca6b12f`](https://github.com/ljharb/get-intrinsic/commit/ca6b12f31eaacea4ea3b055e744cd61623385ffb) +- [Dev Deps] update `@ljharb/eslint-config`, `es-abstract`, `object-inspect`, `tape` [`41a3727`](https://github.com/ljharb/get-intrinsic/commit/41a3727d0026fa04273ae216a5f8e12eefd72da8) +- [Fix] ensure `Error.prototype` is undeniable [`c511e97`](https://github.com/ljharb/get-intrinsic/commit/c511e97ae99c764c4524b540dee7a70757af8da3) +- [Dev Deps] update `aud`, `es-abstract`, `tape` [`1bef8a8`](https://github.com/ljharb/get-intrinsic/commit/1bef8a8fd439ebb80863199b6189199e0851ac67) +- [Dev Deps] update `aud`, `es-abstract` [`0d41f16`](https://github.com/ljharb/get-intrinsic/commit/0d41f16bcd500bc28b7bfc98043ebf61ea081c26) +- [New] add `BigInt64Array` and `BigUint64Array` [`a6cca25`](https://github.com/ljharb/get-intrinsic/commit/a6cca25f29635889b7e9bd669baf9e04be90e48c) +- [Tests] use `gopd` [`ecf7722`](https://github.com/ljharb/get-intrinsic/commit/ecf7722240d15cfd16edda06acf63359c10fb9bd) + +## [v1.1.3](https://github.com/ljharb/get-intrinsic/compare/v1.1.2...v1.1.3) - 2022-09-12 + +### Commits + +- [Dev Deps] update `es-abstract`, `es-value-fixtures`, `tape` [`07ff291`](https://github.com/ljharb/get-intrinsic/commit/07ff291816406ebe5a12d7f16965bde0942dd688) +- [Fix] properly check for % signs [`50ac176`](https://github.com/ljharb/get-intrinsic/commit/50ac1760fe99c227e64eabde76e9c0e44cd881b5) + +## [v1.1.2](https://github.com/ljharb/get-intrinsic/compare/v1.1.1...v1.1.2) - 2022-06-08 + +### Fixed + +- [Fix] properly validate against extra % signs [`#16`](https://github.com/ljharb/get-intrinsic/issues/16) + +### Commits + +- [actions] reuse common workflows [`0972547`](https://github.com/ljharb/get-intrinsic/commit/0972547efd0abc863fe4c445a6ca7eb4f8c6901d) +- [meta] use `npmignore` to autogenerate an npmignore file [`5ba0b51`](https://github.com/ljharb/get-intrinsic/commit/5ba0b51d8d8d4f1c31d426d74abc0770fd106bad) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`c364492`](https://github.com/ljharb/get-intrinsic/commit/c364492af4af51333e6f81c0bf21fd3d602c3661) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `es-abstract`, `object-inspect`, `tape` [`dc04dad`](https://github.com/ljharb/get-intrinsic/commit/dc04dad86f6e5608775a2640cb0db5927ae29ed9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `es-abstract`, `object-inspect`, `safe-publish-latest`, `tape` [`1c14059`](https://github.com/ljharb/get-intrinsic/commit/1c1405984e86dd2dc9366c15d8a0294a96a146a5) +- [Tests] use `mock-property` [`b396ef0`](https://github.com/ljharb/get-intrinsic/commit/b396ef05bb73b1d699811abd64b0d9b97997fdda) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`c2c758d`](https://github.com/ljharb/get-intrinsic/commit/c2c758d3b90af4fef0a76910d8d3c292ec8d1d3e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es-abstract`, `es-value-fixtures`, `object-inspect`, `tape` [`29e3c09`](https://github.com/ljharb/get-intrinsic/commit/29e3c091c2bf3e17099969847e8729d0e46896de) +- [actions] update codecov uploader [`8cbc141`](https://github.com/ljharb/get-intrinsic/commit/8cbc1418940d7a8941f3a7985cbc4ac095c5e13d) +- [Dev Deps] update `@ljharb/eslint-config`, `es-abstract`, `es-value-fixtures`, `object-inspect`, `tape` [`10b6f5c`](https://github.com/ljharb/get-intrinsic/commit/10b6f5c02593fb3680c581d696ac124e30652932) +- [readme] add github actions/codecov badges [`4e25400`](https://github.com/ljharb/get-intrinsic/commit/4e25400d9f51ae9eb059cbe22d9144e70ea214e8) +- [Tests] use `for-each` instead of `foreach` [`c05b957`](https://github.com/ljharb/get-intrinsic/commit/c05b957ad9a7bc7721af7cc9e9be1edbfe057496) +- [Dev Deps] update `es-abstract` [`29b05ae`](https://github.com/ljharb/get-intrinsic/commit/29b05aec3e7330e9ad0b8e0f685a9112c20cdd97) +- [meta] use `prepublishOnly` script for npm 7+ [`95c285d`](https://github.com/ljharb/get-intrinsic/commit/95c285da810516057d3bbfa871176031af38f05d) +- [Deps] update `has-symbols` [`593cb4f`](https://github.com/ljharb/get-intrinsic/commit/593cb4fb38e7922e40e42c183f45274b636424cd) +- [readme] fix repo URLs [`1c8305b`](https://github.com/ljharb/get-intrinsic/commit/1c8305b5365827c9b6fc785434aac0e1328ff2f5) +- [Deps] update `has-symbols` [`c7138b6`](https://github.com/ljharb/get-intrinsic/commit/c7138b6c6d73132d859471fb8c13304e1e7c8b20) +- [Dev Deps] remove unused `has-bigints` [`bd63aff`](https://github.com/ljharb/get-intrinsic/commit/bd63aff6ad8f3a986c557fcda2914187bdaab359) + +## [v1.1.1](https://github.com/ljharb/get-intrinsic/compare/v1.1.0...v1.1.1) - 2021-02-03 + +### Fixed + +- [meta] export `./package.json` [`#9`](https://github.com/ljharb/get-intrinsic/issues/9) + +### Commits + +- [readme] flesh out the readme; use `evalmd` [`d12f12c`](https://github.com/ljharb/get-intrinsic/commit/d12f12c15345a0a0772cc65a7c64369529abd614) +- [eslint] set up proper globals config [`5a8c098`](https://github.com/ljharb/get-intrinsic/commit/5a8c0984e3319d1ac0e64b102f8ec18b64e79f36) +- [Dev Deps] update `eslint` [`7b9a5c0`](https://github.com/ljharb/get-intrinsic/commit/7b9a5c0d31a90ca1a1234181c74988fb046701cd) + +## [v1.1.0](https://github.com/ljharb/get-intrinsic/compare/v1.0.2...v1.1.0) - 2021-01-25 + +### Fixed + +- [Refactor] delay `Function` eval until syntax-derived values are requested [`#3`](https://github.com/ljharb/get-intrinsic/issues/3) + +### Commits + +- [Tests] migrate tests to Github Actions [`2ab762b`](https://github.com/ljharb/get-intrinsic/commit/2ab762b48164aea8af37a40ba105bbc8246ab8c4) +- [meta] do not publish github action workflow files [`5e7108e`](https://github.com/ljharb/get-intrinsic/commit/5e7108e4768b244d48d9567ba4f8a6cab9c65b8e) +- [Tests] add some coverage [`01ac7a8`](https://github.com/ljharb/get-intrinsic/commit/01ac7a87ac29738567e8524cd8c9e026b1fa8cb3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `call-bind`, `es-abstract`, `tape`; add `call-bind` [`911b672`](https://github.com/ljharb/get-intrinsic/commit/911b672fbffae433a96924c6ce013585e425f4b7) +- [Refactor] rearrange evalled constructors a bit [`7e7e4bf`](https://github.com/ljharb/get-intrinsic/commit/7e7e4bf583f3799c8ac1c6c5e10d2cb553957347) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`0199968`](https://github.com/ljharb/get-intrinsic/commit/01999687a263ffce0a3cb011dfbcb761754aedbc) + +## [v1.0.2](https://github.com/ljharb/get-intrinsic/compare/v1.0.1...v1.0.2) - 2020-12-17 + +### Commits + +- [Fix] Throw for non‑existent intrinsics [`68f873b`](https://github.com/ljharb/get-intrinsic/commit/68f873b013c732a05ad6f5fc54f697e55515461b) +- [Fix] Throw for non‑existent segments in the intrinsic path [`8325dee`](https://github.com/ljharb/get-intrinsic/commit/8325deee43128f3654d3399aa9591741ebe17b21) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-bigints`, `object-inspect` [`0c227a7`](https://github.com/ljharb/get-intrinsic/commit/0c227a7d8b629166f25715fd242553892e458525) +- [meta] do not lint coverage output [`70d2419`](https://github.com/ljharb/get-intrinsic/commit/70d24199b620043cd9110fc5f426d214ebe21dc9) + +## [v1.0.1](https://github.com/ljharb/get-intrinsic/compare/v1.0.0...v1.0.1) - 2020-10-30 + +### Commits + +- [Tests] gather coverage data on every job [`d1d280d`](https://github.com/ljharb/get-intrinsic/commit/d1d280dec714e3f0519cc877dbcb193057d9cac6) +- [Fix] add missing dependencies [`5031771`](https://github.com/ljharb/get-intrinsic/commit/5031771bb1095b38be88ce7c41d5de88718e432e) +- [Tests] use `es-value-fixtures` [`af48765`](https://github.com/ljharb/get-intrinsic/commit/af48765a23c5323fb0b6b38dbf00eb5099c7bebc) + +## v1.0.0 - 2020-10-29 + +### Commits + +- Implementation [`bbce57c`](https://github.com/ljharb/get-intrinsic/commit/bbce57c6f33d05b2d8d3efa273ceeb3ee01127bb) +- Tests [`17b4f0d`](https://github.com/ljharb/get-intrinsic/commit/17b4f0d56dea6b4059b56fc30ef3ee4d9500ebc2) +- Initial commit [`3153294`](https://github.com/ljharb/get-intrinsic/commit/31532948de363b0a27dd9fd4649e7b7028ec4b44) +- npm init [`fb326c4`](https://github.com/ljharb/get-intrinsic/commit/fb326c4d2817c8419ec31de1295f06bb268a7902) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`48862fb`](https://github.com/ljharb/get-intrinsic/commit/48862fb2508c8f6a57968e6d08b7c883afc9d550) +- [meta] add `auto-changelog` [`5f28ad0`](https://github.com/ljharb/get-intrinsic/commit/5f28ad019e060a353d8028f9f2591a9cc93074a1) +- [meta] add "funding"; create `FUNDING.yml` [`c2bbdde`](https://github.com/ljharb/get-intrinsic/commit/c2bbddeba73a875be61484ee4680b129a6d4e0a1) +- [Tests] add `npm run lint` [`0a84b98`](https://github.com/ljharb/get-intrinsic/commit/0a84b98b22b7cf7a748666f705b0003a493c35fd) +- Only apps should have lockfiles [`9586c75`](https://github.com/ljharb/get-intrinsic/commit/9586c75866c1ee678e4d5d4dbbdef6997e511b05) diff --git a/graphql-subscription-express/node_modules/get-intrinsic/LICENSE b/graphql-subscription-express/node_modules/get-intrinsic/LICENSE new file mode 100644 index 0000000..48f05d0 --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/get-intrinsic/README.md b/graphql-subscription-express/node_modules/get-intrinsic/README.md new file mode 100644 index 0000000..3aa0bba --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/README.md @@ -0,0 +1,71 @@ +# get-intrinsic [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Get and robustly cache all JS language-level intrinsics at first require time. + +See the syntax described [in the JS spec](https://tc39.es/ecma262/#sec-well-known-intrinsic-objects) for reference. + +## Example + +```js +var GetIntrinsic = require('get-intrinsic'); +var assert = require('assert'); + +// static methods +assert.equal(GetIntrinsic('%Math.pow%'), Math.pow); +assert.equal(Math.pow(2, 3), 8); +assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); +delete Math.pow; +assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); + +// instance methods +var arr = [1]; +assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push); +assert.deepEqual(arr, [1]); + +arr.push(2); +assert.deepEqual(arr, [1, 2]); + +GetIntrinsic('%Array.prototype.push%').call(arr, 3); +assert.deepEqual(arr, [1, 2, 3]); + +delete Array.prototype.push; +GetIntrinsic('%Array.prototype.push%').call(arr, 4); +assert.deepEqual(arr, [1, 2, 3, 4]); + +// missing features +delete JSON.parse; // to simulate a real intrinsic that is missing in the environment +assert.throws(() => GetIntrinsic('%JSON.parse%')); +assert.equal(undefined, GetIntrinsic('%JSON.parse%', true)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/get-intrinsic +[npm-version-svg]: https://versionbadg.es/ljharb/get-intrinsic.svg +[deps-svg]: https://david-dm.org/ljharb/get-intrinsic.svg +[deps-url]: https://david-dm.org/ljharb/get-intrinsic +[dev-deps-svg]: https://david-dm.org/ljharb/get-intrinsic/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/get-intrinsic#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/get-intrinsic.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/get-intrinsic.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/get-intrinsic.svg +[downloads-url]: https://npm-stat.com/charts.html?package=get-intrinsic +[codecov-image]: https://codecov.io/gh/ljharb/get-intrinsic/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/get-intrinsic/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/get-intrinsic +[actions-url]: https://github.com/ljharb/get-intrinsic/actions diff --git a/graphql-subscription-express/node_modules/get-intrinsic/index.js b/graphql-subscription-express/node_modules/get-intrinsic/index.js new file mode 100644 index 0000000..c25e2c4 --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/index.js @@ -0,0 +1,359 @@ +'use strict'; + +var undefined; + +var $Error = require('es-errors'); +var $EvalError = require('es-errors/eval'); +var $RangeError = require('es-errors/range'); +var $ReferenceError = require('es-errors/ref'); +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); +var $URIError = require('es-errors/uri'); + +var $Function = Function; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = Object.getOwnPropertyDescriptor; +if ($gOPD) { + try { + $gOPD({}, ''); + } catch (e) { + $gOPD = null; // this is IE 8, which has a broken gOPD + } +} + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = require('has-symbols')(); +var hasProto = require('has-proto')(); + +var getProto = Object.getPrototypeOf || ( + hasProto + ? function (x) { return x.__proto__; } // eslint-disable-line no-proto + : null +); + +var needsEval = {}; + +var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + __proto__: null, + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': needsEval, + '%AsyncGenerator%': needsEval, + '%AsyncGeneratorFunction%': needsEval, + '%AsyncIteratorPrototype%': needsEval, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, + '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': $Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': $EvalError, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': needsEval, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': Object, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': $RangeError, + '%ReferenceError%': $ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': $URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet +}; + +if (getProto) { + try { + null.error; // eslint-disable-line no-unused-expressions + } catch (e) { + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 + var errorProto = getProto(getProto(e)); + INTRINSICS['%Error.prototype%'] = errorProto; + } +} + +var doEval = function doEval(name) { + var value; + if (name === '%AsyncFunction%') { + value = getEvalledConstructor('async function () {}'); + } else if (name === '%GeneratorFunction%') { + value = getEvalledConstructor('function* () {}'); + } else if (name === '%AsyncGeneratorFunction%') { + value = getEvalledConstructor('async function* () {}'); + } else if (name === '%AsyncGenerator%') { + var fn = doEval('%AsyncGeneratorFunction%'); + if (fn) { + value = fn.prototype; + } + } else if (name === '%AsyncIteratorPrototype%') { + var gen = doEval('%AsyncGenerator%'); + if (gen && getProto) { + value = getProto(gen.prototype); + } + } + + INTRINSICS[name] = value; + + return value; +}; + +var LEGACY_ALIASES = { + __proto__: null, + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'] +}; + +var bind = require('function-bind'); +var hasOwn = require('hasown'); +var $concat = bind.call(Function.call, Array.prototype.concat); +var $spliceApply = bind.call(Function.apply, Array.prototype.splice); +var $replace = bind.call(Function.call, String.prototype.replace); +var $strSlice = bind.call(Function.call, String.prototype.slice); +var $exec = bind.call(Function.call, RegExp.prototype.exec); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === '%' && last !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); + } else if (last === '%' && first !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); + } + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + if ($exec(/^%?[^%]*%?$/, name) === null) { + throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); + } + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ( + ( + (first === '"' || first === "'" || first === '`') + || (last === '"' || last === "'" || last === '`') + ) + && first !== last + ) { + throw new $SyntaxError('property names with quotes must have matching quotes'); + } + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + return void undefined; + } + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; diff --git a/graphql-subscription-express/node_modules/get-intrinsic/package.json b/graphql-subscription-express/node_modules/get-intrinsic/package.json new file mode 100644 index 0000000..568dff9 --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/package.json @@ -0,0 +1,93 @@ +{ + "name": "get-intrinsic", + "version": "1.2.4", + "description": "Get and robustly cache all JS language-level intrinsics at first require time", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=.js,.mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/get-intrinsic.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "es", + "js", + "intrinsic", + "getintrinsic", + "es-abstract" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/get-intrinsic/issues" + }, + "homepage": "https://github.com/ljharb/get-intrinsic#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "call-bind": "^1.0.5", + "es-abstract": "^1.22.3", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "make-async-function": "^1.0.0", + "make-async-generator-function": "^1.0.0", + "make-generator-function": "^2.0.0", + "mock-property": "^1.0.3", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "testling": { + "files": "test/GetIntrinsic.js" + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/graphql-subscription-express/node_modules/get-intrinsic/test/GetIntrinsic.js b/graphql-subscription-express/node_modules/get-intrinsic/test/GetIntrinsic.js new file mode 100644 index 0000000..1cc08e0 --- /dev/null +++ b/graphql-subscription-express/node_modules/get-intrinsic/test/GetIntrinsic.js @@ -0,0 +1,274 @@ +'use strict'; + +var GetIntrinsic = require('../'); + +var test = require('tape'); +var forEach = require('for-each'); +var debug = require('object-inspect'); +var generatorFns = require('make-generator-function')(); +var asyncFns = require('make-async-function').list(); +var asyncGenFns = require('make-async-generator-function')(); +var mockProperty = require('mock-property'); + +var callBound = require('call-bind/callBound'); +var v = require('es-value-fixtures'); +var $gOPD = require('gopd'); +var DefinePropertyOrThrow = require('es-abstract/2021/DefinePropertyOrThrow'); + +var $isProto = callBound('%Object.prototype.isPrototypeOf%'); + +test('export', function (t) { + t.equal(typeof GetIntrinsic, 'function', 'it is a function'); + t.equal(GetIntrinsic.length, 2, 'function has length of 2'); + + t.end(); +}); + +test('throws', function (t) { + t['throws']( + function () { GetIntrinsic('not an intrinsic'); }, + SyntaxError, + 'nonexistent intrinsic throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic(''); }, + TypeError, + 'empty string intrinsic throws a type error' + ); + + t['throws']( + function () { GetIntrinsic('.'); }, + SyntaxError, + '"just a dot" intrinsic throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic('%String'); }, + SyntaxError, + 'Leading % without trailing % throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic('String%'); }, + SyntaxError, + 'Trailing % without leading % throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic("String['prototype]"); }, + SyntaxError, + 'Dynamic property access is disallowed for intrinsics (unterminated string)' + ); + + t['throws']( + function () { GetIntrinsic('%Proxy.prototype.undefined%'); }, + TypeError, + "Throws when middle part doesn't exist (%Proxy.prototype.undefined%)" + ); + + t['throws']( + function () { GetIntrinsic('%Array.prototype%garbage%'); }, + SyntaxError, + 'Throws with extra percent signs' + ); + + t['throws']( + function () { GetIntrinsic('%Array.prototype%push%'); }, + SyntaxError, + 'Throws with extra percent signs, even on an existing intrinsic' + ); + + forEach(v.nonStrings, function (nonString) { + t['throws']( + function () { GetIntrinsic(nonString); }, + TypeError, + debug(nonString) + ' is not a String' + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { GetIntrinsic('%', nonBoolean); }, + TypeError, + debug(nonBoolean) + ' is not a Boolean' + ); + }); + + forEach([ + 'toString', + 'propertyIsEnumerable', + 'hasOwnProperty' + ], function (objectProtoMember) { + t['throws']( + function () { GetIntrinsic(objectProtoMember); }, + SyntaxError, + debug(objectProtoMember) + ' is not an intrinsic' + ); + }); + + t.end(); +}); + +test('base intrinsics', function (t) { + t.equal(GetIntrinsic('%Object%'), Object, '%Object% yields Object'); + t.equal(GetIntrinsic('Object'), Object, 'Object yields Object'); + t.equal(GetIntrinsic('%Array%'), Array, '%Array% yields Array'); + t.equal(GetIntrinsic('Array'), Array, 'Array yields Array'); + + t.end(); +}); + +test('dotted paths', function (t) { + t.equal(GetIntrinsic('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% yields Object.prototype.toString'); + t.equal(GetIntrinsic('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString yields Object.prototype.toString'); + t.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push, '%Array.prototype.push% yields Array.prototype.push'); + t.equal(GetIntrinsic('Array.prototype.push'), Array.prototype.push, 'Array.prototype.push yields Array.prototype.push'); + + test('underscore paths are aliases for dotted paths', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { + var original = GetIntrinsic('%ObjProto_toString%'); + + forEach([ + '%Object.prototype.toString%', + 'Object.prototype.toString', + '%ObjectPrototype.toString%', + 'ObjectPrototype.toString', + '%ObjProto_toString%', + 'ObjProto_toString' + ], function (name) { + DefinePropertyOrThrow(Object.prototype, 'toString', { + '[[Value]]': function toString() { + return original.apply(this, arguments); + } + }); + st.equal(GetIntrinsic(name), original, name + ' yields original Object.prototype.toString'); + }); + + DefinePropertyOrThrow(Object.prototype, 'toString', { '[[Value]]': original }); + st.end(); + }); + + test('dotted paths cache', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { + var original = GetIntrinsic('%Object.prototype.propertyIsEnumerable%'); + + forEach([ + '%Object.prototype.propertyIsEnumerable%', + 'Object.prototype.propertyIsEnumerable', + '%ObjectPrototype.propertyIsEnumerable%', + 'ObjectPrototype.propertyIsEnumerable' + ], function (name) { + var restore = mockProperty(Object.prototype, 'propertyIsEnumerable', { + value: function propertyIsEnumerable() { + return original.apply(this, arguments); + } + }); + st.equal(GetIntrinsic(name), original, name + ' yields cached Object.prototype.propertyIsEnumerable'); + + restore(); + }); + + st.end(); + }); + + test('dotted path reports correct error', function (st) { + st['throws'](function () { + GetIntrinsic('%NonExistentIntrinsic.prototype.property%'); + }, /%NonExistentIntrinsic%/, 'The base intrinsic of %NonExistentIntrinsic.prototype.property% is %NonExistentIntrinsic%'); + + st['throws'](function () { + GetIntrinsic('%NonExistentIntrinsicPrototype.property%'); + }, /%NonExistentIntrinsicPrototype%/, 'The base intrinsic of %NonExistentIntrinsicPrototype.property% is %NonExistentIntrinsicPrototype%'); + + st.end(); + }); + + t.end(); +}); + +test('accessors', { skip: !$gOPD || typeof Map !== 'function' }, function (t) { + var actual = $gOPD(Map.prototype, 'size'); + t.ok(actual, 'Map.prototype.size has a descriptor'); + t.equal(typeof actual.get, 'function', 'Map.prototype.size has a getter function'); + t.equal(GetIntrinsic('%Map.prototype.size%'), actual.get, '%Map.prototype.size% yields the getter for it'); + t.equal(GetIntrinsic('Map.prototype.size'), actual.get, 'Map.prototype.size yields the getter for it'); + + t.end(); +}); + +test('generator functions', { skip: !generatorFns.length }, function (t) { + var $GeneratorFunction = GetIntrinsic('%GeneratorFunction%'); + var $GeneratorFunctionPrototype = GetIntrinsic('%Generator%'); + var $GeneratorPrototype = GetIntrinsic('%GeneratorPrototype%'); + + forEach(generatorFns, function (genFn) { + var fnName = genFn.name; + fnName = fnName ? "'" + fnName + "'" : 'genFn'; + + t.ok(genFn instanceof $GeneratorFunction, fnName + ' instanceof %GeneratorFunction%'); + t.ok($isProto($GeneratorFunctionPrototype, genFn), '%Generator% is prototype of ' + fnName); + t.ok($isProto($GeneratorPrototype, genFn.prototype), '%GeneratorPrototype% is prototype of ' + fnName + '.prototype'); + }); + + t.end(); +}); + +test('async functions', { skip: !asyncFns.length }, function (t) { + var $AsyncFunction = GetIntrinsic('%AsyncFunction%'); + var $AsyncFunctionPrototype = GetIntrinsic('%AsyncFunctionPrototype%'); + + forEach(asyncFns, function (asyncFn) { + var fnName = asyncFn.name; + fnName = fnName ? "'" + fnName + "'" : 'asyncFn'; + + t.ok(asyncFn instanceof $AsyncFunction, fnName + ' instanceof %AsyncFunction%'); + t.ok($isProto($AsyncFunctionPrototype, asyncFn), '%AsyncFunctionPrototype% is prototype of ' + fnName); + }); + + t.end(); +}); + +test('async generator functions', { skip: asyncGenFns.length === 0 }, function (t) { + var $AsyncGeneratorFunction = GetIntrinsic('%AsyncGeneratorFunction%'); + var $AsyncGeneratorFunctionPrototype = GetIntrinsic('%AsyncGenerator%'); + var $AsyncGeneratorPrototype = GetIntrinsic('%AsyncGeneratorPrototype%'); + + forEach(asyncGenFns, function (asyncGenFn) { + var fnName = asyncGenFn.name; + fnName = fnName ? "'" + fnName + "'" : 'asyncGenFn'; + + t.ok(asyncGenFn instanceof $AsyncGeneratorFunction, fnName + ' instanceof %AsyncGeneratorFunction%'); + t.ok($isProto($AsyncGeneratorFunctionPrototype, asyncGenFn), '%AsyncGenerator% is prototype of ' + fnName); + t.ok($isProto($AsyncGeneratorPrototype, asyncGenFn.prototype), '%AsyncGeneratorPrototype% is prototype of ' + fnName + '.prototype'); + }); + + t.end(); +}); + +test('%ThrowTypeError%', function (t) { + var $ThrowTypeError = GetIntrinsic('%ThrowTypeError%'); + + t.equal(typeof $ThrowTypeError, 'function', 'is a function'); + t['throws']( + $ThrowTypeError, + TypeError, + '%ThrowTypeError% throws a TypeError' + ); + + t.end(); +}); + +test('allowMissing', { skip: asyncGenFns.length > 0 }, function (t) { + t['throws']( + function () { GetIntrinsic('%AsyncGeneratorPrototype%'); }, + TypeError, + 'throws when missing' + ); + + t.equal( + GetIntrinsic('%AsyncGeneratorPrototype%', true), + undefined, + 'does not throw when allowMissing' + ); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/gopd/.eslintrc b/graphql-subscription-express/node_modules/gopd/.eslintrc new file mode 100644 index 0000000..e2550c0 --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-style": [2, "declaration"], + "id-length": 0, + "multiline-comment-style": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/graphql-subscription-express/node_modules/gopd/.github/FUNDING.yml b/graphql-subscription-express/node_modules/gopd/.github/FUNDING.yml new file mode 100644 index 0000000..94a44a8 --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/gopd +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/gopd/CHANGELOG.md b/graphql-subscription-express/node_modules/gopd/CHANGELOG.md new file mode 100644 index 0000000..f111eb1 --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.1](https://github.com/ljharb/gopd/compare/v1.0.0...v1.0.1) - 2022-11-01 + +### Commits + +- [Fix] actually export gOPD instead of dP [`4b624bf`](https://github.com/ljharb/gopd/commit/4b624bfbeff788c5e3ff16d9443a83627847234f) + +## v1.0.0 - 2022-11-01 + +### Commits + +- Initial implementation, tests, readme [`0911e01`](https://github.com/ljharb/gopd/commit/0911e012cd642092bd88b732c161c58bf4f20bea) +- Initial commit [`b84e33f`](https://github.com/ljharb/gopd/commit/b84e33f5808a805ac57ff88d4247ad935569acbe) +- [actions] add reusable workflows [`12ae28a`](https://github.com/ljharb/gopd/commit/12ae28ae5f50f86e750215b6e2188901646d0119) +- npm init [`280118b`](https://github.com/ljharb/gopd/commit/280118badb45c80b4483836b5cb5315bddf6e582) +- [meta] add `auto-changelog` [`bb78de5`](https://github.com/ljharb/gopd/commit/bb78de5639a180747fb290c28912beaaf1615709) +- [meta] create FUNDING.yml; add `funding` in package.json [`11c22e6`](https://github.com/ljharb/gopd/commit/11c22e6355bb01f24e7fac4c9bb3055eb5b25002) +- [meta] use `npmignore` to autogenerate an npmignore file [`4f4537a`](https://github.com/ljharb/gopd/commit/4f4537a843b39f698c52f072845092e6fca345bb) +- Only apps should have lockfiles [`c567022`](https://github.com/ljharb/gopd/commit/c567022a18573aa7951cf5399445d9840e23e98b) diff --git a/graphql-subscription-express/node_modules/gopd/LICENSE b/graphql-subscription-express/node_modules/gopd/LICENSE new file mode 100644 index 0000000..6abfe14 --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/gopd/README.md b/graphql-subscription-express/node_modules/gopd/README.md new file mode 100644 index 0000000..784e56a --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/README.md @@ -0,0 +1,40 @@ +# gopd [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation. + +## Usage + +```javascript +var gOPD = require('gopd'); +var assert = require('assert'); + +if (gOPD) { + assert.equal(typeof gOPD, 'function', 'descriptors supported'); + // use gOPD like Object.getOwnPropertyDescriptor here +} else { + assert.ok(!gOPD, 'descriptors not supported'); +} +``` + +[package-url]: https://npmjs.org/package/gopd +[npm-version-svg]: https://versionbadg.es/ljharb/gopd.svg +[deps-svg]: https://david-dm.org/ljharb/gopd.svg +[deps-url]: https://david-dm.org/ljharb/gopd +[dev-deps-svg]: https://david-dm.org/ljharb/gopd/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/gopd#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/gopd.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/gopd.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/gopd.svg +[downloads-url]: https://npm-stat.com/charts.html?package=gopd +[codecov-image]: https://codecov.io/gh/ljharb/gopd/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/gopd/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/gopd +[actions-url]: https://github.com/ljharb/gopd/actions diff --git a/graphql-subscription-express/node_modules/gopd/index.js b/graphql-subscription-express/node_modules/gopd/index.js new file mode 100644 index 0000000..fb6d3bb --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/index.js @@ -0,0 +1,16 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; diff --git a/graphql-subscription-express/node_modules/gopd/package.json b/graphql-subscription-express/node_modules/gopd/package.json new file mode 100644 index 0000000..d5e1fa4 --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/package.json @@ -0,0 +1,71 @@ +{ + "name": "gopd", + "version": "1.0.1", + "description": "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "evalmd README.md", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/gopd.git" + }, + "keywords": [ + "ecmascript", + "javascript", + "getownpropertydescriptor", + "property", + "descriptor" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/gopd/issues" + }, + "homepage": "https://github.com/ljharb/gopd#readme", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.1", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/graphql-subscription-express/node_modules/gopd/test/index.js b/graphql-subscription-express/node_modules/gopd/test/index.js new file mode 100644 index 0000000..0376bfb --- /dev/null +++ b/graphql-subscription-express/node_modules/gopd/test/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var test = require('tape'); +var gOPD = require('../'); + +test('gOPD', function (t) { + t.test('supported', { skip: !gOPD }, function (st) { + st.equal(typeof gOPD, 'function', 'is a function'); + + var obj = { x: 1 }; + st.ok('x' in obj, 'property exists'); + + var desc = gOPD(obj, 'x'); + st.deepEqual( + desc, + { + configurable: true, + enumerable: true, + value: 1, + writable: true + }, + 'descriptor is as expected' + ); + + st.end(); + }); + + t.test('not supported', { skip: gOPD }, function (st) { + st.notOk(gOPD, 'is falsy'); + + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/graphql-ws/LICENSE.md b/graphql-subscription-express/node_modules/graphql-ws/LICENSE.md new file mode 100644 index 0000000..8920ca2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/LICENSE.md @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2020-2021 Denis Badurina + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/graphql-ws/PROTOCOL.md b/graphql-subscription-express/node_modules/graphql-ws/PROTOCOL.md new file mode 100644 index 0000000..ca70a78 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/PROTOCOL.md @@ -0,0 +1,251 @@ +# GraphQL over WebSocket Protocol + +## Nomenclature + +- **Socket** is the main WebSocket communication channel between the _server_ and the _client_ +- **Connection** is a connection **within the established socket** describing a "connection" through which the operation requests will be communicated + +## Communication + +The WebSocket sub-protocol for this specification is: `graphql-transport-ws`. + +Messages are represented through the JSON structure and are stringified before being sent over the network. They are bidirectional, meaning both the server and the client must conform to the specified message structure. + +**All** messages contain the `type` field outlining the action this message describes. + +Messages corresponding to operations must contain the `id` field used for uniquely identifying server responses and connecting them with the client's requests. + +Multiple operations identified with separate IDs can be active at any time and their messages can be interleaved on the connection. + +The server can close the socket (kick the client off) at any time. The close event dispatched by the server is used to describe the fatal error to the client. + +The client closes the socket and the connection by dispatching a `1000: Normal Closure` close event to the server indicating a normal closure. + +## Message types + +### `ConnectionInit` + +Direction: **Client -> Server** + +Indicates that the client wants to establish a connection within the existing socket. This connection is **not** the actual WebSocket communication channel, but is rather a frame within it asking the server to allow future operation requests. + +The server must receive the connection initialisation message within the allowed waiting time specified in the `connectionInitWaitTimeout` parameter during the server setup. If the client does not request a connection within the allowed timeout, the server will close the socket with the event: `4408: Connection initialisation timeout`. + +If the server receives more than one `ConnectionInit` message at any given time, the server will close the socket with the event `4429: Too many initialisation requests`. + +If the server wishes to reject the connection, for example during authentication, it is recommended to close the socket with `4403: Forbidden`. + +```typescript +interface ConnectionInitMessage { + type: 'connection_init'; + payload?: Record | null; +} +``` + +### `ConnectionAck` + +Direction: **Server -> Client** + +Expected response to the `ConnectionInit` message from the client acknowledging a successful connection with the server. + +The server can use the optional `payload` field to transfer additional details about the connection. + +```typescript +interface ConnectionAckMessage { + type: 'connection_ack'; + payload?: Record | null; +} +``` + +The client is now **ready** to request subscription operations. + +### `Ping` + +Direction: **bidirectional** + +Useful for detecting failed connections, displaying latency metrics or other types of network probing. + +A `Pong` must be sent in response from the receiving party as soon as possible. + +The `Ping` message can be sent at any time within the established socket. + +The optional `payload` field can be used to transfer additional details about the ping. + +```typescript +interface PingMessage { + type: 'ping'; + payload?: Record | null; +} +``` + +### `Pong` + +Direction: **bidirectional** + +The response to the `Ping` message. Must be sent as soon as the `Ping` message is received. + +The `Pong` message can be sent at any time within the established socket. Furthermore, the `Pong` message may even be sent unsolicited as an unidirectional heartbeat. + +The optional `payload` field can be used to transfer additional details about the pong. + +```typescript +interface PongMessage { + type: 'pong'; + payload?: Record | null; +} +``` + +### `Subscribe` + +Direction: **Client -> Server** + +Requests an operation specified in the message `payload`. This message provides a unique ID field to connect published messages to the operation requested by this message. + +If there is already an active subscriber for an operation matching the provided ID, regardless of the operation type, the server **must** close the socket immediately with the event `4409: Subscriber for already exists`. + +The server needs only keep track of IDs for as long as the subscription is active. Once a client completes an operation, it is free to re-use that ID. + +```typescript +interface SubscribeMessage { + id: ''; + type: 'subscribe'; + payload: { + operationName?: string | null; + query: string; + variables?: Record | null; + extensions?: Record | null; + }; +} +``` + +Executing operations is allowed **only** after the server has acknowledged the connection through the `ConnectionAck` message, if the connection is not acknowledged, the socket will be closed immediately with the event `4401: Unauthorized`. + +### `Next` + +Direction: **Server -> Client** + +Operation execution result(s) from the source stream created by the binding `Subscribe` message. After all results have been emitted, the `Complete` message will follow indicating stream completion. + +```typescript +import { ExecutionResult } from 'graphql'; + +interface NextMessage { + id: ''; + type: 'next'; + payload: ExecutionResult; +} +``` + +### `Error` + +Direction: **Server -> Client** + +Operation execution error(s) in response to the `Subscribe` message. This can occur _before_ execution starts, usually due to validation errors, or _during_ the execution of the request. This message terminates the operation and no further messages will be sent. + +```typescript +import { GraphQLError } from 'graphql'; + +interface ErrorMessage { + id: ''; + type: 'error'; + payload: GraphQLError[]; +} +``` + +### `Complete` + +Direction: **bidirectional** + +- **Server -> Client** indicates that the requested operation execution has completed. If the server dispatched the `Error` message relative to the original `Subscribe` message, no `Complete` message will be emitted. + +- **Client -> Server** indicates that the client has stopped listening and wants to complete the subscription. No further events, relevant to the original subscription, should be sent through. Even if the client sent a `Complete` message for a _single-result-operation_ before it resolved, the result should not be sent through once it does. + +Note: The asynchronous nature of the full-duplex connection means that a client can send a `Complete` message to the server even when messages are in-flight to the client, or when the server has itself completed the operation (via a `Error` or `Complete` message). Both client and server must therefore be prepared to receive (and ignore) messages for operations that they consider already completed. + +```typescript +interface CompleteMessage { + id: ''; + type: 'complete'; +} +``` + +### Invalid message + +Direction: **bidirectional** + +Receiving a message of a type or format which is not specified in this document will result in an **immediate** socket closure with the event `4400: `. The `` can be vaguely descriptive on why the received message is invalid. + +Receiving a message (other than `Subscribe`) with an ID that belongs to an operation that has been previously completed does not constitute an error. It is permissable to simply ignore all _unknown_ IDs without closing the connection. + +## Examples + +For the sake of clarity, the following examples demonstrate the communication protocol. + +

Successful connection initialisation

+ +1. _Client_ sends a WebSocket handshake request with the sub-protocol: `graphql-transport-ws` +1. _Server_ accepts the handshake and establishes a WebSocket communication channel (which we call "socket") +1. _Client_ immediately dispatches a `ConnectionInit` message optionally providing a payload as agreed with the server +1. _Server_ validates the connection initialisation request and dispatches a `ConnectionAck` message to the client on successful connection +1. _Client_ has received the acknowledgement message and is now ready to request operation executions + +### Connection initialisation timeout + +1. _Client_ sends a WebSocket handshake request with the sub-protocol: `graphql-transport-ws` +1. _Server_ accepts the handshake and establishes a WebSocket communication channel (which we call "socket") +1. _Client_ does not dispatch a `ConnectionInit` message +1. _Server_ waits for the `ConnectionInit` message for the duration specified in the `connectionInitWaitTimeout` parameter +1. _Server_ waiting time has passed +1. _Server_ closes the socket by dispatching the event `4408: Connection initialisation timeout` + +### Streaming operation + +#### `subscription` operation and queries with streaming directives + +_The client and the server has already gone through [successful connection initialisation](#successful-connection-initialisation)._ + +1. _Client_ generates a unique ID for the following operation +1. _Client_ dispatches the `Subscribe` message with the generated ID through the `id` field and the requested operation passed through the `payload` field +
_All future communication is linked through this unique ID_ +1. _Server_ executes the streaming GraphQL operation +1. _Server_ checks if the generated ID is unique across active streaming subscriptions + + - If **not** unique, the _server_ will close the socket with the event `4409: Subscriber for already exists` + - If unique, continue... + +1. _Server_ _optionally_ checks if the operation is valid before starting executing it, e.g. checking permissions + + - If **not** valid, the _server_ sends an `Error` message and deems the operation complete. + - If valid, continue... + +1. _Server_ dispatches results over time with the `Next` message +1. - _Server_ dispatches the `Complete` message indicating that the source stream has completed + - _Client_ completes the stream observer +
**or** + - _Client_ stops the subscription by dispatching a `Complete` message + - _Server_ receives `Complete` message and completes the source stream + - _Client_ ignores all further messages that it receives with this ID +
**or** + - _Server_ dispatches the `Complete` message indicating that the source stream has completed + - **Simultaneously** _client_ stops the subscription by dispatching a `Complete` message + - _Client_ ignores all further messages that it receives with this ID + - _Server_ ignores the `Complete` message from the client + +### Single result operation + +#### `query` and `mutation` operations without streaming directives + +A single result operation is identical to a streaming operation except that _at most one_ `Next` message is sent. + +It shares the same name-space for IDs as streaming operations and can be multiplexed with other operations on the connection. + +_The client and the server has already gone through [successful connection initialisation](#successful-connection-initialisation)._ + +1. _Client_ generates a unique ID for the following operation +1. _Client_ dispatches the `Subscribe` message with the generated ID through the `id` field and the requested operation passed through the `payload` field +
_All future communication is linked through this unique ID_ +1. _Server_ executes the single result GraphQL operation +1. _Server_ dispatches the result with the `Next` message +1. _Server_ dispatches the `Complete` message indicating that the execution has completed + +The _client_ may dispatch a `Complete` message at any time, just as shown in the streaming operations examples above, and the same interactions ensue. diff --git a/graphql-subscription-express/node_modules/graphql-ws/README.md b/graphql-subscription-express/node_modules/graphql-ws/README.md new file mode 100644 index 0000000..b55c98a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/README.md @@ -0,0 +1,39 @@ +
+
+ +![GraphQLOverWebSocket](https://user-images.githubusercontent.com/25294569/94527042-172dba00-023f-11eb-944b-88c0bd58a8d2.gif) + +
Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
+ +[![Continuous integration](https://github.com/enisdenjo/graphql-ws/workflows/Continuous%20integration/badge.svg)](https://github.com/enisdenjo/graphql-ws/actions?query=workflow%3A%22Continuous+integration%22) [![graphql-ws](https://img.shields.io/npm/v/graphql-ws.svg?label=graphql-ws&logo=npm)](https://www.npmjs.com/package/graphql-ws) + +Use [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) instead? Check out [graphql-sse](https://github.com/enisdenjo/graphql-sse)! + +
+
+ +## [Get started](https://the-guild.dev/graphql/ws/get-started) + +Swiftly start with the [get started guide on the website](https://the-guild.dev/graphql/ws/get-started). + +## [Recipes](https://the-guild.dev/graphql/ws/recipes) + +Short and concise code snippets for starting with common use-cases. [Available on the website.](https://the-guild.dev/graphql/ws/recipes) + +## [Documentation](https://the-guild.dev/graphql/ws/docs) + +Auto-generated by [TypeDoc](https://typedoc.org) and then [rendered on the website](https://the-guild.dev/graphql/ws/docs). + +## [How does it work?](PROTOCOL.md) + +Read about the exact transport intricacies used by the library in the [GraphQL over WebSocket Protocol document](PROTOCOL.md). + +## [Want to help?](CONTRIBUTING.md) + +File a bug, contribute with code, or improve documentation? Read up on our guidelines for [contributing](CONTRIBUTING.md) and drive development with `yarn test --watch` away! + +## Disclaimer + +This library and the [GraphQL over WebSocket Protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) are **not** cross-compatible with the [deprecated `subscriptions-transport-ws`](https://github.com/apollographql/subscriptions-transport-ws) and its [accompanying Protocol](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md). + +You must use `graphql-ws` coherently and implement the [GraphQL over WebSocket Protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) on both sides, server and the client. diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/client.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/client.d.mts new file mode 100644 index 0000000..1d664c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/client.d.mts @@ -0,0 +1,407 @@ +/** + * + * client + * + */ +import { ExecutionResult } from 'graphql'; +import { Sink, ID, Disposable, Message, ConnectionInitMessage, ConnectionAckMessage, PingMessage, PongMessage, SubscribePayload, JSONMessageReviver, JSONMessageReplacer } from './common.mjs'; +/** This file is the entry point for browsers, re-export common elements. */ +export * from './common.mjs'; +/** + * WebSocket started connecting. + * + * @category Client + */ +export type EventConnecting = 'connecting'; +/** + * WebSocket has opened. + * + * @category Client + */ +export type EventOpened = 'opened'; +/** + * Open WebSocket connection has been acknowledged. + * + * @category Client + */ +export type EventConnected = 'connected'; +/** + * `PingMessage` has been received or sent. + * + * @category Client + */ +export type EventPing = 'ping'; +/** + * `PongMessage` has been received or sent. + * + * @category Client + */ +export type EventPong = 'pong'; +/** + * A message has been received. + * + * @category Client + */ +export type EventMessage = 'message'; +/** + * WebSocket connection has closed. + * + * @category Client + */ +export type EventClosed = 'closed'; +/** + * WebSocket connection had an error or client had an internal error. + * + * @category Client + */ +export type EventError = 'error'; +/** + * All events that could occur. + * + * @category Client + */ +export type Event = EventConnecting | EventOpened | EventConnected | EventPing | EventPong | EventMessage | EventClosed | EventError; +/** @category Client */ +export type EventConnectingListener = (isRetry: boolean) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventOpenedListener = (socket: unknown) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * Also, the second argument is the optional payload that the server may + * send through the `ConnectionAck` message. + * + * @category Client + */ +export type EventConnectedListener = (socket: unknown, payload: ConnectionAckMessage['payload'], wasRetry: boolean) => void; +/** + * The first argument communicates whether the ping was received from the server. + * If `false`, the ping was sent by the client. + * + * @category Client + */ +export type EventPingListener = (received: boolean, payload: PingMessage['payload']) => void; +/** + * The first argument communicates whether the pong was received from the server. + * If `false`, the pong was sent by the client. + * + * @category Client + */ +export type EventPongListener = (received: boolean, payload: PongMessage['payload']) => void; +/** + * Called for all **valid** messages received by the client. Mainly useful for + * debugging and logging received messages. + * + * @category Client + */ +export type EventMessageListener = (message: Message) => void; +/** + * The argument is actually the websocket `CloseEvent`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventClosedListener = (event: unknown) => void; +/** + * Events dispatched from the WebSocket `onerror` are handled in this listener, + * as well as all internal client errors that could throw. + * + * @category Client + */ +export type EventErrorListener = (error: unknown) => void; +/** @category Client */ +export type EventListener = E extends EventConnecting ? EventConnectingListener : E extends EventOpened ? EventOpenedListener : E extends EventConnected ? EventConnectedListener : E extends EventPing ? EventPingListener : E extends EventPong ? EventPongListener : E extends EventMessage ? EventMessageListener : E extends EventClosed ? EventClosedListener : E extends EventError ? EventErrorListener : never; +/** + * Configuration used for the GraphQL over WebSocket client. + * + * @category Client + */ +export interface ClientOptions

{ + /** + * URL of the GraphQL over WebSocket Protocol compliant server to connect. + * + * If the option is a function, it will be called on every WebSocket connection attempt. + * Returning a promise is supported too and the connecting phase will stall until it + * resolves with the URL. + * + * A good use-case for having a function is when using the URL for authentication, + * where subsequent reconnects (due to auth) may have a refreshed identity token in + * the URL. + */ + url: string | (() => Promise | string); + /** + * Optional parameters, passed through the `payload` field with the `ConnectionInit` message, + * that the client specifies when establishing a connection with the server. You can use this + * for securely passing arguments for authentication. + * + * If you decide to return a promise, keep in mind that the server might kick you off if it + * takes too long to resolve! Check the `connectionInitWaitTimeout` on the server for more info. + * + * Throwing an error from within this function will close the socket with the `Error` message + * in the close event reason. + */ + connectionParams?: P | (() => Promise

| P); + /** + * Controls when should the connection be established. + * + * - `false`: Establish a connection immediately. Use `onNonLazyError` to handle errors. + * - `true`: Establish a connection on first subscribe and close on last unsubscribe. Use + * the subscription sink's `error` to handle errors. + * + * @default true + */ + lazy?: boolean; + /** + * Used ONLY when the client is in non-lazy mode (`lazy = false`). When + * using this mode, the errors might have no sinks to report to; however, + * to avoid swallowing errors, consider using `onNonLazyError`, which will + * be called when either: + * - An unrecoverable error/close event occurs + * - Silent retry attempts have been exceeded + * + * After a client has errored out, it will NOT perform any automatic actions. + * + * The argument can be a websocket `CloseEvent` or an `Error`. To avoid bundling + * DOM types, you should derive and assert the correct type. When receiving: + * - A `CloseEvent`: retry attempts have been exceeded or the specific + * close event is labeled as fatal (read more in `retryAttempts`). + * - An `Error`: some internal issue has occured, all internal errors are + * fatal by nature. + * + * @default console.error + */ + onNonLazyError?: (errorOrCloseEvent: unknown) => void; + /** + * How long should the client wait before closing the socket after the last oparation has + * completed. This is meant to be used in combination with `lazy`. You might want to have + * a calmdown time before actually closing the connection. Kinda' like a lazy close "debounce". + * + * @default 0 + */ + lazyCloseTimeout?: number; + /** + * The timout between dispatched keep-alive messages, naimly server pings. Internally + * dispatches the `PingMessage` type to the server and expects a `PongMessage` in response. + * This helps with making sure that the connection with the server is alive and working. + * + * Timeout countdown starts from the moment the socket was opened and subsequently + * after every received `PongMessage`. + * + * Note that NOTHING will happen automatically with the client if the server never + * responds to a `PingMessage` with a `PongMessage`. If you want the connection to close, + * you should implement your own logic on top of the client. A simple example looks like this: + * + * ```js + * import { createClient } from 'graphql-ws'; + * + * let activeSocket, timedOut; + * createClient({ + * url: 'ws://i.time.out:4000/after-5/seconds', + * keepAlive: 10_000, // ping server every 10 seconds + * on: { + * connected: (socket) => (activeSocket = socket), + * ping: (received) => { + * if (!received) // sent + * timedOut = setTimeout(() => { + * if (activeSocket.readyState === WebSocket.OPEN) + * activeSocket.close(4408, 'Request Timeout'); + * }, 5_000); // wait 5 seconds for the pong and then close the connection + * }, + * pong: (received) => { + * if (received) clearTimeout(timedOut); // pong is received, clear connection close timeout + * }, + * }, + * }); + * ``` + * + * @default 0 + */ + keepAlive?: number; + /** + * The amount of time for which the client will wait + * for `ConnectionAck` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the server + * has not responded with `ConnectionAck` message, + * the client will terminate the socket by + * dispatching a close event `4418: Connection acknowledgement timeout` + * + * @default 0 + */ + connectionAckWaitTimeout?: number; + /** + * Disable sending the `PongMessage` automatically. + * + * Useful for when integrating your own custom client pinger that performs + * custom actions before responding to a ping, or to pass along the optional pong + * message payload. Please check the readme recipes for a concrete example. + */ + disablePong?: boolean; + /** + * How many times should the client try to reconnect on abnormal socket closure before it errors out? + * + * The library classifies the following close events as fatal: + * - _All internal WebSocket fatal close codes (check `isFatalInternalCloseCode` in `src/client.ts` for exact list)_ + * - `4500: Internal server error` + * - `4005: Internal client error` + * - `4400: Bad request` + * - `4004: Bad response` + * - `4401: Unauthorized` _tried subscribing before connect ack_ + * - `4406: Subprotocol not acceptable` + * - `4409: Subscriber for already exists` _distinction is very important_ + * - `4429: Too many initialisation requests` + * + * In addition to the aforementioned close events, any _non-CloseEvent_ connection problem + * is considered fatal by default. However, this specific behaviour can be altered by using + * the `shouldRetry` option. + * + * These events are reported immediately and the client will not reconnect. + * + * @default 5 + */ + retryAttempts?: number; + /** + * Control the wait time between retries. You may implement your own strategy + * by timing the resolution of the returned promise with the retries count. + * `retries` argument counts actual connection attempts, so it will begin with + * 0 after the first retryable disconnect. + * + * @default 'Randomised exponential backoff' + */ + retryWait?: (retries: number) => Promise; + /** + * Check if the close event or connection error is fatal. If you return `false`, + * the client will fail immediately without additional retries; however, if you + * return `true`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is whatever has been thrown during the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned here. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Only `CloseEvent`s' + */ + shouldRetry?: (errOrCloseEvent: unknown) => boolean; + /** + * @deprecated Use `shouldRetry` instead. + * + * Check if the close event or connection error is fatal. If you return `true`, + * the client will fail immediately without additional retries; however, if you + * return `false`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is either a WebSocket `CloseEvent` or an error thrown during + * the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Any non-`CloseEvent`' + */ + isFatalConnectionProblem?: (errOrCloseEvent: unknown) => boolean; + /** + * Register listeners before initialising the client. This way + * you can ensure to catch all client relevant emitted events. + * + * The listeners passed in will **always** be the first ones + * to get the emitted event before other registered listeners. + */ + on?: Partial<{ + [event in Event]: EventListener; + }>; + /** + * A custom WebSocket implementation to use instead of the + * one provided by the global scope. Mostly useful for when + * using the client outside of the browser environment. + */ + webSocketImpl?: unknown; + /** + * A custom ID generator for identifying subscriptions. + * + * The default generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID?: (payload: SubscribePayload) => ID; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this client. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages from this client. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Client */ +export interface Client extends Disposable { + /** + * Listens on the client which dispatches events about the socket state. + */ + on(event: E, listener: EventListener): () => void; + /** + * Subscribes through the WebSocket following the config parameters. It + * uses the `sink` to emit received data or errors. Returns a _cleanup_ + * function used for dropping the subscription and cleaning stuff up. + */ + subscribe, Extensions = unknown>(payload: SubscribePayload, sink: Sink>): () => void; + /** + * Subscribes and iterates over emitted results from the WebSocket + * through the returned async iterator. + */ + iterate, Extensions = unknown>(payload: SubscribePayload): AsyncIterableIterator>; + /** + * Terminates the WebSocket abruptly and immediately. + * + * A close event `4499: Terminated` is issued to the current WebSocket and a + * syntetic {@link TerminatedCloseEvent} is immediately emitted without waiting for + * the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ + terminate(): void; +} +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +export declare function createClient

(options: ClientOptions

): Client; +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +export declare class TerminatedCloseEvent extends Error { + name: string; + message: string; + code: number; + reason: string; + wasClean: boolean; +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/client.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/client.d.ts new file mode 100644 index 0000000..c077ed6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/client.d.ts @@ -0,0 +1,407 @@ +/** + * + * client + * + */ +import { ExecutionResult } from 'graphql'; +import { Sink, ID, Disposable, Message, ConnectionInitMessage, ConnectionAckMessage, PingMessage, PongMessage, SubscribePayload, JSONMessageReviver, JSONMessageReplacer } from './common'; +/** This file is the entry point for browsers, re-export common elements. */ +export * from './common'; +/** + * WebSocket started connecting. + * + * @category Client + */ +export type EventConnecting = 'connecting'; +/** + * WebSocket has opened. + * + * @category Client + */ +export type EventOpened = 'opened'; +/** + * Open WebSocket connection has been acknowledged. + * + * @category Client + */ +export type EventConnected = 'connected'; +/** + * `PingMessage` has been received or sent. + * + * @category Client + */ +export type EventPing = 'ping'; +/** + * `PongMessage` has been received or sent. + * + * @category Client + */ +export type EventPong = 'pong'; +/** + * A message has been received. + * + * @category Client + */ +export type EventMessage = 'message'; +/** + * WebSocket connection has closed. + * + * @category Client + */ +export type EventClosed = 'closed'; +/** + * WebSocket connection had an error or client had an internal error. + * + * @category Client + */ +export type EventError = 'error'; +/** + * All events that could occur. + * + * @category Client + */ +export type Event = EventConnecting | EventOpened | EventConnected | EventPing | EventPong | EventMessage | EventClosed | EventError; +/** @category Client */ +export type EventConnectingListener = (isRetry: boolean) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventOpenedListener = (socket: unknown) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * Also, the second argument is the optional payload that the server may + * send through the `ConnectionAck` message. + * + * @category Client + */ +export type EventConnectedListener = (socket: unknown, payload: ConnectionAckMessage['payload'], wasRetry: boolean) => void; +/** + * The first argument communicates whether the ping was received from the server. + * If `false`, the ping was sent by the client. + * + * @category Client + */ +export type EventPingListener = (received: boolean, payload: PingMessage['payload']) => void; +/** + * The first argument communicates whether the pong was received from the server. + * If `false`, the pong was sent by the client. + * + * @category Client + */ +export type EventPongListener = (received: boolean, payload: PongMessage['payload']) => void; +/** + * Called for all **valid** messages received by the client. Mainly useful for + * debugging and logging received messages. + * + * @category Client + */ +export type EventMessageListener = (message: Message) => void; +/** + * The argument is actually the websocket `CloseEvent`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventClosedListener = (event: unknown) => void; +/** + * Events dispatched from the WebSocket `onerror` are handled in this listener, + * as well as all internal client errors that could throw. + * + * @category Client + */ +export type EventErrorListener = (error: unknown) => void; +/** @category Client */ +export type EventListener = E extends EventConnecting ? EventConnectingListener : E extends EventOpened ? EventOpenedListener : E extends EventConnected ? EventConnectedListener : E extends EventPing ? EventPingListener : E extends EventPong ? EventPongListener : E extends EventMessage ? EventMessageListener : E extends EventClosed ? EventClosedListener : E extends EventError ? EventErrorListener : never; +/** + * Configuration used for the GraphQL over WebSocket client. + * + * @category Client + */ +export interface ClientOptions

{ + /** + * URL of the GraphQL over WebSocket Protocol compliant server to connect. + * + * If the option is a function, it will be called on every WebSocket connection attempt. + * Returning a promise is supported too and the connecting phase will stall until it + * resolves with the URL. + * + * A good use-case for having a function is when using the URL for authentication, + * where subsequent reconnects (due to auth) may have a refreshed identity token in + * the URL. + */ + url: string | (() => Promise | string); + /** + * Optional parameters, passed through the `payload` field with the `ConnectionInit` message, + * that the client specifies when establishing a connection with the server. You can use this + * for securely passing arguments for authentication. + * + * If you decide to return a promise, keep in mind that the server might kick you off if it + * takes too long to resolve! Check the `connectionInitWaitTimeout` on the server for more info. + * + * Throwing an error from within this function will close the socket with the `Error` message + * in the close event reason. + */ + connectionParams?: P | (() => Promise

| P); + /** + * Controls when should the connection be established. + * + * - `false`: Establish a connection immediately. Use `onNonLazyError` to handle errors. + * - `true`: Establish a connection on first subscribe and close on last unsubscribe. Use + * the subscription sink's `error` to handle errors. + * + * @default true + */ + lazy?: boolean; + /** + * Used ONLY when the client is in non-lazy mode (`lazy = false`). When + * using this mode, the errors might have no sinks to report to; however, + * to avoid swallowing errors, consider using `onNonLazyError`, which will + * be called when either: + * - An unrecoverable error/close event occurs + * - Silent retry attempts have been exceeded + * + * After a client has errored out, it will NOT perform any automatic actions. + * + * The argument can be a websocket `CloseEvent` or an `Error`. To avoid bundling + * DOM types, you should derive and assert the correct type. When receiving: + * - A `CloseEvent`: retry attempts have been exceeded or the specific + * close event is labeled as fatal (read more in `retryAttempts`). + * - An `Error`: some internal issue has occured, all internal errors are + * fatal by nature. + * + * @default console.error + */ + onNonLazyError?: (errorOrCloseEvent: unknown) => void; + /** + * How long should the client wait before closing the socket after the last oparation has + * completed. This is meant to be used in combination with `lazy`. You might want to have + * a calmdown time before actually closing the connection. Kinda' like a lazy close "debounce". + * + * @default 0 + */ + lazyCloseTimeout?: number; + /** + * The timout between dispatched keep-alive messages, naimly server pings. Internally + * dispatches the `PingMessage` type to the server and expects a `PongMessage` in response. + * This helps with making sure that the connection with the server is alive and working. + * + * Timeout countdown starts from the moment the socket was opened and subsequently + * after every received `PongMessage`. + * + * Note that NOTHING will happen automatically with the client if the server never + * responds to a `PingMessage` with a `PongMessage`. If you want the connection to close, + * you should implement your own logic on top of the client. A simple example looks like this: + * + * ```js + * import { createClient } from 'graphql-ws'; + * + * let activeSocket, timedOut; + * createClient({ + * url: 'ws://i.time.out:4000/after-5/seconds', + * keepAlive: 10_000, // ping server every 10 seconds + * on: { + * connected: (socket) => (activeSocket = socket), + * ping: (received) => { + * if (!received) // sent + * timedOut = setTimeout(() => { + * if (activeSocket.readyState === WebSocket.OPEN) + * activeSocket.close(4408, 'Request Timeout'); + * }, 5_000); // wait 5 seconds for the pong and then close the connection + * }, + * pong: (received) => { + * if (received) clearTimeout(timedOut); // pong is received, clear connection close timeout + * }, + * }, + * }); + * ``` + * + * @default 0 + */ + keepAlive?: number; + /** + * The amount of time for which the client will wait + * for `ConnectionAck` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the server + * has not responded with `ConnectionAck` message, + * the client will terminate the socket by + * dispatching a close event `4418: Connection acknowledgement timeout` + * + * @default 0 + */ + connectionAckWaitTimeout?: number; + /** + * Disable sending the `PongMessage` automatically. + * + * Useful for when integrating your own custom client pinger that performs + * custom actions before responding to a ping, or to pass along the optional pong + * message payload. Please check the readme recipes for a concrete example. + */ + disablePong?: boolean; + /** + * How many times should the client try to reconnect on abnormal socket closure before it errors out? + * + * The library classifies the following close events as fatal: + * - _All internal WebSocket fatal close codes (check `isFatalInternalCloseCode` in `src/client.ts` for exact list)_ + * - `4500: Internal server error` + * - `4005: Internal client error` + * - `4400: Bad request` + * - `4004: Bad response` + * - `4401: Unauthorized` _tried subscribing before connect ack_ + * - `4406: Subprotocol not acceptable` + * - `4409: Subscriber for already exists` _distinction is very important_ + * - `4429: Too many initialisation requests` + * + * In addition to the aforementioned close events, any _non-CloseEvent_ connection problem + * is considered fatal by default. However, this specific behaviour can be altered by using + * the `shouldRetry` option. + * + * These events are reported immediately and the client will not reconnect. + * + * @default 5 + */ + retryAttempts?: number; + /** + * Control the wait time between retries. You may implement your own strategy + * by timing the resolution of the returned promise with the retries count. + * `retries` argument counts actual connection attempts, so it will begin with + * 0 after the first retryable disconnect. + * + * @default 'Randomised exponential backoff' + */ + retryWait?: (retries: number) => Promise; + /** + * Check if the close event or connection error is fatal. If you return `false`, + * the client will fail immediately without additional retries; however, if you + * return `true`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is whatever has been thrown during the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned here. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Only `CloseEvent`s' + */ + shouldRetry?: (errOrCloseEvent: unknown) => boolean; + /** + * @deprecated Use `shouldRetry` instead. + * + * Check if the close event or connection error is fatal. If you return `true`, + * the client will fail immediately without additional retries; however, if you + * return `false`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is either a WebSocket `CloseEvent` or an error thrown during + * the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Any non-`CloseEvent`' + */ + isFatalConnectionProblem?: (errOrCloseEvent: unknown) => boolean; + /** + * Register listeners before initialising the client. This way + * you can ensure to catch all client relevant emitted events. + * + * The listeners passed in will **always** be the first ones + * to get the emitted event before other registered listeners. + */ + on?: Partial<{ + [event in Event]: EventListener; + }>; + /** + * A custom WebSocket implementation to use instead of the + * one provided by the global scope. Mostly useful for when + * using the client outside of the browser environment. + */ + webSocketImpl?: unknown; + /** + * A custom ID generator for identifying subscriptions. + * + * The default generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID?: (payload: SubscribePayload) => ID; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this client. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages from this client. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Client */ +export interface Client extends Disposable { + /** + * Listens on the client which dispatches events about the socket state. + */ + on(event: E, listener: EventListener): () => void; + /** + * Subscribes through the WebSocket following the config parameters. It + * uses the `sink` to emit received data or errors. Returns a _cleanup_ + * function used for dropping the subscription and cleaning stuff up. + */ + subscribe, Extensions = unknown>(payload: SubscribePayload, sink: Sink>): () => void; + /** + * Subscribes and iterates over emitted results from the WebSocket + * through the returned async iterator. + */ + iterate, Extensions = unknown>(payload: SubscribePayload): AsyncIterableIterator>; + /** + * Terminates the WebSocket abruptly and immediately. + * + * A close event `4499: Terminated` is issued to the current WebSocket and a + * syntetic {@link TerminatedCloseEvent} is immediately emitted without waiting for + * the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ + terminate(): void; +} +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +export declare function createClient

(options: ClientOptions

): Client; +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +export declare class TerminatedCloseEvent extends Error { + name: string; + message: string; + code: number; + reason: string; + wasClean: boolean; +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/client.js b/graphql-subscription-express/node_modules/graphql-ws/lib/client.js new file mode 100644 index 0000000..c1a5c6e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/client.js @@ -0,0 +1,575 @@ +"use strict"; +/** + * + * client + * + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } +var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TerminatedCloseEvent = exports.createClient = void 0; +const common_1 = require("./common"); +const utils_1 = require("./utils"); +/** This file is the entry point for browsers, re-export common elements. */ +__exportStar(require("./common"), exports); +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +function createClient(options) { + const { url, connectionParams, lazy = true, onNonLazyError = console.error, lazyCloseTimeout: lazyCloseTimeoutMs = 0, keepAlive = 0, disablePong, connectionAckWaitTimeout = 0, retryAttempts = 5, retryWait = async function randomisedExponentialBackoff(retries) { + let retryDelay = 1000; // start with 1s delay + for (let i = 0; i < retries; i++) { + retryDelay *= 2; + } + await new Promise((resolve) => setTimeout(resolve, retryDelay + + // add random timeout from 300ms to 3s + Math.floor(Math.random() * (3000 - 300) + 300))); + }, shouldRetry = isLikeCloseEvent, isFatalConnectionProblem, on, webSocketImpl, + /** + * Generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID = function generateUUID() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); + }, jsonMessageReplacer: replacer, jsonMessageReviver: reviver, } = options; + let ws; + if (webSocketImpl) { + if (!isWebSocket(webSocketImpl)) { + throw new Error('Invalid WebSocket implementation provided'); + } + ws = webSocketImpl; + } + else if (typeof WebSocket !== 'undefined') { + ws = WebSocket; + } + else if (typeof global !== 'undefined') { + ws = + global.WebSocket || + // @ts-expect-error: Support more browsers + global.MozWebSocket; + } + else if (typeof window !== 'undefined') { + ws = + window.WebSocket || + // @ts-expect-error: Support more browsers + window.MozWebSocket; + } + if (!ws) + throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`"); + const WebSocketImpl = ws; + // websocket status emitter, subscriptions are handled differently + const emitter = (() => { + const message = (() => { + const listeners = {}; + return { + on(id, listener) { + listeners[id] = listener; + return () => { + delete listeners[id]; + }; + }, + emit(message) { + var _a; + if ('id' in message) + (_a = listeners[message.id]) === null || _a === void 0 ? void 0 : _a.call(listeners, message); + }, + }; + })(); + const listeners = { + connecting: (on === null || on === void 0 ? void 0 : on.connecting) ? [on.connecting] : [], + opened: (on === null || on === void 0 ? void 0 : on.opened) ? [on.opened] : [], + connected: (on === null || on === void 0 ? void 0 : on.connected) ? [on.connected] : [], + ping: (on === null || on === void 0 ? void 0 : on.ping) ? [on.ping] : [], + pong: (on === null || on === void 0 ? void 0 : on.pong) ? [on.pong] : [], + message: (on === null || on === void 0 ? void 0 : on.message) ? [message.emit, on.message] : [message.emit], + closed: (on === null || on === void 0 ? void 0 : on.closed) ? [on.closed] : [], + error: (on === null || on === void 0 ? void 0 : on.error) ? [on.error] : [], + }; + return { + onMessage: message.on, + on(event, listener) { + const l = listeners[event]; + l.push(listener); + return () => { + l.splice(l.indexOf(listener), 1); + }; + }, + emit(event, ...args) { + // we copy the listeners so that unlistens dont "pull the rug under our feet" + for (const listener of [...listeners[event]]) { + // @ts-expect-error: The args should fit + listener(...args); + } + }, + }; + })(); + // invokes the callback either when an error or closed event is emitted, + // first one that gets called prevails, other emissions are ignored + function errorOrClosed(cb) { + const listening = [ + // errors are fatal and more critical than close events, throw them first + emitter.on('error', (err) => { + listening.forEach((unlisten) => unlisten()); + cb(err); + }), + // closes can be graceful and not fatal, throw them second (if error didnt throw) + emitter.on('closed', (event) => { + listening.forEach((unlisten) => unlisten()); + cb(event); + }), + ]; + } + let connecting, locks = 0, lazyCloseTimeout, retrying = false, retries = 0, disposed = false; + async function connect() { + // clear the lazy close timeout immediatelly so that close gets debounced + // see: https://github.com/enisdenjo/graphql-ws/issues/388 + clearTimeout(lazyCloseTimeout); + const [socket, throwOnClose] = await (connecting !== null && connecting !== void 0 ? connecting : (connecting = new Promise((connected, denied) => (async () => { + if (retrying) { + await retryWait(retries); + // subscriptions might complete while waiting for retry + if (!locks) { + connecting = undefined; + return denied({ code: 1000, reason: 'All Subscriptions Gone' }); + } + retries++; + } + emitter.emit('connecting', retrying); + const socket = new WebSocketImpl(typeof url === 'function' ? await url() : url, common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL); + let connectionAckTimeout, queuedPing; + function enqueuePing() { + if (isFinite(keepAlive) && keepAlive > 0) { + clearTimeout(queuedPing); // in case where a pong was received before a ping (this is valid behaviour) + queuedPing = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) { + socket.send((0, common_1.stringifyMessage)({ type: common_1.MessageType.Ping })); + emitter.emit('ping', false, undefined); + } + }, keepAlive); + } + } + errorOrClosed((errOrEvent) => { + connecting = undefined; + clearTimeout(connectionAckTimeout); + clearTimeout(queuedPing); + denied(errOrEvent); + if (errOrEvent instanceof TerminatedCloseEvent) { + socket.close(4499, 'Terminated'); // close event is artificial and emitted manually, see `Client.terminate()` below + socket.onerror = null; + socket.onclose = null; + } + }); + socket.onerror = (err) => emitter.emit('error', err); + socket.onclose = (event) => emitter.emit('closed', event); + socket.onopen = async () => { + try { + emitter.emit('opened', socket); + const payload = typeof connectionParams === 'function' + ? await connectionParams() + : connectionParams; + // connectionParams might take too long causing the server to kick off the client + // the necessary error/close event is already reported - simply stop execution + if (socket.readyState !== WebSocketImpl.OPEN) + return; + socket.send((0, common_1.stringifyMessage)(payload + ? { + type: common_1.MessageType.ConnectionInit, + payload, + } + : { + type: common_1.MessageType.ConnectionInit, + // payload is completely absent if not provided + }, replacer)); + if (isFinite(connectionAckWaitTimeout) && + connectionAckWaitTimeout > 0) { + connectionAckTimeout = setTimeout(() => { + socket.close(common_1.CloseCode.ConnectionAcknowledgementTimeout, 'Connection acknowledgement timeout'); + }, connectionAckWaitTimeout); + } + enqueuePing(); // enqueue ping (noop if disabled) + } + catch (err) { + emitter.emit('error', err); + socket.close(common_1.CloseCode.InternalClientError, (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : new Error(err).message, 'Internal client error')); + } + }; + let acknowledged = false; + socket.onmessage = ({ data }) => { + try { + const message = (0, common_1.parseMessage)(data, reviver); + emitter.emit('message', message); + if (message.type === 'ping' || message.type === 'pong') { + emitter.emit(message.type, true, message.payload); // received + if (message.type === 'pong') { + enqueuePing(); // enqueue next ping (noop if disabled) + } + else if (!disablePong) { + // respond with pong on ping + socket.send((0, common_1.stringifyMessage)(message.payload + ? { + type: common_1.MessageType.Pong, + payload: message.payload, + } + : { + type: common_1.MessageType.Pong, + // payload is completely absent if not provided + })); + emitter.emit('pong', false, message.payload); + } + return; // ping and pongs can be received whenever + } + if (acknowledged) + return; // already connected and acknowledged + if (message.type !== common_1.MessageType.ConnectionAck) + throw new Error(`First message cannot be of type ${message.type}`); + clearTimeout(connectionAckTimeout); + acknowledged = true; + emitter.emit('connected', socket, message.payload, retrying); // connected = socket opened + acknowledged + retrying = false; // future lazy connects are not retries + retries = 0; // reset the retries on connect + connected([ + socket, + new Promise((_, reject) => errorOrClosed(reject)), + ]); + } + catch (err) { + socket.onmessage = null; // stop reading messages as soon as reading breaks once + emitter.emit('error', err); + socket.close(common_1.CloseCode.BadResponse, (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : new Error(err).message, 'Bad response')); + } + }; + })()))); + // if the provided socket is in a closing state, wait for the throw on close + if (socket.readyState === WebSocketImpl.CLOSING) + await throwOnClose; + let release = () => { + // releases this connection + }; + const released = new Promise((resolve) => (release = resolve)); + return [ + socket, + release, + Promise.race([ + // wait for + released.then(() => { + if (!locks) { + // and if no more locks are present, complete the connection + const complete = () => socket.close(1000, 'Normal Closure'); + if (isFinite(lazyCloseTimeoutMs) && lazyCloseTimeoutMs > 0) { + // if the keepalive is set, allow for the specified calmdown time and + // then complete if the socket is still open. + lazyCloseTimeout = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) + complete(); + }, lazyCloseTimeoutMs); + } + else { + // otherwise complete immediately + complete(); + } + } + }), + // or + throwOnClose, + ]), + ]; + } + /** + * Checks the `connect` problem and evaluates if the client should retry. + */ + function shouldRetryConnectOrThrow(errOrCloseEvent) { + // some close codes are worth reporting immediately + if (isLikeCloseEvent(errOrCloseEvent) && + (isFatalInternalCloseCode(errOrCloseEvent.code) || + [ + common_1.CloseCode.InternalServerError, + common_1.CloseCode.InternalClientError, + common_1.CloseCode.BadRequest, + common_1.CloseCode.BadResponse, + common_1.CloseCode.Unauthorized, + // CloseCode.Forbidden, might grant access out after retry + common_1.CloseCode.SubprotocolNotAcceptable, + // CloseCode.ConnectionInitialisationTimeout, might not time out after retry + // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry + common_1.CloseCode.SubscriberAlreadyExists, + common_1.CloseCode.TooManyInitialisationRequests, + // 4499, // Terminated, probably because the socket froze, we want to retry + ].includes(errOrCloseEvent.code))) + throw errOrCloseEvent; + // client was disposed, no retries should proceed regardless + if (disposed) + return false; + // normal closure (possibly all subscriptions have completed) + // if no locks were acquired in the meantime, shouldnt try again + if (isLikeCloseEvent(errOrCloseEvent) && errOrCloseEvent.code === 1000) + return locks > 0; + // retries are not allowed or we tried to many times, report error + if (!retryAttempts || retries >= retryAttempts) + throw errOrCloseEvent; + // throw non-retryable connection problems + if (!shouldRetry(errOrCloseEvent)) + throw errOrCloseEvent; + // @deprecated throw fatal connection problems immediately + if (isFatalConnectionProblem === null || isFatalConnectionProblem === void 0 ? void 0 : isFatalConnectionProblem(errOrCloseEvent)) + throw errOrCloseEvent; + // looks good, start retrying + return (retrying = true); + } + // in non-lazy (hot?) mode always hold one connection lock to persist the socket + if (!lazy) { + (async () => { + locks++; + for (;;) { + try { + const [, , throwOnClose] = await connect(); + await throwOnClose; // will always throw because releaser is not used + } + catch (errOrCloseEvent) { + try { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + catch (errOrCloseEvent) { + // report thrown error, no further retries + return onNonLazyError === null || onNonLazyError === void 0 ? void 0 : onNonLazyError(errOrCloseEvent); + } + } + } + })(); + } + function subscribe(payload, sink) { + const id = generateID(payload); + let done = false, errored = false, releaser = () => { + // for handling completions before connect + locks--; + done = true; + }; + (async () => { + locks++; + for (;;) { + try { + const [socket, release, waitForReleaseOrThrowOnClose] = await connect(); + // if done while waiting for connect, release the connection lock right away + if (done) + return release(); + const unlisten = emitter.onMessage(id, (message) => { + switch (message.type) { + case common_1.MessageType.Next: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- payload will fit type + sink.next(message.payload); + return; + } + case common_1.MessageType.Error: { + (errored = true), (done = true); + sink.error(message.payload); + releaser(); + return; + } + case common_1.MessageType.Complete: { + done = true; + releaser(); // release completes the sink + return; + } + } + }); + socket.send((0, common_1.stringifyMessage)({ + id, + type: common_1.MessageType.Subscribe, + payload, + }, replacer)); + releaser = () => { + if (!done && socket.readyState === WebSocketImpl.OPEN) + // if not completed already and socket is open, send complete message to server on release + socket.send((0, common_1.stringifyMessage)({ + id, + type: common_1.MessageType.Complete, + }, replacer)); + locks--; + done = true; + release(); + }; + // either the releaser will be called, connection completed and + // the promise resolved or the socket closed and the promise rejected. + // whatever happens though, we want to stop listening for messages + await waitForReleaseOrThrowOnClose.finally(unlisten); + return; // completed, shouldnt try again + } + catch (errOrCloseEvent) { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + } + })() + .then(() => { + // delivering either an error or a complete terminates the sequence + if (!errored) + sink.complete(); + }) // resolves on release or normal closure + .catch((err) => { + sink.error(err); + }); // rejects on close events and errors + return () => { + // dispose only of active subscriptions + if (!done) + releaser(); + }; + } + return { + on: emitter.on, + subscribe, + iterate(request) { + const pending = []; + const deferred = { + done: false, + error: null, + resolve: () => { + // noop + }, + }; + const dispose = subscribe(request, { + next(val) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + pending.push(val); + deferred.resolve(); + }, + error(err) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + }, + complete() { + deferred.done = true; + deferred.resolve(); + }, + }); + const iterator = (function iterator() { + return __asyncGenerator(this, arguments, function* iterator_1() { + for (;;) { + if (!pending.length) { + // only wait if there are no pending messages available + yield __await(new Promise((resolve) => (deferred.resolve = resolve))); + } + // first flush + while (pending.length) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + yield yield __await(pending.shift()); + } + // then error + if (deferred.error) { + throw deferred.error; + } + // or complete + if (deferred.done) { + return yield __await(void 0); + } + } + }); + })(); + iterator.throw = async (err) => { + if (!deferred.done) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + } + return { done: true, value: undefined }; + }; + iterator.return = async () => { + dispose(); + return { done: true, value: undefined }; + }; + return iterator; + }, + async dispose() { + disposed = true; + if (connecting) { + // if there is a connection, close it + const [socket] = await connecting; + socket.close(1000, 'Normal Closure'); + } + }, + terminate() { + if (connecting) { + // only if there is a connection + emitter.emit('closed', new TerminatedCloseEvent()); + } + }, + }; +} +exports.createClient = createClient; +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +class TerminatedCloseEvent extends Error { + constructor() { + super(...arguments); + this.name = 'TerminatedCloseEvent'; + this.message = '4499: Terminated'; + this.code = 4499; + this.reason = 'Terminated'; + this.wasClean = false; + } +} +exports.TerminatedCloseEvent = TerminatedCloseEvent; +function isLikeCloseEvent(val) { + return (0, utils_1.isObject)(val) && 'code' in val && 'reason' in val; +} +function isFatalInternalCloseCode(code) { + if ([ + 1000, + 1001, + 1006, + 1005, + 1012, + 1013, + 1014, // Bad Gateway + ].includes(code)) + return false; + // all other internal errors are fatal + return code >= 1000 && code <= 1999; +} +function isWebSocket(val) { + return (typeof val === 'function' && + 'constructor' in val && + 'CLOSED' in val && + 'CLOSING' in val && + 'CONNECTING' in val && + 'OPEN' in val); +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/client.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/client.mjs new file mode 100644 index 0000000..0ad440c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/client.mjs @@ -0,0 +1,556 @@ +/** + * + * client + * + */ +var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } +var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +}; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, CloseCode, MessageType, parseMessage, stringifyMessage, } from './common.mjs'; +import { isObject, limitCloseReason } from './utils.mjs'; +/** This file is the entry point for browsers, re-export common elements. */ +export * from './common.mjs'; +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +export function createClient(options) { + const { url, connectionParams, lazy = true, onNonLazyError = console.error, lazyCloseTimeout: lazyCloseTimeoutMs = 0, keepAlive = 0, disablePong, connectionAckWaitTimeout = 0, retryAttempts = 5, retryWait = async function randomisedExponentialBackoff(retries) { + let retryDelay = 1000; // start with 1s delay + for (let i = 0; i < retries; i++) { + retryDelay *= 2; + } + await new Promise((resolve) => setTimeout(resolve, retryDelay + + // add random timeout from 300ms to 3s + Math.floor(Math.random() * (3000 - 300) + 300))); + }, shouldRetry = isLikeCloseEvent, isFatalConnectionProblem, on, webSocketImpl, + /** + * Generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID = function generateUUID() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); + }, jsonMessageReplacer: replacer, jsonMessageReviver: reviver, } = options; + let ws; + if (webSocketImpl) { + if (!isWebSocket(webSocketImpl)) { + throw new Error('Invalid WebSocket implementation provided'); + } + ws = webSocketImpl; + } + else if (typeof WebSocket !== 'undefined') { + ws = WebSocket; + } + else if (typeof global !== 'undefined') { + ws = + global.WebSocket || + // @ts-expect-error: Support more browsers + global.MozWebSocket; + } + else if (typeof window !== 'undefined') { + ws = + window.WebSocket || + // @ts-expect-error: Support more browsers + window.MozWebSocket; + } + if (!ws) + throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`"); + const WebSocketImpl = ws; + // websocket status emitter, subscriptions are handled differently + const emitter = (() => { + const message = (() => { + const listeners = {}; + return { + on(id, listener) { + listeners[id] = listener; + return () => { + delete listeners[id]; + }; + }, + emit(message) { + var _a; + if ('id' in message) + (_a = listeners[message.id]) === null || _a === void 0 ? void 0 : _a.call(listeners, message); + }, + }; + })(); + const listeners = { + connecting: (on === null || on === void 0 ? void 0 : on.connecting) ? [on.connecting] : [], + opened: (on === null || on === void 0 ? void 0 : on.opened) ? [on.opened] : [], + connected: (on === null || on === void 0 ? void 0 : on.connected) ? [on.connected] : [], + ping: (on === null || on === void 0 ? void 0 : on.ping) ? [on.ping] : [], + pong: (on === null || on === void 0 ? void 0 : on.pong) ? [on.pong] : [], + message: (on === null || on === void 0 ? void 0 : on.message) ? [message.emit, on.message] : [message.emit], + closed: (on === null || on === void 0 ? void 0 : on.closed) ? [on.closed] : [], + error: (on === null || on === void 0 ? void 0 : on.error) ? [on.error] : [], + }; + return { + onMessage: message.on, + on(event, listener) { + const l = listeners[event]; + l.push(listener); + return () => { + l.splice(l.indexOf(listener), 1); + }; + }, + emit(event, ...args) { + // we copy the listeners so that unlistens dont "pull the rug under our feet" + for (const listener of [...listeners[event]]) { + // @ts-expect-error: The args should fit + listener(...args); + } + }, + }; + })(); + // invokes the callback either when an error or closed event is emitted, + // first one that gets called prevails, other emissions are ignored + function errorOrClosed(cb) { + const listening = [ + // errors are fatal and more critical than close events, throw them first + emitter.on('error', (err) => { + listening.forEach((unlisten) => unlisten()); + cb(err); + }), + // closes can be graceful and not fatal, throw them second (if error didnt throw) + emitter.on('closed', (event) => { + listening.forEach((unlisten) => unlisten()); + cb(event); + }), + ]; + } + let connecting, locks = 0, lazyCloseTimeout, retrying = false, retries = 0, disposed = false; + async function connect() { + // clear the lazy close timeout immediatelly so that close gets debounced + // see: https://github.com/enisdenjo/graphql-ws/issues/388 + clearTimeout(lazyCloseTimeout); + const [socket, throwOnClose] = await (connecting !== null && connecting !== void 0 ? connecting : (connecting = new Promise((connected, denied) => (async () => { + if (retrying) { + await retryWait(retries); + // subscriptions might complete while waiting for retry + if (!locks) { + connecting = undefined; + return denied({ code: 1000, reason: 'All Subscriptions Gone' }); + } + retries++; + } + emitter.emit('connecting', retrying); + const socket = new WebSocketImpl(typeof url === 'function' ? await url() : url, GRAPHQL_TRANSPORT_WS_PROTOCOL); + let connectionAckTimeout, queuedPing; + function enqueuePing() { + if (isFinite(keepAlive) && keepAlive > 0) { + clearTimeout(queuedPing); // in case where a pong was received before a ping (this is valid behaviour) + queuedPing = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) { + socket.send(stringifyMessage({ type: MessageType.Ping })); + emitter.emit('ping', false, undefined); + } + }, keepAlive); + } + } + errorOrClosed((errOrEvent) => { + connecting = undefined; + clearTimeout(connectionAckTimeout); + clearTimeout(queuedPing); + denied(errOrEvent); + if (errOrEvent instanceof TerminatedCloseEvent) { + socket.close(4499, 'Terminated'); // close event is artificial and emitted manually, see `Client.terminate()` below + socket.onerror = null; + socket.onclose = null; + } + }); + socket.onerror = (err) => emitter.emit('error', err); + socket.onclose = (event) => emitter.emit('closed', event); + socket.onopen = async () => { + try { + emitter.emit('opened', socket); + const payload = typeof connectionParams === 'function' + ? await connectionParams() + : connectionParams; + // connectionParams might take too long causing the server to kick off the client + // the necessary error/close event is already reported - simply stop execution + if (socket.readyState !== WebSocketImpl.OPEN) + return; + socket.send(stringifyMessage(payload + ? { + type: MessageType.ConnectionInit, + payload, + } + : { + type: MessageType.ConnectionInit, + // payload is completely absent if not provided + }, replacer)); + if (isFinite(connectionAckWaitTimeout) && + connectionAckWaitTimeout > 0) { + connectionAckTimeout = setTimeout(() => { + socket.close(CloseCode.ConnectionAcknowledgementTimeout, 'Connection acknowledgement timeout'); + }, connectionAckWaitTimeout); + } + enqueuePing(); // enqueue ping (noop if disabled) + } + catch (err) { + emitter.emit('error', err); + socket.close(CloseCode.InternalClientError, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Internal client error')); + } + }; + let acknowledged = false; + socket.onmessage = ({ data }) => { + try { + const message = parseMessage(data, reviver); + emitter.emit('message', message); + if (message.type === 'ping' || message.type === 'pong') { + emitter.emit(message.type, true, message.payload); // received + if (message.type === 'pong') { + enqueuePing(); // enqueue next ping (noop if disabled) + } + else if (!disablePong) { + // respond with pong on ping + socket.send(stringifyMessage(message.payload + ? { + type: MessageType.Pong, + payload: message.payload, + } + : { + type: MessageType.Pong, + // payload is completely absent if not provided + })); + emitter.emit('pong', false, message.payload); + } + return; // ping and pongs can be received whenever + } + if (acknowledged) + return; // already connected and acknowledged + if (message.type !== MessageType.ConnectionAck) + throw new Error(`First message cannot be of type ${message.type}`); + clearTimeout(connectionAckTimeout); + acknowledged = true; + emitter.emit('connected', socket, message.payload, retrying); // connected = socket opened + acknowledged + retrying = false; // future lazy connects are not retries + retries = 0; // reset the retries on connect + connected([ + socket, + new Promise((_, reject) => errorOrClosed(reject)), + ]); + } + catch (err) { + socket.onmessage = null; // stop reading messages as soon as reading breaks once + emitter.emit('error', err); + socket.close(CloseCode.BadResponse, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Bad response')); + } + }; + })()))); + // if the provided socket is in a closing state, wait for the throw on close + if (socket.readyState === WebSocketImpl.CLOSING) + await throwOnClose; + let release = () => { + // releases this connection + }; + const released = new Promise((resolve) => (release = resolve)); + return [ + socket, + release, + Promise.race([ + // wait for + released.then(() => { + if (!locks) { + // and if no more locks are present, complete the connection + const complete = () => socket.close(1000, 'Normal Closure'); + if (isFinite(lazyCloseTimeoutMs) && lazyCloseTimeoutMs > 0) { + // if the keepalive is set, allow for the specified calmdown time and + // then complete if the socket is still open. + lazyCloseTimeout = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) + complete(); + }, lazyCloseTimeoutMs); + } + else { + // otherwise complete immediately + complete(); + } + } + }), + // or + throwOnClose, + ]), + ]; + } + /** + * Checks the `connect` problem and evaluates if the client should retry. + */ + function shouldRetryConnectOrThrow(errOrCloseEvent) { + // some close codes are worth reporting immediately + if (isLikeCloseEvent(errOrCloseEvent) && + (isFatalInternalCloseCode(errOrCloseEvent.code) || + [ + CloseCode.InternalServerError, + CloseCode.InternalClientError, + CloseCode.BadRequest, + CloseCode.BadResponse, + CloseCode.Unauthorized, + // CloseCode.Forbidden, might grant access out after retry + CloseCode.SubprotocolNotAcceptable, + // CloseCode.ConnectionInitialisationTimeout, might not time out after retry + // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry + CloseCode.SubscriberAlreadyExists, + CloseCode.TooManyInitialisationRequests, + // 4499, // Terminated, probably because the socket froze, we want to retry + ].includes(errOrCloseEvent.code))) + throw errOrCloseEvent; + // client was disposed, no retries should proceed regardless + if (disposed) + return false; + // normal closure (possibly all subscriptions have completed) + // if no locks were acquired in the meantime, shouldnt try again + if (isLikeCloseEvent(errOrCloseEvent) && errOrCloseEvent.code === 1000) + return locks > 0; + // retries are not allowed or we tried to many times, report error + if (!retryAttempts || retries >= retryAttempts) + throw errOrCloseEvent; + // throw non-retryable connection problems + if (!shouldRetry(errOrCloseEvent)) + throw errOrCloseEvent; + // @deprecated throw fatal connection problems immediately + if (isFatalConnectionProblem === null || isFatalConnectionProblem === void 0 ? void 0 : isFatalConnectionProblem(errOrCloseEvent)) + throw errOrCloseEvent; + // looks good, start retrying + return (retrying = true); + } + // in non-lazy (hot?) mode always hold one connection lock to persist the socket + if (!lazy) { + (async () => { + locks++; + for (;;) { + try { + const [, , throwOnClose] = await connect(); + await throwOnClose; // will always throw because releaser is not used + } + catch (errOrCloseEvent) { + try { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + catch (errOrCloseEvent) { + // report thrown error, no further retries + return onNonLazyError === null || onNonLazyError === void 0 ? void 0 : onNonLazyError(errOrCloseEvent); + } + } + } + })(); + } + function subscribe(payload, sink) { + const id = generateID(payload); + let done = false, errored = false, releaser = () => { + // for handling completions before connect + locks--; + done = true; + }; + (async () => { + locks++; + for (;;) { + try { + const [socket, release, waitForReleaseOrThrowOnClose] = await connect(); + // if done while waiting for connect, release the connection lock right away + if (done) + return release(); + const unlisten = emitter.onMessage(id, (message) => { + switch (message.type) { + case MessageType.Next: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- payload will fit type + sink.next(message.payload); + return; + } + case MessageType.Error: { + (errored = true), (done = true); + sink.error(message.payload); + releaser(); + return; + } + case MessageType.Complete: { + done = true; + releaser(); // release completes the sink + return; + } + } + }); + socket.send(stringifyMessage({ + id, + type: MessageType.Subscribe, + payload, + }, replacer)); + releaser = () => { + if (!done && socket.readyState === WebSocketImpl.OPEN) + // if not completed already and socket is open, send complete message to server on release + socket.send(stringifyMessage({ + id, + type: MessageType.Complete, + }, replacer)); + locks--; + done = true; + release(); + }; + // either the releaser will be called, connection completed and + // the promise resolved or the socket closed and the promise rejected. + // whatever happens though, we want to stop listening for messages + await waitForReleaseOrThrowOnClose.finally(unlisten); + return; // completed, shouldnt try again + } + catch (errOrCloseEvent) { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + } + })() + .then(() => { + // delivering either an error or a complete terminates the sequence + if (!errored) + sink.complete(); + }) // resolves on release or normal closure + .catch((err) => { + sink.error(err); + }); // rejects on close events and errors + return () => { + // dispose only of active subscriptions + if (!done) + releaser(); + }; + } + return { + on: emitter.on, + subscribe, + iterate(request) { + const pending = []; + const deferred = { + done: false, + error: null, + resolve: () => { + // noop + }, + }; + const dispose = subscribe(request, { + next(val) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + pending.push(val); + deferred.resolve(); + }, + error(err) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + }, + complete() { + deferred.done = true; + deferred.resolve(); + }, + }); + const iterator = (function iterator() { + return __asyncGenerator(this, arguments, function* iterator_1() { + for (;;) { + if (!pending.length) { + // only wait if there are no pending messages available + yield __await(new Promise((resolve) => (deferred.resolve = resolve))); + } + // first flush + while (pending.length) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + yield yield __await(pending.shift()); + } + // then error + if (deferred.error) { + throw deferred.error; + } + // or complete + if (deferred.done) { + return yield __await(void 0); + } + } + }); + })(); + iterator.throw = async (err) => { + if (!deferred.done) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + } + return { done: true, value: undefined }; + }; + iterator.return = async () => { + dispose(); + return { done: true, value: undefined }; + }; + return iterator; + }, + async dispose() { + disposed = true; + if (connecting) { + // if there is a connection, close it + const [socket] = await connecting; + socket.close(1000, 'Normal Closure'); + } + }, + terminate() { + if (connecting) { + // only if there is a connection + emitter.emit('closed', new TerminatedCloseEvent()); + } + }, + }; +} +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +export class TerminatedCloseEvent extends Error { + constructor() { + super(...arguments); + this.name = 'TerminatedCloseEvent'; + this.message = '4499: Terminated'; + this.code = 4499; + this.reason = 'Terminated'; + this.wasClean = false; + } +} +function isLikeCloseEvent(val) { + return isObject(val) && 'code' in val && 'reason' in val; +} +function isFatalInternalCloseCode(code) { + if ([ + 1000, + 1001, + 1006, + 1005, + 1012, + 1013, + 1014, // Bad Gateway + ].includes(code)) + return false; + // all other internal errors are fatal + return code >= 1000 && code <= 1999; +} +function isWebSocket(val) { + return (typeof val === 'function' && + 'constructor' in val && + 'CLOSED' in val && + 'CLOSING' in val && + 'CONNECTING' in val && + 'OPEN' in val); +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/common.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/common.d.mts new file mode 100644 index 0000000..4f3d9cc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/common.d.mts @@ -0,0 +1,201 @@ +/** + * + * common + * + */ +import { GraphQLError } from 'graphql'; +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare const GRAPHQL_TRANSPORT_WS_PROTOCOL = "graphql-transport-ws"; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +export declare const DEPRECATED_GRAPHQL_WS_PROTOCOL = "graphql-ws"; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare enum CloseCode { + InternalServerError = 4500, + InternalClientError = 4005, + BadRequest = 4400, + BadResponse = 4004, + /** Tried subscribing before connect ack */ + Unauthorized = 4401, + Forbidden = 4403, + SubprotocolNotAcceptable = 4406, + ConnectionInitialisationTimeout = 4408, + ConnectionAcknowledgementTimeout = 4504, + /** Subscriber distinction is very important */ + SubscriberAlreadyExists = 4409, + TooManyInitialisationRequests = 4429 +} +/** + * ID is a string type alias representing + * the globally unique ID used for identifying + * subscriptions established by the client. + * + * @category Common + */ +export type ID = string; +/** @category Common */ +export interface Disposable { + /** Dispose of the instance and clear up resources. */ + dispose: () => void | Promise; +} +/** + * A representation of any set of values over any amount of time. + * + * @category Common + */ +export interface Sink { + /** Next value arriving. */ + next(value: T): void; + /** + * An error that has occured. Calling this function "closes" the sink. + * Besides the errors being `Error` and `readonly GraphQLError[]`, it + * can also be a `CloseEvent`, but to avoid bundling DOM typings because + * the client can run in Node env too, you should assert the close event + * type during implementation. + */ + error(error: unknown): void; + /** The sink has completed. This function "closes" the sink. */ + complete(): void; +} +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +export declare enum MessageType { + ConnectionInit = "connection_init", + ConnectionAck = "connection_ack", + Ping = "ping", + Pong = "pong", + Subscribe = "subscribe", + Next = "next", + Error = "error", + Complete = "complete" +} +/** @category Common */ +export interface ConnectionInitMessage { + readonly type: MessageType.ConnectionInit; + readonly payload?: Record; +} +/** @category Common */ +export interface ConnectionAckMessage { + readonly type: MessageType.ConnectionAck; + readonly payload?: Record; +} +/** @category Common */ +export interface PingMessage { + readonly type: MessageType.Ping; + readonly payload?: Record; +} +/** @category Common */ +export interface PongMessage { + readonly type: MessageType.Pong; + readonly payload?: Record; +} +/** @category Common */ +export interface SubscribeMessage { + readonly id: ID; + readonly type: MessageType.Subscribe; + readonly payload: SubscribePayload; +} +/** @category Common */ +export interface SubscribePayload { + readonly operationName?: string | null; + readonly query: string; + readonly variables?: Record | null; + readonly extensions?: Record | null; +} +/** @category Common */ +export interface ExecutionResult, Extensions = Record> { + errors?: ReadonlyArray; + data?: Data | null; + hasNext?: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface ExecutionPatchResult> { + errors?: ReadonlyArray; + data?: Data | null; + path?: ReadonlyArray; + label?: string; + hasNext: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface NextMessage { + readonly id: ID; + readonly type: MessageType.Next; + readonly payload: ExecutionResult | ExecutionPatchResult; +} +/** @category Common */ +export interface ErrorMessage { + readonly id: ID; + readonly type: MessageType.Error; + readonly payload: readonly GraphQLError[]; +} +/** @category Common */ +export interface CompleteMessage { + readonly id: ID; + readonly type: MessageType.Complete; +} +/** @category Common */ +export type Message = T extends MessageType.ConnectionAck ? ConnectionAckMessage : T extends MessageType.ConnectionInit ? ConnectionInitMessage : T extends MessageType.Ping ? PingMessage : T extends MessageType.Pong ? PongMessage : T extends MessageType.Subscribe ? SubscribeMessage : T extends MessageType.Next ? NextMessage : T extends MessageType.Error ? ErrorMessage : T extends MessageType.Complete ? CompleteMessage : never; +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +export declare function validateMessage(val: unknown): Message; +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +export declare function isMessage(val: unknown): val is Message; +/** + * Function for transforming values within a message during JSON parsing + * The values are produced by parsing the incoming raw JSON. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter + * + * @category Common + */ +export type JSONMessageReviver = (this: any, key: string, value: any) => any; +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +export declare function parseMessage(data: unknown, reviver?: JSONMessageReviver): Message; +/** + * Function that allows customization of the produced JSON string + * for the elements of an outgoing `Message` object. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter + * + * @category Common + */ +export type JSONMessageReplacer = (this: any, key: string, value: any) => any; +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +export declare function stringifyMessage(msg: Message, replacer?: JSONMessageReplacer): string; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/common.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/common.d.ts new file mode 100644 index 0000000..4f3d9cc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/common.d.ts @@ -0,0 +1,201 @@ +/** + * + * common + * + */ +import { GraphQLError } from 'graphql'; +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare const GRAPHQL_TRANSPORT_WS_PROTOCOL = "graphql-transport-ws"; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +export declare const DEPRECATED_GRAPHQL_WS_PROTOCOL = "graphql-ws"; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare enum CloseCode { + InternalServerError = 4500, + InternalClientError = 4005, + BadRequest = 4400, + BadResponse = 4004, + /** Tried subscribing before connect ack */ + Unauthorized = 4401, + Forbidden = 4403, + SubprotocolNotAcceptable = 4406, + ConnectionInitialisationTimeout = 4408, + ConnectionAcknowledgementTimeout = 4504, + /** Subscriber distinction is very important */ + SubscriberAlreadyExists = 4409, + TooManyInitialisationRequests = 4429 +} +/** + * ID is a string type alias representing + * the globally unique ID used for identifying + * subscriptions established by the client. + * + * @category Common + */ +export type ID = string; +/** @category Common */ +export interface Disposable { + /** Dispose of the instance and clear up resources. */ + dispose: () => void | Promise; +} +/** + * A representation of any set of values over any amount of time. + * + * @category Common + */ +export interface Sink { + /** Next value arriving. */ + next(value: T): void; + /** + * An error that has occured. Calling this function "closes" the sink. + * Besides the errors being `Error` and `readonly GraphQLError[]`, it + * can also be a `CloseEvent`, but to avoid bundling DOM typings because + * the client can run in Node env too, you should assert the close event + * type during implementation. + */ + error(error: unknown): void; + /** The sink has completed. This function "closes" the sink. */ + complete(): void; +} +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +export declare enum MessageType { + ConnectionInit = "connection_init", + ConnectionAck = "connection_ack", + Ping = "ping", + Pong = "pong", + Subscribe = "subscribe", + Next = "next", + Error = "error", + Complete = "complete" +} +/** @category Common */ +export interface ConnectionInitMessage { + readonly type: MessageType.ConnectionInit; + readonly payload?: Record; +} +/** @category Common */ +export interface ConnectionAckMessage { + readonly type: MessageType.ConnectionAck; + readonly payload?: Record; +} +/** @category Common */ +export interface PingMessage { + readonly type: MessageType.Ping; + readonly payload?: Record; +} +/** @category Common */ +export interface PongMessage { + readonly type: MessageType.Pong; + readonly payload?: Record; +} +/** @category Common */ +export interface SubscribeMessage { + readonly id: ID; + readonly type: MessageType.Subscribe; + readonly payload: SubscribePayload; +} +/** @category Common */ +export interface SubscribePayload { + readonly operationName?: string | null; + readonly query: string; + readonly variables?: Record | null; + readonly extensions?: Record | null; +} +/** @category Common */ +export interface ExecutionResult, Extensions = Record> { + errors?: ReadonlyArray; + data?: Data | null; + hasNext?: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface ExecutionPatchResult> { + errors?: ReadonlyArray; + data?: Data | null; + path?: ReadonlyArray; + label?: string; + hasNext: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface NextMessage { + readonly id: ID; + readonly type: MessageType.Next; + readonly payload: ExecutionResult | ExecutionPatchResult; +} +/** @category Common */ +export interface ErrorMessage { + readonly id: ID; + readonly type: MessageType.Error; + readonly payload: readonly GraphQLError[]; +} +/** @category Common */ +export interface CompleteMessage { + readonly id: ID; + readonly type: MessageType.Complete; +} +/** @category Common */ +export type Message = T extends MessageType.ConnectionAck ? ConnectionAckMessage : T extends MessageType.ConnectionInit ? ConnectionInitMessage : T extends MessageType.Ping ? PingMessage : T extends MessageType.Pong ? PongMessage : T extends MessageType.Subscribe ? SubscribeMessage : T extends MessageType.Next ? NextMessage : T extends MessageType.Error ? ErrorMessage : T extends MessageType.Complete ? CompleteMessage : never; +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +export declare function validateMessage(val: unknown): Message; +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +export declare function isMessage(val: unknown): val is Message; +/** + * Function for transforming values within a message during JSON parsing + * The values are produced by parsing the incoming raw JSON. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter + * + * @category Common + */ +export type JSONMessageReviver = (this: any, key: string, value: any) => any; +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +export declare function parseMessage(data: unknown, reviver?: JSONMessageReviver): Message; +/** + * Function that allows customization of the produced JSON string + * for the elements of an outgoing `Message` object. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter + * + * @category Common + */ +export type JSONMessageReplacer = (this: any, key: string, value: any) => any; +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +export declare function stringifyMessage(msg: Message, replacer?: JSONMessageReplacer): string; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/common.js b/graphql-subscription-express/node_modules/graphql-ws/lib/common.js new file mode 100644 index 0000000..135d1d4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/common.js @@ -0,0 +1,185 @@ +"use strict"; +/** + * + * common + * + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stringifyMessage = exports.parseMessage = exports.isMessage = exports.validateMessage = exports.MessageType = exports.CloseCode = exports.DEPRECATED_GRAPHQL_WS_PROTOCOL = exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = void 0; +const utils_1 = require("./utils"); +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = 'graphql-transport-ws'; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +exports.DEPRECATED_GRAPHQL_WS_PROTOCOL = 'graphql-ws'; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +var CloseCode; +(function (CloseCode) { + CloseCode[CloseCode["InternalServerError"] = 4500] = "InternalServerError"; + CloseCode[CloseCode["InternalClientError"] = 4005] = "InternalClientError"; + CloseCode[CloseCode["BadRequest"] = 4400] = "BadRequest"; + CloseCode[CloseCode["BadResponse"] = 4004] = "BadResponse"; + /** Tried subscribing before connect ack */ + CloseCode[CloseCode["Unauthorized"] = 4401] = "Unauthorized"; + CloseCode[CloseCode["Forbidden"] = 4403] = "Forbidden"; + CloseCode[CloseCode["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable"; + CloseCode[CloseCode["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout"; + CloseCode[CloseCode["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout"; + /** Subscriber distinction is very important */ + CloseCode[CloseCode["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists"; + CloseCode[CloseCode["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests"; +})(CloseCode || (exports.CloseCode = CloseCode = {})); +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +var MessageType; +(function (MessageType) { + MessageType["ConnectionInit"] = "connection_init"; + MessageType["ConnectionAck"] = "connection_ack"; + MessageType["Ping"] = "ping"; + MessageType["Pong"] = "pong"; + MessageType["Subscribe"] = "subscribe"; + MessageType["Next"] = "next"; + MessageType["Error"] = "error"; + MessageType["Complete"] = "complete"; +})(MessageType || (exports.MessageType = MessageType = {})); +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +function validateMessage(val) { + if (!(0, utils_1.isObject)(val)) { + throw new Error(`Message is expected to be an object, but got ${(0, utils_1.extendedTypeof)(val)}`); + } + if (!val.type) { + throw new Error(`Message is missing the 'type' property`); + } + if (typeof val.type !== 'string') { + throw new Error(`Message is expects the 'type' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.type)}`); + } + switch (val.type) { + case MessageType.ConnectionInit: + case MessageType.ConnectionAck: + case MessageType.Ping: + case MessageType.Pong: { + if (val.payload != null && !(0, utils_1.isObject)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${val.payload}"`); + } + break; + } + case MessageType.Subscribe: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!(0, utils_1.isObject)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${(0, utils_1.extendedTypeof)(val.payload)}`); + } + if (typeof val.payload.query !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'query' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.payload.query)}`); + } + if (val.payload.variables != null && !(0, utils_1.isObject)(val.payload.variables)) { + throw new Error(`"${val.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${(0, utils_1.extendedTypeof)(val.payload.variables)}`); + } + if (val.payload.operationName != null && + (0, utils_1.extendedTypeof)(val.payload.operationName) !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${(0, utils_1.extendedTypeof)(val.payload.operationName)}`); + } + if (val.payload.extensions != null && !(0, utils_1.isObject)(val.payload.extensions)) { + throw new Error(`"${val.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${(0, utils_1.extendedTypeof)(val.payload.extensions)}`); + } + break; + } + case MessageType.Next: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!(0, utils_1.isObject)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${(0, utils_1.extendedTypeof)(val.payload)}`); + } + break; + } + case MessageType.Error: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!(0, utils_1.areGraphQLErrors)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(val.payload)}`); + } + break; + } + case MessageType.Complete: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + break; + } + default: + throw new Error(`Invalid message 'type' property "${val.type}"`); + } + return val; +} +exports.validateMessage = validateMessage; +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +function isMessage(val) { + try { + validateMessage(val); + return true; + } + catch (_a) { + return false; + } +} +exports.isMessage = isMessage; +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +function parseMessage(data, reviver) { + return validateMessage(typeof data === 'string' ? JSON.parse(data, reviver) : data); +} +exports.parseMessage = parseMessage; +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +function stringifyMessage(msg, replacer) { + validateMessage(msg); + return JSON.stringify(msg, replacer); +} +exports.stringifyMessage = stringifyMessage; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/common.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/common.mjs new file mode 100644 index 0000000..e65e0ce --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/common.mjs @@ -0,0 +1,178 @@ +/** + * + * common + * + */ +import { areGraphQLErrors, extendedTypeof, isObject } from './utils.mjs'; +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export const GRAPHQL_TRANSPORT_WS_PROTOCOL = 'graphql-transport-ws'; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +export const DEPRECATED_GRAPHQL_WS_PROTOCOL = 'graphql-ws'; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export var CloseCode; +(function (CloseCode) { + CloseCode[CloseCode["InternalServerError"] = 4500] = "InternalServerError"; + CloseCode[CloseCode["InternalClientError"] = 4005] = "InternalClientError"; + CloseCode[CloseCode["BadRequest"] = 4400] = "BadRequest"; + CloseCode[CloseCode["BadResponse"] = 4004] = "BadResponse"; + /** Tried subscribing before connect ack */ + CloseCode[CloseCode["Unauthorized"] = 4401] = "Unauthorized"; + CloseCode[CloseCode["Forbidden"] = 4403] = "Forbidden"; + CloseCode[CloseCode["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable"; + CloseCode[CloseCode["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout"; + CloseCode[CloseCode["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout"; + /** Subscriber distinction is very important */ + CloseCode[CloseCode["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists"; + CloseCode[CloseCode["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests"; +})(CloseCode || (CloseCode = {})); +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +export var MessageType; +(function (MessageType) { + MessageType["ConnectionInit"] = "connection_init"; + MessageType["ConnectionAck"] = "connection_ack"; + MessageType["Ping"] = "ping"; + MessageType["Pong"] = "pong"; + MessageType["Subscribe"] = "subscribe"; + MessageType["Next"] = "next"; + MessageType["Error"] = "error"; + MessageType["Complete"] = "complete"; +})(MessageType || (MessageType = {})); +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +export function validateMessage(val) { + if (!isObject(val)) { + throw new Error(`Message is expected to be an object, but got ${extendedTypeof(val)}`); + } + if (!val.type) { + throw new Error(`Message is missing the 'type' property`); + } + if (typeof val.type !== 'string') { + throw new Error(`Message is expects the 'type' property to be a string, but got ${extendedTypeof(val.type)}`); + } + switch (val.type) { + case MessageType.ConnectionInit: + case MessageType.ConnectionAck: + case MessageType.Ping: + case MessageType.Pong: { + if (val.payload != null && !isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${val.payload}"`); + } + break; + } + case MessageType.Subscribe: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + if (typeof val.payload.query !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'query' property to be a string, but got ${extendedTypeof(val.payload.query)}`); + } + if (val.payload.variables != null && !isObject(val.payload.variables)) { + throw new Error(`"${val.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.variables)}`); + } + if (val.payload.operationName != null && + extendedTypeof(val.payload.operationName) !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${extendedTypeof(val.payload.operationName)}`); + } + if (val.payload.extensions != null && !isObject(val.payload.extensions)) { + throw new Error(`"${val.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.extensions)}`); + } + break; + } + case MessageType.Next: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + break; + } + case MessageType.Error: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!areGraphQLErrors(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(val.payload)}`); + } + break; + } + case MessageType.Complete: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + break; + } + default: + throw new Error(`Invalid message 'type' property "${val.type}"`); + } + return val; +} +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +export function isMessage(val) { + try { + validateMessage(val); + return true; + } + catch (_a) { + return false; + } +} +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +export function parseMessage(data, reviver) { + return validateMessage(typeof data === 'string' ? JSON.parse(data, reviver) : data); +} +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +export function stringifyMessage(msg, replacer) { + validateMessage(msg); + return JSON.stringify(msg, replacer); +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/index.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/index.d.mts new file mode 100644 index 0000000..bd2eb71 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/index.d.mts @@ -0,0 +1,3 @@ +export * from './client.mjs'; +export * from './server.mjs'; +export * from './common.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/index.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/index.d.ts new file mode 100644 index 0000000..1bb4712 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/index.d.ts @@ -0,0 +1,3 @@ +export * from './client'; +export * from './server'; +export * from './common'; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/index.js b/graphql-subscription-express/node_modules/graphql-ws/lib/index.js new file mode 100644 index 0000000..8d08c8b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/index.js @@ -0,0 +1,19 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./client"), exports); +__exportStar(require("./server"), exports); +__exportStar(require("./common"), exports); diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/index.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/index.mjs new file mode 100644 index 0000000..bd2eb71 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/index.mjs @@ -0,0 +1,3 @@ +export * from './client.mjs'; +export * from './server.mjs'; +export * from './common.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/server.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/server.d.mts new file mode 100644 index 0000000..600273b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/server.d.mts @@ -0,0 +1,417 @@ +/** + * + * server + * + */ +import { OperationTypeNode, GraphQLSchema, ExecutionArgs, validate as graphqlValidate, GraphQLError, SubscriptionArgs } from 'graphql'; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, ID, ConnectionInitMessage, SubscribeMessage, NextMessage, ErrorMessage, CompleteMessage, JSONMessageReplacer, JSONMessageReviver, PingMessage, PongMessage, ExecutionResult, ExecutionPatchResult } from './common.mjs'; +/** @category Server */ +export type OperationResult = Promise | AsyncIterable | ExecutionResult> | AsyncGenerator | AsyncIterable | ExecutionResult; +/** + * A concrete GraphQL execution context value type. + * + * Mainly used because TypeScript collapses unions + * with `any` or `unknown` to `any` or `unknown`. So, + * we use a custom type to allow definitions such as + * the `context` server option. + * + * @category Server + */ +export type GraphQLExecutionContextValue = object | symbol | number | string | boolean | undefined | null; +/** @category Server */ +export interface ServerOptions

{ + /** + * The GraphQL schema on which the operations + * will be executed and validated against. + * + * If a function is provided, it will be called on + * every subscription request allowing you to manipulate + * schema dynamically. + * + * If the schema is left undefined, you're trusted to + * provide one in the returned `ExecutionArgs` from the + * `onSubscribe` callback. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + schema?: GraphQLSchema | ((ctx: Context, message: SubscribeMessage, args: Omit) => Promise | GraphQLSchema); + /** + * A value which is provided to every resolver and holds + * important contextual information like the currently + * logged in user, or access to a database. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `contextValue` field, this context will be used + * instead. + * + * If you use the function signature, the final execution arguments + * will be passed in (also the returned value from `onSubscribe`). + * Since the context is injected on every subscribe, the `SubscribeMessage` + * with the regular `Context` will be passed in through the arguments too. + * + * Note that the context function is invoked on each operation only once. + * Meaning, for subscriptions, only at the point of initialising the subscription; + * not on every subscription event emission. Read more about the context lifecycle + * in subscriptions here: https://github.com/graphql/graphql-js/issues/894. + */ + context?: GraphQLExecutionContextValue | ((ctx: Context, message: SubscribeMessage, args: ExecutionArgs) => Promise | GraphQLExecutionContextValue); + /** + * The GraphQL root fields or resolvers to go + * alongside the schema. Learn more about them + * here: https://graphql.org/learn/execution/#root-fields-resolvers. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `rootValue` field, the relevant operation root + * will be used instead. + */ + roots?: { + [operation in OperationTypeNode]?: Record>; + }; + /** + * A custom GraphQL validate function allowing you to apply your + * own validation rules. + * + * Returned, non-empty, array of `GraphQLError`s will be communicated + * to the client through the `ErrorMessage`. Use an empty array if the + * document is valid and no errors have been encountered. + * + * Will not be used when implementing a custom `onSubscribe`. + * + * Throwing an error from within this function will close the socket + * with the `Error` message in the close event reason. + */ + validate?: typeof graphqlValidate; + /** + * Is the `execute` function from GraphQL which is + * used to execute the query and mutation operations. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + execute?: (args: ExecutionArgs) => OperationResult; + /** + * Is the `subscribe` function from GraphQL which is + * used to execute the subscription operation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + subscribe?: (args: ExecutionArgs) => OperationResult; + /** + * The amount of time for which the server will wait + * for `ConnectionInit` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the client + * has not sent the `ConnectionInit` message, + * the server will terminate the socket by + * dispatching a close event `4408: Connection initialisation timeout` + * + * @default 3_000 // 3 seconds + */ + connectionInitWaitTimeout?: number; + /** + * Is the connection callback called when the + * client requests the connection initialisation + * through the message `ConnectionInit`. + * + * The message payload (`connectionParams` from the + * client) is present in the `Context.connectionParams`. + * + * - Returning `true` or nothing from the callback will + * allow the client to connect. + * + * - Returning `false` from the callback will + * terminate the socket by dispatching the + * close event `4403: Forbidden`. + * + * - Returning a `Record` from the callback will + * allow the client to connect and pass the returned + * value to the client through the optional `payload` + * field in the `ConnectionAck` message. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onConnect?: (ctx: Context) => Promise | boolean | void> | Record | boolean | void; + /** + * Called when the client disconnects for whatever reason after + * he successfully went through the connection initialisation phase. + * Provides the close event too. Beware that this callback happens + * AFTER all subscriptions have been gracefully completed and BEFORE + * the `onClose` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * This callback will be called EXCLUSIVELY if the client connection + * is acknowledged. Meaning, `onConnect` will be called before the `onDisconnect`. + * + * For tracking socket closures at any point in time, regardless + * of the connection state - consider using the `onClose` callback. + */ + onDisconnect?: (ctx: Context, code?: number, reason?: string) => Promise | void; + /** + * Called when the socket closes for whatever reason, at any + * point in time. Provides the close event too. Beware + * that this callback happens AFTER all subscriptions have + * been gracefully completed and AFTER the `onDisconnect` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * In comparison to `onDisconnect`, this callback will ALWAYS + * be called, regardless if the user successfully went through + * the connection initialisation or not. `onConnect` might not + * called before the `onClose`. + */ + onClose?: (ctx: Context, code?: number, reason?: string) => Promise | void; + /** + * The subscribe callback executed right after + * acknowledging the request before any payload + * processing has been performed. + * + * If you return `ExecutionArgs` from the callback, + * it will be used instead of trying to build one + * internally. In this case, you are responsible + * for providing a ready set of arguments which will + * be directly plugged in the operation execution. + * + * Omitting the fields `contextValue` or `rootValue` + * from the returned value will have the provided server + * options fill in the gaps. + * + * To report GraphQL errors simply return an array + * of them from the callback, they will be reported + * to the client through the error message. + * + * Useful for preparing the execution arguments + * following a custom logic. A typical use case are + * persisted queries, you can identify the query from + * the subscribe message and create the GraphQL operation + * execution args which are then returned by the function. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onSubscribe?: (ctx: Context, message: SubscribeMessage) => Promise | ExecutionArgs | readonly GraphQLError[] | void; + /** + * Executed after the operation call resolves. For streaming + * operations, triggering this callback does not necessarily + * mean that there is already a result available - it means + * that the subscription process for the stream has resolved + * and that the client is now subscribed. + * + * The `OperationResult` argument is the result of operation + * execution. It can be an iterator or already a value. + * + * If you want the single result and the events from a streaming + * operation, use the `onNext` callback. + * + * Use this callback to listen for subscribe operation and + * execution result manipulation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onOperation?: (ctx: Context, message: SubscribeMessage, args: ExecutionArgs, result: OperationResult) => Promise | OperationResult | void; + /** + * Executed after an error occurred right before it + * has been dispatched to the client. + * + * Use this callback to format the outgoing GraphQL + * errors before they reach the client. + * + * Returned result will be injected in the error message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onError?: (ctx: Context, message: ErrorMessage, errors: readonly GraphQLError[]) => Promise | readonly GraphQLError[] | void; + /** + * Executed after an operation has emitted a result right before + * that result has been sent to the client. Results from both + * single value and streaming operations will appear in this callback. + * + * Use this callback if you want to format the execution result + * before it reaches the client. + * + * Returned result will be injected in the next message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onNext?: (ctx: Context, message: NextMessage, args: ExecutionArgs, result: ExecutionResult | ExecutionPatchResult) => Promise | ExecutionResult | ExecutionPatchResult | void; + /** + * The complete callback is executed after the + * operation has completed right before sending + * the complete message to the client. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + * + * Since the library makes sure to complete streaming + * operations even after an abrupt closure, this callback + * will still be called. + */ + onComplete?: (ctx: Context, message: CompleteMessage) => Promise | void; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this server. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages to from server. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Server */ +export interface Server { + /** + * New socket has been established. The lib will validate + * the protocol and use the socket accordingly. Returned promise + * will resolve after the socket closes. + * + * The second argument will be passed in the `extra` field + * of the `Context`. You may pass the initial request or the + * original WebSocket, if you need it down the road. + * + * Returns a function that should be called when the same socket + * has been closed, for whatever reason. The close code and reason + * must be passed for reporting to the `onDisconnect` callback. Returned + * promise will resolve once the internal cleanup is complete. + */ + opened(socket: WebSocket, ctxExtra: E): (code?: number, reason?: string) => Promise; +} +/** @category Server */ +export interface WebSocket { + /** + * The subprotocol of the WebSocket. Will be used + * to validate against the supported ones. + */ + readonly protocol: string; + /** + * Sends a message through the socket. Will always + * provide a `string` message. + * + * Please take care that the send is ready. Meaning, + * only provide a truly OPEN socket through the `opened` + * method of the `Server`. + * + * The returned promise is used to control the flow of data + * (like handling backpressure). + */ + send(data: string): Promise | void; + /** + * Closes the socket gracefully. Will always provide + * the appropriate code and close reason. `onDisconnect` + * callback will be called. + * + * The returned promise is used to control the graceful + * closure. + */ + close(code: number, reason: string): Promise | void; + /** + * Called when message is received. The library requires the data + * to be a `string`. + * + * All operations requested from the client will block the promise until + * completed, this means that the callback will not resolve until all + * subscription events have been emitted (or until the client has completed + * the stream), or until the query/mutation resolves. + * + * Exceptions raised during any phase of operation processing will + * reject the callback's promise, catch them and communicate them + * to your clients however you wish. + */ + onMessage(cb: (data: string) => Promise): void; + /** + * Implement a listener for the `PingMessage` sent from the client to the server. + * If the client sent the ping with a payload, it will be passed through the + * first argument. + * + * If this listener is implemented, the server will NOT automatically reply + * to any pings from the client. Implementing it makes it your responsibility + * to decide how and when to respond. + */ + onPing?(payload: PingMessage['payload']): Promise | void; + /** + * Implement a listener for the `PongMessage` sent from the client to the server. + * If the client sent the pong with a payload, it will be passed through the + * first argument. + */ + onPong?(payload: PongMessage['payload']): Promise | void; +} +/** @category Server */ +export interface Context

{ + /** + * Indicates that the `ConnectionInit` message + * has been received by the server. If this is + * `true`, the client wont be kicked off after + * the wait timeout has passed. + */ + readonly connectionInitReceived: boolean; + /** + * Indicates that the connection was acknowledged + * by having dispatched the `ConnectionAck` message + * to the related client. + */ + readonly acknowledged: boolean; + /** The parameters passed during the connection initialisation. */ + readonly connectionParams?: Readonly

; + /** + * Holds the active subscriptions for this context. **All operations** + * that are taking place are aggregated here. The user is _subscribed_ + * to an operation when waiting for result(s). + * + * If the subscription behind an ID is an `AsyncIterator` - the operation + * is streaming; on the contrary, if the subscription is `null` - it is simply + * a reservation, meaning - the operation resolves to a single result or is still + * pending/being prepared. + */ + readonly subscriptions: Record | AsyncIterable | null>; + /** + * An extra field where you can store your own context values + * to pass between callbacks. + */ + extra: E; +} +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +export declare function makeServer

(options: ServerOptions): Server; +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +export declare function handleProtocols(protocols: Set | string[] | string): typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/server.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/server.d.ts new file mode 100644 index 0000000..0afbf0b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/server.d.ts @@ -0,0 +1,417 @@ +/** + * + * server + * + */ +import { OperationTypeNode, GraphQLSchema, ExecutionArgs, validate as graphqlValidate, GraphQLError, SubscriptionArgs } from 'graphql'; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, ID, ConnectionInitMessage, SubscribeMessage, NextMessage, ErrorMessage, CompleteMessage, JSONMessageReplacer, JSONMessageReviver, PingMessage, PongMessage, ExecutionResult, ExecutionPatchResult } from './common'; +/** @category Server */ +export type OperationResult = Promise | AsyncIterable | ExecutionResult> | AsyncGenerator | AsyncIterable | ExecutionResult; +/** + * A concrete GraphQL execution context value type. + * + * Mainly used because TypeScript collapses unions + * with `any` or `unknown` to `any` or `unknown`. So, + * we use a custom type to allow definitions such as + * the `context` server option. + * + * @category Server + */ +export type GraphQLExecutionContextValue = object | symbol | number | string | boolean | undefined | null; +/** @category Server */ +export interface ServerOptions

{ + /** + * The GraphQL schema on which the operations + * will be executed and validated against. + * + * If a function is provided, it will be called on + * every subscription request allowing you to manipulate + * schema dynamically. + * + * If the schema is left undefined, you're trusted to + * provide one in the returned `ExecutionArgs` from the + * `onSubscribe` callback. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + schema?: GraphQLSchema | ((ctx: Context, message: SubscribeMessage, args: Omit) => Promise | GraphQLSchema); + /** + * A value which is provided to every resolver and holds + * important contextual information like the currently + * logged in user, or access to a database. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `contextValue` field, this context will be used + * instead. + * + * If you use the function signature, the final execution arguments + * will be passed in (also the returned value from `onSubscribe`). + * Since the context is injected on every subscribe, the `SubscribeMessage` + * with the regular `Context` will be passed in through the arguments too. + * + * Note that the context function is invoked on each operation only once. + * Meaning, for subscriptions, only at the point of initialising the subscription; + * not on every subscription event emission. Read more about the context lifecycle + * in subscriptions here: https://github.com/graphql/graphql-js/issues/894. + */ + context?: GraphQLExecutionContextValue | ((ctx: Context, message: SubscribeMessage, args: ExecutionArgs) => Promise | GraphQLExecutionContextValue); + /** + * The GraphQL root fields or resolvers to go + * alongside the schema. Learn more about them + * here: https://graphql.org/learn/execution/#root-fields-resolvers. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `rootValue` field, the relevant operation root + * will be used instead. + */ + roots?: { + [operation in OperationTypeNode]?: Record>; + }; + /** + * A custom GraphQL validate function allowing you to apply your + * own validation rules. + * + * Returned, non-empty, array of `GraphQLError`s will be communicated + * to the client through the `ErrorMessage`. Use an empty array if the + * document is valid and no errors have been encountered. + * + * Will not be used when implementing a custom `onSubscribe`. + * + * Throwing an error from within this function will close the socket + * with the `Error` message in the close event reason. + */ + validate?: typeof graphqlValidate; + /** + * Is the `execute` function from GraphQL which is + * used to execute the query and mutation operations. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + execute?: (args: ExecutionArgs) => OperationResult; + /** + * Is the `subscribe` function from GraphQL which is + * used to execute the subscription operation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + subscribe?: (args: ExecutionArgs) => OperationResult; + /** + * The amount of time for which the server will wait + * for `ConnectionInit` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the client + * has not sent the `ConnectionInit` message, + * the server will terminate the socket by + * dispatching a close event `4408: Connection initialisation timeout` + * + * @default 3_000 // 3 seconds + */ + connectionInitWaitTimeout?: number; + /** + * Is the connection callback called when the + * client requests the connection initialisation + * through the message `ConnectionInit`. + * + * The message payload (`connectionParams` from the + * client) is present in the `Context.connectionParams`. + * + * - Returning `true` or nothing from the callback will + * allow the client to connect. + * + * - Returning `false` from the callback will + * terminate the socket by dispatching the + * close event `4403: Forbidden`. + * + * - Returning a `Record` from the callback will + * allow the client to connect and pass the returned + * value to the client through the optional `payload` + * field in the `ConnectionAck` message. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onConnect?: (ctx: Context) => Promise | boolean | void> | Record | boolean | void; + /** + * Called when the client disconnects for whatever reason after + * he successfully went through the connection initialisation phase. + * Provides the close event too. Beware that this callback happens + * AFTER all subscriptions have been gracefully completed and BEFORE + * the `onClose` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * This callback will be called EXCLUSIVELY if the client connection + * is acknowledged. Meaning, `onConnect` will be called before the `onDisconnect`. + * + * For tracking socket closures at any point in time, regardless + * of the connection state - consider using the `onClose` callback. + */ + onDisconnect?: (ctx: Context, code?: number, reason?: string) => Promise | void; + /** + * Called when the socket closes for whatever reason, at any + * point in time. Provides the close event too. Beware + * that this callback happens AFTER all subscriptions have + * been gracefully completed and AFTER the `onDisconnect` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * In comparison to `onDisconnect`, this callback will ALWAYS + * be called, regardless if the user successfully went through + * the connection initialisation or not. `onConnect` might not + * called before the `onClose`. + */ + onClose?: (ctx: Context, code?: number, reason?: string) => Promise | void; + /** + * The subscribe callback executed right after + * acknowledging the request before any payload + * processing has been performed. + * + * If you return `ExecutionArgs` from the callback, + * it will be used instead of trying to build one + * internally. In this case, you are responsible + * for providing a ready set of arguments which will + * be directly plugged in the operation execution. + * + * Omitting the fields `contextValue` or `rootValue` + * from the returned value will have the provided server + * options fill in the gaps. + * + * To report GraphQL errors simply return an array + * of them from the callback, they will be reported + * to the client through the error message. + * + * Useful for preparing the execution arguments + * following a custom logic. A typical use case are + * persisted queries, you can identify the query from + * the subscribe message and create the GraphQL operation + * execution args which are then returned by the function. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onSubscribe?: (ctx: Context, message: SubscribeMessage) => Promise | ExecutionArgs | readonly GraphQLError[] | void; + /** + * Executed after the operation call resolves. For streaming + * operations, triggering this callback does not necessarily + * mean that there is already a result available - it means + * that the subscription process for the stream has resolved + * and that the client is now subscribed. + * + * The `OperationResult` argument is the result of operation + * execution. It can be an iterator or already a value. + * + * If you want the single result and the events from a streaming + * operation, use the `onNext` callback. + * + * Use this callback to listen for subscribe operation and + * execution result manipulation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onOperation?: (ctx: Context, message: SubscribeMessage, args: ExecutionArgs, result: OperationResult) => Promise | OperationResult | void; + /** + * Executed after an error occurred right before it + * has been dispatched to the client. + * + * Use this callback to format the outgoing GraphQL + * errors before they reach the client. + * + * Returned result will be injected in the error message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onError?: (ctx: Context, message: ErrorMessage, errors: readonly GraphQLError[]) => Promise | readonly GraphQLError[] | void; + /** + * Executed after an operation has emitted a result right before + * that result has been sent to the client. Results from both + * single value and streaming operations will appear in this callback. + * + * Use this callback if you want to format the execution result + * before it reaches the client. + * + * Returned result will be injected in the next message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onNext?: (ctx: Context, message: NextMessage, args: ExecutionArgs, result: ExecutionResult | ExecutionPatchResult) => Promise | ExecutionResult | ExecutionPatchResult | void; + /** + * The complete callback is executed after the + * operation has completed right before sending + * the complete message to the client. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + * + * Since the library makes sure to complete streaming + * operations even after an abrupt closure, this callback + * will still be called. + */ + onComplete?: (ctx: Context, message: CompleteMessage) => Promise | void; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this server. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages to from server. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Server */ +export interface Server { + /** + * New socket has been established. The lib will validate + * the protocol and use the socket accordingly. Returned promise + * will resolve after the socket closes. + * + * The second argument will be passed in the `extra` field + * of the `Context`. You may pass the initial request or the + * original WebSocket, if you need it down the road. + * + * Returns a function that should be called when the same socket + * has been closed, for whatever reason. The close code and reason + * must be passed for reporting to the `onDisconnect` callback. Returned + * promise will resolve once the internal cleanup is complete. + */ + opened(socket: WebSocket, ctxExtra: E): (code?: number, reason?: string) => Promise; +} +/** @category Server */ +export interface WebSocket { + /** + * The subprotocol of the WebSocket. Will be used + * to validate against the supported ones. + */ + readonly protocol: string; + /** + * Sends a message through the socket. Will always + * provide a `string` message. + * + * Please take care that the send is ready. Meaning, + * only provide a truly OPEN socket through the `opened` + * method of the `Server`. + * + * The returned promise is used to control the flow of data + * (like handling backpressure). + */ + send(data: string): Promise | void; + /** + * Closes the socket gracefully. Will always provide + * the appropriate code and close reason. `onDisconnect` + * callback will be called. + * + * The returned promise is used to control the graceful + * closure. + */ + close(code: number, reason: string): Promise | void; + /** + * Called when message is received. The library requires the data + * to be a `string`. + * + * All operations requested from the client will block the promise until + * completed, this means that the callback will not resolve until all + * subscription events have been emitted (or until the client has completed + * the stream), or until the query/mutation resolves. + * + * Exceptions raised during any phase of operation processing will + * reject the callback's promise, catch them and communicate them + * to your clients however you wish. + */ + onMessage(cb: (data: string) => Promise): void; + /** + * Implement a listener for the `PingMessage` sent from the client to the server. + * If the client sent the ping with a payload, it will be passed through the + * first argument. + * + * If this listener is implemented, the server will NOT automatically reply + * to any pings from the client. Implementing it makes it your responsibility + * to decide how and when to respond. + */ + onPing?(payload: PingMessage['payload']): Promise | void; + /** + * Implement a listener for the `PongMessage` sent from the client to the server. + * If the client sent the pong with a payload, it will be passed through the + * first argument. + */ + onPong?(payload: PongMessage['payload']): Promise | void; +} +/** @category Server */ +export interface Context

{ + /** + * Indicates that the `ConnectionInit` message + * has been received by the server. If this is + * `true`, the client wont be kicked off after + * the wait timeout has passed. + */ + readonly connectionInitReceived: boolean; + /** + * Indicates that the connection was acknowledged + * by having dispatched the `ConnectionAck` message + * to the related client. + */ + readonly acknowledged: boolean; + /** The parameters passed during the connection initialisation. */ + readonly connectionParams?: Readonly

; + /** + * Holds the active subscriptions for this context. **All operations** + * that are taking place are aggregated here. The user is _subscribed_ + * to an operation when waiting for result(s). + * + * If the subscription behind an ID is an `AsyncIterator` - the operation + * is streaming; on the contrary, if the subscription is `null` - it is simply + * a reservation, meaning - the operation resolves to a single result or is still + * pending/being prepared. + */ + readonly subscriptions: Record | AsyncIterable | null>; + /** + * An extra field where you can store your own context values + * to pass between callbacks. + */ + extra: E; +} +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +export declare function makeServer

(options: ServerOptions): Server; +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +export declare function handleProtocols(protocols: Set | string[] | string): typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/server.js b/graphql-subscription-express/node_modules/graphql-ws/lib/server.js new file mode 100644 index 0000000..02e7100 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/server.js @@ -0,0 +1,309 @@ +"use strict"; +/** + * + * server + * + */ +var __asyncValues = (this && this.__asyncValues) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handleProtocols = exports.makeServer = void 0; +const graphql_1 = require("graphql"); +const common_1 = require("./common"); +const utils_1 = require("./utils"); +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +function makeServer(options) { + const { schema, context, roots, validate, execute, subscribe, connectionInitWaitTimeout = 3000, // 3 seconds + onConnect, onDisconnect, onClose, onSubscribe, onOperation, onNext, onError, onComplete, jsonMessageReviver: reviver, jsonMessageReplacer: replacer, } = options; + return { + opened(socket, extra) { + const ctx = { + connectionInitReceived: false, + acknowledged: false, + subscriptions: {}, + extra, + }; + if (socket.protocol !== common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL) { + socket.close(common_1.CloseCode.SubprotocolNotAcceptable, 'Subprotocol not acceptable'); + return async (code, reason) => { + /* nothing was set up, just notify the closure */ + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + } + // kick the client off (close socket) if the connection has + // not been initialised after the specified wait timeout + const connectionInitWait = connectionInitWaitTimeout > 0 && isFinite(connectionInitWaitTimeout) + ? setTimeout(() => { + if (!ctx.connectionInitReceived) + socket.close(common_1.CloseCode.ConnectionInitialisationTimeout, 'Connection initialisation timeout'); + }, connectionInitWaitTimeout) + : null; + socket.onMessage(async function onMessage(data) { + var _a, e_1, _b, _c; + var _d; + let message; + try { + message = (0, common_1.parseMessage)(data, reviver); + } + catch (err) { + return socket.close(common_1.CloseCode.BadRequest, 'Invalid message received'); + } + switch (message.type) { + case common_1.MessageType.ConnectionInit: { + if (ctx.connectionInitReceived) + return socket.close(common_1.CloseCode.TooManyInitialisationRequests, 'Too many initialisation requests'); + // @ts-expect-error: I can write + ctx.connectionInitReceived = true; + if ((0, utils_1.isObject)(message.payload)) + // @ts-expect-error: I can write + ctx.connectionParams = message.payload; + const permittedOrPayload = await (onConnect === null || onConnect === void 0 ? void 0 : onConnect(ctx)); + if (permittedOrPayload === false) + return socket.close(common_1.CloseCode.Forbidden, 'Forbidden'); + // we should acknowledge before send to avoid race conditions (like those exampled in https://github.com/enisdenjo/graphql-ws/issues/501) + // even if the send fails/throws, the connection should be closed because its malfunctioning + // @ts-expect-error: I can write + ctx.acknowledged = true; + await socket.send((0, common_1.stringifyMessage)((0, utils_1.isObject)(permittedOrPayload) + ? { + type: common_1.MessageType.ConnectionAck, + payload: permittedOrPayload, + } + : { + type: common_1.MessageType.ConnectionAck, + // payload is completely absent if not provided + }, replacer)); + return; + } + case common_1.MessageType.Ping: { + if (socket.onPing) + // if the onPing listener is registered, automatic pong is disabled + return await socket.onPing(message.payload); + await socket.send((0, common_1.stringifyMessage)(message.payload + ? { type: common_1.MessageType.Pong, payload: message.payload } + : { + type: common_1.MessageType.Pong, + // payload is completely absent if not provided + })); + return; + } + case common_1.MessageType.Pong: + return await ((_d = socket.onPong) === null || _d === void 0 ? void 0 : _d.call(socket, message.payload)); + case common_1.MessageType.Subscribe: { + if (!ctx.acknowledged) + return socket.close(common_1.CloseCode.Unauthorized, 'Unauthorized'); + const { id, payload } = message; + if (id in ctx.subscriptions) + return socket.close(common_1.CloseCode.SubscriberAlreadyExists, `Subscriber for ${id} already exists`); + // if this turns out to be a streaming operation, the subscription value + // will change to an `AsyncIterable`, otherwise it will stay as is + ctx.subscriptions[id] = null; + const emit = { + next: async (result, args) => { + let nextMessage = { + id, + type: common_1.MessageType.Next, + payload: result, + }; + const maybeResult = await (onNext === null || onNext === void 0 ? void 0 : onNext(ctx, nextMessage, args, result)); + if (maybeResult) + nextMessage = Object.assign(Object.assign({}, nextMessage), { payload: maybeResult }); + await socket.send((0, common_1.stringifyMessage)(nextMessage, replacer)); + }, + error: async (errors) => { + let errorMessage = { + id, + type: common_1.MessageType.Error, + payload: errors, + }; + const maybeErrors = await (onError === null || onError === void 0 ? void 0 : onError(ctx, errorMessage, errors)); + if (maybeErrors) + errorMessage = Object.assign(Object.assign({}, errorMessage), { payload: maybeErrors }); + await socket.send((0, common_1.stringifyMessage)(errorMessage, replacer)); + }, + complete: async (notifyClient) => { + const completeMessage = { + id, + type: common_1.MessageType.Complete, + }; + await (onComplete === null || onComplete === void 0 ? void 0 : onComplete(ctx, completeMessage)); + if (notifyClient) + await socket.send((0, common_1.stringifyMessage)(completeMessage, replacer)); + }, + }; + try { + let execArgs; + const maybeExecArgsOrErrors = await (onSubscribe === null || onSubscribe === void 0 ? void 0 : onSubscribe(ctx, message)); + if (maybeExecArgsOrErrors) { + if ((0, utils_1.areGraphQLErrors)(maybeExecArgsOrErrors)) + return id in ctx.subscriptions + ? await emit.error(maybeExecArgsOrErrors) + : void 0; + else if (Array.isArray(maybeExecArgsOrErrors)) + throw new Error('Invalid return value from onSubscribe hook, expected an array of GraphQLError objects'); + // not errors, is exec args + execArgs = maybeExecArgsOrErrors; + } + else { + // you either provide a schema dynamically through + // `onSubscribe` or you set one up during the server setup + if (!schema) + throw new Error('The GraphQL schema is not provided'); + const args = { + operationName: payload.operationName, + document: (0, graphql_1.parse)(payload.query), + variableValues: payload.variables, + }; + execArgs = Object.assign(Object.assign({}, args), { schema: typeof schema === 'function' + ? await schema(ctx, message, args) + : schema }); + const validationErrors = (validate !== null && validate !== void 0 ? validate : graphql_1.validate)(execArgs.schema, execArgs.document); + if (validationErrors.length > 0) + return id in ctx.subscriptions + ? await emit.error(validationErrors) + : void 0; + } + const operationAST = (0, graphql_1.getOperationAST)(execArgs.document, execArgs.operationName); + if (!operationAST) + return id in ctx.subscriptions + ? await emit.error([ + new graphql_1.GraphQLError('Unable to identify operation'), + ]) + : void 0; + // if `onSubscribe` didn't specify a rootValue, inject one + if (!('rootValue' in execArgs)) + execArgs.rootValue = roots === null || roots === void 0 ? void 0 : roots[operationAST.operation]; + // if `onSubscribe` didn't specify a context, inject one + if (!('contextValue' in execArgs)) + execArgs.contextValue = + typeof context === 'function' + ? await context(ctx, message, execArgs) + : context; + // the execution arguments have been prepared + // perform the operation and act accordingly + let operationResult; + if (operationAST.operation === 'subscription') + operationResult = await (subscribe !== null && subscribe !== void 0 ? subscribe : graphql_1.subscribe)(execArgs); + // operation === 'query' || 'mutation' + else + operationResult = await (execute !== null && execute !== void 0 ? execute : graphql_1.execute)(execArgs); + const maybeResult = await (onOperation === null || onOperation === void 0 ? void 0 : onOperation(ctx, message, execArgs, operationResult)); + if (maybeResult) + operationResult = maybeResult; + if ((0, utils_1.isAsyncIterable)(operationResult)) { + /** multiple emitted results */ + if (!(id in ctx.subscriptions)) { + // subscription was completed/canceled before the operation settled + if ((0, utils_1.isAsyncGenerator)(operationResult)) + operationResult.return(undefined); + } + else { + ctx.subscriptions[id] = operationResult; + try { + for (var _e = true, operationResult_1 = __asyncValues(operationResult), operationResult_1_1; operationResult_1_1 = await operationResult_1.next(), _a = operationResult_1_1.done, !_a; _e = true) { + _c = operationResult_1_1.value; + _e = false; + const result = _c; + await emit.next(result, execArgs); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (!_e && !_a && (_b = operationResult_1.return)) await _b.call(operationResult_1); + } + finally { if (e_1) throw e_1.error; } + } + } + } + else { + /** single emitted result */ + // if the client completed the subscription before the single result + // became available, he effectively canceled it and no data should be sent + if (id in ctx.subscriptions) + await emit.next(operationResult, execArgs); + } + // lack of subscription at this point indicates that the client + // completed the subscription, he doesn't need to be reminded + await emit.complete(id in ctx.subscriptions); + } + finally { + // whatever happens to the subscription, we finally want to get rid of the reservation + delete ctx.subscriptions[id]; + } + return; + } + case common_1.MessageType.Complete: { + const subscription = ctx.subscriptions[message.id]; + delete ctx.subscriptions[message.id]; // deleting the subscription means no further activity should take place + if ((0, utils_1.isAsyncGenerator)(subscription)) + await subscription.return(undefined); + return; + } + default: + throw new Error(`Unexpected message of type ${message.type} received`); + } + }); + // wait for close, cleanup and the disconnect callback + return async (code, reason) => { + if (connectionInitWait) + clearTimeout(connectionInitWait); + const subs = Object.assign({}, ctx.subscriptions); + // @ts-expect-error: I can write + ctx.subscriptions = {}; // deleting the subscription means no further activity should take place + // we return all iterable subscriptions immediatelly, independant of the order + await Promise.all(Object.values(subs) + .filter(utils_1.isAsyncGenerator) + .map((sub) => sub.return(undefined))); + if (ctx.acknowledged) + await (onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect(ctx, code, reason)); + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + }, + }; +} +exports.makeServer = makeServer; +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +function handleProtocols(protocols) { + switch (true) { + case protocols instanceof Set && + protocols.has(common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL): + case Array.isArray(protocols) && + protocols.includes(common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL): + case typeof protocols === 'string' && + protocols + .split(',') + .map((p) => p.trim()) + .includes(common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL): + return common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL; + default: + return false; + } +} +exports.handleProtocols = handleProtocols; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/server.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/server.mjs new file mode 100644 index 0000000..26d9897 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/server.mjs @@ -0,0 +1,304 @@ +/** + * + * server + * + */ +var __asyncValues = (this && this.__asyncValues) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +}; +import { parse, validate as graphqlValidate, execute as graphqlExecute, subscribe as graphqlSubscribe, getOperationAST, GraphQLError, } from 'graphql'; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, CloseCode, MessageType, stringifyMessage, parseMessage, } from './common.mjs'; +import { isObject, isAsyncGenerator, isAsyncIterable, areGraphQLErrors, } from './utils.mjs'; +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +export function makeServer(options) { + const { schema, context, roots, validate, execute, subscribe, connectionInitWaitTimeout = 3000, // 3 seconds + onConnect, onDisconnect, onClose, onSubscribe, onOperation, onNext, onError, onComplete, jsonMessageReviver: reviver, jsonMessageReplacer: replacer, } = options; + return { + opened(socket, extra) { + const ctx = { + connectionInitReceived: false, + acknowledged: false, + subscriptions: {}, + extra, + }; + if (socket.protocol !== GRAPHQL_TRANSPORT_WS_PROTOCOL) { + socket.close(CloseCode.SubprotocolNotAcceptable, 'Subprotocol not acceptable'); + return async (code, reason) => { + /* nothing was set up, just notify the closure */ + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + } + // kick the client off (close socket) if the connection has + // not been initialised after the specified wait timeout + const connectionInitWait = connectionInitWaitTimeout > 0 && isFinite(connectionInitWaitTimeout) + ? setTimeout(() => { + if (!ctx.connectionInitReceived) + socket.close(CloseCode.ConnectionInitialisationTimeout, 'Connection initialisation timeout'); + }, connectionInitWaitTimeout) + : null; + socket.onMessage(async function onMessage(data) { + var _a, e_1, _b, _c; + var _d; + let message; + try { + message = parseMessage(data, reviver); + } + catch (err) { + return socket.close(CloseCode.BadRequest, 'Invalid message received'); + } + switch (message.type) { + case MessageType.ConnectionInit: { + if (ctx.connectionInitReceived) + return socket.close(CloseCode.TooManyInitialisationRequests, 'Too many initialisation requests'); + // @ts-expect-error: I can write + ctx.connectionInitReceived = true; + if (isObject(message.payload)) + // @ts-expect-error: I can write + ctx.connectionParams = message.payload; + const permittedOrPayload = await (onConnect === null || onConnect === void 0 ? void 0 : onConnect(ctx)); + if (permittedOrPayload === false) + return socket.close(CloseCode.Forbidden, 'Forbidden'); + // we should acknowledge before send to avoid race conditions (like those exampled in https://github.com/enisdenjo/graphql-ws/issues/501) + // even if the send fails/throws, the connection should be closed because its malfunctioning + // @ts-expect-error: I can write + ctx.acknowledged = true; + await socket.send(stringifyMessage(isObject(permittedOrPayload) + ? { + type: MessageType.ConnectionAck, + payload: permittedOrPayload, + } + : { + type: MessageType.ConnectionAck, + // payload is completely absent if not provided + }, replacer)); + return; + } + case MessageType.Ping: { + if (socket.onPing) + // if the onPing listener is registered, automatic pong is disabled + return await socket.onPing(message.payload); + await socket.send(stringifyMessage(message.payload + ? { type: MessageType.Pong, payload: message.payload } + : { + type: MessageType.Pong, + // payload is completely absent if not provided + })); + return; + } + case MessageType.Pong: + return await ((_d = socket.onPong) === null || _d === void 0 ? void 0 : _d.call(socket, message.payload)); + case MessageType.Subscribe: { + if (!ctx.acknowledged) + return socket.close(CloseCode.Unauthorized, 'Unauthorized'); + const { id, payload } = message; + if (id in ctx.subscriptions) + return socket.close(CloseCode.SubscriberAlreadyExists, `Subscriber for ${id} already exists`); + // if this turns out to be a streaming operation, the subscription value + // will change to an `AsyncIterable`, otherwise it will stay as is + ctx.subscriptions[id] = null; + const emit = { + next: async (result, args) => { + let nextMessage = { + id, + type: MessageType.Next, + payload: result, + }; + const maybeResult = await (onNext === null || onNext === void 0 ? void 0 : onNext(ctx, nextMessage, args, result)); + if (maybeResult) + nextMessage = Object.assign(Object.assign({}, nextMessage), { payload: maybeResult }); + await socket.send(stringifyMessage(nextMessage, replacer)); + }, + error: async (errors) => { + let errorMessage = { + id, + type: MessageType.Error, + payload: errors, + }; + const maybeErrors = await (onError === null || onError === void 0 ? void 0 : onError(ctx, errorMessage, errors)); + if (maybeErrors) + errorMessage = Object.assign(Object.assign({}, errorMessage), { payload: maybeErrors }); + await socket.send(stringifyMessage(errorMessage, replacer)); + }, + complete: async (notifyClient) => { + const completeMessage = { + id, + type: MessageType.Complete, + }; + await (onComplete === null || onComplete === void 0 ? void 0 : onComplete(ctx, completeMessage)); + if (notifyClient) + await socket.send(stringifyMessage(completeMessage, replacer)); + }, + }; + try { + let execArgs; + const maybeExecArgsOrErrors = await (onSubscribe === null || onSubscribe === void 0 ? void 0 : onSubscribe(ctx, message)); + if (maybeExecArgsOrErrors) { + if (areGraphQLErrors(maybeExecArgsOrErrors)) + return id in ctx.subscriptions + ? await emit.error(maybeExecArgsOrErrors) + : void 0; + else if (Array.isArray(maybeExecArgsOrErrors)) + throw new Error('Invalid return value from onSubscribe hook, expected an array of GraphQLError objects'); + // not errors, is exec args + execArgs = maybeExecArgsOrErrors; + } + else { + // you either provide a schema dynamically through + // `onSubscribe` or you set one up during the server setup + if (!schema) + throw new Error('The GraphQL schema is not provided'); + const args = { + operationName: payload.operationName, + document: parse(payload.query), + variableValues: payload.variables, + }; + execArgs = Object.assign(Object.assign({}, args), { schema: typeof schema === 'function' + ? await schema(ctx, message, args) + : schema }); + const validationErrors = (validate !== null && validate !== void 0 ? validate : graphqlValidate)(execArgs.schema, execArgs.document); + if (validationErrors.length > 0) + return id in ctx.subscriptions + ? await emit.error(validationErrors) + : void 0; + } + const operationAST = getOperationAST(execArgs.document, execArgs.operationName); + if (!operationAST) + return id in ctx.subscriptions + ? await emit.error([ + new GraphQLError('Unable to identify operation'), + ]) + : void 0; + // if `onSubscribe` didn't specify a rootValue, inject one + if (!('rootValue' in execArgs)) + execArgs.rootValue = roots === null || roots === void 0 ? void 0 : roots[operationAST.operation]; + // if `onSubscribe` didn't specify a context, inject one + if (!('contextValue' in execArgs)) + execArgs.contextValue = + typeof context === 'function' + ? await context(ctx, message, execArgs) + : context; + // the execution arguments have been prepared + // perform the operation and act accordingly + let operationResult; + if (operationAST.operation === 'subscription') + operationResult = await (subscribe !== null && subscribe !== void 0 ? subscribe : graphqlSubscribe)(execArgs); + // operation === 'query' || 'mutation' + else + operationResult = await (execute !== null && execute !== void 0 ? execute : graphqlExecute)(execArgs); + const maybeResult = await (onOperation === null || onOperation === void 0 ? void 0 : onOperation(ctx, message, execArgs, operationResult)); + if (maybeResult) + operationResult = maybeResult; + if (isAsyncIterable(operationResult)) { + /** multiple emitted results */ + if (!(id in ctx.subscriptions)) { + // subscription was completed/canceled before the operation settled + if (isAsyncGenerator(operationResult)) + operationResult.return(undefined); + } + else { + ctx.subscriptions[id] = operationResult; + try { + for (var _e = true, operationResult_1 = __asyncValues(operationResult), operationResult_1_1; operationResult_1_1 = await operationResult_1.next(), _a = operationResult_1_1.done, !_a; _e = true) { + _c = operationResult_1_1.value; + _e = false; + const result = _c; + await emit.next(result, execArgs); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (!_e && !_a && (_b = operationResult_1.return)) await _b.call(operationResult_1); + } + finally { if (e_1) throw e_1.error; } + } + } + } + else { + /** single emitted result */ + // if the client completed the subscription before the single result + // became available, he effectively canceled it and no data should be sent + if (id in ctx.subscriptions) + await emit.next(operationResult, execArgs); + } + // lack of subscription at this point indicates that the client + // completed the subscription, he doesn't need to be reminded + await emit.complete(id in ctx.subscriptions); + } + finally { + // whatever happens to the subscription, we finally want to get rid of the reservation + delete ctx.subscriptions[id]; + } + return; + } + case MessageType.Complete: { + const subscription = ctx.subscriptions[message.id]; + delete ctx.subscriptions[message.id]; // deleting the subscription means no further activity should take place + if (isAsyncGenerator(subscription)) + await subscription.return(undefined); + return; + } + default: + throw new Error(`Unexpected message of type ${message.type} received`); + } + }); + // wait for close, cleanup and the disconnect callback + return async (code, reason) => { + if (connectionInitWait) + clearTimeout(connectionInitWait); + const subs = Object.assign({}, ctx.subscriptions); + // @ts-expect-error: I can write + ctx.subscriptions = {}; // deleting the subscription means no further activity should take place + // we return all iterable subscriptions immediatelly, independant of the order + await Promise.all(Object.values(subs) + .filter(isAsyncGenerator) + .map((sub) => sub.return(undefined))); + if (ctx.acknowledged) + await (onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect(ctx, code, reason)); + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + }, + }; +} +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +export function handleProtocols(protocols) { + switch (true) { + case protocols instanceof Set && + protocols.has(GRAPHQL_TRANSPORT_WS_PROTOCOL): + case Array.isArray(protocols) && + protocols.includes(GRAPHQL_TRANSPORT_WS_PROTOCOL): + case typeof protocols === 'string' && + protocols + .split(',') + .map((p) => p.trim()) + .includes(GRAPHQL_TRANSPORT_WS_PROTOCOL): + return GRAPHQL_TRANSPORT_WS_PROTOCOL; + default: + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts new file mode 100644 index 0000000..6c5b7b0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts @@ -0,0 +1,36 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from '@fastify/websocket'; +import { ServerOptions } from '../../server.mjs'; +import { ConnectionInitMessage } from '../../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/@fastify/websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +export declare function makeHandler

= Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts new file mode 100644 index 0000000..810c0fb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts @@ -0,0 +1,36 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from '@fastify/websocket'; +import { ServerOptions } from '../../server'; +import { ConnectionInitMessage } from '../../common'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/@fastify/websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +export declare function makeHandler

= Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.js b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.js new file mode 100644 index 0000000..9048573 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.js @@ -0,0 +1,126 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = void 0; +const server_1 = require("../../server"); +const common_1 = require("../../common"); +const utils_1 = require("../../utils"); +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = (0, server_1.makeServer)(options); + // we dont have access to the fastify-websocket server instance yet, + // register an error handler on first connection ONCE only + let handlingServerEmittedErrors = false; + return function handler(connection, request) { + const { socket } = connection; + // might be too late, but meh + this.websocketServer.options.handleProtocols = server_1.handleProtocols; + // handle server emitted errors only if not already handling + if (!handlingServerEmittedErrors) { + handlingServerEmittedErrors = true; + this.websocketServer.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of this.websocketServer.clients) { + try { + client.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + } + // used as listener on two streams, prevent superfluous calls on close + let emittedErrorHandled = false; + function handleEmittedError(err) { + if (emittedErrorHandled) + return; + emittedErrorHandled = true; + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + // fastify-websocket uses the WebSocket.createWebSocketStream, + // therefore errors get emitted on both the connection and the socket + connection.once('error', handleEmittedError); + socket.once('error', handleEmittedError); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { connection, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === common_1.CloseCode.SubprotocolNotAcceptable && + socket.protocol === common_1.DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }; +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs new file mode 100644 index 0000000..1940ba1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs @@ -0,0 +1,122 @@ +import { handleProtocols, makeServer } from '../../server.mjs'; +import { DEPRECATED_GRAPHQL_WS_PROTOCOL, CloseCode, } from '../../common.mjs'; +import { limitCloseReason } from '../../utils.mjs'; +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +export function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = makeServer(options); + // we dont have access to the fastify-websocket server instance yet, + // register an error handler on first connection ONCE only + let handlingServerEmittedErrors = false; + return function handler(connection, request) { + const { socket } = connection; + // might be too late, but meh + this.websocketServer.options.handleProtocols = handleProtocols; + // handle server emitted errors only if not already handling + if (!handlingServerEmittedErrors) { + handlingServerEmittedErrors = true; + this.websocketServer.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of this.websocketServer.clients) { + try { + client.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + } + // used as listener on two streams, prevent superfluous calls on close + let emittedErrorHandled = false; + function handleEmittedError(err) { + if (emittedErrorHandled) + return; + emittedErrorHandled = true; + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + // fastify-websocket uses the WebSocket.createWebSocketStream, + // therefore errors get emitted on both the connection and the socket + connection.once('error', handleEmittedError); + socket.once('error', handleEmittedError); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { connection, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === CloseCode.SubprotocolNotAcceptable && + socket.protocol === DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }; +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.mts new file mode 100644 index 0000000..7b24b2d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.mts @@ -0,0 +1,60 @@ +/// +import type { WebSocketHandler, ServerWebSocket } from 'bun'; +import { ConnectionInitMessage } from '../common.mjs'; +import { ServerOptions } from '../server.mjs'; +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +export { handleProtocols } from '../server.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/bun + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: ServerWebSocket; +} +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema/index.mjs'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +export declare function makeHandler

= Record>(options: ServerOptions>): WebSocketHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.ts new file mode 100644 index 0000000..8c34f1d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.d.ts @@ -0,0 +1,60 @@ +/// +import type { WebSocketHandler, ServerWebSocket } from 'bun'; +import { ConnectionInitMessage } from '../common'; +import { ServerOptions } from '../server'; +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +export { handleProtocols } from '../server'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/bun + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: ServerWebSocket; +} +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +export declare function makeHandler

= Record>(options: ServerOptions>): WebSocketHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.js b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.js new file mode 100644 index 0000000..39b76b1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.js @@ -0,0 +1,97 @@ +"use strict"; +/// +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = exports.handleProtocols = void 0; +const common_1 = require("../common"); +const server_1 = require("../server"); +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +var server_2 = require("../server"); +Object.defineProperty(exports, "handleProtocols", { enumerable: true, get: function () { return server_2.handleProtocols; } }); +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +function makeHandler(options) { + const server = (0, server_1.makeServer)(options); + const clients = new WeakMap(); + return { + open(ws) { + const client = { + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + // TODO: use protocol on socket once Bun exposes it + protocol: common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL, + send: async (message) => { + // ws might have been destroyed in the meantime, send only if exists + if (clients.has(ws)) { + ws.sendText(message); + } + }, + close: (code, reason) => { + if (clients.has(ws)) { + ws.close(code, reason); + } + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket: ws }); + clients.set(ws, client); + }, + message(ws, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Message received for a missing client'); + return client.handleMessage(String(message)); + }, + close(ws, code, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Closing a missing client'); + return client.closed(code, message); + }, + }; +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.mjs new file mode 100644 index 0000000..eac61ec --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/bun.mjs @@ -0,0 +1,92 @@ +/// +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, } from '../common.mjs'; +import { makeServer } from '../server.mjs'; +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +export { handleProtocols } from '../server.mjs'; +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema/index.mjs'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +export function makeHandler(options) { + const server = makeServer(options); + const clients = new WeakMap(); + return { + open(ws) { + const client = { + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + // TODO: use protocol on socket once Bun exposes it + protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + send: async (message) => { + // ws might have been destroyed in the meantime, send only if exists + if (clients.has(ws)) { + ws.sendText(message); + } + }, + close: (code, reason) => { + if (clients.has(ws)) { + ws.close(code, reason); + } + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket: ws }); + clients.set(ws, client); + }, + message(ws, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Message received for a missing client'); + return client.handleMessage(String(message)); + }, + close(ws, code, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Closing a missing client'); + return client.closed(code, message); + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.mts new file mode 100644 index 0000000..1d9b80e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.mts @@ -0,0 +1,56 @@ +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage } from '../common.mjs'; +export { GRAPHQL_TRANSPORT_WS_PROTOCOL } from '../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/deno + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; +} +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts/index.mjs'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +export declare function makeHandler

= Record>(options: ServerOptions>): (socket: WebSocket) => void; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.ts new file mode 100644 index 0000000..2417c24 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.d.ts @@ -0,0 +1,56 @@ +import { ServerOptions } from '../server'; +import { ConnectionInitMessage } from '../common'; +export { GRAPHQL_TRANSPORT_WS_PROTOCOL } from '../common'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/deno + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; +} +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +export declare function makeHandler

= Record>(options: ServerOptions>): (socket: WebSocket) => void; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.js b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.js new file mode 100644 index 0000000..bf83f66 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = void 0; +const server_1 = require("../server"); +const common_1 = require("../common"); +var common_2 = require("../common"); +Object.defineProperty(exports, "GRAPHQL_TRANSPORT_WS_PROTOCOL", { enumerable: true, get: function () { return common_2.GRAPHQL_TRANSPORT_WS_PROTOCOL; } }); +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +function makeHandler(options) { + const server = (0, server_1.makeServer)(options); + return function handle(socket) { + socket.onerror = (err) => { + console.error('Internal error emitted on the WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, 'Internal server error'); + }; + let closed = () => { + // noop + }; + socket.onopen = () => { + closed = server.opened({ + protocol: socket.protocol, + send: (msg) => socket.send(msg), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => { + socket.onmessage = async (event) => { + try { + await cb(String(event.data)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, 'Internal server error'); + } + }; + }, + }, { socket }); + }; + socket.onclose = (event) => { + if (event.code === common_1.CloseCode.SubprotocolNotAcceptable && + socket.protocol === common_1.DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(event.code, event.reason); + }; + }; +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.mjs new file mode 100644 index 0000000..3cd9095 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/deno.mjs @@ -0,0 +1,83 @@ +import { makeServer } from '../server.mjs'; +import { DEPRECATED_GRAPHQL_WS_PROTOCOL, CloseCode, } from '../common.mjs'; +export { GRAPHQL_TRANSPORT_WS_PROTOCOL } from '../common.mjs'; +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts/index.mjs'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +export function makeHandler(options) { + const server = makeServer(options); + return function handle(socket) { + socket.onerror = (err) => { + console.error('Internal error emitted on the WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, 'Internal server error'); + }; + let closed = () => { + // noop + }; + socket.onopen = () => { + closed = server.opened({ + protocol: socket.protocol, + send: (msg) => socket.send(msg), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => { + socket.onmessage = async (event) => { + try { + await cb(String(event.data)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, 'Internal server error'); + } + }; + }, + }, { socket }); + }; + socket.onclose = (event) => { + if (event.code === CloseCode.SubprotocolNotAcceptable && + socket.protocol === DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(event.code, event.reason); + }; + }; +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts new file mode 100644 index 0000000..aa91314 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts @@ -0,0 +1,40 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from 'fastify-websocket'; +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage } from '../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export declare function makeHandler

= Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts new file mode 100644 index 0000000..3e01ab9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts @@ -0,0 +1,40 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from 'fastify-websocket'; +import { ServerOptions } from '../server'; +import { ConnectionInitMessage } from '../common'; +/** + * The extra that will be put in the `Context`. + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export declare function makeHandler

= Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.js b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.js new file mode 100644 index 0000000..e033342 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = void 0; +const websocket_1 = require("./@fastify/websocket"); +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + // new handler can be reused, the semantics stayed the same + return (0, websocket_1.makeHandler)(options, keepAlive); +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.mjs new file mode 100644 index 0000000..e533497 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/fastify-websocket.mjs @@ -0,0 +1,21 @@ +import { makeHandler as makeHandlerCurrent } from './@fastify/websocket.mjs'; +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + // new handler can be reused, the semantics stayed the same + return makeHandlerCurrent(options, keepAlive); +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.mts new file mode 100644 index 0000000..809418c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.mts @@ -0,0 +1,67 @@ +/// +import type * as uWS from 'uWebSockets.js'; +import type http from 'http'; +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage } from '../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/uWebSockets + */ +export interface Extra extends UpgradeData { + /** + * The actual socket connection between the server and the client + * with the upgrade data. + */ + readonly socket: uWS.WebSocket & UpgradeData; +} +/** + * Data acquired during the HTTP upgrade callback from uWS. + * + * @category Server/uWebSockets + */ +export interface UpgradeData { + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds the relevant values extracted from the uWS's request + * while it is accessible. + */ + readonly persistedRequest: PersistedRequest; +} +/** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds relevant values extracted from the uWS's request + * while it is accessible. + * + * @category Server/uWebSockets + */ +export interface PersistedRequest { + method: string; + url: string; + /** The raw query string (after the `?` sign) or empty string. */ + query: string; + headers: http.IncomingHttpHeaders; +} +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +export declare function makeBehavior

= Record>(options: ServerOptions>, behavior?: uWS.WebSocketBehavior, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): uWS.WebSocketBehavior; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.ts new file mode 100644 index 0000000..837b7bb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.d.ts @@ -0,0 +1,67 @@ +/// +import type * as uWS from 'uWebSockets.js'; +import type http from 'http'; +import { ServerOptions } from '../server'; +import { ConnectionInitMessage } from '../common'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/uWebSockets + */ +export interface Extra extends UpgradeData { + /** + * The actual socket connection between the server and the client + * with the upgrade data. + */ + readonly socket: uWS.WebSocket & UpgradeData; +} +/** + * Data acquired during the HTTP upgrade callback from uWS. + * + * @category Server/uWebSockets + */ +export interface UpgradeData { + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds the relevant values extracted from the uWS's request + * while it is accessible. + */ + readonly persistedRequest: PersistedRequest; +} +/** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds relevant values extracted from the uWS's request + * while it is accessible. + * + * @category Server/uWebSockets + */ +export interface PersistedRequest { + method: string; + url: string; + /** The raw query string (after the `?` sign) or empty string. */ + query: string; + headers: http.IncomingHttpHeaders; +} +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +export declare function makeBehavior

= Record>(options: ServerOptions>, behavior?: uWS.WebSocketBehavior, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): uWS.WebSocketBehavior; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.js b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.js new file mode 100644 index 0000000..3f9a8c0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.js @@ -0,0 +1,141 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeBehavior = void 0; +const server_1 = require("../server"); +const common_1 = require("../common"); +const utils_1 = require("../utils"); +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +function makeBehavior(options, behavior = {}, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = (0, server_1.makeServer)(options); + const clients = new Map(); + let onDrain = () => { + // gets called when backpressure drains + }; + return Object.assign(Object.assign({}, behavior), { pong(...args) { + var _a; + (_a = behavior.pong) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Pong received for a missing client'); + if (client.pongWaitTimeout) { + clearTimeout(client.pongWaitTimeout); + client.pongWaitTimeout = null; + } + }, + upgrade(...args) { + var _a; + (_a = behavior.upgrade) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [res, req, context] = args; + const headers = {}; + req.forEach((key, value) => { + headers[key] = value; + }); + res.upgrade({ + persistedRequest: { + method: req.getMethod(), + url: req.getUrl(), + query: req.getQuery(), + headers, + }, + }, req.getHeader('sec-websocket-key'), (0, server_1.handleProtocols)(req.getHeader('sec-websocket-protocol')) || + new Uint8Array(), req.getHeader('sec-websocket-extensions'), context); + }, + open(...args) { + var _a; + (_a = behavior.open) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const socket = args[0]; + const persistedRequest = socket.persistedRequest; + // prepare client object + const client = { + pingInterval: null, + pongWaitTimeout: null, + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + protocol: (0, server_1.handleProtocols)(persistedRequest.headers['sec-websocket-protocol'] || '') || '', + send: async (message) => { + // the socket might have been destroyed in the meantime + if (!clients.has(socket)) + return; + if (!socket.send(message)) + // if backpressure is built up wait for drain + await new Promise((resolve) => (onDrain = resolve)); + }, + close: (code, reason) => { + // end socket in next tick making sure the client is registered + setImmediate(() => { + // the socket might have been destroyed before issuing a close + if (clients.has(socket)) + socket.end(code, reason); + }); + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket, persistedRequest }); + if (keepAlive > 0 && isFinite(keepAlive)) { + client.pingInterval = setInterval(() => { + // terminate the connection after pong wait has passed because the client is idle + client.pongWaitTimeout = setTimeout(() => socket.close(), keepAlive); + socket.ping(); + }, keepAlive); + } + clients.set(socket, client); + }, + drain(...args) { + var _a; + (_a = behavior.drain) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + onDrain(); + }, + async message(...args) { + var _a; + (_a = behavior.message) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Message received for a missing client'); + try { + await client.handleMessage(Buffer.from(message).toString()); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.end(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }, + close(...args) { + var _a; + (_a = behavior.close) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, code, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Closing a missing client'); + if (client.pongWaitTimeout) + clearTimeout(client.pongWaitTimeout); + if (client.pingInterval) + clearTimeout(client.pingInterval); + client.closed(code, Buffer.from(message).toString()); + clients.delete(socket); + } }); +} +exports.makeBehavior = makeBehavior; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.mjs new file mode 100644 index 0000000..833ce14 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/uWebSockets.mjs @@ -0,0 +1,137 @@ +import { handleProtocols, makeServer } from '../server.mjs'; +import { CloseCode } from '../common.mjs'; +import { limitCloseReason } from '../utils.mjs'; +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +export function makeBehavior(options, behavior = {}, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = makeServer(options); + const clients = new Map(); + let onDrain = () => { + // gets called when backpressure drains + }; + return Object.assign(Object.assign({}, behavior), { pong(...args) { + var _a; + (_a = behavior.pong) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Pong received for a missing client'); + if (client.pongWaitTimeout) { + clearTimeout(client.pongWaitTimeout); + client.pongWaitTimeout = null; + } + }, + upgrade(...args) { + var _a; + (_a = behavior.upgrade) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [res, req, context] = args; + const headers = {}; + req.forEach((key, value) => { + headers[key] = value; + }); + res.upgrade({ + persistedRequest: { + method: req.getMethod(), + url: req.getUrl(), + query: req.getQuery(), + headers, + }, + }, req.getHeader('sec-websocket-key'), handleProtocols(req.getHeader('sec-websocket-protocol')) || + new Uint8Array(), req.getHeader('sec-websocket-extensions'), context); + }, + open(...args) { + var _a; + (_a = behavior.open) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const socket = args[0]; + const persistedRequest = socket.persistedRequest; + // prepare client object + const client = { + pingInterval: null, + pongWaitTimeout: null, + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + protocol: handleProtocols(persistedRequest.headers['sec-websocket-protocol'] || '') || '', + send: async (message) => { + // the socket might have been destroyed in the meantime + if (!clients.has(socket)) + return; + if (!socket.send(message)) + // if backpressure is built up wait for drain + await new Promise((resolve) => (onDrain = resolve)); + }, + close: (code, reason) => { + // end socket in next tick making sure the client is registered + setImmediate(() => { + // the socket might have been destroyed before issuing a close + if (clients.has(socket)) + socket.end(code, reason); + }); + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket, persistedRequest }); + if (keepAlive > 0 && isFinite(keepAlive)) { + client.pingInterval = setInterval(() => { + // terminate the connection after pong wait has passed because the client is idle + client.pongWaitTimeout = setTimeout(() => socket.close(), keepAlive); + socket.ping(); + }, keepAlive); + } + clients.set(socket, client); + }, + drain(...args) { + var _a; + (_a = behavior.drain) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + onDrain(); + }, + async message(...args) { + var _a; + (_a = behavior.message) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Message received for a missing client'); + try { + await client.handleMessage(Buffer.from(message).toString()); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.end(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }, + close(...args) { + var _a; + (_a = behavior.close) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, code, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Closing a missing client'); + if (client.pongWaitTimeout) + clearTimeout(client.pongWaitTimeout); + if (client.pingInterval) + clearTimeout(client.pingInterval); + client.closed(code, Buffer.from(message).toString()); + clients.delete(socket); + } }); +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.mts new file mode 100644 index 0000000..3f49108 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.mts @@ -0,0 +1,38 @@ +import type * as http from 'http'; +import type * as ws from 'ws'; +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage, Disposable } from '../common.mjs'; +type WebSocket = typeof ws.prototype; +type WebSocketServer = ws.Server; +/** + * The extra that will be put in the `Context`. + * + * @category Server/ws + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: http.IncomingMessage; +} +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +export declare function useServer

= Record>(options: ServerOptions>, ws: WebSocketServer, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): Disposable; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.ts new file mode 100644 index 0000000..74a6974 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.d.ts @@ -0,0 +1,38 @@ +import type * as http from 'http'; +import type * as ws from 'ws'; +import { ServerOptions } from '../server'; +import { ConnectionInitMessage, Disposable } from '../common'; +type WebSocket = typeof ws.prototype; +type WebSocketServer = ws.Server; +/** + * The extra that will be put in the `Context`. + * + * @category Server/ws + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: http.IncomingMessage; +} +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +export declare function useServer

= Record>(options: ServerOptions>, ws: WebSocketServer, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): Disposable; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.js b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.js new file mode 100644 index 0000000..894f1a7 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.js @@ -0,0 +1,119 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useServer = void 0; +const server_1 = require("../server"); +const common_1 = require("../common"); +const utils_1 = require("../utils"); +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +function useServer(options, ws, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = (0, server_1.makeServer)(options); + ws.options.handleProtocols = server_1.handleProtocols; + ws.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of ws.clients) { + try { + client.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + ws.on('connection', (socket, request) => { + socket.once('error', (err) => { + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + }); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { socket, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === common_1.CloseCode.SubprotocolNotAcceptable && + socket.protocol === common_1.DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }); + return { + dispose: async () => { + for (const client of ws.clients) { + client.close(1001, 'Going away'); + } + ws.removeAllListeners(); + await new Promise((resolve, reject) => { + ws.close((err) => (err ? reject(err) : resolve())); + }); + }, + }; +} +exports.useServer = useServer; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.mjs new file mode 100644 index 0000000..ee38127 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/use/ws.mjs @@ -0,0 +1,115 @@ +import { handleProtocols, makeServer } from '../server.mjs'; +import { DEPRECATED_GRAPHQL_WS_PROTOCOL, CloseCode, } from '../common.mjs'; +import { limitCloseReason } from '../utils.mjs'; +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +export function useServer(options, ws, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = makeServer(options); + ws.options.handleProtocols = handleProtocols; + ws.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of ws.clients) { + try { + client.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + ws.on('connection', (socket, request) => { + socket.once('error', (err) => { + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + }); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { socket, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === CloseCode.SubprotocolNotAcceptable && + socket.protocol === DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }); + return { + dispose: async () => { + for (const client of ws.clients) { + client.close(1001, 'Going away'); + } + ws.removeAllListeners(); + await new Promise((resolve, reject) => { + ws.close((err) => (err ? reject(err) : resolve())); + }); + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.mts b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.mts new file mode 100644 index 0000000..cc1262d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.mts @@ -0,0 +1,23 @@ +/** + * + * utils + * + */ +import { GraphQLError } from 'graphql'; +/** @private */ +export declare function extendedTypeof(val: unknown): 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'array' | 'null'; +/** @private */ +export declare function isObject(val: unknown): val is Record; +/** @private */ +export declare function isAsyncIterable(val: unknown): val is AsyncIterable; +/** @private */ +export declare function isAsyncGenerator(val: unknown): val is AsyncGenerator; +/** @private */ +export declare function areGraphQLErrors(obj: unknown): obj is readonly GraphQLError[]; +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +export declare function limitCloseReason(reason: string, whenTooLong: string): string; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.ts b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.ts new file mode 100644 index 0000000..cc1262d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.d.ts @@ -0,0 +1,23 @@ +/** + * + * utils + * + */ +import { GraphQLError } from 'graphql'; +/** @private */ +export declare function extendedTypeof(val: unknown): 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'array' | 'null'; +/** @private */ +export declare function isObject(val: unknown): val is Record; +/** @private */ +export declare function isAsyncIterable(val: unknown): val is AsyncIterable; +/** @private */ +export declare function isAsyncGenerator(val: unknown): val is AsyncGenerator; +/** @private */ +export declare function areGraphQLErrors(obj: unknown): obj is readonly GraphQLError[]; +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +export declare function limitCloseReason(reason: string, whenTooLong: string): string; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/utils.js b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.js new file mode 100644 index 0000000..2b1241a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.limitCloseReason = exports.areGraphQLErrors = exports.isAsyncGenerator = exports.isAsyncIterable = exports.isObject = exports.extendedTypeof = void 0; +/** @private */ +function extendedTypeof(val) { + if (val === null) { + return 'null'; + } + if (Array.isArray(val)) { + return 'array'; + } + return typeof val; +} +exports.extendedTypeof = extendedTypeof; +/** @private */ +function isObject(val) { + return extendedTypeof(val) === 'object'; +} +exports.isObject = isObject; +/** @private */ +function isAsyncIterable(val) { + return typeof Object(val)[Symbol.asyncIterator] === 'function'; +} +exports.isAsyncIterable = isAsyncIterable; +/** @private */ +function isAsyncGenerator(val) { + return (isObject(val) && + typeof Object(val)[Symbol.asyncIterator] === 'function' && + typeof val.return === 'function' + // for lazy ones, we only need the return anyway + // typeof val.throw === 'function' && + // typeof val.next === 'function' + ); +} +exports.isAsyncGenerator = isAsyncGenerator; +/** @private */ +function areGraphQLErrors(obj) { + return (Array.isArray(obj) && + // must be at least one error + obj.length > 0 && + // error has at least a message + obj.every((ob) => 'message' in ob)); +} +exports.areGraphQLErrors = areGraphQLErrors; +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +function limitCloseReason(reason, whenTooLong) { + return reason.length < 124 ? reason : whenTooLong; +} +exports.limitCloseReason = limitCloseReason; diff --git a/graphql-subscription-express/node_modules/graphql-ws/lib/utils.mjs b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.mjs new file mode 100644 index 0000000..5820119 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/lib/utils.mjs @@ -0,0 +1,45 @@ +/** @private */ +export function extendedTypeof(val) { + if (val === null) { + return 'null'; + } + if (Array.isArray(val)) { + return 'array'; + } + return typeof val; +} +/** @private */ +export function isObject(val) { + return extendedTypeof(val) === 'object'; +} +/** @private */ +export function isAsyncIterable(val) { + return typeof Object(val)[Symbol.asyncIterator] === 'function'; +} +/** @private */ +export function isAsyncGenerator(val) { + return (isObject(val) && + typeof Object(val)[Symbol.asyncIterator] === 'function' && + typeof val.return === 'function' + // for lazy ones, we only need the return anyway + // typeof val.throw === 'function' && + // typeof val.next === 'function' + ); +} +/** @private */ +export function areGraphQLErrors(obj) { + return (Array.isArray(obj) && + // must be at least one error + obj.length > 0 && + // error has at least a message + obj.every((ob) => 'message' in ob)); +} +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +export function limitCloseReason(reason, whenTooLong) { + return reason.length < 124 ? reason : whenTooLong; +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/package.json b/graphql-subscription-express/node_modules/graphql-ws/package.json new file mode 100644 index 0000000..8bbd98d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/package.json @@ -0,0 +1,152 @@ +{ + "name": "graphql-ws", + "version": "5.16.0", + "description": "Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client", + "keywords": [ + "protocol", + "graphql", + "transport", + "subscriptions", + "websockets", + "server", + "client", + "observables", + "express", + "relay", + "apollo", + "fastify", + "uwebsockets" + ], + "author": "Denis Badurina ", + "license": "MIT", + "homepage": "https://github.com/enisdenjo/graphql-ws#readme", + "repository": { + "type": "git", + "url": "https://github.com/enisdenjo/graphql-ws.git" + }, + "engines": { + "node": ">=10" + }, + "packageManager": "yarn@3.6.0", + "types": "lib/index.d.ts", + "main": "lib/index.js", + "module": "lib/index.mjs", + "browser": "umd/graphql-ws.js", + "exports": { + ".": { + "types": "./lib/index.d.ts", + "require": "./lib/index.js", + "import": "./lib/index.mjs", + "browser": "./umd/graphql-ws.js" + }, + "./lib/use/ws": { + "types": "./lib/use/ws.d.ts", + "require": "./lib/use/ws.js", + "import": "./lib/use/ws.mjs" + }, + "./lib/use/uWebSockets": { + "types": "./lib/use/uWebSockets.d.ts", + "require": "./lib/use/uWebSockets.js", + "import": "./lib/use/uWebSockets.mjs" + }, + "./lib/use/@fastify/websocket": { + "types": "./lib/use/@fastify/websocket.d.ts", + "require": "./lib/use/@fastify/websocket.js", + "import": "./lib/use/@fastify/websocket.mjs" + }, + "./lib/use/fastify-websocket": { + "types": "./lib/use/fastify-websocket.d.ts", + "require": "./lib/use/fastify-websocket.js", + "import": "./lib/use/fastify-websocket.mjs" + }, + "./lib/use/bun": { + "bun": "./lib/use/bun.mjs", + "types": "./lib/use/bun.d.ts", + "require": "./lib/use/bun.js", + "import": "./lib/use/bun.mjs" + }, + "./lib/use/deno": { + "types": "./lib/use/deno.d.ts", + "require": "./lib/use/deno.js", + "import": "./lib/use/deno.mjs" + }, + "./package.json": "./package.json" + }, + "files": [ + "lib", + "umd", + "README.md", + "LICENSE.md", + "PROTOCOL.md" + ], + "sideEffects": [ + "umd/*" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "gendocs": "typedoc --options typedoc.js src/ && node scripts/post-gendocs.mjs", + "lint:eslint": "eslint 'src'", + "lint:prettier": "prettier -c .", + "lint": "yarn lint:eslint && yarn lint:prettier", + "type-check": "tsc --noEmit", + "test": "jest", + "bench:start-servers": "NODE_ENV=production node benchmark/servers/index.mjs", + "bench": "k6 run benchmark/k6.mjs", + "build:esm": "tsc -b tsconfig.esm.json && node scripts/esm-post-process.mjs", + "build:cjs": "tsc -b tsconfig.cjs.json", + "build:umd": "rollup --bundleConfigAsCjs --config rollup.config.ts --configPlugin typescript && gzip umd/graphql-ws.min.js -c > umd/graphql-ws.min.js.gz", + "build": "yarn build:esm && yarn build:cjs && yarn build:umd && yarn postbuild", + "postbuild": "node scripts/fix-declaration-directives.mjs", + "prepack": "npm pkg delete workspaces", + "postpack": "npm pkg set 'workspaces[]=website'", + "release": "semantic-release" + }, + "peerDependencies": { + "graphql": ">=0.11 <=16" + }, + "devDependencies": { + "@babel/core": "^7.22.5", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", + "@babel/plugin-proposal-object-rest-spread": "^7.20.7", + "@babel/plugin-proposal-optional-chaining": "^7.21.0", + "@babel/preset-env": "^7.22.5", + "@babel/preset-typescript": "^7.22.5", + "@fastify/websocket": "^7.2.0", + "@rollup/plugin-terser": "^0.4.3", + "@rollup/plugin-typescript": "^11.1.1", + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "@types/eslint": "^8.40.2", + "@types/glob": "^8.1.0", + "@types/jest": "^29.5.2", + "@types/ws": "^8.5.5", + "@typescript-eslint/eslint-plugin": "^5.60.0", + "@typescript-eslint/parser": "^5.60.0", + "babel-jest": "^29.5.0", + "bun-types": "^0.6.9", + "eslint": "^8.43.0", + "eslint-config-prettier": "^8.8.0", + "fastify": "^4.18.0", + "fastify-websocket": "4.2.2", + "glob": "^10.3.0", + "graphql": "^16.7.0", + "jest": "^29.5.0", + "jest-environment-jsdom": "^29.5.0", + "jest-jasmine2": "^29.5.0", + "prettier": "^2.8.8", + "replacestream": "^4.0.3", + "rollup": "^3.25.1", + "semantic-release": "^21.0.5", + "subscriptions-transport-ws": "^0.11.0", + "tslib": "^2.5.3", + "typedoc": "^0.24.8", + "typedoc-plugin-markdown": "^3.15.3", + "typescript": "^5.1.3", + "uWebSockets.js": "uNetworking/uWebSockets.js#v20.30.0", + "ws": "8.12.0", + "ws7": "npm:ws@^7.5.9" + } +} diff --git a/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.js b/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.js new file mode 100644 index 0000000..c51d3bb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.js @@ -0,0 +1,800 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.graphqlWs = {})); +})(this, (function (exports) { 'use strict'; + + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + /* global Reflect, Promise */ + + + function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + } + + /** @private */ + function extendedTypeof(val) { + if (val === null) { + return 'null'; + } + if (Array.isArray(val)) { + return 'array'; + } + return typeof val; + } + /** @private */ + function isObject(val) { + return extendedTypeof(val) === 'object'; + } + /** @private */ + function areGraphQLErrors(obj) { + return (Array.isArray(obj) && + // must be at least one error + obj.length > 0 && + // error has at least a message + obj.every((ob) => 'message' in ob)); + } + /** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ + function limitCloseReason(reason, whenTooLong) { + return reason.length < 124 ? reason : whenTooLong; + } + + /** + * + * common + * + */ + /** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ + const GRAPHQL_TRANSPORT_WS_PROTOCOL = 'graphql-transport-ws'; + /** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ + const DEPRECATED_GRAPHQL_WS_PROTOCOL = 'graphql-ws'; + /** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ + exports.CloseCode = void 0; + (function (CloseCode) { + CloseCode[CloseCode["InternalServerError"] = 4500] = "InternalServerError"; + CloseCode[CloseCode["InternalClientError"] = 4005] = "InternalClientError"; + CloseCode[CloseCode["BadRequest"] = 4400] = "BadRequest"; + CloseCode[CloseCode["BadResponse"] = 4004] = "BadResponse"; + /** Tried subscribing before connect ack */ + CloseCode[CloseCode["Unauthorized"] = 4401] = "Unauthorized"; + CloseCode[CloseCode["Forbidden"] = 4403] = "Forbidden"; + CloseCode[CloseCode["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable"; + CloseCode[CloseCode["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout"; + CloseCode[CloseCode["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout"; + /** Subscriber distinction is very important */ + CloseCode[CloseCode["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists"; + CloseCode[CloseCode["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests"; + })(exports.CloseCode || (exports.CloseCode = {})); + /** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ + exports.MessageType = void 0; + (function (MessageType) { + MessageType["ConnectionInit"] = "connection_init"; + MessageType["ConnectionAck"] = "connection_ack"; + MessageType["Ping"] = "ping"; + MessageType["Pong"] = "pong"; + MessageType["Subscribe"] = "subscribe"; + MessageType["Next"] = "next"; + MessageType["Error"] = "error"; + MessageType["Complete"] = "complete"; + })(exports.MessageType || (exports.MessageType = {})); + /** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ + function validateMessage(val) { + if (!isObject(val)) { + throw new Error(`Message is expected to be an object, but got ${extendedTypeof(val)}`); + } + if (!val.type) { + throw new Error(`Message is missing the 'type' property`); + } + if (typeof val.type !== 'string') { + throw new Error(`Message is expects the 'type' property to be a string, but got ${extendedTypeof(val.type)}`); + } + switch (val.type) { + case exports.MessageType.ConnectionInit: + case exports.MessageType.ConnectionAck: + case exports.MessageType.Ping: + case exports.MessageType.Pong: { + if (val.payload != null && !isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${val.payload}"`); + } + break; + } + case exports.MessageType.Subscribe: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + if (typeof val.payload.query !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'query' property to be a string, but got ${extendedTypeof(val.payload.query)}`); + } + if (val.payload.variables != null && !isObject(val.payload.variables)) { + throw new Error(`"${val.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.variables)}`); + } + if (val.payload.operationName != null && + extendedTypeof(val.payload.operationName) !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${extendedTypeof(val.payload.operationName)}`); + } + if (val.payload.extensions != null && !isObject(val.payload.extensions)) { + throw new Error(`"${val.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.extensions)}`); + } + break; + } + case exports.MessageType.Next: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + break; + } + case exports.MessageType.Error: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!areGraphQLErrors(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(val.payload)}`); + } + break; + } + case exports.MessageType.Complete: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + break; + } + default: + throw new Error(`Invalid message 'type' property "${val.type}"`); + } + return val; + } + /** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ + function isMessage(val) { + try { + validateMessage(val); + return true; + } + catch (_a) { + return false; + } + } + /** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ + function parseMessage(data, reviver) { + return validateMessage(typeof data === 'string' ? JSON.parse(data, reviver) : data); + } + /** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ + function stringifyMessage(msg, replacer) { + validateMessage(msg); + return JSON.stringify(msg, replacer); + } + + /** + * + * client + * + */ + /** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ + function createClient(options) { + const { url, connectionParams, lazy = true, onNonLazyError = console.error, lazyCloseTimeout: lazyCloseTimeoutMs = 0, keepAlive = 0, disablePong, connectionAckWaitTimeout = 0, retryAttempts = 5, retryWait = async function randomisedExponentialBackoff(retries) { + let retryDelay = 1000; // start with 1s delay + for (let i = 0; i < retries; i++) { + retryDelay *= 2; + } + await new Promise((resolve) => setTimeout(resolve, retryDelay + + // add random timeout from 300ms to 3s + Math.floor(Math.random() * (3000 - 300) + 300))); + }, shouldRetry = isLikeCloseEvent, isFatalConnectionProblem, on, webSocketImpl, + /** + * Generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID = function generateUUID() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); + }, jsonMessageReplacer: replacer, jsonMessageReviver: reviver, } = options; + let ws; + if (webSocketImpl) { + if (!isWebSocket(webSocketImpl)) { + throw new Error('Invalid WebSocket implementation provided'); + } + ws = webSocketImpl; + } + else if (typeof WebSocket !== 'undefined') { + ws = WebSocket; + } + else if (typeof global !== 'undefined') { + ws = + global.WebSocket || + // @ts-expect-error: Support more browsers + global.MozWebSocket; + } + else if (typeof window !== 'undefined') { + ws = + window.WebSocket || + // @ts-expect-error: Support more browsers + window.MozWebSocket; + } + if (!ws) + throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`"); + const WebSocketImpl = ws; + // websocket status emitter, subscriptions are handled differently + const emitter = (() => { + const message = (() => { + const listeners = {}; + return { + on(id, listener) { + listeners[id] = listener; + return () => { + delete listeners[id]; + }; + }, + emit(message) { + var _a; + if ('id' in message) + (_a = listeners[message.id]) === null || _a === void 0 ? void 0 : _a.call(listeners, message); + }, + }; + })(); + const listeners = { + connecting: (on === null || on === void 0 ? void 0 : on.connecting) ? [on.connecting] : [], + opened: (on === null || on === void 0 ? void 0 : on.opened) ? [on.opened] : [], + connected: (on === null || on === void 0 ? void 0 : on.connected) ? [on.connected] : [], + ping: (on === null || on === void 0 ? void 0 : on.ping) ? [on.ping] : [], + pong: (on === null || on === void 0 ? void 0 : on.pong) ? [on.pong] : [], + message: (on === null || on === void 0 ? void 0 : on.message) ? [message.emit, on.message] : [message.emit], + closed: (on === null || on === void 0 ? void 0 : on.closed) ? [on.closed] : [], + error: (on === null || on === void 0 ? void 0 : on.error) ? [on.error] : [], + }; + return { + onMessage: message.on, + on(event, listener) { + const l = listeners[event]; + l.push(listener); + return () => { + l.splice(l.indexOf(listener), 1); + }; + }, + emit(event, ...args) { + // we copy the listeners so that unlistens dont "pull the rug under our feet" + for (const listener of [...listeners[event]]) { + // @ts-expect-error: The args should fit + listener(...args); + } + }, + }; + })(); + // invokes the callback either when an error or closed event is emitted, + // first one that gets called prevails, other emissions are ignored + function errorOrClosed(cb) { + const listening = [ + // errors are fatal and more critical than close events, throw them first + emitter.on('error', (err) => { + listening.forEach((unlisten) => unlisten()); + cb(err); + }), + // closes can be graceful and not fatal, throw them second (if error didnt throw) + emitter.on('closed', (event) => { + listening.forEach((unlisten) => unlisten()); + cb(event); + }), + ]; + } + let connecting, locks = 0, lazyCloseTimeout, retrying = false, retries = 0, disposed = false; + async function connect() { + // clear the lazy close timeout immediatelly so that close gets debounced + // see: https://github.com/enisdenjo/graphql-ws/issues/388 + clearTimeout(lazyCloseTimeout); + const [socket, throwOnClose] = await (connecting !== null && connecting !== void 0 ? connecting : (connecting = new Promise((connected, denied) => (async () => { + if (retrying) { + await retryWait(retries); + // subscriptions might complete while waiting for retry + if (!locks) { + connecting = undefined; + return denied({ code: 1000, reason: 'All Subscriptions Gone' }); + } + retries++; + } + emitter.emit('connecting', retrying); + const socket = new WebSocketImpl(typeof url === 'function' ? await url() : url, GRAPHQL_TRANSPORT_WS_PROTOCOL); + let connectionAckTimeout, queuedPing; + function enqueuePing() { + if (isFinite(keepAlive) && keepAlive > 0) { + clearTimeout(queuedPing); // in case where a pong was received before a ping (this is valid behaviour) + queuedPing = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) { + socket.send(stringifyMessage({ type: exports.MessageType.Ping })); + emitter.emit('ping', false, undefined); + } + }, keepAlive); + } + } + errorOrClosed((errOrEvent) => { + connecting = undefined; + clearTimeout(connectionAckTimeout); + clearTimeout(queuedPing); + denied(errOrEvent); + if (errOrEvent instanceof TerminatedCloseEvent) { + socket.close(4499, 'Terminated'); // close event is artificial and emitted manually, see `Client.terminate()` below + socket.onerror = null; + socket.onclose = null; + } + }); + socket.onerror = (err) => emitter.emit('error', err); + socket.onclose = (event) => emitter.emit('closed', event); + socket.onopen = async () => { + try { + emitter.emit('opened', socket); + const payload = typeof connectionParams === 'function' + ? await connectionParams() + : connectionParams; + // connectionParams might take too long causing the server to kick off the client + // the necessary error/close event is already reported - simply stop execution + if (socket.readyState !== WebSocketImpl.OPEN) + return; + socket.send(stringifyMessage(payload + ? { + type: exports.MessageType.ConnectionInit, + payload, + } + : { + type: exports.MessageType.ConnectionInit, + // payload is completely absent if not provided + }, replacer)); + if (isFinite(connectionAckWaitTimeout) && + connectionAckWaitTimeout > 0) { + connectionAckTimeout = setTimeout(() => { + socket.close(exports.CloseCode.ConnectionAcknowledgementTimeout, 'Connection acknowledgement timeout'); + }, connectionAckWaitTimeout); + } + enqueuePing(); // enqueue ping (noop if disabled) + } + catch (err) { + emitter.emit('error', err); + socket.close(exports.CloseCode.InternalClientError, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Internal client error')); + } + }; + let acknowledged = false; + socket.onmessage = ({ data }) => { + try { + const message = parseMessage(data, reviver); + emitter.emit('message', message); + if (message.type === 'ping' || message.type === 'pong') { + emitter.emit(message.type, true, message.payload); // received + if (message.type === 'pong') { + enqueuePing(); // enqueue next ping (noop if disabled) + } + else if (!disablePong) { + // respond with pong on ping + socket.send(stringifyMessage(message.payload + ? { + type: exports.MessageType.Pong, + payload: message.payload, + } + : { + type: exports.MessageType.Pong, + // payload is completely absent if not provided + })); + emitter.emit('pong', false, message.payload); + } + return; // ping and pongs can be received whenever + } + if (acknowledged) + return; // already connected and acknowledged + if (message.type !== exports.MessageType.ConnectionAck) + throw new Error(`First message cannot be of type ${message.type}`); + clearTimeout(connectionAckTimeout); + acknowledged = true; + emitter.emit('connected', socket, message.payload, retrying); // connected = socket opened + acknowledged + retrying = false; // future lazy connects are not retries + retries = 0; // reset the retries on connect + connected([ + socket, + new Promise((_, reject) => errorOrClosed(reject)), + ]); + } + catch (err) { + socket.onmessage = null; // stop reading messages as soon as reading breaks once + emitter.emit('error', err); + socket.close(exports.CloseCode.BadResponse, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Bad response')); + } + }; + })()))); + // if the provided socket is in a closing state, wait for the throw on close + if (socket.readyState === WebSocketImpl.CLOSING) + await throwOnClose; + let release = () => { + // releases this connection + }; + const released = new Promise((resolve) => (release = resolve)); + return [ + socket, + release, + Promise.race([ + // wait for + released.then(() => { + if (!locks) { + // and if no more locks are present, complete the connection + const complete = () => socket.close(1000, 'Normal Closure'); + if (isFinite(lazyCloseTimeoutMs) && lazyCloseTimeoutMs > 0) { + // if the keepalive is set, allow for the specified calmdown time and + // then complete if the socket is still open. + lazyCloseTimeout = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) + complete(); + }, lazyCloseTimeoutMs); + } + else { + // otherwise complete immediately + complete(); + } + } + }), + // or + throwOnClose, + ]), + ]; + } + /** + * Checks the `connect` problem and evaluates if the client should retry. + */ + function shouldRetryConnectOrThrow(errOrCloseEvent) { + // some close codes are worth reporting immediately + if (isLikeCloseEvent(errOrCloseEvent) && + (isFatalInternalCloseCode(errOrCloseEvent.code) || + [ + exports.CloseCode.InternalServerError, + exports.CloseCode.InternalClientError, + exports.CloseCode.BadRequest, + exports.CloseCode.BadResponse, + exports.CloseCode.Unauthorized, + // CloseCode.Forbidden, might grant access out after retry + exports.CloseCode.SubprotocolNotAcceptable, + // CloseCode.ConnectionInitialisationTimeout, might not time out after retry + // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry + exports.CloseCode.SubscriberAlreadyExists, + exports.CloseCode.TooManyInitialisationRequests, + // 4499, // Terminated, probably because the socket froze, we want to retry + ].includes(errOrCloseEvent.code))) + throw errOrCloseEvent; + // client was disposed, no retries should proceed regardless + if (disposed) + return false; + // normal closure (possibly all subscriptions have completed) + // if no locks were acquired in the meantime, shouldnt try again + if (isLikeCloseEvent(errOrCloseEvent) && errOrCloseEvent.code === 1000) + return locks > 0; + // retries are not allowed or we tried to many times, report error + if (!retryAttempts || retries >= retryAttempts) + throw errOrCloseEvent; + // throw non-retryable connection problems + if (!shouldRetry(errOrCloseEvent)) + throw errOrCloseEvent; + // @deprecated throw fatal connection problems immediately + if (isFatalConnectionProblem === null || isFatalConnectionProblem === void 0 ? void 0 : isFatalConnectionProblem(errOrCloseEvent)) + throw errOrCloseEvent; + // looks good, start retrying + return (retrying = true); + } + // in non-lazy (hot?) mode always hold one connection lock to persist the socket + if (!lazy) { + (async () => { + locks++; + for (;;) { + try { + const [, , throwOnClose] = await connect(); + await throwOnClose; // will always throw because releaser is not used + } + catch (errOrCloseEvent) { + try { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + catch (errOrCloseEvent) { + // report thrown error, no further retries + return onNonLazyError === null || onNonLazyError === void 0 ? void 0 : onNonLazyError(errOrCloseEvent); + } + } + } + })(); + } + function subscribe(payload, sink) { + const id = generateID(payload); + let done = false, errored = false, releaser = () => { + // for handling completions before connect + locks--; + done = true; + }; + (async () => { + locks++; + for (;;) { + try { + const [socket, release, waitForReleaseOrThrowOnClose] = await connect(); + // if done while waiting for connect, release the connection lock right away + if (done) + return release(); + const unlisten = emitter.onMessage(id, (message) => { + switch (message.type) { + case exports.MessageType.Next: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- payload will fit type + sink.next(message.payload); + return; + } + case exports.MessageType.Error: { + (errored = true), (done = true); + sink.error(message.payload); + releaser(); + return; + } + case exports.MessageType.Complete: { + done = true; + releaser(); // release completes the sink + return; + } + } + }); + socket.send(stringifyMessage({ + id, + type: exports.MessageType.Subscribe, + payload, + }, replacer)); + releaser = () => { + if (!done && socket.readyState === WebSocketImpl.OPEN) + // if not completed already and socket is open, send complete message to server on release + socket.send(stringifyMessage({ + id, + type: exports.MessageType.Complete, + }, replacer)); + locks--; + done = true; + release(); + }; + // either the releaser will be called, connection completed and + // the promise resolved or the socket closed and the promise rejected. + // whatever happens though, we want to stop listening for messages + await waitForReleaseOrThrowOnClose.finally(unlisten); + return; // completed, shouldnt try again + } + catch (errOrCloseEvent) { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + } + })() + .then(() => { + // delivering either an error or a complete terminates the sequence + if (!errored) + sink.complete(); + }) // resolves on release or normal closure + .catch((err) => { + sink.error(err); + }); // rejects on close events and errors + return () => { + // dispose only of active subscriptions + if (!done) + releaser(); + }; + } + return { + on: emitter.on, + subscribe, + iterate(request) { + const pending = []; + const deferred = { + done: false, + error: null, + resolve: () => { + // noop + }, + }; + const dispose = subscribe(request, { + next(val) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + pending.push(val); + deferred.resolve(); + }, + error(err) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + }, + complete() { + deferred.done = true; + deferred.resolve(); + }, + }); + const iterator = (function iterator() { + return __asyncGenerator(this, arguments, function* iterator_1() { + for (;;) { + if (!pending.length) { + // only wait if there are no pending messages available + yield __await(new Promise((resolve) => (deferred.resolve = resolve))); + } + // first flush + while (pending.length) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + yield yield __await(pending.shift()); + } + // then error + if (deferred.error) { + throw deferred.error; + } + // or complete + if (deferred.done) { + return yield __await(void 0); + } + } + }); + })(); + iterator.throw = async (err) => { + if (!deferred.done) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + } + return { done: true, value: undefined }; + }; + iterator.return = async () => { + dispose(); + return { done: true, value: undefined }; + }; + return iterator; + }, + async dispose() { + disposed = true; + if (connecting) { + // if there is a connection, close it + const [socket] = await connecting; + socket.close(1000, 'Normal Closure'); + } + }, + terminate() { + if (connecting) { + // only if there is a connection + emitter.emit('closed', new TerminatedCloseEvent()); + } + }, + }; + } + /** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ + class TerminatedCloseEvent extends Error { + constructor() { + super(...arguments); + this.name = 'TerminatedCloseEvent'; + this.message = '4499: Terminated'; + this.code = 4499; + this.reason = 'Terminated'; + this.wasClean = false; + } + } + function isLikeCloseEvent(val) { + return isObject(val) && 'code' in val && 'reason' in val; + } + function isFatalInternalCloseCode(code) { + if ([ + 1000, + 1001, + 1006, + 1005, + 1012, + 1013, + 1014, // Bad Gateway + ].includes(code)) + return false; + // all other internal errors are fatal + return code >= 1000 && code <= 1999; + } + function isWebSocket(val) { + return (typeof val === 'function' && + 'constructor' in val && + 'CLOSED' in val && + 'CLOSING' in val && + 'CONNECTING' in val && + 'OPEN' in val); + } + + exports.DEPRECATED_GRAPHQL_WS_PROTOCOL = DEPRECATED_GRAPHQL_WS_PROTOCOL; + exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = GRAPHQL_TRANSPORT_WS_PROTOCOL; + exports.TerminatedCloseEvent = TerminatedCloseEvent; + exports.createClient = createClient; + exports.isMessage = isMessage; + exports.parseMessage = parseMessage; + exports.stringifyMessage = stringifyMessage; + exports.validateMessage = validateMessage; + +})); diff --git a/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.min.js b/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.min.js new file mode 100644 index 0000000..0d43885 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.min.js @@ -0,0 +1 @@ +!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).graphqlWs={})}(this,(function(e){"use strict";function o(e){return this instanceof o?(this.v=e,this):new o(e)}function t(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,s=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){s[e]&&(n[e]=function(o){return new Promise((function(t,r){i.push([e,o,t,r])>1||l(e,o)}))})}function l(e,t){try{(r=s[e](t)).value instanceof o?Promise.resolve(r.value.v).then(c,p):d(i[0][2],r)}catch(e){d(i[0][3],e)}var r}function c(e){l("next",e)}function p(e){l("throw",e)}function d(e,o){e(o),i.shift(),i.length&&l(i[0][0],i[0][1])}}function r(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function n(e){return"object"===r(e)}function s(e,o){return e.length<124?e:o}const i="graphql-transport-ws";var a,l;function c(o){if(!n(o))throw new Error(`Message is expected to be an object, but got ${r(o)}`);if(!o.type)throw new Error("Message is missing the 'type' property");if("string"!=typeof o.type)throw new Error(`Message is expects the 'type' property to be a string, but got ${r(o.type)}`);switch(o.type){case e.MessageType.ConnectionInit:case e.MessageType.ConnectionAck:case e.MessageType.Ping:case e.MessageType.Pong:if(null!=o.payload&&!n(o.payload))throw new Error(`"${o.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${o.payload}"`);break;case e.MessageType.Subscribe:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);if(!n(o.payload))throw new Error(`"${o.type}" message expects the 'payload' property to be an object, but got ${r(o.payload)}`);if("string"!=typeof o.payload.query)throw new Error(`"${o.type}" message payload expects the 'query' property to be a string, but got ${r(o.payload.query)}`);if(null!=o.payload.variables&&!n(o.payload.variables))throw new Error(`"${o.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${r(o.payload.variables)}`);if(null!=o.payload.operationName&&"string"!==r(o.payload.operationName))throw new Error(`"${o.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${r(o.payload.operationName)}`);if(null!=o.payload.extensions&&!n(o.payload.extensions))throw new Error(`"${o.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${r(o.payload.extensions)}`);break;case e.MessageType.Next:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);if(!n(o.payload))throw new Error(`"${o.type}" message expects the 'payload' property to be an object, but got ${r(o.payload)}`);break;case e.MessageType.Error:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);if(t=o.payload,!(Array.isArray(t)&&t.length>0&&t.every((e=>"message"in e))))throw new Error(`"${o.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(o.payload)}`);break;case e.MessageType.Complete:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);break;default:throw new Error(`Invalid message 'type' property "${o.type}"`)}var t;return o}function p(e,o){return c("string"==typeof e?JSON.parse(e,o):e)}function d(e,o){return c(e),JSON.stringify(e,o)}e.CloseCode=void 0,(a=e.CloseCode||(e.CloseCode={}))[a.InternalServerError=4500]="InternalServerError",a[a.InternalClientError=4005]="InternalClientError",a[a.BadRequest=4400]="BadRequest",a[a.BadResponse=4004]="BadResponse",a[a.Unauthorized=4401]="Unauthorized",a[a.Forbidden=4403]="Forbidden",a[a.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",a[a.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",a[a.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",a[a.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",a[a.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests",e.MessageType=void 0,(l=e.MessageType||(e.MessageType={})).ConnectionInit="connection_init",l.ConnectionAck="connection_ack",l.Ping="ping",l.Pong="pong",l.Subscribe="subscribe",l.Next="next",l.Error="error",l.Complete="complete";class y extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function u(e){return n(e)&&"code"in e&&"reason"in e}e.DEPRECATED_GRAPHQL_WS_PROTOCOL="graphql-ws",e.GRAPHQL_TRANSPORT_WS_PROTOCOL=i,e.TerminatedCloseEvent=y,e.createClient=function(r){const{url:n,connectionParams:a,lazy:l=!0,onNonLazyError:c=console.error,lazyCloseTimeout:g=0,keepAlive:f=0,disablePong:m,connectionAckWaitTimeout:h=0,retryAttempts:w=5,retryWait:b=async function(e){let o=1e3;for(let t=0;tsetTimeout(e,o+Math.floor(2700*Math.random()+300))))},shouldRetry:x=u,isFatalConnectionProblem:C,on:v,webSocketImpl:E,generateID:T=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const o=16*Math.random()|0;return("x"==e?o:3&o|8).toString(16)}))},jsonMessageReplacer:S,jsonMessageReviver:M}=r;let $;if(E){if(!("function"==typeof(P=E)&&"constructor"in P&&"CLOSED"in P&&"CLOSING"in P&&"CONNECTING"in P&&"OPEN"in P))throw new Error("Invalid WebSocket implementation provided");$=E}else"undefined"!=typeof WebSocket?$=WebSocket:"undefined"!=typeof global?$=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window&&($=window.WebSocket||window.MozWebSocket);var P;if(!$)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const I=$,N=(()=>{const e=(()=>{const e={};return{on:(o,t)=>(e[o]=t,()=>{delete e[o]}),emit(o){var t;"id"in o&&(null===(t=e[o.id])||void 0===t||t.call(e,o))}}})(),o={connecting:(null==v?void 0:v.connecting)?[v.connecting]:[],opened:(null==v?void 0:v.opened)?[v.opened]:[],connected:(null==v?void 0:v.connected)?[v.connected]:[],ping:(null==v?void 0:v.ping)?[v.ping]:[],pong:(null==v?void 0:v.pong)?[v.pong]:[],message:(null==v?void 0:v.message)?[e.emit,v.message]:[e.emit],closed:(null==v?void 0:v.closed)?[v.closed]:[],error:(null==v?void 0:v.error)?[v.error]:[]};return{onMessage:e.on,on(e,t){const r=o[e];return r.push(t),()=>{r.splice(r.indexOf(t),1)}},emit(e,...t){for(const r of[...o[e]])r(...t)}}})();function k(e){const o=[N.on("error",(t=>{o.forEach((e=>e())),e(t)})),N.on("closed",(t=>{o.forEach((e=>e())),e(t)}))]}let A,O,R=0,q=!1,W=0,j=!1;async function L(){clearTimeout(O);const[o,t]=await(null!=A?A:A=new Promise(((o,t)=>(async()=>{if(q){if(await b(W),!R)return A=void 0,t({code:1e3,reason:"All Subscriptions Gone"});W++}N.emit("connecting",q);const r=new I("function"==typeof n?await n():n,i);let l,c;function u(){isFinite(f)&&f>0&&(clearTimeout(c),c=setTimeout((()=>{r.readyState===I.OPEN&&(r.send(d({type:e.MessageType.Ping})),N.emit("ping",!1,void 0))}),f))}k((e=>{A=void 0,clearTimeout(l),clearTimeout(c),t(e),e instanceof y&&(r.close(4499,"Terminated"),r.onerror=null,r.onclose=null)})),r.onerror=e=>N.emit("error",e),r.onclose=e=>N.emit("closed",e),r.onopen=async()=>{try{N.emit("opened",r);const o="function"==typeof a?await a():a;if(r.readyState!==I.OPEN)return;r.send(d(o?{type:e.MessageType.ConnectionInit,payload:o}:{type:e.MessageType.ConnectionInit},S)),isFinite(h)&&h>0&&(l=setTimeout((()=>{r.close(e.CloseCode.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")}),h)),u()}catch(o){N.emit("error",o),r.close(e.CloseCode.InternalClientError,s(o instanceof Error?o.message:new Error(o).message,"Internal client error"))}};let g=!1;r.onmessage=({data:t})=>{try{const n=p(t,M);if(N.emit("message",n),"ping"===n.type||"pong"===n.type)return N.emit(n.type,!0,n.payload),void("pong"===n.type?u():m||(r.send(d(n.payload?{type:e.MessageType.Pong,payload:n.payload}:{type:e.MessageType.Pong})),N.emit("pong",!1,n.payload)));if(g)return;if(n.type!==e.MessageType.ConnectionAck)throw new Error(`First message cannot be of type ${n.type}`);clearTimeout(l),g=!0,N.emit("connected",r,n.payload,q),q=!1,W=0,o([r,new Promise(((e,o)=>k(o)))])}catch(o){r.onmessage=null,N.emit("error",o),r.close(e.CloseCode.BadResponse,s(o instanceof Error?o.message:new Error(o).message,"Bad response"))}}})())));o.readyState===I.CLOSING&&await t;let r=()=>{};const l=new Promise((e=>r=e));return[o,r,Promise.race([l.then((()=>{if(!R){const e=()=>o.close(1e3,"Normal Closure");isFinite(g)&&g>0?O=setTimeout((()=>{o.readyState===I.OPEN&&e()}),g):e()}})),t])]}function z(o){if(u(o)&&(t=o.code,![1e3,1001,1006,1005,1012,1013,1014].includes(t)&&t>=1e3&&t<=1999||[e.CloseCode.InternalServerError,e.CloseCode.InternalClientError,e.CloseCode.BadRequest,e.CloseCode.BadResponse,e.CloseCode.Unauthorized,e.CloseCode.SubprotocolNotAcceptable,e.CloseCode.SubscriberAlreadyExists,e.CloseCode.TooManyInitialisationRequests].includes(o.code)))throw o;var t;if(j)return!1;if(u(o)&&1e3===o.code)return R>0;if(!w||W>=w)throw o;if(!x(o))throw o;if(null==C?void 0:C(o))throw o;return q=!0}function B(o,t){const r=T(o);let n=!1,s=!1,i=()=>{R--,n=!0};return(async()=>{for(R++;;)try{const[a,l,c]=await L();if(n)return l();const p=N.onMessage(r,(o=>{switch(o.type){case e.MessageType.Next:return void t.next(o.payload);case e.MessageType.Error:return s=!0,n=!0,t.error(o.payload),void i();case e.MessageType.Complete:return n=!0,void i()}}));return a.send(d({id:r,type:e.MessageType.Subscribe,payload:o},S)),i=()=>{n||a.readyState!==I.OPEN||a.send(d({id:r,type:e.MessageType.Complete},S)),R--,n=!0,l()},void await c.finally(p)}catch(e){if(!z(e))return}})().then((()=>{s||t.complete()})).catch((e=>{t.error(e)})),()=>{n||i()}}return l||(async()=>{for(R++;;)try{const[,,e]=await L();await e}catch(e){try{if(!z(e))return}catch(e){return null==c?void 0:c(e)}}})(),{on:N.on,subscribe:B,iterate(e){const r=[],n={done:!1,error:null,resolve:()=>{}},s=B(e,{next(e){r.push(e),n.resolve()},error(e){n.done=!0,n.error=e,n.resolve()},complete(){n.done=!0,n.resolve()}}),i=function(){return t(this,arguments,(function*(){for(;;){for(r.length||(yield o(new Promise((e=>n.resolve=e))));r.length;)yield yield o(r.shift());if(n.error)throw n.error;if(n.done)return yield o(void 0)}}))}();return i.throw=async e=>(n.done||(n.done=!0,n.error=e,n.resolve()),{done:!0,value:void 0}),i.return=async()=>(s(),{done:!0,value:void 0}),i},async dispose(){if(j=!0,A){const[e]=await A;e.close(1e3,"Normal Closure")}},terminate(){A&&N.emit("closed",new y)}}},e.isMessage=function(e){try{return c(e),!0}catch(e){return!1}},e.parseMessage=p,e.stringifyMessage=d,e.validateMessage=c})); diff --git a/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.min.js.gz b/graphql-subscription-express/node_modules/graphql-ws/umd/graphql-ws.min.js.gz new file mode 100644 index 0000000000000000000000000000000000000000..4aeb974de558aab4f9c9254b8f5fbda4e83384a4 GIT binary patch literal 3841 zcmV+c5B~5UiwFo&fCOd$17~t!aAUYI6YX8f#PANb>vr3ZbIB(lXJR zgyc5z4laj~99Idjz!e`{t{~*GtsrZh(HL-S|M%;jhaN^iZg=m?)}>NrG}GPF)7{fA zX=^mkVwv#FV}$!lmtTKnv2-bwiy7l1huzP(ka?@+&a)vKB^evKTXu2Ehx3$mxo4pK z(6!`B3L2}`(tm?!I_&D9*LM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x!jK>|BhV>u>)7>5533dn^C| D&vt8+ literal 0 HcmV?d00001 diff --git a/graphql-subscription-express/node_modules/graphql/LICENSE b/graphql-subscription-express/node_modules/graphql/LICENSE new file mode 100644 index 0000000..7bbf892 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) GraphQL Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/graphql/NotSupportedTSVersion.d.ts b/graphql-subscription-express/node_modules/graphql/NotSupportedTSVersion.d.ts new file mode 100644 index 0000000..af77c30 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/NotSupportedTSVersion.d.ts @@ -0,0 +1 @@ +"Package 'graphql' support only TS versions that are >=4.1.0". \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/graphql/README.md b/graphql-subscription-express/node_modules/graphql/README.md new file mode 100644 index 0000000..3475347 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/README.md @@ -0,0 +1,158 @@ +# GraphQL.js + +The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook. + +[![npm version](https://badge.fury.io/js/graphql.svg)](https://badge.fury.io/js/graphql) +[![Build Status](https://github.com/graphql/graphql-js/workflows/CI/badge.svg?branch=main)](https://github.com/graphql/graphql-js/actions?query=branch%3Amain) +[![Coverage Status](https://codecov.io/gh/graphql/graphql-js/branch/main/graph/badge.svg)](https://codecov.io/gh/graphql/graphql-js) + +See more complete documentation at https://graphql.org/ and +https://graphql.org/graphql-js/. + +Looking for help? Find resources [from the community](https://graphql.org/community/). + +## Getting Started + +A general overview of GraphQL is available in the +[README](https://github.com/graphql/graphql-spec/blob/main/README.md) for the +[Specification for GraphQL](https://github.com/graphql/graphql-spec). That overview +describes a simple set of GraphQL examples that exist as [tests](src/__tests__) +in this repository. A good way to get started with this repository is to walk +through that README and the corresponding tests in parallel. + +### Using GraphQL.js + +Install GraphQL.js from npm + +With npm: + +```sh +npm install --save graphql +``` + +or using yarn: + +```sh +yarn add graphql +``` + +GraphQL.js provides two important capabilities: building a type schema and +serving queries against that type schema. + +First, build a GraphQL type schema which maps to your codebase. + +```js +import { + graphql, + GraphQLSchema, + GraphQLObjectType, + GraphQLString, +} from 'graphql'; + +var schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'RootQueryType', + fields: { + hello: { + type: GraphQLString, + resolve() { + return 'world'; + }, + }, + }, + }), +}); +``` + +This defines a simple schema, with one type and one field, that resolves +to a fixed value. The `resolve` function can return a value, a promise, +or an array of promises. A more complex example is included in the top-level [tests](src/__tests__) directory. + +Then, serve the result of a query against that type schema. + +```js +var source = '{ hello }'; + +graphql({ schema, source }).then((result) => { + // Prints + // { + // data: { hello: "world" } + // } + console.log(result); +}); +``` + +This runs a query fetching the one field defined. The `graphql` function will +first ensure the query is syntactically and semantically valid before executing +it, reporting errors otherwise. + +```js +var source = '{ BoyHowdy }'; + +graphql({ schema, source }).then((result) => { + // Prints + // { + // errors: [ + // { message: 'Cannot query field BoyHowdy on RootQueryType', + // locations: [ { line: 1, column: 3 } ] } + // ] + // } + console.log(result); +}); +``` + +**Note**: Please don't forget to set `NODE_ENV=production` if you are running a production server. It will disable some checks that can be useful during development but will significantly improve performance. + +### Want to ride the bleeding edge? + +The `npm` branch in this repository is automatically maintained to be the last +commit to `main` to pass all tests, in the same form found on npm. It is +recommended to use builds deployed to npm for many reasons, but if you want to use +the latest not-yet-released version of graphql-js, you can do so by depending +directly on this branch: + +``` +npm install graphql@git://github.com/graphql/graphql-js.git#npm +``` + +### Experimental features + +Each release of GraphQL.js will be accompanied by an experimental release containing support for the `@defer` and `@stream` directive proposal. We are hoping to get community feedback on these releases before the proposal is accepted into the GraphQL specification. You can use this experimental release of GraphQL.js by adding the following to your project's `package.json` file. + +``` +"graphql": "experimental-stream-defer" +``` + +Community feedback on this experimental release is much appreciated and can be provided on the [issue created for this purpose](https://github.com/graphql/graphql-js/issues/2848). + +### Using in a Browser + +GraphQL.js is a general-purpose library and can be used both in a Node server +and in the browser. As an example, the [GraphiQL](https://github.com/graphql/graphiql/) +tool is built with GraphQL.js! + +Building a project using GraphQL.js with [webpack](https://webpack.js.org) or +[rollup](https://github.com/rollup/rollup) should just work and only include +the portions of the library you use. This works because GraphQL.js is distributed +with both CommonJS (`require()`) and ESModule (`import`) files. Ensure that any +custom build configurations look for `.mjs` files! + +### Contributing + +We actively welcome pull requests. Learn how to [contribute](./.github/CONTRIBUTING.md). + +This repository is managed by EasyCLA. Project participants must sign the free ([GraphQL Specification Membership agreement](https://preview-spec-membership.graphql.org) before making a contribution. You only need to do this one time, and it can be signed by [individual contributors](http://individual-spec-membership.graphql.org/) or their [employers](http://corporate-spec-membership.graphql.org/). + +To initiate the signature process please open a PR against this repo. The EasyCLA bot will block the merge if we still need a membership agreement from you. + +You can find [detailed information here](https://github.com/graphql/graphql-wg/tree/main/membership). If you have issues, please email [operations@graphql.org](mailto:operations@graphql.org). + +If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the [GraphQL Foundation](https://foundation.graphql.org/join). + +### Changelog + +Changes are tracked as [GitHub releases](https://github.com/graphql/graphql-js/releases). + +### License + +GraphQL.js is [MIT-licensed](./LICENSE). diff --git a/graphql-subscription-express/node_modules/graphql/error/GraphQLError.d.ts b/graphql-subscription-express/node_modules/graphql/error/GraphQLError.d.ts new file mode 100644 index 0000000..e7f1a6a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/GraphQLError.d.ts @@ -0,0 +1,142 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ASTNode } from '../language/ast'; +import type { SourceLocation } from '../language/location'; +import type { Source } from '../language/source'; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLErrorExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLErrorOptions { + nodes?: ReadonlyArray | ASTNode | null; + source?: Maybe; + positions?: Maybe>; + path?: Maybe>; + originalError?: Maybe< + Error & { + readonly extensions?: unknown; + } + >; + extensions?: Maybe; +} +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ +export declare class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly locations: ReadonlyArray | undefined; + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly path: ReadonlyArray | undefined; + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + readonly nodes: ReadonlyArray | undefined; + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + readonly source: Source | undefined; + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + readonly positions: ReadonlyArray | undefined; + /** + * The original error thrown from a field resolver during execution. + */ + readonly originalError: Error | undefined; + /** + * Extension fields to add to the formatted error. + */ + readonly extensions: GraphQLErrorExtensions; + constructor(message: string, options?: GraphQLErrorOptions); + /** + * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. + */ + constructor( + message: string, + nodes?: ReadonlyArray | ASTNode | null, + source?: Maybe, + positions?: Maybe>, + path?: Maybe>, + originalError?: Maybe< + Error & { + readonly extensions?: unknown; + } + >, + extensions?: Maybe, + ); + get [Symbol.toStringTag](): string; + toString(): string; + toJSON(): GraphQLFormattedError; +} +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ +export interface GraphQLFormattedError { + /** + * A short, human-readable summary of the problem that **SHOULD NOT** change + * from occurrence to occurrence of the problem, except for purposes of + * localization. + */ + readonly message: string; + /** + * If an error can be associated to a particular point in the requested + * GraphQL document, it should contain a list of locations. + */ + readonly locations?: ReadonlyArray; + /** + * If an error can be associated to a particular field in the GraphQL result, + * it _must_ contain an entry with the key `path` that details the path of + * the response field which experienced the error. This allows clients to + * identify whether a null result is intentional or caused by a runtime error. + */ + readonly path?: ReadonlyArray; + /** + * Reserved for implementors to extend the protocol however they see fit, + * and hence there are no additional restrictions on its contents. + */ + readonly extensions?: { + [key: string]: unknown; + }; +} +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +export declare function printError(error: GraphQLError): string; +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toJSON` instead. Will be removed in v17 + */ +export declare function formatError(error: GraphQLError): GraphQLFormattedError; diff --git a/graphql-subscription-express/node_modules/graphql/error/GraphQLError.js b/graphql-subscription-express/node_modules/graphql/error/GraphQLError.js new file mode 100644 index 0000000..09d9939 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/GraphQLError.js @@ -0,0 +1,267 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLError = void 0; +exports.formatError = formatError; +exports.printError = printError; + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _location = require('../language/location.js'); + +var _printLocation = require('../language/printLocation.js'); + +function toNormalizedOptions(args) { + const firstArg = args[0]; + + if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) { + return { + nodes: firstArg, + source: args[1], + positions: args[2], + path: args[3], + originalError: args[4], + extensions: args[5], + }; + } + + return firstArg; +} +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ + +class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + + /** + * The original error thrown from a field resolver during execution. + */ + + /** + * Extension fields to add to the formatted error. + */ + + /** + * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. + */ + constructor(message, ...rawArgs) { + var _this$nodes, _nodeLocations$, _ref; + + const { nodes, source, positions, path, originalError, extensions } = + toNormalizedOptions(rawArgs); + super(message); + this.name = 'GraphQLError'; + this.path = path !== null && path !== void 0 ? path : undefined; + this.originalError = + originalError !== null && originalError !== void 0 + ? originalError + : undefined; // Compute list of blame nodes. + + this.nodes = undefinedIfEmpty( + Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined, + ); + const nodeLocations = undefinedIfEmpty( + (_this$nodes = this.nodes) === null || _this$nodes === void 0 + ? void 0 + : _this$nodes.map((node) => node.loc).filter((loc) => loc != null), + ); // Compute locations in the source for the given nodes/positions. + + this.source = + source !== null && source !== void 0 + ? source + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : (_nodeLocations$ = nodeLocations[0]) === null || + _nodeLocations$ === void 0 + ? void 0 + : _nodeLocations$.source; + this.positions = + positions !== null && positions !== void 0 + ? positions + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => loc.start); + this.locations = + positions && source + ? positions.map((pos) => (0, _location.getLocation)(source, pos)) + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => + (0, _location.getLocation)(loc.source, loc.start), + ); + const originalExtensions = (0, _isObjectLike.isObjectLike)( + originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions, + ) + ? originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions + : undefined; + this.extensions = + (_ref = + extensions !== null && extensions !== void 0 + ? extensions + : originalExtensions) !== null && _ref !== void 0 + ? _ref + : Object.create(null); // Only properties prescribed by the spec should be enumerable. + // Keep the rest as non-enumerable. + + Object.defineProperties(this, { + message: { + writable: true, + enumerable: true, + }, + name: { + enumerable: false, + }, + nodes: { + enumerable: false, + }, + source: { + enumerable: false, + }, + positions: { + enumerable: false, + }, + originalError: { + enumerable: false, + }, + }); // Include (non-enumerable) stack trace. + + /* c8 ignore start */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + + if ( + originalError !== null && + originalError !== void 0 && + originalError.stack + ) { + Object.defineProperty(this, 'stack', { + value: originalError.stack, + writable: true, + configurable: true, + }); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, GraphQLError); + } else { + Object.defineProperty(this, 'stack', { + value: Error().stack, + writable: true, + configurable: true, + }); + } + /* c8 ignore stop */ + } + + get [Symbol.toStringTag]() { + return 'GraphQLError'; + } + + toString() { + let output = this.message; + + if (this.nodes) { + for (const node of this.nodes) { + if (node.loc) { + output += '\n\n' + (0, _printLocation.printLocation)(node.loc); + } + } + } else if (this.source && this.locations) { + for (const location of this.locations) { + output += + '\n\n' + + (0, _printLocation.printSourceLocation)(this.source, location); + } + } + + return output; + } + + toJSON() { + const formattedError = { + message: this.message, + }; + + if (this.locations != null) { + formattedError.locations = this.locations; + } + + if (this.path != null) { + formattedError.path = this.path; + } + + if (this.extensions != null && Object.keys(this.extensions).length > 0) { + formattedError.extensions = this.extensions; + } + + return formattedError; + } +} + +exports.GraphQLError = GraphQLError; + +function undefinedIfEmpty(array) { + return array === undefined || array.length === 0 ? undefined : array; +} +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ + +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +function printError(error) { + return error.toString(); +} +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toJSON` instead. Will be removed in v17 + */ + +function formatError(error) { + return error.toJSON(); +} diff --git a/graphql-subscription-express/node_modules/graphql/error/GraphQLError.mjs b/graphql-subscription-express/node_modules/graphql/error/GraphQLError.mjs new file mode 100644 index 0000000..d2fe38a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/GraphQLError.mjs @@ -0,0 +1,253 @@ +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { getLocation } from '../language/location.mjs'; +import { + printLocation, + printSourceLocation, +} from '../language/printLocation.mjs'; + +function toNormalizedOptions(args) { + const firstArg = args[0]; + + if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) { + return { + nodes: firstArg, + source: args[1], + positions: args[2], + path: args[3], + originalError: args[4], + extensions: args[5], + }; + } + + return firstArg; +} +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ + +export class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + + /** + * The original error thrown from a field resolver during execution. + */ + + /** + * Extension fields to add to the formatted error. + */ + + /** + * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. + */ + constructor(message, ...rawArgs) { + var _this$nodes, _nodeLocations$, _ref; + + const { nodes, source, positions, path, originalError, extensions } = + toNormalizedOptions(rawArgs); + super(message); + this.name = 'GraphQLError'; + this.path = path !== null && path !== void 0 ? path : undefined; + this.originalError = + originalError !== null && originalError !== void 0 + ? originalError + : undefined; // Compute list of blame nodes. + + this.nodes = undefinedIfEmpty( + Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined, + ); + const nodeLocations = undefinedIfEmpty( + (_this$nodes = this.nodes) === null || _this$nodes === void 0 + ? void 0 + : _this$nodes.map((node) => node.loc).filter((loc) => loc != null), + ); // Compute locations in the source for the given nodes/positions. + + this.source = + source !== null && source !== void 0 + ? source + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : (_nodeLocations$ = nodeLocations[0]) === null || + _nodeLocations$ === void 0 + ? void 0 + : _nodeLocations$.source; + this.positions = + positions !== null && positions !== void 0 + ? positions + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => loc.start); + this.locations = + positions && source + ? positions.map((pos) => getLocation(source, pos)) + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => getLocation(loc.source, loc.start)); + const originalExtensions = isObjectLike( + originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions, + ) + ? originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions + : undefined; + this.extensions = + (_ref = + extensions !== null && extensions !== void 0 + ? extensions + : originalExtensions) !== null && _ref !== void 0 + ? _ref + : Object.create(null); // Only properties prescribed by the spec should be enumerable. + // Keep the rest as non-enumerable. + + Object.defineProperties(this, { + message: { + writable: true, + enumerable: true, + }, + name: { + enumerable: false, + }, + nodes: { + enumerable: false, + }, + source: { + enumerable: false, + }, + positions: { + enumerable: false, + }, + originalError: { + enumerable: false, + }, + }); // Include (non-enumerable) stack trace. + + /* c8 ignore start */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + + if ( + originalError !== null && + originalError !== void 0 && + originalError.stack + ) { + Object.defineProperty(this, 'stack', { + value: originalError.stack, + writable: true, + configurable: true, + }); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, GraphQLError); + } else { + Object.defineProperty(this, 'stack', { + value: Error().stack, + writable: true, + configurable: true, + }); + } + /* c8 ignore stop */ + } + + get [Symbol.toStringTag]() { + return 'GraphQLError'; + } + + toString() { + let output = this.message; + + if (this.nodes) { + for (const node of this.nodes) { + if (node.loc) { + output += '\n\n' + printLocation(node.loc); + } + } + } else if (this.source && this.locations) { + for (const location of this.locations) { + output += '\n\n' + printSourceLocation(this.source, location); + } + } + + return output; + } + + toJSON() { + const formattedError = { + message: this.message, + }; + + if (this.locations != null) { + formattedError.locations = this.locations; + } + + if (this.path != null) { + formattedError.path = this.path; + } + + if (this.extensions != null && Object.keys(this.extensions).length > 0) { + formattedError.extensions = this.extensions; + } + + return formattedError; + } +} + +function undefinedIfEmpty(array) { + return array === undefined || array.length === 0 ? undefined : array; +} +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ + +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +export function printError(error) { + return error.toString(); +} +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toJSON` instead. Will be removed in v17 + */ + +export function formatError(error) { + return error.toJSON(); +} diff --git a/graphql-subscription-express/node_modules/graphql/error/index.d.ts b/graphql-subscription-express/node_modules/graphql/error/index.d.ts new file mode 100644 index 0000000..d95f96f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/index.d.ts @@ -0,0 +1,8 @@ +export { GraphQLError, printError, formatError } from './GraphQLError'; +export type { + GraphQLErrorOptions, + GraphQLFormattedError, + GraphQLErrorExtensions, +} from './GraphQLError'; +export { syntaxError } from './syntaxError'; +export { locatedError } from './locatedError'; diff --git a/graphql-subscription-express/node_modules/graphql/error/index.js b/graphql-subscription-express/node_modules/graphql/error/index.js new file mode 100644 index 0000000..c508370 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/index.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'GraphQLError', { + enumerable: true, + get: function () { + return _GraphQLError.GraphQLError; + }, +}); +Object.defineProperty(exports, 'formatError', { + enumerable: true, + get: function () { + return _GraphQLError.formatError; + }, +}); +Object.defineProperty(exports, 'locatedError', { + enumerable: true, + get: function () { + return _locatedError.locatedError; + }, +}); +Object.defineProperty(exports, 'printError', { + enumerable: true, + get: function () { + return _GraphQLError.printError; + }, +}); +Object.defineProperty(exports, 'syntaxError', { + enumerable: true, + get: function () { + return _syntaxError.syntaxError; + }, +}); + +var _GraphQLError = require('./GraphQLError.js'); + +var _syntaxError = require('./syntaxError.js'); + +var _locatedError = require('./locatedError.js'); diff --git a/graphql-subscription-express/node_modules/graphql/error/index.mjs b/graphql-subscription-express/node_modules/graphql/error/index.mjs new file mode 100644 index 0000000..d3507ff --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/index.mjs @@ -0,0 +1,3 @@ +export { GraphQLError, printError, formatError } from './GraphQLError.mjs'; +export { syntaxError } from './syntaxError.mjs'; +export { locatedError } from './locatedError.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/error/locatedError.d.ts b/graphql-subscription-express/node_modules/graphql/error/locatedError.d.ts new file mode 100644 index 0000000..8aa7f4a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/locatedError.d.ts @@ -0,0 +1,13 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ASTNode } from '../language/ast'; +import { GraphQLError } from './GraphQLError'; +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ +export declare function locatedError( + rawOriginalError: unknown, + nodes: ASTNode | ReadonlyArray | undefined | null, + path?: Maybe>, +): GraphQLError; diff --git a/graphql-subscription-express/node_modules/graphql/error/locatedError.js b/graphql-subscription-express/node_modules/graphql/error/locatedError.js new file mode 100644 index 0000000..48e5b99 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/locatedError.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.locatedError = locatedError; + +var _toError = require('../jsutils/toError.js'); + +var _GraphQLError = require('./GraphQLError.js'); + +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ +function locatedError(rawOriginalError, nodes, path) { + var _nodes; + + const originalError = (0, _toError.toError)(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + + if (isLocatedGraphQLError(originalError)) { + return originalError; + } + + return new _GraphQLError.GraphQLError(originalError.message, { + nodes: + (_nodes = originalError.nodes) !== null && _nodes !== void 0 + ? _nodes + : nodes, + source: originalError.source, + positions: originalError.positions, + path, + originalError, + }); +} + +function isLocatedGraphQLError(error) { + return Array.isArray(error.path); +} diff --git a/graphql-subscription-express/node_modules/graphql/error/locatedError.mjs b/graphql-subscription-express/node_modules/graphql/error/locatedError.mjs new file mode 100644 index 0000000..572e398 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/locatedError.mjs @@ -0,0 +1,32 @@ +import { toError } from '../jsutils/toError.mjs'; +import { GraphQLError } from './GraphQLError.mjs'; +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ + +export function locatedError(rawOriginalError, nodes, path) { + var _nodes; + + const originalError = toError(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + + if (isLocatedGraphQLError(originalError)) { + return originalError; + } + + return new GraphQLError(originalError.message, { + nodes: + (_nodes = originalError.nodes) !== null && _nodes !== void 0 + ? _nodes + : nodes, + source: originalError.source, + positions: originalError.positions, + path, + originalError, + }); +} + +function isLocatedGraphQLError(error) { + return Array.isArray(error.path); +} diff --git a/graphql-subscription-express/node_modules/graphql/error/syntaxError.d.ts b/graphql-subscription-express/node_modules/graphql/error/syntaxError.d.ts new file mode 100644 index 0000000..3a4ceba --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/syntaxError.d.ts @@ -0,0 +1,11 @@ +import type { Source } from '../language/source'; +import { GraphQLError } from './GraphQLError'; +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ +export declare function syntaxError( + source: Source, + position: number, + description: string, +): GraphQLError; diff --git a/graphql-subscription-express/node_modules/graphql/error/syntaxError.js b/graphql-subscription-express/node_modules/graphql/error/syntaxError.js new file mode 100644 index 0000000..eb7dfc4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/syntaxError.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.syntaxError = syntaxError; + +var _GraphQLError = require('./GraphQLError.js'); + +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ +function syntaxError(source, position, description) { + return new _GraphQLError.GraphQLError(`Syntax Error: ${description}`, { + source, + positions: [position], + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/error/syntaxError.mjs b/graphql-subscription-express/node_modules/graphql/error/syntaxError.mjs new file mode 100644 index 0000000..e5b2d74 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/error/syntaxError.mjs @@ -0,0 +1,12 @@ +import { GraphQLError } from './GraphQLError.mjs'; +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ + +export function syntaxError(source, position, description) { + return new GraphQLError(`Syntax Error: ${description}`, { + source, + positions: [position], + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/collectFields.d.ts b/graphql-subscription-express/node_modules/graphql/execution/collectFields.d.ts new file mode 100644 index 0000000..67532c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/collectFields.d.ts @@ -0,0 +1,45 @@ +import type { ObjMap } from '../jsutils/ObjMap'; +import type { + FieldNode, + FragmentDefinitionNode, + SelectionSetNode, +} from '../language/ast'; +import type { GraphQLObjectType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Given a selectionSet, collects all of the fields and returns them. + * + * CollectFields requires the "runtime type" of an object. For a field that + * returns an Interface or Union type, the "runtime type" will be the actual + * object type returned by that field. + * + * @internal + */ +export declare function collectFields( + schema: GraphQLSchema, + fragments: ObjMap, + variableValues: { + [variable: string]: unknown; + }, + runtimeType: GraphQLObjectType, + selectionSet: SelectionSetNode, +): Map>; +/** + * Given an array of field nodes, collects all of the subfields of the passed + * in fields, and returns them at the end. + * + * CollectSubFields requires the "return type" of an object. For a field that + * returns an Interface or Union type, the "return type" will be the actual + * object type returned by that field. + * + * @internal + */ +export declare function collectSubfields( + schema: GraphQLSchema, + fragments: ObjMap, + variableValues: { + [variable: string]: unknown; + }, + returnType: GraphQLObjectType, + fieldNodes: ReadonlyArray, +): Map>; diff --git a/graphql-subscription-express/node_modules/graphql/execution/collectFields.js b/graphql-subscription-express/node_modules/graphql/execution/collectFields.js new file mode 100644 index 0000000..4259219 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/collectFields.js @@ -0,0 +1,229 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.collectFields = collectFields; +exports.collectSubfields = collectSubfields; + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _typeFromAST = require('../utilities/typeFromAST.js'); + +var _values = require('./values.js'); + +/** + * Given a selectionSet, collects all of the fields and returns them. + * + * CollectFields requires the "runtime type" of an object. For a field that + * returns an Interface or Union type, the "runtime type" will be the actual + * object type returned by that field. + * + * @internal + */ +function collectFields( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, +) { + const fields = new Map(); + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + new Set(), + ); + return fields; +} +/** + * Given an array of field nodes, collects all of the subfields of the passed + * in fields, and returns them at the end. + * + * CollectSubFields requires the "return type" of an object. For a field that + * returns an Interface or Union type, the "return type" will be the actual + * object type returned by that field. + * + * @internal + */ + +function collectSubfields( + schema, + fragments, + variableValues, + returnType, + fieldNodes, +) { + const subFieldNodes = new Map(); + const visitedFragmentNames = new Set(); + + for (const node of fieldNodes) { + if (node.selectionSet) { + collectFieldsImpl( + schema, + fragments, + variableValues, + returnType, + node.selectionSet, + subFieldNodes, + visitedFragmentNames, + ); + } + } + + return subFieldNodes; +} + +function collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + visitedFragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case _kinds.Kind.FIELD: { + if (!shouldIncludeNode(variableValues, selection)) { + continue; + } + + const name = getFieldEntryKey(selection); + const fieldList = fields.get(name); + + if (fieldList !== undefined) { + fieldList.push(selection); + } else { + fields.set(name, [selection]); + } + + break; + } + + case _kinds.Kind.INLINE_FRAGMENT: { + if ( + !shouldIncludeNode(variableValues, selection) || + !doesFragmentConditionMatch(schema, selection, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selection.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + + case _kinds.Kind.FRAGMENT_SPREAD: { + const fragName = selection.name.value; + + if ( + visitedFragmentNames.has(fragName) || + !shouldIncludeNode(variableValues, selection) + ) { + continue; + } + + visitedFragmentNames.add(fragName); + const fragment = fragments[fragName]; + + if ( + !fragment || + !doesFragmentConditionMatch(schema, fragment, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + fragment.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + } + } +} +/** + * Determines if a field should be included based on the `@include` and `@skip` + * directives, where `@skip` has higher precedence than `@include`. + */ + +function shouldIncludeNode(variableValues, node) { + const skip = (0, _values.getDirectiveValues)( + _directives.GraphQLSkipDirective, + node, + variableValues, + ); + + if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { + return false; + } + + const include = (0, _values.getDirectiveValues)( + _directives.GraphQLIncludeDirective, + node, + variableValues, + ); + + if ( + (include === null || include === void 0 ? void 0 : include.if) === false + ) { + return false; + } + + return true; +} +/** + * Determines if a fragment is applicable to the given type. + */ + +function doesFragmentConditionMatch(schema, fragment, type) { + const typeConditionNode = fragment.typeCondition; + + if (!typeConditionNode) { + return true; + } + + const conditionalType = (0, _typeFromAST.typeFromAST)( + schema, + typeConditionNode, + ); + + if (conditionalType === type) { + return true; + } + + if ((0, _definition.isAbstractType)(conditionalType)) { + return schema.isSubType(conditionalType, type); + } + + return false; +} +/** + * Implements the logic to compute the key of a given field's entry + */ + +function getFieldEntryKey(node) { + return node.alias ? node.alias.value : node.name.value; +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/collectFields.mjs b/graphql-subscription-express/node_modules/graphql/execution/collectFields.mjs new file mode 100644 index 0000000..cb88797 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/collectFields.mjs @@ -0,0 +1,213 @@ +import { Kind } from '../language/kinds.mjs'; +import { isAbstractType } from '../type/definition.mjs'; +import { + GraphQLIncludeDirective, + GraphQLSkipDirective, +} from '../type/directives.mjs'; +import { typeFromAST } from '../utilities/typeFromAST.mjs'; +import { getDirectiveValues } from './values.mjs'; +/** + * Given a selectionSet, collects all of the fields and returns them. + * + * CollectFields requires the "runtime type" of an object. For a field that + * returns an Interface or Union type, the "runtime type" will be the actual + * object type returned by that field. + * + * @internal + */ + +export function collectFields( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, +) { + const fields = new Map(); + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + new Set(), + ); + return fields; +} +/** + * Given an array of field nodes, collects all of the subfields of the passed + * in fields, and returns them at the end. + * + * CollectSubFields requires the "return type" of an object. For a field that + * returns an Interface or Union type, the "return type" will be the actual + * object type returned by that field. + * + * @internal + */ + +export function collectSubfields( + schema, + fragments, + variableValues, + returnType, + fieldNodes, +) { + const subFieldNodes = new Map(); + const visitedFragmentNames = new Set(); + + for (const node of fieldNodes) { + if (node.selectionSet) { + collectFieldsImpl( + schema, + fragments, + variableValues, + returnType, + node.selectionSet, + subFieldNodes, + visitedFragmentNames, + ); + } + } + + return subFieldNodes; +} + +function collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + visitedFragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case Kind.FIELD: { + if (!shouldIncludeNode(variableValues, selection)) { + continue; + } + + const name = getFieldEntryKey(selection); + const fieldList = fields.get(name); + + if (fieldList !== undefined) { + fieldList.push(selection); + } else { + fields.set(name, [selection]); + } + + break; + } + + case Kind.INLINE_FRAGMENT: { + if ( + !shouldIncludeNode(variableValues, selection) || + !doesFragmentConditionMatch(schema, selection, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selection.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + + case Kind.FRAGMENT_SPREAD: { + const fragName = selection.name.value; + + if ( + visitedFragmentNames.has(fragName) || + !shouldIncludeNode(variableValues, selection) + ) { + continue; + } + + visitedFragmentNames.add(fragName); + const fragment = fragments[fragName]; + + if ( + !fragment || + !doesFragmentConditionMatch(schema, fragment, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + fragment.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + } + } +} +/** + * Determines if a field should be included based on the `@include` and `@skip` + * directives, where `@skip` has higher precedence than `@include`. + */ + +function shouldIncludeNode(variableValues, node) { + const skip = getDirectiveValues(GraphQLSkipDirective, node, variableValues); + + if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { + return false; + } + + const include = getDirectiveValues( + GraphQLIncludeDirective, + node, + variableValues, + ); + + if ( + (include === null || include === void 0 ? void 0 : include.if) === false + ) { + return false; + } + + return true; +} +/** + * Determines if a fragment is applicable to the given type. + */ + +function doesFragmentConditionMatch(schema, fragment, type) { + const typeConditionNode = fragment.typeCondition; + + if (!typeConditionNode) { + return true; + } + + const conditionalType = typeFromAST(schema, typeConditionNode); + + if (conditionalType === type) { + return true; + } + + if (isAbstractType(conditionalType)) { + return schema.isSubType(conditionalType, type); + } + + return false; +} +/** + * Implements the logic to compute the key of a given field's entry + */ + +function getFieldEntryKey(node) { + return node.alias ? node.alias.value : node.name.value; +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/execute.d.ts b/graphql-subscription-express/node_modules/graphql/execution/execute.d.ts new file mode 100644 index 0000000..fa3dff9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/execute.d.ts @@ -0,0 +1,185 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { Path } from '../jsutils/Path'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +import type { GraphQLFormattedError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError'; +import type { + DocumentNode, + FieldNode, + FragmentDefinitionNode, + OperationDefinitionNode, +} from '../language/ast'; +import type { + GraphQLField, + GraphQLFieldResolver, + GraphQLObjectType, + GraphQLResolveInfo, + GraphQLTypeResolver, +} from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ +export interface ExecutionContext { + schema: GraphQLSchema; + fragments: ObjMap; + rootValue: unknown; + contextValue: unknown; + operation: OperationDefinitionNode; + variableValues: { + [variable: string]: unknown; + }; + fieldResolver: GraphQLFieldResolver; + typeResolver: GraphQLTypeResolver; + subscribeFieldResolver: GraphQLFieldResolver; + errors: Array; +} +/** + * The result of GraphQL execution. + * + * - `errors` is included when any errors occurred as a non-empty array. + * - `data` is the result of a successful execution of the query. + * - `extensions` is reserved for adding non-standard properties. + */ +export interface ExecutionResult< + TData = ObjMap, + TExtensions = ObjMap, +> { + errors?: ReadonlyArray; + data?: TData | null; + extensions?: TExtensions; +} +export interface FormattedExecutionResult< + TData = ObjMap, + TExtensions = ObjMap, +> { + errors?: ReadonlyArray; + data?: TData | null; + extensions?: TExtensions; +} +export interface ExecutionArgs { + schema: GraphQLSchema; + document: DocumentNode; + rootValue?: unknown; + contextValue?: unknown; + variableValues?: Maybe<{ + readonly [variable: string]: unknown; + }>; + operationName?: Maybe; + fieldResolver?: Maybe>; + typeResolver?: Maybe>; + subscribeFieldResolver?: Maybe>; +} +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the arguments to this function do not result in a legal execution context, + * a GraphQLError will be thrown immediately explaining the invalid input. + */ +export declare function execute( + args: ExecutionArgs, +): PromiseOrValue; +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ +export declare function executeSync(args: ExecutionArgs): ExecutionResult; +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ +export declare function assertValidExecutionArguments( + schema: GraphQLSchema, + document: DocumentNode, + rawVariableValues: Maybe<{ + readonly [variable: string]: unknown; + }>, +): void; +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ +export declare function buildExecutionContext( + args: ExecutionArgs, +): ReadonlyArray | ExecutionContext; +/** + * @internal + */ +export declare function buildResolveInfo( + exeContext: ExecutionContext, + fieldDef: GraphQLField, + fieldNodes: ReadonlyArray, + parentType: GraphQLObjectType, + path: Path, +): GraphQLResolveInfo; +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ +export declare const defaultTypeResolver: GraphQLTypeResolver; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ +export declare const defaultFieldResolver: GraphQLFieldResolver< + unknown, + unknown +>; +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ +export declare function getFieldDef( + schema: GraphQLSchema, + parentType: GraphQLObjectType, + fieldNode: FieldNode, +): Maybe>; diff --git a/graphql-subscription-express/node_modules/graphql/execution/execute.js b/graphql-subscription-express/node_modules/graphql/execution/execute.js new file mode 100644 index 0000000..cab41cf --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/execute.js @@ -0,0 +1,1037 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidExecutionArguments = assertValidExecutionArguments; +exports.buildExecutionContext = buildExecutionContext; +exports.buildResolveInfo = buildResolveInfo; +exports.defaultTypeResolver = exports.defaultFieldResolver = void 0; +exports.execute = execute; +exports.executeSync = executeSync; +exports.getFieldDef = getFieldDef; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _isIterableObject = require('../jsutils/isIterableObject.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _isPromise = require('../jsutils/isPromise.js'); + +var _memoize = require('../jsutils/memoize3.js'); + +var _Path = require('../jsutils/Path.js'); + +var _promiseForObject = require('../jsutils/promiseForObject.js'); + +var _promiseReduce = require('../jsutils/promiseReduce.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _locatedError = require('../error/locatedError.js'); + +var _ast = require('../language/ast.js'); + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +var _introspection = require('../type/introspection.js'); + +var _validate = require('../type/validate.js'); + +var _collectFields = require('./collectFields.js'); + +var _values = require('./values.js'); + +/** + * A memoized collection of relevant subfields with regard to the return + * type. Memoizing ensures the subfields are not repeatedly calculated, which + * saves overhead when resolving lists of values. + */ +const collectSubfields = (0, _memoize.memoize3)( + (exeContext, returnType, fieldNodes) => + (0, _collectFields.collectSubfields)( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + returnType, + fieldNodes, + ), +); +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ + +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ + +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the arguments to this function do not result in a legal execution context, + * a GraphQLError will be thrown immediately explaining the invalid input. + */ +function execute(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + (0, _devAssert.devAssert)( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { schema, document, variableValues, rootValue } = args; // If arguments are missing or incorrect, throw an error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = buildExecutionContext(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } // Return a Promise that will eventually resolve to the data described by + // The "Response" section of the GraphQL specification. + // + // If errors are encountered while executing a GraphQL field, only that + // field and its descendants will be omitted, and sibling fields will still + // be executed. An execution which encounters errors will still result in a + // resolved Promise. + // + // Errors from sub-fields of a NonNull type may propagate to the top level, + // at which point we still log the error and null the parent field, which + // in this case is the entire response. + + try { + const { operation } = exeContext; + const result = executeOperation(exeContext, operation, rootValue); + + if ((0, _isPromise.isPromise)(result)) { + return result.then( + (data) => buildResponse(data, exeContext.errors), + (error) => { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + }, + ); + } + + return buildResponse(result, exeContext.errors); + } catch (error) { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + } +} +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +function executeSync(args) { + const result = execute(args); // Assert that the execution was synchronous. + + if ((0, _isPromise.isPromise)(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} +/** + * Given a completed execution context and data, build the `{ errors, data }` + * response defined by the "Response" section of the GraphQL specification. + */ + +function buildResponse(data, errors) { + return errors.length === 0 + ? { + data, + } + : { + errors, + data, + }; +} +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ + +function assertValidExecutionArguments(schema, document, rawVariableValues) { + document || (0, _devAssert.devAssert)(false, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. + + (0, _validate.assertValidSchema)(schema); // Variables, if provided, must be an object. + + rawVariableValues == null || + (0, _isObjectLike.isObjectLike)(rawVariableValues) || + (0, _devAssert.devAssert)( + false, + 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', + ); +} +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ + +function buildExecutionContext(args) { + var _definition$name, _operation$variableDe; + + const { + schema, + document, + rootValue, + contextValue, + variableValues: rawVariableValues, + operationName, + fieldResolver, + typeResolver, + subscribeFieldResolver, + } = args; + let operation; + const fragments = Object.create(null); + + for (const definition of document.definitions) { + switch (definition.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + if (operationName == null) { + if (operation !== undefined) { + return [ + new _GraphQLError.GraphQLError( + 'Must provide operation name if query contains multiple operations.', + ), + ]; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + operation = definition; + } + + break; + + case _kinds.Kind.FRAGMENT_DEFINITION: + fragments[definition.name.value] = definition; + break; + + default: // ignore non-executable definitions + } + } + + if (!operation) { + if (operationName != null) { + return [ + new _GraphQLError.GraphQLError( + `Unknown operation named "${operationName}".`, + ), + ]; + } + + return [new _GraphQLError.GraphQLError('Must provide an operation.')]; + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const variableDefinitions = + (_operation$variableDe = operation.variableDefinitions) !== null && + _operation$variableDe !== void 0 + ? _operation$variableDe + : []; + const coercedVariableValues = (0, _values.getVariableValues)( + schema, + variableDefinitions, + rawVariableValues !== null && rawVariableValues !== void 0 + ? rawVariableValues + : {}, + { + maxErrors: 50, + }, + ); + + if (coercedVariableValues.errors) { + return coercedVariableValues.errors; + } + + return { + schema, + fragments, + rootValue, + contextValue, + operation, + variableValues: coercedVariableValues.coerced, + fieldResolver: + fieldResolver !== null && fieldResolver !== void 0 + ? fieldResolver + : defaultFieldResolver, + typeResolver: + typeResolver !== null && typeResolver !== void 0 + ? typeResolver + : defaultTypeResolver, + subscribeFieldResolver: + subscribeFieldResolver !== null && subscribeFieldResolver !== void 0 + ? subscribeFieldResolver + : defaultFieldResolver, + errors: [], + }; +} +/** + * Implements the "Executing operations" section of the spec. + */ + +function executeOperation(exeContext, operation, rootValue) { + const rootType = exeContext.schema.getRootType(operation.operation); + + if (rootType == null) { + throw new _GraphQLError.GraphQLError( + `Schema is not configured to execute ${operation.operation} operation.`, + { + nodes: operation, + }, + ); + } + + const rootFields = (0, _collectFields.collectFields)( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + rootType, + operation.selectionSet, + ); + const path = undefined; + + switch (operation.operation) { + case _ast.OperationTypeNode.QUERY: + return executeFields(exeContext, rootType, rootValue, path, rootFields); + + case _ast.OperationTypeNode.MUTATION: + return executeFieldsSerially( + exeContext, + rootType, + rootValue, + path, + rootFields, + ); + + case _ast.OperationTypeNode.SUBSCRIPTION: + // TODO: deprecate `subscribe` and move all logic here + // Temporary solution until we finish merging execute and subscribe together + return executeFields(exeContext, rootType, rootValue, path, rootFields); + } +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that must be executed serially. + */ + +function executeFieldsSerially( + exeContext, + parentType, + sourceValue, + path, + fields, +) { + return (0, _promiseReduce.promiseReduce)( + fields.entries(), + (results, [responseName, fieldNodes]) => { + const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result === undefined) { + return results; + } + + if ((0, _isPromise.isPromise)(result)) { + return result.then((resolvedResult) => { + results[responseName] = resolvedResult; + return results; + }); + } + + results[responseName] = result; + return results; + }, + Object.create(null), + ); +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that may be executed in parallel. + */ + +function executeFields(exeContext, parentType, sourceValue, path, fields) { + const results = Object.create(null); + let containsPromise = false; + + try { + for (const [responseName, fieldNodes] of fields.entries()) { + const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result !== undefined) { + results[responseName] = result; + + if ((0, _isPromise.isPromise)(result)) { + containsPromise = true; + } + } + } + } catch (error) { + if (containsPromise) { + // Ensure that any promises returned by other fields are handled, as they may also reject. + return (0, _promiseForObject.promiseForObject)(results).finally(() => { + throw error; + }); + } + + throw error; + } // If there are no promises, we can just return the object + + if (!containsPromise) { + return results; + } // Otherwise, results is a map from field name to the result of resolving that + // field, which is possibly a promise. Return a promise that will return this + // same map, but with any promises replaced with the values they resolved to. + + return (0, _promiseForObject.promiseForObject)(results); +} +/** + * Implements the "Executing fields" section of the spec + * In particular, this function figures out the value that the field returns by + * calling its resolve function, then calls completeValue to complete promises, + * serialize scalars, or execute the sub-selection-set for objects. + */ + +function executeField(exeContext, parentType, source, fieldNodes, path) { + var _fieldDef$resolve; + + const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]); + + if (!fieldDef) { + return; + } + + const returnType = fieldDef.type; + const resolveFn = + (_fieldDef$resolve = fieldDef.resolve) !== null && + _fieldDef$resolve !== void 0 + ? _fieldDef$resolve + : exeContext.fieldResolver; + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + parentType, + path, + ); // Get the resolve function, regardless of if its result is normal or abrupt (error). + + try { + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + // TODO: find a way to memoize, in case this field is within a List type. + const args = (0, _values.getArgumentValues)( + fieldDef, + fieldNodes[0], + exeContext.variableValues, + ); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; + const result = resolveFn(source, args, contextValue, info); + let completed; + + if ((0, _isPromise.isPromise)(result)) { + completed = result.then((resolved) => + completeValue(exeContext, returnType, fieldNodes, info, path, resolved), + ); + } else { + completed = completeValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + + if ((0, _isPromise.isPromise)(completed)) { + // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + return completed.then(undefined, (rawError) => { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(path), + ); + return handleFieldError(error, returnType, exeContext); + }); + } + + return completed; + } catch (rawError) { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(path), + ); + return handleFieldError(error, returnType, exeContext); + } +} +/** + * @internal + */ + +function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { + // The resolve function's optional fourth argument is a collection of + // information about the current execution state. + return { + fieldName: fieldDef.name, + fieldNodes, + returnType: fieldDef.type, + parentType, + path, + schema: exeContext.schema, + fragments: exeContext.fragments, + rootValue: exeContext.rootValue, + operation: exeContext.operation, + variableValues: exeContext.variableValues, + }; +} + +function handleFieldError(error, returnType, exeContext) { + // If the field type is non-nullable, then it is resolved without any + // protection from errors, however it still properly locates the error. + if ((0, _definition.isNonNullType)(returnType)) { + throw error; + } // Otherwise, error protection is applied, logging the error and resolving + // a null value for this field if one is encountered. + + exeContext.errors.push(error); + return null; +} +/** + * Implements the instructions for completeValue as defined in the + * "Value Completion" section of the spec. + * + * If the field type is Non-Null, then this recursively completes the value + * for the inner type. It throws a field error if that completion returns null, + * as per the "Nullability" section of the spec. + * + * If the field type is a List, then this recursively completes the value + * for the inner type on each item in the list. + * + * If the field type is a Scalar or Enum, ensures the completed value is a legal + * value of the type by calling the `serialize` method of GraphQL type + * definition. + * + * If the field is an abstract type, determine the runtime type of the value + * and then complete based on that type + * + * Otherwise, the field type expects a sub-selection set, and will complete the + * value by executing all sub-selections. + */ + +function completeValue(exeContext, returnType, fieldNodes, info, path, result) { + // If result is an Error, throw a located error. + if (result instanceof Error) { + throw result; + } // If field type is NonNull, complete for inner type, and throw field error + // if result is null. + + if ((0, _definition.isNonNullType)(returnType)) { + const completed = completeValue( + exeContext, + returnType.ofType, + fieldNodes, + info, + path, + result, + ); + + if (completed === null) { + throw new Error( + `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`, + ); + } + + return completed; + } // If result value is null or undefined then return null. + + if (result == null) { + return null; + } // If field type is List, complete each item in the list with the inner type + + if ((0, _definition.isListType)(returnType)) { + return completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, + // returning null if serialization is not possible. + + if ((0, _definition.isLeafType)(returnType)) { + return completeLeafValue(returnType, result); + } // If field type is an abstract type, Interface or Union, determine the + // runtime Object type and complete for that type. + + if ((0, _definition.isAbstractType)(returnType)) { + return completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is Object, execute and complete all sub-selections. + + if ((0, _definition.isObjectType)(returnType)) { + return completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + /* c8 ignore next 6 */ + // Not reachable, all possible output types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Cannot complete value of unexpected output type: ' + + (0, _inspect.inspect)(returnType), + ); +} +/** + * Complete a list value by completing each item in the list with the + * inner type + */ + +function completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + if (!(0, _isIterableObject.isIterableObject)(result)) { + throw new _GraphQLError.GraphQLError( + `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`, + ); + } // This is specified as a simple map, however we're optimizing the path + // where the list contains no Promises by avoiding creating another Promise. + + const itemType = returnType.ofType; + let containsPromise = false; + const completedResults = Array.from(result, (item, index) => { + // No need to modify the info object containing the path, + // since from here on it is not ever accessed by resolver functions. + const itemPath = (0, _Path.addPath)(path, index, undefined); + + try { + let completedItem; + + if ((0, _isPromise.isPromise)(item)) { + completedItem = item.then((resolved) => + completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + resolved, + ), + ); + } else { + completedItem = completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + item, + ); + } + + if ((0, _isPromise.isPromise)(completedItem)) { + containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + + return completedItem.then(undefined, (rawError) => { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(itemPath), + ); + return handleFieldError(error, itemType, exeContext); + }); + } + + return completedItem; + } catch (rawError) { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(itemPath), + ); + return handleFieldError(error, itemType, exeContext); + } + }); + return containsPromise ? Promise.all(completedResults) : completedResults; +} +/** + * Complete a Scalar or Enum by serializing to a valid value, returning + * null if serialization is not possible. + */ + +function completeLeafValue(returnType, result) { + const serializedResult = returnType.serialize(result); + + if (serializedResult == null) { + throw new Error( + `Expected \`${(0, _inspect.inspect)(returnType)}.serialize(${(0, + _inspect.inspect)(result)})\` to ` + + `return non-nullable value, returned: ${(0, _inspect.inspect)( + serializedResult, + )}`, + ); + } + + return serializedResult; +} +/** + * Complete a value of an abstract type by determining the runtime object type + * of that value, then complete the value for that type. + */ + +function completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + var _returnType$resolveTy; + + const resolveTypeFn = + (_returnType$resolveTy = returnType.resolveType) !== null && + _returnType$resolveTy !== void 0 + ? _returnType$resolveTy + : exeContext.typeResolver; + const contextValue = exeContext.contextValue; + const runtimeType = resolveTypeFn(result, contextValue, info, returnType); + + if ((0, _isPromise.isPromise)(runtimeType)) { + return runtimeType.then((resolvedRuntimeType) => + completeObjectValue( + exeContext, + ensureValidRuntimeType( + resolvedRuntimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ), + ); + } + + return completeObjectValue( + exeContext, + ensureValidRuntimeType( + runtimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ); +} + +function ensureValidRuntimeType( + runtimeTypeName, + exeContext, + returnType, + fieldNodes, + info, + result, +) { + if (runtimeTypeName == null) { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, + fieldNodes, + ); + } // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` + // TODO: remove in 17.0.0 release + + if ((0, _definition.isObjectType)(runtimeTypeName)) { + throw new _GraphQLError.GraphQLError( + 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', + ); + } + + if (typeof runtimeTypeName !== 'string') { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` + + `value ${(0, _inspect.inspect)(result)}, received "${(0, + _inspect.inspect)(runtimeTypeName)}".`, + ); + } + + const runtimeType = exeContext.schema.getType(runtimeTypeName); + + if (runtimeType == null) { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`, + { + nodes: fieldNodes, + }, + ); + } + + if (!(0, _definition.isObjectType)(runtimeType)) { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`, + { + nodes: fieldNodes, + }, + ); + } + + if (!exeContext.schema.isSubType(returnType, runtimeType)) { + throw new _GraphQLError.GraphQLError( + `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, + { + nodes: fieldNodes, + }, + ); + } + + return runtimeType; +} +/** + * Complete an Object value by executing all sub-selections. + */ + +function completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + // Collect sub-fields to execute to complete this value. + const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); // If there is an isTypeOf predicate function, call it with the + // current result. If isTypeOf returns false, then raise an error rather + // than continuing execution. + + if (returnType.isTypeOf) { + const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); + + if ((0, _isPromise.isPromise)(isTypeOf)) { + return isTypeOf.then((resolvedIsTypeOf) => { + if (!resolvedIsTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + + return executeFields( + exeContext, + returnType, + result, + path, + subFieldNodes, + ); + }); + } + + if (!isTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + } + + return executeFields(exeContext, returnType, result, path, subFieldNodes); +} + +function invalidReturnTypeError(returnType, result, fieldNodes) { + return new _GraphQLError.GraphQLError( + `Expected value of type "${returnType.name}" but got: ${(0, + _inspect.inspect)(result)}.`, + { + nodes: fieldNodes, + }, + ); +} +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ + +const defaultTypeResolver = function (value, contextValue, info, abstractType) { + // First, look for `__typename`. + if ( + (0, _isObjectLike.isObjectLike)(value) && + typeof value.__typename === 'string' + ) { + return value.__typename; + } // Otherwise, test each possible type. + + const possibleTypes = info.schema.getPossibleTypes(abstractType); + const promisedIsTypeOfResults = []; + + for (let i = 0; i < possibleTypes.length; i++) { + const type = possibleTypes[i]; + + if (type.isTypeOf) { + const isTypeOfResult = type.isTypeOf(value, contextValue, info); + + if ((0, _isPromise.isPromise)(isTypeOfResult)) { + promisedIsTypeOfResults[i] = isTypeOfResult; + } else if (isTypeOfResult) { + return type.name; + } + } + } + + if (promisedIsTypeOfResults.length) { + return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => { + for (let i = 0; i < isTypeOfResults.length; i++) { + if (isTypeOfResults[i]) { + return possibleTypes[i].name; + } + } + }); + } +}; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ + +exports.defaultTypeResolver = defaultTypeResolver; + +const defaultFieldResolver = function (source, args, contextValue, info) { + // ensure source is a value for which property access is acceptable. + if ((0, _isObjectLike.isObjectLike)(source) || typeof source === 'function') { + const property = source[info.fieldName]; + + if (typeof property === 'function') { + return source[info.fieldName](args, contextValue, info); + } + + return property; + } +}; +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ + +exports.defaultFieldResolver = defaultFieldResolver; + +function getFieldDef(schema, parentType, fieldNode) { + const fieldName = fieldNode.name.value; + + if ( + fieldName === _introspection.SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.SchemaMetaFieldDef; + } else if ( + fieldName === _introspection.TypeMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.TypeMetaFieldDef; + } else if (fieldName === _introspection.TypeNameMetaFieldDef.name) { + return _introspection.TypeNameMetaFieldDef; + } + + return parentType.getFields()[fieldName]; +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/execute.mjs b/graphql-subscription-express/node_modules/graphql/execution/execute.mjs new file mode 100644 index 0000000..bc084be --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/execute.mjs @@ -0,0 +1,1009 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isIterableObject } from '../jsutils/isIterableObject.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { isPromise } from '../jsutils/isPromise.mjs'; +import { memoize3 } from '../jsutils/memoize3.mjs'; +import { addPath, pathToArray } from '../jsutils/Path.mjs'; +import { promiseForObject } from '../jsutils/promiseForObject.mjs'; +import { promiseReduce } from '../jsutils/promiseReduce.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { locatedError } from '../error/locatedError.mjs'; +import { OperationTypeNode } from '../language/ast.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isAbstractType, + isLeafType, + isListType, + isNonNullType, + isObjectType, +} from '../type/definition.mjs'; +import { + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from '../type/introspection.mjs'; +import { assertValidSchema } from '../type/validate.mjs'; +import { + collectFields, + collectSubfields as _collectSubfields, +} from './collectFields.mjs'; +import { getArgumentValues, getVariableValues } from './values.mjs'; +/** + * A memoized collection of relevant subfields with regard to the return + * type. Memoizing ensures the subfields are not repeatedly calculated, which + * saves overhead when resolving lists of values. + */ + +const collectSubfields = memoize3((exeContext, returnType, fieldNodes) => + _collectSubfields( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + returnType, + fieldNodes, + ), +); +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ + +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ + +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the arguments to this function do not result in a legal execution context, + * a GraphQLError will be thrown immediately explaining the invalid input. + */ +export function execute(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + devAssert( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { schema, document, variableValues, rootValue } = args; // If arguments are missing or incorrect, throw an error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = buildExecutionContext(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } // Return a Promise that will eventually resolve to the data described by + // The "Response" section of the GraphQL specification. + // + // If errors are encountered while executing a GraphQL field, only that + // field and its descendants will be omitted, and sibling fields will still + // be executed. An execution which encounters errors will still result in a + // resolved Promise. + // + // Errors from sub-fields of a NonNull type may propagate to the top level, + // at which point we still log the error and null the parent field, which + // in this case is the entire response. + + try { + const { operation } = exeContext; + const result = executeOperation(exeContext, operation, rootValue); + + if (isPromise(result)) { + return result.then( + (data) => buildResponse(data, exeContext.errors), + (error) => { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + }, + ); + } + + return buildResponse(result, exeContext.errors); + } catch (error) { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + } +} +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +export function executeSync(args) { + const result = execute(args); // Assert that the execution was synchronous. + + if (isPromise(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} +/** + * Given a completed execution context and data, build the `{ errors, data }` + * response defined by the "Response" section of the GraphQL specification. + */ + +function buildResponse(data, errors) { + return errors.length === 0 + ? { + data, + } + : { + errors, + data, + }; +} +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ + +export function assertValidExecutionArguments( + schema, + document, + rawVariableValues, +) { + document || devAssert(false, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. + + assertValidSchema(schema); // Variables, if provided, must be an object. + + rawVariableValues == null || + isObjectLike(rawVariableValues) || + devAssert( + false, + 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', + ); +} +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ + +export function buildExecutionContext(args) { + var _definition$name, _operation$variableDe; + + const { + schema, + document, + rootValue, + contextValue, + variableValues: rawVariableValues, + operationName, + fieldResolver, + typeResolver, + subscribeFieldResolver, + } = args; + let operation; + const fragments = Object.create(null); + + for (const definition of document.definitions) { + switch (definition.kind) { + case Kind.OPERATION_DEFINITION: + if (operationName == null) { + if (operation !== undefined) { + return [ + new GraphQLError( + 'Must provide operation name if query contains multiple operations.', + ), + ]; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + operation = definition; + } + + break; + + case Kind.FRAGMENT_DEFINITION: + fragments[definition.name.value] = definition; + break; + + default: // ignore non-executable definitions + } + } + + if (!operation) { + if (operationName != null) { + return [new GraphQLError(`Unknown operation named "${operationName}".`)]; + } + + return [new GraphQLError('Must provide an operation.')]; + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const variableDefinitions = + (_operation$variableDe = operation.variableDefinitions) !== null && + _operation$variableDe !== void 0 + ? _operation$variableDe + : []; + const coercedVariableValues = getVariableValues( + schema, + variableDefinitions, + rawVariableValues !== null && rawVariableValues !== void 0 + ? rawVariableValues + : {}, + { + maxErrors: 50, + }, + ); + + if (coercedVariableValues.errors) { + return coercedVariableValues.errors; + } + + return { + schema, + fragments, + rootValue, + contextValue, + operation, + variableValues: coercedVariableValues.coerced, + fieldResolver: + fieldResolver !== null && fieldResolver !== void 0 + ? fieldResolver + : defaultFieldResolver, + typeResolver: + typeResolver !== null && typeResolver !== void 0 + ? typeResolver + : defaultTypeResolver, + subscribeFieldResolver: + subscribeFieldResolver !== null && subscribeFieldResolver !== void 0 + ? subscribeFieldResolver + : defaultFieldResolver, + errors: [], + }; +} +/** + * Implements the "Executing operations" section of the spec. + */ + +function executeOperation(exeContext, operation, rootValue) { + const rootType = exeContext.schema.getRootType(operation.operation); + + if (rootType == null) { + throw new GraphQLError( + `Schema is not configured to execute ${operation.operation} operation.`, + { + nodes: operation, + }, + ); + } + + const rootFields = collectFields( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + rootType, + operation.selectionSet, + ); + const path = undefined; + + switch (operation.operation) { + case OperationTypeNode.QUERY: + return executeFields(exeContext, rootType, rootValue, path, rootFields); + + case OperationTypeNode.MUTATION: + return executeFieldsSerially( + exeContext, + rootType, + rootValue, + path, + rootFields, + ); + + case OperationTypeNode.SUBSCRIPTION: + // TODO: deprecate `subscribe` and move all logic here + // Temporary solution until we finish merging execute and subscribe together + return executeFields(exeContext, rootType, rootValue, path, rootFields); + } +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that must be executed serially. + */ + +function executeFieldsSerially( + exeContext, + parentType, + sourceValue, + path, + fields, +) { + return promiseReduce( + fields.entries(), + (results, [responseName, fieldNodes]) => { + const fieldPath = addPath(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result === undefined) { + return results; + } + + if (isPromise(result)) { + return result.then((resolvedResult) => { + results[responseName] = resolvedResult; + return results; + }); + } + + results[responseName] = result; + return results; + }, + Object.create(null), + ); +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that may be executed in parallel. + */ + +function executeFields(exeContext, parentType, sourceValue, path, fields) { + const results = Object.create(null); + let containsPromise = false; + + try { + for (const [responseName, fieldNodes] of fields.entries()) { + const fieldPath = addPath(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result !== undefined) { + results[responseName] = result; + + if (isPromise(result)) { + containsPromise = true; + } + } + } + } catch (error) { + if (containsPromise) { + // Ensure that any promises returned by other fields are handled, as they may also reject. + return promiseForObject(results).finally(() => { + throw error; + }); + } + + throw error; + } // If there are no promises, we can just return the object + + if (!containsPromise) { + return results; + } // Otherwise, results is a map from field name to the result of resolving that + // field, which is possibly a promise. Return a promise that will return this + // same map, but with any promises replaced with the values they resolved to. + + return promiseForObject(results); +} +/** + * Implements the "Executing fields" section of the spec + * In particular, this function figures out the value that the field returns by + * calling its resolve function, then calls completeValue to complete promises, + * serialize scalars, or execute the sub-selection-set for objects. + */ + +function executeField(exeContext, parentType, source, fieldNodes, path) { + var _fieldDef$resolve; + + const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]); + + if (!fieldDef) { + return; + } + + const returnType = fieldDef.type; + const resolveFn = + (_fieldDef$resolve = fieldDef.resolve) !== null && + _fieldDef$resolve !== void 0 + ? _fieldDef$resolve + : exeContext.fieldResolver; + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + parentType, + path, + ); // Get the resolve function, regardless of if its result is normal or abrupt (error). + + try { + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + // TODO: find a way to memoize, in case this field is within a List type. + const args = getArgumentValues( + fieldDef, + fieldNodes[0], + exeContext.variableValues, + ); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; + const result = resolveFn(source, args, contextValue, info); + let completed; + + if (isPromise(result)) { + completed = result.then((resolved) => + completeValue(exeContext, returnType, fieldNodes, info, path, resolved), + ); + } else { + completed = completeValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + + if (isPromise(completed)) { + // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + return completed.then(undefined, (rawError) => { + const error = locatedError(rawError, fieldNodes, pathToArray(path)); + return handleFieldError(error, returnType, exeContext); + }); + } + + return completed; + } catch (rawError) { + const error = locatedError(rawError, fieldNodes, pathToArray(path)); + return handleFieldError(error, returnType, exeContext); + } +} +/** + * @internal + */ + +export function buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + parentType, + path, +) { + // The resolve function's optional fourth argument is a collection of + // information about the current execution state. + return { + fieldName: fieldDef.name, + fieldNodes, + returnType: fieldDef.type, + parentType, + path, + schema: exeContext.schema, + fragments: exeContext.fragments, + rootValue: exeContext.rootValue, + operation: exeContext.operation, + variableValues: exeContext.variableValues, + }; +} + +function handleFieldError(error, returnType, exeContext) { + // If the field type is non-nullable, then it is resolved without any + // protection from errors, however it still properly locates the error. + if (isNonNullType(returnType)) { + throw error; + } // Otherwise, error protection is applied, logging the error and resolving + // a null value for this field if one is encountered. + + exeContext.errors.push(error); + return null; +} +/** + * Implements the instructions for completeValue as defined in the + * "Value Completion" section of the spec. + * + * If the field type is Non-Null, then this recursively completes the value + * for the inner type. It throws a field error if that completion returns null, + * as per the "Nullability" section of the spec. + * + * If the field type is a List, then this recursively completes the value + * for the inner type on each item in the list. + * + * If the field type is a Scalar or Enum, ensures the completed value is a legal + * value of the type by calling the `serialize` method of GraphQL type + * definition. + * + * If the field is an abstract type, determine the runtime type of the value + * and then complete based on that type + * + * Otherwise, the field type expects a sub-selection set, and will complete the + * value by executing all sub-selections. + */ + +function completeValue(exeContext, returnType, fieldNodes, info, path, result) { + // If result is an Error, throw a located error. + if (result instanceof Error) { + throw result; + } // If field type is NonNull, complete for inner type, and throw field error + // if result is null. + + if (isNonNullType(returnType)) { + const completed = completeValue( + exeContext, + returnType.ofType, + fieldNodes, + info, + path, + result, + ); + + if (completed === null) { + throw new Error( + `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`, + ); + } + + return completed; + } // If result value is null or undefined then return null. + + if (result == null) { + return null; + } // If field type is List, complete each item in the list with the inner type + + if (isListType(returnType)) { + return completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, + // returning null if serialization is not possible. + + if (isLeafType(returnType)) { + return completeLeafValue(returnType, result); + } // If field type is an abstract type, Interface or Union, determine the + // runtime Object type and complete for that type. + + if (isAbstractType(returnType)) { + return completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is Object, execute and complete all sub-selections. + + if (isObjectType(returnType)) { + return completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + /* c8 ignore next 6 */ + // Not reachable, all possible output types have been considered. + + false || + invariant( + false, + 'Cannot complete value of unexpected output type: ' + inspect(returnType), + ); +} +/** + * Complete a list value by completing each item in the list with the + * inner type + */ + +function completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + if (!isIterableObject(result)) { + throw new GraphQLError( + `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`, + ); + } // This is specified as a simple map, however we're optimizing the path + // where the list contains no Promises by avoiding creating another Promise. + + const itemType = returnType.ofType; + let containsPromise = false; + const completedResults = Array.from(result, (item, index) => { + // No need to modify the info object containing the path, + // since from here on it is not ever accessed by resolver functions. + const itemPath = addPath(path, index, undefined); + + try { + let completedItem; + + if (isPromise(item)) { + completedItem = item.then((resolved) => + completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + resolved, + ), + ); + } else { + completedItem = completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + item, + ); + } + + if (isPromise(completedItem)) { + containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + + return completedItem.then(undefined, (rawError) => { + const error = locatedError( + rawError, + fieldNodes, + pathToArray(itemPath), + ); + return handleFieldError(error, itemType, exeContext); + }); + } + + return completedItem; + } catch (rawError) { + const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); + return handleFieldError(error, itemType, exeContext); + } + }); + return containsPromise ? Promise.all(completedResults) : completedResults; +} +/** + * Complete a Scalar or Enum by serializing to a valid value, returning + * null if serialization is not possible. + */ + +function completeLeafValue(returnType, result) { + const serializedResult = returnType.serialize(result); + + if (serializedResult == null) { + throw new Error( + `Expected \`${inspect(returnType)}.serialize(${inspect(result)})\` to ` + + `return non-nullable value, returned: ${inspect(serializedResult)}`, + ); + } + + return serializedResult; +} +/** + * Complete a value of an abstract type by determining the runtime object type + * of that value, then complete the value for that type. + */ + +function completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + var _returnType$resolveTy; + + const resolveTypeFn = + (_returnType$resolveTy = returnType.resolveType) !== null && + _returnType$resolveTy !== void 0 + ? _returnType$resolveTy + : exeContext.typeResolver; + const contextValue = exeContext.contextValue; + const runtimeType = resolveTypeFn(result, contextValue, info, returnType); + + if (isPromise(runtimeType)) { + return runtimeType.then((resolvedRuntimeType) => + completeObjectValue( + exeContext, + ensureValidRuntimeType( + resolvedRuntimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ), + ); + } + + return completeObjectValue( + exeContext, + ensureValidRuntimeType( + runtimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ); +} + +function ensureValidRuntimeType( + runtimeTypeName, + exeContext, + returnType, + fieldNodes, + info, + result, +) { + if (runtimeTypeName == null) { + throw new GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, + fieldNodes, + ); + } // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` + // TODO: remove in 17.0.0 release + + if (isObjectType(runtimeTypeName)) { + throw new GraphQLError( + 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', + ); + } + + if (typeof runtimeTypeName !== 'string') { + throw new GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` + + `value ${inspect(result)}, received "${inspect(runtimeTypeName)}".`, + ); + } + + const runtimeType = exeContext.schema.getType(runtimeTypeName); + + if (runtimeType == null) { + throw new GraphQLError( + `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`, + { + nodes: fieldNodes, + }, + ); + } + + if (!isObjectType(runtimeType)) { + throw new GraphQLError( + `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`, + { + nodes: fieldNodes, + }, + ); + } + + if (!exeContext.schema.isSubType(returnType, runtimeType)) { + throw new GraphQLError( + `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, + { + nodes: fieldNodes, + }, + ); + } + + return runtimeType; +} +/** + * Complete an Object value by executing all sub-selections. + */ + +function completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + // Collect sub-fields to execute to complete this value. + const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); // If there is an isTypeOf predicate function, call it with the + // current result. If isTypeOf returns false, then raise an error rather + // than continuing execution. + + if (returnType.isTypeOf) { + const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); + + if (isPromise(isTypeOf)) { + return isTypeOf.then((resolvedIsTypeOf) => { + if (!resolvedIsTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + + return executeFields( + exeContext, + returnType, + result, + path, + subFieldNodes, + ); + }); + } + + if (!isTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + } + + return executeFields(exeContext, returnType, result, path, subFieldNodes); +} + +function invalidReturnTypeError(returnType, result, fieldNodes) { + return new GraphQLError( + `Expected value of type "${returnType.name}" but got: ${inspect(result)}.`, + { + nodes: fieldNodes, + }, + ); +} +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ + +export const defaultTypeResolver = function ( + value, + contextValue, + info, + abstractType, +) { + // First, look for `__typename`. + if (isObjectLike(value) && typeof value.__typename === 'string') { + return value.__typename; + } // Otherwise, test each possible type. + + const possibleTypes = info.schema.getPossibleTypes(abstractType); + const promisedIsTypeOfResults = []; + + for (let i = 0; i < possibleTypes.length; i++) { + const type = possibleTypes[i]; + + if (type.isTypeOf) { + const isTypeOfResult = type.isTypeOf(value, contextValue, info); + + if (isPromise(isTypeOfResult)) { + promisedIsTypeOfResults[i] = isTypeOfResult; + } else if (isTypeOfResult) { + return type.name; + } + } + } + + if (promisedIsTypeOfResults.length) { + return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => { + for (let i = 0; i < isTypeOfResults.length; i++) { + if (isTypeOfResults[i]) { + return possibleTypes[i].name; + } + } + }); + } +}; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ + +export const defaultFieldResolver = function ( + source, + args, + contextValue, + info, +) { + // ensure source is a value for which property access is acceptable. + if (isObjectLike(source) || typeof source === 'function') { + const property = source[info.fieldName]; + + if (typeof property === 'function') { + return source[info.fieldName](args, contextValue, info); + } + + return property; + } +}; +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ + +export function getFieldDef(schema, parentType, fieldNode) { + const fieldName = fieldNode.name.value; + + if ( + fieldName === SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return SchemaMetaFieldDef; + } else if ( + fieldName === TypeMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return TypeMetaFieldDef; + } else if (fieldName === TypeNameMetaFieldDef.name) { + return TypeNameMetaFieldDef; + } + + return parentType.getFields()[fieldName]; +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/index.d.ts b/graphql-subscription-express/node_modules/graphql/execution/index.d.ts new file mode 100644 index 0000000..e9901c1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/index.d.ts @@ -0,0 +1,18 @@ +export { pathToArray as responsePathAsArray } from '../jsutils/Path'; +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, +} from './execute'; +export type { + ExecutionArgs, + ExecutionResult, + FormattedExecutionResult, +} from './execute'; +export { subscribe, createSourceEventStream } from './subscribe'; +export { + getArgumentValues, + getVariableValues, + getDirectiveValues, +} from './values'; diff --git a/graphql-subscription-express/node_modules/graphql/execution/index.js b/graphql-subscription-express/node_modules/graphql/execution/index.js new file mode 100644 index 0000000..3fef7fa --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/index.js @@ -0,0 +1,73 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'createSourceEventStream', { + enumerable: true, + get: function () { + return _subscribe.createSourceEventStream; + }, +}); +Object.defineProperty(exports, 'defaultFieldResolver', { + enumerable: true, + get: function () { + return _execute.defaultFieldResolver; + }, +}); +Object.defineProperty(exports, 'defaultTypeResolver', { + enumerable: true, + get: function () { + return _execute.defaultTypeResolver; + }, +}); +Object.defineProperty(exports, 'execute', { + enumerable: true, + get: function () { + return _execute.execute; + }, +}); +Object.defineProperty(exports, 'executeSync', { + enumerable: true, + get: function () { + return _execute.executeSync; + }, +}); +Object.defineProperty(exports, 'getArgumentValues', { + enumerable: true, + get: function () { + return _values.getArgumentValues; + }, +}); +Object.defineProperty(exports, 'getDirectiveValues', { + enumerable: true, + get: function () { + return _values.getDirectiveValues; + }, +}); +Object.defineProperty(exports, 'getVariableValues', { + enumerable: true, + get: function () { + return _values.getVariableValues; + }, +}); +Object.defineProperty(exports, 'responsePathAsArray', { + enumerable: true, + get: function () { + return _Path.pathToArray; + }, +}); +Object.defineProperty(exports, 'subscribe', { + enumerable: true, + get: function () { + return _subscribe.subscribe; + }, +}); + +var _Path = require('../jsutils/Path.js'); + +var _execute = require('./execute.js'); + +var _subscribe = require('./subscribe.js'); + +var _values = require('./values.js'); diff --git a/graphql-subscription-express/node_modules/graphql/execution/index.mjs b/graphql-subscription-express/node_modules/graphql/execution/index.mjs new file mode 100644 index 0000000..f1b9756 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/index.mjs @@ -0,0 +1,13 @@ +export { pathToArray as responsePathAsArray } from '../jsutils/Path.mjs'; +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, +} from './execute.mjs'; +export { subscribe, createSourceEventStream } from './subscribe.mjs'; +export { + getArgumentValues, + getVariableValues, + getDirectiveValues, +} from './values.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.d.ts b/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.d.ts new file mode 100644 index 0000000..a0a516b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.d.ts @@ -0,0 +1,9 @@ +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +export declare function mapAsyncIterator( + iterable: AsyncGenerator | AsyncIterable, + callback: (value: T) => PromiseOrValue, +): AsyncGenerator; diff --git a/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.js b/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.js new file mode 100644 index 0000000..8fd8f94 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.js @@ -0,0 +1,68 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.mapAsyncIterator = mapAsyncIterator; + +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +function mapAsyncIterator(iterable, callback) { + const iterator = iterable[Symbol.asyncIterator](); + + async function mapResult(result) { + if (result.done) { + return result; + } + + try { + return { + value: await callback(result.value), + done: false, + }; + } catch (error) { + /* c8 ignore start */ + // FIXME: add test case + if (typeof iterator.return === 'function') { + try { + await iterator.return(); + } catch (_e) { + /* ignore error */ + } + } + + throw error; + /* c8 ignore stop */ + } + } + + return { + async next() { + return mapResult(await iterator.next()); + }, + + async return() { + // If iterator.return() does not exist, then type R must be undefined. + return typeof iterator.return === 'function' + ? mapResult(await iterator.return()) + : { + value: undefined, + done: true, + }; + }, + + async throw(error) { + if (typeof iterator.throw === 'function') { + return mapResult(await iterator.throw(error)); + } + + throw error; + }, + + [Symbol.asyncIterator]() { + return this; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.mjs b/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.mjs new file mode 100644 index 0000000..b3d3a27 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/mapAsyncIterator.mjs @@ -0,0 +1,61 @@ +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +export function mapAsyncIterator(iterable, callback) { + const iterator = iterable[Symbol.asyncIterator](); + + async function mapResult(result) { + if (result.done) { + return result; + } + + try { + return { + value: await callback(result.value), + done: false, + }; + } catch (error) { + /* c8 ignore start */ + // FIXME: add test case + if (typeof iterator.return === 'function') { + try { + await iterator.return(); + } catch (_e) { + /* ignore error */ + } + } + + throw error; + /* c8 ignore stop */ + } + } + + return { + async next() { + return mapResult(await iterator.next()); + }, + + async return() { + // If iterator.return() does not exist, then type R must be undefined. + return typeof iterator.return === 'function' + ? mapResult(await iterator.return()) + : { + value: undefined, + done: true, + }; + }, + + async throw(error) { + if (typeof iterator.throw === 'function') { + return mapResult(await iterator.throw(error)); + } + + throw error; + }, + + [Symbol.asyncIterator]() { + return this; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/subscribe.d.ts b/graphql-subscription-express/node_modules/graphql/execution/subscribe.d.ts new file mode 100644 index 0000000..161f650 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/subscribe.d.ts @@ -0,0 +1,72 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DocumentNode } from '../language/ast'; +import type { GraphQLFieldResolver } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +import type { ExecutionArgs, ExecutionResult } from './execute'; +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ +export declare function subscribe( + args: ExecutionArgs, +): Promise | ExecutionResult>; +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ +export declare function createSourceEventStream( + args: ExecutionArgs, +): Promise | ExecutionResult>; +/** @deprecated will be removed in next major version in favor of named arguments */ +export declare function createSourceEventStream( + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: unknown, + contextValue?: unknown, + variableValues?: Maybe<{ + readonly [variable: string]: unknown; + }>, + operationName?: Maybe, + subscribeFieldResolver?: Maybe>, +): Promise | ExecutionResult>; diff --git a/graphql-subscription-express/node_modules/graphql/execution/subscribe.js b/graphql-subscription-express/node_modules/graphql/execution/subscribe.js new file mode 100644 index 0000000..e0c8012 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/subscribe.js @@ -0,0 +1,244 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.createSourceEventStream = createSourceEventStream; +exports.subscribe = subscribe; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _isAsyncIterable = require('../jsutils/isAsyncIterable.js'); + +var _Path = require('../jsutils/Path.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _locatedError = require('../error/locatedError.js'); + +var _collectFields = require('./collectFields.js'); + +var _execute = require('./execute.js'); + +var _mapAsyncIterator = require('./mapAsyncIterator.js'); + +var _values = require('./values.js'); + +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ +async function subscribe(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + (0, _devAssert.devAssert)( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const resultOrStream = await createSourceEventStream(args); + + if (!(0, _isAsyncIterable.isAsyncIterable)(resultOrStream)) { + return resultOrStream; + } // For each payload yielded from a subscription, map it over the normal + // GraphQL `execute` function, with `payload` as the rootValue. + // This implements the "MapSourceToResponseEvent" algorithm described in + // the GraphQL specification. The `execute` function provides the + // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the + // "ExecuteQuery" algorithm, for which `execute` is also used. + + const mapSourceToResponse = (payload) => + (0, _execute.execute)({ ...args, rootValue: payload }); // Map every source value to a ExecutionResult value as described above. + + return (0, _mapAsyncIterator.mapAsyncIterator)( + resultOrStream, + mapSourceToResponse, + ); +} + +function toNormalizedArgs(args) { + const firstArg = args[0]; + + if (firstArg && 'document' in firstArg) { + return firstArg; + } + + return { + schema: firstArg, + // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613 + document: args[1], + rootValue: args[2], + contextValue: args[3], + variableValues: args[4], + operationName: args[5], + subscribeFieldResolver: args[6], + }; +} +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ + +async function createSourceEventStream(...rawArgs) { + const args = toNormalizedArgs(rawArgs); + const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal + // developer mistake which should throw an early error. + + (0, _execute.assertValidExecutionArguments)(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = (0, _execute.buildExecutionContext)(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } + + try { + const eventStream = await executeSubscription(exeContext); // Assert field returned an event stream, otherwise yield an error. + + if (!(0, _isAsyncIterable.isAsyncIterable)(eventStream)) { + throw new Error( + 'Subscription field must return Async Iterable. ' + + `Received: ${(0, _inspect.inspect)(eventStream)}.`, + ); + } + + return eventStream; + } catch (error) { + // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data. + // Otherwise treat the error as a system-class error and re-throw it. + if (error instanceof _GraphQLError.GraphQLError) { + return { + errors: [error], + }; + } + + throw error; + } +} + +async function executeSubscription(exeContext) { + const { schema, fragments, operation, variableValues, rootValue } = + exeContext; + const rootType = schema.getSubscriptionType(); + + if (rootType == null) { + throw new _GraphQLError.GraphQLError( + 'Schema is not configured to execute subscription operation.', + { + nodes: operation, + }, + ); + } + + const rootFields = (0, _collectFields.collectFields)( + schema, + fragments, + variableValues, + rootType, + operation.selectionSet, + ); + const [responseName, fieldNodes] = [...rootFields.entries()][0]; + const fieldDef = (0, _execute.getFieldDef)(schema, rootType, fieldNodes[0]); + + if (!fieldDef) { + const fieldName = fieldNodes[0].name.value; + throw new _GraphQLError.GraphQLError( + `The subscription field "${fieldName}" is not defined.`, + { + nodes: fieldNodes, + }, + ); + } + + const path = (0, _Path.addPath)(undefined, responseName, rootType.name); + const info = (0, _execute.buildResolveInfo)( + exeContext, + fieldDef, + fieldNodes, + rootType, + path, + ); + + try { + var _fieldDef$subscribe; + + // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. + // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + const args = (0, _values.getArgumentValues)( + fieldDef, + fieldNodes[0], + variableValues, + ); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an + // AsyncIterable yielding raw payloads. + + const resolveFn = + (_fieldDef$subscribe = fieldDef.subscribe) !== null && + _fieldDef$subscribe !== void 0 + ? _fieldDef$subscribe + : exeContext.subscribeFieldResolver; + const eventStream = await resolveFn(rootValue, args, contextValue, info); + + if (eventStream instanceof Error) { + throw eventStream; + } + + return eventStream; + } catch (error) { + throw (0, _locatedError.locatedError)( + error, + fieldNodes, + (0, _Path.pathToArray)(path), + ); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/subscribe.mjs b/graphql-subscription-express/node_modules/graphql/execution/subscribe.mjs new file mode 100644 index 0000000..e0cf732 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/subscribe.mjs @@ -0,0 +1,222 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { isAsyncIterable } from '../jsutils/isAsyncIterable.mjs'; +import { addPath, pathToArray } from '../jsutils/Path.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { locatedError } from '../error/locatedError.mjs'; +import { collectFields } from './collectFields.mjs'; +import { + assertValidExecutionArguments, + buildExecutionContext, + buildResolveInfo, + execute, + getFieldDef, +} from './execute.mjs'; +import { mapAsyncIterator } from './mapAsyncIterator.mjs'; +import { getArgumentValues } from './values.mjs'; +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ + +export async function subscribe(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + devAssert( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const resultOrStream = await createSourceEventStream(args); + + if (!isAsyncIterable(resultOrStream)) { + return resultOrStream; + } // For each payload yielded from a subscription, map it over the normal + // GraphQL `execute` function, with `payload` as the rootValue. + // This implements the "MapSourceToResponseEvent" algorithm described in + // the GraphQL specification. The `execute` function provides the + // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the + // "ExecuteQuery" algorithm, for which `execute` is also used. + + const mapSourceToResponse = (payload) => + execute({ ...args, rootValue: payload }); // Map every source value to a ExecutionResult value as described above. + + return mapAsyncIterator(resultOrStream, mapSourceToResponse); +} + +function toNormalizedArgs(args) { + const firstArg = args[0]; + + if (firstArg && 'document' in firstArg) { + return firstArg; + } + + return { + schema: firstArg, + // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613 + document: args[1], + rootValue: args[2], + contextValue: args[3], + variableValues: args[4], + operationName: args[5], + subscribeFieldResolver: args[6], + }; +} +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ + +export async function createSourceEventStream(...rawArgs) { + const args = toNormalizedArgs(rawArgs); + const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal + // developer mistake which should throw an early error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = buildExecutionContext(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } + + try { + const eventStream = await executeSubscription(exeContext); // Assert field returned an event stream, otherwise yield an error. + + if (!isAsyncIterable(eventStream)) { + throw new Error( + 'Subscription field must return Async Iterable. ' + + `Received: ${inspect(eventStream)}.`, + ); + } + + return eventStream; + } catch (error) { + // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data. + // Otherwise treat the error as a system-class error and re-throw it. + if (error instanceof GraphQLError) { + return { + errors: [error], + }; + } + + throw error; + } +} + +async function executeSubscription(exeContext) { + const { schema, fragments, operation, variableValues, rootValue } = + exeContext; + const rootType = schema.getSubscriptionType(); + + if (rootType == null) { + throw new GraphQLError( + 'Schema is not configured to execute subscription operation.', + { + nodes: operation, + }, + ); + } + + const rootFields = collectFields( + schema, + fragments, + variableValues, + rootType, + operation.selectionSet, + ); + const [responseName, fieldNodes] = [...rootFields.entries()][0]; + const fieldDef = getFieldDef(schema, rootType, fieldNodes[0]); + + if (!fieldDef) { + const fieldName = fieldNodes[0].name.value; + throw new GraphQLError( + `The subscription field "${fieldName}" is not defined.`, + { + nodes: fieldNodes, + }, + ); + } + + const path = addPath(undefined, responseName, rootType.name); + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + rootType, + path, + ); + + try { + var _fieldDef$subscribe; + + // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. + // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + const args = getArgumentValues(fieldDef, fieldNodes[0], variableValues); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an + // AsyncIterable yielding raw payloads. + + const resolveFn = + (_fieldDef$subscribe = fieldDef.subscribe) !== null && + _fieldDef$subscribe !== void 0 + ? _fieldDef$subscribe + : exeContext.subscribeFieldResolver; + const eventStream = await resolveFn(rootValue, args, contextValue, info); + + if (eventStream instanceof Error) { + throw eventStream; + } + + return eventStream; + } catch (error) { + throw locatedError(error, fieldNodes, pathToArray(path)); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/values.d.ts b/graphql-subscription-express/node_modules/graphql/execution/values.d.ts new file mode 100644 index 0000000..6deec36 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/values.d.ts @@ -0,0 +1,79 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import { GraphQLError } from '../error/GraphQLError'; +import type { + DirectiveNode, + FieldNode, + VariableDefinitionNode, +} from '../language/ast'; +import type { GraphQLField } from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; +declare type CoercedVariableValues = + | { + errors: ReadonlyArray; + coerced?: never; + } + | { + coerced: { + [variable: string]: unknown; + }; + errors?: never; + }; +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export declare function getVariableValues( + schema: GraphQLSchema, + varDefNodes: ReadonlyArray, + inputs: { + readonly [variable: string]: unknown; + }, + options?: { + maxErrors?: number; + }, +): CoercedVariableValues; +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export declare function getArgumentValues( + def: GraphQLField | GraphQLDirective, + node: FieldNode | DirectiveNode, + variableValues?: Maybe>, +): { + [argument: string]: unknown; +}; +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export declare function getDirectiveValues( + directiveDef: GraphQLDirective, + node: { + readonly directives?: ReadonlyArray; + }, + variableValues?: Maybe>, +): + | undefined + | { + [argument: string]: unknown; + }; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/execution/values.js b/graphql-subscription-express/node_modules/graphql/execution/values.js new file mode 100644 index 0000000..97a3a83 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/values.js @@ -0,0 +1,300 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getArgumentValues = getArgumentValues; +exports.getDirectiveValues = getDirectiveValues; +exports.getVariableValues = getVariableValues; + +var _inspect = require('../jsutils/inspect.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _printPathArray = require('../jsutils/printPathArray.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('../type/definition.js'); + +var _coerceInputValue = require('../utilities/coerceInputValue.js'); + +var _typeFromAST = require('../utilities/typeFromAST.js'); + +var _valueFromAST = require('../utilities/valueFromAST.js'); + +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +function getVariableValues(schema, varDefNodes, inputs, options) { + const errors = []; + const maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors; + + try { + const coerced = coerceVariableValues( + schema, + varDefNodes, + inputs, + (error) => { + if (maxErrors != null && errors.length >= maxErrors) { + throw new _GraphQLError.GraphQLError( + 'Too many errors processing variables, error limit reached. Execution aborted.', + ); + } + + errors.push(error); + }, + ); + + if (errors.length === 0) { + return { + coerced, + }; + } + } catch (error) { + errors.push(error); + } + + return { + errors, + }; +} + +function coerceVariableValues(schema, varDefNodes, inputs, onError) { + const coercedValues = {}; + + for (const varDefNode of varDefNodes) { + const varName = varDefNode.variable.name.value; + const varType = (0, _typeFromAST.typeFromAST)(schema, varDefNode.type); + + if (!(0, _definition.isInputType)(varType)) { + // Must use input types for variables. This should be caught during + // validation, however is checked again here for safety. + const varTypeStr = (0, _printer.print)(varDefNode.type); + onError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, + { + nodes: varDefNode.type, + }, + ), + ); + continue; + } + + if (!hasOwnProperty(inputs, varName)) { + if (varDefNode.defaultValue) { + coercedValues[varName] = (0, _valueFromAST.valueFromAST)( + varDefNode.defaultValue, + varType, + ); + } else if ((0, _definition.isNonNullType)(varType)) { + const varTypeStr = (0, _inspect.inspect)(varType); + onError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, + { + nodes: varDefNode, + }, + ), + ); + } + + continue; + } + + const value = inputs[varName]; + + if (value === null && (0, _definition.isNonNullType)(varType)) { + const varTypeStr = (0, _inspect.inspect)(varType); + onError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, + { + nodes: varDefNode, + }, + ), + ); + continue; + } + + coercedValues[varName] = (0, _coerceInputValue.coerceInputValue)( + value, + varType, + (path, invalidValue, error) => { + let prefix = + `Variable "$${varName}" got invalid value ` + + (0, _inspect.inspect)(invalidValue); + + if (path.length > 0) { + prefix += ` at "${varName}${(0, _printPathArray.printPathArray)( + path, + )}"`; + } + + onError( + new _GraphQLError.GraphQLError(prefix + '; ' + error.message, { + nodes: varDefNode, + originalError: error, + }), + ); + }, + ); + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +function getArgumentValues(def, node, variableValues) { + var _node$arguments; + + const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 + ? _node$arguments + : []; + const argNodeMap = (0, _keyMap.keyMap)( + argumentNodes, + (arg) => arg.name.value, + ); + + for (const argDef of def.args) { + const name = argDef.name; + const argType = argDef.type; + const argumentNode = argNodeMap[name]; + + if (!argumentNode) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if ((0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError( + `Argument "${name}" of required type "${(0, _inspect.inspect)( + argType, + )}" ` + 'was not provided.', + { + nodes: node, + }, + ); + } + + continue; + } + + const valueNode = argumentNode.value; + let isNull = valueNode.kind === _kinds.Kind.NULL; + + if (valueNode.kind === _kinds.Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if ( + variableValues == null || + !hasOwnProperty(variableValues, variableName) + ) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if ((0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError( + `Argument "${name}" of required type "${(0, _inspect.inspect)( + argType, + )}" ` + + `was provided the variable "$${variableName}" which was not provided a runtime value.`, + { + nodes: valueNode, + }, + ); + } + + continue; + } + + isNull = variableValues[variableName] == null; + } + + if (isNull && (0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError( + `Argument "${name}" of non-null type "${(0, _inspect.inspect)( + argType, + )}" ` + 'must not be null.', + { + nodes: valueNode, + }, + ); + } + + const coercedValue = (0, _valueFromAST.valueFromAST)( + valueNode, + argType, + variableValues, + ); + + if (coercedValue === undefined) { + // Note: ValuesOfCorrectTypeRule validation should catch this before + // execution. This is a runtime check to ensure execution does not + // continue with an invalid argument value. + throw new _GraphQLError.GraphQLError( + `Argument "${name}" has invalid value ${(0, _printer.print)( + valueNode, + )}.`, + { + nodes: valueNode, + }, + ); + } + + coercedValues[name] = coercedValue; + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +function getDirectiveValues(directiveDef, node, variableValues) { + var _node$directives; + + const directiveNode = + (_node$directives = node.directives) === null || _node$directives === void 0 + ? void 0 + : _node$directives.find( + (directive) => directive.name.value === directiveDef.name, + ); + + if (directiveNode) { + return getArgumentValues(directiveDef, directiveNode, variableValues); + } +} + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} diff --git a/graphql-subscription-express/node_modules/graphql/execution/values.mjs b/graphql-subscription-express/node_modules/graphql/execution/values.mjs new file mode 100644 index 0000000..059f4d2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/execution/values.mjs @@ -0,0 +1,263 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { printPathArray } from '../jsutils/printPathArray.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { isInputType, isNonNullType } from '../type/definition.mjs'; +import { coerceInputValue } from '../utilities/coerceInputValue.mjs'; +import { typeFromAST } from '../utilities/typeFromAST.mjs'; +import { valueFromAST } from '../utilities/valueFromAST.mjs'; + +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export function getVariableValues(schema, varDefNodes, inputs, options) { + const errors = []; + const maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors; + + try { + const coerced = coerceVariableValues( + schema, + varDefNodes, + inputs, + (error) => { + if (maxErrors != null && errors.length >= maxErrors) { + throw new GraphQLError( + 'Too many errors processing variables, error limit reached. Execution aborted.', + ); + } + + errors.push(error); + }, + ); + + if (errors.length === 0) { + return { + coerced, + }; + } + } catch (error) { + errors.push(error); + } + + return { + errors, + }; +} + +function coerceVariableValues(schema, varDefNodes, inputs, onError) { + const coercedValues = {}; + + for (const varDefNode of varDefNodes) { + const varName = varDefNode.variable.name.value; + const varType = typeFromAST(schema, varDefNode.type); + + if (!isInputType(varType)) { + // Must use input types for variables. This should be caught during + // validation, however is checked again here for safety. + const varTypeStr = print(varDefNode.type); + onError( + new GraphQLError( + `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, + { + nodes: varDefNode.type, + }, + ), + ); + continue; + } + + if (!hasOwnProperty(inputs, varName)) { + if (varDefNode.defaultValue) { + coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType); + } else if (isNonNullType(varType)) { + const varTypeStr = inspect(varType); + onError( + new GraphQLError( + `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, + { + nodes: varDefNode, + }, + ), + ); + } + + continue; + } + + const value = inputs[varName]; + + if (value === null && isNonNullType(varType)) { + const varTypeStr = inspect(varType); + onError( + new GraphQLError( + `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, + { + nodes: varDefNode, + }, + ), + ); + continue; + } + + coercedValues[varName] = coerceInputValue( + value, + varType, + (path, invalidValue, error) => { + let prefix = + `Variable "$${varName}" got invalid value ` + inspect(invalidValue); + + if (path.length > 0) { + prefix += ` at "${varName}${printPathArray(path)}"`; + } + + onError( + new GraphQLError(prefix + '; ' + error.message, { + nodes: varDefNode, + originalError: error, + }), + ); + }, + ); + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +export function getArgumentValues(def, node, variableValues) { + var _node$arguments; + + const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 + ? _node$arguments + : []; + const argNodeMap = keyMap(argumentNodes, (arg) => arg.name.value); + + for (const argDef of def.args) { + const name = argDef.name; + const argType = argDef.type; + const argumentNode = argNodeMap[name]; + + if (!argumentNode) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if (isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of required type "${inspect(argType)}" ` + + 'was not provided.', + { + nodes: node, + }, + ); + } + + continue; + } + + const valueNode = argumentNode.value; + let isNull = valueNode.kind === Kind.NULL; + + if (valueNode.kind === Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if ( + variableValues == null || + !hasOwnProperty(variableValues, variableName) + ) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if (isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of required type "${inspect(argType)}" ` + + `was provided the variable "$${variableName}" which was not provided a runtime value.`, + { + nodes: valueNode, + }, + ); + } + + continue; + } + + isNull = variableValues[variableName] == null; + } + + if (isNull && isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of non-null type "${inspect(argType)}" ` + + 'must not be null.', + { + nodes: valueNode, + }, + ); + } + + const coercedValue = valueFromAST(valueNode, argType, variableValues); + + if (coercedValue === undefined) { + // Note: ValuesOfCorrectTypeRule validation should catch this before + // execution. This is a runtime check to ensure execution does not + // continue with an invalid argument value. + throw new GraphQLError( + `Argument "${name}" has invalid value ${print(valueNode)}.`, + { + nodes: valueNode, + }, + ); + } + + coercedValues[name] = coercedValue; + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +export function getDirectiveValues(directiveDef, node, variableValues) { + var _node$directives; + + const directiveNode = + (_node$directives = node.directives) === null || _node$directives === void 0 + ? void 0 + : _node$directives.find( + (directive) => directive.name.value === directiveDef.name, + ); + + if (directiveNode) { + return getArgumentValues(directiveDef, directiveNode, variableValues); + } +} + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} diff --git a/graphql-subscription-express/node_modules/graphql/graphql.d.ts b/graphql-subscription-express/node_modules/graphql/graphql.d.ts new file mode 100644 index 0000000..8c3bf67 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/graphql.d.ts @@ -0,0 +1,67 @@ +import type { Maybe } from './jsutils/Maybe'; +import type { Source } from './language/source'; +import type { + GraphQLFieldResolver, + GraphQLTypeResolver, +} from './type/definition'; +import type { GraphQLSchema } from './type/schema'; +import type { ExecutionResult } from './execution/execute'; +/** + * This is the primary entry point function for fulfilling GraphQL operations + * by parsing, validating, and executing a GraphQL document along side a + * GraphQL schema. + * + * More sophisticated GraphQL servers, such as those which persist queries, + * may wish to separate the validation and execution phases to a static time + * tooling step, and a server runtime step. + * + * Accepts either an object with named arguments, or individual arguments: + * + * schema: + * The GraphQL type system to use when validating and executing a query. + * source: + * A GraphQL language formatted string representing the requested operation. + * rootValue: + * The value provided as the first argument to resolver functions on the top + * level type (e.g. the query object type). + * contextValue: + * The context value is provided as an argument to resolver functions after + * field arguments. It is used to pass shared information useful at any point + * during executing this query, for example the currently logged in user and + * connections to databases or other services. + * variableValues: + * A mapping of variable name to runtime value to use for all variables + * defined in the requestString. + * operationName: + * The name of the operation to use if requestString contains multiple + * possible operations. Can be omitted if requestString contains only + * one operation. + * fieldResolver: + * A resolver function to use when one is not provided by the schema. + * If not provided, the default field resolver is used (which looks for a + * value or method on the source value with the field's name). + * typeResolver: + * A type resolver function to use when none is provided by the schema. + * If not provided, the default type resolver is used (which looks for a + * `__typename` field or alternatively calls the `isTypeOf` method). + */ +export interface GraphQLArgs { + schema: GraphQLSchema; + source: string | Source; + rootValue?: unknown; + contextValue?: unknown; + variableValues?: Maybe<{ + readonly [variable: string]: unknown; + }>; + operationName?: Maybe; + fieldResolver?: Maybe>; + typeResolver?: Maybe>; +} +export declare function graphql(args: GraphQLArgs): Promise; +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ +export declare function graphqlSync(args: GraphQLArgs): ExecutionResult; diff --git a/graphql-subscription-express/node_modules/graphql/graphql.js b/graphql-subscription-express/node_modules/graphql/graphql.js new file mode 100644 index 0000000..087f3ba --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/graphql.js @@ -0,0 +1,96 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.graphql = graphql; +exports.graphqlSync = graphqlSync; + +var _devAssert = require('./jsutils/devAssert.js'); + +var _isPromise = require('./jsutils/isPromise.js'); + +var _parser = require('./language/parser.js'); + +var _validate = require('./type/validate.js'); + +var _validate2 = require('./validation/validate.js'); + +var _execute = require('./execution/execute.js'); + +function graphql(args) { + // Always return a Promise for a consistent API. + return new Promise((resolve) => resolve(graphqlImpl(args))); +} +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +function graphqlSync(args) { + const result = graphqlImpl(args); // Assert that the execution was synchronous. + + if ((0, _isPromise.isPromise)(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +function graphqlImpl(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + (0, _devAssert.devAssert)( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { + schema, + source, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + } = args; // Validate Schema + + const schemaValidationErrors = (0, _validate.validateSchema)(schema); + + if (schemaValidationErrors.length > 0) { + return { + errors: schemaValidationErrors, + }; + } // Parse + + let document; + + try { + document = (0, _parser.parse)(source); + } catch (syntaxError) { + return { + errors: [syntaxError], + }; + } // Validate + + const validationErrors = (0, _validate2.validate)(schema, document); + + if (validationErrors.length > 0) { + return { + errors: validationErrors, + }; + } // Execute + + return (0, _execute.execute)({ + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/graphql.mjs b/graphql-subscription-express/node_modules/graphql/graphql.mjs new file mode 100644 index 0000000..c8cfdbc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/graphql.mjs @@ -0,0 +1,122 @@ +import { devAssert } from './jsutils/devAssert.mjs'; +import { isPromise } from './jsutils/isPromise.mjs'; +import { parse } from './language/parser.mjs'; +import { validateSchema } from './type/validate.mjs'; +import { validate } from './validation/validate.mjs'; +import { execute } from './execution/execute.mjs'; +/** + * This is the primary entry point function for fulfilling GraphQL operations + * by parsing, validating, and executing a GraphQL document along side a + * GraphQL schema. + * + * More sophisticated GraphQL servers, such as those which persist queries, + * may wish to separate the validation and execution phases to a static time + * tooling step, and a server runtime step. + * + * Accepts either an object with named arguments, or individual arguments: + * + * schema: + * The GraphQL type system to use when validating and executing a query. + * source: + * A GraphQL language formatted string representing the requested operation. + * rootValue: + * The value provided as the first argument to resolver functions on the top + * level type (e.g. the query object type). + * contextValue: + * The context value is provided as an argument to resolver functions after + * field arguments. It is used to pass shared information useful at any point + * during executing this query, for example the currently logged in user and + * connections to databases or other services. + * variableValues: + * A mapping of variable name to runtime value to use for all variables + * defined in the requestString. + * operationName: + * The name of the operation to use if requestString contains multiple + * possible operations. Can be omitted if requestString contains only + * one operation. + * fieldResolver: + * A resolver function to use when one is not provided by the schema. + * If not provided, the default field resolver is used (which looks for a + * value or method on the source value with the field's name). + * typeResolver: + * A type resolver function to use when none is provided by the schema. + * If not provided, the default type resolver is used (which looks for a + * `__typename` field or alternatively calls the `isTypeOf` method). + */ + +export function graphql(args) { + // Always return a Promise for a consistent API. + return new Promise((resolve) => resolve(graphqlImpl(args))); +} +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +export function graphqlSync(args) { + const result = graphqlImpl(args); // Assert that the execution was synchronous. + + if (isPromise(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +function graphqlImpl(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + devAssert( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { + schema, + source, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + } = args; // Validate Schema + + const schemaValidationErrors = validateSchema(schema); + + if (schemaValidationErrors.length > 0) { + return { + errors: schemaValidationErrors, + }; + } // Parse + + let document; + + try { + document = parse(source); + } catch (syntaxError) { + return { + errors: [syntaxError], + }; + } // Validate + + const validationErrors = validate(schema, document); + + if (validationErrors.length > 0) { + return { + errors: validationErrors, + }; + } // Execute + + return execute({ + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/index.d.ts b/graphql-subscription-express/node_modules/graphql/index.d.ts new file mode 100644 index 0000000..2b7e702 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/index.d.ts @@ -0,0 +1,413 @@ +/** + * GraphQL.js provides a reference implementation for the GraphQL specification + * but is also a useful utility for operating on GraphQL files and building + * sophisticated tools. + * + * This primary module exports a general purpose function for fulfilling all + * steps of the GraphQL specification in a single operation, but also includes + * utilities for every part of the GraphQL specification: + * + * - Parsing the GraphQL language. + * - Building a GraphQL type schema. + * - Validating a GraphQL request against a type schema. + * - Executing a GraphQL request against a type schema. + * + * This also includes utility functions for operating on GraphQL types and + * GraphQL documents to facilitate building tools. + * + * You may also import from each sub-directory directly. For example, the + * following two import statements are equivalent: + * + * ```ts + * import { parse } from 'graphql'; + * import { parse } from 'graphql/language'; + * ``` + * + * @packageDocumentation + */ +export { version, versionInfo } from './version'; +export type { GraphQLArgs } from './graphql'; +export { graphql, graphqlSync } from './graphql'; +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, + GraphQLSchema, + GraphQLDirective, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, + TypeKind, + DEFAULT_DEPRECATION_REASON, + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, + isSchema, + isDirective, + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + isSpecifiedScalarType, + isIntrospectionType, + isSpecifiedDirective, + assertSchema, + assertDirective, + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, + getNullableType, + getNamedType, + validateSchema, + assertValidSchema, + assertName, + assertEnumValueName, +} from './type/index'; +export type { + GraphQLType, + GraphQLInputType, + GraphQLOutputType, + GraphQLLeafType, + GraphQLCompositeType, + GraphQLAbstractType, + GraphQLWrappingType, + GraphQLNullableType, + GraphQLNamedType, + GraphQLNamedInputType, + GraphQLNamedOutputType, + ThunkReadonlyArray, + ThunkObjMap, + GraphQLSchemaConfig, + GraphQLSchemaExtensions, + GraphQLDirectiveConfig, + GraphQLDirectiveExtensions, + GraphQLArgument, + GraphQLArgumentConfig, + GraphQLArgumentExtensions, + GraphQLEnumTypeConfig, + GraphQLEnumTypeExtensions, + GraphQLEnumValue, + GraphQLEnumValueConfig, + GraphQLEnumValueConfigMap, + GraphQLEnumValueExtensions, + GraphQLField, + GraphQLFieldConfig, + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLFieldExtensions, + GraphQLFieldMap, + GraphQLFieldResolver, + GraphQLInputField, + GraphQLInputFieldConfig, + GraphQLInputFieldConfigMap, + GraphQLInputFieldExtensions, + GraphQLInputFieldMap, + GraphQLInputObjectTypeConfig, + GraphQLInputObjectTypeExtensions, + GraphQLInterfaceTypeConfig, + GraphQLInterfaceTypeExtensions, + GraphQLIsTypeOfFn, + GraphQLObjectTypeConfig, + GraphQLObjectTypeExtensions, + GraphQLResolveInfo, + ResponsePath, + GraphQLScalarTypeConfig, + GraphQLScalarTypeExtensions, + GraphQLTypeResolver, + GraphQLUnionTypeConfig, + GraphQLUnionTypeExtensions, + GraphQLScalarSerializer, + GraphQLScalarValueParser, + GraphQLScalarLiteralParser, +} from './type/index'; +export { + Token, + Source, + Location, + OperationTypeNode, + getLocation, + printLocation, + printSourceLocation, + Lexer, + TokenKind, + parse, + parseValue, + parseConstValue, + parseType, + print, + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, + Kind, + DirectiveLocation, + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './language/index'; +export type { + ParseOptions, + SourceLocation, + TokenKindEnum, + KindEnum, + DirectiveLocationEnum, + ASTVisitor, + ASTVisitFn, + ASTVisitorKeyMap, + ASTNode, + ASTKindToNode, + NameNode, + DocumentNode, + DefinitionNode, + ExecutableDefinitionNode, + OperationDefinitionNode, + VariableDefinitionNode, + VariableNode, + SelectionSetNode, + SelectionNode, + FieldNode, + ArgumentNode, + ConstArgumentNode, + FragmentSpreadNode, + InlineFragmentNode, + FragmentDefinitionNode, + ValueNode, + ConstValueNode, + IntValueNode, + FloatValueNode, + StringValueNode, + BooleanValueNode, + NullValueNode, + EnumValueNode, + ListValueNode, + ConstListValueNode, + ObjectValueNode, + ConstObjectValueNode, + ObjectFieldNode, + ConstObjectFieldNode, + DirectiveNode, + ConstDirectiveNode, + TypeNode, + NamedTypeNode, + ListTypeNode, + NonNullTypeNode, + TypeSystemDefinitionNode, + SchemaDefinitionNode, + OperationTypeDefinitionNode, + TypeDefinitionNode, + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + DirectiveDefinitionNode, + TypeSystemExtensionNode, + SchemaExtensionNode, + TypeExtensionNode, + ScalarTypeExtensionNode, + ObjectTypeExtensionNode, + InterfaceTypeExtensionNode, + UnionTypeExtensionNode, + EnumTypeExtensionNode, + InputObjectTypeExtensionNode, +} from './language/index'; +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, + responsePathAsArray, + getArgumentValues, + getVariableValues, + getDirectiveValues, + subscribe, + createSourceEventStream, +} from './execution/index'; +export type { + ExecutionArgs, + ExecutionResult, + FormattedExecutionResult, +} from './execution/index'; +export type { SubscriptionArgs } from './subscription/index'; +export { + validate, + ValidationContext, + specifiedRules, + ExecutableDefinitionsRule, + FieldsOnCorrectTypeRule, + FragmentsOnCompositeTypesRule, + KnownArgumentNamesRule, + KnownDirectivesRule, + KnownFragmentNamesRule, + KnownTypeNamesRule, + LoneAnonymousOperationRule, + NoFragmentCyclesRule, + NoUndefinedVariablesRule, + NoUnusedFragmentsRule, + NoUnusedVariablesRule, + OverlappingFieldsCanBeMergedRule, + PossibleFragmentSpreadsRule, + ProvidedRequiredArgumentsRule, + ScalarLeafsRule, + SingleFieldSubscriptionsRule, + UniqueArgumentNamesRule, + UniqueDirectivesPerLocationRule, + UniqueFragmentNamesRule, + UniqueInputFieldNamesRule, + UniqueOperationNamesRule, + UniqueVariableNamesRule, + ValuesOfCorrectTypeRule, + VariablesAreInputTypesRule, + VariablesInAllowedPositionRule, + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + PossibleTypeExtensionsRule, + NoDeprecatedCustomRule, + NoSchemaIntrospectionCustomRule, +} from './validation/index'; +export type { ValidationRule } from './validation/index'; +export { + GraphQLError, + syntaxError, + locatedError, + printError, + formatError, +} from './error/index'; +export type { + GraphQLErrorOptions, + GraphQLFormattedError, + GraphQLErrorExtensions, +} from './error/index'; +export { + getIntrospectionQuery, + getOperationAST, + getOperationRootType, + introspectionFromSchema, + buildClientSchema, + buildASTSchema, + buildSchema, + extendSchema, + lexicographicSortSchema, + printSchema, + printType, + printIntrospectionSchema, + typeFromAST, + valueFromAST, + valueFromASTUntyped, + astFromValue, + TypeInfo, + visitWithTypeInfo, + coerceInputValue, + concatAST, + separateOperations, + stripIgnoredCharacters, + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, + assertValidName, + isValidNameError, + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './utilities/index'; +export type { + IntrospectionOptions, + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionInputType, + IntrospectionOutputType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionInputTypeRef, + IntrospectionOutputTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, + BuildSchemaOptions, + BreakingChange, + DangerousChange, + TypedQueryDocumentNode, +} from './utilities/index'; diff --git a/graphql-subscription-express/node_modules/graphql/index.js b/graphql-subscription-express/node_modules/graphql/index.js new file mode 100644 index 0000000..153e908 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/index.js @@ -0,0 +1,1269 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'BREAK', { + enumerable: true, + get: function () { + return _index2.BREAK; + }, +}); +Object.defineProperty(exports, 'BreakingChangeType', { + enumerable: true, + get: function () { + return _index6.BreakingChangeType; + }, +}); +Object.defineProperty(exports, 'DEFAULT_DEPRECATION_REASON', { + enumerable: true, + get: function () { + return _index.DEFAULT_DEPRECATION_REASON; + }, +}); +Object.defineProperty(exports, 'DangerousChangeType', { + enumerable: true, + get: function () { + return _index6.DangerousChangeType; + }, +}); +Object.defineProperty(exports, 'DirectiveLocation', { + enumerable: true, + get: function () { + return _index2.DirectiveLocation; + }, +}); +Object.defineProperty(exports, 'ExecutableDefinitionsRule', { + enumerable: true, + get: function () { + return _index4.ExecutableDefinitionsRule; + }, +}); +Object.defineProperty(exports, 'FieldsOnCorrectTypeRule', { + enumerable: true, + get: function () { + return _index4.FieldsOnCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'FragmentsOnCompositeTypesRule', { + enumerable: true, + get: function () { + return _index4.FragmentsOnCompositeTypesRule; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MAX_INT', { + enumerable: true, + get: function () { + return _index.GRAPHQL_MAX_INT; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MIN_INT', { + enumerable: true, + get: function () { + return _index.GRAPHQL_MIN_INT; + }, +}); +Object.defineProperty(exports, 'GraphQLBoolean', { + enumerable: true, + get: function () { + return _index.GraphQLBoolean; + }, +}); +Object.defineProperty(exports, 'GraphQLDeprecatedDirective', { + enumerable: true, + get: function () { + return _index.GraphQLDeprecatedDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLDirective', { + enumerable: true, + get: function () { + return _index.GraphQLDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLEnumType', { + enumerable: true, + get: function () { + return _index.GraphQLEnumType; + }, +}); +Object.defineProperty(exports, 'GraphQLError', { + enumerable: true, + get: function () { + return _index5.GraphQLError; + }, +}); +Object.defineProperty(exports, 'GraphQLFloat', { + enumerable: true, + get: function () { + return _index.GraphQLFloat; + }, +}); +Object.defineProperty(exports, 'GraphQLID', { + enumerable: true, + get: function () { + return _index.GraphQLID; + }, +}); +Object.defineProperty(exports, 'GraphQLIncludeDirective', { + enumerable: true, + get: function () { + return _index.GraphQLIncludeDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLInputObjectType', { + enumerable: true, + get: function () { + return _index.GraphQLInputObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLInt', { + enumerable: true, + get: function () { + return _index.GraphQLInt; + }, +}); +Object.defineProperty(exports, 'GraphQLInterfaceType', { + enumerable: true, + get: function () { + return _index.GraphQLInterfaceType; + }, +}); +Object.defineProperty(exports, 'GraphQLList', { + enumerable: true, + get: function () { + return _index.GraphQLList; + }, +}); +Object.defineProperty(exports, 'GraphQLNonNull', { + enumerable: true, + get: function () { + return _index.GraphQLNonNull; + }, +}); +Object.defineProperty(exports, 'GraphQLObjectType', { + enumerable: true, + get: function () { + return _index.GraphQLObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLScalarType', { + enumerable: true, + get: function () { + return _index.GraphQLScalarType; + }, +}); +Object.defineProperty(exports, 'GraphQLSchema', { + enumerable: true, + get: function () { + return _index.GraphQLSchema; + }, +}); +Object.defineProperty(exports, 'GraphQLSkipDirective', { + enumerable: true, + get: function () { + return _index.GraphQLSkipDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLSpecifiedByDirective', { + enumerable: true, + get: function () { + return _index.GraphQLSpecifiedByDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLString', { + enumerable: true, + get: function () { + return _index.GraphQLString; + }, +}); +Object.defineProperty(exports, 'GraphQLUnionType', { + enumerable: true, + get: function () { + return _index.GraphQLUnionType; + }, +}); +Object.defineProperty(exports, 'Kind', { + enumerable: true, + get: function () { + return _index2.Kind; + }, +}); +Object.defineProperty(exports, 'KnownArgumentNamesRule', { + enumerable: true, + get: function () { + return _index4.KnownArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownDirectivesRule', { + enumerable: true, + get: function () { + return _index4.KnownDirectivesRule; + }, +}); +Object.defineProperty(exports, 'KnownFragmentNamesRule', { + enumerable: true, + get: function () { + return _index4.KnownFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownTypeNamesRule', { + enumerable: true, + get: function () { + return _index4.KnownTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'Lexer', { + enumerable: true, + get: function () { + return _index2.Lexer; + }, +}); +Object.defineProperty(exports, 'Location', { + enumerable: true, + get: function () { + return _index2.Location; + }, +}); +Object.defineProperty(exports, 'LoneAnonymousOperationRule', { + enumerable: true, + get: function () { + return _index4.LoneAnonymousOperationRule; + }, +}); +Object.defineProperty(exports, 'LoneSchemaDefinitionRule', { + enumerable: true, + get: function () { + return _index4.LoneSchemaDefinitionRule; + }, +}); +Object.defineProperty(exports, 'NoDeprecatedCustomRule', { + enumerable: true, + get: function () { + return _index4.NoDeprecatedCustomRule; + }, +}); +Object.defineProperty(exports, 'NoFragmentCyclesRule', { + enumerable: true, + get: function () { + return _index4.NoFragmentCyclesRule; + }, +}); +Object.defineProperty(exports, 'NoSchemaIntrospectionCustomRule', { + enumerable: true, + get: function () { + return _index4.NoSchemaIntrospectionCustomRule; + }, +}); +Object.defineProperty(exports, 'NoUndefinedVariablesRule', { + enumerable: true, + get: function () { + return _index4.NoUndefinedVariablesRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedFragmentsRule', { + enumerable: true, + get: function () { + return _index4.NoUnusedFragmentsRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedVariablesRule', { + enumerable: true, + get: function () { + return _index4.NoUnusedVariablesRule; + }, +}); +Object.defineProperty(exports, 'OperationTypeNode', { + enumerable: true, + get: function () { + return _index2.OperationTypeNode; + }, +}); +Object.defineProperty(exports, 'OverlappingFieldsCanBeMergedRule', { + enumerable: true, + get: function () { + return _index4.OverlappingFieldsCanBeMergedRule; + }, +}); +Object.defineProperty(exports, 'PossibleFragmentSpreadsRule', { + enumerable: true, + get: function () { + return _index4.PossibleFragmentSpreadsRule; + }, +}); +Object.defineProperty(exports, 'PossibleTypeExtensionsRule', { + enumerable: true, + get: function () { + return _index4.PossibleTypeExtensionsRule; + }, +}); +Object.defineProperty(exports, 'ProvidedRequiredArgumentsRule', { + enumerable: true, + get: function () { + return _index4.ProvidedRequiredArgumentsRule; + }, +}); +Object.defineProperty(exports, 'ScalarLeafsRule', { + enumerable: true, + get: function () { + return _index4.ScalarLeafsRule; + }, +}); +Object.defineProperty(exports, 'SchemaMetaFieldDef', { + enumerable: true, + get: function () { + return _index.SchemaMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'SingleFieldSubscriptionsRule', { + enumerable: true, + get: function () { + return _index4.SingleFieldSubscriptionsRule; + }, +}); +Object.defineProperty(exports, 'Source', { + enumerable: true, + get: function () { + return _index2.Source; + }, +}); +Object.defineProperty(exports, 'Token', { + enumerable: true, + get: function () { + return _index2.Token; + }, +}); +Object.defineProperty(exports, 'TokenKind', { + enumerable: true, + get: function () { + return _index2.TokenKind; + }, +}); +Object.defineProperty(exports, 'TypeInfo', { + enumerable: true, + get: function () { + return _index6.TypeInfo; + }, +}); +Object.defineProperty(exports, 'TypeKind', { + enumerable: true, + get: function () { + return _index.TypeKind; + }, +}); +Object.defineProperty(exports, 'TypeMetaFieldDef', { + enumerable: true, + get: function () { + return _index.TypeMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'TypeNameMetaFieldDef', { + enumerable: true, + get: function () { + return _index.TypeNameMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentDefinitionNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueArgumentDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectiveNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueDirectiveNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectivesPerLocationRule', { + enumerable: true, + get: function () { + return _index4.UniqueDirectivesPerLocationRule; + }, +}); +Object.defineProperty(exports, 'UniqueEnumValueNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueEnumValueNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFieldDefinitionNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueFieldDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFragmentNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueInputFieldNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueInputFieldNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueOperationNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationTypesRule', { + enumerable: true, + get: function () { + return _index4.UniqueOperationTypesRule; + }, +}); +Object.defineProperty(exports, 'UniqueTypeNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueVariableNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueVariableNamesRule; + }, +}); +Object.defineProperty(exports, 'ValidationContext', { + enumerable: true, + get: function () { + return _index4.ValidationContext; + }, +}); +Object.defineProperty(exports, 'ValuesOfCorrectTypeRule', { + enumerable: true, + get: function () { + return _index4.ValuesOfCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'VariablesAreInputTypesRule', { + enumerable: true, + get: function () { + return _index4.VariablesAreInputTypesRule; + }, +}); +Object.defineProperty(exports, 'VariablesInAllowedPositionRule', { + enumerable: true, + get: function () { + return _index4.VariablesInAllowedPositionRule; + }, +}); +Object.defineProperty(exports, '__Directive', { + enumerable: true, + get: function () { + return _index.__Directive; + }, +}); +Object.defineProperty(exports, '__DirectiveLocation', { + enumerable: true, + get: function () { + return _index.__DirectiveLocation; + }, +}); +Object.defineProperty(exports, '__EnumValue', { + enumerable: true, + get: function () { + return _index.__EnumValue; + }, +}); +Object.defineProperty(exports, '__Field', { + enumerable: true, + get: function () { + return _index.__Field; + }, +}); +Object.defineProperty(exports, '__InputValue', { + enumerable: true, + get: function () { + return _index.__InputValue; + }, +}); +Object.defineProperty(exports, '__Schema', { + enumerable: true, + get: function () { + return _index.__Schema; + }, +}); +Object.defineProperty(exports, '__Type', { + enumerable: true, + get: function () { + return _index.__Type; + }, +}); +Object.defineProperty(exports, '__TypeKind', { + enumerable: true, + get: function () { + return _index.__TypeKind; + }, +}); +Object.defineProperty(exports, 'assertAbstractType', { + enumerable: true, + get: function () { + return _index.assertAbstractType; + }, +}); +Object.defineProperty(exports, 'assertCompositeType', { + enumerable: true, + get: function () { + return _index.assertCompositeType; + }, +}); +Object.defineProperty(exports, 'assertDirective', { + enumerable: true, + get: function () { + return _index.assertDirective; + }, +}); +Object.defineProperty(exports, 'assertEnumType', { + enumerable: true, + get: function () { + return _index.assertEnumType; + }, +}); +Object.defineProperty(exports, 'assertEnumValueName', { + enumerable: true, + get: function () { + return _index.assertEnumValueName; + }, +}); +Object.defineProperty(exports, 'assertInputObjectType', { + enumerable: true, + get: function () { + return _index.assertInputObjectType; + }, +}); +Object.defineProperty(exports, 'assertInputType', { + enumerable: true, + get: function () { + return _index.assertInputType; + }, +}); +Object.defineProperty(exports, 'assertInterfaceType', { + enumerable: true, + get: function () { + return _index.assertInterfaceType; + }, +}); +Object.defineProperty(exports, 'assertLeafType', { + enumerable: true, + get: function () { + return _index.assertLeafType; + }, +}); +Object.defineProperty(exports, 'assertListType', { + enumerable: true, + get: function () { + return _index.assertListType; + }, +}); +Object.defineProperty(exports, 'assertName', { + enumerable: true, + get: function () { + return _index.assertName; + }, +}); +Object.defineProperty(exports, 'assertNamedType', { + enumerable: true, + get: function () { + return _index.assertNamedType; + }, +}); +Object.defineProperty(exports, 'assertNonNullType', { + enumerable: true, + get: function () { + return _index.assertNonNullType; + }, +}); +Object.defineProperty(exports, 'assertNullableType', { + enumerable: true, + get: function () { + return _index.assertNullableType; + }, +}); +Object.defineProperty(exports, 'assertObjectType', { + enumerable: true, + get: function () { + return _index.assertObjectType; + }, +}); +Object.defineProperty(exports, 'assertOutputType', { + enumerable: true, + get: function () { + return _index.assertOutputType; + }, +}); +Object.defineProperty(exports, 'assertScalarType', { + enumerable: true, + get: function () { + return _index.assertScalarType; + }, +}); +Object.defineProperty(exports, 'assertSchema', { + enumerable: true, + get: function () { + return _index.assertSchema; + }, +}); +Object.defineProperty(exports, 'assertType', { + enumerable: true, + get: function () { + return _index.assertType; + }, +}); +Object.defineProperty(exports, 'assertUnionType', { + enumerable: true, + get: function () { + return _index.assertUnionType; + }, +}); +Object.defineProperty(exports, 'assertValidName', { + enumerable: true, + get: function () { + return _index6.assertValidName; + }, +}); +Object.defineProperty(exports, 'assertValidSchema', { + enumerable: true, + get: function () { + return _index.assertValidSchema; + }, +}); +Object.defineProperty(exports, 'assertWrappingType', { + enumerable: true, + get: function () { + return _index.assertWrappingType; + }, +}); +Object.defineProperty(exports, 'astFromValue', { + enumerable: true, + get: function () { + return _index6.astFromValue; + }, +}); +Object.defineProperty(exports, 'buildASTSchema', { + enumerable: true, + get: function () { + return _index6.buildASTSchema; + }, +}); +Object.defineProperty(exports, 'buildClientSchema', { + enumerable: true, + get: function () { + return _index6.buildClientSchema; + }, +}); +Object.defineProperty(exports, 'buildSchema', { + enumerable: true, + get: function () { + return _index6.buildSchema; + }, +}); +Object.defineProperty(exports, 'coerceInputValue', { + enumerable: true, + get: function () { + return _index6.coerceInputValue; + }, +}); +Object.defineProperty(exports, 'concatAST', { + enumerable: true, + get: function () { + return _index6.concatAST; + }, +}); +Object.defineProperty(exports, 'createSourceEventStream', { + enumerable: true, + get: function () { + return _index3.createSourceEventStream; + }, +}); +Object.defineProperty(exports, 'defaultFieldResolver', { + enumerable: true, + get: function () { + return _index3.defaultFieldResolver; + }, +}); +Object.defineProperty(exports, 'defaultTypeResolver', { + enumerable: true, + get: function () { + return _index3.defaultTypeResolver; + }, +}); +Object.defineProperty(exports, 'doTypesOverlap', { + enumerable: true, + get: function () { + return _index6.doTypesOverlap; + }, +}); +Object.defineProperty(exports, 'execute', { + enumerable: true, + get: function () { + return _index3.execute; + }, +}); +Object.defineProperty(exports, 'executeSync', { + enumerable: true, + get: function () { + return _index3.executeSync; + }, +}); +Object.defineProperty(exports, 'extendSchema', { + enumerable: true, + get: function () { + return _index6.extendSchema; + }, +}); +Object.defineProperty(exports, 'findBreakingChanges', { + enumerable: true, + get: function () { + return _index6.findBreakingChanges; + }, +}); +Object.defineProperty(exports, 'findDangerousChanges', { + enumerable: true, + get: function () { + return _index6.findDangerousChanges; + }, +}); +Object.defineProperty(exports, 'formatError', { + enumerable: true, + get: function () { + return _index5.formatError; + }, +}); +Object.defineProperty(exports, 'getArgumentValues', { + enumerable: true, + get: function () { + return _index3.getArgumentValues; + }, +}); +Object.defineProperty(exports, 'getDirectiveValues', { + enumerable: true, + get: function () { + return _index3.getDirectiveValues; + }, +}); +Object.defineProperty(exports, 'getEnterLeaveForKind', { + enumerable: true, + get: function () { + return _index2.getEnterLeaveForKind; + }, +}); +Object.defineProperty(exports, 'getIntrospectionQuery', { + enumerable: true, + get: function () { + return _index6.getIntrospectionQuery; + }, +}); +Object.defineProperty(exports, 'getLocation', { + enumerable: true, + get: function () { + return _index2.getLocation; + }, +}); +Object.defineProperty(exports, 'getNamedType', { + enumerable: true, + get: function () { + return _index.getNamedType; + }, +}); +Object.defineProperty(exports, 'getNullableType', { + enumerable: true, + get: function () { + return _index.getNullableType; + }, +}); +Object.defineProperty(exports, 'getOperationAST', { + enumerable: true, + get: function () { + return _index6.getOperationAST; + }, +}); +Object.defineProperty(exports, 'getOperationRootType', { + enumerable: true, + get: function () { + return _index6.getOperationRootType; + }, +}); +Object.defineProperty(exports, 'getVariableValues', { + enumerable: true, + get: function () { + return _index3.getVariableValues; + }, +}); +Object.defineProperty(exports, 'getVisitFn', { + enumerable: true, + get: function () { + return _index2.getVisitFn; + }, +}); +Object.defineProperty(exports, 'graphql', { + enumerable: true, + get: function () { + return _graphql.graphql; + }, +}); +Object.defineProperty(exports, 'graphqlSync', { + enumerable: true, + get: function () { + return _graphql.graphqlSync; + }, +}); +Object.defineProperty(exports, 'introspectionFromSchema', { + enumerable: true, + get: function () { + return _index6.introspectionFromSchema; + }, +}); +Object.defineProperty(exports, 'introspectionTypes', { + enumerable: true, + get: function () { + return _index.introspectionTypes; + }, +}); +Object.defineProperty(exports, 'isAbstractType', { + enumerable: true, + get: function () { + return _index.isAbstractType; + }, +}); +Object.defineProperty(exports, 'isCompositeType', { + enumerable: true, + get: function () { + return _index.isCompositeType; + }, +}); +Object.defineProperty(exports, 'isConstValueNode', { + enumerable: true, + get: function () { + return _index2.isConstValueNode; + }, +}); +Object.defineProperty(exports, 'isDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isDirective', { + enumerable: true, + get: function () { + return _index.isDirective; + }, +}); +Object.defineProperty(exports, 'isEnumType', { + enumerable: true, + get: function () { + return _index.isEnumType; + }, +}); +Object.defineProperty(exports, 'isEqualType', { + enumerable: true, + get: function () { + return _index6.isEqualType; + }, +}); +Object.defineProperty(exports, 'isExecutableDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isExecutableDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isInputObjectType', { + enumerable: true, + get: function () { + return _index.isInputObjectType; + }, +}); +Object.defineProperty(exports, 'isInputType', { + enumerable: true, + get: function () { + return _index.isInputType; + }, +}); +Object.defineProperty(exports, 'isInterfaceType', { + enumerable: true, + get: function () { + return _index.isInterfaceType; + }, +}); +Object.defineProperty(exports, 'isIntrospectionType', { + enumerable: true, + get: function () { + return _index.isIntrospectionType; + }, +}); +Object.defineProperty(exports, 'isLeafType', { + enumerable: true, + get: function () { + return _index.isLeafType; + }, +}); +Object.defineProperty(exports, 'isListType', { + enumerable: true, + get: function () { + return _index.isListType; + }, +}); +Object.defineProperty(exports, 'isNamedType', { + enumerable: true, + get: function () { + return _index.isNamedType; + }, +}); +Object.defineProperty(exports, 'isNonNullType', { + enumerable: true, + get: function () { + return _index.isNonNullType; + }, +}); +Object.defineProperty(exports, 'isNullableType', { + enumerable: true, + get: function () { + return _index.isNullableType; + }, +}); +Object.defineProperty(exports, 'isObjectType', { + enumerable: true, + get: function () { + return _index.isObjectType; + }, +}); +Object.defineProperty(exports, 'isOutputType', { + enumerable: true, + get: function () { + return _index.isOutputType; + }, +}); +Object.defineProperty(exports, 'isRequiredArgument', { + enumerable: true, + get: function () { + return _index.isRequiredArgument; + }, +}); +Object.defineProperty(exports, 'isRequiredInputField', { + enumerable: true, + get: function () { + return _index.isRequiredInputField; + }, +}); +Object.defineProperty(exports, 'isScalarType', { + enumerable: true, + get: function () { + return _index.isScalarType; + }, +}); +Object.defineProperty(exports, 'isSchema', { + enumerable: true, + get: function () { + return _index.isSchema; + }, +}); +Object.defineProperty(exports, 'isSelectionNode', { + enumerable: true, + get: function () { + return _index2.isSelectionNode; + }, +}); +Object.defineProperty(exports, 'isSpecifiedDirective', { + enumerable: true, + get: function () { + return _index.isSpecifiedDirective; + }, +}); +Object.defineProperty(exports, 'isSpecifiedScalarType', { + enumerable: true, + get: function () { + return _index.isSpecifiedScalarType; + }, +}); +Object.defineProperty(exports, 'isType', { + enumerable: true, + get: function () { + return _index.isType; + }, +}); +Object.defineProperty(exports, 'isTypeDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isTypeDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeExtensionNode', { + enumerable: true, + get: function () { + return _index2.isTypeExtensionNode; + }, +}); +Object.defineProperty(exports, 'isTypeNode', { + enumerable: true, + get: function () { + return _index2.isTypeNode; + }, +}); +Object.defineProperty(exports, 'isTypeSubTypeOf', { + enumerable: true, + get: function () { + return _index6.isTypeSubTypeOf; + }, +}); +Object.defineProperty(exports, 'isTypeSystemDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isTypeSystemDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeSystemExtensionNode', { + enumerable: true, + get: function () { + return _index2.isTypeSystemExtensionNode; + }, +}); +Object.defineProperty(exports, 'isUnionType', { + enumerable: true, + get: function () { + return _index.isUnionType; + }, +}); +Object.defineProperty(exports, 'isValidNameError', { + enumerable: true, + get: function () { + return _index6.isValidNameError; + }, +}); +Object.defineProperty(exports, 'isValueNode', { + enumerable: true, + get: function () { + return _index2.isValueNode; + }, +}); +Object.defineProperty(exports, 'isWrappingType', { + enumerable: true, + get: function () { + return _index.isWrappingType; + }, +}); +Object.defineProperty(exports, 'lexicographicSortSchema', { + enumerable: true, + get: function () { + return _index6.lexicographicSortSchema; + }, +}); +Object.defineProperty(exports, 'locatedError', { + enumerable: true, + get: function () { + return _index5.locatedError; + }, +}); +Object.defineProperty(exports, 'parse', { + enumerable: true, + get: function () { + return _index2.parse; + }, +}); +Object.defineProperty(exports, 'parseConstValue', { + enumerable: true, + get: function () { + return _index2.parseConstValue; + }, +}); +Object.defineProperty(exports, 'parseType', { + enumerable: true, + get: function () { + return _index2.parseType; + }, +}); +Object.defineProperty(exports, 'parseValue', { + enumerable: true, + get: function () { + return _index2.parseValue; + }, +}); +Object.defineProperty(exports, 'print', { + enumerable: true, + get: function () { + return _index2.print; + }, +}); +Object.defineProperty(exports, 'printError', { + enumerable: true, + get: function () { + return _index5.printError; + }, +}); +Object.defineProperty(exports, 'printIntrospectionSchema', { + enumerable: true, + get: function () { + return _index6.printIntrospectionSchema; + }, +}); +Object.defineProperty(exports, 'printLocation', { + enumerable: true, + get: function () { + return _index2.printLocation; + }, +}); +Object.defineProperty(exports, 'printSchema', { + enumerable: true, + get: function () { + return _index6.printSchema; + }, +}); +Object.defineProperty(exports, 'printSourceLocation', { + enumerable: true, + get: function () { + return _index2.printSourceLocation; + }, +}); +Object.defineProperty(exports, 'printType', { + enumerable: true, + get: function () { + return _index6.printType; + }, +}); +Object.defineProperty(exports, 'resolveObjMapThunk', { + enumerable: true, + get: function () { + return _index.resolveObjMapThunk; + }, +}); +Object.defineProperty(exports, 'resolveReadonlyArrayThunk', { + enumerable: true, + get: function () { + return _index.resolveReadonlyArrayThunk; + }, +}); +Object.defineProperty(exports, 'responsePathAsArray', { + enumerable: true, + get: function () { + return _index3.responsePathAsArray; + }, +}); +Object.defineProperty(exports, 'separateOperations', { + enumerable: true, + get: function () { + return _index6.separateOperations; + }, +}); +Object.defineProperty(exports, 'specifiedDirectives', { + enumerable: true, + get: function () { + return _index.specifiedDirectives; + }, +}); +Object.defineProperty(exports, 'specifiedRules', { + enumerable: true, + get: function () { + return _index4.specifiedRules; + }, +}); +Object.defineProperty(exports, 'specifiedScalarTypes', { + enumerable: true, + get: function () { + return _index.specifiedScalarTypes; + }, +}); +Object.defineProperty(exports, 'stripIgnoredCharacters', { + enumerable: true, + get: function () { + return _index6.stripIgnoredCharacters; + }, +}); +Object.defineProperty(exports, 'subscribe', { + enumerable: true, + get: function () { + return _index3.subscribe; + }, +}); +Object.defineProperty(exports, 'syntaxError', { + enumerable: true, + get: function () { + return _index5.syntaxError; + }, +}); +Object.defineProperty(exports, 'typeFromAST', { + enumerable: true, + get: function () { + return _index6.typeFromAST; + }, +}); +Object.defineProperty(exports, 'validate', { + enumerable: true, + get: function () { + return _index4.validate; + }, +}); +Object.defineProperty(exports, 'validateSchema', { + enumerable: true, + get: function () { + return _index.validateSchema; + }, +}); +Object.defineProperty(exports, 'valueFromAST', { + enumerable: true, + get: function () { + return _index6.valueFromAST; + }, +}); +Object.defineProperty(exports, 'valueFromASTUntyped', { + enumerable: true, + get: function () { + return _index6.valueFromASTUntyped; + }, +}); +Object.defineProperty(exports, 'version', { + enumerable: true, + get: function () { + return _version.version; + }, +}); +Object.defineProperty(exports, 'versionInfo', { + enumerable: true, + get: function () { + return _version.versionInfo; + }, +}); +Object.defineProperty(exports, 'visit', { + enumerable: true, + get: function () { + return _index2.visit; + }, +}); +Object.defineProperty(exports, 'visitInParallel', { + enumerable: true, + get: function () { + return _index2.visitInParallel; + }, +}); +Object.defineProperty(exports, 'visitWithTypeInfo', { + enumerable: true, + get: function () { + return _index6.visitWithTypeInfo; + }, +}); + +var _version = require('./version.js'); + +var _graphql = require('./graphql.js'); + +var _index = require('./type/index.js'); + +var _index2 = require('./language/index.js'); + +var _index3 = require('./execution/index.js'); + +var _index4 = require('./validation/index.js'); + +var _index5 = require('./error/index.js'); + +var _index6 = require('./utilities/index.js'); diff --git a/graphql-subscription-express/node_modules/graphql/index.mjs b/graphql-subscription-express/node_modules/graphql/index.mjs new file mode 100644 index 0000000..ba8672e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/index.mjs @@ -0,0 +1,255 @@ +/** + * GraphQL.js provides a reference implementation for the GraphQL specification + * but is also a useful utility for operating on GraphQL files and building + * sophisticated tools. + * + * This primary module exports a general purpose function for fulfilling all + * steps of the GraphQL specification in a single operation, but also includes + * utilities for every part of the GraphQL specification: + * + * - Parsing the GraphQL language. + * - Building a GraphQL type schema. + * - Validating a GraphQL request against a type schema. + * - Executing a GraphQL request against a type schema. + * + * This also includes utility functions for operating on GraphQL types and + * GraphQL documents to facilitate building tools. + * + * You may also import from each sub-directory directly. For example, the + * following two import statements are equivalent: + * + * ```ts + * import { parse } from 'graphql'; + * import { parse } from 'graphql/language'; + * ``` + * + * @packageDocumentation + */ +// The GraphQL.js version info. +export { version, versionInfo } from './version.mjs'; // The primary entry point into fulfilling a GraphQL request. + +export { graphql, graphqlSync } from './graphql.mjs'; // Create and operate on GraphQL type definitions and schema. + +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, // Definitions + GraphQLSchema, + GraphQLDirective, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, // Standard GraphQL Scalars + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, // Int boundaries constants + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, // Built-in Directives defined by the Spec + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, // "Enum" of Type Kinds + TypeKind, // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, // GraphQL Types for introspection. + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, // Predicates + isSchema, + isDirective, + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + isSpecifiedScalarType, + isIntrospectionType, + isSpecifiedDirective, // Assertions + assertSchema, + assertDirective, + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, // Un-modifiers + getNullableType, + getNamedType, // Validate GraphQL schema. + validateSchema, + assertValidSchema, // Upholds the spec rules about naming. + assertName, + assertEnumValueName, +} from './type/index.mjs'; +// Parse and operate on GraphQL language source files. +export { + Token, + Source, + Location, + OperationTypeNode, + getLocation, // Print source location. + printLocation, + printSourceLocation, // Lex + Lexer, + TokenKind, // Parse + parse, + parseValue, + parseConstValue, + parseType, // Print + print, // Visit + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, + Kind, + DirectiveLocation, // Predicates + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './language/index.mjs'; +// Execute GraphQL queries. +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, + responsePathAsArray, + getArgumentValues, + getVariableValues, + getDirectiveValues, + subscribe, + createSourceEventStream, +} from './execution/index.mjs'; +// Validate GraphQL documents. +export { + validate, + ValidationContext, // All validation rules in the GraphQL Specification. + specifiedRules, // Individual validation rules. + ExecutableDefinitionsRule, + FieldsOnCorrectTypeRule, + FragmentsOnCompositeTypesRule, + KnownArgumentNamesRule, + KnownDirectivesRule, + KnownFragmentNamesRule, + KnownTypeNamesRule, + LoneAnonymousOperationRule, + NoFragmentCyclesRule, + NoUndefinedVariablesRule, + NoUnusedFragmentsRule, + NoUnusedVariablesRule, + OverlappingFieldsCanBeMergedRule, + PossibleFragmentSpreadsRule, + ProvidedRequiredArgumentsRule, + ScalarLeafsRule, + SingleFieldSubscriptionsRule, + UniqueArgumentNamesRule, + UniqueDirectivesPerLocationRule, + UniqueFragmentNamesRule, + UniqueInputFieldNamesRule, + UniqueOperationNamesRule, + UniqueVariableNamesRule, + ValuesOfCorrectTypeRule, + VariablesAreInputTypesRule, + VariablesInAllowedPositionRule, // SDL-specific validation rules + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + PossibleTypeExtensionsRule, // Custom validation rules + NoDeprecatedCustomRule, + NoSchemaIntrospectionCustomRule, +} from './validation/index.mjs'; +// Create, format, and print GraphQL errors. +export { + GraphQLError, + syntaxError, + locatedError, + printError, + formatError, +} from './error/index.mjs'; +// Utilities for operating on GraphQL type schema and parsed sources. +export { + // Produce the GraphQL query recommended for a full schema introspection. + // Accepts optional IntrospectionOptions. + getIntrospectionQuery, // Gets the target Operation from a Document. + getOperationAST, // Gets the Type for the target Operation AST. + getOperationRootType, // Convert a GraphQLSchema to an IntrospectionQuery. + introspectionFromSchema, // Build a GraphQLSchema from an introspection result. + buildClientSchema, // Build a GraphQLSchema from a parsed GraphQL Schema language AST. + buildASTSchema, // Build a GraphQLSchema from a GraphQL schema language document. + buildSchema, // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. + extendSchema, // Sort a GraphQLSchema. + lexicographicSortSchema, // Print a GraphQLSchema to GraphQL Schema language. + printSchema, // Print a GraphQLType to GraphQL Schema language. + printType, // Prints the built-in introspection schema in the Schema Language format. + printIntrospectionSchema, // Create a GraphQLType from a GraphQL language AST. + typeFromAST, // Create a JavaScript value from a GraphQL language AST with a Type. + valueFromAST, // Create a JavaScript value from a GraphQL language AST without a Type. + valueFromASTUntyped, // Create a GraphQL language AST from a JavaScript value. + astFromValue, // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. + TypeInfo, + visitWithTypeInfo, // Coerces a JavaScript value to a GraphQL type, or produces errors. + coerceInputValue, // Concatenates multiple AST together. + concatAST, // Separates an AST into an AST per Operation. + separateOperations, // Strips characters that are not significant to the validity or execution of a GraphQL document. + stripIgnoredCharacters, // Comparators for types + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, // Asserts a string is a valid GraphQL name. + assertValidName, // Determine if a string is a valid GraphQL name. + isValidNameError, // Compares two GraphQLSchemas and detects breaking changes. + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './utilities/index.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.d.ts new file mode 100644 index 0000000..d86ffcc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.d.ts @@ -0,0 +1,2 @@ +/** Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/ */ +export declare type Maybe = null | undefined | T; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.js b/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/Maybe.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.d.ts new file mode 100644 index 0000000..d22215b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.d.ts @@ -0,0 +1,16 @@ +export interface ObjMap { + [key: string]: T; +} +export declare type ObjMapLike = + | ObjMap + | { + [key: string]: T; + }; +export interface ReadOnlyObjMap { + readonly [key: string]: T; +} +export declare type ReadOnlyObjMapLike = + | ReadOnlyObjMap + | { + readonly [key: string]: T; + }; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.js b/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/ObjMap.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/Path.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/Path.d.ts new file mode 100644 index 0000000..af55cc0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/Path.d.ts @@ -0,0 +1,20 @@ +import type { Maybe } from './Maybe'; +export interface Path { + readonly prev: Path | undefined; + readonly key: string | number; + readonly typename: string | undefined; +} +/** + * Given a Path and a key, return a new Path containing the new key. + */ +export declare function addPath( + prev: Readonly | undefined, + key: string | number, + typename: string | undefined, +): Path; +/** + * Given a Path, return an Array of the path keys. + */ +export declare function pathToArray( + path: Maybe>, +): Array; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/Path.js b/graphql-subscription-express/node_modules/graphql/jsutils/Path.js new file mode 100644 index 0000000..9b4540a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/Path.js @@ -0,0 +1,33 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.addPath = addPath; +exports.pathToArray = pathToArray; + +/** + * Given a Path and a key, return a new Path containing the new key. + */ +function addPath(prev, key, typename) { + return { + prev, + key, + typename, + }; +} +/** + * Given a Path, return an Array of the path keys. + */ + +function pathToArray(path) { + const flattened = []; + let curr = path; + + while (curr) { + flattened.push(curr.key); + curr = curr.prev; + } + + return flattened.reverse(); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/Path.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/Path.mjs new file mode 100644 index 0000000..945f182 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/Path.mjs @@ -0,0 +1,25 @@ +/** + * Given a Path and a key, return a new Path containing the new key. + */ +export function addPath(prev, key, typename) { + return { + prev, + key, + typename, + }; +} +/** + * Given a Path, return an Array of the path keys. + */ + +export function pathToArray(path) { + const flattened = []; + let curr = path; + + while (curr) { + flattened.push(curr.key); + curr = curr.prev; + } + + return flattened.reverse(); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.d.ts new file mode 100644 index 0000000..abf2785 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.d.ts @@ -0,0 +1 @@ +export declare type PromiseOrValue = Promise | T; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.js b/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/PromiseOrValue.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.d.ts new file mode 100644 index 0000000..02f90c2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.d.ts @@ -0,0 +1 @@ +export declare function devAssert(condition: unknown, message: string): void; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.js b/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.js new file mode 100644 index 0000000..c40d406 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.devAssert = devAssert; + +function devAssert(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error(message); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.mjs new file mode 100644 index 0000000..5192b32 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/devAssert.mjs @@ -0,0 +1,7 @@ +export function devAssert(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error(message); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.d.ts new file mode 100644 index 0000000..81afb5d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.d.ts @@ -0,0 +1,8 @@ +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ +export declare function didYouMean(suggestions: ReadonlyArray): string; +export declare function didYouMean( + subMessage: string, + suggestions: ReadonlyArray, +): string; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.js b/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.js new file mode 100644 index 0000000..afac8d6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.didYouMean = didYouMean; +const MAX_SUGGESTIONS = 5; +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ + +function didYouMean(firstArg, secondArg) { + const [subMessage, suggestionsArg] = secondArg + ? [firstArg, secondArg] + : [undefined, firstArg]; + let message = ' Did you mean '; + + if (subMessage) { + message += subMessage + ' '; + } + + const suggestions = suggestionsArg.map((x) => `"${x}"`); + + switch (suggestions.length) { + case 0: + return ''; + + case 1: + return message + suggestions[0] + '?'; + + case 2: + return message + suggestions[0] + ' or ' + suggestions[1] + '?'; + } + + const selected = suggestions.slice(0, MAX_SUGGESTIONS); + const lastItem = selected.pop(); + return message + selected.join(', ') + ', or ' + lastItem + '?'; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.mjs new file mode 100644 index 0000000..bce3c29 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/didYouMean.mjs @@ -0,0 +1,32 @@ +const MAX_SUGGESTIONS = 5; +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ + +export function didYouMean(firstArg, secondArg) { + const [subMessage, suggestionsArg] = secondArg + ? [firstArg, secondArg] + : [undefined, firstArg]; + let message = ' Did you mean '; + + if (subMessage) { + message += subMessage + ' '; + } + + const suggestions = suggestionsArg.map((x) => `"${x}"`); + + switch (suggestions.length) { + case 0: + return ''; + + case 1: + return message + suggestions[0] + '?'; + + case 2: + return message + suggestions[0] + ' or ' + suggestions[1] + '?'; + } + + const selected = suggestions.slice(0, MAX_SUGGESTIONS); + const lastItem = selected.pop(); + return message + selected.join(', ') + ', or ' + lastItem + '?'; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.d.ts new file mode 100644 index 0000000..93b0b45 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.d.ts @@ -0,0 +1,7 @@ +/** + * Groups array items into a Map, given a function to produce grouping key. + */ +export declare function groupBy( + list: ReadonlyArray, + keyFn: (item: T) => K, +): Map>; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.js b/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.js new file mode 100644 index 0000000..7c2a2c3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.groupBy = groupBy; + +/** + * Groups array items into a Map, given a function to produce grouping key. + */ +function groupBy(list, keyFn) { + const result = new Map(); + + for (const item of list) { + const key = keyFn(item); + const group = result.get(key); + + if (group === undefined) { + result.set(key, [item]); + } else { + group.push(item); + } + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.mjs new file mode 100644 index 0000000..032287b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/groupBy.mjs @@ -0,0 +1,19 @@ +/** + * Groups array items into a Map, given a function to produce grouping key. + */ +export function groupBy(list, keyFn) { + const result = new Map(); + + for (const item of list) { + const key = keyFn(item); + const group = result.get(key); + + if (group === undefined) { + result.set(key, [item]); + } else { + group.push(item); + } + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.d.ts new file mode 100644 index 0000000..bf1bbcb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.d.ts @@ -0,0 +1,4 @@ +/** + * Returns the first argument it receives. + */ +export declare function identityFunc(x: T): T; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.js b/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.js new file mode 100644 index 0000000..d9614fc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.identityFunc = identityFunc; + +/** + * Returns the first argument it receives. + */ +function identityFunc(x) { + return x; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.mjs new file mode 100644 index 0000000..88e3fdc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/identityFunc.mjs @@ -0,0 +1,6 @@ +/** + * Returns the first argument it receives. + */ +export function identityFunc(x) { + return x; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/inspect.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/inspect.d.ts new file mode 100644 index 0000000..b6e0815 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/inspect.d.ts @@ -0,0 +1,4 @@ +/** + * Used to print values in error messages. + */ +export declare function inspect(value: unknown): string; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/inspect.js b/graphql-subscription-express/node_modules/graphql/jsutils/inspect.js new file mode 100644 index 0000000..9869702 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/inspect.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.inspect = inspect; +const MAX_ARRAY_LENGTH = 10; +const MAX_RECURSIVE_DEPTH = 2; +/** + * Used to print values in error messages. + */ + +function inspect(value) { + return formatValue(value, []); +} + +function formatValue(value, seenValues) { + switch (typeof value) { + case 'string': + return JSON.stringify(value); + + case 'function': + return value.name ? `[function ${value.name}]` : '[function]'; + + case 'object': + return formatObjectValue(value, seenValues); + + default: + return String(value); + } +} + +function formatObjectValue(value, previouslySeenValues) { + if (value === null) { + return 'null'; + } + + if (previouslySeenValues.includes(value)) { + return '[Circular]'; + } + + const seenValues = [...previouslySeenValues, value]; + + if (isJSONable(value)) { + const jsonValue = value.toJSON(); // check for infinite recursion + + if (jsonValue !== value) { + return typeof jsonValue === 'string' + ? jsonValue + : formatValue(jsonValue, seenValues); + } + } else if (Array.isArray(value)) { + return formatArray(value, seenValues); + } + + return formatObject(value, seenValues); +} + +function isJSONable(value) { + return typeof value.toJSON === 'function'; +} + +function formatObject(object, seenValues) { + const entries = Object.entries(object); + + if (entries.length === 0) { + return '{}'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[' + getObjectTag(object) + ']'; + } + + const properties = entries.map( + ([key, value]) => key + ': ' + formatValue(value, seenValues), + ); + return '{ ' + properties.join(', ') + ' }'; +} + +function formatArray(array, seenValues) { + if (array.length === 0) { + return '[]'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[Array]'; + } + + const len = Math.min(MAX_ARRAY_LENGTH, array.length); + const remaining = array.length - len; + const items = []; + + for (let i = 0; i < len; ++i) { + items.push(formatValue(array[i], seenValues)); + } + + if (remaining === 1) { + items.push('... 1 more item'); + } else if (remaining > 1) { + items.push(`... ${remaining} more items`); + } + + return '[' + items.join(', ') + ']'; +} + +function getObjectTag(object) { + const tag = Object.prototype.toString + .call(object) + .replace(/^\[object /, '') + .replace(/]$/, ''); + + if (tag === 'Object' && typeof object.constructor === 'function') { + const name = object.constructor.name; + + if (typeof name === 'string' && name !== '') { + return name; + } + } + + return tag; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/inspect.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/inspect.mjs new file mode 100644 index 0000000..00000b8 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/inspect.mjs @@ -0,0 +1,115 @@ +const MAX_ARRAY_LENGTH = 10; +const MAX_RECURSIVE_DEPTH = 2; +/** + * Used to print values in error messages. + */ + +export function inspect(value) { + return formatValue(value, []); +} + +function formatValue(value, seenValues) { + switch (typeof value) { + case 'string': + return JSON.stringify(value); + + case 'function': + return value.name ? `[function ${value.name}]` : '[function]'; + + case 'object': + return formatObjectValue(value, seenValues); + + default: + return String(value); + } +} + +function formatObjectValue(value, previouslySeenValues) { + if (value === null) { + return 'null'; + } + + if (previouslySeenValues.includes(value)) { + return '[Circular]'; + } + + const seenValues = [...previouslySeenValues, value]; + + if (isJSONable(value)) { + const jsonValue = value.toJSON(); // check for infinite recursion + + if (jsonValue !== value) { + return typeof jsonValue === 'string' + ? jsonValue + : formatValue(jsonValue, seenValues); + } + } else if (Array.isArray(value)) { + return formatArray(value, seenValues); + } + + return formatObject(value, seenValues); +} + +function isJSONable(value) { + return typeof value.toJSON === 'function'; +} + +function formatObject(object, seenValues) { + const entries = Object.entries(object); + + if (entries.length === 0) { + return '{}'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[' + getObjectTag(object) + ']'; + } + + const properties = entries.map( + ([key, value]) => key + ': ' + formatValue(value, seenValues), + ); + return '{ ' + properties.join(', ') + ' }'; +} + +function formatArray(array, seenValues) { + if (array.length === 0) { + return '[]'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[Array]'; + } + + const len = Math.min(MAX_ARRAY_LENGTH, array.length); + const remaining = array.length - len; + const items = []; + + for (let i = 0; i < len; ++i) { + items.push(formatValue(array[i], seenValues)); + } + + if (remaining === 1) { + items.push('... 1 more item'); + } else if (remaining > 1) { + items.push(`... ${remaining} more items`); + } + + return '[' + items.join(', ') + ']'; +} + +function getObjectTag(object) { + const tag = Object.prototype.toString + .call(object) + .replace(/^\[object /, '') + .replace(/]$/, ''); + + if (tag === 'Object' && typeof object.constructor === 'function') { + const name = object.constructor.name; + + if (typeof name === 'string' && name !== '') { + return name; + } + } + + return tag; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.d.ts new file mode 100644 index 0000000..1fca676 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.d.ts @@ -0,0 +1,16 @@ +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production + * See: https://webpack.js.org/guides/production/ + */ +export declare const instanceOf: ( + value: unknown, + constructor: Constructor, +) => boolean; +interface Constructor extends Function { + prototype: { + [Symbol.toStringTag]: string; + }; +} +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.js b/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.js new file mode 100644 index 0000000..f489a9a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.js @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.instanceOf = void 0; + +var _inspect = require('./inspect.js'); + +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production + * See: https://webpack.js.org/guides/production/ + */ +const instanceOf = + /* c8 ignore next 6 */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + globalThis.process && globalThis.process.env.NODE_ENV === 'production' + ? function instanceOf(value, constructor) { + return value instanceof constructor; + } + : function instanceOf(value, constructor) { + if (value instanceof constructor) { + return true; + } + + if (typeof value === 'object' && value !== null) { + var _value$constructor; + + // Prefer Symbol.toStringTag since it is immune to minification. + const className = constructor.prototype[Symbol.toStringTag]; + const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library. + Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009 + ? value[Symbol.toStringTag] + : (_value$constructor = value.constructor) === null || + _value$constructor === void 0 + ? void 0 + : _value$constructor.name; + + if (className === valueClassName) { + const stringifiedValue = (0, _inspect.inspect)(value); + throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm. + +Ensure that there is only one instance of "graphql" in the node_modules +directory. If different versions of "graphql" are the dependencies of other +relied on modules, use "resolutions" to ensure only one version is installed. + +https://yarnpkg.com/en/docs/selective-version-resolutions + +Duplicate "graphql" modules cannot be used at the same time since different +versions may have different capabilities and behavior. The data from one +version used in the function from another could produce confusing and +spurious results.`); + } + } + + return false; + }; +exports.instanceOf = instanceOf; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.mjs new file mode 100644 index 0000000..0f05267 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/instanceOf.mjs @@ -0,0 +1,52 @@ +import { inspect } from './inspect.mjs'; +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production + * See: https://webpack.js.org/guides/production/ + */ + +export const instanceOf = + /* c8 ignore next 6 */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + globalThis.process && globalThis.process.env.NODE_ENV === 'production' + ? function instanceOf(value, constructor) { + return value instanceof constructor; + } + : function instanceOf(value, constructor) { + if (value instanceof constructor) { + return true; + } + + if (typeof value === 'object' && value !== null) { + var _value$constructor; + + // Prefer Symbol.toStringTag since it is immune to minification. + const className = constructor.prototype[Symbol.toStringTag]; + const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library. + Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009 + ? value[Symbol.toStringTag] + : (_value$constructor = value.constructor) === null || + _value$constructor === void 0 + ? void 0 + : _value$constructor.name; + + if (className === valueClassName) { + const stringifiedValue = inspect(value); + throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm. + +Ensure that there is only one instance of "graphql" in the node_modules +directory. If different versions of "graphql" are the dependencies of other +relied on modules, use "resolutions" to ensure only one version is installed. + +https://yarnpkg.com/en/docs/selective-version-resolutions + +Duplicate "graphql" modules cannot be used at the same time since different +versions may have different capabilities and behavior. The data from one +version used in the function from another could produce confusing and +spurious results.`); + } + } + + return false; + }; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/invariant.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/invariant.d.ts new file mode 100644 index 0000000..db04500 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/invariant.d.ts @@ -0,0 +1,4 @@ +export declare function invariant( + condition: unknown, + message?: string, +): asserts condition; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/invariant.js b/graphql-subscription-express/node_modules/graphql/jsutils/invariant.js new file mode 100644 index 0000000..9e0cf5b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/invariant.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.invariant = invariant; + +function invariant(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error( + message != null ? message : 'Unexpected invariant triggered.', + ); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/invariant.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/invariant.mjs new file mode 100644 index 0000000..986cc47 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/invariant.mjs @@ -0,0 +1,9 @@ +export function invariant(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error( + message != null ? message : 'Unexpected invariant triggered.', + ); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.d.ts new file mode 100644 index 0000000..8cb226b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.d.ts @@ -0,0 +1,7 @@ +/** + * Returns true if the provided object implements the AsyncIterator protocol via + * implementing a `Symbol.asyncIterator` method. + */ +export declare function isAsyncIterable( + maybeAsyncIterable: any, +): maybeAsyncIterable is AsyncIterable; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.js b/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.js new file mode 100644 index 0000000..c608c0c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isAsyncIterable = isAsyncIterable; + +/** + * Returns true if the provided object implements the AsyncIterator protocol via + * implementing a `Symbol.asyncIterator` method. + */ +function isAsyncIterable(maybeAsyncIterable) { + return ( + typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 + ? void 0 + : maybeAsyncIterable[Symbol.asyncIterator]) === 'function' + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.mjs new file mode 100644 index 0000000..b55e3f0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isAsyncIterable.mjs @@ -0,0 +1,11 @@ +/** + * Returns true if the provided object implements the AsyncIterator protocol via + * implementing a `Symbol.asyncIterator` method. + */ +export function isAsyncIterable(maybeAsyncIterable) { + return ( + typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 + ? void 0 + : maybeAsyncIterable[Symbol.asyncIterator]) === 'function' + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.d.ts new file mode 100644 index 0000000..4fdce25 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.d.ts @@ -0,0 +1,20 @@ +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and implements the Iterator protocol. + * + * This may be used in place of [Array.isArray()][isArray] to determine if + * an object should be iterated-over e.g. Array, Map, Set, Int8Array, + * TypedArray, etc. but excludes string literals. + * + * @example + * ```ts + * isIterableObject([ 1, 2, 3 ]) // true + * isIterableObject(new Map()) // true + * isIterableObject('ABC') // false + * isIterableObject({ key: 'value' }) // false + * isIterableObject({ length: 1, 0: 'Alpha' }) // false + * ``` + */ +export declare function isIterableObject( + maybeIterable: any, +): maybeIterable is Iterable; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.js b/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.js new file mode 100644 index 0000000..33204cc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.js @@ -0,0 +1,32 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isIterableObject = isIterableObject; + +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and implements the Iterator protocol. + * + * This may be used in place of [Array.isArray()][isArray] to determine if + * an object should be iterated-over e.g. Array, Map, Set, Int8Array, + * TypedArray, etc. but excludes string literals. + * + * @example + * ```ts + * isIterableObject([ 1, 2, 3 ]) // true + * isIterableObject(new Map()) // true + * isIterableObject('ABC') // false + * isIterableObject({ key: 'value' }) // false + * isIterableObject({ length: 1, 0: 'Alpha' }) // false + * ``` + */ +function isIterableObject(maybeIterable) { + return ( + typeof maybeIterable === 'object' && + typeof (maybeIterable === null || maybeIterable === void 0 + ? void 0 + : maybeIterable[Symbol.iterator]) === 'function' + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.mjs new file mode 100644 index 0000000..92ca657 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isIterableObject.mjs @@ -0,0 +1,25 @@ +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and implements the Iterator protocol. + * + * This may be used in place of [Array.isArray()][isArray] to determine if + * an object should be iterated-over e.g. Array, Map, Set, Int8Array, + * TypedArray, etc. but excludes string literals. + * + * @example + * ```ts + * isIterableObject([ 1, 2, 3 ]) // true + * isIterableObject(new Map()) // true + * isIterableObject('ABC') // false + * isIterableObject({ key: 'value' }) // false + * isIterableObject({ length: 1, 0: 'Alpha' }) // false + * ``` + */ +export function isIterableObject(maybeIterable) { + return ( + typeof maybeIterable === 'object' && + typeof (maybeIterable === null || maybeIterable === void 0 + ? void 0 + : maybeIterable[Symbol.iterator]) === 'function' + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.d.ts new file mode 100644 index 0000000..3390639 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.d.ts @@ -0,0 +1,7 @@ +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +export declare function isObjectLike(value: unknown): value is { + [key: string]: unknown; +}; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.js b/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.js new file mode 100644 index 0000000..aeba023 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isObjectLike = isObjectLike; + +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +function isObjectLike(value) { + return typeof value == 'object' && value !== null; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.mjs new file mode 100644 index 0000000..96e7678 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isObjectLike.mjs @@ -0,0 +1,7 @@ +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +export function isObjectLike(value) { + return typeof value == 'object' && value !== null; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.d.ts new file mode 100644 index 0000000..786de26 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.d.ts @@ -0,0 +1,5 @@ +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +export declare function isPromise(value: any): value is Promise; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.js b/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.js new file mode 100644 index 0000000..715deed --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isPromise = isPromise; + +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +function isPromise(value) { + return ( + typeof (value === null || value === void 0 ? void 0 : value.then) === + 'function' + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.mjs new file mode 100644 index 0000000..02755c2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/isPromise.mjs @@ -0,0 +1,10 @@ +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +export function isPromise(value) { + return ( + typeof (value === null || value === void 0 ? void 0 : value.then) === + 'function' + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.d.ts new file mode 100644 index 0000000..9d0df47 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.d.ts @@ -0,0 +1,32 @@ +import type { ObjMap } from './ObjMap'; +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { + * // Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } + * // } + * + * const jennyEntry = entriesByName['Jenny'] + * + * // { name: 'Jenny', num: '857-6309' } + * ``` + */ +export declare function keyMap( + list: ReadonlyArray, + keyFn: (item: T) => string, +): ObjMap; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.js b/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.js new file mode 100644 index 0000000..f06476e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.keyMap = keyMap; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { + * // Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } + * // } + * + * const jennyEntry = entriesByName['Jenny'] + * + * // { name: 'Jenny', num: '857-6309' } + * ``` + */ +function keyMap(list, keyFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = item; + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.mjs new file mode 100644 index 0000000..56712f3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/keyMap.mjs @@ -0,0 +1,36 @@ +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { + * // Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } + * // } + * + * const jennyEntry = entriesByName['Jenny'] + * + * // { name: 'Jenny', num: '857-6309' } + * ``` + */ +export function keyMap(list, keyFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = item; + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.d.ts new file mode 100644 index 0000000..ed03a1a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.d.ts @@ -0,0 +1,23 @@ +import type { ObjMap } from './ObjMap'; +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * ``` + */ +export declare function keyValMap( + list: ReadonlyArray, + keyFn: (item: T) => string, + valFn: (item: T) => V, +): ObjMap; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.js b/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.js new file mode 100644 index 0000000..af724b0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.js @@ -0,0 +1,33 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.keyValMap = keyValMap; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * ``` + */ +function keyValMap(list, keyFn, valFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = valFn(item); + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.mjs new file mode 100644 index 0000000..9efe2ae --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/keyValMap.mjs @@ -0,0 +1,26 @@ +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * ``` + */ +export function keyValMap(list, keyFn, valFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = valFn(item); + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.d.ts new file mode 100644 index 0000000..c1a54d4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.d.ts @@ -0,0 +1,9 @@ +import type { ObjMap, ReadOnlyObjMap } from './ObjMap'; +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +export declare function mapValue( + map: ReadOnlyObjMap, + fn: (value: T, key: string) => V, +): ObjMap; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.js b/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.js new file mode 100644 index 0000000..98c9768 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.mapValue = mapValue; + +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +function mapValue(map, fn) { + const result = Object.create(null); + + for (const key of Object.keys(map)) { + result[key] = fn(map[key], key); + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.mjs new file mode 100644 index 0000000..c7e2a23 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/mapValue.mjs @@ -0,0 +1,13 @@ +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +export function mapValue(map, fn) { + const result = Object.create(null); + + for (const key of Object.keys(map)) { + result[key] = fn(map[key], key); + } + + return result; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.d.ts new file mode 100644 index 0000000..7e7e679 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.d.ts @@ -0,0 +1,9 @@ +/** + * Memoizes the provided three-argument function. + */ +export declare function memoize3< + A1 extends object, + A2 extends object, + A3 extends object, + R, +>(fn: (a1: A1, a2: A2, a3: A3) => R): (a1: A1, a2: A2, a3: A3) => R; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.js b/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.js new file mode 100644 index 0000000..c3b9ebc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.memoize3 = memoize3; + +/** + * Memoizes the provided three-argument function. + */ +function memoize3(fn) { + let cache0; + return function memoized(a1, a2, a3) { + if (cache0 === undefined) { + cache0 = new WeakMap(); + } + + let cache1 = cache0.get(a1); + + if (cache1 === undefined) { + cache1 = new WeakMap(); + cache0.set(a1, cache1); + } + + let cache2 = cache1.get(a2); + + if (cache2 === undefined) { + cache2 = new WeakMap(); + cache1.set(a2, cache2); + } + + let fnResult = cache2.get(a3); + + if (fnResult === undefined) { + fnResult = fn(a1, a2, a3); + cache2.set(a3, fnResult); + } + + return fnResult; + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.mjs new file mode 100644 index 0000000..89687f8 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/memoize3.mjs @@ -0,0 +1,34 @@ +/** + * Memoizes the provided three-argument function. + */ +export function memoize3(fn) { + let cache0; + return function memoized(a1, a2, a3) { + if (cache0 === undefined) { + cache0 = new WeakMap(); + } + + let cache1 = cache0.get(a1); + + if (cache1 === undefined) { + cache1 = new WeakMap(); + cache0.set(a1, cache1); + } + + let cache2 = cache1.get(a2); + + if (cache2 === undefined) { + cache2 = new WeakMap(); + cache1.set(a2, cache2); + } + + let fnResult = cache2.get(a3); + + if (fnResult === undefined) { + fnResult = fn(a1, a2, a3); + cache2.set(a3, fnResult); + } + + return fnResult; + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.d.ts new file mode 100644 index 0000000..9407779 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.d.ts @@ -0,0 +1,8 @@ +/** + * Returns a number indicating whether a reference string comes before, or after, + * or is the same as the given string in natural sort order. + * + * See: https://en.wikipedia.org/wiki/Natural_sort_order + * + */ +export declare function naturalCompare(aStr: string, bStr: string): number; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.js b/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.js new file mode 100644 index 0000000..f6385ae --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.naturalCompare = naturalCompare; + +/** + * Returns a number indicating whether a reference string comes before, or after, + * or is the same as the given string in natural sort order. + * + * See: https://en.wikipedia.org/wiki/Natural_sort_order + * + */ +function naturalCompare(aStr, bStr) { + let aIndex = 0; + let bIndex = 0; + + while (aIndex < aStr.length && bIndex < bStr.length) { + let aChar = aStr.charCodeAt(aIndex); + let bChar = bStr.charCodeAt(bIndex); + + if (isDigit(aChar) && isDigit(bChar)) { + let aNum = 0; + + do { + ++aIndex; + aNum = aNum * 10 + aChar - DIGIT_0; + aChar = aStr.charCodeAt(aIndex); + } while (isDigit(aChar) && aNum > 0); + + let bNum = 0; + + do { + ++bIndex; + bNum = bNum * 10 + bChar - DIGIT_0; + bChar = bStr.charCodeAt(bIndex); + } while (isDigit(bChar) && bNum > 0); + + if (aNum < bNum) { + return -1; + } + + if (aNum > bNum) { + return 1; + } + } else { + if (aChar < bChar) { + return -1; + } + + if (aChar > bChar) { + return 1; + } + + ++aIndex; + ++bIndex; + } + } + + return aStr.length - bStr.length; +} + +const DIGIT_0 = 48; +const DIGIT_9 = 57; + +function isDigit(code) { + return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.mjs new file mode 100644 index 0000000..e47a484 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/naturalCompare.mjs @@ -0,0 +1,61 @@ +/** + * Returns a number indicating whether a reference string comes before, or after, + * or is the same as the given string in natural sort order. + * + * See: https://en.wikipedia.org/wiki/Natural_sort_order + * + */ +export function naturalCompare(aStr, bStr) { + let aIndex = 0; + let bIndex = 0; + + while (aIndex < aStr.length && bIndex < bStr.length) { + let aChar = aStr.charCodeAt(aIndex); + let bChar = bStr.charCodeAt(bIndex); + + if (isDigit(aChar) && isDigit(bChar)) { + let aNum = 0; + + do { + ++aIndex; + aNum = aNum * 10 + aChar - DIGIT_0; + aChar = aStr.charCodeAt(aIndex); + } while (isDigit(aChar) && aNum > 0); + + let bNum = 0; + + do { + ++bIndex; + bNum = bNum * 10 + bChar - DIGIT_0; + bChar = bStr.charCodeAt(bIndex); + } while (isDigit(bChar) && bNum > 0); + + if (aNum < bNum) { + return -1; + } + + if (aNum > bNum) { + return 1; + } + } else { + if (aChar < bChar) { + return -1; + } + + if (aChar > bChar) { + return 1; + } + + ++aIndex; + ++bIndex; + } + } + + return aStr.length - bStr.length; +} +const DIGIT_0 = 48; +const DIGIT_9 = 57; + +function isDigit(code) { + return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.d.ts new file mode 100644 index 0000000..189d19e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.d.ts @@ -0,0 +1,6 @@ +/** + * Build a string describing the path. + */ +export declare function printPathArray( + path: ReadonlyArray, +): string; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.js b/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.js new file mode 100644 index 0000000..355af8e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printPathArray = printPathArray; + +/** + * Build a string describing the path. + */ +function printPathArray(path) { + return path + .map((key) => + typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key, + ) + .join(''); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.mjs new file mode 100644 index 0000000..4109212 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/printPathArray.mjs @@ -0,0 +1,10 @@ +/** + * Build a string describing the path. + */ +export function printPathArray(path) { + return path + .map((key) => + typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key, + ) + .join(''); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.d.ts new file mode 100644 index 0000000..8a682b1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.d.ts @@ -0,0 +1,11 @@ +import type { ObjMap } from './ObjMap'; +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +export declare function promiseForObject( + object: ObjMap>, +): Promise>; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.js b/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.js new file mode 100644 index 0000000..788a3e5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.promiseForObject = promiseForObject; + +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +function promiseForObject(object) { + return Promise.all(Object.values(object)).then((resolvedValues) => { + const resolvedObject = Object.create(null); + + for (const [i, key] of Object.keys(object).entries()) { + resolvedObject[key] = resolvedValues[i]; + } + + return resolvedObject; + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.mjs new file mode 100644 index 0000000..9d24cbd --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/promiseForObject.mjs @@ -0,0 +1,18 @@ +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +export function promiseForObject(object) { + return Promise.all(Object.values(object)).then((resolvedValues) => { + const resolvedObject = Object.create(null); + + for (const [i, key] of Object.keys(object).entries()) { + resolvedObject[key] = resolvedValues[i]; + } + + return resolvedObject; + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.d.ts new file mode 100644 index 0000000..cafdf41 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.d.ts @@ -0,0 +1,13 @@ +import type { PromiseOrValue } from './PromiseOrValue'; +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +export declare function promiseReduce( + values: Iterable, + callbackFn: (accumulator: U, currentValue: T) => PromiseOrValue, + initialValue: PromiseOrValue, +): PromiseOrValue; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.js b/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.js new file mode 100644 index 0000000..67c5c94 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.promiseReduce = promiseReduce; + +var _isPromise = require('./isPromise.js'); + +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +function promiseReduce(values, callbackFn, initialValue) { + let accumulator = initialValue; + + for (const value of values) { + accumulator = (0, _isPromise.isPromise)(accumulator) + ? accumulator.then((resolved) => callbackFn(resolved, value)) + : callbackFn(accumulator, value); + } + + return accumulator; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.mjs new file mode 100644 index 0000000..c9eeddf --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/promiseReduce.mjs @@ -0,0 +1,20 @@ +import { isPromise } from './isPromise.mjs'; + +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +export function promiseReduce(values, callbackFn, initialValue) { + let accumulator = initialValue; + + for (const value of values) { + accumulator = isPromise(accumulator) + ? accumulator.then((resolved) => callbackFn(resolved, value)) + : callbackFn(accumulator, value); + } + + return accumulator; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.d.ts new file mode 100644 index 0000000..d5d20ea --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.d.ts @@ -0,0 +1,8 @@ +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ +export declare function suggestionList( + input: string, + options: ReadonlyArray, +): Array; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.js b/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.js new file mode 100644 index 0000000..f2b83c7 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.js @@ -0,0 +1,139 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.suggestionList = suggestionList; + +var _naturalCompare = require('./naturalCompare.js'); + +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ +function suggestionList(input, options) { + const optionsByDistance = Object.create(null); + const lexicalDistance = new LexicalDistance(input); + const threshold = Math.floor(input.length * 0.4) + 1; + + for (const option of options) { + const distance = lexicalDistance.measure(option, threshold); + + if (distance !== undefined) { + optionsByDistance[option] = distance; + } + } + + return Object.keys(optionsByDistance).sort((a, b) => { + const distanceDiff = optionsByDistance[a] - optionsByDistance[b]; + return distanceDiff !== 0 + ? distanceDiff + : (0, _naturalCompare.naturalCompare)(a, b); + }); +} +/** + * Computes the lexical distance between strings A and B. + * + * The "distance" between two strings is given by counting the minimum number + * of edits needed to transform string A into string B. An edit can be an + * insertion, deletion, or substitution of a single character, or a swap of two + * adjacent characters. + * + * Includes a custom alteration from Damerau-Levenshtein to treat case changes + * as a single edit which helps identify mis-cased values with an edit distance + * of 1. + * + * This distance can be useful for detecting typos in input or sorting + */ + +class LexicalDistance { + constructor(input) { + this._input = input; + this._inputLowerCase = input.toLowerCase(); + this._inputArray = stringToArray(this._inputLowerCase); + this._rows = [ + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + ]; + } + + measure(option, threshold) { + if (this._input === option) { + return 0; + } + + const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit + + if (this._inputLowerCase === optionLowerCase) { + return 1; + } + + let a = stringToArray(optionLowerCase); + let b = this._inputArray; + + if (a.length < b.length) { + const tmp = a; + a = b; + b = tmp; + } + + const aLength = a.length; + const bLength = b.length; + + if (aLength - bLength > threshold) { + return undefined; + } + + const rows = this._rows; + + for (let j = 0; j <= bLength; j++) { + rows[0][j] = j; + } + + for (let i = 1; i <= aLength; i++) { + const upRow = rows[(i - 1) % 3]; + const currentRow = rows[i % 3]; + let smallestCell = (currentRow[0] = i); + + for (let j = 1; j <= bLength; j++) { + const cost = a[i - 1] === b[j - 1] ? 0 : 1; + let currentCell = Math.min( + upRow[j] + 1, // delete + currentRow[j - 1] + 1, // insert + upRow[j - 1] + cost, // substitute + ); + + if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { + // transposition + const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; + currentCell = Math.min(currentCell, doubleDiagonalCell + 1); + } + + if (currentCell < smallestCell) { + smallestCell = currentCell; + } + + currentRow[j] = currentCell; + } // Early exit, since distance can't go smaller than smallest element of the previous row. + + if (smallestCell > threshold) { + return undefined; + } + } + + const distance = rows[aLength % 3][bLength]; + return distance <= threshold ? distance : undefined; + } +} + +function stringToArray(str) { + const strLength = str.length; + const array = new Array(strLength); + + for (let i = 0; i < strLength; ++i) { + array[i] = str.charCodeAt(i); + } + + return array; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.mjs new file mode 100644 index 0000000..c3dba2e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/suggestionList.mjs @@ -0,0 +1,130 @@ +import { naturalCompare } from './naturalCompare.mjs'; +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ + +export function suggestionList(input, options) { + const optionsByDistance = Object.create(null); + const lexicalDistance = new LexicalDistance(input); + const threshold = Math.floor(input.length * 0.4) + 1; + + for (const option of options) { + const distance = lexicalDistance.measure(option, threshold); + + if (distance !== undefined) { + optionsByDistance[option] = distance; + } + } + + return Object.keys(optionsByDistance).sort((a, b) => { + const distanceDiff = optionsByDistance[a] - optionsByDistance[b]; + return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b); + }); +} +/** + * Computes the lexical distance between strings A and B. + * + * The "distance" between two strings is given by counting the minimum number + * of edits needed to transform string A into string B. An edit can be an + * insertion, deletion, or substitution of a single character, or a swap of two + * adjacent characters. + * + * Includes a custom alteration from Damerau-Levenshtein to treat case changes + * as a single edit which helps identify mis-cased values with an edit distance + * of 1. + * + * This distance can be useful for detecting typos in input or sorting + */ + +class LexicalDistance { + constructor(input) { + this._input = input; + this._inputLowerCase = input.toLowerCase(); + this._inputArray = stringToArray(this._inputLowerCase); + this._rows = [ + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + ]; + } + + measure(option, threshold) { + if (this._input === option) { + return 0; + } + + const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit + + if (this._inputLowerCase === optionLowerCase) { + return 1; + } + + let a = stringToArray(optionLowerCase); + let b = this._inputArray; + + if (a.length < b.length) { + const tmp = a; + a = b; + b = tmp; + } + + const aLength = a.length; + const bLength = b.length; + + if (aLength - bLength > threshold) { + return undefined; + } + + const rows = this._rows; + + for (let j = 0; j <= bLength; j++) { + rows[0][j] = j; + } + + for (let i = 1; i <= aLength; i++) { + const upRow = rows[(i - 1) % 3]; + const currentRow = rows[i % 3]; + let smallestCell = (currentRow[0] = i); + + for (let j = 1; j <= bLength; j++) { + const cost = a[i - 1] === b[j - 1] ? 0 : 1; + let currentCell = Math.min( + upRow[j] + 1, // delete + currentRow[j - 1] + 1, // insert + upRow[j - 1] + cost, // substitute + ); + + if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { + // transposition + const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; + currentCell = Math.min(currentCell, doubleDiagonalCell + 1); + } + + if (currentCell < smallestCell) { + smallestCell = currentCell; + } + + currentRow[j] = currentCell; + } // Early exit, since distance can't go smaller than smallest element of the previous row. + + if (smallestCell > threshold) { + return undefined; + } + } + + const distance = rows[aLength % 3][bLength]; + return distance <= threshold ? distance : undefined; + } +} + +function stringToArray(str) { + const strLength = str.length; + const array = new Array(strLength); + + for (let i = 0; i < strLength; ++i) { + array[i] = str.charCodeAt(i); + } + + return array; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/toError.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/toError.d.ts new file mode 100644 index 0000000..f9c3729 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/toError.d.ts @@ -0,0 +1,4 @@ +/** + * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + */ +export declare function toError(thrownValue: unknown): Error; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/toError.js b/graphql-subscription-express/node_modules/graphql/jsutils/toError.js new file mode 100644 index 0000000..8a41830 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/toError.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.toError = toError; + +var _inspect = require('./inspect.js'); + +/** + * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + */ +function toError(thrownValue) { + return thrownValue instanceof Error + ? thrownValue + : new NonErrorThrown(thrownValue); +} + +class NonErrorThrown extends Error { + constructor(thrownValue) { + super('Unexpected error value: ' + (0, _inspect.inspect)(thrownValue)); + this.name = 'NonErrorThrown'; + this.thrownValue = thrownValue; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/toError.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/toError.mjs new file mode 100644 index 0000000..55173ba --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/toError.mjs @@ -0,0 +1,18 @@ +import { inspect } from './inspect.mjs'; +/** + * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + */ + +export function toError(thrownValue) { + return thrownValue instanceof Error + ? thrownValue + : new NonErrorThrown(thrownValue); +} + +class NonErrorThrown extends Error { + constructor(thrownValue) { + super('Unexpected error value: ' + inspect(thrownValue)); + this.name = 'NonErrorThrown'; + this.thrownValue = thrownValue; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.d.ts b/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.d.ts new file mode 100644 index 0000000..457a1ec --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.d.ts @@ -0,0 +1,5 @@ +import type { Maybe } from './Maybe'; +import type { ReadOnlyObjMap, ReadOnlyObjMapLike } from './ObjMap'; +export declare function toObjMap( + obj: Maybe>, +): ReadOnlyObjMap; diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.js b/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.js new file mode 100644 index 0000000..95b42ed --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.toObjMap = toObjMap; + +function toObjMap(obj) { + if (obj == null) { + return Object.create(null); + } + + if (Object.getPrototypeOf(obj) === null) { + return obj; + } + + const map = Object.create(null); + + for (const [key, value] of Object.entries(obj)) { + map[key] = value; + } + + return map; +} diff --git a/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.mjs b/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.mjs new file mode 100644 index 0000000..61a8284 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/jsutils/toObjMap.mjs @@ -0,0 +1,17 @@ +export function toObjMap(obj) { + if (obj == null) { + return Object.create(null); + } + + if (Object.getPrototypeOf(obj) === null) { + return obj; + } + + const map = Object.create(null); + + for (const [key, value] of Object.entries(obj)) { + map[key] = value; + } + + return map; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/ast.d.ts b/graphql-subscription-express/node_modules/graphql/language/ast.d.ts new file mode 100644 index 0000000..7acf626 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/ast.d.ts @@ -0,0 +1,537 @@ +import type { Kind } from './kinds'; +import type { Source } from './source'; +import type { TokenKind } from './tokenKind'; +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +export declare class Location { + /** + * The character offset at which this Node begins. + */ + readonly start: number; + /** + * The character offset at which this Node ends. + */ + readonly end: number; + /** + * The Token at which this Node begins. + */ + readonly startToken: Token; + /** + * The Token at which this Node ends. + */ + readonly endToken: Token; + /** + * The Source document the AST represents. + */ + readonly source: Source; + constructor(startToken: Token, endToken: Token, source: Source); + get [Symbol.toStringTag](): string; + toJSON(): { + start: number; + end: number; + }; +} +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ +export declare class Token { + /** + * The kind of Token. + */ + readonly kind: TokenKind; + /** + * The character offset at which this Node begins. + */ + readonly start: number; + /** + * The character offset at which this Node ends. + */ + readonly end: number; + /** + * The 1-indexed line number on which this Token appears. + */ + readonly line: number; + /** + * The 1-indexed column number at which this Token begins. + */ + readonly column: number; + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + readonly value: string; + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + readonly prev: Token | null; + readonly next: Token | null; + constructor( + kind: TokenKind, + start: number, + end: number, + line: number, + column: number, + value?: string, + ); + get [Symbol.toStringTag](): string; + toJSON(): { + kind: TokenKind; + value?: string; + line: number; + column: number; + }; +} +/** + * The list of all possible AST node types. + */ +export declare type ASTNode = + | NameNode + | DocumentNode + | OperationDefinitionNode + | VariableDefinitionNode + | VariableNode + | SelectionSetNode + | FieldNode + | ArgumentNode + | FragmentSpreadNode + | InlineFragmentNode + | FragmentDefinitionNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode + | ObjectFieldNode + | DirectiveNode + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode + | SchemaDefinitionNode + | OperationTypeDefinitionNode + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | EnumValueDefinitionNode + | InputObjectTypeDefinitionNode + | DirectiveDefinitionNode + | SchemaExtensionNode + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; +/** + * Utility type listing all nodes indexed by their kind. + */ +export declare type ASTKindToNode = { + [NodeT in ASTNode as NodeT['kind']]: NodeT; +}; +/** + * @internal + */ +export declare const QueryDocumentKeys: { + [NodeT in ASTNode as NodeT['kind']]: ReadonlyArray; +}; +/** + * @internal + */ +export declare function isNode(maybeNode: any): maybeNode is ASTNode; +/** Name */ +export interface NameNode { + readonly kind: Kind.NAME; + readonly loc?: Location; + readonly value: string; +} +/** Document */ +export interface DocumentNode { + readonly kind: Kind.DOCUMENT; + readonly loc?: Location; + readonly definitions: ReadonlyArray; +} +export declare type DefinitionNode = + | ExecutableDefinitionNode + | TypeSystemDefinitionNode + | TypeSystemExtensionNode; +export declare type ExecutableDefinitionNode = + | OperationDefinitionNode + | FragmentDefinitionNode; +export interface OperationDefinitionNode { + readonly kind: Kind.OPERATION_DEFINITION; + readonly loc?: Location; + readonly operation: OperationTypeNode; + readonly name?: NameNode; + readonly variableDefinitions?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} +declare enum OperationTypeNode { + QUERY = 'query', + MUTATION = 'mutation', + SUBSCRIPTION = 'subscription', +} +export { OperationTypeNode }; +export interface VariableDefinitionNode { + readonly kind: Kind.VARIABLE_DEFINITION; + readonly loc?: Location; + readonly variable: VariableNode; + readonly type: TypeNode; + readonly defaultValue?: ConstValueNode; + readonly directives?: ReadonlyArray; +} +export interface VariableNode { + readonly kind: Kind.VARIABLE; + readonly loc?: Location; + readonly name: NameNode; +} +export interface SelectionSetNode { + kind: Kind.SELECTION_SET; + loc?: Location; + selections: ReadonlyArray; +} +export declare type SelectionNode = + | FieldNode + | FragmentSpreadNode + | InlineFragmentNode; +export interface FieldNode { + readonly kind: Kind.FIELD; + readonly loc?: Location; + readonly alias?: NameNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly selectionSet?: SelectionSetNode; +} +export interface ArgumentNode { + readonly kind: Kind.ARGUMENT; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ValueNode; +} +export interface ConstArgumentNode { + readonly kind: Kind.ARGUMENT; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ConstValueNode; +} +/** Fragments */ +export interface FragmentSpreadNode { + readonly kind: Kind.FRAGMENT_SPREAD; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface InlineFragmentNode { + readonly kind: Kind.INLINE_FRAGMENT; + readonly loc?: Location; + readonly typeCondition?: NamedTypeNode; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} +export interface FragmentDefinitionNode { + readonly kind: Kind.FRAGMENT_DEFINITION; + readonly loc?: Location; + readonly name: NameNode; + /** @deprecated variableDefinitions will be removed in v17.0.0 */ + readonly variableDefinitions?: ReadonlyArray; + readonly typeCondition: NamedTypeNode; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} +/** Values */ +export declare type ValueNode = + | VariableNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode; +export declare type ConstValueNode = + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ConstListValueNode + | ConstObjectValueNode; +export interface IntValueNode { + readonly kind: Kind.INT; + readonly loc?: Location; + readonly value: string; +} +export interface FloatValueNode { + readonly kind: Kind.FLOAT; + readonly loc?: Location; + readonly value: string; +} +export interface StringValueNode { + readonly kind: Kind.STRING; + readonly loc?: Location; + readonly value: string; + readonly block?: boolean; +} +export interface BooleanValueNode { + readonly kind: Kind.BOOLEAN; + readonly loc?: Location; + readonly value: boolean; +} +export interface NullValueNode { + readonly kind: Kind.NULL; + readonly loc?: Location; +} +export interface EnumValueNode { + readonly kind: Kind.ENUM; + readonly loc?: Location; + readonly value: string; +} +export interface ListValueNode { + readonly kind: Kind.LIST; + readonly loc?: Location; + readonly values: ReadonlyArray; +} +export interface ConstListValueNode { + readonly kind: Kind.LIST; + readonly loc?: Location; + readonly values: ReadonlyArray; +} +export interface ObjectValueNode { + readonly kind: Kind.OBJECT; + readonly loc?: Location; + readonly fields: ReadonlyArray; +} +export interface ConstObjectValueNode { + readonly kind: Kind.OBJECT; + readonly loc?: Location; + readonly fields: ReadonlyArray; +} +export interface ObjectFieldNode { + readonly kind: Kind.OBJECT_FIELD; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ValueNode; +} +export interface ConstObjectFieldNode { + readonly kind: Kind.OBJECT_FIELD; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ConstValueNode; +} +/** Directives */ +export interface DirectiveNode { + readonly kind: Kind.DIRECTIVE; + readonly loc?: Location; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; +} +export interface ConstDirectiveNode { + readonly kind: Kind.DIRECTIVE; + readonly loc?: Location; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; +} +/** Type Reference */ +export declare type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; +export interface NamedTypeNode { + readonly kind: Kind.NAMED_TYPE; + readonly loc?: Location; + readonly name: NameNode; +} +export interface ListTypeNode { + readonly kind: Kind.LIST_TYPE; + readonly loc?: Location; + readonly type: TypeNode; +} +export interface NonNullTypeNode { + readonly kind: Kind.NON_NULL_TYPE; + readonly loc?: Location; + readonly type: NamedTypeNode | ListTypeNode; +} +/** Type System Definition */ +export declare type TypeSystemDefinitionNode = + | SchemaDefinitionNode + | TypeDefinitionNode + | DirectiveDefinitionNode; +export interface SchemaDefinitionNode { + readonly kind: Kind.SCHEMA_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly directives?: ReadonlyArray; + readonly operationTypes: ReadonlyArray; +} +export interface OperationTypeDefinitionNode { + readonly kind: Kind.OPERATION_TYPE_DEFINITION; + readonly loc?: Location; + readonly operation: OperationTypeNode; + readonly type: NamedTypeNode; +} +/** Type Definition */ +export declare type TypeDefinitionNode = + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | InputObjectTypeDefinitionNode; +export interface ScalarTypeDefinitionNode { + readonly kind: Kind.SCALAR_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface ObjectTypeDefinitionNode { + readonly kind: Kind.OBJECT_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface FieldDefinitionNode { + readonly kind: Kind.FIELD_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly type: TypeNode; + readonly directives?: ReadonlyArray; +} +export interface InputValueDefinitionNode { + readonly kind: Kind.INPUT_VALUE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly type: TypeNode; + readonly defaultValue?: ConstValueNode; + readonly directives?: ReadonlyArray; +} +export interface InterfaceTypeDefinitionNode { + readonly kind: Kind.INTERFACE_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface UnionTypeDefinitionNode { + readonly kind: Kind.UNION_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly types?: ReadonlyArray; +} +export interface EnumTypeDefinitionNode { + readonly kind: Kind.ENUM_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly values?: ReadonlyArray; +} +export interface EnumValueDefinitionNode { + readonly kind: Kind.ENUM_VALUE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface InputObjectTypeDefinitionNode { + readonly kind: Kind.INPUT_OBJECT_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +/** Directive Definitions */ +export interface DirectiveDefinitionNode { + readonly kind: Kind.DIRECTIVE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly repeatable: boolean; + readonly locations: ReadonlyArray; +} +/** Type System Extensions */ +export declare type TypeSystemExtensionNode = + | SchemaExtensionNode + | TypeExtensionNode; +export interface SchemaExtensionNode { + readonly kind: Kind.SCHEMA_EXTENSION; + readonly loc?: Location; + readonly directives?: ReadonlyArray; + readonly operationTypes?: ReadonlyArray; +} +/** Type Extensions */ +export declare type TypeExtensionNode = + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; +export interface ScalarTypeExtensionNode { + readonly kind: Kind.SCALAR_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface ObjectTypeExtensionNode { + readonly kind: Kind.OBJECT_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface InterfaceTypeExtensionNode { + readonly kind: Kind.INTERFACE_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface UnionTypeExtensionNode { + readonly kind: Kind.UNION_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly types?: ReadonlyArray; +} +export interface EnumTypeExtensionNode { + readonly kind: Kind.ENUM_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly values?: ReadonlyArray; +} +export interface InputObjectTypeExtensionNode { + readonly kind: Kind.INPUT_OBJECT_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/ast.js b/graphql-subscription-express/node_modules/graphql/language/ast.js new file mode 100644 index 0000000..eb3bac1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/ast.js @@ -0,0 +1,224 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Token = + exports.QueryDocumentKeys = + exports.OperationTypeNode = + exports.Location = + void 0; +exports.isNode = isNode; + +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +class Location { + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The Token at which this Node begins. + */ + + /** + * The Token at which this Node ends. + */ + + /** + * The Source document the AST represents. + */ + constructor(startToken, endToken, source) { + this.start = startToken.start; + this.end = endToken.end; + this.startToken = startToken; + this.endToken = endToken; + this.source = source; + } + + get [Symbol.toStringTag]() { + return 'Location'; + } + + toJSON() { + return { + start: this.start, + end: this.end, + }; + } +} +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ + +exports.Location = Location; + +class Token { + /** + * The kind of Token. + */ + + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The 1-indexed line number on which this Token appears. + */ + + /** + * The 1-indexed column number at which this Token begins. + */ + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + constructor(kind, start, end, line, column, value) { + this.kind = kind; + this.start = start; + this.end = end; + this.line = line; + this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + this.value = value; + this.prev = null; + this.next = null; + } + + get [Symbol.toStringTag]() { + return 'Token'; + } + + toJSON() { + return { + kind: this.kind, + value: this.value, + line: this.line, + column: this.column, + }; + } +} +/** + * The list of all possible AST node types. + */ + +exports.Token = Token; + +/** + * @internal + */ +const QueryDocumentKeys = { + Name: [], + Document: ['definitions'], + OperationDefinition: [ + 'name', + 'variableDefinitions', + 'directives', + 'selectionSet', + ], + VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], + Variable: ['name'], + SelectionSet: ['selections'], + Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], + Argument: ['name', 'value'], + FragmentSpread: ['name', 'directives'], + InlineFragment: ['typeCondition', 'directives', 'selectionSet'], + FragmentDefinition: [ + 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0 + 'variableDefinitions', + 'typeCondition', + 'directives', + 'selectionSet', + ], + IntValue: [], + FloatValue: [], + StringValue: [], + BooleanValue: [], + NullValue: [], + EnumValue: [], + ListValue: ['values'], + ObjectValue: ['fields'], + ObjectField: ['name', 'value'], + Directive: ['name', 'arguments'], + NamedType: ['name'], + ListType: ['type'], + NonNullType: ['type'], + SchemaDefinition: ['description', 'directives', 'operationTypes'], + OperationTypeDefinition: ['type'], + ScalarTypeDefinition: ['description', 'name', 'directives'], + ObjectTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], + InputValueDefinition: [ + 'description', + 'name', + 'type', + 'defaultValue', + 'directives', + ], + InterfaceTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + UnionTypeDefinition: ['description', 'name', 'directives', 'types'], + EnumTypeDefinition: ['description', 'name', 'directives', 'values'], + EnumValueDefinition: ['description', 'name', 'directives'], + InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], + DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], + SchemaExtension: ['directives', 'operationTypes'], + ScalarTypeExtension: ['name', 'directives'], + ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + UnionTypeExtension: ['name', 'directives', 'types'], + EnumTypeExtension: ['name', 'directives', 'values'], + InputObjectTypeExtension: ['name', 'directives', 'fields'], +}; +exports.QueryDocumentKeys = QueryDocumentKeys; +const kindValues = new Set(Object.keys(QueryDocumentKeys)); +/** + * @internal + */ + +function isNode(maybeNode) { + const maybeKind = + maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind; + return typeof maybeKind === 'string' && kindValues.has(maybeKind); +} +/** Name */ + +var OperationTypeNode; +exports.OperationTypeNode = OperationTypeNode; + +(function (OperationTypeNode) { + OperationTypeNode['QUERY'] = 'query'; + OperationTypeNode['MUTATION'] = 'mutation'; + OperationTypeNode['SUBSCRIPTION'] = 'subscription'; +})(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {})); diff --git a/graphql-subscription-express/node_modules/graphql/language/ast.mjs b/graphql-subscription-express/node_modules/graphql/language/ast.mjs new file mode 100644 index 0000000..d6d9ef2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/ast.mjs @@ -0,0 +1,208 @@ +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +export class Location { + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The Token at which this Node begins. + */ + + /** + * The Token at which this Node ends. + */ + + /** + * The Source document the AST represents. + */ + constructor(startToken, endToken, source) { + this.start = startToken.start; + this.end = endToken.end; + this.startToken = startToken; + this.endToken = endToken; + this.source = source; + } + + get [Symbol.toStringTag]() { + return 'Location'; + } + + toJSON() { + return { + start: this.start, + end: this.end, + }; + } +} +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ + +export class Token { + /** + * The kind of Token. + */ + + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The 1-indexed line number on which this Token appears. + */ + + /** + * The 1-indexed column number at which this Token begins. + */ + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + constructor(kind, start, end, line, column, value) { + this.kind = kind; + this.start = start; + this.end = end; + this.line = line; + this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + this.value = value; + this.prev = null; + this.next = null; + } + + get [Symbol.toStringTag]() { + return 'Token'; + } + + toJSON() { + return { + kind: this.kind, + value: this.value, + line: this.line, + column: this.column, + }; + } +} +/** + * The list of all possible AST node types. + */ + +/** + * @internal + */ +export const QueryDocumentKeys = { + Name: [], + Document: ['definitions'], + OperationDefinition: [ + 'name', + 'variableDefinitions', + 'directives', + 'selectionSet', + ], + VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], + Variable: ['name'], + SelectionSet: ['selections'], + Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], + Argument: ['name', 'value'], + FragmentSpread: ['name', 'directives'], + InlineFragment: ['typeCondition', 'directives', 'selectionSet'], + FragmentDefinition: [ + 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0 + 'variableDefinitions', + 'typeCondition', + 'directives', + 'selectionSet', + ], + IntValue: [], + FloatValue: [], + StringValue: [], + BooleanValue: [], + NullValue: [], + EnumValue: [], + ListValue: ['values'], + ObjectValue: ['fields'], + ObjectField: ['name', 'value'], + Directive: ['name', 'arguments'], + NamedType: ['name'], + ListType: ['type'], + NonNullType: ['type'], + SchemaDefinition: ['description', 'directives', 'operationTypes'], + OperationTypeDefinition: ['type'], + ScalarTypeDefinition: ['description', 'name', 'directives'], + ObjectTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], + InputValueDefinition: [ + 'description', + 'name', + 'type', + 'defaultValue', + 'directives', + ], + InterfaceTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + UnionTypeDefinition: ['description', 'name', 'directives', 'types'], + EnumTypeDefinition: ['description', 'name', 'directives', 'values'], + EnumValueDefinition: ['description', 'name', 'directives'], + InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], + DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], + SchemaExtension: ['directives', 'operationTypes'], + ScalarTypeExtension: ['name', 'directives'], + ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + UnionTypeExtension: ['name', 'directives', 'types'], + EnumTypeExtension: ['name', 'directives', 'values'], + InputObjectTypeExtension: ['name', 'directives', 'fields'], +}; +const kindValues = new Set(Object.keys(QueryDocumentKeys)); +/** + * @internal + */ + +export function isNode(maybeNode) { + const maybeKind = + maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind; + return typeof maybeKind === 'string' && kindValues.has(maybeKind); +} +/** Name */ + +var OperationTypeNode; + +(function (OperationTypeNode) { + OperationTypeNode['QUERY'] = 'query'; + OperationTypeNode['MUTATION'] = 'mutation'; + OperationTypeNode['SUBSCRIPTION'] = 'subscription'; +})(OperationTypeNode || (OperationTypeNode = {})); + +export { OperationTypeNode }; diff --git a/graphql-subscription-express/node_modules/graphql/language/blockString.d.ts b/graphql-subscription-express/node_modules/graphql/language/blockString.d.ts new file mode 100644 index 0000000..8441d8b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/blockString.d.ts @@ -0,0 +1,28 @@ +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ +export declare function dedentBlockStringLines( + lines: ReadonlyArray, +): Array; +/** + * @internal + */ +export declare function isPrintableAsBlockString(value: string): boolean; +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ +export declare function printBlockString( + value: string, + options?: { + minimize?: boolean; + }, +): string; diff --git a/graphql-subscription-express/node_modules/graphql/language/blockString.js b/graphql-subscription-express/node_modules/graphql/language/blockString.js new file mode 100644 index 0000000..a3f1ea8 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/blockString.js @@ -0,0 +1,195 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.dedentBlockStringLines = dedentBlockStringLines; +exports.isPrintableAsBlockString = isPrintableAsBlockString; +exports.printBlockString = printBlockString; + +var _characterClasses = require('./characterClasses.js'); + +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ +function dedentBlockStringLines(lines) { + var _firstNonEmptyLine2; + + let commonIndent = Number.MAX_SAFE_INTEGER; + let firstNonEmptyLine = null; + let lastNonEmptyLine = -1; + + for (let i = 0; i < lines.length; ++i) { + var _firstNonEmptyLine; + + const line = lines[i]; + const indent = leadingWhitespace(line); + + if (indent === line.length) { + continue; // skip empty lines + } + + firstNonEmptyLine = + (_firstNonEmptyLine = firstNonEmptyLine) !== null && + _firstNonEmptyLine !== void 0 + ? _firstNonEmptyLine + : i; + lastNonEmptyLine = i; + + if (i !== 0 && indent < commonIndent) { + commonIndent = indent; + } + } + + return lines // Remove common indentation from all lines but first. + .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines. + .slice( + (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && + _firstNonEmptyLine2 !== void 0 + ? _firstNonEmptyLine2 + : 0, + lastNonEmptyLine + 1, + ); +} + +function leadingWhitespace(str) { + let i = 0; + + while ( + i < str.length && + (0, _characterClasses.isWhiteSpace)(str.charCodeAt(i)) + ) { + ++i; + } + + return i; +} +/** + * @internal + */ + +function isPrintableAsBlockString(value) { + if (value === '') { + return true; // empty string is printable + } + + let isEmptyLine = true; + let hasIndent = false; + let hasCommonIndent = true; + let seenNonEmptyLine = false; + + for (let i = 0; i < value.length; ++i) { + switch (value.codePointAt(i)) { + case 0x0000: + case 0x0001: + case 0x0002: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + case 0x0008: + case 0x000b: + case 0x000c: + case 0x000e: + case 0x000f: + return false; + // Has non-printable characters + + case 0x000d: + // \r + return false; + // Has \r or \r\n which will be replaced as \n + + case 10: + // \n + if (isEmptyLine && !seenNonEmptyLine) { + return false; // Has leading new line + } + + seenNonEmptyLine = true; + isEmptyLine = true; + hasIndent = false; + break; + + case 9: // \t + + case 32: + // + hasIndent || (hasIndent = isEmptyLine); + break; + + default: + hasCommonIndent && (hasCommonIndent = hasIndent); + isEmptyLine = false; + } + } + + if (isEmptyLine) { + return false; // Has trailing empty lines + } + + if (hasCommonIndent && seenNonEmptyLine) { + return false; // Has internal indent + } + + return true; +} +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ + +function printBlockString(value, options) { + const escapedValue = value.replace(/"""/g, '\\"""'); // Expand a block string's raw value into independent lines. + + const lines = escapedValue.split(/\r\n|[\n\r]/g); + const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line + + const forceLeadingNewLine = + lines.length > 1 && + lines + .slice(1) + .every( + (line) => + line.length === 0 || + (0, _characterClasses.isWhiteSpace)(line.charCodeAt(0)), + ); // Trailing triple quotes just looks confusing but doesn't force trailing new line + + const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); // Trailing quote (single or double) or slash forces trailing new line + + const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; + const hasTrailingSlash = value.endsWith('\\'); + const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; + const printAsMultipleLines = + !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability + (!isSingleLine || + value.length > 70 || + forceTrailingNewline || + forceLeadingNewLine || + hasTrailingTripleQuotes); + let result = ''; // Format a multi-line block quote to account for leading space. + + const skipLeadingNewLine = + isSingleLine && (0, _characterClasses.isWhiteSpace)(value.charCodeAt(0)); + + if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) { + result += '\n'; + } + + result += escapedValue; + + if (printAsMultipleLines || forceTrailingNewline) { + result += '\n'; + } + + return '"""' + result + '"""'; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/blockString.mjs b/graphql-subscription-express/node_modules/graphql/language/blockString.mjs new file mode 100644 index 0000000..e050d7f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/blockString.mjs @@ -0,0 +1,178 @@ +import { isWhiteSpace } from './characterClasses.mjs'; +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ + +export function dedentBlockStringLines(lines) { + var _firstNonEmptyLine2; + + let commonIndent = Number.MAX_SAFE_INTEGER; + let firstNonEmptyLine = null; + let lastNonEmptyLine = -1; + + for (let i = 0; i < lines.length; ++i) { + var _firstNonEmptyLine; + + const line = lines[i]; + const indent = leadingWhitespace(line); + + if (indent === line.length) { + continue; // skip empty lines + } + + firstNonEmptyLine = + (_firstNonEmptyLine = firstNonEmptyLine) !== null && + _firstNonEmptyLine !== void 0 + ? _firstNonEmptyLine + : i; + lastNonEmptyLine = i; + + if (i !== 0 && indent < commonIndent) { + commonIndent = indent; + } + } + + return lines // Remove common indentation from all lines but first. + .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines. + .slice( + (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && + _firstNonEmptyLine2 !== void 0 + ? _firstNonEmptyLine2 + : 0, + lastNonEmptyLine + 1, + ); +} + +function leadingWhitespace(str) { + let i = 0; + + while (i < str.length && isWhiteSpace(str.charCodeAt(i))) { + ++i; + } + + return i; +} +/** + * @internal + */ + +export function isPrintableAsBlockString(value) { + if (value === '') { + return true; // empty string is printable + } + + let isEmptyLine = true; + let hasIndent = false; + let hasCommonIndent = true; + let seenNonEmptyLine = false; + + for (let i = 0; i < value.length; ++i) { + switch (value.codePointAt(i)) { + case 0x0000: + case 0x0001: + case 0x0002: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + case 0x0008: + case 0x000b: + case 0x000c: + case 0x000e: + case 0x000f: + return false; + // Has non-printable characters + + case 0x000d: + // \r + return false; + // Has \r or \r\n which will be replaced as \n + + case 10: + // \n + if (isEmptyLine && !seenNonEmptyLine) { + return false; // Has leading new line + } + + seenNonEmptyLine = true; + isEmptyLine = true; + hasIndent = false; + break; + + case 9: // \t + + case 32: + // + hasIndent || (hasIndent = isEmptyLine); + break; + + default: + hasCommonIndent && (hasCommonIndent = hasIndent); + isEmptyLine = false; + } + } + + if (isEmptyLine) { + return false; // Has trailing empty lines + } + + if (hasCommonIndent && seenNonEmptyLine) { + return false; // Has internal indent + } + + return true; +} +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ + +export function printBlockString(value, options) { + const escapedValue = value.replace(/"""/g, '\\"""'); // Expand a block string's raw value into independent lines. + + const lines = escapedValue.split(/\r\n|[\n\r]/g); + const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line + + const forceLeadingNewLine = + lines.length > 1 && + lines + .slice(1) + .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line + + const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); // Trailing quote (single or double) or slash forces trailing new line + + const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; + const hasTrailingSlash = value.endsWith('\\'); + const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; + const printAsMultipleLines = + !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability + (!isSingleLine || + value.length > 70 || + forceTrailingNewline || + forceLeadingNewLine || + hasTrailingTripleQuotes); + let result = ''; // Format a multi-line block quote to account for leading space. + + const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0)); + + if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) { + result += '\n'; + } + + result += escapedValue; + + if (printAsMultipleLines || forceTrailingNewline) { + result += '\n'; + } + + return '"""' + result + '"""'; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/characterClasses.d.ts b/graphql-subscription-express/node_modules/graphql/language/characterClasses.d.ts new file mode 100644 index 0000000..1e5da8a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/characterClasses.d.ts @@ -0,0 +1,47 @@ +/** + * ``` + * WhiteSpace :: + * - "Horizontal Tab (U+0009)" + * - "Space (U+0020)" + * ``` + * @internal + */ +export declare function isWhiteSpace(code: number): boolean; +/** + * ``` + * Digit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * ``` + * @internal + */ +export declare function isDigit(code: number): boolean; +/** + * ``` + * Letter :: one of + * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` + * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` + * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` + * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` + * ``` + * @internal + */ +export declare function isLetter(code: number): boolean; +/** + * ``` + * NameStart :: + * - Letter + * - `_` + * ``` + * @internal + */ +export declare function isNameStart(code: number): boolean; +/** + * ``` + * NameContinue :: + * - Letter + * - Digit + * - `_` + * ``` + * @internal + */ +export declare function isNameContinue(code: number): boolean; diff --git a/graphql-subscription-express/node_modules/graphql/language/characterClasses.js b/graphql-subscription-express/node_modules/graphql/language/characterClasses.js new file mode 100644 index 0000000..075f740 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/characterClasses.js @@ -0,0 +1,75 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isDigit = isDigit; +exports.isLetter = isLetter; +exports.isNameContinue = isNameContinue; +exports.isNameStart = isNameStart; +exports.isWhiteSpace = isWhiteSpace; + +/** + * ``` + * WhiteSpace :: + * - "Horizontal Tab (U+0009)" + * - "Space (U+0020)" + * ``` + * @internal + */ +function isWhiteSpace(code) { + return code === 0x0009 || code === 0x0020; +} +/** + * ``` + * Digit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * ``` + * @internal + */ + +function isDigit(code) { + return code >= 0x0030 && code <= 0x0039; +} +/** + * ``` + * Letter :: one of + * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` + * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` + * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` + * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` + * ``` + * @internal + */ + +function isLetter(code) { + return ( + (code >= 0x0061 && code <= 0x007a) || // A-Z + (code >= 0x0041 && code <= 0x005a) // a-z + ); +} +/** + * ``` + * NameStart :: + * - Letter + * - `_` + * ``` + * @internal + */ + +function isNameStart(code) { + return isLetter(code) || code === 0x005f; +} +/** + * ``` + * NameContinue :: + * - Letter + * - Digit + * - `_` + * ``` + * @internal + */ + +function isNameContinue(code) { + return isLetter(code) || isDigit(code) || code === 0x005f; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/characterClasses.mjs b/graphql-subscription-express/node_modules/graphql/language/characterClasses.mjs new file mode 100644 index 0000000..c75777a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/characterClasses.mjs @@ -0,0 +1,64 @@ +/** + * ``` + * WhiteSpace :: + * - "Horizontal Tab (U+0009)" + * - "Space (U+0020)" + * ``` + * @internal + */ +export function isWhiteSpace(code) { + return code === 0x0009 || code === 0x0020; +} +/** + * ``` + * Digit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * ``` + * @internal + */ + +export function isDigit(code) { + return code >= 0x0030 && code <= 0x0039; +} +/** + * ``` + * Letter :: one of + * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` + * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` + * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` + * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` + * ``` + * @internal + */ + +export function isLetter(code) { + return ( + (code >= 0x0061 && code <= 0x007a) || // A-Z + (code >= 0x0041 && code <= 0x005a) // a-z + ); +} +/** + * ``` + * NameStart :: + * - Letter + * - `_` + * ``` + * @internal + */ + +export function isNameStart(code) { + return isLetter(code) || code === 0x005f; +} +/** + * ``` + * NameContinue :: + * - Letter + * - Digit + * - `_` + * ``` + * @internal + */ + +export function isNameContinue(code) { + return isLetter(code) || isDigit(code) || code === 0x005f; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/directiveLocation.d.ts b/graphql-subscription-express/node_modules/graphql/language/directiveLocation.d.ts new file mode 100644 index 0000000..73d944f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/directiveLocation.d.ts @@ -0,0 +1,33 @@ +/** + * The set of allowed directive location values. + */ +declare enum DirectiveLocation { + /** Request Definitions */ + QUERY = 'QUERY', + MUTATION = 'MUTATION', + SUBSCRIPTION = 'SUBSCRIPTION', + FIELD = 'FIELD', + FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION', + FRAGMENT_SPREAD = 'FRAGMENT_SPREAD', + INLINE_FRAGMENT = 'INLINE_FRAGMENT', + VARIABLE_DEFINITION = 'VARIABLE_DEFINITION', + /** Type System Definitions */ + SCHEMA = 'SCHEMA', + SCALAR = 'SCALAR', + OBJECT = 'OBJECT', + FIELD_DEFINITION = 'FIELD_DEFINITION', + ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION', + INTERFACE = 'INTERFACE', + UNION = 'UNION', + ENUM = 'ENUM', + ENUM_VALUE = 'ENUM_VALUE', + INPUT_OBJECT = 'INPUT_OBJECT', + INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION', +} +export { DirectiveLocation }; +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ +export declare type DirectiveLocationEnum = typeof DirectiveLocation; diff --git a/graphql-subscription-express/node_modules/graphql/language/directiveLocation.js b/graphql-subscription-express/node_modules/graphql/language/directiveLocation.js new file mode 100644 index 0000000..beff283 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/directiveLocation.js @@ -0,0 +1,39 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.DirectiveLocation = void 0; + +/** + * The set of allowed directive location values. + */ +var DirectiveLocation; +exports.DirectiveLocation = DirectiveLocation; + +(function (DirectiveLocation) { + DirectiveLocation['QUERY'] = 'QUERY'; + DirectiveLocation['MUTATION'] = 'MUTATION'; + DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION'; + DirectiveLocation['FIELD'] = 'FIELD'; + DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION'; + DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD'; + DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT'; + DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION'; + DirectiveLocation['SCHEMA'] = 'SCHEMA'; + DirectiveLocation['SCALAR'] = 'SCALAR'; + DirectiveLocation['OBJECT'] = 'OBJECT'; + DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION'; + DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION'; + DirectiveLocation['INTERFACE'] = 'INTERFACE'; + DirectiveLocation['UNION'] = 'UNION'; + DirectiveLocation['ENUM'] = 'ENUM'; + DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE'; + DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT'; + DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION'; +})(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {})); +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ diff --git a/graphql-subscription-express/node_modules/graphql/language/directiveLocation.mjs b/graphql-subscription-express/node_modules/graphql/language/directiveLocation.mjs new file mode 100644 index 0000000..31bfbb1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/directiveLocation.mjs @@ -0,0 +1,33 @@ +/** + * The set of allowed directive location values. + */ +var DirectiveLocation; + +(function (DirectiveLocation) { + DirectiveLocation['QUERY'] = 'QUERY'; + DirectiveLocation['MUTATION'] = 'MUTATION'; + DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION'; + DirectiveLocation['FIELD'] = 'FIELD'; + DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION'; + DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD'; + DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT'; + DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION'; + DirectiveLocation['SCHEMA'] = 'SCHEMA'; + DirectiveLocation['SCALAR'] = 'SCALAR'; + DirectiveLocation['OBJECT'] = 'OBJECT'; + DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION'; + DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION'; + DirectiveLocation['INTERFACE'] = 'INTERFACE'; + DirectiveLocation['UNION'] = 'UNION'; + DirectiveLocation['ENUM'] = 'ENUM'; + DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE'; + DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT'; + DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION'; +})(DirectiveLocation || (DirectiveLocation = {})); + +export { DirectiveLocation }; +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ diff --git a/graphql-subscription-express/node_modules/graphql/language/index.d.ts b/graphql-subscription-express/node_modules/graphql/language/index.d.ts new file mode 100644 index 0000000..93d9529 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/index.d.ts @@ -0,0 +1,97 @@ +export { Source } from './source'; +export { getLocation } from './location'; +export type { SourceLocation } from './location'; +export { printLocation, printSourceLocation } from './printLocation'; +export { Kind } from './kinds'; +export type { KindEnum } from './kinds'; +export { TokenKind } from './tokenKind'; +export type { TokenKindEnum } from './tokenKind'; +export { Lexer } from './lexer'; +export { parse, parseValue, parseConstValue, parseType } from './parser'; +export type { ParseOptions } from './parser'; +export { print } from './printer'; +export { + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, +} from './visitor'; +export type { ASTVisitor, ASTVisitFn, ASTVisitorKeyMap } from './visitor'; +export { Location, Token, OperationTypeNode } from './ast'; +export type { + ASTNode, + ASTKindToNode, + NameNode, + DocumentNode, + DefinitionNode, + ExecutableDefinitionNode, + OperationDefinitionNode, + VariableDefinitionNode, + VariableNode, + SelectionSetNode, + SelectionNode, + FieldNode, + ArgumentNode, + ConstArgumentNode, + FragmentSpreadNode, + InlineFragmentNode, + FragmentDefinitionNode, + ValueNode, + ConstValueNode, + IntValueNode, + FloatValueNode, + StringValueNode, + BooleanValueNode, + NullValueNode, + EnumValueNode, + ListValueNode, + ConstListValueNode, + ObjectValueNode, + ConstObjectValueNode, + ObjectFieldNode, + ConstObjectFieldNode, + DirectiveNode, + ConstDirectiveNode, + TypeNode, + NamedTypeNode, + ListTypeNode, + NonNullTypeNode, + TypeSystemDefinitionNode, + SchemaDefinitionNode, + OperationTypeDefinitionNode, + TypeDefinitionNode, + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + DirectiveDefinitionNode, + TypeSystemExtensionNode, + SchemaExtensionNode, + TypeExtensionNode, + ScalarTypeExtensionNode, + ObjectTypeExtensionNode, + InterfaceTypeExtensionNode, + UnionTypeExtensionNode, + EnumTypeExtensionNode, + InputObjectTypeExtensionNode, +} from './ast'; +export { + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './predicates'; +export { DirectiveLocation } from './directiveLocation'; +export type { DirectiveLocationEnum } from './directiveLocation'; diff --git a/graphql-subscription-express/node_modules/graphql/language/index.js b/graphql-subscription-express/node_modules/graphql/language/index.js new file mode 100644 index 0000000..b597925 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/index.js @@ -0,0 +1,215 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'BREAK', { + enumerable: true, + get: function () { + return _visitor.BREAK; + }, +}); +Object.defineProperty(exports, 'DirectiveLocation', { + enumerable: true, + get: function () { + return _directiveLocation.DirectiveLocation; + }, +}); +Object.defineProperty(exports, 'Kind', { + enumerable: true, + get: function () { + return _kinds.Kind; + }, +}); +Object.defineProperty(exports, 'Lexer', { + enumerable: true, + get: function () { + return _lexer.Lexer; + }, +}); +Object.defineProperty(exports, 'Location', { + enumerable: true, + get: function () { + return _ast.Location; + }, +}); +Object.defineProperty(exports, 'OperationTypeNode', { + enumerable: true, + get: function () { + return _ast.OperationTypeNode; + }, +}); +Object.defineProperty(exports, 'Source', { + enumerable: true, + get: function () { + return _source.Source; + }, +}); +Object.defineProperty(exports, 'Token', { + enumerable: true, + get: function () { + return _ast.Token; + }, +}); +Object.defineProperty(exports, 'TokenKind', { + enumerable: true, + get: function () { + return _tokenKind.TokenKind; + }, +}); +Object.defineProperty(exports, 'getEnterLeaveForKind', { + enumerable: true, + get: function () { + return _visitor.getEnterLeaveForKind; + }, +}); +Object.defineProperty(exports, 'getLocation', { + enumerable: true, + get: function () { + return _location.getLocation; + }, +}); +Object.defineProperty(exports, 'getVisitFn', { + enumerable: true, + get: function () { + return _visitor.getVisitFn; + }, +}); +Object.defineProperty(exports, 'isConstValueNode', { + enumerable: true, + get: function () { + return _predicates.isConstValueNode; + }, +}); +Object.defineProperty(exports, 'isDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isExecutableDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isExecutableDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isSelectionNode', { + enumerable: true, + get: function () { + return _predicates.isSelectionNode; + }, +}); +Object.defineProperty(exports, 'isTypeDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeExtensionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeExtensionNode; + }, +}); +Object.defineProperty(exports, 'isTypeNode', { + enumerable: true, + get: function () { + return _predicates.isTypeNode; + }, +}); +Object.defineProperty(exports, 'isTypeSystemDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeSystemDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeSystemExtensionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeSystemExtensionNode; + }, +}); +Object.defineProperty(exports, 'isValueNode', { + enumerable: true, + get: function () { + return _predicates.isValueNode; + }, +}); +Object.defineProperty(exports, 'parse', { + enumerable: true, + get: function () { + return _parser.parse; + }, +}); +Object.defineProperty(exports, 'parseConstValue', { + enumerable: true, + get: function () { + return _parser.parseConstValue; + }, +}); +Object.defineProperty(exports, 'parseType', { + enumerable: true, + get: function () { + return _parser.parseType; + }, +}); +Object.defineProperty(exports, 'parseValue', { + enumerable: true, + get: function () { + return _parser.parseValue; + }, +}); +Object.defineProperty(exports, 'print', { + enumerable: true, + get: function () { + return _printer.print; + }, +}); +Object.defineProperty(exports, 'printLocation', { + enumerable: true, + get: function () { + return _printLocation.printLocation; + }, +}); +Object.defineProperty(exports, 'printSourceLocation', { + enumerable: true, + get: function () { + return _printLocation.printSourceLocation; + }, +}); +Object.defineProperty(exports, 'visit', { + enumerable: true, + get: function () { + return _visitor.visit; + }, +}); +Object.defineProperty(exports, 'visitInParallel', { + enumerable: true, + get: function () { + return _visitor.visitInParallel; + }, +}); + +var _source = require('./source.js'); + +var _location = require('./location.js'); + +var _printLocation = require('./printLocation.js'); + +var _kinds = require('./kinds.js'); + +var _tokenKind = require('./tokenKind.js'); + +var _lexer = require('./lexer.js'); + +var _parser = require('./parser.js'); + +var _printer = require('./printer.js'); + +var _visitor = require('./visitor.js'); + +var _ast = require('./ast.js'); + +var _predicates = require('./predicates.js'); + +var _directiveLocation = require('./directiveLocation.js'); diff --git a/graphql-subscription-express/node_modules/graphql/language/index.mjs b/graphql-subscription-express/node_modules/graphql/language/index.mjs new file mode 100644 index 0000000..3f23c6c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/index.mjs @@ -0,0 +1,29 @@ +export { Source } from './source.mjs'; +export { getLocation } from './location.mjs'; +export { printLocation, printSourceLocation } from './printLocation.mjs'; +export { Kind } from './kinds.mjs'; +export { TokenKind } from './tokenKind.mjs'; +export { Lexer } from './lexer.mjs'; +export { parse, parseValue, parseConstValue, parseType } from './parser.mjs'; +export { print } from './printer.mjs'; +export { + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, +} from './visitor.mjs'; +export { Location, Token, OperationTypeNode } from './ast.mjs'; +export { + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './predicates.mjs'; +export { DirectiveLocation } from './directiveLocation.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/language/kinds.d.ts b/graphql-subscription-express/node_modules/graphql/language/kinds.d.ts new file mode 100644 index 0000000..6848fa7 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/kinds.d.ts @@ -0,0 +1,66 @@ +/** + * The set of allowed kind values for AST nodes. + */ +declare enum Kind { + /** Name */ + NAME = 'Name', + /** Document */ + DOCUMENT = 'Document', + OPERATION_DEFINITION = 'OperationDefinition', + VARIABLE_DEFINITION = 'VariableDefinition', + SELECTION_SET = 'SelectionSet', + FIELD = 'Field', + ARGUMENT = 'Argument', + /** Fragments */ + FRAGMENT_SPREAD = 'FragmentSpread', + INLINE_FRAGMENT = 'InlineFragment', + FRAGMENT_DEFINITION = 'FragmentDefinition', + /** Values */ + VARIABLE = 'Variable', + INT = 'IntValue', + FLOAT = 'FloatValue', + STRING = 'StringValue', + BOOLEAN = 'BooleanValue', + NULL = 'NullValue', + ENUM = 'EnumValue', + LIST = 'ListValue', + OBJECT = 'ObjectValue', + OBJECT_FIELD = 'ObjectField', + /** Directives */ + DIRECTIVE = 'Directive', + /** Types */ + NAMED_TYPE = 'NamedType', + LIST_TYPE = 'ListType', + NON_NULL_TYPE = 'NonNullType', + /** Type System Definitions */ + SCHEMA_DEFINITION = 'SchemaDefinition', + OPERATION_TYPE_DEFINITION = 'OperationTypeDefinition', + /** Type Definitions */ + SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition', + OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition', + FIELD_DEFINITION = 'FieldDefinition', + INPUT_VALUE_DEFINITION = 'InputValueDefinition', + INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition', + UNION_TYPE_DEFINITION = 'UnionTypeDefinition', + ENUM_TYPE_DEFINITION = 'EnumTypeDefinition', + ENUM_VALUE_DEFINITION = 'EnumValueDefinition', + INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition', + /** Directive Definitions */ + DIRECTIVE_DEFINITION = 'DirectiveDefinition', + /** Type System Extensions */ + SCHEMA_EXTENSION = 'SchemaExtension', + /** Type Extensions */ + SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension', + OBJECT_TYPE_EXTENSION = 'ObjectTypeExtension', + INTERFACE_TYPE_EXTENSION = 'InterfaceTypeExtension', + UNION_TYPE_EXTENSION = 'UnionTypeExtension', + ENUM_TYPE_EXTENSION = 'EnumTypeExtension', + INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension', +} +export { Kind }; +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ +export declare type KindEnum = typeof Kind; diff --git a/graphql-subscription-express/node_modules/graphql/language/kinds.js b/graphql-subscription-express/node_modules/graphql/language/kinds.js new file mode 100644 index 0000000..6423403 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/kinds.js @@ -0,0 +1,63 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Kind = void 0; + +/** + * The set of allowed kind values for AST nodes. + */ +var Kind; +exports.Kind = Kind; + +(function (Kind) { + Kind['NAME'] = 'Name'; + Kind['DOCUMENT'] = 'Document'; + Kind['OPERATION_DEFINITION'] = 'OperationDefinition'; + Kind['VARIABLE_DEFINITION'] = 'VariableDefinition'; + Kind['SELECTION_SET'] = 'SelectionSet'; + Kind['FIELD'] = 'Field'; + Kind['ARGUMENT'] = 'Argument'; + Kind['FRAGMENT_SPREAD'] = 'FragmentSpread'; + Kind['INLINE_FRAGMENT'] = 'InlineFragment'; + Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition'; + Kind['VARIABLE'] = 'Variable'; + Kind['INT'] = 'IntValue'; + Kind['FLOAT'] = 'FloatValue'; + Kind['STRING'] = 'StringValue'; + Kind['BOOLEAN'] = 'BooleanValue'; + Kind['NULL'] = 'NullValue'; + Kind['ENUM'] = 'EnumValue'; + Kind['LIST'] = 'ListValue'; + Kind['OBJECT'] = 'ObjectValue'; + Kind['OBJECT_FIELD'] = 'ObjectField'; + Kind['DIRECTIVE'] = 'Directive'; + Kind['NAMED_TYPE'] = 'NamedType'; + Kind['LIST_TYPE'] = 'ListType'; + Kind['NON_NULL_TYPE'] = 'NonNullType'; + Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition'; + Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition'; + Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition'; + Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition'; + Kind['FIELD_DEFINITION'] = 'FieldDefinition'; + Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition'; + Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition'; + Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition'; + Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition'; + Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition'; + Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition'; + Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition'; + Kind['SCHEMA_EXTENSION'] = 'SchemaExtension'; + Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension'; + Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension'; + Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension'; + Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension'; + Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension'; + Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension'; +})(Kind || (exports.Kind = Kind = {})); +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ diff --git a/graphql-subscription-express/node_modules/graphql/language/kinds.mjs b/graphql-subscription-express/node_modules/graphql/language/kinds.mjs new file mode 100644 index 0000000..3205eae --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/kinds.mjs @@ -0,0 +1,57 @@ +/** + * The set of allowed kind values for AST nodes. + */ +var Kind; + +(function (Kind) { + Kind['NAME'] = 'Name'; + Kind['DOCUMENT'] = 'Document'; + Kind['OPERATION_DEFINITION'] = 'OperationDefinition'; + Kind['VARIABLE_DEFINITION'] = 'VariableDefinition'; + Kind['SELECTION_SET'] = 'SelectionSet'; + Kind['FIELD'] = 'Field'; + Kind['ARGUMENT'] = 'Argument'; + Kind['FRAGMENT_SPREAD'] = 'FragmentSpread'; + Kind['INLINE_FRAGMENT'] = 'InlineFragment'; + Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition'; + Kind['VARIABLE'] = 'Variable'; + Kind['INT'] = 'IntValue'; + Kind['FLOAT'] = 'FloatValue'; + Kind['STRING'] = 'StringValue'; + Kind['BOOLEAN'] = 'BooleanValue'; + Kind['NULL'] = 'NullValue'; + Kind['ENUM'] = 'EnumValue'; + Kind['LIST'] = 'ListValue'; + Kind['OBJECT'] = 'ObjectValue'; + Kind['OBJECT_FIELD'] = 'ObjectField'; + Kind['DIRECTIVE'] = 'Directive'; + Kind['NAMED_TYPE'] = 'NamedType'; + Kind['LIST_TYPE'] = 'ListType'; + Kind['NON_NULL_TYPE'] = 'NonNullType'; + Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition'; + Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition'; + Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition'; + Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition'; + Kind['FIELD_DEFINITION'] = 'FieldDefinition'; + Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition'; + Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition'; + Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition'; + Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition'; + Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition'; + Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition'; + Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition'; + Kind['SCHEMA_EXTENSION'] = 'SchemaExtension'; + Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension'; + Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension'; + Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension'; + Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension'; + Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension'; + Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension'; +})(Kind || (Kind = {})); + +export { Kind }; +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ diff --git a/graphql-subscription-express/node_modules/graphql/language/lexer.d.ts b/graphql-subscription-express/node_modules/graphql/language/lexer.d.ts new file mode 100644 index 0000000..14abf38 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/lexer.d.ts @@ -0,0 +1,45 @@ +import { Token } from './ast'; +import type { Source } from './source'; +import { TokenKind } from './tokenKind'; +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ +export declare class Lexer { + source: Source; + /** + * The previously focused non-ignored token. + */ + lastToken: Token; + /** + * The currently focused non-ignored token. + */ + token: Token; + /** + * The (1-indexed) line containing the current token. + */ + line: number; + /** + * The character offset at which the current line begins. + */ + lineStart: number; + constructor(source: Source); + get [Symbol.toStringTag](): string; + /** + * Advances the token stream to the next non-ignored token. + */ + advance(): Token; + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + lookahead(): Token; +} +/** + * @internal + */ +export declare function isPunctuatorTokenKind(kind: TokenKind): boolean; diff --git a/graphql-subscription-express/node_modules/graphql/language/lexer.js b/graphql-subscription-express/node_modules/graphql/language/lexer.js new file mode 100644 index 0000000..08cea79 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/lexer.js @@ -0,0 +1,1006 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Lexer = void 0; +exports.isPunctuatorTokenKind = isPunctuatorTokenKind; + +var _syntaxError = require('../error/syntaxError.js'); + +var _ast = require('./ast.js'); + +var _blockString = require('./blockString.js'); + +var _characterClasses = require('./characterClasses.js'); + +var _tokenKind = require('./tokenKind.js'); + +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ +class Lexer { + /** + * The previously focused non-ignored token. + */ + + /** + * The currently focused non-ignored token. + */ + + /** + * The (1-indexed) line containing the current token. + */ + + /** + * The character offset at which the current line begins. + */ + constructor(source) { + const startOfFileToken = new _ast.Token( + _tokenKind.TokenKind.SOF, + 0, + 0, + 0, + 0, + ); + this.source = source; + this.lastToken = startOfFileToken; + this.token = startOfFileToken; + this.line = 1; + this.lineStart = 0; + } + + get [Symbol.toStringTag]() { + return 'Lexer'; + } + /** + * Advances the token stream to the next non-ignored token. + */ + + advance() { + this.lastToken = this.token; + const token = (this.token = this.lookahead()); + return token; + } + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + + lookahead() { + let token = this.token; + + if (token.kind !== _tokenKind.TokenKind.EOF) { + do { + if (token.next) { + token = token.next; + } else { + // Read the next token and form a link in the token linked-list. + const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing. + + token.next = nextToken; // @ts-expect-error prev is only mutable during parsing. + + nextToken.prev = token; + token = nextToken; + } + } while (token.kind === _tokenKind.TokenKind.COMMENT); + } + + return token; + } +} +/** + * @internal + */ + +exports.Lexer = Lexer; + +function isPunctuatorTokenKind(kind) { + return ( + kind === _tokenKind.TokenKind.BANG || + kind === _tokenKind.TokenKind.DOLLAR || + kind === _tokenKind.TokenKind.AMP || + kind === _tokenKind.TokenKind.PAREN_L || + kind === _tokenKind.TokenKind.PAREN_R || + kind === _tokenKind.TokenKind.SPREAD || + kind === _tokenKind.TokenKind.COLON || + kind === _tokenKind.TokenKind.EQUALS || + kind === _tokenKind.TokenKind.AT || + kind === _tokenKind.TokenKind.BRACKET_L || + kind === _tokenKind.TokenKind.BRACKET_R || + kind === _tokenKind.TokenKind.BRACE_L || + kind === _tokenKind.TokenKind.PIPE || + kind === _tokenKind.TokenKind.BRACE_R + ); +} +/** + * A Unicode scalar value is any Unicode code point except surrogate code + * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and + * 0xE000 to 0x10FFFF. + * + * SourceCharacter :: + * - "Any Unicode scalar value" + */ + +function isUnicodeScalarValue(code) { + return ( + (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff) + ); +} +/** + * The GraphQL specification defines source text as a sequence of unicode scalar + * values (which Unicode defines to exclude surrogate code points). However + * JavaScript defines strings as a sequence of UTF-16 code units which may + * include surrogates. A surrogate pair is a valid source character as it + * encodes a supplementary code point (above U+FFFF), but unpaired surrogate + * code points are not valid source characters. + */ + +function isSupplementaryCodePoint(body, location) { + return ( + isLeadingSurrogate(body.charCodeAt(location)) && + isTrailingSurrogate(body.charCodeAt(location + 1)) + ); +} + +function isLeadingSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} + +function isTrailingSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +/** + * Prints the code point (or end of file reference) at a given location in a + * source for use in error messages. + * + * Printable ASCII is printed quoted, while other points are printed in Unicode + * code point form (ie. U+1234). + */ + +function printCodePointAt(lexer, location) { + const code = lexer.source.body.codePointAt(location); + + if (code === undefined) { + return _tokenKind.TokenKind.EOF; + } else if (code >= 0x0020 && code <= 0x007e) { + // Printable ASCII + const char = String.fromCodePoint(code); + return char === '"' ? "'\"'" : `"${char}"`; + } // Unicode code point + + return 'U+' + code.toString(16).toUpperCase().padStart(4, '0'); +} +/** + * Create a token with line and column location information. + */ + +function createToken(lexer, kind, start, end, value) { + const line = lexer.line; + const col = 1 + start - lexer.lineStart; + return new _ast.Token(kind, start, end, line, col, value); +} +/** + * Gets the next token from the source starting at the given position. + * + * This skips over whitespace until it finds the next lexable token, then lexes + * punctuators immediately or calls the appropriate helper function for more + * complicated tokens. + */ + +function readNextToken(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // SourceCharacter + + switch (code) { + // Ignored :: + // - UnicodeBOM + // - WhiteSpace + // - LineTerminator + // - Comment + // - Comma + // + // UnicodeBOM :: "Byte Order Mark (U+FEFF)" + // + // WhiteSpace :: + // - "Horizontal Tab (U+0009)" + // - "Space (U+0020)" + // + // Comma :: , + case 0xfeff: // + + case 0x0009: // \t + + case 0x0020: // + + case 0x002c: + // , + ++position; + continue; + // LineTerminator :: + // - "New Line (U+000A)" + // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] + // - "Carriage Return (U+000D)" "New Line (U+000A)" + + case 0x000a: + // \n + ++position; + ++lexer.line; + lexer.lineStart = position; + continue; + + case 0x000d: + // \r + if (body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + ++lexer.line; + lexer.lineStart = position; + continue; + // Comment + + case 0x0023: + // # + return readComment(lexer, position); + // Token :: + // - Punctuator + // - Name + // - IntValue + // - FloatValue + // - StringValue + // + // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } + + case 0x0021: + // ! + return createToken( + lexer, + _tokenKind.TokenKind.BANG, + position, + position + 1, + ); + + case 0x0024: + // $ + return createToken( + lexer, + _tokenKind.TokenKind.DOLLAR, + position, + position + 1, + ); + + case 0x0026: + // & + return createToken( + lexer, + _tokenKind.TokenKind.AMP, + position, + position + 1, + ); + + case 0x0028: + // ( + return createToken( + lexer, + _tokenKind.TokenKind.PAREN_L, + position, + position + 1, + ); + + case 0x0029: + // ) + return createToken( + lexer, + _tokenKind.TokenKind.PAREN_R, + position, + position + 1, + ); + + case 0x002e: + // . + if ( + body.charCodeAt(position + 1) === 0x002e && + body.charCodeAt(position + 2) === 0x002e + ) { + return createToken( + lexer, + _tokenKind.TokenKind.SPREAD, + position, + position + 3, + ); + } + + break; + + case 0x003a: + // : + return createToken( + lexer, + _tokenKind.TokenKind.COLON, + position, + position + 1, + ); + + case 0x003d: + // = + return createToken( + lexer, + _tokenKind.TokenKind.EQUALS, + position, + position + 1, + ); + + case 0x0040: + // @ + return createToken( + lexer, + _tokenKind.TokenKind.AT, + position, + position + 1, + ); + + case 0x005b: + // [ + return createToken( + lexer, + _tokenKind.TokenKind.BRACKET_L, + position, + position + 1, + ); + + case 0x005d: + // ] + return createToken( + lexer, + _tokenKind.TokenKind.BRACKET_R, + position, + position + 1, + ); + + case 0x007b: + // { + return createToken( + lexer, + _tokenKind.TokenKind.BRACE_L, + position, + position + 1, + ); + + case 0x007c: + // | + return createToken( + lexer, + _tokenKind.TokenKind.PIPE, + position, + position + 1, + ); + + case 0x007d: + // } + return createToken( + lexer, + _tokenKind.TokenKind.BRACE_R, + position, + position + 1, + ); + // StringValue + + case 0x0022: + // " + if ( + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + return readBlockString(lexer, position); + } + + return readString(lexer, position); + } // IntValue | FloatValue (Digit | -) + + if ((0, _characterClasses.isDigit)(code) || code === 0x002d) { + return readNumber(lexer, position, code); + } // Name + + if ((0, _characterClasses.isNameStart)(code)) { + return readName(lexer, position); + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + code === 0x0027 + ? 'Unexpected single quote character (\'), did you mean to use a double quote (")?' + : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) + ? `Unexpected character: ${printCodePointAt(lexer, position)}.` + : `Invalid character: ${printCodePointAt(lexer, position)}.`, + ); + } + + return createToken(lexer, _tokenKind.TokenKind.EOF, bodyLength, bodyLength); +} +/** + * Reads a comment token from the source file. + * + * ``` + * Comment :: # CommentChar* [lookahead != CommentChar] + * + * CommentChar :: SourceCharacter but not LineTerminator + * ``` + */ + +function readComment(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + break; + } + } + + return createToken( + lexer, + _tokenKind.TokenKind.COMMENT, + start, + position, + body.slice(start + 1, position), + ); +} +/** + * Reads a number token from the source file, either a FloatValue or an IntValue + * depending on whether a FractionalPart or ExponentPart is encountered. + * + * ``` + * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}] + * + * IntegerPart :: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit Digit* + * + * NegativeSign :: - + * + * NonZeroDigit :: Digit but not `0` + * + * FloatValue :: + * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * + * FractionalPart :: . Digit+ + * + * ExponentPart :: ExponentIndicator Sign? Digit+ + * + * ExponentIndicator :: one of `e` `E` + * + * Sign :: one of + - + * ``` + */ + +function readNumber(lexer, start, firstCode) { + const body = lexer.source.body; + let position = start; + let code = firstCode; + let isFloat = false; // NegativeSign (-) + + if (code === 0x002d) { + code = body.charCodeAt(++position); + } // Zero (0) + + if (code === 0x0030) { + code = body.charCodeAt(++position); + + if ((0, _characterClasses.isDigit)(code)) { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid number, unexpected digit after 0: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } else { + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Full stop (.) + + if (code === 0x002e) { + isFloat = true; + code = body.charCodeAt(++position); + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // E e + + if (code === 0x0045 || code === 0x0065) { + isFloat = true; + code = body.charCodeAt(++position); // + - + + if (code === 0x002b || code === 0x002d) { + code = body.charCodeAt(++position); + } + + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Numbers cannot be followed by . or NameStart + + if (code === 0x002e || (0, _characterClasses.isNameStart)(code)) { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + + return createToken( + lexer, + isFloat ? _tokenKind.TokenKind.FLOAT : _tokenKind.TokenKind.INT, + start, + position, + body.slice(start, position), + ); +} +/** + * Returns the new position in the source after reading one or more digits. + */ + +function readDigits(lexer, start, firstCode) { + if (!(0, _characterClasses.isDigit)(firstCode)) { + throw (0, _syntaxError.syntaxError)( + lexer.source, + start, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + start, + )}.`, + ); + } + + const body = lexer.source.body; + let position = start + 1; // +1 to skip first firstCode + + while ((0, _characterClasses.isDigit)(body.charCodeAt(position))) { + ++position; + } + + return position; +} +/** + * Reads a single-quote string token from the source file. + * + * ``` + * StringValue :: + * - `""` [lookahead != `"`] + * - `"` StringCharacter+ `"` + * + * StringCharacter :: + * - SourceCharacter but not `"` or `\` or LineTerminator + * - `\u` EscapedUnicode + * - `\` EscapedCharacter + * + * EscapedUnicode :: + * - `{` HexDigit+ `}` + * - HexDigit HexDigit HexDigit HexDigit + * + * EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t` + * ``` + */ + +function readString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + let chunkStart = position; + let value = ''; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Quote (") + + if (code === 0x0022) { + value += body.slice(chunkStart, position); + return createToken( + lexer, + _tokenKind.TokenKind.STRING, + start, + position + 1, + value, + ); + } // Escape Sequence (\) + + if (code === 0x005c) { + value += body.slice(chunkStart, position); + const escape = + body.charCodeAt(position + 1) === 0x0075 // u + ? body.charCodeAt(position + 2) === 0x007b // { + ? readEscapedUnicodeVariableWidth(lexer, position) + : readEscapedUnicodeFixedWidth(lexer, position) + : readEscapedCharacter(lexer, position); + value += escape.value; + position += escape.size; + chunkStart = position; + continue; + } // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + 'Unterminated string.', + ); +} // The string value and lexed size of an escape sequence. + +function readEscapedUnicodeVariableWidth(lexer, position) { + const body = lexer.source.body; + let point = 0; + let size = 3; // Cannot be larger than 12 chars (\u{00000000}). + + while (size < 12) { + const code = body.charCodeAt(position + size++); // Closing Brace (}) + + if (code === 0x007d) { + // Must be at least 5 chars (\u{0}) and encode a Unicode scalar value. + if (size < 5 || !isUnicodeScalarValue(point)) { + break; + } + + return { + value: String.fromCodePoint(point), + size, + }; + } // Append this hex digit to the code point. + + point = (point << 4) | readHexDigit(code); + + if (point < 0) { + break; + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice( + position, + position + size, + )}".`, + ); +} + +function readEscapedUnicodeFixedWidth(lexer, position) { + const body = lexer.source.body; + const code = read16BitHexCode(body, position + 2); + + if (isUnicodeScalarValue(code)) { + return { + value: String.fromCodePoint(code), + size: 6, + }; + } // GraphQL allows JSON-style surrogate pair escape sequences, but only when + // a valid pair is formed. + + if (isLeadingSurrogate(code)) { + // \u + if ( + body.charCodeAt(position + 6) === 0x005c && + body.charCodeAt(position + 7) === 0x0075 + ) { + const trailingCode = read16BitHexCode(body, position + 8); + + if (isTrailingSurrogate(trailingCode)) { + // JavaScript defines strings as a sequence of UTF-16 code units and + // encodes Unicode code points above U+FFFF using a surrogate pair of + // code units. Since this is a surrogate pair escape sequence, just + // include both codes into the JavaScript string value. Had JavaScript + // not been internally based on UTF-16, then this surrogate pair would + // be decoded to retrieve the supplementary code point. + return { + value: String.fromCodePoint(code, trailingCode), + size: 12, + }; + } + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`, + ); +} +/** + * Reads four hexadecimal characters and returns the positive integer that 16bit + * hexadecimal string represents. For example, "000f" will return 15, and "dead" + * will return 57005. + * + * Returns a negative number if any char was not a valid hexadecimal digit. + */ + +function read16BitHexCode(body, position) { + // readHexDigit() returns -1 on error. ORing a negative value with any other + // value always produces a negative value. + return ( + (readHexDigit(body.charCodeAt(position)) << 12) | + (readHexDigit(body.charCodeAt(position + 1)) << 8) | + (readHexDigit(body.charCodeAt(position + 2)) << 4) | + readHexDigit(body.charCodeAt(position + 3)) + ); +} +/** + * Reads a hexadecimal character and returns its positive integer value (0-15). + * + * '0' becomes 0, '9' becomes 9 + * 'A' becomes 10, 'F' becomes 15 + * 'a' becomes 10, 'f' becomes 15 + * + * Returns -1 if the provided character code was not a valid hexadecimal digit. + * + * HexDigit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * - `A` `B` `C` `D` `E` `F` + * - `a` `b` `c` `d` `e` `f` + */ + +function readHexDigit(code) { + return code >= 0x0030 && code <= 0x0039 // 0-9 + ? code - 0x0030 + : code >= 0x0041 && code <= 0x0046 // A-F + ? code - 0x0037 + : code >= 0x0061 && code <= 0x0066 // a-f + ? code - 0x0057 + : -1; +} +/** + * | Escaped Character | Code Point | Character Name | + * | ----------------- | ---------- | ---------------------------- | + * | `"` | U+0022 | double quote | + * | `\` | U+005C | reverse solidus (back slash) | + * | `/` | U+002F | solidus (forward slash) | + * | `b` | U+0008 | backspace | + * | `f` | U+000C | form feed | + * | `n` | U+000A | line feed (new line) | + * | `r` | U+000D | carriage return | + * | `t` | U+0009 | horizontal tab | + */ + +function readEscapedCharacter(lexer, position) { + const body = lexer.source.body; + const code = body.charCodeAt(position + 1); + + switch (code) { + case 0x0022: + // " + return { + value: '\u0022', + size: 2, + }; + + case 0x005c: + // \ + return { + value: '\u005c', + size: 2, + }; + + case 0x002f: + // / + return { + value: '\u002f', + size: 2, + }; + + case 0x0062: + // b + return { + value: '\u0008', + size: 2, + }; + + case 0x0066: + // f + return { + value: '\u000c', + size: 2, + }; + + case 0x006e: + // n + return { + value: '\u000a', + size: 2, + }; + + case 0x0072: + // r + return { + value: '\u000d', + size: 2, + }; + + case 0x0074: + // t + return { + value: '\u0009', + size: 2, + }; + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid character escape sequence: "${body.slice( + position, + position + 2, + )}".`, + ); +} +/** + * Reads a block string token from the source file. + * + * ``` + * StringValue :: + * - `"""` BlockStringCharacter* `"""` + * + * BlockStringCharacter :: + * - SourceCharacter but not `"""` or `\"""` + * - `\"""` + * ``` + */ + +function readBlockString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let lineStart = lexer.lineStart; + let position = start + 3; + let chunkStart = position; + let currentLine = ''; + const blockLines = []; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Triple-Quote (""") + + if ( + code === 0x0022 && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + const token = createToken( + lexer, + _tokenKind.TokenKind.BLOCK_STRING, + start, + position + 3, // Return a string of the lines joined with U+000A. + (0, _blockString.dedentBlockStringLines)(blockLines).join('\n'), + ); + lexer.line += blockLines.length - 1; + lexer.lineStart = lineStart; + return token; + } // Escaped Triple-Quote (\""") + + if ( + code === 0x005c && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 && + body.charCodeAt(position + 3) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + chunkStart = position + 1; // skip only slash + + position += 4; + continue; + } // LineTerminator + + if (code === 0x000a || code === 0x000d) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + + if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + currentLine = ''; + chunkStart = position; + lineStart = position; + continue; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + 'Unterminated string.', + ); +} +/** + * Reads an alphanumeric + underscore name from the source. + * + * ``` + * Name :: + * - NameStart NameContinue* [lookahead != NameContinue] + * ``` + */ + +function readName(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + + if ((0, _characterClasses.isNameContinue)(code)) { + ++position; + } else { + break; + } + } + + return createToken( + lexer, + _tokenKind.TokenKind.NAME, + start, + position, + body.slice(start, position), + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/lexer.mjs b/graphql-subscription-express/node_modules/graphql/language/lexer.mjs new file mode 100644 index 0000000..75299ca --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/lexer.mjs @@ -0,0 +1,902 @@ +import { syntaxError } from '../error/syntaxError.mjs'; +import { Token } from './ast.mjs'; +import { dedentBlockStringLines } from './blockString.mjs'; +import { isDigit, isNameContinue, isNameStart } from './characterClasses.mjs'; +import { TokenKind } from './tokenKind.mjs'; +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ + +export class Lexer { + /** + * The previously focused non-ignored token. + */ + + /** + * The currently focused non-ignored token. + */ + + /** + * The (1-indexed) line containing the current token. + */ + + /** + * The character offset at which the current line begins. + */ + constructor(source) { + const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0); + this.source = source; + this.lastToken = startOfFileToken; + this.token = startOfFileToken; + this.line = 1; + this.lineStart = 0; + } + + get [Symbol.toStringTag]() { + return 'Lexer'; + } + /** + * Advances the token stream to the next non-ignored token. + */ + + advance() { + this.lastToken = this.token; + const token = (this.token = this.lookahead()); + return token; + } + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + + lookahead() { + let token = this.token; + + if (token.kind !== TokenKind.EOF) { + do { + if (token.next) { + token = token.next; + } else { + // Read the next token and form a link in the token linked-list. + const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing. + + token.next = nextToken; // @ts-expect-error prev is only mutable during parsing. + + nextToken.prev = token; + token = nextToken; + } + } while (token.kind === TokenKind.COMMENT); + } + + return token; + } +} +/** + * @internal + */ + +export function isPunctuatorTokenKind(kind) { + return ( + kind === TokenKind.BANG || + kind === TokenKind.DOLLAR || + kind === TokenKind.AMP || + kind === TokenKind.PAREN_L || + kind === TokenKind.PAREN_R || + kind === TokenKind.SPREAD || + kind === TokenKind.COLON || + kind === TokenKind.EQUALS || + kind === TokenKind.AT || + kind === TokenKind.BRACKET_L || + kind === TokenKind.BRACKET_R || + kind === TokenKind.BRACE_L || + kind === TokenKind.PIPE || + kind === TokenKind.BRACE_R + ); +} +/** + * A Unicode scalar value is any Unicode code point except surrogate code + * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and + * 0xE000 to 0x10FFFF. + * + * SourceCharacter :: + * - "Any Unicode scalar value" + */ + +function isUnicodeScalarValue(code) { + return ( + (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff) + ); +} +/** + * The GraphQL specification defines source text as a sequence of unicode scalar + * values (which Unicode defines to exclude surrogate code points). However + * JavaScript defines strings as a sequence of UTF-16 code units which may + * include surrogates. A surrogate pair is a valid source character as it + * encodes a supplementary code point (above U+FFFF), but unpaired surrogate + * code points are not valid source characters. + */ + +function isSupplementaryCodePoint(body, location) { + return ( + isLeadingSurrogate(body.charCodeAt(location)) && + isTrailingSurrogate(body.charCodeAt(location + 1)) + ); +} + +function isLeadingSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} + +function isTrailingSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +/** + * Prints the code point (or end of file reference) at a given location in a + * source for use in error messages. + * + * Printable ASCII is printed quoted, while other points are printed in Unicode + * code point form (ie. U+1234). + */ + +function printCodePointAt(lexer, location) { + const code = lexer.source.body.codePointAt(location); + + if (code === undefined) { + return TokenKind.EOF; + } else if (code >= 0x0020 && code <= 0x007e) { + // Printable ASCII + const char = String.fromCodePoint(code); + return char === '"' ? "'\"'" : `"${char}"`; + } // Unicode code point + + return 'U+' + code.toString(16).toUpperCase().padStart(4, '0'); +} +/** + * Create a token with line and column location information. + */ + +function createToken(lexer, kind, start, end, value) { + const line = lexer.line; + const col = 1 + start - lexer.lineStart; + return new Token(kind, start, end, line, col, value); +} +/** + * Gets the next token from the source starting at the given position. + * + * This skips over whitespace until it finds the next lexable token, then lexes + * punctuators immediately or calls the appropriate helper function for more + * complicated tokens. + */ + +function readNextToken(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // SourceCharacter + + switch (code) { + // Ignored :: + // - UnicodeBOM + // - WhiteSpace + // - LineTerminator + // - Comment + // - Comma + // + // UnicodeBOM :: "Byte Order Mark (U+FEFF)" + // + // WhiteSpace :: + // - "Horizontal Tab (U+0009)" + // - "Space (U+0020)" + // + // Comma :: , + case 0xfeff: // + + case 0x0009: // \t + + case 0x0020: // + + case 0x002c: + // , + ++position; + continue; + // LineTerminator :: + // - "New Line (U+000A)" + // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] + // - "Carriage Return (U+000D)" "New Line (U+000A)" + + case 0x000a: + // \n + ++position; + ++lexer.line; + lexer.lineStart = position; + continue; + + case 0x000d: + // \r + if (body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + ++lexer.line; + lexer.lineStart = position; + continue; + // Comment + + case 0x0023: + // # + return readComment(lexer, position); + // Token :: + // - Punctuator + // - Name + // - IntValue + // - FloatValue + // - StringValue + // + // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } + + case 0x0021: + // ! + return createToken(lexer, TokenKind.BANG, position, position + 1); + + case 0x0024: + // $ + return createToken(lexer, TokenKind.DOLLAR, position, position + 1); + + case 0x0026: + // & + return createToken(lexer, TokenKind.AMP, position, position + 1); + + case 0x0028: + // ( + return createToken(lexer, TokenKind.PAREN_L, position, position + 1); + + case 0x0029: + // ) + return createToken(lexer, TokenKind.PAREN_R, position, position + 1); + + case 0x002e: + // . + if ( + body.charCodeAt(position + 1) === 0x002e && + body.charCodeAt(position + 2) === 0x002e + ) { + return createToken(lexer, TokenKind.SPREAD, position, position + 3); + } + + break; + + case 0x003a: + // : + return createToken(lexer, TokenKind.COLON, position, position + 1); + + case 0x003d: + // = + return createToken(lexer, TokenKind.EQUALS, position, position + 1); + + case 0x0040: + // @ + return createToken(lexer, TokenKind.AT, position, position + 1); + + case 0x005b: + // [ + return createToken(lexer, TokenKind.BRACKET_L, position, position + 1); + + case 0x005d: + // ] + return createToken(lexer, TokenKind.BRACKET_R, position, position + 1); + + case 0x007b: + // { + return createToken(lexer, TokenKind.BRACE_L, position, position + 1); + + case 0x007c: + // | + return createToken(lexer, TokenKind.PIPE, position, position + 1); + + case 0x007d: + // } + return createToken(lexer, TokenKind.BRACE_R, position, position + 1); + // StringValue + + case 0x0022: + // " + if ( + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + return readBlockString(lexer, position); + } + + return readString(lexer, position); + } // IntValue | FloatValue (Digit | -) + + if (isDigit(code) || code === 0x002d) { + return readNumber(lexer, position, code); + } // Name + + if (isNameStart(code)) { + return readName(lexer, position); + } + + throw syntaxError( + lexer.source, + position, + code === 0x0027 + ? 'Unexpected single quote character (\'), did you mean to use a double quote (")?' + : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) + ? `Unexpected character: ${printCodePointAt(lexer, position)}.` + : `Invalid character: ${printCodePointAt(lexer, position)}.`, + ); + } + + return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength); +} +/** + * Reads a comment token from the source file. + * + * ``` + * Comment :: # CommentChar* [lookahead != CommentChar] + * + * CommentChar :: SourceCharacter but not LineTerminator + * ``` + */ + +function readComment(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + break; + } + } + + return createToken( + lexer, + TokenKind.COMMENT, + start, + position, + body.slice(start + 1, position), + ); +} +/** + * Reads a number token from the source file, either a FloatValue or an IntValue + * depending on whether a FractionalPart or ExponentPart is encountered. + * + * ``` + * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}] + * + * IntegerPart :: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit Digit* + * + * NegativeSign :: - + * + * NonZeroDigit :: Digit but not `0` + * + * FloatValue :: + * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * + * FractionalPart :: . Digit+ + * + * ExponentPart :: ExponentIndicator Sign? Digit+ + * + * ExponentIndicator :: one of `e` `E` + * + * Sign :: one of + - + * ``` + */ + +function readNumber(lexer, start, firstCode) { + const body = lexer.source.body; + let position = start; + let code = firstCode; + let isFloat = false; // NegativeSign (-) + + if (code === 0x002d) { + code = body.charCodeAt(++position); + } // Zero (0) + + if (code === 0x0030) { + code = body.charCodeAt(++position); + + if (isDigit(code)) { + throw syntaxError( + lexer.source, + position, + `Invalid number, unexpected digit after 0: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } else { + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Full stop (.) + + if (code === 0x002e) { + isFloat = true; + code = body.charCodeAt(++position); + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // E e + + if (code === 0x0045 || code === 0x0065) { + isFloat = true; + code = body.charCodeAt(++position); // + - + + if (code === 0x002b || code === 0x002d) { + code = body.charCodeAt(++position); + } + + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Numbers cannot be followed by . or NameStart + + if (code === 0x002e || isNameStart(code)) { + throw syntaxError( + lexer.source, + position, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + + return createToken( + lexer, + isFloat ? TokenKind.FLOAT : TokenKind.INT, + start, + position, + body.slice(start, position), + ); +} +/** + * Returns the new position in the source after reading one or more digits. + */ + +function readDigits(lexer, start, firstCode) { + if (!isDigit(firstCode)) { + throw syntaxError( + lexer.source, + start, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + start, + )}.`, + ); + } + + const body = lexer.source.body; + let position = start + 1; // +1 to skip first firstCode + + while (isDigit(body.charCodeAt(position))) { + ++position; + } + + return position; +} +/** + * Reads a single-quote string token from the source file. + * + * ``` + * StringValue :: + * - `""` [lookahead != `"`] + * - `"` StringCharacter+ `"` + * + * StringCharacter :: + * - SourceCharacter but not `"` or `\` or LineTerminator + * - `\u` EscapedUnicode + * - `\` EscapedCharacter + * + * EscapedUnicode :: + * - `{` HexDigit+ `}` + * - HexDigit HexDigit HexDigit HexDigit + * + * EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t` + * ``` + */ + +function readString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + let chunkStart = position; + let value = ''; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Quote (") + + if (code === 0x0022) { + value += body.slice(chunkStart, position); + return createToken(lexer, TokenKind.STRING, start, position + 1, value); + } // Escape Sequence (\) + + if (code === 0x005c) { + value += body.slice(chunkStart, position); + const escape = + body.charCodeAt(position + 1) === 0x0075 // u + ? body.charCodeAt(position + 2) === 0x007b // { + ? readEscapedUnicodeVariableWidth(lexer, position) + : readEscapedUnicodeFixedWidth(lexer, position) + : readEscapedCharacter(lexer, position); + value += escape.value; + position += escape.size; + chunkStart = position; + continue; + } // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw syntaxError( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw syntaxError(lexer.source, position, 'Unterminated string.'); +} // The string value and lexed size of an escape sequence. + +function readEscapedUnicodeVariableWidth(lexer, position) { + const body = lexer.source.body; + let point = 0; + let size = 3; // Cannot be larger than 12 chars (\u{00000000}). + + while (size < 12) { + const code = body.charCodeAt(position + size++); // Closing Brace (}) + + if (code === 0x007d) { + // Must be at least 5 chars (\u{0}) and encode a Unicode scalar value. + if (size < 5 || !isUnicodeScalarValue(point)) { + break; + } + + return { + value: String.fromCodePoint(point), + size, + }; + } // Append this hex digit to the code point. + + point = (point << 4) | readHexDigit(code); + + if (point < 0) { + break; + } + } + + throw syntaxError( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice( + position, + position + size, + )}".`, + ); +} + +function readEscapedUnicodeFixedWidth(lexer, position) { + const body = lexer.source.body; + const code = read16BitHexCode(body, position + 2); + + if (isUnicodeScalarValue(code)) { + return { + value: String.fromCodePoint(code), + size: 6, + }; + } // GraphQL allows JSON-style surrogate pair escape sequences, but only when + // a valid pair is formed. + + if (isLeadingSurrogate(code)) { + // \u + if ( + body.charCodeAt(position + 6) === 0x005c && + body.charCodeAt(position + 7) === 0x0075 + ) { + const trailingCode = read16BitHexCode(body, position + 8); + + if (isTrailingSurrogate(trailingCode)) { + // JavaScript defines strings as a sequence of UTF-16 code units and + // encodes Unicode code points above U+FFFF using a surrogate pair of + // code units. Since this is a surrogate pair escape sequence, just + // include both codes into the JavaScript string value. Had JavaScript + // not been internally based on UTF-16, then this surrogate pair would + // be decoded to retrieve the supplementary code point. + return { + value: String.fromCodePoint(code, trailingCode), + size: 12, + }; + } + } + } + + throw syntaxError( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`, + ); +} +/** + * Reads four hexadecimal characters and returns the positive integer that 16bit + * hexadecimal string represents. For example, "000f" will return 15, and "dead" + * will return 57005. + * + * Returns a negative number if any char was not a valid hexadecimal digit. + */ + +function read16BitHexCode(body, position) { + // readHexDigit() returns -1 on error. ORing a negative value with any other + // value always produces a negative value. + return ( + (readHexDigit(body.charCodeAt(position)) << 12) | + (readHexDigit(body.charCodeAt(position + 1)) << 8) | + (readHexDigit(body.charCodeAt(position + 2)) << 4) | + readHexDigit(body.charCodeAt(position + 3)) + ); +} +/** + * Reads a hexadecimal character and returns its positive integer value (0-15). + * + * '0' becomes 0, '9' becomes 9 + * 'A' becomes 10, 'F' becomes 15 + * 'a' becomes 10, 'f' becomes 15 + * + * Returns -1 if the provided character code was not a valid hexadecimal digit. + * + * HexDigit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * - `A` `B` `C` `D` `E` `F` + * - `a` `b` `c` `d` `e` `f` + */ + +function readHexDigit(code) { + return code >= 0x0030 && code <= 0x0039 // 0-9 + ? code - 0x0030 + : code >= 0x0041 && code <= 0x0046 // A-F + ? code - 0x0037 + : code >= 0x0061 && code <= 0x0066 // a-f + ? code - 0x0057 + : -1; +} +/** + * | Escaped Character | Code Point | Character Name | + * | ----------------- | ---------- | ---------------------------- | + * | `"` | U+0022 | double quote | + * | `\` | U+005C | reverse solidus (back slash) | + * | `/` | U+002F | solidus (forward slash) | + * | `b` | U+0008 | backspace | + * | `f` | U+000C | form feed | + * | `n` | U+000A | line feed (new line) | + * | `r` | U+000D | carriage return | + * | `t` | U+0009 | horizontal tab | + */ + +function readEscapedCharacter(lexer, position) { + const body = lexer.source.body; + const code = body.charCodeAt(position + 1); + + switch (code) { + case 0x0022: + // " + return { + value: '\u0022', + size: 2, + }; + + case 0x005c: + // \ + return { + value: '\u005c', + size: 2, + }; + + case 0x002f: + // / + return { + value: '\u002f', + size: 2, + }; + + case 0x0062: + // b + return { + value: '\u0008', + size: 2, + }; + + case 0x0066: + // f + return { + value: '\u000c', + size: 2, + }; + + case 0x006e: + // n + return { + value: '\u000a', + size: 2, + }; + + case 0x0072: + // r + return { + value: '\u000d', + size: 2, + }; + + case 0x0074: + // t + return { + value: '\u0009', + size: 2, + }; + } + + throw syntaxError( + lexer.source, + position, + `Invalid character escape sequence: "${body.slice( + position, + position + 2, + )}".`, + ); +} +/** + * Reads a block string token from the source file. + * + * ``` + * StringValue :: + * - `"""` BlockStringCharacter* `"""` + * + * BlockStringCharacter :: + * - SourceCharacter but not `"""` or `\"""` + * - `\"""` + * ``` + */ + +function readBlockString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let lineStart = lexer.lineStart; + let position = start + 3; + let chunkStart = position; + let currentLine = ''; + const blockLines = []; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Triple-Quote (""") + + if ( + code === 0x0022 && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + const token = createToken( + lexer, + TokenKind.BLOCK_STRING, + start, + position + 3, // Return a string of the lines joined with U+000A. + dedentBlockStringLines(blockLines).join('\n'), + ); + lexer.line += blockLines.length - 1; + lexer.lineStart = lineStart; + return token; + } // Escaped Triple-Quote (\""") + + if ( + code === 0x005c && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 && + body.charCodeAt(position + 3) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + chunkStart = position + 1; // skip only slash + + position += 4; + continue; + } // LineTerminator + + if (code === 0x000a || code === 0x000d) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + + if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + currentLine = ''; + chunkStart = position; + lineStart = position; + continue; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw syntaxError( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw syntaxError(lexer.source, position, 'Unterminated string.'); +} +/** + * Reads an alphanumeric + underscore name from the source. + * + * ``` + * Name :: + * - NameStart NameContinue* [lookahead != NameContinue] + * ``` + */ + +function readName(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + + if (isNameContinue(code)) { + ++position; + } else { + break; + } + } + + return createToken( + lexer, + TokenKind.NAME, + start, + position, + body.slice(start, position), + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/location.d.ts b/graphql-subscription-express/node_modules/graphql/language/location.d.ts new file mode 100644 index 0000000..2a274ef --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/location.d.ts @@ -0,0 +1,16 @@ +import type { Source } from './source'; +/** + * Represents a location in a Source. + */ +export interface SourceLocation { + readonly line: number; + readonly column: number; +} +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +export declare function getLocation( + source: Source, + position: number, +): SourceLocation; diff --git a/graphql-subscription-express/node_modules/graphql/language/location.js b/graphql-subscription-express/node_modules/graphql/language/location.js new file mode 100644 index 0000000..5ef2316 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/location.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getLocation = getLocation; + +var _invariant = require('../jsutils/invariant.js'); + +const LineRegExp = /\r\n|[\n\r]/g; +/** + * Represents a location in a Source. + */ + +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +function getLocation(source, position) { + let lastLineStart = 0; + let line = 1; + + for (const match of source.body.matchAll(LineRegExp)) { + typeof match.index === 'number' || (0, _invariant.invariant)(false); + + if (match.index >= position) { + break; + } + + lastLineStart = match.index + match[0].length; + line += 1; + } + + return { + line, + column: position + 1 - lastLineStart, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/location.mjs b/graphql-subscription-express/node_modules/graphql/language/location.mjs new file mode 100644 index 0000000..6cca4bb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/location.mjs @@ -0,0 +1,30 @@ +import { invariant } from '../jsutils/invariant.mjs'; +const LineRegExp = /\r\n|[\n\r]/g; +/** + * Represents a location in a Source. + */ + +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +export function getLocation(source, position) { + let lastLineStart = 0; + let line = 1; + + for (const match of source.body.matchAll(LineRegExp)) { + typeof match.index === 'number' || invariant(false); + + if (match.index >= position) { + break; + } + + lastLineStart = match.index + match[0].length; + line += 1; + } + + return { + line, + column: position + 1 - lastLineStart, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/parser.d.ts b/graphql-subscription-express/node_modules/graphql/language/parser.d.ts new file mode 100644 index 0000000..a158a64 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/parser.d.ts @@ -0,0 +1,564 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { GraphQLError } from '../error/GraphQLError'; +import type { + ArgumentNode, + ConstArgumentNode, + ConstDirectiveNode, + ConstListValueNode, + ConstObjectFieldNode, + ConstObjectValueNode, + ConstValueNode, + DefinitionNode, + DirectiveDefinitionNode, + DirectiveNode, + DocumentNode, + EnumTypeDefinitionNode, + EnumTypeExtensionNode, + EnumValueDefinitionNode, + FieldDefinitionNode, + FieldNode, + FragmentDefinitionNode, + FragmentSpreadNode, + InlineFragmentNode, + InputObjectTypeDefinitionNode, + InputObjectTypeExtensionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + ListValueNode, + NamedTypeNode, + NameNode, + ObjectFieldNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + ObjectValueNode, + OperationDefinitionNode, + OperationTypeDefinitionNode, + ScalarTypeDefinitionNode, + ScalarTypeExtensionNode, + SchemaDefinitionNode, + SchemaExtensionNode, + SelectionNode, + SelectionSetNode, + StringValueNode, + Token, + TypeNode, + TypeSystemExtensionNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, + ValueNode, + VariableDefinitionNode, + VariableNode, +} from './ast'; +import { Location, OperationTypeNode } from './ast'; +import { Lexer } from './lexer'; +import { Source } from './source'; +import { TokenKind } from './tokenKind'; +/** + * Configuration options to control parser behavior + */ +export interface ParseOptions { + /** + * By default, the parser creates AST nodes that know the location + * in the source that they correspond to. This configuration flag + * disables that behavior for performance or testing. + */ + noLocation?: boolean; + /** + * Parser CPU and memory usage is linear to the number of tokens in a document + * however in extreme cases it becomes quadratic due to memory exhaustion. + * Parsing happens before validation so even invalid queries can burn lots of + * CPU time and memory. + * To prevent this you can set a maximum number of tokens allowed within a document. + */ + maxTokens?: number | undefined; + /** + * @deprecated will be removed in the v17.0.0 + * + * If enabled, the parser will understand and parse variable definitions + * contained in a fragment definition. They'll be represented in the + * `variableDefinitions` field of the FragmentDefinitionNode. + * + * The syntax is identical to normal, query-defined variables. For example: + * + * ```graphql + * fragment A($var: Boolean = false) on T { + * ... + * } + * ``` + */ + allowLegacyFragmentVariables?: boolean; +} +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +export declare function parse( + source: string | Source, + options?: ParseOptions | undefined, +): DocumentNode; +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ +export declare function parseValue( + source: string | Source, + options?: ParseOptions | undefined, +): ValueNode; +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + */ +export declare function parseConstValue( + source: string | Source, + options?: ParseOptions | undefined, +): ConstValueNode; +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ +export declare function parseType( + source: string | Source, + options?: ParseOptions | undefined, +): TypeNode; +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ +export declare class Parser { + protected _options: ParseOptions; + protected _lexer: Lexer; + protected _tokenCounter: number; + constructor(source: string | Source, options?: ParseOptions); + /** + * Converts a name lex token into a name parse node. + */ + parseName(): NameNode; + /** + * Document : Definition+ + */ + parseDocument(): DocumentNode; + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + * + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + parseDefinition(): DefinitionNode; + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + parseOperationDefinition(): OperationDefinitionNode; + /** + * OperationType : one of query mutation subscription + */ + parseOperationType(): OperationTypeNode; + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + parseVariableDefinitions(): Array; + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + parseVariableDefinition(): VariableDefinitionNode; + /** + * Variable : $ Name + */ + parseVariable(): VariableNode; + /** + * ``` + * SelectionSet : { Selection+ } + * ``` + */ + parseSelectionSet(): SelectionSetNode; + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + parseSelection(): SelectionNode; + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + parseField(): FieldNode; + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + parseArguments(isConst: true): Array; + parseArguments(isConst: boolean): Array; + /** + * Argument[Const] : Name : Value[?Const] + */ + parseArgument(isConst: true): ConstArgumentNode; + parseArgument(isConst?: boolean): ArgumentNode; + parseConstArgument(): ConstArgumentNode; + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + parseFragment(): FragmentSpreadNode | InlineFragmentNode; + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + parseFragmentDefinition(): FragmentDefinitionNode; + /** + * FragmentName : Name but not `on` + */ + parseFragmentName(): NameNode; + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + parseValueLiteral(isConst: true): ConstValueNode; + parseValueLiteral(isConst: boolean): ValueNode; + parseConstValueLiteral(): ConstValueNode; + parseStringLiteral(): StringValueNode; + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + parseList(isConst: true): ConstListValueNode; + parseList(isConst: boolean): ListValueNode; + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + parseObject(isConst: true): ConstObjectValueNode; + parseObject(isConst: boolean): ObjectValueNode; + /** + * ObjectField[Const] : Name : Value[?Const] + */ + parseObjectField(isConst: true): ConstObjectFieldNode; + parseObjectField(isConst: boolean): ObjectFieldNode; + /** + * Directives[Const] : Directive[?Const]+ + */ + parseDirectives(isConst: true): Array; + parseDirectives(isConst: boolean): Array; + parseConstDirectives(): Array; + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + parseDirective(isConst: true): ConstDirectiveNode; + parseDirective(isConst: boolean): DirectiveNode; + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + parseTypeReference(): TypeNode; + /** + * NamedType : Name + */ + parseNamedType(): NamedTypeNode; + peekDescription(): boolean; + /** + * Description : StringValue + */ + parseDescription(): undefined | StringValueNode; + /** + * ``` + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + * ``` + */ + parseSchemaDefinition(): SchemaDefinitionNode; + /** + * OperationTypeDefinition : OperationType : NamedType + */ + parseOperationTypeDefinition(): OperationTypeDefinitionNode; + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + parseScalarTypeDefinition(): ScalarTypeDefinitionNode; + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + parseObjectTypeDefinition(): ObjectTypeDefinitionNode; + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + parseImplementsInterfaces(): Array; + /** + * ``` + * FieldsDefinition : { FieldDefinition+ } + * ``` + */ + parseFieldsDefinition(): Array; + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + parseFieldDefinition(): FieldDefinitionNode; + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + parseArgumentDefs(): Array; + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + parseInputValueDef(): InputValueDefinitionNode; + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + parseInterfaceTypeDefinition(): InterfaceTypeDefinitionNode; + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + parseUnionTypeDefinition(): UnionTypeDefinitionNode; + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + parseUnionMemberTypes(): Array; + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + parseEnumTypeDefinition(): EnumTypeDefinitionNode; + /** + * ``` + * EnumValuesDefinition : { EnumValueDefinition+ } + * ``` + */ + parseEnumValuesDefinition(): Array; + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + */ + parseEnumValueDefinition(): EnumValueDefinitionNode; + /** + * EnumValue : Name but not `true`, `false` or `null` + */ + parseEnumValueName(): NameNode; + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + parseInputObjectTypeDefinition(): InputObjectTypeDefinitionNode; + /** + * ``` + * InputFieldsDefinition : { InputValueDefinition+ } + * ``` + */ + parseInputFieldsDefinition(): Array; + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + parseTypeSystemExtension(): TypeSystemExtensionNode; + /** + * ``` + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + * ``` + */ + parseSchemaExtension(): SchemaExtensionNode; + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + parseScalarTypeExtension(): ScalarTypeExtensionNode; + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + parseObjectTypeExtension(): ObjectTypeExtensionNode; + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + parseInterfaceTypeExtension(): InterfaceTypeExtensionNode; + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + parseUnionTypeExtension(): UnionTypeExtensionNode; + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + parseEnumTypeExtension(): EnumTypeExtensionNode; + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + parseInputObjectTypeExtension(): InputObjectTypeExtensionNode; + /** + * ``` + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + * ``` + */ + parseDirectiveDefinition(): DirectiveDefinitionNode; + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + parseDirectiveLocations(): Array; + parseDirectiveLocation(): NameNode; + /** + * Returns a node that, if configured to do so, sets a "loc" field as a + * location object, used to identify the place in the source that created a + * given parsed object. + */ + node< + T extends { + loc?: Location; + }, + >(startToken: Token, node: T): T; + /** + * Determines if the next token is of a given kind + */ + peek(kind: TokenKind): boolean; + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + expectToken(kind: TokenKind): Token; + /** + * If the next token is of the given kind, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + expectOptionalToken(kind: TokenKind): boolean; + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + expectKeyword(value: string): void; + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + expectOptionalKeyword(value: string): boolean; + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + unexpected(atToken?: Maybe): GraphQLError; + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + any(openKind: TokenKind, parseFn: () => T, closeKind: TokenKind): Array; + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + optionalMany( + openKind: TokenKind, + parseFn: () => T, + closeKind: TokenKind, + ): Array; + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + many( + openKind: TokenKind, + parseFn: () => T, + closeKind: TokenKind, + ): Array; + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + delimitedMany(delimiterKind: TokenKind, parseFn: () => T): Array; + advanceLexer(): void; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/parser.js b/graphql-subscription-express/node_modules/graphql/language/parser.js new file mode 100644 index 0000000..f133239 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/parser.js @@ -0,0 +1,1567 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Parser = void 0; +exports.parse = parse; +exports.parseConstValue = parseConstValue; +exports.parseType = parseType; +exports.parseValue = parseValue; + +var _syntaxError = require('../error/syntaxError.js'); + +var _ast = require('./ast.js'); + +var _directiveLocation = require('./directiveLocation.js'); + +var _kinds = require('./kinds.js'); + +var _lexer = require('./lexer.js'); + +var _source = require('./source.js'); + +var _tokenKind = require('./tokenKind.js'); + +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +function parse(source, options) { + const parser = new Parser(source, options); + return parser.parseDocument(); +} +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ + +function parseValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + const value = parser.parseValueLiteral(false); + parser.expectToken(_tokenKind.TokenKind.EOF); + return value; +} +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + */ + +function parseConstValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + const value = parser.parseConstValueLiteral(); + parser.expectToken(_tokenKind.TokenKind.EOF); + return value; +} +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ + +function parseType(source, options) { + const parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + const type = parser.parseTypeReference(); + parser.expectToken(_tokenKind.TokenKind.EOF); + return type; +} +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ + +class Parser { + constructor(source, options = {}) { + const sourceObj = (0, _source.isSource)(source) + ? source + : new _source.Source(source); + this._lexer = new _lexer.Lexer(sourceObj); + this._options = options; + this._tokenCounter = 0; + } + /** + * Converts a name lex token into a name parse node. + */ + + parseName() { + const token = this.expectToken(_tokenKind.TokenKind.NAME); + return this.node(token, { + kind: _kinds.Kind.NAME, + value: token.value, + }); + } // Implements the parsing rules in the Document section. + + /** + * Document : Definition+ + */ + + parseDocument() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.DOCUMENT, + definitions: this.many( + _tokenKind.TokenKind.SOF, + this.parseDefinition, + _tokenKind.TokenKind.EOF, + ), + }); + } + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + * + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + + parseDefinition() { + if (this.peek(_tokenKind.TokenKind.BRACE_L)) { + return this.parseOperationDefinition(); + } // Many definitions begin with a description and require a lookahead. + + const hasDescription = this.peekDescription(); + const keywordToken = hasDescription + ? this._lexer.lookahead() + : this._lexer.token; + + if (keywordToken.kind === _tokenKind.TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaDefinition(); + + case 'scalar': + return this.parseScalarTypeDefinition(); + + case 'type': + return this.parseObjectTypeDefinition(); + + case 'interface': + return this.parseInterfaceTypeDefinition(); + + case 'union': + return this.parseUnionTypeDefinition(); + + case 'enum': + return this.parseEnumTypeDefinition(); + + case 'input': + return this.parseInputObjectTypeDefinition(); + + case 'directive': + return this.parseDirectiveDefinition(); + } + + if (hasDescription) { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + this._lexer.token.start, + 'Unexpected description, descriptions are supported only on type definitions.', + ); + } + + switch (keywordToken.value) { + case 'query': + case 'mutation': + case 'subscription': + return this.parseOperationDefinition(); + + case 'fragment': + return this.parseFragmentDefinition(); + + case 'extend': + return this.parseTypeSystemExtension(); + } + } + + throw this.unexpected(keywordToken); + } // Implements the parsing rules in the Operations section. + + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + + parseOperationDefinition() { + const start = this._lexer.token; + + if (this.peek(_tokenKind.TokenKind.BRACE_L)) { + return this.node(start, { + kind: _kinds.Kind.OPERATION_DEFINITION, + operation: _ast.OperationTypeNode.QUERY, + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: this.parseSelectionSet(), + }); + } + + const operation = this.parseOperationType(); + let name; + + if (this.peek(_tokenKind.TokenKind.NAME)) { + name = this.parseName(); + } + + return this.node(start, { + kind: _kinds.Kind.OPERATION_DEFINITION, + operation, + name, + variableDefinitions: this.parseVariableDefinitions(), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * OperationType : one of query mutation subscription + */ + + parseOperationType() { + const operationToken = this.expectToken(_tokenKind.TokenKind.NAME); + + switch (operationToken.value) { + case 'query': + return _ast.OperationTypeNode.QUERY; + + case 'mutation': + return _ast.OperationTypeNode.MUTATION; + + case 'subscription': + return _ast.OperationTypeNode.SUBSCRIPTION; + } + + throw this.unexpected(operationToken); + } + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + + parseVariableDefinitions() { + return this.optionalMany( + _tokenKind.TokenKind.PAREN_L, + this.parseVariableDefinition, + _tokenKind.TokenKind.PAREN_R, + ); + } + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + + parseVariableDefinition() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.VARIABLE_DEFINITION, + variable: this.parseVariable(), + type: + (this.expectToken(_tokenKind.TokenKind.COLON), + this.parseTypeReference()), + defaultValue: this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) + ? this.parseConstValueLiteral() + : undefined, + directives: this.parseConstDirectives(), + }); + } + /** + * Variable : $ Name + */ + + parseVariable() { + const start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.DOLLAR); + return this.node(start, { + kind: _kinds.Kind.VARIABLE, + name: this.parseName(), + }); + } + /** + * ``` + * SelectionSet : { Selection+ } + * ``` + */ + + parseSelectionSet() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.SELECTION_SET, + selections: this.many( + _tokenKind.TokenKind.BRACE_L, + this.parseSelection, + _tokenKind.TokenKind.BRACE_R, + ), + }); + } + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + + parseSelection() { + return this.peek(_tokenKind.TokenKind.SPREAD) + ? this.parseFragment() + : this.parseField(); + } + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + + parseField() { + const start = this._lexer.token; + const nameOrAlias = this.parseName(); + let alias; + let name; + + if (this.expectOptionalToken(_tokenKind.TokenKind.COLON)) { + alias = nameOrAlias; + name = this.parseName(); + } else { + name = nameOrAlias; + } + + return this.node(start, { + kind: _kinds.Kind.FIELD, + alias, + name, + arguments: this.parseArguments(false), + directives: this.parseDirectives(false), + selectionSet: this.peek(_tokenKind.TokenKind.BRACE_L) + ? this.parseSelectionSet() + : undefined, + }); + } + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + + parseArguments(isConst) { + const item = isConst ? this.parseConstArgument : this.parseArgument; + return this.optionalMany( + _tokenKind.TokenKind.PAREN_L, + item, + _tokenKind.TokenKind.PAREN_R, + ); + } + /** + * Argument[Const] : Name : Value[?Const] + */ + + parseArgument(isConst = false) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + return this.node(start, { + kind: _kinds.Kind.ARGUMENT, + name, + value: this.parseValueLiteral(isConst), + }); + } + + parseConstArgument() { + return this.parseArgument(true); + } // Implements the parsing rules in the Fragments section. + + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + + parseFragment() { + const start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.SPREAD); + const hasTypeCondition = this.expectOptionalKeyword('on'); + + if (!hasTypeCondition && this.peek(_tokenKind.TokenKind.NAME)) { + return this.node(start, { + kind: _kinds.Kind.FRAGMENT_SPREAD, + name: this.parseFragmentName(), + directives: this.parseDirectives(false), + }); + } + + return this.node(start, { + kind: _kinds.Kind.INLINE_FRAGMENT, + typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + + parseFragmentDefinition() { + const start = this._lexer.token; + this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes + // the grammar of FragmentDefinition: + // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + + if (this._options.allowLegacyFragmentVariables === true) { + return this.node(start, { + kind: _kinds.Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + variableDefinitions: this.parseVariableDefinitions(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + + return this.node(start, { + kind: _kinds.Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentName : Name but not `on` + */ + + parseFragmentName() { + if (this._lexer.token.value === 'on') { + throw this.unexpected(); + } + + return this.parseName(); + } // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseValueLiteral(isConst) { + const token = this._lexer.token; + + switch (token.kind) { + case _tokenKind.TokenKind.BRACKET_L: + return this.parseList(isConst); + + case _tokenKind.TokenKind.BRACE_L: + return this.parseObject(isConst); + + case _tokenKind.TokenKind.INT: + this.advanceLexer(); + return this.node(token, { + kind: _kinds.Kind.INT, + value: token.value, + }); + + case _tokenKind.TokenKind.FLOAT: + this.advanceLexer(); + return this.node(token, { + kind: _kinds.Kind.FLOAT, + value: token.value, + }); + + case _tokenKind.TokenKind.STRING: + case _tokenKind.TokenKind.BLOCK_STRING: + return this.parseStringLiteral(); + + case _tokenKind.TokenKind.NAME: + this.advanceLexer(); + + switch (token.value) { + case 'true': + return this.node(token, { + kind: _kinds.Kind.BOOLEAN, + value: true, + }); + + case 'false': + return this.node(token, { + kind: _kinds.Kind.BOOLEAN, + value: false, + }); + + case 'null': + return this.node(token, { + kind: _kinds.Kind.NULL, + }); + + default: + return this.node(token, { + kind: _kinds.Kind.ENUM, + value: token.value, + }); + } + + case _tokenKind.TokenKind.DOLLAR: + if (isConst) { + this.expectToken(_tokenKind.TokenKind.DOLLAR); + + if (this._lexer.token.kind === _tokenKind.TokenKind.NAME) { + const varName = this._lexer.token.value; + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Unexpected variable "$${varName}" in constant value.`, + ); + } else { + throw this.unexpected(token); + } + } + + return this.parseVariable(); + + default: + throw this.unexpected(); + } + } + + parseConstValueLiteral() { + return this.parseValueLiteral(true); + } + + parseStringLiteral() { + const token = this._lexer.token; + this.advanceLexer(); + return this.node(token, { + kind: _kinds.Kind.STRING, + value: token.value, + block: token.kind === _tokenKind.TokenKind.BLOCK_STRING, + }); + } + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + + parseList(isConst) { + const item = () => this.parseValueLiteral(isConst); + + return this.node(this._lexer.token, { + kind: _kinds.Kind.LIST, + values: this.any( + _tokenKind.TokenKind.BRACKET_L, + item, + _tokenKind.TokenKind.BRACKET_R, + ), + }); + } + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + + parseObject(isConst) { + const item = () => this.parseObjectField(isConst); + + return this.node(this._lexer.token, { + kind: _kinds.Kind.OBJECT, + fields: this.any( + _tokenKind.TokenKind.BRACE_L, + item, + _tokenKind.TokenKind.BRACE_R, + ), + }); + } + /** + * ObjectField[Const] : Name : Value[?Const] + */ + + parseObjectField(isConst) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + return this.node(start, { + kind: _kinds.Kind.OBJECT_FIELD, + name, + value: this.parseValueLiteral(isConst), + }); + } // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + + parseDirectives(isConst) { + const directives = []; + + while (this.peek(_tokenKind.TokenKind.AT)) { + directives.push(this.parseDirective(isConst)); + } + + return directives; + } + + parseConstDirectives() { + return this.parseDirectives(true); + } + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + + parseDirective(isConst) { + const start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.AT); + return this.node(start, { + kind: _kinds.Kind.DIRECTIVE, + name: this.parseName(), + arguments: this.parseArguments(isConst), + }); + } // Implements the parsing rules in the Types section. + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + + parseTypeReference() { + const start = this._lexer.token; + let type; + + if (this.expectOptionalToken(_tokenKind.TokenKind.BRACKET_L)) { + const innerType = this.parseTypeReference(); + this.expectToken(_tokenKind.TokenKind.BRACKET_R); + type = this.node(start, { + kind: _kinds.Kind.LIST_TYPE, + type: innerType, + }); + } else { + type = this.parseNamedType(); + } + + if (this.expectOptionalToken(_tokenKind.TokenKind.BANG)) { + return this.node(start, { + kind: _kinds.Kind.NON_NULL_TYPE, + type, + }); + } + + return type; + } + /** + * NamedType : Name + */ + + parseNamedType() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.NAMED_TYPE, + name: this.parseName(), + }); + } // Implements the parsing rules in the Type Definition section. + + peekDescription() { + return ( + this.peek(_tokenKind.TokenKind.STRING) || + this.peek(_tokenKind.TokenKind.BLOCK_STRING) + ); + } + /** + * Description : StringValue + */ + + parseDescription() { + if (this.peekDescription()) { + return this.parseStringLiteral(); + } + } + /** + * ``` + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + * ``` + */ + + parseSchemaDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.many( + _tokenKind.TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + return this.node(start, { + kind: _kinds.Kind.SCHEMA_DEFINITION, + description, + directives, + operationTypes, + }); + } + /** + * OperationTypeDefinition : OperationType : NamedType + */ + + parseOperationTypeDefinition() { + const start = this._lexer.token; + const operation = this.parseOperationType(); + this.expectToken(_tokenKind.TokenKind.COLON); + const type = this.parseNamedType(); + return this.node(start, { + kind: _kinds.Kind.OPERATION_TYPE_DEFINITION, + operation, + type, + }); + } + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + + parseScalarTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.SCALAR_TYPE_DEFINITION, + description, + name, + directives, + }); + } + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + + parseObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: _kinds.Kind.OBJECT_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + + parseImplementsInterfaces() { + return this.expectOptionalKeyword('implements') + ? this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType) + : []; + } + /** + * ``` + * FieldsDefinition : { FieldDefinition+ } + * ``` + */ + + parseFieldsDefinition() { + return this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseFieldDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + } + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + + parseFieldDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + this.expectToken(_tokenKind.TokenKind.COLON); + const type = this.parseTypeReference(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.FIELD_DEFINITION, + description, + name, + arguments: args, + type, + directives, + }); + } + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + + parseArgumentDefs() { + return this.optionalMany( + _tokenKind.TokenKind.PAREN_L, + this.parseInputValueDef, + _tokenKind.TokenKind.PAREN_R, + ); + } + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + + parseInputValueDef() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + const type = this.parseTypeReference(); + let defaultValue; + + if (this.expectOptionalToken(_tokenKind.TokenKind.EQUALS)) { + defaultValue = this.parseConstValueLiteral(); + } + + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.INPUT_VALUE_DEFINITION, + description, + name, + type, + defaultValue, + directives, + }); + } + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + + parseInterfaceTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: _kinds.Kind.INTERFACE_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + + parseUnionTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + return this.node(start, { + kind: _kinds.Kind.UNION_TYPE_DEFINITION, + description, + name, + directives, + types, + }); + } + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + + parseUnionMemberTypes() { + return this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) + ? this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseNamedType) + : []; + } + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + + parseEnumTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + return this.node(start, { + kind: _kinds.Kind.ENUM_TYPE_DEFINITION, + description, + name, + directives, + values, + }); + } + /** + * ``` + * EnumValuesDefinition : { EnumValueDefinition+ } + * ``` + */ + + parseEnumValuesDefinition() { + return this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseEnumValueDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + } + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + */ + + parseEnumValueDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseEnumValueName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.ENUM_VALUE_DEFINITION, + description, + name, + directives, + }); + } + /** + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseEnumValueName() { + if ( + this._lexer.token.value === 'true' || + this._lexer.token.value === 'false' || + this._lexer.token.value === 'null' + ) { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + this._lexer.token.start, + `${getTokenDesc( + this._lexer.token, + )} is reserved and cannot be used for an enum value.`, + ); + } + + return this.parseName(); + } + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + + parseInputObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + return this.node(start, { + kind: _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, + description, + name, + directives, + fields, + }); + } + /** + * ``` + * InputFieldsDefinition : { InputValueDefinition+ } + * ``` + */ + + parseInputFieldsDefinition() { + return this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseInputValueDef, + _tokenKind.TokenKind.BRACE_R, + ); + } + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + + parseTypeSystemExtension() { + const keywordToken = this._lexer.lookahead(); + + if (keywordToken.kind === _tokenKind.TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaExtension(); + + case 'scalar': + return this.parseScalarTypeExtension(); + + case 'type': + return this.parseObjectTypeExtension(); + + case 'interface': + return this.parseInterfaceTypeExtension(); + + case 'union': + return this.parseUnionTypeExtension(); + + case 'enum': + return this.parseEnumTypeExtension(); + + case 'input': + return this.parseInputObjectTypeExtension(); + } + } + + throw this.unexpected(keywordToken); + } + /** + * ``` + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + * ``` + */ + + parseSchemaExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + + if (directives.length === 0 && operationTypes.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.SCHEMA_EXTENSION, + directives, + operationTypes, + }); + } + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + + parseScalarTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + + if (directives.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.SCALAR_TYPE_EXTENSION, + name, + directives, + }); + } + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + + parseObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.OBJECT_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + + parseInterfaceTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.INTERFACE_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + + parseUnionTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + + if (directives.length === 0 && types.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.UNION_TYPE_EXTENSION, + name, + directives, + types, + }); + } + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + + parseEnumTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + + if (directives.length === 0 && values.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.ENUM_TYPE_EXTENSION, + name, + directives, + values, + }); + } + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + + parseInputObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + + if (directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, + name, + directives, + fields, + }); + } + /** + * ``` + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + * ``` + */ + + parseDirectiveDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('directive'); + this.expectToken(_tokenKind.TokenKind.AT); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + const repeatable = this.expectOptionalKeyword('repeatable'); + this.expectKeyword('on'); + const locations = this.parseDirectiveLocations(); + return this.node(start, { + kind: _kinds.Kind.DIRECTIVE_DEFINITION, + description, + name, + arguments: args, + repeatable, + locations, + }); + } + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + + parseDirectiveLocations() { + return this.delimitedMany( + _tokenKind.TokenKind.PIPE, + this.parseDirectiveLocation, + ); + } + /* + * DirectiveLocation : + * - ExecutableDirectiveLocation + * - TypeSystemDirectiveLocation + * + * ExecutableDirectiveLocation : one of + * `QUERY` + * `MUTATION` + * `SUBSCRIPTION` + * `FIELD` + * `FRAGMENT_DEFINITION` + * `FRAGMENT_SPREAD` + * `INLINE_FRAGMENT` + * + * TypeSystemDirectiveLocation : one of + * `SCHEMA` + * `SCALAR` + * `OBJECT` + * `FIELD_DEFINITION` + * `ARGUMENT_DEFINITION` + * `INTERFACE` + * `UNION` + * `ENUM` + * `ENUM_VALUE` + * `INPUT_OBJECT` + * `INPUT_FIELD_DEFINITION` + */ + + parseDirectiveLocation() { + const start = this._lexer.token; + const name = this.parseName(); + + if ( + Object.prototype.hasOwnProperty.call( + _directiveLocation.DirectiveLocation, + name.value, + ) + ) { + return name; + } + + throw this.unexpected(start); + } // Core parsing utility functions + + /** + * Returns a node that, if configured to do so, sets a "loc" field as a + * location object, used to identify the place in the source that created a + * given parsed object. + */ + + node(startToken, node) { + if (this._options.noLocation !== true) { + node.loc = new _ast.Location( + startToken, + this._lexer.lastToken, + this._lexer.source, + ); + } + + return node; + } + /** + * Determines if the next token is of a given kind + */ + + peek(kind) { + return this._lexer.token.kind === kind; + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return token; + } + + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`, + ); + } + /** + * If the next token is of the given kind, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectKeyword(value) { + const token = this._lexer.token; + + if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { + this.advanceLexer(); + } else { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Expected "${value}", found ${getTokenDesc(token)}.`, + ); + } + } + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalKeyword(value) { + const token = this._lexer.token; + + if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + + unexpected(atToken) { + const token = + atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; + return (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Unexpected ${getTokenDesc(token)}.`, + ); + } + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + any(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + while (!this.expectOptionalToken(closeKind)) { + nodes.push(parseFn.call(this)); + } + + return nodes; + } + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + optionalMany(openKind, parseFn, closeKind) { + if (this.expectOptionalToken(openKind)) { + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + + return []; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + many(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + + delimitedMany(delimiterKind, parseFn) { + this.expectOptionalToken(delimiterKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (this.expectOptionalToken(delimiterKind)); + + return nodes; + } + + advanceLexer() { + const { maxTokens } = this._options; + + const token = this._lexer.advance(); + + if (maxTokens !== undefined && token.kind !== _tokenKind.TokenKind.EOF) { + ++this._tokenCounter; + + if (this._tokenCounter > maxTokens) { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Document contains more that ${maxTokens} tokens. Parsing aborted.`, + ); + } + } + } +} +/** + * A helper function to describe a token as a string for debugging. + */ + +exports.Parser = Parser; + +function getTokenDesc(token) { + const value = token.value; + return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ''); +} +/** + * A helper function to describe a token kind as a string for debugging. + */ + +function getTokenKindDesc(kind) { + return (0, _lexer.isPunctuatorTokenKind)(kind) ? `"${kind}"` : kind; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/parser.mjs b/graphql-subscription-express/node_modules/graphql/language/parser.mjs new file mode 100644 index 0000000..2ba066c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/parser.mjs @@ -0,0 +1,1524 @@ +import { syntaxError } from '../error/syntaxError.mjs'; +import { Location, OperationTypeNode } from './ast.mjs'; +import { DirectiveLocation } from './directiveLocation.mjs'; +import { Kind } from './kinds.mjs'; +import { isPunctuatorTokenKind, Lexer } from './lexer.mjs'; +import { isSource, Source } from './source.mjs'; +import { TokenKind } from './tokenKind.mjs'; +/** + * Configuration options to control parser behavior + */ + +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +export function parse(source, options) { + const parser = new Parser(source, options); + return parser.parseDocument(); +} +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ + +export function parseValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const value = parser.parseValueLiteral(false); + parser.expectToken(TokenKind.EOF); + return value; +} +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + */ + +export function parseConstValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const value = parser.parseConstValueLiteral(); + parser.expectToken(TokenKind.EOF); + return value; +} +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ + +export function parseType(source, options) { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const type = parser.parseTypeReference(); + parser.expectToken(TokenKind.EOF); + return type; +} +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ + +export class Parser { + constructor(source, options = {}) { + const sourceObj = isSource(source) ? source : new Source(source); + this._lexer = new Lexer(sourceObj); + this._options = options; + this._tokenCounter = 0; + } + /** + * Converts a name lex token into a name parse node. + */ + + parseName() { + const token = this.expectToken(TokenKind.NAME); + return this.node(token, { + kind: Kind.NAME, + value: token.value, + }); + } // Implements the parsing rules in the Document section. + + /** + * Document : Definition+ + */ + + parseDocument() { + return this.node(this._lexer.token, { + kind: Kind.DOCUMENT, + definitions: this.many( + TokenKind.SOF, + this.parseDefinition, + TokenKind.EOF, + ), + }); + } + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + * + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + + parseDefinition() { + if (this.peek(TokenKind.BRACE_L)) { + return this.parseOperationDefinition(); + } // Many definitions begin with a description and require a lookahead. + + const hasDescription = this.peekDescription(); + const keywordToken = hasDescription + ? this._lexer.lookahead() + : this._lexer.token; + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaDefinition(); + + case 'scalar': + return this.parseScalarTypeDefinition(); + + case 'type': + return this.parseObjectTypeDefinition(); + + case 'interface': + return this.parseInterfaceTypeDefinition(); + + case 'union': + return this.parseUnionTypeDefinition(); + + case 'enum': + return this.parseEnumTypeDefinition(); + + case 'input': + return this.parseInputObjectTypeDefinition(); + + case 'directive': + return this.parseDirectiveDefinition(); + } + + if (hasDescription) { + throw syntaxError( + this._lexer.source, + this._lexer.token.start, + 'Unexpected description, descriptions are supported only on type definitions.', + ); + } + + switch (keywordToken.value) { + case 'query': + case 'mutation': + case 'subscription': + return this.parseOperationDefinition(); + + case 'fragment': + return this.parseFragmentDefinition(); + + case 'extend': + return this.parseTypeSystemExtension(); + } + } + + throw this.unexpected(keywordToken); + } // Implements the parsing rules in the Operations section. + + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + + parseOperationDefinition() { + const start = this._lexer.token; + + if (this.peek(TokenKind.BRACE_L)) { + return this.node(start, { + kind: Kind.OPERATION_DEFINITION, + operation: OperationTypeNode.QUERY, + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: this.parseSelectionSet(), + }); + } + + const operation = this.parseOperationType(); + let name; + + if (this.peek(TokenKind.NAME)) { + name = this.parseName(); + } + + return this.node(start, { + kind: Kind.OPERATION_DEFINITION, + operation, + name, + variableDefinitions: this.parseVariableDefinitions(), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * OperationType : one of query mutation subscription + */ + + parseOperationType() { + const operationToken = this.expectToken(TokenKind.NAME); + + switch (operationToken.value) { + case 'query': + return OperationTypeNode.QUERY; + + case 'mutation': + return OperationTypeNode.MUTATION; + + case 'subscription': + return OperationTypeNode.SUBSCRIPTION; + } + + throw this.unexpected(operationToken); + } + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + + parseVariableDefinitions() { + return this.optionalMany( + TokenKind.PAREN_L, + this.parseVariableDefinition, + TokenKind.PAREN_R, + ); + } + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + + parseVariableDefinition() { + return this.node(this._lexer.token, { + kind: Kind.VARIABLE_DEFINITION, + variable: this.parseVariable(), + type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), + defaultValue: this.expectOptionalToken(TokenKind.EQUALS) + ? this.parseConstValueLiteral() + : undefined, + directives: this.parseConstDirectives(), + }); + } + /** + * Variable : $ Name + */ + + parseVariable() { + const start = this._lexer.token; + this.expectToken(TokenKind.DOLLAR); + return this.node(start, { + kind: Kind.VARIABLE, + name: this.parseName(), + }); + } + /** + * ``` + * SelectionSet : { Selection+ } + * ``` + */ + + parseSelectionSet() { + return this.node(this._lexer.token, { + kind: Kind.SELECTION_SET, + selections: this.many( + TokenKind.BRACE_L, + this.parseSelection, + TokenKind.BRACE_R, + ), + }); + } + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + + parseSelection() { + return this.peek(TokenKind.SPREAD) + ? this.parseFragment() + : this.parseField(); + } + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + + parseField() { + const start = this._lexer.token; + const nameOrAlias = this.parseName(); + let alias; + let name; + + if (this.expectOptionalToken(TokenKind.COLON)) { + alias = nameOrAlias; + name = this.parseName(); + } else { + name = nameOrAlias; + } + + return this.node(start, { + kind: Kind.FIELD, + alias, + name, + arguments: this.parseArguments(false), + directives: this.parseDirectives(false), + selectionSet: this.peek(TokenKind.BRACE_L) + ? this.parseSelectionSet() + : undefined, + }); + } + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + + parseArguments(isConst) { + const item = isConst ? this.parseConstArgument : this.parseArgument; + return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); + } + /** + * Argument[Const] : Name : Value[?Const] + */ + + parseArgument(isConst = false) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + return this.node(start, { + kind: Kind.ARGUMENT, + name, + value: this.parseValueLiteral(isConst), + }); + } + + parseConstArgument() { + return this.parseArgument(true); + } // Implements the parsing rules in the Fragments section. + + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + + parseFragment() { + const start = this._lexer.token; + this.expectToken(TokenKind.SPREAD); + const hasTypeCondition = this.expectOptionalKeyword('on'); + + if (!hasTypeCondition && this.peek(TokenKind.NAME)) { + return this.node(start, { + kind: Kind.FRAGMENT_SPREAD, + name: this.parseFragmentName(), + directives: this.parseDirectives(false), + }); + } + + return this.node(start, { + kind: Kind.INLINE_FRAGMENT, + typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + + parseFragmentDefinition() { + const start = this._lexer.token; + this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes + // the grammar of FragmentDefinition: + // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + + if (this._options.allowLegacyFragmentVariables === true) { + return this.node(start, { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + variableDefinitions: this.parseVariableDefinitions(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + + return this.node(start, { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentName : Name but not `on` + */ + + parseFragmentName() { + if (this._lexer.token.value === 'on') { + throw this.unexpected(); + } + + return this.parseName(); + } // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseValueLiteral(isConst) { + const token = this._lexer.token; + + switch (token.kind) { + case TokenKind.BRACKET_L: + return this.parseList(isConst); + + case TokenKind.BRACE_L: + return this.parseObject(isConst); + + case TokenKind.INT: + this.advanceLexer(); + return this.node(token, { + kind: Kind.INT, + value: token.value, + }); + + case TokenKind.FLOAT: + this.advanceLexer(); + return this.node(token, { + kind: Kind.FLOAT, + value: token.value, + }); + + case TokenKind.STRING: + case TokenKind.BLOCK_STRING: + return this.parseStringLiteral(); + + case TokenKind.NAME: + this.advanceLexer(); + + switch (token.value) { + case 'true': + return this.node(token, { + kind: Kind.BOOLEAN, + value: true, + }); + + case 'false': + return this.node(token, { + kind: Kind.BOOLEAN, + value: false, + }); + + case 'null': + return this.node(token, { + kind: Kind.NULL, + }); + + default: + return this.node(token, { + kind: Kind.ENUM, + value: token.value, + }); + } + + case TokenKind.DOLLAR: + if (isConst) { + this.expectToken(TokenKind.DOLLAR); + + if (this._lexer.token.kind === TokenKind.NAME) { + const varName = this._lexer.token.value; + throw syntaxError( + this._lexer.source, + token.start, + `Unexpected variable "$${varName}" in constant value.`, + ); + } else { + throw this.unexpected(token); + } + } + + return this.parseVariable(); + + default: + throw this.unexpected(); + } + } + + parseConstValueLiteral() { + return this.parseValueLiteral(true); + } + + parseStringLiteral() { + const token = this._lexer.token; + this.advanceLexer(); + return this.node(token, { + kind: Kind.STRING, + value: token.value, + block: token.kind === TokenKind.BLOCK_STRING, + }); + } + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + + parseList(isConst) { + const item = () => this.parseValueLiteral(isConst); + + return this.node(this._lexer.token, { + kind: Kind.LIST, + values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R), + }); + } + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + + parseObject(isConst) { + const item = () => this.parseObjectField(isConst); + + return this.node(this._lexer.token, { + kind: Kind.OBJECT, + fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R), + }); + } + /** + * ObjectField[Const] : Name : Value[?Const] + */ + + parseObjectField(isConst) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + return this.node(start, { + kind: Kind.OBJECT_FIELD, + name, + value: this.parseValueLiteral(isConst), + }); + } // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + + parseDirectives(isConst) { + const directives = []; + + while (this.peek(TokenKind.AT)) { + directives.push(this.parseDirective(isConst)); + } + + return directives; + } + + parseConstDirectives() { + return this.parseDirectives(true); + } + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + + parseDirective(isConst) { + const start = this._lexer.token; + this.expectToken(TokenKind.AT); + return this.node(start, { + kind: Kind.DIRECTIVE, + name: this.parseName(), + arguments: this.parseArguments(isConst), + }); + } // Implements the parsing rules in the Types section. + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + + parseTypeReference() { + const start = this._lexer.token; + let type; + + if (this.expectOptionalToken(TokenKind.BRACKET_L)) { + const innerType = this.parseTypeReference(); + this.expectToken(TokenKind.BRACKET_R); + type = this.node(start, { + kind: Kind.LIST_TYPE, + type: innerType, + }); + } else { + type = this.parseNamedType(); + } + + if (this.expectOptionalToken(TokenKind.BANG)) { + return this.node(start, { + kind: Kind.NON_NULL_TYPE, + type, + }); + } + + return type; + } + /** + * NamedType : Name + */ + + parseNamedType() { + return this.node(this._lexer.token, { + kind: Kind.NAMED_TYPE, + name: this.parseName(), + }); + } // Implements the parsing rules in the Type Definition section. + + peekDescription() { + return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); + } + /** + * Description : StringValue + */ + + parseDescription() { + if (this.peekDescription()) { + return this.parseStringLiteral(); + } + } + /** + * ``` + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + * ``` + */ + + parseSchemaDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.many( + TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + TokenKind.BRACE_R, + ); + return this.node(start, { + kind: Kind.SCHEMA_DEFINITION, + description, + directives, + operationTypes, + }); + } + /** + * OperationTypeDefinition : OperationType : NamedType + */ + + parseOperationTypeDefinition() { + const start = this._lexer.token; + const operation = this.parseOperationType(); + this.expectToken(TokenKind.COLON); + const type = this.parseNamedType(); + return this.node(start, { + kind: Kind.OPERATION_TYPE_DEFINITION, + operation, + type, + }); + } + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + + parseScalarTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.SCALAR_TYPE_DEFINITION, + description, + name, + directives, + }); + } + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + + parseObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: Kind.OBJECT_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + + parseImplementsInterfaces() { + return this.expectOptionalKeyword('implements') + ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) + : []; + } + /** + * ``` + * FieldsDefinition : { FieldDefinition+ } + * ``` + */ + + parseFieldsDefinition() { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseFieldDefinition, + TokenKind.BRACE_R, + ); + } + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + + parseFieldDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + this.expectToken(TokenKind.COLON); + const type = this.parseTypeReference(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.FIELD_DEFINITION, + description, + name, + arguments: args, + type, + directives, + }); + } + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + + parseArgumentDefs() { + return this.optionalMany( + TokenKind.PAREN_L, + this.parseInputValueDef, + TokenKind.PAREN_R, + ); + } + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + + parseInputValueDef() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + const type = this.parseTypeReference(); + let defaultValue; + + if (this.expectOptionalToken(TokenKind.EQUALS)) { + defaultValue = this.parseConstValueLiteral(); + } + + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.INPUT_VALUE_DEFINITION, + description, + name, + type, + defaultValue, + directives, + }); + } + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + + parseInterfaceTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: Kind.INTERFACE_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + + parseUnionTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + return this.node(start, { + kind: Kind.UNION_TYPE_DEFINITION, + description, + name, + directives, + types, + }); + } + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + + parseUnionMemberTypes() { + return this.expectOptionalToken(TokenKind.EQUALS) + ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) + : []; + } + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + + parseEnumTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + return this.node(start, { + kind: Kind.ENUM_TYPE_DEFINITION, + description, + name, + directives, + values, + }); + } + /** + * ``` + * EnumValuesDefinition : { EnumValueDefinition+ } + * ``` + */ + + parseEnumValuesDefinition() { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseEnumValueDefinition, + TokenKind.BRACE_R, + ); + } + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + */ + + parseEnumValueDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseEnumValueName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.ENUM_VALUE_DEFINITION, + description, + name, + directives, + }); + } + /** + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseEnumValueName() { + if ( + this._lexer.token.value === 'true' || + this._lexer.token.value === 'false' || + this._lexer.token.value === 'null' + ) { + throw syntaxError( + this._lexer.source, + this._lexer.token.start, + `${getTokenDesc( + this._lexer.token, + )} is reserved and cannot be used for an enum value.`, + ); + } + + return this.parseName(); + } + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + + parseInputObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + return this.node(start, { + kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, + description, + name, + directives, + fields, + }); + } + /** + * ``` + * InputFieldsDefinition : { InputValueDefinition+ } + * ``` + */ + + parseInputFieldsDefinition() { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseInputValueDef, + TokenKind.BRACE_R, + ); + } + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + + parseTypeSystemExtension() { + const keywordToken = this._lexer.lookahead(); + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaExtension(); + + case 'scalar': + return this.parseScalarTypeExtension(); + + case 'type': + return this.parseObjectTypeExtension(); + + case 'interface': + return this.parseInterfaceTypeExtension(); + + case 'union': + return this.parseUnionTypeExtension(); + + case 'enum': + return this.parseEnumTypeExtension(); + + case 'input': + return this.parseInputObjectTypeExtension(); + } + } + + throw this.unexpected(keywordToken); + } + /** + * ``` + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + * ``` + */ + + parseSchemaExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.optionalMany( + TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + TokenKind.BRACE_R, + ); + + if (directives.length === 0 && operationTypes.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.SCHEMA_EXTENSION, + directives, + operationTypes, + }); + } + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + + parseScalarTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + + if (directives.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.SCALAR_TYPE_EXTENSION, + name, + directives, + }); + } + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + + parseObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.OBJECT_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + + parseInterfaceTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.INTERFACE_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + + parseUnionTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + + if (directives.length === 0 && types.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.UNION_TYPE_EXTENSION, + name, + directives, + types, + }); + } + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + + parseEnumTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + + if (directives.length === 0 && values.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.ENUM_TYPE_EXTENSION, + name, + directives, + values, + }); + } + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + + parseInputObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + + if (directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, + name, + directives, + fields, + }); + } + /** + * ``` + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + * ``` + */ + + parseDirectiveDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('directive'); + this.expectToken(TokenKind.AT); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + const repeatable = this.expectOptionalKeyword('repeatable'); + this.expectKeyword('on'); + const locations = this.parseDirectiveLocations(); + return this.node(start, { + kind: Kind.DIRECTIVE_DEFINITION, + description, + name, + arguments: args, + repeatable, + locations, + }); + } + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + + parseDirectiveLocations() { + return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); + } + /* + * DirectiveLocation : + * - ExecutableDirectiveLocation + * - TypeSystemDirectiveLocation + * + * ExecutableDirectiveLocation : one of + * `QUERY` + * `MUTATION` + * `SUBSCRIPTION` + * `FIELD` + * `FRAGMENT_DEFINITION` + * `FRAGMENT_SPREAD` + * `INLINE_FRAGMENT` + * + * TypeSystemDirectiveLocation : one of + * `SCHEMA` + * `SCALAR` + * `OBJECT` + * `FIELD_DEFINITION` + * `ARGUMENT_DEFINITION` + * `INTERFACE` + * `UNION` + * `ENUM` + * `ENUM_VALUE` + * `INPUT_OBJECT` + * `INPUT_FIELD_DEFINITION` + */ + + parseDirectiveLocation() { + const start = this._lexer.token; + const name = this.parseName(); + + if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) { + return name; + } + + throw this.unexpected(start); + } // Core parsing utility functions + + /** + * Returns a node that, if configured to do so, sets a "loc" field as a + * location object, used to identify the place in the source that created a + * given parsed object. + */ + + node(startToken, node) { + if (this._options.noLocation !== true) { + node.loc = new Location( + startToken, + this._lexer.lastToken, + this._lexer.source, + ); + } + + return node; + } + /** + * Determines if the next token is of a given kind + */ + + peek(kind) { + return this._lexer.token.kind === kind; + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return token; + } + + throw syntaxError( + this._lexer.source, + token.start, + `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`, + ); + } + /** + * If the next token is of the given kind, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectKeyword(value) { + const token = this._lexer.token; + + if (token.kind === TokenKind.NAME && token.value === value) { + this.advanceLexer(); + } else { + throw syntaxError( + this._lexer.source, + token.start, + `Expected "${value}", found ${getTokenDesc(token)}.`, + ); + } + } + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalKeyword(value) { + const token = this._lexer.token; + + if (token.kind === TokenKind.NAME && token.value === value) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + + unexpected(atToken) { + const token = + atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; + return syntaxError( + this._lexer.source, + token.start, + `Unexpected ${getTokenDesc(token)}.`, + ); + } + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + any(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + while (!this.expectOptionalToken(closeKind)) { + nodes.push(parseFn.call(this)); + } + + return nodes; + } + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + optionalMany(openKind, parseFn, closeKind) { + if (this.expectOptionalToken(openKind)) { + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + + return []; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + many(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + + delimitedMany(delimiterKind, parseFn) { + this.expectOptionalToken(delimiterKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (this.expectOptionalToken(delimiterKind)); + + return nodes; + } + + advanceLexer() { + const { maxTokens } = this._options; + + const token = this._lexer.advance(); + + if (maxTokens !== undefined && token.kind !== TokenKind.EOF) { + ++this._tokenCounter; + + if (this._tokenCounter > maxTokens) { + throw syntaxError( + this._lexer.source, + token.start, + `Document contains more that ${maxTokens} tokens. Parsing aborted.`, + ); + } + } + } +} +/** + * A helper function to describe a token as a string for debugging. + */ + +function getTokenDesc(token) { + const value = token.value; + return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ''); +} +/** + * A helper function to describe a token kind as a string for debugging. + */ + +function getTokenKindDesc(kind) { + return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/predicates.d.ts b/graphql-subscription-express/node_modules/graphql/language/predicates.d.ts new file mode 100644 index 0000000..3ebad9b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/predicates.d.ts @@ -0,0 +1,33 @@ +import type { + ASTNode, + ConstValueNode, + DefinitionNode, + ExecutableDefinitionNode, + SelectionNode, + TypeDefinitionNode, + TypeExtensionNode, + TypeNode, + TypeSystemDefinitionNode, + TypeSystemExtensionNode, + ValueNode, +} from './ast'; +export declare function isDefinitionNode(node: ASTNode): node is DefinitionNode; +export declare function isExecutableDefinitionNode( + node: ASTNode, +): node is ExecutableDefinitionNode; +export declare function isSelectionNode(node: ASTNode): node is SelectionNode; +export declare function isValueNode(node: ASTNode): node is ValueNode; +export declare function isConstValueNode(node: ASTNode): node is ConstValueNode; +export declare function isTypeNode(node: ASTNode): node is TypeNode; +export declare function isTypeSystemDefinitionNode( + node: ASTNode, +): node is TypeSystemDefinitionNode; +export declare function isTypeDefinitionNode( + node: ASTNode, +): node is TypeDefinitionNode; +export declare function isTypeSystemExtensionNode( + node: ASTNode, +): node is TypeSystemExtensionNode; +export declare function isTypeExtensionNode( + node: ASTNode, +): node is TypeExtensionNode; diff --git a/graphql-subscription-express/node_modules/graphql/language/predicates.js b/graphql-subscription-express/node_modules/graphql/language/predicates.js new file mode 100644 index 0000000..da635a8 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/predicates.js @@ -0,0 +1,109 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isConstValueNode = isConstValueNode; +exports.isDefinitionNode = isDefinitionNode; +exports.isExecutableDefinitionNode = isExecutableDefinitionNode; +exports.isSelectionNode = isSelectionNode; +exports.isTypeDefinitionNode = isTypeDefinitionNode; +exports.isTypeExtensionNode = isTypeExtensionNode; +exports.isTypeNode = isTypeNode; +exports.isTypeSystemDefinitionNode = isTypeSystemDefinitionNode; +exports.isTypeSystemExtensionNode = isTypeSystemExtensionNode; +exports.isValueNode = isValueNode; + +var _kinds = require('./kinds.js'); + +function isDefinitionNode(node) { + return ( + isExecutableDefinitionNode(node) || + isTypeSystemDefinitionNode(node) || + isTypeSystemExtensionNode(node) + ); +} + +function isExecutableDefinitionNode(node) { + return ( + node.kind === _kinds.Kind.OPERATION_DEFINITION || + node.kind === _kinds.Kind.FRAGMENT_DEFINITION + ); +} + +function isSelectionNode(node) { + return ( + node.kind === _kinds.Kind.FIELD || + node.kind === _kinds.Kind.FRAGMENT_SPREAD || + node.kind === _kinds.Kind.INLINE_FRAGMENT + ); +} + +function isValueNode(node) { + return ( + node.kind === _kinds.Kind.VARIABLE || + node.kind === _kinds.Kind.INT || + node.kind === _kinds.Kind.FLOAT || + node.kind === _kinds.Kind.STRING || + node.kind === _kinds.Kind.BOOLEAN || + node.kind === _kinds.Kind.NULL || + node.kind === _kinds.Kind.ENUM || + node.kind === _kinds.Kind.LIST || + node.kind === _kinds.Kind.OBJECT + ); +} + +function isConstValueNode(node) { + return ( + isValueNode(node) && + (node.kind === _kinds.Kind.LIST + ? node.values.some(isConstValueNode) + : node.kind === _kinds.Kind.OBJECT + ? node.fields.some((field) => isConstValueNode(field.value)) + : node.kind !== _kinds.Kind.VARIABLE) + ); +} + +function isTypeNode(node) { + return ( + node.kind === _kinds.Kind.NAMED_TYPE || + node.kind === _kinds.Kind.LIST_TYPE || + node.kind === _kinds.Kind.NON_NULL_TYPE + ); +} + +function isTypeSystemDefinitionNode(node) { + return ( + node.kind === _kinds.Kind.SCHEMA_DEFINITION || + isTypeDefinitionNode(node) || + node.kind === _kinds.Kind.DIRECTIVE_DEFINITION + ); +} + +function isTypeDefinitionNode(node) { + return ( + node.kind === _kinds.Kind.SCALAR_TYPE_DEFINITION || + node.kind === _kinds.Kind.OBJECT_TYPE_DEFINITION || + node.kind === _kinds.Kind.INTERFACE_TYPE_DEFINITION || + node.kind === _kinds.Kind.UNION_TYPE_DEFINITION || + node.kind === _kinds.Kind.ENUM_TYPE_DEFINITION || + node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION + ); +} + +function isTypeSystemExtensionNode(node) { + return ( + node.kind === _kinds.Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node) + ); +} + +function isTypeExtensionNode(node) { + return ( + node.kind === _kinds.Kind.SCALAR_TYPE_EXTENSION || + node.kind === _kinds.Kind.OBJECT_TYPE_EXTENSION || + node.kind === _kinds.Kind.INTERFACE_TYPE_EXTENSION || + node.kind === _kinds.Kind.UNION_TYPE_EXTENSION || + node.kind === _kinds.Kind.ENUM_TYPE_EXTENSION || + node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/predicates.mjs b/graphql-subscription-express/node_modules/graphql/language/predicates.mjs new file mode 100644 index 0000000..858ff4e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/predicates.mjs @@ -0,0 +1,81 @@ +import { Kind } from './kinds.mjs'; +export function isDefinitionNode(node) { + return ( + isExecutableDefinitionNode(node) || + isTypeSystemDefinitionNode(node) || + isTypeSystemExtensionNode(node) + ); +} +export function isExecutableDefinitionNode(node) { + return ( + node.kind === Kind.OPERATION_DEFINITION || + node.kind === Kind.FRAGMENT_DEFINITION + ); +} +export function isSelectionNode(node) { + return ( + node.kind === Kind.FIELD || + node.kind === Kind.FRAGMENT_SPREAD || + node.kind === Kind.INLINE_FRAGMENT + ); +} +export function isValueNode(node) { + return ( + node.kind === Kind.VARIABLE || + node.kind === Kind.INT || + node.kind === Kind.FLOAT || + node.kind === Kind.STRING || + node.kind === Kind.BOOLEAN || + node.kind === Kind.NULL || + node.kind === Kind.ENUM || + node.kind === Kind.LIST || + node.kind === Kind.OBJECT + ); +} +export function isConstValueNode(node) { + return ( + isValueNode(node) && + (node.kind === Kind.LIST + ? node.values.some(isConstValueNode) + : node.kind === Kind.OBJECT + ? node.fields.some((field) => isConstValueNode(field.value)) + : node.kind !== Kind.VARIABLE) + ); +} +export function isTypeNode(node) { + return ( + node.kind === Kind.NAMED_TYPE || + node.kind === Kind.LIST_TYPE || + node.kind === Kind.NON_NULL_TYPE + ); +} +export function isTypeSystemDefinitionNode(node) { + return ( + node.kind === Kind.SCHEMA_DEFINITION || + isTypeDefinitionNode(node) || + node.kind === Kind.DIRECTIVE_DEFINITION + ); +} +export function isTypeDefinitionNode(node) { + return ( + node.kind === Kind.SCALAR_TYPE_DEFINITION || + node.kind === Kind.OBJECT_TYPE_DEFINITION || + node.kind === Kind.INTERFACE_TYPE_DEFINITION || + node.kind === Kind.UNION_TYPE_DEFINITION || + node.kind === Kind.ENUM_TYPE_DEFINITION || + node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION + ); +} +export function isTypeSystemExtensionNode(node) { + return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); +} +export function isTypeExtensionNode(node) { + return ( + node.kind === Kind.SCALAR_TYPE_EXTENSION || + node.kind === Kind.OBJECT_TYPE_EXTENSION || + node.kind === Kind.INTERFACE_TYPE_EXTENSION || + node.kind === Kind.UNION_TYPE_EXTENSION || + node.kind === Kind.ENUM_TYPE_EXTENSION || + node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/printLocation.d.ts b/graphql-subscription-express/node_modules/graphql/language/printLocation.d.ts new file mode 100644 index 0000000..c3f9b91 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printLocation.d.ts @@ -0,0 +1,14 @@ +import type { Location } from './ast'; +import type { SourceLocation } from './location'; +import type { Source } from './source'; +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export declare function printLocation(location: Location): string; +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export declare function printSourceLocation( + source: Source, + sourceLocation: SourceLocation, +): string; diff --git a/graphql-subscription-express/node_modules/graphql/language/printLocation.js b/graphql-subscription-express/node_modules/graphql/language/printLocation.js new file mode 100644 index 0000000..c507ab7 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printLocation.js @@ -0,0 +1,74 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printLocation = printLocation; +exports.printSourceLocation = printSourceLocation; + +var _location = require('./location.js'); + +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +function printLocation(location) { + return printSourceLocation( + location.source, + (0, _location.getLocation)(location.source, location.start), + ); +} +/** + * Render a helpful description of the location in the GraphQL Source document. + */ + +function printSourceLocation(source, sourceLocation) { + const firstLineColumnOffset = source.locationOffset.column - 1; + const body = ''.padStart(firstLineColumnOffset) + source.body; + const lineIndex = sourceLocation.line - 1; + const lineOffset = source.locationOffset.line - 1; + const lineNum = sourceLocation.line + lineOffset; + const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; + const columnNum = sourceLocation.column + columnOffset; + const locationStr = `${source.name}:${lineNum}:${columnNum}\n`; + const lines = body.split(/\r\n|[\n\r]/g); + const locationLine = lines[lineIndex]; // Special case for minified documents + + if (locationLine.length > 120) { + const subLineIndex = Math.floor(columnNum / 80); + const subLineColumnNum = columnNum % 80; + const subLines = []; + + for (let i = 0; i < locationLine.length; i += 80) { + subLines.push(locationLine.slice(i, i + 80)); + } + + return ( + locationStr + + printPrefixedLines([ + [`${lineNum} |`, subLines[0]], + ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]), + ['|', '^'.padStart(subLineColumnNum)], + ['|', subLines[subLineIndex + 1]], + ]) + ); + } + + return ( + locationStr + + printPrefixedLines([ + // Lines specified like this: ["prefix", "string"], + [`${lineNum - 1} |`, lines[lineIndex - 1]], + [`${lineNum} |`, locationLine], + ['|', '^'.padStart(columnNum)], + [`${lineNum + 1} |`, lines[lineIndex + 1]], + ]) + ); +} + +function printPrefixedLines(lines) { + const existingLines = lines.filter(([_, line]) => line !== undefined); + const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); + return existingLines + .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : '')) + .join('\n'); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/printLocation.mjs b/graphql-subscription-express/node_modules/graphql/language/printLocation.mjs new file mode 100644 index 0000000..4b9a66f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printLocation.mjs @@ -0,0 +1,66 @@ +import { getLocation } from './location.mjs'; + +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export function printLocation(location) { + return printSourceLocation( + location.source, + getLocation(location.source, location.start), + ); +} +/** + * Render a helpful description of the location in the GraphQL Source document. + */ + +export function printSourceLocation(source, sourceLocation) { + const firstLineColumnOffset = source.locationOffset.column - 1; + const body = ''.padStart(firstLineColumnOffset) + source.body; + const lineIndex = sourceLocation.line - 1; + const lineOffset = source.locationOffset.line - 1; + const lineNum = sourceLocation.line + lineOffset; + const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; + const columnNum = sourceLocation.column + columnOffset; + const locationStr = `${source.name}:${lineNum}:${columnNum}\n`; + const lines = body.split(/\r\n|[\n\r]/g); + const locationLine = lines[lineIndex]; // Special case for minified documents + + if (locationLine.length > 120) { + const subLineIndex = Math.floor(columnNum / 80); + const subLineColumnNum = columnNum % 80; + const subLines = []; + + for (let i = 0; i < locationLine.length; i += 80) { + subLines.push(locationLine.slice(i, i + 80)); + } + + return ( + locationStr + + printPrefixedLines([ + [`${lineNum} |`, subLines[0]], + ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]), + ['|', '^'.padStart(subLineColumnNum)], + ['|', subLines[subLineIndex + 1]], + ]) + ); + } + + return ( + locationStr + + printPrefixedLines([ + // Lines specified like this: ["prefix", "string"], + [`${lineNum - 1} |`, lines[lineIndex - 1]], + [`${lineNum} |`, locationLine], + ['|', '^'.padStart(columnNum)], + [`${lineNum + 1} |`, lines[lineIndex + 1]], + ]) + ); +} + +function printPrefixedLines(lines) { + const existingLines = lines.filter(([_, line]) => line !== undefined); + const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); + return existingLines + .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : '')) + .join('\n'); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/printString.d.ts b/graphql-subscription-express/node_modules/graphql/language/printString.d.ts new file mode 100644 index 0000000..34caad6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printString.d.ts @@ -0,0 +1,5 @@ +/** + * Prints a string as a GraphQL StringValue literal. Replaces control characters + * and excluded characters (" U+0022 and \\ U+005C) with escape sequences. + */ +export declare function printString(str: string): string; diff --git a/graphql-subscription-express/node_modules/graphql/language/printString.js b/graphql-subscription-express/node_modules/graphql/language/printString.js new file mode 100644 index 0000000..4b3da49 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printString.js @@ -0,0 +1,183 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printString = printString; + +/** + * Prints a string as a GraphQL StringValue literal. Replaces control characters + * and excluded characters (" U+0022 and \\ U+005C) with escape sequences. + */ +function printString(str) { + return `"${str.replace(escapedRegExp, escapedReplacer)}"`; +} // eslint-disable-next-line no-control-regex + +const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; + +function escapedReplacer(str) { + return escapeSequences[str.charCodeAt(0)]; +} // prettier-ignore + +const escapeSequences = [ + '\\u0000', + '\\u0001', + '\\u0002', + '\\u0003', + '\\u0004', + '\\u0005', + '\\u0006', + '\\u0007', + '\\b', + '\\t', + '\\n', + '\\u000B', + '\\f', + '\\r', + '\\u000E', + '\\u000F', + '\\u0010', + '\\u0011', + '\\u0012', + '\\u0013', + '\\u0014', + '\\u0015', + '\\u0016', + '\\u0017', + '\\u0018', + '\\u0019', + '\\u001A', + '\\u001B', + '\\u001C', + '\\u001D', + '\\u001E', + '\\u001F', + '', + '', + '\\"', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 2F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 3F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 4F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\\\', + '', + '', + '', // 5F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 6F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\u007F', + '\\u0080', + '\\u0081', + '\\u0082', + '\\u0083', + '\\u0084', + '\\u0085', + '\\u0086', + '\\u0087', + '\\u0088', + '\\u0089', + '\\u008A', + '\\u008B', + '\\u008C', + '\\u008D', + '\\u008E', + '\\u008F', + '\\u0090', + '\\u0091', + '\\u0092', + '\\u0093', + '\\u0094', + '\\u0095', + '\\u0096', + '\\u0097', + '\\u0098', + '\\u0099', + '\\u009A', + '\\u009B', + '\\u009C', + '\\u009D', + '\\u009E', + '\\u009F', +]; diff --git a/graphql-subscription-express/node_modules/graphql/language/printString.mjs b/graphql-subscription-express/node_modules/graphql/language/printString.mjs new file mode 100644 index 0000000..bb034b4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printString.mjs @@ -0,0 +1,176 @@ +/** + * Prints a string as a GraphQL StringValue literal. Replaces control characters + * and excluded characters (" U+0022 and \\ U+005C) with escape sequences. + */ +export function printString(str) { + return `"${str.replace(escapedRegExp, escapedReplacer)}"`; +} // eslint-disable-next-line no-control-regex + +const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; + +function escapedReplacer(str) { + return escapeSequences[str.charCodeAt(0)]; +} // prettier-ignore + +const escapeSequences = [ + '\\u0000', + '\\u0001', + '\\u0002', + '\\u0003', + '\\u0004', + '\\u0005', + '\\u0006', + '\\u0007', + '\\b', + '\\t', + '\\n', + '\\u000B', + '\\f', + '\\r', + '\\u000E', + '\\u000F', + '\\u0010', + '\\u0011', + '\\u0012', + '\\u0013', + '\\u0014', + '\\u0015', + '\\u0016', + '\\u0017', + '\\u0018', + '\\u0019', + '\\u001A', + '\\u001B', + '\\u001C', + '\\u001D', + '\\u001E', + '\\u001F', + '', + '', + '\\"', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 2F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 3F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 4F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\\\', + '', + '', + '', // 5F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 6F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\u007F', + '\\u0080', + '\\u0081', + '\\u0082', + '\\u0083', + '\\u0084', + '\\u0085', + '\\u0086', + '\\u0087', + '\\u0088', + '\\u0089', + '\\u008A', + '\\u008B', + '\\u008C', + '\\u008D', + '\\u008E', + '\\u008F', + '\\u0090', + '\\u0091', + '\\u0092', + '\\u0093', + '\\u0094', + '\\u0095', + '\\u0096', + '\\u0097', + '\\u0098', + '\\u0099', + '\\u009A', + '\\u009B', + '\\u009C', + '\\u009D', + '\\u009E', + '\\u009F', +]; diff --git a/graphql-subscription-express/node_modules/graphql/language/printer.d.ts b/graphql-subscription-express/node_modules/graphql/language/printer.d.ts new file mode 100644 index 0000000..336dbf4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printer.d.ts @@ -0,0 +1,6 @@ +import type { ASTNode } from './ast'; +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ +export declare function print(ast: ASTNode): string; diff --git a/graphql-subscription-express/node_modules/graphql/language/printer.js b/graphql-subscription-express/node_modules/graphql/language/printer.js new file mode 100644 index 0000000..eed3b7c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printer.js @@ -0,0 +1,351 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.print = print; + +var _blockString = require('./blockString.js'); + +var _printString = require('./printString.js'); + +var _visitor = require('./visitor.js'); + +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ +function print(ast) { + return (0, _visitor.visit)(ast, printDocASTReducer); +} + +const MAX_LINE_LENGTH = 80; +const printDocASTReducer = { + Name: { + leave: (node) => node.value, + }, + Variable: { + leave: (node) => '$' + node.name, + }, + // Document + Document: { + leave: (node) => join(node.definitions, '\n\n'), + }, + OperationDefinition: { + leave(node) { + const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); + const prefix = join( + [ + node.operation, + join([node.name, varDefs]), + join(node.directives, ' '), + ], + ' ', + ); // Anonymous queries with no directives or variable definitions can use + // the query short form. + + return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet; + }, + }, + VariableDefinition: { + leave: ({ variable, type, defaultValue, directives }) => + variable + + ': ' + + type + + wrap(' = ', defaultValue) + + wrap(' ', join(directives, ' ')), + }, + SelectionSet: { + leave: ({ selections }) => block(selections), + }, + Field: { + leave({ alias, name, arguments: args, directives, selectionSet }) { + const prefix = wrap('', alias, ': ') + name; + let argsLine = prefix + wrap('(', join(args, ', '), ')'); + + if (argsLine.length > MAX_LINE_LENGTH) { + argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); + } + + return join([argsLine, join(directives, ' '), selectionSet], ' '); + }, + }, + Argument: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Fragments + FragmentSpread: { + leave: ({ name, directives }) => + '...' + name + wrap(' ', join(directives, ' ')), + }, + InlineFragment: { + leave: ({ typeCondition, directives, selectionSet }) => + join( + [ + '...', + wrap('on ', typeCondition), + join(directives, ' '), + selectionSet, + ], + ' ', + ), + }, + FragmentDefinition: { + leave: ( + { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed + ) => + // or removed in the future. + `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` + + `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` + + selectionSet, + }, + // Value + IntValue: { + leave: ({ value }) => value, + }, + FloatValue: { + leave: ({ value }) => value, + }, + StringValue: { + leave: ({ value, block: isBlockString }) => + isBlockString + ? (0, _blockString.printBlockString)(value) + : (0, _printString.printString)(value), + }, + BooleanValue: { + leave: ({ value }) => (value ? 'true' : 'false'), + }, + NullValue: { + leave: () => 'null', + }, + EnumValue: { + leave: ({ value }) => value, + }, + ListValue: { + leave: ({ values }) => '[' + join(values, ', ') + ']', + }, + ObjectValue: { + leave: ({ fields }) => '{' + join(fields, ', ') + '}', + }, + ObjectField: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Directive + Directive: { + leave: ({ name, arguments: args }) => + '@' + name + wrap('(', join(args, ', '), ')'), + }, + // Type + NamedType: { + leave: ({ name }) => name, + }, + ListType: { + leave: ({ type }) => '[' + type + ']', + }, + NonNullType: { + leave: ({ type }) => type + '!', + }, + // Type System Definitions + SchemaDefinition: { + leave: ({ description, directives, operationTypes }) => + wrap('', description, '\n') + + join(['schema', join(directives, ' '), block(operationTypes)], ' '), + }, + OperationTypeDefinition: { + leave: ({ operation, type }) => operation + ': ' + type, + }, + ScalarTypeDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + + join(['scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + FieldDefinition: { + leave: ({ description, name, arguments: args, type, directives }) => + wrap('', description, '\n') + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + ': ' + + type + + wrap(' ', join(directives, ' ')), + }, + InputValueDefinition: { + leave: ({ description, name, type, defaultValue, directives }) => + wrap('', description, '\n') + + join( + [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], + ' ', + ), + }, + InterfaceTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeDefinition: { + leave: ({ description, name, directives, types }) => + wrap('', description, '\n') + + join( + ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], + ' ', + ), + }, + EnumTypeDefinition: { + leave: ({ description, name, directives, values }) => + wrap('', description, '\n') + + join(['enum', name, join(directives, ' '), block(values)], ' '), + }, + EnumValueDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + join([name, join(directives, ' ')], ' '), + }, + InputObjectTypeDefinition: { + leave: ({ description, name, directives, fields }) => + wrap('', description, '\n') + + join(['input', name, join(directives, ' '), block(fields)], ' '), + }, + DirectiveDefinition: { + leave: ({ description, name, arguments: args, repeatable, locations }) => + wrap('', description, '\n') + + 'directive @' + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + (repeatable ? ' repeatable' : '') + + ' on ' + + join(locations, ' | '), + }, + SchemaExtension: { + leave: ({ directives, operationTypes }) => + join( + ['extend schema', join(directives, ' '), block(operationTypes)], + ' ', + ), + }, + ScalarTypeExtension: { + leave: ({ name, directives }) => + join(['extend scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + InterfaceTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeExtension: { + leave: ({ name, directives, types }) => + join( + [ + 'extend union', + name, + join(directives, ' '), + wrap('= ', join(types, ' | ')), + ], + ' ', + ), + }, + EnumTypeExtension: { + leave: ({ name, directives, values }) => + join(['extend enum', name, join(directives, ' '), block(values)], ' '), + }, + InputObjectTypeExtension: { + leave: ({ name, directives, fields }) => + join(['extend input', name, join(directives, ' '), block(fields)], ' '), + }, +}; +/** + * Given maybeArray, print an empty string if it is null or empty, otherwise + * print all items together separated by separator if provided + */ + +function join(maybeArray, separator = '') { + var _maybeArray$filter$jo; + + return (_maybeArray$filter$jo = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.filter((x) => x).join(separator)) !== null && + _maybeArray$filter$jo !== void 0 + ? _maybeArray$filter$jo + : ''; +} +/** + * Given array, print each item on its own line, wrapped in an indented `{ }` block. + */ + +function block(array) { + return wrap('{\n', indent(join(array, '\n')), '\n}'); +} +/** + * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. + */ + +function wrap(start, maybeString, end = '') { + return maybeString != null && maybeString !== '' + ? start + maybeString + end + : ''; +} + +function indent(str) { + return wrap(' ', str.replace(/\n/g, '\n ')); +} + +function hasMultilineItems(maybeArray) { + var _maybeArray$some; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + return (_maybeArray$some = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.some((str) => str.includes('\n'))) !== null && + _maybeArray$some !== void 0 + ? _maybeArray$some + : false; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/printer.mjs b/graphql-subscription-express/node_modules/graphql/language/printer.mjs new file mode 100644 index 0000000..cffc2bf --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/printer.mjs @@ -0,0 +1,339 @@ +import { printBlockString } from './blockString.mjs'; +import { printString } from './printString.mjs'; +import { visit } from './visitor.mjs'; +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ + +export function print(ast) { + return visit(ast, printDocASTReducer); +} +const MAX_LINE_LENGTH = 80; +const printDocASTReducer = { + Name: { + leave: (node) => node.value, + }, + Variable: { + leave: (node) => '$' + node.name, + }, + // Document + Document: { + leave: (node) => join(node.definitions, '\n\n'), + }, + OperationDefinition: { + leave(node) { + const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); + const prefix = join( + [ + node.operation, + join([node.name, varDefs]), + join(node.directives, ' '), + ], + ' ', + ); // Anonymous queries with no directives or variable definitions can use + // the query short form. + + return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet; + }, + }, + VariableDefinition: { + leave: ({ variable, type, defaultValue, directives }) => + variable + + ': ' + + type + + wrap(' = ', defaultValue) + + wrap(' ', join(directives, ' ')), + }, + SelectionSet: { + leave: ({ selections }) => block(selections), + }, + Field: { + leave({ alias, name, arguments: args, directives, selectionSet }) { + const prefix = wrap('', alias, ': ') + name; + let argsLine = prefix + wrap('(', join(args, ', '), ')'); + + if (argsLine.length > MAX_LINE_LENGTH) { + argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); + } + + return join([argsLine, join(directives, ' '), selectionSet], ' '); + }, + }, + Argument: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Fragments + FragmentSpread: { + leave: ({ name, directives }) => + '...' + name + wrap(' ', join(directives, ' ')), + }, + InlineFragment: { + leave: ({ typeCondition, directives, selectionSet }) => + join( + [ + '...', + wrap('on ', typeCondition), + join(directives, ' '), + selectionSet, + ], + ' ', + ), + }, + FragmentDefinition: { + leave: ( + { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed + ) => + // or removed in the future. + `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` + + `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` + + selectionSet, + }, + // Value + IntValue: { + leave: ({ value }) => value, + }, + FloatValue: { + leave: ({ value }) => value, + }, + StringValue: { + leave: ({ value, block: isBlockString }) => + isBlockString ? printBlockString(value) : printString(value), + }, + BooleanValue: { + leave: ({ value }) => (value ? 'true' : 'false'), + }, + NullValue: { + leave: () => 'null', + }, + EnumValue: { + leave: ({ value }) => value, + }, + ListValue: { + leave: ({ values }) => '[' + join(values, ', ') + ']', + }, + ObjectValue: { + leave: ({ fields }) => '{' + join(fields, ', ') + '}', + }, + ObjectField: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Directive + Directive: { + leave: ({ name, arguments: args }) => + '@' + name + wrap('(', join(args, ', '), ')'), + }, + // Type + NamedType: { + leave: ({ name }) => name, + }, + ListType: { + leave: ({ type }) => '[' + type + ']', + }, + NonNullType: { + leave: ({ type }) => type + '!', + }, + // Type System Definitions + SchemaDefinition: { + leave: ({ description, directives, operationTypes }) => + wrap('', description, '\n') + + join(['schema', join(directives, ' '), block(operationTypes)], ' '), + }, + OperationTypeDefinition: { + leave: ({ operation, type }) => operation + ': ' + type, + }, + ScalarTypeDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + + join(['scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + FieldDefinition: { + leave: ({ description, name, arguments: args, type, directives }) => + wrap('', description, '\n') + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + ': ' + + type + + wrap(' ', join(directives, ' ')), + }, + InputValueDefinition: { + leave: ({ description, name, type, defaultValue, directives }) => + wrap('', description, '\n') + + join( + [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], + ' ', + ), + }, + InterfaceTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeDefinition: { + leave: ({ description, name, directives, types }) => + wrap('', description, '\n') + + join( + ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], + ' ', + ), + }, + EnumTypeDefinition: { + leave: ({ description, name, directives, values }) => + wrap('', description, '\n') + + join(['enum', name, join(directives, ' '), block(values)], ' '), + }, + EnumValueDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + join([name, join(directives, ' ')], ' '), + }, + InputObjectTypeDefinition: { + leave: ({ description, name, directives, fields }) => + wrap('', description, '\n') + + join(['input', name, join(directives, ' '), block(fields)], ' '), + }, + DirectiveDefinition: { + leave: ({ description, name, arguments: args, repeatable, locations }) => + wrap('', description, '\n') + + 'directive @' + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + (repeatable ? ' repeatable' : '') + + ' on ' + + join(locations, ' | '), + }, + SchemaExtension: { + leave: ({ directives, operationTypes }) => + join( + ['extend schema', join(directives, ' '), block(operationTypes)], + ' ', + ), + }, + ScalarTypeExtension: { + leave: ({ name, directives }) => + join(['extend scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + InterfaceTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeExtension: { + leave: ({ name, directives, types }) => + join( + [ + 'extend union', + name, + join(directives, ' '), + wrap('= ', join(types, ' | ')), + ], + ' ', + ), + }, + EnumTypeExtension: { + leave: ({ name, directives, values }) => + join(['extend enum', name, join(directives, ' '), block(values)], ' '), + }, + InputObjectTypeExtension: { + leave: ({ name, directives, fields }) => + join(['extend input', name, join(directives, ' '), block(fields)], ' '), + }, +}; +/** + * Given maybeArray, print an empty string if it is null or empty, otherwise + * print all items together separated by separator if provided + */ + +function join(maybeArray, separator = '') { + var _maybeArray$filter$jo; + + return (_maybeArray$filter$jo = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.filter((x) => x).join(separator)) !== null && + _maybeArray$filter$jo !== void 0 + ? _maybeArray$filter$jo + : ''; +} +/** + * Given array, print each item on its own line, wrapped in an indented `{ }` block. + */ + +function block(array) { + return wrap('{\n', indent(join(array, '\n')), '\n}'); +} +/** + * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. + */ + +function wrap(start, maybeString, end = '') { + return maybeString != null && maybeString !== '' + ? start + maybeString + end + : ''; +} + +function indent(str) { + return wrap(' ', str.replace(/\n/g, '\n ')); +} + +function hasMultilineItems(maybeArray) { + var _maybeArray$some; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + return (_maybeArray$some = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.some((str) => str.includes('\n'))) !== null && + _maybeArray$some !== void 0 + ? _maybeArray$some + : false; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/source.d.ts b/graphql-subscription-express/node_modules/graphql/language/source.d.ts new file mode 100644 index 0000000..8093914 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/source.d.ts @@ -0,0 +1,25 @@ +interface Location { + line: number; + column: number; +} +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +export declare class Source { + body: string; + name: string; + locationOffset: Location; + constructor(body: string, name?: string, locationOffset?: Location); + get [Symbol.toStringTag](): string; +} +/** + * Test if the given value is a Source object. + * + * @internal + */ +export declare function isSource(source: unknown): source is Source; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/language/source.js b/graphql-subscription-express/node_modules/graphql/language/source.js new file mode 100644 index 0000000..4ddef8d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/source.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Source = void 0; +exports.isSource = isSource; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +class Source { + constructor( + body, + name = 'GraphQL request', + locationOffset = { + line: 1, + column: 1, + }, + ) { + typeof body === 'string' || + (0, _devAssert.devAssert)( + false, + `Body must be a string. Received: ${(0, _inspect.inspect)(body)}.`, + ); + this.body = body; + this.name = name; + this.locationOffset = locationOffset; + this.locationOffset.line > 0 || + (0, _devAssert.devAssert)( + false, + 'line in locationOffset is 1-indexed and must be positive.', + ); + this.locationOffset.column > 0 || + (0, _devAssert.devAssert)( + false, + 'column in locationOffset is 1-indexed and must be positive.', + ); + } + + get [Symbol.toStringTag]() { + return 'Source'; + } +} +/** + * Test if the given value is a Source object. + * + * @internal + */ + +exports.Source = Source; + +function isSource(source) { + return (0, _instanceOf.instanceOf)(source, Source); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/source.mjs b/graphql-subscription-express/node_modules/graphql/language/source.mjs new file mode 100644 index 0000000..c15f85e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/source.mjs @@ -0,0 +1,50 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; + +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +export class Source { + constructor( + body, + name = 'GraphQL request', + locationOffset = { + line: 1, + column: 1, + }, + ) { + typeof body === 'string' || + devAssert(false, `Body must be a string. Received: ${inspect(body)}.`); + this.body = body; + this.name = name; + this.locationOffset = locationOffset; + this.locationOffset.line > 0 || + devAssert( + false, + 'line in locationOffset is 1-indexed and must be positive.', + ); + this.locationOffset.column > 0 || + devAssert( + false, + 'column in locationOffset is 1-indexed and must be positive.', + ); + } + + get [Symbol.toStringTag]() { + return 'Source'; + } +} +/** + * Test if the given value is a Source object. + * + * @internal + */ + +export function isSource(source) { + return instanceOf(source, Source); +} diff --git a/graphql-subscription-express/node_modules/graphql/language/tokenKind.d.ts b/graphql-subscription-express/node_modules/graphql/language/tokenKind.d.ts new file mode 100644 index 0000000..6ba30d3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/tokenKind.d.ts @@ -0,0 +1,35 @@ +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +declare enum TokenKind { + SOF = '', + EOF = '', + BANG = '!', + DOLLAR = '$', + AMP = '&', + PAREN_L = '(', + PAREN_R = ')', + SPREAD = '...', + COLON = ':', + EQUALS = '=', + AT = '@', + BRACKET_L = '[', + BRACKET_R = ']', + BRACE_L = '{', + PIPE = '|', + BRACE_R = '}', + NAME = 'Name', + INT = 'Int', + FLOAT = 'Float', + STRING = 'String', + BLOCK_STRING = 'BlockString', + COMMENT = 'Comment', +} +export { TokenKind }; +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ +export declare type TokenKindEnum = typeof TokenKind; diff --git a/graphql-subscription-express/node_modules/graphql/language/tokenKind.js b/graphql-subscription-express/node_modules/graphql/language/tokenKind.js new file mode 100644 index 0000000..67482b4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/tokenKind.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.TokenKind = void 0; + +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +var TokenKind; +exports.TokenKind = TokenKind; + +(function (TokenKind) { + TokenKind['SOF'] = ''; + TokenKind['EOF'] = ''; + TokenKind['BANG'] = '!'; + TokenKind['DOLLAR'] = '$'; + TokenKind['AMP'] = '&'; + TokenKind['PAREN_L'] = '('; + TokenKind['PAREN_R'] = ')'; + TokenKind['SPREAD'] = '...'; + TokenKind['COLON'] = ':'; + TokenKind['EQUALS'] = '='; + TokenKind['AT'] = '@'; + TokenKind['BRACKET_L'] = '['; + TokenKind['BRACKET_R'] = ']'; + TokenKind['BRACE_L'] = '{'; + TokenKind['PIPE'] = '|'; + TokenKind['BRACE_R'] = '}'; + TokenKind['NAME'] = 'Name'; + TokenKind['INT'] = 'Int'; + TokenKind['FLOAT'] = 'Float'; + TokenKind['STRING'] = 'String'; + TokenKind['BLOCK_STRING'] = 'BlockString'; + TokenKind['COMMENT'] = 'Comment'; +})(TokenKind || (exports.TokenKind = TokenKind = {})); +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ diff --git a/graphql-subscription-express/node_modules/graphql/language/tokenKind.mjs b/graphql-subscription-express/node_modules/graphql/language/tokenKind.mjs new file mode 100644 index 0000000..a9024ec --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/tokenKind.mjs @@ -0,0 +1,37 @@ +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +var TokenKind; + +(function (TokenKind) { + TokenKind['SOF'] = ''; + TokenKind['EOF'] = ''; + TokenKind['BANG'] = '!'; + TokenKind['DOLLAR'] = '$'; + TokenKind['AMP'] = '&'; + TokenKind['PAREN_L'] = '('; + TokenKind['PAREN_R'] = ')'; + TokenKind['SPREAD'] = '...'; + TokenKind['COLON'] = ':'; + TokenKind['EQUALS'] = '='; + TokenKind['AT'] = '@'; + TokenKind['BRACKET_L'] = '['; + TokenKind['BRACKET_R'] = ']'; + TokenKind['BRACE_L'] = '{'; + TokenKind['PIPE'] = '|'; + TokenKind['BRACE_R'] = '}'; + TokenKind['NAME'] = 'Name'; + TokenKind['INT'] = 'Int'; + TokenKind['FLOAT'] = 'Float'; + TokenKind['STRING'] = 'String'; + TokenKind['BLOCK_STRING'] = 'BlockString'; + TokenKind['COMMENT'] = 'Comment'; +})(TokenKind || (TokenKind = {})); + +export { TokenKind }; +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ diff --git a/graphql-subscription-express/node_modules/graphql/language/visitor.d.ts b/graphql-subscription-express/node_modules/graphql/language/visitor.d.ts new file mode 100644 index 0000000..1c11366 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/visitor.d.ts @@ -0,0 +1,194 @@ +import type { ASTNode } from './ast'; +import { Kind } from './kinds'; +/** + * A visitor is provided to visit, it contains the collection of + * relevant functions to be called during the visitor's traversal. + */ +export declare type ASTVisitor = EnterLeaveVisitor | KindVisitor; +declare type KindVisitor = { + readonly [NodeT in ASTNode as NodeT['kind']]?: + | ASTVisitFn + | EnterLeaveVisitor; +}; +interface EnterLeaveVisitor { + readonly enter?: ASTVisitFn; + readonly leave?: ASTVisitFn; +} +/** + * A visitor is comprised of visit functions, which are called on each node + * during the visitor's traversal. + */ +export declare type ASTVisitFn = ( + /** The current node being visiting. */ + node: TVisitedNode, + /** The index or key to this node from the parent node or Array. */ + key: string | number | undefined, + /** The parent immediately above this node, which may be an Array. */ + parent: ASTNode | ReadonlyArray | undefined, + /** The key path to get to this node from the root node. */ + path: ReadonlyArray, + /** + * All nodes and Arrays visited before reaching parent of this node. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays which contain the parent of visited node. + */ + ancestors: ReadonlyArray>, +) => any; +/** + * A reducer is comprised of reducer functions which convert AST nodes into + * another form. + */ +export declare type ASTReducer = { + readonly [NodeT in ASTNode as NodeT['kind']]?: { + readonly enter?: ASTVisitFn; + readonly leave: ASTReducerFn; + }; +}; +declare type ASTReducerFn = ( + /** The current node being visiting. */ + node: { + [K in keyof TReducedNode]: ReducedField; + }, + /** The index or key to this node from the parent node or Array. */ + key: string | number | undefined, + /** The parent immediately above this node, which may be an Array. */ + parent: ASTNode | ReadonlyArray | undefined, + /** The key path to get to this node from the root node. */ + path: ReadonlyArray, + /** + * All nodes and Arrays visited before reaching parent of this node. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays which contain the parent of visited node. + */ + ancestors: ReadonlyArray>, +) => R; +declare type ReducedField = T extends null | undefined + ? T + : T extends ReadonlyArray + ? ReadonlyArray + : R; +/** + * A KeyMap describes each the traversable properties of each kind of node. + * + * @deprecated Please inline it. Will be removed in v17 + */ +export declare type ASTVisitorKeyMap = { + [NodeT in ASTNode as NodeT['kind']]?: ReadonlyArray; +}; +export declare const BREAK: unknown; +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ +export declare function visit( + root: N, + visitor: ASTVisitor, + visitorKeys?: ASTVisitorKeyMap, +): N; +export declare function visit( + root: ASTNode, + visitor: ASTReducer, + visitorKeys?: ASTVisitorKeyMap, +): R; +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ +export declare function visitInParallel( + visitors: ReadonlyArray, +): ASTVisitor; +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + */ +export declare function getEnterLeaveForKind( + visitor: ASTVisitor, + kind: Kind, +): EnterLeaveVisitor; +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ +export declare function getVisitFn( + visitor: ASTVisitor, + kind: Kind, + isLeaving: boolean, +): ASTVisitFn | undefined; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/language/visitor.js b/graphql-subscription-express/node_modules/graphql/language/visitor.js new file mode 100644 index 0000000..a9ee5c4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/visitor.js @@ -0,0 +1,377 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.BREAK = void 0; +exports.getEnterLeaveForKind = getEnterLeaveForKind; +exports.getVisitFn = getVisitFn; +exports.visit = visit; +exports.visitInParallel = visitInParallel; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _ast = require('./ast.js'); + +var _kinds = require('./kinds.js'); + +const BREAK = Object.freeze({}); +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ + +exports.BREAK = BREAK; + +function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { + const enterLeaveMap = new Map(); + + for (const kind of Object.values(_kinds.Kind)) { + enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind)); + } + /* eslint-disable no-undef-init */ + + let stack = undefined; + let inArray = Array.isArray(root); + let keys = [root]; + let index = -1; + let edits = []; + let node = root; + let key = undefined; + let parent = undefined; + const path = []; + const ancestors = []; + /* eslint-enable no-undef-init */ + + do { + index++; + const isLeaving = index === keys.length; + const isEdited = isLeaving && edits.length !== 0; + + if (isLeaving) { + key = ancestors.length === 0 ? undefined : path[path.length - 1]; + node = parent; + parent = ancestors.pop(); + + if (isEdited) { + if (inArray) { + node = node.slice(); + let editOffset = 0; + + for (const [editKey, editValue] of edits) { + const arrayKey = editKey - editOffset; + + if (editValue === null) { + node.splice(arrayKey, 1); + editOffset++; + } else { + node[arrayKey] = editValue; + } + } + } else { + node = Object.defineProperties( + {}, + Object.getOwnPropertyDescriptors(node), + ); + + for (const [editKey, editValue] of edits) { + node[editKey] = editValue; + } + } + } + + index = stack.index; + keys = stack.keys; + edits = stack.edits; + inArray = stack.inArray; + stack = stack.prev; + } else if (parent) { + key = inArray ? index : keys[index]; + node = parent[key]; + + if (node === null || node === undefined) { + continue; + } + + path.push(key); + } + + let result; + + if (!Array.isArray(node)) { + var _enterLeaveMap$get, _enterLeaveMap$get2; + + (0, _ast.isNode)(node) || + (0, _devAssert.devAssert)( + false, + `Invalid AST Node: ${(0, _inspect.inspect)(node)}.`, + ); + const visitFn = isLeaving + ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get === void 0 + ? void 0 + : _enterLeaveMap$get.leave + : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get2 === void 0 + ? void 0 + : _enterLeaveMap$get2.enter; + result = + visitFn === null || visitFn === void 0 + ? void 0 + : visitFn.call(visitor, node, key, parent, path, ancestors); + + if (result === BREAK) { + break; + } + + if (result === false) { + if (!isLeaving) { + path.pop(); + continue; + } + } else if (result !== undefined) { + edits.push([key, result]); + + if (!isLeaving) { + if ((0, _ast.isNode)(result)) { + node = result; + } else { + path.pop(); + continue; + } + } + } + } + + if (result === undefined && isEdited) { + edits.push([key, node]); + } + + if (isLeaving) { + path.pop(); + } else { + var _node$kind; + + stack = { + inArray, + index, + keys, + edits, + prev: stack, + }; + inArray = Array.isArray(node); + keys = inArray + ? node + : (_node$kind = visitorKeys[node.kind]) !== null && + _node$kind !== void 0 + ? _node$kind + : []; + index = -1; + edits = []; + + if (parent) { + ancestors.push(parent); + } + + parent = node; + } + } while (stack !== undefined); + + if (edits.length !== 0) { + // New root + return edits[edits.length - 1][1]; + } + + return root; +} +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ + +function visitInParallel(visitors) { + const skipping = new Array(visitors.length).fill(null); + const mergedVisitor = Object.create(null); + + for (const kind of Object.values(_kinds.Kind)) { + let hasVisitor = false; + const enterList = new Array(visitors.length).fill(undefined); + const leaveList = new Array(visitors.length).fill(undefined); + + for (let i = 0; i < visitors.length; ++i) { + const { enter, leave } = getEnterLeaveForKind(visitors[i], kind); + hasVisitor || (hasVisitor = enter != null || leave != null); + enterList[i] = enter; + leaveList[i] = leave; + } + + if (!hasVisitor) { + continue; + } + + const mergedEnterLeave = { + enter(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _enterList$i; + + const result = + (_enterList$i = enterList[i]) === null || _enterList$i === void 0 + ? void 0 + : _enterList$i.apply(visitors[i], args); + + if (result === false) { + skipping[i] = node; + } else if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined) { + return result; + } + } + } + }, + + leave(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _leaveList$i; + + const result = + (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0 + ? void 0 + : _leaveList$i.apply(visitors[i], args); + + if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined && result !== false) { + return result; + } + } else if (skipping[i] === node) { + skipping[i] = null; + } + } + }, + }; + mergedVisitor[kind] = mergedEnterLeave; + } + + return mergedVisitor; +} +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + */ + +function getEnterLeaveForKind(visitor, kind) { + const kindVisitor = visitor[kind]; + + if (typeof kindVisitor === 'object') { + // { Kind: { enter() {}, leave() {} } } + return kindVisitor; + } else if (typeof kindVisitor === 'function') { + // { Kind() {} } + return { + enter: kindVisitor, + leave: undefined, + }; + } // { enter() {}, leave() {} } + + return { + enter: visitor.enter, + leave: visitor.leave, + }; +} +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ + +/* c8 ignore next 8 */ + +function getVisitFn(visitor, kind, isLeaving) { + const { enter, leave } = getEnterLeaveForKind(visitor, kind); + return isLeaving ? leave : enter; +} diff --git a/graphql-subscription-express/node_modules/graphql/language/visitor.mjs b/graphql-subscription-express/node_modules/graphql/language/visitor.mjs new file mode 100644 index 0000000..e3173a3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/language/visitor.mjs @@ -0,0 +1,361 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { isNode, QueryDocumentKeys } from './ast.mjs'; +import { Kind } from './kinds.mjs'; +/** + * A visitor is provided to visit, it contains the collection of + * relevant functions to be called during the visitor's traversal. + */ + +export const BREAK = Object.freeze({}); +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ + +export function visit(root, visitor, visitorKeys = QueryDocumentKeys) { + const enterLeaveMap = new Map(); + + for (const kind of Object.values(Kind)) { + enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind)); + } + /* eslint-disable no-undef-init */ + + let stack = undefined; + let inArray = Array.isArray(root); + let keys = [root]; + let index = -1; + let edits = []; + let node = root; + let key = undefined; + let parent = undefined; + const path = []; + const ancestors = []; + /* eslint-enable no-undef-init */ + + do { + index++; + const isLeaving = index === keys.length; + const isEdited = isLeaving && edits.length !== 0; + + if (isLeaving) { + key = ancestors.length === 0 ? undefined : path[path.length - 1]; + node = parent; + parent = ancestors.pop(); + + if (isEdited) { + if (inArray) { + node = node.slice(); + let editOffset = 0; + + for (const [editKey, editValue] of edits) { + const arrayKey = editKey - editOffset; + + if (editValue === null) { + node.splice(arrayKey, 1); + editOffset++; + } else { + node[arrayKey] = editValue; + } + } + } else { + node = Object.defineProperties( + {}, + Object.getOwnPropertyDescriptors(node), + ); + + for (const [editKey, editValue] of edits) { + node[editKey] = editValue; + } + } + } + + index = stack.index; + keys = stack.keys; + edits = stack.edits; + inArray = stack.inArray; + stack = stack.prev; + } else if (parent) { + key = inArray ? index : keys[index]; + node = parent[key]; + + if (node === null || node === undefined) { + continue; + } + + path.push(key); + } + + let result; + + if (!Array.isArray(node)) { + var _enterLeaveMap$get, _enterLeaveMap$get2; + + isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`); + const visitFn = isLeaving + ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get === void 0 + ? void 0 + : _enterLeaveMap$get.leave + : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get2 === void 0 + ? void 0 + : _enterLeaveMap$get2.enter; + result = + visitFn === null || visitFn === void 0 + ? void 0 + : visitFn.call(visitor, node, key, parent, path, ancestors); + + if (result === BREAK) { + break; + } + + if (result === false) { + if (!isLeaving) { + path.pop(); + continue; + } + } else if (result !== undefined) { + edits.push([key, result]); + + if (!isLeaving) { + if (isNode(result)) { + node = result; + } else { + path.pop(); + continue; + } + } + } + } + + if (result === undefined && isEdited) { + edits.push([key, node]); + } + + if (isLeaving) { + path.pop(); + } else { + var _node$kind; + + stack = { + inArray, + index, + keys, + edits, + prev: stack, + }; + inArray = Array.isArray(node); + keys = inArray + ? node + : (_node$kind = visitorKeys[node.kind]) !== null && + _node$kind !== void 0 + ? _node$kind + : []; + index = -1; + edits = []; + + if (parent) { + ancestors.push(parent); + } + + parent = node; + } + } while (stack !== undefined); + + if (edits.length !== 0) { + // New root + return edits[edits.length - 1][1]; + } + + return root; +} +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ + +export function visitInParallel(visitors) { + const skipping = new Array(visitors.length).fill(null); + const mergedVisitor = Object.create(null); + + for (const kind of Object.values(Kind)) { + let hasVisitor = false; + const enterList = new Array(visitors.length).fill(undefined); + const leaveList = new Array(visitors.length).fill(undefined); + + for (let i = 0; i < visitors.length; ++i) { + const { enter, leave } = getEnterLeaveForKind(visitors[i], kind); + hasVisitor || (hasVisitor = enter != null || leave != null); + enterList[i] = enter; + leaveList[i] = leave; + } + + if (!hasVisitor) { + continue; + } + + const mergedEnterLeave = { + enter(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _enterList$i; + + const result = + (_enterList$i = enterList[i]) === null || _enterList$i === void 0 + ? void 0 + : _enterList$i.apply(visitors[i], args); + + if (result === false) { + skipping[i] = node; + } else if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined) { + return result; + } + } + } + }, + + leave(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _leaveList$i; + + const result = + (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0 + ? void 0 + : _leaveList$i.apply(visitors[i], args); + + if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined && result !== false) { + return result; + } + } else if (skipping[i] === node) { + skipping[i] = null; + } + } + }, + }; + mergedVisitor[kind] = mergedEnterLeave; + } + + return mergedVisitor; +} +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + */ + +export function getEnterLeaveForKind(visitor, kind) { + const kindVisitor = visitor[kind]; + + if (typeof kindVisitor === 'object') { + // { Kind: { enter() {}, leave() {} } } + return kindVisitor; + } else if (typeof kindVisitor === 'function') { + // { Kind() {} } + return { + enter: kindVisitor, + leave: undefined, + }; + } // { enter() {}, leave() {} } + + return { + enter: visitor.enter, + leave: visitor.leave, + }; +} +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ + +/* c8 ignore next 8 */ + +export function getVisitFn(visitor, kind, isLeaving) { + const { enter, leave } = getEnterLeaveForKind(visitor, kind); + return isLeaving ? leave : enter; +} diff --git a/graphql-subscription-express/node_modules/graphql/package.json b/graphql-subscription-express/node_modules/graphql/package.json new file mode 100644 index 0000000..6781819 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/package.json @@ -0,0 +1,39 @@ +{ + "name": "graphql", + "version": "16.8.1", + "description": "A Query Language and Runtime which can target any service.", + "license": "MIT", + "main": "index", + "module": "index.mjs", + "typesVersions": { + ">=4.1.0": { + "*": [ + "*" + ] + }, + "*": { + "*": [ + "NotSupportedTSVersion.d.ts" + ] + } + }, + "sideEffects": false, + "homepage": "https://github.com/graphql/graphql-js", + "bugs": { + "url": "https://github.com/graphql/graphql-js/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/graphql/graphql-js.git" + }, + "keywords": [ + "graphql", + "graphql-js" + ], + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + }, + "publishConfig": { + "tag": "latest" + } +} diff --git a/graphql-subscription-express/node_modules/graphql/subscription/index.d.ts b/graphql-subscription-express/node_modules/graphql/subscription/index.d.ts new file mode 100644 index 0000000..bf81134 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/subscription/index.d.ts @@ -0,0 +1,19 @@ +/** + * NOTE: the `graphql/subscription` module has been deprecated with its + * exported functions integrated into the `graphql/execution` module, to + * better conform with the terminology of the GraphQL specification. + * + * For backwards compatibility, the `graphql/subscription` module + * currently re-exports the moved functions from the `graphql/execution` + * module. In the next major release, the `graphql/subscription` module + * will be dropped entirely. + */ +import type { ExecutionArgs } from '../execution/execute'; +/** + * @deprecated use ExecutionArgs instead. Will be removed in v17 + * + * ExecutionArgs has been broadened to include all properties within SubscriptionArgs. + * The SubscriptionArgs type is retained for backwards compatibility. + */ +export interface SubscriptionArgs extends ExecutionArgs {} +export { subscribe, createSourceEventStream } from '../execution/subscribe'; diff --git a/graphql-subscription-express/node_modules/graphql/subscription/index.js b/graphql-subscription-express/node_modules/graphql/subscription/index.js new file mode 100644 index 0000000..7d39b2d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/subscription/index.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'createSourceEventStream', { + enumerable: true, + get: function () { + return _subscribe.createSourceEventStream; + }, +}); +Object.defineProperty(exports, 'subscribe', { + enumerable: true, + get: function () { + return _subscribe.subscribe; + }, +}); + +var _subscribe = require('../execution/subscribe.js'); diff --git a/graphql-subscription-express/node_modules/graphql/subscription/index.mjs b/graphql-subscription-express/node_modules/graphql/subscription/index.mjs new file mode 100644 index 0000000..222cbcb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/subscription/index.mjs @@ -0,0 +1,19 @@ +/** + * NOTE: the `graphql/subscription` module has been deprecated with its + * exported functions integrated into the `graphql/execution` module, to + * better conform with the terminology of the GraphQL specification. + * + * For backwards compatibility, the `graphql/subscription` module + * currently re-exports the moved functions from the `graphql/execution` + * module. In the next major release, the `graphql/subscription` module + * will be dropped entirely. + */ + +/** + * @deprecated use ExecutionArgs instead. Will be removed in v17 + * + * ExecutionArgs has been broadened to include all properties within SubscriptionArgs. + * The SubscriptionArgs type is retained for backwards compatibility. + */ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export { subscribe, createSourceEventStream } from '../execution/subscribe.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/type/assertName.d.ts b/graphql-subscription-express/node_modules/graphql/type/assertName.d.ts new file mode 100644 index 0000000..1e21508 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/assertName.d.ts @@ -0,0 +1,10 @@ +/** + * Upholds the spec rules about naming. + */ +export declare function assertName(name: string): string; +/** + * Upholds the spec rules about naming enum values. + * + * @internal + */ +export declare function assertEnumValueName(name: string): string; diff --git a/graphql-subscription-express/node_modules/graphql/type/assertName.js b/graphql-subscription-express/node_modules/graphql/type/assertName.js new file mode 100644 index 0000000..1519d36 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/assertName.js @@ -0,0 +1,59 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertEnumValueName = assertEnumValueName; +exports.assertName = assertName; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _characterClasses = require('../language/characterClasses.js'); + +/** + * Upholds the spec rules about naming. + */ +function assertName(name) { + name != null || (0, _devAssert.devAssert)(false, 'Must provide name.'); + typeof name === 'string' || + (0, _devAssert.devAssert)(false, 'Expected name to be a string.'); + + if (name.length === 0) { + throw new _GraphQLError.GraphQLError( + 'Expected name to be a non-empty string.', + ); + } + + for (let i = 1; i < name.length; ++i) { + if (!(0, _characterClasses.isNameContinue)(name.charCodeAt(i))) { + throw new _GraphQLError.GraphQLError( + `Names must only contain [_a-zA-Z0-9] but "${name}" does not.`, + ); + } + } + + if (!(0, _characterClasses.isNameStart)(name.charCodeAt(0))) { + throw new _GraphQLError.GraphQLError( + `Names must start with [_a-zA-Z] but "${name}" does not.`, + ); + } + + return name; +} +/** + * Upholds the spec rules about naming enum values. + * + * @internal + */ + +function assertEnumValueName(name) { + if (name === 'true' || name === 'false' || name === 'null') { + throw new _GraphQLError.GraphQLError( + `Enum values cannot be named: ${name}`, + ); + } + + return assertName(name); +} diff --git a/graphql-subscription-express/node_modules/graphql/type/assertName.mjs b/graphql-subscription-express/node_modules/graphql/type/assertName.mjs new file mode 100644 index 0000000..960e302 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/assertName.mjs @@ -0,0 +1,44 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { isNameContinue, isNameStart } from '../language/characterClasses.mjs'; +/** + * Upholds the spec rules about naming. + */ + +export function assertName(name) { + name != null || devAssert(false, 'Must provide name.'); + typeof name === 'string' || devAssert(false, 'Expected name to be a string.'); + + if (name.length === 0) { + throw new GraphQLError('Expected name to be a non-empty string.'); + } + + for (let i = 1; i < name.length; ++i) { + if (!isNameContinue(name.charCodeAt(i))) { + throw new GraphQLError( + `Names must only contain [_a-zA-Z0-9] but "${name}" does not.`, + ); + } + } + + if (!isNameStart(name.charCodeAt(0))) { + throw new GraphQLError( + `Names must start with [_a-zA-Z] but "${name}" does not.`, + ); + } + + return name; +} +/** + * Upholds the spec rules about naming enum values. + * + * @internal + */ + +export function assertEnumValueName(name) { + if (name === 'true' || name === 'false' || name === 'null') { + throw new GraphQLError(`Enum values cannot be named: ${name}`); + } + + return assertName(name); +} diff --git a/graphql-subscription-express/node_modules/graphql/type/definition.d.ts b/graphql-subscription-express/node_modules/graphql/type/definition.d.ts new file mode 100644 index 0000000..904a449 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/definition.d.ts @@ -0,0 +1,923 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { Path } from '../jsutils/Path'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +import type { + EnumTypeDefinitionNode, + EnumTypeExtensionNode, + EnumValueDefinitionNode, + FieldDefinitionNode, + FieldNode, + FragmentDefinitionNode, + InputObjectTypeDefinitionNode, + InputObjectTypeExtensionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + OperationDefinitionNode, + ScalarTypeDefinitionNode, + ScalarTypeExtensionNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, + ValueNode, +} from '../language/ast'; +import type { GraphQLSchema } from './schema'; +/** + * These are all of the possible kinds of types. + */ +export declare type GraphQLType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + >; +export declare function isType(type: unknown): type is GraphQLType; +export declare function assertType(type: unknown): GraphQLType; +/** + * There are predicates for each kind of GraphQL type. + */ +export declare function isScalarType(type: unknown): type is GraphQLScalarType; +export declare function assertScalarType(type: unknown): GraphQLScalarType; +export declare function isObjectType(type: unknown): type is GraphQLObjectType; +export declare function assertObjectType(type: unknown): GraphQLObjectType; +export declare function isInterfaceType( + type: unknown, +): type is GraphQLInterfaceType; +export declare function assertInterfaceType( + type: unknown, +): GraphQLInterfaceType; +export declare function isUnionType(type: unknown): type is GraphQLUnionType; +export declare function assertUnionType(type: unknown): GraphQLUnionType; +export declare function isEnumType(type: unknown): type is GraphQLEnumType; +export declare function assertEnumType(type: unknown): GraphQLEnumType; +export declare function isInputObjectType( + type: unknown, +): type is GraphQLInputObjectType; +export declare function assertInputObjectType( + type: unknown, +): GraphQLInputObjectType; +export declare function isListType( + type: GraphQLInputType, +): type is GraphQLList; +export declare function isListType( + type: GraphQLOutputType, +): type is GraphQLList; +export declare function isListType( + type: unknown, +): type is GraphQLList; +export declare function assertListType(type: unknown): GraphQLList; +export declare function isNonNullType( + type: GraphQLInputType, +): type is GraphQLNonNull; +export declare function isNonNullType( + type: GraphQLOutputType, +): type is GraphQLNonNull; +export declare function isNonNullType( + type: unknown, +): type is GraphQLNonNull; +export declare function assertNonNullType( + type: unknown, +): GraphQLNonNull; +/** + * These types may be used as input types for arguments and directives. + */ +export declare type GraphQLInputType = + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + >; +export declare function isInputType(type: unknown): type is GraphQLInputType; +export declare function assertInputType(type: unknown): GraphQLInputType; +/** + * These types may be used as output types as the result of fields. + */ +export declare type GraphQLOutputType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + >; +export declare function isOutputType(type: unknown): type is GraphQLOutputType; +export declare function assertOutputType(type: unknown): GraphQLOutputType; +/** + * These types may describe types which may be leaf values. + */ +export declare type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; +export declare function isLeafType(type: unknown): type is GraphQLLeafType; +export declare function assertLeafType(type: unknown): GraphQLLeafType; +/** + * These types may describe the parent context of a selection set. + */ +export declare type GraphQLCompositeType = + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType; +export declare function isCompositeType( + type: unknown, +): type is GraphQLCompositeType; +export declare function assertCompositeType( + type: unknown, +): GraphQLCompositeType; +/** + * These types may describe the parent context of a selection set. + */ +export declare type GraphQLAbstractType = + | GraphQLInterfaceType + | GraphQLUnionType; +export declare function isAbstractType( + type: unknown, +): type is GraphQLAbstractType; +export declare function assertAbstractType(type: unknown): GraphQLAbstractType; +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * ``` + */ +export declare class GraphQLList { + readonly ofType: T; + constructor(ofType: T); + get [Symbol.toStringTag](): string; + toString(): string; + toJSON(): string; +} +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * ``` + * Note: the enforcement of non-nullability occurs within the executor. + */ +export declare class GraphQLNonNull { + readonly ofType: T; + constructor(ofType: T); + get [Symbol.toStringTag](): string; + toString(): string; + toJSON(): string; +} +/** + * These types wrap and modify other types + */ +export declare type GraphQLWrappingType = + | GraphQLList + | GraphQLNonNull; +export declare function isWrappingType( + type: unknown, +): type is GraphQLWrappingType; +export declare function assertWrappingType(type: unknown): GraphQLWrappingType; +/** + * These types can all accept null as a value. + */ +export declare type GraphQLNullableType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList; +export declare function isNullableType( + type: unknown, +): type is GraphQLNullableType; +export declare function assertNullableType(type: unknown): GraphQLNullableType; +export declare function getNullableType(type: undefined | null): void; +export declare function getNullableType( + type: T | GraphQLNonNull, +): T; +export declare function getNullableType( + type: Maybe, +): GraphQLNullableType | undefined; +/** + * These named types do not include modifiers like List or NonNull. + */ +export declare type GraphQLNamedType = + | GraphQLNamedInputType + | GraphQLNamedOutputType; +export declare type GraphQLNamedInputType = + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType; +export declare type GraphQLNamedOutputType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType; +export declare function isNamedType(type: unknown): type is GraphQLNamedType; +export declare function assertNamedType(type: unknown): GraphQLNamedType; +export declare function getNamedType(type: undefined | null): void; +export declare function getNamedType( + type: GraphQLInputType, +): GraphQLNamedInputType; +export declare function getNamedType( + type: GraphQLOutputType, +): GraphQLNamedOutputType; +export declare function getNamedType(type: GraphQLType): GraphQLNamedType; +export declare function getNamedType( + type: Maybe, +): GraphQLNamedType | undefined; +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ +export declare type ThunkReadonlyArray = + | (() => ReadonlyArray) + | ReadonlyArray; +export declare type ThunkObjMap = (() => ObjMap) | ObjMap; +export declare function resolveReadonlyArrayThunk( + thunk: ThunkReadonlyArray, +): ReadonlyArray; +export declare function resolveObjMapThunk(thunk: ThunkObjMap): ObjMap; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLScalarTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function returns `null` or does not return a value + * (i.e. it returns `undefined`) then an error will be raised and a `null` + * value will be returned in the response. It is always better to validate + * + * Example: + * + * ```ts + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (!Number.isFinite(value)) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`, + * ); + * } + * + * if (value % 2 === 0) { + * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`); + * } + * return value; + * } + * }); + * ``` + */ +export declare class GraphQLScalarType< + TInternal = unknown, + TExternal = TInternal, +> { + name: string; + description: Maybe; + specifiedByURL: Maybe; + serialize: GraphQLScalarSerializer; + parseValue: GraphQLScalarValueParser; + parseLiteral: GraphQLScalarLiteralParser; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + toConfig(): GraphQLScalarTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export declare type GraphQLScalarSerializer = ( + outputValue: unknown, +) => TExternal; +export declare type GraphQLScalarValueParser = ( + inputValue: unknown, +) => TInternal; +export declare type GraphQLScalarLiteralParser = ( + valueNode: ValueNode, + variables?: Maybe>, +) => TInternal; +export interface GraphQLScalarTypeConfig { + name: string; + description?: Maybe; + specifiedByURL?: Maybe; + /** Serializes an internal value to include in a response. */ + serialize?: GraphQLScalarSerializer; + /** Parses an externally provided value to use as an input. */ + parseValue?: GraphQLScalarValueParser; + /** Parses an externally provided literal value to use as an input. */ + parseLiteral?: GraphQLScalarLiteralParser; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLScalarTypeNormalizedConfig + extends GraphQLScalarTypeConfig { + serialize: GraphQLScalarSerializer; + parseValue: GraphQLScalarValueParser; + parseLiteral: GraphQLScalarLiteralParser; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * + * We've provided these template arguments because this is an open type and + * you may find them useful. + */ +export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { + [attributeName: string]: unknown; +} +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * ``` + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * ``` + */ +export declare class GraphQLObjectType { + name: string; + description: Maybe; + isTypeOf: Maybe>; + extensions: Readonly>; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _fields; + private _interfaces; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + getFields(): GraphQLFieldMap; + getInterfaces(): ReadonlyArray; + toConfig(): GraphQLObjectTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export declare function defineArguments( + config: GraphQLFieldConfigArgumentMap, +): ReadonlyArray; +/** + * @internal + */ +export declare function argsToArgsConfig( + args: ReadonlyArray, +): GraphQLFieldConfigArgumentMap; +export interface GraphQLObjectTypeConfig { + name: string; + description?: Maybe; + interfaces?: ThunkReadonlyArray; + fields: ThunkObjMap>; + isTypeOf?: Maybe>; + extensions?: Maybe>>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLObjectTypeNormalizedConfig + extends GraphQLObjectTypeConfig { + interfaces: ReadonlyArray; + fields: GraphQLFieldConfigMap; + extensions: Readonly>; + extensionASTNodes: ReadonlyArray; +} +export declare type GraphQLTypeResolver = ( + value: TSource, + context: TContext, + info: GraphQLResolveInfo, + abstractType: GraphQLAbstractType, +) => PromiseOrValue; +export declare type GraphQLIsTypeOfFn = ( + source: TSource, + context: TContext, + info: GraphQLResolveInfo, +) => PromiseOrValue; +export declare type GraphQLFieldResolver< + TSource, + TContext, + TArgs = any, + TResult = unknown, +> = ( + source: TSource, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => TResult; +export interface GraphQLResolveInfo { + readonly fieldName: string; + readonly fieldNodes: ReadonlyArray; + readonly returnType: GraphQLOutputType; + readonly parentType: GraphQLObjectType; + readonly path: Path; + readonly schema: GraphQLSchema; + readonly fragments: ObjMap; + readonly rootValue: unknown; + readonly operation: OperationDefinitionNode; + readonly variableValues: { + [variable: string]: unknown; + }; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * + * We've provided these template arguments because this is an open type and + * you may find them useful. + */ +export interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs = any> { + [attributeName: string]: unknown; +} +export interface GraphQLFieldConfig { + description?: Maybe; + type: GraphQLOutputType; + args?: GraphQLFieldConfigArgumentMap; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason?: Maybe; + extensions?: Maybe< + Readonly> + >; + astNode?: Maybe; +} +export declare type GraphQLFieldConfigArgumentMap = + ObjMap; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLArgumentExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLArgumentConfig { + description?: Maybe; + type: GraphQLInputType; + defaultValue?: unknown; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +export declare type GraphQLFieldConfigMap = ObjMap< + GraphQLFieldConfig +>; +export interface GraphQLField { + name: string; + description: Maybe; + type: GraphQLOutputType; + args: ReadonlyArray; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason: Maybe; + extensions: Readonly>; + astNode: Maybe; +} +export interface GraphQLArgument { + name: string; + description: Maybe; + type: GraphQLInputType; + defaultValue: unknown; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} +export declare function isRequiredArgument(arg: GraphQLArgument): boolean; +export declare type GraphQLFieldMap = ObjMap< + GraphQLField +>; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInterfaceTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * ``` + */ +export declare class GraphQLInterfaceType { + name: string; + description: Maybe; + resolveType: Maybe>; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _fields; + private _interfaces; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + getFields(): GraphQLFieldMap; + getInterfaces(): ReadonlyArray; + toConfig(): GraphQLInterfaceTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLInterfaceTypeConfig { + name: string; + description?: Maybe; + interfaces?: ThunkReadonlyArray; + fields: ThunkObjMap>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +export interface GraphQLInterfaceTypeNormalizedConfig + extends GraphQLInterfaceTypeConfig { + interfaces: ReadonlyArray; + fields: GraphQLFieldConfigMap; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLUnionTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * ``` + */ +export declare class GraphQLUnionType { + name: string; + description: Maybe; + resolveType: Maybe>; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _types; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + getTypes(): ReadonlyArray; + toConfig(): GraphQLUnionTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLUnionTypeConfig { + name: string; + description?: Maybe; + types: ThunkReadonlyArray; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLUnionTypeNormalizedConfig + extends GraphQLUnionTypeConfig { + types: ReadonlyArray; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * ```ts + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +export declare class GraphQLEnumType { + name: string; + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _values; + private _valueLookup; + private _nameLookup; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + getValues(): ReadonlyArray; + getValue(name: string): Maybe; + serialize(outputValue: unknown): Maybe; + parseValue(inputValue: unknown): Maybe; + parseLiteral( + valueNode: ValueNode, + _variables: Maybe>, + ): Maybe; + toConfig(): GraphQLEnumTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLEnumTypeConfig { + name: string; + description?: Maybe; + values: GraphQLEnumValueConfigMap; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLEnumTypeNormalizedConfig extends GraphQLEnumTypeConfig { + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +export declare type GraphQLEnumValueConfigMap = ObjMap; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumValueExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLEnumValueConfig { + description?: Maybe; + value?: any; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +export interface GraphQLEnumValue { + name: string; + description: Maybe; + value: any; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputObjectTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * ``` + */ +export declare class GraphQLInputObjectType { + name: string; + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _fields; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + getFields(): GraphQLInputFieldMap; + toConfig(): GraphQLInputObjectTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLInputObjectTypeConfig { + name: string; + description?: Maybe; + fields: ThunkObjMap; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLInputObjectTypeNormalizedConfig + extends GraphQLInputObjectTypeConfig { + fields: GraphQLInputFieldConfigMap; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputFieldExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLInputFieldConfig { + description?: Maybe; + type: GraphQLInputType; + defaultValue?: unknown; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +export declare type GraphQLInputFieldConfigMap = + ObjMap; +export interface GraphQLInputField { + name: string; + description: Maybe; + type: GraphQLInputType; + defaultValue: unknown; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} +export declare function isRequiredInputField(field: GraphQLInputField): boolean; +export declare type GraphQLInputFieldMap = ObjMap; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/type/definition.js b/graphql-subscription-express/node_modules/graphql/type/definition.js new file mode 100644 index 0000000..b27c083 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/definition.js @@ -0,0 +1,1339 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLUnionType = + exports.GraphQLScalarType = + exports.GraphQLObjectType = + exports.GraphQLNonNull = + exports.GraphQLList = + exports.GraphQLInterfaceType = + exports.GraphQLInputObjectType = + exports.GraphQLEnumType = + void 0; +exports.argsToArgsConfig = argsToArgsConfig; +exports.assertAbstractType = assertAbstractType; +exports.assertCompositeType = assertCompositeType; +exports.assertEnumType = assertEnumType; +exports.assertInputObjectType = assertInputObjectType; +exports.assertInputType = assertInputType; +exports.assertInterfaceType = assertInterfaceType; +exports.assertLeafType = assertLeafType; +exports.assertListType = assertListType; +exports.assertNamedType = assertNamedType; +exports.assertNonNullType = assertNonNullType; +exports.assertNullableType = assertNullableType; +exports.assertObjectType = assertObjectType; +exports.assertOutputType = assertOutputType; +exports.assertScalarType = assertScalarType; +exports.assertType = assertType; +exports.assertUnionType = assertUnionType; +exports.assertWrappingType = assertWrappingType; +exports.defineArguments = defineArguments; +exports.getNamedType = getNamedType; +exports.getNullableType = getNullableType; +exports.isAbstractType = isAbstractType; +exports.isCompositeType = isCompositeType; +exports.isEnumType = isEnumType; +exports.isInputObjectType = isInputObjectType; +exports.isInputType = isInputType; +exports.isInterfaceType = isInterfaceType; +exports.isLeafType = isLeafType; +exports.isListType = isListType; +exports.isNamedType = isNamedType; +exports.isNonNullType = isNonNullType; +exports.isNullableType = isNullableType; +exports.isObjectType = isObjectType; +exports.isOutputType = isOutputType; +exports.isRequiredArgument = isRequiredArgument; +exports.isRequiredInputField = isRequiredInputField; +exports.isScalarType = isScalarType; +exports.isType = isType; +exports.isUnionType = isUnionType; +exports.isWrappingType = isWrappingType; +exports.resolveObjMapThunk = resolveObjMapThunk; +exports.resolveReadonlyArrayThunk = resolveReadonlyArrayThunk; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _didYouMean = require('../jsutils/didYouMean.js'); + +var _identityFunc = require('../jsutils/identityFunc.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _mapValue = require('../jsutils/mapValue.js'); + +var _suggestionList = require('../jsutils/suggestionList.js'); + +var _toObjMap = require('../jsutils/toObjMap.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _valueFromASTUntyped = require('../utilities/valueFromASTUntyped.js'); + +var _assertName = require('./assertName.js'); + +function isType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) || + isListType(type) || + isNonNullType(type) + ); +} + +function assertType(type) { + if (!isType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL type.`, + ); + } + + return type; +} +/** + * There are predicates for each kind of GraphQL type. + */ + +function isScalarType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLScalarType); +} + +function assertScalarType(type) { + if (!isScalarType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Scalar type.`, + ); + } + + return type; +} + +function isObjectType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLObjectType); +} + +function assertObjectType(type) { + if (!isObjectType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Object type.`, + ); + } + + return type; +} + +function isInterfaceType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLInterfaceType); +} + +function assertInterfaceType(type) { + if (!isInterfaceType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Interface type.`, + ); + } + + return type; +} + +function isUnionType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLUnionType); +} + +function assertUnionType(type) { + if (!isUnionType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Union type.`, + ); + } + + return type; +} + +function isEnumType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLEnumType); +} + +function assertEnumType(type) { + if (!isEnumType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Enum type.`, + ); + } + + return type; +} + +function isInputObjectType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLInputObjectType); +} + +function assertInputObjectType(type) { + if (!isInputObjectType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)( + type, + )} to be a GraphQL Input Object type.`, + ); + } + + return type; +} + +function isListType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLList); +} + +function assertListType(type) { + if (!isListType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL List type.`, + ); + } + + return type; +} + +function isNonNullType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLNonNull); +} + +function assertNonNullType(type) { + if (!isNonNullType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Non-Null type.`, + ); + } + + return type; +} +/** + * These types may be used as input types for arguments and directives. + */ + +function isInputType(type) { + return ( + isScalarType(type) || + isEnumType(type) || + isInputObjectType(type) || + (isWrappingType(type) && isInputType(type.ofType)) + ); +} + +function assertInputType(type) { + if (!isInputType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL input type.`, + ); + } + + return type; +} +/** + * These types may be used as output types as the result of fields. + */ + +function isOutputType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + (isWrappingType(type) && isOutputType(type.ofType)) + ); +} + +function assertOutputType(type) { + if (!isOutputType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL output type.`, + ); + } + + return type; +} +/** + * These types may describe types which may be leaf values. + */ + +function isLeafType(type) { + return isScalarType(type) || isEnumType(type); +} + +function assertLeafType(type) { + if (!isLeafType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL leaf type.`, + ); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +function isCompositeType(type) { + return isObjectType(type) || isInterfaceType(type) || isUnionType(type); +} + +function assertCompositeType(type) { + if (!isCompositeType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL composite type.`, + ); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +function isAbstractType(type) { + return isInterfaceType(type) || isUnionType(type); +} + +function assertAbstractType(type) { + if (!isAbstractType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL abstract type.`, + ); + } + + return type; +} +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * ``` + */ + +class GraphQLList { + constructor(ofType) { + isType(ofType) || + (0, _devAssert.devAssert)( + false, + `Expected ${(0, _inspect.inspect)(ofType)} to be a GraphQL type.`, + ); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLList'; + } + + toString() { + return '[' + String(this.ofType) + ']'; + } + + toJSON() { + return this.toString(); + } +} +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * ``` + * Note: the enforcement of non-nullability occurs within the executor. + */ + +exports.GraphQLList = GraphQLList; + +class GraphQLNonNull { + constructor(ofType) { + isNullableType(ofType) || + (0, _devAssert.devAssert)( + false, + `Expected ${(0, _inspect.inspect)( + ofType, + )} to be a GraphQL nullable type.`, + ); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLNonNull'; + } + + toString() { + return String(this.ofType) + '!'; + } + + toJSON() { + return this.toString(); + } +} +/** + * These types wrap and modify other types + */ + +exports.GraphQLNonNull = GraphQLNonNull; + +function isWrappingType(type) { + return isListType(type) || isNonNullType(type); +} + +function assertWrappingType(type) { + if (!isWrappingType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL wrapping type.`, + ); + } + + return type; +} +/** + * These types can all accept null as a value. + */ + +function isNullableType(type) { + return isType(type) && !isNonNullType(type); +} + +function assertNullableType(type) { + if (!isNullableType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL nullable type.`, + ); + } + + return type; +} + +function getNullableType(type) { + if (type) { + return isNonNullType(type) ? type.ofType : type; + } +} +/** + * These named types do not include modifiers like List or NonNull. + */ + +function isNamedType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) + ); +} + +function assertNamedType(type) { + if (!isNamedType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL named type.`, + ); + } + + return type; +} + +function getNamedType(type) { + if (type) { + let unwrappedType = type; + + while (isWrappingType(unwrappedType)) { + unwrappedType = unwrappedType.ofType; + } + + return unwrappedType; + } +} +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ + +function resolveReadonlyArrayThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} + +function resolveObjMapThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function returns `null` or does not return a value + * (i.e. it returns `undefined`) then an error will be raised and a `null` + * value will be returned in the response. It is always better to validate + * + * Example: + * + * ```ts + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (!Number.isFinite(value)) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`, + * ); + * } + * + * if (value % 2 === 0) { + * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`); + * } + * return value; + * } + * }); + * ``` + */ +class GraphQLScalarType { + constructor(config) { + var _config$parseValue, + _config$serialize, + _config$parseLiteral, + _config$extensionASTN; + + const parseValue = + (_config$parseValue = config.parseValue) !== null && + _config$parseValue !== void 0 + ? _config$parseValue + : _identityFunc.identityFunc; + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.specifiedByURL = config.specifiedByURL; + this.serialize = + (_config$serialize = config.serialize) !== null && + _config$serialize !== void 0 + ? _config$serialize + : _identityFunc.identityFunc; + this.parseValue = parseValue; + this.parseLiteral = + (_config$parseLiteral = config.parseLiteral) !== null && + _config$parseLiteral !== void 0 + ? _config$parseLiteral + : (node, variables) => + parseValue( + (0, _valueFromASTUntyped.valueFromASTUntyped)(node, variables), + ); + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + config.specifiedByURL == null || + typeof config.specifiedByURL === 'string' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "specifiedByURL" as a string, ` + + `but got: ${(0, _inspect.inspect)(config.specifiedByURL)}.`, + ); + config.serialize == null || + typeof config.serialize === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`, + ); + + if (config.parseLiteral) { + (typeof config.parseValue === 'function' && + typeof config.parseLiteral === 'function') || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide both "parseValue" and "parseLiteral" functions.`, + ); + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLScalarType'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + specifiedByURL: this.specifiedByURL, + serialize: this.serialize, + parseValue: this.parseValue, + parseLiteral: this.parseLiteral, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLScalarType = GraphQLScalarType; + +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * ``` + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * ``` + */ +class GraphQLObjectType { + constructor(config) { + var _config$extensionASTN2; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.isTypeOf = config.isTypeOf; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN2 = config.extensionASTNodes) !== null && + _config$extensionASTN2 !== void 0 + ? _config$extensionASTN2 + : []; + + this._fields = () => defineFieldMap(config); + + this._interfaces = () => defineInterfaces(config); + + config.isTypeOf == null || + typeof config.isTypeOf === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "isTypeOf" as a function, ` + + `but got: ${(0, _inspect.inspect)(config.isTypeOf)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + isTypeOf: this.isTypeOf, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLObjectType = GraphQLObjectType; + +function defineInterfaces(config) { + var _config$interfaces; + + const interfaces = resolveReadonlyArrayThunk( + (_config$interfaces = config.interfaces) !== null && + _config$interfaces !== void 0 + ? _config$interfaces + : [], + ); + Array.isArray(interfaces) || + (0, _devAssert.devAssert)( + false, + `${config.name} interfaces must be an Array or a function which returns an Array.`, + ); + return interfaces; +} + +function defineFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + (0, _devAssert.devAssert)( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => { + var _fieldConfig$args; + + isPlainObj(fieldConfig) || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} field config must be an object.`, + ); + fieldConfig.resolve == null || + typeof fieldConfig.resolve === 'function' || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} field resolver must be a function if ` + + `provided, but got: ${(0, _inspect.inspect)(fieldConfig.resolve)}.`, + ); + const argsConfig = + (_fieldConfig$args = fieldConfig.args) !== null && + _fieldConfig$args !== void 0 + ? _fieldConfig$args + : {}; + isPlainObj(argsConfig) || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} args must be an object with argument names as keys.`, + ); + return { + name: (0, _assertName.assertName)(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + args: defineArguments(argsConfig), + resolve: fieldConfig.resolve, + subscribe: fieldConfig.subscribe, + deprecationReason: fieldConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +function defineArguments(config) { + return Object.entries(config).map(([argName, argConfig]) => ({ + name: (0, _assertName.assertName)(argName), + description: argConfig.description, + type: argConfig.type, + defaultValue: argConfig.defaultValue, + deprecationReason: argConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(argConfig.extensions), + astNode: argConfig.astNode, + })); +} + +function isPlainObj(obj) { + return (0, _isObjectLike.isObjectLike)(obj) && !Array.isArray(obj); +} + +function fieldsToFieldsConfig(fields) { + return (0, _mapValue.mapValue)(fields, (field) => ({ + description: field.description, + type: field.type, + args: argsToArgsConfig(field.args), + resolve: field.resolve, + subscribe: field.subscribe, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); +} +/** + * @internal + */ + +function argsToArgsConfig(args) { + return (0, _keyValMap.keyValMap)( + args, + (arg) => arg.name, + (arg) => ({ + description: arg.description, + type: arg.type, + defaultValue: arg.defaultValue, + deprecationReason: arg.deprecationReason, + extensions: arg.extensions, + astNode: arg.astNode, + }), + ); +} + +function isRequiredArgument(arg) { + return isNonNullType(arg.type) && arg.defaultValue === undefined; +} + +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * ``` + */ +class GraphQLInterfaceType { + constructor(config) { + var _config$extensionASTN3; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN3 = config.extensionASTNodes) !== null && + _config$extensionASTN3 !== void 0 + ? _config$extensionASTN3 + : []; + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${(0, _inspect.inspect)(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInterfaceType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLInterfaceType = GraphQLInterfaceType; + +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * ``` + */ +class GraphQLUnionType { + constructor(config) { + var _config$extensionASTN4; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN4 = config.extensionASTNodes) !== null && + _config$extensionASTN4 !== void 0 + ? _config$extensionASTN4 + : []; + this._types = defineTypes.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${(0, _inspect.inspect)(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLUnionType'; + } + + getTypes() { + if (typeof this._types === 'function') { + this._types = this._types(); + } + + return this._types; + } + + toConfig() { + return { + name: this.name, + description: this.description, + types: this.getTypes(), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLUnionType = GraphQLUnionType; + +function defineTypes(config) { + const types = resolveReadonlyArrayThunk(config.types); + Array.isArray(types) || + (0, _devAssert.devAssert)( + false, + `Must provide Array of types or a function which returns such an array for Union ${config.name}.`, + ); + return types; +} + +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * ```ts + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +class GraphQLEnumType { + /* */ + constructor(config) { + var _config$extensionASTN5; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN5 = config.extensionASTNodes) !== null && + _config$extensionASTN5 !== void 0 + ? _config$extensionASTN5 + : []; + this._values = defineEnumValues(this.name, config.values); + this._valueLookup = new Map( + this._values.map((enumValue) => [enumValue.value, enumValue]), + ); + this._nameLookup = (0, _keyMap.keyMap)(this._values, (value) => value.name); + } + + get [Symbol.toStringTag]() { + return 'GraphQLEnumType'; + } + + getValues() { + return this._values; + } + + getValue(name) { + return this._nameLookup[name]; + } + + serialize(outputValue) { + const enumValue = this._valueLookup.get(outputValue); + + if (enumValue === undefined) { + throw new _GraphQLError.GraphQLError( + `Enum "${this.name}" cannot represent value: ${(0, _inspect.inspect)( + outputValue, + )}`, + ); + } + + return enumValue.name; + } + + parseValue(inputValue) /* T */ + { + if (typeof inputValue !== 'string') { + const valueStr = (0, _inspect.inspect)(inputValue); + throw new _GraphQLError.GraphQLError( + `Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + ); + } + + const enumValue = this.getValue(inputValue); + + if (enumValue == null) { + throw new _GraphQLError.GraphQLError( + `Value "${inputValue}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, inputValue), + ); + } + + return enumValue.value; + } + + parseLiteral(valueNode, _variables) /* T */ + { + // Note: variables will be resolved to a value before calling this function. + if (valueNode.kind !== _kinds.Kind.ENUM) { + const valueStr = (0, _printer.print)(valueNode); + throw new _GraphQLError.GraphQLError( + `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + const enumValue = this.getValue(valueNode.value); + + if (enumValue == null) { + const valueStr = (0, _printer.print)(valueNode); + throw new _GraphQLError.GraphQLError( + `Value "${valueStr}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + return enumValue.value; + } + + toConfig() { + const values = (0, _keyValMap.keyValMap)( + this.getValues(), + (value) => value.name, + (value) => ({ + description: value.description, + value: value.value, + deprecationReason: value.deprecationReason, + extensions: value.extensions, + astNode: value.astNode, + }), + ); + return { + name: this.name, + description: this.description, + values, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLEnumType = GraphQLEnumType; + +function didYouMeanEnumValue(enumType, unknownValueStr) { + const allNames = enumType.getValues().map((value) => value.name); + const suggestedValues = (0, _suggestionList.suggestionList)( + unknownValueStr, + allNames, + ); + return (0, _didYouMean.didYouMean)('the enum value', suggestedValues); +} + +function defineEnumValues(typeName, valueMap) { + isPlainObj(valueMap) || + (0, _devAssert.devAssert)( + false, + `${typeName} values must be an object with value names as keys.`, + ); + return Object.entries(valueMap).map(([valueName, valueConfig]) => { + isPlainObj(valueConfig) || + (0, _devAssert.devAssert)( + false, + `${typeName}.${valueName} must refer to an object with a "value" key ` + + `representing an internal value but got: ${(0, _inspect.inspect)( + valueConfig, + )}.`, + ); + return { + name: (0, _assertName.assertEnumValueName)(valueName), + description: valueConfig.description, + value: valueConfig.value !== undefined ? valueConfig.value : valueName, + deprecationReason: valueConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(valueConfig.extensions), + astNode: valueConfig.astNode, + }; + }); +} + +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * ``` + */ +class GraphQLInputObjectType { + constructor(config) { + var _config$extensionASTN6; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN6 = config.extensionASTNodes) !== null && + _config$extensionASTN6 !== void 0 + ? _config$extensionASTN6 + : []; + this._fields = defineInputFieldMap.bind(undefined, config); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInputObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + toConfig() { + const fields = (0, _mapValue.mapValue)(this.getFields(), (field) => ({ + description: field.description, + type: field.type, + defaultValue: field.defaultValue, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); + return { + name: this.name, + description: this.description, + fields, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLInputObjectType = GraphQLInputObjectType; + +function defineInputFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + (0, _devAssert.devAssert)( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => { + !('resolve' in fieldConfig) || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`, + ); + return { + name: (0, _assertName.assertName)(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + defaultValue: fieldConfig.defaultValue, + deprecationReason: fieldConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +function isRequiredInputField(field) { + return isNonNullType(field.type) && field.defaultValue === undefined; +} diff --git a/graphql-subscription-express/node_modules/graphql/type/definition.mjs b/graphql-subscription-express/node_modules/graphql/type/definition.mjs new file mode 100644 index 0000000..636afd6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/definition.mjs @@ -0,0 +1,1177 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { didYouMean } from '../jsutils/didYouMean.mjs'; +import { identityFunc } from '../jsutils/identityFunc.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { mapValue } from '../jsutils/mapValue.mjs'; +import { suggestionList } from '../jsutils/suggestionList.mjs'; +import { toObjMap } from '../jsutils/toObjMap.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.mjs'; +import { assertEnumValueName, assertName } from './assertName.mjs'; +export function isType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) || + isListType(type) || + isNonNullType(type) + ); +} +export function assertType(type) { + if (!isType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`); + } + + return type; +} +/** + * There are predicates for each kind of GraphQL type. + */ + +export function isScalarType(type) { + return instanceOf(type, GraphQLScalarType); +} +export function assertScalarType(type) { + if (!isScalarType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`); + } + + return type; +} +export function isObjectType(type) { + return instanceOf(type, GraphQLObjectType); +} +export function assertObjectType(type) { + if (!isObjectType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`); + } + + return type; +} +export function isInterfaceType(type) { + return instanceOf(type, GraphQLInterfaceType); +} +export function assertInterfaceType(type) { + if (!isInterfaceType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL Interface type.`, + ); + } + + return type; +} +export function isUnionType(type) { + return instanceOf(type, GraphQLUnionType); +} +export function assertUnionType(type) { + if (!isUnionType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`); + } + + return type; +} +export function isEnumType(type) { + return instanceOf(type, GraphQLEnumType); +} +export function assertEnumType(type) { + if (!isEnumType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`); + } + + return type; +} +export function isInputObjectType(type) { + return instanceOf(type, GraphQLInputObjectType); +} +export function assertInputObjectType(type) { + if (!isInputObjectType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL Input Object type.`, + ); + } + + return type; +} +export function isListType(type) { + return instanceOf(type, GraphQLList); +} +export function assertListType(type) { + if (!isListType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`); + } + + return type; +} +export function isNonNullType(type) { + return instanceOf(type, GraphQLNonNull); +} +export function assertNonNullType(type) { + if (!isNonNullType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`); + } + + return type; +} +/** + * These types may be used as input types for arguments and directives. + */ + +export function isInputType(type) { + return ( + isScalarType(type) || + isEnumType(type) || + isInputObjectType(type) || + (isWrappingType(type) && isInputType(type.ofType)) + ); +} +export function assertInputType(type) { + if (!isInputType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`); + } + + return type; +} +/** + * These types may be used as output types as the result of fields. + */ + +export function isOutputType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + (isWrappingType(type) && isOutputType(type.ofType)) + ); +} +export function assertOutputType(type) { + if (!isOutputType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`); + } + + return type; +} +/** + * These types may describe types which may be leaf values. + */ + +export function isLeafType(type) { + return isScalarType(type) || isEnumType(type); +} +export function assertLeafType(type) { + if (!isLeafType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +export function isCompositeType(type) { + return isObjectType(type) || isInterfaceType(type) || isUnionType(type); +} +export function assertCompositeType(type) { + if (!isCompositeType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL composite type.`, + ); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +export function isAbstractType(type) { + return isInterfaceType(type) || isUnionType(type); +} +export function assertAbstractType(type) { + if (!isAbstractType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`); + } + + return type; +} +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * ``` + */ + +export class GraphQLList { + constructor(ofType) { + isType(ofType) || + devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL type.`); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLList'; + } + + toString() { + return '[' + String(this.ofType) + ']'; + } + + toJSON() { + return this.toString(); + } +} +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * ``` + * Note: the enforcement of non-nullability occurs within the executor. + */ + +export class GraphQLNonNull { + constructor(ofType) { + isNullableType(ofType) || + devAssert( + false, + `Expected ${inspect(ofType)} to be a GraphQL nullable type.`, + ); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLNonNull'; + } + + toString() { + return String(this.ofType) + '!'; + } + + toJSON() { + return this.toString(); + } +} +/** + * These types wrap and modify other types + */ + +export function isWrappingType(type) { + return isListType(type) || isNonNullType(type); +} +export function assertWrappingType(type) { + if (!isWrappingType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`); + } + + return type; +} +/** + * These types can all accept null as a value. + */ + +export function isNullableType(type) { + return isType(type) && !isNonNullType(type); +} +export function assertNullableType(type) { + if (!isNullableType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`); + } + + return type; +} +export function getNullableType(type) { + if (type) { + return isNonNullType(type) ? type.ofType : type; + } +} +/** + * These named types do not include modifiers like List or NonNull. + */ + +export function isNamedType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) + ); +} +export function assertNamedType(type) { + if (!isNamedType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`); + } + + return type; +} +export function getNamedType(type) { + if (type) { + let unwrappedType = type; + + while (isWrappingType(unwrappedType)) { + unwrappedType = unwrappedType.ofType; + } + + return unwrappedType; + } +} +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ + +export function resolveReadonlyArrayThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} +export function resolveObjMapThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function returns `null` or does not return a value + * (i.e. it returns `undefined`) then an error will be raised and a `null` + * value will be returned in the response. It is always better to validate + * + * Example: + * + * ```ts + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (!Number.isFinite(value)) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`, + * ); + * } + * + * if (value % 2 === 0) { + * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`); + * } + * return value; + * } + * }); + * ``` + */ +export class GraphQLScalarType { + constructor(config) { + var _config$parseValue, + _config$serialize, + _config$parseLiteral, + _config$extensionASTN; + + const parseValue = + (_config$parseValue = config.parseValue) !== null && + _config$parseValue !== void 0 + ? _config$parseValue + : identityFunc; + this.name = assertName(config.name); + this.description = config.description; + this.specifiedByURL = config.specifiedByURL; + this.serialize = + (_config$serialize = config.serialize) !== null && + _config$serialize !== void 0 + ? _config$serialize + : identityFunc; + this.parseValue = parseValue; + this.parseLiteral = + (_config$parseLiteral = config.parseLiteral) !== null && + _config$parseLiteral !== void 0 + ? _config$parseLiteral + : (node, variables) => parseValue(valueFromASTUntyped(node, variables)); + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + config.specifiedByURL == null || + typeof config.specifiedByURL === 'string' || + devAssert( + false, + `${this.name} must provide "specifiedByURL" as a string, ` + + `but got: ${inspect(config.specifiedByURL)}.`, + ); + config.serialize == null || + typeof config.serialize === 'function' || + devAssert( + false, + `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`, + ); + + if (config.parseLiteral) { + (typeof config.parseValue === 'function' && + typeof config.parseLiteral === 'function') || + devAssert( + false, + `${this.name} must provide both "parseValue" and "parseLiteral" functions.`, + ); + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLScalarType'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + specifiedByURL: this.specifiedByURL, + serialize: this.serialize, + parseValue: this.parseValue, + parseLiteral: this.parseLiteral, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * ``` + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * ``` + */ +export class GraphQLObjectType { + constructor(config) { + var _config$extensionASTN2; + + this.name = assertName(config.name); + this.description = config.description; + this.isTypeOf = config.isTypeOf; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN2 = config.extensionASTNodes) !== null && + _config$extensionASTN2 !== void 0 + ? _config$extensionASTN2 + : []; + + this._fields = () => defineFieldMap(config); + + this._interfaces = () => defineInterfaces(config); + + config.isTypeOf == null || + typeof config.isTypeOf === 'function' || + devAssert( + false, + `${this.name} must provide "isTypeOf" as a function, ` + + `but got: ${inspect(config.isTypeOf)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + isTypeOf: this.isTypeOf, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function defineInterfaces(config) { + var _config$interfaces; + + const interfaces = resolveReadonlyArrayThunk( + (_config$interfaces = config.interfaces) !== null && + _config$interfaces !== void 0 + ? _config$interfaces + : [], + ); + Array.isArray(interfaces) || + devAssert( + false, + `${config.name} interfaces must be an Array or a function which returns an Array.`, + ); + return interfaces; +} + +function defineFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + devAssert( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return mapValue(fieldMap, (fieldConfig, fieldName) => { + var _fieldConfig$args; + + isPlainObj(fieldConfig) || + devAssert( + false, + `${config.name}.${fieldName} field config must be an object.`, + ); + fieldConfig.resolve == null || + typeof fieldConfig.resolve === 'function' || + devAssert( + false, + `${config.name}.${fieldName} field resolver must be a function if ` + + `provided, but got: ${inspect(fieldConfig.resolve)}.`, + ); + const argsConfig = + (_fieldConfig$args = fieldConfig.args) !== null && + _fieldConfig$args !== void 0 + ? _fieldConfig$args + : {}; + isPlainObj(argsConfig) || + devAssert( + false, + `${config.name}.${fieldName} args must be an object with argument names as keys.`, + ); + return { + name: assertName(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + args: defineArguments(argsConfig), + resolve: fieldConfig.resolve, + subscribe: fieldConfig.subscribe, + deprecationReason: fieldConfig.deprecationReason, + extensions: toObjMap(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +export function defineArguments(config) { + return Object.entries(config).map(([argName, argConfig]) => ({ + name: assertName(argName), + description: argConfig.description, + type: argConfig.type, + defaultValue: argConfig.defaultValue, + deprecationReason: argConfig.deprecationReason, + extensions: toObjMap(argConfig.extensions), + astNode: argConfig.astNode, + })); +} + +function isPlainObj(obj) { + return isObjectLike(obj) && !Array.isArray(obj); +} + +function fieldsToFieldsConfig(fields) { + return mapValue(fields, (field) => ({ + description: field.description, + type: field.type, + args: argsToArgsConfig(field.args), + resolve: field.resolve, + subscribe: field.subscribe, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); +} +/** + * @internal + */ + +export function argsToArgsConfig(args) { + return keyValMap( + args, + (arg) => arg.name, + (arg) => ({ + description: arg.description, + type: arg.type, + defaultValue: arg.defaultValue, + deprecationReason: arg.deprecationReason, + extensions: arg.extensions, + astNode: arg.astNode, + }), + ); +} +export function isRequiredArgument(arg) { + return isNonNullType(arg.type) && arg.defaultValue === undefined; +} + +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * ``` + */ +export class GraphQLInterfaceType { + constructor(config) { + var _config$extensionASTN3; + + this.name = assertName(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN3 = config.extensionASTNodes) !== null && + _config$extensionASTN3 !== void 0 + ? _config$extensionASTN3 + : []; + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + devAssert( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${inspect(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInterfaceType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * ``` + */ +export class GraphQLUnionType { + constructor(config) { + var _config$extensionASTN4; + + this.name = assertName(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN4 = config.extensionASTNodes) !== null && + _config$extensionASTN4 !== void 0 + ? _config$extensionASTN4 + : []; + this._types = defineTypes.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + devAssert( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${inspect(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLUnionType'; + } + + getTypes() { + if (typeof this._types === 'function') { + this._types = this._types(); + } + + return this._types; + } + + toConfig() { + return { + name: this.name, + description: this.description, + types: this.getTypes(), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function defineTypes(config) { + const types = resolveReadonlyArrayThunk(config.types); + Array.isArray(types) || + devAssert( + false, + `Must provide Array of types or a function which returns such an array for Union ${config.name}.`, + ); + return types; +} + +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * ```ts + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +export class GraphQLEnumType { + /* */ + constructor(config) { + var _config$extensionASTN5; + + this.name = assertName(config.name); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN5 = config.extensionASTNodes) !== null && + _config$extensionASTN5 !== void 0 + ? _config$extensionASTN5 + : []; + this._values = defineEnumValues(this.name, config.values); + this._valueLookup = new Map( + this._values.map((enumValue) => [enumValue.value, enumValue]), + ); + this._nameLookup = keyMap(this._values, (value) => value.name); + } + + get [Symbol.toStringTag]() { + return 'GraphQLEnumType'; + } + + getValues() { + return this._values; + } + + getValue(name) { + return this._nameLookup[name]; + } + + serialize(outputValue) { + const enumValue = this._valueLookup.get(outputValue); + + if (enumValue === undefined) { + throw new GraphQLError( + `Enum "${this.name}" cannot represent value: ${inspect(outputValue)}`, + ); + } + + return enumValue.name; + } + + parseValue(inputValue) /* T */ + { + if (typeof inputValue !== 'string') { + const valueStr = inspect(inputValue); + throw new GraphQLError( + `Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + ); + } + + const enumValue = this.getValue(inputValue); + + if (enumValue == null) { + throw new GraphQLError( + `Value "${inputValue}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, inputValue), + ); + } + + return enumValue.value; + } + + parseLiteral(valueNode, _variables) /* T */ + { + // Note: variables will be resolved to a value before calling this function. + if (valueNode.kind !== Kind.ENUM) { + const valueStr = print(valueNode); + throw new GraphQLError( + `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + const enumValue = this.getValue(valueNode.value); + + if (enumValue == null) { + const valueStr = print(valueNode); + throw new GraphQLError( + `Value "${valueStr}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + return enumValue.value; + } + + toConfig() { + const values = keyValMap( + this.getValues(), + (value) => value.name, + (value) => ({ + description: value.description, + value: value.value, + deprecationReason: value.deprecationReason, + extensions: value.extensions, + astNode: value.astNode, + }), + ); + return { + name: this.name, + description: this.description, + values, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function didYouMeanEnumValue(enumType, unknownValueStr) { + const allNames = enumType.getValues().map((value) => value.name); + const suggestedValues = suggestionList(unknownValueStr, allNames); + return didYouMean('the enum value', suggestedValues); +} + +function defineEnumValues(typeName, valueMap) { + isPlainObj(valueMap) || + devAssert( + false, + `${typeName} values must be an object with value names as keys.`, + ); + return Object.entries(valueMap).map(([valueName, valueConfig]) => { + isPlainObj(valueConfig) || + devAssert( + false, + `${typeName}.${valueName} must refer to an object with a "value" key ` + + `representing an internal value but got: ${inspect(valueConfig)}.`, + ); + return { + name: assertEnumValueName(valueName), + description: valueConfig.description, + value: valueConfig.value !== undefined ? valueConfig.value : valueName, + deprecationReason: valueConfig.deprecationReason, + extensions: toObjMap(valueConfig.extensions), + astNode: valueConfig.astNode, + }; + }); +} + +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * ``` + */ +export class GraphQLInputObjectType { + constructor(config) { + var _config$extensionASTN6; + + this.name = assertName(config.name); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN6 = config.extensionASTNodes) !== null && + _config$extensionASTN6 !== void 0 + ? _config$extensionASTN6 + : []; + this._fields = defineInputFieldMap.bind(undefined, config); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInputObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + toConfig() { + const fields = mapValue(this.getFields(), (field) => ({ + description: field.description, + type: field.type, + defaultValue: field.defaultValue, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); + return { + name: this.name, + description: this.description, + fields, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function defineInputFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + devAssert( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return mapValue(fieldMap, (fieldConfig, fieldName) => { + !('resolve' in fieldConfig) || + devAssert( + false, + `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`, + ); + return { + name: assertName(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + defaultValue: fieldConfig.defaultValue, + deprecationReason: fieldConfig.deprecationReason, + extensions: toObjMap(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +export function isRequiredInputField(field) { + return isNonNullType(field.type) && field.defaultValue === undefined; +} diff --git a/graphql-subscription-express/node_modules/graphql/type/directives.d.ts b/graphql-subscription-express/node_modules/graphql/type/directives.d.ts new file mode 100644 index 0000000..bab5e5c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/directives.d.ts @@ -0,0 +1,86 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DirectiveDefinitionNode } from '../language/ast'; +import { DirectiveLocation } from '../language/directiveLocation'; +import type { + GraphQLArgument, + GraphQLFieldConfigArgumentMap, +} from './definition'; +/** + * Test if the given value is a GraphQL directive. + */ +export declare function isDirective( + directive: unknown, +): directive is GraphQLDirective; +export declare function assertDirective(directive: unknown): GraphQLDirective; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLDirectiveExtensions { + [attributeName: string]: unknown; +} +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +export declare class GraphQLDirective { + name: string; + description: Maybe; + locations: ReadonlyArray; + args: ReadonlyArray; + isRepeatable: boolean; + extensions: Readonly; + astNode: Maybe; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + toConfig(): GraphQLDirectiveNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLDirectiveConfig { + name: string; + description?: Maybe; + locations: ReadonlyArray; + args?: Maybe; + isRepeatable?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig { + args: GraphQLFieldConfigArgumentMap; + isRepeatable: boolean; + extensions: Readonly; +} +/** + * Used to conditionally include fields or fragments. + */ +export declare const GraphQLIncludeDirective: GraphQLDirective; +/** + * Used to conditionally skip (exclude) fields or fragments. + */ +export declare const GraphQLSkipDirective: GraphQLDirective; +/** + * Constant string used for default reason for a deprecation. + */ +export declare const DEFAULT_DEPRECATION_REASON = 'No longer supported'; +/** + * Used to declare element of a GraphQL schema as deprecated. + */ +export declare const GraphQLDeprecatedDirective: GraphQLDirective; +/** + * Used to provide a URL for specifying the behavior of custom scalar definitions. + */ +export declare const GraphQLSpecifiedByDirective: GraphQLDirective; +/** + * The full list of specified directives. + */ +export declare const specifiedDirectives: ReadonlyArray; +export declare function isSpecifiedDirective( + directive: GraphQLDirective, +): boolean; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/type/directives.js b/graphql-subscription-express/node_modules/graphql/type/directives.js new file mode 100644 index 0000000..392e57f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/directives.js @@ -0,0 +1,224 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLSpecifiedByDirective = + exports.GraphQLSkipDirective = + exports.GraphQLIncludeDirective = + exports.GraphQLDirective = + exports.GraphQLDeprecatedDirective = + exports.DEFAULT_DEPRECATION_REASON = + void 0; +exports.assertDirective = assertDirective; +exports.isDirective = isDirective; +exports.isSpecifiedDirective = isSpecifiedDirective; +exports.specifiedDirectives = void 0; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _toObjMap = require('../jsutils/toObjMap.js'); + +var _directiveLocation = require('../language/directiveLocation.js'); + +var _assertName = require('./assertName.js'); + +var _definition = require('./definition.js'); + +var _scalars = require('./scalars.js'); + +/** + * Test if the given value is a GraphQL directive. + */ +function isDirective(directive) { + return (0, _instanceOf.instanceOf)(directive, GraphQLDirective); +} + +function assertDirective(directive) { + if (!isDirective(directive)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(directive)} to be a GraphQL directive.`, + ); + } + + return directive; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +class GraphQLDirective { + constructor(config) { + var _config$isRepeatable, _config$args; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.locations = config.locations; + this.isRepeatable = + (_config$isRepeatable = config.isRepeatable) !== null && + _config$isRepeatable !== void 0 + ? _config$isRepeatable + : false; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + Array.isArray(config.locations) || + (0, _devAssert.devAssert)( + false, + `@${config.name} locations must be an Array.`, + ); + const args = + (_config$args = config.args) !== null && _config$args !== void 0 + ? _config$args + : {}; + ((0, _isObjectLike.isObjectLike)(args) && !Array.isArray(args)) || + (0, _devAssert.devAssert)( + false, + `@${config.name} args must be an object with argument names as keys.`, + ); + this.args = (0, _definition.defineArguments)(args); + } + + get [Symbol.toStringTag]() { + return 'GraphQLDirective'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + locations: this.locations, + args: (0, _definition.argsToArgsConfig)(this.args), + isRepeatable: this.isRepeatable, + extensions: this.extensions, + astNode: this.astNode, + }; + } + + toString() { + return '@' + this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLDirective = GraphQLDirective; + +/** + * Used to conditionally include fields or fragments. + */ +const GraphQLIncludeDirective = new GraphQLDirective({ + name: 'include', + description: + 'Directs the executor to include this field or fragment only when the `if` argument is true.', + locations: [ + _directiveLocation.DirectiveLocation.FIELD, + _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, + _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + description: 'Included when true.', + }, + }, +}); +/** + * Used to conditionally skip (exclude) fields or fragments. + */ + +exports.GraphQLIncludeDirective = GraphQLIncludeDirective; +const GraphQLSkipDirective = new GraphQLDirective({ + name: 'skip', + description: + 'Directs the executor to skip this field or fragment when the `if` argument is true.', + locations: [ + _directiveLocation.DirectiveLocation.FIELD, + _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, + _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + description: 'Skipped when true.', + }, + }, +}); +/** + * Constant string used for default reason for a deprecation. + */ + +exports.GraphQLSkipDirective = GraphQLSkipDirective; +const DEFAULT_DEPRECATION_REASON = 'No longer supported'; +/** + * Used to declare element of a GraphQL schema as deprecated. + */ + +exports.DEFAULT_DEPRECATION_REASON = DEFAULT_DEPRECATION_REASON; +const GraphQLDeprecatedDirective = new GraphQLDirective({ + name: 'deprecated', + description: 'Marks an element of a GraphQL schema as no longer supported.', + locations: [ + _directiveLocation.DirectiveLocation.FIELD_DEFINITION, + _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, + _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, + _directiveLocation.DirectiveLocation.ENUM_VALUE, + ], + args: { + reason: { + type: _scalars.GraphQLString, + description: + 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', + defaultValue: DEFAULT_DEPRECATION_REASON, + }, + }, +}); +/** + * Used to provide a URL for specifying the behavior of custom scalar definitions. + */ + +exports.GraphQLDeprecatedDirective = GraphQLDeprecatedDirective; +const GraphQLSpecifiedByDirective = new GraphQLDirective({ + name: 'specifiedBy', + description: 'Exposes a URL that specifies the behavior of this scalar.', + locations: [_directiveLocation.DirectiveLocation.SCALAR], + args: { + url: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + description: 'The URL that specifies the behavior of this scalar.', + }, + }, +}); +/** + * The full list of specified directives. + */ + +exports.GraphQLSpecifiedByDirective = GraphQLSpecifiedByDirective; +const specifiedDirectives = Object.freeze([ + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, +]); +exports.specifiedDirectives = specifiedDirectives; + +function isSpecifiedDirective(directive) { + return specifiedDirectives.some(({ name }) => name === directive.name); +} diff --git a/graphql-subscription-express/node_modules/graphql/type/directives.mjs b/graphql-subscription-express/node_modules/graphql/type/directives.mjs new file mode 100644 index 0000000..c31196e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/directives.mjs @@ -0,0 +1,190 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { toObjMap } from '../jsutils/toObjMap.mjs'; +import { DirectiveLocation } from '../language/directiveLocation.mjs'; +import { assertName } from './assertName.mjs'; +import { + argsToArgsConfig, + defineArguments, + GraphQLNonNull, +} from './definition.mjs'; +import { GraphQLBoolean, GraphQLString } from './scalars.mjs'; +/** + * Test if the given value is a GraphQL directive. + */ + +export function isDirective(directive) { + return instanceOf(directive, GraphQLDirective); +} +export function assertDirective(directive) { + if (!isDirective(directive)) { + throw new Error( + `Expected ${inspect(directive)} to be a GraphQL directive.`, + ); + } + + return directive; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +export class GraphQLDirective { + constructor(config) { + var _config$isRepeatable, _config$args; + + this.name = assertName(config.name); + this.description = config.description; + this.locations = config.locations; + this.isRepeatable = + (_config$isRepeatable = config.isRepeatable) !== null && + _config$isRepeatable !== void 0 + ? _config$isRepeatable + : false; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + Array.isArray(config.locations) || + devAssert(false, `@${config.name} locations must be an Array.`); + const args = + (_config$args = config.args) !== null && _config$args !== void 0 + ? _config$args + : {}; + (isObjectLike(args) && !Array.isArray(args)) || + devAssert( + false, + `@${config.name} args must be an object with argument names as keys.`, + ); + this.args = defineArguments(args); + } + + get [Symbol.toStringTag]() { + return 'GraphQLDirective'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + locations: this.locations, + args: argsToArgsConfig(this.args), + isRepeatable: this.isRepeatable, + extensions: this.extensions, + astNode: this.astNode, + }; + } + + toString() { + return '@' + this.name; + } + + toJSON() { + return this.toString(); + } +} + +/** + * Used to conditionally include fields or fragments. + */ +export const GraphQLIncludeDirective = new GraphQLDirective({ + name: 'include', + description: + 'Directs the executor to include this field or fragment only when the `if` argument is true.', + locations: [ + DirectiveLocation.FIELD, + DirectiveLocation.FRAGMENT_SPREAD, + DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new GraphQLNonNull(GraphQLBoolean), + description: 'Included when true.', + }, + }, +}); +/** + * Used to conditionally skip (exclude) fields or fragments. + */ + +export const GraphQLSkipDirective = new GraphQLDirective({ + name: 'skip', + description: + 'Directs the executor to skip this field or fragment when the `if` argument is true.', + locations: [ + DirectiveLocation.FIELD, + DirectiveLocation.FRAGMENT_SPREAD, + DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new GraphQLNonNull(GraphQLBoolean), + description: 'Skipped when true.', + }, + }, +}); +/** + * Constant string used for default reason for a deprecation. + */ + +export const DEFAULT_DEPRECATION_REASON = 'No longer supported'; +/** + * Used to declare element of a GraphQL schema as deprecated. + */ + +export const GraphQLDeprecatedDirective = new GraphQLDirective({ + name: 'deprecated', + description: 'Marks an element of a GraphQL schema as no longer supported.', + locations: [ + DirectiveLocation.FIELD_DEFINITION, + DirectiveLocation.ARGUMENT_DEFINITION, + DirectiveLocation.INPUT_FIELD_DEFINITION, + DirectiveLocation.ENUM_VALUE, + ], + args: { + reason: { + type: GraphQLString, + description: + 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', + defaultValue: DEFAULT_DEPRECATION_REASON, + }, + }, +}); +/** + * Used to provide a URL for specifying the behavior of custom scalar definitions. + */ + +export const GraphQLSpecifiedByDirective = new GraphQLDirective({ + name: 'specifiedBy', + description: 'Exposes a URL that specifies the behavior of this scalar.', + locations: [DirectiveLocation.SCALAR], + args: { + url: { + type: new GraphQLNonNull(GraphQLString), + description: 'The URL that specifies the behavior of this scalar.', + }, + }, +}); +/** + * The full list of specified directives. + */ + +export const specifiedDirectives = Object.freeze([ + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, +]); +export function isSpecifiedDirective(directive) { + return specifiedDirectives.some(({ name }) => name === directive.name); +} diff --git a/graphql-subscription-express/node_modules/graphql/type/index.d.ts b/graphql-subscription-express/node_modules/graphql/type/index.d.ts new file mode 100644 index 0000000..f186273 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/index.d.ts @@ -0,0 +1,150 @@ +export type { Path as ResponsePath } from '../jsutils/Path'; +export { isSchema, assertSchema, GraphQLSchema } from './schema'; +export type { GraphQLSchemaConfig, GraphQLSchemaExtensions } from './schema'; +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, + getNullableType, + getNamedType, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, +} from './definition'; +export type { + GraphQLType, + GraphQLInputType, + GraphQLOutputType, + GraphQLLeafType, + GraphQLCompositeType, + GraphQLAbstractType, + GraphQLWrappingType, + GraphQLNullableType, + GraphQLNamedType, + GraphQLNamedInputType, + GraphQLNamedOutputType, + ThunkReadonlyArray, + ThunkObjMap, + GraphQLArgument, + GraphQLArgumentConfig, + GraphQLArgumentExtensions, + GraphQLEnumTypeConfig, + GraphQLEnumTypeExtensions, + GraphQLEnumValue, + GraphQLEnumValueConfig, + GraphQLEnumValueConfigMap, + GraphQLEnumValueExtensions, + GraphQLField, + GraphQLFieldConfig, + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLFieldExtensions, + GraphQLFieldMap, + GraphQLFieldResolver, + GraphQLInputField, + GraphQLInputFieldConfig, + GraphQLInputFieldConfigMap, + GraphQLInputFieldExtensions, + GraphQLInputFieldMap, + GraphQLInputObjectTypeConfig, + GraphQLInputObjectTypeExtensions, + GraphQLInterfaceTypeConfig, + GraphQLInterfaceTypeExtensions, + GraphQLIsTypeOfFn, + GraphQLObjectTypeConfig, + GraphQLObjectTypeExtensions, + GraphQLResolveInfo, + GraphQLScalarTypeConfig, + GraphQLScalarTypeExtensions, + GraphQLTypeResolver, + GraphQLUnionTypeConfig, + GraphQLUnionTypeExtensions, + GraphQLScalarSerializer, + GraphQLScalarValueParser, + GraphQLScalarLiteralParser, +} from './definition'; +export { + isDirective, + assertDirective, + GraphQLDirective, + isSpecifiedDirective, + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, + DEFAULT_DEPRECATION_REASON, +} from './directives'; +export type { + GraphQLDirectiveConfig, + GraphQLDirectiveExtensions, +} from './directives'; +export { + isSpecifiedScalarType, + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, +} from './scalars'; +export { + isIntrospectionType, + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + TypeKind, + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from './introspection'; +export { validateSchema, assertValidSchema } from './validate'; +export { assertName, assertEnumValueName } from './assertName'; diff --git a/graphql-subscription-express/node_modules/graphql/type/index.js b/graphql-subscription-express/node_modules/graphql/type/index.js new file mode 100644 index 0000000..96b2c1b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/index.js @@ -0,0 +1,547 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'DEFAULT_DEPRECATION_REASON', { + enumerable: true, + get: function () { + return _directives.DEFAULT_DEPRECATION_REASON; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MAX_INT', { + enumerable: true, + get: function () { + return _scalars.GRAPHQL_MAX_INT; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MIN_INT', { + enumerable: true, + get: function () { + return _scalars.GRAPHQL_MIN_INT; + }, +}); +Object.defineProperty(exports, 'GraphQLBoolean', { + enumerable: true, + get: function () { + return _scalars.GraphQLBoolean; + }, +}); +Object.defineProperty(exports, 'GraphQLDeprecatedDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLDeprecatedDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLEnumType', { + enumerable: true, + get: function () { + return _definition.GraphQLEnumType; + }, +}); +Object.defineProperty(exports, 'GraphQLFloat', { + enumerable: true, + get: function () { + return _scalars.GraphQLFloat; + }, +}); +Object.defineProperty(exports, 'GraphQLID', { + enumerable: true, + get: function () { + return _scalars.GraphQLID; + }, +}); +Object.defineProperty(exports, 'GraphQLIncludeDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLIncludeDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLInputObjectType', { + enumerable: true, + get: function () { + return _definition.GraphQLInputObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLInt', { + enumerable: true, + get: function () { + return _scalars.GraphQLInt; + }, +}); +Object.defineProperty(exports, 'GraphQLInterfaceType', { + enumerable: true, + get: function () { + return _definition.GraphQLInterfaceType; + }, +}); +Object.defineProperty(exports, 'GraphQLList', { + enumerable: true, + get: function () { + return _definition.GraphQLList; + }, +}); +Object.defineProperty(exports, 'GraphQLNonNull', { + enumerable: true, + get: function () { + return _definition.GraphQLNonNull; + }, +}); +Object.defineProperty(exports, 'GraphQLObjectType', { + enumerable: true, + get: function () { + return _definition.GraphQLObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLScalarType', { + enumerable: true, + get: function () { + return _definition.GraphQLScalarType; + }, +}); +Object.defineProperty(exports, 'GraphQLSchema', { + enumerable: true, + get: function () { + return _schema.GraphQLSchema; + }, +}); +Object.defineProperty(exports, 'GraphQLSkipDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLSkipDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLSpecifiedByDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLSpecifiedByDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLString', { + enumerable: true, + get: function () { + return _scalars.GraphQLString; + }, +}); +Object.defineProperty(exports, 'GraphQLUnionType', { + enumerable: true, + get: function () { + return _definition.GraphQLUnionType; + }, +}); +Object.defineProperty(exports, 'SchemaMetaFieldDef', { + enumerable: true, + get: function () { + return _introspection.SchemaMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'TypeKind', { + enumerable: true, + get: function () { + return _introspection.TypeKind; + }, +}); +Object.defineProperty(exports, 'TypeMetaFieldDef', { + enumerable: true, + get: function () { + return _introspection.TypeMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'TypeNameMetaFieldDef', { + enumerable: true, + get: function () { + return _introspection.TypeNameMetaFieldDef; + }, +}); +Object.defineProperty(exports, '__Directive', { + enumerable: true, + get: function () { + return _introspection.__Directive; + }, +}); +Object.defineProperty(exports, '__DirectiveLocation', { + enumerable: true, + get: function () { + return _introspection.__DirectiveLocation; + }, +}); +Object.defineProperty(exports, '__EnumValue', { + enumerable: true, + get: function () { + return _introspection.__EnumValue; + }, +}); +Object.defineProperty(exports, '__Field', { + enumerable: true, + get: function () { + return _introspection.__Field; + }, +}); +Object.defineProperty(exports, '__InputValue', { + enumerable: true, + get: function () { + return _introspection.__InputValue; + }, +}); +Object.defineProperty(exports, '__Schema', { + enumerable: true, + get: function () { + return _introspection.__Schema; + }, +}); +Object.defineProperty(exports, '__Type', { + enumerable: true, + get: function () { + return _introspection.__Type; + }, +}); +Object.defineProperty(exports, '__TypeKind', { + enumerable: true, + get: function () { + return _introspection.__TypeKind; + }, +}); +Object.defineProperty(exports, 'assertAbstractType', { + enumerable: true, + get: function () { + return _definition.assertAbstractType; + }, +}); +Object.defineProperty(exports, 'assertCompositeType', { + enumerable: true, + get: function () { + return _definition.assertCompositeType; + }, +}); +Object.defineProperty(exports, 'assertDirective', { + enumerable: true, + get: function () { + return _directives.assertDirective; + }, +}); +Object.defineProperty(exports, 'assertEnumType', { + enumerable: true, + get: function () { + return _definition.assertEnumType; + }, +}); +Object.defineProperty(exports, 'assertEnumValueName', { + enumerable: true, + get: function () { + return _assertName.assertEnumValueName; + }, +}); +Object.defineProperty(exports, 'assertInputObjectType', { + enumerable: true, + get: function () { + return _definition.assertInputObjectType; + }, +}); +Object.defineProperty(exports, 'assertInputType', { + enumerable: true, + get: function () { + return _definition.assertInputType; + }, +}); +Object.defineProperty(exports, 'assertInterfaceType', { + enumerable: true, + get: function () { + return _definition.assertInterfaceType; + }, +}); +Object.defineProperty(exports, 'assertLeafType', { + enumerable: true, + get: function () { + return _definition.assertLeafType; + }, +}); +Object.defineProperty(exports, 'assertListType', { + enumerable: true, + get: function () { + return _definition.assertListType; + }, +}); +Object.defineProperty(exports, 'assertName', { + enumerable: true, + get: function () { + return _assertName.assertName; + }, +}); +Object.defineProperty(exports, 'assertNamedType', { + enumerable: true, + get: function () { + return _definition.assertNamedType; + }, +}); +Object.defineProperty(exports, 'assertNonNullType', { + enumerable: true, + get: function () { + return _definition.assertNonNullType; + }, +}); +Object.defineProperty(exports, 'assertNullableType', { + enumerable: true, + get: function () { + return _definition.assertNullableType; + }, +}); +Object.defineProperty(exports, 'assertObjectType', { + enumerable: true, + get: function () { + return _definition.assertObjectType; + }, +}); +Object.defineProperty(exports, 'assertOutputType', { + enumerable: true, + get: function () { + return _definition.assertOutputType; + }, +}); +Object.defineProperty(exports, 'assertScalarType', { + enumerable: true, + get: function () { + return _definition.assertScalarType; + }, +}); +Object.defineProperty(exports, 'assertSchema', { + enumerable: true, + get: function () { + return _schema.assertSchema; + }, +}); +Object.defineProperty(exports, 'assertType', { + enumerable: true, + get: function () { + return _definition.assertType; + }, +}); +Object.defineProperty(exports, 'assertUnionType', { + enumerable: true, + get: function () { + return _definition.assertUnionType; + }, +}); +Object.defineProperty(exports, 'assertValidSchema', { + enumerable: true, + get: function () { + return _validate.assertValidSchema; + }, +}); +Object.defineProperty(exports, 'assertWrappingType', { + enumerable: true, + get: function () { + return _definition.assertWrappingType; + }, +}); +Object.defineProperty(exports, 'getNamedType', { + enumerable: true, + get: function () { + return _definition.getNamedType; + }, +}); +Object.defineProperty(exports, 'getNullableType', { + enumerable: true, + get: function () { + return _definition.getNullableType; + }, +}); +Object.defineProperty(exports, 'introspectionTypes', { + enumerable: true, + get: function () { + return _introspection.introspectionTypes; + }, +}); +Object.defineProperty(exports, 'isAbstractType', { + enumerable: true, + get: function () { + return _definition.isAbstractType; + }, +}); +Object.defineProperty(exports, 'isCompositeType', { + enumerable: true, + get: function () { + return _definition.isCompositeType; + }, +}); +Object.defineProperty(exports, 'isDirective', { + enumerable: true, + get: function () { + return _directives.isDirective; + }, +}); +Object.defineProperty(exports, 'isEnumType', { + enumerable: true, + get: function () { + return _definition.isEnumType; + }, +}); +Object.defineProperty(exports, 'isInputObjectType', { + enumerable: true, + get: function () { + return _definition.isInputObjectType; + }, +}); +Object.defineProperty(exports, 'isInputType', { + enumerable: true, + get: function () { + return _definition.isInputType; + }, +}); +Object.defineProperty(exports, 'isInterfaceType', { + enumerable: true, + get: function () { + return _definition.isInterfaceType; + }, +}); +Object.defineProperty(exports, 'isIntrospectionType', { + enumerable: true, + get: function () { + return _introspection.isIntrospectionType; + }, +}); +Object.defineProperty(exports, 'isLeafType', { + enumerable: true, + get: function () { + return _definition.isLeafType; + }, +}); +Object.defineProperty(exports, 'isListType', { + enumerable: true, + get: function () { + return _definition.isListType; + }, +}); +Object.defineProperty(exports, 'isNamedType', { + enumerable: true, + get: function () { + return _definition.isNamedType; + }, +}); +Object.defineProperty(exports, 'isNonNullType', { + enumerable: true, + get: function () { + return _definition.isNonNullType; + }, +}); +Object.defineProperty(exports, 'isNullableType', { + enumerable: true, + get: function () { + return _definition.isNullableType; + }, +}); +Object.defineProperty(exports, 'isObjectType', { + enumerable: true, + get: function () { + return _definition.isObjectType; + }, +}); +Object.defineProperty(exports, 'isOutputType', { + enumerable: true, + get: function () { + return _definition.isOutputType; + }, +}); +Object.defineProperty(exports, 'isRequiredArgument', { + enumerable: true, + get: function () { + return _definition.isRequiredArgument; + }, +}); +Object.defineProperty(exports, 'isRequiredInputField', { + enumerable: true, + get: function () { + return _definition.isRequiredInputField; + }, +}); +Object.defineProperty(exports, 'isScalarType', { + enumerable: true, + get: function () { + return _definition.isScalarType; + }, +}); +Object.defineProperty(exports, 'isSchema', { + enumerable: true, + get: function () { + return _schema.isSchema; + }, +}); +Object.defineProperty(exports, 'isSpecifiedDirective', { + enumerable: true, + get: function () { + return _directives.isSpecifiedDirective; + }, +}); +Object.defineProperty(exports, 'isSpecifiedScalarType', { + enumerable: true, + get: function () { + return _scalars.isSpecifiedScalarType; + }, +}); +Object.defineProperty(exports, 'isType', { + enumerable: true, + get: function () { + return _definition.isType; + }, +}); +Object.defineProperty(exports, 'isUnionType', { + enumerable: true, + get: function () { + return _definition.isUnionType; + }, +}); +Object.defineProperty(exports, 'isWrappingType', { + enumerable: true, + get: function () { + return _definition.isWrappingType; + }, +}); +Object.defineProperty(exports, 'resolveObjMapThunk', { + enumerable: true, + get: function () { + return _definition.resolveObjMapThunk; + }, +}); +Object.defineProperty(exports, 'resolveReadonlyArrayThunk', { + enumerable: true, + get: function () { + return _definition.resolveReadonlyArrayThunk; + }, +}); +Object.defineProperty(exports, 'specifiedDirectives', { + enumerable: true, + get: function () { + return _directives.specifiedDirectives; + }, +}); +Object.defineProperty(exports, 'specifiedScalarTypes', { + enumerable: true, + get: function () { + return _scalars.specifiedScalarTypes; + }, +}); +Object.defineProperty(exports, 'validateSchema', { + enumerable: true, + get: function () { + return _validate.validateSchema; + }, +}); + +var _schema = require('./schema.js'); + +var _definition = require('./definition.js'); + +var _directives = require('./directives.js'); + +var _scalars = require('./scalars.js'); + +var _introspection = require('./introspection.js'); + +var _validate = require('./validate.js'); + +var _assertName = require('./assertName.js'); diff --git a/graphql-subscription-express/node_modules/graphql/type/index.mjs b/graphql-subscription-express/node_modules/graphql/type/index.mjs new file mode 100644 index 0000000..027799d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/index.mjs @@ -0,0 +1,103 @@ +export { + // Predicate + isSchema, // Assertion + assertSchema, // GraphQL Schema definition + GraphQLSchema, +} from './schema.mjs'; +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, // Predicates + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, // Assertions + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, // Un-modifiers + getNullableType, + getNamedType, // Definitions + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, // Type Wrappers + GraphQLList, + GraphQLNonNull, +} from './definition.mjs'; +export { + // Predicate + isDirective, // Assertion + assertDirective, // Directives Definition + GraphQLDirective, // Built-in Directives defined by the Spec + isSpecifiedDirective, + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, +} from './directives.mjs'; +// Common built-in scalar instances. +export { + // Predicate + isSpecifiedScalarType, // Standard GraphQL Scalars + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, // Int boundaries constants + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, +} from './scalars.mjs'; +export { + // Predicate + isIntrospectionType, // GraphQL Types for introspection. + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, // "Enum" of Type Kinds + TypeKind, // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from './introspection.mjs'; // Validate GraphQL schema. + +export { validateSchema, assertValidSchema } from './validate.mjs'; // Upholds the spec rules about naming. + +export { assertName, assertEnumValueName } from './assertName.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/type/introspection.d.ts b/graphql-subscription-express/node_modules/graphql/type/introspection.d.ts new file mode 100644 index 0000000..767ccab --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/introspection.d.ts @@ -0,0 +1,30 @@ +import type { GraphQLField, GraphQLNamedType } from './definition'; +import { GraphQLEnumType, GraphQLObjectType } from './definition'; +export declare const __Schema: GraphQLObjectType; +export declare const __Directive: GraphQLObjectType; +export declare const __DirectiveLocation: GraphQLEnumType; +export declare const __Type: GraphQLObjectType; +export declare const __Field: GraphQLObjectType; +export declare const __InputValue: GraphQLObjectType; +export declare const __EnumValue: GraphQLObjectType; +declare enum TypeKind { + SCALAR = 'SCALAR', + OBJECT = 'OBJECT', + INTERFACE = 'INTERFACE', + UNION = 'UNION', + ENUM = 'ENUM', + INPUT_OBJECT = 'INPUT_OBJECT', + LIST = 'LIST', + NON_NULL = 'NON_NULL', +} +export { TypeKind }; +export declare const __TypeKind: GraphQLEnumType; +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ +export declare const SchemaMetaFieldDef: GraphQLField; +export declare const TypeMetaFieldDef: GraphQLField; +export declare const TypeNameMetaFieldDef: GraphQLField; +export declare const introspectionTypes: ReadonlyArray; +export declare function isIntrospectionType(type: GraphQLNamedType): boolean; diff --git a/graphql-subscription-express/node_modules/graphql/type/introspection.js b/graphql-subscription-express/node_modules/graphql/type/introspection.js new file mode 100644 index 0000000..4a5c933 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/introspection.js @@ -0,0 +1,617 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.introspectionTypes = + exports.__TypeKind = + exports.__Type = + exports.__Schema = + exports.__InputValue = + exports.__Field = + exports.__EnumValue = + exports.__DirectiveLocation = + exports.__Directive = + exports.TypeNameMetaFieldDef = + exports.TypeMetaFieldDef = + exports.TypeKind = + exports.SchemaMetaFieldDef = + void 0; +exports.isIntrospectionType = isIntrospectionType; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _directiveLocation = require('../language/directiveLocation.js'); + +var _printer = require('../language/printer.js'); + +var _astFromValue = require('../utilities/astFromValue.js'); + +var _definition = require('./definition.js'); + +var _scalars = require('./scalars.js'); + +const __Schema = new _definition.GraphQLObjectType({ + name: '__Schema', + description: + 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', + fields: () => ({ + description: { + type: _scalars.GraphQLString, + resolve: (schema) => schema.description, + }, + types: { + description: 'A list of all types supported by this server.', + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + ), + + resolve(schema) { + return Object.values(schema.getTypeMap()); + }, + }, + queryType: { + description: 'The type that query operations will be rooted at.', + type: new _definition.GraphQLNonNull(__Type), + resolve: (schema) => schema.getQueryType(), + }, + mutationType: { + description: + 'If this server supports mutation, the type that mutation operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getMutationType(), + }, + subscriptionType: { + description: + 'If this server support subscription, the type that subscription operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getSubscriptionType(), + }, + directives: { + description: 'A list of all directives supported by this server.', + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__Directive), + ), + ), + resolve: (schema) => schema.getDirectives(), + }, + }), +}); + +exports.__Schema = __Schema; + +const __Directive = new _definition.GraphQLObjectType({ + name: '__Directive', + description: + "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (directive) => directive.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (directive) => directive.description, + }, + isRepeatable: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (directive) => directive.isRepeatable, + }, + locations: { + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__DirectiveLocation), + ), + ), + resolve: (directive) => directive.locations, + }, + args: { + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__InputValue), + ), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + }), +}); + +exports.__Directive = __Directive; + +const __DirectiveLocation = new _definition.GraphQLEnumType({ + name: '__DirectiveLocation', + description: + 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', + values: { + QUERY: { + value: _directiveLocation.DirectiveLocation.QUERY, + description: 'Location adjacent to a query operation.', + }, + MUTATION: { + value: _directiveLocation.DirectiveLocation.MUTATION, + description: 'Location adjacent to a mutation operation.', + }, + SUBSCRIPTION: { + value: _directiveLocation.DirectiveLocation.SUBSCRIPTION, + description: 'Location adjacent to a subscription operation.', + }, + FIELD: { + value: _directiveLocation.DirectiveLocation.FIELD, + description: 'Location adjacent to a field.', + }, + FRAGMENT_DEFINITION: { + value: _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION, + description: 'Location adjacent to a fragment definition.', + }, + FRAGMENT_SPREAD: { + value: _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, + description: 'Location adjacent to a fragment spread.', + }, + INLINE_FRAGMENT: { + value: _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, + description: 'Location adjacent to an inline fragment.', + }, + VARIABLE_DEFINITION: { + value: _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION, + description: 'Location adjacent to a variable definition.', + }, + SCHEMA: { + value: _directiveLocation.DirectiveLocation.SCHEMA, + description: 'Location adjacent to a schema definition.', + }, + SCALAR: { + value: _directiveLocation.DirectiveLocation.SCALAR, + description: 'Location adjacent to a scalar definition.', + }, + OBJECT: { + value: _directiveLocation.DirectiveLocation.OBJECT, + description: 'Location adjacent to an object type definition.', + }, + FIELD_DEFINITION: { + value: _directiveLocation.DirectiveLocation.FIELD_DEFINITION, + description: 'Location adjacent to a field definition.', + }, + ARGUMENT_DEFINITION: { + value: _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, + description: 'Location adjacent to an argument definition.', + }, + INTERFACE: { + value: _directiveLocation.DirectiveLocation.INTERFACE, + description: 'Location adjacent to an interface definition.', + }, + UNION: { + value: _directiveLocation.DirectiveLocation.UNION, + description: 'Location adjacent to a union definition.', + }, + ENUM: { + value: _directiveLocation.DirectiveLocation.ENUM, + description: 'Location adjacent to an enum definition.', + }, + ENUM_VALUE: { + value: _directiveLocation.DirectiveLocation.ENUM_VALUE, + description: 'Location adjacent to an enum value definition.', + }, + INPUT_OBJECT: { + value: _directiveLocation.DirectiveLocation.INPUT_OBJECT, + description: 'Location adjacent to an input object type definition.', + }, + INPUT_FIELD_DEFINITION: { + value: _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, + description: 'Location adjacent to an input object field definition.', + }, + }, +}); + +exports.__DirectiveLocation = __DirectiveLocation; + +const __Type = new _definition.GraphQLObjectType({ + name: '__Type', + description: + 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', + fields: () => ({ + kind: { + type: new _definition.GraphQLNonNull(__TypeKind), + + resolve(type) { + if ((0, _definition.isScalarType)(type)) { + return TypeKind.SCALAR; + } + + if ((0, _definition.isObjectType)(type)) { + return TypeKind.OBJECT; + } + + if ((0, _definition.isInterfaceType)(type)) { + return TypeKind.INTERFACE; + } + + if ((0, _definition.isUnionType)(type)) { + return TypeKind.UNION; + } + + if ((0, _definition.isEnumType)(type)) { + return TypeKind.ENUM; + } + + if ((0, _definition.isInputObjectType)(type)) { + return TypeKind.INPUT_OBJECT; + } + + if ((0, _definition.isListType)(type)) { + return TypeKind.LIST; + } + + if ((0, _definition.isNonNullType)(type)) { + return TypeKind.NON_NULL; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered) + + false || + (0, _invariant.invariant)( + false, + `Unexpected type: "${(0, _inspect.inspect)(type)}".`, + ); + }, + }, + name: { + type: _scalars.GraphQLString, + resolve: (type) => ('name' in type ? type.name : undefined), + }, + description: { + type: _scalars.GraphQLString, + resolve: ( + type, // FIXME: add test case + ) => + /* c8 ignore next */ + 'description' in type ? type.description : undefined, + }, + specifiedByURL: { + type: _scalars.GraphQLString, + resolve: (obj) => + 'specifiedByURL' in obj ? obj.specifiedByURL : undefined, + }, + fields: { + type: new _definition.GraphQLList( + new _definition.GraphQLNonNull(__Field), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) + ) { + const fields = Object.values(type.getFields()); + return includeDeprecated + ? fields + : fields.filter((field) => field.deprecationReason == null); + } + }, + }, + interfaces: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + + resolve(type) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) + ) { + return type.getInterfaces(); + } + }, + }, + possibleTypes: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + + resolve(type, _args, _context, { schema }) { + if ((0, _definition.isAbstractType)(type)) { + return schema.getPossibleTypes(type); + } + }, + }, + enumValues: { + type: new _definition.GraphQLList( + new _definition.GraphQLNonNull(__EnumValue), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if ((0, _definition.isEnumType)(type)) { + const values = type.getValues(); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + inputFields: { + type: new _definition.GraphQLList( + new _definition.GraphQLNonNull(__InputValue), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if ((0, _definition.isInputObjectType)(type)) { + const values = Object.values(type.getFields()); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + ofType: { + type: __Type, + resolve: (type) => ('ofType' in type ? type.ofType : undefined), + }, + }), +}); + +exports.__Type = __Type; + +const __Field = new _definition.GraphQLObjectType({ + name: '__Field', + description: + 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (field) => field.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (field) => field.description, + }, + args: { + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__InputValue), + ), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + type: { + type: new _definition.GraphQLNonNull(__Type), + resolve: (field) => field.type, + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: (field) => field.deprecationReason, + }, + }), +}); + +exports.__Field = __Field; + +const __InputValue = new _definition.GraphQLObjectType({ + name: '__InputValue', + description: + 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (inputValue) => inputValue.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (inputValue) => inputValue.description, + }, + type: { + type: new _definition.GraphQLNonNull(__Type), + resolve: (inputValue) => inputValue.type, + }, + defaultValue: { + type: _scalars.GraphQLString, + description: + 'A GraphQL-formatted string representing the default value for this input value.', + + resolve(inputValue) { + const { type, defaultValue } = inputValue; + const valueAST = (0, _astFromValue.astFromValue)(defaultValue, type); + return valueAST ? (0, _printer.print)(valueAST) : null; + }, + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: (obj) => obj.deprecationReason, + }, + }), +}); + +exports.__InputValue = __InputValue; + +const __EnumValue = new _definition.GraphQLObjectType({ + name: '__EnumValue', + description: + 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (enumValue) => enumValue.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (enumValue) => enumValue.description, + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (enumValue) => enumValue.deprecationReason != null, + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: (enumValue) => enumValue.deprecationReason, + }, + }), +}); + +exports.__EnumValue = __EnumValue; +var TypeKind; +exports.TypeKind = TypeKind; + +(function (TypeKind) { + TypeKind['SCALAR'] = 'SCALAR'; + TypeKind['OBJECT'] = 'OBJECT'; + TypeKind['INTERFACE'] = 'INTERFACE'; + TypeKind['UNION'] = 'UNION'; + TypeKind['ENUM'] = 'ENUM'; + TypeKind['INPUT_OBJECT'] = 'INPUT_OBJECT'; + TypeKind['LIST'] = 'LIST'; + TypeKind['NON_NULL'] = 'NON_NULL'; +})(TypeKind || (exports.TypeKind = TypeKind = {})); + +const __TypeKind = new _definition.GraphQLEnumType({ + name: '__TypeKind', + description: 'An enum describing what kind of type a given `__Type` is.', + values: { + SCALAR: { + value: TypeKind.SCALAR, + description: 'Indicates this type is a scalar.', + }, + OBJECT: { + value: TypeKind.OBJECT, + description: + 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', + }, + INTERFACE: { + value: TypeKind.INTERFACE, + description: + 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.', + }, + UNION: { + value: TypeKind.UNION, + description: + 'Indicates this type is a union. `possibleTypes` is a valid field.', + }, + ENUM: { + value: TypeKind.ENUM, + description: + 'Indicates this type is an enum. `enumValues` is a valid field.', + }, + INPUT_OBJECT: { + value: TypeKind.INPUT_OBJECT, + description: + 'Indicates this type is an input object. `inputFields` is a valid field.', + }, + LIST: { + value: TypeKind.LIST, + description: 'Indicates this type is a list. `ofType` is a valid field.', + }, + NON_NULL: { + value: TypeKind.NON_NULL, + description: + 'Indicates this type is a non-null. `ofType` is a valid field.', + }, + }, +}); +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ + +exports.__TypeKind = __TypeKind; +const SchemaMetaFieldDef = { + name: '__schema', + type: new _definition.GraphQLNonNull(__Schema), + description: 'Access the current type schema of this server.', + args: [], + resolve: (_source, _args, _context, { schema }) => schema, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +exports.SchemaMetaFieldDef = SchemaMetaFieldDef; +const TypeMetaFieldDef = { + name: '__type', + type: __Type, + description: 'Request the type information of a single type.', + args: [ + { + name: 'name', + description: undefined, + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + defaultValue: undefined, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, + }, + ], + resolve: (_source, { name }, _context, { schema }) => schema.getType(name), + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +exports.TypeMetaFieldDef = TypeMetaFieldDef; +const TypeNameMetaFieldDef = { + name: '__typename', + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + description: 'The name of the current Object type at runtime.', + args: [], + resolve: (_source, _args, _context, { parentType }) => parentType.name, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +exports.TypeNameMetaFieldDef = TypeNameMetaFieldDef; +const introspectionTypes = Object.freeze([ + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, +]); +exports.introspectionTypes = introspectionTypes; + +function isIntrospectionType(type) { + return introspectionTypes.some(({ name }) => type.name === name); +} diff --git a/graphql-subscription-express/node_modules/graphql/type/introspection.mjs b/graphql-subscription-express/node_modules/graphql/type/introspection.mjs new file mode 100644 index 0000000..31ee741 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/introspection.mjs @@ -0,0 +1,551 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { DirectiveLocation } from '../language/directiveLocation.mjs'; +import { print } from '../language/printer.mjs'; +import { astFromValue } from '../utilities/astFromValue.mjs'; +import { + GraphQLEnumType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + isAbstractType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from './definition.mjs'; +import { GraphQLBoolean, GraphQLString } from './scalars.mjs'; +export const __Schema = new GraphQLObjectType({ + name: '__Schema', + description: + 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', + fields: () => ({ + description: { + type: GraphQLString, + resolve: (schema) => schema.description, + }, + types: { + description: 'A list of all types supported by this server.', + type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))), + + resolve(schema) { + return Object.values(schema.getTypeMap()); + }, + }, + queryType: { + description: 'The type that query operations will be rooted at.', + type: new GraphQLNonNull(__Type), + resolve: (schema) => schema.getQueryType(), + }, + mutationType: { + description: + 'If this server supports mutation, the type that mutation operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getMutationType(), + }, + subscriptionType: { + description: + 'If this server support subscription, the type that subscription operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getSubscriptionType(), + }, + directives: { + description: 'A list of all directives supported by this server.', + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__Directive)), + ), + resolve: (schema) => schema.getDirectives(), + }, + }), +}); +export const __Directive = new GraphQLObjectType({ + name: '__Directive', + description: + "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (directive) => directive.name, + }, + description: { + type: GraphQLString, + resolve: (directive) => directive.description, + }, + isRepeatable: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (directive) => directive.isRepeatable, + }, + locations: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__DirectiveLocation)), + ), + resolve: (directive) => directive.locations, + }, + args: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__InputValue)), + ), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + }), +}); +export const __DirectiveLocation = new GraphQLEnumType({ + name: '__DirectiveLocation', + description: + 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', + values: { + QUERY: { + value: DirectiveLocation.QUERY, + description: 'Location adjacent to a query operation.', + }, + MUTATION: { + value: DirectiveLocation.MUTATION, + description: 'Location adjacent to a mutation operation.', + }, + SUBSCRIPTION: { + value: DirectiveLocation.SUBSCRIPTION, + description: 'Location adjacent to a subscription operation.', + }, + FIELD: { + value: DirectiveLocation.FIELD, + description: 'Location adjacent to a field.', + }, + FRAGMENT_DEFINITION: { + value: DirectiveLocation.FRAGMENT_DEFINITION, + description: 'Location adjacent to a fragment definition.', + }, + FRAGMENT_SPREAD: { + value: DirectiveLocation.FRAGMENT_SPREAD, + description: 'Location adjacent to a fragment spread.', + }, + INLINE_FRAGMENT: { + value: DirectiveLocation.INLINE_FRAGMENT, + description: 'Location adjacent to an inline fragment.', + }, + VARIABLE_DEFINITION: { + value: DirectiveLocation.VARIABLE_DEFINITION, + description: 'Location adjacent to a variable definition.', + }, + SCHEMA: { + value: DirectiveLocation.SCHEMA, + description: 'Location adjacent to a schema definition.', + }, + SCALAR: { + value: DirectiveLocation.SCALAR, + description: 'Location adjacent to a scalar definition.', + }, + OBJECT: { + value: DirectiveLocation.OBJECT, + description: 'Location adjacent to an object type definition.', + }, + FIELD_DEFINITION: { + value: DirectiveLocation.FIELD_DEFINITION, + description: 'Location adjacent to a field definition.', + }, + ARGUMENT_DEFINITION: { + value: DirectiveLocation.ARGUMENT_DEFINITION, + description: 'Location adjacent to an argument definition.', + }, + INTERFACE: { + value: DirectiveLocation.INTERFACE, + description: 'Location adjacent to an interface definition.', + }, + UNION: { + value: DirectiveLocation.UNION, + description: 'Location adjacent to a union definition.', + }, + ENUM: { + value: DirectiveLocation.ENUM, + description: 'Location adjacent to an enum definition.', + }, + ENUM_VALUE: { + value: DirectiveLocation.ENUM_VALUE, + description: 'Location adjacent to an enum value definition.', + }, + INPUT_OBJECT: { + value: DirectiveLocation.INPUT_OBJECT, + description: 'Location adjacent to an input object type definition.', + }, + INPUT_FIELD_DEFINITION: { + value: DirectiveLocation.INPUT_FIELD_DEFINITION, + description: 'Location adjacent to an input object field definition.', + }, + }, +}); +export const __Type = new GraphQLObjectType({ + name: '__Type', + description: + 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', + fields: () => ({ + kind: { + type: new GraphQLNonNull(__TypeKind), + + resolve(type) { + if (isScalarType(type)) { + return TypeKind.SCALAR; + } + + if (isObjectType(type)) { + return TypeKind.OBJECT; + } + + if (isInterfaceType(type)) { + return TypeKind.INTERFACE; + } + + if (isUnionType(type)) { + return TypeKind.UNION; + } + + if (isEnumType(type)) { + return TypeKind.ENUM; + } + + if (isInputObjectType(type)) { + return TypeKind.INPUT_OBJECT; + } + + if (isListType(type)) { + return TypeKind.LIST; + } + + if (isNonNullType(type)) { + return TypeKind.NON_NULL; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered) + + false || invariant(false, `Unexpected type: "${inspect(type)}".`); + }, + }, + name: { + type: GraphQLString, + resolve: (type) => ('name' in type ? type.name : undefined), + }, + description: { + type: GraphQLString, + resolve: ( + type, // FIXME: add test case + ) => + /* c8 ignore next */ + 'description' in type ? type.description : undefined, + }, + specifiedByURL: { + type: GraphQLString, + resolve: (obj) => + 'specifiedByURL' in obj ? obj.specifiedByURL : undefined, + }, + fields: { + type: new GraphQLList(new GraphQLNonNull(__Field)), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if (isObjectType(type) || isInterfaceType(type)) { + const fields = Object.values(type.getFields()); + return includeDeprecated + ? fields + : fields.filter((field) => field.deprecationReason == null); + } + }, + }, + interfaces: { + type: new GraphQLList(new GraphQLNonNull(__Type)), + + resolve(type) { + if (isObjectType(type) || isInterfaceType(type)) { + return type.getInterfaces(); + } + }, + }, + possibleTypes: { + type: new GraphQLList(new GraphQLNonNull(__Type)), + + resolve(type, _args, _context, { schema }) { + if (isAbstractType(type)) { + return schema.getPossibleTypes(type); + } + }, + }, + enumValues: { + type: new GraphQLList(new GraphQLNonNull(__EnumValue)), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if (isEnumType(type)) { + const values = type.getValues(); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + inputFields: { + type: new GraphQLList(new GraphQLNonNull(__InputValue)), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if (isInputObjectType(type)) { + const values = Object.values(type.getFields()); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + ofType: { + type: __Type, + resolve: (type) => ('ofType' in type ? type.ofType : undefined), + }, + }), +}); +export const __Field = new GraphQLObjectType({ + name: '__Field', + description: + 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (field) => field.name, + }, + description: { + type: GraphQLString, + resolve: (field) => field.description, + }, + args: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__InputValue)), + ), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + type: { + type: new GraphQLNonNull(__Type), + resolve: (field) => field.type, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (field) => field.deprecationReason, + }, + }), +}); +export const __InputValue = new GraphQLObjectType({ + name: '__InputValue', + description: + 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (inputValue) => inputValue.name, + }, + description: { + type: GraphQLString, + resolve: (inputValue) => inputValue.description, + }, + type: { + type: new GraphQLNonNull(__Type), + resolve: (inputValue) => inputValue.type, + }, + defaultValue: { + type: GraphQLString, + description: + 'A GraphQL-formatted string representing the default value for this input value.', + + resolve(inputValue) { + const { type, defaultValue } = inputValue; + const valueAST = astFromValue(defaultValue, type); + return valueAST ? print(valueAST) : null; + }, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (obj) => obj.deprecationReason, + }, + }), +}); +export const __EnumValue = new GraphQLObjectType({ + name: '__EnumValue', + description: + 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (enumValue) => enumValue.name, + }, + description: { + type: GraphQLString, + resolve: (enumValue) => enumValue.description, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (enumValue) => enumValue.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (enumValue) => enumValue.deprecationReason, + }, + }), +}); +var TypeKind; + +(function (TypeKind) { + TypeKind['SCALAR'] = 'SCALAR'; + TypeKind['OBJECT'] = 'OBJECT'; + TypeKind['INTERFACE'] = 'INTERFACE'; + TypeKind['UNION'] = 'UNION'; + TypeKind['ENUM'] = 'ENUM'; + TypeKind['INPUT_OBJECT'] = 'INPUT_OBJECT'; + TypeKind['LIST'] = 'LIST'; + TypeKind['NON_NULL'] = 'NON_NULL'; +})(TypeKind || (TypeKind = {})); + +export { TypeKind }; +export const __TypeKind = new GraphQLEnumType({ + name: '__TypeKind', + description: 'An enum describing what kind of type a given `__Type` is.', + values: { + SCALAR: { + value: TypeKind.SCALAR, + description: 'Indicates this type is a scalar.', + }, + OBJECT: { + value: TypeKind.OBJECT, + description: + 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', + }, + INTERFACE: { + value: TypeKind.INTERFACE, + description: + 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.', + }, + UNION: { + value: TypeKind.UNION, + description: + 'Indicates this type is a union. `possibleTypes` is a valid field.', + }, + ENUM: { + value: TypeKind.ENUM, + description: + 'Indicates this type is an enum. `enumValues` is a valid field.', + }, + INPUT_OBJECT: { + value: TypeKind.INPUT_OBJECT, + description: + 'Indicates this type is an input object. `inputFields` is a valid field.', + }, + LIST: { + value: TypeKind.LIST, + description: 'Indicates this type is a list. `ofType` is a valid field.', + }, + NON_NULL: { + value: TypeKind.NON_NULL, + description: + 'Indicates this type is a non-null. `ofType` is a valid field.', + }, + }, +}); +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ + +export const SchemaMetaFieldDef = { + name: '__schema', + type: new GraphQLNonNull(__Schema), + description: 'Access the current type schema of this server.', + args: [], + resolve: (_source, _args, _context, { schema }) => schema, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +export const TypeMetaFieldDef = { + name: '__type', + type: __Type, + description: 'Request the type information of a single type.', + args: [ + { + name: 'name', + description: undefined, + type: new GraphQLNonNull(GraphQLString), + defaultValue: undefined, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, + }, + ], + resolve: (_source, { name }, _context, { schema }) => schema.getType(name), + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +export const TypeNameMetaFieldDef = { + name: '__typename', + type: new GraphQLNonNull(GraphQLString), + description: 'The name of the current Object type at runtime.', + args: [], + resolve: (_source, _args, _context, { parentType }) => parentType.name, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +export const introspectionTypes = Object.freeze([ + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, +]); +export function isIntrospectionType(type) { + return introspectionTypes.some(({ name }) => type.name === name); +} diff --git a/graphql-subscription-express/node_modules/graphql/type/scalars.d.ts b/graphql-subscription-express/node_modules/graphql/type/scalars.d.ts new file mode 100644 index 0000000..aa151e5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/scalars.d.ts @@ -0,0 +1,19 @@ +import type { GraphQLNamedType } from './definition'; +import { GraphQLScalarType } from './definition'; +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + * */ +export declare const GRAPHQL_MAX_INT = 2147483647; +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + * */ +export declare const GRAPHQL_MIN_INT = -2147483648; +export declare const GraphQLInt: GraphQLScalarType; +export declare const GraphQLFloat: GraphQLScalarType; +export declare const GraphQLString: GraphQLScalarType; +export declare const GraphQLBoolean: GraphQLScalarType; +export declare const GraphQLID: GraphQLScalarType; +export declare const specifiedScalarTypes: ReadonlyArray; +export declare function isSpecifiedScalarType(type: GraphQLNamedType): boolean; diff --git a/graphql-subscription-express/node_modules/graphql/type/scalars.js b/graphql-subscription-express/node_modules/graphql/type/scalars.js new file mode 100644 index 0000000..da04111 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/scalars.js @@ -0,0 +1,369 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLString = + exports.GraphQLInt = + exports.GraphQLID = + exports.GraphQLFloat = + exports.GraphQLBoolean = + exports.GRAPHQL_MIN_INT = + exports.GRAPHQL_MAX_INT = + void 0; +exports.isSpecifiedScalarType = isSpecifiedScalarType; +exports.specifiedScalarTypes = void 0; + +var _inspect = require('../jsutils/inspect.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('./definition.js'); + +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + * */ +const GRAPHQL_MAX_INT = 2147483647; +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + * */ + +exports.GRAPHQL_MAX_INT = GRAPHQL_MAX_INT; +const GRAPHQL_MIN_INT = -2147483648; +exports.GRAPHQL_MIN_INT = GRAPHQL_MIN_INT; +const GraphQLInt = new _definition.GraphQLScalarType({ + name: 'Int', + description: + 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isInteger(num)) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non-integer value: ${(0, _inspect.inspect)( + coercedValue, + )}`, + ); + } + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new _GraphQLError.GraphQLError( + 'Int cannot represent non 32-bit signed integer value: ' + + (0, _inspect.inspect)(coercedValue), + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isInteger(inputValue)) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non-integer value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${inputValue}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.INT) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non-integer value: ${(0, _printer.print)( + valueNode, + )}`, + { + nodes: valueNode, + }, + ); + } + + const num = parseInt(valueNode.value, 10); + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, + { + nodes: valueNode, + }, + ); + } + + return num; + }, +}); +exports.GraphQLInt = GraphQLInt; +const GraphQLFloat = new _definition.GraphQLScalarType({ + name: 'Float', + description: + 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isFinite(num)) { + throw new _GraphQLError.GraphQLError( + `Float cannot represent non numeric value: ${(0, _inspect.inspect)( + coercedValue, + )}`, + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isFinite(inputValue)) { + throw new _GraphQLError.GraphQLError( + `Float cannot represent non numeric value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if ( + valueNode.kind !== _kinds.Kind.FLOAT && + valueNode.kind !== _kinds.Kind.INT + ) { + throw new _GraphQLError.GraphQLError( + `Float cannot represent non numeric value: ${(0, _printer.print)( + valueNode, + )}`, + valueNode, + ); + } + + return parseFloat(valueNode.value); + }, +}); +exports.GraphQLFloat = GraphQLFloat; +const GraphQLString = new _definition.GraphQLScalarType({ + name: 'String', + description: + 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not + // attempt to coerce object, function, symbol, or other types as strings. + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 'true' : 'false'; + } + + if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) { + return coercedValue.toString(); + } + + throw new _GraphQLError.GraphQLError( + `String cannot represent value: ${(0, _inspect.inspect)(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'string') { + throw new _GraphQLError.GraphQLError( + `String cannot represent a non string value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.STRING) { + throw new _GraphQLError.GraphQLError( + `String cannot represent a non string value: ${(0, _printer.print)( + valueNode, + )}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +exports.GraphQLString = GraphQLString; +const GraphQLBoolean = new _definition.GraphQLScalarType({ + name: 'Boolean', + description: 'The `Boolean` scalar type represents `true` or `false`.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue; + } + + if (Number.isFinite(coercedValue)) { + return coercedValue !== 0; + } + + throw new _GraphQLError.GraphQLError( + `Boolean cannot represent a non boolean value: ${(0, _inspect.inspect)( + coercedValue, + )}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'boolean') { + throw new _GraphQLError.GraphQLError( + `Boolean cannot represent a non boolean value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.BOOLEAN) { + throw new _GraphQLError.GraphQLError( + `Boolean cannot represent a non boolean value: ${(0, _printer.print)( + valueNode, + )}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +exports.GraphQLBoolean = GraphQLBoolean; +const GraphQLID = new _definition.GraphQLScalarType({ + name: 'ID', + description: + 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (Number.isInteger(coercedValue)) { + return String(coercedValue); + } + + throw new _GraphQLError.GraphQLError( + `ID cannot represent value: ${(0, _inspect.inspect)(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue === 'string') { + return inputValue; + } + + if (typeof inputValue === 'number' && Number.isInteger(inputValue)) { + return inputValue.toString(); + } + + throw new _GraphQLError.GraphQLError( + `ID cannot represent value: ${(0, _inspect.inspect)(inputValue)}`, + ); + }, + + parseLiteral(valueNode) { + if ( + valueNode.kind !== _kinds.Kind.STRING && + valueNode.kind !== _kinds.Kind.INT + ) { + throw new _GraphQLError.GraphQLError( + 'ID cannot represent a non-string and non-integer value: ' + + (0, _printer.print)(valueNode), + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +exports.GraphQLID = GraphQLID; +const specifiedScalarTypes = Object.freeze([ + GraphQLString, + GraphQLInt, + GraphQLFloat, + GraphQLBoolean, + GraphQLID, +]); +exports.specifiedScalarTypes = specifiedScalarTypes; + +function isSpecifiedScalarType(type) { + return specifiedScalarTypes.some(({ name }) => type.name === name); +} // Support serializing objects with custom valueOf() or toJSON() functions - +// a common way to represent a complex value which can be represented as +// a string (ex: MongoDB id objects). + +function serializeObject(outputValue) { + if ((0, _isObjectLike.isObjectLike)(outputValue)) { + if (typeof outputValue.valueOf === 'function') { + const valueOfResult = outputValue.valueOf(); + + if (!(0, _isObjectLike.isObjectLike)(valueOfResult)) { + return valueOfResult; + } + } + + if (typeof outputValue.toJSON === 'function') { + return outputValue.toJSON(); + } + } + + return outputValue; +} diff --git a/graphql-subscription-express/node_modules/graphql/type/scalars.mjs b/graphql-subscription-express/node_modules/graphql/type/scalars.mjs new file mode 100644 index 0000000..3aa154a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/scalars.mjs @@ -0,0 +1,309 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { GraphQLScalarType } from './definition.mjs'; +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + * */ + +export const GRAPHQL_MAX_INT = 2147483647; +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + * */ + +export const GRAPHQL_MIN_INT = -2147483648; +export const GraphQLInt = new GraphQLScalarType({ + name: 'Int', + description: + 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isInteger(num)) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${inspect(coercedValue)}`, + ); + } + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new GraphQLError( + 'Int cannot represent non 32-bit signed integer value: ' + + inspect(coercedValue), + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isInteger(inputValue)) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${inspect(inputValue)}`, + ); + } + + if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) { + throw new GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${inputValue}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.INT) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${print(valueNode)}`, + { + nodes: valueNode, + }, + ); + } + + const num = parseInt(valueNode.value, 10); + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, + { + nodes: valueNode, + }, + ); + } + + return num; + }, +}); +export const GraphQLFloat = new GraphQLScalarType({ + name: 'Float', + description: + 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isFinite(num)) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${inspect(coercedValue)}`, + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isFinite(inputValue)) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${inspect(inputValue)}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${print(valueNode)}`, + valueNode, + ); + } + + return parseFloat(valueNode.value); + }, +}); +export const GraphQLString = new GraphQLScalarType({ + name: 'String', + description: + 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not + // attempt to coerce object, function, symbol, or other types as strings. + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 'true' : 'false'; + } + + if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) { + return coercedValue.toString(); + } + + throw new GraphQLError( + `String cannot represent value: ${inspect(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'string') { + throw new GraphQLError( + `String cannot represent a non string value: ${inspect(inputValue)}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.STRING) { + throw new GraphQLError( + `String cannot represent a non string value: ${print(valueNode)}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +export const GraphQLBoolean = new GraphQLScalarType({ + name: 'Boolean', + description: 'The `Boolean` scalar type represents `true` or `false`.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue; + } + + if (Number.isFinite(coercedValue)) { + return coercedValue !== 0; + } + + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${inspect(coercedValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'boolean') { + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${inspect(inputValue)}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.BOOLEAN) { + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${print(valueNode)}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +export const GraphQLID = new GraphQLScalarType({ + name: 'ID', + description: + 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (Number.isInteger(coercedValue)) { + return String(coercedValue); + } + + throw new GraphQLError( + `ID cannot represent value: ${inspect(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue === 'string') { + return inputValue; + } + + if (typeof inputValue === 'number' && Number.isInteger(inputValue)) { + return inputValue.toString(); + } + + throw new GraphQLError(`ID cannot represent value: ${inspect(inputValue)}`); + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) { + throw new GraphQLError( + 'ID cannot represent a non-string and non-integer value: ' + + print(valueNode), + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +export const specifiedScalarTypes = Object.freeze([ + GraphQLString, + GraphQLInt, + GraphQLFloat, + GraphQLBoolean, + GraphQLID, +]); +export function isSpecifiedScalarType(type) { + return specifiedScalarTypes.some(({ name }) => type.name === name); +} // Support serializing objects with custom valueOf() or toJSON() functions - +// a common way to represent a complex value which can be represented as +// a string (ex: MongoDB id objects). + +function serializeObject(outputValue) { + if (isObjectLike(outputValue)) { + if (typeof outputValue.valueOf === 'function') { + const valueOfResult = outputValue.valueOf(); + + if (!isObjectLike(valueOfResult)) { + return valueOfResult; + } + } + + if (typeof outputValue.toJSON === 'function') { + return outputValue.toJSON(); + } + } + + return outputValue; +} diff --git a/graphql-subscription-express/node_modules/graphql/type/schema.d.ts b/graphql-subscription-express/node_modules/graphql/type/schema.d.ts new file mode 100644 index 0000000..7b84bb9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/schema.d.ts @@ -0,0 +1,170 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { GraphQLError } from '../error/GraphQLError'; +import type { + SchemaDefinitionNode, + SchemaExtensionNode, +} from '../language/ast'; +import { OperationTypeNode } from '../language/ast'; +import type { + GraphQLAbstractType, + GraphQLInterfaceType, + GraphQLNamedType, + GraphQLObjectType, +} from './definition'; +import type { GraphQLDirective } from './directives'; +/** + * Test if the given value is a GraphQL schema. + */ +export declare function isSchema(schema: unknown): schema is GraphQLSchema; +export declare function assertSchema(schema: unknown): GraphQLSchema; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLSchemaExtensions { + [attributeName: string]: unknown; +} +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * ``` + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * ``` + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * ``` + */ +export declare class GraphQLSchema { + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + __validationErrors: Maybe>; + private _queryType; + private _mutationType; + private _subscriptionType; + private _directives; + private _typeMap; + private _subTypeMap; + private _implementationsMap; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + getQueryType(): Maybe; + getMutationType(): Maybe; + getSubscriptionType(): Maybe; + getRootType(operation: OperationTypeNode): Maybe; + getTypeMap(): TypeMap; + getType(name: string): GraphQLNamedType | undefined; + getPossibleTypes( + abstractType: GraphQLAbstractType, + ): ReadonlyArray; + getImplementations(interfaceType: GraphQLInterfaceType): { + objects: ReadonlyArray; + interfaces: ReadonlyArray; + }; + isSubType( + abstractType: GraphQLAbstractType, + maybeSubType: GraphQLObjectType | GraphQLInterfaceType, + ): boolean; + getDirectives(): ReadonlyArray; + getDirective(name: string): Maybe; + toConfig(): GraphQLSchemaNormalizedConfig; +} +declare type TypeMap = ObjMap; +export interface GraphQLSchemaValidationOptions { + /** + * When building a schema from a GraphQL service's introspection result, it + * might be safe to assume the schema is valid. Set to true to assume the + * produced schema is valid. + * + * Default: false + */ + assumeValid?: boolean; +} +export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions { + description?: Maybe; + query?: Maybe; + mutation?: Maybe; + subscription?: Maybe; + types?: Maybe>; + directives?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +/** + * @internal + */ +export interface GraphQLSchemaNormalizedConfig extends GraphQLSchemaConfig { + description: Maybe; + types: ReadonlyArray; + directives: ReadonlyArray; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; + assumeValid: boolean; +} +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/type/schema.js b/graphql-subscription-express/node_modules/graphql/type/schema.js new file mode 100644 index 0000000..d340e68 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/schema.js @@ -0,0 +1,402 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLSchema = void 0; +exports.assertSchema = assertSchema; +exports.isSchema = isSchema; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _toObjMap = require('../jsutils/toObjMap.js'); + +var _ast = require('../language/ast.js'); + +var _definition = require('./definition.js'); + +var _directives = require('./directives.js'); + +var _introspection = require('./introspection.js'); + +/** + * Test if the given value is a GraphQL schema. + */ +function isSchema(schema) { + return (0, _instanceOf.instanceOf)(schema, GraphQLSchema); +} + +function assertSchema(schema) { + if (!isSchema(schema)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(schema)} to be a GraphQL schema.`, + ); + } + + return schema; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * ``` + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * ``` + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * ``` + */ +class GraphQLSchema { + // Used as a cache for validateSchema(). + constructor(config) { + var _config$extensionASTN, _config$directives; + + // If this schema was built from a source known to be valid, then it may be + // marked with assumeValid to avoid an additional type system validation. + this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. + + (0, _isObjectLike.isObjectLike)(config) || + (0, _devAssert.devAssert)(false, 'Must provide configuration object.'); + !config.types || + Array.isArray(config.types) || + (0, _devAssert.devAssert)( + false, + `"types" must be Array if provided but got: ${(0, _inspect.inspect)( + config.types, + )}.`, + ); + !config.directives || + Array.isArray(config.directives) || + (0, _devAssert.devAssert)( + false, + '"directives" must be Array if provided but got: ' + + `${(0, _inspect.inspect)(config.directives)}.`, + ); + this.description = config.description; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + this._queryType = config.query; + this._mutationType = config.mutation; + this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. + + this._directives = + (_config$directives = config.directives) !== null && + _config$directives !== void 0 + ? _config$directives + : _directives.specifiedDirectives; // To preserve order of user-provided types, we add first to add them to + // the set of "collected" types, so `collectReferencedTypes` ignore them. + + const allReferencedTypes = new Set(config.types); + + if (config.types != null) { + for (const type of config.types) { + // When we ready to process this type, we remove it from "collected" types + // and then add it together with all dependent types in the correct position. + allReferencedTypes.delete(type); + collectReferencedTypes(type, allReferencedTypes); + } + } + + if (this._queryType != null) { + collectReferencedTypes(this._queryType, allReferencedTypes); + } + + if (this._mutationType != null) { + collectReferencedTypes(this._mutationType, allReferencedTypes); + } + + if (this._subscriptionType != null) { + collectReferencedTypes(this._subscriptionType, allReferencedTypes); + } + + for (const directive of this._directives) { + // Directives are not validated until validateSchema() is called. + if ((0, _directives.isDirective)(directive)) { + for (const arg of directive.args) { + collectReferencedTypes(arg.type, allReferencedTypes); + } + } + } + + collectReferencedTypes(_introspection.__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. + + this._typeMap = Object.create(null); + this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. + + this._implementationsMap = Object.create(null); + + for (const namedType of allReferencedTypes) { + if (namedType == null) { + continue; + } + + const typeName = namedType.name; + typeName || + (0, _devAssert.devAssert)( + false, + 'One of the provided types for building the Schema is missing a name.', + ); + + if (this._typeMap[typeName] !== undefined) { + throw new Error( + `Schema must contain uniquely named types but contains multiple types named "${typeName}".`, + ); + } + + this._typeMap[typeName] = namedType; + + if ((0, _definition.isInterfaceType)(namedType)) { + // Store implementations by interface. + for (const iface of namedType.getInterfaces()) { + if ((0, _definition.isInterfaceType)(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.interfaces.push(namedType); + } + } + } else if ((0, _definition.isObjectType)(namedType)) { + // Store implementations by objects. + for (const iface of namedType.getInterfaces()) { + if ((0, _definition.isInterfaceType)(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.objects.push(namedType); + } + } + } + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLSchema'; + } + + getQueryType() { + return this._queryType; + } + + getMutationType() { + return this._mutationType; + } + + getSubscriptionType() { + return this._subscriptionType; + } + + getRootType(operation) { + switch (operation) { + case _ast.OperationTypeNode.QUERY: + return this.getQueryType(); + + case _ast.OperationTypeNode.MUTATION: + return this.getMutationType(); + + case _ast.OperationTypeNode.SUBSCRIPTION: + return this.getSubscriptionType(); + } + } + + getTypeMap() { + return this._typeMap; + } + + getType(name) { + return this.getTypeMap()[name]; + } + + getPossibleTypes(abstractType) { + return (0, _definition.isUnionType)(abstractType) + ? abstractType.getTypes() + : this.getImplementations(abstractType).objects; + } + + getImplementations(interfaceType) { + const implementations = this._implementationsMap[interfaceType.name]; + return implementations !== null && implementations !== void 0 + ? implementations + : { + objects: [], + interfaces: [], + }; + } + + isSubType(abstractType, maybeSubType) { + let map = this._subTypeMap[abstractType.name]; + + if (map === undefined) { + map = Object.create(null); + + if ((0, _definition.isUnionType)(abstractType)) { + for (const type of abstractType.getTypes()) { + map[type.name] = true; + } + } else { + const implementations = this.getImplementations(abstractType); + + for (const type of implementations.objects) { + map[type.name] = true; + } + + for (const type of implementations.interfaces) { + map[type.name] = true; + } + } + + this._subTypeMap[abstractType.name] = map; + } + + return map[maybeSubType.name] !== undefined; + } + + getDirectives() { + return this._directives; + } + + getDirective(name) { + return this.getDirectives().find((directive) => directive.name === name); + } + + toConfig() { + return { + description: this.description, + query: this.getQueryType(), + mutation: this.getMutationType(), + subscription: this.getSubscriptionType(), + types: Object.values(this.getTypeMap()), + directives: this.getDirectives(), + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + assumeValid: this.__validationErrors !== undefined, + }; + } +} + +exports.GraphQLSchema = GraphQLSchema; + +function collectReferencedTypes(type, typeSet) { + const namedType = (0, _definition.getNamedType)(type); + + if (!typeSet.has(namedType)) { + typeSet.add(namedType); + + if ((0, _definition.isUnionType)(namedType)) { + for (const memberType of namedType.getTypes()) { + collectReferencedTypes(memberType, typeSet); + } + } else if ( + (0, _definition.isObjectType)(namedType) || + (0, _definition.isInterfaceType)(namedType) + ) { + for (const interfaceType of namedType.getInterfaces()) { + collectReferencedTypes(interfaceType, typeSet); + } + + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + + for (const arg of field.args) { + collectReferencedTypes(arg.type, typeSet); + } + } + } else if ((0, _definition.isInputObjectType)(namedType)) { + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + } + } + } + + return typeSet; +} diff --git a/graphql-subscription-express/node_modules/graphql/type/schema.mjs b/graphql-subscription-express/node_modules/graphql/type/schema.mjs new file mode 100644 index 0000000..39216df --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/schema.mjs @@ -0,0 +1,381 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { toObjMap } from '../jsutils/toObjMap.mjs'; +import { OperationTypeNode } from '../language/ast.mjs'; +import { + getNamedType, + isInputObjectType, + isInterfaceType, + isObjectType, + isUnionType, +} from './definition.mjs'; +import { isDirective, specifiedDirectives } from './directives.mjs'; +import { __Schema } from './introspection.mjs'; +/** + * Test if the given value is a GraphQL schema. + */ + +export function isSchema(schema) { + return instanceOf(schema, GraphQLSchema); +} +export function assertSchema(schema) { + if (!isSchema(schema)) { + throw new Error(`Expected ${inspect(schema)} to be a GraphQL schema.`); + } + + return schema; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * ``` + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * ``` + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * ``` + */ +export class GraphQLSchema { + // Used as a cache for validateSchema(). + constructor(config) { + var _config$extensionASTN, _config$directives; + + // If this schema was built from a source known to be valid, then it may be + // marked with assumeValid to avoid an additional type system validation. + this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. + + isObjectLike(config) || + devAssert(false, 'Must provide configuration object.'); + !config.types || + Array.isArray(config.types) || + devAssert( + false, + `"types" must be Array if provided but got: ${inspect(config.types)}.`, + ); + !config.directives || + Array.isArray(config.directives) || + devAssert( + false, + '"directives" must be Array if provided but got: ' + + `${inspect(config.directives)}.`, + ); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + this._queryType = config.query; + this._mutationType = config.mutation; + this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. + + this._directives = + (_config$directives = config.directives) !== null && + _config$directives !== void 0 + ? _config$directives + : specifiedDirectives; // To preserve order of user-provided types, we add first to add them to + // the set of "collected" types, so `collectReferencedTypes` ignore them. + + const allReferencedTypes = new Set(config.types); + + if (config.types != null) { + for (const type of config.types) { + // When we ready to process this type, we remove it from "collected" types + // and then add it together with all dependent types in the correct position. + allReferencedTypes.delete(type); + collectReferencedTypes(type, allReferencedTypes); + } + } + + if (this._queryType != null) { + collectReferencedTypes(this._queryType, allReferencedTypes); + } + + if (this._mutationType != null) { + collectReferencedTypes(this._mutationType, allReferencedTypes); + } + + if (this._subscriptionType != null) { + collectReferencedTypes(this._subscriptionType, allReferencedTypes); + } + + for (const directive of this._directives) { + // Directives are not validated until validateSchema() is called. + if (isDirective(directive)) { + for (const arg of directive.args) { + collectReferencedTypes(arg.type, allReferencedTypes); + } + } + } + + collectReferencedTypes(__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. + + this._typeMap = Object.create(null); + this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. + + this._implementationsMap = Object.create(null); + + for (const namedType of allReferencedTypes) { + if (namedType == null) { + continue; + } + + const typeName = namedType.name; + typeName || + devAssert( + false, + 'One of the provided types for building the Schema is missing a name.', + ); + + if (this._typeMap[typeName] !== undefined) { + throw new Error( + `Schema must contain uniquely named types but contains multiple types named "${typeName}".`, + ); + } + + this._typeMap[typeName] = namedType; + + if (isInterfaceType(namedType)) { + // Store implementations by interface. + for (const iface of namedType.getInterfaces()) { + if (isInterfaceType(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.interfaces.push(namedType); + } + } + } else if (isObjectType(namedType)) { + // Store implementations by objects. + for (const iface of namedType.getInterfaces()) { + if (isInterfaceType(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.objects.push(namedType); + } + } + } + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLSchema'; + } + + getQueryType() { + return this._queryType; + } + + getMutationType() { + return this._mutationType; + } + + getSubscriptionType() { + return this._subscriptionType; + } + + getRootType(operation) { + switch (operation) { + case OperationTypeNode.QUERY: + return this.getQueryType(); + + case OperationTypeNode.MUTATION: + return this.getMutationType(); + + case OperationTypeNode.SUBSCRIPTION: + return this.getSubscriptionType(); + } + } + + getTypeMap() { + return this._typeMap; + } + + getType(name) { + return this.getTypeMap()[name]; + } + + getPossibleTypes(abstractType) { + return isUnionType(abstractType) + ? abstractType.getTypes() + : this.getImplementations(abstractType).objects; + } + + getImplementations(interfaceType) { + const implementations = this._implementationsMap[interfaceType.name]; + return implementations !== null && implementations !== void 0 + ? implementations + : { + objects: [], + interfaces: [], + }; + } + + isSubType(abstractType, maybeSubType) { + let map = this._subTypeMap[abstractType.name]; + + if (map === undefined) { + map = Object.create(null); + + if (isUnionType(abstractType)) { + for (const type of abstractType.getTypes()) { + map[type.name] = true; + } + } else { + const implementations = this.getImplementations(abstractType); + + for (const type of implementations.objects) { + map[type.name] = true; + } + + for (const type of implementations.interfaces) { + map[type.name] = true; + } + } + + this._subTypeMap[abstractType.name] = map; + } + + return map[maybeSubType.name] !== undefined; + } + + getDirectives() { + return this._directives; + } + + getDirective(name) { + return this.getDirectives().find((directive) => directive.name === name); + } + + toConfig() { + return { + description: this.description, + query: this.getQueryType(), + mutation: this.getMutationType(), + subscription: this.getSubscriptionType(), + types: Object.values(this.getTypeMap()), + directives: this.getDirectives(), + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + assumeValid: this.__validationErrors !== undefined, + }; + } +} + +function collectReferencedTypes(type, typeSet) { + const namedType = getNamedType(type); + + if (!typeSet.has(namedType)) { + typeSet.add(namedType); + + if (isUnionType(namedType)) { + for (const memberType of namedType.getTypes()) { + collectReferencedTypes(memberType, typeSet); + } + } else if (isObjectType(namedType) || isInterfaceType(namedType)) { + for (const interfaceType of namedType.getInterfaces()) { + collectReferencedTypes(interfaceType, typeSet); + } + + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + + for (const arg of field.args) { + collectReferencedTypes(arg.type, typeSet); + } + } + } else if (isInputObjectType(namedType)) { + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + } + } + } + + return typeSet; +} diff --git a/graphql-subscription-express/node_modules/graphql/type/validate.d.ts b/graphql-subscription-express/node_modules/graphql/type/validate.d.ts new file mode 100644 index 0000000..0528c9b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/validate.d.ts @@ -0,0 +1,17 @@ +import { GraphQLError } from '../error/GraphQLError'; +import type { GraphQLSchema } from './schema'; +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ +export declare function validateSchema( + schema: GraphQLSchema, +): ReadonlyArray; +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ +export declare function assertValidSchema(schema: GraphQLSchema): void; diff --git a/graphql-subscription-express/node_modules/graphql/type/validate.js b/graphql-subscription-express/node_modules/graphql/type/validate.js new file mode 100644 index 0000000..f3413d5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/validate.js @@ -0,0 +1,676 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidSchema = assertValidSchema; +exports.validateSchema = validateSchema; + +var _inspect = require('../jsutils/inspect.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _ast = require('../language/ast.js'); + +var _typeComparators = require('../utilities/typeComparators.js'); + +var _definition = require('./definition.js'); + +var _directives = require('./directives.js'); + +var _introspection = require('./introspection.js'); + +var _schema = require('./schema.js'); + +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ +function validateSchema(schema) { + // First check to ensure the provided value is in fact a GraphQLSchema. + (0, _schema.assertSchema)(schema); // If this Schema has already been validated, return the previous results. + + if (schema.__validationErrors) { + return schema.__validationErrors; + } // Validate the schema, producing a list of errors. + + const context = new SchemaValidationContext(schema); + validateRootTypes(context); + validateDirectives(context); + validateTypes(context); // Persist the results of validation before returning to ensure validation + // does not run multiple times for this schema. + + const errors = context.getErrors(); + schema.__validationErrors = errors; + return errors; +} +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ + +function assertValidSchema(schema) { + const errors = validateSchema(schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} + +class SchemaValidationContext { + constructor(schema) { + this._errors = []; + this.schema = schema; + } + + reportError(message, nodes) { + const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; + + this._errors.push( + new _GraphQLError.GraphQLError(message, { + nodes: _nodes, + }), + ); + } + + getErrors() { + return this._errors; + } +} + +function validateRootTypes(context) { + const schema = context.schema; + const queryType = schema.getQueryType(); + + if (!queryType) { + context.reportError('Query root type must be provided.', schema.astNode); + } else if (!(0, _definition.isObjectType)(queryType)) { + var _getOperationTypeNode; + + context.reportError( + `Query root type must be Object type, it cannot be ${(0, + _inspect.inspect)(queryType)}.`, + (_getOperationTypeNode = getOperationTypeNode( + schema, + _ast.OperationTypeNode.QUERY, + )) !== null && _getOperationTypeNode !== void 0 + ? _getOperationTypeNode + : queryType.astNode, + ); + } + + const mutationType = schema.getMutationType(); + + if (mutationType && !(0, _definition.isObjectType)(mutationType)) { + var _getOperationTypeNode2; + + context.reportError( + 'Mutation root type must be Object type if provided, it cannot be ' + + `${(0, _inspect.inspect)(mutationType)}.`, + (_getOperationTypeNode2 = getOperationTypeNode( + schema, + _ast.OperationTypeNode.MUTATION, + )) !== null && _getOperationTypeNode2 !== void 0 + ? _getOperationTypeNode2 + : mutationType.astNode, + ); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && !(0, _definition.isObjectType)(subscriptionType)) { + var _getOperationTypeNode3; + + context.reportError( + 'Subscription root type must be Object type if provided, it cannot be ' + + `${(0, _inspect.inspect)(subscriptionType)}.`, + (_getOperationTypeNode3 = getOperationTypeNode( + schema, + _ast.OperationTypeNode.SUBSCRIPTION, + )) !== null && _getOperationTypeNode3 !== void 0 + ? _getOperationTypeNode3 + : subscriptionType.astNode, + ); + } +} + +function getOperationTypeNode(schema, operation) { + var _flatMap$find; + + return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes] + .flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (schemaNode) => { + var _schemaNode$operation; + + return ( + /* c8 ignore next */ + (_schemaNode$operation = + schemaNode === null || schemaNode === void 0 + ? void 0 + : schemaNode.operationTypes) !== null && + _schemaNode$operation !== void 0 + ? _schemaNode$operation + : [] + ); + }, + ) + .find((operationNode) => operationNode.operation === operation)) === null || + _flatMap$find === void 0 + ? void 0 + : _flatMap$find.type; +} + +function validateDirectives(context) { + for (const directive of context.schema.getDirectives()) { + // Ensure all directives are in fact GraphQL directives. + if (!(0, _directives.isDirective)(directive)) { + context.reportError( + `Expected directive but got: ${(0, _inspect.inspect)(directive)}.`, + directive === null || directive === void 0 ? void 0 : directive.astNode, + ); + continue; + } // Ensure they are named correctly. + + validateName(context, directive); // TODO: Ensure proper locations. + // Ensure the arguments are valid. + + for (const arg of directive.args) { + // Ensure they are named correctly. + validateName(context, arg); // Ensure the type is an input type. + + if (!(0, _definition.isInputType)(arg.type)) { + context.reportError( + `The type of @${directive.name}(${arg.name}:) must be Input Type ` + + `but got: ${(0, _inspect.inspect)(arg.type)}.`, + arg.astNode, + ); + } + + if ( + (0, _definition.isRequiredArgument)(arg) && + arg.deprecationReason != null + ) { + var _arg$astNode; + + context.reportError( + `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 + ? void 0 + : _arg$astNode.type, + ], + ); + } + } + } +} + +function validateName(context, node) { + // Ensure names are valid, however introspection types opt out. + if (node.name.startsWith('__')) { + context.reportError( + `Name "${node.name}" must not begin with "__", which is reserved by GraphQL introspection.`, + node.astNode, + ); + } +} + +function validateTypes(context) { + const validateInputObjectCircularRefs = + createInputObjectCircularRefsValidator(context); + const typeMap = context.schema.getTypeMap(); + + for (const type of Object.values(typeMap)) { + // Ensure all provided types are in fact GraphQL type. + if (!(0, _definition.isNamedType)(type)) { + context.reportError( + `Expected GraphQL named type but got: ${(0, _inspect.inspect)(type)}.`, + type.astNode, + ); + continue; + } // Ensure it is named correctly (excluding introspection types). + + if (!(0, _introspection.isIntrospectionType)(type)) { + validateName(context, type); + } + + if ((0, _definition.isObjectType)(type)) { + // Ensure fields are valid + validateFields(context, type); // Ensure objects implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if ((0, _definition.isInterfaceType)(type)) { + // Ensure fields are valid. + validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if ((0, _definition.isUnionType)(type)) { + // Ensure Unions include valid member types. + validateUnionMembers(context, type); + } else if ((0, _definition.isEnumType)(type)) { + // Ensure Enums have valid values. + validateEnumValues(context, type); + } else if ((0, _definition.isInputObjectType)(type)) { + // Ensure Input Object fields are valid. + validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references + + validateInputObjectCircularRefs(type); + } + } +} + +function validateFields(context, type) { + const fields = Object.values(type.getFields()); // Objects and Interfaces both must define one or more fields. + + if (fields.length === 0) { + context.reportError(`Type ${type.name} must define one or more fields.`, [ + type.astNode, + ...type.extensionASTNodes, + ]); + } + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an output type + + if (!(0, _definition.isOutputType)(field.type)) { + var _field$astNode; + + context.reportError( + `The type of ${type.name}.${field.name} must be Output Type ` + + `but got: ${(0, _inspect.inspect)(field.type)}.`, + (_field$astNode = field.astNode) === null || _field$astNode === void 0 + ? void 0 + : _field$astNode.type, + ); + } // Ensure the arguments are valid + + for (const arg of field.args) { + const argName = arg.name; // Ensure they are named correctly. + + validateName(context, arg); // Ensure the type is an input type + + if (!(0, _definition.isInputType)(arg.type)) { + var _arg$astNode2; + + context.reportError( + `The type of ${type.name}.${field.name}(${argName}:) must be Input ` + + `Type but got: ${(0, _inspect.inspect)(arg.type)}.`, + (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 + ? void 0 + : _arg$astNode2.type, + ); + } + + if ( + (0, _definition.isRequiredArgument)(arg) && + arg.deprecationReason != null + ) { + var _arg$astNode3; + + context.reportError( + `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 + ? void 0 + : _arg$astNode3.type, + ], + ); + } + } + } +} + +function validateInterfaces(context, type) { + const ifaceTypeNames = Object.create(null); + + for (const iface of type.getInterfaces()) { + if (!(0, _definition.isInterfaceType)(iface)) { + context.reportError( + `Type ${(0, _inspect.inspect)( + type, + )} must only implement Interface types, ` + + `it cannot implement ${(0, _inspect.inspect)(iface)}.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (type === iface) { + context.reportError( + `Type ${type.name} cannot implement itself because it would create a circular reference.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (ifaceTypeNames[iface.name]) { + context.reportError( + `Type ${type.name} can only implement ${iface.name} once.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + ifaceTypeNames[iface.name] = true; + validateTypeImplementsAncestors(context, type, iface); + validateTypeImplementsInterface(context, type, iface); + } +} + +function validateTypeImplementsInterface(context, type, iface) { + const typeFieldMap = type.getFields(); // Assert each interface field is implemented. + + for (const ifaceField of Object.values(iface.getFields())) { + const fieldName = ifaceField.name; + const typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. + + if (!typeField) { + context.reportError( + `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, + [ifaceField.astNode, type.astNode, ...type.extensionASTNodes], + ); + continue; + } // Assert interface field type is satisfied by type field type, by being + // a valid subtype. (covariant) + + if ( + !(0, _typeComparators.isTypeSubTypeOf)( + context.schema, + typeField.type, + ifaceField.type, + ) + ) { + var _ifaceField$astNode, _typeField$astNode; + + context.reportError( + `Interface field ${iface.name}.${fieldName} expects type ` + + `${(0, _inspect.inspect)(ifaceField.type)} but ${ + type.name + }.${fieldName} ` + + `is type ${(0, _inspect.inspect)(typeField.type)}.`, + [ + (_ifaceField$astNode = ifaceField.astNode) === null || + _ifaceField$astNode === void 0 + ? void 0 + : _ifaceField$astNode.type, + (_typeField$astNode = typeField.astNode) === null || + _typeField$astNode === void 0 + ? void 0 + : _typeField$astNode.type, + ], + ); + } // Assert each interface field arg is implemented. + + for (const ifaceArg of ifaceField.args) { + const argName = ifaceArg.name; + const typeArg = typeField.args.find((arg) => arg.name === argName); // Assert interface field arg exists on object field. + + if (!typeArg) { + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, + [ifaceArg.astNode, typeField.astNode], + ); + continue; + } // Assert interface field arg type matches object field arg type. + // (invariant) + // TODO: change to contravariant? + + if (!(0, _typeComparators.isEqualType)(ifaceArg.type, typeArg.type)) { + var _ifaceArg$astNode, _typeArg$astNode; + + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + + `expects type ${(0, _inspect.inspect)(ifaceArg.type)} but ` + + `${type.name}.${fieldName}(${argName}:) is type ` + + `${(0, _inspect.inspect)(typeArg.type)}.`, + [ + (_ifaceArg$astNode = ifaceArg.astNode) === null || + _ifaceArg$astNode === void 0 + ? void 0 + : _ifaceArg$astNode.type, + (_typeArg$astNode = typeArg.astNode) === null || + _typeArg$astNode === void 0 + ? void 0 + : _typeArg$astNode.type, + ], + ); + } // TODO: validate default values? + } // Assert additional arguments must not be required. + + for (const typeArg of typeField.args) { + const argName = typeArg.name; + const ifaceArg = ifaceField.args.find((arg) => arg.name === argName); + + if (!ifaceArg && (0, _definition.isRequiredArgument)(typeArg)) { + context.reportError( + `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, + [typeArg.astNode, ifaceField.astNode], + ); + } + } + } +} + +function validateTypeImplementsAncestors(context, type, iface) { + const ifaceInterfaces = type.getInterfaces(); + + for (const transitive of iface.getInterfaces()) { + if (!ifaceInterfaces.includes(transitive)) { + context.reportError( + transitive === type + ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.` + : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`, + [ + ...getAllImplementsInterfaceNodes(iface, transitive), + ...getAllImplementsInterfaceNodes(type, iface), + ], + ); + } + } +} + +function validateUnionMembers(context, union) { + const memberTypes = union.getTypes(); + + if (memberTypes.length === 0) { + context.reportError( + `Union type ${union.name} must define one or more member types.`, + [union.astNode, ...union.extensionASTNodes], + ); + } + + const includedTypeNames = Object.create(null); + + for (const memberType of memberTypes) { + if (includedTypeNames[memberType.name]) { + context.reportError( + `Union type ${union.name} can only include type ${memberType.name} once.`, + getUnionMemberTypeNodes(union, memberType.name), + ); + continue; + } + + includedTypeNames[memberType.name] = true; + + if (!(0, _definition.isObjectType)(memberType)) { + context.reportError( + `Union type ${union.name} can only include Object types, ` + + `it cannot include ${(0, _inspect.inspect)(memberType)}.`, + getUnionMemberTypeNodes(union, String(memberType)), + ); + } + } +} + +function validateEnumValues(context, enumType) { + const enumValues = enumType.getValues(); + + if (enumValues.length === 0) { + context.reportError( + `Enum type ${enumType.name} must define one or more values.`, + [enumType.astNode, ...enumType.extensionASTNodes], + ); + } + + for (const enumValue of enumValues) { + // Ensure valid name. + validateName(context, enumValue); + } +} + +function validateInputFields(context, inputObj) { + const fields = Object.values(inputObj.getFields()); + + if (fields.length === 0) { + context.reportError( + `Input Object type ${inputObj.name} must define one or more fields.`, + [inputObj.astNode, ...inputObj.extensionASTNodes], + ); + } // Ensure the arguments are valid + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an input type + + if (!(0, _definition.isInputType)(field.type)) { + var _field$astNode2; + + context.reportError( + `The type of ${inputObj.name}.${field.name} must be Input Type ` + + `but got: ${(0, _inspect.inspect)(field.type)}.`, + (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 + ? void 0 + : _field$astNode2.type, + ); + } + + if ( + (0, _definition.isRequiredInputField)(field) && + field.deprecationReason != null + ) { + var _field$astNode3; + + context.reportError( + `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(field.astNode), + (_field$astNode3 = field.astNode) === null || + _field$astNode3 === void 0 + ? void 0 + : _field$astNode3.type, + ], + ); + } + } +} + +function createInputObjectCircularRefsValidator(context) { + // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. + // Tracks already visited types to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors + + const fieldPath = []; // Position in the type path + + const fieldPathIndexByTypeName = Object.create(null); + return detectCycleRecursive; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(inputObj) { + if (visitedTypes[inputObj.name]) { + return; + } + + visitedTypes[inputObj.name] = true; + fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; + const fields = Object.values(inputObj.getFields()); + + for (const field of fields) { + if ( + (0, _definition.isNonNullType)(field.type) && + (0, _definition.isInputObjectType)(field.type.ofType) + ) { + const fieldType = field.type.ofType; + const cycleIndex = fieldPathIndexByTypeName[fieldType.name]; + fieldPath.push(field); + + if (cycleIndex === undefined) { + detectCycleRecursive(fieldType); + } else { + const cyclePath = fieldPath.slice(cycleIndex); + const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join('.'); + context.reportError( + `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, + cyclePath.map((fieldObj) => fieldObj.astNode), + ); + } + + fieldPath.pop(); + } + } + + fieldPathIndexByTypeName[inputObj.name] = undefined; + } +} + +function getAllImplementsInterfaceNodes(type, iface) { + const { astNode, extensionASTNodes } = type; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((typeNode) => { + var _typeNode$interfaces; + + return ( + /* c8 ignore next */ + (_typeNode$interfaces = typeNode.interfaces) !== null && + _typeNode$interfaces !== void 0 + ? _typeNode$interfaces + : [] + ); + }) + .filter((ifaceNode) => ifaceNode.name.value === iface.name); +} + +function getUnionMemberTypeNodes(union, typeName) { + const { astNode, extensionASTNodes } = union; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((unionNode) => { + var _unionNode$types; + + return ( + /* c8 ignore next */ + (_unionNode$types = unionNode.types) !== null && + _unionNode$types !== void 0 + ? _unionNode$types + : [] + ); + }) + .filter((typeNode) => typeNode.name.value === typeName); +} + +function getDeprecatedDirectiveNode(definitionNode) { + var _definitionNode$direc; + + return definitionNode === null || definitionNode === void 0 + ? void 0 + : (_definitionNode$direc = definitionNode.directives) === null || + _definitionNode$direc === void 0 + ? void 0 + : _definitionNode$direc.find( + (node) => + node.name.value === _directives.GraphQLDeprecatedDirective.name, + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/type/validate.mjs b/graphql-subscription-express/node_modules/graphql/type/validate.mjs new file mode 100644 index 0000000..5792c26 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/type/validate.mjs @@ -0,0 +1,651 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { OperationTypeNode } from '../language/ast.mjs'; +import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators.mjs'; +import { + isEnumType, + isInputObjectType, + isInputType, + isInterfaceType, + isNamedType, + isNonNullType, + isObjectType, + isOutputType, + isRequiredArgument, + isRequiredInputField, + isUnionType, +} from './definition.mjs'; +import { GraphQLDeprecatedDirective, isDirective } from './directives.mjs'; +import { isIntrospectionType } from './introspection.mjs'; +import { assertSchema } from './schema.mjs'; +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ + +export function validateSchema(schema) { + // First check to ensure the provided value is in fact a GraphQLSchema. + assertSchema(schema); // If this Schema has already been validated, return the previous results. + + if (schema.__validationErrors) { + return schema.__validationErrors; + } // Validate the schema, producing a list of errors. + + const context = new SchemaValidationContext(schema); + validateRootTypes(context); + validateDirectives(context); + validateTypes(context); // Persist the results of validation before returning to ensure validation + // does not run multiple times for this schema. + + const errors = context.getErrors(); + schema.__validationErrors = errors; + return errors; +} +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ + +export function assertValidSchema(schema) { + const errors = validateSchema(schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} + +class SchemaValidationContext { + constructor(schema) { + this._errors = []; + this.schema = schema; + } + + reportError(message, nodes) { + const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; + + this._errors.push( + new GraphQLError(message, { + nodes: _nodes, + }), + ); + } + + getErrors() { + return this._errors; + } +} + +function validateRootTypes(context) { + const schema = context.schema; + const queryType = schema.getQueryType(); + + if (!queryType) { + context.reportError('Query root type must be provided.', schema.astNode); + } else if (!isObjectType(queryType)) { + var _getOperationTypeNode; + + context.reportError( + `Query root type must be Object type, it cannot be ${inspect( + queryType, + )}.`, + (_getOperationTypeNode = getOperationTypeNode( + schema, + OperationTypeNode.QUERY, + )) !== null && _getOperationTypeNode !== void 0 + ? _getOperationTypeNode + : queryType.astNode, + ); + } + + const mutationType = schema.getMutationType(); + + if (mutationType && !isObjectType(mutationType)) { + var _getOperationTypeNode2; + + context.reportError( + 'Mutation root type must be Object type if provided, it cannot be ' + + `${inspect(mutationType)}.`, + (_getOperationTypeNode2 = getOperationTypeNode( + schema, + OperationTypeNode.MUTATION, + )) !== null && _getOperationTypeNode2 !== void 0 + ? _getOperationTypeNode2 + : mutationType.astNode, + ); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && !isObjectType(subscriptionType)) { + var _getOperationTypeNode3; + + context.reportError( + 'Subscription root type must be Object type if provided, it cannot be ' + + `${inspect(subscriptionType)}.`, + (_getOperationTypeNode3 = getOperationTypeNode( + schema, + OperationTypeNode.SUBSCRIPTION, + )) !== null && _getOperationTypeNode3 !== void 0 + ? _getOperationTypeNode3 + : subscriptionType.astNode, + ); + } +} + +function getOperationTypeNode(schema, operation) { + var _flatMap$find; + + return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes] + .flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (schemaNode) => { + var _schemaNode$operation; + + return ( + /* c8 ignore next */ + (_schemaNode$operation = + schemaNode === null || schemaNode === void 0 + ? void 0 + : schemaNode.operationTypes) !== null && + _schemaNode$operation !== void 0 + ? _schemaNode$operation + : [] + ); + }, + ) + .find((operationNode) => operationNode.operation === operation)) === null || + _flatMap$find === void 0 + ? void 0 + : _flatMap$find.type; +} + +function validateDirectives(context) { + for (const directive of context.schema.getDirectives()) { + // Ensure all directives are in fact GraphQL directives. + if (!isDirective(directive)) { + context.reportError( + `Expected directive but got: ${inspect(directive)}.`, + directive === null || directive === void 0 ? void 0 : directive.astNode, + ); + continue; + } // Ensure they are named correctly. + + validateName(context, directive); // TODO: Ensure proper locations. + // Ensure the arguments are valid. + + for (const arg of directive.args) { + // Ensure they are named correctly. + validateName(context, arg); // Ensure the type is an input type. + + if (!isInputType(arg.type)) { + context.reportError( + `The type of @${directive.name}(${arg.name}:) must be Input Type ` + + `but got: ${inspect(arg.type)}.`, + arg.astNode, + ); + } + + if (isRequiredArgument(arg) && arg.deprecationReason != null) { + var _arg$astNode; + + context.reportError( + `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 + ? void 0 + : _arg$astNode.type, + ], + ); + } + } + } +} + +function validateName(context, node) { + // Ensure names are valid, however introspection types opt out. + if (node.name.startsWith('__')) { + context.reportError( + `Name "${node.name}" must not begin with "__", which is reserved by GraphQL introspection.`, + node.astNode, + ); + } +} + +function validateTypes(context) { + const validateInputObjectCircularRefs = + createInputObjectCircularRefsValidator(context); + const typeMap = context.schema.getTypeMap(); + + for (const type of Object.values(typeMap)) { + // Ensure all provided types are in fact GraphQL type. + if (!isNamedType(type)) { + context.reportError( + `Expected GraphQL named type but got: ${inspect(type)}.`, + type.astNode, + ); + continue; + } // Ensure it is named correctly (excluding introspection types). + + if (!isIntrospectionType(type)) { + validateName(context, type); + } + + if (isObjectType(type)) { + // Ensure fields are valid + validateFields(context, type); // Ensure objects implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if (isInterfaceType(type)) { + // Ensure fields are valid. + validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if (isUnionType(type)) { + // Ensure Unions include valid member types. + validateUnionMembers(context, type); + } else if (isEnumType(type)) { + // Ensure Enums have valid values. + validateEnumValues(context, type); + } else if (isInputObjectType(type)) { + // Ensure Input Object fields are valid. + validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references + + validateInputObjectCircularRefs(type); + } + } +} + +function validateFields(context, type) { + const fields = Object.values(type.getFields()); // Objects and Interfaces both must define one or more fields. + + if (fields.length === 0) { + context.reportError(`Type ${type.name} must define one or more fields.`, [ + type.astNode, + ...type.extensionASTNodes, + ]); + } + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an output type + + if (!isOutputType(field.type)) { + var _field$astNode; + + context.reportError( + `The type of ${type.name}.${field.name} must be Output Type ` + + `but got: ${inspect(field.type)}.`, + (_field$astNode = field.astNode) === null || _field$astNode === void 0 + ? void 0 + : _field$astNode.type, + ); + } // Ensure the arguments are valid + + for (const arg of field.args) { + const argName = arg.name; // Ensure they are named correctly. + + validateName(context, arg); // Ensure the type is an input type + + if (!isInputType(arg.type)) { + var _arg$astNode2; + + context.reportError( + `The type of ${type.name}.${field.name}(${argName}:) must be Input ` + + `Type but got: ${inspect(arg.type)}.`, + (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 + ? void 0 + : _arg$astNode2.type, + ); + } + + if (isRequiredArgument(arg) && arg.deprecationReason != null) { + var _arg$astNode3; + + context.reportError( + `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 + ? void 0 + : _arg$astNode3.type, + ], + ); + } + } + } +} + +function validateInterfaces(context, type) { + const ifaceTypeNames = Object.create(null); + + for (const iface of type.getInterfaces()) { + if (!isInterfaceType(iface)) { + context.reportError( + `Type ${inspect(type)} must only implement Interface types, ` + + `it cannot implement ${inspect(iface)}.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (type === iface) { + context.reportError( + `Type ${type.name} cannot implement itself because it would create a circular reference.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (ifaceTypeNames[iface.name]) { + context.reportError( + `Type ${type.name} can only implement ${iface.name} once.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + ifaceTypeNames[iface.name] = true; + validateTypeImplementsAncestors(context, type, iface); + validateTypeImplementsInterface(context, type, iface); + } +} + +function validateTypeImplementsInterface(context, type, iface) { + const typeFieldMap = type.getFields(); // Assert each interface field is implemented. + + for (const ifaceField of Object.values(iface.getFields())) { + const fieldName = ifaceField.name; + const typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. + + if (!typeField) { + context.reportError( + `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, + [ifaceField.astNode, type.astNode, ...type.extensionASTNodes], + ); + continue; + } // Assert interface field type is satisfied by type field type, by being + // a valid subtype. (covariant) + + if (!isTypeSubTypeOf(context.schema, typeField.type, ifaceField.type)) { + var _ifaceField$astNode, _typeField$astNode; + + context.reportError( + `Interface field ${iface.name}.${fieldName} expects type ` + + `${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` + + `is type ${inspect(typeField.type)}.`, + [ + (_ifaceField$astNode = ifaceField.astNode) === null || + _ifaceField$astNode === void 0 + ? void 0 + : _ifaceField$astNode.type, + (_typeField$astNode = typeField.astNode) === null || + _typeField$astNode === void 0 + ? void 0 + : _typeField$astNode.type, + ], + ); + } // Assert each interface field arg is implemented. + + for (const ifaceArg of ifaceField.args) { + const argName = ifaceArg.name; + const typeArg = typeField.args.find((arg) => arg.name === argName); // Assert interface field arg exists on object field. + + if (!typeArg) { + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, + [ifaceArg.astNode, typeField.astNode], + ); + continue; + } // Assert interface field arg type matches object field arg type. + // (invariant) + // TODO: change to contravariant? + + if (!isEqualType(ifaceArg.type, typeArg.type)) { + var _ifaceArg$astNode, _typeArg$astNode; + + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + + `expects type ${inspect(ifaceArg.type)} but ` + + `${type.name}.${fieldName}(${argName}:) is type ` + + `${inspect(typeArg.type)}.`, + [ + (_ifaceArg$astNode = ifaceArg.astNode) === null || + _ifaceArg$astNode === void 0 + ? void 0 + : _ifaceArg$astNode.type, + (_typeArg$astNode = typeArg.astNode) === null || + _typeArg$astNode === void 0 + ? void 0 + : _typeArg$astNode.type, + ], + ); + } // TODO: validate default values? + } // Assert additional arguments must not be required. + + for (const typeArg of typeField.args) { + const argName = typeArg.name; + const ifaceArg = ifaceField.args.find((arg) => arg.name === argName); + + if (!ifaceArg && isRequiredArgument(typeArg)) { + context.reportError( + `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, + [typeArg.astNode, ifaceField.astNode], + ); + } + } + } +} + +function validateTypeImplementsAncestors(context, type, iface) { + const ifaceInterfaces = type.getInterfaces(); + + for (const transitive of iface.getInterfaces()) { + if (!ifaceInterfaces.includes(transitive)) { + context.reportError( + transitive === type + ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.` + : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`, + [ + ...getAllImplementsInterfaceNodes(iface, transitive), + ...getAllImplementsInterfaceNodes(type, iface), + ], + ); + } + } +} + +function validateUnionMembers(context, union) { + const memberTypes = union.getTypes(); + + if (memberTypes.length === 0) { + context.reportError( + `Union type ${union.name} must define one or more member types.`, + [union.astNode, ...union.extensionASTNodes], + ); + } + + const includedTypeNames = Object.create(null); + + for (const memberType of memberTypes) { + if (includedTypeNames[memberType.name]) { + context.reportError( + `Union type ${union.name} can only include type ${memberType.name} once.`, + getUnionMemberTypeNodes(union, memberType.name), + ); + continue; + } + + includedTypeNames[memberType.name] = true; + + if (!isObjectType(memberType)) { + context.reportError( + `Union type ${union.name} can only include Object types, ` + + `it cannot include ${inspect(memberType)}.`, + getUnionMemberTypeNodes(union, String(memberType)), + ); + } + } +} + +function validateEnumValues(context, enumType) { + const enumValues = enumType.getValues(); + + if (enumValues.length === 0) { + context.reportError( + `Enum type ${enumType.name} must define one or more values.`, + [enumType.astNode, ...enumType.extensionASTNodes], + ); + } + + for (const enumValue of enumValues) { + // Ensure valid name. + validateName(context, enumValue); + } +} + +function validateInputFields(context, inputObj) { + const fields = Object.values(inputObj.getFields()); + + if (fields.length === 0) { + context.reportError( + `Input Object type ${inputObj.name} must define one or more fields.`, + [inputObj.astNode, ...inputObj.extensionASTNodes], + ); + } // Ensure the arguments are valid + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an input type + + if (!isInputType(field.type)) { + var _field$astNode2; + + context.reportError( + `The type of ${inputObj.name}.${field.name} must be Input Type ` + + `but got: ${inspect(field.type)}.`, + (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 + ? void 0 + : _field$astNode2.type, + ); + } + + if (isRequiredInputField(field) && field.deprecationReason != null) { + var _field$astNode3; + + context.reportError( + `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(field.astNode), + (_field$astNode3 = field.astNode) === null || + _field$astNode3 === void 0 + ? void 0 + : _field$astNode3.type, + ], + ); + } + } +} + +function createInputObjectCircularRefsValidator(context) { + // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. + // Tracks already visited types to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors + + const fieldPath = []; // Position in the type path + + const fieldPathIndexByTypeName = Object.create(null); + return detectCycleRecursive; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(inputObj) { + if (visitedTypes[inputObj.name]) { + return; + } + + visitedTypes[inputObj.name] = true; + fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; + const fields = Object.values(inputObj.getFields()); + + for (const field of fields) { + if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) { + const fieldType = field.type.ofType; + const cycleIndex = fieldPathIndexByTypeName[fieldType.name]; + fieldPath.push(field); + + if (cycleIndex === undefined) { + detectCycleRecursive(fieldType); + } else { + const cyclePath = fieldPath.slice(cycleIndex); + const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join('.'); + context.reportError( + `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, + cyclePath.map((fieldObj) => fieldObj.astNode), + ); + } + + fieldPath.pop(); + } + } + + fieldPathIndexByTypeName[inputObj.name] = undefined; + } +} + +function getAllImplementsInterfaceNodes(type, iface) { + const { astNode, extensionASTNodes } = type; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((typeNode) => { + var _typeNode$interfaces; + + return ( + /* c8 ignore next */ + (_typeNode$interfaces = typeNode.interfaces) !== null && + _typeNode$interfaces !== void 0 + ? _typeNode$interfaces + : [] + ); + }) + .filter((ifaceNode) => ifaceNode.name.value === iface.name); +} + +function getUnionMemberTypeNodes(union, typeName) { + const { astNode, extensionASTNodes } = union; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((unionNode) => { + var _unionNode$types; + + return ( + /* c8 ignore next */ + (_unionNode$types = unionNode.types) !== null && + _unionNode$types !== void 0 + ? _unionNode$types + : [] + ); + }) + .filter((typeNode) => typeNode.name.value === typeName); +} + +function getDeprecatedDirectiveNode(definitionNode) { + var _definitionNode$direc; + + return definitionNode === null || definitionNode === void 0 + ? void 0 + : (_definitionNode$direc = definitionNode.directives) === null || + _definitionNode$direc === void 0 + ? void 0 + : _definitionNode$direc.find( + (node) => node.name.value === GraphQLDeprecatedDirective.name, + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.d.ts new file mode 100644 index 0000000..78e2402 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.d.ts @@ -0,0 +1,67 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ASTNode, FieldNode } from '../language/ast'; +import type { ASTVisitor } from '../language/visitor'; +import type { + GraphQLArgument, + GraphQLCompositeType, + GraphQLEnumValue, + GraphQLField, + GraphQLInputType, + GraphQLOutputType, + GraphQLType, +} from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ +export declare class TypeInfo { + private _schema; + private _typeStack; + private _parentTypeStack; + private _inputTypeStack; + private _fieldDefStack; + private _defaultValueStack; + private _directive; + private _argument; + private _enumValue; + private _getFieldDef; + constructor( + schema: GraphQLSchema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType?: Maybe, + /** @deprecated will be removed in 17.0.0 */ + getFieldDefFn?: GetFieldDefFn, + ); + get [Symbol.toStringTag](): string; + getType(): Maybe; + getParentType(): Maybe; + getInputType(): Maybe; + getParentInputType(): Maybe; + getFieldDef(): Maybe>; + getDefaultValue(): Maybe; + getDirective(): Maybe; + getArgument(): Maybe; + getEnumValue(): Maybe; + enter(node: ASTNode): void; + leave(node: ASTNode): void; +} +declare type GetFieldDefFn = ( + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode, +) => Maybe>; +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ +export declare function visitWithTypeInfo( + typeInfo: TypeInfo, + visitor: ASTVisitor, +): ASTVisitor; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.js b/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.js new file mode 100644 index 0000000..d15bc2c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.js @@ -0,0 +1,418 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.TypeInfo = void 0; +exports.visitWithTypeInfo = visitWithTypeInfo; + +var _ast = require('../language/ast.js'); + +var _kinds = require('../language/kinds.js'); + +var _visitor = require('../language/visitor.js'); + +var _definition = require('../type/definition.js'); + +var _introspection = require('../type/introspection.js'); + +var _typeFromAST = require('./typeFromAST.js'); + +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ +class TypeInfo { + constructor( + schema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType, + /** @deprecated will be removed in 17.0.0 */ + getFieldDefFn, + ) { + this._schema = schema; + this._typeStack = []; + this._parentTypeStack = []; + this._inputTypeStack = []; + this._fieldDefStack = []; + this._defaultValueStack = []; + this._directive = null; + this._argument = null; + this._enumValue = null; + this._getFieldDef = + getFieldDefFn !== null && getFieldDefFn !== void 0 + ? getFieldDefFn + : getFieldDef; + + if (initialType) { + if ((0, _definition.isInputType)(initialType)) { + this._inputTypeStack.push(initialType); + } + + if ((0, _definition.isCompositeType)(initialType)) { + this._parentTypeStack.push(initialType); + } + + if ((0, _definition.isOutputType)(initialType)) { + this._typeStack.push(initialType); + } + } + } + + get [Symbol.toStringTag]() { + return 'TypeInfo'; + } + + getType() { + if (this._typeStack.length > 0) { + return this._typeStack[this._typeStack.length - 1]; + } + } + + getParentType() { + if (this._parentTypeStack.length > 0) { + return this._parentTypeStack[this._parentTypeStack.length - 1]; + } + } + + getInputType() { + if (this._inputTypeStack.length > 0) { + return this._inputTypeStack[this._inputTypeStack.length - 1]; + } + } + + getParentInputType() { + if (this._inputTypeStack.length > 1) { + return this._inputTypeStack[this._inputTypeStack.length - 2]; + } + } + + getFieldDef() { + if (this._fieldDefStack.length > 0) { + return this._fieldDefStack[this._fieldDefStack.length - 1]; + } + } + + getDefaultValue() { + if (this._defaultValueStack.length > 0) { + return this._defaultValueStack[this._defaultValueStack.length - 1]; + } + } + + getDirective() { + return this._directive; + } + + getArgument() { + return this._argument; + } + + getEnumValue() { + return this._enumValue; + } + + enter(node) { + const schema = this._schema; // Note: many of the types below are explicitly typed as "unknown" to drop + // any assumptions of a valid schema to ensure runtime types are properly + // checked before continuing since TypeInfo is used as part of validation + // which occurs before guarantees of schema and document validity. + + switch (node.kind) { + case _kinds.Kind.SELECTION_SET: { + const namedType = (0, _definition.getNamedType)(this.getType()); + + this._parentTypeStack.push( + (0, _definition.isCompositeType)(namedType) ? namedType : undefined, + ); + + break; + } + + case _kinds.Kind.FIELD: { + const parentType = this.getParentType(); + let fieldDef; + let fieldType; + + if (parentType) { + fieldDef = this._getFieldDef(schema, parentType, node); + + if (fieldDef) { + fieldType = fieldDef.type; + } + } + + this._fieldDefStack.push(fieldDef); + + this._typeStack.push( + (0, _definition.isOutputType)(fieldType) ? fieldType : undefined, + ); + + break; + } + + case _kinds.Kind.DIRECTIVE: + this._directive = schema.getDirective(node.name.value); + break; + + case _kinds.Kind.OPERATION_DEFINITION: { + const rootType = schema.getRootType(node.operation); + + this._typeStack.push( + (0, _definition.isObjectType)(rootType) ? rootType : undefined, + ); + + break; + } + + case _kinds.Kind.INLINE_FRAGMENT: + case _kinds.Kind.FRAGMENT_DEFINITION: { + const typeConditionAST = node.typeCondition; + const outputType = typeConditionAST + ? (0, _typeFromAST.typeFromAST)(schema, typeConditionAST) + : (0, _definition.getNamedType)(this.getType()); + + this._typeStack.push( + (0, _definition.isOutputType)(outputType) ? outputType : undefined, + ); + + break; + } + + case _kinds.Kind.VARIABLE_DEFINITION: { + const inputType = (0, _typeFromAST.typeFromAST)(schema, node.type); + + this._inputTypeStack.push( + (0, _definition.isInputType)(inputType) ? inputType : undefined, + ); + + break; + } + + case _kinds.Kind.ARGUMENT: { + var _this$getDirective; + + let argDef; + let argType; + const fieldOrDirective = + (_this$getDirective = this.getDirective()) !== null && + _this$getDirective !== void 0 + ? _this$getDirective + : this.getFieldDef(); + + if (fieldOrDirective) { + argDef = fieldOrDirective.args.find( + (arg) => arg.name === node.name.value, + ); + + if (argDef) { + argType = argDef.type; + } + } + + this._argument = argDef; + + this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); + + this._inputTypeStack.push( + (0, _definition.isInputType)(argType) ? argType : undefined, + ); + + break; + } + + case _kinds.Kind.LIST: { + const listType = (0, _definition.getNullableType)(this.getInputType()); + const itemType = (0, _definition.isListType)(listType) + ? listType.ofType + : listType; // List positions never have a default value. + + this._defaultValueStack.push(undefined); + + this._inputTypeStack.push( + (0, _definition.isInputType)(itemType) ? itemType : undefined, + ); + + break; + } + + case _kinds.Kind.OBJECT_FIELD: { + const objectType = (0, _definition.getNamedType)(this.getInputType()); + let inputFieldType; + let inputField; + + if ((0, _definition.isInputObjectType)(objectType)) { + inputField = objectType.getFields()[node.name.value]; + + if (inputField) { + inputFieldType = inputField.type; + } + } + + this._defaultValueStack.push( + inputField ? inputField.defaultValue : undefined, + ); + + this._inputTypeStack.push( + (0, _definition.isInputType)(inputFieldType) + ? inputFieldType + : undefined, + ); + + break; + } + + case _kinds.Kind.ENUM: { + const enumType = (0, _definition.getNamedType)(this.getInputType()); + let enumValue; + + if ((0, _definition.isEnumType)(enumType)) { + enumValue = enumType.getValue(node.value); + } + + this._enumValue = enumValue; + break; + } + + default: // Ignore other nodes + } + } + + leave(node) { + switch (node.kind) { + case _kinds.Kind.SELECTION_SET: + this._parentTypeStack.pop(); + + break; + + case _kinds.Kind.FIELD: + this._fieldDefStack.pop(); + + this._typeStack.pop(); + + break; + + case _kinds.Kind.DIRECTIVE: + this._directive = null; + break; + + case _kinds.Kind.OPERATION_DEFINITION: + case _kinds.Kind.INLINE_FRAGMENT: + case _kinds.Kind.FRAGMENT_DEFINITION: + this._typeStack.pop(); + + break; + + case _kinds.Kind.VARIABLE_DEFINITION: + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.ARGUMENT: + this._argument = null; + + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.LIST: + case _kinds.Kind.OBJECT_FIELD: + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.ENUM: + this._enumValue = null; + break; + + default: // Ignore other nodes + } + } +} + +exports.TypeInfo = TypeInfo; + +/** + * Not exactly the same as the executor's definition of getFieldDef, in this + * statically evaluated environment we do not always have an Object type, + * and need to handle Interface and Union types. + */ +function getFieldDef(schema, parentType, fieldNode) { + const name = fieldNode.name.value; + + if ( + name === _introspection.SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.SchemaMetaFieldDef; + } + + if ( + name === _introspection.TypeMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.TypeMetaFieldDef; + } + + if ( + name === _introspection.TypeNameMetaFieldDef.name && + (0, _definition.isCompositeType)(parentType) + ) { + return _introspection.TypeNameMetaFieldDef; + } + + if ( + (0, _definition.isObjectType)(parentType) || + (0, _definition.isInterfaceType)(parentType) + ) { + return parentType.getFields()[name]; + } +} +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ + +function visitWithTypeInfo(typeInfo, visitor) { + return { + enter(...args) { + const node = args[0]; + typeInfo.enter(node); + const fn = (0, _visitor.getEnterLeaveForKind)(visitor, node.kind).enter; + + if (fn) { + const result = fn.apply(visitor, args); + + if (result !== undefined) { + typeInfo.leave(node); + + if ((0, _ast.isNode)(result)) { + typeInfo.enter(result); + } + } + + return result; + } + }, + + leave(...args) { + const node = args[0]; + const fn = (0, _visitor.getEnterLeaveForKind)(visitor, node.kind).leave; + let result; + + if (fn) { + result = fn.apply(visitor, args); + } + + typeInfo.leave(node); + return result; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.mjs b/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.mjs new file mode 100644 index 0000000..4956e0f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/TypeInfo.mjs @@ -0,0 +1,395 @@ +import { isNode } from '../language/ast.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { getEnterLeaveForKind } from '../language/visitor.mjs'; +import { + getNamedType, + getNullableType, + isCompositeType, + isEnumType, + isInputObjectType, + isInputType, + isInterfaceType, + isListType, + isObjectType, + isOutputType, +} from '../type/definition.mjs'; +import { + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from '../type/introspection.mjs'; +import { typeFromAST } from './typeFromAST.mjs'; +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ + +export class TypeInfo { + constructor( + schema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType, + /** @deprecated will be removed in 17.0.0 */ + getFieldDefFn, + ) { + this._schema = schema; + this._typeStack = []; + this._parentTypeStack = []; + this._inputTypeStack = []; + this._fieldDefStack = []; + this._defaultValueStack = []; + this._directive = null; + this._argument = null; + this._enumValue = null; + this._getFieldDef = + getFieldDefFn !== null && getFieldDefFn !== void 0 + ? getFieldDefFn + : getFieldDef; + + if (initialType) { + if (isInputType(initialType)) { + this._inputTypeStack.push(initialType); + } + + if (isCompositeType(initialType)) { + this._parentTypeStack.push(initialType); + } + + if (isOutputType(initialType)) { + this._typeStack.push(initialType); + } + } + } + + get [Symbol.toStringTag]() { + return 'TypeInfo'; + } + + getType() { + if (this._typeStack.length > 0) { + return this._typeStack[this._typeStack.length - 1]; + } + } + + getParentType() { + if (this._parentTypeStack.length > 0) { + return this._parentTypeStack[this._parentTypeStack.length - 1]; + } + } + + getInputType() { + if (this._inputTypeStack.length > 0) { + return this._inputTypeStack[this._inputTypeStack.length - 1]; + } + } + + getParentInputType() { + if (this._inputTypeStack.length > 1) { + return this._inputTypeStack[this._inputTypeStack.length - 2]; + } + } + + getFieldDef() { + if (this._fieldDefStack.length > 0) { + return this._fieldDefStack[this._fieldDefStack.length - 1]; + } + } + + getDefaultValue() { + if (this._defaultValueStack.length > 0) { + return this._defaultValueStack[this._defaultValueStack.length - 1]; + } + } + + getDirective() { + return this._directive; + } + + getArgument() { + return this._argument; + } + + getEnumValue() { + return this._enumValue; + } + + enter(node) { + const schema = this._schema; // Note: many of the types below are explicitly typed as "unknown" to drop + // any assumptions of a valid schema to ensure runtime types are properly + // checked before continuing since TypeInfo is used as part of validation + // which occurs before guarantees of schema and document validity. + + switch (node.kind) { + case Kind.SELECTION_SET: { + const namedType = getNamedType(this.getType()); + + this._parentTypeStack.push( + isCompositeType(namedType) ? namedType : undefined, + ); + + break; + } + + case Kind.FIELD: { + const parentType = this.getParentType(); + let fieldDef; + let fieldType; + + if (parentType) { + fieldDef = this._getFieldDef(schema, parentType, node); + + if (fieldDef) { + fieldType = fieldDef.type; + } + } + + this._fieldDefStack.push(fieldDef); + + this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined); + + break; + } + + case Kind.DIRECTIVE: + this._directive = schema.getDirective(node.name.value); + break; + + case Kind.OPERATION_DEFINITION: { + const rootType = schema.getRootType(node.operation); + + this._typeStack.push(isObjectType(rootType) ? rootType : undefined); + + break; + } + + case Kind.INLINE_FRAGMENT: + case Kind.FRAGMENT_DEFINITION: { + const typeConditionAST = node.typeCondition; + const outputType = typeConditionAST + ? typeFromAST(schema, typeConditionAST) + : getNamedType(this.getType()); + + this._typeStack.push(isOutputType(outputType) ? outputType : undefined); + + break; + } + + case Kind.VARIABLE_DEFINITION: { + const inputType = typeFromAST(schema, node.type); + + this._inputTypeStack.push( + isInputType(inputType) ? inputType : undefined, + ); + + break; + } + + case Kind.ARGUMENT: { + var _this$getDirective; + + let argDef; + let argType; + const fieldOrDirective = + (_this$getDirective = this.getDirective()) !== null && + _this$getDirective !== void 0 + ? _this$getDirective + : this.getFieldDef(); + + if (fieldOrDirective) { + argDef = fieldOrDirective.args.find( + (arg) => arg.name === node.name.value, + ); + + if (argDef) { + argType = argDef.type; + } + } + + this._argument = argDef; + + this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); + + this._inputTypeStack.push(isInputType(argType) ? argType : undefined); + + break; + } + + case Kind.LIST: { + const listType = getNullableType(this.getInputType()); + const itemType = isListType(listType) ? listType.ofType : listType; // List positions never have a default value. + + this._defaultValueStack.push(undefined); + + this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined); + + break; + } + + case Kind.OBJECT_FIELD: { + const objectType = getNamedType(this.getInputType()); + let inputFieldType; + let inputField; + + if (isInputObjectType(objectType)) { + inputField = objectType.getFields()[node.name.value]; + + if (inputField) { + inputFieldType = inputField.type; + } + } + + this._defaultValueStack.push( + inputField ? inputField.defaultValue : undefined, + ); + + this._inputTypeStack.push( + isInputType(inputFieldType) ? inputFieldType : undefined, + ); + + break; + } + + case Kind.ENUM: { + const enumType = getNamedType(this.getInputType()); + let enumValue; + + if (isEnumType(enumType)) { + enumValue = enumType.getValue(node.value); + } + + this._enumValue = enumValue; + break; + } + + default: // Ignore other nodes + } + } + + leave(node) { + switch (node.kind) { + case Kind.SELECTION_SET: + this._parentTypeStack.pop(); + + break; + + case Kind.FIELD: + this._fieldDefStack.pop(); + + this._typeStack.pop(); + + break; + + case Kind.DIRECTIVE: + this._directive = null; + break; + + case Kind.OPERATION_DEFINITION: + case Kind.INLINE_FRAGMENT: + case Kind.FRAGMENT_DEFINITION: + this._typeStack.pop(); + + break; + + case Kind.VARIABLE_DEFINITION: + this._inputTypeStack.pop(); + + break; + + case Kind.ARGUMENT: + this._argument = null; + + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case Kind.LIST: + case Kind.OBJECT_FIELD: + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case Kind.ENUM: + this._enumValue = null; + break; + + default: // Ignore other nodes + } + } +} + +/** + * Not exactly the same as the executor's definition of getFieldDef, in this + * statically evaluated environment we do not always have an Object type, + * and need to handle Interface and Union types. + */ +function getFieldDef(schema, parentType, fieldNode) { + const name = fieldNode.name.value; + + if ( + name === SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return SchemaMetaFieldDef; + } + + if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { + return TypeMetaFieldDef; + } + + if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) { + return TypeNameMetaFieldDef; + } + + if (isObjectType(parentType) || isInterfaceType(parentType)) { + return parentType.getFields()[name]; + } +} +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ + +export function visitWithTypeInfo(typeInfo, visitor) { + return { + enter(...args) { + const node = args[0]; + typeInfo.enter(node); + const fn = getEnterLeaveForKind(visitor, node.kind).enter; + + if (fn) { + const result = fn.apply(visitor, args); + + if (result !== undefined) { + typeInfo.leave(node); + + if (isNode(result)) { + typeInfo.enter(result); + } + } + + return result; + } + }, + + leave(...args) { + const node = args[0]; + const fn = getEnterLeaveForKind(visitor, node.kind).leave; + let result; + + if (fn) { + result = fn.apply(visitor, args); + } + + typeInfo.leave(node); + return result; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.d.ts new file mode 100644 index 0000000..32f475b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.d.ts @@ -0,0 +1,13 @@ +import { GraphQLError } from '../error/GraphQLError'; +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +export declare function assertValidName(name: string): string; +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +export declare function isValidNameError( + name: string, +): GraphQLError | undefined; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.js b/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.js new file mode 100644 index 0000000..08e40a7 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidName = assertValidName; +exports.isValidNameError = isValidNameError; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _assertName = require('../type/assertName.js'); + +/* c8 ignore start */ + +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +function assertValidName(name) { + const error = isValidNameError(name); + + if (error) { + throw error; + } + + return name; +} +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +function isValidNameError(name) { + typeof name === 'string' || + (0, _devAssert.devAssert)(false, 'Expected name to be a string.'); + + if (name.startsWith('__')) { + return new _GraphQLError.GraphQLError( + `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, + ); + } + + try { + (0, _assertName.assertName)(name); + } catch (error) { + return error; + } +} +/* c8 ignore stop */ diff --git a/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.mjs b/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.mjs new file mode 100644 index 0000000..a313a72 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/assertValidName.mjs @@ -0,0 +1,40 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { assertName } from '../type/assertName.mjs'; +/* c8 ignore start */ + +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +export function assertValidName(name) { + const error = isValidNameError(name); + + if (error) { + throw error; + } + + return name; +} +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +export function isValidNameError(name) { + typeof name === 'string' || devAssert(false, 'Expected name to be a string.'); + + if (name.startsWith('__')) { + return new GraphQLError( + `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, + ); + } + + try { + assertName(name); + } catch (error) { + return error; + } +} +/* c8 ignore stop */ diff --git a/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.d.ts new file mode 100644 index 0000000..8b694e7 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.d.ts @@ -0,0 +1,28 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ValueNode } from '../language/ast'; +import type { GraphQLInputType } from '../type/definition'; +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Unknown | Enum Value | + * | null | NullValue | + * + */ +export declare function astFromValue( + value: unknown, + type: GraphQLInputType, +): Maybe; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.js b/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.js new file mode 100644 index 0000000..2e7fa61 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.js @@ -0,0 +1,190 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.astFromValue = astFromValue; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _isIterableObject = require('../jsutils/isIterableObject.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +var _scalars = require('../type/scalars.js'); + +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Unknown | Enum Value | + * | null | NullValue | + * + */ +function astFromValue(value, type) { + if ((0, _definition.isNonNullType)(type)) { + const astValue = astFromValue(value, type.ofType); + + if ( + (astValue === null || astValue === void 0 ? void 0 : astValue.kind) === + _kinds.Kind.NULL + ) { + return null; + } + + return astValue; + } // only explicit null, not undefined, NaN + + if (value === null) { + return { + kind: _kinds.Kind.NULL, + }; + } // undefined + + if (value === undefined) { + return null; + } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but + // the value is not an array, convert the value using the list's item type. + + if ((0, _definition.isListType)(type)) { + const itemType = type.ofType; + + if ((0, _isIterableObject.isIterableObject)(value)) { + const valuesNodes = []; + + for (const item of value) { + const itemNode = astFromValue(item, itemType); + + if (itemNode != null) { + valuesNodes.push(itemNode); + } + } + + return { + kind: _kinds.Kind.LIST, + values: valuesNodes, + }; + } + + return astFromValue(value, itemType); + } // Populate the fields of the input object by creating ASTs from each value + // in the JavaScript object according to the fields in the input type. + + if ((0, _definition.isInputObjectType)(type)) { + if (!(0, _isObjectLike.isObjectLike)(value)) { + return null; + } + + const fieldNodes = []; + + for (const field of Object.values(type.getFields())) { + const fieldValue = astFromValue(value[field.name], field.type); + + if (fieldValue) { + fieldNodes.push({ + kind: _kinds.Kind.OBJECT_FIELD, + name: { + kind: _kinds.Kind.NAME, + value: field.name, + }, + value: fieldValue, + }); + } + } + + return { + kind: _kinds.Kind.OBJECT, + fields: fieldNodes, + }; + } + + if ((0, _definition.isLeafType)(type)) { + // Since value is an internally represented value, it must be serialized + // to an externally represented value before converting into an AST. + const serialized = type.serialize(value); + + if (serialized == null) { + return null; + } // Others serialize based on their corresponding JavaScript scalar types. + + if (typeof serialized === 'boolean') { + return { + kind: _kinds.Kind.BOOLEAN, + value: serialized, + }; + } // JavaScript numbers can be Int or Float values. + + if (typeof serialized === 'number' && Number.isFinite(serialized)) { + const stringNum = String(serialized); + return integerStringRegExp.test(stringNum) + ? { + kind: _kinds.Kind.INT, + value: stringNum, + } + : { + kind: _kinds.Kind.FLOAT, + value: stringNum, + }; + } + + if (typeof serialized === 'string') { + // Enum types use Enum literals. + if ((0, _definition.isEnumType)(type)) { + return { + kind: _kinds.Kind.ENUM, + value: serialized, + }; + } // ID types can use Int literals. + + if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) { + return { + kind: _kinds.Kind.INT, + value: serialized, + }; + } + + return { + kind: _kinds.Kind.STRING, + value: serialized, + }; + } + + throw new TypeError( + `Cannot convert value to AST: ${(0, _inspect.inspect)(serialized)}.`, + ); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected input type: ' + (0, _inspect.inspect)(type), + ); +} +/** + * IntValue: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit ( Digit+ )? + */ + +const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.mjs b/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.mjs new file mode 100644 index 0000000..9bdc1f8 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/astFromValue.mjs @@ -0,0 +1,177 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isIterableObject } from '../jsutils/isIterableObject.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isEnumType, + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition.mjs'; +import { GraphQLID } from '../type/scalars.mjs'; +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Unknown | Enum Value | + * | null | NullValue | + * + */ + +export function astFromValue(value, type) { + if (isNonNullType(type)) { + const astValue = astFromValue(value, type.ofType); + + if ( + (astValue === null || astValue === void 0 ? void 0 : astValue.kind) === + Kind.NULL + ) { + return null; + } + + return astValue; + } // only explicit null, not undefined, NaN + + if (value === null) { + return { + kind: Kind.NULL, + }; + } // undefined + + if (value === undefined) { + return null; + } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but + // the value is not an array, convert the value using the list's item type. + + if (isListType(type)) { + const itemType = type.ofType; + + if (isIterableObject(value)) { + const valuesNodes = []; + + for (const item of value) { + const itemNode = astFromValue(item, itemType); + + if (itemNode != null) { + valuesNodes.push(itemNode); + } + } + + return { + kind: Kind.LIST, + values: valuesNodes, + }; + } + + return astFromValue(value, itemType); + } // Populate the fields of the input object by creating ASTs from each value + // in the JavaScript object according to the fields in the input type. + + if (isInputObjectType(type)) { + if (!isObjectLike(value)) { + return null; + } + + const fieldNodes = []; + + for (const field of Object.values(type.getFields())) { + const fieldValue = astFromValue(value[field.name], field.type); + + if (fieldValue) { + fieldNodes.push({ + kind: Kind.OBJECT_FIELD, + name: { + kind: Kind.NAME, + value: field.name, + }, + value: fieldValue, + }); + } + } + + return { + kind: Kind.OBJECT, + fields: fieldNodes, + }; + } + + if (isLeafType(type)) { + // Since value is an internally represented value, it must be serialized + // to an externally represented value before converting into an AST. + const serialized = type.serialize(value); + + if (serialized == null) { + return null; + } // Others serialize based on their corresponding JavaScript scalar types. + + if (typeof serialized === 'boolean') { + return { + kind: Kind.BOOLEAN, + value: serialized, + }; + } // JavaScript numbers can be Int or Float values. + + if (typeof serialized === 'number' && Number.isFinite(serialized)) { + const stringNum = String(serialized); + return integerStringRegExp.test(stringNum) + ? { + kind: Kind.INT, + value: stringNum, + } + : { + kind: Kind.FLOAT, + value: stringNum, + }; + } + + if (typeof serialized === 'string') { + // Enum types use Enum literals. + if (isEnumType(type)) { + return { + kind: Kind.ENUM, + value: serialized, + }; + } // ID types can use Int literals. + + if (type === GraphQLID && integerStringRegExp.test(serialized)) { + return { + kind: Kind.INT, + value: serialized, + }; + } + + return { + kind: Kind.STRING, + value: serialized, + }; + } + + throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected input type: ' + inspect(type)); +} +/** + * IntValue: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit ( Digit+ )? + */ + +const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.d.ts new file mode 100644 index 0000000..e972f80 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.d.ts @@ -0,0 +1,35 @@ +import type { DocumentNode } from '../language/ast'; +import type { ParseOptions } from '../language/parser'; +import type { Source } from '../language/source'; +import type { GraphQLSchemaValidationOptions } from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; +export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + */ + assumeValidSDL?: boolean; +} +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ +export declare function buildASTSchema( + documentAST: DocumentNode, + options?: BuildSchemaOptions, +): GraphQLSchema; +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ +export declare function buildSchema( + source: string | Source, + options?: BuildSchemaOptions & ParseOptions, +): GraphQLSchema; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.js b/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.js new file mode 100644 index 0000000..4684f80 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.js @@ -0,0 +1,115 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.buildASTSchema = buildASTSchema; +exports.buildSchema = buildSchema; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _kinds = require('../language/kinds.js'); + +var _parser = require('../language/parser.js'); + +var _directives = require('../type/directives.js'); + +var _schema = require('../type/schema.js'); + +var _validate = require('../validation/validate.js'); + +var _extendSchema = require('./extendSchema.js'); + +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ +function buildASTSchema(documentAST, options) { + (documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT) || + (0, _devAssert.devAssert)(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + (0, _validate.assertValidSDL)(documentAST); + } + + const emptySchemaConfig = { + description: undefined, + types: [], + directives: [], + extensions: Object.create(null), + extensionASTNodes: [], + assumeValid: false, + }; + const config = (0, _extendSchema.extendSchemaImpl)( + emptySchemaConfig, + documentAST, + options, + ); + + if (config.astNode == null) { + for (const type of config.types) { + switch (type.name) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + case 'Query': + // @ts-expect-error validated in `validateSchema` + config.query = type; + break; + + case 'Mutation': + // @ts-expect-error validated in `validateSchema` + config.mutation = type; + break; + + case 'Subscription': + // @ts-expect-error validated in `validateSchema` + config.subscription = type; + break; + } + } + } + + const directives = [ + ...config.directives, // If specified directives were not explicitly declared, add them. + ..._directives.specifiedDirectives.filter((stdDirective) => + config.directives.every( + (directive) => directive.name !== stdDirective.name, + ), + ), + ]; + return new _schema.GraphQLSchema({ ...config, directives }); +} +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ + +function buildSchema(source, options) { + const document = (0, _parser.parse)(source, { + noLocation: + options === null || options === void 0 ? void 0 : options.noLocation, + allowLegacyFragmentVariables: + options === null || options === void 0 + ? void 0 + : options.allowLegacyFragmentVariables, + }); + return buildASTSchema(document, { + assumeValidSDL: + options === null || options === void 0 ? void 0 : options.assumeValidSDL, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.mjs b/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.mjs new file mode 100644 index 0000000..f1fe080 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/buildASTSchema.mjs @@ -0,0 +1,97 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { parse } from '../language/parser.mjs'; +import { specifiedDirectives } from '../type/directives.mjs'; +import { GraphQLSchema } from '../type/schema.mjs'; +import { assertValidSDL } from '../validation/validate.mjs'; +import { extendSchemaImpl } from './extendSchema.mjs'; + +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ +export function buildASTSchema(documentAST, options) { + (documentAST != null && documentAST.kind === Kind.DOCUMENT) || + devAssert(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + assertValidSDL(documentAST); + } + + const emptySchemaConfig = { + description: undefined, + types: [], + directives: [], + extensions: Object.create(null), + extensionASTNodes: [], + assumeValid: false, + }; + const config = extendSchemaImpl(emptySchemaConfig, documentAST, options); + + if (config.astNode == null) { + for (const type of config.types) { + switch (type.name) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + case 'Query': + // @ts-expect-error validated in `validateSchema` + config.query = type; + break; + + case 'Mutation': + // @ts-expect-error validated in `validateSchema` + config.mutation = type; + break; + + case 'Subscription': + // @ts-expect-error validated in `validateSchema` + config.subscription = type; + break; + } + } + } + + const directives = [ + ...config.directives, // If specified directives were not explicitly declared, add them. + ...specifiedDirectives.filter((stdDirective) => + config.directives.every( + (directive) => directive.name !== stdDirective.name, + ), + ), + ]; + return new GraphQLSchema({ ...config, directives }); +} +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ + +export function buildSchema(source, options) { + const document = parse(source, { + noLocation: + options === null || options === void 0 ? void 0 : options.noLocation, + allowLegacyFragmentVariables: + options === null || options === void 0 + ? void 0 + : options.allowLegacyFragmentVariables, + }); + return buildASTSchema(document, { + assumeValidSDL: + options === null || options === void 0 ? void 0 : options.assumeValidSDL, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.d.ts new file mode 100644 index 0000000..fb66a8f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.d.ts @@ -0,0 +1,19 @@ +import type { GraphQLSchemaValidationOptions } from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; +import type { IntrospectionQuery } from './getIntrospectionQuery'; +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ +export declare function buildClientSchema( + introspection: IntrospectionQuery, + options?: GraphQLSchemaValidationOptions, +): GraphQLSchema; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.js b/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.js new file mode 100644 index 0000000..18a96c0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.js @@ -0,0 +1,386 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.buildClientSchema = buildClientSchema; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _parser = require('../language/parser.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _scalars = require('../type/scalars.js'); + +var _schema = require('../type/schema.js'); + +var _valueFromAST = require('./valueFromAST.js'); + +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ +function buildClientSchema(introspection, options) { + ((0, _isObjectLike.isObjectLike)(introspection) && + (0, _isObjectLike.isObjectLike)(introspection.__schema)) || + (0, _devAssert.devAssert)( + false, + `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${(0, + _inspect.inspect)(introspection)}.`, + ); // Get the schema from the introspection result. + + const schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. + + const typeMap = (0, _keyValMap.keyValMap)( + schemaIntrospection.types, + (typeIntrospection) => typeIntrospection.name, + (typeIntrospection) => buildType(typeIntrospection), + ); // Include standard types only if they are used. + + for (const stdType of [ + ..._scalars.specifiedScalarTypes, + ..._introspection.introspectionTypes, + ]) { + if (typeMap[stdType.name]) { + typeMap[stdType.name] = stdType; + } + } // Get the root Query, Mutation, and Subscription types. + + const queryType = schemaIntrospection.queryType + ? getObjectType(schemaIntrospection.queryType) + : null; + const mutationType = schemaIntrospection.mutationType + ? getObjectType(schemaIntrospection.mutationType) + : null; + const subscriptionType = schemaIntrospection.subscriptionType + ? getObjectType(schemaIntrospection.subscriptionType) + : null; // Get the directives supported by Introspection, assuming empty-set if + // directives were not queried for. + + const directives = schemaIntrospection.directives + ? schemaIntrospection.directives.map(buildDirective) + : []; // Then produce and return a Schema with these types. + + return new _schema.GraphQLSchema({ + description: schemaIntrospection.description, + query: queryType, + mutation: mutationType, + subscription: subscriptionType, + types: Object.values(typeMap), + directives, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); // Given a type reference in introspection, return the GraphQLType instance. + // preferring cached instances before building new instances. + + function getType(typeRef) { + if (typeRef.kind === _introspection.TypeKind.LIST) { + const itemRef = typeRef.ofType; + + if (!itemRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + return new _definition.GraphQLList(getType(itemRef)); + } + + if (typeRef.kind === _introspection.TypeKind.NON_NULL) { + const nullableRef = typeRef.ofType; + + if (!nullableRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + const nullableType = getType(nullableRef); + return new _definition.GraphQLNonNull( + (0, _definition.assertNullableType)(nullableType), + ); + } + + return getNamedType(typeRef); + } + + function getNamedType(typeRef) { + const typeName = typeRef.name; + + if (!typeName) { + throw new Error( + `Unknown type reference: ${(0, _inspect.inspect)(typeRef)}.`, + ); + } + + const type = typeMap[typeName]; + + if (!type) { + throw new Error( + `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`, + ); + } + + return type; + } + + function getObjectType(typeRef) { + return (0, _definition.assertObjectType)(getNamedType(typeRef)); + } + + function getInterfaceType(typeRef) { + return (0, _definition.assertInterfaceType)(getNamedType(typeRef)); + } // Given a type's introspection result, construct the correct + // GraphQLType instance. + + function buildType(type) { + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain + if (type != null && type.name != null && type.kind != null) { + // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17 + // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check + switch (type.kind) { + case _introspection.TypeKind.SCALAR: + return buildScalarDef(type); + + case _introspection.TypeKind.OBJECT: + return buildObjectDef(type); + + case _introspection.TypeKind.INTERFACE: + return buildInterfaceDef(type); + + case _introspection.TypeKind.UNION: + return buildUnionDef(type); + + case _introspection.TypeKind.ENUM: + return buildEnumDef(type); + + case _introspection.TypeKind.INPUT_OBJECT: + return buildInputObjectDef(type); + } + } + + const typeStr = (0, _inspect.inspect)(type); + throw new Error( + `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`, + ); + } + + function buildScalarDef(scalarIntrospection) { + return new _definition.GraphQLScalarType({ + name: scalarIntrospection.name, + description: scalarIntrospection.description, + specifiedByURL: scalarIntrospection.specifiedByURL, + }); + } + + function buildImplementationsList(implementingIntrospection) { + // TODO: Temporary workaround until GraphQL ecosystem will fully support + // 'interfaces' on interface types. + if ( + implementingIntrospection.interfaces === null && + implementingIntrospection.kind === _introspection.TypeKind.INTERFACE + ) { + return []; + } + + if (!implementingIntrospection.interfaces) { + const implementingIntrospectionStr = (0, _inspect.inspect)( + implementingIntrospection, + ); + throw new Error( + `Introspection result missing interfaces: ${implementingIntrospectionStr}.`, + ); + } + + return implementingIntrospection.interfaces.map(getInterfaceType); + } + + function buildObjectDef(objectIntrospection) { + return new _definition.GraphQLObjectType({ + name: objectIntrospection.name, + description: objectIntrospection.description, + interfaces: () => buildImplementationsList(objectIntrospection), + fields: () => buildFieldDefMap(objectIntrospection), + }); + } + + function buildInterfaceDef(interfaceIntrospection) { + return new _definition.GraphQLInterfaceType({ + name: interfaceIntrospection.name, + description: interfaceIntrospection.description, + interfaces: () => buildImplementationsList(interfaceIntrospection), + fields: () => buildFieldDefMap(interfaceIntrospection), + }); + } + + function buildUnionDef(unionIntrospection) { + if (!unionIntrospection.possibleTypes) { + const unionIntrospectionStr = (0, _inspect.inspect)(unionIntrospection); + throw new Error( + `Introspection result missing possibleTypes: ${unionIntrospectionStr}.`, + ); + } + + return new _definition.GraphQLUnionType({ + name: unionIntrospection.name, + description: unionIntrospection.description, + types: () => unionIntrospection.possibleTypes.map(getObjectType), + }); + } + + function buildEnumDef(enumIntrospection) { + if (!enumIntrospection.enumValues) { + const enumIntrospectionStr = (0, _inspect.inspect)(enumIntrospection); + throw new Error( + `Introspection result missing enumValues: ${enumIntrospectionStr}.`, + ); + } + + return new _definition.GraphQLEnumType({ + name: enumIntrospection.name, + description: enumIntrospection.description, + values: (0, _keyValMap.keyValMap)( + enumIntrospection.enumValues, + (valueIntrospection) => valueIntrospection.name, + (valueIntrospection) => ({ + description: valueIntrospection.description, + deprecationReason: valueIntrospection.deprecationReason, + }), + ), + }); + } + + function buildInputObjectDef(inputObjectIntrospection) { + if (!inputObjectIntrospection.inputFields) { + const inputObjectIntrospectionStr = (0, _inspect.inspect)( + inputObjectIntrospection, + ); + throw new Error( + `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`, + ); + } + + return new _definition.GraphQLInputObjectType({ + name: inputObjectIntrospection.name, + description: inputObjectIntrospection.description, + fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields), + }); + } + + function buildFieldDefMap(typeIntrospection) { + if (!typeIntrospection.fields) { + throw new Error( + `Introspection result missing fields: ${(0, _inspect.inspect)( + typeIntrospection, + )}.`, + ); + } + + return (0, _keyValMap.keyValMap)( + typeIntrospection.fields, + (fieldIntrospection) => fieldIntrospection.name, + buildField, + ); + } + + function buildField(fieldIntrospection) { + const type = getType(fieldIntrospection.type); + + if (!(0, _definition.isOutputType)(type)) { + const typeStr = (0, _inspect.inspect)(type); + throw new Error( + `Introspection must provide output type for fields, but received: ${typeStr}.`, + ); + } + + if (!fieldIntrospection.args) { + const fieldIntrospectionStr = (0, _inspect.inspect)(fieldIntrospection); + throw new Error( + `Introspection result missing field args: ${fieldIntrospectionStr}.`, + ); + } + + return { + description: fieldIntrospection.description, + deprecationReason: fieldIntrospection.deprecationReason, + type, + args: buildInputValueDefMap(fieldIntrospection.args), + }; + } + + function buildInputValueDefMap(inputValueIntrospections) { + return (0, _keyValMap.keyValMap)( + inputValueIntrospections, + (inputValue) => inputValue.name, + buildInputValue, + ); + } + + function buildInputValue(inputValueIntrospection) { + const type = getType(inputValueIntrospection.type); + + if (!(0, _definition.isInputType)(type)) { + const typeStr = (0, _inspect.inspect)(type); + throw new Error( + `Introspection must provide input type for arguments, but received: ${typeStr}.`, + ); + } + + const defaultValue = + inputValueIntrospection.defaultValue != null + ? (0, _valueFromAST.valueFromAST)( + (0, _parser.parseValue)(inputValueIntrospection.defaultValue), + type, + ) + : undefined; + return { + description: inputValueIntrospection.description, + type, + defaultValue, + deprecationReason: inputValueIntrospection.deprecationReason, + }; + } + + function buildDirective(directiveIntrospection) { + if (!directiveIntrospection.args) { + const directiveIntrospectionStr = (0, _inspect.inspect)( + directiveIntrospection, + ); + throw new Error( + `Introspection result missing directive args: ${directiveIntrospectionStr}.`, + ); + } + + if (!directiveIntrospection.locations) { + const directiveIntrospectionStr = (0, _inspect.inspect)( + directiveIntrospection, + ); + throw new Error( + `Introspection result missing directive locations: ${directiveIntrospectionStr}.`, + ); + } + + return new _directives.GraphQLDirective({ + name: directiveIntrospection.name, + description: directiveIntrospection.description, + isRepeatable: directiveIntrospection.isRepeatable, + locations: directiveIntrospection.locations.slice(), + args: buildInputValueDefMap(directiveIntrospection.args), + }); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.mjs b/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.mjs new file mode 100644 index 0000000..bed5876 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/buildClientSchema.mjs @@ -0,0 +1,363 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { parseValue } from '../language/parser.mjs'; +import { + assertInterfaceType, + assertNullableType, + assertObjectType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, + isInputType, + isOutputType, +} from '../type/definition.mjs'; +import { GraphQLDirective } from '../type/directives.mjs'; +import { introspectionTypes, TypeKind } from '../type/introspection.mjs'; +import { specifiedScalarTypes } from '../type/scalars.mjs'; +import { GraphQLSchema } from '../type/schema.mjs'; +import { valueFromAST } from './valueFromAST.mjs'; +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ + +export function buildClientSchema(introspection, options) { + (isObjectLike(introspection) && isObjectLike(introspection.__schema)) || + devAssert( + false, + `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${inspect( + introspection, + )}.`, + ); // Get the schema from the introspection result. + + const schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. + + const typeMap = keyValMap( + schemaIntrospection.types, + (typeIntrospection) => typeIntrospection.name, + (typeIntrospection) => buildType(typeIntrospection), + ); // Include standard types only if they are used. + + for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) { + if (typeMap[stdType.name]) { + typeMap[stdType.name] = stdType; + } + } // Get the root Query, Mutation, and Subscription types. + + const queryType = schemaIntrospection.queryType + ? getObjectType(schemaIntrospection.queryType) + : null; + const mutationType = schemaIntrospection.mutationType + ? getObjectType(schemaIntrospection.mutationType) + : null; + const subscriptionType = schemaIntrospection.subscriptionType + ? getObjectType(schemaIntrospection.subscriptionType) + : null; // Get the directives supported by Introspection, assuming empty-set if + // directives were not queried for. + + const directives = schemaIntrospection.directives + ? schemaIntrospection.directives.map(buildDirective) + : []; // Then produce and return a Schema with these types. + + return new GraphQLSchema({ + description: schemaIntrospection.description, + query: queryType, + mutation: mutationType, + subscription: subscriptionType, + types: Object.values(typeMap), + directives, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); // Given a type reference in introspection, return the GraphQLType instance. + // preferring cached instances before building new instances. + + function getType(typeRef) { + if (typeRef.kind === TypeKind.LIST) { + const itemRef = typeRef.ofType; + + if (!itemRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + return new GraphQLList(getType(itemRef)); + } + + if (typeRef.kind === TypeKind.NON_NULL) { + const nullableRef = typeRef.ofType; + + if (!nullableRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + const nullableType = getType(nullableRef); + return new GraphQLNonNull(assertNullableType(nullableType)); + } + + return getNamedType(typeRef); + } + + function getNamedType(typeRef) { + const typeName = typeRef.name; + + if (!typeName) { + throw new Error(`Unknown type reference: ${inspect(typeRef)}.`); + } + + const type = typeMap[typeName]; + + if (!type) { + throw new Error( + `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`, + ); + } + + return type; + } + + function getObjectType(typeRef) { + return assertObjectType(getNamedType(typeRef)); + } + + function getInterfaceType(typeRef) { + return assertInterfaceType(getNamedType(typeRef)); + } // Given a type's introspection result, construct the correct + // GraphQLType instance. + + function buildType(type) { + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain + if (type != null && type.name != null && type.kind != null) { + // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17 + // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check + switch (type.kind) { + case TypeKind.SCALAR: + return buildScalarDef(type); + + case TypeKind.OBJECT: + return buildObjectDef(type); + + case TypeKind.INTERFACE: + return buildInterfaceDef(type); + + case TypeKind.UNION: + return buildUnionDef(type); + + case TypeKind.ENUM: + return buildEnumDef(type); + + case TypeKind.INPUT_OBJECT: + return buildInputObjectDef(type); + } + } + + const typeStr = inspect(type); + throw new Error( + `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`, + ); + } + + function buildScalarDef(scalarIntrospection) { + return new GraphQLScalarType({ + name: scalarIntrospection.name, + description: scalarIntrospection.description, + specifiedByURL: scalarIntrospection.specifiedByURL, + }); + } + + function buildImplementationsList(implementingIntrospection) { + // TODO: Temporary workaround until GraphQL ecosystem will fully support + // 'interfaces' on interface types. + if ( + implementingIntrospection.interfaces === null && + implementingIntrospection.kind === TypeKind.INTERFACE + ) { + return []; + } + + if (!implementingIntrospection.interfaces) { + const implementingIntrospectionStr = inspect(implementingIntrospection); + throw new Error( + `Introspection result missing interfaces: ${implementingIntrospectionStr}.`, + ); + } + + return implementingIntrospection.interfaces.map(getInterfaceType); + } + + function buildObjectDef(objectIntrospection) { + return new GraphQLObjectType({ + name: objectIntrospection.name, + description: objectIntrospection.description, + interfaces: () => buildImplementationsList(objectIntrospection), + fields: () => buildFieldDefMap(objectIntrospection), + }); + } + + function buildInterfaceDef(interfaceIntrospection) { + return new GraphQLInterfaceType({ + name: interfaceIntrospection.name, + description: interfaceIntrospection.description, + interfaces: () => buildImplementationsList(interfaceIntrospection), + fields: () => buildFieldDefMap(interfaceIntrospection), + }); + } + + function buildUnionDef(unionIntrospection) { + if (!unionIntrospection.possibleTypes) { + const unionIntrospectionStr = inspect(unionIntrospection); + throw new Error( + `Introspection result missing possibleTypes: ${unionIntrospectionStr}.`, + ); + } + + return new GraphQLUnionType({ + name: unionIntrospection.name, + description: unionIntrospection.description, + types: () => unionIntrospection.possibleTypes.map(getObjectType), + }); + } + + function buildEnumDef(enumIntrospection) { + if (!enumIntrospection.enumValues) { + const enumIntrospectionStr = inspect(enumIntrospection); + throw new Error( + `Introspection result missing enumValues: ${enumIntrospectionStr}.`, + ); + } + + return new GraphQLEnumType({ + name: enumIntrospection.name, + description: enumIntrospection.description, + values: keyValMap( + enumIntrospection.enumValues, + (valueIntrospection) => valueIntrospection.name, + (valueIntrospection) => ({ + description: valueIntrospection.description, + deprecationReason: valueIntrospection.deprecationReason, + }), + ), + }); + } + + function buildInputObjectDef(inputObjectIntrospection) { + if (!inputObjectIntrospection.inputFields) { + const inputObjectIntrospectionStr = inspect(inputObjectIntrospection); + throw new Error( + `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`, + ); + } + + return new GraphQLInputObjectType({ + name: inputObjectIntrospection.name, + description: inputObjectIntrospection.description, + fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields), + }); + } + + function buildFieldDefMap(typeIntrospection) { + if (!typeIntrospection.fields) { + throw new Error( + `Introspection result missing fields: ${inspect(typeIntrospection)}.`, + ); + } + + return keyValMap( + typeIntrospection.fields, + (fieldIntrospection) => fieldIntrospection.name, + buildField, + ); + } + + function buildField(fieldIntrospection) { + const type = getType(fieldIntrospection.type); + + if (!isOutputType(type)) { + const typeStr = inspect(type); + throw new Error( + `Introspection must provide output type for fields, but received: ${typeStr}.`, + ); + } + + if (!fieldIntrospection.args) { + const fieldIntrospectionStr = inspect(fieldIntrospection); + throw new Error( + `Introspection result missing field args: ${fieldIntrospectionStr}.`, + ); + } + + return { + description: fieldIntrospection.description, + deprecationReason: fieldIntrospection.deprecationReason, + type, + args: buildInputValueDefMap(fieldIntrospection.args), + }; + } + + function buildInputValueDefMap(inputValueIntrospections) { + return keyValMap( + inputValueIntrospections, + (inputValue) => inputValue.name, + buildInputValue, + ); + } + + function buildInputValue(inputValueIntrospection) { + const type = getType(inputValueIntrospection.type); + + if (!isInputType(type)) { + const typeStr = inspect(type); + throw new Error( + `Introspection must provide input type for arguments, but received: ${typeStr}.`, + ); + } + + const defaultValue = + inputValueIntrospection.defaultValue != null + ? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type) + : undefined; + return { + description: inputValueIntrospection.description, + type, + defaultValue, + deprecationReason: inputValueIntrospection.deprecationReason, + }; + } + + function buildDirective(directiveIntrospection) { + if (!directiveIntrospection.args) { + const directiveIntrospectionStr = inspect(directiveIntrospection); + throw new Error( + `Introspection result missing directive args: ${directiveIntrospectionStr}.`, + ); + } + + if (!directiveIntrospection.locations) { + const directiveIntrospectionStr = inspect(directiveIntrospection); + throw new Error( + `Introspection result missing directive locations: ${directiveIntrospectionStr}.`, + ); + } + + return new GraphQLDirective({ + name: directiveIntrospection.name, + description: directiveIntrospection.description, + isRepeatable: directiveIntrospection.isRepeatable, + locations: directiveIntrospection.locations.slice(), + args: buildInputValueDefMap(directiveIntrospection.args), + }); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.d.ts new file mode 100644 index 0000000..2e580ad --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.d.ts @@ -0,0 +1,16 @@ +import { GraphQLError } from '../error/GraphQLError'; +import type { GraphQLInputType } from '../type/definition'; +declare type OnErrorCB = ( + path: ReadonlyArray, + invalidValue: unknown, + error: GraphQLError, +) => void; +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +export declare function coerceInputValue( + inputValue: unknown, + type: GraphQLInputType, + onError?: OnErrorCB, +): unknown; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.js b/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.js new file mode 100644 index 0000000..fd9d313 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.js @@ -0,0 +1,189 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.coerceInputValue = coerceInputValue; + +var _didYouMean = require('../jsutils/didYouMean.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _isIterableObject = require('../jsutils/isIterableObject.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _Path = require('../jsutils/Path.js'); + +var _printPathArray = require('../jsutils/printPathArray.js'); + +var _suggestionList = require('../jsutils/suggestionList.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _definition = require('../type/definition.js'); + +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +function coerceInputValue(inputValue, type, onError = defaultOnError) { + return coerceInputValueImpl(inputValue, type, onError, undefined); +} + +function defaultOnError(path, invalidValue, error) { + let errorPrefix = 'Invalid value ' + (0, _inspect.inspect)(invalidValue); + + if (path.length > 0) { + errorPrefix += ` at "value${(0, _printPathArray.printPathArray)(path)}"`; + } + + error.message = errorPrefix + ': ' + error.message; + throw error; +} + +function coerceInputValueImpl(inputValue, type, onError, path) { + if ((0, _definition.isNonNullType)(type)) { + if (inputValue != null) { + return coerceInputValueImpl(inputValue, type.ofType, onError, path); + } + + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Expected non-nullable type "${(0, _inspect.inspect)( + type, + )}" not to be null.`, + ), + ); + return; + } + + if (inputValue == null) { + // Explicitly return the value null. + return null; + } + + if ((0, _definition.isListType)(type)) { + const itemType = type.ofType; + + if ((0, _isIterableObject.isIterableObject)(inputValue)) { + return Array.from(inputValue, (itemValue, index) => { + const itemPath = (0, _Path.addPath)(path, index, undefined); + return coerceInputValueImpl(itemValue, itemType, onError, itemPath); + }); + } // Lists accept a non-list value as a list of one. + + return [coerceInputValueImpl(inputValue, itemType, onError, path)]; + } + + if ((0, _definition.isInputObjectType)(type)) { + if (!(0, _isObjectLike.isObjectLike)(inputValue)) { + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Expected type "${type.name}" to be an object.`, + ), + ); + return; + } + + const coercedValue = {}; + const fieldDefs = type.getFields(); + + for (const field of Object.values(fieldDefs)) { + const fieldValue = inputValue[field.name]; + + if (fieldValue === undefined) { + if (field.defaultValue !== undefined) { + coercedValue[field.name] = field.defaultValue; + } else if ((0, _definition.isNonNullType)(field.type)) { + const typeStr = (0, _inspect.inspect)(field.type); + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Field "${field.name}" of required type "${typeStr}" was not provided.`, + ), + ); + } + + continue; + } + + coercedValue[field.name] = coerceInputValueImpl( + fieldValue, + field.type, + onError, + (0, _Path.addPath)(path, field.name, type.name), + ); + } // Ensure every provided field is defined. + + for (const fieldName of Object.keys(inputValue)) { + if (!fieldDefs[fieldName]) { + const suggestions = (0, _suggestionList.suggestionList)( + fieldName, + Object.keys(type.getFields()), + ); + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Field "${fieldName}" is not defined by type "${type.name}".` + + (0, _didYouMean.didYouMean)(suggestions), + ), + ); + } + } + + return coercedValue; + } + + if ((0, _definition.isLeafType)(type)) { + let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), + // which can throw to indicate failure. If it throws, maintain a reference + // to the original error. + + try { + parseResult = type.parseValue(inputValue); + } catch (error) { + if (error instanceof _GraphQLError.GraphQLError) { + onError((0, _Path.pathToArray)(path), inputValue, error); + } else { + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Expected type "${type.name}". ` + error.message, + { + originalError: error, + }, + ), + ); + } + + return; + } + + if (parseResult === undefined) { + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError(`Expected type "${type.name}".`), + ); + } + + return parseResult; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected input type: ' + (0, _inspect.inspect)(type), + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.mjs b/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.mjs new file mode 100644 index 0000000..706c5f6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/coerceInputValue.mjs @@ -0,0 +1,167 @@ +import { didYouMean } from '../jsutils/didYouMean.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isIterableObject } from '../jsutils/isIterableObject.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { addPath, pathToArray } from '../jsutils/Path.mjs'; +import { printPathArray } from '../jsutils/printPathArray.mjs'; +import { suggestionList } from '../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition.mjs'; + +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +export function coerceInputValue(inputValue, type, onError = defaultOnError) { + return coerceInputValueImpl(inputValue, type, onError, undefined); +} + +function defaultOnError(path, invalidValue, error) { + let errorPrefix = 'Invalid value ' + inspect(invalidValue); + + if (path.length > 0) { + errorPrefix += ` at "value${printPathArray(path)}"`; + } + + error.message = errorPrefix + ': ' + error.message; + throw error; +} + +function coerceInputValueImpl(inputValue, type, onError, path) { + if (isNonNullType(type)) { + if (inputValue != null) { + return coerceInputValueImpl(inputValue, type.ofType, onError, path); + } + + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Expected non-nullable type "${inspect(type)}" not to be null.`, + ), + ); + return; + } + + if (inputValue == null) { + // Explicitly return the value null. + return null; + } + + if (isListType(type)) { + const itemType = type.ofType; + + if (isIterableObject(inputValue)) { + return Array.from(inputValue, (itemValue, index) => { + const itemPath = addPath(path, index, undefined); + return coerceInputValueImpl(itemValue, itemType, onError, itemPath); + }); + } // Lists accept a non-list value as a list of one. + + return [coerceInputValueImpl(inputValue, itemType, onError, path)]; + } + + if (isInputObjectType(type)) { + if (!isObjectLike(inputValue)) { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}" to be an object.`), + ); + return; + } + + const coercedValue = {}; + const fieldDefs = type.getFields(); + + for (const field of Object.values(fieldDefs)) { + const fieldValue = inputValue[field.name]; + + if (fieldValue === undefined) { + if (field.defaultValue !== undefined) { + coercedValue[field.name] = field.defaultValue; + } else if (isNonNullType(field.type)) { + const typeStr = inspect(field.type); + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Field "${field.name}" of required type "${typeStr}" was not provided.`, + ), + ); + } + + continue; + } + + coercedValue[field.name] = coerceInputValueImpl( + fieldValue, + field.type, + onError, + addPath(path, field.name, type.name), + ); + } // Ensure every provided field is defined. + + for (const fieldName of Object.keys(inputValue)) { + if (!fieldDefs[fieldName]) { + const suggestions = suggestionList( + fieldName, + Object.keys(type.getFields()), + ); + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Field "${fieldName}" is not defined by type "${type.name}".` + + didYouMean(suggestions), + ), + ); + } + } + + return coercedValue; + } + + if (isLeafType(type)) { + let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), + // which can throw to indicate failure. If it throws, maintain a reference + // to the original error. + + try { + parseResult = type.parseValue(inputValue); + } catch (error) { + if (error instanceof GraphQLError) { + onError(pathToArray(path), inputValue, error); + } else { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}". ` + error.message, { + originalError: error, + }), + ); + } + + return; + } + + if (parseResult === undefined) { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}".`), + ); + } + + return parseResult; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected input type: ' + inspect(type)); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/concatAST.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/concatAST.d.ts new file mode 100644 index 0000000..c8b91d5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/concatAST.d.ts @@ -0,0 +1,9 @@ +import type { DocumentNode } from '../language/ast'; +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ +export declare function concatAST( + documents: ReadonlyArray, +): DocumentNode; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/concatAST.js b/graphql-subscription-express/node_modules/graphql/utilities/concatAST.js new file mode 100644 index 0000000..d45af63 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/concatAST.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.concatAST = concatAST; + +var _kinds = require('../language/kinds.js'); + +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ +function concatAST(documents) { + const definitions = []; + + for (const doc of documents) { + definitions.push(...doc.definitions); + } + + return { + kind: _kinds.Kind.DOCUMENT, + definitions, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/concatAST.mjs b/graphql-subscription-express/node_modules/graphql/utilities/concatAST.mjs new file mode 100644 index 0000000..ca7b4c3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/concatAST.mjs @@ -0,0 +1,19 @@ +import { Kind } from '../language/kinds.mjs'; +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ + +export function concatAST(documents) { + const definitions = []; + + for (const doc of documents) { + definitions.push(...doc.definitions); + } + + return { + kind: Kind.DOCUMENT, + definitions, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.d.ts new file mode 100644 index 0000000..34d7bf0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.d.ts @@ -0,0 +1,40 @@ +import type { DocumentNode } from '../language/ast'; +import type { + GraphQLSchemaNormalizedConfig, + GraphQLSchemaValidationOptions, +} from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; +interface Options extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + */ + assumeValidSDL?: boolean; +} +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ +export declare function extendSchema( + schema: GraphQLSchema, + documentAST: DocumentNode, + options?: Options, +): GraphQLSchema; +/** + * @internal + */ +export declare function extendSchemaImpl( + schemaConfig: GraphQLSchemaNormalizedConfig, + documentAST: DocumentNode, + options?: Options, +): GraphQLSchemaNormalizedConfig; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.js b/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.js new file mode 100644 index 0000000..6ca7f5f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.js @@ -0,0 +1,798 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.extendSchema = extendSchema; +exports.extendSchemaImpl = extendSchemaImpl; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _mapValue = require('../jsutils/mapValue.js'); + +var _kinds = require('../language/kinds.js'); + +var _predicates = require('../language/predicates.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _scalars = require('../type/scalars.js'); + +var _schema = require('../type/schema.js'); + +var _validate = require('../validation/validate.js'); + +var _values = require('../execution/values.js'); + +var _valueFromAST = require('./valueFromAST.js'); + +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ +function extendSchema(schema, documentAST, options) { + (0, _schema.assertSchema)(schema); + (documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT) || + (0, _devAssert.devAssert)(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + (0, _validate.assertValidSDLExtension)(documentAST, schema); + } + + const schemaConfig = schema.toConfig(); + const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); + return schemaConfig === extendedConfig + ? schema + : new _schema.GraphQLSchema(extendedConfig); +} +/** + * @internal + */ + +function extendSchemaImpl(schemaConfig, documentAST, options) { + var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; + + // Collect the type definitions and extensions found in the document. + const typeDefs = []; + const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can + // have the same name. For example, a type named "skip". + + const directiveDefs = []; + let schemaDef; // Schema extensions are collected which may add additional operation types. + + const schemaExtensions = []; + + for (const def of documentAST.definitions) { + if (def.kind === _kinds.Kind.SCHEMA_DEFINITION) { + schemaDef = def; + } else if (def.kind === _kinds.Kind.SCHEMA_EXTENSION) { + schemaExtensions.push(def); + } else if ((0, _predicates.isTypeDefinitionNode)(def)) { + typeDefs.push(def); + } else if ((0, _predicates.isTypeExtensionNode)(def)) { + const extendedTypeName = def.name.value; + const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; + typeExtensionsMap[extendedTypeName] = existingTypeExtensions + ? existingTypeExtensions.concat([def]) + : [def]; + } else if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + directiveDefs.push(def); + } + } // If this document contains no new types, extensions, or directives then + // return the same unmodified GraphQLSchema instance. + + if ( + Object.keys(typeExtensionsMap).length === 0 && + typeDefs.length === 0 && + directiveDefs.length === 0 && + schemaExtensions.length === 0 && + schemaDef == null + ) { + return schemaConfig; + } + + const typeMap = Object.create(null); + + for (const existingType of schemaConfig.types) { + typeMap[existingType.name] = extendNamedType(existingType); + } + + for (const typeNode of typeDefs) { + var _stdTypeMap$name; + + const name = typeNode.name.value; + typeMap[name] = + (_stdTypeMap$name = stdTypeMap[name]) !== null && + _stdTypeMap$name !== void 0 + ? _stdTypeMap$name + : buildType(typeNode); + } + + const operationTypes = { + // Get the extended root operation types. + query: schemaConfig.query && replaceNamedType(schemaConfig.query), + mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), + subscription: + schemaConfig.subscription && replaceNamedType(schemaConfig.subscription), + // Then, incorporate schema definition and all schema extensions. + ...(schemaDef && getOperationTypes([schemaDef])), + ...getOperationTypes(schemaExtensions), + }; // Then produce and return a Schema config with these types. + + return { + description: + (_schemaDef = schemaDef) === null || _schemaDef === void 0 + ? void 0 + : (_schemaDef$descriptio = _schemaDef.description) === null || + _schemaDef$descriptio === void 0 + ? void 0 + : _schemaDef$descriptio.value, + ...operationTypes, + types: Object.values(typeMap), + directives: [ + ...schemaConfig.directives.map(replaceDirective), + ...directiveDefs.map(buildDirective), + ], + extensions: Object.create(null), + astNode: + (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 + ? _schemaDef2 + : schemaConfig.astNode, + extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), + assumeValid: + (_options$assumeValid = + options === null || options === void 0 + ? void 0 + : options.assumeValid) !== null && _options$assumeValid !== void 0 + ? _options$assumeValid + : false, + }; // Below are functions used for producing this schema that have closed over + // this scope and have access to the schema, cache, and newly defined types. + + function replaceType(type) { + if ((0, _definition.isListType)(type)) { + // @ts-expect-error + return new _definition.GraphQLList(replaceType(type.ofType)); + } + + if ((0, _definition.isNonNullType)(type)) { + // @ts-expect-error + return new _definition.GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + // Note: While this could make early assertions to get the correctly + // typed values, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + return typeMap[type.name]; + } + + function replaceDirective(directive) { + const config = directive.toConfig(); + return new _directives.GraphQLDirective({ + ...config, + args: (0, _mapValue.mapValue)(config.args, extendArg), + }); + } + + function extendNamedType(type) { + if ( + (0, _introspection.isIntrospectionType)(type) || + (0, _scalars.isSpecifiedScalarType)(type) + ) { + // Builtin types are not extended. + return type; + } + + if ((0, _definition.isScalarType)(type)) { + return extendScalarType(type); + } + + if ((0, _definition.isObjectType)(type)) { + return extendObjectType(type); + } + + if ((0, _definition.isInterfaceType)(type)) { + return extendInterfaceType(type); + } + + if ((0, _definition.isUnionType)(type)) { + return extendUnionType(type); + } + + if ((0, _definition.isEnumType)(type)) { + return extendEnumType(type); + } + + if ((0, _definition.isInputObjectType)(type)) { + return extendInputObjectType(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible type definition nodes have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); + } + + function extendInputObjectType(type) { + var _typeExtensionsMap$co; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co !== void 0 + ? _typeExtensionsMap$co + : []; + return new _definition.GraphQLInputObjectType({ + ...config, + fields: () => ({ + ...(0, _mapValue.mapValue)(config.fields, (field) => ({ + ...field, + type: replaceType(field.type), + })), + ...buildInputFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendEnumType(type) { + var _typeExtensionsMap$ty; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && + _typeExtensionsMap$ty !== void 0 + ? _typeExtensionsMap$ty + : []; + return new _definition.GraphQLEnumType({ + ...config, + values: { ...config.values, ...buildEnumValueMap(extensions) }, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendScalarType(type) { + var _typeExtensionsMap$co2; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co2 !== void 0 + ? _typeExtensionsMap$co2 + : []; + let specifiedByURL = config.specifiedByURL; + + for (const extensionNode of extensions) { + var _getSpecifiedByURL; + + specifiedByURL = + (_getSpecifiedByURL = getSpecifiedByURL(extensionNode)) !== null && + _getSpecifiedByURL !== void 0 + ? _getSpecifiedByURL + : specifiedByURL; + } + + return new _definition.GraphQLScalarType({ + ...config, + specifiedByURL, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendObjectType(type) { + var _typeExtensionsMap$co3; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co3 !== void 0 + ? _typeExtensionsMap$co3 + : []; + return new _definition.GraphQLObjectType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...(0, _mapValue.mapValue)(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendInterfaceType(type) { + var _typeExtensionsMap$co4; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co4 !== void 0 + ? _typeExtensionsMap$co4 + : []; + return new _definition.GraphQLInterfaceType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...(0, _mapValue.mapValue)(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendUnionType(type) { + var _typeExtensionsMap$co5; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co5 !== void 0 + ? _typeExtensionsMap$co5 + : []; + return new _definition.GraphQLUnionType({ + ...config, + types: () => [ + ...type.getTypes().map(replaceNamedType), + ...buildUnionTypes(extensions), + ], + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendField(field) { + return { + ...field, + type: replaceType(field.type), + args: field.args && (0, _mapValue.mapValue)(field.args, extendArg), + }; + } + + function extendArg(arg) { + return { ...arg, type: replaceType(arg.type) }; + } + + function getOperationTypes(nodes) { + const opTypes = {}; + + for (const node of nodes) { + var _node$operationTypes; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const operationTypesNodes = + /* c8 ignore next */ + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + opTypes[operationType.operation] = getNamedType(operationType.type); + } + } + + return opTypes; + } + + function getNamedType(node) { + var _stdTypeMap$name2; + + const name = node.name.value; + const type = + (_stdTypeMap$name2 = stdTypeMap[name]) !== null && + _stdTypeMap$name2 !== void 0 + ? _stdTypeMap$name2 + : typeMap[name]; + + if (type === undefined) { + throw new Error(`Unknown type: "${name}".`); + } + + return type; + } + + function getWrappedType(node) { + if (node.kind === _kinds.Kind.LIST_TYPE) { + return new _definition.GraphQLList(getWrappedType(node.type)); + } + + if (node.kind === _kinds.Kind.NON_NULL_TYPE) { + return new _definition.GraphQLNonNull(getWrappedType(node.type)); + } + + return getNamedType(node); + } + + function buildDirective(node) { + var _node$description; + + return new _directives.GraphQLDirective({ + name: node.name.value, + description: + (_node$description = node.description) === null || + _node$description === void 0 + ? void 0 + : _node$description.value, + // @ts-expect-error + locations: node.locations.map(({ value }) => value), + isRepeatable: node.repeatable, + args: buildArgumentMap(node.arguments), + astNode: node, + }); + } + + function buildFieldMap(nodes) { + const fieldConfigMap = Object.create(null); + + for (const node of nodes) { + var _node$fields; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const nodeFields = + /* c8 ignore next */ + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + + for (const field of nodeFields) { + var _field$description; + + fieldConfigMap[field.name.value] = { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + type: getWrappedType(field.type), + description: + (_field$description = field.description) === null || + _field$description === void 0 + ? void 0 + : _field$description.value, + args: buildArgumentMap(field.arguments), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return fieldConfigMap; + } + + function buildArgumentMap(args) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const argsNodes = + /* c8 ignore next */ + args !== null && args !== void 0 ? args : []; + const argConfigMap = Object.create(null); + + for (const arg of argsNodes) { + var _arg$description; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(arg.type); + argConfigMap[arg.name.value] = { + type, + description: + (_arg$description = arg.description) === null || + _arg$description === void 0 + ? void 0 + : _arg$description.value, + defaultValue: (0, _valueFromAST.valueFromAST)(arg.defaultValue, type), + deprecationReason: getDeprecationReason(arg), + astNode: arg, + }; + } + + return argConfigMap; + } + + function buildInputFieldMap(nodes) { + const inputFieldMap = Object.create(null); + + for (const node of nodes) { + var _node$fields2; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const fieldsNodes = + /* c8 ignore next */ + (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 + ? _node$fields2 + : []; + + for (const field of fieldsNodes) { + var _field$description2; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(field.type); + inputFieldMap[field.name.value] = { + type, + description: + (_field$description2 = field.description) === null || + _field$description2 === void 0 + ? void 0 + : _field$description2.value, + defaultValue: (0, _valueFromAST.valueFromAST)( + field.defaultValue, + type, + ), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return inputFieldMap; + } + + function buildEnumValueMap(nodes) { + const enumValueMap = Object.create(null); + + for (const node of nodes) { + var _node$values; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const valuesNodes = + /* c8 ignore next */ + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + + for (const value of valuesNodes) { + var _value$description; + + enumValueMap[value.name.value] = { + description: + (_value$description = value.description) === null || + _value$description === void 0 + ? void 0 + : _value$description.value, + deprecationReason: getDeprecationReason(value), + astNode: value, + }; + } + } + + return enumValueMap; + } + + function buildInterfaces(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$interfaces$map, _node$interfaces; + + return ( + /* c8 ignore next */ + (_node$interfaces$map = + (_node$interfaces = node.interfaces) === null || + _node$interfaces === void 0 + ? void 0 + : _node$interfaces.map(getNamedType)) !== null && + _node$interfaces$map !== void 0 + ? _node$interfaces$map + : [] + ); + }, + ); + } + + function buildUnionTypes(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$types$map, _node$types; + + return ( + /* c8 ignore next */ + (_node$types$map = + (_node$types = node.types) === null || _node$types === void 0 + ? void 0 + : _node$types.map(getNamedType)) !== null && + _node$types$map !== void 0 + ? _node$types$map + : [] + ); + }, + ); + } + + function buildType(astNode) { + var _typeExtensionsMap$na; + + const name = astNode.name.value; + const extensionASTNodes = + (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && + _typeExtensionsMap$na !== void 0 + ? _typeExtensionsMap$na + : []; + + switch (astNode.kind) { + case _kinds.Kind.OBJECT_TYPE_DEFINITION: { + var _astNode$description; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLObjectType({ + name, + description: + (_astNode$description = astNode.description) === null || + _astNode$description === void 0 + ? void 0 + : _astNode$description.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.INTERFACE_TYPE_DEFINITION: { + var _astNode$description2; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLInterfaceType({ + name, + description: + (_astNode$description2 = astNode.description) === null || + _astNode$description2 === void 0 + ? void 0 + : _astNode$description2.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.ENUM_TYPE_DEFINITION: { + var _astNode$description3; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLEnumType({ + name, + description: + (_astNode$description3 = astNode.description) === null || + _astNode$description3 === void 0 + ? void 0 + : _astNode$description3.value, + values: buildEnumValueMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.UNION_TYPE_DEFINITION: { + var _astNode$description4; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLUnionType({ + name, + description: + (_astNode$description4 = astNode.description) === null || + _astNode$description4 === void 0 + ? void 0 + : _astNode$description4.value, + types: () => buildUnionTypes(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.SCALAR_TYPE_DEFINITION: { + var _astNode$description5; + + return new _definition.GraphQLScalarType({ + name, + description: + (_astNode$description5 = astNode.description) === null || + _astNode$description5 === void 0 + ? void 0 + : _astNode$description5.value, + specifiedByURL: getSpecifiedByURL(astNode), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: { + var _astNode$description6; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLInputObjectType({ + name, + description: + (_astNode$description6 = astNode.description) === null || + _astNode$description6 === void 0 + ? void 0 + : _astNode$description6.value, + fields: () => buildInputFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + } + } +} + +const stdTypeMap = (0, _keyMap.keyMap)( + [..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes], + (type) => type.name, +); +/** + * Given a field or enum value node, returns the string value for the + * deprecation reason. + */ + +function getDeprecationReason(node) { + const deprecated = (0, _values.getDirectiveValues)( + _directives.GraphQLDeprecatedDirective, + node, + ); // @ts-expect-error validated by `getDirectiveValues` + + return deprecated === null || deprecated === void 0 + ? void 0 + : deprecated.reason; +} +/** + * Given a scalar node, returns the string value for the specifiedByURL. + */ + +function getSpecifiedByURL(node) { + const specifiedBy = (0, _values.getDirectiveValues)( + _directives.GraphQLSpecifiedByDirective, + node, + ); // @ts-expect-error validated by `getDirectiveValues` + + return specifiedBy === null || specifiedBy === void 0 + ? void 0 + : specifiedBy.url; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.mjs b/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.mjs new file mode 100644 index 0000000..78e18ea --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/extendSchema.mjs @@ -0,0 +1,789 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { mapValue } from '../jsutils/mapValue.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isTypeDefinitionNode, + isTypeExtensionNode, +} from '../language/predicates.mjs'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { + GraphQLDeprecatedDirective, + GraphQLDirective, + GraphQLSpecifiedByDirective, +} from '../type/directives.mjs'; +import { + introspectionTypes, + isIntrospectionType, +} from '../type/introspection.mjs'; +import { + isSpecifiedScalarType, + specifiedScalarTypes, +} from '../type/scalars.mjs'; +import { assertSchema, GraphQLSchema } from '../type/schema.mjs'; +import { assertValidSDLExtension } from '../validation/validate.mjs'; +import { getDirectiveValues } from '../execution/values.mjs'; +import { valueFromAST } from './valueFromAST.mjs'; + +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ +export function extendSchema(schema, documentAST, options) { + assertSchema(schema); + (documentAST != null && documentAST.kind === Kind.DOCUMENT) || + devAssert(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + assertValidSDLExtension(documentAST, schema); + } + + const schemaConfig = schema.toConfig(); + const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); + return schemaConfig === extendedConfig + ? schema + : new GraphQLSchema(extendedConfig); +} +/** + * @internal + */ + +export function extendSchemaImpl(schemaConfig, documentAST, options) { + var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; + + // Collect the type definitions and extensions found in the document. + const typeDefs = []; + const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can + // have the same name. For example, a type named "skip". + + const directiveDefs = []; + let schemaDef; // Schema extensions are collected which may add additional operation types. + + const schemaExtensions = []; + + for (const def of documentAST.definitions) { + if (def.kind === Kind.SCHEMA_DEFINITION) { + schemaDef = def; + } else if (def.kind === Kind.SCHEMA_EXTENSION) { + schemaExtensions.push(def); + } else if (isTypeDefinitionNode(def)) { + typeDefs.push(def); + } else if (isTypeExtensionNode(def)) { + const extendedTypeName = def.name.value; + const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; + typeExtensionsMap[extendedTypeName] = existingTypeExtensions + ? existingTypeExtensions.concat([def]) + : [def]; + } else if (def.kind === Kind.DIRECTIVE_DEFINITION) { + directiveDefs.push(def); + } + } // If this document contains no new types, extensions, or directives then + // return the same unmodified GraphQLSchema instance. + + if ( + Object.keys(typeExtensionsMap).length === 0 && + typeDefs.length === 0 && + directiveDefs.length === 0 && + schemaExtensions.length === 0 && + schemaDef == null + ) { + return schemaConfig; + } + + const typeMap = Object.create(null); + + for (const existingType of schemaConfig.types) { + typeMap[existingType.name] = extendNamedType(existingType); + } + + for (const typeNode of typeDefs) { + var _stdTypeMap$name; + + const name = typeNode.name.value; + typeMap[name] = + (_stdTypeMap$name = stdTypeMap[name]) !== null && + _stdTypeMap$name !== void 0 + ? _stdTypeMap$name + : buildType(typeNode); + } + + const operationTypes = { + // Get the extended root operation types. + query: schemaConfig.query && replaceNamedType(schemaConfig.query), + mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), + subscription: + schemaConfig.subscription && replaceNamedType(schemaConfig.subscription), + // Then, incorporate schema definition and all schema extensions. + ...(schemaDef && getOperationTypes([schemaDef])), + ...getOperationTypes(schemaExtensions), + }; // Then produce and return a Schema config with these types. + + return { + description: + (_schemaDef = schemaDef) === null || _schemaDef === void 0 + ? void 0 + : (_schemaDef$descriptio = _schemaDef.description) === null || + _schemaDef$descriptio === void 0 + ? void 0 + : _schemaDef$descriptio.value, + ...operationTypes, + types: Object.values(typeMap), + directives: [ + ...schemaConfig.directives.map(replaceDirective), + ...directiveDefs.map(buildDirective), + ], + extensions: Object.create(null), + astNode: + (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 + ? _schemaDef2 + : schemaConfig.astNode, + extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), + assumeValid: + (_options$assumeValid = + options === null || options === void 0 + ? void 0 + : options.assumeValid) !== null && _options$assumeValid !== void 0 + ? _options$assumeValid + : false, + }; // Below are functions used for producing this schema that have closed over + // this scope and have access to the schema, cache, and newly defined types. + + function replaceType(type) { + if (isListType(type)) { + // @ts-expect-error + return new GraphQLList(replaceType(type.ofType)); + } + + if (isNonNullType(type)) { + // @ts-expect-error + return new GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + // Note: While this could make early assertions to get the correctly + // typed values, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + return typeMap[type.name]; + } + + function replaceDirective(directive) { + const config = directive.toConfig(); + return new GraphQLDirective({ + ...config, + args: mapValue(config.args, extendArg), + }); + } + + function extendNamedType(type) { + if (isIntrospectionType(type) || isSpecifiedScalarType(type)) { + // Builtin types are not extended. + return type; + } + + if (isScalarType(type)) { + return extendScalarType(type); + } + + if (isObjectType(type)) { + return extendObjectType(type); + } + + if (isInterfaceType(type)) { + return extendInterfaceType(type); + } + + if (isUnionType(type)) { + return extendUnionType(type); + } + + if (isEnumType(type)) { + return extendEnumType(type); + } + + if (isInputObjectType(type)) { + return extendInputObjectType(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible type definition nodes have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); + } + + function extendInputObjectType(type) { + var _typeExtensionsMap$co; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co !== void 0 + ? _typeExtensionsMap$co + : []; + return new GraphQLInputObjectType({ + ...config, + fields: () => ({ + ...mapValue(config.fields, (field) => ({ + ...field, + type: replaceType(field.type), + })), + ...buildInputFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendEnumType(type) { + var _typeExtensionsMap$ty; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && + _typeExtensionsMap$ty !== void 0 + ? _typeExtensionsMap$ty + : []; + return new GraphQLEnumType({ + ...config, + values: { ...config.values, ...buildEnumValueMap(extensions) }, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendScalarType(type) { + var _typeExtensionsMap$co2; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co2 !== void 0 + ? _typeExtensionsMap$co2 + : []; + let specifiedByURL = config.specifiedByURL; + + for (const extensionNode of extensions) { + var _getSpecifiedByURL; + + specifiedByURL = + (_getSpecifiedByURL = getSpecifiedByURL(extensionNode)) !== null && + _getSpecifiedByURL !== void 0 + ? _getSpecifiedByURL + : specifiedByURL; + } + + return new GraphQLScalarType({ + ...config, + specifiedByURL, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendObjectType(type) { + var _typeExtensionsMap$co3; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co3 !== void 0 + ? _typeExtensionsMap$co3 + : []; + return new GraphQLObjectType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...mapValue(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendInterfaceType(type) { + var _typeExtensionsMap$co4; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co4 !== void 0 + ? _typeExtensionsMap$co4 + : []; + return new GraphQLInterfaceType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...mapValue(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendUnionType(type) { + var _typeExtensionsMap$co5; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co5 !== void 0 + ? _typeExtensionsMap$co5 + : []; + return new GraphQLUnionType({ + ...config, + types: () => [ + ...type.getTypes().map(replaceNamedType), + ...buildUnionTypes(extensions), + ], + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendField(field) { + return { + ...field, + type: replaceType(field.type), + args: field.args && mapValue(field.args, extendArg), + }; + } + + function extendArg(arg) { + return { ...arg, type: replaceType(arg.type) }; + } + + function getOperationTypes(nodes) { + const opTypes = {}; + + for (const node of nodes) { + var _node$operationTypes; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const operationTypesNodes = + /* c8 ignore next */ + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + opTypes[operationType.operation] = getNamedType(operationType.type); + } + } + + return opTypes; + } + + function getNamedType(node) { + var _stdTypeMap$name2; + + const name = node.name.value; + const type = + (_stdTypeMap$name2 = stdTypeMap[name]) !== null && + _stdTypeMap$name2 !== void 0 + ? _stdTypeMap$name2 + : typeMap[name]; + + if (type === undefined) { + throw new Error(`Unknown type: "${name}".`); + } + + return type; + } + + function getWrappedType(node) { + if (node.kind === Kind.LIST_TYPE) { + return new GraphQLList(getWrappedType(node.type)); + } + + if (node.kind === Kind.NON_NULL_TYPE) { + return new GraphQLNonNull(getWrappedType(node.type)); + } + + return getNamedType(node); + } + + function buildDirective(node) { + var _node$description; + + return new GraphQLDirective({ + name: node.name.value, + description: + (_node$description = node.description) === null || + _node$description === void 0 + ? void 0 + : _node$description.value, + // @ts-expect-error + locations: node.locations.map(({ value }) => value), + isRepeatable: node.repeatable, + args: buildArgumentMap(node.arguments), + astNode: node, + }); + } + + function buildFieldMap(nodes) { + const fieldConfigMap = Object.create(null); + + for (const node of nodes) { + var _node$fields; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const nodeFields = + /* c8 ignore next */ + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + + for (const field of nodeFields) { + var _field$description; + + fieldConfigMap[field.name.value] = { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + type: getWrappedType(field.type), + description: + (_field$description = field.description) === null || + _field$description === void 0 + ? void 0 + : _field$description.value, + args: buildArgumentMap(field.arguments), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return fieldConfigMap; + } + + function buildArgumentMap(args) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const argsNodes = + /* c8 ignore next */ + args !== null && args !== void 0 ? args : []; + const argConfigMap = Object.create(null); + + for (const arg of argsNodes) { + var _arg$description; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(arg.type); + argConfigMap[arg.name.value] = { + type, + description: + (_arg$description = arg.description) === null || + _arg$description === void 0 + ? void 0 + : _arg$description.value, + defaultValue: valueFromAST(arg.defaultValue, type), + deprecationReason: getDeprecationReason(arg), + astNode: arg, + }; + } + + return argConfigMap; + } + + function buildInputFieldMap(nodes) { + const inputFieldMap = Object.create(null); + + for (const node of nodes) { + var _node$fields2; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const fieldsNodes = + /* c8 ignore next */ + (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 + ? _node$fields2 + : []; + + for (const field of fieldsNodes) { + var _field$description2; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(field.type); + inputFieldMap[field.name.value] = { + type, + description: + (_field$description2 = field.description) === null || + _field$description2 === void 0 + ? void 0 + : _field$description2.value, + defaultValue: valueFromAST(field.defaultValue, type), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return inputFieldMap; + } + + function buildEnumValueMap(nodes) { + const enumValueMap = Object.create(null); + + for (const node of nodes) { + var _node$values; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const valuesNodes = + /* c8 ignore next */ + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + + for (const value of valuesNodes) { + var _value$description; + + enumValueMap[value.name.value] = { + description: + (_value$description = value.description) === null || + _value$description === void 0 + ? void 0 + : _value$description.value, + deprecationReason: getDeprecationReason(value), + astNode: value, + }; + } + } + + return enumValueMap; + } + + function buildInterfaces(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$interfaces$map, _node$interfaces; + + return ( + /* c8 ignore next */ + (_node$interfaces$map = + (_node$interfaces = node.interfaces) === null || + _node$interfaces === void 0 + ? void 0 + : _node$interfaces.map(getNamedType)) !== null && + _node$interfaces$map !== void 0 + ? _node$interfaces$map + : [] + ); + }, + ); + } + + function buildUnionTypes(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$types$map, _node$types; + + return ( + /* c8 ignore next */ + (_node$types$map = + (_node$types = node.types) === null || _node$types === void 0 + ? void 0 + : _node$types.map(getNamedType)) !== null && + _node$types$map !== void 0 + ? _node$types$map + : [] + ); + }, + ); + } + + function buildType(astNode) { + var _typeExtensionsMap$na; + + const name = astNode.name.value; + const extensionASTNodes = + (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && + _typeExtensionsMap$na !== void 0 + ? _typeExtensionsMap$na + : []; + + switch (astNode.kind) { + case Kind.OBJECT_TYPE_DEFINITION: { + var _astNode$description; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLObjectType({ + name, + description: + (_astNode$description = astNode.description) === null || + _astNode$description === void 0 + ? void 0 + : _astNode$description.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.INTERFACE_TYPE_DEFINITION: { + var _astNode$description2; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLInterfaceType({ + name, + description: + (_astNode$description2 = astNode.description) === null || + _astNode$description2 === void 0 + ? void 0 + : _astNode$description2.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.ENUM_TYPE_DEFINITION: { + var _astNode$description3; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLEnumType({ + name, + description: + (_astNode$description3 = astNode.description) === null || + _astNode$description3 === void 0 + ? void 0 + : _astNode$description3.value, + values: buildEnumValueMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.UNION_TYPE_DEFINITION: { + var _astNode$description4; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLUnionType({ + name, + description: + (_astNode$description4 = astNode.description) === null || + _astNode$description4 === void 0 + ? void 0 + : _astNode$description4.value, + types: () => buildUnionTypes(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.SCALAR_TYPE_DEFINITION: { + var _astNode$description5; + + return new GraphQLScalarType({ + name, + description: + (_astNode$description5 = astNode.description) === null || + _astNode$description5 === void 0 + ? void 0 + : _astNode$description5.value, + specifiedByURL: getSpecifiedByURL(astNode), + astNode, + extensionASTNodes, + }); + } + + case Kind.INPUT_OBJECT_TYPE_DEFINITION: { + var _astNode$description6; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLInputObjectType({ + name, + description: + (_astNode$description6 = astNode.description) === null || + _astNode$description6 === void 0 + ? void 0 + : _astNode$description6.value, + fields: () => buildInputFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + } + } +} +const stdTypeMap = keyMap( + [...specifiedScalarTypes, ...introspectionTypes], + (type) => type.name, +); +/** + * Given a field or enum value node, returns the string value for the + * deprecation reason. + */ + +function getDeprecationReason(node) { + const deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node); // @ts-expect-error validated by `getDirectiveValues` + + return deprecated === null || deprecated === void 0 + ? void 0 + : deprecated.reason; +} +/** + * Given a scalar node, returns the string value for the specifiedByURL. + */ + +function getSpecifiedByURL(node) { + const specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node); // @ts-expect-error validated by `getDirectiveValues` + + return specifiedBy === null || specifiedBy === void 0 + ? void 0 + : specifiedBy.url; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.d.ts new file mode 100644 index 0000000..d635b60 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.d.ts @@ -0,0 +1,53 @@ +import type { GraphQLSchema } from '../type/schema'; +declare enum BreakingChangeType { + TYPE_REMOVED = 'TYPE_REMOVED', + TYPE_CHANGED_KIND = 'TYPE_CHANGED_KIND', + TYPE_REMOVED_FROM_UNION = 'TYPE_REMOVED_FROM_UNION', + VALUE_REMOVED_FROM_ENUM = 'VALUE_REMOVED_FROM_ENUM', + REQUIRED_INPUT_FIELD_ADDED = 'REQUIRED_INPUT_FIELD_ADDED', + IMPLEMENTED_INTERFACE_REMOVED = 'IMPLEMENTED_INTERFACE_REMOVED', + FIELD_REMOVED = 'FIELD_REMOVED', + FIELD_CHANGED_KIND = 'FIELD_CHANGED_KIND', + REQUIRED_ARG_ADDED = 'REQUIRED_ARG_ADDED', + ARG_REMOVED = 'ARG_REMOVED', + ARG_CHANGED_KIND = 'ARG_CHANGED_KIND', + DIRECTIVE_REMOVED = 'DIRECTIVE_REMOVED', + DIRECTIVE_ARG_REMOVED = 'DIRECTIVE_ARG_REMOVED', + REQUIRED_DIRECTIVE_ARG_ADDED = 'REQUIRED_DIRECTIVE_ARG_ADDED', + DIRECTIVE_REPEATABLE_REMOVED = 'DIRECTIVE_REPEATABLE_REMOVED', + DIRECTIVE_LOCATION_REMOVED = 'DIRECTIVE_LOCATION_REMOVED', +} +export { BreakingChangeType }; +declare enum DangerousChangeType { + VALUE_ADDED_TO_ENUM = 'VALUE_ADDED_TO_ENUM', + TYPE_ADDED_TO_UNION = 'TYPE_ADDED_TO_UNION', + OPTIONAL_INPUT_FIELD_ADDED = 'OPTIONAL_INPUT_FIELD_ADDED', + OPTIONAL_ARG_ADDED = 'OPTIONAL_ARG_ADDED', + IMPLEMENTED_INTERFACE_ADDED = 'IMPLEMENTED_INTERFACE_ADDED', + ARG_DEFAULT_VALUE_CHANGE = 'ARG_DEFAULT_VALUE_CHANGE', +} +export { DangerousChangeType }; +export interface BreakingChange { + type: BreakingChangeType; + description: string; +} +export interface DangerousChange { + type: DangerousChangeType; + description: string; +} +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +export declare function findBreakingChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array; +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ +export declare function findDangerousChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.js b/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.js new file mode 100644 index 0000000..9fb5e39 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.js @@ -0,0 +1,547 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.DangerousChangeType = exports.BreakingChangeType = void 0; +exports.findBreakingChanges = findBreakingChanges; +exports.findDangerousChanges = findDangerousChanges; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('../type/definition.js'); + +var _scalars = require('../type/scalars.js'); + +var _astFromValue = require('./astFromValue.js'); + +var _sortValueNode = require('./sortValueNode.js'); + +var BreakingChangeType; +exports.BreakingChangeType = BreakingChangeType; + +(function (BreakingChangeType) { + BreakingChangeType['TYPE_REMOVED'] = 'TYPE_REMOVED'; + BreakingChangeType['TYPE_CHANGED_KIND'] = 'TYPE_CHANGED_KIND'; + BreakingChangeType['TYPE_REMOVED_FROM_UNION'] = 'TYPE_REMOVED_FROM_UNION'; + BreakingChangeType['VALUE_REMOVED_FROM_ENUM'] = 'VALUE_REMOVED_FROM_ENUM'; + BreakingChangeType['REQUIRED_INPUT_FIELD_ADDED'] = + 'REQUIRED_INPUT_FIELD_ADDED'; + BreakingChangeType['IMPLEMENTED_INTERFACE_REMOVED'] = + 'IMPLEMENTED_INTERFACE_REMOVED'; + BreakingChangeType['FIELD_REMOVED'] = 'FIELD_REMOVED'; + BreakingChangeType['FIELD_CHANGED_KIND'] = 'FIELD_CHANGED_KIND'; + BreakingChangeType['REQUIRED_ARG_ADDED'] = 'REQUIRED_ARG_ADDED'; + BreakingChangeType['ARG_REMOVED'] = 'ARG_REMOVED'; + BreakingChangeType['ARG_CHANGED_KIND'] = 'ARG_CHANGED_KIND'; + BreakingChangeType['DIRECTIVE_REMOVED'] = 'DIRECTIVE_REMOVED'; + BreakingChangeType['DIRECTIVE_ARG_REMOVED'] = 'DIRECTIVE_ARG_REMOVED'; + BreakingChangeType['REQUIRED_DIRECTIVE_ARG_ADDED'] = + 'REQUIRED_DIRECTIVE_ARG_ADDED'; + BreakingChangeType['DIRECTIVE_REPEATABLE_REMOVED'] = + 'DIRECTIVE_REPEATABLE_REMOVED'; + BreakingChangeType['DIRECTIVE_LOCATION_REMOVED'] = + 'DIRECTIVE_LOCATION_REMOVED'; +})( + BreakingChangeType || (exports.BreakingChangeType = BreakingChangeType = {}), +); + +var DangerousChangeType; +exports.DangerousChangeType = DangerousChangeType; + +(function (DangerousChangeType) { + DangerousChangeType['VALUE_ADDED_TO_ENUM'] = 'VALUE_ADDED_TO_ENUM'; + DangerousChangeType['TYPE_ADDED_TO_UNION'] = 'TYPE_ADDED_TO_UNION'; + DangerousChangeType['OPTIONAL_INPUT_FIELD_ADDED'] = + 'OPTIONAL_INPUT_FIELD_ADDED'; + DangerousChangeType['OPTIONAL_ARG_ADDED'] = 'OPTIONAL_ARG_ADDED'; + DangerousChangeType['IMPLEMENTED_INTERFACE_ADDED'] = + 'IMPLEMENTED_INTERFACE_ADDED'; + DangerousChangeType['ARG_DEFAULT_VALUE_CHANGE'] = 'ARG_DEFAULT_VALUE_CHANGE'; +})( + DangerousChangeType || + (exports.DangerousChangeType = DangerousChangeType = {}), +); + +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +function findBreakingChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in BreakingChangeType, + ); +} +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ + +function findDangerousChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in DangerousChangeType, + ); +} + +function findSchemaChanges(oldSchema, newSchema) { + return [ + ...findTypeChanges(oldSchema, newSchema), + ...findDirectiveChanges(oldSchema, newSchema), + ]; +} + +function findDirectiveChanges(oldSchema, newSchema) { + const schemaChanges = []; + const directivesDiff = diff( + oldSchema.getDirectives(), + newSchema.getDirectives(), + ); + + for (const oldDirective of directivesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: `${oldDirective.name} was removed.`, + }); + } + + for (const [oldDirective, newDirective] of directivesDiff.persisted) { + const argsDiff = diff(oldDirective.args, newDirective.args); + + for (const newArg of argsDiff.added) { + if ((0, _definition.isRequiredArgument)(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`, + }); + } + } + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: `${oldArg.name} was removed from ${oldDirective.name}.`, + }); + } + + if (oldDirective.isRepeatable && !newDirective.isRepeatable) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: `Repeatable flag was removed from ${oldDirective.name}.`, + }); + } + + for (const location of oldDirective.locations) { + if (!newDirective.locations.includes(location)) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: `${location} was removed from ${oldDirective.name}.`, + }); + } + } + } + + return schemaChanges; +} + +function findTypeChanges(oldSchema, newSchema) { + const schemaChanges = []; + const typesDiff = diff( + Object.values(oldSchema.getTypeMap()), + Object.values(newSchema.getTypeMap()), + ); + + for (const oldType of typesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED, + description: (0, _scalars.isSpecifiedScalarType)(oldType) + ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.` + : `${oldType.name} was removed.`, + }); + } + + for (const [oldType, newType] of typesDiff.persisted) { + if ( + (0, _definition.isEnumType)(oldType) && + (0, _definition.isEnumType)(newType) + ) { + schemaChanges.push(...findEnumTypeChanges(oldType, newType)); + } else if ( + (0, _definition.isUnionType)(oldType) && + (0, _definition.isUnionType)(newType) + ) { + schemaChanges.push(...findUnionTypeChanges(oldType, newType)); + } else if ( + (0, _definition.isInputObjectType)(oldType) && + (0, _definition.isInputObjectType)(newType) + ) { + schemaChanges.push(...findInputObjectTypeChanges(oldType, newType)); + } else if ( + (0, _definition.isObjectType)(oldType) && + (0, _definition.isObjectType)(newType) + ) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if ( + (0, _definition.isInterfaceType)(oldType) && + (0, _definition.isInterfaceType)(newType) + ) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (oldType.constructor !== newType.constructor) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + `${oldType.name} changed from ` + + `${typeKindName(oldType)} to ${typeKindName(newType)}.`, + }); + } + } + + return schemaChanges; +} + +function findInputObjectTypeChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const newField of fieldsDiff.added) { + if ((0, _definition.isRequiredInputField)(newField)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, + description: `A required field ${newField.name} on input type ${oldType.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, + description: `An optional field ${newField.name} on input type ${oldType.name} was added.`, + }); + } + } + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findUnionTypeChanges(oldType, newType) { + const schemaChanges = []; + const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); + + for (const newPossibleType of possibleTypesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: `${newPossibleType.name} was added to union type ${oldType.name}.`, + }); + } + + for (const oldPossibleType of possibleTypesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findEnumTypeChanges(oldType, newType) { + const schemaChanges = []; + const valuesDiff = diff(oldType.getValues(), newType.getValues()); + + for (const newValue of valuesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: `${newValue.name} was added to enum type ${oldType.name}.`, + }); + } + + for (const oldValue of valuesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: `${oldValue.name} was removed from enum type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findImplementedInterfacesChanges(oldType, newType) { + const schemaChanges = []; + const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); + + for (const newInterface of interfacesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`, + }); + } + + for (const oldInterface of interfacesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: `${oldType.name} no longer implements interface ${oldInterface.name}.`, + }); + } + + return schemaChanges; +} + +function findFieldChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + schemaChanges.push(...findArgChanges(oldType, oldField, newField)); + const isSafe = isChangeSafeForObjectOrInterfaceField( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findArgChanges(oldType, oldField, newField) { + const schemaChanges = []; + const argsDiff = diff(oldField.args, newField.args); + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.ARG_REMOVED, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.`, + }); + } + + for (const [oldArg, newArg] of argsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldArg.type, + newArg.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` + + `${String(oldArg.type)} to ${String(newArg.type)}.`, + }); + } else if (oldArg.defaultValue !== undefined) { + if (newArg.defaultValue === undefined) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`, + }); + } else { + // Since we looking only for client's observable changes we should + // compare default values in the same representation as they are + // represented inside introspection. + const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type); + const newValueStr = stringifyValue(newArg.defaultValue, newArg.type); + + if (oldValueStr !== newValueStr) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`, + }); + } + } + } + } + + for (const newArg of argsDiff.added) { + if ((0, _definition.isRequiredArgument)(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_ARG_ADDED, + description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_ARG_ADDED, + description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } + } + + return schemaChanges; +} + +function isChangeSafeForObjectOrInterfaceField(oldType, newType) { + if ((0, _definition.isListType)(oldType)) { + return ( + // if they're both lists, make sure the underlying types are compatible + ((0, _definition.isListType)(newType) && + isChangeSafeForObjectOrInterfaceField( + oldType.ofType, + newType.ofType, + )) || // moving from nullable to non-null of the same underlying type is safe + ((0, _definition.isNonNullType)(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); + } + + if ((0, _definition.isNonNullType)(oldType)) { + // if they're both non-null, make sure the underlying types are compatible + return ( + (0, _definition.isNonNullType)(newType) && + isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) + ); + } + + return ( + // if they're both named types, see if their names are equivalent + ((0, _definition.isNamedType)(newType) && oldType.name === newType.name) || // moving from nullable to non-null of the same underlying type is safe + ((0, _definition.isNonNullType)(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); +} + +function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { + if ((0, _definition.isListType)(oldType)) { + // if they're both lists, make sure the underlying types are compatible + return ( + (0, _definition.isListType)(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) + ); + } + + if ((0, _definition.isNonNullType)(oldType)) { + return ( + // if they're both non-null, make sure the underlying types are + // compatible + ((0, _definition.isNonNullType)(newType) && + isChangeSafeForInputObjectFieldOrFieldArg( + oldType.ofType, + newType.ofType, + )) || // moving from non-null to nullable of the same underlying type is safe + (!(0, _definition.isNonNullType)(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)) + ); + } // if they're both named types, see if their names are equivalent + + return (0, _definition.isNamedType)(newType) && oldType.name === newType.name; +} + +function typeKindName(type) { + if ((0, _definition.isScalarType)(type)) { + return 'a Scalar type'; + } + + if ((0, _definition.isObjectType)(type)) { + return 'an Object type'; + } + + if ((0, _definition.isInterfaceType)(type)) { + return 'an Interface type'; + } + + if ((0, _definition.isUnionType)(type)) { + return 'a Union type'; + } + + if ((0, _definition.isEnumType)(type)) { + return 'an Enum type'; + } + + if ((0, _definition.isInputObjectType)(type)) { + return 'an Input type'; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); +} + +function stringifyValue(value, type) { + const ast = (0, _astFromValue.astFromValue)(value, type); + ast != null || (0, _invariant.invariant)(false); + return (0, _printer.print)((0, _sortValueNode.sortValueNode)(ast)); +} + +function diff(oldArray, newArray) { + const added = []; + const removed = []; + const persisted = []; + const oldMap = (0, _keyMap.keyMap)(oldArray, ({ name }) => name); + const newMap = (0, _keyMap.keyMap)(newArray, ({ name }) => name); + + for (const oldItem of oldArray) { + const newItem = newMap[oldItem.name]; + + if (newItem === undefined) { + removed.push(oldItem); + } else { + persisted.push([oldItem, newItem]); + } + } + + for (const newItem of newArray) { + if (oldMap[newItem.name] === undefined) { + added.push(newItem); + } + } + + return { + added, + persisted, + removed, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.mjs b/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.mjs new file mode 100644 index 0000000..50756e3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/findBreakingChanges.mjs @@ -0,0 +1,519 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { print } from '../language/printer.mjs'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNamedType, + isNonNullType, + isObjectType, + isRequiredArgument, + isRequiredInputField, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { isSpecifiedScalarType } from '../type/scalars.mjs'; +import { astFromValue } from './astFromValue.mjs'; +import { sortValueNode } from './sortValueNode.mjs'; +var BreakingChangeType; + +(function (BreakingChangeType) { + BreakingChangeType['TYPE_REMOVED'] = 'TYPE_REMOVED'; + BreakingChangeType['TYPE_CHANGED_KIND'] = 'TYPE_CHANGED_KIND'; + BreakingChangeType['TYPE_REMOVED_FROM_UNION'] = 'TYPE_REMOVED_FROM_UNION'; + BreakingChangeType['VALUE_REMOVED_FROM_ENUM'] = 'VALUE_REMOVED_FROM_ENUM'; + BreakingChangeType['REQUIRED_INPUT_FIELD_ADDED'] = + 'REQUIRED_INPUT_FIELD_ADDED'; + BreakingChangeType['IMPLEMENTED_INTERFACE_REMOVED'] = + 'IMPLEMENTED_INTERFACE_REMOVED'; + BreakingChangeType['FIELD_REMOVED'] = 'FIELD_REMOVED'; + BreakingChangeType['FIELD_CHANGED_KIND'] = 'FIELD_CHANGED_KIND'; + BreakingChangeType['REQUIRED_ARG_ADDED'] = 'REQUIRED_ARG_ADDED'; + BreakingChangeType['ARG_REMOVED'] = 'ARG_REMOVED'; + BreakingChangeType['ARG_CHANGED_KIND'] = 'ARG_CHANGED_KIND'; + BreakingChangeType['DIRECTIVE_REMOVED'] = 'DIRECTIVE_REMOVED'; + BreakingChangeType['DIRECTIVE_ARG_REMOVED'] = 'DIRECTIVE_ARG_REMOVED'; + BreakingChangeType['REQUIRED_DIRECTIVE_ARG_ADDED'] = + 'REQUIRED_DIRECTIVE_ARG_ADDED'; + BreakingChangeType['DIRECTIVE_REPEATABLE_REMOVED'] = + 'DIRECTIVE_REPEATABLE_REMOVED'; + BreakingChangeType['DIRECTIVE_LOCATION_REMOVED'] = + 'DIRECTIVE_LOCATION_REMOVED'; +})(BreakingChangeType || (BreakingChangeType = {})); + +export { BreakingChangeType }; +var DangerousChangeType; + +(function (DangerousChangeType) { + DangerousChangeType['VALUE_ADDED_TO_ENUM'] = 'VALUE_ADDED_TO_ENUM'; + DangerousChangeType['TYPE_ADDED_TO_UNION'] = 'TYPE_ADDED_TO_UNION'; + DangerousChangeType['OPTIONAL_INPUT_FIELD_ADDED'] = + 'OPTIONAL_INPUT_FIELD_ADDED'; + DangerousChangeType['OPTIONAL_ARG_ADDED'] = 'OPTIONAL_ARG_ADDED'; + DangerousChangeType['IMPLEMENTED_INTERFACE_ADDED'] = + 'IMPLEMENTED_INTERFACE_ADDED'; + DangerousChangeType['ARG_DEFAULT_VALUE_CHANGE'] = 'ARG_DEFAULT_VALUE_CHANGE'; +})(DangerousChangeType || (DangerousChangeType = {})); + +export { DangerousChangeType }; + +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +export function findBreakingChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in BreakingChangeType, + ); +} +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ + +export function findDangerousChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in DangerousChangeType, + ); +} + +function findSchemaChanges(oldSchema, newSchema) { + return [ + ...findTypeChanges(oldSchema, newSchema), + ...findDirectiveChanges(oldSchema, newSchema), + ]; +} + +function findDirectiveChanges(oldSchema, newSchema) { + const schemaChanges = []; + const directivesDiff = diff( + oldSchema.getDirectives(), + newSchema.getDirectives(), + ); + + for (const oldDirective of directivesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: `${oldDirective.name} was removed.`, + }); + } + + for (const [oldDirective, newDirective] of directivesDiff.persisted) { + const argsDiff = diff(oldDirective.args, newDirective.args); + + for (const newArg of argsDiff.added) { + if (isRequiredArgument(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`, + }); + } + } + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: `${oldArg.name} was removed from ${oldDirective.name}.`, + }); + } + + if (oldDirective.isRepeatable && !newDirective.isRepeatable) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: `Repeatable flag was removed from ${oldDirective.name}.`, + }); + } + + for (const location of oldDirective.locations) { + if (!newDirective.locations.includes(location)) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: `${location} was removed from ${oldDirective.name}.`, + }); + } + } + } + + return schemaChanges; +} + +function findTypeChanges(oldSchema, newSchema) { + const schemaChanges = []; + const typesDiff = diff( + Object.values(oldSchema.getTypeMap()), + Object.values(newSchema.getTypeMap()), + ); + + for (const oldType of typesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED, + description: isSpecifiedScalarType(oldType) + ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.` + : `${oldType.name} was removed.`, + }); + } + + for (const [oldType, newType] of typesDiff.persisted) { + if (isEnumType(oldType) && isEnumType(newType)) { + schemaChanges.push(...findEnumTypeChanges(oldType, newType)); + } else if (isUnionType(oldType) && isUnionType(newType)) { + schemaChanges.push(...findUnionTypeChanges(oldType, newType)); + } else if (isInputObjectType(oldType) && isInputObjectType(newType)) { + schemaChanges.push(...findInputObjectTypeChanges(oldType, newType)); + } else if (isObjectType(oldType) && isObjectType(newType)) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (isInterfaceType(oldType) && isInterfaceType(newType)) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (oldType.constructor !== newType.constructor) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + `${oldType.name} changed from ` + + `${typeKindName(oldType)} to ${typeKindName(newType)}.`, + }); + } + } + + return schemaChanges; +} + +function findInputObjectTypeChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const newField of fieldsDiff.added) { + if (isRequiredInputField(newField)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, + description: `A required field ${newField.name} on input type ${oldType.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, + description: `An optional field ${newField.name} on input type ${oldType.name} was added.`, + }); + } + } + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findUnionTypeChanges(oldType, newType) { + const schemaChanges = []; + const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); + + for (const newPossibleType of possibleTypesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: `${newPossibleType.name} was added to union type ${oldType.name}.`, + }); + } + + for (const oldPossibleType of possibleTypesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findEnumTypeChanges(oldType, newType) { + const schemaChanges = []; + const valuesDiff = diff(oldType.getValues(), newType.getValues()); + + for (const newValue of valuesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: `${newValue.name} was added to enum type ${oldType.name}.`, + }); + } + + for (const oldValue of valuesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: `${oldValue.name} was removed from enum type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findImplementedInterfacesChanges(oldType, newType) { + const schemaChanges = []; + const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); + + for (const newInterface of interfacesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`, + }); + } + + for (const oldInterface of interfacesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: `${oldType.name} no longer implements interface ${oldInterface.name}.`, + }); + } + + return schemaChanges; +} + +function findFieldChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + schemaChanges.push(...findArgChanges(oldType, oldField, newField)); + const isSafe = isChangeSafeForObjectOrInterfaceField( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findArgChanges(oldType, oldField, newField) { + const schemaChanges = []; + const argsDiff = diff(oldField.args, newField.args); + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.ARG_REMOVED, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.`, + }); + } + + for (const [oldArg, newArg] of argsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldArg.type, + newArg.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` + + `${String(oldArg.type)} to ${String(newArg.type)}.`, + }); + } else if (oldArg.defaultValue !== undefined) { + if (newArg.defaultValue === undefined) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`, + }); + } else { + // Since we looking only for client's observable changes we should + // compare default values in the same representation as they are + // represented inside introspection. + const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type); + const newValueStr = stringifyValue(newArg.defaultValue, newArg.type); + + if (oldValueStr !== newValueStr) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`, + }); + } + } + } + } + + for (const newArg of argsDiff.added) { + if (isRequiredArgument(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_ARG_ADDED, + description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_ARG_ADDED, + description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } + } + + return schemaChanges; +} + +function isChangeSafeForObjectOrInterfaceField(oldType, newType) { + if (isListType(oldType)) { + return ( + // if they're both lists, make sure the underlying types are compatible + (isListType(newType) && + isChangeSafeForObjectOrInterfaceField( + oldType.ofType, + newType.ofType, + )) || // moving from nullable to non-null of the same underlying type is safe + (isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); + } + + if (isNonNullType(oldType)) { + // if they're both non-null, make sure the underlying types are compatible + return ( + isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) + ); + } + + return ( + // if they're both named types, see if their names are equivalent + (isNamedType(newType) && oldType.name === newType.name) || // moving from nullable to non-null of the same underlying type is safe + (isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); +} + +function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { + if (isListType(oldType)) { + // if they're both lists, make sure the underlying types are compatible + return ( + isListType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) + ); + } + + if (isNonNullType(oldType)) { + return ( + // if they're both non-null, make sure the underlying types are + // compatible + (isNonNullType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg( + oldType.ofType, + newType.ofType, + )) || // moving from non-null to nullable of the same underlying type is safe + (!isNonNullType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)) + ); + } // if they're both named types, see if their names are equivalent + + return isNamedType(newType) && oldType.name === newType.name; +} + +function typeKindName(type) { + if (isScalarType(type)) { + return 'a Scalar type'; + } + + if (isObjectType(type)) { + return 'an Object type'; + } + + if (isInterfaceType(type)) { + return 'an Interface type'; + } + + if (isUnionType(type)) { + return 'a Union type'; + } + + if (isEnumType(type)) { + return 'an Enum type'; + } + + if (isInputObjectType(type)) { + return 'an Input type'; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function stringifyValue(value, type) { + const ast = astFromValue(value, type); + ast != null || invariant(false); + return print(sortValueNode(ast)); +} + +function diff(oldArray, newArray) { + const added = []; + const removed = []; + const persisted = []; + const oldMap = keyMap(oldArray, ({ name }) => name); + const newMap = keyMap(newArray, ({ name }) => name); + + for (const oldItem of oldArray) { + const newItem = newMap[oldItem.name]; + + if (newItem === undefined) { + removed.push(oldItem); + } else { + persisted.push([oldItem, newItem]); + } + } + + for (const newItem of newArray) { + if (oldMap[newItem.name] === undefined) { + added.push(newItem); + } + } + + return { + added, + persisted, + removed, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.d.ts new file mode 100644 index 0000000..9f80268 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.d.ts @@ -0,0 +1,182 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DirectiveLocation } from '../language/directiveLocation'; +export interface IntrospectionOptions { + /** + * Whether to include descriptions in the introspection result. + * Default: true + */ + descriptions?: boolean; + /** + * Whether to include `specifiedByURL` in the introspection result. + * Default: false + */ + specifiedByUrl?: boolean; + /** + * Whether to include `isRepeatable` flag on directives. + * Default: false + */ + directiveIsRepeatable?: boolean; + /** + * Whether to include `description` field on schema. + * Default: false + */ + schemaDescription?: boolean; + /** + * Whether target GraphQL server support deprecation of input values. + * Default: false + */ + inputValueDeprecation?: boolean; +} +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + */ +export declare function getIntrospectionQuery( + options?: IntrospectionOptions, +): string; +export interface IntrospectionQuery { + readonly __schema: IntrospectionSchema; +} +export interface IntrospectionSchema { + readonly description?: Maybe; + readonly queryType: IntrospectionNamedTypeRef; + readonly mutationType: Maybe< + IntrospectionNamedTypeRef + >; + readonly subscriptionType: Maybe< + IntrospectionNamedTypeRef + >; + readonly types: ReadonlyArray; + readonly directives: ReadonlyArray; +} +export declare type IntrospectionType = + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType + | IntrospectionInputObjectType; +export declare type IntrospectionOutputType = + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType; +export declare type IntrospectionInputType = + | IntrospectionScalarType + | IntrospectionEnumType + | IntrospectionInputObjectType; +export interface IntrospectionScalarType { + readonly kind: 'SCALAR'; + readonly name: string; + readonly description?: Maybe; + readonly specifiedByURL?: Maybe; +} +export interface IntrospectionObjectType { + readonly kind: 'OBJECT'; + readonly name: string; + readonly description?: Maybe; + readonly fields: ReadonlyArray; + readonly interfaces: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} +export interface IntrospectionInterfaceType { + readonly kind: 'INTERFACE'; + readonly name: string; + readonly description?: Maybe; + readonly fields: ReadonlyArray; + readonly interfaces: ReadonlyArray< + IntrospectionNamedTypeRef + >; + readonly possibleTypes: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} +export interface IntrospectionUnionType { + readonly kind: 'UNION'; + readonly name: string; + readonly description?: Maybe; + readonly possibleTypes: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} +export interface IntrospectionEnumType { + readonly kind: 'ENUM'; + readonly name: string; + readonly description?: Maybe; + readonly enumValues: ReadonlyArray; +} +export interface IntrospectionInputObjectType { + readonly kind: 'INPUT_OBJECT'; + readonly name: string; + readonly description?: Maybe; + readonly inputFields: ReadonlyArray; +} +export interface IntrospectionListTypeRef< + T extends IntrospectionTypeRef = IntrospectionTypeRef, +> { + readonly kind: 'LIST'; + readonly ofType: T; +} +export interface IntrospectionNonNullTypeRef< + T extends IntrospectionTypeRef = IntrospectionTypeRef, +> { + readonly kind: 'NON_NULL'; + readonly ofType: T; +} +export declare type IntrospectionTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + IntrospectionNamedTypeRef | IntrospectionListTypeRef + >; +export declare type IntrospectionOutputTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + >; +export declare type IntrospectionInputTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + >; +export interface IntrospectionNamedTypeRef< + T extends IntrospectionType = IntrospectionType, +> { + readonly kind: T['kind']; + readonly name: string; +} +export interface IntrospectionField { + readonly name: string; + readonly description?: Maybe; + readonly args: ReadonlyArray; + readonly type: IntrospectionOutputTypeRef; + readonly isDeprecated: boolean; + readonly deprecationReason: Maybe; +} +export interface IntrospectionInputValue { + readonly name: string; + readonly description?: Maybe; + readonly type: IntrospectionInputTypeRef; + readonly defaultValue: Maybe; + readonly isDeprecated?: boolean; + readonly deprecationReason?: Maybe; +} +export interface IntrospectionEnumValue { + readonly name: string; + readonly description?: Maybe; + readonly isDeprecated: boolean; + readonly deprecationReason: Maybe; +} +export interface IntrospectionDirective { + readonly name: string; + readonly description?: Maybe; + readonly isRepeatable?: boolean; + readonly locations: ReadonlyArray; + readonly args: ReadonlyArray; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.js b/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.js new file mode 100644 index 0000000..415ffc0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.js @@ -0,0 +1,142 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getIntrospectionQuery = getIntrospectionQuery; + +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + */ +function getIntrospectionQuery(options) { + const optionsWithDefault = { + descriptions: true, + specifiedByUrl: false, + directiveIsRepeatable: false, + schemaDescription: false, + inputValueDeprecation: false, + ...options, + }; + const descriptions = optionsWithDefault.descriptions ? 'description' : ''; + const specifiedByUrl = optionsWithDefault.specifiedByUrl + ? 'specifiedByURL' + : ''; + const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable + ? 'isRepeatable' + : ''; + const schemaDescription = optionsWithDefault.schemaDescription + ? descriptions + : ''; + + function inputDeprecation(str) { + return optionsWithDefault.inputValueDeprecation ? str : ''; + } + + return ` + query IntrospectionQuery { + __schema { + ${schemaDescription} + queryType { name } + mutationType { name } + subscriptionType { name } + types { + ...FullType + } + directives { + name + ${descriptions} + ${directiveIsRepeatable} + locations + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + ${descriptions} + ${specifiedByUrl} + fields(includeDeprecated: true) { + name + ${descriptions} + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + ${descriptions} + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + ${descriptions} + type { ...TypeRef } + defaultValue + ${inputDeprecation('isDeprecated')} + ${inputDeprecation('deprecationReason')} + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + } + } + } + } + } + } + `; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.mjs b/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.mjs new file mode 100644 index 0000000..ed12f29 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getIntrospectionQuery.mjs @@ -0,0 +1,135 @@ +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + */ +export function getIntrospectionQuery(options) { + const optionsWithDefault = { + descriptions: true, + specifiedByUrl: false, + directiveIsRepeatable: false, + schemaDescription: false, + inputValueDeprecation: false, + ...options, + }; + const descriptions = optionsWithDefault.descriptions ? 'description' : ''; + const specifiedByUrl = optionsWithDefault.specifiedByUrl + ? 'specifiedByURL' + : ''; + const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable + ? 'isRepeatable' + : ''; + const schemaDescription = optionsWithDefault.schemaDescription + ? descriptions + : ''; + + function inputDeprecation(str) { + return optionsWithDefault.inputValueDeprecation ? str : ''; + } + + return ` + query IntrospectionQuery { + __schema { + ${schemaDescription} + queryType { name } + mutationType { name } + subscriptionType { name } + types { + ...FullType + } + directives { + name + ${descriptions} + ${directiveIsRepeatable} + locations + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + ${descriptions} + ${specifiedByUrl} + fields(includeDeprecated: true) { + name + ${descriptions} + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + ${descriptions} + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + ${descriptions} + type { ...TypeRef } + defaultValue + ${inputDeprecation('isDeprecated')} + ${inputDeprecation('deprecationReason')} + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + } + } + } + } + } + } + `; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.d.ts new file mode 100644 index 0000000..238cdbd --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.d.ts @@ -0,0 +1,11 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DocumentNode, OperationDefinitionNode } from '../language/ast'; +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ +export declare function getOperationAST( + documentAST: DocumentNode, + operationName?: Maybe, +): Maybe; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.js b/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.js new file mode 100644 index 0000000..c102b9a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getOperationAST = getOperationAST; + +var _kinds = require('../language/kinds.js'); + +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ +function getOperationAST(documentAST, operationName) { + let operation = null; + + for (const definition of documentAST.definitions) { + if (definition.kind === _kinds.Kind.OPERATION_DEFINITION) { + var _definition$name; + + if (operationName == null) { + // If no operation name was provided, only return an Operation if there + // is one defined in the document. Upon encountering the second, return + // null. + if (operation) { + return null; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + return definition; + } + } + } + + return operation; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.mjs b/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.mjs new file mode 100644 index 0000000..8d1f5b9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getOperationAST.mjs @@ -0,0 +1,36 @@ +import { Kind } from '../language/kinds.mjs'; +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ + +export function getOperationAST(documentAST, operationName) { + let operation = null; + + for (const definition of documentAST.definitions) { + if (definition.kind === Kind.OPERATION_DEFINITION) { + var _definition$name; + + if (operationName == null) { + // If no operation name was provided, only return an Operation if there + // is one defined in the document. Upon encountering the second, return + // null. + if (operation) { + return null; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + return definition; + } + } + } + + return operation; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.d.ts new file mode 100644 index 0000000..fb813c6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.d.ts @@ -0,0 +1,15 @@ +import type { + OperationDefinitionNode, + OperationTypeDefinitionNode, +} from '../language/ast'; +import type { GraphQLObjectType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +export declare function getOperationRootType( + schema: GraphQLSchema, + operation: OperationDefinitionNode | OperationTypeDefinitionNode, +): GraphQLObjectType; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.js b/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.js new file mode 100644 index 0000000..957f737 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.js @@ -0,0 +1,67 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getOperationRootType = getOperationRootType; + +var _GraphQLError = require('../error/GraphQLError.js'); + +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +function getOperationRootType(schema, operation) { + if (operation.operation === 'query') { + const queryType = schema.getQueryType(); + + if (!queryType) { + throw new _GraphQLError.GraphQLError( + 'Schema does not define the required query root type.', + { + nodes: operation, + }, + ); + } + + return queryType; + } + + if (operation.operation === 'mutation') { + const mutationType = schema.getMutationType(); + + if (!mutationType) { + throw new _GraphQLError.GraphQLError( + 'Schema is not configured for mutations.', + { + nodes: operation, + }, + ); + } + + return mutationType; + } + + if (operation.operation === 'subscription') { + const subscriptionType = schema.getSubscriptionType(); + + if (!subscriptionType) { + throw new _GraphQLError.GraphQLError( + 'Schema is not configured for subscriptions.', + { + nodes: operation, + }, + ); + } + + return subscriptionType; + } + + throw new _GraphQLError.GraphQLError( + 'Can only have query, mutation and subscription operations.', + { + nodes: operation, + }, + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.mjs b/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.mjs new file mode 100644 index 0000000..27855c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/getOperationRootType.mjs @@ -0,0 +1,54 @@ +import { GraphQLError } from '../error/GraphQLError.mjs'; + +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +export function getOperationRootType(schema, operation) { + if (operation.operation === 'query') { + const queryType = schema.getQueryType(); + + if (!queryType) { + throw new GraphQLError( + 'Schema does not define the required query root type.', + { + nodes: operation, + }, + ); + } + + return queryType; + } + + if (operation.operation === 'mutation') { + const mutationType = schema.getMutationType(); + + if (!mutationType) { + throw new GraphQLError('Schema is not configured for mutations.', { + nodes: operation, + }); + } + + return mutationType; + } + + if (operation.operation === 'subscription') { + const subscriptionType = schema.getSubscriptionType(); + + if (!subscriptionType) { + throw new GraphQLError('Schema is not configured for subscriptions.', { + nodes: operation, + }); + } + + return subscriptionType; + } + + throw new GraphQLError( + 'Can only have query, mutation and subscription operations.', + { + nodes: operation, + }, + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/index.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/index.d.ts new file mode 100644 index 0000000..ba8a7fd --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/index.d.ts @@ -0,0 +1,61 @@ +export { getIntrospectionQuery } from './getIntrospectionQuery'; +export type { + IntrospectionOptions, + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionInputType, + IntrospectionOutputType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionInputTypeRef, + IntrospectionOutputTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, +} from './getIntrospectionQuery'; +export { getOperationAST } from './getOperationAST'; +export { getOperationRootType } from './getOperationRootType'; +export { introspectionFromSchema } from './introspectionFromSchema'; +export { buildClientSchema } from './buildClientSchema'; +export { buildASTSchema, buildSchema } from './buildASTSchema'; +export type { BuildSchemaOptions } from './buildASTSchema'; +export { extendSchema } from './extendSchema'; +export { lexicographicSortSchema } from './lexicographicSortSchema'; +export { + printSchema, + printType, + printIntrospectionSchema, +} from './printSchema'; +export { typeFromAST } from './typeFromAST'; +export { valueFromAST } from './valueFromAST'; +export { valueFromASTUntyped } from './valueFromASTUntyped'; +export { astFromValue } from './astFromValue'; +export { TypeInfo, visitWithTypeInfo } from './TypeInfo'; +export { coerceInputValue } from './coerceInputValue'; +export { concatAST } from './concatAST'; +export { separateOperations } from './separateOperations'; +export { stripIgnoredCharacters } from './stripIgnoredCharacters'; +export { + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, +} from './typeComparators'; +export { assertValidName, isValidNameError } from './assertValidName'; +export { + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './findBreakingChanges'; +export type { BreakingChange, DangerousChange } from './findBreakingChanges'; +export type { TypedQueryDocumentNode } from './typedQueryDocumentNode'; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/index.js b/graphql-subscription-express/node_modules/graphql/utilities/index.js new file mode 100644 index 0000000..ed50c3e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/index.js @@ -0,0 +1,233 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'BreakingChangeType', { + enumerable: true, + get: function () { + return _findBreakingChanges.BreakingChangeType; + }, +}); +Object.defineProperty(exports, 'DangerousChangeType', { + enumerable: true, + get: function () { + return _findBreakingChanges.DangerousChangeType; + }, +}); +Object.defineProperty(exports, 'TypeInfo', { + enumerable: true, + get: function () { + return _TypeInfo.TypeInfo; + }, +}); +Object.defineProperty(exports, 'assertValidName', { + enumerable: true, + get: function () { + return _assertValidName.assertValidName; + }, +}); +Object.defineProperty(exports, 'astFromValue', { + enumerable: true, + get: function () { + return _astFromValue.astFromValue; + }, +}); +Object.defineProperty(exports, 'buildASTSchema', { + enumerable: true, + get: function () { + return _buildASTSchema.buildASTSchema; + }, +}); +Object.defineProperty(exports, 'buildClientSchema', { + enumerable: true, + get: function () { + return _buildClientSchema.buildClientSchema; + }, +}); +Object.defineProperty(exports, 'buildSchema', { + enumerable: true, + get: function () { + return _buildASTSchema.buildSchema; + }, +}); +Object.defineProperty(exports, 'coerceInputValue', { + enumerable: true, + get: function () { + return _coerceInputValue.coerceInputValue; + }, +}); +Object.defineProperty(exports, 'concatAST', { + enumerable: true, + get: function () { + return _concatAST.concatAST; + }, +}); +Object.defineProperty(exports, 'doTypesOverlap', { + enumerable: true, + get: function () { + return _typeComparators.doTypesOverlap; + }, +}); +Object.defineProperty(exports, 'extendSchema', { + enumerable: true, + get: function () { + return _extendSchema.extendSchema; + }, +}); +Object.defineProperty(exports, 'findBreakingChanges', { + enumerable: true, + get: function () { + return _findBreakingChanges.findBreakingChanges; + }, +}); +Object.defineProperty(exports, 'findDangerousChanges', { + enumerable: true, + get: function () { + return _findBreakingChanges.findDangerousChanges; + }, +}); +Object.defineProperty(exports, 'getIntrospectionQuery', { + enumerable: true, + get: function () { + return _getIntrospectionQuery.getIntrospectionQuery; + }, +}); +Object.defineProperty(exports, 'getOperationAST', { + enumerable: true, + get: function () { + return _getOperationAST.getOperationAST; + }, +}); +Object.defineProperty(exports, 'getOperationRootType', { + enumerable: true, + get: function () { + return _getOperationRootType.getOperationRootType; + }, +}); +Object.defineProperty(exports, 'introspectionFromSchema', { + enumerable: true, + get: function () { + return _introspectionFromSchema.introspectionFromSchema; + }, +}); +Object.defineProperty(exports, 'isEqualType', { + enumerable: true, + get: function () { + return _typeComparators.isEqualType; + }, +}); +Object.defineProperty(exports, 'isTypeSubTypeOf', { + enumerable: true, + get: function () { + return _typeComparators.isTypeSubTypeOf; + }, +}); +Object.defineProperty(exports, 'isValidNameError', { + enumerable: true, + get: function () { + return _assertValidName.isValidNameError; + }, +}); +Object.defineProperty(exports, 'lexicographicSortSchema', { + enumerable: true, + get: function () { + return _lexicographicSortSchema.lexicographicSortSchema; + }, +}); +Object.defineProperty(exports, 'printIntrospectionSchema', { + enumerable: true, + get: function () { + return _printSchema.printIntrospectionSchema; + }, +}); +Object.defineProperty(exports, 'printSchema', { + enumerable: true, + get: function () { + return _printSchema.printSchema; + }, +}); +Object.defineProperty(exports, 'printType', { + enumerable: true, + get: function () { + return _printSchema.printType; + }, +}); +Object.defineProperty(exports, 'separateOperations', { + enumerable: true, + get: function () { + return _separateOperations.separateOperations; + }, +}); +Object.defineProperty(exports, 'stripIgnoredCharacters', { + enumerable: true, + get: function () { + return _stripIgnoredCharacters.stripIgnoredCharacters; + }, +}); +Object.defineProperty(exports, 'typeFromAST', { + enumerable: true, + get: function () { + return _typeFromAST.typeFromAST; + }, +}); +Object.defineProperty(exports, 'valueFromAST', { + enumerable: true, + get: function () { + return _valueFromAST.valueFromAST; + }, +}); +Object.defineProperty(exports, 'valueFromASTUntyped', { + enumerable: true, + get: function () { + return _valueFromASTUntyped.valueFromASTUntyped; + }, +}); +Object.defineProperty(exports, 'visitWithTypeInfo', { + enumerable: true, + get: function () { + return _TypeInfo.visitWithTypeInfo; + }, +}); + +var _getIntrospectionQuery = require('./getIntrospectionQuery.js'); + +var _getOperationAST = require('./getOperationAST.js'); + +var _getOperationRootType = require('./getOperationRootType.js'); + +var _introspectionFromSchema = require('./introspectionFromSchema.js'); + +var _buildClientSchema = require('./buildClientSchema.js'); + +var _buildASTSchema = require('./buildASTSchema.js'); + +var _extendSchema = require('./extendSchema.js'); + +var _lexicographicSortSchema = require('./lexicographicSortSchema.js'); + +var _printSchema = require('./printSchema.js'); + +var _typeFromAST = require('./typeFromAST.js'); + +var _valueFromAST = require('./valueFromAST.js'); + +var _valueFromASTUntyped = require('./valueFromASTUntyped.js'); + +var _astFromValue = require('./astFromValue.js'); + +var _TypeInfo = require('./TypeInfo.js'); + +var _coerceInputValue = require('./coerceInputValue.js'); + +var _concatAST = require('./concatAST.js'); + +var _separateOperations = require('./separateOperations.js'); + +var _stripIgnoredCharacters = require('./stripIgnoredCharacters.js'); + +var _typeComparators = require('./typeComparators.js'); + +var _assertValidName = require('./assertValidName.js'); + +var _findBreakingChanges = require('./findBreakingChanges.js'); diff --git a/graphql-subscription-express/node_modules/graphql/utilities/index.mjs b/graphql-subscription-express/node_modules/graphql/utilities/index.mjs new file mode 100644 index 0000000..cb8f6b4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/index.mjs @@ -0,0 +1,55 @@ +// Produce the GraphQL query recommended for a full schema introspection. +export { getIntrospectionQuery } from './getIntrospectionQuery.mjs'; +// Gets the target Operation from a Document. +export { getOperationAST } from './getOperationAST.mjs'; // Gets the Type for the target Operation AST. + +export { getOperationRootType } from './getOperationRootType.mjs'; // Convert a GraphQLSchema to an IntrospectionQuery. + +export { introspectionFromSchema } from './introspectionFromSchema.mjs'; // Build a GraphQLSchema from an introspection result. + +export { buildClientSchema } from './buildClientSchema.mjs'; // Build a GraphQLSchema from GraphQL Schema language. + +export { buildASTSchema, buildSchema } from './buildASTSchema.mjs'; +// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. +export { extendSchema } from './extendSchema.mjs'; // Sort a GraphQLSchema. + +export { lexicographicSortSchema } from './lexicographicSortSchema.mjs'; // Print a GraphQLSchema to GraphQL Schema language. + +export { + printSchema, + printType, + printIntrospectionSchema, +} from './printSchema.mjs'; // Create a GraphQLType from a GraphQL language AST. + +export { typeFromAST } from './typeFromAST.mjs'; // Create a JavaScript value from a GraphQL language AST with a type. + +export { valueFromAST } from './valueFromAST.mjs'; // Create a JavaScript value from a GraphQL language AST without a type. + +export { valueFromASTUntyped } from './valueFromASTUntyped.mjs'; // Create a GraphQL language AST from a JavaScript value. + +export { astFromValue } from './astFromValue.mjs'; // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. + +export { TypeInfo, visitWithTypeInfo } from './TypeInfo.mjs'; // Coerces a JavaScript value to a GraphQL type, or produces errors. + +export { coerceInputValue } from './coerceInputValue.mjs'; // Concatenates multiple AST together. + +export { concatAST } from './concatAST.mjs'; // Separates an AST into an AST per Operation. + +export { separateOperations } from './separateOperations.mjs'; // Strips characters that are not significant to the validity or execution of a GraphQL document. + +export { stripIgnoredCharacters } from './stripIgnoredCharacters.mjs'; // Comparators for types + +export { + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, +} from './typeComparators.mjs'; // Asserts that a string is a valid GraphQL name + +export { assertValidName, isValidNameError } from './assertValidName.mjs'; // Compares two GraphQLSchemas and detects breaking changes. + +export { + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './findBreakingChanges.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.d.ts new file mode 100644 index 0000000..8d70191 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.d.ts @@ -0,0 +1,18 @@ +import type { GraphQLSchema } from '../type/schema'; +import type { + IntrospectionOptions, + IntrospectionQuery, +} from './getIntrospectionQuery'; +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ +export declare function introspectionFromSchema( + schema: GraphQLSchema, + options?: IntrospectionOptions, +): IntrospectionQuery; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.js b/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.js new file mode 100644 index 0000000..aef2e5a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.introspectionFromSchema = introspectionFromSchema; + +var _invariant = require('../jsutils/invariant.js'); + +var _parser = require('../language/parser.js'); + +var _execute = require('../execution/execute.js'); + +var _getIntrospectionQuery = require('./getIntrospectionQuery.js'); + +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ +function introspectionFromSchema(schema, options) { + const optionsWithDefaults = { + specifiedByUrl: true, + directiveIsRepeatable: true, + schemaDescription: true, + inputValueDeprecation: true, + ...options, + }; + const document = (0, _parser.parse)( + (0, _getIntrospectionQuery.getIntrospectionQuery)(optionsWithDefaults), + ); + const result = (0, _execute.executeSync)({ + schema, + document, + }); + (!result.errors && result.data) || (0, _invariant.invariant)(false); + return result.data; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.mjs b/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.mjs new file mode 100644 index 0000000..6ad7b1f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/introspectionFromSchema.mjs @@ -0,0 +1,30 @@ +import { invariant } from '../jsutils/invariant.mjs'; +import { parse } from '../language/parser.mjs'; +import { executeSync } from '../execution/execute.mjs'; +import { getIntrospectionQuery } from './getIntrospectionQuery.mjs'; +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ + +export function introspectionFromSchema(schema, options) { + const optionsWithDefaults = { + specifiedByUrl: true, + directiveIsRepeatable: true, + schemaDescription: true, + inputValueDeprecation: true, + ...options, + }; + const document = parse(getIntrospectionQuery(optionsWithDefaults)); + const result = executeSync({ + schema, + document, + }); + (!result.errors && result.data) || invariant(false); + return result.data; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.d.ts new file mode 100644 index 0000000..01855d9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.d.ts @@ -0,0 +1,9 @@ +import { GraphQLSchema } from '../type/schema'; +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ +export declare function lexicographicSortSchema( + schema: GraphQLSchema, +): GraphQLSchema; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.js b/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.js new file mode 100644 index 0000000..ea884b6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.js @@ -0,0 +1,177 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.lexicographicSortSchema = lexicographicSortSchema; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _naturalCompare = require('../jsutils/naturalCompare.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _schema = require('../type/schema.js'); + +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ +function lexicographicSortSchema(schema) { + const schemaConfig = schema.toConfig(); + const typeMap = (0, _keyValMap.keyValMap)( + sortByName(schemaConfig.types), + (type) => type.name, + sortNamedType, + ); + return new _schema.GraphQLSchema({ + ...schemaConfig, + types: Object.values(typeMap), + directives: sortByName(schemaConfig.directives).map(sortDirective), + query: replaceMaybeType(schemaConfig.query), + mutation: replaceMaybeType(schemaConfig.mutation), + subscription: replaceMaybeType(schemaConfig.subscription), + }); + + function replaceType(type) { + if ((0, _definition.isListType)(type)) { + // @ts-expect-error + return new _definition.GraphQLList(replaceType(type.ofType)); + } else if ((0, _definition.isNonNullType)(type)) { + // @ts-expect-error + return new _definition.GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME: TS Conversion + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + return typeMap[type.name]; + } + + function replaceMaybeType(maybeType) { + return maybeType && replaceNamedType(maybeType); + } + + function sortDirective(directive) { + const config = directive.toConfig(); + return new _directives.GraphQLDirective({ + ...config, + locations: sortBy(config.locations, (x) => x), + args: sortArgs(config.args), + }); + } + + function sortArgs(args) { + return sortObjMap(args, (arg) => ({ ...arg, type: replaceType(arg.type) })); + } + + function sortFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + args: field.args && sortArgs(field.args), + })); + } + + function sortInputFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + })); + } + + function sortTypes(array) { + return sortByName(array).map(replaceNamedType); + } + + function sortNamedType(type) { + if ( + (0, _definition.isScalarType)(type) || + (0, _introspection.isIntrospectionType)(type) + ) { + return type; + } + + if ((0, _definition.isObjectType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLObjectType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if ((0, _definition.isInterfaceType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLInterfaceType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if ((0, _definition.isUnionType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLUnionType({ + ...config, + types: () => sortTypes(config.types), + }); + } + + if ((0, _definition.isEnumType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLEnumType({ + ...config, + values: sortObjMap(config.values, (value) => value), + }); + } + + if ((0, _definition.isInputObjectType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLInputObjectType({ + ...config, + fields: () => sortInputFields(config.fields), + }); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); + } +} + +function sortObjMap(map, sortValueFn) { + const sortedMap = Object.create(null); + + for (const key of Object.keys(map).sort(_naturalCompare.naturalCompare)) { + sortedMap[key] = sortValueFn(map[key]); + } + + return sortedMap; +} + +function sortByName(array) { + return sortBy(array, (obj) => obj.name); +} + +function sortBy(array, mapToKey) { + return array.slice().sort((obj1, obj2) => { + const key1 = mapToKey(obj1); + const key2 = mapToKey(obj2); + return (0, _naturalCompare.naturalCompare)(key1, key2); + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.mjs b/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.mjs new file mode 100644 index 0000000..b734adb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/lexicographicSortSchema.mjs @@ -0,0 +1,172 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { naturalCompare } from '../jsutils/naturalCompare.mjs'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLUnionType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { GraphQLDirective } from '../type/directives.mjs'; +import { isIntrospectionType } from '../type/introspection.mjs'; +import { GraphQLSchema } from '../type/schema.mjs'; +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ + +export function lexicographicSortSchema(schema) { + const schemaConfig = schema.toConfig(); + const typeMap = keyValMap( + sortByName(schemaConfig.types), + (type) => type.name, + sortNamedType, + ); + return new GraphQLSchema({ + ...schemaConfig, + types: Object.values(typeMap), + directives: sortByName(schemaConfig.directives).map(sortDirective), + query: replaceMaybeType(schemaConfig.query), + mutation: replaceMaybeType(schemaConfig.mutation), + subscription: replaceMaybeType(schemaConfig.subscription), + }); + + function replaceType(type) { + if (isListType(type)) { + // @ts-expect-error + return new GraphQLList(replaceType(type.ofType)); + } else if (isNonNullType(type)) { + // @ts-expect-error + return new GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME: TS Conversion + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + return typeMap[type.name]; + } + + function replaceMaybeType(maybeType) { + return maybeType && replaceNamedType(maybeType); + } + + function sortDirective(directive) { + const config = directive.toConfig(); + return new GraphQLDirective({ + ...config, + locations: sortBy(config.locations, (x) => x), + args: sortArgs(config.args), + }); + } + + function sortArgs(args) { + return sortObjMap(args, (arg) => ({ ...arg, type: replaceType(arg.type) })); + } + + function sortFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + args: field.args && sortArgs(field.args), + })); + } + + function sortInputFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + })); + } + + function sortTypes(array) { + return sortByName(array).map(replaceNamedType); + } + + function sortNamedType(type) { + if (isScalarType(type) || isIntrospectionType(type)) { + return type; + } + + if (isObjectType(type)) { + const config = type.toConfig(); + return new GraphQLObjectType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if (isInterfaceType(type)) { + const config = type.toConfig(); + return new GraphQLInterfaceType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if (isUnionType(type)) { + const config = type.toConfig(); + return new GraphQLUnionType({ + ...config, + types: () => sortTypes(config.types), + }); + } + + if (isEnumType(type)) { + const config = type.toConfig(); + return new GraphQLEnumType({ + ...config, + values: sortObjMap(config.values, (value) => value), + }); + } + + if (isInputObjectType(type)) { + const config = type.toConfig(); + return new GraphQLInputObjectType({ + ...config, + fields: () => sortInputFields(config.fields), + }); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); + } +} + +function sortObjMap(map, sortValueFn) { + const sortedMap = Object.create(null); + + for (const key of Object.keys(map).sort(naturalCompare)) { + sortedMap[key] = sortValueFn(map[key]); + } + + return sortedMap; +} + +function sortByName(array) { + return sortBy(array, (obj) => obj.name); +} + +function sortBy(array, mapToKey) { + return array.slice().sort((obj1, obj2) => { + const key1 = mapToKey(obj1); + const key2 = mapToKey(obj2); + return naturalCompare(key1, key2); + }); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/printSchema.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/printSchema.d.ts new file mode 100644 index 0000000..5369adb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/printSchema.d.ts @@ -0,0 +1,5 @@ +import type { GraphQLNamedType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +export declare function printSchema(schema: GraphQLSchema): string; +export declare function printIntrospectionSchema(schema: GraphQLSchema): string; +export declare function printType(type: GraphQLNamedType): string; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/printSchema.js b/graphql-subscription-express/node_modules/graphql/utilities/printSchema.js new file mode 100644 index 0000000..0d47611 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/printSchema.js @@ -0,0 +1,333 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printIntrospectionSchema = printIntrospectionSchema; +exports.printSchema = printSchema; +exports.printType = printType; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _blockString = require('../language/blockString.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _scalars = require('../type/scalars.js'); + +var _astFromValue = require('./astFromValue.js'); + +function printSchema(schema) { + return printFilteredSchema( + schema, + (n) => !(0, _directives.isSpecifiedDirective)(n), + isDefinedType, + ); +} + +function printIntrospectionSchema(schema) { + return printFilteredSchema( + schema, + _directives.isSpecifiedDirective, + _introspection.isIntrospectionType, + ); +} + +function isDefinedType(type) { + return ( + !(0, _scalars.isSpecifiedScalarType)(type) && + !(0, _introspection.isIntrospectionType)(type) + ); +} + +function printFilteredSchema(schema, directiveFilter, typeFilter) { + const directives = schema.getDirectives().filter(directiveFilter); + const types = Object.values(schema.getTypeMap()).filter(typeFilter); + return [ + printSchemaDefinition(schema), + ...directives.map((directive) => printDirective(directive)), + ...types.map((type) => printType(type)), + ] + .filter(Boolean) + .join('\n\n'); +} + +function printSchemaDefinition(schema) { + if (schema.description == null && isSchemaOfCommonNames(schema)) { + return; + } + + const operationTypes = []; + const queryType = schema.getQueryType(); + + if (queryType) { + operationTypes.push(` query: ${queryType.name}`); + } + + const mutationType = schema.getMutationType(); + + if (mutationType) { + operationTypes.push(` mutation: ${mutationType.name}`); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + operationTypes.push(` subscription: ${subscriptionType.name}`); + } + + return printDescription(schema) + `schema {\n${operationTypes.join('\n')}\n}`; +} +/** + * GraphQL schema define root types for each type of operation. These types are + * the same as any other type and can be named in any manner, however there is + * a common naming convention: + * + * ```graphql + * schema { + * query: Query + * mutation: Mutation + * subscription: Subscription + * } + * ``` + * + * When using this naming convention, the schema description can be omitted. + */ + +function isSchemaOfCommonNames(schema) { + const queryType = schema.getQueryType(); + + if (queryType && queryType.name !== 'Query') { + return false; + } + + const mutationType = schema.getMutationType(); + + if (mutationType && mutationType.name !== 'Mutation') { + return false; + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && subscriptionType.name !== 'Subscription') { + return false; + } + + return true; +} + +function printType(type) { + if ((0, _definition.isScalarType)(type)) { + return printScalar(type); + } + + if ((0, _definition.isObjectType)(type)) { + return printObject(type); + } + + if ((0, _definition.isInterfaceType)(type)) { + return printInterface(type); + } + + if ((0, _definition.isUnionType)(type)) { + return printUnion(type); + } + + if ((0, _definition.isEnumType)(type)) { + return printEnum(type); + } + + if ((0, _definition.isInputObjectType)(type)) { + return printInputObject(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); +} + +function printScalar(type) { + return ( + printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type) + ); +} + +function printImplementedInterfaces(type) { + const interfaces = type.getInterfaces(); + return interfaces.length + ? ' implements ' + interfaces.map((i) => i.name).join(' & ') + : ''; +} + +function printObject(type) { + return ( + printDescription(type) + + `type ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printInterface(type) { + return ( + printDescription(type) + + `interface ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printUnion(type) { + const types = type.getTypes(); + const possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; + return printDescription(type) + 'union ' + type.name + possibleTypes; +} + +function printEnum(type) { + const values = type + .getValues() + .map( + (value, i) => + printDescription(value, ' ', !i) + + ' ' + + value.name + + printDeprecated(value.deprecationReason), + ); + return printDescription(type) + `enum ${type.name}` + printBlock(values); +} + +function printInputObject(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => printDescription(f, ' ', !i) + ' ' + printInputValue(f), + ); + return printDescription(type) + `input ${type.name}` + printBlock(fields); +} + +function printFields(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => + printDescription(f, ' ', !i) + + ' ' + + f.name + + printArgs(f.args, ' ') + + ': ' + + String(f.type) + + printDeprecated(f.deprecationReason), + ); + return printBlock(fields); +} + +function printBlock(items) { + return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; +} + +function printArgs(args, indentation = '') { + if (args.length === 0) { + return ''; + } // If every arg does not have a description, print them on one line. + + if (args.every((arg) => !arg.description)) { + return '(' + args.map(printInputValue).join(', ') + ')'; + } + + return ( + '(\n' + + args + .map( + (arg, i) => + printDescription(arg, ' ' + indentation, !i) + + ' ' + + indentation + + printInputValue(arg), + ) + .join('\n') + + '\n' + + indentation + + ')' + ); +} + +function printInputValue(arg) { + const defaultAST = (0, _astFromValue.astFromValue)( + arg.defaultValue, + arg.type, + ); + let argDecl = arg.name + ': ' + String(arg.type); + + if (defaultAST) { + argDecl += ` = ${(0, _printer.print)(defaultAST)}`; + } + + return argDecl + printDeprecated(arg.deprecationReason); +} + +function printDirective(directive) { + return ( + printDescription(directive) + + 'directive @' + + directive.name + + printArgs(directive.args) + + (directive.isRepeatable ? ' repeatable' : '') + + ' on ' + + directive.locations.join(' | ') + ); +} + +function printDeprecated(reason) { + if (reason == null) { + return ''; + } + + if (reason !== _directives.DEFAULT_DEPRECATION_REASON) { + const astValue = (0, _printer.print)({ + kind: _kinds.Kind.STRING, + value: reason, + }); + return ` @deprecated(reason: ${astValue})`; + } + + return ' @deprecated'; +} + +function printSpecifiedByURL(scalar) { + if (scalar.specifiedByURL == null) { + return ''; + } + + const astValue = (0, _printer.print)({ + kind: _kinds.Kind.STRING, + value: scalar.specifiedByURL, + }); + return ` @specifiedBy(url: ${astValue})`; +} + +function printDescription(def, indentation = '', firstInBlock = true) { + const { description } = def; + + if (description == null) { + return ''; + } + + const blockString = (0, _printer.print)({ + kind: _kinds.Kind.STRING, + value: description, + block: (0, _blockString.isPrintableAsBlockString)(description), + }); + const prefix = + indentation && !firstInBlock ? '\n' + indentation : indentation; + return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/printSchema.mjs b/graphql-subscription-express/node_modules/graphql/utilities/printSchema.mjs new file mode 100644 index 0000000..9d0643b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/printSchema.mjs @@ -0,0 +1,309 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isPrintableAsBlockString } from '../language/blockString.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { + DEFAULT_DEPRECATION_REASON, + isSpecifiedDirective, +} from '../type/directives.mjs'; +import { isIntrospectionType } from '../type/introspection.mjs'; +import { isSpecifiedScalarType } from '../type/scalars.mjs'; +import { astFromValue } from './astFromValue.mjs'; +export function printSchema(schema) { + return printFilteredSchema( + schema, + (n) => !isSpecifiedDirective(n), + isDefinedType, + ); +} +export function printIntrospectionSchema(schema) { + return printFilteredSchema(schema, isSpecifiedDirective, isIntrospectionType); +} + +function isDefinedType(type) { + return !isSpecifiedScalarType(type) && !isIntrospectionType(type); +} + +function printFilteredSchema(schema, directiveFilter, typeFilter) { + const directives = schema.getDirectives().filter(directiveFilter); + const types = Object.values(schema.getTypeMap()).filter(typeFilter); + return [ + printSchemaDefinition(schema), + ...directives.map((directive) => printDirective(directive)), + ...types.map((type) => printType(type)), + ] + .filter(Boolean) + .join('\n\n'); +} + +function printSchemaDefinition(schema) { + if (schema.description == null && isSchemaOfCommonNames(schema)) { + return; + } + + const operationTypes = []; + const queryType = schema.getQueryType(); + + if (queryType) { + operationTypes.push(` query: ${queryType.name}`); + } + + const mutationType = schema.getMutationType(); + + if (mutationType) { + operationTypes.push(` mutation: ${mutationType.name}`); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + operationTypes.push(` subscription: ${subscriptionType.name}`); + } + + return printDescription(schema) + `schema {\n${operationTypes.join('\n')}\n}`; +} +/** + * GraphQL schema define root types for each type of operation. These types are + * the same as any other type and can be named in any manner, however there is + * a common naming convention: + * + * ```graphql + * schema { + * query: Query + * mutation: Mutation + * subscription: Subscription + * } + * ``` + * + * When using this naming convention, the schema description can be omitted. + */ + +function isSchemaOfCommonNames(schema) { + const queryType = schema.getQueryType(); + + if (queryType && queryType.name !== 'Query') { + return false; + } + + const mutationType = schema.getMutationType(); + + if (mutationType && mutationType.name !== 'Mutation') { + return false; + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && subscriptionType.name !== 'Subscription') { + return false; + } + + return true; +} + +export function printType(type) { + if (isScalarType(type)) { + return printScalar(type); + } + + if (isObjectType(type)) { + return printObject(type); + } + + if (isInterfaceType(type)) { + return printInterface(type); + } + + if (isUnionType(type)) { + return printUnion(type); + } + + if (isEnumType(type)) { + return printEnum(type); + } + + if (isInputObjectType(type)) { + return printInputObject(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function printScalar(type) { + return ( + printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type) + ); +} + +function printImplementedInterfaces(type) { + const interfaces = type.getInterfaces(); + return interfaces.length + ? ' implements ' + interfaces.map((i) => i.name).join(' & ') + : ''; +} + +function printObject(type) { + return ( + printDescription(type) + + `type ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printInterface(type) { + return ( + printDescription(type) + + `interface ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printUnion(type) { + const types = type.getTypes(); + const possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; + return printDescription(type) + 'union ' + type.name + possibleTypes; +} + +function printEnum(type) { + const values = type + .getValues() + .map( + (value, i) => + printDescription(value, ' ', !i) + + ' ' + + value.name + + printDeprecated(value.deprecationReason), + ); + return printDescription(type) + `enum ${type.name}` + printBlock(values); +} + +function printInputObject(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => printDescription(f, ' ', !i) + ' ' + printInputValue(f), + ); + return printDescription(type) + `input ${type.name}` + printBlock(fields); +} + +function printFields(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => + printDescription(f, ' ', !i) + + ' ' + + f.name + + printArgs(f.args, ' ') + + ': ' + + String(f.type) + + printDeprecated(f.deprecationReason), + ); + return printBlock(fields); +} + +function printBlock(items) { + return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; +} + +function printArgs(args, indentation = '') { + if (args.length === 0) { + return ''; + } // If every arg does not have a description, print them on one line. + + if (args.every((arg) => !arg.description)) { + return '(' + args.map(printInputValue).join(', ') + ')'; + } + + return ( + '(\n' + + args + .map( + (arg, i) => + printDescription(arg, ' ' + indentation, !i) + + ' ' + + indentation + + printInputValue(arg), + ) + .join('\n') + + '\n' + + indentation + + ')' + ); +} + +function printInputValue(arg) { + const defaultAST = astFromValue(arg.defaultValue, arg.type); + let argDecl = arg.name + ': ' + String(arg.type); + + if (defaultAST) { + argDecl += ` = ${print(defaultAST)}`; + } + + return argDecl + printDeprecated(arg.deprecationReason); +} + +function printDirective(directive) { + return ( + printDescription(directive) + + 'directive @' + + directive.name + + printArgs(directive.args) + + (directive.isRepeatable ? ' repeatable' : '') + + ' on ' + + directive.locations.join(' | ') + ); +} + +function printDeprecated(reason) { + if (reason == null) { + return ''; + } + + if (reason !== DEFAULT_DEPRECATION_REASON) { + const astValue = print({ + kind: Kind.STRING, + value: reason, + }); + return ` @deprecated(reason: ${astValue})`; + } + + return ' @deprecated'; +} + +function printSpecifiedByURL(scalar) { + if (scalar.specifiedByURL == null) { + return ''; + } + + const astValue = print({ + kind: Kind.STRING, + value: scalar.specifiedByURL, + }); + return ` @specifiedBy(url: ${astValue})`; +} + +function printDescription(def, indentation = '', firstInBlock = true) { + const { description } = def; + + if (description == null) { + return ''; + } + + const blockString = print({ + kind: Kind.STRING, + value: description, + block: isPrintableAsBlockString(description), + }); + const prefix = + indentation && !firstInBlock ? '\n' + indentation : indentation; + return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.d.ts new file mode 100644 index 0000000..d5b80a0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.d.ts @@ -0,0 +1,11 @@ +import type { ObjMap } from '../jsutils/ObjMap'; +import type { DocumentNode } from '../language/ast'; +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ +export declare function separateOperations( + documentAST: DocumentNode, +): ObjMap; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.js b/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.js new file mode 100644 index 0000000..5dd37d0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.js @@ -0,0 +1,88 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.separateOperations = separateOperations; + +var _kinds = require('../language/kinds.js'); + +var _visitor = require('../language/visitor.js'); + +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ +function separateOperations(documentAST) { + const operations = []; + const depGraph = Object.create(null); // Populate metadata and build a dependency graph. + + for (const definitionNode of documentAST.definitions) { + switch (definitionNode.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + operations.push(definitionNode); + break; + + case _kinds.Kind.FRAGMENT_DEFINITION: + depGraph[definitionNode.name.value] = collectDependencies( + definitionNode.selectionSet, + ); + break; + + default: // ignore non-executable definitions + } + } // For each operation, produce a new synthesized AST which includes only what + // is necessary for completing that operation. + + const separatedDocumentASTs = Object.create(null); + + for (const operation of operations) { + const dependencies = new Set(); + + for (const fragmentName of collectDependencies(operation.selectionSet)) { + collectTransitiveDependencies(dependencies, depGraph, fragmentName); + } // Provides the empty string for anonymous operations. + + const operationName = operation.name ? operation.name.value : ''; // The list of definition nodes to be included for this operation, sorted + // to retain the same order as the original document. + + separatedDocumentASTs[operationName] = { + kind: _kinds.Kind.DOCUMENT, + definitions: documentAST.definitions.filter( + (node) => + node === operation || + (node.kind === _kinds.Kind.FRAGMENT_DEFINITION && + dependencies.has(node.name.value)), + ), + }; + } + + return separatedDocumentASTs; +} + +// From a dependency graph, collects a list of transitive dependencies by +// recursing through a dependency graph. +function collectTransitiveDependencies(collected, depGraph, fromName) { + if (!collected.has(fromName)) { + collected.add(fromName); + const immediateDeps = depGraph[fromName]; + + if (immediateDeps !== undefined) { + for (const toName of immediateDeps) { + collectTransitiveDependencies(collected, depGraph, toName); + } + } + } +} + +function collectDependencies(selectionSet) { + const dependencies = []; + (0, _visitor.visit)(selectionSet, { + FragmentSpread(node) { + dependencies.push(node.name.value); + }, + }); + return dependencies; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.mjs b/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.mjs new file mode 100644 index 0000000..1d8ab8b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/separateOperations.mjs @@ -0,0 +1,80 @@ +import { Kind } from '../language/kinds.mjs'; +import { visit } from '../language/visitor.mjs'; +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ + +export function separateOperations(documentAST) { + const operations = []; + const depGraph = Object.create(null); // Populate metadata and build a dependency graph. + + for (const definitionNode of documentAST.definitions) { + switch (definitionNode.kind) { + case Kind.OPERATION_DEFINITION: + operations.push(definitionNode); + break; + + case Kind.FRAGMENT_DEFINITION: + depGraph[definitionNode.name.value] = collectDependencies( + definitionNode.selectionSet, + ); + break; + + default: // ignore non-executable definitions + } + } // For each operation, produce a new synthesized AST which includes only what + // is necessary for completing that operation. + + const separatedDocumentASTs = Object.create(null); + + for (const operation of operations) { + const dependencies = new Set(); + + for (const fragmentName of collectDependencies(operation.selectionSet)) { + collectTransitiveDependencies(dependencies, depGraph, fragmentName); + } // Provides the empty string for anonymous operations. + + const operationName = operation.name ? operation.name.value : ''; // The list of definition nodes to be included for this operation, sorted + // to retain the same order as the original document. + + separatedDocumentASTs[operationName] = { + kind: Kind.DOCUMENT, + definitions: documentAST.definitions.filter( + (node) => + node === operation || + (node.kind === Kind.FRAGMENT_DEFINITION && + dependencies.has(node.name.value)), + ), + }; + } + + return separatedDocumentASTs; +} + +// From a dependency graph, collects a list of transitive dependencies by +// recursing through a dependency graph. +function collectTransitiveDependencies(collected, depGraph, fromName) { + if (!collected.has(fromName)) { + collected.add(fromName); + const immediateDeps = depGraph[fromName]; + + if (immediateDeps !== undefined) { + for (const toName of immediateDeps) { + collectTransitiveDependencies(collected, depGraph, toName); + } + } + } +} + +function collectDependencies(selectionSet) { + const dependencies = []; + visit(selectionSet, { + FragmentSpread(node) { + dependencies.push(node.name.value); + }, + }); + return dependencies; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.d.ts new file mode 100644 index 0000000..7d7a9de --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.d.ts @@ -0,0 +1,9 @@ +import type { ValueNode } from '../language/ast'; +/** + * Sort ValueNode. + * + * This function returns a sorted copy of the given ValueNode. + * + * @internal + */ +export declare function sortValueNode(valueNode: ValueNode): ValueNode; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.js b/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.js new file mode 100644 index 0000000..cf4bbfd --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.js @@ -0,0 +1,47 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.sortValueNode = sortValueNode; + +var _naturalCompare = require('../jsutils/naturalCompare.js'); + +var _kinds = require('../language/kinds.js'); + +/** + * Sort ValueNode. + * + * This function returns a sorted copy of the given ValueNode. + * + * @internal + */ +function sortValueNode(valueNode) { + switch (valueNode.kind) { + case _kinds.Kind.OBJECT: + return { ...valueNode, fields: sortFields(valueNode.fields) }; + + case _kinds.Kind.LIST: + return { ...valueNode, values: valueNode.values.map(sortValueNode) }; + + case _kinds.Kind.INT: + case _kinds.Kind.FLOAT: + case _kinds.Kind.STRING: + case _kinds.Kind.BOOLEAN: + case _kinds.Kind.NULL: + case _kinds.Kind.ENUM: + case _kinds.Kind.VARIABLE: + return valueNode; + } +} + +function sortFields(fields) { + return fields + .map((fieldNode) => ({ + ...fieldNode, + value: sortValueNode(fieldNode.value), + })) + .sort((fieldA, fieldB) => + (0, _naturalCompare.naturalCompare)(fieldA.name.value, fieldB.name.value), + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.mjs b/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.mjs new file mode 100644 index 0000000..79bece3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/sortValueNode.mjs @@ -0,0 +1,39 @@ +import { naturalCompare } from '../jsutils/naturalCompare.mjs'; +import { Kind } from '../language/kinds.mjs'; +/** + * Sort ValueNode. + * + * This function returns a sorted copy of the given ValueNode. + * + * @internal + */ + +export function sortValueNode(valueNode) { + switch (valueNode.kind) { + case Kind.OBJECT: + return { ...valueNode, fields: sortFields(valueNode.fields) }; + + case Kind.LIST: + return { ...valueNode, values: valueNode.values.map(sortValueNode) }; + + case Kind.INT: + case Kind.FLOAT: + case Kind.STRING: + case Kind.BOOLEAN: + case Kind.NULL: + case Kind.ENUM: + case Kind.VARIABLE: + return valueNode; + } +} + +function sortFields(fields) { + return fields + .map((fieldNode) => ({ + ...fieldNode, + value: sortValueNode(fieldNode.value), + })) + .sort((fieldA, fieldB) => + naturalCompare(fieldA.name.value, fieldB.name.value), + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts new file mode 100644 index 0000000..7bd6c04 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts @@ -0,0 +1,62 @@ +import { Source } from '../language/source'; +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * + * SDL example: + * + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + */ +export declare function stripIgnoredCharacters(source: string | Source): string; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.js b/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.js new file mode 100644 index 0000000..04f6a1b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.stripIgnoredCharacters = stripIgnoredCharacters; + +var _blockString = require('../language/blockString.js'); + +var _lexer = require('../language/lexer.js'); + +var _source = require('../language/source.js'); + +var _tokenKind = require('../language/tokenKind.js'); + +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * + * SDL example: + * + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + */ +function stripIgnoredCharacters(source) { + const sourceObj = (0, _source.isSource)(source) + ? source + : new _source.Source(source); + const body = sourceObj.body; + const lexer = new _lexer.Lexer(sourceObj); + let strippedBody = ''; + let wasLastAddedTokenNonPunctuator = false; + + while (lexer.advance().kind !== _tokenKind.TokenKind.EOF) { + const currentToken = lexer.token; + const tokenKind = currentToken.kind; + /** + * Every two non-punctuator tokens should have space between them. + * Also prevent case of non-punctuator token following by spread resulting + * in invalid token (e.g. `1...` is invalid Float token). + */ + + const isNonPunctuator = !(0, _lexer.isPunctuatorTokenKind)( + currentToken.kind, + ); + + if (wasLastAddedTokenNonPunctuator) { + if ( + isNonPunctuator || + currentToken.kind === _tokenKind.TokenKind.SPREAD + ) { + strippedBody += ' '; + } + } + + const tokenBody = body.slice(currentToken.start, currentToken.end); + + if (tokenKind === _tokenKind.TokenKind.BLOCK_STRING) { + strippedBody += (0, _blockString.printBlockString)(currentToken.value, { + minimize: true, + }); + } else { + strippedBody += tokenBody; + } + + wasLastAddedTokenNonPunctuator = isNonPunctuator; + } + + return strippedBody; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.mjs b/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.mjs new file mode 100644 index 0000000..f85bdb9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/stripIgnoredCharacters.mjs @@ -0,0 +1,104 @@ +import { printBlockString } from '../language/blockString.mjs'; +import { isPunctuatorTokenKind, Lexer } from '../language/lexer.mjs'; +import { isSource, Source } from '../language/source.mjs'; +import { TokenKind } from '../language/tokenKind.mjs'; +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * + * SDL example: + * + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + */ + +export function stripIgnoredCharacters(source) { + const sourceObj = isSource(source) ? source : new Source(source); + const body = sourceObj.body; + const lexer = new Lexer(sourceObj); + let strippedBody = ''; + let wasLastAddedTokenNonPunctuator = false; + + while (lexer.advance().kind !== TokenKind.EOF) { + const currentToken = lexer.token; + const tokenKind = currentToken.kind; + /** + * Every two non-punctuator tokens should have space between them. + * Also prevent case of non-punctuator token following by spread resulting + * in invalid token (e.g. `1...` is invalid Float token). + */ + + const isNonPunctuator = !isPunctuatorTokenKind(currentToken.kind); + + if (wasLastAddedTokenNonPunctuator) { + if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) { + strippedBody += ' '; + } + } + + const tokenBody = body.slice(currentToken.start, currentToken.end); + + if (tokenKind === TokenKind.BLOCK_STRING) { + strippedBody += printBlockString(currentToken.value, { + minimize: true, + }); + } else { + strippedBody += tokenBody; + } + + wasLastAddedTokenNonPunctuator = isNonPunctuator; + } + + return strippedBody; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.d.ts new file mode 100644 index 0000000..1e5adbd --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.d.ts @@ -0,0 +1,32 @@ +import type { GraphQLCompositeType, GraphQLType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Provided two types, return true if the types are equal (invariant). + */ +export declare function isEqualType( + typeA: GraphQLType, + typeB: GraphQLType, +): boolean; +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ +export declare function isTypeSubTypeOf( + schema: GraphQLSchema, + maybeSubType: GraphQLType, + superType: GraphQLType, +): boolean; +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ +export declare function doTypesOverlap( + schema: GraphQLSchema, + typeA: GraphQLCompositeType, + typeB: GraphQLCompositeType, +): boolean; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.js b/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.js new file mode 100644 index 0000000..6669c03 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.js @@ -0,0 +1,116 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.doTypesOverlap = doTypesOverlap; +exports.isEqualType = isEqualType; +exports.isTypeSubTypeOf = isTypeSubTypeOf; + +var _definition = require('../type/definition.js'); + +/** + * Provided two types, return true if the types are equal (invariant). + */ +function isEqualType(typeA, typeB) { + // Equivalent types are equal. + if (typeA === typeB) { + return true; + } // If either type is non-null, the other must also be non-null. + + if ( + (0, _definition.isNonNullType)(typeA) && + (0, _definition.isNonNullType)(typeB) + ) { + return isEqualType(typeA.ofType, typeB.ofType); + } // If either type is a list, the other must also be a list. + + if ( + (0, _definition.isListType)(typeA) && + (0, _definition.isListType)(typeB) + ) { + return isEqualType(typeA.ofType, typeB.ofType); + } // Otherwise the types are not equal. + + return false; +} +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ + +function isTypeSubTypeOf(schema, maybeSubType, superType) { + // Equivalent type is a valid subtype + if (maybeSubType === superType) { + return true; + } // If superType is non-null, maybeSubType must also be non-null. + + if ((0, _definition.isNonNullType)(superType)) { + if ((0, _definition.isNonNullType)(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if ((0, _definition.isNonNullType)(maybeSubType)) { + // If superType is nullable, maybeSubType may be non-null or nullable. + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); + } // If superType type is a list, maybeSubType type must also be a list. + + if ((0, _definition.isListType)(superType)) { + if ((0, _definition.isListType)(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if ((0, _definition.isListType)(maybeSubType)) { + // If superType is not a list, maybeSubType must also be not a list. + return false; + } // If superType type is an abstract type, check if it is super type of maybeSubType. + // Otherwise, the child type is not a valid subtype of the parent type. + + return ( + (0, _definition.isAbstractType)(superType) && + ((0, _definition.isInterfaceType)(maybeSubType) || + (0, _definition.isObjectType)(maybeSubType)) && + schema.isSubType(superType, maybeSubType) + ); +} +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ + +function doTypesOverlap(schema, typeA, typeB) { + // Equivalent types overlap + if (typeA === typeB) { + return true; + } + + if ((0, _definition.isAbstractType)(typeA)) { + if ((0, _definition.isAbstractType)(typeB)) { + // If both types are abstract, then determine if there is any intersection + // between possible concrete types of each. + return schema + .getPossibleTypes(typeA) + .some((type) => schema.isSubType(typeB, type)); + } // Determine if the latter type is a possible concrete type of the former. + + return schema.isSubType(typeA, typeB); + } + + if ((0, _definition.isAbstractType)(typeB)) { + // Determine if the former type is a possible concrete type of the latter. + return schema.isSubType(typeB, typeA); + } // Otherwise the types do not overlap. + + return false; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.mjs b/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.mjs new file mode 100644 index 0000000..a57093a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typeComparators.mjs @@ -0,0 +1,106 @@ +import { + isAbstractType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, +} from '../type/definition.mjs'; + +/** + * Provided two types, return true if the types are equal (invariant). + */ +export function isEqualType(typeA, typeB) { + // Equivalent types are equal. + if (typeA === typeB) { + return true; + } // If either type is non-null, the other must also be non-null. + + if (isNonNullType(typeA) && isNonNullType(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } // If either type is a list, the other must also be a list. + + if (isListType(typeA) && isListType(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } // Otherwise the types are not equal. + + return false; +} +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ + +export function isTypeSubTypeOf(schema, maybeSubType, superType) { + // Equivalent type is a valid subtype + if (maybeSubType === superType) { + return true; + } // If superType is non-null, maybeSubType must also be non-null. + + if (isNonNullType(superType)) { + if (isNonNullType(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if (isNonNullType(maybeSubType)) { + // If superType is nullable, maybeSubType may be non-null or nullable. + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); + } // If superType type is a list, maybeSubType type must also be a list. + + if (isListType(superType)) { + if (isListType(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if (isListType(maybeSubType)) { + // If superType is not a list, maybeSubType must also be not a list. + return false; + } // If superType type is an abstract type, check if it is super type of maybeSubType. + // Otherwise, the child type is not a valid subtype of the parent type. + + return ( + isAbstractType(superType) && + (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && + schema.isSubType(superType, maybeSubType) + ); +} +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ + +export function doTypesOverlap(schema, typeA, typeB) { + // Equivalent types overlap + if (typeA === typeB) { + return true; + } + + if (isAbstractType(typeA)) { + if (isAbstractType(typeB)) { + // If both types are abstract, then determine if there is any intersection + // between possible concrete types of each. + return schema + .getPossibleTypes(typeA) + .some((type) => schema.isSubType(typeB, type)); + } // Determine if the latter type is a possible concrete type of the former. + + return schema.isSubType(typeA, typeB); + } + + if (isAbstractType(typeB)) { + // Determine if the former type is a possible concrete type of the latter. + return schema.isSubType(typeB, typeA); + } // Otherwise the types do not overlap. + + return false; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.d.ts new file mode 100644 index 0000000..5823755 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.d.ts @@ -0,0 +1,32 @@ +import type { + ListTypeNode, + NamedTypeNode, + NonNullTypeNode, + TypeNode, +} from '../language/ast'; +import type { GraphQLNamedType, GraphQLType } from '../type/definition'; +import { GraphQLList, GraphQLNonNull } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Given a Schema and an AST node describing a type, return a GraphQLType + * definition which applies to that type. For example, if provided the parsed + * AST node for `[User]`, a GraphQLList instance will be returned, containing + * the type called "User" found in the schema. If a type called "User" is not + * found in the schema, then undefined will be returned. + */ +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: NamedTypeNode, +): GraphQLNamedType | undefined; +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: ListTypeNode, +): GraphQLList | undefined; +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: NonNullTypeNode, +): GraphQLNonNull | undefined; +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: TypeNode, +): GraphQLType | undefined; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.js b/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.js new file mode 100644 index 0000000..998f333 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.typeFromAST = typeFromAST; + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +function typeFromAST(schema, typeNode) { + switch (typeNode.kind) { + case _kinds.Kind.LIST_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new _definition.GraphQLList(innerType); + } + + case _kinds.Kind.NON_NULL_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new _definition.GraphQLNonNull(innerType); + } + + case _kinds.Kind.NAMED_TYPE: + return schema.getType(typeNode.name.value); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.mjs b/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.mjs new file mode 100644 index 0000000..edae41b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typeFromAST.mjs @@ -0,0 +1,18 @@ +import { Kind } from '../language/kinds.mjs'; +import { GraphQLList, GraphQLNonNull } from '../type/definition.mjs'; +export function typeFromAST(schema, typeNode) { + switch (typeNode.kind) { + case Kind.LIST_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new GraphQLList(innerType); + } + + case Kind.NON_NULL_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new GraphQLNonNull(innerType); + } + + case Kind.NAMED_TYPE: + return schema.getType(typeNode.name.value); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts new file mode 100644 index 0000000..a8289c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts @@ -0,0 +1,22 @@ +import type { DocumentNode, ExecutableDefinitionNode } from '../language/ast'; +/** + * Wrapper type that contains DocumentNode and types that can be deduced from it. + */ +export interface TypedQueryDocumentNode< + TResponseData = { + [key: string]: any; + }, + TRequestVariables = { + [key: string]: any; + }, +> extends DocumentNode { + readonly definitions: ReadonlyArray; + /** + * This type is used to ensure that the variables you pass in to the query are assignable to Variables + * and that the Result is assignable to whatever you pass your result to. The method is never actually + * implemented, but the type is valid because we list it as optional + */ + __ensureTypesOfVariablesAndResultMatching?: ( + variables: TRequestVariables, + ) => TResponseData; +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.js b/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.mjs b/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/typedQueryDocumentNode.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.d.ts new file mode 100644 index 0000000..ee5f74e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.d.ts @@ -0,0 +1,29 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { ValueNode } from '../language/ast'; +import type { GraphQLInputType } from '../type/definition'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * + */ +export declare function valueFromAST( + valueNode: Maybe, + type: GraphQLInputType, + variables?: Maybe>, +): unknown; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.js b/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.js new file mode 100644 index 0000000..0d7fe0e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.js @@ -0,0 +1,185 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.valueFromAST = valueFromAST; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * + */ +function valueFromAST(valueNode, type, variables) { + if (!valueNode) { + // When there is no node, then there is also no value. + // Importantly, this is different from returning the value null. + return; + } + + if (valueNode.kind === _kinds.Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if (variables == null || variables[variableName] === undefined) { + // No valid return value. + return; + } + + const variableValue = variables[variableName]; + + if (variableValue === null && (0, _definition.isNonNullType)(type)) { + return; // Invalid: intentionally return no value. + } // Note: This does no further checking that this variable is correct. + // This assumes that this query has been validated and the variable + // usage here is of the correct type. + + return variableValue; + } + + if ((0, _definition.isNonNullType)(type)) { + if (valueNode.kind === _kinds.Kind.NULL) { + return; // Invalid: intentionally return no value. + } + + return valueFromAST(valueNode, type.ofType, variables); + } + + if (valueNode.kind === _kinds.Kind.NULL) { + // This is explicitly returning the value null. + return null; + } + + if ((0, _definition.isListType)(type)) { + const itemType = type.ofType; + + if (valueNode.kind === _kinds.Kind.LIST) { + const coercedValues = []; + + for (const itemNode of valueNode.values) { + if (isMissingVariable(itemNode, variables)) { + // If an array contains a missing variable, it is either coerced to + // null or if the item type is non-null, it considered invalid. + if ((0, _definition.isNonNullType)(itemType)) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(null); + } else { + const itemValue = valueFromAST(itemNode, itemType, variables); + + if (itemValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(itemValue); + } + } + + return coercedValues; + } + + const coercedValue = valueFromAST(valueNode, itemType, variables); + + if (coercedValue === undefined) { + return; // Invalid: intentionally return no value. + } + + return [coercedValue]; + } + + if ((0, _definition.isInputObjectType)(type)) { + if (valueNode.kind !== _kinds.Kind.OBJECT) { + return; // Invalid: intentionally return no value. + } + + const coercedObj = Object.create(null); + const fieldNodes = (0, _keyMap.keyMap)( + valueNode.fields, + (field) => field.name.value, + ); + + for (const field of Object.values(type.getFields())) { + const fieldNode = fieldNodes[field.name]; + + if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { + if (field.defaultValue !== undefined) { + coercedObj[field.name] = field.defaultValue; + } else if ((0, _definition.isNonNullType)(field.type)) { + return; // Invalid: intentionally return no value. + } + + continue; + } + + const fieldValue = valueFromAST(fieldNode.value, field.type, variables); + + if (fieldValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedObj[field.name] = fieldValue; + } + + return coercedObj; + } + + if ((0, _definition.isLeafType)(type)) { + // Scalars and Enums fulfill parsing a literal value via parseLiteral(). + // Invalid values represent a failure to parse correctly, in which case + // no value is returned. + let result; + + try { + result = type.parseLiteral(valueNode, variables); + } catch (_error) { + return; // Invalid: intentionally return no value. + } + + if (result === undefined) { + return; // Invalid: intentionally return no value. + } + + return result; + } + /* c8 ignore next 3 */ + // Not reachable, all possible input types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected input type: ' + (0, _inspect.inspect)(type), + ); +} // Returns true if the provided valueNode is a variable which is not defined +// in the set of variables. + +function isMissingVariable(valueNode, variables) { + return ( + valueNode.kind === _kinds.Kind.VARIABLE && + (variables == null || variables[valueNode.name.value] === undefined) + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.mjs b/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.mjs new file mode 100644 index 0000000..da2ab5c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/valueFromAST.mjs @@ -0,0 +1,172 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition.mjs'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * + */ + +export function valueFromAST(valueNode, type, variables) { + if (!valueNode) { + // When there is no node, then there is also no value. + // Importantly, this is different from returning the value null. + return; + } + + if (valueNode.kind === Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if (variables == null || variables[variableName] === undefined) { + // No valid return value. + return; + } + + const variableValue = variables[variableName]; + + if (variableValue === null && isNonNullType(type)) { + return; // Invalid: intentionally return no value. + } // Note: This does no further checking that this variable is correct. + // This assumes that this query has been validated and the variable + // usage here is of the correct type. + + return variableValue; + } + + if (isNonNullType(type)) { + if (valueNode.kind === Kind.NULL) { + return; // Invalid: intentionally return no value. + } + + return valueFromAST(valueNode, type.ofType, variables); + } + + if (valueNode.kind === Kind.NULL) { + // This is explicitly returning the value null. + return null; + } + + if (isListType(type)) { + const itemType = type.ofType; + + if (valueNode.kind === Kind.LIST) { + const coercedValues = []; + + for (const itemNode of valueNode.values) { + if (isMissingVariable(itemNode, variables)) { + // If an array contains a missing variable, it is either coerced to + // null or if the item type is non-null, it considered invalid. + if (isNonNullType(itemType)) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(null); + } else { + const itemValue = valueFromAST(itemNode, itemType, variables); + + if (itemValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(itemValue); + } + } + + return coercedValues; + } + + const coercedValue = valueFromAST(valueNode, itemType, variables); + + if (coercedValue === undefined) { + return; // Invalid: intentionally return no value. + } + + return [coercedValue]; + } + + if (isInputObjectType(type)) { + if (valueNode.kind !== Kind.OBJECT) { + return; // Invalid: intentionally return no value. + } + + const coercedObj = Object.create(null); + const fieldNodes = keyMap(valueNode.fields, (field) => field.name.value); + + for (const field of Object.values(type.getFields())) { + const fieldNode = fieldNodes[field.name]; + + if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { + if (field.defaultValue !== undefined) { + coercedObj[field.name] = field.defaultValue; + } else if (isNonNullType(field.type)) { + return; // Invalid: intentionally return no value. + } + + continue; + } + + const fieldValue = valueFromAST(fieldNode.value, field.type, variables); + + if (fieldValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedObj[field.name] = fieldValue; + } + + return coercedObj; + } + + if (isLeafType(type)) { + // Scalars and Enums fulfill parsing a literal value via parseLiteral(). + // Invalid values represent a failure to parse correctly, in which case + // no value is returned. + let result; + + try { + result = type.parseLiteral(valueNode, variables); + } catch (_error) { + return; // Invalid: intentionally return no value. + } + + if (result === undefined) { + return; // Invalid: intentionally return no value. + } + + return result; + } + /* c8 ignore next 3 */ + // Not reachable, all possible input types have been considered. + + false || invariant(false, 'Unexpected input type: ' + inspect(type)); +} // Returns true if the provided valueNode is a variable which is not defined +// in the set of variables. + +function isMissingVariable(valueNode, variables) { + return ( + valueNode.kind === Kind.VARIABLE && + (variables == null || variables[valueNode.name.value] === undefined) + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.d.ts b/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.d.ts new file mode 100644 index 0000000..9200a77 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.d.ts @@ -0,0 +1,23 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { ValueNode } from '../language/ast'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ +export declare function valueFromASTUntyped( + valueNode: ValueNode, + variables?: Maybe>, +): unknown; diff --git a/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.js b/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.js new file mode 100644 index 0000000..3c37229 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.valueFromASTUntyped = valueFromASTUntyped; + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _kinds = require('../language/kinds.js'); + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ +function valueFromASTUntyped(valueNode, variables) { + switch (valueNode.kind) { + case _kinds.Kind.NULL: + return null; + + case _kinds.Kind.INT: + return parseInt(valueNode.value, 10); + + case _kinds.Kind.FLOAT: + return parseFloat(valueNode.value); + + case _kinds.Kind.STRING: + case _kinds.Kind.ENUM: + case _kinds.Kind.BOOLEAN: + return valueNode.value; + + case _kinds.Kind.LIST: + return valueNode.values.map((node) => + valueFromASTUntyped(node, variables), + ); + + case _kinds.Kind.OBJECT: + return (0, _keyValMap.keyValMap)( + valueNode.fields, + (field) => field.name.value, + (field) => valueFromASTUntyped(field.value, variables), + ); + + case _kinds.Kind.VARIABLE: + return variables === null || variables === void 0 + ? void 0 + : variables[valueNode.name.value]; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.mjs b/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.mjs new file mode 100644 index 0000000..800d295 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/utilities/valueFromASTUntyped.mjs @@ -0,0 +1,53 @@ +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { Kind } from '../language/kinds.mjs'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ + +export function valueFromASTUntyped(valueNode, variables) { + switch (valueNode.kind) { + case Kind.NULL: + return null; + + case Kind.INT: + return parseInt(valueNode.value, 10); + + case Kind.FLOAT: + return parseFloat(valueNode.value); + + case Kind.STRING: + case Kind.ENUM: + case Kind.BOOLEAN: + return valueNode.value; + + case Kind.LIST: + return valueNode.values.map((node) => + valueFromASTUntyped(node, variables), + ); + + case Kind.OBJECT: + return keyValMap( + valueNode.fields, + (field) => field.name.value, + (field) => valueFromASTUntyped(field.value, variables), + ); + + case Kind.VARIABLE: + return variables === null || variables === void 0 + ? void 0 + : variables[valueNode.name.value]; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.d.ts b/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.d.ts new file mode 100644 index 0000000..8fc6ffb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.d.ts @@ -0,0 +1,95 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { GraphQLError } from '../error/GraphQLError'; +import type { + DocumentNode, + FragmentDefinitionNode, + FragmentSpreadNode, + OperationDefinitionNode, + SelectionSetNode, + VariableNode, +} from '../language/ast'; +import type { ASTVisitor } from '../language/visitor'; +import type { + GraphQLArgument, + GraphQLCompositeType, + GraphQLEnumValue, + GraphQLField, + GraphQLInputType, + GraphQLOutputType, +} from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; +import { TypeInfo } from '../utilities/TypeInfo'; +declare type NodeWithSelectionSet = + | OperationDefinitionNode + | FragmentDefinitionNode; +interface VariableUsage { + readonly node: VariableNode; + readonly type: Maybe; + readonly defaultValue: Maybe; +} +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +export declare class ASTValidationContext { + private _ast; + private _onError; + private _fragments; + private _fragmentSpreads; + private _recursivelyReferencedFragments; + constructor(ast: DocumentNode, onError: (error: GraphQLError) => void); + get [Symbol.toStringTag](): string; + reportError(error: GraphQLError): void; + getDocument(): DocumentNode; + getFragment(name: string): Maybe; + getFragmentSpreads(node: SelectionSetNode): ReadonlyArray; + getRecursivelyReferencedFragments( + operation: OperationDefinitionNode, + ): ReadonlyArray; +} +export declare type ASTValidationRule = ( + context: ASTValidationContext, +) => ASTVisitor; +export declare class SDLValidationContext extends ASTValidationContext { + private _schema; + constructor( + ast: DocumentNode, + schema: Maybe, + onError: (error: GraphQLError) => void, + ); + get [Symbol.toStringTag](): string; + getSchema(): Maybe; +} +export declare type SDLValidationRule = ( + context: SDLValidationContext, +) => ASTVisitor; +export declare class ValidationContext extends ASTValidationContext { + private _schema; + private _typeInfo; + private _variableUsages; + private _recursiveVariableUsages; + constructor( + schema: GraphQLSchema, + ast: DocumentNode, + typeInfo: TypeInfo, + onError: (error: GraphQLError) => void, + ); + get [Symbol.toStringTag](): string; + getSchema(): GraphQLSchema; + getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray; + getRecursiveVariableUsages( + operation: OperationDefinitionNode, + ): ReadonlyArray; + getType(): Maybe; + getParentType(): Maybe; + getInputType(): Maybe; + getParentInputType(): Maybe; + getFieldDef(): Maybe>; + getDirective(): Maybe; + getArgument(): Maybe; + getEnumValue(): Maybe; +} +export declare type ValidationRule = (context: ValidationContext) => ASTVisitor; +export {}; diff --git a/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.js b/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.js new file mode 100644 index 0000000..3f6fa82 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.js @@ -0,0 +1,232 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ValidationContext = + exports.SDLValidationContext = + exports.ASTValidationContext = + void 0; + +var _kinds = require('../language/kinds.js'); + +var _visitor = require('../language/visitor.js'); + +var _TypeInfo = require('../utilities/TypeInfo.js'); + +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +class ASTValidationContext { + constructor(ast, onError) { + this._ast = ast; + this._fragments = undefined; + this._fragmentSpreads = new Map(); + this._recursivelyReferencedFragments = new Map(); + this._onError = onError; + } + + get [Symbol.toStringTag]() { + return 'ASTValidationContext'; + } + + reportError(error) { + this._onError(error); + } + + getDocument() { + return this._ast; + } + + getFragment(name) { + let fragments; + + if (this._fragments) { + fragments = this._fragments; + } else { + fragments = Object.create(null); + + for (const defNode of this.getDocument().definitions) { + if (defNode.kind === _kinds.Kind.FRAGMENT_DEFINITION) { + fragments[defNode.name.value] = defNode; + } + } + + this._fragments = fragments; + } + + return fragments[name]; + } + + getFragmentSpreads(node) { + let spreads = this._fragmentSpreads.get(node); + + if (!spreads) { + spreads = []; + const setsToVisit = [node]; + let set; + + while ((set = setsToVisit.pop())) { + for (const selection of set.selections) { + if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) { + spreads.push(selection); + } else if (selection.selectionSet) { + setsToVisit.push(selection.selectionSet); + } + } + } + + this._fragmentSpreads.set(node, spreads); + } + + return spreads; + } + + getRecursivelyReferencedFragments(operation) { + let fragments = this._recursivelyReferencedFragments.get(operation); + + if (!fragments) { + fragments = []; + const collectedNames = Object.create(null); + const nodesToVisit = [operation.selectionSet]; + let node; + + while ((node = nodesToVisit.pop())) { + for (const spread of this.getFragmentSpreads(node)) { + const fragName = spread.name.value; + + if (collectedNames[fragName] !== true) { + collectedNames[fragName] = true; + const fragment = this.getFragment(fragName); + + if (fragment) { + fragments.push(fragment); + nodesToVisit.push(fragment.selectionSet); + } + } + } + } + + this._recursivelyReferencedFragments.set(operation, fragments); + } + + return fragments; + } +} + +exports.ASTValidationContext = ASTValidationContext; + +class SDLValidationContext extends ASTValidationContext { + constructor(ast, schema, onError) { + super(ast, onError); + this._schema = schema; + } + + get [Symbol.toStringTag]() { + return 'SDLValidationContext'; + } + + getSchema() { + return this._schema; + } +} + +exports.SDLValidationContext = SDLValidationContext; + +class ValidationContext extends ASTValidationContext { + constructor(schema, ast, typeInfo, onError) { + super(ast, onError); + this._schema = schema; + this._typeInfo = typeInfo; + this._variableUsages = new Map(); + this._recursiveVariableUsages = new Map(); + } + + get [Symbol.toStringTag]() { + return 'ValidationContext'; + } + + getSchema() { + return this._schema; + } + + getVariableUsages(node) { + let usages = this._variableUsages.get(node); + + if (!usages) { + const newUsages = []; + const typeInfo = new _TypeInfo.TypeInfo(this._schema); + (0, _visitor.visit)( + node, + (0, _TypeInfo.visitWithTypeInfo)(typeInfo, { + VariableDefinition: () => false, + + Variable(variable) { + newUsages.push({ + node: variable, + type: typeInfo.getInputType(), + defaultValue: typeInfo.getDefaultValue(), + }); + }, + }), + ); + usages = newUsages; + + this._variableUsages.set(node, usages); + } + + return usages; + } + + getRecursiveVariableUsages(operation) { + let usages = this._recursiveVariableUsages.get(operation); + + if (!usages) { + usages = this.getVariableUsages(operation); + + for (const frag of this.getRecursivelyReferencedFragments(operation)) { + usages = usages.concat(this.getVariableUsages(frag)); + } + + this._recursiveVariableUsages.set(operation, usages); + } + + return usages; + } + + getType() { + return this._typeInfo.getType(); + } + + getParentType() { + return this._typeInfo.getParentType(); + } + + getInputType() { + return this._typeInfo.getInputType(); + } + + getParentInputType() { + return this._typeInfo.getParentInputType(); + } + + getFieldDef() { + return this._typeInfo.getFieldDef(); + } + + getDirective() { + return this._typeInfo.getDirective(); + } + + getArgument() { + return this._typeInfo.getArgument(); + } + + getEnumValue() { + return this._typeInfo.getEnumValue(); + } +} + +exports.ValidationContext = ValidationContext; diff --git a/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.mjs b/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.mjs new file mode 100644 index 0000000..4f07f38 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/ValidationContext.mjs @@ -0,0 +1,212 @@ +import { Kind } from '../language/kinds.mjs'; +import { visit } from '../language/visitor.mjs'; +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.mjs'; + +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +export class ASTValidationContext { + constructor(ast, onError) { + this._ast = ast; + this._fragments = undefined; + this._fragmentSpreads = new Map(); + this._recursivelyReferencedFragments = new Map(); + this._onError = onError; + } + + get [Symbol.toStringTag]() { + return 'ASTValidationContext'; + } + + reportError(error) { + this._onError(error); + } + + getDocument() { + return this._ast; + } + + getFragment(name) { + let fragments; + + if (this._fragments) { + fragments = this._fragments; + } else { + fragments = Object.create(null); + + for (const defNode of this.getDocument().definitions) { + if (defNode.kind === Kind.FRAGMENT_DEFINITION) { + fragments[defNode.name.value] = defNode; + } + } + + this._fragments = fragments; + } + + return fragments[name]; + } + + getFragmentSpreads(node) { + let spreads = this._fragmentSpreads.get(node); + + if (!spreads) { + spreads = []; + const setsToVisit = [node]; + let set; + + while ((set = setsToVisit.pop())) { + for (const selection of set.selections) { + if (selection.kind === Kind.FRAGMENT_SPREAD) { + spreads.push(selection); + } else if (selection.selectionSet) { + setsToVisit.push(selection.selectionSet); + } + } + } + + this._fragmentSpreads.set(node, spreads); + } + + return spreads; + } + + getRecursivelyReferencedFragments(operation) { + let fragments = this._recursivelyReferencedFragments.get(operation); + + if (!fragments) { + fragments = []; + const collectedNames = Object.create(null); + const nodesToVisit = [operation.selectionSet]; + let node; + + while ((node = nodesToVisit.pop())) { + for (const spread of this.getFragmentSpreads(node)) { + const fragName = spread.name.value; + + if (collectedNames[fragName] !== true) { + collectedNames[fragName] = true; + const fragment = this.getFragment(fragName); + + if (fragment) { + fragments.push(fragment); + nodesToVisit.push(fragment.selectionSet); + } + } + } + } + + this._recursivelyReferencedFragments.set(operation, fragments); + } + + return fragments; + } +} +export class SDLValidationContext extends ASTValidationContext { + constructor(ast, schema, onError) { + super(ast, onError); + this._schema = schema; + } + + get [Symbol.toStringTag]() { + return 'SDLValidationContext'; + } + + getSchema() { + return this._schema; + } +} +export class ValidationContext extends ASTValidationContext { + constructor(schema, ast, typeInfo, onError) { + super(ast, onError); + this._schema = schema; + this._typeInfo = typeInfo; + this._variableUsages = new Map(); + this._recursiveVariableUsages = new Map(); + } + + get [Symbol.toStringTag]() { + return 'ValidationContext'; + } + + getSchema() { + return this._schema; + } + + getVariableUsages(node) { + let usages = this._variableUsages.get(node); + + if (!usages) { + const newUsages = []; + const typeInfo = new TypeInfo(this._schema); + visit( + node, + visitWithTypeInfo(typeInfo, { + VariableDefinition: () => false, + + Variable(variable) { + newUsages.push({ + node: variable, + type: typeInfo.getInputType(), + defaultValue: typeInfo.getDefaultValue(), + }); + }, + }), + ); + usages = newUsages; + + this._variableUsages.set(node, usages); + } + + return usages; + } + + getRecursiveVariableUsages(operation) { + let usages = this._recursiveVariableUsages.get(operation); + + if (!usages) { + usages = this.getVariableUsages(operation); + + for (const frag of this.getRecursivelyReferencedFragments(operation)) { + usages = usages.concat(this.getVariableUsages(frag)); + } + + this._recursiveVariableUsages.set(operation, usages); + } + + return usages; + } + + getType() { + return this._typeInfo.getType(); + } + + getParentType() { + return this._typeInfo.getParentType(); + } + + getInputType() { + return this._typeInfo.getInputType(); + } + + getParentInputType() { + return this._typeInfo.getParentInputType(); + } + + getFieldDef() { + return this._typeInfo.getFieldDef(); + } + + getDirective() { + return this._typeInfo.getDirective(); + } + + getArgument() { + return this._typeInfo.getArgument(); + } + + getEnumValue() { + return this._typeInfo.getEnumValue(); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/index.d.ts b/graphql-subscription-express/node_modules/graphql/validation/index.d.ts new file mode 100644 index 0000000..c0c720a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/index.d.ts @@ -0,0 +1,40 @@ +export { validate } from './validate'; +export { ValidationContext } from './ValidationContext'; +export type { ValidationRule } from './ValidationContext'; +export { specifiedRules } from './specifiedRules'; +export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; +export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; +export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; +export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule'; +export { KnownDirectivesRule } from './rules/KnownDirectivesRule'; +export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; +export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; +export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; +export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; +export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; +export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; +export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; +export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; +export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; +export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule'; +export { ScalarLeafsRule } from './rules/ScalarLeafsRule'; +export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; +export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; +export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; +export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; +export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; +export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; +export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; +export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; +export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; +export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; +export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; +export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; +export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; +export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; +export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; +export { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule'; +export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; +export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; +export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule'; +export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule'; diff --git a/graphql-subscription-express/node_modules/graphql/validation/index.js b/graphql-subscription-express/node_modules/graphql/validation/index.js new file mode 100644 index 0000000..bc4ea0b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/index.js @@ -0,0 +1,317 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'ExecutableDefinitionsRule', { + enumerable: true, + get: function () { + return _ExecutableDefinitionsRule.ExecutableDefinitionsRule; + }, +}); +Object.defineProperty(exports, 'FieldsOnCorrectTypeRule', { + enumerable: true, + get: function () { + return _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'FragmentsOnCompositeTypesRule', { + enumerable: true, + get: function () { + return _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule; + }, +}); +Object.defineProperty(exports, 'KnownArgumentNamesRule', { + enumerable: true, + get: function () { + return _KnownArgumentNamesRule.KnownArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownDirectivesRule', { + enumerable: true, + get: function () { + return _KnownDirectivesRule.KnownDirectivesRule; + }, +}); +Object.defineProperty(exports, 'KnownFragmentNamesRule', { + enumerable: true, + get: function () { + return _KnownFragmentNamesRule.KnownFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownTypeNamesRule', { + enumerable: true, + get: function () { + return _KnownTypeNamesRule.KnownTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'LoneAnonymousOperationRule', { + enumerable: true, + get: function () { + return _LoneAnonymousOperationRule.LoneAnonymousOperationRule; + }, +}); +Object.defineProperty(exports, 'LoneSchemaDefinitionRule', { + enumerable: true, + get: function () { + return _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule; + }, +}); +Object.defineProperty(exports, 'NoDeprecatedCustomRule', { + enumerable: true, + get: function () { + return _NoDeprecatedCustomRule.NoDeprecatedCustomRule; + }, +}); +Object.defineProperty(exports, 'NoFragmentCyclesRule', { + enumerable: true, + get: function () { + return _NoFragmentCyclesRule.NoFragmentCyclesRule; + }, +}); +Object.defineProperty(exports, 'NoSchemaIntrospectionCustomRule', { + enumerable: true, + get: function () { + return _NoSchemaIntrospectionCustomRule.NoSchemaIntrospectionCustomRule; + }, +}); +Object.defineProperty(exports, 'NoUndefinedVariablesRule', { + enumerable: true, + get: function () { + return _NoUndefinedVariablesRule.NoUndefinedVariablesRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedFragmentsRule', { + enumerable: true, + get: function () { + return _NoUnusedFragmentsRule.NoUnusedFragmentsRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedVariablesRule', { + enumerable: true, + get: function () { + return _NoUnusedVariablesRule.NoUnusedVariablesRule; + }, +}); +Object.defineProperty(exports, 'OverlappingFieldsCanBeMergedRule', { + enumerable: true, + get: function () { + return _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule; + }, +}); +Object.defineProperty(exports, 'PossibleFragmentSpreadsRule', { + enumerable: true, + get: function () { + return _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule; + }, +}); +Object.defineProperty(exports, 'PossibleTypeExtensionsRule', { + enumerable: true, + get: function () { + return _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule; + }, +}); +Object.defineProperty(exports, 'ProvidedRequiredArgumentsRule', { + enumerable: true, + get: function () { + return _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule; + }, +}); +Object.defineProperty(exports, 'ScalarLeafsRule', { + enumerable: true, + get: function () { + return _ScalarLeafsRule.ScalarLeafsRule; + }, +}); +Object.defineProperty(exports, 'SingleFieldSubscriptionsRule', { + enumerable: true, + get: function () { + return _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentDefinitionNamesRule', { + enumerable: true, + get: function () { + return _UniqueArgumentDefinitionNamesRule.UniqueArgumentDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentNamesRule', { + enumerable: true, + get: function () { + return _UniqueArgumentNamesRule.UniqueArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectiveNamesRule', { + enumerable: true, + get: function () { + return _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectivesPerLocationRule', { + enumerable: true, + get: function () { + return _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule; + }, +}); +Object.defineProperty(exports, 'UniqueEnumValueNamesRule', { + enumerable: true, + get: function () { + return _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFieldDefinitionNamesRule', { + enumerable: true, + get: function () { + return _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFragmentNamesRule', { + enumerable: true, + get: function () { + return _UniqueFragmentNamesRule.UniqueFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueInputFieldNamesRule', { + enumerable: true, + get: function () { + return _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationNamesRule', { + enumerable: true, + get: function () { + return _UniqueOperationNamesRule.UniqueOperationNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationTypesRule', { + enumerable: true, + get: function () { + return _UniqueOperationTypesRule.UniqueOperationTypesRule; + }, +}); +Object.defineProperty(exports, 'UniqueTypeNamesRule', { + enumerable: true, + get: function () { + return _UniqueTypeNamesRule.UniqueTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueVariableNamesRule', { + enumerable: true, + get: function () { + return _UniqueVariableNamesRule.UniqueVariableNamesRule; + }, +}); +Object.defineProperty(exports, 'ValidationContext', { + enumerable: true, + get: function () { + return _ValidationContext.ValidationContext; + }, +}); +Object.defineProperty(exports, 'ValuesOfCorrectTypeRule', { + enumerable: true, + get: function () { + return _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'VariablesAreInputTypesRule', { + enumerable: true, + get: function () { + return _VariablesAreInputTypesRule.VariablesAreInputTypesRule; + }, +}); +Object.defineProperty(exports, 'VariablesInAllowedPositionRule', { + enumerable: true, + get: function () { + return _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule; + }, +}); +Object.defineProperty(exports, 'specifiedRules', { + enumerable: true, + get: function () { + return _specifiedRules.specifiedRules; + }, +}); +Object.defineProperty(exports, 'validate', { + enumerable: true, + get: function () { + return _validate.validate; + }, +}); + +var _validate = require('./validate.js'); + +var _ValidationContext = require('./ValidationContext.js'); + +var _specifiedRules = require('./specifiedRules.js'); + +var _ExecutableDefinitionsRule = require('./rules/ExecutableDefinitionsRule.js'); + +var _FieldsOnCorrectTypeRule = require('./rules/FieldsOnCorrectTypeRule.js'); + +var _FragmentsOnCompositeTypesRule = require('./rules/FragmentsOnCompositeTypesRule.js'); + +var _KnownArgumentNamesRule = require('./rules/KnownArgumentNamesRule.js'); + +var _KnownDirectivesRule = require('./rules/KnownDirectivesRule.js'); + +var _KnownFragmentNamesRule = require('./rules/KnownFragmentNamesRule.js'); + +var _KnownTypeNamesRule = require('./rules/KnownTypeNamesRule.js'); + +var _LoneAnonymousOperationRule = require('./rules/LoneAnonymousOperationRule.js'); + +var _NoFragmentCyclesRule = require('./rules/NoFragmentCyclesRule.js'); + +var _NoUndefinedVariablesRule = require('./rules/NoUndefinedVariablesRule.js'); + +var _NoUnusedFragmentsRule = require('./rules/NoUnusedFragmentsRule.js'); + +var _NoUnusedVariablesRule = require('./rules/NoUnusedVariablesRule.js'); + +var _OverlappingFieldsCanBeMergedRule = require('./rules/OverlappingFieldsCanBeMergedRule.js'); + +var _PossibleFragmentSpreadsRule = require('./rules/PossibleFragmentSpreadsRule.js'); + +var _ProvidedRequiredArgumentsRule = require('./rules/ProvidedRequiredArgumentsRule.js'); + +var _ScalarLeafsRule = require('./rules/ScalarLeafsRule.js'); + +var _SingleFieldSubscriptionsRule = require('./rules/SingleFieldSubscriptionsRule.js'); + +var _UniqueArgumentNamesRule = require('./rules/UniqueArgumentNamesRule.js'); + +var _UniqueDirectivesPerLocationRule = require('./rules/UniqueDirectivesPerLocationRule.js'); + +var _UniqueFragmentNamesRule = require('./rules/UniqueFragmentNamesRule.js'); + +var _UniqueInputFieldNamesRule = require('./rules/UniqueInputFieldNamesRule.js'); + +var _UniqueOperationNamesRule = require('./rules/UniqueOperationNamesRule.js'); + +var _UniqueVariableNamesRule = require('./rules/UniqueVariableNamesRule.js'); + +var _ValuesOfCorrectTypeRule = require('./rules/ValuesOfCorrectTypeRule.js'); + +var _VariablesAreInputTypesRule = require('./rules/VariablesAreInputTypesRule.js'); + +var _VariablesInAllowedPositionRule = require('./rules/VariablesInAllowedPositionRule.js'); + +var _LoneSchemaDefinitionRule = require('./rules/LoneSchemaDefinitionRule.js'); + +var _UniqueOperationTypesRule = require('./rules/UniqueOperationTypesRule.js'); + +var _UniqueTypeNamesRule = require('./rules/UniqueTypeNamesRule.js'); + +var _UniqueEnumValueNamesRule = require('./rules/UniqueEnumValueNamesRule.js'); + +var _UniqueFieldDefinitionNamesRule = require('./rules/UniqueFieldDefinitionNamesRule.js'); + +var _UniqueArgumentDefinitionNamesRule = require('./rules/UniqueArgumentDefinitionNamesRule.js'); + +var _UniqueDirectiveNamesRule = require('./rules/UniqueDirectiveNamesRule.js'); + +var _PossibleTypeExtensionsRule = require('./rules/PossibleTypeExtensionsRule.js'); + +var _NoDeprecatedCustomRule = require('./rules/custom/NoDeprecatedCustomRule.js'); + +var _NoSchemaIntrospectionCustomRule = require('./rules/custom/NoSchemaIntrospectionCustomRule.js'); diff --git a/graphql-subscription-express/node_modules/graphql/validation/index.mjs b/graphql-subscription-express/node_modules/graphql/validation/index.mjs new file mode 100644 index 0000000..ebb103b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/index.mjs @@ -0,0 +1,68 @@ +export { validate } from './validate.mjs'; +export { ValidationContext } from './ValidationContext.mjs'; +// All validation rules in the GraphQL Specification. +export { specifiedRules } from './specifiedRules.mjs'; // Spec Section: "Executable Definitions" + +export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule.mjs'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" + +export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule.mjs'; // Spec Section: "Fragments on Composite Types" + +export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule.mjs'; // Spec Section: "Argument Names" + +export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule.mjs'; // Spec Section: "Directives Are Defined" + +export { KnownDirectivesRule } from './rules/KnownDirectivesRule.mjs'; // Spec Section: "Fragment spread target defined" + +export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule.mjs'; // Spec Section: "Fragment Spread Type Existence" + +export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule.mjs'; // Spec Section: "Lone Anonymous Operation" + +export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule.mjs'; // Spec Section: "Fragments must not form cycles" + +export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule.mjs'; // Spec Section: "All Variable Used Defined" + +export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule.mjs'; // Spec Section: "Fragments must be used" + +export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule.mjs'; // Spec Section: "All Variables Used" + +export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule.mjs'; // Spec Section: "Field Selection Merging" + +export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule.mjs'; // Spec Section: "Fragment spread is possible" + +export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule.mjs'; // Spec Section: "Argument Optionality" + +export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule.mjs'; // Spec Section: "Leaf Field Selections" + +export { ScalarLeafsRule } from './rules/ScalarLeafsRule.mjs'; // Spec Section: "Subscriptions with Single Root Field" + +export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule.mjs'; // Spec Section: "Argument Uniqueness" + +export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule.mjs'; // Spec Section: "Directives Are Unique Per Location" + +export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule.mjs'; // Spec Section: "Fragment Name Uniqueness" + +export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule.mjs'; // Spec Section: "Input Object Field Uniqueness" + +export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule.mjs'; // Spec Section: "Operation Name Uniqueness" + +export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule.mjs'; // Spec Section: "Variable Uniqueness" + +export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule.mjs'; // Spec Section: "Values Type Correctness" + +export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule.mjs'; // Spec Section: "Variables are Input Types" + +export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule.mjs'; // Spec Section: "All Variable Usages Are Allowed" + +export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule.mjs'; // SDL-specific validation rules + +export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule.mjs'; +export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule.mjs'; +export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule.mjs'; +export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule.mjs'; +export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule.mjs'; +export { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule.mjs'; +export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule.mjs'; +export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule.mjs'; // Optional rules not defined by the GraphQL Specification + +export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule.mjs'; +export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule.mjs'; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts new file mode 100644 index 0000000..8f58c78 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + */ +export declare function ExecutableDefinitionsRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js new file mode 100644 index 0000000..e20c621 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ExecutableDefinitionsRule = ExecutableDefinitionsRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _predicates = require('../../language/predicates.js'); + +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + */ +function ExecutableDefinitionsRule(context) { + return { + Document(node) { + for (const definition of node.definitions) { + if (!(0, _predicates.isExecutableDefinitionNode)(definition)) { + const defName = + definition.kind === _kinds.Kind.SCHEMA_DEFINITION || + definition.kind === _kinds.Kind.SCHEMA_EXTENSION + ? 'schema' + : '"' + definition.name.value + '"'; + context.reportError( + new _GraphQLError.GraphQLError( + `The ${defName} definition is not executable.`, + { + nodes: definition, + }, + ), + ); + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs new file mode 100644 index 0000000..b83cee4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs @@ -0,0 +1,34 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { isExecutableDefinitionNode } from '../../language/predicates.mjs'; + +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + */ +export function ExecutableDefinitionsRule(context) { + return { + Document(node) { + for (const definition of node.definitions) { + if (!isExecutableDefinitionNode(definition)) { + const defName = + definition.kind === Kind.SCHEMA_DEFINITION || + definition.kind === Kind.SCHEMA_EXTENSION + ? 'schema' + : '"' + definition.name.value + '"'; + context.reportError( + new GraphQLError(`The ${defName} definition is not executable.`, { + nodes: definition, + }), + ); + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts new file mode 100644 index 0000000..127335b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + */ +export declare function FieldsOnCorrectTypeRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js new file mode 100644 index 0000000..d08e1df --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js @@ -0,0 +1,145 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.FieldsOnCorrectTypeRule = FieldsOnCorrectTypeRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _naturalCompare = require('../../jsutils/naturalCompare.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + */ +function FieldsOnCorrectTypeRule(context) { + return { + Field(node) { + const type = context.getParentType(); + + if (type) { + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + // This field doesn't exist, lets look for suggestions. + const schema = context.getSchema(); + const fieldName = node.name.value; // First determine if there are any suggested types to condition on. + + let suggestion = (0, _didYouMean.didYouMean)( + 'to use an inline fragment on', + getSuggestedTypeNames(schema, type, fieldName), + ); // If there are no suggested types, then perhaps this was a typo? + + if (suggestion === '') { + suggestion = (0, _didYouMean.didYouMean)( + getSuggestedFieldNames(type, fieldName), + ); + } // Report an error, including helpful suggestions. + + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot query field "${fieldName}" on type "${type.name}".` + + suggestion, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} +/** + * Go through all of the implementations of type, as well as the interfaces that + * they implement. If any of those types include the provided field, suggest them, + * sorted by how often the type is referenced. + */ + +function getSuggestedTypeNames(schema, type, fieldName) { + if (!(0, _definition.isAbstractType)(type)) { + // Must be an Object type, which does not have possible fields. + return []; + } + + const suggestedTypes = new Set(); + const usageCount = Object.create(null); + + for (const possibleType of schema.getPossibleTypes(type)) { + if (!possibleType.getFields()[fieldName]) { + continue; + } // This object type defines this field. + + suggestedTypes.add(possibleType); + usageCount[possibleType.name] = 1; + + for (const possibleInterface of possibleType.getInterfaces()) { + var _usageCount$possibleI; + + if (!possibleInterface.getFields()[fieldName]) { + continue; + } // This interface type defines this field. + + suggestedTypes.add(possibleInterface); + usageCount[possibleInterface.name] = + ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== + null && _usageCount$possibleI !== void 0 + ? _usageCount$possibleI + : 0) + 1; + } + } + + return [...suggestedTypes] + .sort((typeA, typeB) => { + // Suggest both interface and object types based on how common they are. + const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; + + if (usageCountDiff !== 0) { + return usageCountDiff; + } // Suggest super types first followed by subtypes + + if ( + (0, _definition.isInterfaceType)(typeA) && + schema.isSubType(typeA, typeB) + ) { + return -1; + } + + if ( + (0, _definition.isInterfaceType)(typeB) && + schema.isSubType(typeB, typeA) + ) { + return 1; + } + + return (0, _naturalCompare.naturalCompare)(typeA.name, typeB.name); + }) + .map((x) => x.name); +} +/** + * For the field name provided, determine if there are any similar field names + * that may be the result of a typo. + */ + +function getSuggestedFieldNames(type, fieldName) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) + ) { + const possibleFieldNames = Object.keys(type.getFields()); + return (0, _suggestionList.suggestionList)(fieldName, possibleFieldNames); + } // Otherwise, must be a Union type, which does not define fields. + + return []; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs new file mode 100644 index 0000000..c955265 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs @@ -0,0 +1,127 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { naturalCompare } from '../../jsutils/naturalCompare.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { + isAbstractType, + isInterfaceType, + isObjectType, +} from '../../type/definition.mjs'; + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + */ +export function FieldsOnCorrectTypeRule(context) { + return { + Field(node) { + const type = context.getParentType(); + + if (type) { + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + // This field doesn't exist, lets look for suggestions. + const schema = context.getSchema(); + const fieldName = node.name.value; // First determine if there are any suggested types to condition on. + + let suggestion = didYouMean( + 'to use an inline fragment on', + getSuggestedTypeNames(schema, type, fieldName), + ); // If there are no suggested types, then perhaps this was a typo? + + if (suggestion === '') { + suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); + } // Report an error, including helpful suggestions. + + context.reportError( + new GraphQLError( + `Cannot query field "${fieldName}" on type "${type.name}".` + + suggestion, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} +/** + * Go through all of the implementations of type, as well as the interfaces that + * they implement. If any of those types include the provided field, suggest them, + * sorted by how often the type is referenced. + */ + +function getSuggestedTypeNames(schema, type, fieldName) { + if (!isAbstractType(type)) { + // Must be an Object type, which does not have possible fields. + return []; + } + + const suggestedTypes = new Set(); + const usageCount = Object.create(null); + + for (const possibleType of schema.getPossibleTypes(type)) { + if (!possibleType.getFields()[fieldName]) { + continue; + } // This object type defines this field. + + suggestedTypes.add(possibleType); + usageCount[possibleType.name] = 1; + + for (const possibleInterface of possibleType.getInterfaces()) { + var _usageCount$possibleI; + + if (!possibleInterface.getFields()[fieldName]) { + continue; + } // This interface type defines this field. + + suggestedTypes.add(possibleInterface); + usageCount[possibleInterface.name] = + ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== + null && _usageCount$possibleI !== void 0 + ? _usageCount$possibleI + : 0) + 1; + } + } + + return [...suggestedTypes] + .sort((typeA, typeB) => { + // Suggest both interface and object types based on how common they are. + const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; + + if (usageCountDiff !== 0) { + return usageCountDiff; + } // Suggest super types first followed by subtypes + + if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { + return -1; + } + + if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { + return 1; + } + + return naturalCompare(typeA.name, typeB.name); + }) + .map((x) => x.name); +} +/** + * For the field name provided, determine if there are any similar field names + * that may be the result of a typo. + */ + +function getSuggestedFieldNames(type, fieldName) { + if (isObjectType(type) || isInterfaceType(type)) { + const possibleFieldNames = Object.keys(type.getFields()); + return suggestionList(fieldName, possibleFieldNames); + } // Otherwise, must be a Union type, which does not define fields. + + return []; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts new file mode 100644 index 0000000..a0c5819 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts @@ -0,0 +1,14 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + */ +export declare function FragmentsOnCompositeTypesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js new file mode 100644 index 0000000..26744e5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.FragmentsOnCompositeTypesRule = FragmentsOnCompositeTypesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + */ +function FragmentsOnCompositeTypesRule(context) { + return { + InlineFragment(node) { + const typeCondition = node.typeCondition; + + if (typeCondition) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + typeCondition, + ); + + if (type && !(0, _definition.isCompositeType)(type)) { + const typeStr = (0, _printer.print)(typeCondition); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment cannot condition on non composite type "${typeStr}".`, + { + nodes: typeCondition, + }, + ), + ); + } + } + }, + + FragmentDefinition(node) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + node.typeCondition, + ); + + if (type && !(0, _definition.isCompositeType)(type)) { + const typeStr = (0, _printer.print)(node.typeCondition); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, + { + nodes: node.typeCondition, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs new file mode 100644 index 0000000..2443774 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs @@ -0,0 +1,53 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { print } from '../../language/printer.mjs'; +import { isCompositeType } from '../../type/definition.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + */ +export function FragmentsOnCompositeTypesRule(context) { + return { + InlineFragment(node) { + const typeCondition = node.typeCondition; + + if (typeCondition) { + const type = typeFromAST(context.getSchema(), typeCondition); + + if (type && !isCompositeType(type)) { + const typeStr = print(typeCondition); + context.reportError( + new GraphQLError( + `Fragment cannot condition on non composite type "${typeStr}".`, + { + nodes: typeCondition, + }, + ), + ); + } + } + }, + + FragmentDefinition(node) { + const type = typeFromAST(context.getSchema(), node.typeCondition); + + if (type && !isCompositeType(type)) { + const typeStr = print(node.typeCondition); + context.reportError( + new GraphQLError( + `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, + { + nodes: node.typeCondition, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts new file mode 100644 index 0000000..9e03ac3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts @@ -0,0 +1,23 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + */ +export declare function KnownArgumentNamesRule( + context: ValidationContext, +): ASTVisitor; +/** + * @internal + */ +export declare function KnownArgumentNamesOnDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js new file mode 100644 index 0000000..98f8f36 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js @@ -0,0 +1,120 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownArgumentNamesOnDirectivesRule = KnownArgumentNamesOnDirectivesRule; +exports.KnownArgumentNamesRule = KnownArgumentNamesRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + */ +function KnownArgumentNamesRule(context) { + return { + // eslint-disable-next-line new-cap + ...KnownArgumentNamesOnDirectivesRule(context), + + Argument(argNode) { + const argDef = context.getArgument(); + const fieldDef = context.getFieldDef(); + const parentType = context.getParentType(); + + if (!argDef && fieldDef && parentType) { + const argName = argNode.name.value; + const knownArgsNames = fieldDef.args.map((arg) => arg.name); + const suggestions = (0, _suggestionList.suggestionList)( + argName, + knownArgsNames, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + + (0, _didYouMean.didYouMean)(suggestions), + { + nodes: argNode, + }, + ), + ); + } + }, + }; +} +/** + * @internal + */ + +function KnownArgumentNamesOnDirectivesRule(context) { + const directiveArgs = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + directiveArgs[directive.name] = directive.args.map((arg) => arg.name); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argsNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); + } + } + + return { + Directive(directiveNode) { + const directiveName = directiveNode.name.value; + const knownArgs = directiveArgs[directiveName]; + + if (directiveNode.arguments && knownArgs) { + for (const argNode of directiveNode.arguments) { + const argName = argNode.name.value; + + if (!knownArgs.includes(argName)) { + const suggestions = (0, _suggestionList.suggestionList)( + argName, + knownArgs, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown argument "${argName}" on directive "@${directiveName}".` + + (0, _didYouMean.didYouMean)(suggestions), + { + nodes: argNode, + }, + ), + ); + } + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs new file mode 100644 index 0000000..2213728 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs @@ -0,0 +1,102 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + */ +export function KnownArgumentNamesRule(context) { + return { + // eslint-disable-next-line new-cap + ...KnownArgumentNamesOnDirectivesRule(context), + + Argument(argNode) { + const argDef = context.getArgument(); + const fieldDef = context.getFieldDef(); + const parentType = context.getParentType(); + + if (!argDef && fieldDef && parentType) { + const argName = argNode.name.value; + const knownArgsNames = fieldDef.args.map((arg) => arg.name); + const suggestions = suggestionList(argName, knownArgsNames); + context.reportError( + new GraphQLError( + `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + + didYouMean(suggestions), + { + nodes: argNode, + }, + ), + ); + } + }, + }; +} +/** + * @internal + */ + +export function KnownArgumentNamesOnDirectivesRule(context) { + const directiveArgs = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + + for (const directive of definedDirectives) { + directiveArgs[directive.name] = directive.args.map((arg) => arg.name); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argsNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); + } + } + + return { + Directive(directiveNode) { + const directiveName = directiveNode.name.value; + const knownArgs = directiveArgs[directiveName]; + + if (directiveNode.arguments && knownArgs) { + for (const argNode of directiveNode.arguments) { + const argName = argNode.name.value; + + if (!knownArgs.includes(argName)) { + const suggestions = suggestionList(argName, knownArgs); + context.reportError( + new GraphQLError( + `Unknown argument "${argName}" on directive "@${directiveName}".` + + didYouMean(suggestions), + { + nodes: argNode, + }, + ), + ); + } + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts new file mode 100644 index 0000000..9f3fee4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts @@ -0,0 +1,16 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + */ +export declare function KnownDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.js new file mode 100644 index 0000000..8ee4a3f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.js @@ -0,0 +1,167 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownDirectivesRule = KnownDirectivesRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _invariant = require('../../jsutils/invariant.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _ast = require('../../language/ast.js'); + +var _directiveLocation = require('../../language/directiveLocation.js'); + +var _kinds = require('../../language/kinds.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + */ +function KnownDirectivesRule(context) { + const locationsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + locationsMap[directive.name] = directive.locations; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + locationsMap[def.name.value] = def.locations.map((name) => name.value); + } + } + + return { + Directive(node, _key, _parent, _path, ancestors) { + const name = node.name.value; + const locations = locationsMap[name]; + + if (!locations) { + context.reportError( + new _GraphQLError.GraphQLError(`Unknown directive "@${name}".`, { + nodes: node, + }), + ); + return; + } + + const candidateLocation = getDirectiveLocationForASTPath(ancestors); + + if (candidateLocation && !locations.includes(candidateLocation)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${name}" may not be used on ${candidateLocation}.`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getDirectiveLocationForASTPath(ancestors) { + const appliedTo = ancestors[ancestors.length - 1]; + 'kind' in appliedTo || (0, _invariant.invariant)(false); + + switch (appliedTo.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + return getDirectiveLocationForOperation(appliedTo.operation); + + case _kinds.Kind.FIELD: + return _directiveLocation.DirectiveLocation.FIELD; + + case _kinds.Kind.FRAGMENT_SPREAD: + return _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD; + + case _kinds.Kind.INLINE_FRAGMENT: + return _directiveLocation.DirectiveLocation.INLINE_FRAGMENT; + + case _kinds.Kind.FRAGMENT_DEFINITION: + return _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION; + + case _kinds.Kind.VARIABLE_DEFINITION: + return _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION; + + case _kinds.Kind.SCHEMA_DEFINITION: + case _kinds.Kind.SCHEMA_EXTENSION: + return _directiveLocation.DirectiveLocation.SCHEMA; + + case _kinds.Kind.SCALAR_TYPE_DEFINITION: + case _kinds.Kind.SCALAR_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.SCALAR; + + case _kinds.Kind.OBJECT_TYPE_DEFINITION: + case _kinds.Kind.OBJECT_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.OBJECT; + + case _kinds.Kind.FIELD_DEFINITION: + return _directiveLocation.DirectiveLocation.FIELD_DEFINITION; + + case _kinds.Kind.INTERFACE_TYPE_DEFINITION: + case _kinds.Kind.INTERFACE_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.INTERFACE; + + case _kinds.Kind.UNION_TYPE_DEFINITION: + case _kinds.Kind.UNION_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.UNION; + + case _kinds.Kind.ENUM_TYPE_DEFINITION: + case _kinds.Kind.ENUM_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.ENUM; + + case _kinds.Kind.ENUM_VALUE_DEFINITION: + return _directiveLocation.DirectiveLocation.ENUM_VALUE; + + case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: + case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.INPUT_OBJECT; + + case _kinds.Kind.INPUT_VALUE_DEFINITION: { + const parentNode = ancestors[ancestors.length - 3]; + 'kind' in parentNode || (0, _invariant.invariant)(false); + return parentNode.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION + ? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION + : _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION; + } + // Not reachable, all possible types have been considered. + + /* c8 ignore next */ + + default: + false || + (0, _invariant.invariant)( + false, + 'Unexpected kind: ' + (0, _inspect.inspect)(appliedTo.kind), + ); + } +} + +function getDirectiveLocationForOperation(operation) { + switch (operation) { + case _ast.OperationTypeNode.QUERY: + return _directiveLocation.DirectiveLocation.QUERY; + + case _ast.OperationTypeNode.MUTATION: + return _directiveLocation.DirectiveLocation.MUTATION; + + case _ast.OperationTypeNode.SUBSCRIPTION: + return _directiveLocation.DirectiveLocation.SUBSCRIPTION; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs new file mode 100644 index 0000000..6755ff1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs @@ -0,0 +1,150 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { invariant } from '../../jsutils/invariant.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { OperationTypeNode } from '../../language/ast.mjs'; +import { DirectiveLocation } from '../../language/directiveLocation.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + */ +export function KnownDirectivesRule(context) { + const locationsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + + for (const directive of definedDirectives) { + locationsMap[directive.name] = directive.locations; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + locationsMap[def.name.value] = def.locations.map((name) => name.value); + } + } + + return { + Directive(node, _key, _parent, _path, ancestors) { + const name = node.name.value; + const locations = locationsMap[name]; + + if (!locations) { + context.reportError( + new GraphQLError(`Unknown directive "@${name}".`, { + nodes: node, + }), + ); + return; + } + + const candidateLocation = getDirectiveLocationForASTPath(ancestors); + + if (candidateLocation && !locations.includes(candidateLocation)) { + context.reportError( + new GraphQLError( + `Directive "@${name}" may not be used on ${candidateLocation}.`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getDirectiveLocationForASTPath(ancestors) { + const appliedTo = ancestors[ancestors.length - 1]; + 'kind' in appliedTo || invariant(false); + + switch (appliedTo.kind) { + case Kind.OPERATION_DEFINITION: + return getDirectiveLocationForOperation(appliedTo.operation); + + case Kind.FIELD: + return DirectiveLocation.FIELD; + + case Kind.FRAGMENT_SPREAD: + return DirectiveLocation.FRAGMENT_SPREAD; + + case Kind.INLINE_FRAGMENT: + return DirectiveLocation.INLINE_FRAGMENT; + + case Kind.FRAGMENT_DEFINITION: + return DirectiveLocation.FRAGMENT_DEFINITION; + + case Kind.VARIABLE_DEFINITION: + return DirectiveLocation.VARIABLE_DEFINITION; + + case Kind.SCHEMA_DEFINITION: + case Kind.SCHEMA_EXTENSION: + return DirectiveLocation.SCHEMA; + + case Kind.SCALAR_TYPE_DEFINITION: + case Kind.SCALAR_TYPE_EXTENSION: + return DirectiveLocation.SCALAR; + + case Kind.OBJECT_TYPE_DEFINITION: + case Kind.OBJECT_TYPE_EXTENSION: + return DirectiveLocation.OBJECT; + + case Kind.FIELD_DEFINITION: + return DirectiveLocation.FIELD_DEFINITION; + + case Kind.INTERFACE_TYPE_DEFINITION: + case Kind.INTERFACE_TYPE_EXTENSION: + return DirectiveLocation.INTERFACE; + + case Kind.UNION_TYPE_DEFINITION: + case Kind.UNION_TYPE_EXTENSION: + return DirectiveLocation.UNION; + + case Kind.ENUM_TYPE_DEFINITION: + case Kind.ENUM_TYPE_EXTENSION: + return DirectiveLocation.ENUM; + + case Kind.ENUM_VALUE_DEFINITION: + return DirectiveLocation.ENUM_VALUE; + + case Kind.INPUT_OBJECT_TYPE_DEFINITION: + case Kind.INPUT_OBJECT_TYPE_EXTENSION: + return DirectiveLocation.INPUT_OBJECT; + + case Kind.INPUT_VALUE_DEFINITION: { + const parentNode = ancestors[ancestors.length - 3]; + 'kind' in parentNode || invariant(false); + return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION + ? DirectiveLocation.INPUT_FIELD_DEFINITION + : DirectiveLocation.ARGUMENT_DEFINITION; + } + // Not reachable, all possible types have been considered. + + /* c8 ignore next */ + + default: + false || invariant(false, 'Unexpected kind: ' + inspect(appliedTo.kind)); + } +} + +function getDirectiveLocationForOperation(operation) { + switch (operation) { + case OperationTypeNode.QUERY: + return DirectiveLocation.QUERY; + + case OperationTypeNode.MUTATION: + return DirectiveLocation.MUTATION; + + case OperationTypeNode.SUBSCRIPTION: + return DirectiveLocation.SUBSCRIPTION; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts new file mode 100644 index 0000000..7b783fd --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + */ +export declare function KnownFragmentNamesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js new file mode 100644 index 0000000..92c7646 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js @@ -0,0 +1,36 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownFragmentNamesRule = KnownFragmentNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + */ +function KnownFragmentNamesRule(context) { + return { + FragmentSpread(node) { + const fragmentName = node.name.value; + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown fragment "${fragmentName}".`, + { + nodes: node.name, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs new file mode 100644 index 0000000..f4b5307 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs @@ -0,0 +1,26 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + */ +export function KnownFragmentNamesRule(context) { + return { + FragmentSpread(node) { + const fragmentName = node.name.value; + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + context.reportError( + new GraphQLError(`Unknown fragment "${fragmentName}".`, { + nodes: node.name, + }), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts new file mode 100644 index 0000000..9f761ec --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts @@ -0,0 +1,16 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + */ +export declare function KnownTypeNamesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.js new file mode 100644 index 0000000..67685d2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.js @@ -0,0 +1,89 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownTypeNamesRule = KnownTypeNamesRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _predicates = require('../../language/predicates.js'); + +var _introspection = require('../../type/introspection.js'); + +var _scalars = require('../../type/scalars.js'); + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + */ +function KnownTypeNamesRule(context) { + const schema = context.getSchema(); + const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if ((0, _predicates.isTypeDefinitionNode)(def)) { + definedTypes[def.name.value] = true; + } + } + + const typeNames = [ + ...Object.keys(existingTypesMap), + ...Object.keys(definedTypes), + ]; + return { + NamedType(node, _1, parent, _2, ancestors) { + const typeName = node.name.value; + + if (!existingTypesMap[typeName] && !definedTypes[typeName]) { + var _ancestors$; + + const definitionNode = + (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 + ? _ancestors$ + : parent; + const isSDL = definitionNode != null && isSDLNode(definitionNode); + + if (isSDL && standardTypeNames.includes(typeName)) { + return; + } + + const suggestedTypes = (0, _suggestionList.suggestionList)( + typeName, + isSDL ? standardTypeNames.concat(typeNames) : typeNames, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown type "${typeName}".` + + (0, _didYouMean.didYouMean)(suggestedTypes), + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +const standardTypeNames = [ + ..._scalars.specifiedScalarTypes, + ..._introspection.introspectionTypes, +].map((type) => type.name); + +function isSDLNode(value) { + return ( + 'kind' in value && + ((0, _predicates.isTypeSystemDefinitionNode)(value) || + (0, _predicates.isTypeSystemExtensionNode)(value)) + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs new file mode 100644 index 0000000..424b162 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs @@ -0,0 +1,77 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { + isTypeDefinitionNode, + isTypeSystemDefinitionNode, + isTypeSystemExtensionNode, +} from '../../language/predicates.mjs'; +import { introspectionTypes } from '../../type/introspection.mjs'; +import { specifiedScalarTypes } from '../../type/scalars.mjs'; + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + */ +export function KnownTypeNamesRule(context) { + const schema = context.getSchema(); + const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if (isTypeDefinitionNode(def)) { + definedTypes[def.name.value] = true; + } + } + + const typeNames = [ + ...Object.keys(existingTypesMap), + ...Object.keys(definedTypes), + ]; + return { + NamedType(node, _1, parent, _2, ancestors) { + const typeName = node.name.value; + + if (!existingTypesMap[typeName] && !definedTypes[typeName]) { + var _ancestors$; + + const definitionNode = + (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 + ? _ancestors$ + : parent; + const isSDL = definitionNode != null && isSDLNode(definitionNode); + + if (isSDL && standardTypeNames.includes(typeName)) { + return; + } + + const suggestedTypes = suggestionList( + typeName, + isSDL ? standardTypeNames.concat(typeNames) : typeNames, + ); + context.reportError( + new GraphQLError( + `Unknown type "${typeName}".` + didYouMean(suggestedTypes), + { + nodes: node, + }, + ), + ); + } + }, + }; +} +const standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map( + (type) => type.name, +); + +function isSDLNode(value) { + return ( + 'kind' in value && + (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)) + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts new file mode 100644 index 0000000..60563cb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + */ +export declare function LoneAnonymousOperationRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js new file mode 100644 index 0000000..46f3f48 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.LoneAnonymousOperationRule = LoneAnonymousOperationRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + */ +function LoneAnonymousOperationRule(context) { + let operationCount = 0; + return { + Document(node) { + operationCount = node.definitions.filter( + (definition) => definition.kind === _kinds.Kind.OPERATION_DEFINITION, + ).length; + }, + + OperationDefinition(node) { + if (!node.name && operationCount > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + 'This anonymous operation must be the only defined operation.', + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs new file mode 100644 index 0000000..1a21a39 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs @@ -0,0 +1,34 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + */ +export function LoneAnonymousOperationRule(context) { + let operationCount = 0; + return { + Document(node) { + operationCount = node.definitions.filter( + (definition) => definition.kind === Kind.OPERATION_DEFINITION, + ).length; + }, + + OperationDefinition(node) { + if (!node.name && operationCount > 1) { + context.reportError( + new GraphQLError( + 'This anonymous operation must be the only defined operation.', + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts new file mode 100644 index 0000000..bf926d2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +export declare function LoneSchemaDefinitionRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js new file mode 100644 index 0000000..a5757cc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js @@ -0,0 +1,67 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.LoneSchemaDefinitionRule = LoneSchemaDefinitionRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +function LoneSchemaDefinitionRule(context) { + var _ref, _ref2, _oldSchema$astNode; + + const oldSchema = context.getSchema(); + const alreadyDefined = + (_ref = + (_ref2 = + (_oldSchema$astNode = + oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 + ? _oldSchema$astNode + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getQueryType()) !== null && _ref2 !== void 0 + ? _ref2 + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getMutationType()) !== null && _ref !== void 0 + ? _ref + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getSubscriptionType(); + let schemaDefinitionsCount = 0; + return { + SchemaDefinition(node) { + if (alreadyDefined) { + context.reportError( + new _GraphQLError.GraphQLError( + 'Cannot define a new schema within a schema extension.', + { + nodes: node, + }, + ), + ); + return; + } + + if (schemaDefinitionsCount > 0) { + context.reportError( + new _GraphQLError.GraphQLError( + 'Must provide only one schema definition.', + { + nodes: node, + }, + ), + ); + } + + ++schemaDefinitionsCount; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs new file mode 100644 index 0000000..4287eaa --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs @@ -0,0 +1,57 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +export function LoneSchemaDefinitionRule(context) { + var _ref, _ref2, _oldSchema$astNode; + + const oldSchema = context.getSchema(); + const alreadyDefined = + (_ref = + (_ref2 = + (_oldSchema$astNode = + oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 + ? _oldSchema$astNode + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getQueryType()) !== null && _ref2 !== void 0 + ? _ref2 + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getMutationType()) !== null && _ref !== void 0 + ? _ref + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getSubscriptionType(); + let schemaDefinitionsCount = 0; + return { + SchemaDefinition(node) { + if (alreadyDefined) { + context.reportError( + new GraphQLError( + 'Cannot define a new schema within a schema extension.', + { + nodes: node, + }, + ), + ); + return; + } + + if (schemaDefinitionsCount > 0) { + context.reportError( + new GraphQLError('Must provide only one schema definition.', { + nodes: node, + }), + ); + } + + ++schemaDefinitionsCount; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts new file mode 100644 index 0000000..b9fbeef --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + */ +export declare function NoFragmentCyclesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js new file mode 100644 index 0000000..88744ac --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js @@ -0,0 +1,85 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoFragmentCyclesRule = NoFragmentCyclesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + */ +function NoFragmentCyclesRule(context) { + // Tracks already visited fragments to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors + + const spreadPath = []; // Position in the spread path + + const spreadPathIndexByName = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + detectCycleRecursive(node); + return false; + }, + }; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(fragment) { + if (visitedFrags[fragment.name.value]) { + return; + } + + const fragmentName = fragment.name.value; + visitedFrags[fragmentName] = true; + const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); + + if (spreadNodes.length === 0) { + return; + } + + spreadPathIndexByName[fragmentName] = spreadPath.length; + + for (const spreadNode of spreadNodes) { + const spreadName = spreadNode.name.value; + const cycleIndex = spreadPathIndexByName[spreadName]; + spreadPath.push(spreadNode); + + if (cycleIndex === undefined) { + const spreadFragment = context.getFragment(spreadName); + + if (spreadFragment) { + detectCycleRecursive(spreadFragment); + } + } else { + const cyclePath = spreadPath.slice(cycleIndex); + const viaPath = cyclePath + .slice(0, -1) + .map((s) => '"' + s.name.value + '"') + .join(', '); + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot spread fragment "${spreadName}" within itself` + + (viaPath !== '' ? ` via ${viaPath}.` : '.'), + { + nodes: cyclePath, + }, + ), + ); + } + + spreadPath.pop(); + } + + spreadPathIndexByName[fragmentName] = undefined; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs new file mode 100644 index 0000000..014f1d2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs @@ -0,0 +1,78 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + */ +export function NoFragmentCyclesRule(context) { + // Tracks already visited fragments to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors + + const spreadPath = []; // Position in the spread path + + const spreadPathIndexByName = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + detectCycleRecursive(node); + return false; + }, + }; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(fragment) { + if (visitedFrags[fragment.name.value]) { + return; + } + + const fragmentName = fragment.name.value; + visitedFrags[fragmentName] = true; + const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); + + if (spreadNodes.length === 0) { + return; + } + + spreadPathIndexByName[fragmentName] = spreadPath.length; + + for (const spreadNode of spreadNodes) { + const spreadName = spreadNode.name.value; + const cycleIndex = spreadPathIndexByName[spreadName]; + spreadPath.push(spreadNode); + + if (cycleIndex === undefined) { + const spreadFragment = context.getFragment(spreadName); + + if (spreadFragment) { + detectCycleRecursive(spreadFragment); + } + } else { + const cyclePath = spreadPath.slice(cycleIndex); + const viaPath = cyclePath + .slice(0, -1) + .map((s) => '"' + s.name.value + '"') + .join(', '); + context.reportError( + new GraphQLError( + `Cannot spread fragment "${spreadName}" within itself` + + (viaPath !== '' ? ` via ${viaPath}.` : '.'), + { + nodes: cyclePath, + }, + ), + ); + } + + spreadPath.pop(); + } + + spreadPathIndexByName[fragmentName] = undefined; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts new file mode 100644 index 0000000..40e5d74 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + */ +export declare function NoUndefinedVariablesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js new file mode 100644 index 0000000..2e9bdce --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js @@ -0,0 +1,52 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoUndefinedVariablesRule = NoUndefinedVariablesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + */ +function NoUndefinedVariablesRule(context) { + let variableNameDefined = Object.create(null); + return { + OperationDefinition: { + enter() { + variableNameDefined = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + const varName = node.name.value; + + if (variableNameDefined[varName] !== true) { + context.reportError( + new _GraphQLError.GraphQLError( + operation.name + ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` + : `Variable "$${varName}" is not defined.`, + { + nodes: [node, operation], + }, + ), + ); + } + } + }, + }, + + VariableDefinition(node) { + variableNameDefined[node.variable.name.value] = true; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs new file mode 100644 index 0000000..29b8f37 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs @@ -0,0 +1,45 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + */ +export function NoUndefinedVariablesRule(context) { + let variableNameDefined = Object.create(null); + return { + OperationDefinition: { + enter() { + variableNameDefined = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + const varName = node.name.value; + + if (variableNameDefined[varName] !== true) { + context.reportError( + new GraphQLError( + operation.name + ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` + : `Variable "$${varName}" is not defined.`, + { + nodes: [node, operation], + }, + ), + ); + } + } + }, + }, + + VariableDefinition(node) { + variableNameDefined[node.variable.name.value] = true; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts new file mode 100644 index 0000000..c987878 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + */ +export declare function NoUnusedFragmentsRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js new file mode 100644 index 0000000..c018e21 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoUnusedFragmentsRule = NoUnusedFragmentsRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + */ +function NoUnusedFragmentsRule(context) { + const operationDefs = []; + const fragmentDefs = []; + return { + OperationDefinition(node) { + operationDefs.push(node); + return false; + }, + + FragmentDefinition(node) { + fragmentDefs.push(node); + return false; + }, + + Document: { + leave() { + const fragmentNameUsed = Object.create(null); + + for (const operation of operationDefs) { + for (const fragment of context.getRecursivelyReferencedFragments( + operation, + )) { + fragmentNameUsed[fragment.name.value] = true; + } + } + + for (const fragmentDef of fragmentDefs) { + const fragName = fragmentDef.name.value; + + if (fragmentNameUsed[fragName] !== true) { + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment "${fragName}" is never used.`, + { + nodes: fragmentDef, + }, + ), + ); + } + } + }, + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs new file mode 100644 index 0000000..8ce0735 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs @@ -0,0 +1,51 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + */ +export function NoUnusedFragmentsRule(context) { + const operationDefs = []; + const fragmentDefs = []; + return { + OperationDefinition(node) { + operationDefs.push(node); + return false; + }, + + FragmentDefinition(node) { + fragmentDefs.push(node); + return false; + }, + + Document: { + leave() { + const fragmentNameUsed = Object.create(null); + + for (const operation of operationDefs) { + for (const fragment of context.getRecursivelyReferencedFragments( + operation, + )) { + fragmentNameUsed[fragment.name.value] = true; + } + } + + for (const fragmentDef of fragmentDefs) { + const fragName = fragmentDef.name.value; + + if (fragmentNameUsed[fragName] !== true) { + context.reportError( + new GraphQLError(`Fragment "${fragName}" is never used.`, { + nodes: fragmentDef, + }), + ); + } + } + }, + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts new file mode 100644 index 0000000..118260f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + */ +export declare function NoUnusedVariablesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js new file mode 100644 index 0000000..6377e22 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoUnusedVariablesRule = NoUnusedVariablesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + */ +function NoUnusedVariablesRule(context) { + let variableDefs = []; + return { + OperationDefinition: { + enter() { + variableDefs = []; + }, + + leave(operation) { + const variableNameUsed = Object.create(null); + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + variableNameUsed[node.name.value] = true; + } + + for (const variableDef of variableDefs) { + const variableName = variableDef.variable.name.value; + + if (variableNameUsed[variableName] !== true) { + context.reportError( + new _GraphQLError.GraphQLError( + operation.name + ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` + : `Variable "$${variableName}" is never used.`, + { + nodes: variableDef, + }, + ), + ); + } + } + }, + }, + + VariableDefinition(def) { + variableDefs.push(def); + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs new file mode 100644 index 0000000..07ef8d6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs @@ -0,0 +1,50 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + */ +export function NoUnusedVariablesRule(context) { + let variableDefs = []; + return { + OperationDefinition: { + enter() { + variableDefs = []; + }, + + leave(operation) { + const variableNameUsed = Object.create(null); + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + variableNameUsed[node.name.value] = true; + } + + for (const variableDef of variableDefs) { + const variableName = variableDef.variable.name.value; + + if (variableNameUsed[variableName] !== true) { + context.reportError( + new GraphQLError( + operation.name + ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` + : `Variable "$${variableName}" is never used.`, + { + nodes: variableDef, + }, + ), + ); + } + } + }, + }, + + VariableDefinition(def) { + variableDefs.push(def); + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts new file mode 100644 index 0000000..b5d2c62 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts @@ -0,0 +1,14 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + */ +export declare function OverlappingFieldsCanBeMergedRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js new file mode 100644 index 0000000..4b29acf --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js @@ -0,0 +1,820 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.OverlappingFieldsCanBeMergedRule = OverlappingFieldsCanBeMergedRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _sortValueNode = require('../../utilities/sortValueNode.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +function reasonMessage(reason) { + if (Array.isArray(reason)) { + return reason + .map( + ([responseName, subReason]) => + `subfields "${responseName}" conflict because ` + + reasonMessage(subReason), + ) + .join(' and '); + } + + return reason; +} +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + */ + +function OverlappingFieldsCanBeMergedRule(context) { + // A memoization for when two fragments are compared "between" each other for + // conflicts. Two fragments may be compared many times, so memoizing this can + // dramatically improve the performance of this validator. + const comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given + // selection set. Selection sets may be asked for this information multiple + // times, so this improves the performance of this validator. + + const cachedFieldsAndFragmentNames = new Map(); + return { + SelectionSet(selectionSet) { + const conflicts = findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + context.getParentType(), + selectionSet, + ); + + for (const [[responseName, reason], fields1, fields2] of conflicts) { + const reasonMsg = reasonMessage(reason); + context.reportError( + new _GraphQLError.GraphQLError( + `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, + { + nodes: fields1.concat(fields2), + }, + ), + ); + } + }, + }; +} + +/** + * Algorithm: + * + * Conflicts occur when two fields exist in a query which will produce the same + * response name, but represent differing values, thus creating a conflict. + * The algorithm below finds all conflicts via making a series of comparisons + * between fields. In order to compare as few fields as possible, this makes + * a series of comparisons "within" sets of fields and "between" sets of fields. + * + * Given any selection set, a collection produces both a set of fields by + * also including all inline fragments, as well as a list of fragments + * referenced by fragment spreads. + * + * A) Each selection set represented in the document first compares "within" its + * collected set of fields, finding any conflicts between every pair of + * overlapping fields. + * Note: This is the *only time* that a the fields "within" a set are compared + * to each other. After this only fields "between" sets are compared. + * + * B) Also, if any fragment is referenced in a selection set, then a + * comparison is made "between" the original set of fields and the + * referenced fragment. + * + * C) Also, if multiple fragments are referenced, then comparisons + * are made "between" each referenced fragment. + * + * D) When comparing "between" a set of fields and a referenced fragment, first + * a comparison is made between each field in the original set of fields and + * each field in the the referenced set of fields. + * + * E) Also, if any fragment is referenced in the referenced selection set, + * then a comparison is made "between" the original set of fields and the + * referenced fragment (recursively referring to step D). + * + * F) When comparing "between" two fragments, first a comparison is made between + * each field in the first referenced set of fields and each field in the the + * second referenced set of fields. + * + * G) Also, any fragments referenced by the first must be compared to the + * second, and any fragments referenced by the second must be compared to the + * first (recursively referring to step F). + * + * H) When comparing two fields, if both have selection sets, then a comparison + * is made "between" both selection sets, first comparing the set of fields in + * the first selection set with the set of fields in the second. + * + * I) Also, if any fragment is referenced in either selection set, then a + * comparison is made "between" the other set of fields and the + * referenced fragment. + * + * J) Also, if two fragments are referenced in both selection sets, then a + * comparison is made "between" the two fragments. + * + */ +// Find all conflicts found "within" a selection set, including those found +// via spreading in fragments. Called when visiting each SelectionSet in the +// GraphQL Document. +function findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentType, + selectionSet, +) { + const conflicts = []; + const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, + ); // (A) Find find all conflicts "within" the fields of this selection set. + // Note: this is the *only place* `collectConflictsWithin` is called. + + collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, + ); + + if (fragmentNames.length !== 0) { + // (B) Then collect conflicts between these fields and those represented by + // each spread fragment name found. + for (let i = 0; i < fragmentNames.length; i++) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fieldMap, + fragmentNames[i], + ); // (C) Then compare this fragment with all other fragments found in this + // selection set to collect conflicts between fragments spread together. + // This compares each item in the list of fragment names to every other + // item in that same list (except for itself). + + for (let j = i + 1; j < fragmentNames.length; j++) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fragmentNames[i], + fragmentNames[j], + ); + } + } + } + + return conflicts; +} // Collect all conflicts found between a set of fields and a fragment reference +// including via spreading in any nested fragments. + +function collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fragmentName, +) { + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + return; + } + + const [fieldMap2, referencedFragmentNames] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, + ); // Do not compare a fragment's fieldMap to itself. + + if (fieldMap === fieldMap2) { + return; + } // (D) First collect any conflicts between the provided collection of fields + // and the collection of fields represented by the given fragment. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fieldMap2, + ); // (E) Then collect any conflicts between the provided collection of fields + // and any fragment names found in the given fragment. + + for (const referencedFragmentName of referencedFragmentNames) { + // Memoize so two fragments are not compared for conflicts more than once. + if ( + comparedFragmentPairs.has( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ) + ) { + continue; + } + + comparedFragmentPairs.add( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ); + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + referencedFragmentName, + ); + } +} // Collect all conflicts found between two fragments, including via spreading in +// any nested fragments. + +function collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, +) { + // No need to compare a fragment to itself. + if (fragmentName1 === fragmentName2) { + return; + } // Memoize so two fragments are not compared for conflicts more than once. + + if ( + comparedFragmentPairs.has( + fragmentName1, + fragmentName2, + areMutuallyExclusive, + ) + ) { + return; + } + + comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); + const fragment1 = context.getFragment(fragmentName1); + const fragment2 = context.getFragment(fragmentName2); + + if (!fragment1 || !fragment2) { + return; + } + + const [fieldMap1, referencedFragmentNames1] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment1, + ); + const [fieldMap2, referencedFragmentNames2] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment2, + ); // (F) First, collect all conflicts between these two collections of fields + // (not including any nested fragments). + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (G) Then collect conflicts between the first fragment and any nested + // fragments spread in the second fragment. + + for (const referencedFragmentName2 of referencedFragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + referencedFragmentName2, + ); + } // (G) Then collect conflicts between the second fragment and any nested + // fragments spread in the first fragment. + + for (const referencedFragmentName1 of referencedFragmentNames1) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + referencedFragmentName1, + fragmentName2, + ); + } +} // Find all conflicts found between two selection sets, including those found +// via spreading in fragments. Called when determining if conflicts exist +// between the sub-fields of two overlapping fields. + +function findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + parentType1, + selectionSet1, + parentType2, + selectionSet2, +) { + const conflicts = []; + const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType1, + selectionSet1, + ); + const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType2, + selectionSet2, + ); // (H) First, collect all conflicts between these two collections of field. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (I) Then collect conflicts between the first collection of fields and + // those referenced by each fragment name associated with the second. + + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fragmentName2, + ); + } // (I) Then collect conflicts between the second collection of fields and + // those referenced by each fragment name associated with the first. + + for (const fragmentName1 of fragmentNames1) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap2, + fragmentName1, + ); + } // (J) Also collect conflicts between any fragment names by the first and + // fragment names by the second. This compares each item in the first set of + // names to each item in the second set of names. + + for (const fragmentName1 of fragmentNames1) { + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, + ); + } + } + + return conflicts; +} // Collect all Conflicts "within" one collection of fields. + +function collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For every response name, if there are multiple fields, they + // must be compared to find a potential conflict. + for (const [responseName, fields] of Object.entries(fieldMap)) { + // This compares every field in the list to every other field in this list + // (except to itself). If the list only has one item, nothing needs to + // be compared. + if (fields.length > 1) { + for (let i = 0; i < fields.length; i++) { + for (let j = i + 1; j < fields.length; j++) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, // within one collection is never mutually exclusive + responseName, + fields[i], + fields[j], + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Collect all Conflicts between two collections of fields. This is similar to, +// but different from the `collectConflictsWithin` function above. This check +// assumes that `collectConflictsWithin` has already been called on each +// provided collection of fields. This is true because this validator traverses +// each individual selection set. + +function collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + fieldMap1, + fieldMap2, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For any response name which appears in both provided field + // maps, each field from the first field map must be compared to every field + // in the second field map to find potential conflicts. + for (const [responseName, fields1] of Object.entries(fieldMap1)) { + const fields2 = fieldMap2[responseName]; + + if (fields2) { + for (const field1 of fields1) { + for (const field2 of fields2) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Determines if there is a conflict between two particular fields, including +// comparing their sub-fields. + +function findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, +) { + const [parentType1, node1, def1] = field1; + const [parentType2, node2, def2] = field2; // If it is known that two fields could not possibly apply at the same + // time, due to the parent types, then it is safe to permit them to diverge + // in aliased field or arguments used as they will not present any ambiguity + // by differing. + // It is known that two parent types could never overlap if they are + // different Object types. Interface or Union types might overlap - if not + // in the current state of the schema, then perhaps in some future version, + // thus may not safely diverge. + + const areMutuallyExclusive = + parentFieldsAreMutuallyExclusive || + (parentType1 !== parentType2 && + (0, _definition.isObjectType)(parentType1) && + (0, _definition.isObjectType)(parentType2)); + + if (!areMutuallyExclusive) { + // Two aliases must refer to the same field. + const name1 = node1.name.value; + const name2 = node2.name.value; + + if (name1 !== name2) { + return [ + [responseName, `"${name1}" and "${name2}" are different fields`], + [node1], + [node2], + ]; + } // Two field calls must have the same arguments. + + if (!sameArguments(node1, node2)) { + return [ + [responseName, 'they have differing arguments'], + [node1], + [node2], + ]; + } + } // The return type for each field. + + const type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; + const type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; + + if (type1 && type2 && doTypesConflict(type1, type2)) { + return [ + [ + responseName, + `they return conflicting types "${(0, _inspect.inspect)( + type1, + )}" and "${(0, _inspect.inspect)(type2)}"`, + ], + [node1], + [node2], + ]; + } // Collect and compare sub-fields. Use the same "visited fragment names" list + // for both collections so fields in a fragment reference are never + // compared to themselves. + + const selectionSet1 = node1.selectionSet; + const selectionSet2 = node2.selectionSet; + + if (selectionSet1 && selectionSet2) { + const conflicts = findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + (0, _definition.getNamedType)(type1), + selectionSet1, + (0, _definition.getNamedType)(type2), + selectionSet2, + ); + return subfieldConflicts(conflicts, responseName, node1, node2); + } +} + +function sameArguments(node1, node2) { + const args1 = node1.arguments; + const args2 = node2.arguments; + + if (args1 === undefined || args1.length === 0) { + return args2 === undefined || args2.length === 0; + } + + if (args2 === undefined || args2.length === 0) { + return false; + } + /* c8 ignore next */ + + if (args1.length !== args2.length) { + /* c8 ignore next */ + return false; + /* c8 ignore next */ + } + + const values2 = new Map(args2.map(({ name, value }) => [name.value, value])); + return args1.every((arg1) => { + const value1 = arg1.value; + const value2 = values2.get(arg1.name.value); + + if (value2 === undefined) { + return false; + } + + return stringifyValue(value1) === stringifyValue(value2); + }); +} + +function stringifyValue(value) { + return (0, _printer.print)((0, _sortValueNode.sortValueNode)(value)); +} // Two types conflict if both types could not apply to a value simultaneously. +// Composite types are ignored as their individual field types will be compared +// later recursively. However List and Non-Null types must match. + +function doTypesConflict(type1, type2) { + if ((0, _definition.isListType)(type1)) { + return (0, _definition.isListType)(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if ((0, _definition.isListType)(type2)) { + return true; + } + + if ((0, _definition.isNonNullType)(type1)) { + return (0, _definition.isNonNullType)(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if ((0, _definition.isNonNullType)(type2)) { + return true; + } + + if ( + (0, _definition.isLeafType)(type1) || + (0, _definition.isLeafType)(type2) + ) { + return type1 !== type2; + } + + return false; +} // Given a selection set, return the collection of fields (a mapping of response +// name to field nodes and definitions) as well as a list of fragment names +// referenced via fragment spreads. + +function getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, +) { + const cached = cachedFieldsAndFragmentNames.get(selectionSet); + + if (cached) { + return cached; + } + + const nodeAndDefs = Object.create(null); + const fragmentNames = Object.create(null); + + _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, + ); + + const result = [nodeAndDefs, Object.keys(fragmentNames)]; + cachedFieldsAndFragmentNames.set(selectionSet, result); + return result; +} // Given a reference to a fragment, return the represented collection of fields +// as well as a list of nested fragment names referenced via fragment spreads. + +function getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, +) { + // Short-circuit building a type from the node if possible. + const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); + + if (cached) { + return cached; + } + + const fragmentType = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + fragment.typeCondition, + ); + return getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragmentType, + fragment.selectionSet, + ); +} + +function _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case _kinds.Kind.FIELD: { + const fieldName = selection.name.value; + let fieldDef; + + if ( + (0, _definition.isObjectType)(parentType) || + (0, _definition.isInterfaceType)(parentType) + ) { + fieldDef = parentType.getFields()[fieldName]; + } + + const responseName = selection.alias + ? selection.alias.value + : fieldName; + + if (!nodeAndDefs[responseName]) { + nodeAndDefs[responseName] = []; + } + + nodeAndDefs[responseName].push([parentType, selection, fieldDef]); + break; + } + + case _kinds.Kind.FRAGMENT_SPREAD: + fragmentNames[selection.name.value] = true; + break; + + case _kinds.Kind.INLINE_FRAGMENT: { + const typeCondition = selection.typeCondition; + const inlineFragmentType = typeCondition + ? (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition) + : parentType; + + _collectFieldsAndFragmentNames( + context, + inlineFragmentType, + selection.selectionSet, + nodeAndDefs, + fragmentNames, + ); + + break; + } + } + } +} // Given a series of Conflicts which occurred between two sub-fields, generate +// a single Conflict. + +function subfieldConflicts(conflicts, responseName, node1, node2) { + if (conflicts.length > 0) { + return [ + [responseName, conflicts.map(([reason]) => reason)], + [node1, ...conflicts.map(([, fields1]) => fields1).flat()], + [node2, ...conflicts.map(([, , fields2]) => fields2).flat()], + ]; + } +} +/** + * A way to keep track of pairs of things when the ordering of the pair does not matter. + */ + +class PairSet { + constructor() { + this._data = new Map(); + } + + has(a, b, areMutuallyExclusive) { + var _this$_data$get; + + const [key1, key2] = a < b ? [a, b] : [b, a]; + const result = + (_this$_data$get = this._data.get(key1)) === null || + _this$_data$get === void 0 + ? void 0 + : _this$_data$get.get(key2); + + if (result === undefined) { + return false; + } // areMutuallyExclusive being false is a superset of being true, hence if + // we want to know if this PairSet "has" these two with no exclusivity, + // we have to ensure it was added as such. + + return areMutuallyExclusive ? true : areMutuallyExclusive === result; + } + + add(a, b, areMutuallyExclusive) { + const [key1, key2] = a < b ? [a, b] : [b, a]; + + const map = this._data.get(key1); + + if (map === undefined) { + this._data.set(key1, new Map([[key2, areMutuallyExclusive]])); + } else { + map.set(key2, areMutuallyExclusive); + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs new file mode 100644 index 0000000..0360344 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs @@ -0,0 +1,805 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { print } from '../../language/printer.mjs'; +import { + getNamedType, + isInterfaceType, + isLeafType, + isListType, + isNonNullType, + isObjectType, +} from '../../type/definition.mjs'; +import { sortValueNode } from '../../utilities/sortValueNode.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +function reasonMessage(reason) { + if (Array.isArray(reason)) { + return reason + .map( + ([responseName, subReason]) => + `subfields "${responseName}" conflict because ` + + reasonMessage(subReason), + ) + .join(' and '); + } + + return reason; +} +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + */ + +export function OverlappingFieldsCanBeMergedRule(context) { + // A memoization for when two fragments are compared "between" each other for + // conflicts. Two fragments may be compared many times, so memoizing this can + // dramatically improve the performance of this validator. + const comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given + // selection set. Selection sets may be asked for this information multiple + // times, so this improves the performance of this validator. + + const cachedFieldsAndFragmentNames = new Map(); + return { + SelectionSet(selectionSet) { + const conflicts = findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + context.getParentType(), + selectionSet, + ); + + for (const [[responseName, reason], fields1, fields2] of conflicts) { + const reasonMsg = reasonMessage(reason); + context.reportError( + new GraphQLError( + `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, + { + nodes: fields1.concat(fields2), + }, + ), + ); + } + }, + }; +} + +/** + * Algorithm: + * + * Conflicts occur when two fields exist in a query which will produce the same + * response name, but represent differing values, thus creating a conflict. + * The algorithm below finds all conflicts via making a series of comparisons + * between fields. In order to compare as few fields as possible, this makes + * a series of comparisons "within" sets of fields and "between" sets of fields. + * + * Given any selection set, a collection produces both a set of fields by + * also including all inline fragments, as well as a list of fragments + * referenced by fragment spreads. + * + * A) Each selection set represented in the document first compares "within" its + * collected set of fields, finding any conflicts between every pair of + * overlapping fields. + * Note: This is the *only time* that a the fields "within" a set are compared + * to each other. After this only fields "between" sets are compared. + * + * B) Also, if any fragment is referenced in a selection set, then a + * comparison is made "between" the original set of fields and the + * referenced fragment. + * + * C) Also, if multiple fragments are referenced, then comparisons + * are made "between" each referenced fragment. + * + * D) When comparing "between" a set of fields and a referenced fragment, first + * a comparison is made between each field in the original set of fields and + * each field in the the referenced set of fields. + * + * E) Also, if any fragment is referenced in the referenced selection set, + * then a comparison is made "between" the original set of fields and the + * referenced fragment (recursively referring to step D). + * + * F) When comparing "between" two fragments, first a comparison is made between + * each field in the first referenced set of fields and each field in the the + * second referenced set of fields. + * + * G) Also, any fragments referenced by the first must be compared to the + * second, and any fragments referenced by the second must be compared to the + * first (recursively referring to step F). + * + * H) When comparing two fields, if both have selection sets, then a comparison + * is made "between" both selection sets, first comparing the set of fields in + * the first selection set with the set of fields in the second. + * + * I) Also, if any fragment is referenced in either selection set, then a + * comparison is made "between" the other set of fields and the + * referenced fragment. + * + * J) Also, if two fragments are referenced in both selection sets, then a + * comparison is made "between" the two fragments. + * + */ +// Find all conflicts found "within" a selection set, including those found +// via spreading in fragments. Called when visiting each SelectionSet in the +// GraphQL Document. +function findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentType, + selectionSet, +) { + const conflicts = []; + const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, + ); // (A) Find find all conflicts "within" the fields of this selection set. + // Note: this is the *only place* `collectConflictsWithin` is called. + + collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, + ); + + if (fragmentNames.length !== 0) { + // (B) Then collect conflicts between these fields and those represented by + // each spread fragment name found. + for (let i = 0; i < fragmentNames.length; i++) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fieldMap, + fragmentNames[i], + ); // (C) Then compare this fragment with all other fragments found in this + // selection set to collect conflicts between fragments spread together. + // This compares each item in the list of fragment names to every other + // item in that same list (except for itself). + + for (let j = i + 1; j < fragmentNames.length; j++) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fragmentNames[i], + fragmentNames[j], + ); + } + } + } + + return conflicts; +} // Collect all conflicts found between a set of fields and a fragment reference +// including via spreading in any nested fragments. + +function collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fragmentName, +) { + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + return; + } + + const [fieldMap2, referencedFragmentNames] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, + ); // Do not compare a fragment's fieldMap to itself. + + if (fieldMap === fieldMap2) { + return; + } // (D) First collect any conflicts between the provided collection of fields + // and the collection of fields represented by the given fragment. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fieldMap2, + ); // (E) Then collect any conflicts between the provided collection of fields + // and any fragment names found in the given fragment. + + for (const referencedFragmentName of referencedFragmentNames) { + // Memoize so two fragments are not compared for conflicts more than once. + if ( + comparedFragmentPairs.has( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ) + ) { + continue; + } + + comparedFragmentPairs.add( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ); + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + referencedFragmentName, + ); + } +} // Collect all conflicts found between two fragments, including via spreading in +// any nested fragments. + +function collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, +) { + // No need to compare a fragment to itself. + if (fragmentName1 === fragmentName2) { + return; + } // Memoize so two fragments are not compared for conflicts more than once. + + if ( + comparedFragmentPairs.has( + fragmentName1, + fragmentName2, + areMutuallyExclusive, + ) + ) { + return; + } + + comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); + const fragment1 = context.getFragment(fragmentName1); + const fragment2 = context.getFragment(fragmentName2); + + if (!fragment1 || !fragment2) { + return; + } + + const [fieldMap1, referencedFragmentNames1] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment1, + ); + const [fieldMap2, referencedFragmentNames2] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment2, + ); // (F) First, collect all conflicts between these two collections of fields + // (not including any nested fragments). + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (G) Then collect conflicts between the first fragment and any nested + // fragments spread in the second fragment. + + for (const referencedFragmentName2 of referencedFragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + referencedFragmentName2, + ); + } // (G) Then collect conflicts between the second fragment and any nested + // fragments spread in the first fragment. + + for (const referencedFragmentName1 of referencedFragmentNames1) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + referencedFragmentName1, + fragmentName2, + ); + } +} // Find all conflicts found between two selection sets, including those found +// via spreading in fragments. Called when determining if conflicts exist +// between the sub-fields of two overlapping fields. + +function findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + parentType1, + selectionSet1, + parentType2, + selectionSet2, +) { + const conflicts = []; + const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType1, + selectionSet1, + ); + const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType2, + selectionSet2, + ); // (H) First, collect all conflicts between these two collections of field. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (I) Then collect conflicts between the first collection of fields and + // those referenced by each fragment name associated with the second. + + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fragmentName2, + ); + } // (I) Then collect conflicts between the second collection of fields and + // those referenced by each fragment name associated with the first. + + for (const fragmentName1 of fragmentNames1) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap2, + fragmentName1, + ); + } // (J) Also collect conflicts between any fragment names by the first and + // fragment names by the second. This compares each item in the first set of + // names to each item in the second set of names. + + for (const fragmentName1 of fragmentNames1) { + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, + ); + } + } + + return conflicts; +} // Collect all Conflicts "within" one collection of fields. + +function collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For every response name, if there are multiple fields, they + // must be compared to find a potential conflict. + for (const [responseName, fields] of Object.entries(fieldMap)) { + // This compares every field in the list to every other field in this list + // (except to itself). If the list only has one item, nothing needs to + // be compared. + if (fields.length > 1) { + for (let i = 0; i < fields.length; i++) { + for (let j = i + 1; j < fields.length; j++) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, // within one collection is never mutually exclusive + responseName, + fields[i], + fields[j], + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Collect all Conflicts between two collections of fields. This is similar to, +// but different from the `collectConflictsWithin` function above. This check +// assumes that `collectConflictsWithin` has already been called on each +// provided collection of fields. This is true because this validator traverses +// each individual selection set. + +function collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + fieldMap1, + fieldMap2, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For any response name which appears in both provided field + // maps, each field from the first field map must be compared to every field + // in the second field map to find potential conflicts. + for (const [responseName, fields1] of Object.entries(fieldMap1)) { + const fields2 = fieldMap2[responseName]; + + if (fields2) { + for (const field1 of fields1) { + for (const field2 of fields2) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Determines if there is a conflict between two particular fields, including +// comparing their sub-fields. + +function findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, +) { + const [parentType1, node1, def1] = field1; + const [parentType2, node2, def2] = field2; // If it is known that two fields could not possibly apply at the same + // time, due to the parent types, then it is safe to permit them to diverge + // in aliased field or arguments used as they will not present any ambiguity + // by differing. + // It is known that two parent types could never overlap if they are + // different Object types. Interface or Union types might overlap - if not + // in the current state of the schema, then perhaps in some future version, + // thus may not safely diverge. + + const areMutuallyExclusive = + parentFieldsAreMutuallyExclusive || + (parentType1 !== parentType2 && + isObjectType(parentType1) && + isObjectType(parentType2)); + + if (!areMutuallyExclusive) { + // Two aliases must refer to the same field. + const name1 = node1.name.value; + const name2 = node2.name.value; + + if (name1 !== name2) { + return [ + [responseName, `"${name1}" and "${name2}" are different fields`], + [node1], + [node2], + ]; + } // Two field calls must have the same arguments. + + if (!sameArguments(node1, node2)) { + return [ + [responseName, 'they have differing arguments'], + [node1], + [node2], + ]; + } + } // The return type for each field. + + const type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; + const type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; + + if (type1 && type2 && doTypesConflict(type1, type2)) { + return [ + [ + responseName, + `they return conflicting types "${inspect(type1)}" and "${inspect( + type2, + )}"`, + ], + [node1], + [node2], + ]; + } // Collect and compare sub-fields. Use the same "visited fragment names" list + // for both collections so fields in a fragment reference are never + // compared to themselves. + + const selectionSet1 = node1.selectionSet; + const selectionSet2 = node2.selectionSet; + + if (selectionSet1 && selectionSet2) { + const conflicts = findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + getNamedType(type1), + selectionSet1, + getNamedType(type2), + selectionSet2, + ); + return subfieldConflicts(conflicts, responseName, node1, node2); + } +} + +function sameArguments(node1, node2) { + const args1 = node1.arguments; + const args2 = node2.arguments; + + if (args1 === undefined || args1.length === 0) { + return args2 === undefined || args2.length === 0; + } + + if (args2 === undefined || args2.length === 0) { + return false; + } + /* c8 ignore next */ + + if (args1.length !== args2.length) { + /* c8 ignore next */ + return false; + /* c8 ignore next */ + } + + const values2 = new Map(args2.map(({ name, value }) => [name.value, value])); + return args1.every((arg1) => { + const value1 = arg1.value; + const value2 = values2.get(arg1.name.value); + + if (value2 === undefined) { + return false; + } + + return stringifyValue(value1) === stringifyValue(value2); + }); +} + +function stringifyValue(value) { + return print(sortValueNode(value)); +} // Two types conflict if both types could not apply to a value simultaneously. +// Composite types are ignored as their individual field types will be compared +// later recursively. However List and Non-Null types must match. + +function doTypesConflict(type1, type2) { + if (isListType(type1)) { + return isListType(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if (isListType(type2)) { + return true; + } + + if (isNonNullType(type1)) { + return isNonNullType(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if (isNonNullType(type2)) { + return true; + } + + if (isLeafType(type1) || isLeafType(type2)) { + return type1 !== type2; + } + + return false; +} // Given a selection set, return the collection of fields (a mapping of response +// name to field nodes and definitions) as well as a list of fragment names +// referenced via fragment spreads. + +function getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, +) { + const cached = cachedFieldsAndFragmentNames.get(selectionSet); + + if (cached) { + return cached; + } + + const nodeAndDefs = Object.create(null); + const fragmentNames = Object.create(null); + + _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, + ); + + const result = [nodeAndDefs, Object.keys(fragmentNames)]; + cachedFieldsAndFragmentNames.set(selectionSet, result); + return result; +} // Given a reference to a fragment, return the represented collection of fields +// as well as a list of nested fragment names referenced via fragment spreads. + +function getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, +) { + // Short-circuit building a type from the node if possible. + const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); + + if (cached) { + return cached; + } + + const fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); + return getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragmentType, + fragment.selectionSet, + ); +} + +function _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case Kind.FIELD: { + const fieldName = selection.name.value; + let fieldDef; + + if (isObjectType(parentType) || isInterfaceType(parentType)) { + fieldDef = parentType.getFields()[fieldName]; + } + + const responseName = selection.alias + ? selection.alias.value + : fieldName; + + if (!nodeAndDefs[responseName]) { + nodeAndDefs[responseName] = []; + } + + nodeAndDefs[responseName].push([parentType, selection, fieldDef]); + break; + } + + case Kind.FRAGMENT_SPREAD: + fragmentNames[selection.name.value] = true; + break; + + case Kind.INLINE_FRAGMENT: { + const typeCondition = selection.typeCondition; + const inlineFragmentType = typeCondition + ? typeFromAST(context.getSchema(), typeCondition) + : parentType; + + _collectFieldsAndFragmentNames( + context, + inlineFragmentType, + selection.selectionSet, + nodeAndDefs, + fragmentNames, + ); + + break; + } + } + } +} // Given a series of Conflicts which occurred between two sub-fields, generate +// a single Conflict. + +function subfieldConflicts(conflicts, responseName, node1, node2) { + if (conflicts.length > 0) { + return [ + [responseName, conflicts.map(([reason]) => reason)], + [node1, ...conflicts.map(([, fields1]) => fields1).flat()], + [node2, ...conflicts.map(([, , fields2]) => fields2).flat()], + ]; + } +} +/** + * A way to keep track of pairs of things when the ordering of the pair does not matter. + */ + +class PairSet { + constructor() { + this._data = new Map(); + } + + has(a, b, areMutuallyExclusive) { + var _this$_data$get; + + const [key1, key2] = a < b ? [a, b] : [b, a]; + const result = + (_this$_data$get = this._data.get(key1)) === null || + _this$_data$get === void 0 + ? void 0 + : _this$_data$get.get(key2); + + if (result === undefined) { + return false; + } // areMutuallyExclusive being false is a superset of being true, hence if + // we want to know if this PairSet "has" these two with no exclusivity, + // we have to ensure it was added as such. + + return areMutuallyExclusive ? true : areMutuallyExclusive === result; + } + + add(a, b, areMutuallyExclusive) { + const [key1, key2] = a < b ? [a, b] : [b, a]; + + const map = this._data.get(key1); + + if (map === undefined) { + this._data.set(key1, new Map([[key2, areMutuallyExclusive]])); + } else { + map.set(key2, areMutuallyExclusive); + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts new file mode 100644 index 0000000..e17ff56 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +export declare function PossibleFragmentSpreadsRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js new file mode 100644 index 0000000..104e805 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js @@ -0,0 +1,95 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.PossibleFragmentSpreadsRule = PossibleFragmentSpreadsRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +var _typeComparators = require('../../utilities/typeComparators.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +function PossibleFragmentSpreadsRule(context) { + return { + InlineFragment(node) { + const fragType = context.getType(); + const parentType = context.getParentType(); + + if ( + (0, _definition.isCompositeType)(fragType) && + (0, _definition.isCompositeType)(parentType) && + !(0, _typeComparators.doTypesOverlap)( + context.getSchema(), + fragType, + parentType, + ) + ) { + const parentTypeStr = (0, _inspect.inspect)(parentType); + const fragTypeStr = (0, _inspect.inspect)(fragType); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + + FragmentSpread(node) { + const fragName = node.name.value; + const fragType = getFragmentType(context, fragName); + const parentType = context.getParentType(); + + if ( + fragType && + parentType && + !(0, _typeComparators.doTypesOverlap)( + context.getSchema(), + fragType, + parentType, + ) + ) { + const parentTypeStr = (0, _inspect.inspect)(parentType); + const fragTypeStr = (0, _inspect.inspect)(fragType); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getFragmentType(context, name) { + const frag = context.getFragment(name); + + if (frag) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + frag.typeCondition, + ); + + if ((0, _definition.isCompositeType)(type)) { + return type; + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs new file mode 100644 index 0000000..f1f8711 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs @@ -0,0 +1,73 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { isCompositeType } from '../../type/definition.mjs'; +import { doTypesOverlap } from '../../utilities/typeComparators.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +export function PossibleFragmentSpreadsRule(context) { + return { + InlineFragment(node) { + const fragType = context.getType(); + const parentType = context.getParentType(); + + if ( + isCompositeType(fragType) && + isCompositeType(parentType) && + !doTypesOverlap(context.getSchema(), fragType, parentType) + ) { + const parentTypeStr = inspect(parentType); + const fragTypeStr = inspect(fragType); + context.reportError( + new GraphQLError( + `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + + FragmentSpread(node) { + const fragName = node.name.value; + const fragType = getFragmentType(context, fragName); + const parentType = context.getParentType(); + + if ( + fragType && + parentType && + !doTypesOverlap(context.getSchema(), fragType, parentType) + ) { + const parentTypeStr = inspect(parentType); + const fragTypeStr = inspect(fragType); + context.reportError( + new GraphQLError( + `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getFragmentType(context, name) { + const frag = context.getFragment(name); + + if (frag) { + const type = typeFromAST(context.getSchema(), frag.typeCondition); + + if (isCompositeType(type)) { + return type; + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts new file mode 100644 index 0000000..7671b93 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +export declare function PossibleTypeExtensionsRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js new file mode 100644 index 0000000..d55b4e1 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js @@ -0,0 +1,171 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.PossibleTypeExtensionsRule = PossibleTypeExtensionsRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _inspect = require('../../jsutils/inspect.js'); + +var _invariant = require('../../jsutils/invariant.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _predicates = require('../../language/predicates.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +function PossibleTypeExtensionsRule(context) { + const schema = context.getSchema(); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if ((0, _predicates.isTypeDefinitionNode)(def)) { + definedTypes[def.name.value] = def; + } + } + + return { + ScalarTypeExtension: checkExtension, + ObjectTypeExtension: checkExtension, + InterfaceTypeExtension: checkExtension, + UnionTypeExtension: checkExtension, + EnumTypeExtension: checkExtension, + InputObjectTypeExtension: checkExtension, + }; + + function checkExtension(node) { + const typeName = node.name.value; + const defNode = definedTypes[typeName]; + const existingType = + schema === null || schema === void 0 ? void 0 : schema.getType(typeName); + let expectedKind; + + if (defNode) { + expectedKind = defKindToExtKind[defNode.kind]; + } else if (existingType) { + expectedKind = typeToExtKind(existingType); + } + + if (expectedKind) { + if (expectedKind !== node.kind) { + const kindStr = extensionKindToTypeName(node.kind); + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot extend non-${kindStr} type "${typeName}".`, + { + nodes: defNode ? [defNode, node] : node, + }, + ), + ); + } + } else { + const allTypeNames = Object.keys({ + ...definedTypes, + ...(schema === null || schema === void 0 + ? void 0 + : schema.getTypeMap()), + }); + const suggestedTypes = (0, _suggestionList.suggestionList)( + typeName, + allTypeNames, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot extend type "${typeName}" because it is not defined.` + + (0, _didYouMean.didYouMean)(suggestedTypes), + { + nodes: node.name, + }, + ), + ); + } + } +} + +const defKindToExtKind = { + [_kinds.Kind.SCALAR_TYPE_DEFINITION]: _kinds.Kind.SCALAR_TYPE_EXTENSION, + [_kinds.Kind.OBJECT_TYPE_DEFINITION]: _kinds.Kind.OBJECT_TYPE_EXTENSION, + [_kinds.Kind.INTERFACE_TYPE_DEFINITION]: _kinds.Kind.INTERFACE_TYPE_EXTENSION, + [_kinds.Kind.UNION_TYPE_DEFINITION]: _kinds.Kind.UNION_TYPE_EXTENSION, + [_kinds.Kind.ENUM_TYPE_DEFINITION]: _kinds.Kind.ENUM_TYPE_EXTENSION, + [_kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION]: + _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, +}; + +function typeToExtKind(type) { + if ((0, _definition.isScalarType)(type)) { + return _kinds.Kind.SCALAR_TYPE_EXTENSION; + } + + if ((0, _definition.isObjectType)(type)) { + return _kinds.Kind.OBJECT_TYPE_EXTENSION; + } + + if ((0, _definition.isInterfaceType)(type)) { + return _kinds.Kind.INTERFACE_TYPE_EXTENSION; + } + + if ((0, _definition.isUnionType)(type)) { + return _kinds.Kind.UNION_TYPE_EXTENSION; + } + + if ((0, _definition.isEnumType)(type)) { + return _kinds.Kind.ENUM_TYPE_EXTENSION; + } + + if ((0, _definition.isInputObjectType)(type)) { + return _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION; + } + /* c8 ignore next 3 */ + // Not reachable. All possible types have been considered + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); +} + +function extensionKindToTypeName(kind) { + switch (kind) { + case _kinds.Kind.SCALAR_TYPE_EXTENSION: + return 'scalar'; + + case _kinds.Kind.OBJECT_TYPE_EXTENSION: + return 'object'; + + case _kinds.Kind.INTERFACE_TYPE_EXTENSION: + return 'interface'; + + case _kinds.Kind.UNION_TYPE_EXTENSION: + return 'union'; + + case _kinds.Kind.ENUM_TYPE_EXTENSION: + return 'enum'; + + case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: + return 'input object'; + // Not reachable. All possible types have been considered + + /* c8 ignore next */ + + default: + false || + (0, _invariant.invariant)( + false, + 'Unexpected kind: ' + (0, _inspect.inspect)(kind), + ); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs new file mode 100644 index 0000000..a0a05fa --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs @@ -0,0 +1,148 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { inspect } from '../../jsutils/inspect.mjs'; +import { invariant } from '../../jsutils/invariant.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { isTypeDefinitionNode } from '../../language/predicates.mjs'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isObjectType, + isScalarType, + isUnionType, +} from '../../type/definition.mjs'; + +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +export function PossibleTypeExtensionsRule(context) { + const schema = context.getSchema(); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if (isTypeDefinitionNode(def)) { + definedTypes[def.name.value] = def; + } + } + + return { + ScalarTypeExtension: checkExtension, + ObjectTypeExtension: checkExtension, + InterfaceTypeExtension: checkExtension, + UnionTypeExtension: checkExtension, + EnumTypeExtension: checkExtension, + InputObjectTypeExtension: checkExtension, + }; + + function checkExtension(node) { + const typeName = node.name.value; + const defNode = definedTypes[typeName]; + const existingType = + schema === null || schema === void 0 ? void 0 : schema.getType(typeName); + let expectedKind; + + if (defNode) { + expectedKind = defKindToExtKind[defNode.kind]; + } else if (existingType) { + expectedKind = typeToExtKind(existingType); + } + + if (expectedKind) { + if (expectedKind !== node.kind) { + const kindStr = extensionKindToTypeName(node.kind); + context.reportError( + new GraphQLError(`Cannot extend non-${kindStr} type "${typeName}".`, { + nodes: defNode ? [defNode, node] : node, + }), + ); + } + } else { + const allTypeNames = Object.keys({ + ...definedTypes, + ...(schema === null || schema === void 0 + ? void 0 + : schema.getTypeMap()), + }); + const suggestedTypes = suggestionList(typeName, allTypeNames); + context.reportError( + new GraphQLError( + `Cannot extend type "${typeName}" because it is not defined.` + + didYouMean(suggestedTypes), + { + nodes: node.name, + }, + ), + ); + } + } +} +const defKindToExtKind = { + [Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION, + [Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION, + [Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION, + [Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION, + [Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION, + [Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION, +}; + +function typeToExtKind(type) { + if (isScalarType(type)) { + return Kind.SCALAR_TYPE_EXTENSION; + } + + if (isObjectType(type)) { + return Kind.OBJECT_TYPE_EXTENSION; + } + + if (isInterfaceType(type)) { + return Kind.INTERFACE_TYPE_EXTENSION; + } + + if (isUnionType(type)) { + return Kind.UNION_TYPE_EXTENSION; + } + + if (isEnumType(type)) { + return Kind.ENUM_TYPE_EXTENSION; + } + + if (isInputObjectType(type)) { + return Kind.INPUT_OBJECT_TYPE_EXTENSION; + } + /* c8 ignore next 3 */ + // Not reachable. All possible types have been considered + + false || invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function extensionKindToTypeName(kind) { + switch (kind) { + case Kind.SCALAR_TYPE_EXTENSION: + return 'scalar'; + + case Kind.OBJECT_TYPE_EXTENSION: + return 'object'; + + case Kind.INTERFACE_TYPE_EXTENSION: + return 'interface'; + + case Kind.UNION_TYPE_EXTENSION: + return 'union'; + + case Kind.ENUM_TYPE_EXTENSION: + return 'enum'; + + case Kind.INPUT_OBJECT_TYPE_EXTENSION: + return 'input object'; + // Not reachable. All possible types have been considered + + /* c8 ignore next */ + + default: + false || invariant(false, 'Unexpected kind: ' + inspect(kind)); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts new file mode 100644 index 0000000..4fbd183 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts @@ -0,0 +1,20 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +export declare function ProvidedRequiredArgumentsRule( + context: ValidationContext, +): ASTVisitor; +/** + * @internal + */ +export declare function ProvidedRequiredArgumentsOnDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js new file mode 100644 index 0000000..c819df0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js @@ -0,0 +1,162 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ProvidedRequiredArgumentsOnDirectivesRule = + ProvidedRequiredArgumentsOnDirectivesRule; +exports.ProvidedRequiredArgumentsRule = ProvidedRequiredArgumentsRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _keyMap = require('../../jsutils/keyMap.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +function ProvidedRequiredArgumentsRule(context) { + return { + // eslint-disable-next-line new-cap + ...ProvidedRequiredArgumentsOnDirectivesRule(context), + Field: { + // Validate on leave to allow for deeper errors to appear first. + leave(fieldNode) { + var _fieldNode$arguments; + + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + return false; + } + + const providedArgs = new Set( // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + (_fieldNode$arguments = fieldNode.arguments) === null || + _fieldNode$arguments === void 0 + ? void 0 + : _fieldNode$arguments.map((arg) => arg.name.value), + ); + + for (const argDef of fieldDef.args) { + if ( + !providedArgs.has(argDef.name) && + (0, _definition.isRequiredArgument)(argDef) + ) { + const argTypeStr = (0, _inspect.inspect)(argDef.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, + { + nodes: fieldNode, + }, + ), + ); + } + } + }, + }, + }; +} +/** + * @internal + */ + +function ProvidedRequiredArgumentsOnDirectivesRule(context) { + var _schema$getDirectives; + + const requiredArgsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = + (_schema$getDirectives = + schema === null || schema === void 0 + ? void 0 + : schema.getDirectives()) !== null && _schema$getDirectives !== void 0 + ? _schema$getDirectives + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + requiredArgsMap[directive.name] = (0, _keyMap.keyMap)( + directive.args.filter(_definition.isRequiredArgument), + (arg) => arg.name, + ); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + requiredArgsMap[def.name.value] = (0, _keyMap.keyMap)( + argNodes.filter(isRequiredArgumentNode), + (arg) => arg.name.value, + ); + } + } + + return { + Directive: { + // Validate on leave to allow for deeper errors to appear first. + leave(directiveNode) { + const directiveName = directiveNode.name.value; + const requiredArgs = requiredArgsMap[directiveName]; + + if (requiredArgs) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + const argNodeMap = new Set(argNodes.map((arg) => arg.name.value)); + + for (const [argName, argDef] of Object.entries(requiredArgs)) { + if (!argNodeMap.has(argName)) { + const argType = (0, _definition.isType)(argDef.type) + ? (0, _inspect.inspect)(argDef.type) + : (0, _printer.print)(argDef.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${directiveName}" argument "${argName}" of type "${argType}" is required, but it was not provided.`, + { + nodes: directiveNode, + }, + ), + ); + } + } + } + }, + }, + }; +} + +function isRequiredArgumentNode(arg) { + return ( + arg.type.kind === _kinds.Kind.NON_NULL_TYPE && arg.defaultValue == null + ); +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs new file mode 100644 index 0000000..c96da13 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs @@ -0,0 +1,142 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { keyMap } from '../../jsutils/keyMap.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { print } from '../../language/printer.mjs'; +import { isRequiredArgument, isType } from '../../type/definition.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +export function ProvidedRequiredArgumentsRule(context) { + return { + // eslint-disable-next-line new-cap + ...ProvidedRequiredArgumentsOnDirectivesRule(context), + Field: { + // Validate on leave to allow for deeper errors to appear first. + leave(fieldNode) { + var _fieldNode$arguments; + + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + return false; + } + + const providedArgs = new Set( // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + (_fieldNode$arguments = fieldNode.arguments) === null || + _fieldNode$arguments === void 0 + ? void 0 + : _fieldNode$arguments.map((arg) => arg.name.value), + ); + + for (const argDef of fieldDef.args) { + if (!providedArgs.has(argDef.name) && isRequiredArgument(argDef)) { + const argTypeStr = inspect(argDef.type); + context.reportError( + new GraphQLError( + `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, + { + nodes: fieldNode, + }, + ), + ); + } + } + }, + }, + }; +} +/** + * @internal + */ + +export function ProvidedRequiredArgumentsOnDirectivesRule(context) { + var _schema$getDirectives; + + const requiredArgsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = + (_schema$getDirectives = + schema === null || schema === void 0 + ? void 0 + : schema.getDirectives()) !== null && _schema$getDirectives !== void 0 + ? _schema$getDirectives + : specifiedDirectives; + + for (const directive of definedDirectives) { + requiredArgsMap[directive.name] = keyMap( + directive.args.filter(isRequiredArgument), + (arg) => arg.name, + ); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + requiredArgsMap[def.name.value] = keyMap( + argNodes.filter(isRequiredArgumentNode), + (arg) => arg.name.value, + ); + } + } + + return { + Directive: { + // Validate on leave to allow for deeper errors to appear first. + leave(directiveNode) { + const directiveName = directiveNode.name.value; + const requiredArgs = requiredArgsMap[directiveName]; + + if (requiredArgs) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + const argNodeMap = new Set(argNodes.map((arg) => arg.name.value)); + + for (const [argName, argDef] of Object.entries(requiredArgs)) { + if (!argNodeMap.has(argName)) { + const argType = isType(argDef.type) + ? inspect(argDef.type) + : print(argDef.type); + context.reportError( + new GraphQLError( + `Directive "@${directiveName}" argument "${argName}" of type "${argType}" is required, but it was not provided.`, + { + nodes: directiveNode, + }, + ), + ); + } + } + } + }, + }, + }; +} + +function isRequiredArgumentNode(arg) { + return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts new file mode 100644 index 0000000..98a3bae --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts @@ -0,0 +1,9 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +export declare function ScalarLeafsRule(context: ValidationContext): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.js new file mode 100644 index 0000000..ed6307c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.js @@ -0,0 +1,55 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ScalarLeafsRule = ScalarLeafsRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +function ScalarLeafsRule(context) { + return { + Field(node) { + const type = context.getType(); + const selectionSet = node.selectionSet; + + if (type) { + if ((0, _definition.isLeafType)((0, _definition.getNamedType)(type))) { + if (selectionSet) { + const fieldName = node.name.value; + const typeStr = (0, _inspect.inspect)(type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, + { + nodes: selectionSet, + }, + ), + ); + } + } else if (!selectionSet) { + const fieldName = node.name.value; + const typeStr = (0, _inspect.inspect)(type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs new file mode 100644 index 0000000..4a2f06d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs @@ -0,0 +1,46 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { getNamedType, isLeafType } from '../../type/definition.mjs'; + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +export function ScalarLeafsRule(context) { + return { + Field(node) { + const type = context.getType(); + const selectionSet = node.selectionSet; + + if (type) { + if (isLeafType(getNamedType(type))) { + if (selectionSet) { + const fieldName = node.name.value; + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, + { + nodes: selectionSet, + }, + ), + ); + } + } else if (!selectionSet) { + const fieldName = node.name.value; + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts new file mode 100644 index 0000000..b57a7ce --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + */ +export declare function SingleFieldSubscriptionsRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js new file mode 100644 index 0000000..1c5cbf6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js @@ -0,0 +1,86 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.SingleFieldSubscriptionsRule = SingleFieldSubscriptionsRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _collectFields = require('../../execution/collectFields.js'); + +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + */ +function SingleFieldSubscriptionsRule(context) { + return { + OperationDefinition(node) { + if (node.operation === 'subscription') { + const schema = context.getSchema(); + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + const operationName = node.name ? node.name.value : null; + const variableValues = Object.create(null); + const document = context.getDocument(); + const fragments = Object.create(null); + + for (const definition of document.definitions) { + if (definition.kind === _kinds.Kind.FRAGMENT_DEFINITION) { + fragments[definition.name.value] = definition; + } + } + + const fields = (0, _collectFields.collectFields)( + schema, + fragments, + variableValues, + subscriptionType, + node.selectionSet, + ); + + if (fields.size > 1) { + const fieldSelectionLists = [...fields.values()]; + const extraFieldSelectionLists = fieldSelectionLists.slice(1); + const extraFieldSelections = extraFieldSelectionLists.flat(); + context.reportError( + new _GraphQLError.GraphQLError( + operationName != null + ? `Subscription "${operationName}" must select only one top level field.` + : 'Anonymous Subscription must select only one top level field.', + { + nodes: extraFieldSelections, + }, + ), + ); + } + + for (const fieldNodes of fields.values()) { + const field = fieldNodes[0]; + const fieldName = field.name.value; + + if (fieldName.startsWith('__')) { + context.reportError( + new _GraphQLError.GraphQLError( + operationName != null + ? `Subscription "${operationName}" must not select an introspection top level field.` + : 'Anonymous Subscription must not select an introspection top level field.', + { + nodes: fieldNodes, + }, + ), + ); + } + } + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs new file mode 100644 index 0000000..869f54d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs @@ -0,0 +1,77 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { collectFields } from '../../execution/collectFields.mjs'; + +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + */ +export function SingleFieldSubscriptionsRule(context) { + return { + OperationDefinition(node) { + if (node.operation === 'subscription') { + const schema = context.getSchema(); + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + const operationName = node.name ? node.name.value : null; + const variableValues = Object.create(null); + const document = context.getDocument(); + const fragments = Object.create(null); + + for (const definition of document.definitions) { + if (definition.kind === Kind.FRAGMENT_DEFINITION) { + fragments[definition.name.value] = definition; + } + } + + const fields = collectFields( + schema, + fragments, + variableValues, + subscriptionType, + node.selectionSet, + ); + + if (fields.size > 1) { + const fieldSelectionLists = [...fields.values()]; + const extraFieldSelectionLists = fieldSelectionLists.slice(1); + const extraFieldSelections = extraFieldSelectionLists.flat(); + context.reportError( + new GraphQLError( + operationName != null + ? `Subscription "${operationName}" must select only one top level field.` + : 'Anonymous Subscription must select only one top level field.', + { + nodes: extraFieldSelections, + }, + ), + ); + } + + for (const fieldNodes of fields.values()) { + const field = fieldNodes[0]; + const fieldName = field.name.value; + + if (fieldName.startsWith('__')) { + context.reportError( + new GraphQLError( + operationName != null + ? `Subscription "${operationName}" must not select an introspection top level field.` + : 'Anonymous Subscription must not select an introspection top level field.', + { + nodes: fieldNodes, + }, + ), + ); + } + } + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts new file mode 100644 index 0000000..f96b754 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts @@ -0,0 +1,11 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + */ +export declare function UniqueArgumentDefinitionNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js new file mode 100644 index 0000000..fe997d4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js @@ -0,0 +1,92 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueArgumentDefinitionNamesRule = UniqueArgumentDefinitionNamesRule; + +var _groupBy = require('../../jsutils/groupBy.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + */ +function UniqueArgumentDefinitionNamesRule(context) { + return { + DirectiveDefinition(directiveNode) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes); + }, + + InterfaceTypeDefinition: checkArgUniquenessPerField, + InterfaceTypeExtension: checkArgUniquenessPerField, + ObjectTypeDefinition: checkArgUniquenessPerField, + ObjectTypeExtension: checkArgUniquenessPerField, + }; + + function checkArgUniquenessPerField(typeNode) { + var _typeNode$fields; + + const typeName = typeNode.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_typeNode$fields = typeNode.fields) !== null && + _typeNode$fields !== void 0 + ? _typeNode$fields + : []; + + for (const fieldDef of fieldNodes) { + var _fieldDef$arguments; + + const fieldName = fieldDef.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_fieldDef$arguments = fieldDef.arguments) !== null && + _fieldDef$arguments !== void 0 + ? _fieldDef$arguments + : []; + checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes); + } + + return false; + } + + function checkArgUniqueness(parentName, argumentNodes) { + const seenArgs = (0, _groupBy.groupBy)( + argumentNodes, + (arg) => arg.name.value, + ); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + `Argument "${parentName}(${argName}:)" can only be defined once.`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs new file mode 100644 index 0000000..416a954 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs @@ -0,0 +1,81 @@ +import { groupBy } from '../../jsutils/groupBy.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + */ +export function UniqueArgumentDefinitionNamesRule(context) { + return { + DirectiveDefinition(directiveNode) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes); + }, + + InterfaceTypeDefinition: checkArgUniquenessPerField, + InterfaceTypeExtension: checkArgUniquenessPerField, + ObjectTypeDefinition: checkArgUniquenessPerField, + ObjectTypeExtension: checkArgUniquenessPerField, + }; + + function checkArgUniquenessPerField(typeNode) { + var _typeNode$fields; + + const typeName = typeNode.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_typeNode$fields = typeNode.fields) !== null && + _typeNode$fields !== void 0 + ? _typeNode$fields + : []; + + for (const fieldDef of fieldNodes) { + var _fieldDef$arguments; + + const fieldName = fieldDef.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_fieldDef$arguments = fieldDef.arguments) !== null && + _fieldDef$arguments !== void 0 + ? _fieldDef$arguments + : []; + checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes); + } + + return false; + } + + function checkArgUniqueness(parentName, argumentNodes) { + const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new GraphQLError( + `Argument "${parentName}(${argName}:)" can only be defined once.`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts new file mode 100644 index 0000000..ac13f8a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + */ +export declare function UniqueArgumentNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js new file mode 100644 index 0000000..9766737 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js @@ -0,0 +1,55 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueArgumentNamesRule = UniqueArgumentNamesRule; + +var _groupBy = require('../../jsutils/groupBy.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + */ +function UniqueArgumentNamesRule(context) { + return { + Field: checkArgUniqueness, + Directive: checkArgUniqueness, + }; + + function checkArgUniqueness(parentNode) { + var _parentNode$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_parentNode$arguments = parentNode.arguments) !== null && + _parentNode$arguments !== void 0 + ? _parentNode$arguments + : []; + const seenArgs = (0, _groupBy.groupBy)( + argumentNodes, + (arg) => arg.name.value, + ); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one argument named "${argName}".`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs new file mode 100644 index 0000000..9f78a66 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs @@ -0,0 +1,44 @@ +import { groupBy } from '../../jsutils/groupBy.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + */ +export function UniqueArgumentNamesRule(context) { + return { + Field: checkArgUniqueness, + Directive: checkArgUniqueness, + }; + + function checkArgUniqueness(parentNode) { + var _parentNode$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_parentNode$arguments = parentNode.arguments) !== null && + _parentNode$arguments !== void 0 + ? _parentNode$arguments + : []; + const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new GraphQLError( + `There can be only one argument named "${argName}".`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts new file mode 100644 index 0000000..1aa35db --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +export declare function UniqueDirectiveNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js new file mode 100644 index 0000000..b02635e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueDirectiveNamesRule = UniqueDirectiveNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +function UniqueDirectiveNamesRule(context) { + const knownDirectiveNames = Object.create(null); + const schema = context.getSchema(); + return { + DirectiveDefinition(node) { + const directiveName = node.name.value; + + if ( + schema !== null && + schema !== void 0 && + schema.getDirective(directiveName) + ) { + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownDirectiveNames[directiveName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one directive named "@${directiveName}".`, + { + nodes: [knownDirectiveNames[directiveName], node.name], + }, + ), + ); + } else { + knownDirectiveNames[directiveName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs new file mode 100644 index 0000000..fe70dc9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs @@ -0,0 +1,47 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +export function UniqueDirectiveNamesRule(context) { + const knownDirectiveNames = Object.create(null); + const schema = context.getSchema(); + return { + DirectiveDefinition(node) { + const directiveName = node.name.value; + + if ( + schema !== null && + schema !== void 0 && + schema.getDirective(directiveName) + ) { + context.reportError( + new GraphQLError( + `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownDirectiveNames[directiveName]) { + context.reportError( + new GraphQLError( + `There can be only one directive named "@${directiveName}".`, + { + nodes: [knownDirectiveNames[directiveName], node.name], + }, + ), + ); + } else { + knownDirectiveNames[directiveName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts new file mode 100644 index 0000000..b6e16a8 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts @@ -0,0 +1,16 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + */ +export declare function UniqueDirectivesPerLocationRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js new file mode 100644 index 0000000..272f761 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js @@ -0,0 +1,95 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueDirectivesPerLocationRule = UniqueDirectivesPerLocationRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _predicates = require('../../language/predicates.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + */ +function UniqueDirectivesPerLocationRule(context) { + const uniqueDirectiveMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + uniqueDirectiveMap[directive.name] = !directive.isRepeatable; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + uniqueDirectiveMap[def.name.value] = !def.repeatable; + } + } + + const schemaDirectives = Object.create(null); + const typeDirectivesMap = Object.create(null); + return { + // Many different AST nodes may contain directives. Rather than listing + // them all, just listen for entering any node, and check to see if it + // defines any directives. + enter(node) { + if (!('directives' in node) || !node.directives) { + return; + } + + let seenDirectives; + + if ( + node.kind === _kinds.Kind.SCHEMA_DEFINITION || + node.kind === _kinds.Kind.SCHEMA_EXTENSION + ) { + seenDirectives = schemaDirectives; + } else if ( + (0, _predicates.isTypeDefinitionNode)(node) || + (0, _predicates.isTypeExtensionNode)(node) + ) { + const typeName = node.name.value; + seenDirectives = typeDirectivesMap[typeName]; + + if (seenDirectives === undefined) { + typeDirectivesMap[typeName] = seenDirectives = Object.create(null); + } + } else { + seenDirectives = Object.create(null); + } + + for (const directive of node.directives) { + const directiveName = directive.name.value; + + if (uniqueDirectiveMap[directiveName]) { + if (seenDirectives[directiveName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `The directive "@${directiveName}" can only be used once at this location.`, + { + nodes: [seenDirectives[directiveName], directive], + }, + ), + ); + } else { + seenDirectives[directiveName] = directive; + } + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs new file mode 100644 index 0000000..efd6abe --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs @@ -0,0 +1,85 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { + isTypeDefinitionNode, + isTypeExtensionNode, +} from '../../language/predicates.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + */ +export function UniqueDirectivesPerLocationRule(context) { + const uniqueDirectiveMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + + for (const directive of definedDirectives) { + uniqueDirectiveMap[directive.name] = !directive.isRepeatable; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + uniqueDirectiveMap[def.name.value] = !def.repeatable; + } + } + + const schemaDirectives = Object.create(null); + const typeDirectivesMap = Object.create(null); + return { + // Many different AST nodes may contain directives. Rather than listing + // them all, just listen for entering any node, and check to see if it + // defines any directives. + enter(node) { + if (!('directives' in node) || !node.directives) { + return; + } + + let seenDirectives; + + if ( + node.kind === Kind.SCHEMA_DEFINITION || + node.kind === Kind.SCHEMA_EXTENSION + ) { + seenDirectives = schemaDirectives; + } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { + const typeName = node.name.value; + seenDirectives = typeDirectivesMap[typeName]; + + if (seenDirectives === undefined) { + typeDirectivesMap[typeName] = seenDirectives = Object.create(null); + } + } else { + seenDirectives = Object.create(null); + } + + for (const directive of node.directives) { + const directiveName = directive.name.value; + + if (uniqueDirectiveMap[directiveName]) { + if (seenDirectives[directiveName]) { + context.reportError( + new GraphQLError( + `The directive "@${directiveName}" can only be used once at this location.`, + { + nodes: [seenDirectives[directiveName], directive], + }, + ), + ); + } else { + seenDirectives[directiveName] = directive; + } + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts new file mode 100644 index 0000000..c15414c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +export declare function UniqueEnumValueNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js new file mode 100644 index 0000000..6dba608 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js @@ -0,0 +1,75 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueEnumValueNamesRule = UniqueEnumValueNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +function UniqueEnumValueNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownValueNames = Object.create(null); + return { + EnumTypeDefinition: checkValueUniqueness, + EnumTypeExtension: checkValueUniqueness, + }; + + function checkValueUniqueness(node) { + var _node$values; + + const typeName = node.name.value; + + if (!knownValueNames[typeName]) { + knownValueNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const valueNodes = + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + const valueNames = knownValueNames[typeName]; + + for (const valueDef of valueNodes) { + const valueName = valueDef.name.value; + const existingType = existingTypeMap[typeName]; + + if ( + (0, _definition.isEnumType)(existingType) && + existingType.getValue(valueName) + ) { + context.reportError( + new _GraphQLError.GraphQLError( + `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: valueDef.name, + }, + ), + ); + } else if (valueNames[valueName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `Enum value "${typeName}.${valueName}" can only be defined once.`, + { + nodes: [valueNames[valueName], valueDef.name], + }, + ), + ); + } else { + valueNames[valueName] = valueDef.name; + } + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs new file mode 100644 index 0000000..8e66111 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs @@ -0,0 +1,64 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { isEnumType } from '../../type/definition.mjs'; + +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +export function UniqueEnumValueNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownValueNames = Object.create(null); + return { + EnumTypeDefinition: checkValueUniqueness, + EnumTypeExtension: checkValueUniqueness, + }; + + function checkValueUniqueness(node) { + var _node$values; + + const typeName = node.name.value; + + if (!knownValueNames[typeName]) { + knownValueNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const valueNodes = + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + const valueNames = knownValueNames[typeName]; + + for (const valueDef of valueNodes) { + const valueName = valueDef.name.value; + const existingType = existingTypeMap[typeName]; + + if (isEnumType(existingType) && existingType.getValue(valueName)) { + context.reportError( + new GraphQLError( + `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: valueDef.name, + }, + ), + ); + } else if (valueNames[valueName]) { + context.reportError( + new GraphQLError( + `Enum value "${typeName}.${valueName}" can only be defined once.`, + { + nodes: [valueNames[valueName], valueDef.name], + }, + ), + ); + } else { + valueNames[valueName] = valueDef.name; + } + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts new file mode 100644 index 0000000..f98be94 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +export declare function UniqueFieldDefinitionNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js new file mode 100644 index 0000000..f0d9fcb --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js @@ -0,0 +1,87 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueFieldDefinitionNamesRule = UniqueFieldDefinitionNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +function UniqueFieldDefinitionNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownFieldNames = Object.create(null); + return { + InputObjectTypeDefinition: checkFieldUniqueness, + InputObjectTypeExtension: checkFieldUniqueness, + InterfaceTypeDefinition: checkFieldUniqueness, + InterfaceTypeExtension: checkFieldUniqueness, + ObjectTypeDefinition: checkFieldUniqueness, + ObjectTypeExtension: checkFieldUniqueness, + }; + + function checkFieldUniqueness(node) { + var _node$fields; + + const typeName = node.name.value; + + if (!knownFieldNames[typeName]) { + knownFieldNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + const fieldNames = knownFieldNames[typeName]; + + for (const fieldDef of fieldNodes) { + const fieldName = fieldDef.name.value; + + if (hasField(existingTypeMap[typeName], fieldName)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: fieldDef.name, + }, + ), + ); + } else if (fieldNames[fieldName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${typeName}.${fieldName}" can only be defined once.`, + { + nodes: [fieldNames[fieldName], fieldDef.name], + }, + ), + ); + } else { + fieldNames[fieldName] = fieldDef.name; + } + } + + return false; + } +} + +function hasField(type, fieldName) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) || + (0, _definition.isInputObjectType)(type) + ) { + return type.getFields()[fieldName] != null; + } + + return false; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs new file mode 100644 index 0000000..34a7a4a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs @@ -0,0 +1,79 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { + isInputObjectType, + isInterfaceType, + isObjectType, +} from '../../type/definition.mjs'; + +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +export function UniqueFieldDefinitionNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownFieldNames = Object.create(null); + return { + InputObjectTypeDefinition: checkFieldUniqueness, + InputObjectTypeExtension: checkFieldUniqueness, + InterfaceTypeDefinition: checkFieldUniqueness, + InterfaceTypeExtension: checkFieldUniqueness, + ObjectTypeDefinition: checkFieldUniqueness, + ObjectTypeExtension: checkFieldUniqueness, + }; + + function checkFieldUniqueness(node) { + var _node$fields; + + const typeName = node.name.value; + + if (!knownFieldNames[typeName]) { + knownFieldNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + const fieldNames = knownFieldNames[typeName]; + + for (const fieldDef of fieldNodes) { + const fieldName = fieldDef.name.value; + + if (hasField(existingTypeMap[typeName], fieldName)) { + context.reportError( + new GraphQLError( + `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: fieldDef.name, + }, + ), + ); + } else if (fieldNames[fieldName]) { + context.reportError( + new GraphQLError( + `Field "${typeName}.${fieldName}" can only be defined once.`, + { + nodes: [fieldNames[fieldName], fieldDef.name], + }, + ), + ); + } else { + fieldNames[fieldName] = fieldDef.name; + } + } + + return false; + } +} + +function hasField(type, fieldName) { + if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { + return type.getFields()[fieldName] != null; + } + + return false; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts new file mode 100644 index 0000000..77a6437 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + */ +export declare function UniqueFragmentNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js new file mode 100644 index 0000000..3f1533c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueFragmentNamesRule = UniqueFragmentNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + */ +function UniqueFragmentNamesRule(context) { + const knownFragmentNames = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + const fragmentName = node.name.value; + + if (knownFragmentNames[fragmentName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one fragment named "${fragmentName}".`, + { + nodes: [knownFragmentNames[fragmentName], node.name], + }, + ), + ); + } else { + knownFragmentNames[fragmentName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs new file mode 100644 index 0000000..354fff5 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs @@ -0,0 +1,34 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + */ +export function UniqueFragmentNamesRule(context) { + const knownFragmentNames = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + const fragmentName = node.name.value; + + if (knownFragmentNames[fragmentName]) { + context.reportError( + new GraphQLError( + `There can be only one fragment named "${fragmentName}".`, + { + nodes: [knownFragmentNames[fragmentName], node.name], + }, + ), + ); + } else { + knownFragmentNames[fragmentName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts new file mode 100644 index 0000000..6133fe9 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + */ +export declare function UniqueInputFieldNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js new file mode 100644 index 0000000..3d32a40 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueInputFieldNamesRule = UniqueInputFieldNamesRule; + +var _invariant = require('../../jsutils/invariant.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + */ +function UniqueInputFieldNamesRule(context) { + const knownNameStack = []; + let knownNames = Object.create(null); + return { + ObjectValue: { + enter() { + knownNameStack.push(knownNames); + knownNames = Object.create(null); + }, + + leave() { + const prevKnownNames = knownNameStack.pop(); + prevKnownNames || (0, _invariant.invariant)(false); + knownNames = prevKnownNames; + }, + }, + + ObjectField(node) { + const fieldName = node.name.value; + + if (knownNames[fieldName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one input field named "${fieldName}".`, + { + nodes: [knownNames[fieldName], node.name], + }, + ), + ); + } else { + knownNames[fieldName] = node.name; + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs new file mode 100644 index 0000000..3b21c3c --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs @@ -0,0 +1,46 @@ +import { invariant } from '../../jsutils/invariant.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + */ +export function UniqueInputFieldNamesRule(context) { + const knownNameStack = []; + let knownNames = Object.create(null); + return { + ObjectValue: { + enter() { + knownNameStack.push(knownNames); + knownNames = Object.create(null); + }, + + leave() { + const prevKnownNames = knownNameStack.pop(); + prevKnownNames || invariant(false); + knownNames = prevKnownNames; + }, + }, + + ObjectField(node) { + const fieldName = node.name.value; + + if (knownNames[fieldName]) { + context.reportError( + new GraphQLError( + `There can be only one input field named "${fieldName}".`, + { + nodes: [knownNames[fieldName], node.name], + }, + ), + ); + } else { + knownNames[fieldName] = node.name; + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts new file mode 100644 index 0000000..a3bf0ca --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + */ +export declare function UniqueOperationNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js new file mode 100644 index 0000000..d024c16 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueOperationNamesRule = UniqueOperationNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + */ +function UniqueOperationNamesRule(context) { + const knownOperationNames = Object.create(null); + return { + OperationDefinition(node) { + const operationName = node.name; + + if (operationName) { + if (knownOperationNames[operationName.value]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one operation named "${operationName.value}".`, + { + nodes: [ + knownOperationNames[operationName.value], + operationName, + ], + }, + ), + ); + } else { + knownOperationNames[operationName.value] = operationName; + } + } + + return false; + }, + + FragmentDefinition: () => false, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs new file mode 100644 index 0000000..c79a88f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs @@ -0,0 +1,39 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + */ +export function UniqueOperationNamesRule(context) { + const knownOperationNames = Object.create(null); + return { + OperationDefinition(node) { + const operationName = node.name; + + if (operationName) { + if (knownOperationNames[operationName.value]) { + context.reportError( + new GraphQLError( + `There can be only one operation named "${operationName.value}".`, + { + nodes: [ + knownOperationNames[operationName.value], + operationName, + ], + }, + ), + ); + } else { + knownOperationNames[operationName.value] = operationName; + } + } + + return false; + }, + + FragmentDefinition: () => false, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts new file mode 100644 index 0000000..3471719 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +export declare function UniqueOperationTypesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js new file mode 100644 index 0000000..3fe791e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js @@ -0,0 +1,71 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueOperationTypesRule = UniqueOperationTypesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +function UniqueOperationTypesRule(context) { + const schema = context.getSchema(); + const definedOperationTypes = Object.create(null); + const existingOperationTypes = schema + ? { + query: schema.getQueryType(), + mutation: schema.getMutationType(), + subscription: schema.getSubscriptionType(), + } + : {}; + return { + SchemaDefinition: checkOperationTypes, + SchemaExtension: checkOperationTypes, + }; + + function checkOperationTypes(node) { + var _node$operationTypes; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const operationTypesNodes = + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + const operation = operationType.operation; + const alreadyDefinedOperationType = definedOperationTypes[operation]; + + if (existingOperationTypes[operation]) { + context.reportError( + new _GraphQLError.GraphQLError( + `Type for ${operation} already defined in the schema. It cannot be redefined.`, + { + nodes: operationType, + }, + ), + ); + } else if (alreadyDefinedOperationType) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one ${operation} type in schema.`, + { + nodes: [alreadyDefinedOperationType, operationType], + }, + ), + ); + } else { + definedOperationTypes[operation] = operationType; + } + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs new file mode 100644 index 0000000..9b56d35 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs @@ -0,0 +1,64 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +export function UniqueOperationTypesRule(context) { + const schema = context.getSchema(); + const definedOperationTypes = Object.create(null); + const existingOperationTypes = schema + ? { + query: schema.getQueryType(), + mutation: schema.getMutationType(), + subscription: schema.getSubscriptionType(), + } + : {}; + return { + SchemaDefinition: checkOperationTypes, + SchemaExtension: checkOperationTypes, + }; + + function checkOperationTypes(node) { + var _node$operationTypes; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const operationTypesNodes = + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + const operation = operationType.operation; + const alreadyDefinedOperationType = definedOperationTypes[operation]; + + if (existingOperationTypes[operation]) { + context.reportError( + new GraphQLError( + `Type for ${operation} already defined in the schema. It cannot be redefined.`, + { + nodes: operationType, + }, + ), + ); + } else if (alreadyDefinedOperationType) { + context.reportError( + new GraphQLError( + `There can be only one ${operation} type in schema.`, + { + nodes: [alreadyDefinedOperationType, operationType], + }, + ), + ); + } else { + definedOperationTypes[operation] = operationType; + } + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts new file mode 100644 index 0000000..f2ba792 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +export declare function UniqueTypeNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js new file mode 100644 index 0000000..f510fb7 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueTypeNamesRule = UniqueTypeNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +function UniqueTypeNamesRule(context) { + const knownTypeNames = Object.create(null); + const schema = context.getSchema(); + return { + ScalarTypeDefinition: checkTypeName, + ObjectTypeDefinition: checkTypeName, + InterfaceTypeDefinition: checkTypeName, + UnionTypeDefinition: checkTypeName, + EnumTypeDefinition: checkTypeName, + InputObjectTypeDefinition: checkTypeName, + }; + + function checkTypeName(node) { + const typeName = node.name.value; + + if (schema !== null && schema !== void 0 && schema.getType(typeName)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownTypeNames[typeName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one type named "${typeName}".`, + { + nodes: [knownTypeNames[typeName], node.name], + }, + ), + ); + } else { + knownTypeNames[typeName] = node.name; + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs new file mode 100644 index 0000000..becbf21 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs @@ -0,0 +1,47 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +export function UniqueTypeNamesRule(context) { + const knownTypeNames = Object.create(null); + const schema = context.getSchema(); + return { + ScalarTypeDefinition: checkTypeName, + ObjectTypeDefinition: checkTypeName, + InterfaceTypeDefinition: checkTypeName, + UnionTypeDefinition: checkTypeName, + EnumTypeDefinition: checkTypeName, + InputObjectTypeDefinition: checkTypeName, + }; + + function checkTypeName(node) { + const typeName = node.name.value; + + if (schema !== null && schema !== void 0 && schema.getType(typeName)) { + context.reportError( + new GraphQLError( + `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownTypeNames[typeName]) { + context.reportError( + new GraphQLError(`There can be only one type named "${typeName}".`, { + nodes: [knownTypeNames[typeName], node.name], + }), + ); + } else { + knownTypeNames[typeName] = node.name; + } + + return false; + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts new file mode 100644 index 0000000..05f48ba --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +export declare function UniqueVariableNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js new file mode 100644 index 0000000..d8dca55 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js @@ -0,0 +1,49 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueVariableNamesRule = UniqueVariableNamesRule; + +var _groupBy = require('../../jsutils/groupBy.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +function UniqueVariableNamesRule(context) { + return { + OperationDefinition(operationNode) { + var _operationNode$variab; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const variableDefinitions = + (_operationNode$variab = operationNode.variableDefinitions) !== null && + _operationNode$variab !== void 0 + ? _operationNode$variab + : []; + const seenVariableDefinitions = (0, _groupBy.groupBy)( + variableDefinitions, + (node) => node.variable.name.value, + ); + + for (const [variableName, variableNodes] of seenVariableDefinitions) { + if (variableNodes.length > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one variable named "$${variableName}".`, + { + nodes: variableNodes.map((node) => node.variable.name), + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs new file mode 100644 index 0000000..e8b9e62 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs @@ -0,0 +1,41 @@ +import { groupBy } from '../../jsutils/groupBy.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +export function UniqueVariableNamesRule(context) { + return { + OperationDefinition(operationNode) { + var _operationNode$variab; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const variableDefinitions = + (_operationNode$variab = operationNode.variableDefinitions) !== null && + _operationNode$variab !== void 0 + ? _operationNode$variab + : []; + const seenVariableDefinitions = groupBy( + variableDefinitions, + (node) => node.variable.name.value, + ); + + for (const [variableName, variableNodes] of seenVariableDefinitions) { + if (variableNodes.length > 1) { + context.reportError( + new GraphQLError( + `There can be only one variable named "$${variableName}".`, + { + nodes: variableNodes.map((node) => node.variable.name), + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts new file mode 100644 index 0000000..8685e52 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + */ +export declare function ValuesOfCorrectTypeRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js new file mode 100644 index 0000000..6eede7a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js @@ -0,0 +1,192 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ValuesOfCorrectTypeRule = ValuesOfCorrectTypeRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _inspect = require('../../jsutils/inspect.js'); + +var _keyMap = require('../../jsutils/keyMap.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + */ +function ValuesOfCorrectTypeRule(context) { + return { + ListValue(node) { + // Note: TypeInfo will traverse into a list's item type, so look to the + // parent input type to check if it is a list. + const type = (0, _definition.getNullableType)( + context.getParentInputType(), + ); + + if (!(0, _definition.isListType)(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } + }, + + ObjectValue(node) { + const type = (0, _definition.getNamedType)(context.getInputType()); + + if (!(0, _definition.isInputObjectType)(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } // Ensure every required field exists. + + const fieldNodeMap = (0, _keyMap.keyMap)( + node.fields, + (field) => field.name.value, + ); + + for (const fieldDef of Object.values(type.getFields())) { + const fieldNode = fieldNodeMap[fieldDef.name]; + + if (!fieldNode && (0, _definition.isRequiredInputField)(fieldDef)) { + const typeStr = (0, _inspect.inspect)(fieldDef.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const parentType = (0, _definition.getNamedType)( + context.getParentInputType(), + ); + const fieldType = context.getInputType(); + + if (!fieldType && (0, _definition.isInputObjectType)(parentType)) { + const suggestions = (0, _suggestionList.suggestionList)( + node.name.value, + Object.keys(parentType.getFields()), + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${node.name.value}" is not defined by type "${parentType.name}".` + + (0, _didYouMean.didYouMean)(suggestions), + { + nodes: node, + }, + ), + ); + } + }, + + NullValue(node) { + const type = context.getInputType(); + + if ((0, _definition.isNonNullType)(type)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${(0, _inspect.inspect)( + type, + )}", found ${(0, _printer.print)(node)}.`, + { + nodes: node, + }, + ), + ); + } + }, + + EnumValue: (node) => isValidValueNode(context, node), + IntValue: (node) => isValidValueNode(context, node), + FloatValue: (node) => isValidValueNode(context, node), + StringValue: (node) => isValidValueNode(context, node), + BooleanValue: (node) => isValidValueNode(context, node), + }; +} +/** + * Any value literal may be a valid representation of a Scalar, depending on + * that scalar type. + */ + +function isValidValueNode(context, node) { + // Report any error at the full type expected by the location. + const locationType = context.getInputType(); + + if (!locationType) { + return; + } + + const type = (0, _definition.getNamedType)(locationType); + + if (!(0, _definition.isLeafType)(type)) { + const typeStr = (0, _inspect.inspect)(locationType); + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${typeStr}", found ${(0, _printer.print)( + node, + )}.`, + { + nodes: node, + }, + ), + ); + return; + } // Scalars and Enums determine if a literal value is valid via parseLiteral(), + // which may throw or return an invalid value to indicate failure. + + try { + const parseResult = type.parseLiteral( + node, + undefined, + /* variables */ + ); + + if (parseResult === undefined) { + const typeStr = (0, _inspect.inspect)(locationType); + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${typeStr}", found ${(0, _printer.print)( + node, + )}.`, + { + nodes: node, + }, + ), + ); + } + } catch (error) { + const typeStr = (0, _inspect.inspect)(locationType); + + if (error instanceof _GraphQLError.GraphQLError) { + context.reportError(error); + } else { + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${typeStr}", found ${(0, _printer.print)( + node, + )}; ` + error.message, + { + nodes: node, + originalError: error, + }, + ), + ); + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs new file mode 100644 index 0000000..ca5ca2f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs @@ -0,0 +1,173 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { inspect } from '../../jsutils/inspect.mjs'; +import { keyMap } from '../../jsutils/keyMap.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { print } from '../../language/printer.mjs'; +import { + getNamedType, + getNullableType, + isInputObjectType, + isLeafType, + isListType, + isNonNullType, + isRequiredInputField, +} from '../../type/definition.mjs'; + +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + */ +export function ValuesOfCorrectTypeRule(context) { + return { + ListValue(node) { + // Note: TypeInfo will traverse into a list's item type, so look to the + // parent input type to check if it is a list. + const type = getNullableType(context.getParentInputType()); + + if (!isListType(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } + }, + + ObjectValue(node) { + const type = getNamedType(context.getInputType()); + + if (!isInputObjectType(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } // Ensure every required field exists. + + const fieldNodeMap = keyMap(node.fields, (field) => field.name.value); + + for (const fieldDef of Object.values(type.getFields())) { + const fieldNode = fieldNodeMap[fieldDef.name]; + + if (!fieldNode && isRequiredInputField(fieldDef)) { + const typeStr = inspect(fieldDef.type); + context.reportError( + new GraphQLError( + `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const parentType = getNamedType(context.getParentInputType()); + const fieldType = context.getInputType(); + + if (!fieldType && isInputObjectType(parentType)) { + const suggestions = suggestionList( + node.name.value, + Object.keys(parentType.getFields()), + ); + context.reportError( + new GraphQLError( + `Field "${node.name.value}" is not defined by type "${parentType.name}".` + + didYouMean(suggestions), + { + nodes: node, + }, + ), + ); + } + }, + + NullValue(node) { + const type = context.getInputType(); + + if (isNonNullType(type)) { + context.reportError( + new GraphQLError( + `Expected value of type "${inspect(type)}", found ${print(node)}.`, + { + nodes: node, + }, + ), + ); + } + }, + + EnumValue: (node) => isValidValueNode(context, node), + IntValue: (node) => isValidValueNode(context, node), + FloatValue: (node) => isValidValueNode(context, node), + StringValue: (node) => isValidValueNode(context, node), + BooleanValue: (node) => isValidValueNode(context, node), + }; +} +/** + * Any value literal may be a valid representation of a Scalar, depending on + * that scalar type. + */ + +function isValidValueNode(context, node) { + // Report any error at the full type expected by the location. + const locationType = context.getInputType(); + + if (!locationType) { + return; + } + + const type = getNamedType(locationType); + + if (!isLeafType(type)) { + const typeStr = inspect(locationType); + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}.`, + { + nodes: node, + }, + ), + ); + return; + } // Scalars and Enums determine if a literal value is valid via parseLiteral(), + // which may throw or return an invalid value to indicate failure. + + try { + const parseResult = type.parseLiteral( + node, + undefined, + /* variables */ + ); + + if (parseResult === undefined) { + const typeStr = inspect(locationType); + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}.`, + { + nodes: node, + }, + ), + ); + } + } catch (error) { + const typeStr = inspect(locationType); + + if (error instanceof GraphQLError) { + context.reportError(error); + } else { + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}; ` + + error.message, + { + nodes: node, + originalError: error, + }, + ), + ); + } + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts new file mode 100644 index 0000000..45c7e34 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + */ +export declare function VariablesAreInputTypesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js new file mode 100644 index 0000000..20366d4 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.VariablesAreInputTypesRule = VariablesAreInputTypesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + */ +function VariablesAreInputTypesRule(context) { + return { + VariableDefinition(node) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + node.type, + ); + + if (type !== undefined && !(0, _definition.isInputType)(type)) { + const variableName = node.variable.name.value; + const typeName = (0, _printer.print)(node.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Variable "$${variableName}" cannot be non-input type "${typeName}".`, + { + nodes: node.type, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs new file mode 100644 index 0000000..7ad0659 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs @@ -0,0 +1,33 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { print } from '../../language/printer.mjs'; +import { isInputType } from '../../type/definition.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + */ +export function VariablesAreInputTypesRule(context) { + return { + VariableDefinition(node) { + const type = typeFromAST(context.getSchema(), node.type); + + if (type !== undefined && !isInputType(type)) { + const variableName = node.variable.name.value; + const typeName = print(node.type); + context.reportError( + new GraphQLError( + `Variable "$${variableName}" cannot be non-input type "${typeName}".`, + { + nodes: node.type, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts new file mode 100644 index 0000000..3cac590 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + */ +export declare function VariablesInAllowedPositionRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js new file mode 100644 index 0000000..cc8967b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js @@ -0,0 +1,116 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.VariablesInAllowedPositionRule = VariablesInAllowedPositionRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _definition = require('../../type/definition.js'); + +var _typeComparators = require('../../utilities/typeComparators.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + */ +function VariablesInAllowedPositionRule(context) { + let varDefMap = Object.create(null); + return { + OperationDefinition: { + enter() { + varDefMap = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node, type, defaultValue } of usages) { + const varName = node.name.value; + const varDef = varDefMap[varName]; + + if (varDef && type) { + // A var type is allowed if it is the same or more strict (e.g. is + // a subtype of) than the expected type. It can be more strict if + // the variable type is non-null when the expected type is nullable. + // If both are list types, the variable item type can be more strict + // than the expected item type (contravariant). + const schema = context.getSchema(); + const varType = (0, _typeFromAST.typeFromAST)(schema, varDef.type); + + if ( + varType && + !allowedVariableUsage( + schema, + varType, + varDef.defaultValue, + type, + defaultValue, + ) + ) { + const varTypeStr = (0, _inspect.inspect)(varType); + const typeStr = (0, _inspect.inspect)(type); + context.reportError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, + { + nodes: [varDef, node], + }, + ), + ); + } + } + } + }, + }, + + VariableDefinition(node) { + varDefMap[node.variable.name.value] = node; + }, + }; +} +/** + * Returns true if the variable is allowed in the location it was found, + * which includes considering if default values exist for either the variable + * or the location at which it is located. + */ + +function allowedVariableUsage( + schema, + varType, + varDefaultValue, + locationType, + locationDefaultValue, +) { + if ( + (0, _definition.isNonNullType)(locationType) && + !(0, _definition.isNonNullType)(varType) + ) { + const hasNonNullVariableDefaultValue = + varDefaultValue != null && varDefaultValue.kind !== _kinds.Kind.NULL; + const hasLocationDefaultValue = locationDefaultValue !== undefined; + + if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { + return false; + } + + const nullableLocationType = locationType.ofType; + return (0, _typeComparators.isTypeSubTypeOf)( + schema, + varType, + nullableLocationType, + ); + } + + return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, locationType); +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs new file mode 100644 index 0000000..cd97ffc --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs @@ -0,0 +1,97 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { isNonNullType } from '../../type/definition.mjs'; +import { isTypeSubTypeOf } from '../../utilities/typeComparators.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + */ +export function VariablesInAllowedPositionRule(context) { + let varDefMap = Object.create(null); + return { + OperationDefinition: { + enter() { + varDefMap = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node, type, defaultValue } of usages) { + const varName = node.name.value; + const varDef = varDefMap[varName]; + + if (varDef && type) { + // A var type is allowed if it is the same or more strict (e.g. is + // a subtype of) than the expected type. It can be more strict if + // the variable type is non-null when the expected type is nullable. + // If both are list types, the variable item type can be more strict + // than the expected item type (contravariant). + const schema = context.getSchema(); + const varType = typeFromAST(schema, varDef.type); + + if ( + varType && + !allowedVariableUsage( + schema, + varType, + varDef.defaultValue, + type, + defaultValue, + ) + ) { + const varTypeStr = inspect(varType); + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, + { + nodes: [varDef, node], + }, + ), + ); + } + } + } + }, + }, + + VariableDefinition(node) { + varDefMap[node.variable.name.value] = node; + }, + }; +} +/** + * Returns true if the variable is allowed in the location it was found, + * which includes considering if default values exist for either the variable + * or the location at which it is located. + */ + +function allowedVariableUsage( + schema, + varType, + varDefaultValue, + locationType, + locationDefaultValue, +) { + if (isNonNullType(locationType) && !isNonNullType(varType)) { + const hasNonNullVariableDefaultValue = + varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; + const hasLocationDefaultValue = locationDefaultValue !== undefined; + + if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { + return false; + } + + const nullableLocationType = locationType.ofType; + return isTypeSubTypeOf(schema, varType, nullableLocationType); + } + + return isTypeSubTypeOf(schema, varType, locationType); +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts new file mode 100644 index 0000000..fe36482 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts @@ -0,0 +1,15 @@ +import type { ASTVisitor } from '../../../language/visitor'; +import type { ValidationContext } from '../../ValidationContext'; +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +export declare function NoDeprecatedCustomRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js new file mode 100644 index 0000000..0e118f2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js @@ -0,0 +1,131 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoDeprecatedCustomRule = NoDeprecatedCustomRule; + +var _invariant = require('../../../jsutils/invariant.js'); + +var _GraphQLError = require('../../../error/GraphQLError.js'); + +var _definition = require('../../../type/definition.js'); + +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +function NoDeprecatedCustomRule(context) { + return { + Field(node) { + const fieldDef = context.getFieldDef(); + const deprecationReason = + fieldDef === null || fieldDef === void 0 + ? void 0 + : fieldDef.deprecationReason; + + if (fieldDef && deprecationReason != null) { + const parentType = context.getParentType(); + parentType != null || (0, _invariant.invariant)(false); + context.reportError( + new _GraphQLError.GraphQLError( + `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + + Argument(node) { + const argDef = context.getArgument(); + const deprecationReason = + argDef === null || argDef === void 0 + ? void 0 + : argDef.deprecationReason; + + if (argDef && deprecationReason != null) { + const directiveDef = context.getDirective(); + + if (directiveDef != null) { + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } else { + const parentType = context.getParentType(); + const fieldDef = context.getFieldDef(); + (parentType != null && fieldDef != null) || + (0, _invariant.invariant)(false); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const inputObjectDef = (0, _definition.getNamedType)( + context.getParentInputType(), + ); + + if ((0, _definition.isInputObjectType)(inputObjectDef)) { + const inputFieldDef = inputObjectDef.getFields()[node.name.value]; + const deprecationReason = + inputFieldDef === null || inputFieldDef === void 0 + ? void 0 + : inputFieldDef.deprecationReason; + + if (deprecationReason != null) { + context.reportError( + new _GraphQLError.GraphQLError( + `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + EnumValue(node) { + const enumValueDef = context.getEnumValue(); + const deprecationReason = + enumValueDef === null || enumValueDef === void 0 + ? void 0 + : enumValueDef.deprecationReason; + + if (enumValueDef && deprecationReason != null) { + const enumTypeDef = (0, _definition.getNamedType)( + context.getInputType(), + ); + enumTypeDef != null || (0, _invariant.invariant)(false); + context.reportError( + new _GraphQLError.GraphQLError( + `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs new file mode 100644 index 0000000..0e04b4f --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs @@ -0,0 +1,117 @@ +import { invariant } from '../../../jsutils/invariant.mjs'; +import { GraphQLError } from '../../../error/GraphQLError.mjs'; +import { getNamedType, isInputObjectType } from '../../../type/definition.mjs'; + +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +export function NoDeprecatedCustomRule(context) { + return { + Field(node) { + const fieldDef = context.getFieldDef(); + const deprecationReason = + fieldDef === null || fieldDef === void 0 + ? void 0 + : fieldDef.deprecationReason; + + if (fieldDef && deprecationReason != null) { + const parentType = context.getParentType(); + parentType != null || invariant(false); + context.reportError( + new GraphQLError( + `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + + Argument(node) { + const argDef = context.getArgument(); + const deprecationReason = + argDef === null || argDef === void 0 + ? void 0 + : argDef.deprecationReason; + + if (argDef && deprecationReason != null) { + const directiveDef = context.getDirective(); + + if (directiveDef != null) { + context.reportError( + new GraphQLError( + `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } else { + const parentType = context.getParentType(); + const fieldDef = context.getFieldDef(); + (parentType != null && fieldDef != null) || invariant(false); + context.reportError( + new GraphQLError( + `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const inputObjectDef = getNamedType(context.getParentInputType()); + + if (isInputObjectType(inputObjectDef)) { + const inputFieldDef = inputObjectDef.getFields()[node.name.value]; + const deprecationReason = + inputFieldDef === null || inputFieldDef === void 0 + ? void 0 + : inputFieldDef.deprecationReason; + + if (deprecationReason != null) { + context.reportError( + new GraphQLError( + `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + EnumValue(node) { + const enumValueDef = context.getEnumValue(); + const deprecationReason = + enumValueDef === null || enumValueDef === void 0 + ? void 0 + : enumValueDef.deprecationReason; + + if (enumValueDef && deprecationReason != null) { + const enumTypeDef = getNamedType(context.getInputType()); + enumTypeDef != null || invariant(false); + context.reportError( + new GraphQLError( + `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts new file mode 100644 index 0000000..a7bc93e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts @@ -0,0 +1,15 @@ +import type { ASTVisitor } from '../../../language/visitor'; +import type { ValidationContext } from '../../ValidationContext'; +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +export declare function NoSchemaIntrospectionCustomRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js new file mode 100644 index 0000000..f3b4265 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoSchemaIntrospectionCustomRule = NoSchemaIntrospectionCustomRule; + +var _GraphQLError = require('../../../error/GraphQLError.js'); + +var _definition = require('../../../type/definition.js'); + +var _introspection = require('../../../type/introspection.js'); + +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +function NoSchemaIntrospectionCustomRule(context) { + return { + Field(node) { + const type = (0, _definition.getNamedType)(context.getType()); + + if (type && (0, _introspection.isIntrospectionType)(type)) { + context.reportError( + new _GraphQLError.GraphQLError( + `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs new file mode 100644 index 0000000..9f7984e --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs @@ -0,0 +1,32 @@ +import { GraphQLError } from '../../../error/GraphQLError.mjs'; +import { getNamedType } from '../../../type/definition.mjs'; +import { isIntrospectionType } from '../../../type/introspection.mjs'; + +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +export function NoSchemaIntrospectionCustomRule(context) { + return { + Field(node) { + const type = getNamedType(context.getType()); + + if (type && isIntrospectionType(type)) { + context.reportError( + new GraphQLError( + `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.d.ts b/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.d.ts new file mode 100644 index 0000000..8ab4ec6 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.d.ts @@ -0,0 +1,12 @@ +import type { SDLValidationRule, ValidationRule } from './ValidationContext'; +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +export declare const specifiedRules: ReadonlyArray; +/** + * @internal + */ +export declare const specifiedSDLRules: ReadonlyArray; diff --git a/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.js b/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.js new file mode 100644 index 0000000..014d23b --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.js @@ -0,0 +1,160 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.specifiedSDLRules = exports.specifiedRules = void 0; + +var _ExecutableDefinitionsRule = require('./rules/ExecutableDefinitionsRule.js'); + +var _FieldsOnCorrectTypeRule = require('./rules/FieldsOnCorrectTypeRule.js'); + +var _FragmentsOnCompositeTypesRule = require('./rules/FragmentsOnCompositeTypesRule.js'); + +var _KnownArgumentNamesRule = require('./rules/KnownArgumentNamesRule.js'); + +var _KnownDirectivesRule = require('./rules/KnownDirectivesRule.js'); + +var _KnownFragmentNamesRule = require('./rules/KnownFragmentNamesRule.js'); + +var _KnownTypeNamesRule = require('./rules/KnownTypeNamesRule.js'); + +var _LoneAnonymousOperationRule = require('./rules/LoneAnonymousOperationRule.js'); + +var _LoneSchemaDefinitionRule = require('./rules/LoneSchemaDefinitionRule.js'); + +var _NoFragmentCyclesRule = require('./rules/NoFragmentCyclesRule.js'); + +var _NoUndefinedVariablesRule = require('./rules/NoUndefinedVariablesRule.js'); + +var _NoUnusedFragmentsRule = require('./rules/NoUnusedFragmentsRule.js'); + +var _NoUnusedVariablesRule = require('./rules/NoUnusedVariablesRule.js'); + +var _OverlappingFieldsCanBeMergedRule = require('./rules/OverlappingFieldsCanBeMergedRule.js'); + +var _PossibleFragmentSpreadsRule = require('./rules/PossibleFragmentSpreadsRule.js'); + +var _PossibleTypeExtensionsRule = require('./rules/PossibleTypeExtensionsRule.js'); + +var _ProvidedRequiredArgumentsRule = require('./rules/ProvidedRequiredArgumentsRule.js'); + +var _ScalarLeafsRule = require('./rules/ScalarLeafsRule.js'); + +var _SingleFieldSubscriptionsRule = require('./rules/SingleFieldSubscriptionsRule.js'); + +var _UniqueArgumentDefinitionNamesRule = require('./rules/UniqueArgumentDefinitionNamesRule.js'); + +var _UniqueArgumentNamesRule = require('./rules/UniqueArgumentNamesRule.js'); + +var _UniqueDirectiveNamesRule = require('./rules/UniqueDirectiveNamesRule.js'); + +var _UniqueDirectivesPerLocationRule = require('./rules/UniqueDirectivesPerLocationRule.js'); + +var _UniqueEnumValueNamesRule = require('./rules/UniqueEnumValueNamesRule.js'); + +var _UniqueFieldDefinitionNamesRule = require('./rules/UniqueFieldDefinitionNamesRule.js'); + +var _UniqueFragmentNamesRule = require('./rules/UniqueFragmentNamesRule.js'); + +var _UniqueInputFieldNamesRule = require('./rules/UniqueInputFieldNamesRule.js'); + +var _UniqueOperationNamesRule = require('./rules/UniqueOperationNamesRule.js'); + +var _UniqueOperationTypesRule = require('./rules/UniqueOperationTypesRule.js'); + +var _UniqueTypeNamesRule = require('./rules/UniqueTypeNamesRule.js'); + +var _UniqueVariableNamesRule = require('./rules/UniqueVariableNamesRule.js'); + +var _ValuesOfCorrectTypeRule = require('./rules/ValuesOfCorrectTypeRule.js'); + +var _VariablesAreInputTypesRule = require('./rules/VariablesAreInputTypesRule.js'); + +var _VariablesInAllowedPositionRule = require('./rules/VariablesInAllowedPositionRule.js'); + +// Spec Section: "Executable Definitions" +// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" +// Spec Section: "Fragments on Composite Types" +// Spec Section: "Argument Names" +// Spec Section: "Directives Are Defined" +// Spec Section: "Fragment spread target defined" +// Spec Section: "Fragment Spread Type Existence" +// Spec Section: "Lone Anonymous Operation" +// SDL-specific validation rules +// Spec Section: "Fragments must not form cycles" +// Spec Section: "All Variable Used Defined" +// Spec Section: "Fragments must be used" +// Spec Section: "All Variables Used" +// Spec Section: "Field Selection Merging" +// Spec Section: "Fragment spread is possible" +// Spec Section: "Argument Optionality" +// Spec Section: "Leaf Field Selections" +// Spec Section: "Subscriptions with Single Root Field" +// Spec Section: "Argument Uniqueness" +// Spec Section: "Directives Are Unique Per Location" +// Spec Section: "Fragment Name Uniqueness" +// Spec Section: "Input Object Field Uniqueness" +// Spec Section: "Operation Name Uniqueness" +// Spec Section: "Variable Uniqueness" +// Spec Section: "Value Type Correctness" +// Spec Section: "Variables are Input Types" +// Spec Section: "All Variable Usages Are Allowed" + +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +const specifiedRules = Object.freeze([ + _ExecutableDefinitionsRule.ExecutableDefinitionsRule, + _UniqueOperationNamesRule.UniqueOperationNamesRule, + _LoneAnonymousOperationRule.LoneAnonymousOperationRule, + _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule, + _KnownTypeNamesRule.KnownTypeNamesRule, + _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule, + _VariablesAreInputTypesRule.VariablesAreInputTypesRule, + _ScalarLeafsRule.ScalarLeafsRule, + _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule, + _UniqueFragmentNamesRule.UniqueFragmentNamesRule, + _KnownFragmentNamesRule.KnownFragmentNamesRule, + _NoUnusedFragmentsRule.NoUnusedFragmentsRule, + _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule, + _NoFragmentCyclesRule.NoFragmentCyclesRule, + _UniqueVariableNamesRule.UniqueVariableNamesRule, + _NoUndefinedVariablesRule.NoUndefinedVariablesRule, + _NoUnusedVariablesRule.NoUnusedVariablesRule, + _KnownDirectivesRule.KnownDirectivesRule, + _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, + _KnownArgumentNamesRule.KnownArgumentNamesRule, + _UniqueArgumentNamesRule.UniqueArgumentNamesRule, + _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule, + _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule, + _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule, + _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule, + _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, +]); +/** + * @internal + */ + +exports.specifiedRules = specifiedRules; +const specifiedSDLRules = Object.freeze([ + _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule, + _UniqueOperationTypesRule.UniqueOperationTypesRule, + _UniqueTypeNamesRule.UniqueTypeNamesRule, + _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule, + _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule, + _UniqueArgumentDefinitionNamesRule.UniqueArgumentDefinitionNamesRule, + _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule, + _KnownTypeNamesRule.KnownTypeNamesRule, + _KnownDirectivesRule.KnownDirectivesRule, + _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, + _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule, + _KnownArgumentNamesRule.KnownArgumentNamesOnDirectivesRule, + _UniqueArgumentNamesRule.UniqueArgumentNamesRule, + _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, + _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsOnDirectivesRule, +]); +exports.specifiedSDLRules = specifiedSDLRules; diff --git a/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.mjs b/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.mjs new file mode 100644 index 0000000..c45f0f0 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/specifiedRules.mjs @@ -0,0 +1,123 @@ +// Spec Section: "Executable Definitions" +import { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule.mjs'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" + +import { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule.mjs'; // Spec Section: "Fragments on Composite Types" + +import { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule.mjs'; // Spec Section: "Argument Names" + +import { + KnownArgumentNamesOnDirectivesRule, + KnownArgumentNamesRule, +} from './rules/KnownArgumentNamesRule.mjs'; // Spec Section: "Directives Are Defined" + +import { KnownDirectivesRule } from './rules/KnownDirectivesRule.mjs'; // Spec Section: "Fragment spread target defined" + +import { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule.mjs'; // Spec Section: "Fragment Spread Type Existence" + +import { KnownTypeNamesRule } from './rules/KnownTypeNamesRule.mjs'; // Spec Section: "Lone Anonymous Operation" + +import { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule.mjs'; // SDL-specific validation rules + +import { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule.mjs'; // Spec Section: "Fragments must not form cycles" + +import { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule.mjs'; // Spec Section: "All Variable Used Defined" + +import { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule.mjs'; // Spec Section: "Fragments must be used" + +import { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule.mjs'; // Spec Section: "All Variables Used" + +import { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule.mjs'; // Spec Section: "Field Selection Merging" + +import { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule.mjs'; // Spec Section: "Fragment spread is possible" + +import { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule.mjs'; +import { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule.mjs'; // Spec Section: "Argument Optionality" + +import { + ProvidedRequiredArgumentsOnDirectivesRule, + ProvidedRequiredArgumentsRule, +} from './rules/ProvidedRequiredArgumentsRule.mjs'; // Spec Section: "Leaf Field Selections" + +import { ScalarLeafsRule } from './rules/ScalarLeafsRule.mjs'; // Spec Section: "Subscriptions with Single Root Field" + +import { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule.mjs'; +import { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule.mjs'; // Spec Section: "Argument Uniqueness" + +import { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule.mjs'; +import { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule.mjs'; // Spec Section: "Directives Are Unique Per Location" + +import { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule.mjs'; +import { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule.mjs'; +import { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule.mjs'; // Spec Section: "Fragment Name Uniqueness" + +import { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule.mjs'; // Spec Section: "Input Object Field Uniqueness" + +import { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule.mjs'; // Spec Section: "Operation Name Uniqueness" + +import { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule.mjs'; +import { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule.mjs'; +import { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule.mjs'; // Spec Section: "Variable Uniqueness" + +import { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule.mjs'; // Spec Section: "Value Type Correctness" + +import { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule.mjs'; // Spec Section: "Variables are Input Types" + +import { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule.mjs'; // Spec Section: "All Variable Usages Are Allowed" + +import { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule.mjs'; + +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +export const specifiedRules = Object.freeze([ + ExecutableDefinitionsRule, + UniqueOperationNamesRule, + LoneAnonymousOperationRule, + SingleFieldSubscriptionsRule, + KnownTypeNamesRule, + FragmentsOnCompositeTypesRule, + VariablesAreInputTypesRule, + ScalarLeafsRule, + FieldsOnCorrectTypeRule, + UniqueFragmentNamesRule, + KnownFragmentNamesRule, + NoUnusedFragmentsRule, + PossibleFragmentSpreadsRule, + NoFragmentCyclesRule, + UniqueVariableNamesRule, + NoUndefinedVariablesRule, + NoUnusedVariablesRule, + KnownDirectivesRule, + UniqueDirectivesPerLocationRule, + KnownArgumentNamesRule, + UniqueArgumentNamesRule, + ValuesOfCorrectTypeRule, + ProvidedRequiredArgumentsRule, + VariablesInAllowedPositionRule, + OverlappingFieldsCanBeMergedRule, + UniqueInputFieldNamesRule, +]); +/** + * @internal + */ + +export const specifiedSDLRules = Object.freeze([ + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + KnownTypeNamesRule, + KnownDirectivesRule, + UniqueDirectivesPerLocationRule, + PossibleTypeExtensionsRule, + KnownArgumentNamesOnDirectivesRule, + UniqueArgumentNamesRule, + UniqueInputFieldNamesRule, + ProvidedRequiredArgumentsOnDirectivesRule, +]); diff --git a/graphql-subscription-express/node_modules/graphql/validation/validate.d.ts b/graphql-subscription-express/node_modules/graphql/validation/validate.d.ts new file mode 100644 index 0000000..15dae3a --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/validate.d.ts @@ -0,0 +1,61 @@ +import type { Maybe } from '../jsutils/Maybe'; +import { GraphQLError } from '../error/GraphQLError'; +import type { DocumentNode } from '../language/ast'; +import type { GraphQLSchema } from '../type/schema'; +import { TypeInfo } from '../utilities/TypeInfo'; +import type { SDLValidationRule, ValidationRule } from './ValidationContext'; +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so by default `maxErrors` set to 100 errors. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ +export declare function validate( + schema: GraphQLSchema, + documentAST: DocumentNode, + rules?: ReadonlyArray, + options?: { + maxErrors?: number; + }, + /** @deprecated will be removed in 17.0.0 */ + typeInfo?: TypeInfo, +): ReadonlyArray; +/** + * @internal + */ +export declare function validateSDL( + documentAST: DocumentNode, + schemaToExtend?: Maybe, + rules?: ReadonlyArray, +): ReadonlyArray; +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ +export declare function assertValidSDL(documentAST: DocumentNode): void; +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ +export declare function assertValidSDLExtension( + documentAST: DocumentNode, + schema: GraphQLSchema, +): void; diff --git a/graphql-subscription-express/node_modules/graphql/validation/validate.js b/graphql-subscription-express/node_modules/graphql/validation/validate.js new file mode 100644 index 0000000..5a2114d --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/validate.js @@ -0,0 +1,151 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidSDL = assertValidSDL; +exports.assertValidSDLExtension = assertValidSDLExtension; +exports.validate = validate; +exports.validateSDL = validateSDL; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _visitor = require('../language/visitor.js'); + +var _validate = require('../type/validate.js'); + +var _TypeInfo = require('../utilities/TypeInfo.js'); + +var _specifiedRules = require('./specifiedRules.js'); + +var _ValidationContext = require('./ValidationContext.js'); + +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so by default `maxErrors` set to 100 errors. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ +function validate( + schema, + documentAST, + rules = _specifiedRules.specifiedRules, + options, + /** @deprecated will be removed in 17.0.0 */ + typeInfo = new _TypeInfo.TypeInfo(schema), +) { + var _options$maxErrors; + + const maxErrors = + (_options$maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors) !== + null && _options$maxErrors !== void 0 + ? _options$maxErrors + : 100; + documentAST || (0, _devAssert.devAssert)(false, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. + + (0, _validate.assertValidSchema)(schema); + const abortObj = Object.freeze({}); + const errors = []; + const context = new _ValidationContext.ValidationContext( + schema, + documentAST, + typeInfo, + (error) => { + if (errors.length >= maxErrors) { + errors.push( + new _GraphQLError.GraphQLError( + 'Too many validation errors, error limit reached. Validation aborted.', + ), + ); // eslint-disable-next-line @typescript-eslint/no-throw-literal + + throw abortObj; + } + + errors.push(error); + }, + ); // This uses a specialized visitor which runs multiple visitors in parallel, + // while maintaining the visitor skip and break API. + + const visitor = (0, _visitor.visitInParallel)( + rules.map((rule) => rule(context)), + ); // Visit the whole document with each instance of all provided rules. + + try { + (0, _visitor.visit)( + documentAST, + (0, _TypeInfo.visitWithTypeInfo)(typeInfo, visitor), + ); + } catch (e) { + if (e !== abortObj) { + throw e; + } + } + + return errors; +} +/** + * @internal + */ + +function validateSDL( + documentAST, + schemaToExtend, + rules = _specifiedRules.specifiedSDLRules, +) { + const errors = []; + const context = new _ValidationContext.SDLValidationContext( + documentAST, + schemaToExtend, + (error) => { + errors.push(error); + }, + ); + const visitors = rules.map((rule) => rule(context)); + (0, _visitor.visit)(documentAST, (0, _visitor.visitInParallel)(visitors)); + return errors; +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +function assertValidSDL(documentAST) { + const errors = validateSDL(documentAST); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +function assertValidSDLExtension(documentAST, schema) { + const errors = validateSDL(documentAST, schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/validation/validate.mjs b/graphql-subscription-express/node_modules/graphql/validation/validate.mjs new file mode 100644 index 0000000..be5a3c2 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/validation/validate.mjs @@ -0,0 +1,133 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { visit, visitInParallel } from '../language/visitor.mjs'; +import { assertValidSchema } from '../type/validate.mjs'; +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.mjs'; +import { specifiedRules, specifiedSDLRules } from './specifiedRules.mjs'; +import { + SDLValidationContext, + ValidationContext, +} from './ValidationContext.mjs'; +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so by default `maxErrors` set to 100 errors. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ + +export function validate( + schema, + documentAST, + rules = specifiedRules, + options, + /** @deprecated will be removed in 17.0.0 */ + typeInfo = new TypeInfo(schema), +) { + var _options$maxErrors; + + const maxErrors = + (_options$maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors) !== + null && _options$maxErrors !== void 0 + ? _options$maxErrors + : 100; + documentAST || devAssert(false, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. + + assertValidSchema(schema); + const abortObj = Object.freeze({}); + const errors = []; + const context = new ValidationContext( + schema, + documentAST, + typeInfo, + (error) => { + if (errors.length >= maxErrors) { + errors.push( + new GraphQLError( + 'Too many validation errors, error limit reached. Validation aborted.', + ), + ); // eslint-disable-next-line @typescript-eslint/no-throw-literal + + throw abortObj; + } + + errors.push(error); + }, + ); // This uses a specialized visitor which runs multiple visitors in parallel, + // while maintaining the visitor skip and break API. + + const visitor = visitInParallel(rules.map((rule) => rule(context))); // Visit the whole document with each instance of all provided rules. + + try { + visit(documentAST, visitWithTypeInfo(typeInfo, visitor)); + } catch (e) { + if (e !== abortObj) { + throw e; + } + } + + return errors; +} +/** + * @internal + */ + +export function validateSDL( + documentAST, + schemaToExtend, + rules = specifiedSDLRules, +) { + const errors = []; + const context = new SDLValidationContext( + documentAST, + schemaToExtend, + (error) => { + errors.push(error); + }, + ); + const visitors = rules.map((rule) => rule(context)); + visit(documentAST, visitInParallel(visitors)); + return errors; +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +export function assertValidSDL(documentAST) { + const errors = validateSDL(documentAST); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +export function assertValidSDLExtension(documentAST, schema) { + const errors = validateSDL(documentAST, schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} diff --git a/graphql-subscription-express/node_modules/graphql/version.d.ts b/graphql-subscription-express/node_modules/graphql/version.d.ts new file mode 100644 index 0000000..c813fd3 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/version.d.ts @@ -0,0 +1,13 @@ +/** + * A string containing the version of the GraphQL.js library + */ +export declare const version: string; +/** + * An object containing the components of the GraphQL.js version string + */ +export declare const versionInfo: Readonly<{ + major: number; + minor: number; + patch: number; + preReleaseTag: string | null; +}>; diff --git a/graphql-subscription-express/node_modules/graphql/version.js b/graphql-subscription-express/node_modules/graphql/version.js new file mode 100644 index 0000000..b2ceb43 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/version.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.versionInfo = exports.version = void 0; +// Note: This file is autogenerated using "resources/gen-version.js" script and +// automatically updated by "npm version" command. + +/** + * A string containing the version of the GraphQL.js library + */ +const version = '16.8.1'; +/** + * An object containing the components of the GraphQL.js version string + */ + +exports.version = version; +const versionInfo = Object.freeze({ + major: 16, + minor: 8, + patch: 1, + preReleaseTag: null, +}); +exports.versionInfo = versionInfo; diff --git a/graphql-subscription-express/node_modules/graphql/version.mjs b/graphql-subscription-express/node_modules/graphql/version.mjs new file mode 100644 index 0000000..05aca30 --- /dev/null +++ b/graphql-subscription-express/node_modules/graphql/version.mjs @@ -0,0 +1,17 @@ +// Note: This file is autogenerated using "resources/gen-version.js" script and +// automatically updated by "npm version" command. + +/** + * A string containing the version of the GraphQL.js library + */ +export const version = '16.8.1'; +/** + * An object containing the components of the GraphQL.js version string + */ + +export const versionInfo = Object.freeze({ + major: 16, + minor: 8, + patch: 1, + preReleaseTag: null, +}); diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/.eslintrc b/graphql-subscription-express/node_modules/has-property-descriptors/.eslintrc new file mode 100644 index 0000000..2fcc002 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": ["GetIntrinsic"], + }], + }, +} diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/.github/FUNDING.yml b/graphql-subscription-express/node_modules/has-property-descriptors/.github/FUNDING.yml new file mode 100644 index 0000000..817aacf --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-property-descriptors +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/.nycrc b/graphql-subscription-express/node_modules/has-property-descriptors/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/CHANGELOG.md b/graphql-subscription-express/node_modules/has-property-descriptors/CHANGELOG.md new file mode 100644 index 0000000..19c8a95 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/CHANGELOG.md @@ -0,0 +1,35 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/inspect-js/has-property-descriptors/compare/v1.0.1...v1.0.2) - 2024-02-12 + +### Commits + +- [Refactor] use `es-define-property` [`f93a8c8`](https://github.com/inspect-js/has-property-descriptors/commit/f93a8c85eba70cbceab500f2619fb5cce73a1805) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`42b0c9d`](https://github.com/inspect-js/has-property-descriptors/commit/42b0c9d1c23e747755f0f2924923c418ea34a9ee) +- [Deps] update `get-intrinsic` [`35e9b46`](https://github.com/inspect-js/has-property-descriptors/commit/35e9b46a7f14331bf0de98b644dd803676746037) + +## [v1.0.1](https://github.com/inspect-js/has-property-descriptors/compare/v1.0.0...v1.0.1) - 2023-10-20 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`5bbf4da`](https://github.com/inspect-js/has-property-descriptors/commit/5bbf4dae1b58950d87bb3af508bee7513e640868) +- [actions] update rebase action to use reusable workflow [`3a5585b`](https://github.com/inspect-js/has-property-descriptors/commit/3a5585bf74988f71a8f59e67a07d594e62c51fd8) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`e5c1212`](https://github.com/inspect-js/has-property-descriptors/commit/e5c1212048a8fda549794c47863724ca60b89cae) +- [Dev Deps] update `aud`, `tape` [`e942917`](https://github.com/inspect-js/has-property-descriptors/commit/e942917b6c2f7c090d5623048989cf20d0834ebf) +- [Deps] update `get-intrinsic` [`f4a44ec`](https://github.com/inspect-js/has-property-descriptors/commit/f4a44ec6d94146fa6c550d3c15c31a2062c83ef4) +- [Deps] update `get-intrinsic` [`eeb275b`](https://github.com/inspect-js/has-property-descriptors/commit/eeb275b473e5d72ca843b61ca25cfcb06a5d4300) + +## v1.0.0 - 2022-04-14 + +### Commits + +- Initial implementation, tests [`303559f`](https://github.com/inspect-js/has-property-descriptors/commit/303559f2a72dfe7111573a1aec475ed4a184c35a) +- Initial commit [`3a7ca2d`](https://github.com/inspect-js/has-property-descriptors/commit/3a7ca2dc49f1fff0279a28bb16265e7615e14749) +- read me [`dd73dce`](https://github.com/inspect-js/has-property-descriptors/commit/dd73dce09d89d0f7a4a6e3b1e562a506f979a767) +- npm init [`c1e6557`](https://github.com/inspect-js/has-property-descriptors/commit/c1e655779de632d68cb944c50da6b71bcb7b8c85) +- Only apps should have lockfiles [`e72f7c6`](https://github.com/inspect-js/has-property-descriptors/commit/e72f7c68de534b2d273ee665f8b18d4ecc7f70b0) diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/LICENSE b/graphql-subscription-express/node_modules/has-property-descriptors/LICENSE new file mode 100644 index 0000000..2e7b9a3 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/README.md b/graphql-subscription-express/node_modules/has-property-descriptors/README.md new file mode 100644 index 0000000..d81fbd9 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/README.md @@ -0,0 +1,43 @@ +# has-property-descriptors [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD. + +## Example + +```js +var hasPropertyDescriptors = require('has-property-descriptors'); +var assert = require('assert'); + +assert.equal(hasPropertyDescriptors(), true); // will be `false` in IE 6-8, and ES5 engines + +// Arrays can not have their length `[[Defined]]` in some engines +assert.equal(hasPropertyDescriptors.hasArrayLengthDefineBug(), false); // will be `true` in Firefox 4-22, and node v0.6 +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-property-descriptors +[npm-version-svg]: https://versionbadg.es/inspect-js/has-property-descriptors.svg +[deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors.svg +[deps-url]: https://david-dm.org/inspect-js/has-property-descriptors +[dev-deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-property-descriptors#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-property-descriptors.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-property-descriptors.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-property-descriptors.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-property-descriptors +[codecov-image]: https://codecov.io/gh/inspect-js/has-property-descriptors/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-property-descriptors/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-property-descriptors +[actions-url]: https://github.com/inspect-js/has-property-descriptors/actions diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/index.js b/graphql-subscription-express/node_modules/has-property-descriptors/index.js new file mode 100644 index 0000000..0480437 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + return !!$defineProperty; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!$defineProperty) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/package.json b/graphql-subscription-express/node_modules/has-property-descriptors/package.json new file mode 100644 index 0000000..7e70218 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/package.json @@ -0,0 +1,77 @@ +{ + "name": "has-property-descriptors", + "version": "1.0.2", + "description": "Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/has-property-descriptors.git" + }, + "keywords": [ + "property", + "descriptors", + "has", + "environment", + "env", + "defineProperty", + "getOwnPropertyDescriptor" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/has-property-descriptors/issues" + }, + "homepage": "https://github.com/inspect-js/has-property-descriptors#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" + }, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/graphql-subscription-express/node_modules/has-property-descriptors/test/index.js b/graphql-subscription-express/node_modules/has-property-descriptors/test/index.js new file mode 100644 index 0000000..7f02bd3 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-property-descriptors/test/index.js @@ -0,0 +1,57 @@ +'use strict'; + +var test = require('tape'); + +var hasPropertyDescriptors = require('../'); + +var sentinel = {}; + +test('hasPropertyDescriptors', function (t) { + t.equal(typeof hasPropertyDescriptors, 'function', 'is a function'); + t.equal(typeof hasPropertyDescriptors.hasArrayLengthDefineBug, 'function', '`hasArrayLengthDefineBug` property is a function'); + + var yes = hasPropertyDescriptors(); + t.test('property descriptors', { skip: !yes }, function (st) { + var o = { a: sentinel }; + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: true, + value: sentinel, + writable: true + }, + 'has expected property descriptor' + ); + + Object.defineProperty(o, 'a', { enumerable: false, writable: false }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: false, + value: sentinel, + writable: false + }, + 'has expected property descriptor after [[Define]]' + ); + + st.end(); + }); + + var arrayBug = hasPropertyDescriptors.hasArrayLengthDefineBug(); + t.test('defining array lengths', { skip: !yes || arrayBug }, function (st) { + var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays + st.equal(arr.length, 3, 'array starts with length 3'); + + Object.defineProperty(arr, 'length', { value: 5 }); + + st.equal(arr.length, 5, 'array ends with length 5'); + + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/has-proto/.eslintrc b/graphql-subscription-express/node_modules/has-proto/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/graphql-subscription-express/node_modules/has-proto/.github/FUNDING.yml b/graphql-subscription-express/node_modules/has-proto/.github/FUNDING.yml new file mode 100644 index 0000000..613705c --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-proto +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/has-proto/CHANGELOG.md b/graphql-subscription-express/node_modules/has-proto/CHANGELOG.md new file mode 100644 index 0000000..6690f28 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/CHANGELOG.md @@ -0,0 +1,38 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.3](https://github.com/inspect-js/has-proto/compare/v1.0.2...v1.0.3) - 2024-02-19 + +### Commits + +- [types] add missing declaration file [`26ecade`](https://github.com/inspect-js/has-proto/commit/26ecade05d253bb5dc376945ee3186d1fbe334f8) + +## [v1.0.2](https://github.com/inspect-js/has-proto/compare/v1.0.1...v1.0.2) - 2024-02-19 + +### Commits + +- add types [`6435262`](https://github.com/inspect-js/has-proto/commit/64352626cf511c0276d5f4bb6be770a0bf0f8524) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`f16a5e4`](https://github.com/inspect-js/has-proto/commit/f16a5e4121651e551271419f9d60fdd3561fd82c) +- [Refactor] tiny cleanup [`d1f1a4b`](https://github.com/inspect-js/has-proto/commit/d1f1a4bdc135f115a10f148ce302676224534702) +- [meta] add `sideEffects` flag [`e7ab1a6`](https://github.com/inspect-js/has-proto/commit/e7ab1a6f153b3e80dee68d1748b71e46767a0531) + +## [v1.0.1](https://github.com/inspect-js/has-proto/compare/v1.0.0...v1.0.1) - 2022-12-21 + +### Commits + +- [meta] correct URLs and description [`ef34483`](https://github.com/inspect-js/has-proto/commit/ef34483ca0d35680f271b6b96e35526151b25dfc) +- [patch] add an additional criteria [`e81959e`](https://github.com/inspect-js/has-proto/commit/e81959ed7c7a77fbf459f00cb4ef824f1099497f) +- [Dev Deps] update `aud` [`2bec2c4`](https://github.com/inspect-js/has-proto/commit/2bec2c47b072b122ff5443fba0263f6dc649531f) + +## v1.0.0 - 2022-12-12 + +### Commits + +- Initial implementation, tests, readme [`6886fea`](https://github.com/inspect-js/has-proto/commit/6886fea578f67daf69a7920b2eb7637ea6ebb0bc) +- Initial commit [`99129c8`](https://github.com/inspect-js/has-proto/commit/99129c8f42471ac89cb681ba9cb9d52a583eb94f) +- npm init [`2844ad8`](https://github.com/inspect-js/has-proto/commit/2844ad8e75b84d66a46765b3bab9d2e8ea692e10) +- Only apps should have lockfiles [`c65bc5e`](https://github.com/inspect-js/has-proto/commit/c65bc5e40b9004463f7336d47c67245fb139a36a) diff --git a/graphql-subscription-express/node_modules/has-proto/LICENSE b/graphql-subscription-express/node_modules/has-proto/LICENSE new file mode 100644 index 0000000..2e7b9a3 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/has-proto/README.md b/graphql-subscription-express/node_modules/has-proto/README.md new file mode 100644 index 0000000..1456765 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/README.md @@ -0,0 +1,38 @@ +# has-proto [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does this environment have the ability to set the [[Prototype]] of an object on creation with `__proto__`? + +## Example + +```js +var hasProto = require('has-proto'); +var assert = require('assert'); + +assert.equal(typeof hasProto(), 'boolean'); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-proto +[npm-version-svg]: https://versionbadg.es/inspect-js/has-proto.svg +[deps-svg]: https://david-dm.org/inspect-js/has-proto.svg +[deps-url]: https://david-dm.org/inspect-js/has-proto +[dev-deps-svg]: https://david-dm.org/inspect-js/has-proto/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-proto#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-proto.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-proto.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-proto.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-proto +[codecov-image]: https://codecov.io/gh/inspect-js/has-proto/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-proto/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-proto +[actions-url]: https://github.com/inspect-js/has-proto/actions diff --git a/graphql-subscription-express/node_modules/has-proto/index.d.ts b/graphql-subscription-express/node_modules/has-proto/index.d.ts new file mode 100644 index 0000000..cfed695 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/index.d.ts @@ -0,0 +1,3 @@ +declare function hasProto(): boolean; + +export = hasProto; \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/has-proto/index.js b/graphql-subscription-express/node_modules/has-proto/index.js new file mode 100644 index 0000000..d3c8a0a --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var test = { + __proto__: null, + foo: {} +}; + +var $Object = Object; + +/** @type {import('.')} */ +module.exports = function hasProto() { + // @ts-expect-error: TS errors on an inherited property for some reason + return { __proto__: test }.foo === test.foo + && !(test instanceof $Object); +}; diff --git a/graphql-subscription-express/node_modules/has-proto/package.json b/graphql-subscription-express/node_modules/has-proto/package.json new file mode 100644 index 0000000..9d37e4e --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/package.json @@ -0,0 +1,78 @@ +{ + "name": "has-proto", + "version": "1.0.3", + "description": "Does this environment have the ability to get the [[Prototype]] of an object on creation with `__proto__`?", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/has-proto.git" + }, + "keywords": [ + "prototype", + "proto", + "set", + "get", + "__proto__", + "getPrototypeOf", + "setPrototypeOf", + "has" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/has-proto/issues" + }, + "homepage": "https://github.com/inspect-js/has-proto#readme", + "testling": { + "files": "test/index.js" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/graphql-subscription-express/node_modules/has-proto/test/index.js b/graphql-subscription-express/node_modules/has-proto/test/index.js new file mode 100644 index 0000000..5da1a3a --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/test/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var test = require('tape'); +var hasProto = require('../'); + +test('hasProto', function (t) { + var result = hasProto(); + t.equal(typeof result, 'boolean', 'returns a boolean (' + result + ')'); + + var obj = { __proto__: null }; + if (result) { + t.notOk('toString' in obj, 'null object lacks toString'); + } else { + t.ok('toString' in obj, 'without proto, null object has toString'); + t.equal(obj.__proto__, null); // eslint-disable-line no-proto + } + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/has-proto/tsconfig.json b/graphql-subscription-express/node_modules/has-proto/tsconfig.json new file mode 100644 index 0000000..2002ce5 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-proto/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 0, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + //"skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/graphql-subscription-express/node_modules/has-symbols/.eslintrc b/graphql-subscription-express/node_modules/has-symbols/.eslintrc new file mode 100644 index 0000000..2d9a66a --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": 0, + "multiline-comment-style": 0, + } +} diff --git a/graphql-subscription-express/node_modules/has-symbols/.github/FUNDING.yml b/graphql-subscription-express/node_modules/has-symbols/.github/FUNDING.yml new file mode 100644 index 0000000..04cf87e --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-symbols +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/has-symbols/.nycrc b/graphql-subscription-express/node_modules/has-symbols/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/has-symbols/CHANGELOG.md b/graphql-subscription-express/node_modules/has-symbols/CHANGELOG.md new file mode 100644 index 0000000..cd532a2 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/CHANGELOG.md @@ -0,0 +1,75 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.3](https://github.com/inspect-js/has-symbols/compare/v1.0.2...v1.0.3) - 2022-03-01 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`518b28f`](https://github.com/inspect-js/has-symbols/commit/518b28f6c5a516cbccae30794e40aa9f738b1693) +- [meta] add `bugs` and `homepage` fields; reorder package.json [`c480b13`](https://github.com/inspect-js/has-symbols/commit/c480b13fd6802b557e1cef9749872cb5fdeef744) +- [actions] reuse common workflows [`01d0ee0`](https://github.com/inspect-js/has-symbols/commit/01d0ee0a8d97c0947f5edb73eb722027a77b2b07) +- [actions] update codecov uploader [`6424ebe`](https://github.com/inspect-js/has-symbols/commit/6424ebe86b2c9c7c3d2e9bd4413a4e4f168cb275) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`dfa7e7f`](https://github.com/inspect-js/has-symbols/commit/dfa7e7ff38b594645d8c8222aab895157fa7e282) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`0c8d436`](https://github.com/inspect-js/has-symbols/commit/0c8d43685c45189cea9018191d4fd7eca91c9d02) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`9026554`](https://github.com/inspect-js/has-symbols/commit/902655442a1bf88e72b42345494ef0c60f5d36ab) +- [readme] add actions and codecov badges [`eaa9682`](https://github.com/inspect-js/has-symbols/commit/eaa9682f990f481d3acf7a1c7600bec36f7b3adc) +- [Dev Deps] update `eslint`, `tape` [`bc7a3ba`](https://github.com/inspect-js/has-symbols/commit/bc7a3ba46f27b7743f8a2579732d59d1b9ac791e) +- [Dev Deps] update `eslint`, `auto-changelog` [`0ace00a`](https://github.com/inspect-js/has-symbols/commit/0ace00af08a88cdd1e6ce0d60357d941c60c2d9f) +- [meta] use `prepublishOnly` script for npm 7+ [`093f72b`](https://github.com/inspect-js/has-symbols/commit/093f72bc2b0ed00c781f444922a5034257bf561d) +- [Tests] test on all 16 minors [`9b80d3d`](https://github.com/inspect-js/has-symbols/commit/9b80d3d9102529f04c20ec5b1fcc6e38426c6b03) + +## [v1.0.2](https://github.com/inspect-js/has-symbols/compare/v1.0.1...v1.0.2) - 2021-02-27 + +### Fixed + +- [Fix] use a universal way to get the original Symbol [`#11`](https://github.com/inspect-js/has-symbols/issues/11) + +### Commits + +- [Tests] migrate tests to Github Actions [`90ae798`](https://github.com/inspect-js/has-symbols/commit/90ae79820bdfe7bc703d67f5f3c5e205f98556d3) +- [meta] do not publish github action workflow files [`29e60a1`](https://github.com/inspect-js/has-symbols/commit/29e60a1b7c25c7f1acf7acff4a9320d0d10c49b4) +- [Tests] run `nyc` on all tests [`8476b91`](https://github.com/inspect-js/has-symbols/commit/8476b915650d360915abe2522505abf4b0e8f0ae) +- [readme] fix repo URLs, remove defunct badges [`126288e`](https://github.com/inspect-js/has-symbols/commit/126288ecc1797c0a40247a6b78bcb2e0bc5d7036) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `core-js`, `get-own-property-symbols` [`d84bdfa`](https://github.com/inspect-js/has-symbols/commit/d84bdfa48ac5188abbb4904b42614cd6c030940a) +- [Tests] fix linting errors [`0df3070`](https://github.com/inspect-js/has-symbols/commit/0df3070b981b6c9f2ee530c09189a7f5c6def839) +- [actions] add "Allow Edits" workflow [`1e6bc29`](https://github.com/inspect-js/has-symbols/commit/1e6bc29b188f32b9648657b07eda08504be5aa9c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`36cea2a`](https://github.com/inspect-js/has-symbols/commit/36cea2addd4e6ec435f35a2656b4e9ef82498e9b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1278338`](https://github.com/inspect-js/has-symbols/commit/127833801865fbc2cc8979beb9ca869c7bfe8222) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1493254`](https://github.com/inspect-js/has-symbols/commit/1493254eda13db5fb8fc5e4a3e8324b3d196029d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js` [`b090bf2`](https://github.com/inspect-js/has-symbols/commit/b090bf214d3679a30edc1e2d729d466ab5183e1d) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`4addb7a`](https://github.com/inspect-js/has-symbols/commit/4addb7ab4dc73f927ae99928d68817554fc21dc0) +- [Dev Deps] update `auto-changelog`, `tape` [`81d0baf`](https://github.com/inspect-js/has-symbols/commit/81d0baf3816096a89a8558e8043895f7a7d10d8b) +- [Dev Deps] update `auto-changelog`; add `aud` [`1a4e561`](https://github.com/inspect-js/has-symbols/commit/1a4e5612c25d91c3a03d509721d02630bc4fe3da) +- [readme] remove unused testling URLs [`3000941`](https://github.com/inspect-js/has-symbols/commit/3000941f958046e923ed8152edb1ef4a599e6fcc) +- [Tests] only audit prod deps [`692e974`](https://github.com/inspect-js/has-symbols/commit/692e9743c912410e9440207631a643a34b4741a1) +- [Dev Deps] update `@ljharb/eslint-config` [`51c946c`](https://github.com/inspect-js/has-symbols/commit/51c946c7f6baa793ec5390bb5a45cdce16b4ba76) + +## [v1.0.1](https://github.com/inspect-js/has-symbols/compare/v1.0.0...v1.0.1) - 2019-11-16 + +### Commits + +- [Tests] use shared travis-ci configs [`ce396c9`](https://github.com/inspect-js/has-symbols/commit/ce396c9419ff11c43d0da5d05cdbb79f7fb42229) +- [Tests] up to `node` `v12.4`, `v11.15`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.17`, `v4.9`; use `nvm install-latest-npm` [`0690732`](https://github.com/inspect-js/has-symbols/commit/0690732801f47ab429f39ba1962f522d5c462d6b) +- [meta] add `auto-changelog` [`2163d0b`](https://github.com/inspect-js/has-symbols/commit/2163d0b7f36343076b8f947cd1667dd1750f26fc) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `safe-publish-latest`, `tape` [`8e0951f`](https://github.com/inspect-js/has-symbols/commit/8e0951f1a7a2e52068222b7bb73511761e6e4d9c) +- [actions] add automatic rebasing / merge commit blocking [`b09cdb7`](https://github.com/inspect-js/has-symbols/commit/b09cdb7cd7ee39e7a769878f56e2d6066f5ccd1d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `core-js`, `get-own-property-symbols`, `tape` [`1dd42cd`](https://github.com/inspect-js/has-symbols/commit/1dd42cd86183ed0c50f99b1062345c458babca91) +- [meta] create FUNDING.yml [`aa57a17`](https://github.com/inspect-js/has-symbols/commit/aa57a17b19708906d1927f821ea8e73394d84ca4) +- Only apps should have lockfiles [`a2d8bea`](https://github.com/inspect-js/has-symbols/commit/a2d8bea23a97d15c09eaf60f5b107fcf9a4d57aa) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`9e96cb7`](https://github.com/inspect-js/has-symbols/commit/9e96cb783746cbed0c10ef78e599a8eaa7ebe193) +- [meta] add `funding` field [`a0b32cf`](https://github.com/inspect-js/has-symbols/commit/a0b32cf68e803f963c1639b6d47b0a9d6440bab0) +- [Dev Deps] update `safe-publish-latest` [`cb9f0a5`](https://github.com/inspect-js/has-symbols/commit/cb9f0a521a3a1790f1064d437edd33bb6c3d6af0) + +## v1.0.0 - 2016-09-19 + +### Commits + +- Tests. [`ecb6eb9`](https://github.com/inspect-js/has-symbols/commit/ecb6eb934e4883137f3f93b965ba5e0a98df430d) +- package.json [`88a337c`](https://github.com/inspect-js/has-symbols/commit/88a337cee0864a0da35f5d19e69ff0ef0150e46a) +- Initial commit [`42e1e55`](https://github.com/inspect-js/has-symbols/commit/42e1e5502536a2b8ac529c9443984acd14836b1c) +- Initial implementation. [`33f5cc6`](https://github.com/inspect-js/has-symbols/commit/33f5cc6cdff86e2194b081ee842bfdc63caf43fb) +- read me [`01f1170`](https://github.com/inspect-js/has-symbols/commit/01f1170188ff7cb1558aa297f6ba5b516c6d7b0c) diff --git a/graphql-subscription-express/node_modules/has-symbols/LICENSE b/graphql-subscription-express/node_modules/has-symbols/LICENSE new file mode 100644 index 0000000..df31cbf --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/has-symbols/README.md b/graphql-subscription-express/node_modules/has-symbols/README.md new file mode 100644 index 0000000..33905f0 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/README.md @@ -0,0 +1,46 @@ +# has-symbols [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Determine if the JS environment has Symbol support. Supports spec, or shams. + +## Example + +```js +var hasSymbols = require('has-symbols'); + +hasSymbols() === true; // if the environment has native Symbol support. Not polyfillable, not forgeable. + +var hasSymbolsKinda = require('has-symbols/shams'); +hasSymbolsKinda() === true; // if the environment has a Symbol sham that mostly follows the spec. +``` + +## Supported Symbol shams + - get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols) + - core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js) + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/has-symbols +[2]: https://versionbadg.es/inspect-js/has-symbols.svg +[5]: https://david-dm.org/inspect-js/has-symbols.svg +[6]: https://david-dm.org/inspect-js/has-symbols +[7]: https://david-dm.org/inspect-js/has-symbols/dev-status.svg +[8]: https://david-dm.org/inspect-js/has-symbols#info=devDependencies +[11]: https://nodei.co/npm/has-symbols.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-symbols.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-symbols.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-symbols +[codecov-image]: https://codecov.io/gh/inspect-js/has-symbols/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-symbols/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-symbols +[actions-url]: https://github.com/inspect-js/has-symbols/actions diff --git a/graphql-subscription-express/node_modules/has-symbols/index.js b/graphql-subscription-express/node_modules/has-symbols/index.js new file mode 100644 index 0000000..17044fa --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/index.js @@ -0,0 +1,13 @@ +'use strict'; + +var origSymbol = typeof Symbol !== 'undefined' && Symbol; +var hasSymbolSham = require('./shams'); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; diff --git a/graphql-subscription-express/node_modules/has-symbols/package.json b/graphql-subscription-express/node_modules/has-symbols/package.json new file mode 100644 index 0000000..fe7004a --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/package.json @@ -0,0 +1,101 @@ +{ + "name": "has-symbols", + "version": "1.0.3", + "description": "Determine if the JS environment has Symbol support. Supports spec, or shams.", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run --silent lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "npm run test:stock && npm run test:staging && npm run test:shams", + "test:stock": "nyc node test", + "test:staging": "nyc node --harmony --es-staging test", + "test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs", + "test:shams:corejs": "nyc node test/shams/core-js.js", + "test:shams:getownpropertysymbols": "nyc node test/shams/get-own-property-symbols.js", + "lint": "eslint --ext=js,mjs .", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/inspect-js/has-symbols.git" + }, + "keywords": [ + "Symbol", + "symbols", + "typeof", + "sham", + "polyfill", + "native", + "core-js", + "ES6" + ], + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/has-symbols/issues" + }, + "homepage": "https://github.com/ljharb/has-symbols#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.2.3", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "core-js": "^2.6.12", + "eslint": "=8.8.0", + "get-own-property-symbols": "^0.9.5", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.2" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "greenkeeper": { + "ignore": [ + "core-js" + ] + } +} diff --git a/graphql-subscription-express/node_modules/has-symbols/shams.js b/graphql-subscription-express/node_modules/has-symbols/shams.js new file mode 100644 index 0000000..1285210 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/shams.js @@ -0,0 +1,42 @@ +'use strict'; + +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; diff --git a/graphql-subscription-express/node_modules/has-symbols/test/index.js b/graphql-subscription-express/node_modules/has-symbols/test/index.js new file mode 100644 index 0000000..352129c --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/test/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var test = require('tape'); +var hasSymbols = require('../'); +var runSymbolTests = require('./tests'); + +test('interface', function (t) { + t.equal(typeof hasSymbols, 'function', 'is a function'); + t.equal(typeof hasSymbols(), 'boolean', 'returns a boolean'); + t.end(); +}); + +test('Symbols are supported', { skip: !hasSymbols() }, function (t) { + runSymbolTests(t); + t.end(); +}); + +test('Symbols are not supported', { skip: hasSymbols() }, function (t) { + t.equal(typeof Symbol, 'undefined', 'global Symbol is undefined'); + t.equal(typeof Object.getOwnPropertySymbols, 'undefined', 'Object.getOwnPropertySymbols does not exist'); + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/has-symbols/test/shams/core-js.js b/graphql-subscription-express/node_modules/has-symbols/test/shams/core-js.js new file mode 100644 index 0000000..df5365c --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/test/shams/core-js.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbols = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling'); + require('core-js/fn/symbol'); + require('core-js/fn/symbol/to-string-tag'); + + require('../tests')(t); + + var hasSymbolsAfter = hasSymbols(); + t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/has-symbols/test/shams/get-own-property-symbols.js b/graphql-subscription-express/node_modules/has-symbols/test/shams/get-own-property-symbols.js new file mode 100644 index 0000000..9191b24 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/test/shams/get-own-property-symbols.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbols = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling'); + + require('get-own-property-symbols'); + + require('../tests')(t); + + var hasSymbolsAfter = hasSymbols(); + t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/has-symbols/test/tests.js b/graphql-subscription-express/node_modules/has-symbols/test/tests.js new file mode 100644 index 0000000..89edd12 --- /dev/null +++ b/graphql-subscription-express/node_modules/has-symbols/test/tests.js @@ -0,0 +1,56 @@ +'use strict'; + +// eslint-disable-next-line consistent-return +module.exports = function runSymbolTests(t) { + t.equal(typeof Symbol, 'function', 'global Symbol is a function'); + + if (typeof Symbol !== 'function') { return false; } + + t.notEqual(Symbol(), Symbol(), 'two symbols are not equal'); + + /* + t.equal( + Symbol.prototype.toString.call(Symbol('foo')), + Symbol.prototype.toString.call(Symbol('foo')), + 'two symbols with the same description stringify the same' + ); + */ + + /* + var foo = Symbol('foo'); + + t.notEqual( + String(foo), + String(Symbol('bar')), + 'two symbols with different descriptions do not stringify the same' + ); + */ + + t.equal(typeof Symbol.prototype.toString, 'function', 'Symbol#toString is a function'); + // t.equal(String(foo), Symbol.prototype.toString.call(foo), 'Symbol#toString equals String of the same symbol'); + + t.equal(typeof Object.getOwnPropertySymbols, 'function', 'Object.getOwnPropertySymbols is a function'); + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + t.notEqual(typeof sym, 'string', 'Symbol is not a string'); + t.equal(Object.prototype.toString.call(sym), '[object Symbol]', 'symbol primitive Object#toStrings properly'); + t.equal(Object.prototype.toString.call(symObj), '[object Symbol]', 'symbol primitive Object#toStrings properly'); + + var symVal = 42; + obj[sym] = symVal; + // eslint-disable-next-line no-restricted-syntax + for (sym in obj) { t.fail('symbol property key was found in for..in of object'); } + + t.deepEqual(Object.keys(obj), [], 'no enumerable own keys on symbol-valued object'); + t.deepEqual(Object.getOwnPropertyNames(obj), [], 'no own names on symbol-valued object'); + t.deepEqual(Object.getOwnPropertySymbols(obj), [sym], 'one own symbol on symbol-valued object'); + t.equal(Object.prototype.propertyIsEnumerable.call(obj, sym), true, 'symbol is enumerable'); + t.deepEqual(Object.getOwnPropertyDescriptor(obj, sym), { + configurable: true, + enumerable: true, + value: 42, + writable: true + }, 'property descriptor is correct'); +}; diff --git a/graphql-subscription-express/node_modules/hasown/.eslintrc b/graphql-subscription-express/node_modules/hasown/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/graphql-subscription-express/node_modules/hasown/.github/FUNDING.yml b/graphql-subscription-express/node_modules/hasown/.github/FUNDING.yml new file mode 100644 index 0000000..d68c8b7 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/hasown +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/graphql-subscription-express/node_modules/hasown/.nycrc b/graphql-subscription-express/node_modules/hasown/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/hasown/CHANGELOG.md b/graphql-subscription-express/node_modules/hasown/CHANGELOG.md new file mode 100644 index 0000000..2b0a980 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.2](https://github.com/inspect-js/hasOwn/compare/v2.0.1...v2.0.2) - 2024-03-10 + +### Commits + +- [types] use shared config [`68e9d4d`](https://github.com/inspect-js/hasOwn/commit/68e9d4dab6facb4f05f02c6baea94a3f2a4e44b2) +- [actions] remove redundant finisher; use reusable workflow [`241a68e`](https://github.com/inspect-js/hasOwn/commit/241a68e13ea1fe52bec5ba7f74144befc31fae7b) +- [Tests] increase coverage [`4125c0d`](https://github.com/inspect-js/hasOwn/commit/4125c0d6121db56ae30e38346dfb0c000b04f0a7) +- [Tests] skip `npm ls` in old node due to TS [`01b9282`](https://github.com/inspect-js/hasOwn/commit/01b92822f9971dea031eafdd14767df41d61c202) +- [types] improve predicate type [`d340f85`](https://github.com/inspect-js/hasOwn/commit/d340f85ce02e286ef61096cbbb6697081d40a12b) +- [Dev Deps] update `tape` [`70089fc`](https://github.com/inspect-js/hasOwn/commit/70089fcf544e64acc024cbe60f5a9b00acad86de) +- [Tests] use `@arethetypeswrong/cli` [`50b272c`](https://github.com/inspect-js/hasOwn/commit/50b272c829f40d053a3dd91c9796e0ac0b2af084) + +## [v2.0.1](https://github.com/inspect-js/hasOwn/compare/v2.0.0...v2.0.1) - 2024-02-10 + +### Commits + +- [types] use a handwritten d.ts file; fix exported type [`012b989`](https://github.com/inspect-js/hasOwn/commit/012b9898ccf91dc441e2ebf594ff70270a5fda58) +- [Dev Deps] update `@types/function-bind`, `@types/mock-property`, `@types/tape`, `aud`, `mock-property`, `npmignore`, `tape`, `typescript` [`977a56f`](https://github.com/inspect-js/hasOwn/commit/977a56f51a1f8b20566f3c471612137894644025) +- [meta] add `sideEffects` flag [`3a60b7b`](https://github.com/inspect-js/hasOwn/commit/3a60b7bf42fccd8c605e5f145a6fcc83b13cb46f) + +## [v2.0.0](https://github.com/inspect-js/hasOwn/compare/v1.0.1...v2.0.0) - 2023-10-19 + +### Commits + +- revamped implementation, tests, readme [`72bf8b3`](https://github.com/inspect-js/hasOwn/commit/72bf8b338e77a638f0a290c63ffaed18339c36b4) +- [meta] revamp package.json [`079775f`](https://github.com/inspect-js/hasOwn/commit/079775fb1ec72c1c6334069593617a0be3847458) +- Only apps should have lockfiles [`6640e23`](https://github.com/inspect-js/hasOwn/commit/6640e233d1bb8b65260880f90787637db157d215) + +## v1.0.1 - 2023-10-10 + +### Commits + +- Initial commit [`8dbfde6`](https://github.com/inspect-js/hasOwn/commit/8dbfde6e8fb0ebb076fab38d138f2984eb340a62) diff --git a/graphql-subscription-express/node_modules/hasown/LICENSE b/graphql-subscription-express/node_modules/hasown/LICENSE new file mode 100644 index 0000000..0314929 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/hasown/README.md b/graphql-subscription-express/node_modules/hasown/README.md new file mode 100644 index 0000000..f759b8a --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/README.md @@ -0,0 +1,40 @@ +# hasown [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A robust, ES3 compatible, "has own property" predicate. + +## Example + +```js +const assert = require('assert'); +const hasOwn = require('hasown'); + +assert.equal(hasOwn({}, 'toString'), false); +assert.equal(hasOwn([], 'length'), true); +assert.equal(hasOwn({ a: 42 }, 'a'), true); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/hasown +[npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg +[deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg +[deps-url]: https://david-dm.org/inspect-js/hasOwn +[dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/hasown.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/hasown.svg +[downloads-url]: https://npm-stat.com/charts.html?package=hasown +[codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn +[actions-url]: https://github.com/inspect-js/hasOwn/actions diff --git a/graphql-subscription-express/node_modules/hasown/index.d.ts b/graphql-subscription-express/node_modules/hasown/index.d.ts new file mode 100644 index 0000000..aafdf3b --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/index.d.ts @@ -0,0 +1,3 @@ +declare function hasOwn(o: O, p: K): o is O & Record; + +export = hasOwn; diff --git a/graphql-subscription-express/node_modules/hasown/index.js b/graphql-subscription-express/node_modules/hasown/index.js new file mode 100644 index 0000000..34e6059 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/index.js @@ -0,0 +1,8 @@ +'use strict'; + +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; +var bind = require('function-bind'); + +/** @type {import('.')} */ +module.exports = bind.call(call, $hasOwn); diff --git a/graphql-subscription-express/node_modules/hasown/package.json b/graphql-subscription-express/node_modules/hasown/package.json new file mode 100644 index 0000000..8502e13 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/package.json @@ -0,0 +1,92 @@ +{ + "name": "hasown", + "version": "2.0.2", + "description": "A robust, ES3 compatible, \"has own property\" predicate.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/hasOwn.git" + }, + "keywords": [ + "has", + "hasOwnProperty", + "hasOwn", + "has-own", + "own", + "has", + "property", + "in", + "javascript", + "ecmascript" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/hasOwn/issues" + }, + "homepage": "https://github.com/inspect-js/hasOwn#readme", + "dependencies": { + "function-bind": "^1.1.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.2.0", + "@types/function-bind": "^1.1.10", + "@types/mock-property": "^1.0.2", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "mock-property": "^1.0.3", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/graphql-subscription-express/node_modules/hasown/tsconfig.json b/graphql-subscription-express/node_modules/hasown/tsconfig.json new file mode 100644 index 0000000..0930c56 --- /dev/null +++ b/graphql-subscription-express/node_modules/hasown/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@ljharb/tsconfig", + "exclude": [ + "coverage", + ], +} diff --git a/graphql-subscription-express/node_modules/http-errors/HISTORY.md b/graphql-subscription-express/node_modules/http-errors/HISTORY.md new file mode 100644 index 0000000..7228684 --- /dev/null +++ b/graphql-subscription-express/node_modules/http-errors/HISTORY.md @@ -0,0 +1,180 @@ +2.0.0 / 2021-12-17 +================== + + * Drop support for Node.js 0.6 + * Remove `I'mateapot` export; use `ImATeapot` instead + * Remove support for status being non-first argument + * Rename `UnorderedCollection` constructor to `TooEarly` + * deps: depd@2.0.0 + - Replace internal `eval` usage with `Function` constructor + - Use instance methods on `process` to check for listeners + * deps: statuses@2.0.1 + - Fix messaging casing of `418 I'm a Teapot` + - Remove code 306 + - Rename `425 Unordered Collection` to standard `425 Too Early` + +2021-11-14 / 1.8.1 +================== + + * deps: toidentifier@1.0.1 + +2020-06-29 / 1.8.0 +================== + + * Add `isHttpError` export to determine if value is an HTTP error + * deps: setprototypeof@1.2.0 + +2019-06-24 / 1.7.3 +================== + + * deps: inherits@2.0.4 + +2019-02-18 / 1.7.2 +================== + + * deps: setprototypeof@1.1.1 + +2018-09-08 / 1.7.1 +================== + + * Fix error creating objects in some environments + +2018-07-30 / 1.7.0 +================== + + * Set constructor name when possible + * Use `toidentifier` module to make class names + * deps: statuses@'>= 1.5.0 < 2' + +2018-03-29 / 1.6.3 +================== + + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: setprototypeof@1.1.0 + * deps: statuses@'>= 1.4.0 < 2' + +2017-08-04 / 1.6.2 +================== + + * deps: depd@1.1.1 + - Remove unnecessary `Buffer` loading + +2017-02-20 / 1.6.1 +================== + + * deps: setprototypeof@1.0.3 + - Fix shim for old browsers + +2017-02-14 / 1.6.0 +================== + + * Accept custom 4xx and 5xx status codes in factory + * Add deprecation message to `"I'mateapot"` export + * Deprecate passing status code as anything except first argument in factory + * Deprecate using non-error status codes + * Make `message` property enumerable for `HttpError`s + +2016-11-16 / 1.5.1 +================== + + * deps: inherits@2.0.3 + - Fix issue loading in browser + * deps: setprototypeof@1.0.2 + * deps: statuses@'>= 1.3.1 < 2' + +2016-05-18 / 1.5.0 +================== + + * Support new code `421 Misdirected Request` + * Use `setprototypeof` module to replace `__proto__` setting + * deps: statuses@'>= 1.3.0 < 2' + - Add `421 Misdirected Request` + - perf: enable strict mode + * perf: enable strict mode + +2016-01-28 / 1.4.0 +================== + + * Add `HttpError` export, for `err instanceof createError.HttpError` + * deps: inherits@2.0.1 + * deps: statuses@'>= 1.2.1 < 2' + - Fix message for status 451 + - Remove incorrect nginx status code + +2015-02-02 / 1.3.1 +================== + + * Fix regression where status can be overwritten in `createError` `props` + +2015-02-01 / 1.3.0 +================== + + * Construct errors using defined constructors from `createError` + * Fix error names that are not identifiers + - `createError["I'mateapot"]` is now `createError.ImATeapot` + * Set a meaningful `name` property on constructed errors + +2014-12-09 / 1.2.8 +================== + + * Fix stack trace from exported function + * Remove `arguments.callee` usage + +2014-10-14 / 1.2.7 +================== + + * Remove duplicate line + +2014-10-02 / 1.2.6 +================== + + * Fix `expose` to be `true` for `ClientError` constructor + +2014-09-28 / 1.2.5 +================== + + * deps: statuses@1 + +2014-09-21 / 1.2.4 +================== + + * Fix dependency version to work with old `npm`s + +2014-09-21 / 1.2.3 +================== + + * deps: statuses@~1.1.0 + +2014-09-21 / 1.2.2 +================== + + * Fix publish error + +2014-09-21 / 1.2.1 +================== + + * Support Node.js 0.6 + * Use `inherits` instead of `util` + +2014-09-09 / 1.2.0 +================== + + * Fix the way inheriting functions + * Support `expose` being provided in properties argument + +2014-09-08 / 1.1.0 +================== + + * Default status to 500 + * Support provided `error` to extend + +2014-09-08 / 1.0.1 +================== + + * Fix accepting string message + +2014-09-08 / 1.0.0 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/http-errors/LICENSE b/graphql-subscription-express/node_modules/http-errors/LICENSE new file mode 100644 index 0000000..82af4df --- /dev/null +++ b/graphql-subscription-express/node_modules/http-errors/LICENSE @@ -0,0 +1,23 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com +Copyright (c) 2016 Douglas Christopher Wilson doug@somethingdoug.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/http-errors/README.md b/graphql-subscription-express/node_modules/http-errors/README.md new file mode 100644 index 0000000..a8b7330 --- /dev/null +++ b/graphql-subscription-express/node_modules/http-errors/README.md @@ -0,0 +1,169 @@ +# http-errors + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][node-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Create HTTP errors for Express, Koa, Connect, etc. with ease. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```console +$ npm install http-errors +``` + +## Example + +```js +var createError = require('http-errors') +var express = require('express') +var app = express() + +app.use(function (req, res, next) { + if (!req.user) return next(createError(401, 'Please login to view this page.')) + next() +}) +``` + +## API + +This is the current API, currently extracted from Koa and subject to change. + +### Error Properties + +- `expose` - can be used to signal if `message` should be sent to the client, + defaulting to `false` when `status` >= 500 +- `headers` - can be an object of header names to values to be sent to the + client, defaulting to `undefined`. When defined, the key names should all + be lower-cased +- `message` - the traditional error message, which should be kept short and all + single line +- `status` - the status code of the error, mirroring `statusCode` for general + compatibility +- `statusCode` - the status code of the error, defaulting to `500` + +### createError([status], [message], [properties]) + +Create a new error object with the given message `msg`. +The error object inherits from `createError.HttpError`. + +```js +var err = createError(404, 'This video does not exist!') +``` + +- `status: 500` - the status code as a number +- `message` - the message of the error, defaulting to node's text for that status code. +- `properties` - custom properties to attach to the object + +### createError([status], [error], [properties]) + +Extend the given `error` object with `createError.HttpError` +properties. This will not alter the inheritance of the given +`error` object, and the modified `error` object is the +return value. + + + +```js +fs.readFile('foo.txt', function (err, buf) { + if (err) { + if (err.code === 'ENOENT') { + var httpError = createError(404, err, { expose: false }) + } else { + var httpError = createError(500, err) + } + } +}) +``` + +- `status` - the status code as a number +- `error` - the error object to extend +- `properties` - custom properties to attach to the object + +### createError.isHttpError(val) + +Determine if the provided `val` is an `HttpError`. This will return `true` +if the error inherits from the `HttpError` constructor of this module or +matches the "duck type" for an error this module creates. All outputs from +the `createError` factory will return `true` for this function, including +if an non-`HttpError` was passed into the factory. + +### new createError\[code || name\](\[msg]\)) + +Create a new error object with the given message `msg`. +The error object inherits from `createError.HttpError`. + +```js +var err = new createError.NotFound() +``` + +- `code` - the status code as a number +- `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`. + +#### List of all constructors + +|Status Code|Constructor Name | +|-----------|-----------------------------| +|400 |BadRequest | +|401 |Unauthorized | +|402 |PaymentRequired | +|403 |Forbidden | +|404 |NotFound | +|405 |MethodNotAllowed | +|406 |NotAcceptable | +|407 |ProxyAuthenticationRequired | +|408 |RequestTimeout | +|409 |Conflict | +|410 |Gone | +|411 |LengthRequired | +|412 |PreconditionFailed | +|413 |PayloadTooLarge | +|414 |URITooLong | +|415 |UnsupportedMediaType | +|416 |RangeNotSatisfiable | +|417 |ExpectationFailed | +|418 |ImATeapot | +|421 |MisdirectedRequest | +|422 |UnprocessableEntity | +|423 |Locked | +|424 |FailedDependency | +|425 |TooEarly | +|426 |UpgradeRequired | +|428 |PreconditionRequired | +|429 |TooManyRequests | +|431 |RequestHeaderFieldsTooLarge | +|451 |UnavailableForLegalReasons | +|500 |InternalServerError | +|501 |NotImplemented | +|502 |BadGateway | +|503 |ServiceUnavailable | +|504 |GatewayTimeout | +|505 |HTTPVersionNotSupported | +|506 |VariantAlsoNegotiates | +|507 |InsufficientStorage | +|508 |LoopDetected | +|509 |BandwidthLimitExceeded | +|510 |NotExtended | +|511 |NetworkAuthenticationRequired| + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/http-errors/master?label=ci +[ci-url]: https://github.com/jshttp/http-errors/actions?query=workflow%3Aci +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/http-errors/master +[coveralls-url]: https://coveralls.io/r/jshttp/http-errors?branch=master +[node-image]: https://badgen.net/npm/node/http-errors +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/http-errors +[npm-url]: https://npmjs.org/package/http-errors +[npm-version-image]: https://badgen.net/npm/v/http-errors +[travis-image]: https://badgen.net/travis/jshttp/http-errors/master +[travis-url]: https://travis-ci.org/jshttp/http-errors diff --git a/graphql-subscription-express/node_modules/http-errors/index.js b/graphql-subscription-express/node_modules/http-errors/index.js new file mode 100644 index 0000000..c425f1e --- /dev/null +++ b/graphql-subscription-express/node_modules/http-errors/index.js @@ -0,0 +1,289 @@ +/*! + * http-errors + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var deprecate = require('depd')('http-errors') +var setPrototypeOf = require('setprototypeof') +var statuses = require('statuses') +var inherits = require('inherits') +var toIdentifier = require('toidentifier') + +/** + * Module exports. + * @public + */ + +module.exports = createError +module.exports.HttpError = createHttpErrorConstructor() +module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError) + +// Populate exports for all constructors +populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError) + +/** + * Get the code class of a status code. + * @private + */ + +function codeClass (status) { + return Number(String(status).charAt(0) + '00') +} + +/** + * Create a new HTTP Error. + * + * @returns {Error} + * @public + */ + +function createError () { + // so much arity going on ~_~ + var err + var msg + var status = 500 + var props = {} + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i] + var type = typeof arg + if (type === 'object' && arg instanceof Error) { + err = arg + status = err.status || err.statusCode || status + } else if (type === 'number' && i === 0) { + status = arg + } else if (type === 'string') { + msg = arg + } else if (type === 'object') { + props = arg + } else { + throw new TypeError('argument #' + (i + 1) + ' unsupported type ' + type) + } + } + + if (typeof status === 'number' && (status < 400 || status >= 600)) { + deprecate('non-error status code; use only 4xx or 5xx status codes') + } + + if (typeof status !== 'number' || + (!statuses.message[status] && (status < 400 || status >= 600))) { + status = 500 + } + + // constructor + var HttpError = createError[status] || createError[codeClass(status)] + + if (!err) { + // create error + err = HttpError + ? new HttpError(msg) + : new Error(msg || statuses.message[status]) + Error.captureStackTrace(err, createError) + } + + if (!HttpError || !(err instanceof HttpError) || err.status !== status) { + // add properties to generic error + err.expose = status < 500 + err.status = err.statusCode = status + } + + for (var key in props) { + if (key !== 'status' && key !== 'statusCode') { + err[key] = props[key] + } + } + + return err +} + +/** + * Create HTTP error abstract base class. + * @private + */ + +function createHttpErrorConstructor () { + function HttpError () { + throw new TypeError('cannot construct abstract class') + } + + inherits(HttpError, Error) + + return HttpError +} + +/** + * Create a constructor for a client error. + * @private + */ + +function createClientErrorConstructor (HttpError, name, code) { + var className = toClassName(name) + + function ClientError (message) { + // create the error object + var msg = message != null ? message : statuses.message[code] + var err = new Error(msg) + + // capture a stack trace to the construction point + Error.captureStackTrace(err, ClientError) + + // adjust the [[Prototype]] + setPrototypeOf(err, ClientError.prototype) + + // redefine the error message + Object.defineProperty(err, 'message', { + enumerable: true, + configurable: true, + value: msg, + writable: true + }) + + // redefine the error name + Object.defineProperty(err, 'name', { + enumerable: false, + configurable: true, + value: className, + writable: true + }) + + return err + } + + inherits(ClientError, HttpError) + nameFunc(ClientError, className) + + ClientError.prototype.status = code + ClientError.prototype.statusCode = code + ClientError.prototype.expose = true + + return ClientError +} + +/** + * Create function to test is a value is a HttpError. + * @private + */ + +function createIsHttpErrorFunction (HttpError) { + return function isHttpError (val) { + if (!val || typeof val !== 'object') { + return false + } + + if (val instanceof HttpError) { + return true + } + + return val instanceof Error && + typeof val.expose === 'boolean' && + typeof val.statusCode === 'number' && val.status === val.statusCode + } +} + +/** + * Create a constructor for a server error. + * @private + */ + +function createServerErrorConstructor (HttpError, name, code) { + var className = toClassName(name) + + function ServerError (message) { + // create the error object + var msg = message != null ? message : statuses.message[code] + var err = new Error(msg) + + // capture a stack trace to the construction point + Error.captureStackTrace(err, ServerError) + + // adjust the [[Prototype]] + setPrototypeOf(err, ServerError.prototype) + + // redefine the error message + Object.defineProperty(err, 'message', { + enumerable: true, + configurable: true, + value: msg, + writable: true + }) + + // redefine the error name + Object.defineProperty(err, 'name', { + enumerable: false, + configurable: true, + value: className, + writable: true + }) + + return err + } + + inherits(ServerError, HttpError) + nameFunc(ServerError, className) + + ServerError.prototype.status = code + ServerError.prototype.statusCode = code + ServerError.prototype.expose = false + + return ServerError +} + +/** + * Set the name of a function, if possible. + * @private + */ + +function nameFunc (func, name) { + var desc = Object.getOwnPropertyDescriptor(func, 'name') + + if (desc && desc.configurable) { + desc.value = name + Object.defineProperty(func, 'name', desc) + } +} + +/** + * Populate the exports object with constructors for every error class. + * @private + */ + +function populateConstructorExports (exports, codes, HttpError) { + codes.forEach(function forEachCode (code) { + var CodeError + var name = toIdentifier(statuses.message[code]) + + switch (codeClass(code)) { + case 400: + CodeError = createClientErrorConstructor(HttpError, name, code) + break + case 500: + CodeError = createServerErrorConstructor(HttpError, name, code) + break + } + + if (CodeError) { + // export the constructor + exports[code] = CodeError + exports[name] = CodeError + } + }) +} + +/** + * Get a class name from a name identifier. + * @private + */ + +function toClassName (name) { + return name.substr(-5) !== 'Error' + ? name + 'Error' + : name +} diff --git a/graphql-subscription-express/node_modules/http-errors/package.json b/graphql-subscription-express/node_modules/http-errors/package.json new file mode 100644 index 0000000..4cb6d7e --- /dev/null +++ b/graphql-subscription-express/node_modules/http-errors/package.json @@ -0,0 +1,50 @@ +{ + "name": "http-errors", + "description": "Create HTTP error objects", + "version": "2.0.0", + "author": "Jonathan Ong (http://jongleberry.com)", + "contributors": [ + "Alan Plum ", + "Douglas Christopher Wilson " + ], + "license": "MIT", + "repository": "jshttp/http-errors", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.1.3", + "nyc": "15.1.0" + }, + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "lint": "eslint . && node ./scripts/lint-readme-list.js", + "test": "mocha --reporter spec --bail", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" + }, + "keywords": [ + "http", + "error" + ], + "files": [ + "index.js", + "HISTORY.md", + "LICENSE", + "README.md" + ] +} diff --git a/graphql-subscription-express/node_modules/iconv-lite/Changelog.md b/graphql-subscription-express/node_modules/iconv-lite/Changelog.md new file mode 100644 index 0000000..f252313 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/Changelog.md @@ -0,0 +1,162 @@ +# 0.4.24 / 2018-08-22 + + * Added MIK encoding (#196, by @Ivan-Kalatchev) + + +# 0.4.23 / 2018-05-07 + + * Fix deprecation warning in Node v10 due to the last usage of `new Buffer` (#185, by @felixbuenemann) + * Switched from NodeBuffer to Buffer in typings (#155 by @felixfbecker, #186 by @larssn) + + +# 0.4.22 / 2018-05-05 + + * Use older semver style for dependencies to be compatible with Node version 0.10 (#182, by @dougwilson) + * Fix tests to accomodate fixes in Node v10 (#182, by @dougwilson) + + +# 0.4.21 / 2018-04-06 + + * Fix encoding canonicalization (#156) + * Fix the paths in the "browser" field in package.json (#174 by @LMLB) + * Removed "contributors" section in package.json - see Git history instead. + + +# 0.4.20 / 2018-04-06 + + * Updated `new Buffer()` usages with recommended replacements as it's being deprecated in Node v10 (#176, #178 by @ChALkeR) + + +# 0.4.19 / 2017-09-09 + + * Fixed iso8859-1 codec regression in handling untranslatable characters (#162, caused by #147) + * Re-generated windows1255 codec, because it was updated in iconv project + * Fixed grammar in error message when iconv-lite is loaded with encoding other than utf8 + + +# 0.4.18 / 2017-06-13 + + * Fixed CESU-8 regression in Node v8. + + +# 0.4.17 / 2017-04-22 + + * Updated typescript definition file to support Angular 2 AoT mode (#153 by @larssn) + + +# 0.4.16 / 2017-04-22 + + * Added support for React Native (#150) + * Changed iso8859-1 encoding to usine internal 'binary' encoding, as it's the same thing (#147 by @mscdex) + * Fixed typo in Readme (#138 by @jiangzhuo) + * Fixed build for Node v6.10+ by making correct version comparison + * Added a warning if iconv-lite is loaded not as utf-8 (see #142) + + +# 0.4.15 / 2016-11-21 + + * Fixed typescript type definition (#137) + + +# 0.4.14 / 2016-11-20 + + * Preparation for v1.0 + * Added Node v6 and latest Node versions to Travis CI test rig + * Deprecated Node v0.8 support + * Typescript typings (@larssn) + * Fix encoding of Euro character in GB 18030 (inspired by @lygstate) + * Add ms prefix to dbcs windows encodings (@rokoroku) + + +# 0.4.13 / 2015-10-01 + + * Fix silly mistake in deprecation notice. + + +# 0.4.12 / 2015-09-26 + + * Node v4 support: + * Added CESU-8 decoding (#106) + * Added deprecation notice for `extendNodeEncodings` + * Added Travis tests for Node v4 and io.js latest (#105 by @Mithgol) + + +# 0.4.11 / 2015-07-03 + + * Added CESU-8 encoding. + + +# 0.4.10 / 2015-05-26 + + * Changed UTF-16 endianness heuristic to take into account any ASCII chars, not + just spaces. This should minimize the importance of "default" endianness. + + +# 0.4.9 / 2015-05-24 + + * Streamlined BOM handling: strip BOM by default, add BOM when encoding if + addBOM: true. Added docs to Readme. + * UTF16 now uses UTF16-LE by default. + * Fixed minor issue with big5 encoding. + * Added io.js testing on Travis; updated node-iconv version to test against. + Now we just skip testing SBCS encodings that node-iconv doesn't support. + * (internal refactoring) Updated codec interface to use classes. + * Use strict mode in all files. + + +# 0.4.8 / 2015-04-14 + + * added alias UNICODE-1-1-UTF-7 for UTF-7 encoding (#94) + + +# 0.4.7 / 2015-02-05 + + * stop official support of Node.js v0.8. Should still work, but no guarantees. + reason: Packages needed for testing are hard to get on Travis CI. + * work in environment where Object.prototype is monkey patched with enumerable + props (#89). + + +# 0.4.6 / 2015-01-12 + + * fix rare aliases of single-byte encodings (thanks @mscdex) + * double the timeout for dbcs tests to make them less flaky on travis + + +# 0.4.5 / 2014-11-20 + + * fix windows-31j and x-sjis encoding support (@nleush) + * minor fix: undefined variable reference when internal error happens + + +# 0.4.4 / 2014-07-16 + + * added encodings UTF-7 (RFC2152) and UTF-7-IMAP (RFC3501 Section 5.1.3) + * fixed streaming base64 encoding + + +# 0.4.3 / 2014-06-14 + + * added encodings UTF-16BE and UTF-16 with BOM + + +# 0.4.2 / 2014-06-12 + + * don't throw exception if `extendNodeEncodings()` is called more than once + + +# 0.4.1 / 2014-06-11 + + * codepage 808 added + + +# 0.4.0 / 2014-06-10 + + * code is rewritten from scratch + * all widespread encodings are supported + * streaming interface added + * browserify compatibility added + * (optional) extend core primitive encodings to make usage even simpler + * moved from vows to mocha as the testing framework + + diff --git a/graphql-subscription-express/node_modules/iconv-lite/LICENSE b/graphql-subscription-express/node_modules/iconv-lite/LICENSE new file mode 100644 index 0000000..d518d83 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2011 Alexander Shtuchkin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/graphql-subscription-express/node_modules/iconv-lite/README.md b/graphql-subscription-express/node_modules/iconv-lite/README.md new file mode 100644 index 0000000..c981c37 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/README.md @@ -0,0 +1,156 @@ +## Pure JS character encoding conversion [![Build Status](https://travis-ci.org/ashtuchkin/iconv-lite.svg?branch=master)](https://travis-ci.org/ashtuchkin/iconv-lite) + + * Doesn't need native code compilation. Works on Windows and in sandboxed environments like [Cloud9](http://c9.io). + * Used in popular projects like [Express.js (body_parser)](https://github.com/expressjs/body-parser), + [Grunt](http://gruntjs.com/), [Nodemailer](http://www.nodemailer.com/), [Yeoman](http://yeoman.io/) and others. + * Faster than [node-iconv](https://github.com/bnoordhuis/node-iconv) (see below for performance comparison). + * Intuitive encode/decode API + * Streaming support for Node v0.10+ + * [Deprecated] Can extend Node.js primitives (buffers, streams) to support all iconv-lite encodings. + * In-browser usage via [Browserify](https://github.com/substack/node-browserify) (~180k gzip compressed with Buffer shim included). + * Typescript [type definition file](https://github.com/ashtuchkin/iconv-lite/blob/master/lib/index.d.ts) included. + * React Native is supported (need to explicitly `npm install` two more modules: `buffer` and `stream`). + * License: MIT. + +[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/) + +## Usage +### Basic API +```javascript +var iconv = require('iconv-lite'); + +// Convert from an encoded buffer to js string. +str = iconv.decode(Buffer.from([0x68, 0x65, 0x6c, 0x6c, 0x6f]), 'win1251'); + +// Convert from js string to an encoded buffer. +buf = iconv.encode("Sample input string", 'win1251'); + +// Check if encoding is supported +iconv.encodingExists("us-ascii") +``` + +### Streaming API (Node v0.10+) +```javascript + +// Decode stream (from binary stream to js strings) +http.createServer(function(req, res) { + var converterStream = iconv.decodeStream('win1251'); + req.pipe(converterStream); + + converterStream.on('data', function(str) { + console.log(str); // Do something with decoded strings, chunk-by-chunk. + }); +}); + +// Convert encoding streaming example +fs.createReadStream('file-in-win1251.txt') + .pipe(iconv.decodeStream('win1251')) + .pipe(iconv.encodeStream('ucs2')) + .pipe(fs.createWriteStream('file-in-ucs2.txt')); + +// Sugar: all encode/decode streams have .collect(cb) method to accumulate data. +http.createServer(function(req, res) { + req.pipe(iconv.decodeStream('win1251')).collect(function(err, body) { + assert(typeof body == 'string'); + console.log(body); // full request body string + }); +}); +``` + +### [Deprecated] Extend Node.js own encodings +> NOTE: This doesn't work on latest Node versions. See [details](https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility). + +```javascript +// After this call all Node basic primitives will understand iconv-lite encodings. +iconv.extendNodeEncodings(); + +// Examples: +buf = new Buffer(str, 'win1251'); +buf.write(str, 'gbk'); +str = buf.toString('latin1'); +assert(Buffer.isEncoding('iso-8859-15')); +Buffer.byteLength(str, 'us-ascii'); + +http.createServer(function(req, res) { + req.setEncoding('big5'); + req.collect(function(err, body) { + console.log(body); + }); +}); + +fs.createReadStream("file.txt", "shift_jis"); + +// External modules are also supported (if they use Node primitives, which they probably do). +request = require('request'); +request({ + url: "http://github.com/", + encoding: "cp932" +}); + +// To remove extensions +iconv.undoExtendNodeEncodings(); +``` + +## Supported encodings + + * All node.js native encodings: utf8, ucs2 / utf16-le, ascii, binary, base64, hex. + * Additional unicode encodings: utf16, utf16-be, utf-7, utf-7-imap. + * All widespread singlebyte encodings: Windows 125x family, ISO-8859 family, + IBM/DOS codepages, Macintosh family, KOI8 family, all others supported by iconv library. + Aliases like 'latin1', 'us-ascii' also supported. + * All widespread multibyte encodings: CP932, CP936, CP949, CP950, GB2312, GBK, GB18030, Big5, Shift_JIS, EUC-JP. + +See [all supported encodings on wiki](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings). + +Most singlebyte encodings are generated automatically from [node-iconv](https://github.com/bnoordhuis/node-iconv). Thank you Ben Noordhuis and libiconv authors! + +Multibyte encodings are generated from [Unicode.org mappings](http://www.unicode.org/Public/MAPPINGS/) and [WHATWG Encoding Standard mappings](http://encoding.spec.whatwg.org/). Thank you, respective authors! + + +## Encoding/decoding speed + +Comparison with node-iconv module (1000x256kb, on MacBook Pro, Core i5/2.6 GHz, Node v0.12.0). +Note: your results may vary, so please always check on your hardware. + + operation iconv@2.1.4 iconv-lite@0.4.7 + ---------------------------------------------------------- + encode('win1251') ~96 Mb/s ~320 Mb/s + decode('win1251') ~95 Mb/s ~246 Mb/s + +## BOM handling + + * Decoding: BOM is stripped by default, unless overridden by passing `stripBOM: false` in options + (f.ex. `iconv.decode(buf, enc, {stripBOM: false})`). + A callback might also be given as a `stripBOM` parameter - it'll be called if BOM character was actually found. + * If you want to detect UTF-8 BOM when decoding other encodings, use [node-autodetect-decoder-stream](https://github.com/danielgindi/node-autodetect-decoder-stream) module. + * Encoding: No BOM added, unless overridden by `addBOM: true` option. + +## UTF-16 Encodings + +This library supports UTF-16LE, UTF-16BE and UTF-16 encodings. First two are straightforward, but UTF-16 is trying to be +smart about endianness in the following ways: + * Decoding: uses BOM and 'spaces heuristic' to determine input endianness. Default is UTF-16LE, but can be + overridden with `defaultEncoding: 'utf-16be'` option. Strips BOM unless `stripBOM: false`. + * Encoding: uses UTF-16LE and writes BOM by default. Use `addBOM: false` to override. + +## Other notes + +When decoding, be sure to supply a Buffer to decode() method, otherwise [bad things usually happen](https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding). +Untranslatable characters are set to � or ?. No transliteration is currently supported. +Node versions 0.10.31 and 0.11.13 are buggy, don't use them (see #65, #77). + +## Testing + +```bash +$ git clone git@github.com:ashtuchkin/iconv-lite.git +$ cd iconv-lite +$ npm install +$ npm test + +$ # To view performance: +$ node test/performance.js + +$ # To view test coverage: +$ npm run coverage +$ open coverage/lcov-report/index.html +``` diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-codec.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-codec.js new file mode 100644 index 0000000..1fe3e16 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-codec.js @@ -0,0 +1,555 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Multibyte codec. In this scheme, a character is represented by 1 or more bytes. +// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences. +// To save memory and loading time, we read table files only when requested. + +exports._dbcs = DBCSCodec; + +var UNASSIGNED = -1, + GB18030_CODE = -2, + SEQ_START = -10, + NODE_START = -1000, + UNASSIGNED_NODE = new Array(0x100), + DEF_CHAR = -1; + +for (var i = 0; i < 0x100; i++) + UNASSIGNED_NODE[i] = UNASSIGNED; + + +// Class DBCSCodec reads and initializes mapping tables. +function DBCSCodec(codecOptions, iconv) { + this.encodingName = codecOptions.encodingName; + if (!codecOptions) + throw new Error("DBCS codec is called without the data.") + if (!codecOptions.table) + throw new Error("Encoding '" + this.encodingName + "' has no data."); + + // Load tables. + var mappingTable = codecOptions.table(); + + + // Decode tables: MBCS -> Unicode. + + // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256. + // Trie root is decodeTables[0]. + // Values: >= 0 -> unicode character code. can be > 0xFFFF + // == UNASSIGNED -> unknown/unassigned sequence. + // == GB18030_CODE -> this is the end of a GB18030 4-byte sequence. + // <= NODE_START -> index of the next node in our trie to process next byte. + // <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq. + this.decodeTables = []; + this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node. + + // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. + this.decodeTableSeq = []; + + // Actual mapping tables consist of chunks. Use them to fill up decode tables. + for (var i = 0; i < mappingTable.length; i++) + this._addDecodeChunk(mappingTable[i]); + + this.defaultCharUnicode = iconv.defaultCharUnicode; + + + // Encode tables: Unicode -> DBCS. + + // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance. + // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null. + // Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.). + // == UNASSIGNED -> no conversion found. Output a default char. + // <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence. + this.encodeTable = []; + + // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of + // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key + // means end of sequence (needed when one sequence is a strict subsequence of another). + // Objects are kept separately from encodeTable to increase performance. + this.encodeTableSeq = []; + + // Some chars can be decoded, but need not be encoded. + var skipEncodeChars = {}; + if (codecOptions.encodeSkipVals) + for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) { + var val = codecOptions.encodeSkipVals[i]; + if (typeof val === 'number') + skipEncodeChars[val] = true; + else + for (var j = val.from; j <= val.to; j++) + skipEncodeChars[j] = true; + } + + // Use decode trie to recursively fill out encode tables. + this._fillEncodeTable(0, 0, skipEncodeChars); + + // Add more encoding pairs when needed. + if (codecOptions.encodeAdd) { + for (var uChar in codecOptions.encodeAdd) + if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) + this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]); + } + + this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)]; + if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?']; + if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0); + + + // Load & create GB18030 tables when needed. + if (typeof codecOptions.gb18030 === 'function') { + this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. + + // Add GB18030 decode tables. + var thirdByteNodeIdx = this.decodeTables.length; + var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + var fourthByteNodeIdx = this.decodeTables.length; + var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + for (var i = 0x81; i <= 0xFE; i++) { + var secondByteNodeIdx = NODE_START - this.decodeTables[0][i]; + var secondByteNode = this.decodeTables[secondByteNodeIdx]; + for (var j = 0x30; j <= 0x39; j++) + secondByteNode[j] = NODE_START - thirdByteNodeIdx; + } + for (var i = 0x81; i <= 0xFE; i++) + thirdByteNode[i] = NODE_START - fourthByteNodeIdx; + for (var i = 0x30; i <= 0x39; i++) + fourthByteNode[i] = GB18030_CODE + } +} + +DBCSCodec.prototype.encoder = DBCSEncoder; +DBCSCodec.prototype.decoder = DBCSDecoder; + +// Decoder helpers +DBCSCodec.prototype._getDecodeTrieNode = function(addr) { + var bytes = []; + for (; addr > 0; addr >>= 8) + bytes.push(addr & 0xFF); + if (bytes.length == 0) + bytes.push(0); + + var node = this.decodeTables[0]; + for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie. + var val = node[bytes[i]]; + + if (val == UNASSIGNED) { // Create new node. + node[bytes[i]] = NODE_START - this.decodeTables.length; + this.decodeTables.push(node = UNASSIGNED_NODE.slice(0)); + } + else if (val <= NODE_START) { // Existing node. + node = this.decodeTables[NODE_START - val]; + } + else + throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16)); + } + return node; +} + + +DBCSCodec.prototype._addDecodeChunk = function(chunk) { + // First element of chunk is the hex mbcs code where we start. + var curAddr = parseInt(chunk[0], 16); + + // Choose the decoding node where we'll write our chars. + var writeTable = this._getDecodeTrieNode(curAddr); + curAddr = curAddr & 0xFF; + + // Write all other elements of the chunk to the table. + for (var k = 1; k < chunk.length; k++) { + var part = chunk[k]; + if (typeof part === "string") { // String, write as-is. + for (var l = 0; l < part.length;) { + var code = part.charCodeAt(l++); + if (0xD800 <= code && code < 0xDC00) { // Decode surrogate + var codeTrail = part.charCodeAt(l++); + if (0xDC00 <= codeTrail && codeTrail < 0xE000) + writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00); + else + throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]); + } + else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used) + var len = 0xFFF - code + 2; + var seq = []; + for (var m = 0; m < len; m++) + seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq. + + writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length; + this.decodeTableSeq.push(seq); + } + else + writeTable[curAddr++] = code; // Basic char + } + } + else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character. + var charCode = writeTable[curAddr - 1] + 1; + for (var l = 0; l < part; l++) + writeTable[curAddr++] = charCode++; + } + else + throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]); + } + if (curAddr > 0xFF) + throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr); +} + +// Encoder helpers +DBCSCodec.prototype._getEncodeBucket = function(uCode) { + var high = uCode >> 8; // This could be > 0xFF because of astral characters. + if (this.encodeTable[high] === undefined) + this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand. + return this.encodeTable[high]; +} + +DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) { + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + if (bucket[low] <= SEQ_START) + this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it. + else if (bucket[low] == UNASSIGNED) + bucket[low] = dbcsCode; +} + +DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) { + + // Get the root of character tree according to first character of the sequence. + var uCode = seq[0]; + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + + var node; + if (bucket[low] <= SEQ_START) { + // There's already a sequence with - use it. + node = this.encodeTableSeq[SEQ_START-bucket[low]]; + } + else { + // There was no sequence object - allocate a new one. + node = {}; + if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence. + bucket[low] = SEQ_START - this.encodeTableSeq.length; + this.encodeTableSeq.push(node); + } + + // Traverse the character tree, allocating new nodes as needed. + for (var j = 1; j < seq.length-1; j++) { + var oldVal = node[uCode]; + if (typeof oldVal === 'object') + node = oldVal; + else { + node = node[uCode] = {} + if (oldVal !== undefined) + node[DEF_CHAR] = oldVal + } + } + + // Set the leaf to given dbcsCode. + uCode = seq[seq.length-1]; + node[uCode] = dbcsCode; +} + +DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) { + var node = this.decodeTables[nodeIdx]; + for (var i = 0; i < 0x100; i++) { + var uCode = node[i]; + var mbCode = prefix + i; + if (skipEncodeChars[mbCode]) + continue; + + if (uCode >= 0) + this._setEncodeChar(uCode, mbCode); + else if (uCode <= NODE_START) + this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars); + else if (uCode <= SEQ_START) + this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode); + } +} + + + +// == Encoder ================================================================== + +function DBCSEncoder(options, codec) { + // Encoder state + this.leadSurrogate = -1; + this.seqObj = undefined; + + // Static data + this.encodeTable = codec.encodeTable; + this.encodeTableSeq = codec.encodeTableSeq; + this.defaultCharSingleByte = codec.defCharSB; + this.gb18030 = codec.gb18030; +} + +DBCSEncoder.prototype.write = function(str) { + var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), + leadSurrogate = this.leadSurrogate, + seqObj = this.seqObj, nextChar = -1, + i = 0, j = 0; + + while (true) { + // 0. Get next character. + if (nextChar === -1) { + if (i == str.length) break; + var uCode = str.charCodeAt(i++); + } + else { + var uCode = nextChar; + nextChar = -1; + } + + // 1. Handle surrogates. + if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates. + if (uCode < 0xDC00) { // We've got lead surrogate. + if (leadSurrogate === -1) { + leadSurrogate = uCode; + continue; + } else { + leadSurrogate = uCode; + // Double lead surrogate found. + uCode = UNASSIGNED; + } + } else { // We've got trail surrogate. + if (leadSurrogate !== -1) { + uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00); + leadSurrogate = -1; + } else { + // Incomplete surrogate pair - only trail surrogate found. + uCode = UNASSIGNED; + } + + } + } + else if (leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char. + leadSurrogate = -1; + } + + // 2. Convert uCode character. + var dbcsCode = UNASSIGNED; + if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence + var resCode = seqObj[uCode]; + if (typeof resCode === 'object') { // Sequence continues. + seqObj = resCode; + continue; + + } else if (typeof resCode == 'number') { // Sequence finished. Write it. + dbcsCode = resCode; + + } else if (resCode == undefined) { // Current character is not part of the sequence. + + // Try default character for this sequence + resCode = seqObj[DEF_CHAR]; + if (resCode !== undefined) { + dbcsCode = resCode; // Found. Write it. + nextChar = uCode; // Current character will be written too in the next iteration. + + } else { + // TODO: What if we have no default? (resCode == undefined) + // Then, we should write first char of the sequence as-is and try the rest recursively. + // Didn't do it for now because no encoding has this situation yet. + // Currently, just skip the sequence and write current char. + } + } + seqObj = undefined; + } + else if (uCode >= 0) { // Regular character + var subtable = this.encodeTable[uCode >> 8]; + if (subtable !== undefined) + dbcsCode = subtable[uCode & 0xFF]; + + if (dbcsCode <= SEQ_START) { // Sequence start + seqObj = this.encodeTableSeq[SEQ_START-dbcsCode]; + continue; + } + + if (dbcsCode == UNASSIGNED && this.gb18030) { + // Use GB18030 algorithm to find character(s) to write. + var idx = findIdx(this.gb18030.uChars, uCode); + if (idx != -1) { + var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]); + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600; + newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260; + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10; + newBuf[j++] = 0x30 + dbcsCode; + continue; + } + } + } + + // 3. Write dbcsCode character. + if (dbcsCode === UNASSIGNED) + dbcsCode = this.defaultCharSingleByte; + + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else if (dbcsCode < 0x10000) { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + else { + newBuf[j++] = dbcsCode >> 16; + newBuf[j++] = (dbcsCode >> 8) & 0xFF; + newBuf[j++] = dbcsCode & 0xFF; + } + } + + this.seqObj = seqObj; + this.leadSurrogate = leadSurrogate; + return newBuf.slice(0, j); +} + +DBCSEncoder.prototype.end = function() { + if (this.leadSurrogate === -1 && this.seqObj === undefined) + return; // All clean. Most often case. + + var newBuf = Buffer.alloc(10), j = 0; + + if (this.seqObj) { // We're in the sequence. + var dbcsCode = this.seqObj[DEF_CHAR]; + if (dbcsCode !== undefined) { // Write beginning of the sequence. + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + } else { + // See todo above. + } + this.seqObj = undefined; + } + + if (this.leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + newBuf[j++] = this.defaultCharSingleByte; + this.leadSurrogate = -1; + } + + return newBuf.slice(0, j); +} + +// Export for testing +DBCSEncoder.prototype.findIdx = findIdx; + + +// == Decoder ================================================================== + +function DBCSDecoder(options, codec) { + // Decoder state + this.nodeIdx = 0; + this.prevBuf = Buffer.alloc(0); + + // Static data + this.decodeTables = codec.decodeTables; + this.decodeTableSeq = codec.decodeTableSeq; + this.defaultCharUnicode = codec.defaultCharUnicode; + this.gb18030 = codec.gb18030; +} + +DBCSDecoder.prototype.write = function(buf) { + var newBuf = Buffer.alloc(buf.length*2), + nodeIdx = this.nodeIdx, + prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, + seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence. + uCode; + + if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later. + prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]); + + for (var i = 0, j = 0; i < buf.length; i++) { + var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset]; + + // Lookup in current trie node. + var uCode = this.decodeTables[nodeIdx][curByte]; + + if (uCode >= 0) { + // Normal character, just use it. + } + else if (uCode === UNASSIGNED) { // Unknown char. + // TODO: Callback with seq. + //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle). + uCode = this.defaultCharUnicode.charCodeAt(0); + } + else if (uCode === GB18030_CODE) { + var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30); + var idx = findIdx(this.gb18030.gbChars, ptr); + uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx]; + } + else if (uCode <= NODE_START) { // Go to next trie node. + nodeIdx = NODE_START - uCode; + continue; + } + else if (uCode <= SEQ_START) { // Output a sequence of chars. + var seq = this.decodeTableSeq[SEQ_START - uCode]; + for (var k = 0; k < seq.length - 1; k++) { + uCode = seq[k]; + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + } + uCode = seq[seq.length-1]; + } + else + throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte); + + // Write the character to buffer, handling higher planes using surrogate pair. + if (uCode > 0xFFFF) { + uCode -= 0x10000; + var uCodeLead = 0xD800 + Math.floor(uCode / 0x400); + newBuf[j++] = uCodeLead & 0xFF; + newBuf[j++] = uCodeLead >> 8; + + uCode = 0xDC00 + uCode % 0x400; + } + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + + // Reset trie node. + nodeIdx = 0; seqStart = i+1; + } + + this.nodeIdx = nodeIdx; + this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset); + return newBuf.slice(0, j).toString('ucs2'); +} + +DBCSDecoder.prototype.end = function() { + var ret = ''; + + // Try to parse all remaining chars. + while (this.prevBuf.length > 0) { + // Skip 1 character in the buffer. + ret += this.defaultCharUnicode; + var buf = this.prevBuf.slice(1); + + // Parse remaining as usual. + this.prevBuf = Buffer.alloc(0); + this.nodeIdx = 0; + if (buf.length > 0) + ret += this.write(buf); + } + + this.nodeIdx = 0; + return ret; +} + +// Binary search for GB18030. Returns largest i such that table[i] <= val. +function findIdx(table, val) { + if (table[0] > val) + return -1; + + var l = 0, r = table.length; + while (l < r-1) { // always table[l] <= val < table[r] + var mid = l + Math.floor((r-l+1)/2); + if (table[mid] <= val) + l = mid; + else + r = mid; + } + return l; +} + diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-data.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-data.js new file mode 100644 index 0000000..4b61914 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/dbcs-data.js @@ -0,0 +1,176 @@ +"use strict"; + +// Description of supported double byte encodings and aliases. +// Tables are not require()-d until they are needed to speed up library load. +// require()-s are direct to support Browserify. + +module.exports = { + + // == Japanese/ShiftJIS ==================================================== + // All japanese encodings are based on JIS X set of standards: + // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF. + // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. + // Has several variations in 1978, 1983, 1990 and 1997. + // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead. + // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233. + // 2 planes, first is superset of 0208, second - revised 0212. + // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx) + + // Byte encodings are: + // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte + // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC. + // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI. + // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes. + // 0x00-0x7F - lower part of 0201 + // 0x8E, 0xA1-0xDF - upper part of 0201 + // (0xA1-0xFE)x2 - 0208 plane (94x94). + // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94). + // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon. + // Used as-is in ISO2022 family. + // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, + // 0201-1976 Roman, 0208-1978, 0208-1983. + // * ISO2022-JP-1: Adds esc seq for 0212-1990. + // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7. + // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2. + // * ISO2022-JP-2004: Adds 0213-2004 Plane 1. + // + // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes. + // + // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html + + 'shiftjis': { + type: '_dbcs', + table: function() { return require('./tables/shiftjis.json') }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + encodeSkipVals: [{from: 0xED40, to: 0xF940}], + }, + 'csshiftjis': 'shiftjis', + 'mskanji': 'shiftjis', + 'sjis': 'shiftjis', + 'windows31j': 'shiftjis', + 'ms31j': 'shiftjis', + 'xsjis': 'shiftjis', + 'windows932': 'shiftjis', + 'ms932': 'shiftjis', + '932': 'shiftjis', + 'cp932': 'shiftjis', + + 'eucjp': { + type: '_dbcs', + table: function() { return require('./tables/eucjp.json') }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + }, + + // TODO: KDDI extension to Shift_JIS + // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes. + // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars. + + + // == Chinese/GBK ========================================================== + // http://en.wikipedia.org/wiki/GBK + // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder + + // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936 + 'gb2312': 'cp936', + 'gb231280': 'cp936', + 'gb23121980': 'cp936', + 'csgb2312': 'cp936', + 'csiso58gb231280': 'cp936', + 'euccn': 'cp936', + + // Microsoft's CP936 is a subset and approximation of GBK. + 'windows936': 'cp936', + 'ms936': 'cp936', + '936': 'cp936', + 'cp936': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json') }, + }, + + // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other. + 'gbk': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, + }, + 'xgbk': 'gbk', + 'isoir58': 'gbk', + + // GB18030 is an algorithmic extension of GBK. + // Main source: https://www.w3.org/TR/encoding/#gbk-encoder + // http://icu-project.org/docs/papers/gb18030.html + // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml + // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0 + 'gb18030': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, + gb18030: function() { return require('./tables/gb18030-ranges.json') }, + encodeSkipVals: [0x80], + encodeAdd: {'€': 0xA2E3}, + }, + + 'chinese': 'gb18030', + + + // == Korean =============================================================== + // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same. + 'windows949': 'cp949', + 'ms949': 'cp949', + '949': 'cp949', + 'cp949': { + type: '_dbcs', + table: function() { return require('./tables/cp949.json') }, + }, + + 'cseuckr': 'cp949', + 'csksc56011987': 'cp949', + 'euckr': 'cp949', + 'isoir149': 'cp949', + 'korean': 'cp949', + 'ksc56011987': 'cp949', + 'ksc56011989': 'cp949', + 'ksc5601': 'cp949', + + + // == Big5/Taiwan/Hong Kong ================================================ + // There are lots of tables for Big5 and cp950. Please see the following links for history: + // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html + // Variations, in roughly number of defined chars: + // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT + // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/ + // * Big5-2003 (Taiwan standard) almost superset of cp950. + // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers. + // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. + // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years. + // Plus, it has 4 combining sequences. + // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299 + // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way. + // Implementations are not consistent within browsers; sometimes labeled as just big5. + // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied. + // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31 + // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s. + // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt + // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt + // + // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder + // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong. + + 'windows950': 'cp950', + 'ms950': 'cp950', + '950': 'cp950', + 'cp950': { + type: '_dbcs', + table: function() { return require('./tables/cp950.json') }, + }, + + // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus. + 'big5': 'big5hkscs', + 'big5hkscs': { + type: '_dbcs', + table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) }, + encodeSkipVals: [0xa2cc], + }, + + 'cnbig5': 'big5hkscs', + 'csbig5': 'big5hkscs', + 'xxbig5': 'big5hkscs', +}; diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/index.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/index.js new file mode 100644 index 0000000..e304003 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/index.js @@ -0,0 +1,22 @@ +"use strict"; + +// Update this array if you add/rename/remove files in this directory. +// We support Browserify by skipping automatic module discovery and requiring modules directly. +var modules = [ + require("./internal"), + require("./utf16"), + require("./utf7"), + require("./sbcs-codec"), + require("./sbcs-data"), + require("./sbcs-data-generated"), + require("./dbcs-codec"), + require("./dbcs-data"), +]; + +// Put all encoding/alias/codec definitions to single object and export it. +for (var i = 0; i < modules.length; i++) { + var module = modules[i]; + for (var enc in module) + if (Object.prototype.hasOwnProperty.call(module, enc)) + exports[enc] = module[enc]; +} diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/internal.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/internal.js new file mode 100644 index 0000000..05ce38b --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/internal.js @@ -0,0 +1,188 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Export Node.js internal encodings. + +module.exports = { + // Encodings + utf8: { type: "_internal", bomAware: true}, + cesu8: { type: "_internal", bomAware: true}, + unicode11utf8: "utf8", + + ucs2: { type: "_internal", bomAware: true}, + utf16le: "ucs2", + + binary: { type: "_internal" }, + base64: { type: "_internal" }, + hex: { type: "_internal" }, + + // Codec. + _internal: InternalCodec, +}; + +//------------------------------------------------------------------------------ + +function InternalCodec(codecOptions, iconv) { + this.enc = codecOptions.encodingName; + this.bomAware = codecOptions.bomAware; + + if (this.enc === "base64") + this.encoder = InternalEncoderBase64; + else if (this.enc === "cesu8") { + this.enc = "utf8"; // Use utf8 for decoding. + this.encoder = InternalEncoderCesu8; + + // Add decoder for versions of Node not supporting CESU-8 + if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { + this.decoder = InternalDecoderCesu8; + this.defaultCharUnicode = iconv.defaultCharUnicode; + } + } +} + +InternalCodec.prototype.encoder = InternalEncoder; +InternalCodec.prototype.decoder = InternalDecoder; + +//------------------------------------------------------------------------------ + +// We use node.js internal decoder. Its signature is the same as ours. +var StringDecoder = require('string_decoder').StringDecoder; + +if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. + StringDecoder.prototype.end = function() {}; + + +function InternalDecoder(options, codec) { + StringDecoder.call(this, codec.enc); +} + +InternalDecoder.prototype = StringDecoder.prototype; + + +//------------------------------------------------------------------------------ +// Encoder is mostly trivial + +function InternalEncoder(options, codec) { + this.enc = codec.enc; +} + +InternalEncoder.prototype.write = function(str) { + return Buffer.from(str, this.enc); +} + +InternalEncoder.prototype.end = function() { +} + + +//------------------------------------------------------------------------------ +// Except base64 encoder, which must keep its state. + +function InternalEncoderBase64(options, codec) { + this.prevStr = ''; +} + +InternalEncoderBase64.prototype.write = function(str) { + str = this.prevStr + str; + var completeQuads = str.length - (str.length % 4); + this.prevStr = str.slice(completeQuads); + str = str.slice(0, completeQuads); + + return Buffer.from(str, "base64"); +} + +InternalEncoderBase64.prototype.end = function() { + return Buffer.from(this.prevStr, "base64"); +} + + +//------------------------------------------------------------------------------ +// CESU-8 encoder is also special. + +function InternalEncoderCesu8(options, codec) { +} + +InternalEncoderCesu8.prototype.write = function(str) { + var buf = Buffer.alloc(str.length * 3), bufIdx = 0; + for (var i = 0; i < str.length; i++) { + var charCode = str.charCodeAt(i); + // Naive implementation, but it works because CESU-8 is especially easy + // to convert from UTF-16 (which all JS strings are encoded in). + if (charCode < 0x80) + buf[bufIdx++] = charCode; + else if (charCode < 0x800) { + buf[bufIdx++] = 0xC0 + (charCode >>> 6); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + else { // charCode will always be < 0x10000 in javascript. + buf[bufIdx++] = 0xE0 + (charCode >>> 12); + buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + } + return buf.slice(0, bufIdx); +} + +InternalEncoderCesu8.prototype.end = function() { +} + +//------------------------------------------------------------------------------ +// CESU-8 decoder is not implemented in Node v4.0+ + +function InternalDecoderCesu8(options, codec) { + this.acc = 0; + this.contBytes = 0; + this.accBytes = 0; + this.defaultCharUnicode = codec.defaultCharUnicode; +} + +InternalDecoderCesu8.prototype.write = function(buf) { + var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, + res = ''; + for (var i = 0; i < buf.length; i++) { + var curByte = buf[i]; + if ((curByte & 0xC0) !== 0x80) { // Leading byte + if (contBytes > 0) { // Previous code is invalid + res += this.defaultCharUnicode; + contBytes = 0; + } + + if (curByte < 0x80) { // Single-byte code + res += String.fromCharCode(curByte); + } else if (curByte < 0xE0) { // Two-byte code + acc = curByte & 0x1F; + contBytes = 1; accBytes = 1; + } else if (curByte < 0xF0) { // Three-byte code + acc = curByte & 0x0F; + contBytes = 2; accBytes = 1; + } else { // Four or more are not supported for CESU-8. + res += this.defaultCharUnicode; + } + } else { // Continuation byte + if (contBytes > 0) { // We're waiting for it. + acc = (acc << 6) | (curByte & 0x3f); + contBytes--; accBytes++; + if (contBytes === 0) { + // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80) + if (accBytes === 2 && acc < 0x80 && acc > 0) + res += this.defaultCharUnicode; + else if (accBytes === 3 && acc < 0x800) + res += this.defaultCharUnicode; + else + // Actually add character. + res += String.fromCharCode(acc); + } + } else { // Unexpected continuation byte + res += this.defaultCharUnicode; + } + } + } + this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; + return res; +} + +InternalDecoderCesu8.prototype.end = function() { + var res = 0; + if (this.contBytes > 0) + res += this.defaultCharUnicode; + return res; +} diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-codec.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-codec.js new file mode 100644 index 0000000..abac5ff --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-codec.js @@ -0,0 +1,72 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that +// correspond to encoded bytes (if 128 - then lower half is ASCII). + +exports._sbcs = SBCSCodec; +function SBCSCodec(codecOptions, iconv) { + if (!codecOptions) + throw new Error("SBCS codec is called without the data.") + + // Prepare char buffer for decoding. + if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)) + throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)"); + + if (codecOptions.chars.length === 128) { + var asciiString = ""; + for (var i = 0; i < 128; i++) + asciiString += String.fromCharCode(i); + codecOptions.chars = asciiString + codecOptions.chars; + } + + this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2'); + + // Encoding buffer. + var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0)); + + for (var i = 0; i < codecOptions.chars.length; i++) + encodeBuf[codecOptions.chars.charCodeAt(i)] = i; + + this.encodeBuf = encodeBuf; +} + +SBCSCodec.prototype.encoder = SBCSEncoder; +SBCSCodec.prototype.decoder = SBCSDecoder; + + +function SBCSEncoder(options, codec) { + this.encodeBuf = codec.encodeBuf; +} + +SBCSEncoder.prototype.write = function(str) { + var buf = Buffer.alloc(str.length); + for (var i = 0; i < str.length; i++) + buf[i] = this.encodeBuf[str.charCodeAt(i)]; + + return buf; +} + +SBCSEncoder.prototype.end = function() { +} + + +function SBCSDecoder(options, codec) { + this.decodeBuf = codec.decodeBuf; +} + +SBCSDecoder.prototype.write = function(buf) { + // Strings are immutable in JS -> we use ucs2 buffer to speed up computations. + var decodeBuf = this.decodeBuf; + var newBuf = Buffer.alloc(buf.length*2); + var idx1 = 0, idx2 = 0; + for (var i = 0; i < buf.length; i++) { + idx1 = buf[i]*2; idx2 = i*2; + newBuf[idx2] = decodeBuf[idx1]; + newBuf[idx2+1] = decodeBuf[idx1+1]; + } + return newBuf.toString('ucs2'); +} + +SBCSDecoder.prototype.end = function() { +} diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data-generated.js new file mode 100644 index 0000000..9b48236 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data-generated.js @@ -0,0 +1,451 @@ +"use strict"; + +// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script. +module.exports = { + "437": "cp437", + "737": "cp737", + "775": "cp775", + "850": "cp850", + "852": "cp852", + "855": "cp855", + "856": "cp856", + "857": "cp857", + "858": "cp858", + "860": "cp860", + "861": "cp861", + "862": "cp862", + "863": "cp863", + "864": "cp864", + "865": "cp865", + "866": "cp866", + "869": "cp869", + "874": "windows874", + "922": "cp922", + "1046": "cp1046", + "1124": "cp1124", + "1125": "cp1125", + "1129": "cp1129", + "1133": "cp1133", + "1161": "cp1161", + "1162": "cp1162", + "1163": "cp1163", + "1250": "windows1250", + "1251": "windows1251", + "1252": "windows1252", + "1253": "windows1253", + "1254": "windows1254", + "1255": "windows1255", + "1256": "windows1256", + "1257": "windows1257", + "1258": "windows1258", + "28591": "iso88591", + "28592": "iso88592", + "28593": "iso88593", + "28594": "iso88594", + "28595": "iso88595", + "28596": "iso88596", + "28597": "iso88597", + "28598": "iso88598", + "28599": "iso88599", + "28600": "iso885910", + "28601": "iso885911", + "28603": "iso885913", + "28604": "iso885914", + "28605": "iso885915", + "28606": "iso885916", + "windows874": { + "type": "_sbcs", + "chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "win874": "windows874", + "cp874": "windows874", + "windows1250": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "win1250": "windows1250", + "cp1250": "windows1250", + "windows1251": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "win1251": "windows1251", + "cp1251": "windows1251", + "windows1252": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "win1252": "windows1252", + "cp1252": "windows1252", + "windows1253": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "win1253": "windows1253", + "cp1253": "windows1253", + "windows1254": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "win1254": "windows1254", + "cp1254": "windows1254", + "windows1255": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "win1255": "windows1255", + "cp1255": "windows1255", + "windows1256": { + "type": "_sbcs", + "chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے" + }, + "win1256": "windows1256", + "cp1256": "windows1256", + "windows1257": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙" + }, + "win1257": "windows1257", + "cp1257": "windows1257", + "windows1258": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "win1258": "windows1258", + "cp1258": "windows1258", + "iso88591": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28591": "iso88591", + "iso88592": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "cp28592": "iso88592", + "iso88593": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ħ˘£¤�Ĥ§¨İŞĞĴ­�Ż°ħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙" + }, + "cp28593": "iso88593", + "iso88594": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĸŖ¤ĨĻ§¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖ×ØŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙" + }, + "cp28594": "iso88594", + "iso88595": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ" + }, + "cp28595": "iso88595", + "iso88596": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ���¤�������،­�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������" + }, + "cp28596": "iso88596", + "iso88597": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ‘’£€₯¦§¨©ͺ«¬­�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "cp28597": "iso88597", + "iso88598": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "cp28598": "iso88598", + "iso88599": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "cp28599": "iso88599", + "iso885910": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĒĢĪĨĶ§ĻĐŠŦŽ­ŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ" + }, + "cp28600": "iso885910", + "iso885911": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "cp28601": "iso885911", + "iso885913": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’" + }, + "cp28603": "iso885913", + "iso885914": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ­®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ" + }, + "cp28604": "iso885914", + "iso885915": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28605": "iso885915", + "iso885916": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄąŁ€„Š§š©Ș«Ź­źŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ" + }, + "cp28606": "iso885916", + "cp437": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm437": "cp437", + "csibm437": "cp437", + "cp737": { + "type": "_sbcs", + "chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ " + }, + "ibm737": "cp737", + "csibm737": "cp737", + "cp775": { + "type": "_sbcs", + "chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£ØפĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’­±“¾¶§÷„°∙·¹³²■ " + }, + "ibm775": "cp775", + "csibm775": "cp775", + "cp850": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm850": "cp850", + "csibm850": "cp850", + "cp852": { + "type": "_sbcs", + "chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ " + }, + "ibm852": "cp852", + "csibm852": "cp852", + "cp855": { + "type": "_sbcs", + "chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№­ыЫзЗшШэЭщЩчЧ§■ " + }, + "ibm855": "cp855", + "csibm855": "cp855", + "cp856": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm856": "cp856", + "csibm856": "cp856", + "cp857": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ " + }, + "ibm857": "cp857", + "csibm857": "cp857", + "cp858": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm858": "cp858", + "csibm858": "cp858", + "cp860": { + "type": "_sbcs", + "chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm860": "cp860", + "csibm860": "cp860", + "cp861": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm861": "cp861", + "csibm861": "cp861", + "cp862": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm862": "cp862", + "csibm862": "cp862", + "cp863": { + "type": "_sbcs", + "chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm863": "cp863", + "csibm863": "cp863", + "cp864": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�" + }, + "ibm864": "cp864", + "csibm864": "cp864", + "cp865": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm865": "cp865", + "csibm865": "cp865", + "cp866": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ " + }, + "ibm866": "cp866", + "csibm866": "cp866", + "cp869": { + "type": "_sbcs", + "chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ " + }, + "ibm869": "cp869", + "csibm869": "cp869", + "cp922": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖ×ØÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ" + }, + "ibm922": "cp922", + "csibm922": "cp922", + "cp1046": { + "type": "_sbcs", + "chars": "ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�" + }, + "ibm1046": "cp1046", + "csibm1046": "cp1046", + "cp1124": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ" + }, + "ibm1124": "cp1124", + "csibm1124": "cp1124", + "cp1125": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ " + }, + "ibm1125": "cp1125", + "csibm1125": "cp1125", + "cp1129": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1129": "cp1129", + "csibm1129": "cp1129", + "cp1133": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�" + }, + "ibm1133": "cp1133", + "csibm1133": "cp1133", + "cp1161": { + "type": "_sbcs", + "chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ " + }, + "ibm1161": "cp1161", + "csibm1161": "cp1161", + "cp1162": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "ibm1162": "cp1162", + "csibm1162": "cp1162", + "cp1163": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1163": "cp1163", + "csibm1163": "cp1163", + "maccroatian": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ" + }, + "maccyrillic": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "macgreek": { + "type": "_sbcs", + "chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�" + }, + "maciceland": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macroman": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macromania": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macthai": { + "type": "_sbcs", + "chars": "«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู​–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����" + }, + "macturkish": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macukraine": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "koi8r": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8u": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8ru": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8t": { + "type": "_sbcs", + "chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬­®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "armscii8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�" + }, + "rk1048": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬­®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "tcvn": { + "type": "_sbcs", + "chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ" + }, + "georgianacademy": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "georgianps": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "pt154": { + "type": "_sbcs", + "chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "viscii": { + "type": "_sbcs", + "chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ" + }, + "iso646cn": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "iso646jp": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "hproman8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�" + }, + "macintosh": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "ascii": { + "type": "_sbcs", + "chars": "��������������������������������������������������������������������������������������������������������������������������������" + }, + "tis620": { + "type": "_sbcs", + "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + } +} \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data.js new file mode 100644 index 0000000..fdb81a3 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/sbcs-data.js @@ -0,0 +1,174 @@ +"use strict"; + +// Manually added data to be used by sbcs codec in addition to generated one. + +module.exports = { + // Not supported by iconv, not sure why. + "10029": "maccenteuro", + "maccenteuro": { + "type": "_sbcs", + "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" + }, + + "808": "cp808", + "ibm808": "cp808", + "cp808": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " + }, + + "mik": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + + // Aliases of generated encodings. + "ascii8bit": "ascii", + "usascii": "ascii", + "ansix34": "ascii", + "ansix341968": "ascii", + "ansix341986": "ascii", + "csascii": "ascii", + "cp367": "ascii", + "ibm367": "ascii", + "isoir6": "ascii", + "iso646us": "ascii", + "iso646irv": "ascii", + "us": "ascii", + + "latin1": "iso88591", + "latin2": "iso88592", + "latin3": "iso88593", + "latin4": "iso88594", + "latin5": "iso88599", + "latin6": "iso885910", + "latin7": "iso885913", + "latin8": "iso885914", + "latin9": "iso885915", + "latin10": "iso885916", + + "csisolatin1": "iso88591", + "csisolatin2": "iso88592", + "csisolatin3": "iso88593", + "csisolatin4": "iso88594", + "csisolatincyrillic": "iso88595", + "csisolatinarabic": "iso88596", + "csisolatingreek" : "iso88597", + "csisolatinhebrew": "iso88598", + "csisolatin5": "iso88599", + "csisolatin6": "iso885910", + + "l1": "iso88591", + "l2": "iso88592", + "l3": "iso88593", + "l4": "iso88594", + "l5": "iso88599", + "l6": "iso885910", + "l7": "iso885913", + "l8": "iso885914", + "l9": "iso885915", + "l10": "iso885916", + + "isoir14": "iso646jp", + "isoir57": "iso646cn", + "isoir100": "iso88591", + "isoir101": "iso88592", + "isoir109": "iso88593", + "isoir110": "iso88594", + "isoir144": "iso88595", + "isoir127": "iso88596", + "isoir126": "iso88597", + "isoir138": "iso88598", + "isoir148": "iso88599", + "isoir157": "iso885910", + "isoir166": "tis620", + "isoir179": "iso885913", + "isoir199": "iso885914", + "isoir203": "iso885915", + "isoir226": "iso885916", + + "cp819": "iso88591", + "ibm819": "iso88591", + + "cyrillic": "iso88595", + + "arabic": "iso88596", + "arabic8": "iso88596", + "ecma114": "iso88596", + "asmo708": "iso88596", + + "greek" : "iso88597", + "greek8" : "iso88597", + "ecma118" : "iso88597", + "elot928" : "iso88597", + + "hebrew": "iso88598", + "hebrew8": "iso88598", + + "turkish": "iso88599", + "turkish8": "iso88599", + + "thai": "iso885911", + "thai8": "iso885911", + + "celtic": "iso885914", + "celtic8": "iso885914", + "isoceltic": "iso885914", + + "tis6200": "tis620", + "tis62025291": "tis620", + "tis62025330": "tis620", + + "10000": "macroman", + "10006": "macgreek", + "10007": "maccyrillic", + "10079": "maciceland", + "10081": "macturkish", + + "cspc8codepage437": "cp437", + "cspc775baltic": "cp775", + "cspc850multilingual": "cp850", + "cspcp852": "cp852", + "cspc862latinhebrew": "cp862", + "cpgr": "cp869", + + "msee": "cp1250", + "mscyrl": "cp1251", + "msansi": "cp1252", + "msgreek": "cp1253", + "msturk": "cp1254", + "mshebr": "cp1255", + "msarab": "cp1256", + "winbaltrim": "cp1257", + + "cp20866": "koi8r", + "20866": "koi8r", + "ibm878": "koi8r", + "cskoi8r": "koi8r", + + "cp21866": "koi8u", + "21866": "koi8u", + "ibm1168": "koi8u", + + "strk10482002": "rk1048", + + "tcvn5712": "tcvn", + "tcvn57121": "tcvn", + + "gb198880": "iso646cn", + "cn": "iso646cn", + + "csiso14jisc6220ro": "iso646jp", + "jisc62201969ro": "iso646jp", + "jp": "iso646jp", + + "cshproman8": "hproman8", + "r8": "hproman8", + "roman8": "hproman8", + "xroman8": "hproman8", + "ibm1051": "hproman8", + + "mac": "macintosh", + "csmacintosh": "macintosh", +}; + diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/big5-added.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/big5-added.json new file mode 100644 index 0000000..3c3d3c2 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/big5-added.json @@ -0,0 +1,122 @@ +[ +["8740","䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"], +["8767","綕夝𨮹㷴霴𧯯寛𡵞媤㘥𩺰嫑宷峼杮薓𩥅瑡璝㡵𡵓𣚞𦀡㻬"], +["87a1","𥣞㫵竼龗𤅡𨤍𣇪𠪊𣉞䌊蒄龖鐯䤰蘓墖靊鈘秐稲晠権袝瑌篅枂稬剏遆㓦珄𥶹瓆鿇垳䤯呌䄱𣚎堘穲𧭥讏䚮𦺈䆁𥶙箮𢒼鿈𢓁𢓉𢓌鿉蔄𣖻䂴鿊䓡𪷿拁灮鿋"], +["8840","㇀",4,"𠄌㇅𠃑𠃍㇆㇇𠃋𡿨㇈𠃊㇉㇊㇋㇌𠄎㇍㇎ĀÁǍÀĒÉĚÈŌÓǑÒ࿿Ê̄Ế࿿Ê̌ỀÊāáǎàɑēéěèīíǐìōóǒòūúǔùǖǘǚ"], +["88a1","ǜü࿿ê̄ế࿿ê̌ềêɡ⏚⏛"], +["8940","𪎩𡅅"], +["8943","攊"], +["8946","丽滝鵎釟"], +["894c","𧜵撑会伨侨兖兴农凤务动医华发变团声处备夲头学实実岚庆总斉柾栄桥济炼电纤纬纺织经统缆缷艺苏药视设询车轧轮"], +["89a1","琑糼緍楆竉刧"], +["89ab","醌碸酞肼"], +["89b0","贋胶𠧧"], +["89b5","肟黇䳍鷉鸌䰾𩷶𧀎鸊𪄳㗁"], +["89c1","溚舾甙"], +["89c5","䤑马骏龙禇𨑬𡷊𠗐𢫦两亁亀亇亿仫伷㑌侽㹈倃傈㑽㒓㒥円夅凛凼刅争剹劐匧㗇厩㕑厰㕓参吣㕭㕲㚁咓咣咴咹哐哯唘唣唨㖘唿㖥㖿嗗㗅"], +["8a40","𧶄唥"], +["8a43","𠱂𠴕𥄫喐𢳆㧬𠍁蹆𤶸𩓥䁓𨂾睺𢰸㨴䟕𨅝𦧲𤷪擝𠵼𠾴𠳕𡃴撍蹾𠺖𠰋𠽤𢲩𨉖𤓓"], +["8a64","𠵆𩩍𨃩䟴𤺧𢳂骲㩧𩗴㿭㔆𥋇𩟔𧣈𢵄鵮頕"], +["8a76","䏙𦂥撴哣𢵌𢯊𡁷㧻𡁯"], +["8aa1","𦛚𦜖𧦠擪𥁒𠱃蹨𢆡𨭌𠜱"], +["8aac","䠋𠆩㿺塳𢶍"], +["8ab2","𤗈𠓼𦂗𠽌𠶖啹䂻䎺"], +["8abb","䪴𢩦𡂝膪飵𠶜捹㧾𢝵跀嚡摼㹃"], +["8ac9","𪘁𠸉𢫏𢳉"], +["8ace","𡃈𣧂㦒㨆𨊛㕸𥹉𢃇噒𠼱𢲲𩜠㒼氽𤸻"], +["8adf","𧕴𢺋𢈈𪙛𨳍𠹺𠰴𦠜羓𡃏𢠃𢤹㗻𥇣𠺌𠾍𠺪㾓𠼰𠵇𡅏𠹌"], +["8af6","𠺫𠮩𠵈𡃀𡄽㿹𢚖搲𠾭"], +["8b40","𣏴𧘹𢯎𠵾𠵿𢱑𢱕㨘𠺘𡃇𠼮𪘲𦭐𨳒𨶙𨳊閪哌苄喹"], +["8b55","𩻃鰦骶𧝞𢷮煀腭胬尜𦕲脴㞗卟𨂽醶𠻺𠸏𠹷𠻻㗝𤷫㘉𠳖嚯𢞵𡃉𠸐𠹸𡁸𡅈𨈇𡑕𠹹𤹐𢶤婔𡀝𡀞𡃵𡃶垜𠸑"], +["8ba1","𧚔𨋍𠾵𠹻𥅾㜃𠾶𡆀𥋘𪊽𤧚𡠺𤅷𨉼墙剨㘚𥜽箲孨䠀䬬鼧䧧鰟鮍𥭴𣄽嗻㗲嚉丨夂𡯁屮靑𠂆乛亻㔾尣彑忄㣺扌攵歺氵氺灬爫丬犭𤣩罒礻糹罓𦉪㓁"], +["8bde","𦍋耂肀𦘒𦥑卝衤见𧢲讠贝钅镸长门𨸏韦页风飞饣𩠐鱼鸟黄歯龜丷𠂇阝户钢"], +["8c40","倻淾𩱳龦㷉袏𤅎灷峵䬠𥇍㕙𥴰愢𨨲辧釶熑朙玺𣊁𪄇㲋𡦀䬐磤琂冮𨜏䀉橣𪊺䈣蘏𠩯稪𩥇𨫪靕灍匤𢁾鏴盙𨧣龧矝亣俰傼丯众龨吴綋墒壐𡶶庒庙忂𢜒斋"], +["8ca1","𣏹椙橃𣱣泿"], +["8ca7","爀𤔅玌㻛𤨓嬕璹讃𥲤𥚕窓篬糃繬苸薗龩袐龪躹龫迏蕟駠鈡龬𨶹𡐿䁱䊢娚"], +["8cc9","顨杫䉶圽"], +["8cce","藖𤥻芿𧄍䲁𦵴嵻𦬕𦾾龭龮宖龯曧繛湗秊㶈䓃𣉖𢞖䎚䔶"], +["8ce6","峕𣬚諹屸㴒𣕑嵸龲煗䕘𤃬𡸣䱷㥸㑊𠆤𦱁諌侴𠈹妿腬顖𩣺弻"], +["8d40","𠮟"], +["8d42","𢇁𨥭䄂䚻𩁹㼇龳𪆵䃸㟖䛷𦱆䅼𨚲𧏿䕭㣔𥒚䕡䔛䶉䱻䵶䗪㿈𤬏㙡䓞䒽䇭崾嵈嵖㷼㠏嶤嶹㠠㠸幂庽弥徃㤈㤔㤿㥍惗愽峥㦉憷憹懏㦸戬抐拥挘㧸嚱"], +["8da1","㨃揢揻搇摚㩋擀崕嘡龟㪗斆㪽旿晓㫲暒㬢朖㭂枤栀㭘桊梄㭲㭱㭻椉楃牜楤榟榅㮼槖㯝橥橴橱檂㯬檙㯲檫檵櫔櫶殁毁毪汵沪㳋洂洆洦涁㳯涤涱渕渘温溆𨧀溻滢滚齿滨滩漤漴㵆𣽁澁澾㵪㵵熷岙㶊瀬㶑灐灔灯灿炉𠌥䏁㗱𠻘"], +["8e40","𣻗垾𦻓焾𥟠㙎榢𨯩孴穉𥣡𩓙穥穽𥦬窻窰竂竃燑𦒍䇊竚竝竪䇯咲𥰁笋筕笩𥌎𥳾箢筯莜𥮴𦱿篐萡箒箸𥴠㶭𥱥蒒篺簆簵𥳁籄粃𤢂粦晽𤕸糉糇糦籴糳糵糎"], +["8ea1","繧䔝𦹄絝𦻖璍綉綫焵綳緒𤁗𦀩緤㴓緵𡟹緥𨍭縝𦄡𦅚繮纒䌫鑬縧罀罁罇礶𦋐駡羗𦍑羣𡙡𠁨䕜𣝦䔃𨌺翺𦒉者耈耝耨耯𪂇𦳃耻耼聡𢜔䦉𦘦𣷣𦛨朥肧𨩈脇脚墰𢛶汿𦒘𤾸擧𡒊舘𡡞橓𤩥𤪕䑺舩𠬍𦩒𣵾俹𡓽蓢荢𦬊𤦧𣔰𡝳𣷸芪椛芳䇛"], +["8f40","蕋苐茚𠸖𡞴㛁𣅽𣕚艻苢茘𣺋𦶣𦬅𦮗𣗎㶿茝嗬莅䔋𦶥莬菁菓㑾𦻔橗蕚㒖𦹂𢻯葘𥯤葱㷓䓤檧葊𣲵祘蒨𦮖𦹷𦹃蓞萏莑䒠蒓蓤𥲑䉀𥳀䕃蔴嫲𦺙䔧蕳䔖枿蘖"], +["8fa1","𨘥𨘻藁𧂈蘂𡖂𧃍䕫䕪蘨㙈𡢢号𧎚虾蝱𪃸蟮𢰧螱蟚蠏噡虬桖䘏衅衆𧗠𣶹𧗤衞袜䙛袴袵揁装睷𧜏覇覊覦覩覧覼𨨥觧𧤤𧪽誜瞓釾誐𧩙竩𧬺𣾏䜓𧬸煼謌謟𥐰𥕥謿譌譍誩𤩺讐讛誯𡛟䘕衏貛𧵔𧶏貫㜥𧵓賖𧶘𧶽贒贃𡤐賛灜贑𤳉㻐起"], +["9040","趩𨀂𡀔𤦊㭼𨆼𧄌竧躭躶軃鋔輙輭𨍥𨐒辥錃𪊟𠩐辳䤪𨧞𨔽𣶻廸𣉢迹𪀔𨚼𨔁𢌥㦀𦻗逷𨔼𧪾遡𨕬𨘋邨𨜓郄𨛦邮都酧㫰醩釄粬𨤳𡺉鈎沟鉁鉢𥖹銹𨫆𣲛𨬌𥗛"], +["90a1","𠴱錬鍫𨫡𨯫炏嫃𨫢𨫥䥥鉄𨯬𨰹𨯿鍳鑛躼閅閦鐦閠濶䊹𢙺𨛘𡉼𣸮䧟氜陻隖䅬隣𦻕懚隶磵𨫠隽双䦡𦲸𠉴𦐐𩂯𩃥𤫑𡤕𣌊霱虂霶䨏䔽䖅𤫩灵孁霛靜𩇕靗孊𩇫靟鐥僐𣂷𣂼鞉鞟鞱鞾韀韒韠𥑬韮琜𩐳響韵𩐝𧥺䫑頴頳顋顦㬎𧅵㵑𠘰𤅜"], +["9140","𥜆飊颷飈飇䫿𦴧𡛓喰飡飦飬鍸餹𤨩䭲𩡗𩤅駵騌騻騐驘𥜥㛄𩂱𩯕髠髢𩬅髴䰎鬔鬭𨘀倴鬴𦦨㣃𣁽魐魀𩴾婅𡡣鮎𤉋鰂鯿鰌𩹨鷔𩾷𪆒𪆫𪃡𪄣𪇟鵾鶃𪄴鸎梈"], +["91a1","鷄𢅛𪆓𪈠𡤻𪈳鴹𪂹𪊴麐麕麞麢䴴麪麯𤍤黁㭠㧥㴝伲㞾𨰫鼂鼈䮖鐤𦶢鼗鼖鼹嚟嚊齅馸𩂋韲葿齢齩竜龎爖䮾𤥵𤦻煷𤧸𤍈𤩑玞𨯚𡣺禟𨥾𨸶鍩鏳𨩄鋬鎁鏋𨥬𤒹爗㻫睲穃烐𤑳𤏸煾𡟯炣𡢾𣖙㻇𡢅𥐯𡟸㜢𡛻𡠹㛡𡝴𡣑𥽋㜣𡛀坛𤨥𡏾𡊨"], +["9240","𡏆𡒶蔃𣚦蔃葕𤦔𧅥𣸱𥕜𣻻𧁒䓴𣛮𩦝𦼦柹㜳㰕㷧塬𡤢栐䁗𣜿𤃡𤂋𤄏𦰡哋嚞𦚱嚒𠿟𠮨𠸍鏆𨬓鎜仸儫㠙𤐶亼𠑥𠍿佋侊𥙑婨𠆫𠏋㦙𠌊𠐔㐵伩𠋀𨺳𠉵諚𠈌亘"], +["92a1","働儍侢伃𤨎𣺊佂倮偬傁俌俥偘僼兙兛兝兞湶𣖕𣸹𣺿浲𡢄𣺉冨凃𠗠䓝𠒣𠒒𠒑赺𨪜𠜎剙劤𠡳勡鍮䙺熌𤎌𠰠𤦬𡃤槑𠸝瑹㻞璙琔瑖玘䮎𤪼𤂍叐㖄爏𤃉喴𠍅响𠯆圝鉝雴鍦埝垍坿㘾壋媙𨩆𡛺𡝯𡜐娬妸銏婾嫏娒𥥆𡧳𡡡𤊕㛵洅瑃娡𥺃"], +["9340","媁𨯗𠐓鏠璌𡌃焅䥲鐈𨧻鎽㞠尞岞幞幈𡦖𡥼𣫮廍孏𡤃𡤄㜁𡢠㛝𡛾㛓脪𨩇𡶺𣑲𨦨弌弎𡤧𡞫婫𡜻孄蘔𧗽衠恾𢡠𢘫忛㺸𢖯𢖾𩂈𦽳懀𠀾𠁆𢘛憙憘恵𢲛𢴇𤛔𩅍"], +["93a1","摱𤙥𢭪㨩𢬢𣑐𩣪𢹸挷𪑛撶挱揑𤧣𢵧护𢲡搻敫楲㯴𣂎𣊭𤦉𣊫唍𣋠𡣙𩐿曎𣊉𣆳㫠䆐𥖄𨬢𥖏𡛼𥕛𥐥磮𣄃𡠪𣈴㑤𣈏𣆂𤋉暎𦴤晫䮓昰𧡰𡷫晣𣋒𣋡昞𥡲㣑𣠺𣞼㮙𣞢𣏾瓐㮖枏𤘪梶栞㯄檾㡣𣟕𤒇樳橒櫉欅𡤒攑梘橌㯗橺歗𣿀𣲚鎠鋲𨯪𨫋"], +["9440","銉𨀞𨧜鑧涥漋𤧬浧𣽿㶏渄𤀼娽渊塇洤硂焻𤌚𤉶烱牐犇犔𤞏𤜥兹𤪤𠗫瑺𣻸𣙟𤩊𤤗𥿡㼆㺱𤫟𨰣𣼵悧㻳瓌琼鎇琷䒟𦷪䕑疃㽣𤳙𤴆㽘畕癳𪗆㬙瑨𨫌𤦫𤦎㫻"], +["94a1","㷍𤩎㻿𤧅𤣳釺圲鍂𨫣𡡤僟𥈡𥇧睸𣈲眎眏睻𤚗𣞁㩞𤣰琸璛㺿𤪺𤫇䃈𤪖𦆮錇𥖁砞碍碈磒珐祙𧝁𥛣䄎禛蒖禥樭𣻺稺秴䅮𡛦䄲鈵秱𠵌𤦌𠊙𣶺𡝮㖗啫㕰㚪𠇔𠰍竢婙𢛵𥪯𥪜娍𠉛磰娪𥯆竾䇹籝籭䈑𥮳𥺼𥺦糍𤧹𡞰粎籼粮檲緜縇緓罎𦉡"], +["9540","𦅜𧭈綗𥺂䉪𦭵𠤖柖𠁎𣗏埄𦐒𦏸𤥢翝笧𠠬𥫩𥵃笌𥸎駦虅驣樜𣐿㧢𤧷𦖭騟𦖠蒀𧄧𦳑䓪脷䐂胆脉腂𦞴飃𦩂艢艥𦩑葓𦶧蘐𧈛媆䅿𡡀嬫𡢡嫤𡣘蚠蜨𣶏蠭𧐢娂"], +["95a1","衮佅袇袿裦襥襍𥚃襔𧞅𧞄𨯵𨯙𨮜𨧹㺭蒣䛵䛏㟲訽訜𩑈彍鈫𤊄旔焩烄𡡅鵭貟賩𧷜妚矃姰䍮㛔踪躧𤰉輰轊䋴汘澻𢌡䢛潹溋𡟚鯩㚵𤤯邻邗啱䤆醻鐄𨩋䁢𨫼鐧𨰝𨰻蓥訫閙閧閗閖𨴴瑅㻂𤣿𤩂𤏪㻧𣈥随𨻧𨹦𨹥㻌𤧭𤩸𣿮琒瑫㻼靁𩂰"], +["9640","桇䨝𩂓𥟟靝鍨𨦉𨰦𨬯𦎾銺嬑譩䤼珹𤈛鞛靱餸𠼦巁𨯅𤪲頟𩓚鋶𩗗釥䓀𨭐𤩧𨭤飜𨩅㼀鈪䤥萔餻饍𧬆㷽馛䭯馪驜𨭥𥣈檏騡嫾騯𩣱䮐𩥈馼䮽䮗鍽塲𡌂堢𤦸"], +["96a1","𡓨硄𢜟𣶸棅㵽鑘㤧慐𢞁𢥫愇鱏鱓鱻鰵鰐魿鯏𩸭鮟𪇵𪃾鴡䲮𤄄鸘䲰鴌𪆴𪃭𪃳𩤯鶥蒽𦸒𦿟𦮂藼䔳𦶤𦺄𦷰萠藮𦸀𣟗𦁤秢𣖜𣙀䤭𤧞㵢鏛銾鍈𠊿碹鉷鑍俤㑀遤𥕝砽硔碶硋𡝗𣇉𤥁㚚佲濚濙瀞瀞吔𤆵垻壳垊鴖埗焴㒯𤆬燫𦱀𤾗嬨𡞵𨩉"], +["9740","愌嫎娋䊼𤒈㜬䭻𨧼鎻鎸𡣖𠼝葲𦳀𡐓𤋺𢰦𤏁妔𣶷𦝁綨𦅛𦂤𤦹𤦋𨧺鋥珢㻩璴𨭣𡢟㻡𤪳櫘珳珻㻖𤨾𤪔𡟙𤩦𠎧𡐤𤧥瑈𤤖炥𤥶銄珦鍟𠓾錱𨫎𨨖鎆𨯧𥗕䤵𨪂煫"], +["97a1","𤥃𠳿嚤𠘚𠯫𠲸唂秄𡟺緾𡛂𤩐𡡒䔮鐁㜊𨫀𤦭妰𡢿𡢃𧒄媡㛢𣵛㚰鉟婹𨪁𡡢鍴㳍𠪴䪖㦊僴㵩㵌𡎜煵䋻𨈘渏𩃤䓫浗𧹏灧沯㳖𣿭𣸭渂漌㵯𠏵畑㚼㓈䚀㻚䡱姄鉮䤾轁𨰜𦯀堒埈㛖𡑒烾𤍢𤩱𢿣𡊰𢎽梹楧𡎘𣓥𧯴𣛟𨪃𣟖𣏺𤲟樚𣚭𦲷萾䓟䓎"], +["9840","𦴦𦵑𦲂𦿞漗𧄉茽𡜺菭𦲀𧁓𡟛妉媂𡞳婡婱𡤅𤇼㜭姯𡜼㛇熎鎐暚𤊥婮娫𤊓樫𣻹𧜶𤑛𤋊焝𤉙𨧡侰𦴨峂𤓎𧹍𤎽樌𤉖𡌄炦焳𤏩㶥泟勇𤩏繥姫崯㷳彜𤩝𡟟綤萦"], +["98a1","咅𣫺𣌀𠈔坾𠣕𠘙㿥𡾞𪊶瀃𩅛嵰玏糓𨩙𩐠俈翧狍猐𧫴猸猹𥛶獁獈㺩𧬘遬燵𤣲珡臶㻊県㻑沢国琙琞琟㻢㻰㻴㻺瓓㼎㽓畂畭畲疍㽼痈痜㿀癍㿗癴㿜発𤽜熈嘣覀塩䀝睃䀹条䁅㗛瞘䁪䁯属瞾矋売砘点砜䂨砹硇硑硦葈𥔵礳栃礲䄃"], +["9940","䄉禑禙辻稆込䅧窑䆲窼艹䇄竏竛䇏両筢筬筻簒簛䉠䉺类粜䊌粸䊔糭输烀𠳏総緔緐緽羮羴犟䎗耠耥笹耮耱联㷌垴炠肷胩䏭脌猪脎脒畠脔䐁㬹腖腙腚"], +["99a1","䐓堺腼膄䐥膓䐭膥埯臁臤艔䒏芦艶苊苘苿䒰荗险榊萅烵葤惣蒈䔄蒾蓡蓸蔐蔸蕒䔻蕯蕰藠䕷虲蚒蚲蛯际螋䘆䘗袮裿褤襇覑𧥧訩訸誔誴豑賔賲贜䞘塟跃䟭仮踺嗘坔蹱嗵躰䠷軎転軤軭軲辷迁迊迌逳駄䢭飠鈓䤞鈨鉘鉫銱銮銿"], +["9a40","鋣鋫鋳鋴鋽鍃鎄鎭䥅䥑麿鐗匁鐝鐭鐾䥪鑔鑹锭関䦧间阳䧥枠䨤靀䨵鞲韂噔䫤惨颹䬙飱塄餎餙冴餜餷饂饝饢䭰駅䮝騼鬏窃魩鮁鯝鯱鯴䱭鰠㝯𡯂鵉鰺"], +["9aa1","黾噐鶓鶽鷀鷼银辶鹻麬麱麽黆铜黢黱黸竈齄𠂔𠊷𠎠椚铃妬𠓗塀铁㞹𠗕𠘕𠙶𡚺块煳𠫂𠫍𠮿呪吆𠯋咞𠯻𠰻𠱓𠱥𠱼惧𠲍噺𠲵𠳝𠳭𠵯𠶲𠷈楕鰯螥𠸄𠸎𠻗𠾐𠼭𠹳尠𠾼帋𡁜𡁏𡁶朞𡁻𡂈𡂖㙇𡂿𡃓𡄯𡄻卤蒭𡋣𡍵𡌶讁𡕷𡘙𡟃𡟇乸炻𡠭𡥪"], +["9b40","𡨭𡩅𡰪𡱰𡲬𡻈拃𡻕𡼕熘桕𢁅槩㛈𢉼𢏗𢏺𢜪𢡱𢥏苽𢥧𢦓𢫕覥𢫨辠𢬎鞸𢬿顇骽𢱌"], +["9b62","𢲈𢲷𥯨𢴈𢴒𢶷𢶕𢹂𢽴𢿌𣀳𣁦𣌟𣏞徱晈暿𧩹𣕧𣗳爁𤦺矗𣘚𣜖纇𠍆墵朎"], +["9ba1","椘𣪧𧙗𥿢𣸑𣺹𧗾𢂚䣐䪸𤄙𨪚𤋮𤌍𤀻𤌴𤎖𤩅𠗊凒𠘑妟𡺨㮾𣳿𤐄𤓖垈𤙴㦛𤜯𨗨𩧉㝢𢇃譞𨭎駖𤠒𤣻𤨕爉𤫀𠱸奥𤺥𤾆𠝹軚𥀬劏圿煱𥊙𥐙𣽊𤪧喼𥑆𥑮𦭒釔㑳𥔿𧘲𥕞䜘𥕢𥕦𥟇𤤿𥡝偦㓻𣏌惞𥤃䝼𨥈𥪮𥮉𥰆𡶐垡煑澶𦄂𧰒遖𦆲𤾚譢𦐂𦑊"], +["9c40","嵛𦯷輶𦒄𡤜諪𤧶𦒈𣿯𦔒䯀𦖿𦚵𢜛鑥𥟡憕娧晉侻嚹𤔡𦛼乪𤤴陖涏𦲽㘘襷𦞙𦡮𦐑𦡞營𦣇筂𩃀𠨑𦤦鄄𦤹穅鷰𦧺騦𦨭㙟𦑩𠀡禃𦨴𦭛崬𣔙菏𦮝䛐𦲤画补𦶮墶"], +["9ca1","㜜𢖍𧁋𧇍㱔𧊀𧊅銁𢅺𧊋錰𧋦𤧐氹钟𧑐𠻸蠧裵𢤦𨑳𡞱溸𤨪𡠠㦤㚹尐秣䔿暶𩲭𩢤襃𧟌𧡘囖䃟𡘊㦡𣜯𨃨𡏅熭荦𧧝𩆨婧䲷𧂯𨦫𧧽𧨊𧬋𧵦𤅺筃祾𨀉澵𪋟樃𨌘厢𦸇鎿栶靝𨅯𨀣𦦵𡏭𣈯𨁈嶅𨰰𨂃圕頣𨥉嶫𤦈斾槕叒𤪥𣾁㰑朶𨂐𨃴𨄮𡾡𨅏"], +["9d40","𨆉𨆯𨈚𨌆𨌯𨎊㗊𨑨𨚪䣺揦𨥖砈鉕𨦸䏲𨧧䏟𨧨𨭆𨯔姸𨰉輋𨿅𩃬筑𩄐𩄼㷷𩅞𤫊运犏嚋𩓧𩗩𩖰𩖸𩜲𩣑𩥉𩥪𩧃𩨨𩬎𩵚𩶛纟𩻸𩼣䲤镇𪊓熢𪋿䶑递𪗋䶜𠲜达嗁"], +["9da1","辺𢒰边𤪓䔉繿潖檱仪㓤𨬬𧢝㜺躀𡟵𨀤𨭬𨮙𧨾𦚯㷫𧙕𣲷𥘵𥥖亚𥺁𦉘嚿𠹭踎孭𣺈𤲞揞拐𡟶𡡻攰嘭𥱊吚𥌑㷆𩶘䱽嘢嘞罉𥻘奵𣵀蝰东𠿪𠵉𣚺脗鵞贘瘻鱅癎瞹鍅吲腈苷嘥脲萘肽嗪祢噃吖𠺝㗎嘅嗱曱𨋢㘭甴嗰喺咗啲𠱁𠲖廐𥅈𠹶𢱢"], +["9e40","𠺢麫絚嗞𡁵抝靭咔賍燶酶揼掹揾啩𢭃鱲𢺳冚㓟𠶧冧呍唞唓癦踭𦢊疱肶蠄螆裇膶萜𡃁䓬猄𤜆宐茋𦢓噻𢛴𧴯𤆣𧵳𦻐𧊶酰𡇙鈈𣳼𪚩𠺬𠻹牦𡲢䝎𤿂𧿹𠿫䃺"], +["9ea1","鱝攟𢶠䣳𤟠𩵼𠿬𠸊恢𧖣𠿭"], +["9ead","𦁈𡆇熣纎鵐业丄㕷嬍沲卧㚬㧜卽㚥𤘘墚𤭮舭呋垪𥪕𠥹"], +["9ec5","㩒𢑥獴𩺬䴉鯭𣳾𩼰䱛𤾩𩖞𩿞葜𣶶𧊲𦞳𣜠挮紥𣻷𣸬㨪逈勌㹴㙺䗩𠒎癀嫰𠺶硺𧼮墧䂿噼鮋嵴癔𪐴麅䳡痹㟻愙𣃚𤏲"], +["9ef5","噝𡊩垧𤥣𩸆刴𧂮㖭汊鵼"], +["9f40","籖鬹埞𡝬屓擓𩓐𦌵𧅤蚭𠴨𦴢𤫢𠵱"], +["9f4f","凾𡼏嶎霃𡷑麁遌笟鬂峑箣扨挵髿篏鬪籾鬮籂粆鰕篼鬉鼗鰛𤤾齚啳寃俽麘俲剠㸆勑坧偖妷帒韈鶫轜呩鞴饀鞺匬愰"], +["9fa1","椬叚鰊鴂䰻陁榀傦畆𡝭駚剳"], +["9fae","酙隁酜"], +["9fb2","酑𨺗捿𦴣櫊嘑醎畺抅𠏼獏籰𥰡𣳽"], +["9fc1","𤤙盖鮝个𠳔莾衂"], +["9fc9","届槀僭坺刟巵从氱𠇲伹咜哚劚趂㗾弌㗳"], +["9fdb","歒酼龥鮗頮颴骺麨麄煺笔"], +["9fe7","毺蠘罸"], +["9feb","嘠𪙊蹷齓"], +["9ff0","跔蹏鸜踁抂𨍽踨蹵竓𤩷稾磘泪詧瘇"], +["a040","𨩚鼦泎蟖痃𪊲硓咢贌狢獱謭猂瓱賫𤪻蘯徺袠䒷"], +["a055","𡠻𦸅"], +["a058","詾𢔛"], +["a05b","惽癧髗鵄鍮鮏蟵"], +["a063","蠏賷猬霡鮰㗖犲䰇籑饊𦅙慙䰄麖慽"], +["a073","坟慯抦戹拎㩜懢厪𣏵捤栂㗒"], +["a0a1","嵗𨯂迚𨸹"], +["a0a6","僙𡵆礆匲阸𠼻䁥"], +["a0ae","矾"], +["a0b0","糂𥼚糚稭聦聣絍甅瓲覔舚朌聢𧒆聛瓰脃眤覉𦟌畓𦻑螩蟎臈螌詉貭譃眫瓸蓚㘵榲趦"], +["a0d4","覩瑨涹蟁𤀑瓧㷛煶悤憜㳑煢恷"], +["a0e2","罱𨬭牐惩䭾删㰘𣳇𥻗𧙖𥔱𡥄𡋾𩤃𦷜𧂭峁𦆭𨨏𣙷𠃮𦡆𤼎䕢嬟𦍌齐麦𦉫"], +["a3c0","␀",31,"␡"], +["c6a1","①",9,"⑴",9,"ⅰ",9,"丶丿亅亠冂冖冫勹匸卩厶夊宀巛⼳广廴彐彡攴无疒癶辵隶¨ˆヽヾゝゞ〃仝々〆〇ー[]✽ぁ",23], +["c740","す",58,"ァアィイ"], +["c7a1","ゥ",81,"А",5,"ЁЖ",4], +["c840","Л",26,"ёж",25,"⇧↸↹㇏𠃌乚𠂊刂䒑"], +["c8a1","龰冈龱𧘇"], +["c8cd","¬¦'"㈱№℡゛゜⺀⺄⺆⺇⺈⺊⺌⺍⺕⺜⺝⺥⺧⺪⺬⺮⺶⺼⺾⻆⻊⻌⻍⻏⻖⻗⻞⻣"], +["c8f5","ʃɐɛɔɵœøŋʊɪ"], +["f9fe","■"], +["fa40","𠕇鋛𠗟𣿅蕌䊵珯况㙉𤥂𨧤鍄𡧛苮𣳈砼杄拟𤤳𨦪𠊠𦮳𡌅侫𢓭倈𦴩𧪄𣘀𤪱𢔓倩𠍾徤𠎀𠍇滛𠐟偽儁㑺儎顬㝃萖𤦤𠒇兠𣎴兪𠯿𢃼𠋥𢔰𠖎𣈳𡦃宂蝽𠖳𣲙冲冸"], +["faa1","鴴凉减凑㳜凓𤪦决凢卂凭菍椾𣜭彻刋刦刼劵剗劔効勅簕蕂勠蘍𦬓包𨫞啉滙𣾀𠥔𣿬匳卄𠯢泋𡜦栛珕恊㺪㣌𡛨燝䒢卭却𨚫卾卿𡖖𡘓矦厓𨪛厠厫厮玧𥝲㽙玜叁叅汉义埾叙㪫𠮏叠𣿫𢶣叶𠱷吓灹唫晗浛呭𦭓𠵴啝咏咤䞦𡜍𠻝㶴𠵍"], +["fb40","𨦼𢚘啇䳭启琗喆喩嘅𡣗𤀺䕒𤐵暳𡂴嘷曍𣊊暤暭噍噏磱囱鞇叾圀囯园𨭦㘣𡉏坆𤆥汮炋坂㚱𦱾埦𡐖堃𡑔𤍣堦𤯵塜墪㕡壠壜𡈼壻寿坃𪅐𤉸鏓㖡够梦㛃湙"], +["fba1","𡘾娤啓𡚒蔅姉𠵎𦲁𦴪𡟜姙𡟻𡞲𦶦浱𡠨𡛕姹𦹅媫婣㛦𤦩婷㜈媖瑥嫓𦾡𢕔㶅𡤑㜲𡚸広勐孶斈孼𧨎䀄䡝𠈄寕慠𡨴𥧌𠖥寳宝䴐尅𡭄尓珎尔𡲥𦬨屉䣝岅峩峯嶋𡷹𡸷崐崘嵆𡺤岺巗苼㠭𤤁𢁉𢅳芇㠶㯂帮檊幵幺𤒼𠳓厦亷廐厨𡝱帉廴𨒂"], +["fc40","廹廻㢠廼栾鐛弍𠇁弢㫞䢮𡌺强𦢈𢏐彘𢑱彣鞽𦹮彲鍀𨨶徧嶶㵟𥉐𡽪𧃸𢙨釖𠊞𨨩怱暅𡡷㥣㷇㘹垐𢞴祱㹀悞悤悳𤦂𤦏𧩓璤僡媠慤萤慂慈𦻒憁凴𠙖憇宪𣾷"], +["fca1","𢡟懓𨮝𩥝懐㤲𢦀𢣁怣慜攞掋𠄘担𡝰拕𢸍捬𤧟㨗搸揸𡎎𡟼撐澊𢸶頔𤂌𥜝擡擥鑻㩦携㩗敍漖𤨨𤨣斅敭敟𣁾斵𤥀䬷旑䃘𡠩无旣忟𣐀昘𣇷𣇸晄𣆤𣆥晋𠹵晧𥇦晳晴𡸽𣈱𨗴𣇈𥌓矅𢣷馤朂𤎜𤨡㬫槺𣟂杞杧杢𤇍𩃭柗䓩栢湐鈼栁𣏦𦶠桝"], +["fd40","𣑯槡樋𨫟楳棃𣗍椁椀㴲㨁𣘼㮀枬楡𨩊䋼椶榘㮡𠏉荣傐槹𣙙𢄪橅𣜃檝㯳枱櫈𩆜㰍欝𠤣惞欵歴𢟍溵𣫛𠎵𡥘㝀吡𣭚毡𣻼毜氷𢒋𤣱𦭑汚舦汹𣶼䓅𣶽𤆤𤤌𤤀"], +["fda1","𣳉㛥㳫𠴲鮃𣇹𢒑羏样𦴥𦶡𦷫涖浜湼漄𤥿𤂅𦹲蔳𦽴凇沜渝萮𨬡港𣸯瑓𣾂秌湏媑𣁋濸㜍澝𣸰滺𡒗𤀽䕕鏰潄潜㵎潴𩅰㴻澟𤅄濓𤂑𤅕𤀹𣿰𣾴𤄿凟𤅖𤅗𤅀𦇝灋灾炧炁烌烕烖烟䄄㷨熴熖𤉷焫煅媈煊煮岜𤍥煏鍢𤋁焬𤑚𤨧𤨢熺𨯨炽爎"], +["fe40","鑂爕夑鑃爤鍁𥘅爮牀𤥴梽牕牗㹕𣁄栍漽犂猪猫𤠣𨠫䣭𨠄猨献珏玪𠰺𦨮珉瑉𤇢𡛧𤨤昣㛅𤦷𤦍𤧻珷琕椃𤨦琹𠗃㻗瑜𢢭瑠𨺲瑇珤瑶莹瑬㜰瑴鏱樬璂䥓𤪌"], +["fea1","𤅟𤩹𨮏孆𨰃𡢞瓈𡦈甎瓩甞𨻙𡩋寗𨺬鎅畍畊畧畮𤾂㼄𤴓疎瑝疞疴瘂瘬癑癏癯癶𦏵皐臯㟸𦤑𦤎皡皥皷盌𦾟葢𥂝𥅽𡸜眞眦着撯𥈠睘𣊬瞯𨥤𨥨𡛁矴砉𡍶𤨒棊碯磇磓隥礮𥗠磗礴碱𧘌辸袄𨬫𦂃𢘜禆褀椂禀𥡗禝𧬹礼禩渪𧄦㺨秆𩄍秔"] +] diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp936.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp936.json new file mode 100644 index 0000000..49ddb9a --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp936.json @@ -0,0 +1,264 @@ +[ +["0","\u0000",127,"€"], +["8140","丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪",5,"乲乴",9,"乿",6,"亇亊"], +["8180","亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂",6,"伋伌伒",4,"伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾",4,"佄佅佇",5,"佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢"], +["8240","侤侫侭侰",4,"侶",8,"俀俁係俆俇俈俉俋俌俍俒",4,"俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿",11], +["8280","個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯",10,"倻倽倿偀偁偂偄偅偆偉偊偋偍偐",4,"偖偗偘偙偛偝",7,"偦",5,"偭",8,"偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎",20,"傤傦傪傫傭",4,"傳",6,"傼"], +["8340","傽",17,"僐",5,"僗僘僙僛",10,"僨僩僪僫僯僰僱僲僴僶",4,"僼",9,"儈"], +["8380","儉儊儌",5,"儓",13,"儢",28,"兂兇兊兌兎兏児兒兓兗兘兙兛兝",4,"兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦",4,"冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒",5], +["8440","凘凙凚凜凞凟凢凣凥",5,"凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄",5,"剋剎剏剒剓剕剗剘"], +["8480","剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳",9,"剾劀劃",4,"劉",6,"劑劒劔",6,"劜劤劥劦劧劮劯劰労",9,"勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務",5,"勠勡勢勣勥",10,"勱",7,"勻勼勽匁匂匃匄匇匉匊匋匌匎"], +["8540","匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯",9,"匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏"], +["8580","厐",4,"厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯",6,"厷厸厹厺厼厽厾叀參",4,"収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝",4,"呣呥呧呩",7,"呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡"], +["8640","咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠",4,"哫哬哯哰哱哴",5,"哻哾唀唂唃唄唅唈唊",4,"唒唓唕",5,"唜唝唞唟唡唥唦"], +["8680","唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋",4,"啑啒啓啔啗",4,"啝啞啟啠啢啣啨啩啫啯",5,"啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠",6,"喨",8,"喲喴営喸喺喼喿",4,"嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗",4,"嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸",4,"嗿嘂嘃嘄嘅"], +["8740","嘆嘇嘊嘋嘍嘐",7,"嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀",11,"噏",4,"噕噖噚噛噝",4], +["8780","噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽",7,"嚇",6,"嚐嚑嚒嚔",14,"嚤",10,"嚰",6,"嚸嚹嚺嚻嚽",12,"囋",8,"囕囖囘囙囜団囥",5,"囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國",6], +["8840","園",9,"圝圞圠圡圢圤圥圦圧圫圱圲圴",4,"圼圽圿坁坃坄坅坆坈坉坋坒",4,"坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀"], +["8880","垁垇垈垉垊垍",4,"垔",6,"垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹",8,"埄",6,"埌埍埐埑埓埖埗埛埜埞埡埢埣埥",7,"埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥",4,"堫",4,"報堲堳場堶",7], +["8940","堾",5,"塅",6,"塎塏塐塒塓塕塖塗塙",4,"塟",5,"塦",4,"塭",16,"塿墂墄墆墇墈墊墋墌"], +["8980","墍",4,"墔",4,"墛墜墝墠",7,"墪",17,"墽墾墿壀壂壃壄壆",10,"壒壓壔壖",13,"壥",5,"壭壯壱売壴壵壷壸壺",7,"夃夅夆夈",4,"夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻"], +["8a40","夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛",4,"奡奣奤奦",12,"奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦"], +["8a80","妧妬妭妰妱妳",5,"妺妼妽妿",6,"姇姈姉姌姍姎姏姕姖姙姛姞",4,"姤姦姧姩姪姫姭",11,"姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪",6,"娳娵娷",4,"娽娾娿婁",4,"婇婈婋",9,"婖婗婘婙婛",5], +["8b40","婡婣婤婥婦婨婩婫",8,"婸婹婻婼婽婾媀",17,"媓",6,"媜",13,"媫媬"], +["8b80","媭",4,"媴媶媷媹",4,"媿嫀嫃",5,"嫊嫋嫍",4,"嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬",4,"嫲",22,"嬊",11,"嬘",25,"嬳嬵嬶嬸",7,"孁",6], +["8c40","孈",7,"孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏"], +["8c80","寑寔",8,"寠寢寣實寧審",4,"寯寱",6,"寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧",6,"屰屲",6,"屻屼屽屾岀岃",4,"岉岊岋岎岏岒岓岕岝",4,"岤",4], +["8d40","岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅",5,"峌",5,"峓",5,"峚",6,"峢峣峧峩峫峬峮峯峱",9,"峼",4], +["8d80","崁崄崅崈",5,"崏",4,"崕崗崘崙崚崜崝崟",4,"崥崨崪崫崬崯",4,"崵",7,"崿",7,"嵈嵉嵍",10,"嵙嵚嵜嵞",10,"嵪嵭嵮嵰嵱嵲嵳嵵",12,"嶃",21,"嶚嶛嶜嶞嶟嶠"], +["8e40","嶡",21,"嶸",12,"巆",6,"巎",12,"巜巟巠巣巤巪巬巭"], +["8e80","巰巵巶巸",4,"巿帀帄帇帉帊帋帍帎帒帓帗帞",7,"帨",4,"帯帰帲",4,"帹帺帾帿幀幁幃幆",5,"幍",6,"幖",4,"幜幝幟幠幣",14,"幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨",4,"庮",4,"庴庺庻庼庽庿",6], +["8f40","廆廇廈廋",5,"廔廕廗廘廙廚廜",11,"廩廫",8,"廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤"], +["8f80","弨弫弬弮弰弲",6,"弻弽弾弿彁",14,"彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢",5,"復徫徬徯",5,"徶徸徹徺徻徾",4,"忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇"], +["9040","怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰",4,"怶",4,"怽怾恀恄",6,"恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀"], +["9080","悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽",7,"惇惈惉惌",4,"惒惓惔惖惗惙惛惞惡",4,"惪惱惲惵惷惸惻",4,"愂愃愄愅愇愊愋愌愐",4,"愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬",18,"慀",6], +["9140","慇慉態慍慏慐慒慓慔慖",6,"慞慟慠慡慣慤慥慦慩",6,"慱慲慳慴慶慸",18,"憌憍憏",4,"憕"], +["9180","憖",6,"憞",8,"憪憫憭",9,"憸",5,"憿懀懁懃",4,"應懌",4,"懓懕",16,"懧",13,"懶",8,"戀",5,"戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸",4,"扂扄扅扆扊"], +["9240","扏扐払扖扗扙扚扜",6,"扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋",5,"抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁"], +["9280","拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳",5,"挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖",7,"捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙",6,"採掤掦掫掯掱掲掵掶掹掻掽掿揀"], +["9340","揁揂揃揅揇揈揊揋揌揑揓揔揕揗",6,"揟揢揤",4,"揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆",4,"損搎搑搒搕",5,"搝搟搢搣搤"], +["9380","搥搧搨搩搫搮",5,"搵",4,"搻搼搾摀摂摃摉摋",6,"摓摕摖摗摙",4,"摟",7,"摨摪摫摬摮",9,"摻",6,"撃撆撈",8,"撓撔撗撘撚撛撜撝撟",4,"撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆",6,"擏擑擓擔擕擖擙據"], +["9440","擛擜擝擟擠擡擣擥擧",24,"攁",7,"攊",7,"攓",4,"攙",8], +["9480","攢攣攤攦",4,"攬攭攰攱攲攳攷攺攼攽敀",4,"敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數",14,"斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱",7,"斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘",7,"旡旣旤旪旫"], +["9540","旲旳旴旵旸旹旻",4,"昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷",4,"昽昿晀時晄",6,"晍晎晐晑晘"], +["9580","晙晛晜晝晞晠晢晣晥晧晩",4,"晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘",4,"暞",8,"暩",4,"暯",4,"暵暶暷暸暺暻暼暽暿",25,"曚曞",7,"曧曨曪",5,"曱曵曶書曺曻曽朁朂會"], +["9640","朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠",5,"朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗",4,"杝杢杣杤杦杧杫杬杮東杴杶"], +["9680","杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹",7,"柂柅",9,"柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵",7,"柾栁栂栃栄栆栍栐栒栔栕栘",4,"栞栟栠栢",6,"栫",6,"栴栵栶栺栻栿桇桋桍桏桒桖",5], +["9740","桜桝桞桟桪桬",7,"桵桸",8,"梂梄梇",7,"梐梑梒梔梕梖梘",9,"梣梤梥梩梪梫梬梮梱梲梴梶梷梸"], +["9780","梹",6,"棁棃",5,"棊棌棎棏棐棑棓棔棖棗棙棛",4,"棡棢棤",9,"棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆",4,"椌椏椑椓",11,"椡椢椣椥",7,"椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃",16,"楕楖楘楙楛楜楟"], +["9840","楡楢楤楥楧楨楩楪楬業楯楰楲",4,"楺楻楽楾楿榁榃榅榊榋榌榎",5,"榖榗榙榚榝",9,"榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽"], +["9880","榾榿槀槂",7,"構槍槏槑槒槓槕",5,"槜槝槞槡",11,"槮槯槰槱槳",9,"槾樀",9,"樋",11,"標",5,"樠樢",5,"権樫樬樭樮樰樲樳樴樶",6,"樿",4,"橅橆橈",7,"橑",6,"橚"], +["9940","橜",4,"橢橣橤橦",10,"橲",6,"橺橻橽橾橿檁檂檃檅",8,"檏檒",4,"檘",7,"檡",5], +["9980","檧檨檪檭",114,"欥欦欨",6], +["9a40","欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍",11,"歚",7,"歨歩歫",13,"歺歽歾歿殀殅殈"], +["9a80","殌殎殏殐殑殔殕殗殘殙殜",4,"殢",7,"殫",7,"殶殸",6,"毀毃毄毆",4,"毌毎毐毑毘毚毜",4,"毢",7,"毬毭毮毰毱毲毴毶毷毸毺毻毼毾",6,"氈",4,"氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋",4,"汑汒汓汖汘"], +["9b40","汙汚汢汣汥汦汧汫",4,"汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘"], +["9b80","泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟",5,"洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽",4,"涃涄涆涇涊涋涍涏涐涒涖",4,"涜涢涥涬涭涰涱涳涴涶涷涹",5,"淁淂淃淈淉淊"], +["9c40","淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽",7,"渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵"], +["9c80","渶渷渹渻",7,"湅",7,"湏湐湑湒湕湗湙湚湜湝湞湠",10,"湬湭湯",14,"満溁溂溄溇溈溊",4,"溑",6,"溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪",5], +["9d40","滰滱滲滳滵滶滷滸滺",7,"漃漄漅漇漈漊",4,"漐漑漒漖",9,"漡漢漣漥漦漧漨漬漮漰漲漴漵漷",6,"漿潀潁潂"], +["9d80","潃潄潅潈潉潊潌潎",9,"潙潚潛潝潟潠潡潣潤潥潧",5,"潯潰潱潳潵潶潷潹潻潽",6,"澅澆澇澊澋澏",12,"澝澞澟澠澢",4,"澨",10,"澴澵澷澸澺",5,"濁濃",5,"濊",6,"濓",10,"濟濢濣濤濥"], +["9e40","濦",7,"濰",32,"瀒",7,"瀜",6,"瀤",6], +["9e80","瀫",9,"瀶瀷瀸瀺",17,"灍灎灐",13,"灟",11,"灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞",12,"炰炲炴炵炶為炾炿烄烅烆烇烉烋",12,"烚"], +["9f40","烜烝烞烠烡烢烣烥烪烮烰",6,"烸烺烻烼烾",10,"焋",4,"焑焒焔焗焛",10,"焧",7,"焲焳焴"], +["9f80","焵焷",13,"煆煇煈煉煋煍煏",12,"煝煟",4,"煥煩",4,"煯煰煱煴煵煶煷煹煻煼煾",5,"熅",4,"熋熌熍熎熐熑熒熓熕熖熗熚",4,"熡",6,"熩熪熫熭",5,"熴熶熷熸熺",8,"燄",9,"燏",4], +["a040","燖",9,"燡燢燣燤燦燨",5,"燯",9,"燺",11,"爇",19], +["a080","爛爜爞",9,"爩爫爭爮爯爲爳爴爺爼爾牀",6,"牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅",4,"犌犎犐犑犓",11,"犠",11,"犮犱犲犳犵犺",6,"狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛"], +["a1a1"," 、。·ˉˇ¨〃々—~‖…‘’“”〔〕〈",7,"〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓"], +["a2a1","ⅰ",9], +["a2b1","⒈",19,"⑴",19,"①",9], +["a2e5","㈠",9], +["a2f1","Ⅰ",11], +["a3a1","!"#¥%",88," ̄"], +["a4a1","ぁ",82], +["a5a1","ァ",85], +["a6a1","Α",16,"Σ",6], +["a6c1","α",16,"σ",6], +["a6e0","︵︶︹︺︿﹀︽︾﹁﹂﹃﹄"], +["a6ee","︻︼︷︸︱"], +["a6f4","︳︴"], +["a7a1","А",5,"ЁЖ",25], +["a7d1","а",5,"ёж",25], +["a840","ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═",35,"▁",6], +["a880","█",7,"▓▔▕▼▽◢◣◤◥☉⊕〒〝〞"], +["a8a1","āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ"], +["a8bd","ńň"], +["a8c0","ɡ"], +["a8c5","ㄅ",36], +["a940","〡",8,"㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰¬¦"], +["a959","℡㈱"], +["a95c","‐"], +["a960","ー゛゜ヽヾ〆ゝゞ﹉",9,"﹔﹕﹖﹗﹙",8], +["a980","﹢",4,"﹨﹩﹪﹫"], +["a996","〇"], +["a9a4","─",75], +["aa40","狜狝狟狢",5,"狪狫狵狶狹狽狾狿猀猂猄",5,"猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀",8], +["aa80","獉獊獋獌獎獏獑獓獔獕獖獘",7,"獡",10,"獮獰獱"], +["ab40","獲",11,"獿",4,"玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣",5,"玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃",4], +["ab80","珋珌珎珒",6,"珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳",4], +["ac40","珸",10,"琄琇琈琋琌琍琎琑",8,"琜",5,"琣琤琧琩琫琭琯琱琲琷",4,"琽琾琿瑀瑂",11], +["ac80","瑎",6,"瑖瑘瑝瑠",12,"瑮瑯瑱",4,"瑸瑹瑺"], +["ad40","瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑",10,"璝璟",7,"璪",15,"璻",12], +["ad80","瓈",9,"瓓",8,"瓝瓟瓡瓥瓧",6,"瓰瓱瓲"], +["ae40","瓳瓵瓸",6,"甀甁甂甃甅",7,"甎甐甒甔甕甖甗甛甝甞甠",4,"甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘"], +["ae80","畝",7,"畧畨畩畫",6,"畳畵當畷畺",4,"疀疁疂疄疅疇"], +["af40","疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦",4,"疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇"], +["af80","瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄"], +["b040","癅",6,"癎",5,"癕癗",4,"癝癟癠癡癢癤",6,"癬癭癮癰",7,"癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛"], +["b080","皜",7,"皥",8,"皯皰皳皵",9,"盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥"], +["b140","盄盇盉盋盌盓盕盙盚盜盝盞盠",4,"盦",7,"盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎",10,"眛眜眝眞眡眣眤眥眧眪眫"], +["b180","眬眮眰",4,"眹眻眽眾眿睂睄睅睆睈",7,"睒",7,"睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳"], +["b240","睝睞睟睠睤睧睩睪睭",11,"睺睻睼瞁瞂瞃瞆",5,"瞏瞐瞓",11,"瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶",4], +["b280","瞼瞾矀",12,"矎",8,"矘矙矚矝",4,"矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖"], +["b340","矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃",5,"砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚"], +["b380","硛硜硞",11,"硯",7,"硸硹硺硻硽",6,"场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚"], +["b440","碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨",7,"碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚",9], +["b480","磤磥磦磧磩磪磫磭",4,"磳磵磶磸磹磻",5,"礂礃礄礆",6,"础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮"], +["b540","礍",5,"礔",9,"礟",4,"礥",14,"礵",4,"礽礿祂祃祄祅祇祊",8,"祔祕祘祙祡祣"], +["b580","祤祦祩祪祫祬祮祰",6,"祹祻",4,"禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠"], +["b640","禓",6,"禛",11,"禨",10,"禴",4,"禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙",5,"秠秡秢秥秨秪"], +["b680","秬秮秱",6,"秹秺秼秾秿稁稄稅稇稈稉稊稌稏",4,"稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二"], +["b740","稝稟稡稢稤",14,"稴稵稶稸稺稾穀",5,"穇",9,"穒",4,"穘",16], +["b780","穩",6,"穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服"], +["b840","窣窤窧窩窪窫窮",4,"窴",10,"竀",10,"竌",9,"竗竘竚竛竜竝竡竢竤竧",5,"竮竰竱竲竳"], +["b880","竴",4,"竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹"], +["b940","笯笰笲笴笵笶笷笹笻笽笿",5,"筆筈筊筍筎筓筕筗筙筜筞筟筡筣",10,"筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆",6,"箎箏"], +["b980","箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹",7,"篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈"], +["ba40","篅篈築篊篋篍篎篏篐篒篔",4,"篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲",4,"篸篹篺篻篽篿",7,"簈簉簊簍簎簐",5,"簗簘簙"], +["ba80","簚",4,"簠",5,"簨簩簫",12,"簹",5,"籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖"], +["bb40","籃",9,"籎",36,"籵",5,"籾",9], +["bb80","粈粊",6,"粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴",4,"粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕"], +["bc40","粿糀糂糃糄糆糉糋糎",6,"糘糚糛糝糞糡",6,"糩",5,"糰",7,"糹糺糼",13,"紋",5], +["bc80","紑",14,"紡紣紤紥紦紨紩紪紬紭紮細",6,"肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件"], +["bd40","紷",54,"絯",7], +["bd80","絸",32,"健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸"], +["be40","継",12,"綧",6,"綯",42], +["be80","線",32,"尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻"], +["bf40","緻",62], +["bf80","縺縼",4,"繂",4,"繈",21,"俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀"], +["c040","繞",35,"纃",23,"纜纝纞"], +["c080","纮纴纻纼绖绤绬绹缊缐缞缷缹缻",6,"罃罆",9,"罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐"], +["c140","罖罙罛罜罝罞罠罣",4,"罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂",7,"羋羍羏",4,"羕",4,"羛羜羠羢羣羥羦羨",6,"羱"], +["c180","羳",4,"羺羻羾翀翂翃翄翆翇翈翉翋翍翏",4,"翖翗翙",5,"翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿"], +["c240","翤翧翨翪翫翬翭翯翲翴",6,"翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫",5,"耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗"], +["c280","聙聛",13,"聫",5,"聲",11,"隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫"], +["c340","聾肁肂肅肈肊肍",5,"肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇",4,"胏",6,"胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋"], +["c380","脌脕脗脙脛脜脝脟",12,"脭脮脰脳脴脵脷脹",4,"脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸"], +["c440","腀",5,"腇腉腍腎腏腒腖腗腘腛",4,"腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃",4,"膉膋膌膍膎膐膒",5,"膙膚膞",4,"膤膥"], +["c480","膧膩膫",7,"膴",5,"膼膽膾膿臄臅臇臈臉臋臍",6,"摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁"], +["c540","臔",14,"臤臥臦臨臩臫臮",4,"臵",5,"臽臿舃與",4,"舎舏舑舓舕",5,"舝舠舤舥舦舧舩舮舲舺舼舽舿"], +["c580","艀艁艂艃艅艆艈艊艌艍艎艐",7,"艙艛艜艝艞艠",7,"艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗"], +["c640","艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸"], +["c680","苺苼",4,"茊茋茍茐茒茓茖茘茙茝",9,"茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐"], +["c740","茾茿荁荂荄荅荈荊",4,"荓荕",4,"荝荢荰",6,"荹荺荾",6,"莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡",6,"莬莭莮"], +["c780","莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠"], +["c840","菮華菳",4,"菺菻菼菾菿萀萂萅萇萈萉萊萐萒",5,"萙萚萛萞",5,"萩",7,"萲",5,"萹萺萻萾",7,"葇葈葉"], +["c880","葊",6,"葒",4,"葘葝葞葟葠葢葤",4,"葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁"], +["c940","葽",4,"蒃蒄蒅蒆蒊蒍蒏",7,"蒘蒚蒛蒝蒞蒟蒠蒢",12,"蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗"], +["c980","蓘",4,"蓞蓡蓢蓤蓧",4,"蓭蓮蓯蓱",10,"蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳"], +["ca40","蔃",8,"蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢",8,"蔭",9,"蔾",4,"蕄蕅蕆蕇蕋",10], +["ca80","蕗蕘蕚蕛蕜蕝蕟",4,"蕥蕦蕧蕩",8,"蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱"], +["cb40","薂薃薆薈",6,"薐",10,"薝",6,"薥薦薧薩薫薬薭薱",5,"薸薺",6,"藂",6,"藊",4,"藑藒"], +["cb80","藔藖",5,"藝",6,"藥藦藧藨藪",14,"恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔"], +["cc40","藹藺藼藽藾蘀",4,"蘆",10,"蘒蘓蘔蘕蘗",15,"蘨蘪",13,"蘹蘺蘻蘽蘾蘿虀"], +["cc80","虁",11,"虒虓處",4,"虛虜虝號虠虡虣",7,"獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃"], +["cd40","虭虯虰虲",6,"蚃",6,"蚎",4,"蚔蚖",5,"蚞",4,"蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻",4,"蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜"], +["cd80","蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威"], +["ce40","蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀",6,"蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚",5,"蝡蝢蝦",7,"蝯蝱蝲蝳蝵"], +["ce80","蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎",4,"螔螕螖螘",6,"螠",4,"巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺"], +["cf40","螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁",4,"蟇蟈蟉蟌",4,"蟔",6,"蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯",9], +["cf80","蟺蟻蟼蟽蟿蠀蠁蠂蠄",5,"蠋",7,"蠔蠗蠘蠙蠚蠜",4,"蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓"], +["d040","蠤",13,"蠳",5,"蠺蠻蠽蠾蠿衁衂衃衆",5,"衎",5,"衕衖衘衚",6,"衦衧衪衭衯衱衳衴衵衶衸衹衺"], +["d080","衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗",4,"袝",4,"袣袥",5,"小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄"], +["d140","袬袮袯袰袲",4,"袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚",4,"裠裡裦裧裩",6,"裲裵裶裷裺裻製裿褀褁褃",5], +["d180","褉褋",4,"褑褔",4,"褜",4,"褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶"], +["d240","褸",8,"襂襃襅",24,"襠",5,"襧",19,"襼"], +["d280","襽襾覀覂覄覅覇",26,"摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐"], +["d340","覢",30,"觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴",6], +["d380","觻",4,"訁",5,"計",21,"印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉"], +["d440","訞",31,"訿",8,"詉",21], +["d480","詟",25,"詺",6,"浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧"], +["d540","誁",7,"誋",7,"誔",46], +["d580","諃",32,"铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政"], +["d640","諤",34,"謈",27], +["d680","謤謥謧",30,"帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑"], +["d740","譆",31,"譧",4,"譭",25], +["d780","讇",24,"讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"], +["d840","谸",8,"豂豃豄豅豈豊豋豍",7,"豖豗豘豙豛",5,"豣",6,"豬",6,"豴豵豶豷豻",6,"貃貄貆貇"], +["d880","貈貋貍",6,"貕貖貗貙",20,"亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝"], +["d940","貮",62], +["d980","賭",32,"佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼"], +["da40","贎",14,"贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸",8,"趂趃趆趇趈趉趌",4,"趒趓趕",9,"趠趡"], +["da80","趢趤",12,"趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺"], +["db40","跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾",6,"踆踇踈踋踍踎踐踑踒踓踕",7,"踠踡踤",4,"踫踭踰踲踳踴踶踷踸踻踼踾"], +["db80","踿蹃蹅蹆蹌",4,"蹓",5,"蹚",11,"蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝"], +["dc40","蹳蹵蹷",4,"蹽蹾躀躂躃躄躆躈",6,"躑躒躓躕",6,"躝躟",11,"躭躮躰躱躳",6,"躻",7], +["dc80","軃",10,"軏",21,"堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥"], +["dd40","軥",62], +["dd80","輤",32,"荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺"], +["de40","轅",32,"轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆"], +["de80","迉",4,"迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖"], +["df40","這逜連逤逥逧",5,"逰",4,"逷逹逺逽逿遀遃遅遆遈",4,"過達違遖遙遚遜",5,"遤遦遧適遪遫遬遯",4,"遶",6,"遾邁"], +["df80","還邅邆邇邉邊邌",4,"邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼"], +["e040","郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅",19,"鄚鄛鄜"], +["e080","鄝鄟鄠鄡鄤",10,"鄰鄲",6,"鄺",8,"酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼"], +["e140","酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀",4,"醆醈醊醎醏醓",6,"醜",5,"醤",5,"醫醬醰醱醲醳醶醷醸醹醻"], +["e180","醼",10,"釈釋釐釒",9,"針",8,"帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺"], +["e240","釦",62], +["e280","鈥",32,"狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧",5,"饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂"], +["e340","鉆",45,"鉵",16], +["e380","銆",7,"銏",24,"恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾"], +["e440","銨",5,"銯",24,"鋉",31], +["e480","鋩",32,"洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑"], +["e540","錊",51,"錿",10], +["e580","鍊",31,"鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣"], +["e640","鍬",34,"鎐",27], +["e680","鎬",29,"鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩"], +["e740","鏎",7,"鏗",54], +["e780","鐎",32,"纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡",6,"缪缫缬缭缯",4,"缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬"], +["e840","鐯",14,"鐿",43,"鑬鑭鑮鑯"], +["e880","鑰",20,"钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹"], +["e940","锧锳锽镃镈镋镕镚镠镮镴镵長",7,"門",42], +["e980","閫",32,"椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋"], +["ea40","闌",27,"闬闿阇阓阘阛阞阠阣",6,"阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗"], +["ea80","陘陙陚陜陝陞陠陣陥陦陫陭",4,"陳陸",12,"隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰"], +["eb40","隌階隑隒隓隕隖隚際隝",9,"隨",7,"隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖",9,"雡",6,"雫"], +["eb80","雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗",4,"霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻"], +["ec40","霡",8,"霫霬霮霯霱霳",4,"霺霻霼霽霿",18,"靔靕靗靘靚靜靝靟靣靤靦靧靨靪",7], +["ec80","靲靵靷",4,"靽",7,"鞆",4,"鞌鞎鞏鞐鞓鞕鞖鞗鞙",4,"臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐"], +["ed40","鞞鞟鞡鞢鞤",6,"鞬鞮鞰鞱鞳鞵",46], +["ed80","韤韥韨韮",4,"韴韷",23,"怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨"], +["ee40","頏",62], +["ee80","顎",32,"睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶",4,"钼钽钿铄铈",6,"铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪"], +["ef40","顯",5,"颋颎颒颕颙颣風",37,"飏飐飔飖飗飛飜飝飠",4], +["ef80","飥飦飩",30,"铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒",4,"锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤",8,"镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔"], +["f040","餈",4,"餎餏餑",28,"餯",26], +["f080","饊",9,"饖",12,"饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨",4,"鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦",6,"鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙"], +["f140","馌馎馚",10,"馦馧馩",47], +["f180","駙",32,"瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃"], +["f240","駺",62], +["f280","騹",32,"颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒"], +["f340","驚",17,"驲骃骉骍骎骔骕骙骦骩",6,"骲骳骴骵骹骻骽骾骿髃髄髆",4,"髍髎髏髐髒體髕髖髗髙髚髛髜"], +["f380","髝髞髠髢髣髤髥髧髨髩髪髬髮髰",8,"髺髼",6,"鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋"], +["f440","鬇鬉",5,"鬐鬑鬒鬔",10,"鬠鬡鬢鬤",10,"鬰鬱鬳",7,"鬽鬾鬿魀魆魊魋魌魎魐魒魓魕",5], +["f480","魛",32,"簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤"], +["f540","魼",62], +["f580","鮻",32,"酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜"], +["f640","鯜",62], +["f680","鰛",32,"觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅",5,"龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞",5,"鲥",4,"鲫鲭鲮鲰",7,"鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋"], +["f740","鰼",62], +["f780","鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾",4,"鳈鳉鳑鳒鳚鳛鳠鳡鳌",4,"鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄"], +["f840","鳣",62], +["f880","鴢",32], +["f940","鵃",62], +["f980","鶂",32], +["fa40","鶣",62], +["fa80","鷢",32], +["fb40","鸃",27,"鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴",9,"麀"], +["fb80","麁麃麄麅麆麉麊麌",5,"麔",8,"麞麠",5,"麧麨麩麪"], +["fc40","麫",8,"麵麶麷麹麺麼麿",4,"黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰",8,"黺黽黿",6], +["fc80","鼆",4,"鼌鼏鼑鼒鼔鼕鼖鼘鼚",5,"鼡鼣",8,"鼭鼮鼰鼱"], +["fd40","鼲",4,"鼸鼺鼼鼿",4,"齅",10,"齒",38], +["fd80","齹",5,"龁龂龍",11,"龜龝龞龡",4,"郎凉秊裏隣"], +["fe40","兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩"] +] diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp949.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp949.json new file mode 100644 index 0000000..2022a00 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp949.json @@ -0,0 +1,273 @@ +[ +["0","\u0000",127], +["8141","갂갃갅갆갋",4,"갘갞갟갡갢갣갥",6,"갮갲갳갴"], +["8161","갵갶갷갺갻갽갾갿걁",9,"걌걎",5,"걕"], +["8181","걖걗걙걚걛걝",18,"걲걳걵걶걹걻",4,"겂겇겈겍겎겏겑겒겓겕",6,"겞겢",5,"겫겭겮겱",6,"겺겾겿곀곂곃곅곆곇곉곊곋곍",7,"곖곘",7,"곢곣곥곦곩곫곭곮곲곴곷",4,"곾곿괁괂괃괅괇",4,"괎괐괒괓"], +["8241","괔괕괖괗괙괚괛괝괞괟괡",7,"괪괫괮",5], +["8261","괶괷괹괺괻괽",6,"굆굈굊",5,"굑굒굓굕굖굗"], +["8281","굙",7,"굢굤",7,"굮굯굱굲굷굸굹굺굾궀궃",4,"궊궋궍궎궏궑",10,"궞",5,"궥",17,"궸",7,"귂귃귅귆귇귉",6,"귒귔",7,"귝귞귟귡귢귣귥",18], +["8341","귺귻귽귾긂",5,"긊긌긎",5,"긕",7], +["8361","긝",18,"긲긳긵긶긹긻긼"], +["8381","긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗",4,"깞깢깣깤깦깧깪깫깭깮깯깱",6,"깺깾",5,"꺆",5,"꺍",46,"꺿껁껂껃껅",6,"껎껒",5,"껚껛껝",8], +["8441","껦껧껩껪껬껮",5,"껵껶껷껹껺껻껽",8], +["8461","꼆꼉꼊꼋꼌꼎꼏꼑",18], +["8481","꼤",7,"꼮꼯꼱꼳꼵",6,"꼾꽀꽄꽅꽆꽇꽊",5,"꽑",10,"꽞",5,"꽦",18,"꽺",5,"꾁꾂꾃꾅꾆꾇꾉",6,"꾒꾓꾔꾖",5,"꾝",26,"꾺꾻꾽꾾"], +["8541","꾿꿁",5,"꿊꿌꿏",4,"꿕",6,"꿝",4], +["8561","꿢",5,"꿪",5,"꿲꿳꿵꿶꿷꿹",6,"뀂뀃"], +["8581","뀅",6,"뀍뀎뀏뀑뀒뀓뀕",6,"뀞",9,"뀩",26,"끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞",29,"끾끿낁낂낃낅",6,"낎낐낒",5,"낛낝낞낣낤"], +["8641","낥낦낧낪낰낲낶낷낹낺낻낽",6,"냆냊",5,"냒"], +["8661","냓냕냖냗냙",6,"냡냢냣냤냦",10], +["8681","냱",22,"넊넍넎넏넑넔넕넖넗넚넞",4,"넦넧넩넪넫넭",6,"넶넺",5,"녂녃녅녆녇녉",6,"녒녓녖녗녙녚녛녝녞녟녡",22,"녺녻녽녾녿놁놃",4,"놊놌놎놏놐놑놕놖놗놙놚놛놝"], +["8741","놞",9,"놩",15], +["8761","놹",18,"뇍뇎뇏뇑뇒뇓뇕"], +["8781","뇖",5,"뇞뇠",7,"뇪뇫뇭뇮뇯뇱",7,"뇺뇼뇾",5,"눆눇눉눊눍",6,"눖눘눚",5,"눡",18,"눵",6,"눽",26,"뉙뉚뉛뉝뉞뉟뉡",6,"뉪",4], +["8841","뉯",4,"뉶",5,"뉽",6,"늆늇늈늊",4], +["8861","늏늒늓늕늖늗늛",4,"늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷"], +["8881","늸",15,"닊닋닍닎닏닑닓",4,"닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉",6,"댒댖",5,"댝",54,"덗덙덚덝덠덡덢덣"], +["8941","덦덨덪덬덭덯덲덳덵덶덷덹",6,"뎂뎆",5,"뎍"], +["8961","뎎뎏뎑뎒뎓뎕",10,"뎢",5,"뎩뎪뎫뎭"], +["8981","뎮",21,"돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩",18,"돽",18,"됑",6,"됙됚됛됝됞됟됡",6,"됪됬",7,"됵",15], +["8a41","둅",10,"둒둓둕둖둗둙",6,"둢둤둦"], +["8a61","둧",4,"둭",18,"뒁뒂"], +["8a81","뒃",4,"뒉",19,"뒞",5,"뒥뒦뒧뒩뒪뒫뒭",7,"뒶뒸뒺",5,"듁듂듃듅듆듇듉",6,"듑듒듓듔듖",5,"듞듟듡듢듥듧",4,"듮듰듲",5,"듹",26,"딖딗딙딚딝"], +["8b41","딞",5,"딦딫",4,"딲딳딵딶딷딹",6,"땂땆"], +["8b61","땇땈땉땊땎땏땑땒땓땕",6,"땞땢",8], +["8b81","땫",52,"떢떣떥떦떧떩떬떭떮떯떲떶",4,"떾떿뗁뗂뗃뗅",6,"뗎뗒",5,"뗙",18,"뗭",18], +["8c41","똀",15,"똒똓똕똖똗똙",4], +["8c61","똞",6,"똦",5,"똭",6,"똵",5], +["8c81","똻",12,"뙉",26,"뙥뙦뙧뙩",50,"뚞뚟뚡뚢뚣뚥",5,"뚭뚮뚯뚰뚲",16], +["8d41","뛃",16,"뛕",8], +["8d61","뛞",17,"뛱뛲뛳뛵뛶뛷뛹뛺"], +["8d81","뛻",4,"뜂뜃뜄뜆",33,"뜪뜫뜭뜮뜱",6,"뜺뜼",7,"띅띆띇띉띊띋띍",6,"띖",9,"띡띢띣띥띦띧띩",6,"띲띴띶",5,"띾띿랁랂랃랅",6,"랎랓랔랕랚랛랝랞"], +["8e41","랟랡",6,"랪랮",5,"랶랷랹",8], +["8e61","럂",4,"럈럊",19], +["8e81","럞",13,"럮럯럱럲럳럵",6,"럾렂",4,"렊렋렍렎렏렑",6,"렚렜렞",5,"렦렧렩렪렫렭",6,"렶렺",5,"롁롂롃롅",11,"롒롔",7,"롞롟롡롢롣롥",6,"롮롰롲",5,"롹롺롻롽",7], +["8f41","뢅",7,"뢎",17], +["8f61","뢠",7,"뢩",6,"뢱뢲뢳뢵뢶뢷뢹",4], +["8f81","뢾뢿룂룄룆",5,"룍룎룏룑룒룓룕",7,"룞룠룢",5,"룪룫룭룮룯룱",6,"룺룼룾",5,"뤅",18,"뤙",6,"뤡",26,"뤾뤿륁륂륃륅",6,"륍륎륐륒",5], +["9041","륚륛륝륞륟륡",6,"륪륬륮",5,"륶륷륹륺륻륽"], +["9061","륾",5,"릆릈릋릌릏",15], +["9081","릟",12,"릮릯릱릲릳릵",6,"릾맀맂",5,"맊맋맍맓",4,"맚맜맟맠맢맦맧맩맪맫맭",6,"맶맻",4,"먂",5,"먉",11,"먖",33,"먺먻먽먾먿멁멃멄멅멆"], +["9141","멇멊멌멏멐멑멒멖멗멙멚멛멝",6,"멦멪",5], +["9161","멲멳멵멶멷멹",9,"몆몈몉몊몋몍",5], +["9181","몓",20,"몪몭몮몯몱몳",4,"몺몼몾",5,"뫅뫆뫇뫉",14,"뫚",33,"뫽뫾뫿묁묂묃묅",7,"묎묐묒",5,"묙묚묛묝묞묟묡",6], +["9241","묨묪묬",7,"묷묹묺묿",4,"뭆뭈뭊뭋뭌뭎뭑뭒"], +["9261","뭓뭕뭖뭗뭙",7,"뭢뭤",7,"뭭",4], +["9281","뭲",21,"뮉뮊뮋뮍뮎뮏뮑",18,"뮥뮦뮧뮩뮪뮫뮭",6,"뮵뮶뮸",7,"믁믂믃믅믆믇믉",6,"믑믒믔",35,"믺믻믽믾밁"], +["9341","밃",4,"밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵"], +["9361","밶밷밹",6,"뱂뱆뱇뱈뱊뱋뱎뱏뱑",8], +["9381","뱚뱛뱜뱞",37,"벆벇벉벊벍벏",4,"벖벘벛",4,"벢벣벥벦벩",6,"벲벶",5,"벾벿볁볂볃볅",7,"볎볒볓볔볖볗볙볚볛볝",22,"볷볹볺볻볽"], +["9441","볾",5,"봆봈봊",5,"봑봒봓봕",8], +["9461","봞",5,"봥",6,"봭",12], +["9481","봺",5,"뵁",6,"뵊뵋뵍뵎뵏뵑",6,"뵚",9,"뵥뵦뵧뵩",22,"붂붃붅붆붋",4,"붒붔붖붗붘붛붝",6,"붥",10,"붱",6,"붹",24], +["9541","뷒뷓뷖뷗뷙뷚뷛뷝",11,"뷪",5,"뷱"], +["9561","뷲뷳뷵뷶뷷뷹",6,"븁븂븄븆",5,"븎븏븑븒븓"], +["9581","븕",6,"븞븠",35,"빆빇빉빊빋빍빏",4,"빖빘빜빝빞빟빢빣빥빦빧빩빫",4,"빲빶",4,"빾빿뺁뺂뺃뺅",6,"뺎뺒",5,"뺚",13,"뺩",14], +["9641","뺸",23,"뻒뻓"], +["9661","뻕뻖뻙",6,"뻡뻢뻦",5,"뻭",8], +["9681","뻶",10,"뼂",5,"뼊",13,"뼚뼞",33,"뽂뽃뽅뽆뽇뽉",6,"뽒뽓뽔뽖",44], +["9741","뾃",16,"뾕",8], +["9761","뾞",17,"뾱",7], +["9781","뾹",11,"뿆",5,"뿎뿏뿑뿒뿓뿕",6,"뿝뿞뿠뿢",89,"쀽쀾쀿"], +["9841","쁀",16,"쁒",5,"쁙쁚쁛"], +["9861","쁝쁞쁟쁡",6,"쁪",15], +["9881","쁺",21,"삒삓삕삖삗삙",6,"삢삤삦",5,"삮삱삲삷",4,"삾샂샃샄샆샇샊샋샍샎샏샑",6,"샚샞",5,"샦샧샩샪샫샭",6,"샶샸샺",5,"섁섂섃섅섆섇섉",6,"섑섒섓섔섖",5,"섡섢섥섨섩섪섫섮"], +["9941","섲섳섴섵섷섺섻섽섾섿셁",6,"셊셎",5,"셖셗"], +["9961","셙셚셛셝",6,"셦셪",5,"셱셲셳셵셶셷셹셺셻"], +["9981","셼",8,"솆",5,"솏솑솒솓솕솗",4,"솞솠솢솣솤솦솧솪솫솭솮솯솱",11,"솾",5,"쇅쇆쇇쇉쇊쇋쇍",6,"쇕쇖쇙",6,"쇡쇢쇣쇥쇦쇧쇩",6,"쇲쇴",7,"쇾쇿숁숂숃숅",6,"숎숐숒",5,"숚숛숝숞숡숢숣"], +["9a41","숤숥숦숧숪숬숮숰숳숵",16], +["9a61","쉆쉇쉉",6,"쉒쉓쉕쉖쉗쉙",6,"쉡쉢쉣쉤쉦"], +["9a81","쉧",4,"쉮쉯쉱쉲쉳쉵",6,"쉾슀슂",5,"슊",5,"슑",6,"슙슚슜슞",5,"슦슧슩슪슫슮",5,"슶슸슺",33,"싞싟싡싢싥",5,"싮싰싲싳싴싵싷싺싽싾싿쌁",6,"쌊쌋쌎쌏"], +["9b41","쌐쌑쌒쌖쌗쌙쌚쌛쌝",6,"쌦쌧쌪",8], +["9b61","쌳",17,"썆",7], +["9b81","썎",25,"썪썫썭썮썯썱썳",4,"썺썻썾",5,"쎅쎆쎇쎉쎊쎋쎍",50,"쏁",22,"쏚"], +["9c41","쏛쏝쏞쏡쏣",4,"쏪쏫쏬쏮",5,"쏶쏷쏹",5], +["9c61","쏿",8,"쐉",6,"쐑",9], +["9c81","쐛",8,"쐥",6,"쐭쐮쐯쐱쐲쐳쐵",6,"쐾",9,"쑉",26,"쑦쑧쑩쑪쑫쑭",6,"쑶쑷쑸쑺",5,"쒁",18,"쒕",6,"쒝",12], +["9d41","쒪",13,"쒹쒺쒻쒽",8], +["9d61","쓆",25], +["9d81","쓠",8,"쓪",5,"쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂",9,"씍씎씏씑씒씓씕",6,"씝",10,"씪씫씭씮씯씱",6,"씺씼씾",5,"앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩",6,"앲앶",5,"앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔"], +["9e41","얖얙얚얛얝얞얟얡",7,"얪",9,"얶"], +["9e61","얷얺얿",4,"엋엍엏엒엓엕엖엗엙",6,"엢엤엦엧"], +["9e81","엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑",6,"옚옝",6,"옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉",6,"왒왖",5,"왞왟왡",10,"왭왮왰왲",5,"왺왻왽왾왿욁",6,"욊욌욎",5,"욖욗욙욚욛욝",6,"욦"], +["9f41","욨욪",5,"욲욳욵욶욷욻",4,"웂웄웆",5,"웎"], +["9f61","웏웑웒웓웕",6,"웞웟웢",5,"웪웫웭웮웯웱웲"], +["9f81","웳",4,"웺웻웼웾",5,"윆윇윉윊윋윍",6,"윖윘윚",5,"윢윣윥윦윧윩",6,"윲윴윶윸윹윺윻윾윿읁읂읃읅",4,"읋읎읐읙읚읛읝읞읟읡",6,"읩읪읬",7,"읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛",4,"잢잧",4,"잮잯잱잲잳잵잶잷"], +["a041","잸잹잺잻잾쟂",5,"쟊쟋쟍쟏쟑",6,"쟙쟚쟛쟜"], +["a061","쟞",5,"쟥쟦쟧쟩쟪쟫쟭",13], +["a081","쟻",4,"젂젃젅젆젇젉젋",4,"젒젔젗",4,"젞젟젡젢젣젥",6,"젮젰젲",5,"젹젺젻젽젾젿졁",6,"졊졋졎",5,"졕",26,"졲졳졵졶졷졹졻",4,"좂좄좈좉좊좎",5,"좕",7,"좞좠좢좣좤"], +["a141","좥좦좧좩",18,"좾좿죀죁"], +["a161","죂죃죅죆죇죉죊죋죍",6,"죖죘죚",5,"죢죣죥"], +["a181","죦",14,"죶",5,"죾죿줁줂줃줇",4,"줎 、。·‥…¨〃­―∥\∼‘’“”〔〕〈",9,"±×÷≠≤≥∞∴°′″℃Å¢£¥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨¬"], +["a241","줐줒",5,"줙",18], +["a261","줭",6,"줵",18], +["a281","쥈",7,"쥒쥓쥕쥖쥗쥙",6,"쥢쥤",7,"쥭쥮쥯⇒⇔∀∃´~ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®"], +["a341","쥱쥲쥳쥵",6,"쥽",10,"즊즋즍즎즏"], +["a361","즑",6,"즚즜즞",16], +["a381","즯",16,"짂짃짅짆짉짋",4,"짒짔짗짘짛!",58,"₩]",32," ̄"], +["a441","짞짟짡짣짥짦짨짩짪짫짮짲",5,"짺짻짽짾짿쨁쨂쨃쨄"], +["a461","쨅쨆쨇쨊쨎",5,"쨕쨖쨗쨙",12], +["a481","쨦쨧쨨쨪",28,"ㄱ",93], +["a541","쩇",4,"쩎쩏쩑쩒쩓쩕",6,"쩞쩢",5,"쩩쩪"], +["a561","쩫",17,"쩾",5,"쪅쪆"], +["a581","쪇",16,"쪙",14,"ⅰ",9], +["a5b0","Ⅰ",9], +["a5c1","Α",16,"Σ",6], +["a5e1","α",16,"σ",6], +["a641","쪨",19,"쪾쪿쫁쫂쫃쫅"], +["a661","쫆",5,"쫎쫐쫒쫔쫕쫖쫗쫚",5,"쫡",6], +["a681","쫨쫩쫪쫫쫭",6,"쫵",18,"쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃",7], +["a741","쬋",4,"쬑쬒쬓쬕쬖쬗쬙",6,"쬢",7], +["a761","쬪",22,"쭂쭃쭄"], +["a781","쭅쭆쭇쭊쭋쭍쭎쭏쭑",6,"쭚쭛쭜쭞",5,"쭥",7,"㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙",9,"㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰",9,"㎀",4,"㎺",5,"㎐",4,"Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆"], +["a841","쭭",10,"쭺",14], +["a861","쮉",18,"쮝",6], +["a881","쮤",19,"쮹",11,"ÆЪĦ"], +["a8a6","IJ"], +["a8a8","ĿŁØŒºÞŦŊ"], +["a8b1","㉠",27,"ⓐ",25,"①",14,"½⅓⅔¼¾⅛⅜⅝⅞"], +["a941","쯅",14,"쯕",10], +["a961","쯠쯡쯢쯣쯥쯦쯨쯪",18], +["a981","쯽",14,"찎찏찑찒찓찕",6,"찞찟찠찣찤æđðħıijĸŀłøœßþŧŋʼn㈀",27,"⒜",25,"⑴",14,"¹²³⁴ⁿ₁₂₃₄"], +["aa41","찥찦찪찫찭찯찱",6,"찺찿",4,"챆챇챉챊챋챍챎"], +["aa61","챏",4,"챖챚",5,"챡챢챣챥챧챩",6,"챱챲"], +["aa81","챳챴챶",29,"ぁ",82], +["ab41","첔첕첖첗첚첛첝첞첟첡",6,"첪첮",5,"첶첷첹"], +["ab61","첺첻첽",6,"쳆쳈쳊",5,"쳑쳒쳓쳕",5], +["ab81","쳛",8,"쳥",6,"쳭쳮쳯쳱",12,"ァ",85], +["ac41","쳾쳿촀촂",5,"촊촋촍촎촏촑",6,"촚촜촞촟촠"], +["ac61","촡촢촣촥촦촧촩촪촫촭",11,"촺",4], +["ac81","촿",28,"쵝쵞쵟А",5,"ЁЖ",25], +["acd1","а",5,"ёж",25], +["ad41","쵡쵢쵣쵥",6,"쵮쵰쵲",5,"쵹",7], +["ad61","춁",6,"춉",10,"춖춗춙춚춛춝춞춟"], +["ad81","춠춡춢춣춦춨춪",5,"춱",18,"췅"], +["ae41","췆",5,"췍췎췏췑",16], +["ae61","췢",5,"췩췪췫췭췮췯췱",6,"췺췼췾",4], +["ae81","츃츅츆츇츉츊츋츍",6,"츕츖츗츘츚",5,"츢츣츥츦츧츩츪츫"], +["af41","츬츭츮츯츲츴츶",19], +["af61","칊",13,"칚칛칝칞칢",5,"칪칬"], +["af81","칮",5,"칶칷칹칺칻칽",6,"캆캈캊",5,"캒캓캕캖캗캙"], +["b041","캚",5,"캢캦",5,"캮",12], +["b061","캻",5,"컂",19], +["b081","컖",13,"컦컧컩컪컭",6,"컶컺",5,"가각간갇갈갉갊감",7,"같",4,"갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆"], +["b141","켂켃켅켆켇켉",6,"켒켔켖",5,"켝켞켟켡켢켣"], +["b161","켥",6,"켮켲",5,"켹",11], +["b181","콅",14,"콖콗콙콚콛콝",6,"콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸"], +["b241","콭콮콯콲콳콵콶콷콹",6,"쾁쾂쾃쾄쾆",5,"쾍"], +["b261","쾎",18,"쾢",5,"쾩"], +["b281","쾪",5,"쾱",18,"쿅",6,"깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙"], +["b341","쿌",19,"쿢쿣쿥쿦쿧쿩"], +["b361","쿪",5,"쿲쿴쿶",5,"쿽쿾쿿퀁퀂퀃퀅",5], +["b381","퀋",5,"퀒",5,"퀙",19,"끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫",4,"낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝"], +["b441","퀮",5,"퀶퀷퀹퀺퀻퀽",6,"큆큈큊",5], +["b461","큑큒큓큕큖큗큙",6,"큡",10,"큮큯"], +["b481","큱큲큳큵",6,"큾큿킀킂",18,"뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫",4,"닳담답닷",4,"닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥"], +["b541","킕",14,"킦킧킩킪킫킭",5], +["b561","킳킶킸킺",5,"탂탃탅탆탇탊",5,"탒탖",4], +["b581","탛탞탟탡탢탣탥",6,"탮탲",5,"탹",11,"덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸"], +["b641","턅",7,"턎",17], +["b661","턠",15,"턲턳턵턶턷턹턻턼턽턾"], +["b681","턿텂텆",5,"텎텏텑텒텓텕",6,"텞텠텢",5,"텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗"], +["b741","텮",13,"텽",6,"톅톆톇톉톊"], +["b761","톋",20,"톢톣톥톦톧"], +["b781","톩",6,"톲톴톶톷톸톹톻톽톾톿퇁",14,"래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩"], +["b841","퇐",7,"퇙",17], +["b861","퇫",8,"퇵퇶퇷퇹",13], +["b881","툈툊",5,"툑",24,"륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많",4,"맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼"], +["b941","툪툫툮툯툱툲툳툵",6,"툾퉀퉂",5,"퉉퉊퉋퉌"], +["b961","퉍",14,"퉝",6,"퉥퉦퉧퉨"], +["b981","퉩",22,"튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바",4,"받",4,"밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗"], +["ba41","튍튎튏튒튓튔튖",5,"튝튞튟튡튢튣튥",6,"튭"], +["ba61","튮튯튰튲",5,"튺튻튽튾틁틃",4,"틊틌",5], +["ba81","틒틓틕틖틗틙틚틛틝",6,"틦",9,"틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤"], +["bb41","틻",4,"팂팄팆",5,"팏팑팒팓팕팗",4,"팞팢팣"], +["bb61","팤팦팧팪팫팭팮팯팱",6,"팺팾",5,"퍆퍇퍈퍉"], +["bb81","퍊",31,"빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤"], +["bc41","퍪",17,"퍾퍿펁펂펃펅펆펇"], +["bc61","펈펉펊펋펎펒",5,"펚펛펝펞펟펡",6,"펪펬펮"], +["bc81","펯",4,"펵펶펷펹펺펻펽",6,"폆폇폊",5,"폑",5,"샥샨샬샴샵샷샹섀섄섈섐섕서",4,"섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭"], +["bd41","폗폙",7,"폢폤",7,"폮폯폱폲폳폵폶폷"], +["bd61","폸폹폺폻폾퐀퐂",5,"퐉",13], +["bd81","퐗",5,"퐞",25,"숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰"], +["be41","퐸",7,"푁푂푃푅",14], +["be61","푔",7,"푝푞푟푡푢푣푥",7,"푮푰푱푲"], +["be81","푳",4,"푺푻푽푾풁풃",4,"풊풌풎",5,"풕",8,"쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄",6,"엌엎"], +["bf41","풞",10,"풪",14], +["bf61","풹",18,"퓍퓎퓏퓑퓒퓓퓕"], +["bf81","퓖",5,"퓝퓞퓠",7,"퓩퓪퓫퓭퓮퓯퓱",6,"퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염",5,"옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨"], +["c041","퓾",5,"픅픆픇픉픊픋픍",6,"픖픘",5], +["c061","픞",25], +["c081","픸픹픺픻픾픿핁핂핃핅",6,"핎핐핒",5,"핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응",7,"읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊"], +["c141","핤핦핧핪핬핮",5,"핶핷핹핺핻핽",6,"햆햊햋"], +["c161","햌햍햎햏햑",19,"햦햧"], +["c181","햨",31,"점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓"], +["c241","헊헋헍헎헏헑헓",4,"헚헜헞",5,"헦헧헩헪헫헭헮"], +["c261","헯",4,"헶헸헺",5,"혂혃혅혆혇혉",6,"혒"], +["c281","혖",5,"혝혞혟혡혢혣혥",7,"혮",9,"혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻"], +["c341","혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝",4], +["c361","홢",4,"홨홪",5,"홲홳홵",11], +["c381","횁횂횄횆",5,"횎횏횑횒횓횕",7,"횞횠횢",5,"횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층"], +["c441","횫횭횮횯횱",7,"횺횼",7,"훆훇훉훊훋"], +["c461","훍훎훏훐훒훓훕훖훘훚",5,"훡훢훣훥훦훧훩",4], +["c481","훮훯훱훲훳훴훶",5,"훾훿휁휂휃휅",11,"휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼"], +["c541","휕휖휗휚휛휝휞휟휡",6,"휪휬휮",5,"휶휷휹"], +["c561","휺휻휽",6,"흅흆흈흊",5,"흒흓흕흚",4], +["c581","흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵",6,"흾흿힀힂",5,"힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜"], +["c641","힍힎힏힑",6,"힚힜힞",5], +["c6a1","퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁"], +["c7a1","퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠"], +["c8a1","혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝"], +["caa1","伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕"], +["cba1","匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢"], +["cca1","瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械"], +["cda1","棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜"], +["cea1","科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾"], +["cfa1","區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴"], +["d0a1","鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣"], +["d1a1","朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩",5,"那樂",4,"諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉"], +["d2a1","納臘蠟衲囊娘廊",4,"乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧",5,"駑魯",10,"濃籠聾膿農惱牢磊腦賂雷尿壘",7,"嫩訥杻紐勒",5,"能菱陵尼泥匿溺多茶"], +["d3a1","丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃"], +["d4a1","棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅"], +["d5a1","蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣"], +["d6a1","煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼"], +["d7a1","遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬"], +["d8a1","立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅"], +["d9a1","蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文"], +["daa1","汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑"], +["dba1","發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖"], +["dca1","碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦"], +["dda1","孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥"], +["dea1","脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索"], +["dfa1","傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署"], +["e0a1","胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬"], +["e1a1","聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁"], +["e2a1","戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧"], +["e3a1","嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁"], +["e4a1","沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額"], +["e5a1","櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬"], +["e6a1","旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒"], +["e7a1","簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳"], +["e8a1","烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療"], +["e9a1","窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓"], +["eaa1","運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜"], +["eba1","濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼"], +["eca1","議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄"], +["eda1","立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長"], +["eea1","障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱"], +["efa1","煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖"], +["f0a1","靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫"], +["f1a1","踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只"], +["f2a1","咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯"], +["f3a1","鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策"], +["f4a1","責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢"], +["f5a1","椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃"], +["f6a1","贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託"], +["f7a1","鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑"], +["f8a1","阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃"], +["f9a1","品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航"], +["faa1","行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型"], +["fba1","形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵"], +["fca1","禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆"], +["fda1","爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰"] +] diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp950.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp950.json new file mode 100644 index 0000000..d8bc871 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/cp950.json @@ -0,0 +1,177 @@ +[ +["0","\u0000",127], +["a140"," ,、。.‧;:?!︰…‥﹐﹑﹒·﹔﹕﹖﹗|–︱—︳╴︴﹏()︵︶{}︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚"], +["a1a1","﹛﹜﹝﹞‘’“”〝〞‵′#&*※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯ ̄_ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡+-×÷±√<>=≦≧≠∞≒≡﹢",4,"~∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣/"], +["a240","\∕﹨$¥〒¢£%@℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁",7,"▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭"], +["a2a1","╮╰╯═╞╪╡◢◣◥◤╱╲╳0",9,"Ⅰ",9,"〡",8,"十卄卅A",25,"a",21], +["a340","wxyzΑ",16,"Σ",6,"α",16,"σ",6,"ㄅ",10], +["a3a1","ㄐ",25,"˙ˉˊˇˋ"], +["a3e1","€"], +["a440","一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才"], +["a4a1","丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙"], +["a540","世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外"], +["a5a1","央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全"], +["a640","共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年"], +["a6a1","式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣"], +["a740","作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍"], +["a7a1","均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠"], +["a840","杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒"], +["a8a1","芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵"], +["a940","咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居"], +["a9a1","屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊"], +["aa40","昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠"], +["aaa1","炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附"], +["ab40","陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品"], +["aba1","哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷"], +["ac40","拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗"], +["aca1","活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄"], +["ad40","耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥"], +["ada1","迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪"], +["ae40","哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙"], +["aea1","恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓"], +["af40","浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷"], +["afa1","砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃"], +["b040","虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡"], +["b0a1","陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀"], +["b140","娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽"], +["b1a1","情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺"], +["b240","毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶"], +["b2a1","瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼"], +["b340","莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途"], +["b3a1","部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠"], +["b440","婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍"], +["b4a1","插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋"], +["b540","溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘"], +["b5a1","窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁"], +["b640","詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑"], +["b6a1","間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼"], +["b740","媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業"], +["b7a1","楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督"], +["b840","睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫"], +["b8a1","腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊"], +["b940","辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴"], +["b9a1","飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇"], +["ba40","愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢"], +["baa1","滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬"], +["bb40","罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤"], +["bba1","說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜"], +["bc40","劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂"], +["bca1","慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃"], +["bd40","瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯"], +["bda1","翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞"], +["be40","輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉"], +["bea1","鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡"], +["bf40","濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊"], +["bfa1","縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚"], +["c040","錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇"], +["c0a1","嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬"], +["c140","瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪"], +["c1a1","薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁"], +["c240","駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘"], +["c2a1","癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦"], +["c340","鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸"], +["c3a1","獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類"], +["c440","願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼"], +["c4a1","纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴"], +["c540","護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬"], +["c5a1","禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒"], +["c640","讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲"], +["c940","乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕"], +["c9a1","氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋"], +["ca40","汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘"], +["caa1","吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇"], +["cb40","杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓"], +["cba1","芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢"], +["cc40","坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋"], +["cca1","怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲"], +["cd40","泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺"], +["cda1","矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏"], +["ce40","哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛"], +["cea1","峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺"], +["cf40","柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂"], +["cfa1","洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀"], +["d040","穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪"], +["d0a1","苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱"], +["d140","唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧"], +["d1a1","恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤"], +["d240","毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸"], +["d2a1","牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐"], +["d340","笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢"], +["d3a1","荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐"], +["d440","酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅"], +["d4a1","唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏"], +["d540","崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟"], +["d5a1","捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉"], +["d640","淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏"], +["d6a1","痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟"], +["d740","耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷"], +["d7a1","蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪"], +["d840","釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷"], +["d8a1","堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔"], +["d940","惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒"], +["d9a1","晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞"], +["da40","湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖"], +["daa1","琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥"], +["db40","罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳"], +["dba1","菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺"], +["dc40","軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈"], +["dca1","隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆"], +["dd40","媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤"], +["dda1","搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼"], +["de40","毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓"], +["dea1","煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓"], +["df40","稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯"], +["dfa1","腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤"], +["e040","觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿"], +["e0a1","遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠"], +["e140","凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠"], +["e1a1","寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉"], +["e240","榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊"], +["e2a1","漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓"], +["e340","禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞"], +["e3a1","耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻"], +["e440","裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍"], +["e4a1","銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘"], +["e540","噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉"], +["e5a1","憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒"], +["e640","澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙"], +["e6a1","獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟"], +["e740","膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢"], +["e7a1","蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧"], +["e840","踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓"], +["e8a1","銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮"], +["e940","噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺"], +["e9a1","憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸"], +["ea40","澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙"], +["eaa1","瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘"], +["eb40","蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠"], +["eba1","諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌"], +["ec40","錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕"], +["eca1","魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎"], +["ed40","檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶"], +["eda1","瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞"], +["ee40","蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞"], +["eea1","謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜"], +["ef40","鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰"], +["efa1","鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶"], +["f040","璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒"], +["f0a1","臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧"], +["f140","蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪"], +["f1a1","鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰"], +["f240","徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛"], +["f2a1","礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕"], +["f340","譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦"], +["f3a1","鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲"], +["f440","嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩"], +["f4a1","禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿"], +["f540","鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛"], +["f5a1","鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥"], +["f640","蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺"], +["f6a1","騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚"], +["f740","糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊"], +["f7a1","驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾"], +["f840","讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏"], +["f8a1","齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚"], +["f940","纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊"], +["f9a1","龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"] +] diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/eucjp.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/eucjp.json new file mode 100644 index 0000000..4fa61ca --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/eucjp.json @@ -0,0 +1,182 @@ +[ +["0","\u0000",127], +["8ea1","。",62], +["a1a1"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇"], +["a2a1","◆□■△▲▽▼※〒→←↑↓〓"], +["a2ba","∈∋⊆⊇⊂⊃∪∩"], +["a2ca","∧∨¬⇒⇔∀∃"], +["a2dc","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], +["a2f2","ʼn♯♭♪†‡¶"], +["a2fe","◯"], +["a3b0","0",9], +["a3c1","A",25], +["a3e1","a",25], +["a4a1","ぁ",82], +["a5a1","ァ",85], +["a6a1","Α",16,"Σ",6], +["a6c1","α",16,"σ",6], +["a7a1","А",5,"ЁЖ",25], +["a7d1","а",5,"ёж",25], +["a8a1","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], +["ada1","①",19,"Ⅰ",9], +["adc0","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], +["addf","㍻〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], +["b0a1","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], +["b1a1","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応"], +["b2a1","押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], +["b3a1","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱"], +["b4a1","粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], +["b5a1","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京"], +["b6a1","供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], +["b7a1","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲"], +["b8a1","検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], +["b9a1","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込"], +["baa1","此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], +["bba1","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時"], +["bca1","次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], +["bda1","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償"], +["bea1","勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], +["bfa1","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾"], +["c0a1","澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], +["c1a1","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎"], +["c2a1","臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], +["c3a1","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵"], +["c4a1","帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], +["c5a1","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到"], +["c6a1","董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], +["c7a1","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦"], +["c8a1","函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], +["c9a1","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服"], +["caa1","福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], +["cba1","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満"], +["cca1","漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], +["cda1","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃"], +["cea1","痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], +["cfa1","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], +["d0a1","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], +["d1a1","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨"], +["d2a1","辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], +["d3a1","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉"], +["d4a1","圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], +["d5a1","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓"], +["d6a1","屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], +["d7a1","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚"], +["d8a1","悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], +["d9a1","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼"], +["daa1","據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], +["dba1","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍"], +["dca1","棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], +["dda1","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾"], +["dea1","沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], +["dfa1","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼"], +["e0a1","燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], +["e1a1","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰"], +["e2a1","癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], +["e3a1","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐"], +["e4a1","筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], +["e5a1","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺"], +["e6a1","罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], +["e7a1","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙"], +["e8a1","茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], +["e9a1","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙"], +["eaa1","蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], +["eba1","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫"], +["eca1","譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], +["eda1","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸"], +["eea1","遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], +["efa1","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞"], +["f0a1","陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], +["f1a1","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷"], +["f2a1","髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], +["f3a1","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠"], +["f4a1","堯槇遙瑤凜熙"], +["f9a1","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德"], +["faa1","忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], +["fba1","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚"], +["fca1","釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], +["fcf1","ⅰ",9,"¬¦'""], +["8fa2af","˘ˇ¸˙˝¯˛˚~΄΅"], +["8fa2c2","¡¦¿"], +["8fa2eb","ºª©®™¤№"], +["8fa6e1","ΆΈΉΊΪ"], +["8fa6e7","Ό"], +["8fa6e9","ΎΫ"], +["8fa6ec","Ώ"], +["8fa6f1","άέήίϊΐόςύϋΰώ"], +["8fa7c2","Ђ",10,"ЎЏ"], +["8fa7f2","ђ",10,"ўџ"], +["8fa9a1","ÆĐ"], +["8fa9a4","Ħ"], +["8fa9a6","IJ"], +["8fa9a8","ŁĿ"], +["8fa9ab","ŊØŒ"], +["8fa9af","ŦÞ"], +["8fa9c1","æđðħıijĸłŀʼnŋøœßŧþ"], +["8faaa1","ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈËÊĚĖĒĘ"], +["8faaba","ĜĞĢĠĤÍÌÏÎǏİĪĮĨĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙǕŴÝŸŶŹŽŻ"], +["8faba1","áàäâăǎāąåãćĉčçċďéèëêěėēęǵĝğ"], +["8fabbd","ġĥíìïîǐ"], +["8fabc5","īįĩĵķĺľļńňņñóòöôǒőōõŕřŗśŝšşťţúùüûŭǔűūųůũǘǜǚǖŵýÿŷźžż"], +["8fb0a1","丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄"], +["8fb1a1","侅侉侊侌侎侐侒侓侔侗侙侚侞侟侲侷侹侻侼侽侾俀俁俅俆俈俉俋俌俍俏俒俜俠俢俰俲俼俽俿倀倁倄倇倊倌倎倐倓倗倘倛倜倝倞倢倧倮倰倲倳倵偀偁偂偅偆偊偌偎偑偒偓偗偙偟偠偢偣偦偧偪偭偰偱倻傁傃傄傆傊傎傏傐"], +["8fb2a1","傒傓傔傖傛傜傞",4,"傪傯傰傹傺傽僀僃僄僇僌僎僐僓僔僘僜僝僟僢僤僦僨僩僯僱僶僺僾儃儆儇儈儋儌儍儎僲儐儗儙儛儜儝儞儣儧儨儬儭儯儱儳儴儵儸儹兂兊兏兓兕兗兘兟兤兦兾冃冄冋冎冘冝冡冣冭冸冺冼冾冿凂"], +["8fb3a1","凈减凑凒凓凕凘凞凢凥凮凲凳凴凷刁刂刅划刓刕刖刘刢刨刱刲刵刼剅剉剕剗剘剚剜剟剠剡剦剮剷剸剹劀劂劅劊劌劓劕劖劗劘劚劜劤劥劦劧劯劰劶劷劸劺劻劽勀勄勆勈勌勏勑勔勖勛勜勡勥勨勩勪勬勰勱勴勶勷匀匃匊匋"], +["8fb4a1","匌匑匓匘匛匜匞匟匥匧匨匩匫匬匭匰匲匵匼匽匾卂卌卋卙卛卡卣卥卬卭卲卹卾厃厇厈厎厓厔厙厝厡厤厪厫厯厲厴厵厷厸厺厽叀叅叏叒叓叕叚叝叞叠另叧叵吂吓吚吡吧吨吪启吱吴吵呃呄呇呍呏呞呢呤呦呧呩呫呭呮呴呿"], +["8fb5a1","咁咃咅咈咉咍咑咕咖咜咟咡咦咧咩咪咭咮咱咷咹咺咻咿哆哊响哎哠哪哬哯哶哼哾哿唀唁唅唈唉唌唍唎唕唪唫唲唵唶唻唼唽啁啇啉啊啍啐啑啘啚啛啞啠啡啤啦啿喁喂喆喈喎喏喑喒喓喔喗喣喤喭喲喿嗁嗃嗆嗉嗋嗌嗎嗑嗒"], +["8fb6a1","嗓嗗嗘嗛嗞嗢嗩嗶嗿嘅嘈嘊嘍",5,"嘙嘬嘰嘳嘵嘷嘹嘻嘼嘽嘿噀噁噃噄噆噉噋噍噏噔噞噠噡噢噣噦噩噭噯噱噲噵嚄嚅嚈嚋嚌嚕嚙嚚嚝嚞嚟嚦嚧嚨嚩嚫嚬嚭嚱嚳嚷嚾囅囉囊囋囏囐囌囍囙囜囝囟囡囤",4,"囱囫园"], +["8fb7a1","囶囷圁圂圇圊圌圑圕圚圛圝圠圢圣圤圥圩圪圬圮圯圳圴圽圾圿坅坆坌坍坒坢坥坧坨坫坭",4,"坳坴坵坷坹坺坻坼坾垁垃垌垔垗垙垚垜垝垞垟垡垕垧垨垩垬垸垽埇埈埌埏埕埝埞埤埦埧埩埭埰埵埶埸埽埾埿堃堄堈堉埡"], +["8fb8a1","堌堍堛堞堟堠堦堧堭堲堹堿塉塌塍塏塐塕塟塡塤塧塨塸塼塿墀墁墇墈墉墊墌墍墏墐墔墖墝墠墡墢墦墩墱墲壄墼壂壈壍壎壐壒壔壖壚壝壡壢壩壳夅夆夋夌夒夓夔虁夝夡夣夤夨夯夰夳夵夶夿奃奆奒奓奙奛奝奞奟奡奣奫奭"], +["8fb9a1","奯奲奵奶她奻奼妋妌妎妒妕妗妟妤妧妭妮妯妰妳妷妺妼姁姃姄姈姊姍姒姝姞姟姣姤姧姮姯姱姲姴姷娀娄娌娍娎娒娓娞娣娤娧娨娪娭娰婄婅婇婈婌婐婕婞婣婥婧婭婷婺婻婾媋媐媓媖媙媜媞媟媠媢媧媬媱媲媳媵媸媺媻媿"], +["8fbaa1","嫄嫆嫈嫏嫚嫜嫠嫥嫪嫮嫵嫶嫽嬀嬁嬈嬗嬴嬙嬛嬝嬡嬥嬭嬸孁孋孌孒孖孞孨孮孯孼孽孾孿宁宄宆宊宎宐宑宓宔宖宨宩宬宭宯宱宲宷宺宼寀寁寍寏寖",4,"寠寯寱寴寽尌尗尞尟尣尦尩尫尬尮尰尲尵尶屙屚屜屢屣屧屨屩"], +["8fbba1","屭屰屴屵屺屻屼屽岇岈岊岏岒岝岟岠岢岣岦岪岲岴岵岺峉峋峒峝峗峮峱峲峴崁崆崍崒崫崣崤崦崧崱崴崹崽崿嵂嵃嵆嵈嵕嵑嵙嵊嵟嵠嵡嵢嵤嵪嵭嵰嵹嵺嵾嵿嶁嶃嶈嶊嶒嶓嶔嶕嶙嶛嶟嶠嶧嶫嶰嶴嶸嶹巃巇巋巐巎巘巙巠巤"], +["8fbca1","巩巸巹帀帇帍帒帔帕帘帟帠帮帨帲帵帾幋幐幉幑幖幘幛幜幞幨幪",4,"幰庀庋庎庢庤庥庨庪庬庱庳庽庾庿廆廌廋廎廑廒廔廕廜廞廥廫异弆弇弈弎弙弜弝弡弢弣弤弨弫弬弮弰弴弶弻弽弿彀彄彅彇彍彐彔彘彛彠彣彤彧"], +["8fbda1","彯彲彴彵彸彺彽彾徉徍徏徖徜徝徢徧徫徤徬徯徰徱徸忄忇忈忉忋忐",4,"忞忡忢忨忩忪忬忭忮忯忲忳忶忺忼怇怊怍怓怔怗怘怚怟怤怭怳怵恀恇恈恉恌恑恔恖恗恝恡恧恱恾恿悂悆悈悊悎悑悓悕悘悝悞悢悤悥您悰悱悷"], +["8fbea1","悻悾惂惄惈惉惊惋惎惏惔惕惙惛惝惞惢惥惲惵惸惼惽愂愇愊愌愐",4,"愖愗愙愜愞愢愪愫愰愱愵愶愷愹慁慅慆慉慞慠慬慲慸慻慼慿憀憁憃憄憋憍憒憓憗憘憜憝憟憠憥憨憪憭憸憹憼懀懁懂懎懏懕懜懝懞懟懡懢懧懩懥"], +["8fbfa1","懬懭懯戁戃戄戇戓戕戜戠戢戣戧戩戫戹戽扂扃扄扆扌扐扑扒扔扖扚扜扤扭扯扳扺扽抍抎抏抐抦抨抳抶抷抺抾抿拄拎拕拖拚拪拲拴拼拽挃挄挊挋挍挐挓挖挘挩挪挭挵挶挹挼捁捂捃捄捆捊捋捎捒捓捔捘捛捥捦捬捭捱捴捵"], +["8fc0a1","捸捼捽捿掂掄掇掊掐掔掕掙掚掞掤掦掭掮掯掽揁揅揈揎揑揓揔揕揜揠揥揪揬揲揳揵揸揹搉搊搐搒搔搘搞搠搢搤搥搩搪搯搰搵搽搿摋摏摑摒摓摔摚摛摜摝摟摠摡摣摭摳摴摻摽撅撇撏撐撑撘撙撛撝撟撡撣撦撨撬撳撽撾撿"], +["8fc1a1","擄擉擊擋擌擎擐擑擕擗擤擥擩擪擭擰擵擷擻擿攁攄攈攉攊攏攓攔攖攙攛攞攟攢攦攩攮攱攺攼攽敃敇敉敐敒敔敟敠敧敫敺敽斁斅斊斒斕斘斝斠斣斦斮斲斳斴斿旂旈旉旎旐旔旖旘旟旰旲旴旵旹旾旿昀昄昈昉昍昑昒昕昖昝"], +["8fc2a1","昞昡昢昣昤昦昩昪昫昬昮昰昱昳昹昷晀晅晆晊晌晑晎晗晘晙晛晜晠晡曻晪晫晬晾晳晵晿晷晸晹晻暀晼暋暌暍暐暒暙暚暛暜暟暠暤暭暱暲暵暻暿曀曂曃曈曌曎曏曔曛曟曨曫曬曮曺朅朇朎朓朙朜朠朢朳朾杅杇杈杌杔杕杝"], +["8fc3a1","杦杬杮杴杶杻极构枎枏枑枓枖枘枙枛枰枱枲枵枻枼枽柹柀柂柃柅柈柉柒柗柙柜柡柦柰柲柶柷桒栔栙栝栟栨栧栬栭栯栰栱栳栻栿桄桅桊桌桕桗桘桛桫桮",4,"桵桹桺桻桼梂梄梆梈梖梘梚梜梡梣梥梩梪梮梲梻棅棈棌棏"], +["8fc4a1","棐棑棓棖棙棜棝棥棨棪棫棬棭棰棱棵棶棻棼棽椆椉椊椐椑椓椖椗椱椳椵椸椻楂楅楉楎楗楛楣楤楥楦楨楩楬楰楱楲楺楻楿榀榍榒榖榘榡榥榦榨榫榭榯榷榸榺榼槅槈槑槖槗槢槥槮槯槱槳槵槾樀樁樃樏樑樕樚樝樠樤樨樰樲"], +["8fc5a1","樴樷樻樾樿橅橆橉橊橎橐橑橒橕橖橛橤橧橪橱橳橾檁檃檆檇檉檋檑檛檝檞檟檥檫檯檰檱檴檽檾檿櫆櫉櫈櫌櫐櫔櫕櫖櫜櫝櫤櫧櫬櫰櫱櫲櫼櫽欂欃欆欇欉欏欐欑欗欛欞欤欨欫欬欯欵欶欻欿歆歊歍歒歖歘歝歠歧歫歮歰歵歽"], +["8fc6a1","歾殂殅殗殛殟殠殢殣殨殩殬殭殮殰殸殹殽殾毃毄毉毌毖毚毡毣毦毧毮毱毷毹毿氂氄氅氉氍氎氐氒氙氟氦氧氨氬氮氳氵氶氺氻氿汊汋汍汏汒汔汙汛汜汫汭汯汴汶汸汹汻沅沆沇沉沔沕沗沘沜沟沰沲沴泂泆泍泏泐泑泒泔泖"], +["8fc7a1","泚泜泠泧泩泫泬泮泲泴洄洇洊洎洏洑洓洚洦洧洨汧洮洯洱洹洼洿浗浞浟浡浥浧浯浰浼涂涇涑涒涔涖涗涘涪涬涴涷涹涽涿淄淈淊淎淏淖淛淝淟淠淢淥淩淯淰淴淶淼渀渄渞渢渧渲渶渹渻渼湄湅湈湉湋湏湑湒湓湔湗湜湝湞"], +["8fc8a1","湢湣湨湳湻湽溍溓溙溠溧溭溮溱溳溻溿滀滁滃滇滈滊滍滎滏滫滭滮滹滻滽漄漈漊漌漍漖漘漚漛漦漩漪漯漰漳漶漻漼漭潏潑潒潓潗潙潚潝潞潡潢潨潬潽潾澃澇澈澋澌澍澐澒澓澔澖澚澟澠澥澦澧澨澮澯澰澵澶澼濅濇濈濊"], +["8fc9a1","濚濞濨濩濰濵濹濼濽瀀瀅瀆瀇瀍瀗瀠瀣瀯瀴瀷瀹瀼灃灄灈灉灊灋灔灕灝灞灎灤灥灬灮灵灶灾炁炅炆炔",4,"炛炤炫炰炱炴炷烊烑烓烔烕烖烘烜烤烺焃",4,"焋焌焏焞焠焫焭焯焰焱焸煁煅煆煇煊煋煐煒煗煚煜煞煠"], +["8fcaa1","煨煹熀熅熇熌熒熚熛熠熢熯熰熲熳熺熿燀燁燄燋燌燓燖燙燚燜燸燾爀爇爈爉爓爗爚爝爟爤爫爯爴爸爹牁牂牃牅牎牏牐牓牕牖牚牜牞牠牣牨牫牮牯牱牷牸牻牼牿犄犉犍犎犓犛犨犭犮犱犴犾狁狇狉狌狕狖狘狟狥狳狴狺狻"], +["8fcba1","狾猂猄猅猇猋猍猒猓猘猙猞猢猤猧猨猬猱猲猵猺猻猽獃獍獐獒獖獘獝獞獟獠獦獧獩獫獬獮獯獱獷獹獼玀玁玃玅玆玎玐玓玕玗玘玜玞玟玠玢玥玦玪玫玭玵玷玹玼玽玿珅珆珉珋珌珏珒珓珖珙珝珡珣珦珧珩珴珵珷珹珺珻珽"], +["8fcca1","珿琀琁琄琇琊琑琚琛琤琦琨",9,"琹瑀瑃瑄瑆瑇瑋瑍瑑瑒瑗瑝瑢瑦瑧瑨瑫瑭瑮瑱瑲璀璁璅璆璇璉璏璐璑璒璘璙璚璜璟璠璡璣璦璨璩璪璫璮璯璱璲璵璹璻璿瓈瓉瓌瓐瓓瓘瓚瓛瓞瓟瓤瓨瓪瓫瓯瓴瓺瓻瓼瓿甆"], +["8fcda1","甒甖甗甠甡甤甧甩甪甯甶甹甽甾甿畀畃畇畈畎畐畒畗畞畟畡畯畱畹",5,"疁疅疐疒疓疕疙疜疢疤疴疺疿痀痁痄痆痌痎痏痗痜痟痠痡痤痧痬痮痯痱痹瘀瘂瘃瘄瘇瘈瘊瘌瘏瘒瘓瘕瘖瘙瘛瘜瘝瘞瘣瘥瘦瘩瘭瘲瘳瘵瘸瘹"], +["8fcea1","瘺瘼癊癀癁癃癄癅癉癋癕癙癟癤癥癭癮癯癱癴皁皅皌皍皕皛皜皝皟皠皢",6,"皪皭皽盁盅盉盋盌盎盔盙盠盦盨盬盰盱盶盹盼眀眆眊眎眒眔眕眗眙眚眜眢眨眭眮眯眴眵眶眹眽眾睂睅睆睊睍睎睏睒睖睗睜睞睟睠睢"], +["8fcfa1","睤睧睪睬睰睲睳睴睺睽瞀瞄瞌瞍瞔瞕瞖瞚瞟瞢瞧瞪瞮瞯瞱瞵瞾矃矉矑矒矕矙矞矟矠矤矦矪矬矰矱矴矸矻砅砆砉砍砎砑砝砡砢砣砭砮砰砵砷硃硄硇硈硌硎硒硜硞硠硡硣硤硨硪确硺硾碊碏碔碘碡碝碞碟碤碨碬碭碰碱碲碳"], +["8fd0a1","碻碽碿磇磈磉磌磎磒磓磕磖磤磛磟磠磡磦磪磲磳礀磶磷磺磻磿礆礌礐礚礜礞礟礠礥礧礩礭礱礴礵礻礽礿祄祅祆祊祋祏祑祔祘祛祜祧祩祫祲祹祻祼祾禋禌禑禓禔禕禖禘禛禜禡禨禩禫禯禱禴禸离秂秄秇秈秊秏秔秖秚秝秞"], +["8fd1a1","秠秢秥秪秫秭秱秸秼稂稃稇稉稊稌稑稕稛稞稡稧稫稭稯稰稴稵稸稹稺穄穅穇穈穌穕穖穙穜穝穟穠穥穧穪穭穵穸穾窀窂窅窆窊窋窐窑窔窞窠窣窬窳窵窹窻窼竆竉竌竎竑竛竨竩竫竬竱竴竻竽竾笇笔笟笣笧笩笪笫笭笮笯笰"], +["8fd2a1","笱笴笽笿筀筁筇筎筕筠筤筦筩筪筭筯筲筳筷箄箉箎箐箑箖箛箞箠箥箬箯箰箲箵箶箺箻箼箽篂篅篈篊篔篖篗篙篚篛篨篪篲篴篵篸篹篺篼篾簁簂簃簄簆簉簋簌簎簏簙簛簠簥簦簨簬簱簳簴簶簹簺籆籊籕籑籒籓籙",5], +["8fd3a1","籡籣籧籩籭籮籰籲籹籼籽粆粇粏粔粞粠粦粰粶粷粺粻粼粿糄糇糈糉糍糏糓糔糕糗糙糚糝糦糩糫糵紃紇紈紉紏紑紒紓紖紝紞紣紦紪紭紱紼紽紾絀絁絇絈絍絑絓絗絙絚絜絝絥絧絪絰絸絺絻絿綁綂綃綅綆綈綋綌綍綑綖綗綝"], +["8fd4a1","綞綦綧綪綳綶綷綹緂",4,"緌緍緎緗緙縀緢緥緦緪緫緭緱緵緶緹緺縈縐縑縕縗縜縝縠縧縨縬縭縯縳縶縿繄繅繇繎繐繒繘繟繡繢繥繫繮繯繳繸繾纁纆纇纊纍纑纕纘纚纝纞缼缻缽缾缿罃罄罇罏罒罓罛罜罝罡罣罤罥罦罭"], +["8fd5a1","罱罽罾罿羀羋羍羏羐羑羖羗羜羡羢羦羪羭羴羼羿翀翃翈翎翏翛翟翣翥翨翬翮翯翲翺翽翾翿耇耈耊耍耎耏耑耓耔耖耝耞耟耠耤耦耬耮耰耴耵耷耹耺耼耾聀聄聠聤聦聭聱聵肁肈肎肜肞肦肧肫肸肹胈胍胏胒胔胕胗胘胠胭胮"], +["8fd6a1","胰胲胳胶胹胺胾脃脋脖脗脘脜脞脠脤脧脬脰脵脺脼腅腇腊腌腒腗腠腡腧腨腩腭腯腷膁膐膄膅膆膋膎膖膘膛膞膢膮膲膴膻臋臃臅臊臎臏臕臗臛臝臞臡臤臫臬臰臱臲臵臶臸臹臽臿舀舃舏舓舔舙舚舝舡舢舨舲舴舺艃艄艅艆"], +["8fd7a1","艋艎艏艑艖艜艠艣艧艭艴艻艽艿芀芁芃芄芇芉芊芎芑芔芖芘芚芛芠芡芣芤芧芨芩芪芮芰芲芴芷芺芼芾芿苆苐苕苚苠苢苤苨苪苭苯苶苷苽苾茀茁茇茈茊茋荔茛茝茞茟茡茢茬茭茮茰茳茷茺茼茽荂荃荄荇荍荎荑荕荖荗荰荸"], +["8fd8a1","荽荿莀莂莄莆莍莒莔莕莘莙莛莜莝莦莧莩莬莾莿菀菇菉菏菐菑菔菝荓菨菪菶菸菹菼萁萆萊萏萑萕萙莭萯萹葅葇葈葊葍葏葑葒葖葘葙葚葜葠葤葥葧葪葰葳葴葶葸葼葽蒁蒅蒒蒓蒕蒞蒦蒨蒩蒪蒯蒱蒴蒺蒽蒾蓀蓂蓇蓈蓌蓏蓓"], +["8fd9a1","蓜蓧蓪蓯蓰蓱蓲蓷蔲蓺蓻蓽蔂蔃蔇蔌蔎蔐蔜蔞蔢蔣蔤蔥蔧蔪蔫蔯蔳蔴蔶蔿蕆蕏",4,"蕖蕙蕜",6,"蕤蕫蕯蕹蕺蕻蕽蕿薁薅薆薉薋薌薏薓薘薝薟薠薢薥薧薴薶薷薸薼薽薾薿藂藇藊藋藎薭藘藚藟藠藦藨藭藳藶藼"], +["8fdaa1","藿蘀蘄蘅蘍蘎蘐蘑蘒蘘蘙蘛蘞蘡蘧蘩蘶蘸蘺蘼蘽虀虂虆虒虓虖虗虘虙虝虠",4,"虩虬虯虵虶虷虺蚍蚑蚖蚘蚚蚜蚡蚦蚧蚨蚭蚱蚳蚴蚵蚷蚸蚹蚿蛀蛁蛃蛅蛑蛒蛕蛗蛚蛜蛠蛣蛥蛧蚈蛺蛼蛽蜄蜅蜇蜋蜎蜏蜐蜓蜔蜙蜞蜟蜡蜣"], +["8fdba1","蜨蜮蜯蜱蜲蜹蜺蜼蜽蜾蝀蝃蝅蝍蝘蝝蝡蝤蝥蝯蝱蝲蝻螃",6,"螋螌螐螓螕螗螘螙螞螠螣螧螬螭螮螱螵螾螿蟁蟈蟉蟊蟎蟕蟖蟙蟚蟜蟟蟢蟣蟤蟪蟫蟭蟱蟳蟸蟺蟿蠁蠃蠆蠉蠊蠋蠐蠙蠒蠓蠔蠘蠚蠛蠜蠞蠟蠨蠭蠮蠰蠲蠵"], +["8fdca1","蠺蠼衁衃衅衈衉衊衋衎衑衕衖衘衚衜衟衠衤衩衱衹衻袀袘袚袛袜袟袠袨袪袺袽袾裀裊",4,"裑裒裓裛裞裧裯裰裱裵裷褁褆褍褎褏褕褖褘褙褚褜褠褦褧褨褰褱褲褵褹褺褾襀襂襅襆襉襏襒襗襚襛襜襡襢襣襫襮襰襳襵襺"], +["8fdda1","襻襼襽覉覍覐覔覕覛覜覟覠覥覰覴覵覶覷覼觔",4,"觥觩觫觭觱觳觶觹觽觿訄訅訇訏訑訒訔訕訞訠訢訤訦訫訬訯訵訷訽訾詀詃詅詇詉詍詎詓詖詗詘詜詝詡詥詧詵詶詷詹詺詻詾詿誀誃誆誋誏誐誒誖誗誙誟誧誩誮誯誳"], +["8fdea1","誶誷誻誾諃諆諈諉諊諑諓諔諕諗諝諟諬諰諴諵諶諼諿謅謆謋謑謜謞謟謊謭謰謷謼譂",4,"譈譒譓譔譙譍譞譣譭譶譸譹譼譾讁讄讅讋讍讏讔讕讜讞讟谸谹谽谾豅豇豉豋豏豑豓豔豗豘豛豝豙豣豤豦豨豩豭豳豵豶豻豾貆"], +["8fdfa1","貇貋貐貒貓貙貛貜貤貹貺賅賆賉賋賏賖賕賙賝賡賨賬賯賰賲賵賷賸賾賿贁贃贉贒贗贛赥赩赬赮赿趂趄趈趍趐趑趕趞趟趠趦趫趬趯趲趵趷趹趻跀跅跆跇跈跊跎跑跔跕跗跙跤跥跧跬跰趼跱跲跴跽踁踄踅踆踋踑踔踖踠踡踢"], +["8fe0a1","踣踦踧踱踳踶踷踸踹踽蹀蹁蹋蹍蹎蹏蹔蹛蹜蹝蹞蹡蹢蹩蹬蹭蹯蹰蹱蹹蹺蹻躂躃躉躐躒躕躚躛躝躞躢躧躩躭躮躳躵躺躻軀軁軃軄軇軏軑軔軜軨軮軰軱軷軹軺軭輀輂輇輈輏輐輖輗輘輞輠輡輣輥輧輨輬輭輮輴輵輶輷輺轀轁"], +["8fe1a1","轃轇轏轑",4,"轘轝轞轥辝辠辡辤辥辦辵辶辸达迀迁迆迊迋迍运迒迓迕迠迣迤迨迮迱迵迶迻迾适逄逈逌逘逛逨逩逯逪逬逭逳逴逷逿遃遄遌遛遝遢遦遧遬遰遴遹邅邈邋邌邎邐邕邗邘邙邛邠邡邢邥邰邲邳邴邶邽郌邾郃"], +["8fe2a1","郄郅郇郈郕郗郘郙郜郝郟郥郒郶郫郯郰郴郾郿鄀鄄鄅鄆鄈鄍鄐鄔鄖鄗鄘鄚鄜鄞鄠鄥鄢鄣鄧鄩鄮鄯鄱鄴鄶鄷鄹鄺鄼鄽酃酇酈酏酓酗酙酚酛酡酤酧酭酴酹酺酻醁醃醅醆醊醎醑醓醔醕醘醞醡醦醨醬醭醮醰醱醲醳醶醻醼醽醿"], +["8fe3a1","釂釃釅釓釔釗釙釚釞釤釥釩釪釬",5,"釷釹釻釽鈀鈁鈄鈅鈆鈇鈉鈊鈌鈐鈒鈓鈖鈘鈜鈝鈣鈤鈥鈦鈨鈮鈯鈰鈳鈵鈶鈸鈹鈺鈼鈾鉀鉂鉃鉆鉇鉊鉍鉎鉏鉑鉘鉙鉜鉝鉠鉡鉥鉧鉨鉩鉮鉯鉰鉵",4,"鉻鉼鉽鉿銈銉銊銍銎銒銗"], +["8fe4a1","銙銟銠銤銥銧銨銫銯銲銶銸銺銻銼銽銿",4,"鋅鋆鋇鋈鋋鋌鋍鋎鋐鋓鋕鋗鋘鋙鋜鋝鋟鋠鋡鋣鋥鋧鋨鋬鋮鋰鋹鋻鋿錀錂錈錍錑錔錕錜錝錞錟錡錤錥錧錩錪錳錴錶錷鍇鍈鍉鍐鍑鍒鍕鍗鍘鍚鍞鍤鍥鍧鍩鍪鍭鍯鍰鍱鍳鍴鍶"], +["8fe5a1","鍺鍽鍿鎀鎁鎂鎈鎊鎋鎍鎏鎒鎕鎘鎛鎞鎡鎣鎤鎦鎨鎫鎴鎵鎶鎺鎩鏁鏄鏅鏆鏇鏉",4,"鏓鏙鏜鏞鏟鏢鏦鏧鏹鏷鏸鏺鏻鏽鐁鐂鐄鐈鐉鐍鐎鐏鐕鐖鐗鐟鐮鐯鐱鐲鐳鐴鐻鐿鐽鑃鑅鑈鑊鑌鑕鑙鑜鑟鑡鑣鑨鑫鑭鑮鑯鑱鑲钄钃镸镹"], +["8fe6a1","镾閄閈閌閍閎閝閞閟閡閦閩閫閬閴閶閺閽閿闆闈闉闋闐闑闒闓闙闚闝闞闟闠闤闦阝阞阢阤阥阦阬阱阳阷阸阹阺阼阽陁陒陔陖陗陘陡陮陴陻陼陾陿隁隂隃隄隉隑隖隚隝隟隤隥隦隩隮隯隳隺雊雒嶲雘雚雝雞雟雩雯雱雺霂"], +["8fe7a1","霃霅霉霚霛霝霡霢霣霨霱霳靁靃靊靎靏靕靗靘靚靛靣靧靪靮靳靶靷靸靻靽靿鞀鞉鞕鞖鞗鞙鞚鞞鞟鞢鞬鞮鞱鞲鞵鞶鞸鞹鞺鞼鞾鞿韁韄韅韇韉韊韌韍韎韐韑韔韗韘韙韝韞韠韛韡韤韯韱韴韷韸韺頇頊頙頍頎頔頖頜頞頠頣頦"], +["8fe8a1","頫頮頯頰頲頳頵頥頾顄顇顊顑顒顓顖顗顙顚顢顣顥顦顪顬颫颭颮颰颴颷颸颺颻颿飂飅飈飌飡飣飥飦飧飪飳飶餂餇餈餑餕餖餗餚餛餜餟餢餦餧餫餱",4,"餹餺餻餼饀饁饆饇饈饍饎饔饘饙饛饜饞饟饠馛馝馟馦馰馱馲馵"], +["8fe9a1","馹馺馽馿駃駉駓駔駙駚駜駞駧駪駫駬駰駴駵駹駽駾騂騃騄騋騌騐騑騖騞騠騢騣騤騧騭騮騳騵騶騸驇驁驄驊驋驌驎驑驔驖驝骪骬骮骯骲骴骵骶骹骻骾骿髁髃髆髈髎髐髒髕髖髗髛髜髠髤髥髧髩髬髲髳髵髹髺髽髿",4], +["8feaa1","鬄鬅鬈鬉鬋鬌鬍鬎鬐鬒鬖鬙鬛鬜鬠鬦鬫鬭鬳鬴鬵鬷鬹鬺鬽魈魋魌魕魖魗魛魞魡魣魥魦魨魪",4,"魳魵魷魸魹魿鮀鮄鮅鮆鮇鮉鮊鮋鮍鮏鮐鮔鮚鮝鮞鮦鮧鮩鮬鮰鮱鮲鮷鮸鮻鮼鮾鮿鯁鯇鯈鯎鯐鯗鯘鯝鯟鯥鯧鯪鯫鯯鯳鯷鯸"], +["8feba1","鯹鯺鯽鯿鰀鰂鰋鰏鰑鰖鰘鰙鰚鰜鰞鰢鰣鰦",4,"鰱鰵鰶鰷鰽鱁鱃鱄鱅鱉鱊鱎鱏鱐鱓鱔鱖鱘鱛鱝鱞鱟鱣鱩鱪鱜鱫鱨鱮鱰鱲鱵鱷鱻鳦鳲鳷鳹鴋鴂鴑鴗鴘鴜鴝鴞鴯鴰鴲鴳鴴鴺鴼鵅鴽鵂鵃鵇鵊鵓鵔鵟鵣鵢鵥鵩鵪鵫鵰鵶鵷鵻"], +["8feca1","鵼鵾鶃鶄鶆鶊鶍鶎鶒鶓鶕鶖鶗鶘鶡鶪鶬鶮鶱鶵鶹鶼鶿鷃鷇鷉鷊鷔鷕鷖鷗鷚鷞鷟鷠鷥鷧鷩鷫鷮鷰鷳鷴鷾鸊鸂鸇鸎鸐鸑鸒鸕鸖鸙鸜鸝鹺鹻鹼麀麂麃麄麅麇麎麏麖麘麛麞麤麨麬麮麯麰麳麴麵黆黈黋黕黟黤黧黬黭黮黰黱黲黵"], +["8feda1","黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃",4,"齓齕齖齗齘齚齝齞齨齩齭",4,"齳齵齺齽龏龐龑龒龔龖龗龞龡龢龣龥"] +] diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json new file mode 100644 index 0000000..85c6934 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json @@ -0,0 +1 @@ +{"uChars":[128,165,169,178,184,216,226,235,238,244,248,251,253,258,276,284,300,325,329,334,364,463,465,467,469,471,473,475,477,506,594,610,712,716,730,930,938,962,970,1026,1104,1106,8209,8215,8218,8222,8231,8241,8244,8246,8252,8365,8452,8454,8458,8471,8482,8556,8570,8596,8602,8713,8720,8722,8726,8731,8737,8740,8742,8748,8751,8760,8766,8777,8781,8787,8802,8808,8816,8854,8858,8870,8896,8979,9322,9372,9548,9588,9616,9622,9634,9652,9662,9672,9676,9680,9702,9735,9738,9793,9795,11906,11909,11913,11917,11928,11944,11947,11951,11956,11960,11964,11979,12284,12292,12312,12319,12330,12351,12436,12447,12535,12543,12586,12842,12850,12964,13200,13215,13218,13253,13263,13267,13270,13384,13428,13727,13839,13851,14617,14703,14801,14816,14964,15183,15471,15585,16471,16736,17208,17325,17330,17374,17623,17997,18018,18212,18218,18301,18318,18760,18811,18814,18820,18823,18844,18848,18872,19576,19620,19738,19887,40870,59244,59336,59367,59413,59417,59423,59431,59437,59443,59452,59460,59478,59493,63789,63866,63894,63976,63986,64016,64018,64021,64025,64034,64037,64042,65074,65093,65107,65112,65127,65132,65375,65510,65536],"gbChars":[0,36,38,45,50,81,89,95,96,100,103,104,105,109,126,133,148,172,175,179,208,306,307,308,309,310,311,312,313,341,428,443,544,545,558,741,742,749,750,805,819,820,7922,7924,7925,7927,7934,7943,7944,7945,7950,8062,8148,8149,8152,8164,8174,8236,8240,8262,8264,8374,8380,8381,8384,8388,8390,8392,8393,8394,8396,8401,8406,8416,8419,8424,8437,8439,8445,8482,8485,8496,8521,8603,8936,8946,9046,9050,9063,9066,9076,9092,9100,9108,9111,9113,9131,9162,9164,9218,9219,11329,11331,11334,11336,11346,11361,11363,11366,11370,11372,11375,11389,11682,11686,11687,11692,11694,11714,11716,11723,11725,11730,11736,11982,11989,12102,12336,12348,12350,12384,12393,12395,12397,12510,12553,12851,12962,12973,13738,13823,13919,13933,14080,14298,14585,14698,15583,15847,16318,16434,16438,16481,16729,17102,17122,17315,17320,17402,17418,17859,17909,17911,17915,17916,17936,17939,17961,18664,18703,18814,18962,19043,33469,33470,33471,33484,33485,33490,33497,33501,33505,33513,33520,33536,33550,37845,37921,37948,38029,38038,38064,38065,38066,38069,38075,38076,38078,39108,39109,39113,39114,39115,39116,39265,39394,189000]} \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gbk-added.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gbk-added.json new file mode 100644 index 0000000..8abfa9f --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/gbk-added.json @@ -0,0 +1,55 @@ +[ +["a140","",62], +["a180","",32], +["a240","",62], +["a280","",32], +["a2ab","",5], +["a2e3","€"], +["a2ef",""], +["a2fd",""], +["a340","",62], +["a380","",31," "], +["a440","",62], +["a480","",32], +["a4f4","",10], +["a540","",62], +["a580","",32], +["a5f7","",7], +["a640","",62], +["a680","",32], +["a6b9","",7], +["a6d9","",6], +["a6ec",""], +["a6f3",""], +["a6f6","",8], +["a740","",62], +["a780","",32], +["a7c2","",14], +["a7f2","",12], +["a896","",10], +["a8bc",""], +["a8bf","ǹ"], +["a8c1",""], +["a8ea","",20], +["a958",""], +["a95b",""], +["a95d",""], +["a989","〾⿰",11], +["a997","",12], +["a9f0","",14], +["aaa1","",93], +["aba1","",93], +["aca1","",93], +["ada1","",93], +["aea1","",93], +["afa1","",93], +["d7fa","",4], +["f8a1","",93], +["f9a1","",93], +["faa1","",93], +["fba1","",93], +["fca1","",93], +["fda1","",93], +["fe50","⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌"], +["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",6,"䶮",93] +] diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/shiftjis.json b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/shiftjis.json new file mode 100644 index 0000000..5a3a43c --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/tables/shiftjis.json @@ -0,0 +1,125 @@ +[ +["0","\u0000",128], +["a1","。",62], +["8140"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×"], +["8180","÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓"], +["81b8","∈∋⊆⊇⊂⊃∪∩"], +["81c8","∧∨¬⇒⇔∀∃"], +["81da","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], +["81f0","ʼn♯♭♪†‡¶"], +["81fc","◯"], +["824f","0",9], +["8260","A",25], +["8281","a",25], +["829f","ぁ",82], +["8340","ァ",62], +["8380","ム",22], +["839f","Α",16,"Σ",6], +["83bf","α",16,"σ",6], +["8440","А",5,"ЁЖ",25], +["8470","а",5,"ёж",7], +["8480","о",17], +["849f","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], +["8740","①",19,"Ⅰ",9], +["875f","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], +["877e","㍻"], +["8780","〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], +["889f","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], +["8940","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円"], +["8980","園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], +["8a40","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫"], +["8a80","橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], +["8b40","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救"], +["8b80","朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], +["8c40","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨"], +["8c80","劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], +["8d40","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降"], +["8d80","項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], +["8e40","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止"], +["8e80","死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], +["8f40","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳"], +["8f80","準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], +["9040","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨"], +["9080","逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], +["9140","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻"], +["9180","操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], +["9240","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄"], +["9280","逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], +["9340","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬"], +["9380","凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], +["9440","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅"], +["9480","楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], +["9540","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷"], +["9580","斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], +["9640","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆"], +["9680","摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], +["9740","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲"], +["9780","沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], +["9840","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], +["989f","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], +["9940","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭"], +["9980","凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], +["9a40","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸"], +["9a80","噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], +["9b40","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀"], +["9b80","它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], +["9c40","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠"], +["9c80","怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], +["9d40","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫"], +["9d80","捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], +["9e40","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎"], +["9e80","梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], +["9f40","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯"], +["9f80","麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], +["e040","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝"], +["e080","烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], +["e140","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿"], +["e180","痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], +["e240","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰"], +["e280","窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], +["e340","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷"], +["e380","縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], +["e440","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤"], +["e480","艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], +["e540","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬"], +["e580","蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], +["e640","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧"], +["e680","諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], +["e740","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜"], +["e780","轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], +["e840","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙"], +["e880","閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], +["e940","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃"], +["e980","騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], +["ea40","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯"], +["ea80","黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙"], +["ed40","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏"], +["ed80","塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], +["ee40","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙"], +["ee80","蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], +["eeef","ⅰ",9,"¬¦'""], +["f040","",62], +["f080","",124], +["f140","",62], +["f180","",124], +["f240","",62], +["f280","",124], +["f340","",62], +["f380","",124], +["f440","",62], +["f480","",124], +["f540","",62], +["f580","",124], +["f640","",62], +["f680","",124], +["f740","",62], +["f780","",124], +["f840","",62], +["f880","",124], +["f940",""], +["fa40","ⅰ",9,"Ⅰ",9,"¬¦'"㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊"], +["fa80","兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯"], +["fb40","涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神"], +["fb80","祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙"], +["fc40","髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"] +] diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/utf16.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/utf16.js new file mode 100644 index 0000000..54765ae --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/utf16.js @@ -0,0 +1,177 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js + +// == UTF16-BE codec. ========================================================== + +exports.utf16be = Utf16BECodec; +function Utf16BECodec() { +} + +Utf16BECodec.prototype.encoder = Utf16BEEncoder; +Utf16BECodec.prototype.decoder = Utf16BEDecoder; +Utf16BECodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf16BEEncoder() { +} + +Utf16BEEncoder.prototype.write = function(str) { + var buf = Buffer.from(str, 'ucs2'); + for (var i = 0; i < buf.length; i += 2) { + var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; + } + return buf; +} + +Utf16BEEncoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf16BEDecoder() { + this.overflowByte = -1; +} + +Utf16BEDecoder.prototype.write = function(buf) { + if (buf.length == 0) + return ''; + + var buf2 = Buffer.alloc(buf.length + 1), + i = 0, j = 0; + + if (this.overflowByte !== -1) { + buf2[0] = buf[0]; + buf2[1] = this.overflowByte; + i = 1; j = 2; + } + + for (; i < buf.length-1; i += 2, j+= 2) { + buf2[j] = buf[i+1]; + buf2[j+1] = buf[i]; + } + + this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1; + + return buf2.slice(0, j).toString('ucs2'); +} + +Utf16BEDecoder.prototype.end = function() { +} + + +// == UTF-16 codec ============================================================= +// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic. +// Defaults to UTF-16LE, as it's prevalent and default in Node. +// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le +// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'}); + +// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false). + +exports.utf16 = Utf16Codec; +function Utf16Codec(codecOptions, iconv) { + this.iconv = iconv; +} + +Utf16Codec.prototype.encoder = Utf16Encoder; +Utf16Codec.prototype.decoder = Utf16Decoder; + + +// -- Encoding (pass-through) + +function Utf16Encoder(options, codec) { + options = options || {}; + if (options.addBOM === undefined) + options.addBOM = true; + this.encoder = codec.iconv.getEncoder('utf-16le', options); +} + +Utf16Encoder.prototype.write = function(str) { + return this.encoder.write(str); +} + +Utf16Encoder.prototype.end = function() { + return this.encoder.end(); +} + + +// -- Decoding + +function Utf16Decoder(options, codec) { + this.decoder = null; + this.initialBytes = []; + this.initialBytesLen = 0; + + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf16Decoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBytes.push(buf); + this.initialBytesLen += buf.length; + + if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + this.initialBytes.length = this.initialBytesLen = 0; + } + + return this.decoder.write(buf); +} + +Utf16Decoder.prototype.end = function() { + if (!this.decoder) { + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var res = this.decoder.write(buf), + trail = this.decoder.end(); + + return trail ? (res + trail) : res; + } + return this.decoder.end(); +} + +function detectEncoding(buf, defaultEncoding) { + var enc = defaultEncoding || 'utf-16le'; + + if (buf.length >= 2) { + // Check BOM. + if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM + enc = 'utf-16be'; + else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM + enc = 'utf-16le'; + else { + // No BOM found. Try to deduce encoding from initial content. + // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. + // So, we count ASCII as if it was LE or BE, and decide from that. + var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions + _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even. + + for (var i = 0; i < _len; i += 2) { + if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++; + if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++; + } + + if (asciiCharsBE > asciiCharsLE) + enc = 'utf-16be'; + else if (asciiCharsBE < asciiCharsLE) + enc = 'utf-16le'; + } + } + + return enc; +} + + diff --git a/graphql-subscription-express/node_modules/iconv-lite/encodings/utf7.js b/graphql-subscription-express/node_modules/iconv-lite/encodings/utf7.js new file mode 100644 index 0000000..b7631c2 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/encodings/utf7.js @@ -0,0 +1,290 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 +// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 + +exports.utf7 = Utf7Codec; +exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7 +function Utf7Codec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7Codec.prototype.encoder = Utf7Encoder; +Utf7Codec.prototype.decoder = Utf7Decoder; +Utf7Codec.prototype.bomAware = true; + + +// -- Encoding + +var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; + +function Utf7Encoder(options, codec) { + this.iconv = codec.iconv; +} + +Utf7Encoder.prototype.write = function(str) { + // Naive implementation. + // Non-direct chars are encoded as "+-"; single "+" char is encoded as "+-". + return Buffer.from(str.replace(nonDirectChars, function(chunk) { + return "+" + (chunk === '+' ? '' : + this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) + + "-"; + }.bind(this))); +} + +Utf7Encoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf7Decoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64Regex = /[A-Za-z0-9\/+]/; +var base64Chars = []; +for (var i = 0; i < 256; i++) + base64Chars[i] = base64Regex.test(String.fromCharCode(i)); + +var plusChar = '+'.charCodeAt(0), + minusChar = '-'.charCodeAt(0), + andChar = '&'.charCodeAt(0); + +Utf7Decoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '+' + if (buf[i] == plusChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64Chars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" + res += "+"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString(); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus is absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString(); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7Decoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + +// UTF-7-IMAP codec. +// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3) +// Differences: +// * Base64 part is started by "&" instead of "+" +// * Direct characters are 0x20-0x7E, except "&" (0x26) +// * In Base64, "," is used instead of "/" +// * Base64 must not be used to represent direct characters. +// * No implicit shift back from Base64 (should always end with '-') +// * String must end in non-shifted position. +// * "-&" while in base64 is not allowed. + + +exports.utf7imap = Utf7IMAPCodec; +function Utf7IMAPCodec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; +Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; +Utf7IMAPCodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf7IMAPEncoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = Buffer.alloc(6); + this.base64AccumIdx = 0; +} + +Utf7IMAPEncoder.prototype.write = function(str) { + var inBase64 = this.inBase64, + base64Accum = this.base64Accum, + base64AccumIdx = this.base64AccumIdx, + buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; + + for (var i = 0; i < str.length; i++) { + var uChar = str.charCodeAt(i); + if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'. + if (inBase64) { + if (base64AccumIdx > 0) { + bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + inBase64 = false; + } + + if (!inBase64) { + buf[bufIdx++] = uChar; // Write direct character + + if (uChar === andChar) // Ampersand -> '&-' + buf[bufIdx++] = minusChar; + } + + } else { // Non-direct character + if (!inBase64) { + buf[bufIdx++] = andChar; // Write '&', then go to base64 mode. + inBase64 = true; + } + if (inBase64) { + base64Accum[base64AccumIdx++] = uChar >> 8; + base64Accum[base64AccumIdx++] = uChar & 0xFF; + + if (base64AccumIdx == base64Accum.length) { + bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx); + base64AccumIdx = 0; + } + } + } + } + + this.inBase64 = inBase64; + this.base64AccumIdx = base64AccumIdx; + + return buf.slice(0, bufIdx); +} + +Utf7IMAPEncoder.prototype.end = function() { + var buf = Buffer.alloc(10), bufIdx = 0; + if (this.inBase64) { + if (this.base64AccumIdx > 0) { + bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + this.base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + this.inBase64 = false; + } + + return buf.slice(0, bufIdx); +} + + +// -- Decoding + +function Utf7IMAPDecoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64IMAPChars = base64Chars.slice(); +base64IMAPChars[','.charCodeAt(0)] = true; + +Utf7IMAPDecoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end). + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '&' + if (buf[i] == andChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64IMAPChars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" + res += "&"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/'); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus may be absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/'); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7IMAPDecoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + diff --git a/graphql-subscription-express/node_modules/iconv-lite/lib/bom-handling.js b/graphql-subscription-express/node_modules/iconv-lite/lib/bom-handling.js new file mode 100644 index 0000000..1050872 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/lib/bom-handling.js @@ -0,0 +1,52 @@ +"use strict"; + +var BOMChar = '\uFEFF'; + +exports.PrependBOM = PrependBOMWrapper +function PrependBOMWrapper(encoder, options) { + this.encoder = encoder; + this.addBOM = true; +} + +PrependBOMWrapper.prototype.write = function(str) { + if (this.addBOM) { + str = BOMChar + str; + this.addBOM = false; + } + + return this.encoder.write(str); +} + +PrependBOMWrapper.prototype.end = function() { + return this.encoder.end(); +} + + +//------------------------------------------------------------------------------ + +exports.StripBOM = StripBOMWrapper; +function StripBOMWrapper(decoder, options) { + this.decoder = decoder; + this.pass = false; + this.options = options || {}; +} + +StripBOMWrapper.prototype.write = function(buf) { + var res = this.decoder.write(buf); + if (this.pass || !res) + return res; + + if (res[0] === BOMChar) { + res = res.slice(1); + if (typeof this.options.stripBOM === 'function') + this.options.stripBOM(); + } + + this.pass = true; + return res; +} + +StripBOMWrapper.prototype.end = function() { + return this.decoder.end(); +} + diff --git a/graphql-subscription-express/node_modules/iconv-lite/lib/extend-node.js b/graphql-subscription-express/node_modules/iconv-lite/lib/extend-node.js new file mode 100644 index 0000000..87f5394 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/lib/extend-node.js @@ -0,0 +1,217 @@ +"use strict"; +var Buffer = require("buffer").Buffer; +// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer + +// == Extend Node primitives to use iconv-lite ================================= + +module.exports = function (iconv) { + var original = undefined; // Place to keep original methods. + + // Node authors rewrote Buffer internals to make it compatible with + // Uint8Array and we cannot patch key functions since then. + // Note: this does use older Buffer API on a purpose + iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array); + + iconv.extendNodeEncodings = function extendNodeEncodings() { + if (original) return; + original = {}; + + if (!iconv.supportsNodeEncodingsExtension) { + console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node"); + console.error("See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility"); + return; + } + + var nodeNativeEncodings = { + 'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, + 'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true, + }; + + Buffer.isNativeEncoding = function(enc) { + return enc && nodeNativeEncodings[enc.toLowerCase()]; + } + + // -- SlowBuffer ----------------------------------------------------------- + var SlowBuffer = require('buffer').SlowBuffer; + + original.SlowBufferToString = SlowBuffer.prototype.toString; + SlowBuffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.SlowBufferWrite = SlowBuffer.prototype.write; + SlowBuffer.prototype.write = function(string, offset, length, encoding) { + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferWrite.call(this, string, offset, length, encoding); + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + } + + // -- Buffer --------------------------------------------------------------- + + original.BufferIsEncoding = Buffer.isEncoding; + Buffer.isEncoding = function(encoding) { + return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding); + } + + original.BufferByteLength = Buffer.byteLength; + Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferByteLength.call(this, str, encoding); + + // Slow, I know, but we don't have a better way yet. + return iconv.encode(str, encoding).length; + } + + original.BufferToString = Buffer.prototype.toString; + Buffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.BufferWrite = Buffer.prototype.write; + Buffer.prototype.write = function(string, offset, length, encoding) { + var _offset = offset, _length = length, _encoding = encoding; + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferWrite.call(this, string, _offset, _length, _encoding); + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + + // TODO: Set _charsWritten. + } + + + // -- Readable ------------------------------------------------------------- + if (iconv.supportsStreams) { + var Readable = require('stream').Readable; + + original.ReadableSetEncoding = Readable.prototype.setEncoding; + Readable.prototype.setEncoding = function setEncoding(enc, options) { + // Use our own decoder, it has the same interface. + // We cannot use original function as it doesn't handle BOM-s. + this._readableState.decoder = iconv.getDecoder(enc, options); + this._readableState.encoding = enc; + } + + Readable.prototype.collect = iconv._collect; + } + } + + // Remove iconv-lite Node primitive extensions. + iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() { + if (!iconv.supportsNodeEncodingsExtension) + return; + if (!original) + throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.") + + delete Buffer.isNativeEncoding; + + var SlowBuffer = require('buffer').SlowBuffer; + + SlowBuffer.prototype.toString = original.SlowBufferToString; + SlowBuffer.prototype.write = original.SlowBufferWrite; + + Buffer.isEncoding = original.BufferIsEncoding; + Buffer.byteLength = original.BufferByteLength; + Buffer.prototype.toString = original.BufferToString; + Buffer.prototype.write = original.BufferWrite; + + if (iconv.supportsStreams) { + var Readable = require('stream').Readable; + + Readable.prototype.setEncoding = original.ReadableSetEncoding; + delete Readable.prototype.collect; + } + + original = undefined; + } +} diff --git a/graphql-subscription-express/node_modules/iconv-lite/lib/index.d.ts b/graphql-subscription-express/node_modules/iconv-lite/lib/index.d.ts new file mode 100644 index 0000000..0547eb3 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/lib/index.d.ts @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + * REQUIREMENT: This definition is dependent on the @types/node definition. + * Install with `npm install @types/node --save-dev` + *--------------------------------------------------------------------------------------------*/ + +declare module 'iconv-lite' { + export function decode(buffer: Buffer, encoding: string, options?: Options): string; + + export function encode(content: string, encoding: string, options?: Options): Buffer; + + export function encodingExists(encoding: string): boolean; + + export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; + + export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; +} + +export interface Options { + stripBOM?: boolean; + addBOM?: boolean; + defaultEncoding?: string; +} diff --git a/graphql-subscription-express/node_modules/iconv-lite/lib/index.js b/graphql-subscription-express/node_modules/iconv-lite/lib/index.js new file mode 100644 index 0000000..5391919 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/lib/index.js @@ -0,0 +1,153 @@ +"use strict"; + +// Some environments don't have global Buffer (e.g. React Native). +// Solution would be installing npm modules "buffer" and "stream" explicitly. +var Buffer = require("safer-buffer").Buffer; + +var bomHandling = require("./bom-handling"), + iconv = module.exports; + +// All codecs and aliases are kept here, keyed by encoding name/alias. +// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`. +iconv.encodings = null; + +// Characters emitted in case of error. +iconv.defaultCharUnicode = '�'; +iconv.defaultCharSingleByte = '?'; + +// Public API. +iconv.encode = function encode(str, encoding, options) { + str = "" + (str || ""); // Ensure string. + + var encoder = iconv.getEncoder(encoding, options); + + var res = encoder.write(str); + var trail = encoder.end(); + + return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res; +} + +iconv.decode = function decode(buf, encoding, options) { + if (typeof buf === 'string') { + if (!iconv.skipDecodeWarning) { + console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding'); + iconv.skipDecodeWarning = true; + } + + buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. + } + + var decoder = iconv.getDecoder(encoding, options); + + var res = decoder.write(buf); + var trail = decoder.end(); + + return trail ? (res + trail) : res; +} + +iconv.encodingExists = function encodingExists(enc) { + try { + iconv.getCodec(enc); + return true; + } catch (e) { + return false; + } +} + +// Legacy aliases to convert functions +iconv.toEncoding = iconv.encode; +iconv.fromEncoding = iconv.decode; + +// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache. +iconv._codecDataCache = {}; +iconv.getCodec = function getCodec(encoding) { + if (!iconv.encodings) + iconv.encodings = require("../encodings"); // Lazy load all encoding definitions. + + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + var enc = iconv._canonicalizeEncoding(encoding); + + // Traverse iconv.encodings to find actual codec. + var codecOptions = {}; + while (true) { + var codec = iconv._codecDataCache[enc]; + if (codec) + return codec; + + var codecDef = iconv.encodings[enc]; + + switch (typeof codecDef) { + case "string": // Direct alias to other encoding. + enc = codecDef; + break; + + case "object": // Alias with options. Can be layered. + for (var key in codecDef) + codecOptions[key] = codecDef[key]; + + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + enc = codecDef.type; + break; + + case "function": // Codec itself. + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + // The codec function must load all tables and return object with .encoder and .decoder methods. + // It'll be called only once (for each different options object). + codec = new codecDef(codecOptions, iconv); + + iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later. + return codec; + + default: + throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')"); + } + } +} + +iconv._canonicalizeEncoding = function(encoding) { + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); +} + +iconv.getEncoder = function getEncoder(encoding, options) { + var codec = iconv.getCodec(encoding), + encoder = new codec.encoder(options, codec); + + if (codec.bomAware && options && options.addBOM) + encoder = new bomHandling.PrependBOM(encoder, options); + + return encoder; +} + +iconv.getDecoder = function getDecoder(encoding, options) { + var codec = iconv.getCodec(encoding), + decoder = new codec.decoder(options, codec); + + if (codec.bomAware && !(options && options.stripBOM === false)) + decoder = new bomHandling.StripBOM(decoder, options); + + return decoder; +} + + +// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json. +var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node; +if (nodeVer) { + + // Load streaming support in Node v0.10+ + var nodeVerArr = nodeVer.split(".").map(Number); + if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) { + require("./streams")(iconv); + } + + // Load Node primitive extensions. + require("./extend-node")(iconv); +} + +if ("Ā" != "\u0100") { + console.error("iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); +} diff --git a/graphql-subscription-express/node_modules/iconv-lite/lib/streams.js b/graphql-subscription-express/node_modules/iconv-lite/lib/streams.js new file mode 100644 index 0000000..4409552 --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/lib/streams.js @@ -0,0 +1,121 @@ +"use strict"; + +var Buffer = require("buffer").Buffer, + Transform = require("stream").Transform; + + +// == Exports ================================================================== +module.exports = function(iconv) { + + // Additional Public API. + iconv.encodeStream = function encodeStream(encoding, options) { + return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); + } + + iconv.decodeStream = function decodeStream(encoding, options) { + return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); + } + + iconv.supportsStreams = true; + + + // Not published yet. + iconv.IconvLiteEncoderStream = IconvLiteEncoderStream; + iconv.IconvLiteDecoderStream = IconvLiteDecoderStream; + iconv._collect = IconvLiteDecoderStream.prototype.collect; +}; + + +// == Encoder stream ======================================================= +function IconvLiteEncoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.decodeStrings = false; // We accept only strings, so we don't need to decode them. + Transform.call(this, options); +} + +IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteEncoderStream } +}); + +IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { + if (typeof chunk != 'string') + return done(new Error("Iconv encoding stream needs strings as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype.collect = function(cb) { + var chunks = []; + this.on('error', cb); + this.on('data', function(chunk) { chunks.push(chunk); }); + this.on('end', function() { + cb(null, Buffer.concat(chunks)); + }); + return this; +} + + +// == Decoder stream ======================================================= +function IconvLiteDecoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.encoding = this.encoding = 'utf8'; // We output strings. + Transform.call(this, options); +} + +IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteDecoderStream } +}); + +IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { + if (!Buffer.isBuffer(chunk)) + return done(new Error("Iconv decoding stream needs buffers as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype.collect = function(cb) { + var res = ''; + this.on('error', cb); + this.on('data', function(chunk) { res += chunk; }); + this.on('end', function() { + cb(null, res); + }); + return this; +} + diff --git a/graphql-subscription-express/node_modules/iconv-lite/package.json b/graphql-subscription-express/node_modules/iconv-lite/package.json new file mode 100644 index 0000000..a7c74fc --- /dev/null +++ b/graphql-subscription-express/node_modules/iconv-lite/package.json @@ -0,0 +1,46 @@ +{ + "name": "iconv-lite", + "description": "Convert character encodings in pure javascript.", + "version": "0.4.24", + "license": "MIT", + "keywords": [ + "iconv", + "convert", + "charset", + "icu" + ], + "author": "Alexander Shtuchkin ", + "main": "./lib/index.js", + "typings": "./lib/index.d.ts", + "homepage": "https://github.com/ashtuchkin/iconv-lite", + "bugs": "https://github.com/ashtuchkin/iconv-lite/issues", + "repository": { + "type": "git", + "url": "git://github.com/ashtuchkin/iconv-lite.git" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "coverage": "istanbul cover _mocha -- --grep .", + "coverage-open": "open coverage/lcov-report/index.html", + "test": "mocha --reporter spec --grep ." + }, + "browser": { + "./lib/extend-node": false, + "./lib/streams": false + }, + "devDependencies": { + "mocha": "^3.1.0", + "request": "~2.87.0", + "unorm": "*", + "errto": "*", + "async": "*", + "istanbul": "*", + "semver": "*", + "iconv": "*" + }, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + } +} diff --git a/graphql-subscription-express/node_modules/inherits/LICENSE b/graphql-subscription-express/node_modules/inherits/LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/graphql-subscription-express/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/graphql-subscription-express/node_modules/inherits/README.md b/graphql-subscription-express/node_modules/inherits/README.md new file mode 100644 index 0000000..b1c5665 --- /dev/null +++ b/graphql-subscription-express/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/graphql-subscription-express/node_modules/inherits/inherits.js b/graphql-subscription-express/node_modules/inherits/inherits.js new file mode 100644 index 0000000..f71f2d9 --- /dev/null +++ b/graphql-subscription-express/node_modules/inherits/inherits.js @@ -0,0 +1,9 @@ +try { + var util = require('util'); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = require('./inherits_browser.js'); +} diff --git a/graphql-subscription-express/node_modules/inherits/inherits_browser.js b/graphql-subscription-express/node_modules/inherits/inherits_browser.js new file mode 100644 index 0000000..86bbb3d --- /dev/null +++ b/graphql-subscription-express/node_modules/inherits/inherits_browser.js @@ -0,0 +1,27 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} diff --git a/graphql-subscription-express/node_modules/inherits/package.json b/graphql-subscription-express/node_modules/inherits/package.json new file mode 100644 index 0000000..37b4366 --- /dev/null +++ b/graphql-subscription-express/node_modules/inherits/package.json @@ -0,0 +1,29 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.4", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": "git://github.com/isaacs/inherits", + "license": "ISC", + "scripts": { + "test": "tap" + }, + "devDependencies": { + "tap": "^14.2.4" + }, + "files": [ + "inherits.js", + "inherits_browser.js" + ] +} diff --git a/graphql-subscription-express/node_modules/ipaddr.js/LICENSE b/graphql-subscription-express/node_modules/ipaddr.js/LICENSE new file mode 100644 index 0000000..f6b37b5 --- /dev/null +++ b/graphql-subscription-express/node_modules/ipaddr.js/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011-2017 whitequark + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/ipaddr.js/README.md b/graphql-subscription-express/node_modules/ipaddr.js/README.md new file mode 100644 index 0000000..f57725b --- /dev/null +++ b/graphql-subscription-express/node_modules/ipaddr.js/README.md @@ -0,0 +1,233 @@ +# ipaddr.js — an IPv6 and IPv4 address manipulation library [![Build Status](https://travis-ci.org/whitequark/ipaddr.js.svg)](https://travis-ci.org/whitequark/ipaddr.js) + +ipaddr.js is a small (1.9K minified and gzipped) library for manipulating +IP addresses in JavaScript environments. It runs on both CommonJS runtimes +(e.g. [nodejs]) and in a web browser. + +ipaddr.js allows you to verify and parse string representation of an IP +address, match it against a CIDR range or range list, determine if it falls +into some reserved ranges (examples include loopback and private ranges), +and convert between IPv4 and IPv4-mapped IPv6 addresses. + +[nodejs]: http://nodejs.org + +## Installation + +`npm install ipaddr.js` + +or + +`bower install ipaddr.js` + +## API + +ipaddr.js defines one object in the global scope: `ipaddr`. In CommonJS, +it is exported from the module: + +```js +var ipaddr = require('ipaddr.js'); +``` + +The API consists of several global methods and two classes: ipaddr.IPv6 and ipaddr.IPv4. + +### Global methods + +There are three global methods defined: `ipaddr.isValid`, `ipaddr.parse` and +`ipaddr.process`. All of them receive a string as a single parameter. + +The `ipaddr.isValid` method returns `true` if the address is a valid IPv4 or +IPv6 address, and `false` otherwise. It does not throw any exceptions. + +The `ipaddr.parse` method returns an object representing the IP address, +or throws an `Error` if the passed string is not a valid representation of an +IP address. + +The `ipaddr.process` method works just like the `ipaddr.parse` one, but it +automatically converts IPv4-mapped IPv6 addresses to their IPv4 counterparts +before returning. It is useful when you have a Node.js instance listening +on an IPv6 socket, and the `net.ivp6.bindv6only` sysctl parameter (or its +equivalent on non-Linux OS) is set to 0. In this case, you can accept IPv4 +connections on your IPv6-only socket, but the remote address will be mangled. +Use `ipaddr.process` method to automatically demangle it. + +### Object representation + +Parsing methods return an object which descends from `ipaddr.IPv6` or +`ipaddr.IPv4`. These objects share some properties, but most of them differ. + +#### Shared properties + +One can determine the type of address by calling `addr.kind()`. It will return +either `"ipv6"` or `"ipv4"`. + +An address can be converted back to its string representation with `addr.toString()`. +Note that this method: + * does not return the original string used to create the object (in fact, there is + no way of getting that string) + * returns a compact representation (when it is applicable) + +A `match(range, bits)` method can be used to check if the address falls into a +certain CIDR range. +Note that an address can be (obviously) matched only against an address of the same type. + +For example: + +```js +var addr = ipaddr.parse("2001:db8:1234::1"); +var range = ipaddr.parse("2001:db8::"); + +addr.match(range, 32); // => true +``` + +Alternatively, `match` can also be called as `match([range, bits])`. In this way, +it can be used together with the `parseCIDR(string)` method, which parses an IP +address together with a CIDR range. + +For example: + +```js +var addr = ipaddr.parse("2001:db8:1234::1"); + +addr.match(ipaddr.parseCIDR("2001:db8::/32")); // => true +``` + +A `range()` method returns one of predefined names for several special ranges defined +by IP protocols. The exact names (and their respective CIDR ranges) can be looked up +in the source: [IPv6 ranges] and [IPv4 ranges]. Some common ones include `"unicast"` +(the default one) and `"reserved"`. + +You can match against your own range list by using +`ipaddr.subnetMatch(address, rangeList, defaultName)` method. It can work with a mix of IPv6 or IPv4 addresses, and accepts a name-to-subnet map as the range list. For example: + +```js +var rangeList = { + documentationOnly: [ ipaddr.parse('2001:db8::'), 32 ], + tunnelProviders: [ + [ ipaddr.parse('2001:470::'), 32 ], // he.net + [ ipaddr.parse('2001:5c0::'), 32 ] // freenet6 + ] +}; +ipaddr.subnetMatch(ipaddr.parse('2001:470:8:66::1'), rangeList, 'unknown'); // => "tunnelProviders" +``` + +The addresses can be converted to their byte representation with `toByteArray()`. +(Actually, JavaScript mostly does not know about byte buffers. They are emulated with +arrays of numbers, each in range of 0..255.) + +```js +var bytes = ipaddr.parse('2a00:1450:8007::68').toByteArray(); // ipv6.google.com +bytes // => [42, 0x00, 0x14, 0x50, 0x80, 0x07, 0x00, , 0x00, 0x68 ] +``` + +The `ipaddr.IPv4` and `ipaddr.IPv6` objects have some methods defined, too. All of them +have the same interface for both protocols, and are similar to global methods. + +`ipaddr.IPvX.isValid(string)` can be used to check if the string is a valid address +for particular protocol, and `ipaddr.IPvX.parse(string)` is the error-throwing parser. + +`ipaddr.IPvX.isValid(string)` uses the same format for parsing as the POSIX `inet_ntoa` function, which accepts unusual formats like `0xc0.168.1.1` or `0x10000000`. The function `ipaddr.IPv4.isValidFourPartDecimal(string)` validates the IPv4 address and also ensures that it is written in four-part decimal format. + +[IPv6 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L186 +[IPv4 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L71 + +#### IPv6 properties + +Sometimes you will want to convert IPv6 not to a compact string representation (with +the `::` substitution); the `toNormalizedString()` method will return an address where +all zeroes are explicit. + +For example: + +```js +var addr = ipaddr.parse("2001:0db8::0001"); +addr.toString(); // => "2001:db8::1" +addr.toNormalizedString(); // => "2001:db8:0:0:0:0:0:1" +``` + +The `isIPv4MappedAddress()` method will return `true` if this address is an IPv4-mapped +one, and `toIPv4Address()` will return an IPv4 object address. + +To access the underlying binary representation of the address, use `addr.parts`. + +```js +var addr = ipaddr.parse("2001:db8:10::1234:DEAD"); +addr.parts // => [0x2001, 0xdb8, 0x10, 0, 0, 0, 0x1234, 0xdead] +``` + +A IPv6 zone index can be accessed via `addr.zoneId`: + +```js +var addr = ipaddr.parse("2001:db8::%eth0"); +addr.zoneId // => 'eth0' +``` + +#### IPv4 properties + +`toIPv4MappedAddress()` will return a corresponding IPv4-mapped IPv6 address. + +To access the underlying representation of the address, use `addr.octets`. + +```js +var addr = ipaddr.parse("192.168.1.1"); +addr.octets // => [192, 168, 1, 1] +``` + +`prefixLengthFromSubnetMask()` will return a CIDR prefix length for a valid IPv4 netmask or +null if the netmask is not valid. + +```js +ipaddr.IPv4.parse('255.255.255.240').prefixLengthFromSubnetMask() == 28 +ipaddr.IPv4.parse('255.192.164.0').prefixLengthFromSubnetMask() == null +``` + +`subnetMaskFromPrefixLength()` will return an IPv4 netmask for a valid CIDR prefix length. + +```js +ipaddr.IPv4.subnetMaskFromPrefixLength(24) == "255.255.255.0" +ipaddr.IPv4.subnetMaskFromPrefixLength(29) == "255.255.255.248" +``` + +`broadcastAddressFromCIDR()` will return the broadcast address for a given IPv4 interface and netmask in CIDR notation. +```js +ipaddr.IPv4.broadcastAddressFromCIDR("172.0.0.1/24") == "172.0.0.255" +``` +`networkAddressFromCIDR()` will return the network address for a given IPv4 interface and netmask in CIDR notation. +```js +ipaddr.IPv4.networkAddressFromCIDR("172.0.0.1/24") == "172.0.0.0" +``` + +#### Conversion + +IPv4 and IPv6 can be converted bidirectionally to and from network byte order (MSB) byte arrays. + +The `fromByteArray()` method will take an array and create an appropriate IPv4 or IPv6 object +if the input satisfies the requirements. For IPv4 it has to be an array of four 8-bit values, +while for IPv6 it has to be an array of sixteen 8-bit values. + +For example: +```js +var addr = ipaddr.fromByteArray([0x7f, 0, 0, 1]); +addr.toString(); // => "127.0.0.1" +``` + +or + +```js +var addr = ipaddr.fromByteArray([0x20, 1, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) +addr.toString(); // => "2001:db8::1" +``` + +Both objects also offer a `toByteArray()` method, which returns an array in network byte order (MSB). + +For example: +```js +var addr = ipaddr.parse("127.0.0.1"); +addr.toByteArray(); // => [0x7f, 0, 0, 1] +``` + +or + +```js +var addr = ipaddr.parse("2001:db8::1"); +addr.toByteArray(); // => [0x20, 1, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] +``` diff --git a/graphql-subscription-express/node_modules/ipaddr.js/ipaddr.min.js b/graphql-subscription-express/node_modules/ipaddr.js/ipaddr.min.js new file mode 100644 index 0000000..b54a7cc --- /dev/null +++ b/graphql-subscription-express/node_modules/ipaddr.js/ipaddr.min.js @@ -0,0 +1 @@ +(function(){var r,t,n,e,i,o,a,s;t={},s=this,"undefined"!=typeof module&&null!==module&&module.exports?module.exports=t:s.ipaddr=t,a=function(r,t,n,e){var i,o;if(r.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(i=0;e>0;){if((o=n-e)<0&&(o=0),r[i]>>o!=t[i]>>o)return!1;e-=n,i+=1}return!0},t.subnetMatch=function(r,t,n){var e,i,o,a,s;null==n&&(n="unicast");for(o in t)for(!(a=t[o])[0]||a[0]instanceof Array||(a=[a]),e=0,i=a.length;e=0;t=n+=-1){if(!((e=this.octets[t])in a))return null;if(o=a[e],i&&0!==o)return null;8!==o&&(i=!0),r+=o}return 32-r},r}(),n="(0?\\d+|0x[a-f0-9]+)",e={fourOctet:new RegExp("^"+n+"\\."+n+"\\."+n+"\\."+n+"$","i"),longValue:new RegExp("^"+n+"$","i")},t.IPv4.parser=function(r){var t,n,i,o,a;if(n=function(r){return"0"===r[0]&&"x"!==r[1]?parseInt(r,8):parseInt(r)},t=r.match(e.fourOctet))return function(){var r,e,o,a;for(a=[],r=0,e=(o=t.slice(1,6)).length;r4294967295||a<0)throw new Error("ipaddr: address outside defined range");return function(){var r,t;for(t=[],o=r=0;r<=24;o=r+=8)t.push(a>>o&255);return t}().reverse()}return null},t.IPv6=function(){function r(r,t){var n,e,i,o,a,s;if(16===r.length)for(this.parts=[],n=e=0;e<=14;n=e+=2)this.parts.push(r[n]<<8|r[n+1]);else{if(8!==r.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=r}for(i=0,o=(s=this.parts).length;it&&(r=n.index,t=n[0].length);return t<0?i:i.substring(0,r)+"::"+i.substring(r+t)},r.prototype.toByteArray=function(){var r,t,n,e,i;for(r=[],t=0,n=(i=this.parts).length;t>8),r.push(255&e);return r},r.prototype.toNormalizedString=function(){var r,t,n;return r=function(){var r,n,e,i;for(i=[],r=0,n=(e=this.parts).length;r>8,255&r,n>>8,255&n])},r.prototype.prefixLengthFromSubnetMask=function(){var r,t,n,e,i,o,a;for(a={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r=0,i=!1,t=n=7;n>=0;t=n+=-1){if(!((e=this.parts[t])in a))return null;if(o=a[e],i&&0!==o)return null;16!==o&&(i=!0),r+=o}return 128-r},r}(),i="(?:[0-9a-f]+::?)+",o={zoneIndex:new RegExp("%[0-9a-z]{1,}","i"),native:new RegExp("^(::)?("+i+")?([0-9a-f]+)?(::)?(%[0-9a-z]{1,})?$","i"),transitional:new RegExp("^((?:"+i+")|(?:::)(?:"+i+")?)"+n+"\\."+n+"\\."+n+"\\."+n+"(%[0-9a-z]{1,})?$","i")},r=function(r,t){var n,e,i,a,s,p;if(r.indexOf("::")!==r.lastIndexOf("::"))return null;for((p=(r.match(o.zoneIndex)||[])[0])&&(p=p.substring(1),r=r.replace(/%.+$/,"")),n=0,e=-1;(e=r.indexOf(":",e+1))>=0;)n++;if("::"===r.substr(0,2)&&n--,"::"===r.substr(-2,2)&&n--,n>t)return null;for(s=t-n,a=":";s--;)a+="0:";return":"===(r=r.replace("::",a))[0]&&(r=r.slice(1)),":"===r[r.length-1]&&(r=r.slice(0,-1)),t=function(){var t,n,e,o;for(o=[],t=0,n=(e=r.split(":")).length;t=0&&t<=32)return e=[this.parse(n[1]),t],Object.defineProperty(e,"toString",{value:function(){return this.join("/")}}),e;throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},t.IPv4.subnetMaskFromPrefixLength=function(r){var t,n,e;if((r=parseInt(r))<0||r>32)throw new Error("ipaddr: invalid IPv4 prefix length");for(e=[0,0,0,0],n=0,t=Math.floor(r/8);n=0&&t<=128)return e=[this.parse(n[1]),t],Object.defineProperty(e,"toString",{value:function(){return this.join("/")}}),e;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},t.isValid=function(r){return t.IPv6.isValid(r)||t.IPv4.isValid(r)},t.parse=function(r){if(t.IPv6.isValid(r))return t.IPv6.parse(r);if(t.IPv4.isValid(r))return t.IPv4.parse(r);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},t.parseCIDR=function(r){try{return t.IPv6.parseCIDR(r)}catch(n){n;try{return t.IPv4.parseCIDR(r)}catch(r){throw r,new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},t.fromByteArray=function(r){var n;if(4===(n=r.length))return new t.IPv4(r);if(16===n)return new t.IPv6(r);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},t.process=function(r){var t;return t=this.parse(r),"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t}}).call(this); \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js b/graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js new file mode 100644 index 0000000..18bd93b --- /dev/null +++ b/graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js @@ -0,0 +1,673 @@ +(function() { + var expandIPv6, ipaddr, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root, zoneIndex; + + ipaddr = {}; + + root = this; + + if ((typeof module !== "undefined" && module !== null) && module.exports) { + module.exports = ipaddr; + } else { + root['ipaddr'] = ipaddr; + } + + matchCIDR = function(first, second, partSize, cidrBits) { + var part, shift; + if (first.length !== second.length) { + throw new Error("ipaddr: cannot match CIDR for objects with different lengths"); + } + part = 0; + while (cidrBits > 0) { + shift = partSize - cidrBits; + if (shift < 0) { + shift = 0; + } + if (first[part] >> shift !== second[part] >> shift) { + return false; + } + cidrBits -= partSize; + part += 1; + } + return true; + }; + + ipaddr.subnetMatch = function(address, rangeList, defaultName) { + var k, len, rangeName, rangeSubnets, subnet; + if (defaultName == null) { + defaultName = 'unicast'; + } + for (rangeName in rangeList) { + rangeSubnets = rangeList[rangeName]; + if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) { + rangeSubnets = [rangeSubnets]; + } + for (k = 0, len = rangeSubnets.length; k < len; k++) { + subnet = rangeSubnets[k]; + if (address.kind() === subnet[0].kind()) { + if (address.match.apply(address, subnet)) { + return rangeName; + } + } + } + } + return defaultName; + }; + + ipaddr.IPv4 = (function() { + function IPv4(octets) { + var k, len, octet; + if (octets.length !== 4) { + throw new Error("ipaddr: ipv4 octet count should be 4"); + } + for (k = 0, len = octets.length; k < len; k++) { + octet = octets[k]; + if (!((0 <= octet && octet <= 255))) { + throw new Error("ipaddr: ipv4 octet should fit in 8 bits"); + } + } + this.octets = octets; + } + + IPv4.prototype.kind = function() { + return 'ipv4'; + }; + + IPv4.prototype.toString = function() { + return this.octets.join("."); + }; + + IPv4.prototype.toNormalizedString = function() { + return this.toString(); + }; + + IPv4.prototype.toByteArray = function() { + return this.octets.slice(0); + }; + + IPv4.prototype.match = function(other, cidrRange) { + var ref; + if (cidrRange === void 0) { + ref = other, other = ref[0], cidrRange = ref[1]; + } + if (other.kind() !== 'ipv4') { + throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one"); + } + return matchCIDR(this.octets, other.octets, 8, cidrRange); + }; + + IPv4.prototype.SpecialRanges = { + unspecified: [[new IPv4([0, 0, 0, 0]), 8]], + broadcast: [[new IPv4([255, 255, 255, 255]), 32]], + multicast: [[new IPv4([224, 0, 0, 0]), 4]], + linkLocal: [[new IPv4([169, 254, 0, 0]), 16]], + loopback: [[new IPv4([127, 0, 0, 0]), 8]], + carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]], + "private": [[new IPv4([10, 0, 0, 0]), 8], [new IPv4([172, 16, 0, 0]), 12], [new IPv4([192, 168, 0, 0]), 16]], + reserved: [[new IPv4([192, 0, 0, 0]), 24], [new IPv4([192, 0, 2, 0]), 24], [new IPv4([192, 88, 99, 0]), 24], [new IPv4([198, 51, 100, 0]), 24], [new IPv4([203, 0, 113, 0]), 24], [new IPv4([240, 0, 0, 0]), 4]] + }; + + IPv4.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + IPv4.prototype.toIPv4MappedAddress = function() { + return ipaddr.IPv6.parse("::ffff:" + (this.toString())); + }; + + IPv4.prototype.prefixLengthFromSubnetMask = function() { + var cidr, i, k, octet, stop, zeros, zerotable; + zerotable = { + 0: 8, + 128: 7, + 192: 6, + 224: 5, + 240: 4, + 248: 3, + 252: 2, + 254: 1, + 255: 0 + }; + cidr = 0; + stop = false; + for (i = k = 3; k >= 0; i = k += -1) { + octet = this.octets[i]; + if (octet in zerotable) { + zeros = zerotable[octet]; + if (stop && zeros !== 0) { + return null; + } + if (zeros !== 8) { + stop = true; + } + cidr += zeros; + } else { + return null; + } + } + return 32 - cidr; + }; + + return IPv4; + + })(); + + ipv4Part = "(0?\\d+|0x[a-f0-9]+)"; + + ipv4Regexes = { + fourOctet: new RegExp("^" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$", 'i'), + longValue: new RegExp("^" + ipv4Part + "$", 'i') + }; + + ipaddr.IPv4.parser = function(string) { + var match, parseIntAuto, part, shift, value; + parseIntAuto = function(string) { + if (string[0] === "0" && string[1] !== "x") { + return parseInt(string, 8); + } else { + return parseInt(string); + } + }; + if (match = string.match(ipv4Regexes.fourOctet)) { + return (function() { + var k, len, ref, results; + ref = match.slice(1, 6); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(parseIntAuto(part)); + } + return results; + })(); + } else if (match = string.match(ipv4Regexes.longValue)) { + value = parseIntAuto(match[1]); + if (value > 0xffffffff || value < 0) { + throw new Error("ipaddr: address outside defined range"); + } + return ((function() { + var k, results; + results = []; + for (shift = k = 0; k <= 24; shift = k += 8) { + results.push((value >> shift) & 0xff); + } + return results; + })()).reverse(); + } else { + return null; + } + }; + + ipaddr.IPv6 = (function() { + function IPv6(parts, zoneId) { + var i, k, l, len, part, ref; + if (parts.length === 16) { + this.parts = []; + for (i = k = 0; k <= 14; i = k += 2) { + this.parts.push((parts[i] << 8) | parts[i + 1]); + } + } else if (parts.length === 8) { + this.parts = parts; + } else { + throw new Error("ipaddr: ipv6 part count should be 8 or 16"); + } + ref = this.parts; + for (l = 0, len = ref.length; l < len; l++) { + part = ref[l]; + if (!((0 <= part && part <= 0xffff))) { + throw new Error("ipaddr: ipv6 part should fit in 16 bits"); + } + } + if (zoneId) { + this.zoneId = zoneId; + } + } + + IPv6.prototype.kind = function() { + return 'ipv6'; + }; + + IPv6.prototype.toString = function() { + return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, '::'); + }; + + IPv6.prototype.toRFC5952String = function() { + var bestMatchIndex, bestMatchLength, match, regex, string; + regex = /((^|:)(0(:|$)){2,})/g; + string = this.toNormalizedString(); + bestMatchIndex = 0; + bestMatchLength = -1; + while ((match = regex.exec(string))) { + if (match[0].length > bestMatchLength) { + bestMatchIndex = match.index; + bestMatchLength = match[0].length; + } + } + if (bestMatchLength < 0) { + return string; + } + return string.substring(0, bestMatchIndex) + '::' + string.substring(bestMatchIndex + bestMatchLength); + }; + + IPv6.prototype.toByteArray = function() { + var bytes, k, len, part, ref; + bytes = []; + ref = this.parts; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + bytes.push(part >> 8); + bytes.push(part & 0xff); + } + return bytes; + }; + + IPv6.prototype.toNormalizedString = function() { + var addr, part, suffix; + addr = ((function() { + var k, len, ref, results; + ref = this.parts; + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(part.toString(16)); + } + return results; + }).call(this)).join(":"); + suffix = ''; + if (this.zoneId) { + suffix = '%' + this.zoneId; + } + return addr + suffix; + }; + + IPv6.prototype.toFixedLengthString = function() { + var addr, part, suffix; + addr = ((function() { + var k, len, ref, results; + ref = this.parts; + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(part.toString(16).padStart(4, '0')); + } + return results; + }).call(this)).join(":"); + suffix = ''; + if (this.zoneId) { + suffix = '%' + this.zoneId; + } + return addr + suffix; + }; + + IPv6.prototype.match = function(other, cidrRange) { + var ref; + if (cidrRange === void 0) { + ref = other, other = ref[0], cidrRange = ref[1]; + } + if (other.kind() !== 'ipv6') { + throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one"); + } + return matchCIDR(this.parts, other.parts, 16, cidrRange); + }; + + IPv6.prototype.SpecialRanges = { + unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128], + linkLocal: [new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10], + multicast: [new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8], + loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128], + uniqueLocal: [new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7], + ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96], + rfc6145: [new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96], + rfc6052: [new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96], + '6to4': [new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16], + teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32], + reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]] + }; + + IPv6.prototype.range = function() { + return ipaddr.subnetMatch(this, this.SpecialRanges); + }; + + IPv6.prototype.isIPv4MappedAddress = function() { + return this.range() === 'ipv4Mapped'; + }; + + IPv6.prototype.toIPv4Address = function() { + var high, low, ref; + if (!this.isIPv4MappedAddress()) { + throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4"); + } + ref = this.parts.slice(-2), high = ref[0], low = ref[1]; + return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]); + }; + + IPv6.prototype.prefixLengthFromSubnetMask = function() { + var cidr, i, k, part, stop, zeros, zerotable; + zerotable = { + 0: 16, + 32768: 15, + 49152: 14, + 57344: 13, + 61440: 12, + 63488: 11, + 64512: 10, + 65024: 9, + 65280: 8, + 65408: 7, + 65472: 6, + 65504: 5, + 65520: 4, + 65528: 3, + 65532: 2, + 65534: 1, + 65535: 0 + }; + cidr = 0; + stop = false; + for (i = k = 7; k >= 0; i = k += -1) { + part = this.parts[i]; + if (part in zerotable) { + zeros = zerotable[part]; + if (stop && zeros !== 0) { + return null; + } + if (zeros !== 16) { + stop = true; + } + cidr += zeros; + } else { + return null; + } + } + return 128 - cidr; + }; + + return IPv6; + + })(); + + ipv6Part = "(?:[0-9a-f]+::?)+"; + + zoneIndex = "%[0-9a-z]{1,}"; + + ipv6Regexes = { + zoneIndex: new RegExp(zoneIndex, 'i'), + "native": new RegExp("^(::)?(" + ipv6Part + ")?([0-9a-f]+)?(::)?(" + zoneIndex + ")?$", 'i'), + transitional: new RegExp(("^((?:" + ipv6Part + ")|(?:::)(?:" + ipv6Part + ")?)") + (ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part) + ("(" + zoneIndex + ")?$"), 'i') + }; + + expandIPv6 = function(string, parts) { + var colonCount, lastColon, part, replacement, replacementCount, zoneId; + if (string.indexOf('::') !== string.lastIndexOf('::')) { + return null; + } + zoneId = (string.match(ipv6Regexes['zoneIndex']) || [])[0]; + if (zoneId) { + zoneId = zoneId.substring(1); + string = string.replace(/%.+$/, ''); + } + colonCount = 0; + lastColon = -1; + while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) { + colonCount++; + } + if (string.substr(0, 2) === '::') { + colonCount--; + } + if (string.substr(-2, 2) === '::') { + colonCount--; + } + if (colonCount > parts) { + return null; + } + replacementCount = parts - colonCount; + replacement = ':'; + while (replacementCount--) { + replacement += '0:'; + } + string = string.replace('::', replacement); + if (string[0] === ':') { + string = string.slice(1); + } + if (string[string.length - 1] === ':') { + string = string.slice(0, -1); + } + parts = (function() { + var k, len, ref, results; + ref = string.split(":"); + results = []; + for (k = 0, len = ref.length; k < len; k++) { + part = ref[k]; + results.push(parseInt(part, 16)); + } + return results; + })(); + return { + parts: parts, + zoneId: zoneId + }; + }; + + ipaddr.IPv6.parser = function(string) { + var addr, k, len, match, octet, octets, zoneId; + if (ipv6Regexes['native'].test(string)) { + return expandIPv6(string, 8); + } else if (match = string.match(ipv6Regexes['transitional'])) { + zoneId = match[6] || ''; + addr = expandIPv6(match[1].slice(0, -1) + zoneId, 6); + if (addr.parts) { + octets = [parseInt(match[2]), parseInt(match[3]), parseInt(match[4]), parseInt(match[5])]; + for (k = 0, len = octets.length; k < len; k++) { + octet = octets[k]; + if (!((0 <= octet && octet <= 255))) { + return null; + } + } + addr.parts.push(octets[0] << 8 | octets[1]); + addr.parts.push(octets[2] << 8 | octets[3]); + return { + parts: addr.parts, + zoneId: addr.zoneId + }; + } + } + return null; + }; + + ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = function(string) { + return this.parser(string) !== null; + }; + + ipaddr.IPv4.isValid = function(string) { + var e; + try { + new this(this.parser(string)); + return true; + } catch (error1) { + e = error1; + return false; + } + }; + + ipaddr.IPv4.isValidFourPartDecimal = function(string) { + if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) { + return true; + } else { + return false; + } + }; + + ipaddr.IPv6.isValid = function(string) { + var addr, e; + if (typeof string === "string" && string.indexOf(":") === -1) { + return false; + } + try { + addr = this.parser(string); + new this(addr.parts, addr.zoneId); + return true; + } catch (error1) { + e = error1; + return false; + } + }; + + ipaddr.IPv4.parse = function(string) { + var parts; + parts = this.parser(string); + if (parts === null) { + throw new Error("ipaddr: string is not formatted like ip address"); + } + return new this(parts); + }; + + ipaddr.IPv6.parse = function(string) { + var addr; + addr = this.parser(string); + if (addr.parts === null) { + throw new Error("ipaddr: string is not formatted like ip address"); + } + return new this(addr.parts, addr.zoneId); + }; + + ipaddr.IPv4.parseCIDR = function(string) { + var maskLength, match, parsed; + if (match = string.match(/^(.+)\/(\d+)$/)) { + maskLength = parseInt(match[2]); + if (maskLength >= 0 && maskLength <= 32) { + parsed = [this.parse(match[1]), maskLength]; + Object.defineProperty(parsed, 'toString', { + value: function() { + return this.join('/'); + } + }); + return parsed; + } + } + throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range"); + }; + + ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) { + var filledOctetCount, j, octets; + prefix = parseInt(prefix); + if (prefix < 0 || prefix > 32) { + throw new Error('ipaddr: invalid IPv4 prefix length'); + } + octets = [0, 0, 0, 0]; + j = 0; + filledOctetCount = Math.floor(prefix / 8); + while (j < filledOctetCount) { + octets[j] = 255; + j++; + } + if (filledOctetCount < 4) { + octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8); + } + return new this(octets); + }; + + ipaddr.IPv4.broadcastAddressFromCIDR = function(string) { + var cidr, error, i, ipInterfaceOctets, octets, subnetMaskOctets; + try { + cidr = this.parseCIDR(string); + ipInterfaceOctets = cidr[0].toByteArray(); + subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + octets = []; + i = 0; + while (i < 4) { + octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255); + i++; + } + return new this(octets); + } catch (error1) { + error = error1; + throw new Error('ipaddr: the address does not have IPv4 CIDR format'); + } + }; + + ipaddr.IPv4.networkAddressFromCIDR = function(string) { + var cidr, error, i, ipInterfaceOctets, octets, subnetMaskOctets; + try { + cidr = this.parseCIDR(string); + ipInterfaceOctets = cidr[0].toByteArray(); + subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray(); + octets = []; + i = 0; + while (i < 4) { + octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10)); + i++; + } + return new this(octets); + } catch (error1) { + error = error1; + throw new Error('ipaddr: the address does not have IPv4 CIDR format'); + } + }; + + ipaddr.IPv6.parseCIDR = function(string) { + var maskLength, match, parsed; + if (match = string.match(/^(.+)\/(\d+)$/)) { + maskLength = parseInt(match[2]); + if (maskLength >= 0 && maskLength <= 128) { + parsed = [this.parse(match[1]), maskLength]; + Object.defineProperty(parsed, 'toString', { + value: function() { + return this.join('/'); + } + }); + return parsed; + } + } + throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range"); + }; + + ipaddr.isValid = function(string) { + return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string); + }; + + ipaddr.parse = function(string) { + if (ipaddr.IPv6.isValid(string)) { + return ipaddr.IPv6.parse(string); + } else if (ipaddr.IPv4.isValid(string)) { + return ipaddr.IPv4.parse(string); + } else { + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format"); + } + }; + + ipaddr.parseCIDR = function(string) { + var e; + try { + return ipaddr.IPv6.parseCIDR(string); + } catch (error1) { + e = error1; + try { + return ipaddr.IPv4.parseCIDR(string); + } catch (error1) { + e = error1; + throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format"); + } + } + }; + + ipaddr.fromByteArray = function(bytes) { + var length; + length = bytes.length; + if (length === 4) { + return new ipaddr.IPv4(bytes); + } else if (length === 16) { + return new ipaddr.IPv6(bytes); + } else { + throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address"); + } + }; + + ipaddr.process = function(string) { + var addr; + addr = this.parse(string); + if (addr.kind() === 'ipv6' && addr.isIPv4MappedAddress()) { + return addr.toIPv4Address(); + } else { + return addr; + } + }; + +}).call(this); diff --git a/graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js.d.ts b/graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js.d.ts new file mode 100644 index 0000000..52174b6 --- /dev/null +++ b/graphql-subscription-express/node_modules/ipaddr.js/lib/ipaddr.js.d.ts @@ -0,0 +1,68 @@ +declare module "ipaddr.js" { + type IPv4Range = 'unicast' | 'unspecified' | 'broadcast' | 'multicast' | 'linkLocal' | 'loopback' | 'carrierGradeNat' | 'private' | 'reserved'; + type IPv6Range = 'unicast' | 'unspecified' | 'linkLocal' | 'multicast' | 'loopback' | 'uniqueLocal' | 'ipv4Mapped' | 'rfc6145' | 'rfc6052' | '6to4' | 'teredo' | 'reserved'; + + interface RangeList { + [name: string]: [T, number] | [T, number][]; + } + + // Common methods/properties for IPv4 and IPv6 classes. + class IP { + prefixLengthFromSubnetMask(): number | null; + toByteArray(): number[]; + toNormalizedString(): string; + toString(): string; + } + + namespace Address { + export function isValid(addr: string): boolean; + export function fromByteArray(bytes: number[]): IPv4 | IPv6; + export function parse(addr: string): IPv4 | IPv6; + export function parseCIDR(mask: string): [IPv4 | IPv6, number]; + export function process(addr: string): IPv4 | IPv6; + export function subnetMatch(addr: IPv4, rangeList: RangeList, defaultName?: string): string; + export function subnetMatch(addr: IPv6, rangeList: RangeList, defaultName?: string): string; + + export class IPv4 extends IP { + static broadcastAddressFromCIDR(addr: string): IPv4; + static isIPv4(addr: string): boolean; + static isValidFourPartDecimal(addr: string): boolean; + static isValid(addr: string): boolean; + static networkAddressFromCIDR(addr: string): IPv4; + static parse(addr: string): IPv4; + static parseCIDR(addr: string): [IPv4, number]; + static subnetMaskFromPrefixLength(prefix: number): IPv4; + constructor(octets: number[]); + octets: number[] + + kind(): 'ipv4'; + match(addr: IPv4, bits: number): boolean; + match(mask: [IPv4, number]): boolean; + range(): IPv4Range; + subnetMatch(rangeList: RangeList, defaultName?: string): string; + toIPv4MappedAddress(): IPv6; + } + + export class IPv6 extends IP { + static broadcastAddressFromCIDR(addr: string): IPv6; + static isIPv6(addr: string): boolean; + static isValid(addr: string): boolean; + static parse(addr: string): IPv6; + static parseCIDR(addr: string): [IPv6, number]; + static subnetMaskFromPrefixLength(prefix: number): IPv6; + constructor(parts: number[]); + parts: number[] + zoneId?: string + + isIPv4MappedAddress(): boolean; + kind(): 'ipv6'; + match(addr: IPv6, bits: number): boolean; + match(mask: [IPv6, number]): boolean; + range(): IPv6Range; + subnetMatch(rangeList: RangeList, defaultName?: string): string; + toIPv4Address(): IPv4; + } + } + + export = Address; +} diff --git a/graphql-subscription-express/node_modules/ipaddr.js/package.json b/graphql-subscription-express/node_modules/ipaddr.js/package.json new file mode 100644 index 0000000..f4d3547 --- /dev/null +++ b/graphql-subscription-express/node_modules/ipaddr.js/package.json @@ -0,0 +1,35 @@ +{ + "name": "ipaddr.js", + "description": "A library for manipulating IPv4 and IPv6 addresses in JavaScript.", + "version": "1.9.1", + "author": "whitequark ", + "directories": { + "lib": "./lib" + }, + "dependencies": {}, + "devDependencies": { + "coffee-script": "~1.12.6", + "nodeunit": "^0.11.3", + "uglify-js": "~3.0.19" + }, + "scripts": { + "test": "cake build test" + }, + "files": [ + "lib/", + "LICENSE", + "ipaddr.min.js" + ], + "keywords": [ + "ip", + "ipv4", + "ipv6" + ], + "repository": "git://github.com/whitequark/ipaddr.js", + "main": "./lib/ipaddr.js", + "engines": { + "node": ">= 0.10" + }, + "license": "MIT", + "types": "./lib/ipaddr.js.d.ts" +} diff --git a/graphql-subscription-express/node_modules/media-typer/HISTORY.md b/graphql-subscription-express/node_modules/media-typer/HISTORY.md new file mode 100644 index 0000000..62c2003 --- /dev/null +++ b/graphql-subscription-express/node_modules/media-typer/HISTORY.md @@ -0,0 +1,22 @@ +0.3.0 / 2014-09-07 +================== + + * Support Node.js 0.6 + * Throw error when parameter format invalid on parse + +0.2.0 / 2014-06-18 +================== + + * Add `typer.format()` to format media types + +0.1.0 / 2014-06-17 +================== + + * Accept `req` as argument to `parse` + * Accept `res` as argument to `parse` + * Parse media type with extra LWS between type and first parameter + +0.0.0 / 2014-06-13 +================== + + * Initial implementation diff --git a/graphql-subscription-express/node_modules/media-typer/LICENSE b/graphql-subscription-express/node_modules/media-typer/LICENSE new file mode 100644 index 0000000..b7dce6c --- /dev/null +++ b/graphql-subscription-express/node_modules/media-typer/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/media-typer/README.md b/graphql-subscription-express/node_modules/media-typer/README.md new file mode 100644 index 0000000..d8df623 --- /dev/null +++ b/graphql-subscription-express/node_modules/media-typer/README.md @@ -0,0 +1,81 @@ +# media-typer + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Simple RFC 6838 media type parser + +## Installation + +```sh +$ npm install media-typer +``` + +## API + +```js +var typer = require('media-typer') +``` + +### typer.parse(string) + +```js +var obj = typer.parse('image/svg+xml; charset=utf-8') +``` + +Parse a media type string. This will return an object with the following +properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): + + - `type`: The type of the media type (always lower case). Example: `'image'` + + - `subtype`: The subtype of the media type (always lower case). Example: `'svg'` + + - `suffix`: The suffix of the media type (always lower case). Example: `'xml'` + + - `parameters`: An object of the parameters in the media type (name of parameter always lower case). Example: `{charset: 'utf-8'}` + +### typer.parse(req) + +```js +var obj = typer.parse(req) +``` + +Parse the `content-type` header from the given `req`. Short-cut for +`typer.parse(req.headers['content-type'])`. + +### typer.parse(res) + +```js +var obj = typer.parse(res) +``` + +Parse the `content-type` header set on the given `res`. Short-cut for +`typer.parse(res.getHeader('content-type'))`. + +### typer.format(obj) + +```js +var obj = typer.format({type: 'image', subtype: 'svg', suffix: 'xml'}) +``` + +Format an object into a media type string. This will return a string of the +mime type for the given object. For the properties of the object, see the +documentation for `typer.parse(string)`. + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/media-typer.svg?style=flat +[npm-url]: https://npmjs.org/package/media-typer +[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat +[node-version-url]: http://nodejs.org/download/ +[travis-image]: https://img.shields.io/travis/jshttp/media-typer.svg?style=flat +[travis-url]: https://travis-ci.org/jshttp/media-typer +[coveralls-image]: https://img.shields.io/coveralls/jshttp/media-typer.svg?style=flat +[coveralls-url]: https://coveralls.io/r/jshttp/media-typer +[downloads-image]: https://img.shields.io/npm/dm/media-typer.svg?style=flat +[downloads-url]: https://npmjs.org/package/media-typer diff --git a/graphql-subscription-express/node_modules/media-typer/index.js b/graphql-subscription-express/node_modules/media-typer/index.js new file mode 100644 index 0000000..07f7295 --- /dev/null +++ b/graphql-subscription-express/node_modules/media-typer/index.js @@ -0,0 +1,270 @@ +/*! + * media-typer + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * RegExp to match *( ";" parameter ) in RFC 2616 sec 3.7 + * + * parameter = token "=" ( token | quoted-string ) + * token = 1* + * separators = "(" | ")" | "<" | ">" | "@" + * | "," | ";" | ":" | "\" | <"> + * | "/" | "[" | "]" | "?" | "=" + * | "{" | "}" | SP | HT + * quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) + * qdtext = > + * quoted-pair = "\" CHAR + * CHAR = + * TEXT = + * LWS = [CRLF] 1*( SP | HT ) + * CRLF = CR LF + * CR = + * LF = + * SP = + * SHT = + * CTL = + * OCTET = + */ +var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g; +var textRegExp = /^[\u0020-\u007e\u0080-\u00ff]+$/ +var tokenRegExp = /^[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+$/ + +/** + * RegExp to match quoted-pair in RFC 2616 + * + * quoted-pair = "\" CHAR + * CHAR = + */ +var qescRegExp = /\\([\u0000-\u007f])/g; + +/** + * RegExp to match chars that must be quoted-pair in RFC 2616 + */ +var quoteRegExp = /([\\"])/g; + +/** + * RegExp to match type in RFC 6838 + * + * type-name = restricted-name + * subtype-name = restricted-name + * restricted-name = restricted-name-first *126restricted-name-chars + * restricted-name-first = ALPHA / DIGIT + * restricted-name-chars = ALPHA / DIGIT / "!" / "#" / + * "$" / "&" / "-" / "^" / "_" + * restricted-name-chars =/ "." ; Characters before first dot always + * ; specify a facet name + * restricted-name-chars =/ "+" ; Characters after last plus always + * ; specify a structured syntax suffix + * ALPHA = %x41-5A / %x61-7A ; A-Z / a-z + * DIGIT = %x30-39 ; 0-9 + */ +var subtypeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/ +var typeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/ +var typeRegExp = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/; + +/** + * Module exports. + */ + +exports.format = format +exports.parse = parse + +/** + * Format object to media type. + * + * @param {object} obj + * @return {string} + * @api public + */ + +function format(obj) { + if (!obj || typeof obj !== 'object') { + throw new TypeError('argument obj is required') + } + + var parameters = obj.parameters + var subtype = obj.subtype + var suffix = obj.suffix + var type = obj.type + + if (!type || !typeNameRegExp.test(type)) { + throw new TypeError('invalid type') + } + + if (!subtype || !subtypeNameRegExp.test(subtype)) { + throw new TypeError('invalid subtype') + } + + // format as type/subtype + var string = type + '/' + subtype + + // append +suffix + if (suffix) { + if (!typeNameRegExp.test(suffix)) { + throw new TypeError('invalid suffix') + } + + string += '+' + suffix + } + + // append parameters + if (parameters && typeof parameters === 'object') { + var param + var params = Object.keys(parameters).sort() + + for (var i = 0; i < params.length; i++) { + param = params[i] + + if (!tokenRegExp.test(param)) { + throw new TypeError('invalid parameter name') + } + + string += '; ' + param + '=' + qstring(parameters[param]) + } + } + + return string +} + +/** + * Parse media type to object. + * + * @param {string|object} string + * @return {Object} + * @api public + */ + +function parse(string) { + if (!string) { + throw new TypeError('argument string is required') + } + + // support req/res-like objects as argument + if (typeof string === 'object') { + string = getcontenttype(string) + } + + if (typeof string !== 'string') { + throw new TypeError('argument string is required to be a string') + } + + var index = string.indexOf(';') + var type = index !== -1 + ? string.substr(0, index) + : string + + var key + var match + var obj = splitType(type) + var params = {} + var value + + paramRegExp.lastIndex = index + + while (match = paramRegExp.exec(string)) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value[0] === '"') { + // remove quotes and escapes + value = value + .substr(1, value.length - 2) + .replace(qescRegExp, '$1') + } + + params[key] = value + } + + if (index !== -1 && index !== string.length) { + throw new TypeError('invalid parameter format') + } + + obj.parameters = params + + return obj +} + +/** + * Get content-type from req/res objects. + * + * @param {object} + * @return {Object} + * @api private + */ + +function getcontenttype(obj) { + if (typeof obj.getHeader === 'function') { + // res-like + return obj.getHeader('content-type') + } + + if (typeof obj.headers === 'object') { + // req-like + return obj.headers && obj.headers['content-type'] + } +} + +/** + * Quote a string if necessary. + * + * @param {string} val + * @return {string} + * @api private + */ + +function qstring(val) { + var str = String(val) + + // no need to quote tokens + if (tokenRegExp.test(str)) { + return str + } + + if (str.length > 0 && !textRegExp.test(str)) { + throw new TypeError('invalid parameter value') + } + + return '"' + str.replace(quoteRegExp, '\\$1') + '"' +} + +/** + * Simply "type/subtype+siffx" into parts. + * + * @param {string} string + * @return {Object} + * @api private + */ + +function splitType(string) { + var match = typeRegExp.exec(string.toLowerCase()) + + if (!match) { + throw new TypeError('invalid media type') + } + + var type = match[1] + var subtype = match[2] + var suffix + + // suffix after last + + var index = subtype.lastIndexOf('+') + if (index !== -1) { + suffix = subtype.substr(index + 1) + subtype = subtype.substr(0, index) + } + + var obj = { + type: type, + subtype: subtype, + suffix: suffix + } + + return obj +} diff --git a/graphql-subscription-express/node_modules/media-typer/package.json b/graphql-subscription-express/node_modules/media-typer/package.json new file mode 100644 index 0000000..8cf3ebc --- /dev/null +++ b/graphql-subscription-express/node_modules/media-typer/package.json @@ -0,0 +1,26 @@ +{ + "name": "media-typer", + "description": "Simple RFC 6838 media type parser and formatter", + "version": "0.3.0", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "repository": "jshttp/media-typer", + "devDependencies": { + "istanbul": "0.3.2", + "mocha": "~1.21.4", + "should": "~4.0.4" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/merge-descriptors/HISTORY.md b/graphql-subscription-express/node_modules/merge-descriptors/HISTORY.md new file mode 100644 index 0000000..486771f --- /dev/null +++ b/graphql-subscription-express/node_modules/merge-descriptors/HISTORY.md @@ -0,0 +1,21 @@ +1.0.1 / 2016-01-17 +================== + + * perf: enable strict mode + +1.0.0 / 2015-03-01 +================== + + * Add option to only add new descriptors + * Add simple argument validation + * Add jsdoc to source file + +0.0.2 / 2013-12-14 +================== + + * Move repository to `component` organization + +0.0.1 / 2013-10-29 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/merge-descriptors/LICENSE b/graphql-subscription-express/node_modules/merge-descriptors/LICENSE new file mode 100644 index 0000000..274bfd8 --- /dev/null +++ b/graphql-subscription-express/node_modules/merge-descriptors/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2013 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/merge-descriptors/README.md b/graphql-subscription-express/node_modules/merge-descriptors/README.md new file mode 100644 index 0000000..d593c0e --- /dev/null +++ b/graphql-subscription-express/node_modules/merge-descriptors/README.md @@ -0,0 +1,48 @@ +# Merge Descriptors + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Merge objects using descriptors. + +```js +var thing = { + get name() { + return 'jon' + } +} + +var animal = { + +} + +merge(animal, thing) + +animal.name === 'jon' +``` + +## API + +### merge(destination, source) + +Redefines `destination`'s descriptors with `source`'s. + +### merge(destination, source, false) + +Defines `source`'s descriptors on `destination` if `destination` does not have +a descriptor by the same name. + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/merge-descriptors.svg +[npm-url]: https://npmjs.org/package/merge-descriptors +[travis-image]: https://img.shields.io/travis/component/merge-descriptors/master.svg +[travis-url]: https://travis-ci.org/component/merge-descriptors +[coveralls-image]: https://img.shields.io/coveralls/component/merge-descriptors/master.svg +[coveralls-url]: https://coveralls.io/r/component/merge-descriptors?branch=master +[downloads-image]: https://img.shields.io/npm/dm/merge-descriptors.svg +[downloads-url]: https://npmjs.org/package/merge-descriptors diff --git a/graphql-subscription-express/node_modules/merge-descriptors/index.js b/graphql-subscription-express/node_modules/merge-descriptors/index.js new file mode 100644 index 0000000..573b132 --- /dev/null +++ b/graphql-subscription-express/node_modules/merge-descriptors/index.js @@ -0,0 +1,60 @@ +/*! + * merge-descriptors + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = merge + +/** + * Module variables. + * @private + */ + +var hasOwnProperty = Object.prototype.hasOwnProperty + +/** + * Merge the property descriptors of `src` into `dest` + * + * @param {object} dest Object to add descriptors to + * @param {object} src Object to clone descriptors from + * @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties + * @returns {object} Reference to dest + * @public + */ + +function merge(dest, src, redefine) { + if (!dest) { + throw new TypeError('argument dest is required') + } + + if (!src) { + throw new TypeError('argument src is required') + } + + if (redefine === undefined) { + // Default to true + redefine = true + } + + Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) { + if (!redefine && hasOwnProperty.call(dest, name)) { + // Skip desriptor + return + } + + // Copy descriptor + var descriptor = Object.getOwnPropertyDescriptor(src, name) + Object.defineProperty(dest, name, descriptor) + }) + + return dest +} diff --git a/graphql-subscription-express/node_modules/merge-descriptors/package.json b/graphql-subscription-express/node_modules/merge-descriptors/package.json new file mode 100644 index 0000000..514cdbd --- /dev/null +++ b/graphql-subscription-express/node_modules/merge-descriptors/package.json @@ -0,0 +1,32 @@ +{ + "name": "merge-descriptors", + "description": "Merge objects using descriptors", + "version": "1.0.1", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com", + "twitter": "https://twitter.com/jongleberry" + }, + "contributors": [ + "Douglas Christopher Wilson ", + "Mike Grabowski " + ], + "license": "MIT", + "repository": "component/merge-descriptors", + "devDependencies": { + "istanbul": "0.4.1", + "mocha": "1.21.5" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/methods/HISTORY.md b/graphql-subscription-express/node_modules/methods/HISTORY.md new file mode 100644 index 0000000..c0ecf07 --- /dev/null +++ b/graphql-subscription-express/node_modules/methods/HISTORY.md @@ -0,0 +1,29 @@ +1.1.2 / 2016-01-17 +================== + + * perf: enable strict mode + +1.1.1 / 2014-12-30 +================== + + * Improve `browserify` support + +1.1.0 / 2014-07-05 +================== + + * Add `CONNECT` method + +1.0.1 / 2014-06-02 +================== + + * Fix module to work with harmony transform + +1.0.0 / 2014-05-08 +================== + + * Add `PURGE` method + +0.1.0 / 2013-10-28 +================== + + * Add `http.METHODS` support diff --git a/graphql-subscription-express/node_modules/methods/LICENSE b/graphql-subscription-express/node_modules/methods/LICENSE new file mode 100644 index 0000000..220dc1a --- /dev/null +++ b/graphql-subscription-express/node_modules/methods/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2013-2014 TJ Holowaychuk +Copyright (c) 2015-2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/graphql-subscription-express/node_modules/methods/README.md b/graphql-subscription-express/node_modules/methods/README.md new file mode 100644 index 0000000..672a32b --- /dev/null +++ b/graphql-subscription-express/node_modules/methods/README.md @@ -0,0 +1,51 @@ +# Methods + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +HTTP verbs that Node.js core's HTTP parser supports. + +This module provides an export that is just like `http.METHODS` from Node.js core, +with the following differences: + + * All method names are lower-cased. + * Contains a fallback list of methods for Node.js versions that do not have a + `http.METHODS` export (0.10 and lower). + * Provides the fallback list when using tools like `browserify` without pulling + in the `http` shim module. + +## Install + +```bash +$ npm install methods +``` + +## API + +```js +var methods = require('methods') +``` + +### methods + +This is an array of lower-cased method names that Node.js supports. If Node.js +provides the `http.METHODS` export, then this is the same array lower-cased, +otherwise it is a snapshot of the verbs from Node.js 0.10. + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/methods.svg?style=flat +[npm-url]: https://npmjs.org/package/methods +[node-version-image]: https://img.shields.io/node/v/methods.svg?style=flat +[node-version-url]: https://nodejs.org/en/download/ +[travis-image]: https://img.shields.io/travis/jshttp/methods.svg?style=flat +[travis-url]: https://travis-ci.org/jshttp/methods +[coveralls-image]: https://img.shields.io/coveralls/jshttp/methods.svg?style=flat +[coveralls-url]: https://coveralls.io/r/jshttp/methods?branch=master +[downloads-image]: https://img.shields.io/npm/dm/methods.svg?style=flat +[downloads-url]: https://npmjs.org/package/methods diff --git a/graphql-subscription-express/node_modules/methods/index.js b/graphql-subscription-express/node_modules/methods/index.js new file mode 100644 index 0000000..667a50b --- /dev/null +++ b/graphql-subscription-express/node_modules/methods/index.js @@ -0,0 +1,69 @@ +/*! + * methods + * Copyright(c) 2013-2014 TJ Holowaychuk + * Copyright(c) 2015-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module dependencies. + * @private + */ + +var http = require('http'); + +/** + * Module exports. + * @public + */ + +module.exports = getCurrentNodeMethods() || getBasicNodeMethods(); + +/** + * Get the current Node.js methods. + * @private + */ + +function getCurrentNodeMethods() { + return http.METHODS && http.METHODS.map(function lowerCaseMethod(method) { + return method.toLowerCase(); + }); +} + +/** + * Get the "basic" Node.js methods, a snapshot from Node.js 0.10. + * @private + */ + +function getBasicNodeMethods() { + return [ + 'get', + 'post', + 'put', + 'head', + 'delete', + 'options', + 'trace', + 'copy', + 'lock', + 'mkcol', + 'move', + 'purge', + 'propfind', + 'proppatch', + 'unlock', + 'report', + 'mkactivity', + 'checkout', + 'merge', + 'm-search', + 'notify', + 'subscribe', + 'unsubscribe', + 'patch', + 'search', + 'connect' + ]; +} diff --git a/graphql-subscription-express/node_modules/methods/package.json b/graphql-subscription-express/node_modules/methods/package.json new file mode 100644 index 0000000..c4ce6f0 --- /dev/null +++ b/graphql-subscription-express/node_modules/methods/package.json @@ -0,0 +1,36 @@ +{ + "name": "methods", + "description": "HTTP methods that node supports", + "version": "1.1.2", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)", + "TJ Holowaychuk (http://tjholowaychuk.com)" + ], + "license": "MIT", + "repository": "jshttp/methods", + "devDependencies": { + "istanbul": "0.4.1", + "mocha": "1.21.5" + }, + "files": [ + "index.js", + "HISTORY.md", + "LICENSE" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + }, + "browser": { + "http": false + }, + "keywords": [ + "http", + "methods" + ] +} diff --git a/graphql-subscription-express/node_modules/mime-db/HISTORY.md b/graphql-subscription-express/node_modules/mime-db/HISTORY.md new file mode 100644 index 0000000..7436f64 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-db/HISTORY.md @@ -0,0 +1,507 @@ +1.52.0 / 2022-02-21 +=================== + + * Add extensions from IANA for more `image/*` types + * Add extension `.asc` to `application/pgp-keys` + * Add extensions to various XML types + * Add new upstream MIME types + +1.51.0 / 2021-11-08 +=================== + + * Add new upstream MIME types + * Mark `image/vnd.microsoft.icon` as compressible + * Mark `image/vnd.ms-dds` as compressible + +1.50.0 / 2021-09-15 +=================== + + * Add deprecated iWorks mime types and extensions + * Add new upstream MIME types + +1.49.0 / 2021-07-26 +=================== + + * Add extension `.trig` to `application/trig` + * Add new upstream MIME types + +1.48.0 / 2021-05-30 +=================== + + * Add extension `.mvt` to `application/vnd.mapbox-vector-tile` + * Add new upstream MIME types + * Mark `text/yaml` as compressible + +1.47.0 / 2021-04-01 +=================== + + * Add new upstream MIME types + * Remove ambigious extensions from IANA for `application/*+xml` types + * Update primary extension to `.es` for `application/ecmascript` + +1.46.0 / 2021-02-13 +=================== + + * Add extension `.amr` to `audio/amr` + * Add extension `.m4s` to `video/iso.segment` + * Add extension `.opus` to `audio/ogg` + * Add new upstream MIME types + +1.45.0 / 2020-09-22 +=================== + + * Add `application/ubjson` with extension `.ubj` + * Add `image/avif` with extension `.avif` + * Add `image/ktx2` with extension `.ktx2` + * Add extension `.dbf` to `application/vnd.dbf` + * Add extension `.rar` to `application/vnd.rar` + * Add extension `.td` to `application/urc-targetdesc+xml` + * Add new upstream MIME types + * Fix extension of `application/vnd.apple.keynote` to be `.key` + +1.44.0 / 2020-04-22 +=================== + + * Add charsets from IANA + * Add extension `.cjs` to `application/node` + * Add new upstream MIME types + +1.43.0 / 2020-01-05 +=================== + + * Add `application/x-keepass2` with extension `.kdbx` + * Add extension `.mxmf` to `audio/mobile-xmf` + * Add extensions from IANA for `application/*+xml` types + * Add new upstream MIME types + +1.42.0 / 2019-09-25 +=================== + + * Add `image/vnd.ms-dds` with extension `.dds` + * Add new upstream MIME types + * Remove compressible from `multipart/mixed` + +1.41.0 / 2019-08-30 +=================== + + * Add new upstream MIME types + * Add `application/toml` with extension `.toml` + * Mark `font/ttf` as compressible + +1.40.0 / 2019-04-20 +=================== + + * Add extensions from IANA for `model/*` types + * Add `text/mdx` with extension `.mdx` + +1.39.0 / 2019-04-04 +=================== + + * Add extensions `.siv` and `.sieve` to `application/sieve` + * Add new upstream MIME types + +1.38.0 / 2019-02-04 +=================== + + * Add extension `.nq` to `application/n-quads` + * Add extension `.nt` to `application/n-triples` + * Add new upstream MIME types + * Mark `text/less` as compressible + +1.37.0 / 2018-10-19 +=================== + + * Add extensions to HEIC image types + * Add new upstream MIME types + +1.36.0 / 2018-08-20 +=================== + + * Add Apple file extensions from IANA + * Add extensions from IANA for `image/*` types + * Add new upstream MIME types + +1.35.0 / 2018-07-15 +=================== + + * Add extension `.owl` to `application/rdf+xml` + * Add new upstream MIME types + - Removes extension `.woff` from `application/font-woff` + +1.34.0 / 2018-06-03 +=================== + + * Add extension `.csl` to `application/vnd.citationstyles.style+xml` + * Add extension `.es` to `application/ecmascript` + * Add new upstream MIME types + * Add `UTF-8` as default charset for `text/turtle` + * Mark all XML-derived types as compressible + +1.33.0 / 2018-02-15 +=================== + + * Add extensions from IANA for `message/*` types + * Add new upstream MIME types + * Fix some incorrect OOXML types + * Remove `application/font-woff2` + +1.32.0 / 2017-11-29 +=================== + + * Add new upstream MIME types + * Update `text/hjson` to registered `application/hjson` + * Add `text/shex` with extension `.shex` + +1.31.0 / 2017-10-25 +=================== + + * Add `application/raml+yaml` with extension `.raml` + * Add `application/wasm` with extension `.wasm` + * Add new `font` type from IANA + * Add new upstream font extensions + * Add new upstream MIME types + * Add extensions for JPEG-2000 images + +1.30.0 / 2017-08-27 +=================== + + * Add `application/vnd.ms-outlook` + * Add `application/x-arj` + * Add extension `.mjs` to `application/javascript` + * Add glTF types and extensions + * Add new upstream MIME types + * Add `text/x-org` + * Add VirtualBox MIME types + * Fix `source` records for `video/*` types that are IANA + * Update `font/opentype` to registered `font/otf` + +1.29.0 / 2017-07-10 +=================== + + * Add `application/fido.trusted-apps+json` + * Add extension `.wadl` to `application/vnd.sun.wadl+xml` + * Add new upstream MIME types + * Add `UTF-8` as default charset for `text/css` + +1.28.0 / 2017-05-14 +=================== + + * Add new upstream MIME types + * Add extension `.gz` to `application/gzip` + * Update extensions `.md` and `.markdown` to be `text/markdown` + +1.27.0 / 2017-03-16 +=================== + + * Add new upstream MIME types + * Add `image/apng` with extension `.apng` + +1.26.0 / 2017-01-14 +=================== + + * Add new upstream MIME types + * Add extension `.geojson` to `application/geo+json` + +1.25.0 / 2016-11-11 +=================== + + * Add new upstream MIME types + +1.24.0 / 2016-09-18 +=================== + + * Add `audio/mp3` + * Add new upstream MIME types + +1.23.0 / 2016-05-01 +=================== + + * Add new upstream MIME types + * Add extension `.3gpp` to `audio/3gpp` + +1.22.0 / 2016-02-15 +=================== + + * Add `text/slim` + * Add extension `.rng` to `application/xml` + * Add new upstream MIME types + * Fix extension of `application/dash+xml` to be `.mpd` + * Update primary extension to `.m4a` for `audio/mp4` + +1.21.0 / 2016-01-06 +=================== + + * Add Google document types + * Add new upstream MIME types + +1.20.0 / 2015-11-10 +=================== + + * Add `text/x-suse-ymp` + * Add new upstream MIME types + +1.19.0 / 2015-09-17 +=================== + + * Add `application/vnd.apple.pkpass` + * Add new upstream MIME types + +1.18.0 / 2015-09-03 +=================== + + * Add new upstream MIME types + +1.17.0 / 2015-08-13 +=================== + + * Add `application/x-msdos-program` + * Add `audio/g711-0` + * Add `image/vnd.mozilla.apng` + * Add extension `.exe` to `application/x-msdos-program` + +1.16.0 / 2015-07-29 +=================== + + * Add `application/vnd.uri-map` + +1.15.0 / 2015-07-13 +=================== + + * Add `application/x-httpd-php` + +1.14.0 / 2015-06-25 +=================== + + * Add `application/scim+json` + * Add `application/vnd.3gpp.ussd+xml` + * Add `application/vnd.biopax.rdf+xml` + * Add `text/x-processing` + +1.13.0 / 2015-06-07 +=================== + + * Add nginx as a source + * Add `application/x-cocoa` + * Add `application/x-java-archive-diff` + * Add `application/x-makeself` + * Add `application/x-perl` + * Add `application/x-pilot` + * Add `application/x-redhat-package-manager` + * Add `application/x-sea` + * Add `audio/x-m4a` + * Add `audio/x-realaudio` + * Add `image/x-jng` + * Add `text/mathml` + +1.12.0 / 2015-06-05 +=================== + + * Add `application/bdoc` + * Add `application/vnd.hyperdrive+json` + * Add `application/x-bdoc` + * Add extension `.rtf` to `text/rtf` + +1.11.0 / 2015-05-31 +=================== + + * Add `audio/wav` + * Add `audio/wave` + * Add extension `.litcoffee` to `text/coffeescript` + * Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data` + * Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install` + +1.10.0 / 2015-05-19 +=================== + + * Add `application/vnd.balsamiq.bmpr` + * Add `application/vnd.microsoft.portable-executable` + * Add `application/x-ns-proxy-autoconfig` + +1.9.1 / 2015-04-19 +================== + + * Remove `.json` extension from `application/manifest+json` + - This is causing bugs downstream + +1.9.0 / 2015-04-19 +================== + + * Add `application/manifest+json` + * Add `application/vnd.micro+json` + * Add `image/vnd.zbrush.pcx` + * Add `image/x-ms-bmp` + +1.8.0 / 2015-03-13 +================== + + * Add `application/vnd.citationstyles.style+xml` + * Add `application/vnd.fastcopy-disk-image` + * Add `application/vnd.gov.sk.xmldatacontainer+xml` + * Add extension `.jsonld` to `application/ld+json` + +1.7.0 / 2015-02-08 +================== + + * Add `application/vnd.gerber` + * Add `application/vnd.msa-disk-image` + +1.6.1 / 2015-02-05 +================== + + * Community extensions ownership transferred from `node-mime` + +1.6.0 / 2015-01-29 +================== + + * Add `application/jose` + * Add `application/jose+json` + * Add `application/json-seq` + * Add `application/jwk+json` + * Add `application/jwk-set+json` + * Add `application/jwt` + * Add `application/rdap+json` + * Add `application/vnd.gov.sk.e-form+xml` + * Add `application/vnd.ims.imsccv1p3` + +1.5.0 / 2014-12-30 +================== + + * Add `application/vnd.oracle.resource+json` + * Fix various invalid MIME type entries + - `application/mbox+xml` + - `application/oscp-response` + - `application/vwg-multiplexed` + - `audio/g721` + +1.4.0 / 2014-12-21 +================== + + * Add `application/vnd.ims.imsccv1p2` + * Fix various invalid MIME type entries + - `application/vnd-acucobol` + - `application/vnd-curl` + - `application/vnd-dart` + - `application/vnd-dxr` + - `application/vnd-fdf` + - `application/vnd-mif` + - `application/vnd-sema` + - `application/vnd-wap-wmlc` + - `application/vnd.adobe.flash-movie` + - `application/vnd.dece-zip` + - `application/vnd.dvb_service` + - `application/vnd.micrografx-igx` + - `application/vnd.sealed-doc` + - `application/vnd.sealed-eml` + - `application/vnd.sealed-mht` + - `application/vnd.sealed-ppt` + - `application/vnd.sealed-tiff` + - `application/vnd.sealed-xls` + - `application/vnd.sealedmedia.softseal-html` + - `application/vnd.sealedmedia.softseal-pdf` + - `application/vnd.wap-slc` + - `application/vnd.wap-wbxml` + - `audio/vnd.sealedmedia.softseal-mpeg` + - `image/vnd-djvu` + - `image/vnd-svf` + - `image/vnd-wap-wbmp` + - `image/vnd.sealed-png` + - `image/vnd.sealedmedia.softseal-gif` + - `image/vnd.sealedmedia.softseal-jpg` + - `model/vnd-dwf` + - `model/vnd.parasolid.transmit-binary` + - `model/vnd.parasolid.transmit-text` + - `text/vnd-a` + - `text/vnd-curl` + - `text/vnd.wap-wml` + * Remove example template MIME types + - `application/example` + - `audio/example` + - `image/example` + - `message/example` + - `model/example` + - `multipart/example` + - `text/example` + - `video/example` + +1.3.1 / 2014-12-16 +================== + + * Fix missing extensions + - `application/json5` + - `text/hjson` + +1.3.0 / 2014-12-07 +================== + + * Add `application/a2l` + * Add `application/aml` + * Add `application/atfx` + * Add `application/atxml` + * Add `application/cdfx+xml` + * Add `application/dii` + * Add `application/json5` + * Add `application/lxf` + * Add `application/mf4` + * Add `application/vnd.apache.thrift.compact` + * Add `application/vnd.apache.thrift.json` + * Add `application/vnd.coffeescript` + * Add `application/vnd.enphase.envoy` + * Add `application/vnd.ims.imsccv1p1` + * Add `text/csv-schema` + * Add `text/hjson` + * Add `text/markdown` + * Add `text/yaml` + +1.2.0 / 2014-11-09 +================== + + * Add `application/cea` + * Add `application/dit` + * Add `application/vnd.gov.sk.e-form+zip` + * Add `application/vnd.tmd.mediaflex.api+xml` + * Type `application/epub+zip` is now IANA-registered + +1.1.2 / 2014-10-23 +================== + + * Rebuild database for `application/x-www-form-urlencoded` change + +1.1.1 / 2014-10-20 +================== + + * Mark `application/x-www-form-urlencoded` as compressible. + +1.1.0 / 2014-09-28 +================== + + * Add `application/font-woff2` + +1.0.3 / 2014-09-25 +================== + + * Fix engine requirement in package + +1.0.2 / 2014-09-25 +================== + + * Add `application/coap-group+json` + * Add `application/dcd` + * Add `application/vnd.apache.thrift.binary` + * Add `image/vnd.tencent.tap` + * Mark all JSON-derived types as compressible + * Update `text/vtt` data + +1.0.1 / 2014-08-30 +================== + + * Fix extension ordering + +1.0.0 / 2014-08-30 +================== + + * Add `application/atf` + * Add `application/merge-patch+json` + * Add `multipart/x-mixed-replace` + * Add `source: 'apache'` metadata + * Add `source: 'iana'` metadata + * Remove badly-assumed charset data diff --git a/graphql-subscription-express/node_modules/mime-db/LICENSE b/graphql-subscription-express/node_modules/mime-db/LICENSE new file mode 100644 index 0000000..0751cb1 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-db/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015-2022 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/mime-db/README.md b/graphql-subscription-express/node_modules/mime-db/README.md new file mode 100644 index 0000000..5a8fcfe --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-db/README.md @@ -0,0 +1,100 @@ +# mime-db + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +This is a large database of mime types and information about them. +It consists of a single, public JSON file and does not include any logic, +allowing it to remain as un-opinionated as possible with an API. +It aggregates data from the following sources: + +- http://www.iana.org/assignments/media-types/media-types.xhtml +- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types +- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types + +## Installation + +```bash +npm install mime-db +``` + +### Database Download + +If you're crazy enough to use this in the browser, you can just grab the +JSON file using [jsDelivr](https://www.jsdelivr.com/). It is recommended to +replace `master` with [a release tag](https://github.com/jshttp/mime-db/tags) +as the JSON format may change in the future. + +``` +https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json +``` + +## Usage + +```js +var db = require('mime-db') + +// grab data on .js files +var data = db['application/javascript'] +``` + +## Data Structure + +The JSON file is a map lookup for lowercased mime types. +Each mime type has the following properties: + +- `.source` - where the mime type is defined. + If not set, it's probably a custom media type. + - `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) + - `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml) + - `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types) +- `.extensions[]` - known extensions associated with this mime type. +- `.compressible` - whether a file of this type can be gzipped. +- `.charset` - the default charset associated with this type, if any. + +If unknown, every property could be `undefined`. + +## Contributing + +To edit the database, only make PRs against `src/custom-types.json` or +`src/custom-suffix.json`. + +The `src/custom-types.json` file is a JSON object with the MIME type as the +keys and the values being an object with the following keys: + +- `compressible` - leave out if you don't know, otherwise `true`/`false` to + indicate whether the data represented by the type is typically compressible. +- `extensions` - include an array of file extensions that are associated with + the type. +- `notes` - human-readable notes about the type, typically what the type is. +- `sources` - include an array of URLs of where the MIME type and the associated + extensions are sourced from. This needs to be a [primary source](https://en.wikipedia.org/wiki/Primary_source); + links to type aggregating sites and Wikipedia are _not acceptable_. + +To update the build, run `npm run build`. + +### Adding Custom Media Types + +The best way to get new media types included in this library is to register +them with the IANA. The community registration procedure is outlined in +[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types +registered with the IANA are automatically pulled into this library. + +If that is not possible / feasible, they can be added directly here as a +"custom" type. To do this, it is required to have a primary source that +definitively lists the media type. If an extension is going to be listed as +associateed with this media type, the source must definitively link the +media type and extension as well. + +[ci-image]: https://badgen.net/github/checks/jshttp/mime-db/master?label=ci +[ci-url]: https://github.com/jshttp/mime-db/actions?query=workflow%3Aci +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-db/master +[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master +[node-image]: https://badgen.net/npm/node/mime-db +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/mime-db +[npm-url]: https://npmjs.org/package/mime-db +[npm-version-image]: https://badgen.net/npm/v/mime-db diff --git a/graphql-subscription-express/node_modules/mime-db/db.json b/graphql-subscription-express/node_modules/mime-db/db.json new file mode 100644 index 0000000..eb9c42c --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-db/db.json @@ -0,0 +1,8519 @@ +{ + "application/1d-interleaved-parityfec": { + "source": "iana" + }, + "application/3gpdash-qoe-report+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/3gpp-ims+xml": { + "source": "iana", + "compressible": true + }, + "application/3gpphal+json": { + "source": "iana", + "compressible": true + }, + "application/3gpphalforms+json": { + "source": "iana", + "compressible": true + }, + "application/a2l": { + "source": "iana" + }, + "application/ace+cbor": { + "source": "iana" + }, + "application/activemessage": { + "source": "iana" + }, + "application/activity+json": { + "source": "iana", + "compressible": true + }, + "application/alto-costmap+json": { + "source": "iana", + "compressible": true + }, + "application/alto-costmapfilter+json": { + "source": "iana", + "compressible": true + }, + "application/alto-directory+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointcost+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointcostparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointprop+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointpropparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-error+json": { + "source": "iana", + "compressible": true + }, + "application/alto-networkmap+json": { + "source": "iana", + "compressible": true + }, + "application/alto-networkmapfilter+json": { + "source": "iana", + "compressible": true + }, + "application/alto-updatestreamcontrol+json": { + "source": "iana", + "compressible": true + }, + "application/alto-updatestreamparams+json": { + "source": "iana", + "compressible": true + }, + "application/aml": { + "source": "iana" + }, + "application/andrew-inset": { + "source": "iana", + "extensions": ["ez"] + }, + "application/applefile": { + "source": "iana" + }, + "application/applixware": { + "source": "apache", + "extensions": ["aw"] + }, + "application/at+jwt": { + "source": "iana" + }, + "application/atf": { + "source": "iana" + }, + "application/atfx": { + "source": "iana" + }, + "application/atom+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atom"] + }, + "application/atomcat+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atomcat"] + }, + "application/atomdeleted+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atomdeleted"] + }, + "application/atomicmail": { + "source": "iana" + }, + "application/atomsvc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atomsvc"] + }, + "application/atsc-dwd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["dwd"] + }, + "application/atsc-dynamic-event-message": { + "source": "iana" + }, + "application/atsc-held+xml": { + "source": "iana", + "compressible": true, + "extensions": ["held"] + }, + "application/atsc-rdt+json": { + "source": "iana", + "compressible": true + }, + "application/atsc-rsat+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rsat"] + }, + "application/atxml": { + "source": "iana" + }, + "application/auth-policy+xml": { + "source": "iana", + "compressible": true + }, + "application/bacnet-xdd+zip": { + "source": "iana", + "compressible": false + }, + "application/batch-smtp": { + "source": "iana" + }, + "application/bdoc": { + "compressible": false, + "extensions": ["bdoc"] + }, + "application/beep+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/calendar+json": { + "source": "iana", + "compressible": true + }, + "application/calendar+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xcs"] + }, + "application/call-completion": { + "source": "iana" + }, + "application/cals-1840": { + "source": "iana" + }, + "application/captive+json": { + "source": "iana", + "compressible": true + }, + "application/cbor": { + "source": "iana" + }, + "application/cbor-seq": { + "source": "iana" + }, + "application/cccex": { + "source": "iana" + }, + "application/ccmp+xml": { + "source": "iana", + "compressible": true + }, + "application/ccxml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ccxml"] + }, + "application/cdfx+xml": { + "source": "iana", + "compressible": true, + "extensions": ["cdfx"] + }, + "application/cdmi-capability": { + "source": "iana", + "extensions": ["cdmia"] + }, + "application/cdmi-container": { + "source": "iana", + "extensions": ["cdmic"] + }, + "application/cdmi-domain": { + "source": "iana", + "extensions": ["cdmid"] + }, + "application/cdmi-object": { + "source": "iana", + "extensions": ["cdmio"] + }, + "application/cdmi-queue": { + "source": "iana", + "extensions": ["cdmiq"] + }, + "application/cdni": { + "source": "iana" + }, + "application/cea": { + "source": "iana" + }, + "application/cea-2018+xml": { + "source": "iana", + "compressible": true + }, + "application/cellml+xml": { + "source": "iana", + "compressible": true + }, + "application/cfw": { + "source": "iana" + }, + "application/city+json": { + "source": "iana", + "compressible": true + }, + "application/clr": { + "source": "iana" + }, + "application/clue+xml": { + "source": "iana", + "compressible": true + }, + "application/clue_info+xml": { + "source": "iana", + "compressible": true + }, + "application/cms": { + "source": "iana" + }, + "application/cnrp+xml": { + "source": "iana", + "compressible": true + }, + "application/coap-group+json": { + "source": "iana", + "compressible": true + }, + "application/coap-payload": { + "source": "iana" + }, + "application/commonground": { + "source": "iana" + }, + "application/conference-info+xml": { + "source": "iana", + "compressible": true + }, + "application/cose": { + "source": "iana" + }, + "application/cose-key": { + "source": "iana" + }, + "application/cose-key-set": { + "source": "iana" + }, + "application/cpl+xml": { + "source": "iana", + "compressible": true, + "extensions": ["cpl"] + }, + "application/csrattrs": { + "source": "iana" + }, + "application/csta+xml": { + "source": "iana", + "compressible": true + }, + "application/cstadata+xml": { + "source": "iana", + "compressible": true + }, + "application/csvm+json": { + "source": "iana", + "compressible": true + }, + "application/cu-seeme": { + "source": "apache", + "extensions": ["cu"] + }, + "application/cwt": { + "source": "iana" + }, + "application/cybercash": { + "source": "iana" + }, + "application/dart": { + "compressible": true + }, + "application/dash+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpd"] + }, + "application/dash-patch+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpp"] + }, + "application/dashdelta": { + "source": "iana" + }, + "application/davmount+xml": { + "source": "iana", + "compressible": true, + "extensions": ["davmount"] + }, + "application/dca-rft": { + "source": "iana" + }, + "application/dcd": { + "source": "iana" + }, + "application/dec-dx": { + "source": "iana" + }, + "application/dialog-info+xml": { + "source": "iana", + "compressible": true + }, + "application/dicom": { + "source": "iana" + }, + "application/dicom+json": { + "source": "iana", + "compressible": true + }, + "application/dicom+xml": { + "source": "iana", + "compressible": true + }, + "application/dii": { + "source": "iana" + }, + "application/dit": { + "source": "iana" + }, + "application/dns": { + "source": "iana" + }, + "application/dns+json": { + "source": "iana", + "compressible": true + }, + "application/dns-message": { + "source": "iana" + }, + "application/docbook+xml": { + "source": "apache", + "compressible": true, + "extensions": ["dbk"] + }, + "application/dots+cbor": { + "source": "iana" + }, + "application/dskpp+xml": { + "source": "iana", + "compressible": true + }, + "application/dssc+der": { + "source": "iana", + "extensions": ["dssc"] + }, + "application/dssc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xdssc"] + }, + "application/dvcs": { + "source": "iana" + }, + "application/ecmascript": { + "source": "iana", + "compressible": true, + "extensions": ["es","ecma"] + }, + "application/edi-consent": { + "source": "iana" + }, + "application/edi-x12": { + "source": "iana", + "compressible": false + }, + "application/edifact": { + "source": "iana", + "compressible": false + }, + "application/efi": { + "source": "iana" + }, + "application/elm+json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/elm+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.cap+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/emergencycalldata.comment+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.control+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.deviceinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.ecall.msd": { + "source": "iana" + }, + "application/emergencycalldata.providerinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.serviceinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.subscriberinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.veds+xml": { + "source": "iana", + "compressible": true + }, + "application/emma+xml": { + "source": "iana", + "compressible": true, + "extensions": ["emma"] + }, + "application/emotionml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["emotionml"] + }, + "application/encaprtp": { + "source": "iana" + }, + "application/epp+xml": { + "source": "iana", + "compressible": true + }, + "application/epub+zip": { + "source": "iana", + "compressible": false, + "extensions": ["epub"] + }, + "application/eshop": { + "source": "iana" + }, + "application/exi": { + "source": "iana", + "extensions": ["exi"] + }, + "application/expect-ct-report+json": { + "source": "iana", + "compressible": true + }, + "application/express": { + "source": "iana", + "extensions": ["exp"] + }, + "application/fastinfoset": { + "source": "iana" + }, + "application/fastsoap": { + "source": "iana" + }, + "application/fdt+xml": { + "source": "iana", + "compressible": true, + "extensions": ["fdt"] + }, + "application/fhir+json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/fhir+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/fido.trusted-apps+json": { + "compressible": true + }, + "application/fits": { + "source": "iana" + }, + "application/flexfec": { + "source": "iana" + }, + "application/font-sfnt": { + "source": "iana" + }, + "application/font-tdpfr": { + "source": "iana", + "extensions": ["pfr"] + }, + "application/font-woff": { + "source": "iana", + "compressible": false + }, + "application/framework-attributes+xml": { + "source": "iana", + "compressible": true + }, + "application/geo+json": { + "source": "iana", + "compressible": true, + "extensions": ["geojson"] + }, + "application/geo+json-seq": { + "source": "iana" + }, + "application/geopackage+sqlite3": { + "source": "iana" + }, + "application/geoxacml+xml": { + "source": "iana", + "compressible": true + }, + "application/gltf-buffer": { + "source": "iana" + }, + "application/gml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["gml"] + }, + "application/gpx+xml": { + "source": "apache", + "compressible": true, + "extensions": ["gpx"] + }, + "application/gxf": { + "source": "apache", + "extensions": ["gxf"] + }, + "application/gzip": { + "source": "iana", + "compressible": false, + "extensions": ["gz"] + }, + "application/h224": { + "source": "iana" + }, + "application/held+xml": { + "source": "iana", + "compressible": true + }, + "application/hjson": { + "extensions": ["hjson"] + }, + "application/http": { + "source": "iana" + }, + "application/hyperstudio": { + "source": "iana", + "extensions": ["stk"] + }, + "application/ibe-key-request+xml": { + "source": "iana", + "compressible": true + }, + "application/ibe-pkg-reply+xml": { + "source": "iana", + "compressible": true + }, + "application/ibe-pp-data": { + "source": "iana" + }, + "application/iges": { + "source": "iana" + }, + "application/im-iscomposing+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/index": { + "source": "iana" + }, + "application/index.cmd": { + "source": "iana" + }, + "application/index.obj": { + "source": "iana" + }, + "application/index.response": { + "source": "iana" + }, + "application/index.vnd": { + "source": "iana" + }, + "application/inkml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ink","inkml"] + }, + "application/iotp": { + "source": "iana" + }, + "application/ipfix": { + "source": "iana", + "extensions": ["ipfix"] + }, + "application/ipp": { + "source": "iana" + }, + "application/isup": { + "source": "iana" + }, + "application/its+xml": { + "source": "iana", + "compressible": true, + "extensions": ["its"] + }, + "application/java-archive": { + "source": "apache", + "compressible": false, + "extensions": ["jar","war","ear"] + }, + "application/java-serialized-object": { + "source": "apache", + "compressible": false, + "extensions": ["ser"] + }, + "application/java-vm": { + "source": "apache", + "compressible": false, + "extensions": ["class"] + }, + "application/javascript": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["js","mjs"] + }, + "application/jf2feed+json": { + "source": "iana", + "compressible": true + }, + "application/jose": { + "source": "iana" + }, + "application/jose+json": { + "source": "iana", + "compressible": true + }, + "application/jrd+json": { + "source": "iana", + "compressible": true + }, + "application/jscalendar+json": { + "source": "iana", + "compressible": true + }, + "application/json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["json","map"] + }, + "application/json-patch+json": { + "source": "iana", + "compressible": true + }, + "application/json-seq": { + "source": "iana" + }, + "application/json5": { + "extensions": ["json5"] + }, + "application/jsonml+json": { + "source": "apache", + "compressible": true, + "extensions": ["jsonml"] + }, + "application/jwk+json": { + "source": "iana", + "compressible": true + }, + "application/jwk-set+json": { + "source": "iana", + "compressible": true + }, + "application/jwt": { + "source": "iana" + }, + "application/kpml-request+xml": { + "source": "iana", + "compressible": true + }, + "application/kpml-response+xml": { + "source": "iana", + "compressible": true + }, + "application/ld+json": { + "source": "iana", + "compressible": true, + "extensions": ["jsonld"] + }, + "application/lgr+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lgr"] + }, + "application/link-format": { + "source": "iana" + }, + "application/load-control+xml": { + "source": "iana", + "compressible": true + }, + "application/lost+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lostxml"] + }, + "application/lostsync+xml": { + "source": "iana", + "compressible": true + }, + "application/lpf+zip": { + "source": "iana", + "compressible": false + }, + "application/lxf": { + "source": "iana" + }, + "application/mac-binhex40": { + "source": "iana", + "extensions": ["hqx"] + }, + "application/mac-compactpro": { + "source": "apache", + "extensions": ["cpt"] + }, + "application/macwriteii": { + "source": "iana" + }, + "application/mads+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mads"] + }, + "application/manifest+json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["webmanifest"] + }, + "application/marc": { + "source": "iana", + "extensions": ["mrc"] + }, + "application/marcxml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mrcx"] + }, + "application/mathematica": { + "source": "iana", + "extensions": ["ma","nb","mb"] + }, + "application/mathml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mathml"] + }, + "application/mathml-content+xml": { + "source": "iana", + "compressible": true + }, + "application/mathml-presentation+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-associated-procedure-description+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-deregister+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-envelope+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-msk+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-msk-response+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-protection-description+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-reception-report+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-register+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-register-response+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-schedule+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-user-service-description+xml": { + "source": "iana", + "compressible": true + }, + "application/mbox": { + "source": "iana", + "extensions": ["mbox"] + }, + "application/media-policy-dataset+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpf"] + }, + "application/media_control+xml": { + "source": "iana", + "compressible": true + }, + "application/mediaservercontrol+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mscml"] + }, + "application/merge-patch+json": { + "source": "iana", + "compressible": true + }, + "application/metalink+xml": { + "source": "apache", + "compressible": true, + "extensions": ["metalink"] + }, + "application/metalink4+xml": { + "source": "iana", + "compressible": true, + "extensions": ["meta4"] + }, + "application/mets+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mets"] + }, + "application/mf4": { + "source": "iana" + }, + "application/mikey": { + "source": "iana" + }, + "application/mipc": { + "source": "iana" + }, + "application/missing-blocks+cbor-seq": { + "source": "iana" + }, + "application/mmt-aei+xml": { + "source": "iana", + "compressible": true, + "extensions": ["maei"] + }, + "application/mmt-usd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["musd"] + }, + "application/mods+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mods"] + }, + "application/moss-keys": { + "source": "iana" + }, + "application/moss-signature": { + "source": "iana" + }, + "application/mosskey-data": { + "source": "iana" + }, + "application/mosskey-request": { + "source": "iana" + }, + "application/mp21": { + "source": "iana", + "extensions": ["m21","mp21"] + }, + "application/mp4": { + "source": "iana", + "extensions": ["mp4s","m4p"] + }, + "application/mpeg4-generic": { + "source": "iana" + }, + "application/mpeg4-iod": { + "source": "iana" + }, + "application/mpeg4-iod-xmt": { + "source": "iana" + }, + "application/mrb-consumer+xml": { + "source": "iana", + "compressible": true + }, + "application/mrb-publish+xml": { + "source": "iana", + "compressible": true + }, + "application/msc-ivr+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/msc-mixer+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/msword": { + "source": "iana", + "compressible": false, + "extensions": ["doc","dot"] + }, + "application/mud+json": { + "source": "iana", + "compressible": true + }, + "application/multipart-core": { + "source": "iana" + }, + "application/mxf": { + "source": "iana", + "extensions": ["mxf"] + }, + "application/n-quads": { + "source": "iana", + "extensions": ["nq"] + }, + "application/n-triples": { + "source": "iana", + "extensions": ["nt"] + }, + "application/nasdata": { + "source": "iana" + }, + "application/news-checkgroups": { + "source": "iana", + "charset": "US-ASCII" + }, + "application/news-groupinfo": { + "source": "iana", + "charset": "US-ASCII" + }, + "application/news-transmission": { + "source": "iana" + }, + "application/nlsml+xml": { + "source": "iana", + "compressible": true + }, + "application/node": { + "source": "iana", + "extensions": ["cjs"] + }, + "application/nss": { + "source": "iana" + }, + "application/oauth-authz-req+jwt": { + "source": "iana" + }, + "application/oblivious-dns-message": { + "source": "iana" + }, + "application/ocsp-request": { + "source": "iana" + }, + "application/ocsp-response": { + "source": "iana" + }, + "application/octet-stream": { + "source": "iana", + "compressible": false, + "extensions": ["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"] + }, + "application/oda": { + "source": "iana", + "extensions": ["oda"] + }, + "application/odm+xml": { + "source": "iana", + "compressible": true + }, + "application/odx": { + "source": "iana" + }, + "application/oebps-package+xml": { + "source": "iana", + "compressible": true, + "extensions": ["opf"] + }, + "application/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["ogx"] + }, + "application/omdoc+xml": { + "source": "apache", + "compressible": true, + "extensions": ["omdoc"] + }, + "application/onenote": { + "source": "apache", + "extensions": ["onetoc","onetoc2","onetmp","onepkg"] + }, + "application/opc-nodeset+xml": { + "source": "iana", + "compressible": true + }, + "application/oscore": { + "source": "iana" + }, + "application/oxps": { + "source": "iana", + "extensions": ["oxps"] + }, + "application/p21": { + "source": "iana" + }, + "application/p21+zip": { + "source": "iana", + "compressible": false + }, + "application/p2p-overlay+xml": { + "source": "iana", + "compressible": true, + "extensions": ["relo"] + }, + "application/parityfec": { + "source": "iana" + }, + "application/passport": { + "source": "iana" + }, + "application/patch-ops-error+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xer"] + }, + "application/pdf": { + "source": "iana", + "compressible": false, + "extensions": ["pdf"] + }, + "application/pdx": { + "source": "iana" + }, + "application/pem-certificate-chain": { + "source": "iana" + }, + "application/pgp-encrypted": { + "source": "iana", + "compressible": false, + "extensions": ["pgp"] + }, + "application/pgp-keys": { + "source": "iana", + "extensions": ["asc"] + }, + "application/pgp-signature": { + "source": "iana", + "extensions": ["asc","sig"] + }, + "application/pics-rules": { + "source": "apache", + "extensions": ["prf"] + }, + "application/pidf+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/pidf-diff+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/pkcs10": { + "source": "iana", + "extensions": ["p10"] + }, + "application/pkcs12": { + "source": "iana" + }, + "application/pkcs7-mime": { + "source": "iana", + "extensions": ["p7m","p7c"] + }, + "application/pkcs7-signature": { + "source": "iana", + "extensions": ["p7s"] + }, + "application/pkcs8": { + "source": "iana", + "extensions": ["p8"] + }, + "application/pkcs8-encrypted": { + "source": "iana" + }, + "application/pkix-attr-cert": { + "source": "iana", + "extensions": ["ac"] + }, + "application/pkix-cert": { + "source": "iana", + "extensions": ["cer"] + }, + "application/pkix-crl": { + "source": "iana", + "extensions": ["crl"] + }, + "application/pkix-pkipath": { + "source": "iana", + "extensions": ["pkipath"] + }, + "application/pkixcmp": { + "source": "iana", + "extensions": ["pki"] + }, + "application/pls+xml": { + "source": "iana", + "compressible": true, + "extensions": ["pls"] + }, + "application/poc-settings+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/postscript": { + "source": "iana", + "compressible": true, + "extensions": ["ai","eps","ps"] + }, + "application/ppsp-tracker+json": { + "source": "iana", + "compressible": true + }, + "application/problem+json": { + "source": "iana", + "compressible": true + }, + "application/problem+xml": { + "source": "iana", + "compressible": true + }, + "application/provenance+xml": { + "source": "iana", + "compressible": true, + "extensions": ["provx"] + }, + "application/prs.alvestrand.titrax-sheet": { + "source": "iana" + }, + "application/prs.cww": { + "source": "iana", + "extensions": ["cww"] + }, + "application/prs.cyn": { + "source": "iana", + "charset": "7-BIT" + }, + "application/prs.hpub+zip": { + "source": "iana", + "compressible": false + }, + "application/prs.nprend": { + "source": "iana" + }, + "application/prs.plucker": { + "source": "iana" + }, + "application/prs.rdf-xml-crypt": { + "source": "iana" + }, + "application/prs.xsf+xml": { + "source": "iana", + "compressible": true + }, + "application/pskc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["pskcxml"] + }, + "application/pvd+json": { + "source": "iana", + "compressible": true + }, + "application/qsig": { + "source": "iana" + }, + "application/raml+yaml": { + "compressible": true, + "extensions": ["raml"] + }, + "application/raptorfec": { + "source": "iana" + }, + "application/rdap+json": { + "source": "iana", + "compressible": true + }, + "application/rdf+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rdf","owl"] + }, + "application/reginfo+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rif"] + }, + "application/relax-ng-compact-syntax": { + "source": "iana", + "extensions": ["rnc"] + }, + "application/remote-printing": { + "source": "iana" + }, + "application/reputon+json": { + "source": "iana", + "compressible": true + }, + "application/resource-lists+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rl"] + }, + "application/resource-lists-diff+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rld"] + }, + "application/rfc+xml": { + "source": "iana", + "compressible": true + }, + "application/riscos": { + "source": "iana" + }, + "application/rlmi+xml": { + "source": "iana", + "compressible": true + }, + "application/rls-services+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rs"] + }, + "application/route-apd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rapd"] + }, + "application/route-s-tsid+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sls"] + }, + "application/route-usd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rusd"] + }, + "application/rpki-ghostbusters": { + "source": "iana", + "extensions": ["gbr"] + }, + "application/rpki-manifest": { + "source": "iana", + "extensions": ["mft"] + }, + "application/rpki-publication": { + "source": "iana" + }, + "application/rpki-roa": { + "source": "iana", + "extensions": ["roa"] + }, + "application/rpki-updown": { + "source": "iana" + }, + "application/rsd+xml": { + "source": "apache", + "compressible": true, + "extensions": ["rsd"] + }, + "application/rss+xml": { + "source": "apache", + "compressible": true, + "extensions": ["rss"] + }, + "application/rtf": { + "source": "iana", + "compressible": true, + "extensions": ["rtf"] + }, + "application/rtploopback": { + "source": "iana" + }, + "application/rtx": { + "source": "iana" + }, + "application/samlassertion+xml": { + "source": "iana", + "compressible": true + }, + "application/samlmetadata+xml": { + "source": "iana", + "compressible": true + }, + "application/sarif+json": { + "source": "iana", + "compressible": true + }, + "application/sarif-external-properties+json": { + "source": "iana", + "compressible": true + }, + "application/sbe": { + "source": "iana" + }, + "application/sbml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sbml"] + }, + "application/scaip+xml": { + "source": "iana", + "compressible": true + }, + "application/scim+json": { + "source": "iana", + "compressible": true + }, + "application/scvp-cv-request": { + "source": "iana", + "extensions": ["scq"] + }, + "application/scvp-cv-response": { + "source": "iana", + "extensions": ["scs"] + }, + "application/scvp-vp-request": { + "source": "iana", + "extensions": ["spq"] + }, + "application/scvp-vp-response": { + "source": "iana", + "extensions": ["spp"] + }, + "application/sdp": { + "source": "iana", + "extensions": ["sdp"] + }, + "application/secevent+jwt": { + "source": "iana" + }, + "application/senml+cbor": { + "source": "iana" + }, + "application/senml+json": { + "source": "iana", + "compressible": true + }, + "application/senml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["senmlx"] + }, + "application/senml-etch+cbor": { + "source": "iana" + }, + "application/senml-etch+json": { + "source": "iana", + "compressible": true + }, + "application/senml-exi": { + "source": "iana" + }, + "application/sensml+cbor": { + "source": "iana" + }, + "application/sensml+json": { + "source": "iana", + "compressible": true + }, + "application/sensml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sensmlx"] + }, + "application/sensml-exi": { + "source": "iana" + }, + "application/sep+xml": { + "source": "iana", + "compressible": true + }, + "application/sep-exi": { + "source": "iana" + }, + "application/session-info": { + "source": "iana" + }, + "application/set-payment": { + "source": "iana" + }, + "application/set-payment-initiation": { + "source": "iana", + "extensions": ["setpay"] + }, + "application/set-registration": { + "source": "iana" + }, + "application/set-registration-initiation": { + "source": "iana", + "extensions": ["setreg"] + }, + "application/sgml": { + "source": "iana" + }, + "application/sgml-open-catalog": { + "source": "iana" + }, + "application/shf+xml": { + "source": "iana", + "compressible": true, + "extensions": ["shf"] + }, + "application/sieve": { + "source": "iana", + "extensions": ["siv","sieve"] + }, + "application/simple-filter+xml": { + "source": "iana", + "compressible": true + }, + "application/simple-message-summary": { + "source": "iana" + }, + "application/simplesymbolcontainer": { + "source": "iana" + }, + "application/sipc": { + "source": "iana" + }, + "application/slate": { + "source": "iana" + }, + "application/smil": { + "source": "iana" + }, + "application/smil+xml": { + "source": "iana", + "compressible": true, + "extensions": ["smi","smil"] + }, + "application/smpte336m": { + "source": "iana" + }, + "application/soap+fastinfoset": { + "source": "iana" + }, + "application/soap+xml": { + "source": "iana", + "compressible": true + }, + "application/sparql-query": { + "source": "iana", + "extensions": ["rq"] + }, + "application/sparql-results+xml": { + "source": "iana", + "compressible": true, + "extensions": ["srx"] + }, + "application/spdx+json": { + "source": "iana", + "compressible": true + }, + "application/spirits-event+xml": { + "source": "iana", + "compressible": true + }, + "application/sql": { + "source": "iana" + }, + "application/srgs": { + "source": "iana", + "extensions": ["gram"] + }, + "application/srgs+xml": { + "source": "iana", + "compressible": true, + "extensions": ["grxml"] + }, + "application/sru+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sru"] + }, + "application/ssdl+xml": { + "source": "apache", + "compressible": true, + "extensions": ["ssdl"] + }, + "application/ssml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ssml"] + }, + "application/stix+json": { + "source": "iana", + "compressible": true + }, + "application/swid+xml": { + "source": "iana", + "compressible": true, + "extensions": ["swidtag"] + }, + "application/tamp-apex-update": { + "source": "iana" + }, + "application/tamp-apex-update-confirm": { + "source": "iana" + }, + "application/tamp-community-update": { + "source": "iana" + }, + "application/tamp-community-update-confirm": { + "source": "iana" + }, + "application/tamp-error": { + "source": "iana" + }, + "application/tamp-sequence-adjust": { + "source": "iana" + }, + "application/tamp-sequence-adjust-confirm": { + "source": "iana" + }, + "application/tamp-status-query": { + "source": "iana" + }, + "application/tamp-status-response": { + "source": "iana" + }, + "application/tamp-update": { + "source": "iana" + }, + "application/tamp-update-confirm": { + "source": "iana" + }, + "application/tar": { + "compressible": true + }, + "application/taxii+json": { + "source": "iana", + "compressible": true + }, + "application/td+json": { + "source": "iana", + "compressible": true + }, + "application/tei+xml": { + "source": "iana", + "compressible": true, + "extensions": ["tei","teicorpus"] + }, + "application/tetra_isi": { + "source": "iana" + }, + "application/thraud+xml": { + "source": "iana", + "compressible": true, + "extensions": ["tfi"] + }, + "application/timestamp-query": { + "source": "iana" + }, + "application/timestamp-reply": { + "source": "iana" + }, + "application/timestamped-data": { + "source": "iana", + "extensions": ["tsd"] + }, + "application/tlsrpt+gzip": { + "source": "iana" + }, + "application/tlsrpt+json": { + "source": "iana", + "compressible": true + }, + "application/tnauthlist": { + "source": "iana" + }, + "application/token-introspection+jwt": { + "source": "iana" + }, + "application/toml": { + "compressible": true, + "extensions": ["toml"] + }, + "application/trickle-ice-sdpfrag": { + "source": "iana" + }, + "application/trig": { + "source": "iana", + "extensions": ["trig"] + }, + "application/ttml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ttml"] + }, + "application/tve-trigger": { + "source": "iana" + }, + "application/tzif": { + "source": "iana" + }, + "application/tzif-leap": { + "source": "iana" + }, + "application/ubjson": { + "compressible": false, + "extensions": ["ubj"] + }, + "application/ulpfec": { + "source": "iana" + }, + "application/urc-grpsheet+xml": { + "source": "iana", + "compressible": true + }, + "application/urc-ressheet+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rsheet"] + }, + "application/urc-targetdesc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["td"] + }, + "application/urc-uisocketdesc+xml": { + "source": "iana", + "compressible": true + }, + "application/vcard+json": { + "source": "iana", + "compressible": true + }, + "application/vcard+xml": { + "source": "iana", + "compressible": true + }, + "application/vemmi": { + "source": "iana" + }, + "application/vividence.scriptfile": { + "source": "apache" + }, + "application/vnd.1000minds.decision-model+xml": { + "source": "iana", + "compressible": true, + "extensions": ["1km"] + }, + "application/vnd.3gpp-prose+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp-prose-pc3ch+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp-v2x-local-service-information": { + "source": "iana" + }, + "application/vnd.3gpp.5gnas": { + "source": "iana" + }, + "application/vnd.3gpp.access-transfer-events+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.bsf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.gmop+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.gtpc": { + "source": "iana" + }, + "application/vnd.3gpp.interworking-data": { + "source": "iana" + }, + "application/vnd.3gpp.lpp": { + "source": "iana" + }, + "application/vnd.3gpp.mc-signalling-ear": { + "source": "iana" + }, + "application/vnd.3gpp.mcdata-affiliation-command+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-payload": { + "source": "iana" + }, + "application/vnd.3gpp.mcdata-service-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-signalling": { + "source": "iana" + }, + "application/vnd.3gpp.mcdata-ue-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-user-profile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-affiliation-command+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-floor-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-location-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-mbms-usage-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-service-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-signed+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-ue-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-ue-init-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-user-profile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-affiliation-command+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-affiliation-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-location-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-mbms-usage-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-service-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-transmission-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-ue-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-user-profile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mid-call+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.ngap": { + "source": "iana" + }, + "application/vnd.3gpp.pfcp": { + "source": "iana" + }, + "application/vnd.3gpp.pic-bw-large": { + "source": "iana", + "extensions": ["plb"] + }, + "application/vnd.3gpp.pic-bw-small": { + "source": "iana", + "extensions": ["psb"] + }, + "application/vnd.3gpp.pic-bw-var": { + "source": "iana", + "extensions": ["pvb"] + }, + "application/vnd.3gpp.s1ap": { + "source": "iana" + }, + "application/vnd.3gpp.sms": { + "source": "iana" + }, + "application/vnd.3gpp.sms+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.srvcc-ext+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.srvcc-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.state-and-event-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.ussd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp2.bcmcsinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp2.sms": { + "source": "iana" + }, + "application/vnd.3gpp2.tcap": { + "source": "iana", + "extensions": ["tcap"] + }, + "application/vnd.3lightssoftware.imagescal": { + "source": "iana" + }, + "application/vnd.3m.post-it-notes": { + "source": "iana", + "extensions": ["pwn"] + }, + "application/vnd.accpac.simply.aso": { + "source": "iana", + "extensions": ["aso"] + }, + "application/vnd.accpac.simply.imp": { + "source": "iana", + "extensions": ["imp"] + }, + "application/vnd.acucobol": { + "source": "iana", + "extensions": ["acu"] + }, + "application/vnd.acucorp": { + "source": "iana", + "extensions": ["atc","acutc"] + }, + "application/vnd.adobe.air-application-installer-package+zip": { + "source": "apache", + "compressible": false, + "extensions": ["air"] + }, + "application/vnd.adobe.flash.movie": { + "source": "iana" + }, + "application/vnd.adobe.formscentral.fcdt": { + "source": "iana", + "extensions": ["fcdt"] + }, + "application/vnd.adobe.fxp": { + "source": "iana", + "extensions": ["fxp","fxpl"] + }, + "application/vnd.adobe.partial-upload": { + "source": "iana" + }, + "application/vnd.adobe.xdp+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xdp"] + }, + "application/vnd.adobe.xfdf": { + "source": "iana", + "extensions": ["xfdf"] + }, + "application/vnd.aether.imp": { + "source": "iana" + }, + "application/vnd.afpc.afplinedata": { + "source": "iana" + }, + "application/vnd.afpc.afplinedata-pagedef": { + "source": "iana" + }, + "application/vnd.afpc.cmoca-cmresource": { + "source": "iana" + }, + "application/vnd.afpc.foca-charset": { + "source": "iana" + }, + "application/vnd.afpc.foca-codedfont": { + "source": "iana" + }, + "application/vnd.afpc.foca-codepage": { + "source": "iana" + }, + "application/vnd.afpc.modca": { + "source": "iana" + }, + "application/vnd.afpc.modca-cmtable": { + "source": "iana" + }, + "application/vnd.afpc.modca-formdef": { + "source": "iana" + }, + "application/vnd.afpc.modca-mediummap": { + "source": "iana" + }, + "application/vnd.afpc.modca-objectcontainer": { + "source": "iana" + }, + "application/vnd.afpc.modca-overlay": { + "source": "iana" + }, + "application/vnd.afpc.modca-pagesegment": { + "source": "iana" + }, + "application/vnd.age": { + "source": "iana", + "extensions": ["age"] + }, + "application/vnd.ah-barcode": { + "source": "iana" + }, + "application/vnd.ahead.space": { + "source": "iana", + "extensions": ["ahead"] + }, + "application/vnd.airzip.filesecure.azf": { + "source": "iana", + "extensions": ["azf"] + }, + "application/vnd.airzip.filesecure.azs": { + "source": "iana", + "extensions": ["azs"] + }, + "application/vnd.amadeus+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.amazon.ebook": { + "source": "apache", + "extensions": ["azw"] + }, + "application/vnd.amazon.mobi8-ebook": { + "source": "iana" + }, + "application/vnd.americandynamics.acc": { + "source": "iana", + "extensions": ["acc"] + }, + "application/vnd.amiga.ami": { + "source": "iana", + "extensions": ["ami"] + }, + "application/vnd.amundsen.maze+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.android.ota": { + "source": "iana" + }, + "application/vnd.android.package-archive": { + "source": "apache", + "compressible": false, + "extensions": ["apk"] + }, + "application/vnd.anki": { + "source": "iana" + }, + "application/vnd.anser-web-certificate-issue-initiation": { + "source": "iana", + "extensions": ["cii"] + }, + "application/vnd.anser-web-funds-transfer-initiation": { + "source": "apache", + "extensions": ["fti"] + }, + "application/vnd.antix.game-component": { + "source": "iana", + "extensions": ["atx"] + }, + "application/vnd.apache.arrow.file": { + "source": "iana" + }, + "application/vnd.apache.arrow.stream": { + "source": "iana" + }, + "application/vnd.apache.thrift.binary": { + "source": "iana" + }, + "application/vnd.apache.thrift.compact": { + "source": "iana" + }, + "application/vnd.apache.thrift.json": { + "source": "iana" + }, + "application/vnd.api+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.aplextor.warrp+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.apothekende.reservation+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.apple.installer+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpkg"] + }, + "application/vnd.apple.keynote": { + "source": "iana", + "extensions": ["key"] + }, + "application/vnd.apple.mpegurl": { + "source": "iana", + "extensions": ["m3u8"] + }, + "application/vnd.apple.numbers": { + "source": "iana", + "extensions": ["numbers"] + }, + "application/vnd.apple.pages": { + "source": "iana", + "extensions": ["pages"] + }, + "application/vnd.apple.pkpass": { + "compressible": false, + "extensions": ["pkpass"] + }, + "application/vnd.arastra.swi": { + "source": "iana" + }, + "application/vnd.aristanetworks.swi": { + "source": "iana", + "extensions": ["swi"] + }, + "application/vnd.artisan+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.artsquare": { + "source": "iana" + }, + "application/vnd.astraea-software.iota": { + "source": "iana", + "extensions": ["iota"] + }, + "application/vnd.audiograph": { + "source": "iana", + "extensions": ["aep"] + }, + "application/vnd.autopackage": { + "source": "iana" + }, + "application/vnd.avalon+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.avistar+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.balsamiq.bmml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["bmml"] + }, + "application/vnd.balsamiq.bmpr": { + "source": "iana" + }, + "application/vnd.banana-accounting": { + "source": "iana" + }, + "application/vnd.bbf.usp.error": { + "source": "iana" + }, + "application/vnd.bbf.usp.msg": { + "source": "iana" + }, + "application/vnd.bbf.usp.msg+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.bekitzur-stech+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.bint.med-content": { + "source": "iana" + }, + "application/vnd.biopax.rdf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.blink-idb-value-wrapper": { + "source": "iana" + }, + "application/vnd.blueice.multipass": { + "source": "iana", + "extensions": ["mpm"] + }, + "application/vnd.bluetooth.ep.oob": { + "source": "iana" + }, + "application/vnd.bluetooth.le.oob": { + "source": "iana" + }, + "application/vnd.bmi": { + "source": "iana", + "extensions": ["bmi"] + }, + "application/vnd.bpf": { + "source": "iana" + }, + "application/vnd.bpf3": { + "source": "iana" + }, + "application/vnd.businessobjects": { + "source": "iana", + "extensions": ["rep"] + }, + "application/vnd.byu.uapi+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cab-jscript": { + "source": "iana" + }, + "application/vnd.canon-cpdl": { + "source": "iana" + }, + "application/vnd.canon-lips": { + "source": "iana" + }, + "application/vnd.capasystems-pg+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cendio.thinlinc.clientconf": { + "source": "iana" + }, + "application/vnd.century-systems.tcp_stream": { + "source": "iana" + }, + "application/vnd.chemdraw+xml": { + "source": "iana", + "compressible": true, + "extensions": ["cdxml"] + }, + "application/vnd.chess-pgn": { + "source": "iana" + }, + "application/vnd.chipnuts.karaoke-mmd": { + "source": "iana", + "extensions": ["mmd"] + }, + "application/vnd.ciedi": { + "source": "iana" + }, + "application/vnd.cinderella": { + "source": "iana", + "extensions": ["cdy"] + }, + "application/vnd.cirpack.isdn-ext": { + "source": "iana" + }, + "application/vnd.citationstyles.style+xml": { + "source": "iana", + "compressible": true, + "extensions": ["csl"] + }, + "application/vnd.claymore": { + "source": "iana", + "extensions": ["cla"] + }, + "application/vnd.cloanto.rp9": { + "source": "iana", + "extensions": ["rp9"] + }, + "application/vnd.clonk.c4group": { + "source": "iana", + "extensions": ["c4g","c4d","c4f","c4p","c4u"] + }, + "application/vnd.cluetrust.cartomobile-config": { + "source": "iana", + "extensions": ["c11amc"] + }, + "application/vnd.cluetrust.cartomobile-config-pkg": { + "source": "iana", + "extensions": ["c11amz"] + }, + "application/vnd.coffeescript": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.document": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.document-template": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.presentation": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.presentation-template": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.spreadsheet": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.spreadsheet-template": { + "source": "iana" + }, + "application/vnd.collection+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.collection.doc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.collection.next+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.comicbook+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.comicbook-rar": { + "source": "iana" + }, + "application/vnd.commerce-battelle": { + "source": "iana" + }, + "application/vnd.commonspace": { + "source": "iana", + "extensions": ["csp"] + }, + "application/vnd.contact.cmsg": { + "source": "iana", + "extensions": ["cdbcmsg"] + }, + "application/vnd.coreos.ignition+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cosmocaller": { + "source": "iana", + "extensions": ["cmc"] + }, + "application/vnd.crick.clicker": { + "source": "iana", + "extensions": ["clkx"] + }, + "application/vnd.crick.clicker.keyboard": { + "source": "iana", + "extensions": ["clkk"] + }, + "application/vnd.crick.clicker.palette": { + "source": "iana", + "extensions": ["clkp"] + }, + "application/vnd.crick.clicker.template": { + "source": "iana", + "extensions": ["clkt"] + }, + "application/vnd.crick.clicker.wordbank": { + "source": "iana", + "extensions": ["clkw"] + }, + "application/vnd.criticaltools.wbs+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wbs"] + }, + "application/vnd.cryptii.pipe+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.crypto-shade-file": { + "source": "iana" + }, + "application/vnd.cryptomator.encrypted": { + "source": "iana" + }, + "application/vnd.cryptomator.vault": { + "source": "iana" + }, + "application/vnd.ctc-posml": { + "source": "iana", + "extensions": ["pml"] + }, + "application/vnd.ctct.ws+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.cups-pdf": { + "source": "iana" + }, + "application/vnd.cups-postscript": { + "source": "iana" + }, + "application/vnd.cups-ppd": { + "source": "iana", + "extensions": ["ppd"] + }, + "application/vnd.cups-raster": { + "source": "iana" + }, + "application/vnd.cups-raw": { + "source": "iana" + }, + "application/vnd.curl": { + "source": "iana" + }, + "application/vnd.curl.car": { + "source": "apache", + "extensions": ["car"] + }, + "application/vnd.curl.pcurl": { + "source": "apache", + "extensions": ["pcurl"] + }, + "application/vnd.cyan.dean.root+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.cybank": { + "source": "iana" + }, + "application/vnd.cyclonedx+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cyclonedx+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.d2l.coursepackage1p0+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.d3m-dataset": { + "source": "iana" + }, + "application/vnd.d3m-problem": { + "source": "iana" + }, + "application/vnd.dart": { + "source": "iana", + "compressible": true, + "extensions": ["dart"] + }, + "application/vnd.data-vision.rdz": { + "source": "iana", + "extensions": ["rdz"] + }, + "application/vnd.datapackage+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dataresource+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dbf": { + "source": "iana", + "extensions": ["dbf"] + }, + "application/vnd.debian.binary-package": { + "source": "iana" + }, + "application/vnd.dece.data": { + "source": "iana", + "extensions": ["uvf","uvvf","uvd","uvvd"] + }, + "application/vnd.dece.ttml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["uvt","uvvt"] + }, + "application/vnd.dece.unspecified": { + "source": "iana", + "extensions": ["uvx","uvvx"] + }, + "application/vnd.dece.zip": { + "source": "iana", + "extensions": ["uvz","uvvz"] + }, + "application/vnd.denovo.fcselayout-link": { + "source": "iana", + "extensions": ["fe_launch"] + }, + "application/vnd.desmume.movie": { + "source": "iana" + }, + "application/vnd.dir-bi.plate-dl-nosuffix": { + "source": "iana" + }, + "application/vnd.dm.delegation+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dna": { + "source": "iana", + "extensions": ["dna"] + }, + "application/vnd.document+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dolby.mlp": { + "source": "apache", + "extensions": ["mlp"] + }, + "application/vnd.dolby.mobile.1": { + "source": "iana" + }, + "application/vnd.dolby.mobile.2": { + "source": "iana" + }, + "application/vnd.doremir.scorecloud-binary-document": { + "source": "iana" + }, + "application/vnd.dpgraph": { + "source": "iana", + "extensions": ["dpg"] + }, + "application/vnd.dreamfactory": { + "source": "iana", + "extensions": ["dfac"] + }, + "application/vnd.drive+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ds-keypoint": { + "source": "apache", + "extensions": ["kpxx"] + }, + "application/vnd.dtg.local": { + "source": "iana" + }, + "application/vnd.dtg.local.flash": { + "source": "iana" + }, + "application/vnd.dtg.local.html": { + "source": "iana" + }, + "application/vnd.dvb.ait": { + "source": "iana", + "extensions": ["ait"] + }, + "application/vnd.dvb.dvbisl+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.dvbj": { + "source": "iana" + }, + "application/vnd.dvb.esgcontainer": { + "source": "iana" + }, + "application/vnd.dvb.ipdcdftnotifaccess": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgaccess": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgaccess2": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgpdd": { + "source": "iana" + }, + "application/vnd.dvb.ipdcroaming": { + "source": "iana" + }, + "application/vnd.dvb.iptv.alfec-base": { + "source": "iana" + }, + "application/vnd.dvb.iptv.alfec-enhancement": { + "source": "iana" + }, + "application/vnd.dvb.notif-aggregate-root+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-container+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-generic+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-ia-msglist+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-ia-registration-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-ia-registration-response+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-init+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.pfr": { + "source": "iana" + }, + "application/vnd.dvb.service": { + "source": "iana", + "extensions": ["svc"] + }, + "application/vnd.dxr": { + "source": "iana" + }, + "application/vnd.dynageo": { + "source": "iana", + "extensions": ["geo"] + }, + "application/vnd.dzr": { + "source": "iana" + }, + "application/vnd.easykaraoke.cdgdownload": { + "source": "iana" + }, + "application/vnd.ecdis-update": { + "source": "iana" + }, + "application/vnd.ecip.rlp": { + "source": "iana" + }, + "application/vnd.eclipse.ditto+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ecowin.chart": { + "source": "iana", + "extensions": ["mag"] + }, + "application/vnd.ecowin.filerequest": { + "source": "iana" + }, + "application/vnd.ecowin.fileupdate": { + "source": "iana" + }, + "application/vnd.ecowin.series": { + "source": "iana" + }, + "application/vnd.ecowin.seriesrequest": { + "source": "iana" + }, + "application/vnd.ecowin.seriesupdate": { + "source": "iana" + }, + "application/vnd.efi.img": { + "source": "iana" + }, + "application/vnd.efi.iso": { + "source": "iana" + }, + "application/vnd.emclient.accessrequest+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.enliven": { + "source": "iana", + "extensions": ["nml"] + }, + "application/vnd.enphase.envoy": { + "source": "iana" + }, + "application/vnd.eprints.data+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.epson.esf": { + "source": "iana", + "extensions": ["esf"] + }, + "application/vnd.epson.msf": { + "source": "iana", + "extensions": ["msf"] + }, + "application/vnd.epson.quickanime": { + "source": "iana", + "extensions": ["qam"] + }, + "application/vnd.epson.salt": { + "source": "iana", + "extensions": ["slt"] + }, + "application/vnd.epson.ssf": { + "source": "iana", + "extensions": ["ssf"] + }, + "application/vnd.ericsson.quickcall": { + "source": "iana" + }, + "application/vnd.espass-espass+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.eszigno3+xml": { + "source": "iana", + "compressible": true, + "extensions": ["es3","et3"] + }, + "application/vnd.etsi.aoc+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.asic-e+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.etsi.asic-s+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.etsi.cug+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvcommand+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvdiscovery+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsad-bc+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsad-cod+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsad-npvr+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvservice+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsync+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvueprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.mcid+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.mheg5": { + "source": "iana" + }, + "application/vnd.etsi.overload-control-policy-dataset+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.pstn+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.sci+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.simservs+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.timestamp-token": { + "source": "iana" + }, + "application/vnd.etsi.tsl+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.tsl.der": { + "source": "iana" + }, + "application/vnd.eu.kasparian.car+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.eudora.data": { + "source": "iana" + }, + "application/vnd.evolv.ecig.profile": { + "source": "iana" + }, + "application/vnd.evolv.ecig.settings": { + "source": "iana" + }, + "application/vnd.evolv.ecig.theme": { + "source": "iana" + }, + "application/vnd.exstream-empower+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.exstream-package": { + "source": "iana" + }, + "application/vnd.ezpix-album": { + "source": "iana", + "extensions": ["ez2"] + }, + "application/vnd.ezpix-package": { + "source": "iana", + "extensions": ["ez3"] + }, + "application/vnd.f-secure.mobile": { + "source": "iana" + }, + "application/vnd.familysearch.gedcom+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.fastcopy-disk-image": { + "source": "iana" + }, + "application/vnd.fdf": { + "source": "iana", + "extensions": ["fdf"] + }, + "application/vnd.fdsn.mseed": { + "source": "iana", + "extensions": ["mseed"] + }, + "application/vnd.fdsn.seed": { + "source": "iana", + "extensions": ["seed","dataless"] + }, + "application/vnd.ffsns": { + "source": "iana" + }, + "application/vnd.ficlab.flb+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.filmit.zfc": { + "source": "iana" + }, + "application/vnd.fints": { + "source": "iana" + }, + "application/vnd.firemonkeys.cloudcell": { + "source": "iana" + }, + "application/vnd.flographit": { + "source": "iana", + "extensions": ["gph"] + }, + "application/vnd.fluxtime.clip": { + "source": "iana", + "extensions": ["ftc"] + }, + "application/vnd.font-fontforge-sfd": { + "source": "iana" + }, + "application/vnd.framemaker": { + "source": "iana", + "extensions": ["fm","frame","maker","book"] + }, + "application/vnd.frogans.fnc": { + "source": "iana", + "extensions": ["fnc"] + }, + "application/vnd.frogans.ltf": { + "source": "iana", + "extensions": ["ltf"] + }, + "application/vnd.fsc.weblaunch": { + "source": "iana", + "extensions": ["fsc"] + }, + "application/vnd.fujifilm.fb.docuworks": { + "source": "iana" + }, + "application/vnd.fujifilm.fb.docuworks.binder": { + "source": "iana" + }, + "application/vnd.fujifilm.fb.docuworks.container": { + "source": "iana" + }, + "application/vnd.fujifilm.fb.jfi+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.fujitsu.oasys": { + "source": "iana", + "extensions": ["oas"] + }, + "application/vnd.fujitsu.oasys2": { + "source": "iana", + "extensions": ["oa2"] + }, + "application/vnd.fujitsu.oasys3": { + "source": "iana", + "extensions": ["oa3"] + }, + "application/vnd.fujitsu.oasysgp": { + "source": "iana", + "extensions": ["fg5"] + }, + "application/vnd.fujitsu.oasysprs": { + "source": "iana", + "extensions": ["bh2"] + }, + "application/vnd.fujixerox.art-ex": { + "source": "iana" + }, + "application/vnd.fujixerox.art4": { + "source": "iana" + }, + "application/vnd.fujixerox.ddd": { + "source": "iana", + "extensions": ["ddd"] + }, + "application/vnd.fujixerox.docuworks": { + "source": "iana", + "extensions": ["xdw"] + }, + "application/vnd.fujixerox.docuworks.binder": { + "source": "iana", + "extensions": ["xbd"] + }, + "application/vnd.fujixerox.docuworks.container": { + "source": "iana" + }, + "application/vnd.fujixerox.hbpl": { + "source": "iana" + }, + "application/vnd.fut-misnet": { + "source": "iana" + }, + "application/vnd.futoin+cbor": { + "source": "iana" + }, + "application/vnd.futoin+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.fuzzysheet": { + "source": "iana", + "extensions": ["fzs"] + }, + "application/vnd.genomatix.tuxedo": { + "source": "iana", + "extensions": ["txd"] + }, + "application/vnd.gentics.grd+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.geo+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.geocube+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.geogebra.file": { + "source": "iana", + "extensions": ["ggb"] + }, + "application/vnd.geogebra.slides": { + "source": "iana" + }, + "application/vnd.geogebra.tool": { + "source": "iana", + "extensions": ["ggt"] + }, + "application/vnd.geometry-explorer": { + "source": "iana", + "extensions": ["gex","gre"] + }, + "application/vnd.geonext": { + "source": "iana", + "extensions": ["gxt"] + }, + "application/vnd.geoplan": { + "source": "iana", + "extensions": ["g2w"] + }, + "application/vnd.geospace": { + "source": "iana", + "extensions": ["g3w"] + }, + "application/vnd.gerber": { + "source": "iana" + }, + "application/vnd.globalplatform.card-content-mgt": { + "source": "iana" + }, + "application/vnd.globalplatform.card-content-mgt-response": { + "source": "iana" + }, + "application/vnd.gmx": { + "source": "iana", + "extensions": ["gmx"] + }, + "application/vnd.google-apps.document": { + "compressible": false, + "extensions": ["gdoc"] + }, + "application/vnd.google-apps.presentation": { + "compressible": false, + "extensions": ["gslides"] + }, + "application/vnd.google-apps.spreadsheet": { + "compressible": false, + "extensions": ["gsheet"] + }, + "application/vnd.google-earth.kml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["kml"] + }, + "application/vnd.google-earth.kmz": { + "source": "iana", + "compressible": false, + "extensions": ["kmz"] + }, + "application/vnd.gov.sk.e-form+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.gov.sk.e-form+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.gov.sk.xmldatacontainer+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.grafeq": { + "source": "iana", + "extensions": ["gqf","gqs"] + }, + "application/vnd.gridmp": { + "source": "iana" + }, + "application/vnd.groove-account": { + "source": "iana", + "extensions": ["gac"] + }, + "application/vnd.groove-help": { + "source": "iana", + "extensions": ["ghf"] + }, + "application/vnd.groove-identity-message": { + "source": "iana", + "extensions": ["gim"] + }, + "application/vnd.groove-injector": { + "source": "iana", + "extensions": ["grv"] + }, + "application/vnd.groove-tool-message": { + "source": "iana", + "extensions": ["gtm"] + }, + "application/vnd.groove-tool-template": { + "source": "iana", + "extensions": ["tpl"] + }, + "application/vnd.groove-vcard": { + "source": "iana", + "extensions": ["vcg"] + }, + "application/vnd.hal+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hal+xml": { + "source": "iana", + "compressible": true, + "extensions": ["hal"] + }, + "application/vnd.handheld-entertainment+xml": { + "source": "iana", + "compressible": true, + "extensions": ["zmm"] + }, + "application/vnd.hbci": { + "source": "iana", + "extensions": ["hbci"] + }, + "application/vnd.hc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hcl-bireports": { + "source": "iana" + }, + "application/vnd.hdt": { + "source": "iana" + }, + "application/vnd.heroku+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hhe.lesson-player": { + "source": "iana", + "extensions": ["les"] + }, + "application/vnd.hl7cda+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.hl7v2+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.hp-hpgl": { + "source": "iana", + "extensions": ["hpgl"] + }, + "application/vnd.hp-hpid": { + "source": "iana", + "extensions": ["hpid"] + }, + "application/vnd.hp-hps": { + "source": "iana", + "extensions": ["hps"] + }, + "application/vnd.hp-jlyt": { + "source": "iana", + "extensions": ["jlt"] + }, + "application/vnd.hp-pcl": { + "source": "iana", + "extensions": ["pcl"] + }, + "application/vnd.hp-pclxl": { + "source": "iana", + "extensions": ["pclxl"] + }, + "application/vnd.httphone": { + "source": "iana" + }, + "application/vnd.hydrostatix.sof-data": { + "source": "iana", + "extensions": ["sfd-hdstx"] + }, + "application/vnd.hyper+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hyper-item+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hyperdrive+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hzn-3d-crossword": { + "source": "iana" + }, + "application/vnd.ibm.afplinedata": { + "source": "iana" + }, + "application/vnd.ibm.electronic-media": { + "source": "iana" + }, + "application/vnd.ibm.minipay": { + "source": "iana", + "extensions": ["mpy"] + }, + "application/vnd.ibm.modcap": { + "source": "iana", + "extensions": ["afp","listafp","list3820"] + }, + "application/vnd.ibm.rights-management": { + "source": "iana", + "extensions": ["irm"] + }, + "application/vnd.ibm.secure-container": { + "source": "iana", + "extensions": ["sc"] + }, + "application/vnd.iccprofile": { + "source": "iana", + "extensions": ["icc","icm"] + }, + "application/vnd.ieee.1905": { + "source": "iana" + }, + "application/vnd.igloader": { + "source": "iana", + "extensions": ["igl"] + }, + "application/vnd.imagemeter.folder+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.imagemeter.image+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.immervision-ivp": { + "source": "iana", + "extensions": ["ivp"] + }, + "application/vnd.immervision-ivu": { + "source": "iana", + "extensions": ["ivu"] + }, + "application/vnd.ims.imsccv1p1": { + "source": "iana" + }, + "application/vnd.ims.imsccv1p2": { + "source": "iana" + }, + "application/vnd.ims.imsccv1p3": { + "source": "iana" + }, + "application/vnd.ims.lis.v2.result+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolconsumerprofile+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolproxy+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolproxy.id+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolsettings+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolsettings.simple+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.informedcontrol.rms+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.informix-visionary": { + "source": "iana" + }, + "application/vnd.infotech.project": { + "source": "iana" + }, + "application/vnd.infotech.project+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.innopath.wamp.notification": { + "source": "iana" + }, + "application/vnd.insors.igm": { + "source": "iana", + "extensions": ["igm"] + }, + "application/vnd.intercon.formnet": { + "source": "iana", + "extensions": ["xpw","xpx"] + }, + "application/vnd.intergeo": { + "source": "iana", + "extensions": ["i2g"] + }, + "application/vnd.intertrust.digibox": { + "source": "iana" + }, + "application/vnd.intertrust.nncp": { + "source": "iana" + }, + "application/vnd.intu.qbo": { + "source": "iana", + "extensions": ["qbo"] + }, + "application/vnd.intu.qfx": { + "source": "iana", + "extensions": ["qfx"] + }, + "application/vnd.iptc.g2.catalogitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.conceptitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.knowledgeitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.newsitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.newsmessage+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.packageitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.planningitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ipunplugged.rcprofile": { + "source": "iana", + "extensions": ["rcprofile"] + }, + "application/vnd.irepository.package+xml": { + "source": "iana", + "compressible": true, + "extensions": ["irp"] + }, + "application/vnd.is-xpr": { + "source": "iana", + "extensions": ["xpr"] + }, + "application/vnd.isac.fcs": { + "source": "iana", + "extensions": ["fcs"] + }, + "application/vnd.iso11783-10+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.jam": { + "source": "iana", + "extensions": ["jam"] + }, + "application/vnd.japannet-directory-service": { + "source": "iana" + }, + "application/vnd.japannet-jpnstore-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-payment-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-registration": { + "source": "iana" + }, + "application/vnd.japannet-registration-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-setstore-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-verification": { + "source": "iana" + }, + "application/vnd.japannet-verification-wakeup": { + "source": "iana" + }, + "application/vnd.jcp.javame.midlet-rms": { + "source": "iana", + "extensions": ["rms"] + }, + "application/vnd.jisp": { + "source": "iana", + "extensions": ["jisp"] + }, + "application/vnd.joost.joda-archive": { + "source": "iana", + "extensions": ["joda"] + }, + "application/vnd.jsk.isdn-ngn": { + "source": "iana" + }, + "application/vnd.kahootz": { + "source": "iana", + "extensions": ["ktz","ktr"] + }, + "application/vnd.kde.karbon": { + "source": "iana", + "extensions": ["karbon"] + }, + "application/vnd.kde.kchart": { + "source": "iana", + "extensions": ["chrt"] + }, + "application/vnd.kde.kformula": { + "source": "iana", + "extensions": ["kfo"] + }, + "application/vnd.kde.kivio": { + "source": "iana", + "extensions": ["flw"] + }, + "application/vnd.kde.kontour": { + "source": "iana", + "extensions": ["kon"] + }, + "application/vnd.kde.kpresenter": { + "source": "iana", + "extensions": ["kpr","kpt"] + }, + "application/vnd.kde.kspread": { + "source": "iana", + "extensions": ["ksp"] + }, + "application/vnd.kde.kword": { + "source": "iana", + "extensions": ["kwd","kwt"] + }, + "application/vnd.kenameaapp": { + "source": "iana", + "extensions": ["htke"] + }, + "application/vnd.kidspiration": { + "source": "iana", + "extensions": ["kia"] + }, + "application/vnd.kinar": { + "source": "iana", + "extensions": ["kne","knp"] + }, + "application/vnd.koan": { + "source": "iana", + "extensions": ["skp","skd","skt","skm"] + }, + "application/vnd.kodak-descriptor": { + "source": "iana", + "extensions": ["sse"] + }, + "application/vnd.las": { + "source": "iana" + }, + "application/vnd.las.las+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.las.las+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lasxml"] + }, + "application/vnd.laszip": { + "source": "iana" + }, + "application/vnd.leap+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.liberty-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.llamagraphics.life-balance.desktop": { + "source": "iana", + "extensions": ["lbd"] + }, + "application/vnd.llamagraphics.life-balance.exchange+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lbe"] + }, + "application/vnd.logipipe.circuit+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.loom": { + "source": "iana" + }, + "application/vnd.lotus-1-2-3": { + "source": "iana", + "extensions": ["123"] + }, + "application/vnd.lotus-approach": { + "source": "iana", + "extensions": ["apr"] + }, + "application/vnd.lotus-freelance": { + "source": "iana", + "extensions": ["pre"] + }, + "application/vnd.lotus-notes": { + "source": "iana", + "extensions": ["nsf"] + }, + "application/vnd.lotus-organizer": { + "source": "iana", + "extensions": ["org"] + }, + "application/vnd.lotus-screencam": { + "source": "iana", + "extensions": ["scm"] + }, + "application/vnd.lotus-wordpro": { + "source": "iana", + "extensions": ["lwp"] + }, + "application/vnd.macports.portpkg": { + "source": "iana", + "extensions": ["portpkg"] + }, + "application/vnd.mapbox-vector-tile": { + "source": "iana", + "extensions": ["mvt"] + }, + "application/vnd.marlin.drm.actiontoken+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.marlin.drm.conftoken+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.marlin.drm.license+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.marlin.drm.mdcf": { + "source": "iana" + }, + "application/vnd.mason+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.maxar.archive.3tz+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.maxmind.maxmind-db": { + "source": "iana" + }, + "application/vnd.mcd": { + "source": "iana", + "extensions": ["mcd"] + }, + "application/vnd.medcalcdata": { + "source": "iana", + "extensions": ["mc1"] + }, + "application/vnd.mediastation.cdkey": { + "source": "iana", + "extensions": ["cdkey"] + }, + "application/vnd.meridian-slingshot": { + "source": "iana" + }, + "application/vnd.mfer": { + "source": "iana", + "extensions": ["mwf"] + }, + "application/vnd.mfmp": { + "source": "iana", + "extensions": ["mfm"] + }, + "application/vnd.micro+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.micrografx.flo": { + "source": "iana", + "extensions": ["flo"] + }, + "application/vnd.micrografx.igx": { + "source": "iana", + "extensions": ["igx"] + }, + "application/vnd.microsoft.portable-executable": { + "source": "iana" + }, + "application/vnd.microsoft.windows.thumbnail-cache": { + "source": "iana" + }, + "application/vnd.miele+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.mif": { + "source": "iana", + "extensions": ["mif"] + }, + "application/vnd.minisoft-hp3000-save": { + "source": "iana" + }, + "application/vnd.mitsubishi.misty-guard.trustweb": { + "source": "iana" + }, + "application/vnd.mobius.daf": { + "source": "iana", + "extensions": ["daf"] + }, + "application/vnd.mobius.dis": { + "source": "iana", + "extensions": ["dis"] + }, + "application/vnd.mobius.mbk": { + "source": "iana", + "extensions": ["mbk"] + }, + "application/vnd.mobius.mqy": { + "source": "iana", + "extensions": ["mqy"] + }, + "application/vnd.mobius.msl": { + "source": "iana", + "extensions": ["msl"] + }, + "application/vnd.mobius.plc": { + "source": "iana", + "extensions": ["plc"] + }, + "application/vnd.mobius.txf": { + "source": "iana", + "extensions": ["txf"] + }, + "application/vnd.mophun.application": { + "source": "iana", + "extensions": ["mpn"] + }, + "application/vnd.mophun.certificate": { + "source": "iana", + "extensions": ["mpc"] + }, + "application/vnd.motorola.flexsuite": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.adsi": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.fis": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.gotap": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.kmr": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.ttc": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.wem": { + "source": "iana" + }, + "application/vnd.motorola.iprm": { + "source": "iana" + }, + "application/vnd.mozilla.xul+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xul"] + }, + "application/vnd.ms-3mfdocument": { + "source": "iana" + }, + "application/vnd.ms-artgalry": { + "source": "iana", + "extensions": ["cil"] + }, + "application/vnd.ms-asf": { + "source": "iana" + }, + "application/vnd.ms-cab-compressed": { + "source": "iana", + "extensions": ["cab"] + }, + "application/vnd.ms-color.iccprofile": { + "source": "apache" + }, + "application/vnd.ms-excel": { + "source": "iana", + "compressible": false, + "extensions": ["xls","xlm","xla","xlc","xlt","xlw"] + }, + "application/vnd.ms-excel.addin.macroenabled.12": { + "source": "iana", + "extensions": ["xlam"] + }, + "application/vnd.ms-excel.sheet.binary.macroenabled.12": { + "source": "iana", + "extensions": ["xlsb"] + }, + "application/vnd.ms-excel.sheet.macroenabled.12": { + "source": "iana", + "extensions": ["xlsm"] + }, + "application/vnd.ms-excel.template.macroenabled.12": { + "source": "iana", + "extensions": ["xltm"] + }, + "application/vnd.ms-fontobject": { + "source": "iana", + "compressible": true, + "extensions": ["eot"] + }, + "application/vnd.ms-htmlhelp": { + "source": "iana", + "extensions": ["chm"] + }, + "application/vnd.ms-ims": { + "source": "iana", + "extensions": ["ims"] + }, + "application/vnd.ms-lrm": { + "source": "iana", + "extensions": ["lrm"] + }, + "application/vnd.ms-office.activex+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-officetheme": { + "source": "iana", + "extensions": ["thmx"] + }, + "application/vnd.ms-opentype": { + "source": "apache", + "compressible": true + }, + "application/vnd.ms-outlook": { + "compressible": false, + "extensions": ["msg"] + }, + "application/vnd.ms-package.obfuscated-opentype": { + "source": "apache" + }, + "application/vnd.ms-pki.seccat": { + "source": "apache", + "extensions": ["cat"] + }, + "application/vnd.ms-pki.stl": { + "source": "apache", + "extensions": ["stl"] + }, + "application/vnd.ms-playready.initiator+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-powerpoint": { + "source": "iana", + "compressible": false, + "extensions": ["ppt","pps","pot"] + }, + "application/vnd.ms-powerpoint.addin.macroenabled.12": { + "source": "iana", + "extensions": ["ppam"] + }, + "application/vnd.ms-powerpoint.presentation.macroenabled.12": { + "source": "iana", + "extensions": ["pptm"] + }, + "application/vnd.ms-powerpoint.slide.macroenabled.12": { + "source": "iana", + "extensions": ["sldm"] + }, + "application/vnd.ms-powerpoint.slideshow.macroenabled.12": { + "source": "iana", + "extensions": ["ppsm"] + }, + "application/vnd.ms-powerpoint.template.macroenabled.12": { + "source": "iana", + "extensions": ["potm"] + }, + "application/vnd.ms-printdevicecapabilities+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-printing.printticket+xml": { + "source": "apache", + "compressible": true + }, + "application/vnd.ms-printschematicket+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-project": { + "source": "iana", + "extensions": ["mpp","mpt"] + }, + "application/vnd.ms-tnef": { + "source": "iana" + }, + "application/vnd.ms-windows.devicepairing": { + "source": "iana" + }, + "application/vnd.ms-windows.nwprinting.oob": { + "source": "iana" + }, + "application/vnd.ms-windows.printerpairing": { + "source": "iana" + }, + "application/vnd.ms-windows.wsd.oob": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.lic-chlg-req": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.lic-resp": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.meter-chlg-req": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.meter-resp": { + "source": "iana" + }, + "application/vnd.ms-word.document.macroenabled.12": { + "source": "iana", + "extensions": ["docm"] + }, + "application/vnd.ms-word.template.macroenabled.12": { + "source": "iana", + "extensions": ["dotm"] + }, + "application/vnd.ms-works": { + "source": "iana", + "extensions": ["wps","wks","wcm","wdb"] + }, + "application/vnd.ms-wpl": { + "source": "iana", + "extensions": ["wpl"] + }, + "application/vnd.ms-xpsdocument": { + "source": "iana", + "compressible": false, + "extensions": ["xps"] + }, + "application/vnd.msa-disk-image": { + "source": "iana" + }, + "application/vnd.mseq": { + "source": "iana", + "extensions": ["mseq"] + }, + "application/vnd.msign": { + "source": "iana" + }, + "application/vnd.multiad.creator": { + "source": "iana" + }, + "application/vnd.multiad.creator.cif": { + "source": "iana" + }, + "application/vnd.music-niff": { + "source": "iana" + }, + "application/vnd.musician": { + "source": "iana", + "extensions": ["mus"] + }, + "application/vnd.muvee.style": { + "source": "iana", + "extensions": ["msty"] + }, + "application/vnd.mynfc": { + "source": "iana", + "extensions": ["taglet"] + }, + "application/vnd.nacamar.ybrid+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ncd.control": { + "source": "iana" + }, + "application/vnd.ncd.reference": { + "source": "iana" + }, + "application/vnd.nearst.inv+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.nebumind.line": { + "source": "iana" + }, + "application/vnd.nervana": { + "source": "iana" + }, + "application/vnd.netfpx": { + "source": "iana" + }, + "application/vnd.neurolanguage.nlu": { + "source": "iana", + "extensions": ["nlu"] + }, + "application/vnd.nimn": { + "source": "iana" + }, + "application/vnd.nintendo.nitro.rom": { + "source": "iana" + }, + "application/vnd.nintendo.snes.rom": { + "source": "iana" + }, + "application/vnd.nitf": { + "source": "iana", + "extensions": ["ntf","nitf"] + }, + "application/vnd.noblenet-directory": { + "source": "iana", + "extensions": ["nnd"] + }, + "application/vnd.noblenet-sealer": { + "source": "iana", + "extensions": ["nns"] + }, + "application/vnd.noblenet-web": { + "source": "iana", + "extensions": ["nnw"] + }, + "application/vnd.nokia.catalogs": { + "source": "iana" + }, + "application/vnd.nokia.conml+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.conml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.iptv.config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.isds-radio-presets": { + "source": "iana" + }, + "application/vnd.nokia.landmark+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.landmark+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.landmarkcollection+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.n-gage.ac+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ac"] + }, + "application/vnd.nokia.n-gage.data": { + "source": "iana", + "extensions": ["ngdat"] + }, + "application/vnd.nokia.n-gage.symbian.install": { + "source": "iana", + "extensions": ["n-gage"] + }, + "application/vnd.nokia.ncd": { + "source": "iana" + }, + "application/vnd.nokia.pcd+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.pcd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.radio-preset": { + "source": "iana", + "extensions": ["rpst"] + }, + "application/vnd.nokia.radio-presets": { + "source": "iana", + "extensions": ["rpss"] + }, + "application/vnd.novadigm.edm": { + "source": "iana", + "extensions": ["edm"] + }, + "application/vnd.novadigm.edx": { + "source": "iana", + "extensions": ["edx"] + }, + "application/vnd.novadigm.ext": { + "source": "iana", + "extensions": ["ext"] + }, + "application/vnd.ntt-local.content-share": { + "source": "iana" + }, + "application/vnd.ntt-local.file-transfer": { + "source": "iana" + }, + "application/vnd.ntt-local.ogw_remote-access": { + "source": "iana" + }, + "application/vnd.ntt-local.sip-ta_remote": { + "source": "iana" + }, + "application/vnd.ntt-local.sip-ta_tcp_stream": { + "source": "iana" + }, + "application/vnd.oasis.opendocument.chart": { + "source": "iana", + "extensions": ["odc"] + }, + "application/vnd.oasis.opendocument.chart-template": { + "source": "iana", + "extensions": ["otc"] + }, + "application/vnd.oasis.opendocument.database": { + "source": "iana", + "extensions": ["odb"] + }, + "application/vnd.oasis.opendocument.formula": { + "source": "iana", + "extensions": ["odf"] + }, + "application/vnd.oasis.opendocument.formula-template": { + "source": "iana", + "extensions": ["odft"] + }, + "application/vnd.oasis.opendocument.graphics": { + "source": "iana", + "compressible": false, + "extensions": ["odg"] + }, + "application/vnd.oasis.opendocument.graphics-template": { + "source": "iana", + "extensions": ["otg"] + }, + "application/vnd.oasis.opendocument.image": { + "source": "iana", + "extensions": ["odi"] + }, + "application/vnd.oasis.opendocument.image-template": { + "source": "iana", + "extensions": ["oti"] + }, + "application/vnd.oasis.opendocument.presentation": { + "source": "iana", + "compressible": false, + "extensions": ["odp"] + }, + "application/vnd.oasis.opendocument.presentation-template": { + "source": "iana", + "extensions": ["otp"] + }, + "application/vnd.oasis.opendocument.spreadsheet": { + "source": "iana", + "compressible": false, + "extensions": ["ods"] + }, + "application/vnd.oasis.opendocument.spreadsheet-template": { + "source": "iana", + "extensions": ["ots"] + }, + "application/vnd.oasis.opendocument.text": { + "source": "iana", + "compressible": false, + "extensions": ["odt"] + }, + "application/vnd.oasis.opendocument.text-master": { + "source": "iana", + "extensions": ["odm"] + }, + "application/vnd.oasis.opendocument.text-template": { + "source": "iana", + "extensions": ["ott"] + }, + "application/vnd.oasis.opendocument.text-web": { + "source": "iana", + "extensions": ["oth"] + }, + "application/vnd.obn": { + "source": "iana" + }, + "application/vnd.ocf+cbor": { + "source": "iana" + }, + "application/vnd.oci.image.manifest.v1+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oftn.l10n+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.contentaccessdownload+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.contentaccessstreaming+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.cspg-hexbinary": { + "source": "iana" + }, + "application/vnd.oipf.dae.svg+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.dae.xhtml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.mippvcontrolmessage+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.pae.gem": { + "source": "iana" + }, + "application/vnd.oipf.spdiscovery+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.spdlist+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.ueprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.userprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.olpc-sugar": { + "source": "iana", + "extensions": ["xo"] + }, + "application/vnd.oma-scws-config": { + "source": "iana" + }, + "application/vnd.oma-scws-http-request": { + "source": "iana" + }, + "application/vnd.oma-scws-http-response": { + "source": "iana" + }, + "application/vnd.oma.bcast.associated-procedure-parameter+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.drm-trigger+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.imd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.ltkm": { + "source": "iana" + }, + "application/vnd.oma.bcast.notification+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.provisioningtrigger": { + "source": "iana" + }, + "application/vnd.oma.bcast.sgboot": { + "source": "iana" + }, + "application/vnd.oma.bcast.sgdd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.sgdu": { + "source": "iana" + }, + "application/vnd.oma.bcast.simple-symbol-container": { + "source": "iana" + }, + "application/vnd.oma.bcast.smartcard-trigger+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.sprov+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.stkm": { + "source": "iana" + }, + "application/vnd.oma.cab-address-book+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-feature-handler+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-pcc+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-subs-invite+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-user-prefs+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.dcd": { + "source": "iana" + }, + "application/vnd.oma.dcdc": { + "source": "iana" + }, + "application/vnd.oma.dd2+xml": { + "source": "iana", + "compressible": true, + "extensions": ["dd2"] + }, + "application/vnd.oma.drm.risd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.group-usage-list+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.lwm2m+cbor": { + "source": "iana" + }, + "application/vnd.oma.lwm2m+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.lwm2m+tlv": { + "source": "iana" + }, + "application/vnd.oma.pal+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.detailed-progress-report+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.final-report+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.groups+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.invocation-descriptor+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.optimized-progress-report+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.push": { + "source": "iana" + }, + "application/vnd.oma.scidm.messages+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.xcap-directory+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.omads-email+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.omads-file+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.omads-folder+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.omaloc-supl-init": { + "source": "iana" + }, + "application/vnd.onepager": { + "source": "iana" + }, + "application/vnd.onepagertamp": { + "source": "iana" + }, + "application/vnd.onepagertamx": { + "source": "iana" + }, + "application/vnd.onepagertat": { + "source": "iana" + }, + "application/vnd.onepagertatp": { + "source": "iana" + }, + "application/vnd.onepagertatx": { + "source": "iana" + }, + "application/vnd.openblox.game+xml": { + "source": "iana", + "compressible": true, + "extensions": ["obgx"] + }, + "application/vnd.openblox.game-binary": { + "source": "iana" + }, + "application/vnd.openeye.oeb": { + "source": "iana" + }, + "application/vnd.openofficeorg.extension": { + "source": "apache", + "extensions": ["oxt"] + }, + "application/vnd.openstreetmap.data+xml": { + "source": "iana", + "compressible": true, + "extensions": ["osm"] + }, + "application/vnd.opentimestamps.ots": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.custom-properties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.customxmlproperties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawing+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.extended-properties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.comments+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation": { + "source": "iana", + "compressible": false, + "extensions": ["pptx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide": { + "source": "iana", + "extensions": ["sldx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow": { + "source": "iana", + "extensions": ["ppsx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.tags+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.template": { + "source": "iana", + "extensions": ["potx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { + "source": "iana", + "compressible": false, + "extensions": ["xlsx"] + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template": { + "source": "iana", + "extensions": ["xltx"] + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.theme+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.themeoverride+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.vmldrawing": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { + "source": "iana", + "compressible": false, + "extensions": ["docx"] + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template": { + "source": "iana", + "extensions": ["dotx"] + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-package.core-properties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-package.relationships+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oracle.resource+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.orange.indata": { + "source": "iana" + }, + "application/vnd.osa.netdeploy": { + "source": "iana" + }, + "application/vnd.osgeo.mapguide.package": { + "source": "iana", + "extensions": ["mgp"] + }, + "application/vnd.osgi.bundle": { + "source": "iana" + }, + "application/vnd.osgi.dp": { + "source": "iana", + "extensions": ["dp"] + }, + "application/vnd.osgi.subsystem": { + "source": "iana", + "extensions": ["esa"] + }, + "application/vnd.otps.ct-kip+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oxli.countgraph": { + "source": "iana" + }, + "application/vnd.pagerduty+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.palm": { + "source": "iana", + "extensions": ["pdb","pqa","oprc"] + }, + "application/vnd.panoply": { + "source": "iana" + }, + "application/vnd.paos.xml": { + "source": "iana" + }, + "application/vnd.patentdive": { + "source": "iana" + }, + "application/vnd.patientecommsdoc": { + "source": "iana" + }, + "application/vnd.pawaafile": { + "source": "iana", + "extensions": ["paw"] + }, + "application/vnd.pcos": { + "source": "iana" + }, + "application/vnd.pg.format": { + "source": "iana", + "extensions": ["str"] + }, + "application/vnd.pg.osasli": { + "source": "iana", + "extensions": ["ei6"] + }, + "application/vnd.piaccess.application-licence": { + "source": "iana" + }, + "application/vnd.picsel": { + "source": "iana", + "extensions": ["efif"] + }, + "application/vnd.pmi.widget": { + "source": "iana", + "extensions": ["wg"] + }, + "application/vnd.poc.group-advertisement+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.pocketlearn": { + "source": "iana", + "extensions": ["plf"] + }, + "application/vnd.powerbuilder6": { + "source": "iana", + "extensions": ["pbd"] + }, + "application/vnd.powerbuilder6-s": { + "source": "iana" + }, + "application/vnd.powerbuilder7": { + "source": "iana" + }, + "application/vnd.powerbuilder7-s": { + "source": "iana" + }, + "application/vnd.powerbuilder75": { + "source": "iana" + }, + "application/vnd.powerbuilder75-s": { + "source": "iana" + }, + "application/vnd.preminet": { + "source": "iana" + }, + "application/vnd.previewsystems.box": { + "source": "iana", + "extensions": ["box"] + }, + "application/vnd.proteus.magazine": { + "source": "iana", + "extensions": ["mgz"] + }, + "application/vnd.psfs": { + "source": "iana" + }, + "application/vnd.publishare-delta-tree": { + "source": "iana", + "extensions": ["qps"] + }, + "application/vnd.pvi.ptid1": { + "source": "iana", + "extensions": ["ptid"] + }, + "application/vnd.pwg-multiplexed": { + "source": "iana" + }, + "application/vnd.pwg-xhtml-print+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.qualcomm.brew-app-res": { + "source": "iana" + }, + "application/vnd.quarantainenet": { + "source": "iana" + }, + "application/vnd.quark.quarkxpress": { + "source": "iana", + "extensions": ["qxd","qxt","qwd","qwt","qxl","qxb"] + }, + "application/vnd.quobject-quoxdocument": { + "source": "iana" + }, + "application/vnd.radisys.moml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-conf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-conn+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-dialog+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-stream+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-conf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-base+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-fax-detect+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-fax-sendrecv+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-group+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-speech+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-transform+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.rainstor.data": { + "source": "iana" + }, + "application/vnd.rapid": { + "source": "iana" + }, + "application/vnd.rar": { + "source": "iana", + "extensions": ["rar"] + }, + "application/vnd.realvnc.bed": { + "source": "iana", + "extensions": ["bed"] + }, + "application/vnd.recordare.musicxml": { + "source": "iana", + "extensions": ["mxl"] + }, + "application/vnd.recordare.musicxml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["musicxml"] + }, + "application/vnd.renlearn.rlprint": { + "source": "iana" + }, + "application/vnd.resilient.logic": { + "source": "iana" + }, + "application/vnd.restful+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.rig.cryptonote": { + "source": "iana", + "extensions": ["cryptonote"] + }, + "application/vnd.rim.cod": { + "source": "apache", + "extensions": ["cod"] + }, + "application/vnd.rn-realmedia": { + "source": "apache", + "extensions": ["rm"] + }, + "application/vnd.rn-realmedia-vbr": { + "source": "apache", + "extensions": ["rmvb"] + }, + "application/vnd.route66.link66+xml": { + "source": "iana", + "compressible": true, + "extensions": ["link66"] + }, + "application/vnd.rs-274x": { + "source": "iana" + }, + "application/vnd.ruckus.download": { + "source": "iana" + }, + "application/vnd.s3sms": { + "source": "iana" + }, + "application/vnd.sailingtracker.track": { + "source": "iana", + "extensions": ["st"] + }, + "application/vnd.sar": { + "source": "iana" + }, + "application/vnd.sbm.cid": { + "source": "iana" + }, + "application/vnd.sbm.mid2": { + "source": "iana" + }, + "application/vnd.scribus": { + "source": "iana" + }, + "application/vnd.sealed.3df": { + "source": "iana" + }, + "application/vnd.sealed.csf": { + "source": "iana" + }, + "application/vnd.sealed.doc": { + "source": "iana" + }, + "application/vnd.sealed.eml": { + "source": "iana" + }, + "application/vnd.sealed.mht": { + "source": "iana" + }, + "application/vnd.sealed.net": { + "source": "iana" + }, + "application/vnd.sealed.ppt": { + "source": "iana" + }, + "application/vnd.sealed.tiff": { + "source": "iana" + }, + "application/vnd.sealed.xls": { + "source": "iana" + }, + "application/vnd.sealedmedia.softseal.html": { + "source": "iana" + }, + "application/vnd.sealedmedia.softseal.pdf": { + "source": "iana" + }, + "application/vnd.seemail": { + "source": "iana", + "extensions": ["see"] + }, + "application/vnd.seis+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.sema": { + "source": "iana", + "extensions": ["sema"] + }, + "application/vnd.semd": { + "source": "iana", + "extensions": ["semd"] + }, + "application/vnd.semf": { + "source": "iana", + "extensions": ["semf"] + }, + "application/vnd.shade-save-file": { + "source": "iana" + }, + "application/vnd.shana.informed.formdata": { + "source": "iana", + "extensions": ["ifm"] + }, + "application/vnd.shana.informed.formtemplate": { + "source": "iana", + "extensions": ["itp"] + }, + "application/vnd.shana.informed.interchange": { + "source": "iana", + "extensions": ["iif"] + }, + "application/vnd.shana.informed.package": { + "source": "iana", + "extensions": ["ipk"] + }, + "application/vnd.shootproof+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.shopkick+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.shp": { + "source": "iana" + }, + "application/vnd.shx": { + "source": "iana" + }, + "application/vnd.sigrok.session": { + "source": "iana" + }, + "application/vnd.simtech-mindmapper": { + "source": "iana", + "extensions": ["twd","twds"] + }, + "application/vnd.siren+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.smaf": { + "source": "iana", + "extensions": ["mmf"] + }, + "application/vnd.smart.notebook": { + "source": "iana" + }, + "application/vnd.smart.teacher": { + "source": "iana", + "extensions": ["teacher"] + }, + "application/vnd.snesdev-page-table": { + "source": "iana" + }, + "application/vnd.software602.filler.form+xml": { + "source": "iana", + "compressible": true, + "extensions": ["fo"] + }, + "application/vnd.software602.filler.form-xml-zip": { + "source": "iana" + }, + "application/vnd.solent.sdkm+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sdkm","sdkd"] + }, + "application/vnd.spotfire.dxp": { + "source": "iana", + "extensions": ["dxp"] + }, + "application/vnd.spotfire.sfs": { + "source": "iana", + "extensions": ["sfs"] + }, + "application/vnd.sqlite3": { + "source": "iana" + }, + "application/vnd.sss-cod": { + "source": "iana" + }, + "application/vnd.sss-dtf": { + "source": "iana" + }, + "application/vnd.sss-ntf": { + "source": "iana" + }, + "application/vnd.stardivision.calc": { + "source": "apache", + "extensions": ["sdc"] + }, + "application/vnd.stardivision.draw": { + "source": "apache", + "extensions": ["sda"] + }, + "application/vnd.stardivision.impress": { + "source": "apache", + "extensions": ["sdd"] + }, + "application/vnd.stardivision.math": { + "source": "apache", + "extensions": ["smf"] + }, + "application/vnd.stardivision.writer": { + "source": "apache", + "extensions": ["sdw","vor"] + }, + "application/vnd.stardivision.writer-global": { + "source": "apache", + "extensions": ["sgl"] + }, + "application/vnd.stepmania.package": { + "source": "iana", + "extensions": ["smzip"] + }, + "application/vnd.stepmania.stepchart": { + "source": "iana", + "extensions": ["sm"] + }, + "application/vnd.street-stream": { + "source": "iana" + }, + "application/vnd.sun.wadl+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wadl"] + }, + "application/vnd.sun.xml.calc": { + "source": "apache", + "extensions": ["sxc"] + }, + "application/vnd.sun.xml.calc.template": { + "source": "apache", + "extensions": ["stc"] + }, + "application/vnd.sun.xml.draw": { + "source": "apache", + "extensions": ["sxd"] + }, + "application/vnd.sun.xml.draw.template": { + "source": "apache", + "extensions": ["std"] + }, + "application/vnd.sun.xml.impress": { + "source": "apache", + "extensions": ["sxi"] + }, + "application/vnd.sun.xml.impress.template": { + "source": "apache", + "extensions": ["sti"] + }, + "application/vnd.sun.xml.math": { + "source": "apache", + "extensions": ["sxm"] + }, + "application/vnd.sun.xml.writer": { + "source": "apache", + "extensions": ["sxw"] + }, + "application/vnd.sun.xml.writer.global": { + "source": "apache", + "extensions": ["sxg"] + }, + "application/vnd.sun.xml.writer.template": { + "source": "apache", + "extensions": ["stw"] + }, + "application/vnd.sus-calendar": { + "source": "iana", + "extensions": ["sus","susp"] + }, + "application/vnd.svd": { + "source": "iana", + "extensions": ["svd"] + }, + "application/vnd.swiftview-ics": { + "source": "iana" + }, + "application/vnd.sycle+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.syft+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.symbian.install": { + "source": "apache", + "extensions": ["sis","sisx"] + }, + "application/vnd.syncml+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["xsm"] + }, + "application/vnd.syncml.dm+wbxml": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["bdm"] + }, + "application/vnd.syncml.dm+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["xdm"] + }, + "application/vnd.syncml.dm.notification": { + "source": "iana" + }, + "application/vnd.syncml.dmddf+wbxml": { + "source": "iana" + }, + "application/vnd.syncml.dmddf+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["ddf"] + }, + "application/vnd.syncml.dmtnds+wbxml": { + "source": "iana" + }, + "application/vnd.syncml.dmtnds+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.syncml.ds.notification": { + "source": "iana" + }, + "application/vnd.tableschema+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.tao.intent-module-archive": { + "source": "iana", + "extensions": ["tao"] + }, + "application/vnd.tcpdump.pcap": { + "source": "iana", + "extensions": ["pcap","cap","dmp"] + }, + "application/vnd.think-cell.ppttc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.tmd.mediaflex.api+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.tml": { + "source": "iana" + }, + "application/vnd.tmobile-livetv": { + "source": "iana", + "extensions": ["tmo"] + }, + "application/vnd.tri.onesource": { + "source": "iana" + }, + "application/vnd.trid.tpt": { + "source": "iana", + "extensions": ["tpt"] + }, + "application/vnd.triscape.mxs": { + "source": "iana", + "extensions": ["mxs"] + }, + "application/vnd.trueapp": { + "source": "iana", + "extensions": ["tra"] + }, + "application/vnd.truedoc": { + "source": "iana" + }, + "application/vnd.ubisoft.webplayer": { + "source": "iana" + }, + "application/vnd.ufdl": { + "source": "iana", + "extensions": ["ufd","ufdl"] + }, + "application/vnd.uiq.theme": { + "source": "iana", + "extensions": ["utz"] + }, + "application/vnd.umajin": { + "source": "iana", + "extensions": ["umj"] + }, + "application/vnd.unity": { + "source": "iana", + "extensions": ["unityweb"] + }, + "application/vnd.uoml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["uoml"] + }, + "application/vnd.uplanet.alert": { + "source": "iana" + }, + "application/vnd.uplanet.alert-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.bearer-choice": { + "source": "iana" + }, + "application/vnd.uplanet.bearer-choice-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.cacheop": { + "source": "iana" + }, + "application/vnd.uplanet.cacheop-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.channel": { + "source": "iana" + }, + "application/vnd.uplanet.channel-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.list": { + "source": "iana" + }, + "application/vnd.uplanet.list-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.listcmd": { + "source": "iana" + }, + "application/vnd.uplanet.listcmd-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.signal": { + "source": "iana" + }, + "application/vnd.uri-map": { + "source": "iana" + }, + "application/vnd.valve.source.material": { + "source": "iana" + }, + "application/vnd.vcx": { + "source": "iana", + "extensions": ["vcx"] + }, + "application/vnd.vd-study": { + "source": "iana" + }, + "application/vnd.vectorworks": { + "source": "iana" + }, + "application/vnd.vel+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.verimatrix.vcas": { + "source": "iana" + }, + "application/vnd.veritone.aion+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.veryant.thin": { + "source": "iana" + }, + "application/vnd.ves.encrypted": { + "source": "iana" + }, + "application/vnd.vidsoft.vidconference": { + "source": "iana" + }, + "application/vnd.visio": { + "source": "iana", + "extensions": ["vsd","vst","vss","vsw"] + }, + "application/vnd.visionary": { + "source": "iana", + "extensions": ["vis"] + }, + "application/vnd.vividence.scriptfile": { + "source": "iana" + }, + "application/vnd.vsf": { + "source": "iana", + "extensions": ["vsf"] + }, + "application/vnd.wap.sic": { + "source": "iana" + }, + "application/vnd.wap.slc": { + "source": "iana" + }, + "application/vnd.wap.wbxml": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["wbxml"] + }, + "application/vnd.wap.wmlc": { + "source": "iana", + "extensions": ["wmlc"] + }, + "application/vnd.wap.wmlscriptc": { + "source": "iana", + "extensions": ["wmlsc"] + }, + "application/vnd.webturbo": { + "source": "iana", + "extensions": ["wtb"] + }, + "application/vnd.wfa.dpp": { + "source": "iana" + }, + "application/vnd.wfa.p2p": { + "source": "iana" + }, + "application/vnd.wfa.wsc": { + "source": "iana" + }, + "application/vnd.windows.devicepairing": { + "source": "iana" + }, + "application/vnd.wmc": { + "source": "iana" + }, + "application/vnd.wmf.bootstrap": { + "source": "iana" + }, + "application/vnd.wolfram.mathematica": { + "source": "iana" + }, + "application/vnd.wolfram.mathematica.package": { + "source": "iana" + }, + "application/vnd.wolfram.player": { + "source": "iana", + "extensions": ["nbp"] + }, + "application/vnd.wordperfect": { + "source": "iana", + "extensions": ["wpd"] + }, + "application/vnd.wqd": { + "source": "iana", + "extensions": ["wqd"] + }, + "application/vnd.wrq-hp3000-labelled": { + "source": "iana" + }, + "application/vnd.wt.stf": { + "source": "iana", + "extensions": ["stf"] + }, + "application/vnd.wv.csp+wbxml": { + "source": "iana" + }, + "application/vnd.wv.csp+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.wv.ssp+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.xacml+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.xara": { + "source": "iana", + "extensions": ["xar"] + }, + "application/vnd.xfdl": { + "source": "iana", + "extensions": ["xfdl"] + }, + "application/vnd.xfdl.webform": { + "source": "iana" + }, + "application/vnd.xmi+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.xmpie.cpkg": { + "source": "iana" + }, + "application/vnd.xmpie.dpkg": { + "source": "iana" + }, + "application/vnd.xmpie.plan": { + "source": "iana" + }, + "application/vnd.xmpie.ppkg": { + "source": "iana" + }, + "application/vnd.xmpie.xlim": { + "source": "iana" + }, + "application/vnd.yamaha.hv-dic": { + "source": "iana", + "extensions": ["hvd"] + }, + "application/vnd.yamaha.hv-script": { + "source": "iana", + "extensions": ["hvs"] + }, + "application/vnd.yamaha.hv-voice": { + "source": "iana", + "extensions": ["hvp"] + }, + "application/vnd.yamaha.openscoreformat": { + "source": "iana", + "extensions": ["osf"] + }, + "application/vnd.yamaha.openscoreformat.osfpvg+xml": { + "source": "iana", + "compressible": true, + "extensions": ["osfpvg"] + }, + "application/vnd.yamaha.remote-setup": { + "source": "iana" + }, + "application/vnd.yamaha.smaf-audio": { + "source": "iana", + "extensions": ["saf"] + }, + "application/vnd.yamaha.smaf-phrase": { + "source": "iana", + "extensions": ["spf"] + }, + "application/vnd.yamaha.through-ngn": { + "source": "iana" + }, + "application/vnd.yamaha.tunnel-udpencap": { + "source": "iana" + }, + "application/vnd.yaoweme": { + "source": "iana" + }, + "application/vnd.yellowriver-custom-menu": { + "source": "iana", + "extensions": ["cmp"] + }, + "application/vnd.youtube.yt": { + "source": "iana" + }, + "application/vnd.zul": { + "source": "iana", + "extensions": ["zir","zirz"] + }, + "application/vnd.zzazz.deck+xml": { + "source": "iana", + "compressible": true, + "extensions": ["zaz"] + }, + "application/voicexml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["vxml"] + }, + "application/voucher-cms+json": { + "source": "iana", + "compressible": true + }, + "application/vq-rtcpxr": { + "source": "iana" + }, + "application/wasm": { + "source": "iana", + "compressible": true, + "extensions": ["wasm"] + }, + "application/watcherinfo+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wif"] + }, + "application/webpush-options+json": { + "source": "iana", + "compressible": true + }, + "application/whoispp-query": { + "source": "iana" + }, + "application/whoispp-response": { + "source": "iana" + }, + "application/widget": { + "source": "iana", + "extensions": ["wgt"] + }, + "application/winhlp": { + "source": "apache", + "extensions": ["hlp"] + }, + "application/wita": { + "source": "iana" + }, + "application/wordperfect5.1": { + "source": "iana" + }, + "application/wsdl+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wsdl"] + }, + "application/wspolicy+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wspolicy"] + }, + "application/x-7z-compressed": { + "source": "apache", + "compressible": false, + "extensions": ["7z"] + }, + "application/x-abiword": { + "source": "apache", + "extensions": ["abw"] + }, + "application/x-ace-compressed": { + "source": "apache", + "extensions": ["ace"] + }, + "application/x-amf": { + "source": "apache" + }, + "application/x-apple-diskimage": { + "source": "apache", + "extensions": ["dmg"] + }, + "application/x-arj": { + "compressible": false, + "extensions": ["arj"] + }, + "application/x-authorware-bin": { + "source": "apache", + "extensions": ["aab","x32","u32","vox"] + }, + "application/x-authorware-map": { + "source": "apache", + "extensions": ["aam"] + }, + "application/x-authorware-seg": { + "source": "apache", + "extensions": ["aas"] + }, + "application/x-bcpio": { + "source": "apache", + "extensions": ["bcpio"] + }, + "application/x-bdoc": { + "compressible": false, + "extensions": ["bdoc"] + }, + "application/x-bittorrent": { + "source": "apache", + "extensions": ["torrent"] + }, + "application/x-blorb": { + "source": "apache", + "extensions": ["blb","blorb"] + }, + "application/x-bzip": { + "source": "apache", + "compressible": false, + "extensions": ["bz"] + }, + "application/x-bzip2": { + "source": "apache", + "compressible": false, + "extensions": ["bz2","boz"] + }, + "application/x-cbr": { + "source": "apache", + "extensions": ["cbr","cba","cbt","cbz","cb7"] + }, + "application/x-cdlink": { + "source": "apache", + "extensions": ["vcd"] + }, + "application/x-cfs-compressed": { + "source": "apache", + "extensions": ["cfs"] + }, + "application/x-chat": { + "source": "apache", + "extensions": ["chat"] + }, + "application/x-chess-pgn": { + "source": "apache", + "extensions": ["pgn"] + }, + "application/x-chrome-extension": { + "extensions": ["crx"] + }, + "application/x-cocoa": { + "source": "nginx", + "extensions": ["cco"] + }, + "application/x-compress": { + "source": "apache" + }, + "application/x-conference": { + "source": "apache", + "extensions": ["nsc"] + }, + "application/x-cpio": { + "source": "apache", + "extensions": ["cpio"] + }, + "application/x-csh": { + "source": "apache", + "extensions": ["csh"] + }, + "application/x-deb": { + "compressible": false + }, + "application/x-debian-package": { + "source": "apache", + "extensions": ["deb","udeb"] + }, + "application/x-dgc-compressed": { + "source": "apache", + "extensions": ["dgc"] + }, + "application/x-director": { + "source": "apache", + "extensions": ["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"] + }, + "application/x-doom": { + "source": "apache", + "extensions": ["wad"] + }, + "application/x-dtbncx+xml": { + "source": "apache", + "compressible": true, + "extensions": ["ncx"] + }, + "application/x-dtbook+xml": { + "source": "apache", + "compressible": true, + "extensions": ["dtb"] + }, + "application/x-dtbresource+xml": { + "source": "apache", + "compressible": true, + "extensions": ["res"] + }, + "application/x-dvi": { + "source": "apache", + "compressible": false, + "extensions": ["dvi"] + }, + "application/x-envoy": { + "source": "apache", + "extensions": ["evy"] + }, + "application/x-eva": { + "source": "apache", + "extensions": ["eva"] + }, + "application/x-font-bdf": { + "source": "apache", + "extensions": ["bdf"] + }, + "application/x-font-dos": { + "source": "apache" + }, + "application/x-font-framemaker": { + "source": "apache" + }, + "application/x-font-ghostscript": { + "source": "apache", + "extensions": ["gsf"] + }, + "application/x-font-libgrx": { + "source": "apache" + }, + "application/x-font-linux-psf": { + "source": "apache", + "extensions": ["psf"] + }, + "application/x-font-pcf": { + "source": "apache", + "extensions": ["pcf"] + }, + "application/x-font-snf": { + "source": "apache", + "extensions": ["snf"] + }, + "application/x-font-speedo": { + "source": "apache" + }, + "application/x-font-sunos-news": { + "source": "apache" + }, + "application/x-font-type1": { + "source": "apache", + "extensions": ["pfa","pfb","pfm","afm"] + }, + "application/x-font-vfont": { + "source": "apache" + }, + "application/x-freearc": { + "source": "apache", + "extensions": ["arc"] + }, + "application/x-futuresplash": { + "source": "apache", + "extensions": ["spl"] + }, + "application/x-gca-compressed": { + "source": "apache", + "extensions": ["gca"] + }, + "application/x-glulx": { + "source": "apache", + "extensions": ["ulx"] + }, + "application/x-gnumeric": { + "source": "apache", + "extensions": ["gnumeric"] + }, + "application/x-gramps-xml": { + "source": "apache", + "extensions": ["gramps"] + }, + "application/x-gtar": { + "source": "apache", + "extensions": ["gtar"] + }, + "application/x-gzip": { + "source": "apache" + }, + "application/x-hdf": { + "source": "apache", + "extensions": ["hdf"] + }, + "application/x-httpd-php": { + "compressible": true, + "extensions": ["php"] + }, + "application/x-install-instructions": { + "source": "apache", + "extensions": ["install"] + }, + "application/x-iso9660-image": { + "source": "apache", + "extensions": ["iso"] + }, + "application/x-iwork-keynote-sffkey": { + "extensions": ["key"] + }, + "application/x-iwork-numbers-sffnumbers": { + "extensions": ["numbers"] + }, + "application/x-iwork-pages-sffpages": { + "extensions": ["pages"] + }, + "application/x-java-archive-diff": { + "source": "nginx", + "extensions": ["jardiff"] + }, + "application/x-java-jnlp-file": { + "source": "apache", + "compressible": false, + "extensions": ["jnlp"] + }, + "application/x-javascript": { + "compressible": true + }, + "application/x-keepass2": { + "extensions": ["kdbx"] + }, + "application/x-latex": { + "source": "apache", + "compressible": false, + "extensions": ["latex"] + }, + "application/x-lua-bytecode": { + "extensions": ["luac"] + }, + "application/x-lzh-compressed": { + "source": "apache", + "extensions": ["lzh","lha"] + }, + "application/x-makeself": { + "source": "nginx", + "extensions": ["run"] + }, + "application/x-mie": { + "source": "apache", + "extensions": ["mie"] + }, + "application/x-mobipocket-ebook": { + "source": "apache", + "extensions": ["prc","mobi"] + }, + "application/x-mpegurl": { + "compressible": false + }, + "application/x-ms-application": { + "source": "apache", + "extensions": ["application"] + }, + "application/x-ms-shortcut": { + "source": "apache", + "extensions": ["lnk"] + }, + "application/x-ms-wmd": { + "source": "apache", + "extensions": ["wmd"] + }, + "application/x-ms-wmz": { + "source": "apache", + "extensions": ["wmz"] + }, + "application/x-ms-xbap": { + "source": "apache", + "extensions": ["xbap"] + }, + "application/x-msaccess": { + "source": "apache", + "extensions": ["mdb"] + }, + "application/x-msbinder": { + "source": "apache", + "extensions": ["obd"] + }, + "application/x-mscardfile": { + "source": "apache", + "extensions": ["crd"] + }, + "application/x-msclip": { + "source": "apache", + "extensions": ["clp"] + }, + "application/x-msdos-program": { + "extensions": ["exe"] + }, + "application/x-msdownload": { + "source": "apache", + "extensions": ["exe","dll","com","bat","msi"] + }, + "application/x-msmediaview": { + "source": "apache", + "extensions": ["mvb","m13","m14"] + }, + "application/x-msmetafile": { + "source": "apache", + "extensions": ["wmf","wmz","emf","emz"] + }, + "application/x-msmoney": { + "source": "apache", + "extensions": ["mny"] + }, + "application/x-mspublisher": { + "source": "apache", + "extensions": ["pub"] + }, + "application/x-msschedule": { + "source": "apache", + "extensions": ["scd"] + }, + "application/x-msterminal": { + "source": "apache", + "extensions": ["trm"] + }, + "application/x-mswrite": { + "source": "apache", + "extensions": ["wri"] + }, + "application/x-netcdf": { + "source": "apache", + "extensions": ["nc","cdf"] + }, + "application/x-ns-proxy-autoconfig": { + "compressible": true, + "extensions": ["pac"] + }, + "application/x-nzb": { + "source": "apache", + "extensions": ["nzb"] + }, + "application/x-perl": { + "source": "nginx", + "extensions": ["pl","pm"] + }, + "application/x-pilot": { + "source": "nginx", + "extensions": ["prc","pdb"] + }, + "application/x-pkcs12": { + "source": "apache", + "compressible": false, + "extensions": ["p12","pfx"] + }, + "application/x-pkcs7-certificates": { + "source": "apache", + "extensions": ["p7b","spc"] + }, + "application/x-pkcs7-certreqresp": { + "source": "apache", + "extensions": ["p7r"] + }, + "application/x-pki-message": { + "source": "iana" + }, + "application/x-rar-compressed": { + "source": "apache", + "compressible": false, + "extensions": ["rar"] + }, + "application/x-redhat-package-manager": { + "source": "nginx", + "extensions": ["rpm"] + }, + "application/x-research-info-systems": { + "source": "apache", + "extensions": ["ris"] + }, + "application/x-sea": { + "source": "nginx", + "extensions": ["sea"] + }, + "application/x-sh": { + "source": "apache", + "compressible": true, + "extensions": ["sh"] + }, + "application/x-shar": { + "source": "apache", + "extensions": ["shar"] + }, + "application/x-shockwave-flash": { + "source": "apache", + "compressible": false, + "extensions": ["swf"] + }, + "application/x-silverlight-app": { + "source": "apache", + "extensions": ["xap"] + }, + "application/x-sql": { + "source": "apache", + "extensions": ["sql"] + }, + "application/x-stuffit": { + "source": "apache", + "compressible": false, + "extensions": ["sit"] + }, + "application/x-stuffitx": { + "source": "apache", + "extensions": ["sitx"] + }, + "application/x-subrip": { + "source": "apache", + "extensions": ["srt"] + }, + "application/x-sv4cpio": { + "source": "apache", + "extensions": ["sv4cpio"] + }, + "application/x-sv4crc": { + "source": "apache", + "extensions": ["sv4crc"] + }, + "application/x-t3vm-image": { + "source": "apache", + "extensions": ["t3"] + }, + "application/x-tads": { + "source": "apache", + "extensions": ["gam"] + }, + "application/x-tar": { + "source": "apache", + "compressible": true, + "extensions": ["tar"] + }, + "application/x-tcl": { + "source": "apache", + "extensions": ["tcl","tk"] + }, + "application/x-tex": { + "source": "apache", + "extensions": ["tex"] + }, + "application/x-tex-tfm": { + "source": "apache", + "extensions": ["tfm"] + }, + "application/x-texinfo": { + "source": "apache", + "extensions": ["texinfo","texi"] + }, + "application/x-tgif": { + "source": "apache", + "extensions": ["obj"] + }, + "application/x-ustar": { + "source": "apache", + "extensions": ["ustar"] + }, + "application/x-virtualbox-hdd": { + "compressible": true, + "extensions": ["hdd"] + }, + "application/x-virtualbox-ova": { + "compressible": true, + "extensions": ["ova"] + }, + "application/x-virtualbox-ovf": { + "compressible": true, + "extensions": ["ovf"] + }, + "application/x-virtualbox-vbox": { + "compressible": true, + "extensions": ["vbox"] + }, + "application/x-virtualbox-vbox-extpack": { + "compressible": false, + "extensions": ["vbox-extpack"] + }, + "application/x-virtualbox-vdi": { + "compressible": true, + "extensions": ["vdi"] + }, + "application/x-virtualbox-vhd": { + "compressible": true, + "extensions": ["vhd"] + }, + "application/x-virtualbox-vmdk": { + "compressible": true, + "extensions": ["vmdk"] + }, + "application/x-wais-source": { + "source": "apache", + "extensions": ["src"] + }, + "application/x-web-app-manifest+json": { + "compressible": true, + "extensions": ["webapp"] + }, + "application/x-www-form-urlencoded": { + "source": "iana", + "compressible": true + }, + "application/x-x509-ca-cert": { + "source": "iana", + "extensions": ["der","crt","pem"] + }, + "application/x-x509-ca-ra-cert": { + "source": "iana" + }, + "application/x-x509-next-ca-cert": { + "source": "iana" + }, + "application/x-xfig": { + "source": "apache", + "extensions": ["fig"] + }, + "application/x-xliff+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xlf"] + }, + "application/x-xpinstall": { + "source": "apache", + "compressible": false, + "extensions": ["xpi"] + }, + "application/x-xz": { + "source": "apache", + "extensions": ["xz"] + }, + "application/x-zmachine": { + "source": "apache", + "extensions": ["z1","z2","z3","z4","z5","z6","z7","z8"] + }, + "application/x400-bp": { + "source": "iana" + }, + "application/xacml+xml": { + "source": "iana", + "compressible": true + }, + "application/xaml+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xaml"] + }, + "application/xcap-att+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xav"] + }, + "application/xcap-caps+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xca"] + }, + "application/xcap-diff+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xdf"] + }, + "application/xcap-el+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xel"] + }, + "application/xcap-error+xml": { + "source": "iana", + "compressible": true + }, + "application/xcap-ns+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xns"] + }, + "application/xcon-conference-info+xml": { + "source": "iana", + "compressible": true + }, + "application/xcon-conference-info-diff+xml": { + "source": "iana", + "compressible": true + }, + "application/xenc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xenc"] + }, + "application/xhtml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xhtml","xht"] + }, + "application/xhtml-voice+xml": { + "source": "apache", + "compressible": true + }, + "application/xliff+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xlf"] + }, + "application/xml": { + "source": "iana", + "compressible": true, + "extensions": ["xml","xsl","xsd","rng"] + }, + "application/xml-dtd": { + "source": "iana", + "compressible": true, + "extensions": ["dtd"] + }, + "application/xml-external-parsed-entity": { + "source": "iana" + }, + "application/xml-patch+xml": { + "source": "iana", + "compressible": true + }, + "application/xmpp+xml": { + "source": "iana", + "compressible": true + }, + "application/xop+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xop"] + }, + "application/xproc+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xpl"] + }, + "application/xslt+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xsl","xslt"] + }, + "application/xspf+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xspf"] + }, + "application/xv+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mxml","xhvml","xvml","xvm"] + }, + "application/yang": { + "source": "iana", + "extensions": ["yang"] + }, + "application/yang-data+json": { + "source": "iana", + "compressible": true + }, + "application/yang-data+xml": { + "source": "iana", + "compressible": true + }, + "application/yang-patch+json": { + "source": "iana", + "compressible": true + }, + "application/yang-patch+xml": { + "source": "iana", + "compressible": true + }, + "application/yin+xml": { + "source": "iana", + "compressible": true, + "extensions": ["yin"] + }, + "application/zip": { + "source": "iana", + "compressible": false, + "extensions": ["zip"] + }, + "application/zlib": { + "source": "iana" + }, + "application/zstd": { + "source": "iana" + }, + "audio/1d-interleaved-parityfec": { + "source": "iana" + }, + "audio/32kadpcm": { + "source": "iana" + }, + "audio/3gpp": { + "source": "iana", + "compressible": false, + "extensions": ["3gpp"] + }, + "audio/3gpp2": { + "source": "iana" + }, + "audio/aac": { + "source": "iana" + }, + "audio/ac3": { + "source": "iana" + }, + "audio/adpcm": { + "source": "apache", + "extensions": ["adp"] + }, + "audio/amr": { + "source": "iana", + "extensions": ["amr"] + }, + "audio/amr-wb": { + "source": "iana" + }, + "audio/amr-wb+": { + "source": "iana" + }, + "audio/aptx": { + "source": "iana" + }, + "audio/asc": { + "source": "iana" + }, + "audio/atrac-advanced-lossless": { + "source": "iana" + }, + "audio/atrac-x": { + "source": "iana" + }, + "audio/atrac3": { + "source": "iana" + }, + "audio/basic": { + "source": "iana", + "compressible": false, + "extensions": ["au","snd"] + }, + "audio/bv16": { + "source": "iana" + }, + "audio/bv32": { + "source": "iana" + }, + "audio/clearmode": { + "source": "iana" + }, + "audio/cn": { + "source": "iana" + }, + "audio/dat12": { + "source": "iana" + }, + "audio/dls": { + "source": "iana" + }, + "audio/dsr-es201108": { + "source": "iana" + }, + "audio/dsr-es202050": { + "source": "iana" + }, + "audio/dsr-es202211": { + "source": "iana" + }, + "audio/dsr-es202212": { + "source": "iana" + }, + "audio/dv": { + "source": "iana" + }, + "audio/dvi4": { + "source": "iana" + }, + "audio/eac3": { + "source": "iana" + }, + "audio/encaprtp": { + "source": "iana" + }, + "audio/evrc": { + "source": "iana" + }, + "audio/evrc-qcp": { + "source": "iana" + }, + "audio/evrc0": { + "source": "iana" + }, + "audio/evrc1": { + "source": "iana" + }, + "audio/evrcb": { + "source": "iana" + }, + "audio/evrcb0": { + "source": "iana" + }, + "audio/evrcb1": { + "source": "iana" + }, + "audio/evrcnw": { + "source": "iana" + }, + "audio/evrcnw0": { + "source": "iana" + }, + "audio/evrcnw1": { + "source": "iana" + }, + "audio/evrcwb": { + "source": "iana" + }, + "audio/evrcwb0": { + "source": "iana" + }, + "audio/evrcwb1": { + "source": "iana" + }, + "audio/evs": { + "source": "iana" + }, + "audio/flexfec": { + "source": "iana" + }, + "audio/fwdred": { + "source": "iana" + }, + "audio/g711-0": { + "source": "iana" + }, + "audio/g719": { + "source": "iana" + }, + "audio/g722": { + "source": "iana" + }, + "audio/g7221": { + "source": "iana" + }, + "audio/g723": { + "source": "iana" + }, + "audio/g726-16": { + "source": "iana" + }, + "audio/g726-24": { + "source": "iana" + }, + "audio/g726-32": { + "source": "iana" + }, + "audio/g726-40": { + "source": "iana" + }, + "audio/g728": { + "source": "iana" + }, + "audio/g729": { + "source": "iana" + }, + "audio/g7291": { + "source": "iana" + }, + "audio/g729d": { + "source": "iana" + }, + "audio/g729e": { + "source": "iana" + }, + "audio/gsm": { + "source": "iana" + }, + "audio/gsm-efr": { + "source": "iana" + }, + "audio/gsm-hr-08": { + "source": "iana" + }, + "audio/ilbc": { + "source": "iana" + }, + "audio/ip-mr_v2.5": { + "source": "iana" + }, + "audio/isac": { + "source": "apache" + }, + "audio/l16": { + "source": "iana" + }, + "audio/l20": { + "source": "iana" + }, + "audio/l24": { + "source": "iana", + "compressible": false + }, + "audio/l8": { + "source": "iana" + }, + "audio/lpc": { + "source": "iana" + }, + "audio/melp": { + "source": "iana" + }, + "audio/melp1200": { + "source": "iana" + }, + "audio/melp2400": { + "source": "iana" + }, + "audio/melp600": { + "source": "iana" + }, + "audio/mhas": { + "source": "iana" + }, + "audio/midi": { + "source": "apache", + "extensions": ["mid","midi","kar","rmi"] + }, + "audio/mobile-xmf": { + "source": "iana", + "extensions": ["mxmf"] + }, + "audio/mp3": { + "compressible": false, + "extensions": ["mp3"] + }, + "audio/mp4": { + "source": "iana", + "compressible": false, + "extensions": ["m4a","mp4a"] + }, + "audio/mp4a-latm": { + "source": "iana" + }, + "audio/mpa": { + "source": "iana" + }, + "audio/mpa-robust": { + "source": "iana" + }, + "audio/mpeg": { + "source": "iana", + "compressible": false, + "extensions": ["mpga","mp2","mp2a","mp3","m2a","m3a"] + }, + "audio/mpeg4-generic": { + "source": "iana" + }, + "audio/musepack": { + "source": "apache" + }, + "audio/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["oga","ogg","spx","opus"] + }, + "audio/opus": { + "source": "iana" + }, + "audio/parityfec": { + "source": "iana" + }, + "audio/pcma": { + "source": "iana" + }, + "audio/pcma-wb": { + "source": "iana" + }, + "audio/pcmu": { + "source": "iana" + }, + "audio/pcmu-wb": { + "source": "iana" + }, + "audio/prs.sid": { + "source": "iana" + }, + "audio/qcelp": { + "source": "iana" + }, + "audio/raptorfec": { + "source": "iana" + }, + "audio/red": { + "source": "iana" + }, + "audio/rtp-enc-aescm128": { + "source": "iana" + }, + "audio/rtp-midi": { + "source": "iana" + }, + "audio/rtploopback": { + "source": "iana" + }, + "audio/rtx": { + "source": "iana" + }, + "audio/s3m": { + "source": "apache", + "extensions": ["s3m"] + }, + "audio/scip": { + "source": "iana" + }, + "audio/silk": { + "source": "apache", + "extensions": ["sil"] + }, + "audio/smv": { + "source": "iana" + }, + "audio/smv-qcp": { + "source": "iana" + }, + "audio/smv0": { + "source": "iana" + }, + "audio/sofa": { + "source": "iana" + }, + "audio/sp-midi": { + "source": "iana" + }, + "audio/speex": { + "source": "iana" + }, + "audio/t140c": { + "source": "iana" + }, + "audio/t38": { + "source": "iana" + }, + "audio/telephone-event": { + "source": "iana" + }, + "audio/tetra_acelp": { + "source": "iana" + }, + "audio/tetra_acelp_bb": { + "source": "iana" + }, + "audio/tone": { + "source": "iana" + }, + "audio/tsvcis": { + "source": "iana" + }, + "audio/uemclip": { + "source": "iana" + }, + "audio/ulpfec": { + "source": "iana" + }, + "audio/usac": { + "source": "iana" + }, + "audio/vdvi": { + "source": "iana" + }, + "audio/vmr-wb": { + "source": "iana" + }, + "audio/vnd.3gpp.iufp": { + "source": "iana" + }, + "audio/vnd.4sb": { + "source": "iana" + }, + "audio/vnd.audiokoz": { + "source": "iana" + }, + "audio/vnd.celp": { + "source": "iana" + }, + "audio/vnd.cisco.nse": { + "source": "iana" + }, + "audio/vnd.cmles.radio-events": { + "source": "iana" + }, + "audio/vnd.cns.anp1": { + "source": "iana" + }, + "audio/vnd.cns.inf1": { + "source": "iana" + }, + "audio/vnd.dece.audio": { + "source": "iana", + "extensions": ["uva","uvva"] + }, + "audio/vnd.digital-winds": { + "source": "iana", + "extensions": ["eol"] + }, + "audio/vnd.dlna.adts": { + "source": "iana" + }, + "audio/vnd.dolby.heaac.1": { + "source": "iana" + }, + "audio/vnd.dolby.heaac.2": { + "source": "iana" + }, + "audio/vnd.dolby.mlp": { + "source": "iana" + }, + "audio/vnd.dolby.mps": { + "source": "iana" + }, + "audio/vnd.dolby.pl2": { + "source": "iana" + }, + "audio/vnd.dolby.pl2x": { + "source": "iana" + }, + "audio/vnd.dolby.pl2z": { + "source": "iana" + }, + "audio/vnd.dolby.pulse.1": { + "source": "iana" + }, + "audio/vnd.dra": { + "source": "iana", + "extensions": ["dra"] + }, + "audio/vnd.dts": { + "source": "iana", + "extensions": ["dts"] + }, + "audio/vnd.dts.hd": { + "source": "iana", + "extensions": ["dtshd"] + }, + "audio/vnd.dts.uhd": { + "source": "iana" + }, + "audio/vnd.dvb.file": { + "source": "iana" + }, + "audio/vnd.everad.plj": { + "source": "iana" + }, + "audio/vnd.hns.audio": { + "source": "iana" + }, + "audio/vnd.lucent.voice": { + "source": "iana", + "extensions": ["lvp"] + }, + "audio/vnd.ms-playready.media.pya": { + "source": "iana", + "extensions": ["pya"] + }, + "audio/vnd.nokia.mobile-xmf": { + "source": "iana" + }, + "audio/vnd.nortel.vbk": { + "source": "iana" + }, + "audio/vnd.nuera.ecelp4800": { + "source": "iana", + "extensions": ["ecelp4800"] + }, + "audio/vnd.nuera.ecelp7470": { + "source": "iana", + "extensions": ["ecelp7470"] + }, + "audio/vnd.nuera.ecelp9600": { + "source": "iana", + "extensions": ["ecelp9600"] + }, + "audio/vnd.octel.sbc": { + "source": "iana" + }, + "audio/vnd.presonus.multitrack": { + "source": "iana" + }, + "audio/vnd.qcelp": { + "source": "iana" + }, + "audio/vnd.rhetorex.32kadpcm": { + "source": "iana" + }, + "audio/vnd.rip": { + "source": "iana", + "extensions": ["rip"] + }, + "audio/vnd.rn-realaudio": { + "compressible": false + }, + "audio/vnd.sealedmedia.softseal.mpeg": { + "source": "iana" + }, + "audio/vnd.vmx.cvsd": { + "source": "iana" + }, + "audio/vnd.wave": { + "compressible": false + }, + "audio/vorbis": { + "source": "iana", + "compressible": false + }, + "audio/vorbis-config": { + "source": "iana" + }, + "audio/wav": { + "compressible": false, + "extensions": ["wav"] + }, + "audio/wave": { + "compressible": false, + "extensions": ["wav"] + }, + "audio/webm": { + "source": "apache", + "compressible": false, + "extensions": ["weba"] + }, + "audio/x-aac": { + "source": "apache", + "compressible": false, + "extensions": ["aac"] + }, + "audio/x-aiff": { + "source": "apache", + "extensions": ["aif","aiff","aifc"] + }, + "audio/x-caf": { + "source": "apache", + "compressible": false, + "extensions": ["caf"] + }, + "audio/x-flac": { + "source": "apache", + "extensions": ["flac"] + }, + "audio/x-m4a": { + "source": "nginx", + "extensions": ["m4a"] + }, + "audio/x-matroska": { + "source": "apache", + "extensions": ["mka"] + }, + "audio/x-mpegurl": { + "source": "apache", + "extensions": ["m3u"] + }, + "audio/x-ms-wax": { + "source": "apache", + "extensions": ["wax"] + }, + "audio/x-ms-wma": { + "source": "apache", + "extensions": ["wma"] + }, + "audio/x-pn-realaudio": { + "source": "apache", + "extensions": ["ram","ra"] + }, + "audio/x-pn-realaudio-plugin": { + "source": "apache", + "extensions": ["rmp"] + }, + "audio/x-realaudio": { + "source": "nginx", + "extensions": ["ra"] + }, + "audio/x-tta": { + "source": "apache" + }, + "audio/x-wav": { + "source": "apache", + "extensions": ["wav"] + }, + "audio/xm": { + "source": "apache", + "extensions": ["xm"] + }, + "chemical/x-cdx": { + "source": "apache", + "extensions": ["cdx"] + }, + "chemical/x-cif": { + "source": "apache", + "extensions": ["cif"] + }, + "chemical/x-cmdf": { + "source": "apache", + "extensions": ["cmdf"] + }, + "chemical/x-cml": { + "source": "apache", + "extensions": ["cml"] + }, + "chemical/x-csml": { + "source": "apache", + "extensions": ["csml"] + }, + "chemical/x-pdb": { + "source": "apache" + }, + "chemical/x-xyz": { + "source": "apache", + "extensions": ["xyz"] + }, + "font/collection": { + "source": "iana", + "extensions": ["ttc"] + }, + "font/otf": { + "source": "iana", + "compressible": true, + "extensions": ["otf"] + }, + "font/sfnt": { + "source": "iana" + }, + "font/ttf": { + "source": "iana", + "compressible": true, + "extensions": ["ttf"] + }, + "font/woff": { + "source": "iana", + "extensions": ["woff"] + }, + "font/woff2": { + "source": "iana", + "extensions": ["woff2"] + }, + "image/aces": { + "source": "iana", + "extensions": ["exr"] + }, + "image/apng": { + "compressible": false, + "extensions": ["apng"] + }, + "image/avci": { + "source": "iana", + "extensions": ["avci"] + }, + "image/avcs": { + "source": "iana", + "extensions": ["avcs"] + }, + "image/avif": { + "source": "iana", + "compressible": false, + "extensions": ["avif"] + }, + "image/bmp": { + "source": "iana", + "compressible": true, + "extensions": ["bmp"] + }, + "image/cgm": { + "source": "iana", + "extensions": ["cgm"] + }, + "image/dicom-rle": { + "source": "iana", + "extensions": ["drle"] + }, + "image/emf": { + "source": "iana", + "extensions": ["emf"] + }, + "image/fits": { + "source": "iana", + "extensions": ["fits"] + }, + "image/g3fax": { + "source": "iana", + "extensions": ["g3"] + }, + "image/gif": { + "source": "iana", + "compressible": false, + "extensions": ["gif"] + }, + "image/heic": { + "source": "iana", + "extensions": ["heic"] + }, + "image/heic-sequence": { + "source": "iana", + "extensions": ["heics"] + }, + "image/heif": { + "source": "iana", + "extensions": ["heif"] + }, + "image/heif-sequence": { + "source": "iana", + "extensions": ["heifs"] + }, + "image/hej2k": { + "source": "iana", + "extensions": ["hej2"] + }, + "image/hsj2": { + "source": "iana", + "extensions": ["hsj2"] + }, + "image/ief": { + "source": "iana", + "extensions": ["ief"] + }, + "image/jls": { + "source": "iana", + "extensions": ["jls"] + }, + "image/jp2": { + "source": "iana", + "compressible": false, + "extensions": ["jp2","jpg2"] + }, + "image/jpeg": { + "source": "iana", + "compressible": false, + "extensions": ["jpeg","jpg","jpe"] + }, + "image/jph": { + "source": "iana", + "extensions": ["jph"] + }, + "image/jphc": { + "source": "iana", + "extensions": ["jhc"] + }, + "image/jpm": { + "source": "iana", + "compressible": false, + "extensions": ["jpm"] + }, + "image/jpx": { + "source": "iana", + "compressible": false, + "extensions": ["jpx","jpf"] + }, + "image/jxr": { + "source": "iana", + "extensions": ["jxr"] + }, + "image/jxra": { + "source": "iana", + "extensions": ["jxra"] + }, + "image/jxrs": { + "source": "iana", + "extensions": ["jxrs"] + }, + "image/jxs": { + "source": "iana", + "extensions": ["jxs"] + }, + "image/jxsc": { + "source": "iana", + "extensions": ["jxsc"] + }, + "image/jxsi": { + "source": "iana", + "extensions": ["jxsi"] + }, + "image/jxss": { + "source": "iana", + "extensions": ["jxss"] + }, + "image/ktx": { + "source": "iana", + "extensions": ["ktx"] + }, + "image/ktx2": { + "source": "iana", + "extensions": ["ktx2"] + }, + "image/naplps": { + "source": "iana" + }, + "image/pjpeg": { + "compressible": false + }, + "image/png": { + "source": "iana", + "compressible": false, + "extensions": ["png"] + }, + "image/prs.btif": { + "source": "iana", + "extensions": ["btif"] + }, + "image/prs.pti": { + "source": "iana", + "extensions": ["pti"] + }, + "image/pwg-raster": { + "source": "iana" + }, + "image/sgi": { + "source": "apache", + "extensions": ["sgi"] + }, + "image/svg+xml": { + "source": "iana", + "compressible": true, + "extensions": ["svg","svgz"] + }, + "image/t38": { + "source": "iana", + "extensions": ["t38"] + }, + "image/tiff": { + "source": "iana", + "compressible": false, + "extensions": ["tif","tiff"] + }, + "image/tiff-fx": { + "source": "iana", + "extensions": ["tfx"] + }, + "image/vnd.adobe.photoshop": { + "source": "iana", + "compressible": true, + "extensions": ["psd"] + }, + "image/vnd.airzip.accelerator.azv": { + "source": "iana", + "extensions": ["azv"] + }, + "image/vnd.cns.inf2": { + "source": "iana" + }, + "image/vnd.dece.graphic": { + "source": "iana", + "extensions": ["uvi","uvvi","uvg","uvvg"] + }, + "image/vnd.djvu": { + "source": "iana", + "extensions": ["djvu","djv"] + }, + "image/vnd.dvb.subtitle": { + "source": "iana", + "extensions": ["sub"] + }, + "image/vnd.dwg": { + "source": "iana", + "extensions": ["dwg"] + }, + "image/vnd.dxf": { + "source": "iana", + "extensions": ["dxf"] + }, + "image/vnd.fastbidsheet": { + "source": "iana", + "extensions": ["fbs"] + }, + "image/vnd.fpx": { + "source": "iana", + "extensions": ["fpx"] + }, + "image/vnd.fst": { + "source": "iana", + "extensions": ["fst"] + }, + "image/vnd.fujixerox.edmics-mmr": { + "source": "iana", + "extensions": ["mmr"] + }, + "image/vnd.fujixerox.edmics-rlc": { + "source": "iana", + "extensions": ["rlc"] + }, + "image/vnd.globalgraphics.pgb": { + "source": "iana" + }, + "image/vnd.microsoft.icon": { + "source": "iana", + "compressible": true, + "extensions": ["ico"] + }, + "image/vnd.mix": { + "source": "iana" + }, + "image/vnd.mozilla.apng": { + "source": "iana" + }, + "image/vnd.ms-dds": { + "compressible": true, + "extensions": ["dds"] + }, + "image/vnd.ms-modi": { + "source": "iana", + "extensions": ["mdi"] + }, + "image/vnd.ms-photo": { + "source": "apache", + "extensions": ["wdp"] + }, + "image/vnd.net-fpx": { + "source": "iana", + "extensions": ["npx"] + }, + "image/vnd.pco.b16": { + "source": "iana", + "extensions": ["b16"] + }, + "image/vnd.radiance": { + "source": "iana" + }, + "image/vnd.sealed.png": { + "source": "iana" + }, + "image/vnd.sealedmedia.softseal.gif": { + "source": "iana" + }, + "image/vnd.sealedmedia.softseal.jpg": { + "source": "iana" + }, + "image/vnd.svf": { + "source": "iana" + }, + "image/vnd.tencent.tap": { + "source": "iana", + "extensions": ["tap"] + }, + "image/vnd.valve.source.texture": { + "source": "iana", + "extensions": ["vtf"] + }, + "image/vnd.wap.wbmp": { + "source": "iana", + "extensions": ["wbmp"] + }, + "image/vnd.xiff": { + "source": "iana", + "extensions": ["xif"] + }, + "image/vnd.zbrush.pcx": { + "source": "iana", + "extensions": ["pcx"] + }, + "image/webp": { + "source": "apache", + "extensions": ["webp"] + }, + "image/wmf": { + "source": "iana", + "extensions": ["wmf"] + }, + "image/x-3ds": { + "source": "apache", + "extensions": ["3ds"] + }, + "image/x-cmu-raster": { + "source": "apache", + "extensions": ["ras"] + }, + "image/x-cmx": { + "source": "apache", + "extensions": ["cmx"] + }, + "image/x-freehand": { + "source": "apache", + "extensions": ["fh","fhc","fh4","fh5","fh7"] + }, + "image/x-icon": { + "source": "apache", + "compressible": true, + "extensions": ["ico"] + }, + "image/x-jng": { + "source": "nginx", + "extensions": ["jng"] + }, + "image/x-mrsid-image": { + "source": "apache", + "extensions": ["sid"] + }, + "image/x-ms-bmp": { + "source": "nginx", + "compressible": true, + "extensions": ["bmp"] + }, + "image/x-pcx": { + "source": "apache", + "extensions": ["pcx"] + }, + "image/x-pict": { + "source": "apache", + "extensions": ["pic","pct"] + }, + "image/x-portable-anymap": { + "source": "apache", + "extensions": ["pnm"] + }, + "image/x-portable-bitmap": { + "source": "apache", + "extensions": ["pbm"] + }, + "image/x-portable-graymap": { + "source": "apache", + "extensions": ["pgm"] + }, + "image/x-portable-pixmap": { + "source": "apache", + "extensions": ["ppm"] + }, + "image/x-rgb": { + "source": "apache", + "extensions": ["rgb"] + }, + "image/x-tga": { + "source": "apache", + "extensions": ["tga"] + }, + "image/x-xbitmap": { + "source": "apache", + "extensions": ["xbm"] + }, + "image/x-xcf": { + "compressible": false + }, + "image/x-xpixmap": { + "source": "apache", + "extensions": ["xpm"] + }, + "image/x-xwindowdump": { + "source": "apache", + "extensions": ["xwd"] + }, + "message/cpim": { + "source": "iana" + }, + "message/delivery-status": { + "source": "iana" + }, + "message/disposition-notification": { + "source": "iana", + "extensions": [ + "disposition-notification" + ] + }, + "message/external-body": { + "source": "iana" + }, + "message/feedback-report": { + "source": "iana" + }, + "message/global": { + "source": "iana", + "extensions": ["u8msg"] + }, + "message/global-delivery-status": { + "source": "iana", + "extensions": ["u8dsn"] + }, + "message/global-disposition-notification": { + "source": "iana", + "extensions": ["u8mdn"] + }, + "message/global-headers": { + "source": "iana", + "extensions": ["u8hdr"] + }, + "message/http": { + "source": "iana", + "compressible": false + }, + "message/imdn+xml": { + "source": "iana", + "compressible": true + }, + "message/news": { + "source": "iana" + }, + "message/partial": { + "source": "iana", + "compressible": false + }, + "message/rfc822": { + "source": "iana", + "compressible": true, + "extensions": ["eml","mime"] + }, + "message/s-http": { + "source": "iana" + }, + "message/sip": { + "source": "iana" + }, + "message/sipfrag": { + "source": "iana" + }, + "message/tracking-status": { + "source": "iana" + }, + "message/vnd.si.simp": { + "source": "iana" + }, + "message/vnd.wfa.wsc": { + "source": "iana", + "extensions": ["wsc"] + }, + "model/3mf": { + "source": "iana", + "extensions": ["3mf"] + }, + "model/e57": { + "source": "iana" + }, + "model/gltf+json": { + "source": "iana", + "compressible": true, + "extensions": ["gltf"] + }, + "model/gltf-binary": { + "source": "iana", + "compressible": true, + "extensions": ["glb"] + }, + "model/iges": { + "source": "iana", + "compressible": false, + "extensions": ["igs","iges"] + }, + "model/mesh": { + "source": "iana", + "compressible": false, + "extensions": ["msh","mesh","silo"] + }, + "model/mtl": { + "source": "iana", + "extensions": ["mtl"] + }, + "model/obj": { + "source": "iana", + "extensions": ["obj"] + }, + "model/step": { + "source": "iana" + }, + "model/step+xml": { + "source": "iana", + "compressible": true, + "extensions": ["stpx"] + }, + "model/step+zip": { + "source": "iana", + "compressible": false, + "extensions": ["stpz"] + }, + "model/step-xml+zip": { + "source": "iana", + "compressible": false, + "extensions": ["stpxz"] + }, + "model/stl": { + "source": "iana", + "extensions": ["stl"] + }, + "model/vnd.collada+xml": { + "source": "iana", + "compressible": true, + "extensions": ["dae"] + }, + "model/vnd.dwf": { + "source": "iana", + "extensions": ["dwf"] + }, + "model/vnd.flatland.3dml": { + "source": "iana" + }, + "model/vnd.gdl": { + "source": "iana", + "extensions": ["gdl"] + }, + "model/vnd.gs-gdl": { + "source": "apache" + }, + "model/vnd.gs.gdl": { + "source": "iana" + }, + "model/vnd.gtw": { + "source": "iana", + "extensions": ["gtw"] + }, + "model/vnd.moml+xml": { + "source": "iana", + "compressible": true + }, + "model/vnd.mts": { + "source": "iana", + "extensions": ["mts"] + }, + "model/vnd.opengex": { + "source": "iana", + "extensions": ["ogex"] + }, + "model/vnd.parasolid.transmit.binary": { + "source": "iana", + "extensions": ["x_b"] + }, + "model/vnd.parasolid.transmit.text": { + "source": "iana", + "extensions": ["x_t"] + }, + "model/vnd.pytha.pyox": { + "source": "iana" + }, + "model/vnd.rosette.annotated-data-model": { + "source": "iana" + }, + "model/vnd.sap.vds": { + "source": "iana", + "extensions": ["vds"] + }, + "model/vnd.usdz+zip": { + "source": "iana", + "compressible": false, + "extensions": ["usdz"] + }, + "model/vnd.valve.source.compiled-map": { + "source": "iana", + "extensions": ["bsp"] + }, + "model/vnd.vtu": { + "source": "iana", + "extensions": ["vtu"] + }, + "model/vrml": { + "source": "iana", + "compressible": false, + "extensions": ["wrl","vrml"] + }, + "model/x3d+binary": { + "source": "apache", + "compressible": false, + "extensions": ["x3db","x3dbz"] + }, + "model/x3d+fastinfoset": { + "source": "iana", + "extensions": ["x3db"] + }, + "model/x3d+vrml": { + "source": "apache", + "compressible": false, + "extensions": ["x3dv","x3dvz"] + }, + "model/x3d+xml": { + "source": "iana", + "compressible": true, + "extensions": ["x3d","x3dz"] + }, + "model/x3d-vrml": { + "source": "iana", + "extensions": ["x3dv"] + }, + "multipart/alternative": { + "source": "iana", + "compressible": false + }, + "multipart/appledouble": { + "source": "iana" + }, + "multipart/byteranges": { + "source": "iana" + }, + "multipart/digest": { + "source": "iana" + }, + "multipart/encrypted": { + "source": "iana", + "compressible": false + }, + "multipart/form-data": { + "source": "iana", + "compressible": false + }, + "multipart/header-set": { + "source": "iana" + }, + "multipart/mixed": { + "source": "iana" + }, + "multipart/multilingual": { + "source": "iana" + }, + "multipart/parallel": { + "source": "iana" + }, + "multipart/related": { + "source": "iana", + "compressible": false + }, + "multipart/report": { + "source": "iana" + }, + "multipart/signed": { + "source": "iana", + "compressible": false + }, + "multipart/vnd.bint.med-plus": { + "source": "iana" + }, + "multipart/voice-message": { + "source": "iana" + }, + "multipart/x-mixed-replace": { + "source": "iana" + }, + "text/1d-interleaved-parityfec": { + "source": "iana" + }, + "text/cache-manifest": { + "source": "iana", + "compressible": true, + "extensions": ["appcache","manifest"] + }, + "text/calendar": { + "source": "iana", + "extensions": ["ics","ifb"] + }, + "text/calender": { + "compressible": true + }, + "text/cmd": { + "compressible": true + }, + "text/coffeescript": { + "extensions": ["coffee","litcoffee"] + }, + "text/cql": { + "source": "iana" + }, + "text/cql-expression": { + "source": "iana" + }, + "text/cql-identifier": { + "source": "iana" + }, + "text/css": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["css"] + }, + "text/csv": { + "source": "iana", + "compressible": true, + "extensions": ["csv"] + }, + "text/csv-schema": { + "source": "iana" + }, + "text/directory": { + "source": "iana" + }, + "text/dns": { + "source": "iana" + }, + "text/ecmascript": { + "source": "iana" + }, + "text/encaprtp": { + "source": "iana" + }, + "text/enriched": { + "source": "iana" + }, + "text/fhirpath": { + "source": "iana" + }, + "text/flexfec": { + "source": "iana" + }, + "text/fwdred": { + "source": "iana" + }, + "text/gff3": { + "source": "iana" + }, + "text/grammar-ref-list": { + "source": "iana" + }, + "text/html": { + "source": "iana", + "compressible": true, + "extensions": ["html","htm","shtml"] + }, + "text/jade": { + "extensions": ["jade"] + }, + "text/javascript": { + "source": "iana", + "compressible": true + }, + "text/jcr-cnd": { + "source": "iana" + }, + "text/jsx": { + "compressible": true, + "extensions": ["jsx"] + }, + "text/less": { + "compressible": true, + "extensions": ["less"] + }, + "text/markdown": { + "source": "iana", + "compressible": true, + "extensions": ["markdown","md"] + }, + "text/mathml": { + "source": "nginx", + "extensions": ["mml"] + }, + "text/mdx": { + "compressible": true, + "extensions": ["mdx"] + }, + "text/mizar": { + "source": "iana" + }, + "text/n3": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["n3"] + }, + "text/parameters": { + "source": "iana", + "charset": "UTF-8" + }, + "text/parityfec": { + "source": "iana" + }, + "text/plain": { + "source": "iana", + "compressible": true, + "extensions": ["txt","text","conf","def","list","log","in","ini"] + }, + "text/provenance-notation": { + "source": "iana", + "charset": "UTF-8" + }, + "text/prs.fallenstein.rst": { + "source": "iana" + }, + "text/prs.lines.tag": { + "source": "iana", + "extensions": ["dsc"] + }, + "text/prs.prop.logic": { + "source": "iana" + }, + "text/raptorfec": { + "source": "iana" + }, + "text/red": { + "source": "iana" + }, + "text/rfc822-headers": { + "source": "iana" + }, + "text/richtext": { + "source": "iana", + "compressible": true, + "extensions": ["rtx"] + }, + "text/rtf": { + "source": "iana", + "compressible": true, + "extensions": ["rtf"] + }, + "text/rtp-enc-aescm128": { + "source": "iana" + }, + "text/rtploopback": { + "source": "iana" + }, + "text/rtx": { + "source": "iana" + }, + "text/sgml": { + "source": "iana", + "extensions": ["sgml","sgm"] + }, + "text/shaclc": { + "source": "iana" + }, + "text/shex": { + "source": "iana", + "extensions": ["shex"] + }, + "text/slim": { + "extensions": ["slim","slm"] + }, + "text/spdx": { + "source": "iana", + "extensions": ["spdx"] + }, + "text/strings": { + "source": "iana" + }, + "text/stylus": { + "extensions": ["stylus","styl"] + }, + "text/t140": { + "source": "iana" + }, + "text/tab-separated-values": { + "source": "iana", + "compressible": true, + "extensions": ["tsv"] + }, + "text/troff": { + "source": "iana", + "extensions": ["t","tr","roff","man","me","ms"] + }, + "text/turtle": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["ttl"] + }, + "text/ulpfec": { + "source": "iana" + }, + "text/uri-list": { + "source": "iana", + "compressible": true, + "extensions": ["uri","uris","urls"] + }, + "text/vcard": { + "source": "iana", + "compressible": true, + "extensions": ["vcard"] + }, + "text/vnd.a": { + "source": "iana" + }, + "text/vnd.abc": { + "source": "iana" + }, + "text/vnd.ascii-art": { + "source": "iana" + }, + "text/vnd.curl": { + "source": "iana", + "extensions": ["curl"] + }, + "text/vnd.curl.dcurl": { + "source": "apache", + "extensions": ["dcurl"] + }, + "text/vnd.curl.mcurl": { + "source": "apache", + "extensions": ["mcurl"] + }, + "text/vnd.curl.scurl": { + "source": "apache", + "extensions": ["scurl"] + }, + "text/vnd.debian.copyright": { + "source": "iana", + "charset": "UTF-8" + }, + "text/vnd.dmclientscript": { + "source": "iana" + }, + "text/vnd.dvb.subtitle": { + "source": "iana", + "extensions": ["sub"] + }, + "text/vnd.esmertec.theme-descriptor": { + "source": "iana", + "charset": "UTF-8" + }, + "text/vnd.familysearch.gedcom": { + "source": "iana", + "extensions": ["ged"] + }, + "text/vnd.ficlab.flt": { + "source": "iana" + }, + "text/vnd.fly": { + "source": "iana", + "extensions": ["fly"] + }, + "text/vnd.fmi.flexstor": { + "source": "iana", + "extensions": ["flx"] + }, + "text/vnd.gml": { + "source": "iana" + }, + "text/vnd.graphviz": { + "source": "iana", + "extensions": ["gv"] + }, + "text/vnd.hans": { + "source": "iana" + }, + "text/vnd.hgl": { + "source": "iana" + }, + "text/vnd.in3d.3dml": { + "source": "iana", + "extensions": ["3dml"] + }, + "text/vnd.in3d.spot": { + "source": "iana", + "extensions": ["spot"] + }, + "text/vnd.iptc.newsml": { + "source": "iana" + }, + "text/vnd.iptc.nitf": { + "source": "iana" + }, + "text/vnd.latex-z": { + "source": "iana" + }, + "text/vnd.motorola.reflex": { + "source": "iana" + }, + "text/vnd.ms-mediapackage": { + "source": "iana" + }, + "text/vnd.net2phone.commcenter.command": { + "source": "iana" + }, + "text/vnd.radisys.msml-basic-layout": { + "source": "iana" + }, + "text/vnd.senx.warpscript": { + "source": "iana" + }, + "text/vnd.si.uricatalogue": { + "source": "iana" + }, + "text/vnd.sosi": { + "source": "iana" + }, + "text/vnd.sun.j2me.app-descriptor": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["jad"] + }, + "text/vnd.trolltech.linguist": { + "source": "iana", + "charset": "UTF-8" + }, + "text/vnd.wap.si": { + "source": "iana" + }, + "text/vnd.wap.sl": { + "source": "iana" + }, + "text/vnd.wap.wml": { + "source": "iana", + "extensions": ["wml"] + }, + "text/vnd.wap.wmlscript": { + "source": "iana", + "extensions": ["wmls"] + }, + "text/vtt": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["vtt"] + }, + "text/x-asm": { + "source": "apache", + "extensions": ["s","asm"] + }, + "text/x-c": { + "source": "apache", + "extensions": ["c","cc","cxx","cpp","h","hh","dic"] + }, + "text/x-component": { + "source": "nginx", + "extensions": ["htc"] + }, + "text/x-fortran": { + "source": "apache", + "extensions": ["f","for","f77","f90"] + }, + "text/x-gwt-rpc": { + "compressible": true + }, + "text/x-handlebars-template": { + "extensions": ["hbs"] + }, + "text/x-java-source": { + "source": "apache", + "extensions": ["java"] + }, + "text/x-jquery-tmpl": { + "compressible": true + }, + "text/x-lua": { + "extensions": ["lua"] + }, + "text/x-markdown": { + "compressible": true, + "extensions": ["mkd"] + }, + "text/x-nfo": { + "source": "apache", + "extensions": ["nfo"] + }, + "text/x-opml": { + "source": "apache", + "extensions": ["opml"] + }, + "text/x-org": { + "compressible": true, + "extensions": ["org"] + }, + "text/x-pascal": { + "source": "apache", + "extensions": ["p","pas"] + }, + "text/x-processing": { + "compressible": true, + "extensions": ["pde"] + }, + "text/x-sass": { + "extensions": ["sass"] + }, + "text/x-scss": { + "extensions": ["scss"] + }, + "text/x-setext": { + "source": "apache", + "extensions": ["etx"] + }, + "text/x-sfv": { + "source": "apache", + "extensions": ["sfv"] + }, + "text/x-suse-ymp": { + "compressible": true, + "extensions": ["ymp"] + }, + "text/x-uuencode": { + "source": "apache", + "extensions": ["uu"] + }, + "text/x-vcalendar": { + "source": "apache", + "extensions": ["vcs"] + }, + "text/x-vcard": { + "source": "apache", + "extensions": ["vcf"] + }, + "text/xml": { + "source": "iana", + "compressible": true, + "extensions": ["xml"] + }, + "text/xml-external-parsed-entity": { + "source": "iana" + }, + "text/yaml": { + "compressible": true, + "extensions": ["yaml","yml"] + }, + "video/1d-interleaved-parityfec": { + "source": "iana" + }, + "video/3gpp": { + "source": "iana", + "extensions": ["3gp","3gpp"] + }, + "video/3gpp-tt": { + "source": "iana" + }, + "video/3gpp2": { + "source": "iana", + "extensions": ["3g2"] + }, + "video/av1": { + "source": "iana" + }, + "video/bmpeg": { + "source": "iana" + }, + "video/bt656": { + "source": "iana" + }, + "video/celb": { + "source": "iana" + }, + "video/dv": { + "source": "iana" + }, + "video/encaprtp": { + "source": "iana" + }, + "video/ffv1": { + "source": "iana" + }, + "video/flexfec": { + "source": "iana" + }, + "video/h261": { + "source": "iana", + "extensions": ["h261"] + }, + "video/h263": { + "source": "iana", + "extensions": ["h263"] + }, + "video/h263-1998": { + "source": "iana" + }, + "video/h263-2000": { + "source": "iana" + }, + "video/h264": { + "source": "iana", + "extensions": ["h264"] + }, + "video/h264-rcdo": { + "source": "iana" + }, + "video/h264-svc": { + "source": "iana" + }, + "video/h265": { + "source": "iana" + }, + "video/iso.segment": { + "source": "iana", + "extensions": ["m4s"] + }, + "video/jpeg": { + "source": "iana", + "extensions": ["jpgv"] + }, + "video/jpeg2000": { + "source": "iana" + }, + "video/jpm": { + "source": "apache", + "extensions": ["jpm","jpgm"] + }, + "video/jxsv": { + "source": "iana" + }, + "video/mj2": { + "source": "iana", + "extensions": ["mj2","mjp2"] + }, + "video/mp1s": { + "source": "iana" + }, + "video/mp2p": { + "source": "iana" + }, + "video/mp2t": { + "source": "iana", + "extensions": ["ts"] + }, + "video/mp4": { + "source": "iana", + "compressible": false, + "extensions": ["mp4","mp4v","mpg4"] + }, + "video/mp4v-es": { + "source": "iana" + }, + "video/mpeg": { + "source": "iana", + "compressible": false, + "extensions": ["mpeg","mpg","mpe","m1v","m2v"] + }, + "video/mpeg4-generic": { + "source": "iana" + }, + "video/mpv": { + "source": "iana" + }, + "video/nv": { + "source": "iana" + }, + "video/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["ogv"] + }, + "video/parityfec": { + "source": "iana" + }, + "video/pointer": { + "source": "iana" + }, + "video/quicktime": { + "source": "iana", + "compressible": false, + "extensions": ["qt","mov"] + }, + "video/raptorfec": { + "source": "iana" + }, + "video/raw": { + "source": "iana" + }, + "video/rtp-enc-aescm128": { + "source": "iana" + }, + "video/rtploopback": { + "source": "iana" + }, + "video/rtx": { + "source": "iana" + }, + "video/scip": { + "source": "iana" + }, + "video/smpte291": { + "source": "iana" + }, + "video/smpte292m": { + "source": "iana" + }, + "video/ulpfec": { + "source": "iana" + }, + "video/vc1": { + "source": "iana" + }, + "video/vc2": { + "source": "iana" + }, + "video/vnd.cctv": { + "source": "iana" + }, + "video/vnd.dece.hd": { + "source": "iana", + "extensions": ["uvh","uvvh"] + }, + "video/vnd.dece.mobile": { + "source": "iana", + "extensions": ["uvm","uvvm"] + }, + "video/vnd.dece.mp4": { + "source": "iana" + }, + "video/vnd.dece.pd": { + "source": "iana", + "extensions": ["uvp","uvvp"] + }, + "video/vnd.dece.sd": { + "source": "iana", + "extensions": ["uvs","uvvs"] + }, + "video/vnd.dece.video": { + "source": "iana", + "extensions": ["uvv","uvvv"] + }, + "video/vnd.directv.mpeg": { + "source": "iana" + }, + "video/vnd.directv.mpeg-tts": { + "source": "iana" + }, + "video/vnd.dlna.mpeg-tts": { + "source": "iana" + }, + "video/vnd.dvb.file": { + "source": "iana", + "extensions": ["dvb"] + }, + "video/vnd.fvt": { + "source": "iana", + "extensions": ["fvt"] + }, + "video/vnd.hns.video": { + "source": "iana" + }, + "video/vnd.iptvforum.1dparityfec-1010": { + "source": "iana" + }, + "video/vnd.iptvforum.1dparityfec-2005": { + "source": "iana" + }, + "video/vnd.iptvforum.2dparityfec-1010": { + "source": "iana" + }, + "video/vnd.iptvforum.2dparityfec-2005": { + "source": "iana" + }, + "video/vnd.iptvforum.ttsavc": { + "source": "iana" + }, + "video/vnd.iptvforum.ttsmpeg2": { + "source": "iana" + }, + "video/vnd.motorola.video": { + "source": "iana" + }, + "video/vnd.motorola.videop": { + "source": "iana" + }, + "video/vnd.mpegurl": { + "source": "iana", + "extensions": ["mxu","m4u"] + }, + "video/vnd.ms-playready.media.pyv": { + "source": "iana", + "extensions": ["pyv"] + }, + "video/vnd.nokia.interleaved-multimedia": { + "source": "iana" + }, + "video/vnd.nokia.mp4vr": { + "source": "iana" + }, + "video/vnd.nokia.videovoip": { + "source": "iana" + }, + "video/vnd.objectvideo": { + "source": "iana" + }, + "video/vnd.radgamettools.bink": { + "source": "iana" + }, + "video/vnd.radgamettools.smacker": { + "source": "iana" + }, + "video/vnd.sealed.mpeg1": { + "source": "iana" + }, + "video/vnd.sealed.mpeg4": { + "source": "iana" + }, + "video/vnd.sealed.swf": { + "source": "iana" + }, + "video/vnd.sealedmedia.softseal.mov": { + "source": "iana" + }, + "video/vnd.uvvu.mp4": { + "source": "iana", + "extensions": ["uvu","uvvu"] + }, + "video/vnd.vivo": { + "source": "iana", + "extensions": ["viv"] + }, + "video/vnd.youtube.yt": { + "source": "iana" + }, + "video/vp8": { + "source": "iana" + }, + "video/vp9": { + "source": "iana" + }, + "video/webm": { + "source": "apache", + "compressible": false, + "extensions": ["webm"] + }, + "video/x-f4v": { + "source": "apache", + "extensions": ["f4v"] + }, + "video/x-fli": { + "source": "apache", + "extensions": ["fli"] + }, + "video/x-flv": { + "source": "apache", + "compressible": false, + "extensions": ["flv"] + }, + "video/x-m4v": { + "source": "apache", + "extensions": ["m4v"] + }, + "video/x-matroska": { + "source": "apache", + "compressible": false, + "extensions": ["mkv","mk3d","mks"] + }, + "video/x-mng": { + "source": "apache", + "extensions": ["mng"] + }, + "video/x-ms-asf": { + "source": "apache", + "extensions": ["asf","asx"] + }, + "video/x-ms-vob": { + "source": "apache", + "extensions": ["vob"] + }, + "video/x-ms-wm": { + "source": "apache", + "extensions": ["wm"] + }, + "video/x-ms-wmv": { + "source": "apache", + "compressible": false, + "extensions": ["wmv"] + }, + "video/x-ms-wmx": { + "source": "apache", + "extensions": ["wmx"] + }, + "video/x-ms-wvx": { + "source": "apache", + "extensions": ["wvx"] + }, + "video/x-msvideo": { + "source": "apache", + "extensions": ["avi"] + }, + "video/x-sgi-movie": { + "source": "apache", + "extensions": ["movie"] + }, + "video/x-smv": { + "source": "apache", + "extensions": ["smv"] + }, + "x-conference/x-cooltalk": { + "source": "apache", + "extensions": ["ice"] + }, + "x-shader/x-fragment": { + "compressible": true + }, + "x-shader/x-vertex": { + "compressible": true + } +} diff --git a/graphql-subscription-express/node_modules/mime-db/index.js b/graphql-subscription-express/node_modules/mime-db/index.js new file mode 100644 index 0000000..ec2be30 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-db/index.js @@ -0,0 +1,12 @@ +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module exports. + */ + +module.exports = require('./db.json') diff --git a/graphql-subscription-express/node_modules/mime-db/package.json b/graphql-subscription-express/node_modules/mime-db/package.json new file mode 100644 index 0000000..32c14b8 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-db/package.json @@ -0,0 +1,60 @@ +{ + "name": "mime-db", + "description": "Media Type Database", + "version": "1.52.0", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)", + "Robert Kieffer (http://github.com/broofa)" + ], + "license": "MIT", + "keywords": [ + "mime", + "db", + "type", + "types", + "database", + "charset", + "charsets" + ], + "repository": "jshttp/mime-db", + "devDependencies": { + "bluebird": "3.7.2", + "co": "4.6.0", + "cogent": "1.0.1", + "csv-parse": "4.16.3", + "eslint": "7.32.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.1.1", + "eslint-plugin-standard": "4.1.0", + "gnode": "0.1.2", + "media-typer": "1.1.0", + "mocha": "9.2.1", + "nyc": "15.1.0", + "raw-body": "2.5.0", + "stream-to-array": "2.3.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "db.json", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "build": "node scripts/build", + "fetch": "node scripts/fetch-apache && gnode scripts/fetch-iana && node scripts/fetch-nginx", + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "update": "npm run fetch && npm run build", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/graphql-subscription-express/node_modules/mime-types/HISTORY.md b/graphql-subscription-express/node_modules/mime-types/HISTORY.md new file mode 100644 index 0000000..c5043b7 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-types/HISTORY.md @@ -0,0 +1,397 @@ +2.1.35 / 2022-03-12 +=================== + + * deps: mime-db@1.52.0 + - Add extensions from IANA for more `image/*` types + - Add extension `.asc` to `application/pgp-keys` + - Add extensions to various XML types + - Add new upstream MIME types + +2.1.34 / 2021-11-08 +=================== + + * deps: mime-db@1.51.0 + - Add new upstream MIME types + +2.1.33 / 2021-10-01 +=================== + + * deps: mime-db@1.50.0 + - Add deprecated iWorks mime types and extensions + - Add new upstream MIME types + +2.1.32 / 2021-07-27 +=================== + + * deps: mime-db@1.49.0 + - Add extension `.trig` to `application/trig` + - Add new upstream MIME types + +2.1.31 / 2021-06-01 +=================== + + * deps: mime-db@1.48.0 + - Add extension `.mvt` to `application/vnd.mapbox-vector-tile` + - Add new upstream MIME types + +2.1.30 / 2021-04-02 +=================== + + * deps: mime-db@1.47.0 + - Add extension `.amr` to `audio/amr` + - Remove ambigious extensions from IANA for `application/*+xml` types + - Update primary extension to `.es` for `application/ecmascript` + +2.1.29 / 2021-02-17 +=================== + + * deps: mime-db@1.46.0 + - Add extension `.amr` to `audio/amr` + - Add extension `.m4s` to `video/iso.segment` + - Add extension `.opus` to `audio/ogg` + - Add new upstream MIME types + +2.1.28 / 2021-01-01 +=================== + + * deps: mime-db@1.45.0 + - Add `application/ubjson` with extension `.ubj` + - Add `image/avif` with extension `.avif` + - Add `image/ktx2` with extension `.ktx2` + - Add extension `.dbf` to `application/vnd.dbf` + - Add extension `.rar` to `application/vnd.rar` + - Add extension `.td` to `application/urc-targetdesc+xml` + - Add new upstream MIME types + - Fix extension of `application/vnd.apple.keynote` to be `.key` + +2.1.27 / 2020-04-23 +=================== + + * deps: mime-db@1.44.0 + - Add charsets from IANA + - Add extension `.cjs` to `application/node` + - Add new upstream MIME types + +2.1.26 / 2020-01-05 +=================== + + * deps: mime-db@1.43.0 + - Add `application/x-keepass2` with extension `.kdbx` + - Add extension `.mxmf` to `audio/mobile-xmf` + - Add extensions from IANA for `application/*+xml` types + - Add new upstream MIME types + +2.1.25 / 2019-11-12 +=================== + + * deps: mime-db@1.42.0 + - Add new upstream MIME types + - Add `application/toml` with extension `.toml` + - Add `image/vnd.ms-dds` with extension `.dds` + +2.1.24 / 2019-04-20 +=================== + + * deps: mime-db@1.40.0 + - Add extensions from IANA for `model/*` types + - Add `text/mdx` with extension `.mdx` + +2.1.23 / 2019-04-17 +=================== + + * deps: mime-db@~1.39.0 + - Add extensions `.siv` and `.sieve` to `application/sieve` + - Add new upstream MIME types + +2.1.22 / 2019-02-14 +=================== + + * deps: mime-db@~1.38.0 + - Add extension `.nq` to `application/n-quads` + - Add extension `.nt` to `application/n-triples` + - Add new upstream MIME types + +2.1.21 / 2018-10-19 +=================== + + * deps: mime-db@~1.37.0 + - Add extensions to HEIC image types + - Add new upstream MIME types + +2.1.20 / 2018-08-26 +=================== + + * deps: mime-db@~1.36.0 + - Add Apple file extensions from IANA + - Add extensions from IANA for `image/*` types + - Add new upstream MIME types + +2.1.19 / 2018-07-17 +=================== + + * deps: mime-db@~1.35.0 + - Add extension `.csl` to `application/vnd.citationstyles.style+xml` + - Add extension `.es` to `application/ecmascript` + - Add extension `.owl` to `application/rdf+xml` + - Add new upstream MIME types + - Add UTF-8 as default charset for `text/turtle` + +2.1.18 / 2018-02-16 +=================== + + * deps: mime-db@~1.33.0 + - Add `application/raml+yaml` with extension `.raml` + - Add `application/wasm` with extension `.wasm` + - Add `text/shex` with extension `.shex` + - Add extensions for JPEG-2000 images + - Add extensions from IANA for `message/*` types + - Add new upstream MIME types + - Update font MIME types + - Update `text/hjson` to registered `application/hjson` + +2.1.17 / 2017-09-01 +=================== + + * deps: mime-db@~1.30.0 + - Add `application/vnd.ms-outlook` + - Add `application/x-arj` + - Add extension `.mjs` to `application/javascript` + - Add glTF types and extensions + - Add new upstream MIME types + - Add `text/x-org` + - Add VirtualBox MIME types + - Fix `source` records for `video/*` types that are IANA + - Update `font/opentype` to registered `font/otf` + +2.1.16 / 2017-07-24 +=================== + + * deps: mime-db@~1.29.0 + - Add `application/fido.trusted-apps+json` + - Add extension `.wadl` to `application/vnd.sun.wadl+xml` + - Add extension `.gz` to `application/gzip` + - Add new upstream MIME types + - Update extensions `.md` and `.markdown` to be `text/markdown` + +2.1.15 / 2017-03-23 +=================== + + * deps: mime-db@~1.27.0 + - Add new mime types + - Add `image/apng` + +2.1.14 / 2017-01-14 +=================== + + * deps: mime-db@~1.26.0 + - Add new mime types + +2.1.13 / 2016-11-18 +=================== + + * deps: mime-db@~1.25.0 + - Add new mime types + +2.1.12 / 2016-09-18 +=================== + + * deps: mime-db@~1.24.0 + - Add new mime types + - Add `audio/mp3` + +2.1.11 / 2016-05-01 +=================== + + * deps: mime-db@~1.23.0 + - Add new mime types + +2.1.10 / 2016-02-15 +=================== + + * deps: mime-db@~1.22.0 + - Add new mime types + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + +2.1.9 / 2016-01-06 +================== + + * deps: mime-db@~1.21.0 + - Add new mime types + +2.1.8 / 2015-11-30 +================== + + * deps: mime-db@~1.20.0 + - Add new mime types + +2.1.7 / 2015-09-20 +================== + + * deps: mime-db@~1.19.0 + - Add new mime types + +2.1.6 / 2015-09-03 +================== + + * deps: mime-db@~1.18.0 + - Add new mime types + +2.1.5 / 2015-08-20 +================== + + * deps: mime-db@~1.17.0 + - Add new mime types + +2.1.4 / 2015-07-30 +================== + + * deps: mime-db@~1.16.0 + - Add new mime types + +2.1.3 / 2015-07-13 +================== + + * deps: mime-db@~1.15.0 + - Add new mime types + +2.1.2 / 2015-06-25 +================== + + * deps: mime-db@~1.14.0 + - Add new mime types + +2.1.1 / 2015-06-08 +================== + + * perf: fix deopt during mapping + +2.1.0 / 2015-06-07 +================== + + * Fix incorrectly treating extension-less file name as extension + - i.e. `'path/to/json'` will no longer return `application/json` + * Fix `.charset(type)` to accept parameters + * Fix `.charset(type)` to match case-insensitive + * Improve generation of extension to MIME mapping + * Refactor internals for readability and no argument reassignment + * Prefer `application/*` MIME types from the same source + * Prefer any type over `application/octet-stream` + * deps: mime-db@~1.13.0 + - Add nginx as a source + - Add new mime types + +2.0.14 / 2015-06-06 +=================== + + * deps: mime-db@~1.12.0 + - Add new mime types + +2.0.13 / 2015-05-31 +=================== + + * deps: mime-db@~1.11.0 + - Add new mime types + +2.0.12 / 2015-05-19 +=================== + + * deps: mime-db@~1.10.0 + - Add new mime types + +2.0.11 / 2015-05-05 +=================== + + * deps: mime-db@~1.9.1 + - Add new mime types + +2.0.10 / 2015-03-13 +=================== + + * deps: mime-db@~1.8.0 + - Add new mime types + +2.0.9 / 2015-02-09 +================== + + * deps: mime-db@~1.7.0 + - Add new mime types + - Community extensions ownership transferred from `node-mime` + +2.0.8 / 2015-01-29 +================== + + * deps: mime-db@~1.6.0 + - Add new mime types + +2.0.7 / 2014-12-30 +================== + + * deps: mime-db@~1.5.0 + - Add new mime types + - Fix various invalid MIME type entries + +2.0.6 / 2014-12-30 +================== + + * deps: mime-db@~1.4.0 + - Add new mime types + - Fix various invalid MIME type entries + - Remove example template MIME types + +2.0.5 / 2014-12-29 +================== + + * deps: mime-db@~1.3.1 + - Fix missing extensions + +2.0.4 / 2014-12-10 +================== + + * deps: mime-db@~1.3.0 + - Add new mime types + +2.0.3 / 2014-11-09 +================== + + * deps: mime-db@~1.2.0 + - Add new mime types + +2.0.2 / 2014-09-28 +================== + + * deps: mime-db@~1.1.0 + - Add new mime types + - Update charsets + +2.0.1 / 2014-09-07 +================== + + * Support Node.js 0.6 + +2.0.0 / 2014-09-02 +================== + + * Use `mime-db` + * Remove `.define()` + +1.0.2 / 2014-08-04 +================== + + * Set charset=utf-8 for `text/javascript` + +1.0.1 / 2014-06-24 +================== + + * Add `text/jsx` type + +1.0.0 / 2014-05-12 +================== + + * Return `false` for unknown types + * Set charset=utf-8 for `application/json` + +0.1.0 / 2014-05-02 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/mime-types/LICENSE b/graphql-subscription-express/node_modules/mime-types/LICENSE new file mode 100644 index 0000000..0616607 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-types/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/mime-types/README.md b/graphql-subscription-express/node_modules/mime-types/README.md new file mode 100644 index 0000000..48d2fb4 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-types/README.md @@ -0,0 +1,113 @@ +# mime-types + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +The ultimate javascript content-type utility. + +Similar to [the `mime@1.x` module](https://www.npmjs.com/package/mime), except: + +- __No fallbacks.__ Instead of naively returning the first available type, + `mime-types` simply returns `false`, so do + `var type = mime.lookup('unrecognized') || 'application/octet-stream'`. +- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. +- No `.define()` functionality +- Bug fixes for `.lookup(path)` + +Otherwise, the API is compatible with `mime` 1.x. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install mime-types +``` + +## Adding Types + +All mime types are based on [mime-db](https://www.npmjs.com/package/mime-db), +so open a PR there if you'd like to add mime types. + +## API + +```js +var mime = require('mime-types') +``` + +All functions return `false` if input is invalid or not found. + +### mime.lookup(path) + +Lookup the content-type associated with a file. + +```js +mime.lookup('json') // 'application/json' +mime.lookup('.md') // 'text/markdown' +mime.lookup('file.html') // 'text/html' +mime.lookup('folder/file.js') // 'application/javascript' +mime.lookup('folder/.htaccess') // false + +mime.lookup('cats') // false +``` + +### mime.contentType(type) + +Create a full content-type header given a content-type or extension. +When given an extension, `mime.lookup` is used to get the matching +content-type, otherwise the given content-type is used. Then if the +content-type does not already have a `charset` parameter, `mime.charset` +is used to get the default charset and add to the returned content-type. + +```js +mime.contentType('markdown') // 'text/x-markdown; charset=utf-8' +mime.contentType('file.json') // 'application/json; charset=utf-8' +mime.contentType('text/html') // 'text/html; charset=utf-8' +mime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1' + +// from a full path +mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8' +``` + +### mime.extension(type) + +Get the default extension for a content-type. + +```js +mime.extension('application/octet-stream') // 'bin' +``` + +### mime.charset(type) + +Lookup the implied default charset of a content-type. + +```js +mime.charset('text/markdown') // 'UTF-8' +``` + +### var type = mime.types[extension] + +A map of content-types by extension. + +### [extensions...] = mime.extensions[type] + +A map of extensions by content-type. + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/mime-types/master?label=ci +[ci-url]: https://github.com/jshttp/mime-types/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master +[coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master +[node-version-image]: https://badgen.net/npm/node/mime-types +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/mime-types +[npm-url]: https://npmjs.org/package/mime-types +[npm-version-image]: https://badgen.net/npm/v/mime-types diff --git a/graphql-subscription-express/node_modules/mime-types/index.js b/graphql-subscription-express/node_modules/mime-types/index.js new file mode 100644 index 0000000..b9f34d5 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-types/index.js @@ -0,0 +1,188 @@ +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var db = require('mime-db') +var extname = require('path').extname + +/** + * Module variables. + * @private + */ + +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i + +/** + * Module exports. + * @public + */ + +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) + +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) + +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] + + if (mime && mime.charset) { + return mime.charset + } + + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } + + return false +} + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ + +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } + + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str + + if (!mime) { + return false + } + + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + + return mime +} + +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] + + if (!exts || !exts.length) { + return false + } + + return exts[0] +} + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ + +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } + + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) + + if (!extension) { + return false + } + + return exports.types[extension] || false +} + +/** + * Populate the extensions and types maps. + * @private + */ + +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] + + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions + + if (!exts || !exts.length) { + return + } + + // mime -> extensions + extensions[type] = exts + + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] + + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) + + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } + + // set the extension -> mime + types[extension] = type + } + }) +} diff --git a/graphql-subscription-express/node_modules/mime-types/package.json b/graphql-subscription-express/node_modules/mime-types/package.json new file mode 100644 index 0000000..bbef696 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime-types/package.json @@ -0,0 +1,44 @@ +{ + "name": "mime-types", + "description": "The ultimate javascript content-type utility.", + "version": "2.1.35", + "contributors": [ + "Douglas Christopher Wilson ", + "Jeremiah Senkpiel (https://searchbeam.jit.su)", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "keywords": [ + "mime", + "types" + ], + "repository": "jshttp/mime-types", + "dependencies": { + "mime-db": "1.52.0" + }, + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.2", + "nyc": "15.1.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec test/test.js", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/mime/.npmignore b/graphql-subscription-express/node_modules/mime/.npmignore new file mode 100644 index 0000000..e69de29 diff --git a/graphql-subscription-express/node_modules/mime/CHANGELOG.md b/graphql-subscription-express/node_modules/mime/CHANGELOG.md new file mode 100644 index 0000000..f127535 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/CHANGELOG.md @@ -0,0 +1,164 @@ +# Changelog + +## v1.6.0 (24/11/2017) +*No changelog for this release.* + +--- + +## v2.0.4 (24/11/2017) +- [**closed**] Switch to mime-score module for resolving extension contention issues. [#182](https://github.com/broofa/node-mime/issues/182) +- [**closed**] Update mime-db to 1.31.0 in v1.x branch [#181](https://github.com/broofa/node-mime/issues/181) + +--- + +## v1.5.0 (22/11/2017) +- [**closed**] need ES5 version ready in npm package [#179](https://github.com/broofa/node-mime/issues/179) +- [**closed**] mime-db no trace of iWork - pages / numbers / etc. [#178](https://github.com/broofa/node-mime/issues/178) +- [**closed**] How it works in brownser ? [#176](https://github.com/broofa/node-mime/issues/176) +- [**closed**] Missing `./Mime` [#175](https://github.com/broofa/node-mime/issues/175) +- [**closed**] Vulnerable Regular Expression [#167](https://github.com/broofa/node-mime/issues/167) + +--- + +## v2.0.3 (25/09/2017) +*No changelog for this release.* + +--- + +## v1.4.1 (25/09/2017) +- [**closed**] Issue when bundling with webpack [#172](https://github.com/broofa/node-mime/issues/172) + +--- + +## v2.0.2 (15/09/2017) +- [**V2**] fs.readFileSync is not a function [#165](https://github.com/broofa/node-mime/issues/165) +- [**closed**] The extension for video/quicktime should map to .mov, not .qt [#164](https://github.com/broofa/node-mime/issues/164) +- [**V2**] [v2 Feedback request] Mime class API [#163](https://github.com/broofa/node-mime/issues/163) +- [**V2**] [v2 Feedback request] Resolving conflicts over extensions [#162](https://github.com/broofa/node-mime/issues/162) +- [**V2**] Allow callers to load module with official, full, or no defined types. [#161](https://github.com/broofa/node-mime/issues/161) +- [**V2**] Use "facets" to resolve extension conflicts [#160](https://github.com/broofa/node-mime/issues/160) +- [**V2**] Remove fs and path dependencies [#152](https://github.com/broofa/node-mime/issues/152) +- [**V2**] Default content-type should not be application/octet-stream [#139](https://github.com/broofa/node-mime/issues/139) +- [**V2**] reset mime-types [#124](https://github.com/broofa/node-mime/issues/124) +- [**V2**] Extensionless paths should return null or false [#113](https://github.com/broofa/node-mime/issues/113) + +--- + +## v2.0.1 (14/09/2017) +- [**closed**] Changelog for v2.0 does not mention breaking changes [#171](https://github.com/broofa/node-mime/issues/171) +- [**closed**] MIME breaking with 'class' declaration as it is without 'use strict mode' [#170](https://github.com/broofa/node-mime/issues/170) + +--- + +## v2.0.0 (12/09/2017) +- [**closed**] woff and woff2 [#168](https://github.com/broofa/node-mime/issues/168) + +--- + +## v1.4.0 (28/08/2017) +- [**closed**] support for ac3 voc files [#159](https://github.com/broofa/node-mime/issues/159) +- [**closed**] Help understanding change from application/xml to text/xml [#158](https://github.com/broofa/node-mime/issues/158) +- [**closed**] no longer able to override mimetype [#157](https://github.com/broofa/node-mime/issues/157) +- [**closed**] application/vnd.adobe.photoshop [#147](https://github.com/broofa/node-mime/issues/147) +- [**closed**] Directories should appear as something other than application/octet-stream [#135](https://github.com/broofa/node-mime/issues/135) +- [**closed**] requested features [#131](https://github.com/broofa/node-mime/issues/131) +- [**closed**] Make types.json loading optional? [#129](https://github.com/broofa/node-mime/issues/129) +- [**closed**] Cannot find module './types.json' [#120](https://github.com/broofa/node-mime/issues/120) +- [**V2**] .wav files show up as "audio/x-wav" instead of "audio/x-wave" [#118](https://github.com/broofa/node-mime/issues/118) +- [**closed**] Don't be a pain in the ass for node community [#108](https://github.com/broofa/node-mime/issues/108) +- [**closed**] don't make default_type global [#78](https://github.com/broofa/node-mime/issues/78) +- [**closed**] mime.extension() fails if the content-type is parameterized [#74](https://github.com/broofa/node-mime/issues/74) + +--- + +## v1.3.6 (11/05/2017) +- [**closed**] .md should be text/markdown as of March 2016 [#154](https://github.com/broofa/node-mime/issues/154) +- [**closed**] Error while installing mime [#153](https://github.com/broofa/node-mime/issues/153) +- [**closed**] application/manifest+json [#149](https://github.com/broofa/node-mime/issues/149) +- [**closed**] Dynamic adaptive streaming over HTTP (DASH) file extension typo [#141](https://github.com/broofa/node-mime/issues/141) +- [**closed**] charsets image/png undefined [#140](https://github.com/broofa/node-mime/issues/140) +- [**closed**] Mime-db dependency out of date [#130](https://github.com/broofa/node-mime/issues/130) +- [**closed**] how to support plist? [#126](https://github.com/broofa/node-mime/issues/126) +- [**closed**] how does .types file format look like? [#123](https://github.com/broofa/node-mime/issues/123) +- [**closed**] Feature: support for expanding MIME patterns [#121](https://github.com/broofa/node-mime/issues/121) +- [**closed**] DEBUG_MIME doesn't work [#117](https://github.com/broofa/node-mime/issues/117) + +--- + +## v1.3.4 (06/02/2015) +*No changelog for this release.* + +--- + +## v1.3.3 (06/02/2015) +*No changelog for this release.* + +--- + +## v1.3.1 (05/02/2015) +- [**closed**] Consider adding support for Handlebars .hbs file ending [#111](https://github.com/broofa/node-mime/issues/111) +- [**closed**] Consider adding support for hjson. [#110](https://github.com/broofa/node-mime/issues/110) +- [**closed**] Add mime type for Opus audio files [#94](https://github.com/broofa/node-mime/issues/94) +- [**closed**] Consider making the `Requesting New Types` information more visible [#77](https://github.com/broofa/node-mime/issues/77) + +--- + +## v1.3.0 (05/02/2015) +- [**closed**] Add common name? [#114](https://github.com/broofa/node-mime/issues/114) +- [**closed**] application/x-yaml [#104](https://github.com/broofa/node-mime/issues/104) +- [**closed**] Add mime type for WOFF file format 2.0 [#102](https://github.com/broofa/node-mime/issues/102) +- [**closed**] application/x-msi for .msi [#99](https://github.com/broofa/node-mime/issues/99) +- [**closed**] Add mimetype for gettext translation files [#98](https://github.com/broofa/node-mime/issues/98) +- [**closed**] collaborators [#88](https://github.com/broofa/node-mime/issues/88) +- [**closed**] getting errot in installation of mime module...any1 can help? [#87](https://github.com/broofa/node-mime/issues/87) +- [**closed**] should application/json's charset be utf8? [#86](https://github.com/broofa/node-mime/issues/86) +- [**closed**] Add "license" and "licenses" to package.json [#81](https://github.com/broofa/node-mime/issues/81) +- [**closed**] lookup with extension-less file on Windows returns wrong type [#68](https://github.com/broofa/node-mime/issues/68) + +--- + +## v1.2.11 (15/08/2013) +- [**closed**] Update mime.types [#65](https://github.com/broofa/node-mime/issues/65) +- [**closed**] Publish a new version [#63](https://github.com/broofa/node-mime/issues/63) +- [**closed**] README should state upfront that "application/octet-stream" is default for unknown extension [#55](https://github.com/broofa/node-mime/issues/55) +- [**closed**] Suggested improvement to the charset API [#52](https://github.com/broofa/node-mime/issues/52) + +--- + +## v1.2.10 (25/07/2013) +- [**closed**] Mime type for woff files should be application/font-woff and not application/x-font-woff [#62](https://github.com/broofa/node-mime/issues/62) +- [**closed**] node.types in conflict with mime.types [#51](https://github.com/broofa/node-mime/issues/51) + +--- + +## v1.2.9 (17/01/2013) +- [**closed**] Please update "mime" NPM [#49](https://github.com/broofa/node-mime/issues/49) +- [**closed**] Please add semicolon [#46](https://github.com/broofa/node-mime/issues/46) +- [**closed**] parse full mime types [#43](https://github.com/broofa/node-mime/issues/43) + +--- + +## v1.2.8 (10/01/2013) +- [**closed**] /js directory mime is application/javascript. Is it correct? [#47](https://github.com/broofa/node-mime/issues/47) +- [**closed**] Add mime types for lua code. [#45](https://github.com/broofa/node-mime/issues/45) + +--- + +## v1.2.7 (19/10/2012) +- [**closed**] cannot install 1.2.7 via npm [#41](https://github.com/broofa/node-mime/issues/41) +- [**closed**] Transfer ownership to @broofa [#36](https://github.com/broofa/node-mime/issues/36) +- [**closed**] it's wrong to set charset to UTF-8 for text [#30](https://github.com/broofa/node-mime/issues/30) +- [**closed**] Allow multiple instances of MIME types container [#27](https://github.com/broofa/node-mime/issues/27) + +--- + +## v1.2.5 (16/02/2012) +- [**closed**] When looking up a types, check hasOwnProperty [#23](https://github.com/broofa/node-mime/issues/23) +- [**closed**] Bump version to 1.2.2 [#18](https://github.com/broofa/node-mime/issues/18) +- [**closed**] No license [#16](https://github.com/broofa/node-mime/issues/16) +- [**closed**] Some types missing that are used by html5/css3 [#13](https://github.com/broofa/node-mime/issues/13) +- [**closed**] npm install fails for 1.2.1 [#12](https://github.com/broofa/node-mime/issues/12) +- [**closed**] image/pjpeg + image/x-png [#10](https://github.com/broofa/node-mime/issues/10) +- [**closed**] symlink [#8](https://github.com/broofa/node-mime/issues/8) +- [**closed**] gzip [#2](https://github.com/broofa/node-mime/issues/2) +- [**closed**] ALL CAPS filenames return incorrect mime type [#1](https://github.com/broofa/node-mime/issues/1) diff --git a/graphql-subscription-express/node_modules/mime/LICENSE b/graphql-subscription-express/node_modules/mime/LICENSE new file mode 100644 index 0000000..d3f46f7 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010 Benjamin Thomas, Robert Kieffer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/mime/README.md b/graphql-subscription-express/node_modules/mime/README.md new file mode 100644 index 0000000..506fbe5 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/README.md @@ -0,0 +1,90 @@ +# mime + +Comprehensive MIME type mapping API based on mime-db module. + +## Install + +Install with [npm](http://github.com/isaacs/npm): + + npm install mime + +## Contributing / Testing + + npm run test + +## Command Line + + mime [path_string] + +E.g. + + > mime scripts/jquery.js + application/javascript + +## API - Queries + +### mime.lookup(path) +Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g. + +```js +var mime = require('mime'); + +mime.lookup('/path/to/file.txt'); // => 'text/plain' +mime.lookup('file.txt'); // => 'text/plain' +mime.lookup('.TXT'); // => 'text/plain' +mime.lookup('htm'); // => 'text/html' +``` + +### mime.default_type +Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.) + +### mime.extension(type) +Get the default extension for `type` + +```js +mime.extension('text/html'); // => 'html' +mime.extension('application/octet-stream'); // => 'bin' +``` + +### mime.charsets.lookup() + +Map mime-type to charset + +```js +mime.charsets.lookup('text/plain'); // => 'UTF-8' +``` + +(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) + +## API - Defining Custom Types + +Custom type mappings can be added on a per-project basis via the following APIs. + +### mime.define() + +Add custom mime/extension mappings + +```js +mime.define({ + 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], + 'application/x-my-type': ['x-mt', 'x-mtt'], + // etc ... +}); + +mime.lookup('x-sft'); // => 'text/x-some-format' +``` + +The first entry in the extensions array is returned by `mime.extension()`. E.g. + +```js +mime.extension('text/x-some-format'); // => 'x-sf' +``` + +### mime.load(filepath) + +Load mappings from an Apache ".types" format file + +```js +mime.load('./my_project.types'); +``` +The .types file format is simple - See the `types` dir for examples. diff --git a/graphql-subscription-express/node_modules/mime/cli.js b/graphql-subscription-express/node_modules/mime/cli.js new file mode 100755 index 0000000..20b1ffe --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/cli.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +var mime = require('./mime.js'); +var file = process.argv[2]; +var type = mime.lookup(file); + +process.stdout.write(type + '\n'); + diff --git a/graphql-subscription-express/node_modules/mime/mime.js b/graphql-subscription-express/node_modules/mime/mime.js new file mode 100644 index 0000000..d7efbde --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/mime.js @@ -0,0 +1,108 @@ +var path = require('path'); +var fs = require('fs'); + +function Mime() { + // Map of extension -> mime type + this.types = Object.create(null); + + // Map of mime type -> extension + this.extensions = Object.create(null); +} + +/** + * Define mimetype -> extension mappings. Each key is a mime-type that maps + * to an array of extensions associated with the type. The first extension is + * used as the default extension for the type. + * + * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); + * + * @param map (Object) type definitions + */ +Mime.prototype.define = function (map) { + for (var type in map) { + var exts = map[type]; + for (var i = 0; i < exts.length; i++) { + if (process.env.DEBUG_MIME && this.types[exts[i]]) { + console.warn((this._loading || "define()").replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' + + this.types[exts[i]] + ' to ' + type); + } + + this.types[exts[i]] = type; + } + + // Default extension is the first one we encounter + if (!this.extensions[type]) { + this.extensions[type] = exts[0]; + } + } +}; + +/** + * Load an Apache2-style ".types" file + * + * This may be called multiple times (it's expected). Where files declare + * overlapping types/extensions, the last file wins. + * + * @param file (String) path of file to load. + */ +Mime.prototype.load = function(file) { + this._loading = file; + // Read file and split into lines + var map = {}, + content = fs.readFileSync(file, 'ascii'), + lines = content.split(/[\r\n]+/); + + lines.forEach(function(line) { + // Clean up whitespace/comments, and split into fields + var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); + map[fields.shift()] = fields; + }); + + this.define(map); + + this._loading = null; +}; + +/** + * Lookup a mime type based on extension + */ +Mime.prototype.lookup = function(path, fallback) { + var ext = path.replace(/^.*[\.\/\\]/, '').toLowerCase(); + + return this.types[ext] || fallback || this.default_type; +}; + +/** + * Return file extension associated with a mime type + */ +Mime.prototype.extension = function(mimeType) { + var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase(); + return this.extensions[type]; +}; + +// Default instance +var mime = new Mime(); + +// Define built-in types +mime.define(require('./types.json')); + +// Default type +mime.default_type = mime.lookup('bin'); + +// +// Additional API specific to the default instance +// + +mime.Mime = Mime; + +/** + * Lookup a charset based on mime type. + */ +mime.charsets = { + lookup: function(mimeType, fallback) { + // Assume text types are utf8 + return (/^text\/|^application\/(javascript|json)/).test(mimeType) ? 'UTF-8' : fallback; + } +}; + +module.exports = mime; diff --git a/graphql-subscription-express/node_modules/mime/package.json b/graphql-subscription-express/node_modules/mime/package.json new file mode 100644 index 0000000..6bd24bc --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/package.json @@ -0,0 +1,44 @@ +{ + "author": { + "name": "Robert Kieffer", + "url": "http://github.com/broofa", + "email": "robert@broofa.com" + }, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + }, + "contributors": [ + { + "name": "Benjamin Thomas", + "url": "http://github.com/bentomas", + "email": "benjamin@benjaminthomas.org" + } + ], + "description": "A comprehensive library for mime-type mapping", + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "github-release-notes": "0.13.1", + "mime-db": "1.31.0", + "mime-score": "1.1.0" + }, + "scripts": { + "prepare": "node src/build.js", + "changelog": "gren changelog --tags=all --generate --override", + "test": "node src/test.js" + }, + "keywords": [ + "util", + "mime" + ], + "main": "mime.js", + "name": "mime", + "repository": { + "url": "https://github.com/broofa/node-mime", + "type": "git" + }, + "version": "1.6.0" +} diff --git a/graphql-subscription-express/node_modules/mime/src/build.js b/graphql-subscription-express/node_modules/mime/src/build.js new file mode 100755 index 0000000..4928e48 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/src/build.js @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const mimeScore = require('mime-score'); + +let db = require('mime-db'); +let chalk = require('chalk'); + +const STANDARD_FACET_SCORE = 900; + +const byExtension = {}; + +// Clear out any conflict extensions in mime-db +for (let type in db) { + let entry = db[type]; + entry.type = type; + + if (!entry.extensions) continue; + + entry.extensions.forEach(ext => { + if (ext in byExtension) { + const e0 = entry; + const e1 = byExtension[ext]; + e0.pri = mimeScore(e0.type, e0.source); + e1.pri = mimeScore(e1.type, e1.source); + + let drop = e0.pri < e1.pri ? e0 : e1; + let keep = e0.pri >= e1.pri ? e0 : e1; + drop.extensions = drop.extensions.filter(e => e !== ext); + + console.log(`${ext}: Keeping ${chalk.green(keep.type)} (${keep.pri}), dropping ${chalk.red(drop.type)} (${drop.pri})`); + } + byExtension[ext] = entry; + }); +} + +function writeTypesFile(types, path) { + fs.writeFileSync(path, JSON.stringify(types)); +} + +// Segregate into standard and non-standard types based on facet per +// https://tools.ietf.org/html/rfc6838#section-3.1 +const types = {}; + +Object.keys(db).sort().forEach(k => { + const entry = db[k]; + types[entry.type] = entry.extensions; +}); + +writeTypesFile(types, path.join(__dirname, '..', 'types.json')); diff --git a/graphql-subscription-express/node_modules/mime/src/test.js b/graphql-subscription-express/node_modules/mime/src/test.js new file mode 100644 index 0000000..42958a2 --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/src/test.js @@ -0,0 +1,60 @@ +/** + * Usage: node test.js + */ + +var mime = require('../mime'); +var assert = require('assert'); +var path = require('path'); + +// +// Test mime lookups +// + +assert.equal('text/plain', mime.lookup('text.txt')); // normal file +assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase +assert.equal('text/plain', mime.lookup('dir/text.txt')); // dir + file +assert.equal('text/plain', mime.lookup('.text.txt')); // hidden file +assert.equal('text/plain', mime.lookup('.txt')); // nameless +assert.equal('text/plain', mime.lookup('txt')); // extension-only +assert.equal('text/plain', mime.lookup('/txt')); // extension-less () +assert.equal('text/plain', mime.lookup('\\txt')); // Windows, extension-less +assert.equal('application/octet-stream', mime.lookup('text.nope')); // unrecognized +assert.equal('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default + +// +// Test extensions +// + +assert.equal('txt', mime.extension(mime.types.text)); +assert.equal('html', mime.extension(mime.types.htm)); +assert.equal('bin', mime.extension('application/octet-stream')); +assert.equal('bin', mime.extension('application/octet-stream ')); +assert.equal('html', mime.extension(' text/html; charset=UTF-8')); +assert.equal('html', mime.extension('text/html; charset=UTF-8 ')); +assert.equal('html', mime.extension('text/html; charset=UTF-8')); +assert.equal('html', mime.extension('text/html ; charset=UTF-8')); +assert.equal('html', mime.extension('text/html;charset=UTF-8')); +assert.equal('html', mime.extension('text/Html;charset=UTF-8')); +assert.equal(undefined, mime.extension('unrecognized')); + +// +// Test node.types lookups +// + +assert.equal('font/woff', mime.lookup('file.woff')); +assert.equal('application/octet-stream', mime.lookup('file.buffer')); +// TODO: Uncomment once #157 is resolved +// assert.equal('audio/mp4', mime.lookup('file.m4a')); +assert.equal('font/otf', mime.lookup('file.otf')); + +// +// Test charsets +// + +assert.equal('UTF-8', mime.charsets.lookup('text/plain')); +assert.equal('UTF-8', mime.charsets.lookup(mime.types.js)); +assert.equal('UTF-8', mime.charsets.lookup(mime.types.json)); +assert.equal(undefined, mime.charsets.lookup(mime.types.bin)); +assert.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); + +console.log('\nAll tests passed'); diff --git a/graphql-subscription-express/node_modules/mime/types.json b/graphql-subscription-express/node_modules/mime/types.json new file mode 100644 index 0000000..bec78ab --- /dev/null +++ b/graphql-subscription-express/node_modules/mime/types.json @@ -0,0 +1 @@ +{"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomsvc+xml":["atomsvc"],"application/bdoc":["bdoc"],"application/ccxml+xml":["ccxml"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/font-tdpfr":["pfr"],"application/font-woff":[],"application/font-woff2":[],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/prs.cww":["cww"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":[],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":[],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":[],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":[],"application/x-msdownload":["com","bat"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["wmf","emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":[],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"application/xaml+xml":["xaml"],"application/xcap-diff+xml":["xdf"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":[],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mp3":[],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/wav":["wav"],"audio/wave":[],"audio/webm":["weba"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":[],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":[],"audio/x-wav":[],"audio/xm":["xm"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/g3fax":["g3"],"image/gif":["gif"],"image/ief":["ief"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/ktx":["ktx"],"image/png":["png"],"image/prs.btif":["btif"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/tiff":["tiff","tif"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":[],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/webp":["webp"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":[],"image/x-pcx":["pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/rfc822":["eml","mime"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.vtu":["vtu"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["x3db","x3dbz"],"model/x3d+vrml":["x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/hjson":["hjson"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/prs.lines.tag":["dsc"],"text/richtext":["rtx"],"text/rtf":[],"text/sgml":["sgml","sgm"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/vtt":["vtt"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":[],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"text/xml":[],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/webm":["webm"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]} \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/ms/index.js b/graphql-subscription-express/node_modules/ms/index.js new file mode 100644 index 0000000..6a522b1 --- /dev/null +++ b/graphql-subscription-express/node_modules/ms/index.js @@ -0,0 +1,152 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/graphql-subscription-express/node_modules/ms/license.md b/graphql-subscription-express/node_modules/ms/license.md new file mode 100644 index 0000000..69b6125 --- /dev/null +++ b/graphql-subscription-express/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/ms/package.json b/graphql-subscription-express/node_modules/ms/package.json new file mode 100644 index 0000000..6a31c81 --- /dev/null +++ b/graphql-subscription-express/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.0.0", + "description": "Tiny milisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "3.19.0", + "expect.js": "0.3.1", + "husky": "0.13.3", + "lint-staged": "3.4.1", + "mocha": "3.4.1" + } +} diff --git a/graphql-subscription-express/node_modules/ms/readme.md b/graphql-subscription-express/node_modules/ms/readme.md new file mode 100644 index 0000000..84a9974 --- /dev/null +++ b/graphql-subscription-express/node_modules/ms/readme.md @@ -0,0 +1,51 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +``` + +### Convert from milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +### Time format written-out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [node](https://nodejs.org) and in the browser. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of equivalent ms is returned. + +## Caught a bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/graphql-subscription-express/node_modules/negotiator/HISTORY.md b/graphql-subscription-express/node_modules/negotiator/HISTORY.md new file mode 100644 index 0000000..a9a5449 --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/HISTORY.md @@ -0,0 +1,108 @@ +0.6.3 / 2022-01-22 +================== + + * Revert "Lazy-load modules from main entry point" + +0.6.2 / 2019-04-29 +================== + + * Fix sorting charset, encoding, and language with extra parameters + +0.6.1 / 2016-05-02 +================== + + * perf: improve `Accept` parsing speed + * perf: improve `Accept-Charset` parsing speed + * perf: improve `Accept-Encoding` parsing speed + * perf: improve `Accept-Language` parsing speed + +0.6.0 / 2015-09-29 +================== + + * Fix including type extensions in parameters in `Accept` parsing + * Fix parsing `Accept` parameters with quoted equals + * Fix parsing `Accept` parameters with quoted semicolons + * Lazy-load modules from main entry point + * perf: delay type concatenation until needed + * perf: enable strict mode + * perf: hoist regular expressions + * perf: remove closures getting spec properties + * perf: remove a closure from media type parsing + * perf: remove property delete from media type parsing + +0.5.3 / 2015-05-10 +================== + + * Fix media type parameter matching to be case-insensitive + +0.5.2 / 2015-05-06 +================== + + * Fix comparing media types with quoted values + * Fix splitting media types with quoted commas + +0.5.1 / 2015-02-14 +================== + + * Fix preference sorting to be stable for long acceptable lists + +0.5.0 / 2014-12-18 +================== + + * Fix list return order when large accepted list + * Fix missing identity encoding when q=0 exists + * Remove dynamic building of Negotiator class + +0.4.9 / 2014-10-14 +================== + + * Fix error when media type has invalid parameter + +0.4.8 / 2014-09-28 +================== + + * Fix all negotiations to be case-insensitive + * Stable sort preferences of same quality according to client order + * Support Node.js 0.6 + +0.4.7 / 2014-06-24 +================== + + * Handle invalid provided languages + * Handle invalid provided media types + +0.4.6 / 2014-06-11 +================== + + * Order by specificity when quality is the same + +0.4.5 / 2014-05-29 +================== + + * Fix regression in empty header handling + +0.4.4 / 2014-05-29 +================== + + * Fix behaviors when headers are not present + +0.4.3 / 2014-04-16 +================== + + * Handle slashes on media params correctly + +0.4.2 / 2014-02-28 +================== + + * Fix media type sorting + * Handle media types params strictly + +0.4.1 / 2014-01-16 +================== + + * Use most specific matches + +0.4.0 / 2014-01-09 +================== + + * Remove preferred prefix from methods diff --git a/graphql-subscription-express/node_modules/negotiator/LICENSE b/graphql-subscription-express/node_modules/negotiator/LICENSE new file mode 100644 index 0000000..ea6b9e2 --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Federico Romero +Copyright (c) 2012-2014 Isaac Z. Schlueter +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/negotiator/README.md b/graphql-subscription-express/node_modules/negotiator/README.md new file mode 100644 index 0000000..82915e5 --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/README.md @@ -0,0 +1,203 @@ +# negotiator + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +An HTTP content negotiator for Node.js + +## Installation + +```sh +$ npm install negotiator +``` + +## API + +```js +var Negotiator = require('negotiator') +``` + +### Accept Negotiation + +```js +availableMediaTypes = ['text/html', 'text/plain', 'application/json'] + +// The negotiator constructor receives a request object +negotiator = new Negotiator(request) + +// Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8' + +negotiator.mediaTypes() +// -> ['text/html', 'image/jpeg', 'application/*'] + +negotiator.mediaTypes(availableMediaTypes) +// -> ['text/html', 'application/json'] + +negotiator.mediaType(availableMediaTypes) +// -> 'text/html' +``` + +You can check a working example at `examples/accept.js`. + +#### Methods + +##### mediaType() + +Returns the most preferred media type from the client. + +##### mediaType(availableMediaType) + +Returns the most preferred media type from a list of available media types. + +##### mediaTypes() + +Returns an array of preferred media types ordered by the client preference. + +##### mediaTypes(availableMediaTypes) + +Returns an array of preferred media types ordered by priority from a list of +available media types. + +### Accept-Language Negotiation + +```js +negotiator = new Negotiator(request) + +availableLanguages = ['en', 'es', 'fr'] + +// Let's say Accept-Language header is 'en;q=0.8, es, pt' + +negotiator.languages() +// -> ['es', 'pt', 'en'] + +negotiator.languages(availableLanguages) +// -> ['es', 'en'] + +language = negotiator.language(availableLanguages) +// -> 'es' +``` + +You can check a working example at `examples/language.js`. + +#### Methods + +##### language() + +Returns the most preferred language from the client. + +##### language(availableLanguages) + +Returns the most preferred language from a list of available languages. + +##### languages() + +Returns an array of preferred languages ordered by the client preference. + +##### languages(availableLanguages) + +Returns an array of preferred languages ordered by priority from a list of +available languages. + +### Accept-Charset Negotiation + +```js +availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5'] + +negotiator = new Negotiator(request) + +// Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2' + +negotiator.charsets() +// -> ['utf-8', 'iso-8859-1', 'utf-7'] + +negotiator.charsets(availableCharsets) +// -> ['utf-8', 'iso-8859-1'] + +negotiator.charset(availableCharsets) +// -> 'utf-8' +``` + +You can check a working example at `examples/charset.js`. + +#### Methods + +##### charset() + +Returns the most preferred charset from the client. + +##### charset(availableCharsets) + +Returns the most preferred charset from a list of available charsets. + +##### charsets() + +Returns an array of preferred charsets ordered by the client preference. + +##### charsets(availableCharsets) + +Returns an array of preferred charsets ordered by priority from a list of +available charsets. + +### Accept-Encoding Negotiation + +```js +availableEncodings = ['identity', 'gzip'] + +negotiator = new Negotiator(request) + +// Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5' + +negotiator.encodings() +// -> ['gzip', 'identity', 'compress'] + +negotiator.encodings(availableEncodings) +// -> ['gzip', 'identity'] + +negotiator.encoding(availableEncodings) +// -> 'gzip' +``` + +You can check a working example at `examples/encoding.js`. + +#### Methods + +##### encoding() + +Returns the most preferred encoding from the client. + +##### encoding(availableEncodings) + +Returns the most preferred encoding from a list of available encodings. + +##### encodings() + +Returns an array of preferred encodings ordered by the client preference. + +##### encodings(availableEncodings) + +Returns an array of preferred encodings ordered by priority from a list of +available encodings. + +## See Also + +The [accepts](https://npmjs.org/package/accepts#readme) module builds on +this module and provides an alternative interface, mime type validation, +and more. + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/negotiator.svg +[npm-url]: https://npmjs.org/package/negotiator +[node-version-image]: https://img.shields.io/node/v/negotiator.svg +[node-version-url]: https://nodejs.org/en/download/ +[coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master +[downloads-image]: https://img.shields.io/npm/dm/negotiator.svg +[downloads-url]: https://npmjs.org/package/negotiator +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/negotiator/ci/master?label=ci +[github-actions-ci-url]: https://github.com/jshttp/negotiator/actions/workflows/ci.yml diff --git a/graphql-subscription-express/node_modules/negotiator/index.js b/graphql-subscription-express/node_modules/negotiator/index.js new file mode 100644 index 0000000..4788264 --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/index.js @@ -0,0 +1,82 @@ +/*! + * negotiator + * Copyright(c) 2012 Federico Romero + * Copyright(c) 2012-2014 Isaac Z. Schlueter + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +var preferredCharsets = require('./lib/charset') +var preferredEncodings = require('./lib/encoding') +var preferredLanguages = require('./lib/language') +var preferredMediaTypes = require('./lib/mediaType') + +/** + * Module exports. + * @public + */ + +module.exports = Negotiator; +module.exports.Negotiator = Negotiator; + +/** + * Create a Negotiator instance from a request. + * @param {object} request + * @public + */ + +function Negotiator(request) { + if (!(this instanceof Negotiator)) { + return new Negotiator(request); + } + + this.request = request; +} + +Negotiator.prototype.charset = function charset(available) { + var set = this.charsets(available); + return set && set[0]; +}; + +Negotiator.prototype.charsets = function charsets(available) { + return preferredCharsets(this.request.headers['accept-charset'], available); +}; + +Negotiator.prototype.encoding = function encoding(available) { + var set = this.encodings(available); + return set && set[0]; +}; + +Negotiator.prototype.encodings = function encodings(available) { + return preferredEncodings(this.request.headers['accept-encoding'], available); +}; + +Negotiator.prototype.language = function language(available) { + var set = this.languages(available); + return set && set[0]; +}; + +Negotiator.prototype.languages = function languages(available) { + return preferredLanguages(this.request.headers['accept-language'], available); +}; + +Negotiator.prototype.mediaType = function mediaType(available) { + var set = this.mediaTypes(available); + return set && set[0]; +}; + +Negotiator.prototype.mediaTypes = function mediaTypes(available) { + return preferredMediaTypes(this.request.headers.accept, available); +}; + +// Backwards compatibility +Negotiator.prototype.preferredCharset = Negotiator.prototype.charset; +Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets; +Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding; +Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings; +Negotiator.prototype.preferredLanguage = Negotiator.prototype.language; +Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages; +Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType; +Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes; diff --git a/graphql-subscription-express/node_modules/negotiator/lib/charset.js b/graphql-subscription-express/node_modules/negotiator/lib/charset.js new file mode 100644 index 0000000..cdd0148 --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/lib/charset.js @@ -0,0 +1,169 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredCharsets; +module.exports.preferredCharsets = preferredCharsets; + +/** + * Module variables. + * @private + */ + +var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/; + +/** + * Parse the Accept-Charset header. + * @private + */ + +function parseAcceptCharset(accept) { + var accepts = accept.split(','); + + for (var i = 0, j = 0; i < accepts.length; i++) { + var charset = parseCharset(accepts[i].trim(), i); + + if (charset) { + accepts[j++] = charset; + } + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse a charset from the Accept-Charset header. + * @private + */ + +function parseCharset(str, i) { + var match = simpleCharsetRegExp.exec(str); + if (!match) return null; + + var charset = match[1]; + var q = 1; + if (match[2]) { + var params = match[2].split(';') + for (var j = 0; j < params.length; j++) { + var p = params[j].trim().split('='); + if (p[0] === 'q') { + q = parseFloat(p[1]); + break; + } + } + } + + return { + charset: charset, + q: q, + i: i + }; +} + +/** + * Get the priority of a charset. + * @private + */ + +function getCharsetPriority(charset, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(charset, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the charset. + * @private + */ + +function specify(charset, spec, index) { + var s = 0; + if(spec.charset.toLowerCase() === charset.toLowerCase()){ + s |= 1; + } else if (spec.charset !== '*' ) { + return null + } + + return { + i: index, + o: spec.i, + q: spec.q, + s: s + } +} + +/** + * Get the preferred charsets from an Accept-Charset header. + * @public + */ + +function preferredCharsets(accept, provided) { + // RFC 2616 sec 14.2: no header = * + var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || ''); + + if (!provided) { + // sorted list of all charsets + return accepts + .filter(isQuality) + .sort(compareSpecs) + .map(getFullCharset); + } + + var priorities = provided.map(function getPriority(type, index) { + return getCharsetPriority(type, accepts, index); + }); + + // sorted list of accepted charsets + return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; +} + +/** + * Get full charset string. + * @private + */ + +function getFullCharset(spec) { + return spec.charset; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} diff --git a/graphql-subscription-express/node_modules/negotiator/lib/encoding.js b/graphql-subscription-express/node_modules/negotiator/lib/encoding.js new file mode 100644 index 0000000..8432cd7 --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/lib/encoding.js @@ -0,0 +1,184 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredEncodings; +module.exports.preferredEncodings = preferredEncodings; + +/** + * Module variables. + * @private + */ + +var simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/; + +/** + * Parse the Accept-Encoding header. + * @private + */ + +function parseAcceptEncoding(accept) { + var accepts = accept.split(','); + var hasIdentity = false; + var minQuality = 1; + + for (var i = 0, j = 0; i < accepts.length; i++) { + var encoding = parseEncoding(accepts[i].trim(), i); + + if (encoding) { + accepts[j++] = encoding; + hasIdentity = hasIdentity || specify('identity', encoding); + minQuality = Math.min(minQuality, encoding.q || 1); + } + } + + if (!hasIdentity) { + /* + * If identity doesn't explicitly appear in the accept-encoding header, + * it's added to the list of acceptable encoding with the lowest q + */ + accepts[j++] = { + encoding: 'identity', + q: minQuality, + i: i + }; + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse an encoding from the Accept-Encoding header. + * @private + */ + +function parseEncoding(str, i) { + var match = simpleEncodingRegExp.exec(str); + if (!match) return null; + + var encoding = match[1]; + var q = 1; + if (match[2]) { + var params = match[2].split(';'); + for (var j = 0; j < params.length; j++) { + var p = params[j].trim().split('='); + if (p[0] === 'q') { + q = parseFloat(p[1]); + break; + } + } + } + + return { + encoding: encoding, + q: q, + i: i + }; +} + +/** + * Get the priority of an encoding. + * @private + */ + +function getEncodingPriority(encoding, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(encoding, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the encoding. + * @private + */ + +function specify(encoding, spec, index) { + var s = 0; + if(spec.encoding.toLowerCase() === encoding.toLowerCase()){ + s |= 1; + } else if (spec.encoding !== '*' ) { + return null + } + + return { + i: index, + o: spec.i, + q: spec.q, + s: s + } +}; + +/** + * Get the preferred encodings from an Accept-Encoding header. + * @public + */ + +function preferredEncodings(accept, provided) { + var accepts = parseAcceptEncoding(accept || ''); + + if (!provided) { + // sorted list of all encodings + return accepts + .filter(isQuality) + .sort(compareSpecs) + .map(getFullEncoding); + } + + var priorities = provided.map(function getPriority(type, index) { + return getEncodingPriority(type, accepts, index); + }); + + // sorted list of accepted encodings + return priorities.filter(isQuality).sort(compareSpecs).map(function getEncoding(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; +} + +/** + * Get full encoding string. + * @private + */ + +function getFullEncoding(spec) { + return spec.encoding; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} diff --git a/graphql-subscription-express/node_modules/negotiator/lib/language.js b/graphql-subscription-express/node_modules/negotiator/lib/language.js new file mode 100644 index 0000000..a231672 --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/lib/language.js @@ -0,0 +1,179 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredLanguages; +module.exports.preferredLanguages = preferredLanguages; + +/** + * Module variables. + * @private + */ + +var simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/; + +/** + * Parse the Accept-Language header. + * @private + */ + +function parseAcceptLanguage(accept) { + var accepts = accept.split(','); + + for (var i = 0, j = 0; i < accepts.length; i++) { + var language = parseLanguage(accepts[i].trim(), i); + + if (language) { + accepts[j++] = language; + } + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse a language from the Accept-Language header. + * @private + */ + +function parseLanguage(str, i) { + var match = simpleLanguageRegExp.exec(str); + if (!match) return null; + + var prefix = match[1] + var suffix = match[2] + var full = prefix + + if (suffix) full += "-" + suffix; + + var q = 1; + if (match[3]) { + var params = match[3].split(';') + for (var j = 0; j < params.length; j++) { + var p = params[j].split('='); + if (p[0] === 'q') q = parseFloat(p[1]); + } + } + + return { + prefix: prefix, + suffix: suffix, + q: q, + i: i, + full: full + }; +} + +/** + * Get the priority of a language. + * @private + */ + +function getLanguagePriority(language, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(language, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the language. + * @private + */ + +function specify(language, spec, index) { + var p = parseLanguage(language) + if (!p) return null; + var s = 0; + if(spec.full.toLowerCase() === p.full.toLowerCase()){ + s |= 4; + } else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) { + s |= 2; + } else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) { + s |= 1; + } else if (spec.full !== '*' ) { + return null + } + + return { + i: index, + o: spec.i, + q: spec.q, + s: s + } +}; + +/** + * Get the preferred languages from an Accept-Language header. + * @public + */ + +function preferredLanguages(accept, provided) { + // RFC 2616 sec 14.4: no header = * + var accepts = parseAcceptLanguage(accept === undefined ? '*' : accept || ''); + + if (!provided) { + // sorted list of all languages + return accepts + .filter(isQuality) + .sort(compareSpecs) + .map(getFullLanguage); + } + + var priorities = provided.map(function getPriority(type, index) { + return getLanguagePriority(type, accepts, index); + }); + + // sorted list of accepted languages + return priorities.filter(isQuality).sort(compareSpecs).map(function getLanguage(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; +} + +/** + * Get full language string. + * @private + */ + +function getFullLanguage(spec) { + return spec.full; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} diff --git a/graphql-subscription-express/node_modules/negotiator/lib/mediaType.js b/graphql-subscription-express/node_modules/negotiator/lib/mediaType.js new file mode 100644 index 0000000..67309dd --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/lib/mediaType.js @@ -0,0 +1,294 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredMediaTypes; +module.exports.preferredMediaTypes = preferredMediaTypes; + +/** + * Module variables. + * @private + */ + +var simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/; + +/** + * Parse the Accept header. + * @private + */ + +function parseAccept(accept) { + var accepts = splitMediaTypes(accept); + + for (var i = 0, j = 0; i < accepts.length; i++) { + var mediaType = parseMediaType(accepts[i].trim(), i); + + if (mediaType) { + accepts[j++] = mediaType; + } + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse a media type from the Accept header. + * @private + */ + +function parseMediaType(str, i) { + var match = simpleMediaTypeRegExp.exec(str); + if (!match) return null; + + var params = Object.create(null); + var q = 1; + var subtype = match[2]; + var type = match[1]; + + if (match[3]) { + var kvps = splitParameters(match[3]).map(splitKeyValuePair); + + for (var j = 0; j < kvps.length; j++) { + var pair = kvps[j]; + var key = pair[0].toLowerCase(); + var val = pair[1]; + + // get the value, unwrapping quotes + var value = val && val[0] === '"' && val[val.length - 1] === '"' + ? val.substr(1, val.length - 2) + : val; + + if (key === 'q') { + q = parseFloat(value); + break; + } + + // store parameter + params[key] = value; + } + } + + return { + type: type, + subtype: subtype, + params: params, + q: q, + i: i + }; +} + +/** + * Get the priority of a media type. + * @private + */ + +function getMediaTypePriority(type, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(type, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the media type. + * @private + */ + +function specify(type, spec, index) { + var p = parseMediaType(type); + var s = 0; + + if (!p) { + return null; + } + + if(spec.type.toLowerCase() == p.type.toLowerCase()) { + s |= 4 + } else if(spec.type != '*') { + return null; + } + + if(spec.subtype.toLowerCase() == p.subtype.toLowerCase()) { + s |= 2 + } else if(spec.subtype != '*') { + return null; + } + + var keys = Object.keys(spec.params); + if (keys.length > 0) { + if (keys.every(function (k) { + return spec.params[k] == '*' || (spec.params[k] || '').toLowerCase() == (p.params[k] || '').toLowerCase(); + })) { + s |= 1 + } else { + return null + } + } + + return { + i: index, + o: spec.i, + q: spec.q, + s: s, + } +} + +/** + * Get the preferred media types from an Accept header. + * @public + */ + +function preferredMediaTypes(accept, provided) { + // RFC 2616 sec 14.2: no header = */* + var accepts = parseAccept(accept === undefined ? '*/*' : accept || ''); + + if (!provided) { + // sorted list of all types + return accepts + .filter(isQuality) + .sort(compareSpecs) + .map(getFullType); + } + + var priorities = provided.map(function getPriority(type, index) { + return getMediaTypePriority(type, accepts, index); + }); + + // sorted list of accepted types + return priorities.filter(isQuality).sort(compareSpecs).map(function getType(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; +} + +/** + * Get full type string. + * @private + */ + +function getFullType(spec) { + return spec.type + '/' + spec.subtype; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} + +/** + * Count the number of quotes in a string. + * @private + */ + +function quoteCount(string) { + var count = 0; + var index = 0; + + while ((index = string.indexOf('"', index)) !== -1) { + count++; + index++; + } + + return count; +} + +/** + * Split a key value pair. + * @private + */ + +function splitKeyValuePair(str) { + var index = str.indexOf('='); + var key; + var val; + + if (index === -1) { + key = str; + } else { + key = str.substr(0, index); + val = str.substr(index + 1); + } + + return [key, val]; +} + +/** + * Split an Accept header into media types. + * @private + */ + +function splitMediaTypes(accept) { + var accepts = accept.split(','); + + for (var i = 1, j = 0; i < accepts.length; i++) { + if (quoteCount(accepts[j]) % 2 == 0) { + accepts[++j] = accepts[i]; + } else { + accepts[j] += ',' + accepts[i]; + } + } + + // trim accepts + accepts.length = j + 1; + + return accepts; +} + +/** + * Split a string of parameters. + * @private + */ + +function splitParameters(str) { + var parameters = str.split(';'); + + for (var i = 1, j = 0; i < parameters.length; i++) { + if (quoteCount(parameters[j]) % 2 == 0) { + parameters[++j] = parameters[i]; + } else { + parameters[j] += ';' + parameters[i]; + } + } + + // trim parameters + parameters.length = j + 1; + + for (var i = 0; i < parameters.length; i++) { + parameters[i] = parameters[i].trim(); + } + + return parameters; +} diff --git a/graphql-subscription-express/node_modules/negotiator/package.json b/graphql-subscription-express/node_modules/negotiator/package.json new file mode 100644 index 0000000..297635f --- /dev/null +++ b/graphql-subscription-express/node_modules/negotiator/package.json @@ -0,0 +1,42 @@ +{ + "name": "negotiator", + "description": "HTTP content negotiation", + "version": "0.6.3", + "contributors": [ + "Douglas Christopher Wilson ", + "Federico Romero ", + "Isaac Z. Schlueter (http://blog.izs.me/)" + ], + "license": "MIT", + "keywords": [ + "http", + "content negotiation", + "accept", + "accept-language", + "accept-encoding", + "accept-charset" + ], + "repository": "jshttp/negotiator", + "devDependencies": { + "eslint": "7.32.0", + "eslint-plugin-markdown": "2.2.1", + "mocha": "9.1.3", + "nyc": "15.1.0" + }, + "files": [ + "lib/", + "HISTORY.md", + "LICENSE", + "index.js", + "README.md" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/object-inspect/.eslintrc b/graphql-subscription-express/node_modules/object-inspect/.eslintrc new file mode 100644 index 0000000..21f9039 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/.eslintrc @@ -0,0 +1,53 @@ +{ + "root": true, + "extends": "@ljharb", + "rules": { + "complexity": 0, + "func-style": [2, "declaration"], + "indent": [2, 4], + "max-lines": 1, + "max-lines-per-function": 1, + "max-params": [2, 4], + "max-statements": 0, + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": 0, + "no-param-reassign": 1, + "strict": 0, // TODO + }, + "overrides": [ + { + "files": ["test/**", "test-*", "example/**"], + "extends": "@ljharb/eslint-config/tests", + "rules": { + "id-length": 0, + }, + }, + { + "files": ["example/**"], + "rules": { + "no-console": 0, + }, + }, + { + "files": ["test/browser/**"], + "env": { + "browser": true, + }, + }, + { + "files": ["test/bigint*"], + "rules": { + "new-cap": [2, { "capIsNewExceptions": ["BigInt"] }], + }, + }, + { + "files": "index.js", + "globals": { + "HTMLElement": false, + }, + "rules": { + "no-use-before-define": 1, + }, + }, + ], +} diff --git a/graphql-subscription-express/node_modules/object-inspect/.github/FUNDING.yml b/graphql-subscription-express/node_modules/object-inspect/.github/FUNDING.yml new file mode 100644 index 0000000..730276b --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/object-inspect +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/object-inspect/.nycrc b/graphql-subscription-express/node_modules/object-inspect/.nycrc new file mode 100644 index 0000000..58a5db7 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "instrumentation": false, + "sourceMap": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "example", + "test", + "test-core-js.js" + ] +} diff --git a/graphql-subscription-express/node_modules/object-inspect/CHANGELOG.md b/graphql-subscription-express/node_modules/object-inspect/CHANGELOG.md new file mode 100644 index 0000000..c5772b4 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/CHANGELOG.md @@ -0,0 +1,389 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.13.1](https://github.com/inspect-js/object-inspect/compare/v1.13.0...v1.13.1) - 2023-10-19 + +### Commits + +- [Fix] in IE 8, global can !== window despite them being prototypes of each other [`30d0859`](https://github.com/inspect-js/object-inspect/commit/30d0859dc4606cf75c2410edcd5d5c6355f8d372) + +## [v1.13.0](https://github.com/inspect-js/object-inspect/compare/v1.12.3...v1.13.0) - 2023-10-14 + +### Commits + +- [New] add special handling for the global object [`431bab2`](https://github.com/inspect-js/object-inspect/commit/431bab21a490ee51d35395966a504501e8c685da) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`fd4f619`](https://github.com/inspect-js/object-inspect/commit/fd4f6193562b4b0e95dcf5c0201b4e8cbbc4f58d) +- [Dev Deps] update `mock-property`, `tape` [`b453f6c`](https://github.com/inspect-js/object-inspect/commit/b453f6ceeebf8a1b738a1029754092e0367a4134) +- [Dev Deps] update `error-cause` [`e8ffc57`](https://github.com/inspect-js/object-inspect/commit/e8ffc577d73b92bb6a4b00c44f14e3319e374888) +- [Dev Deps] update `tape` [`054b8b9`](https://github.com/inspect-js/object-inspect/commit/054b8b9b98633284cf989e582450ebfbbe53503c) +- [Dev Deps] temporarily remove `aud` due to breaking change in transitive deps [`2476845`](https://github.com/inspect-js/object-inspect/commit/2476845e0678dd290c541c81cd3dec8420782c52) +- [Dev Deps] pin `glob`, since v10.3.8+ requires a broken `jackspeak` [`383fa5e`](https://github.com/inspect-js/object-inspect/commit/383fa5eebc0afd705cc778a4b49d8e26452e49a8) +- [Dev Deps] pin `jackspeak` since 2.1.2+ depends on npm aliases, which kill the install process in npm < 6 [`68c244c`](https://github.com/inspect-js/object-inspect/commit/68c244c5174cdd877e5dcb8ee90aa3f44b2f25be) + +## [v1.12.3](https://github.com/inspect-js/object-inspect/compare/v1.12.2...v1.12.3) - 2023-01-12 + +### Commits + +- [Fix] in eg FF 24, collections lack forEach [`75fc226`](https://github.com/inspect-js/object-inspect/commit/75fc22673c82d45f28322b1946bb0eb41b672b7f) +- [actions] update rebase action to use reusable workflow [`250a277`](https://github.com/inspect-js/object-inspect/commit/250a277a095e9dacc029ab8454dcfc15de549dcd) +- [Dev Deps] update `aud`, `es-value-fixtures`, `tape` [`66a19b3`](https://github.com/inspect-js/object-inspect/commit/66a19b3209ccc3c5ef4b34c3cb0160e65d1ce9d5) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `error-cause` [`c43d332`](https://github.com/inspect-js/object-inspect/commit/c43d3324b48384a16fd3dc444e5fc589d785bef3) +- [Tests] add `@pkgjs/support` to `postlint` [`e2618d2`](https://github.com/inspect-js/object-inspect/commit/e2618d22a7a3fa361b6629b53c1752fddc9c4d80) + +## [v1.12.2](https://github.com/inspect-js/object-inspect/compare/v1.12.1...v1.12.2) - 2022-05-26 + +### Commits + +- [Fix] use `util.inspect` for a custom inspection symbol method [`e243bf2`](https://github.com/inspect-js/object-inspect/commit/e243bf2eda6c4403ac6f1146fddb14d12e9646c1) +- [meta] add support info [`ca20ba3`](https://github.com/inspect-js/object-inspect/commit/ca20ba35713c17068ca912a86c542f5e8acb656c) +- [Fix] ignore `cause` in node v16.9 and v16.10 where it has a bug [`86aa553`](https://github.com/inspect-js/object-inspect/commit/86aa553a4a455562c2c56f1540f0bf857b9d314b) + +## [v1.12.1](https://github.com/inspect-js/object-inspect/compare/v1.12.0...v1.12.1) - 2022-05-21 + +### Commits + +- [Tests] use `mock-property` [`4ec8893`](https://github.com/inspect-js/object-inspect/commit/4ec8893ea9bfd28065ca3638cf6762424bf44352) +- [meta] use `npmignore` to autogenerate an npmignore file [`07f868c`](https://github.com/inspect-js/object-inspect/commit/07f868c10bd25a9d18686528339bb749c211fc9a) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`b05244b`](https://github.com/inspect-js/object-inspect/commit/b05244b4f331e00c43b3151bc498041be77ccc91) +- [Dev Deps] update `@ljharb/eslint-config`, `error-cause`, `es-value-fixtures`, `functions-have-names`, `tape` [`d037398`](https://github.com/inspect-js/object-inspect/commit/d037398dcc5d531532e4c19c4a711ed677f579c1) +- [Fix] properly handle callable regexes in older engines [`848fe48`](https://github.com/inspect-js/object-inspect/commit/848fe48bd6dd0064ba781ee6f3c5e54a94144c37) + +## [v1.12.0](https://github.com/inspect-js/object-inspect/compare/v1.11.1...v1.12.0) - 2021-12-18 + +### Commits + +- [New] add `numericSeparator` boolean option [`2d2d537`](https://github.com/inspect-js/object-inspect/commit/2d2d537f5359a4300ce1c10241369f8024f89e11) +- [Robustness] cache more prototype methods [`191533d`](https://github.com/inspect-js/object-inspect/commit/191533da8aec98a05eadd73a5a6e979c9c8653e8) +- [New] ensure an Error’s `cause` is displayed [`53bc2ce`](https://github.com/inspect-js/object-inspect/commit/53bc2cee4e5a9cc4986f3cafa22c0685f340715e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`bc164b6`](https://github.com/inspect-js/object-inspect/commit/bc164b6e2e7d36b263970f16f54de63048b84a36) +- [Robustness] cache `RegExp.prototype.test` [`a314ab8`](https://github.com/inspect-js/object-inspect/commit/a314ab8271b905cbabc594c82914d2485a8daf12) +- [meta] fix auto-changelog settings [`5ed0983`](https://github.com/inspect-js/object-inspect/commit/5ed0983be72f73e32e2559997517a95525c7e20d) + +## [v1.11.1](https://github.com/inspect-js/object-inspect/compare/v1.11.0...v1.11.1) - 2021-12-05 + +### Commits + +- [meta] add `auto-changelog` [`7dbdd22`](https://github.com/inspect-js/object-inspect/commit/7dbdd228401d6025d8b7391476d88aee9ea9bbdf) +- [actions] reuse common workflows [`c8823bc`](https://github.com/inspect-js/object-inspect/commit/c8823bc0a8790729680709d45fb6e652432e91aa) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`7532b12`](https://github.com/inspect-js/object-inspect/commit/7532b120598307497b712890f75af8056f6d37a6) +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`94abb5d`](https://github.com/inspect-js/object-inspect/commit/94abb5d4e745bf33253942dea86b3e538d2ff6c6) +- [actions] update codecov uploader [`5ed5102`](https://github.com/inspect-js/object-inspect/commit/5ed51025267a00e53b1341357315490ac4eb0874) +- [Dev Deps] update `eslint`, `tape` [`37b2ad2`](https://github.com/inspect-js/object-inspect/commit/37b2ad26c08d94bfd01d5d07069a0b28ef4e2ad7) +- [meta] add `sideEffects` flag [`d341f90`](https://github.com/inspect-js/object-inspect/commit/d341f905ef8bffa6a694cda6ddc5ba343532cd4f) + +## [v1.11.0](https://github.com/inspect-js/object-inspect/compare/v1.10.3...v1.11.0) - 2021-07-12 + +### Commits + +- [New] `customInspect`: add `symbol` option, to mimic modern util.inspect behavior [`e973a6e`](https://github.com/inspect-js/object-inspect/commit/e973a6e21f8140c5837cf25e9d89bdde88dc3120) +- [Dev Deps] update `eslint` [`05f1cb3`](https://github.com/inspect-js/object-inspect/commit/05f1cb3cbcfe1f238e8b51cf9bc294305b7ed793) + +## [v1.10.3](https://github.com/inspect-js/object-inspect/compare/v1.10.2...v1.10.3) - 2021-05-07 + +### Commits + +- [Fix] handle core-js Symbol shams [`4acfc2c`](https://github.com/inspect-js/object-inspect/commit/4acfc2c4b503498759120eb517abad6d51c9c5d6) +- [readme] update badges [`95c323a`](https://github.com/inspect-js/object-inspect/commit/95c323ad909d6cbabb95dd6015c190ba6db9c1f2) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`cb38f48`](https://github.com/inspect-js/object-inspect/commit/cb38f485de6ec7a95109b5a9bbd0a1deba2f6611) + +## [v1.10.2](https://github.com/inspect-js/object-inspect/compare/v1.10.1...v1.10.2) - 2021-04-17 + +### Commits + +- [Fix] use a robust check for a boxed Symbol [`87f12d6`](https://github.com/inspect-js/object-inspect/commit/87f12d6e69ce530be04659c81a4cd502943acac5) + +## [v1.10.1](https://github.com/inspect-js/object-inspect/compare/v1.10.0...v1.10.1) - 2021-04-17 + +### Commits + +- [Fix] use a robust check for a boxed bigint [`d5ca829`](https://github.com/inspect-js/object-inspect/commit/d5ca8298b6d2e5c7b9334a5b21b96ed95d225c91) + +## [v1.10.0](https://github.com/inspect-js/object-inspect/compare/v1.9.0...v1.10.0) - 2021-04-17 + +### Commits + +- [Tests] increase coverage [`d8abb8a`](https://github.com/inspect-js/object-inspect/commit/d8abb8a62c2f084919df994a433b346e0d87a227) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`4bfec2e`](https://github.com/inspect-js/object-inspect/commit/4bfec2e30aaef6ddef6cbb1448306f9f8b9520b7) +- [New] respect `Symbol.toStringTag` on objects [`799b58f`](https://github.com/inspect-js/object-inspect/commit/799b58f536a45e4484633a8e9daeb0330835f175) +- [Fix] do not allow Symbol.toStringTag to masquerade as builtins [`d6c5b37`](https://github.com/inspect-js/object-inspect/commit/d6c5b37d7e94427796b82432fb0c8964f033a6ab) +- [New] add `WeakRef` support [`b6d898e`](https://github.com/inspect-js/object-inspect/commit/b6d898ee21868c780a7ee66b28532b5b34ed7f09) +- [meta] do not publish github action workflow files [`918cdfc`](https://github.com/inspect-js/object-inspect/commit/918cdfc4b6fe83f559ff6ef04fe66201e3ff5cbd) +- [meta] create `FUNDING.yml` [`0bb5fc5`](https://github.com/inspect-js/object-inspect/commit/0bb5fc516dbcd2cd728bd89cee0b580acc5ce301) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`22c8dc0`](https://github.com/inspect-js/object-inspect/commit/22c8dc0cac113d70f4781e49a950070923a671be) +- [meta] use `prepublishOnly` script for npm 7+ [`e52ee09`](https://github.com/inspect-js/object-inspect/commit/e52ee09e8050b8dbac94ef57f786675567728223) +- [Dev Deps] update `eslint` [`7c4e6fd`](https://github.com/inspect-js/object-inspect/commit/7c4e6fdedcd27cc980e13c9ad834d05a96f3d40c) + +## [v1.9.0](https://github.com/inspect-js/object-inspect/compare/v1.8.0...v1.9.0) - 2020-11-30 + +### Commits + +- [Tests] migrate tests to Github Actions [`d262251`](https://github.com/inspect-js/object-inspect/commit/d262251e13e16d3490b5473672f6b6d6ff86675d) +- [New] add enumerable own Symbols to plain object output [`ee60c03`](https://github.com/inspect-js/object-inspect/commit/ee60c033088cff9d33baa71e59a362a541b48284) +- [Tests] add passing tests [`01ac3e4`](https://github.com/inspect-js/object-inspect/commit/01ac3e4b5a30f97875a63dc9b1416b3bd626afc9) +- [actions] add "Require Allow Edits" action [`c2d7746`](https://github.com/inspect-js/object-inspect/commit/c2d774680cde4ca4af332d84d4121b26f798ba9e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `core-js` [`70058de`](https://github.com/inspect-js/object-inspect/commit/70058de1579fc54d1d15ed6c2dbe246637ce70ff) +- [Fix] hex characters in strings should be uppercased, to match node `assert` [`6ab8faa`](https://github.com/inspect-js/object-inspect/commit/6ab8faaa0abc08fe7a8e2afd8b39c6f1f0e00113) +- [Tests] run `nyc` on all tests [`4c47372`](https://github.com/inspect-js/object-inspect/commit/4c473727879ddc8e28b599202551ddaaf07b6210) +- [Tests] node 0.8 has an unpredictable property order; fix `groups` test by removing property [`f192069`](https://github.com/inspect-js/object-inspect/commit/f192069a978a3b60e6f0e0d45ac7df260ab9a778) +- [New] add enumerable properties to Function inspect result, per node’s `assert` [`fd38e1b`](https://github.com/inspect-js/object-inspect/commit/fd38e1bc3e2a1dc82091ce3e021917462eee64fc) +- [Tests] fix tests for node < 10, due to regex match `groups` [`2ac6462`](https://github.com/inspect-js/object-inspect/commit/2ac6462cc4f72eaa0b63a8cfee9aabe3008b2330) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`44b59e2`](https://github.com/inspect-js/object-inspect/commit/44b59e2676a7f825ef530dfd19dafb599e3b9456) +- [Robustness] cache `Symbol.prototype.toString` [`f3c2074`](https://github.com/inspect-js/object-inspect/commit/f3c2074d8f32faf8292587c07c9678ea931703dd) +- [Dev Deps] update `eslint` [`9411294`](https://github.com/inspect-js/object-inspect/commit/94112944b9245e3302e25453277876402d207e7f) +- [meta] `require-allow-edits` no longer requires an explicit github token [`36c0220`](https://github.com/inspect-js/object-inspect/commit/36c02205de3c2b0e84d53777c5c9fd54a36c48ab) +- [actions] update rebase checkout action to v2 [`55a39a6`](https://github.com/inspect-js/object-inspect/commit/55a39a64e944f19c6a7d8efddf3df27700f20d14) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`f59fd3c`](https://github.com/inspect-js/object-inspect/commit/f59fd3cf406c3a7c7ece140904a80bbc6bacfcca) +- [Dev Deps] update `eslint` [`a492bec`](https://github.com/inspect-js/object-inspect/commit/a492becec644b0155c9c4bc1caf6f9fac11fb2c7) + +## [v1.8.0](https://github.com/inspect-js/object-inspect/compare/v1.7.0...v1.8.0) - 2020-06-18 + +### Fixed + +- [New] add `indent` option [`#27`](https://github.com/inspect-js/object-inspect/issues/27) + +### Commits + +- [Tests] add codecov [`4324cbb`](https://github.com/inspect-js/object-inspect/commit/4324cbb1a2bd7710822a4151ff373570db22453e) +- [New] add `maxStringLength` option [`b3995cb`](https://github.com/inspect-js/object-inspect/commit/b3995cb71e15b5ee127a3094c43994df9d973502) +- [New] add `customInspect` option, to disable custom inspect methods [`28b9179`](https://github.com/inspect-js/object-inspect/commit/28b9179ee802bb3b90810100c11637db90c2fb6d) +- [Tests] add Date and RegExp tests [`3b28eca`](https://github.com/inspect-js/object-inspect/commit/3b28eca57b0367aeadffac604ea09e8bdae7d97b) +- [actions] add automatic rebasing / merge commit blocking [`0d9c6c0`](https://github.com/inspect-js/object-inspect/commit/0d9c6c044e83475ff0bfffb9d35b149834c83a2e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `tape`; add `aud` [`7c204f2`](https://github.com/inspect-js/object-inspect/commit/7c204f22b9e41bc97147f4d32d4cb045b17769a6) +- [readme] fix repo URLs, remove testling [`34ca9a0`](https://github.com/inspect-js/object-inspect/commit/34ca9a0dabfe75bd311f806a326fadad029909a3) +- [Fix] when truncating a deep array, note it as `[Array]` instead of just `[Object]` [`f74c82d`](https://github.com/inspect-js/object-inspect/commit/f74c82dd0b35386445510deb250f34c41be3ec0e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`1a8a5ea`](https://github.com/inspect-js/object-inspect/commit/1a8a5ea069ea2bee89d77caedad83ffa23d35711) +- [Fix] do not be fooled by a function’s own `toString` method [`7cb5c65`](https://github.com/inspect-js/object-inspect/commit/7cb5c657a976f94715c19c10556a30f15bb7d5d7) +- [patch] indicate explicitly that anon functions are anonymous, to match node [`81ebdd4`](https://github.com/inspect-js/object-inspect/commit/81ebdd4215005144074bbdff3f6bafa01407910a) +- [Dev Deps] loosen the `core-js` dep [`e7472e8`](https://github.com/inspect-js/object-inspect/commit/e7472e8e242117670560bd995830c2a4d12080f5) +- [Dev Deps] update `tape` [`699827e`](https://github.com/inspect-js/object-inspect/commit/699827e6b37258b5203c33c78c009bf4b0e6a66d) +- [meta] add `safe-publish-latest` [`c5d2868`](https://github.com/inspect-js/object-inspect/commit/c5d2868d6eb33c472f37a20f89ceef2787046088) +- [Dev Deps] update `@ljharb/eslint-config` [`9199501`](https://github.com/inspect-js/object-inspect/commit/919950195d486114ccebacbdf9d74d7f382693b0) + +## [v1.7.0](https://github.com/inspect-js/object-inspect/compare/v1.6.0...v1.7.0) - 2019-11-10 + +### Commits + +- [Tests] use shared travis-ci configs [`19899ed`](https://github.com/inspect-js/object-inspect/commit/19899edbf31f4f8809acf745ce34ad1ce1bfa63b) +- [Tests] add linting [`a00f057`](https://github.com/inspect-js/object-inspect/commit/a00f057d917f66ea26dd37769c6b810ec4af97e8) +- [Tests] lint last file [`2698047`](https://github.com/inspect-js/object-inspect/commit/2698047b58af1e2e88061598ef37a75f228dddf6) +- [Tests] up to `node` `v12.7`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`589e87a`](https://github.com/inspect-js/object-inspect/commit/589e87a99cadcff4b600e6a303418e9d922836e8) +- [New] add support for `WeakMap` and `WeakSet` [`3ddb3e4`](https://github.com/inspect-js/object-inspect/commit/3ddb3e4e0c8287130c61a12e0ed9c104b1549306) +- [meta] clean up license so github can detect it properly [`27527bb`](https://github.com/inspect-js/object-inspect/commit/27527bb801520c9610c68cc3b55d6f20a2bee56d) +- [Tests] cover `util.inspect.custom` [`36d47b9`](https://github.com/inspect-js/object-inspect/commit/36d47b9c59056a57ef2f1491602c726359561800) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `tape` [`b614eaa`](https://github.com/inspect-js/object-inspect/commit/b614eaac901da0e5c69151f534671f990a94cace) +- [Tests] fix coverage thresholds [`7b7b176`](https://github.com/inspect-js/object-inspect/commit/7b7b176e15f8bd6e8b2f261ff5a493c2fe78d9c2) +- [Tests] bigint tests now can run on unflagged node [`063af31`](https://github.com/inspect-js/object-inspect/commit/063af31ce9cd13c202e3b67c07ba06dc9b7c0f81) +- [Refactor] add early bailout to `isMap` and `isSet` checks [`fc51047`](https://github.com/inspect-js/object-inspect/commit/fc5104714a3671d37e225813db79470d6335683b) +- [meta] add `funding` field [`7f9953a`](https://github.com/inspect-js/object-inspect/commit/7f9953a113eec7b064a6393cf9f90ba15f1d131b) +- [Tests] Fix invalid strict-mode syntax with hexadecimal [`a8b5425`](https://github.com/inspect-js/object-inspect/commit/a8b542503b4af1599a275209a1a99f5fdedb1ead) +- [Dev Deps] update `@ljharb/eslint-config` [`98df157`](https://github.com/inspect-js/object-inspect/commit/98df1577314d9188a3fc3f17fdcf2fba697ae1bd) +- add copyright to LICENSE [`bb69fd0`](https://github.com/inspect-js/object-inspect/commit/bb69fd017a062d299e44da1f9b2c7dcd67f621e6) +- [Tests] use `npx aud` in `posttest` [`4838353`](https://github.com/inspect-js/object-inspect/commit/4838353593974cf7f905b9ef04c03c094f0cdbe2) +- [Tests] move `0.6` to allowed failures, because it won‘t build on travis [`1bff32a`](https://github.com/inspect-js/object-inspect/commit/1bff32aa52e8aea687f0856b28ba754b3e43ebf7) + +## [v1.6.0](https://github.com/inspect-js/object-inspect/compare/v1.5.0...v1.6.0) - 2018-05-02 + +### Commits + +- [New] add support for boxed BigInt primitives [`356c66a`](https://github.com/inspect-js/object-inspect/commit/356c66a410e7aece7162c8319880a5ef647beaa9) +- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9` [`c77b65b`](https://github.com/inspect-js/object-inspect/commit/c77b65bba593811b906b9ec57561c5cba92e2db3) +- [New] Add support for upcoming `BigInt` [`1ac548e`](https://github.com/inspect-js/object-inspect/commit/1ac548e4b27e26466c28c9a5e63e5d4e0591c31f) +- [Tests] run bigint tests in CI with --harmony-bigint flag [`d31b738`](https://github.com/inspect-js/object-inspect/commit/d31b73831880254b5c6cf5691cda9a149fbc5f04) +- [Dev Deps] update `core-js`, `tape` [`ff9eff6`](https://github.com/inspect-js/object-inspect/commit/ff9eff67113341ee1aaf80c1c22d683f43bfbccf) +- [Docs] fix example to use `safer-buffer` [`48cae12`](https://github.com/inspect-js/object-inspect/commit/48cae12a73ec6cacc955175bc56bbe6aee6a211f) + +## [v1.5.0](https://github.com/inspect-js/object-inspect/compare/v1.4.1...v1.5.0) - 2017-12-25 + +### Commits + +- [New] add `quoteStyle` option [`f5a72d2`](https://github.com/inspect-js/object-inspect/commit/f5a72d26edb3959b048f74c056ca7100a6b091e4) +- [Tests] add more test coverage [`30ebe4e`](https://github.com/inspect-js/object-inspect/commit/30ebe4e1fa943b99ecbb85be7614256d536e2759) +- [Tests] require 0.6 to pass [`99a008c`](https://github.com/inspect-js/object-inspect/commit/99a008ccace189a60fd7da18bf00e32c9572b980) + +## [v1.4.1](https://github.com/inspect-js/object-inspect/compare/v1.4.0...v1.4.1) - 2017-12-19 + +### Commits + +- [Tests] up to `node` `v9.3`, `v8.9`, `v6.12` [`6674476`](https://github.com/inspect-js/object-inspect/commit/6674476cc56acaac1bde96c84fed5ef631911906) +- [Fix] `inspect(Object(-0))` should be “Object(-0)”, not “Object(0)” [`d0a031f`](https://github.com/inspect-js/object-inspect/commit/d0a031f1cbb3024ee9982bfe364dd18a7e4d1bd3) + +## [v1.4.0](https://github.com/inspect-js/object-inspect/compare/v1.3.0...v1.4.0) - 2017-10-24 + +### Commits + +- [Tests] add `npm run coverage` [`3b48fb2`](https://github.com/inspect-js/object-inspect/commit/3b48fb25db037235eeb808f0b2830aad7aa36f70) +- [Tests] remove commented-out osx builds [`71e24db`](https://github.com/inspect-js/object-inspect/commit/71e24db8ad6ee3b9b381c5300b0475f2ba595a73) +- [New] add support for `util.inspect.custom`, in node only. [`20cca77`](https://github.com/inspect-js/object-inspect/commit/20cca7762d7e17f15b21a90793dff84acce155df) +- [Tests] up to `node` `v8.6`; use `nvm install-latest-npm` to ensure new npm doesn’t break old node [`252952d`](https://github.com/inspect-js/object-inspect/commit/252952d230d8065851dd3d4d5fe8398aae068529) +- [Tests] up to `node` `v8.8` [`4aa868d`](https://github.com/inspect-js/object-inspect/commit/4aa868d3a62914091d489dd6ec6eed194ee67cd3) +- [Dev Deps] update `core-js`, `tape` [`59483d1`](https://github.com/inspect-js/object-inspect/commit/59483d1df418f852f51fa0db7b24aa6b0209a27a) + +## [v1.3.0](https://github.com/inspect-js/object-inspect/compare/v1.2.2...v1.3.0) - 2017-07-31 + +### Fixed + +- [Fix] Map/Set: work around core-js bug < v2.5.0 [`#9`](https://github.com/inspect-js/object-inspect/issues/9) + +### Commits + +- [New] add support for arrays with additional object keys [`0d19937`](https://github.com/inspect-js/object-inspect/commit/0d199374ee37959e51539616666f420ccb29acb9) +- [Tests] up to `node` `v8.2`, `v7.10`, `v6.11`; fix new npm breaking on older nodes [`e24784a`](https://github.com/inspect-js/object-inspect/commit/e24784a90c49117787157a12a63897c49cf89bbb) +- Only apps should have lockfiles [`c6faebc`](https://github.com/inspect-js/object-inspect/commit/c6faebcb2ee486a889a4a1c4d78c0776c7576185) +- [Dev Deps] update `tape` [`7345a0a`](https://github.com/inspect-js/object-inspect/commit/7345a0aeba7e91b888a079c10004d17696a7f586) + +## [v1.2.2](https://github.com/inspect-js/object-inspect/compare/v1.2.1...v1.2.2) - 2017-03-24 + +### Commits + +- [Tests] up to `node` `v7.7`, `v6.10`, `v4.8`; improve test matrix [`a2ddc15`](https://github.com/inspect-js/object-inspect/commit/a2ddc15a1f2c65af18076eea1c0eb9cbceb478a0) +- [Tests] up to `node` `v7.0`, `v6.9`, `v5.12`, `v4.6`, `io.js` `v3.3`; improve test matrix [`a48949f`](https://github.com/inspect-js/object-inspect/commit/a48949f6b574b2d4d2298109d8e8d0eb3e7a83e7) +- [Performance] check for primitive types as early as possible. [`3b8092a`](https://github.com/inspect-js/object-inspect/commit/3b8092a2a4deffd0575f94334f00194e2d48dad3) +- [Refactor] remove unneeded `else`s. [`7255034`](https://github.com/inspect-js/object-inspect/commit/725503402e08de4f96f6bf2d8edef44ac36f26b6) +- [Refactor] avoid recreating `lowbyte` function every time. [`81edd34`](https://github.com/inspect-js/object-inspect/commit/81edd3475bd15bdd18e84de7472033dcf5004aaa) +- [Fix] differentiate -0 from 0 [`521d345`](https://github.com/inspect-js/object-inspect/commit/521d3456b009da7bf1c5785c8a9df5a9f8718264) +- [Refactor] move object key gathering into separate function [`aca6265`](https://github.com/inspect-js/object-inspect/commit/aca626536eaeef697196c6e9db3e90e7e0355b6a) +- [Refactor] consolidate wrapping logic for boxed primitives into a function. [`4e440cd`](https://github.com/inspect-js/object-inspect/commit/4e440cd9065df04802a2a1dead03f48c353ca301) +- [Robustness] use `typeof` instead of comparing to literal `undefined` [`5ca6f60`](https://github.com/inspect-js/object-inspect/commit/5ca6f601937506daff8ed2fcf686363b55807b69) +- [Refactor] consolidate Map/Set notations. [`4e576e5`](https://github.com/inspect-js/object-inspect/commit/4e576e5d7ed2f9ec3fb7f37a0d16732eb10758a9) +- [Tests] ensure that this function remains anonymous, despite ES6 name inference. [`7540ae5`](https://github.com/inspect-js/object-inspect/commit/7540ae591278756db614fa4def55ca413150e1a3) +- [Refactor] explicitly coerce Error objects to strings. [`7f4ca84`](https://github.com/inspect-js/object-inspect/commit/7f4ca8424ee8dc2c0ca5a422d94f7fac40327261) +- [Refactor] split up `var` declarations for debuggability [`6f2c11e`](https://github.com/inspect-js/object-inspect/commit/6f2c11e6a85418586a00292dcec5e97683f89bc3) +- [Robustness] cache `Object.prototype.toString` [`df44a20`](https://github.com/inspect-js/object-inspect/commit/df44a20adfccf31529d60d1df2079bfc3c836e27) +- [Dev Deps] update `tape` [`3ec714e`](https://github.com/inspect-js/object-inspect/commit/3ec714eba57bc3f58a6eb4fca1376f49e70d300a) +- [Dev Deps] update `tape` [`beb72d9`](https://github.com/inspect-js/object-inspect/commit/beb72d969653747d7cde300393c28755375329b0) + +## [v1.2.1](https://github.com/inspect-js/object-inspect/compare/v1.2.0...v1.2.1) - 2016-04-09 + +### Fixed + +- [Fix] fix Boolean `false` object inspection. [`#7`](https://github.com/substack/object-inspect/pull/7) + +## [v1.2.0](https://github.com/inspect-js/object-inspect/compare/v1.1.0...v1.2.0) - 2016-04-09 + +### Fixed + +- [New] add support for inspecting String/Number/Boolean objects. [`#6`](https://github.com/inspect-js/object-inspect/issues/6) + +### Commits + +- [Dev Deps] update `tape` [`742caa2`](https://github.com/inspect-js/object-inspect/commit/742caa262cf7af4c815d4821c8bd0129c1446432) + +## [v1.1.0](https://github.com/inspect-js/object-inspect/compare/1.0.2...v1.1.0) - 2015-12-14 + +### Merged + +- [New] add ES6 Map/Set support. [`#4`](https://github.com/inspect-js/object-inspect/pull/4) + +### Fixed + +- [New] add ES6 Map/Set support. [`#3`](https://github.com/inspect-js/object-inspect/issues/3) + +### Commits + +- Update `travis.yml` to test on bunches of `iojs` and `node` versions. [`4c1fd65`](https://github.com/inspect-js/object-inspect/commit/4c1fd65cc3bd95307e854d114b90478324287fd2) +- [Dev Deps] update `tape` [`88a907e`](https://github.com/inspect-js/object-inspect/commit/88a907e33afbe408e4b5d6e4e42a33143f88848c) + +## [1.0.2](https://github.com/inspect-js/object-inspect/compare/1.0.1...1.0.2) - 2015-08-07 + +### Commits + +- [Fix] Cache `Object.prototype.hasOwnProperty` in case it's deleted later. [`1d0075d`](https://github.com/inspect-js/object-inspect/commit/1d0075d3091dc82246feeb1f9871cb2b8ed227b3) +- [Dev Deps] Update `tape` [`ca8d5d7`](https://github.com/inspect-js/object-inspect/commit/ca8d5d75635ddbf76f944e628267581e04958457) +- gitignore node_modules since this is a reusable modules. [`ed41407`](https://github.com/inspect-js/object-inspect/commit/ed41407811743ca530cdeb28f982beb96026af82) + +## [1.0.1](https://github.com/inspect-js/object-inspect/compare/1.0.0...1.0.1) - 2015-07-19 + +### Commits + +- Make `inspect` work with symbol primitives and objects, including in node 0.11 and 0.12. [`ddf1b94`](https://github.com/inspect-js/object-inspect/commit/ddf1b94475ab951f1e3bccdc0a48e9073cfbfef4) +- bump tape [`103d674`](https://github.com/inspect-js/object-inspect/commit/103d67496b504bdcfdd765d303a773f87ec106e2) +- use newer travis config [`d497276`](https://github.com/inspect-js/object-inspect/commit/d497276c1da14234bb5098a59cf20de75fbc316a) + +## [1.0.0](https://github.com/inspect-js/object-inspect/compare/0.4.0...1.0.0) - 2014-08-05 + +### Commits + +- error inspect works properly [`260a22d`](https://github.com/inspect-js/object-inspect/commit/260a22d134d3a8a482c67d52091c6040c34f4299) +- seen coverage [`57269e8`](https://github.com/inspect-js/object-inspect/commit/57269e8baa992a7439047f47325111fdcbcb8417) +- htmlelement instance coverage [`397ffe1`](https://github.com/inspect-js/object-inspect/commit/397ffe10a1980350868043ef9de65686d438979f) +- more element coverage [`6905cc2`](https://github.com/inspect-js/object-inspect/commit/6905cc2f7df35600177e613b0642b4df5efd3eca) +- failing test for type errors [`385b615`](https://github.com/inspect-js/object-inspect/commit/385b6152e49b51b68449a662f410b084ed7c601a) +- fn name coverage [`edc906d`](https://github.com/inspect-js/object-inspect/commit/edc906d40fca6b9194d304062c037ee8e398c4c2) +- server-side element test [`362d1d3`](https://github.com/inspect-js/object-inspect/commit/362d1d3e86f187651c29feeb8478110afada385b) +- custom inspect fn [`e89b0f6`](https://github.com/inspect-js/object-inspect/commit/e89b0f6fe6d5e03681282af83732a509160435a6) +- fixed browser test [`b530882`](https://github.com/inspect-js/object-inspect/commit/b5308824a1c8471c5617e394766a03a6977102a9) +- depth test, matches node [`1cfd9e0`](https://github.com/inspect-js/object-inspect/commit/1cfd9e0285a4ae1dff44101ad482915d9bf47e48) +- exercise hasOwnProperty path [`8d753fb`](https://github.com/inspect-js/object-inspect/commit/8d753fb362a534fa1106e4d80f2ee9bea06a66d9) +- more cases covered for errors [`c5c46a5`](https://github.com/inspect-js/object-inspect/commit/c5c46a569ec4606583497e8550f0d8c7ad39a4a4) +- \W obj key test case [`b0eceee`](https://github.com/inspect-js/object-inspect/commit/b0eceeea6e0eb94d686c1046e99b9e25e5005f75) +- coverage for explicit depth param [`e12b91c`](https://github.com/inspect-js/object-inspect/commit/e12b91cd59683362f3a0e80f46481a0211e26c15) + +## [0.4.0](https://github.com/inspect-js/object-inspect/compare/0.3.1...0.4.0) - 2014-03-21 + +### Commits + +- passing lowbyte interpolation test [`b847511`](https://github.com/inspect-js/object-inspect/commit/b8475114f5def7e7961c5353d48d3d8d9a520985) +- lowbyte test [`4a2b0e1`](https://github.com/inspect-js/object-inspect/commit/4a2b0e142667fc933f195472759385ac08f3946c) + +## [0.3.1](https://github.com/inspect-js/object-inspect/compare/0.3.0...0.3.1) - 2014-03-04 + +### Commits + +- sort keys [`a07b19c`](https://github.com/inspect-js/object-inspect/commit/a07b19cc3b1521a82d4fafb6368b7a9775428a05) + +## [0.3.0](https://github.com/inspect-js/object-inspect/compare/0.2.0...0.3.0) - 2014-03-04 + +### Commits + +- [] and {} instead of [ ] and { } [`654c44b`](https://github.com/inspect-js/object-inspect/commit/654c44b2865811f3519e57bb8526e0821caf5c6b) + +## [0.2.0](https://github.com/inspect-js/object-inspect/compare/0.1.3...0.2.0) - 2014-03-04 + +### Commits + +- failing holes test [`99cdfad`](https://github.com/inspect-js/object-inspect/commit/99cdfad03c6474740275a75636fe6ca86c77737a) +- regex already work [`e324033`](https://github.com/inspect-js/object-inspect/commit/e324033267025995ec97d32ed0a65737c99477a6) +- failing undef/null test [`1f88a00`](https://github.com/inspect-js/object-inspect/commit/1f88a00265d3209719dda8117b7e6360b4c20943) +- holes in the all example [`7d345f3`](https://github.com/inspect-js/object-inspect/commit/7d345f3676dcbe980cff89a4f6c243269ebbb709) +- check for .inspect(), fixes Buffer use-case [`c3f7546`](https://github.com/inspect-js/object-inspect/commit/c3f75466dbca125347d49847c05262c292f12b79) +- fixes for holes [`ce25f73`](https://github.com/inspect-js/object-inspect/commit/ce25f736683de4b92ff27dc5471218415e2d78d8) +- weird null behavior [`405c1ea`](https://github.com/inspect-js/object-inspect/commit/405c1ea72cd5a8cf3b498c3eaa903d01b9fbcab5) +- tape is actually a devDependency, upgrade [`703b0ce`](https://github.com/inspect-js/object-inspect/commit/703b0ce6c5817b4245a082564bccd877e0bb6990) +- put date in the example [`a342219`](https://github.com/inspect-js/object-inspect/commit/a3422190eeaa013215f46df2d0d37b48595ac058) +- passing the null test [`4ab737e`](https://github.com/inspect-js/object-inspect/commit/4ab737ebf862a75d247ebe51e79307a34d6380d4) + +## [0.1.3](https://github.com/inspect-js/object-inspect/compare/0.1.1...0.1.3) - 2013-07-26 + +### Commits + +- special isElement() check [`882768a`](https://github.com/inspect-js/object-inspect/commit/882768a54035d30747be9de1baf14e5aa0daa128) +- oh right old IEs don't have indexOf either [`36d1275`](https://github.com/inspect-js/object-inspect/commit/36d12756c38b08a74370b0bb696c809e529913a5) + +## [0.1.1](https://github.com/inspect-js/object-inspect/compare/0.1.0...0.1.1) - 2013-07-26 + +### Commits + +- tests! [`4422fd9`](https://github.com/inspect-js/object-inspect/commit/4422fd95532c2745aa6c4f786f35f1090be29998) +- fix for ie<9, doesn't have hasOwnProperty [`6b7d611`](https://github.com/inspect-js/object-inspect/commit/6b7d61183050f6da801ea04473211da226482613) +- fix for all IEs: no f.name [`4e0c2f6`](https://github.com/inspect-js/object-inspect/commit/4e0c2f6dfd01c306d067d7163319acc97c94ee50) +- badges [`5ed0d88`](https://github.com/inspect-js/object-inspect/commit/5ed0d88e4e407f9cb327fa4a146c17921f9680f3) + +## [0.1.0](https://github.com/inspect-js/object-inspect/compare/0.0.0...0.1.0) - 2013-07-26 + +### Commits + +- [Function] for functions [`ad5c485`](https://github.com/inspect-js/object-inspect/commit/ad5c485098fc83352cb540a60b2548ca56820e0b) + +## 0.0.0 - 2013-07-26 + +### Commits + +- working browser example [`34be6b6`](https://github.com/inspect-js/object-inspect/commit/34be6b6548f9ce92bdc3c27572857ba0c4a1218d) +- package.json etc [`cad51f2`](https://github.com/inspect-js/object-inspect/commit/cad51f23fc6bcf1a456ed6abe16088256c2f632f) +- docs complete [`b80cce2`](https://github.com/inspect-js/object-inspect/commit/b80cce2490c4e7183a9ee11ea89071f0abec4446) +- circular example [`4b4a7b9`](https://github.com/inspect-js/object-inspect/commit/4b4a7b92209e4e6b4630976cb6bcd17d14165a59) +- string rep [`7afb479`](https://github.com/inspect-js/object-inspect/commit/7afb479baa798d27f09e0a178b72ea327f60f5c8) diff --git a/graphql-subscription-express/node_modules/object-inspect/LICENSE b/graphql-subscription-express/node_modules/object-inspect/LICENSE new file mode 100644 index 0000000..ca64cc1 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/object-inspect/example/all.js b/graphql-subscription-express/node_modules/object-inspect/example/all.js new file mode 100644 index 0000000..2f3355c --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/example/all.js @@ -0,0 +1,23 @@ +'use strict'; + +var inspect = require('../'); +var Buffer = require('safer-buffer').Buffer; + +var holes = ['a', 'b']; +holes[4] = 'e'; +holes[6] = 'g'; + +var obj = { + a: 1, + b: [3, 4, undefined, null], + c: undefined, + d: null, + e: { + regex: /^x/i, + buf: Buffer.from('abc'), + holes: holes + }, + now: new Date() +}; +obj.self = obj; +console.log(inspect(obj)); diff --git a/graphql-subscription-express/node_modules/object-inspect/example/circular.js b/graphql-subscription-express/node_modules/object-inspect/example/circular.js new file mode 100644 index 0000000..487a7c1 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/example/circular.js @@ -0,0 +1,6 @@ +'use strict'; + +var inspect = require('../'); +var obj = { a: 1, b: [3, 4] }; +obj.c = obj; +console.log(inspect(obj)); diff --git a/graphql-subscription-express/node_modules/object-inspect/example/fn.js b/graphql-subscription-express/node_modules/object-inspect/example/fn.js new file mode 100644 index 0000000..9b5db8d --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/example/fn.js @@ -0,0 +1,5 @@ +'use strict'; + +var inspect = require('../'); +var obj = [1, 2, function f(n) { return n + 5; }, 4]; +console.log(inspect(obj)); diff --git a/graphql-subscription-express/node_modules/object-inspect/example/inspect.js b/graphql-subscription-express/node_modules/object-inspect/example/inspect.js new file mode 100644 index 0000000..e2df7c9 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/example/inspect.js @@ -0,0 +1,10 @@ +'use strict'; + +/* eslint-env browser */ +var inspect = require('../'); + +var d = document.createElement('div'); +d.setAttribute('id', 'beep'); +d.innerHTML = 'woooiiiii'; + +console.log(inspect([d, { a: 3, b: 4, c: [5, 6, [7, [8, [9]]]] }])); diff --git a/graphql-subscription-express/node_modules/object-inspect/index.js b/graphql-subscription-express/node_modules/object-inspect/index.js new file mode 100644 index 0000000..ff20334 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/index.js @@ -0,0 +1,524 @@ +var hasMap = typeof Map === 'function' && Map.prototype; +var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; +var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; +var mapForEach = hasMap && Map.prototype.forEach; +var hasSet = typeof Set === 'function' && Set.prototype; +var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; +var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; +var setForEach = hasSet && Set.prototype.forEach; +var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype; +var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; +var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype; +var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; +var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype; +var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; +var booleanValueOf = Boolean.prototype.valueOf; +var objectToString = Object.prototype.toString; +var functionToString = Function.prototype.toString; +var $match = String.prototype.match; +var $slice = String.prototype.slice; +var $replace = String.prototype.replace; +var $toUpperCase = String.prototype.toUpperCase; +var $toLowerCase = String.prototype.toLowerCase; +var $test = RegExp.prototype.test; +var $concat = Array.prototype.concat; +var $join = Array.prototype.join; +var $arrSlice = Array.prototype.slice; +var $floor = Math.floor; +var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null; +var gOPS = Object.getOwnPropertySymbols; +var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null; +var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object'; +// ie, `has-tostringtag/shams +var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') + ? Symbol.toStringTag + : null; +var isEnumerable = Object.prototype.propertyIsEnumerable; + +var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ( + [].__proto__ === Array.prototype // eslint-disable-line no-proto + ? function (O) { + return O.__proto__; // eslint-disable-line no-proto + } + : null +); + +function addNumericSeparator(num, str) { + if ( + num === Infinity + || num === -Infinity + || num !== num + || (num && num > -1000 && num < 1000) + || $test.call(/e/, str) + ) { + return str; + } + var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; + if (typeof num === 'number') { + var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num) + if (int !== num) { + var intStr = String(int); + var dec = $slice.call(str, intStr.length + 1); + return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, ''); + } + } + return $replace.call(str, sepRegex, '$&_'); +} + +var utilInspect = require('./util.inspect'); +var inspectCustom = utilInspect.custom; +var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; + +module.exports = function inspect_(obj, options, depth, seen) { + var opts = options || {}; + + if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) { + throw new TypeError('option "quoteStyle" must be "single" or "double"'); + } + if ( + has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' + ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity + : opts.maxStringLength !== null + ) + ) { + throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); + } + var customInspect = has(opts, 'customInspect') ? opts.customInspect : true; + if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') { + throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`'); + } + + if ( + has(opts, 'indent') + && opts.indent !== null + && opts.indent !== '\t' + && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0) + ) { + throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); + } + if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') { + throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); + } + var numericSeparator = opts.numericSeparator; + + if (typeof obj === 'undefined') { + return 'undefined'; + } + if (obj === null) { + return 'null'; + } + if (typeof obj === 'boolean') { + return obj ? 'true' : 'false'; + } + + if (typeof obj === 'string') { + return inspectString(obj, opts); + } + if (typeof obj === 'number') { + if (obj === 0) { + return Infinity / obj > 0 ? '0' : '-0'; + } + var str = String(obj); + return numericSeparator ? addNumericSeparator(obj, str) : str; + } + if (typeof obj === 'bigint') { + var bigIntStr = String(obj) + 'n'; + return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; + } + + var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; + if (typeof depth === 'undefined') { depth = 0; } + if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { + return isArray(obj) ? '[Array]' : '[Object]'; + } + + var indent = getIndent(opts, depth); + + if (typeof seen === 'undefined') { + seen = []; + } else if (indexOf(seen, obj) >= 0) { + return '[Circular]'; + } + + function inspect(value, from, noIndent) { + if (from) { + seen = $arrSlice.call(seen); + seen.push(from); + } + if (noIndent) { + var newOpts = { + depth: opts.depth + }; + if (has(opts, 'quoteStyle')) { + newOpts.quoteStyle = opts.quoteStyle; + } + return inspect_(value, newOpts, depth + 1, seen); + } + return inspect_(value, opts, depth + 1, seen); + } + + if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable + var name = nameOf(obj); + var keys = arrObjKeys(obj, inspect); + return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : ''); + } + if (isSymbol(obj)) { + var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj); + return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString; + } + if (isElement(obj)) { + var s = '<' + $toLowerCase.call(String(obj.nodeName)); + var attrs = obj.attributes || []; + for (var i = 0; i < attrs.length; i++) { + s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); + } + s += '>'; + if (obj.childNodes && obj.childNodes.length) { s += '...'; } + s += ''; + return s; + } + if (isArray(obj)) { + if (obj.length === 0) { return '[]'; } + var xs = arrObjKeys(obj, inspect); + if (indent && !singleLineValues(xs)) { + return '[' + indentedJoin(xs, indent) + ']'; + } + return '[ ' + $join.call(xs, ', ') + ' ]'; + } + if (isError(obj)) { + var parts = arrObjKeys(obj, inspect); + if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) { + return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }'; + } + if (parts.length === 0) { return '[' + String(obj) + ']'; } + return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }'; + } + if (typeof obj === 'object' && customInspect) { + if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) { + return utilInspect(obj, { depth: maxDepth - depth }); + } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') { + return obj.inspect(); + } + } + if (isMap(obj)) { + var mapParts = []; + if (mapForEach) { + mapForEach.call(obj, function (value, key) { + mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); + }); + } + return collectionOf('Map', mapSize.call(obj), mapParts, indent); + } + if (isSet(obj)) { + var setParts = []; + if (setForEach) { + setForEach.call(obj, function (value) { + setParts.push(inspect(value, obj)); + }); + } + return collectionOf('Set', setSize.call(obj), setParts, indent); + } + if (isWeakMap(obj)) { + return weakCollectionOf('WeakMap'); + } + if (isWeakSet(obj)) { + return weakCollectionOf('WeakSet'); + } + if (isWeakRef(obj)) { + return weakCollectionOf('WeakRef'); + } + if (isNumber(obj)) { + return markBoxed(inspect(Number(obj))); + } + if (isBigInt(obj)) { + return markBoxed(inspect(bigIntValueOf.call(obj))); + } + if (isBoolean(obj)) { + return markBoxed(booleanValueOf.call(obj)); + } + if (isString(obj)) { + return markBoxed(inspect(String(obj))); + } + // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other + /* eslint-env browser */ + if (typeof window !== 'undefined' && obj === window) { + return '{ [object Window] }'; + } + if (obj === global) { + return '{ [object globalThis] }'; + } + if (!isDate(obj) && !isRegExp(obj)) { + var ys = arrObjKeys(obj, inspect); + var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; + var protoTag = obj instanceof Object ? '' : 'null prototype'; + var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : ''; + var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : ''; + var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : ''); + if (ys.length === 0) { return tag + '{}'; } + if (indent) { + return tag + '{' + indentedJoin(ys, indent) + '}'; + } + return tag + '{ ' + $join.call(ys, ', ') + ' }'; + } + return String(obj); +}; + +function wrapQuotes(s, defaultStyle, opts) { + var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'"; + return quoteChar + s + quoteChar; +} + +function quote(s) { + return $replace.call(String(s), /"/g, '"'); +} + +function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } + +// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives +function isSymbol(obj) { + if (hasShammedSymbols) { + return obj && typeof obj === 'object' && obj instanceof Symbol; + } + if (typeof obj === 'symbol') { + return true; + } + if (!obj || typeof obj !== 'object' || !symToString) { + return false; + } + try { + symToString.call(obj); + return true; + } catch (e) {} + return false; +} + +function isBigInt(obj) { + if (!obj || typeof obj !== 'object' || !bigIntValueOf) { + return false; + } + try { + bigIntValueOf.call(obj); + return true; + } catch (e) {} + return false; +} + +var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; }; +function has(obj, key) { + return hasOwn.call(obj, key); +} + +function toStr(obj) { + return objectToString.call(obj); +} + +function nameOf(f) { + if (f.name) { return f.name; } + var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); + if (m) { return m[1]; } + return null; +} + +function indexOf(xs, x) { + if (xs.indexOf) { return xs.indexOf(x); } + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) { return i; } + } + return -1; +} + +function isMap(x) { + if (!mapSize || !x || typeof x !== 'object') { + return false; + } + try { + mapSize.call(x); + try { + setSize.call(x); + } catch (s) { + return true; + } + return x instanceof Map; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakMap(x) { + if (!weakMapHas || !x || typeof x !== 'object') { + return false; + } + try { + weakMapHas.call(x, weakMapHas); + try { + weakSetHas.call(x, weakSetHas); + } catch (s) { + return true; + } + return x instanceof WeakMap; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakRef(x) { + if (!weakRefDeref || !x || typeof x !== 'object') { + return false; + } + try { + weakRefDeref.call(x); + return true; + } catch (e) {} + return false; +} + +function isSet(x) { + if (!setSize || !x || typeof x !== 'object') { + return false; + } + try { + setSize.call(x); + try { + mapSize.call(x); + } catch (m) { + return true; + } + return x instanceof Set; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakSet(x) { + if (!weakSetHas || !x || typeof x !== 'object') { + return false; + } + try { + weakSetHas.call(x, weakSetHas); + try { + weakMapHas.call(x, weakMapHas); + } catch (s) { + return true; + } + return x instanceof WeakSet; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isElement(x) { + if (!x || typeof x !== 'object') { return false; } + if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { + return true; + } + return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function'; +} + +function inspectString(str, opts) { + if (str.length > opts.maxStringLength) { + var remaining = str.length - opts.maxStringLength; + var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : ''); + return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; + } + // eslint-disable-next-line no-control-regex + var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte); + return wrapQuotes(s, 'single', opts); +} + +function lowbyte(c) { + var n = c.charCodeAt(0); + var x = { + 8: 'b', + 9: 't', + 10: 'n', + 12: 'f', + 13: 'r' + }[n]; + if (x) { return '\\' + x; } + return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16)); +} + +function markBoxed(str) { + return 'Object(' + str + ')'; +} + +function weakCollectionOf(type) { + return type + ' { ? }'; +} + +function collectionOf(type, size, entries, indent) { + var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', '); + return type + ' (' + size + ') {' + joinedEntries + '}'; +} + +function singleLineValues(xs) { + for (var i = 0; i < xs.length; i++) { + if (indexOf(xs[i], '\n') >= 0) { + return false; + } + } + return true; +} + +function getIndent(opts, depth) { + var baseIndent; + if (opts.indent === '\t') { + baseIndent = '\t'; + } else if (typeof opts.indent === 'number' && opts.indent > 0) { + baseIndent = $join.call(Array(opts.indent + 1), ' '); + } else { + return null; + } + return { + base: baseIndent, + prev: $join.call(Array(depth + 1), baseIndent) + }; +} + +function indentedJoin(xs, indent) { + if (xs.length === 0) { return ''; } + var lineJoiner = '\n' + indent.prev + indent.base; + return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev; +} + +function arrObjKeys(obj, inspect) { + var isArr = isArray(obj); + var xs = []; + if (isArr) { + xs.length = obj.length; + for (var i = 0; i < obj.length; i++) { + xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; + } + } + var syms = typeof gOPS === 'function' ? gOPS(obj) : []; + var symMap; + if (hasShammedSymbols) { + symMap = {}; + for (var k = 0; k < syms.length; k++) { + symMap['$' + syms[k]] = syms[k]; + } + } + + for (var key in obj) { // eslint-disable-line no-restricted-syntax + if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue + if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue + if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) { + // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section + continue; // eslint-disable-line no-restricted-syntax, no-continue + } else if ($test.call(/[^\w$]/, key)) { + xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); + } else { + xs.push(key + ': ' + inspect(obj[key], obj)); + } + } + if (typeof gOPS === 'function') { + for (var j = 0; j < syms.length; j++) { + if (isEnumerable.call(obj, syms[j])) { + xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj)); + } + } + } + return xs; +} diff --git a/graphql-subscription-express/node_modules/object-inspect/package-support.json b/graphql-subscription-express/node_modules/object-inspect/package-support.json new file mode 100644 index 0000000..5cc12d0 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/package-support.json @@ -0,0 +1,20 @@ +{ + "versions": [ + { + "version": "*", + "target": { + "node": "all" + }, + "response": { + "type": "time-permitting" + }, + "backing": { + "npm-funding": true, + "donations": [ + "https://github.com/ljharb", + "https://tidelift.com/funding/github/npm/object-inspect" + ] + } + } + ] +} diff --git a/graphql-subscription-express/node_modules/object-inspect/package.json b/graphql-subscription-express/node_modules/object-inspect/package.json new file mode 100644 index 0000000..02de342 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/package.json @@ -0,0 +1,99 @@ +{ + "name": "object-inspect", + "version": "1.13.1", + "description": "string representations of objects in node and the browser", + "main": "index.js", + "sideEffects": false, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@pkgjs/support": "^0.0.6", + "auto-changelog": "^2.4.0", + "core-js": "^2.6.12", + "error-cause": "^1.0.6", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "for-each": "^0.3.3", + "functions-have-names": "^1.2.3", + "glob": "=10.3.7", + "globalthis": "^1.0.3", + "has-tostringtag": "^1.0.0", + "in-publish": "^2.0.1", + "jackspeak": "=2.1.1", + "make-arrow-function": "^1.2.0", + "mock-property": "^1.0.2", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "string.prototype.repeat": "^1.0.0", + "tape": "^5.7.1" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "lint": "eslint --ext=js,mjs .", + "postlint": "npx @pkgjs/support validate", + "test": "npm run tests-only && npm run test:corejs", + "tests-only": "nyc tape 'test/*.js'", + "test:corejs": "nyc tape test-core-js.js 'test/*.js'", + "posttest": "npx aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": [ + "test/*.js", + "test/browser/*.js" + ], + "browsers": [ + "ie/6..latest", + "chrome/latest", + "firefox/latest", + "safari/latest", + "opera/latest", + "iphone/latest", + "ipad/latest", + "android/latest" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/inspect-js/object-inspect.git" + }, + "homepage": "https://github.com/inspect-js/object-inspect", + "keywords": [ + "inspect", + "util.inspect", + "object", + "stringify", + "pretty" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "browser": { + "./util.inspect.js": false + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "./test-core-js.js" + ] + }, + "support": true +} diff --git a/graphql-subscription-express/node_modules/object-inspect/readme.markdown b/graphql-subscription-express/node_modules/object-inspect/readme.markdown new file mode 100644 index 0000000..9ff6bec --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/readme.markdown @@ -0,0 +1,86 @@ +# object-inspect [![Version Badge][2]][1] + +string representations of objects in node and the browser + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +# example + +## circular + +``` js +var inspect = require('object-inspect'); +var obj = { a: 1, b: [3,4] }; +obj.c = obj; +console.log(inspect(obj)); +``` + +## dom element + +``` js +var inspect = require('object-inspect'); + +var d = document.createElement('div'); +d.setAttribute('id', 'beep'); +d.innerHTML = 'woooiiiii'; + +console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ])); +``` + +output: + +``` +[

...
, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ] +``` + +# methods + +``` js +var inspect = require('object-inspect') +``` + +## var s = inspect(obj, opts={}) + +Return a string `s` with the string representation of `obj` up to a depth of `opts.depth`. + +Additional options: + - `quoteStyle`: must be "single" or "double", if present. Default `'single'` for strings, `'double'` for HTML elements. + - `maxStringLength`: must be `0`, a positive integer, `Infinity`, or `null`, if present. Default `Infinity`. + - `customInspect`: When `true`, a custom inspect method function will be invoked (either undere the `util.inspect.custom` symbol, or the `inspect` property). When the string `'symbol'`, only the symbol method will be invoked. Default `true`. + - `indent`: must be "\t", `null`, or a positive integer. Default `null`. + - `numericSeparator`: must be a boolean, if present. Default `false`. If `true`, all numbers will be printed with numeric separators (eg, `1234.5678` will be printed as `'1_234.567_8'`) + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install object-inspect +``` + +# license + +MIT + +[1]: https://npmjs.org/package/object-inspect +[2]: https://versionbadg.es/inspect-js/object-inspect.svg +[5]: https://david-dm.org/inspect-js/object-inspect.svg +[6]: https://david-dm.org/inspect-js/object-inspect +[7]: https://david-dm.org/inspect-js/object-inspect/dev-status.svg +[8]: https://david-dm.org/inspect-js/object-inspect#info=devDependencies +[11]: https://nodei.co/npm/object-inspect.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/object-inspect.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/object-inspect.svg +[downloads-url]: https://npm-stat.com/charts.html?package=object-inspect +[codecov-image]: https://codecov.io/gh/inspect-js/object-inspect/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/object-inspect/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/object-inspect +[actions-url]: https://github.com/inspect-js/object-inspect/actions diff --git a/graphql-subscription-express/node_modules/object-inspect/test-core-js.js b/graphql-subscription-express/node_modules/object-inspect/test-core-js.js new file mode 100644 index 0000000..e53c400 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test-core-js.js @@ -0,0 +1,26 @@ +'use strict'; + +require('core-js'); + +var inspect = require('./'); +var test = require('tape'); + +test('Maps', function (t) { + t.equal(inspect(new Map([[1, 2]])), 'Map (1) {1 => 2}'); + t.end(); +}); + +test('WeakMaps', function (t) { + t.equal(inspect(new WeakMap([[{}, 2]])), 'WeakMap { ? }'); + t.end(); +}); + +test('Sets', function (t) { + t.equal(inspect(new Set([[1, 2]])), 'Set (1) {[ 1, 2 ]}'); + t.end(); +}); + +test('WeakSets', function (t) { + t.equal(inspect(new WeakSet([[1, 2]])), 'WeakSet { ? }'); + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/bigint.js b/graphql-subscription-express/node_modules/object-inspect/test/bigint.js new file mode 100644 index 0000000..4ecc31d --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/bigint.js @@ -0,0 +1,58 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var hasToStringTag = require('has-tostringtag/shams')(); + +test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) { + t.test('primitives', function (st) { + st.plan(3); + + st.equal(inspect(BigInt(-256)), '-256n'); + st.equal(inspect(BigInt(0)), '0n'); + st.equal(inspect(BigInt(256)), '256n'); + }); + + t.test('objects', function (st) { + st.plan(3); + + st.equal(inspect(Object(BigInt(-256))), 'Object(-256n)'); + st.equal(inspect(Object(BigInt(0))), 'Object(0n)'); + st.equal(inspect(Object(BigInt(256))), 'Object(256n)'); + }); + + t.test('syntactic primitives', function (st) { + st.plan(3); + + /* eslint-disable no-new-func */ + st.equal(inspect(Function('return -256n')()), '-256n'); + st.equal(inspect(Function('return 0n')()), '0n'); + st.equal(inspect(Function('return 256n')()), '256n'); + }); + + t.test('toStringTag', { skip: !hasToStringTag }, function (st) { + st.plan(1); + + var faker = {}; + faker[Symbol.toStringTag] = 'BigInt'; + st.equal( + inspect(faker), + '{ [Symbol(Symbol.toStringTag)]: \'BigInt\' }', + 'object lying about being a BigInt inspects as an object' + ); + }); + + t.test('numericSeparator', function (st) { + st.equal(inspect(BigInt(0), { numericSeparator: false }), '0n', '0n, numericSeparator false'); + st.equal(inspect(BigInt(0), { numericSeparator: true }), '0n', '0n, numericSeparator true'); + + st.equal(inspect(BigInt(1234), { numericSeparator: false }), '1234n', '1234n, numericSeparator false'); + st.equal(inspect(BigInt(1234), { numericSeparator: true }), '1_234n', '1234n, numericSeparator true'); + st.equal(inspect(BigInt(-1234), { numericSeparator: false }), '-1234n', '1234n, numericSeparator false'); + st.equal(inspect(BigInt(-1234), { numericSeparator: true }), '-1_234n', '1234n, numericSeparator true'); + + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/browser/dom.js b/graphql-subscription-express/node_modules/object-inspect/test/browser/dom.js new file mode 100644 index 0000000..210c0b2 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/browser/dom.js @@ -0,0 +1,15 @@ +var inspect = require('../../'); +var test = require('tape'); + +test('dom element', function (t) { + t.plan(1); + + var d = document.createElement('div'); + d.setAttribute('id', 'beep'); + d.innerHTML = 'woooiiiii'; + + t.equal( + inspect([d, { a: 3, b: 4, c: [5, 6, [7, [8, [9]]]] }]), + '[
...
, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [Object] ] ] ] } ]' + ); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/circular.js b/graphql-subscription-express/node_modules/object-inspect/test/circular.js new file mode 100644 index 0000000..5df4233 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/circular.js @@ -0,0 +1,16 @@ +var inspect = require('../'); +var test = require('tape'); + +test('circular', function (t) { + t.plan(2); + var obj = { a: 1, b: [3, 4] }; + obj.c = obj; + t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }'); + + var double = {}; + double.a = [double]; + double.b = {}; + double.b.inner = double.b; + double.b.obj = double; + t.equal(inspect(double), '{ a: [ [Circular] ], b: { inner: [Circular], obj: [Circular] } }'); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/deep.js b/graphql-subscription-express/node_modules/object-inspect/test/deep.js new file mode 100644 index 0000000..99ce32a --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/deep.js @@ -0,0 +1,12 @@ +var inspect = require('../'); +var test = require('tape'); + +test('deep', function (t) { + t.plan(4); + var obj = [[[[[[500]]]]]]; + t.equal(inspect(obj), '[ [ [ [ [ [Array] ] ] ] ] ]'); + t.equal(inspect(obj, { depth: 4 }), '[ [ [ [ [Array] ] ] ] ]'); + t.equal(inspect(obj, { depth: 2 }), '[ [ [Array] ] ]'); + + t.equal(inspect([[[{ a: 1 }]]], { depth: 3 }), '[ [ [ [Object] ] ] ]'); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/element.js b/graphql-subscription-express/node_modules/object-inspect/test/element.js new file mode 100644 index 0000000..47fa9e2 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/element.js @@ -0,0 +1,53 @@ +var inspect = require('../'); +var test = require('tape'); + +test('element', function (t) { + t.plan(3); + var elem = { + nodeName: 'div', + attributes: [{ name: 'class', value: 'row' }], + getAttribute: function (key) { return key; }, + childNodes: [] + }; + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); + t.deepEqual(inspect(obj, { quoteStyle: 'single' }), "[ 1,
, 3 ]"); + t.deepEqual(inspect(obj, { quoteStyle: 'double' }), '[ 1,
, 3 ]'); +}); + +test('element no attr', function (t) { + t.plan(1); + var elem = { + nodeName: 'div', + getAttribute: function (key) { return key; }, + childNodes: [] + }; + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); +}); + +test('element with contents', function (t) { + t.plan(1); + var elem = { + nodeName: 'div', + getAttribute: function (key) { return key; }, + childNodes: [{ nodeName: 'b' }] + }; + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
...
, 3 ]'); +}); + +test('element instance', function (t) { + t.plan(1); + var h = global.HTMLElement; + global.HTMLElement = function (name, attr) { + this.nodeName = name; + this.attributes = attr; + }; + global.HTMLElement.prototype.getAttribute = function () {}; + + var elem = new global.HTMLElement('div', []); + var obj = [1, elem, 3]; + t.deepEqual(inspect(obj), '[ 1,
, 3 ]'); + global.HTMLElement = h; +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/err.js b/graphql-subscription-express/node_modules/object-inspect/test/err.js new file mode 100644 index 0000000..cc1d884 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/err.js @@ -0,0 +1,48 @@ +var test = require('tape'); +var ErrorWithCause = require('error-cause/Error'); + +var inspect = require('../'); + +test('type error', function (t) { + t.plan(1); + var aerr = new TypeError(); + aerr.foo = 555; + aerr.bar = [1, 2, 3]; + + var berr = new TypeError('tuv'); + berr.baz = 555; + + var cerr = new SyntaxError(); + cerr.message = 'whoa'; + cerr['a-b'] = 5; + + var withCause = new ErrorWithCause('foo', { cause: 'bar' }); + var withCausePlus = new ErrorWithCause('foo', { cause: 'bar' }); + withCausePlus.foo = 'bar'; + var withUndefinedCause = new ErrorWithCause('foo', { cause: undefined }); + var withEnumerableCause = new Error('foo'); + withEnumerableCause.cause = 'bar'; + + var obj = [ + new TypeError(), + new TypeError('xxx'), + aerr, + berr, + cerr, + withCause, + withCausePlus, + withUndefinedCause, + withEnumerableCause + ]; + t.equal(inspect(obj), '[ ' + [ + '[TypeError]', + '[TypeError: xxx]', + '{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }', + '{ [TypeError: tuv] baz: 555 }', + '{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }', + 'cause' in Error.prototype ? '[Error: foo]' : '{ [Error: foo] [cause]: \'bar\' }', + '{ [Error: foo] ' + ('cause' in Error.prototype ? '' : '[cause]: \'bar\', ') + 'foo: \'bar\' }', + 'cause' in Error.prototype ? '[Error: foo]' : '{ [Error: foo] [cause]: undefined }', + '{ [Error: foo] cause: \'bar\' }' + ].join(', ') + ' ]'); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/fakes.js b/graphql-subscription-express/node_modules/object-inspect/test/fakes.js new file mode 100644 index 0000000..a65c08c --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/fakes.js @@ -0,0 +1,29 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var hasToStringTag = require('has-tostringtag/shams')(); +var forEach = require('for-each'); + +test('fakes', { skip: !hasToStringTag }, function (t) { + forEach([ + 'Array', + 'Boolean', + 'Date', + 'Error', + 'Number', + 'RegExp', + 'String' + ], function (expected) { + var faker = {}; + faker[Symbol.toStringTag] = expected; + + t.equal( + inspect(faker), + '{ [Symbol(Symbol.toStringTag)]: \'' + expected + '\' }', + 'faker masquerading as ' + expected + ' is not shown as one' + ); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/fn.js b/graphql-subscription-express/node_modules/object-inspect/test/fn.js new file mode 100644 index 0000000..de3ca62 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/fn.js @@ -0,0 +1,76 @@ +var inspect = require('../'); +var test = require('tape'); +var arrow = require('make-arrow-function')(); +var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); + +test('function', function (t) { + t.plan(1); + var obj = [1, 2, function f(n) { return n; }, 4]; + t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]'); +}); + +test('function name', function (t) { + t.plan(1); + var f = (function () { + return function () {}; + }()); + f.toString = function toStr() { return 'function xxx () {}'; }; + var obj = [1, 2, f, 4]; + t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)] { toString: [Function: toStr] }, 4 ]'); +}); + +test('anon function', function (t) { + var f = (function () { + return function () {}; + }()); + var obj = [1, 2, f, 4]; + t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)], 4 ]'); + + t.end(); +}); + +test('arrow function', { skip: !arrow }, function (t) { + t.equal(inspect(arrow), '[Function (anonymous)]'); + + t.end(); +}); + +test('truly nameless function', { skip: !arrow || !functionsHaveConfigurableNames }, function (t) { + function f() {} + Object.defineProperty(f, 'name', { value: false }); + t.equal(f.name, false); + t.equal( + inspect(f), + '[Function: f]', + 'named function with falsy `.name` does not hide its original name' + ); + + function g() {} + Object.defineProperty(g, 'name', { value: true }); + t.equal(g.name, true); + t.equal( + inspect(g), + '[Function: true]', + 'named function with truthy `.name` hides its original name' + ); + + var anon = function () {}; // eslint-disable-line func-style + Object.defineProperty(anon, 'name', { value: null }); + t.equal(anon.name, null); + t.equal( + inspect(anon), + '[Function (anonymous)]', + 'anon function with falsy `.name` does not hide its anonymity' + ); + + var anon2 = function () {}; // eslint-disable-line func-style + Object.defineProperty(anon2, 'name', { value: 1 }); + t.equal(anon2.name, 1); + t.equal( + inspect(anon2), + '[Function: 1]', + 'anon function with truthy `.name` hides its anonymity' + ); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/global.js b/graphql-subscription-express/node_modules/object-inspect/test/global.js new file mode 100644 index 0000000..c57216a --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/global.js @@ -0,0 +1,17 @@ +'use strict'; + +var inspect = require('../'); + +var test = require('tape'); +var globalThis = require('globalthis')(); + +test('global object', function (t) { + /* eslint-env browser */ + var expected = typeof window === 'undefined' ? 'globalThis' : 'Window'; + t.equal( + inspect([globalThis]), + '[ { [object ' + expected + '] } ]' + ); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/has.js b/graphql-subscription-express/node_modules/object-inspect/test/has.js new file mode 100644 index 0000000..01800de --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/has.js @@ -0,0 +1,15 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var mockProperty = require('mock-property'); + +test('when Object#hasOwnProperty is deleted', function (t) { + t.plan(1); + var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays + + t.teardown(mockProperty(Array.prototype, 1, { value: 2 })); // this is needed to account for "in" vs "hasOwnProperty" + t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true })); + + t.equal(inspect(arr), '[ 1, , 3 ]'); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/holes.js b/graphql-subscription-express/node_modules/object-inspect/test/holes.js new file mode 100644 index 0000000..87fc8c8 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/holes.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var inspect = require('../'); + +var xs = ['a', 'b']; +xs[5] = 'f'; +xs[7] = 'j'; +xs[8] = 'k'; + +test('holes', function (t) { + t.plan(1); + t.equal( + inspect(xs), + "[ 'a', 'b', , , , 'f', , 'j', 'k' ]" + ); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/indent-option.js b/graphql-subscription-express/node_modules/object-inspect/test/indent-option.js new file mode 100644 index 0000000..89d8fce --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/indent-option.js @@ -0,0 +1,271 @@ +var test = require('tape'); +var forEach = require('for-each'); + +var inspect = require('../'); + +test('bad indent options', function (t) { + forEach([ + undefined, + true, + false, + -1, + 1.2, + Infinity, + -Infinity, + NaN + ], function (indent) { + t['throws']( + function () { inspect('', { indent: indent }); }, + TypeError, + inspect(indent) + ' is invalid' + ); + }); + + t.end(); +}); + +test('simple object with indent', function (t) { + t.plan(2); + + var obj = { a: 1, b: 2 }; + + var expectedSpaces = [ + '{', + ' a: 1,', + ' b: 2', + '}' + ].join('\n'); + var expectedTabs = [ + '{', + ' a: 1,', + ' b: 2', + '}' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('two deep object with indent', function (t) { + t.plan(2); + + var obj = { a: 1, b: { c: 3, d: 4 } }; + + var expectedSpaces = [ + '{', + ' a: 1,', + ' b: {', + ' c: 3,', + ' d: 4', + ' }', + '}' + ].join('\n'); + var expectedTabs = [ + '{', + ' a: 1,', + ' b: {', + ' c: 3,', + ' d: 4', + ' }', + '}' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('simple array with all single line elements', function (t) { + t.plan(2); + + var obj = [1, 2, 3, 'asdf\nsdf']; + + var expected = '[ 1, 2, 3, \'asdf\\nsdf\' ]'; + + t.equal(inspect(obj, { indent: 2 }), expected, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expected, 'tabs'); +}); + +test('array with complex elements', function (t) { + t.plan(2); + + var obj = [1, { a: 1, b: { c: 1 } }, 'asdf\nsdf']; + + var expectedSpaces = [ + '[', + ' 1,', + ' {', + ' a: 1,', + ' b: {', + ' c: 1', + ' }', + ' },', + ' \'asdf\\nsdf\'', + ']' + ].join('\n'); + var expectedTabs = [ + '[', + ' 1,', + ' {', + ' a: 1,', + ' b: {', + ' c: 1', + ' }', + ' },', + ' \'asdf\\nsdf\'', + ']' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('values', function (t) { + t.plan(2); + var obj = [{}, [], { 'a-b': 5 }]; + + var expectedSpaces = [ + '[', + ' {},', + ' [],', + ' {', + ' \'a-b\': 5', + ' }', + ']' + ].join('\n'); + var expectedTabs = [ + '[', + ' {},', + ' [],', + ' {', + ' \'a-b\': 5', + ' }', + ']' + ].join('\n'); + + t.equal(inspect(obj, { indent: 2 }), expectedSpaces, 'two'); + t.equal(inspect(obj, { indent: '\t' }), expectedTabs, 'tabs'); +}); + +test('Map', { skip: typeof Map !== 'function' }, function (t) { + var map = new Map(); + map.set({ a: 1 }, ['b']); + map.set(3, NaN); + + var expectedStringSpaces = [ + 'Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + '}' + ].join('\n'); + var expectedStringTabs = [ + 'Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + '}' + ].join('\n'); + var expectedStringTabsDoubleQuotes = [ + 'Map (2) {', + ' { a: 1 } => [ "b" ],', + ' 3 => NaN', + '}' + ].join('\n'); + + t.equal( + inspect(map, { indent: 2 }), + expectedStringSpaces, + 'Map keys are not indented (two)' + ); + t.equal( + inspect(map, { indent: '\t' }), + expectedStringTabs, + 'Map keys are not indented (tabs)' + ); + t.equal( + inspect(map, { indent: '\t', quoteStyle: 'double' }), + expectedStringTabsDoubleQuotes, + 'Map keys are not indented (tabs + double quotes)' + ); + + t.equal(inspect(new Map(), { indent: 2 }), 'Map (0) {}', 'empty Map should show as empty (two)'); + t.equal(inspect(new Map(), { indent: '\t' }), 'Map (0) {}', 'empty Map should show as empty (tabs)'); + + var nestedMap = new Map(); + nestedMap.set(nestedMap, map); + var expectedNestedSpaces = [ + 'Map (1) {', + ' [Circular] => Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + ' }', + '}' + ].join('\n'); + var expectedNestedTabs = [ + 'Map (1) {', + ' [Circular] => Map (2) {', + ' { a: 1 } => [ \'b\' ],', + ' 3 => NaN', + ' }', + '}' + ].join('\n'); + t.equal(inspect(nestedMap, { indent: 2 }), expectedNestedSpaces, 'Map containing a Map should work (two)'); + t.equal(inspect(nestedMap, { indent: '\t' }), expectedNestedTabs, 'Map containing a Map should work (tabs)'); + + t.end(); +}); + +test('Set', { skip: typeof Set !== 'function' }, function (t) { + var set = new Set(); + set.add({ a: 1 }); + set.add(['b']); + var expectedStringSpaces = [ + 'Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + '}' + ].join('\n'); + var expectedStringTabs = [ + 'Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + '}' + ].join('\n'); + t.equal(inspect(set, { indent: 2 }), expectedStringSpaces, 'new Set([{ a: 1 }, ["b"]]) should show size and contents (two)'); + t.equal(inspect(set, { indent: '\t' }), expectedStringTabs, 'new Set([{ a: 1 }, ["b"]]) should show size and contents (tabs)'); + + t.equal(inspect(new Set(), { indent: 2 }), 'Set (0) {}', 'empty Set should show as empty (two)'); + t.equal(inspect(new Set(), { indent: '\t' }), 'Set (0) {}', 'empty Set should show as empty (tabs)'); + + var nestedSet = new Set(); + nestedSet.add(set); + nestedSet.add(nestedSet); + var expectedNestedSpaces = [ + 'Set (2) {', + ' Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + ' },', + ' [Circular]', + '}' + ].join('\n'); + var expectedNestedTabs = [ + 'Set (2) {', + ' Set (2) {', + ' {', + ' a: 1', + ' },', + ' [ \'b\' ]', + ' },', + ' [Circular]', + '}' + ].join('\n'); + t.equal(inspect(nestedSet, { indent: 2 }), expectedNestedSpaces, 'Set containing a Set should work (two)'); + t.equal(inspect(nestedSet, { indent: '\t' }), expectedNestedTabs, 'Set containing a Set should work (tabs)'); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/inspect.js b/graphql-subscription-express/node_modules/object-inspect/test/inspect.js new file mode 100644 index 0000000..1abf81b --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/inspect.js @@ -0,0 +1,139 @@ +var test = require('tape'); +var hasSymbols = require('has-symbols/shams')(); +var utilInspect = require('../util.inspect'); +var repeat = require('string.prototype.repeat'); + +var inspect = require('..'); + +test('inspect', function (t) { + t.plan(5); + + var obj = [{ inspect: function xyzInspect() { return '!XYZ¡'; } }, []]; + var stringResult = '[ !XYZ¡, [] ]'; + var falseResult = '[ { inspect: [Function: xyzInspect] }, [] ]'; + + t.equal(inspect(obj), stringResult); + t.equal(inspect(obj, { customInspect: true }), stringResult); + t.equal(inspect(obj, { customInspect: 'symbol' }), falseResult); + t.equal(inspect(obj, { customInspect: false }), falseResult); + t['throws']( + function () { inspect(obj, { customInspect: 'not a boolean or "symbol"' }); }, + TypeError, + '`customInspect` must be a boolean or the string "symbol"' + ); +}); + +test('inspect custom symbol', { skip: !hasSymbols || !utilInspect || !utilInspect.custom }, function (t) { + t.plan(4); + + var obj = { inspect: function stringInspect() { return 'string'; } }; + obj[utilInspect.custom] = function custom() { return 'symbol'; }; + + var symbolResult = '[ symbol, [] ]'; + var stringResult = '[ string, [] ]'; + var falseResult = '[ { inspect: [Function: stringInspect]' + (utilInspect.custom ? ', [' + inspect(utilInspect.custom) + ']: [Function: custom]' : '') + ' }, [] ]'; + + var symbolStringFallback = utilInspect.custom ? symbolResult : stringResult; + var symbolFalseFallback = utilInspect.custom ? symbolResult : falseResult; + + t.equal(inspect([obj, []]), symbolStringFallback); + t.equal(inspect([obj, []], { customInspect: true }), symbolStringFallback); + t.equal(inspect([obj, []], { customInspect: 'symbol' }), symbolFalseFallback); + t.equal(inspect([obj, []], { customInspect: false }), falseResult); +}); + +test('symbols', { skip: !hasSymbols }, function (t) { + t.plan(2); + + var obj = { a: 1 }; + obj[Symbol('test')] = 2; + obj[Symbol.iterator] = 3; + Object.defineProperty(obj, Symbol('non-enum'), { + enumerable: false, + value: 4 + }); + + if (typeof Symbol.iterator === 'symbol') { + t.equal(inspect(obj), '{ a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }', 'object with symbols'); + t.equal(inspect([obj, []]), '[ { a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }, [] ]', 'object with symbols in array'); + } else { + // symbol sham key ordering is unreliable + t.match( + inspect(obj), + /^(?:{ a: 1, \[Symbol\(test\)\]: 2, \[Symbol\(Symbol.iterator\)\]: 3 }|{ a: 1, \[Symbol\(Symbol.iterator\)\]: 3, \[Symbol\(test\)\]: 2 })$/, + 'object with symbols (nondeterministic symbol sham key ordering)' + ); + t.match( + inspect([obj, []]), + /^\[ (?:{ a: 1, \[Symbol\(test\)\]: 2, \[Symbol\(Symbol.iterator\)\]: 3 }|{ a: 1, \[Symbol\(Symbol.iterator\)\]: 3, \[Symbol\(test\)\]: 2 }), \[\] \]$/, + 'object with symbols in array (nondeterministic symbol sham key ordering)' + ); + } +}); + +test('maxStringLength', function (t) { + t['throws']( + function () { inspect('', { maxStringLength: -1 }); }, + TypeError, + 'maxStringLength must be >= 0, or Infinity, not negative' + ); + + var str = repeat('a', 1e8); + + t.equal( + inspect([str], { maxStringLength: 10 }), + '[ \'aaaaaaaaaa\'... 99999990 more characters ]', + 'maxStringLength option limits output' + ); + + t.equal( + inspect(['f'], { maxStringLength: null }), + '[ \'\'... 1 more character ]', + 'maxStringLength option accepts `null`' + ); + + t.equal( + inspect([str], { maxStringLength: Infinity }), + '[ \'' + str + '\' ]', + 'maxStringLength option accepts ∞' + ); + + t.end(); +}); + +test('inspect options', { skip: !utilInspect.custom }, function (t) { + var obj = {}; + obj[utilInspect.custom] = function () { + return JSON.stringify(arguments); + }; + t.equal( + inspect(obj), + utilInspect(obj, { depth: 5 }), + 'custom symbols will use node\'s inspect' + ); + t.equal( + inspect(obj, { depth: 2 }), + utilInspect(obj, { depth: 2 }), + 'a reduced depth will be passed to node\'s inspect' + ); + t.equal( + inspect({ d1: obj }, { depth: 3 }), + '{ d1: ' + utilInspect(obj, { depth: 2 }) + ' }', + 'deep objects will receive a reduced depth' + ); + t.equal( + inspect({ d1: obj }, { depth: 1 }), + '{ d1: [Object] }', + 'unlike nodejs inspect, customInspect will not be used once the depth is exceeded.' + ); + t.end(); +}); + +test('inspect URL', { skip: typeof URL === 'undefined' }, function (t) { + t.match( + inspect(new URL('https://nodejs.org')), + /nodejs\.org/, // Different environments stringify it differently + 'url can be inspected' + ); + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/lowbyte.js b/graphql-subscription-express/node_modules/object-inspect/test/lowbyte.js new file mode 100644 index 0000000..68a345d --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/lowbyte.js @@ -0,0 +1,12 @@ +var test = require('tape'); +var inspect = require('../'); + +var obj = { x: 'a\r\nb', y: '\x05! \x1f \x12' }; + +test('interpolate low bytes', function (t) { + t.plan(1); + t.equal( + inspect(obj), + "{ x: 'a\\r\\nb', y: '\\x05! \\x1F \\x12' }" + ); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/number.js b/graphql-subscription-express/node_modules/object-inspect/test/number.js new file mode 100644 index 0000000..8f287e8 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/number.js @@ -0,0 +1,58 @@ +var test = require('tape'); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); + +var inspect = require('../'); + +test('negative zero', function (t) { + t.equal(inspect(0), '0', 'inspect(0) === "0"'); + t.equal(inspect(Object(0)), 'Object(0)', 'inspect(Object(0)) === "Object(0)"'); + + t.equal(inspect(-0), '-0', 'inspect(-0) === "-0"'); + t.equal(inspect(Object(-0)), 'Object(-0)', 'inspect(Object(-0)) === "Object(-0)"'); + + t.end(); +}); + +test('numericSeparator', function (t) { + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { inspect(true, { numericSeparator: nonBoolean }); }, + TypeError, + inspect(nonBoolean) + ' is not a boolean' + ); + }); + + t.test('3 digit numbers', function (st) { + var failed = false; + for (var i = -999; i < 1000; i += 1) { + var actual = inspect(i); + var actualSepNo = inspect(i, { numericSeparator: false }); + var actualSepYes = inspect(i, { numericSeparator: true }); + var expected = String(i); + if (actual !== expected || actualSepNo !== expected || actualSepYes !== expected) { + failed = true; + t.equal(actual, expected); + t.equal(actualSepNo, expected); + t.equal(actualSepYes, expected); + } + } + + st.notOk(failed, 'all 3 digit numbers passed'); + + st.end(); + }); + + t.equal(inspect(1e3), '1000', '1000'); + t.equal(inspect(1e3, { numericSeparator: false }), '1000', '1000, numericSeparator false'); + t.equal(inspect(1e3, { numericSeparator: true }), '1_000', '1000, numericSeparator true'); + t.equal(inspect(-1e3), '-1000', '-1000'); + t.equal(inspect(-1e3, { numericSeparator: false }), '-1000', '-1000, numericSeparator false'); + t.equal(inspect(-1e3, { numericSeparator: true }), '-1_000', '-1000, numericSeparator true'); + + t.equal(inspect(1234.5678, { numericSeparator: true }), '1_234.567_8', 'fractional numbers get separators'); + t.equal(inspect(1234.56789, { numericSeparator: true }), '1_234.567_89', 'fractional numbers get separators'); + t.equal(inspect(1234.567891, { numericSeparator: true }), '1_234.567_891', 'fractional numbers get separators'); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/quoteStyle.js b/graphql-subscription-express/node_modules/object-inspect/test/quoteStyle.js new file mode 100644 index 0000000..ae4d734 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/quoteStyle.js @@ -0,0 +1,17 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); + +test('quoteStyle option', function (t) { + t['throws'](function () { inspect(null, { quoteStyle: false }); }, 'false is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: true }); }, 'true is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: '' }); }, '"" is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: {} }); }, '{} is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: [] }); }, '[] is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: 42 }); }, '42 is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: NaN }); }, 'NaN is not a valid value'); + t['throws'](function () { inspect(null, { quoteStyle: function () {} }); }, 'a function is not a valid value'); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/toStringTag.js b/graphql-subscription-express/node_modules/object-inspect/test/toStringTag.js new file mode 100644 index 0000000..95f8270 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/toStringTag.js @@ -0,0 +1,40 @@ +'use strict'; + +var test = require('tape'); +var hasToStringTag = require('has-tostringtag/shams')(); + +var inspect = require('../'); + +test('Symbol.toStringTag', { skip: !hasToStringTag }, function (t) { + t.plan(4); + + var obj = { a: 1 }; + t.equal(inspect(obj), '{ a: 1 }', 'object, no Symbol.toStringTag'); + + obj[Symbol.toStringTag] = 'foo'; + t.equal(inspect(obj), '{ a: 1, [Symbol(Symbol.toStringTag)]: \'foo\' }', 'object with Symbol.toStringTag'); + + t.test('null objects', { skip: 'toString' in { __proto__: null } }, function (st) { + st.plan(2); + + var dict = { __proto__: null, a: 1 }; + st.equal(inspect(dict), '[Object: null prototype] { a: 1 }', 'null object with Symbol.toStringTag'); + + dict[Symbol.toStringTag] = 'Dict'; + st.equal(inspect(dict), '[Dict: null prototype] { a: 1, [Symbol(Symbol.toStringTag)]: \'Dict\' }', 'null object with Symbol.toStringTag'); + }); + + t.test('instances', function (st) { + st.plan(4); + + function C() { + this.a = 1; + } + st.equal(Object.prototype.toString.call(new C()), '[object Object]', 'instance, no toStringTag, Object.prototype.toString'); + st.equal(inspect(new C()), 'C { a: 1 }', 'instance, no toStringTag'); + + C.prototype[Symbol.toStringTag] = 'Class!'; + st.equal(Object.prototype.toString.call(new C()), '[object Class!]', 'instance, with toStringTag, Object.prototype.toString'); + st.equal(inspect(new C()), 'C [Class!] { a: 1 }', 'instance, with toStringTag'); + }); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/undef.js b/graphql-subscription-express/node_modules/object-inspect/test/undef.js new file mode 100644 index 0000000..e3f4961 --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/undef.js @@ -0,0 +1,12 @@ +var test = require('tape'); +var inspect = require('../'); + +var obj = { a: 1, b: [3, 4, undefined, null], c: undefined, d: null }; + +test('undef and null', function (t) { + t.plan(1); + t.equal( + inspect(obj), + '{ a: 1, b: [ 3, 4, undefined, null ], c: undefined, d: null }' + ); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/test/values.js b/graphql-subscription-express/node_modules/object-inspect/test/values.js new file mode 100644 index 0000000..4832b9f --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/test/values.js @@ -0,0 +1,211 @@ +'use strict'; + +var inspect = require('../'); +var test = require('tape'); +var mockProperty = require('mock-property'); +var hasSymbols = require('has-symbols/shams')(); +var hasToStringTag = require('has-tostringtag/shams')(); + +test('values', function (t) { + t.plan(1); + var obj = [{}, [], { 'a-b': 5 }]; + t.equal(inspect(obj), '[ {}, [], { \'a-b\': 5 } ]'); +}); + +test('arrays with properties', function (t) { + t.plan(1); + var arr = [3]; + arr.foo = 'bar'; + var obj = [1, 2, arr]; + obj.baz = 'quux'; + obj.index = -1; + t.equal(inspect(obj), '[ 1, 2, [ 3, foo: \'bar\' ], baz: \'quux\', index: -1 ]'); +}); + +test('has', function (t) { + t.plan(1); + t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true })); + + t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }'); +}); + +test('indexOf seen', function (t) { + t.plan(1); + var xs = [1, 2, 3, {}]; + xs.push(xs); + + var seen = []; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[ 1, 2, 3, {}, [Circular] ]' + ); +}); + +test('seen seen', function (t) { + t.plan(1); + var xs = [1, 2, 3]; + + var seen = [xs]; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[Circular]' + ); +}); + +test('seen seen seen', function (t) { + t.plan(1); + var xs = [1, 2, 3]; + + var seen = [5, xs]; + seen.indexOf = undefined; + + t.equal( + inspect(xs, {}, 0, seen), + '[Circular]' + ); +}); + +test('symbols', { skip: !hasSymbols }, function (t) { + var sym = Symbol('foo'); + t.equal(inspect(sym), 'Symbol(foo)', 'Symbol("foo") should be "Symbol(foo)"'); + if (typeof sym === 'symbol') { + // Symbol shams are incapable of differentiating boxed from unboxed symbols + t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"'); + } + + t.test('toStringTag', { skip: !hasToStringTag }, function (st) { + st.plan(1); + + var faker = {}; + faker[Symbol.toStringTag] = 'Symbol'; + st.equal( + inspect(faker), + '{ [Symbol(Symbol.toStringTag)]: \'Symbol\' }', + 'object lying about being a Symbol inspects as an object' + ); + }); + + t.end(); +}); + +test('Map', { skip: typeof Map !== 'function' }, function (t) { + var map = new Map(); + map.set({ a: 1 }, ['b']); + map.set(3, NaN); + var expectedString = 'Map (2) {' + inspect({ a: 1 }) + ' => ' + inspect(['b']) + ', 3 => NaN}'; + t.equal(inspect(map), expectedString, 'new Map([[{ a: 1 }, ["b"]], [3, NaN]]) should show size and contents'); + t.equal(inspect(new Map()), 'Map (0) {}', 'empty Map should show as empty'); + + var nestedMap = new Map(); + nestedMap.set(nestedMap, map); + t.equal(inspect(nestedMap), 'Map (1) {[Circular] => ' + expectedString + '}', 'Map containing a Map should work'); + + t.end(); +}); + +test('WeakMap', { skip: typeof WeakMap !== 'function' }, function (t) { + var map = new WeakMap(); + map.set({ a: 1 }, ['b']); + var expectedString = 'WeakMap { ? }'; + t.equal(inspect(map), expectedString, 'new WeakMap([[{ a: 1 }, ["b"]]]) should not show size or contents'); + t.equal(inspect(new WeakMap()), 'WeakMap { ? }', 'empty WeakMap should not show as empty'); + + t.end(); +}); + +test('Set', { skip: typeof Set !== 'function' }, function (t) { + var set = new Set(); + set.add({ a: 1 }); + set.add(['b']); + var expectedString = 'Set (2) {' + inspect({ a: 1 }) + ', ' + inspect(['b']) + '}'; + t.equal(inspect(set), expectedString, 'new Set([{ a: 1 }, ["b"]]) should show size and contents'); + t.equal(inspect(new Set()), 'Set (0) {}', 'empty Set should show as empty'); + + var nestedSet = new Set(); + nestedSet.add(set); + nestedSet.add(nestedSet); + t.equal(inspect(nestedSet), 'Set (2) {' + expectedString + ', [Circular]}', 'Set containing a Set should work'); + + t.end(); +}); + +test('WeakSet', { skip: typeof WeakSet !== 'function' }, function (t) { + var map = new WeakSet(); + map.add({ a: 1 }); + var expectedString = 'WeakSet { ? }'; + t.equal(inspect(map), expectedString, 'new WeakSet([{ a: 1 }]) should not show size or contents'); + t.equal(inspect(new WeakSet()), 'WeakSet { ? }', 'empty WeakSet should not show as empty'); + + t.end(); +}); + +test('WeakRef', { skip: typeof WeakRef !== 'function' }, function (t) { + var ref = new WeakRef({ a: 1 }); + var expectedString = 'WeakRef { ? }'; + t.equal(inspect(ref), expectedString, 'new WeakRef({ a: 1 }) should not show contents'); + + t.end(); +}); + +test('FinalizationRegistry', { skip: typeof FinalizationRegistry !== 'function' }, function (t) { + var registry = new FinalizationRegistry(function () {}); + var expectedString = 'FinalizationRegistry [FinalizationRegistry] {}'; + t.equal(inspect(registry), expectedString, 'new FinalizationRegistry(function () {}) should work normallys'); + + t.end(); +}); + +test('Strings', function (t) { + var str = 'abc'; + + t.equal(inspect(str), "'" + str + "'", 'primitive string shows as such'); + t.equal(inspect(str, { quoteStyle: 'single' }), "'" + str + "'", 'primitive string shows as such, single quoted'); + t.equal(inspect(str, { quoteStyle: 'double' }), '"' + str + '"', 'primitive string shows as such, double quoted'); + t.equal(inspect(Object(str)), 'Object(' + inspect(str) + ')', 'String object shows as such'); + t.equal(inspect(Object(str), { quoteStyle: 'single' }), 'Object(' + inspect(str, { quoteStyle: 'single' }) + ')', 'String object shows as such, single quoted'); + t.equal(inspect(Object(str), { quoteStyle: 'double' }), 'Object(' + inspect(str, { quoteStyle: 'double' }) + ')', 'String object shows as such, double quoted'); + + t.end(); +}); + +test('Numbers', function (t) { + var num = 42; + + t.equal(inspect(num), String(num), 'primitive number shows as such'); + t.equal(inspect(Object(num)), 'Object(' + inspect(num) + ')', 'Number object shows as such'); + + t.end(); +}); + +test('Booleans', function (t) { + t.equal(inspect(true), String(true), 'primitive true shows as such'); + t.equal(inspect(Object(true)), 'Object(' + inspect(true) + ')', 'Boolean object true shows as such'); + + t.equal(inspect(false), String(false), 'primitive false shows as such'); + t.equal(inspect(Object(false)), 'Object(' + inspect(false) + ')', 'Boolean false object shows as such'); + + t.end(); +}); + +test('Date', function (t) { + var now = new Date(); + t.equal(inspect(now), String(now), 'Date shows properly'); + t.equal(inspect(new Date(NaN)), 'Invalid Date', 'Invalid Date shows properly'); + + t.end(); +}); + +test('RegExps', function (t) { + t.equal(inspect(/a/g), '/a/g', 'regex shows properly'); + t.equal(inspect(new RegExp('abc', 'i')), '/abc/i', 'new RegExp shows properly'); + + var match = 'abc abc'.match(/[ab]+/); + delete match.groups; // for node < 10 + t.equal(inspect(match), '[ \'ab\', index: 0, input: \'abc abc\' ]', 'RegExp match object shows properly'); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/object-inspect/util.inspect.js b/graphql-subscription-express/node_modules/object-inspect/util.inspect.js new file mode 100644 index 0000000..7784fab --- /dev/null +++ b/graphql-subscription-express/node_modules/object-inspect/util.inspect.js @@ -0,0 +1 @@ +module.exports = require('util').inspect; diff --git a/graphql-subscription-express/node_modules/on-finished/HISTORY.md b/graphql-subscription-express/node_modules/on-finished/HISTORY.md new file mode 100644 index 0000000..1917595 --- /dev/null +++ b/graphql-subscription-express/node_modules/on-finished/HISTORY.md @@ -0,0 +1,98 @@ +2.4.1 / 2022-02-22 +================== + + * Fix error on early async hooks implementations + +2.4.0 / 2022-02-21 +================== + + * Prevent loss of async hooks context + +2.3.0 / 2015-05-26 +================== + + * Add defined behavior for HTTP `CONNECT` requests + * Add defined behavior for HTTP `Upgrade` requests + * deps: ee-first@1.1.1 + +2.2.1 / 2015-04-22 +================== + + * Fix `isFinished(req)` when data buffered + +2.2.0 / 2014-12-22 +================== + + * Add message object to callback arguments + +2.1.1 / 2014-10-22 +================== + + * Fix handling of pipelined requests + +2.1.0 / 2014-08-16 +================== + + * Check if `socket` is detached + * Return `undefined` for `isFinished` if state unknown + +2.0.0 / 2014-08-16 +================== + + * Add `isFinished` function + * Move to `jshttp` organization + * Remove support for plain socket argument + * Rename to `on-finished` + * Support both `req` and `res` as arguments + * deps: ee-first@1.0.5 + +1.2.2 / 2014-06-10 +================== + + * Reduce listeners added to emitters + - avoids "event emitter leak" warnings when used multiple times on same request + +1.2.1 / 2014-06-08 +================== + + * Fix returned value when already finished + +1.2.0 / 2014-06-05 +================== + + * Call callback when called on already-finished socket + +1.1.4 / 2014-05-27 +================== + + * Support node.js 0.8 + +1.1.3 / 2014-04-30 +================== + + * Make sure errors passed as instanceof `Error` + +1.1.2 / 2014-04-18 +================== + + * Default the `socket` to passed-in object + +1.1.1 / 2014-01-16 +================== + + * Rename module to `finished` + +1.1.0 / 2013-12-25 +================== + + * Call callback when called on already-errored socket + +1.0.1 / 2013-12-20 +================== + + * Actually pass the error to the callback + +1.0.0 / 2013-12-20 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/on-finished/LICENSE b/graphql-subscription-express/node_modules/on-finished/LICENSE new file mode 100644 index 0000000..5931fd2 --- /dev/null +++ b/graphql-subscription-express/node_modules/on-finished/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2013 Jonathan Ong +Copyright (c) 2014 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/on-finished/README.md b/graphql-subscription-express/node_modules/on-finished/README.md new file mode 100644 index 0000000..8973cde --- /dev/null +++ b/graphql-subscription-express/node_modules/on-finished/README.md @@ -0,0 +1,162 @@ +# on-finished + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Execute a callback when a HTTP request closes, finishes, or errors. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install on-finished +``` + +## API + +```js +var onFinished = require('on-finished') +``` + +### onFinished(res, listener) + +Attach a listener to listen for the response to finish. The listener will +be invoked only once when the response finished. If the response finished +to an error, the first argument will contain the error. If the response +has already finished, the listener will be invoked. + +Listening to the end of a response would be used to close things associated +with the response, like open files. + +Listener is invoked as `listener(err, res)`. + + + +```js +onFinished(res, function (err, res) { + // clean up open fds, etc. + // err contains the error if request error'd +}) +``` + +### onFinished(req, listener) + +Attach a listener to listen for the request to finish. The listener will +be invoked only once when the request finished. If the request finished +to an error, the first argument will contain the error. If the request +has already finished, the listener will be invoked. + +Listening to the end of a request would be used to know when to continue +after reading the data. + +Listener is invoked as `listener(err, req)`. + + + +```js +var data = '' + +req.setEncoding('utf8') +req.on('data', function (str) { + data += str +}) + +onFinished(req, function (err, req) { + // data is read unless there is err +}) +``` + +### onFinished.isFinished(res) + +Determine if `res` is already finished. This would be useful to check and +not even start certain operations if the response has already finished. + +### onFinished.isFinished(req) + +Determine if `req` is already finished. This would be useful to check and +not even start certain operations if the request has already finished. + +## Special Node.js requests + +### HTTP CONNECT method + +The meaning of the `CONNECT` method from RFC 7231, section 4.3.6: + +> The CONNECT method requests that the recipient establish a tunnel to +> the destination origin server identified by the request-target and, +> if successful, thereafter restrict its behavior to blind forwarding +> of packets, in both directions, until the tunnel is closed. Tunnels +> are commonly used to create an end-to-end virtual connection, through +> one or more proxies, which can then be secured using TLS (Transport +> Layer Security, [RFC5246]). + +In Node.js, these request objects come from the `'connect'` event on +the HTTP server. + +When this module is used on a HTTP `CONNECT` request, the request is +considered "finished" immediately, **due to limitations in the Node.js +interface**. This means if the `CONNECT` request contains a request entity, +the request will be considered "finished" even before it has been read. + +There is no such thing as a response object to a `CONNECT` request in +Node.js, so there is no support for one. + +### HTTP Upgrade request + +The meaning of the `Upgrade` header from RFC 7230, section 6.1: + +> The "Upgrade" header field is intended to provide a simple mechanism +> for transitioning from HTTP/1.1 to some other protocol on the same +> connection. + +In Node.js, these request objects come from the `'upgrade'` event on +the HTTP server. + +When this module is used on a HTTP request with an `Upgrade` header, the +request is considered "finished" immediately, **due to limitations in the +Node.js interface**. This means if the `Upgrade` request contains a request +entity, the request will be considered "finished" even before it has been +read. + +There is no such thing as a response object to a `Upgrade` request in +Node.js, so there is no support for one. + +## Example + +The following code ensures that file descriptors are always closed +once the response finishes. + +```js +var destroy = require('destroy') +var fs = require('fs') +var http = require('http') +var onFinished = require('on-finished') + +http.createServer(function onRequest (req, res) { + var stream = fs.createReadStream('package.json') + stream.pipe(res) + onFinished(res, function () { + destroy(stream) + }) +}) +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/on-finished/master?label=ci +[ci-url]: https://github.com/jshttp/on-finished/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-finished/master +[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master +[node-image]: https://badgen.net/npm/node/on-finished +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/on-finished +[npm-url]: https://npmjs.org/package/on-finished +[npm-version-image]: https://badgen.net/npm/v/on-finished diff --git a/graphql-subscription-express/node_modules/on-finished/index.js b/graphql-subscription-express/node_modules/on-finished/index.js new file mode 100644 index 0000000..e68df7b --- /dev/null +++ b/graphql-subscription-express/node_modules/on-finished/index.js @@ -0,0 +1,234 @@ +/*! + * on-finished + * Copyright(c) 2013 Jonathan Ong + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = onFinished +module.exports.isFinished = isFinished + +/** + * Module dependencies. + * @private + */ + +var asyncHooks = tryRequireAsyncHooks() +var first = require('ee-first') + +/** + * Variables. + * @private + */ + +/* istanbul ignore next */ +var defer = typeof setImmediate === 'function' + ? setImmediate + : function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) } + +/** + * Invoke callback when the response has finished, useful for + * cleaning up resources afterwards. + * + * @param {object} msg + * @param {function} listener + * @return {object} + * @public + */ + +function onFinished (msg, listener) { + if (isFinished(msg) !== false) { + defer(listener, null, msg) + return msg + } + + // attach the listener to the message + attachListener(msg, wrap(listener)) + + return msg +} + +/** + * Determine if message is already finished. + * + * @param {object} msg + * @return {boolean} + * @public + */ + +function isFinished (msg) { + var socket = msg.socket + + if (typeof msg.finished === 'boolean') { + // OutgoingMessage + return Boolean(msg.finished || (socket && !socket.writable)) + } + + if (typeof msg.complete === 'boolean') { + // IncomingMessage + return Boolean(msg.upgrade || !socket || !socket.readable || (msg.complete && !msg.readable)) + } + + // don't know + return undefined +} + +/** + * Attach a finished listener to the message. + * + * @param {object} msg + * @param {function} callback + * @private + */ + +function attachFinishedListener (msg, callback) { + var eeMsg + var eeSocket + var finished = false + + function onFinish (error) { + eeMsg.cancel() + eeSocket.cancel() + + finished = true + callback(error) + } + + // finished on first message event + eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish) + + function onSocket (socket) { + // remove listener + msg.removeListener('socket', onSocket) + + if (finished) return + if (eeMsg !== eeSocket) return + + // finished on first socket event + eeSocket = first([[socket, 'error', 'close']], onFinish) + } + + if (msg.socket) { + // socket already assigned + onSocket(msg.socket) + return + } + + // wait for socket to be assigned + msg.on('socket', onSocket) + + if (msg.socket === undefined) { + // istanbul ignore next: node.js 0.8 patch + patchAssignSocket(msg, onSocket) + } +} + +/** + * Attach the listener to the message. + * + * @param {object} msg + * @return {function} + * @private + */ + +function attachListener (msg, listener) { + var attached = msg.__onFinished + + // create a private single listener with queue + if (!attached || !attached.queue) { + attached = msg.__onFinished = createListener(msg) + attachFinishedListener(msg, attached) + } + + attached.queue.push(listener) +} + +/** + * Create listener on message. + * + * @param {object} msg + * @return {function} + * @private + */ + +function createListener (msg) { + function listener (err) { + if (msg.__onFinished === listener) msg.__onFinished = null + if (!listener.queue) return + + var queue = listener.queue + listener.queue = null + + for (var i = 0; i < queue.length; i++) { + queue[i](err, msg) + } + } + + listener.queue = [] + + return listener +} + +/** + * Patch ServerResponse.prototype.assignSocket for node.js 0.8. + * + * @param {ServerResponse} res + * @param {function} callback + * @private + */ + +// istanbul ignore next: node.js 0.8 patch +function patchAssignSocket (res, callback) { + var assignSocket = res.assignSocket + + if (typeof assignSocket !== 'function') return + + // res.on('socket', callback) is broken in 0.8 + res.assignSocket = function _assignSocket (socket) { + assignSocket.call(this, socket) + callback(socket) + } +} + +/** + * Try to require async_hooks + * @private + */ + +function tryRequireAsyncHooks () { + try { + return require('async_hooks') + } catch (e) { + return {} + } +} + +/** + * Wrap function with async resource, if possible. + * AsyncResource.bind static method backported. + * @private + */ + +function wrap (fn) { + var res + + // create anonymous resource + if (asyncHooks.AsyncResource) { + res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn') + } + + // incompatible node.js + if (!res || !res.runInAsyncScope) { + return fn + } + + // return bound function + return res.runInAsyncScope.bind(res, fn, null) +} diff --git a/graphql-subscription-express/node_modules/on-finished/package.json b/graphql-subscription-express/node_modules/on-finished/package.json new file mode 100644 index 0000000..644cd81 --- /dev/null +++ b/graphql-subscription-express/node_modules/on-finished/package.json @@ -0,0 +1,39 @@ +{ + "name": "on-finished", + "description": "Execute a callback when a request closes, finishes, or errors", + "version": "2.4.1", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "jshttp/on-finished", + "dependencies": { + "ee-first": "1.1.1" + }, + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.1", + "nyc": "15.1.0" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/parseurl/HISTORY.md b/graphql-subscription-express/node_modules/parseurl/HISTORY.md new file mode 100644 index 0000000..8e40954 --- /dev/null +++ b/graphql-subscription-express/node_modules/parseurl/HISTORY.md @@ -0,0 +1,58 @@ +1.3.3 / 2019-04-15 +================== + + * Fix Node.js 0.8 return value inconsistencies + +1.3.2 / 2017-09-09 +================== + + * perf: reduce overhead for full URLs + * perf: unroll the "fast-path" `RegExp` + +1.3.1 / 2016-01-17 +================== + + * perf: enable strict mode + +1.3.0 / 2014-08-09 +================== + + * Add `parseurl.original` for parsing `req.originalUrl` with fallback + * Return `undefined` if `req.url` is `undefined` + +1.2.0 / 2014-07-21 +================== + + * Cache URLs based on original value + * Remove no-longer-needed URL mis-parse work-around + * Simplify the "fast-path" `RegExp` + +1.1.3 / 2014-07-08 +================== + + * Fix typo + +1.1.2 / 2014-07-08 +================== + + * Seriously fix Node.js 0.8 compatibility + +1.1.1 / 2014-07-08 +================== + + * Fix Node.js 0.8 compatibility + +1.1.0 / 2014-07-08 +================== + + * Incorporate URL href-only parse fast-path + +1.0.1 / 2014-03-08 +================== + + * Add missing `require` + +1.0.0 / 2014-03-08 +================== + + * Genesis from `connect` diff --git a/graphql-subscription-express/node_modules/parseurl/LICENSE b/graphql-subscription-express/node_modules/parseurl/LICENSE new file mode 100644 index 0000000..27653d3 --- /dev/null +++ b/graphql-subscription-express/node_modules/parseurl/LICENSE @@ -0,0 +1,24 @@ + +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/parseurl/README.md b/graphql-subscription-express/node_modules/parseurl/README.md new file mode 100644 index 0000000..443e716 --- /dev/null +++ b/graphql-subscription-express/node_modules/parseurl/README.md @@ -0,0 +1,133 @@ +# parseurl + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Parse a URL with memoization. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install parseurl +``` + +## API + +```js +var parseurl = require('parseurl') +``` + +### parseurl(req) + +Parse the URL of the given request object (looks at the `req.url` property) +and return the result. The result is the same as `url.parse` in Node.js core. +Calling this function multiple times on the same `req` where `req.url` does +not change will return a cached parsed object, rather than parsing again. + +### parseurl.original(req) + +Parse the original URL of the given request object and return the result. +This works by trying to parse `req.originalUrl` if it is a string, otherwise +parses `req.url`. The result is the same as `url.parse` in Node.js core. +Calling this function multiple times on the same `req` where `req.originalUrl` +does not change will return a cached parsed object, rather than parsing again. + +## Benchmark + +```bash +$ npm run-script bench + +> parseurl@1.3.3 bench nodejs-parseurl +> node benchmark/index.js + + http_parser@2.8.0 + node@10.6.0 + v8@6.7.288.46-node.13 + uv@1.21.0 + zlib@1.2.11 + ares@1.14.0 + modules@64 + nghttp2@1.32.0 + napi@3 + openssl@1.1.0h + icu@61.1 + unicode@10.0 + cldr@33.0 + tz@2018c + +> node benchmark/fullurl.js + + Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy" + + 4 tests completed. + + fasturl x 2,207,842 ops/sec ±3.76% (184 runs sampled) + nativeurl - legacy x 507,180 ops/sec ±0.82% (191 runs sampled) + nativeurl - whatwg x 290,044 ops/sec ±1.96% (189 runs sampled) + parseurl x 488,907 ops/sec ±2.13% (192 runs sampled) + +> node benchmark/pathquery.js + + Parsing URL "/foo/bar?user=tj&pet=fluffy" + + 4 tests completed. + + fasturl x 3,812,564 ops/sec ±3.15% (188 runs sampled) + nativeurl - legacy x 2,651,631 ops/sec ±1.68% (189 runs sampled) + nativeurl - whatwg x 161,837 ops/sec ±2.26% (189 runs sampled) + parseurl x 4,166,338 ops/sec ±2.23% (184 runs sampled) + +> node benchmark/samerequest.js + + Parsing URL "/foo/bar?user=tj&pet=fluffy" on same request object + + 4 tests completed. + + fasturl x 3,821,651 ops/sec ±2.42% (185 runs sampled) + nativeurl - legacy x 2,651,162 ops/sec ±1.90% (187 runs sampled) + nativeurl - whatwg x 175,166 ops/sec ±1.44% (188 runs sampled) + parseurl x 14,912,606 ops/sec ±3.59% (183 runs sampled) + +> node benchmark/simplepath.js + + Parsing URL "/foo/bar" + + 4 tests completed. + + fasturl x 12,421,765 ops/sec ±2.04% (191 runs sampled) + nativeurl - legacy x 7,546,036 ops/sec ±1.41% (188 runs sampled) + nativeurl - whatwg x 198,843 ops/sec ±1.83% (189 runs sampled) + parseurl x 24,244,006 ops/sec ±0.51% (194 runs sampled) + +> node benchmark/slash.js + + Parsing URL "/" + + 4 tests completed. + + fasturl x 17,159,456 ops/sec ±3.25% (188 runs sampled) + nativeurl - legacy x 11,635,097 ops/sec ±3.79% (184 runs sampled) + nativeurl - whatwg x 240,693 ops/sec ±0.83% (189 runs sampled) + parseurl x 42,279,067 ops/sec ±0.55% (190 runs sampled) +``` + +## License + + [MIT](LICENSE) + +[coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/parseurl/master +[coveralls-url]: https://coveralls.io/r/pillarjs/parseurl?branch=master +[node-image]: https://badgen.net/npm/node/parseurl +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/parseurl +[npm-url]: https://npmjs.org/package/parseurl +[npm-version-image]: https://badgen.net/npm/v/parseurl +[travis-image]: https://badgen.net/travis/pillarjs/parseurl/master +[travis-url]: https://travis-ci.org/pillarjs/parseurl diff --git a/graphql-subscription-express/node_modules/parseurl/index.js b/graphql-subscription-express/node_modules/parseurl/index.js new file mode 100644 index 0000000..ece7223 --- /dev/null +++ b/graphql-subscription-express/node_modules/parseurl/index.js @@ -0,0 +1,158 @@ +/*! + * parseurl + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var url = require('url') +var parse = url.parse +var Url = url.Url + +/** + * Module exports. + * @public + */ + +module.exports = parseurl +module.exports.original = originalurl + +/** + * Parse the `req` url with memoization. + * + * @param {ServerRequest} req + * @return {Object} + * @public + */ + +function parseurl (req) { + var url = req.url + + if (url === undefined) { + // URL is undefined + return undefined + } + + var parsed = req._parsedUrl + + if (fresh(url, parsed)) { + // Return cached URL parse + return parsed + } + + // Parse the URL + parsed = fastparse(url) + parsed._raw = url + + return (req._parsedUrl = parsed) +}; + +/** + * Parse the `req` original url with fallback and memoization. + * + * @param {ServerRequest} req + * @return {Object} + * @public + */ + +function originalurl (req) { + var url = req.originalUrl + + if (typeof url !== 'string') { + // Fallback + return parseurl(req) + } + + var parsed = req._parsedOriginalUrl + + if (fresh(url, parsed)) { + // Return cached URL parse + return parsed + } + + // Parse the URL + parsed = fastparse(url) + parsed._raw = url + + return (req._parsedOriginalUrl = parsed) +}; + +/** + * Parse the `str` url with fast-path short-cut. + * + * @param {string} str + * @return {Object} + * @private + */ + +function fastparse (str) { + if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) { + return parse(str) + } + + var pathname = str + var query = null + var search = null + + // This takes the regexp from https://github.com/joyent/node/pull/7878 + // Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/ + // And unrolls it into a for loop + for (var i = 1; i < str.length; i++) { + switch (str.charCodeAt(i)) { + case 0x3f: /* ? */ + if (search === null) { + pathname = str.substring(0, i) + query = str.substring(i + 1) + search = str.substring(i) + } + break + case 0x09: /* \t */ + case 0x0a: /* \n */ + case 0x0c: /* \f */ + case 0x0d: /* \r */ + case 0x20: /* */ + case 0x23: /* # */ + case 0xa0: + case 0xfeff: + return parse(str) + } + } + + var url = Url !== undefined + ? new Url() + : {} + + url.path = str + url.href = str + url.pathname = pathname + + if (search !== null) { + url.query = query + url.search = search + } + + return url +} + +/** + * Determine if parsed is still fresh for url. + * + * @param {string} url + * @param {object} parsedUrl + * @return {boolean} + * @private + */ + +function fresh (url, parsedUrl) { + return typeof parsedUrl === 'object' && + parsedUrl !== null && + (Url === undefined || parsedUrl instanceof Url) && + parsedUrl._raw === url +} diff --git a/graphql-subscription-express/node_modules/parseurl/package.json b/graphql-subscription-express/node_modules/parseurl/package.json new file mode 100644 index 0000000..6b443ca --- /dev/null +++ b/graphql-subscription-express/node_modules/parseurl/package.json @@ -0,0 +1,40 @@ +{ + "name": "parseurl", + "description": "parse a url with memoization", + "version": "1.3.3", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "repository": "pillarjs/parseurl", + "license": "MIT", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "5.16.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.17.1", + "eslint-plugin-node": "7.0.1", + "eslint-plugin-promise": "4.1.1", + "eslint-plugin-standard": "4.0.0", + "fast-url-parser": "1.1.3", + "istanbul": "0.4.5", + "mocha": "6.1.3" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint .", + "test": "mocha --check-leaks --bail --reporter spec test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/" + } +} diff --git a/graphql-subscription-express/node_modules/path-to-regexp/History.md b/graphql-subscription-express/node_modules/path-to-regexp/History.md new file mode 100644 index 0000000..7f65878 --- /dev/null +++ b/graphql-subscription-express/node_modules/path-to-regexp/History.md @@ -0,0 +1,36 @@ +0.1.7 / 2015-07-28 +================== + + * Fixed regression with escaped round brackets and matching groups. + +0.1.6 / 2015-06-19 +================== + + * Replace `index` feature by outputting all parameters, unnamed and named. + +0.1.5 / 2015-05-08 +================== + + * Add an index property for position in match result. + +0.1.4 / 2015-03-05 +================== + + * Add license information + +0.1.3 / 2014-07-06 +================== + + * Better array support + * Improved support for trailing slash in non-ending mode + +0.1.0 / 2014-03-06 +================== + + * add options.end + +0.0.2 / 2013-02-10 +================== + + * Update to match current express + * add .license property to component.json diff --git a/graphql-subscription-express/node_modules/path-to-regexp/LICENSE b/graphql-subscription-express/node_modules/path-to-regexp/LICENSE new file mode 100644 index 0000000..983fbe8 --- /dev/null +++ b/graphql-subscription-express/node_modules/path-to-regexp/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/path-to-regexp/Readme.md b/graphql-subscription-express/node_modules/path-to-regexp/Readme.md new file mode 100644 index 0000000..95452a6 --- /dev/null +++ b/graphql-subscription-express/node_modules/path-to-regexp/Readme.md @@ -0,0 +1,35 @@ +# Path-to-RegExp + +Turn an Express-style path string such as `/user/:name` into a regular expression. + +**Note:** This is a legacy branch. You should upgrade to `1.x`. + +## Usage + +```javascript +var pathToRegexp = require('path-to-regexp'); +``` + +### pathToRegexp(path, keys, options) + + - **path** A string in the express format, an array of such strings, or a regular expression + - **keys** An array to be populated with the keys present in the url. Once the function completes, this will be an array of strings. + - **options** + - **options.sensitive** Defaults to false, set this to true to make routes case sensitive + - **options.strict** Defaults to false, set this to true to make the trailing slash matter. + - **options.end** Defaults to true, set this to false to only match the prefix of the URL. + +```javascript +var keys = []; +var exp = pathToRegexp('/foo/:bar', keys); +//keys = ['bar'] +//exp = /^\/foo\/(?:([^\/]+?))\/?$/i +``` + +## Live Demo + +You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/). + +## License + + MIT diff --git a/graphql-subscription-express/node_modules/path-to-regexp/index.js b/graphql-subscription-express/node_modules/path-to-regexp/index.js new file mode 100644 index 0000000..500d1da --- /dev/null +++ b/graphql-subscription-express/node_modules/path-to-regexp/index.js @@ -0,0 +1,129 @@ +/** + * Expose `pathtoRegexp`. + */ + +module.exports = pathtoRegexp; + +/** + * Match matching groups in a regular expression. + */ +var MATCHING_GROUP_REGEXP = /\((?!\?)/g; + +/** + * Normalize the given path string, + * returning a regular expression. + * + * An empty array should be passed, + * which will contain the placeholder + * key names. For example "/user/:id" will + * then contain ["id"]. + * + * @param {String|RegExp|Array} path + * @param {Array} keys + * @param {Object} options + * @return {RegExp} + * @api private + */ + +function pathtoRegexp(path, keys, options) { + options = options || {}; + keys = keys || []; + var strict = options.strict; + var end = options.end !== false; + var flags = options.sensitive ? '' : 'i'; + var extraOffset = 0; + var keysOffset = keys.length; + var i = 0; + var name = 0; + var m; + + if (path instanceof RegExp) { + while (m = MATCHING_GROUP_REGEXP.exec(path.source)) { + keys.push({ + name: name++, + optional: false, + offset: m.index + }); + } + + return path; + } + + if (Array.isArray(path)) { + // Map array parts into regexps and return their source. We also pass + // the same keys and options instance into every generation to get + // consistent matching groups before we join the sources together. + path = path.map(function (value) { + return pathtoRegexp(value, keys, options).source; + }); + + return new RegExp('(?:' + path.join('|') + ')', flags); + } + + path = ('^' + path + (strict ? '' : path[path.length - 1] === '/' ? '?' : '/?')) + .replace(/\/\(/g, '/(?:') + .replace(/([\/\.])/g, '\\$1') + .replace(/(\\\/)?(\\\.)?:(\w+)(\(.*?\))?(\*)?(\?)?/g, function (match, slash, format, key, capture, star, optional, offset) { + slash = slash || ''; + format = format || ''; + capture = capture || '([^\\/' + format + ']+?)'; + optional = optional || ''; + + keys.push({ + name: key, + optional: !!optional, + offset: offset + extraOffset + }); + + var result = '' + + (optional ? '' : slash) + + '(?:' + + format + (optional ? slash : '') + capture + + (star ? '((?:[\\/' + format + '].+?)?)' : '') + + ')' + + optional; + + extraOffset += result.length - match.length; + + return result; + }) + .replace(/\*/g, function (star, index) { + var len = keys.length + + while (len-- > keysOffset && keys[len].offset > index) { + keys[len].offset += 3; // Replacement length minus asterisk length. + } + + return '(.*)'; + }); + + // This is a workaround for handling unnamed matching groups. + while (m = MATCHING_GROUP_REGEXP.exec(path)) { + var escapeCount = 0; + var index = m.index; + + while (path.charAt(--index) === '\\') { + escapeCount++; + } + + // It's possible to escape the bracket. + if (escapeCount % 2 === 1) { + continue; + } + + if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) { + keys.splice(keysOffset + i, 0, { + name: name++, // Unnamed matching groups must be consistently linear. + optional: false, + offset: m.index + }); + } + + i++; + } + + // If the path is non-ending, match until the end or a slash. + path += (end ? '$' : (path[path.length - 1] === '/' ? '' : '(?=\\/|$)')); + + return new RegExp(path, flags); +}; diff --git a/graphql-subscription-express/node_modules/path-to-regexp/package.json b/graphql-subscription-express/node_modules/path-to-regexp/package.json new file mode 100644 index 0000000..d4e51b5 --- /dev/null +++ b/graphql-subscription-express/node_modules/path-to-regexp/package.json @@ -0,0 +1,30 @@ +{ + "name": "path-to-regexp", + "description": "Express style path to RegExp utility", + "version": "0.1.7", + "files": [ + "index.js", + "LICENSE" + ], + "scripts": { + "test": "istanbul cover _mocha -- -R spec" + }, + "keywords": [ + "express", + "regexp" + ], + "component": { + "scripts": { + "path-to-regexp": "index.js" + } + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/component/path-to-regexp.git" + }, + "devDependencies": { + "mocha": "^1.17.1", + "istanbul": "^0.2.6" + } +} diff --git a/graphql-subscription-express/node_modules/proxy-addr/HISTORY.md b/graphql-subscription-express/node_modules/proxy-addr/HISTORY.md new file mode 100644 index 0000000..8480242 --- /dev/null +++ b/graphql-subscription-express/node_modules/proxy-addr/HISTORY.md @@ -0,0 +1,161 @@ +2.0.7 / 2021-05-31 +================== + + * deps: forwarded@0.2.0 + - Use `req.socket` over deprecated `req.connection` + +2.0.6 / 2020-02-24 +================== + + * deps: ipaddr.js@1.9.1 + +2.0.5 / 2019-04-16 +================== + + * deps: ipaddr.js@1.9.0 + +2.0.4 / 2018-07-26 +================== + + * deps: ipaddr.js@1.8.0 + +2.0.3 / 2018-02-19 +================== + + * deps: ipaddr.js@1.6.0 + +2.0.2 / 2017-09-24 +================== + + * deps: forwarded@~0.1.2 + - perf: improve header parsing + - perf: reduce overhead when no `X-Forwarded-For` header + +2.0.1 / 2017-09-10 +================== + + * deps: forwarded@~0.1.1 + - Fix trimming leading / trailing OWS + - perf: hoist regular expression + * deps: ipaddr.js@1.5.2 + +2.0.0 / 2017-08-08 +================== + + * Drop support for Node.js below 0.10 + +1.1.5 / 2017-07-25 +================== + + * Fix array argument being altered + * deps: ipaddr.js@1.4.0 + +1.1.4 / 2017-03-24 +================== + + * deps: ipaddr.js@1.3.0 + +1.1.3 / 2017-01-14 +================== + + * deps: ipaddr.js@1.2.0 + +1.1.2 / 2016-05-29 +================== + + * deps: ipaddr.js@1.1.1 + - Fix IPv6-mapped IPv4 validation edge cases + +1.1.1 / 2016-05-03 +================== + + * Fix regression matching mixed versions against multiple subnets + +1.1.0 / 2016-05-01 +================== + + * Fix accepting various invalid netmasks + - IPv4 netmasks must be contingous + - IPv6 addresses cannot be used as a netmask + * deps: ipaddr.js@1.1.0 + +1.0.10 / 2015-12-09 +=================== + + * deps: ipaddr.js@1.0.5 + - Fix regression in `isValid` with non-string arguments + +1.0.9 / 2015-12-01 +================== + + * deps: ipaddr.js@1.0.4 + - Fix accepting some invalid IPv6 addresses + - Reject CIDRs with negative or overlong masks + * perf: enable strict mode + +1.0.8 / 2015-05-10 +================== + + * deps: ipaddr.js@1.0.1 + +1.0.7 / 2015-03-16 +================== + + * deps: ipaddr.js@0.1.9 + - Fix OOM on certain inputs to `isValid` + +1.0.6 / 2015-02-01 +================== + + * deps: ipaddr.js@0.1.8 + +1.0.5 / 2015-01-08 +================== + + * deps: ipaddr.js@0.1.6 + +1.0.4 / 2014-11-23 +================== + + * deps: ipaddr.js@0.1.5 + - Fix edge cases with `isValid` + +1.0.3 / 2014-09-21 +================== + + * Use `forwarded` npm module + +1.0.2 / 2014-09-18 +================== + + * Fix a global leak when multiple subnets are trusted + * Support Node.js 0.6 + * deps: ipaddr.js@0.1.3 + +1.0.1 / 2014-06-03 +================== + + * Fix links in npm package + +1.0.0 / 2014-05-08 +================== + + * Add `trust` argument to determine proxy trust on + * Accepts custom function + * Accepts IPv4/IPv6 address(es) + * Accepts subnets + * Accepts pre-defined names + * Add optional `trust` argument to `proxyaddr.all` to + stop at first untrusted + * Add `proxyaddr.compile` to pre-compile `trust` function + to make subsequent calls faster + +0.0.1 / 2014-05-04 +================== + + * Fix bad npm publish + +0.0.0 / 2014-05-04 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/proxy-addr/LICENSE b/graphql-subscription-express/node_modules/proxy-addr/LICENSE new file mode 100644 index 0000000..cab251c --- /dev/null +++ b/graphql-subscription-express/node_modules/proxy-addr/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/proxy-addr/README.md b/graphql-subscription-express/node_modules/proxy-addr/README.md new file mode 100644 index 0000000..69c0b63 --- /dev/null +++ b/graphql-subscription-express/node_modules/proxy-addr/README.md @@ -0,0 +1,139 @@ +# proxy-addr + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Determine address of proxied request + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install proxy-addr +``` + +## API + +```js +var proxyaddr = require('proxy-addr') +``` + +### proxyaddr(req, trust) + +Return the address of the request, using the given `trust` parameter. + +The `trust` argument is a function that returns `true` if you trust +the address, `false` if you don't. The closest untrusted address is +returned. + +```js +proxyaddr(req, function (addr) { return addr === '127.0.0.1' }) +proxyaddr(req, function (addr, i) { return i < 1 }) +``` + +The `trust` arugment may also be a single IP address string or an +array of trusted addresses, as plain IP addresses, CIDR-formatted +strings, or IP/netmask strings. + +```js +proxyaddr(req, '127.0.0.1') +proxyaddr(req, ['127.0.0.0/8', '10.0.0.0/8']) +proxyaddr(req, ['127.0.0.0/255.0.0.0', '192.168.0.0/255.255.0.0']) +``` + +This module also supports IPv6. Your IPv6 addresses will be normalized +automatically (i.e. `fe80::00ed:1` equals `fe80:0:0:0:0:0:ed:1`). + +```js +proxyaddr(req, '::1') +proxyaddr(req, ['::1/128', 'fe80::/10']) +``` + +This module will automatically work with IPv4-mapped IPv6 addresses +as well to support node.js in IPv6-only mode. This means that you do +not have to specify both `::ffff:a00:1` and `10.0.0.1`. + +As a convenience, this module also takes certain pre-defined names +in addition to IP addresses, which expand into IP addresses: + +```js +proxyaddr(req, 'loopback') +proxyaddr(req, ['loopback', 'fc00:ac:1ab5:fff::1/64']) +``` + + * `loopback`: IPv4 and IPv6 loopback addresses (like `::1` and + `127.0.0.1`). + * `linklocal`: IPv4 and IPv6 link-local addresses (like + `fe80::1:1:1:1` and `169.254.0.1`). + * `uniquelocal`: IPv4 private addresses and IPv6 unique-local + addresses (like `fc00:ac:1ab5:fff::1` and `192.168.0.1`). + +When `trust` is specified as a function, it will be called for each +address to determine if it is a trusted address. The function is +given two arguments: `addr` and `i`, where `addr` is a string of +the address to check and `i` is a number that represents the distance +from the socket address. + +### proxyaddr.all(req, [trust]) + +Return all the addresses of the request, optionally stopping at the +first untrusted. This array is ordered from closest to furthest +(i.e. `arr[0] === req.connection.remoteAddress`). + +```js +proxyaddr.all(req) +``` + +The optional `trust` argument takes the same arguments as `trust` +does in `proxyaddr(req, trust)`. + +```js +proxyaddr.all(req, 'loopback') +``` + +### proxyaddr.compile(val) + +Compiles argument `val` into a `trust` function. This function takes +the same arguments as `trust` does in `proxyaddr(req, trust)` and +returns a function suitable for `proxyaddr(req, trust)`. + +```js +var trust = proxyaddr.compile('loopback') +var addr = proxyaddr(req, trust) +``` + +This function is meant to be optimized for use against every request. +It is recommend to compile a trust function up-front for the trusted +configuration and pass that to `proxyaddr(req, trust)` for each request. + +## Testing + +```sh +$ npm test +``` + +## Benchmarks + +```sh +$ npm run-script bench +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/proxy-addr/master?label=ci +[ci-url]: https://github.com/jshttp/proxy-addr/actions?query=workflow%3Aci +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/proxy-addr/master +[coveralls-url]: https://coveralls.io/r/jshttp/proxy-addr?branch=master +[node-image]: https://badgen.net/npm/node/proxy-addr +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/proxy-addr +[npm-url]: https://npmjs.org/package/proxy-addr +[npm-version-image]: https://badgen.net/npm/v/proxy-addr diff --git a/graphql-subscription-express/node_modules/proxy-addr/index.js b/graphql-subscription-express/node_modules/proxy-addr/index.js new file mode 100644 index 0000000..a909b05 --- /dev/null +++ b/graphql-subscription-express/node_modules/proxy-addr/index.js @@ -0,0 +1,327 @@ +/*! + * proxy-addr + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = proxyaddr +module.exports.all = alladdrs +module.exports.compile = compile + +/** + * Module dependencies. + * @private + */ + +var forwarded = require('forwarded') +var ipaddr = require('ipaddr.js') + +/** + * Variables. + * @private + */ + +var DIGIT_REGEXP = /^[0-9]+$/ +var isip = ipaddr.isValid +var parseip = ipaddr.parse + +/** + * Pre-defined IP ranges. + * @private + */ + +var IP_RANGES = { + linklocal: ['169.254.0.0/16', 'fe80::/10'], + loopback: ['127.0.0.1/8', '::1/128'], + uniquelocal: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', 'fc00::/7'] +} + +/** + * Get all addresses in the request, optionally stopping + * at the first untrusted. + * + * @param {Object} request + * @param {Function|Array|String} [trust] + * @public + */ + +function alladdrs (req, trust) { + // get addresses + var addrs = forwarded(req) + + if (!trust) { + // Return all addresses + return addrs + } + + if (typeof trust !== 'function') { + trust = compile(trust) + } + + for (var i = 0; i < addrs.length - 1; i++) { + if (trust(addrs[i], i)) continue + + addrs.length = i + 1 + } + + return addrs +} + +/** + * Compile argument into trust function. + * + * @param {Array|String} val + * @private + */ + +function compile (val) { + if (!val) { + throw new TypeError('argument is required') + } + + var trust + + if (typeof val === 'string') { + trust = [val] + } else if (Array.isArray(val)) { + trust = val.slice() + } else { + throw new TypeError('unsupported trust argument') + } + + for (var i = 0; i < trust.length; i++) { + val = trust[i] + + if (!Object.prototype.hasOwnProperty.call(IP_RANGES, val)) { + continue + } + + // Splice in pre-defined range + val = IP_RANGES[val] + trust.splice.apply(trust, [i, 1].concat(val)) + i += val.length - 1 + } + + return compileTrust(compileRangeSubnets(trust)) +} + +/** + * Compile `arr` elements into range subnets. + * + * @param {Array} arr + * @private + */ + +function compileRangeSubnets (arr) { + var rangeSubnets = new Array(arr.length) + + for (var i = 0; i < arr.length; i++) { + rangeSubnets[i] = parseipNotation(arr[i]) + } + + return rangeSubnets +} + +/** + * Compile range subnet array into trust function. + * + * @param {Array} rangeSubnets + * @private + */ + +function compileTrust (rangeSubnets) { + // Return optimized function based on length + var len = rangeSubnets.length + return len === 0 + ? trustNone + : len === 1 + ? trustSingle(rangeSubnets[0]) + : trustMulti(rangeSubnets) +} + +/** + * Parse IP notation string into range subnet. + * + * @param {String} note + * @private + */ + +function parseipNotation (note) { + var pos = note.lastIndexOf('/') + var str = pos !== -1 + ? note.substring(0, pos) + : note + + if (!isip(str)) { + throw new TypeError('invalid IP address: ' + str) + } + + var ip = parseip(str) + + if (pos === -1 && ip.kind() === 'ipv6' && ip.isIPv4MappedAddress()) { + // Store as IPv4 + ip = ip.toIPv4Address() + } + + var max = ip.kind() === 'ipv6' + ? 128 + : 32 + + var range = pos !== -1 + ? note.substring(pos + 1, note.length) + : null + + if (range === null) { + range = max + } else if (DIGIT_REGEXP.test(range)) { + range = parseInt(range, 10) + } else if (ip.kind() === 'ipv4' && isip(range)) { + range = parseNetmask(range) + } else { + range = null + } + + if (range <= 0 || range > max) { + throw new TypeError('invalid range on address: ' + note) + } + + return [ip, range] +} + +/** + * Parse netmask string into CIDR range. + * + * @param {String} netmask + * @private + */ + +function parseNetmask (netmask) { + var ip = parseip(netmask) + var kind = ip.kind() + + return kind === 'ipv4' + ? ip.prefixLengthFromSubnetMask() + : null +} + +/** + * Determine address of proxied request. + * + * @param {Object} request + * @param {Function|Array|String} trust + * @public + */ + +function proxyaddr (req, trust) { + if (!req) { + throw new TypeError('req argument is required') + } + + if (!trust) { + throw new TypeError('trust argument is required') + } + + var addrs = alladdrs(req, trust) + var addr = addrs[addrs.length - 1] + + return addr +} + +/** + * Static trust function to trust nothing. + * + * @private + */ + +function trustNone () { + return false +} + +/** + * Compile trust function for multiple subnets. + * + * @param {Array} subnets + * @private + */ + +function trustMulti (subnets) { + return function trust (addr) { + if (!isip(addr)) return false + + var ip = parseip(addr) + var ipconv + var kind = ip.kind() + + for (var i = 0; i < subnets.length; i++) { + var subnet = subnets[i] + var subnetip = subnet[0] + var subnetkind = subnetip.kind() + var subnetrange = subnet[1] + var trusted = ip + + if (kind !== subnetkind) { + if (subnetkind === 'ipv4' && !ip.isIPv4MappedAddress()) { + // Incompatible IP addresses + continue + } + + if (!ipconv) { + // Convert IP to match subnet IP kind + ipconv = subnetkind === 'ipv4' + ? ip.toIPv4Address() + : ip.toIPv4MappedAddress() + } + + trusted = ipconv + } + + if (trusted.match(subnetip, subnetrange)) { + return true + } + } + + return false + } +} + +/** + * Compile trust function for single subnet. + * + * @param {Object} subnet + * @private + */ + +function trustSingle (subnet) { + var subnetip = subnet[0] + var subnetkind = subnetip.kind() + var subnetisipv4 = subnetkind === 'ipv4' + var subnetrange = subnet[1] + + return function trust (addr) { + if (!isip(addr)) return false + + var ip = parseip(addr) + var kind = ip.kind() + + if (kind !== subnetkind) { + if (subnetisipv4 && !ip.isIPv4MappedAddress()) { + // Incompatible IP addresses + return false + } + + // Convert IP to match subnet IP kind + ip = subnetisipv4 + ? ip.toIPv4Address() + : ip.toIPv4MappedAddress() + } + + return ip.match(subnetip, subnetrange) + } +} diff --git a/graphql-subscription-express/node_modules/proxy-addr/package.json b/graphql-subscription-express/node_modules/proxy-addr/package.json new file mode 100644 index 0000000..24ba8f7 --- /dev/null +++ b/graphql-subscription-express/node_modules/proxy-addr/package.json @@ -0,0 +1,47 @@ +{ + "name": "proxy-addr", + "description": "Determine address of proxied request", + "version": "2.0.7", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "ip", + "proxy", + "x-forwarded-for" + ], + "repository": "jshttp/proxy-addr", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "devDependencies": { + "benchmark": "2.1.4", + "beautify-benchmark": "0.2.4", + "deep-equal": "1.0.1", + "eslint": "7.26.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.23.4", + "eslint-plugin-markdown": "2.2.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "4.3.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "8.4.0", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.10" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/qs/.editorconfig b/graphql-subscription-express/node_modules/qs/.editorconfig new file mode 100644 index 0000000..2f08444 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/.editorconfig @@ -0,0 +1,43 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 160 +quote_type = single + +[test/*] +max_line_length = off + +[LICENSE.md] +indent_size = off + +[*.md] +max_line_length = off + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[LICENSE] +indent_size = 2 +max_line_length = off + +[coverage/**/*] +indent_size = off +indent_style = off +indent = off +max_line_length = off + +[.nycrc] +indent_style = tab diff --git a/graphql-subscription-express/node_modules/qs/.eslintrc b/graphql-subscription-express/node_modules/qs/.eslintrc new file mode 100644 index 0000000..35220cd --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/.eslintrc @@ -0,0 +1,38 @@ +{ + "root": true, + + "extends": "@ljharb", + + "ignorePatterns": [ + "dist/", + ], + + "rules": { + "complexity": 0, + "consistent-return": 1, + "func-name-matching": 0, + "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], + "indent": [2, 4], + "max-lines-per-function": [2, { "max": 150 }], + "max-params": [2, 16], + "max-statements": [2, 53], + "multiline-comment-style": 0, + "no-continue": 1, + "no-magic-numbers": 0, + "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "function-paren-newline": 0, + "max-lines-per-function": 0, + "max-statements": 0, + "no-buffer-constructor": 0, + "no-extend-native": 0, + "no-throw-literal": 0, + }, + }, + ], +} diff --git a/graphql-subscription-express/node_modules/qs/.github/FUNDING.yml b/graphql-subscription-express/node_modules/qs/.github/FUNDING.yml new file mode 100644 index 0000000..0355f4f --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/qs +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/graphql-subscription-express/node_modules/qs/.nycrc b/graphql-subscription-express/node_modules/qs/.nycrc new file mode 100644 index 0000000..1d57cab --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "dist" + ] +} diff --git a/graphql-subscription-express/node_modules/qs/CHANGELOG.md b/graphql-subscription-express/node_modules/qs/CHANGELOG.md new file mode 100644 index 0000000..37b1d3f --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/CHANGELOG.md @@ -0,0 +1,546 @@ +## **6.11.0 +- [New] [Fix] `stringify`: revert 0e903c0; add `commaRoundTrip` option (#442) +- [readme] fix version badge + +## **6.10.5** +- [Fix] `stringify`: with `arrayFormat: comma`, properly include an explicit `[]` on a single-item array (#434) + +## **6.10.4** +- [Fix] `stringify`: with `arrayFormat: comma`, include an explicit `[]` on a single-item array (#441) +- [meta] use `npmignore` to autogenerate an npmignore file +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbol`, `object-inspect`, `tape` + +## **6.10.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [actions] reuse common workflows +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `tape` + +## **6.10.2** +- [Fix] `stringify`: actually fix cyclic references (#426) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] add note and links for coercing primitive values (#408) +- [actions] update codecov uploader +- [actions] update workflows +- [Tests] clean up stringify tests slightly +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `safe-publish-latest`, `tape` + +## **6.10.1** +- [Fix] `stringify`: avoid exception on repeated object values (#402) + +## **6.10.0** +- [New] `stringify`: throw on cycles, instead of an infinite loop (#395, #394, #393) +- [New] `parse`: add `allowSparse` option for collapsing arrays with missing indices (#312) +- [meta] fix README.md (#399) +- [meta] only run `npm run dist` in publish, not install +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `tape` +- [Tests] fix tests on node v0.6 +- [Tests] use `ljharb/actions/node/install` instead of `ljharb/actions/node/run` +- [Tests] Revert "[meta] ignore eclint transitive audit warning" + +## **6.9.7** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] add note and links for coercing primitive values (#408) +- [Tests] clean up stringify tests slightly +- [meta] fix README.md (#399) +- Revert "[meta] ignore eclint transitive audit warning" +- [actions] backport actions from main +- [Dev Deps] backport updates from main + +## **6.9.6** +- [Fix] restore `dist` dir; mistakenly removed in d4f6c32 + +## **6.9.5** +- [Fix] `stringify`: do not encode parens for RFC1738 +- [Fix] `stringify`: fix arrayFormat comma with empty array/objects (#350) +- [Refactor] `format`: remove `util.assign` call +- [meta] add "Allow Edits" workflow; update rebase workflow +- [actions] switch Automatic Rebase workflow to `pull_request_target` event +- [Tests] `stringify`: add tests for #378 +- [Tests] migrate tests to Github Actions +- [Tests] run `nyc` on all tests; use `tape` runner +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `mkdirp`, `object-inspect`, `tape`; add `aud` + +## **6.9.4** +- [Fix] `stringify`: when `arrayFormat` is `comma`, respect `serializeDate` (#364) +- [Refactor] `stringify`: reduce branching (part of #350) +- [Refactor] move `maybeMap` to `utils` +- [Dev Deps] update `browserify`, `tape` + +## **6.9.3** +- [Fix] proper comma parsing of URL-encoded commas (#361) +- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) + +## **6.9.2** +- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) +- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) +- [meta] ignore eclint transitive audit warning +- [meta] fix indentation in package.json +- [meta] add tidelift marketing copy +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `has-symbols`, `tape`, `mkdirp`, `iconv-lite` +- [actions] add automatic rebasing / merge commit blocking + +## **6.9.1** +- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) +- [Fix] `parse`: with comma true, do not split non-string values (#334) +- [meta] add `funding` field +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` +- [Tests] use shared travis-ci config + +## **6.9.0** +- [New] `parse`/`stringify`: Pass extra key/value argument to `decoder` (#333) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `evalmd` +- [Tests] `parse`: add passing `arrayFormat` tests +- [Tests] add `posttest` using `npx aud` to run `npm audit` without a lockfile +- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16` +- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray + +## **6.8.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Tests] clean up stringify tests slightly +- [Docs] add note and links for coercing primitive values (#408) +- [meta] fix README.md (#399) +- [actions] backport actions from main +- [Dev Deps] backport updates from main +- [Refactor] `stringify`: reduce branching +- [meta] do not publish workflow files + +## **6.8.2** +- [Fix] proper comma parsing of URL-encoded commas (#361) +- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) + +## **6.8.1** +- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) +- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) +- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) +- [fix] `parse`: with comma true, do not split non-string values (#334) +- [meta] add tidelift marketing copy +- [meta] add `funding` field +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `has-symbols`, `iconv-lite`, `mkdirp`, `object-inspect` +- [Tests] `parse`: add passing `arrayFormat` tests +- [Tests] use shared travis-ci configs +- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray +- [actions] add automatic rebasing / merge commit blocking + +## **6.8.0** +- [New] add `depth=false` to preserve the original key; [Fix] `depth=0` should preserve the original key (#326) +- [New] [Fix] stringify symbols and bigints +- [Fix] ensure node 0.12 can stringify Symbols +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Refactor] `formats`: tiny bit of cleanup. +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `safe-publish-latest`, `iconv-lite`, `tape` +- [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended (#326) +- [Tests] use `eclint` instead of `editorconfig-tools` +- [docs] readme: add security note +- [meta] add github sponsorship +- [meta] add FUNDING.yml +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause + +## **6.7.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] add note and links for coercing primitive values (#408) +- [meta] fix README.md (#399) +- [meta] do not publish workflow files +- [actions] backport actions from main +- [Dev Deps] backport updates from main +- [Tests] use `nyc` for coverage +- [Tests] clean up stringify tests slightly + +## **6.7.2** +- [Fix] proper comma parsing of URL-encoded commas (#361) +- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) + +## **6.7.1** +- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) +- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) +- [fix] `parse`: with comma true, do not split non-string values (#334) +- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Refactor] `formats`: tiny bit of cleanup. +- readme: add security note +- [meta] add tidelift marketing copy +- [meta] add `funding` field +- [meta] add FUNDING.yml +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `iconv-lite`, `mkdirp`, `object-inspect`, `browserify` +- [Tests] `parse`: add passing `arrayFormat` tests +- [Tests] use shared travis-ci configs +- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray +- [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended +- [Tests] use `eclint` instead of `editorconfig-tools` +- [actions] add automatic rebasing / merge commit blocking + +## **6.7.0** +- [New] `stringify`/`parse`: add `comma` as an `arrayFormat` option (#276, #219) +- [Fix] correctly parse nested arrays (#212) +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source, also with an array source +- [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty` +- [Refactor] `utils`: `isBuffer`: small tweak; add tests +- [Refactor] use cached `Array.isArray` +- [Refactor] `parse`/`stringify`: make a function to normalize the options +- [Refactor] `utils`: reduce observable [[Get]]s +- [Refactor] `stringify`/`utils`: cache `Array.isArray` +- [Tests] always use `String(x)` over `x.toString()` +- [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10 +- [Tests] temporarily allow coverage to fail + +## **6.6.1** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] correctly parse nested arrays +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty` +- [Refactor] `formats`: tiny bit of cleanup. +- [Refactor] `utils`: `isBuffer`: small tweak; add tests +- [Refactor]: `stringify`/`utils`: cache `Array.isArray` +- [Refactor] `utils`: reduce observable [[Get]]s +- [Refactor] use cached `Array.isArray` +- [Refactor] `parse`/`stringify`: make a function to normalize the options +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] do not publish workflow files +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [meta] Fixes typo in CHANGELOG.md +- [actions] backport actions from main +- [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10 +- [Tests] always use `String(x)` over `x.toString()` +- [Dev Deps] backport from main + +## **6.6.0** +- [New] Add support for iso-8859-1, utf8 "sentinel" and numeric entities (#268) +- [New] move two-value combine to a `utils` function (#189) +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` (#260) +- [Fix] `stringify`: do not crash in an obscure combo of `interpretNumericEntities`, a bad custom `decoder`, & `iso-8859-1` +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [Refactor] `parse`: only need to reassign the var once +- [Refactor] `parse`/`stringify`: clean up `charset` options checking; fix defaults +- [Refactor] add missing defaults +- [Refactor] `parse`: one less `concat` call +- [Refactor] `utils`: `compactQueue`: make it explicitly side-effecting +- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`, `iconv-lite`, `safe-publish-latest`, `tape` +- [Tests] up to `node` `v10.10`, `v9.11`, `v8.12`, `v6.14`, `v4.9`; pin included builds to LTS + +## **6.5.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix]` `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] correctly parse nested arrays +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Refactor] `utils`: reduce observable [[Get]]s +- [Refactor] use cached `Array.isArray` +- [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [Refactor] `parse`: only need to reassign the var once +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] Clean up license text so it’s properly detected as BSD-3-Clause +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] always use `String(x)` over `x.toString()` +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.5.2** +- [Fix] use `safer-buffer` instead of `Buffer` constructor +- [Refactor] utils: `module.exports` one thing, instead of mutating `exports` (#230) +- [Dev Deps] update `browserify`, `eslint`, `iconv-lite`, `safer-buffer`, `tape`, `browserify` + +## **6.5.1** +- [Fix] Fix parsing & compacting very deep objects (#224) +- [Refactor] name utils functions +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` +- [Tests] up to `node` `v8.4`; use `nvm install-latest-npm` so newer npm doesn’t break older node +- [Tests] Use precise dist for Node.js 0.6 runtime (#225) +- [Tests] make 0.6 required, now that it’s passing +- [Tests] on `node` `v8.2`; fix npm on node 0.6 + +## **6.5.0** +- [New] add `utils.assign` +- [New] pass default encoder/decoder to custom encoder/decoder functions (#206) +- [New] `parse`/`stringify`: add `ignoreQueryPrefix`/`addQueryPrefix` options, respectively (#213) +- [Fix] Handle stringifying empty objects with addQueryPrefix (#217) +- [Fix] do not mutate `options` argument (#207) +- [Refactor] `parse`: cache index to reuse in else statement (#182) +- [Docs] add various badges to readme (#208) +- [Dev Deps] update `eslint`, `browserify`, `iconv-lite`, `tape` +- [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`; npm v4.6 breaks on node < v1; npm v5+ breaks on node < v4 +- [Tests] add `editorconfig-tools` + +## **6.4.1** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] use `safer-buffer` instead of `Buffer` constructor +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix]` `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Refactor] use cached `Array.isArray` +- [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.4.0** +- [New] `qs.stringify`: add `encodeValuesOnly` option +- [Fix] follow `allowPrototypes` option during merge (#201, #201) +- [Fix] support keys starting with brackets (#202, #200) +- [Fix] chmod a-x +- [Dev Deps] update `eslint` +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds +- [eslint] reduce warnings + +## **6.3.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix]` `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Refactor] use cached `Array.isArray` +- [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] use `safer-buffer` instead of `Buffer` constructor +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.3.2** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Dev Deps] update `eslint` +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.3.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties (thanks, @snyk!) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `iconv-lite`, `qs-iconv`, `tape` +- [Tests] on all node minors; improve test matrix +- [Docs] document stringify option `allowDots` (#195) +- [Docs] add empty object and array values example (#195) +- [Docs] Fix minor inconsistency/typo (#192) +- [Docs] document stringify option `sort` (#191) +- [Refactor] `stringify`: throw faster with an invalid encoder +- [Refactor] remove unnecessary escapes (#184) +- Remove contributing.md, since `qs` is no longer part of `hapi` (#183) + +## **6.3.0** +- [New] Add support for RFC 1738 (#174, #173) +- [New] `stringify`: Add `serializeDate` option to customize Date serialization (#159) +- [Fix] ensure `utils.merge` handles merging two arrays +- [Refactor] only constructors should be capitalized +- [Refactor] capitalized var names are for constructors only +- [Refactor] avoid using a sparse array +- [Robustness] `formats`: cache `String#replace` +- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` +- [Tests] up to `node` `v6.8`, `v4.6`; improve test matrix +- [Tests] flesh out arrayLimit/arrayFormat tests (#107) +- [Tests] skip Object.create tests when null objects are not available +- [Tests] Turn on eslint for test files (#175) + +## **6.2.4** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Refactor] use cached `Array.isArray` +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] use `safer-buffer` instead of `Buffer` constructor +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.2.3** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.2.2** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## **6.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values +- [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call` +- [Tests] remove `parallelshell` since it does not reliably report failures +- [Tests] up to `node` `v6.3`, `v5.12` +- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `qs-iconv` + +## [**6.2.0**](https://github.com/ljharb/qs/issues?milestone=36&state=closed) +- [New] pass Buffers to the encoder/decoder directly (#161) +- [New] add "encoder" and "decoder" options, for custom param encoding/decoding (#160) +- [Fix] fix compacting of nested sparse arrays (#150) + +## **6.1.2 +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.1.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=35&state=closed) +- [New] allowDots option for `stringify` (#151) +- [Fix] "sort" option should work at a depth of 3 or more (#151) +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## **6.0.4** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.0.3** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed) +- Revert ES6 requirement and restore support for node down to v0.8. + +## [**6.0.1**](https://github.com/ljharb/qs/issues?milestone=32&state=closed) +- [**#127**](https://github.com/ljharb/qs/pull/127) Fix engines definition in package.json + +## [**6.0.0**](https://github.com/ljharb/qs/issues?milestone=31&state=closed) +- [**#124**](https://github.com/ljharb/qs/issues/124) Use ES6 and drop support for node < v4 + +## **5.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values + +## [**5.2.0**](https://github.com/ljharb/qs/issues?milestone=30&state=closed) +- [**#64**](https://github.com/ljharb/qs/issues/64) Add option to sort object keys in the query string + +## [**5.1.0**](https://github.com/ljharb/qs/issues?milestone=29&state=closed) +- [**#117**](https://github.com/ljharb/qs/issues/117) make URI encoding stringified results optional +- [**#106**](https://github.com/ljharb/qs/issues/106) Add flag `skipNulls` to optionally skip null values in stringify + +## [**5.0.0**](https://github.com/ljharb/qs/issues?milestone=28&state=closed) +- [**#114**](https://github.com/ljharb/qs/issues/114) default allowDots to false +- [**#100**](https://github.com/ljharb/qs/issues/100) include dist to npm + +## [**4.0.0**](https://github.com/ljharb/qs/issues?milestone=26&state=closed) +- [**#98**](https://github.com/ljharb/qs/issues/98) make returning plain objects and allowing prototype overwriting properties optional + +## [**3.1.0**](https://github.com/ljharb/qs/issues?milestone=24&state=closed) +- [**#89**](https://github.com/ljharb/qs/issues/89) Add option to disable "Transform dot notation to bracket notation" + +## [**3.0.0**](https://github.com/ljharb/qs/issues?milestone=23&state=closed) +- [**#80**](https://github.com/ljharb/qs/issues/80) qs.parse silently drops properties +- [**#77**](https://github.com/ljharb/qs/issues/77) Perf boost +- [**#60**](https://github.com/ljharb/qs/issues/60) Add explicit option to disable array parsing +- [**#74**](https://github.com/ljharb/qs/issues/74) Bad parse when turning array into object +- [**#81**](https://github.com/ljharb/qs/issues/81) Add a `filter` option +- [**#68**](https://github.com/ljharb/qs/issues/68) Fixed issue with recursion and passing strings into objects. +- [**#66**](https://github.com/ljharb/qs/issues/66) Add mixed array and object dot notation support Closes: #47 +- [**#76**](https://github.com/ljharb/qs/issues/76) RFC 3986 +- [**#85**](https://github.com/ljharb/qs/issues/85) No equal sign +- [**#84**](https://github.com/ljharb/qs/issues/84) update license attribute + +## [**2.4.1**](https://github.com/ljharb/qs/issues?milestone=20&state=closed) +- [**#73**](https://github.com/ljharb/qs/issues/73) Property 'hasOwnProperty' of object # is not a function + +## [**2.4.0**](https://github.com/ljharb/qs/issues?milestone=19&state=closed) +- [**#70**](https://github.com/ljharb/qs/issues/70) Add arrayFormat option + +## [**2.3.3**](https://github.com/ljharb/qs/issues?milestone=18&state=closed) +- [**#59**](https://github.com/ljharb/qs/issues/59) make sure array indexes are >= 0, closes #57 +- [**#58**](https://github.com/ljharb/qs/issues/58) make qs usable for browser loader + +## [**2.3.2**](https://github.com/ljharb/qs/issues?milestone=17&state=closed) +- [**#55**](https://github.com/ljharb/qs/issues/55) allow merging a string into an object + +## [**2.3.1**](https://github.com/ljharb/qs/issues?milestone=16&state=closed) +- [**#52**](https://github.com/ljharb/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError". + +## [**2.3.0**](https://github.com/ljharb/qs/issues?milestone=15&state=closed) +- [**#50**](https://github.com/ljharb/qs/issues/50) add option to omit array indices, closes #46 + +## [**2.2.5**](https://github.com/ljharb/qs/issues?milestone=14&state=closed) +- [**#39**](https://github.com/ljharb/qs/issues/39) Is there an alternative to Buffer.isBuffer? +- [**#49**](https://github.com/ljharb/qs/issues/49) refactor utils.merge, fixes #45 +- [**#41**](https://github.com/ljharb/qs/issues/41) avoid browserifying Buffer, for #39 + +## [**2.2.4**](https://github.com/ljharb/qs/issues?milestone=13&state=closed) +- [**#38**](https://github.com/ljharb/qs/issues/38) how to handle object keys beginning with a number + +## [**2.2.3**](https://github.com/ljharb/qs/issues?milestone=12&state=closed) +- [**#37**](https://github.com/ljharb/qs/issues/37) parser discards first empty value in array +- [**#36**](https://github.com/ljharb/qs/issues/36) Update to lab 4.x + +## [**2.2.2**](https://github.com/ljharb/qs/issues?milestone=11&state=closed) +- [**#33**](https://github.com/ljharb/qs/issues/33) Error when plain object in a value +- [**#34**](https://github.com/ljharb/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty +- [**#24**](https://github.com/ljharb/qs/issues/24) Changelog? Semver? + +## [**2.2.1**](https://github.com/ljharb/qs/issues?milestone=10&state=closed) +- [**#32**](https://github.com/ljharb/qs/issues/32) account for circular references properly, closes #31 +- [**#31**](https://github.com/ljharb/qs/issues/31) qs.parse stackoverflow on circular objects + +## [**2.2.0**](https://github.com/ljharb/qs/issues?milestone=9&state=closed) +- [**#26**](https://github.com/ljharb/qs/issues/26) Don't use Buffer global if it's not present +- [**#30**](https://github.com/ljharb/qs/issues/30) Bug when merging non-object values into arrays +- [**#29**](https://github.com/ljharb/qs/issues/29) Don't call Utils.clone at the top of Utils.merge +- [**#23**](https://github.com/ljharb/qs/issues/23) Ability to not limit parameters? + +## [**2.1.0**](https://github.com/ljharb/qs/issues?milestone=8&state=closed) +- [**#22**](https://github.com/ljharb/qs/issues/22) Enable using a RegExp as delimiter + +## [**2.0.0**](https://github.com/ljharb/qs/issues?milestone=7&state=closed) +- [**#18**](https://github.com/ljharb/qs/issues/18) Why is there arrayLimit? +- [**#20**](https://github.com/ljharb/qs/issues/20) Configurable parametersLimit +- [**#21**](https://github.com/ljharb/qs/issues/21) make all limits optional, for #18, for #20 + +## [**1.2.2**](https://github.com/ljharb/qs/issues?milestone=6&state=closed) +- [**#19**](https://github.com/ljharb/qs/issues/19) Don't overwrite null values + +## [**1.2.1**](https://github.com/ljharb/qs/issues?milestone=5&state=closed) +- [**#16**](https://github.com/ljharb/qs/issues/16) ignore non-string delimiters +- [**#15**](https://github.com/ljharb/qs/issues/15) Close code block + +## [**1.2.0**](https://github.com/ljharb/qs/issues?milestone=4&state=closed) +- [**#12**](https://github.com/ljharb/qs/issues/12) Add optional delim argument +- [**#13**](https://github.com/ljharb/qs/issues/13) fix #11: flattened keys in array are now correctly parsed + +## [**1.1.0**](https://github.com/ljharb/qs/issues?milestone=3&state=closed) +- [**#7**](https://github.com/ljharb/qs/issues/7) Empty values of a POST array disappear after being submitted +- [**#9**](https://github.com/ljharb/qs/issues/9) Should not omit equals signs (=) when value is null +- [**#6**](https://github.com/ljharb/qs/issues/6) Minor grammar fix in README + +## [**1.0.2**](https://github.com/ljharb/qs/issues?milestone=2&state=closed) +- [**#5**](https://github.com/ljharb/qs/issues/5) array holes incorrectly copied into object on large index diff --git a/graphql-subscription-express/node_modules/qs/LICENSE.md b/graphql-subscription-express/node_modules/qs/LICENSE.md new file mode 100644 index 0000000..fecf6b6 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/LICENSE.md @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/ljharb/qs/graphs/contributors) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/graphql-subscription-express/node_modules/qs/README.md b/graphql-subscription-express/node_modules/qs/README.md new file mode 100644 index 0000000..11be853 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/README.md @@ -0,0 +1,625 @@ +# qs [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A querystring parsing and stringifying library with some added security. + +Lead Maintainer: [Jordan Harband](https://github.com/ljharb) + +The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring). + +## Usage + +```javascript +var qs = require('qs'); +var assert = require('assert'); + +var obj = qs.parse('a=c'); +assert.deepEqual(obj, { a: 'c' }); + +var str = qs.stringify(obj); +assert.equal(str, 'a=c'); +``` + +### Parsing Objects + +[](#preventEval) +```javascript +qs.parse(string, [options]); +``` + +**qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`. +For example, the string `'foo[bar]=baz'` converts to: + +```javascript +assert.deepEqual(qs.parse('foo[bar]=baz'), { + foo: { + bar: 'baz' + } +}); +``` + +When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: + +```javascript +var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); +assert.deepEqual(nullObject, { a: { hasOwnProperty: 'b' } }); +``` + +By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. *WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option. + +```javascript +var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); +assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); +``` + +URI encoded strings work too: + +```javascript +assert.deepEqual(qs.parse('a%5Bb%5D=c'), { + a: { b: 'c' } +}); +``` + +You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`: + +```javascript +assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { + foo: { + bar: { + baz: 'foobarbaz' + } + } +}); +``` + +By default, when nesting objects **qs** will only parse up to 5 children deep. This means if you attempt to parse a string like +`'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be: + +```javascript +var expected = { + a: { + b: { + c: { + d: { + e: { + f: { + '[g][h][i]': 'j' + } + } + } + } + } + } +}; +var string = 'a[b][c][d][e][f][g][h][i]=j'; +assert.deepEqual(qs.parse(string), expected); +``` + +This depth can be overridden by passing a `depth` option to `qs.parse(string, [options])`: + +```javascript +var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); +assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); +``` + +The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number. + +For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option: + +```javascript +var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); +assert.deepEqual(limited, { a: 'b' }); +``` + +To bypass the leading question mark, use `ignoreQueryPrefix`: + +```javascript +var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true }); +assert.deepEqual(prefixed, { a: 'b', c: 'd' }); +``` + +An optional delimiter can also be passed: + +```javascript +var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); +assert.deepEqual(delimited, { a: 'b', c: 'd' }); +``` + +Delimiters can be a regular expression too: + +```javascript +var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); +assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); +``` + +Option `allowDots` can be used to enable dot notation: + +```javascript +var withDots = qs.parse('a.b=c', { allowDots: true }); +assert.deepEqual(withDots, { a: { b: 'c' } }); +``` + +If you have to deal with legacy browsers or services, there's +also support for decoding percent-encoded octets as iso-8859-1: + +```javascript +var oldCharset = qs.parse('a=%A7', { charset: 'iso-8859-1' }); +assert.deepEqual(oldCharset, { a: '§' }); +``` + +Some services add an initial `utf8=✓` value to forms so that old +Internet Explorer versions are more likely to submit the form as +utf-8. Additionally, the server can check the value against wrong +encodings of the checkmark character and detect that a query string +or `application/x-www-form-urlencoded` body was *not* sent as +utf-8, eg. if the form had an `accept-charset` parameter or the +containing page had a different character set. + +**qs** supports this mechanism via the `charsetSentinel` option. +If specified, the `utf8` parameter will be omitted from the +returned object. It will be used to switch to `iso-8859-1`/`utf-8` +mode depending on how the checkmark is encoded. + +**Important**: When you specify both the `charset` option and the +`charsetSentinel` option, the `charset` will be overridden when +the request contains a `utf8` parameter from which the actual +charset can be deduced. In that sense the `charset` will behave +as the default charset rather than the authoritative charset. + +```javascript +var detectedAsUtf8 = qs.parse('utf8=%E2%9C%93&a=%C3%B8', { + charset: 'iso-8859-1', + charsetSentinel: true +}); +assert.deepEqual(detectedAsUtf8, { a: 'ø' }); + +// Browsers encode the checkmark as ✓ when submitting as iso-8859-1: +var detectedAsIso8859_1 = qs.parse('utf8=%26%2310003%3B&a=%F8', { + charset: 'utf-8', + charsetSentinel: true +}); +assert.deepEqual(detectedAsIso8859_1, { a: 'ø' }); +``` + +If you want to decode the `&#...;` syntax to the actual character, +you can specify the `interpretNumericEntities` option as well: + +```javascript +var detectedAsIso8859_1 = qs.parse('a=%26%239786%3B', { + charset: 'iso-8859-1', + interpretNumericEntities: true +}); +assert.deepEqual(detectedAsIso8859_1, { a: '☺' }); +``` + +It also works when the charset has been detected in `charsetSentinel` +mode. + +### Parsing Arrays + +**qs** can also parse arrays using a similar `[]` notation: + +```javascript +var withArray = qs.parse('a[]=b&a[]=c'); +assert.deepEqual(withArray, { a: ['b', 'c'] }); +``` + +You may specify an index as well: + +```javascript +var withIndexes = qs.parse('a[1]=c&a[0]=b'); +assert.deepEqual(withIndexes, { a: ['b', 'c'] }); +``` + +Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number +to create an array. When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving +their order: + +```javascript +var noSparse = qs.parse('a[1]=b&a[15]=c'); +assert.deepEqual(noSparse, { a: ['b', 'c'] }); +``` + +You may also use `allowSparse` option to parse sparse arrays: + +```javascript +var sparseArray = qs.parse('a[1]=2&a[3]=5', { allowSparse: true }); +assert.deepEqual(sparseArray, { a: [, '2', , '5'] }); +``` + +Note that an empty string is also a value, and will be preserved: + +```javascript +var withEmptyString = qs.parse('a[]=&a[]=b'); +assert.deepEqual(withEmptyString, { a: ['', 'b'] }); + +var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); +assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); +``` + +**qs** will also limit specifying indices in an array to a maximum index of `20`. Any array members with an index of greater than `20` will +instead be converted to an object with the index as the key. This is needed to handle cases when someone sent, for example, `a[999999999]` and it will take significant time to iterate over this huge array. + +```javascript +var withMaxIndex = qs.parse('a[100]=b'); +assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); +``` + +This limit can be overridden by passing an `arrayLimit` option: + +```javascript +var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); +assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); +``` + +To disable array parsing entirely, set `parseArrays` to `false`. + +```javascript +var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); +assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); +``` + +If you mix notations, **qs** will merge the two items into an object: + +```javascript +var mixedNotation = qs.parse('a[0]=b&a[b]=c'); +assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); +``` + +You can also create arrays of objects: + +```javascript +var arraysOfObjects = qs.parse('a[][b]=c'); +assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); +``` + +Some people use comma to join array, **qs** can parse it: +```javascript +var arraysOfObjects = qs.parse('a=b,c', { comma: true }) +assert.deepEqual(arraysOfObjects, { a: ['b', 'c'] }) +``` +(_this cannot convert nested objects, such as `a={b:1},{c:d}`_) + +### Parsing primitive/scalar values (numbers, booleans, null, etc) + +By default, all values are parsed as strings. This behavior will not change and is explained in [issue #91](https://github.com/ljharb/qs/issues/91). + +```javascript +var primitiveValues = qs.parse('a=15&b=true&c=null'); +assert.deepEqual(primitiveValues, { a: '15', b: 'true', c: 'null' }); +``` + +If you wish to auto-convert values which look like numbers, booleans, and other values into their primitive counterparts, you can use the [query-types Express JS middleware](https://github.com/xpepermint/query-types) which will auto-convert all request query parameters. + +### Stringifying + +[](#preventEval) +```javascript +qs.stringify(object, [options]); +``` + +When stringifying, **qs** by default URI encodes output. Objects are stringified as you would expect: + +```javascript +assert.equal(qs.stringify({ a: 'b' }), 'a=b'); +assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); +``` + +This encoding can be disabled by setting the `encode` option to `false`: + +```javascript +var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); +assert.equal(unencoded, 'a[b]=c'); +``` + +Encoding can be disabled for keys by setting the `encodeValuesOnly` option to `true`: +```javascript +var encodedValues = qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true } +); +assert.equal(encodedValues,'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h'); +``` + +This encoding can also be replaced by a custom encoding method set as `encoder` option: + +```javascript +var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) { + // Passed in values `a`, `b`, `c` + return // Return encoded string +}}) +``` + +_(Note: the `encoder` option does not apply if `encode` is `false`)_ + +Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values: + +```javascript +var decoded = qs.parse('x=z', { decoder: function (str) { + // Passed in values `x`, `z` + return // Return decoded string +}}) +``` + +You can encode keys and values using different logic by using the type argument provided to the encoder: + +```javascript +var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str, defaultEncoder, charset, type) { + if (type === 'key') { + return // Encoded key + } else if (type === 'value') { + return // Encoded value + } +}}) +``` + +The type argument is also provided to the decoder: + +```javascript +var decoded = qs.parse('x=z', { decoder: function (str, defaultDecoder, charset, type) { + if (type === 'key') { + return // Decoded key + } else if (type === 'value') { + return // Decoded value + } +}}) +``` + +Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage. + +When arrays are stringified, by default they are given explicit indices: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }); +// 'a[0]=b&a[1]=c&a[2]=d' +``` + +You may override this by setting the `indices` option to `false`: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); +// 'a=b&a=c&a=d' +``` + +You may use the `arrayFormat` option to specify the format of the output array: + +```javascript +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) +// 'a[0]=b&a[1]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) +// 'a[]=b&a[]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) +// 'a=b&a=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' }) +// 'a=b,c' +``` + +Note: when using `arrayFormat` set to `'comma'`, you can also pass the `commaRoundTrip` option set to `true` or `false`, to append `[]` on single-item arrays, so that they can round trip through a parse. + +When objects are stringified, by default they use bracket notation: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }); +// 'a[b][c]=d&a[b][e]=f' +``` + +You may override this to use dot notation by setting the `allowDots` option to `true`: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true }); +// 'a.b.c=d&a.b.e=f' +``` + +Empty strings and null values will omit the value, but the equals sign (=) remains in place: + +```javascript +assert.equal(qs.stringify({ a: '' }), 'a='); +``` + +Key with no values (such as an empty object or array) will return nothing: + +```javascript +assert.equal(qs.stringify({ a: [] }), ''); +assert.equal(qs.stringify({ a: {} }), ''); +assert.equal(qs.stringify({ a: [{}] }), ''); +assert.equal(qs.stringify({ a: { b: []} }), ''); +assert.equal(qs.stringify({ a: { b: {}} }), ''); +``` + +Properties that are set to `undefined` will be omitted entirely: + +```javascript +assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); +``` + +The query string may optionally be prepended with a question mark: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { addQueryPrefix: true }), '?a=b&c=d'); +``` + +The delimiter may be overridden with stringify as well: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); +``` + +If you only want to override the serialization of `Date` objects, you can provide a `serializeDate` option: + +```javascript +var date = new Date(7); +assert.equal(qs.stringify({ a: date }), 'a=1970-01-01T00:00:00.007Z'.replace(/:/g, '%3A')); +assert.equal( + qs.stringify({ a: date }, { serializeDate: function (d) { return d.getTime(); } }), + 'a=7' +); +``` + +You may use the `sort` option to affect the order of parameter keys: + +```javascript +function alphabeticalSort(a, b) { + return a.localeCompare(b); +} +assert.equal(qs.stringify({ a: 'c', z: 'y', b : 'f' }, { sort: alphabeticalSort }), 'a=c&b=f&z=y'); +``` + +Finally, you can use the `filter` option to restrict which keys will be included in the stringified output. +If you pass a function, it will be called for each key to obtain the replacement value. Otherwise, if you +pass an array, it will be used to select properties and array indices for stringification: + +```javascript +function filterFunc(prefix, value) { + if (prefix == 'b') { + // Return an `undefined` value to omit a property. + return; + } + if (prefix == 'e[f]') { + return value.getTime(); + } + if (prefix == 'e[g][0]') { + return value * 2; + } + return value; +} +qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: filterFunc }); +// 'a=b&c=d&e[f]=123&e[g][0]=4' +qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); +// 'a=b&e=f' +qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); +// 'a[0]=b&a[2]=d' +``` + +### Handling of `null` values + +By default, `null` values are treated like empty strings: + +```javascript +var withNull = qs.stringify({ a: null, b: '' }); +assert.equal(withNull, 'a=&b='); +``` + +Parsing does not distinguish between parameters with and without equal signs. Both are converted to empty strings. + +```javascript +var equalsInsensitive = qs.parse('a&b='); +assert.deepEqual(equalsInsensitive, { a: '', b: '' }); +``` + +To distinguish between `null` values and empty strings use the `strictNullHandling` flag. In the result string the `null` +values have no `=` sign: + +```javascript +var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); +assert.equal(strictNull, 'a&b='); +``` + +To parse values without `=` back to `null` use the `strictNullHandling` flag: + +```javascript +var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); +assert.deepEqual(parsedStrictNull, { a: null, b: '' }); +``` + +To completely skip rendering keys with `null` values, use the `skipNulls` flag: + +```javascript +var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true }); +assert.equal(nullsSkipped, 'a=b'); +``` + +If you're communicating with legacy systems, you can switch to `iso-8859-1` +using the `charset` option: + +```javascript +var iso = qs.stringify({ æ: 'æ' }, { charset: 'iso-8859-1' }); +assert.equal(iso, '%E6=%E6'); +``` + +Characters that don't exist in `iso-8859-1` will be converted to numeric +entities, similar to what browsers do: + +```javascript +var numeric = qs.stringify({ a: '☺' }, { charset: 'iso-8859-1' }); +assert.equal(numeric, 'a=%26%239786%3B'); +``` + +You can use the `charsetSentinel` option to announce the character by +including an `utf8=✓` parameter with the proper encoding if the checkmark, +similar to what Ruby on Rails and others do when submitting forms. + +```javascript +var sentinel = qs.stringify({ a: '☺' }, { charsetSentinel: true }); +assert.equal(sentinel, 'utf8=%E2%9C%93&a=%E2%98%BA'); + +var isoSentinel = qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'iso-8859-1' }); +assert.equal(isoSentinel, 'utf8=%26%2310003%3B&a=%E6'); +``` + +### Dealing with special character sets + +By default the encoding and decoding of characters is done in `utf-8`, +and `iso-8859-1` support is also built in via the `charset` parameter. + +If you wish to encode querystrings to a different character set (i.e. +[Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the +[`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library: + +```javascript +var encoder = require('qs-iconv/encoder')('shift_jis'); +var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); +assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); +``` + +This also works for decoding of query strings: + +```javascript +var decoder = require('qs-iconv/decoder')('shift_jis'); +var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); +assert.deepEqual(obj, { a: 'こんにちは!' }); +``` + +### RFC 3986 and RFC 1738 space encoding + +RFC3986 used as default option and encodes ' ' to *%20* which is backward compatible. +In the same time, output can be stringified as per RFC1738 with ' ' equal to '+'. + +``` +assert.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC3986' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c'); +``` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +## qs for enterprise + +Available as part of the Tidelift Subscription + +The maintainers of qs and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-qs?utm_source=npm-qs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +[package-url]: https://npmjs.org/package/qs +[npm-version-svg]: https://versionbadg.es/ljharb/qs.svg +[deps-svg]: https://david-dm.org/ljharb/qs.svg +[deps-url]: https://david-dm.org/ljharb/qs +[dev-deps-svg]: https://david-dm.org/ljharb/qs/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/qs#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/qs.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/qs.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/qs.svg +[downloads-url]: https://npm-stat.com/charts.html?package=qs +[codecov-image]: https://codecov.io/gh/ljharb/qs/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/qs/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/qs +[actions-url]: https://github.com/ljharb/qs/actions diff --git a/graphql-subscription-express/node_modules/qs/dist/qs.js b/graphql-subscription-express/node_modules/qs/dist/qs.js new file mode 100644 index 0000000..1c620a4 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/dist/qs.js @@ -0,0 +1,2054 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i -1) { + return val.split(','); + } + + return val; +}; + +// This is what browsers will submit when the ✓ character occurs in an +// application/x-www-form-urlencoded body and the encoding of the page containing +// the form is iso-8859-1, or when the submitted form has an accept-charset +// attribute of iso-8859-1. Presumably also with other charsets that do not contain +// the ✓ character, such as us-ascii. +var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓') + +// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded. +var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') + +var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; + var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; + var parts = cleanStr.split(options.delimiter, limit); + var skipIndex = -1; // Keep track of where the utf8 sentinel was found + var i; + + var charset = options.charset; + if (options.charsetSentinel) { + for (i = 0; i < parts.length; ++i) { + if (parts[i].indexOf('utf8=') === 0) { + if (parts[i] === charsetSentinel) { + charset = 'utf-8'; + } else if (parts[i] === isoSentinel) { + charset = 'iso-8859-1'; + } + skipIndex = i; + i = parts.length; // The eslint settings do not allow break; + } + } + } + + for (i = 0; i < parts.length; ++i) { + if (i === skipIndex) { + continue; + } + var part = parts[i]; + + var bracketEqualsPos = part.indexOf(']='); + var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part, defaults.decoder, charset, 'key'); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); + val = utils.maybeMap( + parseArrayValue(part.slice(pos + 1), options), + function (encodedVal) { + return options.decoder(encodedVal, defaults.decoder, charset, 'value'); + } + ); + } + + if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { + val = interpretNumericEntities(val); + } + + if (part.indexOf('[]=') > -1) { + val = isArray(val) ? [val] : val; + } + + if (has.call(obj, key)) { + obj[key] = utils.combine(obj[key], val); + } else { + obj[key] = val; + } + } + + return obj; +}; + +var parseObject = function (chain, val, options, valuesParsed) { + var leaf = valuesParsed ? val : parseArrayValue(val, options); + + for (var i = chain.length - 1; i >= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]' && options.parseArrays) { + obj = [].concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if (!options.parseArrays && cleanRoot === '') { + obj = { 0: leaf }; + } else if ( + !isNaN(index) + && root !== cleanRoot + && String(index) === cleanRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else if (cleanRoot !== '__proto__') { + obj[cleanRoot] = leaf; + } + } + + leaf = obj; + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = options.depth > 0 && brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options, valuesParsed); +}; + +var normalizeParseOptions = function normalizeParseOptions(opts) { + if (!opts) { + return defaults; + } + + if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; + + return { + allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes, + allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse, + arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma, + decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder, + delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, + // eslint-disable-next-line no-implicit-coercion, no-extra-parens + depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth, + ignoreQueryPrefix: opts.ignoreQueryPrefix === true, + interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities, + parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit, + parseArrays: opts.parseArrays !== false, + plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling + }; +}; + +module.exports = function (str, opts) { + var options = normalizeParseOptions(opts); + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string'); + obj = utils.merge(obj, newObj, options); + } + + if (options.allowSparse === true) { + return obj; + } + + return utils.compact(obj); +}; + +},{"./utils":5}],4:[function(require,module,exports){ +'use strict'; + +var getSideChannel = require('side-channel'); +var utils = require('./utils'); +var formats = require('./formats'); +var has = Object.prototype.hasOwnProperty; + +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { + return prefix + '[]'; + }, + comma: 'comma', + indices: function indices(prefix, key) { + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { + return prefix; + } +}; + +var isArray = Array.isArray; +var split = String.prototype.split; +var push = Array.prototype.push; +var pushToArray = function (arr, valueOrArray) { + push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); +}; + +var toISO = Date.prototype.toISOString; + +var defaultFormat = formats['default']; +var defaults = { + addQueryPrefix: false, + allowDots: false, + charset: 'utf-8', + charsetSentinel: false, + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + format: defaultFormat, + formatter: formats.formatters[defaultFormat], + // deprecated + indices: false, + serializeDate: function serializeDate(date) { + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var isNonNullishPrimitive = function isNonNullishPrimitive(v) { + return typeof v === 'string' + || typeof v === 'number' + || typeof v === 'boolean' + || typeof v === 'symbol' + || typeof v === 'bigint'; +}; + +var sentinel = {}; + +var stringify = function stringify( + object, + prefix, + generateArrayPrefix, + commaRoundTrip, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + sideChannel +) { + var obj = object; + + var tmpSc = sideChannel; + var step = 0; + var findFlag = false; + while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) { + // Where object last appeared in the ref tree + var pos = tmpSc.get(object); + step += 1; + if (typeof pos !== 'undefined') { + if (pos === step) { + throw new RangeError('Cyclic object value'); + } else { + findFlag = true; // Break while + } + } + if (typeof tmpSc.get(sentinel) === 'undefined') { + step = 0; + } + } + + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (generateArrayPrefix === 'comma' && isArray(obj)) { + obj = utils.maybeMap(obj, function (value) { + if (value instanceof Date) { + return serializeDate(value); + } + return value; + }); + } + + if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix; + } + + obj = ''; + } + + if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format); + if (generateArrayPrefix === 'comma' && encodeValuesOnly) { + var valuesArray = split.call(String(obj), ','); + var valuesJoined = ''; + for (var i = 0; i < valuesArray.length; ++i) { + valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format)); + } + return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined]; + } + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (generateArrayPrefix === 'comma' && isArray(obj)) { + // we need to join elements in + objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }]; + } else if (isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix; + + for (var j = 0; j < objKeys.length; ++j) { + var key = objKeys[j]; + var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key]; + + if (skipNulls && value === null) { + continue; + } + + var keyPrefix = isArray(obj) + ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix + : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']'); + + sideChannel.set(object, step); + var valueSideChannel = getSideChannel(); + valueSideChannel.set(sentinel, sideChannel); + pushToArray(values, stringify( + value, + keyPrefix, + generateArrayPrefix, + commaRoundTrip, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + valueSideChannel + )); + } + + return values; +}; + +var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { + if (!opts) { + return defaults; + } + + if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var charset = opts.charset || defaults.charset; + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + + var format = formats['default']; + if (typeof opts.format !== 'undefined') { + if (!has.call(formats.formatters, opts.format)) { + throw new TypeError('Unknown format option provided.'); + } + format = opts.format; + } + var formatter = formats.formatters[format]; + + var filter = defaults.filter; + if (typeof opts.filter === 'function' || isArray(opts.filter)) { + filter = opts.filter; + } + + return { + addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, + allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, + encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, + encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, + encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, + filter: filter, + format: format, + formatter: formatter, + serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, + skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, + sort: typeof opts.sort === 'function' ? opts.sort : null, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling + }; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = normalizeStringifyOptions(opts); + + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (opts && opts.arrayFormat in arrayPrefixGenerators) { + arrayFormat = opts.arrayFormat; + } else if (opts && 'indices' in opts) { + arrayFormat = opts.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') { + throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); + } + var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (options.sort) { + objKeys.sort(options.sort); + } + + var sideChannel = getSideChannel(); + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (options.skipNulls && obj[key] === null) { + continue; + } + pushToArray(keys, stringify( + obj[key], + key, + generateArrayPrefix, + commaRoundTrip, + options.strictNullHandling, + options.skipNulls, + options.encode ? options.encoder : null, + options.filter, + options.sort, + options.allowDots, + options.serializeDate, + options.format, + options.formatter, + options.encodeValuesOnly, + options.charset, + sideChannel + )); + } + + var joined = keys.join(options.delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + if (options.charsetSentinel) { + if (options.charset === 'iso-8859-1') { + // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark + prefix += 'utf8=%26%2310003%3B&'; + } else { + // encodeURIComponent('✓') + prefix += 'utf8=%E2%9C%93&'; + } + } + + return joined.length > 0 ? prefix + joined : ''; +}; + +},{"./formats":1,"./utils":5,"side-channel":16}],5:[function(require,module,exports){ +'use strict'; + +var formats = require('./formats'); + +var has = Object.prototype.hasOwnProperty; +var isArray = Array.isArray; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + while (queue.length > 1) { + var item = queue.pop(); + var obj = item.obj[item.prop]; + + if (isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } +}; + +var arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +var merge = function merge(target, source, options) { + /* eslint no-param-reassign: 0 */ + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (isArray(target)) { + target.push(source); + } else if (target && typeof target === 'object') { + if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (!target || typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (isArray(target) && !isArray(source)) { + mergeTarget = arrayToObject(target, options); + } + + if (isArray(target) && isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + var targetItem = target[i]; + if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { + target[i] = merge(targetItem, item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +var assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +var decode = function (str, decoder, charset) { + var strWithoutPlus = str.replace(/\+/g, ' '); + if (charset === 'iso-8859-1') { + // unescape never throws, no try...catch needed: + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); + } + // utf-8 + try { + return decodeURIComponent(strWithoutPlus); + } catch (e) { + return strWithoutPlus; + } +}; + +var encode = function encode(str, defaultEncoder, charset, kind, format) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = str; + if (typeof str === 'symbol') { + string = Symbol.prototype.toString.call(str); + } else if (typeof str !== 'string') { + string = String(str); + } + + if (charset === 'iso-8859-1') { + return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { + return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; + }); + } + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( ) + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + /* eslint operator-linebreak: [2, "before"] */ + out += hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + return out; +}; + +var compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + compactQueue(queue); + + return value; +}; + +var isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +var isBuffer = function isBuffer(obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; + +var combine = function combine(a, b) { + return [].concat(a, b); +}; + +var maybeMap = function maybeMap(val, fn) { + if (isArray(val)) { + var mapped = []; + for (var i = 0; i < val.length; i += 1) { + mapped.push(fn(val[i])); + } + return mapped; + } + return fn(val); +}; + +module.exports = { + arrayToObject: arrayToObject, + assign: assign, + combine: combine, + compact: compact, + decode: decode, + encode: encode, + isBuffer: isBuffer, + isRegExp: isRegExp, + maybeMap: maybeMap, + merge: merge +}; + +},{"./formats":1}],6:[function(require,module,exports){ + +},{}],7:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBind = require('./'); + +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; + +},{"./":8,"get-intrinsic":11}],8:[function(require,module,exports){ +'use strict'; + +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); + +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); +var $max = GetIntrinsic('%Math.max%'); + +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = null; + } +} + +module.exports = function callBind(originalFunction) { + var func = $reflectApply(bind, $call, arguments); + if ($gOPD && $defineProperty) { + var desc = $gOPD(func, 'length'); + if (desc.configurable) { + // original length, plus the receiver, minus any additional arguments (after the receiver) + $defineProperty( + func, + 'length', + { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } + ); + } + } + return func; +}; + +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} + +},{"function-bind":10,"get-intrinsic":11}],9:[function(require,module,exports){ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var slice = Array.prototype.slice; +var toStr = Object.prototype.toString; +var funcType = '[object Function]'; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + } + }; + + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push('$' + i); + } + + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; + +},{}],10:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; + +},{"./implementation":9}],11:[function(require,module,exports){ +'use strict'; + +var undefined; + +var $SyntaxError = SyntaxError; +var $Function = Function; +var $TypeError = TypeError; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = Object.getOwnPropertyDescriptor; +if ($gOPD) { + try { + $gOPD({}, ''); + } catch (e) { + $gOPD = null; // this is IE 8, which has a broken gOPD + } +} + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = require('has-symbols')(); + +var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto + +var needsEval = {}; + +var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': needsEval, + '%AsyncGenerator%': needsEval, + '%AsyncGeneratorFunction%': needsEval, + '%AsyncIteratorPrototype%': needsEval, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': EvalError, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': needsEval, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': Object, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': RangeError, + '%ReferenceError%': ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet +}; + +var doEval = function doEval(name) { + var value; + if (name === '%AsyncFunction%') { + value = getEvalledConstructor('async function () {}'); + } else if (name === '%GeneratorFunction%') { + value = getEvalledConstructor('function* () {}'); + } else if (name === '%AsyncGeneratorFunction%') { + value = getEvalledConstructor('async function* () {}'); + } else if (name === '%AsyncGenerator%') { + var fn = doEval('%AsyncGeneratorFunction%'); + if (fn) { + value = fn.prototype; + } + } else if (name === '%AsyncIteratorPrototype%') { + var gen = doEval('%AsyncGenerator%'); + if (gen) { + value = getProto(gen.prototype); + } + } + + INTRINSICS[name] = value; + + return value; +}; + +var LEGACY_ALIASES = { + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'] +}; + +var bind = require('function-bind'); +var hasOwn = require('has'); +var $concat = bind.call(Function.call, Array.prototype.concat); +var $spliceApply = bind.call(Function.apply, Array.prototype.splice); +var $replace = bind.call(Function.call, String.prototype.replace); +var $strSlice = bind.call(Function.call, String.prototype.slice); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === '%' && last !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); + } else if (last === '%' && first !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); + } + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ( + ( + (first === '"' || first === "'" || first === '`') + || (last === '"' || last === "'" || last === '`') + ) + && first !== last + ) { + throw new $SyntaxError('property names with quotes must have matching quotes'); + } + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + return void undefined; + } + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; + +},{"function-bind":10,"has":14,"has-symbols":12}],12:[function(require,module,exports){ +'use strict'; + +var origSymbol = typeof Symbol !== 'undefined' && Symbol; +var hasSymbolSham = require('./shams'); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; + +},{"./shams":13}],13:[function(require,module,exports){ +'use strict'; + +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; + +},{}],14:[function(require,module,exports){ +'use strict'; + +var bind = require('function-bind'); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); + +},{"function-bind":10}],15:[function(require,module,exports){ +var hasMap = typeof Map === 'function' && Map.prototype; +var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; +var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; +var mapForEach = hasMap && Map.prototype.forEach; +var hasSet = typeof Set === 'function' && Set.prototype; +var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; +var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; +var setForEach = hasSet && Set.prototype.forEach; +var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype; +var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; +var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype; +var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; +var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype; +var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; +var booleanValueOf = Boolean.prototype.valueOf; +var objectToString = Object.prototype.toString; +var functionToString = Function.prototype.toString; +var $match = String.prototype.match; +var $slice = String.prototype.slice; +var $replace = String.prototype.replace; +var $toUpperCase = String.prototype.toUpperCase; +var $toLowerCase = String.prototype.toLowerCase; +var $test = RegExp.prototype.test; +var $concat = Array.prototype.concat; +var $join = Array.prototype.join; +var $arrSlice = Array.prototype.slice; +var $floor = Math.floor; +var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null; +var gOPS = Object.getOwnPropertySymbols; +var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null; +var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object'; +// ie, `has-tostringtag/shams +var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') + ? Symbol.toStringTag + : null; +var isEnumerable = Object.prototype.propertyIsEnumerable; + +var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ( + [].__proto__ === Array.prototype // eslint-disable-line no-proto + ? function (O) { + return O.__proto__; // eslint-disable-line no-proto + } + : null +); + +function addNumericSeparator(num, str) { + if ( + num === Infinity + || num === -Infinity + || num !== num + || (num && num > -1000 && num < 1000) + || $test.call(/e/, str) + ) { + return str; + } + var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; + if (typeof num === 'number') { + var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num) + if (int !== num) { + var intStr = String(int); + var dec = $slice.call(str, intStr.length + 1); + return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, ''); + } + } + return $replace.call(str, sepRegex, '$&_'); +} + +var utilInspect = require('./util.inspect'); +var inspectCustom = utilInspect.custom; +var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; + +module.exports = function inspect_(obj, options, depth, seen) { + var opts = options || {}; + + if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) { + throw new TypeError('option "quoteStyle" must be "single" or "double"'); + } + if ( + has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' + ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity + : opts.maxStringLength !== null + ) + ) { + throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); + } + var customInspect = has(opts, 'customInspect') ? opts.customInspect : true; + if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') { + throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`'); + } + + if ( + has(opts, 'indent') + && opts.indent !== null + && opts.indent !== '\t' + && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0) + ) { + throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); + } + if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') { + throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); + } + var numericSeparator = opts.numericSeparator; + + if (typeof obj === 'undefined') { + return 'undefined'; + } + if (obj === null) { + return 'null'; + } + if (typeof obj === 'boolean') { + return obj ? 'true' : 'false'; + } + + if (typeof obj === 'string') { + return inspectString(obj, opts); + } + if (typeof obj === 'number') { + if (obj === 0) { + return Infinity / obj > 0 ? '0' : '-0'; + } + var str = String(obj); + return numericSeparator ? addNumericSeparator(obj, str) : str; + } + if (typeof obj === 'bigint') { + var bigIntStr = String(obj) + 'n'; + return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; + } + + var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; + if (typeof depth === 'undefined') { depth = 0; } + if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { + return isArray(obj) ? '[Array]' : '[Object]'; + } + + var indent = getIndent(opts, depth); + + if (typeof seen === 'undefined') { + seen = []; + } else if (indexOf(seen, obj) >= 0) { + return '[Circular]'; + } + + function inspect(value, from, noIndent) { + if (from) { + seen = $arrSlice.call(seen); + seen.push(from); + } + if (noIndent) { + var newOpts = { + depth: opts.depth + }; + if (has(opts, 'quoteStyle')) { + newOpts.quoteStyle = opts.quoteStyle; + } + return inspect_(value, newOpts, depth + 1, seen); + } + return inspect_(value, opts, depth + 1, seen); + } + + if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable + var name = nameOf(obj); + var keys = arrObjKeys(obj, inspect); + return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : ''); + } + if (isSymbol(obj)) { + var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj); + return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString; + } + if (isElement(obj)) { + var s = '<' + $toLowerCase.call(String(obj.nodeName)); + var attrs = obj.attributes || []; + for (var i = 0; i < attrs.length; i++) { + s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); + } + s += '>'; + if (obj.childNodes && obj.childNodes.length) { s += '...'; } + s += ''; + return s; + } + if (isArray(obj)) { + if (obj.length === 0) { return '[]'; } + var xs = arrObjKeys(obj, inspect); + if (indent && !singleLineValues(xs)) { + return '[' + indentedJoin(xs, indent) + ']'; + } + return '[ ' + $join.call(xs, ', ') + ' ]'; + } + if (isError(obj)) { + var parts = arrObjKeys(obj, inspect); + if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) { + return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }'; + } + if (parts.length === 0) { return '[' + String(obj) + ']'; } + return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }'; + } + if (typeof obj === 'object' && customInspect) { + if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) { + return utilInspect(obj, { depth: maxDepth - depth }); + } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') { + return obj.inspect(); + } + } + if (isMap(obj)) { + var mapParts = []; + mapForEach.call(obj, function (value, key) { + mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); + }); + return collectionOf('Map', mapSize.call(obj), mapParts, indent); + } + if (isSet(obj)) { + var setParts = []; + setForEach.call(obj, function (value) { + setParts.push(inspect(value, obj)); + }); + return collectionOf('Set', setSize.call(obj), setParts, indent); + } + if (isWeakMap(obj)) { + return weakCollectionOf('WeakMap'); + } + if (isWeakSet(obj)) { + return weakCollectionOf('WeakSet'); + } + if (isWeakRef(obj)) { + return weakCollectionOf('WeakRef'); + } + if (isNumber(obj)) { + return markBoxed(inspect(Number(obj))); + } + if (isBigInt(obj)) { + return markBoxed(inspect(bigIntValueOf.call(obj))); + } + if (isBoolean(obj)) { + return markBoxed(booleanValueOf.call(obj)); + } + if (isString(obj)) { + return markBoxed(inspect(String(obj))); + } + if (!isDate(obj) && !isRegExp(obj)) { + var ys = arrObjKeys(obj, inspect); + var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; + var protoTag = obj instanceof Object ? '' : 'null prototype'; + var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : ''; + var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : ''; + var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : ''); + if (ys.length === 0) { return tag + '{}'; } + if (indent) { + return tag + '{' + indentedJoin(ys, indent) + '}'; + } + return tag + '{ ' + $join.call(ys, ', ') + ' }'; + } + return String(obj); +}; + +function wrapQuotes(s, defaultStyle, opts) { + var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'"; + return quoteChar + s + quoteChar; +} + +function quote(s) { + return $replace.call(String(s), /"/g, '"'); +} + +function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } +function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); } + +// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives +function isSymbol(obj) { + if (hasShammedSymbols) { + return obj && typeof obj === 'object' && obj instanceof Symbol; + } + if (typeof obj === 'symbol') { + return true; + } + if (!obj || typeof obj !== 'object' || !symToString) { + return false; + } + try { + symToString.call(obj); + return true; + } catch (e) {} + return false; +} + +function isBigInt(obj) { + if (!obj || typeof obj !== 'object' || !bigIntValueOf) { + return false; + } + try { + bigIntValueOf.call(obj); + return true; + } catch (e) {} + return false; +} + +var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; }; +function has(obj, key) { + return hasOwn.call(obj, key); +} + +function toStr(obj) { + return objectToString.call(obj); +} + +function nameOf(f) { + if (f.name) { return f.name; } + var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); + if (m) { return m[1]; } + return null; +} + +function indexOf(xs, x) { + if (xs.indexOf) { return xs.indexOf(x); } + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) { return i; } + } + return -1; +} + +function isMap(x) { + if (!mapSize || !x || typeof x !== 'object') { + return false; + } + try { + mapSize.call(x); + try { + setSize.call(x); + } catch (s) { + return true; + } + return x instanceof Map; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakMap(x) { + if (!weakMapHas || !x || typeof x !== 'object') { + return false; + } + try { + weakMapHas.call(x, weakMapHas); + try { + weakSetHas.call(x, weakSetHas); + } catch (s) { + return true; + } + return x instanceof WeakMap; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakRef(x) { + if (!weakRefDeref || !x || typeof x !== 'object') { + return false; + } + try { + weakRefDeref.call(x); + return true; + } catch (e) {} + return false; +} + +function isSet(x) { + if (!setSize || !x || typeof x !== 'object') { + return false; + } + try { + setSize.call(x); + try { + mapSize.call(x); + } catch (m) { + return true; + } + return x instanceof Set; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isWeakSet(x) { + if (!weakSetHas || !x || typeof x !== 'object') { + return false; + } + try { + weakSetHas.call(x, weakSetHas); + try { + weakMapHas.call(x, weakMapHas); + } catch (s) { + return true; + } + return x instanceof WeakSet; // core-js workaround, pre-v2.5.0 + } catch (e) {} + return false; +} + +function isElement(x) { + if (!x || typeof x !== 'object') { return false; } + if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { + return true; + } + return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function'; +} + +function inspectString(str, opts) { + if (str.length > opts.maxStringLength) { + var remaining = str.length - opts.maxStringLength; + var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : ''); + return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; + } + // eslint-disable-next-line no-control-regex + var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte); + return wrapQuotes(s, 'single', opts); +} + +function lowbyte(c) { + var n = c.charCodeAt(0); + var x = { + 8: 'b', + 9: 't', + 10: 'n', + 12: 'f', + 13: 'r' + }[n]; + if (x) { return '\\' + x; } + return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16)); +} + +function markBoxed(str) { + return 'Object(' + str + ')'; +} + +function weakCollectionOf(type) { + return type + ' { ? }'; +} + +function collectionOf(type, size, entries, indent) { + var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', '); + return type + ' (' + size + ') {' + joinedEntries + '}'; +} + +function singleLineValues(xs) { + for (var i = 0; i < xs.length; i++) { + if (indexOf(xs[i], '\n') >= 0) { + return false; + } + } + return true; +} + +function getIndent(opts, depth) { + var baseIndent; + if (opts.indent === '\t') { + baseIndent = '\t'; + } else if (typeof opts.indent === 'number' && opts.indent > 0) { + baseIndent = $join.call(Array(opts.indent + 1), ' '); + } else { + return null; + } + return { + base: baseIndent, + prev: $join.call(Array(depth + 1), baseIndent) + }; +} + +function indentedJoin(xs, indent) { + if (xs.length === 0) { return ''; } + var lineJoiner = '\n' + indent.prev + indent.base; + return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev; +} + +function arrObjKeys(obj, inspect) { + var isArr = isArray(obj); + var xs = []; + if (isArr) { + xs.length = obj.length; + for (var i = 0; i < obj.length; i++) { + xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; + } + } + var syms = typeof gOPS === 'function' ? gOPS(obj) : []; + var symMap; + if (hasShammedSymbols) { + symMap = {}; + for (var k = 0; k < syms.length; k++) { + symMap['$' + syms[k]] = syms[k]; + } + } + + for (var key in obj) { // eslint-disable-line no-restricted-syntax + if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue + if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue + if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) { + // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section + continue; // eslint-disable-line no-restricted-syntax, no-continue + } else if ($test.call(/[^\w$]/, key)) { + xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); + } else { + xs.push(key + ': ' + inspect(obj[key], obj)); + } + } + if (typeof gOPS === 'function') { + for (var j = 0; j < syms.length; j++) { + if (isEnumerable.call(obj, syms[j])) { + xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj)); + } + } + } + return xs; +} + +},{"./util.inspect":6}],16:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); +var inspect = require('object-inspect'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $WeakMap = GetIntrinsic('%WeakMap%', true); +var $Map = GetIntrinsic('%Map%', true); + +var $weakMapGet = callBound('WeakMap.prototype.get', true); +var $weakMapSet = callBound('WeakMap.prototype.set', true); +var $weakMapHas = callBound('WeakMap.prototype.has', true); +var $mapGet = callBound('Map.prototype.get', true); +var $mapSet = callBound('Map.prototype.set', true); +var $mapHas = callBound('Map.prototype.has', true); + +/* + * This function traverses the list returning the node corresponding to the + * given key. + * + * That node is also moved to the head of the list, so that if it's accessed + * again we don't need to traverse the whole list. By doing so, all the recently + * used nodes can be accessed relatively quickly. + */ +var listGetNode = function (list, key) { // eslint-disable-line consistent-return + for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) { + if (curr.key === key) { + prev.next = curr.next; + curr.next = list.next; + list.next = curr; // eslint-disable-line no-param-reassign + return curr; + } + } +}; + +var listGet = function (objects, key) { + var node = listGetNode(objects, key); + return node && node.value; +}; +var listSet = function (objects, key, value) { + var node = listGetNode(objects, key); + if (node) { + node.value = value; + } else { + // Prepend the new node to the beginning of the list + objects.next = { // eslint-disable-line no-param-reassign + key: key, + next: objects.next, + value: value + }; + } +}; +var listHas = function (objects, key) { + return !!listGetNode(objects, key); +}; + +module.exports = function getSideChannel() { + var $wm; + var $m; + var $o; + var channel = { + assert: function (key) { + if (!channel.has(key)) { + throw new $TypeError('Side channel does not contain ' + inspect(key)); + } + }, + get: function (key) { // eslint-disable-line consistent-return + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapGet($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapGet($m, key); + } + } else { + if ($o) { // eslint-disable-line no-lonely-if + return listGet($o, key); + } + } + }, + has: function (key) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapHas($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapHas($m, key); + } + } else { + if ($o) { // eslint-disable-line no-lonely-if + return listHas($o, key); + } + } + return false; + }, + set: function (key, value) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if (!$wm) { + $wm = new $WeakMap(); + } + $weakMapSet($wm, key, value); + } else if ($Map) { + if (!$m) { + $m = new $Map(); + } + $mapSet($m, key, value); + } else { + if (!$o) { + /* + * Initialize the linked list as an empty node, so that we don't have + * to special-case handling of the first node: we can always refer to + * it as (previous node).next, instead of something like (list).head + */ + $o = { key: {}, next: null }; + } + listSet($o, key, value); + } + } + }; + return channel; +}; + +},{"call-bind/callBound":7,"get-intrinsic":11,"object-inspect":15}]},{},[2])(2) +}); diff --git a/graphql-subscription-express/node_modules/qs/lib/formats.js b/graphql-subscription-express/node_modules/qs/lib/formats.js new file mode 100644 index 0000000..f36cf20 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/lib/formats.js @@ -0,0 +1,23 @@ +'use strict'; + +var replace = String.prototype.replace; +var percentTwenties = /%20/g; + +var Format = { + RFC1738: 'RFC1738', + RFC3986: 'RFC3986' +}; + +module.exports = { + 'default': Format.RFC3986, + formatters: { + RFC1738: function (value) { + return replace.call(value, percentTwenties, '+'); + }, + RFC3986: function (value) { + return String(value); + } + }, + RFC1738: Format.RFC1738, + RFC3986: Format.RFC3986 +}; diff --git a/graphql-subscription-express/node_modules/qs/lib/index.js b/graphql-subscription-express/node_modules/qs/lib/index.js new file mode 100644 index 0000000..0d6a97d --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/lib/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var stringify = require('./stringify'); +var parse = require('./parse'); +var formats = require('./formats'); + +module.exports = { + formats: formats, + parse: parse, + stringify: stringify +}; diff --git a/graphql-subscription-express/node_modules/qs/lib/parse.js b/graphql-subscription-express/node_modules/qs/lib/parse.js new file mode 100644 index 0000000..a4ac4fa --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/lib/parse.js @@ -0,0 +1,263 @@ +'use strict'; + +var utils = require('./utils'); + +var has = Object.prototype.hasOwnProperty; +var isArray = Array.isArray; + +var defaults = { + allowDots: false, + allowPrototypes: false, + allowSparse: false, + arrayLimit: 20, + charset: 'utf-8', + charsetSentinel: false, + comma: false, + decoder: utils.decode, + delimiter: '&', + depth: 5, + ignoreQueryPrefix: false, + interpretNumericEntities: false, + parameterLimit: 1000, + parseArrays: true, + plainObjects: false, + strictNullHandling: false +}; + +var interpretNumericEntities = function (str) { + return str.replace(/&#(\d+);/g, function ($0, numberStr) { + return String.fromCharCode(parseInt(numberStr, 10)); + }); +}; + +var parseArrayValue = function (val, options) { + if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) { + return val.split(','); + } + + return val; +}; + +// This is what browsers will submit when the ✓ character occurs in an +// application/x-www-form-urlencoded body and the encoding of the page containing +// the form is iso-8859-1, or when the submitted form has an accept-charset +// attribute of iso-8859-1. Presumably also with other charsets that do not contain +// the ✓ character, such as us-ascii. +var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓') + +// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded. +var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') + +var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; + var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; + var parts = cleanStr.split(options.delimiter, limit); + var skipIndex = -1; // Keep track of where the utf8 sentinel was found + var i; + + var charset = options.charset; + if (options.charsetSentinel) { + for (i = 0; i < parts.length; ++i) { + if (parts[i].indexOf('utf8=') === 0) { + if (parts[i] === charsetSentinel) { + charset = 'utf-8'; + } else if (parts[i] === isoSentinel) { + charset = 'iso-8859-1'; + } + skipIndex = i; + i = parts.length; // The eslint settings do not allow break; + } + } + } + + for (i = 0; i < parts.length; ++i) { + if (i === skipIndex) { + continue; + } + var part = parts[i]; + + var bracketEqualsPos = part.indexOf(']='); + var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part, defaults.decoder, charset, 'key'); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); + val = utils.maybeMap( + parseArrayValue(part.slice(pos + 1), options), + function (encodedVal) { + return options.decoder(encodedVal, defaults.decoder, charset, 'value'); + } + ); + } + + if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { + val = interpretNumericEntities(val); + } + + if (part.indexOf('[]=') > -1) { + val = isArray(val) ? [val] : val; + } + + if (has.call(obj, key)) { + obj[key] = utils.combine(obj[key], val); + } else { + obj[key] = val; + } + } + + return obj; +}; + +var parseObject = function (chain, val, options, valuesParsed) { + var leaf = valuesParsed ? val : parseArrayValue(val, options); + + for (var i = chain.length - 1; i >= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]' && options.parseArrays) { + obj = [].concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if (!options.parseArrays && cleanRoot === '') { + obj = { 0: leaf }; + } else if ( + !isNaN(index) + && root !== cleanRoot + && String(index) === cleanRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else if (cleanRoot !== '__proto__') { + obj[cleanRoot] = leaf; + } + } + + leaf = obj; + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = options.depth > 0 && brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options, valuesParsed); +}; + +var normalizeParseOptions = function normalizeParseOptions(opts) { + if (!opts) { + return defaults; + } + + if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; + + return { + allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes, + allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse, + arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma, + decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder, + delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, + // eslint-disable-next-line no-implicit-coercion, no-extra-parens + depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth, + ignoreQueryPrefix: opts.ignoreQueryPrefix === true, + interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities, + parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit, + parseArrays: opts.parseArrays !== false, + plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling + }; +}; + +module.exports = function (str, opts) { + var options = normalizeParseOptions(opts); + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string'); + obj = utils.merge(obj, newObj, options); + } + + if (options.allowSparse === true) { + return obj; + } + + return utils.compact(obj); +}; diff --git a/graphql-subscription-express/node_modules/qs/lib/stringify.js b/graphql-subscription-express/node_modules/qs/lib/stringify.js new file mode 100644 index 0000000..48ec030 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/lib/stringify.js @@ -0,0 +1,326 @@ +'use strict'; + +var getSideChannel = require('side-channel'); +var utils = require('./utils'); +var formats = require('./formats'); +var has = Object.prototype.hasOwnProperty; + +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { + return prefix + '[]'; + }, + comma: 'comma', + indices: function indices(prefix, key) { + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { + return prefix; + } +}; + +var isArray = Array.isArray; +var split = String.prototype.split; +var push = Array.prototype.push; +var pushToArray = function (arr, valueOrArray) { + push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); +}; + +var toISO = Date.prototype.toISOString; + +var defaultFormat = formats['default']; +var defaults = { + addQueryPrefix: false, + allowDots: false, + charset: 'utf-8', + charsetSentinel: false, + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + format: defaultFormat, + formatter: formats.formatters[defaultFormat], + // deprecated + indices: false, + serializeDate: function serializeDate(date) { + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var isNonNullishPrimitive = function isNonNullishPrimitive(v) { + return typeof v === 'string' + || typeof v === 'number' + || typeof v === 'boolean' + || typeof v === 'symbol' + || typeof v === 'bigint'; +}; + +var sentinel = {}; + +var stringify = function stringify( + object, + prefix, + generateArrayPrefix, + commaRoundTrip, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + sideChannel +) { + var obj = object; + + var tmpSc = sideChannel; + var step = 0; + var findFlag = false; + while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) { + // Where object last appeared in the ref tree + var pos = tmpSc.get(object); + step += 1; + if (typeof pos !== 'undefined') { + if (pos === step) { + throw new RangeError('Cyclic object value'); + } else { + findFlag = true; // Break while + } + } + if (typeof tmpSc.get(sentinel) === 'undefined') { + step = 0; + } + } + + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (generateArrayPrefix === 'comma' && isArray(obj)) { + obj = utils.maybeMap(obj, function (value) { + if (value instanceof Date) { + return serializeDate(value); + } + return value; + }); + } + + if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix; + } + + obj = ''; + } + + if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format); + if (generateArrayPrefix === 'comma' && encodeValuesOnly) { + var valuesArray = split.call(String(obj), ','); + var valuesJoined = ''; + for (var i = 0; i < valuesArray.length; ++i) { + valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format)); + } + return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined]; + } + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (generateArrayPrefix === 'comma' && isArray(obj)) { + // we need to join elements in + objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }]; + } else if (isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix; + + for (var j = 0; j < objKeys.length; ++j) { + var key = objKeys[j]; + var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key]; + + if (skipNulls && value === null) { + continue; + } + + var keyPrefix = isArray(obj) + ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix + : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']'); + + sideChannel.set(object, step); + var valueSideChannel = getSideChannel(); + valueSideChannel.set(sentinel, sideChannel); + pushToArray(values, stringify( + value, + keyPrefix, + generateArrayPrefix, + commaRoundTrip, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + valueSideChannel + )); + } + + return values; +}; + +var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { + if (!opts) { + return defaults; + } + + if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var charset = opts.charset || defaults.charset; + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + + var format = formats['default']; + if (typeof opts.format !== 'undefined') { + if (!has.call(formats.formatters, opts.format)) { + throw new TypeError('Unknown format option provided.'); + } + format = opts.format; + } + var formatter = formats.formatters[format]; + + var filter = defaults.filter; + if (typeof opts.filter === 'function' || isArray(opts.filter)) { + filter = opts.filter; + } + + return { + addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, + allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, + encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, + encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, + encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, + filter: filter, + format: format, + formatter: formatter, + serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, + skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, + sort: typeof opts.sort === 'function' ? opts.sort : null, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling + }; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = normalizeStringifyOptions(opts); + + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (opts && opts.arrayFormat in arrayPrefixGenerators) { + arrayFormat = opts.arrayFormat; + } else if (opts && 'indices' in opts) { + arrayFormat = opts.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') { + throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); + } + var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (options.sort) { + objKeys.sort(options.sort); + } + + var sideChannel = getSideChannel(); + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (options.skipNulls && obj[key] === null) { + continue; + } + pushToArray(keys, stringify( + obj[key], + key, + generateArrayPrefix, + commaRoundTrip, + options.strictNullHandling, + options.skipNulls, + options.encode ? options.encoder : null, + options.filter, + options.sort, + options.allowDots, + options.serializeDate, + options.format, + options.formatter, + options.encodeValuesOnly, + options.charset, + sideChannel + )); + } + + var joined = keys.join(options.delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + if (options.charsetSentinel) { + if (options.charset === 'iso-8859-1') { + // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark + prefix += 'utf8=%26%2310003%3B&'; + } else { + // encodeURIComponent('✓') + prefix += 'utf8=%E2%9C%93&'; + } + } + + return joined.length > 0 ? prefix + joined : ''; +}; diff --git a/graphql-subscription-express/node_modules/qs/lib/utils.js b/graphql-subscription-express/node_modules/qs/lib/utils.js new file mode 100644 index 0000000..1e54538 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/lib/utils.js @@ -0,0 +1,252 @@ +'use strict'; + +var formats = require('./formats'); + +var has = Object.prototype.hasOwnProperty; +var isArray = Array.isArray; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + while (queue.length > 1) { + var item = queue.pop(); + var obj = item.obj[item.prop]; + + if (isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } +}; + +var arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +var merge = function merge(target, source, options) { + /* eslint no-param-reassign: 0 */ + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (isArray(target)) { + target.push(source); + } else if (target && typeof target === 'object') { + if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (!target || typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (isArray(target) && !isArray(source)) { + mergeTarget = arrayToObject(target, options); + } + + if (isArray(target) && isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + var targetItem = target[i]; + if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { + target[i] = merge(targetItem, item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +var assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +var decode = function (str, decoder, charset) { + var strWithoutPlus = str.replace(/\+/g, ' '); + if (charset === 'iso-8859-1') { + // unescape never throws, no try...catch needed: + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); + } + // utf-8 + try { + return decodeURIComponent(strWithoutPlus); + } catch (e) { + return strWithoutPlus; + } +}; + +var encode = function encode(str, defaultEncoder, charset, kind, format) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = str; + if (typeof str === 'symbol') { + string = Symbol.prototype.toString.call(str); + } else if (typeof str !== 'string') { + string = String(str); + } + + if (charset === 'iso-8859-1') { + return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { + return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; + }); + } + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( ) + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + /* eslint operator-linebreak: [2, "before"] */ + out += hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + return out; +}; + +var compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + compactQueue(queue); + + return value; +}; + +var isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +var isBuffer = function isBuffer(obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; + +var combine = function combine(a, b) { + return [].concat(a, b); +}; + +var maybeMap = function maybeMap(val, fn) { + if (isArray(val)) { + var mapped = []; + for (var i = 0; i < val.length; i += 1) { + mapped.push(fn(val[i])); + } + return mapped; + } + return fn(val); +}; + +module.exports = { + arrayToObject: arrayToObject, + assign: assign, + combine: combine, + compact: compact, + decode: decode, + encode: encode, + isBuffer: isBuffer, + isRegExp: isRegExp, + maybeMap: maybeMap, + merge: merge +}; diff --git a/graphql-subscription-express/node_modules/qs/package.json b/graphql-subscription-express/node_modules/qs/package.json new file mode 100644 index 0000000..2ff42f3 --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/package.json @@ -0,0 +1,77 @@ +{ + "name": "qs", + "description": "A querystring parser that supports nesting and arrays, with a depth limit", + "homepage": "https://github.com/ljharb/qs", + "version": "6.11.0", + "repository": { + "type": "git", + "url": "https://github.com/ljharb/qs.git" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "main": "lib/index.js", + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "keywords": [ + "querystring", + "qs", + "query", + "url", + "parse", + "stringify" + ], + "engines": { + "node": ">=0.6" + }, + "dependencies": { + "side-channel": "^1.0.4" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "browserify": "^16.5.2", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "has-symbols": "^1.0.3", + "iconv-lite": "^0.5.1", + "in-publish": "^2.0.1", + "mkdirp": "^0.5.5", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "object-inspect": "^1.12.2", + "qs-iconv": "^1.0.4", + "safe-publish-latest": "^2.0.0", + "safer-buffer": "^2.1.2", + "tape": "^5.5.3" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest && npm run dist", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run --silent readme && npm run --silent lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "aud --production", + "readme": "evalmd README.md", + "postlint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)", + "lint": "eslint --ext=js,mjs .", + "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js" + }, + "license": "BSD-3-Clause", + "publishConfig": { + "ignore": [ + "!dist/*", + "bower.json", + "component.json", + ".github/workflows" + ] + } +} diff --git a/graphql-subscription-express/node_modules/qs/test/parse.js b/graphql-subscription-express/node_modules/qs/test/parse.js new file mode 100644 index 0000000..7d7b4dd --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/test/parse.js @@ -0,0 +1,855 @@ +'use strict'; + +var test = require('tape'); +var qs = require('../'); +var utils = require('../lib/utils'); +var iconv = require('iconv-lite'); +var SaferBuffer = require('safer-buffer').Buffer; + +test('parse()', function (t) { + t.test('parses a simple string', function (st) { + st.deepEqual(qs.parse('0=foo'), { 0: 'foo' }); + st.deepEqual(qs.parse('foo=c++'), { foo: 'c ' }); + st.deepEqual(qs.parse('a[>=]=23'), { a: { '>=': '23' } }); + st.deepEqual(qs.parse('a[<=>]==23'), { a: { '<=>': '=23' } }); + st.deepEqual(qs.parse('a[==]=23'), { a: { '==': '23' } }); + st.deepEqual(qs.parse('foo', { strictNullHandling: true }), { foo: null }); + st.deepEqual(qs.parse('foo'), { foo: '' }); + st.deepEqual(qs.parse('foo='), { foo: '' }); + st.deepEqual(qs.parse('foo=bar'), { foo: 'bar' }); + st.deepEqual(qs.parse(' foo = bar = baz '), { ' foo ': ' bar = baz ' }); + st.deepEqual(qs.parse('foo=bar=baz'), { foo: 'bar=baz' }); + st.deepEqual(qs.parse('foo=bar&bar=baz'), { foo: 'bar', bar: 'baz' }); + st.deepEqual(qs.parse('foo2=bar2&baz2='), { foo2: 'bar2', baz2: '' }); + st.deepEqual(qs.parse('foo=bar&baz', { strictNullHandling: true }), { foo: 'bar', baz: null }); + st.deepEqual(qs.parse('foo=bar&baz'), { foo: 'bar', baz: '' }); + st.deepEqual(qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World'), { + cht: 'p3', + chd: 't:60,40', + chs: '250x100', + chl: 'Hello|World' + }); + st.end(); + }); + + t.test('arrayFormat: brackets allows only explicit arrays', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=c', { arrayFormat: 'brackets' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayFormat: 'brackets' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b,c', { arrayFormat: 'brackets' }), { a: 'b,c' }); + st.deepEqual(qs.parse('a=b&a=c', { arrayFormat: 'brackets' }), { a: ['b', 'c'] }); + st.end(); + }); + + t.test('arrayFormat: indices allows only indexed arrays', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=c', { arrayFormat: 'indices' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayFormat: 'indices' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b,c', { arrayFormat: 'indices' }), { a: 'b,c' }); + st.deepEqual(qs.parse('a=b&a=c', { arrayFormat: 'indices' }), { a: ['b', 'c'] }); + st.end(); + }); + + t.test('arrayFormat: comma allows only comma-separated arrays', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=c', { arrayFormat: 'comma' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayFormat: 'comma' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b,c', { arrayFormat: 'comma' }), { a: 'b,c' }); + st.deepEqual(qs.parse('a=b&a=c', { arrayFormat: 'comma' }), { a: ['b', 'c'] }); + st.end(); + }); + + t.test('arrayFormat: repeat allows only repeated values', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=c', { arrayFormat: 'repeat' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayFormat: 'repeat' }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b,c', { arrayFormat: 'repeat' }), { a: 'b,c' }); + st.deepEqual(qs.parse('a=b&a=c', { arrayFormat: 'repeat' }), { a: ['b', 'c'] }); + st.end(); + }); + + t.test('allows enabling dot notation', function (st) { + st.deepEqual(qs.parse('a.b=c'), { 'a.b': 'c' }); + st.deepEqual(qs.parse('a.b=c', { allowDots: true }), { a: { b: 'c' } }); + st.end(); + }); + + t.deepEqual(qs.parse('a[b]=c'), { a: { b: 'c' } }, 'parses a single nested string'); + t.deepEqual(qs.parse('a[b][c]=d'), { a: { b: { c: 'd' } } }, 'parses a double nested string'); + t.deepEqual( + qs.parse('a[b][c][d][e][f][g][h]=i'), + { a: { b: { c: { d: { e: { f: { '[g][h]': 'i' } } } } } } }, + 'defaults to a depth of 5' + ); + + t.test('only parses one level when depth = 1', function (st) { + st.deepEqual(qs.parse('a[b][c]=d', { depth: 1 }), { a: { b: { '[c]': 'd' } } }); + st.deepEqual(qs.parse('a[b][c][d]=e', { depth: 1 }), { a: { b: { '[c][d]': 'e' } } }); + st.end(); + }); + + t.test('uses original key when depth = 0', function (st) { + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { depth: 0 }), { 'a[0]': 'b', 'a[1]': 'c' }); + st.deepEqual(qs.parse('a[0][0]=b&a[0][1]=c&a[1]=d&e=2', { depth: 0 }), { 'a[0][0]': 'b', 'a[0][1]': 'c', 'a[1]': 'd', e: '2' }); + st.end(); + }); + + t.test('uses original key when depth = false', function (st) { + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { depth: false }), { 'a[0]': 'b', 'a[1]': 'c' }); + st.deepEqual(qs.parse('a[0][0]=b&a[0][1]=c&a[1]=d&e=2', { depth: false }), { 'a[0][0]': 'b', 'a[0][1]': 'c', 'a[1]': 'd', e: '2' }); + st.end(); + }); + + t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array'); + + t.test('parses an explicit array', function (st) { + st.deepEqual(qs.parse('a[]=b'), { a: ['b'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c&a[]=d'), { a: ['b', 'c', 'd'] }); + st.end(); + }); + + t.test('parses a mix of simple and explicit arrays', function (st) { + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[0]=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a[1]=b&a=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a=b&a[1]=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + + st.end(); + }); + + t.test('parses a nested array', function (st) { + st.deepEqual(qs.parse('a[b][]=c&a[b][]=d'), { a: { b: ['c', 'd'] } }); + st.deepEqual(qs.parse('a[>=]=25'), { a: { '>=': '25' } }); + st.end(); + }); + + t.test('allows to specify array indices', function (st) { + st.deepEqual(qs.parse('a[1]=c&a[0]=b&a[2]=d'), { a: ['b', 'c', 'd'] }); + st.deepEqual(qs.parse('a[1]=c&a[0]=b'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 20 }), { a: ['c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 0 }), { a: { 1: 'c' } }); + st.deepEqual(qs.parse('a[1]=c'), { a: ['c'] }); + st.end(); + }); + + t.test('limits specific array indices to arrayLimit', function (st) { + st.deepEqual(qs.parse('a[20]=a', { arrayLimit: 20 }), { a: ['a'] }); + st.deepEqual(qs.parse('a[21]=a', { arrayLimit: 20 }), { a: { 21: 'a' } }); + + st.deepEqual(qs.parse('a[20]=a'), { a: ['a'] }); + st.deepEqual(qs.parse('a[21]=a'), { a: { 21: 'a' } }); + st.end(); + }); + + t.deepEqual(qs.parse('a[12b]=c'), { a: { '12b': 'c' } }, 'supports keys that begin with a number'); + + t.test('supports encoded = signs', function (st) { + st.deepEqual(qs.parse('he%3Dllo=th%3Dere'), { 'he=llo': 'th=ere' }); + st.end(); + }); + + t.test('is ok with url encoded strings', function (st) { + st.deepEqual(qs.parse('a[b%20c]=d'), { a: { 'b c': 'd' } }); + st.deepEqual(qs.parse('a[b]=c%20d'), { a: { b: 'c d' } }); + st.end(); + }); + + t.test('allows brackets in the value', function (st) { + st.deepEqual(qs.parse('pets=["tobi"]'), { pets: '["tobi"]' }); + st.deepEqual(qs.parse('operators=[">=", "<="]'), { operators: '[">=", "<="]' }); + st.end(); + }); + + t.test('allows empty values', function (st) { + st.deepEqual(qs.parse(''), {}); + st.deepEqual(qs.parse(null), {}); + st.deepEqual(qs.parse(undefined), {}); + st.end(); + }); + + t.test('transforms arrays to objects', function (st) { + st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { 0: 'b', t: 'u' } }); + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: true }), { a: { 0: 'b', t: 'u', hasOwnProperty: 'c' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { 0: 'b', x: 'y' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: true }), { a: { 0: 'b', hasOwnProperty: 'c', x: 'y' } }); + st.end(); + }); + + t.test('transforms arrays to objects (dot notation)', function (st) { + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad.boo=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: { boo: 'baz' } } }); + st.deepEqual(qs.parse('foo[0][0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [[{ baz: 'bar' }]], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15'], bar: '2' }] }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].baz[1]=16&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15', '16'], bar: '2' }] }); + st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0].a=a&foo[0].b=b&foo[1].a=aa&foo[1].b=bb', { allowDots: true }), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + st.end(); + }); + + t.test('correctly prunes undefined values when converting an array to an object', function (st) { + st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { 2: 'b', 99999999: 'c' } }); + st.end(); + }); + + t.test('supports malformed uri characters', function (st) { + st.deepEqual(qs.parse('{%:%}', { strictNullHandling: true }), { '{%:%}': null }); + st.deepEqual(qs.parse('{%:%}='), { '{%:%}': '' }); + st.deepEqual(qs.parse('foo=%:%}'), { foo: '%:%}' }); + st.end(); + }); + + t.test('doesn\'t produce empty keys', function (st) { + st.deepEqual(qs.parse('_r=1&'), { _r: '1' }); + st.end(); + }); + + t.test('cannot access Object prototype', function (st) { + qs.parse('constructor[prototype][bad]=bad'); + qs.parse('bad[constructor][prototype][bad]=bad'); + st.equal(typeof Object.prototype.bad, 'undefined'); + st.end(); + }); + + t.test('parses arrays of objects', function (st) { + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + st.deepEqual(qs.parse('a[0][b]=c'), { a: [{ b: 'c' }] }); + st.end(); + }); + + t.test('allows for empty strings in arrays', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=&a[]=c'), { a: ['b', '', 'c'] }); + + st.deepEqual( + qs.parse('a[0]=b&a[1]&a[2]=c&a[19]=', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 20 + array indices: null then empty string works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]&a[]=c&a[]=', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 0 + array brackets: null then empty string works' + ); + + st.deepEqual( + qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 20 + array indices: empty string then null works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]=&a[]=c&a[]', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 0 + array brackets: empty string then null works' + ); + + st.deepEqual( + qs.parse('a[]=&a[]=b&a[]=c'), + { a: ['', 'b', 'c'] }, + 'array brackets: empty strings work' + ); + st.end(); + }); + + t.test('compacts sparse arrays', function (st) { + st.deepEqual(qs.parse('a[10]=1&a[2]=2', { arrayLimit: 20 }), { a: ['2', '1'] }); + st.deepEqual(qs.parse('a[1][b][2][c]=1', { arrayLimit: 20 }), { a: [{ b: [{ c: '1' }] }] }); + st.deepEqual(qs.parse('a[1][2][3][c]=1', { arrayLimit: 20 }), { a: [[[{ c: '1' }]]] }); + st.deepEqual(qs.parse('a[1][2][3][c][1]=1', { arrayLimit: 20 }), { a: [[[{ c: ['1'] }]]] }); + st.end(); + }); + + t.test('parses sparse arrays', function (st) { + /* eslint no-sparse-arrays: 0 */ + st.deepEqual(qs.parse('a[4]=1&a[1]=2', { allowSparse: true }), { a: [, '2', , , '1'] }); + st.deepEqual(qs.parse('a[1][b][2][c]=1', { allowSparse: true }), { a: [, { b: [, , { c: '1' }] }] }); + st.deepEqual(qs.parse('a[1][2][3][c]=1', { allowSparse: true }), { a: [, [, , [, , , { c: '1' }]]] }); + st.deepEqual(qs.parse('a[1][2][3][c][1]=1', { allowSparse: true }), { a: [, [, , [, , , { c: [, '1'] }]]] }); + st.end(); + }); + + t.test('parses semi-parsed strings', function (st) { + st.deepEqual(qs.parse({ 'a[b]': 'c' }), { a: { b: 'c' } }); + st.deepEqual(qs.parse({ 'a[b]': 'c', 'a[d]': 'e' }), { a: { b: 'c', d: 'e' } }); + st.end(); + }); + + t.test('parses buffers correctly', function (st) { + var b = SaferBuffer.from('test'); + st.deepEqual(qs.parse({ a: b }), { a: b }); + st.end(); + }); + + t.test('parses jquery-param strings', function (st) { + // readable = 'filter[0][]=int1&filter[0][]==&filter[0][]=77&filter[]=and&filter[2][]=int2&filter[2][]==&filter[2][]=8' + var encoded = 'filter%5B0%5D%5B%5D=int1&filter%5B0%5D%5B%5D=%3D&filter%5B0%5D%5B%5D=77&filter%5B%5D=and&filter%5B2%5D%5B%5D=int2&filter%5B2%5D%5B%5D=%3D&filter%5B2%5D%5B%5D=8'; + var expected = { filter: [['int1', '=', '77'], 'and', ['int2', '=', '8']] }; + st.deepEqual(qs.parse(encoded), expected); + st.end(); + }); + + t.test('continues parsing when no parent is found', function (st) { + st.deepEqual(qs.parse('[]=&a=b'), { 0: '', a: 'b' }); + st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { 0: null, a: 'b' }); + st.deepEqual(qs.parse('[foo]=bar'), { foo: 'bar' }); + st.end(); + }); + + t.test('does not error when parsing a very long array', function (st) { + var str = 'a[]=a'; + while (Buffer.byteLength(str) < 128 * 1024) { + str = str + '&' + str; + } + + st.doesNotThrow(function () { + qs.parse(str); + }); + + st.end(); + }); + + t.test('should not throw when a native prototype has an enumerable property', function (st) { + Object.prototype.crash = ''; + Array.prototype.crash = ''; + st.doesNotThrow(qs.parse.bind(null, 'a=b')); + st.deepEqual(qs.parse('a=b'), { a: 'b' }); + st.doesNotThrow(qs.parse.bind(null, 'a[][b]=c')); + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + delete Object.prototype.crash; + delete Array.prototype.crash; + st.end(); + }); + + t.test('parses a string with an alternative string delimiter', function (st) { + st.deepEqual(qs.parse('a=b;c=d', { delimiter: ';' }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('parses a string with an alternative RegExp delimiter', function (st) { + st.deepEqual(qs.parse('a=b; c=d', { delimiter: /[;,] */ }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not use non-splittable objects as delimiters', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { delimiter: true }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding parameter limit', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: 1 }), { a: 'b' }); + st.end(); + }); + + t.test('allows setting the parameter limit to Infinity', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: Infinity }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding array limit', function (st) { + st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { 0: 'b' } }); + st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { 0: 'b', 1: 'c' } }); + st.end(); + }); + + t.test('allows disabling array parsing', function (st) { + var indices = qs.parse('a[0]=b&a[1]=c', { parseArrays: false }); + st.deepEqual(indices, { a: { 0: 'b', 1: 'c' } }); + st.equal(Array.isArray(indices.a), false, 'parseArrays:false, indices case is not an array'); + + var emptyBrackets = qs.parse('a[]=b', { parseArrays: false }); + st.deepEqual(emptyBrackets, { a: { 0: 'b' } }); + st.equal(Array.isArray(emptyBrackets.a), false, 'parseArrays:false, empty brackets case is not an array'); + + st.end(); + }); + + t.test('allows for query string prefix', function (st) { + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: false }), { '?foo': 'bar' }); + + st.end(); + }); + + t.test('parses an object', function (st) { + var input = { + 'user[name]': { 'pop[bob]': 3 }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses string with comma as array divider', function (st) { + st.deepEqual(qs.parse('foo=bar,tee', { comma: true }), { foo: ['bar', 'tee'] }); + st.deepEqual(qs.parse('foo[bar]=coffee,tee', { comma: true }), { foo: { bar: ['coffee', 'tee'] } }); + st.deepEqual(qs.parse('foo=', { comma: true }), { foo: '' }); + st.deepEqual(qs.parse('foo', { comma: true }), { foo: '' }); + st.deepEqual(qs.parse('foo', { comma: true, strictNullHandling: true }), { foo: null }); + + // test cases inversed from from stringify tests + st.deepEqual(qs.parse('a[0]=c'), { a: ['c'] }); + st.deepEqual(qs.parse('a[]=c'), { a: ['c'] }); + st.deepEqual(qs.parse('a[]=c', { comma: true }), { a: ['c'] }); + + st.deepEqual(qs.parse('a[0]=c&a[1]=d'), { a: ['c', 'd'] }); + st.deepEqual(qs.parse('a[]=c&a[]=d'), { a: ['c', 'd'] }); + st.deepEqual(qs.parse('a=c,d', { comma: true }), { a: ['c', 'd'] }); + + st.end(); + }); + + t.test('parses values with comma as array divider', function (st) { + st.deepEqual(qs.parse({ foo: 'bar,tee' }, { comma: false }), { foo: 'bar,tee' }); + st.deepEqual(qs.parse({ foo: 'bar,tee' }, { comma: true }), { foo: ['bar', 'tee'] }); + st.end(); + }); + + t.test('use number decoder, parses string that has one number with comma option enabled', function (st) { + var decoder = function (str, defaultDecoder, charset, type) { + if (!isNaN(Number(str))) { + return parseFloat(str); + } + return defaultDecoder(str, defaultDecoder, charset, type); + }; + + st.deepEqual(qs.parse('foo=1', { comma: true, decoder: decoder }), { foo: 1 }); + st.deepEqual(qs.parse('foo=0', { comma: true, decoder: decoder }), { foo: 0 }); + + st.end(); + }); + + t.test('parses brackets holds array of arrays when having two parts of strings with comma as array divider', function (st) { + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=4,5,6', { comma: true }), { foo: [['1', '2', '3'], ['4', '5', '6']] }); + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=', { comma: true }), { foo: [['1', '2', '3'], ''] }); + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=,', { comma: true }), { foo: [['1', '2', '3'], ['', '']] }); + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=a', { comma: true }), { foo: [['1', '2', '3'], 'a'] }); + + st.end(); + }); + + t.test('parses comma delimited array while having percent-encoded comma treated as normal text', function (st) { + st.deepEqual(qs.parse('foo=a%2Cb', { comma: true }), { foo: 'a,b' }); + st.deepEqual(qs.parse('foo=a%2C%20b,d', { comma: true }), { foo: ['a, b', 'd'] }); + st.deepEqual(qs.parse('foo=a%2C%20b,c%2C%20d', { comma: true }), { foo: ['a, b', 'c, d'] }); + + st.end(); + }); + + t.test('parses an object in dot notation', function (st) { + var input = { + 'user.name': { 'pop[bob]': 3 }, + 'user.email.': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input, { allowDots: true }); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses an object and not child values', function (st) { + var input = { + 'user[name]': { 'pop[bob]': { test: 3 } }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': { test: 3 } }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('does not blow up when Buffer global is missing', function (st) { + var tempBuffer = global.Buffer; + delete global.Buffer; + var result = qs.parse('a=b&c=d'); + global.Buffer = tempBuffer; + st.deepEqual(result, { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not crash when parsing circular references', function (st) { + var a = {}; + a.b = a; + + var parsed; + + st.doesNotThrow(function () { + parsed = qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + st.equal('bar' in parsed.foo, true); + st.equal('baz' in parsed.foo, true); + st.equal(parsed.foo.bar, 'baz'); + st.deepEqual(parsed.foo.baz, a); + st.end(); + }); + + t.test('does not crash when parsing deep objects', function (st) { + var parsed; + var str = 'foo'; + + for (var i = 0; i < 5000; i++) { + str += '[p]'; + } + + str += '=bar'; + + st.doesNotThrow(function () { + parsed = qs.parse(str, { depth: 5000 }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + + var depth = 0; + var ref = parsed.foo; + while ((ref = ref.p)) { + depth += 1; + } + + st.equal(depth, 5000, 'parsed is 5000 properties deep'); + + st.end(); + }); + + t.test('parses null objects correctly', { skip: !Object.create }, function (st) { + var a = Object.create(null); + a.b = 'c'; + + st.deepEqual(qs.parse(a), { b: 'c' }); + var result = qs.parse({ a: a }); + st.equal('a' in result, true, 'result has "a" property'); + st.deepEqual(result.a, a); + st.end(); + }); + + t.test('parses dates correctly', function (st) { + var now = new Date(); + st.deepEqual(qs.parse({ a: now }), { a: now }); + st.end(); + }); + + t.test('parses regular expressions correctly', function (st) { + var re = /^test$/; + st.deepEqual(qs.parse({ a: re }), { a: re }); + st.end(); + }); + + t.test('does not allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: false }), {}); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: false }), {}); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: false }), + {}, + 'bare "toString" results in {}' + ); + + st.end(); + }); + + t.test('can allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } }); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' }); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: true }), + { toString: '' }, + 'bare "toString" results in { toString: "" }' + ); + + st.end(); + }); + + t.test('params starting with a closing bracket', function (st) { + st.deepEqual(qs.parse(']=toString'), { ']': 'toString' }); + st.deepEqual(qs.parse(']]=toString'), { ']]': 'toString' }); + st.deepEqual(qs.parse(']hello]=toString'), { ']hello]': 'toString' }); + st.end(); + }); + + t.test('params starting with a starting bracket', function (st) { + st.deepEqual(qs.parse('[=toString'), { '[': 'toString' }); + st.deepEqual(qs.parse('[[=toString'), { '[[': 'toString' }); + st.deepEqual(qs.parse('[hello[=toString'), { '[hello[': 'toString' }); + st.end(); + }); + + t.test('add keys to objects', function (st) { + st.deepEqual( + qs.parse('a[b]=c&a=d'), + { a: { b: 'c', d: true } }, + 'can add keys to objects' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString'), + { a: { b: 'c' } }, + 'can not overwrite prototype' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { allowPrototypes: true }), + { a: { b: 'c', toString: true } }, + 'can overwrite prototype with allowPrototypes true' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { plainObjects: true }), + { __proto__: null, a: { __proto__: null, b: 'c', toString: true } }, + 'can overwrite prototype with plainObjects true' + ); + + st.end(); + }); + + t.test('dunder proto is ignored', function (st) { + var payload = 'categories[__proto__]=login&categories[__proto__]&categories[length]=42'; + var result = qs.parse(payload, { allowPrototypes: true }); + + st.deepEqual( + result, + { + categories: { + length: '42' + } + }, + 'silent [[Prototype]] payload' + ); + + var plainResult = qs.parse(payload, { allowPrototypes: true, plainObjects: true }); + + st.deepEqual( + plainResult, + { + __proto__: null, + categories: { + __proto__: null, + length: '42' + } + }, + 'silent [[Prototype]] payload: plain objects' + ); + + var query = qs.parse('categories[__proto__]=cats&categories[__proto__]=dogs&categories[some][json]=toInject', { allowPrototypes: true }); + + st.notOk(Array.isArray(query.categories), 'is not an array'); + st.notOk(query.categories instanceof Array, 'is not instanceof an array'); + st.deepEqual(query.categories, { some: { json: 'toInject' } }); + st.equal(JSON.stringify(query.categories), '{"some":{"json":"toInject"}}', 'stringifies as a non-array'); + + st.deepEqual( + qs.parse('foo[__proto__][hidden]=value&foo[bar]=stuffs', { allowPrototypes: true }), + { + foo: { + bar: 'stuffs' + } + }, + 'hidden values' + ); + + st.deepEqual( + qs.parse('foo[__proto__][hidden]=value&foo[bar]=stuffs', { allowPrototypes: true, plainObjects: true }), + { + __proto__: null, + foo: { + __proto__: null, + bar: 'stuffs' + } + }, + 'hidden values: plain objects' + ); + + st.end(); + }); + + t.test('can return null objects', { skip: !Object.create }, function (st) { + var expected = Object.create(null); + expected.a = Object.create(null); + expected.a.b = 'c'; + expected.a.hasOwnProperty = 'd'; + st.deepEqual(qs.parse('a[b]=c&a[hasOwnProperty]=d', { plainObjects: true }), expected); + st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null)); + var expectedArray = Object.create(null); + expectedArray.a = Object.create(null); + expectedArray.a[0] = 'b'; + expectedArray.a.c = 'd'; + st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray); + st.end(); + }); + + t.test('can parse with custom encoding', function (st) { + st.deepEqual(qs.parse('%8c%a7=%91%e5%8d%e3%95%7b', { + decoder: function (str) { + var reg = /%([0-9A-F]{2})/ig; + var result = []; + var parts = reg.exec(str); + while (parts) { + result.push(parseInt(parts[1], 16)); + parts = reg.exec(str); + } + return String(iconv.decode(SaferBuffer.from(result), 'shift_jis')); + } + }), { 県: '大阪府' }); + st.end(); + }); + + t.test('receives the default decoder as a second argument', function (st) { + st.plan(1); + qs.parse('a', { + decoder: function (str, defaultDecoder) { + st.equal(defaultDecoder, utils.decode); + } + }); + st.end(); + }); + + t.test('throws error with wrong decoder', function (st) { + st['throws'](function () { + qs.parse({}, { decoder: 'string' }); + }, new TypeError('Decoder has to be a function.')); + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.parse('a[b]=true', options); + st.deepEqual(options, {}); + st.end(); + }); + + t.test('throws if an invalid charset is specified', function (st) { + st['throws'](function () { + qs.parse('a=b', { charset: 'foobar' }); + }, new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined')); + st.end(); + }); + + t.test('parses an iso-8859-1 string if asked to', function (st) { + st.deepEqual(qs.parse('%A2=%BD', { charset: 'iso-8859-1' }), { '¢': '½' }); + st.end(); + }); + + var urlEncodedCheckmarkInUtf8 = '%E2%9C%93'; + var urlEncodedOSlashInUtf8 = '%C3%B8'; + var urlEncodedNumCheckmark = '%26%2310003%3B'; + var urlEncodedNumSmiley = '%26%239786%3B'; + + t.test('prefers an utf-8 charset specified by the utf8 sentinel to a default charset of iso-8859-1', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedCheckmarkInUtf8 + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'iso-8859-1' }), { ø: 'ø' }); + st.end(); + }); + + t.test('prefers an iso-8859-1 charset specified by the utf8 sentinel to a default charset of utf-8', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { 'ø': 'ø' }); + st.end(); + }); + + t.test('does not require the utf8 sentinel to be defined before the parameters whose decoding it affects', function (st) { + st.deepEqual(qs.parse('a=' + urlEncodedOSlashInUtf8 + '&utf8=' + urlEncodedNumCheckmark, { charsetSentinel: true, charset: 'utf-8' }), { a: 'ø' }); + st.end(); + }); + + t.test('should ignore an utf8 sentinel with an unknown value', function (st) { + st.deepEqual(qs.parse('utf8=foo&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { ø: 'ø' }); + st.end(); + }); + + t.test('uses the utf8 sentinel to switch to utf-8 when no default charset is given', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedCheckmarkInUtf8 + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true }), { ø: 'ø' }); + st.end(); + }); + + t.test('uses the utf8 sentinel to switch to iso-8859-1 when no default charset is given', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true }), { 'ø': 'ø' }); + st.end(); + }); + + t.test('interprets numeric entities in iso-8859-1 when `interpretNumericEntities`', function (st) { + st.deepEqual(qs.parse('foo=' + urlEncodedNumSmiley, { charset: 'iso-8859-1', interpretNumericEntities: true }), { foo: '☺' }); + st.end(); + }); + + t.test('handles a custom decoder returning `null`, in the `iso-8859-1` charset, when `interpretNumericEntities`', function (st) { + st.deepEqual(qs.parse('foo=&bar=' + urlEncodedNumSmiley, { + charset: 'iso-8859-1', + decoder: function (str, defaultDecoder, charset) { + return str ? defaultDecoder(str, defaultDecoder, charset) : null; + }, + interpretNumericEntities: true + }), { foo: null, bar: '☺' }); + st.end(); + }); + + t.test('does not interpret numeric entities in iso-8859-1 when `interpretNumericEntities` is absent', function (st) { + st.deepEqual(qs.parse('foo=' + urlEncodedNumSmiley, { charset: 'iso-8859-1' }), { foo: '☺' }); + st.end(); + }); + + t.test('does not interpret numeric entities when the charset is utf-8, even when `interpretNumericEntities`', function (st) { + st.deepEqual(qs.parse('foo=' + urlEncodedNumSmiley, { charset: 'utf-8', interpretNumericEntities: true }), { foo: '☺' }); + st.end(); + }); + + t.test('does not interpret %uXXXX syntax in iso-8859-1 mode', function (st) { + st.deepEqual(qs.parse('%u263A=%u263A', { charset: 'iso-8859-1' }), { '%u263A': '%u263A' }); + st.end(); + }); + + t.test('allows for decoding keys and values differently', function (st) { + var decoder = function (str, defaultDecoder, charset, type) { + if (type === 'key') { + return defaultDecoder(str, defaultDecoder, charset, type).toLowerCase(); + } + if (type === 'value') { + return defaultDecoder(str, defaultDecoder, charset, type).toUpperCase(); + } + throw 'this should never happen! type: ' + type; + }; + + st.deepEqual(qs.parse('KeY=vAlUe', { decoder: decoder }), { key: 'VALUE' }); + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/qs/test/stringify.js b/graphql-subscription-express/node_modules/qs/test/stringify.js new file mode 100644 index 0000000..f0cdfef --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/test/stringify.js @@ -0,0 +1,909 @@ +'use strict'; + +var test = require('tape'); +var qs = require('../'); +var utils = require('../lib/utils'); +var iconv = require('iconv-lite'); +var SaferBuffer = require('safer-buffer').Buffer; +var hasSymbols = require('has-symbols'); +var hasBigInt = typeof BigInt === 'function'; + +test('stringify()', function (t) { + t.test('stringifies a querystring object', function (st) { + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: 1 }), 'a=1'); + st.equal(qs.stringify({ a: 1, b: 2 }), 'a=1&b=2'); + st.equal(qs.stringify({ a: 'A_Z' }), 'a=A_Z'); + st.equal(qs.stringify({ a: '€' }), 'a=%E2%82%AC'); + st.equal(qs.stringify({ a: '' }), 'a=%EE%80%80'); + st.equal(qs.stringify({ a: 'א' }), 'a=%D7%90'); + st.equal(qs.stringify({ a: '𐐷' }), 'a=%F0%90%90%B7'); + st.end(); + }); + + t.test('stringifies falsy values', function (st) { + st.equal(qs.stringify(undefined), ''); + st.equal(qs.stringify(null), ''); + st.equal(qs.stringify(null, { strictNullHandling: true }), ''); + st.equal(qs.stringify(false), ''); + st.equal(qs.stringify(0), ''); + st.end(); + }); + + t.test('stringifies symbols', { skip: !hasSymbols() }, function (st) { + st.equal(qs.stringify(Symbol.iterator), ''); + st.equal(qs.stringify([Symbol.iterator]), '0=Symbol%28Symbol.iterator%29'); + st.equal(qs.stringify({ a: Symbol.iterator }), 'a=Symbol%28Symbol.iterator%29'); + st.equal( + qs.stringify({ a: [Symbol.iterator] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), + 'a[]=Symbol%28Symbol.iterator%29' + ); + st.end(); + }); + + t.test('stringifies bigints', { skip: !hasBigInt }, function (st) { + var three = BigInt(3); + var encodeWithN = function (value, defaultEncoder, charset) { + var result = defaultEncoder(value, defaultEncoder, charset); + return typeof value === 'bigint' ? result + 'n' : result; + }; + st.equal(qs.stringify(three), ''); + st.equal(qs.stringify([three]), '0=3'); + st.equal(qs.stringify([three], { encoder: encodeWithN }), '0=3n'); + st.equal(qs.stringify({ a: three }), 'a=3'); + st.equal(qs.stringify({ a: three }, { encoder: encodeWithN }), 'a=3n'); + st.equal( + qs.stringify({ a: [three] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), + 'a[]=3' + ); + st.equal( + qs.stringify({ a: [three] }, { encodeValuesOnly: true, encoder: encodeWithN, arrayFormat: 'brackets' }), + 'a[]=3n' + ); + st.end(); + }); + + t.test('adds query prefix', function (st) { + st.equal(qs.stringify({ a: 'b' }, { addQueryPrefix: true }), '?a=b'); + st.end(); + }); + + t.test('with query prefix, outputs blank string given an empty object', function (st) { + st.equal(qs.stringify({}, { addQueryPrefix: true }), ''); + st.end(); + }); + + t.test('stringifies nested falsy values', function (st) { + st.equal(qs.stringify({ a: { b: { c: null } } }), 'a%5Bb%5D%5Bc%5D='); + st.equal(qs.stringify({ a: { b: { c: null } } }, { strictNullHandling: true }), 'a%5Bb%5D%5Bc%5D'); + st.equal(qs.stringify({ a: { b: { c: false } } }), 'a%5Bb%5D%5Bc%5D=false'); + st.end(); + }); + + t.test('stringifies a nested object', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }), 'a%5Bb%5D%5Bc%5D%5Bd%5D=e'); + st.end(); + }); + + t.test('stringifies a nested object with dots notation', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }, { allowDots: true }), 'a.b=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }, { allowDots: true }), 'a.b.c.d=e'); + st.end(); + }); + + t.test('stringifies an array value', function (st) { + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'indices' }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'brackets' }), + 'a%5B%5D=b&a%5B%5D=c&a%5B%5D=d', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'comma' }), + 'a=b%2Cc%2Cd', + 'comma => comma' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'default => indices' + ); + st.end(); + }); + + t.test('omits nulls when asked', function (st) { + st.equal(qs.stringify({ a: 'b', c: null }, { skipNulls: true }), 'a=b'); + st.end(); + }); + + t.test('omits nested nulls when asked', function (st) { + st.equal(qs.stringify({ a: { b: 'c', d: null } }, { skipNulls: true }), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('omits array indices when asked', function (st) { + st.equal(qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }), 'a=b&a=c&a=d'); + st.end(); + }); + + t.test('stringifies an array value with one item vs multiple items', function (st) { + st.test('non-array item', function (s2t) { + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a=c'); + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a=c'); + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c'); + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true }), 'a=c'); + + s2t.end(); + }); + + st.test('array with a single item', function (s2t) { + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[0]=c'); + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=c'); + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c'); + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'comma', commaRoundTrip: true }), 'a[]=c'); // so it parses back as an array + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true }), 'a[0]=c'); + + s2t.end(); + }); + + st.test('array with multiple items', function (s2t) { + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[0]=c&a[1]=d'); + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=c&a[]=d'); + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c,d'); + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true }), 'a[0]=c&a[1]=d'); + + s2t.end(); + }); + + st.end(); + }); + + t.test('stringifies a nested array value', function (st) { + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[b][0]=c&a[b][1]=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[b][]=c&a[b][]=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a[b]=c,d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true }), 'a[b][0]=c&a[b][1]=d'); + st.end(); + }); + + t.test('stringifies a nested array value with dots notation', function (st) { + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true, arrayFormat: 'indices' } + ), + 'a.b[0]=c&a.b[1]=d', + 'indices: stringifies with dots + indices' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true, arrayFormat: 'brackets' } + ), + 'a.b[]=c&a.b[]=d', + 'brackets: stringifies with dots + brackets' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true, arrayFormat: 'comma' } + ), + 'a.b=c,d', + 'comma: stringifies with dots + comma' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true } + ), + 'a.b[0]=c&a.b[1]=d', + 'default: stringifies with dots + indices' + ); + st.end(); + }); + + t.test('stringifies an object inside an array', function (st) { + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'indices' }), + 'a%5B0%5D%5Bb%5D=c', // a[0][b]=c + 'indices => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'brackets' }), + 'a%5B%5D%5Bb%5D=c', // a[][b]=c + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }), + 'a%5B0%5D%5Bb%5D=c', + 'default => indices' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'indices' }), + 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1', + 'indices => indices' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'brackets' }), + 'a%5B%5D%5Bb%5D%5Bc%5D%5B%5D=1', + 'brackets => brackets' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }), + 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an array with mixed objects and primitives', function (st) { + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), + 'a[][b]=1&a[]=2&a[]=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), + '???', + 'brackets => brackets', + { skip: 'TODO: figure out what this should do' } + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an object inside an array with dots notation', function (st) { + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b=c', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b=c', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false } + ), + 'a[0].b=c', + 'default => indices' + ); + + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b.c[0]=1', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b.c[]=1', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false } + ), + 'a[0].b.c[0]=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('does not omit object keys when indices = false', function (st) { + st.equal(qs.stringify({ a: [{ b: 'c' }] }, { indices: false }), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when indices=true', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { indices: true }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when no arrayFormat is specified', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when no arrayFormat=indices', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses repeat notation for arrays when no arrayFormat=repeat', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }), 'a=b&a=c'); + st.end(); + }); + + t.test('uses brackets notation for arrays when no arrayFormat=brackets', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }), 'a%5B%5D=b&a%5B%5D=c'); + st.end(); + }); + + t.test('stringifies a complicated object', function (st) { + st.equal(qs.stringify({ a: { b: 'c', d: 'e' } }), 'a%5Bb%5D=c&a%5Bd%5D=e'); + st.end(); + }); + + t.test('stringifies an empty value', function (st) { + st.equal(qs.stringify({ a: '' }), 'a='); + st.equal(qs.stringify({ a: null }, { strictNullHandling: true }), 'a'); + + st.equal(qs.stringify({ a: '', b: '' }), 'a=&b='); + st.equal(qs.stringify({ a: null, b: '' }, { strictNullHandling: true }), 'a&b='); + + st.equal(qs.stringify({ a: { b: '' } }), 'a%5Bb%5D='); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: true }), 'a%5Bb%5D'); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: false }), 'a%5Bb%5D='); + + st.end(); + }); + + t.test('stringifies an empty array in different arrayFormat', function (st) { + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false }), 'b[0]=&c=c'); + // arrayFormat default + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'indices' }), 'b[0]=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'brackets' }), 'b[]=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'repeat' }), 'b=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma' }), 'b=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', commaRoundTrip: true }), 'b[]=&c=c'); + // with strictNullHandling + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'indices', strictNullHandling: true }), 'b[0]&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'brackets', strictNullHandling: true }), 'b[]&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'repeat', strictNullHandling: true }), 'b&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', strictNullHandling: true }), 'b&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', strictNullHandling: true, commaRoundTrip: true }), 'b[]&c=c'); + // with skipNulls + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'indices', skipNulls: true }), 'c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'brackets', skipNulls: true }), 'c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'repeat', skipNulls: true }), 'c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', skipNulls: true }), 'c=c'); + + st.end(); + }); + + t.test('stringifies a null object', { skip: !Object.create }, function (st) { + var obj = Object.create(null); + obj.a = 'b'; + st.equal(qs.stringify(obj), 'a=b'); + st.end(); + }); + + t.test('returns an empty string for invalid input', function (st) { + st.equal(qs.stringify(undefined), ''); + st.equal(qs.stringify(false), ''); + st.equal(qs.stringify(null), ''); + st.equal(qs.stringify(''), ''); + st.end(); + }); + + t.test('stringifies an object with a null object as a child', { skip: !Object.create }, function (st) { + var obj = { a: Object.create(null) }; + + obj.a.b = 'c'; + st.equal(qs.stringify(obj), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('drops keys with a value of undefined', function (st) { + st.equal(qs.stringify({ a: undefined }), ''); + + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: true }), 'a%5Bc%5D'); + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: false }), 'a%5Bc%5D='); + st.equal(qs.stringify({ a: { b: undefined, c: '' } }), 'a%5Bc%5D='); + st.end(); + }); + + t.test('url encodes values', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.end(); + }); + + t.test('stringifies a date', function (st) { + var now = new Date(); + var str = 'a=' + encodeURIComponent(now.toISOString()); + st.equal(qs.stringify({ a: now }), str); + st.end(); + }); + + t.test('stringifies the weird object from qs', function (st) { + st.equal(qs.stringify({ 'my weird field': '~q1!2"\'w$5&7/z8)?' }), 'my%20weird%20field=~q1%212%22%27w%245%267%2Fz8%29%3F'); + st.end(); + }); + + t.test('skips properties that are part of the object prototype', function (st) { + Object.prototype.crash = 'test'; + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + delete Object.prototype.crash; + st.end(); + }); + + t.test('stringifies boolean values', function (st) { + st.equal(qs.stringify({ a: true }), 'a=true'); + st.equal(qs.stringify({ a: { b: true } }), 'a%5Bb%5D=true'); + st.equal(qs.stringify({ b: false }), 'b=false'); + st.equal(qs.stringify({ b: { c: false } }), 'b%5Bc%5D=false'); + st.end(); + }); + + t.test('stringifies buffer values', function (st) { + st.equal(qs.stringify({ a: SaferBuffer.from('test') }), 'a=test'); + st.equal(qs.stringify({ a: { b: SaferBuffer.from('test') } }), 'a%5Bb%5D=test'); + st.end(); + }); + + t.test('stringifies an object using an alternative delimiter', function (st) { + st.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); + st.end(); + }); + + t.test('does not blow up when Buffer global is missing', function (st) { + var tempBuffer = global.Buffer; + delete global.Buffer; + var result = qs.stringify({ a: 'b', c: 'd' }); + global.Buffer = tempBuffer; + st.equal(result, 'a=b&c=d'); + st.end(); + }); + + t.test('does not crash when parsing circular references', function (st) { + var a = {}; + a.b = a; + + st['throws']( + function () { qs.stringify({ 'foo[bar]': 'baz', 'foo[baz]': a }); }, + /RangeError: Cyclic object value/, + 'cyclic values throw' + ); + + var circular = { + a: 'value' + }; + circular.a = circular; + st['throws']( + function () { qs.stringify(circular); }, + /RangeError: Cyclic object value/, + 'cyclic values throw' + ); + + var arr = ['a']; + st.doesNotThrow( + function () { qs.stringify({ x: arr, y: arr }); }, + 'non-cyclic values do not throw' + ); + + st.end(); + }); + + t.test('non-circular duplicated references can still work', function (st) { + var hourOfDay = { + 'function': 'hour_of_day' + }; + + var p1 = { + 'function': 'gte', + arguments: [hourOfDay, 0] + }; + var p2 = { + 'function': 'lte', + arguments: [hourOfDay, 23] + }; + + st.equal( + qs.stringify({ filters: { $and: [p1, p2] } }, { encodeValuesOnly: true }), + 'filters[$and][0][function]=gte&filters[$and][0][arguments][0][function]=hour_of_day&filters[$and][0][arguments][1]=0&filters[$and][1][function]=lte&filters[$and][1][arguments][0][function]=hour_of_day&filters[$and][1][arguments][1]=23' + ); + + st.end(); + }); + + t.test('selects properties when filter=array', function (st) { + st.equal(qs.stringify({ a: 'b' }, { filter: ['a'] }), 'a=b'); + st.equal(qs.stringify({ a: 1 }, { filter: [] }), ''); + + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'indices' } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'brackets' } + ), + 'a%5Bb%5D%5B%5D=1&a%5Bb%5D%5B%5D=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2] } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('supports custom representations when filter=function', function (st) { + var calls = 0; + var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } }; + var filterFunc = function (prefix, value) { + calls += 1; + if (calls === 1) { + st.equal(prefix, '', 'prefix is empty'); + st.equal(value, obj); + } else if (prefix === 'c') { + return void 0; + } else if (value instanceof Date) { + st.equal(prefix, 'e[f]'); + return value.getTime(); + } + return value; + }; + + st.equal(qs.stringify(obj, { filter: filterFunc }), 'a=b&e%5Bf%5D=1257894000000'); + st.equal(calls, 5); + st.end(); + }); + + t.test('can disable uri encoding', function (st) { + st.equal(qs.stringify({ a: 'b' }, { encode: false }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }, { encode: false }), 'a[b]=c'); + st.equal(qs.stringify({ a: 'b', c: null }, { strictNullHandling: true, encode: false }), 'a=b&c'); + st.end(); + }); + + t.test('can sort the keys', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal(qs.stringify({ a: 'c', z: 'y', b: 'f' }, { sort: sort }), 'a=c&b=f&z=y'); + st.equal(qs.stringify({ a: 'c', z: { j: 'a', i: 'b' }, b: 'f' }, { sort: sort }), 'a=c&b=f&z%5Bi%5D=b&z%5Bj%5D=a'); + st.end(); + }); + + t.test('can sort the keys at depth 3 or more too', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: sort, encode: false } + ), + 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb' + ); + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: null, encode: false } + ), + 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b' + ); + st.end(); + }); + + t.test('can stringify with custom encoding', function (st) { + st.equal(qs.stringify({ 県: '大阪府', '': '' }, { + encoder: function (str) { + if (str.length === 0) { + return ''; + } + var buf = iconv.encode(str, 'shiftjis'); + var result = []; + for (var i = 0; i < buf.length; ++i) { + result.push(buf.readUInt8(i).toString(16)); + } + return '%' + result.join('%'); + } + }), '%8c%a7=%91%e5%8d%e3%95%7b&='); + st.end(); + }); + + t.test('receives the default encoder as a second argument', function (st) { + st.plan(2); + qs.stringify({ a: 1 }, { + encoder: function (str, defaultEncoder) { + st.equal(defaultEncoder, utils.encode); + } + }); + st.end(); + }); + + t.test('throws error with wrong encoder', function (st) { + st['throws'](function () { + qs.stringify({}, { encoder: 'string' }); + }, new TypeError('Encoder has to be a function.')); + st.end(); + }); + + t.test('can use custom encoder for a buffer object', { skip: typeof Buffer === 'undefined' }, function (st) { + st.equal(qs.stringify({ a: SaferBuffer.from([1]) }, { + encoder: function (buffer) { + if (typeof buffer === 'string') { + return buffer; + } + return String.fromCharCode(buffer.readUInt8(0) + 97); + } + }), 'a=b'); + + st.equal(qs.stringify({ a: SaferBuffer.from('a b') }, { + encoder: function (buffer) { + return buffer; + } + }), 'a=a b'); + st.end(); + }); + + t.test('serializeDate option', function (st) { + var date = new Date(); + st.equal( + qs.stringify({ a: date }), + 'a=' + date.toISOString().replace(/:/g, '%3A'), + 'default is toISOString' + ); + + var mutatedDate = new Date(); + mutatedDate.toISOString = function () { + throw new SyntaxError(); + }; + st['throws'](function () { + mutatedDate.toISOString(); + }, SyntaxError); + st.equal( + qs.stringify({ a: mutatedDate }), + 'a=' + Date.prototype.toISOString.call(mutatedDate).replace(/:/g, '%3A'), + 'toISOString works even when method is not locally present' + ); + + var specificDate = new Date(6); + st.equal( + qs.stringify( + { a: specificDate }, + { serializeDate: function (d) { return d.getTime() * 7; } } + ), + 'a=42', + 'custom serializeDate function called' + ); + + st.equal( + qs.stringify( + { a: [date] }, + { + serializeDate: function (d) { return d.getTime(); }, + arrayFormat: 'comma' + } + ), + 'a=' + date.getTime(), + 'works with arrayFormat comma' + ); + st.equal( + qs.stringify( + { a: [date] }, + { + serializeDate: function (d) { return d.getTime(); }, + arrayFormat: 'comma', + commaRoundTrip: true + } + ), + 'a%5B%5D=' + date.getTime(), + 'works with arrayFormat comma' + ); + + st.end(); + }); + + t.test('RFC 1738 serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC1738 }), 'a=b+c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC1738 }), 'a+b=c+d'); + st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }, { format: qs.formats.RFC1738 }), 'a+b=a+b'); + + st.equal(qs.stringify({ 'foo(ref)': 'bar' }, { format: qs.formats.RFC1738 }), 'foo(ref)=bar'); + + st.end(); + }); + + t.test('RFC 3986 spaces serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC3986 }), 'a=b%20c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC3986 }), 'a%20b=c%20d'); + st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }, { format: qs.formats.RFC3986 }), 'a%20b=a%20b'); + + st.end(); + }); + + t.test('Backward compatibility to RFC 3986', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }), 'a%20b=a%20b'); + + st.end(); + }); + + t.test('Edge cases and unknown formats', function (st) { + ['UFO1234', false, 1234, null, {}, []].forEach(function (format) { + st['throws']( + function () { + qs.stringify({ a: 'b c' }, { format: format }); + }, + new TypeError('Unknown format option provided.') + ); + }); + st.end(); + }); + + t.test('encodeValuesOnly', function (st) { + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true } + ), + 'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h' + ); + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e'], f: [['g'], ['h']] } + ), + 'a=b&c%5B0%5D=d&c%5B1%5D=e&f%5B0%5D%5B0%5D=g&f%5B1%5D%5B0%5D=h' + ); + st.end(); + }); + + t.test('encodeValuesOnly - strictNullHandling', function (st) { + st.equal( + qs.stringify( + { a: { b: null } }, + { encodeValuesOnly: true, strictNullHandling: true } + ), + 'a[b]' + ); + st.end(); + }); + + t.test('throws if an invalid charset is specified', function (st) { + st['throws'](function () { + qs.stringify({ a: 'b' }, { charset: 'foobar' }); + }, new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined')); + st.end(); + }); + + t.test('respects a charset of iso-8859-1', function (st) { + st.equal(qs.stringify({ æ: 'æ' }, { charset: 'iso-8859-1' }), '%E6=%E6'); + st.end(); + }); + + t.test('encodes unrepresentable chars as numeric entities in iso-8859-1 mode', function (st) { + st.equal(qs.stringify({ a: '☺' }, { charset: 'iso-8859-1' }), 'a=%26%239786%3B'); + st.end(); + }); + + t.test('respects an explicit charset of utf-8 (the default)', function (st) { + st.equal(qs.stringify({ a: 'æ' }, { charset: 'utf-8' }), 'a=%C3%A6'); + st.end(); + }); + + t.test('adds the right sentinel when instructed to and the charset is utf-8', function (st) { + st.equal(qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'utf-8' }), 'utf8=%E2%9C%93&a=%C3%A6'); + st.end(); + }); + + t.test('adds the right sentinel when instructed to and the charset is iso-8859-1', function (st) { + st.equal(qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'iso-8859-1' }), 'utf8=%26%2310003%3B&a=%E6'); + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.stringify({}, options); + st.deepEqual(options, {}); + st.end(); + }); + + t.test('strictNullHandling works with custom filter', function (st) { + var filter = function (prefix, value) { + return value; + }; + + var options = { strictNullHandling: true, filter: filter }; + st.equal(qs.stringify({ key: null }, options), 'key'); + st.end(); + }); + + t.test('strictNullHandling works with null serializeDate', function (st) { + var serializeDate = function () { + return null; + }; + var options = { strictNullHandling: true, serializeDate: serializeDate }; + var date = new Date(); + st.equal(qs.stringify({ key: date }, options), 'key'); + st.end(); + }); + + t.test('allows for encoding keys and values differently', function (st) { + var encoder = function (str, defaultEncoder, charset, type) { + if (type === 'key') { + return defaultEncoder(str, defaultEncoder, charset, type).toLowerCase(); + } + if (type === 'value') { + return defaultEncoder(str, defaultEncoder, charset, type).toUpperCase(); + } + throw 'this should never happen! type: ' + type; + }; + + st.deepEqual(qs.stringify({ KeY: 'vAlUe' }, { encoder: encoder }), 'key=VALUE'); + st.end(); + }); + + t.test('objects inside arrays', function (st) { + var obj = { a: { b: { c: 'd', e: 'f' } } }; + var withArray = { a: { b: [{ c: 'd', e: 'f' }] } }; + + st.equal(qs.stringify(obj, { encode: false }), 'a[b][c]=d&a[b][e]=f', 'no array, no arrayFormat'); + st.equal(qs.stringify(obj, { encode: false, arrayFormat: 'bracket' }), 'a[b][c]=d&a[b][e]=f', 'no array, bracket'); + st.equal(qs.stringify(obj, { encode: false, arrayFormat: 'indices' }), 'a[b][c]=d&a[b][e]=f', 'no array, indices'); + st.equal(qs.stringify(obj, { encode: false, arrayFormat: 'comma' }), 'a[b][c]=d&a[b][e]=f', 'no array, comma'); + + st.equal(qs.stringify(withArray, { encode: false }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, no arrayFormat'); + st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'bracket' }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, bracket'); + st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'indices' }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, indices'); + st.equal( + qs.stringify(withArray, { encode: false, arrayFormat: 'comma' }), + '???', + 'array, comma', + { skip: 'TODO: figure out what this should do' } + ); + + st.end(); + }); + + t.test('stringifies sparse arrays', function (st) { + /* eslint no-sparse-arrays: 0 */ + st.equal(qs.stringify({ a: [, '2', , , '1'] }, { encodeValuesOnly: true }), 'a[1]=2&a[4]=1'); + st.equal(qs.stringify({ a: [, { b: [, , { c: '1' }] }] }, { encodeValuesOnly: true }), 'a[1][b][2][c]=1'); + st.equal(qs.stringify({ a: [, [, , [, , , { c: '1' }]]] }, { encodeValuesOnly: true }), 'a[1][2][3][c]=1'); + st.equal(qs.stringify({ a: [, [, , [, , , { c: [, '1'] }]]] }, { encodeValuesOnly: true }), 'a[1][2][3][c][1]=1'); + + st.end(); + }); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/qs/test/utils.js b/graphql-subscription-express/node_modules/qs/test/utils.js new file mode 100644 index 0000000..aa84dfd --- /dev/null +++ b/graphql-subscription-express/node_modules/qs/test/utils.js @@ -0,0 +1,136 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var SaferBuffer = require('safer-buffer').Buffer; +var forEach = require('for-each'); +var utils = require('../lib/utils'); + +test('merge()', function (t) { + t.deepEqual(utils.merge(null, true), [null, true], 'merges true into null'); + + t.deepEqual(utils.merge(null, [42]), [null, 42], 'merges null into an array'); + + t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key'); + + var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } }); + t.deepEqual(oneMerged, { foo: ['bar', { first: '123' }] }, 'merges a standalone and an object into an array'); + + var twoMerged = utils.merge({ foo: ['bar', { first: '123' }] }, { foo: { second: '456' } }); + t.deepEqual(twoMerged, { foo: { 0: 'bar', 1: { first: '123' }, second: '456' } }, 'merges a standalone and two objects into an array'); + + var sandwiched = utils.merge({ foo: ['bar', { first: '123', second: '456' }] }, { foo: 'baz' }); + t.deepEqual(sandwiched, { foo: ['bar', { first: '123', second: '456' }, 'baz'] }, 'merges an object sandwiched by two standalones into an array'); + + var nestedArrays = utils.merge({ foo: ['baz'] }, { foo: ['bar', 'xyzzy'] }); + t.deepEqual(nestedArrays, { foo: ['baz', 'bar', 'xyzzy'] }); + + var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar'); + t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true }); + + t.test( + 'avoids invoking array setters unnecessarily', + { skip: typeof Object.defineProperty !== 'function' }, + function (st) { + var setCount = 0; + var getCount = 0; + var observed = []; + Object.defineProperty(observed, 0, { + get: function () { + getCount += 1; + return { bar: 'baz' }; + }, + set: function () { setCount += 1; } + }); + utils.merge(observed, [null]); + st.equal(setCount, 0); + st.equal(getCount, 1); + observed[0] = observed[0]; // eslint-disable-line no-self-assign + st.equal(setCount, 1); + st.equal(getCount, 2); + st.end(); + } + ); + + t.end(); +}); + +test('assign()', function (t) { + var target = { a: 1, b: 2 }; + var source = { b: 3, c: 4 }; + var result = utils.assign(target, source); + + t.equal(result, target, 'returns the target'); + t.deepEqual(target, { a: 1, b: 3, c: 4 }, 'target and source are merged'); + t.deepEqual(source, { b: 3, c: 4 }, 'source is untouched'); + + t.end(); +}); + +test('combine()', function (t) { + t.test('both arrays', function (st) { + var a = [1]; + var b = [2]; + var combined = utils.combine(a, b); + + st.deepEqual(a, [1], 'a is not mutated'); + st.deepEqual(b, [2], 'b is not mutated'); + st.notEqual(a, combined, 'a !== combined'); + st.notEqual(b, combined, 'b !== combined'); + st.deepEqual(combined, [1, 2], 'combined is a + b'); + + st.end(); + }); + + t.test('one array, one non-array', function (st) { + var aN = 1; + var a = [aN]; + var bN = 2; + var b = [bN]; + + var combinedAnB = utils.combine(aN, b); + st.deepEqual(b, [bN], 'b is not mutated'); + st.notEqual(aN, combinedAnB, 'aN + b !== aN'); + st.notEqual(a, combinedAnB, 'aN + b !== a'); + st.notEqual(bN, combinedAnB, 'aN + b !== bN'); + st.notEqual(b, combinedAnB, 'aN + b !== b'); + st.deepEqual([1, 2], combinedAnB, 'first argument is array-wrapped when not an array'); + + var combinedABn = utils.combine(a, bN); + st.deepEqual(a, [aN], 'a is not mutated'); + st.notEqual(aN, combinedABn, 'a + bN !== aN'); + st.notEqual(a, combinedABn, 'a + bN !== a'); + st.notEqual(bN, combinedABn, 'a + bN !== bN'); + st.notEqual(b, combinedABn, 'a + bN !== b'); + st.deepEqual([1, 2], combinedABn, 'second argument is array-wrapped when not an array'); + + st.end(); + }); + + t.test('neither is an array', function (st) { + var combined = utils.combine(1, 2); + st.notEqual(1, combined, '1 + 2 !== 1'); + st.notEqual(2, combined, '1 + 2 !== 2'); + st.deepEqual([1, 2], combined, 'both arguments are array-wrapped when not an array'); + + st.end(); + }); + + t.end(); +}); + +test('isBuffer()', function (t) { + forEach([null, undefined, true, false, '', 'abc', 42, 0, NaN, {}, [], function () {}, /a/g], function (x) { + t.equal(utils.isBuffer(x), false, inspect(x) + ' is not a buffer'); + }); + + var fakeBuffer = { constructor: Buffer }; + t.equal(utils.isBuffer(fakeBuffer), false, 'fake buffer is not a buffer'); + + var saferBuffer = SaferBuffer.from('abc'); + t.equal(utils.isBuffer(saferBuffer), true, 'SaferBuffer instance is a buffer'); + + var buffer = Buffer.from && Buffer.alloc ? Buffer.from('abc') : new Buffer('abc'); + t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer'); + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/range-parser/HISTORY.md b/graphql-subscription-express/node_modules/range-parser/HISTORY.md new file mode 100644 index 0000000..70a973d --- /dev/null +++ b/graphql-subscription-express/node_modules/range-parser/HISTORY.md @@ -0,0 +1,56 @@ +1.2.1 / 2019-05-10 +================== + + * Improve error when `str` is not a string + +1.2.0 / 2016-06-01 +================== + + * Add `combine` option to combine overlapping ranges + +1.1.0 / 2016-05-13 +================== + + * Fix incorrectly returning -1 when there is at least one valid range + * perf: remove internal function + +1.0.3 / 2015-10-29 +================== + + * perf: enable strict mode + +1.0.2 / 2014-09-08 +================== + + * Support Node.js 0.6 + +1.0.1 / 2014-09-07 +================== + + * Move repository to jshttp + +1.0.0 / 2013-12-11 +================== + + * Add repository to package.json + * Add MIT license + +0.0.4 / 2012-06-17 +================== + + * Change ret -1 for unsatisfiable and -2 when invalid + +0.0.3 / 2012-06-17 +================== + + * Fix last-byte-pos default to len - 1 + +0.0.2 / 2012-06-14 +================== + + * Add `.type` + +0.0.1 / 2012-06-11 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/range-parser/LICENSE b/graphql-subscription-express/node_modules/range-parser/LICENSE new file mode 100644 index 0000000..3599954 --- /dev/null +++ b/graphql-subscription-express/node_modules/range-parser/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012-2014 TJ Holowaychuk +Copyright (c) 2015-2016 Douglas Christopher Wilson + +```js +var parseRange = require('range-parser') +``` + +### parseRange(size, header, options) + +Parse the given `header` string where `size` is the maximum size of the resource. +An array of ranges will be returned or negative numbers indicating an error parsing. + + * `-2` signals a malformed header string + * `-1` signals an unsatisfiable range + + + +```js +// parse header from request +var range = parseRange(size, req.headers.range) + +// the type of the range +if (range.type === 'bytes') { + // the ranges + range.forEach(function (r) { + // do something with r.start and r.end + }) +} +``` + +#### Options + +These properties are accepted in the options object. + +##### combine + +Specifies if overlapping & adjacent ranges should be combined, defaults to `false`. +When `true`, ranges will be combined and returned as if they were specified that +way in the header. + + + +```js +parseRange(100, 'bytes=50-55,0-10,5-10,56-60', { combine: true }) +// => [ +// { start: 0, end: 10 }, +// { start: 50, end: 60 } +// ] +``` + +## License + +[MIT](LICENSE) + +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/range-parser/master +[coveralls-url]: https://coveralls.io/r/jshttp/range-parser?branch=master +[node-image]: https://badgen.net/npm/node/range-parser +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/range-parser +[npm-url]: https://npmjs.org/package/range-parser +[npm-version-image]: https://badgen.net/npm/v/range-parser +[travis-image]: https://badgen.net/travis/jshttp/range-parser/master +[travis-url]: https://travis-ci.org/jshttp/range-parser diff --git a/graphql-subscription-express/node_modules/range-parser/index.js b/graphql-subscription-express/node_modules/range-parser/index.js new file mode 100644 index 0000000..b7dc5c0 --- /dev/null +++ b/graphql-subscription-express/node_modules/range-parser/index.js @@ -0,0 +1,162 @@ +/*! + * range-parser + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = rangeParser + +/** + * Parse "Range" header `str` relative to the given file `size`. + * + * @param {Number} size + * @param {String} str + * @param {Object} [options] + * @return {Array} + * @public + */ + +function rangeParser (size, str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string') + } + + var index = str.indexOf('=') + + if (index === -1) { + return -2 + } + + // split the range string + var arr = str.slice(index + 1).split(',') + var ranges = [] + + // add ranges type + ranges.type = str.slice(0, index) + + // parse all ranges + for (var i = 0; i < arr.length; i++) { + var range = arr[i].split('-') + var start = parseInt(range[0], 10) + var end = parseInt(range[1], 10) + + // -nnn + if (isNaN(start)) { + start = size - end + end = size - 1 + // nnn- + } else if (isNaN(end)) { + end = size - 1 + } + + // limit last-byte-pos to current length + if (end > size - 1) { + end = size - 1 + } + + // invalid or unsatisifiable + if (isNaN(start) || isNaN(end) || start > end || start < 0) { + continue + } + + // add range + ranges.push({ + start: start, + end: end + }) + } + + if (ranges.length < 1) { + // unsatisifiable + return -1 + } + + return options && options.combine + ? combineRanges(ranges) + : ranges +} + +/** + * Combine overlapping & adjacent ranges. + * @private + */ + +function combineRanges (ranges) { + var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart) + + for (var j = 0, i = 1; i < ordered.length; i++) { + var range = ordered[i] + var current = ordered[j] + + if (range.start > current.end + 1) { + // next range + ordered[++j] = range + } else if (range.end > current.end) { + // extend range + current.end = range.end + current.index = Math.min(current.index, range.index) + } + } + + // trim ordered array + ordered.length = j + 1 + + // generate combined range + var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex) + + // copy ranges type + combined.type = ranges.type + + return combined +} + +/** + * Map function to add index value to ranges. + * @private + */ + +function mapWithIndex (range, index) { + return { + start: range.start, + end: range.end, + index: index + } +} + +/** + * Map function to remove index value from ranges. + * @private + */ + +function mapWithoutIndex (range) { + return { + start: range.start, + end: range.end + } +} + +/** + * Sort function to sort ranges by index. + * @private + */ + +function sortByRangeIndex (a, b) { + return a.index - b.index +} + +/** + * Sort function to sort ranges by start position. + * @private + */ + +function sortByRangeStart (a, b) { + return a.start - b.start +} diff --git a/graphql-subscription-express/node_modules/range-parser/package.json b/graphql-subscription-express/node_modules/range-parser/package.json new file mode 100644 index 0000000..abea6d8 --- /dev/null +++ b/graphql-subscription-express/node_modules/range-parser/package.json @@ -0,0 +1,44 @@ +{ + "name": "range-parser", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "description": "Range header field string parser", + "version": "1.2.1", + "contributors": [ + "Douglas Christopher Wilson ", + "James Wyatt Cready ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "keywords": [ + "range", + "parser", + "http" + ], + "repository": "jshttp/range-parser", + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "5.16.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-markdown": "1.0.0", + "eslint-plugin-import": "2.17.2", + "eslint-plugin-node": "8.0.1", + "eslint-plugin-promise": "4.1.1", + "eslint-plugin-standard": "4.0.0", + "mocha": "6.1.4", + "nyc": "14.1.1" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "test-travis": "nyc --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/raw-body/HISTORY.md b/graphql-subscription-express/node_modules/raw-body/HISTORY.md new file mode 100644 index 0000000..baf0e2d --- /dev/null +++ b/graphql-subscription-express/node_modules/raw-body/HISTORY.md @@ -0,0 +1,308 @@ +2.5.2 / 2023-02-21 +================== + + * Fix error message for non-stream argument + +2.5.1 / 2022-02-28 +================== + + * Fix error on early async hooks implementations + +2.5.0 / 2022-02-21 +================== + + * Prevent loss of async hooks context + * Prevent hanging when stream is not readable + * deps: http-errors@2.0.0 + - deps: depd@2.0.0 + - deps: statuses@2.0.1 + +2.4.3 / 2022-02-14 +================== + + * deps: bytes@3.1.2 + +2.4.2 / 2021-11-16 +================== + + * deps: bytes@3.1.1 + * deps: http-errors@1.8.1 + - deps: setprototypeof@1.2.0 + - deps: toidentifier@1.0.1 + +2.4.1 / 2019-06-25 +================== + + * deps: http-errors@1.7.3 + - deps: inherits@2.0.4 + +2.4.0 / 2019-04-17 +================== + + * deps: bytes@3.1.0 + - Add petabyte (`pb`) support + * deps: http-errors@1.7.2 + - Set constructor name when possible + - deps: setprototypeof@1.1.1 + - deps: statuses@'>= 1.5.0 < 2' + * deps: iconv-lite@0.4.24 + - Added encoding MIK + +2.3.3 / 2018-05-08 +================== + + * deps: http-errors@1.6.3 + - deps: depd@~1.1.2 + - deps: setprototypeof@1.1.0 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.23 + - Fix loading encoding with year appended + - Fix deprecation warnings on Node.js 10+ + +2.3.2 / 2017-09-09 +================== + + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1 regression + - Update Windows-1255 + +2.3.1 / 2017-09-07 +================== + + * deps: bytes@3.0.0 + * deps: http-errors@1.6.2 + - deps: depd@1.1.1 + * perf: skip buffer decoding on overage chunk + +2.3.0 / 2017-08-04 +================== + + * Add TypeScript definitions + * Use `http-errors` for standard emitted errors + * deps: bytes@2.5.0 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + +2.2.0 / 2017-01-02 +================== + + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + +2.1.7 / 2016-06-19 +================== + + * deps: bytes@2.4.0 + * perf: remove double-cleanup on happy path + +2.1.6 / 2016-03-07 +================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + +2.1.5 / 2015-11-30 +================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + +2.1.4 / 2015-09-27 +================== + + * Fix masking critical errors from `iconv-lite` + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + +2.1.3 / 2015-09-12 +================== + + * Fix sync callback when attaching data listener causes sync read + - Node.js 0.10 compatibility issue + +2.1.2 / 2015-07-05 +================== + + * Fix error stack traces to skip `makeError` + * deps: iconv-lite@0.4.11 + - Add encoding CESU-8 + +2.1.1 / 2015-06-14 +================== + + * Use `unpipe` module for unpiping requests + +2.1.0 / 2015-05-28 +================== + + * deps: iconv-lite@0.4.10 + - Improved UTF-16 endianness detection + - Leading BOM is now removed when decoding + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + +2.0.2 / 2015-05-21 +================== + + * deps: bytes@2.1.0 + - Slight optimizations + +2.0.1 / 2015-05-10 +================== + + * Fix a false-positive when unpiping in Node.js 0.8 + +2.0.0 / 2015-05-08 +================== + + * Return a promise without callback instead of thunk + * deps: bytes@2.0.1 + - units no longer case sensitive when parsing + +1.3.4 / 2015-04-15 +================== + + * Fix hanging callback if request aborts during read + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + +1.3.3 / 2015-02-08 +================== + + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + +1.3.2 / 2015-01-20 +================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + +1.3.1 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + +1.3.0 / 2014-07-20 +================== + + * Fully unpipe the stream on error + - Fixes `Cannot switch to old mode now` error on Node.js 0.10+ + +1.2.3 / 2014-07-20 +================== + + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + +1.2.2 / 2014-06-19 +================== + + * Send invalid encoding error to callback + +1.2.1 / 2014-06-15 +================== + + * deps: iconv-lite@0.4.3 + - Added encodings UTF-16BE and UTF-16 with BOM + +1.2.0 / 2014-06-13 +================== + + * Passing string as `options` interpreted as encoding + * Support all encodings from `iconv-lite` + +1.1.7 / 2014-06-12 +================== + + * use `string_decoder` module from npm + +1.1.6 / 2014-05-27 +================== + + * check encoding for old streams1 + * support node.js < 0.10.6 + +1.1.5 / 2014-05-14 +================== + + * bump bytes + +1.1.4 / 2014-04-19 +================== + + * allow true as an option + * bump bytes + +1.1.3 / 2014-03-02 +================== + + * fix case when length=null + +1.1.2 / 2013-12-01 +================== + + * be less strict on state.encoding check + +1.1.1 / 2013-11-27 +================== + + * add engines + +1.1.0 / 2013-11-27 +================== + + * add err.statusCode and err.type + * allow for encoding option to be true + * pause the stream instead of dumping on error + * throw if the stream's encoding is set + +1.0.1 / 2013-11-19 +================== + + * dont support streams1, throw if dev set encoding + +1.0.0 / 2013-11-17 +================== + + * rename `expected` option to `length` + +0.2.0 / 2013-11-15 +================== + + * republish + +0.1.1 / 2013-11-15 +================== + + * use bytes + +0.1.0 / 2013-11-11 +================== + + * generator support + +0.0.3 / 2013-10-10 +================== + + * update repo + +0.0.2 / 2013-09-14 +================== + + * dump stream on bad headers + * listen to events after defining received and buffers + +0.0.1 / 2013-09-14 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/raw-body/LICENSE b/graphql-subscription-express/node_modules/raw-body/LICENSE new file mode 100644 index 0000000..1029a7a --- /dev/null +++ b/graphql-subscription-express/node_modules/raw-body/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2013-2014 Jonathan Ong +Copyright (c) 2014-2022 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/raw-body/README.md b/graphql-subscription-express/node_modules/raw-body/README.md new file mode 100644 index 0000000..d9b36d6 --- /dev/null +++ b/graphql-subscription-express/node_modules/raw-body/README.md @@ -0,0 +1,223 @@ +# raw-body + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build status][github-actions-ci-image]][github-actions-ci-url] +[![Test coverage][coveralls-image]][coveralls-url] + +Gets the entire buffer of a stream either as a `Buffer` or a string. +Validates the stream's length against an expected length and maximum limit. +Ideal for parsing request bodies. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install raw-body +``` + +### TypeScript + +This module includes a [TypeScript](https://www.typescriptlang.org/) +declaration file to enable auto complete in compatible editors and type +information for TypeScript projects. This module depends on the Node.js +types, so install `@types/node`: + +```sh +$ npm install @types/node +``` + +## API + +```js +var getRawBody = require('raw-body') +``` + +### getRawBody(stream, [options], [callback]) + +**Returns a promise if no callback specified and global `Promise` exists.** + +Options: + +- `length` - The length of the stream. + If the contents of the stream do not add up to this length, + an `400` error code is returned. +- `limit` - The byte limit of the body. + This is the number of bytes or any string format supported by + [bytes](https://www.npmjs.com/package/bytes), + for example `1000`, `'500kb'` or `'3mb'`. + If the body ends up being larger than this limit, + a `413` error code is returned. +- `encoding` - The encoding to use to decode the body into a string. + By default, a `Buffer` instance will be returned when no encoding is specified. + Most likely, you want `utf-8`, so setting `encoding` to `true` will decode as `utf-8`. + You can use any type of encoding supported by [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme). + +You can also pass a string in place of options to just specify the encoding. + +If an error occurs, the stream will be paused, everything unpiped, +and you are responsible for correctly disposing the stream. +For HTTP requests, you may need to finish consuming the stream if +you want to keep the socket open for future requests. For streams +that use file descriptors, you should `stream.destroy()` or +`stream.close()` to prevent leaks. + +## Errors + +This module creates errors depending on the error condition during reading. +The error may be an error from the underlying Node.js implementation, but is +otherwise an error created by this module, which has the following attributes: + + * `limit` - the limit in bytes + * `length` and `expected` - the expected length of the stream + * `received` - the received bytes + * `encoding` - the invalid encoding + * `status` and `statusCode` - the corresponding status code for the error + * `type` - the error type + +### Types + +The errors from this module have a `type` property which allows for the programmatic +determination of the type of error returned. + +#### encoding.unsupported + +This error will occur when the `encoding` option is specified, but the value does +not map to an encoding supported by the [iconv-lite](https://www.npmjs.org/package/iconv-lite#readme) +module. + +#### entity.too.large + +This error will occur when the `limit` option is specified, but the stream has +an entity that is larger. + +#### request.aborted + +This error will occur when the request stream is aborted by the client before +reading the body has finished. + +#### request.size.invalid + +This error will occur when the `length` option is specified, but the stream has +emitted more bytes. + +#### stream.encoding.set + +This error will occur when the given stream has an encoding set on it, making it +a decoded stream. The stream should not have an encoding set and is expected to +emit `Buffer` objects. + +#### stream.not.readable + +This error will occur when the given stream is not readable. + +## Examples + +### Simple Express example + +```js +var contentType = require('content-type') +var express = require('express') +var getRawBody = require('raw-body') + +var app = express() + +app.use(function (req, res, next) { + getRawBody(req, { + length: req.headers['content-length'], + limit: '1mb', + encoding: contentType.parse(req).parameters.charset + }, function (err, string) { + if (err) return next(err) + req.text = string + next() + }) +}) + +// now access req.text +``` + +### Simple Koa example + +```js +var contentType = require('content-type') +var getRawBody = require('raw-body') +var koa = require('koa') + +var app = koa() + +app.use(function * (next) { + this.text = yield getRawBody(this.req, { + length: this.req.headers['content-length'], + limit: '1mb', + encoding: contentType.parse(this.req).parameters.charset + }) + yield next +}) + +// now access this.text +``` + +### Using as a promise + +To use this library as a promise, simply omit the `callback` and a promise is +returned, provided that a global `Promise` is defined. + +```js +var getRawBody = require('raw-body') +var http = require('http') + +var server = http.createServer(function (req, res) { + getRawBody(req) + .then(function (buf) { + res.statusCode = 200 + res.end(buf.length + ' bytes submitted') + }) + .catch(function (err) { + res.statusCode = 500 + res.end(err.message) + }) +}) + +server.listen(3000) +``` + +### Using with TypeScript + +```ts +import * as getRawBody from 'raw-body'; +import * as http from 'http'; + +const server = http.createServer((req, res) => { + getRawBody(req) + .then((buf) => { + res.statusCode = 200; + res.end(buf.length + ' bytes submitted'); + }) + .catch((err) => { + res.statusCode = err.statusCode; + res.end(err.message); + }); +}); + +server.listen(3000); +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/raw-body.svg +[npm-url]: https://npmjs.org/package/raw-body +[node-version-image]: https://img.shields.io/node/v/raw-body.svg +[node-version-url]: https://nodejs.org/en/download/ +[coveralls-image]: https://img.shields.io/coveralls/stream-utils/raw-body/master.svg +[coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master +[downloads-image]: https://img.shields.io/npm/dm/raw-body.svg +[downloads-url]: https://npmjs.org/package/raw-body +[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/stream-utils/raw-body/ci.yml?branch=master&label=ci +[github-actions-ci-url]: https://github.com/jshttp/stream-utils/raw-body?query=workflow%3Aci diff --git a/graphql-subscription-express/node_modules/raw-body/SECURITY.md b/graphql-subscription-express/node_modules/raw-body/SECURITY.md new file mode 100644 index 0000000..2421efc --- /dev/null +++ b/graphql-subscription-express/node_modules/raw-body/SECURITY.md @@ -0,0 +1,24 @@ +# Security Policies and Procedures + +## Reporting a Bug + +The `raw-body` team and community take all security bugs seriously. Thank you +for improving the security of Express. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your +contributions. + +Report security bugs by emailing the current owners of `raw-body`. This information +can be found in the npm registry using the command `npm owner ls raw-body`. +If unsure or unable to get the information from the above, open an issue +in the [project issue tracker](https://github.com/stream-utils/raw-body/issues) +asking for the current contact information. + +To ensure the timely response to your report, please ensure that the entirety +of the report is contained within the email body and not solely behind a web +link or an attachment. + +At least one owner will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the owners will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. diff --git a/graphql-subscription-express/node_modules/raw-body/index.d.ts b/graphql-subscription-express/node_modules/raw-body/index.d.ts new file mode 100644 index 0000000..dcbbebd --- /dev/null +++ b/graphql-subscription-express/node_modules/raw-body/index.d.ts @@ -0,0 +1,87 @@ +import { Readable } from 'stream'; + +declare namespace getRawBody { + export type Encoding = string | true; + + export interface Options { + /** + * The expected length of the stream. + */ + length?: number | string | null; + /** + * The byte limit of the body. This is the number of bytes or any string + * format supported by `bytes`, for example `1000`, `'500kb'` or `'3mb'`. + */ + limit?: number | string | null; + /** + * The encoding to use to decode the body into a string. By default, a + * `Buffer` instance will be returned when no encoding is specified. Most + * likely, you want `utf-8`, so setting encoding to `true` will decode as + * `utf-8`. You can use any type of encoding supported by `iconv-lite`. + */ + encoding?: Encoding | null; + } + + export interface RawBodyError extends Error { + /** + * The limit in bytes. + */ + limit?: number; + /** + * The expected length of the stream. + */ + length?: number; + expected?: number; + /** + * The received bytes. + */ + received?: number; + /** + * The encoding. + */ + encoding?: string; + /** + * The corresponding status code for the error. + */ + status: number; + statusCode: number; + /** + * The error type. + */ + type: string; + } +} + +/** + * Gets the entire buffer of a stream either as a `Buffer` or a string. + * Validates the stream's length against an expected length and maximum + * limit. Ideal for parsing request bodies. + */ +declare function getRawBody( + stream: Readable, + callback: (err: getRawBody.RawBodyError, body: Buffer) => void +): void; + +declare function getRawBody( + stream: Readable, + options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding, + callback: (err: getRawBody.RawBodyError, body: string) => void +): void; + +declare function getRawBody( + stream: Readable, + options: getRawBody.Options, + callback: (err: getRawBody.RawBodyError, body: Buffer) => void +): void; + +declare function getRawBody( + stream: Readable, + options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding +): Promise; + +declare function getRawBody( + stream: Readable, + options?: getRawBody.Options +): Promise; + +export = getRawBody; diff --git a/graphql-subscription-express/node_modules/raw-body/index.js b/graphql-subscription-express/node_modules/raw-body/index.js new file mode 100644 index 0000000..9cdcd12 --- /dev/null +++ b/graphql-subscription-express/node_modules/raw-body/index.js @@ -0,0 +1,336 @@ +/*! + * raw-body + * Copyright(c) 2013-2014 Jonathan Ong + * Copyright(c) 2014-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var asyncHooks = tryRequireAsyncHooks() +var bytes = require('bytes') +var createError = require('http-errors') +var iconv = require('iconv-lite') +var unpipe = require('unpipe') + +/** + * Module exports. + * @public + */ + +module.exports = getRawBody + +/** + * Module variables. + * @private + */ + +var ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: / + +/** + * Get the decoder for a given encoding. + * + * @param {string} encoding + * @private + */ + +function getDecoder (encoding) { + if (!encoding) return null + + try { + return iconv.getDecoder(encoding) + } catch (e) { + // error getting decoder + if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e + + // the encoding was not found + throw createError(415, 'specified encoding unsupported', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } +} + +/** + * Get the raw body of a stream (typically HTTP). + * + * @param {object} stream + * @param {object|string|function} [options] + * @param {function} [callback] + * @public + */ + +function getRawBody (stream, options, callback) { + var done = callback + var opts = options || {} + + // light validation + if (stream === undefined) { + throw new TypeError('argument stream is required') + } else if (typeof stream !== 'object' || stream === null || typeof stream.on !== 'function') { + throw new TypeError('argument stream must be a stream') + } + + if (options === true || typeof options === 'string') { + // short cut for encoding + opts = { + encoding: options + } + } + + if (typeof options === 'function') { + done = options + opts = {} + } + + // validate callback is a function, if provided + if (done !== undefined && typeof done !== 'function') { + throw new TypeError('argument callback must be a function') + } + + // require the callback without promises + if (!done && !global.Promise) { + throw new TypeError('argument callback is required') + } + + // get encoding + var encoding = opts.encoding !== true + ? opts.encoding + : 'utf-8' + + // convert the limit to an integer + var limit = bytes.parse(opts.limit) + + // convert the expected length to an integer + var length = opts.length != null && !isNaN(opts.length) + ? parseInt(opts.length, 10) + : null + + if (done) { + // classic callback style + return readStream(stream, encoding, length, limit, wrap(done)) + } + + return new Promise(function executor (resolve, reject) { + readStream(stream, encoding, length, limit, function onRead (err, buf) { + if (err) return reject(err) + resolve(buf) + }) + }) +} + +/** + * Halt a stream. + * + * @param {Object} stream + * @private + */ + +function halt (stream) { + // unpipe everything from the stream + unpipe(stream) + + // pause stream + if (typeof stream.pause === 'function') { + stream.pause() + } +} + +/** + * Read the data from the stream. + * + * @param {object} stream + * @param {string} encoding + * @param {number} length + * @param {number} limit + * @param {function} callback + * @public + */ + +function readStream (stream, encoding, length, limit, callback) { + var complete = false + var sync = true + + // check the length and limit options. + // note: we intentionally leave the stream paused, + // so users should handle the stream themselves. + if (limit !== null && length !== null && length > limit) { + return done(createError(413, 'request entity too large', { + expected: length, + length: length, + limit: limit, + type: 'entity.too.large' + })) + } + + // streams1: assert request encoding is buffer. + // streams2+: assert the stream encoding is buffer. + // stream._decoder: streams1 + // state.encoding: streams2 + // state.decoder: streams2, specifically < 0.10.6 + var state = stream._readableState + if (stream._decoder || (state && (state.encoding || state.decoder))) { + // developer error + return done(createError(500, 'stream encoding should not be set', { + type: 'stream.encoding.set' + })) + } + + if (typeof stream.readable !== 'undefined' && !stream.readable) { + return done(createError(500, 'stream is not readable', { + type: 'stream.not.readable' + })) + } + + var received = 0 + var decoder + + try { + decoder = getDecoder(encoding) + } catch (err) { + return done(err) + } + + var buffer = decoder + ? '' + : [] + + // attach listeners + stream.on('aborted', onAborted) + stream.on('close', cleanup) + stream.on('data', onData) + stream.on('end', onEnd) + stream.on('error', onEnd) + + // mark sync section complete + sync = false + + function done () { + var args = new Array(arguments.length) + + // copy arguments + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + + // mark complete + complete = true + + if (sync) { + process.nextTick(invokeCallback) + } else { + invokeCallback() + } + + function invokeCallback () { + cleanup() + + if (args[0]) { + // halt the stream on error + halt(stream) + } + + callback.apply(null, args) + } + } + + function onAborted () { + if (complete) return + + done(createError(400, 'request aborted', { + code: 'ECONNABORTED', + expected: length, + length: length, + received: received, + type: 'request.aborted' + })) + } + + function onData (chunk) { + if (complete) return + + received += chunk.length + + if (limit !== null && received > limit) { + done(createError(413, 'request entity too large', { + limit: limit, + received: received, + type: 'entity.too.large' + })) + } else if (decoder) { + buffer += decoder.write(chunk) + } else { + buffer.push(chunk) + } + } + + function onEnd (err) { + if (complete) return + if (err) return done(err) + + if (length !== null && received !== length) { + done(createError(400, 'request size did not match content length', { + expected: length, + length: length, + received: received, + type: 'request.size.invalid' + })) + } else { + var string = decoder + ? buffer + (decoder.end() || '') + : Buffer.concat(buffer) + done(null, string) + } + } + + function cleanup () { + buffer = null + + stream.removeListener('aborted', onAborted) + stream.removeListener('data', onData) + stream.removeListener('end', onEnd) + stream.removeListener('error', onEnd) + stream.removeListener('close', cleanup) + } +} + +/** + * Try to require async_hooks + * @private + */ + +function tryRequireAsyncHooks () { + try { + return require('async_hooks') + } catch (e) { + return {} + } +} + +/** + * Wrap function with async resource, if possible. + * AsyncResource.bind static method backported. + * @private + */ + +function wrap (fn) { + var res + + // create anonymous resource + if (asyncHooks.AsyncResource) { + res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn') + } + + // incompatible node.js + if (!res || !res.runInAsyncScope) { + return fn + } + + // return bound function + return res.runInAsyncScope.bind(res, fn, null) +} diff --git a/graphql-subscription-express/node_modules/raw-body/package.json b/graphql-subscription-express/node_modules/raw-body/package.json new file mode 100644 index 0000000..aabb1c3 --- /dev/null +++ b/graphql-subscription-express/node_modules/raw-body/package.json @@ -0,0 +1,49 @@ +{ + "name": "raw-body", + "description": "Get and validate the raw body of a readable stream.", + "version": "2.5.2", + "author": "Jonathan Ong (http://jongleberry.com)", + "contributors": [ + "Douglas Christopher Wilson ", + "Raynos " + ], + "license": "MIT", + "repository": "stream-utils/raw-body", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "devDependencies": { + "bluebird": "3.7.2", + "eslint": "8.34.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "10.2.0", + "nyc": "15.1.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.8" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "SECURITY.md", + "index.d.ts", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "test": "mocha --trace-deprecation --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/safe-buffer/LICENSE b/graphql-subscription-express/node_modules/safe-buffer/LICENSE new file mode 100644 index 0000000..0c068ce --- /dev/null +++ b/graphql-subscription-express/node_modules/safe-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/safe-buffer/README.md b/graphql-subscription-express/node_modules/safe-buffer/README.md new file mode 100644 index 0000000..e9a81af --- /dev/null +++ b/graphql-subscription-express/node_modules/safe-buffer/README.md @@ -0,0 +1,584 @@ +# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/safe-buffer +[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg +[npm-url]: https://npmjs.org/package/safe-buffer +[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg +[downloads-url]: https://npmjs.org/package/safe-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Safer Node.js Buffer API + +**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, +`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** + +**Uses the built-in implementation when available.** + +## install + +``` +npm install safe-buffer +``` + +## usage + +The goal of this package is to provide a safe replacement for the node.js `Buffer`. + +It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to +the top of your node.js modules: + +```js +var Buffer = require('safe-buffer').Buffer + +// Existing buffer code will continue to work without issues: + +new Buffer('hey', 'utf8') +new Buffer([1, 2, 3], 'utf8') +new Buffer(obj) +new Buffer(16) // create an uninitialized buffer (potentially unsafe) + +// But you can use these new explicit APIs to make clear what you want: + +Buffer.from('hey', 'utf8') // convert from many types to a Buffer +Buffer.alloc(16) // create a zero-filled buffer (safe) +Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) +``` + +## api + +### Class Method: Buffer.from(array) + + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) + + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created `Buffer` will share the same allocated memory as the +TypedArray. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) + + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) + + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the character encoding. +If not provided, `encoding` defaults to `'utf8'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) + + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. A zero-length Buffer will be created if a `size` less than or equal to +0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.allocUnsafeSlow(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The +`size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, +allocations under 4KB are, by default, sliced from a single pre-allocated +`Buffer`. This allows applications to avoid the garbage collection overhead of +creating many individually allocated Buffers. This approach improves both +performance and memory usage by eliminating the need to track and cleanup as +many `Persistent` objects. + +However, in the case where a developer may need to retain a small chunk of +memory from a pool for an indeterminate amount of time, it may be appropriate +to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then +copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + const data = socket.read(); + // allocate for retained data + const sb = Buffer.allocUnsafeSlow(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* +a developer has observed undue memory retention in their applications. + +A `TypeError` will be thrown if `size` is not a number. + +### All the Rest + +The rest of the `Buffer` API is exactly the same as in node.js. +[See the docs](https://nodejs.org/api/buffer.html). + + +## Related links + +- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) +- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) + +## Why is `Buffer` unsafe? + +Today, the node.js `Buffer` constructor is overloaded to handle many different argument +types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), +`ArrayBuffer`, and also `Number`. + +The API is optimized for convenience: you can throw any type at it, and it will try to do +what you want. + +Because the Buffer constructor is so powerful, you often see code like this: + +```js +// Convert UTF-8 strings to hex +function toHex (str) { + return new Buffer(str).toString('hex') +} +``` + +***But what happens if `toHex` is called with a `Number` argument?*** + +### Remote Memory Disclosure + +If an attacker can make your program call the `Buffer` constructor with a `Number` +argument, then they can make it allocate uninitialized memory from the node.js process. +This could potentially disclose TLS private keys, user data, or database passwords. + +When the `Buffer` constructor is passed a `Number` argument, it returns an +**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like +this, you **MUST** overwrite the contents before returning it to the user. + +From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): + +> `new Buffer(size)` +> +> - `size` Number +> +> The underlying memory for `Buffer` instances created in this way is not initialized. +> **The contents of a newly created `Buffer` are unknown and could contain sensitive +> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. + +(Emphasis our own.) + +Whenever the programmer intended to create an uninitialized `Buffer` you often see code +like this: + +```js +var buf = new Buffer(16) + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### Would this ever be a problem in real code? + +Yes. It's surprisingly common to forget to check the type of your variables in a +dynamically-typed language like JavaScript. + +Usually the consequences of assuming the wrong type is that your program crashes with an +uncaught exception. But the failure mode for forgetting to check the type of arguments to +the `Buffer` constructor is more catastrophic. + +Here's an example of a vulnerable service that takes a JSON payload and converts it to +hex: + +```js +// Take a JSON payload {str: "some string"} and convert it to hex +var server = http.createServer(function (req, res) { + var data = '' + req.setEncoding('utf8') + req.on('data', function (chunk) { + data += chunk + }) + req.on('end', function () { + var body = JSON.parse(data) + res.end(new Buffer(body.str).toString('hex')) + }) +}) + +server.listen(8080) +``` + +In this example, an http client just has to send: + +```json +{ + "str": 1000 +} +``` + +and it will get back 1,000 bytes of uninitialized memory from the server. + +This is a very serious bug. It's similar in severity to the +[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process +memory by remote attackers. + + +### Which real-world packages were vulnerable? + +#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) + +[Mathias Buus](https://github.com/mafintosh) and I +([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, +[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow +anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get +them to reveal 20 bytes at a time of uninitialized memory from the node.js process. + +Here's +[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) +that fixed it. We released a new fixed version, created a +[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all +vulnerable versions on npm so users will get a warning to upgrade to a newer version. + +#### [`ws`](https://www.npmjs.com/package/ws) + +That got us wondering if there were other vulnerable packages. Sure enough, within a short +period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the +most popular WebSocket implementation in node.js. + +If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as +expected, then uninitialized server memory would be disclosed to the remote peer. + +These were the vulnerable methods: + +```js +socket.send(number) +socket.ping(number) +socket.pong(number) +``` + +Here's a vulnerable socket server with some echo functionality: + +```js +server.on('connection', function (socket) { + socket.on('message', function (message) { + message = JSON.parse(message) + if (message.type === 'echo') { + socket.send(message.data) // send back the user's message + } + }) +}) +``` + +`socket.send(number)` called on the server, will disclose server memory. + +Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue +was fixed, with a more detailed explanation. Props to +[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the +[Node Security Project disclosure](https://nodesecurity.io/advisories/67). + + +### What's the solution? + +It's important that node.js offers a fast way to get memory otherwise performance-critical +applications would needlessly get a lot slower. + +But we need a better way to *signal our intent* as programmers. **When we want +uninitialized memory, we should request it explicitly.** + +Sensitive functionality should not be packed into a developer-friendly API that loosely +accepts many different types. This type of API encourages the lazy practice of passing +variables in without checking the type very carefully. + +#### A new API: `Buffer.allocUnsafe(number)` + +The functionality of creating buffers with uninitialized memory should be part of another +API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that +frequently gets user input of all sorts of different types passed into it. + +```js +var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### How do we fix node.js core? + +We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as +`semver-major`) which defends against one case: + +```js +var str = 16 +new Buffer(str, 'utf8') +``` + +In this situation, it's implied that the programmer intended the first argument to be a +string, since they passed an encoding as a second argument. Today, node.js will allocate +uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not +what the programmer intended. + +But this is only a partial solution, since if the programmer does `new Buffer(variable)` +(without an `encoding` parameter) there's no way to know what they intended. If `variable` +is sometimes a number, then uninitialized memory will sometimes be returned. + +### What's the real long-term fix? + +We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when +we need uninitialized memory. But that would break 1000s of packages. + +~~We believe the best solution is to:~~ + +~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ + +~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ + +#### Update + +We now support adding three new APIs: + +- `Buffer.from(value)` - convert from any type to a buffer +- `Buffer.alloc(size)` - create a zero-filled buffer +- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size + +This solves the core problem that affected `ws` and `bittorrent-dht` which is +`Buffer(variable)` getting tricked into taking a number argument. + +This way, existing code continues working and the impact on the npm ecosystem will be +minimal. Over time, npm maintainers can migrate performance-critical code to use +`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. + + +### Conclusion + +We think there's a serious design issue with the `Buffer` API as it exists today. It +promotes insecure software by putting high-risk functionality into a convenient API +with friendly "developer ergonomics". + +This wasn't merely a theoretical exercise because we found the issue in some of the +most popular npm packages. + +Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of +`buffer`. + +```js +var Buffer = require('safe-buffer').Buffer +``` + +Eventually, we hope that node.js core can switch to this new, safer behavior. We believe +the impact on the ecosystem would be minimal since it's not a breaking change. +Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while +older, insecure packages would magically become safe from this attack vector. + + +## links + +- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) +- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) +- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) + + +## credit + +The original issues in `bittorrent-dht` +([disclosure](https://nodesecurity.io/advisories/68)) and +`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by +[Mathias Buus](https://github.com/mafintosh) and +[Feross Aboukhadijeh](http://feross.org/). + +Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues +and for his work running the [Node Security Project](https://nodesecurity.io/). + +Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and +auditing the code. + + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/graphql-subscription-express/node_modules/safe-buffer/index.d.ts b/graphql-subscription-express/node_modules/safe-buffer/index.d.ts new file mode 100644 index 0000000..e9fed80 --- /dev/null +++ b/graphql-subscription-express/node_modules/safe-buffer/index.d.ts @@ -0,0 +1,187 @@ +declare module "safe-buffer" { + export class Buffer { + length: number + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): { type: 'Buffer', data: any[] }; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + swap16(): Buffer; + swap32(): Buffer; + swap64(): Buffer; + writeUInt8(value: number, offset: number, noAssert?: boolean): number; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeInt8(value: number, offset: number, noAssert?: boolean): number; + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; + fill(value: any, offset?: number, end?: number): this; + indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; + + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ + constructor (str: string, encoding?: string); + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ + constructor (size: number); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: Uint8Array); + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}. + * + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + */ + constructor (arrayBuffer: ArrayBuffer); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: any[]); + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + constructor (buffer: Buffer); + prototype: Buffer; + /** + * Allocates a new Buffer using an {array} of octets. + * + * @param array + */ + static from(array: any[]): Buffer; + /** + * When passed a reference to the .buffer property of a TypedArray instance, + * the newly created Buffer will share the same allocated memory as the TypedArray. + * The optional {byteOffset} and {length} arguments specify a memory range + * within the {arrayBuffer} that will be shared by the Buffer. + * + * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() + * @param byteOffset + * @param length + */ + static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; + /** + * Copies the passed {buffer} data onto a new Buffer instance. + * + * @param buffer + */ + static from(buffer: Buffer): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + * + * @param str + */ + static from(str: string, encoding?: string): Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ + static isBuffer(obj: any): obj is Buffer; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + static isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ + static byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ + static concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + static compare(buf1: Buffer, buf2: Buffer): number; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @param fill if specified, buffer will be initialized by calling buf.fill(fill). + * If parameter is omitted, buffer will be filled with zeros. + * @param encoding encoding used for call to buf.fill while initalizing + */ + static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafe(size: number): Buffer; + /** + * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafeSlow(size: number): Buffer; + } +} \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/safe-buffer/index.js b/graphql-subscription-express/node_modules/safe-buffer/index.js new file mode 100644 index 0000000..f8d3ec9 --- /dev/null +++ b/graphql-subscription-express/node_modules/safe-buffer/index.js @@ -0,0 +1,65 @@ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} diff --git a/graphql-subscription-express/node_modules/safe-buffer/package.json b/graphql-subscription-express/node_modules/safe-buffer/package.json new file mode 100644 index 0000000..f2869e2 --- /dev/null +++ b/graphql-subscription-express/node_modules/safe-buffer/package.json @@ -0,0 +1,51 @@ +{ + "name": "safe-buffer", + "description": "Safer Node.js Buffer API", + "version": "5.2.1", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "https://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "devDependencies": { + "standard": "*", + "tape": "^5.0.0" + }, + "homepage": "https://github.com/feross/safe-buffer", + "keywords": [ + "buffer", + "buffer allocate", + "node security", + "safe", + "safe-buffer", + "security", + "uninitialized" + ], + "license": "MIT", + "main": "index.js", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] +} diff --git a/graphql-subscription-express/node_modules/safer-buffer/LICENSE b/graphql-subscription-express/node_modules/safer-buffer/LICENSE new file mode 100644 index 0000000..4fe9e6f --- /dev/null +++ b/graphql-subscription-express/node_modules/safer-buffer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Nikita Skovoroda + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/safer-buffer/Porting-Buffer.md b/graphql-subscription-express/node_modules/safer-buffer/Porting-Buffer.md new file mode 100644 index 0000000..68d86ba --- /dev/null +++ b/graphql-subscription-express/node_modules/safer-buffer/Porting-Buffer.md @@ -0,0 +1,268 @@ +# Porting to the Buffer.from/Buffer.alloc API + + +## Overview + +- [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*) +- [Variant 2: Use a polyfill](#variant-2) +- [Variant 3: manual detection, with safeguards](#variant-3) + +### Finding problematic bits of code using grep + +Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`. + +It will find all the potentially unsafe places in your own code (with some considerably unlikely +exceptions). + +### Finding problematic bits of code using Node.js 8 + +If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code: + +- `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js. +- `--trace-deprecation` does the same thing, but only for deprecation warnings. +- `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8. + +You can set these flags using an environment variable: + +```console +$ export NODE_OPTIONS='--trace-warnings --pending-deprecation' +$ cat example.js +'use strict'; +const foo = new Buffer('foo'); +$ node example.js +(node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead. + at showFlaggedDeprecation (buffer.js:127:13) + at new Buffer (buffer.js:148:3) + at Object. (/path/to/example.js:2:13) + [... more stack trace lines ...] +``` + +### Finding problematic bits of code using linters + +Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets. + +There is a drawback, though, that it doesn't always +[work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is +overriden e.g. with a polyfill, so recommended is a combination of this and some other method +described above. + + +## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x. + +This is the recommended solution nowadays that would imply only minimal overhead. + +The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible. + +What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way: + +- For `new Buffer(number)`, replace it with `Buffer.alloc(number)`. +- For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`). +- For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`. + +Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than +`new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling. + +Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +is recommended to avoid accidential unsafe Buffer API usage. + +There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005) +for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`. +Note that it currently only works with cases where the arguments are literals or where the +constructor is invoked with two arguments. + +_If you currently support those older Node.js versions and dropping them would be a semver-major change +for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2) +or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive +the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and +your users will not observe a runtime deprecation warning when running your code on Node.js 10._ + + +## Variant 2: Use a polyfill + +Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older +Node.js versions. + +You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill +`const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api. + +Make sure that you do not use old `new Buffer` API — in any files where the line above is added, +using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though. + +Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or +[buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) — +those are great, the only downsides being 4 deps in the tree and slightly more code changes to +migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only +`Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies. + +_Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also +provides a polyfill, but takes a different approach which has +[it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you +to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as +it is problematic, can cause issues in your code, and will start emitting runtime deprecation +warnings starting with Node.js 10._ + +Note that in either case, it is important that you also remove all calls to the old Buffer +API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides +a polyfill for the new API. I have seen people doing that mistake. + +Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +is recommended. + +_Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._ + + +## Variant 3 — manual detection, with safeguards + +This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own +wrapper around them. + +### Buffer(0) + +This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which +returns the same result all the way down to Node.js 0.8.x. + +### Buffer(notNumber) + +Before: + +```js +var buf = new Buffer(notNumber, encoding); +``` + +After: + +```js +var buf; +if (Buffer.from && Buffer.from !== Uint8Array.from) { + buf = Buffer.from(notNumber, encoding); +} else { + if (typeof notNumber === 'number') + throw new Error('The "size" argument must be of type number.'); + buf = new Buffer(notNumber, encoding); +} +``` + +`encoding` is optional. + +Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not +hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the +Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous +security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create +problems ranging from DoS to leaking sensitive information to the attacker from the process memory. + +When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can +be omitted. + +Also note that using TypeScript does not fix this problem for you — when libs written in +`TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as +all type checks are translation-time only and are not present in the actual JS code which TS +compiles to. + +### Buffer(number) + +For Node.js 0.10.x (and below) support: + +```js +var buf; +if (Buffer.alloc) { + buf = Buffer.alloc(number); +} else { + buf = new Buffer(number); + buf.fill(0); +} +``` + +Otherwise (Node.js ≥ 0.12.x): + +```js +const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0); +``` + +## Regarding Buffer.allocUnsafe + +Be extra cautious when using `Buffer.allocUnsafe`: + * Don't use it if you don't have a good reason to + * e.g. you probably won't ever see a performance difference for small buffers, in fact, those + might be even faster with `Buffer.alloc()`, + * if your code is not in the hot code path — you also probably won't notice a difference, + * keep in mind that zero-filling minimizes the potential risks. + * If you use it, make sure that you never return the buffer in a partially-filled state, + * if you are writing to it sequentially — always truncate it to the actuall written length + +Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues, +ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs) +leaking to the remote attacker. + +_Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js +version (and lacking type checks also adds DoS to the list of potential problems)._ + + +## FAQ + + +### What is wrong with the `Buffer` constructor? + +The `Buffer` constructor could be used to create a buffer in many different ways: + +- `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained + *arbitrary memory* for performance reasons, which could include anything ranging from + program source code to passwords and encryption keys. +- `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of + the string `'abc'`. A second argument could specify another encoding: For example, + `new Buffer(string, 'base64')` could be used to convert a Base64 string into the original + sequence of bytes that it represents. +- There are several other combinations of arguments. + +This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell +what exactly the contents of the generated buffer are* without knowing the type of `foo`. + +Sometimes, the value of `foo` comes from an external source. For example, this function +could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form: + +``` +function stringToBase64(req, res) { + // The request body should have the format of `{ string: 'foobar' }` + const rawBytes = new Buffer(req.body.string) + const encoded = rawBytes.toString('base64') + res.end({ encoded: encoded }) +} +``` + +Note that this code does *not* validate the type of `req.body.string`: + +- `req.body.string` is expected to be a string. If this is the case, all goes well. +- `req.body.string` is controlled by the client that sends the request. +- If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes: + - Before Node.js 8, the content would be uninitialized + - After Node.js 8, the content would be `50` bytes with the value `0` + +Because of the missing type check, an attacker could intentionally send a number +as part of the request. Using this, they can either: + +- Read uninitialized memory. This **will** leak passwords, encryption keys and other + kinds of sensitive information. (Information leak) +- Force the program to allocate a large amount of memory. For example, when specifying + `500000000` as the input value, each request will allocate 500MB of memory. + This can be used to either exhaust the memory available of a program completely + and make it crash, or slow it down significantly. (Denial of Service) + +Both of these scenarios are considered serious security issues in a real-world +web server context. + +when using `Buffer.from(req.body.string)` instead, passing a number will always +throw an exception instead, giving a controlled behaviour that can always be +handled by the program. + + +### The `Buffer()` constructor has been deprecated for a while. Is this really an issue? + +Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still +widely used. This includes new code, and overall usage of such code has actually been +*increasing*. diff --git a/graphql-subscription-express/node_modules/safer-buffer/Readme.md b/graphql-subscription-express/node_modules/safer-buffer/Readme.md new file mode 100644 index 0000000..14b0822 --- /dev/null +++ b/graphql-subscription-express/node_modules/safer-buffer/Readme.md @@ -0,0 +1,156 @@ +# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url] + +[travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master +[travis-url]: https://travis-ci.org/ChALkeR/safer-buffer +[npm-image]: https://img.shields.io/npm/v/safer-buffer.svg +[npm-url]: https://npmjs.org/package/safer-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com +[secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg +[secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md + +Modern Buffer API polyfill without footguns, working on Node.js from 0.8 to current. + +## How to use? + +First, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API. + +Then, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use +`const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new +Buffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._ + +Also, see the +[porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide. + +## Do I need it? + +Hopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that +is the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()` +though. + +See the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) +for a better description. + +## Why not [safe-buffer](https://npmjs.com/safe-buffer)? + +_In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and +itself contains footguns._ + +`safe-buffer` could be used safely to get the new API while still keeping support for older +Node.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API +I found out that `safe-buffer` is itself causing problems in some cases. + +For example, consider the following snippet: + +```console +$ cat example.unsafe.js +console.log(Buffer(20)) +$ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js + +$ standard example.unsafe.js +standard: Use JavaScript Standard Style (https://standardjs.com) + /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead. +``` + +This is allocates and writes to console an uninitialized chunk of memory. +[standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people +to avoid using unsafe API. + +Let's now throw in `safe-buffer`! + +```console +$ cat example.safe-buffer.js +const Buffer = require('safe-buffer').Buffer +console.log(Buffer(20)) +$ standard example.safe-buffer.js +$ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js + +``` + +See the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior +remains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out +chunks of uninitialized memory. +_And this code will still emit runtime warnings on Node.js 10.x and above._ + +That was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or +emitting warnings on it, but that significantly diverges from `safe-buffer` design. After some +discussion, it was decided to move my approach into a separate package, and _this is that separate +package_. + +This footgun is not imaginary — I observed top-downloaded packages doing that kind of thing, +«fixing» the lint warning by blindly including `safe-buffer` without any actual changes. + +Also in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request +can bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go +unnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even +pass CI. _I also observed that being done in popular packages._ + +Some examples: + * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31) + (a module with 548 759 downloads/month), + * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61) + (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)), + * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c) + (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)), + * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec) + (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)), + * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1) + (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)). + * And there are a lot more over the ecosystem. + +I filed a PR at +[mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to +partially fix that (for cases when that lint rule is used), but it is a semver-major change for +linter rules and presets, so it would take significant time for that to reach actual setups. +_It also hasn't been released yet (2018-03-20)._ + +Also, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake. +It still supports it with an explicit concern barier, by placing it under +`require('safer-buffer/dangereous')`. + +## But isn't throwing bad? + +Not really. It's an error that could be noticed and fixed early, instead of causing havoc later like +unguarded `new Buffer()` calls that end up receiving user input can do. + +This package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so +it is really simple to keep track of things and make sure that you don't mix old API usage with that. +Also, CI should hint anything that you might have missed. + +New commits, if tested, won't land new usage of unsafe Buffer API this way. +_Node.js 10.x also deals with that by printing a runtime depecation warning._ + +### Would it affect third-party modules? + +No, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`. +Don't do that. + +### But I don't want throwing… + +That is also fine! + +Also, it could be better in some cases when you don't comprehensive enough test coverage. + +In that case — just don't override `Buffer` and use +`var SaferBuffer = require('safer-buffer').Buffer` instead. + +That way, everything using `Buffer` natively would still work, but there would be two drawbacks: + +* `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and + `SaferBuffer.alloc` instead. +* You are still open to accidentally using the insecure deprecated API — use a linter to catch that. + +Note that using a linter to catch accidential `Buffer` constructor usage in this case is strongly +recommended. `Buffer` is not overriden in this usecase, so linters won't get confused. + +## «Without footguns»? + +Well, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property +on older versions and duping things from there. You shouldn't do that in your code, probabably. + +The intention is to remove the most significant footguns that affect lots of packages in the +ecosystem, and to do it in the proper way. + +Also, this package doesn't protect against security issues affecting some Node.js versions, so for +usage in your own production code, it is still recommended to update to a Node.js version +[supported by upstream](https://github.com/nodejs/release#release-schedule). diff --git a/graphql-subscription-express/node_modules/safer-buffer/dangerous.js b/graphql-subscription-express/node_modules/safer-buffer/dangerous.js new file mode 100644 index 0000000..ca41fdc --- /dev/null +++ b/graphql-subscription-express/node_modules/safer-buffer/dangerous.js @@ -0,0 +1,58 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var buffer = require('buffer') +var Buffer = buffer.Buffer +var safer = require('./safer.js') +var Safer = safer.Buffer + +var dangerous = {} + +var key + +for (key in safer) { + if (!safer.hasOwnProperty(key)) continue + dangerous[key] = safer[key] +} + +var Dangereous = dangerous.Buffer = {} + +// Copy Safer API +for (key in Safer) { + if (!Safer.hasOwnProperty(key)) continue + Dangereous[key] = Safer[key] +} + +// Copy those missing unsafe methods, if they are present +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (Dangereous.hasOwnProperty(key)) continue + Dangereous[key] = Buffer[key] +} + +if (!Dangereous.allocUnsafe) { + Dangereous.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + return Buffer(size) + } +} + +if (!Dangereous.allocUnsafeSlow) { + Dangereous.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + return buffer.SlowBuffer(size) + } +} + +module.exports = dangerous diff --git a/graphql-subscription-express/node_modules/safer-buffer/package.json b/graphql-subscription-express/node_modules/safer-buffer/package.json new file mode 100644 index 0000000..d452b04 --- /dev/null +++ b/graphql-subscription-express/node_modules/safer-buffer/package.json @@ -0,0 +1,34 @@ +{ + "name": "safer-buffer", + "version": "2.1.2", + "description": "Modern Buffer API polyfill without footguns", + "main": "safer.js", + "scripts": { + "browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js", + "test": "standard && tape tests.js" + }, + "author": { + "name": "Nikita Skovoroda", + "email": "chalkerx@gmail.com", + "url": "https://github.com/ChALkeR" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ChALkeR/safer-buffer.git" + }, + "bugs": { + "url": "https://github.com/ChALkeR/safer-buffer/issues" + }, + "devDependencies": { + "standard": "^11.0.1", + "tape": "^4.9.0" + }, + "files": [ + "Porting-Buffer.md", + "Readme.md", + "tests.js", + "dangerous.js", + "safer.js" + ] +} diff --git a/graphql-subscription-express/node_modules/safer-buffer/safer.js b/graphql-subscription-express/node_modules/safer-buffer/safer.js new file mode 100644 index 0000000..37c7e1a --- /dev/null +++ b/graphql-subscription-express/node_modules/safer-buffer/safer.js @@ -0,0 +1,77 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var buffer = require('buffer') +var Buffer = buffer.Buffer + +var safer = {} + +var key + +for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue + if (key === 'SlowBuffer' || key === 'Buffer') continue + safer[key] = buffer[key] +} + +var Safer = safer.Buffer = {} +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue + Safer[key] = Buffer[key] +} + +safer.Buffer.prototype = Buffer.prototype + +if (!Safer.from || Safer.from === Uint8Array.from) { + Safer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) + } + if (value && typeof value.length === 'undefined') { + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + } + return Buffer(value, encodingOrOffset, length) + } +} + +if (!Safer.alloc) { + Safer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + var buf = Buffer(size) + if (!fill || fill.length === 0) { + buf.fill(0) + } else if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + return buf + } +} + +if (!safer.kStringMaxLength) { + try { + safer.kStringMaxLength = process.binding('buffer').kStringMaxLength + } catch (e) { + // we can't determine kStringMaxLength in environments where process.binding + // is unsupported, so let's not set it + } +} + +if (!safer.constants) { + safer.constants = { + MAX_LENGTH: safer.kMaxLength + } + if (safer.kStringMaxLength) { + safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + } +} + +module.exports = safer diff --git a/graphql-subscription-express/node_modules/safer-buffer/tests.js b/graphql-subscription-express/node_modules/safer-buffer/tests.js new file mode 100644 index 0000000..7ed2777 --- /dev/null +++ b/graphql-subscription-express/node_modules/safer-buffer/tests.js @@ -0,0 +1,406 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var test = require('tape') + +var buffer = require('buffer') + +var index = require('./') +var safer = require('./safer') +var dangerous = require('./dangerous') + +/* Inheritance tests */ + +test('Default is Safer', function (t) { + t.equal(index, safer) + t.notEqual(safer, dangerous) + t.notEqual(index, dangerous) + t.end() +}) + +test('Is not a function', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(typeof impl, 'object') + t.equal(typeof impl.Buffer, 'object') + }); + [buffer].forEach(function (impl) { + t.equal(typeof impl, 'object') + t.equal(typeof impl.Buffer, 'function') + }) + t.end() +}) + +test('Constructor throws', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.throws(function () { impl.Buffer() }) + t.throws(function () { impl.Buffer(0) }) + t.throws(function () { impl.Buffer('a') }) + t.throws(function () { impl.Buffer('a', 'utf-8') }) + t.throws(function () { return new impl.Buffer() }) + t.throws(function () { return new impl.Buffer(0) }) + t.throws(function () { return new impl.Buffer('a') }) + t.throws(function () { return new impl.Buffer('a', 'utf-8') }) + }) + t.end() +}) + +test('Safe methods exist', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(typeof impl.Buffer.alloc, 'function', 'alloc') + t.equal(typeof impl.Buffer.from, 'function', 'from') + }) + t.end() +}) + +test('Unsafe methods exist only in Dangerous', function (t) { + [index, safer].forEach(function (impl) { + t.equal(typeof impl.Buffer.allocUnsafe, 'undefined') + t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined') + }); + [dangerous].forEach(function (impl) { + t.equal(typeof impl.Buffer.allocUnsafe, 'function') + t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function') + }) + t.end() +}) + +test('Generic methods/properties are defined and equal', function (t) { + ['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], buffer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Built-in buffer static methods/properties are inherited', function (t) { + Object.keys(buffer).forEach(function (method) { + if (method === 'SlowBuffer' || method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], buffer[method], method) + t.notEqual(typeof impl[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Built-in Buffer static methods/properties are inherited', function (t) { + Object.keys(buffer.Buffer).forEach(function (method) { + if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], buffer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('.prototype property of Buffer is inherited', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype') + t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype') + }) + t.end() +}) + +test('All Safer methods are present in Dangerous', function (t) { + Object.keys(safer).forEach(function (method) { + if (method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], safer[method], method) + if (method !== 'kStringMaxLength') { + t.notEqual(typeof impl[method], 'undefined', method) + } + }) + }) + Object.keys(safer.Buffer).forEach(function (method) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], safer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Safe methods from Dangerous methods are present in Safer', function (t) { + Object.keys(dangerous).forEach(function (method) { + if (method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], dangerous[method], method) + if (method !== 'kStringMaxLength') { + t.notEqual(typeof impl[method], 'undefined', method) + } + }) + }) + Object.keys(dangerous.Buffer).forEach(function (method) { + if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], dangerous.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +/* Behaviour tests */ + +test('Methods return Buffers', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(''))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3]))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3])))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([]))) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0))) + t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10))) + }) + t.end() +}) + +test('Constructor is buffer.Buffer', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('string').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer) + t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer) + t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer) + t.equal(impl.Buffer.from([]).constructor, buffer.Buffer) + }); + [0, 10, 100].forEach(function (arg) { + t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer) + t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor) + }) + t.end() +}) + +test('Invalid calls throw', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.throws(function () { impl.Buffer.from(0) }) + t.throws(function () { impl.Buffer.from(10) }) + t.throws(function () { impl.Buffer.from(10, 'utf-8') }) + t.throws(function () { impl.Buffer.from('string', 'invalid encoding') }) + t.throws(function () { impl.Buffer.from(-10) }) + t.throws(function () { impl.Buffer.from(1e90) }) + t.throws(function () { impl.Buffer.from(Infinity) }) + t.throws(function () { impl.Buffer.from(-Infinity) }) + t.throws(function () { impl.Buffer.from(NaN) }) + t.throws(function () { impl.Buffer.from(null) }) + t.throws(function () { impl.Buffer.from(undefined) }) + t.throws(function () { impl.Buffer.from() }) + t.throws(function () { impl.Buffer.from({}) }) + t.throws(function () { impl.Buffer.alloc('') }) + t.throws(function () { impl.Buffer.alloc('string') }) + t.throws(function () { impl.Buffer.alloc('string', 'utf-8') }) + t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') }) + t.throws(function () { impl.Buffer.alloc(-10) }) + t.throws(function () { impl.Buffer.alloc(1e90) }) + t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) }) + t.throws(function () { impl.Buffer.alloc(Infinity) }) + t.throws(function () { impl.Buffer.alloc(-Infinity) }) + t.throws(function () { impl.Buffer.alloc(null) }) + t.throws(function () { impl.Buffer.alloc(undefined) }) + t.throws(function () { impl.Buffer.alloc() }) + t.throws(function () { impl.Buffer.alloc([]) }) + t.throws(function () { impl.Buffer.alloc([0, 42, 3]) }) + t.throws(function () { impl.Buffer.alloc({}) }) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.throws(function () { dangerous.Buffer[method]('') }) + t.throws(function () { dangerous.Buffer[method]('string') }) + t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') }) + t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) }) + t.throws(function () { dangerous.Buffer[method](Infinity) }) + if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) { + t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0') + } else { + t.throws(function () { dangerous.Buffer[method](-10) }) + t.throws(function () { dangerous.Buffer[method](-1e90) }) + t.throws(function () { dangerous.Buffer[method](-Infinity) }) + } + t.throws(function () { dangerous.Buffer[method](null) }) + t.throws(function () { dangerous.Buffer[method](undefined) }) + t.throws(function () { dangerous.Buffer[method]() }) + t.throws(function () { dangerous.Buffer[method]([]) }) + t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) }) + t.throws(function () { dangerous.Buffer[method]({}) }) + }) + t.end() +}) + +test('Buffers have appropriate lengths', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.alloc(0).length, 0) + t.equal(impl.Buffer.alloc(10).length, 10) + t.equal(impl.Buffer.from('').length, 0) + t.equal(impl.Buffer.from('string').length, 6) + t.equal(impl.Buffer.from('string', 'utf-8').length, 6) + t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11) + t.equal(impl.Buffer.from([0, 42, 3]).length, 3) + t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3) + t.equal(impl.Buffer.from([]).length, 0) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.equal(dangerous.Buffer[method](0).length, 0) + t.equal(dangerous.Buffer[method](10).length, 10) + }) + t.end() +}) + +test('Buffers have appropriate lengths (2)', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true; + [ safer.Buffer.alloc, + dangerous.Buffer.allocUnsafe, + dangerous.Buffer.allocUnsafeSlow + ].forEach(function (method) { + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 1e5) + var buf = method(length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + } + }) + t.ok(ok) + t.end() +}) + +test('.alloc(size) is zero-filled and has correct length', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var buf = index.Buffer.alloc(length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + var j + for (j = 0; j < length; j++) { + if (buf[j] !== 0) ok = false + } + buf.fill(1) + for (j = 0; j < length; j++) { + if (buf[j] !== 1) ok = false + } + } + t.ok(ok) + t.end() +}) + +test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) { + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var buf = dangerous.Buffer[method](length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + buf.fill(0, 0, length) + var j + for (j = 0; j < length; j++) { + if (buf[j] !== 0) ok = false + } + buf.fill(1, 0, length) + for (j = 0; j < length; j++) { + if (buf[j] !== 1) ok = false + } + } + t.ok(ok, method) + }) + t.end() +}) + +test('.alloc(size, fill) is `fill`-filled', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var fill = Math.round(Math.random() * 255) + var buf = index.Buffer.alloc(length, fill) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + for (var j = 0; j < length; j++) { + if (buf[j] !== fill) ok = false + } + } + t.ok(ok) + t.end() +}) + +test('.alloc(size, fill) is `fill`-filled', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var fill = Math.round(Math.random() * 255) + var buf = index.Buffer.alloc(length, fill) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + for (var j = 0; j < length; j++) { + if (buf[j] !== fill) ok = false + } + } + t.ok(ok) + t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97)) + t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98)) + + var tmp = new buffer.Buffer(2) + tmp.fill('ok') + if (tmp[1] === tmp[0]) { + // Outdated Node.js + t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo')) + } else { + t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko')) + } + t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok')) + + t.end() +}) + +test('safer.Buffer.from returns results same as Buffer constructor', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.deepEqual(impl.Buffer.from(''), new buffer.Buffer('')) + t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string')) + t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8')) + t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64')) + t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3])) + t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3]))) + t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([])) + }) + t.end() +}) + +test('safer.Buffer.from returns consistent results', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string')) + t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103])) + t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string'))) + t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree')) + t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree')) + }) + t.end() +}) diff --git a/graphql-subscription-express/node_modules/send/HISTORY.md b/graphql-subscription-express/node_modules/send/HISTORY.md new file mode 100644 index 0000000..a739774 --- /dev/null +++ b/graphql-subscription-express/node_modules/send/HISTORY.md @@ -0,0 +1,521 @@ +0.18.0 / 2022-03-23 +=================== + + * Fix emitted 416 error missing headers property + * Limit the headers removed for 304 response + * deps: depd@2.0.0 + - Replace internal `eval` usage with `Function` constructor + - Use instance methods on `process` to check for listeners + * deps: destroy@1.2.0 + * deps: http-errors@2.0.0 + - deps: depd@2.0.0 + - deps: statuses@2.0.1 + * deps: on-finished@2.4.1 + * deps: statuses@2.0.1 + +0.17.2 / 2021-12-11 +=================== + + * pref: ignore empty http tokens + * deps: http-errors@1.8.1 + - deps: inherits@2.0.4 + - deps: toidentifier@1.0.1 + - deps: setprototypeof@1.2.0 + * deps: ms@2.1.3 + +0.17.1 / 2019-05-10 +=================== + + * Set stricter CSP header in redirect & error responses + * deps: range-parser@~1.2.1 + +0.17.0 / 2019-05-03 +=================== + + * deps: http-errors@~1.7.2 + - Set constructor name when possible + - Use `toidentifier` module to make class names + - deps: depd@~1.1.2 + - deps: setprototypeof@1.1.1 + - deps: statuses@'>= 1.5.0 < 2' + * deps: mime@1.6.0 + - Add extensions for JPEG-2000 images + - Add new `font/*` types from IANA + - Add WASM mapping + - Update `.bdoc` to `application/bdoc` + - Update `.bmp` to `image/bmp` + - Update `.m4a` to `audio/mp4` + - Update `.rtf` to `application/rtf` + - Update `.wav` to `audio/wav` + - Update `.xml` to `application/xml` + - Update generic extensions to `application/octet-stream`: + `.deb`, `.dll`, `.dmg`, `.exe`, `.iso`, `.msi` + - Use mime-score module to resolve extension conflicts + * deps: ms@2.1.1 + - Add `week`/`w` support + - Fix negative number handling + * deps: statuses@~1.5.0 + * perf: remove redundant `path.normalize` call + +0.16.2 / 2018-02-07 +=================== + + * Fix incorrect end tag in default error & redirects + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: encodeurl@~1.0.2 + - Fix encoding `%` as last character + * deps: statuses@~1.4.0 + +0.16.1 / 2017-09-29 +=================== + + * Fix regression in edge-case behavior for empty `path` + +0.16.0 / 2017-09-27 +=================== + + * Add `immutable` option + * Fix missing `` in default error & redirects + * Use instance methods on steam to check for listeners + * deps: mime@1.4.1 + - Add 70 new types for file extensions + - Set charset as "UTF-8" for .js and .json + * perf: improve path validation speed + +0.15.6 / 2017-09-22 +=================== + + * deps: debug@2.6.9 + * perf: improve `If-Match` token parsing + +0.15.5 / 2017-09-20 +=================== + + * deps: etag@~1.8.1 + - perf: replace regular expression with substring + * deps: fresh@0.5.2 + - Fix handling of modified headers with invalid dates + - perf: improve ETag match loop + - perf: improve `If-None-Match` token parsing + +0.15.4 / 2017-08-05 +=================== + + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: http-errors@~1.6.2 + - deps: depd@1.1.1 + +0.15.3 / 2017-05-16 +=================== + + * deps: debug@2.6.7 + - deps: ms@2.0.0 + * deps: ms@2.0.0 + +0.15.2 / 2017-04-26 +=================== + + * deps: debug@2.6.4 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@0.7.3 + * deps: ms@1.0.0 + +0.15.1 / 2017-03-04 +=================== + + * Fix issue when `Date.parse` does not return `NaN` on invalid date + * Fix strict violation in broken environments + +0.15.0 / 2017-02-25 +=================== + + * Support `If-Match` and `If-Unmodified-Since` headers + * Add `res` and `path` arguments to `directory` event + * Remove usage of `res._headers` private field + - Improves compatibility with Node.js 8 nightly + * Send complete HTML document in redirect & error responses + * Set default CSP header in redirect & error responses + * Use `res.getHeaderNames()` when available + * Use `res.headersSent` when available + * deps: debug@2.6.1 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable set to `3` or higher + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: etag@~1.8.0 + * deps: fresh@0.5.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - perf: delay reading header values until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove duplicate conditional + - perf: remove unnecessary boolean coercions + - perf: skip checking modified time if ETag check failed + - perf: skip parsing `If-None-Match` when no `ETag` header + - perf: use `Date.parse` instead of `new Date` + * deps: http-errors@~1.6.1 + - Make `message` property enumerable for `HttpError`s + - deps: setprototypeof@1.0.3 + +0.14.2 / 2017-01-23 +=================== + + * deps: http-errors@~1.5.1 + - deps: inherits@2.0.3 + - deps: setprototypeof@1.0.2 + - deps: statuses@'>= 1.3.1 < 2' + * deps: ms@0.7.2 + * deps: statuses@~1.3.1 + +0.14.1 / 2016-06-09 +=================== + + * Fix redirect error when `path` contains raw non-URL characters + * Fix redirect when `path` starts with multiple forward slashes + +0.14.0 / 2016-06-06 +=================== + + * Add `acceptRanges` option + * Add `cacheControl` option + * Attempt to combine multiple ranges into single range + * Correctly inherit from `Stream` class + * Fix `Content-Range` header in 416 responses when using `start`/`end` options + * Fix `Content-Range` header missing from default 416 responses + * Ignore non-byte `Range` headers + * deps: http-errors@~1.5.0 + - Add `HttpError` export, for `err instanceof createError.HttpError` + - Support new code `421 Misdirected Request` + - Use `setprototypeof` module to replace `__proto__` setting + - deps: inherits@2.0.1 + - deps: statuses@'>= 1.3.0 < 2' + - perf: enable strict mode + * deps: range-parser@~1.2.0 + - Fix incorrectly returning -1 when there is at least one valid range + - perf: remove internal function + * deps: statuses@~1.3.0 + - Add `421 Misdirected Request` + - perf: enable strict mode + * perf: remove argument reassignment + +0.13.2 / 2016-03-05 +=================== + + * Fix invalid `Content-Type` header when `send.mime.default_type` unset + +0.13.1 / 2016-01-16 +=================== + + * deps: depd@~1.1.0 + - Support web browser loading + - perf: enable strict mode + * deps: destroy@~1.0.4 + - perf: enable strict mode + * deps: escape-html@~1.0.3 + - perf: enable strict mode + - perf: optimize string replacement + - perf: use faster string coercion + * deps: range-parser@~1.0.3 + - perf: enable strict mode + +0.13.0 / 2015-06-16 +=================== + + * Allow Node.js HTTP server to set `Date` response header + * Fix incorrectly removing `Content-Location` on 304 response + * Improve the default redirect response headers + * Send appropriate headers on default error response + * Use `http-errors` for standard emitted errors + * Use `statuses` instead of `http` module for status messages + * deps: escape-html@1.0.2 + * deps: etag@~1.7.0 + - Improve stat performance by removing hashing + * deps: fresh@0.3.0 + - Add weak `ETag` matching support + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * perf: enable strict mode + * perf: remove unnecessary array allocations + +0.12.3 / 2015-05-13 +=================== + + * deps: debug@~2.2.0 + - deps: ms@0.7.1 + * deps: depd@~1.0.1 + * deps: etag@~1.6.0 + - Improve support for JXcore + - Support "fake" stats objects in environments without `fs` + * deps: ms@0.7.1 + - Prevent extraordinarily long inputs + * deps: on-finished@~2.2.1 + +0.12.2 / 2015-03-13 +=================== + + * Throw errors early for invalid `extensions` or `index` options + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + +0.12.1 / 2015-02-17 +=================== + + * Fix regression sending zero-length files + +0.12.0 / 2015-02-16 +=================== + + * Always read the stat size from the file + * Fix mutating passed-in `options` + * deps: mime@1.3.4 + +0.11.1 / 2015-01-20 +=================== + + * Fix `root` path disclosure + +0.11.0 / 2015-01-05 +=================== + + * deps: debug@~2.1.1 + * deps: etag@~1.5.1 + - deps: crc@3.2.1 + * deps: ms@0.7.0 + - Add `milliseconds` + - Add `msecs` + - Add `secs` + - Add `mins` + - Add `hrs` + - Add `yrs` + * deps: on-finished@~2.2.0 + +0.10.1 / 2014-10-22 +=================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + +0.10.0 / 2014-10-15 +=================== + + * deps: debug@~2.1.0 + - Implement `DEBUG_FD` env variable support + * deps: depd@~1.0.0 + * deps: etag@~1.5.0 + - Improve string performance + - Slightly improve speed for weak ETags over 1KB + +0.9.3 / 2014-09-24 +================== + + * deps: etag@~1.4.0 + - Support "fake" stats objects + +0.9.2 / 2014-09-15 +================== + + * deps: depd@0.4.5 + * deps: etag@~1.3.1 + * deps: range-parser@~1.0.2 + +0.9.1 / 2014-09-07 +================== + + * deps: fresh@0.2.4 + +0.9.0 / 2014-09-07 +================== + + * Add `lastModified` option + * Use `etag` to generate `ETag` header + * deps: debug@~2.0.0 + +0.8.5 / 2014-09-04 +================== + + * Fix malicious path detection for empty string path + +0.8.4 / 2014-09-04 +================== + + * Fix a path traversal issue when using `root` + +0.8.3 / 2014-08-16 +================== + + * deps: destroy@1.0.3 + - renamed from dethroy + * deps: on-finished@2.1.0 + +0.8.2 / 2014-08-14 +================== + + * Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + * deps: dethroy@1.0.2 + +0.8.1 / 2014-08-05 +================== + + * Fix `extensions` behavior when file already has extension + +0.8.0 / 2014-08-05 +================== + + * Add `extensions` option + +0.7.4 / 2014-08-04 +================== + + * Fix serving index files without root dir + +0.7.3 / 2014-07-29 +================== + + * Fix incorrect 403 on Windows and Node.js 0.11 + +0.7.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +0.7.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +0.7.0 / 2014-07-20 +================== + + * Deprecate `hidden` option; use `dotfiles` option + * Add `dotfiles` option + * deps: debug@1.0.4 + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + +0.6.0 / 2014-07-11 +================== + + * Deprecate `from` option; use `root` option + * Deprecate `send.etag()` -- use `etag` in `options` + * Deprecate `send.hidden()` -- use `hidden` in `options` + * Deprecate `send.index()` -- use `index` in `options` + * Deprecate `send.maxage()` -- use `maxAge` in `options` + * Deprecate `send.root()` -- use `root` in `options` + * Cap `maxAge` value to 1 year + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + +0.5.0 / 2014-06-28 +================== + + * Accept string for `maxAge` (converted by `ms`) + * Add `headers` event + * Include link in default redirect response + * Use `EventEmitter.listenerCount` to count listeners + +0.4.3 / 2014-06-11 +================== + + * Do not throw un-catchable error on file open race condition + * Use `escape-html` for HTML escaping + * deps: debug@1.0.2 + - fix some debugging output colors on node.js 0.8 + * deps: finished@1.2.2 + * deps: fresh@0.2.2 + +0.4.2 / 2014-06-09 +================== + + * fix "event emitter leak" warnings + * deps: debug@1.0.1 + * deps: finished@1.2.1 + +0.4.1 / 2014-06-02 +================== + + * Send `max-age` in `Cache-Control` in correct format + +0.4.0 / 2014-05-27 +================== + + * Calculate ETag with md5 for reduced collisions + * Fix wrong behavior when index file matches directory + * Ignore stream errors after request ends + - Goodbye `EBADF, read` + * Skip directories in index file search + * deps: debug@0.8.1 + +0.3.0 / 2014-04-24 +================== + + * Fix sending files with dots without root set + * Coerce option types + * Accept API options in options object + * Set etags to "weak" + * Include file path in etag + * Make "Can't set headers after they are sent." catchable + * Send full entity-body for multi range requests + * Default directory access to 403 when index disabled + * Support multiple index paths + * Support "If-Range" header + * Control whether to generate etags + * deps: mime@1.2.11 + +0.2.0 / 2014-01-29 +================== + + * update range-parser and fresh + +0.1.4 / 2013-08-11 +================== + + * update fresh + +0.1.3 / 2013-07-08 +================== + + * Revert "Fix fd leak" + +0.1.2 / 2013-07-03 +================== + + * Fix fd leak + +0.1.0 / 2012-08-25 +================== + + * add options parameter to send() that is passed to fs.createReadStream() [kanongil] + +0.0.4 / 2012-08-16 +================== + + * allow custom "Accept-Ranges" definition + +0.0.3 / 2012-07-16 +================== + + * fix normalization of the root directory. Closes #3 + +0.0.2 / 2012-07-09 +================== + + * add passing of req explicitly for now (YUCK) + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/send/LICENSE b/graphql-subscription-express/node_modules/send/LICENSE new file mode 100644 index 0000000..b6ea1c1 --- /dev/null +++ b/graphql-subscription-express/node_modules/send/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk +Copyright (c) 2014-2022 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/send/README.md b/graphql-subscription-express/node_modules/send/README.md new file mode 100644 index 0000000..fadf838 --- /dev/null +++ b/graphql-subscription-express/node_modules/send/README.md @@ -0,0 +1,327 @@ +# send + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Linux Build][github-actions-ci-image]][github-actions-ci-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Send is a library for streaming files from the file system as a http response +supporting partial responses (Ranges), conditional-GET negotiation (If-Match, +If-Unmodified-Since, If-None-Match, If-Modified-Since), high test coverage, +and granular events which may be leveraged to take appropriate actions in your +application or framework. + +Looking to serve up entire folders mapped to URLs? Try [serve-static](https://www.npmjs.org/package/serve-static). + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```bash +$ npm install send +``` + +## API + +```js +var send = require('send') +``` + +### send(req, path, [options]) + +Create a new `SendStream` for the given path to send to a `res`. The `req` is +the Node.js HTTP request and the `path` is a urlencoded path to send (urlencoded, +not the actual file-system path). + +#### Options + +##### acceptRanges + +Enable or disable accepting ranged requests, defaults to true. +Disabling this will not send `Accept-Ranges` and ignore the contents +of the `Range` request header. + +##### cacheControl + +Enable or disable setting `Cache-Control` response header, defaults to +true. Disabling this will ignore the `immutable` and `maxAge` options. + +##### dotfiles + +Set how "dotfiles" are treated when encountered. A dotfile is a file +or directory that begins with a dot ("."). Note this check is done on +the path itself without checking if the path actually exists on the +disk. If `root` is specified, only the dotfiles above the root are +checked (i.e. the root itself can be within a dotfile when when set +to "deny"). + + - `'allow'` No special treatment for dotfiles. + - `'deny'` Send a 403 for any request for a dotfile. + - `'ignore'` Pretend like the dotfile does not exist and 404. + +The default value is _similar_ to `'ignore'`, with the exception that +this default will not ignore the files within a directory that begins +with a dot, for backward-compatibility. + +##### end + +Byte offset at which the stream ends, defaults to the length of the file +minus 1. The end is inclusive in the stream, meaning `end: 3` will include +the 4th byte in the stream. + +##### etag + +Enable or disable etag generation, defaults to true. + +##### extensions + +If a given file doesn't exist, try appending one of the given extensions, +in the given order. By default, this is disabled (set to `false`). An +example value that will serve extension-less HTML files: `['html', 'htm']`. +This is skipped if the requested file already has an extension. + +##### immutable + +Enable or disable the `immutable` directive in the `Cache-Control` response +header, defaults to `false`. If set to `true`, the `maxAge` option should +also be specified to enable caching. The `immutable` directive will prevent +supported clients from making conditional requests during the life of the +`maxAge` option to check if the file has changed. + +##### index + +By default send supports "index.html" files, to disable this +set `false` or to supply a new index pass a string or an array +in preferred order. + +##### lastModified + +Enable or disable `Last-Modified` header, defaults to true. Uses the file +system's last modified value. + +##### maxAge + +Provide a max-age in milliseconds for http caching, defaults to 0. +This can also be a string accepted by the +[ms](https://www.npmjs.org/package/ms#readme) module. + +##### root + +Serve files relative to `path`. + +##### start + +Byte offset at which the stream starts, defaults to 0. The start is inclusive, +meaning `start: 2` will include the 3rd byte in the stream. + +#### Events + +The `SendStream` is an event emitter and will emit the following events: + + - `error` an error occurred `(err)` + - `directory` a directory was requested `(res, path)` + - `file` a file was requested `(path, stat)` + - `headers` the headers are about to be set on a file `(res, path, stat)` + - `stream` file streaming has started `(stream)` + - `end` streaming has completed + +#### .pipe + +The `pipe` method is used to pipe the response into the Node.js HTTP response +object, typically `send(req, path, options).pipe(res)`. + +### .mime + +The `mime` export is the global instance of of the +[`mime` npm module](https://www.npmjs.com/package/mime). + +This is used to configure the MIME types that are associated with file extensions +as well as other options for how to resolve the MIME type of a file (like the +default type to use for an unknown file extension). + +## Error-handling + +By default when no `error` listeners are present an automatic response will be +made, otherwise you have full control over the response, aka you may show a 5xx +page etc. + +## Caching + +It does _not_ perform internal caching, you should use a reverse proxy cache +such as Varnish for this, or those fancy things called CDNs. If your +application is small enough that it would benefit from single-node memory +caching, it's small enough that it does not need caching at all ;). + +## Debugging + +To enable `debug()` instrumentation output export __DEBUG__: + +``` +$ DEBUG=send node app +``` + +## Running tests + +``` +$ npm install +$ npm test +``` + +## Examples + +### Serve a specific file + +This simple example will send a specific file to all requests. + +```js +var http = require('http') +var send = require('send') + +var server = http.createServer(function onRequest (req, res) { + send(req, '/path/to/index.html') + .pipe(res) +}) + +server.listen(3000) +``` + +### Serve all files from a directory + +This simple example will just serve up all the files in a +given directory as the top-level. For example, a request +`GET /foo.txt` will send back `/www/public/foo.txt`. + +```js +var http = require('http') +var parseUrl = require('parseurl') +var send = require('send') + +var server = http.createServer(function onRequest (req, res) { + send(req, parseUrl(req).pathname, { root: '/www/public' }) + .pipe(res) +}) + +server.listen(3000) +``` + +### Custom file types + +```js +var http = require('http') +var parseUrl = require('parseurl') +var send = require('send') + +// Default unknown types to text/plain +send.mime.default_type = 'text/plain' + +// Add a custom type +send.mime.define({ + 'application/x-my-type': ['x-mt', 'x-mtt'] +}) + +var server = http.createServer(function onRequest (req, res) { + send(req, parseUrl(req).pathname, { root: '/www/public' }) + .pipe(res) +}) + +server.listen(3000) +``` + +### Custom directory index view + +This is a example of serving up a structure of directories with a +custom function to render a listing of a directory. + +```js +var http = require('http') +var fs = require('fs') +var parseUrl = require('parseurl') +var send = require('send') + +// Transfer arbitrary files from within /www/example.com/public/* +// with a custom handler for directory listing +var server = http.createServer(function onRequest (req, res) { + send(req, parseUrl(req).pathname, { index: false, root: '/www/public' }) + .once('directory', directory) + .pipe(res) +}) + +server.listen(3000) + +// Custom directory handler +function directory (res, path) { + var stream = this + + // redirect to trailing slash for consistent url + if (!stream.hasTrailingSlash()) { + return stream.redirect(path) + } + + // get directory list + fs.readdir(path, function onReaddir (err, list) { + if (err) return stream.error(err) + + // render an index for the directory + res.setHeader('Content-Type', 'text/plain; charset=UTF-8') + res.end(list.join('\n') + '\n') + }) +} +``` + +### Serving from a root directory with custom error-handling + +```js +var http = require('http') +var parseUrl = require('parseurl') +var send = require('send') + +var server = http.createServer(function onRequest (req, res) { + // your custom error-handling logic: + function error (err) { + res.statusCode = err.status || 500 + res.end(err.message) + } + + // your custom headers + function headers (res, path, stat) { + // serve all files for download + res.setHeader('Content-Disposition', 'attachment') + } + + // your custom directory handling logic: + function redirect () { + res.statusCode = 301 + res.setHeader('Location', req.url + '/') + res.end('Redirecting to ' + req.url + '/') + } + + // transfer arbitrary files from within + // /www/example.com/public/* + send(req, parseUrl(req).pathname, { root: '/www/public' }) + .on('error', error) + .on('directory', redirect) + .on('headers', headers) + .pipe(res) +}) + +server.listen(3000) +``` + +## License + +[MIT](LICENSE) + +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/send/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/send +[coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/send/master +[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master +[github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=linux +[github-actions-ci-url]: https://github.com/pillarjs/send/actions/workflows/ci.yml +[node-image]: https://badgen.net/npm/node/send +[node-url]: https://nodejs.org/en/download/ +[npm-downloads-image]: https://badgen.net/npm/dm/send +[npm-url]: https://npmjs.org/package/send +[npm-version-image]: https://badgen.net/npm/v/send diff --git a/graphql-subscription-express/node_modules/send/SECURITY.md b/graphql-subscription-express/node_modules/send/SECURITY.md new file mode 100644 index 0000000..46b48f7 --- /dev/null +++ b/graphql-subscription-express/node_modules/send/SECURITY.md @@ -0,0 +1,24 @@ +# Security Policies and Procedures + +## Reporting a Bug + +The `send` team and community take all security bugs seriously. Thank you +for improving the security of Express. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your +contributions. + +Report security bugs by emailing the current owner(s) of `send`. This information +can be found in the npm registry using the command `npm owner ls send`. +If unsure or unable to get the information from the above, open an issue +in the [project issue tracker](https://github.com/pillarjs/send/issues) +asking for the current contact information. + +To ensure the timely response to your report, please ensure that the entirety +of the report is contained within the email body and not solely behind a web +link or an attachment. + +At least one owner will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the owners will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. diff --git a/graphql-subscription-express/node_modules/send/index.js b/graphql-subscription-express/node_modules/send/index.js new file mode 100644 index 0000000..89afd7e --- /dev/null +++ b/graphql-subscription-express/node_modules/send/index.js @@ -0,0 +1,1143 @@ +/*! + * send + * Copyright(c) 2012 TJ Holowaychuk + * Copyright(c) 2014-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var createError = require('http-errors') +var debug = require('debug')('send') +var deprecate = require('depd')('send') +var destroy = require('destroy') +var encodeUrl = require('encodeurl') +var escapeHtml = require('escape-html') +var etag = require('etag') +var fresh = require('fresh') +var fs = require('fs') +var mime = require('mime') +var ms = require('ms') +var onFinished = require('on-finished') +var parseRange = require('range-parser') +var path = require('path') +var statuses = require('statuses') +var Stream = require('stream') +var util = require('util') + +/** + * Path function references. + * @private + */ + +var extname = path.extname +var join = path.join +var normalize = path.normalize +var resolve = path.resolve +var sep = path.sep + +/** + * Regular expression for identifying a bytes Range header. + * @private + */ + +var BYTES_RANGE_REGEXP = /^ *bytes=/ + +/** + * Maximum value allowed for the max age. + * @private + */ + +var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000 // 1 year + +/** + * Regular expression to match a path with a directory up component. + * @private + */ + +var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/ + +/** + * Module exports. + * @public + */ + +module.exports = send +module.exports.mime = mime + +/** + * Return a `SendStream` for `req` and `path`. + * + * @param {object} req + * @param {string} path + * @param {object} [options] + * @return {SendStream} + * @public + */ + +function send (req, path, options) { + return new SendStream(req, path, options) +} + +/** + * Initialize a `SendStream` with the given `path`. + * + * @param {Request} req + * @param {String} path + * @param {object} [options] + * @private + */ + +function SendStream (req, path, options) { + Stream.call(this) + + var opts = options || {} + + this.options = opts + this.path = path + this.req = req + + this._acceptRanges = opts.acceptRanges !== undefined + ? Boolean(opts.acceptRanges) + : true + + this._cacheControl = opts.cacheControl !== undefined + ? Boolean(opts.cacheControl) + : true + + this._etag = opts.etag !== undefined + ? Boolean(opts.etag) + : true + + this._dotfiles = opts.dotfiles !== undefined + ? opts.dotfiles + : 'ignore' + + if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') { + throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"') + } + + this._hidden = Boolean(opts.hidden) + + if (opts.hidden !== undefined) { + deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead') + } + + // legacy support + if (opts.dotfiles === undefined) { + this._dotfiles = undefined + } + + this._extensions = opts.extensions !== undefined + ? normalizeList(opts.extensions, 'extensions option') + : [] + + this._immutable = opts.immutable !== undefined + ? Boolean(opts.immutable) + : false + + this._index = opts.index !== undefined + ? normalizeList(opts.index, 'index option') + : ['index.html'] + + this._lastModified = opts.lastModified !== undefined + ? Boolean(opts.lastModified) + : true + + this._maxage = opts.maxAge || opts.maxage + this._maxage = typeof this._maxage === 'string' + ? ms(this._maxage) + : Number(this._maxage) + this._maxage = !isNaN(this._maxage) + ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) + : 0 + + this._root = opts.root + ? resolve(opts.root) + : null + + if (!this._root && opts.from) { + this.from(opts.from) + } +} + +/** + * Inherits from `Stream`. + */ + +util.inherits(SendStream, Stream) + +/** + * Enable or disable etag generation. + * + * @param {Boolean} val + * @return {SendStream} + * @api public + */ + +SendStream.prototype.etag = deprecate.function(function etag (val) { + this._etag = Boolean(val) + debug('etag %s', this._etag) + return this +}, 'send.etag: pass etag as option') + +/** + * Enable or disable "hidden" (dot) files. + * + * @param {Boolean} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.hidden = deprecate.function(function hidden (val) { + this._hidden = Boolean(val) + this._dotfiles = undefined + debug('hidden %s', this._hidden) + return this +}, 'send.hidden: use dotfiles option') + +/** + * Set index `paths`, set to a falsy + * value to disable index support. + * + * @param {String|Boolean|Array} paths + * @return {SendStream} + * @api public + */ + +SendStream.prototype.index = deprecate.function(function index (paths) { + var index = !paths ? [] : normalizeList(paths, 'paths argument') + debug('index %o', paths) + this._index = index + return this +}, 'send.index: pass index as option') + +/** + * Set root `path`. + * + * @param {String} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.root = function root (path) { + this._root = resolve(String(path)) + debug('root %s', this._root) + return this +} + +SendStream.prototype.from = deprecate.function(SendStream.prototype.root, + 'send.from: pass root as option') + +SendStream.prototype.root = deprecate.function(SendStream.prototype.root, + 'send.root: pass root as option') + +/** + * Set max-age to `maxAge`. + * + * @param {Number} maxAge + * @return {SendStream} + * @api public + */ + +SendStream.prototype.maxage = deprecate.function(function maxage (maxAge) { + this._maxage = typeof maxAge === 'string' + ? ms(maxAge) + : Number(maxAge) + this._maxage = !isNaN(this._maxage) + ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) + : 0 + debug('max-age %d', this._maxage) + return this +}, 'send.maxage: pass maxAge as option') + +/** + * Emit error with `status`. + * + * @param {number} status + * @param {Error} [err] + * @private + */ + +SendStream.prototype.error = function error (status, err) { + // emit if listeners instead of responding + if (hasListeners(this, 'error')) { + return this.emit('error', createHttpError(status, err)) + } + + var res = this.res + var msg = statuses.message[status] || String(status) + var doc = createHtmlDocument('Error', escapeHtml(msg)) + + // clear existing headers + clearHeaders(res) + + // add error headers + if (err && err.headers) { + setHeaders(res, err.headers) + } + + // send basic response + res.statusCode = status + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', Buffer.byteLength(doc)) + res.setHeader('Content-Security-Policy', "default-src 'none'") + res.setHeader('X-Content-Type-Options', 'nosniff') + res.end(doc) +} + +/** + * Check if the pathname ends with "/". + * + * @return {boolean} + * @private + */ + +SendStream.prototype.hasTrailingSlash = function hasTrailingSlash () { + return this.path[this.path.length - 1] === '/' +} + +/** + * Check if this is a conditional GET request. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isConditionalGET = function isConditionalGET () { + return this.req.headers['if-match'] || + this.req.headers['if-unmodified-since'] || + this.req.headers['if-none-match'] || + this.req.headers['if-modified-since'] +} + +/** + * Check if the request preconditions failed. + * + * @return {boolean} + * @private + */ + +SendStream.prototype.isPreconditionFailure = function isPreconditionFailure () { + var req = this.req + var res = this.res + + // if-match + var match = req.headers['if-match'] + if (match) { + var etag = res.getHeader('ETag') + return !etag || (match !== '*' && parseTokenList(match).every(function (match) { + return match !== etag && match !== 'W/' + etag && 'W/' + match !== etag + })) + } + + // if-unmodified-since + var unmodifiedSince = parseHttpDate(req.headers['if-unmodified-since']) + if (!isNaN(unmodifiedSince)) { + var lastModified = parseHttpDate(res.getHeader('Last-Modified')) + return isNaN(lastModified) || lastModified > unmodifiedSince + } + + return false +} + +/** + * Strip various content header fields for a change in entity. + * + * @private + */ + +SendStream.prototype.removeContentHeaderFields = function removeContentHeaderFields () { + var res = this.res + + res.removeHeader('Content-Encoding') + res.removeHeader('Content-Language') + res.removeHeader('Content-Length') + res.removeHeader('Content-Range') + res.removeHeader('Content-Type') +} + +/** + * Respond with 304 not modified. + * + * @api private + */ + +SendStream.prototype.notModified = function notModified () { + var res = this.res + debug('not modified') + this.removeContentHeaderFields() + res.statusCode = 304 + res.end() +} + +/** + * Raise error that headers already sent. + * + * @api private + */ + +SendStream.prototype.headersAlreadySent = function headersAlreadySent () { + var err = new Error('Can\'t set headers after they are sent.') + debug('headers already sent') + this.error(500, err) +} + +/** + * Check if the request is cacheable, aka + * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}). + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isCachable = function isCachable () { + var statusCode = this.res.statusCode + return (statusCode >= 200 && statusCode < 300) || + statusCode === 304 +} + +/** + * Handle stat() error. + * + * @param {Error} error + * @private + */ + +SendStream.prototype.onStatError = function onStatError (error) { + switch (error.code) { + case 'ENAMETOOLONG': + case 'ENOENT': + case 'ENOTDIR': + this.error(404, error) + break + default: + this.error(500, error) + break + } +} + +/** + * Check if the cache is fresh. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isFresh = function isFresh () { + return fresh(this.req.headers, { + etag: this.res.getHeader('ETag'), + 'last-modified': this.res.getHeader('Last-Modified') + }) +} + +/** + * Check if the range is fresh. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isRangeFresh = function isRangeFresh () { + var ifRange = this.req.headers['if-range'] + + if (!ifRange) { + return true + } + + // if-range as etag + if (ifRange.indexOf('"') !== -1) { + var etag = this.res.getHeader('ETag') + return Boolean(etag && ifRange.indexOf(etag) !== -1) + } + + // if-range as modified date + var lastModified = this.res.getHeader('Last-Modified') + return parseHttpDate(lastModified) <= parseHttpDate(ifRange) +} + +/** + * Redirect to path. + * + * @param {string} path + * @private + */ + +SendStream.prototype.redirect = function redirect (path) { + var res = this.res + + if (hasListeners(this, 'directory')) { + this.emit('directory', res, path) + return + } + + if (this.hasTrailingSlash()) { + this.error(403) + return + } + + var loc = encodeUrl(collapseLeadingSlashes(this.path + '/')) + var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + + escapeHtml(loc) + '') + + // redirect + res.statusCode = 301 + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', Buffer.byteLength(doc)) + res.setHeader('Content-Security-Policy', "default-src 'none'") + res.setHeader('X-Content-Type-Options', 'nosniff') + res.setHeader('Location', loc) + res.end(doc) +} + +/** + * Pipe to `res. + * + * @param {Stream} res + * @return {Stream} res + * @api public + */ + +SendStream.prototype.pipe = function pipe (res) { + // root path + var root = this._root + + // references + this.res = res + + // decode the path + var path = decode(this.path) + if (path === -1) { + this.error(400) + return res + } + + // null byte(s) + if (~path.indexOf('\0')) { + this.error(400) + return res + } + + var parts + if (root !== null) { + // normalize + if (path) { + path = normalize('.' + sep + path) + } + + // malicious path + if (UP_PATH_REGEXP.test(path)) { + debug('malicious path "%s"', path) + this.error(403) + return res + } + + // explode path parts + parts = path.split(sep) + + // join / normalize from optional root dir + path = normalize(join(root, path)) + } else { + // ".." is malicious without "root" + if (UP_PATH_REGEXP.test(path)) { + debug('malicious path "%s"', path) + this.error(403) + return res + } + + // explode path parts + parts = normalize(path).split(sep) + + // resolve the path + path = resolve(path) + } + + // dotfile handling + if (containsDotFile(parts)) { + var access = this._dotfiles + + // legacy support + if (access === undefined) { + access = parts[parts.length - 1][0] === '.' + ? (this._hidden ? 'allow' : 'ignore') + : 'allow' + } + + debug('%s dotfile "%s"', access, path) + switch (access) { + case 'allow': + break + case 'deny': + this.error(403) + return res + case 'ignore': + default: + this.error(404) + return res + } + } + + // index file support + if (this._index.length && this.hasTrailingSlash()) { + this.sendIndex(path) + return res + } + + this.sendFile(path) + return res +} + +/** + * Transfer `path`. + * + * @param {String} path + * @api public + */ + +SendStream.prototype.send = function send (path, stat) { + var len = stat.size + var options = this.options + var opts = {} + var res = this.res + var req = this.req + var ranges = req.headers.range + var offset = options.start || 0 + + if (headersSent(res)) { + // impossible to send now + this.headersAlreadySent() + return + } + + debug('pipe "%s"', path) + + // set header fields + this.setHeader(path, stat) + + // set content-type + this.type(path) + + // conditional GET support + if (this.isConditionalGET()) { + if (this.isPreconditionFailure()) { + this.error(412) + return + } + + if (this.isCachable() && this.isFresh()) { + this.notModified() + return + } + } + + // adjust len to start/end options + len = Math.max(0, len - offset) + if (options.end !== undefined) { + var bytes = options.end - offset + 1 + if (len > bytes) len = bytes + } + + // Range support + if (this._acceptRanges && BYTES_RANGE_REGEXP.test(ranges)) { + // parse + ranges = parseRange(len, ranges, { + combine: true + }) + + // If-Range support + if (!this.isRangeFresh()) { + debug('range stale') + ranges = -2 + } + + // unsatisfiable + if (ranges === -1) { + debug('range unsatisfiable') + + // Content-Range + res.setHeader('Content-Range', contentRange('bytes', len)) + + // 416 Requested Range Not Satisfiable + return this.error(416, { + headers: { 'Content-Range': res.getHeader('Content-Range') } + }) + } + + // valid (syntactically invalid/multiple ranges are treated as a regular response) + if (ranges !== -2 && ranges.length === 1) { + debug('range %j', ranges) + + // Content-Range + res.statusCode = 206 + res.setHeader('Content-Range', contentRange('bytes', len, ranges[0])) + + // adjust for requested range + offset += ranges[0].start + len = ranges[0].end - ranges[0].start + 1 + } + } + + // clone options + for (var prop in options) { + opts[prop] = options[prop] + } + + // set read options + opts.start = offset + opts.end = Math.max(offset, offset + len - 1) + + // content-length + res.setHeader('Content-Length', len) + + // HEAD support + if (req.method === 'HEAD') { + res.end() + return + } + + this.stream(path, opts) +} + +/** + * Transfer file for `path`. + * + * @param {String} path + * @api private + */ +SendStream.prototype.sendFile = function sendFile (path) { + var i = 0 + var self = this + + debug('stat "%s"', path) + fs.stat(path, function onstat (err, stat) { + if (err && err.code === 'ENOENT' && !extname(path) && path[path.length - 1] !== sep) { + // not found, check extensions + return next(err) + } + if (err) return self.onStatError(err) + if (stat.isDirectory()) return self.redirect(path) + self.emit('file', path, stat) + self.send(path, stat) + }) + + function next (err) { + if (self._extensions.length <= i) { + return err + ? self.onStatError(err) + : self.error(404) + } + + var p = path + '.' + self._extensions[i++] + + debug('stat "%s"', p) + fs.stat(p, function (err, stat) { + if (err) return next(err) + if (stat.isDirectory()) return next() + self.emit('file', p, stat) + self.send(p, stat) + }) + } +} + +/** + * Transfer index for `path`. + * + * @param {String} path + * @api private + */ +SendStream.prototype.sendIndex = function sendIndex (path) { + var i = -1 + var self = this + + function next (err) { + if (++i >= self._index.length) { + if (err) return self.onStatError(err) + return self.error(404) + } + + var p = join(path, self._index[i]) + + debug('stat "%s"', p) + fs.stat(p, function (err, stat) { + if (err) return next(err) + if (stat.isDirectory()) return next() + self.emit('file', p, stat) + self.send(p, stat) + }) + } + + next() +} + +/** + * Stream `path` to the response. + * + * @param {String} path + * @param {Object} options + * @api private + */ + +SendStream.prototype.stream = function stream (path, options) { + var self = this + var res = this.res + + // pipe + var stream = fs.createReadStream(path, options) + this.emit('stream', stream) + stream.pipe(res) + + // cleanup + function cleanup () { + destroy(stream, true) + } + + // response finished, cleanup + onFinished(res, cleanup) + + // error handling + stream.on('error', function onerror (err) { + // clean up stream early + cleanup() + + // error + self.onStatError(err) + }) + + // end + stream.on('end', function onend () { + self.emit('end') + }) +} + +/** + * Set content-type based on `path` + * if it hasn't been explicitly set. + * + * @param {String} path + * @api private + */ + +SendStream.prototype.type = function type (path) { + var res = this.res + + if (res.getHeader('Content-Type')) return + + var type = mime.lookup(path) + + if (!type) { + debug('no content-type') + return + } + + var charset = mime.charsets.lookup(type) + + debug('content-type %s', type) + res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')) +} + +/** + * Set response header fields, most + * fields may be pre-defined. + * + * @param {String} path + * @param {Object} stat + * @api private + */ + +SendStream.prototype.setHeader = function setHeader (path, stat) { + var res = this.res + + this.emit('headers', res, path, stat) + + if (this._acceptRanges && !res.getHeader('Accept-Ranges')) { + debug('accept ranges') + res.setHeader('Accept-Ranges', 'bytes') + } + + if (this._cacheControl && !res.getHeader('Cache-Control')) { + var cacheControl = 'public, max-age=' + Math.floor(this._maxage / 1000) + + if (this._immutable) { + cacheControl += ', immutable' + } + + debug('cache-control %s', cacheControl) + res.setHeader('Cache-Control', cacheControl) + } + + if (this._lastModified && !res.getHeader('Last-Modified')) { + var modified = stat.mtime.toUTCString() + debug('modified %s', modified) + res.setHeader('Last-Modified', modified) + } + + if (this._etag && !res.getHeader('ETag')) { + var val = etag(stat) + debug('etag %s', val) + res.setHeader('ETag', val) + } +} + +/** + * Clear all headers from a response. + * + * @param {object} res + * @private + */ + +function clearHeaders (res) { + var headers = getHeaderNames(res) + + for (var i = 0; i < headers.length; i++) { + res.removeHeader(headers[i]) + } +} + +/** + * Collapse all leading slashes into a single slash + * + * @param {string} str + * @private + */ +function collapseLeadingSlashes (str) { + for (var i = 0; i < str.length; i++) { + if (str[i] !== '/') { + break + } + } + + return i > 1 + ? '/' + str.substr(i) + : str +} + +/** + * Determine if path parts contain a dotfile. + * + * @api private + */ + +function containsDotFile (parts) { + for (var i = 0; i < parts.length; i++) { + var part = parts[i] + if (part.length > 1 && part[0] === '.') { + return true + } + } + + return false +} + +/** + * Create a Content-Range header. + * + * @param {string} type + * @param {number} size + * @param {array} [range] + */ + +function contentRange (type, size, range) { + return type + ' ' + (range ? range.start + '-' + range.end : '*') + '/' + size +} + +/** + * Create a minimal HTML document. + * + * @param {string} title + * @param {string} body + * @private + */ + +function createHtmlDocument (title, body) { + return '\n' + + '\n' + + '\n' + + '\n' + + '' + title + '\n' + + '\n' + + '\n' + + '
' + body + '
\n' + + '\n' + + '\n' +} + +/** + * Create a HttpError object from simple arguments. + * + * @param {number} status + * @param {Error|object} err + * @private + */ + +function createHttpError (status, err) { + if (!err) { + return createError(status) + } + + return err instanceof Error + ? createError(status, err, { expose: false }) + : createError(status, err) +} + +/** + * decodeURIComponent. + * + * Allows V8 to only deoptimize this fn instead of all + * of send(). + * + * @param {String} path + * @api private + */ + +function decode (path) { + try { + return decodeURIComponent(path) + } catch (err) { + return -1 + } +} + +/** + * Get the header names on a respnse. + * + * @param {object} res + * @returns {array[string]} + * @private + */ + +function getHeaderNames (res) { + return typeof res.getHeaderNames !== 'function' + ? Object.keys(res._headers || {}) + : res.getHeaderNames() +} + +/** + * Determine if emitter has listeners of a given type. + * + * The way to do this check is done three different ways in Node.js >= 0.8 + * so this consolidates them into a minimal set using instance methods. + * + * @param {EventEmitter} emitter + * @param {string} type + * @returns {boolean} + * @private + */ + +function hasListeners (emitter, type) { + var count = typeof emitter.listenerCount !== 'function' + ? emitter.listeners(type).length + : emitter.listenerCount(type) + + return count > 0 +} + +/** + * Determine if the response headers have been sent. + * + * @param {object} res + * @returns {boolean} + * @private + */ + +function headersSent (res) { + return typeof res.headersSent !== 'boolean' + ? Boolean(res._header) + : res.headersSent +} + +/** + * Normalize the index option into an array. + * + * @param {boolean|string|array} val + * @param {string} name + * @private + */ + +function normalizeList (val, name) { + var list = [].concat(val || []) + + for (var i = 0; i < list.length; i++) { + if (typeof list[i] !== 'string') { + throw new TypeError(name + ' must be array of strings or false') + } + } + + return list +} + +/** + * Parse an HTTP Date into a number. + * + * @param {string} date + * @private + */ + +function parseHttpDate (date) { + var timestamp = date && Date.parse(date) + + return typeof timestamp === 'number' + ? timestamp + : NaN +} + +/** + * Parse a HTTP token list. + * + * @param {string} str + * @private + */ + +function parseTokenList (str) { + var end = 0 + var list = [] + var start = 0 + + // gather tokens + for (var i = 0, len = str.length; i < len; i++) { + switch (str.charCodeAt(i)) { + case 0x20: /* */ + if (start === end) { + start = end = i + 1 + } + break + case 0x2c: /* , */ + if (start !== end) { + list.push(str.substring(start, end)) + } + start = end = i + 1 + break + default: + end = i + 1 + break + } + } + + // final token + if (start !== end) { + list.push(str.substring(start, end)) + } + + return list +} + +/** + * Set an object of headers on a response. + * + * @param {object} res + * @param {object} headers + * @private + */ + +function setHeaders (res, headers) { + var keys = Object.keys(headers) + + for (var i = 0; i < keys.length; i++) { + var key = keys[i] + res.setHeader(key, headers[key]) + } +} diff --git a/graphql-subscription-express/node_modules/send/node_modules/ms/index.js b/graphql-subscription-express/node_modules/send/node_modules/ms/index.js new file mode 100644 index 0000000..ea734fb --- /dev/null +++ b/graphql-subscription-express/node_modules/send/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function (val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/graphql-subscription-express/node_modules/send/node_modules/ms/license.md b/graphql-subscription-express/node_modules/send/node_modules/ms/license.md new file mode 100644 index 0000000..fa5d39b --- /dev/null +++ b/graphql-subscription-express/node_modules/send/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Vercel, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/send/node_modules/ms/package.json b/graphql-subscription-express/node_modules/send/node_modules/ms/package.json new file mode 100644 index 0000000..4997189 --- /dev/null +++ b/graphql-subscription-express/node_modules/send/node_modules/ms/package.json @@ -0,0 +1,38 @@ +{ + "name": "ms", + "version": "2.1.3", + "description": "Tiny millisecond conversion utility", + "repository": "vercel/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.18.2", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1", + "prettier": "2.0.5" + } +} diff --git a/graphql-subscription-express/node_modules/send/node_modules/ms/readme.md b/graphql-subscription-express/node_modules/send/node_modules/ms/readme.md new file mode 100644 index 0000000..0fc1abb --- /dev/null +++ b/graphql-subscription-express/node_modules/send/node_modules/ms/readme.md @@ -0,0 +1,59 @@ +# ms + +![CI](https://github.com/vercel/ms/workflows/CI/badge.svg) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/graphql-subscription-express/node_modules/send/package.json b/graphql-subscription-express/node_modules/send/package.json new file mode 100644 index 0000000..7f269d5 --- /dev/null +++ b/graphql-subscription-express/node_modules/send/package.json @@ -0,0 +1,62 @@ +{ + "name": "send", + "description": "Better streaming static file server with Range and conditional-GET support", + "version": "0.18.0", + "author": "TJ Holowaychuk ", + "contributors": [ + "Douglas Christopher Wilson ", + "James Wyatt Cready ", + "Jesús Leganés Combarro " + ], + "license": "MIT", + "repository": "pillarjs/send", + "keywords": [ + "static", + "file", + "server" + ], + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "devDependencies": { + "after": "0.8.2", + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.2", + "nyc": "15.1.0", + "supertest": "6.2.2" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "SECURITY.md", + "index.js" + ], + "engines": { + "node": ">= 0.8.0" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --check-leaks --reporter spec --bail", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/graphql-subscription-express/node_modules/serve-static/HISTORY.md b/graphql-subscription-express/node_modules/serve-static/HISTORY.md new file mode 100644 index 0000000..6b58456 --- /dev/null +++ b/graphql-subscription-express/node_modules/serve-static/HISTORY.md @@ -0,0 +1,471 @@ +1.15.0 / 2022-03-24 +=================== + + * deps: send@0.18.0 + - Fix emitted 416 error missing headers property + - Limit the headers removed for 304 response + - deps: depd@2.0.0 + - deps: destroy@1.2.0 + - deps: http-errors@2.0.0 + - deps: on-finished@2.4.1 + - deps: statuses@2.0.1 + +1.14.2 / 2021-12-15 +=================== + + * deps: send@0.17.2 + - deps: http-errors@1.8.1 + - deps: ms@2.1.3 + - pref: ignore empty http tokens + +1.14.1 / 2019-05-10 +=================== + + * Set stricter CSP header in redirect response + * deps: send@0.17.1 + - deps: range-parser@~1.2.1 + +1.14.0 / 2019-05-07 +=================== + + * deps: parseurl@~1.3.3 + * deps: send@0.17.0 + - deps: http-errors@~1.7.2 + - deps: mime@1.6.0 + - deps: ms@2.1.1 + - deps: statuses@~1.5.0 + - perf: remove redundant `path.normalize` call + +1.13.2 / 2018-02-07 +=================== + + * Fix incorrect end tag in redirects + * deps: encodeurl@~1.0.2 + - Fix encoding `%` as last character + * deps: send@0.16.2 + - deps: depd@~1.1.2 + - deps: encodeurl@~1.0.2 + - deps: statuses@~1.4.0 + +1.13.1 / 2017-09-29 +=================== + + * Fix regression when `root` is incorrectly set to a file + * deps: send@0.16.1 + +1.13.0 / 2017-09-27 +=================== + + * deps: send@0.16.0 + - Add 70 new types for file extensions + - Add `immutable` option + - Fix missing `` in default error & redirects + - Set charset as "UTF-8" for .js and .json + - Use instance methods on steam to check for listeners + - deps: mime@1.4.1 + - perf: improve path validation speed + +1.12.6 / 2017-09-22 +=================== + + * deps: send@0.15.6 + - deps: debug@2.6.9 + - perf: improve `If-Match` token parsing + * perf: improve slash collapsing + +1.12.5 / 2017-09-21 +=================== + + * deps: parseurl@~1.3.2 + - perf: reduce overhead for full URLs + - perf: unroll the "fast-path" `RegExp` + * deps: send@0.15.5 + - Fix handling of modified headers with invalid dates + - deps: etag@~1.8.1 + - deps: fresh@0.5.2 + +1.12.4 / 2017-08-05 +=================== + + * deps: send@0.15.4 + - deps: debug@2.6.8 + - deps: depd@~1.1.1 + - deps: http-errors@~1.6.2 + +1.12.3 / 2017-05-16 +=================== + + * deps: send@0.15.3 + - deps: debug@2.6.7 + +1.12.2 / 2017-04-26 +=================== + + * deps: send@0.15.2 + - deps: debug@2.6.4 + +1.12.1 / 2017-03-04 +=================== + + * deps: send@0.15.1 + - Fix issue when `Date.parse` does not return `NaN` on invalid date + - Fix strict violation in broken environments + +1.12.0 / 2017-02-25 +=================== + + * Send complete HTML document in redirect response + * Set default CSP header in redirect response + * deps: send@0.15.0 + - Fix false detection of `no-cache` request directive + - Fix incorrect result when `If-None-Match` has both `*` and ETags + - Fix weak `ETag` matching to match spec + - Remove usage of `res._headers` private field + - Support `If-Match` and `If-Unmodified-Since` headers + - Use `res.getHeaderNames()` when available + - Use `res.headersSent` when available + - deps: debug@2.6.1 + - deps: etag@~1.8.0 + - deps: fresh@0.5.0 + - deps: http-errors@~1.6.1 + +1.11.2 / 2017-01-23 +=================== + + * deps: send@0.14.2 + - deps: http-errors@~1.5.1 + - deps: ms@0.7.2 + - deps: statuses@~1.3.1 + +1.11.1 / 2016-06-10 +=================== + + * Fix redirect error when `req.url` contains raw non-URL characters + * deps: send@0.14.1 + +1.11.0 / 2016-06-07 +=================== + + * Use status code 301 for redirects + * deps: send@0.14.0 + - Add `acceptRanges` option + - Add `cacheControl` option + - Attempt to combine multiple ranges into single range + - Correctly inherit from `Stream` class + - Fix `Content-Range` header in 416 responses when using `start`/`end` options + - Fix `Content-Range` header missing from default 416 responses + - Ignore non-byte `Range` headers + - deps: http-errors@~1.5.0 + - deps: range-parser@~1.2.0 + - deps: statuses@~1.3.0 + - perf: remove argument reassignment + +1.10.3 / 2016-05-30 +=================== + + * deps: send@0.13.2 + - Fix invalid `Content-Type` header when `send.mime.default_type` unset + +1.10.2 / 2016-01-19 +=================== + + * deps: parseurl@~1.3.1 + - perf: enable strict mode + +1.10.1 / 2016-01-16 +=================== + + * deps: escape-html@~1.0.3 + - perf: enable strict mode + - perf: optimize string replacement + - perf: use faster string coercion + * deps: send@0.13.1 + - deps: depd@~1.1.0 + - deps: destroy@~1.0.4 + - deps: escape-html@~1.0.3 + - deps: range-parser@~1.0.3 + +1.10.0 / 2015-06-17 +=================== + + * Add `fallthrough` option + - Allows declaring this middleware is the final destination + - Provides better integration with Express patterns + * Fix reading options from options prototype + * Improve the default redirect response headers + * deps: escape-html@1.0.2 + * deps: send@0.13.0 + - Allow Node.js HTTP server to set `Date` response header + - Fix incorrectly removing `Content-Location` on 304 response + - Improve the default redirect response headers + - Send appropriate headers on default error response + - Use `http-errors` for standard emitted errors + - Use `statuses` instead of `http` module for status messages + - deps: escape-html@1.0.2 + - deps: etag@~1.7.0 + - deps: fresh@0.3.0 + - deps: on-finished@~2.3.0 + - perf: enable strict mode + - perf: remove unnecessary array allocations + * perf: enable strict mode + * perf: remove argument reassignment + +1.9.3 / 2015-05-14 +================== + + * deps: send@0.12.3 + - deps: debug@~2.2.0 + - deps: depd@~1.0.1 + - deps: etag@~1.6.0 + - deps: ms@0.7.1 + - deps: on-finished@~2.2.1 + +1.9.2 / 2015-03-14 +================== + + * deps: send@0.12.2 + - Throw errors early for invalid `extensions` or `index` options + - deps: debug@~2.1.3 + +1.9.1 / 2015-02-17 +================== + + * deps: send@0.12.1 + - Fix regression sending zero-length files + +1.9.0 / 2015-02-16 +================== + + * deps: send@0.12.0 + - Always read the stat size from the file + - Fix mutating passed-in `options` + - deps: mime@1.3.4 + +1.8.1 / 2015-01-20 +================== + + * Fix redirect loop in Node.js 0.11.14 + * deps: send@0.11.1 + - Fix root path disclosure + +1.8.0 / 2015-01-05 +================== + + * deps: send@0.11.0 + - deps: debug@~2.1.1 + - deps: etag@~1.5.1 + - deps: ms@0.7.0 + - deps: on-finished@~2.2.0 + +1.7.2 / 2015-01-02 +================== + + * Fix potential open redirect when mounted at root + +1.7.1 / 2014-10-22 +================== + + * deps: send@0.10.1 + - deps: on-finished@~2.1.1 + +1.7.0 / 2014-10-15 +================== + + * deps: send@0.10.0 + - deps: debug@~2.1.0 + - deps: depd@~1.0.0 + - deps: etag@~1.5.0 + +1.6.5 / 2015-02-04 +================== + + * Fix potential open redirect when mounted at root + - Back-ported from v1.7.2 + +1.6.4 / 2014-10-08 +================== + + * Fix redirect loop when index file serving disabled + +1.6.3 / 2014-09-24 +================== + + * deps: send@0.9.3 + - deps: etag@~1.4.0 + +1.6.2 / 2014-09-15 +================== + + * deps: send@0.9.2 + - deps: depd@0.4.5 + - deps: etag@~1.3.1 + - deps: range-parser@~1.0.2 + +1.6.1 / 2014-09-07 +================== + + * deps: send@0.9.1 + - deps: fresh@0.2.4 + +1.6.0 / 2014-09-07 +================== + + * deps: send@0.9.0 + - Add `lastModified` option + - Use `etag` to generate `ETag` header + - deps: debug@~2.0.0 + +1.5.4 / 2014-09-04 +================== + + * deps: send@0.8.5 + - Fix a path traversal issue when using `root` + - Fix malicious path detection for empty string path + +1.5.3 / 2014-08-17 +================== + + * deps: send@0.8.3 + +1.5.2 / 2014-08-14 +================== + + * deps: send@0.8.2 + - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` + +1.5.1 / 2014-08-09 +================== + + * Fix parsing of weird `req.originalUrl` values + * deps: parseurl@~1.3.0 + * deps: utils-merge@1.0.0 + +1.5.0 / 2014-08-05 +================== + + * deps: send@0.8.1 + - Add `extensions` option + +1.4.4 / 2014-08-04 +================== + + * deps: send@0.7.4 + - Fix serving index files without root dir + +1.4.3 / 2014-07-29 +================== + + * deps: send@0.7.3 + - Fix incorrect 403 on Windows and Node.js 0.11 + +1.4.2 / 2014-07-27 +================== + + * deps: send@0.7.2 + - deps: depd@0.4.4 + +1.4.1 / 2014-07-26 +================== + + * deps: send@0.7.1 + - deps: depd@0.4.3 + +1.4.0 / 2014-07-21 +================== + + * deps: parseurl@~1.2.0 + - Cache URLs based on original value + - Remove no-longer-needed URL mis-parse work-around + - Simplify the "fast-path" `RegExp` + * deps: send@0.7.0 + - Add `dotfiles` option + - deps: debug@1.0.4 + - deps: depd@0.4.2 + +1.3.2 / 2014-07-11 +================== + + * deps: send@0.6.0 + - Cap `maxAge` value to 1 year + - deps: debug@1.0.3 + +1.3.1 / 2014-07-09 +================== + + * deps: parseurl@~1.1.3 + - faster parsing of href-only URLs + +1.3.0 / 2014-06-28 +================== + + * Add `setHeaders` option + * Include HTML link in redirect response + * deps: send@0.5.0 + - Accept string for `maxAge` (converted by `ms`) + +1.2.3 / 2014-06-11 +================== + + * deps: send@0.4.3 + - Do not throw un-catchable error on file open race condition + - Use `escape-html` for HTML escaping + - deps: debug@1.0.2 + - deps: finished@1.2.2 + - deps: fresh@0.2.2 + +1.2.2 / 2014-06-09 +================== + + * deps: send@0.4.2 + - fix "event emitter leak" warnings + - deps: debug@1.0.1 + - deps: finished@1.2.1 + +1.2.1 / 2014-06-02 +================== + + * use `escape-html` for escaping + * deps: send@0.4.1 + - Send `max-age` in `Cache-Control` in correct format + +1.2.0 / 2014-05-29 +================== + + * deps: send@0.4.0 + - Calculate ETag with md5 for reduced collisions + - Fix wrong behavior when index file matches directory + - Ignore stream errors after request ends + - Skip directories in index file search + - deps: debug@0.8.1 + +1.1.0 / 2014-04-24 +================== + + * Accept options directly to `send` module + * deps: send@0.3.0 + +1.0.4 / 2014-04-07 +================== + + * Resolve relative paths at middleware setup + * Use parseurl to parse the URL from request + +1.0.3 / 2014-03-20 +================== + + * Do not rely on connect-like environments + +1.0.2 / 2014-03-06 +================== + + * deps: send@0.2.0 + +1.0.1 / 2014-03-05 +================== + + * Add mime export for back-compat + +1.0.0 / 2014-03-05 +================== + + * Genesis from `connect` diff --git a/graphql-subscription-express/node_modules/serve-static/LICENSE b/graphql-subscription-express/node_modules/serve-static/LICENSE new file mode 100644 index 0000000..cbe62e8 --- /dev/null +++ b/graphql-subscription-express/node_modules/serve-static/LICENSE @@ -0,0 +1,25 @@ +(The MIT License) + +Copyright (c) 2010 Sencha Inc. +Copyright (c) 2011 LearnBoost +Copyright (c) 2011 TJ Holowaychuk +Copyright (c) 2014-2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/serve-static/README.md b/graphql-subscription-express/node_modules/serve-static/README.md new file mode 100644 index 0000000..262d944 --- /dev/null +++ b/graphql-subscription-express/node_modules/serve-static/README.md @@ -0,0 +1,257 @@ +# serve-static + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Linux Build][github-actions-ci-image]][github-actions-ci-url] +[![Windows Build][appveyor-image]][appveyor-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install serve-static +``` + +## API + +```js +var serveStatic = require('serve-static') +``` + +### serveStatic(root, options) + +Create a new middleware function to serve files from within a given root +directory. The file to serve will be determined by combining `req.url` +with the provided root directory. When a file is not found, instead of +sending a 404 response, this module will instead call `next()` to move on +to the next middleware, allowing for stacking and fall-backs. + +#### Options + +##### acceptRanges + +Enable or disable accepting ranged requests, defaults to true. +Disabling this will not send `Accept-Ranges` and ignore the contents +of the `Range` request header. + +##### cacheControl + +Enable or disable setting `Cache-Control` response header, defaults to +true. Disabling this will ignore the `immutable` and `maxAge` options. + +##### dotfiles + + Set how "dotfiles" are treated when encountered. A dotfile is a file +or directory that begins with a dot ("."). Note this check is done on +the path itself without checking if the path actually exists on the +disk. If `root` is specified, only the dotfiles above the root are +checked (i.e. the root itself can be within a dotfile when set +to "deny"). + + - `'allow'` No special treatment for dotfiles. + - `'deny'` Deny a request for a dotfile and 403/`next()`. + - `'ignore'` Pretend like the dotfile does not exist and 404/`next()`. + +The default value is similar to `'ignore'`, with the exception that this +default will not ignore the files within a directory that begins with a dot. + +##### etag + +Enable or disable etag generation, defaults to true. + +##### extensions + +Set file extension fallbacks. When set, if a file is not found, the given +extensions will be added to the file name and search for. The first that +exists will be served. Example: `['html', 'htm']`. + +The default value is `false`. + +##### fallthrough + +Set the middleware to have client errors fall-through as just unhandled +requests, otherwise forward a client error. The difference is that client +errors like a bad request or a request to a non-existent file will cause +this middleware to simply `next()` to your next middleware when this value +is `true`. When this value is `false`, these errors (even 404s), will invoke +`next(err)`. + +Typically `true` is desired such that multiple physical directories can be +mapped to the same web address or for routes to fill in non-existent files. + +The value `false` can be used if this middleware is mounted at a path that +is designed to be strictly a single file system directory, which allows for +short-circuiting 404s for less overhead. This middleware will also reply to +all methods. + +The default value is `true`. + +##### immutable + +Enable or disable the `immutable` directive in the `Cache-Control` response +header, defaults to `false`. If set to `true`, the `maxAge` option should +also be specified to enable caching. The `immutable` directive will prevent +supported clients from making conditional requests during the life of the +`maxAge` option to check if the file has changed. + +##### index + +By default this module will send "index.html" files in response to a request +on a directory. To disable this set `false` or to supply a new index pass a +string or an array in preferred order. + +##### lastModified + +Enable or disable `Last-Modified` header, defaults to true. Uses the file +system's last modified value. + +##### maxAge + +Provide a max-age in milliseconds for http caching, defaults to 0. This +can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) +module. + +##### redirect + +Redirect to trailing "/" when the pathname is a dir. Defaults to `true`. + +##### setHeaders + +Function to set custom headers on response. Alterations to the headers need to +occur synchronously. The function is called as `fn(res, path, stat)`, where +the arguments are: + + - `res` the response object + - `path` the file path that is being sent + - `stat` the stat object of the file that is being sent + +## Examples + +### Serve files with vanilla node.js http server + +```js +var finalhandler = require('finalhandler') +var http = require('http') +var serveStatic = require('serve-static') + +// Serve up public/ftp folder +var serve = serveStatic('public/ftp', { index: ['index.html', 'index.htm'] }) + +// Create server +var server = http.createServer(function onRequest (req, res) { + serve(req, res, finalhandler(req, res)) +}) + +// Listen +server.listen(3000) +``` + +### Serve all files as downloads + +```js +var contentDisposition = require('content-disposition') +var finalhandler = require('finalhandler') +var http = require('http') +var serveStatic = require('serve-static') + +// Serve up public/ftp folder +var serve = serveStatic('public/ftp', { + index: false, + setHeaders: setHeaders +}) + +// Set header to force download +function setHeaders (res, path) { + res.setHeader('Content-Disposition', contentDisposition(path)) +} + +// Create server +var server = http.createServer(function onRequest (req, res) { + serve(req, res, finalhandler(req, res)) +}) + +// Listen +server.listen(3000) +``` + +### Serving using express + +#### Simple + +This is a simple example of using Express. + +```js +var express = require('express') +var serveStatic = require('serve-static') + +var app = express() + +app.use(serveStatic('public/ftp', { index: ['default.html', 'default.htm'] })) +app.listen(3000) +``` + +#### Multiple roots + +This example shows a simple way to search through multiple directories. +Files are searched for in `public-optimized/` first, then `public/` second +as a fallback. + +```js +var express = require('express') +var path = require('path') +var serveStatic = require('serve-static') + +var app = express() + +app.use(serveStatic(path.join(__dirname, 'public-optimized'))) +app.use(serveStatic(path.join(__dirname, 'public'))) +app.listen(3000) +``` + +#### Different settings for paths + +This example shows how to set a different max age depending on the served +file type. In this example, HTML files are not cached, while everything else +is for 1 day. + +```js +var express = require('express') +var path = require('path') +var serveStatic = require('serve-static') + +var app = express() + +app.use(serveStatic(path.join(__dirname, 'public'), { + maxAge: '1d', + setHeaders: setCustomCacheControl +})) + +app.listen(3000) + +function setCustomCacheControl (res, path) { + if (serveStatic.mime.lookup(path) === 'text/html') { + // Custom Cache-Control for HTML files + res.setHeader('Cache-Control', 'public, max-age=0') + } +} +``` + +## License + +[MIT](LICENSE) + +[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/serve-static/master?label=windows +[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/serve-static/master +[coveralls-url]: https://coveralls.io/r/expressjs/serve-static?branch=master +[github-actions-ci-image]: https://badgen.net/github/checks/expressjs/serve-static/master?label=linux +[github-actions-ci-url]: https://github.com/expressjs/serve-static/actions/workflows/ci.yml +[node-image]: https://badgen.net/npm/node/serve-static +[node-url]: https://nodejs.org/en/download/ +[npm-downloads-image]: https://badgen.net/npm/dm/serve-static +[npm-url]: https://npmjs.org/package/serve-static +[npm-version-image]: https://badgen.net/npm/v/serve-static diff --git a/graphql-subscription-express/node_modules/serve-static/index.js b/graphql-subscription-express/node_modules/serve-static/index.js new file mode 100644 index 0000000..b7d3984 --- /dev/null +++ b/graphql-subscription-express/node_modules/serve-static/index.js @@ -0,0 +1,210 @@ +/*! + * serve-static + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * Copyright(c) 2014-2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var encodeUrl = require('encodeurl') +var escapeHtml = require('escape-html') +var parseUrl = require('parseurl') +var resolve = require('path').resolve +var send = require('send') +var url = require('url') + +/** + * Module exports. + * @public + */ + +module.exports = serveStatic +module.exports.mime = send.mime + +/** + * @param {string} root + * @param {object} [options] + * @return {function} + * @public + */ + +function serveStatic (root, options) { + if (!root) { + throw new TypeError('root path required') + } + + if (typeof root !== 'string') { + throw new TypeError('root path must be a string') + } + + // copy options object + var opts = Object.create(options || null) + + // fall-though + var fallthrough = opts.fallthrough !== false + + // default redirect + var redirect = opts.redirect !== false + + // headers listener + var setHeaders = opts.setHeaders + + if (setHeaders && typeof setHeaders !== 'function') { + throw new TypeError('option setHeaders must be function') + } + + // setup options for send + opts.maxage = opts.maxage || opts.maxAge || 0 + opts.root = resolve(root) + + // construct directory listener + var onDirectory = redirect + ? createRedirectDirectoryListener() + : createNotFoundDirectoryListener() + + return function serveStatic (req, res, next) { + if (req.method !== 'GET' && req.method !== 'HEAD') { + if (fallthrough) { + return next() + } + + // method not allowed + res.statusCode = 405 + res.setHeader('Allow', 'GET, HEAD') + res.setHeader('Content-Length', '0') + res.end() + return + } + + var forwardError = !fallthrough + var originalUrl = parseUrl.original(req) + var path = parseUrl(req).pathname + + // make sure redirect occurs at mount + if (path === '/' && originalUrl.pathname.substr(-1) !== '/') { + path = '' + } + + // create send stream + var stream = send(req, path, opts) + + // add directory handler + stream.on('directory', onDirectory) + + // add headers listener + if (setHeaders) { + stream.on('headers', setHeaders) + } + + // add file listener for fallthrough + if (fallthrough) { + stream.on('file', function onFile () { + // once file is determined, always forward error + forwardError = true + }) + } + + // forward errors + stream.on('error', function error (err) { + if (forwardError || !(err.statusCode < 500)) { + next(err) + return + } + + next() + }) + + // pipe + stream.pipe(res) + } +} + +/** + * Collapse all leading slashes into a single slash + * @private + */ +function collapseLeadingSlashes (str) { + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) !== 0x2f /* / */) { + break + } + } + + return i > 1 + ? '/' + str.substr(i) + : str +} + +/** + * Create a minimal HTML document. + * + * @param {string} title + * @param {string} body + * @private + */ + +function createHtmlDocument (title, body) { + return '\n' + + '\n' + + '\n' + + '\n' + + '' + title + '\n' + + '\n' + + '\n' + + '
' + body + '
\n' + + '\n' + + '\n' +} + +/** + * Create a directory listener that just 404s. + * @private + */ + +function createNotFoundDirectoryListener () { + return function notFound () { + this.error(404) + } +} + +/** + * Create a directory listener that performs a redirect. + * @private + */ + +function createRedirectDirectoryListener () { + return function redirect (res) { + if (this.hasTrailingSlash()) { + this.error(404) + return + } + + // get original URL + var originalUrl = parseUrl.original(this.req) + + // append trailing slash + originalUrl.path = null + originalUrl.pathname = collapseLeadingSlashes(originalUrl.pathname + '/') + + // reformat the URL + var loc = encodeUrl(url.format(originalUrl)) + var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + + escapeHtml(loc) + '') + + // send redirect response + res.statusCode = 301 + res.setHeader('Content-Type', 'text/html; charset=UTF-8') + res.setHeader('Content-Length', Buffer.byteLength(doc)) + res.setHeader('Content-Security-Policy', "default-src 'none'") + res.setHeader('X-Content-Type-Options', 'nosniff') + res.setHeader('Location', loc) + res.end(doc) + } +} diff --git a/graphql-subscription-express/node_modules/serve-static/package.json b/graphql-subscription-express/node_modules/serve-static/package.json new file mode 100644 index 0000000..9d935f5 --- /dev/null +++ b/graphql-subscription-express/node_modules/serve-static/package.json @@ -0,0 +1,42 @@ +{ + "name": "serve-static", + "description": "Serve static files", + "version": "1.15.0", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "repository": "expressjs/serve-static", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.2", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "supertest": "6.2.2" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "engines": { + "node": ">= 0.8.0" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/graphql-subscription-express/node_modules/set-function-length/.eslintrc b/graphql-subscription-express/node_modules/set-function-length/.eslintrc new file mode 100644 index 0000000..7cff507 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/.eslintrc @@ -0,0 +1,27 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic" + ], + }], + "no-extra-parens": "off", + }, + + "overrides": [ + { + "files": ["test/**/*.js"], + "rules": { + "id-length": "off", + "max-lines-per-function": "off", + "multiline-comment-style": "off", + "no-empty-function": "off", + }, + }, + ], +} diff --git a/graphql-subscription-express/node_modules/set-function-length/.github/FUNDING.yml b/graphql-subscription-express/node_modules/set-function-length/.github/FUNDING.yml new file mode 100644 index 0000000..92feb6f --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/set-function-name +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/graphql-subscription-express/node_modules/set-function-length/.nycrc b/graphql-subscription-express/node_modules/set-function-length/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/set-function-length/CHANGELOG.md b/graphql-subscription-express/node_modules/set-function-length/CHANGELOG.md new file mode 100644 index 0000000..bac439d --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.2](https://github.com/ljharb/set-function-length/compare/v1.2.1...v1.2.2) - 2024-03-09 + +### Commits + +- [types] use shared config [`027032f`](https://github.com/ljharb/set-function-length/commit/027032fe9cc439644a07248ea6a8d813fcc767cb) +- [actions] remove redundant finisher; use reusable workflow [`1fd4fb1`](https://github.com/ljharb/set-function-length/commit/1fd4fb1c58bd5170f0dcff7e320077c0aa2ffdeb) +- [types] use a handwritten d.ts file instead of emit [`01b9761`](https://github.com/ljharb/set-function-length/commit/01b9761742c95e1118e8c2d153ce2ae43d9731aa) +- [Deps] update `define-data-property`, `get-intrinsic`, `has-property-descriptors` [`bee8eaf`](https://github.com/ljharb/set-function-length/commit/bee8eaf7749f325357ade85cffeaeef679e513d4) +- [Dev Deps] update `call-bind`, `tape` [`5dae579`](https://github.com/ljharb/set-function-length/commit/5dae579fdc3aab91b14ebb58f9c19ee3f509d434) +- [Tests] use `@arethetypeswrong/cli` [`7e22425`](https://github.com/ljharb/set-function-length/commit/7e22425d15957fd3d6da0b6bca4afc0c8d255d2d) + +## [v1.2.1](https://github.com/ljharb/set-function-length/compare/v1.2.0...v1.2.1) - 2024-02-06 + +### Commits + +- [Dev Deps] update `call-bind`, `tape`, `typescript` [`d9a4601`](https://github.com/ljharb/set-function-length/commit/d9a460199c4c1fa37da9ebe055e2c884128f0738) +- [Deps] update `define-data-property`, `get-intrinsic` [`38d39ae`](https://github.com/ljharb/set-function-length/commit/38d39aed13a757ed36211d5b0437b88485090c6b) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b4bfe5a`](https://github.com/ljharb/set-function-length/commit/b4bfe5ae0953b906d55b85f867eca5e7f673ebf4) + +## [v1.2.0](https://github.com/ljharb/set-function-length/compare/v1.1.1...v1.2.0) - 2024-01-14 + +### Commits + +- [New] add types [`f6d9088`](https://github.com/ljharb/set-function-length/commit/f6d9088b9283a3112b21c6776e8bef6d1f30558a) +- [Fix] ensure `env` properties are always booleans [`0c42f84`](https://github.com/ljharb/set-function-length/commit/0c42f84979086389b3229e1b4272697fd352275a) +- [Dev Deps] update `aud`, `call-bind`, `npmignore`, `tape` [`2b75f75`](https://github.com/ljharb/set-function-length/commit/2b75f75468093a4bb8ce8ca989b2edd2e80d95d1) +- [Deps] update `get-intrinsic`, `has-property-descriptors` [`19bf0fc`](https://github.com/ljharb/set-function-length/commit/19bf0fc4ffaa5ad425acbfa150516be9f3b6263a) +- [meta] add `sideEffects` flag [`8bb9b78`](https://github.com/ljharb/set-function-length/commit/8bb9b78c11c621123f725c9470222f43466c01d0) + +## [v1.1.1](https://github.com/ljharb/set-function-length/compare/v1.1.0...v1.1.1) - 2023-10-19 + +### Fixed + +- [Fix] move `define-data-property` to runtime deps [`#2`](https://github.com/ljharb/set-function-length/issues/2) + +### Commits + +- [Dev Deps] update `object-inspect`; add missing `call-bind` [`5aecf79`](https://github.com/ljharb/set-function-length/commit/5aecf79e7d6400957a5d9bd9ac20d4528908ca18) + +## [v1.1.0](https://github.com/ljharb/set-function-length/compare/v1.0.1...v1.1.0) - 2023-10-13 + +### Commits + +- [New] add `env` entry point [`475c87a`](https://github.com/ljharb/set-function-length/commit/475c87aa2f59b700aaed589d980624ec596acdcb) +- [Tests] add coverage with `nyc` [`14f0bf8`](https://github.com/ljharb/set-function-length/commit/14f0bf8c145ae60bf14a026420a06bb7be132c36) +- [eslint] fix linting failure [`fb516f9`](https://github.com/ljharb/set-function-length/commit/fb516f93c664057138c53559ef63c8622a093335) +- [Deps] update `define-data-property` [`d727e7c`](https://github.com/ljharb/set-function-length/commit/d727e7c6c9a40d7bf26797694e500ea68741feea) + +## [v1.0.1](https://github.com/ljharb/set-function-length/compare/v1.0.0...v1.0.1) - 2023-10-12 + +### Commits + +- [Refactor] use `get-intrinsic`, since it‘s in the dep graph anyways [`278a954`](https://github.com/ljharb/set-function-length/commit/278a954a06cd849051c569ff7aee56df6798933e) +- [meta] add `exports` [`72acfe5`](https://github.com/ljharb/set-function-length/commit/72acfe5a0310071fb205a72caba5ecbab24336a0) + +## v1.0.0 - 2023-10-12 + +### Commits + +- Initial implementation, tests, readme [`fce14e1`](https://github.com/ljharb/set-function-length/commit/fce14e17586460e4f294405173be72b6ffdf7e5f) +- Initial commit [`ca7ba85`](https://github.com/ljharb/set-function-length/commit/ca7ba857c7c283f9d26e21f14e71cd388f2cb722) +- npm init [`6a7e493`](https://github.com/ljharb/set-function-length/commit/6a7e493927736cebcaf5c1a84e69b8e6b7b744d8) +- Only apps should have lockfiles [`d2bf6c4`](https://github.com/ljharb/set-function-length/commit/d2bf6c43de8a51b02a0aa53e8d62cb50c4a2b0da) diff --git a/graphql-subscription-express/node_modules/set-function-length/LICENSE b/graphql-subscription-express/node_modules/set-function-length/LICENSE new file mode 100644 index 0000000..0314929 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/set-function-length/README.md b/graphql-subscription-express/node_modules/set-function-length/README.md new file mode 100644 index 0000000..15e3ac4 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/README.md @@ -0,0 +1,56 @@ +# set-function-length [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Set a function’s length. + +Arguments: + - `fn`: the function + - `length`: the new length. Must be an integer between 0 and 2**32. + - `loose`: Optional. If true, and the length fails to be set, do not throw. Default false. + +Returns `fn`. + +## Usage + +```javascript +var setFunctionLength = require('set-function-length'); +var assert = require('assert'); + +function zero() {} +function one(_) {} +function two(_, __) {} + +assert.equal(zero.length, 0); +assert.equal(one.length, 1); +assert.equal(two.length, 2); + +assert.equal(setFunctionLength(zero, 10), zero); +assert.equal(setFunctionLength(one, 11), one); +assert.equal(setFunctionLength(two, 12), two); + +assert.equal(zero.length, 10); +assert.equal(one.length, 11); +assert.equal(two.length, 12); +``` + +[package-url]: https://npmjs.org/package/set-function-length +[npm-version-svg]: https://versionbadg.es/ljharb/set-function-length.svg +[deps-svg]: https://david-dm.org/ljharb/set-function-length.svg +[deps-url]: https://david-dm.org/ljharb/set-function-length +[dev-deps-svg]: https://david-dm.org/ljharb/set-function-length/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/set-function-length#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/set-function-length.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/set-function-length.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/set-function-length.svg +[downloads-url]: https://npm-stat.com/charts.html?package=set-function-length +[codecov-image]: https://codecov.io/gh/ljharb/set-function-length/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/set-function-length/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-function-length +[actions-url]: https://github.com/ljharb/set-function-length/actions diff --git a/graphql-subscription-express/node_modules/set-function-length/env.d.ts b/graphql-subscription-express/node_modules/set-function-length/env.d.ts new file mode 100644 index 0000000..970ea53 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/env.d.ts @@ -0,0 +1,9 @@ +declare const env: { + __proto__: null, + boundFnsHaveConfigurableLengths: boolean; + boundFnsHaveWritableLengths: boolean; + functionsHaveConfigurableLengths: boolean; + functionsHaveWritableLengths: boolean; +}; + +export = env; \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/set-function-length/env.js b/graphql-subscription-express/node_modules/set-function-length/env.js new file mode 100644 index 0000000..d9b0a29 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/env.js @@ -0,0 +1,25 @@ +'use strict'; + +var gOPD = require('gopd'); +var bind = require('function-bind'); + +var unbound = gOPD && gOPD(function () {}, 'length'); +// @ts-expect-error ts(2555) TS is overly strict with .call +var bound = gOPD && gOPD(bind.call(function () {}), 'length'); + +var functionsHaveConfigurableLengths = !!(unbound && unbound.configurable); + +var functionsHaveWritableLengths = !!(unbound && unbound.writable); + +var boundFnsHaveConfigurableLengths = !!(bound && bound.configurable); + +var boundFnsHaveWritableLengths = !!(bound && bound.writable); + +/** @type {import('./env')} */ +module.exports = { + __proto__: null, + boundFnsHaveConfigurableLengths: boundFnsHaveConfigurableLengths, + boundFnsHaveWritableLengths: boundFnsHaveWritableLengths, + functionsHaveConfigurableLengths: functionsHaveConfigurableLengths, + functionsHaveWritableLengths: functionsHaveWritableLengths +}; diff --git a/graphql-subscription-express/node_modules/set-function-length/index.d.ts b/graphql-subscription-express/node_modules/set-function-length/index.d.ts new file mode 100644 index 0000000..0451ecd --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/index.d.ts @@ -0,0 +1,7 @@ +declare namespace setFunctionLength { + type Func = (...args: unknown[]) => unknown; +} + +declare function setFunctionLength(fn: T, length: number, loose?: boolean): T; + +export = setFunctionLength; \ No newline at end of file diff --git a/graphql-subscription-express/node_modules/set-function-length/index.js b/graphql-subscription-express/node_modules/set-function-length/index.js new file mode 100644 index 0000000..14ce74d --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var gOPD = require('gopd'); + +var $TypeError = require('es-errors/type'); +var $floor = GetIntrinsic('%Math.floor%'); + +/** @type {import('.')} */ +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } + + var loose = arguments.length > 2 && !!arguments[2]; + + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } + + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(/** @type {Parameters[0]} */ (fn), 'length', length, true, true); + } else { + define(/** @type {Parameters[0]} */ (fn), 'length', length); + } + } + return fn; +}; diff --git a/graphql-subscription-express/node_modules/set-function-length/package.json b/graphql-subscription-express/node_modules/set-function-length/package.json new file mode 100644 index 0000000..f6b8881 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/package.json @@ -0,0 +1,102 @@ +{ + "name": "set-function-length", + "version": "1.2.2", + "description": "Set a function's length property", + "main": "index.js", + "exports": { + ".": "./index.js", + "./env": "./env.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "directories": { + "test": "test" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/set-function-length.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "set", + "function", + "length", + "function.length" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/set-function-length/issues" + }, + "homepage": "https://github.com/ljharb/set-function-length#readme", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.1.1", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/function-bind": "^1.1.10", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "call-bind": "^1.0.7", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/graphql-subscription-express/node_modules/set-function-length/tsconfig.json b/graphql-subscription-express/node_modules/set-function-length/tsconfig.json new file mode 100644 index 0000000..d9a6668 --- /dev/null +++ b/graphql-subscription-express/node_modules/set-function-length/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/graphql-subscription-express/node_modules/setprototypeof/LICENSE b/graphql-subscription-express/node_modules/setprototypeof/LICENSE new file mode 100644 index 0000000..61afa2f --- /dev/null +++ b/graphql-subscription-express/node_modules/setprototypeof/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Wes Todd + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/graphql-subscription-express/node_modules/setprototypeof/README.md b/graphql-subscription-express/node_modules/setprototypeof/README.md new file mode 100644 index 0000000..791eeff --- /dev/null +++ b/graphql-subscription-express/node_modules/setprototypeof/README.md @@ -0,0 +1,31 @@ +# Polyfill for `Object.setPrototypeOf` + +[![NPM Version](https://img.shields.io/npm/v/setprototypeof.svg)](https://npmjs.org/package/setprototypeof) +[![NPM Downloads](https://img.shields.io/npm/dm/setprototypeof.svg)](https://npmjs.org/package/setprototypeof) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard) + +A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8. + +## Usage: + +``` +$ npm install --save setprototypeof +``` + +```javascript +var setPrototypeOf = require('setprototypeof') + +var obj = {} +setPrototypeOf(obj, { + foo: function () { + return 'bar' + } +}) +obj.foo() // bar +``` + +TypeScript is also supported: + +```typescript +import setPrototypeOf from 'setprototypeof' +``` diff --git a/graphql-subscription-express/node_modules/setprototypeof/index.d.ts b/graphql-subscription-express/node_modules/setprototypeof/index.d.ts new file mode 100644 index 0000000..f108ecd --- /dev/null +++ b/graphql-subscription-express/node_modules/setprototypeof/index.d.ts @@ -0,0 +1,2 @@ +declare function setPrototypeOf(o: any, proto: object | null): any; +export = setPrototypeOf; diff --git a/graphql-subscription-express/node_modules/setprototypeof/index.js b/graphql-subscription-express/node_modules/setprototypeof/index.js new file mode 100644 index 0000000..c527055 --- /dev/null +++ b/graphql-subscription-express/node_modules/setprototypeof/index.js @@ -0,0 +1,17 @@ +'use strict' +/* eslint no-proto: 0 */ +module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties) + +function setProtoOf (obj, proto) { + obj.__proto__ = proto + return obj +} + +function mixinProperties (obj, proto) { + for (var prop in proto) { + if (!Object.prototype.hasOwnProperty.call(obj, prop)) { + obj[prop] = proto[prop] + } + } + return obj +} diff --git a/graphql-subscription-express/node_modules/setprototypeof/package.json b/graphql-subscription-express/node_modules/setprototypeof/package.json new file mode 100644 index 0000000..f20915b --- /dev/null +++ b/graphql-subscription-express/node_modules/setprototypeof/package.json @@ -0,0 +1,38 @@ +{ + "name": "setprototypeof", + "version": "1.2.0", + "description": "A small polyfill for Object.setprototypeof", + "main": "index.js", + "typings": "index.d.ts", + "scripts": { + "test": "standard && mocha", + "testallversions": "npm run node010 && npm run node4 && npm run node6 && npm run node9 && npm run node11", + "testversion": "docker run -it --rm -v $(PWD):/usr/src/app -w /usr/src/app node:${NODE_VER} npm install mocha@${MOCHA_VER:-latest} && npm t", + "node010": "NODE_VER=0.10 MOCHA_VER=3 npm run testversion", + "node4": "NODE_VER=4 npm run testversion", + "node6": "NODE_VER=6 npm run testversion", + "node9": "NODE_VER=9 npm run testversion", + "node11": "NODE_VER=11 npm run testversion", + "prepublishOnly": "npm t", + "postpublish": "git push origin && git push origin --tags" + }, + "repository": { + "type": "git", + "url": "https://github.com/wesleytodd/setprototypeof.git" + }, + "keywords": [ + "polyfill", + "object", + "setprototypeof" + ], + "author": "Wes Todd", + "license": "ISC", + "bugs": { + "url": "https://github.com/wesleytodd/setprototypeof/issues" + }, + "homepage": "https://github.com/wesleytodd/setprototypeof", + "devDependencies": { + "mocha": "^6.1.4", + "standard": "^13.0.2" + } +} diff --git a/graphql-subscription-express/node_modules/setprototypeof/test/index.js b/graphql-subscription-express/node_modules/setprototypeof/test/index.js new file mode 100644 index 0000000..afeb4dd --- /dev/null +++ b/graphql-subscription-express/node_modules/setprototypeof/test/index.js @@ -0,0 +1,24 @@ +'use strict' +/* eslint-env mocha */ +/* eslint no-proto: 0 */ +var assert = require('assert') +var setPrototypeOf = require('..') + +describe('setProtoOf(obj, proto)', function () { + it('should merge objects', function () { + var obj = { a: 1, b: 2 } + var proto = { b: 3, c: 4 } + var mergeObj = setPrototypeOf(obj, proto) + + if (Object.getPrototypeOf) { + assert.strictEqual(Object.getPrototypeOf(obj), proto) + } else if ({ __proto__: [] } instanceof Array) { + assert.strictEqual(obj.__proto__, proto) + } else { + assert.strictEqual(obj.a, 1) + assert.strictEqual(obj.b, 2) + assert.strictEqual(obj.c, 4) + } + assert.strictEqual(mergeObj, obj) + }) +}) diff --git a/graphql-subscription-express/node_modules/side-channel/.editorconfig b/graphql-subscription-express/node_modules/side-channel/.editorconfig new file mode 100644 index 0000000..72e0eba --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = true diff --git a/graphql-subscription-express/node_modules/side-channel/.eslintrc b/graphql-subscription-express/node_modules/side-channel/.eslintrc new file mode 100644 index 0000000..93978e7 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-lines-per-function": 0, + "multiline-comment-style": 1, + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + }, +} diff --git a/graphql-subscription-express/node_modules/side-channel/.github/FUNDING.yml b/graphql-subscription-express/node_modules/side-channel/.github/FUNDING.yml new file mode 100644 index 0000000..2a94840 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/side-channel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/graphql-subscription-express/node_modules/side-channel/.nycrc b/graphql-subscription-express/node_modules/side-channel/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/graphql-subscription-express/node_modules/side-channel/CHANGELOG.md b/graphql-subscription-express/node_modules/side-channel/CHANGELOG.md new file mode 100644 index 0000000..25369c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/CHANGELOG.md @@ -0,0 +1,95 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.6](https://github.com/ljharb/side-channel/compare/v1.0.5...v1.0.6) - 2024-02-29 + +### Commits + +- add types [`9beef66`](https://github.com/ljharb/side-channel/commit/9beef6643e6d717ea57bedabf86448123a7dd9e9) +- [meta] simplify `exports` [`4334cf9`](https://github.com/ljharb/side-channel/commit/4334cf9df654151504c383b62a2f9ebdc8d9d5ac) +- [Deps] update `call-bind` [`d6043c4`](https://github.com/ljharb/side-channel/commit/d6043c4d8f4d7be9037dd0f0419c7a2e0e39ec6a) +- [Dev Deps] update `tape` [`6aca376`](https://github.com/ljharb/side-channel/commit/6aca3761868dc8cd5ff7fd9799bf6b95e09a6eb0) + +## [v1.0.5](https://github.com/ljharb/side-channel/compare/v1.0.4...v1.0.5) - 2024-02-06 + +### Commits + +- [actions] reuse common workflows [`3d2e1ff`](https://github.com/ljharb/side-channel/commit/3d2e1ffd16dd6eaaf3e40ff57951f840d2d63c04) +- [meta] use `npmignore` to autogenerate an npmignore file [`04296ea`](https://github.com/ljharb/side-channel/commit/04296ea17d1544b0a5d20fd5bfb31aa4f6513eb9) +- [meta] add `.editorconfig`; add `eclint` [`130f0a6`](https://github.com/ljharb/side-channel/commit/130f0a6adbc04d385c7456a601d38344dce3d6a9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`d480c2f`](https://github.com/ljharb/side-channel/commit/d480c2fbe757489ae9b4275491ffbcc3ac4725e9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ecbe70e`](https://github.com/ljharb/side-channel/commit/ecbe70e53a418234081a77971fec1fdfae20c841) +- [actions] update rebase action [`75240b9`](https://github.com/ljharb/side-channel/commit/75240b9963b816e8846400d2287cb68f88c7fba7) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`ae8d281`](https://github.com/ljharb/side-channel/commit/ae8d281572430099109870fd9430d2ca3f320b8d) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`7125b88`](https://github.com/ljharb/side-channel/commit/7125b885fd0eacad4fee9b073b72d14065ece278) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`82577c9`](https://github.com/ljharb/side-channel/commit/82577c9796304519139a570f82a317211b5f3b86) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`550aadf`](https://github.com/ljharb/side-channel/commit/550aadf20475a6081fd70304cc54f77259a5c8a8) +- [Tests] increase coverage [`5130877`](https://github.com/ljharb/side-channel/commit/5130877a7b27c862e64e6d1c12a178b28808859d) +- [Deps] update `get-intrinsic`, `object-inspect` [`ba0194c`](https://github.com/ljharb/side-channel/commit/ba0194c505b1a8a0427be14cadd5b8a46d4d01b8) +- [meta] add missing `engines.node` [`985fd24`](https://github.com/ljharb/side-channel/commit/985fd249663cb06617a693a94fe08cad12f5cb70) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`40227a8`](https://github.com/ljharb/side-channel/commit/40227a87b01709ad2c0eebf87eb4223a800099b9) +- [Deps] update `get-intrinsic` [`a989b40`](https://github.com/ljharb/side-channel/commit/a989b4024958737ae7be9fbffdeff2078f33a0fd) +- [Deps] update `object-inspect` [`aec42d2`](https://github.com/ljharb/side-channel/commit/aec42d2ec541a31aaa02475692c87d489237d9a3) + +## [v1.0.4](https://github.com/ljharb/side-channel/compare/v1.0.3...v1.0.4) - 2020-12-29 + +### Commits + +- [Tests] migrate tests to Github Actions [`10909cb`](https://github.com/ljharb/side-channel/commit/10909cbf8ce9c0bf96f604cf13d7ffd5a22c2d40) +- [Refactor] Use a linked list rather than an array, and move accessed nodes to the beginning [`195613f`](https://github.com/ljharb/side-channel/commit/195613f28b5c1e6072ef0b61b5beebaf2b6a304e) +- [meta] do not publish github action workflow files [`290ec29`](https://github.com/ljharb/side-channel/commit/290ec29cd21a60585145b4a7237ec55228c52c27) +- [Tests] run `nyc` on all tests; use `tape` runner [`ea6d030`](https://github.com/ljharb/side-channel/commit/ea6d030ff3fe6be2eca39e859d644c51ecd88869) +- [actions] add "Allow Edits" workflow [`d464d8f`](https://github.com/ljharb/side-channel/commit/d464d8fe52b5eddf1504a0ed97f0941a90f32c15) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`02daca8`](https://github.com/ljharb/side-channel/commit/02daca87c6809821c97be468d1afa2f5ef447383) +- [Refactor] use `call-bind` and `get-intrinsic` instead of `es-abstract` [`e09d481`](https://github.com/ljharb/side-channel/commit/e09d481528452ebafa5cdeae1af665c35aa2deee) +- [Deps] update `object.assign` [`ee83aa8`](https://github.com/ljharb/side-channel/commit/ee83aa81df313b5e46319a63adb05cf0c179079a) +- [actions] update rebase action to use checkout v2 [`7726b0b`](https://github.com/ljharb/side-channel/commit/7726b0b058b632fccea709f58960871defaaa9d7) + +## [v1.0.3](https://github.com/ljharb/side-channel/compare/v1.0.2...v1.0.3) - 2020-08-23 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`1f10561`](https://github.com/ljharb/side-channel/commit/1f105611ef3acf32dec8032ae5c0baa5e56bb868) +- [Deps] update `es-abstract`, `object-inspect` [`bc20159`](https://github.com/ljharb/side-channel/commit/bc201597949a505e37cef9eaf24c7010831e6f03) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`b9b2b22`](https://github.com/ljharb/side-channel/commit/b9b2b225f9e0ea72a6ec2b89348f0bd690bc9ed1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7055ab4`](https://github.com/ljharb/side-channel/commit/7055ab4de0860606efd2003674a74f1fe6ebc07e) +- [Dev Deps] update `auto-changelog`; add `aud` [`d278c37`](https://github.com/ljharb/side-channel/commit/d278c37d08227be4f84aa769fcd919e73feeba40) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`3bcf982`](https://github.com/ljharb/side-channel/commit/3bcf982faa122745b39c33ce83d32fdf003741c6) +- [Tests] only audit prod deps [`18d01c4`](https://github.com/ljharb/side-channel/commit/18d01c4015b82a3d75044c4d5ba7917b2eac01ec) +- [Deps] update `es-abstract` [`6ab096d`](https://github.com/ljharb/side-channel/commit/6ab096d9de2b482cf5e0717e34e212f5b2b9bc9a) +- [Dev Deps] update `tape` [`9dc174c`](https://github.com/ljharb/side-channel/commit/9dc174cc651dfd300b4b72da936a0a7eda5f9452) +- [Deps] update `es-abstract` [`431d0f0`](https://github.com/ljharb/side-channel/commit/431d0f0ff11fbd2ae6f3115582a356d3a1cfce82) +- [Deps] update `es-abstract` [`49869fd`](https://github.com/ljharb/side-channel/commit/49869fd323bf4453f0ba515c0fb265cf5ab7b932) +- [meta] Add package.json to package's exports [`77d9cdc`](https://github.com/ljharb/side-channel/commit/77d9cdceb2a9e47700074f2ae0c0a202e7dac0d4) + +## [v1.0.2](https://github.com/ljharb/side-channel/compare/v1.0.1...v1.0.2) - 2019-12-20 + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`4a526df`](https://github.com/ljharb/side-channel/commit/4a526df44e4701566ed001ec78546193f818b082) +- [Deps] update `es-abstract` [`d4f6e62`](https://github.com/ljharb/side-channel/commit/d4f6e629b6fb93a07415db7f30d3c90fd7f264fe) + +## [v1.0.1](https://github.com/ljharb/side-channel/compare/v1.0.0...v1.0.1) - 2019-12-01 + +### Commits + +- [Fix] add missing "exports" [`d212907`](https://github.com/ljharb/side-channel/commit/d2129073abf0701a5343bf28aa2145617604dc2e) + +## v1.0.0 - 2019-12-01 + +### Commits + +- Initial implementation [`dbebd3a`](https://github.com/ljharb/side-channel/commit/dbebd3a4b5ed64242f9a6810efe7c4214cd8cde4) +- Initial tests [`73bdefe`](https://github.com/ljharb/side-channel/commit/73bdefe568c9076cf8c0b8719bc2141aec0e19b8) +- Initial commit [`43c03e1`](https://github.com/ljharb/side-channel/commit/43c03e1c2849ec50a87b7a5cd76238a62b0b8770) +- npm init [`5c090a7`](https://github.com/ljharb/side-channel/commit/5c090a765d66a5527d9889b89aeff78dee91348c) +- [meta] add `auto-changelog` [`a5c4e56`](https://github.com/ljharb/side-channel/commit/a5c4e5675ec02d5eb4d84b4243aeea2a1d38fbec) +- [actions] add automatic rebasing / merge commit blocking [`bab1683`](https://github.com/ljharb/side-channel/commit/bab1683d8f9754b086e94397699fdc645e0d7077) +- [meta] add `funding` field; create FUNDING.yml [`63d7aea`](https://github.com/ljharb/side-channel/commit/63d7aeaf34f5650650ae97ca4b9fae685bd0937c) +- [Tests] add `npm run lint` [`46a5a81`](https://github.com/ljharb/side-channel/commit/46a5a81705cd2664f83df232c01dbbf2ee952885) +- Only apps should have lockfiles [`8b16b03`](https://github.com/ljharb/side-channel/commit/8b16b0305f00895d90c4e2e5773c854cfea0e448) +- [meta] add `safe-publish-latest` [`2f098ef`](https://github.com/ljharb/side-channel/commit/2f098ef092a39399cfe548b19a1fc03c2fd2f490) diff --git a/graphql-subscription-express/node_modules/side-channel/LICENSE b/graphql-subscription-express/node_modules/side-channel/LICENSE new file mode 100644 index 0000000..3900dd7 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/side-channel/README.md b/graphql-subscription-express/node_modules/side-channel/README.md new file mode 100644 index 0000000..7fa4f06 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/README.md @@ -0,0 +1,2 @@ +# side-channel +Store information about any JS value in a side channel. Uses WeakMap if available. diff --git a/graphql-subscription-express/node_modules/side-channel/index.d.ts b/graphql-subscription-express/node_modules/side-channel/index.d.ts new file mode 100644 index 0000000..7cb112b --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/index.d.ts @@ -0,0 +1,27 @@ +declare namespace getSideChannel { + type Key = unknown; + type ListNode = { + key: Key; + next: ListNode; + value: T; + }; + type RootNode = { + key: object; + next: null | ListNode; + }; + function listGetNode(list: RootNode, key: ListNode['key']): ListNode | void; + function listGet(objects: RootNode, key: ListNode['key']): T | void; + function listSet(objects: RootNode, key: ListNode['key'], value: T): void; + function listHas(objects: RootNode, key: ListNode['key']): boolean; + + type Channel = { + assert: (key: Key) => void; + has: (key: Key) => boolean; + get: (key: Key) => T; + set: (key: Key, value: T) => void; + } +} + +declare function getSideChannel(): getSideChannel.Channel; + +export = getSideChannel; diff --git a/graphql-subscription-express/node_modules/side-channel/index.js b/graphql-subscription-express/node_modules/side-channel/index.js new file mode 100644 index 0000000..6b6926e --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/index.js @@ -0,0 +1,129 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); +var inspect = require('object-inspect'); + +var $TypeError = require('es-errors/type'); +var $WeakMap = GetIntrinsic('%WeakMap%', true); +var $Map = GetIntrinsic('%Map%', true); + +var $weakMapGet = callBound('WeakMap.prototype.get', true); +var $weakMapSet = callBound('WeakMap.prototype.set', true); +var $weakMapHas = callBound('WeakMap.prototype.has', true); +var $mapGet = callBound('Map.prototype.get', true); +var $mapSet = callBound('Map.prototype.set', true); +var $mapHas = callBound('Map.prototype.has', true); + +/* +* This function traverses the list returning the node corresponding to the given key. +* +* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly. +*/ +/** @type {import('.').listGetNode} */ +var listGetNode = function (list, key) { // eslint-disable-line consistent-return + /** @type {typeof list | NonNullable<(typeof list)['next']>} */ + var prev = list; + /** @type {(typeof list)['next']} */ + var curr; + for (; (curr = prev.next) !== null; prev = curr) { + if (curr.key === key) { + prev.next = curr.next; + // eslint-disable-next-line no-extra-parens + curr.next = /** @type {NonNullable} */ (list.next); + list.next = curr; // eslint-disable-line no-param-reassign + return curr; + } + } +}; + +/** @type {import('.').listGet} */ +var listGet = function (objects, key) { + var node = listGetNode(objects, key); + return node && node.value; +}; +/** @type {import('.').listSet} */ +var listSet = function (objects, key, value) { + var node = listGetNode(objects, key); + if (node) { + node.value = value; + } else { + // Prepend the new node to the beginning of the list + objects.next = /** @type {import('.').ListNode} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens + key: key, + next: objects.next, + value: value + }); + } +}; +/** @type {import('.').listHas} */ +var listHas = function (objects, key) { + return !!listGetNode(objects, key); +}; + +/** @type {import('.')} */ +module.exports = function getSideChannel() { + /** @type {WeakMap} */ var $wm; + /** @type {Map} */ var $m; + /** @type {import('.').RootNode} */ var $o; + + /** @type {import('.').Channel} */ + var channel = { + assert: function (key) { + if (!channel.has(key)) { + throw new $TypeError('Side channel does not contain ' + inspect(key)); + } + }, + get: function (key) { // eslint-disable-line consistent-return + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapGet($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapGet($m, key); + } + } else { + if ($o) { // eslint-disable-line no-lonely-if + return listGet($o, key); + } + } + }, + has: function (key) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapHas($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapHas($m, key); + } + } else { + if ($o) { // eslint-disable-line no-lonely-if + return listHas($o, key); + } + } + return false; + }, + set: function (key, value) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if (!$wm) { + $wm = new $WeakMap(); + } + $weakMapSet($wm, key, value); + } else if ($Map) { + if (!$m) { + $m = new $Map(); + } + $mapSet($m, key, value); + } else { + if (!$o) { + // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head + $o = { key: {}, next: null }; + } + listSet($o, key, value); + } + } + }; + return channel; +}; diff --git a/graphql-subscription-express/node_modules/side-channel/package.json b/graphql-subscription-express/node_modules/side-channel/package.json new file mode 100644 index 0000000..02cffca --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/package.json @@ -0,0 +1,84 @@ +{ + "name": "side-channel", + "version": "1.0.6", + "description": "Store information about any JS value in a side channel. Uses WeakMap if available.", + "main": "index.js", + "exports": { + "./package.json": "./package.json", + ".": "./index.js" + }, + "types": "./index.d.ts", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/side-channel.git" + }, + "keywords": [ + "weakmap", + "map", + "side", + "channel", + "metadata" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/side-channel/issues" + }, + "homepage": "https://github.com/ljharb/side-channel#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/get-intrinsic": "^1.2.2", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/graphql-subscription-express/node_modules/side-channel/test/index.js b/graphql-subscription-express/node_modules/side-channel/test/index.js new file mode 100644 index 0000000..8da3200 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/test/index.js @@ -0,0 +1,83 @@ +'use strict'; + +var test = require('tape'); + +var getSideChannel = require('../'); + +test('export', function (t) { + t.equal(typeof getSideChannel, 'function', 'is a function'); + t.equal(getSideChannel.length, 0, 'takes no arguments'); + + var channel = getSideChannel(); + t.ok(channel, 'is truthy'); + t.equal(typeof channel, 'object', 'is an object'); + + t.end(); +}); + +test('assert', function (t) { + var channel = getSideChannel(); + t['throws']( + function () { channel.assert({}); }, + TypeError, + 'nonexistent value throws' + ); + + var o = {}; + channel.set(o, 'data'); + t.doesNotThrow(function () { channel.assert(o); }, 'existent value noops'); + + t.end(); +}); + +test('has', function (t) { + var channel = getSideChannel(); + /** @type {unknown[]} */ var o = []; + + t.equal(channel.has(o), false, 'nonexistent value yields false'); + + channel.set(o, 'foo'); + t.equal(channel.has(o), true, 'existent value yields true'); + + t.equal(channel.has('abc'), false, 'non object value non existent yields false'); + + channel.set('abc', 'foo'); + t.equal(channel.has('abc'), true, 'non object value that exists yields true'); + + t.end(); +}); + +test('get', function (t) { + var channel = getSideChannel(); + var o = {}; + t.equal(channel.get(o), undefined, 'nonexistent value yields undefined'); + + var data = {}; + channel.set(o, data); + t.equal(channel.get(o), data, '"get" yields data set by "set"'); + + t.end(); +}); + +test('set', function (t) { + var channel = getSideChannel(); + var o = function () {}; + t.equal(channel.get(o), undefined, 'value not set'); + + channel.set(o, 42); + t.equal(channel.get(o), 42, 'value was set'); + + channel.set(o, Infinity); + t.equal(channel.get(o), Infinity, 'value was set again'); + + var o2 = {}; + channel.set(o2, 17); + t.equal(channel.get(o), Infinity, 'o is not modified'); + t.equal(channel.get(o2), 17, 'o2 is set'); + + channel.set(o, 14); + t.equal(channel.get(o), 14, 'o is modified'); + t.equal(channel.get(o2), 17, 'o2 is not modified'); + + t.end(); +}); diff --git a/graphql-subscription-express/node_modules/side-channel/tsconfig.json b/graphql-subscription-express/node_modules/side-channel/tsconfig.json new file mode 100644 index 0000000..fdfa155 --- /dev/null +++ b/graphql-subscription-express/node_modules/side-channel/tsconfig.json @@ -0,0 +1,50 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + "test/list-exports" + ], +} diff --git a/graphql-subscription-express/node_modules/statuses/HISTORY.md b/graphql-subscription-express/node_modules/statuses/HISTORY.md new file mode 100644 index 0000000..fa4556e --- /dev/null +++ b/graphql-subscription-express/node_modules/statuses/HISTORY.md @@ -0,0 +1,82 @@ +2.0.1 / 2021-01-03 +================== + + * Fix returning values from `Object.prototype` + +2.0.0 / 2020-04-19 +================== + + * Drop support for Node.js 0.6 + * Fix messaging casing of `418 I'm a Teapot` + * Remove code 306 + * Remove `status[code]` exports; use `status.message[code]` + * Remove `status[msg]` exports; use `status.code[msg]` + * Rename `425 Unordered Collection` to standard `425 Too Early` + * Rename `STATUS_CODES` export to `message` + * Return status message for `statuses(code)` when given code + +1.5.0 / 2018-03-27 +================== + + * Add `103 Early Hints` + +1.4.0 / 2017-10-20 +================== + + * Add `STATUS_CODES` export + +1.3.1 / 2016-11-11 +================== + + * Fix return type in JSDoc + +1.3.0 / 2016-05-17 +================== + + * Add `421 Misdirected Request` + * perf: enable strict mode + +1.2.1 / 2015-02-01 +================== + + * Fix message for status 451 + - `451 Unavailable For Legal Reasons` + +1.2.0 / 2014-09-28 +================== + + * Add `208 Already Repored` + * Add `226 IM Used` + * Add `306 (Unused)` + * Add `415 Unable For Legal Reasons` + * Add `508 Loop Detected` + +1.1.1 / 2014-09-24 +================== + + * Add missing 308 to `codes.json` + +1.1.0 / 2014-09-21 +================== + + * Add `codes.json` for universal support + +1.0.4 / 2014-08-20 +================== + + * Package cleanup + +1.0.3 / 2014-06-08 +================== + + * Add 308 to `.redirect` category + +1.0.2 / 2014-03-13 +================== + + * Add `.retry` category + +1.0.1 / 2014-03-12 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/statuses/LICENSE b/graphql-subscription-express/node_modules/statuses/LICENSE new file mode 100644 index 0000000..28a3161 --- /dev/null +++ b/graphql-subscription-express/node_modules/statuses/LICENSE @@ -0,0 +1,23 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/statuses/README.md b/graphql-subscription-express/node_modules/statuses/README.md new file mode 100644 index 0000000..57967e6 --- /dev/null +++ b/graphql-subscription-express/node_modules/statuses/README.md @@ -0,0 +1,136 @@ +# statuses + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +HTTP status utility for node. + +This module provides a list of status codes and messages sourced from +a few different projects: + + * The [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) + * The [Node.js project](https://nodejs.org/) + * The [NGINX project](https://www.nginx.com/) + * The [Apache HTTP Server project](https://httpd.apache.org/) + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install statuses +``` + +## API + + + +```js +var status = require('statuses') +``` + +### status(code) + +Returns the status message string for a known HTTP status code. The code +may be a number or a string. An error is thrown for an unknown status code. + + + +```js +status(403) // => 'Forbidden' +status('403') // => 'Forbidden' +status(306) // throws +``` + +### status(msg) + +Returns the numeric status code for a known HTTP status message. The message +is case-insensitive. An error is thrown for an unknown status message. + + + +```js +status('forbidden') // => 403 +status('Forbidden') // => 403 +status('foo') // throws +``` + +### status.codes + +Returns an array of all the status codes as `Integer`s. + +### status.code[msg] + +Returns the numeric status code for a known status message (in lower-case), +otherwise `undefined`. + + + +```js +status['not found'] // => 404 +``` + +### status.empty[code] + +Returns `true` if a status code expects an empty body. + + + +```js +status.empty[200] // => undefined +status.empty[204] // => true +status.empty[304] // => true +``` + +### status.message[code] + +Returns the string message for a known numeric status code, otherwise +`undefined`. This object is the same format as the +[Node.js http module `http.STATUS_CODES`](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes). + + + +```js +status.message[404] // => 'Not Found' +``` + +### status.redirect[code] + +Returns `true` if a status code is a valid redirect status. + + + +```js +status.redirect[200] // => undefined +status.redirect[301] // => true +``` + +### status.retry[code] + +Returns `true` if you should retry the rest. + + + +```js +status.retry[501] // => undefined +status.retry[503] // => true +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/statuses/master?label=ci +[ci-url]: https://github.com/jshttp/statuses/actions?query=workflow%3Aci +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/statuses/master +[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master +[node-version-image]: https://badgen.net/npm/node/statuses +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/statuses +[npm-url]: https://npmjs.org/package/statuses +[npm-version-image]: https://badgen.net/npm/v/statuses diff --git a/graphql-subscription-express/node_modules/statuses/codes.json b/graphql-subscription-express/node_modules/statuses/codes.json new file mode 100644 index 0000000..1333ed1 --- /dev/null +++ b/graphql-subscription-express/node_modules/statuses/codes.json @@ -0,0 +1,65 @@ +{ + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "103": "Early Hints", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a Teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Too Early", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "451": "Unavailable For Legal Reasons", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "505": "HTTP Version Not Supported", + "506": "Variant Also Negotiates", + "507": "Insufficient Storage", + "508": "Loop Detected", + "509": "Bandwidth Limit Exceeded", + "510": "Not Extended", + "511": "Network Authentication Required" +} diff --git a/graphql-subscription-express/node_modules/statuses/index.js b/graphql-subscription-express/node_modules/statuses/index.js new file mode 100644 index 0000000..ea351c5 --- /dev/null +++ b/graphql-subscription-express/node_modules/statuses/index.js @@ -0,0 +1,146 @@ +/*! + * statuses + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var codes = require('./codes.json') + +/** + * Module exports. + * @public + */ + +module.exports = status + +// status code to message map +status.message = codes + +// status message (lower-case) to code map +status.code = createMessageToStatusCodeMap(codes) + +// array of status codes +status.codes = createStatusCodeList(codes) + +// status codes for redirects +status.redirect = { + 300: true, + 301: true, + 302: true, + 303: true, + 305: true, + 307: true, + 308: true +} + +// status codes for empty bodies +status.empty = { + 204: true, + 205: true, + 304: true +} + +// status codes for when you should retry the request +status.retry = { + 502: true, + 503: true, + 504: true +} + +/** + * Create a map of message to status code. + * @private + */ + +function createMessageToStatusCodeMap (codes) { + var map = {} + + Object.keys(codes).forEach(function forEachCode (code) { + var message = codes[code] + var status = Number(code) + + // populate map + map[message.toLowerCase()] = status + }) + + return map +} + +/** + * Create a list of all status codes. + * @private + */ + +function createStatusCodeList (codes) { + return Object.keys(codes).map(function mapCode (code) { + return Number(code) + }) +} + +/** + * Get the status code for given message. + * @private + */ + +function getStatusCode (message) { + var msg = message.toLowerCase() + + if (!Object.prototype.hasOwnProperty.call(status.code, msg)) { + throw new Error('invalid status message: "' + message + '"') + } + + return status.code[msg] +} + +/** + * Get the status message for given code. + * @private + */ + +function getStatusMessage (code) { + if (!Object.prototype.hasOwnProperty.call(status.message, code)) { + throw new Error('invalid status code: ' + code) + } + + return status.message[code] +} + +/** + * Get the status code. + * + * Given a number, this will throw if it is not a known status + * code, otherwise the code will be returned. Given a string, + * the string will be parsed for a number and return the code + * if valid, otherwise will lookup the code assuming this is + * the status message. + * + * @param {string|number} code + * @returns {number} + * @public + */ + +function status (code) { + if (typeof code === 'number') { + return getStatusMessage(code) + } + + if (typeof code !== 'string') { + throw new TypeError('code must be a number or string') + } + + // '403' + var n = parseInt(code, 10) + if (!isNaN(n)) { + return getStatusMessage(n) + } + + return getStatusCode(code) +} diff --git a/graphql-subscription-express/node_modules/statuses/package.json b/graphql-subscription-express/node_modules/statuses/package.json new file mode 100644 index 0000000..8c3e719 --- /dev/null +++ b/graphql-subscription-express/node_modules/statuses/package.json @@ -0,0 +1,49 @@ +{ + "name": "statuses", + "description": "HTTP status utility", + "version": "2.0.1", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "repository": "jshttp/statuses", + "license": "MIT", + "keywords": [ + "http", + "status", + "code" + ], + "files": [ + "HISTORY.md", + "index.js", + "codes.json", + "LICENSE" + ], + "devDependencies": { + "csv-parse": "4.14.2", + "eslint": "7.17.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.22.1", + "eslint-plugin-markdown": "1.0.2", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "4.2.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "8.2.1", + "nyc": "15.1.0", + "raw-body": "2.4.1", + "stream-to-array": "2.3.0" + }, + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "build": "node scripts/build.js", + "fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "update": "npm run fetch && npm run build", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/graphql-subscription-express/node_modules/toidentifier/HISTORY.md b/graphql-subscription-express/node_modules/toidentifier/HISTORY.md new file mode 100644 index 0000000..cb7cc89 --- /dev/null +++ b/graphql-subscription-express/node_modules/toidentifier/HISTORY.md @@ -0,0 +1,9 @@ +1.0.1 / 2021-11-14 +================== + + * pref: enable strict mode + +1.0.0 / 2018-07-09 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/toidentifier/LICENSE b/graphql-subscription-express/node_modules/toidentifier/LICENSE new file mode 100644 index 0000000..de22d15 --- /dev/null +++ b/graphql-subscription-express/node_modules/toidentifier/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription-express/node_modules/toidentifier/README.md b/graphql-subscription-express/node_modules/toidentifier/README.md new file mode 100644 index 0000000..57e8a78 --- /dev/null +++ b/graphql-subscription-express/node_modules/toidentifier/README.md @@ -0,0 +1,61 @@ +# toidentifier + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][codecov-image]][codecov-url] + +> Convert a string of words to a JavaScript identifier + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```bash +$ npm install toidentifier +``` + +## Example + +```js +var toIdentifier = require('toidentifier') + +console.log(toIdentifier('Bad Request')) +// => "BadRequest" +``` + +## API + +This CommonJS module exports a single default function: `toIdentifier`. + +### toIdentifier(string) + +Given a string as the argument, it will be transformed according to +the following rules and the new string will be returned: + +1. Split into words separated by space characters (`0x20`). +2. Upper case the first character of each word. +3. Join the words together with no separator. +4. Remove all non-word (`[0-9a-z_]`) characters. + +## License + +[MIT](LICENSE) + +[codecov-image]: https://img.shields.io/codecov/c/github/component/toidentifier.svg +[codecov-url]: https://codecov.io/gh/component/toidentifier +[downloads-image]: https://img.shields.io/npm/dm/toidentifier.svg +[downloads-url]: https://npmjs.org/package/toidentifier +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/component/toidentifier/ci/master?label=ci +[github-actions-ci-url]: https://github.com/component/toidentifier?query=workflow%3Aci +[npm-image]: https://img.shields.io/npm/v/toidentifier.svg +[npm-url]: https://npmjs.org/package/toidentifier + + +## + +[npm]: https://www.npmjs.com/ + +[yarn]: https://yarnpkg.com/ diff --git a/graphql-subscription-express/node_modules/toidentifier/index.js b/graphql-subscription-express/node_modules/toidentifier/index.js new file mode 100644 index 0000000..9295d02 --- /dev/null +++ b/graphql-subscription-express/node_modules/toidentifier/index.js @@ -0,0 +1,32 @@ +/*! + * toidentifier + * Copyright(c) 2016 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = toIdentifier + +/** + * Trasform the given string into a JavaScript identifier + * + * @param {string} str + * @returns {string} + * @public + */ + +function toIdentifier (str) { + return str + .split(' ') + .map(function (token) { + return token.slice(0, 1).toUpperCase() + token.slice(1) + }) + .join('') + .replace(/[^ _0-9a-z]/gi, '') +} diff --git a/graphql-subscription-express/node_modules/toidentifier/package.json b/graphql-subscription-express/node_modules/toidentifier/package.json new file mode 100644 index 0000000..42db1a6 --- /dev/null +++ b/graphql-subscription-express/node_modules/toidentifier/package.json @@ -0,0 +1,38 @@ +{ + "name": "toidentifier", + "description": "Convert a string of words to a JavaScript identifier", + "version": "1.0.1", + "author": "Douglas Christopher Wilson ", + "contributors": [ + "Douglas Christopher Wilson ", + "Nick Baugh (http://niftylettuce.com/)" + ], + "repository": "component/toidentifier", + "devDependencies": { + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "4.3.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.1.3", + "nyc": "15.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "license": "MIT", + "files": [ + "HISTORY.md", + "LICENSE", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/graphql-subscription-express/node_modules/type-is/HISTORY.md b/graphql-subscription-express/node_modules/type-is/HISTORY.md new file mode 100644 index 0000000..8de21f7 --- /dev/null +++ b/graphql-subscription-express/node_modules/type-is/HISTORY.md @@ -0,0 +1,259 @@ +1.6.18 / 2019-04-26 +=================== + + * Fix regression passing request object to `typeis.is` + +1.6.17 / 2019-04-25 +=================== + + * deps: mime-types@~2.1.24 + - Add Apple file extensions from IANA + - Add extension `.csl` to `application/vnd.citationstyles.style+xml` + - Add extension `.es` to `application/ecmascript` + - Add extension `.nq` to `application/n-quads` + - Add extension `.nt` to `application/n-triples` + - Add extension `.owl` to `application/rdf+xml` + - Add extensions `.siv` and `.sieve` to `application/sieve` + - Add extensions from IANA for `image/*` types + - Add extensions from IANA for `model/*` types + - Add extensions to HEIC image types + - Add new mime types + - Add `text/mdx` with extension `.mdx` + * perf: prevent internal `throw` on invalid type + +1.6.16 / 2018-02-16 +=================== + + * deps: mime-types@~2.1.18 + - Add `application/raml+yaml` with extension `.raml` + - Add `application/wasm` with extension `.wasm` + - Add `text/shex` with extension `.shex` + - Add extensions for JPEG-2000 images + - Add extensions from IANA for `message/*` types + - Add extension `.mjs` to `application/javascript` + - Add extension `.wadl` to `application/vnd.sun.wadl+xml` + - Add extension `.gz` to `application/gzip` + - Add glTF types and extensions + - Add new mime types + - Update extensions `.md` and `.markdown` to be `text/markdown` + - Update font MIME types + - Update `text/hjson` to registered `application/hjson` + +1.6.15 / 2017-03-31 +=================== + + * deps: mime-types@~2.1.15 + - Add new mime types + +1.6.14 / 2016-11-18 +=================== + + * deps: mime-types@~2.1.13 + - Add new mime types + +1.6.13 / 2016-05-18 +=================== + + * deps: mime-types@~2.1.11 + - Add new mime types + +1.6.12 / 2016-02-28 +=================== + + * deps: mime-types@~2.1.10 + - Add new mime types + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + +1.6.11 / 2016-01-29 +=================== + + * deps: mime-types@~2.1.9 + - Add new mime types + +1.6.10 / 2015-12-01 +=================== + + * deps: mime-types@~2.1.8 + - Add new mime types + +1.6.9 / 2015-09-27 +================== + + * deps: mime-types@~2.1.7 + - Add new mime types + +1.6.8 / 2015-09-04 +================== + + * deps: mime-types@~2.1.6 + - Add new mime types + +1.6.7 / 2015-08-20 +================== + + * Fix type error when given invalid type to match against + * deps: mime-types@~2.1.5 + - Add new mime types + +1.6.6 / 2015-07-31 +================== + + * deps: mime-types@~2.1.4 + - Add new mime types + +1.6.5 / 2015-07-16 +================== + + * deps: mime-types@~2.1.3 + - Add new mime types + +1.6.4 / 2015-07-01 +================== + + * deps: mime-types@~2.1.2 + - Add new mime types + * perf: enable strict mode + * perf: remove argument reassignment + +1.6.3 / 2015-06-08 +================== + + * deps: mime-types@~2.1.1 + - Add new mime types + * perf: reduce try block size + * perf: remove bitwise operations + +1.6.2 / 2015-05-10 +================== + + * deps: mime-types@~2.0.11 + - Add new mime types + +1.6.1 / 2015-03-13 +================== + + * deps: mime-types@~2.0.10 + - Add new mime types + +1.6.0 / 2015-02-12 +================== + + * fix false-positives in `hasBody` `Transfer-Encoding` check + * support wildcard for both type and subtype (`*/*`) + +1.5.7 / 2015-02-09 +================== + + * fix argument reassignment + * deps: mime-types@~2.0.9 + - Add new mime types + +1.5.6 / 2015-01-29 +================== + + * deps: mime-types@~2.0.8 + - Add new mime types + +1.5.5 / 2014-12-30 +================== + + * deps: mime-types@~2.0.7 + - Add new mime types + - Fix missing extensions + - Fix various invalid MIME type entries + - Remove example template MIME types + - deps: mime-db@~1.5.0 + +1.5.4 / 2014-12-10 +================== + + * deps: mime-types@~2.0.4 + - Add new mime types + - deps: mime-db@~1.3.0 + +1.5.3 / 2014-11-09 +================== + + * deps: mime-types@~2.0.3 + - Add new mime types + - deps: mime-db@~1.2.0 + +1.5.2 / 2014-09-28 +================== + + * deps: mime-types@~2.0.2 + - Add new mime types + - deps: mime-db@~1.1.0 + +1.5.1 / 2014-09-07 +================== + + * Support Node.js 0.6 + * deps: media-typer@0.3.0 + * deps: mime-types@~2.0.1 + - Support Node.js 0.6 + +1.5.0 / 2014-09-05 +================== + + * fix `hasbody` to be true for `content-length: 0` + +1.4.0 / 2014-09-02 +================== + + * update mime-types + +1.3.2 / 2014-06-24 +================== + + * use `~` range on mime-types + +1.3.1 / 2014-06-19 +================== + + * fix global variable leak + +1.3.0 / 2014-06-19 +================== + + * improve type parsing + + - invalid media type never matches + - media type not case-sensitive + - extra LWS does not affect results + +1.2.2 / 2014-06-19 +================== + + * fix behavior on unknown type argument + +1.2.1 / 2014-06-03 +================== + + * switch dependency from `mime` to `mime-types@1.0.0` + +1.2.0 / 2014-05-11 +================== + + * support suffix matching: + + - `+json` matches `application/vnd+json` + - `*/vnd+json` matches `application/vnd+json` + - `application/*+json` matches `application/vnd+json` + +1.1.0 / 2014-04-12 +================== + + * add non-array values support + * expose internal utilities: + + - `.is()` + - `.hasBody()` + - `.normalize()` + - `.match()` + +1.0.1 / 2014-03-30 +================== + + * add `multipart` as a shorthand diff --git a/graphql-subscription-express/node_modules/type-is/LICENSE b/graphql-subscription-express/node_modules/type-is/LICENSE new file mode 100644 index 0000000..386b7b6 --- /dev/null +++ b/graphql-subscription-express/node_modules/type-is/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/type-is/README.md b/graphql-subscription-express/node_modules/type-is/README.md new file mode 100644 index 0000000..b85ef8f --- /dev/null +++ b/graphql-subscription-express/node_modules/type-is/README.md @@ -0,0 +1,170 @@ +# type-is + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Infer the content-type of a request. + +### Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install type-is +``` + +## API + +```js +var http = require('http') +var typeis = require('type-is') + +http.createServer(function (req, res) { + var istext = typeis(req, ['text/*']) + res.end('you ' + (istext ? 'sent' : 'did not send') + ' me text') +}) +``` + +### typeis(request, types) + +Checks if the `request` is one of the `types`. If the request has no body, +even if there is a `Content-Type` header, then `null` is returned. If the +`Content-Type` header is invalid or does not matches any of the `types`, then +`false` is returned. Otherwise, a string of the type that matched is returned. + +The `request` argument is expected to be a Node.js HTTP request. The `types` +argument is an array of type strings. + +Each type in the `types` array can be one of the following: + +- A file extension name such as `json`. This name will be returned if matched. +- A mime type such as `application/json`. +- A mime type with a wildcard such as `*/*` or `*/json` or `application/*`. + The full mime type will be returned if matched. +- A suffix such as `+json`. This can be combined with a wildcard such as + `*/vnd+json` or `application/*+json`. The full mime type will be returned + if matched. + +Some examples to illustrate the inputs and returned value: + + + +```js +// req.headers.content-type = 'application/json' + +typeis(req, ['json']) // => 'json' +typeis(req, ['html', 'json']) // => 'json' +typeis(req, ['application/*']) // => 'application/json' +typeis(req, ['application/json']) // => 'application/json' + +typeis(req, ['html']) // => false +``` + +### typeis.hasBody(request) + +Returns a Boolean if the given `request` has a body, regardless of the +`Content-Type` header. + +Having a body has no relation to how large the body is (it may be 0 bytes). +This is similar to how file existence works. If a body does exist, then this +indicates that there is data to read from the Node.js request stream. + + + +```js +if (typeis.hasBody(req)) { + // read the body, since there is one + + req.on('data', function (chunk) { + // ... + }) +} +``` + +### typeis.is(mediaType, types) + +Checks if the `mediaType` is one of the `types`. If the `mediaType` is invalid +or does not matches any of the `types`, then `false` is returned. Otherwise, a +string of the type that matched is returned. + +The `mediaType` argument is expected to be a +[media type](https://tools.ietf.org/html/rfc6838) string. The `types` argument +is an array of type strings. + +Each type in the `types` array can be one of the following: + +- A file extension name such as `json`. This name will be returned if matched. +- A mime type such as `application/json`. +- A mime type with a wildcard such as `*/*` or `*/json` or `application/*`. + The full mime type will be returned if matched. +- A suffix such as `+json`. This can be combined with a wildcard such as + `*/vnd+json` or `application/*+json`. The full mime type will be returned + if matched. + +Some examples to illustrate the inputs and returned value: + + + +```js +var mediaType = 'application/json' + +typeis.is(mediaType, ['json']) // => 'json' +typeis.is(mediaType, ['html', 'json']) // => 'json' +typeis.is(mediaType, ['application/*']) // => 'application/json' +typeis.is(mediaType, ['application/json']) // => 'application/json' + +typeis.is(mediaType, ['html']) // => false +``` + +## Examples + +### Example body parser + +```js +var express = require('express') +var typeis = require('type-is') + +var app = express() + +app.use(function bodyParser (req, res, next) { + if (!typeis.hasBody(req)) { + return next() + } + + switch (typeis(req, ['urlencoded', 'json', 'multipart'])) { + case 'urlencoded': + // parse urlencoded body + throw new Error('implement urlencoded body parsing') + case 'json': + // parse json body + throw new Error('implement json body parsing') + case 'multipart': + // parse multipart body + throw new Error('implement multipart body parsing') + default: + // 415 error code + res.statusCode = 415 + res.end() + break + } +}) +``` + +## License + +[MIT](LICENSE) + +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/type-is/master +[coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master +[node-version-image]: https://badgen.net/npm/node/type-is +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/type-is +[npm-url]: https://npmjs.org/package/type-is +[npm-version-image]: https://badgen.net/npm/v/type-is +[travis-image]: https://badgen.net/travis/jshttp/type-is/master +[travis-url]: https://travis-ci.org/jshttp/type-is diff --git a/graphql-subscription-express/node_modules/type-is/index.js b/graphql-subscription-express/node_modules/type-is/index.js new file mode 100644 index 0000000..890ad76 --- /dev/null +++ b/graphql-subscription-express/node_modules/type-is/index.js @@ -0,0 +1,266 @@ +/*! + * type-is + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var typer = require('media-typer') +var mime = require('mime-types') + +/** + * Module exports. + * @public + */ + +module.exports = typeofrequest +module.exports.is = typeis +module.exports.hasBody = hasbody +module.exports.normalize = normalize +module.exports.match = mimeMatch + +/** + * Compare a `value` content-type with `types`. + * Each `type` can be an extension like `html`, + * a special shortcut like `multipart` or `urlencoded`, + * or a mime type. + * + * If no types match, `false` is returned. + * Otherwise, the first `type` that matches is returned. + * + * @param {String} value + * @param {Array} types + * @public + */ + +function typeis (value, types_) { + var i + var types = types_ + + // remove parameters and normalize + var val = tryNormalizeType(value) + + // no type or invalid + if (!val) { + return false + } + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length - 1) + for (i = 0; i < types.length; i++) { + types[i] = arguments[i + 1] + } + } + + // no types, return the content type + if (!types || !types.length) { + return val + } + + var type + for (i = 0; i < types.length; i++) { + if (mimeMatch(normalize(type = types[i]), val)) { + return type[0] === '+' || type.indexOf('*') !== -1 + ? val + : type + } + } + + // no matches + return false +} + +/** + * Check if a request has a request body. + * A request with a body __must__ either have `transfer-encoding` + * or `content-length` headers set. + * http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3 + * + * @param {Object} request + * @return {Boolean} + * @public + */ + +function hasbody (req) { + return req.headers['transfer-encoding'] !== undefined || + !isNaN(req.headers['content-length']) +} + +/** + * Check if the incoming request contains the "Content-Type" + * header field, and it contains any of the give mime `type`s. + * If there is no request body, `null` is returned. + * If there is no content type, `false` is returned. + * Otherwise, it returns the first `type` that matches. + * + * Examples: + * + * // With Content-Type: text/html; charset=utf-8 + * this.is('html'); // => 'html' + * this.is('text/html'); // => 'text/html' + * this.is('text/*', 'application/json'); // => 'text/html' + * + * // When Content-Type is application/json + * this.is('json', 'urlencoded'); // => 'json' + * this.is('application/json'); // => 'application/json' + * this.is('html', 'application/*'); // => 'application/json' + * + * this.is('html'); // => false + * + * @param {String|Array} types... + * @return {String|false|null} + * @public + */ + +function typeofrequest (req, types_) { + var types = types_ + + // no body + if (!hasbody(req)) { + return null + } + + // support flattened arguments + if (arguments.length > 2) { + types = new Array(arguments.length - 1) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i + 1] + } + } + + // request content type + var value = req.headers['content-type'] + + return typeis(value, types) +} + +/** + * Normalize a mime type. + * If it's a shorthand, expand it to a valid mime type. + * + * In general, you probably want: + * + * var type = is(req, ['urlencoded', 'json', 'multipart']); + * + * Then use the appropriate body parsers. + * These three are the most common request body types + * and are thus ensured to work. + * + * @param {String} type + * @private + */ + +function normalize (type) { + if (typeof type !== 'string') { + // invalid type + return false + } + + switch (type) { + case 'urlencoded': + return 'application/x-www-form-urlencoded' + case 'multipart': + return 'multipart/*' + } + + if (type[0] === '+') { + // "+json" -> "*/*+json" expando + return '*/*' + type + } + + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type +} + +/** + * Check if `expected` mime type + * matches `actual` mime type with + * wildcard and +suffix support. + * + * @param {String} expected + * @param {String} actual + * @return {Boolean} + * @private + */ + +function mimeMatch (expected, actual) { + // invalid type + if (expected === false) { + return false + } + + // split types + var actualParts = actual.split('/') + var expectedParts = expected.split('/') + + // invalid format + if (actualParts.length !== 2 || expectedParts.length !== 2) { + return false + } + + // validate type + if (expectedParts[0] !== '*' && expectedParts[0] !== actualParts[0]) { + return false + } + + // validate suffix wildcard + if (expectedParts[1].substr(0, 2) === '*+') { + return expectedParts[1].length <= actualParts[1].length + 1 && + expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length) + } + + // validate subtype + if (expectedParts[1] !== '*' && expectedParts[1] !== actualParts[1]) { + return false + } + + return true +} + +/** + * Normalize a type and remove parameters. + * + * @param {string} value + * @return {string} + * @private + */ + +function normalizeType (value) { + // parse the type + var type = typer.parse(value) + + // remove the parameters + type.parameters = undefined + + // reformat it + return typer.format(type) +} + +/** + * Try to normalize a type and remove parameters. + * + * @param {string} value + * @return {string} + * @private + */ + +function tryNormalizeType (value) { + if (!value) { + return null + } + + try { + return normalizeType(value) + } catch (err) { + return null + } +} diff --git a/graphql-subscription-express/node_modules/type-is/package.json b/graphql-subscription-express/node_modules/type-is/package.json new file mode 100644 index 0000000..97ba5f1 --- /dev/null +++ b/graphql-subscription-express/node_modules/type-is/package.json @@ -0,0 +1,45 @@ +{ + "name": "type-is", + "description": "Infer the content-type of a request.", + "version": "1.6.18", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "jshttp/type-is", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "devDependencies": { + "eslint": "5.16.0", + "eslint-config-standard": "12.0.0", + "eslint-plugin-import": "2.17.2", + "eslint-plugin-markdown": "1.0.0", + "eslint-plugin-node": "8.0.1", + "eslint-plugin-promise": "4.1.1", + "eslint-plugin-standard": "4.0.0", + "mocha": "6.1.4", + "nyc": "14.0.0" + }, + "engines": { + "node": ">= 0.6" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "scripts": { + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "test-travis": "nyc --reporter=text npm test" + }, + "keywords": [ + "content", + "type", + "checking" + ] +} diff --git a/graphql-subscription-express/node_modules/unpipe/HISTORY.md b/graphql-subscription-express/node_modules/unpipe/HISTORY.md new file mode 100644 index 0000000..85e0f8d --- /dev/null +++ b/graphql-subscription-express/node_modules/unpipe/HISTORY.md @@ -0,0 +1,4 @@ +1.0.0 / 2015-06-14 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/unpipe/LICENSE b/graphql-subscription-express/node_modules/unpipe/LICENSE new file mode 100644 index 0000000..aed0138 --- /dev/null +++ b/graphql-subscription-express/node_modules/unpipe/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/unpipe/README.md b/graphql-subscription-express/node_modules/unpipe/README.md new file mode 100644 index 0000000..e536ad2 --- /dev/null +++ b/graphql-subscription-express/node_modules/unpipe/README.md @@ -0,0 +1,43 @@ +# unpipe + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Unpipe a stream from all destinations. + +## Installation + +```sh +$ npm install unpipe +``` + +## API + +```js +var unpipe = require('unpipe') +``` + +### unpipe(stream) + +Unpipes all destinations from a given stream. With stream 2+, this is +equivalent to `stream.unpipe()`. When used with streams 1 style streams +(typically Node.js 0.8 and below), this module attempts to undo the +actions done in `stream.pipe(dest)`. + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/unpipe.svg +[npm-url]: https://npmjs.org/package/unpipe +[node-image]: https://img.shields.io/node/v/unpipe.svg +[node-url]: http://nodejs.org/download/ +[travis-image]: https://img.shields.io/travis/stream-utils/unpipe.svg +[travis-url]: https://travis-ci.org/stream-utils/unpipe +[coveralls-image]: https://img.shields.io/coveralls/stream-utils/unpipe.svg +[coveralls-url]: https://coveralls.io/r/stream-utils/unpipe?branch=master +[downloads-image]: https://img.shields.io/npm/dm/unpipe.svg +[downloads-url]: https://npmjs.org/package/unpipe diff --git a/graphql-subscription-express/node_modules/unpipe/index.js b/graphql-subscription-express/node_modules/unpipe/index.js new file mode 100644 index 0000000..15c3d97 --- /dev/null +++ b/graphql-subscription-express/node_modules/unpipe/index.js @@ -0,0 +1,69 @@ +/*! + * unpipe + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = unpipe + +/** + * Determine if there are Node.js pipe-like data listeners. + * @private + */ + +function hasPipeDataListeners(stream) { + var listeners = stream.listeners('data') + + for (var i = 0; i < listeners.length; i++) { + if (listeners[i].name === 'ondata') { + return true + } + } + + return false +} + +/** + * Unpipe a stream from all destinations. + * + * @param {object} stream + * @public + */ + +function unpipe(stream) { + if (!stream) { + throw new TypeError('argument stream is required') + } + + if (typeof stream.unpipe === 'function') { + // new-style + stream.unpipe() + return + } + + // Node.js 0.8 hack + if (!hasPipeDataListeners(stream)) { + return + } + + var listener + var listeners = stream.listeners('close') + + for (var i = 0; i < listeners.length; i++) { + listener = listeners[i] + + if (listener.name !== 'cleanup' && listener.name !== 'onclose') { + continue + } + + // invoke the listener + listener.call(stream) + } +} diff --git a/graphql-subscription-express/node_modules/unpipe/package.json b/graphql-subscription-express/node_modules/unpipe/package.json new file mode 100644 index 0000000..a2b7358 --- /dev/null +++ b/graphql-subscription-express/node_modules/unpipe/package.json @@ -0,0 +1,27 @@ +{ + "name": "unpipe", + "description": "Unpipe a stream from all destinations", + "version": "1.0.0", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "repository": "stream-utils/unpipe", + "devDependencies": { + "istanbul": "0.3.15", + "mocha": "2.2.5", + "readable-stream": "1.1.13" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/utils-merge/.npmignore b/graphql-subscription-express/node_modules/utils-merge/.npmignore new file mode 100644 index 0000000..3e53844 --- /dev/null +++ b/graphql-subscription-express/node_modules/utils-merge/.npmignore @@ -0,0 +1,9 @@ +CONTRIBUTING.md +Makefile +docs/ +examples/ +reports/ +test/ + +.jshintrc +.travis.yml diff --git a/graphql-subscription-express/node_modules/utils-merge/LICENSE b/graphql-subscription-express/node_modules/utils-merge/LICENSE new file mode 100644 index 0000000..76f6d08 --- /dev/null +++ b/graphql-subscription-express/node_modules/utils-merge/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013-2017 Jared Hanson + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/utils-merge/README.md b/graphql-subscription-express/node_modules/utils-merge/README.md new file mode 100644 index 0000000..0cb7117 --- /dev/null +++ b/graphql-subscription-express/node_modules/utils-merge/README.md @@ -0,0 +1,34 @@ +# utils-merge + +[![Version](https://img.shields.io/npm/v/utils-merge.svg?label=version)](https://www.npmjs.com/package/utils-merge) +[![Build](https://img.shields.io/travis/jaredhanson/utils-merge.svg)](https://travis-ci.org/jaredhanson/utils-merge) +[![Quality](https://img.shields.io/codeclimate/github/jaredhanson/utils-merge.svg?label=quality)](https://codeclimate.com/github/jaredhanson/utils-merge) +[![Coverage](https://img.shields.io/coveralls/jaredhanson/utils-merge.svg)](https://coveralls.io/r/jaredhanson/utils-merge) +[![Dependencies](https://img.shields.io/david/jaredhanson/utils-merge.svg)](https://david-dm.org/jaredhanson/utils-merge) + + +Merges the properties from a source object into a destination object. + +## Install + +```bash +$ npm install utils-merge +``` + +## Usage + +```javascript +var a = { foo: 'bar' } + , b = { bar: 'baz' }; + +merge(a, b); +// => { foo: 'bar', bar: 'baz' } +``` + +## License + +[The MIT License](http://opensource.org/licenses/MIT) + +Copyright (c) 2013-2017 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> + + Sponsor diff --git a/graphql-subscription-express/node_modules/utils-merge/index.js b/graphql-subscription-express/node_modules/utils-merge/index.js new file mode 100644 index 0000000..4265c69 --- /dev/null +++ b/graphql-subscription-express/node_modules/utils-merge/index.js @@ -0,0 +1,23 @@ +/** + * Merge object b with object a. + * + * var a = { foo: 'bar' } + * , b = { bar: 'baz' }; + * + * merge(a, b); + * // => { foo: 'bar', bar: 'baz' } + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api public + */ + +exports = module.exports = function(a, b){ + if (a && b) { + for (var key in b) { + a[key] = b[key]; + } + } + return a; +}; diff --git a/graphql-subscription-express/node_modules/utils-merge/package.json b/graphql-subscription-express/node_modules/utils-merge/package.json new file mode 100644 index 0000000..e36b078 --- /dev/null +++ b/graphql-subscription-express/node_modules/utils-merge/package.json @@ -0,0 +1,40 @@ +{ + "name": "utils-merge", + "version": "1.0.1", + "description": "merge() utility function", + "keywords": [ + "util" + ], + "author": { + "name": "Jared Hanson", + "email": "jaredhanson@gmail.com", + "url": "http://www.jaredhanson.net/" + }, + "repository": { + "type": "git", + "url": "git://github.com/jaredhanson/utils-merge.git" + }, + "bugs": { + "url": "http://github.com/jaredhanson/utils-merge/issues" + }, + "license": "MIT", + "licenses": [ + { + "type": "MIT", + "url": "http://opensource.org/licenses/MIT" + } + ], + "main": "./index", + "dependencies": {}, + "devDependencies": { + "make-node": "0.3.x", + "mocha": "1.x.x", + "chai": "1.x.x" + }, + "engines": { + "node": ">= 0.4.0" + }, + "scripts": { + "test": "node_modules/.bin/mocha --reporter spec --require test/bootstrap/node test/*.test.js" + } +} diff --git a/graphql-subscription-express/node_modules/vary/HISTORY.md b/graphql-subscription-express/node_modules/vary/HISTORY.md new file mode 100644 index 0000000..f6cbcf7 --- /dev/null +++ b/graphql-subscription-express/node_modules/vary/HISTORY.md @@ -0,0 +1,39 @@ +1.1.2 / 2017-09-23 +================== + + * perf: improve header token parsing speed + +1.1.1 / 2017-03-20 +================== + + * perf: hoist regular expression + +1.1.0 / 2015-09-29 +================== + + * Only accept valid field names in the `field` argument + - Ensures the resulting string is a valid HTTP header value + +1.0.1 / 2015-07-08 +================== + + * Fix setting empty header from empty `field` + * perf: enable strict mode + * perf: remove argument reassignments + +1.0.0 / 2014-08-10 +================== + + * Accept valid `Vary` header string as `field` + * Add `vary.append` for low-level string manipulation + * Move to `jshttp` orgainzation + +0.1.0 / 2014-06-05 +================== + + * Support array of fields to set + +0.0.0 / 2014-06-04 +================== + + * Initial release diff --git a/graphql-subscription-express/node_modules/vary/LICENSE b/graphql-subscription-express/node_modules/vary/LICENSE new file mode 100644 index 0000000..84441fb --- /dev/null +++ b/graphql-subscription-express/node_modules/vary/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/vary/README.md b/graphql-subscription-express/node_modules/vary/README.md new file mode 100644 index 0000000..cc000b3 --- /dev/null +++ b/graphql-subscription-express/node_modules/vary/README.md @@ -0,0 +1,101 @@ +# vary + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][travis-image]][travis-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Manipulate the HTTP Vary header + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install vary +``` + +## API + + + +```js +var vary = require('vary') +``` + +### vary(res, field) + +Adds the given header `field` to the `Vary` response header of `res`. +This can be a string of a single field, a string of a valid `Vary` +header, or an array of multiple fields. + +This will append the header if not already listed, otherwise leaves +it listed in the current location. + + + +```js +// Append "Origin" to the Vary header of the response +vary(res, 'Origin') +``` + +### vary.append(header, field) + +Adds the given header `field` to the `Vary` response header string `header`. +This can be a string of a single field, a string of a valid `Vary` header, +or an array of multiple fields. + +This will append the header if not already listed, otherwise leaves +it listed in the current location. The new header string is returned. + + + +```js +// Get header string appending "Origin" to "Accept, User-Agent" +vary.append('Accept, User-Agent', 'Origin') +``` + +## Examples + +### Updating the Vary header when content is based on it + +```js +var http = require('http') +var vary = require('vary') + +http.createServer(function onRequest (req, res) { + // about to user-agent sniff + vary(res, 'User-Agent') + + var ua = req.headers['user-agent'] || '' + var isMobile = /mobi|android|touch|mini/i.test(ua) + + // serve site, depending on isMobile + res.setHeader('Content-Type', 'text/html') + res.end('You are (probably) ' + (isMobile ? '' : 'not ') + 'a mobile user') +}) +``` + +## Testing + +```sh +$ npm test +``` + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/vary.svg +[npm-url]: https://npmjs.org/package/vary +[node-version-image]: https://img.shields.io/node/v/vary.svg +[node-version-url]: https://nodejs.org/en/download +[travis-image]: https://img.shields.io/travis/jshttp/vary/master.svg +[travis-url]: https://travis-ci.org/jshttp/vary +[coveralls-image]: https://img.shields.io/coveralls/jshttp/vary/master.svg +[coveralls-url]: https://coveralls.io/r/jshttp/vary +[downloads-image]: https://img.shields.io/npm/dm/vary.svg +[downloads-url]: https://npmjs.org/package/vary diff --git a/graphql-subscription-express/node_modules/vary/index.js b/graphql-subscription-express/node_modules/vary/index.js new file mode 100644 index 0000000..5b5e741 --- /dev/null +++ b/graphql-subscription-express/node_modules/vary/index.js @@ -0,0 +1,149 @@ +/*! + * vary + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + */ + +module.exports = vary +module.exports.append = append + +/** + * RegExp to match field-name in RFC 7230 sec 3.2 + * + * field-name = token + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + */ + +var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/ + +/** + * Append a field to a vary header. + * + * @param {String} header + * @param {String|Array} field + * @return {String} + * @public + */ + +function append (header, field) { + if (typeof header !== 'string') { + throw new TypeError('header argument is required') + } + + if (!field) { + throw new TypeError('field argument is required') + } + + // get fields array + var fields = !Array.isArray(field) + ? parse(String(field)) + : field + + // assert on invalid field names + for (var j = 0; j < fields.length; j++) { + if (!FIELD_NAME_REGEXP.test(fields[j])) { + throw new TypeError('field argument contains an invalid header name') + } + } + + // existing, unspecified vary + if (header === '*') { + return header + } + + // enumerate current values + var val = header + var vals = parse(header.toLowerCase()) + + // unspecified vary + if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) { + return '*' + } + + for (var i = 0; i < fields.length; i++) { + var fld = fields[i].toLowerCase() + + // append value (case-preserving) + if (vals.indexOf(fld) === -1) { + vals.push(fld) + val = val + ? val + ', ' + fields[i] + : fields[i] + } + } + + return val +} + +/** + * Parse a vary header into an array. + * + * @param {String} header + * @return {Array} + * @private + */ + +function parse (header) { + var end = 0 + var list = [] + var start = 0 + + // gather tokens + for (var i = 0, len = header.length; i < len; i++) { + switch (header.charCodeAt(i)) { + case 0x20: /* */ + if (start === end) { + start = end = i + 1 + } + break + case 0x2c: /* , */ + list.push(header.substring(start, end)) + start = end = i + 1 + break + default: + end = i + 1 + break + } + } + + // final token + list.push(header.substring(start, end)) + + return list +} + +/** + * Mark that a request is varied on a header field. + * + * @param {Object} res + * @param {String|Array} field + * @public + */ + +function vary (res, field) { + if (!res || !res.getHeader || !res.setHeader) { + // quack quack + throw new TypeError('res argument is required') + } + + // get existing header + var val = res.getHeader('Vary') || '' + var header = Array.isArray(val) + ? val.join(', ') + : String(val) + + // set new header + if ((val = append(header, field))) { + res.setHeader('Vary', val) + } +} diff --git a/graphql-subscription-express/node_modules/vary/package.json b/graphql-subscription-express/node_modules/vary/package.json new file mode 100644 index 0000000..028f72a --- /dev/null +++ b/graphql-subscription-express/node_modules/vary/package.json @@ -0,0 +1,43 @@ +{ + "name": "vary", + "description": "Manipulate the HTTP Vary header", + "version": "1.1.2", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "http", + "res", + "vary" + ], + "repository": "jshttp/vary", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "3.19.0", + "eslint-config-standard": "10.2.1", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-node": "5.1.1", + "eslint-plugin-promise": "3.5.0", + "eslint-plugin-standard": "3.0.1", + "istanbul": "0.4.5", + "mocha": "2.5.3", + "supertest": "1.1.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/graphql-subscription-express/node_modules/ws/LICENSE b/graphql-subscription-express/node_modules/ws/LICENSE new file mode 100644 index 0000000..1da5b96 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2011 Einar Otto Stangvik +Copyright (c) 2013 Arnout Kazemier and contributors +Copyright (c) 2016 Luigi Pinca and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription-express/node_modules/ws/README.md b/graphql-subscription-express/node_modules/ws/README.md new file mode 100644 index 0000000..21f10df --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/README.md @@ -0,0 +1,548 @@ +# ws: a Node.js WebSocket library + +[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws) +[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster) +[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws) + +ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and +server implementation. + +Passes the quite extensive Autobahn test suite: [server][server-report], +[client][client-report]. + +**Note**: This module does not work in the browser. The client in the docs is a +reference to a backend with the role of a client in the WebSocket communication. +Browser clients must use the native +[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) +object. To make the same code work seamlessly on Node.js and the browser, you +can use one of the many wrappers available on npm, like +[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). + +## Table of Contents + +- [Protocol support](#protocol-support) +- [Installing](#installing) + - [Opt-in for performance](#opt-in-for-performance) + - [Legacy opt-in for performance](#legacy-opt-in-for-performance) +- [API docs](#api-docs) +- [WebSocket compression](#websocket-compression) +- [Usage examples](#usage-examples) + - [Sending and receiving text data](#sending-and-receiving-text-data) + - [Sending binary data](#sending-binary-data) + - [Simple server](#simple-server) + - [External HTTP/S server](#external-https-server) + - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) + - [Client authentication](#client-authentication) + - [Server broadcast](#server-broadcast) + - [Round-trip time](#round-trip-time) + - [Use the Node.js streams API](#use-the-nodejs-streams-api) + - [Other examples](#other-examples) +- [FAQ](#faq) + - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) + - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) + - [How to connect via a proxy?](#how-to-connect-via-a-proxy) +- [Changelog](#changelog) +- [License](#license) + +## Protocol support + +- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) +- **HyBi drafts 13-17** (Current default, alternatively option + `protocolVersion: 13`) + +## Installing + +``` +npm install ws +``` + +### Opt-in for performance + +[bufferutil][] is an optional module that can be installed alongside the ws +module: + +``` +npm install --save-optional bufferutil +``` + +This is a binary addon that improves the performance of certain operations such +as masking and unmasking the data payload of the WebSocket frames. Prebuilt +binaries are available for the most popular platforms, so you don't necessarily +need to have a C++ compiler installed on your machine. + +To force ws to not use bufferutil, use the +[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This +can be useful to enhance security in systems where a user can put a package in +the package search path of an application of another user, due to how the +Node.js resolver algorithm works. + +#### Legacy opt-in for performance + +If you are running on an old version of Node.js (prior to v18.14.0), ws also +supports the [utf-8-validate][] module: + +``` +npm install --save-optional utf-8-validate +``` + +This contains a binary polyfill for [`buffer.isUtf8()`][]. + +To force ws not to use utf-8-validate, use the +[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable. + +## API docs + +See [`/doc/ws.md`](./doc/ws.md) for Node.js-like documentation of ws classes and +utility functions. + +## WebSocket compression + +ws supports the [permessage-deflate extension][permessage-deflate] which enables +the client and server to negotiate a compression algorithm and its parameters, +and then selectively apply it to the data payloads of each WebSocket message. + +The extension is disabled by default on the server and enabled by default on the +client. It adds a significant overhead in terms of performance and memory +consumption so we suggest to enable it only if it is really needed. + +Note that Node.js has a variety of issues with high-performance compression, +where increased concurrency, especially on Linux, can lead to [catastrophic +memory fragmentation][node-zlib-bug] and slow performance. If you intend to use +permessage-deflate in production, it is worthwhile to set up a test +representative of your workload and ensure Node.js/zlib will handle it with +acceptable performance and memory usage. + +Tuning of permessage-deflate can be done via the options defined below. You can +also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly +into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. + +See [the docs][ws-server-options] for more options. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ + port: 8080, + perMessageDeflate: { + zlibDeflateOptions: { + // See zlib defaults. + chunkSize: 1024, + memLevel: 7, + level: 3 + }, + zlibInflateOptions: { + chunkSize: 10 * 1024 + }, + // Other options settable: + clientNoContextTakeover: true, // Defaults to negotiated value. + serverNoContextTakeover: true, // Defaults to negotiated value. + serverMaxWindowBits: 10, // Defaults to negotiated value. + // Below options specified as default values. + concurrencyLimit: 10, // Limits zlib concurrency for perf. + threshold: 1024 // Size (in bytes) below which messages + // should not be compressed if context takeover is disabled. + } +}); +``` + +The client will only use the extension if it is supported and enabled on the +server. To always disable the extension on the client, set the +`perMessageDeflate` option to `false`. + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path', { + perMessageDeflate: false +}); +``` + +## Usage examples + +### Sending and receiving text data + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('error', console.error); + +ws.on('open', function open() { + ws.send('something'); +}); + +ws.on('message', function message(data) { + console.log('received: %s', data); +}); +``` + +### Sending binary data + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('error', console.error); + +ws.on('open', function open() { + const array = new Float32Array(5); + + for (var i = 0; i < array.length; ++i) { + array[i] = i / 2; + } + + ws.send(array); +}); +``` + +### Simple server + +```js +import { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log('received: %s', data); + }); + + ws.send('something'); +}); +``` + +### External HTTP/S server + +```js +import { createServer } from 'https'; +import { readFileSync } from 'fs'; +import { WebSocketServer } from 'ws'; + +const server = createServer({ + cert: readFileSync('/path/to/cert.pem'), + key: readFileSync('/path/to/key.pem') +}); +const wss = new WebSocketServer({ server }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log('received: %s', data); + }); + + ws.send('something'); +}); + +server.listen(8080); +``` + +### Multiple servers sharing a single HTTP/S server + +```js +import { createServer } from 'http'; +import { WebSocketServer } from 'ws'; + +const server = createServer(); +const wss1 = new WebSocketServer({ noServer: true }); +const wss2 = new WebSocketServer({ noServer: true }); + +wss1.on('connection', function connection(ws) { + ws.on('error', console.error); + + // ... +}); + +wss2.on('connection', function connection(ws) { + ws.on('error', console.error); + + // ... +}); + +server.on('upgrade', function upgrade(request, socket, head) { + const { pathname } = new URL(request.url, 'wss://base.url'); + + if (pathname === '/foo') { + wss1.handleUpgrade(request, socket, head, function done(ws) { + wss1.emit('connection', ws, request); + }); + } else if (pathname === '/bar') { + wss2.handleUpgrade(request, socket, head, function done(ws) { + wss2.emit('connection', ws, request); + }); + } else { + socket.destroy(); + } +}); + +server.listen(8080); +``` + +### Client authentication + +```js +import { createServer } from 'http'; +import { WebSocketServer } from 'ws'; + +function onSocketError(err) { + console.error(err); +} + +const server = createServer(); +const wss = new WebSocketServer({ noServer: true }); + +wss.on('connection', function connection(ws, request, client) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log(`Received message ${data} from user ${client}`); + }); +}); + +server.on('upgrade', function upgrade(request, socket, head) { + socket.on('error', onSocketError); + + // This function is not defined on purpose. Implement it with your own logic. + authenticate(request, function next(err, client) { + if (err || !client) { + socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n'); + socket.destroy(); + return; + } + + socket.removeListener('error', onSocketError); + + wss.handleUpgrade(request, socket, head, function done(ws) { + wss.emit('connection', ws, request, client); + }); + }); +}); + +server.listen(8080); +``` + +Also see the provided [example][session-parse-example] using `express-session`. + +### Server broadcast + +A client WebSocket broadcasting to all connected WebSocket clients, including +itself. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data, isBinary) { + wss.clients.forEach(function each(client) { + if (client.readyState === WebSocket.OPEN) { + client.send(data, { binary: isBinary }); + } + }); + }); +}); +``` + +A client WebSocket broadcasting to every other connected WebSocket clients, +excluding itself. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data, isBinary) { + wss.clients.forEach(function each(client) { + if (client !== ws && client.readyState === WebSocket.OPEN) { + client.send(data, { binary: isBinary }); + } + }); + }); +}); +``` + +### Round-trip time + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('wss://websocket-echo.com/'); + +ws.on('error', console.error); + +ws.on('open', function open() { + console.log('connected'); + ws.send(Date.now()); +}); + +ws.on('close', function close() { + console.log('disconnected'); +}); + +ws.on('message', function message(data) { + console.log(`Round-trip time: ${Date.now() - data} ms`); + + setTimeout(function timeout() { + ws.send(Date.now()); + }, 500); +}); +``` + +### Use the Node.js streams API + +```js +import WebSocket, { createWebSocketStream } from 'ws'; + +const ws = new WebSocket('wss://websocket-echo.com/'); + +const duplex = createWebSocketStream(ws, { encoding: 'utf8' }); + +duplex.on('error', console.error); + +duplex.pipe(process.stdout); +process.stdin.pipe(duplex); +``` + +### Other examples + +For a full example with a browser client communicating with a ws server, see the +examples folder. + +Otherwise, see the test cases. + +## FAQ + +### How to get the IP address of the client? + +The remote IP address can be obtained from the raw socket. + +```js +import { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws, req) { + const ip = req.socket.remoteAddress; + + ws.on('error', console.error); +}); +``` + +When the server runs behind a proxy like NGINX, the de-facto standard is to use +the `X-Forwarded-For` header. + +```js +wss.on('connection', function connection(ws, req) { + const ip = req.headers['x-forwarded-for'].split(',')[0].trim(); + + ws.on('error', console.error); +}); +``` + +### How to detect and close broken connections? + +Sometimes, the link between the server and the client can be interrupted in a +way that keeps both the server and the client unaware of the broken state of the +connection (e.g. when pulling the cord). + +In these cases, ping messages can be used as a means to verify that the remote +endpoint is still responsive. + +```js +import { WebSocketServer } from 'ws'; + +function heartbeat() { + this.isAlive = true; +} + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.isAlive = true; + ws.on('error', console.error); + ws.on('pong', heartbeat); +}); + +const interval = setInterval(function ping() { + wss.clients.forEach(function each(ws) { + if (ws.isAlive === false) return ws.terminate(); + + ws.isAlive = false; + ws.ping(); + }); +}, 30000); + +wss.on('close', function close() { + clearInterval(interval); +}); +``` + +Pong messages are automatically sent in response to ping messages as required by +the spec. + +Just like the server example above, your clients might as well lose connection +without knowing it. You might want to add a ping listener on your clients to +prevent that. A simple implementation would be: + +```js +import WebSocket from 'ws'; + +function heartbeat() { + clearTimeout(this.pingTimeout); + + // Use `WebSocket#terminate()`, which immediately destroys the connection, + // instead of `WebSocket#close()`, which waits for the close timer. + // Delay should be equal to the interval at which your server + // sends out pings plus a conservative assumption of the latency. + this.pingTimeout = setTimeout(() => { + this.terminate(); + }, 30000 + 1000); +} + +const client = new WebSocket('wss://websocket-echo.com/'); + +client.on('error', console.error); +client.on('open', heartbeat); +client.on('ping', heartbeat); +client.on('close', function clear() { + clearTimeout(this.pingTimeout); +}); +``` + +### How to connect via a proxy? + +Use a custom `http.Agent` implementation like [https-proxy-agent][] or +[socks-proxy-agent][]. + +## Changelog + +We're using the GitHub [releases][changelog] for changelog entries. + +## License + +[MIT](LICENSE) + +[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input +[bufferutil]: https://github.com/websockets/bufferutil +[changelog]: https://github.com/websockets/ws/releases +[client-report]: http://websockets.github.io/ws/autobahn/clients/ +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent +[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 +[node-zlib-deflaterawdocs]: + https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options +[permessage-deflate]: https://tools.ietf.org/html/rfc7692 +[server-report]: http://websockets.github.io/ws/autobahn/servers/ +[session-parse-example]: ./examples/express-session-parse +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent +[utf-8-validate]: https://github.com/websockets/utf-8-validate +[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback diff --git a/graphql-subscription-express/node_modules/ws/browser.js b/graphql-subscription-express/node_modules/ws/browser.js new file mode 100644 index 0000000..ca4f628 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/browser.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + throw new Error( + 'ws does not work in the browser. Browser clients must use the native ' + + 'WebSocket object' + ); +}; diff --git a/graphql-subscription-express/node_modules/ws/index.js b/graphql-subscription-express/node_modules/ws/index.js new file mode 100644 index 0000000..41edb3b --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/index.js @@ -0,0 +1,13 @@ +'use strict'; + +const WebSocket = require('./lib/websocket'); + +WebSocket.createWebSocketStream = require('./lib/stream'); +WebSocket.Server = require('./lib/websocket-server'); +WebSocket.Receiver = require('./lib/receiver'); +WebSocket.Sender = require('./lib/sender'); + +WebSocket.WebSocket = WebSocket; +WebSocket.WebSocketServer = WebSocket.Server; + +module.exports = WebSocket; diff --git a/graphql-subscription-express/node_modules/ws/lib/buffer-util.js b/graphql-subscription-express/node_modules/ws/lib/buffer-util.js new file mode 100644 index 0000000..f7536e2 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/buffer-util.js @@ -0,0 +1,131 @@ +'use strict'; + +const { EMPTY_BUFFER } = require('./constants'); + +const FastBuffer = Buffer[Symbol.species]; + +/** + * Merges an array of buffers into a new buffer. + * + * @param {Buffer[]} list The array of buffers to concat + * @param {Number} totalLength The total length of buffers in the list + * @return {Buffer} The resulting buffer + * @public + */ +function concat(list, totalLength) { + if (list.length === 0) return EMPTY_BUFFER; + if (list.length === 1) return list[0]; + + const target = Buffer.allocUnsafe(totalLength); + let offset = 0; + + for (let i = 0; i < list.length; i++) { + const buf = list[i]; + target.set(buf, offset); + offset += buf.length; + } + + if (offset < totalLength) { + return new FastBuffer(target.buffer, target.byteOffset, offset); + } + + return target; +} + +/** + * Masks a buffer using the given mask. + * + * @param {Buffer} source The buffer to mask + * @param {Buffer} mask The mask to use + * @param {Buffer} output The buffer where to store the result + * @param {Number} offset The offset at which to start writing + * @param {Number} length The number of bytes to mask. + * @public + */ +function _mask(source, mask, output, offset, length) { + for (let i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } +} + +/** + * Unmasks a buffer using the given mask. + * + * @param {Buffer} buffer The buffer to unmask + * @param {Buffer} mask The mask to use + * @public + */ +function _unmask(buffer, mask) { + for (let i = 0; i < buffer.length; i++) { + buffer[i] ^= mask[i & 3]; + } +} + +/** + * Converts a buffer to an `ArrayBuffer`. + * + * @param {Buffer} buf The buffer to convert + * @return {ArrayBuffer} Converted buffer + * @public + */ +function toArrayBuffer(buf) { + if (buf.length === buf.buffer.byteLength) { + return buf.buffer; + } + + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length); +} + +/** + * Converts `data` to a `Buffer`. + * + * @param {*} data The data to convert + * @return {Buffer} The buffer + * @throws {TypeError} + * @public + */ +function toBuffer(data) { + toBuffer.readOnly = true; + + if (Buffer.isBuffer(data)) return data; + + let buf; + + if (data instanceof ArrayBuffer) { + buf = new FastBuffer(data); + } else if (ArrayBuffer.isView(data)) { + buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength); + } else { + buf = Buffer.from(data); + toBuffer.readOnly = false; + } + + return buf; +} + +module.exports = { + concat, + mask: _mask, + toArrayBuffer, + toBuffer, + unmask: _unmask +}; + +/* istanbul ignore else */ +if (!process.env.WS_NO_BUFFER_UTIL) { + try { + const bufferUtil = require('bufferutil'); + + module.exports.mask = function (source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bufferUtil.mask(source, mask, output, offset, length); + }; + + module.exports.unmask = function (buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bufferUtil.unmask(buffer, mask); + }; + } catch (e) { + // Continue regardless of the error. + } +} diff --git a/graphql-subscription-express/node_modules/ws/lib/constants.js b/graphql-subscription-express/node_modules/ws/lib/constants.js new file mode 100644 index 0000000..d691b30 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/constants.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = { + BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], + EMPTY_BUFFER: Buffer.alloc(0), + GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', + kForOnEventAttribute: Symbol('kIsForOnEventAttribute'), + kListener: Symbol('kListener'), + kStatusCode: Symbol('status-code'), + kWebSocket: Symbol('websocket'), + NOOP: () => {} +}; diff --git a/graphql-subscription-express/node_modules/ws/lib/event-target.js b/graphql-subscription-express/node_modules/ws/lib/event-target.js new file mode 100644 index 0000000..fea4cbc --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/event-target.js @@ -0,0 +1,292 @@ +'use strict'; + +const { kForOnEventAttribute, kListener } = require('./constants'); + +const kCode = Symbol('kCode'); +const kData = Symbol('kData'); +const kError = Symbol('kError'); +const kMessage = Symbol('kMessage'); +const kReason = Symbol('kReason'); +const kTarget = Symbol('kTarget'); +const kType = Symbol('kType'); +const kWasClean = Symbol('kWasClean'); + +/** + * Class representing an event. + */ +class Event { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @throws {TypeError} If the `type` argument is not specified + */ + constructor(type) { + this[kTarget] = null; + this[kType] = type; + } + + /** + * @type {*} + */ + get target() { + return this[kTarget]; + } + + /** + * @type {String} + */ + get type() { + return this[kType]; + } +} + +Object.defineProperty(Event.prototype, 'target', { enumerable: true }); +Object.defineProperty(Event.prototype, 'type', { enumerable: true }); + +/** + * Class representing a close event. + * + * @extends Event + */ +class CloseEvent extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {Number} [options.code=0] The status code explaining why the + * connection was closed + * @param {String} [options.reason=''] A human-readable string explaining why + * the connection was closed + * @param {Boolean} [options.wasClean=false] Indicates whether or not the + * connection was cleanly closed + */ + constructor(type, options = {}) { + super(type); + + this[kCode] = options.code === undefined ? 0 : options.code; + this[kReason] = options.reason === undefined ? '' : options.reason; + this[kWasClean] = options.wasClean === undefined ? false : options.wasClean; + } + + /** + * @type {Number} + */ + get code() { + return this[kCode]; + } + + /** + * @type {String} + */ + get reason() { + return this[kReason]; + } + + /** + * @type {Boolean} + */ + get wasClean() { + return this[kWasClean]; + } +} + +Object.defineProperty(CloseEvent.prototype, 'code', { enumerable: true }); +Object.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true }); +Object.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true }); + +/** + * Class representing an error event. + * + * @extends Event + */ +class ErrorEvent extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.error=null] The error that generated this event + * @param {String} [options.message=''] The error message + */ + constructor(type, options = {}) { + super(type); + + this[kError] = options.error === undefined ? null : options.error; + this[kMessage] = options.message === undefined ? '' : options.message; + } + + /** + * @type {*} + */ + get error() { + return this[kError]; + } + + /** + * @type {String} + */ + get message() { + return this[kMessage]; + } +} + +Object.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true }); +Object.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true }); + +/** + * Class representing a message event. + * + * @extends Event + */ +class MessageEvent extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.data=null] The message content + */ + constructor(type, options = {}) { + super(type); + + this[kData] = options.data === undefined ? null : options.data; + } + + /** + * @type {*} + */ + get data() { + return this[kData]; + } +} + +Object.defineProperty(MessageEvent.prototype, 'data', { enumerable: true }); + +/** + * This provides methods for emulating the `EventTarget` interface. It's not + * meant to be used directly. + * + * @mixin + */ +const EventTarget = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {(Function|Object)} handler The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(type, handler, options = {}) { + for (const listener of this.listeners(type)) { + if ( + !options[kForOnEventAttribute] && + listener[kListener] === handler && + !listener[kForOnEventAttribute] + ) { + return; + } + } + + let wrapper; + + if (type === 'message') { + wrapper = function onMessage(data, isBinary) { + const event = new MessageEvent('message', { + data: isBinary ? data : data.toString() + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'close') { + wrapper = function onClose(code, message) { + const event = new CloseEvent('close', { + code, + reason: message.toString(), + wasClean: this._closeFrameReceived && this._closeFrameSent + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'error') { + wrapper = function onError(error) { + const event = new ErrorEvent('error', { + error, + message: error.message + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'open') { + wrapper = function onOpen() { + const event = new Event('open'); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else { + return; + } + + wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute]; + wrapper[kListener] = handler; + + if (options.once) { + this.once(type, wrapper); + } else { + this.on(type, wrapper); + } + }, + + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {(Function|Object)} handler The listener to remove + * @public + */ + removeEventListener(type, handler) { + for (const listener of this.listeners(type)) { + if (listener[kListener] === handler && !listener[kForOnEventAttribute]) { + this.removeListener(type, listener); + break; + } + } + } +}; + +module.exports = { + CloseEvent, + ErrorEvent, + Event, + EventTarget, + MessageEvent +}; + +/** + * Call an event listener + * + * @param {(Function|Object)} listener The listener to call + * @param {*} thisArg The value to use as `this`` when calling the listener + * @param {Event} event The event to pass to the listener + * @private + */ +function callListener(listener, thisArg, event) { + if (typeof listener === 'object' && listener.handleEvent) { + listener.handleEvent.call(listener, event); + } else { + listener.call(thisArg, event); + } +} diff --git a/graphql-subscription-express/node_modules/ws/lib/extension.js b/graphql-subscription-express/node_modules/ws/lib/extension.js new file mode 100644 index 0000000..3d7895c --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/extension.js @@ -0,0 +1,203 @@ +'use strict'; + +const { tokenChars } = require('./validation'); + +/** + * Adds an offer to the map of extension offers or a parameter to the map of + * parameters. + * + * @param {Object} dest The map of extension offers or parameters + * @param {String} name The extension or parameter name + * @param {(Object|Boolean|String)} elem The extension parameters or the + * parameter value + * @private + */ +function push(dest, name, elem) { + if (dest[name] === undefined) dest[name] = [elem]; + else dest[name].push(elem); +} + +/** + * Parses the `Sec-WebSocket-Extensions` header into an object. + * + * @param {String} header The field value of the header + * @return {Object} The parsed object + * @public + */ +function parse(header) { + const offers = Object.create(null); + let params = Object.create(null); + let mustUnescape = false; + let isEscaping = false; + let inQuotes = false; + let extensionName; + let paramName; + let start = -1; + let code = -1; + let end = -1; + let i = 0; + + for (; i < header.length; i++) { + code = header.charCodeAt(i); + + if (extensionName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if ( + i !== 0 && + (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ + ) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + const name = header.slice(start, end); + if (code === 0x2c) { + push(offers, name, params); + params = Object.create(null); + } else { + extensionName = name; + } + + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x20 || code === 0x09) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + push(params, header.slice(start, end), true); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + start = end = -1; + } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + // + // The value of a quoted-string after unescaping must conform to the + // token ABNF, so only token characters are valid. + // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 + // + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x22 /* '"' */ && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 0x5c /* '\' */) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 0x20 || code === 0x09)) { + if (end === -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + let value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ''); + mustUnescape = false; + } + push(params, paramName, value); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + paramName = undefined; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + + if (start === -1 || inQuotes || code === 0x20 || code === 0x09) { + throw new SyntaxError('Unexpected end of input'); + } + + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === undefined) { + push(offers, token, params); + } else { + if (paramName === undefined) { + push(params, token, true); + } else if (mustUnescape) { + push(params, paramName, token.replace(/\\/g, '')); + } else { + push(params, paramName, token); + } + push(offers, extensionName, params); + } + + return offers; +} + +/** + * Builds the `Sec-WebSocket-Extensions` header field value. + * + * @param {Object} extensions The map of extensions and parameters to format + * @return {String} A string representing the given object + * @public + */ +function format(extensions) { + return Object.keys(extensions) + .map((extension) => { + let configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations + .map((params) => { + return [extension] + .concat( + Object.keys(params).map((k) => { + let values = params[k]; + if (!Array.isArray(values)) values = [values]; + return values + .map((v) => (v === true ? k : `${k}=${v}`)) + .join('; '); + }) + ) + .join('; '); + }) + .join(', '); + }) + .join(', '); +} + +module.exports = { format, parse }; diff --git a/graphql-subscription-express/node_modules/ws/lib/limiter.js b/graphql-subscription-express/node_modules/ws/lib/limiter.js new file mode 100644 index 0000000..3fd3578 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/limiter.js @@ -0,0 +1,55 @@ +'use strict'; + +const kDone = Symbol('kDone'); +const kRun = Symbol('kRun'); + +/** + * A very simple job queue with adjustable concurrency. Adapted from + * https://github.com/STRML/async-limiter + */ +class Limiter { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(concurrency) { + this[kDone] = () => { + this.pending--; + this[kRun](); + }; + this.concurrency = concurrency || Infinity; + this.jobs = []; + this.pending = 0; + } + + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(job) { + this.jobs.push(job); + this[kRun](); + } + + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [kRun]() { + if (this.pending === this.concurrency) return; + + if (this.jobs.length) { + const job = this.jobs.shift(); + + this.pending++; + job(this[kDone]); + } + } +} + +module.exports = Limiter; diff --git a/graphql-subscription-express/node_modules/ws/lib/permessage-deflate.js b/graphql-subscription-express/node_modules/ws/lib/permessage-deflate.js new file mode 100644 index 0000000..77d918b --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/permessage-deflate.js @@ -0,0 +1,514 @@ +'use strict'; + +const zlib = require('zlib'); + +const bufferUtil = require('./buffer-util'); +const Limiter = require('./limiter'); +const { kStatusCode } = require('./constants'); + +const FastBuffer = Buffer[Symbol.species]; +const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); +const kPerMessageDeflate = Symbol('permessage-deflate'); +const kTotalLength = Symbol('total-length'); +const kCallback = Symbol('callback'); +const kBuffers = Symbol('buffers'); +const kError = Symbol('error'); + +// +// We limit zlib concurrency, which prevents severe memory fragmentation +// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 +// and https://github.com/websockets/ws/issues/1202 +// +// Intentionally global; it's the global thread pool that's an issue. +// +let zlibLimiter; + +/** + * permessage-deflate implementation. + */ +class PerMessageDeflate { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed if context takeover is disabled + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = + this._options.threshold !== undefined ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + + this.params = null; + + if (!zlibLimiter) { + const concurrency = + this._options.concurrencyLimit !== undefined + ? this._options.concurrencyLimit + : 10; + zlibLimiter = new Limiter(concurrency); + } + } + + /** + * @type {String} + */ + static get extensionName() { + return 'permessage-deflate'; + } + + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params = {}; + + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + + return params; + } + + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + + this.params = this._isServer + ? this.acceptAsServer(configurations) + : this.acceptAsClient(configurations); + + return this.params; + } + + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + + if (this._deflate) { + const callback = this._deflate[kCallback]; + + this._deflate.close(); + this._deflate = null; + + if (callback) { + callback( + new Error( + 'The deflate stream was closed while data was being processed' + ) + ); + } + } + } + + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params) => { + if ( + (opts.serverNoContextTakeover === false && + params.server_no_context_takeover) || + (params.server_max_window_bits && + (opts.serverMaxWindowBits === false || + (typeof opts.serverMaxWindowBits === 'number' && + opts.serverMaxWindowBits > params.server_max_window_bits))) || + (typeof opts.clientMaxWindowBits === 'number' && + !params.client_max_window_bits) + ) { + return false; + } + + return true; + }); + + if (!accepted) { + throw new Error('None of the extension offers can be accepted'); + } + + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if ( + accepted.client_max_window_bits === true || + opts.clientMaxWindowBits === false + ) { + delete accepted.client_max_window_bits; + } + + return accepted; + } + + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params = response[0]; + + if ( + this._options.clientNoContextTakeover === false && + params.client_no_context_takeover + ) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + + if (!params.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === 'number') { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if ( + this._options.clientMaxWindowBits === false || + (typeof this._options.clientMaxWindowBits === 'number' && + params.client_max_window_bits > this._options.clientMaxWindowBits) + ) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + + return params; + } + + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params) => { + Object.keys(params).forEach((key) => { + let value = params[key]; + + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + + value = value[0]; + + if (key === 'client_max_window_bits') { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === 'server_max_window_bits') { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if ( + key === 'client_no_context_takeover' || + key === 'server_no_context_takeover' + ) { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + + params[key] = value; + }); + }); + + return configurations; + } + + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.add((done) => { + this._decompress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Compress data. Concurrency limited. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.add((done) => { + this._compress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._inflate = zlib.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits + }); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on('error', inflateOnError); + this._inflate.on('data', inflateOnData); + } + + this._inflate[kCallback] = callback; + + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + + this._inflate.flush(() => { + const err = this._inflate[kError]; + + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + + const data = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + + if (this._inflate._readableState.endEmitted) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.reset(); + } + } + + callback(null, data); + }); + } + + /** + * Compress data. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + const endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._deflate = zlib.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits + }); + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + this._deflate.on('data', deflateOnData); + } + + this._deflate[kCallback] = callback; + + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + // + // The deflate stream was closed while data was being processed. + // + return; + } + + let data = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + + if (fin) { + data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4); + } + + // + // Ensure that the callback will not be called again in + // `PerMessageDeflate#cleanup()`. + // + this._deflate[kCallback] = null; + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.reset(); + } + + callback(null, data); + }); + } +} + +module.exports = PerMessageDeflate; + +/** + * The listener of the `zlib.DeflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; +} + +/** + * The listener of the `zlib.InflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + + if ( + this[kPerMessageDeflate]._maxPayload < 1 || + this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload + ) { + this[kBuffers].push(chunk); + return; + } + + this[kError] = new RangeError('Max payload size exceeded'); + this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'; + this[kError][kStatusCode] = 1009; + this.removeListener('data', inflateOnData); + this.reset(); +} + +/** + * The listener of the `zlib.InflateRaw` stream `'error'` event. + * + * @param {Error} err The emitted error + * @private + */ +function inflateOnError(err) { + // + // There is no need to call `Zlib#close()` as the handle is automatically + // closed when an error is emitted. + // + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); +} diff --git a/graphql-subscription-express/node_modules/ws/lib/receiver.js b/graphql-subscription-express/node_modules/ws/lib/receiver.js new file mode 100644 index 0000000..70dfd99 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/receiver.js @@ -0,0 +1,704 @@ +'use strict'; + +const { Writable } = require('stream'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + kStatusCode, + kWebSocket +} = require('./constants'); +const { concat, toArrayBuffer, unmask } = require('./buffer-util'); +const { isValidStatusCode, isValidUTF8 } = require('./validation'); + +const FastBuffer = Buffer[Symbol.species]; + +const GET_INFO = 0; +const GET_PAYLOAD_LENGTH_16 = 1; +const GET_PAYLOAD_LENGTH_64 = 2; +const GET_MASK = 3; +const GET_DATA = 4; +const INFLATING = 5; +const DEFER_EVENT = 6; + +/** + * HyBi Receiver implementation. + * + * @extends Writable + */ +class Receiver extends Writable { + /** + * Creates a Receiver instance. + * + * @param {Object} [options] Options object + * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {String} [options.binaryType=nodebuffer] The type for binary data + * @param {Object} [options.extensions] An object containing the negotiated + * extensions + * @param {Boolean} [options.isServer=false] Specifies whether to operate in + * client or server mode + * @param {Number} [options.maxPayload=0] The maximum allowed message length + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + */ + constructor(options = {}) { + super(); + + this._allowSynchronousEvents = + options.allowSynchronousEvents !== undefined + ? options.allowSynchronousEvents + : true; + this._binaryType = options.binaryType || BINARY_TYPES[0]; + this._extensions = options.extensions || {}; + this._isServer = !!options.isServer; + this._maxPayload = options.maxPayload | 0; + this._skipUTF8Validation = !!options.skipUTF8Validation; + this[kWebSocket] = undefined; + + this._bufferedBytes = 0; + this._buffers = []; + + this._compressed = false; + this._payloadLength = 0; + this._mask = undefined; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + + this._errored = false; + this._loop = false; + this._state = GET_INFO; + } + + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(chunk, encoding, cb) { + if (this._opcode === 0x08 && this._state == GET_INFO) return cb(); + + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + + if (n === this._buffers[0].length) return this._buffers.shift(); + + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = new FastBuffer( + buf.buffer, + buf.byteOffset + n, + buf.length - n + ); + + return new FastBuffer(buf.buffer, buf.byteOffset, n); + } + + const dst = Buffer.allocUnsafe(n); + + do { + const buf = this._buffers[0]; + const offset = dst.length - n; + + if (n >= buf.length) { + dst.set(this._buffers.shift(), offset); + } else { + dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); + this._buffers[0] = new FastBuffer( + buf.buffer, + buf.byteOffset + n, + buf.length - n + ); + } + + n -= buf.length; + } while (n > 0); + + return dst; + } + + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + this._loop = true; + + do { + switch (this._state) { + case GET_INFO: + this.getInfo(cb); + break; + case GET_PAYLOAD_LENGTH_16: + this.getPayloadLength16(cb); + break; + case GET_PAYLOAD_LENGTH_64: + this.getPayloadLength64(cb); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + this.getData(cb); + break; + case INFLATING: + case DEFER_EVENT: + this._loop = false; + return; + } + } while (this._loop); + + if (!this._errored) cb(); + } + + /** + * Reads the first two bytes of a frame. + * + * @param {Function} cb Callback + * @private + */ + getInfo(cb) { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + const buf = this.consume(2); + + if ((buf[0] & 0x30) !== 0x00) { + const error = this.createError( + RangeError, + 'RSV2 and RSV3 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_2_3' + ); + + cb(error); + return; + } + + const compressed = (buf[0] & 0x40) === 0x40; + + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + this._fin = (buf[0] & 0x80) === 0x80; + this._opcode = buf[0] & 0x0f; + this._payloadLength = buf[1] & 0x7f; + + if (this._opcode === 0x00) { + if (compressed) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + if (!this._fragmented) { + const error = this.createError( + RangeError, + 'invalid opcode 0', + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + this._opcode = this._fragmented; + } else if (this._opcode === 0x01 || this._opcode === 0x02) { + if (this._fragmented) { + const error = this.createError( + RangeError, + `invalid opcode ${this._opcode}`, + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + this._compressed = compressed; + } else if (this._opcode > 0x07 && this._opcode < 0x0b) { + if (!this._fin) { + const error = this.createError( + RangeError, + 'FIN must be set', + true, + 1002, + 'WS_ERR_EXPECTED_FIN' + ); + + cb(error); + return; + } + + if (compressed) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + if ( + this._payloadLength > 0x7d || + (this._opcode === 0x08 && this._payloadLength === 1) + ) { + const error = this.createError( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002, + 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH' + ); + + cb(error); + return; + } + } else { + const error = this.createError( + RangeError, + `invalid opcode ${this._opcode}`, + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 0x80) === 0x80; + + if (this._isServer) { + if (!this._masked) { + const error = this.createError( + RangeError, + 'MASK must be set', + true, + 1002, + 'WS_ERR_EXPECTED_MASK' + ); + + cb(error); + return; + } + } else if (this._masked) { + const error = this.createError( + RangeError, + 'MASK must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_MASK' + ); + + cb(error); + return; + } + + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else this.haveLength(cb); + } + + /** + * Gets extended payload length (7+16). + * + * @param {Function} cb Callback + * @private + */ + getPayloadLength16(cb) { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + this._payloadLength = this.consume(2).readUInt16BE(0); + this.haveLength(cb); + } + + /** + * Gets extended payload length (7+64). + * + * @param {Function} cb Callback + * @private + */ + getPayloadLength64(cb) { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + + // + // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned + // if payload length is greater than this number. + // + if (num > Math.pow(2, 53 - 32) - 1) { + const error = this.createError( + RangeError, + 'Unsupported WebSocket frame: payload length > 2^53 - 1', + false, + 1009, + 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH' + ); + + cb(error); + return; + } + + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + this.haveLength(cb); + } + + /** + * Payload length has been read. + * + * @param {Function} cb Callback + * @private + */ + haveLength(cb) { + if (this._payloadLength && this._opcode < 0x08) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + const error = this.createError( + RangeError, + 'Max payload size exceeded', + false, + 1009, + 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' + ); + + cb(error); + return; + } + } + + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + + this._mask = this.consume(4); + this._state = GET_DATA; + } + + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @private + */ + getData(cb) { + let data = EMPTY_BUFFER; + + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + + data = this.consume(this._payloadLength); + + if ( + this._masked && + (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0 + ) { + unmask(data, this._mask); + } + } + + if (this._opcode > 0x07) { + this.controlMessage(data, cb); + return; + } + + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + + if (data.length) { + // + // This message is not compressed so its length is the sum of the payload + // length of all fragments. + // + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + + this.dataMessage(cb); + } + + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + const error = this.createError( + RangeError, + 'Max payload size exceeded', + false, + 1009, + 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' + ); + + cb(error); + return; + } + + this._fragments.push(buf); + } + + this.dataMessage(cb); + if (this._state === GET_INFO) this.startLoop(cb); + }); + } + + /** + * Handles a data message. + * + * @param {Function} cb Callback + * @private + */ + dataMessage(cb) { + if (!this._fin) { + this._state = GET_INFO; + return; + } + + const messageLength = this._messageLength; + const fragments = this._fragments; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + + if (this._opcode === 2) { + let data; + + if (this._binaryType === 'nodebuffer') { + data = concat(fragments, messageLength); + } else if (this._binaryType === 'arraybuffer') { + data = toArrayBuffer(concat(fragments, messageLength)); + } else { + data = fragments; + } + + if (this._allowSynchronousEvents) { + this.emit('message', data, true); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + setImmediate(() => { + this.emit('message', data, true); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } else { + const buf = concat(fragments, messageLength); + + if (!this._skipUTF8Validation && !isValidUTF8(buf)) { + const error = this.createError( + Error, + 'invalid UTF-8 sequence', + true, + 1007, + 'WS_ERR_INVALID_UTF8' + ); + + cb(error); + return; + } + + if (this._state === INFLATING || this._allowSynchronousEvents) { + this.emit('message', buf, false); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + setImmediate(() => { + this.emit('message', buf, false); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } + } + + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data, cb) { + if (this._opcode === 0x08) { + if (data.length === 0) { + this._loop = false; + this.emit('conclude', 1005, EMPTY_BUFFER); + this.end(); + } else { + const code = data.readUInt16BE(0); + + if (!isValidStatusCode(code)) { + const error = this.createError( + RangeError, + `invalid status code ${code}`, + true, + 1002, + 'WS_ERR_INVALID_CLOSE_CODE' + ); + + cb(error); + return; + } + + const buf = new FastBuffer( + data.buffer, + data.byteOffset + 2, + data.length - 2 + ); + + if (!this._skipUTF8Validation && !isValidUTF8(buf)) { + const error = this.createError( + Error, + 'invalid UTF-8 sequence', + true, + 1007, + 'WS_ERR_INVALID_UTF8' + ); + + cb(error); + return; + } + + this._loop = false; + this.emit('conclude', code, buf); + this.end(); + } + + this._state = GET_INFO; + return; + } + + if (this._allowSynchronousEvents) { + this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + setImmediate(() => { + this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } + + /** + * Builds an error object. + * + * @param {function(new:Error|RangeError)} ErrorCtor The error constructor + * @param {String} message The error message + * @param {Boolean} prefix Specifies whether or not to add a default prefix to + * `message` + * @param {Number} statusCode The status code + * @param {String} errorCode The exposed error code + * @return {(Error|RangeError)} The error + * @private + */ + createError(ErrorCtor, message, prefix, statusCode, errorCode) { + this._loop = false; + this._errored = true; + + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + + Error.captureStackTrace(err, this.createError); + err.code = errorCode; + err[kStatusCode] = statusCode; + return err; + } +} + +module.exports = Receiver; diff --git a/graphql-subscription-express/node_modules/ws/lib/sender.js b/graphql-subscription-express/node_modules/ws/lib/sender.js new file mode 100644 index 0000000..1ed04b0 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/sender.js @@ -0,0 +1,477 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */ + +'use strict'; + +const { Duplex } = require('stream'); +const { randomFillSync } = require('crypto'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { EMPTY_BUFFER } = require('./constants'); +const { isValidStatusCode } = require('./validation'); +const { mask: applyMask, toBuffer } = require('./buffer-util'); + +const kByteLength = Symbol('kByteLength'); +const maskBuffer = Buffer.alloc(4); + +/** + * HyBi Sender implementation. + */ +class Sender { + /** + * Creates a Sender instance. + * + * @param {Duplex} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Function} [generateMask] The function used to generate the masking + * key + */ + constructor(socket, extensions, generateMask) { + this._extensions = extensions || {}; + + if (generateMask) { + this._generateMask = generateMask; + this._maskBuffer = Buffer.alloc(4); + } + + this._socket = socket; + + this._firstFragment = true; + this._compress = false; + + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {(Buffer|String)} data The data to frame + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {(Buffer|String)[]} The framed data + * @public + */ + static frame(data, options) { + let mask; + let merge = false; + let offset = 2; + let skipMasking = false; + + if (options.mask) { + mask = options.maskBuffer || maskBuffer; + + if (options.generateMask) { + options.generateMask(mask); + } else { + randomFillSync(mask, 0, 4); + } + + skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0; + offset = 6; + } + + let dataLength; + + if (typeof data === 'string') { + if ( + (!options.mask || skipMasking) && + options[kByteLength] !== undefined + ) { + dataLength = options[kByteLength]; + } else { + data = Buffer.from(data); + dataLength = data.length; + } + } else { + dataLength = data.length; + merge = options.mask && options.readOnly && !skipMasking; + } + + let payloadLength = dataLength; + + if (dataLength >= 65536) { + offset += 8; + payloadLength = 127; + } else if (dataLength > 125) { + offset += 2; + payloadLength = 126; + } + + const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset); + + target[0] = options.fin ? options.opcode | 0x80 : options.opcode; + if (options.rsv1) target[0] |= 0x40; + + target[1] = payloadLength; + + if (payloadLength === 126) { + target.writeUInt16BE(dataLength, 2); + } else if (payloadLength === 127) { + target[2] = target[3] = 0; + target.writeUIntBE(dataLength, 4, 6); + } + + if (!options.mask) return [target, data]; + + target[1] |= 0x80; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + + if (skipMasking) return [target, data]; + + if (merge) { + applyMask(data, mask, target, offset, dataLength); + return [target]; + } + + applyMask(data, mask, data, 0, dataLength); + return [target, data]; + } + + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {(String|Buffer)} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(code, data, mask, cb) { + let buf; + + if (code === undefined) { + buf = EMPTY_BUFFER; + } else if (typeof code !== 'number' || !isValidStatusCode(code)) { + throw new TypeError('First argument must be a valid error code number'); + } else if (data === undefined || !data.length) { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + const length = Buffer.byteLength(data); + + if (length > 123) { + throw new RangeError('The message must not be greater than 123 bytes'); + } + + buf = Buffer.allocUnsafe(2 + length); + buf.writeUInt16BE(code, 0); + + if (typeof data === 'string') { + buf.write(data, 2); + } else { + buf.set(data, 2); + } + } + + const options = { + [kByteLength]: buf.length, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x08, + readOnly: false, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, buf, false, options, cb]); + } else { + this.sendFrame(Sender.frame(buf, options), cb); + } + } + + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(data, mask, cb) { + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (byteLength > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + const options = { + [kByteLength]: byteLength, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x09, + readOnly, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, false, options, cb]); + } else { + this.sendFrame(Sender.frame(data, options), cb); + } + } + + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(data, mask, cb) { + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (byteLength > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + const options = { + [kByteLength]: byteLength, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x0a, + readOnly, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, false, options, cb]); + } else { + this.sendFrame(Sender.frame(data, options), cb); + } + } + + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(data, options, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + let opcode = options.binary ? 2 : 1; + let rsv1 = options.compress; + + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (this._firstFragment) { + this._firstFragment = false; + if ( + rsv1 && + perMessageDeflate && + perMessageDeflate.params[ + perMessageDeflate._isServer + ? 'server_no_context_takeover' + : 'client_no_context_takeover' + ] + ) { + rsv1 = byteLength >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + + if (options.fin) this._firstFragment = true; + + if (perMessageDeflate) { + const opts = { + [kByteLength]: byteLength, + fin: options.fin, + generateMask: this._generateMask, + mask: options.mask, + maskBuffer: this._maskBuffer, + opcode, + readOnly, + rsv1 + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, this._compress, opts, cb]); + } else { + this.dispatch(data, this._compress, opts, cb); + } + } else { + this.sendFrame( + Sender.frame(data, { + [kByteLength]: byteLength, + fin: options.fin, + generateMask: this._generateMask, + mask: options.mask, + maskBuffer: this._maskBuffer, + opcode, + readOnly, + rsv1: false + }), + cb + ); + } + } + + /** + * Dispatches a message. + * + * @param {(Buffer|String)} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(Sender.frame(data, options), cb); + return; + } + + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + this._bufferedBytes += options[kByteLength]; + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + if (this._socket.destroyed) { + const err = new Error( + 'The socket was closed while data was being compressed' + ); + + if (typeof cb === 'function') cb(err); + + for (let i = 0; i < this._queue.length; i++) { + const params = this._queue[i]; + const callback = params[params.length - 1]; + + if (typeof callback === 'function') callback(err); + } + + return; + } + + this._bufferedBytes -= options[kByteLength]; + this._deflating = false; + options.readOnly = false; + this.sendFrame(Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params = this._queue.shift(); + + this._bufferedBytes -= params[3][kByteLength]; + Reflect.apply(params[0], this, params.slice(1)); + } + } + + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params) { + this._bufferedBytes += params[3][kByteLength]; + this._queue.push(params); + } + + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.cork(); + this._socket.write(list[0]); + this._socket.write(list[1], cb); + this._socket.uncork(); + } else { + this._socket.write(list[0], cb); + } + } +} + +module.exports = Sender; diff --git a/graphql-subscription-express/node_modules/ws/lib/stream.js b/graphql-subscription-express/node_modules/ws/lib/stream.js new file mode 100644 index 0000000..230734b --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/stream.js @@ -0,0 +1,159 @@ +'use strict'; + +const { Duplex } = require('stream'); + +/** + * Emits the `'close'` event on a stream. + * + * @param {Duplex} stream The stream. + * @private + */ +function emitClose(stream) { + stream.emit('close'); +} + +/** + * The listener of the `'end'` event. + * + * @private + */ +function duplexOnEnd() { + if (!this.destroyed && this._writableState.finished) { + this.destroy(); + } +} + +/** + * The listener of the `'error'` event. + * + * @param {Error} err The error + * @private + */ +function duplexOnError(err) { + this.removeListener('error', duplexOnError); + this.destroy(); + if (this.listenerCount('error') === 0) { + // Do not suppress the throwing behavior. + this.emit('error', err); + } +} + +/** + * Wraps a `WebSocket` in a duplex stream. + * + * @param {WebSocket} ws The `WebSocket` to wrap + * @param {Object} [options] The options for the `Duplex` constructor + * @return {Duplex} The duplex stream + * @public + */ +function createWebSocketStream(ws, options) { + let terminateOnDestroy = true; + + const duplex = new Duplex({ + ...options, + autoDestroy: false, + emitClose: false, + objectMode: false, + writableObjectMode: false + }); + + ws.on('message', function message(msg, isBinary) { + const data = + !isBinary && duplex._readableState.objectMode ? msg.toString() : msg; + + if (!duplex.push(data)) ws.pause(); + }); + + ws.once('error', function error(err) { + if (duplex.destroyed) return; + + // Prevent `ws.terminate()` from being called by `duplex._destroy()`. + // + // - If the `'error'` event is emitted before the `'open'` event, then + // `ws.terminate()` is a noop as no socket is assigned. + // - Otherwise, the error is re-emitted by the listener of the `'error'` + // event of the `Receiver` object. The listener already closes the + // connection by calling `ws.close()`. This allows a close frame to be + // sent to the other peer. If `ws.terminate()` is called right after this, + // then the close frame might not be sent. + terminateOnDestroy = false; + duplex.destroy(err); + }); + + ws.once('close', function close() { + if (duplex.destroyed) return; + + duplex.push(null); + }); + + duplex._destroy = function (err, callback) { + if (ws.readyState === ws.CLOSED) { + callback(err); + process.nextTick(emitClose, duplex); + return; + } + + let called = false; + + ws.once('error', function error(err) { + called = true; + callback(err); + }); + + ws.once('close', function close() { + if (!called) callback(err); + process.nextTick(emitClose, duplex); + }); + + if (terminateOnDestroy) ws.terminate(); + }; + + duplex._final = function (callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._final(callback); + }); + return; + } + + // If the value of the `_socket` property is `null` it means that `ws` is a + // client websocket and the handshake failed. In fact, when this happens, a + // socket is never assigned to the websocket. Wait for the `'error'` event + // that will be emitted by the websocket. + if (ws._socket === null) return; + + if (ws._socket._writableState.finished) { + callback(); + if (duplex._readableState.endEmitted) duplex.destroy(); + } else { + ws._socket.once('finish', function finish() { + // `duplex` is not destroyed here because the `'end'` event will be + // emitted on `duplex` after this `'finish'` event. The EOF signaling + // `null` chunk is, in fact, pushed when the websocket emits `'close'`. + callback(); + }); + ws.close(); + } + }; + + duplex._read = function () { + if (ws.isPaused) ws.resume(); + }; + + duplex._write = function (chunk, encoding, callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._write(chunk, encoding, callback); + }); + return; + } + + ws.send(chunk, callback); + }; + + duplex.on('end', duplexOnEnd); + duplex.on('error', duplexOnError); + return duplex; +} + +module.exports = createWebSocketStream; diff --git a/graphql-subscription-express/node_modules/ws/lib/subprotocol.js b/graphql-subscription-express/node_modules/ws/lib/subprotocol.js new file mode 100644 index 0000000..d4381e8 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/subprotocol.js @@ -0,0 +1,62 @@ +'use strict'; + +const { tokenChars } = require('./validation'); + +/** + * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names. + * + * @param {String} header The field value of the header + * @return {Set} The subprotocol names + * @public + */ +function parse(header) { + const protocols = new Set(); + let start = -1; + let end = -1; + let i = 0; + + for (i; i < header.length; i++) { + const code = header.charCodeAt(i); + + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if ( + i !== 0 && + (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ + ) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + + const protocol = header.slice(start, end); + + if (protocols.has(protocol)) { + throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); + } + + protocols.add(protocol); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + + if (start === -1 || end !== -1) { + throw new SyntaxError('Unexpected end of input'); + } + + const protocol = header.slice(start, i); + + if (protocols.has(protocol)) { + throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); + } + + protocols.add(protocol); + return protocols; +} + +module.exports = { parse }; diff --git a/graphql-subscription-express/node_modules/ws/lib/validation.js b/graphql-subscription-express/node_modules/ws/lib/validation.js new file mode 100644 index 0000000..c352e6e --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/validation.js @@ -0,0 +1,130 @@ +'use strict'; + +const { isUtf8 } = require('buffer'); + +// +// Allowed token characters: +// +// '!', '#', '$', '%', '&', ''', '*', '+', '-', +// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' +// +// tokenChars[32] === 0 // ' ' +// tokenChars[33] === 1 // '!' +// tokenChars[34] === 0 // '"' +// ... +// +// prettier-ignore +const tokenChars = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 + 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 +]; + +/** + * Checks if a status code is allowed in a close frame. + * + * @param {Number} code The status code + * @return {Boolean} `true` if the status code is valid, else `false` + * @public + */ +function isValidStatusCode(code) { + return ( + (code >= 1000 && + code <= 1014 && + code !== 1004 && + code !== 1005 && + code !== 1006) || + (code >= 3000 && code <= 4999) + ); +} + +/** + * Checks if a given buffer contains only correct UTF-8. + * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by + * Markus Kuhn. + * + * @param {Buffer} buf The buffer to check + * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false` + * @public + */ +function _isValidUTF8(buf) { + const len = buf.length; + let i = 0; + + while (i < len) { + if ((buf[i] & 0x80) === 0) { + // 0xxxxxxx + i++; + } else if ((buf[i] & 0xe0) === 0xc0) { + // 110xxxxx 10xxxxxx + if ( + i + 1 === len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i] & 0xfe) === 0xc0 // Overlong + ) { + return false; + } + + i += 2; + } else if ((buf[i] & 0xf0) === 0xe0) { + // 1110xxxx 10xxxxxx 10xxxxxx + if ( + i + 2 >= len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i + 2] & 0xc0) !== 0x80 || + (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong + (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF) + ) { + return false; + } + + i += 3; + } else if ((buf[i] & 0xf8) === 0xf0) { + // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + if ( + i + 3 >= len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i + 2] & 0xc0) !== 0x80 || + (buf[i + 3] & 0xc0) !== 0x80 || + (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong + (buf[i] === 0xf4 && buf[i + 1] > 0x8f) || + buf[i] > 0xf4 // > U+10FFFF + ) { + return false; + } + + i += 4; + } else { + return false; + } + } + + return true; +} + +module.exports = { + isValidStatusCode, + isValidUTF8: _isValidUTF8, + tokenChars +}; + +if (isUtf8) { + module.exports.isValidUTF8 = function (buf) { + return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf); + }; +} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) { + try { + const isValidUTF8 = require('utf-8-validate'); + + module.exports.isValidUTF8 = function (buf) { + return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf); + }; + } catch (e) { + // Continue regardless of the error. + } +} diff --git a/graphql-subscription-express/node_modules/ws/lib/websocket-server.js b/graphql-subscription-express/node_modules/ws/lib/websocket-server.js new file mode 100644 index 0000000..40980f6 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/websocket-server.js @@ -0,0 +1,539 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */ + +'use strict'; + +const EventEmitter = require('events'); +const http = require('http'); +const { Duplex } = require('stream'); +const { createHash } = require('crypto'); + +const extension = require('./extension'); +const PerMessageDeflate = require('./permessage-deflate'); +const subprotocol = require('./subprotocol'); +const WebSocket = require('./websocket'); +const { GUID, kWebSocket } = require('./constants'); + +const keyRegex = /^[+/0-9A-Za-z]{22}==$/; + +const RUNNING = 0; +const CLOSING = 1; +const CLOSED = 2; + +/** + * Class representing a WebSocket server. + * + * @extends EventEmitter + */ +class WebSocketServer extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {Boolean} [options.autoPong=true] Specifies whether or not to + * automatically send a pong in response to a ping + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S + * server to use + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket` + * class to use. It must be the `WebSocket` class or class that extends it + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(options, callback) { + super(); + + options = { + allowSynchronousEvents: true, + autoPong: true, + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: false, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + WebSocket, + ...options + }; + + if ( + (options.port == null && !options.server && !options.noServer) || + (options.port != null && (options.server || options.noServer)) || + (options.server && options.noServer) + ) { + throw new TypeError( + 'One and only one of the "port", "server", or "noServer" options ' + + 'must be specified' + ); + } + + if (options.port != null) { + this._server = http.createServer((req, res) => { + const body = http.STATUS_CODES[426]; + + res.writeHead(426, { + 'Content-Length': body.length, + 'Content-Type': 'text/plain' + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + this._server = options.server; + } + + if (this._server) { + const emitConnection = this.emit.bind(this, 'connection'); + + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, 'listening'), + error: this.emit.bind(this, 'error'), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, emitConnection); + } + }); + } + + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) { + this.clients = new Set(); + this._shouldEmitClose = false; + } + + this.options = options; + this._state = RUNNING; + } + + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + + if (!this._server) return null; + return this._server.address(); + } + + /** + * Stop the server from accepting new connections and emit the `'close'` event + * when all existing connections are closed. + * + * @param {Function} [cb] A one-time listener for the `'close'` event + * @public + */ + close(cb) { + if (this._state === CLOSED) { + if (cb) { + this.once('close', () => { + cb(new Error('The server is not running')); + }); + } + + process.nextTick(emitClose, this); + return; + } + + if (cb) this.once('close', cb); + + if (this._state === CLOSING) return; + this._state = CLOSING; + + if (this.options.noServer || this.options.server) { + if (this._server) { + this._removeListeners(); + this._removeListeners = this._server = null; + } + + if (this.clients) { + if (!this.clients.size) { + process.nextTick(emitClose, this); + } else { + this._shouldEmitClose = true; + } + } else { + process.nextTick(emitClose, this); + } + } else { + const server = this._server; + + this._removeListeners(); + this._removeListeners = this._server = null; + + // + // The HTTP/S server was created internally. Close it, and rely on its + // `'close'` event. + // + server.close(() => { + emitClose(this); + }); + } + } + + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf('?'); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + + if (pathname !== this.options.path) return false; + } + + return true; + } + + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on('error', socketOnError); + + const key = req.headers['sec-websocket-key']; + const version = +req.headers['sec-websocket-version']; + + if (req.method !== 'GET') { + const message = 'Invalid HTTP method'; + abortHandshakeOrEmitwsClientError(this, req, socket, 405, message); + return; + } + + if (req.headers.upgrade.toLowerCase() !== 'websocket') { + const message = 'Invalid Upgrade header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (!key || !keyRegex.test(key)) { + const message = 'Missing or invalid Sec-WebSocket-Key header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (version !== 8 && version !== 13) { + const message = 'Missing or invalid Sec-WebSocket-Version header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (!this.shouldHandle(req)) { + abortHandshake(socket, 400); + return; + } + + const secWebSocketProtocol = req.headers['sec-websocket-protocol']; + let protocols = new Set(); + + if (secWebSocketProtocol !== undefined) { + try { + protocols = subprotocol.parse(secWebSocketProtocol); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Protocol header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + } + + const secWebSocketExtensions = req.headers['sec-websocket-extensions']; + const extensions = {}; + + if ( + this.options.perMessageDeflate && + secWebSocketExtensions !== undefined + ) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + + try { + const offers = extension.parse(secWebSocketExtensions); + + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + const message = + 'Invalid or unacceptable Sec-WebSocket-Extensions header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + } + + // + // Optionally call external client verification handler. + // + if (this.options.verifyClient) { + const info = { + origin: + req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], + secure: !!(req.socket.authorized || req.socket.encrypted), + req + }; + + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + + this.completeUpgrade( + extensions, + key, + protocols, + req, + socket, + head, + cb + ); + }); + return; + } + + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + + this.completeUpgrade(extensions, key, protocols, req, socket, head, cb); + } + + /** + * Upgrade the connection to WebSocket. + * + * @param {Object} extensions The accepted extensions + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Set} protocols The subprotocols + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(extensions, key, protocols, req, socket, head, cb) { + // + // Destroy the socket if the client has already sent a FIN packet. + // + if (!socket.readable || !socket.writable) return socket.destroy(); + + if (socket[kWebSocket]) { + throw new Error( + 'server.handleUpgrade() was called more than once with the same ' + + 'socket, possibly due to a misconfiguration' + ); + } + + if (this._state > RUNNING) return abortHandshake(socket, 503); + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + const headers = [ + 'HTTP/1.1 101 Switching Protocols', + 'Upgrade: websocket', + 'Connection: Upgrade', + `Sec-WebSocket-Accept: ${digest}` + ]; + + const ws = new this.options.WebSocket(null, undefined, this.options); + + if (protocols.size) { + // + // Optionally call external protocol selection handler. + // + const protocol = this.options.handleProtocols + ? this.options.handleProtocols(protocols, req) + : protocols.values().next().value; + + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws._protocol = protocol; + } + } + + if (extensions[PerMessageDeflate.extensionName]) { + const params = extensions[PerMessageDeflate.extensionName].params; + const value = extension.format({ + [PerMessageDeflate.extensionName]: [params] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + + // + // Allow external modification/inspection of handshake headers. + // + this.emit('headers', headers, req); + + socket.write(headers.concat('\r\n').join('\r\n')); + socket.removeListener('error', socketOnError); + + ws.setSocket(socket, head, { + allowSynchronousEvents: this.options.allowSynchronousEvents, + maxPayload: this.options.maxPayload, + skipUTF8Validation: this.options.skipUTF8Validation + }); + + if (this.clients) { + this.clients.add(ws); + ws.on('close', () => { + this.clients.delete(ws); + + if (this._shouldEmitClose && !this.clients.size) { + process.nextTick(emitClose, this); + } + }); + } + + cb(ws, req); + } +} + +module.exports = WebSocketServer; + +/** + * Add event listeners on an `EventEmitter` using a map of + * pairs. + * + * @param {EventEmitter} server The event emitter + * @param {Object.} map The listeners to add + * @return {Function} A function that will remove the added listeners when + * called + * @private + */ +function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; +} + +/** + * Emit a `'close'` event on an `EventEmitter`. + * + * @param {EventEmitter} server The event emitter + * @private + */ +function emitClose(server) { + server._state = CLOSED; + server.emit('close'); +} + +/** + * Handle socket errors. + * + * @private + */ +function socketOnError() { + this.destroy(); +} + +/** + * Close the connection when preconditions are not fulfilled. + * + * @param {Duplex} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} [message] The HTTP response body + * @param {Object} [headers] Additional HTTP response headers + * @private + */ +function abortHandshake(socket, code, message, headers) { + // + // The socket is writable unless the user destroyed or ended it before calling + // `server.handleUpgrade()` or in the `verifyClient` function, which is a user + // error. Handling this does not make much sense as the worst that can happen + // is that some of the data written by the user might be discarded due to the + // call to `socket.end()` below, which triggers an `'error'` event that in + // turn causes the socket to be destroyed. + // + message = message || http.STATUS_CODES[code]; + headers = { + Connection: 'close', + 'Content-Type': 'text/html', + 'Content-Length': Buffer.byteLength(message), + ...headers + }; + + socket.once('finish', socket.destroy); + + socket.end( + `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + + Object.keys(headers) + .map((h) => `${h}: ${headers[h]}`) + .join('\r\n') + + '\r\n\r\n' + + message + ); +} + +/** + * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least + * one listener for it, otherwise call `abortHandshake()`. + * + * @param {WebSocketServer} server The WebSocket server + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} message The HTTP response body + * @private + */ +function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) { + if (server.listenerCount('wsClientError')) { + const err = new Error(message); + Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError); + + server.emit('wsClientError', err, socket, req); + } else { + abortHandshake(socket, code, message); + } +} diff --git a/graphql-subscription-express/node_modules/ws/lib/websocket.js b/graphql-subscription-express/node_modules/ws/lib/websocket.js new file mode 100644 index 0000000..709ad82 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/lib/websocket.js @@ -0,0 +1,1336 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */ + +'use strict'; + +const EventEmitter = require('events'); +const https = require('https'); +const http = require('http'); +const net = require('net'); +const tls = require('tls'); +const { randomBytes, createHash } = require('crypto'); +const { Duplex, Readable } = require('stream'); +const { URL } = require('url'); + +const PerMessageDeflate = require('./permessage-deflate'); +const Receiver = require('./receiver'); +const Sender = require('./sender'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + GUID, + kForOnEventAttribute, + kListener, + kStatusCode, + kWebSocket, + NOOP +} = require('./constants'); +const { + EventTarget: { addEventListener, removeEventListener } +} = require('./event-target'); +const { format, parse } = require('./extension'); +const { toBuffer } = require('./buffer-util'); + +const closeTimeout = 30 * 1000; +const kAborted = Symbol('kAborted'); +const protocolVersions = [8, 13]; +const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; +const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/; + +/** + * Class representing a WebSocket. + * + * @extends EventEmitter + */ +class WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(address, protocols, options) { + super(); + + this._binaryType = BINARY_TYPES[0]; + this._closeCode = 1006; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = EMPTY_BUFFER; + this._closeTimer = null; + this._extensions = {}; + this._paused = false; + this._protocol = ''; + this._readyState = WebSocket.CONNECTING; + this._receiver = null; + this._sender = null; + this._socket = null; + + if (address !== null) { + this._bufferedAmount = 0; + this._isServer = false; + this._redirects = 0; + + if (protocols === undefined) { + protocols = []; + } else if (!Array.isArray(protocols)) { + if (typeof protocols === 'object' && protocols !== null) { + options = protocols; + protocols = []; + } else { + protocols = [protocols]; + } + } + + initAsClient(this, address, protocols, options); + } else { + this._autoPong = options.autoPong; + this._isServer = true; + } + } + + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + + set binaryType(type) { + if (!BINARY_TYPES.includes(type)) return; + + this._binaryType = type; + + // + // Allow to change `binaryType` on the fly. + // + if (this._receiver) this._receiver._binaryType = type; + } + + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return this._bufferedAmount; + + return this._socket._writableState.length + this._sender._bufferedBytes; + } + + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + + /** + * @type {Boolean} + */ + get isPaused() { + return this._paused; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onclose() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onerror() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onopen() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onmessage() { + return null; + } + + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + + /** + * @type {String} + */ + get url() { + return this._url; + } + + /** + * Set up the socket and the internal resources. + * + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Object} options Options object + * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.maxPayload=0] The maximum allowed message size + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ + setSocket(socket, head, options) { + const receiver = new Receiver({ + allowSynchronousEvents: options.allowSynchronousEvents, + binaryType: this.binaryType, + extensions: this._extensions, + isServer: this._isServer, + maxPayload: options.maxPayload, + skipUTF8Validation: options.skipUTF8Validation + }); + + this._sender = new Sender(socket, this._extensions, options.generateMask); + this._receiver = receiver; + this._socket = socket; + + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + + receiver.on('conclude', receiverOnConclude); + receiver.on('drain', receiverOnDrain); + receiver.on('error', receiverOnError); + receiver.on('message', receiverOnMessage); + receiver.on('ping', receiverOnPing); + receiver.on('pong', receiverOnPong); + + // + // These methods may not be available if `socket` is just a `Duplex`. + // + if (socket.setTimeout) socket.setTimeout(0); + if (socket.setNoDelay) socket.setNoDelay(); + + if (head.length > 0) socket.unshift(head); + + socket.on('close', socketOnClose); + socket.on('data', socketOnData); + socket.on('end', socketOnEnd); + socket.on('error', socketOnError); + + this._readyState = WebSocket.OPEN; + this.emit('open'); + } + + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + return; + } + + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + + this._receiver.removeAllListeners(); + this._readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + } + + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {(String|Buffer)} [data] The reason why the connection is + * closing + * @public + */ + close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + abortHandshake(this, this._req, msg); + return; + } + + if (this.readyState === WebSocket.CLOSING) { + if ( + this._closeFrameSent && + (this._closeFrameReceived || this._receiver._writableState.errorEmitted) + ) { + this._socket.end(); + } + + return; + } + + this._readyState = WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + // + // This error is handled by the `'error'` listener on the socket. We only + // want to know if the close frame has been sent here. + // + if (err) return; + + this._closeFrameSent = true; + + if ( + this._closeFrameReceived || + this._receiver._writableState.errorEmitted + ) { + this._socket.end(); + } + }); + + // + // Specify a timeout for the closing handshake to complete. + // + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + + /** + * Pause the socket. + * + * @public + */ + pause() { + if ( + this.readyState === WebSocket.CONNECTING || + this.readyState === WebSocket.CLOSED + ) { + return; + } + + this._paused = true; + this._socket.pause(); + } + + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.ping(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.pong(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Resume the socket. + * + * @public + */ + resume() { + if ( + this.readyState === WebSocket.CONNECTING || + this.readyState === WebSocket.CLOSED + ) { + return; + } + + this._paused = false; + if (!this._receiver._writableState.needDrain) this._socket.resume(); + } + + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + const opts = { + binary: typeof data !== 'string', + mask: !this._isServer, + compress: true, + fin: true, + ...options + }; + + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + + this._sender.send(data || EMPTY_BUFFER, opts, cb); + } + + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + abortHandshake(this, this._req, msg); + return; + } + + if (this._socket) { + this._readyState = WebSocket.CLOSING; + this._socket.destroy(); + } + } +} + +/** + * @constant {Number} CONNECTING + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CONNECTING', { + enumerable: true, + value: readyStates.indexOf('CONNECTING') +}); + +/** + * @constant {Number} CONNECTING + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CONNECTING', { + enumerable: true, + value: readyStates.indexOf('CONNECTING') +}); + +/** + * @constant {Number} OPEN + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'OPEN', { + enumerable: true, + value: readyStates.indexOf('OPEN') +}); + +/** + * @constant {Number} OPEN + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'OPEN', { + enumerable: true, + value: readyStates.indexOf('OPEN') +}); + +/** + * @constant {Number} CLOSING + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CLOSING', { + enumerable: true, + value: readyStates.indexOf('CLOSING') +}); + +/** + * @constant {Number} CLOSING + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CLOSING', { + enumerable: true, + value: readyStates.indexOf('CLOSING') +}); + +/** + * @constant {Number} CLOSED + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CLOSED', { + enumerable: true, + value: readyStates.indexOf('CLOSED') +}); + +/** + * @constant {Number} CLOSED + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CLOSED', { + enumerable: true, + value: readyStates.indexOf('CLOSED') +}); + +[ + 'binaryType', + 'bufferedAmount', + 'extensions', + 'isPaused', + 'protocol', + 'readyState', + 'url' +].forEach((property) => { + Object.defineProperty(WebSocket.prototype, property, { enumerable: true }); +}); + +// +// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. +// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface +// +['open', 'error', 'close', 'message'].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + enumerable: true, + get() { + for (const listener of this.listeners(method)) { + if (listener[kForOnEventAttribute]) return listener[kListener]; + } + + return null; + }, + set(handler) { + for (const listener of this.listeners(method)) { + if (listener[kForOnEventAttribute]) { + this.removeListener(method, listener); + break; + } + } + + if (typeof handler !== 'function') return; + + this.addEventListener(method, handler, { + [kForOnEventAttribute]: true + }); + } + }); +}); + +WebSocket.prototype.addEventListener = addEventListener; +WebSocket.prototype.removeEventListener = removeEventListener; + +module.exports = WebSocket; + +/** + * Initialize a WebSocket client. + * + * @param {WebSocket} websocket The client to initialize + * @param {(String|URL)} address The URL to which to connect + * @param {Array} protocols The subprotocols + * @param {Object} [options] Connection options + * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any + * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple + * times in the same tick + * @param {Boolean} [options.autoPong=true] Specifies whether or not to + * automatically send a pong in response to a ping + * @param {Function} [options.finishRequest] A function which can be used to + * customize the headers of each http request before it is sent + * @param {Boolean} [options.followRedirects=false] Whether or not to follow + * redirects + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the + * handshake request + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Number} [options.maxRedirects=10] The maximum number of redirects + * allowed + * @param {String} [options.origin] Value of the `Origin` or + * `Sec-WebSocket-Origin` header + * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable + * permessage-deflate + * @param {Number} [options.protocolVersion=13] Value of the + * `Sec-WebSocket-Version` header + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ +function initAsClient(websocket, address, protocols, options) { + const opts = { + allowSynchronousEvents: true, + autoPong: true, + protocolVersion: protocolVersions[1], + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: false, + perMessageDeflate: true, + followRedirects: false, + maxRedirects: 10, + ...options, + socketPath: undefined, + hostname: undefined, + protocol: undefined, + timeout: undefined, + method: 'GET', + host: undefined, + path: undefined, + port: undefined + }; + + websocket._autoPong = opts.autoPong; + + if (!protocolVersions.includes(opts.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${opts.protocolVersion} ` + + `(supported versions: ${protocolVersions.join(', ')})` + ); + } + + let parsedUrl; + + if (address instanceof URL) { + parsedUrl = address; + } else { + try { + parsedUrl = new URL(address); + } catch (e) { + throw new SyntaxError(`Invalid URL: ${address}`); + } + } + + if (parsedUrl.protocol === 'http:') { + parsedUrl.protocol = 'ws:'; + } else if (parsedUrl.protocol === 'https:') { + parsedUrl.protocol = 'wss:'; + } + + websocket._url = parsedUrl.href; + + const isSecure = parsedUrl.protocol === 'wss:'; + const isIpcUrl = parsedUrl.protocol === 'ws+unix:'; + let invalidUrlMessage; + + if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) { + invalidUrlMessage = + 'The URL\'s protocol must be one of "ws:", "wss:", ' + + '"http:", "https", or "ws+unix:"'; + } else if (isIpcUrl && !parsedUrl.pathname) { + invalidUrlMessage = "The URL's pathname is empty"; + } else if (parsedUrl.hash) { + invalidUrlMessage = 'The URL contains a fragment identifier'; + } + + if (invalidUrlMessage) { + const err = new SyntaxError(invalidUrlMessage); + + if (websocket._redirects === 0) { + throw err; + } else { + emitErrorAndClose(websocket, err); + return; + } + } + + const defaultPort = isSecure ? 443 : 80; + const key = randomBytes(16).toString('base64'); + const request = isSecure ? https.request : http.request; + const protocolSet = new Set(); + let perMessageDeflate; + + opts.createConnection = + opts.createConnection || (isSecure ? tlsConnect : netConnect); + opts.defaultPort = opts.defaultPort || defaultPort; + opts.port = parsedUrl.port || defaultPort; + opts.host = parsedUrl.hostname.startsWith('[') + ? parsedUrl.hostname.slice(1, -1) + : parsedUrl.hostname; + opts.headers = { + ...opts.headers, + 'Sec-WebSocket-Version': opts.protocolVersion, + 'Sec-WebSocket-Key': key, + Connection: 'Upgrade', + Upgrade: 'websocket' + }; + opts.path = parsedUrl.pathname + parsedUrl.search; + opts.timeout = opts.handshakeTimeout; + + if (opts.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, + false, + opts.maxPayload + ); + opts.headers['Sec-WebSocket-Extensions'] = format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols.length) { + for (const protocol of protocols) { + if ( + typeof protocol !== 'string' || + !subprotocolRegex.test(protocol) || + protocolSet.has(protocol) + ) { + throw new SyntaxError( + 'An invalid or duplicated subprotocol was specified' + ); + } + + protocolSet.add(protocol); + } + + opts.headers['Sec-WebSocket-Protocol'] = protocols.join(','); + } + if (opts.origin) { + if (opts.protocolVersion < 13) { + opts.headers['Sec-WebSocket-Origin'] = opts.origin; + } else { + opts.headers.Origin = opts.origin; + } + } + if (parsedUrl.username || parsedUrl.password) { + opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + + if (isIpcUrl) { + const parts = opts.path.split(':'); + + opts.socketPath = parts[0]; + opts.path = parts[1]; + } + + let req; + + if (opts.followRedirects) { + if (websocket._redirects === 0) { + websocket._originalIpc = isIpcUrl; + websocket._originalSecure = isSecure; + websocket._originalHostOrSocketPath = isIpcUrl + ? opts.socketPath + : parsedUrl.host; + + const headers = options && options.headers; + + // + // Shallow copy the user provided options so that headers can be changed + // without mutating the original object. + // + options = { ...options, headers: {} }; + + if (headers) { + for (const [key, value] of Object.entries(headers)) { + options.headers[key.toLowerCase()] = value; + } + } + } else if (websocket.listenerCount('redirect') === 0) { + const isSameHost = isIpcUrl + ? websocket._originalIpc + ? opts.socketPath === websocket._originalHostOrSocketPath + : false + : websocket._originalIpc + ? false + : parsedUrl.host === websocket._originalHostOrSocketPath; + + if (!isSameHost || (websocket._originalSecure && !isSecure)) { + // + // Match curl 7.77.0 behavior and drop the following headers. These + // headers are also dropped when following a redirect to a subdomain. + // + delete opts.headers.authorization; + delete opts.headers.cookie; + + if (!isSameHost) delete opts.headers.host; + + opts.auth = undefined; + } + } + + // + // Match curl 7.77.0 behavior and make the first `Authorization` header win. + // If the `Authorization` header is set, then there is nothing to do as it + // will take precedence. + // + if (opts.auth && !options.headers.authorization) { + options.headers.authorization = + 'Basic ' + Buffer.from(opts.auth).toString('base64'); + } + + req = websocket._req = request(opts); + + if (websocket._redirects) { + // + // Unlike what is done for the `'upgrade'` event, no early exit is + // triggered here if the user calls `websocket.close()` or + // `websocket.terminate()` from a listener of the `'redirect'` event. This + // is because the user can also call `request.destroy()` with an error + // before calling `websocket.close()` or `websocket.terminate()` and this + // would result in an error being emitted on the `request` object with no + // `'error'` event listeners attached. + // + websocket.emit('redirect', websocket.url, req); + } + } else { + req = websocket._req = request(opts); + } + + if (opts.timeout) { + req.on('timeout', () => { + abortHandshake(websocket, req, 'Opening handshake has timed out'); + }); + } + + req.on('error', (err) => { + if (req === null || req[kAborted]) return; + + req = websocket._req = null; + emitErrorAndClose(websocket, err); + }); + + req.on('response', (res) => { + const location = res.headers.location; + const statusCode = res.statusCode; + + if ( + location && + opts.followRedirects && + statusCode >= 300 && + statusCode < 400 + ) { + if (++websocket._redirects > opts.maxRedirects) { + abortHandshake(websocket, req, 'Maximum redirects exceeded'); + return; + } + + req.abort(); + + let addr; + + try { + addr = new URL(location, address); + } catch (e) { + const err = new SyntaxError(`Invalid URL: ${location}`); + emitErrorAndClose(websocket, err); + return; + } + + initAsClient(websocket, addr, protocols, options); + } else if (!websocket.emit('unexpected-response', req, res)) { + abortHandshake( + websocket, + req, + `Unexpected server response: ${res.statusCode}` + ); + } + }); + + req.on('upgrade', (res, socket, head) => { + websocket.emit('upgrade', res); + + // + // The user may have closed the connection from a listener of the + // `'upgrade'` event. + // + if (websocket.readyState !== WebSocket.CONNECTING) return; + + req = websocket._req = null; + + if (res.headers.upgrade.toLowerCase() !== 'websocket') { + abortHandshake(websocket, socket, 'Invalid Upgrade header'); + return; + } + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + if (res.headers['sec-websocket-accept'] !== digest) { + abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header'); + return; + } + + const serverProt = res.headers['sec-websocket-protocol']; + let protError; + + if (serverProt !== undefined) { + if (!protocolSet.size) { + protError = 'Server sent a subprotocol but none was requested'; + } else if (!protocolSet.has(serverProt)) { + protError = 'Server sent an invalid subprotocol'; + } + } else if (protocolSet.size) { + protError = 'Server sent no subprotocol'; + } + + if (protError) { + abortHandshake(websocket, socket, protError); + return; + } + + if (serverProt) websocket._protocol = serverProt; + + const secWebSocketExtensions = res.headers['sec-websocket-extensions']; + + if (secWebSocketExtensions !== undefined) { + if (!perMessageDeflate) { + const message = + 'Server sent a Sec-WebSocket-Extensions header but no extension ' + + 'was requested'; + abortHandshake(websocket, socket, message); + return; + } + + let extensions; + + try { + extensions = parse(secWebSocketExtensions); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Extensions header'; + abortHandshake(websocket, socket, message); + return; + } + + const extensionNames = Object.keys(extensions); + + if ( + extensionNames.length !== 1 || + extensionNames[0] !== PerMessageDeflate.extensionName + ) { + const message = 'Server indicated an extension that was not requested'; + abortHandshake(websocket, socket, message); + return; + } + + try { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Extensions header'; + abortHandshake(websocket, socket, message); + return; + } + + websocket._extensions[PerMessageDeflate.extensionName] = + perMessageDeflate; + } + + websocket.setSocket(socket, head, { + allowSynchronousEvents: opts.allowSynchronousEvents, + generateMask: opts.generateMask, + maxPayload: opts.maxPayload, + skipUTF8Validation: opts.skipUTF8Validation + }); + }); + + if (opts.finishRequest) { + opts.finishRequest(req, websocket); + } else { + req.end(); + } +} + +/** + * Emit the `'error'` and `'close'` events. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {Error} The error to emit + * @private + */ +function emitErrorAndClose(websocket, err) { + websocket._readyState = WebSocket.CLOSING; + websocket.emit('error', err); + websocket.emitClose(); +} + +/** + * Create a `net.Socket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {net.Socket} The newly created socket used to start the connection + * @private + */ +function netConnect(options) { + options.path = options.socketPath; + return net.connect(options); +} + +/** + * Create a `tls.TLSSocket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {tls.TLSSocket} The newly created socket used to start the connection + * @private + */ +function tlsConnect(options) { + options.path = undefined; + + if (!options.servername && options.servername !== '') { + options.servername = net.isIP(options.host) ? '' : options.host; + } + + return tls.connect(options); +} + +/** + * Abort the handshake and emit an error. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to + * abort or the socket to destroy + * @param {String} message The error message + * @private + */ +function abortHandshake(websocket, stream, message) { + websocket._readyState = WebSocket.CLOSING; + + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + + if (stream.setHeader) { + stream[kAborted] = true; + stream.abort(); + + if (stream.socket && !stream.socket.destroyed) { + // + // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if + // called after the request completed. See + // https://github.com/websockets/ws/issues/1869. + // + stream.socket.destroy(); + } + + process.nextTick(emitErrorAndClose, websocket, err); + } else { + stream.destroy(err); + stream.once('error', websocket.emit.bind(websocket, 'error')); + stream.once('close', websocket.emitClose.bind(websocket)); + } +} + +/** + * Handle cases where the `ping()`, `pong()`, or `send()` methods are called + * when the `readyState` attribute is `CLOSING` or `CLOSED`. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {*} [data] The data to send + * @param {Function} [cb] Callback + * @private + */ +function sendAfterClose(websocket, data, cb) { + if (data) { + const length = toBuffer(data).length; + + // + // The `_bufferedAmount` property is used only when the peer is a client and + // the opening handshake fails. Under these circumstances, in fact, the + // `setSocket()` method is not called, so the `_socket` and `_sender` + // properties are set to `null`. + // + if (websocket._socket) websocket._sender._bufferedBytes += length; + else websocket._bufferedAmount += length; + } + + if (cb) { + const err = new Error( + `WebSocket is not open: readyState ${websocket.readyState} ` + + `(${readyStates[websocket.readyState]})` + ); + process.nextTick(cb, err); + } +} + +/** + * The listener of the `Receiver` `'conclude'` event. + * + * @param {Number} code The status code + * @param {Buffer} reason The reason for closing + * @private + */ +function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + + if (websocket._socket[kWebSocket] === undefined) return; + + websocket._socket.removeListener('data', socketOnData); + process.nextTick(resume, websocket._socket); + + if (code === 1005) websocket.close(); + else websocket.close(code, reason); +} + +/** + * The listener of the `Receiver` `'drain'` event. + * + * @private + */ +function receiverOnDrain() { + const websocket = this[kWebSocket]; + + if (!websocket.isPaused) websocket._socket.resume(); +} + +/** + * The listener of the `Receiver` `'error'` event. + * + * @param {(RangeError|Error)} err The emitted error + * @private + */ +function receiverOnError(err) { + const websocket = this[kWebSocket]; + + if (websocket._socket[kWebSocket] !== undefined) { + websocket._socket.removeListener('data', socketOnData); + + // + // On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See + // https://github.com/websockets/ws/issues/1940. + // + process.nextTick(resume, websocket._socket); + + websocket.close(err[kStatusCode]); + } + + websocket.emit('error', err); +} + +/** + * The listener of the `Receiver` `'finish'` event. + * + * @private + */ +function receiverOnFinish() { + this[kWebSocket].emitClose(); +} + +/** + * The listener of the `Receiver` `'message'` event. + * + * @param {Buffer|ArrayBuffer|Buffer[])} data The message + * @param {Boolean} isBinary Specifies whether the message is binary or not + * @private + */ +function receiverOnMessage(data, isBinary) { + this[kWebSocket].emit('message', data, isBinary); +} + +/** + * The listener of the `Receiver` `'ping'` event. + * + * @param {Buffer} data The data included in the ping frame + * @private + */ +function receiverOnPing(data) { + const websocket = this[kWebSocket]; + + if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP); + websocket.emit('ping', data); +} + +/** + * The listener of the `Receiver` `'pong'` event. + * + * @param {Buffer} data The data included in the pong frame + * @private + */ +function receiverOnPong(data) { + this[kWebSocket].emit('pong', data); +} + +/** + * Resume a readable stream + * + * @param {Readable} stream The readable stream + * @private + */ +function resume(stream) { + stream.resume(); +} + +/** + * The listener of the socket `'close'` event. + * + * @private + */ +function socketOnClose() { + const websocket = this[kWebSocket]; + + this.removeListener('close', socketOnClose); + this.removeListener('data', socketOnData); + this.removeListener('end', socketOnEnd); + + websocket._readyState = WebSocket.CLOSING; + + let chunk; + + // + // The close frame might not have been received or the `'end'` event emitted, + // for example, if the socket was destroyed due to an error. Ensure that the + // `receiver` stream is closed after writing any remaining buffered data to + // it. If the readable side of the socket is in flowing mode then there is no + // buffered data as everything has been already written and `readable.read()` + // will return `null`. If instead, the socket is paused, any possible buffered + // data will be read as a single chunk. + // + if ( + !this._readableState.endEmitted && + !websocket._closeFrameReceived && + !websocket._receiver._writableState.errorEmitted && + (chunk = websocket._socket.read()) !== null + ) { + websocket._receiver.write(chunk); + } + + websocket._receiver.end(); + + this[kWebSocket] = undefined; + + clearTimeout(websocket._closeTimer); + + if ( + websocket._receiver._writableState.finished || + websocket._receiver._writableState.errorEmitted + ) { + websocket.emitClose(); + } else { + websocket._receiver.on('error', receiverOnFinish); + websocket._receiver.on('finish', receiverOnFinish); + } +} + +/** + * The listener of the socket `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } +} + +/** + * The listener of the socket `'end'` event. + * + * @private + */ +function socketOnEnd() { + const websocket = this[kWebSocket]; + + websocket._readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); +} + +/** + * The listener of the socket `'error'` event. + * + * @private + */ +function socketOnError() { + const websocket = this[kWebSocket]; + + this.removeListener('error', socketOnError); + this.on('error', NOOP); + + if (websocket) { + websocket._readyState = WebSocket.CLOSING; + this.destroy(); + } +} diff --git a/graphql-subscription-express/node_modules/ws/package.json b/graphql-subscription-express/node_modules/ws/package.json new file mode 100644 index 0000000..ed9c681 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/package.json @@ -0,0 +1,69 @@ +{ + "name": "ws", + "version": "8.17.0", + "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", + "keywords": [ + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "homepage": "https://github.com/websockets/ws", + "bugs": "https://github.com/websockets/ws/issues", + "repository": { + "type": "git", + "url": "git+https://github.com/websockets/ws.git" + }, + "author": "Einar Otto Stangvik (http://2x.io)", + "license": "MIT", + "main": "index.js", + "exports": { + ".": { + "browser": "./browser.js", + "import": "./wrapper.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "browser": "browser.js", + "engines": { + "node": ">=10.0.0" + }, + "files": [ + "browser.js", + "index.js", + "lib/*.js", + "wrapper.mjs" + ], + "scripts": { + "test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js", + "integration": "mocha --throw-deprecation test/*.integration.js", + "lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\"" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + }, + "devDependencies": { + "benchmark": "^2.1.4", + "bufferutil": "^4.0.1", + "eslint": "^9.0.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prettier": "^5.0.0", + "globals": "^15.0.0", + "mocha": "^8.4.0", + "nyc": "^15.0.0", + "prettier": "^3.0.0", + "utf-8-validate": "^6.0.0" + } +} diff --git a/graphql-subscription-express/node_modules/ws/wrapper.mjs b/graphql-subscription-express/node_modules/ws/wrapper.mjs new file mode 100644 index 0000000..7245ad1 --- /dev/null +++ b/graphql-subscription-express/node_modules/ws/wrapper.mjs @@ -0,0 +1,8 @@ +import createWebSocketStream from './lib/stream.js'; +import Receiver from './lib/receiver.js'; +import Sender from './lib/sender.js'; +import WebSocket from './lib/websocket.js'; +import WebSocketServer from './lib/websocket-server.js'; + +export { createWebSocketStream, Receiver, Sender, WebSocket, WebSocketServer }; +export default WebSocket; diff --git a/graphql-subscription-express/package-lock.json b/graphql-subscription-express/package-lock.json new file mode 100644 index 0000000..987c2bd --- /dev/null +++ b/graphql-subscription-express/package-lock.json @@ -0,0 +1,736 @@ +{ + "name": "graphql-express-app", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "graphql-express-app", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "express": "^4.19.2", + "graphql-ws": "^5.16.0", + "ws": "^8.17.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.2", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graphql": { + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/graphql-ws": { + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.16.0.tgz", + "integrity": "sha512-Ju2RCU2dQMgSKtArPbEtsK5gNLnsQyTNIo/T7cZNp96niC1x0KdJNZV0TIoilceBPQwfb5itrGl8pkFeOUMl4A==", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "graphql": ">=0.11 <=16" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ws": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/graphql-subscription-express/package.json b/graphql-subscription-express/package.json new file mode 100644 index 0000000..a4396f5 --- /dev/null +++ b/graphql-subscription-express/package.json @@ -0,0 +1,17 @@ +{ + "name": "graphql-express-app", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "express": "^4.19.2", + "graphql-ws": "^5.16.0", + "ws": "^8.17.0" + } +} diff --git a/graphql-subscription-express/server.js b/graphql-subscription-express/server.js new file mode 100644 index 0000000..ad2a327 --- /dev/null +++ b/graphql-subscription-express/server.js @@ -0,0 +1,31 @@ +const express = require('express'); +const { WebSocketServer } = require('ws'); +const path = require('path'); +const { subscribeToSomething, setWsClient } = require('./subscriptionClient'); + +const app = express(); +const PORT = 4000; + +// Serve the HTML file +app.get('/', (req, res) => { + res.sendFile(path.join(__dirname, 'index.html')); +}); + +const server = app.listen(PORT, () => { + console.log(`Server is running on http://localhost:${PORT}`); +}); + +// Create WebSocket server +const wss = new WebSocketServer({ server }); + +wss.on('connection', (ws) => { + console.log('Client connected'); + setWsClient(ws); + + ws.on('close', () => { + console.log('Client disconnected'); + }); +}); + +// Start the subscription +subscribeToSomething(); diff --git a/graphql-subscription-express/subscriptionClient.js b/graphql-subscription-express/subscriptionClient.js new file mode 100644 index 0000000..fe1e8f2 --- /dev/null +++ b/graphql-subscription-express/subscriptionClient.js @@ -0,0 +1,93 @@ +const { createClient, SubscribePayload } = require('graphql-ws'); +const { WebSocket } = require('ws'); + +// const ws = new WebSocket('ws://localhost:8016/gqlapi', { +// WebSocket, +// }); + +// const client = createClient({ +// url: 'ws://localhost:8016/gqlapi', +// webSocketImpl: ws, +// }); + +// const ws = new WebSocket('ws://localhost:8016/gqlapi', { +// headers: { +// Authorization: "Basic YWRtaW46YWRtaW4=" +// } +// }); + +// const client = createClient({ +// url: 'ws://localhost:8016/gqlapi', +// webSocketImpl: ws, +// }); + + +const headers = { + 'Authorization': 'Basic YWRtaW46YWRtaW4=', + 'Content-Type': 'application/json', + origin: 'abcdefg', + // Other headers as needed + }; + +// const ws = WebSocket('ws://localhost:8016/user-graphql-basic', { +// headers: headers +// }) + +class MyWebSocket extends WebSocket { + constructor(address, protocols) { + super(address, protocols, { + headers: headers + }); + } + } + +const client = createClient({ +url: 'ws://localhost:8016/gqlapi', +//url: 'wss://easyapi.ekika.app/user-graphql-apikey', +webSocketImpl: MyWebSocket, +}); + + + +const subscribeToSomething = async () => { + const payload = { + query: ` + subscription MySubscription{ + ResPartnerSub{ + name + phone + email + } + } + `, + }; + + const onNext = (data) => { + console.log('Received data:', data); + // Send data to the client + if (wsClient && wsClient.readyState === WebSocket.OPEN) { + wsClient.send(JSON.stringify(data)); + } + }; + + const onError = (error) => { + console.error('Subscription error:', error); + }; + + const onComplete = () => { + console.log('Subscription complete'); + }; + + await new Promise((resolve, reject) => { + client.subscribe(payload, { + next: onNext, + error: onError, + complete: onComplete, + }); + }); +}; + +// Keep track of the connected WebSocket client +let wsClient = null; + +module.exports = { subscribeToSomething, setWsClient: (client) => { wsClient = client; } }; diff --git a/graphql-subscription/graphql-subscription-client.js b/graphql-subscription/graphql-subscription-client.js new file mode 100644 index 0000000..6dda9ad --- /dev/null +++ b/graphql-subscription/graphql-subscription-client.js @@ -0,0 +1,161 @@ +// import { createClient, SubscribePayload } from 'graphql-ws'; +const { createClient, SubscribePayload } = require('graphql-ws'); +const { WebSocket } = require('ws'); + +console.log('start'); + +const headers = { + 'x-api-key': 'Yn7}a4fe`j(]k+Zu.Bk|}Hoz7RgAgdv<', + 'Content-Type': 'application/json', + origin: 'abcdefg', + }; + +class MyWebSocket extends WebSocket { + constructor(address, protocols) { + super(address, protocols, { + headers: headers + }); + } +} +let client; +async function clientFunction() { + client = createClient({ + url: 'wss://apibundle.17.dev.ekika.co/user-graphql-apikey', + //url: 'wss://easyapi.ekika.app/user-graphql-apikey', + webSocketImpl: MyWebSocket, + }); + + const query = client.iterate({ + query: ` + subscription MySub{ + ResPartnerNew{ + id + name + write_date + } + } + `, + operationName: 'SubscriptionType', + variables: {}, + }); + + try{ + for await (const result of query) { + console.log(result) + } + } catch(err) { + console.log(err) + } +}; +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +clientFunction(); +a => setTimeout(a, 5000); +client.terminate(); + + + +function comment() { + +// import { createClient, SubscribePayload } from 'graphql-ws'; +const { createClient, SubscribePayload } = require('graphql-ws'); +const { WebSocket } = require('ws'); + +console.log('start'); + +const headers = { + 'x-api-key': 'Yn7}a4fe`j(]k+Zu.Bk|}Hoz7RgAgdv<', + //'x-api-key': `Af+"E { +// const subscription = client.iterate({ +// query: 'subscription { greetings }', +// }); +// // "subscription.return()" to dispose + +// for await (const result of subscription) { +// // next = result = { data: { greetings: 5x } } +// // "break" to dispose +// } +// // complete +// })(); +} \ No newline at end of file diff --git a/graphql-subscription/node_modules/.bin/loose-envify b/graphql-subscription/node_modules/.bin/loose-envify new file mode 120000 index 0000000..ed9009c --- /dev/null +++ b/graphql-subscription/node_modules/.bin/loose-envify @@ -0,0 +1 @@ +../loose-envify/cli.js \ No newline at end of file diff --git a/graphql-subscription/node_modules/.package-lock.json b/graphql-subscription/node_modules/.package-lock.json new file mode 100644 index 0000000..f4783ea --- /dev/null +++ b/graphql-subscription/node_modules/.package-lock.json @@ -0,0 +1,297 @@ +{ + "name": "graphql-example", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@apollo/client": { + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.9.5.tgz", + "integrity": "sha512-7y+c8MTPU+hhTwvcGVtMMGIgWduzrvG1mz5yJMRyqYbheBkkky3Lki6ADWVSBXG1lZoOtPYvB2zDgVfKb2HSsw==", + "dependencies": { + "@graphql-typed-document-node/core": "^3.1.1", + "@wry/caches": "^1.0.0", + "@wry/equality": "^0.5.6", + "@wry/trie": "^0.5.0", + "graphql-tag": "^2.12.6", + "hoist-non-react-statics": "^3.3.2", + "optimism": "^0.18.0", + "prop-types": "^15.7.2", + "rehackt": "0.0.5", + "response-iterator": "^0.2.6", + "symbol-observable": "^4.0.0", + "ts-invariant": "^0.10.3", + "tslib": "^2.3.0", + "zen-observable-ts": "^1.2.5" + }, + "peerDependencies": { + "graphql": "^15.0.0 || ^16.0.0", + "graphql-ws": "^5.5.5", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0", + "subscriptions-transport-ws": "^0.9.0 || ^0.11.0" + }, + "peerDependenciesMeta": { + "graphql-ws": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "subscriptions-transport-ws": { + "optional": true + } + } + }, + "node_modules/@graphql-typed-document-node/core": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", + "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", + "peerDependencies": { + "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" + } + }, + "node_modules/@wry/caches": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@wry/caches/-/caches-1.0.1.tgz", + "integrity": "sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/context": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@wry/context/-/context-0.7.4.tgz", + "integrity": "sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/equality": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.5.7.tgz", + "integrity": "sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/trie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.5.0.tgz", + "integrity": "sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/graphql": { + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/graphql-tag": { + "version": "2.12.6", + "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", + "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" + } + }, + "node_modules/graphql-ws": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.15.0.tgz", + "integrity": "sha512-xWGAtm3fig9TIhSaNsg0FaDZ8Pyn/3re3RFlP4rhQcmjRDIPpk1EhRuNB+YSJtLzttyuToaDiNhwT1OMoGnJnw==", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "graphql": ">=0.11 <=16" + } + }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dependencies": { + "react-is": "^16.7.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/optimism": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.18.0.tgz", + "integrity": "sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ==", + "dependencies": { + "@wry/caches": "^1.0.0", + "@wry/context": "^0.7.0", + "@wry/trie": "^0.4.3", + "tslib": "^2.3.0" + } + }, + "node_modules/optimism/node_modules/@wry/trie": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.4.3.tgz", + "integrity": "sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, + "node_modules/rehackt": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/rehackt/-/rehackt-0.0.5.tgz", + "integrity": "sha512-BI1rV+miEkaHj8zd2n+gaMgzu/fKz7BGlb4zZ6HAiY9adDmJMkaDcmuXlJFv0eyKUob+oszs3/2gdnXUrzx2Tg==", + "peerDependencies": { + "@types/react": "*", + "react": "*" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + } + } + }, + "node_modules/response-iterator": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/response-iterator/-/response-iterator-0.2.6.tgz", + "integrity": "sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/symbol-observable": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-4.0.0.tgz", + "integrity": "sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/ts-invariant": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.10.3.tgz", + "integrity": "sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ==", + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/ws": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/zen-observable": { + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", + "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" + }, + "node_modules/zen-observable-ts": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz", + "integrity": "sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==", + "dependencies": { + "zen-observable": "0.8.15" + } + } + } +} diff --git a/graphql-subscription/node_modules/@apollo/client/.changeset/README.md b/graphql-subscription/node_modules/@apollo/client/.changeset/README.md new file mode 100644 index 0000000..e5b6d8d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/graphql-subscription/node_modules/@apollo/client/.changeset/config.json b/graphql-subscription/node_modules/@apollo/client/.changeset/config.json new file mode 100644 index 0000000..894e338 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/.changeset/config.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json", + "changelog": [ + "@changesets/changelog-github", + { "repo": "apollographql/apollo-client" } + ], + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/graphql-subscription/node_modules/@apollo/client/CHANGELOG.md b/graphql-subscription/node_modules/@apollo/client/CHANGELOG.md new file mode 100644 index 0000000..a904383 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/CHANGELOG.md @@ -0,0 +1,3734 @@ +# @apollo/client + +## 3.9.5 + +### Patch Changes + +- [#11595](https://github.com/apollographql/apollo-client/pull/11595) [`8c20955`](https://github.com/apollographql/apollo-client/commit/8c20955874562e5b2ab35557325e047b059bc4fc) Thanks [@phryneas](https://github.com/phryneas)! - Bumps the dependency `rehackt` to 0.0.5 + +- [#11592](https://github.com/apollographql/apollo-client/pull/11592) [`1133469`](https://github.com/apollographql/apollo-client/commit/1133469bd91ff76b9815e815a454a79d8e23a9bc) Thanks [@Stephen2](https://github.com/Stephen2)! - Strengthen `MockedResponse.newData` type + +- [#11579](https://github.com/apollographql/apollo-client/pull/11579) [`1ba2fd9`](https://github.com/apollographql/apollo-client/commit/1ba2fd919f79dfdc7b9d3f7d1a7aa5918e648349) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where partial data is reported to `useQuery` when using `notifyOnNetworkStatusChange` after it errors while another overlapping query succeeds. + +- [#11579](https://github.com/apollographql/apollo-client/pull/11579) [`1ba2fd9`](https://github.com/apollographql/apollo-client/commit/1ba2fd919f79dfdc7b9d3f7d1a7aa5918e648349) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a partial cache write for an errored query would result in automatically refetching that query. + +- [#11562](https://github.com/apollographql/apollo-client/pull/11562) [`65ab695`](https://github.com/apollographql/apollo-client/commit/65ab695470741e8dcaef1ebd7742c3c397526354) Thanks [@mspiess](https://github.com/mspiess)! - Mocks with an infinite delay no longer require result or error + +## 3.9.4 + +### Patch Changes + +- [#11403](https://github.com/apollographql/apollo-client/pull/11403) [`b0c4f3a`](https://github.com/apollographql/apollo-client/commit/b0c4f3ad8198981a229b46dc430345a76e577e9c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue in `useLazyQuery` that results in a double network call when calling the execute function with no arguments after having called it previously with another set of arguments. + +- [#11576](https://github.com/apollographql/apollo-client/pull/11576) [`e855d00`](https://github.com/apollographql/apollo-client/commit/e855d00447e4d9ae478d98f6796d842ef6cc76d1) Thanks [@alessbell](https://github.com/alessbell)! - Revert PR [#11202](https://github.com/apollographql/apollo-client/pull/11202) to fix caching bug reported in [#11560](https://github.com/apollographql/apollo-client/issues/11560) + +## 3.9.3 + +### Patch Changes + +- [#11525](https://github.com/apollographql/apollo-client/pull/11525) [`dce923a`](https://github.com/apollographql/apollo-client/commit/dce923ae57eb6b6d889e2980635cb90e2c6cbca3) Thanks [@vezaynk](https://github.com/vezaynk)! - Allows passing in client via options to useFragment + +- [#11558](https://github.com/apollographql/apollo-client/pull/11558) [`8cba16f`](https://github.com/apollographql/apollo-client/commit/8cba16f041609443111ecf5fb58faea1b3e79569) Thanks [@alessbell](https://github.com/alessbell)! - Fix [`unbound-method`](https://github.com/apollographql/apollo-client/issues/11554) linter error on ObservableQuery methods exposed on useQuery's QueryResult object. + +## 3.9.2 + +### Patch Changes + +- [#11552](https://github.com/apollographql/apollo-client/pull/11552) [`6ac2b0c`](https://github.com/apollographql/apollo-client/commit/6ac2b0ce4d999c63478d85b40ad56ccda9624797) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix import in `useLazyRef` causing import issues in the nextjs package. + +## 3.9.1 + +### Patch Changes + +- [#11516](https://github.com/apollographql/apollo-client/pull/11516) [`8390fea`](https://github.com/apollographql/apollo-client/commit/8390fea13175bada8361ba5f0df2e43197085aba) Thanks [@phryneas](https://github.com/phryneas)! - Fix an incorrect string substitution in a warning message. + +- [#11515](https://github.com/apollographql/apollo-client/pull/11515) [`c9bf93b`](https://github.com/apollographql/apollo-client/commit/c9bf93bdc2816f7fdba96961e1435f463f440bd1) Thanks [@vladar](https://github.com/vladar)! - Avoid redundant refetchQueries call for mutation with no-cache policy (fixes #10238) + +- [#11545](https://github.com/apollographql/apollo-client/pull/11545) [`84a6bea`](https://github.com/apollographql/apollo-client/commit/84a6beaeae69acdffea49ba6b8242752cc188172) Thanks [@alessbell](https://github.com/alessbell)! - Remove error thrown by `inFlightLinkObservables` intended to be removed before 3.9 release. + +## 3.9.0 + +### Minor Changes + +#### Memory optimizations + +- [#11424](https://github.com/apollographql/apollo-client/pull/11424) [`62f3b6d`](https://github.com/apollographql/apollo-client/commit/62f3b6d0e89611e27d9f29812ee60e5db5963fd6) Thanks [@phryneas](https://github.com/phryneas)! - Simplify RetryLink, fix potential memory leak + + Historically, `RetryLink` would keep a `values` array of all previous values, in case the operation would get an additional subscriber at a later point in time. + + In practice, this could lead to a memory leak ([#11393](https://github.com/apollographql/apollo-client/pull/11393)) and did not serve any further purpose, as the resulting observable would only be subscribed to by Apollo Client itself, and only once - it would be wrapped in a `Concast` before being exposed to the user, and that `Concast` would handle subscribers on its own. + +- [#11435](https://github.com/apollographql/apollo-client/pull/11435) [`5cce53e`](https://github.com/apollographql/apollo-client/commit/5cce53e83b976f85d2d2b06e28cc38f01324fea1) Thanks [@phryneas](https://github.com/phryneas)! - Deprecates `canonizeResults`. + + Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + +- [#11254](https://github.com/apollographql/apollo-client/pull/11254) [`d08970d`](https://github.com/apollographql/apollo-client/commit/d08970d348cf4ad6d80c6baf85b4a4cd4034a3bb) Thanks [@benjamn](https://github.com/benjamn)! - Decouple `canonicalStringify` from `ObjectCanon` for better time and memory performance. + +- [#11356](https://github.com/apollographql/apollo-client/pull/11356) [`cc4ac7e`](https://github.com/apollographql/apollo-client/commit/cc4ac7e1917f046bcd177882727864eed40b910e) Thanks [@phryneas](https://github.com/phryneas)! - Fix a potential memory leak in `FragmentRegistry.transform` and `FragmentRegistry.findFragmentSpreads` that would hold on to passed-in `DocumentNodes` for too long. + +- [#11370](https://github.com/apollographql/apollo-client/pull/11370) [`25e2cb4`](https://github.com/apollographql/apollo-client/commit/25e2cb431c76ec5aa88202eaacbd98fad42edc7f) Thanks [@phryneas](https://github.com/phryneas)! - `parse` function: improve memory management + + - use LRU `WeakCache` instead of `Map` to keep a limited number of parsed results + - cache is initiated lazily, only when needed + - expose `parse.resetCache()` method + +- [#11389](https://github.com/apollographql/apollo-client/pull/11389) [`139acd1`](https://github.com/apollographql/apollo-client/commit/139acd1153afa1445b69dcb4e139668ab8c5889a) Thanks [@phryneas](https://github.com/phryneas)! - `documentTransform`: use `optimism` and `WeakCache` instead of directly storing data on the `Trie` + +- [#11358](https://github.com/apollographql/apollo-client/pull/11358) [`7d939f8`](https://github.com/apollographql/apollo-client/commit/7d939f80fbc2c419c58a6c55b6a35ee7474d0379) Thanks [@phryneas](https://github.com/phryneas)! - Fixes a potential memory leak in `Concast` that might have been triggered when `Concast` was used outside of Apollo Client. + +- [#11344](https://github.com/apollographql/apollo-client/pull/11344) [`bd26676`](https://github.com/apollographql/apollo-client/commit/bd2667619700139af32a45364794d11f845ab6cf) Thanks [@phryneas](https://github.com/phryneas)! - Add a `resetCache` method to `DocumentTransform` and hook `InMemoryCache.addTypenameTransform` up to `InMemoryCache.gc` + +- [#11367](https://github.com/apollographql/apollo-client/pull/11367) [`30d17bf`](https://github.com/apollographql/apollo-client/commit/30d17bfebe44dbfa7b78c8982cfeb49afd37129c) Thanks [@phryneas](https://github.com/phryneas)! - `print`: use `WeakCache` instead of `WeakMap` + +- [#11387](https://github.com/apollographql/apollo-client/pull/11387) [`4dce867`](https://github.com/apollographql/apollo-client/commit/4dce8673b1757d8a3a4edd2996d780e86fad14e3) Thanks [@phryneas](https://github.com/phryneas)! - `QueryManager.transformCache`: use `WeakCache` instead of `WeakMap` + +- [#11369](https://github.com/apollographql/apollo-client/pull/11369) [`2a47164`](https://github.com/apollographql/apollo-client/commit/2a471646616e3af1b5c039e961f8d5717fad8f32) Thanks [@phryneas](https://github.com/phryneas)! - Persisted Query Link: improve memory management + + - use LRU `WeakCache` instead of `WeakMap` to keep a limited number of hash results + - hash cache is initiated lazily, only when needed + - expose `persistedLink.resetHashCache()` method + - reset hash cache if the upstream server reports it doesn't accept persisted queries + +- [#10804](https://github.com/apollographql/apollo-client/pull/10804) [`221dd99`](https://github.com/apollographql/apollo-client/commit/221dd99ffd1990f8bd0392543af35e9b08d0fed8) Thanks [@phryneas](https://github.com/phryneas)! - use WeakMap in React Native with Hermes + +- [#11355](https://github.com/apollographql/apollo-client/pull/11355) [`7d8e184`](https://github.com/apollographql/apollo-client/commit/7d8e18493cd13134726c6643cbf0fadb08be2d37) Thanks [@phryneas](https://github.com/phryneas)! - InMemoryCache.gc now also triggers FragmentRegistry.resetCaches (if there is a FragmentRegistry) + +- [#11409](https://github.com/apollographql/apollo-client/pull/11409) [`2e7203b`](https://github.com/apollographql/apollo-client/commit/2e7203b3a9618952ddb522627ded7cceabd7f250) Thanks [@phryneas](https://github.com/phryneas)! - Adds an experimental `ApolloClient.getMemoryInternals` helper + +- [#11343](https://github.com/apollographql/apollo-client/pull/11343) [`776631d`](https://github.com/apollographql/apollo-client/commit/776631de4500d56252f6f5fdaf29a81c41dfbdc7) Thanks [@phryneas](https://github.com/phryneas)! - Add `reset` method to `print`, hook up to `InMemoryCache.gc` + +#### Suspense-enabled data fetching on user interaction with `useLoadableQuery` + +- [#11300](https://github.com/apollographql/apollo-client/pull/11300) [`a815873`](https://github.com/apollographql/apollo-client/commit/a8158733cfa3e65180ec23518d657ea41894bb2b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Introduces a new `useLoadableQuery` hook. This hook works similarly to `useBackgroundQuery` in that it returns a `queryRef` that can be used to suspend a component via the `useReadQuery` hook. It provides a more ergonomic way to load the query during a user interaction (for example when wanting to preload some data) that would otherwise be clunky with `useBackgroundQuery`. + + ```tsx + function App() { + const [loadQuery, queryRef, { refetch, fetchMore, reset }] = + useLoadableQuery(query, options); + + return ( + <> + + }> + {queryRef && } + + + ); + } + + function Child({ queryRef }) { + const { data } = useReadQuery(queryRef); + + // ... + } + ``` + +#### Begin preloading outside of React with `createQueryPreloader` + +- [#11412](https://github.com/apollographql/apollo-client/pull/11412) [`58db5c3`](https://github.com/apollographql/apollo-client/commit/58db5c3295b88162f91019f0898f6baa4b9cced6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to start preloading a query outside React to begin fetching as early as possible. Call `createQueryPreloader` to create a `preloadQuery` function which can be called to start fetching a query. This returns a `queryRef` which is passed to `useReadQuery` and suspended until the query is done fetching. + +#### Testing utility improvements + +- [#11178](https://github.com/apollographql/apollo-client/pull/11178) [`4d64a6f`](https://github.com/apollographql/apollo-client/commit/4d64a6fa2ad5abe6f7f172c164f5e1fc2cb89829) Thanks [@sebakerckhof](https://github.com/sebakerckhof)! - Support re-using of mocks in the MockedProvider + +- [#6701](https://github.com/apollographql/apollo-client/pull/6701) [`8d2b4e1`](https://github.com/apollographql/apollo-client/commit/8d2b4e107d7c21563894ced3a65d631183b58fd9) Thanks [@prowe](https://github.com/prowe)! - Ability to dynamically match mocks + + Adds support for a new property `MockedResponse.variableMatcher`: a predicate function that accepts a `variables` param. If `true`, the `variables` will be passed into the `ResultFunction` to help dynamically build a response. + +#### New `useQueryRefHandlers` hook + +- [#11412](https://github.com/apollographql/apollo-client/pull/11412) [`58db5c3`](https://github.com/apollographql/apollo-client/commit/58db5c3295b88162f91019f0898f6baa4b9cced6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Create a new `useQueryRefHandlers` hook that returns `refetch` and `fetchMore` functions for a given `queryRef`. This is useful to get access to handlers for a `queryRef` that was created by `createQueryPreloader` or when the handlers for a `queryRef` produced by a different component are inaccessible. + + ```jsx + const MyComponent({ queryRef }) { + const { refetch, fetchMore } = useQueryRefHandlers(queryRef); + + // ... + } + ``` + +#### Bail out of `optimisticResponse` updates with the `IGNORE` sentinel object + +- [#11410](https://github.com/apollographql/apollo-client/pull/11410) [`07fcf6a`](https://github.com/apollographql/apollo-client/commit/07fcf6a3bf5bc78ffe6f3e598897246b4da02cbb) Thanks [@sf-twingate](https://github.com/sf-twingate)! - Allow returning `IGNORE` sentinel object from `optimisticResponse` functions to bail-out from the optimistic update. + + Consider this example: + + ```jsx + const UPDATE_COMMENT = gql` + mutation UpdateComment($commentId: ID!, $commentContent: String!) { + updateComment(commentId: $commentId, content: $commentContent) { + id + __typename + content + } + } + `; + + function CommentPageWithData() { + const [mutate] = useMutation(UPDATE_COMMENT); + return ( + + mutate({ + variables: { commentId, commentContent }, + optimisticResponse: (vars, { IGNORE }) => { + if (commentContent === "foo") { + // conditionally bail out of optimistic updates + return IGNORE; + } + return { + updateComment: { + id: commentId, + __typename: "Comment", + content: commentContent, + }, + }; + }, + }) + } + /> + ); + } + ``` + + The `IGNORE` sentinel can be destructured from the second parameter in the callback function signature passed to `optimisticResponse`. + + ```tsx + const preloadQuery = createQueryPreloader(client); + const queryRef = preloadQuery(QUERY, { variables, ...otherOptions }); + + function App() { + return { + Loading}> + + + } + } + + function MyQuery() { + const { data } = useReadQuery(queryRef); + + // do something with data + } + ``` + +#### Network adapters for multipart subscriptions usage with Relay and urql + +- [#11301](https://github.com/apollographql/apollo-client/pull/11301) [`46ab032`](https://github.com/apollographql/apollo-client/commit/46ab032af83a01f184bfcce5edba4b55dbb2962a) Thanks [@alessbell](https://github.com/alessbell)! - Add multipart subscription network adapters for Relay and urql + + ##### Relay + + ```tsx + import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/relay"; + import { Environment, Network, RecordSource, Store } from "relay-runtime"; + + const fetchMultipartSubs = createFetchMultipartSubscription( + "http://localhost:4000", + ); + + const network = Network.create(fetchQuery, fetchMultipartSubs); + + export const RelayEnvironment = new Environment({ + network, + store: new Store(new RecordSource()), + }); + ``` + + ##### Urql + + ```tsx + import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/urql"; + import { Client, fetchExchange, subscriptionExchange } from "@urql/core"; + + const url = "http://localhost:4000"; + + const multipartSubscriptionForwarder = createFetchMultipartSubscription(url); + + const client = new Client({ + url, + exchanges: [ + fetchExchange, + subscriptionExchange({ + forwardSubscription: multipartSubscriptionForwarder, + }), + ], + }); + ``` + +#### `skipPollAttempt` callback function + +- [#11397](https://github.com/apollographql/apollo-client/pull/11397) [`3f7eecb`](https://github.com/apollographql/apollo-client/commit/3f7eecbfbd4f4444cffcaac7dd9fd225c8c2a401) Thanks [@aditya-kumawat](https://github.com/aditya-kumawat)! - Adds a new `skipPollAttempt` callback function that's called whenever a refetch attempt occurs while polling. If the function returns `true`, the refetch is skipped and not reattempted until the next poll interval. This will solve the frequent use-case of disabling polling when the window is inactive. + + ```ts + useQuery(QUERY, { + pollInterval: 1000, + skipPollAttempt: () => document.hidden, // or !document.hasFocus() + }); + // or define it globally + new ApolloClient({ + defaultOptions: { + watchQuery: { + skipPollAttempt: () => document.hidden, // or !document.hasFocus() + }, + }, + }); + ``` + +#### `QueryManager.inFlightLinkObservables` now uses a strong `Trie` as an internal data structure + +- [#11345](https://github.com/apollographql/apollo-client/pull/11345) [`1759066`](https://github.com/apollographql/apollo-client/commit/1759066a8f9a204e49228568aef9446a64890ff3) Thanks [@phryneas](https://github.com/phryneas)! + + ##### Warning: requires `@apollo/experimental-nextjs-app-support` update + + If you are using `@apollo/experimental-nextjs-app-support`, you will need to update that to at least 0.5.2, as it accesses this internal data structure. + +
+

More Minor Changes

+ +- [#11202](https://github.com/apollographql/apollo-client/pull/11202) [`7c2bc08`](https://github.com/apollographql/apollo-client/commit/7c2bc08b2ab46b9aa181d187a27aec2ad7129599) Thanks [@benjamn](https://github.com/benjamn)! - Prevent `QueryInfo#markResult` mutation of `result.data` and return cache data consistently whether complete or incomplete. + +- [#11442](https://github.com/apollographql/apollo-client/pull/11442) [`4b6f2bc`](https://github.com/apollographql/apollo-client/commit/4b6f2bccf3ba94643b38689b32edd2839e47aec1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the need to call `retain` from `useLoadableQuery` since `useReadQuery` will now retain the query. This means that a `queryRef` that is not consumed by `useReadQuery` within the given `autoDisposeTimeoutMs` will now be auto diposed for you. + + Thanks to [#11412](https://github.com/apollographql/apollo-client/pull/11412), disposed query refs will be automatically resubscribed to the query when consumed by `useReadQuery` after it has been disposed. + +- [#11438](https://github.com/apollographql/apollo-client/pull/11438) [`6d46ab9`](https://github.com/apollographql/apollo-client/commit/6d46ab930a5e9bd5cae153d3b75b8966784fcd4e) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the need to call `retain` from `useBackgroundQuery` since `useReadQuery` will now retain the query. This means that a `queryRef` that is not consumed by `useReadQuery` within the given `autoDisposeTimeoutMs` will now be auto diposed for you. + + Thanks to [#11412](https://github.com/apollographql/apollo-client/pull/11412), disposed query refs will be automatically resubscribed to the query when consumed by `useReadQuery` after it has been disposed. + +- [#11175](https://github.com/apollographql/apollo-client/pull/11175) [`d6d1491`](https://github.com/apollographql/apollo-client/commit/d6d14911c40782cd6d69167b6f6169c890091ccb) Thanks [@phryneas](https://github.com/phryneas)! - To work around issues in React Server Components, especially with bundling for + the Next.js "edge" runtime we now use an external package to wrap `react` imports + instead of importing React directly. + +- [#11495](https://github.com/apollographql/apollo-client/pull/11495) [`1190aa5`](https://github.com/apollographql/apollo-client/commit/1190aa59a106217f7192c1f81099adfa5e4365c1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Increase the default memory limits for `executeSelectionSet` and `executeSelectionSetArray`. + +
+ +
+

Patch Changes

+ +- [#11275](https://github.com/apollographql/apollo-client/pull/11275) [`3862f9b`](https://github.com/apollographql/apollo-client/commit/3862f9ba9086394c4cf4c2ecd99e8e0f6cf44885) Thanks [@phryneas](https://github.com/phryneas)! - Add a `defaultContext` option and property on `ApolloClient`, e.g. for keeping track of changing auth tokens or dependency injection. + + This can be used e.g. in authentication scenarios, where a new token might be generated outside of the link chain and should passed into the link chain. + + ```js + import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client"; + import { setContext } from "@apollo/client/link/context"; + + const httpLink = createHttpLink({ + uri: "/graphql", + }); + + const authLink = setContext((_, { headers, token }) => { + return { + headers: { + ...headers, + authorization: token ? `Bearer ${token}` : "", + }, + }; + }); + + const client = new ApolloClient({ + link: authLink.concat(httpLink), + cache: new InMemoryCache(), + }); + + // somewhere else in your application + function onNewToken(newToken) { + // token can now be changed for future requests without need for a global + // variable, scoped ref or recreating the client + client.defaultContext.token = newToken; + } + ``` + +- [#11443](https://github.com/apollographql/apollo-client/pull/11443) [`ff5a332`](https://github.com/apollographql/apollo-client/commit/ff5a332ff8b190c418df25371e36719d70061ebe) Thanks [@phryneas](https://github.com/phryneas)! - Adds a deprecation warning to the HOC and render prop APIs. + + The HOC and render prop APIs have already been deprecated since 2020, + but we previously didn't have a `@deprecated` tag in the DocBlocks. + +- [#11385](https://github.com/apollographql/apollo-client/pull/11385) [`d9ca4f0`](https://github.com/apollographql/apollo-client/commit/d9ca4f0821c66ae4f03cf35a7ac93fe604cc6de3) Thanks [@phryneas](https://github.com/phryneas)! - ensure `defaultContext` is also used for mutations and subscriptions + +- [#11503](https://github.com/apollographql/apollo-client/pull/11503) [`67f62e3`](https://github.com/apollographql/apollo-client/commit/67f62e359bc471787d066319326e5582b4a635c8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Release changes from [`v3.8.10`](https://github.com/apollographql/apollo-client/releases/tag/v3.8.10) + +- [#11078](https://github.com/apollographql/apollo-client/pull/11078) [`14edebe`](https://github.com/apollographql/apollo-client/commit/14edebebefb7634c32b921d02c1c85c6c8737989) Thanks [@phryneas](https://github.com/phryneas)! - ObservableQuery: prevent reporting results of previous queries if the variables changed since + +- [#11439](https://github.com/apollographql/apollo-client/pull/11439) [`33454f0`](https://github.com/apollographql/apollo-client/commit/33454f0a40a05ea2b00633bda20a84d0ec3a4f4d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Address bundling issue introduced in [#11412](https://github.com/apollographql/apollo-client/pull/11412) where the `react/cache` internals ended up duplicated in the bundle. This was due to the fact that we had a `react/hooks` entrypoint that imported these files along with the newly introduced `createQueryPreloader` function, which lived outside of the `react/hooks` folder. + +- [#11371](https://github.com/apollographql/apollo-client/pull/11371) [`ebd8fe2`](https://github.com/apollographql/apollo-client/commit/ebd8fe2c1b8b50bfeb2da20aeca5671300fb5564) Thanks [@phryneas](https://github.com/phryneas)! - Clarify types of `EntityStore.makeCacheKey`. + +
+ +## 3.8.10 + +### Patch Changes + +- [#11489](https://github.com/apollographql/apollo-client/pull/11489) [`abfd02a`](https://github.com/apollographql/apollo-client/commit/abfd02abeb8585e44377e9e87e5d20e5d95be002) Thanks [@gronxb](https://github.com/gronxb)! - Fix `networkStatus` with `useSuspenseQuery` not properly updating to ready state when using a `cache-and-network` fetch policy that returns data equal to what is already in the cache. + +- [#11483](https://github.com/apollographql/apollo-client/pull/11483) [`6394dda`](https://github.com/apollographql/apollo-client/commit/6394dda47fa83d9ddd922e0d05e62bd872e4ea8e) Thanks [@pipopotamasu](https://github.com/pipopotamasu)! - Fix cache override warning output + +## 3.8.9 + +### Patch Changes + +- [#11472](https://github.com/apollographql/apollo-client/pull/11472) [`afc844d`](https://github.com/apollographql/apollo-client/commit/afc844dd8d6f9f7a3e2003f9a5b541291dfe3fb4) Thanks [@alessbell](https://github.com/alessbell)! - Fix delay: Infinity when set on a MockResponse passed to Mocked Provider so it indefinitely enters loading state. + +- [#11464](https://github.com/apollographql/apollo-client/pull/11464) [`aac12b2`](https://github.com/apollographql/apollo-client/commit/aac12b221a6cb776d4941b6c8aadf04f0f0acd27) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent `useFragment` from excessively unsubscribing and resubscribing the fragment with the cache on every render. + +- [#11449](https://github.com/apollographql/apollo-client/pull/11449) [`f40cda4`](https://github.com/apollographql/apollo-client/commit/f40cda45841e93b056c781c19651b54464f7346a) Thanks [@phryneas](https://github.com/phryneas)! - Removes refences to the typescript "dom" lib. + +- [#11470](https://github.com/apollographql/apollo-client/pull/11470) [`e293bc9`](https://github.com/apollographql/apollo-client/commit/e293bc90d6f7937a6fc7c169f7b16eeb39d5fd49) Thanks [@phryneas](https://github.com/phryneas)! - Remove an unnecessary check from parseAndCheckHttpResponse. + +## 3.8.8 + +### Patch Changes + +- [#11200](https://github.com/apollographql/apollo-client/pull/11200) [`ae5091a21`](https://github.com/apollographql/apollo-client/commit/ae5091a21f0feff1486503071ea8dc002cf1be41) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Enable `strict` in tsconfig for the entire project. + +- [#11332](https://github.com/apollographql/apollo-client/pull/11332) [`291aea56b`](https://github.com/apollographql/apollo-client/commit/291aea56bfaed3987a98be7fe4e6160114b62d2d) Thanks [@asvishnyakov](https://github.com/asvishnyakov)! - Add missed reexports of MutationFetchPolicy and RefetchWritePolicy to @apollo/client/core + +- [#10931](https://github.com/apollographql/apollo-client/pull/10931) [`e5acf910e`](https://github.com/apollographql/apollo-client/commit/e5acf910e39752b453540b6751046d1c19b66350) Thanks [@phryneas](https://github.com/phryneas)! - `useMutation`: also reset internal state on reset + +## 3.8.7 + +### Patch Changes + +- [#11297](https://github.com/apollographql/apollo-client/pull/11297) [`c8c76a522`](https://github.com/apollographql/apollo-client/commit/c8c76a522e593de0d06cff73fde2d9e88152bed6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add an explicit return type for the `useReadQuery` hook called `UseReadQueryResult`. Previously the return type of this hook was inferred from the return value. + +- [#11337](https://github.com/apollographql/apollo-client/pull/11337) [`bb1da8349`](https://github.com/apollographql/apollo-client/commit/bb1da8349e785c54fb4030f269602c900adf23a0) Thanks [@phryneas](https://github.com/phryneas)! - #11206 used the TypeScript syntax `infer X extends Y` that was introduced in TS 4.8. + This caused some problems for some users, so we are rolling back to a more backwars-compatible (albeit slightly less performant) type. + +## 3.8.6 + +### Patch Changes + +- [#11291](https://github.com/apollographql/apollo-client/pull/11291) [`2be7eafe3`](https://github.com/apollographql/apollo-client/commit/2be7eafe3c115d56d993dbda64d320550712df1f) Thanks [@ArioA](https://github.com/ArioA)! - Fix a bug that allows to only call `loadErrorMessages` without also calling `loadDevErrorMessages`. + +- [#11274](https://github.com/apollographql/apollo-client/pull/11274) [`b29f000f3`](https://github.com/apollographql/apollo-client/commit/b29f000f36f281e256809b5454eaeca2ec4450bf) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Start the query ref auto dispose timeout after the initial promise has settled. This prevents requests that run longer than the timeout duration from keeping the component suspended indefinitely. + +- [#11289](https://github.com/apollographql/apollo-client/pull/11289) [`b5894dbf0`](https://github.com/apollographql/apollo-client/commit/b5894dbf0fd5ea5ef1ff20dd896a658ef78c69dc) Thanks [@phryneas](https://github.com/phryneas)! - `MockedProvider`: default `connectToDevTools` to `false` in created `ApolloClient` instance. + + This will prevent the mocked `ApolloClient` instance from trying to connect to the DevTools, which would start a `setTimeout` that might keep running after a test has finished. + +- [#11206](https://github.com/apollographql/apollo-client/pull/11206) [`dd2ce7687`](https://github.com/apollographql/apollo-client/commit/dd2ce7687ae9afa399e950a523fc7330284c25fe) Thanks [@phryneas](https://github.com/phryneas)! - `cache.modify`: Less strict types & new dev runtime warnings. + +## 3.8.5 + +### Patch Changes + +- [#11266](https://github.com/apollographql/apollo-client/pull/11266) [`5192cf6e1`](https://github.com/apollographql/apollo-client/commit/5192cf6e1e958080bcae09e5967fa6851bd3a78c) Thanks [@phryneas](https://github.com/phryneas)! - Fixes argument handling for invariant log messages. + +- [#11235](https://github.com/apollographql/apollo-client/pull/11235) [`6cddaaf65`](https://github.com/apollographql/apollo-client/commit/6cddaaf6543f5c0b1fb04ba47480fb393ba10de7) Thanks [@phryneas](https://github.com/phryneas)! - Fix nextFetchPolicy behaviour with transformed documents by keeping `options` reference stable when passing it through QueryManager. + +- [#11252](https://github.com/apollographql/apollo-client/pull/11252) [`327a2abbd`](https://github.com/apollographql/apollo-client/commit/327a2abbd5db87ca27f2ffd1d2f8dccd75868a58) Thanks [@phryneas](https://github.com/phryneas)! - Fixes a race condition in asyncMap that caused issues in React Native when errors were returned in the response payload along with a data property that was null. + +- [#11229](https://github.com/apollographql/apollo-client/pull/11229) [`c372bad4e`](https://github.com/apollographql/apollo-client/commit/c372bad4ebd01a4f2e772cd76e873143bf043fe6) Thanks [@phryneas](https://github.com/phryneas)! - Remove (already throwing) SuspenseCache export that should have been removed in 3.8. + +- [#11267](https://github.com/apollographql/apollo-client/pull/11267) [`bc055e068`](https://github.com/apollographql/apollo-client/commit/bc055e0683e87b9445e321f73857f4a91b20a9ce) Thanks [@phryneas](https://github.com/phryneas)! - Remove some dead code. + +## 3.8.4 + +### Patch Changes + +- [#11195](https://github.com/apollographql/apollo-client/pull/11195) [`9e59b251d`](https://github.com/apollographql/apollo-client/commit/9e59b251d4d63afb83d9821889f87c71c4adde0f) Thanks [@phryneas](https://github.com/phryneas)! - For `invariant.log` etc., error arguments are now serialized correctly in the link to the error page. + +## 3.8.3 + +### Patch Changes + +- [#11193](https://github.com/apollographql/apollo-client/pull/11193) [`fd2a4cf0c`](https://github.com/apollographql/apollo-client/commit/fd2a4cf0c3ada968df3f9814d87dedaaa8eddb5e) Thanks [@phryneas](https://github.com/phryneas)! - Call devtools registration after ApolloClient is fully set up. + +## 3.8.2 + +### Patch Changes + +- [#10072](https://github.com/apollographql/apollo-client/pull/10072) [`51045c336`](https://github.com/apollographql/apollo-client/commit/51045c336ff86befbdd598af6e7104ffe0d419d0) Thanks [@Huulivoide](https://github.com/Huulivoide)! - Fixes race conditions in useReactiveVar that may prevent updates to the reactive variable from propagating through the hook. + +- [#11162](https://github.com/apollographql/apollo-client/pull/11162) [`d9685f53c`](https://github.com/apollographql/apollo-client/commit/d9685f53c34483245e6ea21e91b669ef1180ae97) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensures GraphQL errors returned in subscription payloads adhere to the `errorPolicy` set in `client.subscribe(...)` calls. + +- [#11134](https://github.com/apollographql/apollo-client/pull/11134) [`96492e142`](https://github.com/apollographql/apollo-client/commit/96492e14279d78e2613c1381d31f88cdf5816f45) Thanks [@alessbell](https://github.com/alessbell)! - Use separate type imports in useSuspenseQuery and useBackgroundQuery to workaround SWC compiler issue. + +- [#11117](https://github.com/apollographql/apollo-client/pull/11117) [`6b8198109`](https://github.com/apollographql/apollo-client/commit/6b8198109bd9fe5eedf352421a0a773ac0acfb18) Thanks [@phryneas](https://github.com/phryneas)! - Adds a new devtools registration mechanism and tweaks the mechanism behind the + "devtools not found" mechanic. + +- [#11186](https://github.com/apollographql/apollo-client/pull/11186) [`f1d429f32`](https://github.com/apollographql/apollo-client/commit/f1d429f32ae8e896155b50f1fc7c51dfeb06c3ba) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where race conditions when rapidly switching between variables would sometimes result in the wrong `data` returned from the query. Specifically this occurs when a query is triggered with an initial set of variables (`VariablesA`), then triggers the same query with another set of variables (`VariablesB`) but switches back to the `VariablesA` before the response for `VariablesB` is returned. Previously this would result in the data for `VariablesB` to be displayed while `VariablesA` was active. The data is for `VariablesA` is now properly returned. + +- [#11163](https://github.com/apollographql/apollo-client/pull/11163) [`a8a9e11e9`](https://github.com/apollographql/apollo-client/commit/a8a9e11e917716538206eb7d5de21dbfd09630bd) Thanks [@bignimbus](https://github.com/bignimbus)! - Fix typo in error message: "occured" -> "occurred" + +- [#11180](https://github.com/apollographql/apollo-client/pull/11180) [`7d9c481e5`](https://github.com/apollographql/apollo-client/commit/7d9c481e53f3c9577ec6ed6231c9e3db8c8b374b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixes an issue where refetching from `useBackgroundQuery` via `refetch` with an error after an error was already fetched would get stuck in a loading state. + +## 3.8.1 + +### Patch Changes + +- [#11141](https://github.com/apollographql/apollo-client/pull/11141) [`c469b1616`](https://github.com/apollographql/apollo-client/commit/c469b1616517aac124a3357066cd83439463033c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove newly exported response iterator helpers that caused problems on some installs where `@types/node` was not available. + + **IMPORTANT** + + The following exports were added in version 3.8.0 that are removed with this patch. + + - `isAsyncIterableIterator` + - `isBlob` + - `isNodeReadableStream` + - `isNodeResponse` + - `isReadableStream` + - `isStreamableBlob` + +## 3.8.0 + +### Minor Changes + +#### Fetching with Suspense 🎉 + +- [#10323](https://github.com/apollographql/apollo-client/pull/10323) [`64cb88a4b`](https://github.com/apollographql/apollo-client/commit/64cb88a4b6be8640c4e0d753dd06ddf4c25a2bc3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for React suspense with a new `useSuspenseQuery` hook. + + `useSuspenseQuery` initiates a network request and causes the component calling it to suspend while the request is in flight. It can be thought of as a drop-in replacement for `useQuery` that allows you to take advantage of React's concurrent features while fetching during render. + + Consider a `Dog` component that fetches and renders some information about a dog named Mozzarella: + +
+ View code 🐶 + + ```tsx + import { Suspense } from "react"; + import { gql, TypedDocumentNode, useSuspenseQuery } from "@apollo/client"; + + interface Data { + dog: { + id: string; + name: string; + }; + } + + interface Variables { + name: string; + } + + const GET_DOG_QUERY: TypedDocumentNode = gql` + query GetDog($name: String) { + dog(name: $name) { + id + name + } + } + `; + + function App() { + return ( + Loading...}> + + + ); + } + + function Dog({ name }: { name: string }) { + const { data } = useSuspenseQuery(GET_DOG_QUERY, { + variables: { name }, + }); + + return <>Name: {data.dog.name}; + } + ``` + +
+ + For a detailed explanation of `useSuspenseQuery`, see our [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense). + +- [#10755](https://github.com/apollographql/apollo-client/pull/10755) [`e3c676deb`](https://github.com/apollographql/apollo-client/commit/e3c676deb59d006f33d24a7211e58725a67641b8) Thanks [@alessbell](https://github.com/alessbell)! - Feature: adds `useBackgroundQuery` and `useReadQuery` hooks + + `useBackgroundQuery` initiates a request for data in a parent component and returns a `QueryReference` which is used to read the data in a child component via `useReadQuery`. If the child component attempts to render before the data can be found in the cache, the child component will suspend until the data is available. On cache updates to watched data, the child component calling `useReadQuery` will re-render with new data **but the parent component will not re-render** (as it would, for example, if it were using `useQuery` to issue the request). + + Consider an `App` component that fetches a list of breeds in the background while also fetching and rendering some information about an individual dog, Mozzarella: + +
+ View code 🐶 + + ```tsx + function App() { + const [queryRef] = useBackgroundQuery(GET_BREEDS_QUERY); + return ( + Loading...}> + + + ); + } + + function Dog({ + name, + queryRef, + }: { + name: string; + queryRef: QueryReference; + }) { + const { data } = useSuspenseQuery(GET_DOG_QUERY, { + variables: { name }, + }); + return ( + <> + Name: {data.dog.name} + Loading breeds...}> + + + + ); + } + + function Breeds({ queryRef }: { queryRef: QueryReference }) { + const { data } = useReadQuery(queryRef); + return data.breeds.map(({ characteristics }) => + characteristics.map((characteristic) => ( +
{characteristic}
+ )), + ); + } + ``` + +
+ + For a detailed explanation of `useBackgroundQuery` and `useReadQuery`, see our [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense). + +#### Document transforms 📑 + +- [#10509](https://github.com/apollographql/apollo-client/pull/10509) [`79df2c7ba`](https://github.com/apollographql/apollo-client/commit/79df2c7ba55b7cfee69fd54024174f77099a2550) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to specify custom GraphQL document transforms. These transforms are run before reading data from the cache, before local state is resolved, and before the query document is sent through the link chain. + + To register a custom document transform, create a transform using the `DocumentTransform` class and pass it to the `documentTransform` option on `ApolloClient`. + + ```ts + import { DocumentTransform } from "@apollo/client"; + + const documentTransform = new DocumentTransform((document) => { + // do something with `document` + return transformedDocument; + }); + + const client = new ApolloClient({ documentTransform: documentTransform }); + ``` + + For more information on the behavior and API of `DocumentTransform`, see its [reference page in our documentation](https://www.apollographql.com/docs/react/data/document-transforms). + +#### New `removeTypenameFromVariables` link 🔗 + +- [#10853](https://github.com/apollographql/apollo-client/pull/10853) [`300957960`](https://github.com/apollographql/apollo-client/commit/300957960a584920f2d346d29a0b3aaeb27d9489) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Introduce the new `removeTypenameFromVariables` link. This link will automatically remove `__typename` fields from `variables` for all operations. This link can be configured to exclude JSON-scalars for scalars that utilize `__typename`. + + This change undoes some work from [#10724](https://github.com/apollographql/apollo-client/pull/10724) where `__typename` was automatically stripped for all operations with no configuration. This was determined to be a breaking change and therefore moved into this link. + + For a detailed explanation of `removeTypenameFromVariables`, see its [API reference](https://www.apollographql.com/docs/react/api/link/apollo-link-remove-typename). + +#### New `skipToken` sentinel ⏭️ + +- [#11112](https://github.com/apollographql/apollo-client/pull/11112) [`b4aefcfe9`](https://github.com/apollographql/apollo-client/commit/b4aefcfe97213461b9ce01946344e6a5e6d80704) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adds support for a `skipToken` sentinel that can be used as `options` in `useSuspenseQuery` and `useBackgroundQuery` to skip execution of a query. This works identically to the `skip` option but is more type-safe and as such, becomes the recommended way to skip query execution. As such, the `skip` option has been deprecated in favor of `skipToken`. + + We are considering the removal of the `skip` option from `useSuspenseQuery` and `useBackgroundQuery` in the next major. We are releasing with it now to make migration from `useQuery` easier and make `skipToken` more discoverable. + + **`useSuspenseQuery`** + + ```ts + import { skipToken, useSuspenseQuery } from "@apollo/client"; + + const id: number | undefined; + + const { data } = useSuspenseQuery( + query, + id ? { variables: { id } } : skipToken, + ); + ``` + + **`useBackgroundQuery`** + + ```ts + import { skipToken, useBackgroundQuery } from "@apollo/client"; + + function Parent() { + const [queryRef] = useBackgroundQuery( + query, + id ? { variables: { id } } : skipToken + ); + + return queryRef ? : null; + } + + function Child({ queryRef }: { queryRef: QueryReference }) { + const { data } = useReadQuery(queryRef); + } + ``` + + For a detailed explanation of `skipToken`, see its [API reference](https://www.apollographql.com/docs/react/api/react/hooks/#skiptoken). + +#### New error extraction mechanism, smaller bundles 📉 + +- [#10887](https://github.com/apollographql/apollo-client/pull/10887) [`f8c0b965d`](https://github.com/apollographql/apollo-client/commit/f8c0b965d49fb7d802371bb9cc3cb0b60cf05e5d) Thanks [@phryneas](https://github.com/phryneas)! - Add a new mechanism for Error Extraction to reduce bundle size by including error message texts on an opt-in basis. + + By default, errors will link to an error page with the entire error message. + This replaces "development" and "production" errors and works without + additional bundler configuration. + + Bundling the text of error messages and development warnings can be enabled as follows: + + ```js + import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev"; + if (process.env.NODE_ENV !== "production") { + loadErrorMessages(); + loadDevMessages(); + } + ``` + + For a detailed explanation, see our [reference on reducing bundle size](https://www.apollographql.com/docs/react/development-testing/reducing-bundle-size). + +#### New `@nonreactive` directive 🎬 + +- [#10722](https://github.com/apollographql/apollo-client/pull/10722) [`c7e60f83d`](https://github.com/apollographql/apollo-client/commit/c7e60f83dd1dfe07a1b6ce60d9675d3616a2ce66) Thanks [@benjamn](https://github.com/benjamn)! - Implement a `@nonreactive` directive for selectively skipping reactive comparisons of query result subtrees. + + The `@nonreactive` directive can be used to mark query fields or fragment spreads and is used to indicate that changes to the data contained within the subtrees marked `@nonreactive` should _not_ trigger re-rendering. This allows parent components to fetch data to be rendered by their children without re-rendering themselves when the data corresponding with fields marked as `@nonreactive` change. + + Consider an `App` component that fetches and renders a list of ski trails: + +
+ View code 🎿 + + ```jsx + const TrailFragment = gql` + fragment TrailFragment on Trail { + name + status + } + `; + + const ALL_TRAILS = gql` + query allTrails { + allTrails { + id + ...TrailFragment @nonreactive + } + } + ${TrailFragment} + `; + + function App() { + const { data, loading } = useQuery(ALL_TRAILS); + return ( +
+

Ski Trails

+
    + {data?.trails.map((trail) => ( + + ))} +
+
+ ); + } + ``` + +
+ + The `Trail` component renders a trail's name and status and allows the user to execute a mutation to toggle the status of the trail between `"OPEN"` and `"CLOSED"`: + +
+ View code 🎿 + + ```jsx + const Trail = ({ id }) => { + const [updateTrail] = useMutation(UPDATE_TRAIL); + const { data } = useFragment({ + fragment: TrailFragment, + from: { + __typename: "Trail", + id, + }, + }); + return ( +
  • + {data.name} - {data.status} + { + updateTrail({ + variables: { + trailId: id, + status: e.target.checked ? "OPEN" : "CLOSED", + }, + }); + }} + /> +
  • + ); + }; + ``` + +
    + + Notice that the `Trail` component isn't receiving the entire `trail` object via props, only the `id` which is used along with the fragment document to create a live binding for each trail item in the cache. This allows each `Trail` component to react to the cache updates for a single trail independently. Updates to a trail's `status` will not cause the parent `App` component to rerender since the `@nonreactive` directive is applied to the `TrailFragment` spread, a fragment that includes the `status` field. + + For a detailed explanation, see our [`@nonreactive` reference](https://www.apollographql.com/docs/react/data/directives/#nonreactive) and [@alessbell](https://github.com/alessbell)'s [post on the Apollo blog about using `@nonreactive` with `useFragment`](https://www.apollographql.com/blog/apollo-client/introducing-apollo-clients-nonreactive-directive-and-usefragment-hook/). + +#### Abort the `AbortController` signal more granularly 🛑 + +- [#11040](https://github.com/apollographql/apollo-client/pull/11040) [`125ef5b2a`](https://github.com/apollographql/apollo-client/commit/125ef5b2a8fd2de1515b2bdd71785ebab3596cb2) Thanks [@phryneas](https://github.com/phryneas)! - `HttpLink`/`BatchHttpLink`: Abort the `AbortController` signal more granularly. + + Before this change, when `HttpLink`/`BatchHttpLink` created an `AbortController` internally, the signal would always be `.abort`ed after the request was completed. This could cause issues with Sentry Session Replay and Next.js App Router Cache invalidations, which just replayed the fetch with the same options - including the cancelled `AbortSignal`. + + With this change, the `AbortController` will only be `.abort()`ed by outside events, not as a consequence of the request completing. + +#### `useFragment` drops its experimental label 🎓 + +- [#10916](https://github.com/apollographql/apollo-client/pull/10916) [`ea75e18de`](https://github.com/apollographql/apollo-client/commit/ea75e18dec3db090dd4ed3b2d249bf674b90ead4) Thanks [@alessbell](https://github.com/alessbell)! - Remove experimental labels. + + `useFragment`, introduced in `3.7.0` as `useFragment_experimental`, is no longer an experimental API 🎉 We've removed the `_experimental` suffix from its named export and have made a number of improvements. + + For a detailed explanation, see our [`useFragment` reference](https://www.apollographql.com/docs/react/api/react/hooks#usefragment) and [@alessbell](https://github.com/alessbell)'s [post on the Apollo blog](https://www.apollographql.com/blog/apollo-client/introducing-apollo-clients-nonreactive-directive-and-usefragment-hook/) about using `useFragment` with `@nonreactive` for improved performance when rendering lists. + +
    +
    useFragment improvements
    + + - [#10765](https://github.com/apollographql/apollo-client/pull/10765) [`35f36c5aa`](https://github.com/apollographql/apollo-client/commit/35f36c5aaefe1f215044e09fdf9386042bc59dd2) Thanks [@phryneas](https://github.com/phryneas)! - More robust types for the `data` property on `UseFragmentResult`. When a partial result is given, the type is now correctly set to `Partial`. + + - [#11083](https://github.com/apollographql/apollo-client/pull/11083) [`f766e8305`](https://github.com/apollographql/apollo-client/commit/f766e8305d9f2dbde59a61b8e70c99c4b2b67d55) Thanks [@phryneas](https://github.com/phryneas)! - Adjust the rerender timing of `useQuery` to more closely align with `useFragment`. This means that cache updates delivered to both hooks should trigger renders at relatively the same time. Previously, the `useFragment` might rerender much faster leading to some confusion. + + - [#10836](https://github.com/apollographql/apollo-client/pull/10836) [`6794893c2`](https://github.com/apollographql/apollo-client/commit/6794893c29cc945aa99f6fe54a9e4e70ec3e57fd) Thanks [@phryneas](https://github.com/phryneas)! - Remove the deprecated `returnPartialData` option from `useFragment` hook. + +
    + +
    +

    More Minor Changes

    + +- [#10895](https://github.com/apollographql/apollo-client/pull/10895) [`e187866fd`](https://github.com/apollographql/apollo-client/commit/e187866fdfbbd1e1e30646f289367fb4b5afb3c3) Thanks [@Gelio](https://github.com/Gelio)! - Add generic type parameter for the entity modified in `cache.modify`. Improves TypeScript type inference for that type's fields and values of those fields. + + Example: + + ```ts + cache.modify({ + id: cache.identify(someBook), + fields: { + title: (title) => { + // title has type `string`. + // It used to be `any`. + }, + => { + // author has type `Reference | Book["author"]`. + // It used to be `any`. + }, + }, + }); + ``` + +- [#10895](https://github.com/apollographql/apollo-client/pull/10895) [`e187866fd`](https://github.com/apollographql/apollo-client/commit/e187866fdfbbd1e1e30646f289367fb4b5afb3c3) Thanks [@Gelio](https://github.com/Gelio)! - Use unique opaque types for the `DELETE` and `INVALIDATE` Apollo cache modifiers. + + This increases type safety, since these 2 modifiers no longer have the `any` type. Moreover, it no longer triggers [the `@typescript-eslint/no-unsafe-return` + rule](https://typescript-eslint.io/rules/no-unsafe-return/). + +- [#10340](https://github.com/apollographql/apollo-client/pull/10340) [`4f73c5ca1`](https://github.com/apollographql/apollo-client/commit/4f73c5ca15d367aa23f02018d062f221c4506a4d) Thanks [@alessbell](https://github.com/alessbell)! - Avoid calling `useQuery` `onCompleted` for cache writes + +- [#10527](https://github.com/apollographql/apollo-client/pull/10527) [`0cc7e2e19`](https://github.com/apollographql/apollo-client/commit/0cc7e2e194f84e137a502395f26acdaef392ecae) Thanks [@phryneas](https://github.com/phryneas)! - Remove the `query`/`mutation`/`subscription` option from hooks that already take that value as their first argument. + +- [#10506](https://github.com/apollographql/apollo-client/pull/10506) [`2dc2e1d4f`](https://github.com/apollographql/apollo-client/commit/2dc2e1d4f77318d8a4c29445344b4f8c5b08b7e3) Thanks [@phryneas](https://github.com/phryneas)! - prevent accidental widening of inferred `TData` and `TVariables` generics for query hook option arguments + +- [#10521](https://github.com/apollographql/apollo-client/pull/10521) [`fbf729414`](https://github.com/apollographql/apollo-client/commit/fbf729414b6322a84158d9864bdfb5b17b2c7d77) Thanks [@benjamn](https://github.com/benjamn)! - Simplify `__DEV__` polyfill to use imports instead of global scope + +- [#10994](https://github.com/apollographql/apollo-client/pull/10994) [`2ebbd3abb`](https://github.com/apollographql/apollo-client/commit/2ebbd3abb31224ed383896ebea7c2791c9b42a22) Thanks [@phryneas](https://github.com/phryneas)! - Add .js file extensions to imports in src and dist/\*_/_.d.ts + +- [#11045](https://github.com/apollographql/apollo-client/pull/11045) [`9c1d4a104`](https://github.com/apollographql/apollo-client/commit/9c1d4a104d721993b5b306ca4c21724a974e098d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - When changing variables back to a previously used set of variables, do not automatically cache the result as part of the query reference. Instead, dispose of the query reference so that the `InMemoryCache` can determine the cached behavior. This means that fetch policies that would guarantee a network request are now honored when switching back to previously used variables. + +- [#11058](https://github.com/apollographql/apollo-client/pull/11058) [`89bf33c42`](https://github.com/apollographql/apollo-client/commit/89bf33c425d08880eeaed4584bdd56c4caf085e7) Thanks [@phryneas](https://github.com/phryneas)! - (Batch)HttpLink: Propagate `AbortError`s to the user when a user-provided `signal` is passed to the link. Previously, these links would swallow all `AbortErrors`, potentially causing queries and mutations to never resolve. As a result of this change, users are now expected to handle `AbortError`s when passing in a user-provided `signal`. + +- [#10346](https://github.com/apollographql/apollo-client/pull/10346) [`3bcfc42d3`](https://github.com/apollographql/apollo-client/commit/3bcfc42d394b6a97900495eacdaf58c31ae96d9f) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to allow `@client` fields to be sent to the link chain. + +- [#10567](https://github.com/apollographql/apollo-client/pull/10567) [`c2ce6496c`](https://github.com/apollographql/apollo-client/commit/c2ce6496c10e7ae7e29d25161c2d3cef3e2c6144) Thanks [@benjamn](https://github.com/benjamn)! - Allow `ApolloCache` implementations to specify default value for `assumeImmutableResults` client option, improving performance for applications currently using `InMemoryCache` without configuring `new ApolloClient({ assumeImmutableResults: true })` + +- [#10915](https://github.com/apollographql/apollo-client/pull/10915) [`3a62d8228`](https://github.com/apollographql/apollo-client/commit/3a62d8228ab6c15cdb7cd4ea106d13ba3e6f0029) Thanks [@phryneas](https://github.com/phryneas)! - Changes how development-only code is bundled in the library to more reliably enable consuming bundlers to reduce production bundle sizes while keeping compatibility with non-node environments. + +
    + +
    +

    Patch Changes

    + +- [#11086](https://github.com/apollographql/apollo-client/pull/11086) [`0264fee06`](https://github.com/apollographql/apollo-client/commit/0264fee066cb715602eda26c7c0bb1254469eccb) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a call to `refetch`, `fetchMore`, or changing `skip` to `false` that returned a result deeply equal to data in the cache would get stuck in a pending state and never resolve. + +- [#11053](https://github.com/apollographql/apollo-client/pull/11053) [`c0ca70720`](https://github.com/apollographql/apollo-client/commit/c0ca70720cf5fbedd6e4f128b460c1995d9c55a7) Thanks [@phryneas](https://github.com/phryneas)! - Add `SuspenseCache` as a lazy hidden property on ApolloClient. + This means that `SuspenseCache` is now an implementation details of Apollo Client and you no longer need to manually instantiate it and no longer need to pass it into `ApolloProvider`. Trying to instantiate a `SuspenseCache` instance in your code will now throw an error. + +- [#11115](https://github.com/apollographql/apollo-client/pull/11115) [`78739e3ef`](https://github.com/apollographql/apollo-client/commit/78739e3efe86f6db959dd792d21fa12e0427b12c) Thanks [@phryneas](https://github.com/phryneas)! - Enforce `export type` for all type-level exports. + +- [#11027](https://github.com/apollographql/apollo-client/pull/11027) [`e47cfd04e`](https://github.com/apollographql/apollo-client/commit/e47cfd04ec50cb4c19828f4d655eb0f989cdcf7d) Thanks [@phryneas](https://github.com/phryneas)! - Prevents the DevTool installation warning to be turned into a documentation link. + +- [#10594](https://github.com/apollographql/apollo-client/pull/10594) [`f221b5e8f`](https://github.com/apollographql/apollo-client/commit/f221b5e8fafef3970af2037218c2396ae7db505e) Thanks [@phryneas](https://github.com/phryneas)! - Add a `suspenseCache` option to `useSuspenseQuery` + +- [#10700](https://github.com/apollographql/apollo-client/pull/10700) [`12e37f46f`](https://github.com/apollographql/apollo-client/commit/12e37f46f17f0d5a6d408b89ebafbf7413f309ab) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add a `queryKey` option to `useSuspenseQuery` that allows the hook to create a unique subscription instance. + +- [#10724](https://github.com/apollographql/apollo-client/pull/10724) [`e285dfd00`](https://github.com/apollographql/apollo-client/commit/e285dfd003c7074383732ee23e539d7a0316af10) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Automatically strips `__typename` fields from `variables` sent to the server when using [`HttpLink`](https://www.apollographql.com/docs/react/api/link/apollo-link-http), [`BatchHttpLink`](https://www.apollographql.com/docs/react/api/link/apollo-link-batch-http), or [`GraphQLWsLink`](https://www.apollographql.com/docs/react/api/link/apollo-link-subscriptions). This allows GraphQL data returned from a query to be used as an argument to a subsequent GraphQL operation without the need to strip the `__typename` in user-space. + +- [#10957](https://github.com/apollographql/apollo-client/pull/10957) [`445164d21`](https://github.com/apollographql/apollo-client/commit/445164d2177efe46637a514afa6a88502d3de10f) Thanks [@phryneas](https://github.com/phryneas)! - Use `React.version` as key for shared Contexts. + +- [#10635](https://github.com/apollographql/apollo-client/pull/10635) [`7df51ee19`](https://github.com/apollographql/apollo-client/commit/7df51ee19a49a92f48c0f58f91894d32091cb294) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where cache updates would not propagate to `useSuspenseQuery` while in strict mode. + +- [#11013](https://github.com/apollographql/apollo-client/pull/11013) [`5ed2cfdaf`](https://github.com/apollographql/apollo-client/commit/5ed2cfdaf9030550d4c82200a5a690b112ad3335) Thanks [@alessbell](https://github.com/alessbell)! - Make private fields `inFlightLinkObservables` and `fetchCancelFns` protected in QueryManager in order to make types available in [`@apollo/experimental-nextjs-app-support`](https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support) package when extending the `ApolloClient` class. + +- [#10869](https://github.com/apollographql/apollo-client/pull/10869) [`ba1d06166`](https://github.com/apollographql/apollo-client/commit/ba1d0616618ee040e9bcb20874b03d5783f7eff3) Thanks [@phryneas](https://github.com/phryneas)! - Ensure Context value stability when rerendering ApolloProvider with the same `client` and/or `suspenseCache` prop + +- [#11103](https://github.com/apollographql/apollo-client/pull/11103) [`e3d611daf`](https://github.com/apollographql/apollo-client/commit/e3d611daf7a014e5c92d6bed75d67b9187437eda) Thanks [@caylahamann](https://github.com/caylahamann)! - Fixes a bug in `useMutation` so that `onError` is called when an error is returned from the request with `errorPolicy` set to 'all' . + +- [#10657](https://github.com/apollographql/apollo-client/pull/10657) [`db305a800`](https://github.com/apollographql/apollo-client/commit/db305a8005664e9b6ec64046da230f41d293104d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Return `networkStatus` in the `useSuspenseQuery` result. + +- [#10937](https://github.com/apollographql/apollo-client/pull/10937) [`eea44eb87`](https://github.com/apollographql/apollo-client/commit/eea44eb87f6f296a6f9978d6ba1cf36e899c9131) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Moves `DocumentTransform` to the `utilities` sub-package to avoid a circular dependency between the `core` and `cache` sub-packages. + +- [#10951](https://github.com/apollographql/apollo-client/pull/10951) [`2e833b2ca`](https://github.com/apollographql/apollo-client/commit/2e833b2cacb71fc2050cb3976d0bbe710baeedff) Thanks [@alessbell](https://github.com/alessbell)! - Improve `useBackgroundQuery` type interface + +- [#10651](https://github.com/apollographql/apollo-client/pull/10651) [`8355d0e1e`](https://github.com/apollographql/apollo-client/commit/8355d0e1e9c1cee58cabd7df68d3ba09a3afaf6c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixes an issue where `useSuspenseQuery` would not respond to cache updates when using a cache-first `fetchPolicy` after the hook was mounted with data already in the cache. + +- [#11026](https://github.com/apollographql/apollo-client/pull/11026) [`b8d405eee`](https://github.com/apollographql/apollo-client/commit/b8d405eee2a81df92861be5abd9bd874d7cad111) Thanks [@phryneas](https://github.com/phryneas)! - Store React.Context instance mapped by React.createContext instance, not React.version. + Using `React.version` can cause problems with `preact`, as multiple versions of `preact` will all identify themselves as React `17.0.2`. + +- [#11000](https://github.com/apollographql/apollo-client/pull/11000) [`1d43ab616`](https://github.com/apollographql/apollo-client/commit/1d43ab6169b2b2ebfd8f86366212667f9609f5f5) Thanks [@phryneas](https://github.com/phryneas)! - Use `import * as React` everywhere. This prevents an error when importing `@apollo/client` in a React Server component. (see [#10974](https://github.com/apollographql/apollo-client/issues/10974)) + +- [#10852](https://github.com/apollographql/apollo-client/pull/10852) [`27fbdb3f9`](https://github.com/apollographql/apollo-client/commit/27fbdb3f9003cc304d26987cb38daf10910f2da6) Thanks [@phryneas](https://github.com/phryneas)! - Chore: Add ESLint rule for consistent type imports, apply autofix + +- [#10999](https://github.com/apollographql/apollo-client/pull/10999) [`c1904a78a`](https://github.com/apollographql/apollo-client/commit/c1904a78abb186f475303d632c2cb303bbd8d4f9) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug in `QueryReference` where `this.resolve` or `this.reject` might be executed even if `undefined`. + +- [#10940](https://github.com/apollographql/apollo-client/pull/10940) [`1d38f128f`](https://github.com/apollographql/apollo-client/commit/1d38f128f325ea7092bd04fe3799ebbb6e8bdfdd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for the `skip` option in `useBackgroundQuery` and `useSuspenseQuery`. Setting this option to `true` will avoid a network request. + +- [#10672](https://github.com/apollographql/apollo-client/pull/10672) [`932252b0c`](https://github.com/apollographql/apollo-client/commit/932252b0c54792ec8c5095de1b42c005a91ffe6d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix the compatibility between `useSuspenseQuery` and React's `useDeferredValue` and `startTransition` APIs to allow React to show stale UI while the changes to the variable cause the component to suspend. + + #### Breaking change + + `nextFetchPolicy` support has been removed from `useSuspenseQuery`. If you are using this option, remove it, otherwise it will be ignored. + +- [#10964](https://github.com/apollographql/apollo-client/pull/10964) [`f33171506`](https://github.com/apollographql/apollo-client/commit/f331715066d65291b1f5df5e6fa2b6618dfc70b1) Thanks [@alessbell](https://github.com/alessbell)! - Fixes a bug in `BatchHttpLink` that removed variables from all requests by default. + +- [#10633](https://github.com/apollographql/apollo-client/pull/10633) [`90a06eeeb`](https://github.com/apollographql/apollo-client/commit/90a06eeeb5a50eb172f5c6211693ea051897d8f3) Thanks [@benjamn](https://github.com/benjamn)! - Fix type policy inheritance involving fuzzy `possibleTypes` + +- [#10754](https://github.com/apollographql/apollo-client/pull/10754) [`64b304862`](https://github.com/apollographql/apollo-client/commit/64b3048621de35bbfe9bdf47785a2d5583232830) Thanks [@sincraianul](https://github.com/sincraianul)! - Fix `includeUnusedVariables` option not working with `BatchHttpLink` + +- [#11018](https://github.com/apollographql/apollo-client/pull/11018) [`5618953f3`](https://github.com/apollographql/apollo-client/commit/5618953f332a10c7df1b385126ec714aa5809c48) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `useBackgroundQuery` now uses its own options type called `BackgroundQueryHookOptions` rather than reusing `SuspenseQueryHookOptions`. + +- [#11035](https://github.com/apollographql/apollo-client/pull/11035) [`a3ab7456d`](https://github.com/apollographql/apollo-client/commit/a3ab7456d59be4a7beb58d0aff6d431c603448f5) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Incrementally re-render deferred queries after calling `refetch` or setting `skip` to `false` to match the behavior of the initial fetch. Previously, the hook would not re-render until the entire result had finished loading in these cases. + +- [#10399](https://github.com/apollographql/apollo-client/pull/10399) [`652a1ae08`](https://github.com/apollographql/apollo-client/commit/652a1ae0868e4a5b75b9ff656d26f57eeca1081a) Thanks [@alessbell](https://github.com/alessbell)! - Silence useLayoutEffect warning when useSuspenseQuery runs on server + +- [#10919](https://github.com/apollographql/apollo-client/pull/10919) [`f796ce1ac`](https://github.com/apollographql/apollo-client/commit/f796ce1ac72f31a951a1d0f0b78d19dd039a6398) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue when using a link that relied on `operation.getContext` and `operation.setContext` would error out when it was declared after the `removeTypenameFromVariables` link. + +- [#10968](https://github.com/apollographql/apollo-client/pull/10968) [`b102390b2`](https://github.com/apollographql/apollo-client/commit/b102390b238e5ce083062541d98a00fc3a10e1e1) Thanks [@phryneas](https://github.com/phryneas)! - Use printed query for query deduplication. Cache `print` calls for GraphQL documents to speed up repeated operations. + +- [#11071](https://github.com/apollographql/apollo-client/pull/11071) [`4473e925a`](https://github.com/apollographql/apollo-client/commit/4473e925ac5d6a53dc2b34867f034eda1b05aa00) Thanks [@jerelmiller](https://github.com/jerelmiller)! - [#10509](https://github.com/apollographql/apollo-client/pull/10509) introduced some helpers for determining the type of operation for a GraphQL query. This imported the `OperationTypeNode` from graphql-js which is not available in GraphQL 14. To maintain compatibility with graphql-js v14, this has been reverted to use plain strings. + +- [#10766](https://github.com/apollographql/apollo-client/pull/10766) [`ffb179e55`](https://github.com/apollographql/apollo-client/commit/ffb179e5553fa6f9156ae0aaf782dfcbec7d08c7) Thanks [@jerelmiller](https://github.com/jerelmiller)! - More robust typings for the `data` property returned from `useSuspenseQuery` when using `returnPartialData: true` or an `errorPolicy` of `all` or `ignore`. `TData` now defaults to `unknown` instead of `any`. + +- [#10401](https://github.com/apollographql/apollo-client/pull/10401) [`3e5b41a75`](https://github.com/apollographql/apollo-client/commit/3e5b41a751673bb2120c0b624e22afd3b7b860e5) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Always throw network errors in `useSuspenseQuery` regardless of the set `errorPolicy`. + +- [#10877](https://github.com/apollographql/apollo-client/pull/10877) [`f40248598`](https://github.com/apollographql/apollo-client/commit/f402485985cc2551b51602c0bff213b7ffb856b9) Thanks [@phryneas](https://github.com/phryneas)! - Change an import in `useQuery` and `useMutation` that added an unnecessary runtime dependency on `@apollo/client/core`. This drastically reduces the bundle size of each the hooks. + +- [#10656](https://github.com/apollographql/apollo-client/pull/10656) [`54c4d2f3c`](https://github.com/apollographql/apollo-client/commit/54c4d2f3c719654e38e537ec38f1cb415c7c3f58) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure `refetch`, `fetchMore`, and `subscribeToMore` functions returned by `useSuspenseQuery` are referentially stable between renders, even as `data` is updated. + +- [#10324](https://github.com/apollographql/apollo-client/pull/10324) [`95eb228be`](https://github.com/apollographql/apollo-client/commit/95eb228bedc193a520604e351d1c455bfbedef06) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add `@defer` support to `useSuspenseQuery`. + +- [#10888](https://github.com/apollographql/apollo-client/pull/10888) [`1562a2f5a`](https://github.com/apollographql/apollo-client/commit/1562a2f5a91cf577d9c89c4e84088a6bccc73c28) Thanks [@alessbell](https://github.com/alessbell)! - Updates dependency versions in `package.json` by bumping: + + - `@wry/context` to `^0.7.3` + - `@wry/equality` to `^0.5.6` + - `@wry/trie` to `^0.4.3` + - `optimism` to `^0.17.4` + + to 1. [fix sourcemap warnings](https://github.com/benjamn/wryware/pull/497) and 2. a Codesandbox [sandpack (in-browser) bundler transpilation bug](https://github.com/codesandbox/sandpack/issues/940) with an [upstream optimism workaround](https://github.com/benjamn/optimism/pull/550). + +- [#11010](https://github.com/apollographql/apollo-client/pull/11010) [`1051a9c88`](https://github.com/apollographql/apollo-client/commit/1051a9c888ba86511b7fcb80a26d3b3050359258) Thanks [@alessbell](https://github.com/alessbell)! - Hide queryRef in a Symbol in `useBackgroundQuery`s return value. + +- [#10758](https://github.com/apollographql/apollo-client/pull/10758) [`9def7421f`](https://github.com/apollographql/apollo-client/commit/9def7421f3d028c91fcaa7971878b3da8281424d) Thanks [@phryneas](https://github.com/phryneas)! - use `React.use` where available + +- [#11032](https://github.com/apollographql/apollo-client/pull/11032) [`6a4da900a`](https://github.com/apollographql/apollo-client/commit/6a4da900a1bc5da3524caabd64bb30945e66f675) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Throw errors in `useSuspenseQuery` for errors returned in incremental chunks when `errorPolicy` is `none`. This provides a more consistent behavior of the `errorPolicy` in the hook. + + #### Potentially breaking change + + Previously, if you issued a query with `@defer` and relied on `errorPolicy: 'none'` to set the `error` property returned from `useSuspenseQuery` when the error was returned in an incremental chunk, this error is now thrown. Switch the `errorPolicy` to `all` to avoid throwing the error and instead return it in the `error` property. + +- [#10960](https://github.com/apollographql/apollo-client/pull/10960) [`ee407ef97`](https://github.com/apollographql/apollo-client/commit/ee407ef97317bf29c554732237aaf11552e06b01) Thanks [@alessbell](https://github.com/alessbell)! - Adds support for `returnPartialData` and `refetchWritePolicy` options in `useBackgroundQuery` hook. + +- [#10809](https://github.com/apollographql/apollo-client/pull/10809) [`49d28f764`](https://github.com/apollographql/apollo-client/commit/49d28f764980d132089ef8f6beca6e766b6120c0) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixed the ability to use `refetch` and `fetchMore` with React's `startTransition`. The hook will now behave correctly by allowing React to avoid showing the Suspense fallback when these functions are wrapped by `startTransition`. This change deprecates the `suspensePolicy` option in favor of `startTransition`. + +- [#11082](https://github.com/apollographql/apollo-client/pull/11082) [`0f1cde3a2`](https://github.com/apollographql/apollo-client/commit/0f1cde3a207699edb742dfaada817a815488d594) Thanks [@phryneas](https://github.com/phryneas)! - Restore Apollo Client 3.7 `getApolloContext` behaviour + +- [#10969](https://github.com/apollographql/apollo-client/pull/10969) [`525a9317a`](https://github.com/apollographql/apollo-client/commit/525a9317af729309f699fd6f8b787647a5f63eac) Thanks [@phryneas](https://github.com/phryneas)! - Slightly decrease bundle size and memory footprint of `SuspenseCache` by changing how cache entries are stored internally. + +- [#11025](https://github.com/apollographql/apollo-client/pull/11025) [`6092b6edf`](https://github.com/apollographql/apollo-client/commit/6092b6edf67ef311954c18c778ed0bdca1b77258) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `useSuspenseQuery` and `useBackgroundQuery` will now properly apply changes to its options between renders. + +- [#10872](https://github.com/apollographql/apollo-client/pull/10872) [`96b4f8837`](https://github.com/apollographql/apollo-client/commit/96b4f8837881db67e951272b775dc62282e50d49) Thanks [@phryneas](https://github.com/phryneas)! - The "per-React-Version-Singleton" ApolloContext is now stored on `globalThis`, not `React.createContext`, and throws an error message when accessed from React Server Components. + +- [#10450](https://github.com/apollographql/apollo-client/pull/10450) [`f8bc33387`](https://github.com/apollographql/apollo-client/commit/f8bc33387f66e28456aede53bae75694c9a7a45f) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for the `subscribeToMore` and `client` fields returned in the `useSuspenseQuery` result. + +
    + +## 3.7.17 + +### Patch Changes + +- [#10631](https://github.com/apollographql/apollo-client/pull/10631) [`b93388d75`](https://github.com/apollographql/apollo-client/commit/b93388d7582d88859c4975dff524c1ceb5bd2b4e) Thanks [@phryneas](https://github.com/phryneas)! - ObservableQuery.getCurrentResult: skip the cache if the running query should not access the cache + +## 3.7.16 + +### Patch Changes + +- [#10806](https://github.com/apollographql/apollo-client/pull/10806) [`cb1540504`](https://github.com/apollographql/apollo-client/commit/cb15405041e0bd644fcf23d1b8fcaa09762c5a6a) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug in `PersistedQueryLink` that would cause it to permanently skip persisted queries after a 400 or 500 status code. + +- [#10807](https://github.com/apollographql/apollo-client/pull/10807) [`b32369592`](https://github.com/apollographql/apollo-client/commit/b3236959269ce27b18b8c2cae72106098a3ba1b8) Thanks [@phryneas](https://github.com/phryneas)! - `PersistedQueryLink` will now also check for error codes in `extensions`. + +- [#10982](https://github.com/apollographql/apollo-client/pull/10982) [`b9be7a814`](https://github.com/apollographql/apollo-client/commit/b9be7a814a64fc6b3e6ce23dd97a4f0c7140aba7) Thanks [@sdeleur-sc](https://github.com/sdeleur-sc)! - Update `relayStylePagination` to avoid populating `startCursor` when only a single cursor is present under the `edges` field. Use that cursor only as the `endCursor`. + +- [#10962](https://github.com/apollographql/apollo-client/pull/10962) [`772cfa3cb`](https://github.com/apollographql/apollo-client/commit/772cfa3cb563dccee878177e58c8250c4e5b5013) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove `useGETForQueries` option in `BatchHttpLink.Options` type since it is not supported. + +## 3.7.15 + +### Patch Changes + +- [#10891](https://github.com/apollographql/apollo-client/pull/10891) [`ab42a5c08`](https://github.com/apollographql/apollo-client/commit/ab42a5c08840193cb915f4e66d71fac3834fec68) Thanks [@laverdet](https://github.com/laverdet)! - Fixes a bug in how multipart responses are read when using `@defer`. When reading a multipart body, `HttpLink` no longer attempts to parse the boundary (e.g. `"---"` or other boundary string) within the response data itself, only when reading the beginning of each mulitpart chunked message. + +- [#10789](https://github.com/apollographql/apollo-client/pull/10789) [`23a4e1578`](https://github.com/apollographql/apollo-client/commit/23a4e15786fe99658d741585366f3b02bcffb97f) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where other fields could be aliased to `__typename` or `id`, in which case an incoming result would be merged into the wrong cache entry. + +## 3.7.14 + +### Patch Changes + +- [#10764](https://github.com/apollographql/apollo-client/pull/10764) [`1b0a61fe5`](https://github.com/apollographql/apollo-client/commit/1b0a61fe5a6593f319da26fec8692359232ccf9b) Thanks [@phryneas](https://github.com/phryneas)! - Deprecate `useFragment` `returnPartialData` option + +- [#10810](https://github.com/apollographql/apollo-client/pull/10810) [`a6252774f`](https://github.com/apollographql/apollo-client/commit/a6252774f43fd9a4be9c50b48b7a6d5a1c8e64ec) Thanks [@dleavitt](https://github.com/dleavitt)! - Fix type signature of `ServerError`. + + In <3.7 `HttpLink` and `BatchHttpLink` would return a `ServerError.message` of e.g. `"Unexpected token 'E', \"Error! Foo bar\" is not valid JSON"` and a `ServerError.result` of `undefined` in the case where a server returned a >= 300 response code with a response body containing a string that could not be parsed as JSON. + + In >=3.7, `message` became e.g. `Response not successful: Received status code 302` and `result` became the string from the response body, however the type in `ServerError.result` was not updated to include the `string` type, which is now properly reflected. + +## 3.7.13 + +### Patch Changes + +- [#10805](https://github.com/apollographql/apollo-client/pull/10805) [`a5503666c`](https://github.com/apollographql/apollo-client/commit/a5503666c2cc8220ac1d877e3296556e54e58ff6) Thanks [@phryneas](https://github.com/phryneas)! - Fix a potential memory leak in SSR scenarios when many `persistedQuery` instances were created over time. + +- [#10718](https://github.com/apollographql/apollo-client/pull/10718) [`577c68bdd`](https://github.com/apollographql/apollo-client/commit/577c68bdd26519f8341fd1188ea4b8aabe357856) Thanks [@Hsifnus](https://github.com/Hsifnus)! - Delay Concast subscription teardown slightly in `useSubscription` to prevent unexpected Concast teardown when one `useSubscription` hook tears down its in-flight Concast subscription immediately followed by another `useSubscription` hook reusing and subscribing to that same Concast + +## 3.7.12 + +### Patch Changes + +- [#10735](https://github.com/apollographql/apollo-client/pull/10735) [`895bcdcff`](https://github.com/apollographql/apollo-client/commit/895bcdcff146bc4575c8f3423c30fa9e885be16b) Thanks [@alessbell](https://github.com/alessbell)! - If a multipart chunk contains only `hasNext: false`, immediately complete the observable. + +## 3.7.11 + +### Patch Changes + +- [#10586](https://github.com/apollographql/apollo-client/pull/10586) [`4175af594`](https://github.com/apollographql/apollo-client/commit/4175af59419dbb698c32c074f44229f3a5b3b83d) Thanks [@alessbell](https://github.com/alessbell)! - Improve WebSocket error handling for generic `Event` received on error. For more information see [https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event). + +- [#10411](https://github.com/apollographql/apollo-client/pull/10411) [`152baac34`](https://github.com/apollographql/apollo-client/commit/152baac343b8b68c7a2d4691d5dc60d9e43e62bb) Thanks [@lovasoa](https://github.com/lovasoa)! - Simplify error message generation and make 'undefined' an impossible message string. + +- [#10592](https://github.com/apollographql/apollo-client/pull/10592) [`cdb98ae08`](https://github.com/apollographql/apollo-client/commit/cdb98ae082ae4c7da6cd6a0fd5ad8457810fceda) Thanks [@alessbell](https://github.com/alessbell)! - Adds support for multipart subscriptions in `HttpLink`. + +- [#10698](https://github.com/apollographql/apollo-client/pull/10698) [`38508a251`](https://github.com/apollographql/apollo-client/commit/38508a251423057fd8a0df50230f50e0a5dde5fd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Changes the behavior of `useLazyQuery` introduced in [#10427](https://github.com/apollographql/apollo-client/pull/10427) where unmounting a component before a query was resolved would reject the promise with an abort error. Instead, the promise will now resolve naturally with the result from the request. + + Other notable fixes: + + - Kicking off multiple requests in parallel with the execution function will now ensure each returned promise is resolved with the data from its request. Previously, each promise was resolved with data from the last execution. + - Re-rendering `useLazyQuery` with a different query document will now ensure the execution function uses the updated query document. Previously, only the query document rendered the first time would be used for the request. + +- [#10660](https://github.com/apollographql/apollo-client/pull/10660) [`364bee98f`](https://github.com/apollographql/apollo-client/commit/364bee98fe193a7915664c1a5b206fd52793f85a) Thanks [@alessbell](https://github.com/alessbell)! - Upgrades TypeScript to v5. This change is fully backward-compatible and transparent to users. + +- [#10597](https://github.com/apollographql/apollo-client/pull/10597) [`8fb9d190d`](https://github.com/apollographql/apollo-client/commit/8fb9d190dbf48147412517643e3e425a7d48c49c) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where an incoming cache update could prevent future updates from the active link. + +- [#10629](https://github.com/apollographql/apollo-client/pull/10629) [`02605bb3c`](https://github.com/apollographql/apollo-client/commit/02605bb3c9e148bf87a6e52b4a9ecc7d523ef9f6) Thanks [@phryneas](https://github.com/phryneas)! - `useQuery`: delay unsubscribe to fix race conditions + +## 3.7.10 + +### Patch Changes + +- [#9438](https://github.com/apollographql/apollo-client/pull/9438) [`52a9c8ea1`](https://github.com/apollographql/apollo-client/commit/52a9c8ea1ac08ee53fe1ddbd4ded899ea00a1f9f) Thanks [@dciesielkiewicz](https://github.com/dciesielkiewicz)! - Ensure the `client` option passed to `useMutation`'s execute function is used when provided. Previously this option was ignored. + +- [#9124](https://github.com/apollographql/apollo-client/pull/9124) [`975b923c0`](https://github.com/apollographql/apollo-client/commit/975b923c0c0e7ddc8553917a91981e9f41713bc1) Thanks [@andrebrantom](https://github.com/andrebrantom)! - Make `ApolloClient.writeQuery` and `ApolloClient.writeFragment` behave more like `cache.writeQuery` and `cache.writeFragment` by returning the reference returned by the cache. + +## 3.7.9 + +### Patch Changes + +- [#10560](https://github.com/apollographql/apollo-client/pull/10560) [`a561ecf43`](https://github.com/apollographql/apollo-client/commit/a561ecf4306c56770ba0713f0136174275887f1a) Thanks [@benjamn](https://github.com/benjamn)! - Keep `__typename` fragment when it does not contain `@client` directive and strip out inline fragments which use a `@client` directive. Thanks @Gazler and @mtsmfm! + +- [#10560](https://github.com/apollographql/apollo-client/pull/10560) [`251a12806`](https://github.com/apollographql/apollo-client/commit/251a12806d1fa38bc8723540fb2d696c39db1097) Thanks [@benjamn](https://github.com/benjamn)! - Refactor `removeDirectivesFromDocument` to fix AST ordering sensitivities and avoid 1/3 AST traversals, potentially improving performance for large queries + +## 3.7.8 + +### Patch Changes + +- [#7555](https://github.com/apollographql/apollo-client/pull/7555) [`45562d6fa`](https://github.com/apollographql/apollo-client/commit/45562d6fa20eab658bd86d79d092862ace4e1225) Thanks [@TheCeloReis](https://github.com/TheCeloReis)! - Adds `TVariables` generic to `GraphQLRequest` and `MockedResponse` interfaces. + +- [#10526](https://github.com/apollographql/apollo-client/pull/10526) [`1d13de4f1`](https://github.com/apollographql/apollo-client/commit/1d13de4f190150e96d61a9e987274ee6c249dbef) Thanks [@benjamn](https://github.com/benjamn)! - Tolerate undefined `concast.sources` if `complete` called earlier than `concast.start` + +- [#10497](https://github.com/apollographql/apollo-client/pull/10497) [`8a883d8a1`](https://github.com/apollographql/apollo-client/commit/8a883d8a1c8899f94a3e2ae09cb2069bde2b2150) Thanks [@nevir](https://github.com/nevir)! - Update `SingleExecutionResult` and `IncrementalPayload`'s `data` types such that they no longer include `undefined`, which was not a valid runtime value, to fix errors when TypeScript's `exactOptionalPropertyTypes` is enabled. + +## 3.7.7 + +### Patch Changes + +- [#10502](https://github.com/apollographql/apollo-client/pull/10502) [`315faf9ca`](https://github.com/apollographql/apollo-client/commit/315faf9ca5b326852919ab7fc2082d6ba92bcb59) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Log a warning to the console when a mock passed to `MockedProvider` or `MockLink` cannot be matched to a query during a test. This makes it easier to debug user errors in the mock setup, such as typos, especially if the query under test is using an `errorPolicy` set to `ignore`, which makes it difficult to know that a match did not occur. + +- [#10499](https://github.com/apollographql/apollo-client/pull/10499) [`9e54f5dfa`](https://github.com/apollographql/apollo-client/commit/9e54f5dfa05fd363e534c432ba8c569bb96a6e35) Thanks [@phryneas](https://github.com/phryneas)! - Allow the execution function returned by `useLazyQuery` to change the query. + +- [#10362](https://github.com/apollographql/apollo-client/pull/10362) [`14a56b105`](https://github.com/apollographql/apollo-client/commit/14a56b105fefcbb2ce5daa9fd6924e5decafcc16) Thanks [@mccraveiro](https://github.com/mccraveiro)! - Fix error when server returns an error and we are also querying for a local field + +## 3.7.6 + +### Patch Changes + +- [#10470](https://github.com/apollographql/apollo-client/pull/10470) [`47435e879`](https://github.com/apollographql/apollo-client/commit/47435e879ebc867d9fc3de5b6fd5785204b4dbd4) Thanks [@alessbell](https://github.com/alessbell)! - Bumps TypeScript to `4.9.4` (previously `4.7.4`) and updates types to account for changes in TypeScript 4.8 by [propagating contstraints on generic types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#unconstrained-generics-no-longer-assignable-to). Technically this makes some types stricter as attempting to pass `null|undefined` into certain functions is now disallowed by TypeScript, but these were never expected runtime values in the first place. + This should only affect you if you are wrapping functions provided by Apollo Client with your own abstractions that pass in their generics as type arguments, in which case you might get an error like `error TS2344: Type 'YourGenericType' does not satisfy the constraint 'OperationVariables'`. In that case, make sure that `YourGenericType` is restricted to a type that only accepts objects via `extends`, like `Record` or `@apollo/client`'s `OperationVariables`: + + ```diff + import { + QueryHookOptions, + QueryResult, + useQuery, + + OperationVariables, + } from '@apollo/client'; + - export function useWrappedQuery( + + export function useWrappedQuery( + query: DocumentNode, + queryOptions: QueryHookOptions + ): QueryResult { + const [execute, result] = useQuery(query); + } + ``` + +- [#10408](https://github.com/apollographql/apollo-client/pull/10408) [`55ffafc58`](https://github.com/apollographql/apollo-client/commit/55ffafc585e9eb66314755b4f40804b8b8affb13) Thanks [@zlrlo](https://github.com/zlrlo)! - fix: modify BatchHttpLink to have a separate timer for each different batch key + +- [#9573](https://github.com/apollographql/apollo-client/pull/9573) [`4a4f48dda`](https://github.com/apollographql/apollo-client/commit/4a4f48dda8dd290ef110aed9e4e73d0c1c977c31) Thanks [@vladar](https://github.com/vladar)! - Improve performance of local resolvers by only executing selection sets that contain an `@client` directive. Previously, local resolvers were executed even when the field did not contain `@client`. While the result was properly discarded, the unncessary work could negatively affect query performance, sometimes signficantly. + +## 3.7.5 + +### Patch Changes + +- [#10458](https://github.com/apollographql/apollo-client/pull/10458) [`b5ccef229`](https://github.com/apollographql/apollo-client/commit/b5ccef229046d230e82a68a4834ac09ae1ef2009) Thanks [@lennyburdette](https://github.com/lennyburdette)! - Passes `getServerSnapshot` to `useSyncExternalStore` so that it doesn't trigger a `Missing getServerSnapshot` error when using `useFragment_experimental` on the server. + +- [#10471](https://github.com/apollographql/apollo-client/pull/10471) [`895ddcb54`](https://github.com/apollographql/apollo-client/commit/895ddcb546b5692cd53caae1b604412728641374) Thanks [@alessbell](https://github.com/alessbell)! - More robust type definition for `headers` property passed to `createHttpLink` + +- [#10321](https://github.com/apollographql/apollo-client/pull/10321) [`bbaa3ef2d`](https://github.com/apollographql/apollo-client/commit/bbaa3ef2d95a03e2453ef86a25096c314fbd8998) Thanks [@alessbell](https://github.com/alessbell)! - Refetch should not return partial data with `errorPolicy: none` and `notifyOnNetworkStatusChange: true`. + +- [#10402](https://github.com/apollographql/apollo-client/pull/10402) [`0b07aa955`](https://github.com/apollographql/apollo-client/commit/0b07aa955bab2e929f21590b565507a66f930539) Thanks [@Hugodby](https://github.com/Hugodby)! - Improve context types + +- [#10469](https://github.com/apollographql/apollo-client/pull/10469) [`328c58f90`](https://github.com/apollographql/apollo-client/commit/328c58f90d3fd985a58a68d8ba07f7c03f9808f6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add generic type defaults when using `useFragment` to allow passing `TData` directly to the function without needing to specify `TVars`. + +## 3.7.4 + +### Patch Changes + +- [#10427](https://github.com/apollographql/apollo-client/pull/10427) [`28d909cff`](https://github.com/apollographql/apollo-client/commit/28d909cff086f8352e2ea75421a1cac590917573) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure in-flight promises executed by `useLazyQuery` are rejected when `useLazyQuery` unmounts. + +- [#10383](https://github.com/apollographql/apollo-client/pull/10383) [`5c5ca9b01`](https://github.com/apollographql/apollo-client/commit/5c5ca9b01a2b9905f94de85e5b80ffc29522e2e3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure the `onError` callback is called when the `errorPolicy` is set to "all" and partial data is returned. + +- [#10425](https://github.com/apollographql/apollo-client/pull/10425) [`86e35a6d2`](https://github.com/apollographql/apollo-client/commit/86e35a6d25e9838f39a9de652e52a358b9c08488) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prefer the `onError` and `onCompleted` callback functions passed to the execute function returned from `useMutation` instead of calling both callback handlers. + +## 3.7.3 + +### Patch Changes + +- [#10334](https://github.com/apollographql/apollo-client/pull/10334) [`7d923939d`](https://github.com/apollographql/apollo-client/commit/7d923939dd7e6db7d69f04f598c666104b076e78) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Better handle deferred queries that have cached or partial cached data for them + +- [#10368](https://github.com/apollographql/apollo-client/pull/10368) [`46b58e976`](https://github.com/apollographql/apollo-client/commit/46b58e9762abbffaee5c9abda8e309bea6d7a785) Thanks [@alessbell](https://github.com/alessbell)! - Fix: unblocks support for defer in mutations + + If the `@defer` directive is present in the document passed to `mutate`, the Promise will resolve with the final merged data after the last multipart chunk has arrived in the response. + +## 3.7.2 + +### Patch Changes + +- Only show dev tools suggestion in the console when `connectToDevTools` is `true`.
    + [@chris110408](https://github.com/chris110408) in [#10258](https://github.com/apollographql/apollo-client/pull/10258) + +- Pass `TCache` generic to `MutationHookOptions` for better type support in `useMutation`.
    + [@igrlk](https://github.com/igrlk) in [#10223](https://github.com/apollographql/apollo-client/pull/10223) + +- Add `name` property to `ApolloError` to ensure better type safety and help error reporting tools better identify the error.
    + [@aaronadamsCA](https://github.com/aaronadamsCA) in [#9323](https://github.com/apollographql/apollo-client/pull/9323) + +- Export a `ModifierDetails` type for the `details` parameter of a `Modifier` function.
    + [@KeithGillette](https://github.com/KeithGillette) in [#7133](https://github.com/apollographql/apollo-client/pull/7133) + +- Revert use of `cloneDeep` to clone options when fetching queries.
    + [@MrDoomBringer](https://github.com/MrDoomBringer) in [#10215](https://github.com/apollographql/apollo-client/pull/10215) + +## 3.7.1 + +### Patch Changes + +- Fix issue where `loading` remains `true` after `observer.refetch` is called repeatedly with different variables when the same data are returned.
    + [@alessbell](https://github.com/alessbell) in [#10143](https://github.com/apollographql/apollo-client/pull/10143) + +- Fix race condition where `useFragment_experimental` could receive cache updates before initially calling `cache.watch` in `useEffect`.
    + [@benjamn](https://github.com/benjamn) in [#10212](https://github.com/apollographql/apollo-client/pull/10212) + +## 3.7.0 + +### Minor Changes + +- Implement preview support for the [`@defer` directive](https://github.com/graphql/graphql-spec/pull/742).
    + [@alessbell](https://github.com/alessbell) and [@benjamn](https://github.com/benjamn) in [#10018](https://github.com/apollographql/apollo-client/pull/10018) + +- Implement `useFragment_experimental` hook, which represents a lightweight live binding into the `ApolloCache`, and never triggers network requests of its own.
    + [@benjamn](https://github.com/benjamn) in [#8782](https://github.com/apollographql/apollo-client/pull/8782) + +- Allow registering named fragments with `InMemoryCache` to support using `...NamedFragment` in queries without redeclaring `NamedFragment` repeatedly in every query that uses it.
    + [@benjamn](https://github.com/benjamn) in [#9764](https://github.com/apollographql/apollo-client/pull/9764) + +- Support `onError` callback for `useSubscription` hook.
    + [@jeroenvisser101](https://github.com/jeroenvisser101) in [#9495](https://github.com/apollographql/apollo-client/pull/9495) + +- Implement `preserveHeaderCase` option for `http` context object, enabling preserved header capitalization for non-http-spec-compliant servers.
    + [@mrdoombringer](https://github.com/mrdoombringer) in [#9891](https://github.com/apollographql/apollo-client/pull/9891) + +### Patch Changes + +- Delay calling `onCompleted` and `onError` callbacks passed to `useQuery` using `Promise.resolve().then(() => ...)` to fix issue [#9794](https://github.com/apollographql/apollo-client/pull/9794).
    + [@dylanwulf](https://github.com/dylanwulf) in [#9823](https://github.com/apollographql/apollo-client/pull/9823) + +- Replace `concast.cleanup` method with simpler `concast.beforeNext` API, which promises to call the given callback function just before the next result/error is delivered. In addition, `concast.removeObserver` no longer takes a `quietly?: boolean` parameter, since that parameter was partly responsible for cleanup callbacks sometimes not getting called.
    + [@benjamn](https://github.com/benjamn) in [#9718](https://github.com/apollographql/apollo-client/pull/9718) + +- Allow preserving header name capitalization when creating an `HttpLink` with `createHttpLink({ uri, preserveHeaderCase: true })`. Otherwise, header names are converted to lowercase to prevent case-sensitivity bugs.
    + [@MrDoomBringer](https://github.com/MrDoomBringer) in [#9891](https://github.com/apollographql/apollo-client/pull/9891) + +- Make queries with a `pollInterval` respect the `no-cache` fetch policy, instead of writing polled results into the cache.
    + [@MrDoomBringer](https://github.com/MrDoomBringer) in [#10020](https://github.com/apollographql/apollo-client/pull/10020) + +- Deprecate the `onSubscriptionData` callback in favor of a new `onData` callback for the `useSubscription` hook. Deprecate the `onSubscriptionComplete` callback in favor of a new `onComplete` callback for the `useSubscription` hook.
    + [@jerelmiller](https://github.com/jerelmiller) in [#10134](https://github.com/apollographql/apollo-client/pull/10134) + +### Potentially disruptive + +- The optional `subscribeAndCount` testing utility exported from `@apollo/client/testing/core` now takes a single generic `TResult` type parameter, instead of `TData`. This type will typically be inferred from the `observable` argument type, but if you have any explicit calls to `subscribeAndCount(...)` in your own codebase, you may need to adjust those calls accordingly.
    + [@benjamn](https://github.com/benjamn) in [#9718](https://github.com/apollographql/apollo-client/pull/9718) + +## Apollo Client 3.6.10 (2022-09-29) + +### Improvements + +- The client options (`variables`, `context`, etc.) used for `mutation` calls are now available as the second argument to the `onCompleted` and `onError` callback functions.
    + [@MrDoomBringer](https://github.com/MrDoomBringer) in [#10052](https://github.com/apollographql/apollo-client/pull/10052) + +## Apollo Client 3.6.9 (2022-06-21) + +### Bug Fixes + +- Leave `fetchPolicy` unchanged when `skip: true` (or in standby) and `nextFetchPolicy` is available, even if `variables` change.
    + [@benjamn](https://github.com/benjamn) in [#9823](https://github.com/apollographql/apollo-client/pull/9823) + +## Apollo Client 3.6.8 (2022-06-10) + +### Bug Fixes + +- Fix incorrect `variables` passed in `FieldFunctionOptions` for nested `readField` calls in `read` and `merge` functions.
    + [@stardustxx](https://github.com/stardustxx) in [#9808](https://github.com/apollographql/apollo-client/pull/9808) + +- Improve repository build scripts to work better on Windows.
    + [@dylanwulf](https://github.com/dylanwulf) in [#9805](https://github.com/apollographql/apollo-client/pull/9805) + +- Ensure `useQuery(query, { skip: true }).called === false` rather than always returning `called` as `true`.
    + [@KucharskiPiotr](https://github.com/KucharskiPiotr) in [#9798](https://github.com/apollographql/apollo-client/pull/9798) + +- Allow abandoned `reobserve` requests to unsubscribe from their underlying `Observable`.
    + [@javier-garcia-meteologica](https://github.com/javier-garcia-meteologica) in [#9791](https://github.com/apollographql/apollo-client/pull/9791) + +## Apollo Client 3.6.7 (2022-06-10) + +### Bug Fixes + +- Fix regression (introduced in v3.6.0) that caused `BatchHttpLink` to discard pending batched queries on early completion of the underlying `Observable`.
    + [@benjamn](https://github.com/benjamn) in [#9793](https://github.com/apollographql/apollo-client/pull/9793) + +## Apollo Client 3.6.6 (2022-05-26) + +### Bug Fixes + +- Allow `useLazyQuery(query, { defaultOptions })` to benefit from `defaultOptions.variables` and `client.defaultOptions.watchQuery.variables` merging.
    + [@benjamn](https://github.com/benjamn) in [#9762](https://github.com/apollographql/apollo-client/pull/9762) + +## Apollo Client 3.6.5 (2022-05-23) + +### Bug Fixes + +- Restore pre-v3.6 `variables` replacement behavior of `ObservableQuery#reobserve` method, fixing a regression that prevented removal of variables.
    + [@benjamn](https://github.com/benjamn) in [#9741](https://github.com/apollographql/apollo-client/pull/9741) + +- Preserve `previousData` even when different query or client provided to `useQuery`, instead of resetting `previousData` to undefined in those cases, matching behavior prior to v3.6.0.
    + [@benjamn](https://github.com/benjamn) in [#9734](https://github.com/apollographql/apollo-client/pull/9734) + +- Fix bug where `onCompleted()` and `onError()` are stale for `useMutation()`.
    + [@charle692](https://github.com/charle692) in [#9740](https://github.com/apollographql/apollo-client/pull/9740) + +- Limit scope of `DeepMerger` object reuse, and avoid using `Object.isFrozen`, which can introduce differences between development and production if objects that were frozen using `Object.freeze` in development are left unfrozen in production.
    + [@benjamn](https://github.com/benjamn) in [#9742](https://github.com/apollographql/apollo-client/pull/9742) + +- Properly merge `variables` from original `useLazyQuery(query, { variables })` with `variables` passed to execution function.
    + [@benjamn](https://github.com/benjamn) in [#9758](https://github.com/apollographql/apollo-client/pull/9758) + +## Apollo Client 3.6.4 (2022-05-16) + +### Bug Fixes + +- Guarantee `Concast` cleanup without `Observable cancelled prematurely` rejection, potentially solving long-standing issues involving that error.
    + [@benjamn](https://github.com/benjamn) in [#9701](https://github.com/apollographql/apollo-client/pull/9701) + +- Ensure `useSubscription` subscriptions are properly restarted after unmounting/remounting by React 18 in ``.
    + [@kazekyo](https://github.com/kazekyo) in [#9707](https://github.com/apollographql/apollo-client/pull/9707) + +### Improvements + +- Internalize `useSyncExternalStore` shim, for more control than `use-sync-external-store` provides, fixing some React Native issues.
    + [@benjamn](https://github.com/benjamn) in [#9675](https://github.com/apollographql/apollo-client/pull/9675) and [#9709](https://github.com/apollographql/apollo-client/pull/9709) + +- Provide `@apollo/client/**/*.cjs.native.js` versions of every `@apollo/client/**/*.cjs` bundle (including dependencies `ts-invariant` and `zen-observable-ts`) to help React Native's Metro bundler automatically resolve CommonJS entry point modules. **These changes should render unnecessary [the advice we gave in the v3.5.4 section below about `metro.config.js`](#apollo-client-354-2021-11-19).**
    + [@benjamn](https://github.com/benjamn) in [#9716](https://github.com/apollographql/apollo-client/pull/9716) + +- Handle falsy `incoming` data more gracefully in `offetLimitPagination().merge` function.
    + [@shobhitsharma](https://github.com/shobhitsharma) in [#9705](https://github.com/apollographql/apollo-client/pull/9705) + +## Apollo Client 3.6.3 (2022-05-05, only tagged `next` on npm) + +### Bug Fixes + +- Simplify `useQuery(query, { defaultOptions })` default options processing in order to fix bug where `skip: true` queries failed to execute upon switching to `skip: false`.
    + [@benjamn](https://github.com/benjamn) in [#9665](https://github.com/apollographql/apollo-client/pull/9665) + +- Add tests of skipping/unskipping and `useLazyQuery` with `defaultOptions`, and fix a bug causing duplicate requests.
    + [@benjamn](https://github.com/benjamn) in [#9666](https://github.com/apollographql/apollo-client/pull/9666) + +- Update `ts-invariant` to version 0.10.2 to fix source map warnings.
    + [@benjamn](https://github.com/benjamn) in [#9672](https://github.com/apollographql/apollo-client/pull/9672) + +- Test that `useQuery` queries with `skip: true` do not stall server-side rendering.
    + [@nathanmarks](https://github.com/nathanmarks) and [@benjamn](https://github.com/benjamn) in [#9677](https://github.com/apollographql/apollo-client/pull/9677) + +- Prevent `useLazyQuery` from making duplicate requests when its execution function is first called, and stop rejecting the `Promise` it returns when `result.error` is defined.
    + [@benjamn](https://github.com/benjamn) in [#9684](https://github.com/apollographql/apollo-client/pull/9684) + +- Fix issue with `useQuery` returning `loading: true` state during server-side rendering with `skip: true`.
    + [@nathanmarks](https://github.com/nathanmarks) in [#9679](https://github.com/apollographql/apollo-client/pull/9679) + +## Apollo Client 3.6.2 (2022-05-02) + +### Bug Fixes + +- Pass `getServerSnapshot` function to `useSyncExternalStore` in addition to `getSnapshot`, though the two functions behave identically. This change should fix/unbreak React 18 server rendering.
    + [@hungphongbk](https://github.com/hungphongbk) in [#9652](https://github.com/apollographql/apollo-client/pull/9652) + +### Improvements + +- Consider `networkError.result.errors` in addition to `result.errors` in `PersistedQueryLink`.
    + [@redaid113](https://github.com/redaid113) and [@benjamn](https://github.com/benjamn) in [#9410](https://github.com/apollographql/apollo-client/pull/9410) + +## Apollo Client 3.6.1 (2022-04-28) + +### Bug Fixes + +- Remove recently-added, internal `fetchBlockingPromise` option from the `WatchQueryOptions` interface, due to regressions.
    + [@benjamn](https://github.com/benjamn) in [#9504](https://github.com/apollographql/apollo-client/pull/9504) + +## Apollo Client 3.6.0 (2022-04-26) + +### Potentially disruptive changes + +- Calling `fetchMore` for queries using the `cache-and-network` or `network-only` fetch policies will no longer trigger additional network requests when cache results are complete. Instead, those complete cache results will be delivered as if using the `cache-first` fetch policy.
    + [@benjamn](https://github.com/benjamn) in [#9504](https://github.com/apollographql/apollo-client/pull/9504) + +- Reimplement `useQuery` and `useLazyQuery` to use the [proposed `useSyncExternalStore` API](https://github.com/reactwg/react-18/discussions/86) from React 18.
    + [@brainkim](https://github.com/brainkim) and [@benjamn](https://github.com/benjamn) in [#8785](https://github.com/apollographql/apollo-client/pull/8785) and [#9596](https://github.com/apollographql/apollo-client/pull/9596) + +- Fixed bug where the `useLazyQuery` execution function would always use the `refetch` method of `ObservableQuery`, instead of properly reapplying the current `fetchPolicy` using the `reobserve` method.
    + [@benjamn](https://github.com/benjamn) in [#9564](https://github.com/apollographql/apollo-client/pull/9564) + + > Since this `reobserve` method is useful and used internally, we have now exposed it as `use[Lazy]Query(...).reobserve` (which optionally takes a `Partial` of new options), to supplement the existing `refetch` method. Note that `reobserve` permanently updates the `variables` and other options of the `ObservableQuery`, unlike `refetch({ ...variables })`, which does not save those `variables`. + +- The internal use of `options.fetchBlockingPromise` by `useQuery` and `useLazyQuery` may slightly delay the delivery of network results, compared to previous versions of Apollo Client. Since network results are already delivered asynchronously, these timing differences should not be disruptive in most cases. Nevertheless, please open an issue if the timing differences are a problem for you (and you have no easy workaround).
    + [@benjamn](https://github.com/benjamn) in [#9599](https://github.com/apollographql/apollo-client/pull/9599) + +### React 18 + +In both its `peerDependencies` and its internal implementation, Apollo Client v3.6 should no longer prevent you from updating to React 18 in your applications. + +Internally, we have refactored `useQuery` and `useLazyQuery` to be implemented in terms of React's new (shimmable) `useSyncExternalStore` hook, demonstrating Apollo Client can serve as an external store with a referentially stable, synchronous API, as needed by React. + +As part of this refactoring, we also improved the behavior of `useQuery` and `useLazyQuery` when used in ``, which [double-renders components in development](https://github.com/reactwg/react-18/discussions/96). While this double-rendering always results in calling `useQuery` twice, forcing Apollo Client to create and then discard an unnecessary `ObservableQuery` object, we now have multiple defenses in place against executing any network queries for the unused `ObservableQuery` objects. + +In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling our server-side rendering utilities (`getDataFromTree` et al.), and introducing suspenseful versions of our hooks, to take full advantage of the new patterns React 18+ enables for data management libraries like Apollo Client. + +### Improvements + +- Allow `BatchLink` to cancel queued and in-flight operations.
    + [@PowerKiKi](https://github.com/PowerKiKi) and [@benjamn](https://github.com/benjamn) in [#9248](https://github.com/apollographql/apollo-client/pull/9248) + +- Add `GraphQLWsLink` in `@apollo/client/link/subscriptions`. This link is similar to the existing `WebSocketLink` in `@apollo/client/link/ws`, but uses the newer [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) package and protocol instead of the older `subscriptions-transport-ws` implementation. This functionality was technically first released in `@apollo/client@3.5.10`, but semantically belongs in the 3.6.0 minor version. + [@glasser](https://github.com/glasser) in [#9369](https://github.com/apollographql/apollo-client/pull/9369) + +- Allow passing `defaultOptions` to `useQuery` to avoid clobbering/resetting existing options when `useQuery` is called repeatedly.
    + [@benjamn](https://github.com/benjamn) in [#9563](https://github.com/apollographql/apollo-client/pull/9563), superseding [#9223](https://github.com/apollographql/apollo-client/pull/9223) + +- Provide additional context to `nextFetchPolicy` functions to assist with `fetchPolicy` transitions. More details can be found in the [`nextFetchPolicy` documentation](https://www.apollographql.com/docs/react/data/queries/#nextfetchpolicy).
    + [@benjamn](https://github.com/benjamn) in [#9222](https://github.com/apollographql/apollo-client/pull/9222) + +- Remove nagging deprecation warning about passing an `options.updateQuery` function to `fetchMore`.
    + [@benjamn](https://github.com/benjamn) in [#9504](https://github.com/apollographql/apollo-client/pull/9504) + +- Let `addTypenameToDocument` take any `ASTNode` (including `DocumentNode`, as before).
    + [@benjamn](https://github.com/benjamn) in [#9595](https://github.com/apollographql/apollo-client/pull/9595) + +- Set `useMutation` internal `isMounted` variable to `true` again when component remounted.
    + [@devpeerapong](https://github.com/devpeerapong) in [#9561](https://github.com/apollographql/apollo-client/pull/9561) + +## Apollo Client 3.5.10 (2022-02-24) + +### Improvements + +- Add `GraphQLWsLink` in `@apollo/client/link/subscriptions`. This link is similar to the existing `WebSocketLink` in `@apollo/client/link/ws`, but uses the newer [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) package and protocol instead of the older `subscriptions-transport-ws` implementation.
    + [@glasser](https://github.com/glasser) in [#9369](https://github.com/apollographql/apollo-client/pull/9369) + + > Note from [@benjamn](https://github.com/benjamn): since `GraphQLWsLink` is new functionality, we would normally wait for the next minor version (v3.6), but we were asked to expedite this release. These changes are strictly additive/opt-in/backwards-compatible, so shipping them in a patch release (3.5.10) seems safe, if unusual. + +## Apollo Client 3.5.9 (2022-02-15) + +### Improvements + +- Interpret `keyFields: [...]` and `keyArgs: [...]` configurations in `InMemoryCache` type/field policies as `ReadonlyArray`s, since they are never mutated internally.
    + [@julienfouilhe](https://github.com/julienfouilhe) in [#9339](https://github.com/apollographql/apollo-client/pull/9339) + +- Avoid declaring a global type for the `__DEV__` constant, to avoid conflict with other such global declarations.
    + [@benjamn](https://github.com/benjamn) in [#9386](https://github.com/apollographql/apollo-client/pull/9386) + +### Bug Fixes + +- Fix `useSubscription` executing `skip`ped subscription when input changes.
    + [@levrik](https://github.com/levrik) in [#9299](https://github.com/apollographql/apollo-client/pull/9299) + +- Fix partial data appearing in `useQuery().data` when `notifyOnNetworkStatusChange: true`.
    + [@brainkim](https://github.com/brainkim) in [#9367](https://github.com/apollographql/apollo-client/pull/9367) + +- Prevent `Promise`s returned by `useLazyQuery` execute functions from causing unhandled `Promise` rejection errors if uncaught.
    + [@brainkim](https://github.com/brainkim) in [#9380](https://github.com/apollographql/apollo-client/pull/9380) + +## Apollo Client 3.5.8 (2022-01-24) + +### Bug Fixes + +- Fix the type of the `called` property returned by `useQuery()` and `useLazyQuery()`.
    + [@sztadii](https://github.com/sztadii) in [#9304](https://github.com/apollographql/apollo-client/pull/9304) + +### Bug Fixes (by [@brainkim](https://github.com/brainkim) in [#9328](https://github.com/apollographql/apollo-client/pull/9328)) + +- Fix `refetch()` not being called when `skip` is true. +- Fix the promise returned from the `useLazyQuery()` execution function having stale variables. +- Fix the promise returned from the `useLazyQuery()` execution function not rejecting when a query errors. + +## Apollo Client 3.5.7 (2022-01-10) + +### Bug Fixes + +- Fix regression that prevented calling `onError` or `onCompleted` in some cases when using `useQuery`.
    + [@mmahalwy](https://github.com/mmahalwy) in [#9226](https://github.com/apollographql/apollo-client/pull/9226) + +- Make `useQuery` respect `defaultOptions.watchQuery.fetchPolicy`.
    + [@yasharzolmajdi](https://github.com/yasharzolmajdi) in [#9210](https://github.com/apollographql/apollo-client/pull/9210) + +## Apollo Client 3.5.6 (2021-12-07) + +### Bug Fixes (by [@brainkim](https://github.com/brainkim) in [#9144](https://github.com/apollographql/apollo-client/pull/9144)) + +- Restores old behavior where the callback passed to `useMutation()` is constant. +- Fix `useMutation()` callbacks having stale closures. +- Fix `useQuery()` variables being out of date. + +## Apollo Client 3.5.5 (2021-11-23) + +### Bug Fixes + +- Remove `printer: Printer` positional parameter from publicly-exported `selectHttpOptionsAndBody` function, whose addition in [#8699](https://github.com/apollographql/apollo-client/pull/8699) was a breaking change (starting in Apollo Client 3.5.0) for direct consumers of `selectHttpOptionsAndBody`.
    + [@benjamn](https://github.com/benjamn) in [#9103](https://github.com/apollographql/apollo-client/pull/9103) + +## Apollo Client 3.5.4 (2021-11-19) + +### Notices + +> ⚠️ The following advice about `metro.config.js` should no longer be necessary, as of Apollo Client v3.6.4. + +- [Relevant if you use Apollo Client with React Native] Since Apollo Client v3.5.0, CommonJS bundles provided by `@apollo/client` use a `.cjs` file extension rather than `.cjs.js`, so Node.js won't interpret them as ECMAScript modules. While this change should be an implementation detail, it may cause problems for the [Metro bundler](https://facebook.github.io/metro/) used by React Native, whose [`resolver.sourceExts`](https://facebook.github.io/metro/docs/configuration#sourceexts) configuration does not include the `cjs` extension by default. + + As a workaround until [this issue](https://github.com/facebook/metro/issues/535) is resolved, you can configure Metro to understand the `.cjs` file extension by creating a `metro.config.js` file in the root of your React Native project: + + ```js + // NOTE: No longer necessary in @apollo/client@3.6.4! + const { getDefaultConfig } = require("metro-config"); + const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues(); + exports.resolver = { + ...defaultResolver, + sourceExts: [...defaultResolver.sourceExts, "cjs"], + }; + ``` + +### Improvements + +- Restore the ability to pass `onError()` and `onCompleted()` to the mutation execution function.
    [@brainkim](https://github.com/brainkim) in [#9076](https://github.com/apollographql/apollo-client/pull/9076) + +- Work around webpack 5 errors of the form + ``` + The request 'ts-invariant/process' failed to resolve only because it was resolved as fully specified + ``` + by ensuring `import ... from 'ts-invariant/process'` is internally written to `import ... from 'ts-invariant/process/index.js'`.
    + [@benjamn](https://github.com/benjamn) in [#9083](https://github.com/apollographql/apollo-client/pull/9083) + +## Apollo Client 3.5.3 (2021-11-17) + +- Avoid rewriting non-relative imported module specifiers in `config/rewriteModuleIds.ts` script, thereby allowing bundlers to resolve those imports as they see fit.
    + [@benjamn](https://github.com/benjamn) in [#9073](https://github.com/apollographql/apollo-client/pull/9073) + +- Ensure only current file is matched when running VSCode debugger.
    + [@eps1lon](https://github.com/eps1lon) in [#9050](https://github.com/apollographql/apollo-client/pull/9050) + +## Apollo Client 3.5.2 (2021-11-10) + +- Fix `useMutation` execute function returning non-identical execution functions when passing similar options.
    + [@brainkim](https://github.com/brainkim) in [#9037](https://github.com/apollographql/apollo-client/pull/9037) + +## Apollo Client 3.5.1 (2021-11-09) + +- Remove npm from dependencies, and avoid referencing graphql-js enum value.
    + [@brainkim](https://github.com/brainkim) in [#9030](https://github.com/apollographql/apollo-client/pull/9030) + +## Apollo Client 3.5.0 (2021-11-08) + +### Improvements + +- Add `updateQuery` and `updateFragment` methods to `ApolloCache`, simplifying common `readQuery`/`writeQuery` cache update patterns.
    + [@wassim-k](https://github.com/wassim-k) in [#8382](https://github.com/apollographql/apollo-client/pull/8382) + +- Field directives and their arguments can now be included along with field argument names when using [field policy `keyArgs: [...]` notation](https://www.apollographql.com/docs/react/pagination/key-args/). For example, if you have a `Query.feed` field that takes an argument called `type` and uses a `@connection(key:...)` directive to keep `feed` data from different queries separate within the cache, you might configure both using the following `InMemoryCache` field policy: + + ```ts + new InMemoryCache({ + typePolicies: { + Query: { + fields: { + feed: { + keyArgs: ["type", "@connection", ["key"]], + }, + }, + }, + }, + }); + ``` + + [@benjamn](https://github.com/benjamn) in [#8678](https://github.com/apollographql/apollo-client/pull/8678) + +- Report single `MissingFieldError` instead of a potentially very large `MissingFieldError[]` array for incomplete cache reads, improving performance and memory usage.
    + [@benjamn](https://github.com/benjamn) in [#8734](https://github.com/apollographql/apollo-client/pull/8734) + +- When writing results into `InMemoryCache`, each written object is now identified using `policies.identify` _after_ traversing the fields of the object (rather than before), simplifying identification and reducing duplicate work. If you have custom `keyFields` functions, they still receive the raw result object as their first parameter, but the `KeyFieldsContext` parameter now provides `context.storeObject` (the `StoreObject` just processed by `processSelectionSet`) and `context.readField` (a helper function for reading fields from `context.storeObject` and any `Reference`s it might contain, similar to `readField` for `read`, `merge`, and `cache.modify` functions).
    + [@benjamn](https://github.com/benjamn) in [#8996](https://github.com/apollographql/apollo-client/pull/8996) + +- Ensure `cache.identify` never throws when primary key fields are missing, and include the source object in the error message when `keyFields` processing fails.
    + [@benjamn](https://github.com/benjamn) in [#8679](https://github.com/apollographql/apollo-client/pull/8679) + +- The `HttpLink` constructor now accepts an optional `print` function that can be used to customize how GraphQL `DocumentNode` objects are transformed back into strings before they are sent over the network.
    + [@sarahgp](https://github.com/sarahgp) in [#8699](https://github.com/apollographql/apollo-client/pull/8699) + +- Make `@apollo/client/testing` a fully-fledged, independent entry point, instead of re-exporting `@apollo/client/utilities/testing` (which was never an entry point and no longer exists).
    + [@benjamn](https://github.com/benjamn) in [#8769](https://github.com/apollographql/apollo-client/pull/8769) + +- A new nested entry point called `@apollo/client/testing/core` has been created. Importing from this entry point instead of `@apollo/client/testing` excludes any React-related dependencies.
    + [@wassim-k](https://github.com/wassim-k) in [#8687](https://github.com/apollographql/apollo-client/pull/8687) + +- Make `cache.batch` return the result of calling the `options.update` function.
    + [@benjamn](https://github.com/benjamn) in [#8696](https://github.com/apollographql/apollo-client/pull/8696) + +- The `NetworkError` and `ErrorResponse` types have been changed to align more closely.
    + [@korywka](https://github.com/korywka) in [#8424](https://github.com/apollographql/apollo-client/pull/8424) + +- Include `graphql@16` in peer deps.
    + [@brainkim](https://github.com/brainkim) in [#8997](https://github.com/apollographql/apollo-client/pull/8997) + +- Update `zen-observable-ts` to eliminate transitive dependency on `@types/zen-observable`.
    + [@benjamn](https://github.com/benjamn) in [#8695](https://github.com/apollographql/apollo-client/pull/8695) + +### React Refactoring + +#### Improvements (due to [@brainkim](https://github.com/brainkim) in [#8875](https://github.com/apollographql/apollo-client/pull/8875)): + +- The `useLazyQuery` function now returns a promise with the result. +- The `useMutation` result now exposes a method which can be reset. + +#### Bug Fixes (due to [@brainkim](https://github.com/brainkim) in [#8596](https://github.com/apollographql/apollo-client/pull/8596)): + +- The `useQuery` and `useLazyQuery` hooks will now have `ObservableQuery` methods defined consistently. +- Calling `useLazyQuery` methods like `startPolling` will start the query. +- Calling the `useLazyQuery` execution function will now behave more like `refetch`. `previousData` will be preserved. +- `standby` fetchPolicies will now act like `skip: true` more consistently. +- Calling `refetch` on a skipped query will have no effect (issue [#8270](https://github.com/apollographql/apollo-client/issues/8270)). +- Prevent `onError` and `onCompleted` functions from firing continuously, and improving their polling behavior. + +## Apollo Client 3.4.17 (2021-11-08) + +### Improvements + +- Allow `TOptions extends FieldFunctionOptions` to be passed as final (optional) type parameter of `FieldPolicy` type.
    + [@VictorGaiva](https://github.com/VictorGaiva) in [#9000](https://github.com/apollographql/apollo-client/pull/9000) + +## Apollo Client 3.4.16 + +### Improvements + +- Prevent webpack from misresolving the `graphql` package as the local `@apollo/client/utilities/globals/graphql.js` module when `module.exports.resolve.preferRelative` is enabled in `webpack.config.js`. + + > Note: if you encounter strange module resolution errors like `export 'isType' (imported as 'isType') was not found in 'graphql' (possible exports: removeTemporaryGlobals)` please try removing `preferRelative: true` from your `webpack.config.js` file, or find a way to disable that resolution behavior for packages within `node_modules`. + + [@benjamn](https://github.com/benjamn) in [#8862](https://github.com/apollographql/apollo-client/pull/8862) + +- Avoid importing `isType` from the `graphql` package internally, to prevent bundlers from including as much as 3.4kB of unnecessary code.
    + [@benjamn](https://github.com/benjamn) in [#8891](https://github.com/apollographql/apollo-client/pull/8891) + +- Make `client.resetStore` and `client.clearStore` pass appropriate `discardWatches` option to `cache.reset`.
    + [@benjamn](https://github.com/benjamn) in [#8873](https://github.com/apollographql/apollo-client/pull/8873) + +## Apollo Client 3.4.15 + +### Bug Fixes + +- Require calling `cache.reset({ discardWatches: true })` to make `cache.reset` discard `cache.watches`, restoring behavior broken in v3.4.14 by [#8826](https://github.com/apollographql/apollo-client/pull/8826).
    + [@benjamn](https://github.com/benjamn) in [#8852](https://github.com/apollographql/apollo-client/pull/8852) + +## Apollo Client 3.4.14 + +### Bug Fixes + +- Disable `InMemoryCache` [result object canonization](https://github.com/apollographql/apollo-client/pull/7439) by default, to prevent unexpected memory growth and/or reuse of object references, with multiple ways to reenable it (per-cache, per-query, or a mixture of both).
    + [@benjamn](https://github.com/benjamn) in [#8822](https://github.com/apollographql/apollo-client/pull/8822) + +- Clear `InMemoryCache` `watches` set when `cache.reset()` called.
    + [@benjamn](https://github.com/benjamn) in [#8826](https://github.com/apollographql/apollo-client/pull/8826) + +- Stop excluding observerless queries from `refetchQueries: [...]` selection.
    + [@benjamn](https://github.com/benjamn) in [#8825](https://github.com/apollographql/apollo-client/pull/8825) + +- Prevent optimistic cache evictions from evicting non-optimistic data.
    + [@benjamn](https://github.com/benjamn) in [#8829](https://github.com/apollographql/apollo-client/pull/8829) + +- Ensure `cache.broadcastWatch` passes all relevant `WatchOptions` to `cache.diff` as `DiffOptions`.
    + [@benjamn](https://github.com/benjamn) in [#8832](https://github.com/apollographql/apollo-client/pull/8832) + +## Apollo Client 3.4.13 + +### Bug Fixes + +- Fix `componentDidUpate` typo in `withSubscription` higher-order component.
    + [@YarBez](https://github.com/YarBez) in [#7506](https://github.com/apollographql/apollo-client/pull/7506) + +- Fix internal `canUseSymbol` import within `@apollo/client/utilities` to avoid breaking bundlers/builds.
    + [@benjamn](https://github.com/benjamn) in [#8817](https://github.com/apollographql/apollo-client/pull/8817) + +- Tolerate unfreezable objects like `Uint8Array` and `Buffer` in `maybeDeepFreeze`.
    + [@geekuillaume](https://github.com/geekuillaume) and [@benjamn](https://github.com/benjamn) in [#8813](https://github.com/apollographql/apollo-client/pull/8813) + +## Apollo Client 3.4.12 + +### Bug Fixes + +- Improve handling of falsy `existing` and/or `incoming` parameters in `relayStylePagination` field policy helper function.
    + [@bubba](https://github.com/bubba) and [@benjamn](https://github.com/benjamn) in [#8733](https://github.com/apollographql/apollo-client/pull/8733) + +- Associate Apollo context with `React.createContext` (instead of using a local `WeakMap`) again, so multiple copies of `@apollo/client` (uncommon) can share the same context.
    + [@benjamn](https://github.com/benjamn) in [#8798](https://github.com/apollographql/apollo-client/pull/8798) + +## Apollo Client 3.4.11 + +### Bug Fixes + +- Fix [Vite](https://vitejs.dev) tree-shaking by calling the `checkDEV()` function (at least once) in the module that exports it, `@apollo/client/utilities/globals/index.ts`.
    + [@benjamn](https://github.com/benjamn) in [#8767](https://github.com/apollographql/apollo-client/pull/8767) + +### Improvements + +- Export `PersistedQueryLink` namespace from `@apollo/client/link/persisted-queries`.
    + [@vedrani](https://github.com/vedrani) in [#8761](https://github.com/apollographql/apollo-client/pull/8761) + +### Documentation + +- Upgrade docs theme for new Algolia-powered search experience.
    + [@trevorblades](https://github.com/trevorblades) in [#8768](https://github.com/apollographql/apollo-client/pull/8768) + +## Apollo Client 3.4.10 + +### Improvements + +- Warn when calling `refetch({ variables })` instead of `refetch(variables)`, except for queries that declare a variable named `$variables` (uncommon).
    + [@benjamn](https://github.com/benjamn) in [#8702](https://github.com/apollographql/apollo-client/pull/8702) + +### Bug Fixes + +- Fix `ObservableQuery.getCurrentResult()` returning cached `data` with certain fetch policies.
    + [@brainkim](https://github.com/brainkim) in [#8718](https://github.com/apollographql/apollo-client/pull/8718) + +- Prevent `ssrMode`/`ssrForceFetchDelay` from causing queries to hang.
    + [@brainkim](https://github.com/brainkim) in [#8709](https://github.com/apollographql/apollo-client/pull/8709) + +- Import `@apollo/client/utilities/globals` internally wherever `__DEV__` is used, not just in `@apollo/client/**/index.js` entry points.
    + [@benjamn](https://github.com/benjamn) in [#8720](https://github.com/apollographql/apollo-client/pull/8720) + +## Apollo Client 3.4.9 + +### Bug Fixes + +- Fix unhandled `Promise` rejection warnings/errors whose message is `Observable cancelled prematurely`.
    + [@benjamn](https://github.com/benjamn) in [#8676](https://github.com/apollographql/apollo-client/pull/8676) + +- Enforce that `__DEV__` is polyfilled by every `@apollo/client/*` entry point that uses it. This build step considers not only explicit `__DEV__` usage but also `__DEV__` references injected near `invariant(...)` and `new InvariantError(...)` expressions.
    + [@benjamn](https://github.com/benjamn) in [#8689](https://github.com/apollographql/apollo-client/pull/8689) + +## Apollo Client 3.4.8 + +### Bug Fixes + +- Fix error thrown by nested `keyFields: ["a", ["b", "c"], "d"]` type policies when writing results into the cache where any of the key fields (`.a`, `.a.b`, `.a.c`, or `.d`) have been renamed by query field alias syntax.
    + [@benjamn](https://github.com/benjamn) in [#8643](https://github.com/apollographql/apollo-client/pull/8643) + +- Fix regression from PR [#8422](https://github.com/apollographql/apollo-client/pull/8422) (first released in `@apollo/client@3.4.0-rc.15`) that caused `result.data` to be set to undefined in some cases after `ObservableQuery#getCurrentResult` reads an incomplete result from the cache.
    + [@benjamn](https://github.com/benjamn) in [#8642](https://github.com/apollographql/apollo-client/pull/8642) + +## Apollo Client 3.4.7 + +### Bug Fixes + +- Fix accidental reuse of recycled `MergeTree` objects in `StoreWriter` class used by `InMemoryCache`.
    + [@benjamn](https://github.com/benjamn) in [#8618](https://github.com/apollographql/apollo-client/pull/8618) + +## Apollo Client 3.4.6 + +### Improvements + +- Reevaluate `window.fetch` each time `HttpLink` uses it, if not configured using `options.fetch`. This change enables a variety of strategies for instrumenting `window.fetch`, without requiring those strategies to run before `@apollo/client/link/http` is first imported.
    + [@benjamn](https://github.com/benjamn) in [#8603](https://github.com/apollographql/apollo-client/pull/8603) + +- Clarify mutation `fetchPolicy` options (`"network-only"` or `"no-cache"`) using [`MutationFetchPolicy`](https://github.com/apollographql/apollo-client/blob/fa52875341ab33f3e8192ded90af5e2c208e0f75/src/core/watchQueryOptions.ts#L33-L37) union type.
    + [@benjamn](https://github.com/benjamn) in [#8602](https://github.com/apollographql/apollo-client/pull/8602) + +### Bug Fixes + +- Restore full `@apollo/client/apollo-client.cjs.js` CommonJS bundle for older bundlers. + + > Note that Node.js and CommonJS bundlers typically use the bundles specified by `"main"` fields in our generated `package.json` files, which are all independent and non-overlapping CommonJS modules. However, `apollo-client.cjs.js` is just one big bundle, so mixing imports of `apollo-client.cjs.js` with the other CommonJS bundles is discouraged, as it could trigger the [dual package hazard](https://nodejs.org/api/packages.html#packages_dual_commonjs_es_module_packages). In other words, please don't start using `apollo-client.cjs.js` if you're not already.
    + + [@benjamn](https://github.com/benjamn) in [#8592](https://github.com/apollographql/apollo-client/pull/8592) + +- Log `MissingFieldError`s in `ObservableQuery#getCurrentResult` using `invariant.debug`, rather than reporting them via `result.error`.
    + [@benjamn](https://github.com/benjamn) in [#8604](https://github.com/apollographql/apollo-client/pull/8604) + +## Apollo Client 3.4.5 + +### Bug Fixes + +- Fix double registration bug for mutation `refetchQueries` specified using legacy one-time `refetchQueries: [{ query, variables }]` style. Though the bug is fixed, we recommend using `refetchQueries: [query]` instead (when possible) to refetch an existing query using its `DocumentNode`, rather than creating, executing, and then deleting a new query, as the legacy `{ query, variables }` style unfortunately does.
    + [@benjamn](https://github.com/benjamn) in [#8586](https://github.com/apollographql/apollo-client/pull/8586) + +- Fix `useQuery`/`useLazyQuery` stalling when clients or queries change.
    + [@brainkim](https://github.com/brainkim) in [#8589](https://github.com/apollographql/apollo-client/pull/8589) + +## Apollo Client 3.4.4 + +### Bug Fixes + +- Revert accidental addition of `engines.npm` section to published version of `@apollo/client/package.json`.
    + [@benjamn](https://github.com/benjamn) in [#8578](https://github.com/apollographql/apollo-client/pull/8578) + +## Apollo Client 3.4.3 + +### Bug Fixes + +- Fix `{ ssr: false }` causing queries to hang on the client.
    + [@brainkim](https://github.com/brainkim) in [#8574](https://github.com/apollographql/apollo-client/pull/8574) + +## Apollo Client 3.4.2 + +### Bug Fixes + +- Use more default type parameters for mutation-related types in `react/types/types.ts`, to provide smoother backwards compatibility for code using those types explicitly.
    + [@benjamn](https://github.com/benjamn) in [#8573](https://github.com/apollographql/apollo-client/pull/8573) + +## Apollo Client 3.4.1 + +### Bug Fixes + +- Initialize `stringifyCanon` lazily, when `canonicalStringify` is first called, fixing `Uncaught ReferenceError: __DEV__ is not defined` errors due to usage of `__DEV__` before declaration.
    + [@benjamn](https://github.com/benjamn) in [#8557](https://github.com/apollographql/apollo-client/pull/8557) + +## Apollo Client 3.4.0 + +### New documentation + +- [**Refetching queries**](https://www.apollographql.com/docs/react/data/refetching/) with `client.refetchQueries`.
    + [@StephenBarlow](https://github.com/StephenBarlow) and [@benjamn](https://github.com/benjamn) in [#8265](https://github.com/apollographql/apollo-client/pull/8265) + +### Improvements + +- `InMemoryCache` now _guarantees_ that any two result objects returned by the cache (from `readQuery`, `readFragment`, etc.) will be referentially equal (`===`) if they are deeply equal. Previously, `===` equality was often achievable for results for the same query, on a best-effort basis. Now, equivalent result objects will be automatically shared among the result trees of completely different queries. This guarantee is important for taking full advantage of optimistic updates that correctly guess the final data, and for "pure" UI components that can skip re-rendering when their input data are unchanged.
    + [@benjamn](https://github.com/benjamn) in [#7439](https://github.com/apollographql/apollo-client/pull/7439) + +- Mutations now accept an optional callback function called `onQueryUpdated`, which will be passed the `ObservableQuery` and `Cache.DiffResult` objects for any queries invalidated by cache writes performed by the mutation's final `update` function. Using `onQueryUpdated`, you can override the default `FetchPolicy` of the query, by (for example) calling `ObservableQuery` methods like `refetch` to force a network request. This automatic detection of invalidated queries provides an alternative to manually enumerating queries using the `refetchQueries` mutation option. Also, if you return a `Promise` from `onQueryUpdated`, the mutation will automatically await that `Promise`, rendering the `awaitRefetchQueries` option unnecessary.
    + [@benjamn](https://github.com/benjamn) in [#7827](https://github.com/apollographql/apollo-client/pull/7827) + +- Support `client.refetchQueries` as an imperative way to refetch queries, without having to pass `options.refetchQueries` to `client.mutate`.
    + [@dannycochran](https://github.com/dannycochran) in [#7431](https://github.com/apollographql/apollo-client/pull/7431) + +- Improve standalone `client.refetchQueries` method to support automatic detection of queries needing to be refetched.
    + [@benjamn](https://github.com/benjamn) in [#8000](https://github.com/apollographql/apollo-client/pull/8000) + +- Fix remaining barriers to loading [`@apollo/client/core`](https://cdn.jsdelivr.net/npm/@apollo/client@3.4.0/core/+esm) as native ECMAScript modules from a CDN like [esm.run](https://www.jsdelivr.com/esm). Importing `@apollo/client` from a CDN will become possible once we move all React-related dependencies into `@apollo/client/react` in Apollo Client 4.
    + [@benjamn](https://github.com/benjamn) in [#8266](https://github.com/apollographql/apollo-client/issues/8266) + +- `InMemoryCache` supports a new method called `batch`, which is similar to `performTransaction` but takes named options rather than positional parameters. One of these named options is an `onDirty(watch, diff)` callback, which can be used to determine which watched queries were invalidated by the `batch` operation.
    + [@benjamn](https://github.com/benjamn) in [#7819](https://github.com/apollographql/apollo-client/pull/7819) + +- Allow `merge: true` field policy to merge `Reference` objects with non-normalized objects, and vice-versa.
    + [@benjamn](https://github.com/benjamn) in [#7778](https://github.com/apollographql/apollo-client/pull/7778) + +- Allow identical subscriptions to be deduplicated by default, like queries.
    + [@jkossis](https://github.com/jkossis) in [#6910](https://github.com/apollographql/apollo-client/pull/6910) + +- Always use `POST` request when falling back to sending full query with `@apollo/client/link/persisted-queries`.
    + [@rieset](https://github.com/rieset) in [#7456](https://github.com/apollographql/apollo-client/pull/7456) + +- The `FetchMoreQueryOptions` type now takes two instead of three type parameters (``), thanks to using `Partial` instead of `K extends typeof TVariables` and `Pick`.
    + [@ArnaudBarre](https://github.com/ArnaudBarre) in [#7476](https://github.com/apollographql/apollo-client/pull/7476) + +- Pass `variables` and `context` to a mutation's `update` function. **Note:** The type of the `update` function is now named `MutationUpdaterFunction` rather than `MutationUpdaterFn`, since the older type was [broken beyond repair](https://github.com/apollographql/apollo-client/issues/8506#issuecomment-881706613). If you are using `MutationUpdaterFn` in your own code, please use `MutationUpdaterFunction` instead.
    + [@jcreighton](https://github.com/jcreighton) in [#7902](https://github.com/apollographql/apollo-client/pull/7902) + +- A `resultCacheMaxSize` option may be passed to the `InMemoryCache` constructor to limit the number of result objects that will be retained in memory (to speed up repeated reads), and calling `cache.reset()` now releases all such memory.
    + [@SofianHn](https://github.com/SofianHn) in [#8107](https://github.com/apollographql/apollo-client/pull/8107) + +- Fully remove result cache entries from LRU dependency system when the corresponding entities are removed from `InMemoryCache` by eviction, or by any other means.
    + [@sofianhn](https://github.com/sofianhn) and [@benjamn](https://github.com/benjamn) in [#8147](https://github.com/apollographql/apollo-client/pull/8147) + +- Expose missing field errors in results.
    + [@brainkim](github.com/brainkim) in [#8262](https://github.com/apollographql/apollo-client/pull/8262) + +- Add expected/received `variables` to `No more mocked responses...` error messages generated by `MockLink`.
    + [@markneub](github.com/markneub) in [#8340](https://github.com/apollographql/apollo-client/pull/8340) + +- The `InMemoryCache` version of the `cache.gc` method now supports additional options for removing non-essential (recomputable) result caching data.
    + [@benjamn](https://github.com/benjamn) in [#8421](https://github.com/apollographql/apollo-client/pull/8421) + +- Suppress noisy `Missing cache result fields...` warnings by default unless `setLogVerbosity("debug")` called.
    + [@benjamn](https://github.com/benjamn) in [#8489](https://github.com/apollographql/apollo-client/pull/8489) + +- Improve interaction between React hooks and React Fast Refresh in development.
    + [@andreialecu](https://github.com/andreialecu) in [#7952](https://github.com/apollographql/apollo-client/pull/7952) + +### Potentially disruptive changes + +- To avoid retaining sensitive information from mutation root field arguments, Apollo Client v3.4 automatically clears any `ROOT_MUTATION` fields from the cache after each mutation finishes. If you need this information to remain in the cache, you can prevent the removal by passing the `keepRootFields: true` option to `client.mutate`. `ROOT_MUTATION` result data are also passed to the mutation `update` function, so we recommend obtaining the results that way, rather than using `keepRootFields: true`, if possible.
    + [@benjamn](https://github.com/benjamn) in [#8280](https://github.com/apollographql/apollo-client/pull/8280) + +- Internally, Apollo Client now controls the execution of development-only code using the `__DEV__` global variable, rather than `process.env.NODE_ENV`. While this change should not cause any visible differences in behavior, it will increase your minified+gzip bundle size by more than 3.5kB, unless you configure your minifier to replace `__DEV__` with a `true` or `false` constant, the same way you already replace `process.env.NODE_ENV` with a string literal like `"development"` or `"production"`. For an example of configuring a Create React App project without ejecting, see this pull request for our [React Apollo reproduction template](https://github.com/apollographql/react-apollo-error-template/pull/51).
    + [@benjamn](https://github.com/benjamn) in [#8347](https://github.com/apollographql/apollo-client/pull/8347) + +- Internally, Apollo Client now uses namespace syntax (e.g. `import * as React from "react"`) for imports whose types are re-exported (and thus may appear in `.d.ts` files). This change should remove any need to configure `esModuleInterop` or `allowSyntheticDefaultImports` in `tsconfig.json`, but might require updating bundler configurations that specify named exports of the `react` and `prop-types` packages, to include exports like `createContext` and `createElement` ([example](https://github.com/apollographql/apollo-client/commit/16b08e1af9ba9934041298496e167aafb128c15d)).
    + [@devrelm](https://github.com/devrelm) in [#7742](https://github.com/apollographql/apollo-client/pull/7742) + +- Respect `no-cache` fetch policy (by not reading any `data` from the cache) for `loading: true` results triggered by `notifyOnNetworkStatusChange: true`.
    + [@jcreighton](https://github.com/jcreighton) in [#7761](https://github.com/apollographql/apollo-client/pull/7761) + +- The TypeScript return types of the `getLastResult` and `getLastError` methods of `ObservableQuery` now correctly include the possibility of returning `undefined`. If you happen to be calling either of these methods directly, you may need to adjust how the calling code handles the methods' possibly-`undefined` results.
    + [@benjamn](https://github.com/benjamn) in [#8394](https://github.com/apollographql/apollo-client/pull/8394) + +- Log non-fatal `invariant.error` message when fields are missing from result objects written into `InMemoryCache`, rather than throwing an exception. While this change relaxes an exception to be merely an error message, which is usually a backwards-compatible change, the error messages are logged in more cases now than the exception was previously thrown, and those new error messages may be worth investigating to discover potential problems in your application. The errors are not displayed for `@client`-only fields, so adding `@client` is one way to handle/hide the errors for local-only fields. Another general strategy is to use a more precise query to write specific subsets of data into the cache, rather than reusing a larger query that contains fields not present in the written `data`.
    + [@benjamn](https://github.com/benjamn) in [#8416](https://github.com/apollographql/apollo-client/pull/8416) + +- The [`nextFetchPolicy`](https://github.com/apollographql/apollo-client/pull/6893) option for `client.watchQuery` and `useQuery` will no longer be removed from the `options` object after it has been applied, and instead will continue to be applied any time `options.fetchPolicy` is reset to another value, until/unless the `options.nextFetchPolicy` property is removed from `options`.
    + [@benjamn](https://github.com/benjamn) in [#8465](https://github.com/apollographql/apollo-client/pull/8465) + +- The `fetchMore`, `subscribeToMore`, and `updateQuery` functions returned from the `useQuery` hook may now return undefined in edge cases where the functions are called when the component is unmounted
    [@noghartt](https://github.com/noghartt) in [#7980](https://github.com/apollographql/apollo-client/pull/7980). + +### Bug fixes + +- In Apollo Client 2.x, a `refetch` operation would always replace existing data in the cache. With the introduction of field policy `merge` functions in Apollo Client 3, existing field values could be inappropriately combined with incoming field values by a custom `merge` function that does not realize a `refetch` has happened. + + To give you more control over this behavior, we have introduced an `overwrite?: boolean = false` option for `cache.writeQuery` and `cache.writeFragment`, and an option called `refetchWritePolicy?: "merge" | "overwrite"` for `client.watchQuery`, `useQuery`, and other functions that accept `WatchQueryOptions`. You can use these options to make sure any `merge` functions involved in cache writes for `refetch` operations get invoked with `undefined` as their first argument, which simulates the absence of any existing data, while still giving the `merge` function a chance to determine the internal representation of the incoming data. + + The default behaviors are `overwrite: true` and `refetchWritePolicy: "overwrite"`, which restores the Apollo Client 2.x behavior, but (if this change causes any problems for your application) you can easily recover the previous merging behavior by setting a default value for `refetchWritePolicy` in `defaultOptions.watchQuery`: + + ```ts + new ApolloClient({ + defaultOptions: { + watchQuery: { + refetchWritePolicy: "merge", + }, + }, + }); + ``` + + [@benjamn](https://github.com/benjamn) in [#7810](https://github.com/apollographql/apollo-client/pull/7810) + +- Make sure the `MockedResponse` `ResultFunction` type is re-exported.
    + [@hwillson](https://github.com/hwillson) in [#8315](https://github.com/apollographql/apollo-client/pull/8315) + +- Fix polling when used with `skip`.
    + [@brainkim](https://github.com/brainkim) in [#8346](https://github.com/apollographql/apollo-client/pull/8346) + +- `InMemoryCache` now coalesces `EntityStore` updates to guarantee only one `store.merge(id, fields)` call per `id` per cache write.
    + [@benjamn](https://github.com/benjamn) in [#8372](https://github.com/apollographql/apollo-client/pull/8372) + +- Fix polling when used with ``.
    + [@brainkim](https://github.com/brainkim) in [#8414](https://github.com/apollographql/apollo-client/pull/8414) + +- Fix the React integration logging `Warning: Can't perform a React state update on an unmounted component`.
    + [@wuarmin](https://github.com/wuarmin) in [#7745](https://github.com/apollographql/apollo-client/pull/7745) + +- Make `ObservableQuery#getCurrentResult` always call `queryInfo.getDiff()`.
    + [@benjamn](https://github.com/benjamn) in [#8422](https://github.com/apollographql/apollo-client/pull/8422) + +- Make `readField` default to reading from current object only when the `from` option/argument is actually omitted, not when `from` is passed to `readField` with an undefined value. A warning will be printed when this situation occurs.
    + [@benjamn](https://github.com/benjamn) in [#8508](https://github.com/apollographql/apollo-client/pull/8508) + +- The `fetchMore`, `subscribeToMore`, and `updateQuery` functions no longer throw `undefined` errors
    [@noghartt](https://github.com/noghartt) in [#7980](https://github.com/apollographql/apollo-client/pull/7980). + +## Apollo Client 3.3.21 + +### Bug fixes + +- Fix race condition in `@apollo/client/link/context` that could leak subscriptions if the subscription is cancelled before `operation.setContext` is called.
    + [@sofianhn](https://github.com/sofianhn) in [#8399](https://github.com/apollographql/apollo-client/pull/8399) + +- Prefer `existing.pageInfo.startCursor` and `endCursor` (if defined) in `read` function of `relayStylePagination` policies.
    + [@benjamn](https://github.com/benjamn) in [#8438](https://github.com/apollographql/apollo-client/pull/8438) + +### Improvements + +- Normalize user-provided `HttpLink` headers by lower-casing their names.
    + [@benjamn](https://github.com/benjamn) in [#8449](https://github.com/apollographql/apollo-client/pull/8449) + +## Apollo Client 3.3.20 + +### Bug fixes + +- Fix policy merging bug when calling `cache.policies.addTypePolicies` multiple times for the same type policy.
    + [@Banou26](https://github.com/Banou26) in [#8361](https://github.com/apollographql/apollo-client/pull/8361) + +## Apollo Client 3.3.19 + +### Bug fixes + +- Use `export ... from` syntax to re-export `graphql-tag` named exports, making tree-shaking easier for some bundlers.
    + [@benjamn](https://github.com/benjamn) in [#8221](https://github.com/apollographql/apollo-client/pull/8221) + +### Documentation + +- Replace Spectrum references with [community.apollographql.com](https://community.apollographql.com).
    + [@hwillson](https://github.com/hwillson) in [#8238](https://github.com/apollographql/apollo-client/pull/8238) + +## Apollo Client 3.3.18 + +### Bug fixes + +- Add `"sideEffects": false` to all generated/published `package.json` files, to improve dead code elimination for nested entry points like `@apollo/client/cache`.
    + [@benjamn](https://github.com/benjamn) in [#8213](https://github.com/apollographql/apollo-client/pull/8213) + +## Apollo Client 3.3.17 + +### Bug fixes + +- Make `useReactiveVar(rv)` recheck the latest `rv()` value in its `useEffect` callback, and immediately update state if the value has already changed, rather than calling `rv.onNextChange(setValue)` to listen for future changes.
    + [@benjamn](https://github.com/benjamn) in [#8135](https://github.com/apollographql/apollo-client/pull/8135) + +## Apollo Client 3.3.16 + +### Bug fixes + +- Prevent `undefined` mutation result in `useMutation`.
    + [@jcreighton](https://github.com/jcreighton) in [#8018](https://github.com/apollographql/apollo-client/pull/8018) + +- Fix `useReactiveVar` not rerendering for successive synchronous calls.
    + [@brainkim](https://github.com/brainkim) in [#8022](https://github.com/apollographql/apollo-client/pull/8022) + +- Support `batchDebounce` option for `BatchLink` and `BatchHttpLink`.
    + [@dannycochran](https://github.com/dannycochran) in [#8024](https://github.com/apollographql/apollo-client/pull/8024) + +## Apollo Client 3.3.15 + +- Increment `queryInfo.lastRequestId` only when making a network request through the `ApolloLink` chain, rather than every time `fetchQueryByPolicy` is called.
    + [@dannycochran](https://github.com/dannycochran) in [#7956](https://github.com/apollographql/apollo-client/pull/7956) + +- During server-side rendering, allow initial `useQuery` calls to return final `{ loading: false, data }` results when the cache already contains the necessary data.
    + [@benjamn](https://github.com/benjamn) in [#7983](https://github.com/apollographql/apollo-client/pull/7983) + +## Apollo Client 3.3.14 + +### Improvements + +- Adjust TypeScript types to allow `keyFields` and `keyArgs` functions to return `false`.
    + [@CarsonF](https://github.com/CarsonF) and [@benjamn](https://github.com/benjamn) in [#7900](https://github.com/apollographql/apollo-client/pull/7900) + +### Bug fixes + +- Prevent `RenderPromises` memory leak by calling `renderPromises.clear()` after `getMarkupFromTree` finishes.
    + [@benjamn](https://github.com/benjamn) in [#7943](https://github.com/apollographql/apollo-client/pull/7943) + +- Cancel pending notify timeout when stopping a `QueryInfo` object.
    + [@hollandThomas](https://github.com/hollandThomas) in [#7935](https://github.com/apollographql/apollo-client/pull/7935) + +- Fix infinite rendering bug related to `useSubscription`.
    + [@brainkim](https://github.com/brainkim) in [#7917](https://github.com/apollographql/apollo-client/pull/7917) + +## Apollo Client 3.3.13 + +### Improvements + +- Add missing `context` option to `useSubscription`.
    + [@jcreighton](https://github.com/jcreighton) in [#7860](https://github.com/apollographql/apollo-client/pull/7860) + +- Remove unnecessary TypeScript global `Observable["@@observable"]` method declaration.
    + [@benjamn](https://github.com/benjamn) in [#7888](https://github.com/apollographql/apollo-client/pull/7888) + +- Prevent skipped/observerless `ObservableQuery`s from being refetched by `refetchQueries`.
    + [@dannycochran](https://github.com/dannycochran) in [#7877](https://github.com/apollographql/apollo-client/pull/7877) + +## Apollo Client 3.3.12 + +### Bug fixes + +- Maintain serial ordering of `asyncMap` mapping function calls, and prevent potential unhandled `Promise` rejection errors.
    + [@benjamn](https://github.com/benjamn) in [#7818](https://github.com/apollographql/apollo-client/pull/7818) + +- Relax incompatible `children?: React.ReactElement` field type in `MockedProviderProps` interface.
    + [@kevinperaza](https://github.com/kevinperaza) in [#7833](https://github.com/apollographql/apollo-client/pull/7833) + +## Apollo Client 3.3.11 + +### Bug fixes + +- Fix `useLazyQuery` `forceUpdate` loop regression introduced by [#7655](https://github.com/apollographql/apollo-client/pull/7655) in version 3.3.10.
    + [@benjamn](https://github.com/benjamn) in [#7715](https://github.com/apollographql/apollo-client/pull/7715) + +## Apollo Client 3.3.10 + +### Bug fixes + +- Revert PR [#7276](https://github.com/apollographql/apollo-client/pull/7276), but test that garbage collection reclaims torn-down `ObservableQuery` objects.
    + [@benjamn](https://github.com/benjamn) in [#7695](https://github.com/apollographql/apollo-client/pull/7695) + +- Reset `QueryInfo.diff` and `QueryInfo.dirty` after canceling notify timeout in `QueryInfo.markResult` and `QueryInfo.markError`.
    + [@jcreighton](https://github.com/jcreighton) in [#7696](https://github.com/apollographql/apollo-client/pull/7696) + +### Improvements + +- Avoid calling `forceUpdate` when component is unmounted.
    + [@DylanVann](https://github.com/DylanVann) in [#7655](https://github.com/apollographql/apollo-client/pull/7655) + +- The `codemods/` top-level directory has been moved into the `scripts/` directory.
    + [@benjamn](https://github.com/benjamn) in [#7675](https://github.com/apollographql/apollo-client/pull/7675) + +## Apollo Client 3.3.9 + +### Bug Fixes + +- Prevent reactive variables from retaining otherwise unreachable `InMemoryCache` objects.
    + [@benjamn](https://github.com/benjamn) in [#7661](https://github.com/apollographql/apollo-client/pull/7661) + +### Improvements + +- The [`graphql-tag`](https://www.npmjs.com/package/graphql-tag) dependency has been updated to version 2.12.0, after converting its repository to use TypeScript and ECMAScript module syntax. There should be no visible changes in behavior, though the internal changes seemed significant enough to mention here.
    + [@abdonrd](https://github.com/abdonrd) in [graphql-tag#273](https://github.com/apollographql/graphql-tag/pull/273) and + [@PowerKiKi](https://github.com/PowerKiKi) in [graphql-tag#325](https://github.com/apollographql/graphql-tag/pull/325) + +## Apollo Client 3.3.8 + +### Bug Fixes + +- Catch updates in `useReactiveVar` with an additional check.
    + [@jcreighton](https://github.com/jcreighton) in [#7652](https://github.com/apollographql/apollo-client/pull/7652) + +- Reactivate forgotten reactive variables whenever `InMemoryCache` acquires its first watcher.
    + [@benjamn](https://github.com/benjamn) in [#7657](https://github.com/apollographql/apollo-client/pull/7657) + +- Backport `Symbol.species` fix for `Concast` and `ObservableQuery` from [`release-3.4`](https://github.com/apollographql/apollo-client/pull/7399), fixing subscriptions in React Native Android when the Hermes JavaScript engine is enabled (among other benefits).
    + [@benjamn](https://github.com/benjamn) in [#7403](https://github.com/apollographql/apollo-client/pull/7403) and [#7660](https://github.com/apollographql/apollo-client/pull/7660) + +## Apollo Client 3.3.7 + +### Bug Fixes + +- Fix a regression due to [#7310](https://github.com/apollographql/apollo-client/pull/7310) that caused `loading` always to be `true` for `skip: true` results during server-side rendering.
    + [@rgrove](https://github.com/rgrove) in [#7567](https://github.com/apollographql/apollo-client/pull/7567) + +- Avoid duplicate `useReactiveVar` listeners when rendering in `React.StrictMode`.
    + [@jcreighton](https://github.com/jcreighton) in [#7581](https://github.com/apollographql/apollo-client/pull/7581) + +### Improvements + +- Set `displayName` on `ApolloContext` objects for easier debugging.
    + [@dulmandakh](https://github.com/dulmandakh) in [#7550](https://github.com/apollographql/apollo-client/pull/7550) + +## Apollo Client 3.3.6 + +### Bug Fixes + +- Immediately apply `queryType: true`, `mutationType: true`, and `subscriptionType: true` type policies, rather than waiting for the first time the policy is used, fixing a [regression](https://github.com/apollographql/apollo-client/issues/7443) introduced by [#7065](https://github.com/apollographql/apollo-client/pull/7065).
    + [@benjamn](https://github.com/benjamn) in [#7463](https://github.com/apollographql/apollo-client/pull/7463) + +- Check that `window` is defined even when `connectToDevTools` is `true`.
    + [@yasupeke](https://github.com/yasupeke) in [#7434](https://github.com/apollographql/apollo-client/pull/7434) + +### Improvements + +- Replace stray `console.debug` (undefined in React Native) with `invariant.log`.
    + [@benjamn](https://github.com/benjamn) in [#7454](https://github.com/apollographql/apollo-client/pull/7454) + +- Suggest Firefox Apollo DevTools as well as the Chrome extension.
    + [@benjamn](https://github.com/benjamn) in [#7461](https://github.com/apollographql/apollo-client/pull/7461) + +## Apollo Client 3.3.5 + +### Improvements + +- Restore `client.version` property, reflecting the current `@apollo/client` version from `package.json`.
    + [@benjamn](https://github.com/benjamn) in [#7448](https://github.com/apollographql/apollo-client/pull/7448) + +## Apollo Client 3.3.4 + +### Improvements + +- Update `ts-invariant` to avoid potential [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)-violating `Function` fallback, thanks to [a clever new `globalThis` polyfill technique](https://mathiasbynens.be/notes/globalthis).
    + [@benjamn](https://github.com/benjamn) in [#7414](https://github.com/apollographql/apollo-client/pull/7414) + +## Apollo Client 3.3.3 + +### Bug fixes + +- Make the `observer` parameter of `ApolloLink#onError` optional, fixing an unnecessary breaking change for any code that called `onError` directly.
    + [@benjamn](https://github.com/benjamn) in [#7407](https://github.com/apollographql/apollo-client/pull/7407) + +## Apollo Client 3.3.2 + +> ⚠️ **Note:** This version of `@apollo/client` contains no behavioral changes since version 3.3.1 + +### Documentation + +- The [Pagination](https://www.apollographql.com/docs/react/pagination/overview/) article has been completely rewritten (and split into multiple pages) to cover Apollo Client 3 field policies.
    + [@benjamn](https://github.com/benjamn) and [@StephenBarlow](https://github.com/StephenBarlow) in [#7175](https://github.com/apollographql/apollo-client/pull/7175) + +- Revamp [local state tutorial chapter](https://www.apollographql.com/tutorials/fullstack-quickstart/managing-local-state) for Apollo Client 3, including reactive variables.
    + [@StephenBarlow](https://github.com/StephenBarlow) in [`apollographql@apollo#1050`](https://github.com/apollographql/apollo/pull/1050) + +- Add examples of using `ApolloLink` to modify response data asynchronously.
    + [@alichry](https://github.com/alichry) in [#7332](https://github.com/apollographql/apollo-client/pull/7332) + +- Consolidate separate v2.4, v2.5, and v2.6 documentation versions into one v2 version.
    + [@jgarrow](https://github.com/jgarrow) in [#7378](https://github.com/apollographql/apollo-client/pull/7378) + +## Apollo Client 3.3.1 + +### Bug Fixes + +- Revert back to `default`-importing `React` internally, rather than using a namespace import.
    + [@benjamn](https://github.com/benjamn) in [113475b1](https://github.com/apollographql/apollo-client/commit/113475b163a19a40a67465c11e8e6f48a1de7e76) + +## Apollo Client 3.3.0 + +### Bug Fixes + +- Update `@wry/equality` to consider undefined properties equivalent to missing properties.
    + [@benjamn](https://github.com/benjamn) in [#7108](https://github.com/apollographql/apollo-client/pull/7108) + +- Prevent memory leaks involving unused `onBroadcast` function closure created in `ApolloClient` constructor.
    + [@kamilkisiela](https://github.com/kamilkisiela) in [#7161](https://github.com/apollographql/apollo-client/pull/7161) + +- Provide default empty cache object for root IDs like `ROOT_QUERY`, to avoid differences in behavior before/after `ROOT_QUERY` data has been written into `InMemoryCache`.
    + [@benjamn](https://github.com/benjamn) in [#7100](https://github.com/apollographql/apollo-client/pull/7100) + +- Cancel `queryInfo.notifyTimeout` in `QueryInfo#markResult` to prevent unnecessary network requests when using a `FetchPolicy` of `cache-and-network` or `network-only` in a React component with multiple `useQuery` calls.
    + [@benjamn](https://github.com/benjamn) in [#7347](https://github.com/apollographql/apollo-client/pull/7347) + +### Potentially breaking changes + +- Ensure `cache.readQuery` and `cache.readFragment` always return `TData | null`, instead of throwing `MissingFieldError` exceptions when missing fields are encountered.
    + [@benjamn](https://github.com/benjamn) in [#7098](https://github.com/apollographql/apollo-client/pull/7098) + + > Since this change converts prior exceptions to `null` returns, and since `null` was already a possible return value according to the `TData | null` return type, we are confident this change will be backwards compatible (as long as `null` was properly handled before). + +- `HttpLink` will now automatically strip any unused `variables` before sending queries to the GraphQL server, since those queries are very likely to fail validation, according to the [All Variables Used](https://spec.graphql.org/draft/#sec-All-Variables-Used) rule in the GraphQL specification. If you depend on the preservation of unused variables, you can restore the previous behavior by passing `includeUnusedVariables: true` to the `HttpLink` constructor (which is typically passed as `options.link` to the `ApolloClient` constructor).
    + [@benjamn](https://github.com/benjamn) in [#7127](https://github.com/apollographql/apollo-client/pull/7127) + +- Ensure `MockLink` (used by `MockedProvider`) returns mock configuration errors (e.g. `No more mocked responses for the query ...`) through the Link's `Observable`, instead of throwing them. These errors are now available through the `error` property of a result.
    + [@hwillson](https://github.com/hwillson) in [#7110](https://github.com/apollographql/apollo-client/pull/7110) + + > Returning mock configuration errors through the Link's `Observable` was the default behavior in Apollo Client 2.x. We changed it for 3, but the change has been problematic for those looking to migrate from 2.x to 3. We've decided to change this back with the understanding that not many people want or are relying on `MockLink`'s throwing exception approach. If you want to change this functionality, you can define custom error handling through `MockLink.setOnError`. + +- Unsubscribing the last observer from an `ObservableQuery` will once again unsubscribe from the underlying network `Observable` in all cases, as in Apollo Client 2.x, allowing network requests to be cancelled by unsubscribing.
    + [@javier-garcia-meteologica](https://github.com/javier-garcia-meteologica) in [#7165](https://github.com/apollographql/apollo-client/pull/7165) and [#7170](https://github.com/apollographql/apollo-client/pull/7170). + +- The independent `QueryBaseOptions` and `ModifiableWatchQueryOptions` interface supertypes have been eliminated, and their fields are now defined by `QueryOptions`.
    + [@DCtheTall](https://github.com/DCtheTall) in [#7136](https://github.com/apollographql/apollo-client/pull/7136) + +- Internally, Apollo Client now avoids nested imports from the `graphql` package, importing everything from the top-level package instead. For example, + ```ts + import { visit } from "graphql/language/visitor"; + ``` + is now just + ```ts + import { visit } from "graphql"; + ``` + Since the `graphql` package uses `.mjs` modules, your bundler may need to be configured to recognize `.mjs` files as ECMAScript modules rather than CommonJS modules.
    + [@benjamn](https://github.com/benjamn) in [#7185](https://github.com/apollographql/apollo-client/pull/7185) + +### Improvements + +- Support inheritance of type and field policies, according to `possibleTypes`.
    + [@benjamn](https://github.com/benjamn) in [#7065](https://github.com/apollographql/apollo-client/pull/7065) + +- Allow configuring custom `merge` functions, including the `merge: true` and `merge: false` shorthands, in type policies as well as field policies.
    + [@benjamn](https://github.com/benjamn) in [#7070](https://github.com/apollographql/apollo-client/pull/7070) + +- The verbosity of Apollo Client console messages can be globally adjusted using the `setLogVerbosity` function: + + ```ts + import { setLogVerbosity } from "@apollo/client"; + setLogVerbosity("log"); // display all messages + setLogVerbosity("warn"); // display only warnings and errors (default) + setLogVerbosity("error"); // display only errors + setLogVerbosity("silent"); // hide all console messages + ``` + + Remember that all logs, warnings, and errors are hidden in production.
    + [@benjamn](https://github.com/benjamn) in [#7226](https://github.com/apollographql/apollo-client/pull/7226) + +- Modifying `InMemoryCache` fields that have `keyArgs` configured will now invalidate only the field value with matching key arguments, rather than invalidating all field values that share the same field name. If `keyArgs` has not been configured, the cache must err on the side of invalidating by field name, as before.
    + [@benjamn](https://github.com/benjamn) in [#7351](https://github.com/apollographql/apollo-client/pull/7351) + +- Shallow-merge `options.variables` when combining existing or default options with newly-provided options, so new variables do not completely overwrite existing variables.
    + [@amannn](https://github.com/amannn) in [#6927](https://github.com/apollographql/apollo-client/pull/6927) + +- Avoid displaying `Cache data may be lost...` warnings for scalar field values that happen to be objects, such as JSON data.
    + [@benjamn](https://github.com/benjamn) in [#7075](https://github.com/apollographql/apollo-client/pull/7075) + +- In addition to the `result.data` property, `useQuery` and `useLazyQuery` will now provide a `result.previousData` property, which can be useful when a network request is pending and `result.data` is undefined, since `result.previousData` can be rendered instead of rendering an empty/loading state.
    + [@hwillson](https://github.com/hwillson) in [#7082](https://github.com/apollographql/apollo-client/pull/7082) + +- Passing `validate: true` to the `SchemaLink` constructor will enable validation of incoming queries against the local schema before execution, returning validation errors in `result.errors`, just like a non-local GraphQL endpoint typically would.
    + [@amannn](https://github.com/amannn) in [#7094](https://github.com/apollographql/apollo-client/pull/7094) + +- Allow optional arguments in `keyArgs: [...]` arrays for `InMemoryCache` field policies.
    + [@benjamn](https://github.com/benjamn) in [#7109](https://github.com/apollographql/apollo-client/pull/7109) + +- Avoid registering `QueryPromise` when `skip` is `true` during server-side rendering.
    + [@izumin5210](https://github.com/izumin5210) in [#7310](https://github.com/apollographql/apollo-client/pull/7310) + +- `ApolloCache` objects (including `InMemoryCache`) may now be associated with or disassociated from individual reactive variables by calling `reactiveVar.attachCache(cache)` and/or `reactiveVar.forgetCache(cache)`.
    + [@benjamn](https://github.com/benjamn) in [#7350](https://github.com/apollographql/apollo-client/pull/7350) + +## Apollo Client 3.2.9 + +### Bug Fixes + +- Revert back to `default`-importing `React` internally, rather than using a namespace import.
    + [@benjamn](https://github.com/benjamn) in [113475b1](https://github.com/apollographql/apollo-client/commit/113475b163a19a40a67465c11e8e6f48a1de7e76) + +## Apollo Client 3.2.8 + +### Bug Fixes + +- Ensure `sourcesContent` array is properly defined in `.js.map` files generated by `tsc`.
    + [@benjamn](https://github.com/benjamn) in [#7371](https://github.com/apollographql/apollo-client/pull/7371) + +- Avoid relying on global `Symbol` properties in `ApolloContext.ts`.
    + [@benjamn](https://github.com/benjamn) in [#7371](https://github.com/apollographql/apollo-client/pull/7371) + +## Apollo Client 3.2.7 + +### Bug Fixes + +- Revert updating `symbol-observable` from version 2.x to version 3, which caused TypeScript errors with some `@types/node` versions, especially in Angular applications.
    + [@benjamn](https://github.com/benjamn) in [#7340](https://github.com/apollographql/apollo-client/pull/7340) + +## Apollo Client 3.2.6 + +### Bug Fixes + +- Always consider singleton IDs like `ROOT_QUERY` and `ROOT_MUTATION` to be root IDs during `cache.gc` garbage collection, regardless of whether they have been retained or released.
    + [@benjamn](https://github.com/benjamn) in [#7333](https://github.com/apollographql/apollo-client/pull/7333) + +- Use optional chaining syntax (`this.currentObservable?.refetch`) in React `refetch` wrapper function to avoid crashing when an unmounted component is accidentally refetched.
    + [@tm1000](https://github.com/tm1000) in [#6314](https://github.com/apollographql/apollo-client/pull/6314) and + [@linmic](https://github.com/linmic) in [#7186](https://github.com/apollographql/apollo-client/pull/7186) + +### Improvements + +- Handle older `react-apollo` package in `codemods/ac2-to-ac3/imports.js` migration script.
    + [@tm1000](https://github.com/tm1000) in [#7216](https://github.com/apollographql/apollo-client/pull/7216) + +- Ensure `relayStylePagination` preserves `pageInfo.{start,end}Cursor` if `edges` is missing or empty.
    + [@beaucollins](https://github.com/beaucollins) in [#7224](https://github.com/apollographql/apollo-client/pull/7224) + +## Apollo Client 3.2.5 + +### Improvements + +- Move `terser` dependency from `dependencies` to `devDependencies`.
    + [@SimenB](https://github.com/SimenB) in [#7188](https://github.com/apollographql/apollo-client/pull/7188) + +- Avoid all sub-package imports from the `graphql` npm package.
    + [@stoically](https://github.com/stoically) in [#7185](https://github.com/apollographql/apollo-client/pull/7185) + +## Apollo Client 3.2.4 + +### Improvements + +- Update the `optimism` npm dependency to version 0.13.0 in order to use the new `optimistic.forget` method to fix a potential `cache.watch` memory leak.
    + [@benjamn](https://github.com/benjamn) in [#7157](https://github.com/apollographql/apollo-client/pull/7157) + +- Consider `cache.reset` a destructive method, like `cache.evict` and `cache.modify`.
    + [@joshjg](https://github.com/joshjg) in [#7150](https://github.com/apollographql/apollo-client/pull/7150) + +- Avoid refetching observerless queries with `reFetchObservableQueries`.
    + [@joshjg](https://github.com/joshjg) in [#7146](https://github.com/apollographql/apollo-client/pull/7146) + +## Apollo Client 3.2.3 + +### Improvements + +- Default `args.offset` to zero in `offsetLimitPagination`.
    + [@benjamn](https://github.com/benjamn) in [#7141](https://github.com/apollographql/apollo-client/pull/7141) + +## Apollo Client 3.2.2 + +### Bug Fixes + +- Undo `TEdgeWrapper` approach for `relayStylePagination`, introduced by [f41e9efc](https://github.com/apollographql/apollo-client/commit/f41e9efc9e061b80fe5019456c049a3c56661e87) in [#7023](https://github.com/apollographql/apollo-client/pull/7023), since it was an unintended breaking change for existing code that used `cache.modify` to interact with field data managed by `relayStylePagination`.
    + [@benjamn](https://github.com/benjamn) in [#7103](https://github.com/apollographql/apollo-client/pull/7103) + +## Apollo Client 3.2.1 + +### Bug Fixes + +- Fix `relayStylePagination` to handle the possibility that edges might be normalized `Reference` objects (uncommon).
    + [@anark](https://github.com/anark) and [@benjamn](https://github.com/benjamn) in [#7023](https://github.com/apollographql/apollo-client/pull/7023) + +- Disable "Missing cache result fields" warnings when `returnPartialData` is `true`.
    + [@hwillson](https://github.com/hwillson) in [#7055](https://github.com/apollographql/apollo-client/pull/7055) + +### Improvements + +- Mark `subscriptions-transport-ws` `peerDependency` as optional.
    + [@MasterOdin](https://github.com/MasterOdin) in [#7047](https://github.com/apollographql/apollo-client/pull/7047) + +## Apollo Client 3.2.0 + +### Bug Fixes + +- Use `options.nextFetchPolicy` internally to restore original `FetchPolicy` after polling with `fetchPolicy: "network-only"`, so that polling does not interfere with normal query watching.
    + [@benjamn](https://github.com/benjamn) in [#6893](https://github.com/apollographql/apollo-client/pull/6893) + +- Initialize `ObservableQuery` in `updateObservableQuery` even if `skip` is `true`.
    + [@mu29](https://github.com/mu29) in [#6999](https://github.com/apollographql/apollo-client/pull/6999) + +- Prevent full reobservation of queries affected by optimistic mutation updates, while still delivering results from the cache.
    + [@benjamn](https://github.com/benjamn) in [#6854](https://github.com/apollographql/apollo-client/pull/6854) + +### Improvements + +- In TypeScript, all APIs that take `DocumentNode` parameters now may alternatively take `TypeDocumentNode`. This type has the same JavaScript representation but allows the APIs to infer the data and variable types instead of requiring you to specify types explicitly at the call site.
    + [@dotansimha](https://github.com/dotansimha) in [#6720](https://github.com/apollographql/apollo-client/pull/6720) + +- Bring back an improved form of heuristic fragment matching, by allowing `possibleTypes` to specify subtype regular expression strings, which count as matches if the written result object has all the fields expected for the fragment.
    + [@benjamn](https://github.com/benjamn) in [#6901](https://github.com/apollographql/apollo-client/pull/6901) + +- Allow `options.nextFetchPolicy` to be a function that takes the current `FetchPolicy` and returns a new (or the same) `FetchPolicy`, making `nextFetchPolicy` more suitable for global use in `defaultOptions.watchQuery`.
    + [@benjamn](https://github.com/benjamn) in [#6893](https://github.com/apollographql/apollo-client/pull/6893) + +- Implement `useReactiveVar` hook for consuming reactive variables in React components.
    + [@benjamn](https://github.com/benjamn) in [#6867](https://github.com/apollographql/apollo-client/pull/6867) + +- Move `apollo-link-persisted-queries` implementation to `@apollo/client/link/persisted-queries`. Try running our [automated imports transform](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3) to handle this conversion, if you're using `apollo-link-persisted-queries`.
    + [@hwillson](https://github.com/hwillson) in [#6837](https://github.com/apollographql/apollo-client/pull/6837) + +- Disable feud-stopping logic after any `cache.evict` or `cache.modify` operation.
    + [@benjamn](https://github.com/benjamn) in + [#6817](https://github.com/apollographql/apollo-client/pull/6817) and + [#6898](https://github.com/apollographql/apollo-client/pull/6898) + +- Throw if `writeFragment` cannot identify `options.data` when no `options.id` provided.
    + [@jcreighton](https://github.com/jcreighton) in [#6859](https://github.com/apollographql/apollo-client/pull/6859) + +- Provide `options.storage` object to `cache.modify` functions, as provided to `read` and `merge` functions.
    + [@benjamn](https://github.com/benjamn) in [#6991](https://github.com/apollographql/apollo-client/pull/6991) + +- Allow `cache.modify` functions to return `details.INVALIDATE` (similar to `details.DELETE`) to invalidate the current field, causing affected queries to rerun, even if the field's value is unchanged.
    + [@benjamn](https://github.com/benjamn) in [#6991](https://github.com/apollographql/apollo-client/pull/6991) + +- Support non-default `ErrorPolicy` values (that is, `"ignore"` and `"all"`, in addition to the default value `"none"`) for mutations and subscriptions, like we do for queries.
    + [@benjamn](https://github.com/benjamn) in [#7003](https://github.com/apollographql/apollo-client/pull/7003) + +- Remove invariant forbidding a `FetchPolicy` of `cache-only` in `ObservableQuery#refetch`.
    + [@benjamn](https://github.com/benjamn) in [ccb0a79a](https://github.com/apollographql/apollo-client/pull/6774/commits/ccb0a79a588721f08bf87a131c31bf37fa3238e5), fixing [#6702](https://github.com/apollographql/apollo-client/issues/6702) + +## Apollo Client 3.1.5 + +### Bug Fixes + +- Make `ApolloQueryResult.data` field non-optional again.
    + [@benjamn](https://github.com/benjamn) in [#6997](https://github.com/apollographql/apollo-client/pull/6997) + +### Improvements + +- Allow querying `Connection` metadata without `args` in `relayStylePagination`.
    + [@anark](https://github.com/anark) in [#6935](https://github.com/apollographql/apollo-client/pull/6935) + +## Apollo Client 3.1.4 + +### Bug Fixes + +- Restrict root object identification to `ROOT_QUERY` (the ID corresponding to the root `Query` object), allowing `Mutation` and `Subscription` as user-defined types.
    + [@benjamn](https://github.com/benjamn) in [#6914](https://github.com/apollographql/apollo-client/pull/6914) + +- Prevent crash when `pageInfo` and empty `edges` are received by `relayStylePagination`.
    + [@fracmak](https://github.com/fracmak) in [#6918](https://github.com/apollographql/apollo-client/pull/6918) + +## Apollo Client 3.1.3 + +### Bug Fixes + +- Consider only `result.data` (rather than all properties of `result`) when settling cache feuds.
    + [@danReynolds](https://github.com/danReynolds) in [#6777](https://github.com/apollographql/apollo-client/pull/6777) + +### Improvements + +- Provide [jscodeshift](https://www.npmjs.com/package/jscodeshift) transform for automatically converting Apollo Client 2.x `import` declarations to use Apollo Client 3.x packages. [Instructions](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3).
    + [@dminkovsky](https://github.com/dminkovsky) and [@jcreighton](https://github.com/jcreighton) in [#6486](https://github.com/apollographql/apollo-client/pull/6486) + +## Apollo Client 3.1.2 + +### Bug Fixes + +- Avoid making network requests when `skip` is `true`.
    + [@hwillson](https://github.com/hwillson) in [#6752](https://github.com/apollographql/apollo-client/pull/6752) + +### Improvements + +- Allow `SchemaLink.Options.context` function to be `async` (or return a `Promise`).
    + [@benjamn](https://github.com/benjamn) in [#6735](https://github.com/apollographql/apollo-client/pull/6735) + +## Apollo Client 3.1.1 + +### Bug Fixes + +- Re-export cache types from `@apollo/client/core` (and thus also `@apollo/client`), again.
    + [@benjamn](https://github.com/benjamn) in [#6725](https://github.com/apollographql/apollo-client/pull/6725) + +## Apollo Client 3.1.0 + +### Bug Fixes + +- Rework interdependencies between `@apollo/client/*` entry points, so that CommonJS and ESM modules are supported equally well, without any duplication of shared code.
    + [@benjamn](https://github.com/benjamn) in [#6656](https://github.com/apollographql/apollo-client/pull/6656) and + [#6657](https://github.com/apollographql/apollo-client/pull/6657) + +- Tolerate `!==` callback functions (like `onCompleted` and `onError`) in `useQuery` options, since those functions are almost always freshly evaluated each time `useQuery` is called.
    + [@hwillson](https://github.com/hwillson) and [@benjamn](https://github.com/benjamn) in [#6588](https://github.com/apollographql/apollo-client/pull/6588) + +- Respect `context.queryDeduplication` if provided, and otherwise fall back to `client.deduplication` (as before).
    + [@igaloly](https://github.com/igaloly) in [#6261](https://github.com/apollographql/apollo-client/pull/6261) and + [@Kujawadl](https://github.com/Kujawadl) in [#6526](https://github.com/apollographql/apollo-client/pull/6526) + +- Refactor `ObservableQuery#getCurrentResult` to reenable immediate delivery of warm cache results. As part of this refactoring, the `ApolloCurrentQueryResult` type was eliminated in favor of `ApolloQueryResult`.
    + [@benjamn](https://github.com/benjamn) in [#6710](https://github.com/apollographql/apollo-client/pull/6710) + +- Avoid clobbering `defaultOptions` with `undefined` values.
    + [@benjamn](https://github.com/benjamn) in [#6715](https://github.com/apollographql/apollo-client/pull/6715) + +### Improvements + +- Apollo Client will no longer modify `options.fetchPolicy` unless you pass `options.nextFetchPolicy` to request an explicit change in `FetchPolicy` after the current request. Although this is technically a breaking change, `options.nextFieldPolicy` makes it easy to restore the old behavior (by passing `cache-first`).
    + [@benjamn](https://github.com/benjamn) in [#6712](https://github.com/apollographql/apollo-client/pull/6712), reverting [#6353](https://github.com/apollographql/apollo-client/pull/6353) + +- Errors of the form `Invariant Violation: 42` thrown in production can now be looked up much more easily, by consulting the auto-generated `@apollo/client/invariantErrorCodes.js` file specific to your `@apollo/client` version.
    + [@benjamn](https://github.com/benjamn) in [#6665](https://github.com/apollographql/apollo-client/pull/6665) + +- Make the `client` field of the `MutationResult` type non-optional, since it is always provided.
    + [@glasser](https://github.com/glasser) in [#6617](https://github.com/apollographql/apollo-client/pull/6617) + +- Allow passing an asynchronous `options.renderFunction` to `getMarkupFromTree`.
    + [@richardscarrott](https://github.com/richardscarrott) in [#6576](https://github.com/apollographql/apollo-client/pull/6576) + +- Ergonomic improvements for `merge` and `keyArgs` functions in cache field policies.
    + [@benjamn](https://github.com/benjamn) in [#6714](https://github.com/apollographql/apollo-client/pull/6714) + +## Apollo Client 3.0.2 + +### Bug Fixes + +- Avoid duplicating `graphql/execution/execute` dependency in CommonJS bundle for `@apollo/client/link/schema`, fixing `instanceof` errors reported in [#6621](https://github.com/apollographql/apollo-client/issues/6621) and [#6614](https://github.com/apollographql/apollo-client/issues/6614).
    + [@benjamn](https://github.com/benjamn) in [#6624](https://github.com/apollographql/apollo-client/pull/6624) + +## Apollo Client 3.0.1 + +### Bug Fixes + +- Make sure `useQuery` `onCompleted` is not fired when `skip` is `true`.
    + [@hwillson](https://github.com/hwillson) in [#6589](https://github.com/apollographql/apollo-client/pull/6589) + +- Revert changes to `peerDependencies` in `package.json` ([#6594](https://github.com/apollographql/apollo-client/pull/6594)), which would have allowed using incompatible future versions of `graphql` and/or `react` due to overly-permissive `>=` version constraints.
    + [@hwillson](https://github.com/hwillson) in [#6605](https://github.com/apollographql/apollo-client/pull/6605) + +# Apollo Client 3.0.0 + +## Improvements + +> ⚠️ **Note:** As of 3.0.0, Apollo Client uses a new package name: [`@apollo/client`](https://www.npmjs.com/package/@apollo/client) + +### `ApolloClient` + +- **[BREAKING]** `ApolloClient` is now only available as a named export. The default `ApolloClient` export has been removed.
    + [@hwillson](https://github.com/hwillson) in [#5425](https://github.com/apollographql/apollo-client/pull/5425) + +- **[BREAKING]** The `queryManager` property of `ApolloClient` instances is now marked as `private`, paving the way for a more aggressive redesign of its API. + +- **[BREAKING]** Apollo Client will no longer deliver "stale" results to `ObservableQuery` consumers, but will instead log more helpful errors about which cache fields were missing.
    + [@benjamn](https://github.com/benjamn) in [#6058](https://github.com/apollographql/apollo-client/pull/6058) + +- **[BREAKING]** `ApolloError`'s thrown by Apollo Client no longer prefix error messages with `GraphQL error:` or `Network error:`. To differentiate between GraphQL/network errors, refer to `ApolloError`'s public `graphQLErrors` and `networkError` properties.
    + [@lorensr](https://github.com/lorensr) in [#3892](https://github.com/apollographql/apollo-client/pull/3892) + +- **[BREAKING]** Support for the `@live` directive has been removed, but might be restored in the future if a more thorough implementation is proposed.
    + [@benjamn](https://github.com/benjamn) in [#6221](https://github.com/apollographql/apollo-client/pull/6221) + +- **[BREAKING]** Apollo Client 2.x allowed `@client` fields to be passed into the `link` chain if `resolvers` were not set in the constructor. This allowed `@client` fields to be passed into Links like `apollo-link-state`. Apollo Client 3 enforces that `@client` fields are local only, meaning they are no longer passed into the `link` chain, under any circumstances.
    + [@hwillson](https://github.com/hwillson) in [#5982](https://github.com/apollographql/apollo-client/pull/5982) + +- **[BREAKING?]** Refactor `QueryManager` to make better use of observables and enforce `fetchPolicy` more reliably.
    + [@benjamn](https://github.com/benjamn) in [#6221](https://github.com/apollographql/apollo-client/pull/6221) + +- The `updateQuery` function previously required by `fetchMore` has been deprecated with a warning, and will be removed in the next major version of Apollo Client. Please consider using a `merge` function to handle incoming data instead of relying on `updateQuery`.
    + [@benjamn](https://github.com/benjamn) in [#6464](https://github.com/apollographql/apollo-client/pull/6464) + + - Helper functions for generating common pagination-related field policies may be imported from `@apollo/client/utilities`. The most basic helper is `concatPagination`, which emulates the concatenation behavior of typical `updateQuery` functions. A more sophisticated helper is `offsetLimitPagination`, which implements offset/limit-based pagination. If you are consuming paginated data from a Relay-friendly API, use `relayStylePagination`. Feel free to use [these helper functions](https://github.com/apollographql/apollo-client/blob/main/src/utilities/policies/pagination.ts) as inspiration for your own field policies, and/or modify them to suit your needs.
    + [@benjamn](https://github.com/benjamn) in [#6465](https://github.com/apollographql/apollo-client/pull/6465) + +- Updated to work with `graphql@15`.
    + [@durchanek](https://github.com/durchanek) in [#6194](https://github.com/apollographql/apollo-client/pull/6194) and [#6279](https://github.com/apollographql/apollo-client/pull/6279)
    + [@hagmic](https://github.com/hagmic) in [#6328](https://github.com/apollographql/apollo-client/pull/6328) + +- Apollo Link core and HTTP related functionality has been merged into `@apollo/client`. Functionality that was previously available through the `apollo-link`, `apollo-link-http-common` and `apollo-link-http` packages is now directly available from `@apollo/client` (e.g. `import { HttpLink } from '@apollo/client'`). The `ApolloClient` constructor has also been updated to accept new `uri`, `headers` and `credentials` options. If `uri` is specified, Apollo Client will take care of creating the necessary `HttpLink` behind the scenes.
    + [@hwillson](https://github.com/hwillson) in [#5412](https://github.com/apollographql/apollo-client/pull/5412) + +- The `gql` template tag should now be imported from the `@apollo/client` package, rather than the `graphql-tag` package. Although the `graphql-tag` package still works for now, future versions of `@apollo/client` may change the implementation details of `gql` without a major version bump.
    + [@hwillson](https://github.com/hwillson) in [#5451](https://github.com/apollographql/apollo-client/pull/5451) + +- `@apollo/client/core` can be used to import the Apollo Client core, which includes everything the main `@apollo/client` package does, except for all React related functionality.
    + [@kamilkisiela](https://github.com/kamilkisiela) in [#5541](https://github.com/apollographql/apollo-client/pull/5541) + +- Several deprecated methods have been fully removed: + + - `ApolloClient#initQueryManager` + - `QueryManager#startQuery` + - `ObservableQuery#currentResult` + +- Apollo Client now supports setting a new `ApolloLink` (or link chain) after `new ApolloClient()` has been called, using the `ApolloClient#setLink` method.
    + [@hwillson](https://github.com/hwillson) in [#6193](https://github.com/apollographql/apollo-client/pull/6193) + +- The final time a mutation `update` function is called, it can no longer accidentally read optimistic data from other concurrent mutations, which ensures the use of optimistic updates has no lasting impact on the state of the cache after mutations have finished.
    + [@benjamn](https://github.com/benjamn) in [#6551](https://github.com/apollographql/apollo-client/pull/6551) + +- Apollo links that were previously maintained in https://github.com/apollographql/apollo-link have been merged into the Apollo Client project. They should be accessed using the new entry points listed in the [migration guide](./docs/source/migrating/apollo-client-3-migration.md).
    + [@hwillson](https://github.com/hwillson) in [#](TODO) + +### `InMemoryCache` + +> ⚠️ **Note:** `InMemoryCache` has been significantly redesigned and rewritten in Apollo Client 3.0. Please consult the [migration guide](https://www.apollographql.com/docs/react/v3.0-beta/migrating/apollo-client-3-migration/#cache-improvements) and read the new [documentation](https://www.apollographql.com/docs/react/v3.0-beta/caching/cache-configuration/) to understand everything that has been improved. + +- The `InMemoryCache` constructor should now be imported directly from `@apollo/client`, rather than from a separate package. The `apollo-cache-inmemory` package is no longer supported. + + > The `@apollo/client/cache` entry point can be used to import `InMemoryCache` without importing other parts of the Apollo Client codebase.
    > [@hwillson](https://github.com/hwillson) in [#5577](https://github.com/apollographql/apollo-client/pull/5577) + +- **[BREAKING]** `FragmentMatcher`, `HeuristicFragmentMatcher`, and `IntrospectionFragmentMatcher` have all been removed. We now recommend using `InMemoryCache`’s `possibleTypes` option instead. For more information see the [Defining `possibleTypes` manually](https://www.apollographql.com/docs/react/v3.0-beta/data/fragments/#defining-possibletypes-manually) section of the docs.
    + [@benjamn](https://github.com/benjamn) in [#5073](https://github.com/apollographql/apollo-client/pull/5073) + +- **[BREAKING]** As promised in the [Apollo Client 2.6 blog post](https://blog.apollographql.com/whats-new-in-apollo-client-2-6-b3acf28ecad1), all cache results are now frozen/immutable.
    + [@benjamn](https://github.com/benjamn) in [#5153](https://github.com/apollographql/apollo-client/pull/5153) + +- **[BREAKING]** Eliminate "generated" cache IDs to avoid normalizing objects with no meaningful ID, significantly reducing cache memory usage. This might be a backwards-incompatible change if your code depends on the precise internal representation of normalized data in the cache.
    + [@benjamn](https://github.com/benjamn) in [#5146](https://github.com/apollographql/apollo-client/pull/5146) + +- **[BREAKING]** `InMemoryCache` will no longer merge the fields of written objects unless the objects are known to have the same identity, and the values of fields with the same name will not be recursively merged unless a custom `merge` function is defined by a field policy for that field, within a type policy associated with the `__typename` of the parent object.
    + [@benjamn](https://github.com/benjamn) in [#5603](https://github.com/apollographql/apollo-client/pull/5603) + +- **[BREAKING]** `InMemoryCache` now _throws_ when data with missing or undefined query fields is written into the cache, rather than just warning in development.
    + [@benjamn](https://github.com/benjamn) in [#6055](https://github.com/apollographql/apollo-client/pull/6055) + +- **[BREAKING]** `client|cache.writeData` have been fully removed. `writeData` usage is one of the easiest ways to turn faulty assumptions about how the cache represents data internally, into cache inconsistency and corruption. `client|cache.writeQuery`, `client|cache.writeFragment`, and/or `cache.modify` can be used to update the cache.
    + [@benjamn](https://github.com/benjamn) in [#5923](https://github.com/apollographql/apollo-client/pull/5923) + +- `InMemoryCache` now supports tracing garbage collection and eviction. Note that the signature of the `evict` method has been simplified in a potentially backwards-incompatible way.
    + [@benjamn](https://github.com/benjamn) in [#5310](https://github.com/apollographql/apollo-client/pull/5310) + + - **[beta-BREAKING]** Please note that the `cache.evict` method now requires `Cache.EvictOptions`, though it previously supported positional arguments as well.
    + [@danReynolds](https://github.com/danReynolds) in [#6141](https://github.com/apollographql/apollo-client/pull/6141) + [@benjamn](https://github.com/benjamn) in [#6364](https://github.com/apollographql/apollo-client/pull/6364) + + - Removing an entity object using the `cache.evict` method does not automatically remove dangling references to that entity elsewhere in the cache, but dangling references will be automatically filtered from lists whenever those lists are read from the cache. You can define a custom field `read` function to customize this behavior. See [#6412](https://github.com/apollographql/apollo-client/pull/6412), [#6425](https://github.com/apollographql/apollo-client/pull/6425), and [#6454](https://github.com/apollographql/apollo-client/pull/6454) for further explanation. + +- Cache methods that would normally trigger a broadcast, like `cache.evict`, `cache.writeQuery`, and `cache.writeFragment`, can now be called with a named options object, which supports a `broadcast: boolean` property that can be used to silence the broadcast, for situations where you want to update the cache multiple times without triggering a broadcast each time.
    + [@benjamn](https://github.com/benjamn) in [#6288](https://github.com/apollographql/apollo-client/pull/6288) + +- `InMemoryCache` now `console.warn`s in development whenever non-normalized data is dangerously overwritten, with helpful links to documentation about normalization and custom `merge` functions.
    + [@benjamn](https://github.com/benjamn) in [#6372](https://github.com/apollographql/apollo-client/pull/6372) + +- The result caching system (introduced in [#3394](https://github.com/apollographql/apollo-client/pull/3394)) now tracks dependencies at the field level, rather than at the level of whole entity objects, allowing the cache to return identical (`===`) results much more often than before.
    + [@benjamn](https://github.com/benjamn) in [#5617](https://github.com/apollographql/apollo-client/pull/5617) + +- `InMemoryCache` now has a method called `modify` which can be used to update the value of a specific field within a specific entity object: + + ```ts + cache.modify({ + id: cache.identify(post), + fields: { + comments(comments: Reference[], { readField }) { + return comments.filter( + (comment) => idToRemove !== readField("id", comment), + ); + }, + }, + }); + ``` + + This API gracefully handles cases where multiple field values are associated with a single field name, and also removes the need for updating the cache by reading a query or fragment, modifying the result, and writing the modified result back into the cache. Behind the scenes, the `cache.evict` method is now implemented in terms of `cache.modify`.
    + [@benjamn](https://github.com/benjamn) in [#5909](https://github.com/apollographql/apollo-client/pull/5909) + and [#6178](https://github.com/apollographql/apollo-client/pull/6178) + +- `InMemoryCache` provides a new API for storing client state that can be updated from anywhere: + + ```ts + import { makeVar } from "@apollo/client"; + const v = makeVar(123); + console.log(v()); // 123 + console.log(v(v() + 1)); // 124 + console.log(v()); // 124 + v("asdf"); // TS type error + ``` + + These variables are _reactive_ in the sense that updating their values invalidates any previously cached query results that depended on the old values.
    + [@benjamn](https://github.com/benjamn) in + [#5799](https://github.com/apollographql/apollo-client/pull/5799), + [#5976](https://github.com/apollographql/apollo-client/pull/5976), and + [#6512](https://github.com/apollographql/apollo-client/pull/6512) + +- Various cache read and write performance optimizations, cutting read and write times by more than 50% in larger benchmarks.
    + [@benjamn](https://github.com/benjamn) in [#5948](https://github.com/apollographql/apollo-client/pull/5948) + +- The `cache.readQuery` and `cache.writeQuery` methods now accept an `options.id` string, which eliminates most use cases for `cache.readFragment` and `cache.writeFragment`, and skips the implicit conversion of fragment documents to query documents performed by `cache.{read,write}Fragment`.
    + [@benjamn](https://github.com/benjamn) in [#5930](https://github.com/apollographql/apollo-client/pull/5930) + +- Support `cache.identify(entity)` for easily computing entity ID strings.
    + [@benjamn](https://github.com/benjamn) in [#5642](https://github.com/apollographql/apollo-client/pull/5642) + +- Support eviction of specific entity fields using `cache.evict(id, fieldName)`.
    + [@benjamn](https://github.com/benjamn) in [#5643](https://github.com/apollographql/apollo-client/pull/5643) + +- Make `InMemoryCache#evict` remove data from all `EntityStore` layers.
    + [@benjamn](https://github.com/benjamn) in [#5773](https://github.com/apollographql/apollo-client/pull/5773) + +- Stop paying attention to `previousResult` in `InMemoryCache`.
    + [@benjamn](https://github.com/benjamn) in [#5644](https://github.com/apollographql/apollo-client/pull/5644) + +- Improve optimistic update performance by limiting cache key diversity.
    + [@benjamn](https://github.com/benjamn) in [#5648](https://github.com/apollographql/apollo-client/pull/5648) + +- Custom field `read` functions can read from neighboring fields using the `readField(fieldName)` helper, and may also read fields from other entities by calling `readField(fieldName, objectOrReference)`.
    + [@benjamn](https://github.com/benjamn) in [#5651](https://github.com/apollographql/apollo-client/pull/5651) + +- Expose cache `modify` and `identify` to the mutate `update` function.
    + [@hwillson](https://github.com/hwillson) in [#5956](https://github.com/apollographql/apollo-client/pull/5956) + +- Add a default `gc` implementation to `ApolloCache`.
    + [@justinwaite](https://github.com/justinwaite) in [#5974](https://github.com/apollographql/apollo-client/pull/5974) + +### React + +- **[BREAKING]** The `QueryOptions`, `MutationOptions`, and `SubscriptionOptions` React Apollo interfaces have been renamed to `QueryDataOptions`, `MutationDataOptions`, and `SubscriptionDataOptions` (to avoid conflicting with similarly named and exported Apollo Client interfaces). + +- **[BREAKING]** Results with `loading: true` will no longer redeliver previous data, though they may provide partial data from the cache, when available.
    + [@benjamn](https://github.com/benjamn) in [#6566](https://github.com/apollographql/apollo-client/pull/6566) + +- **[BREAKING?]** Remove `fixPolyfills.ts`, except when bundling for React Native. If you have trouble with `Map` or `Set` operations due to frozen key objects in React Native, either update React Native to version 0.59.0 (or 0.61.x, if possible) or investigate why `fixPolyfills.native.js` is not included in your bundle.
    + [@benjamn](https://github.com/benjamn) in [#5962](https://github.com/apollographql/apollo-client/pull/5962) + +- The contents of the `@apollo/react-hooks` package have been merged into `@apollo/client`, enabling the following all-in-one `import`: + + ```ts + import { ApolloClient, ApolloProvider, useQuery } from "@apollo/client"; + ``` + + [@hwillson](https://github.com/hwillson) in [#5357](https://github.com/apollographql/apollo-client/pull/5357) + +- React SSR features (previously accessed via `@apollo/react-ssr`) can now be accessed from the separate Apollo Client entry point of `@apollo/client/react/ssr`. These features are not included in the default `@apollo/client` bundle.
    + [@hwillson](https://github.com/hwillson) in [#6499](https://github.com/apollographql/apollo-client/pull/6499) + +### General + +- **[BREAKING]** Removed `graphql-anywhere` since it's no longer used by Apollo Client.
    + [@hwillson](https://github.com/hwillson) in [#5159](https://github.com/apollographql/apollo-client/pull/5159) + +- **[BREAKING]** Removed `apollo-boost` since Apollo Client 3.0 provides a boost like getting started experience out of the box.
    + [@hwillson](https://github.com/hwillson) in [#5217](https://github.com/apollographql/apollo-client/pull/5217) + +- **[BREAKING]** We are no longer exporting certain (intended to be) internal utilities. If you are depending on some of the lesser known exports from `apollo-cache`, `apollo-cache-inmemory`, or `apollo-utilities`, they may no longer be available from `@apollo/client`.
    + [@hwillson](https://github.com/hwillson) in [#5437](https://github.com/apollographql/apollo-client/pull/5437) and [#5514](https://github.com/apollographql/apollo-client/pull/5514) + + > Utilities that were previously externally available through the `apollo-utilities` package are now only available by importing from `@apollo/client/utilities`.
    > [@hwillson](https://github.com/hwillson) in [#5683](https://github.com/apollographql/apollo-client/pull/5683) + +- Make sure all `graphql-tag` public exports are re-exported.
    + [@hwillson](https://github.com/hwillson) in [#5861](https://github.com/apollographql/apollo-client/pull/5861) + +- Fully removed `prettier`. The Apollo Client team has decided to no longer automatically enforce code formatting across the codebase. In most cases existing code styles should be followed as much as possible, but this is not a hard and fast rule.
    + [@hwillson](https://github.com/hwillson) in [#5227](https://github.com/apollographql/apollo-client/pull/5227) + +- Make sure `ApolloContext` plays nicely with IE11 when storing the shared context.
    + [@ms](https://github.com/ms) in [#5840](https://github.com/apollographql/apollo-client/pull/5840) + +- Migrated React Apollo HOC and Components functionality into Apollo Client, making it accessible from `@apollo/client/react/components` and `@apollo/client/react/hoc` entry points.
    + [@hwillson](https://github.com/hwillson) in [#6558](https://github.com/apollographql/apollo-client/pull/6558) + +- Support passing a `context` object through the link execution chain when using subscriptions.
    + [@sgtpepper43](https://github.com/sgtpepper43) in [#4925](https://github.com/apollographql/apollo-client/pull/4925) + +- `MockSubscriptionLink` now supports multiple subscriptions.
    + [@dfrankland](https://github.com/dfrankland) in [#6081](https://github.com/apollographql/apollo-client/pull/6081) + +### Bug Fixes + +- `useMutation` adjustments to help avoid an infinite loop / too many renders issue, caused by unintentionally modifying the `useState` based mutation result directly.
    + [@hwillson](https://github/com/hwillson) in [#5770](https://github.com/apollographql/apollo-client/pull/5770) + +- Missing `__typename` fields no longer cause the `InMemoryCache#diff` result to be marked `complete: false`, if those fields were added by `InMemoryCache#transformDocument` (which calls `addTypenameToDocument`).
    + [@benjamn](https://github.com/benjamn) in [#5787](https://github.com/apollographql/apollo-client/pull/5787) + +- Fixed an issue that allowed `@client @export` based queries to lead to extra unnecessary network requests being fired.
    + [@hwillson](https://github.com/hwillson) in [#5946](https://github.com/apollographql/apollo-client/pull/5946) + +- Refined `useLazyQuery` types to help prevent runtime errors.
    + [@benmosher](https://github.com/benmosher) in [#5935](https://github.com/apollographql/apollo-client/pull/5935) + +- Make sure `@client @export` variables used in watched queries are updated each time the query receives new data that changes the value of the `@export` variable.
    + [@hwillson](https://github.com/hwillson) in [#5986](https://github.com/apollographql/apollo-client/pull/5986) + +- Ensure `useMutation` passes a defined `errorPolicy` option into its underlying `ApolloClient.mutate()` call.
    + [@jamesreggio](https://github.com/jamesreggio) in [#5863](https://github.com/apollographql/apollo-client/pull/5863) + +- `useQuery`: Prevent new data re-render attempts during an existing render. This helps avoid React 16.13.0's "Cannot update a component from inside the function body of a different component" warning (https://github.com/facebook/react/pull/17099).
    + [@hwillson](https://github.com/hwillson) in [#6107](https://github.com/apollographql/apollo-client/pull/6107) + +- Expand `ApolloError` typings to include `ServerError` and `ServerParseError`.
    + [@dmarkow](https://github.com/dmarkow) in [#6319](https://github.com/apollographql/apollo-client/pull/6319) + +- Fast responses received over the link chain will no longer conflict with `skip` settings.
    + [@hwillson](https://github.com/hwillson) in [#6587](https://github.com/apollographql/apollo-client/pull/6587) + +## Apollo Client 2.6.8 + +### Apollo Client (2.6.8) + +- Update the `fetchMore` type signature to accept `context`.
    + [@koenpunt](https://github.com/koenpunt) in [#5147](https://github.com/apollographql/apollo-client/pull/5147) + +- Fix type for `Resolver` and use it in the definition of `Resolvers`.
    + [@peoplenarthax](https://github.com/peoplenarthax) in [#4943](https://github.com/apollographql/apollo-client/pull/4943) + +- Local state resolver functions now receive a `fragmentMap: FragmentMap` + object, in addition to the `field: FieldNode` object, via the `info` + parameter.
    + [@mjlyons](https://github.com/mjlyons) in [#5388](https://github.com/apollographql/apollo-client/pull/5388) + +- Documentation updates.
    + [@tomquirk](https://github.com/tomquirk) in [#5645](https://github.com/apollographql/apollo-client/pull/5645)
    + [@Sequoia](https://github.com/Sequoia) in [#5641](https://github.com/apollographql/apollo-client/pull/5641)
    + [@phryneas](https://github.com/phryneas) in [#5628](https://github.com/apollographql/apollo-client/pull/5628)
    + [@AryanJ-NYC](https://github.com/AryanJ-NYC) in [#5560](https://github.com/apollographql/apollo-client/pull/5560) + +### GraphQL Anywhere (4.2.6) + +- Fix `filter` edge case involving `null`.
    + [@lifeiscontent](https://github.com/lifeiscontent) in [#5110](https://github.com/apollographql/apollo-client/pull/5110) + +### Apollo Boost (0.4.7) + +- Replace `GlobalFetch` reference with `WindowOrWorkerGlobalScope`.
    + [@abdonrd](https://github.com/abdonrd) in [#5373](https://github.com/apollographql/apollo-client/pull/5373) + +- Add `assumeImmutableResults` typing to apollo boost `PresetConfig` interface.
    + [@bencoullie](https://github.com/bencoullie) in [#5571](https://github.com/apollographql/apollo-client/pull/5571) + +## Apollo Client (2.6.4) + +### Apollo Client (2.6.4) + +- Modify `ObservableQuery` to allow queries with `notifyOnNetworkStatusChange` + to be notified when loading after an error occurs.
    + [@jasonpaulos](https://github.com/jasonpaulos) in [#4992](https://github.com/apollographql/apollo-client/pull/4992) + +- Add `graphql` as a `peerDependency` of `apollo-cache` and + `graphql-anywhere`.
    + [@ssalbdivad](https://github.com/ssalbdivad) in [#5081](https://github.com/apollographql/apollo-client/pull/5081) + +- Documentation updates.
    + [@raibima](https://github.com/raibima) in [#5132](https://github.com/apollographql/apollo-client/pull/5132)
    + [@hwillson](https://github.com/hwillson) in [#5141](https://github.com/apollographql/apollo-client/pull/5141) + +## Apollo Client (2.6.3) + +### Apollo Client (2.6.3) + +- A new `ObservableQuery.resetQueryStoreErrors()` method is now available that + can be used to clear out `ObservableQuery` query store errors.
    + [@hwillson](https://github.com/hwillson) in [#4941](https://github.com/apollographql/apollo-client/pull/4941) +- Documentation updates.
    + [@michael-watson](https://github.com/michael-watson) in [#4940](https://github.com/apollographql/apollo-client/pull/4940)
    + [@hwillson](https://github.com/hwillson) in [#4969](https://github.com/apollographql/apollo-client/pull/4969) + +## Apollo Client (2.6.1) + +### Apollo Utilities 1.3.2 + +- Reimplement `isEqual` without pulling in massive `lodash.isequal`.
    + [@benjamn](https://github.com/benjamn) in [#4924](https://github.com/apollographql/apollo-client/pull/4924) + +## Apollo Client (2.6.1) + +- In all Apollo Client packages, the compilation of `lib/bundle.esm.js` to `lib/bundle.cjs.js` and `lib/bundle.umd.js` now uses Babel instead of Rollup, since Babel correctly compiles some [edge cases](https://github.com/apollographql/apollo-client/issues/4843#issuecomment-495717720) that neither Rollup nor TypeScript compile correctly.
    + [@benjamn](https://github.com/benjamn) in [#4911](https://github.com/apollographql/apollo-client/pull/4911) + +### Apollo Cache In-Memory 1.6.1 + +- Pretend that `__typename` exists on the root Query when matching fragments.
    + [@benjamn](https://github.com/benjamn) in [#4853](https://github.com/apollographql/apollo-client/pull/4853) + +### Apollo Utilities 1.3.1 + +- The `isEqual` function has been reimplemented using the `lodash.isequal` npm package, to better support circular references. Since the `lodash.isequal` package is already used by `react-apollo`, this change is likely to decrease total bundle size.
    + [@capaj](https://github.com/capaj) in [#4915](https://github.com/apollographql/apollo-client/pull/4915) + +## Apollo Client (2.6.0) + +- In production, `invariant(condition, message)` failures will now include + a unique error code that can be used to trace the error back to the + point of failure.
    + [@benjamn](https://github.com/benjamn) in [#4521](https://github.com/apollographql/apollo-client/pull/4521) + +### Apollo Client 2.6.0 + +- If you can be sure your application code does not modify cache result objects (see `freezeResults` note below), you can unlock substantial performance improvements by communicating this assumption via + + ```ts + new ApolloClient({ assumeImmutableResults: true }); + ``` + + which allows the client to avoid taking defensive snapshots of past results using `cloneDeep`, as explained by [@benjamn](https://github.com/benjamn) in [#4543](https://github.com/apollographql/apollo-client/pull/4543). + +- Identical overlapping queries are now deduplicated internally by `apollo-client`, rather than using the `apollo-link-dedup` package.
    + [@benjamn](https://github.com/benjamn) in commit [7cd8479f](https://github.com/apollographql/apollo-client/pull/4586/commits/7cd8479f27ce38930f122e4f703c4081a75a63a7) + +- The `FetchPolicy` type has been split into two types, so that passing `cache-and-network` to `ApolloClient#query` is now forbidden at the type level, whereas previously it was forbidden by a runtime `invariant` assertion: + + ```ts + export type FetchPolicy = + | "cache-first" + | "network-only" + | "cache-only" + | "no-cache" + | "standby"; + + export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; + ``` + + The exception thrown if you ignore the type error has also been improved to explain the motivation behind this restriction.
    + [Issue #3130 (comment)](https://github.com/apollographql/apollo-client/issues/3130#issuecomment-478409066) and commit [cf069bc7](github.com/apollographql/apollo-client/commit/cf069bc7ee6577092234b0eb0ac32e05d50f5a1c) + +- Avoid updating (and later invalidating) cache watches when `fetchPolicy` is `'no-cache'`.
    + [@bradleyayers](https://github.com/bradleyayers) in [PR #4573](https://github.com/apollographql/apollo-client/pull/4573), part of [issue #3452](https://github.com/apollographql/apollo-client/issues/3452) + +- Remove temporary `queryId` after `fetchMore` completes.
    + [@doomsower](https://github.com/doomsower) in [#4440](https://github.com/apollographql/apollo-client/pull/4440) + +- Call `clearStore` callbacks after clearing store.
    + [@ds8k](https://github.com/ds8k) in [#4695](https://github.com/apollographql/apollo-client/pull/4695) + +- Perform all `DocumentNode` transforms once, and cache the results.
    + [@benjamn](https://github.com/benjamn) in [#4601](https://github.com/apollographql/apollo-client/pull/4601) + +- Accommodate `@client @export` variable changes in `ObservableQuery`.
    + [@hwillson](https://github.com/hwillson) in [#4604](https://github.com/apollographql/apollo-client/pull/4604) + +- Support the `returnPartialData` option for watched queries again.
    + [@benjamn](https://github.com/benjamn) in [#4743](https://github.com/apollographql/apollo-client/pull/4743) + +- Preserve `networkStatus` for incomplete `cache-and-network` queries.
    + [@benjamn](https://github.com/benjamn) in [#4765](https://github.com/apollographql/apollo-client/pull/4765) + +- Preserve `cache-and-network` `fetchPolicy` when refetching.
    + [@benjamn](https://github.com/benjamn) in [#4840](https://github.com/apollographql/apollo-client/pull/4840) + +- Update the React Native docs to remove the request for external example apps that we can link to. We're no longer going to manage a list of external example apps.
    + [@hwillson](https://github.com/hwillson) in [#4531](https://github.com/apollographql/apollo-client/pull/4531) + +- Polling queries are no longer batched together, so their scheduling should be more predictable.
    + [@benjamn](https://github.com/benjamn) in [#4800](https://github.com/apollographql/apollo-client/pull/4800) + +### Apollo Cache In-Memory 1.6.0 + +- Support `new InMemoryCache({ freezeResults: true })` to help enforce immutability.
    + [@benjamn](https://github.com/benjamn) in [#4514](https://github.com/apollographql/apollo-client/pull/4514) + +- Allow `IntrospectionFragmentMatcher` to match fragments against the root `Query`, as `HeuristicFragmentMatcher` does.
    + [@rynobax](https://github.com/rynobax) in [#4620](https://github.com/apollographql/apollo-client/pull/4620) + +- Rerential identity (`===`) of arrays in cache results will now be preserved for unchanged data.
    + [@benjamn](https://github.com/benjamn) in commit [f3091d6a](https://github.com/apollographql/apollo-client/pull/4586/commits/f3091d6a7e91be98549baea58903282cc540f460) + +- Avoid adding `__typename` field to `@client` selection sets that have been `@export`ed as input variables.
    + [@benjamn](https://github.com/benjamn) in [#4784](https://github.com/apollographql/apollo-client/pull/4784) + +### GraphQL Anywhere 4.2.2 + +- The `graphql` function can now be configured to ignore `@include` and + `@skip` directives (useful when walking a fragment to generate prop types + or filter result data).
    + [@GreenGremlin](https://github.com/GreenGremlin) in [#4373](https://github.com/apollographql/apollo-client/pull/4373) + +## Apollo Client 2.5.1 + +### apollo-client 2.5.1 + +- Fixes `A tuple type element list cannot be empty` issue.
    + [@benjamn](https://github.com/benjamn) in [#4502](https://github.com/apollographql/apollo-client/pull/4502) + +### graphql-anywhere 4.2.1 + +- Adds back the missing `graphql-anywhere/lib/async` entry point.
    + [@benjamn](https://github.com/benjamn) in [#4503](https://github.com/apollographql/apollo-client/pull/4503) + +## Apollo Client (2.5.0) + +### Apollo Client (2.5.0) + +- Introduces new local state management features (client-side schema + and local resolver / `@client` support) and many overall code improvements, + to help reduce the Apollo Client bundle size.
    + [#4361](https://github.com/apollographql/apollo-client/pull/4361) +- Revamped CJS and ESM bundling approach with Rollup.
    + [@rosskevin](https://github.com/rosskevin) in [#4261](https://github.com/apollographql/apollo-client/pull/4261) +- Fixes an issue where the `QueryManager` was accidentally returning cached + data for `network-only` queries.
    + [@danilobuerger](https://github.com/danilobuerger) in [#4352](https://github.com/apollographql/apollo-client/pull/4352) +- Fixed an issue in the repo `.gitattributes` that was causing binary files + to have their line endings adjusted, and cleaned up corrupted documentation + images (ref: https://github.com/apollographql/apollo-client/pull/4232).
    + [@rajington](https://github.com/rajington) in [#4438](https://github.com/apollographql/apollo-client/pull/4438) +- Improve (and shorten) query polling implementation.
    + [PR #4337](https://github.com/apollographql/apollo-client/pull/4337) + +## Apollo Client (2.4.13) + +### Apollo Client (2.4.13) + +- Resolve "invalidate" -> "invalidated" typo in `QueryManager`.
    + [@quazzie](https://github.com/quazzie) in [#4041](https://github.com/apollographql/apollo-client/pull/4041) + +- Properly type `setQuery` and fix now typed callers.
    + [@danilobuerger](https://github.com/danilobuerger) in [#4369](https://github.com/apollographql/apollo-client/pull/4369) + +- Align with the React Apollo decision that result `data` should be + `TData | undefined` instead of `TData | {}`.
    + [@danilobuerger](https://github.com/danilobuerger) in [#4356](https://github.com/apollographql/apollo-client/pull/4356) + +- Documentation updates.
    + [@danilobuerger](https://github.com/danilobuerger) in [#4340](https://github.com/apollographql/apollo-client/pull/4340)
    + [@justyn-clark](https://github.com/justyn-clark) in [#4383](https://github.com/apollographql/apollo-client/pull/4383)
    + [@jtassin](https://github.com/jtassin) in [#4287](https://github.com/apollographql/apollo-client/pull/4287)
    + [@Gongreg](https://github.com/Gongreg) in [#4386](https://github.com/apollographql/apollo-client/pull/4386)
    + [@davecardwell](https://github.com/davecardwell) in [#4399](https://github.com/apollographql/apollo-client/pull/4399)
    + [@michaelknoch](https://github.com/michaelknoch) in [#4384](https://github.com/apollographql/apollo-client/pull/4384)
    + +## Apollo Client (2.4.12) + +### Apollo Client (2.4.12) + +- Support `ApolloClient#stop` method for safe client disposal.
    + [PR #4336](https://github.com/apollographql/apollo-client/pull/4336) + +## Apollo Client (2.4.11) + +- Added explicit dependencies on the + [`tslib`](https://www.npmjs.com/package/tslib) package to all client + packages to fix + [Issue #4332](https://github.com/apollographql/apollo-client/issues/4332). + +### Apollo Client (2.4.11) + +- Reverted some breaking changes accidentally released in a patch version + (2.4.10). [PR #4334](https://github.com/apollographql/apollo-client/pull/4334) + +## Apollo Client (2.4.10) + +### Apollo Client (2.4.10) + +- The `apollo-client` package no longer exports a `printAST` function from + `graphql/language/printer`. If you need this functionality, import it + directly: `import { print } from "graphql/language/printer"` + +- Query polling now uses a simpler scheduling strategy based on a single + `setTimeout` interval rather than multiple `setInterval` timers. The new + timer fires at the rate of the fastest polling interval, and queries + with longer polling intervals fire whenever the time elapsed since they + last fired exceeds their desired interval.
    + [PR #4243](https://github.com/apollographql/apollo-client/pull/4243) + +### Apollo Cache In-Memory (1.4.1) + +- The `optimism` npm package has been updated to a version (0.6.9) that + provides its own TypeScript declarations, which should fix problems like + [Issue #4327](https://github.com/apollographql/apollo-client/issues/4327).
    + [PR #4331](https://github.com/apollographql/apollo-client/pull/4331) + +- Error messages involving GraphQL queries now print the queries using + `JSON.stringify` instead of the `print` function exported by the + `graphql` package, to avoid pulling unnecessary printing logic into your + JavaScript bundle.
    + [PR #4234](https://github.com/apollographql/apollo-client/pull/4234) + +- The `QueryKeyMaker` abstraction has been removed, meaning that cache + results for non-identical queries (or sub-queries) with equivalent + structure will no longer be cached together. This feature was a nice + optimization in certain specific use cases, but it was not worth the + additional complexity or bundle size.
    + [PR #4245](https://github.com/apollographql/apollo-client/pull/4245) + +### Apollo Utilities (1.1.1) + +- The `flattenSelections` helper function is no longer exported from + `apollo-utilities`, since `getDirectiveNames` has been reimplemented + without using `flattenSelections`, and `flattenSelections` has no clear + purpose now. If you need the old functionality, use a visitor: + + ```ts + import { visit } from "graphql/language/visitor"; + + function flattenSelections(selection: SelectionNode) { + const selections: SelectionNode[] = []; + visit(selection, { + SelectionSet(ss) { + selections.push(...ss.selections); + }, + }); + return selections; + } + ``` + +## Apollo Client (2.4.9) + +### Apollo Client (2.4.9) + +- Apollo Client has been updated to use `graphql` 14.x as a dev dependency.
    + [@hwillson](https://github.com/hwillson) in [#4233](https://github.com/apollographql/apollo-client/pull/4233) + +- The `onClearStore` function can now be used to register callbacks that should + be triggered when calling `clearStore`.
    + [@joe-re](https://github.com/joe-re) in [#4082](https://github.com/apollographql/apollo-client/pull/4082) + +- Make `isApolloError` available for external use.
    + [@FredyC](https://github.com/FredyC) in [#4223](https://github.com/apollographql/apollo-client/pull/4223) + +- The `QueryManager` now calls `complete` on the observables used by + Apollo Client's Subscription handling. This gives finite subscriptions a + chance to handle cleanup.
    + [@sujeetsr](https://github.com/sujeetsr) in [#4290](https://github.com/apollographql/apollo-client/pull/4290) + +- Documentation updates.
    + [@lifedup](https://github.com/lifedup) in [#3931](https://github.com/apollographql/apollo-client/pull/3931)
    + [@Dem0n3D](https://github.com/Dem0n3D) in [#4008](https://github.com/apollographql/apollo-client/pull/4008)
    + [@anand-sundaram-zocdoc](https://github.com/anand-sundaram-zocdoc) in [#4009](https://github.com/apollographql/apollo-client/pull/4009)
    + [@mattphoto](https://github.com/mattphoto) in [#4026](https://github.com/apollographql/apollo-client/pull/4026)
    + [@birge](https://github.com/birge) in [#4029](https://github.com/apollographql/apollo-client/pull/4029)
    + [@mxstbr](https://github.com/mxstbr) in [#4127](https://github.com/apollographql/apollo-client/pull/4127)
    + [@Caerbannog](https://github.com/Caerbannog) in [#4140](https://github.com/apollographql/apollo-client/pull/4140)
    + [@jedwards1211](https://github.com/jedwards1211) in [#4179](https://github.com/apollographql/apollo-client/pull/4179)
    + [@nutboltu](https://github.com/nutboltu) in [#4182](https://github.com/apollographql/apollo-client/pull/4182)
    + [@CarloPalinckx](https://github.com/CarloPalinckx) in [#4189](https://github.com/apollographql/apollo-client/pull/4189)
    + [@joebernard](https://github.com/joebernard) in [#4206](https://github.com/apollographql/apollo-client/pull/4206)
    + [@evans](https://github.com/evans) in [#4213](https://github.com/apollographql/apollo-client/pull/4213)
    + [@danilobuerger](https://github.com/danilobuerger) in [#4214](https://github.com/apollographql/apollo-client/pull/4214)
    + [@stubailo](https://github.com/stubailo) in [#4220](https://github.com/apollographql/apollo-client/pull/4220)
    + [@haysclark](https://github.com/haysclark) in [#4255](https://github.com/apollographql/apollo-client/pull/4255)
    + [@shelmire](https://github.com/shelmire) in [#4266](https://github.com/apollographql/apollo-client/pull/4266)
    + [@peggyrayzis](https://github.com/peggyrayzis) in [#4280](https://github.com/apollographql/apollo-client/pull/4280)
    + [@caydie-tran](https://github.com/caydie-tran) in [#4300](https://github.com/apollographql/apollo-client/pull/4300) + +### Apollo Utilities (1.1.0) + +- Transformation utilities have been refactored to work with `graphql` 14.x. + GraphQL AST's are no longer being directly modified.
    + [@hwillson](https://github.com/hwillson) in [#4233](https://github.com/apollographql/apollo-client/pull/4233) + +### Apollo Cache In-Memory (1.4.0) + +- The speed and memory usage of optimistic reads and writes has been + improved dramatically using a new layering technique that does not + require copying the non-optimistic contents of the cache.
    + [PR #4319](https://github.com/apollographql/apollo-client/pull/4319/) + +- The `RecordingCache` abstraction has been removed, and thus is no longer + exported from `apollo-cache-inmemory`.
    + [PR #4319](https://github.com/apollographql/apollo-client/pull/4319/) + +- Export the optimism `wrap` function using ES2015 export syntax, instead of + CommonJS.
    + [@ardatan](https://github.com/ardatan) in [#4158](https://github.com/apollographql/apollo-client/pull/4158) + +## Apollo Client (2.4.8) + +### Apollo Client (2.4.8) + +- Documentation and config updates.
    + [@justinanastos](https://github.com/justinanastos) in [#4187](https://github.com/apollographql/apollo-client/pull/4187)
    + [@PowerKiKi](https://github.com/PowerKiKi) in [#3693](https://github.com/apollographql/apollo-client/pull/3693)
    + [@nandito](https://github.com/nandito) in [#3865](https://github.com/apollographql/apollo-client/pull/3865) + +- Schema/AST tranformation utilities have been updated to work properly with + `@client` directives.
    + [@justinmakaila](https://github.com/justinmakaila) in [#3482](https://github.com/apollographql/apollo-client/pull/3482) + +### Apollo Cache In-Memory (1.3.12) + +- Avoid using `DepTrackingCache` for optimistic reads. + [PR #4521](https://github.com/apollographql/apollo-client/pull/4251) + +- When creating an `InMemoryCache` object, it's now possible to disable the + result caching behavior introduced in [#3394](https://github.com/apollographql/apollo-client/pull/3394), + either for diagnostic purposes or because the benefit of caching repeated + reads is not worth the extra memory usage in your application: + ```ts + new InMemoryCache({ + resultCaching: false, + }); + ``` + Part of [PR #4521](https://github.com/apollographql/apollo-client/pull/4251). + +## Apollo Client (2.4.7) + +### Apollo Client (2.4.7) + +- The `ApolloClient` constructor has been updated to accept `name` and + `version` params, that can be used to support Apollo Server [Client Awareness](https://www.apollographql.com/docs/apollo-server/v2/features/metrics.html#Client-Awareness) + functionality. These client awareness properties are passed into the + defined Apollo Link chain, and are then ultimately sent out as custom + headers with outgoing requests.
    + [@hwillson](https://github.com/hwillson) in [#4154](https://github.com/apollographql/apollo-client/pull/4154) + +### Apollo Boost (0.1.22) + +- No changes. + +### Apollo Cache (1.1.21) + +- No changes. + +### Apollo Cache In-Memory (1.3.11) + +- No changes. + +### Apollo Utilities (1.0.26) + +- No changes. + +### Graphql Anywhere (4.1.23) + +- No changes. + +## Apollo Client (2.4.6) + +### Apollo Cache In-Memory (1.3.10) + +- Added some `return`s to prevent errors with `noImplicitReturns` + TypeScript rule. + [PR #4137](https://github.com/apollographql/apollo-client/pull/4137) + +- Exclude the `src/` directory when publishing `apollo-cache-inmemory`. + [Issue #4083](https://github.com/apollographql/apollo-client/issues/4083) + +## Apollo Client (2.4.5) + +- Optimistic tests cleanup. + [PR #3834](https://github.com/apollographql/apollo-client/pull/3834) by + [@joshribakoff](https://github.com/joshribakoff) + +- Documentation updates. + [PR #3840](https://github.com/apollographql/apollo-client/pull/3840) by + [@chentsulin](https://github.com/chentsulin) and + [PR #3844](https://github.com/apollographql/apollo-client/pull/3844) by + [@lorensr](https://github.com/lorensr) + +- Implement `ObservableQuery#isDifferentFromLastResult` to fix + [Issue #4054](https://github.com/apollographql/apollo-client/issues/4054) and + [Issue #4031](https://github.com/apollographql/apollo-client/issues/4031). + [PR #4069](https://github.com/apollographql/apollo-client/pull/4069) + +### Apollo Cache (1.1.20) + +- Add `readQuery` test to make sure options aren't mutated. + [@CarloPalinckx](https://github.com/CarloPalinckx) in + [#3838](https://github.com/apollographql/apollo-client/pull/3838) + +### Apollo Cache In-Memory (1.3.9) + +- Avoid modifying source objects when merging cache results. + [Issue #4081](https://github.com/apollographql/apollo-client/issues/4081) + [PR #4089](https://github.com/apollographql/apollo-client/pull/4089) + +### Apollo Utilities (1.0.25) + +- Fix `apollo-utilities` `isEqual` bug due to missing `hasOwnProperty` + check. [PR #4072](https://github.com/apollographql/apollo-client/pull/4072) + by [@samkline](https://github.com/samkline) + +## Apollo Client (2.4.4) + +### Apollo Utilities (1.0.24) + +- Discard property accessor functions in `cloneDeep` helper, to fix + [issue #4034](https://github.com/apollographql/apollo-client/issues/4034). + +- Unconditionally remove `cloneDeep` property accessors. + [PR #4039](https://github.com/apollographql/apollo-client/pull/4039) + +- Avoid copying non-enumerable and/or `Symbol` keys in `cloneDeep`. + [PR #4052](https://github.com/apollographql/apollo-client/pull/4052) + +### Apollo Cache In-Memory (1.3.7) + +- Throw when querying non-scalar objects without a selection set. + [Issue #4025](https://github.com/apollographql/apollo-client/issues/4025) + [PR #4038](https://github.com/apollographql/apollo-client/pull/4038) + +- Work around spec non-compliance of `Map#set` and `Set#add` in IE11. + [Issue #4024](https://github.com/apollographql/apollo-client/issues/4024) + [PR #4012](https://github.com/apollographql/apollo-client/pull/4012) + +## Apollo Client (2.4.3) + +- Add additional checks to make sure we don't try to set the network status + of queries in the store, when the store doesn't exist.
    + [@i6mi6](https://github.com/i6mi6) in [#3914](https://github.com/apollographql/apollo-client/pull/3914) +- Documentation updates.
    + [@shanonvl](https://github.com/shanonvl) in [#3925](https://github.com/apollographql/apollo-client/pull/3925)
    + [@ojh102](https://github.com/ojh102) in [#3920](https://github.com/apollographql/apollo-client/pull/3920)
    + [@Bkucera](https://github.com/Bkucera) in [#3919](https://github.com/apollographql/apollo-client/pull/3919)
    + [@j4chou](https://github.com/j4chou) in [#3915](https://github.com/apollographql/apollo-client/pull/3915)
    + [@billfienberg](https://github.com/billfienberg) in [#3886](https://github.com/apollographql/apollo-client/pull/3886)
    + [@TLadd](https://github.com/TLadd) in [#3884](https://github.com/apollographql/apollo-client/pull/3884) + +- The `ObservableQuery` class now makes a deep clone of `lastResult` when + first received, so that the `isDifferentResult` logic will not be + confused if the result object is modified later. + [Issue #3992](https://github.com/apollographql/apollo-client/issues/3992) + [PR #4032](https://github.com/apollographql/apollo-client/pull/4032/commits/e66027c5341dc7aaf71ee7ffcba1305b9a553525) + +### Apollo Cache In-Memory (1.3.6) + +- Optimize repeated `apollo-cache-inmemory` reads by caching partial query + results, for substantial performance improvements. As a consequence, watched + queries will not be rebroadcast unless the data have changed. + [PR #3394](https://github.com/apollographql/apollo-client/pull/3394) + +- Include root ID and fragment matcher function in cache keys computed by + `StoreReader#executeStoreQuery` and `executeSelectionSet`, and work + around bugs in the React Native `Map` and `Set` polyfills. + [PR #3964](https://github.com/apollographql/apollo-client/pull/3964) + [React Native PR #21492 (pending)](https://github.com/facebook/react-native/pull/21492) + +- The `apollo-cache-inmemory` package now allows `graphql@^14.0.0` as a + peer dependency. + [Issue #3978](https://github.com/apollographql/apollo-client/issues/3978) + +- The `apollo-cache-inmemory` package now correctly broadcasts changes + even when the new data is `===` to the old data, since the contents of + the data object may have changed. + [Issue #3992](https://github.com/apollographql/apollo-client/issues/3992) + [PR #4032](https://github.com/apollographql/apollo-client/pull/4032/commits/d6a673fbc1444e115e90cc9e4c7fa3fc67bb7e56) + +### Apollo GraphQL Anywhere (4.1.20) + +- Make `graphql-anywhere` `filter` function generic (typescript).
    + [@minznerjosh](https://github.com/minznerjosh) in [#3929](https://github.com/apollographql/apollo-client/pull/3929) + +### Apollo Utilities (1.0.22) + +- The `fclone` package has been replaced with a custom `cloneDeep` + implementation that is tolerant of cycles, symbol properties, and + non-enumerable properties. + [PR #4032](https://github.com/apollographql/apollo-client/pull/4032/commits/78e2ad89f950da2829f49c7876f968adb2bc1302) + +### Apollo Boost (0.1.17) + +- Remove duplicate InMemoryCache export for Babel 6 compatibility. + [Issue #3910](https://github.com/apollographql/apollo-client/issues/3910) + [PR #3932](https://github.com/apollographql/apollo-client/pull/3932) + +### Apollo Cache (1.1.18) + +- No changes. + +## Apollo Client (2.4.2) + +### Apollo Client (2.4.2) + +- Apollo Client no longer deep freezes query results. + [@hwillson](https://github.com/hwillson) in [#3883](https://github.com/apollographql/apollo-client/pull/3883) +- A new `clearStore` method has been added, that will remove all data from + the store. Unlike `resetStore`, it will not refetch active queries after + removing store data. + [@hwillson](https://github.com/hwillson) in [#3885](https://github.com/apollographql/apollo-client/pull/3885) + +### Apollo Utilities (1.0.21) + +- Replace the custom `cloneDeep` implementation with + [`fclone`](https://www.npmjs.com/package/fclone), to avoid crashing when + encountering circular references.
    + [@hwillson](https://github.com/hwillson) in [#3881](https://github.com/apollographql/apollo-client/pull/3881) + +### Apollo Boost (0.1.16) + +- No changes. + +### Apollo Cache (1.1.17) + +- No changes. + +### Apollo Cache In-Memory (1.2.10) + +- No changes. + +### Apollo GraphQL Anywhere (4.1.19) + +- No changes. + +## 2.4.1 (August 26, 2018) + +### Apollo Client (2.4.1) + +- `mutate`'s `refetchQueries` option now allows queries to include a custom + `context` option. This `context` will be used when refetching the query. + For example: + + ```js + context = { + headers: { + token: 'some auth token', + }, + }; + client.mutate({ + mutation: UPDATE_CUSTOMER_MUTATION, + variables: { + userId: user.id, + firstName, + ... + }, + refetchQueries: [{ + query: CUSTOMER_MESSAGES_QUERY, + variables: { userId: user.id }, + context, + }], + context, + }); + ``` + + The `CUSTOMER_MESSAGES_QUERY` above will be refetched using `context`. + Normally queries are refetched using the original context they were first + started with, but this provides a way to override the context, if needed.
    + [@hwillson](https://github.com/hwillson) in [#3852](https://github.com/apollographql/apollo-client/pull/3852) + +- Documentation updates.
    + [@hwillson](https://github.com/hwillson) in [#3841](https://github.com/apollographql/apollo-client/pull/3841) + +### Apollo Boost (0.1.15) + +- Various internal infrastructure changes related to building, bundling, + testing, etc. + [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817) + +### Apollo Cache (1.1.16) + +- Various internal infrastructure changes related to building, bundling, + testing, etc. + [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817) + +### Apollo Cache In-Memory (1.2.9) + +- Various internal infrastructure changes related to building, bundling, + testing, etc. + [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817) + +### Apollo Utilities (1.0.20) + +- Various internal infrastructure changes related to building, bundling, + testing, etc. + [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817) + +### Apollo GraphQL Anywhere (4.1.18) + +- Various internal infrastructure changes related to building, bundling, + testing, etc. + [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817) + +## 2.4.0 (August 17, 2018) + +### Apollo Client (2.4.0) + +- Add proper error handling for subscriptions. If you have defined an `error` + handler on your subscription observer, it will now be called when an error + comes back in a result, and the `next` handler will be skipped (similar to + how we're handling errors with mutations). Previously, the error was + just passed in the result to the `next` handler. If you don't have an + `error` handler defined, the previous functionality is maintained, meaning + the error is passed in the result, giving the next handler a chance to deal + with it. This should help address backwards compatibility (and is the reason + for the minor version bumo in this release).
    + [@clayne11](https://github.com/clayne11) in [#3800](https://github.com/apollographql/apollo-client/pull/3800) +- Allow an `optimistic` param to be passed into `ApolloClient.readQuery` and + `ApolloClient.readFragment`, that when set to `true`, will allow + optimistic results to be returned. Is `false` by default.
    + [@jay1337](https://github.com/jay1337) in [#2429](https://github.com/apollographql/apollo-client/pull/2429) +- Optimistic tests cleanup.
    + [@joshribakoff](https://github.com/joshribakoff) in [#3713](https://github.com/apollographql/apollo-client/pull/3713) +- Make sure each package has its own `.npmignore`, so they're taken into + consideration when publishing via lerna.
    + [@hwillson](https://github.com/hwillson) in [#3828](https://github.com/apollographql/apollo-client/pull/3828) +- Documentation updates.
    + [@toolness](https://github.com/toolness) in [#3804](https://github.com/apollographql/apollo-client/pull/3804)
    + [@pungggi](https://github.com/pungggi) in [#3798](https://github.com/apollographql/apollo-client/pull/3798)
    + [@lorensr](https://github.com/lorensr) in [#3748](https://github.com/apollographql/apollo-client/pull/3748)
    + [@joshribakoff](https://github.com/joshribakoff) in [#3730](https://github.com/apollographql/apollo-client/pull/3730)
    + [@yalamber](https://github.com/yalamber) in [#3819](https://github.com/apollographql/apollo-client/pull/3819)
    + [@pschreibs85](https://github.com/pschreibs85) in [#3812](https://github.com/apollographql/apollo-client/pull/3812)
    + [@msreekm](https://github.com/msreekm) in [#3808](https://github.com/apollographql/apollo-client/pull/3808)
    + [@kamaltmo](https://github.com/kamaltmo) in [#3806](https://github.com/apollographql/apollo-client/pull/3806)
    + [@lorensr](https://github.com/lorensr) in [#3739](https://github.com/apollographql/apollo-client/pull/3739)
    + [@brainkim](https://github.com/brainkim) in [#3680](https://github.com/apollographql/apollo-client/pull/3680) + +### Apollo Cache In-Memory (1.2.8) + +- Fix typo in `console.warn` regarding fragment matching error message.
    + [@combizs](https://github.com/combizs) in [#3701](https://github.com/apollographql/apollo-client/pull/3701) + +### Apollo Boost (0.1.14) + +- No changes. + +### Apollo Cache (1.1.15) + +- No changes. + +### Apollo Utilities (1.0.19) + +- No changes. + +### Apollo GraphQL Anywhere (4.1.17) + +- No changes. + +## 2.3.8 (August 9, 2018) + +### Apollo Client (2.3.8) + +- Adjusted the `graphql` peer dependency to cover explicit minor ranges. + Since the ^ operator only covers any minor version if the major version + is not 0 (since a major version of 0 is technically considered development by + semver 2), the current ^0.11.0 || ^14.0.0 graphql range doesn't cover + 0.12._ or 0.13._. This fixes the `apollo-client@X has incorrect peer dependency "graphql@^0.11.0 || ^14.0.0"` errors that people might have + seen using `graphql` 0.12.x or 0.13.x.
    + [@hwillson](https://github.com/hwillson) in [#3746](https://github.com/apollographql/apollo-client/pull/3746) +- Document `setVariables` internal API status.
    + [@PowerKiKi](https://github.com/PowerKiKi) in [#3692](https://github.com/apollographql/apollo-client/pull/3692) +- Corrected `ApolloClient.queryManager` typing as it may be `undefined`.
    + [@danilobuerger](https://github.com/danilobuerger) in [#3661](https://github.com/apollographql/apollo-client/pull/3661) +- Make sure using a `no-cache` fetch policy with subscriptions prevents data + from being cached.
    + [@hwillson](https://github.com/hwillson) in [#3773](https://github.com/apollographql/apollo-client/pull/3773) +- Fixed an issue that sometimes caused empty query results, when using the + `no-cache` fetch policy.
    + [@hwillson](https://github.com/hwillson) in [#3777](https://github.com/apollographql/apollo-client/pull/3777) +- Documentation updates.
    + [@hwillson](https://github.com/hwillson) in [#3750](https://github.com/apollographql/apollo-client/pull/3750)
    + [@hwillson](https://github.com/hwillson) in [#3754](https://github.com/apollographql/apollo-client/pull/3754)
    + [@TheMightyPenguin](https://github.com/TheMightyPenguin) in [#3725](https://github.com/apollographql/apollo-client/pull/3725)
    + [@bennypowers](https://github.com/bennypowers) in [#3668](https://github.com/apollographql/apollo-client/pull/3668)
    + [@hwillson](https://github.com/hwillson) in [#3762](https://github.com/apollographql/apollo-client/pull/3762)
    + [@chentsulin](https://github.com/chentsulin) in [#3688](https://github.com/apollographql/apollo-client/pull/3688)
    + [@chentsulin](https://github.com/chentsulin) in [#3687](https://github.com/apollographql/apollo-client/pull/3687)
    + [@ardouglass](https://github.com/ardouglass) in [#3645](https://github.com/apollographql/apollo-client/pull/3645)
    + [@hwillson](https://github.com/hwillson) in [#3764](https://github.com/apollographql/apollo-client/pull/3764)
    + [@hwillson](https://github.com/hwillson) in [#3767](https://github.com/apollographql/apollo-client/pull/3767)
    + [@hwillson](https://github.com/hwillson) in [#3774](https://github.com/apollographql/apollo-client/pull/3774)
    + [@hwillson](https://github.com/hwillson) in [#3779](https://github.com/apollographql/apollo-client/pull/3779) + +### Apollo Boost (0.1.13) + +- No changes. + +### Apollo Cache In-Memory (1.2.7) + +- No changes. + +### Apollo Cache (1.1.14) + +- No changes. + +### Apollo Utilities (1.0.18) + +- No changes. + +### Apollo GraphQL Anywhere (4.1.16) + +- No changes. + +## 2.3.7 (July 24, 2018) + +### Apollo Client (2.3.7) + +- Release 2.3.6 broke Typescript compilation. `QueryManager`'s + `getQueryWithPreviousResult` method included an invalid `variables` return + type in the auto-generated `core/QueryManager.d.ts` declaration file. The + type definition had a locally referenced path, that appears to have been + caused by the typescript compiler getting confused at compile/publish time. + `getQueryWithPreviousResult` return types are now excplicity identified, + which helps Typescript avoid the local type reference. For more details, + see https://github.com/apollographql/apollo-client/issues/3729.
    + [@hwillson](https://github.com/hwillson) in [#3731](https://github.com/apollographql/apollo-client/pull/3731) + +### Apollo Boost (0.1.12) + +- No changes. + +## 2.3.6 (July 24, 2018) + +### Apollo Client (2.3.6) + +- Documentation updates.
    + [@ananth99](https://github.com/ananth99) in [#3599](https://github.com/apollographql/apollo-client/pull/3599)
    + [@hwillson](https://github.com/hwillson) in [#3635](https://github.com/apollographql/apollo-client/pull/3635)
    + [@JakeDawkins](https://github.com/JakeDawkins) in [#3642](https://github.com/apollographql/apollo-client/pull/3642)
    + [@hwillson](https://github.com/hwillson) in [#3644](https://github.com/apollographql/apollo-client/pull/3644)
    + [@gbau](https://github.com/gbau) in [#3644](https://github.com/apollographql/apollo-client/pull/3600)
    + [@chentsulin](https://github.com/chentsulin) in [#3608](https://github.com/apollographql/apollo-client/pull/3608)
    + [@MikaelCarpenter](https://github.com/MikaelCarpenter) in [#3609](https://github.com/apollographql/apollo-client/pull/3609)
    + [@Gamezpedia](https://github.com/Gamezpedia) in [#3612](https://github.com/apollographql/apollo-client/pull/3612)
    + [@jinxac](https://github.com/jinxac) in [#3647](https://github.com/apollographql/apollo-client/pull/3647)
    + [@abernix](https://github.com/abernix) in [#3705](https://github.com/apollographql/apollo-client/pull/3705)
    + [@dandv](https://github.com/dandv) in [#3703](https://github.com/apollographql/apollo-client/pull/3703)
    + [@hwillson](https://github.com/hwillson) in [#3580](https://github.com/apollographql/apollo-client/pull/3580)
    +- Updated `graphql` `peerDependencies` to handle 14.x versions.
    + [@ivank](https://github.com/ivank) in [#3598](https://github.com/apollographql/apollo-client/pull/3598) +- Add optional generic type params for variables on low level methods.
    + [@mvestergaard](https://github.com/mvestergaard) in [#3588](https://github.com/apollographql/apollo-client/pull/3588) +- Add a new `awaitRefetchQueries` config option to the Apollo Client + `mutate` function, that when set to `true` will wait for all + `refetchQueries` to be fully refetched, before resolving the mutation + call. `awaitRefetchQueries` is `false` by default.
    + [@jzimmek](https://github.com/jzimmek) in [#3169](https://github.com/apollographql/apollo-client/pull/3169) + +### Apollo Boost (0.1.11) + +- Allow `fetch` to be given as a configuration option to `ApolloBoost`.
    + [@mbaranovski](https://github.com/mbaranovski) in [#3590](https://github.com/apollographql/apollo-client/pull/3590) +- The `apollo-boost` `ApolloClient` constructor now warns about unsupported + options.
    + [@quentin-](https://github.com/quentin-) in [#3551](https://github.com/apollographql/apollo-client/pull/3551) + +### Apollo Cache (1.1.13) + +- No changes. + +### Apollo Cache In-Memory (1.2.6) + +- Add `__typename` and `id` properties to `dataIdFromObject` parameter + (typescript)
    + [@jfurler](https://github.com/jfurler) in [#3641](https://github.com/apollographql/apollo-client/pull/3641) +- Fixed an issue caused by `dataIdFromObject` considering returned 0 values to + be falsy, instead of being a valid ID, which lead to the store not being + updated properly in some cases.
    + [@hwillson](https://github.com/hwillson) in [#3711](https://github.com/apollographql/apollo-client/pull/3711) + +### Apollo Utilities (1.0.17) + +- No changes. + +### Apollo GraphQL Anywhere (4.1.15) + +- Add support for arrays to `graphql-anywhere`'s filter utility.
    + [@jsweet314](https://github.com/jsweet314) in [#3591](https://github.com/apollographql/apollo-client/pull/3591) +- Fix `Cannot convert object to primitive value` error that was showing up + when attempting to report a missing property on an object.
    + [@benjie](https://github.com/benjie) in [#3618](https://github.com/apollographql/apollo-client/pull/3618) + +## 2.3.5 (June 19, 2018) + +### Apollo Client (2.3.5) + +- Internal code formatting updates. + - [@chentsulin](https://github.com/chentsulin) in [#3574](https://github.com/apollographql/apollo-client/pull/3574) +- Documentation updates. + - [@andtos90](https://github.com/andtos90) in [#3596](https://github.com/apollographql/apollo-client/pull/3596) + - [@serranoarevalo](https://github.com/serranoarevalo) in [#3554](https://github.com/apollographql/apollo-client/pull/3554) + - [@cooperka](https://github.com/cooperka) in [#3594](https://github.com/apollographql/apollo-client/pull/3594) + - [@pravdomil](https://github.com/pravdomil) in [#3587](https://github.com/apollographql/apollo-client/pull/3587) + - [@excitement-engineer](https://github.com/excitement-engineer) in [#3309](https://github.com/apollographql/apollo-client/pull/3309) + +### Apollo Boost (0.1.10) + +- No changes. + +### Apollo Cache (1.1.12) + +- No changes. + +### Apollo Cache In-Memory (1.2.5) + +- No changes. + +### Apollo Utilities (1.0.16) + +- Removed unnecessary whitespace from error message. + - [@mbaranovski](https://github.com/mbaranovski) in [#3593](https://github.com/apollographql/apollo-client/pull/3593) + +### Apollo GraphQL Anywhere (4.1.14) + +- No changes. + +## 2.3.4 (June 13, 2018) + +### Apollo Client (2.3.4) + +- Export the `QueryOptions` interface, to make sure it can be used by other + projects (like `apollo-angular`). +- Fixed an issue caused by typescript changes to the constructor + `defaultOptions` param, that prevented `query` defaults from passing type + checks. + ([@hwillson](https://github.com/hwillson) in [#3585](https://github.com/apollographql/apollo-client/pull/3585)) + +### Apollo Boost (0.1.9) + +- No changes + +### Apollo Cache (1.1.11) + +- No changes + +### Apollo Cache In-Memory (1.2.4) + +- No changes + +### Apollo Utilities (1.0.15) + +- No changes + +### Apollo GraphQL Anywhere (4.1.13) + +- No changes + +## 2.3.3 (June 13, 2018) + +### Apollo Client (2.3.3) + +- Typescript improvements. Made observable query parameterized on data and + variables: `ObservableQuery` + ([@excitement-engineer](https://github.com/excitement-engineer) in [#3140](https://github.com/apollographql/apollo-client/pull/3140)) +- Added optional generics to cache manipulation methods (typescript). + ([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541)) +- Typescript improvements. Created a new `QueryOptions` interface that + is now used by `ApolloClient.query` options, instead of the previous + `WatchQueryOptions` interface. This helps reduce confusion (especially + in the docs) that made it look like `ApolloClient.query` accepted + `ApolloClient.watchQuery` only options, like `pollingInterval`. + ([@hwillson](https://github.com/hwillson) in [#3569](https://github.com/apollographql/apollo-client/pull/3569)) + +### Apollo Boost (0.1.8) + +- Allow `cache` to be given as a configuration option to `ApolloBoost`. + ([@dandean](https://github.com/dandean) in [#3561](https://github.com/apollographql/apollo-client/pull/3561)) +- Allow `headers` and `credentials` to be passed in as configuration + parameters to the `apollo-boost` `ApolloClient` constructor. + ([@rzane](https://github.com/rzane) in [#3098](https://github.com/apollographql/apollo-client/pull/3098)) + +### Apollo Cache (1.1.10) + +- Added optional generics to cache manipulation methods (typescript). + ([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541)) + +### Apollo Cache In-Memory (1.2.3) + +- Added optional generics to cache manipulation methods (typescript). + ([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541)) +- Restore non-enumerability of `resultFields[ID_KEY]`. + ([@benjamn](https://github.com/benjamn) in [#3544](https://github.com/apollographql/apollo-client/pull/3544)) +- Cache query documents transformed by InMemoryCache. + ([@benjamn](https://github.com/benjamn) in [#3553](https://github.com/apollographql/apollo-client/pull/3553)) + +### Apollo Utilities (1.0.14) + +- Store key names generated by `getStoreKeyName` now leverage a more + deterministic approach to handling JSON based strings. This prevents store + key names from differing when using `args` like + `{ prop1: 'value1', prop2: 'value2' }` and + `{ prop2: 'value2', prop1: 'value1' }`. + ([@gdi2290](https://github.com/gdi2290) in [#2869](https://github.com/apollographql/apollo-client/pull/2869)) +- Avoid needless `hasOwnProperty` check in `deepFreeze`. + ([@benjamn](https://github.com/benjamn) in [#3545](https://github.com/apollographql/apollo-client/pull/3545)) + +### Apollo GraphQL Anywhere (4.1.12) + +- No new changes. + +## 2.3.2 (May 29, 2018) + +### Apollo Client (2.3.2) + +- Fix SSR and `cache-and-network` fetch policy + ([@dastoori](https://github.com/dastoori) in [#3372](https://github.com/apollographql/apollo-client/pull/3372)) +- Fixed an issue where the `updateQuery` method passed to + `ObservableQuery.fetchMore` was receiving the original query variables, + instead of the new variables that it used to fetch more data. + ([@abhiaiyer91](https://github.com/abhiaiyer91) in [#3500](https://github.com/apollographql/apollo-client/pull/3500)) +- Fixed an issue involving `Object.setPrototypeOf()` not working on JSC + (Android), by instead setting the `prototype` of `this` manually. + ([@seklyza](https://github.com/seklyza) in [#3306](https://github.com/apollographql/apollo-client/pull/3306)) +- Added safeguards to make sure `QueryStore.initQuery` and + `QueryStore.markQueryResult` don't try to set the network status of a + `fetchMoreForQueryId` query, if it does not exist in the store. This was + happening when a query component was unmounted while a `fetchMore` was still + in flight. + ([@conrad-vanl](https://github.com/conrad-vanl) in [#3367](https://github.com/apollographql/apollo-client/pull/3367), [@doomsower](https://github.com/doomsower) in [#3469](https://github.com/apollographql/apollo-client/pull/3469)) + +### Apollo Boost (0.1.7) + +- Various internal code cleanup, tooling and dependency changes. + +### Apollo Cache (1.1.9) + +- Various internal code cleanup, tooling and dependency changes. + +### Apollo Cache In-Memory (1.2.2) + +- Fixed an issue that caused fragment only queries to sometimes fail. + ([@abhiaiyer91](https://github.com/abhiaiyer91) in [#3507](https://github.com/apollographql/apollo-client/pull/3507)) +- Fixed cache invalidation for inlined mixed types in union fields within + arrays. + ([@dferber90](https://github.com/dferber90) in [#3422](https://github.com/apollographql/apollo-client/pull/3422)) + +### Apollo Utilities (1.0.13) + +- Make `maybeDeepFreeze` a little more defensive, by always using + `Object.prototype.hasOwnProperty` (to avoid cases where the object being + frozen doesn't have its own `hasOwnProperty`). + ([@jorisroling](https://github.com/jorisroling) in [#3418](https://github.com/apollographql/apollo-client/pull/3418)) +- Remove certain small internal caches to prevent memory leaks when using SSR. + ([@brunorzn](https://github.com/brunorzn) in [#3444](https://github.com/apollographql/apollo-client/pull/3444)) + +### Apollo GraphQL Anywhere (4.1.11) + +- Source files are now excluded when publishing to npm. + ([@hwillson](https://github.com/hwillson) in [#3454](https://github.com/apollographql/apollo-client/pull/3454)) diff --git a/graphql-subscription/node_modules/@apollo/client/LICENSE b/graphql-subscription/node_modules/@apollo/client/LICENSE new file mode 100644 index 0000000..c3bbeae --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2022 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/graphql-subscription/node_modules/@apollo/client/README.md b/graphql-subscription/node_modules/@apollo/client/README.md new file mode 100644 index 0000000..8340c85 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/README.md @@ -0,0 +1,51 @@ +
    + +

    + Apollo Client +

    +

    Apollo Client

    + +[![npm version](https://badge.fury.io/js/%40apollo%2Fclient.svg)](https://badge.fury.io/js/%40apollo%2Fclient) [![Build Status](https://circleci.com/gh/apollographql/apollo-client.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-client) [![Join the community](https://img.shields.io/discourse/status?label=Join%20the%20community&server=https%3A%2F%2Fcommunity.apollographql.com)](https://community.apollographql.com) [![Join our Discord server](https://img.shields.io/discord/1022972389463687228.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square)](https://discord.gg/graphos) + +
    + +Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components that fetch data via GraphQL. + +| ☑️ Apollo Client User Survey | +| :----- | +| What do you like best about Apollo Client? What needs to be improved? Please tell us by taking a [one-minute survey](https://docs.google.com/forms/d/e/1FAIpQLSczNDXfJne3ZUOXjk9Ursm9JYvhTh1_nFTDfdq3XBAFWCzplQ/viewform?usp=pp_url&entry.1170701325=Apollo+Client&entry.204965213=Readme). Your responses will help us understand Apollo Client usage and allow us to serve you better. | + +## Documentation + +All Apollo Client documentation, including React integration articles and helpful recipes, can be found at:
    +[https://www.apollographql.com/docs/react/](https://www.apollographql.com/docs/react/) + +The Apollo Client API reference can be found at:
    +[https://www.apollographql.com/docs/react/api/apollo-client/](https://www.apollographql.com/docs/react/api/apollo-client/) + +Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apollo's official learning platform:
    +[https://odyssey.apollographql.com/](https://odyssey.apollographql.com/) + +## Maintainers + +|Name|Username| +|---|---| +|Ben Newman|[@benjamn](https://github.com/benjamn)| +|Alessia Bellisario|[@alessbell](https://github.com/alessbell)| +|Jeff Auriemma|[@bignimbus](https://github.com/bignimbus)| +|Hugh Willson|[@hwillson](https://github.com/hwillson)| +|Jerel Miller|[@jerelmiller](https://github.com/jerelmiller)| +|Lenz Weber-Tronic|[@phryneas](https://github.com/phryneas)| + +## Who is Apollo? + +[Apollo](https://apollographql.com/) builds open-source software and a graph platform to unify GraphQL across your apps and services. We help you ship faster with: + +- [Apollo Studio](https://www.apollographql.com/studio/develop/) – A free, end-to-end platform for managing your GraphQL lifecycle. Track your GraphQL schemas in a hosted registry to create a source of truth for everything in your graph. Studio provides an IDE (Apollo Explorer) so you can explore data, collaborate on queries, observe usage, and safely make schema changes. +- [Apollo Federation](https://www.apollographql.com/apollo-federation) – The industry-standard open architecture for building a distributed graph. Use Apollo’s gateway to compose a unified graph from multiple subgraphs, determine a query plan, and route requests across your services. +- [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Kotlin](https://github.com/apollographql/apollo-kotlin). +- [Apollo Server](https://www.apollographql.com/docs/apollo-server/) – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments. + +## Learn how to build with Apollo + +Check out the [Odyssey](https://odyssey.apollographql.com/) learning platform, the perfect place to start your GraphQL journey with videos and interactive code challenges. Join the [Apollo Community](https://community.apollographql.com/) to interact with and get technical help from the GraphQL community. diff --git a/graphql-subscription/node_modules/@apollo/client/apollo-client.cjs b/graphql-subscription/node_modules/@apollo/client/apollo-client.cjs new file mode 100644 index 0000000..17856d7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/apollo-client.cjs @@ -0,0 +1,8661 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var tsInvariant = require('ts-invariant'); +var equal = require('@wry/equality'); +var caches = require('@wry/caches'); +var graphql = require('graphql'); +var zenObservableTs = require('zen-observable-ts'); +require('symbol-observable'); +var optimism = require('optimism'); +var trie = require('@wry/trie'); +var graphqlTag = require('graphql-tag'); +var React = require('rehackt'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal); +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +var version = "3.9.5"; + +function maybe(thunk) { + try { + return thunk(); + } + catch (_a) { } +} + +var global$1 = (maybe(function () { return globalThis; }) || + maybe(function () { return window; }) || + maybe(function () { return self; }) || + maybe(function () { return global; }) || +maybe(function () { + return maybe.constructor("return this")(); +})); + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} + +function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} + +function wrap(fn) { + return function (message) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof message === "number") { + var arg0 = message; + message = getHandledErrorMsg(arg0); + if (!message) { + message = getFallbackErrorMsg(arg0, args); + args = []; + } + } + fn.apply(void 0, [message].concat(args)); + }; +} +var invariant = Object.assign(function invariant(condition, message) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (!condition) { + tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args)); + } +}, { + debug: wrap(tsInvariant.invariant.debug), + log: wrap(tsInvariant.invariant.log), + warn: wrap(tsInvariant.invariant.warn), + error: wrap(tsInvariant.invariant.error), +}); +function newInvariantError(message) { + var optionalParams = []; + for (var _i = 1; _i < arguments.length; _i++) { + optionalParams[_i - 1] = arguments[_i]; + } + return new tsInvariant.InvariantError(getHandledErrorMsg(message, optionalParams) || + getFallbackErrorMsg(message, optionalParams)); +} +var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version); +function stringify(arg) { + return typeof arg == "string" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000)); +} +function getHandledErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return (global$1[ApolloErrorMessageHandler] && + global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify))); +} +function getFallbackErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({ + version: version, + message: message, + args: messageArgs.map(stringify), + }))); +} + +function shouldInclude(_a, variables) { + var directives = _a.directives; + if (!directives || !directives.length) { + return true; + } + return getInclusionDirectives(directives).every(function (_a) { + var directive = _a.directive, ifArgument = _a.ifArgument; + var evaledValue = false; + if (ifArgument.value.kind === "Variable") { + evaledValue = + variables && variables[ifArgument.value.name.value]; + invariant(evaledValue !== void 0, 67, directive.name.value); + } + else { + evaledValue = ifArgument.value.value; + } + return directive.name.value === "skip" ? !evaledValue : evaledValue; + }); +} +function hasDirectives(names, root, all) { + var nameSet = new Set(names); + var uniqueCount = nameSet.size; + graphql.visit(root, { + Directive: function (node) { + if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) { + return graphql.BREAK; + } + }, + }); + return all ? !nameSet.size : nameSet.size < uniqueCount; +} +function hasClientExports(document) { + return document && hasDirectives(["client", "export"], document, true); +} +function isInclusionDirective(_a) { + var value = _a.name.value; + return value === "skip" || value === "include"; +} +function getInclusionDirectives(directives) { + var result = []; + if (directives && directives.length) { + directives.forEach(function (directive) { + if (!isInclusionDirective(directive)) + return; + var directiveArguments = directive.arguments; + var directiveName = directive.name.value; + invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName); + var ifArgument = directiveArguments[0]; + invariant(ifArgument.name && ifArgument.name.value === "if", 69, directiveName); + var ifValue = ifArgument.value; + invariant(ifValue && + (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 70, directiveName); + result.push({ directive: directive, ifArgument: ifArgument }); + }); + } + return result; +} + +var canUseWeakMap = typeof WeakMap === "function" && + !maybe(function () { return navigator.product == "ReactNative" && !global.HermesInternal; }); +var canUseWeakSet = typeof WeakSet === "function"; +var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function"; +var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator; +var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === "function"; +var usingJSDOM = +maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false; +var canUseLayoutEffect = canUseDOM && !usingJSDOM; + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function getFragmentQueryDocument(document, fragmentName) { + var actualFragmentName = fragmentName; + var fragments = []; + document.definitions.forEach(function (definition) { + if (definition.kind === "OperationDefinition") { + throw newInvariantError( + 71, + definition.operation, + definition.name ? " named '".concat(definition.name.value, "'") : "" + ); + } + if (definition.kind === "FragmentDefinition") { + fragments.push(definition); + } + }); + if (typeof actualFragmentName === "undefined") { + invariant(fragments.length === 1, 72, fragments.length); + actualFragmentName = fragments[0].name.value; + } + var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([ + { + kind: "OperationDefinition", + operation: "query", + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "FragmentSpread", + name: { + kind: "Name", + value: actualFragmentName, + }, + }, + ], + }, + } + ], document.definitions, true) }); + return query; +} +function createFragmentMap(fragments) { + if (fragments === void 0) { fragments = []; } + var symTable = {}; + fragments.forEach(function (fragment) { + symTable[fragment.name.value] = fragment; + }); + return symTable; +} +function getFragmentFromSelection(selection, fragmentMap) { + switch (selection.kind) { + case "InlineFragment": + return selection; + case "FragmentSpread": { + var fragmentName = selection.name.value; + if (typeof fragmentMap === "function") { + return fragmentMap(fragmentName); + } + var fragment = fragmentMap && fragmentMap[fragmentName]; + invariant(fragment, 73, fragmentName); + return fragment || null; + } + default: + return null; + } +} + +var scheduledCleanup = new WeakSet(); +function schedule(cache) { + if (!scheduledCleanup.has(cache)) { + scheduledCleanup.add(cache); + setTimeout(function () { + cache.clean(); + scheduledCleanup.delete(cache); + }, 100); + } +} +var AutoCleanedWeakCache = function (max, dispose) { + var cache = new caches.WeakCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return caches.WeakCache.prototype.set.call(this, key, value); + }; + return cache; +}; +var AutoCleanedStrongCache = function (max, dispose) { + var cache = new caches.StrongCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return caches.StrongCache.prototype.set.call(this, key, value); + }; + return cache; +}; + +var cacheSizeSymbol = Symbol.for("apollo.cacheSize"); +var cacheSizes = tslib.__assign({}, global$1[cacheSizeSymbol]); + +var globalCaches = {}; +function registerGlobalCache(name, getSize) { + globalCaches[name] = getSize; +} +var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloClientMemoryInternals + : undefined; +var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getInMemoryCacheMemoryInternals + : undefined; +var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloCacheMemoryInternals + : undefined; +function getCurrentCacheSizes() { + var defaults = { + parser: 1000 , + canonicalStringify: 1000 , + print: 2000 , + "documentTransform.cache": 2000 , + "queryManager.getDocumentInfo": 2000 , + "PersistedQueryLink.persistedQueryHashes": 2000 , + "fragmentRegistry.transform": 2000 , + "fragmentRegistry.lookup": 1000 , + "fragmentRegistry.findFragmentSpreads": 4000 , + "cache.fragmentQueryDocuments": 1000 , + "removeTypenameFromVariables.getVariableDefinitions": 2000 , + "inMemoryCache.maybeBroadcastWatch": 5000 , + "inMemoryCache.executeSelectionSet": 50000 , + "inMemoryCache.executeSubSelectedArray": 10000 , + }; + return Object.fromEntries(Object.entries(defaults).map(function (_a) { + var k = _a[0], v = _a[1]; + return [ + k, + cacheSizes[k] || v, + ]; + })); +} +function _getApolloClientMemoryInternals() { + var _a, _b, _c, _d, _e; + if (!(globalThis.__DEV__ !== false)) + throw new Error("only supported in development mode"); + return { + limits: getCurrentCacheSizes(), + sizes: tslib.__assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: { + getDocumentInfo: this["queryManager"]["transformCache"].size, + documentTransforms: transformInfo(this["queryManager"].documentTransform), + } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)), + }; +} +function _getApolloCacheMemoryInternals() { + return { + cache: { + fragmentQueryDocuments: getWrapperInformation(this["getFragmentDoc"]), + }, + }; +} +function _getInMemoryCacheMemoryInternals() { + var fragments = this.config.fragments; + return tslib.__assign(tslib.__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this["addTypenameTransform"]), inMemoryCache: { + executeSelectionSet: getWrapperInformation(this["storeReader"]["executeSelectionSet"]), + executeSubSelectedArray: getWrapperInformation(this["storeReader"]["executeSubSelectedArray"]), + maybeBroadcastWatch: getWrapperInformation(this["maybeBroadcastWatch"]), + }, fragmentRegistry: { + findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads), + lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup), + transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform), + } }); +} +function isWrapper(f) { + return !!f && "dirtyKey" in f; +} +function getWrapperInformation(f) { + return isWrapper(f) ? f.size : undefined; +} +function isDefined(value) { + return value != null; +} +function transformInfo(transform) { + return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); }); +} +function recurseTransformInfo(transform) { + return transform ? + tslib.__spreadArray(tslib.__spreadArray([ + getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"]) + ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined) + : []; +} +function linkInfo(link) { + var _a; + return link ? + tslib.__spreadArray(tslib.__spreadArray([ + (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link) + ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined) + : []; +} + +var canonicalStringify = Object.assign(function canonicalStringify(value) { + return JSON.stringify(value, stableObjectReplacer); +}, { + reset: function () { + sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 ); + }, +}); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("canonicalStringify", function () { return sortingMap.size; }); +} +var sortingMap; +canonicalStringify.reset(); +function stableObjectReplacer(key, value) { + if (value && typeof value === "object") { + var proto = Object.getPrototypeOf(value); + if (proto === Object.prototype || proto === null) { + var keys = Object.keys(value); + if (keys.every(everyKeyInOrder)) + return value; + var unsortedKey = JSON.stringify(keys); + var sortedKeys = sortingMap.get(unsortedKey); + if (!sortedKeys) { + keys.sort(); + var sortedKey = JSON.stringify(keys); + sortedKeys = sortingMap.get(sortedKey) || keys; + sortingMap.set(unsortedKey, sortedKeys); + sortingMap.set(sortedKey, sortedKeys); + } + var sortedObject_1 = Object.create(proto); + sortedKeys.forEach(function (key) { + sortedObject_1[key] = value[key]; + }); + return sortedObject_1; + } + } + return value; +} +function everyKeyInOrder(key, i, keys) { + return i === 0 || keys[i - 1] <= key; +} + +function makeReference(id) { + return { __ref: String(id) }; +} +function isReference(obj) { + return Boolean(obj && typeof obj === "object" && typeof obj.__ref === "string"); +} +function isDocumentNode(value) { + return (isNonNullObject(value) && + value.kind === "Document" && + Array.isArray(value.definitions)); +} +function isStringValue(value) { + return value.kind === "StringValue"; +} +function isBooleanValue(value) { + return value.kind === "BooleanValue"; +} +function isIntValue(value) { + return value.kind === "IntValue"; +} +function isFloatValue(value) { + return value.kind === "FloatValue"; +} +function isVariable(value) { + return value.kind === "Variable"; +} +function isObjectValue(value) { + return value.kind === "ObjectValue"; +} +function isListValue(value) { + return value.kind === "ListValue"; +} +function isEnumValue(value) { + return value.kind === "EnumValue"; +} +function isNullValue(value) { + return value.kind === "NullValue"; +} +function valueToObjectRepresentation(argObj, name, value, variables) { + if (isIntValue(value) || isFloatValue(value)) { + argObj[name.value] = Number(value.value); + } + else if (isBooleanValue(value) || isStringValue(value)) { + argObj[name.value] = value.value; + } + else if (isObjectValue(value)) { + var nestedArgObj_1 = {}; + value.fields.map(function (obj) { + return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); + }); + argObj[name.value] = nestedArgObj_1; + } + else if (isVariable(value)) { + var variableValue = (variables || {})[value.name.value]; + argObj[name.value] = variableValue; + } + else if (isListValue(value)) { + argObj[name.value] = value.values.map(function (listValue) { + var nestedArgArrayObj = {}; + valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); + return nestedArgArrayObj[name.value]; + }); + } + else if (isEnumValue(value)) { + argObj[name.value] = value.value; + } + else if (isNullValue(value)) { + argObj[name.value] = null; + } + else { + throw newInvariantError(82, name.value, value.kind); + } +} +function storeKeyNameFromField(field, variables) { + var directivesObj = null; + if (field.directives) { + directivesObj = {}; + field.directives.forEach(function (directive) { + directivesObj[directive.name.value] = {}; + if (directive.arguments) { + directive.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); + }); + } + }); + } + var argObj = null; + if (field.arguments && field.arguments.length) { + argObj = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj, name, value, variables); + }); + } + return getStoreKeyName(field.name.value, argObj, directivesObj); +} +var KNOWN_DIRECTIVES = [ + "connection", + "include", + "skip", + "client", + "rest", + "export", + "nonreactive", +]; +var storeKeyNameStringify = canonicalStringify; +var getStoreKeyName = Object.assign(function (fieldName, args, directives) { + if (args && + directives && + directives["connection"] && + directives["connection"]["key"]) { + if (directives["connection"]["filter"] && + directives["connection"]["filter"].length > 0) { + var filterKeys = directives["connection"]["filter"] ? + directives["connection"]["filter"] + : []; + filterKeys.sort(); + var filteredArgs_1 = {}; + filterKeys.forEach(function (key) { + filteredArgs_1[key] = args[key]; + }); + return "".concat(directives["connection"]["key"], "(").concat(storeKeyNameStringify(filteredArgs_1), ")"); + } + else { + return directives["connection"]["key"]; + } + } + var completeFieldName = fieldName; + if (args) { + var stringifiedArgs = storeKeyNameStringify(args); + completeFieldName += "(".concat(stringifiedArgs, ")"); + } + if (directives) { + Object.keys(directives).forEach(function (key) { + if (KNOWN_DIRECTIVES.indexOf(key) !== -1) + return; + if (directives[key] && Object.keys(directives[key]).length) { + completeFieldName += "@".concat(key, "(").concat(storeKeyNameStringify(directives[key]), ")"); + } + else { + completeFieldName += "@".concat(key); + } + }); + } + return completeFieldName; +}, { + setStringify: function (s) { + var previous = storeKeyNameStringify; + storeKeyNameStringify = s; + return previous; + }, +}); +function argumentsObjectFromField(field, variables) { + if (field.arguments && field.arguments.length) { + var argObj_1 = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj_1, name, value, variables); + }); + return argObj_1; + } + return null; +} +function resultKeyNameFromField(field) { + return field.alias ? field.alias.value : field.name.value; +} +function getTypenameFromResult(result, selectionSet, fragmentMap) { + var fragments; + for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) { + var selection = _a[_i]; + if (isField(selection)) { + if (selection.name.value === "__typename") { + return result[resultKeyNameFromField(selection)]; + } + } + else if (fragments) { + fragments.push(selection); + } + else { + fragments = [selection]; + } + } + if (typeof result.__typename === "string") { + return result.__typename; + } + if (fragments) { + for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) { + var selection = fragments_1[_b]; + var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap); + if (typeof typename === "string") { + return typename; + } + } + } +} +function isField(selection) { + return selection.kind === "Field"; +} +function isInlineFragment(selection) { + return selection.kind === "InlineFragment"; +} + +function checkDocument(doc) { + invariant(doc && doc.kind === "Document", 74); + var operations = doc.definitions + .filter(function (d) { return d.kind !== "FragmentDefinition"; }) + .map(function (definition) { + if (definition.kind !== "OperationDefinition") { + throw newInvariantError(75, definition.kind); + } + return definition; + }); + invariant(operations.length <= 1, 76, operations.length); + return doc; +} +function getOperationDefinition(doc) { + checkDocument(doc); + return doc.definitions.filter(function (definition) { + return definition.kind === "OperationDefinition"; + })[0]; +} +function getOperationName(doc) { + return (doc.definitions + .filter(function (definition) { + return definition.kind === "OperationDefinition" && !!definition.name; + }) + .map(function (x) { return x.name.value; })[0] || null); +} +function getFragmentDefinitions(doc) { + return doc.definitions.filter(function (definition) { + return definition.kind === "FragmentDefinition"; + }); +} +function getQueryDefinition(doc) { + var queryDef = getOperationDefinition(doc); + invariant(queryDef && queryDef.operation === "query", 77); + return queryDef; +} +function getFragmentDefinition(doc) { + invariant(doc.kind === "Document", 78); + invariant(doc.definitions.length <= 1, 79); + var fragmentDef = doc.definitions[0]; + invariant(fragmentDef.kind === "FragmentDefinition", 80); + return fragmentDef; +} +function getMainDefinition(queryDoc) { + checkDocument(queryDoc); + var fragmentDefinition; + for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { + var definition = _a[_i]; + if (definition.kind === "OperationDefinition") { + var operation = definition.operation; + if (operation === "query" || + operation === "mutation" || + operation === "subscription") { + return definition; + } + } + if (definition.kind === "FragmentDefinition" && !fragmentDefinition) { + fragmentDefinition = definition; + } + } + if (fragmentDefinition) { + return fragmentDefinition; + } + throw newInvariantError(81); +} +function getDefaultValues(definition) { + var defaultValues = Object.create(null); + var defs = definition && definition.variableDefinitions; + if (defs && defs.length) { + defs.forEach(function (def) { + if (def.defaultValue) { + valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue); + } + }); + } + return defaultValues; +} + +function identity(document) { + return document; +} +var DocumentTransform = (function () { + function DocumentTransform(transform, options) { + if (options === void 0) { options = Object.create(null); } + this.resultCache = canUseWeakSet ? new WeakSet() : new Set(); + this.transform = transform; + if (options.getCacheKey) { + this.getCacheKey = options.getCacheKey; + } + this.cached = options.cache !== false; + this.resetCache(); + } + DocumentTransform.prototype.getCacheKey = function (document) { + return [document]; + }; + DocumentTransform.identity = function () { + return new DocumentTransform(identity, { cache: false }); + }; + DocumentTransform.split = function (predicate, left, right) { + if (right === void 0) { right = DocumentTransform.identity(); } + return Object.assign(new DocumentTransform(function (document) { + var documentTransform = predicate(document) ? left : right; + return documentTransform.transformDocument(document); + }, + { cache: false }), { left: left, right: right }); + }; + DocumentTransform.prototype.resetCache = function () { + var _this = this; + if (this.cached) { + var stableCacheKeys_1 = new trie.Trie(canUseWeakMap); + this.performWork = optimism.wrap(DocumentTransform.prototype.performWork.bind(this), { + makeCacheKey: function (document) { + var cacheKeys = _this.getCacheKey(document); + if (cacheKeys) { + invariant(Array.isArray(cacheKeys), 66); + return stableCacheKeys_1.lookupArray(cacheKeys); + } + }, + max: cacheSizes["documentTransform.cache"], + cache: (caches.WeakCache), + }); + } + }; + DocumentTransform.prototype.performWork = function (document) { + checkDocument(document); + return this.transform(document); + }; + DocumentTransform.prototype.transformDocument = function (document) { + if (this.resultCache.has(document)) { + return document; + } + var transformedDocument = this.performWork(document); + this.resultCache.add(transformedDocument); + return transformedDocument; + }; + DocumentTransform.prototype.concat = function (otherTransform) { + var _this = this; + return Object.assign(new DocumentTransform(function (document) { + return otherTransform.transformDocument(_this.transformDocument(document)); + }, + { cache: false }), { + left: this, + right: otherTransform, + }); + }; + return DocumentTransform; +}()); + +var printCache; +var print = Object.assign(function (ast) { + var result = printCache.get(ast); + if (!result) { + result = graphql.print(ast); + printCache.set(ast, result); + } + return result; +}, { + reset: function () { + printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 ); + }, +}); +print.reset(); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("print", function () { return (printCache ? printCache.size : 0); }); +} + +var isArray = Array.isArray; +function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} + +var TYPENAME_FIELD = { + kind: graphql.Kind.FIELD, + name: { + kind: graphql.Kind.NAME, + value: "__typename", + }, +}; +function isEmpty(op, fragmentMap) { + return (!op || + op.selectionSet.selections.every(function (selection) { + return selection.kind === graphql.Kind.FRAGMENT_SPREAD && + isEmpty(fragmentMap[selection.name.value], fragmentMap); + })); +} +function nullIfDocIsEmpty(doc) { + return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ? + null + : doc; +} +function getDirectiveMatcher(configs) { + var names = new Map(); + var tests = new Map(); + configs.forEach(function (directive) { + if (directive) { + if (directive.name) { + names.set(directive.name, directive); + } + else if (directive.test) { + tests.set(directive.test, directive); + } + } + }); + return function (directive) { + var config = names.get(directive.name.value); + if (!config && tests.size) { + tests.forEach(function (testConfig, test) { + if (test(directive)) { + config = testConfig; + } + }); + } + return config; + }; +} +function makeInUseGetterFunction(defaultKey) { + var map = new Map(); + return function inUseGetterFunction(key) { + if (key === void 0) { key = defaultKey; } + var inUse = map.get(key); + if (!inUse) { + map.set(key, (inUse = { + variables: new Set(), + fragmentSpreads: new Set(), + })); + } + return inUse; + }; +} +function removeDirectivesFromDocument(directives, doc) { + checkDocument(doc); + var getInUseByOperationName = makeInUseGetterFunction(""); + var getInUseByFragmentName = makeInUseGetterFunction(""); + var getInUse = function (ancestors) { + for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) { + if (isArray(ancestor)) + continue; + if (ancestor.kind === graphql.Kind.OPERATION_DEFINITION) { + return getInUseByOperationName(ancestor.name && ancestor.name.value); + } + if (ancestor.kind === graphql.Kind.FRAGMENT_DEFINITION) { + return getInUseByFragmentName(ancestor.name.value); + } + } + globalThis.__DEV__ !== false && invariant.error(83); + return null; + }; + var operationCount = 0; + for (var i = doc.definitions.length - 1; i >= 0; --i) { + if (doc.definitions[i].kind === graphql.Kind.OPERATION_DEFINITION) { + ++operationCount; + } + } + var directiveMatcher = getDirectiveMatcher(directives); + var shouldRemoveField = function (nodeDirectives) { + return isNonEmptyArray(nodeDirectives) && + nodeDirectives + .map(directiveMatcher) + .some(function (config) { return config && config.remove; }); + }; + var originalFragmentDefsByPath = new Map(); + var firstVisitMadeChanges = false; + var fieldOrInlineFragmentVisitor = { + enter: function (node) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + }, + }; + var docWithoutDirectiveSubtrees = graphql.visit(doc, { + Field: fieldOrInlineFragmentVisitor, + InlineFragment: fieldOrInlineFragmentVisitor, + VariableDefinition: { + enter: function () { + return false; + }, + }, + Variable: { + enter: function (node, _key, _parent, _path, ancestors) { + var inUse = getInUse(ancestors); + if (inUse) { + inUse.variables.add(node.name.value); + } + }, + }, + FragmentSpread: { + enter: function (node, _key, _parent, _path, ancestors) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + var inUse = getInUse(ancestors); + if (inUse) { + inUse.fragmentSpreads.add(node.name.value); + } + }, + }, + FragmentDefinition: { + enter: function (node, _key, _parent, path) { + originalFragmentDefsByPath.set(JSON.stringify(path), node); + }, + leave: function (node, _key, _parent, path) { + var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path)); + if (node === originalNode) { + return node; + } + if ( + operationCount > 0 && + node.selectionSet.selections.every(function (selection) { + return selection.kind === graphql.Kind.FIELD && + selection.name.value === "__typename"; + })) { + getInUseByFragmentName(node.name.value).removed = true; + firstVisitMadeChanges = true; + return null; + } + }, + }, + Directive: { + leave: function (node) { + if (directiveMatcher(node)) { + firstVisitMadeChanges = true; + return null; + } + }, + }, + }); + if (!firstVisitMadeChanges) { + return doc; + } + var populateTransitiveVars = function (inUse) { + if (!inUse.transitiveVars) { + inUse.transitiveVars = new Set(inUse.variables); + if (!inUse.removed) { + inUse.fragmentSpreads.forEach(function (childFragmentName) { + populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) { + inUse.transitiveVars.add(varName); + }); + }); + } + } + return inUse; + }; + var allFragmentNamesUsed = new Set(); + docWithoutDirectiveSubtrees.definitions.forEach(function (def) { + if (def.kind === graphql.Kind.OPERATION_DEFINITION) { + populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + } + else if (def.kind === graphql.Kind.FRAGMENT_DEFINITION && + operationCount === 0 && + !getInUseByFragmentName(def.name.value).removed) { + allFragmentNamesUsed.add(def.name.value); + } + }); + allFragmentNamesUsed.forEach(function (fragmentName) { + populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + }); + var fragmentWillBeRemoved = function (fragmentName) { + return !!( + (!allFragmentNamesUsed.has(fragmentName) || + getInUseByFragmentName(fragmentName).removed)); + }; + var enterVisitor = { + enter: function (node) { + if (fragmentWillBeRemoved(node.name.value)) { + return null; + } + }, + }; + return nullIfDocIsEmpty(graphql.visit(docWithoutDirectiveSubtrees, { + FragmentSpread: enterVisitor, + FragmentDefinition: enterVisitor, + OperationDefinition: { + leave: function (node) { + if (node.variableDefinitions) { + var usedVariableNames_1 = populateTransitiveVars( + getInUseByOperationName(node.name && node.name.value)).transitiveVars; + if (usedVariableNames_1.size < node.variableDefinitions.length) { + return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { + return usedVariableNames_1.has(varDef.variable.name.value); + }) }); + } + } + }, + }, + })); +} +var addTypenameToDocument = Object.assign(function (doc) { + return graphql.visit(doc, { + SelectionSet: { + enter: function (node, _key, parent) { + if (parent && + parent.kind === + graphql.Kind.OPERATION_DEFINITION) { + return; + } + var selections = node.selections; + if (!selections) { + return; + } + var skip = selections.some(function (selection) { + return (isField(selection) && + (selection.name.value === "__typename" || + selection.name.value.lastIndexOf("__", 0) === 0)); + }); + if (skip) { + return; + } + var field = parent; + if (isField(field) && + field.directives && + field.directives.some(function (d) { return d.name.value === "export"; })) { + return; + } + return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) }); + }, + }, + }); +}, { + added: function (field) { + return field === TYPENAME_FIELD; + }, +}); +function buildQueryFromSelectionSet(document) { + var definition = getMainDefinition(document); + var definitionOperation = definition.operation; + if (definitionOperation === "query") { + return document; + } + var modifiedDoc = graphql.visit(document, { + OperationDefinition: { + enter: function (node) { + return tslib.__assign(tslib.__assign({}, node), { operation: "query" }); + }, + }, + }); + return modifiedDoc; +} +function removeClientSetsFromDocument(document) { + checkDocument(document); + var modifiedDoc = removeDirectivesFromDocument([ + { + test: function (directive) { return directive.name.value === "client"; }, + remove: true, + }, + ], document); + return modifiedDoc; +} + +var hasOwnProperty$4 = Object.prototype.hasOwnProperty; +function mergeDeep() { + var sources = []; + for (var _i = 0; _i < arguments.length; _i++) { + sources[_i] = arguments[_i]; + } + return mergeDeepArray(sources); +} +function mergeDeepArray(sources) { + var target = sources[0] || {}; + var count = sources.length; + if (count > 1) { + var merger = new DeepMerger(); + for (var i = 1; i < count; ++i) { + target = merger.merge(target, sources[i]); + } + } + return target; +} +var defaultReconciler = function (target, source, property) { + return this.merge(target[property], source[property]); +}; +var DeepMerger = (function () { + function DeepMerger(reconciler) { + if (reconciler === void 0) { reconciler = defaultReconciler; } + this.reconciler = reconciler; + this.isObject = isNonNullObject; + this.pastCopies = new Set(); + } + DeepMerger.prototype.merge = function (target, source) { + var _this = this; + var context = []; + for (var _i = 2; _i < arguments.length; _i++) { + context[_i - 2] = arguments[_i]; + } + if (isNonNullObject(source) && isNonNullObject(target)) { + Object.keys(source).forEach(function (sourceKey) { + if (hasOwnProperty$4.call(target, sourceKey)) { + var targetValue = target[sourceKey]; + if (source[sourceKey] !== targetValue) { + var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, + source, + sourceKey], context, false)); + if (result !== targetValue) { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = result; + } + } + } + else { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = source[sourceKey]; + } + }); + return target; + } + return source; + }; + DeepMerger.prototype.shallowCopyForMerge = function (value) { + if (isNonNullObject(value)) { + if (!this.pastCopies.has(value)) { + if (Array.isArray(value)) { + value = value.slice(0); + } + else { + value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + this.pastCopies.add(value); + } + } + return value; + }; + return DeepMerger; +}()); + +function createFulfilledPromise(value) { + var promise = Promise.resolve(value); + promise.status = "fulfilled"; + promise.value = value; + return promise; +} +function createRejectedPromise(reason) { + var promise = Promise.reject(reason); + promise.catch(function () { }); + promise.status = "rejected"; + promise.reason = reason; + return promise; +} +function isStatefulPromise(promise) { + return "status" in promise; +} +function wrapPromiseWithState(promise) { + if (isStatefulPromise(promise)) { + return promise; + } + var pendingPromise = promise; + pendingPromise.status = "pending"; + pendingPromise.then(function (value) { + if (pendingPromise.status === "pending") { + var fulfilledPromise = pendingPromise; + fulfilledPromise.status = "fulfilled"; + fulfilledPromise.value = value; + } + }, function (reason) { + if (pendingPromise.status === "pending") { + var rejectedPromise = pendingPromise; + rejectedPromise.status = "rejected"; + rejectedPromise.reason = reason; + } + }); + return promise; +} + +var toString = Object.prototype.toString; +function cloneDeep(value) { + return cloneDeepHelper(value); +} +function cloneDeepHelper(val, seen) { + switch (toString.call(val)) { + case "[object Array]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + var copy_1 = val.slice(0); + seen.set(val, copy_1); + copy_1.forEach(function (child, i) { + copy_1[i] = cloneDeepHelper(child, seen); + }); + return copy_1; + } + case "[object Object]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + var copy_2 = Object.create(Object.getPrototypeOf(val)); + seen.set(val, copy_2); + Object.keys(val).forEach(function (key) { + copy_2[key] = cloneDeepHelper(val[key], seen); + }); + return copy_2; + } + default: + return val; + } +} + +function deepFreeze(value) { + var workSet = new Set([value]); + workSet.forEach(function (obj) { + if (isNonNullObject(obj) && shallowFreeze(obj) === obj) { + Object.getOwnPropertyNames(obj).forEach(function (name) { + if (isNonNullObject(obj[name])) + workSet.add(obj[name]); + }); + } + }); + return value; +} +function shallowFreeze(obj) { + if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) { + try { + Object.freeze(obj); + } + catch (e) { + if (e instanceof TypeError) + return null; + throw e; + } + } + return obj; +} +function maybeDeepFreeze(obj) { + if (globalThis.__DEV__ !== false) { + deepFreeze(obj); + } + return obj; +} + +function iterateObserversSafely(observers, method, argument) { + var observersWithMethod = []; + observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); + observersWithMethod.forEach(function (obs) { return obs[method](argument); }); +} + +function asyncMap(observable, mapFn, catchFn) { + return new zenObservableTs.Observable(function (observer) { + var promiseQueue = { + then: function (callback) { + return new Promise(function (resolve) { return resolve(callback()); }); + }, + }; + function makeCallback(examiner, key) { + return function (arg) { + if (examiner) { + var both = function () { + return observer.closed ? + 0 + : examiner(arg); + }; + promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); }); + } + else { + observer[key](arg); + } + }; + } + var handler = { + next: makeCallback(mapFn, "next"), + error: makeCallback(catchFn, "error"), + complete: function () { + promiseQueue.then(function () { return observer.complete(); }); + }, + }; + var sub = observable.subscribe(handler); + return function () { return sub.unsubscribe(); }; + }); +} + +function fixObservableSubclass(subclass) { + function set(key) { + Object.defineProperty(subclass, key, { value: zenObservableTs.Observable }); + } + if (canUseSymbol && Symbol.species) { + set(Symbol.species); + } + set("@@species"); + return subclass; +} + +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +var Concast = (function (_super) { + tslib.__extends(Concast, _super); + function Concast(sources) { + var _this = _super.call(this, function (observer) { + _this.addObserver(observer); + return function () { return _this.removeObserver(observer); }; + }) || this; + _this.observers = new Set(); + _this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + _this.handlers = { + next: function (result) { + if (_this.sub !== null) { + _this.latest = ["next", result]; + _this.notify("next", result); + iterateObserversSafely(_this.observers, "next", result); + } + }, + error: function (error) { + var sub = _this.sub; + if (sub !== null) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + _this.latest = ["error", error]; + _this.reject(error); + _this.notify("error", error); + iterateObserversSafely(_this.observers, "error", error); + } + }, + complete: function () { + var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b; + if (sub !== null) { + var value = sources.shift(); + if (!value) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + if (_this.latest && _this.latest[0] === "next") { + _this.resolve(_this.latest[1]); + } + else { + _this.resolve(); + } + _this.notify("complete"); + iterateObserversSafely(_this.observers, "complete"); + } + else if (isPromiseLike(value)) { + value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error); + } + else { + _this.sub = value.subscribe(_this.handlers); + } + } + }, + }; + _this.nextResultListeners = new Set(); + _this.cancel = function (reason) { + _this.reject(reason); + _this.sources = []; + _this.handlers.complete(); + }; + _this.promise.catch(function (_) { }); + if (typeof sources === "function") { + sources = [new zenObservableTs.Observable(sources)]; + } + if (isPromiseLike(sources)) { + sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error); + } + else { + _this.start(sources); + } + return _this; + } + Concast.prototype.start = function (sources) { + if (this.sub !== void 0) + return; + this.sources = Array.from(sources); + this.handlers.complete(); + }; + Concast.prototype.deliverLastMessage = function (observer) { + if (this.latest) { + var nextOrError = this.latest[0]; + var method = observer[nextOrError]; + if (method) { + method.call(observer, this.latest[1]); + } + if (this.sub === null && nextOrError === "next" && observer.complete) { + observer.complete(); + } + } + }; + Concast.prototype.addObserver = function (observer) { + if (!this.observers.has(observer)) { + this.deliverLastMessage(observer); + this.observers.add(observer); + } + }; + Concast.prototype.removeObserver = function (observer) { + if (this.observers.delete(observer) && this.observers.size < 1) { + this.handlers.complete(); + } + }; + Concast.prototype.notify = function (method, arg) { + var nextResultListeners = this.nextResultListeners; + if (nextResultListeners.size) { + this.nextResultListeners = new Set(); + nextResultListeners.forEach(function (listener) { return listener(method, arg); }); + } + }; + Concast.prototype.beforeNext = function (callback) { + var called = false; + this.nextResultListeners.add(function (method, arg) { + if (!called) { + called = true; + callback(method, arg); + } + }); + }; + return Concast; +}(zenObservableTs.Observable)); +fixObservableSubclass(Concast); + +function isExecutionPatchIncrementalResult(value) { + return "incremental" in value; +} +function isExecutionPatchInitialResult(value) { + return "hasNext" in value && "data" in value; +} +function isExecutionPatchResult(value) { + return (isExecutionPatchIncrementalResult(value) || + isExecutionPatchInitialResult(value)); +} +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} +function mergeIncrementalData(prevResult, result) { + var mergedData = prevResult; + var merger = new DeepMerger(); + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (_a) { + var data = _a.data, path = _a.path; + for (var i = path.length - 1; i >= 0; --i) { + var key = path[i]; + var isNumericKey = !isNaN(+key); + var parent_1 = isNumericKey ? [] : {}; + parent_1[key] = data; + data = parent_1; + } + mergedData = merger.merge(mergedData, data); + }); + } + return mergedData; +} + +function graphQLResultHasError(result) { + var errors = getGraphQLErrorsFromResult(result); + return isNonEmptyArray(errors); +} +function getGraphQLErrorsFromResult(result) { + var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (incrementalResult) { + if (incrementalResult.errors) { + graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors); + } + }); + } + return graphQLErrors; +} + +function compact() { + var objects = []; + for (var _i = 0; _i < arguments.length; _i++) { + objects[_i] = arguments[_i]; + } + var result = Object.create(null); + objects.forEach(function (obj) { + if (!obj) + return; + Object.keys(obj).forEach(function (key) { + var value = obj[key]; + if (value !== void 0) { + result[key] = value; + } + }); + }); + return result; +} + +function mergeOptions(defaults, options) { + return compact(defaults, options, options.variables && { + variables: compact(tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables)), + }); +} + +function fromError(errorValue) { + return new zenObservableTs.Observable(function (observer) { + observer.error(errorValue); + }); +} + +function toPromise(observable) { + var completed = false; + return new Promise(function (resolve, reject) { + observable.subscribe({ + next: function (data) { + if (completed) { + globalThis.__DEV__ !== false && invariant.warn(42); + } + else { + completed = true; + resolve(data); + } + }, + error: reject, + }); + }); +} + +function fromPromise(promise) { + return new zenObservableTs.Observable(function (observer) { + promise + .then(function (value) { + observer.next(value); + observer.complete(); + }) + .catch(observer.error.bind(observer)); + }); +} + +var throwServerError = function (response, result, message) { + var error = new Error(message); + error.name = "ServerError"; + error.response = response; + error.statusCode = response.status; + error.result = result; + throw error; +}; + +function validateOperation(operation) { + var OPERATION_FIELDS = [ + "query", + "operationName", + "variables", + "extensions", + "context", + ]; + for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { + var key = _a[_i]; + if (OPERATION_FIELDS.indexOf(key) < 0) { + throw newInvariantError(43, key); + } + } + return operation; +} + +function createOperation(starting, operation) { + var context = tslib.__assign({}, starting); + var setContext = function (next) { + if (typeof next === "function") { + context = tslib.__assign(tslib.__assign({}, context), next(context)); + } + else { + context = tslib.__assign(tslib.__assign({}, context), next); + } + }; + var getContext = function () { return (tslib.__assign({}, context)); }; + Object.defineProperty(operation, "setContext", { + enumerable: false, + value: setContext, + }); + Object.defineProperty(operation, "getContext", { + enumerable: false, + value: getContext, + }); + return operation; +} + +function transformOperation(operation) { + var transformedOperation = { + variables: operation.variables || {}, + extensions: operation.extensions || {}, + operationName: operation.operationName, + query: operation.query, + }; + if (!transformedOperation.operationName) { + transformedOperation.operationName = + typeof transformedOperation.query !== "string" ? + getOperationName(transformedOperation.query) || undefined + : ""; + } + return transformedOperation; +} + +function filterOperationVariables(variables, query) { + var result = tslib.__assign({}, variables); + var unusedNames = new Set(Object.keys(variables)); + graphql.visit(query, { + Variable: function (node, _key, parent) { + if (parent && + parent.kind !== "VariableDefinition") { + unusedNames.delete(node.name.value); + } + }, + }); + unusedNames.forEach(function (name) { + delete result[name]; + }); + return result; +} + +function passthrough(op, forward) { + return (forward ? forward(op) : zenObservableTs.Observable.of()); +} +function toLink(handler) { + return typeof handler === "function" ? new ApolloLink(handler) : handler; +} +function isTerminating(link) { + return link.request.length <= 1; +} +var ApolloLink = (function () { + function ApolloLink(request) { + if (request) + this.request = request; + } + ApolloLink.empty = function () { + return new ApolloLink(function () { return zenObservableTs.Observable.of(); }); + }; + ApolloLink.from = function (links) { + if (links.length === 0) + return ApolloLink.empty(); + return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); + }; + ApolloLink.split = function (test, left, right) { + var leftLink = toLink(left); + var rightLink = toLink(right || new ApolloLink(passthrough)); + var ret; + if (isTerminating(leftLink) && isTerminating(rightLink)) { + ret = new ApolloLink(function (operation) { + return test(operation) ? + leftLink.request(operation) || zenObservableTs.Observable.of() + : rightLink.request(operation) || zenObservableTs.Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return test(operation) ? + leftLink.request(operation, forward) || zenObservableTs.Observable.of() + : rightLink.request(operation, forward) || zenObservableTs.Observable.of(); + }); + } + return Object.assign(ret, { left: leftLink, right: rightLink }); + }; + ApolloLink.execute = function (link, operation) { + return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || zenObservableTs.Observable.of()); + }; + ApolloLink.concat = function (first, second) { + var firstLink = toLink(first); + if (isTerminating(firstLink)) { + globalThis.__DEV__ !== false && invariant.warn(35, firstLink); + return firstLink; + } + var nextLink = toLink(second); + var ret; + if (isTerminating(nextLink)) { + ret = new ApolloLink(function (operation) { + return firstLink.request(operation, function (op) { return nextLink.request(op) || zenObservableTs.Observable.of(); }) || zenObservableTs.Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return (firstLink.request(operation, function (op) { + return nextLink.request(op, forward) || zenObservableTs.Observable.of(); + }) || zenObservableTs.Observable.of()); + }); + } + return Object.assign(ret, { left: firstLink, right: nextLink }); + }; + ApolloLink.prototype.split = function (test, left, right) { + return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough))); + }; + ApolloLink.prototype.concat = function (next) { + return ApolloLink.concat(this, next); + }; + ApolloLink.prototype.request = function (operation, forward) { + throw newInvariantError(36); + }; + ApolloLink.prototype.onError = function (error, observer) { + if (observer && observer.error) { + observer.error(error); + return false; + } + throw error; + }; + ApolloLink.prototype.setOnError = function (fn) { + this.onError = fn; + return this; + }; + return ApolloLink; +}()); + +var empty = ApolloLink.empty; + +var from = ApolloLink.from; + +var split = ApolloLink.split; + +var concat = ApolloLink.concat; + +var execute = ApolloLink.execute; + +function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} + +function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} + +var PROTOCOL_ERRORS_SYMBOL = Symbol(); +function graphQLResultHasProtocolErrors(result) { + if (result.extensions) { + return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]); + } + return false; +} +function isApolloError(err) { + return err.hasOwnProperty("graphQLErrors"); +} +var generateErrorMessage = function (err) { + var errors = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true); + if (err.networkError) + errors.push(err.networkError); + return (errors + .map(function (err) { + return (isNonNullObject(err) && err.message) || "Error message not found."; + }) + .join("\n")); +}; +var ApolloError = (function (_super) { + tslib.__extends(ApolloError, _super); + function ApolloError(_a) { + var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; + var _this = _super.call(this, errorMessage) || this; + _this.name = "ApolloError"; + _this.graphQLErrors = graphQLErrors || []; + _this.protocolErrors = protocolErrors || []; + _this.clientErrors = clientErrors || []; + _this.networkError = networkError || null; + _this.message = errorMessage || generateErrorMessage(_this); + _this.extraInfo = extraInfo; + _this.__proto__ = ApolloError.prototype; + return _this; + } + return ApolloError; +}(Error)); + +var hasOwnProperty$3 = Object.prototype.hasOwnProperty; +function readMultipartBody(response, nextValue) { + var _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 , 3]; + return [4 , iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = tslib.__assign({}, result.payload); + } + if ("errors" in result) { + next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + nextValue(result); + } + } + else if ( + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 ]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 , 1]; + case 3: return [2 ]; + } + }); + }); +} +function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +function handleError(err, observer) { + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); +} +function parseAndCheckHttpResponse(operations) { + return function (response) { + return response + .text() + .then(function (bodyText) { return parseJsonBody(response, bodyText); }) + .then(function (result) { + if (!Array.isArray(result) && + !hasOwnProperty$3.call(result, "data") && + !hasOwnProperty$3.call(result, "errors")) { + throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ? + operations.map(function (op) { return op.operationName; }) + : operations.operationName, "'.")); + } + return result; + }); + }; +} + +var serializeFetchParameter = function (p, label) { + var serialized; + try { + serialized = JSON.stringify(p); + } + catch (e) { + var parseError = newInvariantError(39, label, e.message); + parseError.parseError = e; + throw parseError; + } + return serialized; +}; + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + accept: "*/*", + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; +var defaultPrinter = function (ast, printer) { return printer(ast); }; +function selectHttpOptionsAndBody(operation, fallbackConfig) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + configs.unshift(fallbackConfig); + return selectHttpOptionsAndBodyInternal.apply(void 0, tslib.__spreadArray([operation, + defaultPrinter], configs, false)); +} +function selectHttpOptionsAndBodyInternal(operation, printer) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + var options = {}; + var http = {}; + configs.forEach(function (config) { + options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), config.headers) }); + if (config.credentials) { + options.credentials = config.credentials; + } + http = tslib.__assign(tslib.__assign({}, http), config.http); + }); + if (options.headers) { + options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase); + } + var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; + var body = { operationName: operationName, variables: variables }; + if (http.includeExtensions) + body.extensions = extensions; + if (http.includeQuery) + body.query = printer(query, print); + return { + options: options, + body: body, + }; +} +function removeDuplicateHeaders(headers, preserveHeaderCase) { + if (!preserveHeaderCase) { + var normalizedHeaders_1 = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + normalizedHeaders_1[name.toLowerCase()] = headers[name]; + }); + return normalizedHeaders_1; + } + var headerData = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + headerData[name.toLowerCase()] = { + originalName: name, + value: headers[name], + }; + }); + var normalizedHeaders = Object.create(null); + Object.keys(headerData).forEach(function (name) { + normalizedHeaders[headerData[name].originalName] = headerData[name].value; + }); + return normalizedHeaders; +} + +var checkFetcher = function (fetcher) { + if (!fetcher && typeof fetch === "undefined") { + throw newInvariantError(37); + } +}; + +var createSignalIfSupported = function () { + if (typeof AbortController === "undefined") + return { controller: false, signal: false }; + var controller = new AbortController(); + var signal = controller.signal; + return { controller: controller, signal: signal }; +}; + +var selectURI = function (operation, fallbackURI) { + var context = operation.getContext(); + var contextURI = context.uri; + if (contextURI) { + return contextURI; + } + else if (typeof fallbackURI === "function") { + return fallbackURI(operation); + } + else { + return fallbackURI || "/graphql"; + } +}; + +function rewriteURIForGET(chosenURI, body) { + var queryParams = []; + var addQueryParam = function (key, value) { + queryParams.push("".concat(key, "=").concat(encodeURIComponent(value))); + }; + if ("query" in body) { + addQueryParam("query", body.query); + } + if (body.operationName) { + addQueryParam("operationName", body.operationName); + } + if (body.variables) { + var serializedVariables = void 0; + try { + serializedVariables = serializeFetchParameter(body.variables, "Variables map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("variables", serializedVariables); + } + if (body.extensions) { + var serializedExtensions = void 0; + try { + serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("extensions", serializedExtensions); + } + var fragment = "", preFragment = chosenURI; + var fragmentStart = chosenURI.indexOf("#"); + if (fragmentStart !== -1) { + fragment = chosenURI.substr(fragmentStart); + preFragment = chosenURI.substr(0, fragmentStart); + } + var queryParamsPrefix = preFragment.indexOf("?") === -1 ? "?" : "&"; + var newURI = preFragment + queryParamsPrefix + queryParams.join("&") + fragment; + return { newURI: newURI }; +} + +var backupFetch = maybe(function () { return fetch; }); +var createHttpLink = function (linkOptions) { + if (linkOptions === void 0) { linkOptions = {}; } + var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a, + preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]); + if (globalThis.__DEV__ !== false) { + checkFetcher(preferredFetch || backupFetch); + } + var linkConfig = { + http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + return new ApolloLink(function (operation) { + var chosenURI = selectURI(operation, uri); + var context = operation.getContext(); + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders["apollographql-client-name"] = name_1; + } + if (version) { + clientAwarenessHeaders["apollographql-client-version"] = version; + } + } + var contextHeaders = tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: contextHeaders, + }; + if (hasDirectives(["client"], operation.query)) { + var transformedQuery = removeClientSetsFromDocument(operation.query); + if (!transformedQuery) { + return fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.")); + } + operation.query = transformedQuery; + } + var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body; + if (body.variables && !includeUnusedVariables) { + body.variables = filterOperationVariables(body.variables, operation.query); + } + var controller; + if (!options.signal && typeof AbortController !== "undefined") { + controller = new AbortController(); + options.signal = controller.signal; + } + var definitionIsMutation = function (d) { + return d.kind === "OperationDefinition" && d.operation === "mutation"; + }; + var definitionIsSubscription = function (d) { + return d.kind === "OperationDefinition" && d.operation === "subscription"; + }; + var isSubscription = definitionIsSubscription(getMainDefinition(operation.query)); + var hasDefer = hasDirectives(["defer"], operation.query); + if (useGETForQueries && + !operation.query.definitions.some(definitionIsMutation)) { + options.method = "GET"; + } + if (hasDefer || isSubscription) { + options.headers = options.headers || {}; + var acceptHeader = "multipart/mixed;"; + if (isSubscription && hasDefer) { + globalThis.__DEV__ !== false && invariant.warn(38); + } + if (isSubscription) { + acceptHeader += + "boundary=graphql;subscriptionSpec=1.0,application/json"; + } + else if (hasDefer) { + acceptHeader += "deferSpec=20220824,application/json"; + } + options.headers.accept = acceptHeader; + } + if (options.method === "GET") { + var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError; + if (parseError) { + return fromError(parseError); + } + chosenURI = newURI; + } + else { + try { + options.body = serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + return fromError(parseError); + } + } + return new zenObservableTs.Observable(function (observer) { + var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch; + var observerNext = observer.next.bind(observer); + currentFetch(chosenURI, options) + .then(function (response) { + var _a; + operation.setContext({ response: response }); + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + else { + return parseAndCheckHttpResponse(operation)(response).then(observerNext); + } + }) + .then(function () { + controller = undefined; + observer.complete(); + }) + .catch(function (err) { + controller = undefined; + handleError(err, observer); + }); + return function () { + if (controller) + controller.abort(); + }; + }); + }); +}; + +var HttpLink = (function (_super) { + tslib.__extends(HttpLink, _super); + function HttpLink(options) { + if (options === void 0) { options = {}; } + var _this = _super.call(this, createHttpLink(options).request) || this; + _this.options = options; + return _this; + } + return HttpLink; +}(ApolloLink)); + +var ApolloCache = (function () { + function ApolloCache() { + this.assumeImmutableResults = false; + this.getFragmentDoc = optimism.wrap(getFragmentQueryDocument, { + max: cacheSizes["cache.fragmentQueryDocuments"] || + 1000 , + cache: caches.WeakCache, + }); + } + ApolloCache.prototype.batch = function (options) { + var _this = this; + var optimisticId = typeof options.optimistic === "string" ? options.optimistic + : options.optimistic === false ? null + : void 0; + var updateResult; + this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId); + return updateResult; + }; + ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) { + this.performTransaction(transaction, optimisticId); + }; + ApolloCache.prototype.transformDocument = function (document) { + return document; + }; + ApolloCache.prototype.transformForLink = function (document) { + return document; + }; + ApolloCache.prototype.identify = function (object) { + return; + }; + ApolloCache.prototype.gc = function () { + return []; + }; + ApolloCache.prototype.modify = function (options) { + return false; + }; + ApolloCache.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic: optimistic })); + }; + ApolloCache.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic })); + }; + ApolloCache.prototype.writeQuery = function (_a) { + var id = _a.id, data = _a.data, options = tslib.__rest(_a, ["id", "data"]); + return this.write(Object.assign(options, { + dataId: id || "ROOT_QUERY", + result: data, + })); + }; + ApolloCache.prototype.writeFragment = function (_a) { + var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = tslib.__rest(_a, ["id", "data", "fragment", "fragmentName"]); + return this.write(Object.assign(options, { + query: this.getFragmentDoc(fragment, fragmentName), + dataId: id, + result: data, + })); + }; + ApolloCache.prototype.updateQuery = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readQuery(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeQuery(tslib.__assign(tslib.__assign({}, options), { data: data })); + return data; + }, + }); + }; + ApolloCache.prototype.updateFragment = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readFragment(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeFragment(tslib.__assign(tslib.__assign({}, options), { data: data })); + return data; + }, + }); + }; + return ApolloCache; +}()); +if (globalThis.__DEV__ !== false) { + ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals; +} + +exports.Cache = void 0; +(function (Cache) { +})(exports.Cache || (exports.Cache = {})); + +var MissingFieldError = (function (_super) { + tslib.__extends(MissingFieldError, _super); + function MissingFieldError(message, path, query, variables) { + var _a; + var _this = _super.call(this, message) || this; + _this.message = message; + _this.path = path; + _this.query = query; + _this.variables = variables; + if (Array.isArray(_this.path)) { + _this.missing = _this.message; + for (var i = _this.path.length - 1; i >= 0; --i) { + _this.missing = (_a = {}, _a[_this.path[i]] = _this.missing, _a); + } + } + else { + _this.missing = _this.path; + } + _this.__proto__ = MissingFieldError.prototype; + return _this; + } + return MissingFieldError; +}(Error)); + +var hasOwn = Object.prototype.hasOwnProperty; +function isNullish(value) { + return value === null || value === void 0; +} +function defaultDataIdFromObject(_a, context) { + var __typename = _a.__typename, id = _a.id, _id = _a._id; + if (typeof __typename === "string") { + if (context) { + context.keyObject = + !isNullish(id) ? { id: id } + : !isNullish(_id) ? { _id: _id } + : void 0; + } + if (isNullish(id) && !isNullish(_id)) { + id = _id; + } + if (!isNullish(id)) { + return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ? + id + : JSON.stringify(id)); + } + } +} +var defaultConfig = { + dataIdFromObject: defaultDataIdFromObject, + addTypename: true, + resultCaching: true, + canonizeResults: false, +}; +function normalizeConfig(config) { + return compact(defaultConfig, config); +} +function shouldCanonizeResults(config) { + var value = config.canonizeResults; + return value === void 0 ? defaultConfig.canonizeResults : value; +} +function getTypenameFromStoreObject(store, objectOrReference) { + return isReference(objectOrReference) ? + store.get(objectOrReference.__ref, "__typename") + : objectOrReference && objectOrReference.__typename; +} +var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i; +function fieldNameFromStoreName(storeFieldName) { + var match = storeFieldName.match(TypeOrFieldNameRegExp); + return match ? match[0] : storeFieldName; +} +function selectionSetMatchesResult(selectionSet, result, variables) { + if (isNonNullObject(result)) { + return isArray(result) ? + result.every(function (item) { + return selectionSetMatchesResult(selectionSet, item, variables); + }) + : selectionSet.selections.every(function (field) { + if (isField(field) && shouldInclude(field, variables)) { + var key = resultKeyNameFromField(field); + return (hasOwn.call(result, key) && + (!field.selectionSet || + selectionSetMatchesResult(field.selectionSet, result[key], variables))); + } + return true; + }); + } + return false; +} +function storeValueIsStoreObject(value) { + return isNonNullObject(value) && !isReference(value) && !isArray(value); +} +function makeProcessedFieldsMerger() { + return new DeepMerger(); +} +function extractFragmentContext(document, fragments) { + var fragmentMap = createFragmentMap(getFragmentDefinitions(document)); + return { + fragmentMap: fragmentMap, + lookupFragment: function (name) { + var def = fragmentMap[name]; + if (!def && fragments) { + def = fragments.lookup(name); + } + return def || null; + }, + }; +} + +var DELETE = Object.create(null); +var delModifier = function () { return DELETE; }; +var INVALIDATE = Object.create(null); +var EntityStore = (function () { + function EntityStore(policies, group) { + var _this = this; + this.policies = policies; + this.group = group; + this.data = Object.create(null); + this.rootIds = Object.create(null); + this.refs = Object.create(null); + this.getFieldValue = function (objectOrReference, storeFieldName) { + return maybeDeepFreeze(isReference(objectOrReference) ? + _this.get(objectOrReference.__ref, storeFieldName) + : objectOrReference && objectOrReference[storeFieldName]); + }; + this.canRead = function (objOrRef) { + return isReference(objOrRef) ? + _this.has(objOrRef.__ref) + : typeof objOrRef === "object"; + }; + this.toReference = function (objOrIdOrRef, mergeIntoStore) { + if (typeof objOrIdOrRef === "string") { + return makeReference(objOrIdOrRef); + } + if (isReference(objOrIdOrRef)) { + return objOrIdOrRef; + } + var id = _this.policies.identify(objOrIdOrRef)[0]; + if (id) { + var ref = makeReference(id); + if (mergeIntoStore) { + _this.merge(id, objOrIdOrRef); + } + return ref; + } + }; + } + EntityStore.prototype.toObject = function () { + return tslib.__assign({}, this.data); + }; + EntityStore.prototype.has = function (dataId) { + return this.lookup(dataId, true) !== void 0; + }; + EntityStore.prototype.get = function (dataId, fieldName) { + this.group.depend(dataId, fieldName); + if (hasOwn.call(this.data, dataId)) { + var storeObject = this.data[dataId]; + if (storeObject && hasOwn.call(storeObject, fieldName)) { + return storeObject[fieldName]; + } + } + if (fieldName === "__typename" && + hasOwn.call(this.policies.rootTypenamesById, dataId)) { + return this.policies.rootTypenamesById[dataId]; + } + if (this instanceof Layer) { + return this.parent.get(dataId, fieldName); + } + }; + EntityStore.prototype.lookup = function (dataId, dependOnExistence) { + if (dependOnExistence) + this.group.depend(dataId, "__exists"); + if (hasOwn.call(this.data, dataId)) { + return this.data[dataId]; + } + if (this instanceof Layer) { + return this.parent.lookup(dataId, dependOnExistence); + } + if (this.policies.rootTypenamesById[dataId]) { + return Object.create(null); + } + }; + EntityStore.prototype.merge = function (older, newer) { + var _this = this; + var dataId; + if (isReference(older)) + older = older.__ref; + if (isReference(newer)) + newer = newer.__ref; + var existing = typeof older === "string" ? this.lookup((dataId = older)) : older; + var incoming = typeof newer === "string" ? this.lookup((dataId = newer)) : newer; + if (!incoming) + return; + invariant(typeof dataId === "string", 1); + var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming); + this.data[dataId] = merged; + if (merged !== existing) { + delete this.refs[dataId]; + if (this.group.caching) { + var fieldsToDirty_1 = Object.create(null); + if (!existing) + fieldsToDirty_1.__exists = 1; + Object.keys(incoming).forEach(function (storeFieldName) { + if (!existing || + existing[storeFieldName] !== merged[storeFieldName]) { + fieldsToDirty_1[storeFieldName] = 1; + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName && + !_this.policies.hasKeyArgs(merged.__typename, fieldName)) { + fieldsToDirty_1[fieldName] = 1; + } + if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) { + delete merged[storeFieldName]; + } + } + }); + if (fieldsToDirty_1.__typename && + !(existing && existing.__typename) && + this.policies.rootTypenamesById[dataId] === merged.__typename) { + delete fieldsToDirty_1.__typename; + } + Object.keys(fieldsToDirty_1).forEach(function (fieldName) { + return _this.group.dirty(dataId, fieldName); + }); + } + } + }; + EntityStore.prototype.modify = function (dataId, fields) { + var _this = this; + var storeObject = this.lookup(dataId); + if (storeObject) { + var changedFields_1 = Object.create(null); + var needToMerge_1 = false; + var allDeleted_1 = true; + var sharedDetails_1 = { + DELETE: DELETE, + INVALIDATE: INVALIDATE, + isReference: isReference, + toReference: this.toReference, + canRead: this.canRead, + readField: function (fieldNameOrOptions, from) { + return _this.policies.readField(typeof fieldNameOrOptions === "string" ? + { + fieldName: fieldNameOrOptions, + from: from || makeReference(dataId), + } + : fieldNameOrOptions, { store: _this }); + }, + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + var fieldName = fieldNameFromStoreName(storeFieldName); + var fieldValue = storeObject[storeFieldName]; + if (fieldValue === void 0) + return; + var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]); + if (modify) { + var newValue = modify === delModifier ? DELETE : (modify(maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }))); + if (newValue === INVALIDATE) { + _this.group.dirty(dataId, storeFieldName); + } + else { + if (newValue === DELETE) + newValue = void 0; + if (newValue !== fieldValue) { + changedFields_1[storeFieldName] = newValue; + needToMerge_1 = true; + fieldValue = newValue; + if (globalThis.__DEV__ !== false) { + var checkReference = function (ref) { + if (_this.lookup(ref.__ref) === undefined) { + globalThis.__DEV__ !== false && invariant.warn(2, ref); + return true; + } + }; + if (isReference(newValue)) { + checkReference(newValue); + } + else if (Array.isArray(newValue)) { + var seenReference = false; + var someNonReference = void 0; + for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) { + var value = newValue_1[_i]; + if (isReference(value)) { + seenReference = true; + if (checkReference(value)) + break; + } + else { + if (typeof value === "object" && !!value) { + var id = _this.policies.identify(value)[0]; + if (id) { + someNonReference = value; + } + } + } + if (seenReference && someNonReference !== undefined) { + globalThis.__DEV__ !== false && invariant.warn(3, someNonReference); + break; + } + } + } + } + } + } + } + if (fieldValue !== void 0) { + allDeleted_1 = false; + } + }); + if (needToMerge_1) { + this.merge(dataId, changedFields_1); + if (allDeleted_1) { + if (this instanceof Layer) { + this.data[dataId] = void 0; + } + else { + delete this.data[dataId]; + } + this.group.dirty(dataId, "__exists"); + } + return true; + } + } + return false; + }; + EntityStore.prototype.delete = function (dataId, fieldName, args) { + var _a; + var storeObject = this.lookup(dataId); + if (storeObject) { + var typename = this.getFieldValue(storeObject, "__typename"); + var storeFieldName = fieldName && args ? + this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args }) + : fieldName; + return this.modify(dataId, storeFieldName ? (_a = {}, + _a[storeFieldName] = delModifier, + _a) : delModifier); + } + return false; + }; + EntityStore.prototype.evict = function (options, limit) { + var evicted = false; + if (options.id) { + if (hasOwn.call(this.data, options.id)) { + evicted = this.delete(options.id, options.fieldName, options.args); + } + if (this instanceof Layer && this !== limit) { + evicted = this.parent.evict(options, limit) || evicted; + } + if (options.fieldName || evicted) { + this.group.dirty(options.id, options.fieldName || "__exists"); + } + } + return evicted; + }; + EntityStore.prototype.clear = function () { + this.replace(null); + }; + EntityStore.prototype.extract = function () { + var _this = this; + var obj = this.toObject(); + var extraRootIds = []; + this.getRootIdSet().forEach(function (id) { + if (!hasOwn.call(_this.policies.rootTypenamesById, id)) { + extraRootIds.push(id); + } + }); + if (extraRootIds.length) { + obj.__META = { extraRootIds: extraRootIds.sort() }; + } + return obj; + }; + EntityStore.prototype.replace = function (newData) { + var _this = this; + Object.keys(this.data).forEach(function (dataId) { + if (!(newData && hasOwn.call(newData, dataId))) { + _this.delete(dataId); + } + }); + if (newData) { + var __META = newData.__META, rest_1 = tslib.__rest(newData, ["__META"]); + Object.keys(rest_1).forEach(function (dataId) { + _this.merge(dataId, rest_1[dataId]); + }); + if (__META) { + __META.extraRootIds.forEach(this.retain, this); + } + } + }; + EntityStore.prototype.retain = function (rootId) { + return (this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1); + }; + EntityStore.prototype.release = function (rootId) { + if (this.rootIds[rootId] > 0) { + var count = --this.rootIds[rootId]; + if (!count) + delete this.rootIds[rootId]; + return count; + } + return 0; + }; + EntityStore.prototype.getRootIdSet = function (ids) { + if (ids === void 0) { ids = new Set(); } + Object.keys(this.rootIds).forEach(ids.add, ids); + if (this instanceof Layer) { + this.parent.getRootIdSet(ids); + } + else { + Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids); + } + return ids; + }; + EntityStore.prototype.gc = function () { + var _this = this; + var ids = this.getRootIdSet(); + var snapshot = this.toObject(); + ids.forEach(function (id) { + if (hasOwn.call(snapshot, id)) { + Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids); + delete snapshot[id]; + } + }); + var idsToRemove = Object.keys(snapshot); + if (idsToRemove.length) { + var root_1 = this; + while (root_1 instanceof Layer) + root_1 = root_1.parent; + idsToRemove.forEach(function (id) { return root_1.delete(id); }); + } + return idsToRemove; + }; + EntityStore.prototype.findChildRefIds = function (dataId) { + if (!hasOwn.call(this.refs, dataId)) { + var found_1 = (this.refs[dataId] = Object.create(null)); + var root = this.data[dataId]; + if (!root) + return found_1; + var workSet_1 = new Set([root]); + workSet_1.forEach(function (obj) { + if (isReference(obj)) { + found_1[obj.__ref] = true; + } + if (isNonNullObject(obj)) { + Object.keys(obj).forEach(function (key) { + var child = obj[key]; + if (isNonNullObject(child)) { + workSet_1.add(child); + } + }); + } + }); + } + return this.refs[dataId]; + }; + EntityStore.prototype.makeCacheKey = function () { + return this.group.keyMaker.lookupArray(arguments); + }; + return EntityStore; +}()); +var CacheGroup = (function () { + function CacheGroup(caching, parent) { + if (parent === void 0) { parent = null; } + this.caching = caching; + this.parent = parent; + this.d = null; + this.resetCaching(); + } + CacheGroup.prototype.resetCaching = function () { + this.d = this.caching ? optimism.dep() : null; + this.keyMaker = new trie.Trie(canUseWeakMap); + }; + CacheGroup.prototype.depend = function (dataId, storeFieldName) { + if (this.d) { + this.d(makeDepKey(dataId, storeFieldName)); + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName) { + this.d(makeDepKey(dataId, fieldName)); + } + if (this.parent) { + this.parent.depend(dataId, storeFieldName); + } + } + }; + CacheGroup.prototype.dirty = function (dataId, storeFieldName) { + if (this.d) { + this.d.dirty(makeDepKey(dataId, storeFieldName), + storeFieldName === "__exists" ? "forget" : "setDirty"); + } + }; + return CacheGroup; +}()); +function makeDepKey(dataId, storeFieldName) { + return storeFieldName + "#" + dataId; +} +function maybeDependOnExistenceOfEntity(store, entityId) { + if (supportsResultCaching(store)) { + store.group.depend(entityId, "__exists"); + } +} +(function (EntityStore) { + var Root = (function (_super) { + tslib.__extends(Root, _super); + function Root(_a) { + var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed; + var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this; + _this.stump = new Stump(_this); + _this.storageTrie = new trie.Trie(canUseWeakMap); + if (seed) + _this.replace(seed); + return _this; + } + Root.prototype.addLayer = function (layerId, replay) { + return this.stump.addLayer(layerId, replay); + }; + Root.prototype.removeLayer = function () { + return this; + }; + Root.prototype.getStorage = function () { + return this.storageTrie.lookupArray(arguments); + }; + return Root; + }(EntityStore)); + EntityStore.Root = Root; +})(EntityStore || (EntityStore = {})); +var Layer = (function (_super) { + tslib.__extends(Layer, _super); + function Layer(id, parent, replay, group) { + var _this = _super.call(this, parent.policies, group) || this; + _this.id = id; + _this.parent = parent; + _this.replay = replay; + _this.group = group; + replay(_this); + return _this; + } + Layer.prototype.addLayer = function (layerId, replay) { + return new Layer(layerId, this, replay, this.group); + }; + Layer.prototype.removeLayer = function (layerId) { + var _this = this; + var parent = this.parent.removeLayer(layerId); + if (layerId === this.id) { + if (this.group.caching) { + Object.keys(this.data).forEach(function (dataId) { + var ownStoreObject = _this.data[dataId]; + var parentStoreObject = parent["lookup"](dataId); + if (!parentStoreObject) { + _this.delete(dataId); + } + else if (!ownStoreObject) { + _this.group.dirty(dataId, "__exists"); + Object.keys(parentStoreObject).forEach(function (storeFieldName) { + _this.group.dirty(dataId, storeFieldName); + }); + } + else if (ownStoreObject !== parentStoreObject) { + Object.keys(ownStoreObject).forEach(function (storeFieldName) { + if (!equal.equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) { + _this.group.dirty(dataId, storeFieldName); + } + }); + } + }); + } + return parent; + } + if (parent === this.parent) + return this; + return parent.addLayer(this.id, this.replay); + }; + Layer.prototype.toObject = function () { + return tslib.__assign(tslib.__assign({}, this.parent.toObject()), this.data); + }; + Layer.prototype.findChildRefIds = function (dataId) { + var fromParent = this.parent.findChildRefIds(dataId); + return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent; + }; + Layer.prototype.getStorage = function () { + var p = this.parent; + while (p.parent) + p = p.parent; + return p.getStorage.apply(p, + arguments); + }; + return Layer; +}(EntityStore)); +var Stump = (function (_super) { + tslib.__extends(Stump, _super); + function Stump(root) { + return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this; + } + Stump.prototype.removeLayer = function () { + return this; + }; + Stump.prototype.merge = function (older, newer) { + return this.parent.merge(older, newer); + }; + return Stump; +}(Layer)); +function storeObjectReconciler(existingObject, incomingObject, property) { + var existingValue = existingObject[property]; + var incomingValue = incomingObject[property]; + return equal.equal(existingValue, incomingValue) ? existingValue : incomingValue; +} +function supportsResultCaching(store) { + return !!(store instanceof EntityStore && store.group.caching); +} + +function shallowCopy(value) { + if (isNonNullObject(value)) { + return isArray(value) ? + value.slice(0) + : tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + return value; +} +var ObjectCanon = (function () { + function ObjectCanon() { + this.known = new (canUseWeakSet ? WeakSet : Set)(); + this.pool = new trie.Trie(canUseWeakMap); + this.passes = new WeakMap(); + this.keysByJSON = new Map(); + this.empty = this.admit({}); + } + ObjectCanon.prototype.isKnown = function (value) { + return isNonNullObject(value) && this.known.has(value); + }; + ObjectCanon.prototype.pass = function (value) { + if (isNonNullObject(value)) { + var copy = shallowCopy(value); + this.passes.set(copy, value); + return copy; + } + return value; + }; + ObjectCanon.prototype.admit = function (value) { + var _this = this; + if (isNonNullObject(value)) { + var original = this.passes.get(value); + if (original) + return original; + var proto = Object.getPrototypeOf(value); + switch (proto) { + case Array.prototype: { + if (this.known.has(value)) + return value; + var array = value.map(this.admit, this); + var node = this.pool.lookupArray(array); + if (!node.array) { + this.known.add((node.array = array)); + if (globalThis.__DEV__ !== false) { + Object.freeze(array); + } + } + return node.array; + } + case null: + case Object.prototype: { + if (this.known.has(value)) + return value; + var proto_1 = Object.getPrototypeOf(value); + var array_1 = [proto_1]; + var keys = this.sortedKeys(value); + array_1.push(keys.json); + var firstValueIndex_1 = array_1.length; + keys.sorted.forEach(function (key) { + array_1.push(_this.admit(value[key])); + }); + var node = this.pool.lookupArray(array_1); + if (!node.object) { + var obj_1 = (node.object = Object.create(proto_1)); + this.known.add(obj_1); + keys.sorted.forEach(function (key, i) { + obj_1[key] = array_1[firstValueIndex_1 + i]; + }); + if (globalThis.__DEV__ !== false) { + Object.freeze(obj_1); + } + } + return node.object; + } + } + } + return value; + }; + ObjectCanon.prototype.sortedKeys = function (obj) { + var keys = Object.keys(obj); + var node = this.pool.lookupArray(keys); + if (!node.keys) { + keys.sort(); + var json = JSON.stringify(keys); + if (!(node.keys = this.keysByJSON.get(json))) { + this.keysByJSON.set(json, (node.keys = { sorted: keys, json: json })); + } + } + return node.keys; + }; + return ObjectCanon; +}()); + +function execSelectionSetKeyArgs(options) { + return [ + options.selectionSet, + options.objectOrReference, + options.context, + options.context.canonizeResults, + ]; +} +var StoreReader = (function () { + function StoreReader(config) { + var _this = this; + this.knownResults = new (canUseWeakMap ? WeakMap : Map)(); + this.config = compact(config, { + addTypename: config.addTypename !== false, + canonizeResults: shouldCanonizeResults(config), + }); + this.canon = config.canon || new ObjectCanon(); + this.executeSelectionSet = optimism.wrap(function (options) { + var _a; + var canonizeResults = options.context.canonizeResults; + var peekArgs = execSelectionSetKeyArgs(options); + peekArgs[3] = !canonizeResults; + var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs); + if (other) { + if (canonizeResults) { + return tslib.__assign(tslib.__assign({}, other), { + result: _this.canon.admit(other.result) }); + } + return other; + } + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSelectionSetImpl(options); + }, { + max: this.config.resultCacheMaxSize || + cacheSizes["inMemoryCache.executeSelectionSet"] || + 50000 , + keyArgs: execSelectionSetKeyArgs, + makeCacheKey: function (selectionSet, parent, context, canonizeResults) { + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(selectionSet, isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults); + } + }, + }); + this.executeSubSelectedArray = optimism.wrap(function (options) { + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSubSelectedArrayImpl(options); + }, { + max: this.config.resultCacheMaxSize || + cacheSizes["inMemoryCache.executeSubSelectedArray"] || + 10000 , + makeCacheKey: function (_a) { + var field = _a.field, array = _a.array, context = _a.context; + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(field, array, context.varString); + } + }, + }); + } + StoreReader.prototype.resetCanon = function () { + this.canon = new ObjectCanon(); + }; + StoreReader.prototype.diffQueryAgainstStore = function (_a) { + var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? "ROOT_QUERY" : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d; + var policies = this.config.cache.policies; + variables = tslib.__assign(tslib.__assign({}, getDefaultValues(getQueryDefinition(query))), variables); + var rootRef = makeReference(rootId); + var execResult = this.executeSelectionSet({ + selectionSet: getMainDefinition(query).selectionSet, + objectOrReference: rootRef, + enclosingRef: rootRef, + context: tslib.__assign({ store: store, query: query, policies: policies, variables: variables, varString: canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)), + }); + var missing; + if (execResult.missing) { + missing = [ + new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables), + ]; + if (!returnPartialData) { + throw missing[0]; + } + } + return { + result: execResult.result, + complete: !missing, + missing: missing, + }; + }; + StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) { + if (supportsResultCaching(context.store) && + this.knownResults.get(result) === selectionSet) { + var latest = this.executeSelectionSet.peek(selectionSet, parent, context, + this.canon.isKnown(result)); + if (latest && result === latest.result) { + return true; + } + } + return false; + }; + StoreReader.prototype.execSelectionSetImpl = function (_a) { + var _this = this; + var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context; + if (isReference(objectOrReference) && + !context.policies.rootTypenamesById[objectOrReference.__ref] && + !context.store.has(objectOrReference.__ref)) { + return { + result: this.canon.empty, + missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"), + }; + } + var variables = context.variables, policies = context.policies, store = context.store; + var typename = store.getFieldValue(objectOrReference, "__typename"); + var objectsToMerge = []; + var missing; + var missingMerger = new DeepMerger(); + if (this.config.addTypename && + typeof typename === "string" && + !policies.rootIdsByTypename[typename]) { + objectsToMerge.push({ __typename: typename }); + } + function handleMissing(result, resultName) { + var _a; + if (result.missing) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = result.missing, + _a)); + } + return result.result; + } + var workSet = new Set(selectionSet.selections); + workSet.forEach(function (selection) { + var _a, _b; + if (!shouldInclude(selection, variables)) + return; + if (isField(selection)) { + var fieldValue = policies.readField({ + fieldName: selection.name.value, + field: selection, + variables: context.variables, + from: objectOrReference, + }, context); + var resultName = resultKeyNameFromField(selection); + if (fieldValue === void 0) { + if (!addTypenameToDocument.added(selection)) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference) ? + objectOrReference.__ref + " object" + : "object " + JSON.stringify(objectOrReference, null, 2)), + _a)); + } + } + else if (isArray(fieldValue)) { + fieldValue = handleMissing(_this.executeSubSelectedArray({ + field: selection, + array: fieldValue, + enclosingRef: enclosingRef, + context: context, + }), resultName); + } + else if (!selection.selectionSet) { + if (context.canonizeResults) { + fieldValue = _this.canon.pass(fieldValue); + } + } + else if (fieldValue != null) { + fieldValue = handleMissing(_this.executeSelectionSet({ + selectionSet: selection.selectionSet, + objectOrReference: fieldValue, + enclosingRef: isReference(fieldValue) ? fieldValue : enclosingRef, + context: context, + }), resultName); + } + if (fieldValue !== void 0) { + objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b)); + } + } + else { + var fragment = getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) { + throw newInvariantError(9, selection.name.value); + } + if (fragment && policies.fragmentMatches(fragment, typename)) { + fragment.selectionSet.selections.forEach(workSet.add, workSet); + } + } + }); + var result = mergeDeepArray(objectsToMerge); + var finalResult = { result: result, missing: missing }; + var frozen = context.canonizeResults ? + this.canon.admit(finalResult) + : maybeDeepFreeze(finalResult); + if (frozen.result) { + this.knownResults.set(frozen.result, selectionSet); + } + return frozen; + }; + StoreReader.prototype.execSubSelectedArrayImpl = function (_a) { + var _this = this; + var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context; + var missing; + var missingMerger = new DeepMerger(); + function handleMissing(childResult, i) { + var _a; + if (childResult.missing) { + missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a)); + } + return childResult.result; + } + if (field.selectionSet) { + array = array.filter(context.store.canRead); + } + array = array.map(function (item, i) { + if (item === null) { + return null; + } + if (isArray(item)) { + return handleMissing(_this.executeSubSelectedArray({ + field: field, + array: item, + enclosingRef: enclosingRef, + context: context, + }), i); + } + if (field.selectionSet) { + return handleMissing(_this.executeSelectionSet({ + selectionSet: field.selectionSet, + objectOrReference: item, + enclosingRef: isReference(item) ? item : enclosingRef, + context: context, + }), i); + } + if (globalThis.__DEV__ !== false) { + assertSelectionSetForIdValue(context.store, field, item); + } + return item; + }); + return { + result: context.canonizeResults ? this.canon.admit(array) : array, + missing: missing, + }; + }; + return StoreReader; +}()); +function firstMissing(tree) { + try { + JSON.stringify(tree, function (_, value) { + if (typeof value === "string") + throw value; + return value; + }); + } + catch (result) { + return result; + } +} +function assertSelectionSetForIdValue(store, field, fieldValue) { + if (!field.selectionSet) { + var workSet_1 = new Set([fieldValue]); + workSet_1.forEach(function (value) { + if (isNonNullObject(value)) { + invariant( + !isReference(value), + 10, + getTypenameFromStoreObject(store, value), + field.name.value + ); + Object.values(value).forEach(workSet_1.add, workSet_1); + } + }); + } +} + +var cacheSlot = new optimism.Slot(); +var cacheInfoMap = new WeakMap(); +function getCacheInfo(cache) { + var info = cacheInfoMap.get(cache); + if (!info) { + cacheInfoMap.set(cache, (info = { + vars: new Set(), + dep: optimism.dep(), + })); + } + return info; +} +function forgetCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); }); +} +function recallCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); }); +} +function makeVar(value) { + var caches = new Set(); + var listeners = new Set(); + var rv = function (newValue) { + if (arguments.length > 0) { + if (value !== newValue) { + value = newValue; + caches.forEach(function (cache) { + getCacheInfo(cache).dep.dirty(rv); + broadcast(cache); + }); + var oldListeners = Array.from(listeners); + listeners.clear(); + oldListeners.forEach(function (listener) { return listener(value); }); + } + } + else { + var cache = cacheSlot.getValue(); + if (cache) { + attach(cache); + getCacheInfo(cache).dep(rv); + } + } + return value; + }; + rv.onNextChange = function (listener) { + listeners.add(listener); + return function () { + listeners.delete(listener); + }; + }; + var attach = (rv.attachCache = function (cache) { + caches.add(cache); + getCacheInfo(cache).vars.add(rv); + return rv; + }); + rv.forgetCache = function (cache) { return caches.delete(cache); }; + return rv; +} +function broadcast(cache) { + if (cache.broadcastWatches) { + cache.broadcastWatches(); + } +} + +var specifierInfoCache = Object.create(null); +function lookupSpecifierInfo(spec) { + var cacheKey = JSON.stringify(spec); + return (specifierInfoCache[cacheKey] || + (specifierInfoCache[cacheKey] = Object.create(null))); +} +function keyFieldsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyFieldsFn || (info.keyFieldsFn = function (object, context) { + var extract = function (from, key) { + return context.readField(key, from); + }; + var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) { + var extracted = extractKeyPath(context.storeObject, schemaKeyPath, + extract); + if (extracted === void 0 && + object !== context.storeObject && + hasOwn.call(object, schemaKeyPath[0])) { + extracted = extractKeyPath(object, schemaKeyPath, extractKey); + } + invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object); + return extracted; + })); + return "".concat(context.typename, ":").concat(JSON.stringify(keyObject)); + })); +} +function keyArgsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyArgsFn || + (info.keyArgsFn = function (args, _a) { + var field = _a.field, variables = _a.variables, fieldName = _a.fieldName; + var collected = collectSpecifierPaths(specifier, function (keyPath) { + var firstKey = keyPath[0]; + var firstChar = firstKey.charAt(0); + if (firstChar === "@") { + if (field && isNonEmptyArray(field.directives)) { + var directiveName_1 = firstKey.slice(1); + var d = field.directives.find(function (d) { return d.name.value === directiveName_1; }); + var directiveArgs = d && argumentsObjectFromField(d, variables); + return (directiveArgs && + extractKeyPath(directiveArgs, + keyPath.slice(1))); + } + return; + } + if (firstChar === "$") { + var variableName = firstKey.slice(1); + if (variables && hasOwn.call(variables, variableName)) { + var varKeyPath = keyPath.slice(0); + varKeyPath[0] = variableName; + return extractKeyPath(variables, varKeyPath); + } + return; + } + if (args) { + return extractKeyPath(args, keyPath); + } + }); + var suffix = JSON.stringify(collected); + if (args || suffix !== "{}") { + fieldName += ":" + suffix; + } + return fieldName; + })); +} +function collectSpecifierPaths(specifier, extractor) { + var merger = new DeepMerger(); + return getSpecifierPaths(specifier).reduce(function (collected, path) { + var _a; + var toMerge = extractor(path); + if (toMerge !== void 0) { + for (var i = path.length - 1; i >= 0; --i) { + toMerge = (_a = {}, _a[path[i]] = toMerge, _a); + } + collected = merger.merge(collected, toMerge); + } + return collected; + }, Object.create(null)); +} +function getSpecifierPaths(spec) { + var info = lookupSpecifierInfo(spec); + if (!info.paths) { + var paths_1 = (info.paths = []); + var currentPath_1 = []; + spec.forEach(function (s, i) { + if (isArray(s)) { + getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); }); + currentPath_1.length = 0; + } + else { + currentPath_1.push(s); + if (!isArray(spec[i + 1])) { + paths_1.push(currentPath_1.slice(0)); + currentPath_1.length = 0; + } + } + }); + } + return info.paths; +} +function extractKey(object, key) { + return object[key]; +} +function extractKeyPath(object, path, extract) { + extract = extract || extractKey; + return normalize(path.reduce(function reducer(obj, key) { + return isArray(obj) ? + obj.map(function (child) { return reducer(child, key); }) + : obj && extract(obj, key); + }, object)); +} +function normalize(value) { + if (isNonNullObject(value)) { + if (isArray(value)) { + return value.map(normalize); + } + return collectSpecifierPaths(Object.keys(value).sort(), function (path) { + return extractKeyPath(value, path); + }); + } + return value; +} + +function argsFromFieldSpecifier(spec) { + return (spec.args !== void 0 ? spec.args + : spec.field ? argumentsObjectFromField(spec.field, spec.variables) + : null); +} +var nullKeyFieldsFn = function () { return void 0; }; +var simpleKeyArgsFn = function (_args, context) { return context.fieldName; }; +var mergeTrueFn = function (existing, incoming, _a) { + var mergeObjects = _a.mergeObjects; + return mergeObjects(existing, incoming); +}; +var mergeFalseFn = function (_, incoming) { return incoming; }; +var Policies = (function () { + function Policies(config) { + this.config = config; + this.typePolicies = Object.create(null); + this.toBeAdded = Object.create(null); + this.supertypeMap = new Map(); + this.fuzzySubtypes = new Map(); + this.rootIdsByTypename = Object.create(null); + this.rootTypenamesById = Object.create(null); + this.usingPossibleTypes = false; + this.config = tslib.__assign({ dataIdFromObject: defaultDataIdFromObject }, config); + this.cache = this.config.cache; + this.setRootTypename("Query"); + this.setRootTypename("Mutation"); + this.setRootTypename("Subscription"); + if (config.possibleTypes) { + this.addPossibleTypes(config.possibleTypes); + } + if (config.typePolicies) { + this.addTypePolicies(config.typePolicies); + } + } + Policies.prototype.identify = function (object, partialContext) { + var _a; + var policies = this; + var typename = (partialContext && + (partialContext.typename || ((_a = partialContext.storeObject) === null || _a === void 0 ? void 0 : _a.__typename))) || + object.__typename; + if (typename === this.rootTypenamesById.ROOT_QUERY) { + return ["ROOT_QUERY"]; + } + var storeObject = (partialContext && partialContext.storeObject) || object; + var context = tslib.__assign(tslib.__assign({}, partialContext), { typename: typename, storeObject: storeObject, readField: (partialContext && partialContext.readField) || + function () { + var options = normalizeReadFieldOptions(arguments, storeObject); + return policies.readField(options, { + store: policies.cache["data"], + variables: options.variables, + }); + } }); + var id; + var policy = typename && this.getTypePolicy(typename); + var keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject; + while (keyFn) { + var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context); + if (isArray(specifierOrId)) { + keyFn = keyFieldsFnFromSpecifier(specifierOrId); + } + else { + id = specifierOrId; + break; + } + } + id = id ? String(id) : void 0; + return context.keyObject ? [id, context.keyObject] : [id]; + }; + Policies.prototype.addTypePolicies = function (typePolicies) { + var _this = this; + Object.keys(typePolicies).forEach(function (typename) { + var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = tslib.__rest(_a, ["queryType", "mutationType", "subscriptionType"]); + if (queryType) + _this.setRootTypename("Query", typename); + if (mutationType) + _this.setRootTypename("Mutation", typename); + if (subscriptionType) + _this.setRootTypename("Subscription", typename); + if (hasOwn.call(_this.toBeAdded, typename)) { + _this.toBeAdded[typename].push(incoming); + } + else { + _this.toBeAdded[typename] = [incoming]; + } + }); + }; + Policies.prototype.updateTypePolicy = function (typename, incoming) { + var _this = this; + var existing = this.getTypePolicy(typename); + var keyFields = incoming.keyFields, fields = incoming.fields; + function setMerge(existing, merge) { + existing.merge = + typeof merge === "function" ? merge + : merge === true ? mergeTrueFn + : merge === false ? mergeFalseFn + : existing.merge; + } + setMerge(existing, incoming.merge); + existing.keyFn = + keyFields === false ? nullKeyFieldsFn + : isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) + : typeof keyFields === "function" ? keyFields + : existing.keyFn; + if (fields) { + Object.keys(fields).forEach(function (fieldName) { + var existing = _this.getFieldPolicy(typename, fieldName, true); + var incoming = fields[fieldName]; + if (typeof incoming === "function") { + existing.read = incoming; + } + else { + var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge; + existing.keyFn = + keyArgs === false ? simpleKeyArgsFn + : isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) + : typeof keyArgs === "function" ? keyArgs + : existing.keyFn; + if (typeof read === "function") { + existing.read = read; + } + setMerge(existing, merge); + } + if (existing.read && existing.merge) { + existing.keyFn = existing.keyFn || simpleKeyArgsFn; + } + }); + } + }; + Policies.prototype.setRootTypename = function (which, typename) { + if (typename === void 0) { typename = which; } + var rootId = "ROOT_" + which.toUpperCase(); + var old = this.rootTypenamesById[rootId]; + if (typename !== old) { + invariant(!old || old === which, 5, which); + if (old) + delete this.rootIdsByTypename[old]; + this.rootIdsByTypename[typename] = rootId; + this.rootTypenamesById[rootId] = typename; + } + }; + Policies.prototype.addPossibleTypes = function (possibleTypes) { + var _this = this; + this.usingPossibleTypes = true; + Object.keys(possibleTypes).forEach(function (supertype) { + _this.getSupertypeSet(supertype, true); + possibleTypes[supertype].forEach(function (subtype) { + _this.getSupertypeSet(subtype, true).add(supertype); + var match = subtype.match(TypeOrFieldNameRegExp); + if (!match || match[0] !== subtype) { + _this.fuzzySubtypes.set(subtype, new RegExp(subtype)); + } + }); + }); + }; + Policies.prototype.getTypePolicy = function (typename) { + var _this = this; + if (!hasOwn.call(this.typePolicies, typename)) { + var policy_1 = (this.typePolicies[typename] = Object.create(null)); + policy_1.fields = Object.create(null); + var supertypes_1 = this.supertypeMap.get(typename); + if (!supertypes_1 && this.fuzzySubtypes.size) { + supertypes_1 = this.getSupertypeSet(typename, true); + this.fuzzySubtypes.forEach(function (regExp, fuzzy) { + if (regExp.test(typename)) { + var fuzzySupertypes = _this.supertypeMap.get(fuzzy); + if (fuzzySupertypes) { + fuzzySupertypes.forEach(function (supertype) { + return supertypes_1.add(supertype); + }); + } + } + }); + } + if (supertypes_1 && supertypes_1.size) { + supertypes_1.forEach(function (supertype) { + var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = tslib.__rest(_a, ["fields"]); + Object.assign(policy_1, rest); + Object.assign(policy_1.fields, fields); + }); + } + } + var inbox = this.toBeAdded[typename]; + if (inbox && inbox.length) { + inbox.splice(0).forEach(function (policy) { + _this.updateTypePolicy(typename, policy); + }); + } + return this.typePolicies[typename]; + }; + Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) { + if (typename) { + var fieldPolicies = this.getTypePolicy(typename).fields; + return (fieldPolicies[fieldName] || + (createIfMissing && (fieldPolicies[fieldName] = Object.create(null)))); + } + }; + Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) { + var supertypeSet = this.supertypeMap.get(subtype); + if (!supertypeSet && createIfMissing) { + this.supertypeMap.set(subtype, (supertypeSet = new Set())); + } + return supertypeSet; + }; + Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) { + var _this = this; + if (!fragment.typeCondition) + return true; + if (!typename) + return false; + var supertype = fragment.typeCondition.name.value; + if (typename === supertype) + return true; + if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) { + var typenameSupertypeSet = this.getSupertypeSet(typename, true); + var workQueue_1 = [typenameSupertypeSet]; + var maybeEnqueue_1 = function (subtype) { + var supertypeSet = _this.getSupertypeSet(subtype, false); + if (supertypeSet && + supertypeSet.size && + workQueue_1.indexOf(supertypeSet) < 0) { + workQueue_1.push(supertypeSet); + } + }; + var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size); + var checkingFuzzySubtypes = false; + for (var i = 0; i < workQueue_1.length; ++i) { + var supertypeSet = workQueue_1[i]; + if (supertypeSet.has(supertype)) { + if (!typenameSupertypeSet.has(supertype)) { + if (checkingFuzzySubtypes) { + globalThis.__DEV__ !== false && invariant.warn(6, typename, supertype); + } + typenameSupertypeSet.add(supertype); + } + return true; + } + supertypeSet.forEach(maybeEnqueue_1); + if (needToCheckFuzzySubtypes && + i === workQueue_1.length - 1 && + selectionSetMatchesResult(fragment.selectionSet, result, variables)) { + needToCheckFuzzySubtypes = false; + checkingFuzzySubtypes = true; + this.fuzzySubtypes.forEach(function (regExp, fuzzyString) { + var match = typename.match(regExp); + if (match && match[0] === typename) { + maybeEnqueue_1(fuzzyString); + } + }); + } + } + } + return false; + }; + Policies.prototype.hasKeyArgs = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return !!(policy && policy.keyFn); + }; + Policies.prototype.getStoreFieldName = function (fieldSpec) { + var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName; + var policy = this.getFieldPolicy(typename, fieldName, false); + var storeFieldName; + var keyFn = policy && policy.keyFn; + if (keyFn && typename) { + var context = { + typename: typename, + fieldName: fieldName, + field: fieldSpec.field || null, + variables: fieldSpec.variables, + }; + var args = argsFromFieldSpecifier(fieldSpec); + while (keyFn) { + var specifierOrString = keyFn(args, context); + if (isArray(specifierOrString)) { + keyFn = keyArgsFnFromSpecifier(specifierOrString); + } + else { + storeFieldName = specifierOrString || fieldName; + break; + } + } + } + if (storeFieldName === void 0) { + storeFieldName = + fieldSpec.field ? + storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) + : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec)); + } + if (storeFieldName === false) { + return fieldName; + } + return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName + : fieldName + ":" + storeFieldName; + }; + Policies.prototype.readField = function (options, context) { + var objectOrReference = options.from; + if (!objectOrReference) + return; + var nameOrField = options.field || options.fieldName; + if (!nameOrField) + return; + if (options.typename === void 0) { + var typename = context.store.getFieldValue(objectOrReference, "__typename"); + if (typename) + options.typename = typename; + } + var storeFieldName = this.getStoreFieldName(options); + var fieldName = fieldNameFromStoreName(storeFieldName); + var existing = context.store.getFieldValue(objectOrReference, storeFieldName); + var policy = this.getFieldPolicy(options.typename, fieldName, false); + var read = policy && policy.read; + if (read) { + var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference) ? + objectOrReference.__ref + : objectOrReference, storeFieldName)); + return cacheSlot.withValue(this.cache, read, [ + existing, + readOptions, + ]); + } + return existing; + }; + Policies.prototype.getReadFunction = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return policy && policy.read; + }; + Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) { + var policy = this.getFieldPolicy(parentTypename, fieldName, false); + var merge = policy && policy.merge; + if (!merge && childTypename) { + policy = this.getTypePolicy(childTypename); + merge = policy && policy.merge; + } + return merge; + }; + Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) { + var field = _a.field, typename = _a.typename, merge = _a.merge; + if (merge === mergeTrueFn) { + return makeMergeObjectsFunction(context.store)(existing, incoming); + } + if (merge === mergeFalseFn) { + return incoming; + } + if (context.overwrite) { + existing = void 0; + } + return merge(existing, incoming, makeFieldFunctionOptions(this, + void 0, { + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }, context, storage || Object.create(null))); + }; + return Policies; +}()); +function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) { + var storeFieldName = policies.getStoreFieldName(fieldSpec); + var fieldName = fieldNameFromStoreName(storeFieldName); + var variables = fieldSpec.variables || context.variables; + var _a = context.store, toReference = _a.toReference, canRead = _a.canRead; + return { + args: argsFromFieldSpecifier(fieldSpec), + field: fieldSpec.field || null, + fieldName: fieldName, + storeFieldName: storeFieldName, + variables: variables, + isReference: isReference, + toReference: toReference, + storage: storage, + cache: policies.cache, + canRead: canRead, + readField: function () { + return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context); + }, + mergeObjects: makeMergeObjectsFunction(context.store), + }; +} +function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) { + var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length; + var options; + if (typeof fieldNameOrOptions === "string") { + options = { + fieldName: fieldNameOrOptions, + from: argc > 1 ? from : objectOrReference, + }; + } + else { + options = tslib.__assign({}, fieldNameOrOptions); + if (!hasOwn.call(options, "from")) { + options.from = objectOrReference; + } + } + if (globalThis.__DEV__ !== false && options.from === void 0) { + globalThis.__DEV__ !== false && invariant.warn(7, stringifyForDisplay(Array.from(readFieldArgs))); + } + if (void 0 === options.variables) { + options.variables = variables; + } + return options; +} +function makeMergeObjectsFunction(store) { + return function mergeObjects(existing, incoming) { + if (isArray(existing) || isArray(incoming)) { + throw newInvariantError(8); + } + if (isNonNullObject(existing) && isNonNullObject(incoming)) { + var eType = store.getFieldValue(existing, "__typename"); + var iType = store.getFieldValue(incoming, "__typename"); + var typesDiffer = eType && iType && eType !== iType; + if (typesDiffer) { + return incoming; + } + if (isReference(existing) && storeValueIsStoreObject(incoming)) { + store.merge(existing.__ref, incoming); + return existing; + } + if (storeValueIsStoreObject(existing) && isReference(incoming)) { + store.merge(existing, incoming.__ref); + return incoming; + } + if (storeValueIsStoreObject(existing) && + storeValueIsStoreObject(incoming)) { + return tslib.__assign(tslib.__assign({}, existing), incoming); + } + } + return incoming; + }; +} + +function getContextFlavor(context, clientOnly, deferred) { + var key = "".concat(clientOnly).concat(deferred); + var flavored = context.flavors.get(key); + if (!flavored) { + context.flavors.set(key, (flavored = + context.clientOnly === clientOnly && context.deferred === deferred ? + context + : tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred }))); + } + return flavored; +} +var StoreWriter = (function () { + function StoreWriter(cache, reader, fragments) { + this.cache = cache; + this.reader = reader; + this.fragments = fragments; + } + StoreWriter.prototype.writeToStore = function (store, _a) { + var _this = this; + var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite; + var operationDefinition = getOperationDefinition(query); + var merger = makeProcessedFieldsMerger(); + variables = tslib.__assign(tslib.__assign({}, getDefaultValues(operationDefinition)), variables); + var context = tslib.__assign(tslib.__assign({ store: store, written: Object.create(null), merge: function (existing, incoming) { + return merger.merge(existing, incoming); + }, variables: variables, varString: canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() }); + var ref = this.processSelectionSet({ + result: result || Object.create(null), + dataId: dataId, + selectionSet: operationDefinition.selectionSet, + mergeTree: { map: new Map() }, + context: context, + }); + if (!isReference(ref)) { + throw newInvariantError(11, result); + } + context.incomingById.forEach(function (_a, dataId) { + var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet; + var entityRef = makeReference(dataId); + if (mergeTree && mergeTree.map.size) { + var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context); + if (isReference(applied)) { + return; + } + storeObject = applied; + } + if (globalThis.__DEV__ !== false && !context.overwrite) { + var fieldsWithSelectionSets_1 = Object.create(null); + fieldNodeSet.forEach(function (field) { + if (field.selectionSet) { + fieldsWithSelectionSets_1[field.name.value] = true; + } + }); + var hasSelectionSet_1 = function (storeFieldName) { + return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] === + true; + }; + var hasMergeFunction_1 = function (storeFieldName) { + var childTree = mergeTree && mergeTree.map.get(storeFieldName); + return Boolean(childTree && childTree.info && childTree.info.merge); + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + if (hasSelectionSet_1(storeFieldName) && + !hasMergeFunction_1(storeFieldName)) { + warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store); + } + }); + } + store.merge(dataId, storeObject); + }); + store.retain(ref.__ref); + return ref; + }; + StoreWriter.prototype.processSelectionSet = function (_a) { + var _this = this; + var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, + mergeTree = _a.mergeTree; + var policies = this.cache.policies; + var incoming = Object.create(null); + var typename = (dataId && policies.rootTypenamesById[dataId]) || + getTypenameFromResult(result, selectionSet, context.fragmentMap) || + (dataId && context.store.get(dataId, "__typename")); + if ("string" === typeof typename) { + incoming.__typename = typename; + } + var readField = function () { + var options = normalizeReadFieldOptions(arguments, incoming, context.variables); + if (isReference(options.from)) { + var info = context.incomingById.get(options.from.__ref); + if (info) { + var result_1 = policies.readField(tslib.__assign(tslib.__assign({}, options), { from: info.storeObject }), context); + if (result_1 !== void 0) { + return result_1; + } + } + } + return policies.readField(options, context); + }; + var fieldNodeSet = new Set(); + this.flattenFields(selectionSet, result, + context, typename).forEach(function (context, field) { + var _a; + var resultFieldKey = resultKeyNameFromField(field); + var value = result[resultFieldKey]; + fieldNodeSet.add(field); + if (value !== void 0) { + var storeFieldName = policies.getStoreFieldName({ + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }); + var childTree = getChildMergeTree(mergeTree, storeFieldName); + var incomingValue = _this.processFieldValue(value, field, + field.selectionSet ? + getContextFlavor(context, false, false) + : context, childTree); + var childTypename = void 0; + if (field.selectionSet && + (isReference(incomingValue) || storeValueIsStoreObject(incomingValue))) { + childTypename = readField("__typename", incomingValue); + } + var merge = policies.getMergeFunction(typename, field.name.value, childTypename); + if (merge) { + childTree.info = { + field: field, + typename: typename, + merge: merge, + }; + } + else { + maybeRecycleChildMergeTree(mergeTree, storeFieldName); + } + incoming = context.merge(incoming, (_a = {}, + _a[storeFieldName] = incomingValue, + _a)); + } + else if (globalThis.__DEV__ !== false && + !context.clientOnly && + !context.deferred && + !addTypenameToDocument.added(field) && + !policies.getReadFunction(typename, field.name.value)) { + globalThis.__DEV__ !== false && invariant.error(12, resultKeyNameFromField(field), result); + } + }); + try { + var _b = policies.identify(result, { + typename: typename, + selectionSet: selectionSet, + fragmentMap: context.fragmentMap, + storeObject: incoming, + readField: readField, + }), id = _b[0], keyObject = _b[1]; + dataId = dataId || id; + if (keyObject) { + incoming = context.merge(incoming, keyObject); + } + } + catch (e) { + if (!dataId) + throw e; + } + if ("string" === typeof dataId) { + var dataRef = makeReference(dataId); + var sets = context.written[dataId] || (context.written[dataId] = []); + if (sets.indexOf(selectionSet) >= 0) + return dataRef; + sets.push(selectionSet); + if (this.reader && + this.reader.isFresh(result, dataRef, selectionSet, context)) { + return dataRef; + } + var previous_1 = context.incomingById.get(dataId); + if (previous_1) { + previous_1.storeObject = context.merge(previous_1.storeObject, incoming); + previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree); + fieldNodeSet.forEach(function (field) { return previous_1.fieldNodeSet.add(field); }); + } + else { + context.incomingById.set(dataId, { + storeObject: incoming, + mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree, + fieldNodeSet: fieldNodeSet, + }); + } + return dataRef; + } + return incoming; + }; + StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) { + var _this = this; + if (!field.selectionSet || value === null) { + return globalThis.__DEV__ !== false ? cloneDeep(value) : value; + } + if (isArray(value)) { + return value.map(function (item, i) { + var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i)); + maybeRecycleChildMergeTree(mergeTree, i); + return value; + }); + } + return this.processSelectionSet({ + result: value, + selectionSet: field.selectionSet, + context: context, + mergeTree: mergeTree, + }); + }; + StoreWriter.prototype.flattenFields = function (selectionSet, result, context, typename) { + if (typename === void 0) { typename = getTypenameFromResult(result, selectionSet, context.fragmentMap); } + var fieldMap = new Map(); + var policies = this.cache.policies; + var limitingTrie = new trie.Trie(false); + (function flatten(selectionSet, inheritedContext) { + var visitedNode = limitingTrie.lookup(selectionSet, + inheritedContext.clientOnly, inheritedContext.deferred); + if (visitedNode.visited) + return; + visitedNode.visited = true; + selectionSet.selections.forEach(function (selection) { + if (!shouldInclude(selection, context.variables)) + return; + var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred; + if ( + !(clientOnly && deferred) && + isNonEmptyArray(selection.directives)) { + selection.directives.forEach(function (dir) { + var name = dir.name.value; + if (name === "client") + clientOnly = true; + if (name === "defer") { + var args = argumentsObjectFromField(dir, context.variables); + if (!args || args.if !== false) { + deferred = true; + } + } + }); + } + if (isField(selection)) { + var existing = fieldMap.get(selection); + if (existing) { + clientOnly = clientOnly && existing.clientOnly; + deferred = deferred && existing.deferred; + } + fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred)); + } + else { + var fragment = getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) { + throw newInvariantError(13, selection.name.value); + } + if (fragment && + policies.fragmentMatches(fragment, typename, result, context.variables)) { + flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred)); + } + } + }); + })(selectionSet, context); + return fieldMap; + }; + StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) { + var _a; + var _this = this; + if (mergeTree.map.size && !isReference(incoming)) { + var e_1 = + (!isArray(incoming) && + (isReference(existing) || storeValueIsStoreObject(existing))) ? + existing + : void 0; + var i_1 = incoming; + if (e_1 && !getStorageArgs) { + getStorageArgs = [isReference(e_1) ? e_1.__ref : e_1]; + } + var changedFields_1; + var getValue_1 = function (from, name) { + return (isArray(from) ? + typeof name === "number" ? + from[name] + : void 0 + : context.store.getFieldValue(from, String(name))); + }; + mergeTree.map.forEach(function (childTree, storeFieldName) { + var eVal = getValue_1(e_1, storeFieldName); + var iVal = getValue_1(i_1, storeFieldName); + if (void 0 === iVal) + return; + if (getStorageArgs) { + getStorageArgs.push(storeFieldName); + } + var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs); + if (aVal !== iVal) { + changedFields_1 = changedFields_1 || new Map(); + changedFields_1.set(storeFieldName, aVal); + } + if (getStorageArgs) { + invariant(getStorageArgs.pop() === storeFieldName); + } + }); + if (changedFields_1) { + incoming = (isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1)); + changedFields_1.forEach(function (value, name) { + incoming[name] = value; + }); + } + } + if (mergeTree.info) { + return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs)); + } + return incoming; + }; + return StoreWriter; +}()); +var emptyMergeTreePool = []; +function getChildMergeTree(_a, name) { + var map = _a.map; + if (!map.has(name)) { + map.set(name, emptyMergeTreePool.pop() || { map: new Map() }); + } + return map.get(name); +} +function mergeMergeTrees(left, right) { + if (left === right || !right || mergeTreeIsEmpty(right)) + return left; + if (!left || mergeTreeIsEmpty(left)) + return right; + var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info; + var needToMergeMaps = left.map.size && right.map.size; + var map = needToMergeMaps ? new Map() + : left.map.size ? left.map + : right.map; + var merged = { info: info, map: map }; + if (needToMergeMaps) { + var remainingRightKeys_1 = new Set(right.map.keys()); + left.map.forEach(function (leftTree, key) { + merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key))); + remainingRightKeys_1.delete(key); + }); + remainingRightKeys_1.forEach(function (key) { + merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key))); + }); + } + return merged; +} +function mergeTreeIsEmpty(tree) { + return !tree || !(tree.info || tree.map.size); +} +function maybeRecycleChildMergeTree(_a, name) { + var map = _a.map; + var childTree = map.get(name); + if (childTree && mergeTreeIsEmpty(childTree)) { + emptyMergeTreePool.push(childTree); + map.delete(name); + } +} +var warnings = new Set(); +function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) { + var getChild = function (objOrRef) { + var child = store.getFieldValue(objOrRef, storeFieldName); + return typeof child === "object" && child; + }; + var existing = getChild(existingRef); + if (!existing) + return; + var incoming = getChild(incomingObj); + if (!incoming) + return; + if (isReference(existing)) + return; + if (equal.equal(existing, incoming)) + return; + if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) { + return; + } + var parentType = store.getFieldValue(existingRef, "__typename") || + store.getFieldValue(incomingObj, "__typename"); + var fieldName = fieldNameFromStoreName(storeFieldName); + var typeDotName = "".concat(parentType, ".").concat(fieldName); + if (warnings.has(typeDotName)) + return; + warnings.add(typeDotName); + var childTypenames = []; + if (!isArray(existing) && !isArray(incoming)) { + [existing, incoming].forEach(function (child) { + var typename = store.getFieldValue(child, "__typename"); + if (typeof typename === "string" && !childTypenames.includes(typename)) { + childTypenames.push(typename); + } + }); + } + globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length ? + "either ensure all objects of type " + + childTypenames.join(" and ") + + " have an ID or a custom merge function, or " + : "", typeDotName, existing, incoming); +} + +var InMemoryCache = (function (_super) { + tslib.__extends(InMemoryCache, _super); + function InMemoryCache(config) { + if (config === void 0) { config = {}; } + var _this = _super.call(this) || this; + _this.watches = new Set(); + _this.addTypenameTransform = new DocumentTransform(addTypenameToDocument); + _this.assumeImmutableResults = true; + _this.makeVar = makeVar; + _this.txCount = 0; + _this.config = normalizeConfig(config); + _this.addTypename = !!_this.config.addTypename; + _this.policies = new Policies({ + cache: _this, + dataIdFromObject: _this.config.dataIdFromObject, + possibleTypes: _this.config.possibleTypes, + typePolicies: _this.config.typePolicies, + }); + _this.init(); + return _this; + } + InMemoryCache.prototype.init = function () { + var rootStore = (this.data = new EntityStore.Root({ + policies: this.policies, + resultCaching: this.config.resultCaching, + })); + this.optimisticData = rootStore.stump; + this.resetResultCache(); + }; + InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) { + var _this = this; + var previousReader = this.storeReader; + var fragments = this.config.fragments; + this.storeWriter = new StoreWriter(this, (this.storeReader = new StoreReader({ + cache: this, + addTypename: this.addTypename, + resultCacheMaxSize: this.config.resultCacheMaxSize, + canonizeResults: shouldCanonizeResults(this.config), + canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon), + fragments: fragments, + })), fragments); + this.maybeBroadcastWatch = optimism.wrap(function (c, options) { + return _this.broadcastWatch(c, options); + }, { + max: this.config.resultCacheMaxSize || + cacheSizes["inMemoryCache.maybeBroadcastWatch"] || + 5000 , + makeCacheKey: function (c) { + var store = c.optimistic ? _this.optimisticData : _this.data; + if (supportsResultCaching(store)) { + var optimistic = c.optimistic, id = c.id, variables = c.variables; + return store.makeCacheKey(c.query, + c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables })); + } + }, + }); + new Set([this.data.group, this.optimisticData.group]).forEach(function (group) { + return group.resetCaching(); + }); + }; + InMemoryCache.prototype.restore = function (data) { + this.init(); + if (data) + this.data.replace(data); + return this; + }; + InMemoryCache.prototype.extract = function (optimistic) { + if (optimistic === void 0) { optimistic = false; } + return (optimistic ? this.optimisticData : this.data).extract(); + }; + InMemoryCache.prototype.read = function (options) { + var + _a = options.returnPartialData, + returnPartialData = _a === void 0 ? false : _a; + try { + return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null); + } + catch (e) { + if (e instanceof MissingFieldError) { + return null; + } + throw e; + } + }; + InMemoryCache.prototype.write = function (options) { + try { + ++this.txCount; + return this.storeWriter.writeToStore(this.data, options); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.modify = function (options) { + if (hasOwn.call(options, "id") && !options.id) { + return false; + } + var store = ((options.optimistic) + ) ? + this.optimisticData + : this.data; + try { + ++this.txCount; + return store.modify(options.id || "ROOT_QUERY", options.fields); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.diff = function (options) { + return this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config })); + }; + InMemoryCache.prototype.watch = function (watch) { + var _this = this; + if (!this.watches.size) { + recallCache(this); + } + this.watches.add(watch); + if (watch.immediate) { + this.maybeBroadcastWatch(watch); + } + return function () { + if (_this.watches.delete(watch) && !_this.watches.size) { + forgetCache(_this); + } + _this.maybeBroadcastWatch.forget(watch); + }; + }; + InMemoryCache.prototype.gc = function (options) { + var _a; + canonicalStringify.reset(); + print.reset(); + this.addTypenameTransform.resetCache(); + (_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches(); + var ids = this.optimisticData.gc(); + if (options && !this.txCount) { + if (options.resetResultCache) { + this.resetResultCache(options.resetResultIdentities); + } + else if (options.resetResultIdentities) { + this.storeReader.resetCanon(); + } + } + return ids; + }; + InMemoryCache.prototype.retain = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).retain(rootId); + }; + InMemoryCache.prototype.release = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).release(rootId); + }; + InMemoryCache.prototype.identify = function (object) { + if (isReference(object)) + return object.__ref; + try { + return this.policies.identify(object)[0]; + } + catch (e) { + globalThis.__DEV__ !== false && invariant.warn(e); + } + }; + InMemoryCache.prototype.evict = function (options) { + if (!options.id) { + if (hasOwn.call(options, "id")) { + return false; + } + options = tslib.__assign(tslib.__assign({}, options), { id: "ROOT_QUERY" }); + } + try { + ++this.txCount; + return this.optimisticData.evict(options, this.data); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.reset = function (options) { + var _this = this; + this.init(); + canonicalStringify.reset(); + if (options && options.discardWatches) { + this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); }); + this.watches.clear(); + forgetCache(this); + } + else { + this.broadcastWatches(); + } + return Promise.resolve(); + }; + InMemoryCache.prototype.removeOptimistic = function (idToRemove) { + var newOptimisticData = this.optimisticData.removeLayer(idToRemove); + if (newOptimisticData !== this.optimisticData) { + this.optimisticData = newOptimisticData; + this.broadcastWatches(); + } + }; + InMemoryCache.prototype.batch = function (options) { + var _this = this; + var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated; + var updateResult; + var perform = function (layer) { + var _a = _this, data = _a.data, optimisticData = _a.optimisticData; + ++_this.txCount; + if (layer) { + _this.data = _this.optimisticData = layer; + } + try { + return (updateResult = update(_this)); + } + finally { + --_this.txCount; + _this.data = data; + _this.optimisticData = optimisticData; + } + }; + var alreadyDirty = new Set(); + if (onWatchUpdated && !this.txCount) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch) { + alreadyDirty.add(watch); + return false; + } })); + } + if (typeof optimistic === "string") { + this.optimisticData = this.optimisticData.addLayer(optimistic, perform); + } + else if (optimistic === false) { + perform(this.data); + } + else { + perform(); + } + if (typeof removeOptimistic === "string") { + this.optimisticData = this.optimisticData.removeLayer(removeOptimistic); + } + if (onWatchUpdated && alreadyDirty.size) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch, diff) { + var result = onWatchUpdated.call(this, watch, diff); + if (result !== false) { + alreadyDirty.delete(watch); + } + return result; + } })); + if (alreadyDirty.size) { + alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); }); + } + } + else { + this.broadcastWatches(options); + } + return updateResult; + }; + InMemoryCache.prototype.performTransaction = function (update, optimisticId) { + return this.batch({ + update: update, + optimistic: optimisticId || optimisticId !== null, + }); + }; + InMemoryCache.prototype.transformDocument = function (document) { + return this.addTypenameToDocument(this.addFragmentsToDocument(document)); + }; + InMemoryCache.prototype.broadcastWatches = function (options) { + var _this = this; + if (!this.txCount) { + this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); }); + } + }; + InMemoryCache.prototype.addFragmentsToDocument = function (document) { + var fragments = this.config.fragments; + return fragments ? fragments.transform(document) : document; + }; + InMemoryCache.prototype.addTypenameToDocument = function (document) { + if (this.addTypename) { + return this.addTypenameTransform.transformDocument(document); + } + return document; + }; + InMemoryCache.prototype.broadcastWatch = function (c, options) { + var lastDiff = c.lastDiff; + var diff = this.diff(c); + if (options) { + if (c.optimistic && typeof options.optimistic === "string") { + diff.fromOptimisticTransaction = true; + } + if (options.onWatchUpdated && + options.onWatchUpdated.call(this, c, diff, lastDiff) === false) { + return; + } + } + if (!lastDiff || !equal.equal(lastDiff.result, diff.result)) { + c.callback((c.lastDiff = diff), lastDiff); + } + }; + return InMemoryCache; +}(ApolloCache)); +if (globalThis.__DEV__ !== false) { + InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals; +} + +exports.NetworkStatus = void 0; +(function (NetworkStatus) { + NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; + NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; + NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; + NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; + NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; + NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; + NetworkStatus[NetworkStatus["error"] = 8] = "error"; +})(exports.NetworkStatus || (exports.NetworkStatus = {})); +function isNetworkRequestInFlight(networkStatus) { + return networkStatus ? networkStatus < 7 : false; +} +function isNetworkRequestSettled(networkStatus) { + return networkStatus === 7 || networkStatus === 8; +} + +function equalByQuery(query, _a, _b, variables) { + var aData = _a.data, aRest = tslib.__rest(_a, ["data"]); + var bData = _b.data, bRest = tslib.__rest(_b, ["data"]); + return (equal__default(aRest, bRest) && + equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, { + fragmentMap: createFragmentMap(getFragmentDefinitions(query)), + variables: variables, + })); +} +function equalBySelectionSet(selectionSet, aResult, bResult, context) { + if (aResult === bResult) { + return true; + } + var seenSelections = new Set(); + return selectionSet.selections.every(function (selection) { + if (seenSelections.has(selection)) + return true; + seenSelections.add(selection); + if (!shouldInclude(selection, context.variables)) + return true; + if (selectionHasNonreactiveDirective(selection)) + return true; + if (isField(selection)) { + var resultKey = resultKeyNameFromField(selection); + var aResultChild = aResult && aResult[resultKey]; + var bResultChild = bResult && bResult[resultKey]; + var childSelectionSet = selection.selectionSet; + if (!childSelectionSet) { + return equal__default(aResultChild, bResultChild); + } + var aChildIsArray = Array.isArray(aResultChild); + var bChildIsArray = Array.isArray(bResultChild); + if (aChildIsArray !== bChildIsArray) + return false; + if (aChildIsArray && bChildIsArray) { + var length_1 = aResultChild.length; + if (bResultChild.length !== length_1) { + return false; + } + for (var i = 0; i < length_1; ++i) { + if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) { + return false; + } + } + return true; + } + return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context); + } + else { + var fragment = getFragmentFromSelection(selection, context.fragmentMap); + if (fragment) { + if (selectionHasNonreactiveDirective(fragment)) + return true; + return equalBySelectionSet(fragment.selectionSet, + aResult, bResult, context); + } + } + }); +} +function selectionHasNonreactiveDirective(selection) { + return (!!selection.directives && selection.directives.some(directiveIsNonreactive)); +} +function directiveIsNonreactive(dir) { + return dir.name.value === "nonreactive"; +} + +var assign = Object.assign, hasOwnProperty$2 = Object.hasOwnProperty; +var ObservableQuery = (function (_super) { + tslib.__extends(ObservableQuery, _super); + function ObservableQuery(_a) { + var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options; + var _this = _super.call(this, function (observer) { + try { + var subObserver = observer._subscription._observer; + if (subObserver && !subObserver.error) { + subObserver.error = defaultSubscriptionObserverErrorCallback; + } + } + catch (_a) { } + var first = !_this.observers.size; + _this.observers.add(observer); + var last = _this.last; + if (last && last.error) { + observer.error && observer.error(last.error); + } + else if (last && last.result) { + observer.next && observer.next(last.result); + } + if (first) { + _this.reobserve().catch(function () { }); + } + return function () { + if (_this.observers.delete(observer) && !_this.observers.size) { + _this.tearDownQuery(); + } + }; + }) || this; + _this.observers = new Set(); + _this.subscriptions = new Set(); + _this.queryInfo = queryInfo; + _this.queryManager = queryManager; + _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy); + _this.isTornDown = false; + var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d; + var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, + _f = options.initialFetchPolicy, + initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f; + _this.options = tslib.__assign(tslib.__assign({}, options), { + initialFetchPolicy: initialFetchPolicy, + fetchPolicy: fetchPolicy }); + _this.queryId = queryInfo.queryId || queryManager.generateQueryId(); + var opDef = getOperationDefinition(_this.query); + _this.queryName = opDef && opDef.name && opDef.name.value; + return _this; + } + Object.defineProperty(ObservableQuery.prototype, "query", { + get: function () { + return this.lastQuery || this.options.query; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservableQuery.prototype, "variables", { + get: function () { + return this.options.variables; + }, + enumerable: false, + configurable: true + }); + ObservableQuery.prototype.result = function () { + var _this = this; + return new Promise(function (resolve, reject) { + var observer = { + next: function (result) { + resolve(result); + _this.observers.delete(observer); + if (!_this.observers.size) { + _this.queryManager.removeQuery(_this.queryId); + } + setTimeout(function () { + subscription.unsubscribe(); + }, 0); + }, + error: reject, + }; + var subscription = _this.subscribe(observer); + }); + }; + ObservableQuery.prototype.resetDiff = function () { + this.queryInfo.resetDiff(); + }; + ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) { + if (saveAsLastResult === void 0) { saveAsLastResult = true; } + var lastResult = this.getLastResult(true); + var networkStatus = this.queryInfo.networkStatus || + (lastResult && lastResult.networkStatus) || + exports.NetworkStatus.ready; + var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }); + var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a; + if ( + skipCacheDataFor(fetchPolicy) || + this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ; + else if (this.waitForOwnResult) { + this.queryInfo["updateWatch"](); + } + else { + var diff = this.queryInfo.getDiff(); + if (diff.complete || this.options.returnPartialData) { + result.data = diff.result; + } + if (equal.equal(result.data, {})) { + result.data = void 0; + } + if (diff.complete) { + delete result.partial; + if (diff.complete && + result.networkStatus === exports.NetworkStatus.loading && + (fetchPolicy === "cache-first" || fetchPolicy === "cache-only")) { + result.networkStatus = exports.NetworkStatus.ready; + result.loading = false; + } + } + else { + result.partial = true; + } + if (globalThis.__DEV__ !== false && + !diff.complete && + !this.options.partialRefetch && + !result.loading && + !result.data && + !result.error) { + logMissingFieldErrors(diff.missing); + } + } + if (saveAsLastResult) { + this.updateLastResult(result); + } + return result; + }; + ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) { + if (!this.last) { + return true; + } + var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ? + !equalByQuery(this.query, this.last.result, newResult, this.variables) + : !equal.equal(this.last.result, newResult); + return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables))); + }; + ObservableQuery.prototype.getLast = function (key, variablesMustMatch) { + var last = this.last; + if (last && + last[key] && + (!variablesMustMatch || equal.equal(last.variables, this.variables))) { + return last[key]; + } + }; + ObservableQuery.prototype.getLastResult = function (variablesMustMatch) { + return this.getLast("result", variablesMustMatch); + }; + ObservableQuery.prototype.getLastError = function (variablesMustMatch) { + return this.getLast("error", variablesMustMatch); + }; + ObservableQuery.prototype.resetLastResults = function () { + delete this.last; + this.isTornDown = false; + }; + ObservableQuery.prototype.resetQueryStoreErrors = function () { + this.queryManager.resetErrors(this.queryId); + }; + ObservableQuery.prototype.refetch = function (variables) { + var _a; + var reobserveOptions = { + pollInterval: 0, + }; + var fetchPolicy = this.options.fetchPolicy; + if (fetchPolicy === "cache-and-network") { + reobserveOptions.fetchPolicy = fetchPolicy; + } + else if (fetchPolicy === "no-cache") { + reobserveOptions.fetchPolicy = "no-cache"; + } + else { + reobserveOptions.fetchPolicy = "network-only"; + } + if (globalThis.__DEV__ !== false && variables && hasOwnProperty$2.call(variables, "variables")) { + var queryDef = getQueryDefinition(this.query); + var vars = queryDef.variableDefinitions; + if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) { + globalThis.__DEV__ !== false && invariant.warn( + 20, + variables, + ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef + ); + } + } + if (variables && !equal.equal(this.options.variables, variables)) { + reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables); + } + this.queryInfo.resetLastWrite(); + return this.reobserve(reobserveOptions, exports.NetworkStatus.refetch); + }; + ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { + var _this = this; + var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) })))), { + fetchPolicy: "no-cache" }); + combinedOptions.query = this.transformDocument(combinedOptions.query); + var qid = this.queryManager.generateQueryId(); + this.lastQuery = + fetchMoreOptions.query ? + this.transformDocument(this.options.query) + : combinedOptions.query; + var queryInfo = this.queryInfo; + var originalNetworkStatus = queryInfo.networkStatus; + queryInfo.networkStatus = exports.NetworkStatus.fetchMore; + if (combinedOptions.notifyOnNetworkStatusChange) { + this.observe(); + } + var updatedQuerySet = new Set(); + return this.queryManager + .fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore) + .then(function (fetchMoreResult) { + _this.queryManager.removeQuery(qid); + if (queryInfo.networkStatus === exports.NetworkStatus.fetchMore) { + queryInfo.networkStatus = originalNetworkStatus; + } + _this.queryManager.cache.batch({ + update: function (cache) { + var updateQuery = fetchMoreOptions.updateQuery; + if (updateQuery) { + cache.updateQuery({ + query: _this.query, + variables: _this.variables, + returnPartialData: true, + optimistic: false, + }, function (previous) { + return updateQuery(previous, { + fetchMoreResult: fetchMoreResult.data, + variables: combinedOptions.variables, + }); + }); + } + else { + cache.writeQuery({ + query: combinedOptions.query, + variables: combinedOptions.variables, + data: fetchMoreResult.data, + }); + } + }, + onWatchUpdated: function (watch) { + updatedQuerySet.add(watch.query); + }, + }); + return fetchMoreResult; + }) + .finally(function () { + if (!updatedQuerySet.has(_this.query)) { + reobserveCacheFirst(_this); + } + }); + }; + ObservableQuery.prototype.subscribeToMore = function (options) { + var _this = this; + var subscription = this.queryManager + .startGraphQLSubscription({ + query: options.document, + variables: options.variables, + context: options.context, + }) + .subscribe({ + next: function (subscriptionData) { + var updateQuery = options.updateQuery; + if (updateQuery) { + _this.updateQuery(function (previous, _a) { + var variables = _a.variables; + return updateQuery(previous, { + subscriptionData: subscriptionData, + variables: variables, + }); + }); + } + }, + error: function (err) { + if (options.onError) { + options.onError(err); + return; + } + globalThis.__DEV__ !== false && invariant.error(21, err); + }, + }); + this.subscriptions.add(subscription); + return function () { + if (_this.subscriptions.delete(subscription)) { + subscription.unsubscribe(); + } + }; + }; + ObservableQuery.prototype.setOptions = function (newOptions) { + return this.reobserve(newOptions); + }; + ObservableQuery.prototype.silentSetOptions = function (newOptions) { + var mergedOptions = compact(this.options, newOptions || {}); + assign(this.options, mergedOptions); + }; + ObservableQuery.prototype.setVariables = function (variables) { + if (equal.equal(this.variables, variables)) { + return this.observers.size ? this.result() : Promise.resolve(); + } + this.options.variables = variables; + if (!this.observers.size) { + return Promise.resolve(); + } + return this.reobserve({ + fetchPolicy: this.options.initialFetchPolicy, + variables: variables, + }, exports.NetworkStatus.setVariables); + }; + ObservableQuery.prototype.updateQuery = function (mapFn) { + var queryManager = this.queryManager; + var result = queryManager.cache.diff({ + query: this.options.query, + variables: this.variables, + returnPartialData: true, + optimistic: false, + }).result; + var newResult = mapFn(result, { + variables: this.variables, + }); + if (newResult) { + queryManager.cache.writeQuery({ + query: this.options.query, + data: newResult, + variables: this.variables, + }); + queryManager.broadcastQueries(); + } + }; + ObservableQuery.prototype.startPolling = function (pollInterval) { + this.options.pollInterval = pollInterval; + this.updatePolling(); + }; + ObservableQuery.prototype.stopPolling = function () { + this.options.pollInterval = 0; + this.updatePolling(); + }; + ObservableQuery.prototype.applyNextFetchPolicy = function (reason, + options) { + if (options.nextFetchPolicy) { + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b; + if (fetchPolicy === "standby") ; + else if (typeof options.nextFetchPolicy === "function") { + options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, { + reason: reason, + options: options, + observable: this, + initialFetchPolicy: initialFetchPolicy, + }); + } + else if (reason === "variables-changed") { + options.fetchPolicy = initialFetchPolicy; + } + else { + options.fetchPolicy = options.nextFetchPolicy; + } + } + return options.fetchPolicy; + }; + ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) { + this.queryManager.setObservableQuery(this); + return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query); + }; + ObservableQuery.prototype.updatePolling = function () { + var _this = this; + if (this.queryManager.ssrMode) { + return; + } + var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval; + if (!pollInterval) { + if (pollingInfo) { + clearTimeout(pollingInfo.timeout); + delete this.pollingInfo; + } + return; + } + if (pollingInfo && pollingInfo.interval === pollInterval) { + return; + } + invariant(pollInterval, 22); + var info = pollingInfo || (this.pollingInfo = {}); + info.interval = pollInterval; + var maybeFetch = function () { + var _a, _b; + if (_this.pollingInfo) { + if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) && + !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) { + _this.reobserve({ + fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ? + "no-cache" + : "network-only", + }, exports.NetworkStatus.poll).then(poll, poll); + } + else { + poll(); + } + } + }; + var poll = function () { + var info = _this.pollingInfo; + if (info) { + clearTimeout(info.timeout); + info.timeout = setTimeout(maybeFetch, info.interval); + } + }; + poll(); + }; + ObservableQuery.prototype.updateLastResult = function (newResult, variables) { + if (variables === void 0) { variables = this.variables; } + var error = this.getLastError(); + if (error && this.last && !equal.equal(variables, this.last.variables)) { + error = void 0; + } + return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults ? + newResult + : cloneDeep(newResult), variables: variables }, (error ? { error: error } : null))); + }; + ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) { + var _this = this; + this.isTornDown = false; + var useDisposableConcast = + newNetworkStatus === exports.NetworkStatus.refetch || + newNetworkStatus === exports.NetworkStatus.fetchMore || + newNetworkStatus === exports.NetworkStatus.poll; + var oldVariables = this.options.variables; + var oldFetchPolicy = this.options.fetchPolicy; + var mergedOptions = compact(this.options, newOptions || {}); + var options = useDisposableConcast ? + mergedOptions + : assign(this.options, mergedOptions); + var query = this.transformDocument(options.query); + this.lastQuery = query; + if (!useDisposableConcast) { + this.updatePolling(); + if (newOptions && + newOptions.variables && + !equal.equal(newOptions.variables, oldVariables) && + options.fetchPolicy !== "standby" && + options.fetchPolicy === oldFetchPolicy) { + this.applyNextFetchPolicy("variables-changed", options); + if (newNetworkStatus === void 0) { + newNetworkStatus = exports.NetworkStatus.setVariables; + } + } + } + this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy)); + var finishWaitingForOwnResult = function () { + if (_this.concast === concast) { + _this.waitForOwnResult = false; + } + }; + var variables = options.variables && tslib.__assign({}, options.variables); + var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink; + var observer = { + next: function (result) { + if (equal.equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportResult(result, variables); + } + }, + error: function (error) { + if (equal.equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportError(error, variables); + } + }, + }; + if (!useDisposableConcast && (fromLink || !this.concast)) { + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + } + this.concast = concast; + this.observer = observer; + } + concast.addObserver(observer); + return concast; + }; + ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) { + return this.reobserveAsConcast(newOptions, newNetworkStatus) + .promise; + }; + ObservableQuery.prototype.resubscribeAfterError = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var last = this.last; + this.resetLastResults(); + var subscription = this.subscribe.apply(this, args); + this.last = last; + return subscription; + }; + ObservableQuery.prototype.observe = function () { + this.reportResult( + this.getCurrentResult(false), this.variables); + }; + ObservableQuery.prototype.reportResult = function (result, variables) { + var lastError = this.getLastError(); + var isDifferent = this.isDifferentFromLastResult(result, variables); + if (lastError || !result.partial || this.options.returnPartialData) { + this.updateLastResult(result, variables); + } + if (lastError || isDifferent) { + iterateObserversSafely(this.observers, "next", result); + } + }; + ObservableQuery.prototype.reportError = function (error, variables) { + var errorResult = tslib.__assign(tslib.__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false }); + this.updateLastResult(errorResult, variables); + iterateObserversSafely(this.observers, "error", (this.last.error = error)); + }; + ObservableQuery.prototype.hasObservers = function () { + return this.observers.size > 0; + }; + ObservableQuery.prototype.tearDownQuery = function () { + if (this.isTornDown) + return; + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + delete this.concast; + delete this.observer; + } + this.stopPolling(); + this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); + this.subscriptions.clear(); + this.queryManager.stopQuery(this.queryId); + this.observers.clear(); + this.isTornDown = true; + }; + ObservableQuery.prototype.transformDocument = function (document) { + return this.queryManager.transform(document); + }; + return ObservableQuery; +}(zenObservableTs.Observable)); +fixObservableSubclass(ObservableQuery); +function reobserveCacheFirst(obsQuery) { + var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy; + if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") { + return obsQuery.reobserve({ + fetchPolicy: "cache-first", + nextFetchPolicy: function (currentFetchPolicy, context) { + this.nextFetchPolicy = nextFetchPolicy; + if (typeof this.nextFetchPolicy === "function") { + return this.nextFetchPolicy(currentFetchPolicy, context); + } + return fetchPolicy; + }, + }); + } + return obsQuery.reobserve(); +} +function defaultSubscriptionObserverErrorCallback(error) { + globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack); +} +function logMissingFieldErrors(missing) { + if (globalThis.__DEV__ !== false && missing) { + globalThis.__DEV__ !== false && invariant.debug(24, missing); + } +} +function skipCacheDataFor(fetchPolicy ) { + return (fetchPolicy === "network-only" || + fetchPolicy === "no-cache" || + fetchPolicy === "standby"); +} + +var LocalState = (function () { + function LocalState(_a) { + var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; + this.selectionsToResolveCache = new WeakMap(); + this.cache = cache; + if (client) { + this.client = client; + } + if (resolvers) { + this.addResolvers(resolvers); + } + if (fragmentMatcher) { + this.setFragmentMatcher(fragmentMatcher); + } + } + LocalState.prototype.addResolvers = function (resolvers) { + var _this = this; + this.resolvers = this.resolvers || {}; + if (Array.isArray(resolvers)) { + resolvers.forEach(function (resolverGroup) { + _this.resolvers = mergeDeep(_this.resolvers, resolverGroup); + }); + } + else { + this.resolvers = mergeDeep(this.resolvers, resolvers); + } + }; + LocalState.prototype.setResolvers = function (resolvers) { + this.resolvers = {}; + this.addResolvers(resolvers); + }; + LocalState.prototype.getResolvers = function () { + return this.resolvers || {}; + }; + LocalState.prototype.runResolvers = function (_a) { + var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_c) { + if (document) { + return [2 , this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })]; + } + return [2 , remoteResult]; + }); + }); + }; + LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { + this.fragmentMatcher = fragmentMatcher; + }; + LocalState.prototype.getFragmentMatcher = function () { + return this.fragmentMatcher; + }; + LocalState.prototype.clientQuery = function (document) { + if (hasDirectives(["client"], document)) { + if (this.resolvers) { + return document; + } + } + return null; + }; + LocalState.prototype.serverQuery = function (document) { + return removeClientSetsFromDocument(document); + }; + LocalState.prototype.prepareContext = function (context) { + var cache = this.cache; + return tslib.__assign(tslib.__assign({}, context), { cache: cache, + getCacheKey: function (obj) { + return cache.identify(obj); + } }); + }; + LocalState.prototype.addExportedVariables = function (document, variables, context) { + if (variables === void 0) { variables = {}; } + if (context === void 0) { context = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + if (document) { + return [2 , this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })]; + } + return [2 , tslib.__assign({}, variables)]; + }); + }); + }; + LocalState.prototype.shouldForceResolvers = function (document) { + var forceResolvers = false; + graphql.visit(document, { + Directive: { + enter: function (node) { + if (node.name.value === "client" && node.arguments) { + forceResolvers = node.arguments.some(function (arg) { + return arg.name.value === "always" && + arg.value.kind === "BooleanValue" && + arg.value.value === true; + }); + if (forceResolvers) { + return graphql.BREAK; + } + } + }, + }, + }); + return forceResolvers; + }; + LocalState.prototype.buildRootValueFromCache = function (document, variables) { + return this.cache.diff({ + query: buildQueryFromSelectionSet(document), + variables: variables, + returnPartialData: true, + optimistic: false, + }).result; + }; + LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { + if (context === void 0) { context = {}; } + if (variables === void 0) { variables = {}; } + if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } + if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } + return tslib.__awaiter(this, void 0, void 0, function () { + var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant; + return tslib.__generator(this, function (_b) { + mainDefinition = getMainDefinition(document); + fragments = getFragmentDefinitions(document); + fragmentMap = createFragmentMap(fragments); + selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap); + definitionOperation = mainDefinition.operation; + defaultOperationType = definitionOperation ? + definitionOperation.charAt(0).toUpperCase() + + definitionOperation.slice(1) + : "Query"; + _a = this, cache = _a.cache, client = _a.client; + execContext = { + fragmentMap: fragmentMap, + context: tslib.__assign(tslib.__assign({}, context), { cache: cache, client: client }), + variables: variables, + fragmentMatcher: fragmentMatcher, + defaultOperationType: defaultOperationType, + exportedVariables: {}, + selectionsToResolve: selectionsToResolve, + onlyRunForcedResolvers: onlyRunForcedResolvers, + }; + isClientFieldDescendant = false; + return [2 , this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({ + result: result, + exportedVariables: execContext.exportedVariables, + }); })]; + }); + }); + }; + LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var fragmentMap, context, variables, resultsToMerge, execute; + var _this = this; + return tslib.__generator(this, function (_a) { + fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; + resultsToMerge = [rootValue]; + execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () { + var fragment, typeCondition; + return tslib.__generator(this, function (_a) { + if (!isClientFieldDescendant && + !execContext.selectionsToResolve.has(selection)) { + return [2 ]; + } + if (!shouldInclude(selection, variables)) { + return [2 ]; + } + if (isField(selection)) { + return [2 , this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) { + var _a; + if (typeof fieldResult !== "undefined") { + resultsToMerge.push((_a = {}, + _a[resultKeyNameFromField(selection)] = fieldResult, + _a)); + } + })]; + } + if (isInlineFragment(selection)) { + fragment = selection; + } + else { + fragment = fragmentMap[selection.name.value]; + invariant(fragment, 18, selection.name.value); + } + if (fragment && fragment.typeCondition) { + typeCondition = fragment.typeCondition.name.value; + if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { + return [2 , this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) { + resultsToMerge.push(fragmentResult); + })]; + } + } + return [2 ]; + }); + }); }; + return [2 , Promise.all(selectionSet.selections.map(execute)).then(function () { + return mergeDeepArray(resultsToMerge); + })]; + }); + }); + }; + LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; + var _this = this; + return tslib.__generator(this, function (_a) { + if (!rootValue) { + return [2 , null]; + } + variables = execContext.variables; + fieldName = field.name.value; + aliasedFieldName = resultKeyNameFromField(field); + aliasUsed = fieldName !== aliasedFieldName; + defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; + resultPromise = Promise.resolve(defaultResult); + if (!execContext.onlyRunForcedResolvers || + this.shouldForceResolvers(field)) { + resolverType = rootValue.__typename || execContext.defaultOperationType; + resolverMap = this.resolvers && this.resolvers[resolverType]; + if (resolverMap) { + resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; + if (resolve) { + resultPromise = Promise.resolve( + cacheSlot.withValue(this.cache, resolve, [ + rootValue, + argumentsObjectFromField(field, variables), + execContext.context, + { field: field, fragmentMap: execContext.fragmentMap }, + ])); + } + } + } + return [2 , resultPromise.then(function (result) { + var _a, _b; + if (result === void 0) { result = defaultResult; } + if (field.directives) { + field.directives.forEach(function (directive) { + if (directive.name.value === "export" && directive.arguments) { + directive.arguments.forEach(function (arg) { + if (arg.name.value === "as" && arg.value.kind === "StringValue") { + execContext.exportedVariables[arg.value.value] = result; + } + }); + } + }); + } + if (!field.selectionSet) { + return result; + } + if (result == null) { + return result; + } + var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === "client"; })) !== null && _b !== void 0 ? _b : false; + if (Array.isArray(result)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext); + } + })]; + }); + }); + }; + LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) { + var _this = this; + return Promise.all(result.map(function (item) { + if (item === null) { + return null; + } + if (Array.isArray(item)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext); + } + })); + }; + LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) { + var isSingleASTNode = function (node) { return !Array.isArray(node); }; + var selectionsToResolveCache = this.selectionsToResolveCache; + function collectByDefinition(definitionNode) { + if (!selectionsToResolveCache.has(definitionNode)) { + var matches_1 = new Set(); + selectionsToResolveCache.set(definitionNode, matches_1); + graphql.visit(definitionNode, { + Directive: function (node, _, __, ___, ancestors) { + if (node.name.value === "client") { + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && graphql.isSelectionNode(node)) { + matches_1.add(node); + } + }); + } + }, + FragmentSpread: function (spread, _, __, ___, ancestors) { + var fragment = fragmentMap[spread.name.value]; + invariant(fragment, 19, spread.name.value); + var fragmentSelections = collectByDefinition(fragment); + if (fragmentSelections.size > 0) { + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && graphql.isSelectionNode(node)) { + matches_1.add(node); + } + }); + matches_1.add(spread); + fragmentSelections.forEach(function (selection) { + matches_1.add(selection); + }); + } + }, + }); + } + return selectionsToResolveCache.get(definitionNode); + } + return collectByDefinition(mainDefinition); + }; + return LocalState; +}()); + +var destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)(); +function wrapDestructiveCacheMethod(cache, methodName) { + var original = cache[methodName]; + if (typeof original === "function") { + cache[methodName] = function () { + destructiveMethodCounts.set(cache, + (destructiveMethodCounts.get(cache) + 1) % 1e15); + return original.apply(this, arguments); + }; + } +} +function cancelNotifyTimeout(info) { + if (info["notifyTimeout"]) { + clearTimeout(info["notifyTimeout"]); + info["notifyTimeout"] = void 0; + } +} +var QueryInfo = (function () { + function QueryInfo(queryManager, queryId) { + if (queryId === void 0) { queryId = queryManager.generateQueryId(); } + this.queryId = queryId; + this.listeners = new Set(); + this.document = null; + this.lastRequestId = 1; + this.stopped = false; + this.dirty = false; + this.observableQuery = null; + var cache = (this.cache = queryManager.cache); + if (!destructiveMethodCounts.has(cache)) { + destructiveMethodCounts.set(cache, 0); + wrapDestructiveCacheMethod(cache, "evict"); + wrapDestructiveCacheMethod(cache, "modify"); + wrapDestructiveCacheMethod(cache, "reset"); + } + } + QueryInfo.prototype.init = function (query) { + var networkStatus = query.networkStatus || exports.NetworkStatus.loading; + if (this.variables && + this.networkStatus !== exports.NetworkStatus.loading && + !equal.equal(this.variables, query.variables)) { + networkStatus = exports.NetworkStatus.setVariables; + } + if (!equal.equal(query.variables, this.variables)) { + this.lastDiff = void 0; + } + Object.assign(this, { + document: query.document, + variables: query.variables, + networkError: null, + graphQLErrors: this.graphQLErrors || [], + networkStatus: networkStatus, + }); + if (query.observableQuery) { + this.setObservableQuery(query.observableQuery); + } + if (query.lastRequestId) { + this.lastRequestId = query.lastRequestId; + } + return this; + }; + QueryInfo.prototype.reset = function () { + cancelNotifyTimeout(this); + this.dirty = false; + }; + QueryInfo.prototype.resetDiff = function () { + this.lastDiff = void 0; + }; + QueryInfo.prototype.getDiff = function () { + var options = this.getDiffOptions(); + if (this.lastDiff && equal.equal(options, this.lastDiff.options)) { + return this.lastDiff.diff; + } + this.updateWatch(this.variables); + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return { complete: false }; + } + var diff = this.cache.diff(options); + this.updateLastDiff(diff, options); + return diff; + }; + QueryInfo.prototype.updateLastDiff = function (diff, options) { + this.lastDiff = + diff ? + { + diff: diff, + options: options || this.getDiffOptions(), + } + : void 0; + }; + QueryInfo.prototype.getDiffOptions = function (variables) { + var _a; + if (variables === void 0) { variables = this.variables; } + return { + query: this.document, + variables: variables, + returnPartialData: true, + optimistic: true, + canonizeResults: (_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.canonizeResults, + }; + }; + QueryInfo.prototype.setDiff = function (diff) { + var _this = this; + var _a; + var oldDiff = this.lastDiff && this.lastDiff.diff; + if (diff && + !diff.complete && + !((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.returnPartialData) && + !(oldDiff && oldDiff.complete)) { + return; + } + this.updateLastDiff(diff); + if (!this.dirty && !equal.equal(oldDiff && oldDiff.result, diff && diff.result)) { + this.dirty = true; + if (!this.notifyTimeout) { + this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0); + } + } + }; + QueryInfo.prototype.setObservableQuery = function (oq) { + var _this = this; + if (oq === this.observableQuery) + return; + if (this.oqListener) { + this.listeners.delete(this.oqListener); + } + this.observableQuery = oq; + if (oq) { + oq["queryInfo"] = this; + this.listeners.add((this.oqListener = function () { + var diff = _this.getDiff(); + if (diff.fromOptimisticTransaction) { + oq["observe"](); + } + else { + reobserveCacheFirst(oq); + } + })); + } + else { + delete this.oqListener; + } + }; + QueryInfo.prototype.notify = function () { + var _this = this; + cancelNotifyTimeout(this); + if (this.shouldNotify()) { + this.listeners.forEach(function (listener) { return listener(_this); }); + } + this.dirty = false; + }; + QueryInfo.prototype.shouldNotify = function () { + if (!this.dirty || !this.listeners.size) { + return false; + } + if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) { + var fetchPolicy = this.observableQuery.options.fetchPolicy; + if (fetchPolicy !== "cache-only" && fetchPolicy !== "cache-and-network") { + return false; + } + } + return true; + }; + QueryInfo.prototype.stop = function () { + if (!this.stopped) { + this.stopped = true; + this.reset(); + this.cancel(); + this.cancel = QueryInfo.prototype.cancel; + var oq = this.observableQuery; + if (oq) + oq.stopPolling(); + } + }; + QueryInfo.prototype.cancel = function () { }; + QueryInfo.prototype.updateWatch = function (variables) { + var _this = this; + if (variables === void 0) { variables = this.variables; } + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return; + } + var watchOptions = tslib.__assign(tslib.__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } }); + if (!this.lastWatch || !equal.equal(watchOptions, this.lastWatch)) { + this.cancel(); + this.cancel = this.cache.watch((this.lastWatch = watchOptions)); + } + }; + QueryInfo.prototype.resetLastWrite = function () { + this.lastWrite = void 0; + }; + QueryInfo.prototype.shouldWrite = function (result, variables) { + var lastWrite = this.lastWrite; + return !(lastWrite && + lastWrite.dmCount === destructiveMethodCounts.get(this.cache) && + equal.equal(variables, lastWrite.variables) && + equal.equal(result.data, lastWrite.result.data)); + }; + QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) { + var _this = this; + var merger = new DeepMerger(); + var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + this.reset(); + if ("incremental" in result && isNonEmptyArray(result.incremental)) { + var mergedData = mergeIncrementalData(this.getDiff().result, result); + result.data = mergedData; + } + else if ("hasNext" in result && result.hasNext) { + var diff = this.getDiff(); + result.data = merger.merge(diff.result, result.data); + } + this.graphQLErrors = graphQLErrors; + if (options.fetchPolicy === "no-cache") { + this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables)); + } + else if (cacheWriteBehavior !== 0 ) { + if (shouldWriteResult(result, options.errorPolicy)) { + this.cache.performTransaction(function (cache) { + if (_this.shouldWrite(result, options.variables)) { + cache.writeQuery({ + query: document, + data: result.data, + variables: options.variables, + overwrite: cacheWriteBehavior === 1 , + }); + _this.lastWrite = { + result: result, + variables: options.variables, + dmCount: destructiveMethodCounts.get(_this.cache), + }; + } + else { + if (_this.lastDiff && _this.lastDiff.diff.complete) { + result.data = _this.lastDiff.diff.result; + return; + } + } + var diffOptions = _this.getDiffOptions(options.variables); + var diff = cache.diff(diffOptions); + if (!_this.stopped && equal.equal(_this.variables, options.variables)) { + _this.updateWatch(options.variables); + } + _this.updateLastDiff(diff, diffOptions); + if (diff.complete) { + result.data = diff.result; + } + }); + } + else { + this.lastWrite = void 0; + } + } + }; + QueryInfo.prototype.markReady = function () { + this.networkError = null; + return (this.networkStatus = exports.NetworkStatus.ready); + }; + QueryInfo.prototype.markError = function (error) { + this.networkStatus = exports.NetworkStatus.error; + this.lastWrite = void 0; + this.reset(); + if (error.graphQLErrors) { + this.graphQLErrors = error.graphQLErrors; + } + if (error.networkError) { + this.networkError = error.networkError; + } + return error; + }; + return QueryInfo; +}()); +function shouldWriteResult(result, errorPolicy) { + if (errorPolicy === void 0) { errorPolicy = "none"; } + var ignoreErrors = errorPolicy === "ignore" || errorPolicy === "all"; + var writeWithErrors = !graphQLResultHasError(result); + if (!writeWithErrors && ignoreErrors && result.data) { + writeWithErrors = true; + } + return writeWithErrors; +} + +var hasOwnProperty$1 = Object.prototype.hasOwnProperty; +var IGNORE = Object.create(null); +var QueryManager = (function () { + function QueryManager(_a) { + var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext; + var _this = this; + this.clientAwareness = {}; + this.queries = new Map(); + this.fetchCancelFns = new Map(); + this.transformCache = new AutoCleanedWeakCache(cacheSizes["queryManager.getDocumentInfo"] || + 2000 ); + this.queryIdCounter = 1; + this.requestIdCounter = 1; + this.mutationIdCounter = 1; + this.inFlightLinkObservables = new trie.Trie(false); + var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, + { cache: false }); + this.cache = cache; + this.link = link; + this.defaultOptions = defaultOptions || Object.create(null); + this.queryDeduplication = queryDeduplication; + this.clientAwareness = clientAwareness; + this.localState = localState || new LocalState({ cache: cache }); + this.ssrMode = ssrMode; + this.assumeImmutableResults = assumeImmutableResults; + this.documentTransform = + documentTransform ? + defaultDocumentTransform + .concat(documentTransform) + .concat(defaultDocumentTransform) + : defaultDocumentTransform; + this.defaultContext = defaultContext || Object.create(null); + if ((this.onBroadcast = onBroadcast)) { + this.mutationStore = Object.create(null); + } + } + QueryManager.prototype.stop = function () { + var _this = this; + this.queries.forEach(function (_info, queryId) { + _this.stopQueryNoBroadcast(queryId); + }); + this.cancelPendingFetches(newInvariantError(25)); + }; + QueryManager.prototype.cancelPendingFetches = function (error) { + this.fetchCancelFns.forEach(function (cancel) { return cancel(error); }); + this.fetchCancelFns.clear(); + }; + QueryManager.prototype.mutate = function (_a) { + var _b, _c; + var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || "network-only" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || "none" : _g, keepRootFields = _a.keepRootFields, context = _a.context; + return tslib.__awaiter(this, void 0, void 0, function () { + var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self; + return tslib.__generator(this, function (_h) { + switch (_h.label) { + case 0: + invariant(mutation, 26); + invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27); + mutationId = this.generateMutationId(); + mutation = this.cache.transformForLink(this.transform(mutation)); + hasClientExports = this.getDocumentInfo(mutation).hasClientExports; + variables = this.getVariables(mutation, variables); + if (!hasClientExports) return [3 , 2]; + return [4 , this.localState.addExportedVariables(mutation, variables, context)]; + case 1: + variables = (_h.sent()); + _h.label = 2; + case 2: + mutationStoreValue = this.mutationStore && + (this.mutationStore[mutationId] = { + mutation: mutation, + variables: variables, + loading: true, + error: null, + }); + isOptimistic = optimisticResponse && + this.markMutationOptimistic(optimisticResponse, { + mutationId: mutationId, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + updateQueries: updateQueries, + update: updateWithProxyFn, + keepRootFields: keepRootFields, + }); + this.broadcastQueries(); + self = this; + return [2 , new Promise(function (resolve, reject) { + return asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) { + if (graphQLResultHasError(result) && errorPolicy === "none") { + throw new ApolloError({ + graphQLErrors: getGraphQLErrorsFromResult(result), + }); + } + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = null; + } + var storeResult = tslib.__assign({}, result); + if (typeof refetchQueries === "function") { + refetchQueries = refetchQueries(storeResult); + } + if (errorPolicy === "ignore" && graphQLResultHasError(storeResult)) { + delete storeResult.errors; + } + return self.markMutationResult({ + mutationId: mutationId, + result: storeResult, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + update: updateWithProxyFn, + updateQueries: updateQueries, + awaitRefetchQueries: awaitRefetchQueries, + refetchQueries: refetchQueries, + removeOptimistic: isOptimistic ? mutationId : void 0, + onQueryUpdated: onQueryUpdated, + keepRootFields: keepRootFields, + }); + }).subscribe({ + next: function (storeResult) { + self.broadcastQueries(); + if (!("hasNext" in storeResult) || storeResult.hasNext === false) { + resolve(storeResult); + } + }, + error: function (err) { + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = err; + } + if (isOptimistic) { + self.cache.removeOptimistic(mutationId); + } + self.broadcastQueries(); + reject(err instanceof ApolloError ? err : (new ApolloError({ + networkError: err, + }))); + }, + }); + })]; + } + }); + }); + }; + QueryManager.prototype.markMutationResult = function (mutation, cache) { + var _this = this; + if (cache === void 0) { cache = this.cache; } + var result = mutation.result; + var cacheWrites = []; + var skipCache = mutation.fetchPolicy === "no-cache"; + if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) { + if (!isExecutionPatchIncrementalResult(result)) { + cacheWrites.push({ + result: result.data, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + query: this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + var mergedData = void 0; + if (diff.result) { + mergedData = mergeIncrementalData(diff.result, result); + } + if (typeof mergedData !== "undefined") { + result.data = mergedData; + cacheWrites.push({ + result: mergedData, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + } + var updateQueries_1 = mutation.updateQueries; + if (updateQueries_1) { + this.queries.forEach(function (_a, queryId) { + var observableQuery = _a.observableQuery; + var queryName = observableQuery && observableQuery.queryName; + if (!queryName || !hasOwnProperty$1.call(updateQueries_1, queryName)) { + return; + } + var updater = updateQueries_1[queryName]; + var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables; + var _c = cache.diff({ + query: document, + variables: variables, + returnPartialData: true, + optimistic: false, + }), currentQueryResult = _c.result, complete = _c.complete; + if (complete && currentQueryResult) { + var nextQueryResult = updater(currentQueryResult, { + mutationResult: result, + queryName: (document && getOperationName(document)) || void 0, + queryVariables: variables, + }); + if (nextQueryResult) { + cacheWrites.push({ + result: nextQueryResult, + dataId: "ROOT_QUERY", + query: document, + variables: variables, + }); + } + } + }); + } + } + if (cacheWrites.length > 0 || + (mutation.refetchQueries || "").length > 0 || + mutation.update || + mutation.onQueryUpdated || + mutation.removeOptimistic) { + var results_1 = []; + this.refetchQueries({ + updateCache: function (cache) { + if (!skipCache) { + cacheWrites.forEach(function (write) { return cache.write(write); }); + } + var update = mutation.update; + var isFinalResult = !isExecutionPatchResult(result) || + (isExecutionPatchIncrementalResult(result) && !result.hasNext); + if (update) { + if (!skipCache) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + query: _this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + if (diff.complete) { + result = tslib.__assign(tslib.__assign({}, result), { data: diff.result }); + if ("incremental" in result) { + delete result.incremental; + } + if ("hasNext" in result) { + delete result.hasNext; + } + } + } + if (isFinalResult) { + update(cache, result, { + context: mutation.context, + variables: mutation.variables, + }); + } + } + if (!skipCache && !mutation.keepRootFields && isFinalResult) { + cache.modify({ + id: "ROOT_MUTATION", + fields: function (value, _a) { + var fieldName = _a.fieldName, DELETE = _a.DELETE; + return fieldName === "__typename" ? value : DELETE; + }, + }); + } + }, + include: mutation.refetchQueries, + optimistic: false, + removeOptimistic: mutation.removeOptimistic, + onQueryUpdated: mutation.onQueryUpdated || null, + }).forEach(function (result) { return results_1.push(result); }); + if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) { + return Promise.all(results_1).then(function () { return result; }); + } + } + return Promise.resolve(result); + }; + QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) { + var _this = this; + var data = typeof optimisticResponse === "function" ? + optimisticResponse(mutation.variables, { IGNORE: IGNORE }) + : optimisticResponse; + if (data === IGNORE) { + return false; + } + this.cache.recordOptimisticTransaction(function (cache) { + try { + _this.markMutationResult(tslib.__assign(tslib.__assign({}, mutation), { result: { data: data } }), cache); + } + catch (error) { + globalThis.__DEV__ !== false && invariant.error(error); + } + }, mutation.mutationId); + return true; + }; + QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) { + return this.fetchConcastWithInfo(queryId, options, networkStatus).concast + .promise; + }; + QueryManager.prototype.getQueryStore = function () { + var store = Object.create(null); + this.queries.forEach(function (info, queryId) { + store[queryId] = { + variables: info.variables, + networkStatus: info.networkStatus, + networkError: info.networkError, + graphQLErrors: info.graphQLErrors, + }; + }); + return store; + }; + QueryManager.prototype.resetErrors = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) { + queryInfo.networkError = undefined; + queryInfo.graphQLErrors = []; + } + }; + QueryManager.prototype.transform = function (document) { + return this.documentTransform.transformDocument(document); + }; + QueryManager.prototype.getDocumentInfo = function (document) { + var transformCache = this.transformCache; + if (!transformCache.has(document)) { + var cacheEntry = { + hasClientExports: hasClientExports(document), + hasForcedResolvers: this.localState.shouldForceResolvers(document), + hasNonreactiveDirective: hasDirectives(["nonreactive"], document), + clientQuery: this.localState.clientQuery(document), + serverQuery: removeDirectivesFromDocument([ + { name: "client", remove: true }, + { name: "connection" }, + { name: "nonreactive" }, + ], document), + defaultVars: getDefaultValues(getOperationDefinition(document)), + asQuery: tslib.__assign(tslib.__assign({}, document), { definitions: document.definitions.map(function (def) { + if (def.kind === "OperationDefinition" && + def.operation !== "query") { + return tslib.__assign(tslib.__assign({}, def), { operation: "query" }); + } + return def; + }) }), + }; + transformCache.set(document, cacheEntry); + } + return transformCache.get(document); + }; + QueryManager.prototype.getVariables = function (document, variables) { + return tslib.__assign(tslib.__assign({}, this.getDocumentInfo(document).defaultVars), variables); + }; + QueryManager.prototype.watchQuery = function (options) { + var query = this.transform(options.query); + options = tslib.__assign(tslib.__assign({}, options), { variables: this.getVariables(query, options.variables) }); + if (typeof options.notifyOnNetworkStatusChange === "undefined") { + options.notifyOnNetworkStatusChange = false; + } + var queryInfo = new QueryInfo(this); + var observable = new ObservableQuery({ + queryManager: this, + queryInfo: queryInfo, + options: options, + }); + observable["lastQuery"] = query; + this.queries.set(observable.queryId, queryInfo); + queryInfo.init({ + document: query, + observableQuery: observable, + variables: observable.variables, + }); + return observable; + }; + QueryManager.prototype.query = function (options, queryId) { + var _this = this; + if (queryId === void 0) { queryId = this.generateQueryId(); } + invariant(options.query, 28); + invariant(options.query.kind === "Document", 29); + invariant(!options.returnPartialData, 30); + invariant(!options.pollInterval, 31); + return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); }); + }; + QueryManager.prototype.generateQueryId = function () { + return String(this.queryIdCounter++); + }; + QueryManager.prototype.generateRequestId = function () { + return this.requestIdCounter++; + }; + QueryManager.prototype.generateMutationId = function () { + return String(this.mutationIdCounter++); + }; + QueryManager.prototype.stopQueryInStore = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) + queryInfo.stop(); + }; + QueryManager.prototype.clearStore = function (options) { + if (options === void 0) { options = { + discardWatches: true, + }; } + this.cancelPendingFetches(newInvariantError(32)); + this.queries.forEach(function (queryInfo) { + if (queryInfo.observableQuery) { + queryInfo.networkStatus = exports.NetworkStatus.loading; + } + else { + queryInfo.stop(); + } + }); + if (this.mutationStore) { + this.mutationStore = Object.create(null); + } + return this.cache.reset(options); + }; + QueryManager.prototype.getObservableQueries = function (include) { + var _this = this; + if (include === void 0) { include = "active"; } + var queries = new Map(); + var queryNamesAndDocs = new Map(); + var legacyQueryOptions = new Set(); + if (Array.isArray(include)) { + include.forEach(function (desc) { + if (typeof desc === "string") { + queryNamesAndDocs.set(desc, false); + } + else if (isDocumentNode(desc)) { + queryNamesAndDocs.set(_this.transform(desc), false); + } + else if (isNonNullObject(desc) && desc.query) { + legacyQueryOptions.add(desc); + } + }); + } + this.queries.forEach(function (_a, queryId) { + var oq = _a.observableQuery, document = _a.document; + if (oq) { + if (include === "all") { + queries.set(queryId, oq); + return; + } + var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy; + if (fetchPolicy === "standby" || + (include === "active" && !oq.hasObservers())) { + return; + } + if (include === "active" || + (queryName && queryNamesAndDocs.has(queryName)) || + (document && queryNamesAndDocs.has(document))) { + queries.set(queryId, oq); + if (queryName) + queryNamesAndDocs.set(queryName, true); + if (document) + queryNamesAndDocs.set(document, true); + } + } + }); + if (legacyQueryOptions.size) { + legacyQueryOptions.forEach(function (options) { + var queryId = makeUniqueId("legacyOneTimeQuery"); + var queryInfo = _this.getQuery(queryId).init({ + document: options.query, + variables: options.variables, + }); + var oq = new ObservableQuery({ + queryManager: _this, + queryInfo: queryInfo, + options: tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "network-only" }), + }); + invariant(oq.queryId === queryId); + queryInfo.setObservableQuery(oq); + queries.set(queryId, oq); + }); + } + if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) { + queryNamesAndDocs.forEach(function (included, nameOrDoc) { + if (!included) { + globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc); + } + }); + } + return queries; + }; + QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { + var _this = this; + if (includeStandby === void 0) { includeStandby = false; } + var observableQueryPromises = []; + this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) { + var fetchPolicy = observableQuery.options.fetchPolicy; + observableQuery.resetLastResults(); + if (includeStandby || + (fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) { + observableQueryPromises.push(observableQuery.refetch()); + } + _this.getQuery(queryId).setDiff(null); + }); + this.broadcastQueries(); + return Promise.all(observableQueryPromises); + }; + QueryManager.prototype.setObservableQuery = function (observableQuery) { + this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); + }; + QueryManager.prototype.startGraphQLSubscription = function (_a) { + var _this = this; + var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c; + query = this.transform(query); + variables = this.getVariables(query, variables); + var makeObservable = function (variables) { + return _this.getObservableFromLink(query, context, variables).map(function (result) { + if (fetchPolicy !== "no-cache") { + if (shouldWriteResult(result, errorPolicy)) { + _this.cache.write({ + query: query, + result: result.data, + dataId: "ROOT_SUBSCRIPTION", + variables: variables, + }); + } + _this.broadcastQueries(); + } + var hasErrors = graphQLResultHasError(result); + var hasProtocolErrors = graphQLResultHasProtocolErrors(result); + if (hasErrors || hasProtocolErrors) { + var errors = {}; + if (hasErrors) { + errors.graphQLErrors = result.errors; + } + if (hasProtocolErrors) { + errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL]; + } + if (errorPolicy === "none" || hasProtocolErrors) { + throw new ApolloError(errors); + } + } + if (errorPolicy === "ignore") { + delete result.errors; + } + return result; + }); + }; + if (this.getDocumentInfo(query).hasClientExports) { + var observablePromise_1 = this.localState + .addExportedVariables(query, variables, context) + .then(makeObservable); + return new zenObservableTs.Observable(function (observer) { + var sub = null; + observablePromise_1.then(function (observable) { return (sub = observable.subscribe(observer)); }, observer.error); + return function () { return sub && sub.unsubscribe(); }; + }); + } + return makeObservable(variables); + }; + QueryManager.prototype.stopQuery = function (queryId) { + this.stopQueryNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.removeQuery(queryId); + }; + QueryManager.prototype.removeQuery = function (queryId) { + this.fetchCancelFns.delete(queryId); + if (this.queries.has(queryId)) { + this.getQuery(queryId).stop(); + this.queries.delete(queryId); + } + }; + QueryManager.prototype.broadcastQueries = function () { + if (this.onBroadcast) + this.onBroadcast(); + this.queries.forEach(function (info) { return info.notify(); }); + }; + QueryManager.prototype.getLocalState = function () { + return this.localState; + }; + QueryManager.prototype.getObservableFromLink = function (query, context, variables, + deduplication) { + var _this = this; + var _a; + if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; } + var observable; + var _b = this.getDocumentInfo(query), serverQuery = _b.serverQuery, clientQuery = _b.clientQuery; + if (serverQuery) { + var _c = this, inFlightLinkObservables_1 = _c.inFlightLinkObservables, link = _c.link; + var operation = { + query: serverQuery, + variables: variables, + operationName: getOperationName(serverQuery) || void 0, + context: this.prepareContext(tslib.__assign(tslib.__assign({}, context), { forceFetch: !deduplication })), + }; + context = operation.context; + if (deduplication) { + var printedServerQuery_1 = print(serverQuery); + var varJson_1 = canonicalStringify(variables); + var entry = inFlightLinkObservables_1.lookup(printedServerQuery_1, varJson_1); + observable = entry.observable; + if (!observable) { + var concast = new Concast([ + execute(link, operation), + ]); + observable = entry.observable = concast; + concast.beforeNext(function () { + inFlightLinkObservables_1.remove(printedServerQuery_1, varJson_1); + }); + } + } + else { + observable = new Concast([ + execute(link, operation), + ]); + } + } + else { + observable = new Concast([zenObservableTs.Observable.of({ data: {} })]); + context = this.prepareContext(context); + } + if (clientQuery) { + observable = asyncMap(observable, function (result) { + return _this.localState.runResolvers({ + document: clientQuery, + remoteResult: result, + context: context, + variables: variables, + }); + }); + } + return observable; + }; + QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) { + var requestId = (queryInfo.lastRequestId = this.generateRequestId()); + var linkDocument = this.cache.transformForLink(options.query); + return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) { + var graphQLErrors = getGraphQLErrorsFromResult(result); + var hasErrors = graphQLErrors.length > 0; + if (requestId >= queryInfo.lastRequestId) { + if (hasErrors && options.errorPolicy === "none") { + throw queryInfo.markError(new ApolloError({ + graphQLErrors: graphQLErrors, + })); + } + queryInfo.markResult(result, linkDocument, options, cacheWriteBehavior); + queryInfo.markReady(); + } + var aqr = { + data: result.data, + loading: false, + networkStatus: exports.NetworkStatus.ready, + }; + if (hasErrors && options.errorPolicy !== "ignore") { + aqr.errors = graphQLErrors; + aqr.networkStatus = exports.NetworkStatus.error; + } + return aqr; + }, function (networkError) { + var error = isApolloError(networkError) ? networkError : (new ApolloError({ networkError: networkError })); + if (requestId >= queryInfo.lastRequestId) { + queryInfo.markError(error); + } + throw error; + }); + }; + QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, + networkStatus, query) { + var _this = this; + if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; } + if (query === void 0) { query = options.query; } + var variables = this.getVariables(query, options.variables); + var queryInfo = this.getQuery(queryId); + var defaults = this.defaultOptions.watchQuery; + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e; + var normalized = Object.assign({}, options, { + query: query, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + returnPartialData: returnPartialData, + notifyOnNetworkStatusChange: notifyOnNetworkStatusChange, + context: context, + }); + var fromVariables = function (variables) { + normalized.variables = variables; + var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus); + if ( + normalized.fetchPolicy !== "standby" && + sourcesWithInfo.sources.length > 0 && + queryInfo.observableQuery) { + queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options); + } + return sourcesWithInfo; + }; + var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); }; + this.fetchCancelFns.set(queryId, function (reason) { + cleanupCancelFn(); + setTimeout(function () { return concast.cancel(reason); }); + }); + var concast, containsDataFromLink; + if (this.getDocumentInfo(normalized.query).hasClientExports) { + concast = new Concast(this.localState + .addExportedVariables(normalized.query, normalized.variables, normalized.context) + .then(fromVariables) + .then(function (sourcesWithInfo) { return sourcesWithInfo.sources; })); + containsDataFromLink = true; + } + else { + var sourcesWithInfo = fromVariables(normalized.variables); + containsDataFromLink = sourcesWithInfo.fromLink; + concast = new Concast(sourcesWithInfo.sources); + } + concast.promise.then(cleanupCancelFn, cleanupCancelFn); + return { + concast: concast, + fromLink: containsDataFromLink, + }; + }; + QueryManager.prototype.refetchQueries = function (_a) { + var _this = this; + var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? makeUniqueId("refetchQueries") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated; + var includedQueriesById = new Map(); + if (include) { + this.getObservableQueries(include).forEach(function (oq, queryId) { + includedQueriesById.set(queryId, { + oq: oq, + lastDiff: _this.getQuery(queryId).getDiff(), + }); + }); + } + var results = new Map(); + if (updateCache) { + this.cache.batch({ + update: updateCache, + optimistic: (optimistic && removeOptimistic) || false, + removeOptimistic: removeOptimistic, + onWatchUpdated: function (watch, diff, lastDiff) { + var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery; + if (oq) { + if (onQueryUpdated) { + includedQueriesById.delete(oq.queryId); + var result = onQueryUpdated(oq, diff, lastDiff); + if (result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + return result; + } + if (onQueryUpdated !== null) { + includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff }); + } + } + }, + }); + } + if (includedQueriesById.size) { + includedQueriesById.forEach(function (_a, queryId) { + var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff; + var result; + if (onQueryUpdated) { + if (!diff) { + var info = oq["queryInfo"]; + info.reset(); + diff = info.getDiff(); + } + result = onQueryUpdated(oq, diff, lastDiff); + } + if (!onQueryUpdated || result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + if (queryId.indexOf("legacyOneTimeQuery") >= 0) { + _this.stopQueryNoBroadcast(queryId); + } + }); + } + if (removeOptimistic) { + this.cache.removeOptimistic(removeOptimistic); + } + return results; + }; + QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, + networkStatus) { + var _this = this; + var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange; + var oldNetworkStatus = queryInfo.networkStatus; + queryInfo.init({ + document: query, + variables: variables, + networkStatus: networkStatus, + }); + var readCache = function () { return queryInfo.getDiff(); }; + var resultsFromCache = function (diff, networkStatus) { + if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || exports.NetworkStatus.loading; } + var data = diff.result; + if (globalThis.__DEV__ !== false && !returnPartialData && !equal.equal(data, {})) { + logMissingFieldErrors(diff.missing); + } + var fromData = function (data) { + return zenObservableTs.Observable.of(tslib.__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); + }; + if (data && _this.getDocumentInfo(query).hasForcedResolvers) { + return _this.localState + .runResolvers({ + document: query, + remoteResult: { data: data }, + context: context, + variables: variables, + onlyRunForcedResolvers: true, + }) + .then(function (resolved) { return fromData(resolved.data || void 0); }); + } + if (errorPolicy === "none" && + networkStatus === exports.NetworkStatus.refetch && + Array.isArray(diff.missing)) { + return fromData(void 0); + } + return fromData(data); + }; + var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 + : (networkStatus === exports.NetworkStatus.refetch && + refetchWritePolicy !== "merge") ? + 1 + : 2 ; + var resultsFromLink = function () { + return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, { + query: query, + variables: variables, + context: context, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + }); + }; + var shouldNotify = notifyOnNetworkStatusChange && + typeof oldNetworkStatus === "number" && + oldNetworkStatus !== networkStatus && + isNetworkRequestInFlight(networkStatus); + switch (fetchPolicy) { + default: + case "cache-first": { + var diff = readCache(); + if (diff.complete) { + return { + fromLink: false, + sources: [resultsFromCache(diff, queryInfo.markReady())], + }; + } + if (returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-and-network": { + var diff = readCache(); + if (diff.complete || returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-only": + return { + fromLink: false, + sources: [resultsFromCache(readCache(), queryInfo.markReady())], + }; + case "network-only": + if (shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(readCache()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "no-cache": + if (shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "standby": + return { fromLink: false, sources: [] }; + } + }; + QueryManager.prototype.getQuery = function (queryId) { + if (queryId && !this.queries.has(queryId)) { + this.queries.set(queryId, new QueryInfo(this, queryId)); + } + return this.queries.get(queryId); + }; + QueryManager.prototype.prepareContext = function (context) { + if (context === void 0) { context = {}; } + var newContext = this.localState.prepareContext(context); + return tslib.__assign(tslib.__assign(tslib.__assign({}, this.defaultContext), newContext), { clientAwareness: this.clientAwareness }); + }; + return QueryManager; +}()); + +var hasSuggestedDevtools = false; +var ApolloClient = (function () { + function ApolloClient(options) { + var _this = this; + this.resetStoreCallbacks = []; + this.clearStoreCallbacks = []; + if (!options.cache) { + throw newInvariantError(15); + } + var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, + _c = options.connectToDevTools, + connectToDevTools = _c === void 0 ? typeof window === "object" && + !window.__APOLLO_CLIENT__ && + globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; + var link = options.link; + if (!link) { + link = + uri ? new HttpLink({ uri: uri, credentials: credentials, headers: headers }) : ApolloLink.empty(); + } + this.link = link; + this.cache = cache; + this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; + this.queryDeduplication = queryDeduplication; + this.defaultOptions = defaultOptions || Object.create(null); + this.typeDefs = typeDefs; + if (ssrForceFetchDelay) { + setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); + } + this.watchQuery = this.watchQuery.bind(this); + this.query = this.query.bind(this); + this.mutate = this.mutate.bind(this); + this.resetStore = this.resetStore.bind(this); + this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); + this.version = version; + this.localState = new LocalState({ + cache: cache, + client: this, + resolvers: resolvers, + fragmentMatcher: fragmentMatcher, + }); + this.queryManager = new QueryManager({ + cache: this.cache, + link: this.link, + defaultOptions: this.defaultOptions, + defaultContext: defaultContext, + documentTransform: documentTransform, + queryDeduplication: queryDeduplication, + ssrMode: ssrMode, + clientAwareness: { + name: clientAwarenessName, + version: clientAwarenessVersion, + }, + localState: this.localState, + assumeImmutableResults: assumeImmutableResults, + onBroadcast: connectToDevTools ? + function () { + if (_this.devToolsHookCb) { + _this.devToolsHookCb({ + action: {}, + state: { + queries: _this.queryManager.getQueryStore(), + mutations: _this.queryManager.mutationStore || {}, + }, + dataWithOptimisticResults: _this.cache.extract(true), + }); + } + } + : void 0, + }); + if (connectToDevTools) + this.connectToDevTools(); + } + ApolloClient.prototype.connectToDevTools = function () { + if (typeof window === "object") { + var windowWithDevTools = window; + var devtoolsSymbol = Symbol.for("apollo.devtools"); + (windowWithDevTools[devtoolsSymbol] = + windowWithDevTools[devtoolsSymbol] || []).push(this); + windowWithDevTools.__APOLLO_CLIENT__ = this; + } + if (!hasSuggestedDevtools && globalThis.__DEV__ !== false) { + hasSuggestedDevtools = true; + setTimeout(function () { + if (typeof window !== "undefined" && + window.document && + window.top === window.self && + !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) { + var nav = window.navigator; + var ua = nav && nav.userAgent; + var url = void 0; + if (typeof ua === "string") { + if (ua.indexOf("Chrome/") > -1) { + url = + "https://chrome.google.com/webstore/detail/" + + "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm"; + } + else if (ua.indexOf("Firefox/") > -1) { + url = + "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/"; + } + } + if (url) { + globalThis.__DEV__ !== false && invariant.log("Download the Apollo DevTools for a better development " + + "experience: %s", url); + } + } + }, 10000); + } + }; + Object.defineProperty(ApolloClient.prototype, "documentTransform", { + get: function () { + return this.queryManager.documentTransform; + }, + enumerable: false, + configurable: true + }); + ApolloClient.prototype.stop = function () { + this.queryManager.stop(); + }; + ApolloClient.prototype.watchQuery = function (options) { + if (this.defaultOptions.watchQuery) { + options = mergeOptions(this.defaultOptions.watchQuery, options); + } + if (this.disableNetworkFetches && + (options.fetchPolicy === "network-only" || + options.fetchPolicy === "cache-and-network")) { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.watchQuery(options); + }; + ApolloClient.prototype.query = function (options) { + if (this.defaultOptions.query) { + options = mergeOptions(this.defaultOptions.query, options); + } + invariant(options.fetchPolicy !== "cache-and-network", 16); + if (this.disableNetworkFetches && options.fetchPolicy === "network-only") { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.query(options); + }; + ApolloClient.prototype.mutate = function (options) { + if (this.defaultOptions.mutate) { + options = mergeOptions(this.defaultOptions.mutate, options); + } + return this.queryManager.mutate(options); + }; + ApolloClient.prototype.subscribe = function (options) { + return this.queryManager.startGraphQLSubscription(options); + }; + ApolloClient.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readQuery(options, optimistic); + }; + ApolloClient.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readFragment(options, optimistic); + }; + ApolloClient.prototype.writeQuery = function (options) { + var ref = this.cache.writeQuery(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + ApolloClient.prototype.writeFragment = function (options) { + var ref = this.cache.writeFragment(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + ApolloClient.prototype.__actionHookForDevTools = function (cb) { + this.devToolsHookCb = cb; + }; + ApolloClient.prototype.__requestRaw = function (payload) { + return execute(this.link, payload); + }; + ApolloClient.prototype.resetStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: false, + }); + }) + .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) + .then(function () { return _this.reFetchObservableQueries(); }); + }; + ApolloClient.prototype.clearStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: true, + }); + }) + .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); + }; + ApolloClient.prototype.onResetStore = function (cb) { + var _this = this; + this.resetStoreCallbacks.push(cb); + return function () { + _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.onClearStore = function (cb) { + var _this = this; + this.clearStoreCallbacks.push(cb); + return function () { + _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { + return this.queryManager.reFetchObservableQueries(includeStandby); + }; + ApolloClient.prototype.refetchQueries = function (options) { + var map = this.queryManager.refetchQueries(options); + var queries = []; + var results = []; + map.forEach(function (result, obsQuery) { + queries.push(obsQuery); + results.push(result); + }); + var result = Promise.all(results); + result.queries = queries; + result.results = results; + result.catch(function (error) { + globalThis.__DEV__ !== false && invariant.debug(17, error); + }); + return result; + }; + ApolloClient.prototype.getObservableQueries = function (include) { + if (include === void 0) { include = "active"; } + return this.queryManager.getObservableQueries(include); + }; + ApolloClient.prototype.extract = function (optimistic) { + return this.cache.extract(optimistic); + }; + ApolloClient.prototype.restore = function (serializedState) { + return this.cache.restore(serializedState); + }; + ApolloClient.prototype.addResolvers = function (resolvers) { + this.localState.addResolvers(resolvers); + }; + ApolloClient.prototype.setResolvers = function (resolvers) { + this.localState.setResolvers(resolvers); + }; + ApolloClient.prototype.getResolvers = function () { + return this.localState.getResolvers(); + }; + ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { + this.localState.setFragmentMatcher(fragmentMatcher); + }; + ApolloClient.prototype.setLink = function (newLink) { + this.link = this.queryManager.link = newLink; + }; + Object.defineProperty(ApolloClient.prototype, "defaultContext", { + get: function () { + return this.queryManager.defaultContext; + }, + enumerable: false, + configurable: true + }); + return ApolloClient; +}()); +if (globalThis.__DEV__ !== false) { + ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals; +} + +var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__"; +function getApolloContext() { + invariant("createContext" in React__namespace, 45); + var context = React__namespace.createContext[contextKey]; + if (!context) { + Object.defineProperty(React__namespace.createContext, contextKey, { + value: (context = React__namespace.createContext({})), + enumerable: false, + writable: false, + configurable: true, + }); + context.displayName = "ApolloContext"; + } + return context; +} +var resetApolloContext = getApolloContext; + +var ApolloConsumer = function (props) { + var ApolloContext = getApolloContext(); + return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) { + invariant(context && context.client, 44); + return props.children(context.client); + })); +}; + +var ApolloProvider = function (_a) { + var client = _a.client, children = _a.children; + var ApolloContext = getApolloContext(); + var parentContext = React__namespace.useContext(ApolloContext); + var context = React__namespace.useMemo(function () { + return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client }); + }, [parentContext, client]); + invariant(context.client, 46); + return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children)); +}; + +function useApolloClient(override) { + var context = React__namespace.useContext(getApolloContext()); + var client = override || context.client; + invariant(!!client, 49); + return client; +} + +var didWarnUncachedGetSnapshot = false; +var uSESKey = "useSyncExternalStore"; +var realHook$1 = React__namespace[uSESKey]; +var useSyncExternalStore = realHook$1 || + (function (subscribe, getSnapshot, getServerSnapshot) { + var value = getSnapshot(); + if ( + globalThis.__DEV__ !== false && + !didWarnUncachedGetSnapshot && + value !== getSnapshot()) { + didWarnUncachedGetSnapshot = true; + globalThis.__DEV__ !== false && invariant.error(58); + } + var _a = React__namespace.useState({ + inst: { value: value, getSnapshot: getSnapshot }, + }), inst = _a[0].inst, forceUpdate = _a[1]; + if (canUseLayoutEffect) { + React__namespace.useLayoutEffect(function () { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + }, [subscribe, value, getSnapshot]); + } + else { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + } + React__namespace.useEffect(function () { + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + return subscribe(function handleStoreChange() { + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + }); + }, [subscribe]); + return value; + }); +function checkIfSnapshotChanged(_a) { + var value = _a.value, getSnapshot = _a.getSnapshot; + try { + return value !== getSnapshot(); + } + catch (_b) { + return true; + } +} + +exports.DocumentType = void 0; +(function (DocumentType) { + DocumentType[DocumentType["Query"] = 0] = "Query"; + DocumentType[DocumentType["Mutation"] = 1] = "Mutation"; + DocumentType[DocumentType["Subscription"] = 2] = "Subscription"; +})(exports.DocumentType || (exports.DocumentType = {})); +var cache; +function operationName(type) { + var name; + switch (type) { + case exports.DocumentType.Query: + name = "Query"; + break; + case exports.DocumentType.Mutation: + name = "Mutation"; + break; + case exports.DocumentType.Subscription: + name = "Subscription"; + break; + } + return name; +} +function parser(document) { + if (!cache) { + cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 ); + } + var cached = cache.get(document); + if (cached) + return cached; + var variables, type, name; + invariant(!!document && !!document.kind, 59, document); + var fragments = []; + var queries = []; + var mutations = []; + var subscriptions = []; + for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) { + var x = _a[_i]; + if (x.kind === "FragmentDefinition") { + fragments.push(x); + continue; + } + if (x.kind === "OperationDefinition") { + switch (x.operation) { + case "query": + queries.push(x); + break; + case "mutation": + mutations.push(x); + break; + case "subscription": + subscriptions.push(x); + break; + } + } + } + invariant(!fragments.length || + queries.length || + mutations.length || + subscriptions.length, 60); + invariant( + queries.length + mutations.length + subscriptions.length <= 1, + 61, + document, + queries.length, + subscriptions.length, + mutations.length + ); + type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation; + if (!queries.length && !mutations.length) + type = exports.DocumentType.Subscription; + var definitions = queries.length ? queries + : mutations.length ? mutations + : subscriptions; + invariant(definitions.length === 1, 62, document, definitions.length); + var definition = definitions[0]; + variables = definition.variableDefinitions || []; + if (definition.name && definition.name.kind === "Name") { + name = definition.name.value; + } + else { + name = "data"; + } + var payload = { name: name, type: type, variables: variables }; + cache.set(document, payload); + return payload; +} +parser.resetCache = function () { + cache = undefined; +}; +if (globalThis.__DEV__ !== false) { + registerGlobalCache("parser", function () { return (cache ? cache.size : 0); }); +} +function verifyDocumentType(document, type) { + var operation = parser(document); + var requiredOperationName = operationName(type); + var usedOperationName = operationName(operation.type); + invariant( + operation.type === type, + 63, + requiredOperationName, + requiredOperationName, + usedOperationName + ); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function useQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + return useInternalState(useApolloClient(options.client), query).useQuery(options); +} +function useInternalState(client, query) { + var stateRef = React__namespace.useRef(); + if (!stateRef.current || + client !== stateRef.current.client || + query !== stateRef.current.query) { + stateRef.current = new InternalState(client, query, stateRef.current); + } + var state = stateRef.current; + state.forceUpdateState = React__namespace.useReducer(function (tick) { return tick + 1; }, 0)[1]; + return state; +} +var InternalState = (function () { + function InternalState(client, query, previous) { + var _this = this; + this.client = client; + this.query = query; + this.forceUpdate = function () { return _this.forceUpdateState(); }; + this.ssrDisabledResult = maybeDeepFreeze({ + loading: true, + data: void 0, + error: void 0, + networkStatus: exports.NetworkStatus.loading, + }); + this.skipStandbyResult = maybeDeepFreeze({ + loading: false, + data: void 0, + error: void 0, + networkStatus: exports.NetworkStatus.ready, + }); + this.toQueryResultCache = new (canUseWeakMap ? WeakMap : Map)(); + verifyDocumentType(query, exports.DocumentType.Query); + var previousResult = previous && previous.result; + var previousData = previousResult && previousResult.data; + if (previousData) { + this.previousData = previousData; + } + } + InternalState.prototype.forceUpdateState = function () { + globalThis.__DEV__ !== false && invariant.warn(51); + }; + InternalState.prototype.executeQuery = function (options) { + var _this = this; + var _a; + if (options.query) { + Object.assign(this, { query: options.query }); + } + this.watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + var concast = this.observable.reobserveAsConcast(this.getObsQueryOptions()); + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + this.forceUpdate(); + return new Promise(function (resolve) { + var result; + concast.subscribe({ + next: function (value) { + result = value; + }, + error: function () { + resolve(_this.toQueryResult(_this.observable.getCurrentResult())); + }, + complete: function () { + resolve(_this.toQueryResult(result)); + }, + }); + }); + }; + InternalState.prototype.useQuery = function (options) { + var _this = this; + this.renderPromises = React__namespace.useContext(getApolloContext()).renderPromises; + this.useOptions(options); + var obsQuery = this.useObservableQuery(); + var result = useSyncExternalStore(React__namespace.useCallback(function (handleStoreChange) { + if (_this.renderPromises) { + return function () { }; + } + _this.forceUpdate = handleStoreChange; + var onNext = function () { + var previousResult = _this.result; + var result = obsQuery.getCurrentResult(); + if (previousResult && + previousResult.loading === result.loading && + previousResult.networkStatus === result.networkStatus && + equal.equal(previousResult.data, result.data)) { + return; + } + _this.setResult(result); + }; + var onError = function (error) { + subscription.unsubscribe(); + subscription = obsQuery.resubscribeAfterError(onNext, onError); + if (!hasOwnProperty.call(error, "graphQLErrors")) { + throw error; + } + var previousResult = _this.result; + if (!previousResult || + (previousResult && previousResult.loading) || + !equal.equal(error, previousResult.error)) { + _this.setResult({ + data: (previousResult && previousResult.data), + error: error, + loading: false, + networkStatus: exports.NetworkStatus.error, + }); + } + }; + var subscription = obsQuery.subscribe(onNext, onError); + return function () { + setTimeout(function () { return subscription.unsubscribe(); }); + _this.forceUpdate = function () { return _this.forceUpdateState(); }; + }; + }, [ + obsQuery, + this.renderPromises, + this.client.disableNetworkFetches, + ]), function () { return _this.getCurrentResult(); }, function () { return _this.getCurrentResult(); }); + this.unsafeHandlePartialRefetch(result); + return this.toQueryResult(result); + }; + InternalState.prototype.useOptions = function (options) { + var _a; + var watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + var currentWatchQueryOptions = this.watchQueryOptions; + if (!equal.equal(watchQueryOptions, currentWatchQueryOptions)) { + this.watchQueryOptions = watchQueryOptions; + if (currentWatchQueryOptions && this.observable) { + this.observable.reobserve(this.getObsQueryOptions()); + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + } + } + this.onCompleted = + options.onCompleted || InternalState.prototype.onCompleted; + this.onError = options.onError || InternalState.prototype.onError; + if ((this.renderPromises || this.client.disableNetworkFetches) && + this.queryHookOptions.ssr === false && + !this.queryHookOptions.skip) { + this.result = this.ssrDisabledResult; + } + else if (this.queryHookOptions.skip || + this.watchQueryOptions.fetchPolicy === "standby") { + this.result = this.skipStandbyResult; + } + else if (this.result === this.ssrDisabledResult || + this.result === this.skipStandbyResult) { + this.result = void 0; + } + }; + InternalState.prototype.getObsQueryOptions = function () { + var toMerge = []; + var globalDefaults = this.client.defaultOptions.watchQuery; + if (globalDefaults) + toMerge.push(globalDefaults); + if (this.queryHookOptions.defaultOptions) { + toMerge.push(this.queryHookOptions.defaultOptions); + } + toMerge.push(compact(this.observable && this.observable.options, this.watchQueryOptions)); + return toMerge.reduce(mergeOptions); + }; + InternalState.prototype.createWatchQueryOptions = function (_a) { + var _b; + if (_a === void 0) { _a = {}; } + var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions; + var otherOptions = tslib.__rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]); + var watchQueryOptions = Object.assign(otherOptions, { query: this.query }); + if (this.renderPromises && + (watchQueryOptions.fetchPolicy === "network-only" || + watchQueryOptions.fetchPolicy === "cache-and-network")) { + watchQueryOptions.fetchPolicy = "cache-first"; + } + if (!watchQueryOptions.variables) { + watchQueryOptions.variables = {}; + } + if (skip) { + var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d; + Object.assign(watchQueryOptions, { + initialFetchPolicy: initialFetchPolicy, + fetchPolicy: "standby", + }); + } + else if (!watchQueryOptions.fetchPolicy) { + watchQueryOptions.fetchPolicy = + ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) || + this.getDefaultFetchPolicy(); + } + return watchQueryOptions; + }; + InternalState.prototype.getDefaultFetchPolicy = function () { + var _a, _b; + return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + "cache-first"); + }; + InternalState.prototype.onCompleted = function (data) { }; + InternalState.prototype.onError = function (error) { }; + InternalState.prototype.useObservableQuery = function () { + var obsQuery = (this.observable = + (this.renderPromises && + this.renderPromises.getSSRObservable(this.watchQueryOptions)) || + this.observable || + this.client.watchQuery(this.getObsQueryOptions())); + this.obsQueryFields = React__namespace.useMemo(function () { return ({ + refetch: obsQuery.refetch.bind(obsQuery), + reobserve: obsQuery.reobserve.bind(obsQuery), + fetchMore: obsQuery.fetchMore.bind(obsQuery), + updateQuery: obsQuery.updateQuery.bind(obsQuery), + startPolling: obsQuery.startPolling.bind(obsQuery), + stopPolling: obsQuery.stopPolling.bind(obsQuery), + subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery), + }); }, [obsQuery]); + var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip); + if (this.renderPromises && ssrAllowed) { + this.renderPromises.registerSSRObservable(obsQuery); + if (obsQuery.getCurrentResult().loading) { + this.renderPromises.addObservableQueryPromise(obsQuery); + } + } + return obsQuery; + }; + InternalState.prototype.setResult = function (nextResult) { + var previousResult = this.result; + if (previousResult && previousResult.data) { + this.previousData = previousResult.data; + } + this.result = nextResult; + this.forceUpdate(); + this.handleErrorOrCompleted(nextResult, previousResult); + }; + InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) { + var _this = this; + if (!result.loading) { + var error_1 = this.toApolloError(result); + Promise.resolve() + .then(function () { + if (error_1) { + _this.onError(error_1); + } + else if (result.data && + (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus && + result.networkStatus === exports.NetworkStatus.ready) { + _this.onCompleted(result.data); + } + }) + .catch(function (error) { + globalThis.__DEV__ !== false && invariant.warn(error); + }); + } + }; + InternalState.prototype.toApolloError = function (result) { + return isNonEmptyArray(result.errors) ? + new ApolloError({ graphQLErrors: result.errors }) + : result.error; + }; + InternalState.prototype.getCurrentResult = function () { + if (!this.result) { + this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult())); + } + return this.result; + }; + InternalState.prototype.toQueryResult = function (result) { + var queryResult = this.toQueryResultCache.get(result); + if (queryResult) + return queryResult; + var data = result.data; result.partial; var resultWithoutPartial = tslib.__rest(result, ["data", "partial"]); + this.toQueryResultCache.set(result, (queryResult = tslib.__assign(tslib.__assign(tslib.__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData }))); + if (!queryResult.error && isNonEmptyArray(result.errors)) { + queryResult.error = new ApolloError({ graphQLErrors: result.errors }); + } + return queryResult; + }; + InternalState.prototype.unsafeHandlePartialRefetch = function (result) { + if (result.partial && + this.queryHookOptions.partialRefetch && + !result.loading && + (!result.data || Object.keys(result.data).length === 0) && + this.observable.options.fetchPolicy !== "cache-only") { + Object.assign(result, { + loading: true, + networkStatus: exports.NetworkStatus.refetch, + }); + this.observable.refetch(); + } + }; + return InternalState; +}()); + +var EAGER_METHODS = [ + "refetch", + "reobserve", + "fetchMore", + "updateQuery", + "startPolling", + "subscribeToMore", +]; +function useLazyQuery(query, options) { + var _a; + var execOptionsRef = React__namespace.useRef(); + var optionsRef = React__namespace.useRef(); + var queryRef = React__namespace.useRef(); + var merged = mergeOptions(options, execOptionsRef.current || {}); + var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query; + optionsRef.current = options; + queryRef.current = document; + var internalState = useInternalState(useApolloClient(options && options.client), document); + var useQueryResult = internalState.useQuery(tslib.__assign(tslib.__assign({}, merged), { skip: !execOptionsRef.current })); + var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy || + internalState.getDefaultFetchPolicy(); + var result = Object.assign(useQueryResult, { + called: !!execOptionsRef.current, + }); + var eagerMethods = React__namespace.useMemo(function () { + var eagerMethods = {}; + var _loop_1 = function (key) { + var method = result[key]; + eagerMethods[key] = function () { + if (!execOptionsRef.current) { + execOptionsRef.current = Object.create(null); + internalState.forceUpdateState(); + } + return method.apply(this, arguments); + }; + }; + for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) { + var key = EAGER_METHODS_1[_i]; + _loop_1(key); + } + return eagerMethods; + }, []); + Object.assign(result, eagerMethods); + var execute = React__namespace.useCallback(function (executeOptions) { + execOptionsRef.current = + executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : { + fetchPolicy: initialFetchPolicy, + }; + var options = mergeOptions(optionsRef.current, tslib.__assign({ query: queryRef.current }, execOptionsRef.current)); + var promise = internalState + .executeQuery(tslib.__assign(tslib.__assign({}, options), { skip: false })) + .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); }); + promise.catch(function () { }); + return promise; + }, []); + return [execute, result]; +} + +function useMutation(mutation, options) { + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + verifyDocumentType(mutation, exports.DocumentType.Mutation); + var _a = React__namespace.useState({ + called: false, + loading: false, + client: client, + }), result = _a[0], setResult = _a[1]; + var ref = React__namespace.useRef({ + result: result, + mutationId: 0, + isMounted: true, + client: client, + mutation: mutation, + options: options, + }); + { + Object.assign(ref.current, { client: client, options: options, mutation: mutation }); + } + var execute = React__namespace.useCallback(function (executeOptions) { + if (executeOptions === void 0) { executeOptions = {}; } + var _a = ref.current, options = _a.options, mutation = _a.mutation; + var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation }); + var client = executeOptions.client || ref.current.client; + if (!ref.current.result.loading && + !baseOptions.ignoreResults && + ref.current.isMounted) { + setResult((ref.current.result = { + loading: true, + error: void 0, + data: void 0, + called: true, + client: client, + })); + } + var mutationId = ++ref.current.mutationId; + var clientOptions = mergeOptions(baseOptions, executeOptions); + return client + .mutate(clientOptions) + .then(function (response) { + var _a, _b; + var data = response.data, errors = response.errors; + var error = errors && errors.length > 0 ? + new ApolloError({ graphQLErrors: errors }) + : void 0; + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (error && onError) { + onError(error, clientOptions); + } + if (mutationId === ref.current.mutationId && + !clientOptions.ignoreResults) { + var result_1 = { + called: true, + loading: false, + data: data, + error: error, + client: client, + }; + if (ref.current.isMounted && !equal.equal(ref.current.result, result_1)) { + setResult((ref.current.result = result_1)); + } + } + var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted); + if (!error) { + onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions); + } + return response; + }) + .catch(function (error) { + var _a; + if (mutationId === ref.current.mutationId && ref.current.isMounted) { + var result_2 = { + loading: false, + error: error, + data: void 0, + called: true, + client: client, + }; + if (!equal.equal(ref.current.result, result_2)) { + setResult((ref.current.result = result_2)); + } + } + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (onError) { + onError(error, clientOptions); + return { data: void 0, errors: error }; + } + throw error; + }); + }, []); + var reset = React__namespace.useCallback(function () { + if (ref.current.isMounted) { + var result_3 = { called: false, loading: false, client: client }; + Object.assign(ref.current, { mutationId: 0, result: result_3 }); + setResult(result_3); + } + }, []); + React__namespace.useEffect(function () { + ref.current.isMounted = true; + return function () { + ref.current.isMounted = false; + }; + }, []); + return [execute, tslib.__assign({ reset: reset }, result)]; +} + +function useSubscription(subscription, options) { + var hasIssuedDeprecationWarningRef = React__namespace.useRef(false); + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + verifyDocumentType(subscription, exports.DocumentType.Subscription); + var _a = React__namespace.useState({ + loading: !(options === null || options === void 0 ? void 0 : options.skip), + error: void 0, + data: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }), result = _a[0], setResult = _a[1]; + if (!hasIssuedDeprecationWarningRef.current) { + hasIssuedDeprecationWarningRef.current = true; + if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) { + globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53); + } + if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) { + globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55); + } + } + var _b = React__namespace.useState(function () { + if (options === null || options === void 0 ? void 0 : options.skip) { + return null; + } + return client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + }); + }), observable = _b[0], setObservable = _b[1]; + var canResetObservableRef = React__namespace.useRef(false); + React__namespace.useEffect(function () { + return function () { + canResetObservableRef.current = true; + }; + }, []); + var ref = React__namespace.useRef({ client: client, subscription: subscription, options: options }); + React__namespace.useEffect(function () { + var _a, _b, _c, _d; + var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe; + if (typeof shouldResubscribe === "function") { + shouldResubscribe = !!shouldResubscribe(options); + } + if (options === null || options === void 0 ? void 0 : options.skip) { + if (!(options === null || options === void 0 ? void 0 : options.skip) !== !((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.skip) || + canResetObservableRef.current) { + setResult({ + loading: false, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(null); + canResetObservableRef.current = false; + } + } + else if ((shouldResubscribe !== false && + (client !== ref.current.client || + subscription !== ref.current.subscription || + (options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + !(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) || + !equal.equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) || + canResetObservableRef.current) { + setResult({ + loading: true, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + })); + canResetObservableRef.current = false; + } + Object.assign(ref.current, { client: client, subscription: subscription, options: options }); + }, [client, subscription, options, canResetObservableRef.current]); + React__namespace.useEffect(function () { + if (!observable) { + return; + } + var subscriptionStopped = false; + var subscription = observable.subscribe({ + next: function (fetchResult) { + var _a, _b; + if (subscriptionStopped) { + return; + } + var result = { + loading: false, + data: fetchResult.data, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }; + setResult(result); + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) { + ref.current.options.onData({ + client: client, + data: result, + }); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) { + ref.current.options.onSubscriptionData({ + client: client, + subscriptionData: result, + }); + } + }, + error: function (error) { + var _a, _b; + if (!subscriptionStopped) { + setResult({ + loading: false, + data: void 0, + error: error, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error); + } + }, + complete: function () { + var _a, _b; + if (!subscriptionStopped) { + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) { + ref.current.options.onComplete(); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) { + ref.current.options.onSubscriptionComplete(); + } + } + }, + }); + return function () { + subscriptionStopped = true; + setTimeout(function () { + subscription.unsubscribe(); + }); + }; + }, [observable]); + return result; +} + +function useReactiveVar(rv) { + return useSyncExternalStore(React__namespace.useCallback(function (update) { + return rv.onNextChange(function onNext() { + update(); + rv.onNextChange(onNext); + }); + }, [rv]), rv, rv); +} + +function useDeepMemo(memoFn, deps) { + var ref = React__namespace.useRef(); + if (!ref.current || !equal.equal(ref.current.deps, deps)) { + ref.current = { value: memoFn(), deps: deps }; + } + return ref.current.value; +} + +function getRenderDispatcher() { + var _a, _b; + return (_b = (_a = React__namespace.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentDispatcher) === null || _b === void 0 ? void 0 : _b.current; +} +var RenderDispatcher = null; +function useRenderGuard() { + RenderDispatcher = getRenderDispatcher(); + return React__namespace.useCallback(function () { + return (RenderDispatcher !== null && RenderDispatcher === getRenderDispatcher()); + }, []); +} + +var INIT = {}; +function useLazyRef(getInitialValue) { + var ref = React__namespace.useRef(INIT); + if (ref.current === INIT) { + ref.current = getInitialValue(); + } + return ref; +} + +var useKey = "use"; +var realHook = React__namespace[useKey]; +var __use = realHook || + function __use(promise) { + var statefulPromise = wrapPromiseWithState(promise); + switch (statefulPromise.status) { + case "pending": + throw statefulPromise; + case "rejected": + throw statefulPromise.reason; + case "fulfilled": + return statefulPromise.value; + } + }; + +function useFragment(options) { + var cache = useApolloClient(options.client).cache; + var diffOptions = useDeepMemo(function () { + var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]); + return tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic }); + }, [options]); + var resultRef = useLazyRef(function () { + return diffToResult(cache.diff(diffOptions)); + }); + var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []); + return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) { + var lastTimeout = 0; + var unsubscribe = cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) { + if (!equal.equal(diff.result, resultRef.current.data)) { + resultRef.current = diffToResult(diff); + clearTimeout(lastTimeout); + lastTimeout = setTimeout(forceUpdate); + } + } })); + return function () { + unsubscribe(); + clearTimeout(lastTimeout); + }; + }, [cache, diffOptions]), getSnapshot, getSnapshot); +} +function diffToResult(diff) { + var result = { + data: diff.result, + complete: !!diff.complete, + }; + if (diff.missing) { + result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; })); + } + return result; +} + +var QUERY_REFERENCE_SYMBOL = Symbol(); +var PROMISE_SYMBOL = Symbol(); +function wrapQueryRef(internalQueryRef) { + var _a; + var ref = (_a = { + toPromise: function () { + return getWrappedPromise(ref).then(function () { return ref; }); + } + }, + _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef, + _a[PROMISE_SYMBOL] = internalQueryRef.promise, + _a); + return ref; +} +function getWrappedPromise(queryRef) { + var internalQueryRef = unwrapQueryRef(queryRef); + return internalQueryRef.promise.status === "fulfilled" ? + internalQueryRef.promise + : queryRef[PROMISE_SYMBOL]; +} +function unwrapQueryRef(queryRef) { + return queryRef[QUERY_REFERENCE_SYMBOL]; +} +function updateWrappedQueryRef(queryRef, promise) { + queryRef[PROMISE_SYMBOL] = promise; +} +var OBSERVED_CHANGED_OPTIONS = [ + "canonizeResults", + "context", + "errorPolicy", + "fetchPolicy", + "refetchWritePolicy", + "returnPartialData", +]; +var InternalQueryReference = (function () { + function InternalQueryReference(observable, options) { + var _this = this; + this.key = {}; + this.listeners = new Set(); + this.references = 0; + this.handleNext = this.handleNext.bind(this); + this.handleError = this.handleError.bind(this); + this.dispose = this.dispose.bind(this); + this.observable = observable; + if (options.onDispose) { + this.onDispose = options.onDispose; + } + this.setResult(); + this.subscribeToQuery(); + var startDisposeTimer = function () { + var _a; + if (!_this.references) { + _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000); + } + }; + this.promise.then(startDisposeTimer, startDisposeTimer); + } + Object.defineProperty(InternalQueryReference.prototype, "disposed", { + get: function () { + return this.subscription.closed; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", { + get: function () { + return this.observable.options; + }, + enumerable: false, + configurable: true + }); + InternalQueryReference.prototype.reinitialize = function () { + var observable = this.observable; + var originalFetchPolicy = this.watchQueryOptions.fetchPolicy; + try { + if (originalFetchPolicy !== "no-cache") { + observable.resetLastResults(); + observable.silentSetOptions({ fetchPolicy: "cache-first" }); + } + else { + observable.silentSetOptions({ fetchPolicy: "standby" }); + } + this.subscribeToQuery(); + if (originalFetchPolicy === "no-cache") { + return; + } + observable.resetDiff(); + this.setResult(); + } + finally { + observable.silentSetOptions({ fetchPolicy: originalFetchPolicy }); + } + }; + InternalQueryReference.prototype.retain = function () { + var _this = this; + this.references++; + clearTimeout(this.autoDisposeTimeoutId); + var disposed = false; + return function () { + if (disposed) { + return; + } + disposed = true; + _this.references--; + setTimeout(function () { + if (!_this.references) { + _this.dispose(); + } + }); + }; + }; + InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) { + var _this = this; + return OBSERVED_CHANGED_OPTIONS.some(function (option) { + return !equal.equal(_this.watchQueryOptions[option], watchQueryOptions[option]); + }); + }; + InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) { + var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults; + if (currentFetchPolicy === "standby" && + currentFetchPolicy !== watchQueryOptions.fetchPolicy) { + this.initiateFetch(this.observable.reobserve(watchQueryOptions)); + } + else { + this.observable.silentSetOptions(watchQueryOptions); + if (currentCanonizeResults !== watchQueryOptions.canonizeResults) { + this.result = tslib.__assign(tslib.__assign({}, this.result), this.observable.getCurrentResult()); + this.promise = createFulfilledPromise(this.result); + } + } + return this.promise; + }; + InternalQueryReference.prototype.listen = function (listener) { + var _this = this; + this.listeners.add(listener); + return function () { + _this.listeners.delete(listener); + }; + }; + InternalQueryReference.prototype.refetch = function (variables) { + return this.initiateFetch(this.observable.refetch(variables)); + }; + InternalQueryReference.prototype.fetchMore = function (options) { + return this.initiateFetch(this.observable.fetchMore(options)); + }; + InternalQueryReference.prototype.dispose = function () { + this.subscription.unsubscribe(); + this.onDispose(); + }; + InternalQueryReference.prototype.onDispose = function () { + }; + InternalQueryReference.prototype.handleNext = function (result) { + var _a; + switch (this.promise.status) { + case "pending": { + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result); + break; + } + default: { + if (result.data === this.result.data && + result.networkStatus === this.result.networkStatus) { + return; + } + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + this.promise = createFulfilledPromise(result); + this.deliver(this.promise); + break; + } + } + }; + InternalQueryReference.prototype.handleError = function (error) { + var _a; + this.subscription.unsubscribe(); + this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError); + switch (this.promise.status) { + case "pending": { + (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error); + break; + } + default: { + this.promise = createRejectedPromise(error); + this.deliver(this.promise); + } + } + }; + InternalQueryReference.prototype.deliver = function (promise) { + this.listeners.forEach(function (listener) { return listener(promise); }); + }; + InternalQueryReference.prototype.initiateFetch = function (returnedPromise) { + var _this = this; + this.promise = this.createPendingPromise(); + this.promise.catch(function () { }); + returnedPromise + .then(function (result) { + var _a; + if (_this.promise.status === "pending") { + _this.result = result; + (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result); + } + }) + .catch(function () { }); + return returnedPromise; + }; + InternalQueryReference.prototype.subscribeToQuery = function () { + var _this = this; + this.subscription = this.observable + .filter(function (result) { return !equal.equal(result.data, {}) && !equal.equal(result, _this.result); }) + .subscribe(this.handleNext, this.handleError); + }; + InternalQueryReference.prototype.setResult = function () { + var result = this.observable.getCurrentResult(false); + if (equal.equal(result, this.result)) { + return; + } + this.result = result; + this.promise = + (result.data && + (!result.partial || this.watchQueryOptions.returnPartialData)) ? + createFulfilledPromise(result) + : this.createPendingPromise(); + }; + InternalQueryReference.prototype.createPendingPromise = function () { + var _this = this; + return wrapPromiseWithState(new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + })); + }; + return InternalQueryReference; +}()); + +var SuspenseCache = (function () { + function SuspenseCache(options) { + if (options === void 0) { options = Object.create(null); } + this.queryRefs = new trie.Trie(canUseWeakMap); + this.options = options; + } + SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) { + var ref = this.queryRefs.lookupArray(cacheKey); + if (!ref.current) { + ref.current = new InternalQueryReference(createObservable(), { + autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs, + onDispose: function () { + delete ref.current; + }, + }); + } + return ref.current; + }; + return SuspenseCache; +}()); + +var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache"); +function getSuspenseCache(client) { + var _a; + if (!client[suspenseCacheSymbol]) { + client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense); + } + return client[suspenseCacheSymbol]; +} + +var skipToken = Symbol.for("apollo.skipToken"); + +function useSuspenseQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ + client: client, + query: query, + options: options, + }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var cacheKey = tslib.__spreadArray([ + query, + canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React__namespace.useState([queryRef.key, queryRef.promise]), current = _b[0], setPromise = _b[1]; + if (current[0] !== queryRef.key) { + current[0] = queryRef.key; + current[1] = queryRef.promise; + } + var promise = current[1]; + if (queryRef.didChangeOptions(watchQueryOptions)) { + current[1] = promise = queryRef.applyOptions(watchQueryOptions); + } + React__namespace.useEffect(function () { + var dispose = queryRef.retain(); + var removeListener = queryRef.listen(function (promise) { + setPromise([queryRef.key, promise]); + }); + return function () { + removeListener(); + dispose(); + }; + }, [queryRef]); + var skipResult = React__namespace.useMemo(function () { + var error = toApolloError(queryRef.result); + return { + loading: false, + data: queryRef.result.data, + networkStatus: error ? exports.NetworkStatus.error : exports.NetworkStatus.ready, + error: error, + }; + }, [queryRef.result]); + var result = fetchPolicy === "standby" ? skipResult : __use(promise); + var fetchMore = React__namespace.useCallback((function (options) { + var promise = queryRef.fetchMore(options); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }), [queryRef]); + var refetch = React__namespace.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }, [queryRef]); + var subscribeToMore = React__namespace.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]); + return React__namespace.useMemo(function () { + return { + client: client, + data: result.data, + error: toApolloError(result), + networkStatus: result.networkStatus, + fetchMore: fetchMore, + refetch: refetch, + subscribeToMore: subscribeToMore, + }; + }, [client, fetchMore, refetch, result, subscribeToMore]); +} +function validateOptions(options) { + var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData; + verifyDocumentType(query, exports.DocumentType.Query); + validateFetchPolicy(fetchPolicy); + validatePartialDataReturn(fetchPolicy, returnPartialData); +} +function validateFetchPolicy(fetchPolicy) { + if (fetchPolicy === void 0) { fetchPolicy = "cache-first"; } + var supportedFetchPolicies = [ + "cache-first", + "network-only", + "no-cache", + "cache-and-network", + ]; + invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy); +} +function validatePartialDataReturn(fetchPolicy, returnPartialData) { + if (fetchPolicy === "no-cache" && returnPartialData) { + globalThis.__DEV__ !== false && invariant.warn(57); + } +} +function toApolloError(result) { + return isNonEmptyArray(result.errors) ? + new ApolloError({ graphQLErrors: result.errors }) + : result.error; +} +function useWatchQueryOptions(_a) { + var client = _a.client, query = _a.query, options = _a.options; + return useDeepMemo(function () { + var _a; + if (options === skipToken) { + return { query: query, fetchPolicy: "standby" }; + } + var fetchPolicy = options.fetchPolicy || + ((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + "cache-first"; + var watchQueryOptions = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 }); + if (globalThis.__DEV__ !== false) { + validateOptions(watchQueryOptions); + } + if (options.skip) { + watchQueryOptions.fetchPolicy = "standby"; + } + return watchQueryOptions; + }, [client, options, query]); +} + +function useBackgroundQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var didFetchResult = React__namespace.useRef(fetchPolicy !== "standby"); + didFetchResult.current || (didFetchResult.current = fetchPolicy !== "standby"); + var cacheKey = tslib.__spreadArray([ + query, + canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React__namespace.useState(wrapQueryRef(queryRef)), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + if (unwrapQueryRef(wrappedQueryRef) !== queryRef) { + setWrappedQueryRef(wrapQueryRef(queryRef)); + } + if (queryRef.didChangeOptions(watchQueryOptions)) { + var promise = queryRef.applyOptions(watchQueryOptions); + updateWrappedQueryRef(wrappedQueryRef, promise); + } + var fetchMore = React__namespace.useCallback(function (options) { + var promise = queryRef.fetchMore(options); + setWrappedQueryRef(wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + var refetch = React__namespace.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setWrappedQueryRef(wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + return [ + didFetchResult.current ? wrappedQueryRef : void 0, + { fetchMore: fetchMore, refetch: refetch }, + ]; +} + +function useLoadableQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var _b = React__namespace.useState(null), queryRef = _b[0], setQueryRef = _b[1]; + var internalQueryRef = queryRef && unwrapQueryRef(queryRef); + if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) { + var promise = internalQueryRef.applyOptions(watchQueryOptions); + updateWrappedQueryRef(queryRef, promise); + } + var calledDuringRender = useRenderGuard(); + var fetchMore = React__namespace.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.fetchMore(options); + setQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var refetch = React__namespace.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.refetch(options); + setQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var loadQuery = React__namespace.useCallback(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + invariant(!calledDuringRender(), 50); + var variables = args[0]; + var cacheKey = tslib.__spreadArray([ + query, + canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(tslib.__assign(tslib.__assign({}, watchQueryOptions), { variables: variables })); + }); + setQueryRef(wrapQueryRef(queryRef)); + }, [query, queryKey, suspenseCache, watchQueryOptions, calledDuringRender]); + var reset = React__namespace.useCallback(function () { + setQueryRef(null); + }, [queryRef]); + return [loadQuery, queryRef, { fetchMore: fetchMore, refetch: refetch, reset: reset }]; +} + +function useQueryRefHandlers(queryRef) { + var _a = React__namespace.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1]; + var _b = React__namespace.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + var internalQueryRef = unwrapQueryRef(queryRef); + if (previousQueryRef !== queryRef) { + setPreviousQueryRef(queryRef); + setWrappedQueryRef(queryRef); + } + else { + updateWrappedQueryRef(queryRef, getWrappedPromise(wrappedQueryRef)); + } + var refetch = React__namespace.useCallback(function (variables) { + var promise = internalQueryRef.refetch(variables); + setWrappedQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var fetchMore = React__namespace.useCallback(function (options) { + var promise = internalQueryRef.fetchMore(options); + setWrappedQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + return { refetch: refetch, fetchMore: fetchMore }; +} + +function useReadQuery(queryRef) { + var internalQueryRef = React__namespace.useMemo(function () { return unwrapQueryRef(queryRef); }, [queryRef]); + var getPromise = React__namespace.useCallback(function () { return getWrappedPromise(queryRef); }, [queryRef]); + if (internalQueryRef.disposed) { + internalQueryRef.reinitialize(); + updateWrappedQueryRef(queryRef, internalQueryRef.promise); + } + React__namespace.useEffect(function () { return internalQueryRef.retain(); }, [internalQueryRef]); + var promise = useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) { + return internalQueryRef.listen(function (promise) { + updateWrappedQueryRef(queryRef, promise); + forceUpdate(); + }); + }, [internalQueryRef]), getPromise, getPromise); + var result = __use(promise); + return React__namespace.useMemo(function () { + return { + data: result.data, + networkStatus: result.networkStatus, + error: toApolloError(result), + }; + }, [result]); +} + +function createQueryPreloader(client) { + return function preloadQuery(query, options) { + var _a, _b; + if (options === void 0) { options = Object.create(null); } + var queryRef = new InternalQueryReference(client.watchQuery(tslib.__assign(tslib.__assign({}, options), { query: query })), { + autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs, + }); + return wrapQueryRef(queryRef); + }; +} + +exports.setLogVerbosity = tsInvariant.setVerbosity; +exports.Observable = zenObservableTs.Observable; +exports.disableExperimentalFragmentVariables = graphqlTag.disableExperimentalFragmentVariables; +exports.disableFragmentWarnings = graphqlTag.disableFragmentWarnings; +exports.enableExperimentalFragmentVariables = graphqlTag.enableExperimentalFragmentVariables; +exports.gql = graphqlTag.gql; +exports.resetCaches = graphqlTag.resetCaches; +exports.ApolloCache = ApolloCache; +exports.ApolloClient = ApolloClient; +exports.ApolloConsumer = ApolloConsumer; +exports.ApolloError = ApolloError; +exports.ApolloLink = ApolloLink; +exports.ApolloProvider = ApolloProvider; +exports.DocumentTransform = DocumentTransform; +exports.HttpLink = HttpLink; +exports.InMemoryCache = InMemoryCache; +exports.MissingFieldError = MissingFieldError; +exports.ObservableQuery = ObservableQuery; +exports.checkFetcher = checkFetcher; +exports.concat = concat; +exports.createHttpLink = createHttpLink; +exports.createQueryPreloader = createQueryPreloader; +exports.createSignalIfSupported = createSignalIfSupported; +exports.defaultDataIdFromObject = defaultDataIdFromObject; +exports.defaultPrinter = defaultPrinter; +exports.empty = empty; +exports.execute = execute; +exports.fallbackHttpConfig = fallbackHttpConfig; +exports.from = from; +exports.fromError = fromError; +exports.fromPromise = fromPromise; +exports.getApolloContext = getApolloContext; +exports.isApolloError = isApolloError; +exports.isNetworkRequestSettled = isNetworkRequestSettled; +exports.isReference = isReference; +exports.makeReference = makeReference; +exports.makeVar = makeVar; +exports.mergeOptions = mergeOptions; +exports.operationName = operationName; +exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse; +exports.parser = parser; +exports.resetApolloContext = resetApolloContext; +exports.rewriteURIForGET = rewriteURIForGET; +exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody; +exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal; +exports.selectURI = selectURI; +exports.serializeFetchParameter = serializeFetchParameter; +exports.skipToken = skipToken; +exports.split = split; +exports.throwServerError = throwServerError; +exports.toPromise = toPromise; +exports.useApolloClient = useApolloClient; +exports.useBackgroundQuery = useBackgroundQuery; +exports.useFragment = useFragment; +exports.useLazyQuery = useLazyQuery; +exports.useLoadableQuery = useLoadableQuery; +exports.useMutation = useMutation; +exports.useQuery = useQuery; +exports.useQueryRefHandlers = useQueryRefHandlers; +exports.useReactiveVar = useReactiveVar; +exports.useReadQuery = useReadQuery; +exports.useSubscription = useSubscription; +exports.useSuspenseQuery = useSuspenseQuery; +//# sourceMappingURL=apollo-client.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/apollo-client.cjs.map b/graphql-subscription/node_modules/@apollo/client/apollo-client.cjs.map new file mode 100644 index 0000000..b76e403 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/apollo-client.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"apollo-client.cjs","sources":["version.js","utilities/globals/maybe.js","utilities/globals/global.js","utilities/common/makeUniqueId.js","utilities/common/stringifyForDisplay.js","utilities/globals/invariantWrappers.js","utilities/graphql/directives.js","utilities/common/canUse.js","utilities/common/objects.js","utilities/graphql/fragments.js","utilities/caching/caches.js","utilities/caching/sizes.js","utilities/caching/getMemoryInternals.js","utilities/common/canonicalStringify.js","utilities/graphql/storeUtils.js","utilities/graphql/getFromAST.js","utilities/graphql/DocumentTransform.js","utilities/graphql/print.js","utilities/common/arrays.js","utilities/graphql/transform.js","utilities/common/mergeDeep.js","utilities/promises/decoration.js","utilities/common/cloneDeep.js","utilities/common/maybeDeepFreeze.js","utilities/observables/iteration.js","utilities/observables/asyncMap.js","utilities/observables/subclassing.js","utilities/observables/Concast.js","utilities/common/incrementalResult.js","utilities/common/errorHandling.js","utilities/common/compact.js","utilities/common/mergeOptions.js","link/utils/fromError.js","link/utils/toPromise.js","link/utils/fromPromise.js","link/utils/throwServerError.js","link/utils/validateOperation.js","link/utils/createOperation.js","link/utils/transformOperation.js","link/utils/filterOperationVariables.js","link/core/ApolloLink.js","link/core/empty.js","link/core/from.js","link/core/split.js","link/core/concat.js","link/core/execute.js","link/http/iterators/async.js","link/http/iterators/nodeStream.js","link/http/iterators/promise.js","link/http/iterators/reader.js","link/http/responseIterator.js","errors/index.js","link/http/parseAndCheckHttpResponse.js","link/http/serializeFetchParameter.js","link/http/selectHttpOptionsAndBody.js","link/http/checkFetcher.js","link/http/createSignalIfSupported.js","link/http/selectURI.js","link/http/rewriteURIForGET.js","link/http/createHttpLink.js","link/http/HttpLink.js","cache/core/cache.js","cache/core/types/Cache.js","cache/core/types/common.js","cache/inmemory/helpers.js","cache/inmemory/entityStore.js","cache/inmemory/object-canon.js","cache/inmemory/readFromStore.js","cache/inmemory/reactiveVars.js","cache/inmemory/key-extractor.js","cache/inmemory/policies.js","cache/inmemory/writeToStore.js","cache/inmemory/inMemoryCache.js","core/networkStatus.js","core/equalByQuery.js","core/ObservableQuery.js","core/LocalState.js","core/QueryInfo.js","core/QueryManager.js","core/ApolloClient.js","react/context/ApolloContext.js","react/context/ApolloConsumer.js","react/context/ApolloProvider.js","react/hooks/useApolloClient.js","react/hooks/useSyncExternalStore.js","react/parser/index.js","react/hooks/useQuery.js","react/hooks/useLazyQuery.js","react/hooks/useMutation.js","react/hooks/useSubscription.js","react/hooks/useReactiveVar.js","react/hooks/internal/useDeepMemo.js","react/hooks/internal/useRenderGuard.js","react/hooks/internal/useLazyRef.js","react/hooks/internal/__use.js","react/hooks/useFragment.js","react/internal/cache/QueryReference.js","react/internal/cache/SuspenseCache.js","react/internal/cache/getSuspenseCache.js","react/hooks/constants.js","react/hooks/useSuspenseQuery.js","react/hooks/useBackgroundQuery.js","react/hooks/useLoadableQuery.js","react/hooks/useQueryRefHandlers.js","react/hooks/useReadQuery.js","react/query-preloader/createQueryPreloader.js"],"sourcesContent":["export var version = \"3.9.5\";\n//# sourceMappingURL=version.js.map","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as\n// long as at least one of globalThis, window, self, or global is defined, so\n// we are under no obligation to make it easy for static analysis tools to\n// detect syntactic usage of the Function constructor. If you think you can\n// improve your static analysis to detect this obfuscation, think again. This\n// is an arms race you cannot win, at least not in JavaScript.\nmaybe(function () {\n return maybe.constructor(\"return this\")();\n}));\n//# sourceMappingURL=global.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\nfunction wrap(fn) {\n return function (message) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof message === \"number\") {\n var arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn.apply(void 0, [message].concat(args));\n };\n}\nvar invariant = Object.assign(function invariant(condition, message) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (!condition) {\n originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));\n }\n}, {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n});\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(message) {\n var optionalParams = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n optionalParams[_i - 1] = arguments[_i];\n }\n return new InvariantError(getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams));\n}\nvar ApolloErrorMessageHandler = Symbol.for(\"ApolloErrorMessageHandler_\" + version);\nfunction stringify(arg) {\n return typeof arg == \"string\" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000));\n}\nfunction getHandledErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));\n}\nfunction getFallbackErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return \"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#\".concat(encodeURIComponent(JSON.stringify({\n version: version,\n message: message,\n args: messageArgs.map(stringify),\n })));\n}\nexport { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, };\n//# sourceMappingURL=invariantWrappers.js.map","import { invariant } from \"../globals/index.js\";\nimport { visit, BREAK } from \"graphql\";\nexport function shouldInclude(_a, variables) {\n var directives = _a.directives;\n if (!directives || !directives.length) {\n return true;\n }\n return getInclusionDirectives(directives).every(function (_a) {\n var directive = _a.directive, ifArgument = _a.ifArgument;\n var evaledValue = false;\n if (ifArgument.value.kind === \"Variable\") {\n evaledValue =\n variables && variables[ifArgument.value.name.value];\n invariant(evaledValue !== void 0, 67, directive.name.value);\n }\n else {\n evaledValue = ifArgument.value.value;\n }\n return directive.name.value === \"skip\" ? !evaledValue : evaledValue;\n });\n}\nexport function getDirectiveNames(root) {\n var names = [];\n visit(root, {\n Directive: function (node) {\n names.push(node.name.value);\n },\n });\n return names;\n}\nexport var hasAnyDirectives = function (names, root) {\n return hasDirectives(names, root, false);\n};\nexport var hasAllDirectives = function (names, root) {\n return hasDirectives(names, root, true);\n};\nexport function hasDirectives(names, root, all) {\n var nameSet = new Set(names);\n var uniqueCount = nameSet.size;\n visit(root, {\n Directive: function (node) {\n if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) {\n return BREAK;\n }\n },\n });\n // If we found all the names, nameSet will be empty. If we only care about\n // finding some of them, the < condition is sufficient.\n return all ? !nameSet.size : nameSet.size < uniqueCount;\n}\nexport function hasClientExports(document) {\n return document && hasDirectives([\"client\", \"export\"], document, true);\n}\nfunction isInclusionDirective(_a) {\n var value = _a.name.value;\n return value === \"skip\" || value === \"include\";\n}\nexport function getInclusionDirectives(directives) {\n var result = [];\n if (directives && directives.length) {\n directives.forEach(function (directive) {\n if (!isInclusionDirective(directive))\n return;\n var directiveArguments = directive.arguments;\n var directiveName = directive.name.value;\n invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName);\n var ifArgument = directiveArguments[0];\n invariant(ifArgument.name && ifArgument.name.value === \"if\", 69, directiveName);\n var ifValue = ifArgument.value;\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\"), 70, directiveName);\n result.push({ directive: directive, ifArgument: ifArgument });\n });\n }\n return result;\n}\n//# sourceMappingURL=directives.js.map","import { maybe } from \"../globals/index.js\";\nexport var canUseWeakMap = typeof WeakMap === \"function\" &&\n !maybe(function () { return navigator.product == \"ReactNative\" && !global.HermesInternal; });\nexport var canUseWeakSet = typeof WeakSet === \"function\";\nexport var canUseSymbol = typeof Symbol === \"function\" && typeof Symbol.for === \"function\";\nexport var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;\nexport var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === \"function\";\nvar usingJSDOM = \n// Following advice found in this comment from @domenic (maintainer of jsdom):\n// https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327\n//\n// Since we control the version of Jest and jsdom used when running Apollo\n// Client tests, and that version is recent enought to include \" jsdom/x.y.z\"\n// at the end of the user agent string, I believe this case is all we need to\n// check. Testing for \"Node.js\" was recommended for backwards compatibility\n// with older version of jsdom, but we don't have that problem.\nmaybe(function () { return navigator.userAgent.indexOf(\"jsdom\") >= 0; }) || false;\n// Our tests should all continue to pass if we remove this !usingJSDOM\n// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,\n// if we allow useLayoutEffect, then useSyncExternalStore generates many\n// warnings about useLayoutEffect doing nothing on the server. While these\n// warnings are harmless, this !usingJSDOM condition seems to be the best way to\n// prevent them (i.e. skipping useLayoutEffect when using jsdom).\nexport var canUseLayoutEffect = canUseDOM && !usingJSDOM;\n//# sourceMappingURL=canUse.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === \"object\";\n}\nexport function isPlainObject(obj) {\n return (obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null));\n}\n//# sourceMappingURL=objects.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { invariant, newInvariantError } from \"../globals/index.js\";\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(document, fragmentName) {\n var actualFragmentName = fragmentName;\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n var fragments = [];\n document.definitions.forEach(function (definition) {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === \"OperationDefinition\") {\n throw newInvariantError(\n 71,\n definition.operation,\n definition.name ? \" named '\".concat(definition.name.value, \"'\") : \"\"\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === \"FragmentDefinition\") {\n fragments.push(definition);\n }\n });\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === \"undefined\") {\n invariant(fragments.length === 1, 72, fragments.length);\n actualFragmentName = fragments[0].name.value;\n }\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n var query = __assign(__assign({}, document), { definitions: __spreadArray([\n {\n kind: \"OperationDefinition\",\n // OperationTypeNode is an enum\n operation: \"query\",\n selectionSet: {\n kind: \"SelectionSet\",\n selections: [\n {\n kind: \"FragmentSpread\",\n name: {\n kind: \"Name\",\n value: actualFragmentName,\n },\n },\n ],\n },\n }\n ], document.definitions, true) });\n return query;\n}\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(fragments) {\n if (fragments === void 0) { fragments = []; }\n var symTable = {};\n fragments.forEach(function (fragment) {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\nexport function getFragmentFromSelection(selection, fragmentMap) {\n switch (selection.kind) {\n case \"InlineFragment\":\n return selection;\n case \"FragmentSpread\": {\n var fragmentName = selection.name.value;\n if (typeof fragmentMap === \"function\") {\n return fragmentMap(fragmentName);\n }\n var fragment = fragmentMap && fragmentMap[fragmentName];\n invariant(fragment, 73, fragmentName);\n return fragment || null;\n }\n default:\n return null;\n }\n}\n//# sourceMappingURL=fragments.js.map","import { WeakCache, StrongCache } from \"@wry/caches\";\nvar scheduledCleanup = new WeakSet();\nfunction schedule(cache) {\n if (!scheduledCleanup.has(cache)) {\n scheduledCleanup.add(cache);\n setTimeout(function () {\n cache.clean();\n scheduledCleanup.delete(cache);\n }, 100);\n }\n}\n/**\n * @internal\n * A version of WeakCache that will auto-schedule a cleanup of the cache when\n * a new item is added.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of WeakCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `WeakCache`.\n */\nexport var AutoCleanedWeakCache = function (max, dispose) {\n /*\n Some builds of `WeakCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n var cache = new WeakCache(max, dispose);\n cache.set = function (key, value) {\n schedule(this);\n return WeakCache.prototype.set.call(this, key, value);\n };\n return cache;\n};\n/**\n * @internal\n * A version of StrongCache that will auto-schedule a cleanup of the cache when\n * a new item is added.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of StrongCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `StrongCache`.\n */\nexport var AutoCleanedStrongCache = function (max, dispose) {\n /*\n Some builds of `StrongCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n var cache = new StrongCache(max, dispose);\n cache.set = function (key, value) {\n schedule(this);\n return StrongCache.prototype.set.call(this, key, value);\n };\n return cache;\n};\n//# sourceMappingURL=caches.js.map","import { __assign } from \"tslib\";\nimport { global } from \"../globals/index.js\";\nvar cacheSizeSymbol = Symbol.for(\"apollo.cacheSize\");\n/**\n *\n * The global cache size configuration for Apollo Client.\n *\n * @remarks\n *\n * You can directly modify this object, but any modification will\n * only have an effect on caches that are created after the modification.\n *\n * So for global caches, such as `parser`, `canonicalStringify` and `print`,\n * you might need to call `.reset` on them, which will essentially re-create them.\n *\n * Alternatively, you can set `globalThis[Symbol.for(\"apollo.cacheSize\")]` before\n * you load the Apollo Client package:\n *\n * @example\n * ```ts\n * globalThis[Symbol.for(\"apollo.cacheSize\")] = {\n * parser: 100\n * } satisfies Partial // the `satisfies` is optional if using TypeScript\n * ```\n */\nexport var cacheSizes = __assign({}, global[cacheSizeSymbol]);\n//# sourceMappingURL=sizes.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { AutoCleanedStrongCache, cacheSizes, } from \"../../utilities/caching/index.js\";\nimport { registerGlobalCache } from \"../caching/getMemoryInternals.js\";\n/**\n * Like JSON.stringify, but with object keys always sorted in the same order.\n *\n * To achieve performant sorting, this function uses a Map from JSON-serialized\n * arrays of keys (in any order) to sorted arrays of the same keys, with a\n * single sorted array reference shared by all permutations of the keys.\n *\n * As a drawback, this function will add a little bit more memory for every\n * object encountered that has different (more, less, a different order of) keys\n * than in the past.\n *\n * In a typical application, this extra memory usage should not play a\n * significant role, as `canonicalStringify` will be called for only a limited\n * number of object shapes, and the cache will not grow beyond a certain point.\n * But in some edge cases, this could be a problem, so we provide\n * canonicalStringify.reset() as a way of clearing the cache.\n * */\nexport var canonicalStringify = Object.assign(function canonicalStringify(value) {\n return JSON.stringify(value, stableObjectReplacer);\n}, {\n reset: function () {\n // Clearing the sortingMap will reclaim all cached memory, without\n // affecting the logical results of canonicalStringify, but potentially\n // sacrificing performance until the cache is refilled.\n sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 /* defaultCacheSizes.canonicalStringify */);\n },\n});\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"canonicalStringify\", function () { return sortingMap.size; });\n}\n// Values are JSON-serialized arrays of object keys (in any order), and values\n// are sorted arrays of the same keys.\nvar sortingMap;\ncanonicalStringify.reset();\n// The JSON.stringify function takes an optional second argument called a\n// replacer function. This function is called for each key-value pair in the\n// object being stringified, and its return value is used instead of the\n// original value. If the replacer function returns a new value, that value is\n// stringified as JSON instead of the original value of the property.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter\nfunction stableObjectReplacer(key, value) {\n if (value && typeof value === \"object\") {\n var proto = Object.getPrototypeOf(value);\n // We don't want to mess with objects that are not \"plain\" objects, which\n // means their prototype is either Object.prototype or null. This check also\n // prevents needlessly rearranging the indices of arrays.\n if (proto === Object.prototype || proto === null) {\n var keys = Object.keys(value);\n // If keys is already sorted, let JSON.stringify serialize the original\n // value instead of creating a new object with keys in the same order.\n if (keys.every(everyKeyInOrder))\n return value;\n var unsortedKey = JSON.stringify(keys);\n var sortedKeys = sortingMap.get(unsortedKey);\n if (!sortedKeys) {\n keys.sort();\n var sortedKey = JSON.stringify(keys);\n // Checking for sortedKey in the sortingMap allows us to share the same\n // sorted array reference for all permutations of the same set of keys.\n sortedKeys = sortingMap.get(sortedKey) || keys;\n sortingMap.set(unsortedKey, sortedKeys);\n sortingMap.set(sortedKey, sortedKeys);\n }\n var sortedObject_1 = Object.create(proto);\n // Reassigning the keys in sorted order will cause JSON.stringify to\n // serialize them in sorted order.\n sortedKeys.forEach(function (key) {\n sortedObject_1[key] = value[key];\n });\n return sortedObject_1;\n }\n }\n return value;\n}\n// Since everything that happens in stableObjectReplacer benefits from being as\n// efficient as possible, we use a static function as the callback for\n// keys.every in order to test if the provided keys are already sorted without\n// allocating extra memory for a callback.\nfunction everyKeyInOrder(key, i, keys) {\n return i === 0 || keys[i - 1] <= key;\n}\n//# sourceMappingURL=canonicalStringify.js.map","import { newInvariantError } from \"../globals/index.js\";\nimport { isNonNullObject } from \"../common/objects.js\";\nimport { getFragmentFromSelection } from \"./fragments.js\";\nimport { canonicalStringify } from \"../common/canonicalStringify.js\";\nexport function makeReference(id) {\n return { __ref: String(id) };\n}\nexport function isReference(obj) {\n return Boolean(obj && typeof obj === \"object\" && typeof obj.__ref === \"string\");\n}\nexport function isDocumentNode(value) {\n return (isNonNullObject(value) &&\n value.kind === \"Document\" &&\n Array.isArray(value.definitions));\n}\nfunction isStringValue(value) {\n return value.kind === \"StringValue\";\n}\nfunction isBooleanValue(value) {\n return value.kind === \"BooleanValue\";\n}\nfunction isIntValue(value) {\n return value.kind === \"IntValue\";\n}\nfunction isFloatValue(value) {\n return value.kind === \"FloatValue\";\n}\nfunction isVariable(value) {\n return value.kind === \"Variable\";\n}\nfunction isObjectValue(value) {\n return value.kind === \"ObjectValue\";\n}\nfunction isListValue(value) {\n return value.kind === \"ListValue\";\n}\nfunction isEnumValue(value) {\n return value.kind === \"EnumValue\";\n}\nfunction isNullValue(value) {\n return value.kind === \"NullValue\";\n}\nexport function valueToObjectRepresentation(argObj, name, value, variables) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n }\n else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isObjectValue(value)) {\n var nestedArgObj_1 = {};\n value.fields.map(function (obj) {\n return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables);\n });\n argObj[name.value] = nestedArgObj_1;\n }\n else if (isVariable(value)) {\n var variableValue = (variables || {})[value.name.value];\n argObj[name.value] = variableValue;\n }\n else if (isListValue(value)) {\n argObj[name.value] = value.values.map(function (listValue) {\n var nestedArgArrayObj = {};\n valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables);\n return nestedArgArrayObj[name.value];\n });\n }\n else if (isEnumValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isNullValue(value)) {\n argObj[name.value] = null;\n }\n else {\n throw newInvariantError(82, name.value, value.kind);\n }\n}\nexport function storeKeyNameFromField(field, variables) {\n var directivesObj = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(function (directive) {\n directivesObj[directive.name.value] = {};\n if (directive.arguments) {\n directive.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables);\n });\n }\n });\n }\n var argObj = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj, name, value, variables);\n });\n }\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\nvar KNOWN_DIRECTIVES = [\n \"connection\",\n \"include\",\n \"skip\",\n \"client\",\n \"rest\",\n \"export\",\n \"nonreactive\",\n];\n// Default stable JSON.stringify implementation used by getStoreKeyName. Can be\n// updated/replaced with something better by calling\n// getStoreKeyName.setStringify(newStringifyFunction).\nvar storeKeyNameStringify = canonicalStringify;\nexport var getStoreKeyName = Object.assign(function (fieldName, args, directives) {\n if (args &&\n directives &&\n directives[\"connection\"] &&\n directives[\"connection\"][\"key\"]) {\n if (directives[\"connection\"][\"filter\"] &&\n directives[\"connection\"][\"filter\"].length > 0) {\n var filterKeys = directives[\"connection\"][\"filter\"] ?\n directives[\"connection\"][\"filter\"]\n : [];\n filterKeys.sort();\n var filteredArgs_1 = {};\n filterKeys.forEach(function (key) {\n filteredArgs_1[key] = args[key];\n });\n return \"\".concat(directives[\"connection\"][\"key\"], \"(\").concat(storeKeyNameStringify(filteredArgs_1), \")\");\n }\n else {\n return directives[\"connection\"][\"key\"];\n }\n }\n var completeFieldName = fieldName;\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n var stringifiedArgs = storeKeyNameStringify(args);\n completeFieldName += \"(\".concat(stringifiedArgs, \")\");\n }\n if (directives) {\n Object.keys(directives).forEach(function (key) {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1)\n return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += \"@\".concat(key, \"(\").concat(storeKeyNameStringify(directives[key]), \")\");\n }\n else {\n completeFieldName += \"@\".concat(key);\n }\n });\n }\n return completeFieldName;\n}, {\n setStringify: function (s) {\n var previous = storeKeyNameStringify;\n storeKeyNameStringify = s;\n return previous;\n },\n});\nexport function argumentsObjectFromField(field, variables) {\n if (field.arguments && field.arguments.length) {\n var argObj_1 = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj_1, name, value, variables);\n });\n return argObj_1;\n }\n return null;\n}\nexport function resultKeyNameFromField(field) {\n return field.alias ? field.alias.value : field.name.value;\n}\nexport function getTypenameFromResult(result, selectionSet, fragmentMap) {\n var fragments;\n for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {\n var selection = _a[_i];\n if (isField(selection)) {\n if (selection.name.value === \"__typename\") {\n return result[resultKeyNameFromField(selection)];\n }\n }\n else if (fragments) {\n fragments.push(selection);\n }\n else {\n fragments = [selection];\n }\n }\n if (typeof result.__typename === \"string\") {\n return result.__typename;\n }\n if (fragments) {\n for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {\n var selection = fragments_1[_b];\n var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);\n if (typeof typename === \"string\") {\n return typename;\n }\n }\n }\n}\nexport function isField(selection) {\n return selection.kind === \"Field\";\n}\nexport function isInlineFragment(selection) {\n return selection.kind === \"InlineFragment\";\n}\n//# sourceMappingURL=storeUtils.js.map","import { invariant, newInvariantError } from \"../globals/index.js\";\nimport { valueToObjectRepresentation } from \"./storeUtils.js\";\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc) {\n invariant(doc && doc.kind === \"Document\", 74);\n var operations = doc.definitions\n .filter(function (d) { return d.kind !== \"FragmentDefinition\"; })\n .map(function (definition) {\n if (definition.kind !== \"OperationDefinition\") {\n throw newInvariantError(75, definition.kind);\n }\n return definition;\n });\n invariant(operations.length <= 1, 76, operations.length);\n return doc;\n}\nexport function getOperationDefinition(doc) {\n checkDocument(doc);\n return doc.definitions.filter(function (definition) {\n return definition.kind === \"OperationDefinition\";\n })[0];\n}\nexport function getOperationName(doc) {\n return (doc.definitions\n .filter(function (definition) {\n return definition.kind === \"OperationDefinition\" && !!definition.name;\n })\n .map(function (x) { return x.name.value; })[0] || null);\n}\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(doc) {\n return doc.definitions.filter(function (definition) {\n return definition.kind === \"FragmentDefinition\";\n });\n}\nexport function getQueryDefinition(doc) {\n var queryDef = getOperationDefinition(doc);\n invariant(queryDef && queryDef.operation === \"query\", 77);\n return queryDef;\n}\nexport function getFragmentDefinition(doc) {\n invariant(doc.kind === \"Document\", 78);\n invariant(doc.definitions.length <= 1, 79);\n var fragmentDef = doc.definitions[0];\n invariant(fragmentDef.kind === \"FragmentDefinition\", 80);\n return fragmentDef;\n}\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(queryDoc) {\n checkDocument(queryDoc);\n var fragmentDefinition;\n for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) {\n var definition = _a[_i];\n if (definition.kind === \"OperationDefinition\") {\n var operation = definition.operation;\n if (operation === \"query\" ||\n operation === \"mutation\" ||\n operation === \"subscription\") {\n return definition;\n }\n }\n if (definition.kind === \"FragmentDefinition\" && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition;\n }\n }\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n throw newInvariantError(81);\n}\nexport function getDefaultValues(definition) {\n var defaultValues = Object.create(null);\n var defs = definition && definition.variableDefinitions;\n if (defs && defs.length) {\n defs.forEach(function (def) {\n if (def.defaultValue) {\n valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue);\n }\n });\n }\n return defaultValues;\n}\n//# sourceMappingURL=getFromAST.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap, canUseWeakSet } from \"../common/canUse.js\";\nimport { checkDocument } from \"./getFromAST.js\";\nimport { invariant } from \"../globals/index.js\";\nimport { WeakCache } from \"@wry/caches\";\nimport { wrap } from \"optimism\";\nimport { cacheSizes } from \"../caching/index.js\";\nfunction identity(document) {\n return document;\n}\nvar DocumentTransform = /** @class */ (function () {\n function DocumentTransform(transform, options) {\n if (options === void 0) { options = Object.create(null); }\n this.resultCache = canUseWeakSet ? new WeakSet() : new Set();\n this.transform = transform;\n if (options.getCacheKey) {\n // Override default `getCacheKey` function, which returns [document].\n this.getCacheKey = options.getCacheKey;\n }\n this.cached = options.cache !== false;\n this.resetCache();\n }\n // This default implementation of getCacheKey can be overridden by providing\n // options.getCacheKey to the DocumentTransform constructor. In general, a\n // getCacheKey function may either return an array of keys (often including\n // the document) to be used as a cache key, or undefined to indicate the\n // transform for this document should not be cached.\n DocumentTransform.prototype.getCacheKey = function (document) {\n return [document];\n };\n DocumentTransform.identity = function () {\n // No need to cache this transform since it just returns the document\n // unchanged. This should save a bit of memory that would otherwise be\n // needed to populate the `documentCache` of this transform.\n return new DocumentTransform(identity, { cache: false });\n };\n DocumentTransform.split = function (predicate, left, right) {\n if (right === void 0) { right = DocumentTransform.identity(); }\n return Object.assign(new DocumentTransform(function (document) {\n var documentTransform = predicate(document) ? left : right;\n return documentTransform.transformDocument(document);\n }, \n // Reasonably assume both `left` and `right` transforms handle their own caching\n { cache: false }), { left: left, right: right });\n };\n /**\n * Resets the internal cache of this transform, if it has one.\n */\n DocumentTransform.prototype.resetCache = function () {\n var _this = this;\n if (this.cached) {\n var stableCacheKeys_1 = new Trie(canUseWeakMap);\n this.performWork = wrap(DocumentTransform.prototype.performWork.bind(this), {\n makeCacheKey: function (document) {\n var cacheKeys = _this.getCacheKey(document);\n if (cacheKeys) {\n invariant(Array.isArray(cacheKeys), 66);\n return stableCacheKeys_1.lookupArray(cacheKeys);\n }\n },\n max: cacheSizes[\"documentTransform.cache\"],\n cache: (WeakCache),\n });\n }\n };\n DocumentTransform.prototype.performWork = function (document) {\n checkDocument(document);\n return this.transform(document);\n };\n DocumentTransform.prototype.transformDocument = function (document) {\n // If a user passes an already transformed result back to this function,\n // immediately return it.\n if (this.resultCache.has(document)) {\n return document;\n }\n var transformedDocument = this.performWork(document);\n this.resultCache.add(transformedDocument);\n return transformedDocument;\n };\n DocumentTransform.prototype.concat = function (otherTransform) {\n var _this = this;\n return Object.assign(new DocumentTransform(function (document) {\n return otherTransform.transformDocument(_this.transformDocument(document));\n }, \n // Reasonably assume both transforms handle their own caching\n { cache: false }), {\n left: this,\n right: otherTransform,\n });\n };\n return DocumentTransform;\n}());\nexport { DocumentTransform };\n//# sourceMappingURL=DocumentTransform.js.map","import { print as origPrint } from \"graphql\";\nimport { AutoCleanedWeakCache, cacheSizes, } from \"../caching/index.js\";\nimport { registerGlobalCache } from \"../caching/getMemoryInternals.js\";\nvar printCache;\nexport var print = Object.assign(function (ast) {\n var result = printCache.get(ast);\n if (!result) {\n result = origPrint(ast);\n printCache.set(ast, result);\n }\n return result;\n}, {\n reset: function () {\n printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 /* defaultCacheSizes.print */);\n },\n});\nprint.reset();\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"print\", function () { return (printCache ? printCache.size : 0); });\n}\n//# sourceMappingURL=print.js.map","// A version of Array.isArray that works better with readonly arrays.\nexport var isArray = Array.isArray;\nexport function isNonEmptyArray(value) {\n return Array.isArray(value) && value.length > 0;\n}\n//# sourceMappingURL=arrays.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { invariant } from \"../globals/index.js\";\nimport { visit, Kind } from \"graphql\";\nimport { checkDocument, getOperationDefinition, getFragmentDefinition, getFragmentDefinitions, getMainDefinition, } from \"./getFromAST.js\";\nimport { isField } from \"./storeUtils.js\";\nimport { createFragmentMap } from \"./fragments.js\";\nimport { isArray, isNonEmptyArray } from \"../common/arrays.js\";\nvar TYPENAME_FIELD = {\n kind: Kind.FIELD,\n name: {\n kind: Kind.NAME,\n value: \"__typename\",\n },\n};\nfunction isEmpty(op, fragmentMap) {\n return (!op ||\n op.selectionSet.selections.every(function (selection) {\n return selection.kind === Kind.FRAGMENT_SPREAD &&\n isEmpty(fragmentMap[selection.name.value], fragmentMap);\n }));\n}\nfunction nullIfDocIsEmpty(doc) {\n return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ?\n null\n : doc;\n}\nfunction getDirectiveMatcher(configs) {\n var names = new Map();\n var tests = new Map();\n configs.forEach(function (directive) {\n if (directive) {\n if (directive.name) {\n names.set(directive.name, directive);\n }\n else if (directive.test) {\n tests.set(directive.test, directive);\n }\n }\n });\n return function (directive) {\n var config = names.get(directive.name.value);\n if (!config && tests.size) {\n tests.forEach(function (testConfig, test) {\n if (test(directive)) {\n config = testConfig;\n }\n });\n }\n return config;\n };\n}\nfunction makeInUseGetterFunction(defaultKey) {\n var map = new Map();\n return function inUseGetterFunction(key) {\n if (key === void 0) { key = defaultKey; }\n var inUse = map.get(key);\n if (!inUse) {\n map.set(key, (inUse = {\n // Variable and fragment spread names used directly within this\n // operation or fragment definition, as identified by key. These sets\n // will be populated during the first traversal of the document in\n // removeDirectivesFromDocument below.\n variables: new Set(),\n fragmentSpreads: new Set(),\n }));\n }\n return inUse;\n };\n}\nexport function removeDirectivesFromDocument(directives, doc) {\n checkDocument(doc);\n // Passing empty strings to makeInUseGetterFunction means we handle anonymous\n // operations as if their names were \"\". Anonymous fragment definitions are\n // not supposed to be possible, but the same default naming strategy seems\n // appropriate for that case as well.\n var getInUseByOperationName = makeInUseGetterFunction(\"\");\n var getInUseByFragmentName = makeInUseGetterFunction(\"\");\n var getInUse = function (ancestors) {\n for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) {\n if (isArray(ancestor))\n continue;\n if (ancestor.kind === Kind.OPERATION_DEFINITION) {\n // If an operation is anonymous, we use the empty string as its key.\n return getInUseByOperationName(ancestor.name && ancestor.name.value);\n }\n if (ancestor.kind === Kind.FRAGMENT_DEFINITION) {\n return getInUseByFragmentName(ancestor.name.value);\n }\n }\n globalThis.__DEV__ !== false && invariant.error(83);\n return null;\n };\n var operationCount = 0;\n for (var i = doc.definitions.length - 1; i >= 0; --i) {\n if (doc.definitions[i].kind === Kind.OPERATION_DEFINITION) {\n ++operationCount;\n }\n }\n var directiveMatcher = getDirectiveMatcher(directives);\n var shouldRemoveField = function (nodeDirectives) {\n return isNonEmptyArray(nodeDirectives) &&\n nodeDirectives\n .map(directiveMatcher)\n .some(function (config) { return config && config.remove; });\n };\n var originalFragmentDefsByPath = new Map();\n // Any time the first traversal of the document below makes a change like\n // removing a fragment (by returning null), this variable should be set to\n // true. Once it becomes true, it should never be set to false again. If this\n // variable remains false throughout the traversal, then we can return the\n // original doc immediately without any modifications.\n var firstVisitMadeChanges = false;\n var fieldOrInlineFragmentVisitor = {\n enter: function (node) {\n if (shouldRemoveField(node.directives)) {\n firstVisitMadeChanges = true;\n return null;\n }\n },\n };\n var docWithoutDirectiveSubtrees = visit(doc, {\n // These two AST node types share the same implementation, defined above.\n Field: fieldOrInlineFragmentVisitor,\n InlineFragment: fieldOrInlineFragmentVisitor,\n VariableDefinition: {\n enter: function () {\n // VariableDefinition nodes do not count as variables in use, though\n // they do contain Variable nodes that might be visited below. To avoid\n // counting variable declarations as usages, we skip visiting the\n // contents of this VariableDefinition node by returning false.\n return false;\n },\n },\n Variable: {\n enter: function (node, _key, _parent, _path, ancestors) {\n var inUse = getInUse(ancestors);\n if (inUse) {\n inUse.variables.add(node.name.value);\n }\n },\n },\n FragmentSpread: {\n enter: function (node, _key, _parent, _path, ancestors) {\n if (shouldRemoveField(node.directives)) {\n firstVisitMadeChanges = true;\n return null;\n }\n var inUse = getInUse(ancestors);\n if (inUse) {\n inUse.fragmentSpreads.add(node.name.value);\n }\n // We might like to remove this FragmentSpread by returning null here if\n // the corresponding FragmentDefinition node is also going to be removed\n // by the logic below, but we can't control the relative order of those\n // events, so we have to postpone the removal of dangling FragmentSpread\n // nodes until after the current visit of the document has finished.\n },\n },\n FragmentDefinition: {\n enter: function (node, _key, _parent, path) {\n originalFragmentDefsByPath.set(JSON.stringify(path), node);\n },\n leave: function (node, _key, _parent, path) {\n var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path));\n if (node === originalNode) {\n // If the FragmentNode received by this leave function is identical to\n // the one received by the corresponding enter function (above), then\n // the visitor must not have made any changes within this\n // FragmentDefinition node. This fragment definition may still be\n // removed if there are no ...spread references to it, but it won't be\n // removed just because it has only a __typename field.\n return node;\n }\n if (\n // This logic applies only if the document contains one or more\n // operations, since removing all fragments from a document containing\n // only fragments makes the document useless.\n operationCount > 0 &&\n node.selectionSet.selections.every(function (selection) {\n return selection.kind === Kind.FIELD &&\n selection.name.value === \"__typename\";\n })) {\n // This is a somewhat opinionated choice: if a FragmentDefinition ends\n // up having no fields other than __typename, we remove the whole\n // fragment definition, and later prune ...spread references to it.\n getInUseByFragmentName(node.name.value).removed = true;\n firstVisitMadeChanges = true;\n return null;\n }\n },\n },\n Directive: {\n leave: function (node) {\n // If a matching directive is found, remove the directive itself. Note\n // that this does not remove the target (field, argument, etc) of the\n // directive, but only the directive itself.\n if (directiveMatcher(node)) {\n firstVisitMadeChanges = true;\n return null;\n }\n },\n },\n });\n if (!firstVisitMadeChanges) {\n // If our first pass did not change anything about the document, then there\n // is no cleanup we need to do, and we can return the original doc.\n return doc;\n }\n // Utility for making sure inUse.transitiveVars is recursively populated.\n // Because this logic assumes inUse.fragmentSpreads has been completely\n // populated and inUse.removed has been set if appropriate,\n // populateTransitiveVars must be called after that information has been\n // collected by the first traversal of the document.\n var populateTransitiveVars = function (inUse) {\n if (!inUse.transitiveVars) {\n inUse.transitiveVars = new Set(inUse.variables);\n if (!inUse.removed) {\n inUse.fragmentSpreads.forEach(function (childFragmentName) {\n populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) {\n inUse.transitiveVars.add(varName);\n });\n });\n }\n }\n return inUse;\n };\n // Since we've been keeping track of fragment spreads used by particular\n // operations and fragment definitions, we now need to compute the set of all\n // spreads used (transitively) by any operations in the document.\n var allFragmentNamesUsed = new Set();\n docWithoutDirectiveSubtrees.definitions.forEach(function (def) {\n if (def.kind === Kind.OPERATION_DEFINITION) {\n populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) {\n allFragmentNamesUsed.add(childFragmentName);\n });\n }\n else if (def.kind === Kind.FRAGMENT_DEFINITION &&\n // If there are no operations in the document, then all fragment\n // definitions count as usages of their own fragment names. This heuristic\n // prevents accidentally removing all fragment definitions from the\n // document just because it contains no operations that use the fragments.\n operationCount === 0 &&\n !getInUseByFragmentName(def.name.value).removed) {\n allFragmentNamesUsed.add(def.name.value);\n }\n });\n // Now that we have added all fragment spreads used by operations to the\n // allFragmentNamesUsed set, we can complete the set by transitively adding\n // all fragment spreads used by those fragments, and so on.\n allFragmentNamesUsed.forEach(function (fragmentName) {\n // Once all the childFragmentName strings added here have been seen already,\n // the top-level allFragmentNamesUsed.forEach loop will terminate.\n populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) {\n allFragmentNamesUsed.add(childFragmentName);\n });\n });\n var fragmentWillBeRemoved = function (fragmentName) {\n return !!(\n // A fragment definition will be removed if there are no spreads that refer\n // to it, or the fragment was explicitly removed because it had no fields\n // other than __typename.\n (!allFragmentNamesUsed.has(fragmentName) ||\n getInUseByFragmentName(fragmentName).removed));\n };\n var enterVisitor = {\n enter: function (node) {\n if (fragmentWillBeRemoved(node.name.value)) {\n return null;\n }\n },\n };\n return nullIfDocIsEmpty(visit(docWithoutDirectiveSubtrees, {\n // If the fragment is going to be removed, then leaving any dangling\n // FragmentSpread nodes with the same name would be a mistake.\n FragmentSpread: enterVisitor,\n // This is where the fragment definition is actually removed.\n FragmentDefinition: enterVisitor,\n OperationDefinition: {\n leave: function (node) {\n // Upon leaving each operation in the depth-first AST traversal, prune\n // any variables that are declared by the operation but unused within.\n if (node.variableDefinitions) {\n var usedVariableNames_1 = populateTransitiveVars(\n // If an operation is anonymous, we use the empty string as its key.\n getInUseByOperationName(node.name && node.name.value)).transitiveVars;\n // According to the GraphQL spec, all variables declared by an\n // operation must either be used by that operation or used by some\n // fragment included transitively into that operation:\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n //\n // To stay on the right side of this validation rule, if/when we\n // remove the last $var references from an operation or its fragments,\n // we must also remove the corresponding $var declaration from the\n // enclosing operation. This pruning applies only to operations and\n // not fragment definitions, at the moment. Fragments may be able to\n // declare variables eventually, but today they can only consume them.\n if (usedVariableNames_1.size < node.variableDefinitions.length) {\n return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) {\n return usedVariableNames_1.has(varDef.variable.name.value);\n }) });\n }\n }\n },\n },\n }));\n}\nexport var addTypenameToDocument = Object.assign(function (doc) {\n return visit(doc, {\n SelectionSet: {\n enter: function (node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (parent &&\n parent.kind ===\n Kind.OPERATION_DEFINITION) {\n return;\n }\n // No changes if no selections.\n var selections = node.selections;\n if (!selections) {\n return;\n }\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n var skip = selections.some(function (selection) {\n return (isField(selection) &&\n (selection.name.value === \"__typename\" ||\n selection.name.value.lastIndexOf(\"__\", 0) === 0));\n });\n if (skip) {\n return;\n }\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n var field = parent;\n if (isField(field) &&\n field.directives &&\n field.directives.some(function (d) { return d.name.value === \"export\"; })) {\n return;\n }\n // Create and return a new SelectionSet with a __typename Field.\n return __assign(__assign({}, node), { selections: __spreadArray(__spreadArray([], selections, true), [TYPENAME_FIELD], false) });\n },\n },\n });\n}, {\n added: function (field) {\n return field === TYPENAME_FIELD;\n },\n});\nvar connectionRemoveConfig = {\n test: function (directive) {\n var willRemove = directive.name.value === \"connection\";\n if (willRemove) {\n if (!directive.arguments ||\n !directive.arguments.some(function (arg) { return arg.name.value === \"key\"; })) {\n globalThis.__DEV__ !== false && invariant.warn(84);\n }\n }\n return willRemove;\n },\n};\nexport function removeConnectionDirectiveFromDocument(doc) {\n return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));\n}\nfunction hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) {\n if (nestedCheck === void 0) { nestedCheck = true; }\n return (!!selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(function (selection) {\n return hasDirectivesInSelection(directives, selection, nestedCheck);\n }));\n}\nfunction hasDirectivesInSelection(directives, selection, nestedCheck) {\n if (nestedCheck === void 0) { nestedCheck = true; }\n if (!isField(selection)) {\n return true;\n }\n if (!selection.directives) {\n return false;\n }\n return (selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck)));\n}\nfunction getArgumentMatcher(config) {\n return function argumentMatcher(argument) {\n return config.some(function (aConfig) {\n return argument.value &&\n argument.value.kind === Kind.VARIABLE &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument)));\n });\n };\n}\nexport function removeArgumentsFromDocument(config, doc) {\n var argMatcher = getArgumentMatcher(config);\n return nullIfDocIsEmpty(visit(doc, {\n OperationDefinition: {\n enter: function (node) {\n return __assign(__assign({}, node), { \n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions ?\n node.variableDefinitions.filter(function (varDef) {\n return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });\n })\n : [] });\n },\n },\n Field: {\n enter: function (node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; });\n if (shouldRemoveField) {\n var argMatchCount_1 = 0;\n if (node.arguments) {\n node.arguments.forEach(function (arg) {\n if (argMatcher(arg)) {\n argMatchCount_1 += 1;\n }\n });\n }\n if (argMatchCount_1 === 1) {\n return null;\n }\n }\n },\n },\n Argument: {\n enter: function (node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }));\n}\nexport function removeFragmentSpreadFromDocument(config, doc) {\n function enter(node) {\n if (config.some(function (def) { return def.name === node.name.value; })) {\n return null;\n }\n }\n return nullIfDocIsEmpty(visit(doc, {\n FragmentSpread: { enter: enter },\n FragmentDefinition: { enter: enter },\n }));\n}\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(document) {\n var definition = getMainDefinition(document);\n var definitionOperation = definition.operation;\n if (definitionOperation === \"query\") {\n // Already a query, so return the existing document.\n return document;\n }\n // Build a new query using the selection set of the main operation.\n var modifiedDoc = visit(document, {\n OperationDefinition: {\n enter: function (node) {\n return __assign(__assign({}, node), { operation: \"query\" });\n },\n },\n });\n return modifiedDoc;\n}\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(document) {\n checkDocument(document);\n var modifiedDoc = removeDirectivesFromDocument([\n {\n test: function (directive) { return directive.name.value === \"client\"; },\n remove: true,\n },\n ], document);\n return modifiedDoc;\n}\n//# sourceMappingURL=transform.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { isNonNullObject } from \"./objects.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function mergeDeep() {\n var sources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n sources[_i] = arguments[_i];\n }\n return mergeDeepArray(sources);\n}\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources) {\n var target = sources[0] || {};\n var count = sources.length;\n if (count > 1) {\n var merger = new DeepMerger();\n for (var i = 1; i < count; ++i) {\n target = merger.merge(target, sources[i]);\n }\n }\n return target;\n}\nvar defaultReconciler = function (target, source, property) {\n return this.merge(target[property], source[property]);\n};\nvar DeepMerger = /** @class */ (function () {\n function DeepMerger(reconciler) {\n if (reconciler === void 0) { reconciler = defaultReconciler; }\n this.reconciler = reconciler;\n this.isObject = isNonNullObject;\n this.pastCopies = new Set();\n }\n DeepMerger.prototype.merge = function (target, source) {\n var _this = this;\n var context = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n context[_i - 2] = arguments[_i];\n }\n if (isNonNullObject(source) && isNonNullObject(target)) {\n Object.keys(source).forEach(function (sourceKey) {\n if (hasOwnProperty.call(target, sourceKey)) {\n var targetValue = target[sourceKey];\n if (source[sourceKey] !== targetValue) {\n var result = _this.reconciler.apply(_this, __spreadArray([target,\n source,\n sourceKey], context, false));\n // A well-implemented reconciler may return targetValue to indicate\n // the merge changed nothing about the structure of the target.\n if (result !== targetValue) {\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = result;\n }\n }\n }\n else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = source[sourceKey];\n }\n });\n return target;\n }\n // If source (or target) is not an object, let source replace target.\n return source;\n };\n DeepMerger.prototype.shallowCopyForMerge = function (value) {\n if (isNonNullObject(value)) {\n if (!this.pastCopies.has(value)) {\n if (Array.isArray(value)) {\n value = value.slice(0);\n }\n else {\n value = __assign({ __proto__: Object.getPrototypeOf(value) }, value);\n }\n this.pastCopies.add(value);\n }\n }\n return value;\n };\n return DeepMerger;\n}());\nexport { DeepMerger };\n//# sourceMappingURL=mergeDeep.js.map","export function createFulfilledPromise(value) {\n var promise = Promise.resolve(value);\n promise.status = \"fulfilled\";\n promise.value = value;\n return promise;\n}\nexport function createRejectedPromise(reason) {\n var promise = Promise.reject(reason);\n // prevent potential edge cases leaking unhandled error rejections\n promise.catch(function () { });\n promise.status = \"rejected\";\n promise.reason = reason;\n return promise;\n}\nexport function isStatefulPromise(promise) {\n return \"status\" in promise;\n}\nexport function wrapPromiseWithState(promise) {\n if (isStatefulPromise(promise)) {\n return promise;\n }\n var pendingPromise = promise;\n pendingPromise.status = \"pending\";\n pendingPromise.then(function (value) {\n if (pendingPromise.status === \"pending\") {\n var fulfilledPromise = pendingPromise;\n fulfilledPromise.status = \"fulfilled\";\n fulfilledPromise.value = value;\n }\n }, function (reason) {\n if (pendingPromise.status === \"pending\") {\n var rejectedPromise = pendingPromise;\n rejectedPromise.status = \"rejected\";\n rejectedPromise.reason = reason;\n }\n });\n return promise;\n}\n//# sourceMappingURL=decoration.js.map","var toString = Object.prototype.toString;\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value) {\n return cloneDeepHelper(value);\n}\nfunction cloneDeepHelper(val, seen) {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n seen = seen || new Map();\n if (seen.has(val))\n return seen.get(val);\n var copy_1 = val.slice(0);\n seen.set(val, copy_1);\n copy_1.forEach(function (child, i) {\n copy_1[i] = cloneDeepHelper(child, seen);\n });\n return copy_1;\n }\n case \"[object Object]\": {\n seen = seen || new Map();\n if (seen.has(val))\n return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n var copy_2 = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy_2);\n Object.keys(val).forEach(function (key) {\n copy_2[key] = cloneDeepHelper(val[key], seen);\n });\n return copy_2;\n }\n default:\n return val;\n }\n}\n//# sourceMappingURL=cloneDeep.js.map","import { isNonNullObject } from \"./objects.js\";\nfunction deepFreeze(value) {\n var workSet = new Set([value]);\n workSet.forEach(function (obj) {\n if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {\n Object.getOwnPropertyNames(obj).forEach(function (name) {\n if (isNonNullObject(obj[name]))\n workSet.add(obj[name]);\n });\n }\n });\n return value;\n}\nfunction shallowFreeze(obj) {\n if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) {\n try {\n Object.freeze(obj);\n }\n catch (e) {\n // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but\n // they all throw a TypeError when you try, so we re-throw any exceptions\n // that are not TypeErrors, since that would be unexpected.\n if (e instanceof TypeError)\n return null;\n throw e;\n }\n }\n return obj;\n}\nexport function maybeDeepFreeze(obj) {\n if (globalThis.__DEV__ !== false) {\n deepFreeze(obj);\n }\n return obj;\n}\n//# sourceMappingURL=maybeDeepFreeze.js.map","export function iterateObserversSafely(observers, method, argument) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n var observersWithMethod = [];\n observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); });\n observersWithMethod.forEach(function (obs) { return obs[method](argument); });\n}\n//# sourceMappingURL=iteration.js.map","import { Observable } from \"./Observable.js\";\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap(observable, mapFn, catchFn) {\n return new Observable(function (observer) {\n var promiseQueue = {\n // Normally we would initialize promiseQueue to Promise.resolve(), but\n // in this case, for backwards compatibility, we need to be careful to\n // invoke the first callback synchronously.\n then: function (callback) {\n return new Promise(function (resolve) { return resolve(callback()); });\n },\n };\n function makeCallback(examiner, key) {\n return function (arg) {\n if (examiner) {\n var both = function () {\n // If the observer is closed, we don't want to continue calling the\n // mapping function - it's result will be swallowed anyways.\n return observer.closed ?\n /* will be swallowed */ 0\n : examiner(arg);\n };\n promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });\n }\n else {\n observer[key](arg);\n }\n };\n }\n var handler = {\n next: makeCallback(mapFn, \"next\"),\n error: makeCallback(catchFn, \"error\"),\n complete: function () {\n // no need to reassign `promiseQueue`, after `observer.complete`,\n // the observer will be closed and short-circuit everything anyways\n /*promiseQueue = */ promiseQueue.then(function () { return observer.complete(); });\n },\n };\n var sub = observable.subscribe(handler);\n return function () { return sub.unsubscribe(); };\n });\n}\n//# sourceMappingURL=asyncMap.js.map","import { Observable } from \"./Observable.js\";\nimport { canUseSymbol } from \"../common/canUse.js\";\n// Generic implementations of Observable.prototype methods like map and\n// filter need to know how to create a new Observable from an Observable\n// subclass (like Concast or ObservableQuery). Those methods assume\n// (perhaps unwisely?) that they can call the subtype's constructor with a\n// Subscriber function, even though the subclass constructor might expect\n// different parameters. Defining this static Symbol.species property on\n// the subclass is a hint to generic Observable code to use the default\n// constructor instead of trying to do `new Subclass(observer => ...)`.\nexport function fixObservableSubclass(subclass) {\n function set(key) {\n // Object.defineProperty is necessary because the Symbol.species\n // property is a getter by default in modern JS environments, so we\n // can't assign to it with a normal assignment expression.\n Object.defineProperty(subclass, key, { value: Observable });\n }\n if (canUseSymbol && Symbol.species) {\n set(Symbol.species);\n }\n // The \"@@species\" string is used as a fake Symbol.species value in some\n // polyfill systems (including the SymbolSpecies variable used by\n // zen-observable), so we should set it as well, to be safe.\n set(\"@@species\");\n return subclass;\n}\n//# sourceMappingURL=subclassing.js.map","import { __extends } from \"tslib\";\nimport { Observable } from \"./Observable.js\";\nimport { iterateObserversSafely } from \"./iteration.js\";\nimport { fixObservableSubclass } from \"./subclassing.js\";\nfunction isPromiseLike(value) {\n return value && typeof value.then === \"function\";\n}\n// A Concast observable concatenates the given sources into a single\n// non-overlapping sequence of Ts, automatically unwrapping any promises,\n// and broadcasts the T elements of that sequence to any number of\n// subscribers, all without creating a bunch of intermediary Observable\n// wrapper objects.\n//\n// Even though any number of observers can subscribe to the Concast, each\n// source observable is guaranteed to receive at most one subscribe call,\n// and the results are multicast to all observers.\n//\n// In addition to broadcasting every next/error message to this.observers,\n// the Concast stores the most recent message using this.latest, so any\n// new observers can immediately receive the latest message, even if it\n// was originally delivered in the past. This behavior means we can assume\n// every active observer in this.observers has received the same most\n// recent message.\n//\n// With the exception of this.latest replay, a Concast is a \"hot\"\n// observable in the sense that it does not replay past results from the\n// beginning of time for each new observer.\n//\n// Could we have used some existing RxJS class instead? Concast is\n// similar to a BehaviorSubject, because it is multicast and redelivers\n// the latest next/error message to new subscribers. Unlike Subject,\n// Concast does not expose an Observer interface (this.handlers is\n// intentionally private), since Concast gets its inputs from the\n// concatenated sources. If we ever switch to RxJS, there may be some\n// value in reusing their code, but for now we use zen-observable, which\n// does not contain any Subject implementations.\nvar Concast = /** @class */ (function (_super) {\n __extends(Concast, _super);\n // Not only can the individual elements of the iterable be promises, but\n // also the iterable itself can be wrapped in a promise.\n function Concast(sources) {\n var _this = _super.call(this, function (observer) {\n _this.addObserver(observer);\n return function () { return _this.removeObserver(observer); };\n }) || this;\n // Active observers receiving broadcast messages. Thanks to this.latest,\n // we can assume all observers in this Set have received the same most\n // recent message, though possibly at different times in the past.\n _this.observers = new Set();\n _this.promise = new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n });\n // Bound handler functions that can be reused for every internal\n // subscription.\n _this.handlers = {\n next: function (result) {\n if (_this.sub !== null) {\n _this.latest = [\"next\", result];\n _this.notify(\"next\", result);\n iterateObserversSafely(_this.observers, \"next\", result);\n }\n },\n error: function (error) {\n var sub = _this.sub;\n if (sub !== null) {\n // Delay unsubscribing from the underlying subscription slightly,\n // so that immediately subscribing another observer can keep the\n // subscription active.\n if (sub)\n setTimeout(function () { return sub.unsubscribe(); });\n _this.sub = null;\n _this.latest = [\"error\", error];\n _this.reject(error);\n _this.notify(\"error\", error);\n iterateObserversSafely(_this.observers, \"error\", error);\n }\n },\n complete: function () {\n var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b;\n if (sub !== null) {\n // If complete is called before concast.start, this.sources may be\n // undefined, so we use a default value of [] for sources. That works\n // here because it falls into the if (!value) {...} block, which\n // appropriately terminates the Concast, even if this.sources might\n // eventually have been initialized to a non-empty array.\n var value = sources.shift();\n if (!value) {\n if (sub)\n setTimeout(function () { return sub.unsubscribe(); });\n _this.sub = null;\n if (_this.latest && _this.latest[0] === \"next\") {\n _this.resolve(_this.latest[1]);\n }\n else {\n _this.resolve();\n }\n _this.notify(\"complete\");\n // We do not store this.latest = [\"complete\"], because doing so\n // discards useful information about the previous next (or\n // error) message. Instead, if new observers subscribe after\n // this Concast has completed, they will receive the final\n // 'next' message (unless there was an error) immediately\n // followed by a 'complete' message (see addObserver).\n iterateObserversSafely(_this.observers, \"complete\");\n }\n else if (isPromiseLike(value)) {\n value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error);\n }\n else {\n _this.sub = value.subscribe(_this.handlers);\n }\n }\n },\n };\n _this.nextResultListeners = new Set();\n // A public way to abort observation and broadcast.\n _this.cancel = function (reason) {\n _this.reject(reason);\n _this.sources = [];\n _this.handlers.complete();\n };\n // Suppress rejection warnings for this.promise, since it's perfectly\n // acceptable to pay no attention to this.promise if you're consuming\n // the results through the normal observable API.\n _this.promise.catch(function (_) { });\n // If someone accidentally tries to create a Concast using a subscriber\n // function, recover by creating an Observable from that subscriber and\n // using it as the source.\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n if (isPromiseLike(sources)) {\n sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error);\n }\n else {\n _this.start(sources);\n }\n return _this;\n }\n Concast.prototype.start = function (sources) {\n if (this.sub !== void 0)\n return;\n // In practice, sources is most often simply an Array of observables.\n // TODO Consider using sources[Symbol.iterator]() to take advantage\n // of the laziness of non-Array iterables.\n this.sources = Array.from(sources);\n // Calling this.handlers.complete() kicks off consumption of the first\n // source observable. It's tempting to do this step lazily in\n // addObserver, but this.promise can be accessed without calling\n // addObserver, so consumption needs to begin eagerly.\n this.handlers.complete();\n };\n Concast.prototype.deliverLastMessage = function (observer) {\n if (this.latest) {\n var nextOrError = this.latest[0];\n var method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n // If the subscription is already closed, and the last message was\n // a 'next' message, simulate delivery of the final 'complete'\n // message again.\n if (this.sub === null && nextOrError === \"next\" && observer.complete) {\n observer.complete();\n }\n }\n };\n Concast.prototype.addObserver = function (observer) {\n if (!this.observers.has(observer)) {\n // Immediately deliver the most recent message, so we can always\n // be sure all observers have the latest information.\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n }\n };\n Concast.prototype.removeObserver = function (observer) {\n if (this.observers.delete(observer) && this.observers.size < 1) {\n // In case there are still any listeners in this.nextResultListeners, and\n // no error or completion has been broadcast yet, make sure those\n // observers have a chance to run and then remove themselves from\n // this.observers.\n this.handlers.complete();\n }\n };\n Concast.prototype.notify = function (method, arg) {\n var nextResultListeners = this.nextResultListeners;\n if (nextResultListeners.size) {\n // Replacing this.nextResultListeners first ensures it does not grow while\n // we are iterating over it, potentially leading to infinite loops.\n this.nextResultListeners = new Set();\n nextResultListeners.forEach(function (listener) { return listener(method, arg); });\n }\n };\n // We need a way to run callbacks just *before* the next result (or error or\n // completion) is delivered by this Concast, so we can be sure any code that\n // runs as a result of delivering that result/error observes the effects of\n // running the callback(s). It was tempting to reuse the Observer type instead\n // of introducing NextResultListener, but that messes with the sizing and\n // maintenance of this.observers, and ends up being more code overall.\n Concast.prototype.beforeNext = function (callback) {\n var called = false;\n this.nextResultListeners.add(function (method, arg) {\n if (!called) {\n called = true;\n callback(method, arg);\n }\n });\n };\n return Concast;\n}(Observable));\nexport { Concast };\n// Necessary because the Concast constructor has a different signature\n// than the Observable constructor.\nfixObservableSubclass(Concast);\n//# sourceMappingURL=Concast.js.map","import { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\nexport function isExecutionPatchIncrementalResult(value) {\n return \"incremental\" in value;\n}\nexport function isExecutionPatchInitialResult(value) {\n return \"hasNext\" in value && \"data\" in value;\n}\nexport function isExecutionPatchResult(value) {\n return (isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value));\n}\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(value) {\n return isNonNullObject(value) && \"payload\" in value;\n}\nexport function mergeIncrementalData(prevResult, result) {\n var mergedData = prevResult;\n var merger = new DeepMerger();\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (_a) {\n var data = _a.data, path = _a.path;\n for (var i = path.length - 1; i >= 0; --i) {\n var key = path[i];\n var isNumericKey = !isNaN(+key);\n var parent_1 = isNumericKey ? [] : {};\n parent_1[key] = data;\n data = parent_1;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData;\n}\n//# sourceMappingURL=incrementalResult.js.map","import { isNonEmptyArray } from \"./arrays.js\";\nimport { isExecutionPatchIncrementalResult } from \"./incrementalResult.js\";\nexport function graphQLResultHasError(result) {\n var errors = getGraphQLErrorsFromResult(result);\n return isNonEmptyArray(errors);\n}\nexport function getGraphQLErrorsFromResult(result) {\n var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (incrementalResult) {\n if (incrementalResult.errors) {\n graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);\n }\n });\n }\n return graphQLErrors;\n}\n//# sourceMappingURL=errorHandling.js.map","/**\n * Merges the provided objects shallowly and removes\n * all properties with an `undefined` value\n */\nexport function compact() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n var result = Object.create(null);\n objects.forEach(function (obj) {\n if (!obj)\n return;\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n if (value !== void 0) {\n result[key] = value;\n }\n });\n });\n return result;\n}\n//# sourceMappingURL=compact.js.map","import { __assign } from \"tslib\";\nimport { compact } from \"./compact.js\";\nexport function mergeOptions(defaults, options) {\n return compact(defaults, options, options.variables && {\n variables: compact(__assign(__assign({}, (defaults && defaults.variables)), options.variables)),\n });\n}\n//# sourceMappingURL=mergeOptions.js.map","import { Observable } from \"../../utilities/index.js\";\nexport function fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\n//# sourceMappingURL=fromError.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nexport function toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n globalThis.__DEV__ !== false && invariant.warn(42);\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n//# sourceMappingURL=toPromise.js.map","import { Observable } from \"../../utilities/index.js\";\nexport function fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n//# sourceMappingURL=fromPromise.js.map","export var throwServerError = function (response, result, message) {\n var error = new Error(message);\n error.name = \"ServerError\";\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n//# sourceMappingURL=throwServerError.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport function validateOperation(operation) {\n var OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(43, key);\n }\n }\n return operation;\n}\n//# sourceMappingURL=validateOperation.js.map","import { __assign } from \"tslib\";\nexport function createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === \"function\") {\n context = __assign(__assign({}, context), next(context));\n }\n else {\n context = __assign(__assign({}, context), next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, \"setContext\", {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, \"getContext\", {\n enumerable: false,\n value: getContext,\n });\n return operation;\n}\n//# sourceMappingURL=createOperation.js.map","import { getOperationName } from \"../../utilities/index.js\";\nexport function transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n // Best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== \"string\" ?\n getOperationName(transformedOperation.query) || undefined\n : \"\";\n }\n return transformedOperation;\n}\n//# sourceMappingURL=transformOperation.js.map","import { __assign } from \"tslib\";\nimport { visit } from \"graphql\";\nexport function filterOperationVariables(variables, query) {\n var result = __assign({}, variables);\n var unusedNames = new Set(Object.keys(variables));\n visit(query, {\n Variable: function (node, _key, parent) {\n // A variable type definition at the top level of a query is not\n // enough to silence server-side errors about the variable being\n // unused, so variable definitions do not count as usage.\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n if (parent &&\n parent.kind !== \"VariableDefinition\") {\n unusedNames.delete(node.name.value);\n }\n },\n });\n unusedNames.forEach(function (name) {\n delete result[name];\n });\n return result;\n}\n//# sourceMappingURL=filterOperationVariables.js.map","import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { validateOperation, createOperation, transformOperation, } from \"../utils/index.js\";\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar ApolloLink = /** @class */ (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n var ret;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink(function (operation) {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n globalThis.__DEV__ !== false && invariant.warn(35, firstLink);\n return firstLink;\n }\n var nextLink = toLink(second);\n var ret;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw newInvariantError(36);\n };\n ApolloLink.prototype.onError = function (error, observer) {\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n };\n ApolloLink.prototype.setOnError = function (fn) {\n this.onError = fn;\n return this;\n };\n return ApolloLink;\n}());\nexport { ApolloLink };\n//# sourceMappingURL=ApolloLink.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var empty = ApolloLink.empty;\n//# sourceMappingURL=empty.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var from = ApolloLink.from;\n//# sourceMappingURL=from.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var split = ApolloLink.split;\n//# sourceMappingURL=split.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var concat = ApolloLink.concat;\n//# sourceMappingURL=concat.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var execute = ApolloLink.execute;\n//# sourceMappingURL=execute.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts\n */\nexport default function asyncIterator(source) {\n var _a;\n var iterator = source[Symbol.asyncIterator]();\n return _a = {\n next: function () {\n return iterator.next();\n }\n },\n _a[Symbol.asyncIterator] = function () {\n return this;\n },\n _a;\n}\n//# sourceMappingURL=async.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function nodeStreamIterator(stream) {\n var cleanup = null;\n var error = null;\n var done = false;\n var data = [];\n var waiting = [];\n function onData(chunk) {\n if (error)\n return;\n if (waiting.length) {\n var shiftedArr = waiting.shift();\n if (Array.isArray(shiftedArr) && shiftedArr[0]) {\n return shiftedArr[0]({ value: chunk, done: false });\n }\n }\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n cleanup = function () {\n cleanup = null;\n stream.removeListener(\"data\", onData);\n stream.removeListener(\"error\", onError);\n stream.removeListener(\"end\", onEnd);\n stream.removeListener(\"finish\", onEnd);\n stream.removeListener(\"close\", onEnd);\n };\n stream.on(\"data\", onData);\n stream.on(\"error\", onError);\n stream.on(\"end\", onEnd);\n stream.on(\"finish\", onEnd);\n stream.on(\"close\", onEnd);\n function getNext() {\n return new Promise(function (resolve, reject) {\n if (error)\n return reject(error);\n if (data.length)\n return resolve({ value: data.shift(), done: false });\n if (done)\n return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n var iterator = {\n next: function () {\n return getNext();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=nodeStream.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function promiseIterator(promise) {\n var resolved = false;\n var iterator = {\n next: function () {\n if (resolved)\n return Promise.resolve({\n value: undefined,\n done: true,\n });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value: value, done: false });\n })\n .catch(reject);\n });\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=promise.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function readerIterator(reader) {\n var iterator = {\n next: function () {\n return reader.read();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=reader.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../utilities/index.js\";\nimport asyncIterator from \"./iterators/async.js\";\nimport nodeStreamIterator from \"./iterators/nodeStream.js\";\nimport promiseIterator from \"./iterators/promise.js\";\nimport readerIterator from \"./iterators/reader.js\";\nfunction isNodeResponse(value) {\n return !!value.body;\n}\nfunction isReadableStream(value) {\n return !!value.getReader;\n}\nfunction isAsyncIterableIterator(value) {\n return !!(canUseAsyncIteratorSymbol &&\n value[Symbol.asyncIterator]);\n}\nfunction isStreamableBlob(value) {\n return !!value.stream;\n}\nfunction isBlob(value) {\n return !!value.arrayBuffer;\n}\nfunction isNodeReadableStream(value) {\n return !!value.pipe;\n}\nexport function responseIterator(response) {\n var body = response;\n if (isNodeResponse(response))\n body = response.body;\n if (isAsyncIterableIterator(body))\n return asyncIterator(body);\n if (isReadableStream(body))\n return readerIterator(body.getReader());\n // this errors without casting to ReadableStream\n // because Blob.stream() returns a NodeJS ReadableStream\n if (isStreamableBlob(body)) {\n return readerIterator(body.stream().getReader());\n }\n if (isBlob(body))\n return promiseIterator(body.arrayBuffer());\n if (isNodeReadableStream(body))\n return nodeStreamIterator(body);\n throw new Error(\"Unknown body type for responseIterator. Please pass a streamable response.\");\n}\n//# sourceMappingURL=responseIterator.js.map","import { __extends, __spreadArray } from \"tslib\";\nimport \"../utilities/globals/index.js\";\nimport { isNonNullObject } from \"../utilities/index.js\";\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport var PROTOCOL_ERRORS_SYMBOL = Symbol();\nexport function graphQLResultHasProtocolErrors(result) {\n if (result.extensions) {\n return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]);\n }\n return false;\n}\nexport function isApolloError(err) {\n return err.hasOwnProperty(\"graphQLErrors\");\n}\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nvar generateErrorMessage = function (err) {\n var errors = __spreadArray(__spreadArray(__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true);\n if (err.networkError)\n errors.push(err.networkError);\n return (errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(function (err) {\n return (isNonNullObject(err) && err.message) || \"Error message not found.\";\n })\n .join(\"\\n\"));\n};\nvar ApolloError = /** @class */ (function (_super) {\n __extends(ApolloError, _super);\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n function ApolloError(_a) {\n var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo;\n var _this = _super.call(this, errorMessage) || this;\n _this.name = \"ApolloError\";\n _this.graphQLErrors = graphQLErrors || [];\n _this.protocolErrors = protocolErrors || [];\n _this.clientErrors = clientErrors || [];\n _this.networkError = networkError || null;\n _this.message = errorMessage || generateErrorMessage(_this);\n _this.extraInfo = extraInfo;\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n _this.__proto__ = ApolloError.prototype;\n return _this;\n }\n return ApolloError;\n}(Error));\nexport { ApolloError };\n//# sourceMappingURL=index.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { responseIterator } from \"./responseIterator.js\";\nimport { throwServerError } from \"../utils/index.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../../errors/index.js\";\nimport { isApolloPayloadResult } from \"../../utilities/common/incrementalResult.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function readMultipartBody(response, nextValue) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n if (TextDecoder === undefined) {\n throw new Error(\"TextDecoder must be defined in the environment: please import a polyfill.\");\n }\n decoder = new TextDecoder(\"utf-8\");\n contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n delimiter = \"boundary=\";\n boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?\n contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['\"]/g, \"\").replace(/\\;(.*)/gm, \"\").trim()\n : \"-\";\n boundary = \"\\r\\n--\".concat(boundaryVal);\n buffer = \"\";\n iterator = responseIterator(response);\n running = true;\n _e.label = 1;\n case 1:\n if (!running) return [3 /*break*/, 3];\n return [4 /*yield*/, iterator.next()];\n case 2:\n _b = _e.sent(), value = _b.value, done = _b.done;\n chunk = typeof value === \"string\" ? value : decoder.decode(value);\n searchFrom = buffer.length - boundary.length + 1;\n running = !done;\n buffer += chunk;\n bi = buffer.indexOf(boundary, searchFrom);\n while (bi > -1) {\n message = void 0;\n _c = [\n buffer.slice(0, bi),\n buffer.slice(bi + boundary.length),\n ], message = _c[0], buffer = _c[1];\n i = message.indexOf(\"\\r\\n\\r\\n\");\n headers = parseHeaders(message.slice(0, i));\n contentType_1 = headers[\"content-type\"];\n if (contentType_1 &&\n contentType_1.toLowerCase().indexOf(\"application/json\") === -1) {\n throw new Error(\"Unsupported patch content type: application/json is required.\");\n }\n body = message.slice(i);\n if (body) {\n result = parseJsonBody(response, body);\n if (Object.keys(result).length > 1 ||\n \"data\" in result ||\n \"incremental\" in result ||\n \"errors\" in result ||\n \"payload\" in result) {\n if (isApolloPayloadResult(result)) {\n next = {};\n if (\"payload\" in result) {\n next = __assign({}, result.payload);\n }\n if (\"errors\" in result) {\n next = __assign(__assign({}, next), { extensions: __assign(__assign({}, (\"extensions\" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });\n }\n nextValue(next);\n }\n else {\n // for the last chunk with only `hasNext: false`\n // we don't need to call observer.next as there is no data/errors\n nextValue(result);\n }\n }\n else if (\n // If the chunk contains only a \"hasNext: false\", we can call\n // observer.complete() immediately.\n Object.keys(result).length === 1 &&\n \"hasNext\" in result &&\n !result.hasNext) {\n return [2 /*return*/];\n }\n }\n bi = buffer.indexOf(boundary);\n }\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/];\n }\n });\n });\n}\nexport function parseHeaders(headerText) {\n var headersInit = {};\n headerText.split(\"\\n\").forEach(function (line) {\n var i = line.indexOf(\":\");\n if (i > -1) {\n // normalize headers to lowercase\n var name_1 = line.slice(0, i).trim().toLowerCase();\n var value = line.slice(i + 1).trim();\n headersInit[name_1] = value;\n }\n });\n return headersInit;\n}\nexport function parseJsonBody(response, bodyText) {\n if (response.status >= 300) {\n // Network error\n var getResult = function () {\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n return bodyText;\n }\n };\n throwServerError(response, getResult(), \"Response not successful: Received status code \".concat(response.status));\n }\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n var parseError = err;\n parseError.name = \"ServerParseError\";\n parseError.response = response;\n parseError.statusCode = response.status;\n parseError.bodyText = bodyText;\n throw parseError;\n }\n}\nexport function handleError(err, observer) {\n // if it is a network error, BUT there is graphql result info fire\n // the next observer before calling error this gives apollo-client\n // (and react-apollo) the `graphqlErrors` and `networkErrors` to\n // pass to UI this should only happen if we *also* have data as\n // part of the response key per the spec\n if (err.result && err.result.errors && err.result.data) {\n // if we don't call next, the UI can only show networkError\n // because AC didn't get any graphqlErrors this is graphql\n // execution result info (i.e errors and possibly data) this is\n // because there is no formal spec how errors should translate to\n // http status codes. So an auth error (401) could have both data\n // from a public field, errors from a private field, and a status\n // of 401\n // {\n // user { // this will have errors\n // firstName\n // }\n // products { // this is public so will have data\n // cost\n // }\n // }\n //\n // the result of above *could* look like this:\n // {\n // data: { products: [{ cost: \"$10\" }] },\n // errors: [{\n // message: 'your session has timed out',\n // path: []\n // }]\n // }\n // status code of above would be a 401\n // in the UI you want to show data where you can, errors as data where you can\n // and use correct http status codes\n observer.next(err.result);\n }\n observer.error(err);\n}\nexport function parseAndCheckHttpResponse(operations) {\n return function (response) {\n return response\n .text()\n .then(function (bodyText) { return parseJsonBody(response, bodyText); })\n .then(function (result) {\n if (!Array.isArray(result) &&\n !hasOwnProperty.call(result, \"data\") &&\n !hasOwnProperty.call(result, \"errors\")) {\n // Data error\n throwServerError(response, result, \"Server response was missing for query '\".concat(Array.isArray(operations) ?\n operations.map(function (op) { return op.operationName; })\n : operations.operationName, \"'.\"));\n }\n return result;\n });\n };\n}\n//# sourceMappingURL=parseAndCheckHttpResponse.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport var serializeFetchParameter = function (p, label) {\n var serialized;\n try {\n serialized = JSON.stringify(p);\n }\n catch (e) {\n var parseError = newInvariantError(39, label, e.message);\n parseError.parseError = e;\n throw parseError;\n }\n return serialized;\n};\n//# sourceMappingURL=serializeFetchParameter.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { print } from \"../../utilities/index.js\";\nvar defaultHttpOptions = {\n includeQuery: true,\n includeExtensions: false,\n preserveHeaderCase: false,\n};\nvar defaultHeaders = {\n // headers are case insensitive (https://stackoverflow.com/a/5259004)\n accept: \"*/*\",\n // The content-type header describes the type of the body of the request, and\n // so it typically only is sent with requests that actually have bodies. One\n // could imagine that Apollo Client would remove this header when constructing\n // a GET request (which has no body), but we historically have not done that.\n // This means that browsers will preflight all Apollo Client requests (even\n // GET requests). Apollo Server's CSRF prevention feature (introduced in\n // AS3.7) takes advantage of this fact and does not block requests with this\n // header. If you want to drop this header from GET requests, then you should\n // probably replace it with a `apollo-require-preflight` header, or servers\n // with CSRF prevention enabled might block your GET request. See\n // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf\n // for more details.\n \"content-type\": \"application/json\",\n};\nvar defaultOptions = {\n method: \"POST\",\n};\nexport var fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\nexport var defaultPrinter = function (ast, printer) { return printer(ast); };\nexport function selectHttpOptionsAndBody(operation, fallbackConfig) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal.apply(void 0, __spreadArray([operation,\n defaultPrinter], configs, false));\n}\nexport function selectHttpOptionsAndBodyInternal(operation, printer) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n var options = {};\n var http = {};\n configs.forEach(function (config) {\n options = __assign(__assign(__assign({}, options), config.options), { headers: __assign(__assign({}, options.headers), config.headers) });\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n http = __assign(__assign({}, http), config.http);\n });\n if (options.headers) {\n options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);\n }\n //The body depends on the http options\n var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;\n var body = { operationName: operationName, variables: variables };\n if (http.includeExtensions)\n body.extensions = extensions;\n // not sending the query (i.e persisted queries)\n if (http.includeQuery)\n body.query = printer(query, print);\n return {\n options: options,\n body: body,\n };\n}\n// Remove potential duplicate header names, preserving last (by insertion order).\n// This is done to prevent unintentionally duplicating a header instead of\n// overwriting it (See #8447 and #8449).\nfunction removeDuplicateHeaders(headers, preserveHeaderCase) {\n // If we're not preserving the case, just remove duplicates w/ normalization.\n if (!preserveHeaderCase) {\n var normalizedHeaders_1 = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n normalizedHeaders_1[name.toLowerCase()] = headers[name];\n });\n return normalizedHeaders_1;\n }\n // If we are preserving the case, remove duplicates w/ normalization,\n // preserving the original name.\n // This allows for non-http-spec-compliant servers that expect intentionally\n // capitalized header names (See #6741).\n var headerData = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n headerData[name.toLowerCase()] = {\n originalName: name,\n value: headers[name],\n };\n });\n var normalizedHeaders = Object.create(null);\n Object.keys(headerData).forEach(function (name) {\n normalizedHeaders[headerData[name].originalName] = headerData[name].value;\n });\n return normalizedHeaders;\n}\n//# sourceMappingURL=selectHttpOptionsAndBody.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport var checkFetcher = function (fetcher) {\n if (!fetcher && typeof fetch === \"undefined\") {\n throw newInvariantError(37);\n }\n};\n//# sourceMappingURL=checkFetcher.js.map","/**\n * @deprecated\n * This is not used internally any more and will be removed in\n * the next major version of Apollo Client.\n */\nexport var createSignalIfSupported = function () {\n if (typeof AbortController === \"undefined\")\n return { controller: false, signal: false };\n var controller = new AbortController();\n var signal = controller.signal;\n return { controller: controller, signal: signal };\n};\n//# sourceMappingURL=createSignalIfSupported.js.map","export var selectURI = function (operation, fallbackURI) {\n var context = operation.getContext();\n var contextURI = context.uri;\n if (contextURI) {\n return contextURI;\n }\n else if (typeof fallbackURI === \"function\") {\n return fallbackURI(operation);\n }\n else {\n return fallbackURI || \"/graphql\";\n }\n};\n//# sourceMappingURL=selectURI.js.map","import { serializeFetchParameter } from \"./serializeFetchParameter.js\";\n// For GET operations, returns the given URI rewritten with parameters, or a\n// parse error.\nexport function rewriteURIForGET(chosenURI, body) {\n // Implement the standard HTTP GET serialization, plus 'extensions'. Note\n // the extra level of JSON serialization!\n var queryParams = [];\n var addQueryParam = function (key, value) {\n queryParams.push(\"\".concat(key, \"=\").concat(encodeURIComponent(value)));\n };\n if (\"query\" in body) {\n addQueryParam(\"query\", body.query);\n }\n if (body.operationName) {\n addQueryParam(\"operationName\", body.operationName);\n }\n if (body.variables) {\n var serializedVariables = void 0;\n try {\n serializedVariables = serializeFetchParameter(body.variables, \"Variables map\");\n }\n catch (parseError) {\n return { parseError: parseError };\n }\n addQueryParam(\"variables\", serializedVariables);\n }\n if (body.extensions) {\n var serializedExtensions = void 0;\n try {\n serializedExtensions = serializeFetchParameter(body.extensions, \"Extensions map\");\n }\n catch (parseError) {\n return { parseError: parseError };\n }\n addQueryParam(\"extensions\", serializedExtensions);\n }\n // Reconstruct the URI with added query params.\n // XXX This assumes that the URI is well-formed and that it doesn't\n // already contain any of these query params. We could instead use the\n // URL API and take a polyfill (whatwg-url@6) for older browsers that\n // don't support URLSearchParams. Note that some browsers (and\n // versions of whatwg-url) support URL but not URLSearchParams!\n var fragment = \"\", preFragment = chosenURI;\n var fragmentStart = chosenURI.indexOf(\"#\");\n if (fragmentStart !== -1) {\n fragment = chosenURI.substr(fragmentStart);\n preFragment = chosenURI.substr(0, fragmentStart);\n }\n var queryParamsPrefix = preFragment.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n var newURI = preFragment + queryParamsPrefix + queryParams.join(\"&\") + fragment;\n return { newURI: newURI };\n}\n//# sourceMappingURL=rewriteURIForGET.js.map","import { __assign, __rest } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable, hasDirectives } from \"../../utilities/index.js\";\nimport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nimport { selectURI } from \"./selectURI.js\";\nimport { handleError, readMultipartBody, parseAndCheckHttpResponse, } from \"./parseAndCheckHttpResponse.js\";\nimport { checkFetcher } from \"./checkFetcher.js\";\nimport { selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig, } from \"./selectHttpOptionsAndBody.js\";\nimport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\nimport { fromError, filterOperationVariables } from \"../utils/index.js\";\nimport { maybe, getMainDefinition, removeClientSetsFromDocument, } from \"../../utilities/index.js\";\nvar backupFetch = maybe(function () { return fetch; });\nexport var createHttpLink = function (linkOptions) {\n if (linkOptions === void 0) { linkOptions = {}; }\n var _a = linkOptions.uri, uri = _a === void 0 ? \"/graphql\" : _a, \n // use default global fetch if nothing passed in\n preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = __rest(linkOptions, [\"uri\", \"fetch\", \"print\", \"includeExtensions\", \"preserveHeaderCase\", \"useGETForQueries\", \"includeUnusedVariables\"]);\n if (globalThis.__DEV__ !== false) {\n // Make sure at least one of preferredFetch, window.fetch, or backupFetch is\n // defined, so requests won't fail at runtime.\n checkFetcher(preferredFetch || backupFetch);\n }\n var linkConfig = {\n http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase },\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n return new ApolloLink(function (operation) {\n var chosenURI = selectURI(operation, uri);\n var context = operation.getContext();\n // `apollographql-client-*` headers are automatically set if a\n // `clientAwareness` object is found in the context. These headers are\n // set first, followed by the rest of the headers pulled from\n // `context.headers`. If desired, `apollographql-client-*` headers set by\n // the `clientAwareness` object can be overridden by\n // `apollographql-client-*` headers set in `context.headers`.\n var clientAwarenessHeaders = {};\n if (context.clientAwareness) {\n var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;\n if (name_1) {\n clientAwarenessHeaders[\"apollographql-client-name\"] = name_1;\n }\n if (version) {\n clientAwarenessHeaders[\"apollographql-client-version\"] = version;\n }\n }\n var contextHeaders = __assign(__assign({}, clientAwarenessHeaders), context.headers);\n var contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: contextHeaders,\n };\n if (hasDirectives([\"client\"], operation.query)) {\n var transformedQuery = removeClientSetsFromDocument(operation.query);\n if (!transformedQuery) {\n return fromError(new Error(\"HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.\"));\n }\n operation.query = transformedQuery;\n }\n //uses fallback, link, and then context to build options\n var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;\n if (body.variables && !includeUnusedVariables) {\n body.variables = filterOperationVariables(body.variables, operation.query);\n }\n var controller;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n // If requested, set method to GET if there are no mutations.\n var definitionIsMutation = function (d) {\n return d.kind === \"OperationDefinition\" && d.operation === \"mutation\";\n };\n var definitionIsSubscription = function (d) {\n return d.kind === \"OperationDefinition\" && d.operation === \"subscription\";\n };\n var isSubscription = definitionIsSubscription(getMainDefinition(operation.query));\n // does not match custom directives beginning with @defer\n var hasDefer = hasDirectives([\"defer\"], operation.query);\n if (useGETForQueries &&\n !operation.query.definitions.some(definitionIsMutation)) {\n options.method = \"GET\";\n }\n if (hasDefer || isSubscription) {\n options.headers = options.headers || {};\n var acceptHeader = \"multipart/mixed;\";\n // Omit defer-specific headers if the user attempts to defer a selection\n // set on a subscription and log a warning.\n if (isSubscription && hasDefer) {\n globalThis.__DEV__ !== false && invariant.warn(38);\n }\n if (isSubscription) {\n acceptHeader +=\n \"boundary=graphql;subscriptionSpec=1.0,application/json\";\n }\n else if (hasDefer) {\n acceptHeader += \"deferSpec=20220824,application/json\";\n }\n options.headers.accept = acceptHeader;\n }\n if (options.method === \"GET\") {\n var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError;\n if (parseError) {\n return fromError(parseError);\n }\n chosenURI = newURI;\n }\n else {\n try {\n options.body = serializeFetchParameter(body, \"Payload\");\n }\n catch (parseError) {\n return fromError(parseError);\n }\n }\n return new Observable(function (observer) {\n // Prefer linkOptions.fetch (preferredFetch) if provided, and otherwise\n // fall back to the *current* global window.fetch function (see issue\n // #7832), or (if all else fails) the backupFetch function we saved when\n // this module was first evaluated. This last option protects against the\n // removal of window.fetch, which is unlikely but not impossible.\n var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch;\n var observerNext = observer.next.bind(observer);\n currentFetch(chosenURI, options)\n .then(function (response) {\n var _a;\n operation.setContext({ response: response });\n var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n }\n else {\n return parseAndCheckHttpResponse(operation)(response).then(observerNext);\n }\n })\n .then(function () {\n controller = undefined;\n observer.complete();\n })\n .catch(function (err) {\n controller = undefined;\n handleError(err, observer);\n });\n return function () {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller)\n controller.abort();\n };\n });\n });\n};\n//# sourceMappingURL=createHttpLink.js.map","import { __extends } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { createHttpLink } from \"./createHttpLink.js\";\nvar HttpLink = /** @class */ (function (_super) {\n __extends(HttpLink, _super);\n function HttpLink(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, createHttpLink(options).request) || this;\n _this.options = options;\n return _this;\n }\n return HttpLink;\n}(ApolloLink));\nexport { HttpLink };\n//# sourceMappingURL=HttpLink.js.map","import { __assign, __rest } from \"tslib\";\nimport { wrap } from \"optimism\";\nimport { cacheSizes, getFragmentQueryDocument, } from \"../../utilities/index.js\";\nimport { WeakCache } from \"@wry/caches\";\nimport { getApolloCacheMemoryInternals } from \"../../utilities/caching/getMemoryInternals.js\";\nvar ApolloCache = /** @class */ (function () {\n function ApolloCache() {\n this.assumeImmutableResults = false;\n // Make sure we compute the same (===) fragment query document every\n // time we receive the same fragment in readFragment.\n this.getFragmentDoc = wrap(getFragmentQueryDocument, {\n max: cacheSizes[\"cache.fragmentQueryDocuments\"] ||\n 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n cache: WeakCache,\n });\n }\n // Transactional API\n // The batch method is intended to replace/subsume both performTransaction\n // and recordOptimisticTransaction, but performTransaction came first, so we\n // provide a default batch implementation that's just another way of calling\n // performTransaction. Subclasses of ApolloCache (such as InMemoryCache) can\n // override the batch method to do more interesting things with its options.\n ApolloCache.prototype.batch = function (options) {\n var _this = this;\n var optimisticId = typeof options.optimistic === \"string\" ? options.optimistic\n : options.optimistic === false ? null\n : void 0;\n var updateResult;\n this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId);\n return updateResult;\n };\n ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) {\n this.performTransaction(transaction, optimisticId);\n };\n // Optional API\n // Called once per input document, allowing the cache to make static changes\n // to the query, such as adding __typename fields.\n ApolloCache.prototype.transformDocument = function (document) {\n return document;\n };\n // Called before each ApolloLink request, allowing the cache to make dynamic\n // changes to the query, such as filling in missing fragment definitions.\n ApolloCache.prototype.transformForLink = function (document) {\n return document;\n };\n ApolloCache.prototype.identify = function (object) {\n return;\n };\n ApolloCache.prototype.gc = function () {\n return [];\n };\n ApolloCache.prototype.modify = function (options) {\n return false;\n };\n // DataProxy API\n ApolloCache.prototype.readQuery = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = !!options.optimistic; }\n return this.read(__assign(__assign({}, options), { rootId: options.id || \"ROOT_QUERY\", optimistic: optimistic }));\n };\n ApolloCache.prototype.readFragment = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = !!options.optimistic; }\n return this.read(__assign(__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic }));\n };\n ApolloCache.prototype.writeQuery = function (_a) {\n var id = _a.id, data = _a.data, options = __rest(_a, [\"id\", \"data\"]);\n return this.write(Object.assign(options, {\n dataId: id || \"ROOT_QUERY\",\n result: data,\n }));\n };\n ApolloCache.prototype.writeFragment = function (_a) {\n var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = __rest(_a, [\"id\", \"data\", \"fragment\", \"fragmentName\"]);\n return this.write(Object.assign(options, {\n query: this.getFragmentDoc(fragment, fragmentName),\n dataId: id,\n result: data,\n }));\n };\n ApolloCache.prototype.updateQuery = function (options, update) {\n return this.batch({\n update: function (cache) {\n var value = cache.readQuery(options);\n var data = update(value);\n if (data === void 0 || data === null)\n return value;\n cache.writeQuery(__assign(__assign({}, options), { data: data }));\n return data;\n },\n });\n };\n ApolloCache.prototype.updateFragment = function (options, update) {\n return this.batch({\n update: function (cache) {\n var value = cache.readFragment(options);\n var data = update(value);\n if (data === void 0 || data === null)\n return value;\n cache.writeFragment(__assign(__assign({}, options), { data: data }));\n return data;\n },\n });\n };\n return ApolloCache;\n}());\nexport { ApolloCache };\nif (globalThis.__DEV__ !== false) {\n ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals;\n}\n//# sourceMappingURL=cache.js.map","export var Cache;\n(function (Cache) {\n})(Cache || (Cache = {}));\n//# sourceMappingURL=Cache.js.map","import { __extends } from \"tslib\";\nvar MissingFieldError = /** @class */ (function (_super) {\n __extends(MissingFieldError, _super);\n function MissingFieldError(message, path, query, variables) {\n var _a;\n // 'Error' breaks prototype chain here\n var _this = _super.call(this, message) || this;\n _this.message = message;\n _this.path = path;\n _this.query = query;\n _this.variables = variables;\n if (Array.isArray(_this.path)) {\n _this.missing = _this.message;\n for (var i = _this.path.length - 1; i >= 0; --i) {\n _this.missing = (_a = {}, _a[_this.path[i]] = _this.missing, _a);\n }\n }\n else {\n _this.missing = _this.path;\n }\n // We're not using `Object.setPrototypeOf` here as it isn't fully supported\n // on Android (see issue #3236).\n _this.__proto__ = MissingFieldError.prototype;\n return _this;\n }\n return MissingFieldError;\n}(Error));\nexport { MissingFieldError };\n//# sourceMappingURL=common.js.map","import { isReference, isField, DeepMerger, resultKeyNameFromField, shouldInclude, isNonNullObject, compact, createFragmentMap, getFragmentDefinitions, isArray, } from \"../../utilities/index.js\";\nexport var hasOwn = Object.prototype.hasOwnProperty;\nexport function isNullish(value) {\n return value === null || value === void 0;\n}\nexport { isArray };\nexport function defaultDataIdFromObject(_a, context) {\n var __typename = _a.__typename, id = _a.id, _id = _a._id;\n if (typeof __typename === \"string\") {\n if (context) {\n context.keyObject =\n !isNullish(id) ? { id: id }\n : !isNullish(_id) ? { _id: _id }\n : void 0;\n }\n // If there is no object.id, fall back to object._id.\n if (isNullish(id) && !isNullish(_id)) {\n id = _id;\n }\n if (!isNullish(id)) {\n return \"\".concat(__typename, \":\").concat(typeof id === \"number\" || typeof id === \"string\" ?\n id\n : JSON.stringify(id));\n }\n }\n}\nvar defaultConfig = {\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n // Thanks to the shouldCanonizeResults helper, this should be the only line\n // you have to change to reenable canonization by default in the future.\n canonizeResults: false,\n};\nexport function normalizeConfig(config) {\n return compact(defaultConfig, config);\n}\nexport function shouldCanonizeResults(config) {\n var value = config.canonizeResults;\n return value === void 0 ? defaultConfig.canonizeResults : value;\n}\nexport function getTypenameFromStoreObject(store, objectOrReference) {\n return isReference(objectOrReference) ?\n store.get(objectOrReference.__ref, \"__typename\")\n : objectOrReference && objectOrReference.__typename;\n}\nexport var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;\nexport function fieldNameFromStoreName(storeFieldName) {\n var match = storeFieldName.match(TypeOrFieldNameRegExp);\n return match ? match[0] : storeFieldName;\n}\nexport function selectionSetMatchesResult(selectionSet, result, variables) {\n if (isNonNullObject(result)) {\n return isArray(result) ?\n result.every(function (item) {\n return selectionSetMatchesResult(selectionSet, item, variables);\n })\n : selectionSet.selections.every(function (field) {\n if (isField(field) && shouldInclude(field, variables)) {\n var key = resultKeyNameFromField(field);\n return (hasOwn.call(result, key) &&\n (!field.selectionSet ||\n selectionSetMatchesResult(field.selectionSet, result[key], variables)));\n }\n // If the selection has been skipped with @skip(true) or\n // @include(false), it should not count against the matching. If\n // the selection is not a field, it must be a fragment (inline or\n // named). We will determine if selectionSetMatchesResult for that\n // fragment when we get to it, so for now we return true.\n return true;\n });\n }\n return false;\n}\nexport function storeValueIsStoreObject(value) {\n return isNonNullObject(value) && !isReference(value) && !isArray(value);\n}\nexport function makeProcessedFieldsMerger() {\n return new DeepMerger();\n}\nexport function extractFragmentContext(document, fragments) {\n // FragmentMap consisting only of fragments defined directly in document, not\n // including other fragments registered in the FragmentRegistry.\n var fragmentMap = createFragmentMap(getFragmentDefinitions(document));\n return {\n fragmentMap: fragmentMap,\n lookupFragment: function (name) {\n var def = fragmentMap[name];\n if (!def && fragments) {\n def = fragments.lookup(name);\n }\n return def || null;\n },\n };\n}\n//# sourceMappingURL=helpers.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { dep } from \"optimism\";\nimport { equal } from \"@wry/equality\";\nimport { Trie } from \"@wry/trie\";\nimport { isReference, makeReference, DeepMerger, maybeDeepFreeze, canUseWeakMap, isNonNullObject, } from \"../../utilities/index.js\";\nimport { hasOwn, fieldNameFromStoreName } from \"./helpers.js\";\nvar DELETE = Object.create(null);\nvar delModifier = function () { return DELETE; };\nvar INVALIDATE = Object.create(null);\nvar EntityStore = /** @class */ (function () {\n function EntityStore(policies, group) {\n var _this = this;\n this.policies = policies;\n this.group = group;\n this.data = Object.create(null);\n // Maps root entity IDs to the number of times they have been retained, minus\n // the number of times they have been released. Retained entities keep other\n // entities they reference (even indirectly) from being garbage collected.\n this.rootIds = Object.create(null);\n // Lazily tracks { __ref: } strings contained by this.data[dataId].\n this.refs = Object.create(null);\n // Bound function that can be passed around to provide easy access to fields\n // of Reference objects as well as ordinary objects.\n this.getFieldValue = function (objectOrReference, storeFieldName) {\n return maybeDeepFreeze(isReference(objectOrReference) ?\n _this.get(objectOrReference.__ref, storeFieldName)\n : objectOrReference && objectOrReference[storeFieldName]);\n };\n // Returns true for non-normalized StoreObjects and non-dangling\n // References, indicating that readField(name, objOrRef) has a chance of\n // working. Useful for filtering out dangling references from lists.\n this.canRead = function (objOrRef) {\n return isReference(objOrRef) ?\n _this.has(objOrRef.__ref)\n : typeof objOrRef === \"object\";\n };\n // Bound function that converts an id or an object with a __typename and\n // primary key fields to a Reference object. If called with a Reference object,\n // that same Reference object is returned. Pass true for mergeIntoStore to persist\n // an object into the store.\n this.toReference = function (objOrIdOrRef, mergeIntoStore) {\n if (typeof objOrIdOrRef === \"string\") {\n return makeReference(objOrIdOrRef);\n }\n if (isReference(objOrIdOrRef)) {\n return objOrIdOrRef;\n }\n var id = _this.policies.identify(objOrIdOrRef)[0];\n if (id) {\n var ref = makeReference(id);\n if (mergeIntoStore) {\n _this.merge(id, objOrIdOrRef);\n }\n return ref;\n }\n };\n }\n // Although the EntityStore class is abstract, it contains concrete\n // implementations of the various NormalizedCache interface methods that\n // are inherited by the Root and Layer subclasses.\n EntityStore.prototype.toObject = function () {\n return __assign({}, this.data);\n };\n EntityStore.prototype.has = function (dataId) {\n return this.lookup(dataId, true) !== void 0;\n };\n EntityStore.prototype.get = function (dataId, fieldName) {\n this.group.depend(dataId, fieldName);\n if (hasOwn.call(this.data, dataId)) {\n var storeObject = this.data[dataId];\n if (storeObject && hasOwn.call(storeObject, fieldName)) {\n return storeObject[fieldName];\n }\n }\n if (fieldName === \"__typename\" &&\n hasOwn.call(this.policies.rootTypenamesById, dataId)) {\n return this.policies.rootTypenamesById[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.get(dataId, fieldName);\n }\n };\n EntityStore.prototype.lookup = function (dataId, dependOnExistence) {\n // The has method (above) calls lookup with dependOnExistence = true, so\n // that it can later be invalidated when we add or remove a StoreObject for\n // this dataId. Any consumer who cares about the contents of the StoreObject\n // should not rely on this dependency, since the contents could change\n // without the object being added or removed.\n if (dependOnExistence)\n this.group.depend(dataId, \"__exists\");\n if (hasOwn.call(this.data, dataId)) {\n return this.data[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.lookup(dataId, dependOnExistence);\n }\n if (this.policies.rootTypenamesById[dataId]) {\n return Object.create(null);\n }\n };\n EntityStore.prototype.merge = function (older, newer) {\n var _this = this;\n var dataId;\n // Convert unexpected references to ID strings.\n if (isReference(older))\n older = older.__ref;\n if (isReference(newer))\n newer = newer.__ref;\n var existing = typeof older === \"string\" ? this.lookup((dataId = older)) : older;\n var incoming = typeof newer === \"string\" ? this.lookup((dataId = newer)) : newer;\n // If newer was a string ID, but that ID was not defined in this store,\n // then there are no fields to be merged, so we're done.\n if (!incoming)\n return;\n invariant(typeof dataId === \"string\", 1);\n var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);\n // Even if merged === existing, existing may have come from a lower\n // layer, so we always need to set this.data[dataId] on this level.\n this.data[dataId] = merged;\n if (merged !== existing) {\n delete this.refs[dataId];\n if (this.group.caching) {\n var fieldsToDirty_1 = Object.create(null);\n // If we added a new StoreObject where there was previously none, dirty\n // anything that depended on the existence of this dataId, such as the\n // EntityStore#has method.\n if (!existing)\n fieldsToDirty_1.__exists = 1;\n // Now invalidate dependents who called getFieldValue for any fields\n // that are changing as a result of this merge.\n Object.keys(incoming).forEach(function (storeFieldName) {\n if (!existing ||\n existing[storeFieldName] !== merged[storeFieldName]) {\n // Always dirty the full storeFieldName, which may include\n // serialized arguments following the fieldName prefix.\n fieldsToDirty_1[storeFieldName] = 1;\n // Also dirty fieldNameFromStoreName(storeFieldName) if it's\n // different from storeFieldName and this field does not have\n // keyArgs configured, because that means the cache can't make\n // any assumptions about how field values with the same field\n // name but different arguments might be interrelated, so it\n // must err on the side of invalidating all field values that\n // share the same short fieldName, regardless of arguments.\n var fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName &&\n !_this.policies.hasKeyArgs(merged.__typename, fieldName)) {\n fieldsToDirty_1[fieldName] = 1;\n }\n // If merged[storeFieldName] has become undefined, and this is the\n // Root layer, actually delete the property from the merged object,\n // which is guaranteed to have been created fresh in this method.\n if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) {\n delete merged[storeFieldName];\n }\n }\n });\n if (fieldsToDirty_1.__typename &&\n !(existing && existing.__typename) &&\n // Since we return default root __typename strings\n // automatically from store.get, we don't need to dirty the\n // ROOT_QUERY.__typename field if merged.__typename is equal\n // to the default string (usually \"Query\").\n this.policies.rootTypenamesById[dataId] === merged.__typename) {\n delete fieldsToDirty_1.__typename;\n }\n Object.keys(fieldsToDirty_1).forEach(function (fieldName) {\n return _this.group.dirty(dataId, fieldName);\n });\n }\n }\n };\n EntityStore.prototype.modify = function (dataId, fields) {\n var _this = this;\n var storeObject = this.lookup(dataId);\n if (storeObject) {\n var changedFields_1 = Object.create(null);\n var needToMerge_1 = false;\n var allDeleted_1 = true;\n var sharedDetails_1 = {\n DELETE: DELETE,\n INVALIDATE: INVALIDATE,\n isReference: isReference,\n toReference: this.toReference,\n canRead: this.canRead,\n readField: function (fieldNameOrOptions, from) {\n return _this.policies.readField(typeof fieldNameOrOptions === \"string\" ?\n {\n fieldName: fieldNameOrOptions,\n from: from || makeReference(dataId),\n }\n : fieldNameOrOptions, { store: _this });\n },\n };\n Object.keys(storeObject).forEach(function (storeFieldName) {\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var fieldValue = storeObject[storeFieldName];\n if (fieldValue === void 0)\n return;\n var modify = typeof fields === \"function\" ? fields : (fields[storeFieldName] || fields[fieldName]);\n if (modify) {\n var newValue = modify === delModifier ? DELETE : (modify(maybeDeepFreeze(fieldValue), __assign(__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })));\n if (newValue === INVALIDATE) {\n _this.group.dirty(dataId, storeFieldName);\n }\n else {\n if (newValue === DELETE)\n newValue = void 0;\n if (newValue !== fieldValue) {\n changedFields_1[storeFieldName] = newValue;\n needToMerge_1 = true;\n fieldValue = newValue;\n if (globalThis.__DEV__ !== false) {\n var checkReference = function (ref) {\n if (_this.lookup(ref.__ref) === undefined) {\n globalThis.__DEV__ !== false && invariant.warn(2, ref);\n return true;\n }\n };\n if (isReference(newValue)) {\n checkReference(newValue);\n }\n else if (Array.isArray(newValue)) {\n // Warn about writing \"mixed\" arrays of Reference and non-Reference objects\n var seenReference = false;\n var someNonReference = void 0;\n for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) {\n var value = newValue_1[_i];\n if (isReference(value)) {\n seenReference = true;\n if (checkReference(value))\n break;\n }\n else {\n // Do not warn on primitive values, since those could never be represented\n // by a reference. This is a valid (albeit uncommon) use case.\n if (typeof value === \"object\" && !!value) {\n var id = _this.policies.identify(value)[0];\n // check if object could even be referenced, otherwise we are not interested in it for this warning\n if (id) {\n someNonReference = value;\n }\n }\n }\n if (seenReference && someNonReference !== undefined) {\n globalThis.__DEV__ !== false && invariant.warn(3, someNonReference);\n break;\n }\n }\n }\n }\n }\n }\n }\n if (fieldValue !== void 0) {\n allDeleted_1 = false;\n }\n });\n if (needToMerge_1) {\n this.merge(dataId, changedFields_1);\n if (allDeleted_1) {\n if (this instanceof Layer) {\n this.data[dataId] = void 0;\n }\n else {\n delete this.data[dataId];\n }\n this.group.dirty(dataId, \"__exists\");\n }\n return true;\n }\n }\n return false;\n };\n // If called with only one argument, removes the entire entity\n // identified by dataId. If called with a fieldName as well, removes all\n // fields of that entity whose names match fieldName according to the\n // fieldNameFromStoreName helper function. If called with a fieldName\n // and variables, removes all fields of that entity whose names match fieldName\n // and whose arguments when cached exactly match the variables passed.\n EntityStore.prototype.delete = function (dataId, fieldName, args) {\n var _a;\n var storeObject = this.lookup(dataId);\n if (storeObject) {\n var typename = this.getFieldValue(storeObject, \"__typename\");\n var storeFieldName = fieldName && args ?\n this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args })\n : fieldName;\n return this.modify(dataId, storeFieldName ? (_a = {},\n _a[storeFieldName] = delModifier,\n _a) : delModifier);\n }\n return false;\n };\n EntityStore.prototype.evict = function (options, limit) {\n var evicted = false;\n if (options.id) {\n if (hasOwn.call(this.data, options.id)) {\n evicted = this.delete(options.id, options.fieldName, options.args);\n }\n if (this instanceof Layer && this !== limit) {\n evicted = this.parent.evict(options, limit) || evicted;\n }\n // Always invalidate the field to trigger rereading of watched\n // queries, even if no cache data was modified by the eviction,\n // because queries may depend on computed fields with custom read\n // functions, whose values are not stored in the EntityStore.\n if (options.fieldName || evicted) {\n this.group.dirty(options.id, options.fieldName || \"__exists\");\n }\n }\n return evicted;\n };\n EntityStore.prototype.clear = function () {\n this.replace(null);\n };\n EntityStore.prototype.extract = function () {\n var _this = this;\n var obj = this.toObject();\n var extraRootIds = [];\n this.getRootIdSet().forEach(function (id) {\n if (!hasOwn.call(_this.policies.rootTypenamesById, id)) {\n extraRootIds.push(id);\n }\n });\n if (extraRootIds.length) {\n obj.__META = { extraRootIds: extraRootIds.sort() };\n }\n return obj;\n };\n EntityStore.prototype.replace = function (newData) {\n var _this = this;\n Object.keys(this.data).forEach(function (dataId) {\n if (!(newData && hasOwn.call(newData, dataId))) {\n _this.delete(dataId);\n }\n });\n if (newData) {\n var __META = newData.__META, rest_1 = __rest(newData, [\"__META\"]);\n Object.keys(rest_1).forEach(function (dataId) {\n _this.merge(dataId, rest_1[dataId]);\n });\n if (__META) {\n __META.extraRootIds.forEach(this.retain, this);\n }\n }\n };\n EntityStore.prototype.retain = function (rootId) {\n return (this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1);\n };\n EntityStore.prototype.release = function (rootId) {\n if (this.rootIds[rootId] > 0) {\n var count = --this.rootIds[rootId];\n if (!count)\n delete this.rootIds[rootId];\n return count;\n }\n return 0;\n };\n // Return a Set of all the ID strings that have been retained by\n // this layer/root *and* any layers/roots beneath it.\n EntityStore.prototype.getRootIdSet = function (ids) {\n if (ids === void 0) { ids = new Set(); }\n Object.keys(this.rootIds).forEach(ids.add, ids);\n if (this instanceof Layer) {\n this.parent.getRootIdSet(ids);\n }\n else {\n // Official singleton IDs like ROOT_QUERY and ROOT_MUTATION are\n // always considered roots for garbage collection, regardless of\n // their retainment counts in this.rootIds.\n Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids);\n }\n return ids;\n };\n // The goal of garbage collection is to remove IDs from the Root layer of the\n // store that are no longer reachable starting from any IDs that have been\n // explicitly retained (see retain and release, above). Returns an array of\n // dataId strings that were removed from the store.\n EntityStore.prototype.gc = function () {\n var _this = this;\n var ids = this.getRootIdSet();\n var snapshot = this.toObject();\n ids.forEach(function (id) {\n if (hasOwn.call(snapshot, id)) {\n // Because we are iterating over an ECMAScript Set, the IDs we add here\n // will be visited in later iterations of the forEach loop only if they\n // were not previously contained by the Set.\n Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids);\n // By removing IDs from the snapshot object here, we protect them from\n // getting removed from the root store layer below.\n delete snapshot[id];\n }\n });\n var idsToRemove = Object.keys(snapshot);\n if (idsToRemove.length) {\n var root_1 = this;\n while (root_1 instanceof Layer)\n root_1 = root_1.parent;\n idsToRemove.forEach(function (id) { return root_1.delete(id); });\n }\n return idsToRemove;\n };\n EntityStore.prototype.findChildRefIds = function (dataId) {\n if (!hasOwn.call(this.refs, dataId)) {\n var found_1 = (this.refs[dataId] = Object.create(null));\n var root = this.data[dataId];\n if (!root)\n return found_1;\n var workSet_1 = new Set([root]);\n // Within the store, only arrays and objects can contain child entity\n // references, so we can prune the traversal using this predicate:\n workSet_1.forEach(function (obj) {\n if (isReference(obj)) {\n found_1[obj.__ref] = true;\n // In rare cases, a { __ref } Reference object may have other fields.\n // This often indicates a mismerging of References with StoreObjects,\n // but garbage collection should not be fooled by a stray __ref\n // property in a StoreObject (ignoring all the other fields just\n // because the StoreObject looks like a Reference). To avoid this\n // premature termination of findChildRefIds recursion, we fall through\n // to the code below, which will handle any other properties of obj.\n }\n if (isNonNullObject(obj)) {\n Object.keys(obj).forEach(function (key) {\n var child = obj[key];\n // No need to add primitive values to the workSet, since they cannot\n // contain reference objects.\n if (isNonNullObject(child)) {\n workSet_1.add(child);\n }\n });\n }\n });\n }\n return this.refs[dataId];\n };\n EntityStore.prototype.makeCacheKey = function () {\n return this.group.keyMaker.lookupArray(arguments);\n };\n return EntityStore;\n}());\nexport { EntityStore };\n// A single CacheGroup represents a set of one or more EntityStore objects,\n// typically the Root store in a CacheGroup by itself, and all active Layer\n// stores in a group together. A single EntityStore object belongs to only\n// one CacheGroup, store.group. The CacheGroup is responsible for tracking\n// dependencies, so store.group is helpful for generating unique keys for\n// cached results that need to be invalidated when/if those dependencies\n// change. If we used the EntityStore objects themselves as cache keys (that\n// is, store rather than store.group), the cache would become unnecessarily\n// fragmented by all the different Layer objects. Instead, the CacheGroup\n// approach allows all optimistic Layer objects in the same linked list to\n// belong to one CacheGroup, with the non-optimistic Root object belonging\n// to another CacheGroup, allowing resultCaching dependencies to be tracked\n// separately for optimistic and non-optimistic entity data.\nvar CacheGroup = /** @class */ (function () {\n function CacheGroup(caching, parent) {\n if (parent === void 0) { parent = null; }\n this.caching = caching;\n this.parent = parent;\n this.d = null;\n this.resetCaching();\n }\n CacheGroup.prototype.resetCaching = function () {\n this.d = this.caching ? dep() : null;\n this.keyMaker = new Trie(canUseWeakMap);\n };\n CacheGroup.prototype.depend = function (dataId, storeFieldName) {\n if (this.d) {\n this.d(makeDepKey(dataId, storeFieldName));\n var fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName) {\n // Fields with arguments that contribute extra identifying\n // information to the fieldName (thus forming the storeFieldName)\n // depend not only on the full storeFieldName but also on the\n // short fieldName, so the field can be invalidated using either\n // level of specificity.\n this.d(makeDepKey(dataId, fieldName));\n }\n if (this.parent) {\n this.parent.depend(dataId, storeFieldName);\n }\n }\n };\n CacheGroup.prototype.dirty = function (dataId, storeFieldName) {\n if (this.d) {\n this.d.dirty(makeDepKey(dataId, storeFieldName), \n // When storeFieldName === \"__exists\", that means the entity identified\n // by dataId has either disappeared from the cache or was newly added,\n // so the result caching system would do well to \"forget everything it\n // knows\" about that object. To achieve that kind of invalidation, we\n // not only dirty the associated result cache entry, but also remove it\n // completely from the dependency graph. For the optimism implementation\n // details, see https://github.com/benjamn/optimism/pull/195.\n storeFieldName === \"__exists\" ? \"forget\" : \"setDirty\");\n }\n };\n return CacheGroup;\n}());\nfunction makeDepKey(dataId, storeFieldName) {\n // Since field names cannot have '#' characters in them, this method\n // of joining the field name and the ID should be unambiguous, and much\n // cheaper than JSON.stringify([dataId, fieldName]).\n return storeFieldName + \"#\" + dataId;\n}\nexport function maybeDependOnExistenceOfEntity(store, entityId) {\n if (supportsResultCaching(store)) {\n // We use this pseudo-field __exists elsewhere in the EntityStore code to\n // represent changes in the existence of the entity object identified by\n // entityId. This dependency gets reliably dirtied whenever an object with\n // this ID is deleted (or newly created) within this group, so any result\n // cache entries (for example, StoreReader#executeSelectionSet results) that\n // depend on __exists for this entityId will get dirtied as well, leading to\n // the eventual recomputation (instead of reuse) of those result objects the\n // next time someone reads them from the cache.\n store.group.depend(entityId, \"__exists\");\n }\n}\n(function (EntityStore) {\n // Refer to this class as EntityStore.Root outside this namespace.\n var Root = /** @class */ (function (_super) {\n __extends(Root, _super);\n function Root(_a) {\n var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;\n var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this;\n _this.stump = new Stump(_this);\n _this.storageTrie = new Trie(canUseWeakMap);\n if (seed)\n _this.replace(seed);\n return _this;\n }\n Root.prototype.addLayer = function (layerId, replay) {\n // Adding an optimistic Layer on top of the Root actually adds the Layer\n // on top of the Stump, so the Stump always comes between the Root and\n // any Layer objects that we've added.\n return this.stump.addLayer(layerId, replay);\n };\n Root.prototype.removeLayer = function () {\n // Never remove the root layer.\n return this;\n };\n Root.prototype.getStorage = function () {\n return this.storageTrie.lookupArray(arguments);\n };\n return Root;\n }(EntityStore));\n EntityStore.Root = Root;\n})(EntityStore || (EntityStore = {}));\n// Not exported, since all Layer instances are created by the addLayer method\n// of the EntityStore.Root class.\nvar Layer = /** @class */ (function (_super) {\n __extends(Layer, _super);\n function Layer(id, parent, replay, group) {\n var _this = _super.call(this, parent.policies, group) || this;\n _this.id = id;\n _this.parent = parent;\n _this.replay = replay;\n _this.group = group;\n replay(_this);\n return _this;\n }\n Layer.prototype.addLayer = function (layerId, replay) {\n return new Layer(layerId, this, replay, this.group);\n };\n Layer.prototype.removeLayer = function (layerId) {\n var _this = this;\n // Remove all instances of the given id, not just the first one.\n var parent = this.parent.removeLayer(layerId);\n if (layerId === this.id) {\n if (this.group.caching) {\n // Dirty every ID we're removing. Technically we might be able to avoid\n // dirtying fields that have values in higher layers, but we don't have\n // easy access to higher layers here, and we're about to recreate those\n // layers anyway (see parent.addLayer below).\n Object.keys(this.data).forEach(function (dataId) {\n var ownStoreObject = _this.data[dataId];\n var parentStoreObject = parent[\"lookup\"](dataId);\n if (!parentStoreObject) {\n // The StoreObject identified by dataId was defined in this layer\n // but will be undefined in the parent layer, so we can delete the\n // whole entity using this.delete(dataId). Since we're about to\n // throw this layer away, the only goal of this deletion is to dirty\n // the removed fields.\n _this.delete(dataId);\n }\n else if (!ownStoreObject) {\n // This layer had an entry for dataId but it was undefined, which\n // means the entity was deleted in this layer, and it's about to\n // become undeleted when we remove this layer, so we need to dirty\n // all fields that are about to be reexposed.\n _this.group.dirty(dataId, \"__exists\");\n Object.keys(parentStoreObject).forEach(function (storeFieldName) {\n _this.group.dirty(dataId, storeFieldName);\n });\n }\n else if (ownStoreObject !== parentStoreObject) {\n // If ownStoreObject is not exactly the same as parentStoreObject,\n // dirty any fields whose values will change as a result of this\n // removal.\n Object.keys(ownStoreObject).forEach(function (storeFieldName) {\n if (!equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) {\n _this.group.dirty(dataId, storeFieldName);\n }\n });\n }\n });\n }\n return parent;\n }\n // No changes are necessary if the parent chain remains identical.\n if (parent === this.parent)\n return this;\n // Recreate this layer on top of the new parent.\n return parent.addLayer(this.id, this.replay);\n };\n Layer.prototype.toObject = function () {\n return __assign(__assign({}, this.parent.toObject()), this.data);\n };\n Layer.prototype.findChildRefIds = function (dataId) {\n var fromParent = this.parent.findChildRefIds(dataId);\n return hasOwn.call(this.data, dataId) ? __assign(__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;\n };\n Layer.prototype.getStorage = function () {\n var p = this.parent;\n while (p.parent)\n p = p.parent;\n return p.getStorage.apply(p, \n // @ts-expect-error\n arguments);\n };\n return Layer;\n}(EntityStore));\n// Represents a Layer permanently installed just above the Root, which allows\n// reading optimistically (and registering optimistic dependencies) even when\n// no optimistic layers are currently active. The stump.group CacheGroup object\n// is shared by any/all Layer objects added on top of the Stump.\nvar Stump = /** @class */ (function (_super) {\n __extends(Stump, _super);\n function Stump(root) {\n return _super.call(this, \"EntityStore.Stump\", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this;\n }\n Stump.prototype.removeLayer = function () {\n // Never remove the Stump layer.\n return this;\n };\n Stump.prototype.merge = function (older, newer) {\n // We never want to write any data into the Stump, so we forward any merge\n // calls to the Root instead. Another option here would be to throw an\n // exception, but the toReference(object, true) function can sometimes\n // trigger Stump writes (which used to be Root writes, before the Stump\n // concept was introduced).\n return this.parent.merge(older, newer);\n };\n return Stump;\n}(Layer));\nfunction storeObjectReconciler(existingObject, incomingObject, property) {\n var existingValue = existingObject[property];\n var incomingValue = incomingObject[property];\n // Wherever there is a key collision, prefer the incoming value, unless\n // it is deeply equal to the existing value. It's worth checking deep\n // equality here (even though blindly returning incoming would be\n // logically correct) because preserving the referential identity of\n // existing data can prevent needless rereading and rerendering.\n return equal(existingValue, incomingValue) ? existingValue : incomingValue;\n}\nexport function supportsResultCaching(store) {\n // When result caching is disabled, store.depend will be null.\n return !!(store instanceof EntityStore && store.group.caching);\n}\n//# sourceMappingURL=entityStore.js.map","import { __assign } from \"tslib\";\nimport { Trie } from \"@wry/trie\";\nimport { canUseWeakMap, canUseWeakSet, isNonNullObject as isObjectOrArray, } from \"../../utilities/index.js\";\nimport { isArray } from \"./helpers.js\";\nfunction shallowCopy(value) {\n if (isObjectOrArray(value)) {\n return isArray(value) ?\n value.slice(0)\n : __assign({ __proto__: Object.getPrototypeOf(value) }, value);\n }\n return value;\n}\n// When programmers talk about the \"canonical form\" of an object, they\n// usually have the following meaning in mind, which I've copied from\n// https://en.wiktionary.org/wiki/canonical_form:\n//\n// 1. A standard or normal presentation of a mathematical entity [or\n// object]. A canonical form is an element of a set of representatives\n// of equivalence classes of forms such that there is a function or\n// procedure which projects every element of each equivalence class\n// onto that one element, the canonical form of that equivalence\n// class. The canonical form is expected to be simpler than the rest of\n// the forms in some way.\n//\n// That's a long-winded way of saying any two objects that have the same\n// canonical form may be considered equivalent, even if they are !==,\n// which usually means the objects are structurally equivalent (deeply\n// equal), but don't necessarily use the same memory.\n//\n// Like a literary or musical canon, this ObjectCanon class represents a\n// collection of unique canonical items (JavaScript objects), with the\n// important property that canon.admit(a) === canon.admit(b) if a and b\n// are deeply equal to each other. In terms of the definition above, the\n// canon.admit method is the \"function or procedure which projects every\"\n// object \"onto that one element, the canonical form.\"\n//\n// In the worst case, the canonicalization process may involve looking at\n// every property in the provided object tree, so it takes the same order\n// of time as deep equality checking. Fortunately, already-canonicalized\n// objects are returned immediately from canon.admit, so the presence of\n// canonical subtrees tends to speed up canonicalization.\n//\n// Since consumers of canonical objects can check for deep equality in\n// constant time, canonicalizing cache results can massively improve the\n// performance of application code that skips re-rendering unchanged\n// results, such as \"pure\" UI components in a framework like React.\n//\n// Of course, since canonical objects may be shared widely between\n// unrelated consumers, it's important to think of them as immutable, even\n// though they are not actually frozen with Object.freeze in production,\n// due to the extra performance overhead that comes with frozen objects.\n//\n// Custom scalar objects whose internal class name is neither Array nor\n// Object can be included safely in the admitted tree, but they will not\n// be replaced with a canonical version (to put it another way, they are\n// assumed to be canonical already).\n//\n// If we ignore custom objects, no detection of cycles or repeated object\n// references is currently required by the StoreReader class, since\n// GraphQL result objects are JSON-serializable trees (and thus contain\n// neither cycles nor repeated subtrees), so we can avoid the complexity\n// of keeping track of objects we've already seen during the recursion of\n// the admit method.\n//\n// In the future, we may consider adding additional cases to the switch\n// statement to handle other common object types, such as \"[object Date]\"\n// objects, as needed.\nvar ObjectCanon = /** @class */ (function () {\n function ObjectCanon() {\n // Set of all canonical objects this ObjectCanon has admitted, allowing\n // canon.admit to return previously-canonicalized objects immediately.\n this.known = new (canUseWeakSet ? WeakSet : Set)();\n // Efficient storage/lookup structure for canonical objects.\n this.pool = new Trie(canUseWeakMap);\n // Make the ObjectCanon assume this value has already been\n // canonicalized.\n this.passes = new WeakMap();\n // Arrays that contain the same elements in a different order can share\n // the same SortedKeysInfo object, to save memory.\n this.keysByJSON = new Map();\n // This has to come last because it depends on keysByJSON.\n this.empty = this.admit({});\n }\n ObjectCanon.prototype.isKnown = function (value) {\n return isObjectOrArray(value) && this.known.has(value);\n };\n ObjectCanon.prototype.pass = function (value) {\n if (isObjectOrArray(value)) {\n var copy = shallowCopy(value);\n this.passes.set(copy, value);\n return copy;\n }\n return value;\n };\n ObjectCanon.prototype.admit = function (value) {\n var _this = this;\n if (isObjectOrArray(value)) {\n var original = this.passes.get(value);\n if (original)\n return original;\n var proto = Object.getPrototypeOf(value);\n switch (proto) {\n case Array.prototype: {\n if (this.known.has(value))\n return value;\n var array = value.map(this.admit, this);\n // Arrays are looked up in the Trie using their recursively\n // canonicalized elements, and the known version of the array is\n // preserved as node.array.\n var node = this.pool.lookupArray(array);\n if (!node.array) {\n this.known.add((node.array = array));\n // Since canonical arrays may be shared widely between\n // unrelated consumers, it's important to regard them as\n // immutable, even if they are not frozen in production.\n if (globalThis.__DEV__ !== false) {\n Object.freeze(array);\n }\n }\n return node.array;\n }\n case null:\n case Object.prototype: {\n if (this.known.has(value))\n return value;\n var proto_1 = Object.getPrototypeOf(value);\n var array_1 = [proto_1];\n var keys = this.sortedKeys(value);\n array_1.push(keys.json);\n var firstValueIndex_1 = array_1.length;\n keys.sorted.forEach(function (key) {\n array_1.push(_this.admit(value[key]));\n });\n // Objects are looked up in the Trie by their prototype (which\n // is *not* recursively canonicalized), followed by a JSON\n // representation of their (sorted) keys, followed by the\n // sequence of recursively canonicalized values corresponding to\n // those keys. To keep the final results unambiguous with other\n // sequences (such as arrays that just happen to contain [proto,\n // keys.json, value1, value2, ...]), the known version of the\n // object is stored as node.object.\n var node = this.pool.lookupArray(array_1);\n if (!node.object) {\n var obj_1 = (node.object = Object.create(proto_1));\n this.known.add(obj_1);\n keys.sorted.forEach(function (key, i) {\n obj_1[key] = array_1[firstValueIndex_1 + i];\n });\n // Since canonical objects may be shared widely between\n // unrelated consumers, it's important to regard them as\n // immutable, even if they are not frozen in production.\n if (globalThis.__DEV__ !== false) {\n Object.freeze(obj_1);\n }\n }\n return node.object;\n }\n }\n }\n return value;\n };\n // It's worthwhile to cache the sorting of arrays of strings, since the\n // same initial unsorted arrays tend to be encountered many times.\n // Fortunately, we can reuse the Trie machinery to look up the sorted\n // arrays in linear time (which is faster than sorting large arrays).\n ObjectCanon.prototype.sortedKeys = function (obj) {\n var keys = Object.keys(obj);\n var node = this.pool.lookupArray(keys);\n if (!node.keys) {\n keys.sort();\n var json = JSON.stringify(keys);\n if (!(node.keys = this.keysByJSON.get(json))) {\n this.keysByJSON.set(json, (node.keys = { sorted: keys, json: json }));\n }\n }\n return node.keys;\n };\n return ObjectCanon;\n}());\nexport { ObjectCanon };\n//# sourceMappingURL=object-canon.js.map","import { __assign } from \"tslib\";\nimport { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\nimport { Kind } from \"graphql\";\nimport { wrap } from \"optimism\";\nimport { isField, resultKeyNameFromField, isReference, makeReference, shouldInclude, addTypenameToDocument, getDefaultValues, getMainDefinition, getQueryDefinition, getFragmentFromSelection, maybeDeepFreeze, mergeDeepArray, DeepMerger, isNonNullObject, canUseWeakMap, compact, canonicalStringify, cacheSizes, } from \"../../utilities/index.js\";\nimport { maybeDependOnExistenceOfEntity, supportsResultCaching, } from \"./entityStore.js\";\nimport { isArray, extractFragmentContext, getTypenameFromStoreObject, shouldCanonizeResults, } from \"./helpers.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport { ObjectCanon } from \"./object-canon.js\";\nfunction execSelectionSetKeyArgs(options) {\n return [\n options.selectionSet,\n options.objectOrReference,\n options.context,\n // We split out this property so we can pass different values\n // independently without modifying options.context itself.\n options.context.canonizeResults,\n ];\n}\nvar StoreReader = /** @class */ (function () {\n function StoreReader(config) {\n var _this = this;\n this.knownResults = new (canUseWeakMap ? WeakMap : Map)();\n this.config = compact(config, {\n addTypename: config.addTypename !== false,\n canonizeResults: shouldCanonizeResults(config),\n });\n this.canon = config.canon || new ObjectCanon();\n // memoized functions in this class will be \"garbage-collected\"\n // by recreating the whole `StoreReader` in\n // `InMemoryCache.resetResultsCache`\n // (triggered from `InMemoryCache.gc` with `resetResultCache: true`)\n this.executeSelectionSet = wrap(function (options) {\n var _a;\n var canonizeResults = options.context.canonizeResults;\n var peekArgs = execSelectionSetKeyArgs(options);\n // Negate this boolean option so we can find out if we've already read\n // this result using the other boolean value.\n peekArgs[3] = !canonizeResults;\n var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);\n if (other) {\n if (canonizeResults) {\n return __assign(__assign({}, other), { \n // If we previously read this result without canonizing it, we can\n // reuse that result simply by canonizing it now.\n result: _this.canon.admit(other.result) });\n }\n // If we previously read this result with canonization enabled, we can\n // return that canonized result as-is.\n return other;\n }\n maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);\n // Finally, if we didn't find any useful previous results, run the real\n // execSelectionSetImpl method with the given options.\n return _this.execSelectionSetImpl(options);\n }, {\n max: this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.executeSelectionSet\"] ||\n 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n keyArgs: execSelectionSetKeyArgs,\n // Note that the parameters of makeCacheKey are determined by the\n // array returned by keyArgs.\n makeCacheKey: function (selectionSet, parent, context, canonizeResults) {\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(selectionSet, isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults);\n }\n },\n });\n this.executeSubSelectedArray = wrap(function (options) {\n maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);\n return _this.execSubSelectedArrayImpl(options);\n }, {\n max: this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.executeSubSelectedArray\"] ||\n 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n makeCacheKey: function (_a) {\n var field = _a.field, array = _a.array, context = _a.context;\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(field, array, context.varString);\n }\n },\n });\n }\n StoreReader.prototype.resetCanon = function () {\n this.canon = new ObjectCanon();\n };\n /**\n * Given a store and a query, return as much of the result as possible and\n * identify if any data was missing from the store.\n */\n StoreReader.prototype.diffQueryAgainstStore = function (_a) {\n var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? \"ROOT_QUERY\" : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d;\n var policies = this.config.cache.policies;\n variables = __assign(__assign({}, getDefaultValues(getQueryDefinition(query))), variables);\n var rootRef = makeReference(rootId);\n var execResult = this.executeSelectionSet({\n selectionSet: getMainDefinition(query).selectionSet,\n objectOrReference: rootRef,\n enclosingRef: rootRef,\n context: __assign({ store: store, query: query, policies: policies, variables: variables, varString: canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)),\n });\n var missing;\n if (execResult.missing) {\n // For backwards compatibility we still report an array of\n // MissingFieldError objects, even though there will only ever be at most\n // one of them, now that all missing field error messages are grouped\n // together in the execResult.missing tree.\n missing = [\n new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables),\n ];\n if (!returnPartialData) {\n throw missing[0];\n }\n }\n return {\n result: execResult.result,\n complete: !missing,\n missing: missing,\n };\n };\n StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {\n if (supportsResultCaching(context.store) &&\n this.knownResults.get(result) === selectionSet) {\n var latest = this.executeSelectionSet.peek(selectionSet, parent, context, \n // If result is canonical, then it could only have been previously\n // cached by the canonizing version of executeSelectionSet, so we can\n // avoid checking both possibilities here.\n this.canon.isKnown(result));\n if (latest && result === latest.result) {\n return true;\n }\n }\n return false;\n };\n // Uncached version of executeSelectionSet.\n StoreReader.prototype.execSelectionSetImpl = function (_a) {\n var _this = this;\n var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context;\n if (isReference(objectOrReference) &&\n !context.policies.rootTypenamesById[objectOrReference.__ref] &&\n !context.store.has(objectOrReference.__ref)) {\n return {\n result: this.canon.empty,\n missing: \"Dangling reference to missing \".concat(objectOrReference.__ref, \" object\"),\n };\n }\n var variables = context.variables, policies = context.policies, store = context.store;\n var typename = store.getFieldValue(objectOrReference, \"__typename\");\n var objectsToMerge = [];\n var missing;\n var missingMerger = new DeepMerger();\n if (this.config.addTypename &&\n typeof typename === \"string\" &&\n !policies.rootIdsByTypename[typename]) {\n // Ensure we always include a default value for the __typename\n // field, if we have one, and this.config.addTypename is true. Note\n // that this field can be overridden by other merged objects.\n objectsToMerge.push({ __typename: typename });\n }\n function handleMissing(result, resultName) {\n var _a;\n if (result.missing) {\n missing = missingMerger.merge(missing, (_a = {},\n _a[resultName] = result.missing,\n _a));\n }\n return result.result;\n }\n var workSet = new Set(selectionSet.selections);\n workSet.forEach(function (selection) {\n var _a, _b;\n // Omit fields with directives @skip(if: ) or\n // @include(if: ).\n if (!shouldInclude(selection, variables))\n return;\n if (isField(selection)) {\n var fieldValue = policies.readField({\n fieldName: selection.name.value,\n field: selection,\n variables: context.variables,\n from: objectOrReference,\n }, context);\n var resultName = resultKeyNameFromField(selection);\n if (fieldValue === void 0) {\n if (!addTypenameToDocument.added(selection)) {\n missing = missingMerger.merge(missing, (_a = {},\n _a[resultName] = \"Can't find field '\".concat(selection.name.value, \"' on \").concat(isReference(objectOrReference) ?\n objectOrReference.__ref + \" object\"\n : \"object \" + JSON.stringify(objectOrReference, null, 2)),\n _a));\n }\n }\n else if (isArray(fieldValue)) {\n fieldValue = handleMissing(_this.executeSubSelectedArray({\n field: selection,\n array: fieldValue,\n enclosingRef: enclosingRef,\n context: context,\n }), resultName);\n }\n else if (!selection.selectionSet) {\n // If the field does not have a selection set, then we handle it\n // as a scalar value. To keep this.canon from canonicalizing\n // this value, we use this.canon.pass to wrap fieldValue in a\n // Pass object that this.canon.admit will later unwrap as-is.\n if (context.canonizeResults) {\n fieldValue = _this.canon.pass(fieldValue);\n }\n }\n else if (fieldValue != null) {\n // In this case, because we know the field has a selection set,\n // it must be trying to query a GraphQLObjectType, which is why\n // fieldValue must be != null.\n fieldValue = handleMissing(_this.executeSelectionSet({\n selectionSet: selection.selectionSet,\n objectOrReference: fieldValue,\n enclosingRef: isReference(fieldValue) ? fieldValue : enclosingRef,\n context: context,\n }), resultName);\n }\n if (fieldValue !== void 0) {\n objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b));\n }\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.lookupFragment);\n if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {\n throw newInvariantError(9, selection.name.value);\n }\n if (fragment && policies.fragmentMatches(fragment, typename)) {\n fragment.selectionSet.selections.forEach(workSet.add, workSet);\n }\n }\n });\n var result = mergeDeepArray(objectsToMerge);\n var finalResult = { result: result, missing: missing };\n var frozen = context.canonizeResults ?\n this.canon.admit(finalResult)\n // Since this.canon is normally responsible for freezing results (only in\n // development), freeze them manually if canonization is disabled.\n : maybeDeepFreeze(finalResult);\n // Store this result with its selection set so that we can quickly\n // recognize it again in the StoreReader#isFresh method.\n if (frozen.result) {\n this.knownResults.set(frozen.result, selectionSet);\n }\n return frozen;\n };\n // Uncached version of executeSubSelectedArray.\n StoreReader.prototype.execSubSelectedArrayImpl = function (_a) {\n var _this = this;\n var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context;\n var missing;\n var missingMerger = new DeepMerger();\n function handleMissing(childResult, i) {\n var _a;\n if (childResult.missing) {\n missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a));\n }\n return childResult.result;\n }\n if (field.selectionSet) {\n array = array.filter(context.store.canRead);\n }\n array = array.map(function (item, i) {\n // null value in array\n if (item === null) {\n return null;\n }\n // This is a nested array, recurse\n if (isArray(item)) {\n return handleMissing(_this.executeSubSelectedArray({\n field: field,\n array: item,\n enclosingRef: enclosingRef,\n context: context,\n }), i);\n }\n // This is an object, run the selection set on it\n if (field.selectionSet) {\n return handleMissing(_this.executeSelectionSet({\n selectionSet: field.selectionSet,\n objectOrReference: item,\n enclosingRef: isReference(item) ? item : enclosingRef,\n context: context,\n }), i);\n }\n if (globalThis.__DEV__ !== false) {\n assertSelectionSetForIdValue(context.store, field, item);\n }\n return item;\n });\n return {\n result: context.canonizeResults ? this.canon.admit(array) : array,\n missing: missing,\n };\n };\n return StoreReader;\n}());\nexport { StoreReader };\nfunction firstMissing(tree) {\n try {\n JSON.stringify(tree, function (_, value) {\n if (typeof value === \"string\")\n throw value;\n return value;\n });\n }\n catch (result) {\n return result;\n }\n}\nfunction assertSelectionSetForIdValue(store, field, fieldValue) {\n if (!field.selectionSet) {\n var workSet_1 = new Set([fieldValue]);\n workSet_1.forEach(function (value) {\n if (isNonNullObject(value)) {\n invariant(\n !isReference(value),\n 10,\n getTypenameFromStoreObject(store, value),\n field.name.value\n );\n Object.values(value).forEach(workSet_1.add, workSet_1);\n }\n });\n }\n}\n//# sourceMappingURL=readFromStore.js.map","import { dep, Slot } from \"optimism\";\n// Contextual Slot that acquires its value when custom read functions are\n// called in Policies#readField.\nexport var cacheSlot = new Slot();\nvar cacheInfoMap = new WeakMap();\nfunction getCacheInfo(cache) {\n var info = cacheInfoMap.get(cache);\n if (!info) {\n cacheInfoMap.set(cache, (info = {\n vars: new Set(),\n dep: dep(),\n }));\n }\n return info;\n}\nexport function forgetCache(cache) {\n getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); });\n}\n// Calling forgetCache(cache) serves to silence broadcasts and allows the\n// cache to be garbage collected. However, the varsByCache WeakMap\n// preserves the set of reactive variables that were previously associated\n// with this cache, which makes it possible to \"recall\" the cache at a\n// later time, by reattaching it to those variables. If the cache has been\n// garbage collected in the meantime, because it is no longer reachable,\n// you won't be able to call recallCache(cache), and the cache will\n// automatically disappear from the varsByCache WeakMap.\nexport function recallCache(cache) {\n getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); });\n}\nexport function makeVar(value) {\n var caches = new Set();\n var listeners = new Set();\n var rv = function (newValue) {\n if (arguments.length > 0) {\n if (value !== newValue) {\n value = newValue;\n caches.forEach(function (cache) {\n // Invalidate any fields with custom read functions that\n // consumed this variable, so query results involving those\n // fields will be recomputed the next time we read them.\n getCacheInfo(cache).dep.dirty(rv);\n // Broadcast changes to any caches that have previously read\n // from this variable.\n broadcast(cache);\n });\n // Finally, notify any listeners added via rv.onNextChange.\n var oldListeners = Array.from(listeners);\n listeners.clear();\n oldListeners.forEach(function (listener) { return listener(value); });\n }\n }\n else {\n // When reading from the variable, obtain the current cache from\n // context via cacheSlot. This isn't entirely foolproof, but it's\n // the same system that powers varDep.\n var cache = cacheSlot.getValue();\n if (cache) {\n attach(cache);\n getCacheInfo(cache).dep(rv);\n }\n }\n return value;\n };\n rv.onNextChange = function (listener) {\n listeners.add(listener);\n return function () {\n listeners.delete(listener);\n };\n };\n var attach = (rv.attachCache = function (cache) {\n caches.add(cache);\n getCacheInfo(cache).vars.add(rv);\n return rv;\n });\n rv.forgetCache = function (cache) { return caches.delete(cache); };\n return rv;\n}\nfunction broadcast(cache) {\n if (cache.broadcastWatches) {\n cache.broadcastWatches();\n }\n}\n//# sourceMappingURL=reactiveVars.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { argumentsObjectFromField, DeepMerger, isNonEmptyArray, isNonNullObject, } from \"../../utilities/index.js\";\nimport { hasOwn, isArray } from \"./helpers.js\";\n// Mapping from JSON-encoded KeySpecifier strings to associated information.\nvar specifierInfoCache = Object.create(null);\nfunction lookupSpecifierInfo(spec) {\n // It's safe to encode KeySpecifier arrays with JSON.stringify, since they're\n // just arrays of strings or nested KeySpecifier arrays, and the order of the\n // array elements is important (and suitably preserved by JSON.stringify).\n var cacheKey = JSON.stringify(spec);\n return (specifierInfoCache[cacheKey] ||\n (specifierInfoCache[cacheKey] = Object.create(null)));\n}\nexport function keyFieldsFnFromSpecifier(specifier) {\n var info = lookupSpecifierInfo(specifier);\n return (info.keyFieldsFn || (info.keyFieldsFn = function (object, context) {\n var extract = function (from, key) {\n return context.readField(key, from);\n };\n var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {\n var extracted = extractKeyPath(context.storeObject, schemaKeyPath, \n // Using context.readField to extract paths from context.storeObject\n // allows the extraction to see through Reference objects and respect\n // custom read functions.\n extract);\n if (extracted === void 0 &&\n object !== context.storeObject &&\n hasOwn.call(object, schemaKeyPath[0])) {\n // If context.storeObject fails to provide a value for the requested\n // path, fall back to the raw result object, if it has a top-level key\n // matching the first key in the path (schemaKeyPath[0]). This allows\n // key fields included in the written data to be saved in the cache\n // even if they are not selected explicitly in context.selectionSet.\n // Not being mentioned by context.selectionSet is convenient here,\n // since it means these extra fields cannot be affected by field\n // aliasing, which is why we can use extractKey instead of\n // context.readField for this extraction.\n extracted = extractKeyPath(object, schemaKeyPath, extractKey);\n }\n invariant(extracted !== void 0, 4, schemaKeyPath.join(\".\"), object);\n return extracted;\n }));\n return \"\".concat(context.typename, \":\").concat(JSON.stringify(keyObject));\n }));\n}\n// The keyArgs extraction process is roughly analogous to keyFields extraction,\n// but there are no aliases involved, missing fields are tolerated (by merely\n// omitting them from the key), and drawing from field.directives or variables\n// is allowed (in addition to drawing from the field's arguments object).\n// Concretely, these differences mean passing a different key path extractor\n// function to collectSpecifierPaths, reusing the shared extractKeyPath helper\n// wherever possible.\nexport function keyArgsFnFromSpecifier(specifier) {\n var info = lookupSpecifierInfo(specifier);\n return (info.keyArgsFn ||\n (info.keyArgsFn = function (args, _a) {\n var field = _a.field, variables = _a.variables, fieldName = _a.fieldName;\n var collected = collectSpecifierPaths(specifier, function (keyPath) {\n var firstKey = keyPath[0];\n var firstChar = firstKey.charAt(0);\n if (firstChar === \"@\") {\n if (field && isNonEmptyArray(field.directives)) {\n var directiveName_1 = firstKey.slice(1);\n // If the directive appears multiple times, only the first\n // occurrence's arguments will be used. TODO Allow repetition?\n // TODO Cache this work somehow, a la aliasMap?\n var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });\n // Fortunately argumentsObjectFromField works for DirectiveNode!\n var directiveArgs = d && argumentsObjectFromField(d, variables);\n // For directives without arguments (d defined, but directiveArgs ===\n // null), the presence or absence of the directive still counts as\n // part of the field key, so we return null in those cases. If no\n // directive with this name was found for this field (d undefined and\n // thus directiveArgs undefined), we return undefined, which causes\n // this value to be omitted from the key object returned by\n // collectSpecifierPaths.\n return (directiveArgs &&\n extractKeyPath(directiveArgs, \n // If keyPath.length === 1, this code calls extractKeyPath with an\n // empty path, which works because it uses directiveArgs as the\n // extracted value.\n keyPath.slice(1)));\n }\n // If the key started with @ but there was no corresponding directive,\n // we want to omit this value from the key object, not fall through to\n // treating @whatever as a normal argument name.\n return;\n }\n if (firstChar === \"$\") {\n var variableName = firstKey.slice(1);\n if (variables && hasOwn.call(variables, variableName)) {\n var varKeyPath = keyPath.slice(0);\n varKeyPath[0] = variableName;\n return extractKeyPath(variables, varKeyPath);\n }\n // If the key started with $ but there was no corresponding variable, we\n // want to omit this value from the key object, not fall through to\n // treating $whatever as a normal argument name.\n return;\n }\n if (args) {\n return extractKeyPath(args, keyPath);\n }\n });\n var suffix = JSON.stringify(collected);\n // If no arguments were passed to this field, and it didn't have any other\n // field key contributions from directives or variables, hide the empty\n // :{} suffix from the field key. However, a field passed no arguments can\n // still end up with a non-empty :{...} suffix if its key configuration\n // refers to directives or variables.\n if (args || suffix !== \"{}\") {\n fieldName += \":\" + suffix;\n }\n return fieldName;\n }));\n}\nexport function collectSpecifierPaths(specifier, extractor) {\n // For each path specified by specifier, invoke the extractor, and repeatedly\n // merge the results together, with appropriate ancestor context.\n var merger = new DeepMerger();\n return getSpecifierPaths(specifier).reduce(function (collected, path) {\n var _a;\n var toMerge = extractor(path);\n if (toMerge !== void 0) {\n // This path is not expected to contain array indexes, so the toMerge\n // reconstruction will not contain arrays. TODO Fix this?\n for (var i = path.length - 1; i >= 0; --i) {\n toMerge = (_a = {}, _a[path[i]] = toMerge, _a);\n }\n collected = merger.merge(collected, toMerge);\n }\n return collected;\n }, Object.create(null));\n}\nexport function getSpecifierPaths(spec) {\n var info = lookupSpecifierInfo(spec);\n if (!info.paths) {\n var paths_1 = (info.paths = []);\n var currentPath_1 = [];\n spec.forEach(function (s, i) {\n if (isArray(s)) {\n getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); });\n currentPath_1.length = 0;\n }\n else {\n currentPath_1.push(s);\n if (!isArray(spec[i + 1])) {\n paths_1.push(currentPath_1.slice(0));\n currentPath_1.length = 0;\n }\n }\n });\n }\n return info.paths;\n}\nfunction extractKey(object, key) {\n return object[key];\n}\nexport function extractKeyPath(object, path, extract) {\n // For each key in path, extract the corresponding child property from obj,\n // flattening arrays if encountered (uncommon for keyFields and keyArgs, but\n // possible). The final result of path.reduce is normalized so unexpected leaf\n // objects have their keys safely sorted. That final result is difficult to\n // type as anything other than any. You're welcome to try to improve the\n // return type, but keep in mind extractKeyPath is not a public function\n // (exported only for testing), so the effort may not be worthwhile unless the\n // limited set of actual callers (see above) pass arguments that TypeScript\n // can statically type. If we know only that path is some array of strings\n // (and not, say, a specific tuple of statically known strings), any (or\n // possibly unknown) is the honest answer.\n extract = extract || extractKey;\n return normalize(path.reduce(function reducer(obj, key) {\n return isArray(obj) ?\n obj.map(function (child) { return reducer(child, key); })\n : obj && extract(obj, key);\n }, object));\n}\nfunction normalize(value) {\n // Usually the extracted value will be a scalar value, since most primary\n // key fields are scalar, but just in case we get an object or an array, we\n // need to do some normalization of the order of (nested) keys.\n if (isNonNullObject(value)) {\n if (isArray(value)) {\n return value.map(normalize);\n }\n return collectSpecifierPaths(Object.keys(value).sort(), function (path) {\n return extractKeyPath(value, path);\n });\n }\n return value;\n}\n//# sourceMappingURL=key-extractor.js.map","import { __assign, __rest } from \"tslib\";\nimport { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\nimport { storeKeyNameFromField, argumentsObjectFromField, isReference, getStoreKeyName, isNonNullObject, stringifyForDisplay, } from \"../../utilities/index.js\";\nimport { hasOwn, fieldNameFromStoreName, storeValueIsStoreObject, selectionSetMatchesResult, TypeOrFieldNameRegExp, defaultDataIdFromObject, isArray, } from \"./helpers.js\";\nimport { cacheSlot } from \"./reactiveVars.js\";\nimport { keyArgsFnFromSpecifier, keyFieldsFnFromSpecifier, } from \"./key-extractor.js\";\nfunction argsFromFieldSpecifier(spec) {\n return (spec.args !== void 0 ? spec.args\n : spec.field ? argumentsObjectFromField(spec.field, spec.variables)\n : null);\n}\nvar nullKeyFieldsFn = function () { return void 0; };\nvar simpleKeyArgsFn = function (_args, context) { return context.fieldName; };\n// These merge functions can be selected by specifying merge:true or\n// merge:false in a field policy.\nvar mergeTrueFn = function (existing, incoming, _a) {\n var mergeObjects = _a.mergeObjects;\n return mergeObjects(existing, incoming);\n};\nvar mergeFalseFn = function (_, incoming) { return incoming; };\nvar Policies = /** @class */ (function () {\n function Policies(config) {\n this.config = config;\n this.typePolicies = Object.create(null);\n this.toBeAdded = Object.create(null);\n // Map from subtype names to sets of supertype names. Note that this\n // representation inverts the structure of possibleTypes (whose keys are\n // supertypes and whose values are arrays of subtypes) because it tends\n // to be much more efficient to search upwards than downwards.\n this.supertypeMap = new Map();\n // Any fuzzy subtypes specified by possibleTypes will be converted to\n // RegExp objects and recorded here. Every key of this map can also be\n // found in supertypeMap. In many cases this Map will be empty, which\n // means no fuzzy subtype checking will happen in fragmentMatches.\n this.fuzzySubtypes = new Map();\n this.rootIdsByTypename = Object.create(null);\n this.rootTypenamesById = Object.create(null);\n this.usingPossibleTypes = false;\n this.config = __assign({ dataIdFromObject: defaultDataIdFromObject }, config);\n this.cache = this.config.cache;\n this.setRootTypename(\"Query\");\n this.setRootTypename(\"Mutation\");\n this.setRootTypename(\"Subscription\");\n if (config.possibleTypes) {\n this.addPossibleTypes(config.possibleTypes);\n }\n if (config.typePolicies) {\n this.addTypePolicies(config.typePolicies);\n }\n }\n Policies.prototype.identify = function (object, partialContext) {\n var _a;\n var policies = this;\n var typename = (partialContext &&\n (partialContext.typename || ((_a = partialContext.storeObject) === null || _a === void 0 ? void 0 : _a.__typename))) ||\n object.__typename;\n // It should be possible to write root Query fields with writeFragment,\n // using { __typename: \"Query\", ... } as the data, but it does not make\n // sense to allow the same identification behavior for the Mutation and\n // Subscription types, since application code should never be writing\n // directly to (or reading directly from) those root objects.\n if (typename === this.rootTypenamesById.ROOT_QUERY) {\n return [\"ROOT_QUERY\"];\n }\n // Default context.storeObject to object if not otherwise provided.\n var storeObject = (partialContext && partialContext.storeObject) || object;\n var context = __assign(__assign({}, partialContext), { typename: typename, storeObject: storeObject, readField: (partialContext && partialContext.readField) ||\n function () {\n var options = normalizeReadFieldOptions(arguments, storeObject);\n return policies.readField(options, {\n store: policies.cache[\"data\"],\n variables: options.variables,\n });\n } });\n var id;\n var policy = typename && this.getTypePolicy(typename);\n var keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject;\n while (keyFn) {\n var specifierOrId = keyFn(__assign(__assign({}, object), storeObject), context);\n if (isArray(specifierOrId)) {\n keyFn = keyFieldsFnFromSpecifier(specifierOrId);\n }\n else {\n id = specifierOrId;\n break;\n }\n }\n id = id ? String(id) : void 0;\n return context.keyObject ? [id, context.keyObject] : [id];\n };\n Policies.prototype.addTypePolicies = function (typePolicies) {\n var _this = this;\n Object.keys(typePolicies).forEach(function (typename) {\n var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = __rest(_a, [\"queryType\", \"mutationType\", \"subscriptionType\"]);\n // Though {query,mutation,subscription}Type configurations are rare,\n // it's important to call setRootTypename as early as possible,\n // since these configurations should apply consistently for the\n // entire lifetime of the cache. Also, since only one __typename can\n // qualify as one of these root types, these three properties cannot\n // be inherited, unlike the rest of the incoming properties. That\n // restriction is convenient, because the purpose of this.toBeAdded\n // is to delay the processing of type/field policies until the first\n // time they're used, allowing policies to be added in any order as\n // long as all relevant policies (including policies for supertypes)\n // have been added by the time a given policy is used for the first\n // time. In other words, since inheritance doesn't matter for these\n // properties, there's also no need to delay their processing using\n // the this.toBeAdded queue.\n if (queryType)\n _this.setRootTypename(\"Query\", typename);\n if (mutationType)\n _this.setRootTypename(\"Mutation\", typename);\n if (subscriptionType)\n _this.setRootTypename(\"Subscription\", typename);\n if (hasOwn.call(_this.toBeAdded, typename)) {\n _this.toBeAdded[typename].push(incoming);\n }\n else {\n _this.toBeAdded[typename] = [incoming];\n }\n });\n };\n Policies.prototype.updateTypePolicy = function (typename, incoming) {\n var _this = this;\n var existing = this.getTypePolicy(typename);\n var keyFields = incoming.keyFields, fields = incoming.fields;\n function setMerge(existing, merge) {\n existing.merge =\n typeof merge === \"function\" ? merge\n // Pass merge:true as a shorthand for a merge implementation\n // that returns options.mergeObjects(existing, incoming).\n : merge === true ? mergeTrueFn\n // Pass merge:false to make incoming always replace existing\n // without any warnings about data clobbering.\n : merge === false ? mergeFalseFn\n : existing.merge;\n }\n // Type policies can define merge functions, as an alternative to\n // using field policies to merge child objects.\n setMerge(existing, incoming.merge);\n existing.keyFn =\n // Pass false to disable normalization for this typename.\n keyFields === false ? nullKeyFieldsFn\n // Pass an array of strings to use those fields to compute a\n // composite ID for objects of this typename.\n : isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)\n // Pass a function to take full control over identification.\n : typeof keyFields === \"function\" ? keyFields\n // Leave existing.keyFn unchanged if above cases fail.\n : existing.keyFn;\n if (fields) {\n Object.keys(fields).forEach(function (fieldName) {\n var existing = _this.getFieldPolicy(typename, fieldName, true);\n var incoming = fields[fieldName];\n if (typeof incoming === \"function\") {\n existing.read = incoming;\n }\n else {\n var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;\n existing.keyFn =\n // Pass false to disable argument-based differentiation of\n // field identities.\n keyArgs === false ? simpleKeyArgsFn\n // Pass an array of strings to use named arguments to\n // compute a composite identity for the field.\n : isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)\n // Pass a function to take full control over field identity.\n : typeof keyArgs === \"function\" ? keyArgs\n // Leave existing.keyFn unchanged if above cases fail.\n : existing.keyFn;\n if (typeof read === \"function\") {\n existing.read = read;\n }\n setMerge(existing, merge);\n }\n if (existing.read && existing.merge) {\n // If we have both a read and a merge function, assume\n // keyArgs:false, because read and merge together can take\n // responsibility for interpreting arguments in and out. This\n // default assumption can always be overridden by specifying\n // keyArgs explicitly in the FieldPolicy.\n existing.keyFn = existing.keyFn || simpleKeyArgsFn;\n }\n });\n }\n };\n Policies.prototype.setRootTypename = function (which, typename) {\n if (typename === void 0) { typename = which; }\n var rootId = \"ROOT_\" + which.toUpperCase();\n var old = this.rootTypenamesById[rootId];\n if (typename !== old) {\n invariant(!old || old === which, 5, which);\n // First, delete any old __typename associated with this rootId from\n // rootIdsByTypename.\n if (old)\n delete this.rootIdsByTypename[old];\n // Now make this the only __typename that maps to this rootId.\n this.rootIdsByTypename[typename] = rootId;\n // Finally, update the __typename associated with this rootId.\n this.rootTypenamesById[rootId] = typename;\n }\n };\n Policies.prototype.addPossibleTypes = function (possibleTypes) {\n var _this = this;\n this.usingPossibleTypes = true;\n Object.keys(possibleTypes).forEach(function (supertype) {\n // Make sure all types have an entry in this.supertypeMap, even if\n // their supertype set is empty, so we can return false immediately\n // from policies.fragmentMatches for unknown supertypes.\n _this.getSupertypeSet(supertype, true);\n possibleTypes[supertype].forEach(function (subtype) {\n _this.getSupertypeSet(subtype, true).add(supertype);\n var match = subtype.match(TypeOrFieldNameRegExp);\n if (!match || match[0] !== subtype) {\n // TODO Don't interpret just any invalid typename as a RegExp.\n _this.fuzzySubtypes.set(subtype, new RegExp(subtype));\n }\n });\n });\n };\n Policies.prototype.getTypePolicy = function (typename) {\n var _this = this;\n if (!hasOwn.call(this.typePolicies, typename)) {\n var policy_1 = (this.typePolicies[typename] = Object.create(null));\n policy_1.fields = Object.create(null);\n // When the TypePolicy for typename is first accessed, instead of\n // starting with an empty policy object, inherit any properties or\n // fields from the type policies of the supertypes of typename.\n //\n // Any properties or fields defined explicitly within the TypePolicy\n // for typename will take precedence, and if there are multiple\n // supertypes, the properties of policies whose types were added\n // later via addPossibleTypes will take precedence over those of\n // earlier supertypes. TODO Perhaps we should warn about these\n // conflicts in development, and recommend defining the property\n // explicitly in the subtype policy?\n //\n // Field policy inheritance is atomic/shallow: you can't inherit a\n // field policy and then override just its read function, since read\n // and merge functions often need to cooperate, so changing only one\n // of them would be a recipe for inconsistency.\n //\n // Once the TypePolicy for typename has been accessed, its properties can\n // still be updated directly using addTypePolicies, but future changes to\n // inherited supertype policies will not be reflected in this subtype\n // policy, because this code runs at most once per typename.\n var supertypes_1 = this.supertypeMap.get(typename);\n if (!supertypes_1 && this.fuzzySubtypes.size) {\n // To make the inheritance logic work for unknown typename strings that\n // may have fuzzy supertypes, we give this typename an empty supertype\n // set and then populate it with any fuzzy supertypes that match.\n supertypes_1 = this.getSupertypeSet(typename, true);\n // This only works for typenames that are directly matched by a fuzzy\n // supertype. What if there is an intermediate chain of supertypes?\n // While possible, that situation can only be solved effectively by\n // specifying the intermediate relationships via possibleTypes, manually\n // and in a non-fuzzy way.\n this.fuzzySubtypes.forEach(function (regExp, fuzzy) {\n if (regExp.test(typename)) {\n // The fuzzy parameter is just the original string version of regExp\n // (not a valid __typename string), but we can look up the\n // associated supertype(s) in this.supertypeMap.\n var fuzzySupertypes = _this.supertypeMap.get(fuzzy);\n if (fuzzySupertypes) {\n fuzzySupertypes.forEach(function (supertype) {\n return supertypes_1.add(supertype);\n });\n }\n }\n });\n }\n if (supertypes_1 && supertypes_1.size) {\n supertypes_1.forEach(function (supertype) {\n var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = __rest(_a, [\"fields\"]);\n Object.assign(policy_1, rest);\n Object.assign(policy_1.fields, fields);\n });\n }\n }\n var inbox = this.toBeAdded[typename];\n if (inbox && inbox.length) {\n // Merge the pending policies into this.typePolicies, in the order they\n // were originally passed to addTypePolicy.\n inbox.splice(0).forEach(function (policy) {\n _this.updateTypePolicy(typename, policy);\n });\n }\n return this.typePolicies[typename];\n };\n Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) {\n if (typename) {\n var fieldPolicies = this.getTypePolicy(typename).fields;\n return (fieldPolicies[fieldName] ||\n (createIfMissing && (fieldPolicies[fieldName] = Object.create(null))));\n }\n };\n Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) {\n var supertypeSet = this.supertypeMap.get(subtype);\n if (!supertypeSet && createIfMissing) {\n this.supertypeMap.set(subtype, (supertypeSet = new Set()));\n }\n return supertypeSet;\n };\n Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) {\n var _this = this;\n if (!fragment.typeCondition)\n return true;\n // If the fragment has a type condition but the object we're matching\n // against does not have a __typename, the fragment cannot match.\n if (!typename)\n return false;\n var supertype = fragment.typeCondition.name.value;\n // Common case: fragment type condition and __typename are the same.\n if (typename === supertype)\n return true;\n if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) {\n var typenameSupertypeSet = this.getSupertypeSet(typename, true);\n var workQueue_1 = [typenameSupertypeSet];\n var maybeEnqueue_1 = function (subtype) {\n var supertypeSet = _this.getSupertypeSet(subtype, false);\n if (supertypeSet &&\n supertypeSet.size &&\n workQueue_1.indexOf(supertypeSet) < 0) {\n workQueue_1.push(supertypeSet);\n }\n };\n // We need to check fuzzy subtypes only if we encountered fuzzy\n // subtype strings in addPossibleTypes, and only while writing to\n // the cache, since that's when selectionSetMatchesResult gives a\n // strong signal of fragment matching. The StoreReader class calls\n // policies.fragmentMatches without passing a result object, so\n // needToCheckFuzzySubtypes is always false while reading.\n var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size);\n var checkingFuzzySubtypes = false;\n // It's important to keep evaluating workQueue.length each time through\n // the loop, because the queue can grow while we're iterating over it.\n for (var i = 0; i < workQueue_1.length; ++i) {\n var supertypeSet = workQueue_1[i];\n if (supertypeSet.has(supertype)) {\n if (!typenameSupertypeSet.has(supertype)) {\n if (checkingFuzzySubtypes) {\n globalThis.__DEV__ !== false && invariant.warn(6, typename, supertype);\n }\n // Record positive results for faster future lookup.\n // Unfortunately, we cannot safely cache negative results,\n // because new possibleTypes data could always be added to the\n // Policies class.\n typenameSupertypeSet.add(supertype);\n }\n return true;\n }\n supertypeSet.forEach(maybeEnqueue_1);\n if (needToCheckFuzzySubtypes &&\n // Start checking fuzzy subtypes only after exhausting all\n // non-fuzzy subtypes (after the final iteration of the loop).\n i === workQueue_1.length - 1 &&\n // We could wait to compare fragment.selectionSet to result\n // after we verify the supertype, but this check is often less\n // expensive than that search, and we will have to do the\n // comparison anyway whenever we find a potential match.\n selectionSetMatchesResult(fragment.selectionSet, result, variables)) {\n // We don't always need to check fuzzy subtypes (if no result\n // was provided, or !this.fuzzySubtypes.size), but, when we do,\n // we only want to check them once.\n needToCheckFuzzySubtypes = false;\n checkingFuzzySubtypes = true;\n // If we find any fuzzy subtypes that match typename, extend the\n // workQueue to search through the supertypes of those fuzzy\n // subtypes. Otherwise the for-loop will terminate and we'll\n // return false below.\n this.fuzzySubtypes.forEach(function (regExp, fuzzyString) {\n var match = typename.match(regExp);\n if (match && match[0] === typename) {\n maybeEnqueue_1(fuzzyString);\n }\n });\n }\n }\n }\n return false;\n };\n Policies.prototype.hasKeyArgs = function (typename, fieldName) {\n var policy = this.getFieldPolicy(typename, fieldName, false);\n return !!(policy && policy.keyFn);\n };\n Policies.prototype.getStoreFieldName = function (fieldSpec) {\n var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName;\n var policy = this.getFieldPolicy(typename, fieldName, false);\n var storeFieldName;\n var keyFn = policy && policy.keyFn;\n if (keyFn && typename) {\n var context = {\n typename: typename,\n fieldName: fieldName,\n field: fieldSpec.field || null,\n variables: fieldSpec.variables,\n };\n var args = argsFromFieldSpecifier(fieldSpec);\n while (keyFn) {\n var specifierOrString = keyFn(args, context);\n if (isArray(specifierOrString)) {\n keyFn = keyArgsFnFromSpecifier(specifierOrString);\n }\n else {\n // If the custom keyFn returns a falsy value, fall back to\n // fieldName instead.\n storeFieldName = specifierOrString || fieldName;\n break;\n }\n }\n }\n if (storeFieldName === void 0) {\n storeFieldName =\n fieldSpec.field ?\n storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)\n : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));\n }\n // Returning false from a keyArgs function is like configuring\n // keyArgs: false, but more dynamic.\n if (storeFieldName === false) {\n return fieldName;\n }\n // Make sure custom field names start with the actual field.name.value\n // of the field, so we can always figure out which properties of a\n // StoreObject correspond to which original field names.\n return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName\n : fieldName + \":\" + storeFieldName;\n };\n Policies.prototype.readField = function (options, context) {\n var objectOrReference = options.from;\n if (!objectOrReference)\n return;\n var nameOrField = options.field || options.fieldName;\n if (!nameOrField)\n return;\n if (options.typename === void 0) {\n var typename = context.store.getFieldValue(objectOrReference, \"__typename\");\n if (typename)\n options.typename = typename;\n }\n var storeFieldName = this.getStoreFieldName(options);\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var existing = context.store.getFieldValue(objectOrReference, storeFieldName);\n var policy = this.getFieldPolicy(options.typename, fieldName, false);\n var read = policy && policy.read;\n if (read) {\n var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference) ?\n objectOrReference.__ref\n : objectOrReference, storeFieldName));\n // Call read(existing, readOptions) with cacheSlot holding this.cache.\n return cacheSlot.withValue(this.cache, read, [\n existing,\n readOptions,\n ]);\n }\n return existing;\n };\n Policies.prototype.getReadFunction = function (typename, fieldName) {\n var policy = this.getFieldPolicy(typename, fieldName, false);\n return policy && policy.read;\n };\n Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) {\n var policy = this.getFieldPolicy(parentTypename, fieldName, false);\n var merge = policy && policy.merge;\n if (!merge && childTypename) {\n policy = this.getTypePolicy(childTypename);\n merge = policy && policy.merge;\n }\n return merge;\n };\n Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) {\n var field = _a.field, typename = _a.typename, merge = _a.merge;\n if (merge === mergeTrueFn) {\n // Instead of going to the trouble of creating a full\n // FieldFunctionOptions object and calling mergeTrueFn, we can\n // simply call mergeObjects, as mergeTrueFn would.\n return makeMergeObjectsFunction(context.store)(existing, incoming);\n }\n if (merge === mergeFalseFn) {\n // Likewise for mergeFalseFn, whose implementation is even simpler.\n return incoming;\n }\n // If cache.writeQuery or cache.writeFragment was called with\n // options.overwrite set to true, we still call merge functions, but\n // the existing data is always undefined, so the merge function will\n // not attempt to combine the incoming data with the existing data.\n if (context.overwrite) {\n existing = void 0;\n }\n return merge(existing, incoming, makeFieldFunctionOptions(this, \n // Unlike options.readField for read functions, we do not fall\n // back to the current object if no foreignObjOrRef is provided,\n // because it's not clear what the current object should be for\n // merge functions: the (possibly undefined) existing object, or\n // the incoming object? If you think your merge function needs\n // to read sibling fields in order to produce a new value for\n // the current field, you might want to rethink your strategy,\n // because that's a recipe for making merge behavior sensitive\n // to the order in which fields are written into the cache.\n // However, readField(name, ref) is useful for merge functions\n // that need to deduplicate child objects and references.\n void 0, {\n typename: typename,\n fieldName: field.name.value,\n field: field,\n variables: context.variables,\n }, context, storage || Object.create(null)));\n };\n return Policies;\n}());\nexport { Policies };\nfunction makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) {\n var storeFieldName = policies.getStoreFieldName(fieldSpec);\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var variables = fieldSpec.variables || context.variables;\n var _a = context.store, toReference = _a.toReference, canRead = _a.canRead;\n return {\n args: argsFromFieldSpecifier(fieldSpec),\n field: fieldSpec.field || null,\n fieldName: fieldName,\n storeFieldName: storeFieldName,\n variables: variables,\n isReference: isReference,\n toReference: toReference,\n storage: storage,\n cache: policies.cache,\n canRead: canRead,\n readField: function () {\n return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context);\n },\n mergeObjects: makeMergeObjectsFunction(context.store),\n };\n}\nexport function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) {\n var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length;\n var options;\n if (typeof fieldNameOrOptions === \"string\") {\n options = {\n fieldName: fieldNameOrOptions,\n // Default to objectOrReference only when no second argument was\n // passed for the from parameter, not when undefined is explicitly\n // passed as the second argument.\n from: argc > 1 ? from : objectOrReference,\n };\n }\n else {\n options = __assign({}, fieldNameOrOptions);\n // Default to objectOrReference only when fieldNameOrOptions.from is\n // actually omitted, rather than just undefined.\n if (!hasOwn.call(options, \"from\")) {\n options.from = objectOrReference;\n }\n }\n if (globalThis.__DEV__ !== false && options.from === void 0) {\n globalThis.__DEV__ !== false && invariant.warn(7, stringifyForDisplay(Array.from(readFieldArgs)));\n }\n if (void 0 === options.variables) {\n options.variables = variables;\n }\n return options;\n}\nfunction makeMergeObjectsFunction(store) {\n return function mergeObjects(existing, incoming) {\n if (isArray(existing) || isArray(incoming)) {\n throw newInvariantError(8);\n }\n // These dynamic checks are necessary because the parameters of a\n // custom merge function can easily have the any type, so the type\n // system cannot always enforce the StoreObject | Reference parameter\n // types of options.mergeObjects.\n if (isNonNullObject(existing) && isNonNullObject(incoming)) {\n var eType = store.getFieldValue(existing, \"__typename\");\n var iType = store.getFieldValue(incoming, \"__typename\");\n var typesDiffer = eType && iType && eType !== iType;\n if (typesDiffer) {\n return incoming;\n }\n if (isReference(existing) && storeValueIsStoreObject(incoming)) {\n // Update the normalized EntityStore for the entity identified by\n // existing.__ref, preferring/overwriting any fields contributed by the\n // newer incoming StoreObject.\n store.merge(existing.__ref, incoming);\n return existing;\n }\n if (storeValueIsStoreObject(existing) && isReference(incoming)) {\n // Update the normalized EntityStore for the entity identified by\n // incoming.__ref, taking fields from the older existing object only if\n // those fields are not already present in the newer StoreObject\n // identified by incoming.__ref.\n store.merge(existing, incoming.__ref);\n return incoming;\n }\n if (storeValueIsStoreObject(existing) &&\n storeValueIsStoreObject(incoming)) {\n return __assign(__assign({}, existing), incoming);\n }\n }\n return incoming;\n };\n}\n//# sourceMappingURL=policies.js.map","import { __assign } from \"tslib\";\nimport { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { Trie } from \"@wry/trie\";\nimport { Kind } from \"graphql\";\nimport { getFragmentFromSelection, getDefaultValues, getOperationDefinition, getTypenameFromResult, makeReference, isField, resultKeyNameFromField, isReference, shouldInclude, cloneDeep, addTypenameToDocument, isNonEmptyArray, argumentsObjectFromField, canonicalStringify, } from \"../../utilities/index.js\";\nimport { isArray, makeProcessedFieldsMerger, fieldNameFromStoreName, storeValueIsStoreObject, extractFragmentContext, } from \"./helpers.js\";\nimport { normalizeReadFieldOptions } from \"./policies.js\";\n// Since there are only four possible combinations of context.clientOnly and\n// context.deferred values, we should need at most four \"flavors\" of any given\n// WriteContext. To avoid creating multiple copies of the same context, we cache\n// the contexts in the context.flavors Map (shared by all flavors) according to\n// their clientOnly and deferred values (always in that order).\nfunction getContextFlavor(context, clientOnly, deferred) {\n var key = \"\".concat(clientOnly).concat(deferred);\n var flavored = context.flavors.get(key);\n if (!flavored) {\n context.flavors.set(key, (flavored =\n context.clientOnly === clientOnly && context.deferred === deferred ?\n context\n : __assign(__assign({}, context), { clientOnly: clientOnly, deferred: deferred })));\n }\n return flavored;\n}\nvar StoreWriter = /** @class */ (function () {\n function StoreWriter(cache, reader, fragments) {\n this.cache = cache;\n this.reader = reader;\n this.fragments = fragments;\n }\n StoreWriter.prototype.writeToStore = function (store, _a) {\n var _this = this;\n var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite;\n var operationDefinition = getOperationDefinition(query);\n var merger = makeProcessedFieldsMerger();\n variables = __assign(__assign({}, getDefaultValues(operationDefinition)), variables);\n var context = __assign(__assign({ store: store, written: Object.create(null), merge: function (existing, incoming) {\n return merger.merge(existing, incoming);\n }, variables: variables, varString: canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() });\n var ref = this.processSelectionSet({\n result: result || Object.create(null),\n dataId: dataId,\n selectionSet: operationDefinition.selectionSet,\n mergeTree: { map: new Map() },\n context: context,\n });\n if (!isReference(ref)) {\n throw newInvariantError(11, result);\n }\n // So far, the store has not been modified, so now it's time to process\n // context.incomingById and merge those incoming fields into context.store.\n context.incomingById.forEach(function (_a, dataId) {\n var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;\n var entityRef = makeReference(dataId);\n if (mergeTree && mergeTree.map.size) {\n var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context);\n if (isReference(applied)) {\n // Assume References returned by applyMerges have already been merged\n // into the store. See makeMergeObjectsFunction in policies.ts for an\n // example of how this can happen.\n return;\n }\n // Otherwise, applyMerges returned a StoreObject, whose fields we should\n // merge into the store (see store.merge statement below).\n storeObject = applied;\n }\n if (globalThis.__DEV__ !== false && !context.overwrite) {\n var fieldsWithSelectionSets_1 = Object.create(null);\n fieldNodeSet.forEach(function (field) {\n if (field.selectionSet) {\n fieldsWithSelectionSets_1[field.name.value] = true;\n }\n });\n var hasSelectionSet_1 = function (storeFieldName) {\n return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] ===\n true;\n };\n var hasMergeFunction_1 = function (storeFieldName) {\n var childTree = mergeTree && mergeTree.map.get(storeFieldName);\n return Boolean(childTree && childTree.info && childTree.info.merge);\n };\n Object.keys(storeObject).forEach(function (storeFieldName) {\n // If a merge function was defined for this field, trust that it\n // did the right thing about (not) clobbering data. If the field\n // has no selection set, it's a scalar field, so it doesn't need\n // a merge function (even if it's an object, like JSON data).\n if (hasSelectionSet_1(storeFieldName) &&\n !hasMergeFunction_1(storeFieldName)) {\n warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store);\n }\n });\n }\n store.merge(dataId, storeObject);\n });\n // Any IDs written explicitly to the cache will be retained as\n // reachable root IDs for garbage collection purposes. Although this\n // logic includes root IDs like ROOT_QUERY and ROOT_MUTATION, their\n // retainment counts are effectively ignored because cache.gc() always\n // includes them in its root ID set.\n store.retain(ref.__ref);\n return ref;\n };\n StoreWriter.prototype.processSelectionSet = function (_a) {\n var _this = this;\n var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, \n // This object allows processSelectionSet to report useful information\n // to its callers without explicitly returning that information.\n mergeTree = _a.mergeTree;\n var policies = this.cache.policies;\n // This variable will be repeatedly updated using context.merge to\n // accumulate all fields that need to be written into the store.\n var incoming = Object.create(null);\n // If typename was not passed in, infer it. Note that typename is\n // always passed in for tricky-to-infer cases such as \"Query\" for\n // ROOT_QUERY.\n var typename = (dataId && policies.rootTypenamesById[dataId]) ||\n getTypenameFromResult(result, selectionSet, context.fragmentMap) ||\n (dataId && context.store.get(dataId, \"__typename\"));\n if (\"string\" === typeof typename) {\n incoming.__typename = typename;\n }\n // This readField function will be passed as context.readField in the\n // KeyFieldsContext object created within policies.identify (called below).\n // In addition to reading from the existing context.store (thanks to the\n // policies.readField(options, context) line at the very bottom), this\n // version of readField can read from Reference objects that are currently\n // pending in context.incomingById, which is important whenever keyFields\n // need to be extracted from a child object that processSelectionSet has\n // turned into a Reference.\n var readField = function () {\n var options = normalizeReadFieldOptions(arguments, incoming, context.variables);\n if (isReference(options.from)) {\n var info = context.incomingById.get(options.from.__ref);\n if (info) {\n var result_1 = policies.readField(__assign(__assign({}, options), { from: info.storeObject }), context);\n if (result_1 !== void 0) {\n return result_1;\n }\n }\n }\n return policies.readField(options, context);\n };\n var fieldNodeSet = new Set();\n this.flattenFields(selectionSet, result, \n // This WriteContext will be the default context value for fields returned\n // by the flattenFields method, but some fields may be assigned a modified\n // context, depending on the presence of @client and other directives.\n context, typename).forEach(function (context, field) {\n var _a;\n var resultFieldKey = resultKeyNameFromField(field);\n var value = result[resultFieldKey];\n fieldNodeSet.add(field);\n if (value !== void 0) {\n var storeFieldName = policies.getStoreFieldName({\n typename: typename,\n fieldName: field.name.value,\n field: field,\n variables: context.variables,\n });\n var childTree = getChildMergeTree(mergeTree, storeFieldName);\n var incomingValue = _this.processFieldValue(value, field, \n // Reset context.clientOnly and context.deferred to their default\n // values before processing nested selection sets.\n field.selectionSet ?\n getContextFlavor(context, false, false)\n : context, childTree);\n // To determine if this field holds a child object with a merge function\n // defined in its type policy (see PR #7070), we need to figure out the\n // child object's __typename.\n var childTypename = void 0;\n // The field's value can be an object that has a __typename only if the\n // field has a selection set. Otherwise incomingValue is scalar.\n if (field.selectionSet &&\n (isReference(incomingValue) || storeValueIsStoreObject(incomingValue))) {\n childTypename = readField(\"__typename\", incomingValue);\n }\n var merge = policies.getMergeFunction(typename, field.name.value, childTypename);\n if (merge) {\n childTree.info = {\n // TODO Check compatibility against any existing childTree.field?\n field: field,\n typename: typename,\n merge: merge,\n };\n }\n else {\n maybeRecycleChildMergeTree(mergeTree, storeFieldName);\n }\n incoming = context.merge(incoming, (_a = {},\n _a[storeFieldName] = incomingValue,\n _a));\n }\n else if (globalThis.__DEV__ !== false &&\n !context.clientOnly &&\n !context.deferred &&\n !addTypenameToDocument.added(field) &&\n // If the field has a read function, it may be a synthetic field or\n // provide a default value, so its absence from the written data should\n // not be cause for alarm.\n !policies.getReadFunction(typename, field.name.value)) {\n globalThis.__DEV__ !== false && invariant.error(12, resultKeyNameFromField(field), result);\n }\n });\n // Identify the result object, even if dataId was already provided,\n // since we always need keyObject below.\n try {\n var _b = policies.identify(result, {\n typename: typename,\n selectionSet: selectionSet,\n fragmentMap: context.fragmentMap,\n storeObject: incoming,\n readField: readField,\n }), id = _b[0], keyObject = _b[1];\n // If dataId was not provided, fall back to the id just generated by\n // policies.identify.\n dataId = dataId || id;\n // Write any key fields that were used during identification, even if\n // they were not mentioned in the original query.\n if (keyObject) {\n // TODO Reverse the order of the arguments?\n incoming = context.merge(incoming, keyObject);\n }\n }\n catch (e) {\n // If dataId was provided, tolerate failure of policies.identify.\n if (!dataId)\n throw e;\n }\n if (\"string\" === typeof dataId) {\n var dataRef = makeReference(dataId);\n // Avoid processing the same entity object using the same selection\n // set more than once. We use an array instead of a Set since most\n // entity IDs will be written using only one selection set, so the\n // size of this array is likely to be very small, meaning indexOf is\n // likely to be faster than Set.prototype.has.\n var sets = context.written[dataId] || (context.written[dataId] = []);\n if (sets.indexOf(selectionSet) >= 0)\n return dataRef;\n sets.push(selectionSet);\n // If we're about to write a result object into the store, but we\n // happen to know that the exact same (===) result object would be\n // returned if we were to reread the result with the same inputs,\n // then we can skip the rest of the processSelectionSet work for\n // this object, and immediately return a Reference to it.\n if (this.reader &&\n this.reader.isFresh(result, dataRef, selectionSet, context)) {\n return dataRef;\n }\n var previous_1 = context.incomingById.get(dataId);\n if (previous_1) {\n previous_1.storeObject = context.merge(previous_1.storeObject, incoming);\n previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree);\n fieldNodeSet.forEach(function (field) { return previous_1.fieldNodeSet.add(field); });\n }\n else {\n context.incomingById.set(dataId, {\n storeObject: incoming,\n // Save a reference to mergeTree only if it is not empty, because\n // empty MergeTrees may be recycled by maybeRecycleChildMergeTree and\n // reused for entirely different parts of the result tree.\n mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree,\n fieldNodeSet: fieldNodeSet,\n });\n }\n return dataRef;\n }\n return incoming;\n };\n StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) {\n var _this = this;\n if (!field.selectionSet || value === null) {\n // In development, we need to clone scalar values so that they can be\n // safely frozen with maybeDeepFreeze in readFromStore.ts. In production,\n // it's cheaper to store the scalar values directly in the cache.\n return globalThis.__DEV__ !== false ? cloneDeep(value) : value;\n }\n if (isArray(value)) {\n return value.map(function (item, i) {\n var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));\n maybeRecycleChildMergeTree(mergeTree, i);\n return value;\n });\n }\n return this.processSelectionSet({\n result: value,\n selectionSet: field.selectionSet,\n context: context,\n mergeTree: mergeTree,\n });\n };\n // Implements https://spec.graphql.org/draft/#sec-Field-Collection, but with\n // some additions for tracking @client and @defer directives.\n StoreWriter.prototype.flattenFields = function (selectionSet, result, context, typename) {\n if (typename === void 0) { typename = getTypenameFromResult(result, selectionSet, context.fragmentMap); }\n var fieldMap = new Map();\n var policies = this.cache.policies;\n var limitingTrie = new Trie(false); // No need for WeakMap, since limitingTrie does not escape.\n (function flatten(selectionSet, inheritedContext) {\n var visitedNode = limitingTrie.lookup(selectionSet, \n // Because we take inheritedClientOnly and inheritedDeferred into\n // consideration here (in addition to selectionSet), it's possible for\n // the same selection set to be flattened more than once, if it appears\n // in the query with different @client and/or @directive configurations.\n inheritedContext.clientOnly, inheritedContext.deferred);\n if (visitedNode.visited)\n return;\n visitedNode.visited = true;\n selectionSet.selections.forEach(function (selection) {\n if (!shouldInclude(selection, context.variables))\n return;\n var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;\n if (\n // Since the presence of @client or @defer on this field can only\n // cause clientOnly or deferred to become true, we can skip the\n // forEach loop if both clientOnly and deferred are already true.\n !(clientOnly && deferred) &&\n isNonEmptyArray(selection.directives)) {\n selection.directives.forEach(function (dir) {\n var name = dir.name.value;\n if (name === \"client\")\n clientOnly = true;\n if (name === \"defer\") {\n var args = argumentsObjectFromField(dir, context.variables);\n // The @defer directive takes an optional args.if boolean\n // argument, similar to @include(if: boolean). Note that\n // @defer(if: false) does not make context.deferred false, but\n // instead behaves as if there was no @defer directive.\n if (!args || args.if !== false) {\n deferred = true;\n }\n // TODO In the future, we may want to record args.label using\n // context.deferred, if a label is specified.\n }\n });\n }\n if (isField(selection)) {\n var existing = fieldMap.get(selection);\n if (existing) {\n // If this field has been visited along another recursive path\n // before, the final context should have clientOnly or deferred set\n // to true only if *all* paths have the directive (hence the &&).\n clientOnly = clientOnly && existing.clientOnly;\n deferred = deferred && existing.deferred;\n }\n fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred));\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.lookupFragment);\n if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {\n throw newInvariantError(13, selection.name.value);\n }\n if (fragment &&\n policies.fragmentMatches(fragment, typename, result, context.variables)) {\n flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred));\n }\n }\n });\n })(selectionSet, context);\n return fieldMap;\n };\n StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) {\n var _a;\n var _this = this;\n if (mergeTree.map.size && !isReference(incoming)) {\n var e_1 = \n // Items in the same position in different arrays are not\n // necessarily related to each other, so when incoming is an array\n // we process its elements as if there was no existing data.\n (!isArray(incoming) &&\n // Likewise, existing must be either a Reference or a StoreObject\n // in order for its fields to be safe to merge with the fields of\n // the incoming object.\n (isReference(existing) || storeValueIsStoreObject(existing))) ?\n existing\n : void 0;\n // This narrowing is implied by mergeTree.map.size > 0 and\n // !isReference(incoming), though TypeScript understandably cannot\n // hope to infer this type.\n var i_1 = incoming;\n // The options.storage objects provided to read and merge functions\n // are derived from the identity of the parent object plus a\n // sequence of storeFieldName strings/numbers identifying the nested\n // field name path of each field value to be merged.\n if (e_1 && !getStorageArgs) {\n getStorageArgs = [isReference(e_1) ? e_1.__ref : e_1];\n }\n // It's possible that applying merge functions to this subtree will\n // not change the incoming data, so this variable tracks the fields\n // that did change, so we can create a new incoming object when (and\n // only when) at least one incoming field has changed. We use a Map\n // to preserve the type of numeric keys.\n var changedFields_1;\n var getValue_1 = function (from, name) {\n return (isArray(from) ?\n typeof name === \"number\" ?\n from[name]\n : void 0\n : context.store.getFieldValue(from, String(name)));\n };\n mergeTree.map.forEach(function (childTree, storeFieldName) {\n var eVal = getValue_1(e_1, storeFieldName);\n var iVal = getValue_1(i_1, storeFieldName);\n // If we have no incoming data, leave any existing data untouched.\n if (void 0 === iVal)\n return;\n if (getStorageArgs) {\n getStorageArgs.push(storeFieldName);\n }\n var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs);\n if (aVal !== iVal) {\n changedFields_1 = changedFields_1 || new Map();\n changedFields_1.set(storeFieldName, aVal);\n }\n if (getStorageArgs) {\n invariant(getStorageArgs.pop() === storeFieldName);\n }\n });\n if (changedFields_1) {\n // Shallow clone i so we can add changed fields to it.\n incoming = (isArray(i_1) ? i_1.slice(0) : __assign({}, i_1));\n changedFields_1.forEach(function (value, name) {\n incoming[name] = value;\n });\n }\n }\n if (mergeTree.info) {\n return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs));\n }\n return incoming;\n };\n return StoreWriter;\n}());\nexport { StoreWriter };\nvar emptyMergeTreePool = [];\nfunction getChildMergeTree(_a, name) {\n var map = _a.map;\n if (!map.has(name)) {\n map.set(name, emptyMergeTreePool.pop() || { map: new Map() });\n }\n return map.get(name);\n}\nfunction mergeMergeTrees(left, right) {\n if (left === right || !right || mergeTreeIsEmpty(right))\n return left;\n if (!left || mergeTreeIsEmpty(left))\n return right;\n var info = left.info && right.info ? __assign(__assign({}, left.info), right.info) : left.info || right.info;\n var needToMergeMaps = left.map.size && right.map.size;\n var map = needToMergeMaps ? new Map()\n : left.map.size ? left.map\n : right.map;\n var merged = { info: info, map: map };\n if (needToMergeMaps) {\n var remainingRightKeys_1 = new Set(right.map.keys());\n left.map.forEach(function (leftTree, key) {\n merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key)));\n remainingRightKeys_1.delete(key);\n });\n remainingRightKeys_1.forEach(function (key) {\n merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key)));\n });\n }\n return merged;\n}\nfunction mergeTreeIsEmpty(tree) {\n return !tree || !(tree.info || tree.map.size);\n}\nfunction maybeRecycleChildMergeTree(_a, name) {\n var map = _a.map;\n var childTree = map.get(name);\n if (childTree && mergeTreeIsEmpty(childTree)) {\n emptyMergeTreePool.push(childTree);\n map.delete(name);\n }\n}\nvar warnings = new Set();\n// Note that this function is unused in production, and thus should be\n// pruned by any well-configured minifier.\nfunction warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {\n var getChild = function (objOrRef) {\n var child = store.getFieldValue(objOrRef, storeFieldName);\n return typeof child === \"object\" && child;\n };\n var existing = getChild(existingRef);\n if (!existing)\n return;\n var incoming = getChild(incomingObj);\n if (!incoming)\n return;\n // It's always safe to replace a reference, since it refers to data\n // safely stored elsewhere.\n if (isReference(existing))\n return;\n // If the values are structurally equivalent, we do not need to worry\n // about incoming replacing existing.\n if (equal(existing, incoming))\n return;\n // If we're replacing every key of the existing object, then the\n // existing data would be overwritten even if the objects were\n // normalized, so warning would not be helpful here.\n if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) {\n return;\n }\n var parentType = store.getFieldValue(existingRef, \"__typename\") ||\n store.getFieldValue(incomingObj, \"__typename\");\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var typeDotName = \"\".concat(parentType, \".\").concat(fieldName);\n // Avoid warning more than once for the same type and field name.\n if (warnings.has(typeDotName))\n return;\n warnings.add(typeDotName);\n var childTypenames = [];\n // Arrays do not have __typename fields, and always need a custom merge\n // function, even if their elements are normalized entities.\n if (!isArray(existing) && !isArray(incoming)) {\n [existing, incoming].forEach(function (child) {\n var typename = store.getFieldValue(child, \"__typename\");\n if (typeof typename === \"string\" && !childTypenames.includes(typename)) {\n childTypenames.push(typename);\n }\n });\n }\n globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length ?\n \"either ensure all objects of type \" +\n childTypenames.join(\" and \") +\n \" have an ID or a custom merge function, or \"\n : \"\", typeDotName, existing, incoming);\n}\n//# sourceMappingURL=writeToStore.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n// Make builtins like Map and Set safe to use with non-extensible objects.\nimport \"./fixPolyfills.js\";\nimport { wrap } from \"optimism\";\nimport { equal } from \"@wry/equality\";\nimport { ApolloCache } from \"../core/cache.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport { addTypenameToDocument, isReference, DocumentTransform, canonicalStringify, print, cacheSizes, } from \"../../utilities/index.js\";\nimport { StoreReader } from \"./readFromStore.js\";\nimport { StoreWriter } from \"./writeToStore.js\";\nimport { EntityStore, supportsResultCaching } from \"./entityStore.js\";\nimport { makeVar, forgetCache, recallCache } from \"./reactiveVars.js\";\nimport { Policies } from \"./policies.js\";\nimport { hasOwn, normalizeConfig, shouldCanonizeResults } from \"./helpers.js\";\nimport { getInMemoryCacheMemoryInternals } from \"../../utilities/caching/getMemoryInternals.js\";\nvar InMemoryCache = /** @class */ (function (_super) {\n __extends(InMemoryCache, _super);\n function InMemoryCache(config) {\n if (config === void 0) { config = {}; }\n var _this = _super.call(this) || this;\n _this.watches = new Set();\n _this.addTypenameTransform = new DocumentTransform(addTypenameToDocument);\n // Override the default value, since InMemoryCache result objects are frozen\n // in development and expected to remain logically immutable in production.\n _this.assumeImmutableResults = true;\n _this.makeVar = makeVar;\n _this.txCount = 0;\n _this.config = normalizeConfig(config);\n _this.addTypename = !!_this.config.addTypename;\n _this.policies = new Policies({\n cache: _this,\n dataIdFromObject: _this.config.dataIdFromObject,\n possibleTypes: _this.config.possibleTypes,\n typePolicies: _this.config.typePolicies,\n });\n _this.init();\n return _this;\n }\n InMemoryCache.prototype.init = function () {\n // Passing { resultCaching: false } in the InMemoryCache constructor options\n // will completely disable dependency tracking, which will improve memory\n // usage but worsen the performance of repeated reads.\n var rootStore = (this.data = new EntityStore.Root({\n policies: this.policies,\n resultCaching: this.config.resultCaching,\n }));\n // When no optimistic writes are currently active, cache.optimisticData ===\n // cache.data, so there are no additional layers on top of the actual data.\n // When an optimistic update happens, this.optimisticData will become a\n // linked list of EntityStore Layer objects that terminates with the\n // original this.data cache object.\n this.optimisticData = rootStore.stump;\n this.resetResultCache();\n };\n InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) {\n var _this = this;\n var previousReader = this.storeReader;\n var fragments = this.config.fragments;\n // The StoreWriter is mostly stateless and so doesn't really need to be\n // reset, but it does need to have its writer.storeReader reference updated,\n // so it's simpler to update this.storeWriter as well.\n this.storeWriter = new StoreWriter(this, (this.storeReader = new StoreReader({\n cache: this,\n addTypename: this.addTypename,\n resultCacheMaxSize: this.config.resultCacheMaxSize,\n canonizeResults: shouldCanonizeResults(this.config),\n canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon),\n fragments: fragments,\n })), fragments);\n this.maybeBroadcastWatch = wrap(function (c, options) {\n return _this.broadcastWatch(c, options);\n }, {\n max: this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] ||\n 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n makeCacheKey: function (c) {\n // Return a cache key (thus enabling result caching) only if we're\n // currently using a data store that can track cache dependencies.\n var store = c.optimistic ? _this.optimisticData : _this.data;\n if (supportsResultCaching(store)) {\n var optimistic = c.optimistic, id = c.id, variables = c.variables;\n return store.makeCacheKey(c.query, \n // Different watches can have the same query, optimistic\n // status, rootId, and variables, but if their callbacks are\n // different, the (identical) result needs to be delivered to\n // each distinct callback. The easiest way to achieve that\n // separation is to include c.callback in the cache key for\n // maybeBroadcastWatch calls. See issue #5733.\n c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));\n }\n },\n });\n // Since we have thrown away all the cached functions that depend on the\n // CacheGroup dependencies maintained by EntityStore, we should also reset\n // all CacheGroup dependency information.\n new Set([this.data.group, this.optimisticData.group]).forEach(function (group) {\n return group.resetCaching();\n });\n };\n InMemoryCache.prototype.restore = function (data) {\n this.init();\n // Since calling this.init() discards/replaces the entire StoreReader, along\n // with the result caches it maintains, this.data.replace(data) won't have\n // to bother deleting the old data.\n if (data)\n this.data.replace(data);\n return this;\n };\n InMemoryCache.prototype.extract = function (optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return (optimistic ? this.optimisticData : this.data).extract();\n };\n InMemoryCache.prototype.read = function (options) {\n var \n // Since read returns data or null, without any additional metadata\n // about whether/where there might have been missing fields, the\n // default behavior cannot be returnPartialData = true (like it is\n // for the diff method), since defaulting to true would violate the\n // integrity of the T in the return type. However, partial data may\n // be useful in some cases, so returnPartialData:true may be\n // specified explicitly.\n _a = options.returnPartialData, \n // Since read returns data or null, without any additional metadata\n // about whether/where there might have been missing fields, the\n // default behavior cannot be returnPartialData = true (like it is\n // for the diff method), since defaulting to true would violate the\n // integrity of the T in the return type. However, partial data may\n // be useful in some cases, so returnPartialData:true may be\n // specified explicitly.\n returnPartialData = _a === void 0 ? false : _a;\n try {\n return (this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null);\n }\n catch (e) {\n if (e instanceof MissingFieldError) {\n // Swallow MissingFieldError and return null, so callers do not need to\n // worry about catching \"normal\" exceptions resulting from incomplete\n // cache data. Unexpected errors will be re-thrown. If you need more\n // information about which fields were missing, use cache.diff instead,\n // and examine diffResult.missing.\n return null;\n }\n throw e;\n }\n };\n InMemoryCache.prototype.write = function (options) {\n try {\n ++this.txCount;\n return this.storeWriter.writeToStore(this.data, options);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.modify = function (options) {\n if (hasOwn.call(options, \"id\") && !options.id) {\n // To my knowledge, TypeScript does not currently provide a way to\n // enforce that an optional property?:type must *not* be undefined\n // when present. That ability would be useful here, because we want\n // options.id to default to ROOT_QUERY only when no options.id was\n // provided. If the caller attempts to pass options.id with a\n // falsy/undefined value (perhaps because cache.identify failed), we\n // should not assume the goal was to modify the ROOT_QUERY object.\n // We could throw, but it seems natural to return false to indicate\n // that nothing was modified.\n return false;\n }\n var store = ((options.optimistic) // Defaults to false.\n ) ?\n this.optimisticData\n : this.data;\n try {\n ++this.txCount;\n return store.modify(options.id || \"ROOT_QUERY\", options.fields);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.diff = function (options) {\n return this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || \"ROOT_QUERY\", config: this.config }));\n };\n InMemoryCache.prototype.watch = function (watch) {\n var _this = this;\n if (!this.watches.size) {\n // In case we previously called forgetCache(this) because\n // this.watches became empty (see below), reattach this cache to any\n // reactive variables on which it previously depended. It might seem\n // paradoxical that we're able to recall something we supposedly\n // forgot, but the point of calling forgetCache(this) is to silence\n // useless broadcasts while this.watches is empty, and to allow the\n // cache to be garbage collected. If, however, we manage to call\n // recallCache(this) here, this cache object must not have been\n // garbage collected yet, and should resume receiving updates from\n // reactive variables, now that it has a watcher to notify.\n recallCache(this);\n }\n this.watches.add(watch);\n if (watch.immediate) {\n this.maybeBroadcastWatch(watch);\n }\n return function () {\n // Once we remove the last watch from this.watches, cache.broadcastWatches\n // no longer does anything, so we preemptively tell the reactive variable\n // system to exclude this cache from future broadcasts.\n if (_this.watches.delete(watch) && !_this.watches.size) {\n forgetCache(_this);\n }\n // Remove this watch from the LRU cache managed by the\n // maybeBroadcastWatch OptimisticWrapperFunction, to prevent memory\n // leaks involving the closure of watch.callback.\n _this.maybeBroadcastWatch.forget(watch);\n };\n };\n InMemoryCache.prototype.gc = function (options) {\n var _a;\n canonicalStringify.reset();\n print.reset();\n this.addTypenameTransform.resetCache();\n (_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches();\n var ids = this.optimisticData.gc();\n if (options && !this.txCount) {\n if (options.resetResultCache) {\n this.resetResultCache(options.resetResultIdentities);\n }\n else if (options.resetResultIdentities) {\n this.storeReader.resetCanon();\n }\n }\n return ids;\n };\n // Call this method to ensure the given root ID remains in the cache after\n // garbage collection, along with its transitive child entities. Note that\n // the cache automatically retains all directly written entities. By default,\n // the retainment persists after optimistic updates are removed. Pass true\n // for the optimistic argument if you would prefer for the retainment to be\n // discarded when the top-most optimistic layer is removed. Returns the\n // resulting (non-negative) retainment count.\n InMemoryCache.prototype.retain = function (rootId, optimistic) {\n return (optimistic ? this.optimisticData : this.data).retain(rootId);\n };\n // Call this method to undo the effect of the retain method, above. Once the\n // retainment count falls to zero, the given ID will no longer be preserved\n // during garbage collection, though it may still be preserved by other safe\n // entities that refer to it. Returns the resulting (non-negative) retainment\n // count, in case that's useful.\n InMemoryCache.prototype.release = function (rootId, optimistic) {\n return (optimistic ? this.optimisticData : this.data).release(rootId);\n };\n // Returns the canonical ID for a given StoreObject, obeying typePolicies\n // and keyFields (and dataIdFromObject, if you still use that). At minimum,\n // the object must contain a __typename and any primary key fields required\n // to identify entities of that type. If you pass a query result object, be\n // sure that none of the primary key fields have been renamed by aliasing.\n // If you pass a Reference object, its __ref ID string will be returned.\n InMemoryCache.prototype.identify = function (object) {\n if (isReference(object))\n return object.__ref;\n try {\n return this.policies.identify(object)[0];\n }\n catch (e) {\n globalThis.__DEV__ !== false && invariant.warn(e);\n }\n };\n InMemoryCache.prototype.evict = function (options) {\n if (!options.id) {\n if (hasOwn.call(options, \"id\")) {\n // See comment in modify method about why we return false when\n // options.id exists but is falsy/undefined.\n return false;\n }\n options = __assign(__assign({}, options), { id: \"ROOT_QUERY\" });\n }\n try {\n // It's unlikely that the eviction will end up invoking any other\n // cache update operations while it's running, but {in,de}crementing\n // this.txCount still seems like a good idea, for uniformity with\n // the other update methods.\n ++this.txCount;\n // Pass this.data as a limit on the depth of the eviction, so evictions\n // during optimistic updates (when this.data is temporarily set equal to\n // this.optimisticData) do not escape their optimistic Layer.\n return this.optimisticData.evict(options, this.data);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.reset = function (options) {\n var _this = this;\n this.init();\n canonicalStringify.reset();\n if (options && options.discardWatches) {\n // Similar to what happens in the unsubscribe function returned by\n // cache.watch, applied to all current watches.\n this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); });\n this.watches.clear();\n forgetCache(this);\n }\n else {\n // Calling this.init() above unblocks all maybeBroadcastWatch caching, so\n // this.broadcastWatches() triggers a broadcast to every current watcher\n // (letting them know their data is now missing). This default behavior is\n // convenient because it means the watches do not have to be manually\n // reestablished after resetting the cache. To prevent this broadcast and\n // cancel all watches, pass true for options.discardWatches.\n this.broadcastWatches();\n }\n return Promise.resolve();\n };\n InMemoryCache.prototype.removeOptimistic = function (idToRemove) {\n var newOptimisticData = this.optimisticData.removeLayer(idToRemove);\n if (newOptimisticData !== this.optimisticData) {\n this.optimisticData = newOptimisticData;\n this.broadcastWatches();\n }\n };\n InMemoryCache.prototype.batch = function (options) {\n var _this = this;\n var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated;\n var updateResult;\n var perform = function (layer) {\n var _a = _this, data = _a.data, optimisticData = _a.optimisticData;\n ++_this.txCount;\n if (layer) {\n _this.data = _this.optimisticData = layer;\n }\n try {\n return (updateResult = update(_this));\n }\n finally {\n --_this.txCount;\n _this.data = data;\n _this.optimisticData = optimisticData;\n }\n };\n var alreadyDirty = new Set();\n if (onWatchUpdated && !this.txCount) {\n // If an options.onWatchUpdated callback is provided, we want to call it\n // with only the Cache.WatchOptions objects affected by options.update,\n // but there might be dirty watchers already waiting to be broadcast that\n // have nothing to do with the update. To prevent including those watchers\n // in the post-update broadcast, we perform this initial broadcast to\n // collect the dirty watchers, so we can re-dirty them later, after the\n // post-update broadcast, allowing them to receive their pending\n // broadcasts the next time broadcastWatches is called, just as they would\n // if we never called cache.batch.\n this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch) {\n alreadyDirty.add(watch);\n return false;\n } }));\n }\n if (typeof optimistic === \"string\") {\n // Note that there can be multiple layers with the same optimistic ID.\n // When removeOptimistic(id) is called for that id, all matching layers\n // will be removed, and the remaining layers will be reapplied.\n this.optimisticData = this.optimisticData.addLayer(optimistic, perform);\n }\n else if (optimistic === false) {\n // Ensure both this.data and this.optimisticData refer to the root\n // (non-optimistic) layer of the cache during the update. Note that\n // this.data could be a Layer if we are currently executing an optimistic\n // update function, but otherwise will always be an EntityStore.Root\n // instance.\n perform(this.data);\n }\n else {\n // Otherwise, leave this.data and this.optimisticData unchanged and run\n // the update with broadcast batching.\n perform();\n }\n if (typeof removeOptimistic === \"string\") {\n this.optimisticData = this.optimisticData.removeLayer(removeOptimistic);\n }\n // Note: if this.txCount > 0, then alreadyDirty.size === 0, so this code\n // takes the else branch and calls this.broadcastWatches(options), which\n // does nothing when this.txCount > 0.\n if (onWatchUpdated && alreadyDirty.size) {\n this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch, diff) {\n var result = onWatchUpdated.call(this, watch, diff);\n if (result !== false) {\n // Since onWatchUpdated did not return false, this diff is\n // about to be broadcast to watch.callback, so we don't need\n // to re-dirty it with the other alreadyDirty watches below.\n alreadyDirty.delete(watch);\n }\n return result;\n } }));\n // Silently re-dirty any watches that were already dirty before the update\n // was performed, and were not broadcast just now.\n if (alreadyDirty.size) {\n alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); });\n }\n }\n else {\n // If alreadyDirty is empty or we don't have an onWatchUpdated\n // function, we don't need to go to the trouble of wrapping\n // options.onWatchUpdated.\n this.broadcastWatches(options);\n }\n return updateResult;\n };\n InMemoryCache.prototype.performTransaction = function (update, optimisticId) {\n return this.batch({\n update: update,\n optimistic: optimisticId || optimisticId !== null,\n });\n };\n InMemoryCache.prototype.transformDocument = function (document) {\n return this.addTypenameToDocument(this.addFragmentsToDocument(document));\n };\n InMemoryCache.prototype.broadcastWatches = function (options) {\n var _this = this;\n if (!this.txCount) {\n this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); });\n }\n };\n InMemoryCache.prototype.addFragmentsToDocument = function (document) {\n var fragments = this.config.fragments;\n return fragments ? fragments.transform(document) : document;\n };\n InMemoryCache.prototype.addTypenameToDocument = function (document) {\n if (this.addTypename) {\n return this.addTypenameTransform.transformDocument(document);\n }\n return document;\n };\n // This method is wrapped by maybeBroadcastWatch, which is called by\n // broadcastWatches, so that we compute and broadcast results only when\n // the data that would be broadcast might have changed. It would be\n // simpler to check for changes after recomputing a result but before\n // broadcasting it, but this wrapping approach allows us to skip both\n // the recomputation and the broadcast, in most cases.\n InMemoryCache.prototype.broadcastWatch = function (c, options) {\n var lastDiff = c.lastDiff;\n // Both WatchOptions and DiffOptions extend ReadOptions, and DiffOptions\n // currently requires no additional properties, so we can use c (a\n // WatchOptions object) as DiffOptions, without having to allocate a new\n // object, and without having to enumerate the relevant properties (query,\n // variables, etc.) explicitly. There will be some additional properties\n // (lastDiff, callback, etc.), but cache.diff ignores them.\n var diff = this.diff(c);\n if (options) {\n if (c.optimistic && typeof options.optimistic === \"string\") {\n diff.fromOptimisticTransaction = true;\n }\n if (options.onWatchUpdated &&\n options.onWatchUpdated.call(this, c, diff, lastDiff) === false) {\n // Returning false from the onWatchUpdated callback will prevent\n // calling c.callback(diff) for this watcher.\n return;\n }\n }\n if (!lastDiff || !equal(lastDiff.result, diff.result)) {\n c.callback((c.lastDiff = diff), lastDiff);\n }\n };\n return InMemoryCache;\n}(ApolloCache));\nexport { InMemoryCache };\nif (globalThis.__DEV__ !== false) {\n InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals;\n}\n//# sourceMappingURL=inMemoryCache.js.map","/**\n * The current status of a query’s execution in our system.\n */\nexport var NetworkStatus;\n(function (NetworkStatus) {\n /**\n * The query has never been run before and the query is now currently running. A query will still\n * have this network status even if a partial data result was returned from the cache, but a\n * query was dispatched anyway.\n */\n NetworkStatus[NetworkStatus[\"loading\"] = 1] = \"loading\";\n /**\n * If `setVariables` was called and a query was fired because of that then the network status\n * will be `setVariables` until the result of that query comes back.\n */\n NetworkStatus[NetworkStatus[\"setVariables\"] = 2] = \"setVariables\";\n /**\n * Indicates that `fetchMore` was called on this query and that the query created is currently in\n * flight.\n */\n NetworkStatus[NetworkStatus[\"fetchMore\"] = 3] = \"fetchMore\";\n /**\n * Similar to the `setVariables` network status. It means that `refetch` was called on a query\n * and the refetch request is currently in flight.\n */\n NetworkStatus[NetworkStatus[\"refetch\"] = 4] = \"refetch\";\n /**\n * Indicates that a polling query is currently in flight. So for example if you are polling a\n * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever\n * a poll request has been sent but not resolved.\n */\n NetworkStatus[NetworkStatus[\"poll\"] = 6] = \"poll\";\n /**\n * No request is in flight for this query, and no errors happened. Everything is OK.\n */\n NetworkStatus[NetworkStatus[\"ready\"] = 7] = \"ready\";\n /**\n * No request is in flight for this query, but one or more errors were detected.\n */\n NetworkStatus[NetworkStatus[\"error\"] = 8] = \"error\";\n})(NetworkStatus || (NetworkStatus = {}));\n/**\n * Returns true if there is currently a network request in flight according to a given network\n * status.\n */\nexport function isNetworkRequestInFlight(networkStatus) {\n return networkStatus ? networkStatus < 7 : false;\n}\n/**\n * Returns true if the network request is in ready or error state according to a given network\n * status.\n */\nexport function isNetworkRequestSettled(networkStatus) {\n return networkStatus === 7 || networkStatus === 8;\n}\n//# sourceMappingURL=networkStatus.js.map","import { __rest } from \"tslib\";\nimport equal from \"@wry/equality\";\nimport { createFragmentMap, getFragmentDefinitions, getFragmentFromSelection, getMainDefinition, isField, resultKeyNameFromField, shouldInclude, } from \"../utilities/index.js\";\n// Returns true if aResult and bResult are deeply equal according to the fields\n// selected by the given query, ignoring any fields marked as @nonreactive.\nexport function equalByQuery(query, _a, _b, variables) {\n var aData = _a.data, aRest = __rest(_a, [\"data\"]);\n var bData = _b.data, bRest = __rest(_b, [\"data\"]);\n return (equal(aRest, bRest) &&\n equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {\n fragmentMap: createFragmentMap(getFragmentDefinitions(query)),\n variables: variables,\n }));\n}\nfunction equalBySelectionSet(selectionSet, aResult, bResult, context) {\n if (aResult === bResult) {\n return true;\n }\n var seenSelections = new Set();\n // Returning true from this Array.prototype.every callback function skips the\n // current field/subtree. Returning false aborts the entire traversal\n // immediately, causing equalBySelectionSet to return false.\n return selectionSet.selections.every(function (selection) {\n // Avoid re-processing the same selection at the same level of recursion, in\n // case the same field gets included via multiple indirect fragment spreads.\n if (seenSelections.has(selection))\n return true;\n seenSelections.add(selection);\n // Ignore @skip(if: true) and @include(if: false) fields.\n if (!shouldInclude(selection, context.variables))\n return true;\n // If the field or (named) fragment spread has a @nonreactive directive on\n // it, we don't care if it's different, so we pretend it's the same.\n if (selectionHasNonreactiveDirective(selection))\n return true;\n if (isField(selection)) {\n var resultKey = resultKeyNameFromField(selection);\n var aResultChild = aResult && aResult[resultKey];\n var bResultChild = bResult && bResult[resultKey];\n var childSelectionSet = selection.selectionSet;\n if (!childSelectionSet) {\n // These are scalar values, so we can compare them with deep equal\n // without redoing the main recursive work.\n return equal(aResultChild, bResultChild);\n }\n var aChildIsArray = Array.isArray(aResultChild);\n var bChildIsArray = Array.isArray(bResultChild);\n if (aChildIsArray !== bChildIsArray)\n return false;\n if (aChildIsArray && bChildIsArray) {\n var length_1 = aResultChild.length;\n if (bResultChild.length !== length_1) {\n return false;\n }\n for (var i = 0; i < length_1; ++i) {\n if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) {\n return false;\n }\n }\n return true;\n }\n return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context);\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.fragmentMap);\n if (fragment) {\n // The fragment might === selection if it's an inline fragment, but\n // could be !== if it's a named fragment ...spread.\n if (selectionHasNonreactiveDirective(fragment))\n return true;\n return equalBySelectionSet(fragment.selectionSet, \n // Notice that we reuse the same aResult and bResult values here,\n // since the fragment ...spread does not specify a field name, but\n // consists of multiple fields (within the fragment's selection set)\n // that should be applied to the current result value(s).\n aResult, bResult, context);\n }\n }\n });\n}\nfunction selectionHasNonreactiveDirective(selection) {\n return (!!selection.directives && selection.directives.some(directiveIsNonreactive));\n}\nfunction directiveIsNonreactive(dir) {\n return dir.name.value === \"nonreactive\";\n}\n//# sourceMappingURL=equalByQuery.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport { cloneDeep, compact, getOperationDefinition, Observable, iterateObserversSafely, fixObservableSubclass, getQueryDefinition, } from \"../utilities/index.js\";\nimport { equalByQuery } from \"./equalByQuery.js\";\nvar assign = Object.assign, hasOwnProperty = Object.hasOwnProperty;\nvar ObservableQuery = /** @class */ (function (_super) {\n __extends(ObservableQuery, _super);\n function ObservableQuery(_a) {\n var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;\n var _this = _super.call(this, function (observer) {\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = observer._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n }\n catch (_a) { }\n var first = !_this.observers.size;\n _this.observers.add(observer);\n // Deliver most recent error or result.\n var last = _this.last;\n if (last && last.error) {\n observer.error && observer.error(last.error);\n }\n else if (last && last.result) {\n observer.next && observer.next(last.result);\n }\n // Initiate observation of this query if it hasn't been reported to\n // the QueryManager yet.\n if (first) {\n // Blindly catching here prevents unhandled promise rejections,\n // and is safe because the ObservableQuery handles this error with\n // this.observer.error, so we're not just swallowing the error by\n // ignoring it here.\n _this.reobserve().catch(function () { });\n }\n return function () {\n if (_this.observers.delete(observer) && !_this.observers.size) {\n _this.tearDownQuery();\n }\n };\n }) || this;\n _this.observers = new Set();\n _this.subscriptions = new Set();\n // related classes\n _this.queryInfo = queryInfo;\n _this.queryManager = queryManager;\n // active state\n _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);\n _this.isTornDown = false;\n var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? \"cache-first\" : _d;\n var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, \n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n _f = options.initialFetchPolicy, \n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n initialFetchPolicy = _f === void 0 ? fetchPolicy === \"standby\" ? defaultFetchPolicy : (fetchPolicy) : _f;\n _this.options = __assign(__assign({}, options), { \n // Remember the initial options.fetchPolicy so we can revert back to this\n // policy when variables change. This information can also be specified\n // (or overridden) by providing options.initialFetchPolicy explicitly.\n initialFetchPolicy: initialFetchPolicy, \n // This ensures this.options.fetchPolicy always has a string value, in\n // case options.fetchPolicy was not provided.\n fetchPolicy: fetchPolicy });\n _this.queryId = queryInfo.queryId || queryManager.generateQueryId();\n var opDef = getOperationDefinition(_this.query);\n _this.queryName = opDef && opDef.name && opDef.name.value;\n return _this;\n }\n Object.defineProperty(ObservableQuery.prototype, \"query\", {\n // The `query` computed property will always reflect the document transformed\n // by the last run query. `this.options.query` will always reflect the raw\n // untransformed query to ensure document transforms with runtime conditionals\n // are run on the original document.\n get: function () {\n return this.lastQuery || this.options.query;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ObservableQuery.prototype, \"variables\", {\n // Computed shorthand for this.options.variables, preserved for\n // backwards compatibility.\n /**\n * An object containing the variables that were provided for the query.\n */\n get: function () {\n return this.options.variables;\n },\n enumerable: false,\n configurable: true\n });\n ObservableQuery.prototype.result = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n // TODO: this code doesn’t actually make sense insofar as the observer\n // will never exist in this.observers due how zen-observable wraps observables.\n // https://github.com/zenparsing/zen-observable/blob/master/src/Observable.js#L169\n var observer = {\n next: function (result) {\n resolve(result);\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n _this.observers.delete(observer);\n if (!_this.observers.size) {\n _this.queryManager.removeQuery(_this.queryId);\n }\n setTimeout(function () {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n var subscription = _this.subscribe(observer);\n });\n };\n /** @internal */\n ObservableQuery.prototype.resetDiff = function () {\n this.queryInfo.resetDiff();\n };\n ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) {\n if (saveAsLastResult === void 0) { saveAsLastResult = true; }\n // Use the last result as long as the variables match this.variables.\n var lastResult = this.getLastResult(true);\n var networkStatus = this.queryInfo.networkStatus ||\n (lastResult && lastResult.networkStatus) ||\n NetworkStatus.ready;\n var result = __assign(__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });\n var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a;\n if (\n // These fetch policies should never deliver data from the cache, unless\n // redelivering a previously delivered result.\n skipCacheDataFor(fetchPolicy) ||\n // If this.options.query has @client(always: true) fields, we cannot\n // trust diff.result, since it was read from the cache without running\n // local resolvers (and it's too late to run resolvers now, since we must\n // return a result synchronously).\n this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) {\n // Fall through.\n }\n else if (this.waitForOwnResult) {\n // This would usually be a part of `QueryInfo.getDiff()`.\n // which we skip in the waitForOwnResult case since we are not\n // interested in the diff.\n this.queryInfo[\"updateWatch\"]();\n }\n else {\n var diff = this.queryInfo.getDiff();\n if (diff.complete || this.options.returnPartialData) {\n result.data = diff.result;\n }\n if (equal(result.data, {})) {\n result.data = void 0;\n }\n if (diff.complete) {\n // Similar to setting result.partial to false, but taking advantage of the\n // falsiness of missing fields.\n delete result.partial;\n // If the diff is complete, and we're using a FetchPolicy that\n // terminates after a complete cache read, we can assume the next result\n // we receive will have NetworkStatus.ready and !loading.\n if (diff.complete &&\n result.networkStatus === NetworkStatus.loading &&\n (fetchPolicy === \"cache-first\" || fetchPolicy === \"cache-only\")) {\n result.networkStatus = NetworkStatus.ready;\n result.loading = false;\n }\n }\n else {\n result.partial = true;\n }\n if (globalThis.__DEV__ !== false &&\n !diff.complete &&\n !this.options.partialRefetch &&\n !result.loading &&\n !result.data &&\n !result.error) {\n logMissingFieldErrors(diff.missing);\n }\n }\n if (saveAsLastResult) {\n this.updateLastResult(result);\n }\n return result;\n };\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) {\n if (!this.last) {\n return true;\n }\n var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ?\n !equalByQuery(this.query, this.last.result, newResult, this.variables)\n : !equal(this.last.result, newResult);\n return (resultIsDifferent || (variables && !equal(this.last.variables, variables)));\n };\n ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {\n var last = this.last;\n if (last &&\n last[key] &&\n (!variablesMustMatch || equal(last.variables, this.variables))) {\n return last[key];\n }\n };\n ObservableQuery.prototype.getLastResult = function (variablesMustMatch) {\n return this.getLast(\"result\", variablesMustMatch);\n };\n ObservableQuery.prototype.getLastError = function (variablesMustMatch) {\n return this.getLast(\"error\", variablesMustMatch);\n };\n ObservableQuery.prototype.resetLastResults = function () {\n delete this.last;\n this.isTornDown = false;\n };\n ObservableQuery.prototype.resetQueryStoreErrors = function () {\n this.queryManager.resetErrors(this.queryId);\n };\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n ObservableQuery.prototype.refetch = function (variables) {\n var _a;\n var reobserveOptions = {\n // Always disable polling for refetches.\n pollInterval: 0,\n };\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n var fetchPolicy = this.options.fetchPolicy;\n if (fetchPolicy === \"cache-and-network\") {\n reobserveOptions.fetchPolicy = fetchPolicy;\n }\n else if (fetchPolicy === \"no-cache\") {\n reobserveOptions.fetchPolicy = \"no-cache\";\n }\n else {\n reobserveOptions.fetchPolicy = \"network-only\";\n }\n if (globalThis.__DEV__ !== false && variables && hasOwnProperty.call(variables, \"variables\")) {\n var queryDef = getQueryDefinition(this.query);\n var vars = queryDef.variableDefinitions;\n if (!vars || !vars.some(function (v) { return v.variable.name.value === \"variables\"; })) {\n globalThis.__DEV__ !== false && invariant.warn(\n 20,\n variables,\n ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef\n );\n }\n }\n if (variables && !equal(this.options.variables, variables)) {\n // Update the existing options with new variables\n reobserveOptions.variables = this.options.variables = __assign(__assign({}, this.options.variables), variables);\n }\n this.queryInfo.resetLastWrite();\n return this.reobserve(reobserveOptions, NetworkStatus.refetch);\n };\n /**\n * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).\n */\n ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {\n var _this = this;\n var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (__assign(__assign(__assign(__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: __assign(__assign({}, this.options.variables), fetchMoreOptions.variables) })))), { \n // The fetchMore request goes immediately to the network and does\n // not automatically write its result to the cache (hence no-cache\n // instead of network-only), because we allow the caller of\n // fetchMore to provide an updateQuery callback that determines how\n // the data gets written to the cache.\n fetchPolicy: \"no-cache\" });\n combinedOptions.query = this.transformDocument(combinedOptions.query);\n var qid = this.queryManager.generateQueryId();\n // If a temporary query is passed to `fetchMore`, we don't want to store\n // it as the last query result since it may be an optimized query for\n // pagination. We will however run the transforms on the original document\n // as well as the document passed in `fetchMoreOptions` to ensure the cache\n // uses the most up-to-date document which may rely on runtime conditionals.\n this.lastQuery =\n fetchMoreOptions.query ?\n this.transformDocument(this.options.query)\n : combinedOptions.query;\n // Simulate a loading result for the original query with\n // result.networkStatus === NetworkStatus.fetchMore.\n var queryInfo = this.queryInfo;\n var originalNetworkStatus = queryInfo.networkStatus;\n queryInfo.networkStatus = NetworkStatus.fetchMore;\n if (combinedOptions.notifyOnNetworkStatusChange) {\n this.observe();\n }\n var updatedQuerySet = new Set();\n return this.queryManager\n .fetchQuery(qid, combinedOptions, NetworkStatus.fetchMore)\n .then(function (fetchMoreResult) {\n _this.queryManager.removeQuery(qid);\n if (queryInfo.networkStatus === NetworkStatus.fetchMore) {\n queryInfo.networkStatus = originalNetworkStatus;\n }\n // Performing this cache update inside a cache.batch transaction ensures\n // any affected cache.watch watchers are notified at most once about any\n // updates. Most watchers will be using the QueryInfo class, which\n // responds to notifications by calling reobserveCacheFirst to deliver\n // fetchMore cache results back to this ObservableQuery.\n _this.queryManager.cache.batch({\n update: function (cache) {\n var updateQuery = fetchMoreOptions.updateQuery;\n if (updateQuery) {\n cache.updateQuery({\n query: _this.query,\n variables: _this.variables,\n returnPartialData: true,\n optimistic: false,\n }, function (previous) {\n return updateQuery(previous, {\n fetchMoreResult: fetchMoreResult.data,\n variables: combinedOptions.variables,\n });\n });\n }\n else {\n // If we're using a field policy instead of updateQuery, the only\n // thing we need to do is write the new data to the cache using\n // combinedOptions.variables (instead of this.variables, which is\n // what this.updateQuery uses, because it works by abusing the\n // original field value, keyed by the original variables).\n cache.writeQuery({\n query: combinedOptions.query,\n variables: combinedOptions.variables,\n data: fetchMoreResult.data,\n });\n }\n },\n onWatchUpdated: function (watch) {\n // Record the DocumentNode associated with any watched query whose\n // data were updated by the cache writes above.\n updatedQuerySet.add(watch.query);\n },\n });\n return fetchMoreResult;\n })\n .finally(function () {\n // In case the cache writes above did not generate a broadcast\n // notification (which would have been intercepted by onWatchUpdated),\n // likely because the written data were the same as what was already in\n // the cache, we still want fetchMore to deliver its final loading:false\n // result with the unchanged data.\n if (!updatedQuerySet.has(_this.query)) {\n reobserveCacheFirst(_this);\n }\n });\n };\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n /**\n * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.\n *\n * This function returns _another_ function that you can call to terminate the subscription.\n */\n ObservableQuery.prototype.subscribeToMore = function (options) {\n var _this = this;\n var subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n context: options.context,\n })\n .subscribe({\n next: function (subscriptionData) {\n var updateQuery = options.updateQuery;\n if (updateQuery) {\n _this.updateQuery(function (previous, _a) {\n var variables = _a.variables;\n return updateQuery(previous, {\n subscriptionData: subscriptionData,\n variables: variables,\n });\n });\n }\n },\n error: function (err) {\n if (options.onError) {\n options.onError(err);\n return;\n }\n globalThis.__DEV__ !== false && invariant.error(21, err);\n },\n });\n this.subscriptions.add(subscription);\n return function () {\n if (_this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n };\n ObservableQuery.prototype.setOptions = function (newOptions) {\n return this.reobserve(newOptions);\n };\n ObservableQuery.prototype.silentSetOptions = function (newOptions) {\n var mergedOptions = compact(this.options, newOptions || {});\n assign(this.options, mergedOptions);\n };\n /**\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. Most users should prefer `refetch` instead of\n * `setVariables` in order to to be properly notified of results even when\n * they come from the cache.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n ObservableQuery.prototype.setVariables = function (variables) {\n if (equal(this.variables, variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size ? this.result() : Promise.resolve();\n }\n this.options.variables = variables;\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n return this.reobserve({\n // Reset options.fetchPolicy to its original value.\n fetchPolicy: this.options.initialFetchPolicy,\n variables: variables,\n }, NetworkStatus.setVariables);\n };\n /**\n * A function that enables you to update the query's cached result without executing a followup GraphQL operation.\n *\n * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.\n */\n ObservableQuery.prototype.updateQuery = function (mapFn) {\n var queryManager = this.queryManager;\n var result = queryManager.cache.diff({\n query: this.options.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n var newResult = mapFn(result, {\n variables: this.variables,\n });\n if (newResult) {\n queryManager.cache.writeQuery({\n query: this.options.query,\n data: newResult,\n variables: this.variables,\n });\n queryManager.broadcastQueries();\n }\n };\n /**\n * A function that instructs the query to begin re-executing at a specified interval (in milliseconds).\n */\n ObservableQuery.prototype.startPolling = function (pollInterval) {\n this.options.pollInterval = pollInterval;\n this.updatePolling();\n };\n /**\n * A function that instructs the query to stop polling after a previous call to `startPolling`.\n */\n ObservableQuery.prototype.stopPolling = function () {\n this.options.pollInterval = 0;\n this.updatePolling();\n };\n // Update options.fetchPolicy according to options.nextFetchPolicy.\n ObservableQuery.prototype.applyNextFetchPolicy = function (reason, \n // It's possible to use this method to apply options.nextFetchPolicy to\n // options.fetchPolicy even if options !== this.options, though that happens\n // most often when the options are temporary, used for only one request and\n // then thrown away, so nextFetchPolicy may not end up mattering.\n options) {\n if (options.nextFetchPolicy) {\n var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;\n if (fetchPolicy === \"standby\") {\n // Do nothing, leaving options.fetchPolicy unchanged.\n }\n else if (typeof options.nextFetchPolicy === \"function\") {\n // When someone chooses \"cache-and-network\" or \"network-only\" as their\n // initial FetchPolicy, they often do not want future cache updates to\n // trigger unconditional network requests, which is what repeatedly\n // applying the \"cache-and-network\" or \"network-only\" policies would\n // seem to imply. Instead, when the cache reports an update after the\n // initial network request, it may be desirable for subsequent network\n // requests to be triggered only if the cache result is incomplete. To\n // that end, the options.nextFetchPolicy option provides an easy way to\n // update options.fetchPolicy after the initial network request, without\n // having to call observableQuery.setOptions.\n options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {\n reason: reason,\n options: options,\n observable: this,\n initialFetchPolicy: initialFetchPolicy,\n });\n }\n else if (reason === \"variables-changed\") {\n options.fetchPolicy = initialFetchPolicy;\n }\n else {\n options.fetchPolicy = options.nextFetchPolicy;\n }\n }\n return options.fetchPolicy;\n };\n ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {\n // TODO Make sure we update the networkStatus (and infer fetchVariables)\n // before actually committing to the fetch.\n this.queryManager.setObservableQuery(this);\n return this.queryManager[\"fetchConcastWithInfo\"](this.queryId, options, newNetworkStatus, query);\n };\n // Turns polling on or off based on this.options.pollInterval.\n ObservableQuery.prototype.updatePolling = function () {\n var _this = this;\n // Avoid polling in SSR mode\n if (this.queryManager.ssrMode) {\n return;\n }\n var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval;\n if (!pollInterval) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n if (pollingInfo && pollingInfo.interval === pollInterval) {\n return;\n }\n invariant(pollInterval, 22);\n var info = pollingInfo || (this.pollingInfo = {});\n info.interval = pollInterval;\n var maybeFetch = function () {\n var _a, _b;\n if (_this.pollingInfo) {\n if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) &&\n !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) {\n _this.reobserve({\n // Most fetchPolicy options don't make sense to use in a polling context, as\n // users wouldn't want to be polling the cache directly. However, network-only and\n // no-cache are both useful for when the user wants to control whether or not the\n // polled results are written to the cache.\n fetchPolicy: _this.options.initialFetchPolicy === \"no-cache\" ?\n \"no-cache\"\n : \"network-only\",\n }, NetworkStatus.poll).then(poll, poll);\n }\n else {\n poll();\n }\n }\n };\n var poll = function () {\n var info = _this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n poll();\n };\n ObservableQuery.prototype.updateLastResult = function (newResult, variables) {\n if (variables === void 0) { variables = this.variables; }\n var error = this.getLastError();\n // Preserve this.last.error unless the variables have changed.\n if (error && this.last && !equal(variables, this.last.variables)) {\n error = void 0;\n }\n return (this.last = __assign({ result: this.queryManager.assumeImmutableResults ?\n newResult\n : cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));\n };\n ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {\n var _this = this;\n this.isTornDown = false;\n var useDisposableConcast = \n // Refetching uses a disposable Concast to allow refetches using different\n // options/variables, without permanently altering the options of the\n // original ObservableQuery.\n newNetworkStatus === NetworkStatus.refetch ||\n // The fetchMore method does not actually call the reobserve method, but,\n // if it did, it would definitely use a disposable Concast.\n newNetworkStatus === NetworkStatus.fetchMore ||\n // Polling uses a disposable Concast so the polling options (which force\n // fetchPolicy to be \"network-only\" or \"no-cache\") won't override the original options.\n newNetworkStatus === NetworkStatus.poll;\n // Save the old variables, since Object.assign may modify them below.\n var oldVariables = this.options.variables;\n var oldFetchPolicy = this.options.fetchPolicy;\n var mergedOptions = compact(this.options, newOptions || {});\n var options = useDisposableConcast ?\n // Disposable Concast fetches receive a shallow copy of this.options\n // (merged with newOptions), leaving this.options unmodified.\n mergedOptions\n : assign(this.options, mergedOptions);\n // Don't update options.query with the transformed query to avoid\n // overwriting this.options.query when we aren't using a disposable concast.\n // We want to ensure we can re-run the custom document transforms the next\n // time a request is made against the original query.\n var query = this.transformDocument(options.query);\n this.lastQuery = query;\n if (!useDisposableConcast) {\n // We can skip calling updatePolling if we're not changing this.options.\n this.updatePolling();\n // Reset options.fetchPolicy to its original value when variables change,\n // unless a new fetchPolicy was provided by newOptions.\n if (newOptions &&\n newOptions.variables &&\n !equal(newOptions.variables, oldVariables) &&\n // Don't mess with the fetchPolicy if it's currently \"standby\".\n options.fetchPolicy !== \"standby\" &&\n // If we're changing the fetchPolicy anyway, don't try to change it here\n // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.\n options.fetchPolicy === oldFetchPolicy) {\n this.applyNextFetchPolicy(\"variables-changed\", options);\n if (newNetworkStatus === void 0) {\n newNetworkStatus = NetworkStatus.setVariables;\n }\n }\n }\n this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));\n var finishWaitingForOwnResult = function () {\n if (_this.concast === concast) {\n _this.waitForOwnResult = false;\n }\n };\n var variables = options.variables && __assign({}, options.variables);\n var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;\n var observer = {\n next: function (result) {\n if (equal(_this.variables, variables)) {\n finishWaitingForOwnResult();\n _this.reportResult(result, variables);\n }\n },\n error: function (error) {\n if (equal(_this.variables, variables)) {\n finishWaitingForOwnResult();\n _this.reportError(error, variables);\n }\n },\n };\n if (!useDisposableConcast && (fromLink || !this.concast)) {\n // We use the {add,remove}Observer methods directly to avoid wrapping\n // observer with an unnecessary SubscriptionObserver object.\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n }\n this.concast = concast;\n this.observer = observer;\n }\n concast.addObserver(observer);\n return concast;\n };\n ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {\n return this.reobserveAsConcast(newOptions, newNetworkStatus)\n .promise;\n };\n ObservableQuery.prototype.resubscribeAfterError = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // If `lastError` is set in the current when the subscription is re-created,\n // the subscription will immediately receive the error, which will\n // cause it to terminate again. To avoid this, we first clear\n // the last error/result from the `observableQuery` before re-starting\n // the subscription, and restore the last value afterwards so that the\n // subscription has a chance to stay open.\n var last = this.last;\n this.resetLastResults();\n var subscription = this.subscribe.apply(this, args);\n this.last = last;\n return subscription;\n };\n // (Re)deliver the current result to this.observers without applying fetch\n // policies or making network requests.\n ObservableQuery.prototype.observe = function () {\n this.reportResult(\n // Passing false is important so that this.getCurrentResult doesn't\n // save the fetchMore result as this.lastResult, causing it to be\n // ignored due to the this.isDifferentFromLastResult check in\n // this.reportResult.\n this.getCurrentResult(false), this.variables);\n };\n ObservableQuery.prototype.reportResult = function (result, variables) {\n var lastError = this.getLastError();\n var isDifferent = this.isDifferentFromLastResult(result, variables);\n // Update the last result even when isDifferentFromLastResult returns false,\n // because the query may be using the @nonreactive directive, and we want to\n // save the the latest version of any nonreactive subtrees (in case\n // getCurrentResult is called), even though we skip broadcasting changes.\n if (lastError || !result.partial || this.options.returnPartialData) {\n this.updateLastResult(result, variables);\n }\n if (lastError || isDifferent) {\n iterateObserversSafely(this.observers, \"next\", result);\n }\n };\n ObservableQuery.prototype.reportError = function (error, variables) {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n var errorResult = __assign(__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: NetworkStatus.error, loading: false });\n this.updateLastResult(errorResult, variables);\n iterateObserversSafely(this.observers, \"error\", (this.last.error = error));\n };\n ObservableQuery.prototype.hasObservers = function () {\n return this.observers.size > 0;\n };\n ObservableQuery.prototype.tearDownQuery = function () {\n if (this.isTornDown)\n return;\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n delete this.observer;\n }\n this.stopPolling();\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });\n this.subscriptions.clear();\n this.queryManager.stopQuery(this.queryId);\n this.observers.clear();\n this.isTornDown = true;\n };\n ObservableQuery.prototype.transformDocument = function (document) {\n return this.queryManager.transform(document);\n };\n return ObservableQuery;\n}(Observable));\nexport { ObservableQuery };\n// Necessary because the ObservableQuery constructor has a different\n// signature than the Observable constructor.\nfixObservableSubclass(ObservableQuery);\n// Reobserve with fetchPolicy effectively set to \"cache-first\", triggering\n// delivery of any new data from the cache, possibly falling back to the network\n// if any cache data are missing. This allows _complete_ cache results to be\n// delivered without also kicking off unnecessary network requests when\n// this.options.fetchPolicy is \"cache-and-network\" or \"network-only\". When\n// this.options.fetchPolicy is any other policy (\"cache-first\", \"cache-only\",\n// \"standby\", or \"no-cache\"), we call this.reobserve() as usual.\nexport function reobserveCacheFirst(obsQuery) {\n var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy;\n if (fetchPolicy === \"cache-and-network\" || fetchPolicy === \"network-only\") {\n return obsQuery.reobserve({\n fetchPolicy: \"cache-first\",\n // Use a temporary nextFetchPolicy function that replaces itself with the\n // previous nextFetchPolicy value and returns the original fetchPolicy.\n nextFetchPolicy: function (currentFetchPolicy, context) {\n // Replace this nextFetchPolicy function in the options object with the\n // original this.options.nextFetchPolicy value.\n this.nextFetchPolicy = nextFetchPolicy;\n // If the original nextFetchPolicy value was a function, give it a\n // chance to decide what happens here.\n if (typeof this.nextFetchPolicy === \"function\") {\n return this.nextFetchPolicy(currentFetchPolicy, context);\n }\n // Otherwise go back to the original this.options.fetchPolicy.\n return fetchPolicy;\n },\n });\n }\n return obsQuery.reobserve();\n}\nfunction defaultSubscriptionObserverErrorCallback(error) {\n globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack);\n}\nexport function logMissingFieldErrors(missing) {\n if (globalThis.__DEV__ !== false && missing) {\n globalThis.__DEV__ !== false && invariant.debug(24, missing);\n }\n}\nfunction skipCacheDataFor(fetchPolicy /* `undefined` would mean `\"cache-first\"` */) {\n return (fetchPolicy === \"network-only\" ||\n fetchPolicy === \"no-cache\" ||\n fetchPolicy === \"standby\");\n}\n//# sourceMappingURL=ObservableQuery.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { visit, BREAK, isSelectionNode } from \"graphql\";\nimport { argumentsObjectFromField, buildQueryFromSelectionSet, createFragmentMap, getFragmentDefinitions, getMainDefinition, hasDirectives, isField, isInlineFragment, mergeDeep, mergeDeepArray, removeClientSetsFromDocument, resultKeyNameFromField, shouldInclude, } from \"../utilities/index.js\";\nimport { cacheSlot } from \"../cache/index.js\";\nvar LocalState = /** @class */ (function () {\n function LocalState(_a) {\n var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;\n this.selectionsToResolveCache = new WeakMap();\n this.cache = cache;\n if (client) {\n this.client = client;\n }\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n LocalState.prototype.addResolvers = function (resolvers) {\n var _this = this;\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach(function (resolverGroup) {\n _this.resolvers = mergeDeep(_this.resolvers, resolverGroup);\n });\n }\n else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n };\n LocalState.prototype.setResolvers = function (resolvers) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n };\n LocalState.prototype.getResolvers = function () {\n return this.resolvers || {};\n };\n // Run local client resolvers against the incoming query and remote data.\n // Locally resolved field values are merged with the incoming remote data,\n // and returned. Note that locally resolved fields will overwrite\n // remote data using the same field name.\n LocalState.prototype.runResolvers = function (_a) {\n var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b;\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_c) {\n if (document) {\n return [2 /*return*/, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (__assign(__assign({}, remoteResult), { data: localResult.result })); })];\n }\n return [2 /*return*/, remoteResult];\n });\n });\n };\n LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n };\n LocalState.prototype.getFragmentMatcher = function () {\n return this.fragmentMatcher;\n };\n // Client queries contain everything in the incoming document (if a @client\n // directive is found).\n LocalState.prototype.clientQuery = function (document) {\n if (hasDirectives([\"client\"], document)) {\n if (this.resolvers) {\n return document;\n }\n }\n return null;\n };\n // Server queries are stripped of all @client based selection sets.\n LocalState.prototype.serverQuery = function (document) {\n return removeClientSetsFromDocument(document);\n };\n LocalState.prototype.prepareContext = function (context) {\n var cache = this.cache;\n return __assign(__assign({}, context), { cache: cache, \n // Getting an entry's cache key is useful for local state resolvers.\n getCacheKey: function (obj) {\n return cache.identify(obj);\n } });\n };\n // To support `@client @export(as: \"someVar\")` syntax, we'll first resolve\n // @client @export fields locally, then pass the resolved values back to be\n // used alongside the original operation variables.\n LocalState.prototype.addExportedVariables = function (document, variables, context) {\n if (variables === void 0) { variables = {}; }\n if (context === void 0) { context = {}; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (document) {\n return [2 /*return*/, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (__assign(__assign({}, variables), data.exportedVariables)); })];\n }\n return [2 /*return*/, __assign({}, variables)];\n });\n });\n };\n LocalState.prototype.shouldForceResolvers = function (document) {\n var forceResolvers = false;\n visit(document, {\n Directive: {\n enter: function (node) {\n if (node.name.value === \"client\" && node.arguments) {\n forceResolvers = node.arguments.some(function (arg) {\n return arg.name.value === \"always\" &&\n arg.value.kind === \"BooleanValue\" &&\n arg.value.value === true;\n });\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n };\n // Query the cache and return matching data.\n LocalState.prototype.buildRootValueFromCache = function (document, variables) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables: variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n };\n LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) {\n if (context === void 0) { context = {}; }\n if (variables === void 0) { variables = {}; }\n if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }\n if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }\n return __awaiter(this, void 0, void 0, function () {\n var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;\n return __generator(this, function (_b) {\n mainDefinition = getMainDefinition(document);\n fragments = getFragmentDefinitions(document);\n fragmentMap = createFragmentMap(fragments);\n selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);\n definitionOperation = mainDefinition.operation;\n defaultOperationType = definitionOperation ?\n definitionOperation.charAt(0).toUpperCase() +\n definitionOperation.slice(1)\n : \"Query\";\n _a = this, cache = _a.cache, client = _a.client;\n execContext = {\n fragmentMap: fragmentMap,\n context: __assign(__assign({}, context), { cache: cache, client: client }),\n variables: variables,\n fragmentMatcher: fragmentMatcher,\n defaultOperationType: defaultOperationType,\n exportedVariables: {},\n selectionsToResolve: selectionsToResolve,\n onlyRunForcedResolvers: onlyRunForcedResolvers,\n };\n isClientFieldDescendant = false;\n return [2 /*return*/, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({\n result: result,\n exportedVariables: execContext.exportedVariables,\n }); })];\n });\n });\n };\n LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) {\n return __awaiter(this, void 0, void 0, function () {\n var fragmentMap, context, variables, resultsToMerge, execute;\n var _this = this;\n return __generator(this, function (_a) {\n fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables;\n resultsToMerge = [rootValue];\n execute = function (selection) { return __awaiter(_this, void 0, void 0, function () {\n var fragment, typeCondition;\n return __generator(this, function (_a) {\n if (!isClientFieldDescendant &&\n !execContext.selectionsToResolve.has(selection)) {\n // Skip selections without @client directives\n // (still processing if one of the ancestors or one of the child fields has @client directive)\n return [2 /*return*/];\n }\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely.\n return [2 /*return*/];\n }\n if (isField(selection)) {\n return [2 /*return*/, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {\n var _a;\n if (typeof fieldResult !== \"undefined\") {\n resultsToMerge.push((_a = {},\n _a[resultKeyNameFromField(selection)] = fieldResult,\n _a));\n }\n })];\n }\n if (isInlineFragment(selection)) {\n fragment = selection;\n }\n else {\n // This is a named fragment.\n fragment = fragmentMap[selection.name.value];\n invariant(fragment, 18, selection.name.value);\n }\n if (fragment && fragment.typeCondition) {\n typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return [2 /*return*/, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {\n resultsToMerge.push(fragmentResult);\n })];\n }\n }\n return [2 /*return*/];\n });\n }); };\n return [2 /*return*/, Promise.all(selectionSet.selections.map(execute)).then(function () {\n return mergeDeepArray(resultsToMerge);\n })];\n });\n });\n };\n LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) {\n return __awaiter(this, void 0, void 0, function () {\n var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;\n var _this = this;\n return __generator(this, function (_a) {\n if (!rootValue) {\n return [2 /*return*/, null];\n }\n variables = execContext.variables;\n fieldName = field.name.value;\n aliasedFieldName = resultKeyNameFromField(field);\n aliasUsed = fieldName !== aliasedFieldName;\n defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n resultPromise = Promise.resolve(defaultResult);\n // Usually all local resolvers are run when passing through here, but\n // if we've specifically identified that we only want to run forced\n // resolvers (that is, resolvers for fields marked with\n // `@client(always: true)`), then we'll skip running non-forced resolvers.\n if (!execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)) {\n resolverType = rootValue.__typename || execContext.defaultOperationType;\n resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(\n // In case the resolve function accesses reactive variables,\n // set cacheSlot to the current cache instance.\n cacheSlot.withValue(this.cache, resolve, [\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field: field, fragmentMap: execContext.fragmentMap },\n ]));\n }\n }\n }\n return [2 /*return*/, resultPromise.then(function (result) {\n var _a, _b;\n if (result === void 0) { result = defaultResult; }\n // If an @export directive is associated with the current field, store\n // the `as` export variable name and current result for later use.\n if (field.directives) {\n field.directives.forEach(function (directive) {\n if (directive.name.value === \"export\" && directive.arguments) {\n directive.arguments.forEach(function (arg) {\n if (arg.name.value === \"as\" && arg.value.kind === \"StringValue\") {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n // Handle all scalar types here.\n if (!field.selectionSet) {\n return result;\n }\n // From here down, the field has a selection set, which means it's trying\n // to query a GraphQLObjectType.\n if (result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return result;\n }\n var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === \"client\"; })) !== null && _b !== void 0 ? _b : false;\n if (Array.isArray(result)) {\n return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);\n }\n // Returned value is an object, and the query has a sub-selection. Recurse.\n if (field.selectionSet) {\n return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext);\n }\n })];\n });\n });\n };\n LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) {\n var _this = this;\n return Promise.all(result.map(function (item) {\n if (item === null) {\n return null;\n }\n // This is a nested array, recurse.\n if (Array.isArray(item)) {\n return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext);\n }\n // This is an object, run the selection set on it.\n if (field.selectionSet) {\n return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext);\n }\n }));\n };\n // Collect selection nodes on paths from document root down to all @client directives.\n // This function takes into account transitive fragment spreads.\n // Complexity equals to a single `visit` over the full document.\n LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) {\n var isSingleASTNode = function (node) { return !Array.isArray(node); };\n var selectionsToResolveCache = this.selectionsToResolveCache;\n function collectByDefinition(definitionNode) {\n if (!selectionsToResolveCache.has(definitionNode)) {\n var matches_1 = new Set();\n selectionsToResolveCache.set(definitionNode, matches_1);\n visit(definitionNode, {\n Directive: function (node, _, __, ___, ancestors) {\n if (node.name.value === \"client\") {\n ancestors.forEach(function (node) {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches_1.add(node);\n }\n });\n }\n },\n FragmentSpread: function (spread, _, __, ___, ancestors) {\n var fragment = fragmentMap[spread.name.value];\n invariant(fragment, 19, spread.name.value);\n var fragmentSelections = collectByDefinition(fragment);\n if (fragmentSelections.size > 0) {\n // Fragment for this spread contains @client directive (either directly or transitively)\n // Collect selection nodes on paths from the root down to fields with the @client directive\n ancestors.forEach(function (node) {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches_1.add(node);\n }\n });\n matches_1.add(spread);\n fragmentSelections.forEach(function (selection) {\n matches_1.add(selection);\n });\n }\n },\n });\n }\n return selectionsToResolveCache.get(definitionNode);\n }\n return collectByDefinition(mainDefinition);\n };\n return LocalState;\n}());\nexport { LocalState };\n//# sourceMappingURL=LocalState.js.map","import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { DeepMerger } from \"../utilities/index.js\";\nimport { mergeIncrementalData } from \"../utilities/index.js\";\nimport { reobserveCacheFirst } from \"./ObservableQuery.js\";\nimport { isNonEmptyArray, graphQLResultHasError, canUseWeakMap, } from \"../utilities/index.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nvar destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)();\nfunction wrapDestructiveCacheMethod(cache, methodName) {\n var original = cache[methodName];\n if (typeof original === \"function\") {\n // @ts-expect-error this is just too generic to be typed correctly\n cache[methodName] = function () {\n destructiveMethodCounts.set(cache, \n // The %1e15 allows the count to wrap around to 0 safely every\n // quadrillion evictions, so there's no risk of overflow. To be\n // clear, this is more of a pedantic principle than something\n // that matters in any conceivable practical scenario.\n (destructiveMethodCounts.get(cache) + 1) % 1e15);\n // @ts-expect-error this is just too generic to be typed correctly\n return original.apply(this, arguments);\n };\n }\n}\nfunction cancelNotifyTimeout(info) {\n if (info[\"notifyTimeout\"]) {\n clearTimeout(info[\"notifyTimeout\"]);\n info[\"notifyTimeout\"] = void 0;\n }\n}\n// A QueryInfo object represents a single query managed by the\n// QueryManager, which tracks all QueryInfo objects by queryId in its\n// this.queries Map. QueryInfo objects store the latest results and errors\n// for the given query, and are responsible for reporting those results to\n// the corresponding ObservableQuery, via the QueryInfo.notify method.\n// Results are reported asynchronously whenever setDiff marks the\n// QueryInfo object as dirty, though a call to the QueryManager's\n// broadcastQueries method may trigger the notification before it happens\n// automatically. This class used to be a simple interface type without\n// any field privacy or meaningful methods, which is why it still has so\n// many public fields. The effort to lock down and simplify the QueryInfo\n// interface is ongoing, and further improvements are welcome.\nvar QueryInfo = /** @class */ (function () {\n function QueryInfo(queryManager, queryId) {\n if (queryId === void 0) { queryId = queryManager.generateQueryId(); }\n this.queryId = queryId;\n this.listeners = new Set();\n this.document = null;\n this.lastRequestId = 1;\n this.stopped = false;\n this.dirty = false;\n this.observableQuery = null;\n var cache = (this.cache = queryManager.cache);\n // Track how often cache.evict is called, since we want eviction to\n // override the feud-stopping logic in the markResult method, by\n // causing shouldWrite to return true. Wrapping the cache.evict method\n // is a bit of a hack, but it saves us from having to make eviction\n // counting an official part of the ApolloCache API.\n if (!destructiveMethodCounts.has(cache)) {\n destructiveMethodCounts.set(cache, 0);\n wrapDestructiveCacheMethod(cache, \"evict\");\n wrapDestructiveCacheMethod(cache, \"modify\");\n wrapDestructiveCacheMethod(cache, \"reset\");\n }\n }\n QueryInfo.prototype.init = function (query) {\n var networkStatus = query.networkStatus || NetworkStatus.loading;\n if (this.variables &&\n this.networkStatus !== NetworkStatus.loading &&\n !equal(this.variables, query.variables)) {\n networkStatus = NetworkStatus.setVariables;\n }\n if (!equal(query.variables, this.variables)) {\n this.lastDiff = void 0;\n }\n Object.assign(this, {\n document: query.document,\n variables: query.variables,\n networkError: null,\n graphQLErrors: this.graphQLErrors || [],\n networkStatus: networkStatus,\n });\n if (query.observableQuery) {\n this.setObservableQuery(query.observableQuery);\n }\n if (query.lastRequestId) {\n this.lastRequestId = query.lastRequestId;\n }\n return this;\n };\n QueryInfo.prototype.reset = function () {\n cancelNotifyTimeout(this);\n this.dirty = false;\n };\n QueryInfo.prototype.resetDiff = function () {\n this.lastDiff = void 0;\n };\n QueryInfo.prototype.getDiff = function () {\n var options = this.getDiffOptions();\n if (this.lastDiff && equal(options, this.lastDiff.options)) {\n return this.lastDiff.diff;\n }\n this.updateWatch(this.variables);\n var oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return { complete: false };\n }\n var diff = this.cache.diff(options);\n this.updateLastDiff(diff, options);\n return diff;\n };\n QueryInfo.prototype.updateLastDiff = function (diff, options) {\n this.lastDiff =\n diff ?\n {\n diff: diff,\n options: options || this.getDiffOptions(),\n }\n : void 0;\n };\n QueryInfo.prototype.getDiffOptions = function (variables) {\n var _a;\n if (variables === void 0) { variables = this.variables; }\n return {\n query: this.document,\n variables: variables,\n returnPartialData: true,\n optimistic: true,\n canonizeResults: (_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.canonizeResults,\n };\n };\n QueryInfo.prototype.setDiff = function (diff) {\n var _this = this;\n var _a;\n var oldDiff = this.lastDiff && this.lastDiff.diff;\n // If we do not tolerate partial results, skip this update to prevent it\n // from being reported. This prevents a situtuation where a query that\n // errors and another succeeds with overlapping data does not report the\n // partial data result to the errored query.\n //\n // See https://github.com/apollographql/apollo-client/issues/11400 for more\n // information on this issue.\n if (diff &&\n !diff.complete &&\n !((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.returnPartialData) &&\n // In the case of a cache eviction, the diff will become partial so we\n // schedule a notification to send a network request (this.oqListener) to\n // go and fetch the missing data.\n !(oldDiff && oldDiff.complete)) {\n return;\n }\n this.updateLastDiff(diff);\n if (!this.dirty && !equal(oldDiff && oldDiff.result, diff && diff.result)) {\n this.dirty = true;\n if (!this.notifyTimeout) {\n this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);\n }\n }\n };\n QueryInfo.prototype.setObservableQuery = function (oq) {\n var _this = this;\n if (oq === this.observableQuery)\n return;\n if (this.oqListener) {\n this.listeners.delete(this.oqListener);\n }\n this.observableQuery = oq;\n if (oq) {\n oq[\"queryInfo\"] = this;\n this.listeners.add((this.oqListener = function () {\n var diff = _this.getDiff();\n if (diff.fromOptimisticTransaction) {\n // If this diff came from an optimistic transaction, deliver the\n // current cache data to the ObservableQuery, but don't perform a\n // reobservation, since oq.reobserveCacheFirst might make a network\n // request, and we never want to trigger network requests in the\n // middle of optimistic updates.\n oq[\"observe\"]();\n }\n else {\n // Otherwise, make the ObservableQuery \"reobserve\" the latest data\n // using a temporary fetch policy of \"cache-first\", so complete cache\n // results have a chance to be delivered without triggering additional\n // network requests, even when options.fetchPolicy is \"network-only\"\n // or \"cache-and-network\". All other fetch policies are preserved by\n // this method, and are handled by calling oq.reobserve(). If this\n // reobservation is spurious, isDifferentFromLastResult still has a\n // chance to catch it before delivery to ObservableQuery subscribers.\n reobserveCacheFirst(oq);\n }\n }));\n }\n else {\n delete this.oqListener;\n }\n };\n QueryInfo.prototype.notify = function () {\n var _this = this;\n cancelNotifyTimeout(this);\n if (this.shouldNotify()) {\n this.listeners.forEach(function (listener) { return listener(_this); });\n }\n this.dirty = false;\n };\n QueryInfo.prototype.shouldNotify = function () {\n if (!this.dirty || !this.listeners.size) {\n return false;\n }\n if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) {\n var fetchPolicy = this.observableQuery.options.fetchPolicy;\n if (fetchPolicy !== \"cache-only\" && fetchPolicy !== \"cache-and-network\") {\n return false;\n }\n }\n return true;\n };\n QueryInfo.prototype.stop = function () {\n if (!this.stopped) {\n this.stopped = true;\n // Cancel the pending notify timeout\n this.reset();\n this.cancel();\n // Revert back to the no-op version of cancel inherited from\n // QueryInfo.prototype.\n this.cancel = QueryInfo.prototype.cancel;\n var oq = this.observableQuery;\n if (oq)\n oq.stopPolling();\n }\n };\n // This method is a no-op by default, until/unless overridden by the\n // updateWatch method.\n QueryInfo.prototype.cancel = function () { };\n QueryInfo.prototype.updateWatch = function (variables) {\n var _this = this;\n if (variables === void 0) { variables = this.variables; }\n var oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return;\n }\n var watchOptions = __assign(__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } });\n if (!this.lastWatch || !equal(watchOptions, this.lastWatch)) {\n this.cancel();\n this.cancel = this.cache.watch((this.lastWatch = watchOptions));\n }\n };\n QueryInfo.prototype.resetLastWrite = function () {\n this.lastWrite = void 0;\n };\n QueryInfo.prototype.shouldWrite = function (result, variables) {\n var lastWrite = this.lastWrite;\n return !(lastWrite &&\n // If cache.evict has been called since the last time we wrote this\n // data into the cache, there's a chance writing this result into\n // the cache will repair what was evicted.\n lastWrite.dmCount === destructiveMethodCounts.get(this.cache) &&\n equal(variables, lastWrite.variables) &&\n equal(result.data, lastWrite.result.data));\n };\n QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {\n var _this = this;\n var merger = new DeepMerger();\n var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];\n // Cancel the pending notify timeout (if it exists) to prevent extraneous network\n // requests. To allow future notify timeouts, diff and dirty are reset as well.\n this.reset();\n if (\"incremental\" in result && isNonEmptyArray(result.incremental)) {\n var mergedData = mergeIncrementalData(this.getDiff().result, result);\n result.data = mergedData;\n // Detect the first chunk of a deferred query and merge it with existing\n // cache data. This ensures a `cache-first` fetch policy that returns\n // partial cache data or a `cache-and-network` fetch policy that already\n // has full data in the cache does not complain when trying to merge the\n // initial deferred server data with existing cache data.\n }\n else if (\"hasNext\" in result && result.hasNext) {\n var diff = this.getDiff();\n result.data = merger.merge(diff.result, result.data);\n }\n this.graphQLErrors = graphQLErrors;\n if (options.fetchPolicy === \"no-cache\") {\n this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));\n }\n else if (cacheWriteBehavior !== 0 /* CacheWriteBehavior.FORBID */) {\n if (shouldWriteResult(result, options.errorPolicy)) {\n // Using a transaction here so we have a chance to read the result\n // back from the cache before the watch callback fires as a result\n // of writeQuery, so we can store the new diff quietly and ignore\n // it when we receive it redundantly from the watch callback.\n this.cache.performTransaction(function (cache) {\n if (_this.shouldWrite(result, options.variables)) {\n cache.writeQuery({\n query: document,\n data: result.data,\n variables: options.variables,\n overwrite: cacheWriteBehavior === 1 /* CacheWriteBehavior.OVERWRITE */,\n });\n _this.lastWrite = {\n result: result,\n variables: options.variables,\n dmCount: destructiveMethodCounts.get(_this.cache),\n };\n }\n else {\n // If result is the same as the last result we received from\n // the network (and the variables match too), avoid writing\n // result into the cache again. The wisdom of skipping this\n // cache write is far from obvious, since any cache write\n // could be the one that puts the cache back into a desired\n // state, fixing corruption or missing data. However, if we\n // always write every network result into the cache, we enable\n // feuds between queries competing to update the same data in\n // incompatible ways, which can lead to an endless cycle of\n // cache broadcasts and useless network requests. As with any\n // feud, eventually one side must step back from the brink,\n // letting the other side(s) have the last word(s). There may\n // be other points where we could break this cycle, such as\n // silencing the broadcast for cache.writeQuery (not a good\n // idea, since it just delays the feud a bit) or somehow\n // avoiding the network request that just happened (also bad,\n // because the server could return useful new data). All\n // options considered, skipping this cache write seems to be\n // the least damaging place to break the cycle, because it\n // reflects the intuition that we recently wrote this exact\n // result into the cache, so the cache *should* already/still\n // contain this data. If some other query has clobbered that\n // data in the meantime, that's too bad, but there will be no\n // winners if every query blindly reverts to its own version\n // of the data. This approach also gives the network a chance\n // to return new data, which will be written into the cache as\n // usual, notifying only those queries that are directly\n // affected by the cache updates, as usual. In the future, an\n // even more sophisticated cache could perhaps prevent or\n // mitigate the clobbering somehow, but that would make this\n // particular cache write even less important, and thus\n // skipping it would be even safer than it is today.\n if (_this.lastDiff && _this.lastDiff.diff.complete) {\n // Reuse data from the last good (complete) diff that we\n // received, when possible.\n result.data = _this.lastDiff.diff.result;\n return;\n }\n // If the previous this.diff was incomplete, fall through to\n // re-reading the latest data with cache.diff, below.\n }\n var diffOptions = _this.getDiffOptions(options.variables);\n var diff = cache.diff(diffOptions);\n // In case the QueryManager stops this QueryInfo before its\n // results are delivered, it's important to avoid restarting the\n // cache watch when markResult is called. We also avoid updating\n // the watch if we are writing a result that doesn't match the current\n // variables to avoid race conditions from broadcasting the wrong\n // result.\n if (!_this.stopped && equal(_this.variables, options.variables)) {\n // Any time we're about to update this.diff, we need to make\n // sure we've started watching the cache.\n _this.updateWatch(options.variables);\n }\n // If we're allowed to write to the cache, and we can read a\n // complete result from the cache, update result.data to be the\n // result from the cache, rather than the raw network result.\n // Set without setDiff to avoid triggering a notify call, since\n // we have other ways of notifying for this result.\n _this.updateLastDiff(diff, diffOptions);\n if (diff.complete) {\n result.data = diff.result;\n }\n });\n }\n else {\n this.lastWrite = void 0;\n }\n }\n };\n QueryInfo.prototype.markReady = function () {\n this.networkError = null;\n return (this.networkStatus = NetworkStatus.ready);\n };\n QueryInfo.prototype.markError = function (error) {\n this.networkStatus = NetworkStatus.error;\n this.lastWrite = void 0;\n this.reset();\n if (error.graphQLErrors) {\n this.graphQLErrors = error.graphQLErrors;\n }\n if (error.networkError) {\n this.networkError = error.networkError;\n }\n return error;\n };\n return QueryInfo;\n}());\nexport { QueryInfo };\nexport function shouldWriteResult(result, errorPolicy) {\n if (errorPolicy === void 0) { errorPolicy = \"none\"; }\n var ignoreErrors = errorPolicy === \"ignore\" || errorPolicy === \"all\";\n var writeWithErrors = !graphQLResultHasError(result);\n if (!writeWithErrors && ignoreErrors && result.data) {\n writeWithErrors = true;\n }\n return writeWithErrors;\n}\n//# sourceMappingURL=QueryInfo.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { invariant, newInvariantError } from \"../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { execute } from \"../link/core/index.js\";\nimport { hasDirectives, isExecutionPatchIncrementalResult, isExecutionPatchResult, removeDirectivesFromDocument, } from \"../utilities/index.js\";\nimport { canonicalStringify } from \"../cache/index.js\";\nimport { getDefaultValues, getOperationDefinition, getOperationName, hasClientExports, graphQLResultHasError, getGraphQLErrorsFromResult, Observable, asyncMap, isNonEmptyArray, Concast, makeUniqueId, isDocumentNode, isNonNullObject, DocumentTransform, } from \"../utilities/index.js\";\nimport { mergeIncrementalData } from \"../utilities/common/incrementalResult.js\";\nimport { ApolloError, isApolloError, graphQLResultHasProtocolErrors, } from \"../errors/index.js\";\nimport { ObservableQuery, logMissingFieldErrors } from \"./ObservableQuery.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport { LocalState } from \"./LocalState.js\";\nimport { QueryInfo, shouldWriteResult, } from \"./QueryInfo.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../errors/index.js\";\nimport { print } from \"../utilities/index.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar IGNORE = Object.create(null);\nimport { Trie } from \"@wry/trie\";\nimport { AutoCleanedWeakCache, cacheSizes } from \"../utilities/index.js\";\nvar QueryManager = /** @class */ (function () {\n function QueryManager(_a) {\n var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext;\n var _this = this;\n this.clientAwareness = {};\n // All the queries that the QueryManager is currently managing (not\n // including mutations and subscriptions).\n this.queries = new Map();\n // Maps from queryId strings to Promise rejection functions for\n // currently active queries and fetches.\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n this.fetchCancelFns = new Map();\n this.transformCache = new AutoCleanedWeakCache(cacheSizes[\"queryManager.getDocumentInfo\"] ||\n 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */);\n this.queryIdCounter = 1;\n this.requestIdCounter = 1;\n this.mutationIdCounter = 1;\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n this.inFlightLinkObservables = new Trie(false);\n var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, \n // Allow the apollo cache to manage its own transform caches\n { cache: false });\n this.cache = cache;\n this.link = link;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.queryDeduplication = queryDeduplication;\n this.clientAwareness = clientAwareness;\n this.localState = localState || new LocalState({ cache: cache });\n this.ssrMode = ssrMode;\n this.assumeImmutableResults = assumeImmutableResults;\n this.documentTransform =\n documentTransform ?\n defaultDocumentTransform\n .concat(documentTransform)\n // The custom document transform may add new fragment spreads or new\n // field selections, so we want to give the cache a chance to run\n // again. For example, the InMemoryCache adds __typename to field\n // selections and fragments from the fragment registry.\n .concat(defaultDocumentTransform)\n : defaultDocumentTransform;\n this.defaultContext = defaultContext || Object.create(null);\n if ((this.onBroadcast = onBroadcast)) {\n this.mutationStore = Object.create(null);\n }\n }\n /**\n * Call this method to terminate any active query processes, making it safe\n * to dispose of this QueryManager instance.\n */\n QueryManager.prototype.stop = function () {\n var _this = this;\n this.queries.forEach(function (_info, queryId) {\n _this.stopQueryNoBroadcast(queryId);\n });\n this.cancelPendingFetches(newInvariantError(25));\n };\n QueryManager.prototype.cancelPendingFetches = function (error) {\n this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });\n this.fetchCancelFns.clear();\n };\n QueryManager.prototype.mutate = function (_a) {\n var _b, _c;\n var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || \"network-only\" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || \"none\" : _g, keepRootFields = _a.keepRootFields, context = _a.context;\n return __awaiter(this, void 0, void 0, function () {\n var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self;\n return __generator(this, function (_h) {\n switch (_h.label) {\n case 0:\n invariant(mutation, 26);\n invariant(fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\", 27);\n mutationId = this.generateMutationId();\n mutation = this.cache.transformForLink(this.transform(mutation));\n hasClientExports = this.getDocumentInfo(mutation).hasClientExports;\n variables = this.getVariables(mutation, variables);\n if (!hasClientExports) return [3 /*break*/, 2];\n return [4 /*yield*/, this.localState.addExportedVariables(mutation, variables, context)];\n case 1:\n variables = (_h.sent());\n _h.label = 2;\n case 2:\n mutationStoreValue = this.mutationStore &&\n (this.mutationStore[mutationId] = {\n mutation: mutation,\n variables: variables,\n loading: true,\n error: null,\n });\n isOptimistic = optimisticResponse &&\n this.markMutationOptimistic(optimisticResponse, {\n mutationId: mutationId,\n document: mutation,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n context: context,\n updateQueries: updateQueries,\n update: updateWithProxyFn,\n keepRootFields: keepRootFields,\n });\n this.broadcastQueries();\n self = this;\n return [2 /*return*/, new Promise(function (resolve, reject) {\n return asyncMap(self.getObservableFromLink(mutation, __assign(__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) {\n if (graphQLResultHasError(result) && errorPolicy === \"none\") {\n throw new ApolloError({\n graphQLErrors: getGraphQLErrorsFromResult(result),\n });\n }\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = null;\n }\n var storeResult = __assign({}, result);\n if (typeof refetchQueries === \"function\") {\n refetchQueries = refetchQueries(storeResult);\n }\n if (errorPolicy === \"ignore\" && graphQLResultHasError(storeResult)) {\n delete storeResult.errors;\n }\n return self.markMutationResult({\n mutationId: mutationId,\n result: storeResult,\n document: mutation,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n context: context,\n update: updateWithProxyFn,\n updateQueries: updateQueries,\n awaitRefetchQueries: awaitRefetchQueries,\n refetchQueries: refetchQueries,\n removeOptimistic: isOptimistic ? mutationId : void 0,\n onQueryUpdated: onQueryUpdated,\n keepRootFields: keepRootFields,\n });\n }).subscribe({\n next: function (storeResult) {\n self.broadcastQueries();\n // Since mutations might receive multiple payloads from the\n // ApolloLink chain (e.g. when used with @defer),\n // we resolve with a SingleExecutionResult or after the final\n // ExecutionPatchResult has arrived and we have assembled the\n // multipart response into a single result.\n if (!(\"hasNext\" in storeResult) || storeResult.hasNext === false) {\n resolve(storeResult);\n }\n },\n error: function (err) {\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = err;\n }\n if (isOptimistic) {\n self.cache.removeOptimistic(mutationId);\n }\n self.broadcastQueries();\n reject(err instanceof ApolloError ? err : (new ApolloError({\n networkError: err,\n })));\n },\n });\n })];\n }\n });\n });\n };\n QueryManager.prototype.markMutationResult = function (mutation, cache) {\n var _this = this;\n if (cache === void 0) { cache = this.cache; }\n var result = mutation.result;\n var cacheWrites = [];\n var skipCache = mutation.fetchPolicy === \"no-cache\";\n if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) {\n if (!isExecutionPatchIncrementalResult(result)) {\n cacheWrites.push({\n result: result.data,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n var diff = cache.diff({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n var mergedData = void 0;\n if (diff.result) {\n mergedData = mergeIncrementalData(diff.result, result);\n }\n if (typeof mergedData !== \"undefined\") {\n // cast the ExecutionPatchResult to FetchResult here since\n // ExecutionPatchResult never has `data` when returned from the server\n result.data = mergedData;\n cacheWrites.push({\n result: mergedData,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n }\n var updateQueries_1 = mutation.updateQueries;\n if (updateQueries_1) {\n this.queries.forEach(function (_a, queryId) {\n var observableQuery = _a.observableQuery;\n var queryName = observableQuery && observableQuery.queryName;\n if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) {\n return;\n }\n var updater = updateQueries_1[queryName];\n var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables;\n // Read the current query result from the store.\n var _c = cache.diff({\n query: document,\n variables: variables,\n returnPartialData: true,\n optimistic: false,\n }), currentQueryResult = _c.result, complete = _c.complete;\n if (complete && currentQueryResult) {\n // Run our reducer using the current query result and the mutation result.\n var nextQueryResult = updater(currentQueryResult, {\n mutationResult: result,\n queryName: (document && getOperationName(document)) || void 0,\n queryVariables: variables,\n });\n // Write the modified result back into the store if we got a new result.\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: \"ROOT_QUERY\",\n query: document,\n variables: variables,\n });\n }\n }\n });\n }\n }\n if (cacheWrites.length > 0 ||\n (mutation.refetchQueries || \"\").length > 0 ||\n mutation.update ||\n mutation.onQueryUpdated ||\n mutation.removeOptimistic) {\n var results_1 = [];\n this.refetchQueries({\n updateCache: function (cache) {\n if (!skipCache) {\n cacheWrites.forEach(function (write) { return cache.write(write); });\n }\n // If the mutation has some writes associated with it then we need to\n // apply those writes to the store by running this reducer again with\n // a write action.\n var update = mutation.update;\n // Determine whether result is a SingleExecutionResult,\n // or the final ExecutionPatchResult.\n var isFinalResult = !isExecutionPatchResult(result) ||\n (isExecutionPatchIncrementalResult(result) && !result.hasNext);\n if (update) {\n if (!skipCache) {\n // Re-read the ROOT_MUTATION data we just wrote into the cache\n // (the first cache.write call in the cacheWrites.forEach loop\n // above), so field read functions have a chance to run for\n // fields within mutation result objects.\n var diff = cache.diff({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: _this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n if (diff.complete) {\n result = __assign(__assign({}, result), { data: diff.result });\n if (\"incremental\" in result) {\n delete result.incremental;\n }\n if (\"hasNext\" in result) {\n delete result.hasNext;\n }\n }\n }\n // If we've received the whole response,\n // either a SingleExecutionResult or the final ExecutionPatchResult,\n // call the update function.\n if (isFinalResult) {\n update(cache, result, {\n context: mutation.context,\n variables: mutation.variables,\n });\n }\n }\n // TODO Do this with cache.evict({ id: 'ROOT_MUTATION' }) but make it\n // shallow to allow rolling back optimistic evictions.\n if (!skipCache && !mutation.keepRootFields && isFinalResult) {\n cache.modify({\n id: \"ROOT_MUTATION\",\n fields: function (value, _a) {\n var fieldName = _a.fieldName, DELETE = _a.DELETE;\n return fieldName === \"__typename\" ? value : DELETE;\n },\n });\n }\n },\n include: mutation.refetchQueries,\n // Write the final mutation.result to the root layer of the cache.\n optimistic: false,\n // Remove the corresponding optimistic layer at the same time as we\n // write the final non-optimistic result.\n removeOptimistic: mutation.removeOptimistic,\n // Let the caller of client.mutate optionally determine the refetching\n // behavior for watched queries after the mutation.update function runs.\n // If no onQueryUpdated function was provided for this mutation, pass\n // null instead of undefined to disable the default refetching behavior.\n onQueryUpdated: mutation.onQueryUpdated || null,\n }).forEach(function (result) { return results_1.push(result); });\n if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) {\n // Returning a promise here makes the mutation await that promise, so we\n // include results in that promise's work if awaitRefetchQueries or an\n // onQueryUpdated function was specified.\n return Promise.all(results_1).then(function () { return result; });\n }\n }\n return Promise.resolve(result);\n };\n QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {\n var _this = this;\n var data = typeof optimisticResponse === \"function\" ?\n optimisticResponse(mutation.variables, { IGNORE: IGNORE })\n : optimisticResponse;\n if (data === IGNORE) {\n return false;\n }\n this.cache.recordOptimisticTransaction(function (cache) {\n try {\n _this.markMutationResult(__assign(__assign({}, mutation), { result: { data: data } }), cache);\n }\n catch (error) {\n globalThis.__DEV__ !== false && invariant.error(error);\n }\n }, mutation.mutationId);\n return true;\n };\n QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) {\n return this.fetchConcastWithInfo(queryId, options, networkStatus).concast\n .promise;\n };\n QueryManager.prototype.getQueryStore = function () {\n var store = Object.create(null);\n this.queries.forEach(function (info, queryId) {\n store[queryId] = {\n variables: info.variables,\n networkStatus: info.networkStatus,\n networkError: info.networkError,\n graphQLErrors: info.graphQLErrors,\n };\n });\n return store;\n };\n QueryManager.prototype.resetErrors = function (queryId) {\n var queryInfo = this.queries.get(queryId);\n if (queryInfo) {\n queryInfo.networkError = undefined;\n queryInfo.graphQLErrors = [];\n }\n };\n QueryManager.prototype.transform = function (document) {\n return this.documentTransform.transformDocument(document);\n };\n QueryManager.prototype.getDocumentInfo = function (document) {\n var transformCache = this.transformCache;\n if (!transformCache.has(document)) {\n var cacheEntry = {\n // TODO These three calls (hasClientExports, shouldForceResolvers, and\n // usesNonreactiveDirective) are performing independent full traversals\n // of the transformed document. We should consider merging these\n // traversals into a single pass in the future, though the work is\n // cached after the first time.\n hasClientExports: hasClientExports(document),\n hasForcedResolvers: this.localState.shouldForceResolvers(document),\n hasNonreactiveDirective: hasDirectives([\"nonreactive\"], document),\n clientQuery: this.localState.clientQuery(document),\n serverQuery: removeDirectivesFromDocument([\n { name: \"client\", remove: true },\n { name: \"connection\" },\n { name: \"nonreactive\" },\n ], document),\n defaultVars: getDefaultValues(getOperationDefinition(document)),\n // Transform any mutation or subscription operations to query operations\n // so we can read/write them from/to the cache.\n asQuery: __assign(__assign({}, document), { definitions: document.definitions.map(function (def) {\n if (def.kind === \"OperationDefinition\" &&\n def.operation !== \"query\") {\n return __assign(__assign({}, def), { operation: \"query\" });\n }\n return def;\n }) }),\n };\n transformCache.set(document, cacheEntry);\n }\n return transformCache.get(document);\n };\n QueryManager.prototype.getVariables = function (document, variables) {\n return __assign(__assign({}, this.getDocumentInfo(document).defaultVars), variables);\n };\n QueryManager.prototype.watchQuery = function (options) {\n var query = this.transform(options.query);\n // assign variable default values if supplied\n // NOTE: We don't modify options.query here with the transformed query to\n // ensure observable.options.query is set to the raw untransformed query.\n options = __assign(__assign({}, options), { variables: this.getVariables(query, options.variables) });\n if (typeof options.notifyOnNetworkStatusChange === \"undefined\") {\n options.notifyOnNetworkStatusChange = false;\n }\n var queryInfo = new QueryInfo(this);\n var observable = new ObservableQuery({\n queryManager: this,\n queryInfo: queryInfo,\n options: options,\n });\n observable[\"lastQuery\"] = query;\n this.queries.set(observable.queryId, queryInfo);\n // We give queryInfo the transformed query to ensure the first cache diff\n // uses the transformed query instead of the raw query\n queryInfo.init({\n document: query,\n observableQuery: observable,\n variables: observable.variables,\n });\n return observable;\n };\n QueryManager.prototype.query = function (options, queryId) {\n var _this = this;\n if (queryId === void 0) { queryId = this.generateQueryId(); }\n invariant(options.query, 28);\n invariant(options.query.kind === \"Document\", 29);\n invariant(!options.returnPartialData, 30);\n invariant(!options.pollInterval, 31);\n return this.fetchQuery(queryId, __assign(__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });\n };\n QueryManager.prototype.generateQueryId = function () {\n return String(this.queryIdCounter++);\n };\n QueryManager.prototype.generateRequestId = function () {\n return this.requestIdCounter++;\n };\n QueryManager.prototype.generateMutationId = function () {\n return String(this.mutationIdCounter++);\n };\n QueryManager.prototype.stopQueryInStore = function (queryId) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n };\n QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) {\n var queryInfo = this.queries.get(queryId);\n if (queryInfo)\n queryInfo.stop();\n };\n QueryManager.prototype.clearStore = function (options) {\n if (options === void 0) { options = {\n discardWatches: true,\n }; }\n // Before we have sent the reset action to the store, we can no longer\n // rely on the results returned by in-flight requests since these may\n // depend on values that previously existed in the data portion of the\n // store. So, we cancel the promises and observers that we have issued\n // so far and not yet resolved (in the case of queries).\n this.cancelPendingFetches(newInvariantError(32));\n this.queries.forEach(function (queryInfo) {\n if (queryInfo.observableQuery) {\n // Set loading to true so listeners don't trigger unless they want\n // results with partial data.\n queryInfo.networkStatus = NetworkStatus.loading;\n }\n else {\n queryInfo.stop();\n }\n });\n if (this.mutationStore) {\n this.mutationStore = Object.create(null);\n }\n // begin removing data from the store\n return this.cache.reset(options);\n };\n QueryManager.prototype.getObservableQueries = function (include) {\n var _this = this;\n if (include === void 0) { include = \"active\"; }\n var queries = new Map();\n var queryNamesAndDocs = new Map();\n var legacyQueryOptions = new Set();\n if (Array.isArray(include)) {\n include.forEach(function (desc) {\n if (typeof desc === \"string\") {\n queryNamesAndDocs.set(desc, false);\n }\n else if (isDocumentNode(desc)) {\n queryNamesAndDocs.set(_this.transform(desc), false);\n }\n else if (isNonNullObject(desc) && desc.query) {\n legacyQueryOptions.add(desc);\n }\n });\n }\n this.queries.forEach(function (_a, queryId) {\n var oq = _a.observableQuery, document = _a.document;\n if (oq) {\n if (include === \"all\") {\n queries.set(queryId, oq);\n return;\n }\n var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy;\n if (fetchPolicy === \"standby\" ||\n (include === \"active\" && !oq.hasObservers())) {\n return;\n }\n if (include === \"active\" ||\n (queryName && queryNamesAndDocs.has(queryName)) ||\n (document && queryNamesAndDocs.has(document))) {\n queries.set(queryId, oq);\n if (queryName)\n queryNamesAndDocs.set(queryName, true);\n if (document)\n queryNamesAndDocs.set(document, true);\n }\n }\n });\n if (legacyQueryOptions.size) {\n legacyQueryOptions.forEach(function (options) {\n // We will be issuing a fresh network request for this query, so we\n // pre-allocate a new query ID here, using a special prefix to enable\n // cleaning up these temporary queries later, after fetching.\n var queryId = makeUniqueId(\"legacyOneTimeQuery\");\n var queryInfo = _this.getQuery(queryId).init({\n document: options.query,\n variables: options.variables,\n });\n var oq = new ObservableQuery({\n queryManager: _this,\n queryInfo: queryInfo,\n options: __assign(__assign({}, options), { fetchPolicy: \"network-only\" }),\n });\n invariant(oq.queryId === queryId);\n queryInfo.setObservableQuery(oq);\n queries.set(queryId, oq);\n });\n }\n if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {\n queryNamesAndDocs.forEach(function (included, nameOrDoc) {\n if (!included) {\n globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === \"string\" ? 33 : 34, nameOrDoc);\n }\n });\n }\n return queries;\n };\n QueryManager.prototype.reFetchObservableQueries = function (includeStandby) {\n var _this = this;\n if (includeStandby === void 0) { includeStandby = false; }\n var observableQueryPromises = [];\n this.getObservableQueries(includeStandby ? \"all\" : \"active\").forEach(function (observableQuery, queryId) {\n var fetchPolicy = observableQuery.options.fetchPolicy;\n observableQuery.resetLastResults();\n if (includeStandby ||\n (fetchPolicy !== \"standby\" && fetchPolicy !== \"cache-only\")) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n _this.getQuery(queryId).setDiff(null);\n });\n this.broadcastQueries();\n return Promise.all(observableQueryPromises);\n };\n QueryManager.prototype.setObservableQuery = function (observableQuery) {\n this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery);\n };\n QueryManager.prototype.startGraphQLSubscription = function (_a) {\n var _this = this;\n var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? \"none\" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c;\n query = this.transform(query);\n variables = this.getVariables(query, variables);\n var makeObservable = function (variables) {\n return _this.getObservableFromLink(query, context, variables).map(function (result) {\n if (fetchPolicy !== \"no-cache\") {\n // the subscription interface should handle not sending us results we no longer subscribe to.\n // XXX I don't think we ever send in an object with errors, but we might in the future...\n if (shouldWriteResult(result, errorPolicy)) {\n _this.cache.write({\n query: query,\n result: result.data,\n dataId: \"ROOT_SUBSCRIPTION\",\n variables: variables,\n });\n }\n _this.broadcastQueries();\n }\n var hasErrors = graphQLResultHasError(result);\n var hasProtocolErrors = graphQLResultHasProtocolErrors(result);\n if (hasErrors || hasProtocolErrors) {\n var errors = {};\n if (hasErrors) {\n errors.graphQLErrors = result.errors;\n }\n if (hasProtocolErrors) {\n errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL];\n }\n // `errorPolicy` is a mechanism for handling GraphQL errors, according\n // to our documentation, so we throw protocol errors regardless of the\n // set error policy.\n if (errorPolicy === \"none\" || hasProtocolErrors) {\n throw new ApolloError(errors);\n }\n }\n if (errorPolicy === \"ignore\") {\n delete result.errors;\n }\n return result;\n });\n };\n if (this.getDocumentInfo(query).hasClientExports) {\n var observablePromise_1 = this.localState\n .addExportedVariables(query, variables, context)\n .then(makeObservable);\n return new Observable(function (observer) {\n var sub = null;\n observablePromise_1.then(function (observable) { return (sub = observable.subscribe(observer)); }, observer.error);\n return function () { return sub && sub.unsubscribe(); };\n });\n }\n return makeObservable(variables);\n };\n QueryManager.prototype.stopQuery = function (queryId) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n };\n QueryManager.prototype.stopQueryNoBroadcast = function (queryId) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n };\n QueryManager.prototype.removeQuery = function (queryId) {\n // teardown all links\n // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises\n // that each add their reject functions to fetchCancelFns.\n // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.\n // The same queryId could have two rejection fns for two promises\n this.fetchCancelFns.delete(queryId);\n if (this.queries.has(queryId)) {\n this.getQuery(queryId).stop();\n this.queries.delete(queryId);\n }\n };\n QueryManager.prototype.broadcastQueries = function () {\n if (this.onBroadcast)\n this.onBroadcast();\n this.queries.forEach(function (info) { return info.notify(); });\n };\n QueryManager.prototype.getLocalState = function () {\n return this.localState;\n };\n QueryManager.prototype.getObservableFromLink = function (query, context, variables, \n // Prefer context.queryDeduplication if specified.\n deduplication) {\n var _this = this;\n var _a;\n if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }\n var observable;\n var _b = this.getDocumentInfo(query), serverQuery = _b.serverQuery, clientQuery = _b.clientQuery;\n if (serverQuery) {\n var _c = this, inFlightLinkObservables_1 = _c.inFlightLinkObservables, link = _c.link;\n var operation = {\n query: serverQuery,\n variables: variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext(__assign(__assign({}, context), { forceFetch: !deduplication })),\n };\n context = operation.context;\n if (deduplication) {\n var printedServerQuery_1 = print(serverQuery);\n var varJson_1 = canonicalStringify(variables);\n var entry = inFlightLinkObservables_1.lookup(printedServerQuery_1, varJson_1);\n observable = entry.observable;\n if (!observable) {\n var concast = new Concast([\n execute(link, operation),\n ]);\n observable = entry.observable = concast;\n concast.beforeNext(function () {\n inFlightLinkObservables_1.remove(printedServerQuery_1, varJson_1);\n });\n }\n }\n else {\n observable = new Concast([\n execute(link, operation),\n ]);\n }\n }\n else {\n observable = new Concast([Observable.of({ data: {} })]);\n context = this.prepareContext(context);\n }\n if (clientQuery) {\n observable = asyncMap(observable, function (result) {\n return _this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context: context,\n variables: variables,\n });\n });\n }\n return observable;\n };\n QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) {\n var requestId = (queryInfo.lastRequestId = this.generateRequestId());\n // Performing transformForLink here gives this.cache a chance to fill in\n // missing fragment definitions (for example) before sending this document\n // through the link chain.\n var linkDocument = this.cache.transformForLink(options.query);\n return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {\n var graphQLErrors = getGraphQLErrorsFromResult(result);\n var hasErrors = graphQLErrors.length > 0;\n // If we interrupted this request by calling getResultsFromLink again\n // with the same QueryInfo object, we ignore the old results.\n if (requestId >= queryInfo.lastRequestId) {\n if (hasErrors && options.errorPolicy === \"none\") {\n // Throwing here effectively calls observer.error.\n throw queryInfo.markError(new ApolloError({\n graphQLErrors: graphQLErrors,\n }));\n }\n // Use linkDocument rather than queryInfo.document so the\n // operation/fragments used to write the result are the same as the\n // ones used to obtain it from the link.\n queryInfo.markResult(result, linkDocument, options, cacheWriteBehavior);\n queryInfo.markReady();\n }\n var aqr = {\n data: result.data,\n loading: false,\n networkStatus: NetworkStatus.ready,\n };\n if (hasErrors && options.errorPolicy !== \"ignore\") {\n aqr.errors = graphQLErrors;\n aqr.networkStatus = NetworkStatus.error;\n }\n return aqr;\n }, function (networkError) {\n var error = isApolloError(networkError) ? networkError : (new ApolloError({ networkError: networkError }));\n // Avoid storing errors from older interrupted queries.\n if (requestId >= queryInfo.lastRequestId) {\n queryInfo.markError(error);\n }\n throw error;\n });\n };\n QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, \n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus, query) {\n var _this = this;\n if (networkStatus === void 0) { networkStatus = NetworkStatus.loading; }\n if (query === void 0) { query = options.query; }\n var variables = this.getVariables(query, options.variables);\n var queryInfo = this.getQuery(queryId);\n var defaults = this.defaultOptions.watchQuery;\n var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || \"cache-first\" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || \"none\" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e;\n var normalized = Object.assign({}, options, {\n query: query,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n returnPartialData: returnPartialData,\n notifyOnNetworkStatusChange: notifyOnNetworkStatusChange,\n context: context,\n });\n var fromVariables = function (variables) {\n // Since normalized is always a fresh copy of options, it's safe to\n // modify its properties here, rather than creating yet another new\n // WatchQueryOptions object.\n normalized.variables = variables;\n var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);\n if (\n // If we're in standby, postpone advancing options.fetchPolicy using\n // applyNextFetchPolicy.\n normalized.fetchPolicy !== \"standby\" &&\n // The \"standby\" policy currently returns [] from fetchQueryByPolicy, so\n // this is another way to detect when nothing was done/fetched.\n sourcesWithInfo.sources.length > 0 &&\n queryInfo.observableQuery) {\n queryInfo.observableQuery[\"applyNextFetchPolicy\"](\"after-fetch\", options);\n }\n return sourcesWithInfo;\n };\n // This cancel function needs to be set before the concast is created,\n // in case concast creation synchronously cancels the request.\n var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); };\n this.fetchCancelFns.set(queryId, function (reason) {\n cleanupCancelFn();\n // This delay ensures the concast variable has been initialized.\n setTimeout(function () { return concast.cancel(reason); });\n });\n var concast, containsDataFromLink;\n // If the query has @export(as: ...) directives, then we need to\n // process those directives asynchronously. When there are no\n // @export directives (the common case), we deliberately avoid\n // wrapping the result of this.fetchQueryByPolicy in a Promise,\n // since the timing of result delivery is (unfortunately) important\n // for backwards compatibility. TODO This code could be simpler if\n // we deprecated and removed LocalState.\n if (this.getDocumentInfo(normalized.query).hasClientExports) {\n concast = new Concast(this.localState\n .addExportedVariables(normalized.query, normalized.variables, normalized.context)\n .then(fromVariables)\n .then(function (sourcesWithInfo) { return sourcesWithInfo.sources; }));\n // there is just no way we can synchronously get the *right* value here,\n // so we will assume `true`, which is the behaviour before the bug fix in\n // #10597. This means that bug is not fixed in that case, and is probably\n // un-fixable with reasonable effort for the edge case of @export as\n // directives.\n containsDataFromLink = true;\n }\n else {\n var sourcesWithInfo = fromVariables(normalized.variables);\n containsDataFromLink = sourcesWithInfo.fromLink;\n concast = new Concast(sourcesWithInfo.sources);\n }\n concast.promise.then(cleanupCancelFn, cleanupCancelFn);\n return {\n concast: concast,\n fromLink: containsDataFromLink,\n };\n };\n QueryManager.prototype.refetchQueries = function (_a) {\n var _this = this;\n var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? makeUniqueId(\"refetchQueries\") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated;\n var includedQueriesById = new Map();\n if (include) {\n this.getObservableQueries(include).forEach(function (oq, queryId) {\n includedQueriesById.set(queryId, {\n oq: oq,\n lastDiff: _this.getQuery(queryId).getDiff(),\n });\n });\n }\n var results = new Map();\n if (updateCache) {\n this.cache.batch({\n update: updateCache,\n // Since you can perform any combination of cache reads and/or writes in\n // the cache.batch update function, its optimistic option can be either\n // a boolean or a string, representing three distinct modes of\n // operation:\n //\n // * false: read/write only the root layer\n // * true: read/write the topmost layer\n // * string: read/write a fresh optimistic layer with that ID string\n //\n // When typeof optimistic === \"string\", a new optimistic layer will be\n // temporarily created within cache.batch with that string as its ID. If\n // we then pass that same string as the removeOptimistic option, we can\n // make cache.batch immediately remove the optimistic layer after\n // running the updateCache function, triggering only one broadcast.\n //\n // However, the refetchQueries method accepts only true or false for its\n // optimistic option (not string). We interpret true to mean a temporary\n // optimistic layer should be created, to allow efficiently rolling back\n // the effect of the updateCache function, which involves passing a\n // string instead of true as the optimistic option to cache.batch, when\n // refetchQueries receives optimistic: true.\n //\n // In other words, we are deliberately not supporting the use case of\n // writing to an *existing* optimistic layer (using the refetchQueries\n // updateCache function), since that would potentially interfere with\n // other optimistic updates in progress. Instead, you can read/write\n // only the root layer by passing optimistic: false to refetchQueries,\n // or you can read/write a brand new optimistic layer that will be\n // automatically removed by passing optimistic: true.\n optimistic: (optimistic && removeOptimistic) || false,\n // The removeOptimistic option can also be provided by itself, even if\n // optimistic === false, to remove some previously-added optimistic\n // layer safely and efficiently, like we do in markMutationResult.\n //\n // If an explicit removeOptimistic string is provided with optimistic:\n // true, the removeOptimistic string will determine the ID of the\n // temporary optimistic layer, in case that ever matters.\n removeOptimistic: removeOptimistic,\n onWatchUpdated: function (watch, diff, lastDiff) {\n var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery;\n if (oq) {\n if (onQueryUpdated) {\n // Since we're about to handle this query now, remove it from\n // includedQueriesById, in case it was added earlier because of\n // options.include.\n includedQueriesById.delete(oq.queryId);\n var result = onQueryUpdated(oq, diff, lastDiff);\n if (result === true) {\n // The onQueryUpdated function requested the default refetching\n // behavior by returning true.\n result = oq.refetch();\n }\n // Record the result in the results Map, as long as onQueryUpdated\n // did not return false to skip/ignore this result.\n if (result !== false) {\n results.set(oq, result);\n }\n // Allow the default cache broadcast to happen, except when\n // onQueryUpdated returns false.\n return result;\n }\n if (onQueryUpdated !== null) {\n // If we don't have an onQueryUpdated function, and onQueryUpdated\n // was not disabled by passing null, make sure this query is\n // \"included\" like any other options.include-specified query.\n includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff });\n }\n }\n },\n });\n }\n if (includedQueriesById.size) {\n includedQueriesById.forEach(function (_a, queryId) {\n var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff;\n var result;\n // If onQueryUpdated is provided, we want to use it for all included\n // queries, even the QueryOptions ones.\n if (onQueryUpdated) {\n if (!diff) {\n var info = oq[\"queryInfo\"];\n info.reset(); // Force info.getDiff() to read from cache.\n diff = info.getDiff();\n }\n result = onQueryUpdated(oq, diff, lastDiff);\n }\n // Otherwise, we fall back to refetching.\n if (!onQueryUpdated || result === true) {\n result = oq.refetch();\n }\n if (result !== false) {\n results.set(oq, result);\n }\n if (queryId.indexOf(\"legacyOneTimeQuery\") >= 0) {\n _this.stopQueryNoBroadcast(queryId);\n }\n });\n }\n if (removeOptimistic) {\n // In case no updateCache callback was provided (so cache.batch was not\n // called above, and thus did not already remove the optimistic layer),\n // remove it here. Since this is a no-op when the layer has already been\n // removed, we do it even if we called cache.batch above, since it's\n // possible this.cache is an instance of some ApolloCache subclass other\n // than InMemoryCache, and does not fully support the removeOptimistic\n // option for cache.batch.\n this.cache.removeOptimistic(removeOptimistic);\n }\n return results;\n };\n QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, \n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus) {\n var _this = this;\n var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange;\n var oldNetworkStatus = queryInfo.networkStatus;\n queryInfo.init({\n document: query,\n variables: variables,\n networkStatus: networkStatus,\n });\n var readCache = function () { return queryInfo.getDiff(); };\n var resultsFromCache = function (diff, networkStatus) {\n if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || NetworkStatus.loading; }\n var data = diff.result;\n if (globalThis.__DEV__ !== false && !returnPartialData && !equal(data, {})) {\n logMissingFieldErrors(diff.missing);\n }\n var fromData = function (data) {\n return Observable.of(__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true })));\n };\n if (data && _this.getDocumentInfo(query).hasForcedResolvers) {\n return _this.localState\n .runResolvers({\n document: query,\n remoteResult: { data: data },\n context: context,\n variables: variables,\n onlyRunForcedResolvers: true,\n })\n .then(function (resolved) { return fromData(resolved.data || void 0); });\n }\n // Resolves https://github.com/apollographql/apollo-client/issues/10317.\n // If errorPolicy is 'none' and notifyOnNetworkStatusChange is true,\n // data was incorrectly returned from the cache on refetch:\n // if diff.missing exists, we should not return cache data.\n if (errorPolicy === \"none\" &&\n networkStatus === NetworkStatus.refetch &&\n Array.isArray(diff.missing)) {\n return fromData(void 0);\n }\n return fromData(data);\n };\n var cacheWriteBehavior = fetchPolicy === \"no-cache\" ? 0 /* CacheWriteBehavior.FORBID */\n // Watched queries must opt into overwriting existing data on refetch,\n // by passing refetchWritePolicy: \"overwrite\" in their WatchQueryOptions.\n : (networkStatus === NetworkStatus.refetch &&\n refetchWritePolicy !== \"merge\") ?\n 1 /* CacheWriteBehavior.OVERWRITE */\n : 2 /* CacheWriteBehavior.MERGE */;\n var resultsFromLink = function () {\n return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {\n query: query,\n variables: variables,\n context: context,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n });\n };\n var shouldNotify = notifyOnNetworkStatusChange &&\n typeof oldNetworkStatus === \"number\" &&\n oldNetworkStatus !== networkStatus &&\n isNetworkRequestInFlight(networkStatus);\n switch (fetchPolicy) {\n default:\n case \"cache-first\": {\n var diff = readCache();\n if (diff.complete) {\n return {\n fromLink: false,\n sources: [resultsFromCache(diff, queryInfo.markReady())],\n };\n }\n if (returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n case \"cache-and-network\": {\n var diff = readCache();\n if (diff.complete || returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n case \"cache-only\":\n return {\n fromLink: false,\n sources: [resultsFromCache(readCache(), queryInfo.markReady())],\n };\n case \"network-only\":\n if (shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(readCache()), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n case \"no-cache\":\n if (shouldNotify) {\n return {\n fromLink: true,\n // Note that queryInfo.getDiff() for no-cache queries does not call\n // cache.diff, but instead returns a { complete: false } stub result\n // when there is no queryInfo.diff already defined.\n sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n case \"standby\":\n return { fromLink: false, sources: [] };\n }\n };\n QueryManager.prototype.getQuery = function (queryId) {\n if (queryId && !this.queries.has(queryId)) {\n this.queries.set(queryId, new QueryInfo(this, queryId));\n }\n return this.queries.get(queryId);\n };\n QueryManager.prototype.prepareContext = function (context) {\n if (context === void 0) { context = {}; }\n var newContext = this.localState.prepareContext(context);\n return __assign(__assign(__assign({}, this.defaultContext), newContext), { clientAwareness: this.clientAwareness });\n };\n return QueryManager;\n}());\nexport { QueryManager };\n//# sourceMappingURL=QueryManager.js.map","import { __assign } from \"tslib\";\nimport { invariant, newInvariantError } from \"../utilities/globals/index.js\";\nimport { ApolloLink, execute } from \"../link/core/index.js\";\nimport { version } from \"../version.js\";\nimport { HttpLink } from \"../link/http/index.js\";\nimport { QueryManager } from \"./QueryManager.js\";\nimport { LocalState } from \"./LocalState.js\";\nvar hasSuggestedDevtools = false;\n// Though mergeOptions now resides in @apollo/client/utilities, it was\n// previously declared and exported from this module, and then reexported from\n// @apollo/client/core. Since we need to preserve that API anyway, the easiest\n// solution is to reexport mergeOptions where it was previously declared (here).\nimport { mergeOptions } from \"../utilities/index.js\";\nimport { getApolloClientMemoryInternals } from \"../utilities/caching/getMemoryInternals.js\";\nexport { mergeOptions };\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through {@link Observable} instances.\n */\nvar ApolloClient = /** @class */ (function () {\n /**\n * Constructs an instance of {@link ApolloClient}.\n *\n * @example\n * ```js\n * import { ApolloClient, InMemoryCache } from '@apollo/client';\n *\n * const cache = new InMemoryCache();\n *\n * const client = new ApolloClient({\n * // Provide required constructor fields\n * cache: cache,\n * uri: 'http://localhost:4000/',\n *\n * // Provide some optional constructor fields\n * name: 'react-web-client',\n * version: '1.3',\n * queryDeduplication: false,\n * defaultOptions: {\n * watchQuery: {\n * fetchPolicy: 'cache-and-network',\n * },\n * },\n * });\n * ```\n */\n function ApolloClient(options) {\n var _this = this;\n this.resetStoreCallbacks = [];\n this.clearStoreCallbacks = [];\n if (!options.cache) {\n throw newInvariantError(15);\n }\n var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, \n // Expose the client instance as window.__APOLLO_CLIENT__ and call\n // onBroadcast in queryManager.broadcastQueries to enable browser\n // devtools, but disable them by default in production.\n _c = options.connectToDevTools, \n // Expose the client instance as window.__APOLLO_CLIENT__ and call\n // onBroadcast in queryManager.broadcastQueries to enable browser\n // devtools, but disable them by default in production.\n connectToDevTools = _c === void 0 ? typeof window === \"object\" &&\n !window.__APOLLO_CLIENT__ &&\n globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;\n var link = options.link;\n if (!link) {\n link =\n uri ? new HttpLink({ uri: uri, credentials: credentials, headers: headers }) : ApolloLink.empty();\n }\n this.link = link;\n this.cache = cache;\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.typeDefs = typeDefs;\n if (ssrForceFetchDelay) {\n setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay);\n }\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n this.version = version;\n this.localState = new LocalState({\n cache: cache,\n client: this,\n resolvers: resolvers,\n fragmentMatcher: fragmentMatcher,\n });\n this.queryManager = new QueryManager({\n cache: this.cache,\n link: this.link,\n defaultOptions: this.defaultOptions,\n defaultContext: defaultContext,\n documentTransform: documentTransform,\n queryDeduplication: queryDeduplication,\n ssrMode: ssrMode,\n clientAwareness: {\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n },\n localState: this.localState,\n assumeImmutableResults: assumeImmutableResults,\n onBroadcast: connectToDevTools ?\n function () {\n if (_this.devToolsHookCb) {\n _this.devToolsHookCb({\n action: {},\n state: {\n queries: _this.queryManager.getQueryStore(),\n mutations: _this.queryManager.mutationStore || {},\n },\n dataWithOptimisticResults: _this.cache.extract(true),\n });\n }\n }\n : void 0,\n });\n if (connectToDevTools)\n this.connectToDevTools();\n }\n ApolloClient.prototype.connectToDevTools = function () {\n if (typeof window === \"object\") {\n var windowWithDevTools = window;\n var devtoolsSymbol = Symbol.for(\"apollo.devtools\");\n (windowWithDevTools[devtoolsSymbol] =\n windowWithDevTools[devtoolsSymbol] || []).push(this);\n windowWithDevTools.__APOLLO_CLIENT__ = this;\n }\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && globalThis.__DEV__ !== false) {\n hasSuggestedDevtools = true;\n setTimeout(function () {\n if (typeof window !== \"undefined\" &&\n window.document &&\n window.top === window.self &&\n !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {\n var nav = window.navigator;\n var ua = nav && nav.userAgent;\n var url = void 0;\n if (typeof ua === \"string\") {\n if (ua.indexOf(\"Chrome/\") > -1) {\n url =\n \"https://chrome.google.com/webstore/detail/\" +\n \"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm\";\n }\n else if (ua.indexOf(\"Firefox/\") > -1) {\n url =\n \"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/\";\n }\n }\n if (url) {\n globalThis.__DEV__ !== false && invariant.log(\"Download the Apollo DevTools for a better development \" +\n \"experience: %s\", url);\n }\n }\n }, 10000);\n }\n };\n Object.defineProperty(ApolloClient.prototype, \"documentTransform\", {\n /**\n * The `DocumentTransform` used to modify GraphQL documents before a request\n * is made. If a custom `DocumentTransform` is not provided, this will be the\n * default document transform.\n */\n get: function () {\n return this.queryManager.documentTransform;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n ApolloClient.prototype.stop = function () {\n this.queryManager.stop();\n };\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and\n * receive updated results through a GraphQL observer when the cache store changes.\n *\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifier, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n ApolloClient.prototype.watchQuery = function (options) {\n if (this.defaultOptions.watchQuery) {\n options = mergeOptions(this.defaultOptions.watchQuery, options);\n }\n // XXX Overwriting options is probably not the best way to do this long term...\n if (this.disableNetworkFetches &&\n (options.fetchPolicy === \"network-only\" ||\n options.fetchPolicy === \"cache-and-network\")) {\n options = __assign(__assign({}, options), { fetchPolicy: \"cache-first\" });\n }\n return this.queryManager.watchQuery(options);\n };\n /**\n * This resolves a single query according to the options specified and\n * returns a `Promise` which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options - An object of type {@link QueryOptions} that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n ApolloClient.prototype.query = function (options) {\n if (this.defaultOptions.query) {\n options = mergeOptions(this.defaultOptions.query, options);\n }\n invariant(options.fetchPolicy !== \"cache-and-network\", 16);\n if (this.disableNetworkFetches && options.fetchPolicy === \"network-only\") {\n options = __assign(__assign({}, options), { fetchPolicy: \"cache-first\" });\n }\n return this.queryManager.query(options);\n };\n /**\n * This resolves a single mutation according to the options specified and returns a\n * Promise which is either resolved with the resulting data or rejected with an\n * error. In some cases both `data` and `errors` might be undefined, for example\n * when `errorPolicy` is set to `'ignore'`.\n *\n * It takes options as an object with the following keys and values:\n */\n ApolloClient.prototype.mutate = function (options) {\n if (this.defaultOptions.mutate) {\n options = mergeOptions(this.defaultOptions.mutate, options);\n }\n return this.queryManager.mutate(options);\n };\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * {@link Observable} which either emits received data or an error.\n */\n ApolloClient.prototype.subscribe = function (options) {\n return this.queryManager.startGraphQLSubscription(options);\n };\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic - Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n ApolloClient.prototype.readQuery = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return this.cache.readQuery(options, optimistic);\n };\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic - Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n ApolloClient.prototype.readFragment = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return this.cache.readFragment(options, optimistic);\n };\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n ApolloClient.prototype.writeQuery = function (options) {\n var ref = this.cache.writeQuery(options);\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n return ref;\n };\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n ApolloClient.prototype.writeFragment = function (options) {\n var ref = this.cache.writeFragment(options);\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n return ref;\n };\n ApolloClient.prototype.__actionHookForDevTools = function (cb) {\n this.devToolsHookCb = cb;\n };\n ApolloClient.prototype.__requestRaw = function (payload) {\n return execute(this.link, payload);\n };\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n ApolloClient.prototype.resetStore = function () {\n var _this = this;\n return Promise.resolve()\n .then(function () {\n return _this.queryManager.clearStore({\n discardWatches: false,\n });\n })\n .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); })\n .then(function () { return _this.reFetchObservableQueries(); });\n };\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n ApolloClient.prototype.clearStore = function () {\n var _this = this;\n return Promise.resolve()\n .then(function () {\n return _this.queryManager.clearStore({\n discardWatches: true,\n });\n })\n .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); });\n };\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n ApolloClient.prototype.onResetStore = function (cb) {\n var _this = this;\n this.resetStoreCallbacks.push(cb);\n return function () {\n _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; });\n };\n };\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n ApolloClient.prototype.onClearStore = function (cb) {\n var _this = this;\n this.clearStoreCallbacks.push(cb);\n return function () {\n _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; });\n };\n };\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n };\n /**\n * Refetches specified active queries. Similar to \"reFetchObservableQueries()\" but with a specific list of queries.\n *\n * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries.\n *\n * It is important to remember that `refetchQueries()` *will* refetch specified active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n ApolloClient.prototype.refetchQueries = function (options) {\n var map = this.queryManager.refetchQueries(options);\n var queries = [];\n var results = [];\n map.forEach(function (result, obsQuery) {\n queries.push(obsQuery);\n results.push(result);\n });\n var result = Promise.all(results);\n // In case you need the raw results immediately, without awaiting\n // Promise.all(results):\n result.queries = queries;\n result.results = results;\n // If you decide to ignore the result Promise because you're using\n // result.queries and result.results instead, you shouldn't have to worry\n // about preventing uncaught rejections for the Promise.all result.\n result.catch(function (error) {\n globalThis.__DEV__ !== false && invariant.debug(17, error);\n });\n return result;\n };\n /**\n * Get all currently active `ObservableQuery` objects, in a `Map` keyed by\n * query ID strings.\n *\n * An \"active\" query is one that has observers and a `fetchPolicy` other than\n * \"standby\" or \"cache-only\".\n *\n * You can include all `ObservableQuery` objects (including the inactive ones)\n * by passing \"all\" instead of \"active\", or you can include just a subset of\n * active queries by passing an array of query names or DocumentNode objects.\n */\n ApolloClient.prototype.getObservableQueries = function (include) {\n if (include === void 0) { include = \"active\"; }\n return this.queryManager.getObservableQueries(include);\n };\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n ApolloClient.prototype.extract = function (optimistic) {\n return this.cache.extract(optimistic);\n };\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n ApolloClient.prototype.restore = function (serializedState) {\n return this.cache.restore(serializedState);\n };\n /**\n * Add additional local resolvers.\n */\n ApolloClient.prototype.addResolvers = function (resolvers) {\n this.localState.addResolvers(resolvers);\n };\n /**\n * Set (override existing) local resolvers.\n */\n ApolloClient.prototype.setResolvers = function (resolvers) {\n this.localState.setResolvers(resolvers);\n };\n /**\n * Get all registered local resolvers.\n */\n ApolloClient.prototype.getResolvers = function () {\n return this.localState.getResolvers();\n };\n /**\n * Set a custom local state fragment matcher.\n */\n ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n };\n /**\n * Define a new ApolloLink (or link chain) that Apollo Client will use.\n */\n ApolloClient.prototype.setLink = function (newLink) {\n this.link = this.queryManager.link = newLink;\n };\n Object.defineProperty(ApolloClient.prototype, \"defaultContext\", {\n get: function () {\n return this.queryManager.defaultContext;\n },\n enumerable: false,\n configurable: true\n });\n return ApolloClient;\n}());\nexport { ApolloClient };\nif (globalThis.__DEV__ !== false) {\n ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;\n}\n//# sourceMappingURL=ApolloClient.js.map","import * as React from \"rehackt\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nvar contextKey = canUseSymbol ? Symbol.for(\"__APOLLO_CONTEXT__\") : \"__APOLLO_CONTEXT__\";\nexport function getApolloContext() {\n invariant(\"createContext\" in React, 45);\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport var resetApolloContext = getApolloContext;\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n invariant(context && context.client, 44);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n var parentContext = React.useContext(ApolloContext);\n var context = React.useMemo(function () {\n return __assign(__assign({}, parentContext), { client: client || parentContext.client });\n }, [parentContext, client]);\n invariant(context.client, 46);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n};\n//# sourceMappingURL=ApolloProvider.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"../context/index.js\";\n/**\n * @example\n * ```jsx\n * import { useApolloClient } from '@apollo/client';\n *\n * function SomeComponent() {\n * const client = useApolloClient();\n * // `client` is now set to the `ApolloClient` instance being used by the\n * // application (that was configured using something like `ApolloProvider`)\n * }\n * ```\n *\n * @since 3.0.0\n * @returns The `ApolloClient` instance being used by the application.\n */\nexport function useApolloClient(override) {\n var context = React.useContext(getApolloContext());\n var client = override || context.client;\n invariant(!!client, 49);\n return client;\n}\n//# sourceMappingURL=useApolloClient.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { canUseLayoutEffect } from \"../../utilities/index.js\";\nvar didWarnUncachedGetSnapshot = false;\n// Prevent webpack from complaining about our feature detection of the\n// useSyncExternalStore property of the React namespace, which is expected not\n// to exist when using React 17 and earlier, and that's fine.\nvar uSESKey = \"useSyncExternalStore\";\nvar realHook = React[uSESKey];\n// Adapted from https://www.npmjs.com/package/use-sync-external-store, with\n// Apollo Client deviations called out by \"// DEVIATION ...\" comments.\n// When/if React.useSyncExternalStore is defined, delegate fully to it.\nexport var useSyncExternalStore = realHook ||\n (function (subscribe, getSnapshot, getServerSnapshot) {\n // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n var value = getSnapshot();\n if (\n // DEVIATION: Using __DEV__\n globalThis.__DEV__ !== false &&\n !didWarnUncachedGetSnapshot &&\n // DEVIATION: Not using Object.is because we know our snapshots will never\n // be exotic primitive values like NaN, which is !== itself.\n value !== getSnapshot()) {\n didWarnUncachedGetSnapshot = true;\n // DEVIATION: Using invariant.error instead of console.error directly.\n globalThis.__DEV__ !== false && invariant.error(58);\n }\n // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n var _a = React.useState({\n inst: { value: value, getSnapshot: getSnapshot },\n }), inst = _a[0].inst, forceUpdate = _a[1];\n // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n if (canUseLayoutEffect) {\n // DEVIATION: We avoid calling useLayoutEffect when !canUseLayoutEffect,\n // which may seem like a conditional hook, but this code ends up behaving\n // unconditionally (one way or the other) because canUseLayoutEffect is\n // constant.\n React.useLayoutEffect(function () {\n Object.assign(inst, { value: value, getSnapshot: getSnapshot });\n // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n }, [subscribe, value, getSnapshot]);\n }\n else {\n Object.assign(inst, { value: value, getSnapshot: getSnapshot });\n }\n React.useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n // Subscribe to the store and return a clean-up function.\n return subscribe(function handleStoreChange() {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n });\n }, [subscribe]);\n return value;\n });\nfunction checkIfSnapshotChanged(_a) {\n var value = _a.value, getSnapshot = _a.getSnapshot;\n try {\n return value !== getSnapshot();\n }\n catch (_b) {\n return true;\n }\n}\n//# sourceMappingURL=useSyncExternalStore.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { AutoCleanedWeakCache, cacheSizes, } from \"../../utilities/index.js\";\nimport { registerGlobalCache } from \"../../utilities/caching/getMemoryInternals.js\";\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache;\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = \"Query\";\n break;\n case DocumentType.Mutation:\n name = \"Mutation\";\n break;\n case DocumentType.Subscription:\n name = \"Subscription\";\n break;\n }\n return name;\n}\n// This parser is mostly used to safety check incoming documents.\nexport function parser(document) {\n if (!cache) {\n cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 /* defaultCacheSizes.parser */);\n }\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n invariant(!!document && !!document.kind, 59, document);\n var fragments = [];\n var queries = [];\n var mutations = [];\n var subscriptions = [];\n for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {\n var x = _a[_i];\n if (x.kind === \"FragmentDefinition\") {\n fragments.push(x);\n continue;\n }\n if (x.kind === \"OperationDefinition\") {\n switch (x.operation) {\n case \"query\":\n queries.push(x);\n break;\n case \"mutation\":\n mutations.push(x);\n break;\n case \"subscription\":\n subscriptions.push(x);\n break;\n }\n }\n }\n invariant(!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length, 60);\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n 61,\n document,\n queries.length,\n subscriptions.length,\n mutations.length\n );\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length ? queries\n : mutations.length ? mutations\n : subscriptions;\n invariant(definitions.length === 1, 62, document, definitions.length);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === \"Name\") {\n name = definition.name.value;\n }\n else {\n name = \"data\"; // fallback to using data if no name\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\nparser.resetCache = function () {\n cache = undefined;\n};\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"parser\", function () { return (cache ? cache.size : 0); });\n}\nexport function verifyDocumentType(document, type) {\n var operation = parser(document);\n var requiredOperationName = operationName(type);\n var usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n 63,\n requiredOperationName,\n requiredOperationName,\n usedOperationName\n );\n}\n//# sourceMappingURL=index.js.map","import { __assign, __rest } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { equal } from \"@wry/equality\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { getApolloContext } from \"../context/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { NetworkStatus } from \"../../core/index.js\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { canUseWeakMap, compact, isNonEmptyArray, maybeDeepFreeze, } from \"../../utilities/index.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * A hook for executing queries in an Apollo application.\n *\n * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.\n *\n * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, and `data` properties you can use to render your UI.\n *\n * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useQuery } from '@apollo/client';\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const { loading, error, data } = useQuery(GET_GREETING, {\n * variables: { language: 'english' },\n * });\n * if (loading) return

    Loading ...

    ;\n * return

    Hello {data.greeting.message}!

    ;\n * }\n * ```\n * @since 3.0.0\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Options to control how the query is executed.\n * @returns Query result object\n */\nexport function useQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n return useInternalState(useApolloClient(options.client), query).useQuery(options);\n}\nexport function useInternalState(client, query) {\n var stateRef = React.useRef();\n if (!stateRef.current ||\n client !== stateRef.current.client ||\n query !== stateRef.current.query) {\n stateRef.current = new InternalState(client, query, stateRef.current);\n }\n var state = stateRef.current;\n // By default, InternalState.prototype.forceUpdate is an empty function, but\n // we replace it here (before anyone has had a chance to see this state yet)\n // with a function that unconditionally forces an update, using the latest\n // setTick function. Updating this state by calling state.forceUpdate is the\n // only way we trigger React component updates (no other useState calls within\n // the InternalState class).\n state.forceUpdateState = React.useReducer(function (tick) { return tick + 1; }, 0)[1];\n return state;\n}\nvar InternalState = /** @class */ (function () {\n function InternalState(client, query, previous) {\n var _this = this;\n this.client = client;\n this.query = query;\n /**\n * Will be overwritten by the `useSyncExternalStore` \"force update\" method\n * whenever it is available and reset to `forceUpdateState` when it isn't.\n */\n this.forceUpdate = function () { return _this.forceUpdateState(); };\n this.ssrDisabledResult = maybeDeepFreeze({\n loading: true,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.loading,\n });\n this.skipStandbyResult = maybeDeepFreeze({\n loading: false,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.ready,\n });\n // This cache allows the referential stability of this.result (as returned by\n // getCurrentResult) to translate into referential stability of the resulting\n // QueryResult object returned by toQueryResult.\n this.toQueryResultCache = new (canUseWeakMap ? WeakMap : Map)();\n verifyDocumentType(query, DocumentType.Query);\n // Reuse previousData from previous InternalState (if any) to provide\n // continuity of previousData even if/when the query or client changes.\n var previousResult = previous && previous.result;\n var previousData = previousResult && previousResult.data;\n if (previousData) {\n this.previousData = previousData;\n }\n }\n /**\n * Forces an update using local component state.\n * As this is not batched with `useSyncExternalStore` updates,\n * this is only used as a fallback if the `useSyncExternalStore` \"force update\"\n * method is not registered at the moment.\n * See https://github.com/facebook/react/issues/25191\n * */\n InternalState.prototype.forceUpdateState = function () {\n // Replaced (in useInternalState) with a method that triggers an update.\n globalThis.__DEV__ !== false && invariant.warn(51);\n };\n InternalState.prototype.executeQuery = function (options) {\n var _this = this;\n var _a;\n if (options.query) {\n Object.assign(this, { query: options.query });\n }\n this.watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options));\n var concast = this.observable.reobserveAsConcast(this.getObsQueryOptions());\n // Make sure getCurrentResult returns a fresh ApolloQueryResult,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData;\n this.result = void 0;\n this.forceUpdate();\n return new Promise(function (resolve) {\n var result;\n // Subscribe to the concast independently of the ObservableQuery in case\n // the component gets unmounted before the promise resolves. This prevents\n // the concast from terminating early and resolving with `undefined` when\n // there are no more subscribers for the concast.\n concast.subscribe({\n next: function (value) {\n result = value;\n },\n error: function () {\n resolve(_this.toQueryResult(_this.observable.getCurrentResult()));\n },\n complete: function () {\n resolve(_this.toQueryResult(result));\n },\n });\n });\n };\n // Methods beginning with use- should be called according to the standard\n // rules of React hooks: only at the top level of the calling function, and\n // without any dynamic conditional logic.\n InternalState.prototype.useQuery = function (options) {\n var _this = this;\n // The renderPromises field gets initialized here in the useQuery method, at\n // the beginning of everything (for a given component rendering, at least),\n // so we can safely use this.renderPromises in other/later InternalState\n // methods without worrying it might be uninitialized. Even after\n // initialization, this.renderPromises is usually undefined (unless SSR is\n // happening), but that's fine as long as it has been initialized that way,\n // rather than left uninitialized.\n this.renderPromises = React.useContext(getApolloContext()).renderPromises;\n this.useOptions(options);\n var obsQuery = this.useObservableQuery();\n var result = useSyncExternalStore(React.useCallback(function (handleStoreChange) {\n if (_this.renderPromises) {\n return function () { };\n }\n _this.forceUpdate = handleStoreChange;\n var onNext = function () {\n var previousResult = _this.result;\n // We use `getCurrentResult()` instead of the onNext argument because\n // the values differ slightly. Specifically, loading results will have\n // an empty object for data instead of `undefined` for some reason.\n var result = obsQuery.getCurrentResult();\n // Make sure we're not attempting to re-render similar results\n if (previousResult &&\n previousResult.loading === result.loading &&\n previousResult.networkStatus === result.networkStatus &&\n equal(previousResult.data, result.data)) {\n return;\n }\n _this.setResult(result);\n };\n var onError = function (error) {\n subscription.unsubscribe();\n subscription = obsQuery.resubscribeAfterError(onNext, onError);\n if (!hasOwnProperty.call(error, \"graphQLErrors\")) {\n // The error is not a GraphQL error\n throw error;\n }\n var previousResult = _this.result;\n if (!previousResult ||\n (previousResult && previousResult.loading) ||\n !equal(error, previousResult.error)) {\n _this.setResult({\n data: (previousResult && previousResult.data),\n error: error,\n loading: false,\n networkStatus: NetworkStatus.error,\n });\n }\n };\n var subscription = obsQuery.subscribe(onNext, onError);\n // Do the \"unsubscribe\" with a short delay.\n // This way, an existing subscription can be reused without an additional\n // request if \"unsubscribe\" and \"resubscribe\" to the same ObservableQuery\n // happen in very fast succession.\n return function () {\n setTimeout(function () { return subscription.unsubscribe(); });\n _this.forceUpdate = function () { return _this.forceUpdateState(); };\n };\n }, [\n // We memoize the subscribe function using useCallback and the following\n // dependency keys, because the subscribe function reference is all that\n // useSyncExternalStore uses internally as a dependency key for the\n // useEffect ultimately responsible for the subscription, so we are\n // effectively passing this dependency array to that useEffect buried\n // inside useSyncExternalStore, as desired.\n obsQuery,\n this.renderPromises,\n this.client.disableNetworkFetches,\n ]), function () { return _this.getCurrentResult(); }, function () { return _this.getCurrentResult(); });\n // TODO Remove this method when we remove support for options.partialRefetch.\n this.unsafeHandlePartialRefetch(result);\n return this.toQueryResult(result);\n };\n InternalState.prototype.useOptions = function (options) {\n var _a;\n var watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options));\n // Update this.watchQueryOptions, but only when they have changed, which\n // allows us to depend on the referential stability of\n // this.watchQueryOptions elsewhere.\n var currentWatchQueryOptions = this.watchQueryOptions;\n if (!equal(watchQueryOptions, currentWatchQueryOptions)) {\n this.watchQueryOptions = watchQueryOptions;\n if (currentWatchQueryOptions && this.observable) {\n // Though it might be tempting to postpone this reobserve call to the\n // useEffect block, we need getCurrentResult to return an appropriate\n // loading:true result synchronously (later within the same call to\n // useQuery). Since we already have this.observable here (not true for\n // the very first call to useQuery), we are not initiating any new\n // subscriptions, though it does feel less than ideal that reobserve\n // (potentially) kicks off a network request (for example, when the\n // variables have changed), which is technically a side-effect.\n this.observable.reobserve(this.getObsQueryOptions());\n // Make sure getCurrentResult returns a fresh ApolloQueryResult,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData;\n this.result = void 0;\n }\n }\n // Make sure state.onCompleted and state.onError always reflect the latest\n // options.onCompleted and options.onError callbacks provided to useQuery,\n // since those functions are often recreated every time useQuery is called.\n // Like the forceUpdate method, the versions of these methods inherited from\n // InternalState.prototype are empty no-ops, but we can override them on the\n // base state object (without modifying the prototype).\n this.onCompleted =\n options.onCompleted || InternalState.prototype.onCompleted;\n this.onError = options.onError || InternalState.prototype.onError;\n if ((this.renderPromises || this.client.disableNetworkFetches) &&\n this.queryHookOptions.ssr === false &&\n !this.queryHookOptions.skip) {\n // If SSR has been explicitly disabled, and this function has been called\n // on the server side, return the default loading state.\n this.result = this.ssrDisabledResult;\n }\n else if (this.queryHookOptions.skip ||\n this.watchQueryOptions.fetchPolicy === \"standby\") {\n // When skipping a query (ie. we're not querying for data but still want to\n // render children), make sure the `data` is cleared out and `loading` is\n // set to `false` (since we aren't loading anything).\n //\n // NOTE: We no longer think this is the correct behavior. Skipping should\n // not automatically set `data` to `undefined`, but instead leave the\n // previous data in place. In other words, skipping should not mandate that\n // previously received data is all of a sudden removed. Unfortunately,\n // changing this is breaking, so we'll have to wait until Apollo Client 4.0\n // to address this.\n this.result = this.skipStandbyResult;\n }\n else if (this.result === this.ssrDisabledResult ||\n this.result === this.skipStandbyResult) {\n this.result = void 0;\n }\n };\n InternalState.prototype.getObsQueryOptions = function () {\n var toMerge = [];\n var globalDefaults = this.client.defaultOptions.watchQuery;\n if (globalDefaults)\n toMerge.push(globalDefaults);\n if (this.queryHookOptions.defaultOptions) {\n toMerge.push(this.queryHookOptions.defaultOptions);\n }\n // We use compact rather than mergeOptions for this part of the merge,\n // because we want watchQueryOptions.variables (if defined) to replace\n // this.observable.options.variables whole. This replacement allows\n // removing variables by removing them from the variables input to\n // useQuery. If the variables were always merged together (rather than\n // replaced), there would be no way to remove existing variables.\n // However, the variables from options.defaultOptions and globalDefaults\n // (if provided) should be merged, to ensure individual defaulted\n // variables always have values, if not otherwise defined in\n // observable.options or watchQueryOptions.\n toMerge.push(compact(this.observable && this.observable.options, this.watchQueryOptions));\n return toMerge.reduce(mergeOptions);\n };\n // A function to massage options before passing them to ObservableQuery.\n InternalState.prototype.createWatchQueryOptions = function (_a) {\n var _b;\n if (_a === void 0) { _a = {}; }\n var skip = _a.skip, ssr = _a.ssr, onCompleted = _a.onCompleted, onError = _a.onError, defaultOptions = _a.defaultOptions, \n // The above options are useQuery-specific, so this ...otherOptions spread\n // makes otherOptions almost a WatchQueryOptions object, except for the\n // query property that we add below.\n otherOptions = __rest(_a, [\"skip\", \"ssr\", \"onCompleted\", \"onError\", \"defaultOptions\"]);\n // This Object.assign is safe because otherOptions is a fresh ...rest object\n // that did not exist until just now, so modifications are still allowed.\n var watchQueryOptions = Object.assign(otherOptions, { query: this.query });\n if (this.renderPromises &&\n (watchQueryOptions.fetchPolicy === \"network-only\" ||\n watchQueryOptions.fetchPolicy === \"cache-and-network\")) {\n // this behavior was added to react-apollo without explanation in this PR\n // https://github.com/apollographql/react-apollo/pull/1579\n watchQueryOptions.fetchPolicy = \"cache-first\";\n }\n if (!watchQueryOptions.variables) {\n watchQueryOptions.variables = {};\n }\n if (skip) {\n var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d;\n // When skipping, we set watchQueryOptions.fetchPolicy initially to\n // \"standby\", but we also need/want to preserve the initial non-standby\n // fetchPolicy that would have been used if not skipping.\n Object.assign(watchQueryOptions, {\n initialFetchPolicy: initialFetchPolicy,\n fetchPolicy: \"standby\",\n });\n }\n else if (!watchQueryOptions.fetchPolicy) {\n watchQueryOptions.fetchPolicy =\n ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) ||\n this.getDefaultFetchPolicy();\n }\n return watchQueryOptions;\n };\n InternalState.prototype.getDefaultFetchPolicy = function () {\n var _a, _b;\n return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||\n ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||\n \"cache-first\");\n };\n // Defining these methods as no-ops on the prototype allows us to call\n // state.onCompleted and/or state.onError without worrying about whether a\n // callback was provided.\n InternalState.prototype.onCompleted = function (data) { };\n InternalState.prototype.onError = function (error) { };\n InternalState.prototype.useObservableQuery = function () {\n // See if there is an existing observable that was used to fetch the same\n // data and if so, use it instead since it will contain the proper queryId\n // to fetch the result set. This is used during SSR.\n var obsQuery = (this.observable =\n (this.renderPromises &&\n this.renderPromises.getSSRObservable(this.watchQueryOptions)) ||\n this.observable || // Reuse this.observable if possible (and not SSR)\n this.client.watchQuery(this.getObsQueryOptions()));\n this.obsQueryFields = React.useMemo(function () { return ({\n refetch: obsQuery.refetch.bind(obsQuery),\n reobserve: obsQuery.reobserve.bind(obsQuery),\n fetchMore: obsQuery.fetchMore.bind(obsQuery),\n updateQuery: obsQuery.updateQuery.bind(obsQuery),\n startPolling: obsQuery.startPolling.bind(obsQuery),\n stopPolling: obsQuery.stopPolling.bind(obsQuery),\n subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery),\n }); }, [obsQuery]);\n var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip);\n if (this.renderPromises && ssrAllowed) {\n this.renderPromises.registerSSRObservable(obsQuery);\n if (obsQuery.getCurrentResult().loading) {\n // TODO: This is a legacy API which could probably be cleaned up\n this.renderPromises.addObservableQueryPromise(obsQuery);\n }\n }\n return obsQuery;\n };\n InternalState.prototype.setResult = function (nextResult) {\n var previousResult = this.result;\n if (previousResult && previousResult.data) {\n this.previousData = previousResult.data;\n }\n this.result = nextResult;\n // Calling state.setResult always triggers an update, though some call sites\n // perform additional equality checks before committing to an update.\n this.forceUpdate();\n this.handleErrorOrCompleted(nextResult, previousResult);\n };\n InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) {\n var _this = this;\n if (!result.loading) {\n var error_1 = this.toApolloError(result);\n // wait a tick in case we are in the middle of rendering a component\n Promise.resolve()\n .then(function () {\n if (error_1) {\n _this.onError(error_1);\n }\n else if (result.data &&\n (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus &&\n result.networkStatus === NetworkStatus.ready) {\n _this.onCompleted(result.data);\n }\n })\n .catch(function (error) {\n globalThis.__DEV__ !== false && invariant.warn(error);\n });\n }\n };\n InternalState.prototype.toApolloError = function (result) {\n return isNonEmptyArray(result.errors) ?\n new ApolloError({ graphQLErrors: result.errors })\n : result.error;\n };\n InternalState.prototype.getCurrentResult = function () {\n // Using this.result as a cache ensures getCurrentResult continues returning\n // the same (===) result object, unless state.setResult has been called, or\n // we're doing server rendering and therefore override the result below.\n if (!this.result) {\n this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult()));\n }\n return this.result;\n };\n InternalState.prototype.toQueryResult = function (result) {\n var queryResult = this.toQueryResultCache.get(result);\n if (queryResult)\n return queryResult;\n var data = result.data, partial = result.partial, resultWithoutPartial = __rest(result, [\"data\", \"partial\"]);\n this.toQueryResultCache.set(result, (queryResult = __assign(__assign(__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData })));\n if (!queryResult.error && isNonEmptyArray(result.errors)) {\n // Until a set naming convention for networkError and graphQLErrors is\n // decided upon, we map errors (graphQLErrors) to the error options.\n // TODO: Is it possible for both result.error and result.errors to be\n // defined here?\n queryResult.error = new ApolloError({ graphQLErrors: result.errors });\n }\n return queryResult;\n };\n InternalState.prototype.unsafeHandlePartialRefetch = function (result) {\n // WARNING: SIDE-EFFECTS IN THE RENDER FUNCTION\n //\n // TODO: This code should be removed when the partialRefetch option is\n // removed. I was unable to get this hook to behave reasonably in certain\n // edge cases when this block was put in an effect.\n if (result.partial &&\n this.queryHookOptions.partialRefetch &&\n !result.loading &&\n (!result.data || Object.keys(result.data).length === 0) &&\n this.observable.options.fetchPolicy !== \"cache-only\") {\n Object.assign(result, {\n loading: true,\n networkStatus: NetworkStatus.refetch,\n });\n this.observable.refetch();\n }\n };\n return InternalState;\n}());\n//# sourceMappingURL=useQuery.js.map","import { __assign } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { useInternalState } from \"./useQuery.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n// The following methods, when called will execute the query, regardless of\n// whether the useLazyQuery execute function was called before.\nvar EAGER_METHODS = [\n \"refetch\",\n \"reobserve\",\n \"fetchMore\",\n \"updateQuery\",\n \"startPolling\",\n \"subscribeToMore\",\n];\n/**\n * A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction.\n *\n * > Refer to the [Queries - Manual execution with useLazyQuery](https://www.apollographql.com/docs/react/data/queries#manual-execution-with-uselazyquery) section for a more in-depth overview of `useLazyQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useLazyQuery } from \"@apollo/client\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const [loadGreeting, { called, loading, data }] = useLazyQuery(\n * GET_GREETING,\n * { variables: { language: \"english\" } }\n * );\n * if (called && loading) return

    Loading ...

    \n * if (!called) {\n * return \n * }\n * return

    Hello {data.greeting.message}!

    ;\n * }\n * ```\n * @since 3.0.0\n *\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Default options to control how the query is executed.\n * @returns A tuple in the form of `[execute, result]`\n */\nexport function useLazyQuery(query, options) {\n var _a;\n var execOptionsRef = React.useRef();\n var optionsRef = React.useRef();\n var queryRef = React.useRef();\n var merged = mergeOptions(options, execOptionsRef.current || {});\n var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;\n // Use refs to track options and the used query to ensure the `execute`\n // function remains referentially stable between renders.\n optionsRef.current = options;\n queryRef.current = document;\n var internalState = useInternalState(useApolloClient(options && options.client), document);\n var useQueryResult = internalState.useQuery(__assign(__assign({}, merged), { skip: !execOptionsRef.current }));\n var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy ||\n internalState.getDefaultFetchPolicy();\n var result = Object.assign(useQueryResult, {\n called: !!execOptionsRef.current,\n });\n // We use useMemo here to make sure the eager methods have a stable identity.\n var eagerMethods = React.useMemo(function () {\n var eagerMethods = {};\n var _loop_1 = function (key) {\n var method = result[key];\n eagerMethods[key] = function () {\n if (!execOptionsRef.current) {\n execOptionsRef.current = Object.create(null);\n // Only the first time populating execOptionsRef.current matters here.\n internalState.forceUpdateState();\n }\n // @ts-expect-error this is just too generic to type\n return method.apply(this, arguments);\n };\n };\n for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) {\n var key = EAGER_METHODS_1[_i];\n _loop_1(key);\n }\n return eagerMethods;\n }, []);\n Object.assign(result, eagerMethods);\n var execute = React.useCallback(function (executeOptions) {\n execOptionsRef.current =\n executeOptions ? __assign(__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {\n fetchPolicy: initialFetchPolicy,\n };\n var options = mergeOptions(optionsRef.current, __assign({ query: queryRef.current }, execOptionsRef.current));\n var promise = internalState\n .executeQuery(__assign(__assign({}, options), { skip: false }))\n .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); });\n // Because the return value of `useLazyQuery` is usually floated, we need\n // to catch the promise to prevent unhandled rejections.\n promise.catch(function () { });\n return promise;\n }, []);\n return [execute, result];\n}\n//# sourceMappingURL=useLazyQuery.js.map","import { __assign } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n/**\n *\n *\n * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`.\n *\n * @example\n * ```jsx\n * import { gql, useMutation } from '@apollo/client';\n *\n * const ADD_TODO = gql`\n * mutation AddTodo($type: String!) {\n * addTodo(type: $type) {\n * id\n * type\n * }\n * }\n * `;\n *\n * function AddTodo() {\n * let input;\n * const [addTodo, { data }] = useMutation(ADD_TODO);\n *\n * return (\n *
    \n * {\n * e.preventDefault();\n * addTodo({ variables: { type: input.value } });\n * input.value = '';\n * }}\n * >\n * {\n * input = node;\n * }}\n * />\n * \n * \n *
    \n * );\n * }\n * ```\n * @since 3.0.0\n * @param mutation - A GraphQL mutation document parsed into an AST by `gql`.\n * @param options - Options to control how the mutation is executed.\n * @returns A tuple in the form of `[mutate, result]`\n */\nexport function useMutation(mutation, options) {\n var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);\n verifyDocumentType(mutation, DocumentType.Mutation);\n var _a = React.useState({\n called: false,\n loading: false,\n client: client,\n }), result = _a[0], setResult = _a[1];\n var ref = React.useRef({\n result: result,\n mutationId: 0,\n isMounted: true,\n client: client,\n mutation: mutation,\n options: options,\n });\n // TODO: Trying to assign these in a useEffect or useLayoutEffect breaks\n // higher-order components.\n {\n Object.assign(ref.current, { client: client, options: options, mutation: mutation });\n }\n var execute = React.useCallback(function (executeOptions) {\n if (executeOptions === void 0) { executeOptions = {}; }\n var _a = ref.current, options = _a.options, mutation = _a.mutation;\n var baseOptions = __assign(__assign({}, options), { mutation: mutation });\n var client = executeOptions.client || ref.current.client;\n if (!ref.current.result.loading &&\n !baseOptions.ignoreResults &&\n ref.current.isMounted) {\n setResult((ref.current.result = {\n loading: true,\n error: void 0,\n data: void 0,\n called: true,\n client: client,\n }));\n }\n var mutationId = ++ref.current.mutationId;\n var clientOptions = mergeOptions(baseOptions, executeOptions);\n return client\n .mutate(clientOptions)\n .then(function (response) {\n var _a, _b;\n var data = response.data, errors = response.errors;\n var error = errors && errors.length > 0 ?\n new ApolloError({ graphQLErrors: errors })\n : void 0;\n var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);\n if (error && onError) {\n onError(error, clientOptions);\n }\n if (mutationId === ref.current.mutationId &&\n !clientOptions.ignoreResults) {\n var result_1 = {\n called: true,\n loading: false,\n data: data,\n error: error,\n client: client,\n };\n if (ref.current.isMounted && !equal(ref.current.result, result_1)) {\n setResult((ref.current.result = result_1));\n }\n }\n var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted);\n if (!error) {\n onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions);\n }\n return response;\n })\n .catch(function (error) {\n var _a;\n if (mutationId === ref.current.mutationId && ref.current.isMounted) {\n var result_2 = {\n loading: false,\n error: error,\n data: void 0,\n called: true,\n client: client,\n };\n if (!equal(ref.current.result, result_2)) {\n setResult((ref.current.result = result_2));\n }\n }\n var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);\n if (onError) {\n onError(error, clientOptions);\n // TODO(brian): why are we returning this here???\n return { data: void 0, errors: error };\n }\n throw error;\n });\n }, []);\n var reset = React.useCallback(function () {\n if (ref.current.isMounted) {\n var result_3 = { called: false, loading: false, client: client };\n Object.assign(ref.current, { mutationId: 0, result: result_3 });\n setResult(result_3);\n }\n }, []);\n React.useEffect(function () {\n ref.current.isMounted = true;\n return function () {\n ref.current.isMounted = false;\n };\n }, []);\n return [execute, __assign({ reset: reset }, result)];\n}\n//# sourceMappingURL=useMutation.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n/**\n * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`.\n *\n * @example\n * ```jsx\n * const COMMENTS_SUBSCRIPTION = gql`\n * subscription OnCommentAdded($repoFullName: String!) {\n * commentAdded(repoFullName: $repoFullName) {\n * id\n * content\n * }\n * }\n * `;\n *\n * function DontReadTheComments({ repoFullName }) {\n * const {\n * data: { commentAdded },\n * loading,\n * } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } });\n * return

    New comment: {!loading && commentAdded.content}

    ;\n * }\n * ```\n * @remarks\n * #### Subscriptions and React 18 Automatic Batching\n *\n * With React 18's [automatic batching](https://react.dev/blog/2022/03/29/react-v18#new-feature-automatic-batching), multiple state updates may be grouped into a single re-render for better performance.\n *\n * If your subscription API sends multiple messages at the same time or in very fast succession (within fractions of a millisecond), it is likely that only the last message received in that narrow time frame will result in a re-render.\n *\n * Consider the following component:\n *\n * ```jsx\n * export function Subscriptions() {\n * const { data, error, loading } = useSubscription(query);\n * const [accumulatedData, setAccumulatedData] = useState([]);\n *\n * useEffect(() => {\n * setAccumulatedData((prev) => [...prev, data]);\n * }, [data]);\n *\n * return (\n * <>\n * {loading &&

    Loading...

    }\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * \n * );\n * }\n * ```\n *\n * If your subscription back-end emits two messages with the same timestamp, only the last message received by Apollo Client will be rendered. This is because React 18 will batch these two state updates into a single re-render.\n *\n * Since the component above is using `useEffect` to push `data` into a piece of local state on each `Subscriptions` re-render, the first message will never be added to the `accumulatedData` array since its render was skipped.\n *\n * Instead of using `useEffect` here, we can re-write this component to use the `onData` callback function accepted in `useSubscription`'s `options` object:\n *\n * ```jsx\n * export function Subscriptions() {\n * const [accumulatedData, setAccumulatedData] = useState([]);\n * const { data, error, loading } = useSubscription(\n * query,\n * {\n * onData({ data }) {\n * setAccumulatedData((prev) => [...prev, data])\n * }\n * }\n * );\n *\n * return (\n * <>\n * {loading &&

    Loading...

    }\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * \n * );\n * }\n * ```\n *\n * > ⚠️ **Note:** The `useSubscription` option `onData` is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named `onSubscriptionData`.\n *\n * Now, the first message will be added to the `accumulatedData` array since `onData` is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with `onData` we can guarantee each message received after the component mounts is added to `accumulatedData`.\n *\n * @since 3.0.0\n * @param subscription - A GraphQL subscription document parsed into an AST by `gql`.\n * @param options - Options to control how the subscription is executed.\n * @returns Query result object\n */\nexport function useSubscription(subscription, options) {\n var hasIssuedDeprecationWarningRef = React.useRef(false);\n var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);\n verifyDocumentType(subscription, DocumentType.Subscription);\n var _a = React.useState({\n loading: !(options === null || options === void 0 ? void 0 : options.skip),\n error: void 0,\n data: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n }), result = _a[0], setResult = _a[1];\n if (!hasIssuedDeprecationWarningRef.current) {\n hasIssuedDeprecationWarningRef.current = true;\n if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {\n globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53);\n }\n if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {\n globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55);\n }\n }\n var _b = React.useState(function () {\n if (options === null || options === void 0 ? void 0 : options.skip) {\n return null;\n }\n return client.subscribe({\n query: subscription,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,\n context: options === null || options === void 0 ? void 0 : options.context,\n });\n }), observable = _b[0], setObservable = _b[1];\n var canResetObservableRef = React.useRef(false);\n React.useEffect(function () {\n return function () {\n canResetObservableRef.current = true;\n };\n }, []);\n var ref = React.useRef({ client: client, subscription: subscription, options: options });\n React.useEffect(function () {\n var _a, _b, _c, _d;\n var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe;\n if (typeof shouldResubscribe === \"function\") {\n shouldResubscribe = !!shouldResubscribe(options);\n }\n if (options === null || options === void 0 ? void 0 : options.skip) {\n if (!(options === null || options === void 0 ? void 0 : options.skip) !== !((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.skip) ||\n canResetObservableRef.current) {\n setResult({\n loading: false,\n data: void 0,\n error: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n });\n setObservable(null);\n canResetObservableRef.current = false;\n }\n }\n else if ((shouldResubscribe !== false &&\n (client !== ref.current.client ||\n subscription !== ref.current.subscription ||\n (options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||\n !(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) ||\n !equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) ||\n canResetObservableRef.current) {\n setResult({\n loading: true,\n data: void 0,\n error: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n });\n setObservable(client.subscribe({\n query: subscription,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,\n context: options === null || options === void 0 ? void 0 : options.context,\n }));\n canResetObservableRef.current = false;\n }\n Object.assign(ref.current, { client: client, subscription: subscription, options: options });\n }, [client, subscription, options, canResetObservableRef.current]);\n React.useEffect(function () {\n if (!observable) {\n return;\n }\n var subscriptionStopped = false;\n var subscription = observable.subscribe({\n next: function (fetchResult) {\n var _a, _b;\n if (subscriptionStopped) {\n return;\n }\n var result = {\n loading: false,\n // TODO: fetchResult.data can be null but SubscriptionResult.data\n // expects TData | undefined only\n data: fetchResult.data,\n error: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n };\n setResult(result);\n if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) {\n ref.current.options.onData({\n client: client,\n data: result,\n });\n }\n else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) {\n ref.current.options.onSubscriptionData({\n client: client,\n subscriptionData: result,\n });\n }\n },\n error: function (error) {\n var _a, _b;\n if (!subscriptionStopped) {\n setResult({\n loading: false,\n data: void 0,\n error: error,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n });\n (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);\n }\n },\n complete: function () {\n var _a, _b;\n if (!subscriptionStopped) {\n if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {\n ref.current.options.onComplete();\n }\n else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {\n ref.current.options.onSubscriptionComplete();\n }\n }\n },\n });\n return function () {\n // immediately stop receiving subscription values, but do not unsubscribe\n // until after a short delay in case another useSubscription hook is\n // reusing the same underlying observable and is about to subscribe\n subscriptionStopped = true;\n setTimeout(function () {\n subscription.unsubscribe();\n });\n };\n }, [observable]);\n return result;\n}\n//# sourceMappingURL=useSubscription.js.map","import * as React from \"rehackt\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\n/**\n * Reads the value of a [reactive variable](https://www.apollographql.com/docs/react/local-state/reactive-variables/) and re-renders the containing component whenever that variable's value changes. This enables a reactive variable to trigger changes _without_ relying on the `useQuery` hook.\n *\n * @example\n * ```jsx\n * import { makeVar, useReactiveVar } from \"@apollo/client\";\n * export const cartItemsVar = makeVar([]);\n *\n * export function Cart() {\n * const cartItems = useReactiveVar(cartItemsVar);\n * // ...\n * }\n * ```\n * @since 3.2.0\n * @param rv - A reactive variable.\n * @returns The current value of the reactive variable.\n */\nexport function useReactiveVar(rv) {\n return useSyncExternalStore(React.useCallback(function (update) {\n // By reusing the same onNext function in the nested call to\n // rv.onNextChange(onNext), we can keep using the initial clean-up function\n // returned by rv.onNextChange(function onNext(v){...}), without having to\n // register the new clean-up function (returned by the nested\n // rv.onNextChange(onNext)) with yet another callback.\n return rv.onNextChange(function onNext() {\n update();\n rv.onNextChange(onNext);\n });\n }, [rv]), rv, rv);\n}\n//# sourceMappingURL=useReactiveVar.js.map","import * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\nexport function useDeepMemo(memoFn, deps) {\n var ref = React.useRef();\n if (!ref.current || !equal(ref.current.deps, deps)) {\n ref.current = { value: memoFn(), deps: deps };\n }\n return ref.current.value;\n}\n//# sourceMappingURL=useDeepMemo.js.map","import * as React from \"rehackt\";\nfunction getRenderDispatcher() {\n var _a, _b;\n return (_b = (_a = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentDispatcher) === null || _b === void 0 ? void 0 : _b.current;\n}\nvar RenderDispatcher = null;\n/*\nRelay does this too, so we hope this is safe.\nhttps://github.com/facebook/relay/blob/8651fbca19adbfbb79af7a3bc40834d105fd7747/packages/react-relay/relay-hooks/loadQuery.js#L90-L98\n*/\nexport function useRenderGuard() {\n RenderDispatcher = getRenderDispatcher();\n return React.useCallback(function () {\n return (RenderDispatcher !== null && RenderDispatcher === getRenderDispatcher());\n }, []);\n}\n//# sourceMappingURL=useRenderGuard.js.map","import * as React from \"rehackt\";\nvar INIT = {};\nexport function useLazyRef(getInitialValue) {\n var ref = React.useRef(INIT);\n if (ref.current === INIT) {\n ref.current = getInitialValue();\n }\n return ref;\n}\n//# sourceMappingURL=useLazyRef.js.map","import { wrapPromiseWithState } from \"../../../utilities/index.js\";\nimport * as React from \"rehackt\";\n// Prevent webpack from complaining about our feature detection of the\n// use property of the React namespace, which is expected not\n// to exist when using current stable versions, and that's fine.\nvar useKey = \"use\";\nvar realHook = React[useKey];\n// This is named with two underscores to allow this hook to evade typical rules of\n// hooks (i.e. it can be used conditionally)\nexport var __use = realHook ||\n function __use(promise) {\n var statefulPromise = wrapPromiseWithState(promise);\n switch (statefulPromise.status) {\n case \"pending\":\n throw statefulPromise;\n case \"rejected\":\n throw statefulPromise.reason;\n case \"fulfilled\":\n return statefulPromise.value;\n }\n };\n//# sourceMappingURL=__use.js.map","import { __assign, __rest } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\nimport { mergeDeepArray } from \"../../utilities/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { useDeepMemo, useLazyRef } from \"./internal/index.js\";\nexport function useFragment(options) {\n var cache = useApolloClient(options.client).cache;\n var diffOptions = useDeepMemo(function () {\n var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = __rest(options, [\"fragment\", \"fragmentName\", \"from\", \"optimistic\"]);\n return __assign(__assign({}, rest), { returnPartialData: true, id: typeof from === \"string\" ? from : cache.identify(from), query: cache[\"getFragmentDoc\"](fragment, fragmentName), optimistic: optimistic });\n }, [options]);\n var resultRef = useLazyRef(function () {\n return diffToResult(cache.diff(diffOptions));\n });\n // Used for both getSnapshot and getServerSnapshot\n var getSnapshot = React.useCallback(function () { return resultRef.current; }, []);\n return useSyncExternalStore(React.useCallback(function (forceUpdate) {\n var lastTimeout = 0;\n var unsubscribe = cache.watch(__assign(__assign({}, diffOptions), { immediate: true, callback: function (diff) {\n if (!equal(diff.result, resultRef.current.data)) {\n resultRef.current = diffToResult(diff);\n // If we get another update before we've re-rendered, bail out of\n // the update and try again. This ensures that the relative timing\n // between useQuery and useFragment stays roughly the same as\n // fixed in https://github.com/apollographql/apollo-client/pull/11083\n clearTimeout(lastTimeout);\n lastTimeout = setTimeout(forceUpdate);\n }\n } }));\n return function () {\n unsubscribe();\n clearTimeout(lastTimeout);\n };\n }, [cache, diffOptions]), getSnapshot, getSnapshot);\n}\nfunction diffToResult(diff) {\n var result = {\n data: diff.result,\n complete: !!diff.complete,\n };\n if (diff.missing) {\n result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));\n }\n return result;\n}\n//# sourceMappingURL=useFragment.js.map","import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { createFulfilledPromise, createRejectedPromise, } from \"../../../utilities/index.js\";\nimport { wrapPromiseWithState } from \"../../../utilities/index.js\";\nvar QUERY_REFERENCE_SYMBOL = Symbol();\nvar PROMISE_SYMBOL = Symbol();\nexport function wrapQueryRef(internalQueryRef) {\n var _a;\n var ref = (_a = {\n toPromise: function () {\n // We avoid resolving this promise with the query data because we want to\n // discourage using the server data directly from the queryRef. Instead,\n // the data should be accessed through `useReadQuery`. When the server\n // data is needed, its better to use `client.query()` directly.\n //\n // Here we resolve with the ref itself to make using this in React Router\n // or TanStack Router `loader` functions a bit more ergonomic e.g.\n //\n // function loader() {\n // return { queryRef: await preloadQuery(query).toPromise() }\n // }\n return getWrappedPromise(ref).then(function () { return ref; });\n }\n },\n _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef,\n _a[PROMISE_SYMBOL] = internalQueryRef.promise,\n _a);\n return ref;\n}\nexport function getWrappedPromise(queryRef) {\n var internalQueryRef = unwrapQueryRef(queryRef);\n return internalQueryRef.promise.status === \"fulfilled\" ?\n internalQueryRef.promise\n : queryRef[PROMISE_SYMBOL];\n}\nexport function unwrapQueryRef(queryRef) {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\nexport function updateWrappedQueryRef(queryRef, promise) {\n queryRef[PROMISE_SYMBOL] = promise;\n}\nvar OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n];\nvar InternalQueryReference = /** @class */ (function () {\n function InternalQueryReference(observable, options) {\n var _this = this;\n this.key = {};\n this.listeners = new Set();\n this.references = 0;\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n this.setResult();\n this.subscribeToQuery();\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n var startDisposeTimer = function () {\n var _a;\n if (!_this.references) {\n _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);\n }\n };\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n Object.defineProperty(InternalQueryReference.prototype, \"disposed\", {\n get: function () {\n return this.subscription.closed;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InternalQueryReference.prototype, \"watchQueryOptions\", {\n get: function () {\n return this.observable.options;\n },\n enumerable: false,\n configurable: true\n });\n InternalQueryReference.prototype.reinitialize = function () {\n var observable = this.observable;\n var originalFetchPolicy = this.watchQueryOptions.fetchPolicy;\n try {\n if (originalFetchPolicy !== \"no-cache\") {\n observable.resetLastResults();\n observable.silentSetOptions({ fetchPolicy: \"cache-first\" });\n }\n else {\n observable.silentSetOptions({ fetchPolicy: \"standby\" });\n }\n this.subscribeToQuery();\n if (originalFetchPolicy === \"no-cache\") {\n return;\n }\n observable.resetDiff();\n this.setResult();\n }\n finally {\n observable.silentSetOptions({ fetchPolicy: originalFetchPolicy });\n }\n };\n InternalQueryReference.prototype.retain = function () {\n var _this = this;\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n var disposed = false;\n return function () {\n if (disposed) {\n return;\n }\n disposed = true;\n _this.references--;\n // Wait before fully disposing in case the app is running in strict mode.\n setTimeout(function () {\n if (!_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {\n var _this = this;\n return OBSERVED_CHANGED_OPTIONS.some(function (option) {\n return !equal(_this.watchQueryOptions[option], watchQueryOptions[option]);\n });\n };\n InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {\n var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n }\n else {\n this.observable.silentSetOptions(watchQueryOptions);\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = __assign(__assign({}, this.result), this.observable.getCurrentResult());\n this.promise = createFulfilledPromise(this.result);\n }\n }\n return this.promise;\n };\n InternalQueryReference.prototype.listen = function (listener) {\n var _this = this;\n this.listeners.add(listener);\n return function () {\n _this.listeners.delete(listener);\n };\n };\n InternalQueryReference.prototype.refetch = function (variables) {\n return this.initiateFetch(this.observable.refetch(variables));\n };\n InternalQueryReference.prototype.fetchMore = function (options) {\n return this.initiateFetch(this.observable.fetchMore(options));\n };\n InternalQueryReference.prototype.dispose = function () {\n this.subscription.unsubscribe();\n this.onDispose();\n };\n InternalQueryReference.prototype.onDispose = function () {\n // noop. overridable by options\n };\n InternalQueryReference.prototype.handleNext = function (result) {\n var _a;\n switch (this.promise.status) {\n case \"pending\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);\n break;\n }\n default: {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data &&\n result.networkStatus === this.result.networkStatus) {\n return;\n }\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n };\n InternalQueryReference.prototype.handleError = function (error) {\n var _a;\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError);\n switch (this.promise.status) {\n case \"pending\": {\n (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);\n break;\n }\n default: {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n };\n InternalQueryReference.prototype.deliver = function (promise) {\n this.listeners.forEach(function (listener) { return listener(promise); });\n };\n InternalQueryReference.prototype.initiateFetch = function (returnedPromise) {\n var _this = this;\n this.promise = this.createPendingPromise();\n this.promise.catch(function () { });\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then(function (result) {\n var _a;\n if (_this.promise.status === \"pending\") {\n _this.result = result;\n (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);\n }\n })\n .catch(function () { });\n return returnedPromise;\n };\n InternalQueryReference.prototype.subscribeToQuery = function () {\n var _this = this;\n this.subscription = this.observable\n .filter(function (result) { return !equal(result.data, {}) && !equal(result, _this.result); })\n .subscribe(this.handleNext, this.handleError);\n };\n InternalQueryReference.prototype.setResult = function () {\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n var result = this.observable.getCurrentResult(false);\n if (equal(result, this.result)) {\n return;\n }\n this.result = result;\n this.promise =\n (result.data &&\n (!result.partial || this.watchQueryOptions.returnPartialData)) ?\n createFulfilledPromise(result)\n : this.createPendingPromise();\n };\n InternalQueryReference.prototype.createPendingPromise = function () {\n var _this = this;\n return wrapPromiseWithState(new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n }));\n };\n return InternalQueryReference;\n}());\nexport { InternalQueryReference };\n//# sourceMappingURL=QueryReference.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap } from \"../../../utilities/index.js\";\nimport { InternalQueryReference } from \"./QueryReference.js\";\nvar SuspenseCache = /** @class */ (function () {\n function SuspenseCache(options) {\n if (options === void 0) { options = Object.create(null); }\n this.queryRefs = new Trie(canUseWeakMap);\n this.options = options;\n }\n SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n if (!ref.current) {\n ref.current = new InternalQueryReference(createObservable(), {\n autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,\n onDispose: function () {\n delete ref.current;\n },\n });\n }\n return ref.current;\n };\n return SuspenseCache;\n}());\nexport { SuspenseCache };\n//# sourceMappingURL=SuspenseCache.js.map","import { SuspenseCache } from \"./SuspenseCache.js\";\nvar suspenseCacheSymbol = Symbol.for(\"apollo.suspenseCache\");\nexport function getSuspenseCache(client) {\n var _a;\n if (!client[suspenseCacheSymbol]) {\n client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);\n }\n return client[suspenseCacheSymbol];\n}\n//# sourceMappingURL=getSuspenseCache.js.map","export var skipToken = Symbol.for(\"apollo.skipToken\");\n//# sourceMappingURL=constants.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { ApolloError, NetworkStatus } from \"../../core/index.js\";\nimport { isNonEmptyArray } from \"../../utilities/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { __use, useDeepMemo } from \"./internal/index.js\";\nimport { getSuspenseCache } from \"../internal/index.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { skipToken } from \"./constants.js\";\nexport function useSuspenseQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n var client = useApolloClient(options.client);\n var suspenseCache = getSuspenseCache(client);\n var watchQueryOptions = useWatchQueryOptions({\n client: client,\n query: query,\n options: options,\n });\n var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;\n var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;\n var cacheKey = __spreadArray([\n query,\n canonicalStringify(variables)\n ], [].concat(queryKey), true);\n var queryRef = suspenseCache.getQueryRef(cacheKey, function () {\n return client.watchQuery(watchQueryOptions);\n });\n var _b = React.useState([queryRef.key, queryRef.promise]), current = _b[0], setPromise = _b[1];\n // This saves us a re-execution of the render function when a variable changed.\n if (current[0] !== queryRef.key) {\n current[0] = queryRef.key;\n current[1] = queryRef.promise;\n }\n var promise = current[1];\n if (queryRef.didChangeOptions(watchQueryOptions)) {\n current[1] = promise = queryRef.applyOptions(watchQueryOptions);\n }\n React.useEffect(function () {\n var dispose = queryRef.retain();\n var removeListener = queryRef.listen(function (promise) {\n setPromise([queryRef.key, promise]);\n });\n return function () {\n removeListener();\n dispose();\n };\n }, [queryRef]);\n var skipResult = React.useMemo(function () {\n var error = toApolloError(queryRef.result);\n return {\n loading: false,\n data: queryRef.result.data,\n networkStatus: error ? NetworkStatus.error : NetworkStatus.ready,\n error: error,\n };\n }, [queryRef.result]);\n var result = fetchPolicy === \"standby\" ? skipResult : __use(promise);\n var fetchMore = React.useCallback((function (options) {\n var promise = queryRef.fetchMore(options);\n setPromise([queryRef.key, queryRef.promise]);\n return promise;\n }), [queryRef]);\n var refetch = React.useCallback(function (variables) {\n var promise = queryRef.refetch(variables);\n setPromise([queryRef.key, queryRef.promise]);\n return promise;\n }, [queryRef]);\n var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);\n return React.useMemo(function () {\n return {\n client: client,\n data: result.data,\n error: toApolloError(result),\n networkStatus: result.networkStatus,\n fetchMore: fetchMore,\n refetch: refetch,\n subscribeToMore: subscribeToMore,\n };\n }, [client, fetchMore, refetch, result, subscribeToMore]);\n}\nfunction validateOptions(options) {\n var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData;\n verifyDocumentType(query, DocumentType.Query);\n validateFetchPolicy(fetchPolicy);\n validatePartialDataReturn(fetchPolicy, returnPartialData);\n}\nfunction validateFetchPolicy(fetchPolicy) {\n if (fetchPolicy === void 0) { fetchPolicy = \"cache-first\"; }\n var supportedFetchPolicies = [\n \"cache-first\",\n \"network-only\",\n \"no-cache\",\n \"cache-and-network\",\n ];\n invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy);\n}\nfunction validatePartialDataReturn(fetchPolicy, returnPartialData) {\n if (fetchPolicy === \"no-cache\" && returnPartialData) {\n globalThis.__DEV__ !== false && invariant.warn(57);\n }\n}\nexport function toApolloError(result) {\n return isNonEmptyArray(result.errors) ?\n new ApolloError({ graphQLErrors: result.errors })\n : result.error;\n}\nexport function useWatchQueryOptions(_a) {\n var client = _a.client, query = _a.query, options = _a.options;\n return useDeepMemo(function () {\n var _a;\n if (options === skipToken) {\n return { query: query, fetchPolicy: \"standby\" };\n }\n var fetchPolicy = options.fetchPolicy ||\n ((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||\n \"cache-first\";\n var watchQueryOptions = __assign(__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 });\n if (globalThis.__DEV__ !== false) {\n validateOptions(watchQueryOptions);\n }\n // Assign the updated fetch policy after our validation since `standby` is\n // not a supported fetch policy on its own without the use of `skip`.\n if (options.skip) {\n watchQueryOptions.fetchPolicy = \"standby\";\n }\n return watchQueryOptions;\n }, [client, options, query]);\n}\n//# sourceMappingURL=useSuspenseQuery.js.map","import { __spreadArray } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from \"../internal/index.js\";\nimport { useWatchQueryOptions } from \"./useSuspenseQuery.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nexport function useBackgroundQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n var client = useApolloClient(options.client);\n var suspenseCache = getSuspenseCache(client);\n var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });\n var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;\n var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;\n // This ref tracks the first time query execution is enabled to determine\n // whether to return a query ref or `undefined`. When initialized\n // in a skipped state (either via `skip: true` or `skipToken`) we return\n // `undefined` for the `queryRef` until the query has been enabled. Once\n // enabled, a query ref is always returned regardless of whether the query is\n // skipped again later.\n var didFetchResult = React.useRef(fetchPolicy !== \"standby\");\n didFetchResult.current || (didFetchResult.current = fetchPolicy !== \"standby\");\n var cacheKey = __spreadArray([\n query,\n canonicalStringify(variables)\n ], [].concat(queryKey), true);\n var queryRef = suspenseCache.getQueryRef(cacheKey, function () {\n return client.watchQuery(watchQueryOptions);\n });\n var _b = React.useState(wrapQueryRef(queryRef)), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];\n if (unwrapQueryRef(wrappedQueryRef) !== queryRef) {\n setWrappedQueryRef(wrapQueryRef(queryRef));\n }\n if (queryRef.didChangeOptions(watchQueryOptions)) {\n var promise = queryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(wrappedQueryRef, promise);\n }\n var fetchMore = React.useCallback(function (options) {\n var promise = queryRef.fetchMore(options);\n setWrappedQueryRef(wrapQueryRef(queryRef));\n return promise;\n }, [queryRef]);\n var refetch = React.useCallback(function (variables) {\n var promise = queryRef.refetch(variables);\n setWrappedQueryRef(wrapQueryRef(queryRef));\n return promise;\n }, [queryRef]);\n return [\n didFetchResult.current ? wrappedQueryRef : void 0,\n { fetchMore: fetchMore, refetch: refetch },\n ];\n}\n//# sourceMappingURL=useBackgroundQuery.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from \"../internal/index.js\";\nimport { useRenderGuard } from \"./internal/index.js\";\nimport { useWatchQueryOptions } from \"./useSuspenseQuery.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nexport function useLoadableQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n var client = useApolloClient(options.client);\n var suspenseCache = getSuspenseCache(client);\n var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });\n var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;\n var _b = React.useState(null), queryRef = _b[0], setQueryRef = _b[1];\n var internalQueryRef = queryRef && unwrapQueryRef(queryRef);\n if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) {\n var promise = internalQueryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(queryRef, promise);\n }\n var calledDuringRender = useRenderGuard();\n var fetchMore = React.useCallback(function (options) {\n if (!internalQueryRef) {\n throw new Error(\"The query has not been loaded. Please load the query.\");\n }\n var promise = internalQueryRef.fetchMore(options);\n setQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n var refetch = React.useCallback(function (options) {\n if (!internalQueryRef) {\n throw new Error(\"The query has not been loaded. Please load the query.\");\n }\n var promise = internalQueryRef.refetch(options);\n setQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n var loadQuery = React.useCallback(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n invariant(!calledDuringRender(), 50);\n var variables = args[0];\n var cacheKey = __spreadArray([\n query,\n canonicalStringify(variables)\n ], [].concat(queryKey), true);\n var queryRef = suspenseCache.getQueryRef(cacheKey, function () {\n return client.watchQuery(__assign(__assign({}, watchQueryOptions), { variables: variables }));\n });\n setQueryRef(wrapQueryRef(queryRef));\n }, [query, queryKey, suspenseCache, watchQueryOptions, calledDuringRender]);\n var reset = React.useCallback(function () {\n setQueryRef(null);\n }, [queryRef]);\n return [loadQuery, queryRef, { fetchMore: fetchMore, refetch: refetch, reset: reset }];\n}\n//# sourceMappingURL=useLoadableQuery.js.map","import * as React from \"rehackt\";\nimport { getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from \"../internal/index.js\";\n/**\n * A React hook that returns a `refetch` and `fetchMore` function for a given\n * `queryRef`.\n *\n * This is useful to get access to handlers for a `queryRef` that was created by\n * `createQueryPreloader` or when the handlers for a `queryRef` produced in\n * a different component are inaccessible.\n *\n * @example\n * ```tsx\n * const MyComponent({ queryRef }) {\n * const { refetch, fetchMore } = useQueryRefHandlers(queryRef);\n *\n * // ...\n * }\n * ```\n * @since 3.9.0\n * @param queryRef - A `QueryReference` returned from `useBackgroundQuery`, `useLoadableQuery`, or `createQueryPreloader`.\n */\nexport function useQueryRefHandlers(queryRef) {\n var _a = React.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1];\n var _b = React.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];\n var internalQueryRef = unwrapQueryRef(queryRef);\n // To ensure we can support React transitions, this hook needs to manage the\n // queryRef state and apply React's state value immediately to the existing\n // queryRef since this hook doesn't return the queryRef directly\n if (previousQueryRef !== queryRef) {\n setPreviousQueryRef(queryRef);\n setWrappedQueryRef(queryRef);\n }\n else {\n updateWrappedQueryRef(queryRef, getWrappedPromise(wrappedQueryRef));\n }\n var refetch = React.useCallback(function (variables) {\n var promise = internalQueryRef.refetch(variables);\n setWrappedQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n var fetchMore = React.useCallback(function (options) {\n var promise = internalQueryRef.fetchMore(options);\n setWrappedQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n return { refetch: refetch, fetchMore: fetchMore };\n}\n//# sourceMappingURL=useQueryRefHandlers.js.map","import * as React from \"rehackt\";\nimport { getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, } from \"../internal/index.js\";\nimport { __use } from \"./internal/index.js\";\nimport { toApolloError } from \"./useSuspenseQuery.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nexport function useReadQuery(queryRef) {\n var internalQueryRef = React.useMemo(function () { return unwrapQueryRef(queryRef); }, [queryRef]);\n var getPromise = React.useCallback(function () { return getWrappedPromise(queryRef); }, [queryRef]);\n if (internalQueryRef.disposed) {\n internalQueryRef.reinitialize();\n updateWrappedQueryRef(queryRef, internalQueryRef.promise);\n }\n React.useEffect(function () { return internalQueryRef.retain(); }, [internalQueryRef]);\n var promise = useSyncExternalStore(React.useCallback(function (forceUpdate) {\n return internalQueryRef.listen(function (promise) {\n updateWrappedQueryRef(queryRef, promise);\n forceUpdate();\n });\n }, [internalQueryRef]), getPromise, getPromise);\n var result = __use(promise);\n return React.useMemo(function () {\n return {\n data: result.data,\n networkStatus: result.networkStatus,\n error: toApolloError(result),\n };\n }, [result]);\n}\n//# sourceMappingURL=useReadQuery.js.map","import { __assign } from \"tslib\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n * @alpha\n */\nexport function createQueryPreloader(client) {\n return function preloadQuery(query, options) {\n var _a, _b;\n if (options === void 0) { options = Object.create(null); }\n var queryRef = new InternalQueryReference(client.watchQuery(__assign(__assign({}, options), { query: query })), {\n autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,\n });\n return wrapQueryRef(queryRef);\n };\n}\n//# sourceMappingURL=createQueryPreloader.js.map"],"names":["originalInvariant","InvariantError","global","visit","BREAK","__assign","__spreadArray","WeakCache","StrongCache","Trie","wrap","origPrint","Kind","hasOwnProperty","Observable","__extends","__awaiter","__generator","__rest","Cache","dep","equal","isObjectOrArray","Slot","NetworkStatus","isSelectionNode","React","realHook","DocumentType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAI,OAAO,GAAG,OAAO;;ACArB,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI;AACR,QAAQ,OAAO,KAAK,EAAE,CAAC;AACvB,KAAK;AACL,IAAI,OAAO,EAAE,EAAE,GAAG;AAClB;;ACJA,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,UAAU,CAAC,EAAE,CAAC;AACzD,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AACzC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;AACvC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AAMzC,KAAK,CAAC,YAAY;AAClB,IAAI,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;AAC9C,CAAC,CAAC;;ACZF,IAAI,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAGtB,SAAS,YAAY,CAAC,MAAM,EAAE;AACrC,IAAI,IAAI,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACxC,IAAI,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,C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E,aAAa,CAAC,MAAM,CAAC;AACxC,SAAS,CAAC;AACV,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACjB;;ACNO,SAAS,oBAAoB,CAAC,MAAM,EAAE;AAC7C,IAAI,OAAO,SAAS,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE;AACjD,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC;AACnB,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;AAClE,QAAQ,IAAI,QAAQ,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,UAAU,CAACrB,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE;AACxH,YAAY,oBAAoB,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,oBAAoB;AACzL,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK,CAAC;AACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/apollo-client.min.cjs b/graphql-subscription/node_modules/@apollo/client/apollo-client.min.cjs new file mode 100644 index 0000000..70f257e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/apollo-client.min.cjs @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("ts-invariant"),r=require("@wry/equality"),n=require("@wry/caches"),i=require("graphql"),o=require("zen-observable-ts");require("symbol-observable");var s=require("optimism"),a=require("@wry/trie"),u=require("graphql-tag"),c=require("rehackt");function l(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e)for(var r in e)t[r]=e[r];return t.default=e,Object.freeze(t)}var h=l(r),p=f(c),d="3.9.5";function v(e){try{return e()}catch(e){}}var y=v((function(){return globalThis}))||v((function(){return window}))||v((function(){return self}))||v((function(){return global}))||v((function(){return v.constructor("return this")()})),m=new Map;function g(e){var t=m.get(e)||1;return m.set(e,t+1),"".concat(e,":").concat(t,":").concat(Math.random().toString(36).slice(2))}function b(e,t){void 0===t&&(t=0);var r=g("stringifyForDisplay");return JSON.stringify(e,(function(e,t){return void 0===t?r:t}),t).split(JSON.stringify(r)).join("")}function _(e){return function(t){for(var r=[],n=1;n=0}))||!1,M=F&&!I;function j(e){return null!==e&&"object"==typeof e}function N(t,r){var n=r,i=[];return t.definitions.forEach((function(e){if("OperationDefinition"===e.kind)throw w(71,e.operation,e.name?" named '".concat(e.name.value,"'"):"");"FragmentDefinition"===e.kind&&i.push(e)})),void 0===n&&(O(1===i.length,72,i.length),n=i[0].name.value),e.__assign(e.__assign({},t),{definitions:e.__spreadArray([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:n}}]}}],t.definitions,!0)})}function A(e){void 0===e&&(e=[]);var t={};return e.forEach((function(e){t[e.name.value]=e})),t}function L(e,t){switch(e.kind){case"InlineFragment":return e;case"FragmentSpread":var r=e.name.value;if("function"==typeof t)return t(r);var n=t&&t[r];return O(n,73,r),n||null;default:return null}}var W=new WeakSet;function V(e){W.has(e)||(W.add(e),setTimeout((function(){e.clean(),W.delete(e)}),100))}var z=function(e,t){var r=new n.WeakCache(e,t);return r.set=function(e,t){return V(this),n.WeakCache.prototype.set.call(this,e,t)},r},B=function(e,t){var r=new n.StrongCache(e,t);return r.set=function(e,t){return V(this),n.StrongCache.prototype.set.call(this,e,t)},r},U=Symbol.for("apollo.cacheSize"),K=e.__assign({},y[U]);var H,J=Object.assign((function(e){return JSON.stringify(e,G)}),{reset:function(){H=new B(K.canonicalStringify||1e3)}});function G(e,t){if(t&&"object"==typeof t){var r=Object.getPrototypeOf(t);if(r===Object.prototype||null===r){var n=Object.keys(t);if(n.every(Y))return t;var i=JSON.stringify(n),o=H.get(i);if(!o){n.sort();var s=JSON.stringify(n);o=H.get(s)||n,H.set(i,o),H.set(s,o)}var a=Object.create(r);return o.forEach((function(e){a[e]=t[e]})),a}}return t}function Y(e,t,r){return 0===t||r[t-1]<=e}function X(e){return{__ref:String(e)}}function $(e){return Boolean(e&&"object"==typeof e&&"string"==typeof e.__ref)}function Z(e,t,r,n){if(function(e){return"IntValue"===e.kind}(r)||function(e){return"FloatValue"===e.kind}(r))e[t.value]=Number(r.value);else if(function(e){return"BooleanValue"===e.kind}(r)||function(e){return"StringValue"===e.kind}(r))e[t.value]=r.value;else if(function(e){return"ObjectValue"===e.kind}(r)){var i={};r.fields.map((function(e){return Z(i,e.name,e.value,n)})),e[t.value]=i}else if(function(e){return"Variable"===e.kind}(r)){var o=(n||{})[r.name.value];e[t.value]=o}else if(function(e){return"ListValue"===e.kind}(r))e[t.value]=r.values.map((function(e){var r={};return Z(r,t,e,n),r[t.value]}));else if(function(e){return"EnumValue"===e.kind}(r))e[t.value]=r.value;else{if(!function(e){return"NullValue"===e.kind}(r))throw w(82,t.value,r.kind);e[t.value]=null}}J.reset();var ee=["connection","include","skip","client","rest","export","nonreactive"],te=J,re=Object.assign((function(e,t,r){if(t&&r&&r.connection&&r.connection.key){if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach((function(e){i[e]=t[e]})),"".concat(r.connection.key,"(").concat(te(i),")")}return r.connection.key}var o=e;if(t){var s=te(t);o+="(".concat(s,")")}return r&&Object.keys(r).forEach((function(e){-1===ee.indexOf(e)&&(r[e]&&Object.keys(r[e]).length?o+="@".concat(e,"(").concat(te(r[e]),")"):o+="@".concat(e))})),o}),{setStringify:function(e){var t=te;return te=e,t}});function ne(e,t){if(e.arguments&&e.arguments.length){var r={};return e.arguments.forEach((function(e){var n=e.name,i=e.value;return Z(r,n,i,t)})),r}return null}function ie(e){return e.alias?e.alias.value:e.name.value}function oe(e,t,r){for(var n,i=0,o=t.selections;i0}var _e={kind:i.Kind.FIELD,name:{kind:i.Kind.NAME,value:"__typename"}};function Oe(e,t){return!e||e.selectionSet.selections.every((function(e){return e.kind===i.Kind.FRAGMENT_SPREAD&&Oe(t[e.name.value],t)}))}function we(e){return Oe(ue(e)||function(e){O("Document"===e.kind,78),O(e.definitions.length<=1,79);var t=e.definitions[0];return O("FragmentDefinition"===t.kind,80),t}(e),A(le(e)))?null:e}function ke(e){var t=new Map;return function(r){void 0===r&&(r=e);var n=t.get(r);return n||t.set(r,n={variables:new Set,fragmentSpreads:new Set}),n}}function Se(t,r){ae(r);for(var n=ke(""),o=ke(""),s=function(e){for(var t=0,r=void 0;t=0;--u)r.definitions[u].kind===i.Kind.OPERATION_DEFINITION&&++a;var c,l,f,h=(c=t,l=new Map,f=new Map,c.forEach((function(e){e&&(e.name?l.set(e.name,e):e.test&&f.set(e.test,e))})),function(e){var t=l.get(e.name.value);return!t&&f.size&&f.forEach((function(r,n){n(e)&&(t=r)})),t}),p=function(e){return be(e)&&e.map(h).some((function(e){return e&&e.remove}))},d=new Map,v=!1,y={enter:function(e){if(p(e.directives))return v=!0,null}},m=i.visit(r,{Field:y,InlineFragment:y,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(e,t,r,n,i){var o=s(i);o&&o.variables.add(e.name.value)}},FragmentSpread:{enter:function(e,t,r,n,i){if(p(e.directives))return v=!0,null;var o=s(i);o&&o.fragmentSpreads.add(e.name.value)}},FragmentDefinition:{enter:function(e,t,r,n){d.set(JSON.stringify(n),e)},leave:function(e,t,r,n){return e===d.get(JSON.stringify(n))?e:a>0&&e.selectionSet.selections.every((function(e){return e.kind===i.Kind.FIELD&&"__typename"===e.name.value}))?(o(e.name.value).removed=!0,v=!0,null):void 0}},Directive:{leave:function(e){if(h(e))return v=!0,null}}});if(!v)return r;var g=function(e){return e.transitiveVars||(e.transitiveVars=new Set(e.variables),e.removed||e.fragmentSpreads.forEach((function(t){g(o(t)).transitiveVars.forEach((function(t){e.transitiveVars.add(t)}))}))),e},b=new Set;m.definitions.forEach((function(e){e.kind===i.Kind.OPERATION_DEFINITION?g(n(e.name&&e.name.value)).fragmentSpreads.forEach((function(e){b.add(e)})):e.kind!==i.Kind.FRAGMENT_DEFINITION||0!==a||o(e.name.value).removed||b.add(e.name.value)})),b.forEach((function(e){g(o(e)).fragmentSpreads.forEach((function(e){b.add(e)}))}));var _={enter:function(e){if(t=e.name.value,!b.has(t)||o(t).removed)return null;var t}};return we(i.visit(m,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(t){if(t.variableDefinitions){var r=g(n(t.name&&t.name.value)).transitiveVars;if(r.size1)for(var n=new Te,i=1;i=0;--o){var s=i[o],a=!isNaN(+s)?[]:{};a[s]=t,t=a}r=n.merge(r,t)})),r}function Ke(e){return be(He(e))}function He(e){var t=be(e.errors)?e.errors.slice(0):[];return ze(e)&&be(e.incremental)&&e.incremental.forEach((function(e){e.errors&&t.push.apply(t,e.errors)})),t}function Je(){for(var e=[],t=0;t-1){var n=e.slice(0,r).trim().toLowerCase(),i=e.slice(r+1).trim();t[n]=i}})),t}function vt(e,t){if(e.status>=300){Xe(e,function(){try{return JSON.parse(t)}catch(e){return t}}(),"Response not successful: Received status code ".concat(e.status))}try{return JSON.parse(t)}catch(n){var r=n;throw r.name="ServerParseError",r.response=e,r.statusCode=e.status,r.bodyText=t,r}}function yt(e){return function(t){return t.text().then((function(e){return vt(t,e)})).then((function(r){return Array.isArray(r)||pt.call(r,"data")||pt.call(r,"errors")||Xe(t,r,"Server response was missing for query '".concat(Array.isArray(e)?e.map((function(e){return e.operationName})):e.operationName,"'.")),r}))}}var mt=function(e,t){var r;try{r=JSON.stringify(e)}catch(e){var n=w(39,t,e.message);throw n.parseError=e,n}return r},gt={http:{includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},bt=function(e,t){return t(e)};function _t(t,r){for(var n=[],i=2;i-1;){if(g=void 0,x=[c.slice(0,m),c.slice(m+u.length)],c=x[1],b=(g=x[0]).indexOf("\r\n\r\n"),_=dt(g.slice(0,b)),(O=_["content-type"])&&-1===O.toLowerCase().indexOf("application/json"))throw new Error("Unsupported patch content type: application/json is required.");if(w=g.slice(b))if(k=vt(t,w),Object.keys(k).length>1||"data"in k||"incremental"in k||"errors"in k||"payload"in k)Be(k)?(S={},"payload"in k&&(S=e.__assign({},k.payload)),"errors"in k&&(S=e.__assign(e.__assign({},S),{extensions:e.__assign(e.__assign({},"extensions"in S?S.extensions:null),(q={},q[lt]=k.errors,q))})),r(S)):r(k);else if(1===Object.keys(k).length&&"hasNext"in k&&!k.hasNext)return[2];m=c.indexOf(u)}return[3,1];case 3:return[2]}}))}))}(r,o):yt(t)(r).then(o)})).then((function(){S=void 0,n.complete()})).catch((function(e){S=void 0,function(e,t){e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e)}(e,n)})),function(){S&&S.abort()}}))}))},qt=function(t){function r(e){void 0===e&&(e={});var r=t.call(this,xt(e).request)||this;return r.options=e,r}return e.__extends(r,t),r}(tt),Et=function(){function t(){this.assumeImmutableResults=!1,this.getFragmentDoc=s.wrap(N,{max:K["cache.fragmentQueryDocuments"]||1e3,cache:n.WeakCache})}return t.prototype.batch=function(e){var t,r=this,n="string"==typeof e.optimistic?e.optimistic:!1===e.optimistic?null:void 0;return this.performTransaction((function(){return t=e.update(r)}),n),t},t.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{rootId:t.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(t,r){return void 0===r&&(r=!!t.optimistic),this.read(e.__assign(e.__assign({},t),{query:this.getFragmentDoc(t.fragment,t.fragmentName),rootId:t.id,optimistic:r}))},t.prototype.writeQuery=function(t){var r=t.id,n=t.data,i=e.__rest(t,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(t){var r=t.id,n=t.data,i=t.fragment,o=t.fragmentName,s=e.__rest(t,["id","data","fragment","fragmentName"]);return this.write(Object.assign(s,{query:this.getFragmentDoc(i,o),dataId:r,result:n}))},t.prototype.updateQuery=function(t,r){return this.batch({update:function(n){var i=n.readQuery(t),o=r(i);return null==o?i:(n.writeQuery(e.__assign(e.__assign({},t),{data:o})),o)}})},t.prototype.updateFragment=function(t,r){return this.batch({update:function(n){var i=n.readFragment(t),o=r(i);return null==o?i:(n.writeFragment(e.__assign(e.__assign({},t),{data:o})),o)}})},t}();exports.Cache=void 0,exports.Cache||(exports.Cache={});var Rt=function(t){function r(e,n,i,o){var s,a=t.call(this,e)||this;if(a.message=e,a.path=n,a.query=i,a.variables=o,Array.isArray(a.path)){a.missing=a.message;for(var u=a.path.length-1;u>=0;--u)a.missing=((s={})[a.path[u]]=a.missing,s)}else a.missing=a.path;return a.__proto__=r.prototype,a}return e.__extends(r,t),r}(Error),Pt=Object.prototype.hasOwnProperty;function Ct(e){return null==e}function Qt(e,t){var r=e.__typename,n=e.id,i=e._id;if("string"==typeof r&&(t&&(t.keyObject=Ct(n)?Ct(i)?void 0:{_id:i}:{id:n}),Ct(n)&&!Ct(i)&&(n=i),!Ct(n)))return"".concat(r,":").concat("number"==typeof n||"string"==typeof n?n:JSON.stringify(n))}var Tt={dataIdFromObject:Qt,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Dt(e){var t=e.canonizeResults;return void 0===t?Tt.canonizeResults:t}var Ft=/^[_a-z][_0-9a-z]*/i;function It(e){var t=e.match(Ft);return t?t[0]:e}function Mt(e,t,r){return!!j(t)&&(ge(t)?t.every((function(t){return Mt(e,t,r)})):e.selections.every((function(e){if(se(e)&&E(e,r)){var n=ie(e);return Pt.call(t,n)&&(!e.selectionSet||Mt(e.selectionSet,t[n],r))}return!0})))}function jt(e){return j(e)&&!$(e)&&!ge(e)}function Nt(e,t){var r=A(le(e));return{fragmentMap:r,lookupFragment:function(e){var n=r[e];return!n&&t&&(n=t.lookup(e)),n||null}}}var At=Object.create(null),Lt=function(){return At},Wt=Object.create(null),Vt=function(){function t(e,t){var r=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(e,t){return $(e)?r.get(e.__ref,t):e&&e[t]},this.canRead=function(e){return $(e)?r.has(e.__ref):"object"==typeof e},this.toReference=function(e,t){if("string"==typeof e)return X(e);if($(e))return e;var n=r.policies.identify(e)[0];if(n){var i=X(n);return t&&r.merge(n,e),i}}}return t.prototype.toObject=function(){return e.__assign({},this.data)},t.prototype.has=function(e){return void 0!==this.lookup(e,!0)},t.prototype.get=function(e,t){if(this.group.depend(e,t),Pt.call(this.data,e)){var r=this.data[e];if(r&&Pt.call(r,t))return r[t]}return"__typename"===t&&Pt.call(this.policies.rootTypenamesById,e)?this.policies.rootTypenamesById[e]:this instanceof Kt?this.parent.get(e,t):void 0},t.prototype.lookup=function(e,t){return t&&this.group.depend(e,"__exists"),Pt.call(this.data,e)?this.data[e]:this instanceof Kt?this.parent.lookup(e,t):this.policies.rootTypenamesById[e]?Object.create(null):void 0},t.prototype.merge=function(e,t){var r,n=this;$(e)&&(e=e.__ref),$(t)&&(t=t.__ref);var i="string"==typeof e?this.lookup(r=e):e,o="string"==typeof t?this.lookup(r=t):t;if(o){O("string"==typeof r,1);var s=new Te(Jt).merge(i,o);if(this.data[r]=s,s!==i&&(delete this.refs[r],this.group.caching)){var a=Object.create(null);i||(a.__exists=1),Object.keys(o).forEach((function(e){if(!i||i[e]!==s[e]){a[e]=1;var t=It(e);t===e||n.policies.hasKeyArgs(s.__typename,t)||(a[t]=1),void 0!==s[e]||n instanceof Kt||delete s[e]}})),!a.__typename||i&&i.__typename||this.policies.rootTypenamesById[r]!==s.__typename||delete a.__typename,Object.keys(a).forEach((function(e){return n.group.dirty(r,e)}))}}},t.prototype.modify=function(t,r){var n=this,i=this.lookup(t);if(i){var o=Object.create(null),s=!1,a=!0,u={DELETE:At,INVALIDATE:Wt,isReference:$,toReference:this.toReference,canRead:this.canRead,readField:function(e,r){return n.policies.readField("string"==typeof e?{fieldName:e,from:r||X(t)}:e,{store:n})}};if(Object.keys(i).forEach((function(c){var l=It(c),f=i[c];if(void 0!==f){var h="function"==typeof r?r:r[c]||r[l];if(h){var p=h===Lt?At:h(f,e.__assign(e.__assign({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(t,c)}));if(p===Wt)n.group.dirty(t,c);else if(p===At&&(p=void 0),p!==f)o[c]=p,s=!0,f=p}void 0!==f&&(a=!1)}})),s)return this.merge(t,o),a&&(this instanceof Kt?this.data[t]=void 0:delete this.data[t],this.group.dirty(t,"__exists")),!0}return!1},t.prototype.delete=function(e,t,r){var n,i=this.lookup(e);if(i){var o=this.getFieldValue(i,"__typename"),s=t&&r?this.policies.getStoreFieldName({typename:o,fieldName:t,args:r}):t;return this.modify(e,s?((n={})[s]=Lt,n):Lt)}return!1},t.prototype.evict=function(e,t){var r=!1;return e.id&&(Pt.call(this.data,e.id)&&(r=this.delete(e.id,e.fieldName,e.args)),this instanceof Kt&&this!==t&&(r=this.parent.evict(e,t)||r),(e.fieldName||r)&&this.group.dirty(e.id,e.fieldName||"__exists")),r},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,t=this.toObject(),r=[];return this.getRootIdSet().forEach((function(t){Pt.call(e.policies.rootTypenamesById,t)||r.push(t)})),r.length&&(t.__META={extraRootIds:r.sort()}),t},t.prototype.replace=function(t){var r=this;if(Object.keys(this.data).forEach((function(e){t&&Pt.call(t,e)||r.delete(e)})),t){var n=t.__META,i=e.__rest(t,["__META"]);Object.keys(i).forEach((function(e){r.merge(e,i[e])})),n&&n.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},t.prototype.getRootIdSet=function(e){return void 0===e&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Kt?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,t=this.getRootIdSet(),r=this.toObject();t.forEach((function(n){Pt.call(r,n)&&(Object.keys(e.findChildRefIds(n)).forEach(t.add,t),delete r[n])}));var n=Object.keys(r);if(n.length){for(var i=this;i instanceof Kt;)i=i.parent;n.forEach((function(e){return i.delete(e)}))}return n},t.prototype.findChildRefIds=function(e){if(!Pt.call(this.refs,e)){var t=this.refs[e]=Object.create(null),r=this.data[e];if(!r)return t;var n=new Set([r]);n.forEach((function(e){$(e)&&(t[e.__ref]=!0),j(e)&&Object.keys(e).forEach((function(t){var r=e[t];j(r)&&n.add(r)}))}))}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}(),zt=function(){function e(e,t){void 0===t&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return e.prototype.resetCaching=function(){this.d=this.caching?s.dep():null,this.keyMaker=new a.Trie(C)},e.prototype.depend=function(e,t){if(this.d){this.d(Bt(e,t));var r=It(t);r!==t&&this.d(Bt(e,r)),this.parent&&this.parent.depend(e,t)}},e.prototype.dirty=function(e,t){this.d&&this.d.dirty(Bt(e,t),"__exists"===t?"forget":"setDirty")},e}();function Bt(e,t){return t+"#"+e}function Ut(e,t){Gt(e)&&e.group.depend(t,"__exists")}!function(t){var r=function(t){function r(e){var r=e.policies,n=e.resultCaching,i=void 0===n||n,o=e.seed,s=t.call(this,r,new zt(i))||this;return s.stump=new Ht(s),s.storageTrie=new a.Trie(C),o&&s.replace(o),s}return e.__extends(r,t),r.prototype.addLayer=function(e,t){return this.stump.addLayer(e,t)},r.prototype.removeLayer=function(){return this},r.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},r}(t);t.Root=r}(Vt||(Vt={}));var Kt=function(t){function n(e,r,n,i){var o=t.call(this,r.policies,i)||this;return o.id=e,o.parent=r,o.replay=n,o.group=i,n(o),o}return e.__extends(n,t),n.prototype.addLayer=function(e,t){return new n(e,this,t,this.group)},n.prototype.removeLayer=function(e){var t=this,n=this.parent.removeLayer(e);return e===this.id?(this.group.caching&&Object.keys(this.data).forEach((function(e){var i=t.data[e],o=n.lookup(e);o?i?i!==o&&Object.keys(i).forEach((function(n){r.equal(i[n],o[n])||t.group.dirty(e,n)})):(t.group.dirty(e,"__exists"),Object.keys(o).forEach((function(r){t.group.dirty(e,r)}))):t.delete(e)})),n):n===this.parent?this:n.addLayer(this.id,this.replay)},n.prototype.toObject=function(){return e.__assign(e.__assign({},this.parent.toObject()),this.data)},n.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return Pt.call(this.data,r)?e.__assign(e.__assign({},n),t.prototype.findChildRefIds.call(this,r)):n},n.prototype.getStorage=function(){for(var e=this.parent;e.parent;)e=e.parent;return e.getStorage.apply(e,arguments)},n}(Vt),Ht=function(t){function r(e){return t.call(this,"EntityStore.Stump",e,(function(){}),new zt(e.group.caching,e.group))||this}return e.__extends(r,t),r.prototype.removeLayer=function(){return this},r.prototype.merge=function(e,t){return this.parent.merge(e,t)},r}(Kt);function Jt(e,t,n){var i=e[n],o=t[n];return r.equal(i,o)?i:o}function Gt(e){return!!(e instanceof Vt&&e.group.caching)}var Yt=function(){function t(){this.known=new(Q?WeakSet:Set),this.pool=new a.Trie(C),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return j(e)&&this.known.has(e)},t.prototype.pass=function(t){if(j(t)){var r=function(t){return j(t)?ge(t)?t.slice(0):e.__assign({__proto__:Object.getPrototypeOf(t)},t):t}(t);return this.passes.set(r,t),r}return t},t.prototype.admit=function(e){var t=this;if(j(e)){var r=this.passes.get(e);if(r)return r;switch(Object.getPrototypeOf(e)){case Array.prototype:if(this.known.has(e))return e;var n=e.map(this.admit,this);return(a=this.pool.lookupArray(n)).array||this.known.add(a.array=n),a.array;case null:case Object.prototype:if(this.known.has(e))return e;var i=Object.getPrototypeOf(e),o=[i],s=this.sortedKeys(e);o.push(s.json);var a,u=o.length;if(s.sorted.forEach((function(r){o.push(t.admit(e[r]))})),!(a=this.pool.lookupArray(o)).object){var c=a.object=Object.create(i);this.known.add(c),s.sorted.forEach((function(e,t){c[e]=o[u+t]}))}return a.object}}return e},t.prototype.sortedKeys=function(e){var t=Object.keys(e),r=this.pool.lookupArray(t);if(!r.keys){t.sort();var n=JSON.stringify(t);(r.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,r.keys={sorted:t,json:n})}return r.keys},t}();function Xt(e){return[e.selectionSet,e.objectOrReference,e.context,e.context.canonizeResults]}var $t=function(){function t(t){var r=this;this.knownResults=new(C?WeakMap:Map),this.config=Je(t,{addTypename:!1!==t.addTypename,canonizeResults:Dt(t)}),this.canon=t.canon||new Yt,this.executeSelectionSet=s.wrap((function(t){var n,i=t.context.canonizeResults,o=Xt(t);o[3]=!i;var s=(n=r.executeSelectionSet).peek.apply(n,o);return s?i?e.__assign(e.__assign({},s),{result:r.canon.admit(s.result)}):s:(Ut(t.context.store,t.enclosingRef.__ref),r.execSelectionSetImpl(t))}),{max:this.config.resultCacheMaxSize||K["inMemoryCache.executeSelectionSet"]||5e4,keyArgs:Xt,makeCacheKey:function(e,t,r,n){if(Gt(r.store))return r.store.makeCacheKey(e,$(t)?t.__ref:t,r.varString,n)}}),this.executeSubSelectedArray=s.wrap((function(e){return Ut(e.context.store,e.enclosingRef.__ref),r.execSubSelectedArrayImpl(e)}),{max:this.config.resultCacheMaxSize||K["inMemoryCache.executeSubSelectedArray"]||1e4,makeCacheKey:function(e){var t=e.field,r=e.array,n=e.context;if(Gt(n.store))return n.store.makeCacheKey(t,r,n.varString)}})}return t.prototype.resetCanon=function(){this.canon=new Yt},t.prototype.diffQueryAgainstStore=function(t){var r=t.store,n=t.query,i=t.rootId,o=void 0===i?"ROOT_QUERY":i,s=t.variables,a=t.returnPartialData,u=void 0===a||a,c=t.canonizeResults,l=void 0===c?this.config.canonizeResults:c,f=this.config.cache.policies;s=e.__assign(e.__assign({},pe(fe(n))),s);var h,p=X(o),d=this.executeSelectionSet({selectionSet:he(n).selectionSet,objectOrReference:p,enclosingRef:p,context:e.__assign({store:r,query:n,policies:f,variables:s,varString:J(s),canonizeResults:l},Nt(n,this.config.fragments))});if(d.missing&&(h=[new Rt(Zt(d.missing),d.missing,n,s)],!u))throw h[0];return{result:d.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,t,r,n){if(Gt(n.store)&&this.knownResults.get(e)===r){var i=this.executeSelectionSet.peek(r,t,n,this.canon.isKnown(e));if(i&&e===i.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var t=this,r=e.selectionSet,n=e.objectOrReference,o=e.enclosingRef,s=e.context;if($(n)&&!s.policies.rootTypenamesById[n.__ref]&&!s.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var a,u=s.variables,c=s.policies,l=s.store.getFieldValue(n,"__typename"),f=[],h=new Te;function p(e,t){var r;return e.missing&&(a=h.merge(a,((r={})[t]=e.missing,r))),e.result}this.config.addTypename&&"string"==typeof l&&!c.rootIdsByTypename[l]&&f.push({__typename:l});var d=new Set(r.selections);d.forEach((function(e){var r,v;if(E(e,u))if(se(e)){var y=c.readField({fieldName:e.name.value,field:e,variables:s.variables,from:n},s),m=ie(e);void 0===y?xe.added(e)||(a=h.merge(a,((r={})[m]="Can't find field '".concat(e.name.value,"' on ").concat($(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),r))):ge(y)?y=p(t.executeSubSelectedArray({field:e,array:y,enclosingRef:o,context:s}),m):e.selectionSet?null!=y&&(y=p(t.executeSelectionSet({selectionSet:e.selectionSet,objectOrReference:y,enclosingRef:$(y)?y:o,context:s}),m)):s.canonizeResults&&(y=t.canon.pass(y)),void 0!==y&&f.push(((v={})[m]=y,v))}else{var g=L(e,s.lookupFragment);if(!g&&e.kind===i.Kind.FRAGMENT_SPREAD)throw w(9,e.name.value);g&&c.fragmentMatches(g,l)&&g.selectionSet.selections.forEach(d.add,d)}}));var v={result:Ce(f),missing:a},y=s.canonizeResults?this.canon.admit(v):v;return y.result&&this.knownResults.set(y.result,r),y},t.prototype.execSubSelectedArrayImpl=function(e){var t,r=this,n=e.field,i=e.array,o=e.enclosingRef,s=e.context,a=new Te;function u(e,r){var n;return e.missing&&(t=a.merge(t,((n={})[r]=e.missing,n))),e.result}return n.selectionSet&&(i=i.filter(s.store.canRead)),i=i.map((function(e,t){return null===e?null:ge(e)?u(r.executeSubSelectedArray({field:n,array:e,enclosingRef:o,context:s}),t):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:e,enclosingRef:$(e)?e:o,context:s}),t):e})),{result:s.canonizeResults?this.canon.admit(i):i,missing:t}},t}();function Zt(e){try{JSON.stringify(e,(function(e,t){if("string"==typeof t)throw t;return t}))}catch(e){return e}}var er=new s.Slot,tr=new WeakMap;function rr(e){var t=tr.get(e);return t||tr.set(e,t={vars:new Set,dep:s.dep()}),t}function nr(e){rr(e).vars.forEach((function(t){return t.forgetCache(e)}))}function ir(e){var t=new Set,r=new Set,n=function(o){if(arguments.length>0){if(e!==o){e=o,t.forEach((function(e){rr(e).dep.dirty(n),function(e){e.broadcastWatches&&e.broadcastWatches()}(e)}));var s=Array.from(r);r.clear(),s.forEach((function(t){return t(e)}))}}else{var a=er.getValue();a&&(i(a),rr(a).dep(n))}return e};n.onNextChange=function(e){return r.add(e),function(){r.delete(e)}};var i=n.attachCache=function(e){return t.add(e),rr(e).vars.add(n),n};return n.forgetCache=function(e){return t.delete(e)},n}var or=Object.create(null);function sr(e){var t=JSON.stringify(e);return or[t]||(or[t]=Object.create(null))}function ar(e){var t=sr(e);return t.keyFieldsFn||(t.keyFieldsFn=function(t,r){var n=function(e,t){return r.readField(t,e)},i=r.keyObject=cr(e,(function(e){var i=hr(r.storeObject,e,n);return void 0===i&&t!==r.storeObject&&Pt.call(t,e[0])&&(i=hr(t,e,fr)),O(void 0!==i,4,e.join("."),t),i}));return"".concat(r.typename,":").concat(JSON.stringify(i))})}function ur(e){var t=sr(e);return t.keyArgsFn||(t.keyArgsFn=function(t,r){var n=r.field,i=r.variables,o=r.fieldName,s=cr(e,(function(e){var r=e[0],o=r.charAt(0);if("@"!==o)if("$"!==o){if(t)return hr(t,e)}else{var s=r.slice(1);if(i&&Pt.call(i,s)){var a=e.slice(0);return a[0]=s,hr(i,a)}}else if(n&&be(n.directives)){var u=r.slice(1),c=n.directives.find((function(e){return e.name.value===u})),l=c&&ne(c,i);return l&&hr(l,e.slice(1))}})),a=JSON.stringify(s);return(t||"{}"!==a)&&(o+=":"+a),o})}function cr(e,t){var r=new Te;return lr(e).reduce((function(e,n){var i,o=t(n);if(void 0!==o){for(var s=n.length-1;s>=0;--s)(i={})[n[s]]=o,o=i;e=r.merge(e,o)}return e}),Object.create(null))}function lr(e){var t=sr(e);if(!t.paths){var r=t.paths=[],n=[];e.forEach((function(t,i){ge(t)?(lr(t).forEach((function(e){return r.push(n.concat(e))})),n.length=0):(n.push(t),ge(e[i+1])||(r.push(n.slice(0)),n.length=0))}))}return t.paths}function fr(e,t){return e[t]}function hr(e,t,r){return r=r||fr,pr(t.reduce((function e(t,n){return ge(t)?t.map((function(t){return e(t,n)})):t&&r(t,n)}),e))}function pr(e){return j(e)?ge(e)?e.map(pr):cr(Object.keys(e).sort(),(function(t){return hr(e,t)})):e}function dr(e){return void 0!==e.args?e.args:e.field?ne(e.field,e.variables):null}var vr=function(){},yr=function(e,t){return t.fieldName},mr=function(e,t,r){return(0,r.mergeObjects)(e,t)},gr=function(e,t){return t},br=function(){function t(t){this.config=t,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=e.__assign({dataIdFromObject:Qt},t),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),t.possibleTypes&&this.addPossibleTypes(t.possibleTypes),t.typePolicies&&this.addTypePolicies(t.typePolicies)}return t.prototype.identify=function(t,r){var n,i=this,o=r&&(r.typename||(null===(n=r.storeObject)||void 0===n?void 0:n.__typename))||t.__typename;if(o===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var s,a=r&&r.storeObject||t,u=e.__assign(e.__assign({},r),{typename:o,storeObject:a,readField:r&&r.readField||function(){var e=Or(arguments,a);return i.readField(e,{store:i.cache.data,variables:e.variables})}}),c=o&&this.getTypePolicy(o),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var f=l(e.__assign(e.__assign({},t),a),u);if(!ge(f)){s=f;break}l=ar(f)}return s=s?String(s):void 0,u.keyObject?[s,u.keyObject]:[s]},t.prototype.addTypePolicies=function(t){var r=this;Object.keys(t).forEach((function(n){var i=t[n],o=i.queryType,s=i.mutationType,a=i.subscriptionType,u=e.__rest(i,["queryType","mutationType","subscriptionType"]);o&&r.setRootTypename("Query",n),s&&r.setRootTypename("Mutation",n),a&&r.setRootTypename("Subscription",n),Pt.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]}))},t.prototype.updateTypePolicy=function(e,t){var r=this,n=this.getTypePolicy(e),i=t.keyFields,o=t.fields;function s(e,t){e.merge="function"==typeof t?t:!0===t?mr:!1===t?gr:e.merge}s(n,t.merge),n.keyFn=!1===i?vr:ge(i)?ar(i):"function"==typeof i?i:n.keyFn,o&&Object.keys(o).forEach((function(t){var n=r.getFieldPolicy(e,t,!0),i=o[t];if("function"==typeof i)n.read=i;else{var a=i.keyArgs,u=i.read,c=i.merge;n.keyFn=!1===a?yr:ge(a)?ur(a):"function"==typeof a?a:n.keyFn,"function"==typeof u&&(n.read=u),s(n,c)}n.read&&n.merge&&(n.keyFn=n.keyFn||yr)}))},t.prototype.setRootTypename=function(e,t){void 0===t&&(t=e);var r="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[r];t!==n&&(O(!n||n===e,5,e),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=r,this.rootTypenamesById[r]=t)},t.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach((function(r){t.getSupertypeSet(r,!0),e[r].forEach((function(e){t.getSupertypeSet(e,!0).add(r);var n=e.match(Ft);n&&n[0]===e||t.fuzzySubtypes.set(e,new RegExp(e))}))}))},t.prototype.getTypePolicy=function(t){var r=this;if(!Pt.call(this.typePolicies,t)){var n=this.typePolicies[t]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(t);!i&&this.fuzzySubtypes.size&&(i=this.getSupertypeSet(t,!0),this.fuzzySubtypes.forEach((function(e,n){if(e.test(t)){var o=r.supertypeMap.get(n);o&&o.forEach((function(e){return i.add(e)}))}}))),i&&i.size&&i.forEach((function(t){var i=r.getTypePolicy(t),o=i.fields,s=e.__rest(i,["fields"]);Object.assign(n,s),Object.assign(n.fields,o)}))}var o=this.toBeAdded[t];return o&&o.length&&o.splice(0).forEach((function(e){r.updateTypePolicy(t,e)})),this.typePolicies[t]},t.prototype.getFieldPolicy=function(e,t,r){if(e){var n=this.getTypePolicy(e).fields;return n[t]||r&&(n[t]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,t){var r=this.supertypeMap.get(e);return!r&&t&&this.supertypeMap.set(e,r=new Set),r},t.prototype.fragmentMatches=function(e,t,r,n){var i=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),a=[s],u=function(e){var t=i.getSupertypeSet(e,!1);t&&t.size&&a.indexOf(t)<0&&a.push(t)},c=!(!r||!this.fuzzySubtypes.size),l=0;l1?s:r}:(i=e.__assign({},o),Pt.call(i,"from")||(i.from=r)),void 0===i.variables&&(i.variables=n),i}function wr(t){return function(r,n){if(ge(r)||ge(n))throw w(8);if(j(r)&&j(n)){var i=t.getFieldValue(r,"__typename"),o=t.getFieldValue(n,"__typename");if(i&&o&&i!==o)return n;if($(r)&&jt(n))return t.merge(r.__ref,n),r;if(jt(r)&&$(n))return t.merge(r,n.__ref),n;if(jt(r)&&jt(n))return e.__assign(e.__assign({},r),n)}return n}}function kr(t,r,n){var i="".concat(r).concat(n),o=t.flavors.get(i);return o||t.flavors.set(i,o=t.clientOnly===r&&t.deferred===n?t:e.__assign(e.__assign({},t),{clientOnly:r,deferred:n})),o}var Sr=function(){function t(e,t,r){this.cache=e,this.reader=t,this.fragments=r}return t.prototype.writeToStore=function(t,r){var n=this,i=r.query,o=r.result,s=r.dataId,a=r.variables,u=r.overwrite,c=ue(i),l=new Te;a=e.__assign(e.__assign({},pe(c)),a);var f=e.__assign(e.__assign({store:t,written:Object.create(null),merge:function(e,t){return l.merge(e,t)},variables:a,varString:J(a)},Nt(i,this.fragments)),{overwrite:!!u,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),h=this.processSelectionSet({result:o||Object.create(null),dataId:s,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:f});if(!$(h))throw w(11,o);return f.incomingById.forEach((function(e,r){var i=e.storeObject,o=e.mergeTree,s=(e.fieldNodeSet,X(r));if(o&&o.map.size){var a=n.applyMerges(o,s,i,f);if($(a))return;i=a}t.merge(r,i)})),t.retain(h.__ref),h},t.prototype.processSelectionSet=function(t){var r=this,n=t.dataId,i=t.result,o=t.selectionSet,s=t.context,a=t.mergeTree,u=this.cache.policies,c=Object.create(null),l=n&&u.rootTypenamesById[n]||oe(i,o,s.fragmentMap)||n&&s.store.get(n,"__typename");"string"==typeof l&&(c.__typename=l);var f=function(){var t=Or(arguments,c,s.variables);if($(t.from)){var r=s.incomingById.get(t.from.__ref);if(r){var n=u.readField(e.__assign(e.__assign({},t),{from:r.storeObject}),s);if(void 0!==n)return n}}return u.readField(t,s)},h=new Set;this.flattenFields(o,i,s,l).forEach((function(e,t){var n,o=ie(t),s=i[o];if(h.add(t),void 0!==s){var p=u.getStoreFieldName({typename:l,fieldName:t.name.value,field:t,variables:e.variables}),d=qr(a,p),v=r.processFieldValue(s,t,t.selectionSet?kr(e,!1,!1):e,d),y=void 0;t.selectionSet&&($(v)||jt(v))&&(y=f("__typename",v));var m=u.getMergeFunction(l,t.name.value,y);m?d.info={field:t,typename:l,merge:m}:Pr(a,p),c=e.merge(c,((n={})[p]=v,n))}else 0}));try{var p=u.identify(i,{typename:l,selectionSet:o,fragmentMap:s.fragmentMap,storeObject:c,readField:f}),d=p[0],v=p[1];n=n||d,v&&(c=s.merge(c,v))}catch(e){if(!n)throw e}if("string"==typeof n){var y=X(n),m=s.written[n]||(s.written[n]=[]);if(m.indexOf(o)>=0)return y;if(m.push(o),this.reader&&this.reader.isFresh(i,y,o,s))return y;var g=s.incomingById.get(n);return g?(g.storeObject=s.merge(g.storeObject,c),g.mergeTree=Er(g.mergeTree,a),h.forEach((function(e){return g.fieldNodeSet.add(e)}))):s.incomingById.set(n,{storeObject:c,mergeTree:Rr(a)?void 0:a,fieldNodeSet:h}),y}return c},t.prototype.processFieldValue=function(e,t,r,n){var i=this;return t.selectionSet&&null!==e?ge(e)?e.map((function(e,o){var s=i.processFieldValue(e,t,r,qr(n,o));return Pr(n,o),s})):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:r,mergeTree:n}):e},t.prototype.flattenFields=function(e,t,r,n){void 0===n&&(n=oe(t,e,r.fragmentMap));var o=new Map,s=this.cache.policies,u=new a.Trie(!1);return function e(a,c){var l=u.lookup(a,c.clientOnly,c.deferred);l.visited||(l.visited=!0,a.selections.forEach((function(a){if(E(a,r.variables)){var u=c.clientOnly,l=c.deferred;if(u&&l||!be(a.directives)||a.directives.forEach((function(e){var t=e.name.value;if("client"===t&&(u=!0),"defer"===t){var n=ne(e,r.variables);n&&!1===n.if||(l=!0)}})),se(a)){var f=o.get(a);f&&(u=u&&f.clientOnly,l=l&&f.deferred),o.set(a,kr(r,u,l))}else{var h=L(a,r.lookupFragment);if(!h&&a.kind===i.Kind.FRAGMENT_SPREAD)throw w(13,a.name.value);h&&s.fragmentMatches(h,n,t,r.variables)&&e(h.selectionSet,kr(r,u,l))}}})))}(e,r),o},t.prototype.applyMerges=function(t,r,n,i,o){var s,a=this;if(t.map.size&&!$(n)){var u,c=ge(n)||!$(r)&&!jt(r)?void 0:r,l=n;c&&!o&&(o=[$(c)?c.__ref:c]);var f=function(e,t){return ge(e)?"number"==typeof t?e[t]:void 0:i.store.getFieldValue(e,String(t))};t.map.forEach((function(e,t){var r=f(c,t),n=f(l,t);if(void 0!==n){o&&o.push(t);var s=a.applyMerges(e,r,n,i,o);s!==n&&(u=u||new Map).set(t,s),o&&O(o.pop()===t)}})),u&&(n=ge(l)?l.slice(0):e.__assign({},l),u.forEach((function(e,t){n[t]=e})))}return t.info?this.cache.policies.runMergeFunction(r,n,t.info,i,o&&(s=i.store).getStorage.apply(s,o)):n},t}(),xr=[];function qr(e,t){var r=e.map;return r.has(t)||r.set(t,xr.pop()||{map:new Map}),r.get(t)}function Er(t,r){if(t===r||!r||Rr(r))return t;if(!t||Rr(t))return r;var n=t.info&&r.info?e.__assign(e.__assign({},t.info),r.info):t.info||r.info,i=t.map.size&&r.map.size,o={info:n,map:i?new Map:t.map.size?t.map:r.map};if(i){var s=new Set(r.map.keys());t.map.forEach((function(e,t){o.map.set(t,Er(e,r.map.get(t))),s.delete(t)})),s.forEach((function(e){o.map.set(e,Er(r.map.get(e),t.map.get(e)))}))}return o}function Rr(e){return!e||!(e.info||e.map.size)}function Pr(e,t){var r=e.map,n=r.get(t);n&&Rr(n)&&(xr.push(n),r.delete(t))}new Set;var Cr,Qr=function(t){function n(e){void 0===e&&(e={});var r=t.call(this)||this;return r.watches=new Set,r.addTypenameTransform=new ye(xe),r.assumeImmutableResults=!0,r.makeVar=ir,r.txCount=0,r.config=function(e){return Je(Tt,e)}(e),r.addTypename=!!r.config.addTypename,r.policies=new br({cache:r,dataIdFromObject:r.config.dataIdFromObject,possibleTypes:r.config.possibleTypes,typePolicies:r.config.typePolicies}),r.init(),r}return e.__extends(n,t),n.prototype.init=function(){var e=this.data=new Vt.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=e.stump,this.resetResultCache()},n.prototype.resetResultCache=function(e){var t=this,r=this.storeReader,n=this.config.fragments;this.storeWriter=new Sr(this,this.storeReader=new $t({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Dt(this.config),canon:e?void 0:r&&r.canon,fragments:n}),n),this.maybeBroadcastWatch=s.wrap((function(e,r){return t.broadcastWatch(e,r)}),{max:this.config.resultCacheMaxSize||K["inMemoryCache.maybeBroadcastWatch"]||5e3,makeCacheKey:function(e){var r=e.optimistic?t.optimisticData:t.data;if(Gt(r)){var n=e.optimistic,i=e.id,o=e.variables;return r.makeCacheKey(e.query,e.callback,J({optimistic:n,id:i,variables:o}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach((function(e){return e.resetCaching()}))},n.prototype.restore=function(e){return this.init(),e&&this.data.replace(e),this},n.prototype.extract=function(e){return void 0===e&&(e=!1),(e?this.optimisticData:this.data).extract()},n.prototype.read=function(t){var r=t.returnPartialData,n=void 0!==r&&r;try{return this.storeReader.diffQueryAgainstStore(e.__assign(e.__assign({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:n})).result||null}catch(e){if(e instanceof Rt)return null;throw e}},n.prototype.write=function(e){try{return++this.txCount,this.storeWriter.writeToStore(this.data,e)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},n.prototype.modify=function(e){if(Pt.call(e,"id")&&!e.id)return!1;var t=e.optimistic?this.optimisticData:this.data;try{return++this.txCount,t.modify(e.id||"ROOT_QUERY",e.fields)}finally{--this.txCount||!1===e.broadcast||this.broadcastWatches()}},n.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(e.__assign(e.__assign({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},n.prototype.watch=function(e){var t=this;return this.watches.size||function(e){rr(e).vars.forEach((function(t){return t.attachCache(e)}))}(this),this.watches.add(e),e.immediate&&this.maybeBroadcastWatch(e),function(){t.watches.delete(e)&&!t.watches.size&&nr(t),t.maybeBroadcastWatch.forget(e)}},n.prototype.gc=function(e){var t;J.reset(),me.reset(),this.addTypenameTransform.resetCache(),null===(t=this.config.fragments)||void 0===t||t.resetCaches();var r=this.optimisticData.gc();return e&&!this.txCount&&(e.resetResultCache?this.resetResultCache(e.resetResultIdentities):e.resetResultIdentities&&this.storeReader.resetCanon()),r},n.prototype.retain=function(e,t){return(t?this.optimisticData:this.data).retain(e)},n.prototype.release=function(e,t){return(t?this.optimisticData:this.data).release(e)},n.prototype.identify=function(e){if($(e))return e.__ref;try{return this.policies.identify(e)[0]}catch(e){}},n.prototype.evict=function(t){if(!t.id){if(Pt.call(t,"id"))return!1;t=e.__assign(e.__assign({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{--this.txCount||!1===t.broadcast||this.broadcastWatches()}},n.prototype.reset=function(e){var t=this;return this.init(),J.reset(),e&&e.discardWatches?(this.watches.forEach((function(e){return t.maybeBroadcastWatch.forget(e)})),this.watches.clear(),nr(this)):this.broadcastWatches(),Promise.resolve()},n.prototype.removeOptimistic=function(e){var t=this.optimisticData.removeLayer(e);t!==this.optimisticData&&(this.optimisticData=t,this.broadcastWatches())},n.prototype.batch=function(t){var r,n=this,i=t.update,o=t.optimistic,s=void 0===o||o,a=t.removeOptimistic,u=t.onWatchUpdated,c=function(e){var t=n,o=t.data,s=t.optimisticData;++n.txCount,e&&(n.data=n.optimisticData=e);try{return r=i(n)}finally{--n.txCount,n.data=o,n.optimisticData=s}},l=new Set;return u&&!this.txCount&&this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e){return l.add(e),!1}})),"string"==typeof s?this.optimisticData=this.optimisticData.addLayer(s,c):!1===s?c(this.data):c(),"string"==typeof a&&(this.optimisticData=this.optimisticData.removeLayer(a)),u&&l.size?(this.broadcastWatches(e.__assign(e.__assign({},t),{onWatchUpdated:function(e,t){var r=u.call(this,e,t);return!1!==r&&l.delete(e),r}})),l.size&&l.forEach((function(e){return n.maybeBroadcastWatch.dirty(e)}))):this.broadcastWatches(t),r},n.prototype.performTransaction=function(e,t){return this.batch({update:e,optimistic:t||null!==t})},n.prototype.transformDocument=function(e){return this.addTypenameToDocument(this.addFragmentsToDocument(e))},n.prototype.broadcastWatches=function(e){var t=this;this.txCount||this.watches.forEach((function(r){return t.maybeBroadcastWatch(r,e)}))},n.prototype.addFragmentsToDocument=function(e){var t=this.config.fragments;return t?t.transform(e):e},n.prototype.addTypenameToDocument=function(e){return this.addTypename?this.addTypenameTransform.transformDocument(e):e},n.prototype.broadcastWatch=function(e,t){var n=e.lastDiff,i=this.diff(e);t&&(e.optimistic&&"string"==typeof t.optimistic&&(i.fromOptimisticTransaction=!0),t.onWatchUpdated&&!1===t.onWatchUpdated.call(this,e,i,n))||n&&r.equal(n.result,i.result)||e.callback(e.lastDiff=i,n)},n}(Et);function Tr(e){return!!e&&e<7}function Dr(t,r,n,i){var o=r.data,s=e.__rest(r,["data"]),a=n.data,u=e.__rest(n,["data"]);return h(s,u)&&Fr(he(t).selectionSet,o,a,{fragmentMap:A(le(t)),variables:i})}function Fr(e,t,r,n){if(t===r)return!0;var i=new Set;return e.selections.every((function(e){if(i.has(e))return!0;if(i.add(e),!E(e,n.variables))return!0;if(Ir(e))return!0;if(se(e)){var o=ie(e),s=t&&t[o],a=r&&r[o],u=e.selectionSet;if(!u)return h(s,a);var c=Array.isArray(s),l=Array.isArray(a);if(c!==l)return!1;if(c&&l){var f=s.length;if(a.length!==f)return!1;for(var p=0;p0},n.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},n.prototype.transformDocument=function(e){return this.queryManager.transform(e)},n}(o.Observable));function Ar(e){var t=e.options,r=t.fetchPolicy,n=t.nextFetchPolicy;return"cache-and-network"===r||"network-only"===r?e.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(e,t){return this.nextFetchPolicy=n,"function"==typeof this.nextFetchPolicy?this.nextFetchPolicy(e,t):r}}):e.reobserve()}function Lr(e){}function Wr(e){return"network-only"===e||"no-cache"===e||"standby"===e}Le(Nr);var Vr=function(){function t(e){var t=e.cache,r=e.client,n=e.resolvers,i=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,r&&(this.client=r),n&&this.addResolvers(n),i&&this.setFragmentMatcher(i)}return t.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=Pe(t.resolvers,e)})):this.resolvers=Pe(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(t){var r=t.document,n=t.remoteResult,i=t.context,o=t.variables,s=t.onlyRunForcedResolvers,a=void 0!==s&&s;return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return r?[2,this.resolveDocument(r,n.data,i,o,this.fragmentMatcher,a).then((function(t){return e.__assign(e.__assign({},n),{data:t.result})}))]:[2,n]}))}))},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return R(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return Ee(e)},t.prototype.prepareContext=function(t){var r=this.cache;return e.__assign(e.__assign({},t),{cache:r,getCacheKey:function(e){return r.identify(e)}})},t.prototype.addExportedVariables=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(i){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,r)||{},this.prepareContext(n),r).then((function(t){return e.__assign(e.__assign({},r),t.exportedVariables)}))]:[2,e.__assign({},r)]}))}))},t.prototype.shouldForceResolvers=function(e){var t=!1;return i.visit(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return i.BREAK}}}),t},t.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:qe(e),variables:t,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(t,r,n,i,o,s){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===s&&(s=!1),e.__awaiter(this,void 0,void 0,(function(){var a,u,c,l,f,h,p,d,v,y;return e.__generator(this,(function(m){return a=he(t),u=le(t),c=A(u),l=this.collectSelectionsToResolve(a,c),f=a.operation,h=f?f.charAt(0).toUpperCase()+f.slice(1):"Query",d=(p=this).cache,v=p.client,y={fragmentMap:c,context:e.__assign(e.__assign({},n),{cache:d,client:v}),variables:i,fragmentMatcher:o,defaultOperationType:h,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:s},!1,[2,this.resolveSelectionSet(a.selectionSet,false,r,y).then((function(e){return{result:e,exportedVariables:y.exportedVariables}}))]}))}))},t.prototype.resolveSelectionSet=function(t,r,n,i){return e.__awaiter(this,void 0,void 0,(function(){var o,s,a,u,c,l=this;return e.__generator(this,(function(f){return o=i.fragmentMap,s=i.context,a=i.variables,u=[n],c=function(t){return e.__awaiter(l,void 0,void 0,(function(){var c,l;return e.__generator(this,(function(e){return(r||i.selectionsToResolve.has(t))&&E(t,a)?se(t)?[2,this.resolveField(t,r,n,i).then((function(e){var r;void 0!==e&&u.push(((r={})[ie(t)]=e,r))}))]:(!function(e){return"InlineFragment"===e.kind}(t)?(c=o[t.name.value],O(c,18,t.name.value)):c=t,c&&c.typeCondition&&(l=c.typeCondition.name.value,i.fragmentMatcher(n,l,s))?[2,this.resolveSelectionSet(c.selectionSet,r,n,i).then((function(e){u.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(t.selections.map(c)).then((function(){return Ce(u)}))]}))}))},t.prototype.resolveField=function(t,r,n,i){return e.__awaiter(this,void 0,void 0,(function(){var o,s,a,u,c,l,f,h,p,d=this;return e.__generator(this,(function(e){return n?(o=i.variables,s=t.name.value,a=ie(t),u=s!==a,c=n[a]||n[s],l=Promise.resolve(c),i.onlyRunForcedResolvers&&!this.shouldForceResolvers(t)||(f=n.__typename||i.defaultOperationType,(h=this.resolvers&&this.resolvers[f])&&(p=h[u?s:a])&&(l=Promise.resolve(er.withValue(this.cache,p,[n,ne(t,o),i.context,{field:t,fragmentMap:i.fragmentMap}])))),[2,l.then((function(e){var n,o;if(void 0===e&&(e=c),t.directives&&t.directives.forEach((function(t){"export"===t.name.value&&t.arguments&&t.arguments.forEach((function(t){"as"===t.name.value&&"StringValue"===t.value.kind&&(i.exportedVariables[t.value.value]=e)}))})),!t.selectionSet)return e;if(null==e)return e;var s=null!==(o=null===(n=t.directives)||void 0===n?void 0:n.some((function(e){return"client"===e.name.value})))&&void 0!==o&&o;return Array.isArray(e)?d.resolveSubSelectedArray(t,r||s,e,i):t.selectionSet?d.resolveSelectionSet(t.selectionSet,r||s,e,i):void 0}))]):[2,null]}))}))},t.prototype.resolveSubSelectedArray=function(e,t,r,n){var i=this;return Promise.all(r.map((function(r){return null===r?null:Array.isArray(r)?i.resolveSubSelectedArray(e,t,r,n):e.selectionSet?i.resolveSelectionSet(e.selectionSet,t,r,n):void 0})))},t.prototype.collectSelectionsToResolve=function(e,t){var r=function(e){return!Array.isArray(e)},n=this.selectionsToResolveCache;return function e(o){if(!n.has(o)){var s=new Set;n.set(o,s),i.visit(o,{Directive:function(e,t,n,o,a){"client"===e.name.value&&a.forEach((function(e){r(e)&&i.isSelectionNode(e)&&s.add(e)}))},FragmentSpread:function(n,o,a,u,c){var l=t[n.name.value];O(l,19,n.name.value);var f=e(l);f.size>0&&(c.forEach((function(e){r(e)&&i.isSelectionNode(e)&&s.add(e)})),s.add(n),f.forEach((function(e){s.add(e)})))}})}return n.get(o)}(e)},t}(),zr=new(C?WeakMap:Map);function Br(e,t){var r=e[t];"function"==typeof r&&(e[t]=function(){return zr.set(e,(zr.get(e)+1)%1e15),r.apply(this,arguments)})}function Ur(e){e.notifyTimeout&&(clearTimeout(e.notifyTimeout),e.notifyTimeout=void 0)}var Kr=function(){function t(e,t){void 0===t&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var r=this.cache=e.cache;zr.has(r)||(zr.set(r,0),Br(r,"evict"),Br(r,"modify"),Br(r,"reset"))}return t.prototype.init=function(e){var t=e.networkStatus||exports.NetworkStatus.loading;return this.variables&&this.networkStatus!==exports.NetworkStatus.loading&&!r.equal(this.variables,e.variables)&&(t=exports.NetworkStatus.setVariables),r.equal(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){Ur(this),this.dirty=!1},t.prototype.resetDiff=function(){this.lastDiff=void 0},t.prototype.getDiff=function(){var e=this.getDiffOptions();if(this.lastDiff&&r.equal(e,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables);var t=this.observableQuery;if(t&&"no-cache"===t.options.fetchPolicy)return{complete:!1};var n=this.cache.diff(e);return this.updateLastDiff(n,e),n},t.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var t;return void 0===e&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:null===(t=this.observableQuery)||void 0===t?void 0:t.options.canonizeResults}},t.prototype.setDiff=function(e){var t,n=this,i=this.lastDiff&&this.lastDiff.diff;(!e||e.complete||(null===(t=this.observableQuery)||void 0===t?void 0:t.options.returnPartialData)||i&&i.complete)&&(this.updateLastDiff(e),this.dirty||r.equal(i&&i.result,e&&e.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return n.notify()}),0))))},t.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){t.getDiff().fromOptimisticTransaction?e.observe():Ar(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Ur(this),this.shouldNotify()&&this.listeners.forEach((function(t){return t(e)})),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Tr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if("cache-only"!==e&&"cache-and-network"!==e)return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel;var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(t){var n=this;void 0===t&&(t=this.variables);var i=this.observableQuery;if(!i||"no-cache"!==i.options.fetchPolicy){var o=e.__assign(e.__assign({},this.getDiffOptions(t)),{watcher:this,callback:function(e){return n.setDiff(e)}});this.lastWatch&&r.equal(o,this.lastWatch)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=o))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===zr.get(this.cache)&&r.equal(t,n.variables)&&r.equal(e.data,n.result.data))},t.prototype.markResult=function(e,t,n,i){var o=this,s=new Te,a=be(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&be(e.incremental)){var u=Ue(this.getDiff().result,e);e.data=u}else if("hasNext"in e&&e.hasNext){var c=this.getDiff();e.data=s.merge(c.result,e.data)}this.graphQLErrors=a,"no-cache"===n.fetchPolicy?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):0!==i&&(Hr(e,n.errorPolicy)?this.cache.performTransaction((function(s){if(o.shouldWrite(e,n.variables))s.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:1===i}),o.lastWrite={result:e,variables:n.variables,dmCount:zr.get(o.cache)};else if(o.lastDiff&&o.lastDiff.diff.complete)return void(e.data=o.lastDiff.diff.result);var a=o.getDiffOptions(n.variables),u=s.diff(a);!o.stopped&&r.equal(o.variables,n.variables)&&o.updateWatch(n.variables),o.updateLastDiff(u,a),u.complete&&(e.data=u.result)})):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=exports.NetworkStatus.ready},t.prototype.markError=function(e){return this.networkStatus=exports.NetworkStatus.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function Hr(e,t){void 0===t&&(t="none");var r="ignore"===t||"all"===t,n=!Ke(e);return!n&&r&&e.data&&(n=!0),n}var Jr=Object.prototype.hasOwnProperty,Gr=Object.create(null),Yr=function(){function t(e){var t=e.cache,r=e.link,n=e.defaultOptions,i=e.documentTransform,o=e.queryDeduplication,s=void 0!==o&&o,u=e.onBroadcast,c=e.ssrMode,l=void 0!==c&&c,f=e.clientAwareness,h=void 0===f?{}:f,p=e.localState,d=e.assumeImmutableResults,v=void 0===d?!!t.assumeImmutableResults:d,y=e.defaultContext,m=this;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new z(K["queryManager.getDocumentInfo"]||2e3),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new a.Trie(!1);var g=new ye((function(e){return m.cache.transformDocument(e)}),{cache:!1});this.cache=t,this.link=r,this.defaultOptions=n||Object.create(null),this.queryDeduplication=s,this.clientAwareness=h,this.localState=p||new Vr({cache:t}),this.ssrMode=l,this.assumeImmutableResults=v,this.documentTransform=i?g.concat(i).concat(g):g,this.defaultContext=y||Object.create(null),(this.onBroadcast=u)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches(w(25))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},t.prototype.mutate=function(t){var r,n,i=t.mutation,o=t.variables,s=t.optimisticResponse,a=t.updateQueries,u=t.refetchQueries,c=void 0===u?[]:u,l=t.awaitRefetchQueries,f=void 0!==l&&l,h=t.update,p=t.onQueryUpdated,d=t.fetchPolicy,v=void 0===d?(null===(r=this.defaultOptions.mutate)||void 0===r?void 0:r.fetchPolicy)||"network-only":d,y=t.errorPolicy,m=void 0===y?(null===(n=this.defaultOptions.mutate)||void 0===n?void 0:n.errorPolicy)||"none":y,g=t.keepRootFields,b=t.context;return e.__awaiter(this,void 0,void 0,(function(){var t,r,n,u,l;return e.__generator(this,(function(d){switch(d.label){case 0:return O(i,26),O("network-only"===v||"no-cache"===v,27),t=this.generateMutationId(),i=this.cache.transformForLink(this.transform(i)),r=this.getDocumentInfo(i).hasClientExports,o=this.getVariables(i,o),r?[4,this.localState.addExportedVariables(i,o,b)]:[3,2];case 1:o=d.sent(),d.label=2;case 2:return n=this.mutationStore&&(this.mutationStore[t]={mutation:i,variables:o,loading:!0,error:null}),u=s&&this.markMutationOptimistic(s,{mutationId:t,document:i,variables:o,fetchPolicy:v,errorPolicy:m,context:b,updateQueries:a,update:h,keepRootFields:g}),this.broadcastQueries(),l=this,[2,new Promise((function(r,d){return Ae(l.getObservableFromLink(i,e.__assign(e.__assign({},b),{optimisticResponse:u?s:void 0}),o,!1),(function(r){if(Ke(r)&&"none"===m)throw new ht({graphQLErrors:He(r)});n&&(n.loading=!1,n.error=null);var s=e.__assign({},r);return"function"==typeof c&&(c=c(s)),"ignore"===m&&Ke(s)&&delete s.errors,l.markMutationResult({mutationId:t,result:s,document:i,variables:o,fetchPolicy:v,errorPolicy:m,context:b,update:h,updateQueries:a,awaitRefetchQueries:f,refetchQueries:c,removeOptimistic:u?t:void 0,onQueryUpdated:p,keepRootFields:g})})).subscribe({next:function(e){l.broadcastQueries(),"hasNext"in e&&!1!==e.hasNext||r(e)},error:function(e){n&&(n.loading=!1,n.error=e),u&&l.cache.removeOptimistic(t),l.broadcastQueries(),d(e instanceof ht?e:new ht({networkError:e}))}})}))]}}))}))},t.prototype.markMutationResult=function(t,r){var n=this;void 0===r&&(r=this.cache);var i=t.result,o=[],s="no-cache"===t.fetchPolicy;if(!s&&Hr(i,t.errorPolicy)){if(ze(i)||o.push({result:i.data,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables}),ze(i)&&be(i.incremental)){var a=r.diff({id:"ROOT_MUTATION",query:this.getDocumentInfo(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0}),u=void 0;a.result&&(u=Ue(a.result,i)),void 0!==u&&(i.data=u,o.push({result:u,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables}))}var c=t.updateQueries;c&&this.queries.forEach((function(e,t){var s=e.observableQuery,a=s&&s.queryName;if(a&&Jr.call(c,a)){var u=c[a],l=n.queries.get(t),f=l.document,h=l.variables,p=r.diff({query:f,variables:h,returnPartialData:!0,optimistic:!1}),d=p.result;if(p.complete&&d){var v=u(d,{mutationResult:i,queryName:f&&ce(f)||void 0,queryVariables:h});v&&o.push({result:v,dataId:"ROOT_QUERY",query:f,variables:h})}}}))}if(o.length>0||(t.refetchQueries||"").length>0||t.update||t.onQueryUpdated||t.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(r){s||o.forEach((function(e){return r.write(e)}));var a,u=t.update,c=!(ze(a=i)||function(e){return"hasNext"in e&&"data"in e}(a))||ze(i)&&!i.hasNext;if(u){if(!s){var l=r.diff({id:"ROOT_MUTATION",query:n.getDocumentInfo(t.document).asQuery,variables:t.variables,optimistic:!1,returnPartialData:!0});l.complete&&("incremental"in(i=e.__assign(e.__assign({},i),{data:l.result}))&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}c&&u(r,i,{context:t.context,variables:t.variables})}s||t.keepRootFields||!c||r.modify({id:"ROOT_MUTATION",fields:function(e,t){var r=t.fieldName,n=t.DELETE;return"__typename"===r?e:n}})},include:t.refetchQueries,optimistic:!1,removeOptimistic:t.removeOptimistic,onQueryUpdated:t.onQueryUpdated||null}).forEach((function(e){return l.push(e)})),t.awaitRefetchQueries||t.onQueryUpdated)return Promise.all(l).then((function(){return i}))}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(t,r){var n=this,i="function"==typeof t?t(r.variables,{IGNORE:Gr}):t;return i!==Gr&&(this.cache.recordOptimisticTransaction((function(t){try{n.markMutationResult(e.__assign(e.__assign({},r),{result:{data:i}}),t)}catch(e){}}),r.mutationId),!0)},t.prototype.fetchQuery=function(e,t,r){return this.fetchConcastWithInfo(e,t,r).concast.promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},t.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},t.prototype.transform=function(e){return this.documentTransform.transformDocument(e)},t.prototype.getDocumentInfo=function(t){var r=this.transformCache;if(!r.has(t)){var n={hasClientExports:P(t),hasForcedResolvers:this.localState.shouldForceResolvers(t),hasNonreactiveDirective:R(["nonreactive"],t),clientQuery:this.localState.clientQuery(t),serverQuery:Se([{name:"client",remove:!0},{name:"connection"},{name:"nonreactive"}],t),defaultVars:pe(ue(t)),asQuery:e.__assign(e.__assign({},t),{definitions:t.definitions.map((function(t){return"OperationDefinition"===t.kind&&"query"!==t.operation?e.__assign(e.__assign({},t),{operation:"query"}):t}))})};r.set(t,n)}return r.get(t)},t.prototype.getVariables=function(t,r){return e.__assign(e.__assign({},this.getDocumentInfo(t).defaultVars),r)},t.prototype.watchQuery=function(t){var r=this.transform(t.query);void 0===(t=e.__assign(e.__assign({},t),{variables:this.getVariables(r,t.variables)})).notifyOnNetworkStatusChange&&(t.notifyOnNetworkStatusChange=!1);var n=new Kr(this),i=new Nr({queryManager:this,queryInfo:n,options:t});return i.lastQuery=r,this.queries.set(i.queryId,n),n.init({document:r,observableQuery:i,variables:i.variables}),i},t.prototype.query=function(t,r){var n=this;return void 0===r&&(r=this.generateQueryId()),O(t.query,28),O("Document"===t.query.kind,29),O(!t.returnPartialData,30),O(!t.pollInterval,31),this.fetchQuery(r,e.__assign(e.__assign({},t),{query:this.transform(t.query)})).finally((function(){return n.stopQuery(r)}))},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},t.prototype.clearStore=function(e){return void 0===e&&(e={discardWatches:!0}),this.cancelPendingFetches(w(32)),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=exports.NetworkStatus.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(t){var r=this;void 0===t&&(t="active");var n=new Map,i=new Map,o=new Set;return Array.isArray(t)&&t.forEach((function(e){var t;"string"==typeof e?i.set(e,!1):j(t=e)&&"Document"===t.kind&&Array.isArray(t.definitions)?i.set(r.transform(e),!1):j(e)&&e.query&&o.add(e)})),this.queries.forEach((function(e,r){var o=e.observableQuery,s=e.document;if(o){if("all"===t)return void n.set(r,o);var a=o.queryName;if("standby"===o.options.fetchPolicy||"active"===t&&!o.hasObservers())return;("active"===t||a&&i.has(a)||s&&i.has(s))&&(n.set(r,o),a&&i.set(a,!0),s&&i.set(s,!0))}})),o.size&&o.forEach((function(t){var i=g("legacyOneTimeQuery"),o=r.getQuery(i).init({document:t.query,variables:t.variables}),s=new Nr({queryManager:r,queryInfo:o,options:e.__assign(e.__assign({},t),{fetchPolicy:"network-only"})});O(s.queryId===i),o.setObservableQuery(s),n.set(i,s)})),n},t.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.getObservableQueries(e?"all":"active").forEach((function(n,i){var o=n.options.fetchPolicy;n.resetLastResults(),(e||"standby"!==o&&"cache-only"!==o)&&r.push(n.refetch()),t.getQuery(i).setDiff(null)})),this.broadcastQueries(),Promise.all(r)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,n=e.fetchPolicy,i=e.errorPolicy,s=void 0===i?"none":i,a=e.variables,u=e.context,c=void 0===u?{}:u;r=this.transform(r),a=this.getVariables(r,a);var l=function(e){return t.getObservableFromLink(r,c,e).map((function(i){"no-cache"!==n&&(Hr(i,s)&&t.cache.write({query:r,result:i.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries());var o=Ke(i),a=function(e){return!!e.extensions&&Array.isArray(e.extensions[lt])}(i);if(o||a){var u={};if(o&&(u.graphQLErrors=i.errors),a&&(u.protocolErrors=i.extensions[lt]),"none"===s||a)throw new ht(u)}return"ignore"===s&&delete i.errors,i}))};if(this.getDocumentInfo(r).hasClientExports){var f=this.localState.addExportedVariables(r,a,c).then(l);return new o.Observable((function(e){var t=null;return f.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return l(a)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(t,r,n,i){var s,a,u=this;void 0===i&&(i=null!==(s=null==r?void 0:r.queryDeduplication)&&void 0!==s?s:this.queryDeduplication);var c=this.getDocumentInfo(t),l=c.serverQuery,f=c.clientQuery;if(l){var h=this.inFlightLinkObservables,p=this.link,d={query:l,variables:n,operationName:ce(l)||void 0,context:this.prepareContext(e.__assign(e.__assign({},r),{forceFetch:!i}))};if(r=d.context,i){var v=me(l),y=J(n),m=h.lookup(v,y);if(!(a=m.observable)){var g=new Ve([st(p,d)]);a=m.observable=g,g.beforeNext((function(){h.remove(v,y)}))}}else a=new Ve([st(p,d)])}else a=new Ve([o.Observable.of({data:{}})]),r=this.prepareContext(r);return f&&(a=Ae(a,(function(e){return u.localState.runResolvers({document:f,remoteResult:e,context:r,variables:n})}))),a},t.prototype.getResultsFromLink=function(e,t,r){var n=e.lastRequestId=this.generateRequestId(),i=this.cache.transformForLink(r.query);return Ae(this.getObservableFromLink(i,r.context,r.variables),(function(o){var s=He(o),a=s.length>0;if(n>=e.lastRequestId){if(a&&"none"===r.errorPolicy)throw e.markError(new ht({graphQLErrors:s}));e.markResult(o,i,r,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:exports.NetworkStatus.ready};return a&&"ignore"!==r.errorPolicy&&(u.errors=s,u.networkStatus=exports.NetworkStatus.error),u}),(function(t){var r=ft(t)?t:new ht({networkError:t});throw n>=e.lastRequestId&&e.markError(r),r}))},t.prototype.fetchConcastWithInfo=function(e,t,r,n){var i=this;void 0===r&&(r=exports.NetworkStatus.loading),void 0===n&&(n=t.query);var o,s,a=this.getVariables(n,t.variables),u=this.getQuery(e),c=this.defaultOptions.watchQuery,l=t.fetchPolicy,f=void 0===l?c&&c.fetchPolicy||"cache-first":l,h=t.errorPolicy,p=void 0===h?c&&c.errorPolicy||"none":h,d=t.returnPartialData,v=void 0!==d&&d,y=t.notifyOnNetworkStatusChange,m=void 0!==y&&y,g=t.context,b=void 0===g?{}:g,_=Object.assign({},t,{query:n,variables:a,fetchPolicy:f,errorPolicy:p,returnPartialData:v,notifyOnNetworkStatusChange:m,context:b}),O=function(e){_.variables=e;var n=i.fetchQueryByPolicy(u,_,r);return"standby"!==_.fetchPolicy&&n.sources.length>0&&u.observableQuery&&u.observableQuery.applyNextFetchPolicy("after-fetch",t),n},w=function(){return i.fetchCancelFns.delete(e)};if(this.fetchCancelFns.set(e,(function(e){w(),setTimeout((function(){return o.cancel(e)}))})),this.getDocumentInfo(_.query).hasClientExports)o=new Ve(this.localState.addExportedVariables(_.query,_.variables,_.context).then(O).then((function(e){return e.sources}))),s=!0;else{var k=O(_.variables);s=k.fromLink,o=new Ve(k.sources)}return o.promise.then(w,w),{concast:o,fromLink:s}},t.prototype.refetchQueries=function(e){var t=this,r=e.updateCache,n=e.include,i=e.optimistic,o=void 0!==i&&i,s=e.removeOptimistic,a=void 0===s?o?g("refetchQueries"):void 0:s,u=e.onQueryUpdated,c=new Map;n&&this.getObservableQueries(n).forEach((function(e,r){c.set(r,{oq:e,lastDiff:t.getQuery(r).getDiff()})}));var l=new Map;return r&&this.cache.batch({update:r,optimistic:o&&a||!1,removeOptimistic:a,onWatchUpdated:function(e,t,r){var n=e.watcher instanceof Kr&&e.watcher.observableQuery;if(n){if(u){c.delete(n.queryId);var i=u(n,t,r);return!0===i&&(i=n.refetch()),!1!==i&&l.set(n,i),i}null!==u&&c.set(n.queryId,{oq:n,lastDiff:r,diff:t})}}}),c.size&&c.forEach((function(e,r){var n,i=e.oq,o=e.lastDiff,s=e.diff;if(u){if(!s){var a=i.queryInfo;a.reset(),s=a.getDiff()}n=u(i,s,o)}u&&!0!==n||(n=i.refetch()),!1!==n&&l.set(i,n),r.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(r)})),a&&this.cache.removeOptimistic(a),l},t.prototype.fetchQueryByPolicy=function(t,r,n){var i=this,s=r.query,a=r.variables,u=r.fetchPolicy,c=r.refetchWritePolicy,l=r.errorPolicy,f=r.returnPartialData,h=r.context,p=r.notifyOnNetworkStatusChange,d=t.networkStatus;t.init({document:s,variables:a,networkStatus:n});var v=function(){return t.getDiff()},y=function(r,n){void 0===n&&(n=t.networkStatus||exports.NetworkStatus.loading);var u=r.result;var c=function(t){return o.Observable.of(e.__assign({data:t,loading:Tr(n),networkStatus:n},r.complete?null:{partial:!0}))};return u&&i.getDocumentInfo(s).hasForcedResolvers?i.localState.runResolvers({document:s,remoteResult:{data:u},context:h,variables:a,onlyRunForcedResolvers:!0}).then((function(e){return c(e.data||void 0)})):"none"===l&&n===exports.NetworkStatus.refetch&&Array.isArray(r.missing)?c(void 0):c(u)},m="no-cache"===u?0:n===exports.NetworkStatus.refetch&&"merge"!==c?1:2,g=function(){return i.getResultsFromLink(t,m,{query:s,variables:a,context:h,fetchPolicy:u,errorPolicy:l})},b=p&&"number"==typeof d&&d!==n&&Tr(n);switch(u){default:case"cache-first":return(_=v()).complete?{fromLink:!1,sources:[y(_,t.markReady())]}:f||b?{fromLink:!0,sources:[y(_),g()]}:{fromLink:!0,sources:[g()]};case"cache-and-network":var _;return(_=v()).complete||f||b?{fromLink:!0,sources:[y(_),g()]}:{fromLink:!0,sources:[g()]};case"cache-only":return{fromLink:!1,sources:[y(v(),t.markReady())]};case"network-only":return b?{fromLink:!0,sources:[y(v()),g()]}:{fromLink:!0,sources:[g()]};case"no-cache":return b?{fromLink:!0,sources:[y(t.getDiff()),g()]}:{fromLink:!0,sources:[g()]};case"standby":return{fromLink:!1,sources:[]}}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Kr(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(t){void 0===t&&(t={});var r=this.localState.prepareContext(t);return e.__assign(e.__assign(e.__assign({},this.defaultContext),r),{clientAwareness:this.clientAwareness})},t}(),Xr=function(){function t(e){var t=this;if(this.resetStoreCallbacks=[],this.clearStoreCallbacks=[],!e.cache)throw w(15);var r=e.uri,n=e.credentials,i=e.headers,o=e.cache,s=e.documentTransform,a=e.ssrMode,u=void 0!==a&&a,c=e.ssrForceFetchDelay,l=void 0===c?0:c,f=e.connectToDevTools,h=void 0===f?"object"==typeof window&&!window.__APOLLO_CLIENT__&&!1:f,p=e.queryDeduplication,v=void 0===p||p,y=e.defaultOptions,m=e.defaultContext,g=e.assumeImmutableResults,b=void 0===g?o.assumeImmutableResults:g,_=e.resolvers,O=e.typeDefs,k=e.fragmentMatcher,S=e.name,x=e.version,q=e.link;q||(q=r?new qt({uri:r,credentials:n,headers:i}):tt.empty()),this.link=q,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=v,this.defaultOptions=y||Object.create(null),this.typeDefs=O,l&&setTimeout((function(){return t.disableNetworkFetches=!1}),l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),this.version=d,this.localState=new Vr({cache:o,client:this,resolvers:_,fragmentMatcher:k}),this.queryManager=new Yr({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,defaultContext:m,documentTransform:s,queryDeduplication:v,ssrMode:u,clientAwareness:{name:S,version:x},localState:this.localState,assumeImmutableResults:b,onBroadcast:h?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0}),h&&this.connectToDevTools()}return t.prototype.connectToDevTools=function(){if("object"==typeof window){var e=window,t=Symbol.for("apollo.devtools");(e[t]=e[t]||[]).push(this),e.__APOLLO_CLIENT__=this}},Object.defineProperty(t.prototype,"documentTransform",{get:function(){return this.queryManager.documentTransform},enumerable:!1,configurable:!0}),t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(t){return this.defaultOptions.watchQuery&&(t=Ge(this.defaultOptions.watchQuery,t)),!this.disableNetworkFetches||"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(t=e.__assign(e.__assign({},t),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(t)},t.prototype.query=function(t){return this.defaultOptions.query&&(t=Ge(this.defaultOptions.query,t)),O("cache-and-network"!==t.fetchPolicy,16),this.disableNetworkFetches&&"network-only"===t.fetchPolicy&&(t=e.__assign(e.__assign({},t),{fetchPolicy:"cache-first"})),this.queryManager.query(t)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ge(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},t.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},t.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},t.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return!1!==e.broadcast&&this.queryManager.broadcastQueries(),t},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return st(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!1})})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore({discardWatches:!0})})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},t.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),r=[],n=[];t.forEach((function(e,t){r.push(t),n.push(e)}));var i=Promise.all(n);return i.queries=r,i.results=n,i.catch((function(e){})),i},t.prototype.getObservableQueries=function(e){return void 0===e&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},Object.defineProperty(t.prototype,"defaultContext",{get:function(){return this.queryManager.defaultContext},enumerable:!1,configurable:!0}),t}();var $r=T?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function Zr(){O("createContext"in p,45);var e=p.createContext[$r];return e||(Object.defineProperty(p.createContext,$r,{value:e=p.createContext({}),enumerable:!1,writable:!1,configurable:!0}),e.displayName="ApolloContext"),e}var en=Zr;function tn(e){var t=p.useContext(Zr()),r=e||t.client;return O(!!r,49),r}var rn,nn,on=p.useSyncExternalStore||function(e,t,r){var n=t();var i=p.useState({inst:{value:n,getSnapshot:t}}),o=i[0].inst,s=i[1];return M?p.useLayoutEffect((function(){Object.assign(o,{value:n,getSnapshot:t}),sn(o)&&s({inst:o})}),[e,n,t]):Object.assign(o,{value:n,getSnapshot:t}),p.useEffect((function(){return sn(o)&&s({inst:o}),e((function(){sn(o)&&s({inst:o})}))}),[e]),n};function sn(e){var t=e.value,r=e.getSnapshot;try{return t!==r()}catch(e){return!0}}function an(e){var t;switch(e){case exports.DocumentType.Query:t="Query";break;case exports.DocumentType.Mutation:t="Mutation";break;case exports.DocumentType.Subscription:t="Subscription"}return t}function un(e){nn||(nn=new z(K.parser||1e3));var t,r,n=nn.get(e);if(n)return n;O(!!e&&!!e.kind,59,e);for(var i=[],o=[],s=[],a=[],u=0,c=e.definitions;u0?new ht({graphQLErrors:s}):void 0,p=t.onError||(null===(n=u.current.options)||void 0===n?void 0:n.onError);if(h&&p&&p(h,f),l===u.current.mutationId&&!f.ignoreResults){var d={called:!0,loading:!1,data:o,error:h,client:c};u.current.isMounted&&!r.equal(u.current.result,d)&&a(u.current.result=d)}var v=t.onCompleted||(null===(i=u.current.options)||void 0===i?void 0:i.onCompleted);return h||null==v||v(e.data,f),e})).catch((function(e){var n;if(l===u.current.mutationId&&u.current.isMounted){var i={loading:!1,error:e,data:void 0,called:!0,client:c};r.equal(u.current.result,i)||a(u.current.result=i)}var o=t.onError||(null===(n=u.current.options)||void 0===n?void 0:n.onError);if(o)return o(e,f),{data:void 0,errors:e};throw e}))}),[]),l=p.useCallback((function(){if(u.current.isMounted){var e={called:!1,loading:!1,client:i};Object.assign(u.current,{mutationId:0,result:e}),a(e)}}),[]);return p.useEffect((function(){return u.current.isMounted=!0,function(){u.current.isMounted=!1}}),[]),[c,e.__assign({reset:l},s)]},exports.useQuery=function(e,t){return void 0===t&&(t=Object.create(null)),fn(tn(t.client),e).useQuery(t)},exports.useQueryRefHandlers=function(e){var t=p.useState(e),r=t[0],n=t[1],i=p.useState(e),o=i[0],s=i[1],a=Sn(e);return r!==e?(n(e),s(e)):xn(e,kn(o)),{refetch:p.useCallback((function(e){var t=a.refetch(e);return s(wn(a)),t}),[a]),fetchMore:p.useCallback((function(e){var t=a.fetchMore(e);return s(wn(a)),t}),[a])}},exports.useReactiveVar=function(e){return on(p.useCallback((function(t){return e.onNextChange((function r(){t(),e.onNextChange(r)}))}),[e]),e,e)},exports.useReadQuery=function(e){var t=p.useMemo((function(){return Sn(e)}),[e]),r=p.useCallback((function(){return kn(e)}),[e]);t.disposed&&(t.reinitialize(),xn(e,t.promise)),p.useEffect((function(){return t.retain()}),[t]);var n=on(p.useCallback((function(r){return t.listen((function(t){xn(e,t),r()}))}),[t]),r,r),i=gn(n);return p.useMemo((function(){return{data:i.data,networkStatus:i.networkStatus,error:Tn(i)}}),[i])},exports.useSubscription=function(e,t){var n=p.useRef(!1),i=tn(null==t?void 0:t.client);cn(e,exports.DocumentType.Subscription);var o=p.useState({loading:!(null==t?void 0:t.skip),error:void 0,data:void 0,variables:null==t?void 0:t.variables}),s=o[0],a=o[1];n.current||(n.current=!0,null==t||t.onSubscriptionData,null==t||t.onSubscriptionComplete);var u=p.useState((function(){return(null==t?void 0:t.skip)?null:i.subscribe({query:e,variables:null==t?void 0:t.variables,fetchPolicy:null==t?void 0:t.fetchPolicy,context:null==t?void 0:t.context})})),c=u[0],l=u[1],f=p.useRef(!1);p.useEffect((function(){return function(){f.current=!0}}),[]);var h=p.useRef({client:i,subscription:e,options:t});return p.useEffect((function(){var n,o,s,u,c=null==t?void 0:t.shouldResubscribe;"function"==typeof c&&(c=!!c(t)),(null==t?void 0:t.skip)?(!(null==t?void 0:t.skip)!=!(null===(n=h.current.options)||void 0===n?void 0:n.skip)||f.current)&&(a({loading:!1,data:void 0,error:void 0,variables:null==t?void 0:t.variables}),l(null),f.current=!1):(!1===c||i===h.current.client&&e===h.current.subscription&&(null==t?void 0:t.fetchPolicy)===(null===(o=h.current.options)||void 0===o?void 0:o.fetchPolicy)&&!(null==t?void 0:t.skip)==!(null===(s=h.current.options)||void 0===s?void 0:s.skip)&&r.equal(null==t?void 0:t.variables,null===(u=h.current.options)||void 0===u?void 0:u.variables))&&!f.current||(a({loading:!0,data:void 0,error:void 0,variables:null==t?void 0:t.variables}),l(i.subscribe({query:e,variables:null==t?void 0:t.variables,fetchPolicy:null==t?void 0:t.fetchPolicy,context:null==t?void 0:t.context})),f.current=!1),Object.assign(h.current,{client:i,subscription:e,options:t})}),[i,e,t,f.current]),p.useEffect((function(){if(c){var e=!1,r=c.subscribe({next:function(r){var n,o;if(!e){var s={loading:!1,data:r.data,error:void 0,variables:null==t?void 0:t.variables};a(s),(null===(n=h.current.options)||void 0===n?void 0:n.onData)?h.current.options.onData({client:i,data:s}):(null===(o=h.current.options)||void 0===o?void 0:o.onSubscriptionData)&&h.current.options.onSubscriptionData({client:i,subscriptionData:s})}},error:function(r){var n,i;e||(a({loading:!1,data:void 0,error:r,variables:null==t?void 0:t.variables}),null===(i=null===(n=h.current.options)||void 0===n?void 0:n.onError)||void 0===i||i.call(n,r))},complete:function(){var t,r;e||((null===(t=h.current.options)||void 0===t?void 0:t.onComplete)?h.current.options.onComplete():(null===(r=h.current.options)||void 0===r?void 0:r.onSubscriptionComplete)&&h.current.options.onSubscriptionComplete())}});return function(){e=!0,setTimeout((function(){r.unsubscribe()}))}}}),[c]),s},exports.useSuspenseQuery=function(t,r){void 0===r&&(r=Object.create(null));var n=tn(r.client),i=Cn(n),o=Dn({client:n,query:t,options:r}),s=o.fetchPolicy,a=o.variables,u=r.queryKey,c=void 0===u?[]:u,l=e.__spreadArray([t,J(a)],[].concat(c),!0),f=i.getQueryRef(l,(function(){return n.watchQuery(o)})),h=p.useState([f.key,f.promise]),d=h[0],v=h[1];d[0]!==f.key&&(d[0]=f.key,d[1]=f.promise);var y=d[1];f.didChangeOptions(o)&&(d[1]=y=f.applyOptions(o)),p.useEffect((function(){var e=f.retain(),t=f.listen((function(e){v([f.key,e])}));return function(){t(),e()}}),[f]);var m=p.useMemo((function(){var e=Tn(f.result);return{loading:!1,data:f.result.data,networkStatus:e?exports.NetworkStatus.error:exports.NetworkStatus.ready,error:e}}),[f.result]),g="standby"===s?m:gn(y),b=p.useCallback((function(e){var t=f.fetchMore(e);return v([f.key,f.promise]),t}),[f]),_=p.useCallback((function(e){var t=f.refetch(e);return v([f.key,f.promise]),t}),[f]),O=p.useCallback((function(e){return f.observable.subscribeToMore(e)}),[f]);return p.useMemo((function(){return{client:n,data:g.data,error:Tn(g),networkStatus:g.networkStatus,fetchMore:b,refetch:_,subscribeToMore:O}}),[n,b,_,g,O])}; diff --git a/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs b/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs new file mode 100644 index 0000000..5917180 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs @@ -0,0 +1,2567 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../utilities/globals'); +var tslib = require('tslib'); +var optimism = require('optimism'); +var utilities = require('../utilities'); +var caches = require('@wry/caches'); +var equality = require('@wry/equality'); +var trie = require('@wry/trie'); +var graphql = require('graphql'); + +var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getInMemoryCacheMemoryInternals + : undefined; +var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloCacheMemoryInternals + : undefined; +function _getApolloCacheMemoryInternals() { + return { + cache: { + fragmentQueryDocuments: getWrapperInformation(this["getFragmentDoc"]), + }, + }; +} +function _getInMemoryCacheMemoryInternals() { + var fragments = this.config.fragments; + return tslib.__assign(tslib.__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this["addTypenameTransform"]), inMemoryCache: { + executeSelectionSet: getWrapperInformation(this["storeReader"]["executeSelectionSet"]), + executeSubSelectedArray: getWrapperInformation(this["storeReader"]["executeSubSelectedArray"]), + maybeBroadcastWatch: getWrapperInformation(this["maybeBroadcastWatch"]), + }, fragmentRegistry: { + findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads), + lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup), + transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform), + } }); +} +function isWrapper(f) { + return !!f && "dirtyKey" in f; +} +function getWrapperInformation(f) { + return isWrapper(f) ? f.size : undefined; +} +function isDefined(value) { + return value != null; +} +function transformInfo(transform) { + return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); }); +} +function recurseTransformInfo(transform) { + return transform ? + tslib.__spreadArray(tslib.__spreadArray([ + getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"]) + ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined) + : []; +} + +var ApolloCache = (function () { + function ApolloCache() { + this.assumeImmutableResults = false; + this.getFragmentDoc = optimism.wrap(utilities.getFragmentQueryDocument, { + max: utilities.cacheSizes["cache.fragmentQueryDocuments"] || + 1000 , + cache: caches.WeakCache, + }); + } + ApolloCache.prototype.batch = function (options) { + var _this = this; + var optimisticId = typeof options.optimistic === "string" ? options.optimistic + : options.optimistic === false ? null + : void 0; + var updateResult; + this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId); + return updateResult; + }; + ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) { + this.performTransaction(transaction, optimisticId); + }; + ApolloCache.prototype.transformDocument = function (document) { + return document; + }; + ApolloCache.prototype.transformForLink = function (document) { + return document; + }; + ApolloCache.prototype.identify = function (object) { + return; + }; + ApolloCache.prototype.gc = function () { + return []; + }; + ApolloCache.prototype.modify = function (options) { + return false; + }; + ApolloCache.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic: optimistic })); + }; + ApolloCache.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic })); + }; + ApolloCache.prototype.writeQuery = function (_a) { + var id = _a.id, data = _a.data, options = tslib.__rest(_a, ["id", "data"]); + return this.write(Object.assign(options, { + dataId: id || "ROOT_QUERY", + result: data, + })); + }; + ApolloCache.prototype.writeFragment = function (_a) { + var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = tslib.__rest(_a, ["id", "data", "fragment", "fragmentName"]); + return this.write(Object.assign(options, { + query: this.getFragmentDoc(fragment, fragmentName), + dataId: id, + result: data, + })); + }; + ApolloCache.prototype.updateQuery = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readQuery(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeQuery(tslib.__assign(tslib.__assign({}, options), { data: data })); + return data; + }, + }); + }; + ApolloCache.prototype.updateFragment = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readFragment(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeFragment(tslib.__assign(tslib.__assign({}, options), { data: data })); + return data; + }, + }); + }; + return ApolloCache; +}()); +if (globalThis.__DEV__ !== false) { + ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals; +} + +exports.Cache = void 0; +(function (Cache) { +})(exports.Cache || (exports.Cache = {})); + +var MissingFieldError = (function (_super) { + tslib.__extends(MissingFieldError, _super); + function MissingFieldError(message, path, query, variables) { + var _a; + var _this = _super.call(this, message) || this; + _this.message = message; + _this.path = path; + _this.query = query; + _this.variables = variables; + if (Array.isArray(_this.path)) { + _this.missing = _this.message; + for (var i = _this.path.length - 1; i >= 0; --i) { + _this.missing = (_a = {}, _a[_this.path[i]] = _this.missing, _a); + } + } + else { + _this.missing = _this.path; + } + _this.__proto__ = MissingFieldError.prototype; + return _this; + } + return MissingFieldError; +}(Error)); + +var hasOwn = Object.prototype.hasOwnProperty; +function isNullish(value) { + return value === null || value === void 0; +} +function defaultDataIdFromObject(_a, context) { + var __typename = _a.__typename, id = _a.id, _id = _a._id; + if (typeof __typename === "string") { + if (context) { + context.keyObject = + !isNullish(id) ? { id: id } + : !isNullish(_id) ? { _id: _id } + : void 0; + } + if (isNullish(id) && !isNullish(_id)) { + id = _id; + } + if (!isNullish(id)) { + return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ? + id + : JSON.stringify(id)); + } + } +} +var defaultConfig = { + dataIdFromObject: defaultDataIdFromObject, + addTypename: true, + resultCaching: true, + canonizeResults: false, +}; +function normalizeConfig(config) { + return utilities.compact(defaultConfig, config); +} +function shouldCanonizeResults(config) { + var value = config.canonizeResults; + return value === void 0 ? defaultConfig.canonizeResults : value; +} +function getTypenameFromStoreObject(store, objectOrReference) { + return utilities.isReference(objectOrReference) ? + store.get(objectOrReference.__ref, "__typename") + : objectOrReference && objectOrReference.__typename; +} +var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i; +function fieldNameFromStoreName(storeFieldName) { + var match = storeFieldName.match(TypeOrFieldNameRegExp); + return match ? match[0] : storeFieldName; +} +function selectionSetMatchesResult(selectionSet, result, variables) { + if (utilities.isNonNullObject(result)) { + return utilities.isArray(result) ? + result.every(function (item) { + return selectionSetMatchesResult(selectionSet, item, variables); + }) + : selectionSet.selections.every(function (field) { + if (utilities.isField(field) && utilities.shouldInclude(field, variables)) { + var key = utilities.resultKeyNameFromField(field); + return (hasOwn.call(result, key) && + (!field.selectionSet || + selectionSetMatchesResult(field.selectionSet, result[key], variables))); + } + return true; + }); + } + return false; +} +function storeValueIsStoreObject(value) { + return utilities.isNonNullObject(value) && !utilities.isReference(value) && !utilities.isArray(value); +} +function makeProcessedFieldsMerger() { + return new utilities.DeepMerger(); +} +function extractFragmentContext(document, fragments) { + var fragmentMap = utilities.createFragmentMap(utilities.getFragmentDefinitions(document)); + return { + fragmentMap: fragmentMap, + lookupFragment: function (name) { + var def = fragmentMap[name]; + if (!def && fragments) { + def = fragments.lookup(name); + } + return def || null; + }, + }; +} + +var DELETE = Object.create(null); +var delModifier = function () { return DELETE; }; +var INVALIDATE = Object.create(null); +exports.EntityStore = (function () { + function EntityStore(policies, group) { + var _this = this; + this.policies = policies; + this.group = group; + this.data = Object.create(null); + this.rootIds = Object.create(null); + this.refs = Object.create(null); + this.getFieldValue = function (objectOrReference, storeFieldName) { + return utilities.maybeDeepFreeze(utilities.isReference(objectOrReference) ? + _this.get(objectOrReference.__ref, storeFieldName) + : objectOrReference && objectOrReference[storeFieldName]); + }; + this.canRead = function (objOrRef) { + return utilities.isReference(objOrRef) ? + _this.has(objOrRef.__ref) + : typeof objOrRef === "object"; + }; + this.toReference = function (objOrIdOrRef, mergeIntoStore) { + if (typeof objOrIdOrRef === "string") { + return utilities.makeReference(objOrIdOrRef); + } + if (utilities.isReference(objOrIdOrRef)) { + return objOrIdOrRef; + } + var id = _this.policies.identify(objOrIdOrRef)[0]; + if (id) { + var ref = utilities.makeReference(id); + if (mergeIntoStore) { + _this.merge(id, objOrIdOrRef); + } + return ref; + } + }; + } + EntityStore.prototype.toObject = function () { + return tslib.__assign({}, this.data); + }; + EntityStore.prototype.has = function (dataId) { + return this.lookup(dataId, true) !== void 0; + }; + EntityStore.prototype.get = function (dataId, fieldName) { + this.group.depend(dataId, fieldName); + if (hasOwn.call(this.data, dataId)) { + var storeObject = this.data[dataId]; + if (storeObject && hasOwn.call(storeObject, fieldName)) { + return storeObject[fieldName]; + } + } + if (fieldName === "__typename" && + hasOwn.call(this.policies.rootTypenamesById, dataId)) { + return this.policies.rootTypenamesById[dataId]; + } + if (this instanceof Layer) { + return this.parent.get(dataId, fieldName); + } + }; + EntityStore.prototype.lookup = function (dataId, dependOnExistence) { + if (dependOnExistence) + this.group.depend(dataId, "__exists"); + if (hasOwn.call(this.data, dataId)) { + return this.data[dataId]; + } + if (this instanceof Layer) { + return this.parent.lookup(dataId, dependOnExistence); + } + if (this.policies.rootTypenamesById[dataId]) { + return Object.create(null); + } + }; + EntityStore.prototype.merge = function (older, newer) { + var _this = this; + var dataId; + if (utilities.isReference(older)) + older = older.__ref; + if (utilities.isReference(newer)) + newer = newer.__ref; + var existing = typeof older === "string" ? this.lookup((dataId = older)) : older; + var incoming = typeof newer === "string" ? this.lookup((dataId = newer)) : newer; + if (!incoming) + return; + globals.invariant(typeof dataId === "string", 1); + var merged = new utilities.DeepMerger(storeObjectReconciler).merge(existing, incoming); + this.data[dataId] = merged; + if (merged !== existing) { + delete this.refs[dataId]; + if (this.group.caching) { + var fieldsToDirty_1 = Object.create(null); + if (!existing) + fieldsToDirty_1.__exists = 1; + Object.keys(incoming).forEach(function (storeFieldName) { + if (!existing || + existing[storeFieldName] !== merged[storeFieldName]) { + fieldsToDirty_1[storeFieldName] = 1; + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName && + !_this.policies.hasKeyArgs(merged.__typename, fieldName)) { + fieldsToDirty_1[fieldName] = 1; + } + if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) { + delete merged[storeFieldName]; + } + } + }); + if (fieldsToDirty_1.__typename && + !(existing && existing.__typename) && + this.policies.rootTypenamesById[dataId] === merged.__typename) { + delete fieldsToDirty_1.__typename; + } + Object.keys(fieldsToDirty_1).forEach(function (fieldName) { + return _this.group.dirty(dataId, fieldName); + }); + } + } + }; + EntityStore.prototype.modify = function (dataId, fields) { + var _this = this; + var storeObject = this.lookup(dataId); + if (storeObject) { + var changedFields_1 = Object.create(null); + var needToMerge_1 = false; + var allDeleted_1 = true; + var sharedDetails_1 = { + DELETE: DELETE, + INVALIDATE: INVALIDATE, + isReference: utilities.isReference, + toReference: this.toReference, + canRead: this.canRead, + readField: function (fieldNameOrOptions, from) { + return _this.policies.readField(typeof fieldNameOrOptions === "string" ? + { + fieldName: fieldNameOrOptions, + from: from || utilities.makeReference(dataId), + } + : fieldNameOrOptions, { store: _this }); + }, + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + var fieldName = fieldNameFromStoreName(storeFieldName); + var fieldValue = storeObject[storeFieldName]; + if (fieldValue === void 0) + return; + var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]); + if (modify) { + var newValue = modify === delModifier ? DELETE : (modify(utilities.maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }))); + if (newValue === INVALIDATE) { + _this.group.dirty(dataId, storeFieldName); + } + else { + if (newValue === DELETE) + newValue = void 0; + if (newValue !== fieldValue) { + changedFields_1[storeFieldName] = newValue; + needToMerge_1 = true; + fieldValue = newValue; + if (globalThis.__DEV__ !== false) { + var checkReference = function (ref) { + if (_this.lookup(ref.__ref) === undefined) { + globalThis.__DEV__ !== false && globals.invariant.warn(2, ref); + return true; + } + }; + if (utilities.isReference(newValue)) { + checkReference(newValue); + } + else if (Array.isArray(newValue)) { + var seenReference = false; + var someNonReference = void 0; + for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) { + var value = newValue_1[_i]; + if (utilities.isReference(value)) { + seenReference = true; + if (checkReference(value)) + break; + } + else { + if (typeof value === "object" && !!value) { + var id = _this.policies.identify(value)[0]; + if (id) { + someNonReference = value; + } + } + } + if (seenReference && someNonReference !== undefined) { + globalThis.__DEV__ !== false && globals.invariant.warn(3, someNonReference); + break; + } + } + } + } + } + } + } + if (fieldValue !== void 0) { + allDeleted_1 = false; + } + }); + if (needToMerge_1) { + this.merge(dataId, changedFields_1); + if (allDeleted_1) { + if (this instanceof Layer) { + this.data[dataId] = void 0; + } + else { + delete this.data[dataId]; + } + this.group.dirty(dataId, "__exists"); + } + return true; + } + } + return false; + }; + EntityStore.prototype.delete = function (dataId, fieldName, args) { + var _a; + var storeObject = this.lookup(dataId); + if (storeObject) { + var typename = this.getFieldValue(storeObject, "__typename"); + var storeFieldName = fieldName && args ? + this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args }) + : fieldName; + return this.modify(dataId, storeFieldName ? (_a = {}, + _a[storeFieldName] = delModifier, + _a) : delModifier); + } + return false; + }; + EntityStore.prototype.evict = function (options, limit) { + var evicted = false; + if (options.id) { + if (hasOwn.call(this.data, options.id)) { + evicted = this.delete(options.id, options.fieldName, options.args); + } + if (this instanceof Layer && this !== limit) { + evicted = this.parent.evict(options, limit) || evicted; + } + if (options.fieldName || evicted) { + this.group.dirty(options.id, options.fieldName || "__exists"); + } + } + return evicted; + }; + EntityStore.prototype.clear = function () { + this.replace(null); + }; + EntityStore.prototype.extract = function () { + var _this = this; + var obj = this.toObject(); + var extraRootIds = []; + this.getRootIdSet().forEach(function (id) { + if (!hasOwn.call(_this.policies.rootTypenamesById, id)) { + extraRootIds.push(id); + } + }); + if (extraRootIds.length) { + obj.__META = { extraRootIds: extraRootIds.sort() }; + } + return obj; + }; + EntityStore.prototype.replace = function (newData) { + var _this = this; + Object.keys(this.data).forEach(function (dataId) { + if (!(newData && hasOwn.call(newData, dataId))) { + _this.delete(dataId); + } + }); + if (newData) { + var __META = newData.__META, rest_1 = tslib.__rest(newData, ["__META"]); + Object.keys(rest_1).forEach(function (dataId) { + _this.merge(dataId, rest_1[dataId]); + }); + if (__META) { + __META.extraRootIds.forEach(this.retain, this); + } + } + }; + EntityStore.prototype.retain = function (rootId) { + return (this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1); + }; + EntityStore.prototype.release = function (rootId) { + if (this.rootIds[rootId] > 0) { + var count = --this.rootIds[rootId]; + if (!count) + delete this.rootIds[rootId]; + return count; + } + return 0; + }; + EntityStore.prototype.getRootIdSet = function (ids) { + if (ids === void 0) { ids = new Set(); } + Object.keys(this.rootIds).forEach(ids.add, ids); + if (this instanceof Layer) { + this.parent.getRootIdSet(ids); + } + else { + Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids); + } + return ids; + }; + EntityStore.prototype.gc = function () { + var _this = this; + var ids = this.getRootIdSet(); + var snapshot = this.toObject(); + ids.forEach(function (id) { + if (hasOwn.call(snapshot, id)) { + Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids); + delete snapshot[id]; + } + }); + var idsToRemove = Object.keys(snapshot); + if (idsToRemove.length) { + var root_1 = this; + while (root_1 instanceof Layer) + root_1 = root_1.parent; + idsToRemove.forEach(function (id) { return root_1.delete(id); }); + } + return idsToRemove; + }; + EntityStore.prototype.findChildRefIds = function (dataId) { + if (!hasOwn.call(this.refs, dataId)) { + var found_1 = (this.refs[dataId] = Object.create(null)); + var root = this.data[dataId]; + if (!root) + return found_1; + var workSet_1 = new Set([root]); + workSet_1.forEach(function (obj) { + if (utilities.isReference(obj)) { + found_1[obj.__ref] = true; + } + if (utilities.isNonNullObject(obj)) { + Object.keys(obj).forEach(function (key) { + var child = obj[key]; + if (utilities.isNonNullObject(child)) { + workSet_1.add(child); + } + }); + } + }); + } + return this.refs[dataId]; + }; + EntityStore.prototype.makeCacheKey = function () { + return this.group.keyMaker.lookupArray(arguments); + }; + return EntityStore; +}()); +var CacheGroup = (function () { + function CacheGroup(caching, parent) { + if (parent === void 0) { parent = null; } + this.caching = caching; + this.parent = parent; + this.d = null; + this.resetCaching(); + } + CacheGroup.prototype.resetCaching = function () { + this.d = this.caching ? optimism.dep() : null; + this.keyMaker = new trie.Trie(utilities.canUseWeakMap); + }; + CacheGroup.prototype.depend = function (dataId, storeFieldName) { + if (this.d) { + this.d(makeDepKey(dataId, storeFieldName)); + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName) { + this.d(makeDepKey(dataId, fieldName)); + } + if (this.parent) { + this.parent.depend(dataId, storeFieldName); + } + } + }; + CacheGroup.prototype.dirty = function (dataId, storeFieldName) { + if (this.d) { + this.d.dirty(makeDepKey(dataId, storeFieldName), + storeFieldName === "__exists" ? "forget" : "setDirty"); + } + }; + return CacheGroup; +}()); +function makeDepKey(dataId, storeFieldName) { + return storeFieldName + "#" + dataId; +} +function maybeDependOnExistenceOfEntity(store, entityId) { + if (supportsResultCaching(store)) { + store.group.depend(entityId, "__exists"); + } +} +(function (EntityStore) { + var Root = (function (_super) { + tslib.__extends(Root, _super); + function Root(_a) { + var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed; + var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this; + _this.stump = new Stump(_this); + _this.storageTrie = new trie.Trie(utilities.canUseWeakMap); + if (seed) + _this.replace(seed); + return _this; + } + Root.prototype.addLayer = function (layerId, replay) { + return this.stump.addLayer(layerId, replay); + }; + Root.prototype.removeLayer = function () { + return this; + }; + Root.prototype.getStorage = function () { + return this.storageTrie.lookupArray(arguments); + }; + return Root; + }(EntityStore)); + EntityStore.Root = Root; +})(exports.EntityStore || (exports.EntityStore = {})); +var Layer = (function (_super) { + tslib.__extends(Layer, _super); + function Layer(id, parent, replay, group) { + var _this = _super.call(this, parent.policies, group) || this; + _this.id = id; + _this.parent = parent; + _this.replay = replay; + _this.group = group; + replay(_this); + return _this; + } + Layer.prototype.addLayer = function (layerId, replay) { + return new Layer(layerId, this, replay, this.group); + }; + Layer.prototype.removeLayer = function (layerId) { + var _this = this; + var parent = this.parent.removeLayer(layerId); + if (layerId === this.id) { + if (this.group.caching) { + Object.keys(this.data).forEach(function (dataId) { + var ownStoreObject = _this.data[dataId]; + var parentStoreObject = parent["lookup"](dataId); + if (!parentStoreObject) { + _this.delete(dataId); + } + else if (!ownStoreObject) { + _this.group.dirty(dataId, "__exists"); + Object.keys(parentStoreObject).forEach(function (storeFieldName) { + _this.group.dirty(dataId, storeFieldName); + }); + } + else if (ownStoreObject !== parentStoreObject) { + Object.keys(ownStoreObject).forEach(function (storeFieldName) { + if (!equality.equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) { + _this.group.dirty(dataId, storeFieldName); + } + }); + } + }); + } + return parent; + } + if (parent === this.parent) + return this; + return parent.addLayer(this.id, this.replay); + }; + Layer.prototype.toObject = function () { + return tslib.__assign(tslib.__assign({}, this.parent.toObject()), this.data); + }; + Layer.prototype.findChildRefIds = function (dataId) { + var fromParent = this.parent.findChildRefIds(dataId); + return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent; + }; + Layer.prototype.getStorage = function () { + var p = this.parent; + while (p.parent) + p = p.parent; + return p.getStorage.apply(p, + arguments); + }; + return Layer; +}(exports.EntityStore)); +var Stump = (function (_super) { + tslib.__extends(Stump, _super); + function Stump(root) { + return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this; + } + Stump.prototype.removeLayer = function () { + return this; + }; + Stump.prototype.merge = function (older, newer) { + return this.parent.merge(older, newer); + }; + return Stump; +}(Layer)); +function storeObjectReconciler(existingObject, incomingObject, property) { + var existingValue = existingObject[property]; + var incomingValue = incomingObject[property]; + return equality.equal(existingValue, incomingValue) ? existingValue : incomingValue; +} +function supportsResultCaching(store) { + return !!(store instanceof exports.EntityStore && store.group.caching); +} + +function shallowCopy(value) { + if (utilities.isNonNullObject(value)) { + return utilities.isArray(value) ? + value.slice(0) + : tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + return value; +} +var ObjectCanon = (function () { + function ObjectCanon() { + this.known = new (utilities.canUseWeakSet ? WeakSet : Set)(); + this.pool = new trie.Trie(utilities.canUseWeakMap); + this.passes = new WeakMap(); + this.keysByJSON = new Map(); + this.empty = this.admit({}); + } + ObjectCanon.prototype.isKnown = function (value) { + return utilities.isNonNullObject(value) && this.known.has(value); + }; + ObjectCanon.prototype.pass = function (value) { + if (utilities.isNonNullObject(value)) { + var copy = shallowCopy(value); + this.passes.set(copy, value); + return copy; + } + return value; + }; + ObjectCanon.prototype.admit = function (value) { + var _this = this; + if (utilities.isNonNullObject(value)) { + var original = this.passes.get(value); + if (original) + return original; + var proto = Object.getPrototypeOf(value); + switch (proto) { + case Array.prototype: { + if (this.known.has(value)) + return value; + var array = value.map(this.admit, this); + var node = this.pool.lookupArray(array); + if (!node.array) { + this.known.add((node.array = array)); + if (globalThis.__DEV__ !== false) { + Object.freeze(array); + } + } + return node.array; + } + case null: + case Object.prototype: { + if (this.known.has(value)) + return value; + var proto_1 = Object.getPrototypeOf(value); + var array_1 = [proto_1]; + var keys = this.sortedKeys(value); + array_1.push(keys.json); + var firstValueIndex_1 = array_1.length; + keys.sorted.forEach(function (key) { + array_1.push(_this.admit(value[key])); + }); + var node = this.pool.lookupArray(array_1); + if (!node.object) { + var obj_1 = (node.object = Object.create(proto_1)); + this.known.add(obj_1); + keys.sorted.forEach(function (key, i) { + obj_1[key] = array_1[firstValueIndex_1 + i]; + }); + if (globalThis.__DEV__ !== false) { + Object.freeze(obj_1); + } + } + return node.object; + } + } + } + return value; + }; + ObjectCanon.prototype.sortedKeys = function (obj) { + var keys = Object.keys(obj); + var node = this.pool.lookupArray(keys); + if (!node.keys) { + keys.sort(); + var json = JSON.stringify(keys); + if (!(node.keys = this.keysByJSON.get(json))) { + this.keysByJSON.set(json, (node.keys = { sorted: keys, json: json })); + } + } + return node.keys; + }; + return ObjectCanon; +}()); + +function execSelectionSetKeyArgs(options) { + return [ + options.selectionSet, + options.objectOrReference, + options.context, + options.context.canonizeResults, + ]; +} +var StoreReader = (function () { + function StoreReader(config) { + var _this = this; + this.knownResults = new (utilities.canUseWeakMap ? WeakMap : Map)(); + this.config = utilities.compact(config, { + addTypename: config.addTypename !== false, + canonizeResults: shouldCanonizeResults(config), + }); + this.canon = config.canon || new ObjectCanon(); + this.executeSelectionSet = optimism.wrap(function (options) { + var _a; + var canonizeResults = options.context.canonizeResults; + var peekArgs = execSelectionSetKeyArgs(options); + peekArgs[3] = !canonizeResults; + var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs); + if (other) { + if (canonizeResults) { + return tslib.__assign(tslib.__assign({}, other), { + result: _this.canon.admit(other.result) }); + } + return other; + } + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSelectionSetImpl(options); + }, { + max: this.config.resultCacheMaxSize || + utilities.cacheSizes["inMemoryCache.executeSelectionSet"] || + 50000 , + keyArgs: execSelectionSetKeyArgs, + makeCacheKey: function (selectionSet, parent, context, canonizeResults) { + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(selectionSet, utilities.isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults); + } + }, + }); + this.executeSubSelectedArray = optimism.wrap(function (options) { + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSubSelectedArrayImpl(options); + }, { + max: this.config.resultCacheMaxSize || + utilities.cacheSizes["inMemoryCache.executeSubSelectedArray"] || + 10000 , + makeCacheKey: function (_a) { + var field = _a.field, array = _a.array, context = _a.context; + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(field, array, context.varString); + } + }, + }); + } + StoreReader.prototype.resetCanon = function () { + this.canon = new ObjectCanon(); + }; + StoreReader.prototype.diffQueryAgainstStore = function (_a) { + var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? "ROOT_QUERY" : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d; + var policies = this.config.cache.policies; + variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(utilities.getQueryDefinition(query))), variables); + var rootRef = utilities.makeReference(rootId); + var execResult = this.executeSelectionSet({ + selectionSet: utilities.getMainDefinition(query).selectionSet, + objectOrReference: rootRef, + enclosingRef: rootRef, + context: tslib.__assign({ store: store, query: query, policies: policies, variables: variables, varString: utilities.canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)), + }); + var missing; + if (execResult.missing) { + missing = [ + new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables), + ]; + if (!returnPartialData) { + throw missing[0]; + } + } + return { + result: execResult.result, + complete: !missing, + missing: missing, + }; + }; + StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) { + if (supportsResultCaching(context.store) && + this.knownResults.get(result) === selectionSet) { + var latest = this.executeSelectionSet.peek(selectionSet, parent, context, + this.canon.isKnown(result)); + if (latest && result === latest.result) { + return true; + } + } + return false; + }; + StoreReader.prototype.execSelectionSetImpl = function (_a) { + var _this = this; + var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context; + if (utilities.isReference(objectOrReference) && + !context.policies.rootTypenamesById[objectOrReference.__ref] && + !context.store.has(objectOrReference.__ref)) { + return { + result: this.canon.empty, + missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"), + }; + } + var variables = context.variables, policies = context.policies, store = context.store; + var typename = store.getFieldValue(objectOrReference, "__typename"); + var objectsToMerge = []; + var missing; + var missingMerger = new utilities.DeepMerger(); + if (this.config.addTypename && + typeof typename === "string" && + !policies.rootIdsByTypename[typename]) { + objectsToMerge.push({ __typename: typename }); + } + function handleMissing(result, resultName) { + var _a; + if (result.missing) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = result.missing, + _a)); + } + return result.result; + } + var workSet = new Set(selectionSet.selections); + workSet.forEach(function (selection) { + var _a, _b; + if (!utilities.shouldInclude(selection, variables)) + return; + if (utilities.isField(selection)) { + var fieldValue = policies.readField({ + fieldName: selection.name.value, + field: selection, + variables: context.variables, + from: objectOrReference, + }, context); + var resultName = utilities.resultKeyNameFromField(selection); + if (fieldValue === void 0) { + if (!utilities.addTypenameToDocument.added(selection)) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference) ? + objectOrReference.__ref + " object" + : "object " + JSON.stringify(objectOrReference, null, 2)), + _a)); + } + } + else if (utilities.isArray(fieldValue)) { + fieldValue = handleMissing(_this.executeSubSelectedArray({ + field: selection, + array: fieldValue, + enclosingRef: enclosingRef, + context: context, + }), resultName); + } + else if (!selection.selectionSet) { + if (context.canonizeResults) { + fieldValue = _this.canon.pass(fieldValue); + } + } + else if (fieldValue != null) { + fieldValue = handleMissing(_this.executeSelectionSet({ + selectionSet: selection.selectionSet, + objectOrReference: fieldValue, + enclosingRef: utilities.isReference(fieldValue) ? fieldValue : enclosingRef, + context: context, + }), resultName); + } + if (fieldValue !== void 0) { + objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b)); + } + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) { + throw globals.newInvariantError(9, selection.name.value); + } + if (fragment && policies.fragmentMatches(fragment, typename)) { + fragment.selectionSet.selections.forEach(workSet.add, workSet); + } + } + }); + var result = utilities.mergeDeepArray(objectsToMerge); + var finalResult = { result: result, missing: missing }; + var frozen = context.canonizeResults ? + this.canon.admit(finalResult) + : utilities.maybeDeepFreeze(finalResult); + if (frozen.result) { + this.knownResults.set(frozen.result, selectionSet); + } + return frozen; + }; + StoreReader.prototype.execSubSelectedArrayImpl = function (_a) { + var _this = this; + var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context; + var missing; + var missingMerger = new utilities.DeepMerger(); + function handleMissing(childResult, i) { + var _a; + if (childResult.missing) { + missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a)); + } + return childResult.result; + } + if (field.selectionSet) { + array = array.filter(context.store.canRead); + } + array = array.map(function (item, i) { + if (item === null) { + return null; + } + if (utilities.isArray(item)) { + return handleMissing(_this.executeSubSelectedArray({ + field: field, + array: item, + enclosingRef: enclosingRef, + context: context, + }), i); + } + if (field.selectionSet) { + return handleMissing(_this.executeSelectionSet({ + selectionSet: field.selectionSet, + objectOrReference: item, + enclosingRef: utilities.isReference(item) ? item : enclosingRef, + context: context, + }), i); + } + if (globalThis.__DEV__ !== false) { + assertSelectionSetForIdValue(context.store, field, item); + } + return item; + }); + return { + result: context.canonizeResults ? this.canon.admit(array) : array, + missing: missing, + }; + }; + return StoreReader; +}()); +function firstMissing(tree) { + try { + JSON.stringify(tree, function (_, value) { + if (typeof value === "string") + throw value; + return value; + }); + } + catch (result) { + return result; + } +} +function assertSelectionSetForIdValue(store, field, fieldValue) { + if (!field.selectionSet) { + var workSet_1 = new Set([fieldValue]); + workSet_1.forEach(function (value) { + if (utilities.isNonNullObject(value)) { + globals.invariant( + !utilities.isReference(value), + 10, + getTypenameFromStoreObject(store, value), + field.name.value + ); + Object.values(value).forEach(workSet_1.add, workSet_1); + } + }); + } +} + +var cacheSlot = new optimism.Slot(); +var cacheInfoMap = new WeakMap(); +function getCacheInfo(cache) { + var info = cacheInfoMap.get(cache); + if (!info) { + cacheInfoMap.set(cache, (info = { + vars: new Set(), + dep: optimism.dep(), + })); + } + return info; +} +function forgetCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); }); +} +function recallCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); }); +} +function makeVar(value) { + var caches = new Set(); + var listeners = new Set(); + var rv = function (newValue) { + if (arguments.length > 0) { + if (value !== newValue) { + value = newValue; + caches.forEach(function (cache) { + getCacheInfo(cache).dep.dirty(rv); + broadcast(cache); + }); + var oldListeners = Array.from(listeners); + listeners.clear(); + oldListeners.forEach(function (listener) { return listener(value); }); + } + } + else { + var cache = cacheSlot.getValue(); + if (cache) { + attach(cache); + getCacheInfo(cache).dep(rv); + } + } + return value; + }; + rv.onNextChange = function (listener) { + listeners.add(listener); + return function () { + listeners.delete(listener); + }; + }; + var attach = (rv.attachCache = function (cache) { + caches.add(cache); + getCacheInfo(cache).vars.add(rv); + return rv; + }); + rv.forgetCache = function (cache) { return caches.delete(cache); }; + return rv; +} +function broadcast(cache) { + if (cache.broadcastWatches) { + cache.broadcastWatches(); + } +} + +var specifierInfoCache = Object.create(null); +function lookupSpecifierInfo(spec) { + var cacheKey = JSON.stringify(spec); + return (specifierInfoCache[cacheKey] || + (specifierInfoCache[cacheKey] = Object.create(null))); +} +function keyFieldsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyFieldsFn || (info.keyFieldsFn = function (object, context) { + var extract = function (from, key) { + return context.readField(key, from); + }; + var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) { + var extracted = extractKeyPath(context.storeObject, schemaKeyPath, + extract); + if (extracted === void 0 && + object !== context.storeObject && + hasOwn.call(object, schemaKeyPath[0])) { + extracted = extractKeyPath(object, schemaKeyPath, extractKey); + } + globals.invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object); + return extracted; + })); + return "".concat(context.typename, ":").concat(JSON.stringify(keyObject)); + })); +} +function keyArgsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyArgsFn || + (info.keyArgsFn = function (args, _a) { + var field = _a.field, variables = _a.variables, fieldName = _a.fieldName; + var collected = collectSpecifierPaths(specifier, function (keyPath) { + var firstKey = keyPath[0]; + var firstChar = firstKey.charAt(0); + if (firstChar === "@") { + if (field && utilities.isNonEmptyArray(field.directives)) { + var directiveName_1 = firstKey.slice(1); + var d = field.directives.find(function (d) { return d.name.value === directiveName_1; }); + var directiveArgs = d && utilities.argumentsObjectFromField(d, variables); + return (directiveArgs && + extractKeyPath(directiveArgs, + keyPath.slice(1))); + } + return; + } + if (firstChar === "$") { + var variableName = firstKey.slice(1); + if (variables && hasOwn.call(variables, variableName)) { + var varKeyPath = keyPath.slice(0); + varKeyPath[0] = variableName; + return extractKeyPath(variables, varKeyPath); + } + return; + } + if (args) { + return extractKeyPath(args, keyPath); + } + }); + var suffix = JSON.stringify(collected); + if (args || suffix !== "{}") { + fieldName += ":" + suffix; + } + return fieldName; + })); +} +function collectSpecifierPaths(specifier, extractor) { + var merger = new utilities.DeepMerger(); + return getSpecifierPaths(specifier).reduce(function (collected, path) { + var _a; + var toMerge = extractor(path); + if (toMerge !== void 0) { + for (var i = path.length - 1; i >= 0; --i) { + toMerge = (_a = {}, _a[path[i]] = toMerge, _a); + } + collected = merger.merge(collected, toMerge); + } + return collected; + }, Object.create(null)); +} +function getSpecifierPaths(spec) { + var info = lookupSpecifierInfo(spec); + if (!info.paths) { + var paths_1 = (info.paths = []); + var currentPath_1 = []; + spec.forEach(function (s, i) { + if (utilities.isArray(s)) { + getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); }); + currentPath_1.length = 0; + } + else { + currentPath_1.push(s); + if (!utilities.isArray(spec[i + 1])) { + paths_1.push(currentPath_1.slice(0)); + currentPath_1.length = 0; + } + } + }); + } + return info.paths; +} +function extractKey(object, key) { + return object[key]; +} +function extractKeyPath(object, path, extract) { + extract = extract || extractKey; + return normalize(path.reduce(function reducer(obj, key) { + return utilities.isArray(obj) ? + obj.map(function (child) { return reducer(child, key); }) + : obj && extract(obj, key); + }, object)); +} +function normalize(value) { + if (utilities.isNonNullObject(value)) { + if (utilities.isArray(value)) { + return value.map(normalize); + } + return collectSpecifierPaths(Object.keys(value).sort(), function (path) { + return extractKeyPath(value, path); + }); + } + return value; +} + +function argsFromFieldSpecifier(spec) { + return (spec.args !== void 0 ? spec.args + : spec.field ? utilities.argumentsObjectFromField(spec.field, spec.variables) + : null); +} +var nullKeyFieldsFn = function () { return void 0; }; +var simpleKeyArgsFn = function (_args, context) { return context.fieldName; }; +var mergeTrueFn = function (existing, incoming, _a) { + var mergeObjects = _a.mergeObjects; + return mergeObjects(existing, incoming); +}; +var mergeFalseFn = function (_, incoming) { return incoming; }; +var Policies = (function () { + function Policies(config) { + this.config = config; + this.typePolicies = Object.create(null); + this.toBeAdded = Object.create(null); + this.supertypeMap = new Map(); + this.fuzzySubtypes = new Map(); + this.rootIdsByTypename = Object.create(null); + this.rootTypenamesById = Object.create(null); + this.usingPossibleTypes = false; + this.config = tslib.__assign({ dataIdFromObject: defaultDataIdFromObject }, config); + this.cache = this.config.cache; + this.setRootTypename("Query"); + this.setRootTypename("Mutation"); + this.setRootTypename("Subscription"); + if (config.possibleTypes) { + this.addPossibleTypes(config.possibleTypes); + } + if (config.typePolicies) { + this.addTypePolicies(config.typePolicies); + } + } + Policies.prototype.identify = function (object, partialContext) { + var _a; + var policies = this; + var typename = (partialContext && + (partialContext.typename || ((_a = partialContext.storeObject) === null || _a === void 0 ? void 0 : _a.__typename))) || + object.__typename; + if (typename === this.rootTypenamesById.ROOT_QUERY) { + return ["ROOT_QUERY"]; + } + var storeObject = (partialContext && partialContext.storeObject) || object; + var context = tslib.__assign(tslib.__assign({}, partialContext), { typename: typename, storeObject: storeObject, readField: (partialContext && partialContext.readField) || + function () { + var options = normalizeReadFieldOptions(arguments, storeObject); + return policies.readField(options, { + store: policies.cache["data"], + variables: options.variables, + }); + } }); + var id; + var policy = typename && this.getTypePolicy(typename); + var keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject; + while (keyFn) { + var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context); + if (utilities.isArray(specifierOrId)) { + keyFn = keyFieldsFnFromSpecifier(specifierOrId); + } + else { + id = specifierOrId; + break; + } + } + id = id ? String(id) : void 0; + return context.keyObject ? [id, context.keyObject] : [id]; + }; + Policies.prototype.addTypePolicies = function (typePolicies) { + var _this = this; + Object.keys(typePolicies).forEach(function (typename) { + var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = tslib.__rest(_a, ["queryType", "mutationType", "subscriptionType"]); + if (queryType) + _this.setRootTypename("Query", typename); + if (mutationType) + _this.setRootTypename("Mutation", typename); + if (subscriptionType) + _this.setRootTypename("Subscription", typename); + if (hasOwn.call(_this.toBeAdded, typename)) { + _this.toBeAdded[typename].push(incoming); + } + else { + _this.toBeAdded[typename] = [incoming]; + } + }); + }; + Policies.prototype.updateTypePolicy = function (typename, incoming) { + var _this = this; + var existing = this.getTypePolicy(typename); + var keyFields = incoming.keyFields, fields = incoming.fields; + function setMerge(existing, merge) { + existing.merge = + typeof merge === "function" ? merge + : merge === true ? mergeTrueFn + : merge === false ? mergeFalseFn + : existing.merge; + } + setMerge(existing, incoming.merge); + existing.keyFn = + keyFields === false ? nullKeyFieldsFn + : utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) + : typeof keyFields === "function" ? keyFields + : existing.keyFn; + if (fields) { + Object.keys(fields).forEach(function (fieldName) { + var existing = _this.getFieldPolicy(typename, fieldName, true); + var incoming = fields[fieldName]; + if (typeof incoming === "function") { + existing.read = incoming; + } + else { + var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge; + existing.keyFn = + keyArgs === false ? simpleKeyArgsFn + : utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) + : typeof keyArgs === "function" ? keyArgs + : existing.keyFn; + if (typeof read === "function") { + existing.read = read; + } + setMerge(existing, merge); + } + if (existing.read && existing.merge) { + existing.keyFn = existing.keyFn || simpleKeyArgsFn; + } + }); + } + }; + Policies.prototype.setRootTypename = function (which, typename) { + if (typename === void 0) { typename = which; } + var rootId = "ROOT_" + which.toUpperCase(); + var old = this.rootTypenamesById[rootId]; + if (typename !== old) { + globals.invariant(!old || old === which, 5, which); + if (old) + delete this.rootIdsByTypename[old]; + this.rootIdsByTypename[typename] = rootId; + this.rootTypenamesById[rootId] = typename; + } + }; + Policies.prototype.addPossibleTypes = function (possibleTypes) { + var _this = this; + this.usingPossibleTypes = true; + Object.keys(possibleTypes).forEach(function (supertype) { + _this.getSupertypeSet(supertype, true); + possibleTypes[supertype].forEach(function (subtype) { + _this.getSupertypeSet(subtype, true).add(supertype); + var match = subtype.match(TypeOrFieldNameRegExp); + if (!match || match[0] !== subtype) { + _this.fuzzySubtypes.set(subtype, new RegExp(subtype)); + } + }); + }); + }; + Policies.prototype.getTypePolicy = function (typename) { + var _this = this; + if (!hasOwn.call(this.typePolicies, typename)) { + var policy_1 = (this.typePolicies[typename] = Object.create(null)); + policy_1.fields = Object.create(null); + var supertypes_1 = this.supertypeMap.get(typename); + if (!supertypes_1 && this.fuzzySubtypes.size) { + supertypes_1 = this.getSupertypeSet(typename, true); + this.fuzzySubtypes.forEach(function (regExp, fuzzy) { + if (regExp.test(typename)) { + var fuzzySupertypes = _this.supertypeMap.get(fuzzy); + if (fuzzySupertypes) { + fuzzySupertypes.forEach(function (supertype) { + return supertypes_1.add(supertype); + }); + } + } + }); + } + if (supertypes_1 && supertypes_1.size) { + supertypes_1.forEach(function (supertype) { + var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = tslib.__rest(_a, ["fields"]); + Object.assign(policy_1, rest); + Object.assign(policy_1.fields, fields); + }); + } + } + var inbox = this.toBeAdded[typename]; + if (inbox && inbox.length) { + inbox.splice(0).forEach(function (policy) { + _this.updateTypePolicy(typename, policy); + }); + } + return this.typePolicies[typename]; + }; + Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) { + if (typename) { + var fieldPolicies = this.getTypePolicy(typename).fields; + return (fieldPolicies[fieldName] || + (createIfMissing && (fieldPolicies[fieldName] = Object.create(null)))); + } + }; + Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) { + var supertypeSet = this.supertypeMap.get(subtype); + if (!supertypeSet && createIfMissing) { + this.supertypeMap.set(subtype, (supertypeSet = new Set())); + } + return supertypeSet; + }; + Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) { + var _this = this; + if (!fragment.typeCondition) + return true; + if (!typename) + return false; + var supertype = fragment.typeCondition.name.value; + if (typename === supertype) + return true; + if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) { + var typenameSupertypeSet = this.getSupertypeSet(typename, true); + var workQueue_1 = [typenameSupertypeSet]; + var maybeEnqueue_1 = function (subtype) { + var supertypeSet = _this.getSupertypeSet(subtype, false); + if (supertypeSet && + supertypeSet.size && + workQueue_1.indexOf(supertypeSet) < 0) { + workQueue_1.push(supertypeSet); + } + }; + var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size); + var checkingFuzzySubtypes = false; + for (var i = 0; i < workQueue_1.length; ++i) { + var supertypeSet = workQueue_1[i]; + if (supertypeSet.has(supertype)) { + if (!typenameSupertypeSet.has(supertype)) { + if (checkingFuzzySubtypes) { + globalThis.__DEV__ !== false && globals.invariant.warn(6, typename, supertype); + } + typenameSupertypeSet.add(supertype); + } + return true; + } + supertypeSet.forEach(maybeEnqueue_1); + if (needToCheckFuzzySubtypes && + i === workQueue_1.length - 1 && + selectionSetMatchesResult(fragment.selectionSet, result, variables)) { + needToCheckFuzzySubtypes = false; + checkingFuzzySubtypes = true; + this.fuzzySubtypes.forEach(function (regExp, fuzzyString) { + var match = typename.match(regExp); + if (match && match[0] === typename) { + maybeEnqueue_1(fuzzyString); + } + }); + } + } + } + return false; + }; + Policies.prototype.hasKeyArgs = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return !!(policy && policy.keyFn); + }; + Policies.prototype.getStoreFieldName = function (fieldSpec) { + var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName; + var policy = this.getFieldPolicy(typename, fieldName, false); + var storeFieldName; + var keyFn = policy && policy.keyFn; + if (keyFn && typename) { + var context = { + typename: typename, + fieldName: fieldName, + field: fieldSpec.field || null, + variables: fieldSpec.variables, + }; + var args = argsFromFieldSpecifier(fieldSpec); + while (keyFn) { + var specifierOrString = keyFn(args, context); + if (utilities.isArray(specifierOrString)) { + keyFn = keyArgsFnFromSpecifier(specifierOrString); + } + else { + storeFieldName = specifierOrString || fieldName; + break; + } + } + } + if (storeFieldName === void 0) { + storeFieldName = + fieldSpec.field ? + utilities.storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) + : utilities.getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec)); + } + if (storeFieldName === false) { + return fieldName; + } + return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName + : fieldName + ":" + storeFieldName; + }; + Policies.prototype.readField = function (options, context) { + var objectOrReference = options.from; + if (!objectOrReference) + return; + var nameOrField = options.field || options.fieldName; + if (!nameOrField) + return; + if (options.typename === void 0) { + var typename = context.store.getFieldValue(objectOrReference, "__typename"); + if (typename) + options.typename = typename; + } + var storeFieldName = this.getStoreFieldName(options); + var fieldName = fieldNameFromStoreName(storeFieldName); + var existing = context.store.getFieldValue(objectOrReference, storeFieldName); + var policy = this.getFieldPolicy(options.typename, fieldName, false); + var read = policy && policy.read; + if (read) { + var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference) ? + objectOrReference.__ref + : objectOrReference, storeFieldName)); + return cacheSlot.withValue(this.cache, read, [ + existing, + readOptions, + ]); + } + return existing; + }; + Policies.prototype.getReadFunction = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return policy && policy.read; + }; + Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) { + var policy = this.getFieldPolicy(parentTypename, fieldName, false); + var merge = policy && policy.merge; + if (!merge && childTypename) { + policy = this.getTypePolicy(childTypename); + merge = policy && policy.merge; + } + return merge; + }; + Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) { + var field = _a.field, typename = _a.typename, merge = _a.merge; + if (merge === mergeTrueFn) { + return makeMergeObjectsFunction(context.store)(existing, incoming); + } + if (merge === mergeFalseFn) { + return incoming; + } + if (context.overwrite) { + existing = void 0; + } + return merge(existing, incoming, makeFieldFunctionOptions(this, + void 0, { + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }, context, storage || Object.create(null))); + }; + return Policies; +}()); +function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) { + var storeFieldName = policies.getStoreFieldName(fieldSpec); + var fieldName = fieldNameFromStoreName(storeFieldName); + var variables = fieldSpec.variables || context.variables; + var _a = context.store, toReference = _a.toReference, canRead = _a.canRead; + return { + args: argsFromFieldSpecifier(fieldSpec), + field: fieldSpec.field || null, + fieldName: fieldName, + storeFieldName: storeFieldName, + variables: variables, + isReference: utilities.isReference, + toReference: toReference, + storage: storage, + cache: policies.cache, + canRead: canRead, + readField: function () { + return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context); + }, + mergeObjects: makeMergeObjectsFunction(context.store), + }; +} +function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) { + var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length; + var options; + if (typeof fieldNameOrOptions === "string") { + options = { + fieldName: fieldNameOrOptions, + from: argc > 1 ? from : objectOrReference, + }; + } + else { + options = tslib.__assign({}, fieldNameOrOptions); + if (!hasOwn.call(options, "from")) { + options.from = objectOrReference; + } + } + if (globalThis.__DEV__ !== false && options.from === void 0) { + globalThis.__DEV__ !== false && globals.invariant.warn(7, utilities.stringifyForDisplay(Array.from(readFieldArgs))); + } + if (void 0 === options.variables) { + options.variables = variables; + } + return options; +} +function makeMergeObjectsFunction(store) { + return function mergeObjects(existing, incoming) { + if (utilities.isArray(existing) || utilities.isArray(incoming)) { + throw globals.newInvariantError(8); + } + if (utilities.isNonNullObject(existing) && utilities.isNonNullObject(incoming)) { + var eType = store.getFieldValue(existing, "__typename"); + var iType = store.getFieldValue(incoming, "__typename"); + var typesDiffer = eType && iType && eType !== iType; + if (typesDiffer) { + return incoming; + } + if (utilities.isReference(existing) && storeValueIsStoreObject(incoming)) { + store.merge(existing.__ref, incoming); + return existing; + } + if (storeValueIsStoreObject(existing) && utilities.isReference(incoming)) { + store.merge(existing, incoming.__ref); + return incoming; + } + if (storeValueIsStoreObject(existing) && + storeValueIsStoreObject(incoming)) { + return tslib.__assign(tslib.__assign({}, existing), incoming); + } + } + return incoming; + }; +} + +function getContextFlavor(context, clientOnly, deferred) { + var key = "".concat(clientOnly).concat(deferred); + var flavored = context.flavors.get(key); + if (!flavored) { + context.flavors.set(key, (flavored = + context.clientOnly === clientOnly && context.deferred === deferred ? + context + : tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred }))); + } + return flavored; +} +var StoreWriter = (function () { + function StoreWriter(cache, reader, fragments) { + this.cache = cache; + this.reader = reader; + this.fragments = fragments; + } + StoreWriter.prototype.writeToStore = function (store, _a) { + var _this = this; + var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite; + var operationDefinition = utilities.getOperationDefinition(query); + var merger = makeProcessedFieldsMerger(); + variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(operationDefinition)), variables); + var context = tslib.__assign(tslib.__assign({ store: store, written: Object.create(null), merge: function (existing, incoming) { + return merger.merge(existing, incoming); + }, variables: variables, varString: utilities.canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() }); + var ref = this.processSelectionSet({ + result: result || Object.create(null), + dataId: dataId, + selectionSet: operationDefinition.selectionSet, + mergeTree: { map: new Map() }, + context: context, + }); + if (!utilities.isReference(ref)) { + throw globals.newInvariantError(11, result); + } + context.incomingById.forEach(function (_a, dataId) { + var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet; + var entityRef = utilities.makeReference(dataId); + if (mergeTree && mergeTree.map.size) { + var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context); + if (utilities.isReference(applied)) { + return; + } + storeObject = applied; + } + if (globalThis.__DEV__ !== false && !context.overwrite) { + var fieldsWithSelectionSets_1 = Object.create(null); + fieldNodeSet.forEach(function (field) { + if (field.selectionSet) { + fieldsWithSelectionSets_1[field.name.value] = true; + } + }); + var hasSelectionSet_1 = function (storeFieldName) { + return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] === + true; + }; + var hasMergeFunction_1 = function (storeFieldName) { + var childTree = mergeTree && mergeTree.map.get(storeFieldName); + return Boolean(childTree && childTree.info && childTree.info.merge); + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + if (hasSelectionSet_1(storeFieldName) && + !hasMergeFunction_1(storeFieldName)) { + warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store); + } + }); + } + store.merge(dataId, storeObject); + }); + store.retain(ref.__ref); + return ref; + }; + StoreWriter.prototype.processSelectionSet = function (_a) { + var _this = this; + var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, + mergeTree = _a.mergeTree; + var policies = this.cache.policies; + var incoming = Object.create(null); + var typename = (dataId && policies.rootTypenamesById[dataId]) || + utilities.getTypenameFromResult(result, selectionSet, context.fragmentMap) || + (dataId && context.store.get(dataId, "__typename")); + if ("string" === typeof typename) { + incoming.__typename = typename; + } + var readField = function () { + var options = normalizeReadFieldOptions(arguments, incoming, context.variables); + if (utilities.isReference(options.from)) { + var info = context.incomingById.get(options.from.__ref); + if (info) { + var result_1 = policies.readField(tslib.__assign(tslib.__assign({}, options), { from: info.storeObject }), context); + if (result_1 !== void 0) { + return result_1; + } + } + } + return policies.readField(options, context); + }; + var fieldNodeSet = new Set(); + this.flattenFields(selectionSet, result, + context, typename).forEach(function (context, field) { + var _a; + var resultFieldKey = utilities.resultKeyNameFromField(field); + var value = result[resultFieldKey]; + fieldNodeSet.add(field); + if (value !== void 0) { + var storeFieldName = policies.getStoreFieldName({ + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }); + var childTree = getChildMergeTree(mergeTree, storeFieldName); + var incomingValue = _this.processFieldValue(value, field, + field.selectionSet ? + getContextFlavor(context, false, false) + : context, childTree); + var childTypename = void 0; + if (field.selectionSet && + (utilities.isReference(incomingValue) || storeValueIsStoreObject(incomingValue))) { + childTypename = readField("__typename", incomingValue); + } + var merge = policies.getMergeFunction(typename, field.name.value, childTypename); + if (merge) { + childTree.info = { + field: field, + typename: typename, + merge: merge, + }; + } + else { + maybeRecycleChildMergeTree(mergeTree, storeFieldName); + } + incoming = context.merge(incoming, (_a = {}, + _a[storeFieldName] = incomingValue, + _a)); + } + else if (globalThis.__DEV__ !== false && + !context.clientOnly && + !context.deferred && + !utilities.addTypenameToDocument.added(field) && + !policies.getReadFunction(typename, field.name.value)) { + globalThis.__DEV__ !== false && globals.invariant.error(12, utilities.resultKeyNameFromField(field), result); + } + }); + try { + var _b = policies.identify(result, { + typename: typename, + selectionSet: selectionSet, + fragmentMap: context.fragmentMap, + storeObject: incoming, + readField: readField, + }), id = _b[0], keyObject = _b[1]; + dataId = dataId || id; + if (keyObject) { + incoming = context.merge(incoming, keyObject); + } + } + catch (e) { + if (!dataId) + throw e; + } + if ("string" === typeof dataId) { + var dataRef = utilities.makeReference(dataId); + var sets = context.written[dataId] || (context.written[dataId] = []); + if (sets.indexOf(selectionSet) >= 0) + return dataRef; + sets.push(selectionSet); + if (this.reader && + this.reader.isFresh(result, dataRef, selectionSet, context)) { + return dataRef; + } + var previous_1 = context.incomingById.get(dataId); + if (previous_1) { + previous_1.storeObject = context.merge(previous_1.storeObject, incoming); + previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree); + fieldNodeSet.forEach(function (field) { return previous_1.fieldNodeSet.add(field); }); + } + else { + context.incomingById.set(dataId, { + storeObject: incoming, + mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree, + fieldNodeSet: fieldNodeSet, + }); + } + return dataRef; + } + return incoming; + }; + StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) { + var _this = this; + if (!field.selectionSet || value === null) { + return globalThis.__DEV__ !== false ? utilities.cloneDeep(value) : value; + } + if (utilities.isArray(value)) { + return value.map(function (item, i) { + var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i)); + maybeRecycleChildMergeTree(mergeTree, i); + return value; + }); + } + return this.processSelectionSet({ + result: value, + selectionSet: field.selectionSet, + context: context, + mergeTree: mergeTree, + }); + }; + StoreWriter.prototype.flattenFields = function (selectionSet, result, context, typename) { + if (typename === void 0) { typename = utilities.getTypenameFromResult(result, selectionSet, context.fragmentMap); } + var fieldMap = new Map(); + var policies = this.cache.policies; + var limitingTrie = new trie.Trie(false); + (function flatten(selectionSet, inheritedContext) { + var visitedNode = limitingTrie.lookup(selectionSet, + inheritedContext.clientOnly, inheritedContext.deferred); + if (visitedNode.visited) + return; + visitedNode.visited = true; + selectionSet.selections.forEach(function (selection) { + if (!utilities.shouldInclude(selection, context.variables)) + return; + var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred; + if ( + !(clientOnly && deferred) && + utilities.isNonEmptyArray(selection.directives)) { + selection.directives.forEach(function (dir) { + var name = dir.name.value; + if (name === "client") + clientOnly = true; + if (name === "defer") { + var args = utilities.argumentsObjectFromField(dir, context.variables); + if (!args || args.if !== false) { + deferred = true; + } + } + }); + } + if (utilities.isField(selection)) { + var existing = fieldMap.get(selection); + if (existing) { + clientOnly = clientOnly && existing.clientOnly; + deferred = deferred && existing.deferred; + } + fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred)); + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) { + throw globals.newInvariantError(13, selection.name.value); + } + if (fragment && + policies.fragmentMatches(fragment, typename, result, context.variables)) { + flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred)); + } + } + }); + })(selectionSet, context); + return fieldMap; + }; + StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) { + var _a; + var _this = this; + if (mergeTree.map.size && !utilities.isReference(incoming)) { + var e_1 = + (!utilities.isArray(incoming) && + (utilities.isReference(existing) || storeValueIsStoreObject(existing))) ? + existing + : void 0; + var i_1 = incoming; + if (e_1 && !getStorageArgs) { + getStorageArgs = [utilities.isReference(e_1) ? e_1.__ref : e_1]; + } + var changedFields_1; + var getValue_1 = function (from, name) { + return (utilities.isArray(from) ? + typeof name === "number" ? + from[name] + : void 0 + : context.store.getFieldValue(from, String(name))); + }; + mergeTree.map.forEach(function (childTree, storeFieldName) { + var eVal = getValue_1(e_1, storeFieldName); + var iVal = getValue_1(i_1, storeFieldName); + if (void 0 === iVal) + return; + if (getStorageArgs) { + getStorageArgs.push(storeFieldName); + } + var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs); + if (aVal !== iVal) { + changedFields_1 = changedFields_1 || new Map(); + changedFields_1.set(storeFieldName, aVal); + } + if (getStorageArgs) { + globals.invariant(getStorageArgs.pop() === storeFieldName); + } + }); + if (changedFields_1) { + incoming = (utilities.isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1)); + changedFields_1.forEach(function (value, name) { + incoming[name] = value; + }); + } + } + if (mergeTree.info) { + return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs)); + } + return incoming; + }; + return StoreWriter; +}()); +var emptyMergeTreePool = []; +function getChildMergeTree(_a, name) { + var map = _a.map; + if (!map.has(name)) { + map.set(name, emptyMergeTreePool.pop() || { map: new Map() }); + } + return map.get(name); +} +function mergeMergeTrees(left, right) { + if (left === right || !right || mergeTreeIsEmpty(right)) + return left; + if (!left || mergeTreeIsEmpty(left)) + return right; + var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info; + var needToMergeMaps = left.map.size && right.map.size; + var map = needToMergeMaps ? new Map() + : left.map.size ? left.map + : right.map; + var merged = { info: info, map: map }; + if (needToMergeMaps) { + var remainingRightKeys_1 = new Set(right.map.keys()); + left.map.forEach(function (leftTree, key) { + merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key))); + remainingRightKeys_1.delete(key); + }); + remainingRightKeys_1.forEach(function (key) { + merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key))); + }); + } + return merged; +} +function mergeTreeIsEmpty(tree) { + return !tree || !(tree.info || tree.map.size); +} +function maybeRecycleChildMergeTree(_a, name) { + var map = _a.map; + var childTree = map.get(name); + if (childTree && mergeTreeIsEmpty(childTree)) { + emptyMergeTreePool.push(childTree); + map.delete(name); + } +} +var warnings = new Set(); +function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) { + var getChild = function (objOrRef) { + var child = store.getFieldValue(objOrRef, storeFieldName); + return typeof child === "object" && child; + }; + var existing = getChild(existingRef); + if (!existing) + return; + var incoming = getChild(incomingObj); + if (!incoming) + return; + if (utilities.isReference(existing)) + return; + if (equality.equal(existing, incoming)) + return; + if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) { + return; + } + var parentType = store.getFieldValue(existingRef, "__typename") || + store.getFieldValue(incomingObj, "__typename"); + var fieldName = fieldNameFromStoreName(storeFieldName); + var typeDotName = "".concat(parentType, ".").concat(fieldName); + if (warnings.has(typeDotName)) + return; + warnings.add(typeDotName); + var childTypenames = []; + if (!utilities.isArray(existing) && !utilities.isArray(incoming)) { + [existing, incoming].forEach(function (child) { + var typename = store.getFieldValue(child, "__typename"); + if (typeof typename === "string" && !childTypenames.includes(typename)) { + childTypenames.push(typename); + } + }); + } + globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length ? + "either ensure all objects of type " + + childTypenames.join(" and ") + + " have an ID or a custom merge function, or " + : "", typeDotName, existing, incoming); +} + +var InMemoryCache = (function (_super) { + tslib.__extends(InMemoryCache, _super); + function InMemoryCache(config) { + if (config === void 0) { config = {}; } + var _this = _super.call(this) || this; + _this.watches = new Set(); + _this.addTypenameTransform = new utilities.DocumentTransform(utilities.addTypenameToDocument); + _this.assumeImmutableResults = true; + _this.makeVar = makeVar; + _this.txCount = 0; + _this.config = normalizeConfig(config); + _this.addTypename = !!_this.config.addTypename; + _this.policies = new Policies({ + cache: _this, + dataIdFromObject: _this.config.dataIdFromObject, + possibleTypes: _this.config.possibleTypes, + typePolicies: _this.config.typePolicies, + }); + _this.init(); + return _this; + } + InMemoryCache.prototype.init = function () { + var rootStore = (this.data = new exports.EntityStore.Root({ + policies: this.policies, + resultCaching: this.config.resultCaching, + })); + this.optimisticData = rootStore.stump; + this.resetResultCache(); + }; + InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) { + var _this = this; + var previousReader = this.storeReader; + var fragments = this.config.fragments; + this.storeWriter = new StoreWriter(this, (this.storeReader = new StoreReader({ + cache: this, + addTypename: this.addTypename, + resultCacheMaxSize: this.config.resultCacheMaxSize, + canonizeResults: shouldCanonizeResults(this.config), + canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon), + fragments: fragments, + })), fragments); + this.maybeBroadcastWatch = optimism.wrap(function (c, options) { + return _this.broadcastWatch(c, options); + }, { + max: this.config.resultCacheMaxSize || + utilities.cacheSizes["inMemoryCache.maybeBroadcastWatch"] || + 5000 , + makeCacheKey: function (c) { + var store = c.optimistic ? _this.optimisticData : _this.data; + if (supportsResultCaching(store)) { + var optimistic = c.optimistic, id = c.id, variables = c.variables; + return store.makeCacheKey(c.query, + c.callback, utilities.canonicalStringify({ optimistic: optimistic, id: id, variables: variables })); + } + }, + }); + new Set([this.data.group, this.optimisticData.group]).forEach(function (group) { + return group.resetCaching(); + }); + }; + InMemoryCache.prototype.restore = function (data) { + this.init(); + if (data) + this.data.replace(data); + return this; + }; + InMemoryCache.prototype.extract = function (optimistic) { + if (optimistic === void 0) { optimistic = false; } + return (optimistic ? this.optimisticData : this.data).extract(); + }; + InMemoryCache.prototype.read = function (options) { + var + _a = options.returnPartialData, + returnPartialData = _a === void 0 ? false : _a; + try { + return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null); + } + catch (e) { + if (e instanceof MissingFieldError) { + return null; + } + throw e; + } + }; + InMemoryCache.prototype.write = function (options) { + try { + ++this.txCount; + return this.storeWriter.writeToStore(this.data, options); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.modify = function (options) { + if (hasOwn.call(options, "id") && !options.id) { + return false; + } + var store = ((options.optimistic) + ) ? + this.optimisticData + : this.data; + try { + ++this.txCount; + return store.modify(options.id || "ROOT_QUERY", options.fields); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.diff = function (options) { + return this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config })); + }; + InMemoryCache.prototype.watch = function (watch) { + var _this = this; + if (!this.watches.size) { + recallCache(this); + } + this.watches.add(watch); + if (watch.immediate) { + this.maybeBroadcastWatch(watch); + } + return function () { + if (_this.watches.delete(watch) && !_this.watches.size) { + forgetCache(_this); + } + _this.maybeBroadcastWatch.forget(watch); + }; + }; + InMemoryCache.prototype.gc = function (options) { + var _a; + utilities.canonicalStringify.reset(); + utilities.print.reset(); + this.addTypenameTransform.resetCache(); + (_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches(); + var ids = this.optimisticData.gc(); + if (options && !this.txCount) { + if (options.resetResultCache) { + this.resetResultCache(options.resetResultIdentities); + } + else if (options.resetResultIdentities) { + this.storeReader.resetCanon(); + } + } + return ids; + }; + InMemoryCache.prototype.retain = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).retain(rootId); + }; + InMemoryCache.prototype.release = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).release(rootId); + }; + InMemoryCache.prototype.identify = function (object) { + if (utilities.isReference(object)) + return object.__ref; + try { + return this.policies.identify(object)[0]; + } + catch (e) { + globalThis.__DEV__ !== false && globals.invariant.warn(e); + } + }; + InMemoryCache.prototype.evict = function (options) { + if (!options.id) { + if (hasOwn.call(options, "id")) { + return false; + } + options = tslib.__assign(tslib.__assign({}, options), { id: "ROOT_QUERY" }); + } + try { + ++this.txCount; + return this.optimisticData.evict(options, this.data); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.reset = function (options) { + var _this = this; + this.init(); + utilities.canonicalStringify.reset(); + if (options && options.discardWatches) { + this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); }); + this.watches.clear(); + forgetCache(this); + } + else { + this.broadcastWatches(); + } + return Promise.resolve(); + }; + InMemoryCache.prototype.removeOptimistic = function (idToRemove) { + var newOptimisticData = this.optimisticData.removeLayer(idToRemove); + if (newOptimisticData !== this.optimisticData) { + this.optimisticData = newOptimisticData; + this.broadcastWatches(); + } + }; + InMemoryCache.prototype.batch = function (options) { + var _this = this; + var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated; + var updateResult; + var perform = function (layer) { + var _a = _this, data = _a.data, optimisticData = _a.optimisticData; + ++_this.txCount; + if (layer) { + _this.data = _this.optimisticData = layer; + } + try { + return (updateResult = update(_this)); + } + finally { + --_this.txCount; + _this.data = data; + _this.optimisticData = optimisticData; + } + }; + var alreadyDirty = new Set(); + if (onWatchUpdated && !this.txCount) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch) { + alreadyDirty.add(watch); + return false; + } })); + } + if (typeof optimistic === "string") { + this.optimisticData = this.optimisticData.addLayer(optimistic, perform); + } + else if (optimistic === false) { + perform(this.data); + } + else { + perform(); + } + if (typeof removeOptimistic === "string") { + this.optimisticData = this.optimisticData.removeLayer(removeOptimistic); + } + if (onWatchUpdated && alreadyDirty.size) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch, diff) { + var result = onWatchUpdated.call(this, watch, diff); + if (result !== false) { + alreadyDirty.delete(watch); + } + return result; + } })); + if (alreadyDirty.size) { + alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); }); + } + } + else { + this.broadcastWatches(options); + } + return updateResult; + }; + InMemoryCache.prototype.performTransaction = function (update, optimisticId) { + return this.batch({ + update: update, + optimistic: optimisticId || optimisticId !== null, + }); + }; + InMemoryCache.prototype.transformDocument = function (document) { + return this.addTypenameToDocument(this.addFragmentsToDocument(document)); + }; + InMemoryCache.prototype.broadcastWatches = function (options) { + var _this = this; + if (!this.txCount) { + this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); }); + } + }; + InMemoryCache.prototype.addFragmentsToDocument = function (document) { + var fragments = this.config.fragments; + return fragments ? fragments.transform(document) : document; + }; + InMemoryCache.prototype.addTypenameToDocument = function (document) { + if (this.addTypename) { + return this.addTypenameTransform.transformDocument(document); + } + return document; + }; + InMemoryCache.prototype.broadcastWatch = function (c, options) { + var lastDiff = c.lastDiff; + var diff = this.diff(c); + if (options) { + if (c.optimistic && typeof options.optimistic === "string") { + diff.fromOptimisticTransaction = true; + } + if (options.onWatchUpdated && + options.onWatchUpdated.call(this, c, diff, lastDiff) === false) { + return; + } + } + if (!lastDiff || !equality.equal(lastDiff.result, diff.result)) { + c.callback((c.lastDiff = diff), lastDiff); + } + }; + return InMemoryCache; +}(ApolloCache)); +if (globalThis.__DEV__ !== false) { + InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals; +} + +function createFragmentRegistry() { + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + return new (FragmentRegistry.bind.apply(FragmentRegistry, tslib.__spreadArray([void 0], fragments, false)))(); +} +var FragmentRegistry = (function () { + function FragmentRegistry() { + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + this.registry = Object.create(null); + this.resetCaches(); + if (fragments.length) { + this.register.apply(this, fragments); + } + } + FragmentRegistry.prototype.register = function () { + var _this = this; + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + var definitions = new Map(); + fragments.forEach(function (doc) { + utilities.getFragmentDefinitions(doc).forEach(function (node) { + definitions.set(node.name.value, node); + }); + }); + definitions.forEach(function (node, name) { + if (node !== _this.registry[name]) { + _this.registry[name] = node; + _this.invalidate(name); + } + }); + return this; + }; + FragmentRegistry.prototype.invalidate = function (name) { }; + FragmentRegistry.prototype.resetCaches = function () { + var proto = FragmentRegistry.prototype; + this.invalidate = (this.lookup = optimism.wrap(proto.lookup.bind(this), { + makeCacheKey: function (arg) { return arg; }, + max: utilities.cacheSizes["fragmentRegistry.lookup"] || + 1000 , + })).dirty; + this.transform = optimism.wrap(proto.transform.bind(this), { + cache: caches.WeakCache, + max: utilities.cacheSizes["fragmentRegistry.transform"] || + 2000 , + }); + this.findFragmentSpreads = optimism.wrap(proto.findFragmentSpreads.bind(this), { + cache: caches.WeakCache, + max: utilities.cacheSizes["fragmentRegistry.findFragmentSpreads"] || + 4000 , + }); + }; + FragmentRegistry.prototype.lookup = function (fragmentName) { + return this.registry[fragmentName] || null; + }; + FragmentRegistry.prototype.transform = function (document) { + var _this = this; + var defined = new Map(); + utilities.getFragmentDefinitions(document).forEach(function (def) { + defined.set(def.name.value, def); + }); + var unbound = new Set(); + var enqueue = function (spreadName) { + if (!defined.has(spreadName)) { + unbound.add(spreadName); + } + }; + var enqueueChildSpreads = function (node) { + return Object.keys(_this.findFragmentSpreads(node)).forEach(enqueue); + }; + enqueueChildSpreads(document); + var missing = []; + var map = Object.create(null); + unbound.forEach(function (fragmentName) { + var knownFragmentDef = defined.get(fragmentName); + if (knownFragmentDef) { + enqueueChildSpreads((map[fragmentName] = knownFragmentDef)); + } + else { + missing.push(fragmentName); + var def = _this.lookup(fragmentName); + if (def) { + enqueueChildSpreads((map[fragmentName] = def)); + } + } + }); + if (missing.length) { + var defsToAppend_1 = []; + missing.forEach(function (name) { + var def = map[name]; + if (def) { + defsToAppend_1.push(def); + } + }); + if (defsToAppend_1.length) { + document = tslib.__assign(tslib.__assign({}, document), { definitions: document.definitions.concat(defsToAppend_1) }); + } + } + return document; + }; + FragmentRegistry.prototype.findFragmentSpreads = function (root) { + var spreads = Object.create(null); + graphql.visit(root, { + FragmentSpread: function (node) { + spreads[node.name.value] = node; + }, + }); + return spreads; + }; + return FragmentRegistry; +}()); + +exports.canonicalStringify = utilities.canonicalStringify; +exports.isReference = utilities.isReference; +exports.makeReference = utilities.makeReference; +exports.ApolloCache = ApolloCache; +exports.InMemoryCache = InMemoryCache; +exports.MissingFieldError = MissingFieldError; +exports.Policies = Policies; +exports.cacheSlot = cacheSlot; +exports.createFragmentRegistry = createFragmentRegistry; +exports.defaultDataIdFromObject = defaultDataIdFromObject; +exports.fieldNameFromStoreName = fieldNameFromStoreName; +exports.makeVar = makeVar; +//# sourceMappingURL=cache.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.map b/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.map new file mode 100644 index 0000000..1d96b60 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"cache.cjs","sources":["../utilities/caching/getMemoryInternals.js","core/cache.js","core/types/Cache.js","core/types/common.js","inmemory/helpers.js","inmemory/entityStore.js","inmemory/object-canon.js","inmemory/readFromStore.js","inmemory/reactiveVars.js","inmemory/key-extractor.js","inmemory/policies.js","inmemory/writeToStore.js","inmemory/inMemoryCache.js","inmemory/fragmentRegistry.js"],"sourcesContent":["import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { __assign, __rest } from \"tslib\";\nimport { wrap } from \"optimism\";\nimport { cacheSizes, getFragmentQueryDocument, } from \"../../utilities/index.js\";\nimport { WeakCache } from \"@wry/caches\";\nimport { getApolloCacheMemoryInternals } from \"../../utilities/caching/getMemoryInternals.js\";\nvar ApolloCache = /** @class */ (function () {\n function ApolloCache() {\n this.assumeImmutableResults = false;\n // Make sure we compute the same (===) fragment query document every\n // time we receive the same fragment in readFragment.\n this.getFragmentDoc = wrap(getFragmentQueryDocument, {\n max: cacheSizes[\"cache.fragmentQueryDocuments\"] ||\n 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n cache: WeakCache,\n });\n }\n // Transactional API\n // The batch method is intended to replace/subsume both performTransaction\n // and recordOptimisticTransaction, but performTransaction came first, so we\n // provide a default batch implementation that's just another way of calling\n // performTransaction. Subclasses of ApolloCache (such as InMemoryCache) can\n // override the batch method to do more interesting things with its options.\n ApolloCache.prototype.batch = function (options) {\n var _this = this;\n var optimisticId = typeof options.optimistic === \"string\" ? options.optimistic\n : options.optimistic === false ? null\n : void 0;\n var updateResult;\n this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId);\n return updateResult;\n };\n ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) {\n this.performTransaction(transaction, optimisticId);\n };\n // Optional API\n // Called once per input document, allowing the cache to make static changes\n // to the query, such as adding __typename fields.\n ApolloCache.prototype.transformDocument = function (document) {\n return document;\n };\n // Called before each ApolloLink request, allowing the cache to make dynamic\n // changes to the query, such as filling in missing fragment definitions.\n ApolloCache.prototype.transformForLink = function (document) {\n return document;\n };\n ApolloCache.prototype.identify = function (object) {\n return;\n };\n ApolloCache.prototype.gc = function () {\n return [];\n };\n ApolloCache.prototype.modify = function (options) {\n return false;\n };\n // DataProxy API\n ApolloCache.prototype.readQuery = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = !!options.optimistic; }\n return this.read(__assign(__assign({}, options), { rootId: options.id || \"ROOT_QUERY\", optimistic: optimistic }));\n };\n ApolloCache.prototype.readFragment = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = !!options.optimistic; }\n return this.read(__assign(__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic }));\n };\n ApolloCache.prototype.writeQuery = function (_a) {\n var id = _a.id, data = _a.data, options = __rest(_a, [\"id\", \"data\"]);\n return this.write(Object.assign(options, {\n dataId: id || \"ROOT_QUERY\",\n result: data,\n }));\n };\n ApolloCache.prototype.writeFragment = function (_a) {\n var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = __rest(_a, [\"id\", \"data\", \"fragment\", \"fragmentName\"]);\n return this.write(Object.assign(options, {\n query: this.getFragmentDoc(fragment, fragmentName),\n dataId: id,\n result: data,\n }));\n };\n ApolloCache.prototype.updateQuery = function (options, update) {\n return this.batch({\n update: function (cache) {\n var value = cache.readQuery(options);\n var data = update(value);\n if (data === void 0 || data === null)\n return value;\n cache.writeQuery(__assign(__assign({}, options), { data: data }));\n return data;\n },\n });\n };\n ApolloCache.prototype.updateFragment = function (options, update) {\n return this.batch({\n update: function (cache) {\n var value = cache.readFragment(options);\n var data = update(value);\n if (data === void 0 || data === null)\n return value;\n cache.writeFragment(__assign(__assign({}, options), { data: data }));\n return data;\n },\n });\n };\n return ApolloCache;\n}());\nexport { ApolloCache };\nif (globalThis.__DEV__ !== false) {\n ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals;\n}\n//# sourceMappingURL=cache.js.map","export var Cache;\n(function (Cache) {\n})(Cache || (Cache = {}));\n//# sourceMappingURL=Cache.js.map","import { __extends } from \"tslib\";\nvar MissingFieldError = /** @class */ (function (_super) {\n __extends(MissingFieldError, _super);\n function MissingFieldError(message, path, query, variables) {\n var _a;\n // 'Error' breaks prototype chain here\n var _this = _super.call(this, message) || this;\n _this.message = message;\n _this.path = path;\n _this.query = query;\n _this.variables = variables;\n if (Array.isArray(_this.path)) {\n _this.missing = _this.message;\n for (var i = _this.path.length - 1; i >= 0; --i) {\n _this.missing = (_a = {}, _a[_this.path[i]] = _this.missing, _a);\n }\n }\n else {\n _this.missing = _this.path;\n }\n // We're not using `Object.setPrototypeOf` here as it isn't fully supported\n // on Android (see issue #3236).\n _this.__proto__ = MissingFieldError.prototype;\n return _this;\n }\n return MissingFieldError;\n}(Error));\nexport { MissingFieldError };\n//# sourceMappingURL=common.js.map","import { isReference, isField, DeepMerger, resultKeyNameFromField, shouldInclude, isNonNullObject, compact, createFragmentMap, getFragmentDefinitions, isArray, } from \"../../utilities/index.js\";\nexport var hasOwn = Object.prototype.hasOwnProperty;\nexport function isNullish(value) {\n return value === null || value === void 0;\n}\nexport { isArray };\nexport function defaultDataIdFromObject(_a, context) {\n var __typename = _a.__typename, id = _a.id, _id = _a._id;\n if (typeof __typename === \"string\") {\n if (context) {\n context.keyObject =\n !isNullish(id) ? { id: id }\n : !isNullish(_id) ? { _id: _id }\n : void 0;\n }\n // If there is no object.id, fall back to object._id.\n if (isNullish(id) && !isNullish(_id)) {\n id = _id;\n }\n if (!isNullish(id)) {\n return \"\".concat(__typename, \":\").concat(typeof id === \"number\" || typeof id === \"string\" ?\n id\n : JSON.stringify(id));\n }\n }\n}\nvar defaultConfig = {\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n // Thanks to the shouldCanonizeResults helper, this should be the only line\n // you have to change to reenable canonization by default in the future.\n canonizeResults: false,\n};\nexport function normalizeConfig(config) {\n return compact(defaultConfig, config);\n}\nexport function shouldCanonizeResults(config) {\n var value = config.canonizeResults;\n return value === void 0 ? defaultConfig.canonizeResults : value;\n}\nexport function getTypenameFromStoreObject(store, objectOrReference) {\n return isReference(objectOrReference) ?\n store.get(objectOrReference.__ref, \"__typename\")\n : objectOrReference && objectOrReference.__typename;\n}\nexport var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;\nexport function fieldNameFromStoreName(storeFieldName) {\n var match = storeFieldName.match(TypeOrFieldNameRegExp);\n return match ? match[0] : storeFieldName;\n}\nexport function selectionSetMatchesResult(selectionSet, result, variables) {\n if (isNonNullObject(result)) {\n return isArray(result) ?\n result.every(function (item) {\n return selectionSetMatchesResult(selectionSet, item, variables);\n })\n : selectionSet.selections.every(function (field) {\n if (isField(field) && shouldInclude(field, variables)) {\n var key = resultKeyNameFromField(field);\n return (hasOwn.call(result, key) &&\n (!field.selectionSet ||\n selectionSetMatchesResult(field.selectionSet, result[key], variables)));\n }\n // If the selection has been skipped with @skip(true) or\n // @include(false), it should not count against the matching. If\n // the selection is not a field, it must be a fragment (inline or\n // named). We will determine if selectionSetMatchesResult for that\n // fragment when we get to it, so for now we return true.\n return true;\n });\n }\n return false;\n}\nexport function storeValueIsStoreObject(value) {\n return isNonNullObject(value) && !isReference(value) && !isArray(value);\n}\nexport function makeProcessedFieldsMerger() {\n return new DeepMerger();\n}\nexport function extractFragmentContext(document, fragments) {\n // FragmentMap consisting only of fragments defined directly in document, not\n // including other fragments registered in the FragmentRegistry.\n var fragmentMap = createFragmentMap(getFragmentDefinitions(document));\n return {\n fragmentMap: fragmentMap,\n lookupFragment: function (name) {\n var def = fragmentMap[name];\n if (!def && fragments) {\n def = fragments.lookup(name);\n }\n return def || null;\n },\n };\n}\n//# sourceMappingURL=helpers.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { dep } from \"optimism\";\nimport { equal } from \"@wry/equality\";\nimport { Trie } from \"@wry/trie\";\nimport { isReference, makeReference, DeepMerger, maybeDeepFreeze, canUseWeakMap, isNonNullObject, } from \"../../utilities/index.js\";\nimport { hasOwn, fieldNameFromStoreName } from \"./helpers.js\";\nvar DELETE = Object.create(null);\nvar delModifier = function () { return DELETE; };\nvar INVALIDATE = Object.create(null);\nvar EntityStore = /** @class */ (function () {\n function EntityStore(policies, group) {\n var _this = this;\n this.policies = policies;\n this.group = group;\n this.data = Object.create(null);\n // Maps root entity IDs to the number of times they have been retained, minus\n // the number of times they have been released. Retained entities keep other\n // entities they reference (even indirectly) from being garbage collected.\n this.rootIds = Object.create(null);\n // Lazily tracks { __ref: } strings contained by this.data[dataId].\n this.refs = Object.create(null);\n // Bound function that can be passed around to provide easy access to fields\n // of Reference objects as well as ordinary objects.\n this.getFieldValue = function (objectOrReference, storeFieldName) {\n return maybeDeepFreeze(isReference(objectOrReference) ?\n _this.get(objectOrReference.__ref, storeFieldName)\n : objectOrReference && objectOrReference[storeFieldName]);\n };\n // Returns true for non-normalized StoreObjects and non-dangling\n // References, indicating that readField(name, objOrRef) has a chance of\n // working. Useful for filtering out dangling references from lists.\n this.canRead = function (objOrRef) {\n return isReference(objOrRef) ?\n _this.has(objOrRef.__ref)\n : typeof objOrRef === \"object\";\n };\n // Bound function that converts an id or an object with a __typename and\n // primary key fields to a Reference object. If called with a Reference object,\n // that same Reference object is returned. Pass true for mergeIntoStore to persist\n // an object into the store.\n this.toReference = function (objOrIdOrRef, mergeIntoStore) {\n if (typeof objOrIdOrRef === \"string\") {\n return makeReference(objOrIdOrRef);\n }\n if (isReference(objOrIdOrRef)) {\n return objOrIdOrRef;\n }\n var id = _this.policies.identify(objOrIdOrRef)[0];\n if (id) {\n var ref = makeReference(id);\n if (mergeIntoStore) {\n _this.merge(id, objOrIdOrRef);\n }\n return ref;\n }\n };\n }\n // Although the EntityStore class is abstract, it contains concrete\n // implementations of the various NormalizedCache interface methods that\n // are inherited by the Root and Layer subclasses.\n EntityStore.prototype.toObject = function () {\n return __assign({}, this.data);\n };\n EntityStore.prototype.has = function (dataId) {\n return this.lookup(dataId, true) !== void 0;\n };\n EntityStore.prototype.get = function (dataId, fieldName) {\n this.group.depend(dataId, fieldName);\n if (hasOwn.call(this.data, dataId)) {\n var storeObject = this.data[dataId];\n if (storeObject && hasOwn.call(storeObject, fieldName)) {\n return storeObject[fieldName];\n }\n }\n if (fieldName === \"__typename\" &&\n hasOwn.call(this.policies.rootTypenamesById, dataId)) {\n return this.policies.rootTypenamesById[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.get(dataId, fieldName);\n }\n };\n EntityStore.prototype.lookup = function (dataId, dependOnExistence) {\n // The has method (above) calls lookup with dependOnExistence = true, so\n // that it can later be invalidated when we add or remove a StoreObject for\n // this dataId. Any consumer who cares about the contents of the StoreObject\n // should not rely on this dependency, since the contents could change\n // without the object being added or removed.\n if (dependOnExistence)\n this.group.depend(dataId, \"__exists\");\n if (hasOwn.call(this.data, dataId)) {\n return this.data[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.lookup(dataId, dependOnExistence);\n }\n if (this.policies.rootTypenamesById[dataId]) {\n return Object.create(null);\n }\n };\n EntityStore.prototype.merge = function (older, newer) {\n var _this = this;\n var dataId;\n // Convert unexpected references to ID strings.\n if (isReference(older))\n older = older.__ref;\n if (isReference(newer))\n newer = newer.__ref;\n var existing = typeof older === \"string\" ? this.lookup((dataId = older)) : older;\n var incoming = typeof newer === \"string\" ? this.lookup((dataId = newer)) : newer;\n // If newer was a string ID, but that ID was not defined in this store,\n // then there are no fields to be merged, so we're done.\n if (!incoming)\n return;\n invariant(typeof dataId === \"string\", 1);\n var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);\n // Even if merged === existing, existing may have come from a lower\n // layer, so we always need to set this.data[dataId] on this level.\n this.data[dataId] = merged;\n if (merged !== existing) {\n delete this.refs[dataId];\n if (this.group.caching) {\n var fieldsToDirty_1 = Object.create(null);\n // If we added a new StoreObject where there was previously none, dirty\n // anything that depended on the existence of this dataId, such as the\n // EntityStore#has method.\n if (!existing)\n fieldsToDirty_1.__exists = 1;\n // Now invalidate dependents who called getFieldValue for any fields\n // that are changing as a result of this merge.\n Object.keys(incoming).forEach(function (storeFieldName) {\n if (!existing ||\n existing[storeFieldName] !== merged[storeFieldName]) {\n // Always dirty the full storeFieldName, which may include\n // serialized arguments following the fieldName prefix.\n fieldsToDirty_1[storeFieldName] = 1;\n // Also dirty fieldNameFromStoreName(storeFieldName) if it's\n // different from storeFieldName and this field does not have\n // keyArgs configured, because that means the cache can't make\n // any assumptions about how field values with the same field\n // name but different arguments might be interrelated, so it\n // must err on the side of invalidating all field values that\n // share the same short fieldName, regardless of arguments.\n var fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName &&\n !_this.policies.hasKeyArgs(merged.__typename, fieldName)) {\n fieldsToDirty_1[fieldName] = 1;\n }\n // If merged[storeFieldName] has become undefined, and this is the\n // Root layer, actually delete the property from the merged object,\n // which is guaranteed to have been created fresh in this method.\n if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) {\n delete merged[storeFieldName];\n }\n }\n });\n if (fieldsToDirty_1.__typename &&\n !(existing && existing.__typename) &&\n // Since we return default root __typename strings\n // automatically from store.get, we don't need to dirty the\n // ROOT_QUERY.__typename field if merged.__typename is equal\n // to the default string (usually \"Query\").\n this.policies.rootTypenamesById[dataId] === merged.__typename) {\n delete fieldsToDirty_1.__typename;\n }\n Object.keys(fieldsToDirty_1).forEach(function (fieldName) {\n return _this.group.dirty(dataId, fieldName);\n });\n }\n }\n };\n EntityStore.prototype.modify = function (dataId, fields) {\n var _this = this;\n var storeObject = this.lookup(dataId);\n if (storeObject) {\n var changedFields_1 = Object.create(null);\n var needToMerge_1 = false;\n var allDeleted_1 = true;\n var sharedDetails_1 = {\n DELETE: DELETE,\n INVALIDATE: INVALIDATE,\n isReference: isReference,\n toReference: this.toReference,\n canRead: this.canRead,\n readField: function (fieldNameOrOptions, from) {\n return _this.policies.readField(typeof fieldNameOrOptions === \"string\" ?\n {\n fieldName: fieldNameOrOptions,\n from: from || makeReference(dataId),\n }\n : fieldNameOrOptions, { store: _this });\n },\n };\n Object.keys(storeObject).forEach(function (storeFieldName) {\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var fieldValue = storeObject[storeFieldName];\n if (fieldValue === void 0)\n return;\n var modify = typeof fields === \"function\" ? fields : (fields[storeFieldName] || fields[fieldName]);\n if (modify) {\n var newValue = modify === delModifier ? DELETE : (modify(maybeDeepFreeze(fieldValue), __assign(__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) })));\n if (newValue === INVALIDATE) {\n _this.group.dirty(dataId, storeFieldName);\n }\n else {\n if (newValue === DELETE)\n newValue = void 0;\n if (newValue !== fieldValue) {\n changedFields_1[storeFieldName] = newValue;\n needToMerge_1 = true;\n fieldValue = newValue;\n if (globalThis.__DEV__ !== false) {\n var checkReference = function (ref) {\n if (_this.lookup(ref.__ref) === undefined) {\n globalThis.__DEV__ !== false && invariant.warn(2, ref);\n return true;\n }\n };\n if (isReference(newValue)) {\n checkReference(newValue);\n }\n else if (Array.isArray(newValue)) {\n // Warn about writing \"mixed\" arrays of Reference and non-Reference objects\n var seenReference = false;\n var someNonReference = void 0;\n for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) {\n var value = newValue_1[_i];\n if (isReference(value)) {\n seenReference = true;\n if (checkReference(value))\n break;\n }\n else {\n // Do not warn on primitive values, since those could never be represented\n // by a reference. This is a valid (albeit uncommon) use case.\n if (typeof value === \"object\" && !!value) {\n var id = _this.policies.identify(value)[0];\n // check if object could even be referenced, otherwise we are not interested in it for this warning\n if (id) {\n someNonReference = value;\n }\n }\n }\n if (seenReference && someNonReference !== undefined) {\n globalThis.__DEV__ !== false && invariant.warn(3, someNonReference);\n break;\n }\n }\n }\n }\n }\n }\n }\n if (fieldValue !== void 0) {\n allDeleted_1 = false;\n }\n });\n if (needToMerge_1) {\n this.merge(dataId, changedFields_1);\n if (allDeleted_1) {\n if (this instanceof Layer) {\n this.data[dataId] = void 0;\n }\n else {\n delete this.data[dataId];\n }\n this.group.dirty(dataId, \"__exists\");\n }\n return true;\n }\n }\n return false;\n };\n // If called with only one argument, removes the entire entity\n // identified by dataId. If called with a fieldName as well, removes all\n // fields of that entity whose names match fieldName according to the\n // fieldNameFromStoreName helper function. If called with a fieldName\n // and variables, removes all fields of that entity whose names match fieldName\n // and whose arguments when cached exactly match the variables passed.\n EntityStore.prototype.delete = function (dataId, fieldName, args) {\n var _a;\n var storeObject = this.lookup(dataId);\n if (storeObject) {\n var typename = this.getFieldValue(storeObject, \"__typename\");\n var storeFieldName = fieldName && args ?\n this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args })\n : fieldName;\n return this.modify(dataId, storeFieldName ? (_a = {},\n _a[storeFieldName] = delModifier,\n _a) : delModifier);\n }\n return false;\n };\n EntityStore.prototype.evict = function (options, limit) {\n var evicted = false;\n if (options.id) {\n if (hasOwn.call(this.data, options.id)) {\n evicted = this.delete(options.id, options.fieldName, options.args);\n }\n if (this instanceof Layer && this !== limit) {\n evicted = this.parent.evict(options, limit) || evicted;\n }\n // Always invalidate the field to trigger rereading of watched\n // queries, even if no cache data was modified by the eviction,\n // because queries may depend on computed fields with custom read\n // functions, whose values are not stored in the EntityStore.\n if (options.fieldName || evicted) {\n this.group.dirty(options.id, options.fieldName || \"__exists\");\n }\n }\n return evicted;\n };\n EntityStore.prototype.clear = function () {\n this.replace(null);\n };\n EntityStore.prototype.extract = function () {\n var _this = this;\n var obj = this.toObject();\n var extraRootIds = [];\n this.getRootIdSet().forEach(function (id) {\n if (!hasOwn.call(_this.policies.rootTypenamesById, id)) {\n extraRootIds.push(id);\n }\n });\n if (extraRootIds.length) {\n obj.__META = { extraRootIds: extraRootIds.sort() };\n }\n return obj;\n };\n EntityStore.prototype.replace = function (newData) {\n var _this = this;\n Object.keys(this.data).forEach(function (dataId) {\n if (!(newData && hasOwn.call(newData, dataId))) {\n _this.delete(dataId);\n }\n });\n if (newData) {\n var __META = newData.__META, rest_1 = __rest(newData, [\"__META\"]);\n Object.keys(rest_1).forEach(function (dataId) {\n _this.merge(dataId, rest_1[dataId]);\n });\n if (__META) {\n __META.extraRootIds.forEach(this.retain, this);\n }\n }\n };\n EntityStore.prototype.retain = function (rootId) {\n return (this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1);\n };\n EntityStore.prototype.release = function (rootId) {\n if (this.rootIds[rootId] > 0) {\n var count = --this.rootIds[rootId];\n if (!count)\n delete this.rootIds[rootId];\n return count;\n }\n return 0;\n };\n // Return a Set of all the ID strings that have been retained by\n // this layer/root *and* any layers/roots beneath it.\n EntityStore.prototype.getRootIdSet = function (ids) {\n if (ids === void 0) { ids = new Set(); }\n Object.keys(this.rootIds).forEach(ids.add, ids);\n if (this instanceof Layer) {\n this.parent.getRootIdSet(ids);\n }\n else {\n // Official singleton IDs like ROOT_QUERY and ROOT_MUTATION are\n // always considered roots for garbage collection, regardless of\n // their retainment counts in this.rootIds.\n Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids);\n }\n return ids;\n };\n // The goal of garbage collection is to remove IDs from the Root layer of the\n // store that are no longer reachable starting from any IDs that have been\n // explicitly retained (see retain and release, above). Returns an array of\n // dataId strings that were removed from the store.\n EntityStore.prototype.gc = function () {\n var _this = this;\n var ids = this.getRootIdSet();\n var snapshot = this.toObject();\n ids.forEach(function (id) {\n if (hasOwn.call(snapshot, id)) {\n // Because we are iterating over an ECMAScript Set, the IDs we add here\n // will be visited in later iterations of the forEach loop only if they\n // were not previously contained by the Set.\n Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids);\n // By removing IDs from the snapshot object here, we protect them from\n // getting removed from the root store layer below.\n delete snapshot[id];\n }\n });\n var idsToRemove = Object.keys(snapshot);\n if (idsToRemove.length) {\n var root_1 = this;\n while (root_1 instanceof Layer)\n root_1 = root_1.parent;\n idsToRemove.forEach(function (id) { return root_1.delete(id); });\n }\n return idsToRemove;\n };\n EntityStore.prototype.findChildRefIds = function (dataId) {\n if (!hasOwn.call(this.refs, dataId)) {\n var found_1 = (this.refs[dataId] = Object.create(null));\n var root = this.data[dataId];\n if (!root)\n return found_1;\n var workSet_1 = new Set([root]);\n // Within the store, only arrays and objects can contain child entity\n // references, so we can prune the traversal using this predicate:\n workSet_1.forEach(function (obj) {\n if (isReference(obj)) {\n found_1[obj.__ref] = true;\n // In rare cases, a { __ref } Reference object may have other fields.\n // This often indicates a mismerging of References with StoreObjects,\n // but garbage collection should not be fooled by a stray __ref\n // property in a StoreObject (ignoring all the other fields just\n // because the StoreObject looks like a Reference). To avoid this\n // premature termination of findChildRefIds recursion, we fall through\n // to the code below, which will handle any other properties of obj.\n }\n if (isNonNullObject(obj)) {\n Object.keys(obj).forEach(function (key) {\n var child = obj[key];\n // No need to add primitive values to the workSet, since they cannot\n // contain reference objects.\n if (isNonNullObject(child)) {\n workSet_1.add(child);\n }\n });\n }\n });\n }\n return this.refs[dataId];\n };\n EntityStore.prototype.makeCacheKey = function () {\n return this.group.keyMaker.lookupArray(arguments);\n };\n return EntityStore;\n}());\nexport { EntityStore };\n// A single CacheGroup represents a set of one or more EntityStore objects,\n// typically the Root store in a CacheGroup by itself, and all active Layer\n// stores in a group together. A single EntityStore object belongs to only\n// one CacheGroup, store.group. The CacheGroup is responsible for tracking\n// dependencies, so store.group is helpful for generating unique keys for\n// cached results that need to be invalidated when/if those dependencies\n// change. If we used the EntityStore objects themselves as cache keys (that\n// is, store rather than store.group), the cache would become unnecessarily\n// fragmented by all the different Layer objects. Instead, the CacheGroup\n// approach allows all optimistic Layer objects in the same linked list to\n// belong to one CacheGroup, with the non-optimistic Root object belonging\n// to another CacheGroup, allowing resultCaching dependencies to be tracked\n// separately for optimistic and non-optimistic entity data.\nvar CacheGroup = /** @class */ (function () {\n function CacheGroup(caching, parent) {\n if (parent === void 0) { parent = null; }\n this.caching = caching;\n this.parent = parent;\n this.d = null;\n this.resetCaching();\n }\n CacheGroup.prototype.resetCaching = function () {\n this.d = this.caching ? dep() : null;\n this.keyMaker = new Trie(canUseWeakMap);\n };\n CacheGroup.prototype.depend = function (dataId, storeFieldName) {\n if (this.d) {\n this.d(makeDepKey(dataId, storeFieldName));\n var fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName) {\n // Fields with arguments that contribute extra identifying\n // information to the fieldName (thus forming the storeFieldName)\n // depend not only on the full storeFieldName but also on the\n // short fieldName, so the field can be invalidated using either\n // level of specificity.\n this.d(makeDepKey(dataId, fieldName));\n }\n if (this.parent) {\n this.parent.depend(dataId, storeFieldName);\n }\n }\n };\n CacheGroup.prototype.dirty = function (dataId, storeFieldName) {\n if (this.d) {\n this.d.dirty(makeDepKey(dataId, storeFieldName), \n // When storeFieldName === \"__exists\", that means the entity identified\n // by dataId has either disappeared from the cache or was newly added,\n // so the result caching system would do well to \"forget everything it\n // knows\" about that object. To achieve that kind of invalidation, we\n // not only dirty the associated result cache entry, but also remove it\n // completely from the dependency graph. For the optimism implementation\n // details, see https://github.com/benjamn/optimism/pull/195.\n storeFieldName === \"__exists\" ? \"forget\" : \"setDirty\");\n }\n };\n return CacheGroup;\n}());\nfunction makeDepKey(dataId, storeFieldName) {\n // Since field names cannot have '#' characters in them, this method\n // of joining the field name and the ID should be unambiguous, and much\n // cheaper than JSON.stringify([dataId, fieldName]).\n return storeFieldName + \"#\" + dataId;\n}\nexport function maybeDependOnExistenceOfEntity(store, entityId) {\n if (supportsResultCaching(store)) {\n // We use this pseudo-field __exists elsewhere in the EntityStore code to\n // represent changes in the existence of the entity object identified by\n // entityId. This dependency gets reliably dirtied whenever an object with\n // this ID is deleted (or newly created) within this group, so any result\n // cache entries (for example, StoreReader#executeSelectionSet results) that\n // depend on __exists for this entityId will get dirtied as well, leading to\n // the eventual recomputation (instead of reuse) of those result objects the\n // next time someone reads them from the cache.\n store.group.depend(entityId, \"__exists\");\n }\n}\n(function (EntityStore) {\n // Refer to this class as EntityStore.Root outside this namespace.\n var Root = /** @class */ (function (_super) {\n __extends(Root, _super);\n function Root(_a) {\n var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed;\n var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this;\n _this.stump = new Stump(_this);\n _this.storageTrie = new Trie(canUseWeakMap);\n if (seed)\n _this.replace(seed);\n return _this;\n }\n Root.prototype.addLayer = function (layerId, replay) {\n // Adding an optimistic Layer on top of the Root actually adds the Layer\n // on top of the Stump, so the Stump always comes between the Root and\n // any Layer objects that we've added.\n return this.stump.addLayer(layerId, replay);\n };\n Root.prototype.removeLayer = function () {\n // Never remove the root layer.\n return this;\n };\n Root.prototype.getStorage = function () {\n return this.storageTrie.lookupArray(arguments);\n };\n return Root;\n }(EntityStore));\n EntityStore.Root = Root;\n})(EntityStore || (EntityStore = {}));\n// Not exported, since all Layer instances are created by the addLayer method\n// of the EntityStore.Root class.\nvar Layer = /** @class */ (function (_super) {\n __extends(Layer, _super);\n function Layer(id, parent, replay, group) {\n var _this = _super.call(this, parent.policies, group) || this;\n _this.id = id;\n _this.parent = parent;\n _this.replay = replay;\n _this.group = group;\n replay(_this);\n return _this;\n }\n Layer.prototype.addLayer = function (layerId, replay) {\n return new Layer(layerId, this, replay, this.group);\n };\n Layer.prototype.removeLayer = function (layerId) {\n var _this = this;\n // Remove all instances of the given id, not just the first one.\n var parent = this.parent.removeLayer(layerId);\n if (layerId === this.id) {\n if (this.group.caching) {\n // Dirty every ID we're removing. Technically we might be able to avoid\n // dirtying fields that have values in higher layers, but we don't have\n // easy access to higher layers here, and we're about to recreate those\n // layers anyway (see parent.addLayer below).\n Object.keys(this.data).forEach(function (dataId) {\n var ownStoreObject = _this.data[dataId];\n var parentStoreObject = parent[\"lookup\"](dataId);\n if (!parentStoreObject) {\n // The StoreObject identified by dataId was defined in this layer\n // but will be undefined in the parent layer, so we can delete the\n // whole entity using this.delete(dataId). Since we're about to\n // throw this layer away, the only goal of this deletion is to dirty\n // the removed fields.\n _this.delete(dataId);\n }\n else if (!ownStoreObject) {\n // This layer had an entry for dataId but it was undefined, which\n // means the entity was deleted in this layer, and it's about to\n // become undeleted when we remove this layer, so we need to dirty\n // all fields that are about to be reexposed.\n _this.group.dirty(dataId, \"__exists\");\n Object.keys(parentStoreObject).forEach(function (storeFieldName) {\n _this.group.dirty(dataId, storeFieldName);\n });\n }\n else if (ownStoreObject !== parentStoreObject) {\n // If ownStoreObject is not exactly the same as parentStoreObject,\n // dirty any fields whose values will change as a result of this\n // removal.\n Object.keys(ownStoreObject).forEach(function (storeFieldName) {\n if (!equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) {\n _this.group.dirty(dataId, storeFieldName);\n }\n });\n }\n });\n }\n return parent;\n }\n // No changes are necessary if the parent chain remains identical.\n if (parent === this.parent)\n return this;\n // Recreate this layer on top of the new parent.\n return parent.addLayer(this.id, this.replay);\n };\n Layer.prototype.toObject = function () {\n return __assign(__assign({}, this.parent.toObject()), this.data);\n };\n Layer.prototype.findChildRefIds = function (dataId) {\n var fromParent = this.parent.findChildRefIds(dataId);\n return hasOwn.call(this.data, dataId) ? __assign(__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent;\n };\n Layer.prototype.getStorage = function () {\n var p = this.parent;\n while (p.parent)\n p = p.parent;\n return p.getStorage.apply(p, \n // @ts-expect-error\n arguments);\n };\n return Layer;\n}(EntityStore));\n// Represents a Layer permanently installed just above the Root, which allows\n// reading optimistically (and registering optimistic dependencies) even when\n// no optimistic layers are currently active. The stump.group CacheGroup object\n// is shared by any/all Layer objects added on top of the Stump.\nvar Stump = /** @class */ (function (_super) {\n __extends(Stump, _super);\n function Stump(root) {\n return _super.call(this, \"EntityStore.Stump\", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this;\n }\n Stump.prototype.removeLayer = function () {\n // Never remove the Stump layer.\n return this;\n };\n Stump.prototype.merge = function (older, newer) {\n // We never want to write any data into the Stump, so we forward any merge\n // calls to the Root instead. Another option here would be to throw an\n // exception, but the toReference(object, true) function can sometimes\n // trigger Stump writes (which used to be Root writes, before the Stump\n // concept was introduced).\n return this.parent.merge(older, newer);\n };\n return Stump;\n}(Layer));\nfunction storeObjectReconciler(existingObject, incomingObject, property) {\n var existingValue = existingObject[property];\n var incomingValue = incomingObject[property];\n // Wherever there is a key collision, prefer the incoming value, unless\n // it is deeply equal to the existing value. It's worth checking deep\n // equality here (even though blindly returning incoming would be\n // logically correct) because preserving the referential identity of\n // existing data can prevent needless rereading and rerendering.\n return equal(existingValue, incomingValue) ? existingValue : incomingValue;\n}\nexport function supportsResultCaching(store) {\n // When result caching is disabled, store.depend will be null.\n return !!(store instanceof EntityStore && store.group.caching);\n}\n//# sourceMappingURL=entityStore.js.map","import { __assign } from \"tslib\";\nimport { Trie } from \"@wry/trie\";\nimport { canUseWeakMap, canUseWeakSet, isNonNullObject as isObjectOrArray, } from \"../../utilities/index.js\";\nimport { isArray } from \"./helpers.js\";\nfunction shallowCopy(value) {\n if (isObjectOrArray(value)) {\n return isArray(value) ?\n value.slice(0)\n : __assign({ __proto__: Object.getPrototypeOf(value) }, value);\n }\n return value;\n}\n// When programmers talk about the \"canonical form\" of an object, they\n// usually have the following meaning in mind, which I've copied from\n// https://en.wiktionary.org/wiki/canonical_form:\n//\n// 1. A standard or normal presentation of a mathematical entity [or\n// object]. A canonical form is an element of a set of representatives\n// of equivalence classes of forms such that there is a function or\n// procedure which projects every element of each equivalence class\n// onto that one element, the canonical form of that equivalence\n// class. The canonical form is expected to be simpler than the rest of\n// the forms in some way.\n//\n// That's a long-winded way of saying any two objects that have the same\n// canonical form may be considered equivalent, even if they are !==,\n// which usually means the objects are structurally equivalent (deeply\n// equal), but don't necessarily use the same memory.\n//\n// Like a literary or musical canon, this ObjectCanon class represents a\n// collection of unique canonical items (JavaScript objects), with the\n// important property that canon.admit(a) === canon.admit(b) if a and b\n// are deeply equal to each other. In terms of the definition above, the\n// canon.admit method is the \"function or procedure which projects every\"\n// object \"onto that one element, the canonical form.\"\n//\n// In the worst case, the canonicalization process may involve looking at\n// every property in the provided object tree, so it takes the same order\n// of time as deep equality checking. Fortunately, already-canonicalized\n// objects are returned immediately from canon.admit, so the presence of\n// canonical subtrees tends to speed up canonicalization.\n//\n// Since consumers of canonical objects can check for deep equality in\n// constant time, canonicalizing cache results can massively improve the\n// performance of application code that skips re-rendering unchanged\n// results, such as \"pure\" UI components in a framework like React.\n//\n// Of course, since canonical objects may be shared widely between\n// unrelated consumers, it's important to think of them as immutable, even\n// though they are not actually frozen with Object.freeze in production,\n// due to the extra performance overhead that comes with frozen objects.\n//\n// Custom scalar objects whose internal class name is neither Array nor\n// Object can be included safely in the admitted tree, but they will not\n// be replaced with a canonical version (to put it another way, they are\n// assumed to be canonical already).\n//\n// If we ignore custom objects, no detection of cycles or repeated object\n// references is currently required by the StoreReader class, since\n// GraphQL result objects are JSON-serializable trees (and thus contain\n// neither cycles nor repeated subtrees), so we can avoid the complexity\n// of keeping track of objects we've already seen during the recursion of\n// the admit method.\n//\n// In the future, we may consider adding additional cases to the switch\n// statement to handle other common object types, such as \"[object Date]\"\n// objects, as needed.\nvar ObjectCanon = /** @class */ (function () {\n function ObjectCanon() {\n // Set of all canonical objects this ObjectCanon has admitted, allowing\n // canon.admit to return previously-canonicalized objects immediately.\n this.known = new (canUseWeakSet ? WeakSet : Set)();\n // Efficient storage/lookup structure for canonical objects.\n this.pool = new Trie(canUseWeakMap);\n // Make the ObjectCanon assume this value has already been\n // canonicalized.\n this.passes = new WeakMap();\n // Arrays that contain the same elements in a different order can share\n // the same SortedKeysInfo object, to save memory.\n this.keysByJSON = new Map();\n // This has to come last because it depends on keysByJSON.\n this.empty = this.admit({});\n }\n ObjectCanon.prototype.isKnown = function (value) {\n return isObjectOrArray(value) && this.known.has(value);\n };\n ObjectCanon.prototype.pass = function (value) {\n if (isObjectOrArray(value)) {\n var copy = shallowCopy(value);\n this.passes.set(copy, value);\n return copy;\n }\n return value;\n };\n ObjectCanon.prototype.admit = function (value) {\n var _this = this;\n if (isObjectOrArray(value)) {\n var original = this.passes.get(value);\n if (original)\n return original;\n var proto = Object.getPrototypeOf(value);\n switch (proto) {\n case Array.prototype: {\n if (this.known.has(value))\n return value;\n var array = value.map(this.admit, this);\n // Arrays are looked up in the Trie using their recursively\n // canonicalized elements, and the known version of the array is\n // preserved as node.array.\n var node = this.pool.lookupArray(array);\n if (!node.array) {\n this.known.add((node.array = array));\n // Since canonical arrays may be shared widely between\n // unrelated consumers, it's important to regard them as\n // immutable, even if they are not frozen in production.\n if (globalThis.__DEV__ !== false) {\n Object.freeze(array);\n }\n }\n return node.array;\n }\n case null:\n case Object.prototype: {\n if (this.known.has(value))\n return value;\n var proto_1 = Object.getPrototypeOf(value);\n var array_1 = [proto_1];\n var keys = this.sortedKeys(value);\n array_1.push(keys.json);\n var firstValueIndex_1 = array_1.length;\n keys.sorted.forEach(function (key) {\n array_1.push(_this.admit(value[key]));\n });\n // Objects are looked up in the Trie by their prototype (which\n // is *not* recursively canonicalized), followed by a JSON\n // representation of their (sorted) keys, followed by the\n // sequence of recursively canonicalized values corresponding to\n // those keys. To keep the final results unambiguous with other\n // sequences (such as arrays that just happen to contain [proto,\n // keys.json, value1, value2, ...]), the known version of the\n // object is stored as node.object.\n var node = this.pool.lookupArray(array_1);\n if (!node.object) {\n var obj_1 = (node.object = Object.create(proto_1));\n this.known.add(obj_1);\n keys.sorted.forEach(function (key, i) {\n obj_1[key] = array_1[firstValueIndex_1 + i];\n });\n // Since canonical objects may be shared widely between\n // unrelated consumers, it's important to regard them as\n // immutable, even if they are not frozen in production.\n if (globalThis.__DEV__ !== false) {\n Object.freeze(obj_1);\n }\n }\n return node.object;\n }\n }\n }\n return value;\n };\n // It's worthwhile to cache the sorting of arrays of strings, since the\n // same initial unsorted arrays tend to be encountered many times.\n // Fortunately, we can reuse the Trie machinery to look up the sorted\n // arrays in linear time (which is faster than sorting large arrays).\n ObjectCanon.prototype.sortedKeys = function (obj) {\n var keys = Object.keys(obj);\n var node = this.pool.lookupArray(keys);\n if (!node.keys) {\n keys.sort();\n var json = JSON.stringify(keys);\n if (!(node.keys = this.keysByJSON.get(json))) {\n this.keysByJSON.set(json, (node.keys = { sorted: keys, json: json }));\n }\n }\n return node.keys;\n };\n return ObjectCanon;\n}());\nexport { ObjectCanon };\n//# sourceMappingURL=object-canon.js.map","import { __assign } from \"tslib\";\nimport { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\nimport { Kind } from \"graphql\";\nimport { wrap } from \"optimism\";\nimport { isField, resultKeyNameFromField, isReference, makeReference, shouldInclude, addTypenameToDocument, getDefaultValues, getMainDefinition, getQueryDefinition, getFragmentFromSelection, maybeDeepFreeze, mergeDeepArray, DeepMerger, isNonNullObject, canUseWeakMap, compact, canonicalStringify, cacheSizes, } from \"../../utilities/index.js\";\nimport { maybeDependOnExistenceOfEntity, supportsResultCaching, } from \"./entityStore.js\";\nimport { isArray, extractFragmentContext, getTypenameFromStoreObject, shouldCanonizeResults, } from \"./helpers.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport { ObjectCanon } from \"./object-canon.js\";\nfunction execSelectionSetKeyArgs(options) {\n return [\n options.selectionSet,\n options.objectOrReference,\n options.context,\n // We split out this property so we can pass different values\n // independently without modifying options.context itself.\n options.context.canonizeResults,\n ];\n}\nvar StoreReader = /** @class */ (function () {\n function StoreReader(config) {\n var _this = this;\n this.knownResults = new (canUseWeakMap ? WeakMap : Map)();\n this.config = compact(config, {\n addTypename: config.addTypename !== false,\n canonizeResults: shouldCanonizeResults(config),\n });\n this.canon = config.canon || new ObjectCanon();\n // memoized functions in this class will be \"garbage-collected\"\n // by recreating the whole `StoreReader` in\n // `InMemoryCache.resetResultsCache`\n // (triggered from `InMemoryCache.gc` with `resetResultCache: true`)\n this.executeSelectionSet = wrap(function (options) {\n var _a;\n var canonizeResults = options.context.canonizeResults;\n var peekArgs = execSelectionSetKeyArgs(options);\n // Negate this boolean option so we can find out if we've already read\n // this result using the other boolean value.\n peekArgs[3] = !canonizeResults;\n var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs);\n if (other) {\n if (canonizeResults) {\n return __assign(__assign({}, other), { \n // If we previously read this result without canonizing it, we can\n // reuse that result simply by canonizing it now.\n result: _this.canon.admit(other.result) });\n }\n // If we previously read this result with canonization enabled, we can\n // return that canonized result as-is.\n return other;\n }\n maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);\n // Finally, if we didn't find any useful previous results, run the real\n // execSelectionSetImpl method with the given options.\n return _this.execSelectionSetImpl(options);\n }, {\n max: this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.executeSelectionSet\"] ||\n 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n keyArgs: execSelectionSetKeyArgs,\n // Note that the parameters of makeCacheKey are determined by the\n // array returned by keyArgs.\n makeCacheKey: function (selectionSet, parent, context, canonizeResults) {\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(selectionSet, isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults);\n }\n },\n });\n this.executeSubSelectedArray = wrap(function (options) {\n maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref);\n return _this.execSubSelectedArrayImpl(options);\n }, {\n max: this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.executeSubSelectedArray\"] ||\n 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n makeCacheKey: function (_a) {\n var field = _a.field, array = _a.array, context = _a.context;\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(field, array, context.varString);\n }\n },\n });\n }\n StoreReader.prototype.resetCanon = function () {\n this.canon = new ObjectCanon();\n };\n /**\n * Given a store and a query, return as much of the result as possible and\n * identify if any data was missing from the store.\n */\n StoreReader.prototype.diffQueryAgainstStore = function (_a) {\n var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? \"ROOT_QUERY\" : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d;\n var policies = this.config.cache.policies;\n variables = __assign(__assign({}, getDefaultValues(getQueryDefinition(query))), variables);\n var rootRef = makeReference(rootId);\n var execResult = this.executeSelectionSet({\n selectionSet: getMainDefinition(query).selectionSet,\n objectOrReference: rootRef,\n enclosingRef: rootRef,\n context: __assign({ store: store, query: query, policies: policies, variables: variables, varString: canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)),\n });\n var missing;\n if (execResult.missing) {\n // For backwards compatibility we still report an array of\n // MissingFieldError objects, even though there will only ever be at most\n // one of them, now that all missing field error messages are grouped\n // together in the execResult.missing tree.\n missing = [\n new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables),\n ];\n if (!returnPartialData) {\n throw missing[0];\n }\n }\n return {\n result: execResult.result,\n complete: !missing,\n missing: missing,\n };\n };\n StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) {\n if (supportsResultCaching(context.store) &&\n this.knownResults.get(result) === selectionSet) {\n var latest = this.executeSelectionSet.peek(selectionSet, parent, context, \n // If result is canonical, then it could only have been previously\n // cached by the canonizing version of executeSelectionSet, so we can\n // avoid checking both possibilities here.\n this.canon.isKnown(result));\n if (latest && result === latest.result) {\n return true;\n }\n }\n return false;\n };\n // Uncached version of executeSelectionSet.\n StoreReader.prototype.execSelectionSetImpl = function (_a) {\n var _this = this;\n var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context;\n if (isReference(objectOrReference) &&\n !context.policies.rootTypenamesById[objectOrReference.__ref] &&\n !context.store.has(objectOrReference.__ref)) {\n return {\n result: this.canon.empty,\n missing: \"Dangling reference to missing \".concat(objectOrReference.__ref, \" object\"),\n };\n }\n var variables = context.variables, policies = context.policies, store = context.store;\n var typename = store.getFieldValue(objectOrReference, \"__typename\");\n var objectsToMerge = [];\n var missing;\n var missingMerger = new DeepMerger();\n if (this.config.addTypename &&\n typeof typename === \"string\" &&\n !policies.rootIdsByTypename[typename]) {\n // Ensure we always include a default value for the __typename\n // field, if we have one, and this.config.addTypename is true. Note\n // that this field can be overridden by other merged objects.\n objectsToMerge.push({ __typename: typename });\n }\n function handleMissing(result, resultName) {\n var _a;\n if (result.missing) {\n missing = missingMerger.merge(missing, (_a = {},\n _a[resultName] = result.missing,\n _a));\n }\n return result.result;\n }\n var workSet = new Set(selectionSet.selections);\n workSet.forEach(function (selection) {\n var _a, _b;\n // Omit fields with directives @skip(if: ) or\n // @include(if: ).\n if (!shouldInclude(selection, variables))\n return;\n if (isField(selection)) {\n var fieldValue = policies.readField({\n fieldName: selection.name.value,\n field: selection,\n variables: context.variables,\n from: objectOrReference,\n }, context);\n var resultName = resultKeyNameFromField(selection);\n if (fieldValue === void 0) {\n if (!addTypenameToDocument.added(selection)) {\n missing = missingMerger.merge(missing, (_a = {},\n _a[resultName] = \"Can't find field '\".concat(selection.name.value, \"' on \").concat(isReference(objectOrReference) ?\n objectOrReference.__ref + \" object\"\n : \"object \" + JSON.stringify(objectOrReference, null, 2)),\n _a));\n }\n }\n else if (isArray(fieldValue)) {\n fieldValue = handleMissing(_this.executeSubSelectedArray({\n field: selection,\n array: fieldValue,\n enclosingRef: enclosingRef,\n context: context,\n }), resultName);\n }\n else if (!selection.selectionSet) {\n // If the field does not have a selection set, then we handle it\n // as a scalar value. To keep this.canon from canonicalizing\n // this value, we use this.canon.pass to wrap fieldValue in a\n // Pass object that this.canon.admit will later unwrap as-is.\n if (context.canonizeResults) {\n fieldValue = _this.canon.pass(fieldValue);\n }\n }\n else if (fieldValue != null) {\n // In this case, because we know the field has a selection set,\n // it must be trying to query a GraphQLObjectType, which is why\n // fieldValue must be != null.\n fieldValue = handleMissing(_this.executeSelectionSet({\n selectionSet: selection.selectionSet,\n objectOrReference: fieldValue,\n enclosingRef: isReference(fieldValue) ? fieldValue : enclosingRef,\n context: context,\n }), resultName);\n }\n if (fieldValue !== void 0) {\n objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b));\n }\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.lookupFragment);\n if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {\n throw newInvariantError(9, selection.name.value);\n }\n if (fragment && policies.fragmentMatches(fragment, typename)) {\n fragment.selectionSet.selections.forEach(workSet.add, workSet);\n }\n }\n });\n var result = mergeDeepArray(objectsToMerge);\n var finalResult = { result: result, missing: missing };\n var frozen = context.canonizeResults ?\n this.canon.admit(finalResult)\n // Since this.canon is normally responsible for freezing results (only in\n // development), freeze them manually if canonization is disabled.\n : maybeDeepFreeze(finalResult);\n // Store this result with its selection set so that we can quickly\n // recognize it again in the StoreReader#isFresh method.\n if (frozen.result) {\n this.knownResults.set(frozen.result, selectionSet);\n }\n return frozen;\n };\n // Uncached version of executeSubSelectedArray.\n StoreReader.prototype.execSubSelectedArrayImpl = function (_a) {\n var _this = this;\n var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context;\n var missing;\n var missingMerger = new DeepMerger();\n function handleMissing(childResult, i) {\n var _a;\n if (childResult.missing) {\n missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a));\n }\n return childResult.result;\n }\n if (field.selectionSet) {\n array = array.filter(context.store.canRead);\n }\n array = array.map(function (item, i) {\n // null value in array\n if (item === null) {\n return null;\n }\n // This is a nested array, recurse\n if (isArray(item)) {\n return handleMissing(_this.executeSubSelectedArray({\n field: field,\n array: item,\n enclosingRef: enclosingRef,\n context: context,\n }), i);\n }\n // This is an object, run the selection set on it\n if (field.selectionSet) {\n return handleMissing(_this.executeSelectionSet({\n selectionSet: field.selectionSet,\n objectOrReference: item,\n enclosingRef: isReference(item) ? item : enclosingRef,\n context: context,\n }), i);\n }\n if (globalThis.__DEV__ !== false) {\n assertSelectionSetForIdValue(context.store, field, item);\n }\n return item;\n });\n return {\n result: context.canonizeResults ? this.canon.admit(array) : array,\n missing: missing,\n };\n };\n return StoreReader;\n}());\nexport { StoreReader };\nfunction firstMissing(tree) {\n try {\n JSON.stringify(tree, function (_, value) {\n if (typeof value === \"string\")\n throw value;\n return value;\n });\n }\n catch (result) {\n return result;\n }\n}\nfunction assertSelectionSetForIdValue(store, field, fieldValue) {\n if (!field.selectionSet) {\n var workSet_1 = new Set([fieldValue]);\n workSet_1.forEach(function (value) {\n if (isNonNullObject(value)) {\n invariant(\n !isReference(value),\n 10,\n getTypenameFromStoreObject(store, value),\n field.name.value\n );\n Object.values(value).forEach(workSet_1.add, workSet_1);\n }\n });\n }\n}\n//# sourceMappingURL=readFromStore.js.map","import { dep, Slot } from \"optimism\";\n// Contextual Slot that acquires its value when custom read functions are\n// called in Policies#readField.\nexport var cacheSlot = new Slot();\nvar cacheInfoMap = new WeakMap();\nfunction getCacheInfo(cache) {\n var info = cacheInfoMap.get(cache);\n if (!info) {\n cacheInfoMap.set(cache, (info = {\n vars: new Set(),\n dep: dep(),\n }));\n }\n return info;\n}\nexport function forgetCache(cache) {\n getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); });\n}\n// Calling forgetCache(cache) serves to silence broadcasts and allows the\n// cache to be garbage collected. However, the varsByCache WeakMap\n// preserves the set of reactive variables that were previously associated\n// with this cache, which makes it possible to \"recall\" the cache at a\n// later time, by reattaching it to those variables. If the cache has been\n// garbage collected in the meantime, because it is no longer reachable,\n// you won't be able to call recallCache(cache), and the cache will\n// automatically disappear from the varsByCache WeakMap.\nexport function recallCache(cache) {\n getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); });\n}\nexport function makeVar(value) {\n var caches = new Set();\n var listeners = new Set();\n var rv = function (newValue) {\n if (arguments.length > 0) {\n if (value !== newValue) {\n value = newValue;\n caches.forEach(function (cache) {\n // Invalidate any fields with custom read functions that\n // consumed this variable, so query results involving those\n // fields will be recomputed the next time we read them.\n getCacheInfo(cache).dep.dirty(rv);\n // Broadcast changes to any caches that have previously read\n // from this variable.\n broadcast(cache);\n });\n // Finally, notify any listeners added via rv.onNextChange.\n var oldListeners = Array.from(listeners);\n listeners.clear();\n oldListeners.forEach(function (listener) { return listener(value); });\n }\n }\n else {\n // When reading from the variable, obtain the current cache from\n // context via cacheSlot. This isn't entirely foolproof, but it's\n // the same system that powers varDep.\n var cache = cacheSlot.getValue();\n if (cache) {\n attach(cache);\n getCacheInfo(cache).dep(rv);\n }\n }\n return value;\n };\n rv.onNextChange = function (listener) {\n listeners.add(listener);\n return function () {\n listeners.delete(listener);\n };\n };\n var attach = (rv.attachCache = function (cache) {\n caches.add(cache);\n getCacheInfo(cache).vars.add(rv);\n return rv;\n });\n rv.forgetCache = function (cache) { return caches.delete(cache); };\n return rv;\n}\nfunction broadcast(cache) {\n if (cache.broadcastWatches) {\n cache.broadcastWatches();\n }\n}\n//# sourceMappingURL=reactiveVars.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { argumentsObjectFromField, DeepMerger, isNonEmptyArray, isNonNullObject, } from \"../../utilities/index.js\";\nimport { hasOwn, isArray } from \"./helpers.js\";\n// Mapping from JSON-encoded KeySpecifier strings to associated information.\nvar specifierInfoCache = Object.create(null);\nfunction lookupSpecifierInfo(spec) {\n // It's safe to encode KeySpecifier arrays with JSON.stringify, since they're\n // just arrays of strings or nested KeySpecifier arrays, and the order of the\n // array elements is important (and suitably preserved by JSON.stringify).\n var cacheKey = JSON.stringify(spec);\n return (specifierInfoCache[cacheKey] ||\n (specifierInfoCache[cacheKey] = Object.create(null)));\n}\nexport function keyFieldsFnFromSpecifier(specifier) {\n var info = lookupSpecifierInfo(specifier);\n return (info.keyFieldsFn || (info.keyFieldsFn = function (object, context) {\n var extract = function (from, key) {\n return context.readField(key, from);\n };\n var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) {\n var extracted = extractKeyPath(context.storeObject, schemaKeyPath, \n // Using context.readField to extract paths from context.storeObject\n // allows the extraction to see through Reference objects and respect\n // custom read functions.\n extract);\n if (extracted === void 0 &&\n object !== context.storeObject &&\n hasOwn.call(object, schemaKeyPath[0])) {\n // If context.storeObject fails to provide a value for the requested\n // path, fall back to the raw result object, if it has a top-level key\n // matching the first key in the path (schemaKeyPath[0]). This allows\n // key fields included in the written data to be saved in the cache\n // even if they are not selected explicitly in context.selectionSet.\n // Not being mentioned by context.selectionSet is convenient here,\n // since it means these extra fields cannot be affected by field\n // aliasing, which is why we can use extractKey instead of\n // context.readField for this extraction.\n extracted = extractKeyPath(object, schemaKeyPath, extractKey);\n }\n invariant(extracted !== void 0, 4, schemaKeyPath.join(\".\"), object);\n return extracted;\n }));\n return \"\".concat(context.typename, \":\").concat(JSON.stringify(keyObject));\n }));\n}\n// The keyArgs extraction process is roughly analogous to keyFields extraction,\n// but there are no aliases involved, missing fields are tolerated (by merely\n// omitting them from the key), and drawing from field.directives or variables\n// is allowed (in addition to drawing from the field's arguments object).\n// Concretely, these differences mean passing a different key path extractor\n// function to collectSpecifierPaths, reusing the shared extractKeyPath helper\n// wherever possible.\nexport function keyArgsFnFromSpecifier(specifier) {\n var info = lookupSpecifierInfo(specifier);\n return (info.keyArgsFn ||\n (info.keyArgsFn = function (args, _a) {\n var field = _a.field, variables = _a.variables, fieldName = _a.fieldName;\n var collected = collectSpecifierPaths(specifier, function (keyPath) {\n var firstKey = keyPath[0];\n var firstChar = firstKey.charAt(0);\n if (firstChar === \"@\") {\n if (field && isNonEmptyArray(field.directives)) {\n var directiveName_1 = firstKey.slice(1);\n // If the directive appears multiple times, only the first\n // occurrence's arguments will be used. TODO Allow repetition?\n // TODO Cache this work somehow, a la aliasMap?\n var d = field.directives.find(function (d) { return d.name.value === directiveName_1; });\n // Fortunately argumentsObjectFromField works for DirectiveNode!\n var directiveArgs = d && argumentsObjectFromField(d, variables);\n // For directives without arguments (d defined, but directiveArgs ===\n // null), the presence or absence of the directive still counts as\n // part of the field key, so we return null in those cases. If no\n // directive with this name was found for this field (d undefined and\n // thus directiveArgs undefined), we return undefined, which causes\n // this value to be omitted from the key object returned by\n // collectSpecifierPaths.\n return (directiveArgs &&\n extractKeyPath(directiveArgs, \n // If keyPath.length === 1, this code calls extractKeyPath with an\n // empty path, which works because it uses directiveArgs as the\n // extracted value.\n keyPath.slice(1)));\n }\n // If the key started with @ but there was no corresponding directive,\n // we want to omit this value from the key object, not fall through to\n // treating @whatever as a normal argument name.\n return;\n }\n if (firstChar === \"$\") {\n var variableName = firstKey.slice(1);\n if (variables && hasOwn.call(variables, variableName)) {\n var varKeyPath = keyPath.slice(0);\n varKeyPath[0] = variableName;\n return extractKeyPath(variables, varKeyPath);\n }\n // If the key started with $ but there was no corresponding variable, we\n // want to omit this value from the key object, not fall through to\n // treating $whatever as a normal argument name.\n return;\n }\n if (args) {\n return extractKeyPath(args, keyPath);\n }\n });\n var suffix = JSON.stringify(collected);\n // If no arguments were passed to this field, and it didn't have any other\n // field key contributions from directives or variables, hide the empty\n // :{} suffix from the field key. However, a field passed no arguments can\n // still end up with a non-empty :{...} suffix if its key configuration\n // refers to directives or variables.\n if (args || suffix !== \"{}\") {\n fieldName += \":\" + suffix;\n }\n return fieldName;\n }));\n}\nexport function collectSpecifierPaths(specifier, extractor) {\n // For each path specified by specifier, invoke the extractor, and repeatedly\n // merge the results together, with appropriate ancestor context.\n var merger = new DeepMerger();\n return getSpecifierPaths(specifier).reduce(function (collected, path) {\n var _a;\n var toMerge = extractor(path);\n if (toMerge !== void 0) {\n // This path is not expected to contain array indexes, so the toMerge\n // reconstruction will not contain arrays. TODO Fix this?\n for (var i = path.length - 1; i >= 0; --i) {\n toMerge = (_a = {}, _a[path[i]] = toMerge, _a);\n }\n collected = merger.merge(collected, toMerge);\n }\n return collected;\n }, Object.create(null));\n}\nexport function getSpecifierPaths(spec) {\n var info = lookupSpecifierInfo(spec);\n if (!info.paths) {\n var paths_1 = (info.paths = []);\n var currentPath_1 = [];\n spec.forEach(function (s, i) {\n if (isArray(s)) {\n getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); });\n currentPath_1.length = 0;\n }\n else {\n currentPath_1.push(s);\n if (!isArray(spec[i + 1])) {\n paths_1.push(currentPath_1.slice(0));\n currentPath_1.length = 0;\n }\n }\n });\n }\n return info.paths;\n}\nfunction extractKey(object, key) {\n return object[key];\n}\nexport function extractKeyPath(object, path, extract) {\n // For each key in path, extract the corresponding child property from obj,\n // flattening arrays if encountered (uncommon for keyFields and keyArgs, but\n // possible). The final result of path.reduce is normalized so unexpected leaf\n // objects have their keys safely sorted. That final result is difficult to\n // type as anything other than any. You're welcome to try to improve the\n // return type, but keep in mind extractKeyPath is not a public function\n // (exported only for testing), so the effort may not be worthwhile unless the\n // limited set of actual callers (see above) pass arguments that TypeScript\n // can statically type. If we know only that path is some array of strings\n // (and not, say, a specific tuple of statically known strings), any (or\n // possibly unknown) is the honest answer.\n extract = extract || extractKey;\n return normalize(path.reduce(function reducer(obj, key) {\n return isArray(obj) ?\n obj.map(function (child) { return reducer(child, key); })\n : obj && extract(obj, key);\n }, object));\n}\nfunction normalize(value) {\n // Usually the extracted value will be a scalar value, since most primary\n // key fields are scalar, but just in case we get an object or an array, we\n // need to do some normalization of the order of (nested) keys.\n if (isNonNullObject(value)) {\n if (isArray(value)) {\n return value.map(normalize);\n }\n return collectSpecifierPaths(Object.keys(value).sort(), function (path) {\n return extractKeyPath(value, path);\n });\n }\n return value;\n}\n//# sourceMappingURL=key-extractor.js.map","import { __assign, __rest } from \"tslib\";\nimport { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\nimport { storeKeyNameFromField, argumentsObjectFromField, isReference, getStoreKeyName, isNonNullObject, stringifyForDisplay, } from \"../../utilities/index.js\";\nimport { hasOwn, fieldNameFromStoreName, storeValueIsStoreObject, selectionSetMatchesResult, TypeOrFieldNameRegExp, defaultDataIdFromObject, isArray, } from \"./helpers.js\";\nimport { cacheSlot } from \"./reactiveVars.js\";\nimport { keyArgsFnFromSpecifier, keyFieldsFnFromSpecifier, } from \"./key-extractor.js\";\nfunction argsFromFieldSpecifier(spec) {\n return (spec.args !== void 0 ? spec.args\n : spec.field ? argumentsObjectFromField(spec.field, spec.variables)\n : null);\n}\nvar nullKeyFieldsFn = function () { return void 0; };\nvar simpleKeyArgsFn = function (_args, context) { return context.fieldName; };\n// These merge functions can be selected by specifying merge:true or\n// merge:false in a field policy.\nvar mergeTrueFn = function (existing, incoming, _a) {\n var mergeObjects = _a.mergeObjects;\n return mergeObjects(existing, incoming);\n};\nvar mergeFalseFn = function (_, incoming) { return incoming; };\nvar Policies = /** @class */ (function () {\n function Policies(config) {\n this.config = config;\n this.typePolicies = Object.create(null);\n this.toBeAdded = Object.create(null);\n // Map from subtype names to sets of supertype names. Note that this\n // representation inverts the structure of possibleTypes (whose keys are\n // supertypes and whose values are arrays of subtypes) because it tends\n // to be much more efficient to search upwards than downwards.\n this.supertypeMap = new Map();\n // Any fuzzy subtypes specified by possibleTypes will be converted to\n // RegExp objects and recorded here. Every key of this map can also be\n // found in supertypeMap. In many cases this Map will be empty, which\n // means no fuzzy subtype checking will happen in fragmentMatches.\n this.fuzzySubtypes = new Map();\n this.rootIdsByTypename = Object.create(null);\n this.rootTypenamesById = Object.create(null);\n this.usingPossibleTypes = false;\n this.config = __assign({ dataIdFromObject: defaultDataIdFromObject }, config);\n this.cache = this.config.cache;\n this.setRootTypename(\"Query\");\n this.setRootTypename(\"Mutation\");\n this.setRootTypename(\"Subscription\");\n if (config.possibleTypes) {\n this.addPossibleTypes(config.possibleTypes);\n }\n if (config.typePolicies) {\n this.addTypePolicies(config.typePolicies);\n }\n }\n Policies.prototype.identify = function (object, partialContext) {\n var _a;\n var policies = this;\n var typename = (partialContext &&\n (partialContext.typename || ((_a = partialContext.storeObject) === null || _a === void 0 ? void 0 : _a.__typename))) ||\n object.__typename;\n // It should be possible to write root Query fields with writeFragment,\n // using { __typename: \"Query\", ... } as the data, but it does not make\n // sense to allow the same identification behavior for the Mutation and\n // Subscription types, since application code should never be writing\n // directly to (or reading directly from) those root objects.\n if (typename === this.rootTypenamesById.ROOT_QUERY) {\n return [\"ROOT_QUERY\"];\n }\n // Default context.storeObject to object if not otherwise provided.\n var storeObject = (partialContext && partialContext.storeObject) || object;\n var context = __assign(__assign({}, partialContext), { typename: typename, storeObject: storeObject, readField: (partialContext && partialContext.readField) ||\n function () {\n var options = normalizeReadFieldOptions(arguments, storeObject);\n return policies.readField(options, {\n store: policies.cache[\"data\"],\n variables: options.variables,\n });\n } });\n var id;\n var policy = typename && this.getTypePolicy(typename);\n var keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject;\n while (keyFn) {\n var specifierOrId = keyFn(__assign(__assign({}, object), storeObject), context);\n if (isArray(specifierOrId)) {\n keyFn = keyFieldsFnFromSpecifier(specifierOrId);\n }\n else {\n id = specifierOrId;\n break;\n }\n }\n id = id ? String(id) : void 0;\n return context.keyObject ? [id, context.keyObject] : [id];\n };\n Policies.prototype.addTypePolicies = function (typePolicies) {\n var _this = this;\n Object.keys(typePolicies).forEach(function (typename) {\n var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = __rest(_a, [\"queryType\", \"mutationType\", \"subscriptionType\"]);\n // Though {query,mutation,subscription}Type configurations are rare,\n // it's important to call setRootTypename as early as possible,\n // since these configurations should apply consistently for the\n // entire lifetime of the cache. Also, since only one __typename can\n // qualify as one of these root types, these three properties cannot\n // be inherited, unlike the rest of the incoming properties. That\n // restriction is convenient, because the purpose of this.toBeAdded\n // is to delay the processing of type/field policies until the first\n // time they're used, allowing policies to be added in any order as\n // long as all relevant policies (including policies for supertypes)\n // have been added by the time a given policy is used for the first\n // time. In other words, since inheritance doesn't matter for these\n // properties, there's also no need to delay their processing using\n // the this.toBeAdded queue.\n if (queryType)\n _this.setRootTypename(\"Query\", typename);\n if (mutationType)\n _this.setRootTypename(\"Mutation\", typename);\n if (subscriptionType)\n _this.setRootTypename(\"Subscription\", typename);\n if (hasOwn.call(_this.toBeAdded, typename)) {\n _this.toBeAdded[typename].push(incoming);\n }\n else {\n _this.toBeAdded[typename] = [incoming];\n }\n });\n };\n Policies.prototype.updateTypePolicy = function (typename, incoming) {\n var _this = this;\n var existing = this.getTypePolicy(typename);\n var keyFields = incoming.keyFields, fields = incoming.fields;\n function setMerge(existing, merge) {\n existing.merge =\n typeof merge === \"function\" ? merge\n // Pass merge:true as a shorthand for a merge implementation\n // that returns options.mergeObjects(existing, incoming).\n : merge === true ? mergeTrueFn\n // Pass merge:false to make incoming always replace existing\n // without any warnings about data clobbering.\n : merge === false ? mergeFalseFn\n : existing.merge;\n }\n // Type policies can define merge functions, as an alternative to\n // using field policies to merge child objects.\n setMerge(existing, incoming.merge);\n existing.keyFn =\n // Pass false to disable normalization for this typename.\n keyFields === false ? nullKeyFieldsFn\n // Pass an array of strings to use those fields to compute a\n // composite ID for objects of this typename.\n : isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)\n // Pass a function to take full control over identification.\n : typeof keyFields === \"function\" ? keyFields\n // Leave existing.keyFn unchanged if above cases fail.\n : existing.keyFn;\n if (fields) {\n Object.keys(fields).forEach(function (fieldName) {\n var existing = _this.getFieldPolicy(typename, fieldName, true);\n var incoming = fields[fieldName];\n if (typeof incoming === \"function\") {\n existing.read = incoming;\n }\n else {\n var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;\n existing.keyFn =\n // Pass false to disable argument-based differentiation of\n // field identities.\n keyArgs === false ? simpleKeyArgsFn\n // Pass an array of strings to use named arguments to\n // compute a composite identity for the field.\n : isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)\n // Pass a function to take full control over field identity.\n : typeof keyArgs === \"function\" ? keyArgs\n // Leave existing.keyFn unchanged if above cases fail.\n : existing.keyFn;\n if (typeof read === \"function\") {\n existing.read = read;\n }\n setMerge(existing, merge);\n }\n if (existing.read && existing.merge) {\n // If we have both a read and a merge function, assume\n // keyArgs:false, because read and merge together can take\n // responsibility for interpreting arguments in and out. This\n // default assumption can always be overridden by specifying\n // keyArgs explicitly in the FieldPolicy.\n existing.keyFn = existing.keyFn || simpleKeyArgsFn;\n }\n });\n }\n };\n Policies.prototype.setRootTypename = function (which, typename) {\n if (typename === void 0) { typename = which; }\n var rootId = \"ROOT_\" + which.toUpperCase();\n var old = this.rootTypenamesById[rootId];\n if (typename !== old) {\n invariant(!old || old === which, 5, which);\n // First, delete any old __typename associated with this rootId from\n // rootIdsByTypename.\n if (old)\n delete this.rootIdsByTypename[old];\n // Now make this the only __typename that maps to this rootId.\n this.rootIdsByTypename[typename] = rootId;\n // Finally, update the __typename associated with this rootId.\n this.rootTypenamesById[rootId] = typename;\n }\n };\n Policies.prototype.addPossibleTypes = function (possibleTypes) {\n var _this = this;\n this.usingPossibleTypes = true;\n Object.keys(possibleTypes).forEach(function (supertype) {\n // Make sure all types have an entry in this.supertypeMap, even if\n // their supertype set is empty, so we can return false immediately\n // from policies.fragmentMatches for unknown supertypes.\n _this.getSupertypeSet(supertype, true);\n possibleTypes[supertype].forEach(function (subtype) {\n _this.getSupertypeSet(subtype, true).add(supertype);\n var match = subtype.match(TypeOrFieldNameRegExp);\n if (!match || match[0] !== subtype) {\n // TODO Don't interpret just any invalid typename as a RegExp.\n _this.fuzzySubtypes.set(subtype, new RegExp(subtype));\n }\n });\n });\n };\n Policies.prototype.getTypePolicy = function (typename) {\n var _this = this;\n if (!hasOwn.call(this.typePolicies, typename)) {\n var policy_1 = (this.typePolicies[typename] = Object.create(null));\n policy_1.fields = Object.create(null);\n // When the TypePolicy for typename is first accessed, instead of\n // starting with an empty policy object, inherit any properties or\n // fields from the type policies of the supertypes of typename.\n //\n // Any properties or fields defined explicitly within the TypePolicy\n // for typename will take precedence, and if there are multiple\n // supertypes, the properties of policies whose types were added\n // later via addPossibleTypes will take precedence over those of\n // earlier supertypes. TODO Perhaps we should warn about these\n // conflicts in development, and recommend defining the property\n // explicitly in the subtype policy?\n //\n // Field policy inheritance is atomic/shallow: you can't inherit a\n // field policy and then override just its read function, since read\n // and merge functions often need to cooperate, so changing only one\n // of them would be a recipe for inconsistency.\n //\n // Once the TypePolicy for typename has been accessed, its properties can\n // still be updated directly using addTypePolicies, but future changes to\n // inherited supertype policies will not be reflected in this subtype\n // policy, because this code runs at most once per typename.\n var supertypes_1 = this.supertypeMap.get(typename);\n if (!supertypes_1 && this.fuzzySubtypes.size) {\n // To make the inheritance logic work for unknown typename strings that\n // may have fuzzy supertypes, we give this typename an empty supertype\n // set and then populate it with any fuzzy supertypes that match.\n supertypes_1 = this.getSupertypeSet(typename, true);\n // This only works for typenames that are directly matched by a fuzzy\n // supertype. What if there is an intermediate chain of supertypes?\n // While possible, that situation can only be solved effectively by\n // specifying the intermediate relationships via possibleTypes, manually\n // and in a non-fuzzy way.\n this.fuzzySubtypes.forEach(function (regExp, fuzzy) {\n if (regExp.test(typename)) {\n // The fuzzy parameter is just the original string version of regExp\n // (not a valid __typename string), but we can look up the\n // associated supertype(s) in this.supertypeMap.\n var fuzzySupertypes = _this.supertypeMap.get(fuzzy);\n if (fuzzySupertypes) {\n fuzzySupertypes.forEach(function (supertype) {\n return supertypes_1.add(supertype);\n });\n }\n }\n });\n }\n if (supertypes_1 && supertypes_1.size) {\n supertypes_1.forEach(function (supertype) {\n var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = __rest(_a, [\"fields\"]);\n Object.assign(policy_1, rest);\n Object.assign(policy_1.fields, fields);\n });\n }\n }\n var inbox = this.toBeAdded[typename];\n if (inbox && inbox.length) {\n // Merge the pending policies into this.typePolicies, in the order they\n // were originally passed to addTypePolicy.\n inbox.splice(0).forEach(function (policy) {\n _this.updateTypePolicy(typename, policy);\n });\n }\n return this.typePolicies[typename];\n };\n Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) {\n if (typename) {\n var fieldPolicies = this.getTypePolicy(typename).fields;\n return (fieldPolicies[fieldName] ||\n (createIfMissing && (fieldPolicies[fieldName] = Object.create(null))));\n }\n };\n Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) {\n var supertypeSet = this.supertypeMap.get(subtype);\n if (!supertypeSet && createIfMissing) {\n this.supertypeMap.set(subtype, (supertypeSet = new Set()));\n }\n return supertypeSet;\n };\n Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) {\n var _this = this;\n if (!fragment.typeCondition)\n return true;\n // If the fragment has a type condition but the object we're matching\n // against does not have a __typename, the fragment cannot match.\n if (!typename)\n return false;\n var supertype = fragment.typeCondition.name.value;\n // Common case: fragment type condition and __typename are the same.\n if (typename === supertype)\n return true;\n if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) {\n var typenameSupertypeSet = this.getSupertypeSet(typename, true);\n var workQueue_1 = [typenameSupertypeSet];\n var maybeEnqueue_1 = function (subtype) {\n var supertypeSet = _this.getSupertypeSet(subtype, false);\n if (supertypeSet &&\n supertypeSet.size &&\n workQueue_1.indexOf(supertypeSet) < 0) {\n workQueue_1.push(supertypeSet);\n }\n };\n // We need to check fuzzy subtypes only if we encountered fuzzy\n // subtype strings in addPossibleTypes, and only while writing to\n // the cache, since that's when selectionSetMatchesResult gives a\n // strong signal of fragment matching. The StoreReader class calls\n // policies.fragmentMatches without passing a result object, so\n // needToCheckFuzzySubtypes is always false while reading.\n var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size);\n var checkingFuzzySubtypes = false;\n // It's important to keep evaluating workQueue.length each time through\n // the loop, because the queue can grow while we're iterating over it.\n for (var i = 0; i < workQueue_1.length; ++i) {\n var supertypeSet = workQueue_1[i];\n if (supertypeSet.has(supertype)) {\n if (!typenameSupertypeSet.has(supertype)) {\n if (checkingFuzzySubtypes) {\n globalThis.__DEV__ !== false && invariant.warn(6, typename, supertype);\n }\n // Record positive results for faster future lookup.\n // Unfortunately, we cannot safely cache negative results,\n // because new possibleTypes data could always be added to the\n // Policies class.\n typenameSupertypeSet.add(supertype);\n }\n return true;\n }\n supertypeSet.forEach(maybeEnqueue_1);\n if (needToCheckFuzzySubtypes &&\n // Start checking fuzzy subtypes only after exhausting all\n // non-fuzzy subtypes (after the final iteration of the loop).\n i === workQueue_1.length - 1 &&\n // We could wait to compare fragment.selectionSet to result\n // after we verify the supertype, but this check is often less\n // expensive than that search, and we will have to do the\n // comparison anyway whenever we find a potential match.\n selectionSetMatchesResult(fragment.selectionSet, result, variables)) {\n // We don't always need to check fuzzy subtypes (if no result\n // was provided, or !this.fuzzySubtypes.size), but, when we do,\n // we only want to check them once.\n needToCheckFuzzySubtypes = false;\n checkingFuzzySubtypes = true;\n // If we find any fuzzy subtypes that match typename, extend the\n // workQueue to search through the supertypes of those fuzzy\n // subtypes. Otherwise the for-loop will terminate and we'll\n // return false below.\n this.fuzzySubtypes.forEach(function (regExp, fuzzyString) {\n var match = typename.match(regExp);\n if (match && match[0] === typename) {\n maybeEnqueue_1(fuzzyString);\n }\n });\n }\n }\n }\n return false;\n };\n Policies.prototype.hasKeyArgs = function (typename, fieldName) {\n var policy = this.getFieldPolicy(typename, fieldName, false);\n return !!(policy && policy.keyFn);\n };\n Policies.prototype.getStoreFieldName = function (fieldSpec) {\n var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName;\n var policy = this.getFieldPolicy(typename, fieldName, false);\n var storeFieldName;\n var keyFn = policy && policy.keyFn;\n if (keyFn && typename) {\n var context = {\n typename: typename,\n fieldName: fieldName,\n field: fieldSpec.field || null,\n variables: fieldSpec.variables,\n };\n var args = argsFromFieldSpecifier(fieldSpec);\n while (keyFn) {\n var specifierOrString = keyFn(args, context);\n if (isArray(specifierOrString)) {\n keyFn = keyArgsFnFromSpecifier(specifierOrString);\n }\n else {\n // If the custom keyFn returns a falsy value, fall back to\n // fieldName instead.\n storeFieldName = specifierOrString || fieldName;\n break;\n }\n }\n }\n if (storeFieldName === void 0) {\n storeFieldName =\n fieldSpec.field ?\n storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)\n : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));\n }\n // Returning false from a keyArgs function is like configuring\n // keyArgs: false, but more dynamic.\n if (storeFieldName === false) {\n return fieldName;\n }\n // Make sure custom field names start with the actual field.name.value\n // of the field, so we can always figure out which properties of a\n // StoreObject correspond to which original field names.\n return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName\n : fieldName + \":\" + storeFieldName;\n };\n Policies.prototype.readField = function (options, context) {\n var objectOrReference = options.from;\n if (!objectOrReference)\n return;\n var nameOrField = options.field || options.fieldName;\n if (!nameOrField)\n return;\n if (options.typename === void 0) {\n var typename = context.store.getFieldValue(objectOrReference, \"__typename\");\n if (typename)\n options.typename = typename;\n }\n var storeFieldName = this.getStoreFieldName(options);\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var existing = context.store.getFieldValue(objectOrReference, storeFieldName);\n var policy = this.getFieldPolicy(options.typename, fieldName, false);\n var read = policy && policy.read;\n if (read) {\n var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference) ?\n objectOrReference.__ref\n : objectOrReference, storeFieldName));\n // Call read(existing, readOptions) with cacheSlot holding this.cache.\n return cacheSlot.withValue(this.cache, read, [\n existing,\n readOptions,\n ]);\n }\n return existing;\n };\n Policies.prototype.getReadFunction = function (typename, fieldName) {\n var policy = this.getFieldPolicy(typename, fieldName, false);\n return policy && policy.read;\n };\n Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) {\n var policy = this.getFieldPolicy(parentTypename, fieldName, false);\n var merge = policy && policy.merge;\n if (!merge && childTypename) {\n policy = this.getTypePolicy(childTypename);\n merge = policy && policy.merge;\n }\n return merge;\n };\n Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) {\n var field = _a.field, typename = _a.typename, merge = _a.merge;\n if (merge === mergeTrueFn) {\n // Instead of going to the trouble of creating a full\n // FieldFunctionOptions object and calling mergeTrueFn, we can\n // simply call mergeObjects, as mergeTrueFn would.\n return makeMergeObjectsFunction(context.store)(existing, incoming);\n }\n if (merge === mergeFalseFn) {\n // Likewise for mergeFalseFn, whose implementation is even simpler.\n return incoming;\n }\n // If cache.writeQuery or cache.writeFragment was called with\n // options.overwrite set to true, we still call merge functions, but\n // the existing data is always undefined, so the merge function will\n // not attempt to combine the incoming data with the existing data.\n if (context.overwrite) {\n existing = void 0;\n }\n return merge(existing, incoming, makeFieldFunctionOptions(this, \n // Unlike options.readField for read functions, we do not fall\n // back to the current object if no foreignObjOrRef is provided,\n // because it's not clear what the current object should be for\n // merge functions: the (possibly undefined) existing object, or\n // the incoming object? If you think your merge function needs\n // to read sibling fields in order to produce a new value for\n // the current field, you might want to rethink your strategy,\n // because that's a recipe for making merge behavior sensitive\n // to the order in which fields are written into the cache.\n // However, readField(name, ref) is useful for merge functions\n // that need to deduplicate child objects and references.\n void 0, {\n typename: typename,\n fieldName: field.name.value,\n field: field,\n variables: context.variables,\n }, context, storage || Object.create(null)));\n };\n return Policies;\n}());\nexport { Policies };\nfunction makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) {\n var storeFieldName = policies.getStoreFieldName(fieldSpec);\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var variables = fieldSpec.variables || context.variables;\n var _a = context.store, toReference = _a.toReference, canRead = _a.canRead;\n return {\n args: argsFromFieldSpecifier(fieldSpec),\n field: fieldSpec.field || null,\n fieldName: fieldName,\n storeFieldName: storeFieldName,\n variables: variables,\n isReference: isReference,\n toReference: toReference,\n storage: storage,\n cache: policies.cache,\n canRead: canRead,\n readField: function () {\n return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context);\n },\n mergeObjects: makeMergeObjectsFunction(context.store),\n };\n}\nexport function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) {\n var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length;\n var options;\n if (typeof fieldNameOrOptions === \"string\") {\n options = {\n fieldName: fieldNameOrOptions,\n // Default to objectOrReference only when no second argument was\n // passed for the from parameter, not when undefined is explicitly\n // passed as the second argument.\n from: argc > 1 ? from : objectOrReference,\n };\n }\n else {\n options = __assign({}, fieldNameOrOptions);\n // Default to objectOrReference only when fieldNameOrOptions.from is\n // actually omitted, rather than just undefined.\n if (!hasOwn.call(options, \"from\")) {\n options.from = objectOrReference;\n }\n }\n if (globalThis.__DEV__ !== false && options.from === void 0) {\n globalThis.__DEV__ !== false && invariant.warn(7, stringifyForDisplay(Array.from(readFieldArgs)));\n }\n if (void 0 === options.variables) {\n options.variables = variables;\n }\n return options;\n}\nfunction makeMergeObjectsFunction(store) {\n return function mergeObjects(existing, incoming) {\n if (isArray(existing) || isArray(incoming)) {\n throw newInvariantError(8);\n }\n // These dynamic checks are necessary because the parameters of a\n // custom merge function can easily have the any type, so the type\n // system cannot always enforce the StoreObject | Reference parameter\n // types of options.mergeObjects.\n if (isNonNullObject(existing) && isNonNullObject(incoming)) {\n var eType = store.getFieldValue(existing, \"__typename\");\n var iType = store.getFieldValue(incoming, \"__typename\");\n var typesDiffer = eType && iType && eType !== iType;\n if (typesDiffer) {\n return incoming;\n }\n if (isReference(existing) && storeValueIsStoreObject(incoming)) {\n // Update the normalized EntityStore for the entity identified by\n // existing.__ref, preferring/overwriting any fields contributed by the\n // newer incoming StoreObject.\n store.merge(existing.__ref, incoming);\n return existing;\n }\n if (storeValueIsStoreObject(existing) && isReference(incoming)) {\n // Update the normalized EntityStore for the entity identified by\n // incoming.__ref, taking fields from the older existing object only if\n // those fields are not already present in the newer StoreObject\n // identified by incoming.__ref.\n store.merge(existing, incoming.__ref);\n return incoming;\n }\n if (storeValueIsStoreObject(existing) &&\n storeValueIsStoreObject(incoming)) {\n return __assign(__assign({}, existing), incoming);\n }\n }\n return incoming;\n };\n}\n//# sourceMappingURL=policies.js.map","import { __assign } from \"tslib\";\nimport { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { Trie } from \"@wry/trie\";\nimport { Kind } from \"graphql\";\nimport { getFragmentFromSelection, getDefaultValues, getOperationDefinition, getTypenameFromResult, makeReference, isField, resultKeyNameFromField, isReference, shouldInclude, cloneDeep, addTypenameToDocument, isNonEmptyArray, argumentsObjectFromField, canonicalStringify, } from \"../../utilities/index.js\";\nimport { isArray, makeProcessedFieldsMerger, fieldNameFromStoreName, storeValueIsStoreObject, extractFragmentContext, } from \"./helpers.js\";\nimport { normalizeReadFieldOptions } from \"./policies.js\";\n// Since there are only four possible combinations of context.clientOnly and\n// context.deferred values, we should need at most four \"flavors\" of any given\n// WriteContext. To avoid creating multiple copies of the same context, we cache\n// the contexts in the context.flavors Map (shared by all flavors) according to\n// their clientOnly and deferred values (always in that order).\nfunction getContextFlavor(context, clientOnly, deferred) {\n var key = \"\".concat(clientOnly).concat(deferred);\n var flavored = context.flavors.get(key);\n if (!flavored) {\n context.flavors.set(key, (flavored =\n context.clientOnly === clientOnly && context.deferred === deferred ?\n context\n : __assign(__assign({}, context), { clientOnly: clientOnly, deferred: deferred })));\n }\n return flavored;\n}\nvar StoreWriter = /** @class */ (function () {\n function StoreWriter(cache, reader, fragments) {\n this.cache = cache;\n this.reader = reader;\n this.fragments = fragments;\n }\n StoreWriter.prototype.writeToStore = function (store, _a) {\n var _this = this;\n var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite;\n var operationDefinition = getOperationDefinition(query);\n var merger = makeProcessedFieldsMerger();\n variables = __assign(__assign({}, getDefaultValues(operationDefinition)), variables);\n var context = __assign(__assign({ store: store, written: Object.create(null), merge: function (existing, incoming) {\n return merger.merge(existing, incoming);\n }, variables: variables, varString: canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() });\n var ref = this.processSelectionSet({\n result: result || Object.create(null),\n dataId: dataId,\n selectionSet: operationDefinition.selectionSet,\n mergeTree: { map: new Map() },\n context: context,\n });\n if (!isReference(ref)) {\n throw newInvariantError(11, result);\n }\n // So far, the store has not been modified, so now it's time to process\n // context.incomingById and merge those incoming fields into context.store.\n context.incomingById.forEach(function (_a, dataId) {\n var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;\n var entityRef = makeReference(dataId);\n if (mergeTree && mergeTree.map.size) {\n var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context);\n if (isReference(applied)) {\n // Assume References returned by applyMerges have already been merged\n // into the store. See makeMergeObjectsFunction in policies.ts for an\n // example of how this can happen.\n return;\n }\n // Otherwise, applyMerges returned a StoreObject, whose fields we should\n // merge into the store (see store.merge statement below).\n storeObject = applied;\n }\n if (globalThis.__DEV__ !== false && !context.overwrite) {\n var fieldsWithSelectionSets_1 = Object.create(null);\n fieldNodeSet.forEach(function (field) {\n if (field.selectionSet) {\n fieldsWithSelectionSets_1[field.name.value] = true;\n }\n });\n var hasSelectionSet_1 = function (storeFieldName) {\n return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] ===\n true;\n };\n var hasMergeFunction_1 = function (storeFieldName) {\n var childTree = mergeTree && mergeTree.map.get(storeFieldName);\n return Boolean(childTree && childTree.info && childTree.info.merge);\n };\n Object.keys(storeObject).forEach(function (storeFieldName) {\n // If a merge function was defined for this field, trust that it\n // did the right thing about (not) clobbering data. If the field\n // has no selection set, it's a scalar field, so it doesn't need\n // a merge function (even if it's an object, like JSON data).\n if (hasSelectionSet_1(storeFieldName) &&\n !hasMergeFunction_1(storeFieldName)) {\n warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store);\n }\n });\n }\n store.merge(dataId, storeObject);\n });\n // Any IDs written explicitly to the cache will be retained as\n // reachable root IDs for garbage collection purposes. Although this\n // logic includes root IDs like ROOT_QUERY and ROOT_MUTATION, their\n // retainment counts are effectively ignored because cache.gc() always\n // includes them in its root ID set.\n store.retain(ref.__ref);\n return ref;\n };\n StoreWriter.prototype.processSelectionSet = function (_a) {\n var _this = this;\n var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, \n // This object allows processSelectionSet to report useful information\n // to its callers without explicitly returning that information.\n mergeTree = _a.mergeTree;\n var policies = this.cache.policies;\n // This variable will be repeatedly updated using context.merge to\n // accumulate all fields that need to be written into the store.\n var incoming = Object.create(null);\n // If typename was not passed in, infer it. Note that typename is\n // always passed in for tricky-to-infer cases such as \"Query\" for\n // ROOT_QUERY.\n var typename = (dataId && policies.rootTypenamesById[dataId]) ||\n getTypenameFromResult(result, selectionSet, context.fragmentMap) ||\n (dataId && context.store.get(dataId, \"__typename\"));\n if (\"string\" === typeof typename) {\n incoming.__typename = typename;\n }\n // This readField function will be passed as context.readField in the\n // KeyFieldsContext object created within policies.identify (called below).\n // In addition to reading from the existing context.store (thanks to the\n // policies.readField(options, context) line at the very bottom), this\n // version of readField can read from Reference objects that are currently\n // pending in context.incomingById, which is important whenever keyFields\n // need to be extracted from a child object that processSelectionSet has\n // turned into a Reference.\n var readField = function () {\n var options = normalizeReadFieldOptions(arguments, incoming, context.variables);\n if (isReference(options.from)) {\n var info = context.incomingById.get(options.from.__ref);\n if (info) {\n var result_1 = policies.readField(__assign(__assign({}, options), { from: info.storeObject }), context);\n if (result_1 !== void 0) {\n return result_1;\n }\n }\n }\n return policies.readField(options, context);\n };\n var fieldNodeSet = new Set();\n this.flattenFields(selectionSet, result, \n // This WriteContext will be the default context value for fields returned\n // by the flattenFields method, but some fields may be assigned a modified\n // context, depending on the presence of @client and other directives.\n context, typename).forEach(function (context, field) {\n var _a;\n var resultFieldKey = resultKeyNameFromField(field);\n var value = result[resultFieldKey];\n fieldNodeSet.add(field);\n if (value !== void 0) {\n var storeFieldName = policies.getStoreFieldName({\n typename: typename,\n fieldName: field.name.value,\n field: field,\n variables: context.variables,\n });\n var childTree = getChildMergeTree(mergeTree, storeFieldName);\n var incomingValue = _this.processFieldValue(value, field, \n // Reset context.clientOnly and context.deferred to their default\n // values before processing nested selection sets.\n field.selectionSet ?\n getContextFlavor(context, false, false)\n : context, childTree);\n // To determine if this field holds a child object with a merge function\n // defined in its type policy (see PR #7070), we need to figure out the\n // child object's __typename.\n var childTypename = void 0;\n // The field's value can be an object that has a __typename only if the\n // field has a selection set. Otherwise incomingValue is scalar.\n if (field.selectionSet &&\n (isReference(incomingValue) || storeValueIsStoreObject(incomingValue))) {\n childTypename = readField(\"__typename\", incomingValue);\n }\n var merge = policies.getMergeFunction(typename, field.name.value, childTypename);\n if (merge) {\n childTree.info = {\n // TODO Check compatibility against any existing childTree.field?\n field: field,\n typename: typename,\n merge: merge,\n };\n }\n else {\n maybeRecycleChildMergeTree(mergeTree, storeFieldName);\n }\n incoming = context.merge(incoming, (_a = {},\n _a[storeFieldName] = incomingValue,\n _a));\n }\n else if (globalThis.__DEV__ !== false &&\n !context.clientOnly &&\n !context.deferred &&\n !addTypenameToDocument.added(field) &&\n // If the field has a read function, it may be a synthetic field or\n // provide a default value, so its absence from the written data should\n // not be cause for alarm.\n !policies.getReadFunction(typename, field.name.value)) {\n globalThis.__DEV__ !== false && invariant.error(12, resultKeyNameFromField(field), result);\n }\n });\n // Identify the result object, even if dataId was already provided,\n // since we always need keyObject below.\n try {\n var _b = policies.identify(result, {\n typename: typename,\n selectionSet: selectionSet,\n fragmentMap: context.fragmentMap,\n storeObject: incoming,\n readField: readField,\n }), id = _b[0], keyObject = _b[1];\n // If dataId was not provided, fall back to the id just generated by\n // policies.identify.\n dataId = dataId || id;\n // Write any key fields that were used during identification, even if\n // they were not mentioned in the original query.\n if (keyObject) {\n // TODO Reverse the order of the arguments?\n incoming = context.merge(incoming, keyObject);\n }\n }\n catch (e) {\n // If dataId was provided, tolerate failure of policies.identify.\n if (!dataId)\n throw e;\n }\n if (\"string\" === typeof dataId) {\n var dataRef = makeReference(dataId);\n // Avoid processing the same entity object using the same selection\n // set more than once. We use an array instead of a Set since most\n // entity IDs will be written using only one selection set, so the\n // size of this array is likely to be very small, meaning indexOf is\n // likely to be faster than Set.prototype.has.\n var sets = context.written[dataId] || (context.written[dataId] = []);\n if (sets.indexOf(selectionSet) >= 0)\n return dataRef;\n sets.push(selectionSet);\n // If we're about to write a result object into the store, but we\n // happen to know that the exact same (===) result object would be\n // returned if we were to reread the result with the same inputs,\n // then we can skip the rest of the processSelectionSet work for\n // this object, and immediately return a Reference to it.\n if (this.reader &&\n this.reader.isFresh(result, dataRef, selectionSet, context)) {\n return dataRef;\n }\n var previous_1 = context.incomingById.get(dataId);\n if (previous_1) {\n previous_1.storeObject = context.merge(previous_1.storeObject, incoming);\n previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree);\n fieldNodeSet.forEach(function (field) { return previous_1.fieldNodeSet.add(field); });\n }\n else {\n context.incomingById.set(dataId, {\n storeObject: incoming,\n // Save a reference to mergeTree only if it is not empty, because\n // empty MergeTrees may be recycled by maybeRecycleChildMergeTree and\n // reused for entirely different parts of the result tree.\n mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree,\n fieldNodeSet: fieldNodeSet,\n });\n }\n return dataRef;\n }\n return incoming;\n };\n StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) {\n var _this = this;\n if (!field.selectionSet || value === null) {\n // In development, we need to clone scalar values so that they can be\n // safely frozen with maybeDeepFreeze in readFromStore.ts. In production,\n // it's cheaper to store the scalar values directly in the cache.\n return globalThis.__DEV__ !== false ? cloneDeep(value) : value;\n }\n if (isArray(value)) {\n return value.map(function (item, i) {\n var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));\n maybeRecycleChildMergeTree(mergeTree, i);\n return value;\n });\n }\n return this.processSelectionSet({\n result: value,\n selectionSet: field.selectionSet,\n context: context,\n mergeTree: mergeTree,\n });\n };\n // Implements https://spec.graphql.org/draft/#sec-Field-Collection, but with\n // some additions for tracking @client and @defer directives.\n StoreWriter.prototype.flattenFields = function (selectionSet, result, context, typename) {\n if (typename === void 0) { typename = getTypenameFromResult(result, selectionSet, context.fragmentMap); }\n var fieldMap = new Map();\n var policies = this.cache.policies;\n var limitingTrie = new Trie(false); // No need for WeakMap, since limitingTrie does not escape.\n (function flatten(selectionSet, inheritedContext) {\n var visitedNode = limitingTrie.lookup(selectionSet, \n // Because we take inheritedClientOnly and inheritedDeferred into\n // consideration here (in addition to selectionSet), it's possible for\n // the same selection set to be flattened more than once, if it appears\n // in the query with different @client and/or @directive configurations.\n inheritedContext.clientOnly, inheritedContext.deferred);\n if (visitedNode.visited)\n return;\n visitedNode.visited = true;\n selectionSet.selections.forEach(function (selection) {\n if (!shouldInclude(selection, context.variables))\n return;\n var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred;\n if (\n // Since the presence of @client or @defer on this field can only\n // cause clientOnly or deferred to become true, we can skip the\n // forEach loop if both clientOnly and deferred are already true.\n !(clientOnly && deferred) &&\n isNonEmptyArray(selection.directives)) {\n selection.directives.forEach(function (dir) {\n var name = dir.name.value;\n if (name === \"client\")\n clientOnly = true;\n if (name === \"defer\") {\n var args = argumentsObjectFromField(dir, context.variables);\n // The @defer directive takes an optional args.if boolean\n // argument, similar to @include(if: boolean). Note that\n // @defer(if: false) does not make context.deferred false, but\n // instead behaves as if there was no @defer directive.\n if (!args || args.if !== false) {\n deferred = true;\n }\n // TODO In the future, we may want to record args.label using\n // context.deferred, if a label is specified.\n }\n });\n }\n if (isField(selection)) {\n var existing = fieldMap.get(selection);\n if (existing) {\n // If this field has been visited along another recursive path\n // before, the final context should have clientOnly or deferred set\n // to true only if *all* paths have the directive (hence the &&).\n clientOnly = clientOnly && existing.clientOnly;\n deferred = deferred && existing.deferred;\n }\n fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred));\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.lookupFragment);\n if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {\n throw newInvariantError(13, selection.name.value);\n }\n if (fragment &&\n policies.fragmentMatches(fragment, typename, result, context.variables)) {\n flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred));\n }\n }\n });\n })(selectionSet, context);\n return fieldMap;\n };\n StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) {\n var _a;\n var _this = this;\n if (mergeTree.map.size && !isReference(incoming)) {\n var e_1 = \n // Items in the same position in different arrays are not\n // necessarily related to each other, so when incoming is an array\n // we process its elements as if there was no existing data.\n (!isArray(incoming) &&\n // Likewise, existing must be either a Reference or a StoreObject\n // in order for its fields to be safe to merge with the fields of\n // the incoming object.\n (isReference(existing) || storeValueIsStoreObject(existing))) ?\n existing\n : void 0;\n // This narrowing is implied by mergeTree.map.size > 0 and\n // !isReference(incoming), though TypeScript understandably cannot\n // hope to infer this type.\n var i_1 = incoming;\n // The options.storage objects provided to read and merge functions\n // are derived from the identity of the parent object plus a\n // sequence of storeFieldName strings/numbers identifying the nested\n // field name path of each field value to be merged.\n if (e_1 && !getStorageArgs) {\n getStorageArgs = [isReference(e_1) ? e_1.__ref : e_1];\n }\n // It's possible that applying merge functions to this subtree will\n // not change the incoming data, so this variable tracks the fields\n // that did change, so we can create a new incoming object when (and\n // only when) at least one incoming field has changed. We use a Map\n // to preserve the type of numeric keys.\n var changedFields_1;\n var getValue_1 = function (from, name) {\n return (isArray(from) ?\n typeof name === \"number\" ?\n from[name]\n : void 0\n : context.store.getFieldValue(from, String(name)));\n };\n mergeTree.map.forEach(function (childTree, storeFieldName) {\n var eVal = getValue_1(e_1, storeFieldName);\n var iVal = getValue_1(i_1, storeFieldName);\n // If we have no incoming data, leave any existing data untouched.\n if (void 0 === iVal)\n return;\n if (getStorageArgs) {\n getStorageArgs.push(storeFieldName);\n }\n var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs);\n if (aVal !== iVal) {\n changedFields_1 = changedFields_1 || new Map();\n changedFields_1.set(storeFieldName, aVal);\n }\n if (getStorageArgs) {\n invariant(getStorageArgs.pop() === storeFieldName);\n }\n });\n if (changedFields_1) {\n // Shallow clone i so we can add changed fields to it.\n incoming = (isArray(i_1) ? i_1.slice(0) : __assign({}, i_1));\n changedFields_1.forEach(function (value, name) {\n incoming[name] = value;\n });\n }\n }\n if (mergeTree.info) {\n return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs));\n }\n return incoming;\n };\n return StoreWriter;\n}());\nexport { StoreWriter };\nvar emptyMergeTreePool = [];\nfunction getChildMergeTree(_a, name) {\n var map = _a.map;\n if (!map.has(name)) {\n map.set(name, emptyMergeTreePool.pop() || { map: new Map() });\n }\n return map.get(name);\n}\nfunction mergeMergeTrees(left, right) {\n if (left === right || !right || mergeTreeIsEmpty(right))\n return left;\n if (!left || mergeTreeIsEmpty(left))\n return right;\n var info = left.info && right.info ? __assign(__assign({}, left.info), right.info) : left.info || right.info;\n var needToMergeMaps = left.map.size && right.map.size;\n var map = needToMergeMaps ? new Map()\n : left.map.size ? left.map\n : right.map;\n var merged = { info: info, map: map };\n if (needToMergeMaps) {\n var remainingRightKeys_1 = new Set(right.map.keys());\n left.map.forEach(function (leftTree, key) {\n merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key)));\n remainingRightKeys_1.delete(key);\n });\n remainingRightKeys_1.forEach(function (key) {\n merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key)));\n });\n }\n return merged;\n}\nfunction mergeTreeIsEmpty(tree) {\n return !tree || !(tree.info || tree.map.size);\n}\nfunction maybeRecycleChildMergeTree(_a, name) {\n var map = _a.map;\n var childTree = map.get(name);\n if (childTree && mergeTreeIsEmpty(childTree)) {\n emptyMergeTreePool.push(childTree);\n map.delete(name);\n }\n}\nvar warnings = new Set();\n// Note that this function is unused in production, and thus should be\n// pruned by any well-configured minifier.\nfunction warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {\n var getChild = function (objOrRef) {\n var child = store.getFieldValue(objOrRef, storeFieldName);\n return typeof child === \"object\" && child;\n };\n var existing = getChild(existingRef);\n if (!existing)\n return;\n var incoming = getChild(incomingObj);\n if (!incoming)\n return;\n // It's always safe to replace a reference, since it refers to data\n // safely stored elsewhere.\n if (isReference(existing))\n return;\n // If the values are structurally equivalent, we do not need to worry\n // about incoming replacing existing.\n if (equal(existing, incoming))\n return;\n // If we're replacing every key of the existing object, then the\n // existing data would be overwritten even if the objects were\n // normalized, so warning would not be helpful here.\n if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) {\n return;\n }\n var parentType = store.getFieldValue(existingRef, \"__typename\") ||\n store.getFieldValue(incomingObj, \"__typename\");\n var fieldName = fieldNameFromStoreName(storeFieldName);\n var typeDotName = \"\".concat(parentType, \".\").concat(fieldName);\n // Avoid warning more than once for the same type and field name.\n if (warnings.has(typeDotName))\n return;\n warnings.add(typeDotName);\n var childTypenames = [];\n // Arrays do not have __typename fields, and always need a custom merge\n // function, even if their elements are normalized entities.\n if (!isArray(existing) && !isArray(incoming)) {\n [existing, incoming].forEach(function (child) {\n var typename = store.getFieldValue(child, \"__typename\");\n if (typeof typename === \"string\" && !childTypenames.includes(typename)) {\n childTypenames.push(typename);\n }\n });\n }\n globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length ?\n \"either ensure all objects of type \" +\n childTypenames.join(\" and \") +\n \" have an ID or a custom merge function, or \"\n : \"\", typeDotName, existing, incoming);\n}\n//# sourceMappingURL=writeToStore.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n// Make builtins like Map and Set safe to use with non-extensible objects.\nimport \"./fixPolyfills.js\";\nimport { wrap } from \"optimism\";\nimport { equal } from \"@wry/equality\";\nimport { ApolloCache } from \"../core/cache.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport { addTypenameToDocument, isReference, DocumentTransform, canonicalStringify, print, cacheSizes, } from \"../../utilities/index.js\";\nimport { StoreReader } from \"./readFromStore.js\";\nimport { StoreWriter } from \"./writeToStore.js\";\nimport { EntityStore, supportsResultCaching } from \"./entityStore.js\";\nimport { makeVar, forgetCache, recallCache } from \"./reactiveVars.js\";\nimport { Policies } from \"./policies.js\";\nimport { hasOwn, normalizeConfig, shouldCanonizeResults } from \"./helpers.js\";\nimport { getInMemoryCacheMemoryInternals } from \"../../utilities/caching/getMemoryInternals.js\";\nvar InMemoryCache = /** @class */ (function (_super) {\n __extends(InMemoryCache, _super);\n function InMemoryCache(config) {\n if (config === void 0) { config = {}; }\n var _this = _super.call(this) || this;\n _this.watches = new Set();\n _this.addTypenameTransform = new DocumentTransform(addTypenameToDocument);\n // Override the default value, since InMemoryCache result objects are frozen\n // in development and expected to remain logically immutable in production.\n _this.assumeImmutableResults = true;\n _this.makeVar = makeVar;\n _this.txCount = 0;\n _this.config = normalizeConfig(config);\n _this.addTypename = !!_this.config.addTypename;\n _this.policies = new Policies({\n cache: _this,\n dataIdFromObject: _this.config.dataIdFromObject,\n possibleTypes: _this.config.possibleTypes,\n typePolicies: _this.config.typePolicies,\n });\n _this.init();\n return _this;\n }\n InMemoryCache.prototype.init = function () {\n // Passing { resultCaching: false } in the InMemoryCache constructor options\n // will completely disable dependency tracking, which will improve memory\n // usage but worsen the performance of repeated reads.\n var rootStore = (this.data = new EntityStore.Root({\n policies: this.policies,\n resultCaching: this.config.resultCaching,\n }));\n // When no optimistic writes are currently active, cache.optimisticData ===\n // cache.data, so there are no additional layers on top of the actual data.\n // When an optimistic update happens, this.optimisticData will become a\n // linked list of EntityStore Layer objects that terminates with the\n // original this.data cache object.\n this.optimisticData = rootStore.stump;\n this.resetResultCache();\n };\n InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) {\n var _this = this;\n var previousReader = this.storeReader;\n var fragments = this.config.fragments;\n // The StoreWriter is mostly stateless and so doesn't really need to be\n // reset, but it does need to have its writer.storeReader reference updated,\n // so it's simpler to update this.storeWriter as well.\n this.storeWriter = new StoreWriter(this, (this.storeReader = new StoreReader({\n cache: this,\n addTypename: this.addTypename,\n resultCacheMaxSize: this.config.resultCacheMaxSize,\n canonizeResults: shouldCanonizeResults(this.config),\n canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon),\n fragments: fragments,\n })), fragments);\n this.maybeBroadcastWatch = wrap(function (c, options) {\n return _this.broadcastWatch(c, options);\n }, {\n max: this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] ||\n 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n makeCacheKey: function (c) {\n // Return a cache key (thus enabling result caching) only if we're\n // currently using a data store that can track cache dependencies.\n var store = c.optimistic ? _this.optimisticData : _this.data;\n if (supportsResultCaching(store)) {\n var optimistic = c.optimistic, id = c.id, variables = c.variables;\n return store.makeCacheKey(c.query, \n // Different watches can have the same query, optimistic\n // status, rootId, and variables, but if their callbacks are\n // different, the (identical) result needs to be delivered to\n // each distinct callback. The easiest way to achieve that\n // separation is to include c.callback in the cache key for\n // maybeBroadcastWatch calls. See issue #5733.\n c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));\n }\n },\n });\n // Since we have thrown away all the cached functions that depend on the\n // CacheGroup dependencies maintained by EntityStore, we should also reset\n // all CacheGroup dependency information.\n new Set([this.data.group, this.optimisticData.group]).forEach(function (group) {\n return group.resetCaching();\n });\n };\n InMemoryCache.prototype.restore = function (data) {\n this.init();\n // Since calling this.init() discards/replaces the entire StoreReader, along\n // with the result caches it maintains, this.data.replace(data) won't have\n // to bother deleting the old data.\n if (data)\n this.data.replace(data);\n return this;\n };\n InMemoryCache.prototype.extract = function (optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return (optimistic ? this.optimisticData : this.data).extract();\n };\n InMemoryCache.prototype.read = function (options) {\n var \n // Since read returns data or null, without any additional metadata\n // about whether/where there might have been missing fields, the\n // default behavior cannot be returnPartialData = true (like it is\n // for the diff method), since defaulting to true would violate the\n // integrity of the T in the return type. However, partial data may\n // be useful in some cases, so returnPartialData:true may be\n // specified explicitly.\n _a = options.returnPartialData, \n // Since read returns data or null, without any additional metadata\n // about whether/where there might have been missing fields, the\n // default behavior cannot be returnPartialData = true (like it is\n // for the diff method), since defaulting to true would violate the\n // integrity of the T in the return type. However, partial data may\n // be useful in some cases, so returnPartialData:true may be\n // specified explicitly.\n returnPartialData = _a === void 0 ? false : _a;\n try {\n return (this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null);\n }\n catch (e) {\n if (e instanceof MissingFieldError) {\n // Swallow MissingFieldError and return null, so callers do not need to\n // worry about catching \"normal\" exceptions resulting from incomplete\n // cache data. Unexpected errors will be re-thrown. If you need more\n // information about which fields were missing, use cache.diff instead,\n // and examine diffResult.missing.\n return null;\n }\n throw e;\n }\n };\n InMemoryCache.prototype.write = function (options) {\n try {\n ++this.txCount;\n return this.storeWriter.writeToStore(this.data, options);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.modify = function (options) {\n if (hasOwn.call(options, \"id\") && !options.id) {\n // To my knowledge, TypeScript does not currently provide a way to\n // enforce that an optional property?:type must *not* be undefined\n // when present. That ability would be useful here, because we want\n // options.id to default to ROOT_QUERY only when no options.id was\n // provided. If the caller attempts to pass options.id with a\n // falsy/undefined value (perhaps because cache.identify failed), we\n // should not assume the goal was to modify the ROOT_QUERY object.\n // We could throw, but it seems natural to return false to indicate\n // that nothing was modified.\n return false;\n }\n var store = ((options.optimistic) // Defaults to false.\n ) ?\n this.optimisticData\n : this.data;\n try {\n ++this.txCount;\n return store.modify(options.id || \"ROOT_QUERY\", options.fields);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.diff = function (options) {\n return this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || \"ROOT_QUERY\", config: this.config }));\n };\n InMemoryCache.prototype.watch = function (watch) {\n var _this = this;\n if (!this.watches.size) {\n // In case we previously called forgetCache(this) because\n // this.watches became empty (see below), reattach this cache to any\n // reactive variables on which it previously depended. It might seem\n // paradoxical that we're able to recall something we supposedly\n // forgot, but the point of calling forgetCache(this) is to silence\n // useless broadcasts while this.watches is empty, and to allow the\n // cache to be garbage collected. If, however, we manage to call\n // recallCache(this) here, this cache object must not have been\n // garbage collected yet, and should resume receiving updates from\n // reactive variables, now that it has a watcher to notify.\n recallCache(this);\n }\n this.watches.add(watch);\n if (watch.immediate) {\n this.maybeBroadcastWatch(watch);\n }\n return function () {\n // Once we remove the last watch from this.watches, cache.broadcastWatches\n // no longer does anything, so we preemptively tell the reactive variable\n // system to exclude this cache from future broadcasts.\n if (_this.watches.delete(watch) && !_this.watches.size) {\n forgetCache(_this);\n }\n // Remove this watch from the LRU cache managed by the\n // maybeBroadcastWatch OptimisticWrapperFunction, to prevent memory\n // leaks involving the closure of watch.callback.\n _this.maybeBroadcastWatch.forget(watch);\n };\n };\n InMemoryCache.prototype.gc = function (options) {\n var _a;\n canonicalStringify.reset();\n print.reset();\n this.addTypenameTransform.resetCache();\n (_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches();\n var ids = this.optimisticData.gc();\n if (options && !this.txCount) {\n if (options.resetResultCache) {\n this.resetResultCache(options.resetResultIdentities);\n }\n else if (options.resetResultIdentities) {\n this.storeReader.resetCanon();\n }\n }\n return ids;\n };\n // Call this method to ensure the given root ID remains in the cache after\n // garbage collection, along with its transitive child entities. Note that\n // the cache automatically retains all directly written entities. By default,\n // the retainment persists after optimistic updates are removed. Pass true\n // for the optimistic argument if you would prefer for the retainment to be\n // discarded when the top-most optimistic layer is removed. Returns the\n // resulting (non-negative) retainment count.\n InMemoryCache.prototype.retain = function (rootId, optimistic) {\n return (optimistic ? this.optimisticData : this.data).retain(rootId);\n };\n // Call this method to undo the effect of the retain method, above. Once the\n // retainment count falls to zero, the given ID will no longer be preserved\n // during garbage collection, though it may still be preserved by other safe\n // entities that refer to it. Returns the resulting (non-negative) retainment\n // count, in case that's useful.\n InMemoryCache.prototype.release = function (rootId, optimistic) {\n return (optimistic ? this.optimisticData : this.data).release(rootId);\n };\n // Returns the canonical ID for a given StoreObject, obeying typePolicies\n // and keyFields (and dataIdFromObject, if you still use that). At minimum,\n // the object must contain a __typename and any primary key fields required\n // to identify entities of that type. If you pass a query result object, be\n // sure that none of the primary key fields have been renamed by aliasing.\n // If you pass a Reference object, its __ref ID string will be returned.\n InMemoryCache.prototype.identify = function (object) {\n if (isReference(object))\n return object.__ref;\n try {\n return this.policies.identify(object)[0];\n }\n catch (e) {\n globalThis.__DEV__ !== false && invariant.warn(e);\n }\n };\n InMemoryCache.prototype.evict = function (options) {\n if (!options.id) {\n if (hasOwn.call(options, \"id\")) {\n // See comment in modify method about why we return false when\n // options.id exists but is falsy/undefined.\n return false;\n }\n options = __assign(__assign({}, options), { id: \"ROOT_QUERY\" });\n }\n try {\n // It's unlikely that the eviction will end up invoking any other\n // cache update operations while it's running, but {in,de}crementing\n // this.txCount still seems like a good idea, for uniformity with\n // the other update methods.\n ++this.txCount;\n // Pass this.data as a limit on the depth of the eviction, so evictions\n // during optimistic updates (when this.data is temporarily set equal to\n // this.optimisticData) do not escape their optimistic Layer.\n return this.optimisticData.evict(options, this.data);\n }\n finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n };\n InMemoryCache.prototype.reset = function (options) {\n var _this = this;\n this.init();\n canonicalStringify.reset();\n if (options && options.discardWatches) {\n // Similar to what happens in the unsubscribe function returned by\n // cache.watch, applied to all current watches.\n this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); });\n this.watches.clear();\n forgetCache(this);\n }\n else {\n // Calling this.init() above unblocks all maybeBroadcastWatch caching, so\n // this.broadcastWatches() triggers a broadcast to every current watcher\n // (letting them know their data is now missing). This default behavior is\n // convenient because it means the watches do not have to be manually\n // reestablished after resetting the cache. To prevent this broadcast and\n // cancel all watches, pass true for options.discardWatches.\n this.broadcastWatches();\n }\n return Promise.resolve();\n };\n InMemoryCache.prototype.removeOptimistic = function (idToRemove) {\n var newOptimisticData = this.optimisticData.removeLayer(idToRemove);\n if (newOptimisticData !== this.optimisticData) {\n this.optimisticData = newOptimisticData;\n this.broadcastWatches();\n }\n };\n InMemoryCache.prototype.batch = function (options) {\n var _this = this;\n var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated;\n var updateResult;\n var perform = function (layer) {\n var _a = _this, data = _a.data, optimisticData = _a.optimisticData;\n ++_this.txCount;\n if (layer) {\n _this.data = _this.optimisticData = layer;\n }\n try {\n return (updateResult = update(_this));\n }\n finally {\n --_this.txCount;\n _this.data = data;\n _this.optimisticData = optimisticData;\n }\n };\n var alreadyDirty = new Set();\n if (onWatchUpdated && !this.txCount) {\n // If an options.onWatchUpdated callback is provided, we want to call it\n // with only the Cache.WatchOptions objects affected by options.update,\n // but there might be dirty watchers already waiting to be broadcast that\n // have nothing to do with the update. To prevent including those watchers\n // in the post-update broadcast, we perform this initial broadcast to\n // collect the dirty watchers, so we can re-dirty them later, after the\n // post-update broadcast, allowing them to receive their pending\n // broadcasts the next time broadcastWatches is called, just as they would\n // if we never called cache.batch.\n this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch) {\n alreadyDirty.add(watch);\n return false;\n } }));\n }\n if (typeof optimistic === \"string\") {\n // Note that there can be multiple layers with the same optimistic ID.\n // When removeOptimistic(id) is called for that id, all matching layers\n // will be removed, and the remaining layers will be reapplied.\n this.optimisticData = this.optimisticData.addLayer(optimistic, perform);\n }\n else if (optimistic === false) {\n // Ensure both this.data and this.optimisticData refer to the root\n // (non-optimistic) layer of the cache during the update. Note that\n // this.data could be a Layer if we are currently executing an optimistic\n // update function, but otherwise will always be an EntityStore.Root\n // instance.\n perform(this.data);\n }\n else {\n // Otherwise, leave this.data and this.optimisticData unchanged and run\n // the update with broadcast batching.\n perform();\n }\n if (typeof removeOptimistic === \"string\") {\n this.optimisticData = this.optimisticData.removeLayer(removeOptimistic);\n }\n // Note: if this.txCount > 0, then alreadyDirty.size === 0, so this code\n // takes the else branch and calls this.broadcastWatches(options), which\n // does nothing when this.txCount > 0.\n if (onWatchUpdated && alreadyDirty.size) {\n this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch, diff) {\n var result = onWatchUpdated.call(this, watch, diff);\n if (result !== false) {\n // Since onWatchUpdated did not return false, this diff is\n // about to be broadcast to watch.callback, so we don't need\n // to re-dirty it with the other alreadyDirty watches below.\n alreadyDirty.delete(watch);\n }\n return result;\n } }));\n // Silently re-dirty any watches that were already dirty before the update\n // was performed, and were not broadcast just now.\n if (alreadyDirty.size) {\n alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); });\n }\n }\n else {\n // If alreadyDirty is empty or we don't have an onWatchUpdated\n // function, we don't need to go to the trouble of wrapping\n // options.onWatchUpdated.\n this.broadcastWatches(options);\n }\n return updateResult;\n };\n InMemoryCache.prototype.performTransaction = function (update, optimisticId) {\n return this.batch({\n update: update,\n optimistic: optimisticId || optimisticId !== null,\n });\n };\n InMemoryCache.prototype.transformDocument = function (document) {\n return this.addTypenameToDocument(this.addFragmentsToDocument(document));\n };\n InMemoryCache.prototype.broadcastWatches = function (options) {\n var _this = this;\n if (!this.txCount) {\n this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); });\n }\n };\n InMemoryCache.prototype.addFragmentsToDocument = function (document) {\n var fragments = this.config.fragments;\n return fragments ? fragments.transform(document) : document;\n };\n InMemoryCache.prototype.addTypenameToDocument = function (document) {\n if (this.addTypename) {\n return this.addTypenameTransform.transformDocument(document);\n }\n return document;\n };\n // This method is wrapped by maybeBroadcastWatch, which is called by\n // broadcastWatches, so that we compute and broadcast results only when\n // the data that would be broadcast might have changed. It would be\n // simpler to check for changes after recomputing a result but before\n // broadcasting it, but this wrapping approach allows us to skip both\n // the recomputation and the broadcast, in most cases.\n InMemoryCache.prototype.broadcastWatch = function (c, options) {\n var lastDiff = c.lastDiff;\n // Both WatchOptions and DiffOptions extend ReadOptions, and DiffOptions\n // currently requires no additional properties, so we can use c (a\n // WatchOptions object) as DiffOptions, without having to allocate a new\n // object, and without having to enumerate the relevant properties (query,\n // variables, etc.) explicitly. There will be some additional properties\n // (lastDiff, callback, etc.), but cache.diff ignores them.\n var diff = this.diff(c);\n if (options) {\n if (c.optimistic && typeof options.optimistic === \"string\") {\n diff.fromOptimisticTransaction = true;\n }\n if (options.onWatchUpdated &&\n options.onWatchUpdated.call(this, c, diff, lastDiff) === false) {\n // Returning false from the onWatchUpdated callback will prevent\n // calling c.callback(diff) for this watcher.\n return;\n }\n }\n if (!lastDiff || !equal(lastDiff.result, diff.result)) {\n c.callback((c.lastDiff = diff), lastDiff);\n }\n };\n return InMemoryCache;\n}(ApolloCache));\nexport { InMemoryCache };\nif (globalThis.__DEV__ !== false) {\n InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals;\n}\n//# sourceMappingURL=inMemoryCache.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { visit } from \"graphql\";\nimport { wrap } from \"optimism\";\nimport { cacheSizes, getFragmentDefinitions, } from \"../../utilities/index.js\";\nimport { WeakCache } from \"@wry/caches\";\n// As long as createFragmentRegistry is not imported or used, the\n// FragmentRegistry example implementation provided below should not be bundled\n// (by tree-shaking bundlers like Rollup), because the implementation of\n// InMemoryCache refers only to the TypeScript interface FragmentRegistryAPI,\n// never the concrete implementation FragmentRegistry (which is deliberately not\n// exported from this module).\nexport function createFragmentRegistry() {\n var fragments = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fragments[_i] = arguments[_i];\n }\n return new (FragmentRegistry.bind.apply(FragmentRegistry, __spreadArray([void 0], fragments, false)))();\n}\nvar FragmentRegistry = /** @class */ (function () {\n // Call `createFragmentRegistry` instead of invoking the\n // FragmentRegistry constructor directly. This reserves the constructor for\n // future configuration of the FragmentRegistry.\n function FragmentRegistry() {\n var fragments = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fragments[_i] = arguments[_i];\n }\n this.registry = Object.create(null);\n this.resetCaches();\n if (fragments.length) {\n this.register.apply(this, fragments);\n }\n }\n FragmentRegistry.prototype.register = function () {\n var _this = this;\n var fragments = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fragments[_i] = arguments[_i];\n }\n var definitions = new Map();\n fragments.forEach(function (doc) {\n getFragmentDefinitions(doc).forEach(function (node) {\n definitions.set(node.name.value, node);\n });\n });\n definitions.forEach(function (node, name) {\n if (node !== _this.registry[name]) {\n _this.registry[name] = node;\n _this.invalidate(name);\n }\n });\n return this;\n };\n // Overridden in the resetCaches method below.\n FragmentRegistry.prototype.invalidate = function (name) { };\n FragmentRegistry.prototype.resetCaches = function () {\n var proto = FragmentRegistry.prototype;\n this.invalidate = (this.lookup = wrap(proto.lookup.bind(this), {\n makeCacheKey: function (arg) { return arg; },\n max: cacheSizes[\"fragmentRegistry.lookup\"] ||\n 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n })).dirty; // This dirty function is bound to the wrapped lookup method.\n this.transform = wrap(proto.transform.bind(this), {\n cache: WeakCache,\n max: cacheSizes[\"fragmentRegistry.transform\"] ||\n 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n });\n this.findFragmentSpreads = wrap(proto.findFragmentSpreads.bind(this), {\n cache: WeakCache,\n max: cacheSizes[\"fragmentRegistry.findFragmentSpreads\"] ||\n 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n });\n };\n /*\n * Note:\n * This method is only memoized so it can serve as a dependency to `tranform`,\n * so calling `invalidate` will invalidate cache entries for `transform`.\n */\n FragmentRegistry.prototype.lookup = function (fragmentName) {\n return this.registry[fragmentName] || null;\n };\n FragmentRegistry.prototype.transform = function (document) {\n var _this = this;\n var defined = new Map();\n getFragmentDefinitions(document).forEach(function (def) {\n defined.set(def.name.value, def);\n });\n var unbound = new Set();\n var enqueue = function (spreadName) {\n if (!defined.has(spreadName)) {\n unbound.add(spreadName);\n }\n };\n var enqueueChildSpreads = function (node) {\n return Object.keys(_this.findFragmentSpreads(node)).forEach(enqueue);\n };\n enqueueChildSpreads(document);\n var missing = [];\n var map = Object.create(null);\n // This Set forEach loop can be extended during iteration by adding\n // additional strings to the unbound set.\n unbound.forEach(function (fragmentName) {\n var knownFragmentDef = defined.get(fragmentName);\n if (knownFragmentDef) {\n enqueueChildSpreads((map[fragmentName] = knownFragmentDef));\n }\n else {\n missing.push(fragmentName);\n var def = _this.lookup(fragmentName);\n if (def) {\n enqueueChildSpreads((map[fragmentName] = def));\n }\n }\n });\n if (missing.length) {\n var defsToAppend_1 = [];\n missing.forEach(function (name) {\n var def = map[name];\n if (def) {\n defsToAppend_1.push(def);\n }\n });\n if (defsToAppend_1.length) {\n document = __assign(__assign({}, document), { definitions: document.definitions.concat(defsToAppend_1) });\n }\n }\n return document;\n };\n FragmentRegistry.prototype.findFragmentSpreads = function (root) {\n var spreads = Object.create(null);\n visit(root, {\n FragmentSpread: function (node) {\n spreads[node.name.value] = node;\n },\n });\n return spreads;\n };\n return FragmentRegistry;\n}());\n//# sourceMappingURL=fragmentRegistry.js.map"],"names":["__assign","__spreadArray","wrap","getFragmentQueryDocument","cacheSizes","WeakCache","__rest","Cache","__extends","compact","isReference","isNonNullObject","isArray","isField","shouldInclude","resultKeyNameFromField","DeepMerger","createFragmentMap","getFragmentDefinitions","EntityStore","maybeDeepFreeze","makeReference","invariant","dep","Trie","canUseWeakMap","equal","isObjectOrArray","canUseWeakSet","getDefaultValues","getQueryDefinition","getMainDefinition","canonicalStringify","addTypenameToDocument","getFragmentFromSelection","Kind","newInvariantError","mergeDeepArray","Slot","isNonEmptyArray","argumentsObjectFromField","storeKeyNameFromField","getStoreKeyName","stringifyForDisplay","getOperationDefinition","getTypenameFromResult","cloneDeep","DocumentTransform","print","visit"],"mappings":";;;;;;;;;;;;;AAiBO,IAAI,+BAA+B,GAAG,UAAU,CAAC,OAAO,KAAK,KAAK;AACzE,IAAI,gCAAgC;AACpC,MAAM,SAAS,CAAC;AAKT,IAAI,6BA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AC;AACN,IAAI,gBAAgB,CAAC,SAAS,CAAC,mBAAmB,GAAG,UAAU,IAAI,EAAE;AACrE,QAAQ,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1C,QAAQiD,aAAK,CAAC,IAAI,EAAE;AACpB,YAAY,cAAc,EAAE,UAAU,IAAI,EAAE;AAC5C,gBAAgB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;AAChD,aAAa;AACb,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK,CAAC;AACN,IAAI,OAAO,gBAAgB,CAAC;AAC5B,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.native.js new file mode 100644 index 0000000..5917180 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/cache.cjs.native.js @@ -0,0 +1,2567 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../utilities/globals'); +var tslib = require('tslib'); +var optimism = require('optimism'); +var utilities = require('../utilities'); +var caches = require('@wry/caches'); +var equality = require('@wry/equality'); +var trie = require('@wry/trie'); +var graphql = require('graphql'); + +var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getInMemoryCacheMemoryInternals + : undefined; +var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloCacheMemoryInternals + : undefined; +function _getApolloCacheMemoryInternals() { + return { + cache: { + fragmentQueryDocuments: getWrapperInformation(this["getFragmentDoc"]), + }, + }; +} +function _getInMemoryCacheMemoryInternals() { + var fragments = this.config.fragments; + return tslib.__assign(tslib.__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this["addTypenameTransform"]), inMemoryCache: { + executeSelectionSet: getWrapperInformation(this["storeReader"]["executeSelectionSet"]), + executeSubSelectedArray: getWrapperInformation(this["storeReader"]["executeSubSelectedArray"]), + maybeBroadcastWatch: getWrapperInformation(this["maybeBroadcastWatch"]), + }, fragmentRegistry: { + findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads), + lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup), + transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform), + } }); +} +function isWrapper(f) { + return !!f && "dirtyKey" in f; +} +function getWrapperInformation(f) { + return isWrapper(f) ? f.size : undefined; +} +function isDefined(value) { + return value != null; +} +function transformInfo(transform) { + return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); }); +} +function recurseTransformInfo(transform) { + return transform ? + tslib.__spreadArray(tslib.__spreadArray([ + getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"]) + ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined) + : []; +} + +var ApolloCache = (function () { + function ApolloCache() { + this.assumeImmutableResults = false; + this.getFragmentDoc = optimism.wrap(utilities.getFragmentQueryDocument, { + max: utilities.cacheSizes["cache.fragmentQueryDocuments"] || + 1000 , + cache: caches.WeakCache, + }); + } + ApolloCache.prototype.batch = function (options) { + var _this = this; + var optimisticId = typeof options.optimistic === "string" ? options.optimistic + : options.optimistic === false ? null + : void 0; + var updateResult; + this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId); + return updateResult; + }; + ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) { + this.performTransaction(transaction, optimisticId); + }; + ApolloCache.prototype.transformDocument = function (document) { + return document; + }; + ApolloCache.prototype.transformForLink = function (document) { + return document; + }; + ApolloCache.prototype.identify = function (object) { + return; + }; + ApolloCache.prototype.gc = function () { + return []; + }; + ApolloCache.prototype.modify = function (options) { + return false; + }; + ApolloCache.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic: optimistic })); + }; + ApolloCache.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(tslib.__assign(tslib.__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic })); + }; + ApolloCache.prototype.writeQuery = function (_a) { + var id = _a.id, data = _a.data, options = tslib.__rest(_a, ["id", "data"]); + return this.write(Object.assign(options, { + dataId: id || "ROOT_QUERY", + result: data, + })); + }; + ApolloCache.prototype.writeFragment = function (_a) { + var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = tslib.__rest(_a, ["id", "data", "fragment", "fragmentName"]); + return this.write(Object.assign(options, { + query: this.getFragmentDoc(fragment, fragmentName), + dataId: id, + result: data, + })); + }; + ApolloCache.prototype.updateQuery = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readQuery(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeQuery(tslib.__assign(tslib.__assign({}, options), { data: data })); + return data; + }, + }); + }; + ApolloCache.prototype.updateFragment = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readFragment(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeFragment(tslib.__assign(tslib.__assign({}, options), { data: data })); + return data; + }, + }); + }; + return ApolloCache; +}()); +if (globalThis.__DEV__ !== false) { + ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals; +} + +exports.Cache = void 0; +(function (Cache) { +})(exports.Cache || (exports.Cache = {})); + +var MissingFieldError = (function (_super) { + tslib.__extends(MissingFieldError, _super); + function MissingFieldError(message, path, query, variables) { + var _a; + var _this = _super.call(this, message) || this; + _this.message = message; + _this.path = path; + _this.query = query; + _this.variables = variables; + if (Array.isArray(_this.path)) { + _this.missing = _this.message; + for (var i = _this.path.length - 1; i >= 0; --i) { + _this.missing = (_a = {}, _a[_this.path[i]] = _this.missing, _a); + } + } + else { + _this.missing = _this.path; + } + _this.__proto__ = MissingFieldError.prototype; + return _this; + } + return MissingFieldError; +}(Error)); + +var hasOwn = Object.prototype.hasOwnProperty; +function isNullish(value) { + return value === null || value === void 0; +} +function defaultDataIdFromObject(_a, context) { + var __typename = _a.__typename, id = _a.id, _id = _a._id; + if (typeof __typename === "string") { + if (context) { + context.keyObject = + !isNullish(id) ? { id: id } + : !isNullish(_id) ? { _id: _id } + : void 0; + } + if (isNullish(id) && !isNullish(_id)) { + id = _id; + } + if (!isNullish(id)) { + return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ? + id + : JSON.stringify(id)); + } + } +} +var defaultConfig = { + dataIdFromObject: defaultDataIdFromObject, + addTypename: true, + resultCaching: true, + canonizeResults: false, +}; +function normalizeConfig(config) { + return utilities.compact(defaultConfig, config); +} +function shouldCanonizeResults(config) { + var value = config.canonizeResults; + return value === void 0 ? defaultConfig.canonizeResults : value; +} +function getTypenameFromStoreObject(store, objectOrReference) { + return utilities.isReference(objectOrReference) ? + store.get(objectOrReference.__ref, "__typename") + : objectOrReference && objectOrReference.__typename; +} +var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i; +function fieldNameFromStoreName(storeFieldName) { + var match = storeFieldName.match(TypeOrFieldNameRegExp); + return match ? match[0] : storeFieldName; +} +function selectionSetMatchesResult(selectionSet, result, variables) { + if (utilities.isNonNullObject(result)) { + return utilities.isArray(result) ? + result.every(function (item) { + return selectionSetMatchesResult(selectionSet, item, variables); + }) + : selectionSet.selections.every(function (field) { + if (utilities.isField(field) && utilities.shouldInclude(field, variables)) { + var key = utilities.resultKeyNameFromField(field); + return (hasOwn.call(result, key) && + (!field.selectionSet || + selectionSetMatchesResult(field.selectionSet, result[key], variables))); + } + return true; + }); + } + return false; +} +function storeValueIsStoreObject(value) { + return utilities.isNonNullObject(value) && !utilities.isReference(value) && !utilities.isArray(value); +} +function makeProcessedFieldsMerger() { + return new utilities.DeepMerger(); +} +function extractFragmentContext(document, fragments) { + var fragmentMap = utilities.createFragmentMap(utilities.getFragmentDefinitions(document)); + return { + fragmentMap: fragmentMap, + lookupFragment: function (name) { + var def = fragmentMap[name]; + if (!def && fragments) { + def = fragments.lookup(name); + } + return def || null; + }, + }; +} + +var DELETE = Object.create(null); +var delModifier = function () { return DELETE; }; +var INVALIDATE = Object.create(null); +exports.EntityStore = (function () { + function EntityStore(policies, group) { + var _this = this; + this.policies = policies; + this.group = group; + this.data = Object.create(null); + this.rootIds = Object.create(null); + this.refs = Object.create(null); + this.getFieldValue = function (objectOrReference, storeFieldName) { + return utilities.maybeDeepFreeze(utilities.isReference(objectOrReference) ? + _this.get(objectOrReference.__ref, storeFieldName) + : objectOrReference && objectOrReference[storeFieldName]); + }; + this.canRead = function (objOrRef) { + return utilities.isReference(objOrRef) ? + _this.has(objOrRef.__ref) + : typeof objOrRef === "object"; + }; + this.toReference = function (objOrIdOrRef, mergeIntoStore) { + if (typeof objOrIdOrRef === "string") { + return utilities.makeReference(objOrIdOrRef); + } + if (utilities.isReference(objOrIdOrRef)) { + return objOrIdOrRef; + } + var id = _this.policies.identify(objOrIdOrRef)[0]; + if (id) { + var ref = utilities.makeReference(id); + if (mergeIntoStore) { + _this.merge(id, objOrIdOrRef); + } + return ref; + } + }; + } + EntityStore.prototype.toObject = function () { + return tslib.__assign({}, this.data); + }; + EntityStore.prototype.has = function (dataId) { + return this.lookup(dataId, true) !== void 0; + }; + EntityStore.prototype.get = function (dataId, fieldName) { + this.group.depend(dataId, fieldName); + if (hasOwn.call(this.data, dataId)) { + var storeObject = this.data[dataId]; + if (storeObject && hasOwn.call(storeObject, fieldName)) { + return storeObject[fieldName]; + } + } + if (fieldName === "__typename" && + hasOwn.call(this.policies.rootTypenamesById, dataId)) { + return this.policies.rootTypenamesById[dataId]; + } + if (this instanceof Layer) { + return this.parent.get(dataId, fieldName); + } + }; + EntityStore.prototype.lookup = function (dataId, dependOnExistence) { + if (dependOnExistence) + this.group.depend(dataId, "__exists"); + if (hasOwn.call(this.data, dataId)) { + return this.data[dataId]; + } + if (this instanceof Layer) { + return this.parent.lookup(dataId, dependOnExistence); + } + if (this.policies.rootTypenamesById[dataId]) { + return Object.create(null); + } + }; + EntityStore.prototype.merge = function (older, newer) { + var _this = this; + var dataId; + if (utilities.isReference(older)) + older = older.__ref; + if (utilities.isReference(newer)) + newer = newer.__ref; + var existing = typeof older === "string" ? this.lookup((dataId = older)) : older; + var incoming = typeof newer === "string" ? this.lookup((dataId = newer)) : newer; + if (!incoming) + return; + globals.invariant(typeof dataId === "string", 1); + var merged = new utilities.DeepMerger(storeObjectReconciler).merge(existing, incoming); + this.data[dataId] = merged; + if (merged !== existing) { + delete this.refs[dataId]; + if (this.group.caching) { + var fieldsToDirty_1 = Object.create(null); + if (!existing) + fieldsToDirty_1.__exists = 1; + Object.keys(incoming).forEach(function (storeFieldName) { + if (!existing || + existing[storeFieldName] !== merged[storeFieldName]) { + fieldsToDirty_1[storeFieldName] = 1; + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName && + !_this.policies.hasKeyArgs(merged.__typename, fieldName)) { + fieldsToDirty_1[fieldName] = 1; + } + if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) { + delete merged[storeFieldName]; + } + } + }); + if (fieldsToDirty_1.__typename && + !(existing && existing.__typename) && + this.policies.rootTypenamesById[dataId] === merged.__typename) { + delete fieldsToDirty_1.__typename; + } + Object.keys(fieldsToDirty_1).forEach(function (fieldName) { + return _this.group.dirty(dataId, fieldName); + }); + } + } + }; + EntityStore.prototype.modify = function (dataId, fields) { + var _this = this; + var storeObject = this.lookup(dataId); + if (storeObject) { + var changedFields_1 = Object.create(null); + var needToMerge_1 = false; + var allDeleted_1 = true; + var sharedDetails_1 = { + DELETE: DELETE, + INVALIDATE: INVALIDATE, + isReference: utilities.isReference, + toReference: this.toReference, + canRead: this.canRead, + readField: function (fieldNameOrOptions, from) { + return _this.policies.readField(typeof fieldNameOrOptions === "string" ? + { + fieldName: fieldNameOrOptions, + from: from || utilities.makeReference(dataId), + } + : fieldNameOrOptions, { store: _this }); + }, + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + var fieldName = fieldNameFromStoreName(storeFieldName); + var fieldValue = storeObject[storeFieldName]; + if (fieldValue === void 0) + return; + var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]); + if (modify) { + var newValue = modify === delModifier ? DELETE : (modify(utilities.maybeDeepFreeze(fieldValue), tslib.__assign(tslib.__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }))); + if (newValue === INVALIDATE) { + _this.group.dirty(dataId, storeFieldName); + } + else { + if (newValue === DELETE) + newValue = void 0; + if (newValue !== fieldValue) { + changedFields_1[storeFieldName] = newValue; + needToMerge_1 = true; + fieldValue = newValue; + if (globalThis.__DEV__ !== false) { + var checkReference = function (ref) { + if (_this.lookup(ref.__ref) === undefined) { + globalThis.__DEV__ !== false && globals.invariant.warn(2, ref); + return true; + } + }; + if (utilities.isReference(newValue)) { + checkReference(newValue); + } + else if (Array.isArray(newValue)) { + var seenReference = false; + var someNonReference = void 0; + for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) { + var value = newValue_1[_i]; + if (utilities.isReference(value)) { + seenReference = true; + if (checkReference(value)) + break; + } + else { + if (typeof value === "object" && !!value) { + var id = _this.policies.identify(value)[0]; + if (id) { + someNonReference = value; + } + } + } + if (seenReference && someNonReference !== undefined) { + globalThis.__DEV__ !== false && globals.invariant.warn(3, someNonReference); + break; + } + } + } + } + } + } + } + if (fieldValue !== void 0) { + allDeleted_1 = false; + } + }); + if (needToMerge_1) { + this.merge(dataId, changedFields_1); + if (allDeleted_1) { + if (this instanceof Layer) { + this.data[dataId] = void 0; + } + else { + delete this.data[dataId]; + } + this.group.dirty(dataId, "__exists"); + } + return true; + } + } + return false; + }; + EntityStore.prototype.delete = function (dataId, fieldName, args) { + var _a; + var storeObject = this.lookup(dataId); + if (storeObject) { + var typename = this.getFieldValue(storeObject, "__typename"); + var storeFieldName = fieldName && args ? + this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args }) + : fieldName; + return this.modify(dataId, storeFieldName ? (_a = {}, + _a[storeFieldName] = delModifier, + _a) : delModifier); + } + return false; + }; + EntityStore.prototype.evict = function (options, limit) { + var evicted = false; + if (options.id) { + if (hasOwn.call(this.data, options.id)) { + evicted = this.delete(options.id, options.fieldName, options.args); + } + if (this instanceof Layer && this !== limit) { + evicted = this.parent.evict(options, limit) || evicted; + } + if (options.fieldName || evicted) { + this.group.dirty(options.id, options.fieldName || "__exists"); + } + } + return evicted; + }; + EntityStore.prototype.clear = function () { + this.replace(null); + }; + EntityStore.prototype.extract = function () { + var _this = this; + var obj = this.toObject(); + var extraRootIds = []; + this.getRootIdSet().forEach(function (id) { + if (!hasOwn.call(_this.policies.rootTypenamesById, id)) { + extraRootIds.push(id); + } + }); + if (extraRootIds.length) { + obj.__META = { extraRootIds: extraRootIds.sort() }; + } + return obj; + }; + EntityStore.prototype.replace = function (newData) { + var _this = this; + Object.keys(this.data).forEach(function (dataId) { + if (!(newData && hasOwn.call(newData, dataId))) { + _this.delete(dataId); + } + }); + if (newData) { + var __META = newData.__META, rest_1 = tslib.__rest(newData, ["__META"]); + Object.keys(rest_1).forEach(function (dataId) { + _this.merge(dataId, rest_1[dataId]); + }); + if (__META) { + __META.extraRootIds.forEach(this.retain, this); + } + } + }; + EntityStore.prototype.retain = function (rootId) { + return (this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1); + }; + EntityStore.prototype.release = function (rootId) { + if (this.rootIds[rootId] > 0) { + var count = --this.rootIds[rootId]; + if (!count) + delete this.rootIds[rootId]; + return count; + } + return 0; + }; + EntityStore.prototype.getRootIdSet = function (ids) { + if (ids === void 0) { ids = new Set(); } + Object.keys(this.rootIds).forEach(ids.add, ids); + if (this instanceof Layer) { + this.parent.getRootIdSet(ids); + } + else { + Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids); + } + return ids; + }; + EntityStore.prototype.gc = function () { + var _this = this; + var ids = this.getRootIdSet(); + var snapshot = this.toObject(); + ids.forEach(function (id) { + if (hasOwn.call(snapshot, id)) { + Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids); + delete snapshot[id]; + } + }); + var idsToRemove = Object.keys(snapshot); + if (idsToRemove.length) { + var root_1 = this; + while (root_1 instanceof Layer) + root_1 = root_1.parent; + idsToRemove.forEach(function (id) { return root_1.delete(id); }); + } + return idsToRemove; + }; + EntityStore.prototype.findChildRefIds = function (dataId) { + if (!hasOwn.call(this.refs, dataId)) { + var found_1 = (this.refs[dataId] = Object.create(null)); + var root = this.data[dataId]; + if (!root) + return found_1; + var workSet_1 = new Set([root]); + workSet_1.forEach(function (obj) { + if (utilities.isReference(obj)) { + found_1[obj.__ref] = true; + } + if (utilities.isNonNullObject(obj)) { + Object.keys(obj).forEach(function (key) { + var child = obj[key]; + if (utilities.isNonNullObject(child)) { + workSet_1.add(child); + } + }); + } + }); + } + return this.refs[dataId]; + }; + EntityStore.prototype.makeCacheKey = function () { + return this.group.keyMaker.lookupArray(arguments); + }; + return EntityStore; +}()); +var CacheGroup = (function () { + function CacheGroup(caching, parent) { + if (parent === void 0) { parent = null; } + this.caching = caching; + this.parent = parent; + this.d = null; + this.resetCaching(); + } + CacheGroup.prototype.resetCaching = function () { + this.d = this.caching ? optimism.dep() : null; + this.keyMaker = new trie.Trie(utilities.canUseWeakMap); + }; + CacheGroup.prototype.depend = function (dataId, storeFieldName) { + if (this.d) { + this.d(makeDepKey(dataId, storeFieldName)); + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName) { + this.d(makeDepKey(dataId, fieldName)); + } + if (this.parent) { + this.parent.depend(dataId, storeFieldName); + } + } + }; + CacheGroup.prototype.dirty = function (dataId, storeFieldName) { + if (this.d) { + this.d.dirty(makeDepKey(dataId, storeFieldName), + storeFieldName === "__exists" ? "forget" : "setDirty"); + } + }; + return CacheGroup; +}()); +function makeDepKey(dataId, storeFieldName) { + return storeFieldName + "#" + dataId; +} +function maybeDependOnExistenceOfEntity(store, entityId) { + if (supportsResultCaching(store)) { + store.group.depend(entityId, "__exists"); + } +} +(function (EntityStore) { + var Root = (function (_super) { + tslib.__extends(Root, _super); + function Root(_a) { + var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed; + var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this; + _this.stump = new Stump(_this); + _this.storageTrie = new trie.Trie(utilities.canUseWeakMap); + if (seed) + _this.replace(seed); + return _this; + } + Root.prototype.addLayer = function (layerId, replay) { + return this.stump.addLayer(layerId, replay); + }; + Root.prototype.removeLayer = function () { + return this; + }; + Root.prototype.getStorage = function () { + return this.storageTrie.lookupArray(arguments); + }; + return Root; + }(EntityStore)); + EntityStore.Root = Root; +})(exports.EntityStore || (exports.EntityStore = {})); +var Layer = (function (_super) { + tslib.__extends(Layer, _super); + function Layer(id, parent, replay, group) { + var _this = _super.call(this, parent.policies, group) || this; + _this.id = id; + _this.parent = parent; + _this.replay = replay; + _this.group = group; + replay(_this); + return _this; + } + Layer.prototype.addLayer = function (layerId, replay) { + return new Layer(layerId, this, replay, this.group); + }; + Layer.prototype.removeLayer = function (layerId) { + var _this = this; + var parent = this.parent.removeLayer(layerId); + if (layerId === this.id) { + if (this.group.caching) { + Object.keys(this.data).forEach(function (dataId) { + var ownStoreObject = _this.data[dataId]; + var parentStoreObject = parent["lookup"](dataId); + if (!parentStoreObject) { + _this.delete(dataId); + } + else if (!ownStoreObject) { + _this.group.dirty(dataId, "__exists"); + Object.keys(parentStoreObject).forEach(function (storeFieldName) { + _this.group.dirty(dataId, storeFieldName); + }); + } + else if (ownStoreObject !== parentStoreObject) { + Object.keys(ownStoreObject).forEach(function (storeFieldName) { + if (!equality.equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) { + _this.group.dirty(dataId, storeFieldName); + } + }); + } + }); + } + return parent; + } + if (parent === this.parent) + return this; + return parent.addLayer(this.id, this.replay); + }; + Layer.prototype.toObject = function () { + return tslib.__assign(tslib.__assign({}, this.parent.toObject()), this.data); + }; + Layer.prototype.findChildRefIds = function (dataId) { + var fromParent = this.parent.findChildRefIds(dataId); + return hasOwn.call(this.data, dataId) ? tslib.__assign(tslib.__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent; + }; + Layer.prototype.getStorage = function () { + var p = this.parent; + while (p.parent) + p = p.parent; + return p.getStorage.apply(p, + arguments); + }; + return Layer; +}(exports.EntityStore)); +var Stump = (function (_super) { + tslib.__extends(Stump, _super); + function Stump(root) { + return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this; + } + Stump.prototype.removeLayer = function () { + return this; + }; + Stump.prototype.merge = function (older, newer) { + return this.parent.merge(older, newer); + }; + return Stump; +}(Layer)); +function storeObjectReconciler(existingObject, incomingObject, property) { + var existingValue = existingObject[property]; + var incomingValue = incomingObject[property]; + return equality.equal(existingValue, incomingValue) ? existingValue : incomingValue; +} +function supportsResultCaching(store) { + return !!(store instanceof exports.EntityStore && store.group.caching); +} + +function shallowCopy(value) { + if (utilities.isNonNullObject(value)) { + return utilities.isArray(value) ? + value.slice(0) + : tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + return value; +} +var ObjectCanon = (function () { + function ObjectCanon() { + this.known = new (utilities.canUseWeakSet ? WeakSet : Set)(); + this.pool = new trie.Trie(utilities.canUseWeakMap); + this.passes = new WeakMap(); + this.keysByJSON = new Map(); + this.empty = this.admit({}); + } + ObjectCanon.prototype.isKnown = function (value) { + return utilities.isNonNullObject(value) && this.known.has(value); + }; + ObjectCanon.prototype.pass = function (value) { + if (utilities.isNonNullObject(value)) { + var copy = shallowCopy(value); + this.passes.set(copy, value); + return copy; + } + return value; + }; + ObjectCanon.prototype.admit = function (value) { + var _this = this; + if (utilities.isNonNullObject(value)) { + var original = this.passes.get(value); + if (original) + return original; + var proto = Object.getPrototypeOf(value); + switch (proto) { + case Array.prototype: { + if (this.known.has(value)) + return value; + var array = value.map(this.admit, this); + var node = this.pool.lookupArray(array); + if (!node.array) { + this.known.add((node.array = array)); + if (globalThis.__DEV__ !== false) { + Object.freeze(array); + } + } + return node.array; + } + case null: + case Object.prototype: { + if (this.known.has(value)) + return value; + var proto_1 = Object.getPrototypeOf(value); + var array_1 = [proto_1]; + var keys = this.sortedKeys(value); + array_1.push(keys.json); + var firstValueIndex_1 = array_1.length; + keys.sorted.forEach(function (key) { + array_1.push(_this.admit(value[key])); + }); + var node = this.pool.lookupArray(array_1); + if (!node.object) { + var obj_1 = (node.object = Object.create(proto_1)); + this.known.add(obj_1); + keys.sorted.forEach(function (key, i) { + obj_1[key] = array_1[firstValueIndex_1 + i]; + }); + if (globalThis.__DEV__ !== false) { + Object.freeze(obj_1); + } + } + return node.object; + } + } + } + return value; + }; + ObjectCanon.prototype.sortedKeys = function (obj) { + var keys = Object.keys(obj); + var node = this.pool.lookupArray(keys); + if (!node.keys) { + keys.sort(); + var json = JSON.stringify(keys); + if (!(node.keys = this.keysByJSON.get(json))) { + this.keysByJSON.set(json, (node.keys = { sorted: keys, json: json })); + } + } + return node.keys; + }; + return ObjectCanon; +}()); + +function execSelectionSetKeyArgs(options) { + return [ + options.selectionSet, + options.objectOrReference, + options.context, + options.context.canonizeResults, + ]; +} +var StoreReader = (function () { + function StoreReader(config) { + var _this = this; + this.knownResults = new (utilities.canUseWeakMap ? WeakMap : Map)(); + this.config = utilities.compact(config, { + addTypename: config.addTypename !== false, + canonizeResults: shouldCanonizeResults(config), + }); + this.canon = config.canon || new ObjectCanon(); + this.executeSelectionSet = optimism.wrap(function (options) { + var _a; + var canonizeResults = options.context.canonizeResults; + var peekArgs = execSelectionSetKeyArgs(options); + peekArgs[3] = !canonizeResults; + var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs); + if (other) { + if (canonizeResults) { + return tslib.__assign(tslib.__assign({}, other), { + result: _this.canon.admit(other.result) }); + } + return other; + } + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSelectionSetImpl(options); + }, { + max: this.config.resultCacheMaxSize || + utilities.cacheSizes["inMemoryCache.executeSelectionSet"] || + 50000 , + keyArgs: execSelectionSetKeyArgs, + makeCacheKey: function (selectionSet, parent, context, canonizeResults) { + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(selectionSet, utilities.isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults); + } + }, + }); + this.executeSubSelectedArray = optimism.wrap(function (options) { + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSubSelectedArrayImpl(options); + }, { + max: this.config.resultCacheMaxSize || + utilities.cacheSizes["inMemoryCache.executeSubSelectedArray"] || + 10000 , + makeCacheKey: function (_a) { + var field = _a.field, array = _a.array, context = _a.context; + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(field, array, context.varString); + } + }, + }); + } + StoreReader.prototype.resetCanon = function () { + this.canon = new ObjectCanon(); + }; + StoreReader.prototype.diffQueryAgainstStore = function (_a) { + var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? "ROOT_QUERY" : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d; + var policies = this.config.cache.policies; + variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(utilities.getQueryDefinition(query))), variables); + var rootRef = utilities.makeReference(rootId); + var execResult = this.executeSelectionSet({ + selectionSet: utilities.getMainDefinition(query).selectionSet, + objectOrReference: rootRef, + enclosingRef: rootRef, + context: tslib.__assign({ store: store, query: query, policies: policies, variables: variables, varString: utilities.canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)), + }); + var missing; + if (execResult.missing) { + missing = [ + new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables), + ]; + if (!returnPartialData) { + throw missing[0]; + } + } + return { + result: execResult.result, + complete: !missing, + missing: missing, + }; + }; + StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) { + if (supportsResultCaching(context.store) && + this.knownResults.get(result) === selectionSet) { + var latest = this.executeSelectionSet.peek(selectionSet, parent, context, + this.canon.isKnown(result)); + if (latest && result === latest.result) { + return true; + } + } + return false; + }; + StoreReader.prototype.execSelectionSetImpl = function (_a) { + var _this = this; + var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context; + if (utilities.isReference(objectOrReference) && + !context.policies.rootTypenamesById[objectOrReference.__ref] && + !context.store.has(objectOrReference.__ref)) { + return { + result: this.canon.empty, + missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"), + }; + } + var variables = context.variables, policies = context.policies, store = context.store; + var typename = store.getFieldValue(objectOrReference, "__typename"); + var objectsToMerge = []; + var missing; + var missingMerger = new utilities.DeepMerger(); + if (this.config.addTypename && + typeof typename === "string" && + !policies.rootIdsByTypename[typename]) { + objectsToMerge.push({ __typename: typename }); + } + function handleMissing(result, resultName) { + var _a; + if (result.missing) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = result.missing, + _a)); + } + return result.result; + } + var workSet = new Set(selectionSet.selections); + workSet.forEach(function (selection) { + var _a, _b; + if (!utilities.shouldInclude(selection, variables)) + return; + if (utilities.isField(selection)) { + var fieldValue = policies.readField({ + fieldName: selection.name.value, + field: selection, + variables: context.variables, + from: objectOrReference, + }, context); + var resultName = utilities.resultKeyNameFromField(selection); + if (fieldValue === void 0) { + if (!utilities.addTypenameToDocument.added(selection)) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference) ? + objectOrReference.__ref + " object" + : "object " + JSON.stringify(objectOrReference, null, 2)), + _a)); + } + } + else if (utilities.isArray(fieldValue)) { + fieldValue = handleMissing(_this.executeSubSelectedArray({ + field: selection, + array: fieldValue, + enclosingRef: enclosingRef, + context: context, + }), resultName); + } + else if (!selection.selectionSet) { + if (context.canonizeResults) { + fieldValue = _this.canon.pass(fieldValue); + } + } + else if (fieldValue != null) { + fieldValue = handleMissing(_this.executeSelectionSet({ + selectionSet: selection.selectionSet, + objectOrReference: fieldValue, + enclosingRef: utilities.isReference(fieldValue) ? fieldValue : enclosingRef, + context: context, + }), resultName); + } + if (fieldValue !== void 0) { + objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b)); + } + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) { + throw globals.newInvariantError(9, selection.name.value); + } + if (fragment && policies.fragmentMatches(fragment, typename)) { + fragment.selectionSet.selections.forEach(workSet.add, workSet); + } + } + }); + var result = utilities.mergeDeepArray(objectsToMerge); + var finalResult = { result: result, missing: missing }; + var frozen = context.canonizeResults ? + this.canon.admit(finalResult) + : utilities.maybeDeepFreeze(finalResult); + if (frozen.result) { + this.knownResults.set(frozen.result, selectionSet); + } + return frozen; + }; + StoreReader.prototype.execSubSelectedArrayImpl = function (_a) { + var _this = this; + var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context; + var missing; + var missingMerger = new utilities.DeepMerger(); + function handleMissing(childResult, i) { + var _a; + if (childResult.missing) { + missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a)); + } + return childResult.result; + } + if (field.selectionSet) { + array = array.filter(context.store.canRead); + } + array = array.map(function (item, i) { + if (item === null) { + return null; + } + if (utilities.isArray(item)) { + return handleMissing(_this.executeSubSelectedArray({ + field: field, + array: item, + enclosingRef: enclosingRef, + context: context, + }), i); + } + if (field.selectionSet) { + return handleMissing(_this.executeSelectionSet({ + selectionSet: field.selectionSet, + objectOrReference: item, + enclosingRef: utilities.isReference(item) ? item : enclosingRef, + context: context, + }), i); + } + if (globalThis.__DEV__ !== false) { + assertSelectionSetForIdValue(context.store, field, item); + } + return item; + }); + return { + result: context.canonizeResults ? this.canon.admit(array) : array, + missing: missing, + }; + }; + return StoreReader; +}()); +function firstMissing(tree) { + try { + JSON.stringify(tree, function (_, value) { + if (typeof value === "string") + throw value; + return value; + }); + } + catch (result) { + return result; + } +} +function assertSelectionSetForIdValue(store, field, fieldValue) { + if (!field.selectionSet) { + var workSet_1 = new Set([fieldValue]); + workSet_1.forEach(function (value) { + if (utilities.isNonNullObject(value)) { + globals.invariant( + !utilities.isReference(value), + 10, + getTypenameFromStoreObject(store, value), + field.name.value + ); + Object.values(value).forEach(workSet_1.add, workSet_1); + } + }); + } +} + +var cacheSlot = new optimism.Slot(); +var cacheInfoMap = new WeakMap(); +function getCacheInfo(cache) { + var info = cacheInfoMap.get(cache); + if (!info) { + cacheInfoMap.set(cache, (info = { + vars: new Set(), + dep: optimism.dep(), + })); + } + return info; +} +function forgetCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); }); +} +function recallCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); }); +} +function makeVar(value) { + var caches = new Set(); + var listeners = new Set(); + var rv = function (newValue) { + if (arguments.length > 0) { + if (value !== newValue) { + value = newValue; + caches.forEach(function (cache) { + getCacheInfo(cache).dep.dirty(rv); + broadcast(cache); + }); + var oldListeners = Array.from(listeners); + listeners.clear(); + oldListeners.forEach(function (listener) { return listener(value); }); + } + } + else { + var cache = cacheSlot.getValue(); + if (cache) { + attach(cache); + getCacheInfo(cache).dep(rv); + } + } + return value; + }; + rv.onNextChange = function (listener) { + listeners.add(listener); + return function () { + listeners.delete(listener); + }; + }; + var attach = (rv.attachCache = function (cache) { + caches.add(cache); + getCacheInfo(cache).vars.add(rv); + return rv; + }); + rv.forgetCache = function (cache) { return caches.delete(cache); }; + return rv; +} +function broadcast(cache) { + if (cache.broadcastWatches) { + cache.broadcastWatches(); + } +} + +var specifierInfoCache = Object.create(null); +function lookupSpecifierInfo(spec) { + var cacheKey = JSON.stringify(spec); + return (specifierInfoCache[cacheKey] || + (specifierInfoCache[cacheKey] = Object.create(null))); +} +function keyFieldsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyFieldsFn || (info.keyFieldsFn = function (object, context) { + var extract = function (from, key) { + return context.readField(key, from); + }; + var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) { + var extracted = extractKeyPath(context.storeObject, schemaKeyPath, + extract); + if (extracted === void 0 && + object !== context.storeObject && + hasOwn.call(object, schemaKeyPath[0])) { + extracted = extractKeyPath(object, schemaKeyPath, extractKey); + } + globals.invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object); + return extracted; + })); + return "".concat(context.typename, ":").concat(JSON.stringify(keyObject)); + })); +} +function keyArgsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyArgsFn || + (info.keyArgsFn = function (args, _a) { + var field = _a.field, variables = _a.variables, fieldName = _a.fieldName; + var collected = collectSpecifierPaths(specifier, function (keyPath) { + var firstKey = keyPath[0]; + var firstChar = firstKey.charAt(0); + if (firstChar === "@") { + if (field && utilities.isNonEmptyArray(field.directives)) { + var directiveName_1 = firstKey.slice(1); + var d = field.directives.find(function (d) { return d.name.value === directiveName_1; }); + var directiveArgs = d && utilities.argumentsObjectFromField(d, variables); + return (directiveArgs && + extractKeyPath(directiveArgs, + keyPath.slice(1))); + } + return; + } + if (firstChar === "$") { + var variableName = firstKey.slice(1); + if (variables && hasOwn.call(variables, variableName)) { + var varKeyPath = keyPath.slice(0); + varKeyPath[0] = variableName; + return extractKeyPath(variables, varKeyPath); + } + return; + } + if (args) { + return extractKeyPath(args, keyPath); + } + }); + var suffix = JSON.stringify(collected); + if (args || suffix !== "{}") { + fieldName += ":" + suffix; + } + return fieldName; + })); +} +function collectSpecifierPaths(specifier, extractor) { + var merger = new utilities.DeepMerger(); + return getSpecifierPaths(specifier).reduce(function (collected, path) { + var _a; + var toMerge = extractor(path); + if (toMerge !== void 0) { + for (var i = path.length - 1; i >= 0; --i) { + toMerge = (_a = {}, _a[path[i]] = toMerge, _a); + } + collected = merger.merge(collected, toMerge); + } + return collected; + }, Object.create(null)); +} +function getSpecifierPaths(spec) { + var info = lookupSpecifierInfo(spec); + if (!info.paths) { + var paths_1 = (info.paths = []); + var currentPath_1 = []; + spec.forEach(function (s, i) { + if (utilities.isArray(s)) { + getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); }); + currentPath_1.length = 0; + } + else { + currentPath_1.push(s); + if (!utilities.isArray(spec[i + 1])) { + paths_1.push(currentPath_1.slice(0)); + currentPath_1.length = 0; + } + } + }); + } + return info.paths; +} +function extractKey(object, key) { + return object[key]; +} +function extractKeyPath(object, path, extract) { + extract = extract || extractKey; + return normalize(path.reduce(function reducer(obj, key) { + return utilities.isArray(obj) ? + obj.map(function (child) { return reducer(child, key); }) + : obj && extract(obj, key); + }, object)); +} +function normalize(value) { + if (utilities.isNonNullObject(value)) { + if (utilities.isArray(value)) { + return value.map(normalize); + } + return collectSpecifierPaths(Object.keys(value).sort(), function (path) { + return extractKeyPath(value, path); + }); + } + return value; +} + +function argsFromFieldSpecifier(spec) { + return (spec.args !== void 0 ? spec.args + : spec.field ? utilities.argumentsObjectFromField(spec.field, spec.variables) + : null); +} +var nullKeyFieldsFn = function () { return void 0; }; +var simpleKeyArgsFn = function (_args, context) { return context.fieldName; }; +var mergeTrueFn = function (existing, incoming, _a) { + var mergeObjects = _a.mergeObjects; + return mergeObjects(existing, incoming); +}; +var mergeFalseFn = function (_, incoming) { return incoming; }; +var Policies = (function () { + function Policies(config) { + this.config = config; + this.typePolicies = Object.create(null); + this.toBeAdded = Object.create(null); + this.supertypeMap = new Map(); + this.fuzzySubtypes = new Map(); + this.rootIdsByTypename = Object.create(null); + this.rootTypenamesById = Object.create(null); + this.usingPossibleTypes = false; + this.config = tslib.__assign({ dataIdFromObject: defaultDataIdFromObject }, config); + this.cache = this.config.cache; + this.setRootTypename("Query"); + this.setRootTypename("Mutation"); + this.setRootTypename("Subscription"); + if (config.possibleTypes) { + this.addPossibleTypes(config.possibleTypes); + } + if (config.typePolicies) { + this.addTypePolicies(config.typePolicies); + } + } + Policies.prototype.identify = function (object, partialContext) { + var _a; + var policies = this; + var typename = (partialContext && + (partialContext.typename || ((_a = partialContext.storeObject) === null || _a === void 0 ? void 0 : _a.__typename))) || + object.__typename; + if (typename === this.rootTypenamesById.ROOT_QUERY) { + return ["ROOT_QUERY"]; + } + var storeObject = (partialContext && partialContext.storeObject) || object; + var context = tslib.__assign(tslib.__assign({}, partialContext), { typename: typename, storeObject: storeObject, readField: (partialContext && partialContext.readField) || + function () { + var options = normalizeReadFieldOptions(arguments, storeObject); + return policies.readField(options, { + store: policies.cache["data"], + variables: options.variables, + }); + } }); + var id; + var policy = typename && this.getTypePolicy(typename); + var keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject; + while (keyFn) { + var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context); + if (utilities.isArray(specifierOrId)) { + keyFn = keyFieldsFnFromSpecifier(specifierOrId); + } + else { + id = specifierOrId; + break; + } + } + id = id ? String(id) : void 0; + return context.keyObject ? [id, context.keyObject] : [id]; + }; + Policies.prototype.addTypePolicies = function (typePolicies) { + var _this = this; + Object.keys(typePolicies).forEach(function (typename) { + var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = tslib.__rest(_a, ["queryType", "mutationType", "subscriptionType"]); + if (queryType) + _this.setRootTypename("Query", typename); + if (mutationType) + _this.setRootTypename("Mutation", typename); + if (subscriptionType) + _this.setRootTypename("Subscription", typename); + if (hasOwn.call(_this.toBeAdded, typename)) { + _this.toBeAdded[typename].push(incoming); + } + else { + _this.toBeAdded[typename] = [incoming]; + } + }); + }; + Policies.prototype.updateTypePolicy = function (typename, incoming) { + var _this = this; + var existing = this.getTypePolicy(typename); + var keyFields = incoming.keyFields, fields = incoming.fields; + function setMerge(existing, merge) { + existing.merge = + typeof merge === "function" ? merge + : merge === true ? mergeTrueFn + : merge === false ? mergeFalseFn + : existing.merge; + } + setMerge(existing, incoming.merge); + existing.keyFn = + keyFields === false ? nullKeyFieldsFn + : utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) + : typeof keyFields === "function" ? keyFields + : existing.keyFn; + if (fields) { + Object.keys(fields).forEach(function (fieldName) { + var existing = _this.getFieldPolicy(typename, fieldName, true); + var incoming = fields[fieldName]; + if (typeof incoming === "function") { + existing.read = incoming; + } + else { + var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge; + existing.keyFn = + keyArgs === false ? simpleKeyArgsFn + : utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) + : typeof keyArgs === "function" ? keyArgs + : existing.keyFn; + if (typeof read === "function") { + existing.read = read; + } + setMerge(existing, merge); + } + if (existing.read && existing.merge) { + existing.keyFn = existing.keyFn || simpleKeyArgsFn; + } + }); + } + }; + Policies.prototype.setRootTypename = function (which, typename) { + if (typename === void 0) { typename = which; } + var rootId = "ROOT_" + which.toUpperCase(); + var old = this.rootTypenamesById[rootId]; + if (typename !== old) { + globals.invariant(!old || old === which, 5, which); + if (old) + delete this.rootIdsByTypename[old]; + this.rootIdsByTypename[typename] = rootId; + this.rootTypenamesById[rootId] = typename; + } + }; + Policies.prototype.addPossibleTypes = function (possibleTypes) { + var _this = this; + this.usingPossibleTypes = true; + Object.keys(possibleTypes).forEach(function (supertype) { + _this.getSupertypeSet(supertype, true); + possibleTypes[supertype].forEach(function (subtype) { + _this.getSupertypeSet(subtype, true).add(supertype); + var match = subtype.match(TypeOrFieldNameRegExp); + if (!match || match[0] !== subtype) { + _this.fuzzySubtypes.set(subtype, new RegExp(subtype)); + } + }); + }); + }; + Policies.prototype.getTypePolicy = function (typename) { + var _this = this; + if (!hasOwn.call(this.typePolicies, typename)) { + var policy_1 = (this.typePolicies[typename] = Object.create(null)); + policy_1.fields = Object.create(null); + var supertypes_1 = this.supertypeMap.get(typename); + if (!supertypes_1 && this.fuzzySubtypes.size) { + supertypes_1 = this.getSupertypeSet(typename, true); + this.fuzzySubtypes.forEach(function (regExp, fuzzy) { + if (regExp.test(typename)) { + var fuzzySupertypes = _this.supertypeMap.get(fuzzy); + if (fuzzySupertypes) { + fuzzySupertypes.forEach(function (supertype) { + return supertypes_1.add(supertype); + }); + } + } + }); + } + if (supertypes_1 && supertypes_1.size) { + supertypes_1.forEach(function (supertype) { + var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = tslib.__rest(_a, ["fields"]); + Object.assign(policy_1, rest); + Object.assign(policy_1.fields, fields); + }); + } + } + var inbox = this.toBeAdded[typename]; + if (inbox && inbox.length) { + inbox.splice(0).forEach(function (policy) { + _this.updateTypePolicy(typename, policy); + }); + } + return this.typePolicies[typename]; + }; + Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) { + if (typename) { + var fieldPolicies = this.getTypePolicy(typename).fields; + return (fieldPolicies[fieldName] || + (createIfMissing && (fieldPolicies[fieldName] = Object.create(null)))); + } + }; + Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) { + var supertypeSet = this.supertypeMap.get(subtype); + if (!supertypeSet && createIfMissing) { + this.supertypeMap.set(subtype, (supertypeSet = new Set())); + } + return supertypeSet; + }; + Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) { + var _this = this; + if (!fragment.typeCondition) + return true; + if (!typename) + return false; + var supertype = fragment.typeCondition.name.value; + if (typename === supertype) + return true; + if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) { + var typenameSupertypeSet = this.getSupertypeSet(typename, true); + var workQueue_1 = [typenameSupertypeSet]; + var maybeEnqueue_1 = function (subtype) { + var supertypeSet = _this.getSupertypeSet(subtype, false); + if (supertypeSet && + supertypeSet.size && + workQueue_1.indexOf(supertypeSet) < 0) { + workQueue_1.push(supertypeSet); + } + }; + var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size); + var checkingFuzzySubtypes = false; + for (var i = 0; i < workQueue_1.length; ++i) { + var supertypeSet = workQueue_1[i]; + if (supertypeSet.has(supertype)) { + if (!typenameSupertypeSet.has(supertype)) { + if (checkingFuzzySubtypes) { + globalThis.__DEV__ !== false && globals.invariant.warn(6, typename, supertype); + } + typenameSupertypeSet.add(supertype); + } + return true; + } + supertypeSet.forEach(maybeEnqueue_1); + if (needToCheckFuzzySubtypes && + i === workQueue_1.length - 1 && + selectionSetMatchesResult(fragment.selectionSet, result, variables)) { + needToCheckFuzzySubtypes = false; + checkingFuzzySubtypes = true; + this.fuzzySubtypes.forEach(function (regExp, fuzzyString) { + var match = typename.match(regExp); + if (match && match[0] === typename) { + maybeEnqueue_1(fuzzyString); + } + }); + } + } + } + return false; + }; + Policies.prototype.hasKeyArgs = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return !!(policy && policy.keyFn); + }; + Policies.prototype.getStoreFieldName = function (fieldSpec) { + var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName; + var policy = this.getFieldPolicy(typename, fieldName, false); + var storeFieldName; + var keyFn = policy && policy.keyFn; + if (keyFn && typename) { + var context = { + typename: typename, + fieldName: fieldName, + field: fieldSpec.field || null, + variables: fieldSpec.variables, + }; + var args = argsFromFieldSpecifier(fieldSpec); + while (keyFn) { + var specifierOrString = keyFn(args, context); + if (utilities.isArray(specifierOrString)) { + keyFn = keyArgsFnFromSpecifier(specifierOrString); + } + else { + storeFieldName = specifierOrString || fieldName; + break; + } + } + } + if (storeFieldName === void 0) { + storeFieldName = + fieldSpec.field ? + utilities.storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) + : utilities.getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec)); + } + if (storeFieldName === false) { + return fieldName; + } + return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName + : fieldName + ":" + storeFieldName; + }; + Policies.prototype.readField = function (options, context) { + var objectOrReference = options.from; + if (!objectOrReference) + return; + var nameOrField = options.field || options.fieldName; + if (!nameOrField) + return; + if (options.typename === void 0) { + var typename = context.store.getFieldValue(objectOrReference, "__typename"); + if (typename) + options.typename = typename; + } + var storeFieldName = this.getStoreFieldName(options); + var fieldName = fieldNameFromStoreName(storeFieldName); + var existing = context.store.getFieldValue(objectOrReference, storeFieldName); + var policy = this.getFieldPolicy(options.typename, fieldName, false); + var read = policy && policy.read; + if (read) { + var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(utilities.isReference(objectOrReference) ? + objectOrReference.__ref + : objectOrReference, storeFieldName)); + return cacheSlot.withValue(this.cache, read, [ + existing, + readOptions, + ]); + } + return existing; + }; + Policies.prototype.getReadFunction = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return policy && policy.read; + }; + Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) { + var policy = this.getFieldPolicy(parentTypename, fieldName, false); + var merge = policy && policy.merge; + if (!merge && childTypename) { + policy = this.getTypePolicy(childTypename); + merge = policy && policy.merge; + } + return merge; + }; + Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) { + var field = _a.field, typename = _a.typename, merge = _a.merge; + if (merge === mergeTrueFn) { + return makeMergeObjectsFunction(context.store)(existing, incoming); + } + if (merge === mergeFalseFn) { + return incoming; + } + if (context.overwrite) { + existing = void 0; + } + return merge(existing, incoming, makeFieldFunctionOptions(this, + void 0, { + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }, context, storage || Object.create(null))); + }; + return Policies; +}()); +function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) { + var storeFieldName = policies.getStoreFieldName(fieldSpec); + var fieldName = fieldNameFromStoreName(storeFieldName); + var variables = fieldSpec.variables || context.variables; + var _a = context.store, toReference = _a.toReference, canRead = _a.canRead; + return { + args: argsFromFieldSpecifier(fieldSpec), + field: fieldSpec.field || null, + fieldName: fieldName, + storeFieldName: storeFieldName, + variables: variables, + isReference: utilities.isReference, + toReference: toReference, + storage: storage, + cache: policies.cache, + canRead: canRead, + readField: function () { + return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context); + }, + mergeObjects: makeMergeObjectsFunction(context.store), + }; +} +function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) { + var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length; + var options; + if (typeof fieldNameOrOptions === "string") { + options = { + fieldName: fieldNameOrOptions, + from: argc > 1 ? from : objectOrReference, + }; + } + else { + options = tslib.__assign({}, fieldNameOrOptions); + if (!hasOwn.call(options, "from")) { + options.from = objectOrReference; + } + } + if (globalThis.__DEV__ !== false && options.from === void 0) { + globalThis.__DEV__ !== false && globals.invariant.warn(7, utilities.stringifyForDisplay(Array.from(readFieldArgs))); + } + if (void 0 === options.variables) { + options.variables = variables; + } + return options; +} +function makeMergeObjectsFunction(store) { + return function mergeObjects(existing, incoming) { + if (utilities.isArray(existing) || utilities.isArray(incoming)) { + throw globals.newInvariantError(8); + } + if (utilities.isNonNullObject(existing) && utilities.isNonNullObject(incoming)) { + var eType = store.getFieldValue(existing, "__typename"); + var iType = store.getFieldValue(incoming, "__typename"); + var typesDiffer = eType && iType && eType !== iType; + if (typesDiffer) { + return incoming; + } + if (utilities.isReference(existing) && storeValueIsStoreObject(incoming)) { + store.merge(existing.__ref, incoming); + return existing; + } + if (storeValueIsStoreObject(existing) && utilities.isReference(incoming)) { + store.merge(existing, incoming.__ref); + return incoming; + } + if (storeValueIsStoreObject(existing) && + storeValueIsStoreObject(incoming)) { + return tslib.__assign(tslib.__assign({}, existing), incoming); + } + } + return incoming; + }; +} + +function getContextFlavor(context, clientOnly, deferred) { + var key = "".concat(clientOnly).concat(deferred); + var flavored = context.flavors.get(key); + if (!flavored) { + context.flavors.set(key, (flavored = + context.clientOnly === clientOnly && context.deferred === deferred ? + context + : tslib.__assign(tslib.__assign({}, context), { clientOnly: clientOnly, deferred: deferred }))); + } + return flavored; +} +var StoreWriter = (function () { + function StoreWriter(cache, reader, fragments) { + this.cache = cache; + this.reader = reader; + this.fragments = fragments; + } + StoreWriter.prototype.writeToStore = function (store, _a) { + var _this = this; + var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite; + var operationDefinition = utilities.getOperationDefinition(query); + var merger = makeProcessedFieldsMerger(); + variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(operationDefinition)), variables); + var context = tslib.__assign(tslib.__assign({ store: store, written: Object.create(null), merge: function (existing, incoming) { + return merger.merge(existing, incoming); + }, variables: variables, varString: utilities.canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() }); + var ref = this.processSelectionSet({ + result: result || Object.create(null), + dataId: dataId, + selectionSet: operationDefinition.selectionSet, + mergeTree: { map: new Map() }, + context: context, + }); + if (!utilities.isReference(ref)) { + throw globals.newInvariantError(11, result); + } + context.incomingById.forEach(function (_a, dataId) { + var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet; + var entityRef = utilities.makeReference(dataId); + if (mergeTree && mergeTree.map.size) { + var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context); + if (utilities.isReference(applied)) { + return; + } + storeObject = applied; + } + if (globalThis.__DEV__ !== false && !context.overwrite) { + var fieldsWithSelectionSets_1 = Object.create(null); + fieldNodeSet.forEach(function (field) { + if (field.selectionSet) { + fieldsWithSelectionSets_1[field.name.value] = true; + } + }); + var hasSelectionSet_1 = function (storeFieldName) { + return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] === + true; + }; + var hasMergeFunction_1 = function (storeFieldName) { + var childTree = mergeTree && mergeTree.map.get(storeFieldName); + return Boolean(childTree && childTree.info && childTree.info.merge); + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + if (hasSelectionSet_1(storeFieldName) && + !hasMergeFunction_1(storeFieldName)) { + warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store); + } + }); + } + store.merge(dataId, storeObject); + }); + store.retain(ref.__ref); + return ref; + }; + StoreWriter.prototype.processSelectionSet = function (_a) { + var _this = this; + var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, + mergeTree = _a.mergeTree; + var policies = this.cache.policies; + var incoming = Object.create(null); + var typename = (dataId && policies.rootTypenamesById[dataId]) || + utilities.getTypenameFromResult(result, selectionSet, context.fragmentMap) || + (dataId && context.store.get(dataId, "__typename")); + if ("string" === typeof typename) { + incoming.__typename = typename; + } + var readField = function () { + var options = normalizeReadFieldOptions(arguments, incoming, context.variables); + if (utilities.isReference(options.from)) { + var info = context.incomingById.get(options.from.__ref); + if (info) { + var result_1 = policies.readField(tslib.__assign(tslib.__assign({}, options), { from: info.storeObject }), context); + if (result_1 !== void 0) { + return result_1; + } + } + } + return policies.readField(options, context); + }; + var fieldNodeSet = new Set(); + this.flattenFields(selectionSet, result, + context, typename).forEach(function (context, field) { + var _a; + var resultFieldKey = utilities.resultKeyNameFromField(field); + var value = result[resultFieldKey]; + fieldNodeSet.add(field); + if (value !== void 0) { + var storeFieldName = policies.getStoreFieldName({ + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }); + var childTree = getChildMergeTree(mergeTree, storeFieldName); + var incomingValue = _this.processFieldValue(value, field, + field.selectionSet ? + getContextFlavor(context, false, false) + : context, childTree); + var childTypename = void 0; + if (field.selectionSet && + (utilities.isReference(incomingValue) || storeValueIsStoreObject(incomingValue))) { + childTypename = readField("__typename", incomingValue); + } + var merge = policies.getMergeFunction(typename, field.name.value, childTypename); + if (merge) { + childTree.info = { + field: field, + typename: typename, + merge: merge, + }; + } + else { + maybeRecycleChildMergeTree(mergeTree, storeFieldName); + } + incoming = context.merge(incoming, (_a = {}, + _a[storeFieldName] = incomingValue, + _a)); + } + else if (globalThis.__DEV__ !== false && + !context.clientOnly && + !context.deferred && + !utilities.addTypenameToDocument.added(field) && + !policies.getReadFunction(typename, field.name.value)) { + globalThis.__DEV__ !== false && globals.invariant.error(12, utilities.resultKeyNameFromField(field), result); + } + }); + try { + var _b = policies.identify(result, { + typename: typename, + selectionSet: selectionSet, + fragmentMap: context.fragmentMap, + storeObject: incoming, + readField: readField, + }), id = _b[0], keyObject = _b[1]; + dataId = dataId || id; + if (keyObject) { + incoming = context.merge(incoming, keyObject); + } + } + catch (e) { + if (!dataId) + throw e; + } + if ("string" === typeof dataId) { + var dataRef = utilities.makeReference(dataId); + var sets = context.written[dataId] || (context.written[dataId] = []); + if (sets.indexOf(selectionSet) >= 0) + return dataRef; + sets.push(selectionSet); + if (this.reader && + this.reader.isFresh(result, dataRef, selectionSet, context)) { + return dataRef; + } + var previous_1 = context.incomingById.get(dataId); + if (previous_1) { + previous_1.storeObject = context.merge(previous_1.storeObject, incoming); + previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree); + fieldNodeSet.forEach(function (field) { return previous_1.fieldNodeSet.add(field); }); + } + else { + context.incomingById.set(dataId, { + storeObject: incoming, + mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree, + fieldNodeSet: fieldNodeSet, + }); + } + return dataRef; + } + return incoming; + }; + StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) { + var _this = this; + if (!field.selectionSet || value === null) { + return globalThis.__DEV__ !== false ? utilities.cloneDeep(value) : value; + } + if (utilities.isArray(value)) { + return value.map(function (item, i) { + var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i)); + maybeRecycleChildMergeTree(mergeTree, i); + return value; + }); + } + return this.processSelectionSet({ + result: value, + selectionSet: field.selectionSet, + context: context, + mergeTree: mergeTree, + }); + }; + StoreWriter.prototype.flattenFields = function (selectionSet, result, context, typename) { + if (typename === void 0) { typename = utilities.getTypenameFromResult(result, selectionSet, context.fragmentMap); } + var fieldMap = new Map(); + var policies = this.cache.policies; + var limitingTrie = new trie.Trie(false); + (function flatten(selectionSet, inheritedContext) { + var visitedNode = limitingTrie.lookup(selectionSet, + inheritedContext.clientOnly, inheritedContext.deferred); + if (visitedNode.visited) + return; + visitedNode.visited = true; + selectionSet.selections.forEach(function (selection) { + if (!utilities.shouldInclude(selection, context.variables)) + return; + var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred; + if ( + !(clientOnly && deferred) && + utilities.isNonEmptyArray(selection.directives)) { + selection.directives.forEach(function (dir) { + var name = dir.name.value; + if (name === "client") + clientOnly = true; + if (name === "defer") { + var args = utilities.argumentsObjectFromField(dir, context.variables); + if (!args || args.if !== false) { + deferred = true; + } + } + }); + } + if (utilities.isField(selection)) { + var existing = fieldMap.get(selection); + if (existing) { + clientOnly = clientOnly && existing.clientOnly; + deferred = deferred && existing.deferred; + } + fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred)); + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) { + throw globals.newInvariantError(13, selection.name.value); + } + if (fragment && + policies.fragmentMatches(fragment, typename, result, context.variables)) { + flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred)); + } + } + }); + })(selectionSet, context); + return fieldMap; + }; + StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) { + var _a; + var _this = this; + if (mergeTree.map.size && !utilities.isReference(incoming)) { + var e_1 = + (!utilities.isArray(incoming) && + (utilities.isReference(existing) || storeValueIsStoreObject(existing))) ? + existing + : void 0; + var i_1 = incoming; + if (e_1 && !getStorageArgs) { + getStorageArgs = [utilities.isReference(e_1) ? e_1.__ref : e_1]; + } + var changedFields_1; + var getValue_1 = function (from, name) { + return (utilities.isArray(from) ? + typeof name === "number" ? + from[name] + : void 0 + : context.store.getFieldValue(from, String(name))); + }; + mergeTree.map.forEach(function (childTree, storeFieldName) { + var eVal = getValue_1(e_1, storeFieldName); + var iVal = getValue_1(i_1, storeFieldName); + if (void 0 === iVal) + return; + if (getStorageArgs) { + getStorageArgs.push(storeFieldName); + } + var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs); + if (aVal !== iVal) { + changedFields_1 = changedFields_1 || new Map(); + changedFields_1.set(storeFieldName, aVal); + } + if (getStorageArgs) { + globals.invariant(getStorageArgs.pop() === storeFieldName); + } + }); + if (changedFields_1) { + incoming = (utilities.isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1)); + changedFields_1.forEach(function (value, name) { + incoming[name] = value; + }); + } + } + if (mergeTree.info) { + return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs)); + } + return incoming; + }; + return StoreWriter; +}()); +var emptyMergeTreePool = []; +function getChildMergeTree(_a, name) { + var map = _a.map; + if (!map.has(name)) { + map.set(name, emptyMergeTreePool.pop() || { map: new Map() }); + } + return map.get(name); +} +function mergeMergeTrees(left, right) { + if (left === right || !right || mergeTreeIsEmpty(right)) + return left; + if (!left || mergeTreeIsEmpty(left)) + return right; + var info = left.info && right.info ? tslib.__assign(tslib.__assign({}, left.info), right.info) : left.info || right.info; + var needToMergeMaps = left.map.size && right.map.size; + var map = needToMergeMaps ? new Map() + : left.map.size ? left.map + : right.map; + var merged = { info: info, map: map }; + if (needToMergeMaps) { + var remainingRightKeys_1 = new Set(right.map.keys()); + left.map.forEach(function (leftTree, key) { + merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key))); + remainingRightKeys_1.delete(key); + }); + remainingRightKeys_1.forEach(function (key) { + merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key))); + }); + } + return merged; +} +function mergeTreeIsEmpty(tree) { + return !tree || !(tree.info || tree.map.size); +} +function maybeRecycleChildMergeTree(_a, name) { + var map = _a.map; + var childTree = map.get(name); + if (childTree && mergeTreeIsEmpty(childTree)) { + emptyMergeTreePool.push(childTree); + map.delete(name); + } +} +var warnings = new Set(); +function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) { + var getChild = function (objOrRef) { + var child = store.getFieldValue(objOrRef, storeFieldName); + return typeof child === "object" && child; + }; + var existing = getChild(existingRef); + if (!existing) + return; + var incoming = getChild(incomingObj); + if (!incoming) + return; + if (utilities.isReference(existing)) + return; + if (equality.equal(existing, incoming)) + return; + if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) { + return; + } + var parentType = store.getFieldValue(existingRef, "__typename") || + store.getFieldValue(incomingObj, "__typename"); + var fieldName = fieldNameFromStoreName(storeFieldName); + var typeDotName = "".concat(parentType, ".").concat(fieldName); + if (warnings.has(typeDotName)) + return; + warnings.add(typeDotName); + var childTypenames = []; + if (!utilities.isArray(existing) && !utilities.isArray(incoming)) { + [existing, incoming].forEach(function (child) { + var typename = store.getFieldValue(child, "__typename"); + if (typeof typename === "string" && !childTypenames.includes(typename)) { + childTypenames.push(typename); + } + }); + } + globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length ? + "either ensure all objects of type " + + childTypenames.join(" and ") + + " have an ID or a custom merge function, or " + : "", typeDotName, existing, incoming); +} + +var InMemoryCache = (function (_super) { + tslib.__extends(InMemoryCache, _super); + function InMemoryCache(config) { + if (config === void 0) { config = {}; } + var _this = _super.call(this) || this; + _this.watches = new Set(); + _this.addTypenameTransform = new utilities.DocumentTransform(utilities.addTypenameToDocument); + _this.assumeImmutableResults = true; + _this.makeVar = makeVar; + _this.txCount = 0; + _this.config = normalizeConfig(config); + _this.addTypename = !!_this.config.addTypename; + _this.policies = new Policies({ + cache: _this, + dataIdFromObject: _this.config.dataIdFromObject, + possibleTypes: _this.config.possibleTypes, + typePolicies: _this.config.typePolicies, + }); + _this.init(); + return _this; + } + InMemoryCache.prototype.init = function () { + var rootStore = (this.data = new exports.EntityStore.Root({ + policies: this.policies, + resultCaching: this.config.resultCaching, + })); + this.optimisticData = rootStore.stump; + this.resetResultCache(); + }; + InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) { + var _this = this; + var previousReader = this.storeReader; + var fragments = this.config.fragments; + this.storeWriter = new StoreWriter(this, (this.storeReader = new StoreReader({ + cache: this, + addTypename: this.addTypename, + resultCacheMaxSize: this.config.resultCacheMaxSize, + canonizeResults: shouldCanonizeResults(this.config), + canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon), + fragments: fragments, + })), fragments); + this.maybeBroadcastWatch = optimism.wrap(function (c, options) { + return _this.broadcastWatch(c, options); + }, { + max: this.config.resultCacheMaxSize || + utilities.cacheSizes["inMemoryCache.maybeBroadcastWatch"] || + 5000 , + makeCacheKey: function (c) { + var store = c.optimistic ? _this.optimisticData : _this.data; + if (supportsResultCaching(store)) { + var optimistic = c.optimistic, id = c.id, variables = c.variables; + return store.makeCacheKey(c.query, + c.callback, utilities.canonicalStringify({ optimistic: optimistic, id: id, variables: variables })); + } + }, + }); + new Set([this.data.group, this.optimisticData.group]).forEach(function (group) { + return group.resetCaching(); + }); + }; + InMemoryCache.prototype.restore = function (data) { + this.init(); + if (data) + this.data.replace(data); + return this; + }; + InMemoryCache.prototype.extract = function (optimistic) { + if (optimistic === void 0) { optimistic = false; } + return (optimistic ? this.optimisticData : this.data).extract(); + }; + InMemoryCache.prototype.read = function (options) { + var + _a = options.returnPartialData, + returnPartialData = _a === void 0 ? false : _a; + try { + return (this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null); + } + catch (e) { + if (e instanceof MissingFieldError) { + return null; + } + throw e; + } + }; + InMemoryCache.prototype.write = function (options) { + try { + ++this.txCount; + return this.storeWriter.writeToStore(this.data, options); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.modify = function (options) { + if (hasOwn.call(options, "id") && !options.id) { + return false; + } + var store = ((options.optimistic) + ) ? + this.optimisticData + : this.data; + try { + ++this.txCount; + return store.modify(options.id || "ROOT_QUERY", options.fields); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.diff = function (options) { + return this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config })); + }; + InMemoryCache.prototype.watch = function (watch) { + var _this = this; + if (!this.watches.size) { + recallCache(this); + } + this.watches.add(watch); + if (watch.immediate) { + this.maybeBroadcastWatch(watch); + } + return function () { + if (_this.watches.delete(watch) && !_this.watches.size) { + forgetCache(_this); + } + _this.maybeBroadcastWatch.forget(watch); + }; + }; + InMemoryCache.prototype.gc = function (options) { + var _a; + utilities.canonicalStringify.reset(); + utilities.print.reset(); + this.addTypenameTransform.resetCache(); + (_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches(); + var ids = this.optimisticData.gc(); + if (options && !this.txCount) { + if (options.resetResultCache) { + this.resetResultCache(options.resetResultIdentities); + } + else if (options.resetResultIdentities) { + this.storeReader.resetCanon(); + } + } + return ids; + }; + InMemoryCache.prototype.retain = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).retain(rootId); + }; + InMemoryCache.prototype.release = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).release(rootId); + }; + InMemoryCache.prototype.identify = function (object) { + if (utilities.isReference(object)) + return object.__ref; + try { + return this.policies.identify(object)[0]; + } + catch (e) { + globalThis.__DEV__ !== false && globals.invariant.warn(e); + } + }; + InMemoryCache.prototype.evict = function (options) { + if (!options.id) { + if (hasOwn.call(options, "id")) { + return false; + } + options = tslib.__assign(tslib.__assign({}, options), { id: "ROOT_QUERY" }); + } + try { + ++this.txCount; + return this.optimisticData.evict(options, this.data); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.reset = function (options) { + var _this = this; + this.init(); + utilities.canonicalStringify.reset(); + if (options && options.discardWatches) { + this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); }); + this.watches.clear(); + forgetCache(this); + } + else { + this.broadcastWatches(); + } + return Promise.resolve(); + }; + InMemoryCache.prototype.removeOptimistic = function (idToRemove) { + var newOptimisticData = this.optimisticData.removeLayer(idToRemove); + if (newOptimisticData !== this.optimisticData) { + this.optimisticData = newOptimisticData; + this.broadcastWatches(); + } + }; + InMemoryCache.prototype.batch = function (options) { + var _this = this; + var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated; + var updateResult; + var perform = function (layer) { + var _a = _this, data = _a.data, optimisticData = _a.optimisticData; + ++_this.txCount; + if (layer) { + _this.data = _this.optimisticData = layer; + } + try { + return (updateResult = update(_this)); + } + finally { + --_this.txCount; + _this.data = data; + _this.optimisticData = optimisticData; + } + }; + var alreadyDirty = new Set(); + if (onWatchUpdated && !this.txCount) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch) { + alreadyDirty.add(watch); + return false; + } })); + } + if (typeof optimistic === "string") { + this.optimisticData = this.optimisticData.addLayer(optimistic, perform); + } + else if (optimistic === false) { + perform(this.data); + } + else { + perform(); + } + if (typeof removeOptimistic === "string") { + this.optimisticData = this.optimisticData.removeLayer(removeOptimistic); + } + if (onWatchUpdated && alreadyDirty.size) { + this.broadcastWatches(tslib.__assign(tslib.__assign({}, options), { onWatchUpdated: function (watch, diff) { + var result = onWatchUpdated.call(this, watch, diff); + if (result !== false) { + alreadyDirty.delete(watch); + } + return result; + } })); + if (alreadyDirty.size) { + alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); }); + } + } + else { + this.broadcastWatches(options); + } + return updateResult; + }; + InMemoryCache.prototype.performTransaction = function (update, optimisticId) { + return this.batch({ + update: update, + optimistic: optimisticId || optimisticId !== null, + }); + }; + InMemoryCache.prototype.transformDocument = function (document) { + return this.addTypenameToDocument(this.addFragmentsToDocument(document)); + }; + InMemoryCache.prototype.broadcastWatches = function (options) { + var _this = this; + if (!this.txCount) { + this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); }); + } + }; + InMemoryCache.prototype.addFragmentsToDocument = function (document) { + var fragments = this.config.fragments; + return fragments ? fragments.transform(document) : document; + }; + InMemoryCache.prototype.addTypenameToDocument = function (document) { + if (this.addTypename) { + return this.addTypenameTransform.transformDocument(document); + } + return document; + }; + InMemoryCache.prototype.broadcastWatch = function (c, options) { + var lastDiff = c.lastDiff; + var diff = this.diff(c); + if (options) { + if (c.optimistic && typeof options.optimistic === "string") { + diff.fromOptimisticTransaction = true; + } + if (options.onWatchUpdated && + options.onWatchUpdated.call(this, c, diff, lastDiff) === false) { + return; + } + } + if (!lastDiff || !equality.equal(lastDiff.result, diff.result)) { + c.callback((c.lastDiff = diff), lastDiff); + } + }; + return InMemoryCache; +}(ApolloCache)); +if (globalThis.__DEV__ !== false) { + InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals; +} + +function createFragmentRegistry() { + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + return new (FragmentRegistry.bind.apply(FragmentRegistry, tslib.__spreadArray([void 0], fragments, false)))(); +} +var FragmentRegistry = (function () { + function FragmentRegistry() { + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + this.registry = Object.create(null); + this.resetCaches(); + if (fragments.length) { + this.register.apply(this, fragments); + } + } + FragmentRegistry.prototype.register = function () { + var _this = this; + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + var definitions = new Map(); + fragments.forEach(function (doc) { + utilities.getFragmentDefinitions(doc).forEach(function (node) { + definitions.set(node.name.value, node); + }); + }); + definitions.forEach(function (node, name) { + if (node !== _this.registry[name]) { + _this.registry[name] = node; + _this.invalidate(name); + } + }); + return this; + }; + FragmentRegistry.prototype.invalidate = function (name) { }; + FragmentRegistry.prototype.resetCaches = function () { + var proto = FragmentRegistry.prototype; + this.invalidate = (this.lookup = optimism.wrap(proto.lookup.bind(this), { + makeCacheKey: function (arg) { return arg; }, + max: utilities.cacheSizes["fragmentRegistry.lookup"] || + 1000 , + })).dirty; + this.transform = optimism.wrap(proto.transform.bind(this), { + cache: caches.WeakCache, + max: utilities.cacheSizes["fragmentRegistry.transform"] || + 2000 , + }); + this.findFragmentSpreads = optimism.wrap(proto.findFragmentSpreads.bind(this), { + cache: caches.WeakCache, + max: utilities.cacheSizes["fragmentRegistry.findFragmentSpreads"] || + 4000 , + }); + }; + FragmentRegistry.prototype.lookup = function (fragmentName) { + return this.registry[fragmentName] || null; + }; + FragmentRegistry.prototype.transform = function (document) { + var _this = this; + var defined = new Map(); + utilities.getFragmentDefinitions(document).forEach(function (def) { + defined.set(def.name.value, def); + }); + var unbound = new Set(); + var enqueue = function (spreadName) { + if (!defined.has(spreadName)) { + unbound.add(spreadName); + } + }; + var enqueueChildSpreads = function (node) { + return Object.keys(_this.findFragmentSpreads(node)).forEach(enqueue); + }; + enqueueChildSpreads(document); + var missing = []; + var map = Object.create(null); + unbound.forEach(function (fragmentName) { + var knownFragmentDef = defined.get(fragmentName); + if (knownFragmentDef) { + enqueueChildSpreads((map[fragmentName] = knownFragmentDef)); + } + else { + missing.push(fragmentName); + var def = _this.lookup(fragmentName); + if (def) { + enqueueChildSpreads((map[fragmentName] = def)); + } + } + }); + if (missing.length) { + var defsToAppend_1 = []; + missing.forEach(function (name) { + var def = map[name]; + if (def) { + defsToAppend_1.push(def); + } + }); + if (defsToAppend_1.length) { + document = tslib.__assign(tslib.__assign({}, document), { definitions: document.definitions.concat(defsToAppend_1) }); + } + } + return document; + }; + FragmentRegistry.prototype.findFragmentSpreads = function (root) { + var spreads = Object.create(null); + graphql.visit(root, { + FragmentSpread: function (node) { + spreads[node.name.value] = node; + }, + }); + return spreads; + }; + return FragmentRegistry; +}()); + +exports.canonicalStringify = utilities.canonicalStringify; +exports.isReference = utilities.isReference; +exports.makeReference = utilities.makeReference; +exports.ApolloCache = ApolloCache; +exports.InMemoryCache = InMemoryCache; +exports.MissingFieldError = MissingFieldError; +exports.Policies = Policies; +exports.cacheSlot = cacheSlot; +exports.createFragmentRegistry = createFragmentRegistry; +exports.defaultDataIdFromObject = defaultDataIdFromObject; +exports.fieldNameFromStoreName = fieldNameFromStoreName; +exports.makeVar = makeVar; +//# sourceMappingURL=cache.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/cache.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/core/cache.d.ts new file mode 100644 index 0000000..93ee3d0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/cache.d.ts @@ -0,0 +1,52 @@ +import type { DocumentNode } from "graphql"; +import type { StoreObject, Reference } from "../../utilities/index.js"; +import type { DataProxy } from "./types/DataProxy.js"; +import type { Cache } from "./types/Cache.js"; +import { getApolloCacheMemoryInternals } from "../../utilities/caching/getMemoryInternals.js"; +export type Transaction = (c: ApolloCache) => void; +export declare abstract class ApolloCache implements DataProxy { + readonly assumeImmutableResults: boolean; + abstract read(query: Cache.ReadOptions): TData | null; + abstract write(write: Cache.WriteOptions): Reference | undefined; + abstract diff(query: Cache.DiffOptions): Cache.DiffResult; + abstract watch(watch: Cache.WatchOptions): () => void; + abstract reset(options?: Cache.ResetOptions): Promise; + abstract evict(options: Cache.EvictOptions): boolean; + /** + * Replaces existing state in the cache (if any) with the values expressed by + * `serializedState`. + * + * Called when hydrating a cache (server side rendering, or offline storage), + * and also (potentially) during hot reloads. + */ + abstract restore(serializedState: TSerialized): ApolloCache; + /** + * Exposes the cache's complete state, in a serializable format for later restoration. + */ + abstract extract(optimistic?: boolean): TSerialized; + abstract removeOptimistic(id: string): void; + batch(options: Cache.BatchOptions): U; + abstract performTransaction(transaction: Transaction, optimisticId?: string | null): void; + recordOptimisticTransaction(transaction: Transaction, optimisticId: string): void; + transformDocument(document: DocumentNode): DocumentNode; + transformForLink(document: DocumentNode): DocumentNode; + identify(object: StoreObject | Reference): string | undefined; + gc(): string[]; + modify = Record>(options: Cache.ModifyOptions): boolean; + readQuery(options: Cache.ReadQueryOptions, optimistic?: boolean): QueryType | null; + private getFragmentDoc; + readFragment(options: Cache.ReadFragmentOptions, optimistic?: boolean): FragmentType | null; + writeQuery({ id, data, ...options }: Cache.WriteQueryOptions): Reference | undefined; + writeFragment({ id, data, fragment, fragmentName, ...options }: Cache.WriteFragmentOptions): Reference | undefined; + updateQuery(options: Cache.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; + updateFragment(options: Cache.UpdateFragmentOptions, update: (data: TData | null) => TData | null | void): TData | null; + /** + * @experimental + * @internal + * This is not a stable API - it is used in development builds to expose + * information to the DevTools. + * Use at your own risk! + */ + getMemoryInternals?: typeof getApolloCacheMemoryInternals; +} +//# sourceMappingURL=cache.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/cache.js b/graphql-subscription/node_modules/@apollo/client/cache/core/cache.js new file mode 100644 index 0000000..2407100 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/cache.js @@ -0,0 +1,109 @@ +import { __assign, __rest } from "tslib"; +import { wrap } from "optimism"; +import { cacheSizes, getFragmentQueryDocument, } from "../../utilities/index.js"; +import { WeakCache } from "@wry/caches"; +import { getApolloCacheMemoryInternals } from "../../utilities/caching/getMemoryInternals.js"; +var ApolloCache = /** @class */ (function () { + function ApolloCache() { + this.assumeImmutableResults = false; + // Make sure we compute the same (===) fragment query document every + // time we receive the same fragment in readFragment. + this.getFragmentDoc = wrap(getFragmentQueryDocument, { + max: cacheSizes["cache.fragmentQueryDocuments"] || + 1000 /* defaultCacheSizes["cache.fragmentQueryDocuments"] */, + cache: WeakCache, + }); + } + // Transactional API + // The batch method is intended to replace/subsume both performTransaction + // and recordOptimisticTransaction, but performTransaction came first, so we + // provide a default batch implementation that's just another way of calling + // performTransaction. Subclasses of ApolloCache (such as InMemoryCache) can + // override the batch method to do more interesting things with its options. + ApolloCache.prototype.batch = function (options) { + var _this = this; + var optimisticId = typeof options.optimistic === "string" ? options.optimistic + : options.optimistic === false ? null + : void 0; + var updateResult; + this.performTransaction(function () { return (updateResult = options.update(_this)); }, optimisticId); + return updateResult; + }; + ApolloCache.prototype.recordOptimisticTransaction = function (transaction, optimisticId) { + this.performTransaction(transaction, optimisticId); + }; + // Optional API + // Called once per input document, allowing the cache to make static changes + // to the query, such as adding __typename fields. + ApolloCache.prototype.transformDocument = function (document) { + return document; + }; + // Called before each ApolloLink request, allowing the cache to make dynamic + // changes to the query, such as filling in missing fragment definitions. + ApolloCache.prototype.transformForLink = function (document) { + return document; + }; + ApolloCache.prototype.identify = function (object) { + return; + }; + ApolloCache.prototype.gc = function () { + return []; + }; + ApolloCache.prototype.modify = function (options) { + return false; + }; + // DataProxy API + ApolloCache.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(__assign(__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic: optimistic })); + }; + ApolloCache.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = !!options.optimistic; } + return this.read(__assign(__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic })); + }; + ApolloCache.prototype.writeQuery = function (_a) { + var id = _a.id, data = _a.data, options = __rest(_a, ["id", "data"]); + return this.write(Object.assign(options, { + dataId: id || "ROOT_QUERY", + result: data, + })); + }; + ApolloCache.prototype.writeFragment = function (_a) { + var id = _a.id, data = _a.data, fragment = _a.fragment, fragmentName = _a.fragmentName, options = __rest(_a, ["id", "data", "fragment", "fragmentName"]); + return this.write(Object.assign(options, { + query: this.getFragmentDoc(fragment, fragmentName), + dataId: id, + result: data, + })); + }; + ApolloCache.prototype.updateQuery = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readQuery(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeQuery(__assign(__assign({}, options), { data: data })); + return data; + }, + }); + }; + ApolloCache.prototype.updateFragment = function (options, update) { + return this.batch({ + update: function (cache) { + var value = cache.readFragment(options); + var data = update(value); + if (data === void 0 || data === null) + return value; + cache.writeFragment(__assign(__assign({}, options), { data: data })); + return data; + }, + }); + }; + return ApolloCache; +}()); +export { ApolloCache }; +if (globalThis.__DEV__ !== false) { + ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals; +} +//# sourceMappingURL=cache.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/cache.js.map b/graphql-subscription/node_modules/@apollo/client/cache/core/cache.js.map new file mode 100644 index 0000000..65bbbfe --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/cache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/cache/core/cache.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EACL,UAAU,EAEV,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAI9F;IAAA;QACkB,2BAAsB,GAAY,KAAK,CAAC;QA8HxD,oEAAoE;QACpE,qDAAqD;QAC7C,mBAAc,GAAG,IAAI,CAAC,wBAAwB,EAAE;YACtD,GAAG,EACD,UAAU,CAAC,8BAA8B,CAAC;4EACO;YACnD,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;IAiFL,CAAC;IAvKC,oBAAoB;IAEpB,0EAA0E;IAC1E,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IACrE,2BAAK,GAAZ,UAAgB,OAAoC;QAApD,iBAWC;QAVC,IAAM,YAAY,GAChB,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,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SACF,CAAC,CAAC;IACL,CAAC;IAEM,oCAAc,GAArB,UACE,OAAuD,EACvD,MAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC;YAChB,MAAM,YAAC,KAAK;gBACV,IAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAoB,OAAO,CAAC,CAAC;gBAC7D,IAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC3B,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI;oBAAE,OAAO,KAAK,CAAC;gBACnD,KAAK,CAAC,aAAa,uBAAyB,OAAO,KAAE,IAAI,MAAA,IAAG,CAAC;gBAC7D,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAUH,kBAAC;AAAD,CAAC,AAvND,IAuNC;;AAED,IAAI,OAAO,EAAE,CAAC;IACZ,WAAW,CAAC,SAAS,CAAC,kBAAkB,GAAG,6BAA6B,CAAC;AAC3E,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport { wrap } from \"optimism\";\n\nimport type { StoreObject, Reference } from \"../../utilities/index.js\";\nimport {\n cacheSizes,\n defaultCacheSizes,\n getFragmentQueryDocument,\n} from \"../../utilities/index.js\";\nimport type { DataProxy } from \"./types/DataProxy.js\";\nimport type { Cache } from \"./types/Cache.js\";\nimport { WeakCache } from \"@wry/caches\";\nimport { getApolloCacheMemoryInternals } from \"../../utilities/caching/getMemoryInternals.js\";\n\nexport type Transaction = (c: ApolloCache) => void;\n\nexport abstract class ApolloCache implements DataProxy {\n public readonly assumeImmutableResults: boolean = false;\n\n // required to implement\n // core API\n public abstract read(\n query: Cache.ReadOptions\n ): TData | null;\n public abstract write(\n write: Cache.WriteOptions\n ): Reference | undefined;\n public abstract diff(query: Cache.DiffOptions): Cache.DiffResult;\n public abstract watch(\n watch: Cache.WatchOptions\n ): () => void;\n\n // Empty the cache and restart all current watches (unless\n // options.discardWatches is true).\n public abstract reset(options?: Cache.ResetOptions): Promise;\n\n // Remove whole objects from the cache by passing just options.id, or\n // specific fields by passing options.field and/or options.args. If no\n // options.args are provided, all fields matching options.field (even\n // those with arguments) will be removed. Returns true iff any data was\n // removed from the cache.\n public abstract evict(options: Cache.EvictOptions): boolean;\n\n // initializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized\n ): ApolloCache;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // Optimistic API\n\n public abstract removeOptimistic(id: string): void;\n\n // Transactional API\n\n // The batch method is intended to replace/subsume both performTransaction\n // and recordOptimisticTransaction, but performTransaction came first, so we\n // provide a default batch implementation that's just another way of calling\n // performTransaction. Subclasses of ApolloCache (such as InMemoryCache) can\n // override the batch method to do more interesting things with its options.\n public batch(options: Cache.BatchOptions): U {\n const optimisticId =\n typeof options.optimistic === \"string\" ? options.optimistic\n : options.optimistic === false ? null\n : void 0;\n let updateResult: U;\n this.performTransaction(\n () => (updateResult = options.update(this)),\n optimisticId\n );\n return updateResult!;\n }\n\n public abstract performTransaction(\n transaction: Transaction,\n // Although subclasses may implement recordOptimisticTransaction\n // however they choose, the default implementation simply calls\n // performTransaction with a string as the second argument, allowing\n // performTransaction to handle both optimistic and non-optimistic\n // (broadcast-batching) transactions. Passing null for optimisticId is\n // also allowed, and indicates that performTransaction should apply\n // the transaction non-optimistically (ignoring optimistic data).\n optimisticId?: string | null\n ): void;\n\n public recordOptimisticTransaction(\n transaction: Transaction,\n optimisticId: string\n ) {\n this.performTransaction(transaction, optimisticId);\n }\n\n // Optional API\n\n // Called once per input document, allowing the cache to make static changes\n // to the query, such as adding __typename fields.\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // Called before each ApolloLink request, allowing the cache to make dynamic\n // changes to the query, such as filling in missing fragment definitions.\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n public identify(object: StoreObject | Reference): string | undefined {\n return;\n }\n\n public gc(): string[] {\n return [];\n }\n\n public modify = Record>(\n options: Cache.ModifyOptions\n ): boolean {\n return false;\n }\n\n // DataProxy API\n public readQuery(\n options: Cache.ReadQueryOptions,\n optimistic = !!options.optimistic\n ): QueryType | null {\n return this.read({\n ...options,\n rootId: options.id || \"ROOT_QUERY\",\n optimistic,\n });\n }\n\n // Make sure we compute the same (===) fragment query document every\n // time we receive the same fragment in readFragment.\n private getFragmentDoc = wrap(getFragmentQueryDocument, {\n max:\n cacheSizes[\"cache.fragmentQueryDocuments\"] ||\n defaultCacheSizes[\"cache.fragmentQueryDocuments\"],\n cache: WeakCache,\n });\n\n public readFragment(\n options: Cache.ReadFragmentOptions,\n optimistic = !!options.optimistic\n ): FragmentType | null {\n return this.read({\n ...options,\n query: this.getFragmentDoc(options.fragment, options.fragmentName),\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery({\n id,\n data,\n ...options\n }: Cache.WriteQueryOptions): Reference | undefined {\n return this.write(\n Object.assign(options, {\n dataId: id || \"ROOT_QUERY\",\n result: data,\n })\n );\n }\n\n public writeFragment({\n id,\n data,\n fragment,\n fragmentName,\n ...options\n }: Cache.WriteFragmentOptions): Reference | undefined {\n return this.write(\n Object.assign(options, {\n query: this.getFragmentDoc(fragment, fragmentName),\n dataId: id,\n result: data,\n })\n );\n }\n\n public updateQuery(\n options: Cache.UpdateQueryOptions,\n update: (data: TData | null) => TData | null | void\n ): TData | null {\n return this.batch({\n update(cache) {\n const value = cache.readQuery(options);\n const data = update(value);\n if (data === void 0 || data === null) return value;\n cache.writeQuery({ ...options, data });\n return data;\n },\n });\n }\n\n public updateFragment(\n options: Cache.UpdateFragmentOptions,\n update: (data: TData | null) => TData | null | void\n ): TData | null {\n return this.batch({\n update(cache) {\n const value = cache.readFragment(options);\n const data = update(value);\n if (data === void 0 || data === null) return value;\n cache.writeFragment({ ...options, data });\n return data;\n },\n });\n }\n\n /**\n * @experimental\n * @internal\n * This is not a stable API - it is used in development builds to expose\n * information to the DevTools.\n * Use at your own risk!\n */\n public getMemoryInternals?: typeof getApolloCacheMemoryInternals;\n}\n\nif (__DEV__) {\n ApolloCache.prototype.getMemoryInternals = getApolloCacheMemoryInternals;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.d.ts new file mode 100644 index 0000000..185ce63 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.d.ts @@ -0,0 +1,62 @@ +import { DataProxy } from "./DataProxy.js"; +import type { AllFieldsModifier, Modifiers } from "./common.js"; +import type { ApolloCache } from "../cache.js"; +export declare namespace Cache { + type WatchCallback = (diff: Cache.DiffResult, lastDiff?: Cache.DiffResult) => void; + interface ReadOptions extends DataProxy.Query { + rootId?: string; + previousResult?: any; + optimistic: boolean; + returnPartialData?: boolean; + /** + * @deprecated + * Using `canonizeResults` can result in memory leaks so we generally do not + * recommend using this option anymore. + * A future version of Apollo Client will contain a similar feature without + * the risk of memory leaks. + */ + canonizeResults?: boolean; + } + interface WriteOptions extends Omit, "id">, Omit, "data"> { + dataId?: string; + result: TResult; + } + interface DiffOptions extends Omit, "rootId"> { + } + interface WatchOptions extends DiffOptions { + watcher?: object; + immediate?: boolean; + callback: WatchCallback; + lastDiff?: DiffResult; + } + interface EvictOptions { + id?: string; + fieldName?: string; + args?: Record; + broadcast?: boolean; + } + interface ResetOptions { + discardWatches?: boolean; + } + interface ModifyOptions = Record> { + id?: string; + fields: Modifiers | AllFieldsModifier; + optimistic?: boolean; + broadcast?: boolean; + } + interface BatchOptions, TUpdateResult = void> { + update(cache: TCache): TUpdateResult; + optimistic?: string | boolean; + removeOptimistic?: string; + onWatchUpdated?: (this: TCache, watch: Cache.WatchOptions, diff: Cache.DiffResult, lastDiff?: Cache.DiffResult | undefined) => any; + } + export import DiffResult = DataProxy.DiffResult; + export import ReadQueryOptions = DataProxy.ReadQueryOptions; + export import ReadFragmentOptions = DataProxy.ReadFragmentOptions; + export import WriteQueryOptions = DataProxy.WriteQueryOptions; + export import WriteFragmentOptions = DataProxy.WriteFragmentOptions; + export import UpdateQueryOptions = DataProxy.UpdateQueryOptions; + export import UpdateFragmentOptions = DataProxy.UpdateFragmentOptions; + export import Fragment = DataProxy.Fragment; +} +//# sourceMappingURL=Cache.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js b/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js new file mode 100644 index 0000000..a691993 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js @@ -0,0 +1,4 @@ +export var Cache; +(function (Cache) { +})(Cache || (Cache = {})); +//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js.map b/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js.map new file mode 100644 index 0000000..506482c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/Cache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"AAIA,MAAM,KAAW,KAAK,CA8GrB;AA9GD,WAAiB,KAAK;AA8GtB,CAAC,EA9GgB,KAAK,KAAL,KAAK,QA8GrB","sourcesContent":["import { DataProxy } from \"./DataProxy.js\";\nimport type { AllFieldsModifier, Modifiers } from \"./common.js\";\nimport type { ApolloCache } from \"../cache.js\";\n\nexport namespace Cache {\n export type WatchCallback = (\n diff: Cache.DiffResult,\n lastDiff?: Cache.DiffResult\n ) => void;\n\n export interface ReadOptions\n extends DataProxy.Query {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n returnPartialData?: boolean;\n /**\n * @deprecated\n * Using `canonizeResults` can result in memory leaks so we generally do not\n * recommend using this option anymore.\n * A future version of Apollo Client will contain a similar feature without\n * the risk of memory leaks.\n */\n canonizeResults?: boolean;\n }\n\n export interface WriteOptions\n extends Omit, \"id\">,\n Omit, \"data\"> {\n dataId?: string;\n result: TResult;\n }\n\n export interface DiffOptions\n extends Omit, \"rootId\"> {\n // The DiffOptions interface is currently just an alias for\n // ReadOptions, though DiffOptions used to be responsible for\n // declaring the returnPartialData option.\n }\n\n export interface WatchOptions\n extends DiffOptions {\n watcher?: object;\n immediate?: boolean;\n callback: WatchCallback;\n lastDiff?: DiffResult;\n }\n\n export interface EvictOptions {\n id?: string;\n fieldName?: string;\n args?: Record;\n broadcast?: boolean;\n }\n\n // Although you can call cache.reset() without options, its behavior can be\n // configured by passing a Cache.ResetOptions object.\n export interface ResetOptions {\n discardWatches?: boolean;\n }\n\n export interface ModifyOptions<\n Entity extends Record = Record,\n > {\n id?: string;\n fields: Modifiers | AllFieldsModifier;\n optimistic?: boolean;\n broadcast?: boolean;\n }\n\n export interface BatchOptions<\n TCache extends ApolloCache,\n TUpdateResult = void,\n > {\n // Same as the first parameter of performTransaction, except the cache\n // argument will have the subclass type rather than ApolloCache.\n update(cache: TCache): TUpdateResult;\n\n // Passing a string for this option creates a new optimistic layer, with the\n // given string as its layer.id, just like passing a string for the\n // optimisticId parameter of performTransaction. Passing true is the same as\n // passing undefined to performTransaction (running the batch operation\n // against the current top layer of the cache), and passing false is the\n // same as passing null (running the operation against root/non-optimistic\n // cache data).\n optimistic?: string | boolean;\n\n // If you specify the ID of an optimistic layer using this option, that\n // layer will be removed as part of the batch transaction, triggering at\n // most one broadcast for both the transaction and the removal of the layer.\n // Note: this option is needed because calling cache.removeOptimistic during\n // the transaction function may not be not safe, since any modifications to\n // cache layers may be discarded after the transaction finishes.\n removeOptimistic?: string;\n\n // If you want to find out which watched queries were invalidated during\n // this batch operation, pass this optional callback function. Returning\n // false from the callback will prevent broadcasting this result.\n onWatchUpdated?: (\n this: TCache,\n watch: Cache.WatchOptions,\n diff: Cache.DiffResult,\n lastDiff?: Cache.DiffResult | undefined\n ) => any;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import ReadQueryOptions = DataProxy.ReadQueryOptions;\n export import ReadFragmentOptions = DataProxy.ReadFragmentOptions;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import UpdateQueryOptions = DataProxy.UpdateQueryOptions;\n export import UpdateFragmentOptions = DataProxy.UpdateFragmentOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.d.ts new file mode 100644 index 0000000..f0b6b3b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.d.ts @@ -0,0 +1,149 @@ +import type { DocumentNode } from "graphql"; +import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +import type { MissingFieldError } from "./common.js"; +import type { Reference } from "../../../utilities/index.js"; +export declare namespace DataProxy { + interface Query { + /** + * The GraphQL query shape to be used constructed using the `gql` template + * string tag from `graphql-tag`. The query will be used to determine the + * shape of the data to be read. + */ + query: DocumentNode | TypedDocumentNode; + /** + * Any variables that the GraphQL query may depend on. + */ + variables?: TVariables; + /** + * The root id to be used. Defaults to "ROOT_QUERY", which is the ID of the + * root query object. This property makes writeQuery capable of writing data + * to any object in the cache. + */ + id?: string; + } + interface Fragment { + /** + * The root id to be used. This id should take the same form as the + * value returned by your `dataIdFromObject` function. If a value with your + * id does not exist in the store, `null` will be returned. + */ + id?: string; + /** + * A GraphQL document created using the `gql` template string tag from + * `graphql-tag` with one or more fragments which will be used to determine + * the shape of data to read. If you provide more than one fragment in this + * document then you must also specify `fragmentName` to select a single. + */ + fragment: DocumentNode | TypedDocumentNode; + /** + * The name of the fragment in your GraphQL document to be used. If you do + * not provide a `fragmentName` and there is only one fragment in your + * `fragment` document then that fragment will be used. + */ + fragmentName?: string; + /** + * Any variables that your GraphQL fragments depend on. + */ + variables?: TVariables; + } + interface ReadQueryOptions extends Query { + /** + * Whether to return incomplete data rather than null. + * Defaults to false. + */ + returnPartialData?: boolean; + /** + * Whether to read from optimistic or non-optimistic cache data. If + * this named option is provided, the optimistic parameter of the + * readQuery method can be omitted. Defaults to false. + */ + optimistic?: boolean; + /** + * Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false. + * + * @deprecated + * + * Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + */ + canonizeResults?: boolean; + } + interface ReadFragmentOptions extends Fragment { + /** + * Whether to return incomplete data rather than null. + * Defaults to false. + */ + returnPartialData?: boolean; + /** + * Whether to read from optimistic or non-optimistic cache data. If + * this named option is provided, the optimistic parameter of the + * readQuery method can be omitted. Defaults to false. + */ + optimistic?: boolean; + /** + * Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false. + * + * @deprecated + * + * Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + */ + canonizeResults?: boolean; + } + interface WriteOptions { + /** + * The data you will be writing to the store. + */ + data: TData; + /** + * Whether to notify query watchers (default: true). + */ + broadcast?: boolean; + /** + * When true, ignore existing field data rather than merging it with + * incoming data (default: false). + */ + overwrite?: boolean; + } + interface WriteQueryOptions extends Query, WriteOptions { + } + interface WriteFragmentOptions extends Fragment, WriteOptions { + } + interface UpdateQueryOptions extends Omit & WriteQueryOptions, "data"> { + } + interface UpdateFragmentOptions extends Omit & WriteFragmentOptions, "data"> { + } + type DiffResult = { + result?: T; + complete?: boolean; + missing?: MissingFieldError[]; + fromOptimisticTransaction?: boolean; + }; +} +/** + * A proxy to the normalized data living in our store. This interface allows a + * user to read and write denormalized data which feels natural to the user + * whilst in the background this data is being converted into the normalized + * store format. + */ +export interface DataProxy { + /** + * Reads a GraphQL query from the root query id. + */ + readQuery(options: DataProxy.ReadQueryOptions, optimistic?: boolean): QueryType | null; + /** + * Reads a GraphQL fragment from any arbitrary id. If there is more than + * one fragment in the provided document then a `fragmentName` must be + * provided to select the correct fragment. + */ + readFragment(options: DataProxy.ReadFragmentOptions, optimistic?: boolean): FragmentType | null; + /** + * Writes a GraphQL query to the root query id. + */ + writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; + /** + * Writes a GraphQL fragment to any arbitrary id. If there is more than + * one fragment in the provided document then a `fragmentName` must be + * provided to select the correct fragment. + */ + writeFragment(options: DataProxy.WriteFragmentOptions): Reference | undefined; +} +//# sourceMappingURL=DataProxy.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js b/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js new file mode 100644 index 0000000..95cad7f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=DataProxy.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js.map b/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js.map new file mode 100644 index 0000000..22bdf77 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/DataProxy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\"; // ignore-comment eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type { MissingFieldError } from \"./common.js\";\nimport type { Reference } from \"../../../utilities/index.js\";\n\nexport namespace DataProxy {\n export interface Query {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n }\n\n export interface Fragment {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by your `dataIdFromObject` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n }\n\n export interface ReadQueryOptions\n extends Query {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n }\n\n export interface ReadFragmentOptions\n extends Fragment {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n }\n\n export interface WriteOptions {\n /**\n * The data you will be writing to the store.\n */\n data: TData;\n /**\n * Whether to notify query watchers (default: true).\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data (default: false).\n */\n overwrite?: boolean;\n }\n\n export interface WriteQueryOptions\n extends Query,\n WriteOptions {}\n\n export interface WriteFragmentOptions\n extends Fragment,\n WriteOptions {}\n\n export interface UpdateQueryOptions\n extends Omit<\n ReadQueryOptions &\n WriteQueryOptions,\n \"data\"\n > {}\n\n export interface UpdateFragmentOptions\n extends Omit<\n ReadFragmentOptions &\n WriteFragmentOptions,\n \"data\"\n > {}\n\n export type DiffResult = {\n result?: T;\n complete?: boolean;\n missing?: MissingFieldError[];\n fromOptimisticTransaction?: boolean;\n };\n}\n\n/**\n * A proxy to the normalized data living in our store. This interface allows a\n * user to read and write denormalized data which feels natural to the user\n * whilst in the background this data is being converted into the normalized\n * store format.\n */\nexport interface DataProxy {\n /**\n * Reads a GraphQL query from the root query id.\n */\n readQuery(\n options: DataProxy.ReadQueryOptions,\n optimistic?: boolean\n ): QueryType | null;\n\n /**\n * Reads a GraphQL fragment from any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n readFragment(\n options: DataProxy.ReadFragmentOptions,\n optimistic?: boolean\n ): FragmentType | null;\n\n /**\n * Writes a GraphQL query to the root query id.\n */\n writeQuery(\n options: DataProxy.WriteQueryOptions\n ): Reference | undefined;\n\n /**\n * Writes a GraphQL fragment to any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n writeFragment(\n options: DataProxy.WriteFragmentOptions\n ): Reference | undefined;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.d.ts new file mode 100644 index 0000000..0725c1e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.d.ts @@ -0,0 +1,62 @@ +import type { DocumentNode, FieldNode } from "graphql"; +import type { Reference, StoreObject, StoreValue, isReference, AsStoreObject } from "../../../utilities/index.js"; +import type { StorageType } from "../../inmemory/policies.js"; +export type SafeReadonly = T extends object ? Readonly : T; +export type MissingTree = string | { + readonly [key: string]: MissingTree; +}; +export declare class MissingFieldError extends Error { + readonly message: string; + readonly path: MissingTree | Array; + readonly query: DocumentNode; + readonly variables?: Record | undefined; + constructor(message: string, path: MissingTree | Array, query: DocumentNode, variables?: Record | undefined); + readonly missing: MissingTree; +} +export interface FieldSpecifier { + typename?: string; + fieldName: string; + field?: FieldNode; + args?: Record; + variables?: Record; +} +export interface ReadFieldOptions extends FieldSpecifier { + from?: StoreObject | Reference; +} +export interface ReadFieldFunction { + (options: ReadFieldOptions): SafeReadonly | undefined; + (fieldName: string, from?: StoreObject | Reference): SafeReadonly | undefined; +} +export type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; +export type CanReadFunction = (value: StoreValue) => boolean; +declare const _deleteModifier: unique symbol; +export interface DeleteModifier { + [_deleteModifier]: true; +} +declare const _invalidateModifier: unique symbol; +export interface InvalidateModifier { + [_invalidateModifier]: true; +} +declare const _ignoreModifier: unique symbol; +export interface IgnoreModifier { + [_ignoreModifier]: true; +} +export type ModifierDetails = { + DELETE: DeleteModifier; + INVALIDATE: InvalidateModifier; + fieldName: string; + storeFieldName: string; + readField: ReadFieldFunction; + canRead: CanReadFunction; + isReference: typeof isReference; + toReference: ToReferenceFunction; + storage: StorageType; +}; +export type Modifier = (value: T, details: ModifierDetails) => T | DeleteModifier | InvalidateModifier; +type StoreObjectValueMaybeReference = StoreVal extends Array> ? StoreVal extends Array ? Item extends Record ? ReadonlyArray | Reference> : never : never : StoreVal extends Record ? AsStoreObject | Reference : StoreVal; +export type AllFieldsModifier> = Modifier> : never>; +export type Modifiers = Record> = Partial<{ + [FieldName in keyof T]: Modifier>>; +}>; +export {}; +//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js b/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js new file mode 100644 index 0000000..1dc21ac --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js @@ -0,0 +1,29 @@ +import { __extends } from "tslib"; +var MissingFieldError = /** @class */ (function (_super) { + __extends(MissingFieldError, _super); + function MissingFieldError(message, path, query, variables) { + var _a; + // 'Error' breaks prototype chain here + var _this = _super.call(this, message) || this; + _this.message = message; + _this.path = path; + _this.query = query; + _this.variables = variables; + if (Array.isArray(_this.path)) { + _this.missing = _this.message; + for (var i = _this.path.length - 1; i >= 0; --i) { + _this.missing = (_a = {}, _a[_this.path[i]] = _this.missing, _a); + } + } + else { + _this.missing = _this.path; + } + // We're not using `Object.setPrototypeOf` here as it isn't fully supported + // on Android (see issue #3236). + _this.__proto__ = MissingFieldError.prototype; + return _this; + } + return MissingFieldError; +}(Error)); +export { MissingFieldError }; +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js.map b/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js.map new file mode 100644 index 0000000..116be0e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/core/types/common.js.map @@ -0,0 +1 @@ +{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/cache/core/types/common.ts"],"names":[],"mappings":";AA2BA;IAAuC,qCAAK;IAC1C,2BACkB,OAAe,EACf,IAA0C,EAC1C,KAAmB,EACnB,SAA+B;;QAE/C,sCAAsC;QACtC,YAAA,MAAK,YAAC,OAAO,CAAC,SAAC;QANC,aAAO,GAAP,OAAO,CAAQ;QACf,UAAI,GAAJ,IAAI,CAAsC;QAC1C,WAAK,GAAL,KAAK,CAAc;QACnB,eAAS,GAAT,SAAS,CAAsB;QAK/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,KAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;gBAC/C,KAAI,CAAC,OAAO,aAAK,GAAC,KAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAG,KAAI,CAAC,OAAO,KAAE,CAAC;YAClD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,IAAI,CAAC;QAC3B,CAAC;QAED,2EAA2E;QAC3E,gCAAgC;QAC/B,KAAY,CAAC,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;;IACxD,CAAC;IAGH,wBAAC;AAAD,CAAC,AAzBD,CAAuC,KAAK,GAyB3C","sourcesContent":["import type { DocumentNode, FieldNode } from \"graphql\";\n\nimport type {\n Reference,\n StoreObject,\n StoreValue,\n isReference,\n AsStoreObject,\n} from \"../../../utilities/index.js\";\n\nimport type { StorageType } from \"../../inmemory/policies.js\";\n\n// The Readonly type only really works for object types, since it marks\n// all of the object's properties as readonly, but there are many cases when\n// a generic type parameter like TExisting might be a string or some other\n// primitive type, in which case we need to avoid wrapping it with Readonly.\n// SafeReadonly collapses to just string, which makes string\n// assignable to SafeReadonly, whereas string is not assignable to\n// Readonly, somewhat surprisingly.\nexport type SafeReadonly = T extends object ? Readonly : T;\n\nexport type MissingTree =\n | string\n | {\n readonly [key: string]: MissingTree;\n };\n\nexport class MissingFieldError extends Error {\n constructor(\n public readonly message: string,\n public readonly path: MissingTree | Array,\n public readonly query: DocumentNode,\n public readonly variables?: Record\n ) {\n // 'Error' breaks prototype chain here\n super(message);\n\n if (Array.isArray(this.path)) {\n this.missing = this.message;\n for (let i = this.path.length - 1; i >= 0; --i) {\n this.missing = { [this.path[i]]: this.missing };\n }\n } else {\n this.missing = this.path;\n }\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully supported\n // on Android (see issue #3236).\n (this as any).__proto__ = MissingFieldError.prototype;\n }\n\n public readonly missing: MissingTree;\n}\n\nexport interface FieldSpecifier {\n typename?: string;\n fieldName: string;\n field?: FieldNode;\n args?: Record;\n variables?: Record;\n}\n\nexport interface ReadFieldOptions extends FieldSpecifier {\n from?: StoreObject | Reference;\n}\n\nexport interface ReadFieldFunction {\n (options: ReadFieldOptions): SafeReadonly | undefined;\n (\n fieldName: string,\n from?: StoreObject | Reference\n ): SafeReadonly | undefined;\n}\n\nexport type ToReferenceFunction = (\n objOrIdOrRef: StoreObject | string | Reference,\n mergeIntoStore?: boolean\n) => Reference | undefined;\n\nexport type CanReadFunction = (value: StoreValue) => boolean;\n\ndeclare const _deleteModifier: unique symbol;\nexport interface DeleteModifier {\n [_deleteModifier]: true;\n}\ndeclare const _invalidateModifier: unique symbol;\nexport interface InvalidateModifier {\n [_invalidateModifier]: true;\n}\ndeclare const _ignoreModifier: unique symbol;\nexport interface IgnoreModifier {\n [_ignoreModifier]: true;\n}\n\nexport type ModifierDetails = {\n DELETE: DeleteModifier;\n INVALIDATE: InvalidateModifier;\n fieldName: string;\n storeFieldName: string;\n readField: ReadFieldFunction;\n canRead: CanReadFunction;\n isReference: typeof isReference;\n toReference: ToReferenceFunction;\n storage: StorageType;\n};\n\nexport type Modifier = (\n value: T,\n details: ModifierDetails\n) => T | DeleteModifier | InvalidateModifier;\n\ntype StoreObjectValueMaybeReference =\n StoreVal extends Array> ?\n StoreVal extends Array ?\n Item extends Record ?\n ReadonlyArray | Reference>\n : never\n : never\n : StoreVal extends Record ? AsStoreObject | Reference\n : StoreVal;\n\nexport type AllFieldsModifier> = Modifier<\n Entity[keyof Entity] extends infer Value ?\n StoreObjectValueMaybeReference>\n : never\n>;\n\nexport type Modifiers = Record> =\n Partial<{\n [FieldName in keyof T]: Modifier<\n StoreObjectValueMaybeReference>\n >;\n }>;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/index.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/index.d.ts new file mode 100644 index 0000000..a37a9b4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/index.d.ts @@ -0,0 +1,20 @@ +import "../utilities/globals/index.js"; +export type { Transaction } from "./core/cache.js"; +export { ApolloCache } from "./core/cache.js"; +export { Cache } from "./core/types/Cache.js"; +export type { DataProxy } from "./core/types/DataProxy.js"; +export type { MissingTree, Modifier, Modifiers, ModifierDetails, ReadFieldOptions, } from "./core/types/common.js"; +export { MissingFieldError } from "./core/types/common.js"; +export type { Reference } from "../utilities/index.js"; +export { isReference, makeReference, canonicalStringify, } from "../utilities/index.js"; +export { EntityStore } from "./inmemory/entityStore.js"; +export { fieldNameFromStoreName, defaultDataIdFromObject, } from "./inmemory/helpers.js"; +export { InMemoryCache } from "./inmemory/inMemoryCache.js"; +export type { ReactiveVar } from "./inmemory/reactiveVars.js"; +export { makeVar, cacheSlot } from "./inmemory/reactiveVars.js"; +export type { TypePolicies, TypePolicy, FieldPolicy, FieldReadFunction, FieldMergeFunction, FieldFunctionOptions, PossibleTypesMap, } from "./inmemory/policies.js"; +export { Policies } from "./inmemory/policies.js"; +export type { FragmentRegistryAPI } from "./inmemory/fragmentRegistry.js"; +export { createFragmentRegistry } from "./inmemory/fragmentRegistry.js"; +export * from "./inmemory/types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/index.js b/graphql-subscription/node_modules/@apollo/client/cache/index.js new file mode 100644 index 0000000..0f760c2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/index.js @@ -0,0 +1,13 @@ +import "../utilities/globals/index.js"; +export { ApolloCache } from "./core/cache.js"; +export { Cache } from "./core/types/Cache.js"; +export { MissingFieldError } from "./core/types/common.js"; +export { isReference, makeReference, canonicalStringify, } from "../utilities/index.js"; +export { EntityStore } from "./inmemory/entityStore.js"; +export { fieldNameFromStoreName, defaultDataIdFromObject, } from "./inmemory/helpers.js"; +export { InMemoryCache } from "./inmemory/inMemoryCache.js"; +export { makeVar, cacheSlot } from "./inmemory/reactiveVars.js"; +export { Policies } from "./inmemory/policies.js"; +export { createFragmentRegistry } from "./inmemory/fragmentRegistry.js"; +export * from "./inmemory/types.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/index.js.map b/graphql-subscription/node_modules/@apollo/client/cache/index.js.map new file mode 100644 index 0000000..7ff1101 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAS9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EACL,WAAW,EACX,aAAa,EACb,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAWhE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,cAAc,qBAAqB,CAAC","sourcesContent":["import \"../utilities/globals/index.js\";\n\nexport type { Transaction } from \"./core/cache.js\";\nexport { ApolloCache } from \"./core/cache.js\";\nexport { Cache } from \"./core/types/Cache.js\";\nexport type { DataProxy } from \"./core/types/DataProxy.js\";\nexport type {\n MissingTree,\n Modifier,\n Modifiers,\n ModifierDetails,\n ReadFieldOptions,\n} from \"./core/types/common.js\";\nexport { MissingFieldError } from \"./core/types/common.js\";\n\nexport type { Reference } from \"../utilities/index.js\";\nexport {\n isReference,\n makeReference,\n canonicalStringify,\n} from \"../utilities/index.js\";\n\nexport { EntityStore } from \"./inmemory/entityStore.js\";\nexport {\n fieldNameFromStoreName,\n defaultDataIdFromObject,\n} from \"./inmemory/helpers.js\";\n\nexport { InMemoryCache } from \"./inmemory/inMemoryCache.js\";\n\nexport type { ReactiveVar } from \"./inmemory/reactiveVars.js\";\nexport { makeVar, cacheSlot } from \"./inmemory/reactiveVars.js\";\n\nexport type {\n TypePolicies,\n TypePolicy,\n FieldPolicy,\n FieldReadFunction,\n FieldMergeFunction,\n FieldFunctionOptions,\n PossibleTypesMap,\n} from \"./inmemory/policies.js\";\nexport { Policies } from \"./inmemory/policies.js\";\n\nexport type { FragmentRegistryAPI } from \"./inmemory/fragmentRegistry.js\";\nexport { createFragmentRegistry } from \"./inmemory/fragmentRegistry.js\";\n\nexport * from \"./inmemory/types.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.d.ts new file mode 100644 index 0000000..032bee0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.d.ts @@ -0,0 +1,92 @@ +import { Trie } from "@wry/trie"; +import type { StoreValue, StoreObject, Reference } from "../../utilities/index.js"; +import type { NormalizedCache, NormalizedCacheObject } from "./types.js"; +import type { Policies, StorageType } from "./policies.js"; +import type { Cache } from "../core/types/Cache.js"; +import type { SafeReadonly, Modifier, Modifiers, ToReferenceFunction, CanReadFunction } from "../core/types/common.js"; +import type { DocumentNode, FieldNode, SelectionSetNode } from "graphql"; +export declare abstract class EntityStore implements NormalizedCache { + readonly policies: Policies; + readonly group: CacheGroup; + protected data: NormalizedCacheObject; + constructor(policies: Policies, group: CacheGroup); + abstract addLayer(layerId: string, replay: (layer: EntityStore) => any): Layer; + abstract removeLayer(layerId: string): EntityStore; + toObject(): NormalizedCacheObject; + has(dataId: string): boolean; + get(dataId: string, fieldName: string): StoreValue; + protected lookup(dataId: string, dependOnExistence?: boolean): StoreObject | undefined; + merge(older: string | StoreObject, newer: StoreObject | string): void; + modify(dataId: string, fields: Modifier | Modifiers>): boolean; + delete(dataId: string, fieldName?: string, args?: Record): boolean; + evict(options: Cache.EvictOptions, limit: EntityStore): boolean; + clear(): void; + extract(): NormalizedCacheObject; + replace(newData: NormalizedCacheObject | null): void; + abstract getStorage(idOrObj: string | StoreObject, ...storeFieldNames: (string | number)[]): StorageType; + private rootIds; + retain(rootId: string): number; + release(rootId: string): number; + getRootIdSet(ids?: Set): Set; + gc(): string[]; + private refs; + findChildRefIds(dataId: string): Record; + /** overload for `InMemoryCache.maybeBroadcastWatch` */ + makeCacheKey(document: DocumentNode, callback: Cache.WatchCallback, details: string): object; + /** overload for `StoreReader.executeSelectionSet` */ + makeCacheKey(selectionSet: SelectionSetNode, parent: string | StoreObject, varString: string | undefined, canonizeResults: boolean): object; + /** overload for `StoreReader.executeSubSelectedArray` */ + makeCacheKey(field: FieldNode, array: readonly any[], varString: string | undefined): object; + /** @deprecated This is only meant for internal usage, + * in your own code please use a `Trie` instance instead. */ + makeCacheKey(...args: any[]): object; + getFieldValue: (objectOrReference: StoreObject | Reference | undefined, storeFieldName: string) => SafeReadonly; + canRead: CanReadFunction; + toReference: ToReferenceFunction; +} +export type FieldValueGetter = EntityStore["getFieldValue"]; +declare class CacheGroup { + readonly caching: boolean; + private parent; + private d; + keyMaker: Trie; + constructor(caching: boolean, parent?: CacheGroup | null); + resetCaching(): void; + depend(dataId: string, storeFieldName: string): void; + dirty(dataId: string, storeFieldName: string): void; +} +export declare function maybeDependOnExistenceOfEntity(store: NormalizedCache, entityId: string): void; +export declare namespace EntityStore { + class Root extends EntityStore { + constructor({ policies, resultCaching, seed, }: { + policies: Policies; + resultCaching?: boolean; + seed?: NormalizedCacheObject; + }); + readonly stump: Stump; + addLayer(layerId: string, replay: (layer: EntityStore) => any): Layer; + removeLayer(): Root; + readonly storageTrie: Trie; + getStorage(): StorageType; + } +} +declare class Layer extends EntityStore { + readonly id: string; + readonly parent: EntityStore; + readonly replay: (layer: EntityStore) => any; + readonly group: CacheGroup; + constructor(id: string, parent: EntityStore, replay: (layer: EntityStore) => any, group: CacheGroup); + addLayer(layerId: string, replay: (layer: EntityStore) => any): Layer; + removeLayer(layerId: string): EntityStore; + toObject(): NormalizedCacheObject; + findChildRefIds(dataId: string): Record; + getStorage(): StorageType; +} +declare class Stump extends Layer { + constructor(root: EntityStore.Root); + removeLayer(): this; + merge(older: string | StoreObject, newer: string | StoreObject): void; +} +export declare function supportsResultCaching(store: any): store is EntityStore; +export {}; +//# sourceMappingURL=entityStore.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js new file mode 100644 index 0000000..aaf6617 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js @@ -0,0 +1,671 @@ +import { __assign, __extends, __rest } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +import { dep } from "optimism"; +import { equal } from "@wry/equality"; +import { Trie } from "@wry/trie"; +import { isReference, makeReference, DeepMerger, maybeDeepFreeze, canUseWeakMap, isNonNullObject, } from "../../utilities/index.js"; +import { hasOwn, fieldNameFromStoreName } from "./helpers.js"; +var DELETE = Object.create(null); +var delModifier = function () { return DELETE; }; +var INVALIDATE = Object.create(null); +var EntityStore = /** @class */ (function () { + function EntityStore(policies, group) { + var _this = this; + this.policies = policies; + this.group = group; + this.data = Object.create(null); + // Maps root entity IDs to the number of times they have been retained, minus + // the number of times they have been released. Retained entities keep other + // entities they reference (even indirectly) from being garbage collected. + this.rootIds = Object.create(null); + // Lazily tracks { __ref: } strings contained by this.data[dataId]. + this.refs = Object.create(null); + // Bound function that can be passed around to provide easy access to fields + // of Reference objects as well as ordinary objects. + this.getFieldValue = function (objectOrReference, storeFieldName) { + return maybeDeepFreeze(isReference(objectOrReference) ? + _this.get(objectOrReference.__ref, storeFieldName) + : objectOrReference && objectOrReference[storeFieldName]); + }; + // Returns true for non-normalized StoreObjects and non-dangling + // References, indicating that readField(name, objOrRef) has a chance of + // working. Useful for filtering out dangling references from lists. + this.canRead = function (objOrRef) { + return isReference(objOrRef) ? + _this.has(objOrRef.__ref) + : typeof objOrRef === "object"; + }; + // Bound function that converts an id or an object with a __typename and + // primary key fields to a Reference object. If called with a Reference object, + // that same Reference object is returned. Pass true for mergeIntoStore to persist + // an object into the store. + this.toReference = function (objOrIdOrRef, mergeIntoStore) { + if (typeof objOrIdOrRef === "string") { + return makeReference(objOrIdOrRef); + } + if (isReference(objOrIdOrRef)) { + return objOrIdOrRef; + } + var id = _this.policies.identify(objOrIdOrRef)[0]; + if (id) { + var ref = makeReference(id); + if (mergeIntoStore) { + _this.merge(id, objOrIdOrRef); + } + return ref; + } + }; + } + // Although the EntityStore class is abstract, it contains concrete + // implementations of the various NormalizedCache interface methods that + // are inherited by the Root and Layer subclasses. + EntityStore.prototype.toObject = function () { + return __assign({}, this.data); + }; + EntityStore.prototype.has = function (dataId) { + return this.lookup(dataId, true) !== void 0; + }; + EntityStore.prototype.get = function (dataId, fieldName) { + this.group.depend(dataId, fieldName); + if (hasOwn.call(this.data, dataId)) { + var storeObject = this.data[dataId]; + if (storeObject && hasOwn.call(storeObject, fieldName)) { + return storeObject[fieldName]; + } + } + if (fieldName === "__typename" && + hasOwn.call(this.policies.rootTypenamesById, dataId)) { + return this.policies.rootTypenamesById[dataId]; + } + if (this instanceof Layer) { + return this.parent.get(dataId, fieldName); + } + }; + EntityStore.prototype.lookup = function (dataId, dependOnExistence) { + // The has method (above) calls lookup with dependOnExistence = true, so + // that it can later be invalidated when we add or remove a StoreObject for + // this dataId. Any consumer who cares about the contents of the StoreObject + // should not rely on this dependency, since the contents could change + // without the object being added or removed. + if (dependOnExistence) + this.group.depend(dataId, "__exists"); + if (hasOwn.call(this.data, dataId)) { + return this.data[dataId]; + } + if (this instanceof Layer) { + return this.parent.lookup(dataId, dependOnExistence); + } + if (this.policies.rootTypenamesById[dataId]) { + return Object.create(null); + } + }; + EntityStore.prototype.merge = function (older, newer) { + var _this = this; + var dataId; + // Convert unexpected references to ID strings. + if (isReference(older)) + older = older.__ref; + if (isReference(newer)) + newer = newer.__ref; + var existing = typeof older === "string" ? this.lookup((dataId = older)) : older; + var incoming = typeof newer === "string" ? this.lookup((dataId = newer)) : newer; + // If newer was a string ID, but that ID was not defined in this store, + // then there are no fields to be merged, so we're done. + if (!incoming) + return; + invariant(typeof dataId === "string", 1); + var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming); + // Even if merged === existing, existing may have come from a lower + // layer, so we always need to set this.data[dataId] on this level. + this.data[dataId] = merged; + if (merged !== existing) { + delete this.refs[dataId]; + if (this.group.caching) { + var fieldsToDirty_1 = Object.create(null); + // If we added a new StoreObject where there was previously none, dirty + // anything that depended on the existence of this dataId, such as the + // EntityStore#has method. + if (!existing) + fieldsToDirty_1.__exists = 1; + // Now invalidate dependents who called getFieldValue for any fields + // that are changing as a result of this merge. + Object.keys(incoming).forEach(function (storeFieldName) { + if (!existing || + existing[storeFieldName] !== merged[storeFieldName]) { + // Always dirty the full storeFieldName, which may include + // serialized arguments following the fieldName prefix. + fieldsToDirty_1[storeFieldName] = 1; + // Also dirty fieldNameFromStoreName(storeFieldName) if it's + // different from storeFieldName and this field does not have + // keyArgs configured, because that means the cache can't make + // any assumptions about how field values with the same field + // name but different arguments might be interrelated, so it + // must err on the side of invalidating all field values that + // share the same short fieldName, regardless of arguments. + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName && + !_this.policies.hasKeyArgs(merged.__typename, fieldName)) { + fieldsToDirty_1[fieldName] = 1; + } + // If merged[storeFieldName] has become undefined, and this is the + // Root layer, actually delete the property from the merged object, + // which is guaranteed to have been created fresh in this method. + if (merged[storeFieldName] === void 0 && !(_this instanceof Layer)) { + delete merged[storeFieldName]; + } + } + }); + if (fieldsToDirty_1.__typename && + !(existing && existing.__typename) && + // Since we return default root __typename strings + // automatically from store.get, we don't need to dirty the + // ROOT_QUERY.__typename field if merged.__typename is equal + // to the default string (usually "Query"). + this.policies.rootTypenamesById[dataId] === merged.__typename) { + delete fieldsToDirty_1.__typename; + } + Object.keys(fieldsToDirty_1).forEach(function (fieldName) { + return _this.group.dirty(dataId, fieldName); + }); + } + } + }; + EntityStore.prototype.modify = function (dataId, fields) { + var _this = this; + var storeObject = this.lookup(dataId); + if (storeObject) { + var changedFields_1 = Object.create(null); + var needToMerge_1 = false; + var allDeleted_1 = true; + var sharedDetails_1 = { + DELETE: DELETE, + INVALIDATE: INVALIDATE, + isReference: isReference, + toReference: this.toReference, + canRead: this.canRead, + readField: function (fieldNameOrOptions, from) { + return _this.policies.readField(typeof fieldNameOrOptions === "string" ? + { + fieldName: fieldNameOrOptions, + from: from || makeReference(dataId), + } + : fieldNameOrOptions, { store: _this }); + }, + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + var fieldName = fieldNameFromStoreName(storeFieldName); + var fieldValue = storeObject[storeFieldName]; + if (fieldValue === void 0) + return; + var modify = typeof fields === "function" ? fields : (fields[storeFieldName] || fields[fieldName]); + if (modify) { + var newValue = modify === delModifier ? DELETE : (modify(maybeDeepFreeze(fieldValue), __assign(__assign({}, sharedDetails_1), { fieldName: fieldName, storeFieldName: storeFieldName, storage: _this.getStorage(dataId, storeFieldName) }))); + if (newValue === INVALIDATE) { + _this.group.dirty(dataId, storeFieldName); + } + else { + if (newValue === DELETE) + newValue = void 0; + if (newValue !== fieldValue) { + changedFields_1[storeFieldName] = newValue; + needToMerge_1 = true; + fieldValue = newValue; + if (globalThis.__DEV__ !== false) { + var checkReference = function (ref) { + if (_this.lookup(ref.__ref) === undefined) { + globalThis.__DEV__ !== false && invariant.warn(2, ref); + return true; + } + }; + if (isReference(newValue)) { + checkReference(newValue); + } + else if (Array.isArray(newValue)) { + // Warn about writing "mixed" arrays of Reference and non-Reference objects + var seenReference = false; + var someNonReference = void 0; + for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) { + var value = newValue_1[_i]; + if (isReference(value)) { + seenReference = true; + if (checkReference(value)) + break; + } + else { + // Do not warn on primitive values, since those could never be represented + // by a reference. This is a valid (albeit uncommon) use case. + if (typeof value === "object" && !!value) { + var id = _this.policies.identify(value)[0]; + // check if object could even be referenced, otherwise we are not interested in it for this warning + if (id) { + someNonReference = value; + } + } + } + if (seenReference && someNonReference !== undefined) { + globalThis.__DEV__ !== false && invariant.warn(3, someNonReference); + break; + } + } + } + } + } + } + } + if (fieldValue !== void 0) { + allDeleted_1 = false; + } + }); + if (needToMerge_1) { + this.merge(dataId, changedFields_1); + if (allDeleted_1) { + if (this instanceof Layer) { + this.data[dataId] = void 0; + } + else { + delete this.data[dataId]; + } + this.group.dirty(dataId, "__exists"); + } + return true; + } + } + return false; + }; + // If called with only one argument, removes the entire entity + // identified by dataId. If called with a fieldName as well, removes all + // fields of that entity whose names match fieldName according to the + // fieldNameFromStoreName helper function. If called with a fieldName + // and variables, removes all fields of that entity whose names match fieldName + // and whose arguments when cached exactly match the variables passed. + EntityStore.prototype.delete = function (dataId, fieldName, args) { + var _a; + var storeObject = this.lookup(dataId); + if (storeObject) { + var typename = this.getFieldValue(storeObject, "__typename"); + var storeFieldName = fieldName && args ? + this.policies.getStoreFieldName({ typename: typename, fieldName: fieldName, args: args }) + : fieldName; + return this.modify(dataId, storeFieldName ? (_a = {}, + _a[storeFieldName] = delModifier, + _a) : delModifier); + } + return false; + }; + EntityStore.prototype.evict = function (options, limit) { + var evicted = false; + if (options.id) { + if (hasOwn.call(this.data, options.id)) { + evicted = this.delete(options.id, options.fieldName, options.args); + } + if (this instanceof Layer && this !== limit) { + evicted = this.parent.evict(options, limit) || evicted; + } + // Always invalidate the field to trigger rereading of watched + // queries, even if no cache data was modified by the eviction, + // because queries may depend on computed fields with custom read + // functions, whose values are not stored in the EntityStore. + if (options.fieldName || evicted) { + this.group.dirty(options.id, options.fieldName || "__exists"); + } + } + return evicted; + }; + EntityStore.prototype.clear = function () { + this.replace(null); + }; + EntityStore.prototype.extract = function () { + var _this = this; + var obj = this.toObject(); + var extraRootIds = []; + this.getRootIdSet().forEach(function (id) { + if (!hasOwn.call(_this.policies.rootTypenamesById, id)) { + extraRootIds.push(id); + } + }); + if (extraRootIds.length) { + obj.__META = { extraRootIds: extraRootIds.sort() }; + } + return obj; + }; + EntityStore.prototype.replace = function (newData) { + var _this = this; + Object.keys(this.data).forEach(function (dataId) { + if (!(newData && hasOwn.call(newData, dataId))) { + _this.delete(dataId); + } + }); + if (newData) { + var __META = newData.__META, rest_1 = __rest(newData, ["__META"]); + Object.keys(rest_1).forEach(function (dataId) { + _this.merge(dataId, rest_1[dataId]); + }); + if (__META) { + __META.extraRootIds.forEach(this.retain, this); + } + } + }; + EntityStore.prototype.retain = function (rootId) { + return (this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1); + }; + EntityStore.prototype.release = function (rootId) { + if (this.rootIds[rootId] > 0) { + var count = --this.rootIds[rootId]; + if (!count) + delete this.rootIds[rootId]; + return count; + } + return 0; + }; + // Return a Set of all the ID strings that have been retained by + // this layer/root *and* any layers/roots beneath it. + EntityStore.prototype.getRootIdSet = function (ids) { + if (ids === void 0) { ids = new Set(); } + Object.keys(this.rootIds).forEach(ids.add, ids); + if (this instanceof Layer) { + this.parent.getRootIdSet(ids); + } + else { + // Official singleton IDs like ROOT_QUERY and ROOT_MUTATION are + // always considered roots for garbage collection, regardless of + // their retainment counts in this.rootIds. + Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids); + } + return ids; + }; + // The goal of garbage collection is to remove IDs from the Root layer of the + // store that are no longer reachable starting from any IDs that have been + // explicitly retained (see retain and release, above). Returns an array of + // dataId strings that were removed from the store. + EntityStore.prototype.gc = function () { + var _this = this; + var ids = this.getRootIdSet(); + var snapshot = this.toObject(); + ids.forEach(function (id) { + if (hasOwn.call(snapshot, id)) { + // Because we are iterating over an ECMAScript Set, the IDs we add here + // will be visited in later iterations of the forEach loop only if they + // were not previously contained by the Set. + Object.keys(_this.findChildRefIds(id)).forEach(ids.add, ids); + // By removing IDs from the snapshot object here, we protect them from + // getting removed from the root store layer below. + delete snapshot[id]; + } + }); + var idsToRemove = Object.keys(snapshot); + if (idsToRemove.length) { + var root_1 = this; + while (root_1 instanceof Layer) + root_1 = root_1.parent; + idsToRemove.forEach(function (id) { return root_1.delete(id); }); + } + return idsToRemove; + }; + EntityStore.prototype.findChildRefIds = function (dataId) { + if (!hasOwn.call(this.refs, dataId)) { + var found_1 = (this.refs[dataId] = Object.create(null)); + var root = this.data[dataId]; + if (!root) + return found_1; + var workSet_1 = new Set([root]); + // Within the store, only arrays and objects can contain child entity + // references, so we can prune the traversal using this predicate: + workSet_1.forEach(function (obj) { + if (isReference(obj)) { + found_1[obj.__ref] = true; + // In rare cases, a { __ref } Reference object may have other fields. + // This often indicates a mismerging of References with StoreObjects, + // but garbage collection should not be fooled by a stray __ref + // property in a StoreObject (ignoring all the other fields just + // because the StoreObject looks like a Reference). To avoid this + // premature termination of findChildRefIds recursion, we fall through + // to the code below, which will handle any other properties of obj. + } + if (isNonNullObject(obj)) { + Object.keys(obj).forEach(function (key) { + var child = obj[key]; + // No need to add primitive values to the workSet, since they cannot + // contain reference objects. + if (isNonNullObject(child)) { + workSet_1.add(child); + } + }); + } + }); + } + return this.refs[dataId]; + }; + EntityStore.prototype.makeCacheKey = function () { + return this.group.keyMaker.lookupArray(arguments); + }; + return EntityStore; +}()); +export { EntityStore }; +// A single CacheGroup represents a set of one or more EntityStore objects, +// typically the Root store in a CacheGroup by itself, and all active Layer +// stores in a group together. A single EntityStore object belongs to only +// one CacheGroup, store.group. The CacheGroup is responsible for tracking +// dependencies, so store.group is helpful for generating unique keys for +// cached results that need to be invalidated when/if those dependencies +// change. If we used the EntityStore objects themselves as cache keys (that +// is, store rather than store.group), the cache would become unnecessarily +// fragmented by all the different Layer objects. Instead, the CacheGroup +// approach allows all optimistic Layer objects in the same linked list to +// belong to one CacheGroup, with the non-optimistic Root object belonging +// to another CacheGroup, allowing resultCaching dependencies to be tracked +// separately for optimistic and non-optimistic entity data. +var CacheGroup = /** @class */ (function () { + function CacheGroup(caching, parent) { + if (parent === void 0) { parent = null; } + this.caching = caching; + this.parent = parent; + this.d = null; + this.resetCaching(); + } + CacheGroup.prototype.resetCaching = function () { + this.d = this.caching ? dep() : null; + this.keyMaker = new Trie(canUseWeakMap); + }; + CacheGroup.prototype.depend = function (dataId, storeFieldName) { + if (this.d) { + this.d(makeDepKey(dataId, storeFieldName)); + var fieldName = fieldNameFromStoreName(storeFieldName); + if (fieldName !== storeFieldName) { + // Fields with arguments that contribute extra identifying + // information to the fieldName (thus forming the storeFieldName) + // depend not only on the full storeFieldName but also on the + // short fieldName, so the field can be invalidated using either + // level of specificity. + this.d(makeDepKey(dataId, fieldName)); + } + if (this.parent) { + this.parent.depend(dataId, storeFieldName); + } + } + }; + CacheGroup.prototype.dirty = function (dataId, storeFieldName) { + if (this.d) { + this.d.dirty(makeDepKey(dataId, storeFieldName), + // When storeFieldName === "__exists", that means the entity identified + // by dataId has either disappeared from the cache or was newly added, + // so the result caching system would do well to "forget everything it + // knows" about that object. To achieve that kind of invalidation, we + // not only dirty the associated result cache entry, but also remove it + // completely from the dependency graph. For the optimism implementation + // details, see https://github.com/benjamn/optimism/pull/195. + storeFieldName === "__exists" ? "forget" : "setDirty"); + } + }; + return CacheGroup; +}()); +function makeDepKey(dataId, storeFieldName) { + // Since field names cannot have '#' characters in them, this method + // of joining the field name and the ID should be unambiguous, and much + // cheaper than JSON.stringify([dataId, fieldName]). + return storeFieldName + "#" + dataId; +} +export function maybeDependOnExistenceOfEntity(store, entityId) { + if (supportsResultCaching(store)) { + // We use this pseudo-field __exists elsewhere in the EntityStore code to + // represent changes in the existence of the entity object identified by + // entityId. This dependency gets reliably dirtied whenever an object with + // this ID is deleted (or newly created) within this group, so any result + // cache entries (for example, StoreReader#executeSelectionSet results) that + // depend on __exists for this entityId will get dirtied as well, leading to + // the eventual recomputation (instead of reuse) of those result objects the + // next time someone reads them from the cache. + store.group.depend(entityId, "__exists"); + } +} +(function (EntityStore) { + // Refer to this class as EntityStore.Root outside this namespace. + var Root = /** @class */ (function (_super) { + __extends(Root, _super); + function Root(_a) { + var policies = _a.policies, _b = _a.resultCaching, resultCaching = _b === void 0 ? true : _b, seed = _a.seed; + var _this = _super.call(this, policies, new CacheGroup(resultCaching)) || this; + _this.stump = new Stump(_this); + _this.storageTrie = new Trie(canUseWeakMap); + if (seed) + _this.replace(seed); + return _this; + } + Root.prototype.addLayer = function (layerId, replay) { + // Adding an optimistic Layer on top of the Root actually adds the Layer + // on top of the Stump, so the Stump always comes between the Root and + // any Layer objects that we've added. + return this.stump.addLayer(layerId, replay); + }; + Root.prototype.removeLayer = function () { + // Never remove the root layer. + return this; + }; + Root.prototype.getStorage = function () { + return this.storageTrie.lookupArray(arguments); + }; + return Root; + }(EntityStore)); + EntityStore.Root = Root; +})(EntityStore || (EntityStore = {})); +// Not exported, since all Layer instances are created by the addLayer method +// of the EntityStore.Root class. +var Layer = /** @class */ (function (_super) { + __extends(Layer, _super); + function Layer(id, parent, replay, group) { + var _this = _super.call(this, parent.policies, group) || this; + _this.id = id; + _this.parent = parent; + _this.replay = replay; + _this.group = group; + replay(_this); + return _this; + } + Layer.prototype.addLayer = function (layerId, replay) { + return new Layer(layerId, this, replay, this.group); + }; + Layer.prototype.removeLayer = function (layerId) { + var _this = this; + // Remove all instances of the given id, not just the first one. + var parent = this.parent.removeLayer(layerId); + if (layerId === this.id) { + if (this.group.caching) { + // Dirty every ID we're removing. Technically we might be able to avoid + // dirtying fields that have values in higher layers, but we don't have + // easy access to higher layers here, and we're about to recreate those + // layers anyway (see parent.addLayer below). + Object.keys(this.data).forEach(function (dataId) { + var ownStoreObject = _this.data[dataId]; + var parentStoreObject = parent["lookup"](dataId); + if (!parentStoreObject) { + // The StoreObject identified by dataId was defined in this layer + // but will be undefined in the parent layer, so we can delete the + // whole entity using this.delete(dataId). Since we're about to + // throw this layer away, the only goal of this deletion is to dirty + // the removed fields. + _this.delete(dataId); + } + else if (!ownStoreObject) { + // This layer had an entry for dataId but it was undefined, which + // means the entity was deleted in this layer, and it's about to + // become undeleted when we remove this layer, so we need to dirty + // all fields that are about to be reexposed. + _this.group.dirty(dataId, "__exists"); + Object.keys(parentStoreObject).forEach(function (storeFieldName) { + _this.group.dirty(dataId, storeFieldName); + }); + } + else if (ownStoreObject !== parentStoreObject) { + // If ownStoreObject is not exactly the same as parentStoreObject, + // dirty any fields whose values will change as a result of this + // removal. + Object.keys(ownStoreObject).forEach(function (storeFieldName) { + if (!equal(ownStoreObject[storeFieldName], parentStoreObject[storeFieldName])) { + _this.group.dirty(dataId, storeFieldName); + } + }); + } + }); + } + return parent; + } + // No changes are necessary if the parent chain remains identical. + if (parent === this.parent) + return this; + // Recreate this layer on top of the new parent. + return parent.addLayer(this.id, this.replay); + }; + Layer.prototype.toObject = function () { + return __assign(__assign({}, this.parent.toObject()), this.data); + }; + Layer.prototype.findChildRefIds = function (dataId) { + var fromParent = this.parent.findChildRefIds(dataId); + return hasOwn.call(this.data, dataId) ? __assign(__assign({}, fromParent), _super.prototype.findChildRefIds.call(this, dataId)) : fromParent; + }; + Layer.prototype.getStorage = function () { + var p = this.parent; + while (p.parent) + p = p.parent; + return p.getStorage.apply(p, + // @ts-expect-error + arguments); + }; + return Layer; +}(EntityStore)); +// Represents a Layer permanently installed just above the Root, which allows +// reading optimistically (and registering optimistic dependencies) even when +// no optimistic layers are currently active. The stump.group CacheGroup object +// is shared by any/all Layer objects added on top of the Stump. +var Stump = /** @class */ (function (_super) { + __extends(Stump, _super); + function Stump(root) { + return _super.call(this, "EntityStore.Stump", root, function () { }, new CacheGroup(root.group.caching, root.group)) || this; + } + Stump.prototype.removeLayer = function () { + // Never remove the Stump layer. + return this; + }; + Stump.prototype.merge = function (older, newer) { + // We never want to write any data into the Stump, so we forward any merge + // calls to the Root instead. Another option here would be to throw an + // exception, but the toReference(object, true) function can sometimes + // trigger Stump writes (which used to be Root writes, before the Stump + // concept was introduced). + return this.parent.merge(older, newer); + }; + return Stump; +}(Layer)); +function storeObjectReconciler(existingObject, incomingObject, property) { + var existingValue = existingObject[property]; + var incomingValue = incomingObject[property]; + // Wherever there is a key collision, prefer the incoming value, unless + // it is deeply equal to the existing value. It's worth checking deep + // equality here (even though blindly returning incoming would be + // logically correct) because preserving the referential identity of + // existing data can prevent needless rereading and rerendering. + return equal(existingValue, incomingValue) ? existingValue : incomingValue; +} +export function supportsResultCaching(store) { + // When result caching is disabled, store.depend will be null. + return !!(store instanceof EntityStore && store.group.caching); +} +//# sourceMappingURL=entityStore.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js.map new file mode 100644 index 0000000..b2db5ae --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/entityStore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"entityStore.js","sourceRoot":"","sources":["../../../src/cache/inmemory/entityStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,OAAO,EACL,WAAW,EACX,aAAa,EACb,UAAU,EACV,eAAe,EACf,aAAa,EACb,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAgB9D,IAAM,MAAM,GAAmB,MAAM,CAAC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E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,gEAAgE;AAChE;IAAoB,yBAAK;IACvB,eAAY,IAAsB;QAChC,OAAA,MAAK,YACH,mBAAmB,EACnB,IAAI,EACJ,cAAO,CAAC,EACR,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAC/C,SAAC;IACJ,CAAC;IAEM,2BAAW,GAAlB;QACE,gCAAgC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,qBAAK,GAAZ,UAAa,KAA2B,EAAE,KAA2B;QACnE,0EAA0E;QAC1E,sEAAsE;QACtE,sEAAsE;QACtE,uEAAuE;QACvE,2BAA2B;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IACH,YAAC;AAAD,CAAC,AAvBD,CAAoB,KAAK,GAuBxB;AAED,SAAS,qBAAqB,CAC5B,cAA2B,EAC3B,cAA2B,EAC3B,QAAyB;IAEzB,IAAM,aAAa,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC/C,IAAM,aAAa,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC/C,uEAAuE;IACvE,qEAAqE;IACrE,iEAAiE;IACjE,oEAAoE;IACpE,gEAAgE;IAChE,OAAO,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAU;IAC9C,8DAA8D;IAC9D,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport type { OptimisticDependencyFunction } from \"optimism\";\nimport { dep } from \"optimism\";\nimport { equal } from \"@wry/equality\";\nimport { Trie } from \"@wry/trie\";\n\nimport type {\n StoreValue,\n StoreObject,\n Reference,\n} from \"../../utilities/index.js\";\nimport {\n isReference,\n makeReference,\n DeepMerger,\n maybeDeepFreeze,\n canUseWeakMap,\n isNonNullObject,\n} from \"../../utilities/index.js\";\nimport type { NormalizedCache, NormalizedCacheObject } from \"./types.js\";\nimport { hasOwn, fieldNameFromStoreName } from \"./helpers.js\";\nimport type { Policies, StorageType } from \"./policies.js\";\nimport type { Cache } from \"../core/types/Cache.js\";\nimport type {\n SafeReadonly,\n Modifier,\n Modifiers,\n ReadFieldOptions,\n ToReferenceFunction,\n CanReadFunction,\n InvalidateModifier,\n DeleteModifier,\n ModifierDetails,\n} from \"../core/types/common.js\";\nimport type { DocumentNode, FieldNode, SelectionSetNode } from \"graphql\";\n\nconst DELETE: DeleteModifier = Object.create(null);\nconst delModifier: Modifier = () => DELETE;\nconst INVALIDATE: InvalidateModifier = Object.create(null);\n\nexport abstract class EntityStore implements NormalizedCache {\n protected data: NormalizedCacheObject = Object.create(null);\n\n constructor(\n public readonly policies: Policies,\n public readonly group: CacheGroup\n ) {}\n\n public abstract addLayer(\n layerId: string,\n replay: (layer: EntityStore) => any\n ): Layer;\n\n public abstract removeLayer(layerId: string): EntityStore;\n\n // Although the EntityStore class is abstract, it contains concrete\n // implementations of the various NormalizedCache interface methods that\n // are inherited by the Root and Layer subclasses.\n\n public toObject(): NormalizedCacheObject {\n return { ...this.data };\n }\n\n public has(dataId: string): boolean {\n return this.lookup(dataId, true) !== void 0;\n }\n\n public get(dataId: string, fieldName: string): StoreValue {\n this.group.depend(dataId, fieldName);\n if (hasOwn.call(this.data, dataId)) {\n const storeObject = this.data[dataId];\n if (storeObject && hasOwn.call(storeObject, fieldName)) {\n return storeObject[fieldName];\n }\n }\n if (\n fieldName === \"__typename\" &&\n hasOwn.call(this.policies.rootTypenamesById, dataId)\n ) {\n return this.policies.rootTypenamesById[dataId];\n }\n if (this instanceof Layer) {\n return this.parent.get(dataId, fieldName);\n }\n }\n\n protected lookup(\n dataId: string,\n dependOnExistence?: boolean\n ): StoreObject | undefined {\n // The has method (above) calls lookup with dependOnExistence = true, so\n // that it can later be invalidated when we add or remove a StoreObject for\n // this dataId. Any consumer who cares about the contents of the StoreObject\n // should not rely on this dependency, since the contents could change\n // without the object being added or removed.\n if (dependOnExistence) this.group.depend(dataId, \"__exists\");\n\n if (hasOwn.call(this.data, dataId)) {\n return this.data[dataId];\n }\n\n if (this instanceof Layer) {\n return this.parent.lookup(dataId, dependOnExistence);\n }\n\n if (this.policies.rootTypenamesById[dataId]) {\n return Object.create(null);\n }\n }\n\n public merge(older: string | StoreObject, newer: StoreObject | string): void {\n let dataId: string | undefined;\n\n // Convert unexpected references to ID strings.\n if (isReference(older)) older = older.__ref;\n if (isReference(newer)) newer = newer.__ref;\n\n const existing: StoreObject | undefined =\n typeof older === \"string\" ? this.lookup((dataId = older)) : older;\n\n const incoming: StoreObject | undefined =\n typeof newer === \"string\" ? this.lookup((dataId = newer)) : newer;\n\n // If newer was a string ID, but that ID was not defined in this store,\n // then there are no fields to be merged, so we're done.\n if (!incoming) return;\n\n invariant(typeof dataId === \"string\", \"store.merge expects a string ID\");\n\n const merged: StoreObject = new DeepMerger(storeObjectReconciler).merge(\n existing,\n incoming\n );\n\n // Even if merged === existing, existing may have come from a lower\n // layer, so we always need to set this.data[dataId] on this level.\n this.data[dataId] = merged;\n\n if (merged !== existing) {\n delete this.refs[dataId];\n if (this.group.caching) {\n const fieldsToDirty: Record = Object.create(null);\n\n // If we added a new StoreObject where there was previously none, dirty\n // anything that depended on the existence of this dataId, such as the\n // EntityStore#has method.\n if (!existing) fieldsToDirty.__exists = 1;\n\n // Now invalidate dependents who called getFieldValue for any fields\n // that are changing as a result of this merge.\n Object.keys(incoming).forEach((storeFieldName) => {\n if (\n !existing ||\n existing[storeFieldName] !== merged[storeFieldName]\n ) {\n // Always dirty the full storeFieldName, which may include\n // serialized arguments following the fieldName prefix.\n fieldsToDirty[storeFieldName] = 1;\n\n // Also dirty fieldNameFromStoreName(storeFieldName) if it's\n // different from storeFieldName and this field does not have\n // keyArgs configured, because that means the cache can't make\n // any assumptions about how field values with the same field\n // name but different arguments might be interrelated, so it\n // must err on the side of invalidating all field values that\n // share the same short fieldName, regardless of arguments.\n const fieldName = fieldNameFromStoreName(storeFieldName);\n if (\n fieldName !== storeFieldName &&\n !this.policies.hasKeyArgs(merged.__typename, fieldName)\n ) {\n fieldsToDirty[fieldName] = 1;\n }\n\n // If merged[storeFieldName] has become undefined, and this is the\n // Root layer, actually delete the property from the merged object,\n // which is guaranteed to have been created fresh in this method.\n if (merged[storeFieldName] === void 0 && !(this instanceof Layer)) {\n delete merged[storeFieldName];\n }\n }\n });\n\n if (\n fieldsToDirty.__typename &&\n !(existing && existing.__typename) &&\n // Since we return default root __typename strings\n // automatically from store.get, we don't need to dirty the\n // ROOT_QUERY.__typename field if merged.__typename is equal\n // to the default string (usually \"Query\").\n this.policies.rootTypenamesById[dataId] === merged.__typename\n ) {\n delete fieldsToDirty.__typename;\n }\n\n Object.keys(fieldsToDirty).forEach((fieldName) =>\n this.group.dirty(dataId as string, fieldName)\n );\n }\n }\n }\n\n public modify(\n dataId: string,\n fields: Modifier | Modifiers>\n ): boolean {\n const storeObject = this.lookup(dataId);\n\n if (storeObject) {\n const changedFields: Record = Object.create(null);\n let needToMerge = false;\n let allDeleted = true;\n\n const sharedDetails = {\n DELETE,\n INVALIDATE,\n isReference,\n toReference: this.toReference,\n canRead: this.canRead,\n readField: (\n fieldNameOrOptions: string | ReadFieldOptions,\n from?: StoreObject | Reference\n ) =>\n this.policies.readField(\n typeof fieldNameOrOptions === \"string\" ?\n {\n fieldName: fieldNameOrOptions,\n from: from || makeReference(dataId),\n }\n : fieldNameOrOptions,\n { store: this }\n ),\n } satisfies Partial;\n\n Object.keys(storeObject).forEach((storeFieldName) => {\n const fieldName = fieldNameFromStoreName(storeFieldName);\n let fieldValue = storeObject[storeFieldName];\n if (fieldValue === void 0) return;\n const modify: Modifier | undefined =\n typeof fields === \"function\" ? fields : (\n fields[storeFieldName] || fields[fieldName]\n );\n if (modify) {\n let newValue =\n modify === delModifier ? DELETE : (\n modify(maybeDeepFreeze(fieldValue), {\n ...sharedDetails,\n fieldName,\n storeFieldName,\n storage: this.getStorage(dataId, storeFieldName),\n })\n );\n if (newValue === INVALIDATE) {\n this.group.dirty(dataId, storeFieldName);\n } else {\n if (newValue === DELETE) newValue = void 0;\n if (newValue !== fieldValue) {\n changedFields[storeFieldName] = newValue;\n needToMerge = true;\n fieldValue = newValue;\n\n if (__DEV__) {\n const checkReference = (ref: Reference) => {\n if (this.lookup(ref.__ref) === undefined) {\n invariant.warn(\n \"cache.modify: You are trying to write a Reference that is not part of the store: %o\\n\" +\n \"Please make sure to set the `mergeIntoStore` parameter to `true` when creating a Reference that is not part of the store yet:\\n\" +\n \"`toReference(object, true)`\",\n ref\n );\n return true;\n }\n };\n if (isReference(newValue)) {\n checkReference(newValue);\n } else if (Array.isArray(newValue)) {\n // Warn about writing \"mixed\" arrays of Reference and non-Reference objects\n let seenReference: boolean = false;\n let someNonReference: unknown;\n for (const value of newValue) {\n if (isReference(value)) {\n seenReference = true;\n if (checkReference(value)) break;\n } else {\n // Do not warn on primitive values, since those could never be represented\n // by a reference. This is a valid (albeit uncommon) use case.\n if (typeof value === \"object\" && !!value) {\n const [id] = this.policies.identify(value);\n // check if object could even be referenced, otherwise we are not interested in it for this warning\n if (id) {\n someNonReference = value;\n }\n }\n }\n if (seenReference && someNonReference !== undefined) {\n invariant.warn(\n \"cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\\n\" +\n \"Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`.\",\n someNonReference\n );\n break;\n }\n }\n }\n }\n }\n }\n }\n if (fieldValue !== void 0) {\n allDeleted = false;\n }\n });\n\n if (needToMerge) {\n this.merge(dataId, changedFields);\n\n if (allDeleted) {\n if (this instanceof Layer) {\n this.data[dataId] = void 0;\n } else {\n delete this.data[dataId];\n }\n this.group.dirty(dataId, \"__exists\");\n }\n\n return true;\n }\n }\n\n return false;\n }\n\n // If called with only one argument, removes the entire entity\n // identified by dataId. If called with a fieldName as well, removes all\n // fields of that entity whose names match fieldName according to the\n // fieldNameFromStoreName helper function. If called with a fieldName\n // and variables, removes all fields of that entity whose names match fieldName\n // and whose arguments when cached exactly match the variables passed.\n public delete(\n dataId: string,\n fieldName?: string,\n args?: Record\n ) {\n const storeObject = this.lookup(dataId);\n if (storeObject) {\n const typename = this.getFieldValue(storeObject, \"__typename\");\n const storeFieldName =\n fieldName && args ?\n this.policies.getStoreFieldName({ typename, fieldName, args })\n : fieldName;\n return this.modify(\n dataId,\n storeFieldName ?\n {\n [storeFieldName]: delModifier,\n }\n : delModifier\n );\n }\n return false;\n }\n\n public evict(options: Cache.EvictOptions, limit: EntityStore): boolean {\n let evicted = false;\n if (options.id) {\n if (hasOwn.call(this.data, options.id)) {\n evicted = this.delete(options.id, options.fieldName, options.args);\n }\n if (this instanceof Layer && this !== limit) {\n evicted = this.parent.evict(options, limit) || evicted;\n }\n // Always invalidate the field to trigger rereading of watched\n // queries, even if no cache data was modified by the eviction,\n // because queries may depend on computed fields with custom read\n // functions, whose values are not stored in the EntityStore.\n if (options.fieldName || evicted) {\n this.group.dirty(options.id, options.fieldName || \"__exists\");\n }\n }\n return evicted;\n }\n\n public clear(): void {\n this.replace(null);\n }\n\n public extract(): NormalizedCacheObject {\n const obj = this.toObject();\n const extraRootIds: string[] = [];\n this.getRootIdSet().forEach((id) => {\n if (!hasOwn.call(this.policies.rootTypenamesById, id)) {\n extraRootIds.push(id);\n }\n });\n if (extraRootIds.length) {\n obj.__META = { extraRootIds: extraRootIds.sort() };\n }\n return obj;\n }\n\n public replace(newData: NormalizedCacheObject | null): void {\n Object.keys(this.data).forEach((dataId) => {\n if (!(newData && hasOwn.call(newData, dataId))) {\n this.delete(dataId);\n }\n });\n if (newData) {\n const { __META, ...rest } = newData;\n Object.keys(rest).forEach((dataId) => {\n this.merge(dataId, rest[dataId] as StoreObject);\n });\n if (__META) {\n __META.extraRootIds.forEach(this.retain, this);\n }\n }\n }\n\n public abstract getStorage(\n idOrObj: string | StoreObject,\n ...storeFieldNames: (string | number)[]\n ): StorageType;\n\n // Maps root entity IDs to the number of times they have been retained, minus\n // the number of times they have been released. Retained entities keep other\n // entities they reference (even indirectly) from being garbage collected.\n private rootIds: {\n [rootId: string]: number;\n } = Object.create(null);\n\n public retain(rootId: string): number {\n return (this.rootIds[rootId] = (this.rootIds[rootId] || 0) + 1);\n }\n\n public release(rootId: string): number {\n if (this.rootIds[rootId] > 0) {\n const count = --this.rootIds[rootId];\n if (!count) delete this.rootIds[rootId];\n return count;\n }\n return 0;\n }\n\n // Return a Set of all the ID strings that have been retained by\n // this layer/root *and* any layers/roots beneath it.\n public getRootIdSet(ids = new Set()) {\n Object.keys(this.rootIds).forEach(ids.add, ids);\n if (this instanceof Layer) {\n this.parent.getRootIdSet(ids);\n } else {\n // Official singleton IDs like ROOT_QUERY and ROOT_MUTATION are\n // always considered roots for garbage collection, regardless of\n // their retainment counts in this.rootIds.\n Object.keys(this.policies.rootTypenamesById).forEach(ids.add, ids);\n }\n return ids;\n }\n\n // The goal of garbage collection is to remove IDs from the Root layer of the\n // store that are no longer reachable starting from any IDs that have been\n // explicitly retained (see retain and release, above). Returns an array of\n // dataId strings that were removed from the store.\n public gc() {\n const ids = this.getRootIdSet();\n const snapshot = this.toObject();\n ids.forEach((id) => {\n if (hasOwn.call(snapshot, id)) {\n // Because we are iterating over an ECMAScript Set, the IDs we add here\n // will be visited in later iterations of the forEach loop only if they\n // were not previously contained by the Set.\n Object.keys(this.findChildRefIds(id)).forEach(ids.add, ids);\n // By removing IDs from the snapshot object here, we protect them from\n // getting removed from the root store layer below.\n delete snapshot[id];\n }\n });\n const idsToRemove = Object.keys(snapshot);\n if (idsToRemove.length) {\n let root: EntityStore = this;\n while (root instanceof Layer) root = root.parent;\n idsToRemove.forEach((id) => root.delete(id));\n }\n return idsToRemove;\n }\n\n // Lazily tracks { __ref: } strings contained by this.data[dataId].\n private refs: {\n [dataId: string]: Record;\n } = Object.create(null);\n\n public findChildRefIds(dataId: string): Record {\n if (!hasOwn.call(this.refs, dataId)) {\n const found = (this.refs[dataId] = Object.create(null));\n const root = this.data[dataId];\n if (!root) return found;\n\n const workSet = new Set>([root]);\n // Within the store, only arrays and objects can contain child entity\n // references, so we can prune the traversal using this predicate:\n workSet.forEach((obj) => {\n if (isReference(obj)) {\n found[obj.__ref] = true;\n // In rare cases, a { __ref } Reference object may have other fields.\n // This often indicates a mismerging of References with StoreObjects,\n // but garbage collection should not be fooled by a stray __ref\n // property in a StoreObject (ignoring all the other fields just\n // because the StoreObject looks like a Reference). To avoid this\n // premature termination of findChildRefIds recursion, we fall through\n // to the code below, which will handle any other properties of obj.\n }\n if (isNonNullObject(obj)) {\n Object.keys(obj).forEach((key) => {\n const child = obj[key];\n // No need to add primitive values to the workSet, since they cannot\n // contain reference objects.\n if (isNonNullObject(child)) {\n workSet.add(child);\n }\n });\n }\n });\n }\n return this.refs[dataId];\n }\n\n // Used to compute cache keys specific to this.group.\n /** overload for `InMemoryCache.maybeBroadcastWatch` */\n public makeCacheKey(\n document: DocumentNode,\n callback: Cache.WatchCallback,\n details: string\n ): object;\n /** overload for `StoreReader.executeSelectionSet` */\n public makeCacheKey(\n selectionSet: SelectionSetNode,\n parent: string /* = ( Reference.__ref ) */ | StoreObject,\n varString: string | undefined,\n canonizeResults: boolean\n ): object;\n /** overload for `StoreReader.executeSubSelectedArray` */\n public makeCacheKey(\n field: FieldNode,\n array: readonly any[],\n varString: string | undefined\n ): object;\n /** @deprecated This is only meant for internal usage,\n * in your own code please use a `Trie` instance instead. */\n public makeCacheKey(...args: any[]): object;\n public makeCacheKey() {\n return this.group.keyMaker.lookupArray(arguments);\n }\n\n // Bound function that can be passed around to provide easy access to fields\n // of Reference objects as well as ordinary objects.\n public getFieldValue = (\n objectOrReference: StoreObject | Reference | undefined,\n storeFieldName: string\n ) =>\n maybeDeepFreeze(\n isReference(objectOrReference) ?\n this.get(objectOrReference.__ref, storeFieldName)\n : objectOrReference && objectOrReference[storeFieldName]\n ) as SafeReadonly;\n\n // Returns true for non-normalized StoreObjects and non-dangling\n // References, indicating that readField(name, objOrRef) has a chance of\n // working. Useful for filtering out dangling references from lists.\n public canRead: CanReadFunction = (objOrRef) => {\n return isReference(objOrRef) ?\n this.has(objOrRef.__ref)\n : typeof objOrRef === \"object\";\n };\n\n // Bound function that converts an id or an object with a __typename and\n // primary key fields to a Reference object. If called with a Reference object,\n // that same Reference object is returned. Pass true for mergeIntoStore to persist\n // an object into the store.\n public toReference: ToReferenceFunction = (objOrIdOrRef, mergeIntoStore) => {\n if (typeof objOrIdOrRef === \"string\") {\n return makeReference(objOrIdOrRef);\n }\n\n if (isReference(objOrIdOrRef)) {\n return objOrIdOrRef;\n }\n\n const [id] = this.policies.identify(objOrIdOrRef);\n\n if (id) {\n const ref = makeReference(id);\n if (mergeIntoStore) {\n this.merge(id, objOrIdOrRef);\n }\n return ref;\n }\n };\n}\n\nexport type FieldValueGetter = EntityStore[\"getFieldValue\"];\n\n// A single CacheGroup represents a set of one or more EntityStore objects,\n// typically the Root store in a CacheGroup by itself, and all active Layer\n// stores in a group together. A single EntityStore object belongs to only\n// one CacheGroup, store.group. The CacheGroup is responsible for tracking\n// dependencies, so store.group is helpful for generating unique keys for\n// cached results that need to be invalidated when/if those dependencies\n// change. If we used the EntityStore objects themselves as cache keys (that\n// is, store rather than store.group), the cache would become unnecessarily\n// fragmented by all the different Layer objects. Instead, the CacheGroup\n// approach allows all optimistic Layer objects in the same linked list to\n// belong to one CacheGroup, with the non-optimistic Root object belonging\n// to another CacheGroup, allowing resultCaching dependencies to be tracked\n// separately for optimistic and non-optimistic entity data.\nclass CacheGroup {\n private d: OptimisticDependencyFunction | null = null;\n\n // Used by the EntityStore#makeCacheKey method to compute cache keys\n // specific to this CacheGroup.\n public keyMaker!: Trie;\n\n constructor(\n public readonly caching: boolean,\n private parent: CacheGroup | null = null\n ) {\n this.resetCaching();\n }\n\n public resetCaching() {\n this.d = this.caching ? dep() : null;\n this.keyMaker = new Trie(canUseWeakMap);\n }\n\n public depend(dataId: string, storeFieldName: string) {\n if (this.d) {\n this.d(makeDepKey(dataId, storeFieldName));\n const fieldName = fieldNameFromStoreName(storeFieldName);\n if (fieldName !== storeFieldName) {\n // Fields with arguments that contribute extra identifying\n // information to the fieldName (thus forming the storeFieldName)\n // depend not only on the full storeFieldName but also on the\n // short fieldName, so the field can be invalidated using either\n // level of specificity.\n this.d(makeDepKey(dataId, fieldName));\n }\n if (this.parent) {\n this.parent.depend(dataId, storeFieldName);\n }\n }\n }\n\n public dirty(dataId: string, storeFieldName: string) {\n if (this.d) {\n this.d.dirty(\n makeDepKey(dataId, storeFieldName),\n // When storeFieldName === \"__exists\", that means the entity identified\n // by dataId has either disappeared from the cache or was newly added,\n // so the result caching system would do well to \"forget everything it\n // knows\" about that object. To achieve that kind of invalidation, we\n // not only dirty the associated result cache entry, but also remove it\n // completely from the dependency graph. For the optimism implementation\n // details, see https://github.com/benjamn/optimism/pull/195.\n storeFieldName === \"__exists\" ? \"forget\" : \"setDirty\"\n );\n }\n }\n}\n\nfunction makeDepKey(dataId: string, storeFieldName: string) {\n // Since field names cannot have '#' characters in them, this method\n // of joining the field name and the ID should be unambiguous, and much\n // cheaper than JSON.stringify([dataId, fieldName]).\n return storeFieldName + \"#\" + dataId;\n}\n\nexport function maybeDependOnExistenceOfEntity(\n store: NormalizedCache,\n entityId: string\n) {\n if (supportsResultCaching(store)) {\n // We use this pseudo-field __exists elsewhere in the EntityStore code to\n // represent changes in the existence of the entity object identified by\n // entityId. This dependency gets reliably dirtied whenever an object with\n // this ID is deleted (or newly created) within this group, so any result\n // cache entries (for example, StoreReader#executeSelectionSet results) that\n // depend on __exists for this entityId will get dirtied as well, leading to\n // the eventual recomputation (instead of reuse) of those result objects the\n // next time someone reads them from the cache.\n store.group.depend(entityId, \"__exists\");\n }\n}\n\nexport namespace EntityStore {\n // Refer to this class as EntityStore.Root outside this namespace.\n export class Root extends EntityStore {\n constructor({\n policies,\n resultCaching = true,\n seed,\n }: {\n policies: Policies;\n resultCaching?: boolean;\n seed?: NormalizedCacheObject;\n }) {\n super(policies, new CacheGroup(resultCaching));\n if (seed) this.replace(seed);\n }\n\n public readonly stump = new Stump(this);\n\n public addLayer(\n layerId: string,\n replay: (layer: EntityStore) => any\n ): Layer {\n // Adding an optimistic Layer on top of the Root actually adds the Layer\n // on top of the Stump, so the Stump always comes between the Root and\n // any Layer objects that we've added.\n return this.stump.addLayer(layerId, replay);\n }\n\n public removeLayer(): Root {\n // Never remove the root layer.\n return this;\n }\n\n public readonly storageTrie = new Trie(canUseWeakMap);\n public getStorage(): StorageType {\n return this.storageTrie.lookupArray(arguments);\n }\n }\n}\n\n// Not exported, since all Layer instances are created by the addLayer method\n// of the EntityStore.Root class.\nclass Layer extends EntityStore {\n constructor(\n public readonly id: string,\n public readonly parent: EntityStore,\n public readonly replay: (layer: EntityStore) => any,\n public readonly group: CacheGroup\n ) {\n super(parent.policies, group);\n replay(this);\n }\n\n public addLayer(layerId: string, replay: (layer: EntityStore) => any): Layer {\n return new Layer(layerId, this, replay, this.group);\n }\n\n public removeLayer(layerId: string): EntityStore {\n // Remove all instances of the given id, not just the first one.\n const parent = this.parent.removeLayer(layerId);\n\n if (layerId === this.id) {\n if (this.group.caching) {\n // Dirty every ID we're removing. Technically we might be able to avoid\n // dirtying fields that have values in higher layers, but we don't have\n // easy access to higher layers here, and we're about to recreate those\n // layers anyway (see parent.addLayer below).\n Object.keys(this.data).forEach((dataId) => {\n const ownStoreObject = this.data[dataId];\n const parentStoreObject = parent[\"lookup\"](dataId);\n if (!parentStoreObject) {\n // The StoreObject identified by dataId was defined in this layer\n // but will be undefined in the parent layer, so we can delete the\n // whole entity using this.delete(dataId). Since we're about to\n // throw this layer away, the only goal of this deletion is to dirty\n // the removed fields.\n this.delete(dataId);\n } else if (!ownStoreObject) {\n // This layer had an entry for dataId but it was undefined, which\n // means the entity was deleted in this layer, and it's about to\n // become undeleted when we remove this layer, so we need to dirty\n // all fields that are about to be reexposed.\n this.group.dirty(dataId, \"__exists\");\n Object.keys(parentStoreObject).forEach((storeFieldName) => {\n this.group.dirty(dataId, storeFieldName);\n });\n } else if (ownStoreObject !== parentStoreObject) {\n // If ownStoreObject is not exactly the same as parentStoreObject,\n // dirty any fields whose values will change as a result of this\n // removal.\n Object.keys(ownStoreObject).forEach((storeFieldName) => {\n if (\n !equal(\n ownStoreObject[storeFieldName],\n parentStoreObject[storeFieldName]\n )\n ) {\n this.group.dirty(dataId, storeFieldName);\n }\n });\n }\n });\n }\n\n return parent;\n }\n\n // No changes are necessary if the parent chain remains identical.\n if (parent === this.parent) return this;\n\n // Recreate this layer on top of the new parent.\n return parent.addLayer(this.id, this.replay);\n }\n\n public toObject(): NormalizedCacheObject {\n return {\n ...this.parent.toObject(),\n ...this.data,\n };\n }\n\n public findChildRefIds(dataId: string): Record {\n const fromParent = this.parent.findChildRefIds(dataId);\n return hasOwn.call(this.data, dataId) ?\n {\n ...fromParent,\n ...super.findChildRefIds(dataId),\n }\n : fromParent;\n }\n\n public getStorage(): StorageType {\n let p: EntityStore = this.parent;\n while ((p as Layer).parent) p = (p as Layer).parent;\n return p.getStorage.apply(\n p,\n // @ts-expect-error\n arguments\n );\n }\n}\n\n// Represents a Layer permanently installed just above the Root, which allows\n// reading optimistically (and registering optimistic dependencies) even when\n// no optimistic layers are currently active. The stump.group CacheGroup object\n// is shared by any/all Layer objects added on top of the Stump.\nclass Stump extends Layer {\n constructor(root: EntityStore.Root) {\n super(\n \"EntityStore.Stump\",\n root,\n () => {},\n new CacheGroup(root.group.caching, root.group)\n );\n }\n\n public removeLayer() {\n // Never remove the Stump layer.\n return this;\n }\n\n public merge(older: string | StoreObject, newer: string | StoreObject) {\n // We never want to write any data into the Stump, so we forward any merge\n // calls to the Root instead. Another option here would be to throw an\n // exception, but the toReference(object, true) function can sometimes\n // trigger Stump writes (which used to be Root writes, before the Stump\n // concept was introduced).\n return this.parent.merge(older, newer);\n }\n}\n\nfunction storeObjectReconciler(\n existingObject: StoreObject,\n incomingObject: StoreObject,\n property: string | number\n): StoreValue {\n const existingValue = existingObject[property];\n const incomingValue = incomingObject[property];\n // Wherever there is a key collision, prefer the incoming value, unless\n // it is deeply equal to the existing value. It's worth checking deep\n // equality here (even though blindly returning incoming would be\n // logically correct) because preserving the referential identity of\n // existing data can prevent needless rereading and rerendering.\n return equal(existingValue, incomingValue) ? existingValue : incomingValue;\n}\n\nexport function supportsResultCaching(store: any): store is EntityStore {\n // When result caching is disabled, store.depend will be null.\n return !!(store instanceof EntityStore && store.group.caching);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.d.ts new file mode 100644 index 0000000..9230f94 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.d.ts @@ -0,0 +1 @@ +//# sourceMappingURL=fixPolyfills.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js new file mode 100644 index 0000000..b3a61d9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js @@ -0,0 +1,10 @@ +"use strict"; +// Most JavaScript environments do not need the workarounds implemented in +// fixPolyfills.native.ts, so importing fixPolyfills.ts merely imports +// this empty module, adding nothing to bundle sizes or execution times. +// When bundling for React Native, we substitute fixPolyfills.native.js +// for fixPolyfills.js (see the "react-native" section of package.json), +// to work around problems with Map and Set polyfills in older versions of +// React Native (which should have been fixed in react-native@0.59.0): +// https://github.com/apollographql/apollo-client/pull/5962 +//# sourceMappingURL=fixPolyfills.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js.map new file mode 100644 index 0000000..f662c32 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixPolyfills.js","sourceRoot":"","sources":["../../../src/cache/inmemory/fixPolyfills.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,wEAAwE;AACxE,uEAAuE;AACvE,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,2DAA2D","sourcesContent":["// Most JavaScript environments do not need the workarounds implemented in\n// fixPolyfills.native.ts, so importing fixPolyfills.ts merely imports\n// this empty module, adding nothing to bundle sizes or execution times.\n// When bundling for React Native, we substitute fixPolyfills.native.js\n// for fixPolyfills.js (see the \"react-native\" section of package.json),\n// to work around problems with Map and Set polyfills in older versions of\n// React Native (which should have been fixed in react-native@0.59.0):\n// https://github.com/apollographql/apollo-client/pull/5962\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.d.ts new file mode 100644 index 0000000..7af7269 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=fixPolyfills.native.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js new file mode 100644 index 0000000..24465eb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js @@ -0,0 +1,61 @@ +// Make sure Map.prototype.set returns the Map instance, per spec. +// https://github.com/apollographql/apollo-client/issues/4024 +var testMap = new Map(); +if (testMap.set(1, 2) !== testMap) { + var set_1 = testMap.set; + Map.prototype.set = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + set_1.apply(this, args); + return this; + }; +} +// Make sure Set.prototype.add returns the Set instance, per spec. +var testSet = new Set(); +if (testSet.add(3) !== testSet) { + var add_1 = testSet.add; + Set.prototype.add = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + add_1.apply(this, args); + return this; + }; +} +var frozen = {}; +if (typeof Object.freeze === "function") { + Object.freeze(frozen); +} +try { + // If non-extensible objects can't be stored as keys in a Map, make sure we + // do not freeze/seal/etc. an object without first attempting to put it in a + // Map. For example, this gives the React Native Map polyfill a chance to tag + // objects before they become non-extensible: + // https://github.com/facebook/react-native/blob/98a6f19d7c/Libraries/vendor/core/Map.js#L44-L50 + // https://github.com/apollographql/react-apollo/issues/2442#issuecomment-426489517 + testMap.set(frozen, frozen).delete(frozen); +} +catch (_a) { + var wrap = function (method) { + return (method && + (function (obj) { + try { + // If .set succeeds, also call .delete to avoid leaking memory. + testMap.set(obj, obj).delete(obj); + } + finally { + // If .set or .delete fails, the exception will be silently swallowed + // by this return-from-finally statement: + return method.call(Object, obj); + } + })); + }; + Object.freeze = wrap(Object.freeze); + Object.seal = wrap(Object.seal); + Object.preventExtensions = wrap(Object.preventExtensions); +} +export {}; +//# sourceMappingURL=fixPolyfills.native.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js.map new file mode 100644 index 0000000..dfa2e0e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fixPolyfills.native.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixPolyfills.native.js","sourceRoot":"","sources":["../../../src/cache/inmemory/fixPolyfills.native.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,6DAA6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L,MAAM;YACL,CAAC,UAAC,GAAG;gBACJ,IAAI,CAAC;oBACH,+DAA+D;oBAC/D,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACpC,CAAC;wBAAS,CAAC;oBACT,qEAAqE;oBACrE,yCAAyC;oBACzC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,CAAO,CACT,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["// Make sure Map.prototype.set returns the Map instance, per spec.\n// https://github.com/apollographql/apollo-client/issues/4024\nconst testMap = new Map();\nif (testMap.set(1, 2) !== testMap) {\n const { set } = testMap;\n Map.prototype.set = function (...args) {\n set.apply(this, args);\n return this;\n };\n}\n\n// Make sure Set.prototype.add returns the Set instance, per spec.\nconst testSet = new Set();\nif (testSet.add(3) !== testSet) {\n const { add } = testSet;\n Set.prototype.add = function (...args) {\n add.apply(this, args);\n return this;\n };\n}\n\nconst frozen = {};\nif (typeof Object.freeze === \"function\") {\n Object.freeze(frozen);\n}\n\ntry {\n // If non-extensible objects can't be stored as keys in a Map, make sure we\n // do not freeze/seal/etc. an object without first attempting to put it in a\n // Map. For example, this gives the React Native Map polyfill a chance to tag\n // objects before they become non-extensible:\n // https://github.com/facebook/react-native/blob/98a6f19d7c/Libraries/vendor/core/Map.js#L44-L50\n // https://github.com/apollographql/react-apollo/issues/2442#issuecomment-426489517\n testMap.set(frozen, frozen).delete(frozen);\n} catch {\n const wrap = (obj: T) => T>(method: M): M => {\n return (\n method &&\n (((obj) => {\n try {\n // If .set succeeds, also call .delete to avoid leaking memory.\n testMap.set(obj, obj).delete(obj);\n } finally {\n // If .set or .delete fails, the exception will be silently swallowed\n // by this return-from-finally statement:\n return method.call(Object, obj);\n }\n }) as M)\n );\n };\n Object.freeze = wrap(Object.freeze);\n Object.seal = wrap(Object.seal);\n Object.preventExtensions = wrap(Object.preventExtensions);\n}\n\nexport {};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.d.ts new file mode 100644 index 0000000..08c1386 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.d.ts @@ -0,0 +1,9 @@ +import type { DocumentNode, FragmentDefinitionNode } from "graphql"; +export interface FragmentRegistryAPI { + register(...fragments: DocumentNode[]): this; + lookup(fragmentName: string): FragmentDefinitionNode | null; + transform(document: D): D; + resetCaches(): void; +} +export declare function createFragmentRegistry(...fragments: DocumentNode[]): FragmentRegistryAPI; +//# sourceMappingURL=fragmentRegistry.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js new file mode 100644 index 0000000..8ef8712 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js @@ -0,0 +1,140 @@ +import { __assign, __spreadArray } from "tslib"; +import { visit } from "graphql"; +import { wrap } from "optimism"; +import { cacheSizes, getFragmentDefinitions, } from "../../utilities/index.js"; +import { WeakCache } from "@wry/caches"; +// As long as createFragmentRegistry is not imported or used, the +// FragmentRegistry example implementation provided below should not be bundled +// (by tree-shaking bundlers like Rollup), because the implementation of +// InMemoryCache refers only to the TypeScript interface FragmentRegistryAPI, +// never the concrete implementation FragmentRegistry (which is deliberately not +// exported from this module). +export function createFragmentRegistry() { + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + return new (FragmentRegistry.bind.apply(FragmentRegistry, __spreadArray([void 0], fragments, false)))(); +} +var FragmentRegistry = /** @class */ (function () { + // Call `createFragmentRegistry` instead of invoking the + // FragmentRegistry constructor directly. This reserves the constructor for + // future configuration of the FragmentRegistry. + function FragmentRegistry() { + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + this.registry = Object.create(null); + this.resetCaches(); + if (fragments.length) { + this.register.apply(this, fragments); + } + } + FragmentRegistry.prototype.register = function () { + var _this = this; + var fragments = []; + for (var _i = 0; _i < arguments.length; _i++) { + fragments[_i] = arguments[_i]; + } + var definitions = new Map(); + fragments.forEach(function (doc) { + getFragmentDefinitions(doc).forEach(function (node) { + definitions.set(node.name.value, node); + }); + }); + definitions.forEach(function (node, name) { + if (node !== _this.registry[name]) { + _this.registry[name] = node; + _this.invalidate(name); + } + }); + return this; + }; + // Overridden in the resetCaches method below. + FragmentRegistry.prototype.invalidate = function (name) { }; + FragmentRegistry.prototype.resetCaches = function () { + var proto = FragmentRegistry.prototype; + this.invalidate = (this.lookup = wrap(proto.lookup.bind(this), { + makeCacheKey: function (arg) { return arg; }, + max: cacheSizes["fragmentRegistry.lookup"] || + 1000 /* defaultCacheSizes["fragmentRegistry.lookup"] */, + })).dirty; // This dirty function is bound to the wrapped lookup method. + this.transform = wrap(proto.transform.bind(this), { + cache: WeakCache, + max: cacheSizes["fragmentRegistry.transform"] || + 2000 /* defaultCacheSizes["fragmentRegistry.transform"] */, + }); + this.findFragmentSpreads = wrap(proto.findFragmentSpreads.bind(this), { + cache: WeakCache, + max: cacheSizes["fragmentRegistry.findFragmentSpreads"] || + 4000 /* defaultCacheSizes["fragmentRegistry.findFragmentSpreads"] */, + }); + }; + /* + * Note: + * This method is only memoized so it can serve as a dependency to `tranform`, + * so calling `invalidate` will invalidate cache entries for `transform`. + */ + FragmentRegistry.prototype.lookup = function (fragmentName) { + return this.registry[fragmentName] || null; + }; + FragmentRegistry.prototype.transform = function (document) { + var _this = this; + var defined = new Map(); + getFragmentDefinitions(document).forEach(function (def) { + defined.set(def.name.value, def); + }); + var unbound = new Set(); + var enqueue = function (spreadName) { + if (!defined.has(spreadName)) { + unbound.add(spreadName); + } + }; + var enqueueChildSpreads = function (node) { + return Object.keys(_this.findFragmentSpreads(node)).forEach(enqueue); + }; + enqueueChildSpreads(document); + var missing = []; + var map = Object.create(null); + // This Set forEach loop can be extended during iteration by adding + // additional strings to the unbound set. + unbound.forEach(function (fragmentName) { + var knownFragmentDef = defined.get(fragmentName); + if (knownFragmentDef) { + enqueueChildSpreads((map[fragmentName] = knownFragmentDef)); + } + else { + missing.push(fragmentName); + var def = _this.lookup(fragmentName); + if (def) { + enqueueChildSpreads((map[fragmentName] = def)); + } + } + }); + if (missing.length) { + var defsToAppend_1 = []; + missing.forEach(function (name) { + var def = map[name]; + if (def) { + defsToAppend_1.push(def); + } + }); + if (defsToAppend_1.length) { + document = __assign(__assign({}, document), { definitions: document.definitions.concat(defsToAppend_1) }); + } + } + return document; + }; + FragmentRegistry.prototype.findFragmentSpreads = function (root) { + var spreads = Object.create(null); + visit(root, { + FragmentSpread: function (node) { + spreads[node.name.value] = node; + }, + }); + return spreads; + }; + return FragmentRegistry; +}()); +//# sourceMappingURL=fragmentRegistry.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js.map new file mode 100644 index 0000000..95a673f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/fragmentRegistry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fragmentRegistry.js","sourceRoot":"","sources":["../../../src/cache/inmemory/fragmentRegistry.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,IAAI,EA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Y,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,IAAM,cAAY,GAA6B,EAAE,CAAC;YAClD,OAAO,CAAC,OAAO,CAAC,UAAC,IAAI;gBACnB,IAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;gBACtB,IAAI,GAAG,EAAE,CAAC;oBACR,cAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,cAAY,CAAC,MAAM,EAAE,CAAC;gBACxB,QAAQ,yBACH,QAAQ,KACX,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,cAAY,CAAC,GACvD,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,8CAAmB,GAA1B,UAA2B,IAAa;QACtC,IAAM,OAAO,GAAsB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEvD,KAAK,CAAC,IAAI,EAAE;YACV,cAAc,YAAC,IAAI;gBACjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YAClC,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;IACH,uBAAC;AAAD,CAAC,AApID,IAoIC","sourcesContent":["import type {\n DocumentNode,\n ASTNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n} from \"graphql\";\nimport { visit } from \"graphql\";\n\nimport { wrap } from \"optimism\";\n\nimport type { FragmentMap } from \"../../utilities/index.js\";\nimport {\n cacheSizes,\n defaultCacheSizes,\n getFragmentDefinitions,\n} from \"../../utilities/index.js\";\nimport { WeakCache } from \"@wry/caches\";\n\nexport interface FragmentRegistryAPI {\n register(...fragments: DocumentNode[]): this;\n lookup(fragmentName: string): FragmentDefinitionNode | null;\n transform(document: D): D;\n resetCaches(): void;\n}\n\n// As long as createFragmentRegistry is not imported or used, the\n// FragmentRegistry example implementation provided below should not be bundled\n// (by tree-shaking bundlers like Rollup), because the implementation of\n// InMemoryCache refers only to the TypeScript interface FragmentRegistryAPI,\n// never the concrete implementation FragmentRegistry (which is deliberately not\n// exported from this module).\nexport function createFragmentRegistry(\n ...fragments: DocumentNode[]\n): FragmentRegistryAPI {\n return new FragmentRegistry(...fragments);\n}\n\nclass FragmentRegistry implements FragmentRegistryAPI {\n private registry: FragmentMap = Object.create(null);\n\n // Call `createFragmentRegistry` instead of invoking the\n // FragmentRegistry constructor directly. This reserves the constructor for\n // future configuration of the FragmentRegistry.\n constructor(...fragments: DocumentNode[]) {\n this.resetCaches();\n if (fragments.length) {\n this.register(...fragments);\n }\n }\n\n public register(...fragments: DocumentNode[]): this {\n const definitions = new Map();\n fragments.forEach((doc: DocumentNode) => {\n getFragmentDefinitions(doc).forEach((node) => {\n definitions.set(node.name.value, node);\n });\n });\n\n definitions.forEach((node, name) => {\n if (node !== this.registry[name]) {\n this.registry[name] = node;\n this.invalidate(name);\n }\n });\n\n return this;\n }\n\n // Overridden in the resetCaches method below.\n private invalidate(name: string) {}\n\n public resetCaches() {\n const proto = FragmentRegistry.prototype;\n this.invalidate = (this.lookup = wrap(proto.lookup.bind(this), {\n makeCacheKey: (arg) => arg,\n max:\n cacheSizes[\"fragmentRegistry.lookup\"] ||\n defaultCacheSizes[\"fragmentRegistry.lookup\"],\n })).dirty; // This dirty function is bound to the wrapped lookup method.\n this.transform = wrap(proto.transform.bind(this), {\n cache: WeakCache,\n max:\n cacheSizes[\"fragmentRegistry.transform\"] ||\n defaultCacheSizes[\"fragmentRegistry.transform\"],\n });\n this.findFragmentSpreads = wrap(proto.findFragmentSpreads.bind(this), {\n cache: WeakCache,\n max:\n cacheSizes[\"fragmentRegistry.findFragmentSpreads\"] ||\n defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"],\n });\n }\n\n /*\n * Note:\n * This method is only memoized so it can serve as a dependency to `tranform`,\n * so calling `invalidate` will invalidate cache entries for `transform`.\n */\n public lookup(fragmentName: string): FragmentDefinitionNode | null {\n return this.registry[fragmentName] || null;\n }\n\n public transform(document: D): D {\n const defined = new Map();\n getFragmentDefinitions(document).forEach((def) => {\n defined.set(def.name.value, def);\n });\n\n const unbound = new Set();\n const enqueue = (spreadName: string) => {\n if (!defined.has(spreadName)) {\n unbound.add(spreadName);\n }\n };\n\n const enqueueChildSpreads = (node: ASTNode) =>\n Object.keys(this.findFragmentSpreads(node)).forEach(enqueue);\n\n enqueueChildSpreads(document);\n\n const missing: string[] = [];\n const map: FragmentMap = Object.create(null);\n\n // This Set forEach loop can be extended during iteration by adding\n // additional strings to the unbound set.\n unbound.forEach((fragmentName) => {\n const knownFragmentDef = defined.get(fragmentName);\n if (knownFragmentDef) {\n enqueueChildSpreads((map[fragmentName] = knownFragmentDef));\n } else {\n missing.push(fragmentName);\n const def = this.lookup(fragmentName);\n if (def) {\n enqueueChildSpreads((map[fragmentName] = def));\n }\n }\n });\n\n if (missing.length) {\n const defsToAppend: FragmentDefinitionNode[] = [];\n missing.forEach((name) => {\n const def = map[name];\n if (def) {\n defsToAppend.push(def);\n }\n });\n\n if (defsToAppend.length) {\n document = {\n ...document,\n definitions: document.definitions.concat(defsToAppend),\n };\n }\n }\n\n return document;\n }\n\n public findFragmentSpreads(root: ASTNode): FragmentSpreadMap {\n const spreads: FragmentSpreadMap = Object.create(null);\n\n visit(root, {\n FragmentSpread(node) {\n spreads[node.name.value] = node;\n },\n });\n\n return spreads;\n }\n}\n\ninterface FragmentSpreadMap {\n [fragmentSpreadName: string]: FragmentSpreadNode;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.d.ts new file mode 100644 index 0000000..98a98c4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.d.ts @@ -0,0 +1,28 @@ +import type { DocumentNode, SelectionSetNode } from "graphql"; +import type { NormalizedCache, InMemoryCacheConfig } from "./types.js"; +import type { KeyFieldsContext } from "./policies.js"; +import type { FragmentRegistryAPI } from "./fragmentRegistry.js"; +import type { Reference, StoreValue, StoreObject, FragmentMap, FragmentMapFunction } from "../../utilities/index.js"; +import { DeepMerger, isArray } from "../../utilities/index.js"; +export declare const hasOwn: (v: PropertyKey) => boolean; +export declare function isNullish(value: any): value is null | undefined; +export { isArray }; +export declare function defaultDataIdFromObject({ __typename, id, _id }: Readonly, context?: KeyFieldsContext): string | undefined; +export declare function normalizeConfig(config: InMemoryCacheConfig): { + dataIdFromObject: typeof defaultDataIdFromObject; + addTypename: boolean; + resultCaching: boolean; + canonizeResults: boolean; +} & InMemoryCacheConfig; +export declare function shouldCanonizeResults(config: Pick): boolean; +export declare function getTypenameFromStoreObject(store: NormalizedCache, objectOrReference: StoreObject | Reference): string | undefined; +export declare const TypeOrFieldNameRegExp: RegExp; +export declare function fieldNameFromStoreName(storeFieldName: string): string; +export declare function selectionSetMatchesResult(selectionSet: SelectionSetNode, result: Record, variables?: Record): boolean; +export declare function storeValueIsStoreObject(value: StoreValue): value is StoreObject; +export declare function makeProcessedFieldsMerger(): DeepMerger; +export declare function extractFragmentContext(document: DocumentNode, fragments?: FragmentRegistryAPI): { + fragmentMap: FragmentMap; + lookupFragment: FragmentMapFunction; +}; +//# sourceMappingURL=helpers.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js new file mode 100644 index 0000000..1f0b2f4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js @@ -0,0 +1,96 @@ +import { isReference, isField, DeepMerger, resultKeyNameFromField, shouldInclude, isNonNullObject, compact, createFragmentMap, getFragmentDefinitions, isArray, } from "../../utilities/index.js"; +export var hasOwn = Object.prototype.hasOwnProperty; +export function isNullish(value) { + return value === null || value === void 0; +} +export { isArray }; +export function defaultDataIdFromObject(_a, context) { + var __typename = _a.__typename, id = _a.id, _id = _a._id; + if (typeof __typename === "string") { + if (context) { + context.keyObject = + !isNullish(id) ? { id: id } + : !isNullish(_id) ? { _id: _id } + : void 0; + } + // If there is no object.id, fall back to object._id. + if (isNullish(id) && !isNullish(_id)) { + id = _id; + } + if (!isNullish(id)) { + return "".concat(__typename, ":").concat(typeof id === "number" || typeof id === "string" ? + id + : JSON.stringify(id)); + } + } +} +var defaultConfig = { + dataIdFromObject: defaultDataIdFromObject, + addTypename: true, + resultCaching: true, + // Thanks to the shouldCanonizeResults helper, this should be the only line + // you have to change to reenable canonization by default in the future. + canonizeResults: false, +}; +export function normalizeConfig(config) { + return compact(defaultConfig, config); +} +export function shouldCanonizeResults(config) { + var value = config.canonizeResults; + return value === void 0 ? defaultConfig.canonizeResults : value; +} +export function getTypenameFromStoreObject(store, objectOrReference) { + return isReference(objectOrReference) ? + store.get(objectOrReference.__ref, "__typename") + : objectOrReference && objectOrReference.__typename; +} +export var TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i; +export function fieldNameFromStoreName(storeFieldName) { + var match = storeFieldName.match(TypeOrFieldNameRegExp); + return match ? match[0] : storeFieldName; +} +export function selectionSetMatchesResult(selectionSet, result, variables) { + if (isNonNullObject(result)) { + return isArray(result) ? + result.every(function (item) { + return selectionSetMatchesResult(selectionSet, item, variables); + }) + : selectionSet.selections.every(function (field) { + if (isField(field) && shouldInclude(field, variables)) { + var key = resultKeyNameFromField(field); + return (hasOwn.call(result, key) && + (!field.selectionSet || + selectionSetMatchesResult(field.selectionSet, result[key], variables))); + } + // If the selection has been skipped with @skip(true) or + // @include(false), it should not count against the matching. If + // the selection is not a field, it must be a fragment (inline or + // named). We will determine if selectionSetMatchesResult for that + // fragment when we get to it, so for now we return true. + return true; + }); + } + return false; +} +export function storeValueIsStoreObject(value) { + return isNonNullObject(value) && !isReference(value) && !isArray(value); +} +export function makeProcessedFieldsMerger() { + return new DeepMerger(); +} +export function extractFragmentContext(document, fragments) { + // FragmentMap consisting only of fragments defined directly in document, not + // including other fragments registered in the FragmentRegistry. + var fragmentMap = createFragmentMap(getFragmentDefinitions(document)); + return { + fragmentMap: fragmentMap, + lookupFragment: function (name) { + var def = fragmentMap[name]; + if (!def && fragments) { + def = fragments.lookup(name); + } + return def || null; + }, + }; +} +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js.map new file mode 100644 index 0000000..3cfe0db --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/helpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/cache/inmemory/helpers.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,WAAW,EACX,OAAO,EACP,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,OAAO,EACP,iBAAiB,EACjB,sBAAsB,EACtB,OAAO,GACR,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAS,IAAgB,MAAM,GAAK,MAAM,CAAC,SAAS,eAArB,CAAsB;AAE3D,MAAM,UAAU,SAAS,CAAC,KAAU;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,UAAU,uBAAuB,CACrC,EAA8C,EAC9C,OAA0B;QADxB,UAAU,gBAAA,EAAE,EAAE,QAAA,EAAE,GAAG,SAAA;IAGrB,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,SAAS;gBACf,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EA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BAAuB,CACrC,KAAiB;IAEjB,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,UAAU,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAsB,EACtB,SAA+B;IAK/B,6EAA6E;IAC7E,gEAAgE;IAChE,IAAM,WAAW,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxE,OAAO;QACL,WAAW,aAAA;QACX,cAAc,YAAC,IAAI;YACjB,IAAI,GAAG,GAAkC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC3D,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;gBACtB,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,GAAG,IAAI,IAAI,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n DocumentNode,\n FragmentDefinitionNode,\n SelectionSetNode,\n} from \"graphql\";\n\nimport type { NormalizedCache, InMemoryCacheConfig } from \"./types.js\";\n\nimport type { KeyFieldsContext } from \"./policies.js\";\nimport type { FragmentRegistryAPI } from \"./fragmentRegistry.js\";\n\nimport type {\n Reference,\n StoreValue,\n StoreObject,\n FragmentMap,\n FragmentMapFunction,\n} from \"../../utilities/index.js\";\nimport {\n isReference,\n isField,\n DeepMerger,\n resultKeyNameFromField,\n shouldInclude,\n isNonNullObject,\n compact,\n createFragmentMap,\n getFragmentDefinitions,\n isArray,\n} from \"../../utilities/index.js\";\n\nexport const { hasOwnProperty: hasOwn } = Object.prototype;\n\nexport function isNullish(value: any): value is null | undefined {\n return value === null || value === void 0;\n}\n\nexport { isArray };\n\nexport function defaultDataIdFromObject(\n { __typename, id, _id }: Readonly,\n context?: KeyFieldsContext\n): string | undefined {\n if (typeof __typename === \"string\") {\n if (context) {\n context.keyObject =\n !isNullish(id) ? { id }\n : !isNullish(_id) ? { _id }\n : void 0;\n }\n\n // If there is no object.id, fall back to object._id.\n if (isNullish(id) && !isNullish(_id)) {\n id = _id;\n }\n\n if (!isNullish(id)) {\n return `${__typename}:${\n typeof id === \"number\" || typeof id === \"string\" ?\n id\n : JSON.stringify(id)\n }`;\n }\n }\n}\n\nconst defaultConfig = {\n dataIdFromObject: defaultDataIdFromObject,\n addTypename: true,\n resultCaching: true,\n // Thanks to the shouldCanonizeResults helper, this should be the only line\n // you have to change to reenable canonization by default in the future.\n canonizeResults: false,\n};\n\nexport function normalizeConfig(config: InMemoryCacheConfig) {\n return compact(defaultConfig, config);\n}\n\nexport function shouldCanonizeResults(\n config: Pick\n): boolean {\n const value = config.canonizeResults;\n return value === void 0 ? defaultConfig.canonizeResults : value;\n}\n\nexport function getTypenameFromStoreObject(\n store: NormalizedCache,\n objectOrReference: StoreObject | Reference\n): string | undefined {\n return isReference(objectOrReference) ?\n (store.get(objectOrReference.__ref, \"__typename\") as string)\n : objectOrReference && objectOrReference.__typename;\n}\n\nexport const TypeOrFieldNameRegExp = /^[_a-z][_0-9a-z]*/i;\n\nexport function fieldNameFromStoreName(storeFieldName: string): string {\n const match = storeFieldName.match(TypeOrFieldNameRegExp);\n return match ? match[0] : storeFieldName;\n}\n\nexport function selectionSetMatchesResult(\n selectionSet: SelectionSetNode,\n result: Record,\n variables?: Record\n): boolean {\n if (isNonNullObject(result)) {\n return isArray(result) ?\n result.every((item) =>\n selectionSetMatchesResult(selectionSet, item, variables)\n )\n : selectionSet.selections.every((field) => {\n if (isField(field) && shouldInclude(field, variables)) {\n const key = resultKeyNameFromField(field);\n return (\n hasOwn.call(result, key) &&\n (!field.selectionSet ||\n selectionSetMatchesResult(\n field.selectionSet,\n result[key],\n variables\n ))\n );\n }\n // If the selection has been skipped with @skip(true) or\n // @include(false), it should not count against the matching. If\n // the selection is not a field, it must be a fragment (inline or\n // named). We will determine if selectionSetMatchesResult for that\n // fragment when we get to it, so for now we return true.\n return true;\n });\n }\n return false;\n}\n\nexport function storeValueIsStoreObject(\n value: StoreValue\n): value is StoreObject {\n return isNonNullObject(value) && !isReference(value) && !isArray(value);\n}\n\nexport function makeProcessedFieldsMerger() {\n return new DeepMerger();\n}\n\nexport function extractFragmentContext(\n document: DocumentNode,\n fragments?: FragmentRegistryAPI\n): {\n fragmentMap: FragmentMap;\n lookupFragment: FragmentMapFunction;\n} {\n // FragmentMap consisting only of fragments defined directly in document, not\n // including other fragments registered in the FragmentRegistry.\n const fragmentMap = createFragmentMap(getFragmentDefinitions(document));\n return {\n fragmentMap,\n lookupFragment(name) {\n let def: FragmentDefinitionNode | null = fragmentMap[name];\n if (!def && fragments) {\n def = fragments.lookup(name);\n }\n return def || null;\n },\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.d.ts new file mode 100644 index 0000000..1d47417 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.d.ts @@ -0,0 +1,63 @@ +import "./fixPolyfills.js"; +import type { DocumentNode } from "graphql"; +import { ApolloCache } from "../core/cache.js"; +import type { Cache } from "../core/types/Cache.js"; +import type { StoreObject, Reference } from "../../utilities/index.js"; +import type { InMemoryCacheConfig, NormalizedCacheObject } from "./types.js"; +import { makeVar } from "./reactiveVars.js"; +import { Policies } from "./policies.js"; +import type { OperationVariables } from "../../core/index.js"; +import { getInMemoryCacheMemoryInternals } from "../../utilities/caching/getMemoryInternals.js"; +type BroadcastOptions = Pick, "optimistic" | "onWatchUpdated">; +export declare class InMemoryCache extends ApolloCache { + private data; + private optimisticData; + protected config: InMemoryCacheConfig; + private watches; + private addTypename; + private storeReader; + private storeWriter; + private addTypenameTransform; + private maybeBroadcastWatch; + readonly assumeImmutableResults = true; + readonly policies: Policies; + readonly makeVar: typeof makeVar; + constructor(config?: InMemoryCacheConfig); + private init; + private resetResultCache; + restore(data: NormalizedCacheObject): this; + extract(optimistic?: boolean): NormalizedCacheObject; + read(options: Cache.ReadOptions): T | null; + write(options: Cache.WriteOptions): Reference | undefined; + modify = Record>(options: Cache.ModifyOptions): boolean; + diff(options: Cache.DiffOptions): Cache.DiffResult; + watch(watch: Cache.WatchOptions): () => void; + gc(options?: { + resetResultCache?: boolean; + resetResultIdentities?: boolean; + }): string[]; + retain(rootId: string, optimistic?: boolean): number; + release(rootId: string, optimistic?: boolean): number; + identify(object: StoreObject | Reference): string | undefined; + evict(options: Cache.EvictOptions): boolean; + reset(options?: Cache.ResetOptions): Promise; + removeOptimistic(idToRemove: string): void; + private txCount; + batch(options: Cache.BatchOptions): TUpdateResult; + performTransaction(update: (cache: InMemoryCache) => any, optimisticId?: string | null): any; + transformDocument(document: DocumentNode): DocumentNode; + protected broadcastWatches(options?: BroadcastOptions): void; + private addFragmentsToDocument; + private addTypenameToDocument; + private broadcastWatch; + /** + * @experimental + * @internal + * This is not a stable API - it is used in development builds to expose + * information to the DevTools. + * Use at your own risk! + */ + getMemoryInternals?: typeof getInMemoryCacheMemoryInternals; +} +export {}; +//# sourceMappingURL=inMemoryCache.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js new file mode 100644 index 0000000..4dfcba1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js @@ -0,0 +1,472 @@ +import { __assign, __extends } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +// Make builtins like Map and Set safe to use with non-extensible objects. +import "./fixPolyfills.js"; +import { wrap } from "optimism"; +import { equal } from "@wry/equality"; +import { ApolloCache } from "../core/cache.js"; +import { MissingFieldError } from "../core/types/common.js"; +import { addTypenameToDocument, isReference, DocumentTransform, canonicalStringify, print, cacheSizes, } from "../../utilities/index.js"; +import { StoreReader } from "./readFromStore.js"; +import { StoreWriter } from "./writeToStore.js"; +import { EntityStore, supportsResultCaching } from "./entityStore.js"; +import { makeVar, forgetCache, recallCache } from "./reactiveVars.js"; +import { Policies } from "./policies.js"; +import { hasOwn, normalizeConfig, shouldCanonizeResults } from "./helpers.js"; +import { getInMemoryCacheMemoryInternals } from "../../utilities/caching/getMemoryInternals.js"; +var InMemoryCache = /** @class */ (function (_super) { + __extends(InMemoryCache, _super); + function InMemoryCache(config) { + if (config === void 0) { config = {}; } + var _this = _super.call(this) || this; + _this.watches = new Set(); + _this.addTypenameTransform = new DocumentTransform(addTypenameToDocument); + // Override the default value, since InMemoryCache result objects are frozen + // in development and expected to remain logically immutable in production. + _this.assumeImmutableResults = true; + _this.makeVar = makeVar; + _this.txCount = 0; + _this.config = normalizeConfig(config); + _this.addTypename = !!_this.config.addTypename; + _this.policies = new Policies({ + cache: _this, + dataIdFromObject: _this.config.dataIdFromObject, + possibleTypes: _this.config.possibleTypes, + typePolicies: _this.config.typePolicies, + }); + _this.init(); + return _this; + } + InMemoryCache.prototype.init = function () { + // Passing { resultCaching: false } in the InMemoryCache constructor options + // will completely disable dependency tracking, which will improve memory + // usage but worsen the performance of repeated reads. + var rootStore = (this.data = new EntityStore.Root({ + policies: this.policies, + resultCaching: this.config.resultCaching, + })); + // When no optimistic writes are currently active, cache.optimisticData === + // cache.data, so there are no additional layers on top of the actual data. + // When an optimistic update happens, this.optimisticData will become a + // linked list of EntityStore Layer objects that terminates with the + // original this.data cache object. + this.optimisticData = rootStore.stump; + this.resetResultCache(); + }; + InMemoryCache.prototype.resetResultCache = function (resetResultIdentities) { + var _this = this; + var previousReader = this.storeReader; + var fragments = this.config.fragments; + // The StoreWriter is mostly stateless and so doesn't really need to be + // reset, but it does need to have its writer.storeReader reference updated, + // so it's simpler to update this.storeWriter as well. + this.storeWriter = new StoreWriter(this, (this.storeReader = new StoreReader({ + cache: this, + addTypename: this.addTypename, + resultCacheMaxSize: this.config.resultCacheMaxSize, + canonizeResults: shouldCanonizeResults(this.config), + canon: resetResultIdentities ? void 0 : (previousReader && previousReader.canon), + fragments: fragments, + })), fragments); + this.maybeBroadcastWatch = wrap(function (c, options) { + return _this.broadcastWatch(c, options); + }, { + max: this.config.resultCacheMaxSize || + cacheSizes["inMemoryCache.maybeBroadcastWatch"] || + 5000 /* defaultCacheSizes["inMemoryCache.maybeBroadcastWatch"] */, + makeCacheKey: function (c) { + // Return a cache key (thus enabling result caching) only if we're + // currently using a data store that can track cache dependencies. + var store = c.optimistic ? _this.optimisticData : _this.data; + if (supportsResultCaching(store)) { + var optimistic = c.optimistic, id = c.id, variables = c.variables; + return store.makeCacheKey(c.query, + // Different watches can have the same query, optimistic + // status, rootId, and variables, but if their callbacks are + // different, the (identical) result needs to be delivered to + // each distinct callback. The easiest way to achieve that + // separation is to include c.callback in the cache key for + // maybeBroadcastWatch calls. See issue #5733. + c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables })); + } + }, + }); + // Since we have thrown away all the cached functions that depend on the + // CacheGroup dependencies maintained by EntityStore, we should also reset + // all CacheGroup dependency information. + new Set([this.data.group, this.optimisticData.group]).forEach(function (group) { + return group.resetCaching(); + }); + }; + InMemoryCache.prototype.restore = function (data) { + this.init(); + // Since calling this.init() discards/replaces the entire StoreReader, along + // with the result caches it maintains, this.data.replace(data) won't have + // to bother deleting the old data. + if (data) + this.data.replace(data); + return this; + }; + InMemoryCache.prototype.extract = function (optimistic) { + if (optimistic === void 0) { optimistic = false; } + return (optimistic ? this.optimisticData : this.data).extract(); + }; + InMemoryCache.prototype.read = function (options) { + var + // Since read returns data or null, without any additional metadata + // about whether/where there might have been missing fields, the + // default behavior cannot be returnPartialData = true (like it is + // for the diff method), since defaulting to true would violate the + // integrity of the T in the return type. However, partial data may + // be useful in some cases, so returnPartialData:true may be + // specified explicitly. + _a = options.returnPartialData, + // Since read returns data or null, without any additional metadata + // about whether/where there might have been missing fields, the + // default behavior cannot be returnPartialData = true (like it is + // for the diff method), since defaulting to true would violate the + // integrity of the T in the return type. However, partial data may + // be useful in some cases, so returnPartialData:true may be + // specified explicitly. + returnPartialData = _a === void 0 ? false : _a; + try { + return (this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, config: this.config, returnPartialData: returnPartialData })).result || null); + } + catch (e) { + if (e instanceof MissingFieldError) { + // Swallow MissingFieldError and return null, so callers do not need to + // worry about catching "normal" exceptions resulting from incomplete + // cache data. Unexpected errors will be re-thrown. If you need more + // information about which fields were missing, use cache.diff instead, + // and examine diffResult.missing. + return null; + } + throw e; + } + }; + InMemoryCache.prototype.write = function (options) { + try { + ++this.txCount; + return this.storeWriter.writeToStore(this.data, options); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.modify = function (options) { + if (hasOwn.call(options, "id") && !options.id) { + // To my knowledge, TypeScript does not currently provide a way to + // enforce that an optional property?:type must *not* be undefined + // when present. That ability would be useful here, because we want + // options.id to default to ROOT_QUERY only when no options.id was + // provided. If the caller attempts to pass options.id with a + // falsy/undefined value (perhaps because cache.identify failed), we + // should not assume the goal was to modify the ROOT_QUERY object. + // We could throw, but it seems natural to return false to indicate + // that nothing was modified. + return false; + } + var store = ((options.optimistic) // Defaults to false. + ) ? + this.optimisticData + : this.data; + try { + ++this.txCount; + return store.modify(options.id || "ROOT_QUERY", options.fields); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.diff = function (options) { + return this.storeReader.diffQueryAgainstStore(__assign(__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config })); + }; + InMemoryCache.prototype.watch = function (watch) { + var _this = this; + if (!this.watches.size) { + // In case we previously called forgetCache(this) because + // this.watches became empty (see below), reattach this cache to any + // reactive variables on which it previously depended. It might seem + // paradoxical that we're able to recall something we supposedly + // forgot, but the point of calling forgetCache(this) is to silence + // useless broadcasts while this.watches is empty, and to allow the + // cache to be garbage collected. If, however, we manage to call + // recallCache(this) here, this cache object must not have been + // garbage collected yet, and should resume receiving updates from + // reactive variables, now that it has a watcher to notify. + recallCache(this); + } + this.watches.add(watch); + if (watch.immediate) { + this.maybeBroadcastWatch(watch); + } + return function () { + // Once we remove the last watch from this.watches, cache.broadcastWatches + // no longer does anything, so we preemptively tell the reactive variable + // system to exclude this cache from future broadcasts. + if (_this.watches.delete(watch) && !_this.watches.size) { + forgetCache(_this); + } + // Remove this watch from the LRU cache managed by the + // maybeBroadcastWatch OptimisticWrapperFunction, to prevent memory + // leaks involving the closure of watch.callback. + _this.maybeBroadcastWatch.forget(watch); + }; + }; + InMemoryCache.prototype.gc = function (options) { + var _a; + canonicalStringify.reset(); + print.reset(); + this.addTypenameTransform.resetCache(); + (_a = this.config.fragments) === null || _a === void 0 ? void 0 : _a.resetCaches(); + var ids = this.optimisticData.gc(); + if (options && !this.txCount) { + if (options.resetResultCache) { + this.resetResultCache(options.resetResultIdentities); + } + else if (options.resetResultIdentities) { + this.storeReader.resetCanon(); + } + } + return ids; + }; + // Call this method to ensure the given root ID remains in the cache after + // garbage collection, along with its transitive child entities. Note that + // the cache automatically retains all directly written entities. By default, + // the retainment persists after optimistic updates are removed. Pass true + // for the optimistic argument if you would prefer for the retainment to be + // discarded when the top-most optimistic layer is removed. Returns the + // resulting (non-negative) retainment count. + InMemoryCache.prototype.retain = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).retain(rootId); + }; + // Call this method to undo the effect of the retain method, above. Once the + // retainment count falls to zero, the given ID will no longer be preserved + // during garbage collection, though it may still be preserved by other safe + // entities that refer to it. Returns the resulting (non-negative) retainment + // count, in case that's useful. + InMemoryCache.prototype.release = function (rootId, optimistic) { + return (optimistic ? this.optimisticData : this.data).release(rootId); + }; + // Returns the canonical ID for a given StoreObject, obeying typePolicies + // and keyFields (and dataIdFromObject, if you still use that). At minimum, + // the object must contain a __typename and any primary key fields required + // to identify entities of that type. If you pass a query result object, be + // sure that none of the primary key fields have been renamed by aliasing. + // If you pass a Reference object, its __ref ID string will be returned. + InMemoryCache.prototype.identify = function (object) { + if (isReference(object)) + return object.__ref; + try { + return this.policies.identify(object)[0]; + } + catch (e) { + globalThis.__DEV__ !== false && invariant.warn(e); + } + }; + InMemoryCache.prototype.evict = function (options) { + if (!options.id) { + if (hasOwn.call(options, "id")) { + // See comment in modify method about why we return false when + // options.id exists but is falsy/undefined. + return false; + } + options = __assign(__assign({}, options), { id: "ROOT_QUERY" }); + } + try { + // It's unlikely that the eviction will end up invoking any other + // cache update operations while it's running, but {in,de}crementing + // this.txCount still seems like a good idea, for uniformity with + // the other update methods. + ++this.txCount; + // Pass this.data as a limit on the depth of the eviction, so evictions + // during optimistic updates (when this.data is temporarily set equal to + // this.optimisticData) do not escape their optimistic Layer. + return this.optimisticData.evict(options, this.data); + } + finally { + if (!--this.txCount && options.broadcast !== false) { + this.broadcastWatches(); + } + } + }; + InMemoryCache.prototype.reset = function (options) { + var _this = this; + this.init(); + canonicalStringify.reset(); + if (options && options.discardWatches) { + // Similar to what happens in the unsubscribe function returned by + // cache.watch, applied to all current watches. + this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); }); + this.watches.clear(); + forgetCache(this); + } + else { + // Calling this.init() above unblocks all maybeBroadcastWatch caching, so + // this.broadcastWatches() triggers a broadcast to every current watcher + // (letting them know their data is now missing). This default behavior is + // convenient because it means the watches do not have to be manually + // reestablished after resetting the cache. To prevent this broadcast and + // cancel all watches, pass true for options.discardWatches. + this.broadcastWatches(); + } + return Promise.resolve(); + }; + InMemoryCache.prototype.removeOptimistic = function (idToRemove) { + var newOptimisticData = this.optimisticData.removeLayer(idToRemove); + if (newOptimisticData !== this.optimisticData) { + this.optimisticData = newOptimisticData; + this.broadcastWatches(); + } + }; + InMemoryCache.prototype.batch = function (options) { + var _this = this; + var update = options.update, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, removeOptimistic = options.removeOptimistic, onWatchUpdated = options.onWatchUpdated; + var updateResult; + var perform = function (layer) { + var _a = _this, data = _a.data, optimisticData = _a.optimisticData; + ++_this.txCount; + if (layer) { + _this.data = _this.optimisticData = layer; + } + try { + return (updateResult = update(_this)); + } + finally { + --_this.txCount; + _this.data = data; + _this.optimisticData = optimisticData; + } + }; + var alreadyDirty = new Set(); + if (onWatchUpdated && !this.txCount) { + // If an options.onWatchUpdated callback is provided, we want to call it + // with only the Cache.WatchOptions objects affected by options.update, + // but there might be dirty watchers already waiting to be broadcast that + // have nothing to do with the update. To prevent including those watchers + // in the post-update broadcast, we perform this initial broadcast to + // collect the dirty watchers, so we can re-dirty them later, after the + // post-update broadcast, allowing them to receive their pending + // broadcasts the next time broadcastWatches is called, just as they would + // if we never called cache.batch. + this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch) { + alreadyDirty.add(watch); + return false; + } })); + } + if (typeof optimistic === "string") { + // Note that there can be multiple layers with the same optimistic ID. + // When removeOptimistic(id) is called for that id, all matching layers + // will be removed, and the remaining layers will be reapplied. + this.optimisticData = this.optimisticData.addLayer(optimistic, perform); + } + else if (optimistic === false) { + // Ensure both this.data and this.optimisticData refer to the root + // (non-optimistic) layer of the cache during the update. Note that + // this.data could be a Layer if we are currently executing an optimistic + // update function, but otherwise will always be an EntityStore.Root + // instance. + perform(this.data); + } + else { + // Otherwise, leave this.data and this.optimisticData unchanged and run + // the update with broadcast batching. + perform(); + } + if (typeof removeOptimistic === "string") { + this.optimisticData = this.optimisticData.removeLayer(removeOptimistic); + } + // Note: if this.txCount > 0, then alreadyDirty.size === 0, so this code + // takes the else branch and calls this.broadcastWatches(options), which + // does nothing when this.txCount > 0. + if (onWatchUpdated && alreadyDirty.size) { + this.broadcastWatches(__assign(__assign({}, options), { onWatchUpdated: function (watch, diff) { + var result = onWatchUpdated.call(this, watch, diff); + if (result !== false) { + // Since onWatchUpdated did not return false, this diff is + // about to be broadcast to watch.callback, so we don't need + // to re-dirty it with the other alreadyDirty watches below. + alreadyDirty.delete(watch); + } + return result; + } })); + // Silently re-dirty any watches that were already dirty before the update + // was performed, and were not broadcast just now. + if (alreadyDirty.size) { + alreadyDirty.forEach(function (watch) { return _this.maybeBroadcastWatch.dirty(watch); }); + } + } + else { + // If alreadyDirty is empty or we don't have an onWatchUpdated + // function, we don't need to go to the trouble of wrapping + // options.onWatchUpdated. + this.broadcastWatches(options); + } + return updateResult; + }; + InMemoryCache.prototype.performTransaction = function (update, optimisticId) { + return this.batch({ + update: update, + optimistic: optimisticId || optimisticId !== null, + }); + }; + InMemoryCache.prototype.transformDocument = function (document) { + return this.addTypenameToDocument(this.addFragmentsToDocument(document)); + }; + InMemoryCache.prototype.broadcastWatches = function (options) { + var _this = this; + if (!this.txCount) { + this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c, options); }); + } + }; + InMemoryCache.prototype.addFragmentsToDocument = function (document) { + var fragments = this.config.fragments; + return fragments ? fragments.transform(document) : document; + }; + InMemoryCache.prototype.addTypenameToDocument = function (document) { + if (this.addTypename) { + return this.addTypenameTransform.transformDocument(document); + } + return document; + }; + // This method is wrapped by maybeBroadcastWatch, which is called by + // broadcastWatches, so that we compute and broadcast results only when + // the data that would be broadcast might have changed. It would be + // simpler to check for changes after recomputing a result but before + // broadcasting it, but this wrapping approach allows us to skip both + // the recomputation and the broadcast, in most cases. + InMemoryCache.prototype.broadcastWatch = function (c, options) { + var lastDiff = c.lastDiff; + // Both WatchOptions and DiffOptions extend ReadOptions, and DiffOptions + // currently requires no additional properties, so we can use c (a + // WatchOptions object) as DiffOptions, without having to allocate a new + // object, and without having to enumerate the relevant properties (query, + // variables, etc.) explicitly. There will be some additional properties + // (lastDiff, callback, etc.), but cache.diff ignores them. + var diff = this.diff(c); + if (options) { + if (c.optimistic && typeof options.optimistic === "string") { + diff.fromOptimisticTransaction = true; + } + if (options.onWatchUpdated && + options.onWatchUpdated.call(this, c, diff, lastDiff) === false) { + // Returning false from the onWatchUpdated callback will prevent + // calling c.callback(diff) for this watcher. + return; + } + } + if (!lastDiff || !equal(lastDiff.result, diff.result)) { + c.callback((c.lastDiff = diff), lastDiff); + } + }; + return InMemoryCache; +}(ApolloCache)); +export { InMemoryCache }; +if (globalThis.__DEV__ !== false) { + InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals; +} +//# sourceMappingURL=inMemoryCache.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js.map new file mode 100644 index 0000000..c8fa813 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/inMemoryCache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"inMemoryCache.js","sourceRoot":"","sources":["../../../src/cache/inmemory/inMemoryCache.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,0EAA0E;AAC1E,OAAO,mBAAmB,CAAC;AAI3B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,UAAU,GAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAm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from \"../../utilities/globals/index.js\";\n\n// Make builtins like Map and Set safe to use with non-extensible objects.\nimport \"./fixPolyfills.js\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { OptimisticWrapperFunction } from \"optimism\";\nimport { wrap } from \"optimism\";\nimport { equal } from \"@wry/equality\";\n\nimport { ApolloCache } from \"../core/cache.js\";\nimport type { Cache } from \"../core/types/Cache.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport type { StoreObject, Reference } from \"../../utilities/index.js\";\nimport {\n addTypenameToDocument,\n isReference,\n DocumentTransform,\n canonicalStringify,\n print,\n cacheSizes,\n defaultCacheSizes,\n} from \"../../utilities/index.js\";\nimport type { InMemoryCacheConfig, NormalizedCacheObject } from \"./types.js\";\nimport { StoreReader } from \"./readFromStore.js\";\nimport { StoreWriter } from \"./writeToStore.js\";\nimport { EntityStore, supportsResultCaching } from \"./entityStore.js\";\nimport { makeVar, forgetCache, recallCache } from \"./reactiveVars.js\";\nimport { Policies } from \"./policies.js\";\nimport { hasOwn, normalizeConfig, shouldCanonizeResults } from \"./helpers.js\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { getInMemoryCacheMemoryInternals } from \"../../utilities/caching/getMemoryInternals.js\";\n\ntype BroadcastOptions = Pick<\n Cache.BatchOptions,\n \"optimistic\" | \"onWatchUpdated\"\n>;\n\nexport class InMemoryCache extends ApolloCache {\n private data!: EntityStore;\n private optimisticData!: EntityStore;\n\n protected config: InMemoryCacheConfig;\n private watches = new Set();\n private addTypename: boolean;\n\n private storeReader!: StoreReader;\n private storeWriter!: StoreWriter;\n private addTypenameTransform = new DocumentTransform(addTypenameToDocument);\n\n private maybeBroadcastWatch!: OptimisticWrapperFunction<\n [Cache.WatchOptions, BroadcastOptions?],\n any,\n [Cache.WatchOptions]\n >;\n\n // Override the default value, since InMemoryCache result objects are frozen\n // in development and expected to remain logically immutable in production.\n public readonly assumeImmutableResults = true;\n\n // Dynamically imported code can augment existing typePolicies or\n // possibleTypes by calling cache.policies.addTypePolicies or\n // cache.policies.addPossibletypes.\n public readonly policies: Policies;\n\n public readonly makeVar = makeVar;\n\n constructor(config: InMemoryCacheConfig = {}) {\n super();\n this.config = normalizeConfig(config);\n this.addTypename = !!this.config.addTypename;\n\n this.policies = new Policies({\n cache: this,\n dataIdFromObject: this.config.dataIdFromObject,\n possibleTypes: this.config.possibleTypes,\n typePolicies: this.config.typePolicies,\n });\n\n this.init();\n }\n\n private init() {\n // Passing { resultCaching: false } in the InMemoryCache constructor options\n // will completely disable dependency tracking, which will improve memory\n // usage but worsen the performance of repeated reads.\n const rootStore = (this.data = new EntityStore.Root({\n policies: this.policies,\n resultCaching: this.config.resultCaching,\n }));\n\n // When no optimistic writes are currently active, cache.optimisticData ===\n // cache.data, so there are no additional layers on top of the actual data.\n // When an optimistic update happens, this.optimisticData will become a\n // linked list of EntityStore Layer objects that terminates with the\n // original this.data cache object.\n this.optimisticData = rootStore.stump;\n\n this.resetResultCache();\n }\n\n private resetResultCache(resetResultIdentities?: boolean) {\n const previousReader = this.storeReader;\n const { fragments } = this.config;\n\n // The StoreWriter is mostly stateless and so doesn't really need to be\n // reset, but it does need to have its writer.storeReader reference updated,\n // so it's simpler to update this.storeWriter as well.\n this.storeWriter = new StoreWriter(\n this,\n (this.storeReader = new StoreReader({\n cache: this,\n addTypename: this.addTypename,\n resultCacheMaxSize: this.config.resultCacheMaxSize,\n canonizeResults: shouldCanonizeResults(this.config),\n canon:\n resetResultIdentities ? void 0 : (\n previousReader && previousReader.canon\n ),\n fragments,\n })),\n fragments\n );\n\n this.maybeBroadcastWatch = wrap(\n (c: Cache.WatchOptions, options?: BroadcastOptions) => {\n return this.broadcastWatch(c, options);\n },\n {\n max:\n this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] ||\n defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"],\n makeCacheKey: (c: Cache.WatchOptions) => {\n // Return a cache key (thus enabling result caching) only if we're\n // currently using a data store that can track cache dependencies.\n const store = c.optimistic ? this.optimisticData : this.data;\n if (supportsResultCaching(store)) {\n const { optimistic, id, variables } = c;\n return store.makeCacheKey(\n c.query,\n // Different watches can have the same query, optimistic\n // status, rootId, and variables, but if their callbacks are\n // different, the (identical) result needs to be delivered to\n // each distinct callback. The easiest way to achieve that\n // separation is to include c.callback in the cache key for\n // maybeBroadcastWatch calls. See issue #5733.\n c.callback,\n canonicalStringify({ optimistic, id, variables })\n );\n }\n },\n }\n );\n\n // Since we have thrown away all the cached functions that depend on the\n // CacheGroup dependencies maintained by EntityStore, we should also reset\n // all CacheGroup dependency information.\n new Set([this.data.group, this.optimisticData.group]).forEach((group) =>\n group.resetCaching()\n );\n }\n\n public restore(data: NormalizedCacheObject): this {\n this.init();\n // Since calling this.init() discards/replaces the entire StoreReader, along\n // with the result caches it maintains, this.data.replace(data) won't have\n // to bother deleting the old data.\n if (data) this.data.replace(data);\n return this;\n }\n\n public extract(optimistic: boolean = false): NormalizedCacheObject {\n return (optimistic ? this.optimisticData : this.data).extract();\n }\n\n public read(options: Cache.ReadOptions): T | null {\n const {\n // Since read returns data or null, without any additional metadata\n // about whether/where there might have been missing fields, the\n // default behavior cannot be returnPartialData = true (like it is\n // for the diff method), since defaulting to true would violate the\n // integrity of the T in the return type. However, partial data may\n // be useful in some cases, so returnPartialData:true may be\n // specified explicitly.\n returnPartialData = false,\n } = options;\n try {\n return (\n this.storeReader.diffQueryAgainstStore({\n ...options,\n store: options.optimistic ? this.optimisticData : this.data,\n config: this.config,\n returnPartialData,\n }).result || null\n );\n } catch (e) {\n if (e instanceof MissingFieldError) {\n // Swallow MissingFieldError and return null, so callers do not need to\n // worry about catching \"normal\" exceptions resulting from incomplete\n // cache data. Unexpected errors will be re-thrown. If you need more\n // information about which fields were missing, use cache.diff instead,\n // and examine diffResult.missing.\n return null;\n }\n throw e;\n }\n }\n\n public write(options: Cache.WriteOptions): Reference | undefined {\n try {\n ++this.txCount;\n return this.storeWriter.writeToStore(this.data, options);\n } finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n }\n\n public modify = Record>(\n options: Cache.ModifyOptions\n ): boolean {\n if (hasOwn.call(options, \"id\") && !options.id) {\n // To my knowledge, TypeScript does not currently provide a way to\n // enforce that an optional property?:type must *not* be undefined\n // when present. That ability would be useful here, because we want\n // options.id to default to ROOT_QUERY only when no options.id was\n // provided. If the caller attempts to pass options.id with a\n // falsy/undefined value (perhaps because cache.identify failed), we\n // should not assume the goal was to modify the ROOT_QUERY object.\n // We could throw, but it seems natural to return false to indicate\n // that nothing was modified.\n return false;\n }\n const store =\n (\n options.optimistic // Defaults to false.\n ) ?\n this.optimisticData\n : this.data;\n try {\n ++this.txCount;\n return store.modify(options.id || \"ROOT_QUERY\", options.fields);\n } finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n }\n\n public diff(\n options: Cache.DiffOptions\n ): Cache.DiffResult {\n return this.storeReader.diffQueryAgainstStore({\n ...options,\n store: options.optimistic ? this.optimisticData : this.data,\n rootId: options.id || \"ROOT_QUERY\",\n config: this.config,\n });\n }\n\n public watch(\n watch: Cache.WatchOptions\n ): () => void {\n if (!this.watches.size) {\n // In case we previously called forgetCache(this) because\n // this.watches became empty (see below), reattach this cache to any\n // reactive variables on which it previously depended. It might seem\n // paradoxical that we're able to recall something we supposedly\n // forgot, but the point of calling forgetCache(this) is to silence\n // useless broadcasts while this.watches is empty, and to allow the\n // cache to be garbage collected. If, however, we manage to call\n // recallCache(this) here, this cache object must not have been\n // garbage collected yet, and should resume receiving updates from\n // reactive variables, now that it has a watcher to notify.\n recallCache(this);\n }\n this.watches.add(watch);\n if (watch.immediate) {\n this.maybeBroadcastWatch(watch);\n }\n return () => {\n // Once we remove the last watch from this.watches, cache.broadcastWatches\n // no longer does anything, so we preemptively tell the reactive variable\n // system to exclude this cache from future broadcasts.\n if (this.watches.delete(watch) && !this.watches.size) {\n forgetCache(this);\n }\n // Remove this watch from the LRU cache managed by the\n // maybeBroadcastWatch OptimisticWrapperFunction, to prevent memory\n // leaks involving the closure of watch.callback.\n this.maybeBroadcastWatch.forget(watch);\n };\n }\n\n public gc(options?: {\n // If true, also free non-essential result cache memory by bulk-releasing\n // this.{store{Reader,Writer},maybeBroadcastWatch}. Defaults to false.\n resetResultCache?: boolean;\n // If resetResultCache is true, this.storeReader.canon will be preserved by\n // default, but can also be discarded by passing resetResultIdentities:true.\n // Defaults to false.\n resetResultIdentities?: boolean;\n }) {\n canonicalStringify.reset();\n print.reset();\n this.addTypenameTransform.resetCache();\n this.config.fragments?.resetCaches();\n const ids = this.optimisticData.gc();\n if (options && !this.txCount) {\n if (options.resetResultCache) {\n this.resetResultCache(options.resetResultIdentities);\n } else if (options.resetResultIdentities) {\n this.storeReader.resetCanon();\n }\n }\n return ids;\n }\n\n // Call this method to ensure the given root ID remains in the cache after\n // garbage collection, along with its transitive child entities. Note that\n // the cache automatically retains all directly written entities. By default,\n // the retainment persists after optimistic updates are removed. Pass true\n // for the optimistic argument if you would prefer for the retainment to be\n // discarded when the top-most optimistic layer is removed. Returns the\n // resulting (non-negative) retainment count.\n public retain(rootId: string, optimistic?: boolean): number {\n return (optimistic ? this.optimisticData : this.data).retain(rootId);\n }\n\n // Call this method to undo the effect of the retain method, above. Once the\n // retainment count falls to zero, the given ID will no longer be preserved\n // during garbage collection, though it may still be preserved by other safe\n // entities that refer to it. Returns the resulting (non-negative) retainment\n // count, in case that's useful.\n public release(rootId: string, optimistic?: boolean): number {\n return (optimistic ? this.optimisticData : this.data).release(rootId);\n }\n\n // Returns the canonical ID for a given StoreObject, obeying typePolicies\n // and keyFields (and dataIdFromObject, if you still use that). At minimum,\n // the object must contain a __typename and any primary key fields required\n // to identify entities of that type. If you pass a query result object, be\n // sure that none of the primary key fields have been renamed by aliasing.\n // If you pass a Reference object, its __ref ID string will be returned.\n public identify(object: StoreObject | Reference): string | undefined {\n if (isReference(object)) return object.__ref;\n try {\n return this.policies.identify(object)[0];\n } catch (e) {\n invariant.warn(e);\n }\n }\n\n public evict(options: Cache.EvictOptions): boolean {\n if (!options.id) {\n if (hasOwn.call(options, \"id\")) {\n // See comment in modify method about why we return false when\n // options.id exists but is falsy/undefined.\n return false;\n }\n options = { ...options, id: \"ROOT_QUERY\" };\n }\n try {\n // It's unlikely that the eviction will end up invoking any other\n // cache update operations while it's running, but {in,de}crementing\n // this.txCount still seems like a good idea, for uniformity with\n // the other update methods.\n ++this.txCount;\n // Pass this.data as a limit on the depth of the eviction, so evictions\n // during optimistic updates (when this.data is temporarily set equal to\n // this.optimisticData) do not escape their optimistic Layer.\n return this.optimisticData.evict(options, this.data);\n } finally {\n if (!--this.txCount && options.broadcast !== false) {\n this.broadcastWatches();\n }\n }\n }\n\n public reset(options?: Cache.ResetOptions): Promise {\n this.init();\n\n canonicalStringify.reset();\n\n if (options && options.discardWatches) {\n // Similar to what happens in the unsubscribe function returned by\n // cache.watch, applied to all current watches.\n this.watches.forEach((watch) => this.maybeBroadcastWatch.forget(watch));\n this.watches.clear();\n forgetCache(this);\n } else {\n // Calling this.init() above unblocks all maybeBroadcastWatch caching, so\n // this.broadcastWatches() triggers a broadcast to every current watcher\n // (letting them know their data is now missing). This default behavior is\n // convenient because it means the watches do not have to be manually\n // reestablished after resetting the cache. To prevent this broadcast and\n // cancel all watches, pass true for options.discardWatches.\n this.broadcastWatches();\n }\n\n return Promise.resolve();\n }\n\n public removeOptimistic(idToRemove: string) {\n const newOptimisticData = this.optimisticData.removeLayer(idToRemove);\n if (newOptimisticData !== this.optimisticData) {\n this.optimisticData = newOptimisticData;\n this.broadcastWatches();\n }\n }\n\n private txCount = 0;\n\n public batch(\n options: Cache.BatchOptions\n ): TUpdateResult {\n const {\n update,\n optimistic = true,\n removeOptimistic,\n onWatchUpdated,\n } = options;\n\n let updateResult: TUpdateResult;\n const perform = (layer?: EntityStore): TUpdateResult => {\n const { data, optimisticData } = this;\n ++this.txCount;\n if (layer) {\n this.data = this.optimisticData = layer;\n }\n try {\n return (updateResult = update(this));\n } finally {\n --this.txCount;\n this.data = data;\n this.optimisticData = optimisticData;\n }\n };\n\n const alreadyDirty = new Set();\n\n if (onWatchUpdated && !this.txCount) {\n // If an options.onWatchUpdated callback is provided, we want to call it\n // with only the Cache.WatchOptions objects affected by options.update,\n // but there might be dirty watchers already waiting to be broadcast that\n // have nothing to do with the update. To prevent including those watchers\n // in the post-update broadcast, we perform this initial broadcast to\n // collect the dirty watchers, so we can re-dirty them later, after the\n // post-update broadcast, allowing them to receive their pending\n // broadcasts the next time broadcastWatches is called, just as they would\n // if we never called cache.batch.\n this.broadcastWatches({\n ...options,\n onWatchUpdated(watch) {\n alreadyDirty.add(watch);\n return false;\n },\n });\n }\n\n if (typeof optimistic === \"string\") {\n // Note that there can be multiple layers with the same optimistic ID.\n // When removeOptimistic(id) is called for that id, all matching layers\n // will be removed, and the remaining layers will be reapplied.\n this.optimisticData = this.optimisticData.addLayer(optimistic, perform);\n } else if (optimistic === false) {\n // Ensure both this.data and this.optimisticData refer to the root\n // (non-optimistic) layer of the cache during the update. Note that\n // this.data could be a Layer if we are currently executing an optimistic\n // update function, but otherwise will always be an EntityStore.Root\n // instance.\n perform(this.data);\n } else {\n // Otherwise, leave this.data and this.optimisticData unchanged and run\n // the update with broadcast batching.\n perform();\n }\n\n if (typeof removeOptimistic === \"string\") {\n this.optimisticData = this.optimisticData.removeLayer(removeOptimistic);\n }\n\n // Note: if this.txCount > 0, then alreadyDirty.size === 0, so this code\n // takes the else branch and calls this.broadcastWatches(options), which\n // does nothing when this.txCount > 0.\n if (onWatchUpdated && alreadyDirty.size) {\n this.broadcastWatches({\n ...options,\n onWatchUpdated(watch, diff) {\n const result = onWatchUpdated.call(this, watch, diff);\n if (result !== false) {\n // Since onWatchUpdated did not return false, this diff is\n // about to be broadcast to watch.callback, so we don't need\n // to re-dirty it with the other alreadyDirty watches below.\n alreadyDirty.delete(watch);\n }\n return result;\n },\n });\n // Silently re-dirty any watches that were already dirty before the update\n // was performed, and were not broadcast just now.\n if (alreadyDirty.size) {\n alreadyDirty.forEach((watch) => this.maybeBroadcastWatch.dirty(watch));\n }\n } else {\n // If alreadyDirty is empty or we don't have an onWatchUpdated\n // function, we don't need to go to the trouble of wrapping\n // options.onWatchUpdated.\n this.broadcastWatches(options);\n }\n\n return updateResult!;\n }\n\n public performTransaction(\n update: (cache: InMemoryCache) => any,\n optimisticId?: string | null\n ) {\n return this.batch({\n update,\n optimistic: optimisticId || optimisticId !== null,\n });\n }\n\n public transformDocument(document: DocumentNode): DocumentNode {\n return this.addTypenameToDocument(this.addFragmentsToDocument(document));\n }\n\n protected broadcastWatches(options?: BroadcastOptions) {\n if (!this.txCount) {\n this.watches.forEach((c) => this.maybeBroadcastWatch(c, options));\n }\n }\n\n private addFragmentsToDocument(document: DocumentNode) {\n const { fragments } = this.config;\n return fragments ? fragments.transform(document) : document;\n }\n\n private addTypenameToDocument(document: DocumentNode) {\n if (this.addTypename) {\n return this.addTypenameTransform.transformDocument(document);\n }\n return document;\n }\n\n // This method is wrapped by maybeBroadcastWatch, which is called by\n // broadcastWatches, so that we compute and broadcast results only when\n // the data that would be broadcast might have changed. It would be\n // simpler to check for changes after recomputing a result but before\n // broadcasting it, but this wrapping approach allows us to skip both\n // the recomputation and the broadcast, in most cases.\n private broadcastWatch(c: Cache.WatchOptions, options?: BroadcastOptions) {\n const { lastDiff } = c;\n\n // Both WatchOptions and DiffOptions extend ReadOptions, and DiffOptions\n // currently requires no additional properties, so we can use c (a\n // WatchOptions object) as DiffOptions, without having to allocate a new\n // object, and without having to enumerate the relevant properties (query,\n // variables, etc.) explicitly. There will be some additional properties\n // (lastDiff, callback, etc.), but cache.diff ignores them.\n const diff = this.diff(c);\n\n if (options) {\n if (c.optimistic && typeof options.optimistic === \"string\") {\n diff.fromOptimisticTransaction = true;\n }\n\n if (\n options.onWatchUpdated &&\n options.onWatchUpdated.call(this, c, diff, lastDiff) === false\n ) {\n // Returning false from the onWatchUpdated callback will prevent\n // calling c.callback(diff) for this watcher.\n return;\n }\n }\n\n if (!lastDiff || !equal(lastDiff.result, diff.result)) {\n c.callback((c.lastDiff = diff), lastDiff);\n }\n }\n\n /**\n * @experimental\n * @internal\n * This is not a stable API - it is used in development builds to expose\n * information to the DevTools.\n * Use at your own risk!\n */\n public getMemoryInternals?: typeof getInMemoryCacheMemoryInternals;\n}\n\nif (__DEV__) {\n InMemoryCache.prototype.getMemoryInternals = getInMemoryCacheMemoryInternals;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.d.ts new file mode 100644 index 0000000..634242e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.d.ts @@ -0,0 +1,9 @@ +import type { KeySpecifier, KeyFieldsFunction, KeyArgsFunction } from "./policies.js"; +export declare function keyFieldsFnFromSpecifier(specifier: KeySpecifier): KeyFieldsFunction; +export declare function keyArgsFnFromSpecifier(specifier: KeySpecifier): KeyArgsFunction; +export declare function collectSpecifierPaths(specifier: KeySpecifier, extractor: (path: string[]) => any): Record; +export declare function getSpecifierPaths(spec: KeySpecifier): string[][]; +declare function extractKey, TKey extends string>(object: TObj, key: TKey): TObj[TKey] | undefined; +export declare function extractKeyPath(object: Record, path: string[], extract?: typeof extractKey): any; +export {}; +//# sourceMappingURL=key-extractor.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js new file mode 100644 index 0000000..d088e0b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js @@ -0,0 +1,192 @@ +import { invariant } from "../../utilities/globals/index.js"; +import { argumentsObjectFromField, DeepMerger, isNonEmptyArray, isNonNullObject, } from "../../utilities/index.js"; +import { hasOwn, isArray } from "./helpers.js"; +// Mapping from JSON-encoded KeySpecifier strings to associated information. +var specifierInfoCache = Object.create(null); +function lookupSpecifierInfo(spec) { + // It's safe to encode KeySpecifier arrays with JSON.stringify, since they're + // just arrays of strings or nested KeySpecifier arrays, and the order of the + // array elements is important (and suitably preserved by JSON.stringify). + var cacheKey = JSON.stringify(spec); + return (specifierInfoCache[cacheKey] || + (specifierInfoCache[cacheKey] = Object.create(null))); +} +export function keyFieldsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyFieldsFn || (info.keyFieldsFn = function (object, context) { + var extract = function (from, key) { + return context.readField(key, from); + }; + var keyObject = (context.keyObject = collectSpecifierPaths(specifier, function (schemaKeyPath) { + var extracted = extractKeyPath(context.storeObject, schemaKeyPath, + // Using context.readField to extract paths from context.storeObject + // allows the extraction to see through Reference objects and respect + // custom read functions. + extract); + if (extracted === void 0 && + object !== context.storeObject && + hasOwn.call(object, schemaKeyPath[0])) { + // If context.storeObject fails to provide a value for the requested + // path, fall back to the raw result object, if it has a top-level key + // matching the first key in the path (schemaKeyPath[0]). This allows + // key fields included in the written data to be saved in the cache + // even if they are not selected explicitly in context.selectionSet. + // Not being mentioned by context.selectionSet is convenient here, + // since it means these extra fields cannot be affected by field + // aliasing, which is why we can use extractKey instead of + // context.readField for this extraction. + extracted = extractKeyPath(object, schemaKeyPath, extractKey); + } + invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object); + return extracted; + })); + return "".concat(context.typename, ":").concat(JSON.stringify(keyObject)); + })); +} +// The keyArgs extraction process is roughly analogous to keyFields extraction, +// but there are no aliases involved, missing fields are tolerated (by merely +// omitting them from the key), and drawing from field.directives or variables +// is allowed (in addition to drawing from the field's arguments object). +// Concretely, these differences mean passing a different key path extractor +// function to collectSpecifierPaths, reusing the shared extractKeyPath helper +// wherever possible. +export function keyArgsFnFromSpecifier(specifier) { + var info = lookupSpecifierInfo(specifier); + return (info.keyArgsFn || + (info.keyArgsFn = function (args, _a) { + var field = _a.field, variables = _a.variables, fieldName = _a.fieldName; + var collected = collectSpecifierPaths(specifier, function (keyPath) { + var firstKey = keyPath[0]; + var firstChar = firstKey.charAt(0); + if (firstChar === "@") { + if (field && isNonEmptyArray(field.directives)) { + var directiveName_1 = firstKey.slice(1); + // If the directive appears multiple times, only the first + // occurrence's arguments will be used. TODO Allow repetition? + // TODO Cache this work somehow, a la aliasMap? + var d = field.directives.find(function (d) { return d.name.value === directiveName_1; }); + // Fortunately argumentsObjectFromField works for DirectiveNode! + var directiveArgs = d && argumentsObjectFromField(d, variables); + // For directives without arguments (d defined, but directiveArgs === + // null), the presence or absence of the directive still counts as + // part of the field key, so we return null in those cases. If no + // directive with this name was found for this field (d undefined and + // thus directiveArgs undefined), we return undefined, which causes + // this value to be omitted from the key object returned by + // collectSpecifierPaths. + return (directiveArgs && + extractKeyPath(directiveArgs, + // If keyPath.length === 1, this code calls extractKeyPath with an + // empty path, which works because it uses directiveArgs as the + // extracted value. + keyPath.slice(1))); + } + // If the key started with @ but there was no corresponding directive, + // we want to omit this value from the key object, not fall through to + // treating @whatever as a normal argument name. + return; + } + if (firstChar === "$") { + var variableName = firstKey.slice(1); + if (variables && hasOwn.call(variables, variableName)) { + var varKeyPath = keyPath.slice(0); + varKeyPath[0] = variableName; + return extractKeyPath(variables, varKeyPath); + } + // If the key started with $ but there was no corresponding variable, we + // want to omit this value from the key object, not fall through to + // treating $whatever as a normal argument name. + return; + } + if (args) { + return extractKeyPath(args, keyPath); + } + }); + var suffix = JSON.stringify(collected); + // If no arguments were passed to this field, and it didn't have any other + // field key contributions from directives or variables, hide the empty + // :{} suffix from the field key. However, a field passed no arguments can + // still end up with a non-empty :{...} suffix if its key configuration + // refers to directives or variables. + if (args || suffix !== "{}") { + fieldName += ":" + suffix; + } + return fieldName; + })); +} +export function collectSpecifierPaths(specifier, extractor) { + // For each path specified by specifier, invoke the extractor, and repeatedly + // merge the results together, with appropriate ancestor context. + var merger = new DeepMerger(); + return getSpecifierPaths(specifier).reduce(function (collected, path) { + var _a; + var toMerge = extractor(path); + if (toMerge !== void 0) { + // This path is not expected to contain array indexes, so the toMerge + // reconstruction will not contain arrays. TODO Fix this? + for (var i = path.length - 1; i >= 0; --i) { + toMerge = (_a = {}, _a[path[i]] = toMerge, _a); + } + collected = merger.merge(collected, toMerge); + } + return collected; + }, Object.create(null)); +} +export function getSpecifierPaths(spec) { + var info = lookupSpecifierInfo(spec); + if (!info.paths) { + var paths_1 = (info.paths = []); + var currentPath_1 = []; + spec.forEach(function (s, i) { + if (isArray(s)) { + getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); }); + currentPath_1.length = 0; + } + else { + currentPath_1.push(s); + if (!isArray(spec[i + 1])) { + paths_1.push(currentPath_1.slice(0)); + currentPath_1.length = 0; + } + } + }); + } + return info.paths; +} +function extractKey(object, key) { + return object[key]; +} +export function extractKeyPath(object, path, extract) { + // For each key in path, extract the corresponding child property from obj, + // flattening arrays if encountered (uncommon for keyFields and keyArgs, but + // possible). The final result of path.reduce is normalized so unexpected leaf + // objects have their keys safely sorted. That final result is difficult to + // type as anything other than any. You're welcome to try to improve the + // return type, but keep in mind extractKeyPath is not a public function + // (exported only for testing), so the effort may not be worthwhile unless the + // limited set of actual callers (see above) pass arguments that TypeScript + // can statically type. If we know only that path is some array of strings + // (and not, say, a specific tuple of statically known strings), any (or + // possibly unknown) is the honest answer. + extract = extract || extractKey; + return normalize(path.reduce(function reducer(obj, key) { + return isArray(obj) ? + obj.map(function (child) { return reducer(child, key); }) + : obj && extract(obj, key); + }, object)); +} +function normalize(value) { + // Usually the extracted value will be a scalar value, since most primary + // key fields are scalar, but just in case we get an object or an array, we + // need to do some normalization of the order of (nested) keys. + if (isNonNullObject(value)) { + if (isArray(value)) { + return value.map(normalize); + } + return collectSpecifierPaths(Object.keys(value).sort(), function (path) { + return extractKeyPath(value, path); + }); + } + return value; +} +//# sourceMappingURL=key-extractor.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js.map new file mode 100644 index 0000000..4e11585 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/key-extractor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"key-extractor.js","sourceRoot":"","sources":["../../../src/cache/inmemory/key-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,eAAe,EACf,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAO/C,4EAA4E;AAC5E,IAAM,kBAAkB,GAOpB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAExB,SAAS,mBAAmB,CAAC,IAAkB;IAC7C,6EAA6E;IAC7E,6EAA6E;IAC7E,0EAA0E;IAC1E,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,CACL,kBAAkB,CAAC,QAAQ,CAAC;QAC5B,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CACrD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,SAAuB;IAEvB,IAAM,IAAI,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAE5C,OAAO,CACL,IAAI,CAAC,WAAW;QAChB,CAAC,IAAI,CAAC,WAAW,GAAG,UAAC,MAAM,EAAE,OAAO;YAClC,IAAM,OAAO,GAAsB,UAAC,IAAI,EAAE,GAAG;gBAC3C,OAAA,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;YAA5B,CAA4B,CAAC;YAE/B,IAAM,SAAS,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,qBAAqB,CAC1D,SAAS,EACT,UAAC,aAAa;gBACZ,IA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Ac,EACd,OAA2B;IAE3B,2EAA2E;IAC3E,4EAA4E;IAC5E,8EAA8E;IAC9E,2EAA2E;IAC3E,wEAAwE;IACxE,wEAAwE;IACxE,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,wEAAwE;IACxE,0CAA0C;IAC1C,OAAO,GAAG,OAAO,IAAI,UAAU,CAAC;IAChC,OAAO,SAAS,CACd,IAAI,CAAC,MAAM,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG;QACnC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACjB,GAAG,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAnB,CAAmB,CAAC;YACzC,CAAC,CAAC,GAAG,IAAI,OAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC,EAAE,MAAM,CAAC,CACX,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAI,KAAQ;IAC5B,yEAAyE;IACzE,2EAA2E;IAC3E,+DAA+D;IAC/D,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,CAAQ,CAAC;QACrC,CAAC;QACD,OAAO,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,UAAC,IAAI;YAC3D,OAAA,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC;QAA3B,CAA2B,CACvB,CAAC;IACT,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport {\n argumentsObjectFromField,\n DeepMerger,\n isNonEmptyArray,\n isNonNullObject,\n} from \"../../utilities/index.js\";\n\nimport { hasOwn, isArray } from \"./helpers.js\";\nimport type {\n KeySpecifier,\n KeyFieldsFunction,\n KeyArgsFunction,\n} from \"./policies.js\";\n\n// Mapping from JSON-encoded KeySpecifier strings to associated information.\nconst specifierInfoCache: Record<\n string,\n {\n paths?: string[][];\n keyFieldsFn?: KeyFieldsFunction;\n keyArgsFn?: KeyArgsFunction;\n }\n> = Object.create(null);\n\nfunction lookupSpecifierInfo(spec: KeySpecifier) {\n // It's safe to encode KeySpecifier arrays with JSON.stringify, since they're\n // just arrays of strings or nested KeySpecifier arrays, and the order of the\n // array elements is important (and suitably preserved by JSON.stringify).\n const cacheKey = JSON.stringify(spec);\n return (\n specifierInfoCache[cacheKey] ||\n (specifierInfoCache[cacheKey] = Object.create(null))\n );\n}\n\nexport function keyFieldsFnFromSpecifier(\n specifier: KeySpecifier\n): KeyFieldsFunction {\n const info = lookupSpecifierInfo(specifier);\n\n return (\n info.keyFieldsFn ||\n (info.keyFieldsFn = (object, context) => {\n const extract: typeof extractKey = (from, key) =>\n context.readField(key, from);\n\n const keyObject = (context.keyObject = collectSpecifierPaths(\n specifier,\n (schemaKeyPath) => {\n let extracted = extractKeyPath(\n context.storeObject,\n schemaKeyPath,\n // Using context.readField to extract paths from context.storeObject\n // allows the extraction to see through Reference objects and respect\n // custom read functions.\n extract\n );\n\n if (\n extracted === void 0 &&\n object !== context.storeObject &&\n hasOwn.call(object, schemaKeyPath[0])\n ) {\n // If context.storeObject fails to provide a value for the requested\n // path, fall back to the raw result object, if it has a top-level key\n // matching the first key in the path (schemaKeyPath[0]). This allows\n // key fields included in the written data to be saved in the cache\n // even if they are not selected explicitly in context.selectionSet.\n // Not being mentioned by context.selectionSet is convenient here,\n // since it means these extra fields cannot be affected by field\n // aliasing, which is why we can use extractKey instead of\n // context.readField for this extraction.\n extracted = extractKeyPath(object, schemaKeyPath, extractKey);\n }\n\n invariant(\n extracted !== void 0,\n `Missing field '%s' while extracting keyFields from %s`,\n schemaKeyPath.join(\".\"),\n object\n );\n\n return extracted;\n }\n ));\n\n return `${context.typename}:${JSON.stringify(keyObject)}`;\n })\n );\n}\n\n// The keyArgs extraction process is roughly analogous to keyFields extraction,\n// but there are no aliases involved, missing fields are tolerated (by merely\n// omitting them from the key), and drawing from field.directives or variables\n// is allowed (in addition to drawing from the field's arguments object).\n// Concretely, these differences mean passing a different key path extractor\n// function to collectSpecifierPaths, reusing the shared extractKeyPath helper\n// wherever possible.\nexport function keyArgsFnFromSpecifier(\n specifier: KeySpecifier\n): KeyArgsFunction {\n const info = lookupSpecifierInfo(specifier);\n\n return (\n info.keyArgsFn ||\n (info.keyArgsFn = (args, { field, variables, fieldName }) => {\n const collected = collectSpecifierPaths(specifier, (keyPath) => {\n const firstKey = keyPath[0];\n const firstChar = firstKey.charAt(0);\n\n if (firstChar === \"@\") {\n if (field && isNonEmptyArray(field.directives)) {\n const directiveName = firstKey.slice(1);\n // If the directive appears multiple times, only the first\n // occurrence's arguments will be used. TODO Allow repetition?\n // TODO Cache this work somehow, a la aliasMap?\n const d = field.directives.find(\n (d) => d.name.value === directiveName\n );\n // Fortunately argumentsObjectFromField works for DirectiveNode!\n const directiveArgs = d && argumentsObjectFromField(d, variables);\n // For directives without arguments (d defined, but directiveArgs ===\n // null), the presence or absence of the directive still counts as\n // part of the field key, so we return null in those cases. If no\n // directive with this name was found for this field (d undefined and\n // thus directiveArgs undefined), we return undefined, which causes\n // this value to be omitted from the key object returned by\n // collectSpecifierPaths.\n return (\n directiveArgs &&\n extractKeyPath(\n directiveArgs,\n // If keyPath.length === 1, this code calls extractKeyPath with an\n // empty path, which works because it uses directiveArgs as the\n // extracted value.\n keyPath.slice(1)\n )\n );\n }\n // If the key started with @ but there was no corresponding directive,\n // we want to omit this value from the key object, not fall through to\n // treating @whatever as a normal argument name.\n return;\n }\n\n if (firstChar === \"$\") {\n const variableName = firstKey.slice(1);\n if (variables && hasOwn.call(variables, variableName)) {\n const varKeyPath = keyPath.slice(0);\n varKeyPath[0] = variableName;\n return extractKeyPath(variables, varKeyPath);\n }\n // If the key started with $ but there was no corresponding variable, we\n // want to omit this value from the key object, not fall through to\n // treating $whatever as a normal argument name.\n return;\n }\n\n if (args) {\n return extractKeyPath(args, keyPath);\n }\n });\n\n const suffix = JSON.stringify(collected);\n\n // If no arguments were passed to this field, and it didn't have any other\n // field key contributions from directives or variables, hide the empty\n // :{} suffix from the field key. However, a field passed no arguments can\n // still end up with a non-empty :{...} suffix if its key configuration\n // refers to directives or variables.\n if (args || suffix !== \"{}\") {\n fieldName += \":\" + suffix;\n }\n\n return fieldName;\n })\n );\n}\n\nexport function collectSpecifierPaths(\n specifier: KeySpecifier,\n extractor: (path: string[]) => any\n): Record {\n // For each path specified by specifier, invoke the extractor, and repeatedly\n // merge the results together, with appropriate ancestor context.\n const merger = new DeepMerger();\n return getSpecifierPaths(specifier).reduce((collected, path) => {\n let toMerge = extractor(path);\n if (toMerge !== void 0) {\n // This path is not expected to contain array indexes, so the toMerge\n // reconstruction will not contain arrays. TODO Fix this?\n for (let i = path.length - 1; i >= 0; --i) {\n toMerge = { [path[i]]: toMerge };\n }\n collected = merger.merge(collected, toMerge);\n }\n return collected;\n }, Object.create(null));\n}\n\nexport function getSpecifierPaths(spec: KeySpecifier): string[][] {\n const info = lookupSpecifierInfo(spec);\n\n if (!info.paths) {\n const paths: string[][] = (info.paths = []);\n const currentPath: string[] = [];\n\n spec.forEach((s, i) => {\n if (isArray(s)) {\n getSpecifierPaths(s).forEach((p) => paths.push(currentPath.concat(p)));\n currentPath.length = 0;\n } else {\n currentPath.push(s);\n if (!isArray(spec[i + 1])) {\n paths.push(currentPath.slice(0));\n currentPath.length = 0;\n }\n }\n });\n }\n\n return info.paths!;\n}\n\nfunction extractKey, TKey extends string>(\n object: TObj,\n key: TKey\n): TObj[TKey] | undefined {\n return object[key];\n}\n\nexport function extractKeyPath(\n object: Record,\n path: string[],\n extract?: typeof extractKey\n): any {\n // For each key in path, extract the corresponding child property from obj,\n // flattening arrays if encountered (uncommon for keyFields and keyArgs, but\n // possible). The final result of path.reduce is normalized so unexpected leaf\n // objects have their keys safely sorted. That final result is difficult to\n // type as anything other than any. You're welcome to try to improve the\n // return type, but keep in mind extractKeyPath is not a public function\n // (exported only for testing), so the effort may not be worthwhile unless the\n // limited set of actual callers (see above) pass arguments that TypeScript\n // can statically type. If we know only that path is some array of strings\n // (and not, say, a specific tuple of statically known strings), any (or\n // possibly unknown) is the honest answer.\n extract = extract || extractKey;\n return normalize(\n path.reduce(function reducer(obj, key): any {\n return isArray(obj) ?\n obj.map((child) => reducer(child, key))\n : obj && extract!(obj, key);\n }, object)\n );\n}\n\nfunction normalize(value: T): T {\n // Usually the extracted value will be a scalar value, since most primary\n // key fields are scalar, but just in case we get an object or an array, we\n // need to do some normalization of the order of (nested) keys.\n if (isNonNullObject(value)) {\n if (isArray(value)) {\n return value.map(normalize) as any;\n }\n return collectSpecifierPaths(Object.keys(value).sort(), (path) =>\n extractKeyPath(value, path)\n ) as T;\n }\n return value;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.d.ts new file mode 100644 index 0000000..fcd7fe4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.d.ts @@ -0,0 +1,12 @@ +export declare class ObjectCanon { + private known; + private pool; + isKnown(value: any): boolean; + private passes; + pass(value: T): T; + admit(value: T): T; + private sortedKeys; + private keysByJSON; + readonly empty: {}; +} +//# sourceMappingURL=object-canon.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js new file mode 100644 index 0000000..9cad2d8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js @@ -0,0 +1,181 @@ +import { __assign } from "tslib"; +import { Trie } from "@wry/trie"; +import { canUseWeakMap, canUseWeakSet, isNonNullObject as isObjectOrArray, } from "../../utilities/index.js"; +import { isArray } from "./helpers.js"; +function shallowCopy(value) { + if (isObjectOrArray(value)) { + return isArray(value) ? + value.slice(0) + : __assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + return value; +} +// When programmers talk about the "canonical form" of an object, they +// usually have the following meaning in mind, which I've copied from +// https://en.wiktionary.org/wiki/canonical_form: +// +// 1. A standard or normal presentation of a mathematical entity [or +// object]. A canonical form is an element of a set of representatives +// of equivalence classes of forms such that there is a function or +// procedure which projects every element of each equivalence class +// onto that one element, the canonical form of that equivalence +// class. The canonical form is expected to be simpler than the rest of +// the forms in some way. +// +// That's a long-winded way of saying any two objects that have the same +// canonical form may be considered equivalent, even if they are !==, +// which usually means the objects are structurally equivalent (deeply +// equal), but don't necessarily use the same memory. +// +// Like a literary or musical canon, this ObjectCanon class represents a +// collection of unique canonical items (JavaScript objects), with the +// important property that canon.admit(a) === canon.admit(b) if a and b +// are deeply equal to each other. In terms of the definition above, the +// canon.admit method is the "function or procedure which projects every" +// object "onto that one element, the canonical form." +// +// In the worst case, the canonicalization process may involve looking at +// every property in the provided object tree, so it takes the same order +// of time as deep equality checking. Fortunately, already-canonicalized +// objects are returned immediately from canon.admit, so the presence of +// canonical subtrees tends to speed up canonicalization. +// +// Since consumers of canonical objects can check for deep equality in +// constant time, canonicalizing cache results can massively improve the +// performance of application code that skips re-rendering unchanged +// results, such as "pure" UI components in a framework like React. +// +// Of course, since canonical objects may be shared widely between +// unrelated consumers, it's important to think of them as immutable, even +// though they are not actually frozen with Object.freeze in production, +// due to the extra performance overhead that comes with frozen objects. +// +// Custom scalar objects whose internal class name is neither Array nor +// Object can be included safely in the admitted tree, but they will not +// be replaced with a canonical version (to put it another way, they are +// assumed to be canonical already). +// +// If we ignore custom objects, no detection of cycles or repeated object +// references is currently required by the StoreReader class, since +// GraphQL result objects are JSON-serializable trees (and thus contain +// neither cycles nor repeated subtrees), so we can avoid the complexity +// of keeping track of objects we've already seen during the recursion of +// the admit method. +// +// In the future, we may consider adding additional cases to the switch +// statement to handle other common object types, such as "[object Date]" +// objects, as needed. +var ObjectCanon = /** @class */ (function () { + function ObjectCanon() { + // Set of all canonical objects this ObjectCanon has admitted, allowing + // canon.admit to return previously-canonicalized objects immediately. + this.known = new (canUseWeakSet ? WeakSet : Set)(); + // Efficient storage/lookup structure for canonical objects. + this.pool = new Trie(canUseWeakMap); + // Make the ObjectCanon assume this value has already been + // canonicalized. + this.passes = new WeakMap(); + // Arrays that contain the same elements in a different order can share + // the same SortedKeysInfo object, to save memory. + this.keysByJSON = new Map(); + // This has to come last because it depends on keysByJSON. + this.empty = this.admit({}); + } + ObjectCanon.prototype.isKnown = function (value) { + return isObjectOrArray(value) && this.known.has(value); + }; + ObjectCanon.prototype.pass = function (value) { + if (isObjectOrArray(value)) { + var copy = shallowCopy(value); + this.passes.set(copy, value); + return copy; + } + return value; + }; + ObjectCanon.prototype.admit = function (value) { + var _this = this; + if (isObjectOrArray(value)) { + var original = this.passes.get(value); + if (original) + return original; + var proto = Object.getPrototypeOf(value); + switch (proto) { + case Array.prototype: { + if (this.known.has(value)) + return value; + var array = value.map(this.admit, this); + // Arrays are looked up in the Trie using their recursively + // canonicalized elements, and the known version of the array is + // preserved as node.array. + var node = this.pool.lookupArray(array); + if (!node.array) { + this.known.add((node.array = array)); + // Since canonical arrays may be shared widely between + // unrelated consumers, it's important to regard them as + // immutable, even if they are not frozen in production. + if (globalThis.__DEV__ !== false) { + Object.freeze(array); + } + } + return node.array; + } + case null: + case Object.prototype: { + if (this.known.has(value)) + return value; + var proto_1 = Object.getPrototypeOf(value); + var array_1 = [proto_1]; + var keys = this.sortedKeys(value); + array_1.push(keys.json); + var firstValueIndex_1 = array_1.length; + keys.sorted.forEach(function (key) { + array_1.push(_this.admit(value[key])); + }); + // Objects are looked up in the Trie by their prototype (which + // is *not* recursively canonicalized), followed by a JSON + // representation of their (sorted) keys, followed by the + // sequence of recursively canonicalized values corresponding to + // those keys. To keep the final results unambiguous with other + // sequences (such as arrays that just happen to contain [proto, + // keys.json, value1, value2, ...]), the known version of the + // object is stored as node.object. + var node = this.pool.lookupArray(array_1); + if (!node.object) { + var obj_1 = (node.object = Object.create(proto_1)); + this.known.add(obj_1); + keys.sorted.forEach(function (key, i) { + obj_1[key] = array_1[firstValueIndex_1 + i]; + }); + // Since canonical objects may be shared widely between + // unrelated consumers, it's important to regard them as + // immutable, even if they are not frozen in production. + if (globalThis.__DEV__ !== false) { + Object.freeze(obj_1); + } + } + return node.object; + } + } + } + return value; + }; + // It's worthwhile to cache the sorting of arrays of strings, since the + // same initial unsorted arrays tend to be encountered many times. + // Fortunately, we can reuse the Trie machinery to look up the sorted + // arrays in linear time (which is faster than sorting large arrays). + ObjectCanon.prototype.sortedKeys = function (obj) { + var keys = Object.keys(obj); + var node = this.pool.lookupArray(keys); + if (!node.keys) { + keys.sort(); + var json = JSON.stringify(keys); + if (!(node.keys = this.keysByJSON.get(json))) { + this.keysByJSON.set(json, (node.keys = { sorted: keys, json: json })); + } + } + return node.keys; + }; + return ObjectCanon; +}()); +export { ObjectCanon }; +//# sourceMappingURL=object-canon.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js.map new file mode 100644 index 0000000..2521f53 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/object-canon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"object-canon.js","sourceRoot":"","sources":["../../../src/cache/inmemory/object-canon.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,IAAI,eAAe,GACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,SAAS,WAAW,CAAI,KAAQ;IAC9B,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,KAAK,CA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AI,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAOH,kBAAC;AAAD,CAAC,AAvHD,IAuHC","sourcesContent":["import { Trie } from \"@wry/trie\";\nimport {\n canUseWeakMap,\n canUseWeakSet,\n isNonNullObject as isObjectOrArray,\n} from \"../../utilities/index.js\";\nimport { isArray } from \"./helpers.js\";\n\nfunction shallowCopy(value: T): T {\n if (isObjectOrArray(value)) {\n return isArray(value) ?\n (value.slice(0) as any as T)\n : { __proto__: Object.getPrototypeOf(value), ...value };\n }\n return value;\n}\n\n// When programmers talk about the \"canonical form\" of an object, they\n// usually have the following meaning in mind, which I've copied from\n// https://en.wiktionary.org/wiki/canonical_form:\n//\n// 1. A standard or normal presentation of a mathematical entity [or\n// object]. A canonical form is an element of a set of representatives\n// of equivalence classes of forms such that there is a function or\n// procedure which projects every element of each equivalence class\n// onto that one element, the canonical form of that equivalence\n// class. The canonical form is expected to be simpler than the rest of\n// the forms in some way.\n//\n// That's a long-winded way of saying any two objects that have the same\n// canonical form may be considered equivalent, even if they are !==,\n// which usually means the objects are structurally equivalent (deeply\n// equal), but don't necessarily use the same memory.\n//\n// Like a literary or musical canon, this ObjectCanon class represents a\n// collection of unique canonical items (JavaScript objects), with the\n// important property that canon.admit(a) === canon.admit(b) if a and b\n// are deeply equal to each other. In terms of the definition above, the\n// canon.admit method is the \"function or procedure which projects every\"\n// object \"onto that one element, the canonical form.\"\n//\n// In the worst case, the canonicalization process may involve looking at\n// every property in the provided object tree, so it takes the same order\n// of time as deep equality checking. Fortunately, already-canonicalized\n// objects are returned immediately from canon.admit, so the presence of\n// canonical subtrees tends to speed up canonicalization.\n//\n// Since consumers of canonical objects can check for deep equality in\n// constant time, canonicalizing cache results can massively improve the\n// performance of application code that skips re-rendering unchanged\n// results, such as \"pure\" UI components in a framework like React.\n//\n// Of course, since canonical objects may be shared widely between\n// unrelated consumers, it's important to think of them as immutable, even\n// though they are not actually frozen with Object.freeze in production,\n// due to the extra performance overhead that comes with frozen objects.\n//\n// Custom scalar objects whose internal class name is neither Array nor\n// Object can be included safely in the admitted tree, but they will not\n// be replaced with a canonical version (to put it another way, they are\n// assumed to be canonical already).\n//\n// If we ignore custom objects, no detection of cycles or repeated object\n// references is currently required by the StoreReader class, since\n// GraphQL result objects are JSON-serializable trees (and thus contain\n// neither cycles nor repeated subtrees), so we can avoid the complexity\n// of keeping track of objects we've already seen during the recursion of\n// the admit method.\n//\n// In the future, we may consider adding additional cases to the switch\n// statement to handle other common object types, such as \"[object Date]\"\n// objects, as needed.\nexport class ObjectCanon {\n // Set of all canonical objects this ObjectCanon has admitted, allowing\n // canon.admit to return previously-canonicalized objects immediately.\n private known = new (canUseWeakSet ? WeakSet : Set)();\n\n // Efficient storage/lookup structure for canonical objects.\n private pool = new Trie<{\n array?: any[];\n object?: Record;\n keys?: SortedKeysInfo;\n }>(canUseWeakMap);\n\n public isKnown(value: any): boolean {\n return isObjectOrArray(value) && this.known.has(value);\n }\n\n // Make the ObjectCanon assume this value has already been\n // canonicalized.\n private passes = new WeakMap();\n public pass(value: T): T;\n public pass(value: any) {\n if (isObjectOrArray(value)) {\n const copy = shallowCopy(value);\n this.passes.set(copy, value);\n return copy;\n }\n return value;\n }\n\n // Returns the canonical version of value.\n public admit(value: T): T;\n public admit(value: any) {\n if (isObjectOrArray(value)) {\n const original = this.passes.get(value);\n if (original) return original;\n\n const proto = Object.getPrototypeOf(value);\n switch (proto) {\n case Array.prototype: {\n if (this.known.has(value)) return value;\n const array: any[] = (value as any[]).map(this.admit, this);\n // Arrays are looked up in the Trie using their recursively\n // canonicalized elements, and the known version of the array is\n // preserved as node.array.\n const node = this.pool.lookupArray(array);\n if (!node.array) {\n this.known.add((node.array = array));\n // Since canonical arrays may be shared widely between\n // unrelated consumers, it's important to regard them as\n // immutable, even if they are not frozen in production.\n if (__DEV__) {\n Object.freeze(array);\n }\n }\n return node.array;\n }\n\n case null:\n case Object.prototype: {\n if (this.known.has(value)) return value;\n const proto = Object.getPrototypeOf(value);\n const array = [proto];\n const keys = this.sortedKeys(value);\n array.push(keys.json);\n const firstValueIndex = array.length;\n keys.sorted.forEach((key) => {\n array.push(this.admit((value as any)[key]));\n });\n // Objects are looked up in the Trie by their prototype (which\n // is *not* recursively canonicalized), followed by a JSON\n // representation of their (sorted) keys, followed by the\n // sequence of recursively canonicalized values corresponding to\n // those keys. To keep the final results unambiguous with other\n // sequences (such as arrays that just happen to contain [proto,\n // keys.json, value1, value2, ...]), the known version of the\n // object is stored as node.object.\n const node = this.pool.lookupArray(array);\n if (!node.object) {\n const obj = (node.object = Object.create(proto));\n this.known.add(obj);\n keys.sorted.forEach((key, i) => {\n obj[key] = array[firstValueIndex + i];\n });\n // Since canonical objects may be shared widely between\n // unrelated consumers, it's important to regard them as\n // immutable, even if they are not frozen in production.\n if (__DEV__) {\n Object.freeze(obj);\n }\n }\n return node.object;\n }\n }\n }\n return value;\n }\n\n // It's worthwhile to cache the sorting of arrays of strings, since the\n // same initial unsorted arrays tend to be encountered many times.\n // Fortunately, we can reuse the Trie machinery to look up the sorted\n // arrays in linear time (which is faster than sorting large arrays).\n private sortedKeys(obj: object) {\n const keys = Object.keys(obj);\n const node = this.pool.lookupArray(keys);\n if (!node.keys) {\n keys.sort();\n const json = JSON.stringify(keys);\n if (!(node.keys = this.keysByJSON.get(json))) {\n this.keysByJSON.set(json, (node.keys = { sorted: keys, json }));\n }\n }\n return node.keys;\n }\n // Arrays that contain the same elements in a different order can share\n // the same SortedKeysInfo object, to save memory.\n private keysByJSON = new Map();\n\n // This has to come last because it depends on keysByJSON.\n public readonly empty = this.admit({});\n}\n\ntype SortedKeysInfo = {\n sorted: string[];\n json: string;\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.d.ts new file mode 100644 index 0000000..3a0618a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.d.ts @@ -0,0 +1,97 @@ +import type { InlineFragmentNode, FragmentDefinitionNode, SelectionSetNode, FieldNode } from "graphql"; +import type { FragmentMap, StoreValue, StoreObject, Reference } from "../../utilities/index.js"; +import { isReference } from "../../utilities/index.js"; +import type { IdGetter, MergeInfo, ReadMergeModifyContext } from "./types.js"; +import type { InMemoryCache } from "./inMemoryCache.js"; +import type { SafeReadonly, FieldSpecifier, ToReferenceFunction, ReadFieldFunction, ReadFieldOptions, CanReadFunction } from "../core/types/common.js"; +import type { WriteContext } from "./writeToStore.js"; +export type TypePolicies = { + [__typename: string]: TypePolicy; +}; +export type KeySpecifier = ReadonlyArray; +export type KeyFieldsContext = { + typename: string | undefined; + storeObject: StoreObject; + readField: ReadFieldFunction; + selectionSet?: SelectionSetNode; + fragmentMap?: FragmentMap; + keyObject?: Record; +}; +export type KeyFieldsFunction = (object: Readonly, context: KeyFieldsContext) => KeySpecifier | false | ReturnType; +export type TypePolicy = { + keyFields?: KeySpecifier | KeyFieldsFunction | false; + merge?: FieldMergeFunction | boolean; + queryType?: true; + mutationType?: true; + subscriptionType?: true; + fields?: { + [fieldName: string]: FieldPolicy | FieldReadFunction; + }; +}; +export type KeyArgsFunction = (args: Record | null, context: { + typename: string; + fieldName: string; + field: FieldNode | null; + variables?: Record; +}) => KeySpecifier | false | ReturnType; +export type FieldPolicy = { + keyArgs?: KeySpecifier | KeyArgsFunction | false; + read?: FieldReadFunction; + merge?: FieldMergeFunction | boolean; +}; +export type StorageType = Record; +export interface FieldFunctionOptions, TVars = Record> { + args: TArgs | null; + fieldName: string; + storeFieldName: string; + field: FieldNode | null; + variables?: TVars; + isReference: typeof isReference; + toReference: ToReferenceFunction; + storage: StorageType; + cache: InMemoryCache; + readField: ReadFieldFunction; + canRead: CanReadFunction; + mergeObjects: MergeObjectsFunction; +} +type MergeObjectsFunction = (existing: T, incoming: T) => T; +export type FieldReadFunction = (existing: SafeReadonly | undefined, options: TOptions) => TReadResult | undefined; +export type FieldMergeFunction = (existing: SafeReadonly | undefined, incoming: SafeReadonly, options: TOptions) => SafeReadonly; +export type PossibleTypesMap = { + [supertype: string]: string[]; +}; +export declare class Policies { + private config; + private typePolicies; + private toBeAdded; + private supertypeMap; + private fuzzySubtypes; + readonly cache: InMemoryCache; + readonly rootIdsByTypename: Record; + readonly rootTypenamesById: Record; + readonly usingPossibleTypes = false; + constructor(config: { + cache: InMemoryCache; + dataIdFromObject?: KeyFieldsFunction; + possibleTypes?: PossibleTypesMap; + typePolicies?: TypePolicies; + }); + identify(object: StoreObject, partialContext?: Partial): [string?, StoreObject?]; + addTypePolicies(typePolicies: TypePolicies): void; + private updateTypePolicy; + private setRootTypename; + addPossibleTypes(possibleTypes: PossibleTypesMap): void; + private getTypePolicy; + private getFieldPolicy; + private getSupertypeSet; + fragmentMatches(fragment: InlineFragmentNode | FragmentDefinitionNode, typename: string | undefined, result?: Record, variables?: Record): boolean; + hasKeyArgs(typename: string | undefined, fieldName: string): boolean; + getStoreFieldName(fieldSpec: FieldSpecifier): string; + readField(options: ReadFieldOptions, context: ReadMergeModifyContext): SafeReadonly | undefined; + getReadFunction(typename: string | undefined, fieldName: string): FieldReadFunction | undefined; + getMergeFunction(parentTypename: string | undefined, fieldName: string, childTypename: string | undefined): FieldMergeFunction | undefined; + runMergeFunction(existing: StoreValue, incoming: StoreValue, { field, typename, merge }: MergeInfo, context: WriteContext, storage?: StorageType): any; +} +export declare function normalizeReadFieldOptions(readFieldArgs: IArguments, objectOrReference: StoreObject | Reference | undefined, variables?: ReadMergeModifyContext["variables"]): ReadFieldOptions; +export {}; +//# sourceMappingURL=policies.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js new file mode 100644 index 0000000..d3f5ba3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js @@ -0,0 +1,601 @@ +import { __assign, __rest } from "tslib"; +import { invariant, newInvariantError } from "../../utilities/globals/index.js"; +import { storeKeyNameFromField, argumentsObjectFromField, isReference, getStoreKeyName, isNonNullObject, stringifyForDisplay, } from "../../utilities/index.js"; +import { hasOwn, fieldNameFromStoreName, storeValueIsStoreObject, selectionSetMatchesResult, TypeOrFieldNameRegExp, defaultDataIdFromObject, isArray, } from "./helpers.js"; +import { cacheSlot } from "./reactiveVars.js"; +import { keyArgsFnFromSpecifier, keyFieldsFnFromSpecifier, } from "./key-extractor.js"; +function argsFromFieldSpecifier(spec) { + return (spec.args !== void 0 ? spec.args + : spec.field ? argumentsObjectFromField(spec.field, spec.variables) + : null); +} +var nullKeyFieldsFn = function () { return void 0; }; +var simpleKeyArgsFn = function (_args, context) { return context.fieldName; }; +// These merge functions can be selected by specifying merge:true or +// merge:false in a field policy. +var mergeTrueFn = function (existing, incoming, _a) { + var mergeObjects = _a.mergeObjects; + return mergeObjects(existing, incoming); +}; +var mergeFalseFn = function (_, incoming) { return incoming; }; +var Policies = /** @class */ (function () { + function Policies(config) { + this.config = config; + this.typePolicies = Object.create(null); + this.toBeAdded = Object.create(null); + // Map from subtype names to sets of supertype names. Note that this + // representation inverts the structure of possibleTypes (whose keys are + // supertypes and whose values are arrays of subtypes) because it tends + // to be much more efficient to search upwards than downwards. + this.supertypeMap = new Map(); + // Any fuzzy subtypes specified by possibleTypes will be converted to + // RegExp objects and recorded here. Every key of this map can also be + // found in supertypeMap. In many cases this Map will be empty, which + // means no fuzzy subtype checking will happen in fragmentMatches. + this.fuzzySubtypes = new Map(); + this.rootIdsByTypename = Object.create(null); + this.rootTypenamesById = Object.create(null); + this.usingPossibleTypes = false; + this.config = __assign({ dataIdFromObject: defaultDataIdFromObject }, config); + this.cache = this.config.cache; + this.setRootTypename("Query"); + this.setRootTypename("Mutation"); + this.setRootTypename("Subscription"); + if (config.possibleTypes) { + this.addPossibleTypes(config.possibleTypes); + } + if (config.typePolicies) { + this.addTypePolicies(config.typePolicies); + } + } + Policies.prototype.identify = function (object, partialContext) { + var _a; + var policies = this; + var typename = (partialContext && + (partialContext.typename || ((_a = partialContext.storeObject) === null || _a === void 0 ? void 0 : _a.__typename))) || + object.__typename; + // It should be possible to write root Query fields with writeFragment, + // using { __typename: "Query", ... } as the data, but it does not make + // sense to allow the same identification behavior for the Mutation and + // Subscription types, since application code should never be writing + // directly to (or reading directly from) those root objects. + if (typename === this.rootTypenamesById.ROOT_QUERY) { + return ["ROOT_QUERY"]; + } + // Default context.storeObject to object if not otherwise provided. + var storeObject = (partialContext && partialContext.storeObject) || object; + var context = __assign(__assign({}, partialContext), { typename: typename, storeObject: storeObject, readField: (partialContext && partialContext.readField) || + function () { + var options = normalizeReadFieldOptions(arguments, storeObject); + return policies.readField(options, { + store: policies.cache["data"], + variables: options.variables, + }); + } }); + var id; + var policy = typename && this.getTypePolicy(typename); + var keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject; + while (keyFn) { + var specifierOrId = keyFn(__assign(__assign({}, object), storeObject), context); + if (isArray(specifierOrId)) { + keyFn = keyFieldsFnFromSpecifier(specifierOrId); + } + else { + id = specifierOrId; + break; + } + } + id = id ? String(id) : void 0; + return context.keyObject ? [id, context.keyObject] : [id]; + }; + Policies.prototype.addTypePolicies = function (typePolicies) { + var _this = this; + Object.keys(typePolicies).forEach(function (typename) { + var _a = typePolicies[typename], queryType = _a.queryType, mutationType = _a.mutationType, subscriptionType = _a.subscriptionType, incoming = __rest(_a, ["queryType", "mutationType", "subscriptionType"]); + // Though {query,mutation,subscription}Type configurations are rare, + // it's important to call setRootTypename as early as possible, + // since these configurations should apply consistently for the + // entire lifetime of the cache. Also, since only one __typename can + // qualify as one of these root types, these three properties cannot + // be inherited, unlike the rest of the incoming properties. That + // restriction is convenient, because the purpose of this.toBeAdded + // is to delay the processing of type/field policies until the first + // time they're used, allowing policies to be added in any order as + // long as all relevant policies (including policies for supertypes) + // have been added by the time a given policy is used for the first + // time. In other words, since inheritance doesn't matter for these + // properties, there's also no need to delay their processing using + // the this.toBeAdded queue. + if (queryType) + _this.setRootTypename("Query", typename); + if (mutationType) + _this.setRootTypename("Mutation", typename); + if (subscriptionType) + _this.setRootTypename("Subscription", typename); + if (hasOwn.call(_this.toBeAdded, typename)) { + _this.toBeAdded[typename].push(incoming); + } + else { + _this.toBeAdded[typename] = [incoming]; + } + }); + }; + Policies.prototype.updateTypePolicy = function (typename, incoming) { + var _this = this; + var existing = this.getTypePolicy(typename); + var keyFields = incoming.keyFields, fields = incoming.fields; + function setMerge(existing, merge) { + existing.merge = + typeof merge === "function" ? merge + // Pass merge:true as a shorthand for a merge implementation + // that returns options.mergeObjects(existing, incoming). + : merge === true ? mergeTrueFn + // Pass merge:false to make incoming always replace existing + // without any warnings about data clobbering. + : merge === false ? mergeFalseFn + : existing.merge; + } + // Type policies can define merge functions, as an alternative to + // using field policies to merge child objects. + setMerge(existing, incoming.merge); + existing.keyFn = + // Pass false to disable normalization for this typename. + keyFields === false ? nullKeyFieldsFn + // Pass an array of strings to use those fields to compute a + // composite ID for objects of this typename. + : isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) + // Pass a function to take full control over identification. + : typeof keyFields === "function" ? keyFields + // Leave existing.keyFn unchanged if above cases fail. + : existing.keyFn; + if (fields) { + Object.keys(fields).forEach(function (fieldName) { + var existing = _this.getFieldPolicy(typename, fieldName, true); + var incoming = fields[fieldName]; + if (typeof incoming === "function") { + existing.read = incoming; + } + else { + var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge; + existing.keyFn = + // Pass false to disable argument-based differentiation of + // field identities. + keyArgs === false ? simpleKeyArgsFn + // Pass an array of strings to use named arguments to + // compute a composite identity for the field. + : isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) + // Pass a function to take full control over field identity. + : typeof keyArgs === "function" ? keyArgs + // Leave existing.keyFn unchanged if above cases fail. + : existing.keyFn; + if (typeof read === "function") { + existing.read = read; + } + setMerge(existing, merge); + } + if (existing.read && existing.merge) { + // If we have both a read and a merge function, assume + // keyArgs:false, because read and merge together can take + // responsibility for interpreting arguments in and out. This + // default assumption can always be overridden by specifying + // keyArgs explicitly in the FieldPolicy. + existing.keyFn = existing.keyFn || simpleKeyArgsFn; + } + }); + } + }; + Policies.prototype.setRootTypename = function (which, typename) { + if (typename === void 0) { typename = which; } + var rootId = "ROOT_" + which.toUpperCase(); + var old = this.rootTypenamesById[rootId]; + if (typename !== old) { + invariant(!old || old === which, 5, which); + // First, delete any old __typename associated with this rootId from + // rootIdsByTypename. + if (old) + delete this.rootIdsByTypename[old]; + // Now make this the only __typename that maps to this rootId. + this.rootIdsByTypename[typename] = rootId; + // Finally, update the __typename associated with this rootId. + this.rootTypenamesById[rootId] = typename; + } + }; + Policies.prototype.addPossibleTypes = function (possibleTypes) { + var _this = this; + this.usingPossibleTypes = true; + Object.keys(possibleTypes).forEach(function (supertype) { + // Make sure all types have an entry in this.supertypeMap, even if + // their supertype set is empty, so we can return false immediately + // from policies.fragmentMatches for unknown supertypes. + _this.getSupertypeSet(supertype, true); + possibleTypes[supertype].forEach(function (subtype) { + _this.getSupertypeSet(subtype, true).add(supertype); + var match = subtype.match(TypeOrFieldNameRegExp); + if (!match || match[0] !== subtype) { + // TODO Don't interpret just any invalid typename as a RegExp. + _this.fuzzySubtypes.set(subtype, new RegExp(subtype)); + } + }); + }); + }; + Policies.prototype.getTypePolicy = function (typename) { + var _this = this; + if (!hasOwn.call(this.typePolicies, typename)) { + var policy_1 = (this.typePolicies[typename] = Object.create(null)); + policy_1.fields = Object.create(null); + // When the TypePolicy for typename is first accessed, instead of + // starting with an empty policy object, inherit any properties or + // fields from the type policies of the supertypes of typename. + // + // Any properties or fields defined explicitly within the TypePolicy + // for typename will take precedence, and if there are multiple + // supertypes, the properties of policies whose types were added + // later via addPossibleTypes will take precedence over those of + // earlier supertypes. TODO Perhaps we should warn about these + // conflicts in development, and recommend defining the property + // explicitly in the subtype policy? + // + // Field policy inheritance is atomic/shallow: you can't inherit a + // field policy and then override just its read function, since read + // and merge functions often need to cooperate, so changing only one + // of them would be a recipe for inconsistency. + // + // Once the TypePolicy for typename has been accessed, its properties can + // still be updated directly using addTypePolicies, but future changes to + // inherited supertype policies will not be reflected in this subtype + // policy, because this code runs at most once per typename. + var supertypes_1 = this.supertypeMap.get(typename); + if (!supertypes_1 && this.fuzzySubtypes.size) { + // To make the inheritance logic work for unknown typename strings that + // may have fuzzy supertypes, we give this typename an empty supertype + // set and then populate it with any fuzzy supertypes that match. + supertypes_1 = this.getSupertypeSet(typename, true); + // This only works for typenames that are directly matched by a fuzzy + // supertype. What if there is an intermediate chain of supertypes? + // While possible, that situation can only be solved effectively by + // specifying the intermediate relationships via possibleTypes, manually + // and in a non-fuzzy way. + this.fuzzySubtypes.forEach(function (regExp, fuzzy) { + if (regExp.test(typename)) { + // The fuzzy parameter is just the original string version of regExp + // (not a valid __typename string), but we can look up the + // associated supertype(s) in this.supertypeMap. + var fuzzySupertypes = _this.supertypeMap.get(fuzzy); + if (fuzzySupertypes) { + fuzzySupertypes.forEach(function (supertype) { + return supertypes_1.add(supertype); + }); + } + } + }); + } + if (supertypes_1 && supertypes_1.size) { + supertypes_1.forEach(function (supertype) { + var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = __rest(_a, ["fields"]); + Object.assign(policy_1, rest); + Object.assign(policy_1.fields, fields); + }); + } + } + var inbox = this.toBeAdded[typename]; + if (inbox && inbox.length) { + // Merge the pending policies into this.typePolicies, in the order they + // were originally passed to addTypePolicy. + inbox.splice(0).forEach(function (policy) { + _this.updateTypePolicy(typename, policy); + }); + } + return this.typePolicies[typename]; + }; + Policies.prototype.getFieldPolicy = function (typename, fieldName, createIfMissing) { + if (typename) { + var fieldPolicies = this.getTypePolicy(typename).fields; + return (fieldPolicies[fieldName] || + (createIfMissing && (fieldPolicies[fieldName] = Object.create(null)))); + } + }; + Policies.prototype.getSupertypeSet = function (subtype, createIfMissing) { + var supertypeSet = this.supertypeMap.get(subtype); + if (!supertypeSet && createIfMissing) { + this.supertypeMap.set(subtype, (supertypeSet = new Set())); + } + return supertypeSet; + }; + Policies.prototype.fragmentMatches = function (fragment, typename, result, variables) { + var _this = this; + if (!fragment.typeCondition) + return true; + // If the fragment has a type condition but the object we're matching + // against does not have a __typename, the fragment cannot match. + if (!typename) + return false; + var supertype = fragment.typeCondition.name.value; + // Common case: fragment type condition and __typename are the same. + if (typename === supertype) + return true; + if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) { + var typenameSupertypeSet = this.getSupertypeSet(typename, true); + var workQueue_1 = [typenameSupertypeSet]; + var maybeEnqueue_1 = function (subtype) { + var supertypeSet = _this.getSupertypeSet(subtype, false); + if (supertypeSet && + supertypeSet.size && + workQueue_1.indexOf(supertypeSet) < 0) { + workQueue_1.push(supertypeSet); + } + }; + // We need to check fuzzy subtypes only if we encountered fuzzy + // subtype strings in addPossibleTypes, and only while writing to + // the cache, since that's when selectionSetMatchesResult gives a + // strong signal of fragment matching. The StoreReader class calls + // policies.fragmentMatches without passing a result object, so + // needToCheckFuzzySubtypes is always false while reading. + var needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size); + var checkingFuzzySubtypes = false; + // It's important to keep evaluating workQueue.length each time through + // the loop, because the queue can grow while we're iterating over it. + for (var i = 0; i < workQueue_1.length; ++i) { + var supertypeSet = workQueue_1[i]; + if (supertypeSet.has(supertype)) { + if (!typenameSupertypeSet.has(supertype)) { + if (checkingFuzzySubtypes) { + globalThis.__DEV__ !== false && invariant.warn(6, typename, supertype); + } + // Record positive results for faster future lookup. + // Unfortunately, we cannot safely cache negative results, + // because new possibleTypes data could always be added to the + // Policies class. + typenameSupertypeSet.add(supertype); + } + return true; + } + supertypeSet.forEach(maybeEnqueue_1); + if (needToCheckFuzzySubtypes && + // Start checking fuzzy subtypes only after exhausting all + // non-fuzzy subtypes (after the final iteration of the loop). + i === workQueue_1.length - 1 && + // We could wait to compare fragment.selectionSet to result + // after we verify the supertype, but this check is often less + // expensive than that search, and we will have to do the + // comparison anyway whenever we find a potential match. + selectionSetMatchesResult(fragment.selectionSet, result, variables)) { + // We don't always need to check fuzzy subtypes (if no result + // was provided, or !this.fuzzySubtypes.size), but, when we do, + // we only want to check them once. + needToCheckFuzzySubtypes = false; + checkingFuzzySubtypes = true; + // If we find any fuzzy subtypes that match typename, extend the + // workQueue to search through the supertypes of those fuzzy + // subtypes. Otherwise the for-loop will terminate and we'll + // return false below. + this.fuzzySubtypes.forEach(function (regExp, fuzzyString) { + var match = typename.match(regExp); + if (match && match[0] === typename) { + maybeEnqueue_1(fuzzyString); + } + }); + } + } + } + return false; + }; + Policies.prototype.hasKeyArgs = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return !!(policy && policy.keyFn); + }; + Policies.prototype.getStoreFieldName = function (fieldSpec) { + var typename = fieldSpec.typename, fieldName = fieldSpec.fieldName; + var policy = this.getFieldPolicy(typename, fieldName, false); + var storeFieldName; + var keyFn = policy && policy.keyFn; + if (keyFn && typename) { + var context = { + typename: typename, + fieldName: fieldName, + field: fieldSpec.field || null, + variables: fieldSpec.variables, + }; + var args = argsFromFieldSpecifier(fieldSpec); + while (keyFn) { + var specifierOrString = keyFn(args, context); + if (isArray(specifierOrString)) { + keyFn = keyArgsFnFromSpecifier(specifierOrString); + } + else { + // If the custom keyFn returns a falsy value, fall back to + // fieldName instead. + storeFieldName = specifierOrString || fieldName; + break; + } + } + } + if (storeFieldName === void 0) { + storeFieldName = + fieldSpec.field ? + storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) + : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec)); + } + // Returning false from a keyArgs function is like configuring + // keyArgs: false, but more dynamic. + if (storeFieldName === false) { + return fieldName; + } + // Make sure custom field names start with the actual field.name.value + // of the field, so we can always figure out which properties of a + // StoreObject correspond to which original field names. + return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName + : fieldName + ":" + storeFieldName; + }; + Policies.prototype.readField = function (options, context) { + var objectOrReference = options.from; + if (!objectOrReference) + return; + var nameOrField = options.field || options.fieldName; + if (!nameOrField) + return; + if (options.typename === void 0) { + var typename = context.store.getFieldValue(objectOrReference, "__typename"); + if (typename) + options.typename = typename; + } + var storeFieldName = this.getStoreFieldName(options); + var fieldName = fieldNameFromStoreName(storeFieldName); + var existing = context.store.getFieldValue(objectOrReference, storeFieldName); + var policy = this.getFieldPolicy(options.typename, fieldName, false); + var read = policy && policy.read; + if (read) { + var readOptions = makeFieldFunctionOptions(this, objectOrReference, options, context, context.store.getStorage(isReference(objectOrReference) ? + objectOrReference.__ref + : objectOrReference, storeFieldName)); + // Call read(existing, readOptions) with cacheSlot holding this.cache. + return cacheSlot.withValue(this.cache, read, [ + existing, + readOptions, + ]); + } + return existing; + }; + Policies.prototype.getReadFunction = function (typename, fieldName) { + var policy = this.getFieldPolicy(typename, fieldName, false); + return policy && policy.read; + }; + Policies.prototype.getMergeFunction = function (parentTypename, fieldName, childTypename) { + var policy = this.getFieldPolicy(parentTypename, fieldName, false); + var merge = policy && policy.merge; + if (!merge && childTypename) { + policy = this.getTypePolicy(childTypename); + merge = policy && policy.merge; + } + return merge; + }; + Policies.prototype.runMergeFunction = function (existing, incoming, _a, context, storage) { + var field = _a.field, typename = _a.typename, merge = _a.merge; + if (merge === mergeTrueFn) { + // Instead of going to the trouble of creating a full + // FieldFunctionOptions object and calling mergeTrueFn, we can + // simply call mergeObjects, as mergeTrueFn would. + return makeMergeObjectsFunction(context.store)(existing, incoming); + } + if (merge === mergeFalseFn) { + // Likewise for mergeFalseFn, whose implementation is even simpler. + return incoming; + } + // If cache.writeQuery or cache.writeFragment was called with + // options.overwrite set to true, we still call merge functions, but + // the existing data is always undefined, so the merge function will + // not attempt to combine the incoming data with the existing data. + if (context.overwrite) { + existing = void 0; + } + return merge(existing, incoming, makeFieldFunctionOptions(this, + // Unlike options.readField for read functions, we do not fall + // back to the current object if no foreignObjOrRef is provided, + // because it's not clear what the current object should be for + // merge functions: the (possibly undefined) existing object, or + // the incoming object? If you think your merge function needs + // to read sibling fields in order to produce a new value for + // the current field, you might want to rethink your strategy, + // because that's a recipe for making merge behavior sensitive + // to the order in which fields are written into the cache. + // However, readField(name, ref) is useful for merge functions + // that need to deduplicate child objects and references. + void 0, { + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }, context, storage || Object.create(null))); + }; + return Policies; +}()); +export { Policies }; +function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, context, storage) { + var storeFieldName = policies.getStoreFieldName(fieldSpec); + var fieldName = fieldNameFromStoreName(storeFieldName); + var variables = fieldSpec.variables || context.variables; + var _a = context.store, toReference = _a.toReference, canRead = _a.canRead; + return { + args: argsFromFieldSpecifier(fieldSpec), + field: fieldSpec.field || null, + fieldName: fieldName, + storeFieldName: storeFieldName, + variables: variables, + isReference: isReference, + toReference: toReference, + storage: storage, + cache: policies.cache, + canRead: canRead, + readField: function () { + return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context); + }, + mergeObjects: makeMergeObjectsFunction(context.store), + }; +} +export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) { + var fieldNameOrOptions = readFieldArgs[0], from = readFieldArgs[1], argc = readFieldArgs.length; + var options; + if (typeof fieldNameOrOptions === "string") { + options = { + fieldName: fieldNameOrOptions, + // Default to objectOrReference only when no second argument was + // passed for the from parameter, not when undefined is explicitly + // passed as the second argument. + from: argc > 1 ? from : objectOrReference, + }; + } + else { + options = __assign({}, fieldNameOrOptions); + // Default to objectOrReference only when fieldNameOrOptions.from is + // actually omitted, rather than just undefined. + if (!hasOwn.call(options, "from")) { + options.from = objectOrReference; + } + } + if (globalThis.__DEV__ !== false && options.from === void 0) { + globalThis.__DEV__ !== false && invariant.warn(7, stringifyForDisplay(Array.from(readFieldArgs))); + } + if (void 0 === options.variables) { + options.variables = variables; + } + return options; +} +function makeMergeObjectsFunction(store) { + return function mergeObjects(existing, incoming) { + if (isArray(existing) || isArray(incoming)) { + throw newInvariantError(8); + } + // These dynamic checks are necessary because the parameters of a + // custom merge function can easily have the any type, so the type + // system cannot always enforce the StoreObject | Reference parameter + // types of options.mergeObjects. + if (isNonNullObject(existing) && isNonNullObject(incoming)) { + var eType = store.getFieldValue(existing, "__typename"); + var iType = store.getFieldValue(incoming, "__typename"); + var typesDiffer = eType && iType && eType !== iType; + if (typesDiffer) { + return incoming; + } + if (isReference(existing) && storeValueIsStoreObject(incoming)) { + // Update the normalized EntityStore for the entity identified by + // existing.__ref, preferring/overwriting any fields contributed by the + // newer incoming StoreObject. + store.merge(existing.__ref, incoming); + return existing; + } + if (storeValueIsStoreObject(existing) && isReference(incoming)) { + // Update the normalized EntityStore for the entity identified by + // incoming.__ref, taking fields from the older existing object only if + // those fields are not already present in the newer StoreObject + // identified by incoming.__ref. + store.merge(existing, incoming.__ref); + return incoming; + } + if (storeValueIsStoreObject(existing) && + storeValueIsStoreObject(incoming)) { + return __assign(__assign({}, existing), incoming); + } + } + return incoming; + }; +} +//# sourceMappingURL=policies.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js.map new file mode 100644 index 0000000..15189c2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/policies.js.map @@ -0,0 +1 @@ +{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/cache/inmemory/policies.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAehF,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,MAAM,EACN,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,OAAO,GACR,MAAM,c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,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC1D,IAAM,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC1D,IAAM,WAAW,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,KAAK,KAAK,CAAC;YAEtD,IAAI,WAAW,EAAE,CAAC;gBAChB,OAAO,QAAQ,CAAC;YAClB,CAAC;YAED,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/D,iEAAiE;gBACjE,uEAAuE;gBACvE,8BAA8B;gBAC9B,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBACtC,OAAO,QAAQ,CAAC;YAClB,CAAC;YAED,IAAI,uBAAuB,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/D,iEAAiE;gBACjE,uEAAuE;gBACvE,gEAAgE;gBAChE,gCAAgC;gBAChC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACtC,OAAO,QAAQ,CAAC;YAClB,CAAC;YAED,IACE,uBAAuB,CAAC,QAAQ,CAAC;gBACjC,uBAAuB,CAAC,QAAQ,CAAC,EACjC,CAAC;gBACD,6BAAY,QAAQ,GAAK,QAAQ,EAAG;YACtC,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\n\nimport type {\n InlineFragmentNode,\n FragmentDefinitionNode,\n SelectionSetNode,\n FieldNode,\n} from \"graphql\";\n\nimport type {\n FragmentMap,\n StoreValue,\n StoreObject,\n Reference,\n} from \"../../utilities/index.js\";\nimport {\n storeKeyNameFromField,\n argumentsObjectFromField,\n isReference,\n getStoreKeyName,\n isNonNullObject,\n stringifyForDisplay,\n} from \"../../utilities/index.js\";\nimport type {\n IdGetter,\n MergeInfo,\n NormalizedCache,\n ReadMergeModifyContext,\n} from \"./types.js\";\nimport {\n hasOwn,\n fieldNameFromStoreName,\n storeValueIsStoreObject,\n selectionSetMatchesResult,\n TypeOrFieldNameRegExp,\n defaultDataIdFromObject,\n isArray,\n} from \"./helpers.js\";\nimport { cacheSlot } from \"./reactiveVars.js\";\nimport type { InMemoryCache } from \"./inMemoryCache.js\";\nimport type {\n SafeReadonly,\n FieldSpecifier,\n ToReferenceFunction,\n ReadFieldFunction,\n ReadFieldOptions,\n CanReadFunction,\n} from \"../core/types/common.js\";\nimport type { WriteContext } from \"./writeToStore.js\";\n\nimport {\n keyArgsFnFromSpecifier,\n keyFieldsFnFromSpecifier,\n} from \"./key-extractor.js\";\n\nexport type TypePolicies = {\n [__typename: string]: TypePolicy;\n};\n\n// TypeScript 3.7 will allow recursive type aliases, so this should work:\n// type KeySpecifier = (string | KeySpecifier)[]\nexport type KeySpecifier = ReadonlyArray;\n\nexport type KeyFieldsContext = {\n // The __typename of the incoming object, even if the __typename field was\n // aliased to another name in the raw result object. May be undefined when\n // dataIdFromObject is called for objects without __typename fields.\n typename: string | undefined;\n\n // The object to be identified, after processing to remove aliases and\n // normalize identifiable child objects with references.\n storeObject: StoreObject;\n\n // Handy tool for reading additional fields from context.storeObject, either\n // readField(\"fieldName\") to read storeObject[fieldName], or readField(\"name\",\n // objectOrReference) to read from another object or Reference. If you read a\n // field with a read function, that function will be invoked.\n readField: ReadFieldFunction;\n\n // If you are writing a custom keyFields function, and you plan to use the raw\n // result object passed as the first argument, you may also need access to the\n // selection set and available fragments for this object, just in case any\n // fields have aliases. Since this logic is tricky to get right, and these\n // context properties are not even always provided (for example, they are\n // omitted when calling cache.identify(object), where object is assumed to be\n // a StoreObject), we recommend you use context.storeObject (which has already\n // been de-aliased) and context.readField (which can read from references as\n // well as objects) instead of the raw result object in your keyFields\n // functions, or just rely on the internal implementation of keyFields:[...]\n // syntax to get these details right for you.\n selectionSet?: SelectionSetNode;\n fragmentMap?: FragmentMap;\n\n // Internal. May be set by the KeyFieldsFunction to report fields that were\n // involved in computing the ID. Never passed in by the caller.\n keyObject?: Record;\n};\n\nexport type KeyFieldsFunction = (\n object: Readonly,\n context: KeyFieldsContext\n) => KeySpecifier | false | ReturnType;\n\ntype KeyFieldsResult = Exclude, KeySpecifier>;\n\n// TODO Should TypePolicy be a generic type, with a TObject or TEntity\n// type parameter?\nexport type TypePolicy = {\n // Allows defining the primary key fields for this type, either using an\n // array of field names or a function that returns an arbitrary string.\n keyFields?: KeySpecifier | KeyFieldsFunction | false;\n\n // Allows defining a merge function (or merge:true/false shorthand) to\n // be used for merging objects of this type wherever they appear, unless\n // the parent field also defines a merge function/boolean (that is,\n // parent field merge functions take precedence over type policy merge\n // functions). In many cases, defining merge:true for a given type\n // policy can save you from specifying merge:true for all the field\n // policies where that type might be encountered.\n merge?: FieldMergeFunction | boolean;\n\n // In the rare event that your schema happens to use a different\n // __typename for the root Query, Mutation, and/or Schema types, you can\n // express your deviant preferences by enabling one of these options.\n queryType?: true;\n mutationType?: true;\n subscriptionType?: true;\n\n fields?: {\n [fieldName: string]: FieldPolicy | FieldReadFunction;\n };\n};\n\nexport type KeyArgsFunction = (\n args: Record | null,\n context: {\n typename: string;\n fieldName: string;\n field: FieldNode | null;\n variables?: Record;\n }\n) => KeySpecifier | false | ReturnType;\n\nexport type FieldPolicy<\n // The internal representation used to store the field's data in the\n // cache. Must be JSON-serializable if you plan to serialize the result\n // of cache.extract() using JSON.\n TExisting = any,\n // The type of the incoming parameter passed to the merge function,\n // typically matching the GraphQL response format, but with Reference\n // objects substituted for any identifiable child objects. Often the\n // same as TExisting, but not necessarily.\n TIncoming = TExisting,\n // The type that the read function actually returns, using TExisting\n // data and options.args as input. Usually the same as TIncoming.\n TReadResult = TIncoming,\n // Allows FieldFunctionOptions definition to be overwritten by the\n // developer\n TOptions extends FieldFunctionOptions = FieldFunctionOptions,\n> = {\n keyArgs?: KeySpecifier | KeyArgsFunction | false;\n read?: FieldReadFunction;\n merge?: FieldMergeFunction | boolean;\n};\n\nexport type StorageType = Record;\n\nfunction argsFromFieldSpecifier(spec: FieldSpecifier) {\n return (\n spec.args !== void 0 ? spec.args\n : spec.field ? argumentsObjectFromField(spec.field, spec.variables)\n : null\n );\n}\n\nexport interface FieldFunctionOptions<\n TArgs = Record,\n TVars = Record,\n> {\n args: TArgs | null;\n\n // The name of the field, equal to options.field.name.value when\n // options.field is available. Useful if you reuse the same function for\n // multiple fields, and you need to know which field you're currently\n // processing. Always a string, even when options.field is null.\n fieldName: string;\n\n // The full field key used internally, including serialized key arguments.\n storeFieldName: string;\n\n // The FieldNode object used to read this field. Useful if you need to\n // know about other attributes of the field, such as its directives. This\n // option will be null when a string was passed to options.readField.\n field: FieldNode | null;\n\n variables?: TVars;\n\n // Utilities for dealing with { __ref } objects.\n isReference: typeof isReference;\n toReference: ToReferenceFunction;\n\n // A handy place to put field-specific data that you want to survive\n // across multiple read function calls. Useful for field-level caching,\n // if your read function does any expensive work.\n storage: StorageType;\n\n cache: InMemoryCache;\n\n // Helper function for reading other fields within the current object.\n // If a foreign object or reference is provided, the field will be read\n // from that object instead of the current object, so this function can\n // be used (together with isReference) to examine the cache outside the\n // current object. If a FieldNode is passed instead of a string, and\n // that FieldNode has arguments, the same options.variables will be used\n // to compute the argument values. Note that this function will invoke\n // custom read functions for other fields, if defined. Always returns\n // immutable data (enforced with Object.freeze in development).\n readField: ReadFieldFunction;\n\n // Returns true for non-normalized StoreObjects and non-dangling\n // References, indicating that readField(name, objOrRef) has a chance of\n // working. Useful for filtering out dangling references from lists.\n canRead: CanReadFunction;\n\n // Instead of just merging objects with { ...existing, ...incoming }, this\n // helper function can be used to merge objects in a way that respects any\n // custom merge functions defined for their fields.\n mergeObjects: MergeObjectsFunction;\n}\n\ntype MergeObjectsFunction = (\n existing: T,\n incoming: T\n) => T;\n\nexport type FieldReadFunction<\n TExisting = any,\n TReadResult = TExisting,\n TOptions extends FieldFunctionOptions = FieldFunctionOptions,\n> = (\n // When reading a field, one often needs to know about any existing\n // value stored for that field. If the field is read before any value\n // has been written to the cache, this existing parameter will be\n // undefined, which makes it easy to use a default parameter expression\n // to supply the initial value. This parameter is positional (rather\n // than one of the named options) because that makes it possible for the\n // developer to annotate it with a type, without also having to provide\n // a whole new type for the options object.\n existing: SafeReadonly | undefined,\n options: TOptions\n) => TReadResult | undefined;\n\nexport type FieldMergeFunction<\n TExisting = any,\n TIncoming = TExisting,\n // Passing the whole FieldFunctionOptions makes the current definition\n // independent from its implementation\n TOptions extends FieldFunctionOptions = FieldFunctionOptions,\n> = (\n existing: SafeReadonly | undefined,\n // The incoming parameter needs to be positional as well, for the same\n // reasons discussed in FieldReadFunction above.\n incoming: SafeReadonly,\n options: TOptions\n) => SafeReadonly;\n\nconst nullKeyFieldsFn: KeyFieldsFunction = () => void 0;\nconst simpleKeyArgsFn: KeyArgsFunction = (_args, context) => context.fieldName;\n\n// These merge functions can be selected by specifying merge:true or\n// merge:false in a field policy.\nconst mergeTrueFn: FieldMergeFunction = (\n existing,\n incoming,\n { mergeObjects }\n) => mergeObjects(existing, incoming);\nconst mergeFalseFn: FieldMergeFunction = (_, incoming) => incoming;\n\nexport type PossibleTypesMap = {\n [supertype: string]: string[];\n};\n\nexport class Policies {\n private typePolicies: {\n [__typename: string]: {\n keyFn?: KeyFieldsFunction;\n merge?: FieldMergeFunction;\n fields: {\n [fieldName: string]: {\n keyFn?: KeyArgsFunction;\n read?: FieldReadFunction;\n merge?: FieldMergeFunction;\n };\n };\n };\n } = Object.create(null);\n\n private toBeAdded: {\n [__typename: string]: TypePolicy[];\n } = Object.create(null);\n\n // Map from subtype names to sets of supertype names. Note that this\n // representation inverts the structure of possibleTypes (whose keys are\n // supertypes and whose values are arrays of subtypes) because it tends\n // to be much more efficient to search upwards than downwards.\n private supertypeMap = new Map>();\n\n // Any fuzzy subtypes specified by possibleTypes will be converted to\n // RegExp objects and recorded here. Every key of this map can also be\n // found in supertypeMap. In many cases this Map will be empty, which\n // means no fuzzy subtype checking will happen in fragmentMatches.\n private fuzzySubtypes = new Map();\n\n public readonly cache: InMemoryCache;\n\n public readonly rootIdsByTypename: Record =\n Object.create(null);\n public readonly rootTypenamesById: Record =\n Object.create(null);\n\n public readonly usingPossibleTypes = false;\n\n constructor(\n private config: {\n cache: InMemoryCache;\n dataIdFromObject?: KeyFieldsFunction;\n possibleTypes?: PossibleTypesMap;\n typePolicies?: TypePolicies;\n }\n ) {\n this.config = {\n dataIdFromObject: defaultDataIdFromObject,\n ...config,\n };\n\n this.cache = this.config.cache;\n\n this.setRootTypename(\"Query\");\n this.setRootTypename(\"Mutation\");\n this.setRootTypename(\"Subscription\");\n\n if (config.possibleTypes) {\n this.addPossibleTypes(config.possibleTypes);\n }\n\n if (config.typePolicies) {\n this.addTypePolicies(config.typePolicies);\n }\n }\n\n public identify(\n object: StoreObject,\n partialContext?: Partial\n ): [string?, StoreObject?] {\n const policies = this;\n\n const typename =\n (partialContext &&\n (partialContext.typename || partialContext.storeObject?.__typename)) ||\n object.__typename;\n\n // It should be possible to write root Query fields with writeFragment,\n // using { __typename: \"Query\", ... } as the data, but it does not make\n // sense to allow the same identification behavior for the Mutation and\n // Subscription types, since application code should never be writing\n // directly to (or reading directly from) those root objects.\n if (typename === this.rootTypenamesById.ROOT_QUERY) {\n return [\"ROOT_QUERY\"];\n }\n\n // Default context.storeObject to object if not otherwise provided.\n const storeObject =\n (partialContext && partialContext.storeObject) || object;\n\n const context: KeyFieldsContext = {\n ...partialContext,\n typename,\n storeObject,\n readField:\n (partialContext && partialContext.readField) ||\n function () {\n const options = normalizeReadFieldOptions(arguments, storeObject);\n return policies.readField(options, {\n store: policies.cache[\"data\"],\n variables: options.variables,\n });\n },\n };\n\n let id: KeyFieldsResult;\n\n const policy = typename && this.getTypePolicy(typename);\n let keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject;\n while (keyFn) {\n const specifierOrId = keyFn({ ...object, ...storeObject }, context);\n if (isArray(specifierOrId)) {\n keyFn = keyFieldsFnFromSpecifier(specifierOrId);\n } else {\n id = specifierOrId;\n break;\n }\n }\n\n id = id ? String(id) : void 0;\n return context.keyObject ? [id, context.keyObject] : [id];\n }\n\n public addTypePolicies(typePolicies: TypePolicies) {\n Object.keys(typePolicies).forEach((typename) => {\n const { queryType, mutationType, subscriptionType, ...incoming } =\n typePolicies[typename];\n\n // Though {query,mutation,subscription}Type configurations are rare,\n // it's important to call setRootTypename as early as possible,\n // since these configurations should apply consistently for the\n // entire lifetime of the cache. Also, since only one __typename can\n // qualify as one of these root types, these three properties cannot\n // be inherited, unlike the rest of the incoming properties. That\n // restriction is convenient, because the purpose of this.toBeAdded\n // is to delay the processing of type/field policies until the first\n // time they're used, allowing policies to be added in any order as\n // long as all relevant policies (including policies for supertypes)\n // have been added by the time a given policy is used for the first\n // time. In other words, since inheritance doesn't matter for these\n // properties, there's also no need to delay their processing using\n // the this.toBeAdded queue.\n if (queryType) this.setRootTypename(\"Query\", typename);\n if (mutationType) this.setRootTypename(\"Mutation\", typename);\n if (subscriptionType) this.setRootTypename(\"Subscription\", typename);\n\n if (hasOwn.call(this.toBeAdded, typename)) {\n this.toBeAdded[typename].push(incoming);\n } else {\n this.toBeAdded[typename] = [incoming];\n }\n });\n }\n\n private updateTypePolicy(typename: string, incoming: TypePolicy) {\n const existing = this.getTypePolicy(typename);\n const { keyFields, fields } = incoming;\n\n function setMerge(\n existing: { merge?: FieldMergeFunction | boolean },\n merge?: FieldMergeFunction | boolean\n ) {\n existing.merge =\n typeof merge === \"function\" ? merge\n // Pass merge:true as a shorthand for a merge implementation\n // that returns options.mergeObjects(existing, incoming).\n : merge === true ? mergeTrueFn\n // Pass merge:false to make incoming always replace existing\n // without any warnings about data clobbering.\n : merge === false ? mergeFalseFn\n : existing.merge;\n }\n\n // Type policies can define merge functions, as an alternative to\n // using field policies to merge child objects.\n setMerge(existing, incoming.merge);\n\n existing.keyFn =\n // Pass false to disable normalization for this typename.\n keyFields === false ? nullKeyFieldsFn\n // Pass an array of strings to use those fields to compute a\n // composite ID for objects of this typename.\n : isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields)\n // Pass a function to take full control over identification.\n : typeof keyFields === \"function\" ? keyFields\n // Leave existing.keyFn unchanged if above cases fail.\n : existing.keyFn;\n\n if (fields) {\n Object.keys(fields).forEach((fieldName) => {\n const existing = this.getFieldPolicy(typename, fieldName, true)!;\n const incoming = fields[fieldName];\n\n if (typeof incoming === \"function\") {\n existing.read = incoming;\n } else {\n const { keyArgs, read, merge } = incoming;\n\n existing.keyFn =\n // Pass false to disable argument-based differentiation of\n // field identities.\n keyArgs === false ? simpleKeyArgsFn\n // Pass an array of strings to use named arguments to\n // compute a composite identity for the field.\n : isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs)\n // Pass a function to take full control over field identity.\n : typeof keyArgs === \"function\" ? keyArgs\n // Leave existing.keyFn unchanged if above cases fail.\n : existing.keyFn;\n\n if (typeof read === \"function\") {\n existing.read = read;\n }\n\n setMerge(existing, merge);\n }\n\n if (existing.read && existing.merge) {\n // If we have both a read and a merge function, assume\n // keyArgs:false, because read and merge together can take\n // responsibility for interpreting arguments in and out. This\n // default assumption can always be overridden by specifying\n // keyArgs explicitly in the FieldPolicy.\n existing.keyFn = existing.keyFn || simpleKeyArgsFn;\n }\n });\n }\n }\n\n private setRootTypename(\n which: \"Query\" | \"Mutation\" | \"Subscription\",\n typename: string = which\n ) {\n const rootId = \"ROOT_\" + which.toUpperCase();\n const old = this.rootTypenamesById[rootId];\n if (typename !== old) {\n invariant(\n !old || old === which,\n `Cannot change root %s __typename more than once`,\n which\n );\n // First, delete any old __typename associated with this rootId from\n // rootIdsByTypename.\n if (old) delete this.rootIdsByTypename[old];\n // Now make this the only __typename that maps to this rootId.\n this.rootIdsByTypename[typename] = rootId;\n // Finally, update the __typename associated with this rootId.\n this.rootTypenamesById[rootId] = typename;\n }\n }\n\n public addPossibleTypes(possibleTypes: PossibleTypesMap) {\n (this.usingPossibleTypes as boolean) = true;\n Object.keys(possibleTypes).forEach((supertype) => {\n // Make sure all types have an entry in this.supertypeMap, even if\n // their supertype set is empty, so we can return false immediately\n // from policies.fragmentMatches for unknown supertypes.\n this.getSupertypeSet(supertype, true);\n\n possibleTypes[supertype].forEach((subtype) => {\n this.getSupertypeSet(subtype, true)!.add(supertype);\n const match = subtype.match(TypeOrFieldNameRegExp);\n if (!match || match[0] !== subtype) {\n // TODO Don't interpret just any invalid typename as a RegExp.\n this.fuzzySubtypes.set(subtype, new RegExp(subtype));\n }\n });\n });\n }\n\n private getTypePolicy(typename: string): Policies[\"typePolicies\"][string] {\n if (!hasOwn.call(this.typePolicies, typename)) {\n const policy: Policies[\"typePolicies\"][string] = (this.typePolicies[\n typename\n ] = Object.create(null));\n policy.fields = Object.create(null);\n\n // When the TypePolicy for typename is first accessed, instead of\n // starting with an empty policy object, inherit any properties or\n // fields from the type policies of the supertypes of typename.\n //\n // Any properties or fields defined explicitly within the TypePolicy\n // for typename will take precedence, and if there are multiple\n // supertypes, the properties of policies whose types were added\n // later via addPossibleTypes will take precedence over those of\n // earlier supertypes. TODO Perhaps we should warn about these\n // conflicts in development, and recommend defining the property\n // explicitly in the subtype policy?\n //\n // Field policy inheritance is atomic/shallow: you can't inherit a\n // field policy and then override just its read function, since read\n // and merge functions often need to cooperate, so changing only one\n // of them would be a recipe for inconsistency.\n //\n // Once the TypePolicy for typename has been accessed, its properties can\n // still be updated directly using addTypePolicies, but future changes to\n // inherited supertype policies will not be reflected in this subtype\n // policy, because this code runs at most once per typename.\n let supertypes = this.supertypeMap.get(typename);\n if (!supertypes && this.fuzzySubtypes.size) {\n // To make the inheritance logic work for unknown typename strings that\n // may have fuzzy supertypes, we give this typename an empty supertype\n // set and then populate it with any fuzzy supertypes that match.\n supertypes = this.getSupertypeSet(typename, true)!;\n // This only works for typenames that are directly matched by a fuzzy\n // supertype. What if there is an intermediate chain of supertypes?\n // While possible, that situation can only be solved effectively by\n // specifying the intermediate relationships via possibleTypes, manually\n // and in a non-fuzzy way.\n this.fuzzySubtypes.forEach((regExp, fuzzy) => {\n if (regExp.test(typename)) {\n // The fuzzy parameter is just the original string version of regExp\n // (not a valid __typename string), but we can look up the\n // associated supertype(s) in this.supertypeMap.\n const fuzzySupertypes = this.supertypeMap.get(fuzzy);\n if (fuzzySupertypes) {\n fuzzySupertypes.forEach((supertype) =>\n supertypes!.add(supertype)\n );\n }\n }\n });\n }\n if (supertypes && supertypes.size) {\n supertypes.forEach((supertype) => {\n const { fields, ...rest } = this.getTypePolicy(supertype);\n Object.assign(policy, rest);\n Object.assign(policy.fields, fields);\n });\n }\n }\n\n const inbox = this.toBeAdded[typename];\n if (inbox && inbox.length) {\n // Merge the pending policies into this.typePolicies, in the order they\n // were originally passed to addTypePolicy.\n inbox.splice(0).forEach((policy) => {\n this.updateTypePolicy(typename, policy);\n });\n }\n\n return this.typePolicies[typename];\n }\n\n private getFieldPolicy(\n typename: string | undefined,\n fieldName: string,\n createIfMissing: boolean\n ):\n | {\n keyFn?: KeyArgsFunction;\n read?: FieldReadFunction;\n merge?: FieldMergeFunction;\n }\n | undefined {\n if (typename) {\n const fieldPolicies = this.getTypePolicy(typename).fields;\n return (\n fieldPolicies[fieldName] ||\n (createIfMissing && (fieldPolicies[fieldName] = Object.create(null)))\n );\n }\n }\n\n private getSupertypeSet(\n subtype: string,\n createIfMissing: boolean\n ): Set | undefined {\n let supertypeSet = this.supertypeMap.get(subtype);\n if (!supertypeSet && createIfMissing) {\n this.supertypeMap.set(subtype, (supertypeSet = new Set()));\n }\n return supertypeSet;\n }\n\n public fragmentMatches(\n fragment: InlineFragmentNode | FragmentDefinitionNode,\n typename: string | undefined,\n result?: Record,\n variables?: Record\n ): boolean {\n if (!fragment.typeCondition) return true;\n\n // If the fragment has a type condition but the object we're matching\n // against does not have a __typename, the fragment cannot match.\n if (!typename) return false;\n\n const supertype = fragment.typeCondition.name.value;\n // Common case: fragment type condition and __typename are the same.\n if (typename === supertype) return true;\n\n if (this.usingPossibleTypes && this.supertypeMap.has(supertype)) {\n const typenameSupertypeSet = this.getSupertypeSet(typename, true)!;\n const workQueue = [typenameSupertypeSet];\n const maybeEnqueue = (subtype: string) => {\n const supertypeSet = this.getSupertypeSet(subtype, false);\n if (\n supertypeSet &&\n supertypeSet.size &&\n workQueue.indexOf(supertypeSet) < 0\n ) {\n workQueue.push(supertypeSet);\n }\n };\n\n // We need to check fuzzy subtypes only if we encountered fuzzy\n // subtype strings in addPossibleTypes, and only while writing to\n // the cache, since that's when selectionSetMatchesResult gives a\n // strong signal of fragment matching. The StoreReader class calls\n // policies.fragmentMatches without passing a result object, so\n // needToCheckFuzzySubtypes is always false while reading.\n let needToCheckFuzzySubtypes = !!(result && this.fuzzySubtypes.size);\n let checkingFuzzySubtypes = false;\n\n // It's important to keep evaluating workQueue.length each time through\n // the loop, because the queue can grow while we're iterating over it.\n for (let i = 0; i < workQueue.length; ++i) {\n const supertypeSet = workQueue[i];\n\n if (supertypeSet.has(supertype)) {\n if (!typenameSupertypeSet.has(supertype)) {\n if (checkingFuzzySubtypes) {\n invariant.warn(\n `Inferring subtype %s of supertype %s`,\n typename,\n supertype\n );\n }\n // Record positive results for faster future lookup.\n // Unfortunately, we cannot safely cache negative results,\n // because new possibleTypes data could always be added to the\n // Policies class.\n typenameSupertypeSet.add(supertype);\n }\n return true;\n }\n\n supertypeSet.forEach(maybeEnqueue);\n\n if (\n needToCheckFuzzySubtypes &&\n // Start checking fuzzy subtypes only after exhausting all\n // non-fuzzy subtypes (after the final iteration of the loop).\n i === workQueue.length - 1 &&\n // We could wait to compare fragment.selectionSet to result\n // after we verify the supertype, but this check is often less\n // expensive than that search, and we will have to do the\n // comparison anyway whenever we find a potential match.\n selectionSetMatchesResult(fragment.selectionSet, result!, variables)\n ) {\n // We don't always need to check fuzzy subtypes (if no result\n // was provided, or !this.fuzzySubtypes.size), but, when we do,\n // we only want to check them once.\n needToCheckFuzzySubtypes = false;\n checkingFuzzySubtypes = true;\n\n // If we find any fuzzy subtypes that match typename, extend the\n // workQueue to search through the supertypes of those fuzzy\n // subtypes. Otherwise the for-loop will terminate and we'll\n // return false below.\n this.fuzzySubtypes.forEach((regExp, fuzzyString) => {\n const match = typename.match(regExp);\n if (match && match[0] === typename) {\n maybeEnqueue(fuzzyString);\n }\n });\n }\n }\n }\n\n return false;\n }\n\n public hasKeyArgs(typename: string | undefined, fieldName: string) {\n const policy = this.getFieldPolicy(typename, fieldName, false);\n return !!(policy && policy.keyFn);\n }\n\n public getStoreFieldName(fieldSpec: FieldSpecifier): string {\n const { typename, fieldName } = fieldSpec;\n const policy = this.getFieldPolicy(typename, fieldName, false);\n let storeFieldName: Exclude, KeySpecifier>;\n\n let keyFn = policy && policy.keyFn;\n if (keyFn && typename) {\n const context: Parameters[1] = {\n typename,\n fieldName,\n field: fieldSpec.field || null,\n variables: fieldSpec.variables,\n };\n const args = argsFromFieldSpecifier(fieldSpec);\n while (keyFn) {\n const specifierOrString = keyFn(args, context);\n if (isArray(specifierOrString)) {\n keyFn = keyArgsFnFromSpecifier(specifierOrString);\n } else {\n // If the custom keyFn returns a falsy value, fall back to\n // fieldName instead.\n storeFieldName = specifierOrString || fieldName;\n break;\n }\n }\n }\n\n if (storeFieldName === void 0) {\n storeFieldName =\n fieldSpec.field ?\n storeKeyNameFromField(fieldSpec.field, fieldSpec.variables)\n : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec));\n }\n\n // Returning false from a keyArgs function is like configuring\n // keyArgs: false, but more dynamic.\n if (storeFieldName === false) {\n return fieldName;\n }\n\n // Make sure custom field names start with the actual field.name.value\n // of the field, so we can always figure out which properties of a\n // StoreObject correspond to which original field names.\n return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName\n : fieldName + \":\" + storeFieldName;\n }\n\n public readField(\n options: ReadFieldOptions,\n context: ReadMergeModifyContext\n ): SafeReadonly | undefined {\n const objectOrReference = options.from;\n if (!objectOrReference) return;\n\n const nameOrField = options.field || options.fieldName;\n if (!nameOrField) return;\n\n if (options.typename === void 0) {\n const typename = context.store.getFieldValue(\n objectOrReference,\n \"__typename\"\n );\n if (typename) options.typename = typename;\n }\n\n const storeFieldName = this.getStoreFieldName(options);\n const fieldName = fieldNameFromStoreName(storeFieldName);\n const existing = context.store.getFieldValue(\n objectOrReference,\n storeFieldName\n );\n const policy = this.getFieldPolicy(options.typename, fieldName, false);\n const read = policy && policy.read;\n\n if (read) {\n const readOptions = makeFieldFunctionOptions(\n this,\n objectOrReference,\n options,\n context,\n context.store.getStorage(\n isReference(objectOrReference) ?\n objectOrReference.__ref\n : objectOrReference,\n storeFieldName\n )\n );\n\n // Call read(existing, readOptions) with cacheSlot holding this.cache.\n return cacheSlot.withValue(this.cache, read, [\n existing,\n readOptions,\n ]) as SafeReadonly;\n }\n\n return existing;\n }\n\n public getReadFunction(\n typename: string | undefined,\n fieldName: string\n ): FieldReadFunction | undefined {\n const policy = this.getFieldPolicy(typename, fieldName, false);\n return policy && policy.read;\n }\n\n public getMergeFunction(\n parentTypename: string | undefined,\n fieldName: string,\n childTypename: string | undefined\n ): FieldMergeFunction | undefined {\n let policy:\n | Policies[\"typePolicies\"][string]\n | Policies[\"typePolicies\"][string][\"fields\"][string]\n | undefined = this.getFieldPolicy(parentTypename, fieldName, false);\n let merge = policy && policy.merge;\n if (!merge && childTypename) {\n policy = this.getTypePolicy(childTypename);\n merge = policy && policy.merge;\n }\n return merge;\n }\n\n public runMergeFunction(\n existing: StoreValue,\n incoming: StoreValue,\n { field, typename, merge }: MergeInfo,\n context: WriteContext,\n storage?: StorageType\n ) {\n if (merge === mergeTrueFn) {\n // Instead of going to the trouble of creating a full\n // FieldFunctionOptions object and calling mergeTrueFn, we can\n // simply call mergeObjects, as mergeTrueFn would.\n return makeMergeObjectsFunction(context.store)(\n existing as StoreObject,\n incoming as StoreObject\n );\n }\n\n if (merge === mergeFalseFn) {\n // Likewise for mergeFalseFn, whose implementation is even simpler.\n return incoming;\n }\n\n // If cache.writeQuery or cache.writeFragment was called with\n // options.overwrite set to true, we still call merge functions, but\n // the existing data is always undefined, so the merge function will\n // not attempt to combine the incoming data with the existing data.\n if (context.overwrite) {\n existing = void 0;\n }\n\n return merge(\n existing,\n incoming,\n makeFieldFunctionOptions(\n this,\n // Unlike options.readField for read functions, we do not fall\n // back to the current object if no foreignObjOrRef is provided,\n // because it's not clear what the current object should be for\n // merge functions: the (possibly undefined) existing object, or\n // the incoming object? If you think your merge function needs\n // to read sibling fields in order to produce a new value for\n // the current field, you might want to rethink your strategy,\n // because that's a recipe for making merge behavior sensitive\n // to the order in which fields are written into the cache.\n // However, readField(name, ref) is useful for merge functions\n // that need to deduplicate child objects and references.\n void 0,\n {\n typename,\n fieldName: field.name.value,\n field,\n variables: context.variables,\n },\n context,\n storage || Object.create(null)\n )\n );\n }\n}\n\nfunction makeFieldFunctionOptions(\n policies: Policies,\n objectOrReference: StoreObject | Reference | undefined,\n fieldSpec: FieldSpecifier,\n context: ReadMergeModifyContext,\n storage: StorageType\n): FieldFunctionOptions {\n const storeFieldName = policies.getStoreFieldName(fieldSpec);\n const fieldName = fieldNameFromStoreName(storeFieldName);\n const variables = fieldSpec.variables || context.variables;\n const { toReference, canRead } = context.store;\n\n return {\n args: argsFromFieldSpecifier(fieldSpec),\n field: fieldSpec.field || null,\n fieldName,\n storeFieldName,\n variables,\n isReference,\n toReference,\n storage,\n cache: policies.cache,\n canRead,\n readField() {\n return policies.readField(\n normalizeReadFieldOptions(arguments, objectOrReference, variables),\n context\n );\n },\n mergeObjects: makeMergeObjectsFunction(context.store),\n };\n}\n\nexport function normalizeReadFieldOptions(\n readFieldArgs: IArguments,\n objectOrReference: StoreObject | Reference | undefined,\n variables?: ReadMergeModifyContext[\"variables\"]\n): ReadFieldOptions {\n const { 0: fieldNameOrOptions, 1: from, length: argc } = readFieldArgs;\n\n let options: ReadFieldOptions;\n\n if (typeof fieldNameOrOptions === \"string\") {\n options = {\n fieldName: fieldNameOrOptions,\n // Default to objectOrReference only when no second argument was\n // passed for the from parameter, not when undefined is explicitly\n // passed as the second argument.\n from: argc > 1 ? from : objectOrReference,\n };\n } else {\n options = { ...fieldNameOrOptions };\n // Default to objectOrReference only when fieldNameOrOptions.from is\n // actually omitted, rather than just undefined.\n if (!hasOwn.call(options, \"from\")) {\n options.from = objectOrReference;\n }\n }\n\n if (__DEV__ && options.from === void 0) {\n invariant.warn(\n `Undefined 'from' passed to readField with arguments %s`,\n stringifyForDisplay(Array.from(readFieldArgs))\n );\n }\n\n if (void 0 === options.variables) {\n options.variables = variables;\n }\n\n return options;\n}\n\nfunction makeMergeObjectsFunction(\n store: NormalizedCache\n): MergeObjectsFunction {\n return function mergeObjects(existing, incoming) {\n if (isArray(existing) || isArray(incoming)) {\n throw newInvariantError(\"Cannot automatically merge arrays\");\n }\n\n // These dynamic checks are necessary because the parameters of a\n // custom merge function can easily have the any type, so the type\n // system cannot always enforce the StoreObject | Reference parameter\n // types of options.mergeObjects.\n if (isNonNullObject(existing) && isNonNullObject(incoming)) {\n const eType = store.getFieldValue(existing, \"__typename\");\n const iType = store.getFieldValue(incoming, \"__typename\");\n const typesDiffer = eType && iType && eType !== iType;\n\n if (typesDiffer) {\n return incoming;\n }\n\n if (isReference(existing) && storeValueIsStoreObject(incoming)) {\n // Update the normalized EntityStore for the entity identified by\n // existing.__ref, preferring/overwriting any fields contributed by the\n // newer incoming StoreObject.\n store.merge(existing.__ref, incoming);\n return existing;\n }\n\n if (storeValueIsStoreObject(existing) && isReference(incoming)) {\n // Update the normalized EntityStore for the entity identified by\n // incoming.__ref, taking fields from the older existing object only if\n // those fields are not already present in the newer StoreObject\n // identified by incoming.__ref.\n store.merge(existing, incoming.__ref);\n return incoming;\n }\n\n if (\n storeValueIsStoreObject(existing) &&\n storeValueIsStoreObject(incoming)\n ) {\n return { ...existing, ...incoming };\n }\n }\n\n return incoming;\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.d.ts new file mode 100644 index 0000000..ae52d20 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.d.ts @@ -0,0 +1,18 @@ +import type { ApolloCache } from "../../core/index.js"; +export interface ReactiveVar { + (newValue?: T): T; + onNextChange(listener: ReactiveListener): () => void; + attachCache(cache: ApolloCache): this; + forgetCache(cache: ApolloCache): boolean; +} +export type ReactiveListener = (value: T) => any; +export declare const cacheSlot: { + readonly id: string; + hasValue(): boolean; + getValue(): ApolloCache | undefined; + withValue(value: ApolloCache, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult; +}; +export declare function forgetCache(cache: ApolloCache): void; +export declare function recallCache(cache: ApolloCache): void; +export declare function makeVar(value: T): ReactiveVar; +//# sourceMappingURL=reactiveVars.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js new file mode 100644 index 0000000..db01a8a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js @@ -0,0 +1,83 @@ +import { dep, Slot } from "optimism"; +// Contextual Slot that acquires its value when custom read functions are +// called in Policies#readField. +export var cacheSlot = new Slot(); +var cacheInfoMap = new WeakMap(); +function getCacheInfo(cache) { + var info = cacheInfoMap.get(cache); + if (!info) { + cacheInfoMap.set(cache, (info = { + vars: new Set(), + dep: dep(), + })); + } + return info; +} +export function forgetCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.forgetCache(cache); }); +} +// Calling forgetCache(cache) serves to silence broadcasts and allows the +// cache to be garbage collected. However, the varsByCache WeakMap +// preserves the set of reactive variables that were previously associated +// with this cache, which makes it possible to "recall" the cache at a +// later time, by reattaching it to those variables. If the cache has been +// garbage collected in the meantime, because it is no longer reachable, +// you won't be able to call recallCache(cache), and the cache will +// automatically disappear from the varsByCache WeakMap. +export function recallCache(cache) { + getCacheInfo(cache).vars.forEach(function (rv) { return rv.attachCache(cache); }); +} +export function makeVar(value) { + var caches = new Set(); + var listeners = new Set(); + var rv = function (newValue) { + if (arguments.length > 0) { + if (value !== newValue) { + value = newValue; + caches.forEach(function (cache) { + // Invalidate any fields with custom read functions that + // consumed this variable, so query results involving those + // fields will be recomputed the next time we read them. + getCacheInfo(cache).dep.dirty(rv); + // Broadcast changes to any caches that have previously read + // from this variable. + broadcast(cache); + }); + // Finally, notify any listeners added via rv.onNextChange. + var oldListeners = Array.from(listeners); + listeners.clear(); + oldListeners.forEach(function (listener) { return listener(value); }); + } + } + else { + // When reading from the variable, obtain the current cache from + // context via cacheSlot. This isn't entirely foolproof, but it's + // the same system that powers varDep. + var cache = cacheSlot.getValue(); + if (cache) { + attach(cache); + getCacheInfo(cache).dep(rv); + } + } + return value; + }; + rv.onNextChange = function (listener) { + listeners.add(listener); + return function () { + listeners.delete(listener); + }; + }; + var attach = (rv.attachCache = function (cache) { + caches.add(cache); + getCacheInfo(cache).vars.add(rv); + return rv; + }); + rv.forgetCache = function (cache) { return caches.delete(cache); }; + return rv; +} +function broadcast(cache) { + if (cache.broadcastWatches) { + cache.broadcastWatches(); + } +} +//# sourceMappingURL=reactiveVars.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js.map new file mode 100644 index 0000000..19275be --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/reactiveVars.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reactiveVars.js","sourceRoot":"","sources":["../../../src/cache/inmemory/reactiveVars.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAarC,yEAAyE;AACzE,gCAAgC;AAChC,MAAM,CAA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,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,WAAW,GAAG,UAAC,KAAK,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAApB,CAAoB,CAAC;IAEjD,OAAO,EAAE,CAAC;AACZ,CAAC;AAQD,SAAS,SAAS,CAAC,KAAoB;IACrC,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3B,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["import type { OptimisticDependencyFunction } from \"optimism\";\nimport { dep, Slot } from \"optimism\";\nimport type { InMemoryCache } from \"./inMemoryCache.js\";\nimport type { ApolloCache } from \"../../core/index.js\";\n\nexport interface ReactiveVar {\n (newValue?: T): T;\n onNextChange(listener: ReactiveListener): () => void;\n attachCache(cache: ApolloCache): this;\n forgetCache(cache: ApolloCache): boolean;\n}\n\nexport type ReactiveListener = (value: T) => any;\n\n// Contextual Slot that acquires its value when custom read functions are\n// called in Policies#readField.\nexport const cacheSlot = new Slot>();\n\nconst cacheInfoMap = new WeakMap<\n ApolloCache,\n {\n vars: Set>;\n dep: OptimisticDependencyFunction>;\n }\n>();\n\nfunction getCacheInfo(cache: ApolloCache) {\n let info = cacheInfoMap.get(cache)!;\n if (!info) {\n cacheInfoMap.set(\n cache,\n (info = {\n vars: new Set(),\n dep: dep(),\n })\n );\n }\n return info;\n}\n\nexport function forgetCache(cache: ApolloCache) {\n getCacheInfo(cache).vars.forEach((rv) => rv.forgetCache(cache));\n}\n\n// Calling forgetCache(cache) serves to silence broadcasts and allows the\n// cache to be garbage collected. However, the varsByCache WeakMap\n// preserves the set of reactive variables that were previously associated\n// with this cache, which makes it possible to \"recall\" the cache at a\n// later time, by reattaching it to those variables. If the cache has been\n// garbage collected in the meantime, because it is no longer reachable,\n// you won't be able to call recallCache(cache), and the cache will\n// automatically disappear from the varsByCache WeakMap.\nexport function recallCache(cache: ApolloCache) {\n getCacheInfo(cache).vars.forEach((rv) => rv.attachCache(cache));\n}\n\nexport function makeVar(value: T): ReactiveVar {\n const caches = new Set>();\n const listeners = new Set>();\n\n const rv: ReactiveVar = function (newValue) {\n if (arguments.length > 0) {\n if (value !== newValue) {\n value = newValue!;\n caches.forEach((cache) => {\n // Invalidate any fields with custom read functions that\n // consumed this variable, so query results involving those\n // fields will be recomputed the next time we read them.\n getCacheInfo(cache).dep.dirty(rv);\n // Broadcast changes to any caches that have previously read\n // from this variable.\n broadcast(cache);\n });\n // Finally, notify any listeners added via rv.onNextChange.\n const oldListeners = Array.from(listeners);\n listeners.clear();\n oldListeners.forEach((listener) => listener(value));\n }\n } else {\n // When reading from the variable, obtain the current cache from\n // context via cacheSlot. This isn't entirely foolproof, but it's\n // the same system that powers varDep.\n const cache = cacheSlot.getValue();\n if (cache) {\n attach(cache);\n getCacheInfo(cache).dep(rv);\n }\n }\n\n return value;\n };\n\n rv.onNextChange = (listener) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n };\n\n const attach = (rv.attachCache = (cache) => {\n caches.add(cache);\n getCacheInfo(cache).vars.add(rv);\n return rv;\n });\n\n rv.forgetCache = (cache) => caches.delete(cache);\n\n return rv;\n}\n\ntype Broadcastable = ApolloCache & {\n // This method is protected in InMemoryCache, which we are ignoring, but\n // we still want some semblance of type safety when we call it.\n broadcastWatches?: InMemoryCache[\"broadcastWatches\"];\n};\n\nfunction broadcast(cache: Broadcastable) {\n if (cache.broadcastWatches) {\n cache.broadcastWatches();\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.d.ts new file mode 100644 index 0000000..6d443c4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.d.ts @@ -0,0 +1,40 @@ +import type { SelectionSetNode } from "graphql"; +import type { Reference, StoreObject } from "../../utilities/index.js"; +import type { Cache } from "../core/types/Cache.js"; +import type { DiffQueryAgainstStoreOptions, InMemoryCacheConfig, ReadMergeModifyContext } from "./types.js"; +import type { InMemoryCache } from "./inMemoryCache.js"; +import type { MissingTree } from "../core/types/common.js"; +import { ObjectCanon } from "./object-canon.js"; +export type VariableMap = { + [name: string]: any; +}; +export type ExecResult = { + result: R; + missing?: MissingTree; +}; +export interface StoreReaderConfig { + cache: InMemoryCache; + addTypename?: boolean; + resultCacheMaxSize?: number; + canonizeResults?: boolean; + canon?: ObjectCanon; + fragments?: InMemoryCacheConfig["fragments"]; +} +export declare class StoreReader { + private executeSelectionSet; + private executeSubSelectedArray; + private config; + private knownResults; + canon: ObjectCanon; + resetCanon(): void; + constructor(config: StoreReaderConfig); + /** + * Given a store and a query, return as much of the result as possible and + * identify if any data was missing from the store. + */ + diffQueryAgainstStore({ store, query, rootId, variables, returnPartialData, canonizeResults, }: DiffQueryAgainstStoreOptions): Cache.DiffResult; + isFresh(result: Record, parent: StoreObject | Reference, selectionSet: SelectionSetNode, context: ReadMergeModifyContext): boolean; + private execSelectionSetImpl; + private execSubSelectedArrayImpl; +} +//# sourceMappingURL=readFromStore.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js new file mode 100644 index 0000000..056f1ec --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js @@ -0,0 +1,329 @@ +import { __assign } from "tslib"; +import { invariant, newInvariantError } from "../../utilities/globals/index.js"; +import { Kind } from "graphql"; +import { wrap } from "optimism"; +import { isField, resultKeyNameFromField, isReference, makeReference, shouldInclude, addTypenameToDocument, getDefaultValues, getMainDefinition, getQueryDefinition, getFragmentFromSelection, maybeDeepFreeze, mergeDeepArray, DeepMerger, isNonNullObject, canUseWeakMap, compact, canonicalStringify, cacheSizes, } from "../../utilities/index.js"; +import { maybeDependOnExistenceOfEntity, supportsResultCaching, } from "./entityStore.js"; +import { isArray, extractFragmentContext, getTypenameFromStoreObject, shouldCanonizeResults, } from "./helpers.js"; +import { MissingFieldError } from "../core/types/common.js"; +import { ObjectCanon } from "./object-canon.js"; +function execSelectionSetKeyArgs(options) { + return [ + options.selectionSet, + options.objectOrReference, + options.context, + // We split out this property so we can pass different values + // independently without modifying options.context itself. + options.context.canonizeResults, + ]; +} +var StoreReader = /** @class */ (function () { + function StoreReader(config) { + var _this = this; + this.knownResults = new (canUseWeakMap ? WeakMap : Map)(); + this.config = compact(config, { + addTypename: config.addTypename !== false, + canonizeResults: shouldCanonizeResults(config), + }); + this.canon = config.canon || new ObjectCanon(); + // memoized functions in this class will be "garbage-collected" + // by recreating the whole `StoreReader` in + // `InMemoryCache.resetResultsCache` + // (triggered from `InMemoryCache.gc` with `resetResultCache: true`) + this.executeSelectionSet = wrap(function (options) { + var _a; + var canonizeResults = options.context.canonizeResults; + var peekArgs = execSelectionSetKeyArgs(options); + // Negate this boolean option so we can find out if we've already read + // this result using the other boolean value. + peekArgs[3] = !canonizeResults; + var other = (_a = _this.executeSelectionSet).peek.apply(_a, peekArgs); + if (other) { + if (canonizeResults) { + return __assign(__assign({}, other), { + // If we previously read this result without canonizing it, we can + // reuse that result simply by canonizing it now. + result: _this.canon.admit(other.result) }); + } + // If we previously read this result with canonization enabled, we can + // return that canonized result as-is. + return other; + } + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + // Finally, if we didn't find any useful previous results, run the real + // execSelectionSetImpl method with the given options. + return _this.execSelectionSetImpl(options); + }, { + max: this.config.resultCacheMaxSize || + cacheSizes["inMemoryCache.executeSelectionSet"] || + 50000 /* defaultCacheSizes["inMemoryCache.executeSelectionSet"] */, + keyArgs: execSelectionSetKeyArgs, + // Note that the parameters of makeCacheKey are determined by the + // array returned by keyArgs. + makeCacheKey: function (selectionSet, parent, context, canonizeResults) { + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(selectionSet, isReference(parent) ? parent.__ref : parent, context.varString, canonizeResults); + } + }, + }); + this.executeSubSelectedArray = wrap(function (options) { + maybeDependOnExistenceOfEntity(options.context.store, options.enclosingRef.__ref); + return _this.execSubSelectedArrayImpl(options); + }, { + max: this.config.resultCacheMaxSize || + cacheSizes["inMemoryCache.executeSubSelectedArray"] || + 10000 /* defaultCacheSizes["inMemoryCache.executeSubSelectedArray"] */, + makeCacheKey: function (_a) { + var field = _a.field, array = _a.array, context = _a.context; + if (supportsResultCaching(context.store)) { + return context.store.makeCacheKey(field, array, context.varString); + } + }, + }); + } + StoreReader.prototype.resetCanon = function () { + this.canon = new ObjectCanon(); + }; + /** + * Given a store and a query, return as much of the result as possible and + * identify if any data was missing from the store. + */ + StoreReader.prototype.diffQueryAgainstStore = function (_a) { + var store = _a.store, query = _a.query, _b = _a.rootId, rootId = _b === void 0 ? "ROOT_QUERY" : _b, variables = _a.variables, _c = _a.returnPartialData, returnPartialData = _c === void 0 ? true : _c, _d = _a.canonizeResults, canonizeResults = _d === void 0 ? this.config.canonizeResults : _d; + var policies = this.config.cache.policies; + variables = __assign(__assign({}, getDefaultValues(getQueryDefinition(query))), variables); + var rootRef = makeReference(rootId); + var execResult = this.executeSelectionSet({ + selectionSet: getMainDefinition(query).selectionSet, + objectOrReference: rootRef, + enclosingRef: rootRef, + context: __assign({ store: store, query: query, policies: policies, variables: variables, varString: canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)), + }); + var missing; + if (execResult.missing) { + // For backwards compatibility we still report an array of + // MissingFieldError objects, even though there will only ever be at most + // one of them, now that all missing field error messages are grouped + // together in the execResult.missing tree. + missing = [ + new MissingFieldError(firstMissing(execResult.missing), execResult.missing, query, variables), + ]; + if (!returnPartialData) { + throw missing[0]; + } + } + return { + result: execResult.result, + complete: !missing, + missing: missing, + }; + }; + StoreReader.prototype.isFresh = function (result, parent, selectionSet, context) { + if (supportsResultCaching(context.store) && + this.knownResults.get(result) === selectionSet) { + var latest = this.executeSelectionSet.peek(selectionSet, parent, context, + // If result is canonical, then it could only have been previously + // cached by the canonizing version of executeSelectionSet, so we can + // avoid checking both possibilities here. + this.canon.isKnown(result)); + if (latest && result === latest.result) { + return true; + } + } + return false; + }; + // Uncached version of executeSelectionSet. + StoreReader.prototype.execSelectionSetImpl = function (_a) { + var _this = this; + var selectionSet = _a.selectionSet, objectOrReference = _a.objectOrReference, enclosingRef = _a.enclosingRef, context = _a.context; + if (isReference(objectOrReference) && + !context.policies.rootTypenamesById[objectOrReference.__ref] && + !context.store.has(objectOrReference.__ref)) { + return { + result: this.canon.empty, + missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"), + }; + } + var variables = context.variables, policies = context.policies, store = context.store; + var typename = store.getFieldValue(objectOrReference, "__typename"); + var objectsToMerge = []; + var missing; + var missingMerger = new DeepMerger(); + if (this.config.addTypename && + typeof typename === "string" && + !policies.rootIdsByTypename[typename]) { + // Ensure we always include a default value for the __typename + // field, if we have one, and this.config.addTypename is true. Note + // that this field can be overridden by other merged objects. + objectsToMerge.push({ __typename: typename }); + } + function handleMissing(result, resultName) { + var _a; + if (result.missing) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = result.missing, + _a)); + } + return result.result; + } + var workSet = new Set(selectionSet.selections); + workSet.forEach(function (selection) { + var _a, _b; + // Omit fields with directives @skip(if: ) or + // @include(if: ). + if (!shouldInclude(selection, variables)) + return; + if (isField(selection)) { + var fieldValue = policies.readField({ + fieldName: selection.name.value, + field: selection, + variables: context.variables, + from: objectOrReference, + }, context); + var resultName = resultKeyNameFromField(selection); + if (fieldValue === void 0) { + if (!addTypenameToDocument.added(selection)) { + missing = missingMerger.merge(missing, (_a = {}, + _a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference) ? + objectOrReference.__ref + " object" + : "object " + JSON.stringify(objectOrReference, null, 2)), + _a)); + } + } + else if (isArray(fieldValue)) { + fieldValue = handleMissing(_this.executeSubSelectedArray({ + field: selection, + array: fieldValue, + enclosingRef: enclosingRef, + context: context, + }), resultName); + } + else if (!selection.selectionSet) { + // If the field does not have a selection set, then we handle it + // as a scalar value. To keep this.canon from canonicalizing + // this value, we use this.canon.pass to wrap fieldValue in a + // Pass object that this.canon.admit will later unwrap as-is. + if (context.canonizeResults) { + fieldValue = _this.canon.pass(fieldValue); + } + } + else if (fieldValue != null) { + // In this case, because we know the field has a selection set, + // it must be trying to query a GraphQLObjectType, which is why + // fieldValue must be != null. + fieldValue = handleMissing(_this.executeSelectionSet({ + selectionSet: selection.selectionSet, + objectOrReference: fieldValue, + enclosingRef: isReference(fieldValue) ? fieldValue : enclosingRef, + context: context, + }), resultName); + } + if (fieldValue !== void 0) { + objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b)); + } + } + else { + var fragment = getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) { + throw newInvariantError(9, selection.name.value); + } + if (fragment && policies.fragmentMatches(fragment, typename)) { + fragment.selectionSet.selections.forEach(workSet.add, workSet); + } + } + }); + var result = mergeDeepArray(objectsToMerge); + var finalResult = { result: result, missing: missing }; + var frozen = context.canonizeResults ? + this.canon.admit(finalResult) + // Since this.canon is normally responsible for freezing results (only in + // development), freeze them manually if canonization is disabled. + : maybeDeepFreeze(finalResult); + // Store this result with its selection set so that we can quickly + // recognize it again in the StoreReader#isFresh method. + if (frozen.result) { + this.knownResults.set(frozen.result, selectionSet); + } + return frozen; + }; + // Uncached version of executeSubSelectedArray. + StoreReader.prototype.execSubSelectedArrayImpl = function (_a) { + var _this = this; + var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context; + var missing; + var missingMerger = new DeepMerger(); + function handleMissing(childResult, i) { + var _a; + if (childResult.missing) { + missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a)); + } + return childResult.result; + } + if (field.selectionSet) { + array = array.filter(context.store.canRead); + } + array = array.map(function (item, i) { + // null value in array + if (item === null) { + return null; + } + // This is a nested array, recurse + if (isArray(item)) { + return handleMissing(_this.executeSubSelectedArray({ + field: field, + array: item, + enclosingRef: enclosingRef, + context: context, + }), i); + } + // This is an object, run the selection set on it + if (field.selectionSet) { + return handleMissing(_this.executeSelectionSet({ + selectionSet: field.selectionSet, + objectOrReference: item, + enclosingRef: isReference(item) ? item : enclosingRef, + context: context, + }), i); + } + if (globalThis.__DEV__ !== false) { + assertSelectionSetForIdValue(context.store, field, item); + } + return item; + }); + return { + result: context.canonizeResults ? this.canon.admit(array) : array, + missing: missing, + }; + }; + return StoreReader; +}()); +export { StoreReader }; +function firstMissing(tree) { + try { + JSON.stringify(tree, function (_, value) { + if (typeof value === "string") + throw value; + return value; + }); + } + catch (result) { + return result; + } +} +function assertSelectionSetForIdValue(store, field, fieldValue) { + if (!field.selectionSet) { + var workSet_1 = new Set([fieldValue]); + workSet_1.forEach(function (value) { + if (isNonNullObject(value)) { + invariant( + !isReference(value), + 10, + getTypenameFromStoreObject(store, value), + field.name.value + ); + Object.values(value).forEach(workSet_1.add, workSet_1); + } + }); + } +} +//# sourceMappingURL=readFromStore.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js.map new file mode 100644 index 0000000..def3c21 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/readFromStore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"readFromStore.js","sourceRoot":"","sources":["../../../src/cache/inmemory/readFromStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGhF,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAQhC,OAAO,EACL,OAAO,EACP,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,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AAAD,CAAC,AAvaD,IAuaC;;AAED,SAAS,YAAY,CAAC,IAAiB;IACrC,IAAI,CAAC;QACH,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,UAAC,CAAC,EAAE,KAAK;YAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAAE,MAAM,KAAK,CAAC;YAC3C,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,MAAgB,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,4BAA4B,CACnC,KAAsB,EACtB,KAAgB,EAChB,UAAe;IAEf,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;QACxB,IAAM,SAAO,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QACtC,SAAO,CAAC,OAAO,CAAC,UAAC,KAAK;YACpB,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,SAAS,CACP,CAAC,WAAW,CAAC,KAAK,CAAC,EACnB,yEAAyE,EACzE,0BAA0B,CAAC,KAAK,EAAE,KAAK,CAAC,EACxC,KAAK,CAAC,IAAI,CAAC,KAAK,CACjB,CAAC;gBACF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,SAAO,CAAC,GAAG,EAAE,SAAO,CAAC,CAAC;YACrD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\n\nimport type { DocumentNode, FieldNode, SelectionSetNode } from \"graphql\";\nimport { Kind } from \"graphql\";\nimport type { OptimisticWrapperFunction } from \"optimism\";\nimport { wrap } from \"optimism\";\n\nimport type {\n Reference,\n StoreObject,\n FragmentMap,\n FragmentMapFunction,\n} from \"../../utilities/index.js\";\nimport {\n isField,\n resultKeyNameFromField,\n isReference,\n makeReference,\n shouldInclude,\n addTypenameToDocument,\n getDefaultValues,\n getMainDefinition,\n getQueryDefinition,\n getFragmentFromSelection,\n maybeDeepFreeze,\n mergeDeepArray,\n DeepMerger,\n isNonNullObject,\n canUseWeakMap,\n compact,\n canonicalStringify,\n cacheSizes,\n defaultCacheSizes,\n} from \"../../utilities/index.js\";\nimport type { Cache } from \"../core/types/Cache.js\";\nimport type {\n DiffQueryAgainstStoreOptions,\n InMemoryCacheConfig,\n NormalizedCache,\n ReadMergeModifyContext,\n} from \"./types.js\";\nimport {\n maybeDependOnExistenceOfEntity,\n supportsResultCaching,\n} from \"./entityStore.js\";\nimport {\n isArray,\n extractFragmentContext,\n getTypenameFromStoreObject,\n shouldCanonizeResults,\n} from \"./helpers.js\";\nimport type { Policies } from \"./policies.js\";\nimport type { InMemoryCache } from \"./inMemoryCache.js\";\nimport type { MissingTree } from \"../core/types/common.js\";\nimport { MissingFieldError } from \"../core/types/common.js\";\nimport { ObjectCanon } from \"./object-canon.js\";\n\nexport type VariableMap = { [name: string]: any };\n\ninterface ReadContext extends ReadMergeModifyContext {\n query: DocumentNode;\n policies: Policies;\n canonizeResults: boolean;\n fragmentMap: FragmentMap;\n lookupFragment: FragmentMapFunction;\n}\n\nexport type ExecResult = {\n result: R;\n missing?: MissingTree;\n};\n\ntype ExecSelectionSetOptions = {\n selectionSet: SelectionSetNode;\n objectOrReference: StoreObject | Reference;\n enclosingRef: Reference;\n context: ReadContext;\n};\n\ntype ExecSubSelectedArrayOptions = {\n field: FieldNode;\n array: readonly any[];\n enclosingRef: Reference;\n context: ReadContext;\n};\n\nexport interface StoreReaderConfig {\n cache: InMemoryCache;\n addTypename?: boolean;\n resultCacheMaxSize?: number;\n canonizeResults?: boolean;\n canon?: ObjectCanon;\n fragments?: InMemoryCacheConfig[\"fragments\"];\n}\n\n// Arguments type after keyArgs translation.\ntype ExecSelectionSetKeyArgs = [\n SelectionSetNode,\n StoreObject | Reference,\n ReadMergeModifyContext,\n boolean,\n];\n\nfunction execSelectionSetKeyArgs(\n options: ExecSelectionSetOptions\n): ExecSelectionSetKeyArgs {\n return [\n options.selectionSet,\n options.objectOrReference,\n options.context,\n // We split out this property so we can pass different values\n // independently without modifying options.context itself.\n options.context.canonizeResults,\n ];\n}\n\nexport class StoreReader {\n // cached version of executeSelectionSet\n private executeSelectionSet: OptimisticWrapperFunction<\n [ExecSelectionSetOptions], // Actual arguments tuple type.\n ExecResult, // Actual return type.\n ExecSelectionSetKeyArgs\n >;\n\n // cached version of executeSubSelectedArray\n private executeSubSelectedArray: OptimisticWrapperFunction<\n [ExecSubSelectedArrayOptions],\n ExecResult,\n [ExecSubSelectedArrayOptions]\n >;\n\n private config: {\n cache: InMemoryCache;\n addTypename: boolean;\n resultCacheMaxSize?: number;\n canonizeResults: boolean;\n fragments?: InMemoryCacheConfig[\"fragments\"];\n };\n\n private knownResults = new (canUseWeakMap ? WeakMap : Map)<\n Record,\n SelectionSetNode\n >();\n\n public canon: ObjectCanon;\n public resetCanon() {\n this.canon = new ObjectCanon();\n }\n\n constructor(config: StoreReaderConfig) {\n this.config = compact(config, {\n addTypename: config.addTypename !== false,\n canonizeResults: shouldCanonizeResults(config),\n });\n\n this.canon = config.canon || new ObjectCanon();\n\n // memoized functions in this class will be \"garbage-collected\"\n // by recreating the whole `StoreReader` in\n // `InMemoryCache.resetResultsCache`\n // (triggered from `InMemoryCache.gc` with `resetResultCache: true`)\n this.executeSelectionSet = wrap(\n (options) => {\n const { canonizeResults } = options.context;\n\n const peekArgs = execSelectionSetKeyArgs(options);\n\n // Negate this boolean option so we can find out if we've already read\n // this result using the other boolean value.\n peekArgs[3] = !canonizeResults;\n\n const other = this.executeSelectionSet.peek(...peekArgs);\n\n if (other) {\n if (canonizeResults) {\n return {\n ...other,\n // If we previously read this result without canonizing it, we can\n // reuse that result simply by canonizing it now.\n result: this.canon.admit(other.result),\n };\n }\n // If we previously read this result with canonization enabled, we can\n // return that canonized result as-is.\n return other;\n }\n\n maybeDependOnExistenceOfEntity(\n options.context.store,\n options.enclosingRef.__ref\n );\n\n // Finally, if we didn't find any useful previous results, run the real\n // execSelectionSetImpl method with the given options.\n return this.execSelectionSetImpl(options);\n },\n {\n max:\n this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.executeSelectionSet\"] ||\n defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"],\n keyArgs: execSelectionSetKeyArgs,\n // Note that the parameters of makeCacheKey are determined by the\n // array returned by keyArgs.\n makeCacheKey(selectionSet, parent, context, canonizeResults) {\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(\n selectionSet,\n isReference(parent) ? parent.__ref : parent,\n context.varString,\n canonizeResults\n );\n }\n },\n }\n );\n\n this.executeSubSelectedArray = wrap(\n (options: ExecSubSelectedArrayOptions) => {\n maybeDependOnExistenceOfEntity(\n options.context.store,\n options.enclosingRef.__ref\n );\n return this.execSubSelectedArrayImpl(options);\n },\n {\n max:\n this.config.resultCacheMaxSize ||\n cacheSizes[\"inMemoryCache.executeSubSelectedArray\"] ||\n defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"],\n makeCacheKey({ field, array, context }) {\n if (supportsResultCaching(context.store)) {\n return context.store.makeCacheKey(field, array, context.varString);\n }\n },\n }\n );\n }\n\n /**\n * Given a store and a query, return as much of the result as possible and\n * identify if any data was missing from the store.\n */\n public diffQueryAgainstStore({\n store,\n query,\n rootId = \"ROOT_QUERY\",\n variables,\n returnPartialData = true,\n canonizeResults = this.config.canonizeResults,\n }: DiffQueryAgainstStoreOptions): Cache.DiffResult {\n const policies = this.config.cache.policies;\n\n variables = {\n ...getDefaultValues(getQueryDefinition(query)),\n ...variables!,\n };\n\n const rootRef = makeReference(rootId);\n const execResult = this.executeSelectionSet({\n selectionSet: getMainDefinition(query).selectionSet,\n objectOrReference: rootRef,\n enclosingRef: rootRef,\n context: {\n store,\n query,\n policies,\n variables,\n varString: canonicalStringify(variables),\n canonizeResults,\n ...extractFragmentContext(query, this.config.fragments),\n },\n });\n\n let missing: MissingFieldError[] | undefined;\n if (execResult.missing) {\n // For backwards compatibility we still report an array of\n // MissingFieldError objects, even though there will only ever be at most\n // one of them, now that all missing field error messages are grouped\n // together in the execResult.missing tree.\n missing = [\n new MissingFieldError(\n firstMissing(execResult.missing)!,\n execResult.missing,\n query,\n variables\n ),\n ];\n if (!returnPartialData) {\n throw missing[0];\n }\n }\n\n return {\n result: execResult.result,\n complete: !missing,\n missing,\n };\n }\n\n public isFresh(\n result: Record,\n parent: StoreObject | Reference,\n selectionSet: SelectionSetNode,\n context: ReadMergeModifyContext\n ): boolean {\n if (\n supportsResultCaching(context.store) &&\n this.knownResults.get(result) === selectionSet\n ) {\n const latest = this.executeSelectionSet.peek(\n selectionSet,\n parent,\n context,\n // If result is canonical, then it could only have been previously\n // cached by the canonizing version of executeSelectionSet, so we can\n // avoid checking both possibilities here.\n this.canon.isKnown(result)\n );\n if (latest && result === latest.result) {\n return true;\n }\n }\n return false;\n }\n\n // Uncached version of executeSelectionSet.\n private execSelectionSetImpl({\n selectionSet,\n objectOrReference,\n enclosingRef,\n context,\n }: ExecSelectionSetOptions): ExecResult {\n if (\n isReference(objectOrReference) &&\n !context.policies.rootTypenamesById[objectOrReference.__ref] &&\n !context.store.has(objectOrReference.__ref)\n ) {\n return {\n result: this.canon.empty,\n missing: `Dangling reference to missing ${objectOrReference.__ref} object`,\n };\n }\n\n const { variables, policies, store } = context;\n const typename = store.getFieldValue(\n objectOrReference,\n \"__typename\"\n );\n\n const objectsToMerge: Record[] = [];\n let missing: MissingTree | undefined;\n const missingMerger = new DeepMerger();\n\n if (\n this.config.addTypename &&\n typeof typename === \"string\" &&\n !policies.rootIdsByTypename[typename]\n ) {\n // Ensure we always include a default value for the __typename\n // field, if we have one, and this.config.addTypename is true. Note\n // that this field can be overridden by other merged objects.\n objectsToMerge.push({ __typename: typename });\n }\n\n function handleMissing(result: ExecResult, resultName: string): T {\n if (result.missing) {\n missing = missingMerger.merge(missing, {\n [resultName]: result.missing,\n });\n }\n return result.result;\n }\n\n const workSet = new Set(selectionSet.selections);\n\n workSet.forEach((selection) => {\n // Omit fields with directives @skip(if: ) or\n // @include(if: ).\n if (!shouldInclude(selection, variables)) return;\n\n if (isField(selection)) {\n let fieldValue = policies.readField(\n {\n fieldName: selection.name.value,\n field: selection,\n variables: context.variables,\n from: objectOrReference,\n },\n context\n );\n\n const resultName = resultKeyNameFromField(selection);\n\n if (fieldValue === void 0) {\n if (!addTypenameToDocument.added(selection)) {\n missing = missingMerger.merge(missing, {\n [resultName]: `Can't find field '${selection.name.value}' on ${\n isReference(objectOrReference) ?\n objectOrReference.__ref + \" object\"\n : \"object \" + JSON.stringify(objectOrReference, null, 2)\n }`,\n });\n }\n } else if (isArray(fieldValue)) {\n fieldValue = handleMissing(\n this.executeSubSelectedArray({\n field: selection,\n array: fieldValue,\n enclosingRef,\n context,\n }),\n resultName\n );\n } else if (!selection.selectionSet) {\n // If the field does not have a selection set, then we handle it\n // as a scalar value. To keep this.canon from canonicalizing\n // this value, we use this.canon.pass to wrap fieldValue in a\n // Pass object that this.canon.admit will later unwrap as-is.\n if (context.canonizeResults) {\n fieldValue = this.canon.pass(fieldValue);\n }\n } else if (fieldValue != null) {\n // In this case, because we know the field has a selection set,\n // it must be trying to query a GraphQLObjectType, which is why\n // fieldValue must be != null.\n fieldValue = handleMissing(\n this.executeSelectionSet({\n selectionSet: selection.selectionSet,\n objectOrReference: fieldValue as StoreObject | Reference,\n enclosingRef: isReference(fieldValue) ? fieldValue : enclosingRef,\n context,\n }),\n resultName\n );\n }\n\n if (fieldValue !== void 0) {\n objectsToMerge.push({ [resultName]: fieldValue });\n }\n } else {\n const fragment = getFragmentFromSelection(\n selection,\n context.lookupFragment\n );\n\n if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {\n throw newInvariantError(`No fragment named %s`, selection.name.value);\n }\n\n if (fragment && policies.fragmentMatches(fragment, typename)) {\n fragment.selectionSet.selections.forEach(workSet.add, workSet);\n }\n }\n });\n\n const result = mergeDeepArray(objectsToMerge);\n const finalResult: ExecResult = { result, missing };\n const frozen =\n context.canonizeResults ?\n this.canon.admit(finalResult)\n // Since this.canon is normally responsible for freezing results (only in\n // development), freeze them manually if canonization is disabled.\n : maybeDeepFreeze(finalResult);\n\n // Store this result with its selection set so that we can quickly\n // recognize it again in the StoreReader#isFresh method.\n if (frozen.result) {\n this.knownResults.set(frozen.result, selectionSet);\n }\n\n return frozen;\n }\n\n // Uncached version of executeSubSelectedArray.\n private execSubSelectedArrayImpl({\n field,\n array,\n enclosingRef,\n context,\n }: ExecSubSelectedArrayOptions): ExecResult {\n let missing: MissingTree | undefined;\n let missingMerger = new DeepMerger();\n\n function handleMissing(childResult: ExecResult, i: number): T {\n if (childResult.missing) {\n missing = missingMerger.merge(missing, { [i]: childResult.missing });\n }\n return childResult.result;\n }\n\n if (field.selectionSet) {\n array = array.filter(context.store.canRead);\n }\n\n array = array.map((item, i) => {\n // null value in array\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse\n if (isArray(item)) {\n return handleMissing(\n this.executeSubSelectedArray({\n field,\n array: item,\n enclosingRef,\n context,\n }),\n i\n );\n }\n\n // This is an object, run the selection set on it\n if (field.selectionSet) {\n return handleMissing(\n this.executeSelectionSet({\n selectionSet: field.selectionSet,\n objectOrReference: item,\n enclosingRef: isReference(item) ? item : enclosingRef,\n context,\n }),\n i\n );\n }\n\n if (__DEV__) {\n assertSelectionSetForIdValue(context.store, field, item);\n }\n\n return item;\n });\n\n return {\n result: context.canonizeResults ? this.canon.admit(array) : array,\n missing,\n };\n }\n}\n\nfunction firstMissing(tree: MissingTree): string | undefined {\n try {\n JSON.stringify(tree, (_, value) => {\n if (typeof value === \"string\") throw value;\n return value;\n });\n } catch (result) {\n return result as string;\n }\n}\n\nfunction assertSelectionSetForIdValue(\n store: NormalizedCache,\n field: FieldNode,\n fieldValue: any\n) {\n if (!field.selectionSet) {\n const workSet = new Set([fieldValue]);\n workSet.forEach((value) => {\n if (isNonNullObject(value)) {\n invariant(\n !isReference(value),\n `Missing selection set for object of type %s returned for query field %s`,\n getTypenameFromStoreObject(store, value),\n field.name.value\n );\n Object.values(value).forEach(workSet.add, workSet);\n }\n });\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.d.ts new file mode 100644 index 0000000..f07460c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.d.ts @@ -0,0 +1,126 @@ +import type { DocumentNode, FieldNode } from "graphql"; +import type { Transaction } from "../core/cache.js"; +import type { StoreObject, StoreValue, Reference } from "../../utilities/index.js"; +import type { FieldValueGetter } from "./entityStore.js"; +import type { TypePolicies, PossibleTypesMap, KeyFieldsFunction, StorageType, FieldMergeFunction } from "./policies.js"; +import type { Modifiers, ToReferenceFunction, CanReadFunction, AllFieldsModifier } from "../core/types/common.js"; +import type { FragmentRegistryAPI } from "./fragmentRegistry.js"; +export type { StoreObject, StoreValue, Reference }; +export interface IdGetterObj extends Object { + __typename?: string; + id?: string; + _id?: string; +} +export declare type IdGetter = (value: IdGetterObj) => string | undefined; +/** + * This is an interface used to access, set and remove + * StoreObjects from the cache + */ +export interface NormalizedCache { + has(dataId: string): boolean; + get(dataId: string, fieldName: string): StoreValue; + merge(olderId: string, newerObject: StoreObject): void; + merge(olderObject: StoreObject, newerId: string): void; + modify>(dataId: string, fields: Modifiers | AllFieldsModifier): boolean; + delete(dataId: string, fieldName?: string): boolean; + clear(): void; + /** + * returns an Object with key-value pairs matching the contents of the store + */ + toObject(): NormalizedCacheObject; + /** + * replace the state of the store + */ + replace(newData: NormalizedCacheObject): void; + /** + * Retain (or release) a given root ID to protect (or expose) it and its + * transitive child entities from (or to) garbage collection. The current + * retainment count is returned by both methods. Note that releasing a root + * ID does not cause that entity to be garbage collected, but merely removes + * it from the set of root IDs that will be considered during the next + * mark-and-sweep collection. + */ + retain(rootId: string): number; + release(rootId: string): number; + getFieldValue: FieldValueGetter; + toReference: ToReferenceFunction; + canRead: CanReadFunction; + getStorage(idOrObj: string | StoreObject, ...storeFieldNames: (string | number)[]): StorageType; +} +/** + * This is a normalized representation of the Apollo query result cache. It consists of + * a flattened representation of query result trees. + */ +export interface NormalizedCacheObject { + __META?: { + extraRootIds: string[]; + }; + [dataId: string]: StoreObject | undefined; +} +export type OptimisticStoreItem = { + id: string; + data: NormalizedCacheObject; + transaction: Transaction; +}; +export type ReadQueryOptions = { + /** + * The Apollo Client store object. + */ + store: NormalizedCache; + /** + * A parsed GraphQL query document. + */ + query: DocumentNode; + variables?: Object; + previousResult?: any; + /** + * @deprecated + * Using `canonizeResults` can result in memory leaks so we generally do not + * recommend using this option anymore. + * A future version of Apollo Client will contain a similar feature without + * the risk of memory leaks. + */ + canonizeResults?: boolean; + rootId?: string; + config?: ApolloReducerConfig; +}; +export type DiffQueryAgainstStoreOptions = ReadQueryOptions & { + returnPartialData?: boolean; +}; +export type ApolloReducerConfig = { + dataIdFromObject?: KeyFieldsFunction; + addTypename?: boolean; +}; +export interface InMemoryCacheConfig extends ApolloReducerConfig { + resultCaching?: boolean; + possibleTypes?: PossibleTypesMap; + typePolicies?: TypePolicies; + /** + * @deprecated + * Please use `cacheSizes` instead. + */ + resultCacheMaxSize?: number; + /** + * @deprecated + * Using `canonizeResults` can result in memory leaks so we generally do not + * recommend using this option anymore. + * A future version of Apollo Client will contain a similar feature. + */ + canonizeResults?: boolean; + fragments?: FragmentRegistryAPI; +} +export interface MergeInfo { + field: FieldNode; + typename: string | undefined; + merge: FieldMergeFunction; +} +export interface MergeTree { + info?: MergeInfo; + map: Map; +} +export interface ReadMergeModifyContext { + store: NormalizedCache; + variables?: Record; + varString?: string; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js.map new file mode 100644 index 0000000..da1af1a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cache/inmemory/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FieldNode } from \"graphql\";\n\nimport type { Transaction } from \"../core/cache.js\";\nimport type {\n StoreObject,\n StoreValue,\n Reference,\n} from \"../../utilities/index.js\";\nimport type { FieldValueGetter } from \"./entityStore.js\";\nimport type {\n TypePolicies,\n PossibleTypesMap,\n KeyFieldsFunction,\n StorageType,\n FieldMergeFunction,\n} from \"./policies.js\";\nimport type {\n Modifiers,\n ToReferenceFunction,\n CanReadFunction,\n AllFieldsModifier,\n} from \"../core/types/common.js\";\n\nimport type { FragmentRegistryAPI } from \"./fragmentRegistry.js\";\n\nexport type { StoreObject, StoreValue, Reference };\n\nexport interface IdGetterObj extends Object {\n __typename?: string;\n id?: string;\n _id?: string;\n}\n\nexport declare type IdGetter = (value: IdGetterObj) => string | undefined;\n\n/**\n * This is an interface used to access, set and remove\n * StoreObjects from the cache\n */\nexport interface NormalizedCache {\n has(dataId: string): boolean;\n get(dataId: string, fieldName: string): StoreValue;\n\n // The store.merge method allows either argument to be a string ID, but\n // the other argument has to be a StoreObject. Either way, newer fields\n // always take precedence over older fields.\n merge(olderId: string, newerObject: StoreObject): void;\n merge(olderObject: StoreObject, newerId: string): void;\n\n modify>(\n dataId: string,\n fields: Modifiers | AllFieldsModifier\n ): boolean;\n delete(dataId: string, fieldName?: string): boolean;\n clear(): void;\n\n // non-Map elements:\n /**\n * returns an Object with key-value pairs matching the contents of the store\n */\n toObject(): NormalizedCacheObject;\n /**\n * replace the state of the store\n */\n replace(newData: NormalizedCacheObject): void;\n\n /**\n * Retain (or release) a given root ID to protect (or expose) it and its\n * transitive child entities from (or to) garbage collection. The current\n * retainment count is returned by both methods. Note that releasing a root\n * ID does not cause that entity to be garbage collected, but merely removes\n * it from the set of root IDs that will be considered during the next\n * mark-and-sweep collection.\n */\n retain(rootId: string): number;\n release(rootId: string): number;\n\n getFieldValue: FieldValueGetter;\n toReference: ToReferenceFunction;\n canRead: CanReadFunction;\n\n getStorage(\n idOrObj: string | StoreObject,\n ...storeFieldNames: (string | number)[]\n ): StorageType;\n}\n\n/**\n * This is a normalized representation of the Apollo query result cache. It consists of\n * a flattened representation of query result trees.\n */\nexport interface NormalizedCacheObject {\n __META?: {\n // Well-known singleton IDs like ROOT_QUERY and ROOT_MUTATION are\n // always considered to be root IDs during cache.gc garbage\n // collection, but other IDs can become roots if they are written\n // directly with cache.writeFragment or retained explicitly with\n // cache.retain. When such IDs exist, we include them in the __META\n // section so that they can survive cache.{extract,restore}.\n extraRootIds: string[];\n };\n [dataId: string]: StoreObject | undefined;\n}\n\nexport type OptimisticStoreItem = {\n id: string;\n data: NormalizedCacheObject;\n transaction: Transaction;\n};\n\nexport type ReadQueryOptions = {\n /**\n * The Apollo Client store object.\n */\n store: NormalizedCache;\n /**\n * A parsed GraphQL query document.\n */\n query: DocumentNode;\n variables?: Object;\n previousResult?: any;\n /**\n * @deprecated\n * Using `canonizeResults` can result in memory leaks so we generally do not\n * recommend using this option anymore.\n * A future version of Apollo Client will contain a similar feature without\n * the risk of memory leaks.\n */\n canonizeResults?: boolean;\n rootId?: string;\n config?: ApolloReducerConfig;\n};\n\nexport type DiffQueryAgainstStoreOptions = ReadQueryOptions & {\n returnPartialData?: boolean;\n};\n\nexport type ApolloReducerConfig = {\n dataIdFromObject?: KeyFieldsFunction;\n addTypename?: boolean;\n};\n\nexport interface InMemoryCacheConfig extends ApolloReducerConfig {\n resultCaching?: boolean;\n possibleTypes?: PossibleTypesMap;\n typePolicies?: TypePolicies;\n /**\n * @deprecated\n * Please use `cacheSizes` instead.\n */\n resultCacheMaxSize?: number;\n /**\n * @deprecated\n * Using `canonizeResults` can result in memory leaks so we generally do not\n * recommend using this option anymore.\n * A future version of Apollo Client will contain a similar feature.\n */\n canonizeResults?: boolean;\n fragments?: FragmentRegistryAPI;\n}\n\nexport interface MergeInfo {\n field: FieldNode;\n typename: string | undefined;\n merge: FieldMergeFunction;\n}\n\nexport interface MergeTree {\n info?: MergeInfo;\n map: Map;\n}\n\nexport interface ReadMergeModifyContext {\n store: NormalizedCache;\n variables?: Record;\n // A JSON.stringify-serialized version of context.variables.\n varString?: string;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.d.ts b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.d.ts new file mode 100644 index 0000000..41b383d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.d.ts @@ -0,0 +1,37 @@ +import type { SelectionSetNode, FieldNode } from "graphql"; +import type { FragmentMap, FragmentMapFunction, StoreObject, Reference } from "../../utilities/index.js"; +import type { NormalizedCache, ReadMergeModifyContext, MergeTree } from "./types.js"; +import type { StoreReader } from "./readFromStore.js"; +import type { InMemoryCache } from "./inMemoryCache.js"; +import type { Cache } from "../../core/index.js"; +export interface WriteContext extends ReadMergeModifyContext { + readonly written: { + [dataId: string]: SelectionSetNode[]; + }; + readonly fragmentMap: FragmentMap; + lookupFragment: FragmentMapFunction; + merge(existing: T, incoming: T): T; + overwrite: boolean; + incomingById: Map; + }>; + clientOnly: boolean; + deferred: boolean; + flavors: Map; +} +type FlavorableWriteContext = Pick; +export declare class StoreWriter { + readonly cache: InMemoryCache; + private reader?; + private fragments?; + constructor(cache: InMemoryCache, reader?: StoreReader | undefined, fragments?: import("./fragmentRegistry.js").FragmentRegistryAPI | undefined); + writeToStore(store: NormalizedCache, { query, result, dataId, variables, overwrite }: Cache.WriteOptions): Reference | undefined; + private processSelectionSet; + private processFieldValue; + private flattenFields; + private applyMerges; +} +export {}; +//# sourceMappingURL=writeToStore.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js new file mode 100644 index 0000000..3dfaa7c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js @@ -0,0 +1,529 @@ +import { __assign } from "tslib"; +import { invariant, newInvariantError } from "../../utilities/globals/index.js"; +import { equal } from "@wry/equality"; +import { Trie } from "@wry/trie"; +import { Kind } from "graphql"; +import { getFragmentFromSelection, getDefaultValues, getOperationDefinition, getTypenameFromResult, makeReference, isField, resultKeyNameFromField, isReference, shouldInclude, cloneDeep, addTypenameToDocument, isNonEmptyArray, argumentsObjectFromField, canonicalStringify, } from "../../utilities/index.js"; +import { isArray, makeProcessedFieldsMerger, fieldNameFromStoreName, storeValueIsStoreObject, extractFragmentContext, } from "./helpers.js"; +import { normalizeReadFieldOptions } from "./policies.js"; +// Since there are only four possible combinations of context.clientOnly and +// context.deferred values, we should need at most four "flavors" of any given +// WriteContext. To avoid creating multiple copies of the same context, we cache +// the contexts in the context.flavors Map (shared by all flavors) according to +// their clientOnly and deferred values (always in that order). +function getContextFlavor(context, clientOnly, deferred) { + var key = "".concat(clientOnly).concat(deferred); + var flavored = context.flavors.get(key); + if (!flavored) { + context.flavors.set(key, (flavored = + context.clientOnly === clientOnly && context.deferred === deferred ? + context + : __assign(__assign({}, context), { clientOnly: clientOnly, deferred: deferred }))); + } + return flavored; +} +var StoreWriter = /** @class */ (function () { + function StoreWriter(cache, reader, fragments) { + this.cache = cache; + this.reader = reader; + this.fragments = fragments; + } + StoreWriter.prototype.writeToStore = function (store, _a) { + var _this = this; + var query = _a.query, result = _a.result, dataId = _a.dataId, variables = _a.variables, overwrite = _a.overwrite; + var operationDefinition = getOperationDefinition(query); + var merger = makeProcessedFieldsMerger(); + variables = __assign(__assign({}, getDefaultValues(operationDefinition)), variables); + var context = __assign(__assign({ store: store, written: Object.create(null), merge: function (existing, incoming) { + return merger.merge(existing, incoming); + }, variables: variables, varString: canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() }); + var ref = this.processSelectionSet({ + result: result || Object.create(null), + dataId: dataId, + selectionSet: operationDefinition.selectionSet, + mergeTree: { map: new Map() }, + context: context, + }); + if (!isReference(ref)) { + throw newInvariantError(11, result); + } + // So far, the store has not been modified, so now it's time to process + // context.incomingById and merge those incoming fields into context.store. + context.incomingById.forEach(function (_a, dataId) { + var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet; + var entityRef = makeReference(dataId); + if (mergeTree && mergeTree.map.size) { + var applied = _this.applyMerges(mergeTree, entityRef, storeObject, context); + if (isReference(applied)) { + // Assume References returned by applyMerges have already been merged + // into the store. See makeMergeObjectsFunction in policies.ts for an + // example of how this can happen. + return; + } + // Otherwise, applyMerges returned a StoreObject, whose fields we should + // merge into the store (see store.merge statement below). + storeObject = applied; + } + if (globalThis.__DEV__ !== false && !context.overwrite) { + var fieldsWithSelectionSets_1 = Object.create(null); + fieldNodeSet.forEach(function (field) { + if (field.selectionSet) { + fieldsWithSelectionSets_1[field.name.value] = true; + } + }); + var hasSelectionSet_1 = function (storeFieldName) { + return fieldsWithSelectionSets_1[fieldNameFromStoreName(storeFieldName)] === + true; + }; + var hasMergeFunction_1 = function (storeFieldName) { + var childTree = mergeTree && mergeTree.map.get(storeFieldName); + return Boolean(childTree && childTree.info && childTree.info.merge); + }; + Object.keys(storeObject).forEach(function (storeFieldName) { + // If a merge function was defined for this field, trust that it + // did the right thing about (not) clobbering data. If the field + // has no selection set, it's a scalar field, so it doesn't need + // a merge function (even if it's an object, like JSON data). + if (hasSelectionSet_1(storeFieldName) && + !hasMergeFunction_1(storeFieldName)) { + warnAboutDataLoss(entityRef, storeObject, storeFieldName, context.store); + } + }); + } + store.merge(dataId, storeObject); + }); + // Any IDs written explicitly to the cache will be retained as + // reachable root IDs for garbage collection purposes. Although this + // logic includes root IDs like ROOT_QUERY and ROOT_MUTATION, their + // retainment counts are effectively ignored because cache.gc() always + // includes them in its root ID set. + store.retain(ref.__ref); + return ref; + }; + StoreWriter.prototype.processSelectionSet = function (_a) { + var _this = this; + var dataId = _a.dataId, result = _a.result, selectionSet = _a.selectionSet, context = _a.context, + // This object allows processSelectionSet to report useful information + // to its callers without explicitly returning that information. + mergeTree = _a.mergeTree; + var policies = this.cache.policies; + // This variable will be repeatedly updated using context.merge to + // accumulate all fields that need to be written into the store. + var incoming = Object.create(null); + // If typename was not passed in, infer it. Note that typename is + // always passed in for tricky-to-infer cases such as "Query" for + // ROOT_QUERY. + var typename = (dataId && policies.rootTypenamesById[dataId]) || + getTypenameFromResult(result, selectionSet, context.fragmentMap) || + (dataId && context.store.get(dataId, "__typename")); + if ("string" === typeof typename) { + incoming.__typename = typename; + } + // This readField function will be passed as context.readField in the + // KeyFieldsContext object created within policies.identify (called below). + // In addition to reading from the existing context.store (thanks to the + // policies.readField(options, context) line at the very bottom), this + // version of readField can read from Reference objects that are currently + // pending in context.incomingById, which is important whenever keyFields + // need to be extracted from a child object that processSelectionSet has + // turned into a Reference. + var readField = function () { + var options = normalizeReadFieldOptions(arguments, incoming, context.variables); + if (isReference(options.from)) { + var info = context.incomingById.get(options.from.__ref); + if (info) { + var result_1 = policies.readField(__assign(__assign({}, options), { from: info.storeObject }), context); + if (result_1 !== void 0) { + return result_1; + } + } + } + return policies.readField(options, context); + }; + var fieldNodeSet = new Set(); + this.flattenFields(selectionSet, result, + // This WriteContext will be the default context value for fields returned + // by the flattenFields method, but some fields may be assigned a modified + // context, depending on the presence of @client and other directives. + context, typename).forEach(function (context, field) { + var _a; + var resultFieldKey = resultKeyNameFromField(field); + var value = result[resultFieldKey]; + fieldNodeSet.add(field); + if (value !== void 0) { + var storeFieldName = policies.getStoreFieldName({ + typename: typename, + fieldName: field.name.value, + field: field, + variables: context.variables, + }); + var childTree = getChildMergeTree(mergeTree, storeFieldName); + var incomingValue = _this.processFieldValue(value, field, + // Reset context.clientOnly and context.deferred to their default + // values before processing nested selection sets. + field.selectionSet ? + getContextFlavor(context, false, false) + : context, childTree); + // To determine if this field holds a child object with a merge function + // defined in its type policy (see PR #7070), we need to figure out the + // child object's __typename. + var childTypename = void 0; + // The field's value can be an object that has a __typename only if the + // field has a selection set. Otherwise incomingValue is scalar. + if (field.selectionSet && + (isReference(incomingValue) || storeValueIsStoreObject(incomingValue))) { + childTypename = readField("__typename", incomingValue); + } + var merge = policies.getMergeFunction(typename, field.name.value, childTypename); + if (merge) { + childTree.info = { + // TODO Check compatibility against any existing childTree.field? + field: field, + typename: typename, + merge: merge, + }; + } + else { + maybeRecycleChildMergeTree(mergeTree, storeFieldName); + } + incoming = context.merge(incoming, (_a = {}, + _a[storeFieldName] = incomingValue, + _a)); + } + else if (globalThis.__DEV__ !== false && + !context.clientOnly && + !context.deferred && + !addTypenameToDocument.added(field) && + // If the field has a read function, it may be a synthetic field or + // provide a default value, so its absence from the written data should + // not be cause for alarm. + !policies.getReadFunction(typename, field.name.value)) { + globalThis.__DEV__ !== false && invariant.error(12, resultKeyNameFromField(field), result); + } + }); + // Identify the result object, even if dataId was already provided, + // since we always need keyObject below. + try { + var _b = policies.identify(result, { + typename: typename, + selectionSet: selectionSet, + fragmentMap: context.fragmentMap, + storeObject: incoming, + readField: readField, + }), id = _b[0], keyObject = _b[1]; + // If dataId was not provided, fall back to the id just generated by + // policies.identify. + dataId = dataId || id; + // Write any key fields that were used during identification, even if + // they were not mentioned in the original query. + if (keyObject) { + // TODO Reverse the order of the arguments? + incoming = context.merge(incoming, keyObject); + } + } + catch (e) { + // If dataId was provided, tolerate failure of policies.identify. + if (!dataId) + throw e; + } + if ("string" === typeof dataId) { + var dataRef = makeReference(dataId); + // Avoid processing the same entity object using the same selection + // set more than once. We use an array instead of a Set since most + // entity IDs will be written using only one selection set, so the + // size of this array is likely to be very small, meaning indexOf is + // likely to be faster than Set.prototype.has. + var sets = context.written[dataId] || (context.written[dataId] = []); + if (sets.indexOf(selectionSet) >= 0) + return dataRef; + sets.push(selectionSet); + // If we're about to write a result object into the store, but we + // happen to know that the exact same (===) result object would be + // returned if we were to reread the result with the same inputs, + // then we can skip the rest of the processSelectionSet work for + // this object, and immediately return a Reference to it. + if (this.reader && + this.reader.isFresh(result, dataRef, selectionSet, context)) { + return dataRef; + } + var previous_1 = context.incomingById.get(dataId); + if (previous_1) { + previous_1.storeObject = context.merge(previous_1.storeObject, incoming); + previous_1.mergeTree = mergeMergeTrees(previous_1.mergeTree, mergeTree); + fieldNodeSet.forEach(function (field) { return previous_1.fieldNodeSet.add(field); }); + } + else { + context.incomingById.set(dataId, { + storeObject: incoming, + // Save a reference to mergeTree only if it is not empty, because + // empty MergeTrees may be recycled by maybeRecycleChildMergeTree and + // reused for entirely different parts of the result tree. + mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree, + fieldNodeSet: fieldNodeSet, + }); + } + return dataRef; + } + return incoming; + }; + StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) { + var _this = this; + if (!field.selectionSet || value === null) { + // In development, we need to clone scalar values so that they can be + // safely frozen with maybeDeepFreeze in readFromStore.ts. In production, + // it's cheaper to store the scalar values directly in the cache. + return globalThis.__DEV__ !== false ? cloneDeep(value) : value; + } + if (isArray(value)) { + return value.map(function (item, i) { + var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i)); + maybeRecycleChildMergeTree(mergeTree, i); + return value; + }); + } + return this.processSelectionSet({ + result: value, + selectionSet: field.selectionSet, + context: context, + mergeTree: mergeTree, + }); + }; + // Implements https://spec.graphql.org/draft/#sec-Field-Collection, but with + // some additions for tracking @client and @defer directives. + StoreWriter.prototype.flattenFields = function (selectionSet, result, context, typename) { + if (typename === void 0) { typename = getTypenameFromResult(result, selectionSet, context.fragmentMap); } + var fieldMap = new Map(); + var policies = this.cache.policies; + var limitingTrie = new Trie(false); // No need for WeakMap, since limitingTrie does not escape. + (function flatten(selectionSet, inheritedContext) { + var visitedNode = limitingTrie.lookup(selectionSet, + // Because we take inheritedClientOnly and inheritedDeferred into + // consideration here (in addition to selectionSet), it's possible for + // the same selection set to be flattened more than once, if it appears + // in the query with different @client and/or @directive configurations. + inheritedContext.clientOnly, inheritedContext.deferred); + if (visitedNode.visited) + return; + visitedNode.visited = true; + selectionSet.selections.forEach(function (selection) { + if (!shouldInclude(selection, context.variables)) + return; + var clientOnly = inheritedContext.clientOnly, deferred = inheritedContext.deferred; + if ( + // Since the presence of @client or @defer on this field can only + // cause clientOnly or deferred to become true, we can skip the + // forEach loop if both clientOnly and deferred are already true. + !(clientOnly && deferred) && + isNonEmptyArray(selection.directives)) { + selection.directives.forEach(function (dir) { + var name = dir.name.value; + if (name === "client") + clientOnly = true; + if (name === "defer") { + var args = argumentsObjectFromField(dir, context.variables); + // The @defer directive takes an optional args.if boolean + // argument, similar to @include(if: boolean). Note that + // @defer(if: false) does not make context.deferred false, but + // instead behaves as if there was no @defer directive. + if (!args || args.if !== false) { + deferred = true; + } + // TODO In the future, we may want to record args.label using + // context.deferred, if a label is specified. + } + }); + } + if (isField(selection)) { + var existing = fieldMap.get(selection); + if (existing) { + // If this field has been visited along another recursive path + // before, the final context should have clientOnly or deferred set + // to true only if *all* paths have the directive (hence the &&). + clientOnly = clientOnly && existing.clientOnly; + deferred = deferred && existing.deferred; + } + fieldMap.set(selection, getContextFlavor(context, clientOnly, deferred)); + } + else { + var fragment = getFragmentFromSelection(selection, context.lookupFragment); + if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) { + throw newInvariantError(13, selection.name.value); + } + if (fragment && + policies.fragmentMatches(fragment, typename, result, context.variables)) { + flatten(fragment.selectionSet, getContextFlavor(context, clientOnly, deferred)); + } + } + }); + })(selectionSet, context); + return fieldMap; + }; + StoreWriter.prototype.applyMerges = function (mergeTree, existing, incoming, context, getStorageArgs) { + var _a; + var _this = this; + if (mergeTree.map.size && !isReference(incoming)) { + var e_1 = + // Items in the same position in different arrays are not + // necessarily related to each other, so when incoming is an array + // we process its elements as if there was no existing data. + (!isArray(incoming) && + // Likewise, existing must be either a Reference or a StoreObject + // in order for its fields to be safe to merge with the fields of + // the incoming object. + (isReference(existing) || storeValueIsStoreObject(existing))) ? + existing + : void 0; + // This narrowing is implied by mergeTree.map.size > 0 and + // !isReference(incoming), though TypeScript understandably cannot + // hope to infer this type. + var i_1 = incoming; + // The options.storage objects provided to read and merge functions + // are derived from the identity of the parent object plus a + // sequence of storeFieldName strings/numbers identifying the nested + // field name path of each field value to be merged. + if (e_1 && !getStorageArgs) { + getStorageArgs = [isReference(e_1) ? e_1.__ref : e_1]; + } + // It's possible that applying merge functions to this subtree will + // not change the incoming data, so this variable tracks the fields + // that did change, so we can create a new incoming object when (and + // only when) at least one incoming field has changed. We use a Map + // to preserve the type of numeric keys. + var changedFields_1; + var getValue_1 = function (from, name) { + return (isArray(from) ? + typeof name === "number" ? + from[name] + : void 0 + : context.store.getFieldValue(from, String(name))); + }; + mergeTree.map.forEach(function (childTree, storeFieldName) { + var eVal = getValue_1(e_1, storeFieldName); + var iVal = getValue_1(i_1, storeFieldName); + // If we have no incoming data, leave any existing data untouched. + if (void 0 === iVal) + return; + if (getStorageArgs) { + getStorageArgs.push(storeFieldName); + } + var aVal = _this.applyMerges(childTree, eVal, iVal, context, getStorageArgs); + if (aVal !== iVal) { + changedFields_1 = changedFields_1 || new Map(); + changedFields_1.set(storeFieldName, aVal); + } + if (getStorageArgs) { + invariant(getStorageArgs.pop() === storeFieldName); + } + }); + if (changedFields_1) { + // Shallow clone i so we can add changed fields to it. + incoming = (isArray(i_1) ? i_1.slice(0) : __assign({}, i_1)); + changedFields_1.forEach(function (value, name) { + incoming[name] = value; + }); + } + } + if (mergeTree.info) { + return this.cache.policies.runMergeFunction(existing, incoming, mergeTree.info, context, getStorageArgs && (_a = context.store).getStorage.apply(_a, getStorageArgs)); + } + return incoming; + }; + return StoreWriter; +}()); +export { StoreWriter }; +var emptyMergeTreePool = []; +function getChildMergeTree(_a, name) { + var map = _a.map; + if (!map.has(name)) { + map.set(name, emptyMergeTreePool.pop() || { map: new Map() }); + } + return map.get(name); +} +function mergeMergeTrees(left, right) { + if (left === right || !right || mergeTreeIsEmpty(right)) + return left; + if (!left || mergeTreeIsEmpty(left)) + return right; + var info = left.info && right.info ? __assign(__assign({}, left.info), right.info) : left.info || right.info; + var needToMergeMaps = left.map.size && right.map.size; + var map = needToMergeMaps ? new Map() + : left.map.size ? left.map + : right.map; + var merged = { info: info, map: map }; + if (needToMergeMaps) { + var remainingRightKeys_1 = new Set(right.map.keys()); + left.map.forEach(function (leftTree, key) { + merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key))); + remainingRightKeys_1.delete(key); + }); + remainingRightKeys_1.forEach(function (key) { + merged.map.set(key, mergeMergeTrees(right.map.get(key), left.map.get(key))); + }); + } + return merged; +} +function mergeTreeIsEmpty(tree) { + return !tree || !(tree.info || tree.map.size); +} +function maybeRecycleChildMergeTree(_a, name) { + var map = _a.map; + var childTree = map.get(name); + if (childTree && mergeTreeIsEmpty(childTree)) { + emptyMergeTreePool.push(childTree); + map.delete(name); + } +} +var warnings = new Set(); +// Note that this function is unused in production, and thus should be +// pruned by any well-configured minifier. +function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) { + var getChild = function (objOrRef) { + var child = store.getFieldValue(objOrRef, storeFieldName); + return typeof child === "object" && child; + }; + var existing = getChild(existingRef); + if (!existing) + return; + var incoming = getChild(incomingObj); + if (!incoming) + return; + // It's always safe to replace a reference, since it refers to data + // safely stored elsewhere. + if (isReference(existing)) + return; + // If the values are structurally equivalent, we do not need to worry + // about incoming replacing existing. + if (equal(existing, incoming)) + return; + // If we're replacing every key of the existing object, then the + // existing data would be overwritten even if the objects were + // normalized, so warning would not be helpful here. + if (Object.keys(existing).every(function (key) { return store.getFieldValue(incoming, key) !== void 0; })) { + return; + } + var parentType = store.getFieldValue(existingRef, "__typename") || + store.getFieldValue(incomingObj, "__typename"); + var fieldName = fieldNameFromStoreName(storeFieldName); + var typeDotName = "".concat(parentType, ".").concat(fieldName); + // Avoid warning more than once for the same type and field name. + if (warnings.has(typeDotName)) + return; + warnings.add(typeDotName); + var childTypenames = []; + // Arrays do not have __typename fields, and always need a custom merge + // function, even if their elements are normalized entities. + if (!isArray(existing) && !isArray(incoming)) { + [existing, incoming].forEach(function (child) { + var typename = store.getFieldValue(child, "__typename"); + if (typeof typename === "string" && !childTypenames.includes(typename)) { + childTypenames.push(typename); + } + }); + } + globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length ? + "either ensure all objects of type " + + childTypenames.join(" and ") + + " have an ID or a custom merge function, or " + : "", typeDotName, existing, incoming); +} +//# sourceMappingURL=writeToStore.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js.map b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js.map new file mode 100644 index 0000000..88b1ab2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/inmemory/writeToStore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"writeToStore.js","sourceRoot":"","sources":["../../../src/cache/inmemory/writeToStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAS/B,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,OAAO,EACP,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EAC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,CAAC,WAAW,CAAC,CAAC;IAE1B,IAAM,cAAc,GAAa,EAAE,CAAC;IACpC,uEAAuE;IACvE,4DAA4D;IAC5D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAC,KAAK;YACjC,IAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YAC1D,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACvE,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,IAAI,CACZ,woBAaH,EACG,SAAS,EACT,UAAU,EACV,cAAc,CAAC,MAAM,CAAC,CAAC;QACrB,oCAAoC;YAClC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;YAC5B,6CAA6C;QACjD,CAAC,CAAC,EAAE,EACJ,WAAW,EACX,QAAQ,EACR,QAAQ,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { Trie } from \"@wry/trie\";\nimport type { SelectionSetNode, FieldNode } from \"graphql\";\nimport { Kind } from \"graphql\";\n\nimport type {\n FragmentMap,\n FragmentMapFunction,\n StoreValue,\n StoreObject,\n Reference,\n} from \"../../utilities/index.js\";\nimport {\n getFragmentFromSelection,\n getDefaultValues,\n getOperationDefinition,\n getTypenameFromResult,\n makeReference,\n isField,\n resultKeyNameFromField,\n isReference,\n shouldInclude,\n cloneDeep,\n addTypenameToDocument,\n isNonEmptyArray,\n argumentsObjectFromField,\n canonicalStringify,\n} from \"../../utilities/index.js\";\n\nimport type {\n NormalizedCache,\n ReadMergeModifyContext,\n MergeTree,\n InMemoryCacheConfig,\n} from \"./types.js\";\nimport {\n isArray,\n makeProcessedFieldsMerger,\n fieldNameFromStoreName,\n storeValueIsStoreObject,\n extractFragmentContext,\n} from \"./helpers.js\";\nimport type { StoreReader } from \"./readFromStore.js\";\nimport type { InMemoryCache } from \"./inMemoryCache.js\";\nimport type { EntityStore } from \"./entityStore.js\";\nimport type { Cache } from \"../../core/index.js\";\nimport { normalizeReadFieldOptions } from \"./policies.js\";\nimport type { ReadFieldFunction } from \"../core/types/common.js\";\n\nexport interface WriteContext extends ReadMergeModifyContext {\n readonly written: {\n [dataId: string]: SelectionSetNode[];\n };\n readonly fragmentMap: FragmentMap;\n lookupFragment: FragmentMapFunction;\n // General-purpose deep-merge function for use during writes.\n merge(existing: T, incoming: T): T;\n // If true, merge functions will be called with undefined existing data.\n overwrite: boolean;\n incomingById: Map<\n string,\n {\n storeObject: StoreObject;\n mergeTree?: MergeTree;\n fieldNodeSet: Set;\n }\n >;\n // Directive metadata for @client and @defer. We could use a bitfield for this\n // information to save some space, and use that bitfield number as the keys in\n // the context.flavors Map.\n clientOnly: boolean;\n deferred: boolean;\n flavors: Map;\n}\n\ntype FlavorableWriteContext = Pick<\n WriteContext,\n \"clientOnly\" | \"deferred\" | \"flavors\"\n>;\n\n// Since there are only four possible combinations of context.clientOnly and\n// context.deferred values, we should need at most four \"flavors\" of any given\n// WriteContext. To avoid creating multiple copies of the same context, we cache\n// the contexts in the context.flavors Map (shared by all flavors) according to\n// their clientOnly and deferred values (always in that order).\nfunction getContextFlavor(\n context: TContext,\n clientOnly: TContext[\"clientOnly\"],\n deferred: TContext[\"deferred\"]\n): TContext {\n const key = `${clientOnly}${deferred}`;\n let flavored = context.flavors.get(key);\n if (!flavored) {\n context.flavors.set(\n key,\n (flavored =\n context.clientOnly === clientOnly && context.deferred === deferred ?\n context\n : {\n ...context,\n clientOnly,\n deferred,\n })\n );\n }\n return flavored as TContext;\n}\n\ninterface ProcessSelectionSetOptions {\n dataId?: string;\n result: Record;\n selectionSet: SelectionSetNode;\n context: WriteContext;\n mergeTree: MergeTree;\n}\n\nexport class StoreWriter {\n constructor(\n public readonly cache: InMemoryCache,\n private reader?: StoreReader,\n private fragments?: InMemoryCacheConfig[\"fragments\"]\n ) {}\n\n public writeToStore(\n store: NormalizedCache,\n { query, result, dataId, variables, overwrite }: Cache.WriteOptions\n ): Reference | undefined {\n const operationDefinition = getOperationDefinition(query)!;\n const merger = makeProcessedFieldsMerger();\n\n variables = {\n ...getDefaultValues(operationDefinition),\n ...variables!,\n };\n\n const context: WriteContext = {\n store,\n written: Object.create(null),\n merge(existing: T, incoming: T) {\n return merger.merge(existing, incoming) as T;\n },\n variables,\n varString: canonicalStringify(variables),\n ...extractFragmentContext(query, this.fragments),\n overwrite: !!overwrite,\n incomingById: new Map(),\n clientOnly: false,\n deferred: false,\n flavors: new Map(),\n };\n\n const ref = this.processSelectionSet({\n result: result || Object.create(null),\n dataId,\n selectionSet: operationDefinition.selectionSet,\n mergeTree: { map: new Map() },\n context,\n });\n\n if (!isReference(ref)) {\n throw newInvariantError(`Could not identify object %s`, result);\n }\n\n // So far, the store has not been modified, so now it's time to process\n // context.incomingById and merge those incoming fields into context.store.\n context.incomingById.forEach(\n ({ storeObject, mergeTree, fieldNodeSet }, dataId) => {\n const entityRef = makeReference(dataId);\n\n if (mergeTree && mergeTree.map.size) {\n const applied = this.applyMerges(\n mergeTree,\n entityRef,\n storeObject,\n context\n );\n if (isReference(applied)) {\n // Assume References returned by applyMerges have already been merged\n // into the store. See makeMergeObjectsFunction in policies.ts for an\n // example of how this can happen.\n return;\n }\n // Otherwise, applyMerges returned a StoreObject, whose fields we should\n // merge into the store (see store.merge statement below).\n storeObject = applied;\n }\n\n if (__DEV__ && !context.overwrite) {\n const fieldsWithSelectionSets: Record =\n Object.create(null);\n fieldNodeSet.forEach((field) => {\n if (field.selectionSet) {\n fieldsWithSelectionSets[field.name.value] = true;\n }\n });\n\n const hasSelectionSet = (storeFieldName: string) =>\n fieldsWithSelectionSets[fieldNameFromStoreName(storeFieldName)] ===\n true;\n\n const hasMergeFunction = (storeFieldName: string) => {\n const childTree = mergeTree && mergeTree.map.get(storeFieldName);\n return Boolean(childTree && childTree.info && childTree.info.merge);\n };\n\n Object.keys(storeObject).forEach((storeFieldName) => {\n // If a merge function was defined for this field, trust that it\n // did the right thing about (not) clobbering data. If the field\n // has no selection set, it's a scalar field, so it doesn't need\n // a merge function (even if it's an object, like JSON data).\n if (\n hasSelectionSet(storeFieldName) &&\n !hasMergeFunction(storeFieldName)\n ) {\n warnAboutDataLoss(\n entityRef,\n storeObject,\n storeFieldName,\n context.store\n );\n }\n });\n }\n\n store.merge(dataId, storeObject);\n }\n );\n\n // Any IDs written explicitly to the cache will be retained as\n // reachable root IDs for garbage collection purposes. Although this\n // logic includes root IDs like ROOT_QUERY and ROOT_MUTATION, their\n // retainment counts are effectively ignored because cache.gc() always\n // includes them in its root ID set.\n store.retain(ref.__ref);\n\n return ref;\n }\n\n private processSelectionSet({\n dataId,\n result,\n selectionSet,\n context,\n // This object allows processSelectionSet to report useful information\n // to its callers without explicitly returning that information.\n mergeTree,\n }: ProcessSelectionSetOptions): StoreObject | Reference {\n const { policies } = this.cache;\n\n // This variable will be repeatedly updated using context.merge to\n // accumulate all fields that need to be written into the store.\n let incoming: StoreObject = Object.create(null);\n\n // If typename was not passed in, infer it. Note that typename is\n // always passed in for tricky-to-infer cases such as \"Query\" for\n // ROOT_QUERY.\n const typename: string | undefined =\n (dataId && policies.rootTypenamesById[dataId]) ||\n getTypenameFromResult(result, selectionSet, context.fragmentMap) ||\n (dataId && (context.store.get(dataId, \"__typename\") as string));\n\n if (\"string\" === typeof typename) {\n incoming.__typename = typename;\n }\n\n // This readField function will be passed as context.readField in the\n // KeyFieldsContext object created within policies.identify (called below).\n // In addition to reading from the existing context.store (thanks to the\n // policies.readField(options, context) line at the very bottom), this\n // version of readField can read from Reference objects that are currently\n // pending in context.incomingById, which is important whenever keyFields\n // need to be extracted from a child object that processSelectionSet has\n // turned into a Reference.\n const readField: ReadFieldFunction = function (this: void) {\n const options = normalizeReadFieldOptions(\n arguments,\n incoming,\n context.variables\n );\n\n if (isReference(options.from)) {\n const info = context.incomingById.get(options.from.__ref);\n if (info) {\n const result = policies.readField(\n {\n ...options,\n from: info.storeObject,\n },\n context\n );\n\n if (result !== void 0) {\n return result;\n }\n }\n }\n\n return policies.readField(options, context);\n };\n\n const fieldNodeSet = new Set();\n\n this.flattenFields(\n selectionSet,\n result,\n // This WriteContext will be the default context value for fields returned\n // by the flattenFields method, but some fields may be assigned a modified\n // context, depending on the presence of @client and other directives.\n context,\n typename\n ).forEach((context, field) => {\n const resultFieldKey = resultKeyNameFromField(field);\n const value = result[resultFieldKey];\n\n fieldNodeSet.add(field);\n\n if (value !== void 0) {\n const storeFieldName = policies.getStoreFieldName({\n typename,\n fieldName: field.name.value,\n field,\n variables: context.variables,\n });\n\n const childTree = getChildMergeTree(mergeTree, storeFieldName);\n\n let incomingValue = this.processFieldValue(\n value,\n field,\n // Reset context.clientOnly and context.deferred to their default\n // values before processing nested selection sets.\n field.selectionSet ?\n getContextFlavor(context, false, false)\n : context,\n childTree\n );\n\n // To determine if this field holds a child object with a merge function\n // defined in its type policy (see PR #7070), we need to figure out the\n // child object's __typename.\n let childTypename: string | undefined;\n\n // The field's value can be an object that has a __typename only if the\n // field has a selection set. Otherwise incomingValue is scalar.\n if (\n field.selectionSet &&\n (isReference(incomingValue) || storeValueIsStoreObject(incomingValue))\n ) {\n childTypename = readField(\"__typename\", incomingValue);\n }\n\n const merge = policies.getMergeFunction(\n typename,\n field.name.value,\n childTypename\n );\n\n if (merge) {\n childTree.info = {\n // TODO Check compatibility against any existing childTree.field?\n field,\n typename,\n merge,\n };\n } else {\n maybeRecycleChildMergeTree(mergeTree, storeFieldName);\n }\n\n incoming = context.merge(incoming, {\n [storeFieldName]: incomingValue,\n });\n } else if (\n __DEV__ &&\n !context.clientOnly &&\n !context.deferred &&\n !addTypenameToDocument.added(field) &&\n // If the field has a read function, it may be a synthetic field or\n // provide a default value, so its absence from the written data should\n // not be cause for alarm.\n !policies.getReadFunction(typename, field.name.value)\n ) {\n invariant.error(\n `Missing field '%s' while writing result %o`,\n resultKeyNameFromField(field),\n result\n );\n }\n });\n\n // Identify the result object, even if dataId was already provided,\n // since we always need keyObject below.\n try {\n const [id, keyObject] = policies.identify(result, {\n typename,\n selectionSet,\n fragmentMap: context.fragmentMap,\n storeObject: incoming,\n readField,\n });\n\n // If dataId was not provided, fall back to the id just generated by\n // policies.identify.\n dataId = dataId || id;\n\n // Write any key fields that were used during identification, even if\n // they were not mentioned in the original query.\n if (keyObject) {\n // TODO Reverse the order of the arguments?\n incoming = context.merge(incoming, keyObject);\n }\n } catch (e) {\n // If dataId was provided, tolerate failure of policies.identify.\n if (!dataId) throw e;\n }\n\n if (\"string\" === typeof dataId) {\n const dataRef = makeReference(dataId);\n\n // Avoid processing the same entity object using the same selection\n // set more than once. We use an array instead of a Set since most\n // entity IDs will be written using only one selection set, so the\n // size of this array is likely to be very small, meaning indexOf is\n // likely to be faster than Set.prototype.has.\n const sets = context.written[dataId] || (context.written[dataId] = []);\n if (sets.indexOf(selectionSet) >= 0) return dataRef;\n sets.push(selectionSet);\n\n // If we're about to write a result object into the store, but we\n // happen to know that the exact same (===) result object would be\n // returned if we were to reread the result with the same inputs,\n // then we can skip the rest of the processSelectionSet work for\n // this object, and immediately return a Reference to it.\n if (\n this.reader &&\n this.reader.isFresh(result, dataRef, selectionSet, context)\n ) {\n return dataRef;\n }\n\n const previous = context.incomingById.get(dataId);\n if (previous) {\n previous.storeObject = context.merge(previous.storeObject, incoming);\n previous.mergeTree = mergeMergeTrees(previous.mergeTree, mergeTree);\n fieldNodeSet.forEach((field) => previous.fieldNodeSet.add(field));\n } else {\n context.incomingById.set(dataId, {\n storeObject: incoming,\n // Save a reference to mergeTree only if it is not empty, because\n // empty MergeTrees may be recycled by maybeRecycleChildMergeTree and\n // reused for entirely different parts of the result tree.\n mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree,\n fieldNodeSet,\n });\n }\n\n return dataRef;\n }\n\n return incoming;\n }\n\n private processFieldValue(\n value: any,\n field: FieldNode,\n context: WriteContext,\n mergeTree: MergeTree\n ): StoreValue {\n if (!field.selectionSet || value === null) {\n // In development, we need to clone scalar values so that they can be\n // safely frozen with maybeDeepFreeze in readFromStore.ts. In production,\n // it's cheaper to store the scalar values directly in the cache.\n return __DEV__ ? cloneDeep(value) : value;\n }\n\n if (isArray(value)) {\n return value.map((item, i) => {\n const value = this.processFieldValue(\n item,\n field,\n context,\n getChildMergeTree(mergeTree, i)\n );\n maybeRecycleChildMergeTree(mergeTree, i);\n return value;\n });\n }\n\n return this.processSelectionSet({\n result: value,\n selectionSet: field.selectionSet,\n context,\n mergeTree,\n });\n }\n\n // Implements https://spec.graphql.org/draft/#sec-Field-Collection, but with\n // some additions for tracking @client and @defer directives.\n private flattenFields<\n TContext extends Pick<\n WriteContext,\n | \"clientOnly\"\n | \"deferred\"\n | \"flavors\"\n | \"fragmentMap\"\n | \"lookupFragment\"\n | \"variables\"\n >,\n >(\n selectionSet: SelectionSetNode,\n result: Record,\n context: TContext,\n typename = getTypenameFromResult(result, selectionSet, context.fragmentMap)\n ): Map {\n const fieldMap = new Map();\n const { policies } = this.cache;\n\n const limitingTrie = new Trie<{\n // Tracks whether (selectionSet, clientOnly, deferred) has been flattened\n // before. The GraphQL specification only uses the fragment name for\n // skipping previously visited fragments, but the top-level fragment\n // selection set corresponds 1:1 with the fagment name (and is slightly\n // easier too work with), and we need to consider clientOnly and deferred\n // values as well, potentially revisiting selection sets that were\n // previously visited with different inherited configurations of those\n // directives.\n visited?: boolean;\n }>(false); // No need for WeakMap, since limitingTrie does not escape.\n\n (function flatten(\n this: void,\n selectionSet: SelectionSetNode,\n inheritedContext: TContext\n ) {\n const visitedNode = limitingTrie.lookup(\n selectionSet,\n // Because we take inheritedClientOnly and inheritedDeferred into\n // consideration here (in addition to selectionSet), it's possible for\n // the same selection set to be flattened more than once, if it appears\n // in the query with different @client and/or @directive configurations.\n inheritedContext.clientOnly,\n inheritedContext.deferred\n );\n if (visitedNode.visited) return;\n visitedNode.visited = true;\n\n selectionSet.selections.forEach((selection) => {\n if (!shouldInclude(selection, context.variables)) return;\n\n let { clientOnly, deferred } = inheritedContext;\n if (\n // Since the presence of @client or @defer on this field can only\n // cause clientOnly or deferred to become true, we can skip the\n // forEach loop if both clientOnly and deferred are already true.\n !(clientOnly && deferred) &&\n isNonEmptyArray(selection.directives)\n ) {\n selection.directives.forEach((dir) => {\n const name = dir.name.value;\n if (name === \"client\") clientOnly = true;\n if (name === \"defer\") {\n const args = argumentsObjectFromField(dir, context.variables);\n // The @defer directive takes an optional args.if boolean\n // argument, similar to @include(if: boolean). Note that\n // @defer(if: false) does not make context.deferred false, but\n // instead behaves as if there was no @defer directive.\n if (!args || (args as { if?: boolean }).if !== false) {\n deferred = true;\n }\n // TODO In the future, we may want to record args.label using\n // context.deferred, if a label is specified.\n }\n });\n }\n\n if (isField(selection)) {\n const existing = fieldMap.get(selection);\n if (existing) {\n // If this field has been visited along another recursive path\n // before, the final context should have clientOnly or deferred set\n // to true only if *all* paths have the directive (hence the &&).\n clientOnly = clientOnly && existing.clientOnly;\n deferred = deferred && existing.deferred;\n }\n\n fieldMap.set(\n selection,\n getContextFlavor(context, clientOnly, deferred)\n );\n } else {\n const fragment = getFragmentFromSelection(\n selection,\n context.lookupFragment\n );\n\n if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {\n throw newInvariantError(\n `No fragment named %s`,\n selection.name.value\n );\n }\n\n if (\n fragment &&\n policies.fragmentMatches(\n fragment,\n typename,\n result,\n context.variables\n )\n ) {\n flatten(\n fragment.selectionSet,\n getContextFlavor(context, clientOnly, deferred)\n );\n }\n }\n });\n })(selectionSet, context);\n\n return fieldMap;\n }\n\n private applyMerges(\n mergeTree: MergeTree,\n existing: StoreValue,\n incoming: T,\n context: WriteContext,\n getStorageArgs?: Parameters\n ): T | Reference {\n if (mergeTree.map.size && !isReference(incoming)) {\n const e: StoreObject | Reference | undefined =\n // Items in the same position in different arrays are not\n // necessarily related to each other, so when incoming is an array\n // we process its elements as if there was no existing data.\n (\n !isArray(incoming) &&\n // Likewise, existing must be either a Reference or a StoreObject\n // in order for its fields to be safe to merge with the fields of\n // the incoming object.\n (isReference(existing) || storeValueIsStoreObject(existing))\n ) ?\n existing\n : void 0;\n\n // This narrowing is implied by mergeTree.map.size > 0 and\n // !isReference(incoming), though TypeScript understandably cannot\n // hope to infer this type.\n const i = incoming as StoreObject | StoreValue[];\n\n // The options.storage objects provided to read and merge functions\n // are derived from the identity of the parent object plus a\n // sequence of storeFieldName strings/numbers identifying the nested\n // field name path of each field value to be merged.\n if (e && !getStorageArgs) {\n getStorageArgs = [isReference(e) ? e.__ref : e];\n }\n\n // It's possible that applying merge functions to this subtree will\n // not change the incoming data, so this variable tracks the fields\n // that did change, so we can create a new incoming object when (and\n // only when) at least one incoming field has changed. We use a Map\n // to preserve the type of numeric keys.\n let changedFields: Map | undefined;\n\n const getValue = (\n from: typeof e | typeof i,\n name: string | number\n ): StoreValue => {\n return (\n isArray(from) ?\n typeof name === \"number\" ?\n from[name]\n : void 0\n : context.store.getFieldValue(from, String(name))\n );\n };\n\n mergeTree.map.forEach((childTree, storeFieldName) => {\n const eVal = getValue(e, storeFieldName);\n const iVal = getValue(i, storeFieldName);\n // If we have no incoming data, leave any existing data untouched.\n if (void 0 === iVal) return;\n if (getStorageArgs) {\n getStorageArgs.push(storeFieldName);\n }\n const aVal = this.applyMerges(\n childTree,\n eVal,\n iVal,\n context,\n getStorageArgs\n );\n if (aVal !== iVal) {\n changedFields = changedFields || new Map();\n changedFields.set(storeFieldName, aVal);\n }\n if (getStorageArgs) {\n invariant(getStorageArgs.pop() === storeFieldName);\n }\n });\n\n if (changedFields) {\n // Shallow clone i so we can add changed fields to it.\n incoming = (isArray(i) ? i.slice(0) : { ...i }) as T;\n changedFields.forEach((value, name) => {\n (incoming as any)[name] = value;\n });\n }\n }\n\n if (mergeTree.info) {\n return this.cache.policies.runMergeFunction(\n existing,\n incoming,\n mergeTree.info,\n context,\n getStorageArgs && context.store.getStorage(...getStorageArgs)\n );\n }\n\n return incoming;\n }\n}\n\nconst emptyMergeTreePool: MergeTree[] = [];\n\nfunction getChildMergeTree(\n { map }: MergeTree,\n name: string | number\n): MergeTree {\n if (!map.has(name)) {\n map.set(name, emptyMergeTreePool.pop() || { map: new Map() });\n }\n return map.get(name)!;\n}\n\nfunction mergeMergeTrees(\n left: MergeTree | undefined,\n right: MergeTree | undefined\n): MergeTree {\n if (left === right || !right || mergeTreeIsEmpty(right)) return left!;\n if (!left || mergeTreeIsEmpty(left)) return right;\n\n const info =\n left.info && right.info ?\n {\n ...left.info,\n ...right.info,\n }\n : left.info || right.info;\n\n const needToMergeMaps = left.map.size && right.map.size;\n const map =\n needToMergeMaps ? new Map()\n : left.map.size ? left.map\n : right.map;\n\n const merged = { info, map };\n\n if (needToMergeMaps) {\n const remainingRightKeys = new Set(right.map.keys());\n\n left.map.forEach((leftTree, key) => {\n merged.map.set(key, mergeMergeTrees(leftTree, right.map.get(key)));\n remainingRightKeys.delete(key);\n });\n\n remainingRightKeys.forEach((key) => {\n merged.map.set(\n key,\n mergeMergeTrees(right.map.get(key), left.map.get(key))\n );\n });\n }\n\n return merged;\n}\n\nfunction mergeTreeIsEmpty(tree: MergeTree | undefined): boolean {\n return !tree || !(tree.info || tree.map.size);\n}\n\nfunction maybeRecycleChildMergeTree({ map }: MergeTree, name: string | number) {\n const childTree = map.get(name);\n if (childTree && mergeTreeIsEmpty(childTree)) {\n emptyMergeTreePool.push(childTree);\n map.delete(name);\n }\n}\n\nconst warnings = new Set();\n\n// Note that this function is unused in production, and thus should be\n// pruned by any well-configured minifier.\nfunction warnAboutDataLoss(\n existingRef: Reference,\n incomingObj: StoreObject,\n storeFieldName: string,\n store: NormalizedCache\n) {\n const getChild = (objOrRef: StoreObject | Reference): StoreObject | false => {\n const child = store.getFieldValue(objOrRef, storeFieldName);\n return typeof child === \"object\" && child;\n };\n\n const existing = getChild(existingRef);\n if (!existing) return;\n\n const incoming = getChild(incomingObj);\n if (!incoming) return;\n\n // It's always safe to replace a reference, since it refers to data\n // safely stored elsewhere.\n if (isReference(existing)) return;\n\n // If the values are structurally equivalent, we do not need to worry\n // about incoming replacing existing.\n if (equal(existing, incoming)) return;\n\n // If we're replacing every key of the existing object, then the\n // existing data would be overwritten even if the objects were\n // normalized, so warning would not be helpful here.\n if (\n Object.keys(existing).every(\n (key) => store.getFieldValue(incoming, key) !== void 0\n )\n ) {\n return;\n }\n\n const parentType =\n store.getFieldValue(existingRef, \"__typename\") ||\n store.getFieldValue(incomingObj, \"__typename\");\n const fieldName = fieldNameFromStoreName(storeFieldName);\n const typeDotName = `${parentType}.${fieldName}`;\n // Avoid warning more than once for the same type and field name.\n if (warnings.has(typeDotName)) return;\n warnings.add(typeDotName);\n\n const childTypenames: string[] = [];\n // Arrays do not have __typename fields, and always need a custom merge\n // function, even if their elements are normalized entities.\n if (!isArray(existing) && !isArray(incoming)) {\n [existing, incoming].forEach((child) => {\n const typename = store.getFieldValue(child, \"__typename\");\n if (typeof typename === \"string\" && !childTypenames.includes(typename)) {\n childTypenames.push(typename);\n }\n });\n }\n\n invariant.warn(\n `Cache data may be lost when replacing the %s field of a %s object.\n\nThis could cause additional (usually avoidable) network requests to fetch data that were otherwise cached.\n\nTo address this problem (which is not a bug in Apollo Client), %sdefine a custom merge function for the %s field, so InMemoryCache can safely merge these objects:\n\n existing: %o\n incoming: %o\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n`,\n fieldName,\n parentType,\n childTypenames.length ?\n \"either ensure all objects of type \" +\n childTypenames.join(\" and \") +\n \" have an ID or a custom merge function, or \"\n : \"\",\n typeDotName,\n existing,\n incoming\n );\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/cache/package.json b/graphql-subscription/node_modules/@apollo/client/cache/package.json new file mode 100644 index 0000000..426bb2a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/cache/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/cache", + "type": "module", + "main": "cache.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/config/jest/setup.d.ts b/graphql-subscription/node_modules/@apollo/client/config/jest/setup.d.ts new file mode 100644 index 0000000..47aa013 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/config/jest/setup.d.ts @@ -0,0 +1,3 @@ +import "@testing-library/jest-dom"; +import "../../testing/matchers/index.js"; +//# sourceMappingURL=setup.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/config/jest/setup.js b/graphql-subscription/node_modules/@apollo/client/config/jest/setup.js new file mode 100644 index 0000000..c05ecb4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/config/jest/setup.js @@ -0,0 +1,25 @@ +import gql from "graphql-tag"; +import "@testing-library/jest-dom"; +import { loadErrorMessageHandler } from "../../dev/loadErrorMessageHandler.js"; +import "../../testing/matchers/index.js"; +// Turn off warnings for repeated fragment names +gql.disableFragmentWarnings(); +process.on("unhandledRejection", function () { }); +loadErrorMessageHandler(); +function fail(reason) { + if (reason === void 0) { reason = "fail was called in a test."; } + expect(reason).toBe(undefined); +} +// @ts-ignore +globalThis.fail = fail; +if (!Symbol.dispose) { + Object.defineProperty(Symbol, "dispose", { + value: Symbol("dispose"), + }); +} +if (!Symbol.asyncDispose) { + Object.defineProperty(Symbol, "asyncDispose", { + value: Symbol("asyncDispose"), + }); +} +//# sourceMappingURL=setup.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/config/jest/setup.js.map b/graphql-subscription/node_modules/@apollo/client/config/jest/setup.js.map new file mode 100644 index 0000000..bbd0a01 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/config/jest/setup.js.map @@ -0,0 +1 @@ +{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/config/jest/setup.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,iCAAiC,CAAC;AAEzC,gDAAgD;AAChD,GAAG,CAAC,uBAAuB,EAAE,CAAC;AAE9B,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,cAAO,CAAC,CAAC,CAAC;AAE3C,uBAAuB,EAAE,CAAC;AAE1B,SAAS,IAAI,CAAC,MAAqC;IAArC,uBAAA,EAAA,qCAAqC;IACjD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED,aAAa;AACb,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;AAEvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACpB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE;QACvC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC;KACzB,CAAC,CAAC;AACL,CAAC;AACD,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE;QAC5C,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import gql from \"graphql-tag\";\nimport \"@testing-library/jest-dom\";\nimport { loadErrorMessageHandler } from \"../../dev/loadErrorMessageHandler.js\";\nimport \"../../testing/matchers/index.js\";\n\n// Turn off warnings for repeated fragment names\ngql.disableFragmentWarnings();\n\nprocess.on(\"unhandledRejection\", () => {});\n\nloadErrorMessageHandler();\n\nfunction fail(reason = \"fail was called in a test.\") {\n expect(reason).toBe(undefined);\n}\n\n// @ts-ignore\nglobalThis.fail = fail;\n\nif (!Symbol.dispose) {\n Object.defineProperty(Symbol, \"dispose\", {\n value: Symbol(\"dispose\"),\n });\n}\nif (!Symbol.asyncDispose) {\n Object.defineProperty(Symbol, \"asyncDispose\", {\n value: Symbol(\"asyncDispose\"),\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.d.ts b/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.d.ts new file mode 100644 index 0000000..fff1592 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.d.ts @@ -0,0 +1,430 @@ +import type { ExecutionResult, DocumentNode } from "graphql"; +import type { FetchResult, GraphQLRequest } from "../link/core/index.js"; +import { ApolloLink } from "../link/core/index.js"; +import type { ApolloCache, DataProxy, Reference } from "../cache/index.js"; +import type { DocumentTransform, Observable } from "../utilities/index.js"; +import type { UriFunction } from "../link/http/index.js"; +import type { ObservableQuery } from "./ObservableQuery.js"; +import type { ApolloQueryResult, DefaultContext, OperationVariables, Resolvers, RefetchQueriesOptions, RefetchQueriesResult, RefetchQueriesInclude } from "./types.js"; +import type { QueryOptions, WatchQueryOptions, MutationOptions, SubscriptionOptions } from "./watchQueryOptions.js"; +import type { FragmentMatcher } from "./LocalState.js"; +export interface DefaultOptions { + watchQuery?: Partial>; + query?: Partial>; + mutate?: Partial>; +} +export interface ApolloClientOptions { + /** + * The URI of the GraphQL endpoint that Apollo Client will communicate with. + * + * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence. + */ + uri?: string | UriFunction; + credentials?: string; + /** + * An object representing headers to include in every HTTP request, such as `{Authorization: 'Bearer 1234'}` + * + * This value will be ignored when using the `link` option. + */ + headers?: Record; + /** + * You can provide an {@link ApolloLink} instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/). + * + * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence. + */ + link?: ApolloLink; + /** + * The cache that Apollo Client should use to store query results locally. The recommended cache is `InMemoryCache`, which is provided by the `@apollo/client` package. + * + * For more information, see [Configuring the cache](https://www.apollographql.com/docs/react/caching/cache-configuration/). + */ + cache: ApolloCache; + /** + * The time interval (in milliseconds) before Apollo Client force-fetches queries after a server-side render. + * + * @defaultValue `0` (no delay) + */ + ssrForceFetchDelay?: number; + /** + * When using Apollo Client for [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/), set this to `true` so that the [`getDataFromTree` function](../react/ssr/#getdatafromtree) can work effectively. + * + * @defaultValue `false` + */ + ssrMode?: boolean; + /** + * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to Apollo Client. + * + * The default value is `false` in production and `true` in development (if there is a `window` object). + */ + connectToDevTools?: boolean; + /** + * If `false`, Apollo Client sends every created query to the server, even if a _completely_ identical query (identical in terms of query string, variable values, and operationName) is already in flight. + * + * @defaultValue `true` + */ + queryDeduplication?: boolean; + /** + * Provide this object to set application-wide default values for options you can provide to the `watchQuery`, `query`, and `mutate` functions. See below for an example object. + * + * See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object). + */ + defaultOptions?: DefaultOptions; + defaultContext?: Partial; + /** + * If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations. + * + * @defaultValue `false` + */ + assumeImmutableResults?: boolean; + resolvers?: Resolvers | Resolvers[]; + typeDefs?: string | string[] | DocumentNode | DocumentNode[]; + fragmentMatcher?: FragmentMatcher; + /** + * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature. + */ + name?: string; + /** + * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature. + * + * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client. + */ + version?: string; + documentTransform?: DocumentTransform; +} +import { mergeOptions } from "../utilities/index.js"; +import { getApolloClientMemoryInternals } from "../utilities/caching/getMemoryInternals.js"; +export { mergeOptions }; +/** + * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries + * and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance, + * receive results from the server and cache the results in a store. It also delivers updates + * to GraphQL queries through {@link Observable} instances. + */ +export declare class ApolloClient implements DataProxy { + link: ApolloLink; + cache: ApolloCache; + disableNetworkFetches: boolean; + version: string; + queryDeduplication: boolean; + defaultOptions: DefaultOptions; + readonly typeDefs: ApolloClientOptions["typeDefs"]; + private queryManager; + private devToolsHookCb?; + private resetStoreCallbacks; + private clearStoreCallbacks; + private localState; + /** + * Constructs an instance of {@link ApolloClient}. + * + * @example + * ```js + * import { ApolloClient, InMemoryCache } from '@apollo/client'; + * + * const cache = new InMemoryCache(); + * + * const client = new ApolloClient({ + * // Provide required constructor fields + * cache: cache, + * uri: 'http://localhost:4000/', + * + * // Provide some optional constructor fields + * name: 'react-web-client', + * version: '1.3', + * queryDeduplication: false, + * defaultOptions: { + * watchQuery: { + * fetchPolicy: 'cache-and-network', + * }, + * }, + * }); + * ``` + */ + constructor(options: ApolloClientOptions); + private connectToDevTools; + /** + * The `DocumentTransform` used to modify GraphQL documents before a request + * is made. If a custom `DocumentTransform` is not provided, this will be the + * default document transform. + */ + get documentTransform(): DocumentTransform; + /** + * Call this method to terminate any active client processes, making it safe + * to dispose of this `ApolloClient` instance. + */ + stop(): void; + /** + * This watches the cache store of the query according to the options specified and + * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and + * receive updated results through a GraphQL observer when the cache store changes. + * + * Note that this method is not an implementation of GraphQL subscriptions. Rather, + * it uses Apollo's store in order to reactively deliver updates to your query results. + * + * For example, suppose you call watchQuery on a GraphQL query that fetches a person's + * first and last name and this person has a particular object identifier, provided by + * dataIdFromObject. Later, a different query fetches that same person's + * first and last name and the first name has now changed. Then, any observers associated + * with the results of the first query will be updated with a new result object. + * + * Note that if the cache does not change, the subscriber will *not* be notified. + * + * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for + * a description of store reactivity. + */ + watchQuery(options: WatchQueryOptions): ObservableQuery; + /** + * This resolves a single query according to the options specified and + * returns a `Promise` which is either resolved with the resulting data + * or rejected with an error. + * + * @param options - An object of type {@link QueryOptions} that allows us to + * describe how this query should be treated e.g. whether it should hit the + * server at all or just resolve from the cache, etc. + */ + query(options: QueryOptions): Promise>; + /** + * This resolves a single mutation according to the options specified and returns a + * Promise which is either resolved with the resulting data or rejected with an + * error. In some cases both `data` and `errors` might be undefined, for example + * when `errorPolicy` is set to `'ignore'`. + * + * It takes options as an object with the following keys and values: + */ + mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + /** + * This subscribes to a graphql subscription according to the options specified and returns an + * {@link Observable} which either emits received data or an error. + */ + subscribe(options: SubscriptionOptions): Observable>; + /** + * Tries to read some data from the store in the shape of the provided + * GraphQL query without making a network request. This method will start at + * the root query. To start at a specific id returned by `dataIdFromObject` + * use `readFragment`. + * + * @param optimistic - Set to `true` to allow `readQuery` to return + * optimistic results. Is `false` by default. + */ + readQuery(options: DataProxy.Query, optimistic?: boolean): T | null; + /** + * Tries to read some data from the store in the shape of the provided + * GraphQL fragment without making a network request. This method will read a + * GraphQL fragment from any arbitrary id that is currently cached, unlike + * `readQuery` which will only read from the root query. + * + * You must pass in a GraphQL document with a single fragment or a document + * with multiple fragments that represent what you are reading. If you pass + * in a document with multiple fragments then you must also specify a + * `fragmentName`. + * + * @param optimistic - Set to `true` to allow `readFragment` to return + * optimistic results. Is `false` by default. + */ + readFragment(options: DataProxy.Fragment, optimistic?: boolean): T | null; + /** + * Writes some data in the shape of the provided GraphQL query directly to + * the store. This method will start at the root query. To start at a + * specific id returned by `dataIdFromObject` then use `writeFragment`. + */ + writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; + /** + * Writes some data in the shape of the provided GraphQL fragment directly to + * the store. This method will write to a GraphQL fragment from any arbitrary + * id that is currently cached, unlike `writeQuery` which will only write + * from the root query. + * + * You must pass in a GraphQL document with a single fragment or a document + * with multiple fragments that represent what you are writing. If you pass + * in a document with multiple fragments then you must also specify a + * `fragmentName`. + */ + writeFragment(options: DataProxy.WriteFragmentOptions): Reference | undefined; + __actionHookForDevTools(cb: () => any): void; + __requestRaw(payload: GraphQLRequest): Observable; + /** + * Resets your entire store by clearing out your cache and then re-executing + * all of your active queries. This makes it so that you may guarantee that + * there is no data left in your store from a time before you called this + * method. + * + * `resetStore()` is useful when your user just logged out. You’ve removed the + * user session, and you now want to make sure that any references to data you + * might have fetched while the user session was active is gone. + * + * It is important to remember that `resetStore()` *will* refetch any active + * queries. This means that any components that might be mounted will execute + * their queries again using your network interface. If you do not want to + * re-execute any queries then you should make sure to stop watching any + * active queries. + */ + resetStore(): Promise[] | null>; + /** + * Remove all data from the store. Unlike `resetStore`, `clearStore` will + * not refetch any active queries. + */ + clearStore(): Promise; + /** + * Allows callbacks to be registered that are executed when the store is + * reset. `onResetStore` returns an unsubscribe function that can be used + * to remove registered callbacks. + */ + onResetStore(cb: () => Promise): () => void; + /** + * Allows callbacks to be registered that are executed when the store is + * cleared. `onClearStore` returns an unsubscribe function that can be used + * to remove registered callbacks. + */ + onClearStore(cb: () => Promise): () => void; + /** + * Refetches all of your active queries. + * + * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage + * + * It is important to remember that `reFetchObservableQueries()` *will* refetch any active + * queries. This means that any components that might be mounted will execute + * their queries again using your network interface. If you do not want to + * re-execute any queries then you should make sure to stop watching any + * active queries. + * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching. + */ + reFetchObservableQueries(includeStandby?: boolean): Promise[]>; + /** + * Refetches specified active queries. Similar to "reFetchObservableQueries()" but with a specific list of queries. + * + * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries. + * + * It is important to remember that `refetchQueries()` *will* refetch specified active + * queries. This means that any components that might be mounted will execute + * their queries again using your network interface. If you do not want to + * re-execute any queries then you should make sure to stop watching any + * active queries. + */ + refetchQueries = ApolloCache, TResult = Promise>>(options: RefetchQueriesOptions): RefetchQueriesResult; + /** + * Get all currently active `ObservableQuery` objects, in a `Map` keyed by + * query ID strings. + * + * An "active" query is one that has observers and a `fetchPolicy` other than + * "standby" or "cache-only". + * + * You can include all `ObservableQuery` objects (including the inactive ones) + * by passing "all" instead of "active", or you can include just a subset of + * active queries by passing an array of query names or DocumentNode objects. + */ + getObservableQueries(include?: RefetchQueriesInclude): Map>; + /** + * Exposes the cache's complete state, in a serializable format for later restoration. + */ + extract(optimistic?: boolean): TCacheShape; + /** + * Replaces existing state in the cache (if any) with the values expressed by + * `serializedState`. + * + * Called when hydrating a cache (server side rendering, or offline storage), + * and also (potentially) during hot reloads. + */ + restore(serializedState: TCacheShape): ApolloCache; + /** + * Add additional local resolvers. + */ + addResolvers(resolvers: Resolvers | Resolvers[]): void; + /** + * Set (override existing) local resolvers. + */ + setResolvers(resolvers: Resolvers | Resolvers[]): void; + /** + * Get all registered local resolvers. + */ + getResolvers(): Resolvers; + /** + * Set a custom local state fragment matcher. + */ + setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher): void; + /** + * Define a new ApolloLink (or link chain) that Apollo Client will use. + */ + setLink(newLink: ApolloLink): void; + get defaultContext(): Partial; + /** + * @experimental + * This is not a stable API - it is used in development builds to expose + * information to the DevTools. + * Use at your own risk! + * For more details, see [Memory Management](https://www.apollographql.com/docs/react/caching/memory-management/#measuring-cache-usage) + * + * @example + * ```ts + * console.log(client.getMemoryInternals()) + * ``` + * Logs output in the following JSON format: + * @example + * ```json + *{ + * limits: { + * parser: 1000, + * canonicalStringify: 1000, + * print: 2000, + * 'documentTransform.cache': 2000, + * 'queryManager.getDocumentInfo': 2000, + * 'PersistedQueryLink.persistedQueryHashes': 2000, + * 'fragmentRegistry.transform': 2000, + * 'fragmentRegistry.lookup': 1000, + * 'fragmentRegistry.findFragmentSpreads': 4000, + * 'cache.fragmentQueryDocuments': 1000, + * 'removeTypenameFromVariables.getVariableDefinitions': 2000, + * 'inMemoryCache.maybeBroadcastWatch': 5000, + * 'inMemoryCache.executeSelectionSet': 10000, + * 'inMemoryCache.executeSubSelectedArray': 5000 + * }, + * sizes: { + * parser: 26, + * canonicalStringify: 4, + * print: 14, + * addTypenameDocumentTransform: [ + * { + * cache: 14, + * }, + * ], + * queryManager: { + * getDocumentInfo: 14, + * documentTransforms: [ + * { + * cache: 14, + * }, + * { + * cache: 14, + * }, + * ], + * }, + * fragmentRegistry: { + * findFragmentSpreads: 34, + * lookup: 20, + * transform: 14, + * }, + * cache: { + * fragmentQueryDocuments: 22, + * }, + * inMemoryCache: { + * executeSelectionSet: 4345, + * executeSubSelectedArray: 1206, + * maybeBroadcastWatch: 32, + * }, + * links: [ + * { + * PersistedQueryLink: { + * persistedQueryHashes: 14, + * }, + * }, + * { + * removeTypenameFromVariables: { + * getVariableDefinitions: 14, + * }, + * }, + * ], + * }, + * } + *``` + */ + getMemoryInternals?: typeof getApolloClientMemoryInternals; +} +//# sourceMappingURL=ApolloClient.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js b/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js new file mode 100644 index 0000000..1c646ff --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js @@ -0,0 +1,508 @@ +import { __assign } from "tslib"; +import { invariant, newInvariantError } from "../utilities/globals/index.js"; +import { ApolloLink, execute } from "../link/core/index.js"; +import { version } from "../version.js"; +import { HttpLink } from "../link/http/index.js"; +import { QueryManager } from "./QueryManager.js"; +import { LocalState } from "./LocalState.js"; +var hasSuggestedDevtools = false; +// Though mergeOptions now resides in @apollo/client/utilities, it was +// previously declared and exported from this module, and then reexported from +// @apollo/client/core. Since we need to preserve that API anyway, the easiest +// solution is to reexport mergeOptions where it was previously declared (here). +import { mergeOptions } from "../utilities/index.js"; +import { getApolloClientMemoryInternals } from "../utilities/caching/getMemoryInternals.js"; +export { mergeOptions }; +/** + * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries + * and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance, + * receive results from the server and cache the results in a store. It also delivers updates + * to GraphQL queries through {@link Observable} instances. + */ +var ApolloClient = /** @class */ (function () { + /** + * Constructs an instance of {@link ApolloClient}. + * + * @example + * ```js + * import { ApolloClient, InMemoryCache } from '@apollo/client'; + * + * const cache = new InMemoryCache(); + * + * const client = new ApolloClient({ + * // Provide required constructor fields + * cache: cache, + * uri: 'http://localhost:4000/', + * + * // Provide some optional constructor fields + * name: 'react-web-client', + * version: '1.3', + * queryDeduplication: false, + * defaultOptions: { + * watchQuery: { + * fetchPolicy: 'cache-and-network', + * }, + * }, + * }); + * ``` + */ + function ApolloClient(options) { + var _this = this; + this.resetStoreCallbacks = []; + this.clearStoreCallbacks = []; + if (!options.cache) { + throw newInvariantError(15); + } + var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, + // Expose the client instance as window.__APOLLO_CLIENT__ and call + // onBroadcast in queryManager.broadcastQueries to enable browser + // devtools, but disable them by default in production. + _c = options.connectToDevTools, + // Expose the client instance as window.__APOLLO_CLIENT__ and call + // onBroadcast in queryManager.broadcastQueries to enable browser + // devtools, but disable them by default in production. + connectToDevTools = _c === void 0 ? typeof window === "object" && + !window.__APOLLO_CLIENT__ && + globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; + var link = options.link; + if (!link) { + link = + uri ? new HttpLink({ uri: uri, credentials: credentials, headers: headers }) : ApolloLink.empty(); + } + this.link = link; + this.cache = cache; + this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; + this.queryDeduplication = queryDeduplication; + this.defaultOptions = defaultOptions || Object.create(null); + this.typeDefs = typeDefs; + if (ssrForceFetchDelay) { + setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); + } + this.watchQuery = this.watchQuery.bind(this); + this.query = this.query.bind(this); + this.mutate = this.mutate.bind(this); + this.resetStore = this.resetStore.bind(this); + this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); + this.version = version; + this.localState = new LocalState({ + cache: cache, + client: this, + resolvers: resolvers, + fragmentMatcher: fragmentMatcher, + }); + this.queryManager = new QueryManager({ + cache: this.cache, + link: this.link, + defaultOptions: this.defaultOptions, + defaultContext: defaultContext, + documentTransform: documentTransform, + queryDeduplication: queryDeduplication, + ssrMode: ssrMode, + clientAwareness: { + name: clientAwarenessName, + version: clientAwarenessVersion, + }, + localState: this.localState, + assumeImmutableResults: assumeImmutableResults, + onBroadcast: connectToDevTools ? + function () { + if (_this.devToolsHookCb) { + _this.devToolsHookCb({ + action: {}, + state: { + queries: _this.queryManager.getQueryStore(), + mutations: _this.queryManager.mutationStore || {}, + }, + dataWithOptimisticResults: _this.cache.extract(true), + }); + } + } + : void 0, + }); + if (connectToDevTools) + this.connectToDevTools(); + } + ApolloClient.prototype.connectToDevTools = function () { + if (typeof window === "object") { + var windowWithDevTools = window; + var devtoolsSymbol = Symbol.for("apollo.devtools"); + (windowWithDevTools[devtoolsSymbol] = + windowWithDevTools[devtoolsSymbol] || []).push(this); + windowWithDevTools.__APOLLO_CLIENT__ = this; + } + /** + * Suggest installing the devtools for developers who don't have them + */ + if (!hasSuggestedDevtools && globalThis.__DEV__ !== false) { + hasSuggestedDevtools = true; + setTimeout(function () { + if (typeof window !== "undefined" && + window.document && + window.top === window.self && + !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) { + var nav = window.navigator; + var ua = nav && nav.userAgent; + var url = void 0; + if (typeof ua === "string") { + if (ua.indexOf("Chrome/") > -1) { + url = + "https://chrome.google.com/webstore/detail/" + + "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm"; + } + else if (ua.indexOf("Firefox/") > -1) { + url = + "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/"; + } + } + if (url) { + globalThis.__DEV__ !== false && invariant.log("Download the Apollo DevTools for a better development " + + "experience: %s", url); + } + } + }, 10000); + } + }; + Object.defineProperty(ApolloClient.prototype, "documentTransform", { + /** + * The `DocumentTransform` used to modify GraphQL documents before a request + * is made. If a custom `DocumentTransform` is not provided, this will be the + * default document transform. + */ + get: function () { + return this.queryManager.documentTransform; + }, + enumerable: false, + configurable: true + }); + /** + * Call this method to terminate any active client processes, making it safe + * to dispose of this `ApolloClient` instance. + */ + ApolloClient.prototype.stop = function () { + this.queryManager.stop(); + }; + /** + * This watches the cache store of the query according to the options specified and + * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and + * receive updated results through a GraphQL observer when the cache store changes. + * + * Note that this method is not an implementation of GraphQL subscriptions. Rather, + * it uses Apollo's store in order to reactively deliver updates to your query results. + * + * For example, suppose you call watchQuery on a GraphQL query that fetches a person's + * first and last name and this person has a particular object identifier, provided by + * dataIdFromObject. Later, a different query fetches that same person's + * first and last name and the first name has now changed. Then, any observers associated + * with the results of the first query will be updated with a new result object. + * + * Note that if the cache does not change, the subscriber will *not* be notified. + * + * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for + * a description of store reactivity. + */ + ApolloClient.prototype.watchQuery = function (options) { + if (this.defaultOptions.watchQuery) { + options = mergeOptions(this.defaultOptions.watchQuery, options); + } + // XXX Overwriting options is probably not the best way to do this long term... + if (this.disableNetworkFetches && + (options.fetchPolicy === "network-only" || + options.fetchPolicy === "cache-and-network")) { + options = __assign(__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.watchQuery(options); + }; + /** + * This resolves a single query according to the options specified and + * returns a `Promise` which is either resolved with the resulting data + * or rejected with an error. + * + * @param options - An object of type {@link QueryOptions} that allows us to + * describe how this query should be treated e.g. whether it should hit the + * server at all or just resolve from the cache, etc. + */ + ApolloClient.prototype.query = function (options) { + if (this.defaultOptions.query) { + options = mergeOptions(this.defaultOptions.query, options); + } + invariant(options.fetchPolicy !== "cache-and-network", 16); + if (this.disableNetworkFetches && options.fetchPolicy === "network-only") { + options = __assign(__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.query(options); + }; + /** + * This resolves a single mutation according to the options specified and returns a + * Promise which is either resolved with the resulting data or rejected with an + * error. In some cases both `data` and `errors` might be undefined, for example + * when `errorPolicy` is set to `'ignore'`. + * + * It takes options as an object with the following keys and values: + */ + ApolloClient.prototype.mutate = function (options) { + if (this.defaultOptions.mutate) { + options = mergeOptions(this.defaultOptions.mutate, options); + } + return this.queryManager.mutate(options); + }; + /** + * This subscribes to a graphql subscription according to the options specified and returns an + * {@link Observable} which either emits received data or an error. + */ + ApolloClient.prototype.subscribe = function (options) { + return this.queryManager.startGraphQLSubscription(options); + }; + /** + * Tries to read some data from the store in the shape of the provided + * GraphQL query without making a network request. This method will start at + * the root query. To start at a specific id returned by `dataIdFromObject` + * use `readFragment`. + * + * @param optimistic - Set to `true` to allow `readQuery` to return + * optimistic results. Is `false` by default. + */ + ApolloClient.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readQuery(options, optimistic); + }; + /** + * Tries to read some data from the store in the shape of the provided + * GraphQL fragment without making a network request. This method will read a + * GraphQL fragment from any arbitrary id that is currently cached, unlike + * `readQuery` which will only read from the root query. + * + * You must pass in a GraphQL document with a single fragment or a document + * with multiple fragments that represent what you are reading. If you pass + * in a document with multiple fragments then you must also specify a + * `fragmentName`. + * + * @param optimistic - Set to `true` to allow `readFragment` to return + * optimistic results. Is `false` by default. + */ + ApolloClient.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readFragment(options, optimistic); + }; + /** + * Writes some data in the shape of the provided GraphQL query directly to + * the store. This method will start at the root query. To start at a + * specific id returned by `dataIdFromObject` then use `writeFragment`. + */ + ApolloClient.prototype.writeQuery = function (options) { + var ref = this.cache.writeQuery(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + /** + * Writes some data in the shape of the provided GraphQL fragment directly to + * the store. This method will write to a GraphQL fragment from any arbitrary + * id that is currently cached, unlike `writeQuery` which will only write + * from the root query. + * + * You must pass in a GraphQL document with a single fragment or a document + * with multiple fragments that represent what you are writing. If you pass + * in a document with multiple fragments then you must also specify a + * `fragmentName`. + */ + ApolloClient.prototype.writeFragment = function (options) { + var ref = this.cache.writeFragment(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + ApolloClient.prototype.__actionHookForDevTools = function (cb) { + this.devToolsHookCb = cb; + }; + ApolloClient.prototype.__requestRaw = function (payload) { + return execute(this.link, payload); + }; + /** + * Resets your entire store by clearing out your cache and then re-executing + * all of your active queries. This makes it so that you may guarantee that + * there is no data left in your store from a time before you called this + * method. + * + * `resetStore()` is useful when your user just logged out. You’ve removed the + * user session, and you now want to make sure that any references to data you + * might have fetched while the user session was active is gone. + * + * It is important to remember that `resetStore()` *will* refetch any active + * queries. This means that any components that might be mounted will execute + * their queries again using your network interface. If you do not want to + * re-execute any queries then you should make sure to stop watching any + * active queries. + */ + ApolloClient.prototype.resetStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: false, + }); + }) + .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) + .then(function () { return _this.reFetchObservableQueries(); }); + }; + /** + * Remove all data from the store. Unlike `resetStore`, `clearStore` will + * not refetch any active queries. + */ + ApolloClient.prototype.clearStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: true, + }); + }) + .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); + }; + /** + * Allows callbacks to be registered that are executed when the store is + * reset. `onResetStore` returns an unsubscribe function that can be used + * to remove registered callbacks. + */ + ApolloClient.prototype.onResetStore = function (cb) { + var _this = this; + this.resetStoreCallbacks.push(cb); + return function () { + _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + /** + * Allows callbacks to be registered that are executed when the store is + * cleared. `onClearStore` returns an unsubscribe function that can be used + * to remove registered callbacks. + */ + ApolloClient.prototype.onClearStore = function (cb) { + var _this = this; + this.clearStoreCallbacks.push(cb); + return function () { + _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + /** + * Refetches all of your active queries. + * + * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage + * + * It is important to remember that `reFetchObservableQueries()` *will* refetch any active + * queries. This means that any components that might be mounted will execute + * their queries again using your network interface. If you do not want to + * re-execute any queries then you should make sure to stop watching any + * active queries. + * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching. + */ + ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { + return this.queryManager.reFetchObservableQueries(includeStandby); + }; + /** + * Refetches specified active queries. Similar to "reFetchObservableQueries()" but with a specific list of queries. + * + * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries. + * + * It is important to remember that `refetchQueries()` *will* refetch specified active + * queries. This means that any components that might be mounted will execute + * their queries again using your network interface. If you do not want to + * re-execute any queries then you should make sure to stop watching any + * active queries. + */ + ApolloClient.prototype.refetchQueries = function (options) { + var map = this.queryManager.refetchQueries(options); + var queries = []; + var results = []; + map.forEach(function (result, obsQuery) { + queries.push(obsQuery); + results.push(result); + }); + var result = Promise.all(results); + // In case you need the raw results immediately, without awaiting + // Promise.all(results): + result.queries = queries; + result.results = results; + // If you decide to ignore the result Promise because you're using + // result.queries and result.results instead, you shouldn't have to worry + // about preventing uncaught rejections for the Promise.all result. + result.catch(function (error) { + globalThis.__DEV__ !== false && invariant.debug(17, error); + }); + return result; + }; + /** + * Get all currently active `ObservableQuery` objects, in a `Map` keyed by + * query ID strings. + * + * An "active" query is one that has observers and a `fetchPolicy` other than + * "standby" or "cache-only". + * + * You can include all `ObservableQuery` objects (including the inactive ones) + * by passing "all" instead of "active", or you can include just a subset of + * active queries by passing an array of query names or DocumentNode objects. + */ + ApolloClient.prototype.getObservableQueries = function (include) { + if (include === void 0) { include = "active"; } + return this.queryManager.getObservableQueries(include); + }; + /** + * Exposes the cache's complete state, in a serializable format for later restoration. + */ + ApolloClient.prototype.extract = function (optimistic) { + return this.cache.extract(optimistic); + }; + /** + * Replaces existing state in the cache (if any) with the values expressed by + * `serializedState`. + * + * Called when hydrating a cache (server side rendering, or offline storage), + * and also (potentially) during hot reloads. + */ + ApolloClient.prototype.restore = function (serializedState) { + return this.cache.restore(serializedState); + }; + /** + * Add additional local resolvers. + */ + ApolloClient.prototype.addResolvers = function (resolvers) { + this.localState.addResolvers(resolvers); + }; + /** + * Set (override existing) local resolvers. + */ + ApolloClient.prototype.setResolvers = function (resolvers) { + this.localState.setResolvers(resolvers); + }; + /** + * Get all registered local resolvers. + */ + ApolloClient.prototype.getResolvers = function () { + return this.localState.getResolvers(); + }; + /** + * Set a custom local state fragment matcher. + */ + ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { + this.localState.setFragmentMatcher(fragmentMatcher); + }; + /** + * Define a new ApolloLink (or link chain) that Apollo Client will use. + */ + ApolloClient.prototype.setLink = function (newLink) { + this.link = this.queryManager.link = newLink; + }; + Object.defineProperty(ApolloClient.prototype, "defaultContext", { + get: function () { + return this.queryManager.defaultContext; + }, + enumerable: false, + configurable: true + }); + return ApolloClient; +}()); +export { ApolloClient }; +if (globalThis.__DEV__ !== false) { + ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals; +} +//# sourceMappingURL=ApolloClient.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js.map b/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js.map new file mode 100644 index 0000000..33149bc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/ApolloClient.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ApolloClient.js","sourceRoot":"","sources":["../../src/core/ApolloClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAuBjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,IAAI,oBAAoB,GAAG,KAAK,CAAC;AAiFjC,sEAAsE;AACtE,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;;GAKG;AACH;IAeE;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,sBAAY,OAAyC;QAArD,iBAsGC;QApIO,wBAAmB,GAA8B,EAAE,CAAC;QACpD,wBAAmB,GAA8B,EAAE,CAAC;QA8B1D,IAAI,CAAC,OAAO,CAAC,KAAK,EA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Y,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,8BAAO,GAAd,UAAe,UAAoB;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACI,8BAAO,GAAd,UAAe,eAA4B;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,mCAAY,GAAnB,UAAoB,SAAkC;QACpD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,mCAAY,GAAnB,UAAoB,SAAkC;QACpD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,mCAAY,GAAnB;QACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;OAEG;IACI,mDAA4B,GAAnC,UAAoC,eAAgC;QAClE,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,8BAAO,GAAd,UAAe,OAAmB;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC;IAC/C,CAAC;IAED,sBAAW,wCAAc;aAAzB;YACE,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;QAC1C,CAAC;;;OAAA;IAmFH,mBAAC;AAAD,CAAC,AA3rBD,IA2rBC;;AAED,IAAI,OAAO,EAAE,CAAC;IACZ,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,8BAA8B,CAAC;AAC7E,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../utilities/globals/index.js\";\n\nimport type { ExecutionResult, DocumentNode } from \"graphql\";\n\nimport type { FetchResult, GraphQLRequest } from \"../link/core/index.js\";\nimport { ApolloLink, execute } from \"../link/core/index.js\";\nimport type { ApolloCache, DataProxy, Reference } from \"../cache/index.js\";\nimport type { DocumentTransform, Observable } from \"../utilities/index.js\";\nimport { version } from \"../version.js\";\nimport type { UriFunction } from \"../link/http/index.js\";\nimport { HttpLink } from \"../link/http/index.js\";\n\nimport { QueryManager } from \"./QueryManager.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nimport type {\n ApolloQueryResult,\n DefaultContext,\n OperationVariables,\n Resolvers,\n RefetchQueriesOptions,\n RefetchQueriesResult,\n InternalRefetchQueriesResult,\n RefetchQueriesInclude,\n} from \"./types.js\";\n\nimport type {\n QueryOptions,\n WatchQueryOptions,\n MutationOptions,\n SubscriptionOptions,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\n\nimport type { FragmentMatcher } from \"./LocalState.js\";\nimport { LocalState } from \"./LocalState.js\";\n\nexport interface DefaultOptions {\n watchQuery?: Partial>;\n query?: Partial>;\n mutate?: Partial>;\n}\n\nlet hasSuggestedDevtools = false;\n\nexport interface ApolloClientOptions {\n /**\n * The URI of the GraphQL endpoint that Apollo Client will communicate with.\n *\n * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.\n */\n uri?: string | UriFunction;\n credentials?: string;\n /**\n * An object representing headers to include in every HTTP request, such as `{Authorization: 'Bearer 1234'}`\n *\n * This value will be ignored when using the `link` option.\n */\n headers?: Record;\n /**\n * You can provide an {@link ApolloLink} instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).\n *\n * One of `uri` or `link` is **required**. If you provide both, `link` takes precedence.\n */\n link?: ApolloLink;\n /**\n * The cache that Apollo Client should use to store query results locally. The recommended cache is `InMemoryCache`, which is provided by the `@apollo/client` package.\n *\n * For more information, see [Configuring the cache](https://www.apollographql.com/docs/react/caching/cache-configuration/).\n */\n cache: ApolloCache;\n /**\n * The time interval (in milliseconds) before Apollo Client force-fetches queries after a server-side render.\n *\n * @defaultValue `0` (no delay)\n */\n ssrForceFetchDelay?: number;\n /**\n * When using Apollo Client for [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/), set this to `true` so that the [`getDataFromTree` function](../react/ssr/#getdatafromtree) can work effectively.\n *\n * @defaultValue `false`\n */\n ssrMode?: boolean;\n /**\n * If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to Apollo Client.\n *\n * The default value is `false` in production and `true` in development (if there is a `window` object).\n */\n connectToDevTools?: boolean;\n /**\n * If `false`, Apollo Client sends every created query to the server, even if a _completely_ identical query (identical in terms of query string, variable values, and operationName) is already in flight.\n *\n * @defaultValue `true`\n */\n queryDeduplication?: boolean;\n /**\n * Provide this object to set application-wide default values for options you can provide to the `watchQuery`, `query`, and `mutate` functions. See below for an example object.\n *\n * See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object).\n */\n defaultOptions?: DefaultOptions;\n defaultContext?: Partial;\n /**\n * If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations.\n *\n * @defaultValue `false`\n */\n assumeImmutableResults?: boolean;\n resolvers?: Resolvers | Resolvers[];\n typeDefs?: string | string[] | DocumentNode | DocumentNode[];\n fragmentMatcher?: FragmentMatcher;\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n */\n version?: string;\n documentTransform?: DocumentTransform;\n}\n\n// Though mergeOptions now resides in @apollo/client/utilities, it was\n// previously declared and exported from this module, and then reexported from\n// @apollo/client/core. Since we need to preserve that API anyway, the easiest\n// solution is to reexport mergeOptions where it was previously declared (here).\nimport { mergeOptions } from \"../utilities/index.js\";\nimport { getApolloClientMemoryInternals } from \"../utilities/caching/getMemoryInternals.js\";\nexport { mergeOptions };\n\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through {@link Observable} instances.\n */\nexport class ApolloClient implements DataProxy {\n public link: ApolloLink;\n public cache: ApolloCache;\n public disableNetworkFetches: boolean;\n public version: string;\n public queryDeduplication: boolean;\n public defaultOptions: DefaultOptions;\n public readonly typeDefs: ApolloClientOptions[\"typeDefs\"];\n\n private queryManager: QueryManager;\n private devToolsHookCb?: Function;\n private resetStoreCallbacks: Array<() => Promise> = [];\n private clearStoreCallbacks: Array<() => Promise> = [];\n private localState: LocalState;\n\n /**\n * Constructs an instance of {@link ApolloClient}.\n *\n * @example\n * ```js\n * import { ApolloClient, InMemoryCache } from '@apollo/client';\n *\n * const cache = new InMemoryCache();\n *\n * const client = new ApolloClient({\n * // Provide required constructor fields\n * cache: cache,\n * uri: 'http://localhost:4000/',\n *\n * // Provide some optional constructor fields\n * name: 'react-web-client',\n * version: '1.3',\n * queryDeduplication: false,\n * defaultOptions: {\n * watchQuery: {\n * fetchPolicy: 'cache-and-network',\n * },\n * },\n * });\n * ```\n */\n constructor(options: ApolloClientOptions) {\n if (!options.cache) {\n throw newInvariantError(\n \"To initialize Apollo Client, you must specify a 'cache' property \" +\n \"in the options object. \\n\" +\n \"For more information, please visit: https://go.apollo.dev/c/docs\"\n );\n }\n\n const {\n uri,\n credentials,\n headers,\n cache,\n documentTransform,\n ssrMode = false,\n ssrForceFetchDelay = 0,\n // Expose the client instance as window.__APOLLO_CLIENT__ and call\n // onBroadcast in queryManager.broadcastQueries to enable browser\n // devtools, but disable them by default in production.\n connectToDevTools = typeof window === \"object\" &&\n !(window as any).__APOLLO_CLIENT__ &&\n __DEV__,\n queryDeduplication = true,\n defaultOptions,\n defaultContext,\n assumeImmutableResults = cache.assumeImmutableResults,\n resolvers,\n typeDefs,\n fragmentMatcher,\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n } = options;\n\n let { link } = options;\n\n if (!link) {\n link =\n uri ? new HttpLink({ uri, credentials, headers }) : ApolloLink.empty();\n }\n\n this.link = link;\n this.cache = cache;\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.typeDefs = typeDefs;\n\n if (ssrForceFetchDelay) {\n setTimeout(\n () => (this.disableNetworkFetches = false),\n ssrForceFetchDelay\n );\n }\n\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n\n this.version = version;\n\n this.localState = new LocalState({\n cache,\n client: this,\n resolvers,\n fragmentMatcher,\n });\n\n this.queryManager = new QueryManager({\n cache: this.cache,\n link: this.link,\n defaultOptions: this.defaultOptions,\n defaultContext,\n documentTransform,\n queryDeduplication,\n ssrMode,\n clientAwareness: {\n name: clientAwarenessName!,\n version: clientAwarenessVersion!,\n },\n localState: this.localState,\n assumeImmutableResults,\n onBroadcast:\n connectToDevTools ?\n () => {\n if (this.devToolsHookCb) {\n this.devToolsHookCb({\n action: {},\n state: {\n queries: this.queryManager.getQueryStore(),\n mutations: this.queryManager.mutationStore || {},\n },\n dataWithOptimisticResults: this.cache.extract(true),\n });\n }\n }\n : void 0,\n });\n\n if (connectToDevTools) this.connectToDevTools();\n }\n\n private connectToDevTools() {\n if (typeof window === \"object\") {\n type DevToolsConnector = {\n push(client: ApolloClient): void;\n };\n const windowWithDevTools = window as Window & {\n [devtoolsSymbol]?: DevToolsConnector;\n __APOLLO_CLIENT__?: ApolloClient;\n };\n const devtoolsSymbol = Symbol.for(\"apollo.devtools\");\n (windowWithDevTools[devtoolsSymbol] =\n windowWithDevTools[devtoolsSymbol] || ([] as DevToolsConnector)).push(\n this\n );\n windowWithDevTools.__APOLLO_CLIENT__ = this;\n }\n\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && __DEV__) {\n hasSuggestedDevtools = true;\n setTimeout(() => {\n if (\n typeof window !== \"undefined\" &&\n window.document &&\n window.top === window.self &&\n !(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__\n ) {\n const nav = window.navigator;\n const ua = nav && nav.userAgent;\n let url: string | undefined;\n if (typeof ua === \"string\") {\n if (ua.indexOf(\"Chrome/\") > -1) {\n url =\n \"https://chrome.google.com/webstore/detail/\" +\n \"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm\";\n } else if (ua.indexOf(\"Firefox/\") > -1) {\n url =\n \"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/\";\n }\n }\n if (url) {\n invariant.log(\n \"Download the Apollo DevTools for a better development \" +\n \"experience: %s\",\n url\n );\n }\n }\n }, 10000);\n }\n }\n\n /**\n * The `DocumentTransform` used to modify GraphQL documents before a request\n * is made. If a custom `DocumentTransform` is not provided, this will be the\n * default document transform.\n */\n get documentTransform() {\n return this.queryManager.documentTransform;\n }\n\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n public stop() {\n this.queryManager.stop();\n }\n\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and\n * receive updated results through a GraphQL observer when the cache store changes.\n *\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifier, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n public watchQuery<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(options: WatchQueryOptions): ObservableQuery {\n if (this.defaultOptions.watchQuery) {\n options = mergeOptions(this.defaultOptions.watchQuery, options);\n }\n\n // XXX Overwriting options is probably not the best way to do this long term...\n if (\n this.disableNetworkFetches &&\n (options.fetchPolicy === \"network-only\" ||\n options.fetchPolicy === \"cache-and-network\")\n ) {\n options = { ...options, fetchPolicy: \"cache-first\" };\n }\n\n return this.queryManager.watchQuery(options);\n }\n\n /**\n * This resolves a single query according to the options specified and\n * returns a `Promise` which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options - An object of type {@link QueryOptions} that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n public query<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(options: QueryOptions): Promise> {\n if (this.defaultOptions.query) {\n options = mergeOptions(this.defaultOptions.query, options);\n }\n\n invariant(\n (options.fetchPolicy as WatchQueryFetchPolicy) !== \"cache-and-network\",\n \"The cache-and-network fetchPolicy does not work with client.query, because \" +\n \"client.query can only return a single result. Please use client.watchQuery \" +\n \"to receive multiple results from the cache and the network, or consider \" +\n \"using a different fetchPolicy, such as cache-first or network-only.\"\n );\n\n if (this.disableNetworkFetches && options.fetchPolicy === \"network-only\") {\n options = { ...options, fetchPolicy: \"cache-first\" };\n }\n\n return this.queryManager.query(options);\n }\n\n /**\n * This resolves a single mutation according to the options specified and returns a\n * Promise which is either resolved with the resulting data or rejected with an\n * error. In some cases both `data` and `errors` might be undefined, for example\n * when `errorPolicy` is set to `'ignore'`.\n *\n * It takes options as an object with the following keys and values:\n */\n public mutate<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n TContext extends Record = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n >(\n options: MutationOptions\n ): Promise> {\n if (this.defaultOptions.mutate) {\n options = mergeOptions(this.defaultOptions.mutate, options);\n }\n return this.queryManager.mutate(\n options\n );\n }\n\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * {@link Observable} which either emits received data or an error.\n */\n public subscribe<\n T = any,\n TVariables extends OperationVariables = OperationVariables,\n >(options: SubscriptionOptions): Observable> {\n return this.queryManager.startGraphQLSubscription(options);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic - Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n public readQuery(\n options: DataProxy.Query,\n optimistic: boolean = false\n ): T | null {\n return this.cache.readQuery(options, optimistic);\n }\n\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic - Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n public readFragment(\n options: DataProxy.Fragment,\n optimistic: boolean = false\n ): T | null {\n return this.cache.readFragment(options, optimistic);\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n public writeQuery(\n options: DataProxy.WriteQueryOptions\n ): Reference | undefined {\n const ref = this.cache.writeQuery(options);\n\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n\n return ref;\n }\n\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n public writeFragment(\n options: DataProxy.WriteFragmentOptions\n ): Reference | undefined {\n const ref = this.cache.writeFragment(options);\n\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n\n return ref;\n }\n\n public __actionHookForDevTools(cb: () => any) {\n this.devToolsHookCb = cb;\n }\n\n public __requestRaw(payload: GraphQLRequest): Observable {\n return execute(this.link, payload);\n }\n\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public resetStore(): Promise[] | null> {\n return Promise.resolve()\n .then(() =>\n this.queryManager.clearStore({\n discardWatches: false,\n })\n )\n .then(() => Promise.all(this.resetStoreCallbacks.map((fn) => fn())))\n .then(() => this.reFetchObservableQueries());\n }\n\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n public clearStore(): Promise {\n return Promise.resolve()\n .then(() =>\n this.queryManager.clearStore({\n discardWatches: true,\n })\n )\n .then(() => Promise.all(this.clearStoreCallbacks.map((fn) => fn())));\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onResetStore(cb: () => Promise): () => void {\n this.resetStoreCallbacks.push(cb);\n return () => {\n this.resetStoreCallbacks = this.resetStoreCallbacks.filter(\n (c) => c !== cb\n );\n };\n }\n\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n public onClearStore(cb: () => Promise): () => void {\n this.clearStoreCallbacks.push(cb);\n return () => {\n this.clearStoreCallbacks = this.clearStoreCallbacks.filter(\n (c) => c !== cb\n );\n };\n }\n\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n public reFetchObservableQueries(\n includeStandby?: boolean\n ): Promise[]> {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n }\n\n /**\n * Refetches specified active queries. Similar to \"reFetchObservableQueries()\" but with a specific list of queries.\n *\n * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries.\n *\n * It is important to remember that `refetchQueries()` *will* refetch specified active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n public refetchQueries<\n TCache extends ApolloCache = ApolloCache,\n TResult = Promise>,\n >(\n options: RefetchQueriesOptions\n ): RefetchQueriesResult {\n const map = this.queryManager.refetchQueries(\n options as RefetchQueriesOptions, TResult>\n );\n const queries: ObservableQuery[] = [];\n const results: InternalRefetchQueriesResult[] = [];\n\n map.forEach((result, obsQuery) => {\n queries.push(obsQuery);\n results.push(result);\n });\n\n const result = Promise.all(\n results as TResult[]\n ) as RefetchQueriesResult;\n\n // In case you need the raw results immediately, without awaiting\n // Promise.all(results):\n result.queries = queries;\n result.results = results;\n\n // If you decide to ignore the result Promise because you're using\n // result.queries and result.results instead, you shouldn't have to worry\n // about preventing uncaught rejections for the Promise.all result.\n result.catch((error) => {\n invariant.debug(\n `In client.refetchQueries, Promise.all promise rejected with error %o`,\n error\n );\n });\n\n return result;\n }\n\n /**\n * Get all currently active `ObservableQuery` objects, in a `Map` keyed by\n * query ID strings.\n *\n * An \"active\" query is one that has observers and a `fetchPolicy` other than\n * \"standby\" or \"cache-only\".\n *\n * You can include all `ObservableQuery` objects (including the inactive ones)\n * by passing \"all\" instead of \"active\", or you can include just a subset of\n * active queries by passing an array of query names or DocumentNode objects.\n */\n public getObservableQueries(\n include: RefetchQueriesInclude = \"active\"\n ): Map> {\n return this.queryManager.getObservableQueries(include);\n }\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public extract(optimistic?: boolean): TCacheShape {\n return this.cache.extract(optimistic);\n }\n\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public restore(serializedState: TCacheShape): ApolloCache {\n return this.cache.restore(serializedState);\n }\n\n /**\n * Add additional local resolvers.\n */\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.addResolvers(resolvers);\n }\n\n /**\n * Set (override existing) local resolvers.\n */\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.localState.setResolvers(resolvers);\n }\n\n /**\n * Get all registered local resolvers.\n */\n public getResolvers() {\n return this.localState.getResolvers();\n }\n\n /**\n * Set a custom local state fragment matcher.\n */\n public setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n }\n\n /**\n * Define a new ApolloLink (or link chain) that Apollo Client will use.\n */\n public setLink(newLink: ApolloLink) {\n this.link = this.queryManager.link = newLink;\n }\n\n public get defaultContext() {\n return this.queryManager.defaultContext;\n }\n\n /**\n * @experimental\n * This is not a stable API - it is used in development builds to expose\n * information to the DevTools.\n * Use at your own risk!\n * For more details, see [Memory Management](https://www.apollographql.com/docs/react/caching/memory-management/#measuring-cache-usage)\n *\n * @example\n * ```ts\n * console.log(client.getMemoryInternals())\n * ```\n * Logs output in the following JSON format:\n * @example\n * ```json\n *{\n * limits: {\n * parser: 1000,\n * canonicalStringify: 1000,\n * print: 2000,\n * 'documentTransform.cache': 2000,\n * 'queryManager.getDocumentInfo': 2000,\n * 'PersistedQueryLink.persistedQueryHashes': 2000,\n * 'fragmentRegistry.transform': 2000,\n * 'fragmentRegistry.lookup': 1000,\n * 'fragmentRegistry.findFragmentSpreads': 4000,\n * 'cache.fragmentQueryDocuments': 1000,\n * 'removeTypenameFromVariables.getVariableDefinitions': 2000,\n * 'inMemoryCache.maybeBroadcastWatch': 5000,\n * 'inMemoryCache.executeSelectionSet': 10000,\n * 'inMemoryCache.executeSubSelectedArray': 5000\n * },\n * sizes: {\n * parser: 26,\n * canonicalStringify: 4,\n * print: 14,\n * addTypenameDocumentTransform: [\n * {\n * cache: 14,\n * },\n * ],\n * queryManager: {\n * getDocumentInfo: 14,\n * documentTransforms: [\n * {\n * cache: 14,\n * },\n * {\n * cache: 14,\n * },\n * ],\n * },\n * fragmentRegistry: {\n * findFragmentSpreads: 34,\n * lookup: 20,\n * transform: 14,\n * },\n * cache: {\n * fragmentQueryDocuments: 22,\n * },\n * inMemoryCache: {\n * executeSelectionSet: 4345,\n * executeSubSelectedArray: 1206,\n * maybeBroadcastWatch: 32,\n * },\n * links: [\n * {\n * PersistedQueryLink: {\n * persistedQueryHashes: 14,\n * },\n * },\n * {\n * removeTypenameFromVariables: {\n * getVariableDefinitions: 14,\n * },\n * },\n * ],\n * },\n * }\n *```\n */\n public getMemoryInternals?: typeof getApolloClientMemoryInternals;\n}\n\nif (__DEV__) {\n ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/LocalState.d.ts b/graphql-subscription/node_modules/@apollo/client/core/LocalState.d.ts new file mode 100644 index 0000000..1427e02 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/LocalState.d.ts @@ -0,0 +1,65 @@ +import type { DocumentNode, SelectionNode, FieldNode, ASTNode } from "graphql"; +import type { ApolloCache } from "../cache/index.js"; +import type { FragmentMap, StoreObject } from "../utilities/index.js"; +import type { ApolloClient } from "./ApolloClient.js"; +import type { Resolvers, OperationVariables } from "./types.js"; +import type { FetchResult } from "../link/core/index.js"; +export type Resolver = (rootValue?: any, args?: any, context?: any, info?: { + field: FieldNode; + fragmentMap: FragmentMap; +}) => any; +export type VariableMap = { + [name: string]: any; +}; +export type FragmentMatcher = (rootValue: any, typeCondition: string, context: any) => boolean; +export type ExecContext = { + fragmentMap: FragmentMap; + context: any; + variables: VariableMap; + fragmentMatcher: FragmentMatcher; + defaultOperationType: string; + exportedVariables: Record; + onlyRunForcedResolvers: boolean; + selectionsToResolve: Set; +}; +export type LocalStateOptions = { + cache: ApolloCache; + client?: ApolloClient; + resolvers?: Resolvers | Resolvers[]; + fragmentMatcher?: FragmentMatcher; +}; +export declare class LocalState { + private cache; + private client?; + private resolvers?; + private fragmentMatcher?; + private selectionsToResolveCache; + constructor({ cache, client, resolvers, fragmentMatcher, }: LocalStateOptions); + addResolvers(resolvers: Resolvers | Resolvers[]): void; + setResolvers(resolvers: Resolvers | Resolvers[]): void; + getResolvers(): Resolvers; + runResolvers({ document, remoteResult, context, variables, onlyRunForcedResolvers, }: { + document: DocumentNode | null; + remoteResult: FetchResult; + context?: Record; + variables?: Record; + onlyRunForcedResolvers?: boolean; + }): Promise>; + setFragmentMatcher(fragmentMatcher: FragmentMatcher): void; + getFragmentMatcher(): FragmentMatcher | undefined; + clientQuery(document: DocumentNode): DocumentNode | null; + serverQuery(document: DocumentNode): DocumentNode | null; + prepareContext(context?: Record): { + cache: ApolloCache; + getCacheKey(obj: StoreObject): string | undefined; + }; + addExportedVariables(document: DocumentNode, variables?: TVars, context?: {}): Promise; + shouldForceResolvers(document: ASTNode): boolean; + private buildRootValueFromCache; + private resolveDocument; + private resolveSelectionSet; + private resolveField; + private resolveSubSelectedArray; + private collectSelectionsToResolve; +} +//# sourceMappingURL=LocalState.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/LocalState.js b/graphql-subscription/node_modules/@apollo/client/core/LocalState.js new file mode 100644 index 0000000..b1d8bff --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/LocalState.js @@ -0,0 +1,356 @@ +import { __assign, __awaiter, __generator } from "tslib"; +import { invariant } from "../utilities/globals/index.js"; +import { visit, BREAK, isSelectionNode } from "graphql"; +import { argumentsObjectFromField, buildQueryFromSelectionSet, createFragmentMap, getFragmentDefinitions, getMainDefinition, hasDirectives, isField, isInlineFragment, mergeDeep, mergeDeepArray, removeClientSetsFromDocument, resultKeyNameFromField, shouldInclude, } from "../utilities/index.js"; +import { cacheSlot } from "../cache/index.js"; +var LocalState = /** @class */ (function () { + function LocalState(_a) { + var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; + this.selectionsToResolveCache = new WeakMap(); + this.cache = cache; + if (client) { + this.client = client; + } + if (resolvers) { + this.addResolvers(resolvers); + } + if (fragmentMatcher) { + this.setFragmentMatcher(fragmentMatcher); + } + } + LocalState.prototype.addResolvers = function (resolvers) { + var _this = this; + this.resolvers = this.resolvers || {}; + if (Array.isArray(resolvers)) { + resolvers.forEach(function (resolverGroup) { + _this.resolvers = mergeDeep(_this.resolvers, resolverGroup); + }); + } + else { + this.resolvers = mergeDeep(this.resolvers, resolvers); + } + }; + LocalState.prototype.setResolvers = function (resolvers) { + this.resolvers = {}; + this.addResolvers(resolvers); + }; + LocalState.prototype.getResolvers = function () { + return this.resolvers || {}; + }; + // Run local client resolvers against the incoming query and remote data. + // Locally resolved field values are merged with the incoming remote data, + // and returned. Note that locally resolved fields will overwrite + // remote data using the same field name. + LocalState.prototype.runResolvers = function (_a) { + var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_c) { + if (document) { + return [2 /*return*/, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (__assign(__assign({}, remoteResult), { data: localResult.result })); })]; + } + return [2 /*return*/, remoteResult]; + }); + }); + }; + LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { + this.fragmentMatcher = fragmentMatcher; + }; + LocalState.prototype.getFragmentMatcher = function () { + return this.fragmentMatcher; + }; + // Client queries contain everything in the incoming document (if a @client + // directive is found). + LocalState.prototype.clientQuery = function (document) { + if (hasDirectives(["client"], document)) { + if (this.resolvers) { + return document; + } + } + return null; + }; + // Server queries are stripped of all @client based selection sets. + LocalState.prototype.serverQuery = function (document) { + return removeClientSetsFromDocument(document); + }; + LocalState.prototype.prepareContext = function (context) { + var cache = this.cache; + return __assign(__assign({}, context), { cache: cache, + // Getting an entry's cache key is useful for local state resolvers. + getCacheKey: function (obj) { + return cache.identify(obj); + } }); + }; + // To support `@client @export(as: "someVar")` syntax, we'll first resolve + // @client @export fields locally, then pass the resolved values back to be + // used alongside the original operation variables. + LocalState.prototype.addExportedVariables = function (document, variables, context) { + if (variables === void 0) { variables = {}; } + if (context === void 0) { context = {}; } + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + if (document) { + return [2 /*return*/, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (__assign(__assign({}, variables), data.exportedVariables)); })]; + } + return [2 /*return*/, __assign({}, variables)]; + }); + }); + }; + LocalState.prototype.shouldForceResolvers = function (document) { + var forceResolvers = false; + visit(document, { + Directive: { + enter: function (node) { + if (node.name.value === "client" && node.arguments) { + forceResolvers = node.arguments.some(function (arg) { + return arg.name.value === "always" && + arg.value.kind === "BooleanValue" && + arg.value.value === true; + }); + if (forceResolvers) { + return BREAK; + } + } + }, + }, + }); + return forceResolvers; + }; + // Query the cache and return matching data. + LocalState.prototype.buildRootValueFromCache = function (document, variables) { + return this.cache.diff({ + query: buildQueryFromSelectionSet(document), + variables: variables, + returnPartialData: true, + optimistic: false, + }).result; + }; + LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { + if (context === void 0) { context = {}; } + if (variables === void 0) { variables = {}; } + if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } + if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } + return __awaiter(this, void 0, void 0, function () { + var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant; + return __generator(this, function (_b) { + mainDefinition = getMainDefinition(document); + fragments = getFragmentDefinitions(document); + fragmentMap = createFragmentMap(fragments); + selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap); + definitionOperation = mainDefinition.operation; + defaultOperationType = definitionOperation ? + definitionOperation.charAt(0).toUpperCase() + + definitionOperation.slice(1) + : "Query"; + _a = this, cache = _a.cache, client = _a.client; + execContext = { + fragmentMap: fragmentMap, + context: __assign(__assign({}, context), { cache: cache, client: client }), + variables: variables, + fragmentMatcher: fragmentMatcher, + defaultOperationType: defaultOperationType, + exportedVariables: {}, + selectionsToResolve: selectionsToResolve, + onlyRunForcedResolvers: onlyRunForcedResolvers, + }; + isClientFieldDescendant = false; + return [2 /*return*/, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({ + result: result, + exportedVariables: execContext.exportedVariables, + }); })]; + }); + }); + }; + LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) { + return __awaiter(this, void 0, void 0, function () { + var fragmentMap, context, variables, resultsToMerge, execute; + var _this = this; + return __generator(this, function (_a) { + fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; + resultsToMerge = [rootValue]; + execute = function (selection) { return __awaiter(_this, void 0, void 0, function () { + var fragment, typeCondition; + return __generator(this, function (_a) { + if (!isClientFieldDescendant && + !execContext.selectionsToResolve.has(selection)) { + // Skip selections without @client directives + // (still processing if one of the ancestors or one of the child fields has @client directive) + return [2 /*return*/]; + } + if (!shouldInclude(selection, variables)) { + // Skip this entirely. + return [2 /*return*/]; + } + if (isField(selection)) { + return [2 /*return*/, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) { + var _a; + if (typeof fieldResult !== "undefined") { + resultsToMerge.push((_a = {}, + _a[resultKeyNameFromField(selection)] = fieldResult, + _a)); + } + })]; + } + if (isInlineFragment(selection)) { + fragment = selection; + } + else { + // This is a named fragment. + fragment = fragmentMap[selection.name.value]; + invariant(fragment, 18, selection.name.value); + } + if (fragment && fragment.typeCondition) { + typeCondition = fragment.typeCondition.name.value; + if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { + return [2 /*return*/, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) { + resultsToMerge.push(fragmentResult); + })]; + } + } + return [2 /*return*/]; + }); + }); }; + return [2 /*return*/, Promise.all(selectionSet.selections.map(execute)).then(function () { + return mergeDeepArray(resultsToMerge); + })]; + }); + }); + }; + LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) { + return __awaiter(this, void 0, void 0, function () { + var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; + var _this = this; + return __generator(this, function (_a) { + if (!rootValue) { + return [2 /*return*/, null]; + } + variables = execContext.variables; + fieldName = field.name.value; + aliasedFieldName = resultKeyNameFromField(field); + aliasUsed = fieldName !== aliasedFieldName; + defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; + resultPromise = Promise.resolve(defaultResult); + // Usually all local resolvers are run when passing through here, but + // if we've specifically identified that we only want to run forced + // resolvers (that is, resolvers for fields marked with + // `@client(always: true)`), then we'll skip running non-forced resolvers. + if (!execContext.onlyRunForcedResolvers || + this.shouldForceResolvers(field)) { + resolverType = rootValue.__typename || execContext.defaultOperationType; + resolverMap = this.resolvers && this.resolvers[resolverType]; + if (resolverMap) { + resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; + if (resolve) { + resultPromise = Promise.resolve( + // In case the resolve function accesses reactive variables, + // set cacheSlot to the current cache instance. + cacheSlot.withValue(this.cache, resolve, [ + rootValue, + argumentsObjectFromField(field, variables), + execContext.context, + { field: field, fragmentMap: execContext.fragmentMap }, + ])); + } + } + } + return [2 /*return*/, resultPromise.then(function (result) { + var _a, _b; + if (result === void 0) { result = defaultResult; } + // If an @export directive is associated with the current field, store + // the `as` export variable name and current result for later use. + if (field.directives) { + field.directives.forEach(function (directive) { + if (directive.name.value === "export" && directive.arguments) { + directive.arguments.forEach(function (arg) { + if (arg.name.value === "as" && arg.value.kind === "StringValue") { + execContext.exportedVariables[arg.value.value] = result; + } + }); + } + }); + } + // Handle all scalar types here. + if (!field.selectionSet) { + return result; + } + // From here down, the field has a selection set, which means it's trying + // to query a GraphQLObjectType. + if (result == null) { + // Basically any field in a GraphQL response can be null, or missing + return result; + } + var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === "client"; })) !== null && _b !== void 0 ? _b : false; + if (Array.isArray(result)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext); + } + // Returned value is an object, and the query has a sub-selection. Recurse. + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext); + } + })]; + }); + }); + }; + LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) { + var _this = this; + return Promise.all(result.map(function (item) { + if (item === null) { + return null; + } + // This is a nested array, recurse. + if (Array.isArray(item)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext); + } + // This is an object, run the selection set on it. + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext); + } + })); + }; + // Collect selection nodes on paths from document root down to all @client directives. + // This function takes into account transitive fragment spreads. + // Complexity equals to a single `visit` over the full document. + LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) { + var isSingleASTNode = function (node) { return !Array.isArray(node); }; + var selectionsToResolveCache = this.selectionsToResolveCache; + function collectByDefinition(definitionNode) { + if (!selectionsToResolveCache.has(definitionNode)) { + var matches_1 = new Set(); + selectionsToResolveCache.set(definitionNode, matches_1); + visit(definitionNode, { + Directive: function (node, _, __, ___, ancestors) { + if (node.name.value === "client") { + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && isSelectionNode(node)) { + matches_1.add(node); + } + }); + } + }, + FragmentSpread: function (spread, _, __, ___, ancestors) { + var fragment = fragmentMap[spread.name.value]; + invariant(fragment, 19, spread.name.value); + var fragmentSelections = collectByDefinition(fragment); + if (fragmentSelections.size > 0) { + // Fragment for this spread contains @client directive (either directly or transitively) + // Collect selection nodes on paths from the root down to fields with the @client directive + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && isSelectionNode(node)) { + matches_1.add(node); + } + }); + matches_1.add(spread); + fragmentSelections.forEach(function (selection) { + matches_1.add(selection); + }); + } + }, + }); + } + return selectionsToResolveCache.get(definitionNode); + } + return collectByDefinition(mainDefinition); + }; + return LocalState; +}()); +export { LocalState }; +//# sourceMappingURL=LocalState.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/LocalState.js.map b/graphql-subscription/node_modules/@apollo/client/core/LocalState.js.map new file mode 100644 index 0000000..0879aed --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/LocalState.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LocalState.js","sourceRoot":"","sources":["../../src/core/LocalState.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAe1D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIxD,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,iBAAiB,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AC,SAAS,CAAC,CAAC;4BACzB,CAAC,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;YACD,OAAO,wBAAwB,CAAC,GAAG,CAAC,cAAc,CAAE,CAAC;QACvD,CAAC;QACD,OAAO,mBAAmB,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC;IACH,iBAAC;AAAD,CAAC,AAxeD,IAweC","sourcesContent":["import { invariant } from \"../utilities/globals/index.js\";\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n SelectionSetNode,\n SelectionNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n FieldNode,\n ASTNode,\n DirectiveNode,\n FragmentSpreadNode,\n ExecutableDefinitionNode,\n} from \"graphql\";\nimport { visit, BREAK, isSelectionNode } from \"graphql\";\n\nimport type { ApolloCache } from \"../cache/index.js\";\nimport type { FragmentMap, StoreObject } from \"../utilities/index.js\";\nimport {\n argumentsObjectFromField,\n buildQueryFromSelectionSet,\n createFragmentMap,\n getFragmentDefinitions,\n getMainDefinition,\n hasDirectives,\n isField,\n isInlineFragment,\n mergeDeep,\n mergeDeepArray,\n removeClientSetsFromDocument,\n resultKeyNameFromField,\n shouldInclude,\n} from \"../utilities/index.js\";\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { Resolvers, OperationVariables } from \"./types.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\nimport { cacheSlot } from \"../cache/index.js\";\n\nexport type Resolver = (\n rootValue?: any,\n args?: any,\n context?: any,\n info?: {\n field: FieldNode;\n fragmentMap: FragmentMap;\n }\n) => any;\n\nexport type VariableMap = { [name: string]: any };\n\nexport type FragmentMatcher = (\n rootValue: any,\n typeCondition: string,\n context: any\n) => boolean;\n\nexport type ExecContext = {\n fragmentMap: FragmentMap;\n context: any;\n variables: VariableMap;\n fragmentMatcher: FragmentMatcher;\n defaultOperationType: string;\n exportedVariables: Record;\n onlyRunForcedResolvers: boolean;\n selectionsToResolve: Set;\n};\n\nexport type LocalStateOptions = {\n cache: ApolloCache;\n client?: ApolloClient;\n resolvers?: Resolvers | Resolvers[];\n fragmentMatcher?: FragmentMatcher;\n};\n\nexport class LocalState {\n private cache: ApolloCache;\n private client?: ApolloClient;\n private resolvers?: Resolvers;\n private fragmentMatcher?: FragmentMatcher;\n private selectionsToResolveCache = new WeakMap<\n ExecutableDefinitionNode,\n Set\n >();\n\n constructor({\n cache,\n client,\n resolvers,\n fragmentMatcher,\n }: LocalStateOptions) {\n this.cache = cache;\n\n if (client) {\n this.client = client;\n }\n\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n\n public addResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach((resolverGroup) => {\n this.resolvers = mergeDeep(this.resolvers, resolverGroup);\n });\n } else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n }\n\n public setResolvers(resolvers: Resolvers | Resolvers[]) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n }\n\n public getResolvers() {\n return this.resolvers || {};\n }\n\n // Run local client resolvers against the incoming query and remote data.\n // Locally resolved field values are merged with the incoming remote data,\n // and returned. Note that locally resolved fields will overwrite\n // remote data using the same field name.\n public async runResolvers({\n document,\n remoteResult,\n context,\n variables,\n onlyRunForcedResolvers = false,\n }: {\n document: DocumentNode | null;\n remoteResult: FetchResult;\n context?: Record;\n variables?: Record;\n onlyRunForcedResolvers?: boolean;\n }): Promise> {\n if (document) {\n return this.resolveDocument(\n document,\n remoteResult.data,\n context,\n variables,\n this.fragmentMatcher,\n onlyRunForcedResolvers\n ).then((localResult) => ({\n ...remoteResult,\n data: localResult.result,\n }));\n }\n\n return remoteResult;\n }\n\n public setFragmentMatcher(fragmentMatcher: FragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n }\n\n public getFragmentMatcher(): FragmentMatcher | undefined {\n return this.fragmentMatcher;\n }\n\n // Client queries contain everything in the incoming document (if a @client\n // directive is found).\n public clientQuery(document: DocumentNode) {\n if (hasDirectives([\"client\"], document)) {\n if (this.resolvers) {\n return document;\n }\n }\n return null;\n }\n\n // Server queries are stripped of all @client based selection sets.\n public serverQuery(document: DocumentNode) {\n return removeClientSetsFromDocument(document);\n }\n\n public prepareContext(context?: Record) {\n const { cache } = this;\n return {\n ...context,\n cache,\n // Getting an entry's cache key is useful for local state resolvers.\n getCacheKey(obj: StoreObject) {\n return cache.identify(obj);\n },\n };\n }\n\n // To support `@client @export(as: \"someVar\")` syntax, we'll first resolve\n // @client @export fields locally, then pass the resolved values back to be\n // used alongside the original operation variables.\n public async addExportedVariables(\n document: DocumentNode,\n variables: TVars = {} as TVars,\n context = {}\n ): /* returns at least the variables that were passed in */ Promise {\n if (document) {\n return this.resolveDocument(\n document,\n this.buildRootValueFromCache(document, variables) || {},\n this.prepareContext(context),\n variables\n ).then((data) => ({\n ...variables,\n ...data.exportedVariables,\n }));\n }\n\n return {\n ...variables,\n };\n }\n\n public shouldForceResolvers(document: ASTNode) {\n let forceResolvers = false;\n visit(document, {\n Directive: {\n enter(node) {\n if (node.name.value === \"client\" && node.arguments) {\n forceResolvers = node.arguments.some(\n (arg) =>\n arg.name.value === \"always\" &&\n arg.value.kind === \"BooleanValue\" &&\n arg.value.value === true\n );\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n }\n\n // Query the cache and return matching data.\n private buildRootValueFromCache(\n document: DocumentNode,\n variables?: Record\n ) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n }\n\n private async resolveDocument(\n document: DocumentNode,\n rootValue: TData,\n context: any = {},\n variables: VariableMap = {},\n fragmentMatcher: FragmentMatcher = () => true,\n onlyRunForcedResolvers: boolean = false\n ) {\n const mainDefinition = getMainDefinition(\n document\n ) as OperationDefinitionNode;\n const fragments = getFragmentDefinitions(document);\n const fragmentMap = createFragmentMap(fragments);\n const selectionsToResolve = this.collectSelectionsToResolve(\n mainDefinition,\n fragmentMap\n );\n\n const definitionOperation = mainDefinition.operation;\n\n const defaultOperationType =\n definitionOperation ?\n definitionOperation.charAt(0).toUpperCase() +\n definitionOperation.slice(1)\n : \"Query\";\n\n const { cache, client } = this;\n const execContext: ExecContext = {\n fragmentMap,\n context: {\n ...context,\n cache,\n client,\n },\n variables,\n fragmentMatcher,\n defaultOperationType,\n exportedVariables: {},\n selectionsToResolve,\n onlyRunForcedResolvers,\n };\n const isClientFieldDescendant = false;\n\n return this.resolveSelectionSet(\n mainDefinition.selectionSet,\n isClientFieldDescendant,\n rootValue,\n execContext\n ).then((result) => ({\n result,\n exportedVariables: execContext.exportedVariables,\n }));\n }\n\n private async resolveSelectionSet(\n selectionSet: SelectionSetNode,\n isClientFieldDescendant: boolean,\n rootValue: TData,\n execContext: ExecContext\n ) {\n const { fragmentMap, context, variables } = execContext;\n const resultsToMerge: TData[] = [rootValue];\n\n const execute = async (selection: SelectionNode): Promise => {\n if (\n !isClientFieldDescendant &&\n !execContext.selectionsToResolve.has(selection)\n ) {\n // Skip selections without @client directives\n // (still processing if one of the ancestors or one of the child fields has @client directive)\n return;\n }\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely.\n return;\n }\n\n if (isField(selection)) {\n return this.resolveField(\n selection,\n isClientFieldDescendant,\n rootValue,\n execContext\n ).then((fieldResult) => {\n if (typeof fieldResult !== \"undefined\") {\n resultsToMerge.push({\n [resultKeyNameFromField(selection)]: fieldResult,\n } as TData);\n }\n });\n }\n\n let fragment: InlineFragmentNode | FragmentDefinitionNode;\n\n if (isInlineFragment(selection)) {\n fragment = selection;\n } else {\n // This is a named fragment.\n fragment = fragmentMap[selection.name.value];\n invariant(fragment, `No fragment named %s`, selection.name.value);\n }\n\n if (fragment && fragment.typeCondition) {\n const typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return this.resolveSelectionSet(\n fragment.selectionSet,\n isClientFieldDescendant,\n rootValue,\n execContext\n ).then((fragmentResult) => {\n resultsToMerge.push(fragmentResult);\n });\n }\n }\n };\n\n return Promise.all(selectionSet.selections.map(execute)).then(function () {\n return mergeDeepArray(resultsToMerge);\n });\n }\n\n private async resolveField(\n field: FieldNode,\n isClientFieldDescendant: boolean,\n rootValue: any,\n execContext: ExecContext\n ): Promise {\n if (!rootValue) {\n return null;\n }\n\n const { variables } = execContext;\n const fieldName = field.name.value;\n const aliasedFieldName = resultKeyNameFromField(field);\n const aliasUsed = fieldName !== aliasedFieldName;\n const defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n let resultPromise = Promise.resolve(defaultResult);\n\n // Usually all local resolvers are run when passing through here, but\n // if we've specifically identified that we only want to run forced\n // resolvers (that is, resolvers for fields marked with\n // `@client(always: true)`), then we'll skip running non-forced resolvers.\n if (\n !execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)\n ) {\n const resolverType =\n rootValue.__typename || execContext.defaultOperationType;\n const resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n const resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(\n // In case the resolve function accesses reactive variables,\n // set cacheSlot to the current cache instance.\n cacheSlot.withValue(this.cache, resolve, [\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field, fragmentMap: execContext.fragmentMap },\n ])\n );\n }\n }\n }\n\n return resultPromise.then((result = defaultResult) => {\n // If an @export directive is associated with the current field, store\n // the `as` export variable name and current result for later use.\n if (field.directives) {\n field.directives.forEach((directive) => {\n if (directive.name.value === \"export\" && directive.arguments) {\n directive.arguments.forEach((arg) => {\n if (arg.name.value === \"as\" && arg.value.kind === \"StringValue\") {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n\n // Handle all scalar types here.\n if (!field.selectionSet) {\n return result;\n }\n\n // From here down, the field has a selection set, which means it's trying\n // to query a GraphQLObjectType.\n if (result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return result;\n }\n\n const isClientField =\n field.directives?.some((d) => d.name.value === \"client\") ?? false;\n\n if (Array.isArray(result)) {\n return this.resolveSubSelectedArray(\n field,\n isClientFieldDescendant || isClientField,\n result,\n execContext\n );\n }\n\n // Returned value is an object, and the query has a sub-selection. Recurse.\n if (field.selectionSet) {\n return this.resolveSelectionSet(\n field.selectionSet,\n isClientFieldDescendant || isClientField,\n result,\n execContext\n );\n }\n });\n }\n\n private resolveSubSelectedArray(\n field: FieldNode,\n isClientFieldDescendant: boolean,\n result: any[],\n execContext: ExecContext\n ): any {\n return Promise.all(\n result.map((item) => {\n if (item === null) {\n return null;\n }\n\n // This is a nested array, recurse.\n if (Array.isArray(item)) {\n return this.resolveSubSelectedArray(\n field,\n isClientFieldDescendant,\n item,\n execContext\n );\n }\n\n // This is an object, run the selection set on it.\n if (field.selectionSet) {\n return this.resolveSelectionSet(\n field.selectionSet,\n isClientFieldDescendant,\n item,\n execContext\n );\n }\n })\n );\n }\n\n // Collect selection nodes on paths from document root down to all @client directives.\n // This function takes into account transitive fragment spreads.\n // Complexity equals to a single `visit` over the full document.\n private collectSelectionsToResolve(\n mainDefinition: OperationDefinitionNode,\n fragmentMap: FragmentMap\n ): Set {\n const isSingleASTNode = (\n node: ASTNode | readonly ASTNode[]\n ): node is ASTNode => !Array.isArray(node);\n const selectionsToResolveCache = this.selectionsToResolveCache;\n\n function collectByDefinition(\n definitionNode: ExecutableDefinitionNode\n ): Set {\n if (!selectionsToResolveCache.has(definitionNode)) {\n const matches = new Set();\n selectionsToResolveCache.set(definitionNode, matches);\n\n visit(definitionNode, {\n Directive(node: DirectiveNode, _, __, ___, ancestors) {\n if (node.name.value === \"client\") {\n ancestors.forEach((node) => {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches.add(node);\n }\n });\n }\n },\n FragmentSpread(spread: FragmentSpreadNode, _, __, ___, ancestors) {\n const fragment = fragmentMap[spread.name.value];\n invariant(fragment, `No fragment named %s`, spread.name.value);\n\n const fragmentSelections = collectByDefinition(fragment);\n if (fragmentSelections.size > 0) {\n // Fragment for this spread contains @client directive (either directly or transitively)\n // Collect selection nodes on paths from the root down to fields with the @client directive\n ancestors.forEach((node) => {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches.add(node);\n }\n });\n matches.add(spread);\n fragmentSelections.forEach((selection) => {\n matches.add(selection);\n });\n }\n },\n });\n }\n return selectionsToResolveCache.get(definitionNode)!;\n }\n return collectByDefinition(mainDefinition);\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.d.ts new file mode 100644 index 0000000..573f810 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.d.ts @@ -0,0 +1,130 @@ +import { NetworkStatus } from "./networkStatus.js"; +import type { Concast, Observer, ObservableSubscription } from "../utilities/index.js"; +import { Observable } from "../utilities/index.js"; +import type { ApolloError } from "../errors/index.js"; +import type { QueryManager } from "./QueryManager.js"; +import type { ApolloQueryResult, OperationVariables, TypedDocumentNode } from "./types.js"; +import type { WatchQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions } from "./watchQueryOptions.js"; +import type { QueryInfo } from "./QueryInfo.js"; +import type { MissingFieldError } from "../cache/index.js"; +import type { MissingTree } from "../cache/core/types/common.js"; +export interface FetchMoreOptions { + updateQuery?: (previousQueryResult: TData, options: { + fetchMoreResult?: TData; + variables?: TVariables; + }) => TData; +} +export interface UpdateQueryOptions { + variables?: TVariables; +} +export declare class ObservableQuery extends Observable> { + readonly options: WatchQueryOptions; + readonly queryId: string; + readonly queryName?: string; + get query(): TypedDocumentNode; + /** + * An object containing the variables that were provided for the query. + */ + get variables(): TVariables | undefined; + private isTornDown; + private queryManager; + private observers; + private subscriptions; + private waitForOwnResult; + private last?; + private lastQuery?; + private queryInfo; + private concast?; + private observer?; + private pollingInfo?; + constructor({ queryManager, queryInfo, options, }: { + queryManager: QueryManager; + queryInfo: QueryInfo; + options: WatchQueryOptions; + }); + result(): Promise>; + /** @internal */ + resetDiff(): void; + getCurrentResult(saveAsLastResult?: boolean): ApolloQueryResult; + isDifferentFromLastResult(newResult: ApolloQueryResult, variables?: TVariables): boolean | undefined; + private getLast; + getLastResult(variablesMustMatch?: boolean): ApolloQueryResult | undefined; + getLastError(variablesMustMatch?: boolean): ApolloError | undefined; + resetLastResults(): void; + resetQueryStoreErrors(): void; + /** + * Update the variables of this observable query, and fetch the new results. + * This method should be preferred over `setVariables` in most use cases. + * + * @param variables - The new set of variables. If there are missing variables, + * the previous values of those variables will be used. + */ + refetch(variables?: Partial): Promise>; + /** + * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/). + */ + fetchMore(fetchMoreOptions: FetchMoreQueryOptions & { + updateQuery?: (previousQueryResult: TData, options: { + fetchMoreResult: TFetchData; + variables: TFetchVars; + }) => TData; + }): Promise>; + /** + * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query. + * + * This function returns _another_ function that you can call to terminate the subscription. + */ + subscribeToMore(options: SubscribeToMoreOptions): () => void; + setOptions(newOptions: Partial>): Promise>; + silentSetOptions(newOptions: Partial>): void; + /** + * Update the variables of this observable query, and fetch the new results + * if they've changed. Most users should prefer `refetch` instead of + * `setVariables` in order to to be properly notified of results even when + * they come from the cache. + * + * Note: the `next` callback will *not* fire if the variables have not changed + * or if the result is coming from cache. + * + * Note: the promise will return the old results immediately if the variables + * have not changed. + * + * Note: the promise will return null immediately if the query is not active + * (there are no subscribers). + * + * @param variables - The new set of variables. If there are missing variables, + * the previous values of those variables will be used. + */ + setVariables(variables: TVariables): Promise | void>; + /** + * A function that enables you to update the query's cached result without executing a followup GraphQL operation. + * + * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information. + */ + updateQuery(mapFn: (previousQueryResult: TData, options: Pick, "variables">) => TData): void; + /** + * A function that instructs the query to begin re-executing at a specified interval (in milliseconds). + */ + startPolling(pollInterval: number): void; + /** + * A function that instructs the query to stop polling after a previous call to `startPolling`. + */ + stopPolling(): void; + private applyNextFetchPolicy; + private fetch; + private updatePolling; + private updateLastResult; + reobserveAsConcast(newOptions?: Partial>, newNetworkStatus?: NetworkStatus): Concast>; + reobserve(newOptions?: Partial>, newNetworkStatus?: NetworkStatus): Promise>; + resubscribeAfterError(onNext: (value: ApolloQueryResult) => void, onError?: (error: any) => void, onComplete?: () => void): ObservableSubscription; + resubscribeAfterError(observer: Observer>): ObservableSubscription; + private observe; + private reportResult; + private reportError; + hasObservers(): boolean; + private tearDownQuery; + private transformDocument; +} +export declare function reobserveCacheFirst(obsQuery: ObservableQuery): Promise>; +export declare function logMissingFieldErrors(missing: MissingFieldError[] | MissingTree | undefined): void; +//# sourceMappingURL=ObservableQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js b/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js new file mode 100644 index 0000000..b8339a6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js @@ -0,0 +1,803 @@ +import { __assign, __extends } from "tslib"; +import { invariant } from "../utilities/globals/index.js"; +import { equal } from "@wry/equality"; +import { NetworkStatus, isNetworkRequestInFlight } from "./networkStatus.js"; +import { cloneDeep, compact, getOperationDefinition, Observable, iterateObserversSafely, fixObservableSubclass, getQueryDefinition, } from "../utilities/index.js"; +import { equalByQuery } from "./equalByQuery.js"; +var assign = Object.assign, hasOwnProperty = Object.hasOwnProperty; +var ObservableQuery = /** @class */ (function (_super) { + __extends(ObservableQuery, _super); + function ObservableQuery(_a) { + var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options; + var _this = _super.call(this, function (observer) { + // Zen Observable has its own error function, so in order to log correctly + // we need to provide a custom error callback. + try { + var subObserver = observer._subscription._observer; + if (subObserver && !subObserver.error) { + subObserver.error = defaultSubscriptionObserverErrorCallback; + } + } + catch (_a) { } + var first = !_this.observers.size; + _this.observers.add(observer); + // Deliver most recent error or result. + var last = _this.last; + if (last && last.error) { + observer.error && observer.error(last.error); + } + else if (last && last.result) { + observer.next && observer.next(last.result); + } + // Initiate observation of this query if it hasn't been reported to + // the QueryManager yet. + if (first) { + // Blindly catching here prevents unhandled promise rejections, + // and is safe because the ObservableQuery handles this error with + // this.observer.error, so we're not just swallowing the error by + // ignoring it here. + _this.reobserve().catch(function () { }); + } + return function () { + if (_this.observers.delete(observer) && !_this.observers.size) { + _this.tearDownQuery(); + } + }; + }) || this; + _this.observers = new Set(); + _this.subscriptions = new Set(); + // related classes + _this.queryInfo = queryInfo; + _this.queryManager = queryManager; + // active state + _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy); + _this.isTornDown = false; + var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d; + var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, + // Make sure we don't store "standby" as the initialFetchPolicy. + _f = options.initialFetchPolicy, + // Make sure we don't store "standby" as the initialFetchPolicy. + initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f; + _this.options = __assign(__assign({}, options), { + // Remember the initial options.fetchPolicy so we can revert back to this + // policy when variables change. This information can also be specified + // (or overridden) by providing options.initialFetchPolicy explicitly. + initialFetchPolicy: initialFetchPolicy, + // This ensures this.options.fetchPolicy always has a string value, in + // case options.fetchPolicy was not provided. + fetchPolicy: fetchPolicy }); + _this.queryId = queryInfo.queryId || queryManager.generateQueryId(); + var opDef = getOperationDefinition(_this.query); + _this.queryName = opDef && opDef.name && opDef.name.value; + return _this; + } + Object.defineProperty(ObservableQuery.prototype, "query", { + // The `query` computed property will always reflect the document transformed + // by the last run query. `this.options.query` will always reflect the raw + // untransformed query to ensure document transforms with runtime conditionals + // are run on the original document. + get: function () { + return this.lastQuery || this.options.query; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservableQuery.prototype, "variables", { + // Computed shorthand for this.options.variables, preserved for + // backwards compatibility. + /** + * An object containing the variables that were provided for the query. + */ + get: function () { + return this.options.variables; + }, + enumerable: false, + configurable: true + }); + ObservableQuery.prototype.result = function () { + var _this = this; + return new Promise(function (resolve, reject) { + // TODO: this code doesn’t actually make sense insofar as the observer + // will never exist in this.observers due how zen-observable wraps observables. + // https://github.com/zenparsing/zen-observable/blob/master/src/Observable.js#L169 + var observer = { + next: function (result) { + resolve(result); + // Stop the query within the QueryManager if we can before + // this function returns. + // + // We do this in order to prevent observers piling up within + // the QueryManager. Notice that we only fully unsubscribe + // from the subscription in a setTimeout(..., 0) call. This call can + // actually be handled by the browser at a much later time. If queries + // are fired in the meantime, observers that should have been removed + // from the QueryManager will continue to fire, causing an unnecessary + // performance hit. + _this.observers.delete(observer); + if (!_this.observers.size) { + _this.queryManager.removeQuery(_this.queryId); + } + setTimeout(function () { + subscription.unsubscribe(); + }, 0); + }, + error: reject, + }; + var subscription = _this.subscribe(observer); + }); + }; + /** @internal */ + ObservableQuery.prototype.resetDiff = function () { + this.queryInfo.resetDiff(); + }; + ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) { + if (saveAsLastResult === void 0) { saveAsLastResult = true; } + // Use the last result as long as the variables match this.variables. + var lastResult = this.getLastResult(true); + var networkStatus = this.queryInfo.networkStatus || + (lastResult && lastResult.networkStatus) || + NetworkStatus.ready; + var result = __assign(__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }); + var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a; + if ( + // These fetch policies should never deliver data from the cache, unless + // redelivering a previously delivered result. + skipCacheDataFor(fetchPolicy) || + // If this.options.query has @client(always: true) fields, we cannot + // trust diff.result, since it was read from the cache without running + // local resolvers (and it's too late to run resolvers now, since we must + // return a result synchronously). + this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) { + // Fall through. + } + else if (this.waitForOwnResult) { + // This would usually be a part of `QueryInfo.getDiff()`. + // which we skip in the waitForOwnResult case since we are not + // interested in the diff. + this.queryInfo["updateWatch"](); + } + else { + var diff = this.queryInfo.getDiff(); + if (diff.complete || this.options.returnPartialData) { + result.data = diff.result; + } + if (equal(result.data, {})) { + result.data = void 0; + } + if (diff.complete) { + // Similar to setting result.partial to false, but taking advantage of the + // falsiness of missing fields. + delete result.partial; + // If the diff is complete, and we're using a FetchPolicy that + // terminates after a complete cache read, we can assume the next result + // we receive will have NetworkStatus.ready and !loading. + if (diff.complete && + result.networkStatus === NetworkStatus.loading && + (fetchPolicy === "cache-first" || fetchPolicy === "cache-only")) { + result.networkStatus = NetworkStatus.ready; + result.loading = false; + } + } + else { + result.partial = true; + } + if (globalThis.__DEV__ !== false && + !diff.complete && + !this.options.partialRefetch && + !result.loading && + !result.data && + !result.error) { + logMissingFieldErrors(diff.missing); + } + } + if (saveAsLastResult) { + this.updateLastResult(result); + } + return result; + }; + // Compares newResult to the snapshot we took of this.lastResult when it was + // first received. + ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) { + if (!this.last) { + return true; + } + var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ? + !equalByQuery(this.query, this.last.result, newResult, this.variables) + : !equal(this.last.result, newResult); + return (resultIsDifferent || (variables && !equal(this.last.variables, variables))); + }; + ObservableQuery.prototype.getLast = function (key, variablesMustMatch) { + var last = this.last; + if (last && + last[key] && + (!variablesMustMatch || equal(last.variables, this.variables))) { + return last[key]; + } + }; + ObservableQuery.prototype.getLastResult = function (variablesMustMatch) { + return this.getLast("result", variablesMustMatch); + }; + ObservableQuery.prototype.getLastError = function (variablesMustMatch) { + return this.getLast("error", variablesMustMatch); + }; + ObservableQuery.prototype.resetLastResults = function () { + delete this.last; + this.isTornDown = false; + }; + ObservableQuery.prototype.resetQueryStoreErrors = function () { + this.queryManager.resetErrors(this.queryId); + }; + /** + * Update the variables of this observable query, and fetch the new results. + * This method should be preferred over `setVariables` in most use cases. + * + * @param variables - The new set of variables. If there are missing variables, + * the previous values of those variables will be used. + */ + ObservableQuery.prototype.refetch = function (variables) { + var _a; + var reobserveOptions = { + // Always disable polling for refetches. + pollInterval: 0, + }; + // Unless the provided fetchPolicy always consults the network + // (no-cache, network-only, or cache-and-network), override it with + // network-only to force the refetch for this fetchQuery call. + var fetchPolicy = this.options.fetchPolicy; + if (fetchPolicy === "cache-and-network") { + reobserveOptions.fetchPolicy = fetchPolicy; + } + else if (fetchPolicy === "no-cache") { + reobserveOptions.fetchPolicy = "no-cache"; + } + else { + reobserveOptions.fetchPolicy = "network-only"; + } + if (globalThis.__DEV__ !== false && variables && hasOwnProperty.call(variables, "variables")) { + var queryDef = getQueryDefinition(this.query); + var vars = queryDef.variableDefinitions; + if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) { + globalThis.__DEV__ !== false && invariant.warn( + 20, + variables, + ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef + ); + } + } + if (variables && !equal(this.options.variables, variables)) { + // Update the existing options with new variables + reobserveOptions.variables = this.options.variables = __assign(__assign({}, this.options.variables), variables); + } + this.queryInfo.resetLastWrite(); + return this.reobserve(reobserveOptions, NetworkStatus.refetch); + }; + /** + * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/). + */ + ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { + var _this = this; + var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (__assign(__assign(__assign(__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: __assign(__assign({}, this.options.variables), fetchMoreOptions.variables) })))), { + // The fetchMore request goes immediately to the network and does + // not automatically write its result to the cache (hence no-cache + // instead of network-only), because we allow the caller of + // fetchMore to provide an updateQuery callback that determines how + // the data gets written to the cache. + fetchPolicy: "no-cache" }); + combinedOptions.query = this.transformDocument(combinedOptions.query); + var qid = this.queryManager.generateQueryId(); + // If a temporary query is passed to `fetchMore`, we don't want to store + // it as the last query result since it may be an optimized query for + // pagination. We will however run the transforms on the original document + // as well as the document passed in `fetchMoreOptions` to ensure the cache + // uses the most up-to-date document which may rely on runtime conditionals. + this.lastQuery = + fetchMoreOptions.query ? + this.transformDocument(this.options.query) + : combinedOptions.query; + // Simulate a loading result for the original query with + // result.networkStatus === NetworkStatus.fetchMore. + var queryInfo = this.queryInfo; + var originalNetworkStatus = queryInfo.networkStatus; + queryInfo.networkStatus = NetworkStatus.fetchMore; + if (combinedOptions.notifyOnNetworkStatusChange) { + this.observe(); + } + var updatedQuerySet = new Set(); + return this.queryManager + .fetchQuery(qid, combinedOptions, NetworkStatus.fetchMore) + .then(function (fetchMoreResult) { + _this.queryManager.removeQuery(qid); + if (queryInfo.networkStatus === NetworkStatus.fetchMore) { + queryInfo.networkStatus = originalNetworkStatus; + } + // Performing this cache update inside a cache.batch transaction ensures + // any affected cache.watch watchers are notified at most once about any + // updates. Most watchers will be using the QueryInfo class, which + // responds to notifications by calling reobserveCacheFirst to deliver + // fetchMore cache results back to this ObservableQuery. + _this.queryManager.cache.batch({ + update: function (cache) { + var updateQuery = fetchMoreOptions.updateQuery; + if (updateQuery) { + cache.updateQuery({ + query: _this.query, + variables: _this.variables, + returnPartialData: true, + optimistic: false, + }, function (previous) { + return updateQuery(previous, { + fetchMoreResult: fetchMoreResult.data, + variables: combinedOptions.variables, + }); + }); + } + else { + // If we're using a field policy instead of updateQuery, the only + // thing we need to do is write the new data to the cache using + // combinedOptions.variables (instead of this.variables, which is + // what this.updateQuery uses, because it works by abusing the + // original field value, keyed by the original variables). + cache.writeQuery({ + query: combinedOptions.query, + variables: combinedOptions.variables, + data: fetchMoreResult.data, + }); + } + }, + onWatchUpdated: function (watch) { + // Record the DocumentNode associated with any watched query whose + // data were updated by the cache writes above. + updatedQuerySet.add(watch.query); + }, + }); + return fetchMoreResult; + }) + .finally(function () { + // In case the cache writes above did not generate a broadcast + // notification (which would have been intercepted by onWatchUpdated), + // likely because the written data were the same as what was already in + // the cache, we still want fetchMore to deliver its final loading:false + // result with the unchanged data. + if (!updatedQuerySet.has(_this.query)) { + reobserveCacheFirst(_this); + } + }); + }; + // XXX the subscription variables are separate from the query variables. + // if you want to update subscription variables, right now you have to do that separately, + // and you can only do it by stopping the subscription and then subscribing again with new variables. + /** + * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query. + * + * This function returns _another_ function that you can call to terminate the subscription. + */ + ObservableQuery.prototype.subscribeToMore = function (options) { + var _this = this; + var subscription = this.queryManager + .startGraphQLSubscription({ + query: options.document, + variables: options.variables, + context: options.context, + }) + .subscribe({ + next: function (subscriptionData) { + var updateQuery = options.updateQuery; + if (updateQuery) { + _this.updateQuery(function (previous, _a) { + var variables = _a.variables; + return updateQuery(previous, { + subscriptionData: subscriptionData, + variables: variables, + }); + }); + } + }, + error: function (err) { + if (options.onError) { + options.onError(err); + return; + } + globalThis.__DEV__ !== false && invariant.error(21, err); + }, + }); + this.subscriptions.add(subscription); + return function () { + if (_this.subscriptions.delete(subscription)) { + subscription.unsubscribe(); + } + }; + }; + ObservableQuery.prototype.setOptions = function (newOptions) { + return this.reobserve(newOptions); + }; + ObservableQuery.prototype.silentSetOptions = function (newOptions) { + var mergedOptions = compact(this.options, newOptions || {}); + assign(this.options, mergedOptions); + }; + /** + * Update the variables of this observable query, and fetch the new results + * if they've changed. Most users should prefer `refetch` instead of + * `setVariables` in order to to be properly notified of results even when + * they come from the cache. + * + * Note: the `next` callback will *not* fire if the variables have not changed + * or if the result is coming from cache. + * + * Note: the promise will return the old results immediately if the variables + * have not changed. + * + * Note: the promise will return null immediately if the query is not active + * (there are no subscribers). + * + * @param variables - The new set of variables. If there are missing variables, + * the previous values of those variables will be used. + */ + ObservableQuery.prototype.setVariables = function (variables) { + if (equal(this.variables, variables)) { + // If we have no observers, then we don't actually want to make a network + // request. As soon as someone observes the query, the request will kick + // off. For now, we just store any changes. (See #1077) + return this.observers.size ? this.result() : Promise.resolve(); + } + this.options.variables = variables; + // See comment above + if (!this.observers.size) { + return Promise.resolve(); + } + return this.reobserve({ + // Reset options.fetchPolicy to its original value. + fetchPolicy: this.options.initialFetchPolicy, + variables: variables, + }, NetworkStatus.setVariables); + }; + /** + * A function that enables you to update the query's cached result without executing a followup GraphQL operation. + * + * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information. + */ + ObservableQuery.prototype.updateQuery = function (mapFn) { + var queryManager = this.queryManager; + var result = queryManager.cache.diff({ + query: this.options.query, + variables: this.variables, + returnPartialData: true, + optimistic: false, + }).result; + var newResult = mapFn(result, { + variables: this.variables, + }); + if (newResult) { + queryManager.cache.writeQuery({ + query: this.options.query, + data: newResult, + variables: this.variables, + }); + queryManager.broadcastQueries(); + } + }; + /** + * A function that instructs the query to begin re-executing at a specified interval (in milliseconds). + */ + ObservableQuery.prototype.startPolling = function (pollInterval) { + this.options.pollInterval = pollInterval; + this.updatePolling(); + }; + /** + * A function that instructs the query to stop polling after a previous call to `startPolling`. + */ + ObservableQuery.prototype.stopPolling = function () { + this.options.pollInterval = 0; + this.updatePolling(); + }; + // Update options.fetchPolicy according to options.nextFetchPolicy. + ObservableQuery.prototype.applyNextFetchPolicy = function (reason, + // It's possible to use this method to apply options.nextFetchPolicy to + // options.fetchPolicy even if options !== this.options, though that happens + // most often when the options are temporary, used for only one request and + // then thrown away, so nextFetchPolicy may not end up mattering. + options) { + if (options.nextFetchPolicy) { + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b; + if (fetchPolicy === "standby") { + // Do nothing, leaving options.fetchPolicy unchanged. + } + else if (typeof options.nextFetchPolicy === "function") { + // When someone chooses "cache-and-network" or "network-only" as their + // initial FetchPolicy, they often do not want future cache updates to + // trigger unconditional network requests, which is what repeatedly + // applying the "cache-and-network" or "network-only" policies would + // seem to imply. Instead, when the cache reports an update after the + // initial network request, it may be desirable for subsequent network + // requests to be triggered only if the cache result is incomplete. To + // that end, the options.nextFetchPolicy option provides an easy way to + // update options.fetchPolicy after the initial network request, without + // having to call observableQuery.setOptions. + options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, { + reason: reason, + options: options, + observable: this, + initialFetchPolicy: initialFetchPolicy, + }); + } + else if (reason === "variables-changed") { + options.fetchPolicy = initialFetchPolicy; + } + else { + options.fetchPolicy = options.nextFetchPolicy; + } + } + return options.fetchPolicy; + }; + ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) { + // TODO Make sure we update the networkStatus (and infer fetchVariables) + // before actually committing to the fetch. + this.queryManager.setObservableQuery(this); + return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query); + }; + // Turns polling on or off based on this.options.pollInterval. + ObservableQuery.prototype.updatePolling = function () { + var _this = this; + // Avoid polling in SSR mode + if (this.queryManager.ssrMode) { + return; + } + var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval; + if (!pollInterval) { + if (pollingInfo) { + clearTimeout(pollingInfo.timeout); + delete this.pollingInfo; + } + return; + } + if (pollingInfo && pollingInfo.interval === pollInterval) { + return; + } + invariant(pollInterval, 22); + var info = pollingInfo || (this.pollingInfo = {}); + info.interval = pollInterval; + var maybeFetch = function () { + var _a, _b; + if (_this.pollingInfo) { + if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) && + !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) { + _this.reobserve({ + // Most fetchPolicy options don't make sense to use in a polling context, as + // users wouldn't want to be polling the cache directly. However, network-only and + // no-cache are both useful for when the user wants to control whether or not the + // polled results are written to the cache. + fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ? + "no-cache" + : "network-only", + }, NetworkStatus.poll).then(poll, poll); + } + else { + poll(); + } + } + }; + var poll = function () { + var info = _this.pollingInfo; + if (info) { + clearTimeout(info.timeout); + info.timeout = setTimeout(maybeFetch, info.interval); + } + }; + poll(); + }; + ObservableQuery.prototype.updateLastResult = function (newResult, variables) { + if (variables === void 0) { variables = this.variables; } + var error = this.getLastError(); + // Preserve this.last.error unless the variables have changed. + if (error && this.last && !equal(variables, this.last.variables)) { + error = void 0; + } + return (this.last = __assign({ result: this.queryManager.assumeImmutableResults ? + newResult + : cloneDeep(newResult), variables: variables }, (error ? { error: error } : null))); + }; + ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) { + var _this = this; + this.isTornDown = false; + var useDisposableConcast = + // Refetching uses a disposable Concast to allow refetches using different + // options/variables, without permanently altering the options of the + // original ObservableQuery. + newNetworkStatus === NetworkStatus.refetch || + // The fetchMore method does not actually call the reobserve method, but, + // if it did, it would definitely use a disposable Concast. + newNetworkStatus === NetworkStatus.fetchMore || + // Polling uses a disposable Concast so the polling options (which force + // fetchPolicy to be "network-only" or "no-cache") won't override the original options. + newNetworkStatus === NetworkStatus.poll; + // Save the old variables, since Object.assign may modify them below. + var oldVariables = this.options.variables; + var oldFetchPolicy = this.options.fetchPolicy; + var mergedOptions = compact(this.options, newOptions || {}); + var options = useDisposableConcast ? + // Disposable Concast fetches receive a shallow copy of this.options + // (merged with newOptions), leaving this.options unmodified. + mergedOptions + : assign(this.options, mergedOptions); + // Don't update options.query with the transformed query to avoid + // overwriting this.options.query when we aren't using a disposable concast. + // We want to ensure we can re-run the custom document transforms the next + // time a request is made against the original query. + var query = this.transformDocument(options.query); + this.lastQuery = query; + if (!useDisposableConcast) { + // We can skip calling updatePolling if we're not changing this.options. + this.updatePolling(); + // Reset options.fetchPolicy to its original value when variables change, + // unless a new fetchPolicy was provided by newOptions. + if (newOptions && + newOptions.variables && + !equal(newOptions.variables, oldVariables) && + // Don't mess with the fetchPolicy if it's currently "standby". + options.fetchPolicy !== "standby" && + // If we're changing the fetchPolicy anyway, don't try to change it here + // using applyNextFetchPolicy. The explicit options.fetchPolicy wins. + options.fetchPolicy === oldFetchPolicy) { + this.applyNextFetchPolicy("variables-changed", options); + if (newNetworkStatus === void 0) { + newNetworkStatus = NetworkStatus.setVariables; + } + } + } + this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy)); + var finishWaitingForOwnResult = function () { + if (_this.concast === concast) { + _this.waitForOwnResult = false; + } + }; + var variables = options.variables && __assign({}, options.variables); + var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink; + var observer = { + next: function (result) { + if (equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportResult(result, variables); + } + }, + error: function (error) { + if (equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportError(error, variables); + } + }, + }; + if (!useDisposableConcast && (fromLink || !this.concast)) { + // We use the {add,remove}Observer methods directly to avoid wrapping + // observer with an unnecessary SubscriptionObserver object. + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + } + this.concast = concast; + this.observer = observer; + } + concast.addObserver(observer); + return concast; + }; + ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) { + return this.reobserveAsConcast(newOptions, newNetworkStatus) + .promise; + }; + ObservableQuery.prototype.resubscribeAfterError = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + // If `lastError` is set in the current when the subscription is re-created, + // the subscription will immediately receive the error, which will + // cause it to terminate again. To avoid this, we first clear + // the last error/result from the `observableQuery` before re-starting + // the subscription, and restore the last value afterwards so that the + // subscription has a chance to stay open. + var last = this.last; + this.resetLastResults(); + var subscription = this.subscribe.apply(this, args); + this.last = last; + return subscription; + }; + // (Re)deliver the current result to this.observers without applying fetch + // policies or making network requests. + ObservableQuery.prototype.observe = function () { + this.reportResult( + // Passing false is important so that this.getCurrentResult doesn't + // save the fetchMore result as this.lastResult, causing it to be + // ignored due to the this.isDifferentFromLastResult check in + // this.reportResult. + this.getCurrentResult(false), this.variables); + }; + ObservableQuery.prototype.reportResult = function (result, variables) { + var lastError = this.getLastError(); + var isDifferent = this.isDifferentFromLastResult(result, variables); + // Update the last result even when isDifferentFromLastResult returns false, + // because the query may be using the @nonreactive directive, and we want to + // save the the latest version of any nonreactive subtrees (in case + // getCurrentResult is called), even though we skip broadcasting changes. + if (lastError || !result.partial || this.options.returnPartialData) { + this.updateLastResult(result, variables); + } + if (lastError || isDifferent) { + iterateObserversSafely(this.observers, "next", result); + } + }; + ObservableQuery.prototype.reportError = function (error, variables) { + // Since we don't get the current result on errors, only the error, we + // must mirror the updates that occur in QueryStore.markQueryError here + var errorResult = __assign(__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: NetworkStatus.error, loading: false }); + this.updateLastResult(errorResult, variables); + iterateObserversSafely(this.observers, "error", (this.last.error = error)); + }; + ObservableQuery.prototype.hasObservers = function () { + return this.observers.size > 0; + }; + ObservableQuery.prototype.tearDownQuery = function () { + if (this.isTornDown) + return; + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + delete this.concast; + delete this.observer; + } + this.stopPolling(); + // stop all active GraphQL subscriptions + this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); + this.subscriptions.clear(); + this.queryManager.stopQuery(this.queryId); + this.observers.clear(); + this.isTornDown = true; + }; + ObservableQuery.prototype.transformDocument = function (document) { + return this.queryManager.transform(document); + }; + return ObservableQuery; +}(Observable)); +export { ObservableQuery }; +// Necessary because the ObservableQuery constructor has a different +// signature than the Observable constructor. +fixObservableSubclass(ObservableQuery); +// Reobserve with fetchPolicy effectively set to "cache-first", triggering +// delivery of any new data from the cache, possibly falling back to the network +// if any cache data are missing. This allows _complete_ cache results to be +// delivered without also kicking off unnecessary network requests when +// this.options.fetchPolicy is "cache-and-network" or "network-only". When +// this.options.fetchPolicy is any other policy ("cache-first", "cache-only", +// "standby", or "no-cache"), we call this.reobserve() as usual. +export function reobserveCacheFirst(obsQuery) { + var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy; + if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") { + return obsQuery.reobserve({ + fetchPolicy: "cache-first", + // Use a temporary nextFetchPolicy function that replaces itself with the + // previous nextFetchPolicy value and returns the original fetchPolicy. + nextFetchPolicy: function (currentFetchPolicy, context) { + // Replace this nextFetchPolicy function in the options object with the + // original this.options.nextFetchPolicy value. + this.nextFetchPolicy = nextFetchPolicy; + // If the original nextFetchPolicy value was a function, give it a + // chance to decide what happens here. + if (typeof this.nextFetchPolicy === "function") { + return this.nextFetchPolicy(currentFetchPolicy, context); + } + // Otherwise go back to the original this.options.fetchPolicy. + return fetchPolicy; + }, + }); + } + return obsQuery.reobserve(); +} +function defaultSubscriptionObserverErrorCallback(error) { + globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack); +} +export function logMissingFieldErrors(missing) { + if (globalThis.__DEV__ !== false && missing) { + globalThis.__DEV__ !== false && invariant.debug(24, missing); + } +} +function skipCacheDataFor(fetchPolicy /* `undefined` would mean `"cache-first"` */) { + return (fetchPolicy === "network-only" || + fetchPolicy === "no-cache" || + fetchPolicy === "standby"); +} +//# sourceMappingURL=ObservableQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js.map b/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js.map new file mode 100644 index 0000000..449305e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/ObservableQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ObservableQuery.js","sourceRoot":"","sources":["../../src/core/ObservableQuery.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CA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C;oBAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;gBAC3D,CAAC;gBACD,8DAA8D;gBAC9D,OAAO,WAAY,CAAC;YACtB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,wCAAwC,CAAC,KAAkB;IAClE,SAAS,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAAsD;IAEtD,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;QACvB,SAAS,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CACvB,WAAmC,CAAC,4CAA4C;IAEhF,OAAO,CACL,WAAW,KAAK,cAAc;QAC9B,WAAW,KAAK,UAAU;QAC1B,WAAW,KAAK,SAAS,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../utilities/globals/index.js\";\nimport type { DocumentNode } from \"graphql\";\nimport { equal } from \"@wry/equality\";\n\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport type {\n Concast,\n Observer,\n ObservableSubscription,\n} from \"../utilities/index.js\";\nimport {\n cloneDeep,\n compact,\n getOperationDefinition,\n Observable,\n iterateObserversSafely,\n fixObservableSubclass,\n getQueryDefinition,\n} from \"../utilities/index.js\";\nimport type { ApolloError } from \"../errors/index.js\";\nimport type { QueryManager } from \"./QueryManager.js\";\nimport type {\n ApolloQueryResult,\n OperationVariables,\n TypedDocumentNode,\n} from \"./types.js\";\nimport type {\n WatchQueryOptions,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n NextFetchPolicyContext,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\nimport type { QueryInfo } from \"./QueryInfo.js\";\nimport type { MissingFieldError } from \"../cache/index.js\";\nimport type { MissingTree } from \"../cache/core/types/common.js\";\nimport { equalByQuery } from \"./equalByQuery.js\";\nimport type { TODO } from \"../utilities/types/TODO.js\";\n\nconst { assign, hasOwnProperty } = Object;\n\nexport interface FetchMoreOptions<\n TData = any,\n TVariables = OperationVariables,\n> {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult?: TData;\n variables?: TVariables;\n }\n ) => TData;\n}\n\nexport interface UpdateQueryOptions {\n variables?: TVariables;\n}\n\ninterface Last {\n result: ApolloQueryResult;\n variables?: TVariables;\n error?: ApolloError;\n}\n\nexport class ObservableQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends Observable> {\n public readonly options: WatchQueryOptions;\n public readonly queryId: string;\n public readonly queryName?: string;\n\n // The `query` computed property will always reflect the document transformed\n // by the last run query. `this.options.query` will always reflect the raw\n // untransformed query to ensure document transforms with runtime conditionals\n // are run on the original document.\n public get query(): TypedDocumentNode {\n return this.lastQuery || this.options.query;\n }\n\n // Computed shorthand for this.options.variables, preserved for\n // backwards compatibility.\n /**\n * An object containing the variables that were provided for the query.\n */\n public get variables(): TVariables | undefined {\n return this.options.variables;\n }\n\n private isTornDown: boolean;\n private queryManager: QueryManager;\n private observers = new Set>>();\n private subscriptions = new Set();\n\n private waitForOwnResult: boolean;\n private last?: Last;\n private lastQuery?: DocumentNode;\n\n private queryInfo: QueryInfo;\n\n // When this.concast is defined, this.observer is the Observer currently\n // subscribed to that Concast.\n private concast?: Concast>;\n private observer?: Observer>;\n\n private pollingInfo?: {\n interval: number;\n timeout: ReturnType;\n };\n\n constructor({\n queryManager,\n queryInfo,\n options,\n }: {\n queryManager: QueryManager;\n queryInfo: QueryInfo;\n options: WatchQueryOptions;\n }) {\n super((observer: Observer>) => {\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = (observer as any)._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n } catch {}\n\n const first = !this.observers.size;\n this.observers.add(observer);\n\n // Deliver most recent error or result.\n const last = this.last;\n if (last && last.error) {\n observer.error && observer.error(last.error);\n } else if (last && last.result) {\n observer.next && observer.next(last.result);\n }\n\n // Initiate observation of this query if it hasn't been reported to\n // the QueryManager yet.\n if (first) {\n // Blindly catching here prevents unhandled promise rejections,\n // and is safe because the ObservableQuery handles this error with\n // this.observer.error, so we're not just swallowing the error by\n // ignoring it here.\n this.reobserve().catch(() => {});\n }\n\n return () => {\n if (this.observers.delete(observer) && !this.observers.size) {\n this.tearDownQuery();\n }\n };\n });\n\n // related classes\n this.queryInfo = queryInfo;\n this.queryManager = queryManager;\n\n // active state\n this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);\n this.isTornDown = false;\n\n const {\n watchQuery: { fetchPolicy: defaultFetchPolicy = \"cache-first\" } = {},\n } = queryManager.defaultOptions;\n\n const {\n fetchPolicy = defaultFetchPolicy,\n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n initialFetchPolicy = fetchPolicy === \"standby\" ? defaultFetchPolicy : (\n fetchPolicy\n ),\n } = options;\n\n this.options = {\n ...options,\n\n // Remember the initial options.fetchPolicy so we can revert back to this\n // policy when variables change. This information can also be specified\n // (or overridden) by providing options.initialFetchPolicy explicitly.\n initialFetchPolicy,\n\n // This ensures this.options.fetchPolicy always has a string value, in\n // case options.fetchPolicy was not provided.\n fetchPolicy,\n };\n\n this.queryId = queryInfo.queryId || queryManager.generateQueryId();\n\n const opDef = getOperationDefinition(this.query);\n this.queryName = opDef && opDef.name && opDef.name.value;\n }\n\n public result(): Promise> {\n return new Promise((resolve, reject) => {\n // TODO: this code doesn’t actually make sense insofar as the observer\n // will never exist in this.observers due how zen-observable wraps observables.\n // https://github.com/zenparsing/zen-observable/blob/master/src/Observable.js#L169\n const observer: Observer> = {\n next: (result: ApolloQueryResult) => {\n resolve(result);\n\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n this.observers.delete(observer);\n if (!this.observers.size) {\n this.queryManager.removeQuery(this.queryId);\n }\n\n setTimeout(() => {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n const subscription = this.subscribe(observer);\n });\n }\n\n /** @internal */\n public resetDiff() {\n this.queryInfo.resetDiff();\n }\n\n public getCurrentResult(saveAsLastResult = true): ApolloQueryResult {\n // Use the last result as long as the variables match this.variables.\n const lastResult = this.getLastResult(true);\n\n const networkStatus =\n this.queryInfo.networkStatus ||\n (lastResult && lastResult.networkStatus) ||\n NetworkStatus.ready;\n\n const result = {\n ...lastResult,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n } as ApolloQueryResult;\n\n const { fetchPolicy = \"cache-first\" } = this.options;\n if (\n // These fetch policies should never deliver data from the cache, unless\n // redelivering a previously delivered result.\n skipCacheDataFor(fetchPolicy) ||\n // If this.options.query has @client(always: true) fields, we cannot\n // trust diff.result, since it was read from the cache without running\n // local resolvers (and it's too late to run resolvers now, since we must\n // return a result synchronously).\n this.queryManager.getDocumentInfo(this.query).hasForcedResolvers\n ) {\n // Fall through.\n } else if (this.waitForOwnResult) {\n // This would usually be a part of `QueryInfo.getDiff()`.\n // which we skip in the waitForOwnResult case since we are not\n // interested in the diff.\n this.queryInfo[\"updateWatch\"]();\n } else {\n const diff = this.queryInfo.getDiff();\n\n if (diff.complete || this.options.returnPartialData) {\n result.data = diff.result;\n }\n\n if (equal(result.data, {})) {\n result.data = void 0 as any;\n }\n\n if (diff.complete) {\n // Similar to setting result.partial to false, but taking advantage of the\n // falsiness of missing fields.\n delete result.partial;\n\n // If the diff is complete, and we're using a FetchPolicy that\n // terminates after a complete cache read, we can assume the next result\n // we receive will have NetworkStatus.ready and !loading.\n if (\n diff.complete &&\n result.networkStatus === NetworkStatus.loading &&\n (fetchPolicy === \"cache-first\" || fetchPolicy === \"cache-only\")\n ) {\n result.networkStatus = NetworkStatus.ready;\n result.loading = false;\n }\n } else {\n result.partial = true;\n }\n\n if (\n __DEV__ &&\n !diff.complete &&\n !this.options.partialRefetch &&\n !result.loading &&\n !result.data &&\n !result.error\n ) {\n logMissingFieldErrors(diff.missing);\n }\n }\n\n if (saveAsLastResult) {\n this.updateLastResult(result);\n }\n\n return result;\n }\n\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n public isDifferentFromLastResult(\n newResult: ApolloQueryResult,\n variables?: TVariables\n ) {\n if (!this.last) {\n return true;\n }\n\n const resultIsDifferent =\n this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ?\n !equalByQuery(this.query, this.last.result, newResult, this.variables)\n : !equal(this.last.result, newResult);\n\n return (\n resultIsDifferent || (variables && !equal(this.last.variables, variables))\n );\n }\n\n private getLast>(\n key: K,\n variablesMustMatch?: boolean\n ) {\n const last = this.last;\n if (\n last &&\n last[key] &&\n (!variablesMustMatch || equal(last.variables, this.variables))\n ) {\n return last[key];\n }\n }\n\n public getLastResult(\n variablesMustMatch?: boolean\n ): ApolloQueryResult | undefined {\n return this.getLast(\"result\", variablesMustMatch);\n }\n\n public getLastError(variablesMustMatch?: boolean): ApolloError | undefined {\n return this.getLast(\"error\", variablesMustMatch);\n }\n\n public resetLastResults(): void {\n delete this.last;\n this.isTornDown = false;\n }\n\n public resetQueryStoreErrors() {\n this.queryManager.resetErrors(this.queryId);\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public refetch(\n variables?: Partial\n ): Promise> {\n const reobserveOptions: Partial> = {\n // Always disable polling for refetches.\n pollInterval: 0,\n };\n\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n const { fetchPolicy } = this.options;\n if (fetchPolicy === \"cache-and-network\") {\n reobserveOptions.fetchPolicy = fetchPolicy;\n } else if (fetchPolicy === \"no-cache\") {\n reobserveOptions.fetchPolicy = \"no-cache\";\n } else {\n reobserveOptions.fetchPolicy = \"network-only\";\n }\n\n if (__DEV__ && variables && hasOwnProperty.call(variables, \"variables\")) {\n const queryDef = getQueryDefinition(this.query);\n const vars = queryDef.variableDefinitions;\n if (!vars || !vars.some((v) => v.variable.name.value === \"variables\")) {\n invariant.warn(\n `Called refetch(%o) for query %o, which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?`,\n variables,\n queryDef.name?.value || queryDef\n );\n }\n }\n\n if (variables && !equal(this.options.variables, variables)) {\n // Update the existing options with new variables\n reobserveOptions.variables = this.options.variables = {\n ...this.options.variables,\n ...variables,\n } as TVariables;\n }\n\n this.queryInfo.resetLastWrite();\n return this.reobserve(reobserveOptions, NetworkStatus.refetch);\n }\n\n /**\n * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).\n */\n public fetchMore<\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(\n fetchMoreOptions: FetchMoreQueryOptions & {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult: TFetchData;\n variables: TFetchVars;\n }\n ) => TData;\n }\n ): Promise> {\n const combinedOptions = {\n ...(fetchMoreOptions.query ? fetchMoreOptions : (\n {\n ...this.options,\n query: this.options.query,\n ...fetchMoreOptions,\n variables: {\n ...this.options.variables,\n ...fetchMoreOptions.variables,\n },\n }\n )),\n // The fetchMore request goes immediately to the network and does\n // not automatically write its result to the cache (hence no-cache\n // instead of network-only), because we allow the caller of\n // fetchMore to provide an updateQuery callback that determines how\n // the data gets written to the cache.\n fetchPolicy: \"no-cache\",\n } as WatchQueryOptions;\n\n combinedOptions.query = this.transformDocument(combinedOptions.query);\n\n const qid = this.queryManager.generateQueryId();\n\n // If a temporary query is passed to `fetchMore`, we don't want to store\n // it as the last query result since it may be an optimized query for\n // pagination. We will however run the transforms on the original document\n // as well as the document passed in `fetchMoreOptions` to ensure the cache\n // uses the most up-to-date document which may rely on runtime conditionals.\n this.lastQuery =\n fetchMoreOptions.query ?\n this.transformDocument(this.options.query)\n : combinedOptions.query;\n\n // Simulate a loading result for the original query with\n // result.networkStatus === NetworkStatus.fetchMore.\n const { queryInfo } = this;\n const originalNetworkStatus = queryInfo.networkStatus;\n queryInfo.networkStatus = NetworkStatus.fetchMore;\n if (combinedOptions.notifyOnNetworkStatusChange) {\n this.observe();\n }\n\n const updatedQuerySet = new Set();\n\n return this.queryManager\n .fetchQuery(qid, combinedOptions, NetworkStatus.fetchMore)\n .then((fetchMoreResult) => {\n this.queryManager.removeQuery(qid);\n\n if (queryInfo.networkStatus === NetworkStatus.fetchMore) {\n queryInfo.networkStatus = originalNetworkStatus;\n }\n\n // Performing this cache update inside a cache.batch transaction ensures\n // any affected cache.watch watchers are notified at most once about any\n // updates. Most watchers will be using the QueryInfo class, which\n // responds to notifications by calling reobserveCacheFirst to deliver\n // fetchMore cache results back to this ObservableQuery.\n this.queryManager.cache.batch({\n update: (cache) => {\n const { updateQuery } = fetchMoreOptions;\n if (updateQuery) {\n cache.updateQuery(\n {\n query: this.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n },\n (previous) =>\n updateQuery(previous!, {\n fetchMoreResult: fetchMoreResult.data,\n variables: combinedOptions.variables as TFetchVars,\n })\n );\n } else {\n // If we're using a field policy instead of updateQuery, the only\n // thing we need to do is write the new data to the cache using\n // combinedOptions.variables (instead of this.variables, which is\n // what this.updateQuery uses, because it works by abusing the\n // original field value, keyed by the original variables).\n cache.writeQuery({\n query: combinedOptions.query,\n variables: combinedOptions.variables,\n data: fetchMoreResult.data,\n });\n }\n },\n\n onWatchUpdated: (watch) => {\n // Record the DocumentNode associated with any watched query whose\n // data were updated by the cache writes above.\n updatedQuerySet.add(watch.query);\n },\n });\n\n return fetchMoreResult;\n })\n .finally(() => {\n // In case the cache writes above did not generate a broadcast\n // notification (which would have been intercepted by onWatchUpdated),\n // likely because the written data were the same as what was already in\n // the cache, we still want fetchMore to deliver its final loading:false\n // result with the unchanged data.\n if (!updatedQuerySet.has(this.query)) {\n reobserveCacheFirst(this);\n }\n });\n }\n\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n /**\n * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.\n *\n * This function returns _another_ function that you can call to terminate the subscription.\n */\n public subscribeToMore<\n TSubscriptionData = TData,\n TSubscriptionVariables extends OperationVariables = TVariables,\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >\n ) {\n const subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n context: options.context,\n })\n .subscribe({\n next: (subscriptionData: { data: TSubscriptionData }) => {\n const { updateQuery } = options;\n if (updateQuery) {\n this.updateQuery(\n (previous, { variables }) =>\n updateQuery(previous, {\n subscriptionData,\n variables,\n })\n );\n }\n },\n error: (err: any) => {\n if (options.onError) {\n options.onError(err);\n return;\n }\n invariant.error(\"Unhandled GraphQL subscription error\", err);\n },\n });\n\n this.subscriptions.add(subscription);\n\n return () => {\n if (this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n }\n\n public setOptions(\n newOptions: Partial>\n ): Promise> {\n return this.reobserve(newOptions);\n }\n\n public silentSetOptions(\n newOptions: Partial>\n ) {\n const mergedOptions = compact(this.options, newOptions || {});\n assign(this.options, mergedOptions);\n }\n\n /**\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. Most users should prefer `refetch` instead of\n * `setVariables` in order to to be properly notified of results even when\n * they come from the cache.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n public setVariables(\n variables: TVariables\n ): Promise | void> {\n if (equal(this.variables, variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size ? this.result() : Promise.resolve();\n }\n\n this.options.variables = variables;\n\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n\n return this.reobserve(\n {\n // Reset options.fetchPolicy to its original value.\n fetchPolicy: this.options.initialFetchPolicy,\n variables,\n },\n NetworkStatus.setVariables\n );\n }\n\n /**\n * A function that enables you to update the query's cached result without executing a followup GraphQL operation.\n *\n * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.\n */\n public updateQuery(\n mapFn: (\n previousQueryResult: TData,\n options: Pick, \"variables\">\n ) => TData\n ): void {\n const { queryManager } = this;\n const { result } = queryManager.cache.diff({\n query: this.options.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n const newResult = mapFn(result!, {\n variables: (this as any).variables,\n });\n\n if (newResult) {\n queryManager.cache.writeQuery({\n query: this.options.query,\n data: newResult,\n variables: this.variables,\n });\n\n queryManager.broadcastQueries();\n }\n }\n\n /**\n * A function that instructs the query to begin re-executing at a specified interval (in milliseconds).\n */\n public startPolling(pollInterval: number) {\n this.options.pollInterval = pollInterval;\n this.updatePolling();\n }\n\n /**\n * A function that instructs the query to stop polling after a previous call to `startPolling`.\n */\n public stopPolling() {\n this.options.pollInterval = 0;\n this.updatePolling();\n }\n\n // Update options.fetchPolicy according to options.nextFetchPolicy.\n private applyNextFetchPolicy(\n reason: NextFetchPolicyContext[\"reason\"],\n // It's possible to use this method to apply options.nextFetchPolicy to\n // options.fetchPolicy even if options !== this.options, though that happens\n // most often when the options are temporary, used for only one request and\n // then thrown away, so nextFetchPolicy may not end up mattering.\n options: WatchQueryOptions\n ) {\n if (options.nextFetchPolicy) {\n const { fetchPolicy = \"cache-first\", initialFetchPolicy = fetchPolicy } =\n options;\n\n if (fetchPolicy === \"standby\") {\n // Do nothing, leaving options.fetchPolicy unchanged.\n } else if (typeof options.nextFetchPolicy === \"function\") {\n // When someone chooses \"cache-and-network\" or \"network-only\" as their\n // initial FetchPolicy, they often do not want future cache updates to\n // trigger unconditional network requests, which is what repeatedly\n // applying the \"cache-and-network\" or \"network-only\" policies would\n // seem to imply. Instead, when the cache reports an update after the\n // initial network request, it may be desirable for subsequent network\n // requests to be triggered only if the cache result is incomplete. To\n // that end, the options.nextFetchPolicy option provides an easy way to\n // update options.fetchPolicy after the initial network request, without\n // having to call observableQuery.setOptions.\n options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {\n reason,\n options,\n observable: this,\n initialFetchPolicy,\n });\n } else if (reason === \"variables-changed\") {\n options.fetchPolicy = initialFetchPolicy;\n } else {\n options.fetchPolicy = options.nextFetchPolicy;\n }\n }\n\n return options.fetchPolicy;\n }\n\n private fetch(\n options: WatchQueryOptions,\n newNetworkStatus?: NetworkStatus,\n query?: DocumentNode\n ) {\n // TODO Make sure we update the networkStatus (and infer fetchVariables)\n // before actually committing to the fetch.\n this.queryManager.setObservableQuery(this);\n return this.queryManager[\"fetchConcastWithInfo\"](\n this.queryId,\n options,\n newNetworkStatus,\n query\n );\n }\n\n // Turns polling on or off based on this.options.pollInterval.\n private updatePolling() {\n // Avoid polling in SSR mode\n if (this.queryManager.ssrMode) {\n return;\n }\n\n const {\n pollingInfo,\n options: { pollInterval },\n } = this;\n\n if (!pollInterval) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n\n if (pollingInfo && pollingInfo.interval === pollInterval) {\n return;\n }\n\n invariant(\n pollInterval,\n \"Attempted to start a polling query without a polling interval.\"\n );\n\n const info = pollingInfo || (this.pollingInfo = {} as any);\n info.interval = pollInterval;\n\n const maybeFetch = () => {\n if (this.pollingInfo) {\n if (\n !isNetworkRequestInFlight(this.queryInfo.networkStatus) &&\n !this.options.skipPollAttempt?.()\n ) {\n this.reobserve(\n {\n // Most fetchPolicy options don't make sense to use in a polling context, as\n // users wouldn't want to be polling the cache directly. However, network-only and\n // no-cache are both useful for when the user wants to control whether or not the\n // polled results are written to the cache.\n fetchPolicy:\n this.options.initialFetchPolicy === \"no-cache\" ?\n \"no-cache\"\n : \"network-only\",\n },\n NetworkStatus.poll\n ).then(poll, poll);\n } else {\n poll();\n }\n }\n };\n\n const poll = () => {\n const info = this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n\n poll();\n }\n\n private updateLastResult(\n newResult: ApolloQueryResult,\n variables = this.variables\n ) {\n let error: ApolloError | undefined = this.getLastError();\n // Preserve this.last.error unless the variables have changed.\n if (error && this.last && !equal(variables, this.last.variables)) {\n error = void 0;\n }\n return (this.last = {\n result:\n this.queryManager.assumeImmutableResults ?\n newResult\n : cloneDeep(newResult),\n variables,\n ...(error ? { error } : null),\n });\n }\n\n public reobserveAsConcast(\n newOptions?: Partial>,\n newNetworkStatus?: NetworkStatus\n ): Concast> {\n this.isTornDown = false;\n\n const useDisposableConcast =\n // Refetching uses a disposable Concast to allow refetches using different\n // options/variables, without permanently altering the options of the\n // original ObservableQuery.\n newNetworkStatus === NetworkStatus.refetch ||\n // The fetchMore method does not actually call the reobserve method, but,\n // if it did, it would definitely use a disposable Concast.\n newNetworkStatus === NetworkStatus.fetchMore ||\n // Polling uses a disposable Concast so the polling options (which force\n // fetchPolicy to be \"network-only\" or \"no-cache\") won't override the original options.\n newNetworkStatus === NetworkStatus.poll;\n\n // Save the old variables, since Object.assign may modify them below.\n const oldVariables = this.options.variables;\n const oldFetchPolicy = this.options.fetchPolicy;\n\n const mergedOptions = compact(this.options, newOptions || {});\n const options =\n useDisposableConcast ?\n // Disposable Concast fetches receive a shallow copy of this.options\n // (merged with newOptions), leaving this.options unmodified.\n mergedOptions\n : assign(this.options, mergedOptions);\n\n // Don't update options.query with the transformed query to avoid\n // overwriting this.options.query when we aren't using a disposable concast.\n // We want to ensure we can re-run the custom document transforms the next\n // time a request is made against the original query.\n const query = this.transformDocument(options.query);\n\n this.lastQuery = query;\n\n if (!useDisposableConcast) {\n // We can skip calling updatePolling if we're not changing this.options.\n this.updatePolling();\n\n // Reset options.fetchPolicy to its original value when variables change,\n // unless a new fetchPolicy was provided by newOptions.\n if (\n newOptions &&\n newOptions.variables &&\n !equal(newOptions.variables, oldVariables) &&\n // Don't mess with the fetchPolicy if it's currently \"standby\".\n options.fetchPolicy !== \"standby\" &&\n // If we're changing the fetchPolicy anyway, don't try to change it here\n // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.\n options.fetchPolicy === oldFetchPolicy\n ) {\n this.applyNextFetchPolicy(\"variables-changed\", options);\n if (newNetworkStatus === void 0) {\n newNetworkStatus = NetworkStatus.setVariables;\n }\n }\n }\n\n this.waitForOwnResult &&= skipCacheDataFor(options.fetchPolicy);\n const finishWaitingForOwnResult = () => {\n if (this.concast === concast) {\n this.waitForOwnResult = false;\n }\n };\n\n const variables = options.variables && { ...options.variables };\n const { concast, fromLink } = this.fetch(options, newNetworkStatus, query);\n const observer: Observer> = {\n next: (result) => {\n if (equal(this.variables, variables)) {\n finishWaitingForOwnResult();\n this.reportResult(result, variables);\n }\n },\n error: (error) => {\n if (equal(this.variables, variables)) {\n finishWaitingForOwnResult();\n this.reportError(error, variables);\n }\n },\n };\n\n if (!useDisposableConcast && (fromLink || !this.concast)) {\n // We use the {add,remove}Observer methods directly to avoid wrapping\n // observer with an unnecessary SubscriptionObserver object.\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n }\n\n this.concast = concast;\n this.observer = observer;\n }\n\n concast.addObserver(observer);\n\n return concast;\n }\n\n public reobserve(\n newOptions?: Partial>,\n newNetworkStatus?: NetworkStatus\n ): Promise> {\n return this.reobserveAsConcast(newOptions, newNetworkStatus)\n .promise as TODO;\n }\n\n public resubscribeAfterError(\n onNext: (value: ApolloQueryResult) => void,\n onError?: (error: any) => void,\n onComplete?: () => void\n ): ObservableSubscription;\n\n public resubscribeAfterError(\n observer: Observer>\n ): ObservableSubscription;\n\n public resubscribeAfterError(...args: [any, any?, any?]) {\n // If `lastError` is set in the current when the subscription is re-created,\n // the subscription will immediately receive the error, which will\n // cause it to terminate again. To avoid this, we first clear\n // the last error/result from the `observableQuery` before re-starting\n // the subscription, and restore the last value afterwards so that the\n // subscription has a chance to stay open.\n const last = this.last;\n this.resetLastResults();\n\n const subscription = this.subscribe(...args);\n this.last = last;\n\n return subscription;\n }\n\n // (Re)deliver the current result to this.observers without applying fetch\n // policies or making network requests.\n private observe() {\n this.reportResult(\n // Passing false is important so that this.getCurrentResult doesn't\n // save the fetchMore result as this.lastResult, causing it to be\n // ignored due to the this.isDifferentFromLastResult check in\n // this.reportResult.\n this.getCurrentResult(false),\n this.variables\n );\n }\n\n private reportResult(\n result: ApolloQueryResult,\n variables: TVariables | undefined\n ) {\n const lastError = this.getLastError();\n const isDifferent = this.isDifferentFromLastResult(result, variables);\n // Update the last result even when isDifferentFromLastResult returns false,\n // because the query may be using the @nonreactive directive, and we want to\n // save the the latest version of any nonreactive subtrees (in case\n // getCurrentResult is called), even though we skip broadcasting changes.\n if (lastError || !result.partial || this.options.returnPartialData) {\n this.updateLastResult(result, variables);\n }\n if (lastError || isDifferent) {\n iterateObserversSafely(this.observers, \"next\", result);\n }\n }\n\n private reportError(error: ApolloError, variables: TVariables | undefined) {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n const errorResult = {\n ...this.getLastResult(),\n error,\n errors: error.graphQLErrors,\n networkStatus: NetworkStatus.error,\n loading: false,\n } as ApolloQueryResult;\n\n this.updateLastResult(errorResult, variables);\n\n iterateObserversSafely(this.observers, \"error\", (this.last!.error = error));\n }\n\n public hasObservers() {\n return this.observers.size > 0;\n }\n\n private tearDownQuery() {\n if (this.isTornDown) return;\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n delete this.observer;\n }\n\n this.stopPolling();\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach((sub) => sub.unsubscribe());\n this.subscriptions.clear();\n this.queryManager.stopQuery(this.queryId);\n this.observers.clear();\n this.isTornDown = true;\n }\n\n private transformDocument(document: DocumentNode) {\n return this.queryManager.transform(document);\n }\n}\n\n// Necessary because the ObservableQuery constructor has a different\n// signature than the Observable constructor.\nfixObservableSubclass(ObservableQuery);\n\n// Reobserve with fetchPolicy effectively set to \"cache-first\", triggering\n// delivery of any new data from the cache, possibly falling back to the network\n// if any cache data are missing. This allows _complete_ cache results to be\n// delivered without also kicking off unnecessary network requests when\n// this.options.fetchPolicy is \"cache-and-network\" or \"network-only\". When\n// this.options.fetchPolicy is any other policy (\"cache-first\", \"cache-only\",\n// \"standby\", or \"no-cache\"), we call this.reobserve() as usual.\nexport function reobserveCacheFirst(\n obsQuery: ObservableQuery\n) {\n const { fetchPolicy, nextFetchPolicy } = obsQuery.options;\n\n if (fetchPolicy === \"cache-and-network\" || fetchPolicy === \"network-only\") {\n return obsQuery.reobserve({\n fetchPolicy: \"cache-first\",\n // Use a temporary nextFetchPolicy function that replaces itself with the\n // previous nextFetchPolicy value and returns the original fetchPolicy.\n nextFetchPolicy(\n this: WatchQueryOptions,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext\n ) {\n // Replace this nextFetchPolicy function in the options object with the\n // original this.options.nextFetchPolicy value.\n this.nextFetchPolicy = nextFetchPolicy;\n // If the original nextFetchPolicy value was a function, give it a\n // chance to decide what happens here.\n if (typeof this.nextFetchPolicy === \"function\") {\n return this.nextFetchPolicy(currentFetchPolicy, context);\n }\n // Otherwise go back to the original this.options.fetchPolicy.\n return fetchPolicy!;\n },\n });\n }\n\n return obsQuery.reobserve();\n}\n\nfunction defaultSubscriptionObserverErrorCallback(error: ApolloError) {\n invariant.error(\"Unhandled error\", error.message, error.stack);\n}\n\nexport function logMissingFieldErrors(\n missing: MissingFieldError[] | MissingTree | undefined\n) {\n if (__DEV__ && missing) {\n invariant.debug(`Missing cache result fields: %o`, missing);\n }\n}\n\nfunction skipCacheDataFor(\n fetchPolicy?: WatchQueryFetchPolicy /* `undefined` would mean `\"cache-first\"` */\n) {\n return (\n fetchPolicy === \"network-only\" ||\n fetchPolicy === \"no-cache\" ||\n fetchPolicy === \"standby\"\n );\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.d.ts b/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.d.ts new file mode 100644 index 0000000..ab2e269 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.d.ts @@ -0,0 +1,61 @@ +import type { DocumentNode, GraphQLError } from "graphql"; +import type { Cache } from "../cache/index.js"; +import type { WatchQueryOptions, ErrorPolicy } from "./watchQueryOptions.js"; +import type { ObservableQuery } from "./ObservableQuery.js"; +import type { QueryListener } from "./types.js"; +import type { FetchResult } from "../link/core/index.js"; +import { NetworkStatus } from "./networkStatus.js"; +import type { ApolloError } from "../errors/index.js"; +import type { QueryManager } from "./QueryManager.js"; +export type QueryStoreValue = Pick; +export declare const enum CacheWriteBehavior { + FORBID = 0, + OVERWRITE = 1, + MERGE = 2 +} +export declare class QueryInfo { + readonly queryId: string; + listeners: Set; + document: DocumentNode | null; + lastRequestId: number; + variables?: Record; + networkStatus?: NetworkStatus; + networkError?: Error | null; + graphQLErrors?: ReadonlyArray; + stopped: boolean; + private cache; + constructor(queryManager: QueryManager, queryId?: string); + init(query: { + document: DocumentNode; + variables: Record | undefined; + networkStatus?: NetworkStatus; + observableQuery?: ObservableQuery; + lastRequestId?: number; + }): this; + private dirty; + private notifyTimeout?; + reset(): void; + resetDiff(): void; + getDiff(): Cache.DiffResult; + private lastDiff?; + private updateLastDiff; + private getDiffOptions; + setDiff(diff: Cache.DiffResult | null): void; + readonly observableQuery: ObservableQuery | null; + private oqListener?; + setObservableQuery(oq: ObservableQuery | null): void; + notify(): void; + private shouldNotify; + stop(): void; + private cancel; + private lastWatch?; + private updateWatch; + private lastWrite?; + resetLastWrite(): void; + private shouldWrite; + markResult(result: FetchResult, document: DocumentNode, options: Pick, cacheWriteBehavior: CacheWriteBehavior): void; + markReady(): NetworkStatus; + markError(error: ApolloError): ApolloError; +} +export declare function shouldWriteResult(result: FetchResult, errorPolicy?: ErrorPolicy): boolean; +//# sourceMappingURL=QueryInfo.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js b/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js new file mode 100644 index 0000000..b69480f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js @@ -0,0 +1,403 @@ +import { __assign } from "tslib"; +import { equal } from "@wry/equality"; +import { DeepMerger } from "../utilities/index.js"; +import { mergeIncrementalData } from "../utilities/index.js"; +import { reobserveCacheFirst } from "./ObservableQuery.js"; +import { isNonEmptyArray, graphQLResultHasError, canUseWeakMap, } from "../utilities/index.js"; +import { NetworkStatus, isNetworkRequestInFlight } from "./networkStatus.js"; +var destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)(); +function wrapDestructiveCacheMethod(cache, methodName) { + var original = cache[methodName]; + if (typeof original === "function") { + // @ts-expect-error this is just too generic to be typed correctly + cache[methodName] = function () { + destructiveMethodCounts.set(cache, + // The %1e15 allows the count to wrap around to 0 safely every + // quadrillion evictions, so there's no risk of overflow. To be + // clear, this is more of a pedantic principle than something + // that matters in any conceivable practical scenario. + (destructiveMethodCounts.get(cache) + 1) % 1e15); + // @ts-expect-error this is just too generic to be typed correctly + return original.apply(this, arguments); + }; + } +} +function cancelNotifyTimeout(info) { + if (info["notifyTimeout"]) { + clearTimeout(info["notifyTimeout"]); + info["notifyTimeout"] = void 0; + } +} +// A QueryInfo object represents a single query managed by the +// QueryManager, which tracks all QueryInfo objects by queryId in its +// this.queries Map. QueryInfo objects store the latest results and errors +// for the given query, and are responsible for reporting those results to +// the corresponding ObservableQuery, via the QueryInfo.notify method. +// Results are reported asynchronously whenever setDiff marks the +// QueryInfo object as dirty, though a call to the QueryManager's +// broadcastQueries method may trigger the notification before it happens +// automatically. This class used to be a simple interface type without +// any field privacy or meaningful methods, which is why it still has so +// many public fields. The effort to lock down and simplify the QueryInfo +// interface is ongoing, and further improvements are welcome. +var QueryInfo = /** @class */ (function () { + function QueryInfo(queryManager, queryId) { + if (queryId === void 0) { queryId = queryManager.generateQueryId(); } + this.queryId = queryId; + this.listeners = new Set(); + this.document = null; + this.lastRequestId = 1; + this.stopped = false; + this.dirty = false; + this.observableQuery = null; + var cache = (this.cache = queryManager.cache); + // Track how often cache.evict is called, since we want eviction to + // override the feud-stopping logic in the markResult method, by + // causing shouldWrite to return true. Wrapping the cache.evict method + // is a bit of a hack, but it saves us from having to make eviction + // counting an official part of the ApolloCache API. + if (!destructiveMethodCounts.has(cache)) { + destructiveMethodCounts.set(cache, 0); + wrapDestructiveCacheMethod(cache, "evict"); + wrapDestructiveCacheMethod(cache, "modify"); + wrapDestructiveCacheMethod(cache, "reset"); + } + } + QueryInfo.prototype.init = function (query) { + var networkStatus = query.networkStatus || NetworkStatus.loading; + if (this.variables && + this.networkStatus !== NetworkStatus.loading && + !equal(this.variables, query.variables)) { + networkStatus = NetworkStatus.setVariables; + } + if (!equal(query.variables, this.variables)) { + this.lastDiff = void 0; + } + Object.assign(this, { + document: query.document, + variables: query.variables, + networkError: null, + graphQLErrors: this.graphQLErrors || [], + networkStatus: networkStatus, + }); + if (query.observableQuery) { + this.setObservableQuery(query.observableQuery); + } + if (query.lastRequestId) { + this.lastRequestId = query.lastRequestId; + } + return this; + }; + QueryInfo.prototype.reset = function () { + cancelNotifyTimeout(this); + this.dirty = false; + }; + QueryInfo.prototype.resetDiff = function () { + this.lastDiff = void 0; + }; + QueryInfo.prototype.getDiff = function () { + var options = this.getDiffOptions(); + if (this.lastDiff && equal(options, this.lastDiff.options)) { + return this.lastDiff.diff; + } + this.updateWatch(this.variables); + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return { complete: false }; + } + var diff = this.cache.diff(options); + this.updateLastDiff(diff, options); + return diff; + }; + QueryInfo.prototype.updateLastDiff = function (diff, options) { + this.lastDiff = + diff ? + { + diff: diff, + options: options || this.getDiffOptions(), + } + : void 0; + }; + QueryInfo.prototype.getDiffOptions = function (variables) { + var _a; + if (variables === void 0) { variables = this.variables; } + return { + query: this.document, + variables: variables, + returnPartialData: true, + optimistic: true, + canonizeResults: (_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.canonizeResults, + }; + }; + QueryInfo.prototype.setDiff = function (diff) { + var _this = this; + var _a; + var oldDiff = this.lastDiff && this.lastDiff.diff; + // If we do not tolerate partial results, skip this update to prevent it + // from being reported. This prevents a situtuation where a query that + // errors and another succeeds with overlapping data does not report the + // partial data result to the errored query. + // + // See https://github.com/apollographql/apollo-client/issues/11400 for more + // information on this issue. + if (diff && + !diff.complete && + !((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.returnPartialData) && + // In the case of a cache eviction, the diff will become partial so we + // schedule a notification to send a network request (this.oqListener) to + // go and fetch the missing data. + !(oldDiff && oldDiff.complete)) { + return; + } + this.updateLastDiff(diff); + if (!this.dirty && !equal(oldDiff && oldDiff.result, diff && diff.result)) { + this.dirty = true; + if (!this.notifyTimeout) { + this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0); + } + } + }; + QueryInfo.prototype.setObservableQuery = function (oq) { + var _this = this; + if (oq === this.observableQuery) + return; + if (this.oqListener) { + this.listeners.delete(this.oqListener); + } + this.observableQuery = oq; + if (oq) { + oq["queryInfo"] = this; + this.listeners.add((this.oqListener = function () { + var diff = _this.getDiff(); + if (diff.fromOptimisticTransaction) { + // If this diff came from an optimistic transaction, deliver the + // current cache data to the ObservableQuery, but don't perform a + // reobservation, since oq.reobserveCacheFirst might make a network + // request, and we never want to trigger network requests in the + // middle of optimistic updates. + oq["observe"](); + } + else { + // Otherwise, make the ObservableQuery "reobserve" the latest data + // using a temporary fetch policy of "cache-first", so complete cache + // results have a chance to be delivered without triggering additional + // network requests, even when options.fetchPolicy is "network-only" + // or "cache-and-network". All other fetch policies are preserved by + // this method, and are handled by calling oq.reobserve(). If this + // reobservation is spurious, isDifferentFromLastResult still has a + // chance to catch it before delivery to ObservableQuery subscribers. + reobserveCacheFirst(oq); + } + })); + } + else { + delete this.oqListener; + } + }; + QueryInfo.prototype.notify = function () { + var _this = this; + cancelNotifyTimeout(this); + if (this.shouldNotify()) { + this.listeners.forEach(function (listener) { return listener(_this); }); + } + this.dirty = false; + }; + QueryInfo.prototype.shouldNotify = function () { + if (!this.dirty || !this.listeners.size) { + return false; + } + if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) { + var fetchPolicy = this.observableQuery.options.fetchPolicy; + if (fetchPolicy !== "cache-only" && fetchPolicy !== "cache-and-network") { + return false; + } + } + return true; + }; + QueryInfo.prototype.stop = function () { + if (!this.stopped) { + this.stopped = true; + // Cancel the pending notify timeout + this.reset(); + this.cancel(); + // Revert back to the no-op version of cancel inherited from + // QueryInfo.prototype. + this.cancel = QueryInfo.prototype.cancel; + var oq = this.observableQuery; + if (oq) + oq.stopPolling(); + } + }; + // This method is a no-op by default, until/unless overridden by the + // updateWatch method. + QueryInfo.prototype.cancel = function () { }; + QueryInfo.prototype.updateWatch = function (variables) { + var _this = this; + if (variables === void 0) { variables = this.variables; } + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return; + } + var watchOptions = __assign(__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } }); + if (!this.lastWatch || !equal(watchOptions, this.lastWatch)) { + this.cancel(); + this.cancel = this.cache.watch((this.lastWatch = watchOptions)); + } + }; + QueryInfo.prototype.resetLastWrite = function () { + this.lastWrite = void 0; + }; + QueryInfo.prototype.shouldWrite = function (result, variables) { + var lastWrite = this.lastWrite; + return !(lastWrite && + // If cache.evict has been called since the last time we wrote this + // data into the cache, there's a chance writing this result into + // the cache will repair what was evicted. + lastWrite.dmCount === destructiveMethodCounts.get(this.cache) && + equal(variables, lastWrite.variables) && + equal(result.data, lastWrite.result.data)); + }; + QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) { + var _this = this; + var merger = new DeepMerger(); + var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + // Cancel the pending notify timeout (if it exists) to prevent extraneous network + // requests. To allow future notify timeouts, diff and dirty are reset as well. + this.reset(); + if ("incremental" in result && isNonEmptyArray(result.incremental)) { + var mergedData = mergeIncrementalData(this.getDiff().result, result); + result.data = mergedData; + // Detect the first chunk of a deferred query and merge it with existing + // cache data. This ensures a `cache-first` fetch policy that returns + // partial cache data or a `cache-and-network` fetch policy that already + // has full data in the cache does not complain when trying to merge the + // initial deferred server data with existing cache data. + } + else if ("hasNext" in result && result.hasNext) { + var diff = this.getDiff(); + result.data = merger.merge(diff.result, result.data); + } + this.graphQLErrors = graphQLErrors; + if (options.fetchPolicy === "no-cache") { + this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables)); + } + else if (cacheWriteBehavior !== 0 /* CacheWriteBehavior.FORBID */) { + if (shouldWriteResult(result, options.errorPolicy)) { + // Using a transaction here so we have a chance to read the result + // back from the cache before the watch callback fires as a result + // of writeQuery, so we can store the new diff quietly and ignore + // it when we receive it redundantly from the watch callback. + this.cache.performTransaction(function (cache) { + if (_this.shouldWrite(result, options.variables)) { + cache.writeQuery({ + query: document, + data: result.data, + variables: options.variables, + overwrite: cacheWriteBehavior === 1 /* CacheWriteBehavior.OVERWRITE */, + }); + _this.lastWrite = { + result: result, + variables: options.variables, + dmCount: destructiveMethodCounts.get(_this.cache), + }; + } + else { + // If result is the same as the last result we received from + // the network (and the variables match too), avoid writing + // result into the cache again. The wisdom of skipping this + // cache write is far from obvious, since any cache write + // could be the one that puts the cache back into a desired + // state, fixing corruption or missing data. However, if we + // always write every network result into the cache, we enable + // feuds between queries competing to update the same data in + // incompatible ways, which can lead to an endless cycle of + // cache broadcasts and useless network requests. As with any + // feud, eventually one side must step back from the brink, + // letting the other side(s) have the last word(s). There may + // be other points where we could break this cycle, such as + // silencing the broadcast for cache.writeQuery (not a good + // idea, since it just delays the feud a bit) or somehow + // avoiding the network request that just happened (also bad, + // because the server could return useful new data). All + // options considered, skipping this cache write seems to be + // the least damaging place to break the cycle, because it + // reflects the intuition that we recently wrote this exact + // result into the cache, so the cache *should* already/still + // contain this data. If some other query has clobbered that + // data in the meantime, that's too bad, but there will be no + // winners if every query blindly reverts to its own version + // of the data. This approach also gives the network a chance + // to return new data, which will be written into the cache as + // usual, notifying only those queries that are directly + // affected by the cache updates, as usual. In the future, an + // even more sophisticated cache could perhaps prevent or + // mitigate the clobbering somehow, but that would make this + // particular cache write even less important, and thus + // skipping it would be even safer than it is today. + if (_this.lastDiff && _this.lastDiff.diff.complete) { + // Reuse data from the last good (complete) diff that we + // received, when possible. + result.data = _this.lastDiff.diff.result; + return; + } + // If the previous this.diff was incomplete, fall through to + // re-reading the latest data with cache.diff, below. + } + var diffOptions = _this.getDiffOptions(options.variables); + var diff = cache.diff(diffOptions); + // In case the QueryManager stops this QueryInfo before its + // results are delivered, it's important to avoid restarting the + // cache watch when markResult is called. We also avoid updating + // the watch if we are writing a result that doesn't match the current + // variables to avoid race conditions from broadcasting the wrong + // result. + if (!_this.stopped && equal(_this.variables, options.variables)) { + // Any time we're about to update this.diff, we need to make + // sure we've started watching the cache. + _this.updateWatch(options.variables); + } + // If we're allowed to write to the cache, and we can read a + // complete result from the cache, update result.data to be the + // result from the cache, rather than the raw network result. + // Set without setDiff to avoid triggering a notify call, since + // we have other ways of notifying for this result. + _this.updateLastDiff(diff, diffOptions); + if (diff.complete) { + result.data = diff.result; + } + }); + } + else { + this.lastWrite = void 0; + } + } + }; + QueryInfo.prototype.markReady = function () { + this.networkError = null; + return (this.networkStatus = NetworkStatus.ready); + }; + QueryInfo.prototype.markError = function (error) { + this.networkStatus = NetworkStatus.error; + this.lastWrite = void 0; + this.reset(); + if (error.graphQLErrors) { + this.graphQLErrors = error.graphQLErrors; + } + if (error.networkError) { + this.networkError = error.networkError; + } + return error; + }; + return QueryInfo; +}()); +export { QueryInfo }; +export function shouldWriteResult(result, errorPolicy) { + if (errorPolicy === void 0) { errorPolicy = "none"; } + var ignoreErrors = errorPolicy === "ignore" || errorPolicy === "all"; + var writeWithErrors = !graphQLResultHasError(result); + if (!writeWithErrors && ignoreErrors && result.data) { + writeWithErrors = true; + } + return writeWithErrors; +} +//# sourceMappingURL=QueryInfo.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js.map b/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js.map new file mode 100644 index 0000000..572f36b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/QueryInfo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"QueryInfo.js","sourceRoot":"","sources":["../../src/core/QueryInfo.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAe7E,IAAM,uBAAuB,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,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AAG,KAAK,CAAC,aAAa,CAAC;QAC3C,CAAC;QAED,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QACzC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IACH,gBAAC;AAAD,CAAC,AAvcD,IAucC;;AAED,MAAM,UAAU,iBAAiB,CAC/B,MAAsB,EACtB,WAAiC;IAAjC,4BAAA,EAAA,oBAAiC;IAEjC,IAAM,YAAY,GAAG,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,KAAK,CAAC;IACvE,IAAI,eAAe,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,CAAC,eAAe,IAAI,YAAY,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACpD,eAAe,GAAG,IAAI,CAAC;IACzB,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { DocumentNode, GraphQLError } from \"graphql\";\nimport { equal } from \"@wry/equality\";\n\nimport type { Cache, ApolloCache } from \"../cache/index.js\";\nimport { DeepMerger } from \"../utilities/index.js\";\nimport { mergeIncrementalData } from \"../utilities/index.js\";\nimport type { WatchQueryOptions, ErrorPolicy } from \"./watchQueryOptions.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\nimport { reobserveCacheFirst } from \"./ObservableQuery.js\";\nimport type { QueryListener } from \"./types.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\nimport {\n isNonEmptyArray,\n graphQLResultHasError,\n canUseWeakMap,\n} from \"../utilities/index.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport type { ApolloError } from \"../errors/index.js\";\nimport type { QueryManager } from \"./QueryManager.js\";\n\nexport type QueryStoreValue = Pick<\n QueryInfo,\n \"variables\" | \"networkStatus\" | \"networkError\" | \"graphQLErrors\"\n>;\n\nexport const enum CacheWriteBehavior {\n FORBID,\n OVERWRITE,\n MERGE,\n}\n\nconst destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)<\n ApolloCache,\n number\n>();\n\nfunction wrapDestructiveCacheMethod(\n cache: ApolloCache,\n methodName: \"evict\" | \"modify\" | \"reset\"\n) {\n const original = cache[methodName];\n if (typeof original === \"function\") {\n // @ts-expect-error this is just too generic to be typed correctly\n cache[methodName] = function () {\n destructiveMethodCounts.set(\n cache,\n // The %1e15 allows the count to wrap around to 0 safely every\n // quadrillion evictions, so there's no risk of overflow. To be\n // clear, this is more of a pedantic principle than something\n // that matters in any conceivable practical scenario.\n (destructiveMethodCounts.get(cache)! + 1) % 1e15\n );\n // @ts-expect-error this is just too generic to be typed correctly\n return original.apply(this, arguments);\n };\n }\n}\n\nfunction cancelNotifyTimeout(info: QueryInfo) {\n if (info[\"notifyTimeout\"]) {\n clearTimeout(info[\"notifyTimeout\"]);\n info[\"notifyTimeout\"] = void 0;\n }\n}\n\n// A QueryInfo object represents a single query managed by the\n// QueryManager, which tracks all QueryInfo objects by queryId in its\n// this.queries Map. QueryInfo objects store the latest results and errors\n// for the given query, and are responsible for reporting those results to\n// the corresponding ObservableQuery, via the QueryInfo.notify method.\n// Results are reported asynchronously whenever setDiff marks the\n// QueryInfo object as dirty, though a call to the QueryManager's\n// broadcastQueries method may trigger the notification before it happens\n// automatically. This class used to be a simple interface type without\n// any field privacy or meaningful methods, which is why it still has so\n// many public fields. The effort to lock down and simplify the QueryInfo\n// interface is ongoing, and further improvements are welcome.\nexport class QueryInfo {\n listeners = new Set();\n document: DocumentNode | null = null;\n lastRequestId = 1;\n variables?: Record;\n networkStatus?: NetworkStatus;\n networkError?: Error | null;\n graphQLErrors?: ReadonlyArray;\n stopped = false;\n\n private cache: ApolloCache;\n\n constructor(\n queryManager: QueryManager,\n public readonly queryId = queryManager.generateQueryId()\n ) {\n const cache = (this.cache = queryManager.cache);\n\n // Track how often cache.evict is called, since we want eviction to\n // override the feud-stopping logic in the markResult method, by\n // causing shouldWrite to return true. Wrapping the cache.evict method\n // is a bit of a hack, but it saves us from having to make eviction\n // counting an official part of the ApolloCache API.\n if (!destructiveMethodCounts.has(cache)) {\n destructiveMethodCounts.set(cache, 0);\n wrapDestructiveCacheMethod(cache, \"evict\");\n wrapDestructiveCacheMethod(cache, \"modify\");\n wrapDestructiveCacheMethod(cache, \"reset\");\n }\n }\n\n public init(query: {\n document: DocumentNode;\n variables: Record | undefined;\n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus?: NetworkStatus;\n observableQuery?: ObservableQuery;\n lastRequestId?: number;\n }): this {\n let networkStatus = query.networkStatus || NetworkStatus.loading;\n if (\n this.variables &&\n this.networkStatus !== NetworkStatus.loading &&\n !equal(this.variables, query.variables)\n ) {\n networkStatus = NetworkStatus.setVariables;\n }\n\n if (!equal(query.variables, this.variables)) {\n this.lastDiff = void 0;\n }\n\n Object.assign(this, {\n document: query.document,\n variables: query.variables,\n networkError: null,\n graphQLErrors: this.graphQLErrors || [],\n networkStatus,\n });\n\n if (query.observableQuery) {\n this.setObservableQuery(query.observableQuery);\n }\n\n if (query.lastRequestId) {\n this.lastRequestId = query.lastRequestId;\n }\n\n return this;\n }\n\n private dirty: boolean = false;\n\n private notifyTimeout?: ReturnType;\n\n reset() {\n cancelNotifyTimeout(this);\n this.dirty = false;\n }\n\n resetDiff() {\n this.lastDiff = void 0;\n }\n\n getDiff(): Cache.DiffResult {\n const options = this.getDiffOptions();\n\n if (this.lastDiff && equal(options, this.lastDiff.options)) {\n return this.lastDiff.diff;\n }\n\n this.updateWatch(this.variables);\n\n const oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return { complete: false };\n }\n\n const diff = this.cache.diff(options);\n this.updateLastDiff(diff, options);\n return diff;\n }\n\n private lastDiff?: {\n diff: Cache.DiffResult;\n options: Cache.DiffOptions;\n };\n\n private updateLastDiff(\n diff: Cache.DiffResult | null,\n options?: Cache.DiffOptions\n ) {\n this.lastDiff =\n diff ?\n {\n diff,\n options: options || this.getDiffOptions(),\n }\n : void 0;\n }\n\n private getDiffOptions(variables = this.variables): Cache.DiffOptions {\n return {\n query: this.document!,\n variables,\n returnPartialData: true,\n optimistic: true,\n canonizeResults: this.observableQuery?.options.canonizeResults,\n };\n }\n\n setDiff(diff: Cache.DiffResult | null) {\n const oldDiff = this.lastDiff && this.lastDiff.diff;\n\n // If we do not tolerate partial results, skip this update to prevent it\n // from being reported. This prevents a situtuation where a query that\n // errors and another succeeds with overlapping data does not report the\n // partial data result to the errored query.\n //\n // See https://github.com/apollographql/apollo-client/issues/11400 for more\n // information on this issue.\n if (\n diff &&\n !diff.complete &&\n !this.observableQuery?.options.returnPartialData &&\n // In the case of a cache eviction, the diff will become partial so we\n // schedule a notification to send a network request (this.oqListener) to\n // go and fetch the missing data.\n !(oldDiff && oldDiff.complete)\n ) {\n return;\n }\n\n this.updateLastDiff(diff);\n\n if (!this.dirty && !equal(oldDiff && oldDiff.result, diff && diff.result)) {\n this.dirty = true;\n if (!this.notifyTimeout) {\n this.notifyTimeout = setTimeout(() => this.notify(), 0);\n }\n }\n }\n\n public readonly observableQuery: ObservableQuery | null = null;\n private oqListener?: QueryListener;\n\n setObservableQuery(oq: ObservableQuery | null) {\n if (oq === this.observableQuery) return;\n\n if (this.oqListener) {\n this.listeners.delete(this.oqListener);\n }\n\n (this as any).observableQuery = oq;\n\n if (oq) {\n oq[\"queryInfo\"] = this;\n this.listeners.add(\n (this.oqListener = () => {\n const diff = this.getDiff();\n if (diff.fromOptimisticTransaction) {\n // If this diff came from an optimistic transaction, deliver the\n // current cache data to the ObservableQuery, but don't perform a\n // reobservation, since oq.reobserveCacheFirst might make a network\n // request, and we never want to trigger network requests in the\n // middle of optimistic updates.\n oq[\"observe\"]();\n } else {\n // Otherwise, make the ObservableQuery \"reobserve\" the latest data\n // using a temporary fetch policy of \"cache-first\", so complete cache\n // results have a chance to be delivered without triggering additional\n // network requests, even when options.fetchPolicy is \"network-only\"\n // or \"cache-and-network\". All other fetch policies are preserved by\n // this method, and are handled by calling oq.reobserve(). If this\n // reobservation is spurious, isDifferentFromLastResult still has a\n // chance to catch it before delivery to ObservableQuery subscribers.\n reobserveCacheFirst(oq);\n }\n })\n );\n } else {\n delete this.oqListener;\n }\n }\n\n notify() {\n cancelNotifyTimeout(this);\n\n if (this.shouldNotify()) {\n this.listeners.forEach((listener) => listener(this));\n }\n\n this.dirty = false;\n }\n\n private shouldNotify() {\n if (!this.dirty || !this.listeners.size) {\n return false;\n }\n\n if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) {\n const { fetchPolicy } = this.observableQuery.options;\n if (fetchPolicy !== \"cache-only\" && fetchPolicy !== \"cache-and-network\") {\n return false;\n }\n }\n\n return true;\n }\n\n public stop() {\n if (!this.stopped) {\n this.stopped = true;\n\n // Cancel the pending notify timeout\n this.reset();\n\n this.cancel();\n // Revert back to the no-op version of cancel inherited from\n // QueryInfo.prototype.\n this.cancel = QueryInfo.prototype.cancel;\n\n const oq = this.observableQuery;\n if (oq) oq.stopPolling();\n }\n }\n\n // This method is a no-op by default, until/unless overridden by the\n // updateWatch method.\n private cancel() {}\n\n private lastWatch?: Cache.WatchOptions;\n\n private updateWatch(variables = this.variables) {\n const oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return;\n }\n\n const watchOptions: Cache.WatchOptions = {\n // Although this.getDiffOptions returns Cache.DiffOptions instead of\n // Cache.WatchOptions, all the overlapping options should be the same, so\n // we can reuse getDiffOptions here, for consistency.\n ...this.getDiffOptions(variables),\n watcher: this,\n callback: (diff) => this.setDiff(diff),\n };\n\n if (!this.lastWatch || !equal(watchOptions, this.lastWatch)) {\n this.cancel();\n this.cancel = this.cache.watch((this.lastWatch = watchOptions));\n }\n }\n\n private lastWrite?: {\n result: FetchResult;\n variables: WatchQueryOptions[\"variables\"];\n dmCount: number | undefined;\n };\n\n public resetLastWrite() {\n this.lastWrite = void 0;\n }\n\n private shouldWrite(\n result: FetchResult,\n variables: WatchQueryOptions[\"variables\"]\n ) {\n const { lastWrite } = this;\n return !(\n lastWrite &&\n // If cache.evict has been called since the last time we wrote this\n // data into the cache, there's a chance writing this result into\n // the cache will repair what was evicted.\n lastWrite.dmCount === destructiveMethodCounts.get(this.cache) &&\n equal(variables, lastWrite.variables) &&\n equal(result.data, lastWrite.result.data)\n );\n }\n\n public markResult(\n result: FetchResult,\n document: DocumentNode,\n options: Pick<\n WatchQueryOptions,\n \"variables\" | \"fetchPolicy\" | \"errorPolicy\"\n >,\n cacheWriteBehavior: CacheWriteBehavior\n ) {\n const merger = new DeepMerger();\n const graphQLErrors =\n isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];\n\n // Cancel the pending notify timeout (if it exists) to prevent extraneous network\n // requests. To allow future notify timeouts, diff and dirty are reset as well.\n this.reset();\n\n if (\"incremental\" in result && isNonEmptyArray(result.incremental)) {\n const mergedData = mergeIncrementalData(this.getDiff().result, result);\n result.data = mergedData;\n\n // Detect the first chunk of a deferred query and merge it with existing\n // cache data. This ensures a `cache-first` fetch policy that returns\n // partial cache data or a `cache-and-network` fetch policy that already\n // has full data in the cache does not complain when trying to merge the\n // initial deferred server data with existing cache data.\n } else if (\"hasNext\" in result && result.hasNext) {\n const diff = this.getDiff();\n result.data = merger.merge(diff.result, result.data);\n }\n\n this.graphQLErrors = graphQLErrors;\n\n if (options.fetchPolicy === \"no-cache\") {\n this.updateLastDiff(\n { result: result.data, complete: true },\n this.getDiffOptions(options.variables)\n );\n } else if (cacheWriteBehavior !== CacheWriteBehavior.FORBID) {\n if (shouldWriteResult(result, options.errorPolicy)) {\n // Using a transaction here so we have a chance to read the result\n // back from the cache before the watch callback fires as a result\n // of writeQuery, so we can store the new diff quietly and ignore\n // it when we receive it redundantly from the watch callback.\n this.cache.performTransaction((cache) => {\n if (this.shouldWrite(result, options.variables)) {\n cache.writeQuery({\n query: document,\n data: result.data as T,\n variables: options.variables,\n overwrite: cacheWriteBehavior === CacheWriteBehavior.OVERWRITE,\n });\n\n this.lastWrite = {\n result,\n variables: options.variables,\n dmCount: destructiveMethodCounts.get(this.cache),\n };\n } else {\n // If result is the same as the last result we received from\n // the network (and the variables match too), avoid writing\n // result into the cache again. The wisdom of skipping this\n // cache write is far from obvious, since any cache write\n // could be the one that puts the cache back into a desired\n // state, fixing corruption or missing data. However, if we\n // always write every network result into the cache, we enable\n // feuds between queries competing to update the same data in\n // incompatible ways, which can lead to an endless cycle of\n // cache broadcasts and useless network requests. As with any\n // feud, eventually one side must step back from the brink,\n // letting the other side(s) have the last word(s). There may\n // be other points where we could break this cycle, such as\n // silencing the broadcast for cache.writeQuery (not a good\n // idea, since it just delays the feud a bit) or somehow\n // avoiding the network request that just happened (also bad,\n // because the server could return useful new data). All\n // options considered, skipping this cache write seems to be\n // the least damaging place to break the cycle, because it\n // reflects the intuition that we recently wrote this exact\n // result into the cache, so the cache *should* already/still\n // contain this data. If some other query has clobbered that\n // data in the meantime, that's too bad, but there will be no\n // winners if every query blindly reverts to its own version\n // of the data. This approach also gives the network a chance\n // to return new data, which will be written into the cache as\n // usual, notifying only those queries that are directly\n // affected by the cache updates, as usual. In the future, an\n // even more sophisticated cache could perhaps prevent or\n // mitigate the clobbering somehow, but that would make this\n // particular cache write even less important, and thus\n // skipping it would be even safer than it is today.\n if (this.lastDiff && this.lastDiff.diff.complete) {\n // Reuse data from the last good (complete) diff that we\n // received, when possible.\n result.data = this.lastDiff.diff.result;\n return;\n }\n // If the previous this.diff was incomplete, fall through to\n // re-reading the latest data with cache.diff, below.\n }\n\n const diffOptions = this.getDiffOptions(options.variables);\n const diff = cache.diff(diffOptions);\n\n // In case the QueryManager stops this QueryInfo before its\n // results are delivered, it's important to avoid restarting the\n // cache watch when markResult is called. We also avoid updating\n // the watch if we are writing a result that doesn't match the current\n // variables to avoid race conditions from broadcasting the wrong\n // result.\n if (!this.stopped && equal(this.variables, options.variables)) {\n // Any time we're about to update this.diff, we need to make\n // sure we've started watching the cache.\n this.updateWatch(options.variables);\n }\n\n // If we're allowed to write to the cache, and we can read a\n // complete result from the cache, update result.data to be the\n // result from the cache, rather than the raw network result.\n // Set without setDiff to avoid triggering a notify call, since\n // we have other ways of notifying for this result.\n this.updateLastDiff(diff, diffOptions);\n if (diff.complete) {\n result.data = diff.result;\n }\n });\n } else {\n this.lastWrite = void 0;\n }\n }\n }\n\n public markReady() {\n this.networkError = null;\n return (this.networkStatus = NetworkStatus.ready);\n }\n\n public markError(error: ApolloError) {\n this.networkStatus = NetworkStatus.error;\n this.lastWrite = void 0;\n\n this.reset();\n\n if (error.graphQLErrors) {\n this.graphQLErrors = error.graphQLErrors;\n }\n\n if (error.networkError) {\n this.networkError = error.networkError;\n }\n\n return error;\n }\n}\n\nexport function shouldWriteResult(\n result: FetchResult,\n errorPolicy: ErrorPolicy = \"none\"\n) {\n const ignoreErrors = errorPolicy === \"ignore\" || errorPolicy === \"all\";\n let writeWithErrors = !graphQLResultHasError(result);\n if (!writeWithErrors && ignoreErrors && result.data) {\n writeWithErrors = true;\n }\n return writeWithErrors;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/QueryManager.d.ts b/graphql-subscription/node_modules/@apollo/client/core/QueryManager.d.ts new file mode 100644 index 0000000..67b13ef --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/QueryManager.d.ts @@ -0,0 +1,132 @@ +import type { DocumentNode } from "graphql"; +import type { ApolloLink, FetchResult } from "../link/core/index.js"; +import type { Cache, ApolloCache } from "../cache/index.js"; +import { Observable, DocumentTransform } from "../utilities/index.js"; +import type { QueryOptions, WatchQueryOptions, SubscriptionOptions, MutationOptions, ErrorPolicy, MutationFetchPolicy } from "./watchQueryOptions.js"; +import { ObservableQuery } from "./ObservableQuery.js"; +import { NetworkStatus } from "./networkStatus.js"; +import type { ApolloQueryResult, OperationVariables, MutationUpdaterFunction, OnQueryUpdated, InternalRefetchQueriesInclude, InternalRefetchQueriesOptions, InternalRefetchQueriesMap, DefaultContext } from "./types.js"; +import { LocalState } from "./LocalState.js"; +import type { QueryStoreValue } from "./QueryInfo.js"; +interface MutationStoreValue { + mutation: DocumentNode; + variables: Record; + loading: boolean; + error: Error | null; +} +type UpdateQueries = MutationOptions["updateQueries"]; +interface TransformCacheEntry { + hasClientExports: boolean; + hasForcedResolvers: boolean; + hasNonreactiveDirective: boolean; + clientQuery: DocumentNode | null; + serverQuery: DocumentNode | null; + defaultVars: OperationVariables; + asQuery: DocumentNode; +} +import type { DefaultOptions } from "./ApolloClient.js"; +import { Trie } from "@wry/trie"; +export declare class QueryManager { + cache: ApolloCache; + link: ApolloLink; + defaultOptions: DefaultOptions; + readonly assumeImmutableResults: boolean; + readonly documentTransform: DocumentTransform; + readonly ssrMode: boolean; + readonly defaultContext: Partial; + private queryDeduplication; + private clientAwareness; + private localState; + private onBroadcast?; + mutationStore?: { + [mutationId: string]: MutationStoreValue; + }; + private queries; + protected fetchCancelFns: Map any>; + constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, defaultContext, }: { + cache: ApolloCache; + link: ApolloLink; + defaultOptions?: DefaultOptions; + documentTransform?: DocumentTransform; + queryDeduplication?: boolean; + onBroadcast?: () => void; + ssrMode?: boolean; + clientAwareness?: Record; + localState?: LocalState; + assumeImmutableResults?: boolean; + defaultContext?: Partial; + }); + /** + * Call this method to terminate any active query processes, making it safe + * to dispose of this QueryManager instance. + */ + stop(): void; + private cancelPendingFetches; + mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + markMutationResult>(mutation: { + mutationId: string; + result: FetchResult; + document: DocumentNode; + variables?: TVariables; + fetchPolicy?: MutationFetchPolicy; + errorPolicy: ErrorPolicy; + context?: TContext; + updateQueries: UpdateQueries; + update?: MutationUpdaterFunction; + awaitRefetchQueries?: boolean; + refetchQueries?: InternalRefetchQueriesInclude; + removeOptimistic?: string; + onQueryUpdated?: OnQueryUpdated; + keepRootFields?: boolean; + }, cache?: ApolloCache): Promise>; + markMutationOptimistic>(optimisticResponse: any, mutation: { + mutationId: string; + document: DocumentNode; + variables?: TVariables; + fetchPolicy?: MutationFetchPolicy; + errorPolicy: ErrorPolicy; + context?: TContext; + updateQueries: UpdateQueries; + update?: MutationUpdaterFunction; + keepRootFields?: boolean; + }): boolean; + fetchQuery(queryId: string, options: WatchQueryOptions, networkStatus?: NetworkStatus): Promise>; + getQueryStore(): Record; + resetErrors(queryId: string): void; + transform(document: DocumentNode): DocumentNode; + private transformCache; + getDocumentInfo(document: DocumentNode): TransformCacheEntry; + private getVariables; + watchQuery(options: WatchQueryOptions): ObservableQuery; + query(options: QueryOptions, queryId?: string): Promise>; + private queryIdCounter; + generateQueryId(): string; + private requestIdCounter; + generateRequestId(): number; + private mutationIdCounter; + generateMutationId(): string; + stopQueryInStore(queryId: string): void; + private stopQueryInStoreNoBroadcast; + clearStore(options?: Cache.ResetOptions): Promise; + getObservableQueries(include?: InternalRefetchQueriesInclude): Map>; + reFetchObservableQueries(includeStandby?: boolean): Promise[]>; + setObservableQuery(observableQuery: ObservableQuery): void; + startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, }: SubscriptionOptions): Observable>; + stopQuery(queryId: string): void; + private stopQueryNoBroadcast; + removeQuery(queryId: string): void; + broadcastQueries(): void; + getLocalState(): LocalState; + protected inFlightLinkObservables: Trie<{ + observable?: Observable> | undefined; + }>; + private getObservableFromLink; + private getResultsFromLink; + private fetchConcastWithInfo; + refetchQueries({ updateCache, include, optimistic, removeOptimistic, onQueryUpdated, }: InternalRefetchQueriesOptions, TResult>): InternalRefetchQueriesMap; + private fetchQueryByPolicy; + private getQuery; + private prepareContext; +} +export {}; +//# sourceMappingURL=QueryManager.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/QueryManager.js b/graphql-subscription/node_modules/@apollo/client/core/QueryManager.js new file mode 100644 index 0000000..415c017 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/QueryManager.js @@ -0,0 +1,1123 @@ +import { __assign, __awaiter, __generator } from "tslib"; +import { invariant, newInvariantError } from "../utilities/globals/index.js"; +import { equal } from "@wry/equality"; +import { execute } from "../link/core/index.js"; +import { hasDirectives, isExecutionPatchIncrementalResult, isExecutionPatchResult, removeDirectivesFromDocument, } from "../utilities/index.js"; +import { canonicalStringify } from "../cache/index.js"; +import { getDefaultValues, getOperationDefinition, getOperationName, hasClientExports, graphQLResultHasError, getGraphQLErrorsFromResult, Observable, asyncMap, isNonEmptyArray, Concast, makeUniqueId, isDocumentNode, isNonNullObject, DocumentTransform, } from "../utilities/index.js"; +import { mergeIncrementalData } from "../utilities/common/incrementalResult.js"; +import { ApolloError, isApolloError, graphQLResultHasProtocolErrors, } from "../errors/index.js"; +import { ObservableQuery, logMissingFieldErrors } from "./ObservableQuery.js"; +import { NetworkStatus, isNetworkRequestInFlight } from "./networkStatus.js"; +import { LocalState } from "./LocalState.js"; +import { QueryInfo, shouldWriteResult, } from "./QueryInfo.js"; +import { PROTOCOL_ERRORS_SYMBOL } from "../errors/index.js"; +import { print } from "../utilities/index.js"; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var IGNORE = Object.create(null); +import { Trie } from "@wry/trie"; +import { AutoCleanedWeakCache, cacheSizes } from "../utilities/index.js"; +var QueryManager = /** @class */ (function () { + function QueryManager(_a) { + var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext; + var _this = this; + this.clientAwareness = {}; + // All the queries that the QueryManager is currently managing (not + // including mutations and subscriptions). + this.queries = new Map(); + // Maps from queryId strings to Promise rejection functions for + // currently active queries and fetches. + // Use protected instead of private field so + // @apollo/experimental-nextjs-app-support can access type info. + this.fetchCancelFns = new Map(); + this.transformCache = new AutoCleanedWeakCache(cacheSizes["queryManager.getDocumentInfo"] || + 2000 /* defaultCacheSizes["queryManager.getDocumentInfo"] */); + this.queryIdCounter = 1; + this.requestIdCounter = 1; + this.mutationIdCounter = 1; + // Use protected instead of private field so + // @apollo/experimental-nextjs-app-support can access type info. + this.inFlightLinkObservables = new Trie(false); + var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, + // Allow the apollo cache to manage its own transform caches + { cache: false }); + this.cache = cache; + this.link = link; + this.defaultOptions = defaultOptions || Object.create(null); + this.queryDeduplication = queryDeduplication; + this.clientAwareness = clientAwareness; + this.localState = localState || new LocalState({ cache: cache }); + this.ssrMode = ssrMode; + this.assumeImmutableResults = assumeImmutableResults; + this.documentTransform = + documentTransform ? + defaultDocumentTransform + .concat(documentTransform) + // The custom document transform may add new fragment spreads or new + // field selections, so we want to give the cache a chance to run + // again. For example, the InMemoryCache adds __typename to field + // selections and fragments from the fragment registry. + .concat(defaultDocumentTransform) + : defaultDocumentTransform; + this.defaultContext = defaultContext || Object.create(null); + if ((this.onBroadcast = onBroadcast)) { + this.mutationStore = Object.create(null); + } + } + /** + * Call this method to terminate any active query processes, making it safe + * to dispose of this QueryManager instance. + */ + QueryManager.prototype.stop = function () { + var _this = this; + this.queries.forEach(function (_info, queryId) { + _this.stopQueryNoBroadcast(queryId); + }); + this.cancelPendingFetches(newInvariantError(25)); + }; + QueryManager.prototype.cancelPendingFetches = function (error) { + this.fetchCancelFns.forEach(function (cancel) { return cancel(error); }); + this.fetchCancelFns.clear(); + }; + QueryManager.prototype.mutate = function (_a) { + var _b, _c; + var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || "network-only" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || "none" : _g, keepRootFields = _a.keepRootFields, context = _a.context; + return __awaiter(this, void 0, void 0, function () { + var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self; + return __generator(this, function (_h) { + switch (_h.label) { + case 0: + invariant(mutation, 26); + invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27); + mutationId = this.generateMutationId(); + mutation = this.cache.transformForLink(this.transform(mutation)); + hasClientExports = this.getDocumentInfo(mutation).hasClientExports; + variables = this.getVariables(mutation, variables); + if (!hasClientExports) return [3 /*break*/, 2]; + return [4 /*yield*/, this.localState.addExportedVariables(mutation, variables, context)]; + case 1: + variables = (_h.sent()); + _h.label = 2; + case 2: + mutationStoreValue = this.mutationStore && + (this.mutationStore[mutationId] = { + mutation: mutation, + variables: variables, + loading: true, + error: null, + }); + isOptimistic = optimisticResponse && + this.markMutationOptimistic(optimisticResponse, { + mutationId: mutationId, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + updateQueries: updateQueries, + update: updateWithProxyFn, + keepRootFields: keepRootFields, + }); + this.broadcastQueries(); + self = this; + return [2 /*return*/, new Promise(function (resolve, reject) { + return asyncMap(self.getObservableFromLink(mutation, __assign(__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) { + if (graphQLResultHasError(result) && errorPolicy === "none") { + throw new ApolloError({ + graphQLErrors: getGraphQLErrorsFromResult(result), + }); + } + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = null; + } + var storeResult = __assign({}, result); + if (typeof refetchQueries === "function") { + refetchQueries = refetchQueries(storeResult); + } + if (errorPolicy === "ignore" && graphQLResultHasError(storeResult)) { + delete storeResult.errors; + } + return self.markMutationResult({ + mutationId: mutationId, + result: storeResult, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + update: updateWithProxyFn, + updateQueries: updateQueries, + awaitRefetchQueries: awaitRefetchQueries, + refetchQueries: refetchQueries, + removeOptimistic: isOptimistic ? mutationId : void 0, + onQueryUpdated: onQueryUpdated, + keepRootFields: keepRootFields, + }); + }).subscribe({ + next: function (storeResult) { + self.broadcastQueries(); + // Since mutations might receive multiple payloads from the + // ApolloLink chain (e.g. when used with @defer), + // we resolve with a SingleExecutionResult or after the final + // ExecutionPatchResult has arrived and we have assembled the + // multipart response into a single result. + if (!("hasNext" in storeResult) || storeResult.hasNext === false) { + resolve(storeResult); + } + }, + error: function (err) { + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = err; + } + if (isOptimistic) { + self.cache.removeOptimistic(mutationId); + } + self.broadcastQueries(); + reject(err instanceof ApolloError ? err : (new ApolloError({ + networkError: err, + }))); + }, + }); + })]; + } + }); + }); + }; + QueryManager.prototype.markMutationResult = function (mutation, cache) { + var _this = this; + if (cache === void 0) { cache = this.cache; } + var result = mutation.result; + var cacheWrites = []; + var skipCache = mutation.fetchPolicy === "no-cache"; + if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) { + if (!isExecutionPatchIncrementalResult(result)) { + cacheWrites.push({ + result: result.data, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + // The cache complains if passed a mutation where it expects a + // query, so we transform mutations and subscriptions to queries + // (only once, thanks to this.transformCache). + query: this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + var mergedData = void 0; + if (diff.result) { + mergedData = mergeIncrementalData(diff.result, result); + } + if (typeof mergedData !== "undefined") { + // cast the ExecutionPatchResult to FetchResult here since + // ExecutionPatchResult never has `data` when returned from the server + result.data = mergedData; + cacheWrites.push({ + result: mergedData, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + } + var updateQueries_1 = mutation.updateQueries; + if (updateQueries_1) { + this.queries.forEach(function (_a, queryId) { + var observableQuery = _a.observableQuery; + var queryName = observableQuery && observableQuery.queryName; + if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) { + return; + } + var updater = updateQueries_1[queryName]; + var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables; + // Read the current query result from the store. + var _c = cache.diff({ + query: document, + variables: variables, + returnPartialData: true, + optimistic: false, + }), currentQueryResult = _c.result, complete = _c.complete; + if (complete && currentQueryResult) { + // Run our reducer using the current query result and the mutation result. + var nextQueryResult = updater(currentQueryResult, { + mutationResult: result, + queryName: (document && getOperationName(document)) || void 0, + queryVariables: variables, + }); + // Write the modified result back into the store if we got a new result. + if (nextQueryResult) { + cacheWrites.push({ + result: nextQueryResult, + dataId: "ROOT_QUERY", + query: document, + variables: variables, + }); + } + } + }); + } + } + if (cacheWrites.length > 0 || + (mutation.refetchQueries || "").length > 0 || + mutation.update || + mutation.onQueryUpdated || + mutation.removeOptimistic) { + var results_1 = []; + this.refetchQueries({ + updateCache: function (cache) { + if (!skipCache) { + cacheWrites.forEach(function (write) { return cache.write(write); }); + } + // If the mutation has some writes associated with it then we need to + // apply those writes to the store by running this reducer again with + // a write action. + var update = mutation.update; + // Determine whether result is a SingleExecutionResult, + // or the final ExecutionPatchResult. + var isFinalResult = !isExecutionPatchResult(result) || + (isExecutionPatchIncrementalResult(result) && !result.hasNext); + if (update) { + if (!skipCache) { + // Re-read the ROOT_MUTATION data we just wrote into the cache + // (the first cache.write call in the cacheWrites.forEach loop + // above), so field read functions have a chance to run for + // fields within mutation result objects. + var diff = cache.diff({ + id: "ROOT_MUTATION", + // The cache complains if passed a mutation where it expects a + // query, so we transform mutations and subscriptions to queries + // (only once, thanks to this.transformCache). + query: _this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + if (diff.complete) { + result = __assign(__assign({}, result), { data: diff.result }); + if ("incremental" in result) { + delete result.incremental; + } + if ("hasNext" in result) { + delete result.hasNext; + } + } + } + // If we've received the whole response, + // either a SingleExecutionResult or the final ExecutionPatchResult, + // call the update function. + if (isFinalResult) { + update(cache, result, { + context: mutation.context, + variables: mutation.variables, + }); + } + } + // TODO Do this with cache.evict({ id: 'ROOT_MUTATION' }) but make it + // shallow to allow rolling back optimistic evictions. + if (!skipCache && !mutation.keepRootFields && isFinalResult) { + cache.modify({ + id: "ROOT_MUTATION", + fields: function (value, _a) { + var fieldName = _a.fieldName, DELETE = _a.DELETE; + return fieldName === "__typename" ? value : DELETE; + }, + }); + } + }, + include: mutation.refetchQueries, + // Write the final mutation.result to the root layer of the cache. + optimistic: false, + // Remove the corresponding optimistic layer at the same time as we + // write the final non-optimistic result. + removeOptimistic: mutation.removeOptimistic, + // Let the caller of client.mutate optionally determine the refetching + // behavior for watched queries after the mutation.update function runs. + // If no onQueryUpdated function was provided for this mutation, pass + // null instead of undefined to disable the default refetching behavior. + onQueryUpdated: mutation.onQueryUpdated || null, + }).forEach(function (result) { return results_1.push(result); }); + if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) { + // Returning a promise here makes the mutation await that promise, so we + // include results in that promise's work if awaitRefetchQueries or an + // onQueryUpdated function was specified. + return Promise.all(results_1).then(function () { return result; }); + } + } + return Promise.resolve(result); + }; + QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) { + var _this = this; + var data = typeof optimisticResponse === "function" ? + optimisticResponse(mutation.variables, { IGNORE: IGNORE }) + : optimisticResponse; + if (data === IGNORE) { + return false; + } + this.cache.recordOptimisticTransaction(function (cache) { + try { + _this.markMutationResult(__assign(__assign({}, mutation), { result: { data: data } }), cache); + } + catch (error) { + globalThis.__DEV__ !== false && invariant.error(error); + } + }, mutation.mutationId); + return true; + }; + QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) { + return this.fetchConcastWithInfo(queryId, options, networkStatus).concast + .promise; + }; + QueryManager.prototype.getQueryStore = function () { + var store = Object.create(null); + this.queries.forEach(function (info, queryId) { + store[queryId] = { + variables: info.variables, + networkStatus: info.networkStatus, + networkError: info.networkError, + graphQLErrors: info.graphQLErrors, + }; + }); + return store; + }; + QueryManager.prototype.resetErrors = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) { + queryInfo.networkError = undefined; + queryInfo.graphQLErrors = []; + } + }; + QueryManager.prototype.transform = function (document) { + return this.documentTransform.transformDocument(document); + }; + QueryManager.prototype.getDocumentInfo = function (document) { + var transformCache = this.transformCache; + if (!transformCache.has(document)) { + var cacheEntry = { + // TODO These three calls (hasClientExports, shouldForceResolvers, and + // usesNonreactiveDirective) are performing independent full traversals + // of the transformed document. We should consider merging these + // traversals into a single pass in the future, though the work is + // cached after the first time. + hasClientExports: hasClientExports(document), + hasForcedResolvers: this.localState.shouldForceResolvers(document), + hasNonreactiveDirective: hasDirectives(["nonreactive"], document), + clientQuery: this.localState.clientQuery(document), + serverQuery: removeDirectivesFromDocument([ + { name: "client", remove: true }, + { name: "connection" }, + { name: "nonreactive" }, + ], document), + defaultVars: getDefaultValues(getOperationDefinition(document)), + // Transform any mutation or subscription operations to query operations + // so we can read/write them from/to the cache. + asQuery: __assign(__assign({}, document), { definitions: document.definitions.map(function (def) { + if (def.kind === "OperationDefinition" && + def.operation !== "query") { + return __assign(__assign({}, def), { operation: "query" }); + } + return def; + }) }), + }; + transformCache.set(document, cacheEntry); + } + return transformCache.get(document); + }; + QueryManager.prototype.getVariables = function (document, variables) { + return __assign(__assign({}, this.getDocumentInfo(document).defaultVars), variables); + }; + QueryManager.prototype.watchQuery = function (options) { + var query = this.transform(options.query); + // assign variable default values if supplied + // NOTE: We don't modify options.query here with the transformed query to + // ensure observable.options.query is set to the raw untransformed query. + options = __assign(__assign({}, options), { variables: this.getVariables(query, options.variables) }); + if (typeof options.notifyOnNetworkStatusChange === "undefined") { + options.notifyOnNetworkStatusChange = false; + } + var queryInfo = new QueryInfo(this); + var observable = new ObservableQuery({ + queryManager: this, + queryInfo: queryInfo, + options: options, + }); + observable["lastQuery"] = query; + this.queries.set(observable.queryId, queryInfo); + // We give queryInfo the transformed query to ensure the first cache diff + // uses the transformed query instead of the raw query + queryInfo.init({ + document: query, + observableQuery: observable, + variables: observable.variables, + }); + return observable; + }; + QueryManager.prototype.query = function (options, queryId) { + var _this = this; + if (queryId === void 0) { queryId = this.generateQueryId(); } + invariant(options.query, 28); + invariant(options.query.kind === "Document", 29); + invariant(!options.returnPartialData, 30); + invariant(!options.pollInterval, 31); + return this.fetchQuery(queryId, __assign(__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); }); + }; + QueryManager.prototype.generateQueryId = function () { + return String(this.queryIdCounter++); + }; + QueryManager.prototype.generateRequestId = function () { + return this.requestIdCounter++; + }; + QueryManager.prototype.generateMutationId = function () { + return String(this.mutationIdCounter++); + }; + QueryManager.prototype.stopQueryInStore = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) + queryInfo.stop(); + }; + QueryManager.prototype.clearStore = function (options) { + if (options === void 0) { options = { + discardWatches: true, + }; } + // Before we have sent the reset action to the store, we can no longer + // rely on the results returned by in-flight requests since these may + // depend on values that previously existed in the data portion of the + // store. So, we cancel the promises and observers that we have issued + // so far and not yet resolved (in the case of queries). + this.cancelPendingFetches(newInvariantError(32)); + this.queries.forEach(function (queryInfo) { + if (queryInfo.observableQuery) { + // Set loading to true so listeners don't trigger unless they want + // results with partial data. + queryInfo.networkStatus = NetworkStatus.loading; + } + else { + queryInfo.stop(); + } + }); + if (this.mutationStore) { + this.mutationStore = Object.create(null); + } + // begin removing data from the store + return this.cache.reset(options); + }; + QueryManager.prototype.getObservableQueries = function (include) { + var _this = this; + if (include === void 0) { include = "active"; } + var queries = new Map(); + var queryNamesAndDocs = new Map(); + var legacyQueryOptions = new Set(); + if (Array.isArray(include)) { + include.forEach(function (desc) { + if (typeof desc === "string") { + queryNamesAndDocs.set(desc, false); + } + else if (isDocumentNode(desc)) { + queryNamesAndDocs.set(_this.transform(desc), false); + } + else if (isNonNullObject(desc) && desc.query) { + legacyQueryOptions.add(desc); + } + }); + } + this.queries.forEach(function (_a, queryId) { + var oq = _a.observableQuery, document = _a.document; + if (oq) { + if (include === "all") { + queries.set(queryId, oq); + return; + } + var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy; + if (fetchPolicy === "standby" || + (include === "active" && !oq.hasObservers())) { + return; + } + if (include === "active" || + (queryName && queryNamesAndDocs.has(queryName)) || + (document && queryNamesAndDocs.has(document))) { + queries.set(queryId, oq); + if (queryName) + queryNamesAndDocs.set(queryName, true); + if (document) + queryNamesAndDocs.set(document, true); + } + } + }); + if (legacyQueryOptions.size) { + legacyQueryOptions.forEach(function (options) { + // We will be issuing a fresh network request for this query, so we + // pre-allocate a new query ID here, using a special prefix to enable + // cleaning up these temporary queries later, after fetching. + var queryId = makeUniqueId("legacyOneTimeQuery"); + var queryInfo = _this.getQuery(queryId).init({ + document: options.query, + variables: options.variables, + }); + var oq = new ObservableQuery({ + queryManager: _this, + queryInfo: queryInfo, + options: __assign(__assign({}, options), { fetchPolicy: "network-only" }), + }); + invariant(oq.queryId === queryId); + queryInfo.setObservableQuery(oq); + queries.set(queryId, oq); + }); + } + if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) { + queryNamesAndDocs.forEach(function (included, nameOrDoc) { + if (!included) { + globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc); + } + }); + } + return queries; + }; + QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { + var _this = this; + if (includeStandby === void 0) { includeStandby = false; } + var observableQueryPromises = []; + this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) { + var fetchPolicy = observableQuery.options.fetchPolicy; + observableQuery.resetLastResults(); + if (includeStandby || + (fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) { + observableQueryPromises.push(observableQuery.refetch()); + } + _this.getQuery(queryId).setDiff(null); + }); + this.broadcastQueries(); + return Promise.all(observableQueryPromises); + }; + QueryManager.prototype.setObservableQuery = function (observableQuery) { + this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); + }; + QueryManager.prototype.startGraphQLSubscription = function (_a) { + var _this = this; + var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c; + query = this.transform(query); + variables = this.getVariables(query, variables); + var makeObservable = function (variables) { + return _this.getObservableFromLink(query, context, variables).map(function (result) { + if (fetchPolicy !== "no-cache") { + // the subscription interface should handle not sending us results we no longer subscribe to. + // XXX I don't think we ever send in an object with errors, but we might in the future... + if (shouldWriteResult(result, errorPolicy)) { + _this.cache.write({ + query: query, + result: result.data, + dataId: "ROOT_SUBSCRIPTION", + variables: variables, + }); + } + _this.broadcastQueries(); + } + var hasErrors = graphQLResultHasError(result); + var hasProtocolErrors = graphQLResultHasProtocolErrors(result); + if (hasErrors || hasProtocolErrors) { + var errors = {}; + if (hasErrors) { + errors.graphQLErrors = result.errors; + } + if (hasProtocolErrors) { + errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL]; + } + // `errorPolicy` is a mechanism for handling GraphQL errors, according + // to our documentation, so we throw protocol errors regardless of the + // set error policy. + if (errorPolicy === "none" || hasProtocolErrors) { + throw new ApolloError(errors); + } + } + if (errorPolicy === "ignore") { + delete result.errors; + } + return result; + }); + }; + if (this.getDocumentInfo(query).hasClientExports) { + var observablePromise_1 = this.localState + .addExportedVariables(query, variables, context) + .then(makeObservable); + return new Observable(function (observer) { + var sub = null; + observablePromise_1.then(function (observable) { return (sub = observable.subscribe(observer)); }, observer.error); + return function () { return sub && sub.unsubscribe(); }; + }); + } + return makeObservable(variables); + }; + QueryManager.prototype.stopQuery = function (queryId) { + this.stopQueryNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.removeQuery(queryId); + }; + QueryManager.prototype.removeQuery = function (queryId) { + // teardown all links + // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises + // that each add their reject functions to fetchCancelFns. + // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`. + // The same queryId could have two rejection fns for two promises + this.fetchCancelFns.delete(queryId); + if (this.queries.has(queryId)) { + this.getQuery(queryId).stop(); + this.queries.delete(queryId); + } + }; + QueryManager.prototype.broadcastQueries = function () { + if (this.onBroadcast) + this.onBroadcast(); + this.queries.forEach(function (info) { return info.notify(); }); + }; + QueryManager.prototype.getLocalState = function () { + return this.localState; + }; + QueryManager.prototype.getObservableFromLink = function (query, context, variables, + // Prefer context.queryDeduplication if specified. + deduplication) { + var _this = this; + var _a; + if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; } + var observable; + var _b = this.getDocumentInfo(query), serverQuery = _b.serverQuery, clientQuery = _b.clientQuery; + if (serverQuery) { + var _c = this, inFlightLinkObservables_1 = _c.inFlightLinkObservables, link = _c.link; + var operation = { + query: serverQuery, + variables: variables, + operationName: getOperationName(serverQuery) || void 0, + context: this.prepareContext(__assign(__assign({}, context), { forceFetch: !deduplication })), + }; + context = operation.context; + if (deduplication) { + var printedServerQuery_1 = print(serverQuery); + var varJson_1 = canonicalStringify(variables); + var entry = inFlightLinkObservables_1.lookup(printedServerQuery_1, varJson_1); + observable = entry.observable; + if (!observable) { + var concast = new Concast([ + execute(link, operation), + ]); + observable = entry.observable = concast; + concast.beforeNext(function () { + inFlightLinkObservables_1.remove(printedServerQuery_1, varJson_1); + }); + } + } + else { + observable = new Concast([ + execute(link, operation), + ]); + } + } + else { + observable = new Concast([Observable.of({ data: {} })]); + context = this.prepareContext(context); + } + if (clientQuery) { + observable = asyncMap(observable, function (result) { + return _this.localState.runResolvers({ + document: clientQuery, + remoteResult: result, + context: context, + variables: variables, + }); + }); + } + return observable; + }; + QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) { + var requestId = (queryInfo.lastRequestId = this.generateRequestId()); + // Performing transformForLink here gives this.cache a chance to fill in + // missing fragment definitions (for example) before sending this document + // through the link chain. + var linkDocument = this.cache.transformForLink(options.query); + return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) { + var graphQLErrors = getGraphQLErrorsFromResult(result); + var hasErrors = graphQLErrors.length > 0; + // If we interrupted this request by calling getResultsFromLink again + // with the same QueryInfo object, we ignore the old results. + if (requestId >= queryInfo.lastRequestId) { + if (hasErrors && options.errorPolicy === "none") { + // Throwing here effectively calls observer.error. + throw queryInfo.markError(new ApolloError({ + graphQLErrors: graphQLErrors, + })); + } + // Use linkDocument rather than queryInfo.document so the + // operation/fragments used to write the result are the same as the + // ones used to obtain it from the link. + queryInfo.markResult(result, linkDocument, options, cacheWriteBehavior); + queryInfo.markReady(); + } + var aqr = { + data: result.data, + loading: false, + networkStatus: NetworkStatus.ready, + }; + if (hasErrors && options.errorPolicy !== "ignore") { + aqr.errors = graphQLErrors; + aqr.networkStatus = NetworkStatus.error; + } + return aqr; + }, function (networkError) { + var error = isApolloError(networkError) ? networkError : (new ApolloError({ networkError: networkError })); + // Avoid storing errors from older interrupted queries. + if (requestId >= queryInfo.lastRequestId) { + queryInfo.markError(error); + } + throw error; + }); + }; + QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, + // The initial networkStatus for this fetch, most often + // NetworkStatus.loading, but also possibly fetchMore, poll, refetch, + // or setVariables. + networkStatus, query) { + var _this = this; + if (networkStatus === void 0) { networkStatus = NetworkStatus.loading; } + if (query === void 0) { query = options.query; } + var variables = this.getVariables(query, options.variables); + var queryInfo = this.getQuery(queryId); + var defaults = this.defaultOptions.watchQuery; + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e; + var normalized = Object.assign({}, options, { + query: query, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + returnPartialData: returnPartialData, + notifyOnNetworkStatusChange: notifyOnNetworkStatusChange, + context: context, + }); + var fromVariables = function (variables) { + // Since normalized is always a fresh copy of options, it's safe to + // modify its properties here, rather than creating yet another new + // WatchQueryOptions object. + normalized.variables = variables; + var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus); + if ( + // If we're in standby, postpone advancing options.fetchPolicy using + // applyNextFetchPolicy. + normalized.fetchPolicy !== "standby" && + // The "standby" policy currently returns [] from fetchQueryByPolicy, so + // this is another way to detect when nothing was done/fetched. + sourcesWithInfo.sources.length > 0 && + queryInfo.observableQuery) { + queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options); + } + return sourcesWithInfo; + }; + // This cancel function needs to be set before the concast is created, + // in case concast creation synchronously cancels the request. + var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); }; + this.fetchCancelFns.set(queryId, function (reason) { + cleanupCancelFn(); + // This delay ensures the concast variable has been initialized. + setTimeout(function () { return concast.cancel(reason); }); + }); + var concast, containsDataFromLink; + // If the query has @export(as: ...) directives, then we need to + // process those directives asynchronously. When there are no + // @export directives (the common case), we deliberately avoid + // wrapping the result of this.fetchQueryByPolicy in a Promise, + // since the timing of result delivery is (unfortunately) important + // for backwards compatibility. TODO This code could be simpler if + // we deprecated and removed LocalState. + if (this.getDocumentInfo(normalized.query).hasClientExports) { + concast = new Concast(this.localState + .addExportedVariables(normalized.query, normalized.variables, normalized.context) + .then(fromVariables) + .then(function (sourcesWithInfo) { return sourcesWithInfo.sources; })); + // there is just no way we can synchronously get the *right* value here, + // so we will assume `true`, which is the behaviour before the bug fix in + // #10597. This means that bug is not fixed in that case, and is probably + // un-fixable with reasonable effort for the edge case of @export as + // directives. + containsDataFromLink = true; + } + else { + var sourcesWithInfo = fromVariables(normalized.variables); + containsDataFromLink = sourcesWithInfo.fromLink; + concast = new Concast(sourcesWithInfo.sources); + } + concast.promise.then(cleanupCancelFn, cleanupCancelFn); + return { + concast: concast, + fromLink: containsDataFromLink, + }; + }; + QueryManager.prototype.refetchQueries = function (_a) { + var _this = this; + var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? makeUniqueId("refetchQueries") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated; + var includedQueriesById = new Map(); + if (include) { + this.getObservableQueries(include).forEach(function (oq, queryId) { + includedQueriesById.set(queryId, { + oq: oq, + lastDiff: _this.getQuery(queryId).getDiff(), + }); + }); + } + var results = new Map(); + if (updateCache) { + this.cache.batch({ + update: updateCache, + // Since you can perform any combination of cache reads and/or writes in + // the cache.batch update function, its optimistic option can be either + // a boolean or a string, representing three distinct modes of + // operation: + // + // * false: read/write only the root layer + // * true: read/write the topmost layer + // * string: read/write a fresh optimistic layer with that ID string + // + // When typeof optimistic === "string", a new optimistic layer will be + // temporarily created within cache.batch with that string as its ID. If + // we then pass that same string as the removeOptimistic option, we can + // make cache.batch immediately remove the optimistic layer after + // running the updateCache function, triggering only one broadcast. + // + // However, the refetchQueries method accepts only true or false for its + // optimistic option (not string). We interpret true to mean a temporary + // optimistic layer should be created, to allow efficiently rolling back + // the effect of the updateCache function, which involves passing a + // string instead of true as the optimistic option to cache.batch, when + // refetchQueries receives optimistic: true. + // + // In other words, we are deliberately not supporting the use case of + // writing to an *existing* optimistic layer (using the refetchQueries + // updateCache function), since that would potentially interfere with + // other optimistic updates in progress. Instead, you can read/write + // only the root layer by passing optimistic: false to refetchQueries, + // or you can read/write a brand new optimistic layer that will be + // automatically removed by passing optimistic: true. + optimistic: (optimistic && removeOptimistic) || false, + // The removeOptimistic option can also be provided by itself, even if + // optimistic === false, to remove some previously-added optimistic + // layer safely and efficiently, like we do in markMutationResult. + // + // If an explicit removeOptimistic string is provided with optimistic: + // true, the removeOptimistic string will determine the ID of the + // temporary optimistic layer, in case that ever matters. + removeOptimistic: removeOptimistic, + onWatchUpdated: function (watch, diff, lastDiff) { + var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery; + if (oq) { + if (onQueryUpdated) { + // Since we're about to handle this query now, remove it from + // includedQueriesById, in case it was added earlier because of + // options.include. + includedQueriesById.delete(oq.queryId); + var result = onQueryUpdated(oq, diff, lastDiff); + if (result === true) { + // The onQueryUpdated function requested the default refetching + // behavior by returning true. + result = oq.refetch(); + } + // Record the result in the results Map, as long as onQueryUpdated + // did not return false to skip/ignore this result. + if (result !== false) { + results.set(oq, result); + } + // Allow the default cache broadcast to happen, except when + // onQueryUpdated returns false. + return result; + } + if (onQueryUpdated !== null) { + // If we don't have an onQueryUpdated function, and onQueryUpdated + // was not disabled by passing null, make sure this query is + // "included" like any other options.include-specified query. + includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff }); + } + } + }, + }); + } + if (includedQueriesById.size) { + includedQueriesById.forEach(function (_a, queryId) { + var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff; + var result; + // If onQueryUpdated is provided, we want to use it for all included + // queries, even the QueryOptions ones. + if (onQueryUpdated) { + if (!diff) { + var info = oq["queryInfo"]; + info.reset(); // Force info.getDiff() to read from cache. + diff = info.getDiff(); + } + result = onQueryUpdated(oq, diff, lastDiff); + } + // Otherwise, we fall back to refetching. + if (!onQueryUpdated || result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + if (queryId.indexOf("legacyOneTimeQuery") >= 0) { + _this.stopQueryNoBroadcast(queryId); + } + }); + } + if (removeOptimistic) { + // In case no updateCache callback was provided (so cache.batch was not + // called above, and thus did not already remove the optimistic layer), + // remove it here. Since this is a no-op when the layer has already been + // removed, we do it even if we called cache.batch above, since it's + // possible this.cache is an instance of some ApolloCache subclass other + // than InMemoryCache, and does not fully support the removeOptimistic + // option for cache.batch. + this.cache.removeOptimistic(removeOptimistic); + } + return results; + }; + QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, + // The initial networkStatus for this fetch, most often + // NetworkStatus.loading, but also possibly fetchMore, poll, refetch, + // or setVariables. + networkStatus) { + var _this = this; + var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange; + var oldNetworkStatus = queryInfo.networkStatus; + queryInfo.init({ + document: query, + variables: variables, + networkStatus: networkStatus, + }); + var readCache = function () { return queryInfo.getDiff(); }; + var resultsFromCache = function (diff, networkStatus) { + if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || NetworkStatus.loading; } + var data = diff.result; + if (globalThis.__DEV__ !== false && !returnPartialData && !equal(data, {})) { + logMissingFieldErrors(diff.missing); + } + var fromData = function (data) { + return Observable.of(__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); + }; + if (data && _this.getDocumentInfo(query).hasForcedResolvers) { + return _this.localState + .runResolvers({ + document: query, + remoteResult: { data: data }, + context: context, + variables: variables, + onlyRunForcedResolvers: true, + }) + .then(function (resolved) { return fromData(resolved.data || void 0); }); + } + // Resolves https://github.com/apollographql/apollo-client/issues/10317. + // If errorPolicy is 'none' and notifyOnNetworkStatusChange is true, + // data was incorrectly returned from the cache on refetch: + // if diff.missing exists, we should not return cache data. + if (errorPolicy === "none" && + networkStatus === NetworkStatus.refetch && + Array.isArray(diff.missing)) { + return fromData(void 0); + } + return fromData(data); + }; + var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 /* CacheWriteBehavior.FORBID */ + // Watched queries must opt into overwriting existing data on refetch, + // by passing refetchWritePolicy: "overwrite" in their WatchQueryOptions. + : (networkStatus === NetworkStatus.refetch && + refetchWritePolicy !== "merge") ? + 1 /* CacheWriteBehavior.OVERWRITE */ + : 2 /* CacheWriteBehavior.MERGE */; + var resultsFromLink = function () { + return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, { + query: query, + variables: variables, + context: context, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + }); + }; + var shouldNotify = notifyOnNetworkStatusChange && + typeof oldNetworkStatus === "number" && + oldNetworkStatus !== networkStatus && + isNetworkRequestInFlight(networkStatus); + switch (fetchPolicy) { + default: + case "cache-first": { + var diff = readCache(); + if (diff.complete) { + return { + fromLink: false, + sources: [resultsFromCache(diff, queryInfo.markReady())], + }; + } + if (returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-and-network": { + var diff = readCache(); + if (diff.complete || returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-only": + return { + fromLink: false, + sources: [resultsFromCache(readCache(), queryInfo.markReady())], + }; + case "network-only": + if (shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(readCache()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "no-cache": + if (shouldNotify) { + return { + fromLink: true, + // Note that queryInfo.getDiff() for no-cache queries does not call + // cache.diff, but instead returns a { complete: false } stub result + // when there is no queryInfo.diff already defined. + sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "standby": + return { fromLink: false, sources: [] }; + } + }; + QueryManager.prototype.getQuery = function (queryId) { + if (queryId && !this.queries.has(queryId)) { + this.queries.set(queryId, new QueryInfo(this, queryId)); + } + return this.queries.get(queryId); + }; + QueryManager.prototype.prepareContext = function (context) { + if (context === void 0) { context = {}; } + var newContext = this.localState.prepareContext(context); + return __assign(__assign(__assign({}, this.defaultContext), newContext), { clientAwareness: this.clientAwareness }); + }; + return QueryManager; +}()); +export { QueryManager }; +//# sourceMappingURL=QueryManager.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/QueryManager.js.map b/graphql-subscription/node_modules/@apollo/client/core/QueryManager.js.map new file mode 100644 index 0000000..1597152 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/QueryManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"QueryManager.js","sourceRoot":"","sources":["../../src/core/QueryManager.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAEL,aAAa,EACb,iCAAiC,EACjC,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,U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AM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC3D,sCACK,IAAI,CAAC,cAAc,GACnB,UAAU,KACb,eAAe,EAAE,IAAI,CAAC,eAAe,IACrC;IACJ,CAAC;IACH,mBAAC;AAAD,CAAC,AAnjDD,IAmjDC","sourcesContent":["import { invariant, newInvariantError } from \"../utilities/globals/index.js\";\n\nimport type { DocumentNode } from \"graphql\";\n// TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356)\ntype OperationTypeNode = any;\nimport { equal } from \"@wry/equality\";\n\nimport type { ApolloLink, FetchResult } from \"../link/core/index.js\";\nimport { execute } from \"../link/core/index.js\";\nimport {\n defaultCacheSizes,\n hasDirectives,\n isExecutionPatchIncrementalResult,\n isExecutionPatchResult,\n removeDirectivesFromDocument,\n} from \"../utilities/index.js\";\nimport type { Cache, ApolloCache } from \"../cache/index.js\";\nimport { canonicalStringify } from \"../cache/index.js\";\n\nimport type {\n ObservableSubscription,\n ConcastSourcesArray,\n} from \"../utilities/index.js\";\nimport {\n getDefaultValues,\n getOperationDefinition,\n getOperationName,\n hasClientExports,\n graphQLResultHasError,\n getGraphQLErrorsFromResult,\n Observable,\n asyncMap,\n isNonEmptyArray,\n Concast,\n makeUniqueId,\n isDocumentNode,\n isNonNullObject,\n DocumentTransform,\n} from \"../utilities/index.js\";\nimport { mergeIncrementalData } from \"../utilities/common/incrementalResult.js\";\nimport {\n ApolloError,\n isApolloError,\n graphQLResultHasProtocolErrors,\n} from \"../errors/index.js\";\nimport type {\n QueryOptions,\n WatchQueryOptions,\n SubscriptionOptions,\n MutationOptions,\n ErrorPolicy,\n MutationFetchPolicy,\n} from \"./watchQueryOptions.js\";\nimport { ObservableQuery, logMissingFieldErrors } from \"./ObservableQuery.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport type {\n ApolloQueryResult,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n InternalRefetchQueriesOptions,\n InternalRefetchQueriesResult,\n InternalRefetchQueriesMap,\n DefaultContext,\n} from \"./types.js\";\nimport { LocalState } from \"./LocalState.js\";\n\nimport type { QueryStoreValue } from \"./QueryInfo.js\";\nimport {\n QueryInfo,\n shouldWriteResult,\n CacheWriteBehavior,\n} from \"./QueryInfo.js\";\nimport type { ApolloErrorOptions } from \"../errors/index.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../errors/index.js\";\nimport { print } from \"../utilities/index.js\";\nimport type { IgnoreModifier } from \"../cache/core/types/common.js\";\nimport type { TODO } from \"../utilities/types/TODO.js\";\n\nconst { hasOwnProperty } = Object.prototype;\n\nconst IGNORE: IgnoreModifier = Object.create(null);\n\ninterface MutationStoreValue {\n mutation: DocumentNode;\n variables: Record;\n loading: boolean;\n error: Error | null;\n}\n\ntype UpdateQueries = MutationOptions[\"updateQueries\"];\n\ninterface TransformCacheEntry {\n hasClientExports: boolean;\n hasForcedResolvers: boolean;\n hasNonreactiveDirective: boolean;\n clientQuery: DocumentNode | null;\n serverQuery: DocumentNode | null;\n defaultVars: OperationVariables;\n asQuery: DocumentNode;\n}\n\nimport type { DefaultOptions } from \"./ApolloClient.js\";\nimport { Trie } from \"@wry/trie\";\nimport { AutoCleanedWeakCache, cacheSizes } from \"../utilities/index.js\";\n\nexport class QueryManager {\n public cache: ApolloCache;\n public link: ApolloLink;\n public defaultOptions: DefaultOptions;\n\n public readonly assumeImmutableResults: boolean;\n public readonly documentTransform: DocumentTransform;\n public readonly ssrMode: boolean;\n public readonly defaultContext: Partial;\n\n private queryDeduplication: boolean;\n private clientAwareness: Record = {};\n private localState: LocalState;\n\n private onBroadcast?: () => void;\n public mutationStore?: {\n [mutationId: string]: MutationStoreValue;\n };\n\n // All the queries that the QueryManager is currently managing (not\n // including mutations and subscriptions).\n private queries = new Map();\n\n // Maps from queryId strings to Promise rejection functions for\n // currently active queries and fetches.\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n protected fetchCancelFns = new Map any>();\n\n constructor({\n cache,\n link,\n defaultOptions,\n documentTransform,\n queryDeduplication = false,\n onBroadcast,\n ssrMode = false,\n clientAwareness = {},\n localState,\n assumeImmutableResults = !!cache.assumeImmutableResults,\n defaultContext,\n }: {\n cache: ApolloCache;\n link: ApolloLink;\n defaultOptions?: DefaultOptions;\n documentTransform?: DocumentTransform;\n queryDeduplication?: boolean;\n onBroadcast?: () => void;\n ssrMode?: boolean;\n clientAwareness?: Record;\n localState?: LocalState;\n assumeImmutableResults?: boolean;\n defaultContext?: Partial;\n }) {\n const defaultDocumentTransform = new DocumentTransform(\n (document) => this.cache.transformDocument(document),\n // Allow the apollo cache to manage its own transform caches\n { cache: false }\n );\n\n this.cache = cache;\n this.link = link;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.queryDeduplication = queryDeduplication;\n this.clientAwareness = clientAwareness;\n this.localState = localState || new LocalState({ cache });\n this.ssrMode = ssrMode;\n this.assumeImmutableResults = assumeImmutableResults;\n this.documentTransform =\n documentTransform ?\n defaultDocumentTransform\n .concat(documentTransform)\n // The custom document transform may add new fragment spreads or new\n // field selections, so we want to give the cache a chance to run\n // again. For example, the InMemoryCache adds __typename to field\n // selections and fragments from the fragment registry.\n .concat(defaultDocumentTransform)\n : defaultDocumentTransform;\n this.defaultContext = defaultContext || Object.create(null);\n\n if ((this.onBroadcast = onBroadcast)) {\n this.mutationStore = Object.create(null);\n }\n }\n\n /**\n * Call this method to terminate any active query processes, making it safe\n * to dispose of this QueryManager instance.\n */\n public stop() {\n this.queries.forEach((_info, queryId) => {\n this.stopQueryNoBroadcast(queryId);\n });\n\n this.cancelPendingFetches(\n newInvariantError(\"QueryManager stopped while query was in flight\")\n );\n }\n\n private cancelPendingFetches(error: Error) {\n this.fetchCancelFns.forEach((cancel) => cancel(error));\n this.fetchCancelFns.clear();\n }\n\n public async mutate<\n TData,\n TVariables extends OperationVariables,\n TContext extends Record,\n TCache extends ApolloCache,\n >({\n mutation,\n variables,\n optimisticResponse,\n updateQueries,\n refetchQueries = [],\n awaitRefetchQueries = false,\n update: updateWithProxyFn,\n onQueryUpdated,\n fetchPolicy = this.defaultOptions.mutate?.fetchPolicy || \"network-only\",\n errorPolicy = this.defaultOptions.mutate?.errorPolicy || \"none\",\n keepRootFields,\n context,\n }: MutationOptions): Promise<\n FetchResult\n > {\n invariant(\n mutation,\n \"mutation option is required. You must specify your GraphQL document in the mutation option.\"\n );\n\n invariant(\n fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\",\n \"Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.\"\n );\n\n const mutationId = this.generateMutationId();\n\n mutation = this.cache.transformForLink(this.transform(mutation));\n const { hasClientExports } = this.getDocumentInfo(mutation);\n\n variables = this.getVariables(mutation, variables) as TVariables;\n if (hasClientExports) {\n variables = (await this.localState.addExportedVariables(\n mutation,\n variables,\n context\n )) as TVariables;\n }\n\n const mutationStoreValue =\n this.mutationStore &&\n (this.mutationStore[mutationId] = {\n mutation,\n variables,\n loading: true,\n error: null,\n } as MutationStoreValue);\n\n const isOptimistic =\n optimisticResponse &&\n this.markMutationOptimistic(\n optimisticResponse,\n {\n mutationId,\n document: mutation,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n updateQueries,\n update: updateWithProxyFn,\n keepRootFields,\n }\n );\n\n this.broadcastQueries();\n\n const self = this;\n\n return new Promise((resolve, reject) => {\n return asyncMap(\n self.getObservableFromLink(\n mutation,\n {\n ...context,\n optimisticResponse: isOptimistic ? optimisticResponse : void 0,\n },\n variables,\n false\n ),\n\n (result: FetchResult) => {\n if (graphQLResultHasError(result) && errorPolicy === \"none\") {\n throw new ApolloError({\n graphQLErrors: getGraphQLErrorsFromResult(result),\n });\n }\n\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = null;\n }\n\n const storeResult: typeof result = { ...result };\n\n if (typeof refetchQueries === \"function\") {\n refetchQueries = refetchQueries(storeResult);\n }\n\n if (errorPolicy === \"ignore\" && graphQLResultHasError(storeResult)) {\n delete storeResult.errors;\n }\n\n return self.markMutationResult({\n mutationId,\n result: storeResult,\n document: mutation,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n update: updateWithProxyFn,\n updateQueries,\n awaitRefetchQueries,\n refetchQueries,\n removeOptimistic: isOptimistic ? mutationId : void 0,\n onQueryUpdated,\n keepRootFields,\n });\n }\n ).subscribe({\n next(storeResult) {\n self.broadcastQueries();\n\n // Since mutations might receive multiple payloads from the\n // ApolloLink chain (e.g. when used with @defer),\n // we resolve with a SingleExecutionResult or after the final\n // ExecutionPatchResult has arrived and we have assembled the\n // multipart response into a single result.\n if (!(\"hasNext\" in storeResult) || storeResult.hasNext === false) {\n resolve(storeResult);\n }\n },\n\n error(err: Error) {\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = err;\n }\n\n if (isOptimistic) {\n self.cache.removeOptimistic(mutationId);\n }\n\n self.broadcastQueries();\n\n reject(\n err instanceof ApolloError ? err : (\n new ApolloError({\n networkError: err,\n })\n )\n );\n },\n });\n });\n }\n\n public markMutationResult<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache,\n >(\n mutation: {\n mutationId: string;\n result: FetchResult;\n document: DocumentNode;\n variables?: TVariables;\n fetchPolicy?: MutationFetchPolicy;\n errorPolicy: ErrorPolicy;\n context?: TContext;\n updateQueries: UpdateQueries;\n update?: MutationUpdaterFunction;\n awaitRefetchQueries?: boolean;\n refetchQueries?: InternalRefetchQueriesInclude;\n removeOptimistic?: string;\n onQueryUpdated?: OnQueryUpdated;\n keepRootFields?: boolean;\n },\n cache = this.cache\n ): Promise> {\n let { result } = mutation;\n const cacheWrites: Cache.WriteOptions[] = [];\n const skipCache = mutation.fetchPolicy === \"no-cache\";\n\n if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) {\n if (!isExecutionPatchIncrementalResult(result)) {\n cacheWrites.push({\n result: result.data,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n const diff = cache.diff({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n let mergedData;\n if (diff.result) {\n mergedData = mergeIncrementalData(diff.result, result);\n }\n if (typeof mergedData !== \"undefined\") {\n // cast the ExecutionPatchResult to FetchResult here since\n // ExecutionPatchResult never has `data` when returned from the server\n (result as FetchResult).data = mergedData;\n cacheWrites.push({\n result: mergedData,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n }\n\n const { updateQueries } = mutation;\n if (updateQueries) {\n this.queries.forEach(({ observableQuery }, queryId) => {\n const queryName = observableQuery && observableQuery.queryName;\n if (!queryName || !hasOwnProperty.call(updateQueries, queryName)) {\n return;\n }\n const updater = updateQueries[queryName];\n const { document, variables } = this.queries.get(queryId)!;\n\n // Read the current query result from the store.\n const { result: currentQueryResult, complete } = cache.diff({\n query: document!,\n variables,\n returnPartialData: true,\n optimistic: false,\n });\n\n if (complete && currentQueryResult) {\n // Run our reducer using the current query result and the mutation result.\n const nextQueryResult = updater(currentQueryResult, {\n mutationResult: result,\n queryName: (document && getOperationName(document)) || void 0,\n queryVariables: variables!,\n });\n\n // Write the modified result back into the store if we got a new result.\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: \"ROOT_QUERY\",\n query: document!,\n variables,\n });\n }\n }\n });\n }\n }\n\n if (\n cacheWrites.length > 0 ||\n (mutation.refetchQueries || \"\").length > 0 ||\n mutation.update ||\n mutation.onQueryUpdated ||\n mutation.removeOptimistic\n ) {\n const results: any[] = [];\n\n this.refetchQueries({\n updateCache: (cache) => {\n if (!skipCache) {\n cacheWrites.forEach((write) => cache.write(write));\n }\n\n // If the mutation has some writes associated with it then we need to\n // apply those writes to the store by running this reducer again with\n // a write action.\n const { update } = mutation;\n // Determine whether result is a SingleExecutionResult,\n // or the final ExecutionPatchResult.\n const isFinalResult =\n !isExecutionPatchResult(result) ||\n (isExecutionPatchIncrementalResult(result) && !result.hasNext);\n\n if (update) {\n if (!skipCache) {\n // Re-read the ROOT_MUTATION data we just wrote into the cache\n // (the first cache.write call in the cacheWrites.forEach loop\n // above), so field read functions have a chance to run for\n // fields within mutation result objects.\n const diff = cache.diff({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n\n if (diff.complete) {\n result = { ...(result as FetchResult), data: diff.result };\n if (\"incremental\" in result) {\n delete result.incremental;\n }\n if (\"hasNext\" in result) {\n delete result.hasNext;\n }\n }\n }\n\n // If we've received the whole response,\n // either a SingleExecutionResult or the final ExecutionPatchResult,\n // call the update function.\n if (isFinalResult) {\n update(cache as TCache, result, {\n context: mutation.context,\n variables: mutation.variables,\n });\n }\n }\n\n // TODO Do this with cache.evict({ id: 'ROOT_MUTATION' }) but make it\n // shallow to allow rolling back optimistic evictions.\n if (!skipCache && !mutation.keepRootFields && isFinalResult) {\n cache.modify({\n id: \"ROOT_MUTATION\",\n fields(value, { fieldName, DELETE }) {\n return fieldName === \"__typename\" ? value : DELETE;\n },\n });\n }\n },\n\n include: mutation.refetchQueries,\n\n // Write the final mutation.result to the root layer of the cache.\n optimistic: false,\n\n // Remove the corresponding optimistic layer at the same time as we\n // write the final non-optimistic result.\n removeOptimistic: mutation.removeOptimistic,\n\n // Let the caller of client.mutate optionally determine the refetching\n // behavior for watched queries after the mutation.update function runs.\n // If no onQueryUpdated function was provided for this mutation, pass\n // null instead of undefined to disable the default refetching behavior.\n onQueryUpdated: mutation.onQueryUpdated || null,\n }).forEach((result) => results.push(result));\n\n if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) {\n // Returning a promise here makes the mutation await that promise, so we\n // include results in that promise's work if awaitRefetchQueries or an\n // onQueryUpdated function was specified.\n return Promise.all(results).then(() => result);\n }\n }\n\n return Promise.resolve(result);\n }\n\n public markMutationOptimistic<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache,\n >(\n optimisticResponse: any,\n mutation: {\n mutationId: string;\n document: DocumentNode;\n variables?: TVariables;\n fetchPolicy?: MutationFetchPolicy;\n errorPolicy: ErrorPolicy;\n context?: TContext;\n updateQueries: UpdateQueries;\n update?: MutationUpdaterFunction;\n keepRootFields?: boolean;\n }\n ) {\n const data =\n typeof optimisticResponse === \"function\" ?\n optimisticResponse(mutation.variables, { IGNORE })\n : optimisticResponse;\n\n if (data === IGNORE) {\n return false;\n }\n\n this.cache.recordOptimisticTransaction((cache) => {\n try {\n this.markMutationResult(\n {\n ...mutation,\n result: { data },\n },\n cache\n );\n } catch (error) {\n invariant.error(error);\n }\n }, mutation.mutationId);\n\n return true;\n }\n\n public fetchQuery(\n queryId: string,\n options: WatchQueryOptions,\n networkStatus?: NetworkStatus\n ): Promise> {\n return this.fetchConcastWithInfo(queryId, options, networkStatus).concast\n .promise as TODO;\n }\n\n public getQueryStore() {\n const store: Record = Object.create(null);\n this.queries.forEach((info, queryId) => {\n store[queryId] = {\n variables: info.variables,\n networkStatus: info.networkStatus,\n networkError: info.networkError,\n graphQLErrors: info.graphQLErrors,\n };\n });\n return store;\n }\n\n public resetErrors(queryId: string) {\n const queryInfo = this.queries.get(queryId);\n if (queryInfo) {\n queryInfo.networkError = undefined;\n queryInfo.graphQLErrors = [];\n }\n }\n\n public transform(document: DocumentNode) {\n return this.documentTransform.transformDocument(document);\n }\n\n private transformCache = new AutoCleanedWeakCache<\n DocumentNode,\n TransformCacheEntry\n >(\n cacheSizes[\"queryManager.getDocumentInfo\"] ||\n defaultCacheSizes[\"queryManager.getDocumentInfo\"]\n );\n\n public getDocumentInfo(document: DocumentNode) {\n const { transformCache } = this;\n\n if (!transformCache.has(document)) {\n const cacheEntry: TransformCacheEntry = {\n // TODO These three calls (hasClientExports, shouldForceResolvers, and\n // usesNonreactiveDirective) are performing independent full traversals\n // of the transformed document. We should consider merging these\n // traversals into a single pass in the future, though the work is\n // cached after the first time.\n hasClientExports: hasClientExports(document),\n hasForcedResolvers: this.localState.shouldForceResolvers(document),\n hasNonreactiveDirective: hasDirectives([\"nonreactive\"], document),\n clientQuery: this.localState.clientQuery(document),\n serverQuery: removeDirectivesFromDocument(\n [\n { name: \"client\", remove: true },\n { name: \"connection\" },\n { name: \"nonreactive\" },\n ],\n document\n ),\n defaultVars: getDefaultValues(\n getOperationDefinition(document)\n ) as OperationVariables,\n // Transform any mutation or subscription operations to query operations\n // so we can read/write them from/to the cache.\n asQuery: {\n ...document,\n definitions: document.definitions.map((def) => {\n if (\n def.kind === \"OperationDefinition\" &&\n def.operation !== \"query\"\n ) {\n return { ...def, operation: \"query\" as OperationTypeNode };\n }\n return def;\n }),\n },\n };\n\n transformCache.set(document, cacheEntry);\n }\n\n return transformCache.get(document)!;\n }\n\n private getVariables(\n document: DocumentNode,\n variables?: TVariables\n ): OperationVariables {\n return {\n ...this.getDocumentInfo(document).defaultVars,\n ...variables,\n };\n }\n\n public watchQuery<\n T,\n TVariables extends OperationVariables = OperationVariables,\n >(options: WatchQueryOptions): ObservableQuery {\n const query = this.transform(options.query);\n\n // assign variable default values if supplied\n // NOTE: We don't modify options.query here with the transformed query to\n // ensure observable.options.query is set to the raw untransformed query.\n options = {\n ...options,\n variables: this.getVariables(query, options.variables) as TVariables,\n };\n\n if (typeof options.notifyOnNetworkStatusChange === \"undefined\") {\n options.notifyOnNetworkStatusChange = false;\n }\n\n const queryInfo = new QueryInfo(this);\n const observable = new ObservableQuery({\n queryManager: this,\n queryInfo,\n options,\n });\n observable[\"lastQuery\"] = query;\n\n this.queries.set(observable.queryId, queryInfo);\n\n // We give queryInfo the transformed query to ensure the first cache diff\n // uses the transformed query instead of the raw query\n queryInfo.init({\n document: query,\n observableQuery: observable,\n variables: observable.variables,\n });\n\n return observable;\n }\n\n public query(\n options: QueryOptions,\n queryId = this.generateQueryId()\n ): Promise> {\n invariant(\n options.query,\n \"query option is required. You must specify your GraphQL document \" +\n \"in the query option.\"\n );\n\n invariant(\n options.query.kind === \"Document\",\n 'You must wrap the query string in a \"gql\" tag.'\n );\n\n invariant(\n !(options as any).returnPartialData,\n \"returnPartialData option only supported on watchQuery.\"\n );\n\n invariant(\n !(options as any).pollInterval,\n \"pollInterval option only supported on watchQuery.\"\n );\n\n return this.fetchQuery(queryId, {\n ...options,\n query: this.transform(options.query),\n }).finally(() => this.stopQuery(queryId));\n }\n\n private queryIdCounter = 1;\n public generateQueryId() {\n return String(this.queryIdCounter++);\n }\n\n private requestIdCounter = 1;\n public generateRequestId() {\n return this.requestIdCounter++;\n }\n\n private mutationIdCounter = 1;\n public generateMutationId() {\n return String(this.mutationIdCounter++);\n }\n\n public stopQueryInStore(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryInStoreNoBroadcast(queryId: string) {\n const queryInfo = this.queries.get(queryId);\n if (queryInfo) queryInfo.stop();\n }\n\n public clearStore(\n options: Cache.ResetOptions = {\n discardWatches: true,\n }\n ): Promise {\n // Before we have sent the reset action to the store, we can no longer\n // rely on the results returned by in-flight requests since these may\n // depend on values that previously existed in the data portion of the\n // store. So, we cancel the promises and observers that we have issued\n // so far and not yet resolved (in the case of queries).\n this.cancelPendingFetches(\n newInvariantError(\n \"Store reset while query was in flight (not completed in link chain)\"\n )\n );\n\n this.queries.forEach((queryInfo) => {\n if (queryInfo.observableQuery) {\n // Set loading to true so listeners don't trigger unless they want\n // results with partial data.\n queryInfo.networkStatus = NetworkStatus.loading;\n } else {\n queryInfo.stop();\n }\n });\n\n if (this.mutationStore) {\n this.mutationStore = Object.create(null);\n }\n\n // begin removing data from the store\n return this.cache.reset(options);\n }\n\n public getObservableQueries(\n include: InternalRefetchQueriesInclude = \"active\"\n ) {\n const queries = new Map>();\n const queryNamesAndDocs = new Map();\n const legacyQueryOptions = new Set();\n\n if (Array.isArray(include)) {\n include.forEach((desc) => {\n if (typeof desc === \"string\") {\n queryNamesAndDocs.set(desc, false);\n } else if (isDocumentNode(desc)) {\n queryNamesAndDocs.set(this.transform(desc), false);\n } else if (isNonNullObject(desc) && desc.query) {\n legacyQueryOptions.add(desc);\n }\n });\n }\n\n this.queries.forEach(({ observableQuery: oq, document }, queryId) => {\n if (oq) {\n if (include === \"all\") {\n queries.set(queryId, oq);\n return;\n }\n\n const {\n queryName,\n options: { fetchPolicy },\n } = oq;\n\n if (\n fetchPolicy === \"standby\" ||\n (include === \"active\" && !oq.hasObservers())\n ) {\n return;\n }\n\n if (\n include === \"active\" ||\n (queryName && queryNamesAndDocs.has(queryName)) ||\n (document && queryNamesAndDocs.has(document))\n ) {\n queries.set(queryId, oq);\n if (queryName) queryNamesAndDocs.set(queryName, true);\n if (document) queryNamesAndDocs.set(document, true);\n }\n }\n });\n\n if (legacyQueryOptions.size) {\n legacyQueryOptions.forEach((options: QueryOptions) => {\n // We will be issuing a fresh network request for this query, so we\n // pre-allocate a new query ID here, using a special prefix to enable\n // cleaning up these temporary queries later, after fetching.\n const queryId = makeUniqueId(\"legacyOneTimeQuery\");\n const queryInfo = this.getQuery(queryId).init({\n document: options.query,\n variables: options.variables,\n });\n const oq = new ObservableQuery({\n queryManager: this,\n queryInfo,\n options: {\n ...options,\n fetchPolicy: \"network-only\",\n },\n });\n invariant(oq.queryId === queryId);\n queryInfo.setObservableQuery(oq);\n queries.set(queryId, oq);\n });\n }\n\n if (__DEV__ && queryNamesAndDocs.size) {\n queryNamesAndDocs.forEach((included, nameOrDoc) => {\n if (!included) {\n invariant.warn(\n typeof nameOrDoc === \"string\" ?\n `Unknown query named \"%s\" requested in refetchQueries options.include array`\n : `Unknown query %o requested in refetchQueries options.include array`,\n nameOrDoc\n );\n }\n });\n }\n\n return queries;\n }\n\n public reFetchObservableQueries(\n includeStandby: boolean = false\n ): Promise[]> {\n const observableQueryPromises: Promise>[] = [];\n\n this.getObservableQueries(includeStandby ? \"all\" : \"active\").forEach(\n (observableQuery, queryId) => {\n const { fetchPolicy } = observableQuery.options;\n observableQuery.resetLastResults();\n if (\n includeStandby ||\n (fetchPolicy !== \"standby\" && fetchPolicy !== \"cache-only\")\n ) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n this.getQuery(queryId).setDiff(null);\n }\n );\n\n this.broadcastQueries();\n\n return Promise.all(observableQueryPromises);\n }\n\n public setObservableQuery(observableQuery: ObservableQuery) {\n this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery);\n }\n\n public startGraphQLSubscription({\n query,\n fetchPolicy,\n errorPolicy = \"none\",\n variables,\n context = {},\n }: SubscriptionOptions): Observable> {\n query = this.transform(query);\n variables = this.getVariables(query, variables);\n\n const makeObservable = (variables: OperationVariables) =>\n this.getObservableFromLink(query, context, variables).map((result) => {\n if (fetchPolicy !== \"no-cache\") {\n // the subscription interface should handle not sending us results we no longer subscribe to.\n // XXX I don't think we ever send in an object with errors, but we might in the future...\n if (shouldWriteResult(result, errorPolicy)) {\n this.cache.write({\n query,\n result: result.data,\n dataId: \"ROOT_SUBSCRIPTION\",\n variables: variables,\n });\n }\n\n this.broadcastQueries();\n }\n\n const hasErrors = graphQLResultHasError(result);\n const hasProtocolErrors = graphQLResultHasProtocolErrors(result);\n if (hasErrors || hasProtocolErrors) {\n const errors: ApolloErrorOptions = {};\n if (hasErrors) {\n errors.graphQLErrors = result.errors;\n }\n if (hasProtocolErrors) {\n errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL];\n }\n\n // `errorPolicy` is a mechanism for handling GraphQL errors, according\n // to our documentation, so we throw protocol errors regardless of the\n // set error policy.\n if (errorPolicy === \"none\" || hasProtocolErrors) {\n throw new ApolloError(errors);\n }\n }\n\n if (errorPolicy === \"ignore\") {\n delete result.errors;\n }\n\n return result;\n });\n\n if (this.getDocumentInfo(query).hasClientExports) {\n const observablePromise = this.localState\n .addExportedVariables(query, variables, context)\n .then(makeObservable);\n\n return new Observable>((observer) => {\n let sub: ObservableSubscription | null = null;\n observablePromise.then(\n (observable) => (sub = observable.subscribe(observer)),\n observer.error\n );\n return () => sub && sub.unsubscribe();\n });\n }\n\n return makeObservable(variables);\n }\n\n public stopQuery(queryId: string) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n }\n\n private stopQueryNoBroadcast(queryId: string) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n }\n\n public removeQuery(queryId: string) {\n // teardown all links\n // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises\n // that each add their reject functions to fetchCancelFns.\n // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.\n // The same queryId could have two rejection fns for two promises\n this.fetchCancelFns.delete(queryId);\n if (this.queries.has(queryId)) {\n this.getQuery(queryId).stop();\n this.queries.delete(queryId);\n }\n }\n\n public broadcastQueries() {\n if (this.onBroadcast) this.onBroadcast();\n this.queries.forEach((info) => info.notify());\n }\n\n public getLocalState(): LocalState {\n return this.localState;\n }\n\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n protected inFlightLinkObservables = new Trie<{\n observable?: Observable>;\n }>(false);\n\n private getObservableFromLink(\n query: DocumentNode,\n context: any,\n variables?: OperationVariables,\n // Prefer context.queryDeduplication if specified.\n deduplication: boolean = context?.queryDeduplication ??\n this.queryDeduplication\n ): Observable> {\n let observable: Observable> | undefined;\n\n const { serverQuery, clientQuery } = this.getDocumentInfo(query);\n if (serverQuery) {\n const { inFlightLinkObservables, link } = this;\n\n const operation = {\n query: serverQuery,\n variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext({\n ...context,\n forceFetch: !deduplication,\n }),\n };\n\n context = operation.context;\n\n if (deduplication) {\n const printedServerQuery = print(serverQuery);\n const varJson = canonicalStringify(variables);\n\n const entry = inFlightLinkObservables.lookup(\n printedServerQuery,\n varJson\n );\n\n observable = entry.observable;\n if (!observable) {\n const concast = new Concast([\n execute(link, operation) as Observable>,\n ]);\n observable = entry.observable = concast;\n\n concast.beforeNext(() => {\n inFlightLinkObservables.remove(printedServerQuery, varJson);\n });\n }\n } else {\n observable = new Concast([\n execute(link, operation) as Observable>,\n ]);\n }\n } else {\n observable = new Concast([Observable.of({ data: {} } as FetchResult)]);\n context = this.prepareContext(context);\n }\n\n if (clientQuery) {\n observable = asyncMap(observable, (result) => {\n return this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context,\n variables,\n });\n });\n }\n\n return observable;\n }\n\n private getResultsFromLink(\n queryInfo: QueryInfo,\n cacheWriteBehavior: CacheWriteBehavior,\n options: Pick<\n WatchQueryOptions,\n \"query\" | \"variables\" | \"context\" | \"fetchPolicy\" | \"errorPolicy\"\n >\n ): Observable> {\n const requestId = (queryInfo.lastRequestId = this.generateRequestId());\n\n // Performing transformForLink here gives this.cache a chance to fill in\n // missing fragment definitions (for example) before sending this document\n // through the link chain.\n const linkDocument = this.cache.transformForLink(options.query);\n\n return asyncMap(\n this.getObservableFromLink(\n linkDocument,\n options.context,\n options.variables\n ),\n\n (result) => {\n const graphQLErrors = getGraphQLErrorsFromResult(result);\n const hasErrors = graphQLErrors.length > 0;\n\n // If we interrupted this request by calling getResultsFromLink again\n // with the same QueryInfo object, we ignore the old results.\n if (requestId >= queryInfo.lastRequestId) {\n if (hasErrors && options.errorPolicy === \"none\") {\n // Throwing here effectively calls observer.error.\n throw queryInfo.markError(\n new ApolloError({\n graphQLErrors,\n })\n );\n }\n // Use linkDocument rather than queryInfo.document so the\n // operation/fragments used to write the result are the same as the\n // ones used to obtain it from the link.\n queryInfo.markResult(\n result,\n linkDocument,\n options,\n cacheWriteBehavior\n );\n queryInfo.markReady();\n }\n\n const aqr: ApolloQueryResult = {\n data: result.data,\n loading: false,\n networkStatus: NetworkStatus.ready,\n };\n\n if (hasErrors && options.errorPolicy !== \"ignore\") {\n aqr.errors = graphQLErrors;\n aqr.networkStatus = NetworkStatus.error;\n }\n\n return aqr;\n },\n\n (networkError) => {\n const error =\n isApolloError(networkError) ? networkError : (\n new ApolloError({ networkError })\n );\n\n // Avoid storing errors from older interrupted queries.\n if (requestId >= queryInfo.lastRequestId) {\n queryInfo.markError(error);\n }\n\n throw error;\n }\n );\n }\n\n private fetchConcastWithInfo(\n queryId: string,\n options: WatchQueryOptions,\n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus = NetworkStatus.loading,\n query = options.query\n ): ConcastAndInfo {\n const variables = this.getVariables(query, options.variables) as TVars;\n const queryInfo = this.getQuery(queryId);\n\n const defaults = this.defaultOptions.watchQuery;\n let {\n fetchPolicy = (defaults && defaults.fetchPolicy) || \"cache-first\",\n errorPolicy = (defaults && defaults.errorPolicy) || \"none\",\n returnPartialData = false,\n notifyOnNetworkStatusChange = false,\n context = {},\n } = options;\n\n const normalized = Object.assign({}, options, {\n query,\n variables,\n fetchPolicy,\n errorPolicy,\n returnPartialData,\n notifyOnNetworkStatusChange,\n context,\n });\n\n const fromVariables = (variables: TVars) => {\n // Since normalized is always a fresh copy of options, it's safe to\n // modify its properties here, rather than creating yet another new\n // WatchQueryOptions object.\n normalized.variables = variables;\n\n const sourcesWithInfo = this.fetchQueryByPolicy(\n queryInfo,\n normalized,\n networkStatus\n );\n\n if (\n // If we're in standby, postpone advancing options.fetchPolicy using\n // applyNextFetchPolicy.\n normalized.fetchPolicy !== \"standby\" &&\n // The \"standby\" policy currently returns [] from fetchQueryByPolicy, so\n // this is another way to detect when nothing was done/fetched.\n sourcesWithInfo.sources.length > 0 &&\n queryInfo.observableQuery\n ) {\n queryInfo.observableQuery[\"applyNextFetchPolicy\"](\n \"after-fetch\",\n options\n );\n }\n\n return sourcesWithInfo;\n };\n\n // This cancel function needs to be set before the concast is created,\n // in case concast creation synchronously cancels the request.\n const cleanupCancelFn = () => this.fetchCancelFns.delete(queryId);\n this.fetchCancelFns.set(queryId, (reason) => {\n cleanupCancelFn();\n // This delay ensures the concast variable has been initialized.\n setTimeout(() => concast.cancel(reason));\n });\n\n let concast: Concast>,\n containsDataFromLink: boolean;\n // If the query has @export(as: ...) directives, then we need to\n // process those directives asynchronously. When there are no\n // @export directives (the common case), we deliberately avoid\n // wrapping the result of this.fetchQueryByPolicy in a Promise,\n // since the timing of result delivery is (unfortunately) important\n // for backwards compatibility. TODO This code could be simpler if\n // we deprecated and removed LocalState.\n if (this.getDocumentInfo(normalized.query).hasClientExports) {\n concast = new Concast(\n this.localState\n .addExportedVariables(\n normalized.query,\n normalized.variables,\n normalized.context\n )\n .then(fromVariables)\n .then((sourcesWithInfo) => sourcesWithInfo.sources)\n );\n // there is just no way we can synchronously get the *right* value here,\n // so we will assume `true`, which is the behaviour before the bug fix in\n // #10597. This means that bug is not fixed in that case, and is probably\n // un-fixable with reasonable effort for the edge case of @export as\n // directives.\n containsDataFromLink = true;\n } else {\n const sourcesWithInfo = fromVariables(normalized.variables);\n containsDataFromLink = sourcesWithInfo.fromLink;\n concast = new Concast(sourcesWithInfo.sources);\n }\n\n concast.promise.then(cleanupCancelFn, cleanupCancelFn);\n\n return {\n concast,\n fromLink: containsDataFromLink,\n };\n }\n\n public refetchQueries({\n updateCache,\n include,\n optimistic = false,\n removeOptimistic = optimistic ? makeUniqueId(\"refetchQueries\") : void 0,\n onQueryUpdated,\n }: InternalRefetchQueriesOptions<\n ApolloCache,\n TResult\n >): InternalRefetchQueriesMap {\n const includedQueriesById = new Map<\n string,\n {\n oq: ObservableQuery;\n lastDiff?: Cache.DiffResult;\n diff?: Cache.DiffResult;\n }\n >();\n\n if (include) {\n this.getObservableQueries(include).forEach((oq, queryId) => {\n includedQueriesById.set(queryId, {\n oq,\n lastDiff: this.getQuery(queryId).getDiff(),\n });\n });\n }\n\n const results: InternalRefetchQueriesMap = new Map();\n\n if (updateCache) {\n this.cache.batch({\n update: updateCache,\n\n // Since you can perform any combination of cache reads and/or writes in\n // the cache.batch update function, its optimistic option can be either\n // a boolean or a string, representing three distinct modes of\n // operation:\n //\n // * false: read/write only the root layer\n // * true: read/write the topmost layer\n // * string: read/write a fresh optimistic layer with that ID string\n //\n // When typeof optimistic === \"string\", a new optimistic layer will be\n // temporarily created within cache.batch with that string as its ID. If\n // we then pass that same string as the removeOptimistic option, we can\n // make cache.batch immediately remove the optimistic layer after\n // running the updateCache function, triggering only one broadcast.\n //\n // However, the refetchQueries method accepts only true or false for its\n // optimistic option (not string). We interpret true to mean a temporary\n // optimistic layer should be created, to allow efficiently rolling back\n // the effect of the updateCache function, which involves passing a\n // string instead of true as the optimistic option to cache.batch, when\n // refetchQueries receives optimistic: true.\n //\n // In other words, we are deliberately not supporting the use case of\n // writing to an *existing* optimistic layer (using the refetchQueries\n // updateCache function), since that would potentially interfere with\n // other optimistic updates in progress. Instead, you can read/write\n // only the root layer by passing optimistic: false to refetchQueries,\n // or you can read/write a brand new optimistic layer that will be\n // automatically removed by passing optimistic: true.\n optimistic: (optimistic && removeOptimistic) || false,\n\n // The removeOptimistic option can also be provided by itself, even if\n // optimistic === false, to remove some previously-added optimistic\n // layer safely and efficiently, like we do in markMutationResult.\n //\n // If an explicit removeOptimistic string is provided with optimistic:\n // true, the removeOptimistic string will determine the ID of the\n // temporary optimistic layer, in case that ever matters.\n removeOptimistic,\n\n onWatchUpdated(watch, diff, lastDiff) {\n const oq =\n watch.watcher instanceof QueryInfo && watch.watcher.observableQuery;\n\n if (oq) {\n if (onQueryUpdated) {\n // Since we're about to handle this query now, remove it from\n // includedQueriesById, in case it was added earlier because of\n // options.include.\n includedQueriesById.delete(oq.queryId);\n\n let result: TResult | boolean | Promise> =\n onQueryUpdated(oq, diff, lastDiff);\n\n if (result === true) {\n // The onQueryUpdated function requested the default refetching\n // behavior by returning true.\n result = oq.refetch();\n }\n\n // Record the result in the results Map, as long as onQueryUpdated\n // did not return false to skip/ignore this result.\n if (result !== false) {\n results.set(\n oq,\n result as InternalRefetchQueriesResult\n );\n }\n\n // Allow the default cache broadcast to happen, except when\n // onQueryUpdated returns false.\n return result;\n }\n\n if (onQueryUpdated !== null) {\n // If we don't have an onQueryUpdated function, and onQueryUpdated\n // was not disabled by passing null, make sure this query is\n // \"included\" like any other options.include-specified query.\n includedQueriesById.set(oq.queryId, { oq, lastDiff, diff });\n }\n }\n },\n });\n }\n\n if (includedQueriesById.size) {\n includedQueriesById.forEach(({ oq, lastDiff, diff }, queryId) => {\n let result:\n | TResult\n | boolean\n | Promise>\n | undefined;\n\n // If onQueryUpdated is provided, we want to use it for all included\n // queries, even the QueryOptions ones.\n if (onQueryUpdated) {\n if (!diff) {\n const info = oq[\"queryInfo\"];\n info.reset(); // Force info.getDiff() to read from cache.\n diff = info.getDiff();\n }\n result = onQueryUpdated(oq, diff, lastDiff);\n }\n\n // Otherwise, we fall back to refetching.\n if (!onQueryUpdated || result === true) {\n result = oq.refetch();\n }\n\n if (result !== false) {\n results.set(oq, result as InternalRefetchQueriesResult);\n }\n\n if (queryId.indexOf(\"legacyOneTimeQuery\") >= 0) {\n this.stopQueryNoBroadcast(queryId);\n }\n });\n }\n\n if (removeOptimistic) {\n // In case no updateCache callback was provided (so cache.batch was not\n // called above, and thus did not already remove the optimistic layer),\n // remove it here. Since this is a no-op when the layer has already been\n // removed, we do it even if we called cache.batch above, since it's\n // possible this.cache is an instance of some ApolloCache subclass other\n // than InMemoryCache, and does not fully support the removeOptimistic\n // option for cache.batch.\n this.cache.removeOptimistic(removeOptimistic);\n }\n\n return results;\n }\n\n private fetchQueryByPolicy(\n queryInfo: QueryInfo,\n {\n query,\n variables,\n fetchPolicy,\n refetchWritePolicy,\n errorPolicy,\n returnPartialData,\n context,\n notifyOnNetworkStatusChange,\n }: WatchQueryOptions,\n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus: NetworkStatus\n ): SourcesAndInfo {\n const oldNetworkStatus = queryInfo.networkStatus;\n\n queryInfo.init({\n document: query,\n variables,\n networkStatus,\n });\n\n const readCache = () => queryInfo.getDiff();\n\n const resultsFromCache = (\n diff: Cache.DiffResult,\n networkStatus = queryInfo.networkStatus || NetworkStatus.loading\n ) => {\n const data = diff.result;\n\n if (__DEV__ && !returnPartialData && !equal(data, {})) {\n logMissingFieldErrors(diff.missing);\n }\n\n const fromData = (data: TData | undefined) =>\n Observable.of({\n data,\n loading: isNetworkRequestInFlight(networkStatus),\n networkStatus,\n ...(diff.complete ? null : { partial: true }),\n } as ApolloQueryResult);\n\n if (data && this.getDocumentInfo(query).hasForcedResolvers) {\n return this.localState\n .runResolvers({\n document: query,\n remoteResult: { data },\n context,\n variables,\n onlyRunForcedResolvers: true,\n })\n .then((resolved) => fromData(resolved.data || void 0));\n }\n\n // Resolves https://github.com/apollographql/apollo-client/issues/10317.\n // If errorPolicy is 'none' and notifyOnNetworkStatusChange is true,\n // data was incorrectly returned from the cache on refetch:\n // if diff.missing exists, we should not return cache data.\n if (\n errorPolicy === \"none\" &&\n networkStatus === NetworkStatus.refetch &&\n Array.isArray(diff.missing)\n ) {\n return fromData(void 0);\n }\n\n return fromData(data);\n };\n\n const cacheWriteBehavior =\n fetchPolicy === \"no-cache\" ? CacheWriteBehavior.FORBID\n // Watched queries must opt into overwriting existing data on refetch,\n // by passing refetchWritePolicy: \"overwrite\" in their WatchQueryOptions.\n : (\n networkStatus === NetworkStatus.refetch &&\n refetchWritePolicy !== \"merge\"\n ) ?\n CacheWriteBehavior.OVERWRITE\n : CacheWriteBehavior.MERGE;\n\n const resultsFromLink = () =>\n this.getResultsFromLink(queryInfo, cacheWriteBehavior, {\n query,\n variables,\n context,\n fetchPolicy,\n errorPolicy,\n });\n\n const shouldNotify =\n notifyOnNetworkStatusChange &&\n typeof oldNetworkStatus === \"number\" &&\n oldNetworkStatus !== networkStatus &&\n isNetworkRequestInFlight(networkStatus);\n\n switch (fetchPolicy) {\n default:\n case \"cache-first\": {\n const diff = readCache();\n\n if (diff.complete) {\n return {\n fromLink: false,\n sources: [resultsFromCache(diff, queryInfo.markReady())],\n };\n }\n\n if (returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n\n case \"cache-and-network\": {\n const diff = readCache();\n\n if (diff.complete || returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n\n case \"cache-only\":\n return {\n fromLink: false,\n sources: [resultsFromCache(readCache(), queryInfo.markReady())],\n };\n\n case \"network-only\":\n if (shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(readCache()), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n\n case \"no-cache\":\n if (shouldNotify) {\n return {\n fromLink: true,\n // Note that queryInfo.getDiff() for no-cache queries does not call\n // cache.diff, but instead returns a { complete: false } stub result\n // when there is no queryInfo.diff already defined.\n sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()],\n };\n }\n\n return { fromLink: true, sources: [resultsFromLink()] };\n\n case \"standby\":\n return { fromLink: false, sources: [] };\n }\n }\n\n private getQuery(queryId: string): QueryInfo {\n if (queryId && !this.queries.has(queryId)) {\n this.queries.set(queryId, new QueryInfo(this, queryId));\n }\n return this.queries.get(queryId)!;\n }\n\n private prepareContext(context = {}) {\n const newContext = this.localState.prepareContext(context);\n return {\n ...this.defaultContext,\n ...newContext,\n clientAwareness: this.clientAwareness,\n };\n }\n}\n\n// Return types used by fetchQueryByPolicy and other private methods above.\ninterface FetchConcastInfo {\n // Metadata properties that can be returned in addition to the Concast.\n fromLink: boolean;\n}\ninterface SourcesAndInfo extends FetchConcastInfo {\n sources: ConcastSourcesArray>;\n}\ninterface ConcastAndInfo extends FetchConcastInfo {\n concast: Concast>;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/core.cjs b/graphql-subscription/node_modules/@apollo/client/core/core.cjs new file mode 100644 index 0000000..f15ae51 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/core.cjs @@ -0,0 +1,2642 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var globals = require('../utilities/globals'); +var core = require('../link/core'); +var http = require('../link/http'); +var equal = require('@wry/equality'); +var utilities = require('../utilities'); +var cache = require('../cache'); +var errors = require('../errors'); +var graphql = require('graphql'); +var trie = require('@wry/trie'); +var utils = require('../link/utils'); +var tsInvariant = require('ts-invariant'); +var graphqlTag = require('graphql-tag'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; } + +var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal); + +var version = "3.9.5"; + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} + +var hasOwnProperty$2 = Object.prototype.hasOwnProperty; +var defaultReconciler = function (target, source, property) { + return this.merge(target[property], source[property]); +}; +var DeepMerger = (function () { + function DeepMerger(reconciler) { + if (reconciler === void 0) { reconciler = defaultReconciler; } + this.reconciler = reconciler; + this.isObject = isNonNullObject; + this.pastCopies = new Set(); + } + DeepMerger.prototype.merge = function (target, source) { + var _this = this; + var context = []; + for (var _i = 2; _i < arguments.length; _i++) { + context[_i - 2] = arguments[_i]; + } + if (isNonNullObject(source) && isNonNullObject(target)) { + Object.keys(source).forEach(function (sourceKey) { + if (hasOwnProperty$2.call(target, sourceKey)) { + var targetValue = target[sourceKey]; + if (source[sourceKey] !== targetValue) { + var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, + source, + sourceKey], context, false)); + if (result !== targetValue) { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = result; + } + } + } + else { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = source[sourceKey]; + } + }); + return target; + } + return source; + }; + DeepMerger.prototype.shallowCopyForMerge = function (value) { + if (isNonNullObject(value)) { + if (!this.pastCopies.has(value)) { + if (Array.isArray(value)) { + value = value.slice(0); + } + else { + value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + this.pastCopies.add(value); + } + } + return value; + }; + return DeepMerger; +}()); + +function isExecutionPatchIncrementalResult(value) { + return "incremental" in value; +} +function mergeIncrementalData(prevResult, result) { + var mergedData = prevResult; + var merger = new DeepMerger(); + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (_a) { + var data = _a.data, path = _a.path; + for (var i = path.length - 1; i >= 0; --i) { + var key = path[i]; + var isNumericKey = !isNaN(+key); + var parent_1 = isNumericKey ? [] : {}; + parent_1[key] = data; + data = parent_1; + } + mergedData = merger.merge(mergedData, data); + }); + } + return mergedData; +} + +exports.NetworkStatus = void 0; +(function (NetworkStatus) { + NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; + NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; + NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; + NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; + NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; + NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; + NetworkStatus[NetworkStatus["error"] = 8] = "error"; +})(exports.NetworkStatus || (exports.NetworkStatus = {})); +function isNetworkRequestInFlight(networkStatus) { + return networkStatus ? networkStatus < 7 : false; +} +function isNetworkRequestSettled(networkStatus) { + return networkStatus === 7 || networkStatus === 8; +} + +function equalByQuery(query, _a, _b, variables) { + var aData = _a.data, aRest = tslib.__rest(_a, ["data"]); + var bData = _b.data, bRest = tslib.__rest(_b, ["data"]); + return (equal__default(aRest, bRest) && + equalBySelectionSet(utilities.getMainDefinition(query).selectionSet, aData, bData, { + fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(query)), + variables: variables, + })); +} +function equalBySelectionSet(selectionSet, aResult, bResult, context) { + if (aResult === bResult) { + return true; + } + var seenSelections = new Set(); + return selectionSet.selections.every(function (selection) { + if (seenSelections.has(selection)) + return true; + seenSelections.add(selection); + if (!utilities.shouldInclude(selection, context.variables)) + return true; + if (selectionHasNonreactiveDirective(selection)) + return true; + if (utilities.isField(selection)) { + var resultKey = utilities.resultKeyNameFromField(selection); + var aResultChild = aResult && aResult[resultKey]; + var bResultChild = bResult && bResult[resultKey]; + var childSelectionSet = selection.selectionSet; + if (!childSelectionSet) { + return equal__default(aResultChild, bResultChild); + } + var aChildIsArray = Array.isArray(aResultChild); + var bChildIsArray = Array.isArray(bResultChild); + if (aChildIsArray !== bChildIsArray) + return false; + if (aChildIsArray && bChildIsArray) { + var length_1 = aResultChild.length; + if (bResultChild.length !== length_1) { + return false; + } + for (var i = 0; i < length_1; ++i) { + if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) { + return false; + } + } + return true; + } + return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context); + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.fragmentMap); + if (fragment) { + if (selectionHasNonreactiveDirective(fragment)) + return true; + return equalBySelectionSet(fragment.selectionSet, + aResult, bResult, context); + } + } + }); +} +function selectionHasNonreactiveDirective(selection) { + return (!!selection.directives && selection.directives.some(directiveIsNonreactive)); +} +function directiveIsNonreactive(dir) { + return dir.name.value === "nonreactive"; +} + +var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty; +var ObservableQuery = (function (_super) { + tslib.__extends(ObservableQuery, _super); + function ObservableQuery(_a) { + var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options; + var _this = _super.call(this, function (observer) { + try { + var subObserver = observer._subscription._observer; + if (subObserver && !subObserver.error) { + subObserver.error = defaultSubscriptionObserverErrorCallback; + } + } + catch (_a) { } + var first = !_this.observers.size; + _this.observers.add(observer); + var last = _this.last; + if (last && last.error) { + observer.error && observer.error(last.error); + } + else if (last && last.result) { + observer.next && observer.next(last.result); + } + if (first) { + _this.reobserve().catch(function () { }); + } + return function () { + if (_this.observers.delete(observer) && !_this.observers.size) { + _this.tearDownQuery(); + } + }; + }) || this; + _this.observers = new Set(); + _this.subscriptions = new Set(); + _this.queryInfo = queryInfo; + _this.queryManager = queryManager; + _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy); + _this.isTornDown = false; + var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d; + var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, + _f = options.initialFetchPolicy, + initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f; + _this.options = tslib.__assign(tslib.__assign({}, options), { + initialFetchPolicy: initialFetchPolicy, + fetchPolicy: fetchPolicy }); + _this.queryId = queryInfo.queryId || queryManager.generateQueryId(); + var opDef = utilities.getOperationDefinition(_this.query); + _this.queryName = opDef && opDef.name && opDef.name.value; + return _this; + } + Object.defineProperty(ObservableQuery.prototype, "query", { + get: function () { + return this.lastQuery || this.options.query; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservableQuery.prototype, "variables", { + get: function () { + return this.options.variables; + }, + enumerable: false, + configurable: true + }); + ObservableQuery.prototype.result = function () { + var _this = this; + return new Promise(function (resolve, reject) { + var observer = { + next: function (result) { + resolve(result); + _this.observers.delete(observer); + if (!_this.observers.size) { + _this.queryManager.removeQuery(_this.queryId); + } + setTimeout(function () { + subscription.unsubscribe(); + }, 0); + }, + error: reject, + }; + var subscription = _this.subscribe(observer); + }); + }; + ObservableQuery.prototype.resetDiff = function () { + this.queryInfo.resetDiff(); + }; + ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) { + if (saveAsLastResult === void 0) { saveAsLastResult = true; } + var lastResult = this.getLastResult(true); + var networkStatus = this.queryInfo.networkStatus || + (lastResult && lastResult.networkStatus) || + exports.NetworkStatus.ready; + var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }); + var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a; + if ( + skipCacheDataFor(fetchPolicy) || + this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ; + else if (this.waitForOwnResult) { + this.queryInfo["updateWatch"](); + } + else { + var diff = this.queryInfo.getDiff(); + if (diff.complete || this.options.returnPartialData) { + result.data = diff.result; + } + if (equal.equal(result.data, {})) { + result.data = void 0; + } + if (diff.complete) { + delete result.partial; + if (diff.complete && + result.networkStatus === exports.NetworkStatus.loading && + (fetchPolicy === "cache-first" || fetchPolicy === "cache-only")) { + result.networkStatus = exports.NetworkStatus.ready; + result.loading = false; + } + } + else { + result.partial = true; + } + if (globalThis.__DEV__ !== false && + !diff.complete && + !this.options.partialRefetch && + !result.loading && + !result.data && + !result.error) { + logMissingFieldErrors(diff.missing); + } + } + if (saveAsLastResult) { + this.updateLastResult(result); + } + return result; + }; + ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) { + if (!this.last) { + return true; + } + var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ? + !equalByQuery(this.query, this.last.result, newResult, this.variables) + : !equal.equal(this.last.result, newResult); + return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables))); + }; + ObservableQuery.prototype.getLast = function (key, variablesMustMatch) { + var last = this.last; + if (last && + last[key] && + (!variablesMustMatch || equal.equal(last.variables, this.variables))) { + return last[key]; + } + }; + ObservableQuery.prototype.getLastResult = function (variablesMustMatch) { + return this.getLast("result", variablesMustMatch); + }; + ObservableQuery.prototype.getLastError = function (variablesMustMatch) { + return this.getLast("error", variablesMustMatch); + }; + ObservableQuery.prototype.resetLastResults = function () { + delete this.last; + this.isTornDown = false; + }; + ObservableQuery.prototype.resetQueryStoreErrors = function () { + this.queryManager.resetErrors(this.queryId); + }; + ObservableQuery.prototype.refetch = function (variables) { + var _a; + var reobserveOptions = { + pollInterval: 0, + }; + var fetchPolicy = this.options.fetchPolicy; + if (fetchPolicy === "cache-and-network") { + reobserveOptions.fetchPolicy = fetchPolicy; + } + else if (fetchPolicy === "no-cache") { + reobserveOptions.fetchPolicy = "no-cache"; + } + else { + reobserveOptions.fetchPolicy = "network-only"; + } + if (globalThis.__DEV__ !== false && variables && hasOwnProperty$1.call(variables, "variables")) { + var queryDef = utilities.getQueryDefinition(this.query); + var vars = queryDef.variableDefinitions; + if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) { + globalThis.__DEV__ !== false && globals.invariant.warn( + 20, + variables, + ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef + ); + } + } + if (variables && !equal.equal(this.options.variables, variables)) { + reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables); + } + this.queryInfo.resetLastWrite(); + return this.reobserve(reobserveOptions, exports.NetworkStatus.refetch); + }; + ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { + var _this = this; + var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) })))), { + fetchPolicy: "no-cache" }); + combinedOptions.query = this.transformDocument(combinedOptions.query); + var qid = this.queryManager.generateQueryId(); + this.lastQuery = + fetchMoreOptions.query ? + this.transformDocument(this.options.query) + : combinedOptions.query; + var queryInfo = this.queryInfo; + var originalNetworkStatus = queryInfo.networkStatus; + queryInfo.networkStatus = exports.NetworkStatus.fetchMore; + if (combinedOptions.notifyOnNetworkStatusChange) { + this.observe(); + } + var updatedQuerySet = new Set(); + return this.queryManager + .fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore) + .then(function (fetchMoreResult) { + _this.queryManager.removeQuery(qid); + if (queryInfo.networkStatus === exports.NetworkStatus.fetchMore) { + queryInfo.networkStatus = originalNetworkStatus; + } + _this.queryManager.cache.batch({ + update: function (cache) { + var updateQuery = fetchMoreOptions.updateQuery; + if (updateQuery) { + cache.updateQuery({ + query: _this.query, + variables: _this.variables, + returnPartialData: true, + optimistic: false, + }, function (previous) { + return updateQuery(previous, { + fetchMoreResult: fetchMoreResult.data, + variables: combinedOptions.variables, + }); + }); + } + else { + cache.writeQuery({ + query: combinedOptions.query, + variables: combinedOptions.variables, + data: fetchMoreResult.data, + }); + } + }, + onWatchUpdated: function (watch) { + updatedQuerySet.add(watch.query); + }, + }); + return fetchMoreResult; + }) + .finally(function () { + if (!updatedQuerySet.has(_this.query)) { + reobserveCacheFirst(_this); + } + }); + }; + ObservableQuery.prototype.subscribeToMore = function (options) { + var _this = this; + var subscription = this.queryManager + .startGraphQLSubscription({ + query: options.document, + variables: options.variables, + context: options.context, + }) + .subscribe({ + next: function (subscriptionData) { + var updateQuery = options.updateQuery; + if (updateQuery) { + _this.updateQuery(function (previous, _a) { + var variables = _a.variables; + return updateQuery(previous, { + subscriptionData: subscriptionData, + variables: variables, + }); + }); + } + }, + error: function (err) { + if (options.onError) { + options.onError(err); + return; + } + globalThis.__DEV__ !== false && globals.invariant.error(21, err); + }, + }); + this.subscriptions.add(subscription); + return function () { + if (_this.subscriptions.delete(subscription)) { + subscription.unsubscribe(); + } + }; + }; + ObservableQuery.prototype.setOptions = function (newOptions) { + return this.reobserve(newOptions); + }; + ObservableQuery.prototype.silentSetOptions = function (newOptions) { + var mergedOptions = utilities.compact(this.options, newOptions || {}); + assign(this.options, mergedOptions); + }; + ObservableQuery.prototype.setVariables = function (variables) { + if (equal.equal(this.variables, variables)) { + return this.observers.size ? this.result() : Promise.resolve(); + } + this.options.variables = variables; + if (!this.observers.size) { + return Promise.resolve(); + } + return this.reobserve({ + fetchPolicy: this.options.initialFetchPolicy, + variables: variables, + }, exports.NetworkStatus.setVariables); + }; + ObservableQuery.prototype.updateQuery = function (mapFn) { + var queryManager = this.queryManager; + var result = queryManager.cache.diff({ + query: this.options.query, + variables: this.variables, + returnPartialData: true, + optimistic: false, + }).result; + var newResult = mapFn(result, { + variables: this.variables, + }); + if (newResult) { + queryManager.cache.writeQuery({ + query: this.options.query, + data: newResult, + variables: this.variables, + }); + queryManager.broadcastQueries(); + } + }; + ObservableQuery.prototype.startPolling = function (pollInterval) { + this.options.pollInterval = pollInterval; + this.updatePolling(); + }; + ObservableQuery.prototype.stopPolling = function () { + this.options.pollInterval = 0; + this.updatePolling(); + }; + ObservableQuery.prototype.applyNextFetchPolicy = function (reason, + options) { + if (options.nextFetchPolicy) { + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b; + if (fetchPolicy === "standby") ; + else if (typeof options.nextFetchPolicy === "function") { + options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, { + reason: reason, + options: options, + observable: this, + initialFetchPolicy: initialFetchPolicy, + }); + } + else if (reason === "variables-changed") { + options.fetchPolicy = initialFetchPolicy; + } + else { + options.fetchPolicy = options.nextFetchPolicy; + } + } + return options.fetchPolicy; + }; + ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) { + this.queryManager.setObservableQuery(this); + return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query); + }; + ObservableQuery.prototype.updatePolling = function () { + var _this = this; + if (this.queryManager.ssrMode) { + return; + } + var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval; + if (!pollInterval) { + if (pollingInfo) { + clearTimeout(pollingInfo.timeout); + delete this.pollingInfo; + } + return; + } + if (pollingInfo && pollingInfo.interval === pollInterval) { + return; + } + globals.invariant(pollInterval, 22); + var info = pollingInfo || (this.pollingInfo = {}); + info.interval = pollInterval; + var maybeFetch = function () { + var _a, _b; + if (_this.pollingInfo) { + if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) && + !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) { + _this.reobserve({ + fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ? + "no-cache" + : "network-only", + }, exports.NetworkStatus.poll).then(poll, poll); + } + else { + poll(); + } + } + }; + var poll = function () { + var info = _this.pollingInfo; + if (info) { + clearTimeout(info.timeout); + info.timeout = setTimeout(maybeFetch, info.interval); + } + }; + poll(); + }; + ObservableQuery.prototype.updateLastResult = function (newResult, variables) { + if (variables === void 0) { variables = this.variables; } + var error = this.getLastError(); + if (error && this.last && !equal.equal(variables, this.last.variables)) { + error = void 0; + } + return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults ? + newResult + : utilities.cloneDeep(newResult), variables: variables }, (error ? { error: error } : null))); + }; + ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) { + var _this = this; + this.isTornDown = false; + var useDisposableConcast = + newNetworkStatus === exports.NetworkStatus.refetch || + newNetworkStatus === exports.NetworkStatus.fetchMore || + newNetworkStatus === exports.NetworkStatus.poll; + var oldVariables = this.options.variables; + var oldFetchPolicy = this.options.fetchPolicy; + var mergedOptions = utilities.compact(this.options, newOptions || {}); + var options = useDisposableConcast ? + mergedOptions + : assign(this.options, mergedOptions); + var query = this.transformDocument(options.query); + this.lastQuery = query; + if (!useDisposableConcast) { + this.updatePolling(); + if (newOptions && + newOptions.variables && + !equal.equal(newOptions.variables, oldVariables) && + options.fetchPolicy !== "standby" && + options.fetchPolicy === oldFetchPolicy) { + this.applyNextFetchPolicy("variables-changed", options); + if (newNetworkStatus === void 0) { + newNetworkStatus = exports.NetworkStatus.setVariables; + } + } + } + this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy)); + var finishWaitingForOwnResult = function () { + if (_this.concast === concast) { + _this.waitForOwnResult = false; + } + }; + var variables = options.variables && tslib.__assign({}, options.variables); + var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink; + var observer = { + next: function (result) { + if (equal.equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportResult(result, variables); + } + }, + error: function (error) { + if (equal.equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportError(error, variables); + } + }, + }; + if (!useDisposableConcast && (fromLink || !this.concast)) { + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + } + this.concast = concast; + this.observer = observer; + } + concast.addObserver(observer); + return concast; + }; + ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) { + return this.reobserveAsConcast(newOptions, newNetworkStatus) + .promise; + }; + ObservableQuery.prototype.resubscribeAfterError = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var last = this.last; + this.resetLastResults(); + var subscription = this.subscribe.apply(this, args); + this.last = last; + return subscription; + }; + ObservableQuery.prototype.observe = function () { + this.reportResult( + this.getCurrentResult(false), this.variables); + }; + ObservableQuery.prototype.reportResult = function (result, variables) { + var lastError = this.getLastError(); + var isDifferent = this.isDifferentFromLastResult(result, variables); + if (lastError || !result.partial || this.options.returnPartialData) { + this.updateLastResult(result, variables); + } + if (lastError || isDifferent) { + utilities.iterateObserversSafely(this.observers, "next", result); + } + }; + ObservableQuery.prototype.reportError = function (error, variables) { + var errorResult = tslib.__assign(tslib.__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false }); + this.updateLastResult(errorResult, variables); + utilities.iterateObserversSafely(this.observers, "error", (this.last.error = error)); + }; + ObservableQuery.prototype.hasObservers = function () { + return this.observers.size > 0; + }; + ObservableQuery.prototype.tearDownQuery = function () { + if (this.isTornDown) + return; + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + delete this.concast; + delete this.observer; + } + this.stopPolling(); + this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); + this.subscriptions.clear(); + this.queryManager.stopQuery(this.queryId); + this.observers.clear(); + this.isTornDown = true; + }; + ObservableQuery.prototype.transformDocument = function (document) { + return this.queryManager.transform(document); + }; + return ObservableQuery; +}(utilities.Observable)); +utilities.fixObservableSubclass(ObservableQuery); +function reobserveCacheFirst(obsQuery) { + var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy; + if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") { + return obsQuery.reobserve({ + fetchPolicy: "cache-first", + nextFetchPolicy: function (currentFetchPolicy, context) { + this.nextFetchPolicy = nextFetchPolicy; + if (typeof this.nextFetchPolicy === "function") { + return this.nextFetchPolicy(currentFetchPolicy, context); + } + return fetchPolicy; + }, + }); + } + return obsQuery.reobserve(); +} +function defaultSubscriptionObserverErrorCallback(error) { + globalThis.__DEV__ !== false && globals.invariant.error(23, error.message, error.stack); +} +function logMissingFieldErrors(missing) { + if (globalThis.__DEV__ !== false && missing) { + globalThis.__DEV__ !== false && globals.invariant.debug(24, missing); + } +} +function skipCacheDataFor(fetchPolicy ) { + return (fetchPolicy === "network-only" || + fetchPolicy === "no-cache" || + fetchPolicy === "standby"); +} + +var LocalState = (function () { + function LocalState(_a) { + var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; + this.selectionsToResolveCache = new WeakMap(); + this.cache = cache; + if (client) { + this.client = client; + } + if (resolvers) { + this.addResolvers(resolvers); + } + if (fragmentMatcher) { + this.setFragmentMatcher(fragmentMatcher); + } + } + LocalState.prototype.addResolvers = function (resolvers) { + var _this = this; + this.resolvers = this.resolvers || {}; + if (Array.isArray(resolvers)) { + resolvers.forEach(function (resolverGroup) { + _this.resolvers = utilities.mergeDeep(_this.resolvers, resolverGroup); + }); + } + else { + this.resolvers = utilities.mergeDeep(this.resolvers, resolvers); + } + }; + LocalState.prototype.setResolvers = function (resolvers) { + this.resolvers = {}; + this.addResolvers(resolvers); + }; + LocalState.prototype.getResolvers = function () { + return this.resolvers || {}; + }; + LocalState.prototype.runResolvers = function (_a) { + var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_c) { + if (document) { + return [2 , this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })]; + } + return [2 , remoteResult]; + }); + }); + }; + LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { + this.fragmentMatcher = fragmentMatcher; + }; + LocalState.prototype.getFragmentMatcher = function () { + return this.fragmentMatcher; + }; + LocalState.prototype.clientQuery = function (document) { + if (utilities.hasDirectives(["client"], document)) { + if (this.resolvers) { + return document; + } + } + return null; + }; + LocalState.prototype.serverQuery = function (document) { + return utilities.removeClientSetsFromDocument(document); + }; + LocalState.prototype.prepareContext = function (context) { + var cache = this.cache; + return tslib.__assign(tslib.__assign({}, context), { cache: cache, + getCacheKey: function (obj) { + return cache.identify(obj); + } }); + }; + LocalState.prototype.addExportedVariables = function (document, variables, context) { + if (variables === void 0) { variables = {}; } + if (context === void 0) { context = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + if (document) { + return [2 , this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })]; + } + return [2 , tslib.__assign({}, variables)]; + }); + }); + }; + LocalState.prototype.shouldForceResolvers = function (document) { + var forceResolvers = false; + graphql.visit(document, { + Directive: { + enter: function (node) { + if (node.name.value === "client" && node.arguments) { + forceResolvers = node.arguments.some(function (arg) { + return arg.name.value === "always" && + arg.value.kind === "BooleanValue" && + arg.value.value === true; + }); + if (forceResolvers) { + return graphql.BREAK; + } + } + }, + }, + }); + return forceResolvers; + }; + LocalState.prototype.buildRootValueFromCache = function (document, variables) { + return this.cache.diff({ + query: utilities.buildQueryFromSelectionSet(document), + variables: variables, + returnPartialData: true, + optimistic: false, + }).result; + }; + LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { + if (context === void 0) { context = {}; } + if (variables === void 0) { variables = {}; } + if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } + if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } + return tslib.__awaiter(this, void 0, void 0, function () { + var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant; + return tslib.__generator(this, function (_b) { + mainDefinition = utilities.getMainDefinition(document); + fragments = utilities.getFragmentDefinitions(document); + fragmentMap = utilities.createFragmentMap(fragments); + selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap); + definitionOperation = mainDefinition.operation; + defaultOperationType = definitionOperation ? + definitionOperation.charAt(0).toUpperCase() + + definitionOperation.slice(1) + : "Query"; + _a = this, cache = _a.cache, client = _a.client; + execContext = { + fragmentMap: fragmentMap, + context: tslib.__assign(tslib.__assign({}, context), { cache: cache, client: client }), + variables: variables, + fragmentMatcher: fragmentMatcher, + defaultOperationType: defaultOperationType, + exportedVariables: {}, + selectionsToResolve: selectionsToResolve, + onlyRunForcedResolvers: onlyRunForcedResolvers, + }; + isClientFieldDescendant = false; + return [2 , this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({ + result: result, + exportedVariables: execContext.exportedVariables, + }); })]; + }); + }); + }; + LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var fragmentMap, context, variables, resultsToMerge, execute; + var _this = this; + return tslib.__generator(this, function (_a) { + fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; + resultsToMerge = [rootValue]; + execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () { + var fragment, typeCondition; + return tslib.__generator(this, function (_a) { + if (!isClientFieldDescendant && + !execContext.selectionsToResolve.has(selection)) { + return [2 ]; + } + if (!utilities.shouldInclude(selection, variables)) { + return [2 ]; + } + if (utilities.isField(selection)) { + return [2 , this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) { + var _a; + if (typeof fieldResult !== "undefined") { + resultsToMerge.push((_a = {}, + _a[utilities.resultKeyNameFromField(selection)] = fieldResult, + _a)); + } + })]; + } + if (utilities.isInlineFragment(selection)) { + fragment = selection; + } + else { + fragment = fragmentMap[selection.name.value]; + globals.invariant(fragment, 18, selection.name.value); + } + if (fragment && fragment.typeCondition) { + typeCondition = fragment.typeCondition.name.value; + if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { + return [2 , this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) { + resultsToMerge.push(fragmentResult); + })]; + } + } + return [2 ]; + }); + }); }; + return [2 , Promise.all(selectionSet.selections.map(execute)).then(function () { + return utilities.mergeDeepArray(resultsToMerge); + })]; + }); + }); + }; + LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; + var _this = this; + return tslib.__generator(this, function (_a) { + if (!rootValue) { + return [2 , null]; + } + variables = execContext.variables; + fieldName = field.name.value; + aliasedFieldName = utilities.resultKeyNameFromField(field); + aliasUsed = fieldName !== aliasedFieldName; + defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; + resultPromise = Promise.resolve(defaultResult); + if (!execContext.onlyRunForcedResolvers || + this.shouldForceResolvers(field)) { + resolverType = rootValue.__typename || execContext.defaultOperationType; + resolverMap = this.resolvers && this.resolvers[resolverType]; + if (resolverMap) { + resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; + if (resolve) { + resultPromise = Promise.resolve( + cache.cacheSlot.withValue(this.cache, resolve, [ + rootValue, + utilities.argumentsObjectFromField(field, variables), + execContext.context, + { field: field, fragmentMap: execContext.fragmentMap }, + ])); + } + } + } + return [2 , resultPromise.then(function (result) { + var _a, _b; + if (result === void 0) { result = defaultResult; } + if (field.directives) { + field.directives.forEach(function (directive) { + if (directive.name.value === "export" && directive.arguments) { + directive.arguments.forEach(function (arg) { + if (arg.name.value === "as" && arg.value.kind === "StringValue") { + execContext.exportedVariables[arg.value.value] = result; + } + }); + } + }); + } + if (!field.selectionSet) { + return result; + } + if (result == null) { + return result; + } + var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === "client"; })) !== null && _b !== void 0 ? _b : false; + if (Array.isArray(result)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext); + } + })]; + }); + }); + }; + LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) { + var _this = this; + return Promise.all(result.map(function (item) { + if (item === null) { + return null; + } + if (Array.isArray(item)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext); + } + })); + }; + LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) { + var isSingleASTNode = function (node) { return !Array.isArray(node); }; + var selectionsToResolveCache = this.selectionsToResolveCache; + function collectByDefinition(definitionNode) { + if (!selectionsToResolveCache.has(definitionNode)) { + var matches_1 = new Set(); + selectionsToResolveCache.set(definitionNode, matches_1); + graphql.visit(definitionNode, { + Directive: function (node, _, __, ___, ancestors) { + if (node.name.value === "client") { + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && graphql.isSelectionNode(node)) { + matches_1.add(node); + } + }); + } + }, + FragmentSpread: function (spread, _, __, ___, ancestors) { + var fragment = fragmentMap[spread.name.value]; + globals.invariant(fragment, 19, spread.name.value); + var fragmentSelections = collectByDefinition(fragment); + if (fragmentSelections.size > 0) { + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && graphql.isSelectionNode(node)) { + matches_1.add(node); + } + }); + matches_1.add(spread); + fragmentSelections.forEach(function (selection) { + matches_1.add(selection); + }); + } + }, + }); + } + return selectionsToResolveCache.get(definitionNode); + } + return collectByDefinition(mainDefinition); + }; + return LocalState; +}()); + +var destructiveMethodCounts = new (utilities.canUseWeakMap ? WeakMap : Map)(); +function wrapDestructiveCacheMethod(cache, methodName) { + var original = cache[methodName]; + if (typeof original === "function") { + cache[methodName] = function () { + destructiveMethodCounts.set(cache, + (destructiveMethodCounts.get(cache) + 1) % 1e15); + return original.apply(this, arguments); + }; + } +} +function cancelNotifyTimeout(info) { + if (info["notifyTimeout"]) { + clearTimeout(info["notifyTimeout"]); + info["notifyTimeout"] = void 0; + } +} +var QueryInfo = (function () { + function QueryInfo(queryManager, queryId) { + if (queryId === void 0) { queryId = queryManager.generateQueryId(); } + this.queryId = queryId; + this.listeners = new Set(); + this.document = null; + this.lastRequestId = 1; + this.stopped = false; + this.dirty = false; + this.observableQuery = null; + var cache = (this.cache = queryManager.cache); + if (!destructiveMethodCounts.has(cache)) { + destructiveMethodCounts.set(cache, 0); + wrapDestructiveCacheMethod(cache, "evict"); + wrapDestructiveCacheMethod(cache, "modify"); + wrapDestructiveCacheMethod(cache, "reset"); + } + } + QueryInfo.prototype.init = function (query) { + var networkStatus = query.networkStatus || exports.NetworkStatus.loading; + if (this.variables && + this.networkStatus !== exports.NetworkStatus.loading && + !equal.equal(this.variables, query.variables)) { + networkStatus = exports.NetworkStatus.setVariables; + } + if (!equal.equal(query.variables, this.variables)) { + this.lastDiff = void 0; + } + Object.assign(this, { + document: query.document, + variables: query.variables, + networkError: null, + graphQLErrors: this.graphQLErrors || [], + networkStatus: networkStatus, + }); + if (query.observableQuery) { + this.setObservableQuery(query.observableQuery); + } + if (query.lastRequestId) { + this.lastRequestId = query.lastRequestId; + } + return this; + }; + QueryInfo.prototype.reset = function () { + cancelNotifyTimeout(this); + this.dirty = false; + }; + QueryInfo.prototype.resetDiff = function () { + this.lastDiff = void 0; + }; + QueryInfo.prototype.getDiff = function () { + var options = this.getDiffOptions(); + if (this.lastDiff && equal.equal(options, this.lastDiff.options)) { + return this.lastDiff.diff; + } + this.updateWatch(this.variables); + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return { complete: false }; + } + var diff = this.cache.diff(options); + this.updateLastDiff(diff, options); + return diff; + }; + QueryInfo.prototype.updateLastDiff = function (diff, options) { + this.lastDiff = + diff ? + { + diff: diff, + options: options || this.getDiffOptions(), + } + : void 0; + }; + QueryInfo.prototype.getDiffOptions = function (variables) { + var _a; + if (variables === void 0) { variables = this.variables; } + return { + query: this.document, + variables: variables, + returnPartialData: true, + optimistic: true, + canonizeResults: (_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.canonizeResults, + }; + }; + QueryInfo.prototype.setDiff = function (diff) { + var _this = this; + var _a; + var oldDiff = this.lastDiff && this.lastDiff.diff; + if (diff && + !diff.complete && + !((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.returnPartialData) && + !(oldDiff && oldDiff.complete)) { + return; + } + this.updateLastDiff(diff); + if (!this.dirty && !equal.equal(oldDiff && oldDiff.result, diff && diff.result)) { + this.dirty = true; + if (!this.notifyTimeout) { + this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0); + } + } + }; + QueryInfo.prototype.setObservableQuery = function (oq) { + var _this = this; + if (oq === this.observableQuery) + return; + if (this.oqListener) { + this.listeners.delete(this.oqListener); + } + this.observableQuery = oq; + if (oq) { + oq["queryInfo"] = this; + this.listeners.add((this.oqListener = function () { + var diff = _this.getDiff(); + if (diff.fromOptimisticTransaction) { + oq["observe"](); + } + else { + reobserveCacheFirst(oq); + } + })); + } + else { + delete this.oqListener; + } + }; + QueryInfo.prototype.notify = function () { + var _this = this; + cancelNotifyTimeout(this); + if (this.shouldNotify()) { + this.listeners.forEach(function (listener) { return listener(_this); }); + } + this.dirty = false; + }; + QueryInfo.prototype.shouldNotify = function () { + if (!this.dirty || !this.listeners.size) { + return false; + } + if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) { + var fetchPolicy = this.observableQuery.options.fetchPolicy; + if (fetchPolicy !== "cache-only" && fetchPolicy !== "cache-and-network") { + return false; + } + } + return true; + }; + QueryInfo.prototype.stop = function () { + if (!this.stopped) { + this.stopped = true; + this.reset(); + this.cancel(); + this.cancel = QueryInfo.prototype.cancel; + var oq = this.observableQuery; + if (oq) + oq.stopPolling(); + } + }; + QueryInfo.prototype.cancel = function () { }; + QueryInfo.prototype.updateWatch = function (variables) { + var _this = this; + if (variables === void 0) { variables = this.variables; } + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return; + } + var watchOptions = tslib.__assign(tslib.__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } }); + if (!this.lastWatch || !equal.equal(watchOptions, this.lastWatch)) { + this.cancel(); + this.cancel = this.cache.watch((this.lastWatch = watchOptions)); + } + }; + QueryInfo.prototype.resetLastWrite = function () { + this.lastWrite = void 0; + }; + QueryInfo.prototype.shouldWrite = function (result, variables) { + var lastWrite = this.lastWrite; + return !(lastWrite && + lastWrite.dmCount === destructiveMethodCounts.get(this.cache) && + equal.equal(variables, lastWrite.variables) && + equal.equal(result.data, lastWrite.result.data)); + }; + QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) { + var _this = this; + var merger = new utilities.DeepMerger(); + var graphQLErrors = utilities.isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + this.reset(); + if ("incremental" in result && utilities.isNonEmptyArray(result.incremental)) { + var mergedData = utilities.mergeIncrementalData(this.getDiff().result, result); + result.data = mergedData; + } + else if ("hasNext" in result && result.hasNext) { + var diff = this.getDiff(); + result.data = merger.merge(diff.result, result.data); + } + this.graphQLErrors = graphQLErrors; + if (options.fetchPolicy === "no-cache") { + this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables)); + } + else if (cacheWriteBehavior !== 0 ) { + if (shouldWriteResult(result, options.errorPolicy)) { + this.cache.performTransaction(function (cache) { + if (_this.shouldWrite(result, options.variables)) { + cache.writeQuery({ + query: document, + data: result.data, + variables: options.variables, + overwrite: cacheWriteBehavior === 1 , + }); + _this.lastWrite = { + result: result, + variables: options.variables, + dmCount: destructiveMethodCounts.get(_this.cache), + }; + } + else { + if (_this.lastDiff && _this.lastDiff.diff.complete) { + result.data = _this.lastDiff.diff.result; + return; + } + } + var diffOptions = _this.getDiffOptions(options.variables); + var diff = cache.diff(diffOptions); + if (!_this.stopped && equal.equal(_this.variables, options.variables)) { + _this.updateWatch(options.variables); + } + _this.updateLastDiff(diff, diffOptions); + if (diff.complete) { + result.data = diff.result; + } + }); + } + else { + this.lastWrite = void 0; + } + } + }; + QueryInfo.prototype.markReady = function () { + this.networkError = null; + return (this.networkStatus = exports.NetworkStatus.ready); + }; + QueryInfo.prototype.markError = function (error) { + this.networkStatus = exports.NetworkStatus.error; + this.lastWrite = void 0; + this.reset(); + if (error.graphQLErrors) { + this.graphQLErrors = error.graphQLErrors; + } + if (error.networkError) { + this.networkError = error.networkError; + } + return error; + }; + return QueryInfo; +}()); +function shouldWriteResult(result, errorPolicy) { + if (errorPolicy === void 0) { errorPolicy = "none"; } + var ignoreErrors = errorPolicy === "ignore" || errorPolicy === "all"; + var writeWithErrors = !utilities.graphQLResultHasError(result); + if (!writeWithErrors && ignoreErrors && result.data) { + writeWithErrors = true; + } + return writeWithErrors; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +var IGNORE = Object.create(null); +var QueryManager = (function () { + function QueryManager(_a) { + var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext; + var _this = this; + this.clientAwareness = {}; + this.queries = new Map(); + this.fetchCancelFns = new Map(); + this.transformCache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes["queryManager.getDocumentInfo"] || + 2000 ); + this.queryIdCounter = 1; + this.requestIdCounter = 1; + this.mutationIdCounter = 1; + this.inFlightLinkObservables = new trie.Trie(false); + var defaultDocumentTransform = new utilities.DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, + { cache: false }); + this.cache = cache; + this.link = link; + this.defaultOptions = defaultOptions || Object.create(null); + this.queryDeduplication = queryDeduplication; + this.clientAwareness = clientAwareness; + this.localState = localState || new LocalState({ cache: cache }); + this.ssrMode = ssrMode; + this.assumeImmutableResults = assumeImmutableResults; + this.documentTransform = + documentTransform ? + defaultDocumentTransform + .concat(documentTransform) + .concat(defaultDocumentTransform) + : defaultDocumentTransform; + this.defaultContext = defaultContext || Object.create(null); + if ((this.onBroadcast = onBroadcast)) { + this.mutationStore = Object.create(null); + } + } + QueryManager.prototype.stop = function () { + var _this = this; + this.queries.forEach(function (_info, queryId) { + _this.stopQueryNoBroadcast(queryId); + }); + this.cancelPendingFetches(globals.newInvariantError(25)); + }; + QueryManager.prototype.cancelPendingFetches = function (error) { + this.fetchCancelFns.forEach(function (cancel) { return cancel(error); }); + this.fetchCancelFns.clear(); + }; + QueryManager.prototype.mutate = function (_a) { + var _b, _c; + var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || "network-only" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || "none" : _g, keepRootFields = _a.keepRootFields, context = _a.context; + return tslib.__awaiter(this, void 0, void 0, function () { + var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self; + return tslib.__generator(this, function (_h) { + switch (_h.label) { + case 0: + globals.invariant(mutation, 26); + globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27); + mutationId = this.generateMutationId(); + mutation = this.cache.transformForLink(this.transform(mutation)); + hasClientExports = this.getDocumentInfo(mutation).hasClientExports; + variables = this.getVariables(mutation, variables); + if (!hasClientExports) return [3 , 2]; + return [4 , this.localState.addExportedVariables(mutation, variables, context)]; + case 1: + variables = (_h.sent()); + _h.label = 2; + case 2: + mutationStoreValue = this.mutationStore && + (this.mutationStore[mutationId] = { + mutation: mutation, + variables: variables, + loading: true, + error: null, + }); + isOptimistic = optimisticResponse && + this.markMutationOptimistic(optimisticResponse, { + mutationId: mutationId, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + updateQueries: updateQueries, + update: updateWithProxyFn, + keepRootFields: keepRootFields, + }); + this.broadcastQueries(); + self = this; + return [2 , new Promise(function (resolve, reject) { + return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) { + if (utilities.graphQLResultHasError(result) && errorPolicy === "none") { + throw new errors.ApolloError({ + graphQLErrors: utilities.getGraphQLErrorsFromResult(result), + }); + } + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = null; + } + var storeResult = tslib.__assign({}, result); + if (typeof refetchQueries === "function") { + refetchQueries = refetchQueries(storeResult); + } + if (errorPolicy === "ignore" && utilities.graphQLResultHasError(storeResult)) { + delete storeResult.errors; + } + return self.markMutationResult({ + mutationId: mutationId, + result: storeResult, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + update: updateWithProxyFn, + updateQueries: updateQueries, + awaitRefetchQueries: awaitRefetchQueries, + refetchQueries: refetchQueries, + removeOptimistic: isOptimistic ? mutationId : void 0, + onQueryUpdated: onQueryUpdated, + keepRootFields: keepRootFields, + }); + }).subscribe({ + next: function (storeResult) { + self.broadcastQueries(); + if (!("hasNext" in storeResult) || storeResult.hasNext === false) { + resolve(storeResult); + } + }, + error: function (err) { + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = err; + } + if (isOptimistic) { + self.cache.removeOptimistic(mutationId); + } + self.broadcastQueries(); + reject(err instanceof errors.ApolloError ? err : (new errors.ApolloError({ + networkError: err, + }))); + }, + }); + })]; + } + }); + }); + }; + QueryManager.prototype.markMutationResult = function (mutation, cache) { + var _this = this; + if (cache === void 0) { cache = this.cache; } + var result = mutation.result; + var cacheWrites = []; + var skipCache = mutation.fetchPolicy === "no-cache"; + if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) { + if (!utilities.isExecutionPatchIncrementalResult(result)) { + cacheWrites.push({ + result: result.data, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + if (utilities.isExecutionPatchIncrementalResult(result) && + utilities.isNonEmptyArray(result.incremental)) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + query: this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + var mergedData = void 0; + if (diff.result) { + mergedData = mergeIncrementalData(diff.result, result); + } + if (typeof mergedData !== "undefined") { + result.data = mergedData; + cacheWrites.push({ + result: mergedData, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + } + var updateQueries_1 = mutation.updateQueries; + if (updateQueries_1) { + this.queries.forEach(function (_a, queryId) { + var observableQuery = _a.observableQuery; + var queryName = observableQuery && observableQuery.queryName; + if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) { + return; + } + var updater = updateQueries_1[queryName]; + var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables; + var _c = cache.diff({ + query: document, + variables: variables, + returnPartialData: true, + optimistic: false, + }), currentQueryResult = _c.result, complete = _c.complete; + if (complete && currentQueryResult) { + var nextQueryResult = updater(currentQueryResult, { + mutationResult: result, + queryName: (document && utilities.getOperationName(document)) || void 0, + queryVariables: variables, + }); + if (nextQueryResult) { + cacheWrites.push({ + result: nextQueryResult, + dataId: "ROOT_QUERY", + query: document, + variables: variables, + }); + } + } + }); + } + } + if (cacheWrites.length > 0 || + (mutation.refetchQueries || "").length > 0 || + mutation.update || + mutation.onQueryUpdated || + mutation.removeOptimistic) { + var results_1 = []; + this.refetchQueries({ + updateCache: function (cache) { + if (!skipCache) { + cacheWrites.forEach(function (write) { return cache.write(write); }); + } + var update = mutation.update; + var isFinalResult = !utilities.isExecutionPatchResult(result) || + (utilities.isExecutionPatchIncrementalResult(result) && !result.hasNext); + if (update) { + if (!skipCache) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + query: _this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + if (diff.complete) { + result = tslib.__assign(tslib.__assign({}, result), { data: diff.result }); + if ("incremental" in result) { + delete result.incremental; + } + if ("hasNext" in result) { + delete result.hasNext; + } + } + } + if (isFinalResult) { + update(cache, result, { + context: mutation.context, + variables: mutation.variables, + }); + } + } + if (!skipCache && !mutation.keepRootFields && isFinalResult) { + cache.modify({ + id: "ROOT_MUTATION", + fields: function (value, _a) { + var fieldName = _a.fieldName, DELETE = _a.DELETE; + return fieldName === "__typename" ? value : DELETE; + }, + }); + } + }, + include: mutation.refetchQueries, + optimistic: false, + removeOptimistic: mutation.removeOptimistic, + onQueryUpdated: mutation.onQueryUpdated || null, + }).forEach(function (result) { return results_1.push(result); }); + if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) { + return Promise.all(results_1).then(function () { return result; }); + } + } + return Promise.resolve(result); + }; + QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) { + var _this = this; + var data = typeof optimisticResponse === "function" ? + optimisticResponse(mutation.variables, { IGNORE: IGNORE }) + : optimisticResponse; + if (data === IGNORE) { + return false; + } + this.cache.recordOptimisticTransaction(function (cache) { + try { + _this.markMutationResult(tslib.__assign(tslib.__assign({}, mutation), { result: { data: data } }), cache); + } + catch (error) { + globalThis.__DEV__ !== false && globals.invariant.error(error); + } + }, mutation.mutationId); + return true; + }; + QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) { + return this.fetchConcastWithInfo(queryId, options, networkStatus).concast + .promise; + }; + QueryManager.prototype.getQueryStore = function () { + var store = Object.create(null); + this.queries.forEach(function (info, queryId) { + store[queryId] = { + variables: info.variables, + networkStatus: info.networkStatus, + networkError: info.networkError, + graphQLErrors: info.graphQLErrors, + }; + }); + return store; + }; + QueryManager.prototype.resetErrors = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) { + queryInfo.networkError = undefined; + queryInfo.graphQLErrors = []; + } + }; + QueryManager.prototype.transform = function (document) { + return this.documentTransform.transformDocument(document); + }; + QueryManager.prototype.getDocumentInfo = function (document) { + var transformCache = this.transformCache; + if (!transformCache.has(document)) { + var cacheEntry = { + hasClientExports: utilities.hasClientExports(document), + hasForcedResolvers: this.localState.shouldForceResolvers(document), + hasNonreactiveDirective: utilities.hasDirectives(["nonreactive"], document), + clientQuery: this.localState.clientQuery(document), + serverQuery: utilities.removeDirectivesFromDocument([ + { name: "client", remove: true }, + { name: "connection" }, + { name: "nonreactive" }, + ], document), + defaultVars: utilities.getDefaultValues(utilities.getOperationDefinition(document)), + asQuery: tslib.__assign(tslib.__assign({}, document), { definitions: document.definitions.map(function (def) { + if (def.kind === "OperationDefinition" && + def.operation !== "query") { + return tslib.__assign(tslib.__assign({}, def), { operation: "query" }); + } + return def; + }) }), + }; + transformCache.set(document, cacheEntry); + } + return transformCache.get(document); + }; + QueryManager.prototype.getVariables = function (document, variables) { + return tslib.__assign(tslib.__assign({}, this.getDocumentInfo(document).defaultVars), variables); + }; + QueryManager.prototype.watchQuery = function (options) { + var query = this.transform(options.query); + options = tslib.__assign(tslib.__assign({}, options), { variables: this.getVariables(query, options.variables) }); + if (typeof options.notifyOnNetworkStatusChange === "undefined") { + options.notifyOnNetworkStatusChange = false; + } + var queryInfo = new QueryInfo(this); + var observable = new ObservableQuery({ + queryManager: this, + queryInfo: queryInfo, + options: options, + }); + observable["lastQuery"] = query; + this.queries.set(observable.queryId, queryInfo); + queryInfo.init({ + document: query, + observableQuery: observable, + variables: observable.variables, + }); + return observable; + }; + QueryManager.prototype.query = function (options, queryId) { + var _this = this; + if (queryId === void 0) { queryId = this.generateQueryId(); } + globals.invariant(options.query, 28); + globals.invariant(options.query.kind === "Document", 29); + globals.invariant(!options.returnPartialData, 30); + globals.invariant(!options.pollInterval, 31); + return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); }); + }; + QueryManager.prototype.generateQueryId = function () { + return String(this.queryIdCounter++); + }; + QueryManager.prototype.generateRequestId = function () { + return this.requestIdCounter++; + }; + QueryManager.prototype.generateMutationId = function () { + return String(this.mutationIdCounter++); + }; + QueryManager.prototype.stopQueryInStore = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) + queryInfo.stop(); + }; + QueryManager.prototype.clearStore = function (options) { + if (options === void 0) { options = { + discardWatches: true, + }; } + this.cancelPendingFetches(globals.newInvariantError(32)); + this.queries.forEach(function (queryInfo) { + if (queryInfo.observableQuery) { + queryInfo.networkStatus = exports.NetworkStatus.loading; + } + else { + queryInfo.stop(); + } + }); + if (this.mutationStore) { + this.mutationStore = Object.create(null); + } + return this.cache.reset(options); + }; + QueryManager.prototype.getObservableQueries = function (include) { + var _this = this; + if (include === void 0) { include = "active"; } + var queries = new Map(); + var queryNamesAndDocs = new Map(); + var legacyQueryOptions = new Set(); + if (Array.isArray(include)) { + include.forEach(function (desc) { + if (typeof desc === "string") { + queryNamesAndDocs.set(desc, false); + } + else if (utilities.isDocumentNode(desc)) { + queryNamesAndDocs.set(_this.transform(desc), false); + } + else if (utilities.isNonNullObject(desc) && desc.query) { + legacyQueryOptions.add(desc); + } + }); + } + this.queries.forEach(function (_a, queryId) { + var oq = _a.observableQuery, document = _a.document; + if (oq) { + if (include === "all") { + queries.set(queryId, oq); + return; + } + var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy; + if (fetchPolicy === "standby" || + (include === "active" && !oq.hasObservers())) { + return; + } + if (include === "active" || + (queryName && queryNamesAndDocs.has(queryName)) || + (document && queryNamesAndDocs.has(document))) { + queries.set(queryId, oq); + if (queryName) + queryNamesAndDocs.set(queryName, true); + if (document) + queryNamesAndDocs.set(document, true); + } + } + }); + if (legacyQueryOptions.size) { + legacyQueryOptions.forEach(function (options) { + var queryId = utilities.makeUniqueId("legacyOneTimeQuery"); + var queryInfo = _this.getQuery(queryId).init({ + document: options.query, + variables: options.variables, + }); + var oq = new ObservableQuery({ + queryManager: _this, + queryInfo: queryInfo, + options: tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "network-only" }), + }); + globals.invariant(oq.queryId === queryId); + queryInfo.setObservableQuery(oq); + queries.set(queryId, oq); + }); + } + if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) { + queryNamesAndDocs.forEach(function (included, nameOrDoc) { + if (!included) { + globalThis.__DEV__ !== false && globals.invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc); + } + }); + } + return queries; + }; + QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { + var _this = this; + if (includeStandby === void 0) { includeStandby = false; } + var observableQueryPromises = []; + this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) { + var fetchPolicy = observableQuery.options.fetchPolicy; + observableQuery.resetLastResults(); + if (includeStandby || + (fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) { + observableQueryPromises.push(observableQuery.refetch()); + } + _this.getQuery(queryId).setDiff(null); + }); + this.broadcastQueries(); + return Promise.all(observableQueryPromises); + }; + QueryManager.prototype.setObservableQuery = function (observableQuery) { + this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); + }; + QueryManager.prototype.startGraphQLSubscription = function (_a) { + var _this = this; + var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c; + query = this.transform(query); + variables = this.getVariables(query, variables); + var makeObservable = function (variables) { + return _this.getObservableFromLink(query, context, variables).map(function (result) { + if (fetchPolicy !== "no-cache") { + if (shouldWriteResult(result, errorPolicy)) { + _this.cache.write({ + query: query, + result: result.data, + dataId: "ROOT_SUBSCRIPTION", + variables: variables, + }); + } + _this.broadcastQueries(); + } + var hasErrors = utilities.graphQLResultHasError(result); + var hasProtocolErrors = errors.graphQLResultHasProtocolErrors(result); + if (hasErrors || hasProtocolErrors) { + var errors$1 = {}; + if (hasErrors) { + errors$1.graphQLErrors = result.errors; + } + if (hasProtocolErrors) { + errors$1.protocolErrors = result.extensions[errors.PROTOCOL_ERRORS_SYMBOL]; + } + if (errorPolicy === "none" || hasProtocolErrors) { + throw new errors.ApolloError(errors$1); + } + } + if (errorPolicy === "ignore") { + delete result.errors; + } + return result; + }); + }; + if (this.getDocumentInfo(query).hasClientExports) { + var observablePromise_1 = this.localState + .addExportedVariables(query, variables, context) + .then(makeObservable); + return new utilities.Observable(function (observer) { + var sub = null; + observablePromise_1.then(function (observable) { return (sub = observable.subscribe(observer)); }, observer.error); + return function () { return sub && sub.unsubscribe(); }; + }); + } + return makeObservable(variables); + }; + QueryManager.prototype.stopQuery = function (queryId) { + this.stopQueryNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.removeQuery(queryId); + }; + QueryManager.prototype.removeQuery = function (queryId) { + this.fetchCancelFns.delete(queryId); + if (this.queries.has(queryId)) { + this.getQuery(queryId).stop(); + this.queries.delete(queryId); + } + }; + QueryManager.prototype.broadcastQueries = function () { + if (this.onBroadcast) + this.onBroadcast(); + this.queries.forEach(function (info) { return info.notify(); }); + }; + QueryManager.prototype.getLocalState = function () { + return this.localState; + }; + QueryManager.prototype.getObservableFromLink = function (query, context, variables, + deduplication) { + var _this = this; + var _a; + if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; } + var observable; + var _b = this.getDocumentInfo(query), serverQuery = _b.serverQuery, clientQuery = _b.clientQuery; + if (serverQuery) { + var _c = this, inFlightLinkObservables_1 = _c.inFlightLinkObservables, link = _c.link; + var operation = { + query: serverQuery, + variables: variables, + operationName: utilities.getOperationName(serverQuery) || void 0, + context: this.prepareContext(tslib.__assign(tslib.__assign({}, context), { forceFetch: !deduplication })), + }; + context = operation.context; + if (deduplication) { + var printedServerQuery_1 = utilities.print(serverQuery); + var varJson_1 = cache.canonicalStringify(variables); + var entry = inFlightLinkObservables_1.lookup(printedServerQuery_1, varJson_1); + observable = entry.observable; + if (!observable) { + var concast = new utilities.Concast([ + core.execute(link, operation), + ]); + observable = entry.observable = concast; + concast.beforeNext(function () { + inFlightLinkObservables_1.remove(printedServerQuery_1, varJson_1); + }); + } + } + else { + observable = new utilities.Concast([ + core.execute(link, operation), + ]); + } + } + else { + observable = new utilities.Concast([utilities.Observable.of({ data: {} })]); + context = this.prepareContext(context); + } + if (clientQuery) { + observable = utilities.asyncMap(observable, function (result) { + return _this.localState.runResolvers({ + document: clientQuery, + remoteResult: result, + context: context, + variables: variables, + }); + }); + } + return observable; + }; + QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) { + var requestId = (queryInfo.lastRequestId = this.generateRequestId()); + var linkDocument = this.cache.transformForLink(options.query); + return utilities.asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) { + var graphQLErrors = utilities.getGraphQLErrorsFromResult(result); + var hasErrors = graphQLErrors.length > 0; + if (requestId >= queryInfo.lastRequestId) { + if (hasErrors && options.errorPolicy === "none") { + throw queryInfo.markError(new errors.ApolloError({ + graphQLErrors: graphQLErrors, + })); + } + queryInfo.markResult(result, linkDocument, options, cacheWriteBehavior); + queryInfo.markReady(); + } + var aqr = { + data: result.data, + loading: false, + networkStatus: exports.NetworkStatus.ready, + }; + if (hasErrors && options.errorPolicy !== "ignore") { + aqr.errors = graphQLErrors; + aqr.networkStatus = exports.NetworkStatus.error; + } + return aqr; + }, function (networkError) { + var error = errors.isApolloError(networkError) ? networkError : (new errors.ApolloError({ networkError: networkError })); + if (requestId >= queryInfo.lastRequestId) { + queryInfo.markError(error); + } + throw error; + }); + }; + QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, + networkStatus, query) { + var _this = this; + if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; } + if (query === void 0) { query = options.query; } + var variables = this.getVariables(query, options.variables); + var queryInfo = this.getQuery(queryId); + var defaults = this.defaultOptions.watchQuery; + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e; + var normalized = Object.assign({}, options, { + query: query, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + returnPartialData: returnPartialData, + notifyOnNetworkStatusChange: notifyOnNetworkStatusChange, + context: context, + }); + var fromVariables = function (variables) { + normalized.variables = variables; + var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus); + if ( + normalized.fetchPolicy !== "standby" && + sourcesWithInfo.sources.length > 0 && + queryInfo.observableQuery) { + queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options); + } + return sourcesWithInfo; + }; + var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); }; + this.fetchCancelFns.set(queryId, function (reason) { + cleanupCancelFn(); + setTimeout(function () { return concast.cancel(reason); }); + }); + var concast, containsDataFromLink; + if (this.getDocumentInfo(normalized.query).hasClientExports) { + concast = new utilities.Concast(this.localState + .addExportedVariables(normalized.query, normalized.variables, normalized.context) + .then(fromVariables) + .then(function (sourcesWithInfo) { return sourcesWithInfo.sources; })); + containsDataFromLink = true; + } + else { + var sourcesWithInfo = fromVariables(normalized.variables); + containsDataFromLink = sourcesWithInfo.fromLink; + concast = new utilities.Concast(sourcesWithInfo.sources); + } + concast.promise.then(cleanupCancelFn, cleanupCancelFn); + return { + concast: concast, + fromLink: containsDataFromLink, + }; + }; + QueryManager.prototype.refetchQueries = function (_a) { + var _this = this; + var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? utilities.makeUniqueId("refetchQueries") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated; + var includedQueriesById = new Map(); + if (include) { + this.getObservableQueries(include).forEach(function (oq, queryId) { + includedQueriesById.set(queryId, { + oq: oq, + lastDiff: _this.getQuery(queryId).getDiff(), + }); + }); + } + var results = new Map(); + if (updateCache) { + this.cache.batch({ + update: updateCache, + optimistic: (optimistic && removeOptimistic) || false, + removeOptimistic: removeOptimistic, + onWatchUpdated: function (watch, diff, lastDiff) { + var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery; + if (oq) { + if (onQueryUpdated) { + includedQueriesById.delete(oq.queryId); + var result = onQueryUpdated(oq, diff, lastDiff); + if (result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + return result; + } + if (onQueryUpdated !== null) { + includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff }); + } + } + }, + }); + } + if (includedQueriesById.size) { + includedQueriesById.forEach(function (_a, queryId) { + var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff; + var result; + if (onQueryUpdated) { + if (!diff) { + var info = oq["queryInfo"]; + info.reset(); + diff = info.getDiff(); + } + result = onQueryUpdated(oq, diff, lastDiff); + } + if (!onQueryUpdated || result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + if (queryId.indexOf("legacyOneTimeQuery") >= 0) { + _this.stopQueryNoBroadcast(queryId); + } + }); + } + if (removeOptimistic) { + this.cache.removeOptimistic(removeOptimistic); + } + return results; + }; + QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, + networkStatus) { + var _this = this; + var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange; + var oldNetworkStatus = queryInfo.networkStatus; + queryInfo.init({ + document: query, + variables: variables, + networkStatus: networkStatus, + }); + var readCache = function () { return queryInfo.getDiff(); }; + var resultsFromCache = function (diff, networkStatus) { + if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || exports.NetworkStatus.loading; } + var data = diff.result; + if (globalThis.__DEV__ !== false && !returnPartialData && !equal.equal(data, {})) { + logMissingFieldErrors(diff.missing); + } + var fromData = function (data) { + return utilities.Observable.of(tslib.__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); + }; + if (data && _this.getDocumentInfo(query).hasForcedResolvers) { + return _this.localState + .runResolvers({ + document: query, + remoteResult: { data: data }, + context: context, + variables: variables, + onlyRunForcedResolvers: true, + }) + .then(function (resolved) { return fromData(resolved.data || void 0); }); + } + if (errorPolicy === "none" && + networkStatus === exports.NetworkStatus.refetch && + Array.isArray(diff.missing)) { + return fromData(void 0); + } + return fromData(data); + }; + var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 + : (networkStatus === exports.NetworkStatus.refetch && + refetchWritePolicy !== "merge") ? + 1 + : 2 ; + var resultsFromLink = function () { + return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, { + query: query, + variables: variables, + context: context, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + }); + }; + var shouldNotify = notifyOnNetworkStatusChange && + typeof oldNetworkStatus === "number" && + oldNetworkStatus !== networkStatus && + isNetworkRequestInFlight(networkStatus); + switch (fetchPolicy) { + default: + case "cache-first": { + var diff = readCache(); + if (diff.complete) { + return { + fromLink: false, + sources: [resultsFromCache(diff, queryInfo.markReady())], + }; + } + if (returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-and-network": { + var diff = readCache(); + if (diff.complete || returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-only": + return { + fromLink: false, + sources: [resultsFromCache(readCache(), queryInfo.markReady())], + }; + case "network-only": + if (shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(readCache()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "no-cache": + if (shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "standby": + return { fromLink: false, sources: [] }; + } + }; + QueryManager.prototype.getQuery = function (queryId) { + if (queryId && !this.queries.has(queryId)) { + this.queries.set(queryId, new QueryInfo(this, queryId)); + } + return this.queries.get(queryId); + }; + QueryManager.prototype.prepareContext = function (context) { + if (context === void 0) { context = {}; } + var newContext = this.localState.prepareContext(context); + return tslib.__assign(tslib.__assign(tslib.__assign({}, this.defaultContext), newContext), { clientAwareness: this.clientAwareness }); + }; + return QueryManager; +}()); + +var cacheSizeSymbol = Symbol.for("apollo.cacheSize"); +var cacheSizes = tslib.__assign({}, globals.global[cacheSizeSymbol]); + +var globalCaches = {}; +var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloClientMemoryInternals + : undefined; +function getCurrentCacheSizes() { + var defaults = { + parser: 1000 , + canonicalStringify: 1000 , + print: 2000 , + "documentTransform.cache": 2000 , + "queryManager.getDocumentInfo": 2000 , + "PersistedQueryLink.persistedQueryHashes": 2000 , + "fragmentRegistry.transform": 2000 , + "fragmentRegistry.lookup": 1000 , + "fragmentRegistry.findFragmentSpreads": 4000 , + "cache.fragmentQueryDocuments": 1000 , + "removeTypenameFromVariables.getVariableDefinitions": 2000 , + "inMemoryCache.maybeBroadcastWatch": 5000 , + "inMemoryCache.executeSelectionSet": 50000 , + "inMemoryCache.executeSubSelectedArray": 10000 , + }; + return Object.fromEntries(Object.entries(defaults).map(function (_a) { + var k = _a[0], v = _a[1]; + return [ + k, + cacheSizes[k] || v, + ]; + })); +} +function _getApolloClientMemoryInternals() { + var _a, _b, _c, _d, _e; + if (!(globalThis.__DEV__ !== false)) + throw new Error("only supported in development mode"); + return { + limits: getCurrentCacheSizes(), + sizes: tslib.__assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: { + getDocumentInfo: this["queryManager"]["transformCache"].size, + documentTransforms: transformInfo(this["queryManager"].documentTransform), + } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)), + }; +} +function isWrapper(f) { + return !!f && "dirtyKey" in f; +} +function getWrapperInformation(f) { + return isWrapper(f) ? f.size : undefined; +} +function isDefined(value) { + return value != null; +} +function transformInfo(transform) { + return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); }); +} +function recurseTransformInfo(transform) { + return transform ? + tslib.__spreadArray(tslib.__spreadArray([ + getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"]) + ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined) + : []; +} +function linkInfo(link) { + var _a; + return link ? + tslib.__spreadArray(tslib.__spreadArray([ + (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link) + ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined) + : []; +} + +var hasSuggestedDevtools = false; +var ApolloClient = (function () { + function ApolloClient(options) { + var _this = this; + this.resetStoreCallbacks = []; + this.clearStoreCallbacks = []; + if (!options.cache) { + throw globals.newInvariantError(15); + } + var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, + _c = options.connectToDevTools, + connectToDevTools = _c === void 0 ? typeof window === "object" && + !window.__APOLLO_CLIENT__ && + globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; + var link = options.link; + if (!link) { + link = + uri ? new http.HttpLink({ uri: uri, credentials: credentials, headers: headers }) : core.ApolloLink.empty(); + } + this.link = link; + this.cache = cache; + this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; + this.queryDeduplication = queryDeduplication; + this.defaultOptions = defaultOptions || Object.create(null); + this.typeDefs = typeDefs; + if (ssrForceFetchDelay) { + setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); + } + this.watchQuery = this.watchQuery.bind(this); + this.query = this.query.bind(this); + this.mutate = this.mutate.bind(this); + this.resetStore = this.resetStore.bind(this); + this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); + this.version = version; + this.localState = new LocalState({ + cache: cache, + client: this, + resolvers: resolvers, + fragmentMatcher: fragmentMatcher, + }); + this.queryManager = new QueryManager({ + cache: this.cache, + link: this.link, + defaultOptions: this.defaultOptions, + defaultContext: defaultContext, + documentTransform: documentTransform, + queryDeduplication: queryDeduplication, + ssrMode: ssrMode, + clientAwareness: { + name: clientAwarenessName, + version: clientAwarenessVersion, + }, + localState: this.localState, + assumeImmutableResults: assumeImmutableResults, + onBroadcast: connectToDevTools ? + function () { + if (_this.devToolsHookCb) { + _this.devToolsHookCb({ + action: {}, + state: { + queries: _this.queryManager.getQueryStore(), + mutations: _this.queryManager.mutationStore || {}, + }, + dataWithOptimisticResults: _this.cache.extract(true), + }); + } + } + : void 0, + }); + if (connectToDevTools) + this.connectToDevTools(); + } + ApolloClient.prototype.connectToDevTools = function () { + if (typeof window === "object") { + var windowWithDevTools = window; + var devtoolsSymbol = Symbol.for("apollo.devtools"); + (windowWithDevTools[devtoolsSymbol] = + windowWithDevTools[devtoolsSymbol] || []).push(this); + windowWithDevTools.__APOLLO_CLIENT__ = this; + } + if (!hasSuggestedDevtools && globalThis.__DEV__ !== false) { + hasSuggestedDevtools = true; + setTimeout(function () { + if (typeof window !== "undefined" && + window.document && + window.top === window.self && + !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) { + var nav = window.navigator; + var ua = nav && nav.userAgent; + var url = void 0; + if (typeof ua === "string") { + if (ua.indexOf("Chrome/") > -1) { + url = + "https://chrome.google.com/webstore/detail/" + + "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm"; + } + else if (ua.indexOf("Firefox/") > -1) { + url = + "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/"; + } + } + if (url) { + globalThis.__DEV__ !== false && globals.invariant.log("Download the Apollo DevTools for a better development " + + "experience: %s", url); + } + } + }, 10000); + } + }; + Object.defineProperty(ApolloClient.prototype, "documentTransform", { + get: function () { + return this.queryManager.documentTransform; + }, + enumerable: false, + configurable: true + }); + ApolloClient.prototype.stop = function () { + this.queryManager.stop(); + }; + ApolloClient.prototype.watchQuery = function (options) { + if (this.defaultOptions.watchQuery) { + options = utilities.mergeOptions(this.defaultOptions.watchQuery, options); + } + if (this.disableNetworkFetches && + (options.fetchPolicy === "network-only" || + options.fetchPolicy === "cache-and-network")) { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.watchQuery(options); + }; + ApolloClient.prototype.query = function (options) { + if (this.defaultOptions.query) { + options = utilities.mergeOptions(this.defaultOptions.query, options); + } + globals.invariant(options.fetchPolicy !== "cache-and-network", 16); + if (this.disableNetworkFetches && options.fetchPolicy === "network-only") { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.query(options); + }; + ApolloClient.prototype.mutate = function (options) { + if (this.defaultOptions.mutate) { + options = utilities.mergeOptions(this.defaultOptions.mutate, options); + } + return this.queryManager.mutate(options); + }; + ApolloClient.prototype.subscribe = function (options) { + return this.queryManager.startGraphQLSubscription(options); + }; + ApolloClient.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readQuery(options, optimistic); + }; + ApolloClient.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readFragment(options, optimistic); + }; + ApolloClient.prototype.writeQuery = function (options) { + var ref = this.cache.writeQuery(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + ApolloClient.prototype.writeFragment = function (options) { + var ref = this.cache.writeFragment(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + ApolloClient.prototype.__actionHookForDevTools = function (cb) { + this.devToolsHookCb = cb; + }; + ApolloClient.prototype.__requestRaw = function (payload) { + return core.execute(this.link, payload); + }; + ApolloClient.prototype.resetStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: false, + }); + }) + .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) + .then(function () { return _this.reFetchObservableQueries(); }); + }; + ApolloClient.prototype.clearStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: true, + }); + }) + .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); + }; + ApolloClient.prototype.onResetStore = function (cb) { + var _this = this; + this.resetStoreCallbacks.push(cb); + return function () { + _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.onClearStore = function (cb) { + var _this = this; + this.clearStoreCallbacks.push(cb); + return function () { + _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { + return this.queryManager.reFetchObservableQueries(includeStandby); + }; + ApolloClient.prototype.refetchQueries = function (options) { + var map = this.queryManager.refetchQueries(options); + var queries = []; + var results = []; + map.forEach(function (result, obsQuery) { + queries.push(obsQuery); + results.push(result); + }); + var result = Promise.all(results); + result.queries = queries; + result.results = results; + result.catch(function (error) { + globalThis.__DEV__ !== false && globals.invariant.debug(17, error); + }); + return result; + }; + ApolloClient.prototype.getObservableQueries = function (include) { + if (include === void 0) { include = "active"; } + return this.queryManager.getObservableQueries(include); + }; + ApolloClient.prototype.extract = function (optimistic) { + return this.cache.extract(optimistic); + }; + ApolloClient.prototype.restore = function (serializedState) { + return this.cache.restore(serializedState); + }; + ApolloClient.prototype.addResolvers = function (resolvers) { + this.localState.addResolvers(resolvers); + }; + ApolloClient.prototype.setResolvers = function (resolvers) { + this.localState.setResolvers(resolvers); + }; + ApolloClient.prototype.getResolvers = function () { + return this.localState.getResolvers(); + }; + ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { + this.localState.setFragmentMatcher(fragmentMatcher); + }; + ApolloClient.prototype.setLink = function (newLink) { + this.link = this.queryManager.link = newLink; + }; + Object.defineProperty(ApolloClient.prototype, "defaultContext", { + get: function () { + return this.queryManager.defaultContext; + }, + enumerable: false, + configurable: true + }); + return ApolloClient; +}()); +if (globalThis.__DEV__ !== false) { + ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals; +} + +tsInvariant.setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent"); + +exports.DocumentTransform = utilities.DocumentTransform; +exports.Observable = utilities.Observable; +exports.isReference = utilities.isReference; +exports.makeReference = utilities.makeReference; +exports.mergeOptions = utilities.mergeOptions; +exports.ApolloCache = cache.ApolloCache; +exports.Cache = cache.Cache; +exports.InMemoryCache = cache.InMemoryCache; +exports.MissingFieldError = cache.MissingFieldError; +exports.defaultDataIdFromObject = cache.defaultDataIdFromObject; +exports.makeVar = cache.makeVar; +exports.ApolloError = errors.ApolloError; +exports.isApolloError = errors.isApolloError; +exports.fromError = utils.fromError; +exports.fromPromise = utils.fromPromise; +exports.throwServerError = utils.throwServerError; +exports.toPromise = utils.toPromise; +exports.setLogVerbosity = tsInvariant.setVerbosity; +exports.disableExperimentalFragmentVariables = graphqlTag.disableExperimentalFragmentVariables; +exports.disableFragmentWarnings = graphqlTag.disableFragmentWarnings; +exports.enableExperimentalFragmentVariables = graphqlTag.enableExperimentalFragmentVariables; +exports.gql = graphqlTag.gql; +exports.resetCaches = graphqlTag.resetCaches; +exports.ApolloClient = ApolloClient; +exports.ObservableQuery = ObservableQuery; +exports.isNetworkRequestSettled = isNetworkRequestSettled; +for (var k in core) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +} +for (var k in http) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = http[k]; +} +//# sourceMappingURL=core.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/core/core.cjs.map b/graphql-subscription/node_modules/@apollo/client/core/core.cjs.map new file mode 100644 index 0000000..49eb50f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/core.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"core.cjs","sources":["../version.js","../utilities/common/objects.js","../utilities/common/arrays.js","../utilities/common/mergeDeep.js","../utilities/common/incrementalResult.js","networkStatus.js","equalByQuery.js","ObservableQuery.js","LocalState.js","QueryInfo.js","QueryManager.js","../utilities/caching/sizes.js","../utilities/caching/getMemoryInternals.js","ApolloClient.js","index.js"],"sourcesContent":["export var version = \"3.9.5\";\n//# sourceMappingURL=version.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === \"object\";\n}\nexport function isPlainObject(obj) {\n return (obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null));\n}\n//# sourceMappingURL=objects.js.map","// A version of Array.isArray that works better with readonly arrays.\nexport var isArray = Array.isArray;\nexport function isNonEmptyArray(value) {\n return Array.isArray(value) && value.length > 0;\n}\n//# sourceMappingURL=arrays.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { isNonNullObject } from \"./objects.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function mergeDeep() {\n var sources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n sources[_i] = arguments[_i];\n }\n return mergeDeepArray(sources);\n}\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources) {\n var target = sources[0] || {};\n var count = sources.length;\n if (count > 1) {\n var merger = new DeepMerger();\n for (var i = 1; i < count; ++i) {\n target = merger.merge(target, sources[i]);\n }\n }\n return target;\n}\nvar defaultReconciler = function (target, source, property) {\n return this.merge(target[property], source[property]);\n};\nvar DeepMerger = /** @class */ (function () {\n function DeepMerger(reconciler) {\n if (reconciler === void 0) { reconciler = defaultReconciler; }\n this.reconciler = reconciler;\n this.isObject = isNonNullObject;\n this.pastCopies = new Set();\n }\n DeepMerger.prototype.merge = function (target, source) {\n var _this = this;\n var context = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n context[_i - 2] = arguments[_i];\n }\n if (isNonNullObject(source) && isNonNullObject(target)) {\n Object.keys(source).forEach(function (sourceKey) {\n if (hasOwnProperty.call(target, sourceKey)) {\n var targetValue = target[sourceKey];\n if (source[sourceKey] !== targetValue) {\n var result = _this.reconciler.apply(_this, __spreadArray([target,\n source,\n sourceKey], context, false));\n // A well-implemented reconciler may return targetValue to indicate\n // the merge changed nothing about the structure of the target.\n if (result !== targetValue) {\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = result;\n }\n }\n }\n else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = source[sourceKey];\n }\n });\n return target;\n }\n // If source (or target) is not an object, let source replace target.\n return source;\n };\n DeepMerger.prototype.shallowCopyForMerge = function (value) {\n if (isNonNullObject(value)) {\n if (!this.pastCopies.has(value)) {\n if (Array.isArray(value)) {\n value = value.slice(0);\n }\n else {\n value = __assign({ __proto__: Object.getPrototypeOf(value) }, value);\n }\n this.pastCopies.add(value);\n }\n }\n return value;\n };\n return DeepMerger;\n}());\nexport { DeepMerger };\n//# sourceMappingURL=mergeDeep.js.map","import { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\nexport function isExecutionPatchIncrementalResult(value) {\n return \"incremental\" in value;\n}\nexport function isExecutionPatchInitialResult(value) {\n return \"hasNext\" in value && \"data\" in value;\n}\nexport function isExecutionPatchResult(value) {\n return (isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value));\n}\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(value) {\n return isNonNullObject(value) && \"payload\" in value;\n}\nexport function mergeIncrementalData(prevResult, result) {\n var mergedData = prevResult;\n var merger = new DeepMerger();\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (_a) {\n var data = _a.data, path = _a.path;\n for (var i = path.length - 1; i >= 0; --i) {\n var key = path[i];\n var isNumericKey = !isNaN(+key);\n var parent_1 = isNumericKey ? [] : {};\n parent_1[key] = data;\n data = parent_1;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData;\n}\n//# sourceMappingURL=incrementalResult.js.map","/**\n * The current status of a query’s execution in our system.\n */\nexport var NetworkStatus;\n(function (NetworkStatus) {\n /**\n * The query has never been run before and the query is now currently running. A query will still\n * have this network status even if a partial data result was returned from the cache, but a\n * query was dispatched anyway.\n */\n NetworkStatus[NetworkStatus[\"loading\"] = 1] = \"loading\";\n /**\n * If `setVariables` was called and a query was fired because of that then the network status\n * will be `setVariables` until the result of that query comes back.\n */\n NetworkStatus[NetworkStatus[\"setVariables\"] = 2] = \"setVariables\";\n /**\n * Indicates that `fetchMore` was called on this query and that the query created is currently in\n * flight.\n */\n NetworkStatus[NetworkStatus[\"fetchMore\"] = 3] = \"fetchMore\";\n /**\n * Similar to the `setVariables` network status. It means that `refetch` was called on a query\n * and the refetch request is currently in flight.\n */\n NetworkStatus[NetworkStatus[\"refetch\"] = 4] = \"refetch\";\n /**\n * Indicates that a polling query is currently in flight. So for example if you are polling a\n * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever\n * a poll request has been sent but not resolved.\n */\n NetworkStatus[NetworkStatus[\"poll\"] = 6] = \"poll\";\n /**\n * No request is in flight for this query, and no errors happened. Everything is OK.\n */\n NetworkStatus[NetworkStatus[\"ready\"] = 7] = \"ready\";\n /**\n * No request is in flight for this query, but one or more errors were detected.\n */\n NetworkStatus[NetworkStatus[\"error\"] = 8] = \"error\";\n})(NetworkStatus || (NetworkStatus = {}));\n/**\n * Returns true if there is currently a network request in flight according to a given network\n * status.\n */\nexport function isNetworkRequestInFlight(networkStatus) {\n return networkStatus ? networkStatus < 7 : false;\n}\n/**\n * Returns true if the network request is in ready or error state according to a given network\n * status.\n */\nexport function isNetworkRequestSettled(networkStatus) {\n return networkStatus === 7 || networkStatus === 8;\n}\n//# sourceMappingURL=networkStatus.js.map","import { __rest } from \"tslib\";\nimport equal from \"@wry/equality\";\nimport { createFragmentMap, getFragmentDefinitions, getFragmentFromSelection, getMainDefinition, isField, resultKeyNameFromField, shouldInclude, } from \"../utilities/index.js\";\n// Returns true if aResult and bResult are deeply equal according to the fields\n// selected by the given query, ignoring any fields marked as @nonreactive.\nexport function equalByQuery(query, _a, _b, variables) {\n var aData = _a.data, aRest = __rest(_a, [\"data\"]);\n var bData = _b.data, bRest = __rest(_b, [\"data\"]);\n return (equal(aRest, bRest) &&\n equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {\n fragmentMap: createFragmentMap(getFragmentDefinitions(query)),\n variables: variables,\n }));\n}\nfunction equalBySelectionSet(selectionSet, aResult, bResult, context) {\n if (aResult === bResult) {\n return true;\n }\n var seenSelections = new Set();\n // Returning true from this Array.prototype.every callback function skips the\n // current field/subtree. Returning false aborts the entire traversal\n // immediately, causing equalBySelectionSet to return false.\n return selectionSet.selections.every(function (selection) {\n // Avoid re-processing the same selection at the same level of recursion, in\n // case the same field gets included via multiple indirect fragment spreads.\n if (seenSelections.has(selection))\n return true;\n seenSelections.add(selection);\n // Ignore @skip(if: true) and @include(if: false) fields.\n if (!shouldInclude(selection, context.variables))\n return true;\n // If the field or (named) fragment spread has a @nonreactive directive on\n // it, we don't care if it's different, so we pretend it's the same.\n if (selectionHasNonreactiveDirective(selection))\n return true;\n if (isField(selection)) {\n var resultKey = resultKeyNameFromField(selection);\n var aResultChild = aResult && aResult[resultKey];\n var bResultChild = bResult && bResult[resultKey];\n var childSelectionSet = selection.selectionSet;\n if (!childSelectionSet) {\n // These are scalar values, so we can compare them with deep equal\n // without redoing the main recursive work.\n return equal(aResultChild, bResultChild);\n }\n var aChildIsArray = Array.isArray(aResultChild);\n var bChildIsArray = Array.isArray(bResultChild);\n if (aChildIsArray !== bChildIsArray)\n return false;\n if (aChildIsArray && bChildIsArray) {\n var length_1 = aResultChild.length;\n if (bResultChild.length !== length_1) {\n return false;\n }\n for (var i = 0; i < length_1; ++i) {\n if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) {\n return false;\n }\n }\n return true;\n }\n return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context);\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.fragmentMap);\n if (fragment) {\n // The fragment might === selection if it's an inline fragment, but\n // could be !== if it's a named fragment ...spread.\n if (selectionHasNonreactiveDirective(fragment))\n return true;\n return equalBySelectionSet(fragment.selectionSet, \n // Notice that we reuse the same aResult and bResult values here,\n // since the fragment ...spread does not specify a field name, but\n // consists of multiple fields (within the fragment's selection set)\n // that should be applied to the current result value(s).\n aResult, bResult, context);\n }\n }\n });\n}\nfunction selectionHasNonreactiveDirective(selection) {\n return (!!selection.directives && selection.directives.some(directiveIsNonreactive));\n}\nfunction directiveIsNonreactive(dir) {\n return dir.name.value === \"nonreactive\";\n}\n//# sourceMappingURL=equalByQuery.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport { cloneDeep, compact, getOperationDefinition, Observable, iterateObserversSafely, fixObservableSubclass, getQueryDefinition, } from \"../utilities/index.js\";\nimport { equalByQuery } from \"./equalByQuery.js\";\nvar assign = Object.assign, hasOwnProperty = Object.hasOwnProperty;\nvar ObservableQuery = /** @class */ (function (_super) {\n __extends(ObservableQuery, _super);\n function ObservableQuery(_a) {\n var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;\n var _this = _super.call(this, function (observer) {\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = observer._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n }\n catch (_a) { }\n var first = !_this.observers.size;\n _this.observers.add(observer);\n // Deliver most recent error or result.\n var last = _this.last;\n if (last && last.error) {\n observer.error && observer.error(last.error);\n }\n else if (last && last.result) {\n observer.next && observer.next(last.result);\n }\n // Initiate observation of this query if it hasn't been reported to\n // the QueryManager yet.\n if (first) {\n // Blindly catching here prevents unhandled promise rejections,\n // and is safe because the ObservableQuery handles this error with\n // this.observer.error, so we're not just swallowing the error by\n // ignoring it here.\n _this.reobserve().catch(function () { });\n }\n return function () {\n if (_this.observers.delete(observer) && !_this.observers.size) {\n _this.tearDownQuery();\n }\n };\n }) || this;\n _this.observers = new Set();\n _this.subscriptions = new Set();\n // related classes\n _this.queryInfo = queryInfo;\n _this.queryManager = queryManager;\n // active state\n _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);\n _this.isTornDown = false;\n var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? \"cache-first\" : _d;\n var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, \n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n _f = options.initialFetchPolicy, \n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n initialFetchPolicy = _f === void 0 ? fetchPolicy === \"standby\" ? defaultFetchPolicy : (fetchPolicy) : _f;\n _this.options = __assign(__assign({}, options), { \n // Remember the initial options.fetchPolicy so we can revert back to this\n // policy when variables change. This information can also be specified\n // (or overridden) by providing options.initialFetchPolicy explicitly.\n initialFetchPolicy: initialFetchPolicy, \n // This ensures this.options.fetchPolicy always has a string value, in\n // case options.fetchPolicy was not provided.\n fetchPolicy: fetchPolicy });\n _this.queryId = queryInfo.queryId || queryManager.generateQueryId();\n var opDef = getOperationDefinition(_this.query);\n _this.queryName = opDef && opDef.name && opDef.name.value;\n return _this;\n }\n Object.defineProperty(ObservableQuery.prototype, \"query\", {\n // The `query` computed property will always reflect the document transformed\n // by the last run query. `this.options.query` will always reflect the raw\n // untransformed query to ensure document transforms with runtime conditionals\n // are run on the original document.\n get: function () {\n return this.lastQuery || this.options.query;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ObservableQuery.prototype, \"variables\", {\n // Computed shorthand for this.options.variables, preserved for\n // backwards compatibility.\n /**\n * An object containing the variables that were provided for the query.\n */\n get: function () {\n return this.options.variables;\n },\n enumerable: false,\n configurable: true\n });\n ObservableQuery.prototype.result = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n // TODO: this code doesn’t actually make sense insofar as the observer\n // will never exist in this.observers due how zen-observable wraps observables.\n // https://github.com/zenparsing/zen-observable/blob/master/src/Observable.js#L169\n var observer = {\n next: function (result) {\n resolve(result);\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n _this.observers.delete(observer);\n if (!_this.observers.size) {\n _this.queryManager.removeQuery(_this.queryId);\n }\n setTimeout(function () {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n var subscription = _this.subscribe(observer);\n });\n };\n /** @internal */\n ObservableQuery.prototype.resetDiff = function () {\n this.queryInfo.resetDiff();\n };\n ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) {\n if (saveAsLastResult === void 0) { saveAsLastResult = true; }\n // Use the last result as long as the variables match this.variables.\n var lastResult = this.getLastResult(true);\n var networkStatus = this.queryInfo.networkStatus ||\n (lastResult && lastResult.networkStatus) ||\n NetworkStatus.ready;\n var result = __assign(__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });\n var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a;\n if (\n // These fetch policies should never deliver data from the cache, unless\n // redelivering a previously delivered result.\n skipCacheDataFor(fetchPolicy) ||\n // If this.options.query has @client(always: true) fields, we cannot\n // trust diff.result, since it was read from the cache without running\n // local resolvers (and it's too late to run resolvers now, since we must\n // return a result synchronously).\n this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) {\n // Fall through.\n }\n else if (this.waitForOwnResult) {\n // This would usually be a part of `QueryInfo.getDiff()`.\n // which we skip in the waitForOwnResult case since we are not\n // interested in the diff.\n this.queryInfo[\"updateWatch\"]();\n }\n else {\n var diff = this.queryInfo.getDiff();\n if (diff.complete || this.options.returnPartialData) {\n result.data = diff.result;\n }\n if (equal(result.data, {})) {\n result.data = void 0;\n }\n if (diff.complete) {\n // Similar to setting result.partial to false, but taking advantage of the\n // falsiness of missing fields.\n delete result.partial;\n // If the diff is complete, and we're using a FetchPolicy that\n // terminates after a complete cache read, we can assume the next result\n // we receive will have NetworkStatus.ready and !loading.\n if (diff.complete &&\n result.networkStatus === NetworkStatus.loading &&\n (fetchPolicy === \"cache-first\" || fetchPolicy === \"cache-only\")) {\n result.networkStatus = NetworkStatus.ready;\n result.loading = false;\n }\n }\n else {\n result.partial = true;\n }\n if (globalThis.__DEV__ !== false &&\n !diff.complete &&\n !this.options.partialRefetch &&\n !result.loading &&\n !result.data &&\n !result.error) {\n logMissingFieldErrors(diff.missing);\n }\n }\n if (saveAsLastResult) {\n this.updateLastResult(result);\n }\n return result;\n };\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) {\n if (!this.last) {\n return true;\n }\n var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ?\n !equalByQuery(this.query, this.last.result, newResult, this.variables)\n : !equal(this.last.result, newResult);\n return (resultIsDifferent || (variables && !equal(this.last.variables, variables)));\n };\n ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {\n var last = this.last;\n if (last &&\n last[key] &&\n (!variablesMustMatch || equal(last.variables, this.variables))) {\n return last[key];\n }\n };\n ObservableQuery.prototype.getLastResult = function (variablesMustMatch) {\n return this.getLast(\"result\", variablesMustMatch);\n };\n ObservableQuery.prototype.getLastError = function (variablesMustMatch) {\n return this.getLast(\"error\", variablesMustMatch);\n };\n ObservableQuery.prototype.resetLastResults = function () {\n delete this.last;\n this.isTornDown = false;\n };\n ObservableQuery.prototype.resetQueryStoreErrors = function () {\n this.queryManager.resetErrors(this.queryId);\n };\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n ObservableQuery.prototype.refetch = function (variables) {\n var _a;\n var reobserveOptions = {\n // Always disable polling for refetches.\n pollInterval: 0,\n };\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n var fetchPolicy = this.options.fetchPolicy;\n if (fetchPolicy === \"cache-and-network\") {\n reobserveOptions.fetchPolicy = fetchPolicy;\n }\n else if (fetchPolicy === \"no-cache\") {\n reobserveOptions.fetchPolicy = \"no-cache\";\n }\n else {\n reobserveOptions.fetchPolicy = \"network-only\";\n }\n if (globalThis.__DEV__ !== false && variables && hasOwnProperty.call(variables, \"variables\")) {\n var queryDef = getQueryDefinition(this.query);\n var vars = queryDef.variableDefinitions;\n if (!vars || !vars.some(function (v) { return v.variable.name.value === \"variables\"; })) {\n globalThis.__DEV__ !== false && invariant.warn(\n 20,\n variables,\n ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef\n );\n }\n }\n if (variables && !equal(this.options.variables, variables)) {\n // Update the existing options with new variables\n reobserveOptions.variables = this.options.variables = __assign(__assign({}, this.options.variables), variables);\n }\n this.queryInfo.resetLastWrite();\n return this.reobserve(reobserveOptions, NetworkStatus.refetch);\n };\n /**\n * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).\n */\n ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {\n var _this = this;\n var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (__assign(__assign(__assign(__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: __assign(__assign({}, this.options.variables), fetchMoreOptions.variables) })))), { \n // The fetchMore request goes immediately to the network and does\n // not automatically write its result to the cache (hence no-cache\n // instead of network-only), because we allow the caller of\n // fetchMore to provide an updateQuery callback that determines how\n // the data gets written to the cache.\n fetchPolicy: \"no-cache\" });\n combinedOptions.query = this.transformDocument(combinedOptions.query);\n var qid = this.queryManager.generateQueryId();\n // If a temporary query is passed to `fetchMore`, we don't want to store\n // it as the last query result since it may be an optimized query for\n // pagination. We will however run the transforms on the original document\n // as well as the document passed in `fetchMoreOptions` to ensure the cache\n // uses the most up-to-date document which may rely on runtime conditionals.\n this.lastQuery =\n fetchMoreOptions.query ?\n this.transformDocument(this.options.query)\n : combinedOptions.query;\n // Simulate a loading result for the original query with\n // result.networkStatus === NetworkStatus.fetchMore.\n var queryInfo = this.queryInfo;\n var originalNetworkStatus = queryInfo.networkStatus;\n queryInfo.networkStatus = NetworkStatus.fetchMore;\n if (combinedOptions.notifyOnNetworkStatusChange) {\n this.observe();\n }\n var updatedQuerySet = new Set();\n return this.queryManager\n .fetchQuery(qid, combinedOptions, NetworkStatus.fetchMore)\n .then(function (fetchMoreResult) {\n _this.queryManager.removeQuery(qid);\n if (queryInfo.networkStatus === NetworkStatus.fetchMore) {\n queryInfo.networkStatus = originalNetworkStatus;\n }\n // Performing this cache update inside a cache.batch transaction ensures\n // any affected cache.watch watchers are notified at most once about any\n // updates. Most watchers will be using the QueryInfo class, which\n // responds to notifications by calling reobserveCacheFirst to deliver\n // fetchMore cache results back to this ObservableQuery.\n _this.queryManager.cache.batch({\n update: function (cache) {\n var updateQuery = fetchMoreOptions.updateQuery;\n if (updateQuery) {\n cache.updateQuery({\n query: _this.query,\n variables: _this.variables,\n returnPartialData: true,\n optimistic: false,\n }, function (previous) {\n return updateQuery(previous, {\n fetchMoreResult: fetchMoreResult.data,\n variables: combinedOptions.variables,\n });\n });\n }\n else {\n // If we're using a field policy instead of updateQuery, the only\n // thing we need to do is write the new data to the cache using\n // combinedOptions.variables (instead of this.variables, which is\n // what this.updateQuery uses, because it works by abusing the\n // original field value, keyed by the original variables).\n cache.writeQuery({\n query: combinedOptions.query,\n variables: combinedOptions.variables,\n data: fetchMoreResult.data,\n });\n }\n },\n onWatchUpdated: function (watch) {\n // Record the DocumentNode associated with any watched query whose\n // data were updated by the cache writes above.\n updatedQuerySet.add(watch.query);\n },\n });\n return fetchMoreResult;\n })\n .finally(function () {\n // In case the cache writes above did not generate a broadcast\n // notification (which would have been intercepted by onWatchUpdated),\n // likely because the written data were the same as what was already in\n // the cache, we still want fetchMore to deliver its final loading:false\n // result with the unchanged data.\n if (!updatedQuerySet.has(_this.query)) {\n reobserveCacheFirst(_this);\n }\n });\n };\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n /**\n * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.\n *\n * This function returns _another_ function that you can call to terminate the subscription.\n */\n ObservableQuery.prototype.subscribeToMore = function (options) {\n var _this = this;\n var subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n context: options.context,\n })\n .subscribe({\n next: function (subscriptionData) {\n var updateQuery = options.updateQuery;\n if (updateQuery) {\n _this.updateQuery(function (previous, _a) {\n var variables = _a.variables;\n return updateQuery(previous, {\n subscriptionData: subscriptionData,\n variables: variables,\n });\n });\n }\n },\n error: function (err) {\n if (options.onError) {\n options.onError(err);\n return;\n }\n globalThis.__DEV__ !== false && invariant.error(21, err);\n },\n });\n this.subscriptions.add(subscription);\n return function () {\n if (_this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n };\n ObservableQuery.prototype.setOptions = function (newOptions) {\n return this.reobserve(newOptions);\n };\n ObservableQuery.prototype.silentSetOptions = function (newOptions) {\n var mergedOptions = compact(this.options, newOptions || {});\n assign(this.options, mergedOptions);\n };\n /**\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. Most users should prefer `refetch` instead of\n * `setVariables` in order to to be properly notified of results even when\n * they come from the cache.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n ObservableQuery.prototype.setVariables = function (variables) {\n if (equal(this.variables, variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size ? this.result() : Promise.resolve();\n }\n this.options.variables = variables;\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n return this.reobserve({\n // Reset options.fetchPolicy to its original value.\n fetchPolicy: this.options.initialFetchPolicy,\n variables: variables,\n }, NetworkStatus.setVariables);\n };\n /**\n * A function that enables you to update the query's cached result without executing a followup GraphQL operation.\n *\n * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.\n */\n ObservableQuery.prototype.updateQuery = function (mapFn) {\n var queryManager = this.queryManager;\n var result = queryManager.cache.diff({\n query: this.options.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n var newResult = mapFn(result, {\n variables: this.variables,\n });\n if (newResult) {\n queryManager.cache.writeQuery({\n query: this.options.query,\n data: newResult,\n variables: this.variables,\n });\n queryManager.broadcastQueries();\n }\n };\n /**\n * A function that instructs the query to begin re-executing at a specified interval (in milliseconds).\n */\n ObservableQuery.prototype.startPolling = function (pollInterval) {\n this.options.pollInterval = pollInterval;\n this.updatePolling();\n };\n /**\n * A function that instructs the query to stop polling after a previous call to `startPolling`.\n */\n ObservableQuery.prototype.stopPolling = function () {\n this.options.pollInterval = 0;\n this.updatePolling();\n };\n // Update options.fetchPolicy according to options.nextFetchPolicy.\n ObservableQuery.prototype.applyNextFetchPolicy = function (reason, \n // It's possible to use this method to apply options.nextFetchPolicy to\n // options.fetchPolicy even if options !== this.options, though that happens\n // most often when the options are temporary, used for only one request and\n // then thrown away, so nextFetchPolicy may not end up mattering.\n options) {\n if (options.nextFetchPolicy) {\n var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;\n if (fetchPolicy === \"standby\") {\n // Do nothing, leaving options.fetchPolicy unchanged.\n }\n else if (typeof options.nextFetchPolicy === \"function\") {\n // When someone chooses \"cache-and-network\" or \"network-only\" as their\n // initial FetchPolicy, they often do not want future cache updates to\n // trigger unconditional network requests, which is what repeatedly\n // applying the \"cache-and-network\" or \"network-only\" policies would\n // seem to imply. Instead, when the cache reports an update after the\n // initial network request, it may be desirable for subsequent network\n // requests to be triggered only if the cache result is incomplete. To\n // that end, the options.nextFetchPolicy option provides an easy way to\n // update options.fetchPolicy after the initial network request, without\n // having to call observableQuery.setOptions.\n options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {\n reason: reason,\n options: options,\n observable: this,\n initialFetchPolicy: initialFetchPolicy,\n });\n }\n else if (reason === \"variables-changed\") {\n options.fetchPolicy = initialFetchPolicy;\n }\n else {\n options.fetchPolicy = options.nextFetchPolicy;\n }\n }\n return options.fetchPolicy;\n };\n ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {\n // TODO Make sure we update the networkStatus (and infer fetchVariables)\n // before actually committing to the fetch.\n this.queryManager.setObservableQuery(this);\n return this.queryManager[\"fetchConcastWithInfo\"](this.queryId, options, newNetworkStatus, query);\n };\n // Turns polling on or off based on this.options.pollInterval.\n ObservableQuery.prototype.updatePolling = function () {\n var _this = this;\n // Avoid polling in SSR mode\n if (this.queryManager.ssrMode) {\n return;\n }\n var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval;\n if (!pollInterval) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n if (pollingInfo && pollingInfo.interval === pollInterval) {\n return;\n }\n invariant(pollInterval, 22);\n var info = pollingInfo || (this.pollingInfo = {});\n info.interval = pollInterval;\n var maybeFetch = function () {\n var _a, _b;\n if (_this.pollingInfo) {\n if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) &&\n !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) {\n _this.reobserve({\n // Most fetchPolicy options don't make sense to use in a polling context, as\n // users wouldn't want to be polling the cache directly. However, network-only and\n // no-cache are both useful for when the user wants to control whether or not the\n // polled results are written to the cache.\n fetchPolicy: _this.options.initialFetchPolicy === \"no-cache\" ?\n \"no-cache\"\n : \"network-only\",\n }, NetworkStatus.poll).then(poll, poll);\n }\n else {\n poll();\n }\n }\n };\n var poll = function () {\n var info = _this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n poll();\n };\n ObservableQuery.prototype.updateLastResult = function (newResult, variables) {\n if (variables === void 0) { variables = this.variables; }\n var error = this.getLastError();\n // Preserve this.last.error unless the variables have changed.\n if (error && this.last && !equal(variables, this.last.variables)) {\n error = void 0;\n }\n return (this.last = __assign({ result: this.queryManager.assumeImmutableResults ?\n newResult\n : cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));\n };\n ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {\n var _this = this;\n this.isTornDown = false;\n var useDisposableConcast = \n // Refetching uses a disposable Concast to allow refetches using different\n // options/variables, without permanently altering the options of the\n // original ObservableQuery.\n newNetworkStatus === NetworkStatus.refetch ||\n // The fetchMore method does not actually call the reobserve method, but,\n // if it did, it would definitely use a disposable Concast.\n newNetworkStatus === NetworkStatus.fetchMore ||\n // Polling uses a disposable Concast so the polling options (which force\n // fetchPolicy to be \"network-only\" or \"no-cache\") won't override the original options.\n newNetworkStatus === NetworkStatus.poll;\n // Save the old variables, since Object.assign may modify them below.\n var oldVariables = this.options.variables;\n var oldFetchPolicy = this.options.fetchPolicy;\n var mergedOptions = compact(this.options, newOptions || {});\n var options = useDisposableConcast ?\n // Disposable Concast fetches receive a shallow copy of this.options\n // (merged with newOptions), leaving this.options unmodified.\n mergedOptions\n : assign(this.options, mergedOptions);\n // Don't update options.query with the transformed query to avoid\n // overwriting this.options.query when we aren't using a disposable concast.\n // We want to ensure we can re-run the custom document transforms the next\n // time a request is made against the original query.\n var query = this.transformDocument(options.query);\n this.lastQuery = query;\n if (!useDisposableConcast) {\n // We can skip calling updatePolling if we're not changing this.options.\n this.updatePolling();\n // Reset options.fetchPolicy to its original value when variables change,\n // unless a new fetchPolicy was provided by newOptions.\n if (newOptions &&\n newOptions.variables &&\n !equal(newOptions.variables, oldVariables) &&\n // Don't mess with the fetchPolicy if it's currently \"standby\".\n options.fetchPolicy !== \"standby\" &&\n // If we're changing the fetchPolicy anyway, don't try to change it here\n // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.\n options.fetchPolicy === oldFetchPolicy) {\n this.applyNextFetchPolicy(\"variables-changed\", options);\n if (newNetworkStatus === void 0) {\n newNetworkStatus = NetworkStatus.setVariables;\n }\n }\n }\n this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));\n var finishWaitingForOwnResult = function () {\n if (_this.concast === concast) {\n _this.waitForOwnResult = false;\n }\n };\n var variables = options.variables && __assign({}, options.variables);\n var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;\n var observer = {\n next: function (result) {\n if (equal(_this.variables, variables)) {\n finishWaitingForOwnResult();\n _this.reportResult(result, variables);\n }\n },\n error: function (error) {\n if (equal(_this.variables, variables)) {\n finishWaitingForOwnResult();\n _this.reportError(error, variables);\n }\n },\n };\n if (!useDisposableConcast && (fromLink || !this.concast)) {\n // We use the {add,remove}Observer methods directly to avoid wrapping\n // observer with an unnecessary SubscriptionObserver object.\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n }\n this.concast = concast;\n this.observer = observer;\n }\n concast.addObserver(observer);\n return concast;\n };\n ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {\n return this.reobserveAsConcast(newOptions, newNetworkStatus)\n .promise;\n };\n ObservableQuery.prototype.resubscribeAfterError = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // If `lastError` is set in the current when the subscription is re-created,\n // the subscription will immediately receive the error, which will\n // cause it to terminate again. To avoid this, we first clear\n // the last error/result from the `observableQuery` before re-starting\n // the subscription, and restore the last value afterwards so that the\n // subscription has a chance to stay open.\n var last = this.last;\n this.resetLastResults();\n var subscription = this.subscribe.apply(this, args);\n this.last = last;\n return subscription;\n };\n // (Re)deliver the current result to this.observers without applying fetch\n // policies or making network requests.\n ObservableQuery.prototype.observe = function () {\n this.reportResult(\n // Passing false is important so that this.getCurrentResult doesn't\n // save the fetchMore result as this.lastResult, causing it to be\n // ignored due to the this.isDifferentFromLastResult check in\n // this.reportResult.\n this.getCurrentResult(false), this.variables);\n };\n ObservableQuery.prototype.reportResult = function (result, variables) {\n var lastError = this.getLastError();\n var isDifferent = this.isDifferentFromLastResult(result, variables);\n // Update the last result even when isDifferentFromLastResult returns false,\n // because the query may be using the @nonreactive directive, and we want to\n // save the the latest version of any nonreactive subtrees (in case\n // getCurrentResult is called), even though we skip broadcasting changes.\n if (lastError || !result.partial || this.options.returnPartialData) {\n this.updateLastResult(result, variables);\n }\n if (lastError || isDifferent) {\n iterateObserversSafely(this.observers, \"next\", result);\n }\n };\n ObservableQuery.prototype.reportError = function (error, variables) {\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n var errorResult = __assign(__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: NetworkStatus.error, loading: false });\n this.updateLastResult(errorResult, variables);\n iterateObserversSafely(this.observers, \"error\", (this.last.error = error));\n };\n ObservableQuery.prototype.hasObservers = function () {\n return this.observers.size > 0;\n };\n ObservableQuery.prototype.tearDownQuery = function () {\n if (this.isTornDown)\n return;\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n delete this.observer;\n }\n this.stopPolling();\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });\n this.subscriptions.clear();\n this.queryManager.stopQuery(this.queryId);\n this.observers.clear();\n this.isTornDown = true;\n };\n ObservableQuery.prototype.transformDocument = function (document) {\n return this.queryManager.transform(document);\n };\n return ObservableQuery;\n}(Observable));\nexport { ObservableQuery };\n// Necessary because the ObservableQuery constructor has a different\n// signature than the Observable constructor.\nfixObservableSubclass(ObservableQuery);\n// Reobserve with fetchPolicy effectively set to \"cache-first\", triggering\n// delivery of any new data from the cache, possibly falling back to the network\n// if any cache data are missing. This allows _complete_ cache results to be\n// delivered without also kicking off unnecessary network requests when\n// this.options.fetchPolicy is \"cache-and-network\" or \"network-only\". When\n// this.options.fetchPolicy is any other policy (\"cache-first\", \"cache-only\",\n// \"standby\", or \"no-cache\"), we call this.reobserve() as usual.\nexport function reobserveCacheFirst(obsQuery) {\n var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy;\n if (fetchPolicy === \"cache-and-network\" || fetchPolicy === \"network-only\") {\n return obsQuery.reobserve({\n fetchPolicy: \"cache-first\",\n // Use a temporary nextFetchPolicy function that replaces itself with the\n // previous nextFetchPolicy value and returns the original fetchPolicy.\n nextFetchPolicy: function (currentFetchPolicy, context) {\n // Replace this nextFetchPolicy function in the options object with the\n // original this.options.nextFetchPolicy value.\n this.nextFetchPolicy = nextFetchPolicy;\n // If the original nextFetchPolicy value was a function, give it a\n // chance to decide what happens here.\n if (typeof this.nextFetchPolicy === \"function\") {\n return this.nextFetchPolicy(currentFetchPolicy, context);\n }\n // Otherwise go back to the original this.options.fetchPolicy.\n return fetchPolicy;\n },\n });\n }\n return obsQuery.reobserve();\n}\nfunction defaultSubscriptionObserverErrorCallback(error) {\n globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack);\n}\nexport function logMissingFieldErrors(missing) {\n if (globalThis.__DEV__ !== false && missing) {\n globalThis.__DEV__ !== false && invariant.debug(24, missing);\n }\n}\nfunction skipCacheDataFor(fetchPolicy /* `undefined` would mean `\"cache-first\"` */) {\n return (fetchPolicy === \"network-only\" ||\n fetchPolicy === \"no-cache\" ||\n fetchPolicy === \"standby\");\n}\n//# sourceMappingURL=ObservableQuery.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { visit, BREAK, isSelectionNode } from \"graphql\";\nimport { argumentsObjectFromField, buildQueryFromSelectionSet, createFragmentMap, getFragmentDefinitions, getMainDefinition, hasDirectives, isField, isInlineFragment, mergeDeep, mergeDeepArray, removeClientSetsFromDocument, resultKeyNameFromField, shouldInclude, } from \"../utilities/index.js\";\nimport { cacheSlot } from \"../cache/index.js\";\nvar LocalState = /** @class */ (function () {\n function LocalState(_a) {\n var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;\n this.selectionsToResolveCache = new WeakMap();\n this.cache = cache;\n if (client) {\n this.client = client;\n }\n if (resolvers) {\n this.addResolvers(resolvers);\n }\n if (fragmentMatcher) {\n this.setFragmentMatcher(fragmentMatcher);\n }\n }\n LocalState.prototype.addResolvers = function (resolvers) {\n var _this = this;\n this.resolvers = this.resolvers || {};\n if (Array.isArray(resolvers)) {\n resolvers.forEach(function (resolverGroup) {\n _this.resolvers = mergeDeep(_this.resolvers, resolverGroup);\n });\n }\n else {\n this.resolvers = mergeDeep(this.resolvers, resolvers);\n }\n };\n LocalState.prototype.setResolvers = function (resolvers) {\n this.resolvers = {};\n this.addResolvers(resolvers);\n };\n LocalState.prototype.getResolvers = function () {\n return this.resolvers || {};\n };\n // Run local client resolvers against the incoming query and remote data.\n // Locally resolved field values are merged with the incoming remote data,\n // and returned. Note that locally resolved fields will overwrite\n // remote data using the same field name.\n LocalState.prototype.runResolvers = function (_a) {\n var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b;\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_c) {\n if (document) {\n return [2 /*return*/, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (__assign(__assign({}, remoteResult), { data: localResult.result })); })];\n }\n return [2 /*return*/, remoteResult];\n });\n });\n };\n LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) {\n this.fragmentMatcher = fragmentMatcher;\n };\n LocalState.prototype.getFragmentMatcher = function () {\n return this.fragmentMatcher;\n };\n // Client queries contain everything in the incoming document (if a @client\n // directive is found).\n LocalState.prototype.clientQuery = function (document) {\n if (hasDirectives([\"client\"], document)) {\n if (this.resolvers) {\n return document;\n }\n }\n return null;\n };\n // Server queries are stripped of all @client based selection sets.\n LocalState.prototype.serverQuery = function (document) {\n return removeClientSetsFromDocument(document);\n };\n LocalState.prototype.prepareContext = function (context) {\n var cache = this.cache;\n return __assign(__assign({}, context), { cache: cache, \n // Getting an entry's cache key is useful for local state resolvers.\n getCacheKey: function (obj) {\n return cache.identify(obj);\n } });\n };\n // To support `@client @export(as: \"someVar\")` syntax, we'll first resolve\n // @client @export fields locally, then pass the resolved values back to be\n // used alongside the original operation variables.\n LocalState.prototype.addExportedVariables = function (document, variables, context) {\n if (variables === void 0) { variables = {}; }\n if (context === void 0) { context = {}; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (document) {\n return [2 /*return*/, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (__assign(__assign({}, variables), data.exportedVariables)); })];\n }\n return [2 /*return*/, __assign({}, variables)];\n });\n });\n };\n LocalState.prototype.shouldForceResolvers = function (document) {\n var forceResolvers = false;\n visit(document, {\n Directive: {\n enter: function (node) {\n if (node.name.value === \"client\" && node.arguments) {\n forceResolvers = node.arguments.some(function (arg) {\n return arg.name.value === \"always\" &&\n arg.value.kind === \"BooleanValue\" &&\n arg.value.value === true;\n });\n if (forceResolvers) {\n return BREAK;\n }\n }\n },\n },\n });\n return forceResolvers;\n };\n // Query the cache and return matching data.\n LocalState.prototype.buildRootValueFromCache = function (document, variables) {\n return this.cache.diff({\n query: buildQueryFromSelectionSet(document),\n variables: variables,\n returnPartialData: true,\n optimistic: false,\n }).result;\n };\n LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) {\n if (context === void 0) { context = {}; }\n if (variables === void 0) { variables = {}; }\n if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }\n if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }\n return __awaiter(this, void 0, void 0, function () {\n var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;\n return __generator(this, function (_b) {\n mainDefinition = getMainDefinition(document);\n fragments = getFragmentDefinitions(document);\n fragmentMap = createFragmentMap(fragments);\n selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);\n definitionOperation = mainDefinition.operation;\n defaultOperationType = definitionOperation ?\n definitionOperation.charAt(0).toUpperCase() +\n definitionOperation.slice(1)\n : \"Query\";\n _a = this, cache = _a.cache, client = _a.client;\n execContext = {\n fragmentMap: fragmentMap,\n context: __assign(__assign({}, context), { cache: cache, client: client }),\n variables: variables,\n fragmentMatcher: fragmentMatcher,\n defaultOperationType: defaultOperationType,\n exportedVariables: {},\n selectionsToResolve: selectionsToResolve,\n onlyRunForcedResolvers: onlyRunForcedResolvers,\n };\n isClientFieldDescendant = false;\n return [2 /*return*/, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({\n result: result,\n exportedVariables: execContext.exportedVariables,\n }); })];\n });\n });\n };\n LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) {\n return __awaiter(this, void 0, void 0, function () {\n var fragmentMap, context, variables, resultsToMerge, execute;\n var _this = this;\n return __generator(this, function (_a) {\n fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables;\n resultsToMerge = [rootValue];\n execute = function (selection) { return __awaiter(_this, void 0, void 0, function () {\n var fragment, typeCondition;\n return __generator(this, function (_a) {\n if (!isClientFieldDescendant &&\n !execContext.selectionsToResolve.has(selection)) {\n // Skip selections without @client directives\n // (still processing if one of the ancestors or one of the child fields has @client directive)\n return [2 /*return*/];\n }\n if (!shouldInclude(selection, variables)) {\n // Skip this entirely.\n return [2 /*return*/];\n }\n if (isField(selection)) {\n return [2 /*return*/, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {\n var _a;\n if (typeof fieldResult !== \"undefined\") {\n resultsToMerge.push((_a = {},\n _a[resultKeyNameFromField(selection)] = fieldResult,\n _a));\n }\n })];\n }\n if (isInlineFragment(selection)) {\n fragment = selection;\n }\n else {\n // This is a named fragment.\n fragment = fragmentMap[selection.name.value];\n invariant(fragment, 18, selection.name.value);\n }\n if (fragment && fragment.typeCondition) {\n typeCondition = fragment.typeCondition.name.value;\n if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {\n return [2 /*return*/, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {\n resultsToMerge.push(fragmentResult);\n })];\n }\n }\n return [2 /*return*/];\n });\n }); };\n return [2 /*return*/, Promise.all(selectionSet.selections.map(execute)).then(function () {\n return mergeDeepArray(resultsToMerge);\n })];\n });\n });\n };\n LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) {\n return __awaiter(this, void 0, void 0, function () {\n var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;\n var _this = this;\n return __generator(this, function (_a) {\n if (!rootValue) {\n return [2 /*return*/, null];\n }\n variables = execContext.variables;\n fieldName = field.name.value;\n aliasedFieldName = resultKeyNameFromField(field);\n aliasUsed = fieldName !== aliasedFieldName;\n defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName];\n resultPromise = Promise.resolve(defaultResult);\n // Usually all local resolvers are run when passing through here, but\n // if we've specifically identified that we only want to run forced\n // resolvers (that is, resolvers for fields marked with\n // `@client(always: true)`), then we'll skip running non-forced resolvers.\n if (!execContext.onlyRunForcedResolvers ||\n this.shouldForceResolvers(field)) {\n resolverType = rootValue.__typename || execContext.defaultOperationType;\n resolverMap = this.resolvers && this.resolvers[resolverType];\n if (resolverMap) {\n resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName];\n if (resolve) {\n resultPromise = Promise.resolve(\n // In case the resolve function accesses reactive variables,\n // set cacheSlot to the current cache instance.\n cacheSlot.withValue(this.cache, resolve, [\n rootValue,\n argumentsObjectFromField(field, variables),\n execContext.context,\n { field: field, fragmentMap: execContext.fragmentMap },\n ]));\n }\n }\n }\n return [2 /*return*/, resultPromise.then(function (result) {\n var _a, _b;\n if (result === void 0) { result = defaultResult; }\n // If an @export directive is associated with the current field, store\n // the `as` export variable name and current result for later use.\n if (field.directives) {\n field.directives.forEach(function (directive) {\n if (directive.name.value === \"export\" && directive.arguments) {\n directive.arguments.forEach(function (arg) {\n if (arg.name.value === \"as\" && arg.value.kind === \"StringValue\") {\n execContext.exportedVariables[arg.value.value] = result;\n }\n });\n }\n });\n }\n // Handle all scalar types here.\n if (!field.selectionSet) {\n return result;\n }\n // From here down, the field has a selection set, which means it's trying\n // to query a GraphQLObjectType.\n if (result == null) {\n // Basically any field in a GraphQL response can be null, or missing\n return result;\n }\n var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === \"client\"; })) !== null && _b !== void 0 ? _b : false;\n if (Array.isArray(result)) {\n return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);\n }\n // Returned value is an object, and the query has a sub-selection. Recurse.\n if (field.selectionSet) {\n return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext);\n }\n })];\n });\n });\n };\n LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) {\n var _this = this;\n return Promise.all(result.map(function (item) {\n if (item === null) {\n return null;\n }\n // This is a nested array, recurse.\n if (Array.isArray(item)) {\n return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext);\n }\n // This is an object, run the selection set on it.\n if (field.selectionSet) {\n return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext);\n }\n }));\n };\n // Collect selection nodes on paths from document root down to all @client directives.\n // This function takes into account transitive fragment spreads.\n // Complexity equals to a single `visit` over the full document.\n LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) {\n var isSingleASTNode = function (node) { return !Array.isArray(node); };\n var selectionsToResolveCache = this.selectionsToResolveCache;\n function collectByDefinition(definitionNode) {\n if (!selectionsToResolveCache.has(definitionNode)) {\n var matches_1 = new Set();\n selectionsToResolveCache.set(definitionNode, matches_1);\n visit(definitionNode, {\n Directive: function (node, _, __, ___, ancestors) {\n if (node.name.value === \"client\") {\n ancestors.forEach(function (node) {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches_1.add(node);\n }\n });\n }\n },\n FragmentSpread: function (spread, _, __, ___, ancestors) {\n var fragment = fragmentMap[spread.name.value];\n invariant(fragment, 19, spread.name.value);\n var fragmentSelections = collectByDefinition(fragment);\n if (fragmentSelections.size > 0) {\n // Fragment for this spread contains @client directive (either directly or transitively)\n // Collect selection nodes on paths from the root down to fields with the @client directive\n ancestors.forEach(function (node) {\n if (isSingleASTNode(node) && isSelectionNode(node)) {\n matches_1.add(node);\n }\n });\n matches_1.add(spread);\n fragmentSelections.forEach(function (selection) {\n matches_1.add(selection);\n });\n }\n },\n });\n }\n return selectionsToResolveCache.get(definitionNode);\n }\n return collectByDefinition(mainDefinition);\n };\n return LocalState;\n}());\nexport { LocalState };\n//# sourceMappingURL=LocalState.js.map","import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { DeepMerger } from \"../utilities/index.js\";\nimport { mergeIncrementalData } from \"../utilities/index.js\";\nimport { reobserveCacheFirst } from \"./ObservableQuery.js\";\nimport { isNonEmptyArray, graphQLResultHasError, canUseWeakMap, } from \"../utilities/index.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nvar destructiveMethodCounts = new (canUseWeakMap ? WeakMap : Map)();\nfunction wrapDestructiveCacheMethod(cache, methodName) {\n var original = cache[methodName];\n if (typeof original === \"function\") {\n // @ts-expect-error this is just too generic to be typed correctly\n cache[methodName] = function () {\n destructiveMethodCounts.set(cache, \n // The %1e15 allows the count to wrap around to 0 safely every\n // quadrillion evictions, so there's no risk of overflow. To be\n // clear, this is more of a pedantic principle than something\n // that matters in any conceivable practical scenario.\n (destructiveMethodCounts.get(cache) + 1) % 1e15);\n // @ts-expect-error this is just too generic to be typed correctly\n return original.apply(this, arguments);\n };\n }\n}\nfunction cancelNotifyTimeout(info) {\n if (info[\"notifyTimeout\"]) {\n clearTimeout(info[\"notifyTimeout\"]);\n info[\"notifyTimeout\"] = void 0;\n }\n}\n// A QueryInfo object represents a single query managed by the\n// QueryManager, which tracks all QueryInfo objects by queryId in its\n// this.queries Map. QueryInfo objects store the latest results and errors\n// for the given query, and are responsible for reporting those results to\n// the corresponding ObservableQuery, via the QueryInfo.notify method.\n// Results are reported asynchronously whenever setDiff marks the\n// QueryInfo object as dirty, though a call to the QueryManager's\n// broadcastQueries method may trigger the notification before it happens\n// automatically. This class used to be a simple interface type without\n// any field privacy or meaningful methods, which is why it still has so\n// many public fields. The effort to lock down and simplify the QueryInfo\n// interface is ongoing, and further improvements are welcome.\nvar QueryInfo = /** @class */ (function () {\n function QueryInfo(queryManager, queryId) {\n if (queryId === void 0) { queryId = queryManager.generateQueryId(); }\n this.queryId = queryId;\n this.listeners = new Set();\n this.document = null;\n this.lastRequestId = 1;\n this.stopped = false;\n this.dirty = false;\n this.observableQuery = null;\n var cache = (this.cache = queryManager.cache);\n // Track how often cache.evict is called, since we want eviction to\n // override the feud-stopping logic in the markResult method, by\n // causing shouldWrite to return true. Wrapping the cache.evict method\n // is a bit of a hack, but it saves us from having to make eviction\n // counting an official part of the ApolloCache API.\n if (!destructiveMethodCounts.has(cache)) {\n destructiveMethodCounts.set(cache, 0);\n wrapDestructiveCacheMethod(cache, \"evict\");\n wrapDestructiveCacheMethod(cache, \"modify\");\n wrapDestructiveCacheMethod(cache, \"reset\");\n }\n }\n QueryInfo.prototype.init = function (query) {\n var networkStatus = query.networkStatus || NetworkStatus.loading;\n if (this.variables &&\n this.networkStatus !== NetworkStatus.loading &&\n !equal(this.variables, query.variables)) {\n networkStatus = NetworkStatus.setVariables;\n }\n if (!equal(query.variables, this.variables)) {\n this.lastDiff = void 0;\n }\n Object.assign(this, {\n document: query.document,\n variables: query.variables,\n networkError: null,\n graphQLErrors: this.graphQLErrors || [],\n networkStatus: networkStatus,\n });\n if (query.observableQuery) {\n this.setObservableQuery(query.observableQuery);\n }\n if (query.lastRequestId) {\n this.lastRequestId = query.lastRequestId;\n }\n return this;\n };\n QueryInfo.prototype.reset = function () {\n cancelNotifyTimeout(this);\n this.dirty = false;\n };\n QueryInfo.prototype.resetDiff = function () {\n this.lastDiff = void 0;\n };\n QueryInfo.prototype.getDiff = function () {\n var options = this.getDiffOptions();\n if (this.lastDiff && equal(options, this.lastDiff.options)) {\n return this.lastDiff.diff;\n }\n this.updateWatch(this.variables);\n var oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return { complete: false };\n }\n var diff = this.cache.diff(options);\n this.updateLastDiff(diff, options);\n return diff;\n };\n QueryInfo.prototype.updateLastDiff = function (diff, options) {\n this.lastDiff =\n diff ?\n {\n diff: diff,\n options: options || this.getDiffOptions(),\n }\n : void 0;\n };\n QueryInfo.prototype.getDiffOptions = function (variables) {\n var _a;\n if (variables === void 0) { variables = this.variables; }\n return {\n query: this.document,\n variables: variables,\n returnPartialData: true,\n optimistic: true,\n canonizeResults: (_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.canonizeResults,\n };\n };\n QueryInfo.prototype.setDiff = function (diff) {\n var _this = this;\n var _a;\n var oldDiff = this.lastDiff && this.lastDiff.diff;\n // If we do not tolerate partial results, skip this update to prevent it\n // from being reported. This prevents a situtuation where a query that\n // errors and another succeeds with overlapping data does not report the\n // partial data result to the errored query.\n //\n // See https://github.com/apollographql/apollo-client/issues/11400 for more\n // information on this issue.\n if (diff &&\n !diff.complete &&\n !((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.returnPartialData) &&\n // In the case of a cache eviction, the diff will become partial so we\n // schedule a notification to send a network request (this.oqListener) to\n // go and fetch the missing data.\n !(oldDiff && oldDiff.complete)) {\n return;\n }\n this.updateLastDiff(diff);\n if (!this.dirty && !equal(oldDiff && oldDiff.result, diff && diff.result)) {\n this.dirty = true;\n if (!this.notifyTimeout) {\n this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);\n }\n }\n };\n QueryInfo.prototype.setObservableQuery = function (oq) {\n var _this = this;\n if (oq === this.observableQuery)\n return;\n if (this.oqListener) {\n this.listeners.delete(this.oqListener);\n }\n this.observableQuery = oq;\n if (oq) {\n oq[\"queryInfo\"] = this;\n this.listeners.add((this.oqListener = function () {\n var diff = _this.getDiff();\n if (diff.fromOptimisticTransaction) {\n // If this diff came from an optimistic transaction, deliver the\n // current cache data to the ObservableQuery, but don't perform a\n // reobservation, since oq.reobserveCacheFirst might make a network\n // request, and we never want to trigger network requests in the\n // middle of optimistic updates.\n oq[\"observe\"]();\n }\n else {\n // Otherwise, make the ObservableQuery \"reobserve\" the latest data\n // using a temporary fetch policy of \"cache-first\", so complete cache\n // results have a chance to be delivered without triggering additional\n // network requests, even when options.fetchPolicy is \"network-only\"\n // or \"cache-and-network\". All other fetch policies are preserved by\n // this method, and are handled by calling oq.reobserve(). If this\n // reobservation is spurious, isDifferentFromLastResult still has a\n // chance to catch it before delivery to ObservableQuery subscribers.\n reobserveCacheFirst(oq);\n }\n }));\n }\n else {\n delete this.oqListener;\n }\n };\n QueryInfo.prototype.notify = function () {\n var _this = this;\n cancelNotifyTimeout(this);\n if (this.shouldNotify()) {\n this.listeners.forEach(function (listener) { return listener(_this); });\n }\n this.dirty = false;\n };\n QueryInfo.prototype.shouldNotify = function () {\n if (!this.dirty || !this.listeners.size) {\n return false;\n }\n if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) {\n var fetchPolicy = this.observableQuery.options.fetchPolicy;\n if (fetchPolicy !== \"cache-only\" && fetchPolicy !== \"cache-and-network\") {\n return false;\n }\n }\n return true;\n };\n QueryInfo.prototype.stop = function () {\n if (!this.stopped) {\n this.stopped = true;\n // Cancel the pending notify timeout\n this.reset();\n this.cancel();\n // Revert back to the no-op version of cancel inherited from\n // QueryInfo.prototype.\n this.cancel = QueryInfo.prototype.cancel;\n var oq = this.observableQuery;\n if (oq)\n oq.stopPolling();\n }\n };\n // This method is a no-op by default, until/unless overridden by the\n // updateWatch method.\n QueryInfo.prototype.cancel = function () { };\n QueryInfo.prototype.updateWatch = function (variables) {\n var _this = this;\n if (variables === void 0) { variables = this.variables; }\n var oq = this.observableQuery;\n if (oq && oq.options.fetchPolicy === \"no-cache\") {\n return;\n }\n var watchOptions = __assign(__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } });\n if (!this.lastWatch || !equal(watchOptions, this.lastWatch)) {\n this.cancel();\n this.cancel = this.cache.watch((this.lastWatch = watchOptions));\n }\n };\n QueryInfo.prototype.resetLastWrite = function () {\n this.lastWrite = void 0;\n };\n QueryInfo.prototype.shouldWrite = function (result, variables) {\n var lastWrite = this.lastWrite;\n return !(lastWrite &&\n // If cache.evict has been called since the last time we wrote this\n // data into the cache, there's a chance writing this result into\n // the cache will repair what was evicted.\n lastWrite.dmCount === destructiveMethodCounts.get(this.cache) &&\n equal(variables, lastWrite.variables) &&\n equal(result.data, lastWrite.result.data));\n };\n QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {\n var _this = this;\n var merger = new DeepMerger();\n var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];\n // Cancel the pending notify timeout (if it exists) to prevent extraneous network\n // requests. To allow future notify timeouts, diff and dirty are reset as well.\n this.reset();\n if (\"incremental\" in result && isNonEmptyArray(result.incremental)) {\n var mergedData = mergeIncrementalData(this.getDiff().result, result);\n result.data = mergedData;\n // Detect the first chunk of a deferred query and merge it with existing\n // cache data. This ensures a `cache-first` fetch policy that returns\n // partial cache data or a `cache-and-network` fetch policy that already\n // has full data in the cache does not complain when trying to merge the\n // initial deferred server data with existing cache data.\n }\n else if (\"hasNext\" in result && result.hasNext) {\n var diff = this.getDiff();\n result.data = merger.merge(diff.result, result.data);\n }\n this.graphQLErrors = graphQLErrors;\n if (options.fetchPolicy === \"no-cache\") {\n this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));\n }\n else if (cacheWriteBehavior !== 0 /* CacheWriteBehavior.FORBID */) {\n if (shouldWriteResult(result, options.errorPolicy)) {\n // Using a transaction here so we have a chance to read the result\n // back from the cache before the watch callback fires as a result\n // of writeQuery, so we can store the new diff quietly and ignore\n // it when we receive it redundantly from the watch callback.\n this.cache.performTransaction(function (cache) {\n if (_this.shouldWrite(result, options.variables)) {\n cache.writeQuery({\n query: document,\n data: result.data,\n variables: options.variables,\n overwrite: cacheWriteBehavior === 1 /* CacheWriteBehavior.OVERWRITE */,\n });\n _this.lastWrite = {\n result: result,\n variables: options.variables,\n dmCount: destructiveMethodCounts.get(_this.cache),\n };\n }\n else {\n // If result is the same as the last result we received from\n // the network (and the variables match too), avoid writing\n // result into the cache again. The wisdom of skipping this\n // cache write is far from obvious, since any cache write\n // could be the one that puts the cache back into a desired\n // state, fixing corruption or missing data. However, if we\n // always write every network result into the cache, we enable\n // feuds between queries competing to update the same data in\n // incompatible ways, which can lead to an endless cycle of\n // cache broadcasts and useless network requests. As with any\n // feud, eventually one side must step back from the brink,\n // letting the other side(s) have the last word(s). There may\n // be other points where we could break this cycle, such as\n // silencing the broadcast for cache.writeQuery (not a good\n // idea, since it just delays the feud a bit) or somehow\n // avoiding the network request that just happened (also bad,\n // because the server could return useful new data). All\n // options considered, skipping this cache write seems to be\n // the least damaging place to break the cycle, because it\n // reflects the intuition that we recently wrote this exact\n // result into the cache, so the cache *should* already/still\n // contain this data. If some other query has clobbered that\n // data in the meantime, that's too bad, but there will be no\n // winners if every query blindly reverts to its own version\n // of the data. This approach also gives the network a chance\n // to return new data, which will be written into the cache as\n // usual, notifying only those queries that are directly\n // affected by the cache updates, as usual. In the future, an\n // even more sophisticated cache could perhaps prevent or\n // mitigate the clobbering somehow, but that would make this\n // particular cache write even less important, and thus\n // skipping it would be even safer than it is today.\n if (_this.lastDiff && _this.lastDiff.diff.complete) {\n // Reuse data from the last good (complete) diff that we\n // received, when possible.\n result.data = _this.lastDiff.diff.result;\n return;\n }\n // If the previous this.diff was incomplete, fall through to\n // re-reading the latest data with cache.diff, below.\n }\n var diffOptions = _this.getDiffOptions(options.variables);\n var diff = cache.diff(diffOptions);\n // In case the QueryManager stops this QueryInfo before its\n // results are delivered, it's important to avoid restarting the\n // cache watch when markResult is called. We also avoid updating\n // the watch if we are writing a result that doesn't match the current\n // variables to avoid race conditions from broadcasting the wrong\n // result.\n if (!_this.stopped && equal(_this.variables, options.variables)) {\n // Any time we're about to update this.diff, we need to make\n // sure we've started watching the cache.\n _this.updateWatch(options.variables);\n }\n // If we're allowed to write to the cache, and we can read a\n // complete result from the cache, update result.data to be the\n // result from the cache, rather than the raw network result.\n // Set without setDiff to avoid triggering a notify call, since\n // we have other ways of notifying for this result.\n _this.updateLastDiff(diff, diffOptions);\n if (diff.complete) {\n result.data = diff.result;\n }\n });\n }\n else {\n this.lastWrite = void 0;\n }\n }\n };\n QueryInfo.prototype.markReady = function () {\n this.networkError = null;\n return (this.networkStatus = NetworkStatus.ready);\n };\n QueryInfo.prototype.markError = function (error) {\n this.networkStatus = NetworkStatus.error;\n this.lastWrite = void 0;\n this.reset();\n if (error.graphQLErrors) {\n this.graphQLErrors = error.graphQLErrors;\n }\n if (error.networkError) {\n this.networkError = error.networkError;\n }\n return error;\n };\n return QueryInfo;\n}());\nexport { QueryInfo };\nexport function shouldWriteResult(result, errorPolicy) {\n if (errorPolicy === void 0) { errorPolicy = \"none\"; }\n var ignoreErrors = errorPolicy === \"ignore\" || errorPolicy === \"all\";\n var writeWithErrors = !graphQLResultHasError(result);\n if (!writeWithErrors && ignoreErrors && result.data) {\n writeWithErrors = true;\n }\n return writeWithErrors;\n}\n//# sourceMappingURL=QueryInfo.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { invariant, newInvariantError } from \"../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { execute } from \"../link/core/index.js\";\nimport { hasDirectives, isExecutionPatchIncrementalResult, isExecutionPatchResult, removeDirectivesFromDocument, } from \"../utilities/index.js\";\nimport { canonicalStringify } from \"../cache/index.js\";\nimport { getDefaultValues, getOperationDefinition, getOperationName, hasClientExports, graphQLResultHasError, getGraphQLErrorsFromResult, Observable, asyncMap, isNonEmptyArray, Concast, makeUniqueId, isDocumentNode, isNonNullObject, DocumentTransform, } from \"../utilities/index.js\";\nimport { mergeIncrementalData } from \"../utilities/common/incrementalResult.js\";\nimport { ApolloError, isApolloError, graphQLResultHasProtocolErrors, } from \"../errors/index.js\";\nimport { ObservableQuery, logMissingFieldErrors } from \"./ObservableQuery.js\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport { LocalState } from \"./LocalState.js\";\nimport { QueryInfo, shouldWriteResult, } from \"./QueryInfo.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../errors/index.js\";\nimport { print } from \"../utilities/index.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar IGNORE = Object.create(null);\nimport { Trie } from \"@wry/trie\";\nimport { AutoCleanedWeakCache, cacheSizes } from \"../utilities/index.js\";\nvar QueryManager = /** @class */ (function () {\n function QueryManager(_a) {\n var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext;\n var _this = this;\n this.clientAwareness = {};\n // All the queries that the QueryManager is currently managing (not\n // including mutations and subscriptions).\n this.queries = new Map();\n // Maps from queryId strings to Promise rejection functions for\n // currently active queries and fetches.\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n this.fetchCancelFns = new Map();\n this.transformCache = new AutoCleanedWeakCache(cacheSizes[\"queryManager.getDocumentInfo\"] ||\n 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */);\n this.queryIdCounter = 1;\n this.requestIdCounter = 1;\n this.mutationIdCounter = 1;\n // Use protected instead of private field so\n // @apollo/experimental-nextjs-app-support can access type info.\n this.inFlightLinkObservables = new Trie(false);\n var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, \n // Allow the apollo cache to manage its own transform caches\n { cache: false });\n this.cache = cache;\n this.link = link;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.queryDeduplication = queryDeduplication;\n this.clientAwareness = clientAwareness;\n this.localState = localState || new LocalState({ cache: cache });\n this.ssrMode = ssrMode;\n this.assumeImmutableResults = assumeImmutableResults;\n this.documentTransform =\n documentTransform ?\n defaultDocumentTransform\n .concat(documentTransform)\n // The custom document transform may add new fragment spreads or new\n // field selections, so we want to give the cache a chance to run\n // again. For example, the InMemoryCache adds __typename to field\n // selections and fragments from the fragment registry.\n .concat(defaultDocumentTransform)\n : defaultDocumentTransform;\n this.defaultContext = defaultContext || Object.create(null);\n if ((this.onBroadcast = onBroadcast)) {\n this.mutationStore = Object.create(null);\n }\n }\n /**\n * Call this method to terminate any active query processes, making it safe\n * to dispose of this QueryManager instance.\n */\n QueryManager.prototype.stop = function () {\n var _this = this;\n this.queries.forEach(function (_info, queryId) {\n _this.stopQueryNoBroadcast(queryId);\n });\n this.cancelPendingFetches(newInvariantError(25));\n };\n QueryManager.prototype.cancelPendingFetches = function (error) {\n this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });\n this.fetchCancelFns.clear();\n };\n QueryManager.prototype.mutate = function (_a) {\n var _b, _c;\n var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || \"network-only\" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || \"none\" : _g, keepRootFields = _a.keepRootFields, context = _a.context;\n return __awaiter(this, void 0, void 0, function () {\n var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self;\n return __generator(this, function (_h) {\n switch (_h.label) {\n case 0:\n invariant(mutation, 26);\n invariant(fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\", 27);\n mutationId = this.generateMutationId();\n mutation = this.cache.transformForLink(this.transform(mutation));\n hasClientExports = this.getDocumentInfo(mutation).hasClientExports;\n variables = this.getVariables(mutation, variables);\n if (!hasClientExports) return [3 /*break*/, 2];\n return [4 /*yield*/, this.localState.addExportedVariables(mutation, variables, context)];\n case 1:\n variables = (_h.sent());\n _h.label = 2;\n case 2:\n mutationStoreValue = this.mutationStore &&\n (this.mutationStore[mutationId] = {\n mutation: mutation,\n variables: variables,\n loading: true,\n error: null,\n });\n isOptimistic = optimisticResponse &&\n this.markMutationOptimistic(optimisticResponse, {\n mutationId: mutationId,\n document: mutation,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n context: context,\n updateQueries: updateQueries,\n update: updateWithProxyFn,\n keepRootFields: keepRootFields,\n });\n this.broadcastQueries();\n self = this;\n return [2 /*return*/, new Promise(function (resolve, reject) {\n return asyncMap(self.getObservableFromLink(mutation, __assign(__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) {\n if (graphQLResultHasError(result) && errorPolicy === \"none\") {\n throw new ApolloError({\n graphQLErrors: getGraphQLErrorsFromResult(result),\n });\n }\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = null;\n }\n var storeResult = __assign({}, result);\n if (typeof refetchQueries === \"function\") {\n refetchQueries = refetchQueries(storeResult);\n }\n if (errorPolicy === \"ignore\" && graphQLResultHasError(storeResult)) {\n delete storeResult.errors;\n }\n return self.markMutationResult({\n mutationId: mutationId,\n result: storeResult,\n document: mutation,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n context: context,\n update: updateWithProxyFn,\n updateQueries: updateQueries,\n awaitRefetchQueries: awaitRefetchQueries,\n refetchQueries: refetchQueries,\n removeOptimistic: isOptimistic ? mutationId : void 0,\n onQueryUpdated: onQueryUpdated,\n keepRootFields: keepRootFields,\n });\n }).subscribe({\n next: function (storeResult) {\n self.broadcastQueries();\n // Since mutations might receive multiple payloads from the\n // ApolloLink chain (e.g. when used with @defer),\n // we resolve with a SingleExecutionResult or after the final\n // ExecutionPatchResult has arrived and we have assembled the\n // multipart response into a single result.\n if (!(\"hasNext\" in storeResult) || storeResult.hasNext === false) {\n resolve(storeResult);\n }\n },\n error: function (err) {\n if (mutationStoreValue) {\n mutationStoreValue.loading = false;\n mutationStoreValue.error = err;\n }\n if (isOptimistic) {\n self.cache.removeOptimistic(mutationId);\n }\n self.broadcastQueries();\n reject(err instanceof ApolloError ? err : (new ApolloError({\n networkError: err,\n })));\n },\n });\n })];\n }\n });\n });\n };\n QueryManager.prototype.markMutationResult = function (mutation, cache) {\n var _this = this;\n if (cache === void 0) { cache = this.cache; }\n var result = mutation.result;\n var cacheWrites = [];\n var skipCache = mutation.fetchPolicy === \"no-cache\";\n if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) {\n if (!isExecutionPatchIncrementalResult(result)) {\n cacheWrites.push({\n result: result.data,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n var diff = cache.diff({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n var mergedData = void 0;\n if (diff.result) {\n mergedData = mergeIncrementalData(diff.result, result);\n }\n if (typeof mergedData !== \"undefined\") {\n // cast the ExecutionPatchResult to FetchResult here since\n // ExecutionPatchResult never has `data` when returned from the server\n result.data = mergedData;\n cacheWrites.push({\n result: mergedData,\n dataId: \"ROOT_MUTATION\",\n query: mutation.document,\n variables: mutation.variables,\n });\n }\n }\n var updateQueries_1 = mutation.updateQueries;\n if (updateQueries_1) {\n this.queries.forEach(function (_a, queryId) {\n var observableQuery = _a.observableQuery;\n var queryName = observableQuery && observableQuery.queryName;\n if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) {\n return;\n }\n var updater = updateQueries_1[queryName];\n var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables;\n // Read the current query result from the store.\n var _c = cache.diff({\n query: document,\n variables: variables,\n returnPartialData: true,\n optimistic: false,\n }), currentQueryResult = _c.result, complete = _c.complete;\n if (complete && currentQueryResult) {\n // Run our reducer using the current query result and the mutation result.\n var nextQueryResult = updater(currentQueryResult, {\n mutationResult: result,\n queryName: (document && getOperationName(document)) || void 0,\n queryVariables: variables,\n });\n // Write the modified result back into the store if we got a new result.\n if (nextQueryResult) {\n cacheWrites.push({\n result: nextQueryResult,\n dataId: \"ROOT_QUERY\",\n query: document,\n variables: variables,\n });\n }\n }\n });\n }\n }\n if (cacheWrites.length > 0 ||\n (mutation.refetchQueries || \"\").length > 0 ||\n mutation.update ||\n mutation.onQueryUpdated ||\n mutation.removeOptimistic) {\n var results_1 = [];\n this.refetchQueries({\n updateCache: function (cache) {\n if (!skipCache) {\n cacheWrites.forEach(function (write) { return cache.write(write); });\n }\n // If the mutation has some writes associated with it then we need to\n // apply those writes to the store by running this reducer again with\n // a write action.\n var update = mutation.update;\n // Determine whether result is a SingleExecutionResult,\n // or the final ExecutionPatchResult.\n var isFinalResult = !isExecutionPatchResult(result) ||\n (isExecutionPatchIncrementalResult(result) && !result.hasNext);\n if (update) {\n if (!skipCache) {\n // Re-read the ROOT_MUTATION data we just wrote into the cache\n // (the first cache.write call in the cacheWrites.forEach loop\n // above), so field read functions have a chance to run for\n // fields within mutation result objects.\n var diff = cache.diff({\n id: \"ROOT_MUTATION\",\n // The cache complains if passed a mutation where it expects a\n // query, so we transform mutations and subscriptions to queries\n // (only once, thanks to this.transformCache).\n query: _this.getDocumentInfo(mutation.document).asQuery,\n variables: mutation.variables,\n optimistic: false,\n returnPartialData: true,\n });\n if (diff.complete) {\n result = __assign(__assign({}, result), { data: diff.result });\n if (\"incremental\" in result) {\n delete result.incremental;\n }\n if (\"hasNext\" in result) {\n delete result.hasNext;\n }\n }\n }\n // If we've received the whole response,\n // either a SingleExecutionResult or the final ExecutionPatchResult,\n // call the update function.\n if (isFinalResult) {\n update(cache, result, {\n context: mutation.context,\n variables: mutation.variables,\n });\n }\n }\n // TODO Do this with cache.evict({ id: 'ROOT_MUTATION' }) but make it\n // shallow to allow rolling back optimistic evictions.\n if (!skipCache && !mutation.keepRootFields && isFinalResult) {\n cache.modify({\n id: \"ROOT_MUTATION\",\n fields: function (value, _a) {\n var fieldName = _a.fieldName, DELETE = _a.DELETE;\n return fieldName === \"__typename\" ? value : DELETE;\n },\n });\n }\n },\n include: mutation.refetchQueries,\n // Write the final mutation.result to the root layer of the cache.\n optimistic: false,\n // Remove the corresponding optimistic layer at the same time as we\n // write the final non-optimistic result.\n removeOptimistic: mutation.removeOptimistic,\n // Let the caller of client.mutate optionally determine the refetching\n // behavior for watched queries after the mutation.update function runs.\n // If no onQueryUpdated function was provided for this mutation, pass\n // null instead of undefined to disable the default refetching behavior.\n onQueryUpdated: mutation.onQueryUpdated || null,\n }).forEach(function (result) { return results_1.push(result); });\n if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) {\n // Returning a promise here makes the mutation await that promise, so we\n // include results in that promise's work if awaitRefetchQueries or an\n // onQueryUpdated function was specified.\n return Promise.all(results_1).then(function () { return result; });\n }\n }\n return Promise.resolve(result);\n };\n QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {\n var _this = this;\n var data = typeof optimisticResponse === \"function\" ?\n optimisticResponse(mutation.variables, { IGNORE: IGNORE })\n : optimisticResponse;\n if (data === IGNORE) {\n return false;\n }\n this.cache.recordOptimisticTransaction(function (cache) {\n try {\n _this.markMutationResult(__assign(__assign({}, mutation), { result: { data: data } }), cache);\n }\n catch (error) {\n globalThis.__DEV__ !== false && invariant.error(error);\n }\n }, mutation.mutationId);\n return true;\n };\n QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) {\n return this.fetchConcastWithInfo(queryId, options, networkStatus).concast\n .promise;\n };\n QueryManager.prototype.getQueryStore = function () {\n var store = Object.create(null);\n this.queries.forEach(function (info, queryId) {\n store[queryId] = {\n variables: info.variables,\n networkStatus: info.networkStatus,\n networkError: info.networkError,\n graphQLErrors: info.graphQLErrors,\n };\n });\n return store;\n };\n QueryManager.prototype.resetErrors = function (queryId) {\n var queryInfo = this.queries.get(queryId);\n if (queryInfo) {\n queryInfo.networkError = undefined;\n queryInfo.graphQLErrors = [];\n }\n };\n QueryManager.prototype.transform = function (document) {\n return this.documentTransform.transformDocument(document);\n };\n QueryManager.prototype.getDocumentInfo = function (document) {\n var transformCache = this.transformCache;\n if (!transformCache.has(document)) {\n var cacheEntry = {\n // TODO These three calls (hasClientExports, shouldForceResolvers, and\n // usesNonreactiveDirective) are performing independent full traversals\n // of the transformed document. We should consider merging these\n // traversals into a single pass in the future, though the work is\n // cached after the first time.\n hasClientExports: hasClientExports(document),\n hasForcedResolvers: this.localState.shouldForceResolvers(document),\n hasNonreactiveDirective: hasDirectives([\"nonreactive\"], document),\n clientQuery: this.localState.clientQuery(document),\n serverQuery: removeDirectivesFromDocument([\n { name: \"client\", remove: true },\n { name: \"connection\" },\n { name: \"nonreactive\" },\n ], document),\n defaultVars: getDefaultValues(getOperationDefinition(document)),\n // Transform any mutation or subscription operations to query operations\n // so we can read/write them from/to the cache.\n asQuery: __assign(__assign({}, document), { definitions: document.definitions.map(function (def) {\n if (def.kind === \"OperationDefinition\" &&\n def.operation !== \"query\") {\n return __assign(__assign({}, def), { operation: \"query\" });\n }\n return def;\n }) }),\n };\n transformCache.set(document, cacheEntry);\n }\n return transformCache.get(document);\n };\n QueryManager.prototype.getVariables = function (document, variables) {\n return __assign(__assign({}, this.getDocumentInfo(document).defaultVars), variables);\n };\n QueryManager.prototype.watchQuery = function (options) {\n var query = this.transform(options.query);\n // assign variable default values if supplied\n // NOTE: We don't modify options.query here with the transformed query to\n // ensure observable.options.query is set to the raw untransformed query.\n options = __assign(__assign({}, options), { variables: this.getVariables(query, options.variables) });\n if (typeof options.notifyOnNetworkStatusChange === \"undefined\") {\n options.notifyOnNetworkStatusChange = false;\n }\n var queryInfo = new QueryInfo(this);\n var observable = new ObservableQuery({\n queryManager: this,\n queryInfo: queryInfo,\n options: options,\n });\n observable[\"lastQuery\"] = query;\n this.queries.set(observable.queryId, queryInfo);\n // We give queryInfo the transformed query to ensure the first cache diff\n // uses the transformed query instead of the raw query\n queryInfo.init({\n document: query,\n observableQuery: observable,\n variables: observable.variables,\n });\n return observable;\n };\n QueryManager.prototype.query = function (options, queryId) {\n var _this = this;\n if (queryId === void 0) { queryId = this.generateQueryId(); }\n invariant(options.query, 28);\n invariant(options.query.kind === \"Document\", 29);\n invariant(!options.returnPartialData, 30);\n invariant(!options.pollInterval, 31);\n return this.fetchQuery(queryId, __assign(__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });\n };\n QueryManager.prototype.generateQueryId = function () {\n return String(this.queryIdCounter++);\n };\n QueryManager.prototype.generateRequestId = function () {\n return this.requestIdCounter++;\n };\n QueryManager.prototype.generateMutationId = function () {\n return String(this.mutationIdCounter++);\n };\n QueryManager.prototype.stopQueryInStore = function (queryId) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.broadcastQueries();\n };\n QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) {\n var queryInfo = this.queries.get(queryId);\n if (queryInfo)\n queryInfo.stop();\n };\n QueryManager.prototype.clearStore = function (options) {\n if (options === void 0) { options = {\n discardWatches: true,\n }; }\n // Before we have sent the reset action to the store, we can no longer\n // rely on the results returned by in-flight requests since these may\n // depend on values that previously existed in the data portion of the\n // store. So, we cancel the promises and observers that we have issued\n // so far and not yet resolved (in the case of queries).\n this.cancelPendingFetches(newInvariantError(32));\n this.queries.forEach(function (queryInfo) {\n if (queryInfo.observableQuery) {\n // Set loading to true so listeners don't trigger unless they want\n // results with partial data.\n queryInfo.networkStatus = NetworkStatus.loading;\n }\n else {\n queryInfo.stop();\n }\n });\n if (this.mutationStore) {\n this.mutationStore = Object.create(null);\n }\n // begin removing data from the store\n return this.cache.reset(options);\n };\n QueryManager.prototype.getObservableQueries = function (include) {\n var _this = this;\n if (include === void 0) { include = \"active\"; }\n var queries = new Map();\n var queryNamesAndDocs = new Map();\n var legacyQueryOptions = new Set();\n if (Array.isArray(include)) {\n include.forEach(function (desc) {\n if (typeof desc === \"string\") {\n queryNamesAndDocs.set(desc, false);\n }\n else if (isDocumentNode(desc)) {\n queryNamesAndDocs.set(_this.transform(desc), false);\n }\n else if (isNonNullObject(desc) && desc.query) {\n legacyQueryOptions.add(desc);\n }\n });\n }\n this.queries.forEach(function (_a, queryId) {\n var oq = _a.observableQuery, document = _a.document;\n if (oq) {\n if (include === \"all\") {\n queries.set(queryId, oq);\n return;\n }\n var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy;\n if (fetchPolicy === \"standby\" ||\n (include === \"active\" && !oq.hasObservers())) {\n return;\n }\n if (include === \"active\" ||\n (queryName && queryNamesAndDocs.has(queryName)) ||\n (document && queryNamesAndDocs.has(document))) {\n queries.set(queryId, oq);\n if (queryName)\n queryNamesAndDocs.set(queryName, true);\n if (document)\n queryNamesAndDocs.set(document, true);\n }\n }\n });\n if (legacyQueryOptions.size) {\n legacyQueryOptions.forEach(function (options) {\n // We will be issuing a fresh network request for this query, so we\n // pre-allocate a new query ID here, using a special prefix to enable\n // cleaning up these temporary queries later, after fetching.\n var queryId = makeUniqueId(\"legacyOneTimeQuery\");\n var queryInfo = _this.getQuery(queryId).init({\n document: options.query,\n variables: options.variables,\n });\n var oq = new ObservableQuery({\n queryManager: _this,\n queryInfo: queryInfo,\n options: __assign(__assign({}, options), { fetchPolicy: \"network-only\" }),\n });\n invariant(oq.queryId === queryId);\n queryInfo.setObservableQuery(oq);\n queries.set(queryId, oq);\n });\n }\n if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {\n queryNamesAndDocs.forEach(function (included, nameOrDoc) {\n if (!included) {\n globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === \"string\" ? 33 : 34, nameOrDoc);\n }\n });\n }\n return queries;\n };\n QueryManager.prototype.reFetchObservableQueries = function (includeStandby) {\n var _this = this;\n if (includeStandby === void 0) { includeStandby = false; }\n var observableQueryPromises = [];\n this.getObservableQueries(includeStandby ? \"all\" : \"active\").forEach(function (observableQuery, queryId) {\n var fetchPolicy = observableQuery.options.fetchPolicy;\n observableQuery.resetLastResults();\n if (includeStandby ||\n (fetchPolicy !== \"standby\" && fetchPolicy !== \"cache-only\")) {\n observableQueryPromises.push(observableQuery.refetch());\n }\n _this.getQuery(queryId).setDiff(null);\n });\n this.broadcastQueries();\n return Promise.all(observableQueryPromises);\n };\n QueryManager.prototype.setObservableQuery = function (observableQuery) {\n this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery);\n };\n QueryManager.prototype.startGraphQLSubscription = function (_a) {\n var _this = this;\n var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? \"none\" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c;\n query = this.transform(query);\n variables = this.getVariables(query, variables);\n var makeObservable = function (variables) {\n return _this.getObservableFromLink(query, context, variables).map(function (result) {\n if (fetchPolicy !== \"no-cache\") {\n // the subscription interface should handle not sending us results we no longer subscribe to.\n // XXX I don't think we ever send in an object with errors, but we might in the future...\n if (shouldWriteResult(result, errorPolicy)) {\n _this.cache.write({\n query: query,\n result: result.data,\n dataId: \"ROOT_SUBSCRIPTION\",\n variables: variables,\n });\n }\n _this.broadcastQueries();\n }\n var hasErrors = graphQLResultHasError(result);\n var hasProtocolErrors = graphQLResultHasProtocolErrors(result);\n if (hasErrors || hasProtocolErrors) {\n var errors = {};\n if (hasErrors) {\n errors.graphQLErrors = result.errors;\n }\n if (hasProtocolErrors) {\n errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL];\n }\n // `errorPolicy` is a mechanism for handling GraphQL errors, according\n // to our documentation, so we throw protocol errors regardless of the\n // set error policy.\n if (errorPolicy === \"none\" || hasProtocolErrors) {\n throw new ApolloError(errors);\n }\n }\n if (errorPolicy === \"ignore\") {\n delete result.errors;\n }\n return result;\n });\n };\n if (this.getDocumentInfo(query).hasClientExports) {\n var observablePromise_1 = this.localState\n .addExportedVariables(query, variables, context)\n .then(makeObservable);\n return new Observable(function (observer) {\n var sub = null;\n observablePromise_1.then(function (observable) { return (sub = observable.subscribe(observer)); }, observer.error);\n return function () { return sub && sub.unsubscribe(); };\n });\n }\n return makeObservable(variables);\n };\n QueryManager.prototype.stopQuery = function (queryId) {\n this.stopQueryNoBroadcast(queryId);\n this.broadcastQueries();\n };\n QueryManager.prototype.stopQueryNoBroadcast = function (queryId) {\n this.stopQueryInStoreNoBroadcast(queryId);\n this.removeQuery(queryId);\n };\n QueryManager.prototype.removeQuery = function (queryId) {\n // teardown all links\n // Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises\n // that each add their reject functions to fetchCancelFns.\n // A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.\n // The same queryId could have two rejection fns for two promises\n this.fetchCancelFns.delete(queryId);\n if (this.queries.has(queryId)) {\n this.getQuery(queryId).stop();\n this.queries.delete(queryId);\n }\n };\n QueryManager.prototype.broadcastQueries = function () {\n if (this.onBroadcast)\n this.onBroadcast();\n this.queries.forEach(function (info) { return info.notify(); });\n };\n QueryManager.prototype.getLocalState = function () {\n return this.localState;\n };\n QueryManager.prototype.getObservableFromLink = function (query, context, variables, \n // Prefer context.queryDeduplication if specified.\n deduplication) {\n var _this = this;\n var _a;\n if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }\n var observable;\n var _b = this.getDocumentInfo(query), serverQuery = _b.serverQuery, clientQuery = _b.clientQuery;\n if (serverQuery) {\n var _c = this, inFlightLinkObservables_1 = _c.inFlightLinkObservables, link = _c.link;\n var operation = {\n query: serverQuery,\n variables: variables,\n operationName: getOperationName(serverQuery) || void 0,\n context: this.prepareContext(__assign(__assign({}, context), { forceFetch: !deduplication })),\n };\n context = operation.context;\n if (deduplication) {\n var printedServerQuery_1 = print(serverQuery);\n var varJson_1 = canonicalStringify(variables);\n var entry = inFlightLinkObservables_1.lookup(printedServerQuery_1, varJson_1);\n observable = entry.observable;\n if (!observable) {\n var concast = new Concast([\n execute(link, operation),\n ]);\n observable = entry.observable = concast;\n concast.beforeNext(function () {\n inFlightLinkObservables_1.remove(printedServerQuery_1, varJson_1);\n });\n }\n }\n else {\n observable = new Concast([\n execute(link, operation),\n ]);\n }\n }\n else {\n observable = new Concast([Observable.of({ data: {} })]);\n context = this.prepareContext(context);\n }\n if (clientQuery) {\n observable = asyncMap(observable, function (result) {\n return _this.localState.runResolvers({\n document: clientQuery,\n remoteResult: result,\n context: context,\n variables: variables,\n });\n });\n }\n return observable;\n };\n QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) {\n var requestId = (queryInfo.lastRequestId = this.generateRequestId());\n // Performing transformForLink here gives this.cache a chance to fill in\n // missing fragment definitions (for example) before sending this document\n // through the link chain.\n var linkDocument = this.cache.transformForLink(options.query);\n return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {\n var graphQLErrors = getGraphQLErrorsFromResult(result);\n var hasErrors = graphQLErrors.length > 0;\n // If we interrupted this request by calling getResultsFromLink again\n // with the same QueryInfo object, we ignore the old results.\n if (requestId >= queryInfo.lastRequestId) {\n if (hasErrors && options.errorPolicy === \"none\") {\n // Throwing here effectively calls observer.error.\n throw queryInfo.markError(new ApolloError({\n graphQLErrors: graphQLErrors,\n }));\n }\n // Use linkDocument rather than queryInfo.document so the\n // operation/fragments used to write the result are the same as the\n // ones used to obtain it from the link.\n queryInfo.markResult(result, linkDocument, options, cacheWriteBehavior);\n queryInfo.markReady();\n }\n var aqr = {\n data: result.data,\n loading: false,\n networkStatus: NetworkStatus.ready,\n };\n if (hasErrors && options.errorPolicy !== \"ignore\") {\n aqr.errors = graphQLErrors;\n aqr.networkStatus = NetworkStatus.error;\n }\n return aqr;\n }, function (networkError) {\n var error = isApolloError(networkError) ? networkError : (new ApolloError({ networkError: networkError }));\n // Avoid storing errors from older interrupted queries.\n if (requestId >= queryInfo.lastRequestId) {\n queryInfo.markError(error);\n }\n throw error;\n });\n };\n QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, \n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus, query) {\n var _this = this;\n if (networkStatus === void 0) { networkStatus = NetworkStatus.loading; }\n if (query === void 0) { query = options.query; }\n var variables = this.getVariables(query, options.variables);\n var queryInfo = this.getQuery(queryId);\n var defaults = this.defaultOptions.watchQuery;\n var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || \"cache-first\" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || \"none\" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e;\n var normalized = Object.assign({}, options, {\n query: query,\n variables: variables,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n returnPartialData: returnPartialData,\n notifyOnNetworkStatusChange: notifyOnNetworkStatusChange,\n context: context,\n });\n var fromVariables = function (variables) {\n // Since normalized is always a fresh copy of options, it's safe to\n // modify its properties here, rather than creating yet another new\n // WatchQueryOptions object.\n normalized.variables = variables;\n var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);\n if (\n // If we're in standby, postpone advancing options.fetchPolicy using\n // applyNextFetchPolicy.\n normalized.fetchPolicy !== \"standby\" &&\n // The \"standby\" policy currently returns [] from fetchQueryByPolicy, so\n // this is another way to detect when nothing was done/fetched.\n sourcesWithInfo.sources.length > 0 &&\n queryInfo.observableQuery) {\n queryInfo.observableQuery[\"applyNextFetchPolicy\"](\"after-fetch\", options);\n }\n return sourcesWithInfo;\n };\n // This cancel function needs to be set before the concast is created,\n // in case concast creation synchronously cancels the request.\n var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); };\n this.fetchCancelFns.set(queryId, function (reason) {\n cleanupCancelFn();\n // This delay ensures the concast variable has been initialized.\n setTimeout(function () { return concast.cancel(reason); });\n });\n var concast, containsDataFromLink;\n // If the query has @export(as: ...) directives, then we need to\n // process those directives asynchronously. When there are no\n // @export directives (the common case), we deliberately avoid\n // wrapping the result of this.fetchQueryByPolicy in a Promise,\n // since the timing of result delivery is (unfortunately) important\n // for backwards compatibility. TODO This code could be simpler if\n // we deprecated and removed LocalState.\n if (this.getDocumentInfo(normalized.query).hasClientExports) {\n concast = new Concast(this.localState\n .addExportedVariables(normalized.query, normalized.variables, normalized.context)\n .then(fromVariables)\n .then(function (sourcesWithInfo) { return sourcesWithInfo.sources; }));\n // there is just no way we can synchronously get the *right* value here,\n // so we will assume `true`, which is the behaviour before the bug fix in\n // #10597. This means that bug is not fixed in that case, and is probably\n // un-fixable with reasonable effort for the edge case of @export as\n // directives.\n containsDataFromLink = true;\n }\n else {\n var sourcesWithInfo = fromVariables(normalized.variables);\n containsDataFromLink = sourcesWithInfo.fromLink;\n concast = new Concast(sourcesWithInfo.sources);\n }\n concast.promise.then(cleanupCancelFn, cleanupCancelFn);\n return {\n concast: concast,\n fromLink: containsDataFromLink,\n };\n };\n QueryManager.prototype.refetchQueries = function (_a) {\n var _this = this;\n var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? makeUniqueId(\"refetchQueries\") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated;\n var includedQueriesById = new Map();\n if (include) {\n this.getObservableQueries(include).forEach(function (oq, queryId) {\n includedQueriesById.set(queryId, {\n oq: oq,\n lastDiff: _this.getQuery(queryId).getDiff(),\n });\n });\n }\n var results = new Map();\n if (updateCache) {\n this.cache.batch({\n update: updateCache,\n // Since you can perform any combination of cache reads and/or writes in\n // the cache.batch update function, its optimistic option can be either\n // a boolean or a string, representing three distinct modes of\n // operation:\n //\n // * false: read/write only the root layer\n // * true: read/write the topmost layer\n // * string: read/write a fresh optimistic layer with that ID string\n //\n // When typeof optimistic === \"string\", a new optimistic layer will be\n // temporarily created within cache.batch with that string as its ID. If\n // we then pass that same string as the removeOptimistic option, we can\n // make cache.batch immediately remove the optimistic layer after\n // running the updateCache function, triggering only one broadcast.\n //\n // However, the refetchQueries method accepts only true or false for its\n // optimistic option (not string). We interpret true to mean a temporary\n // optimistic layer should be created, to allow efficiently rolling back\n // the effect of the updateCache function, which involves passing a\n // string instead of true as the optimistic option to cache.batch, when\n // refetchQueries receives optimistic: true.\n //\n // In other words, we are deliberately not supporting the use case of\n // writing to an *existing* optimistic layer (using the refetchQueries\n // updateCache function), since that would potentially interfere with\n // other optimistic updates in progress. Instead, you can read/write\n // only the root layer by passing optimistic: false to refetchQueries,\n // or you can read/write a brand new optimistic layer that will be\n // automatically removed by passing optimistic: true.\n optimistic: (optimistic && removeOptimistic) || false,\n // The removeOptimistic option can also be provided by itself, even if\n // optimistic === false, to remove some previously-added optimistic\n // layer safely and efficiently, like we do in markMutationResult.\n //\n // If an explicit removeOptimistic string is provided with optimistic:\n // true, the removeOptimistic string will determine the ID of the\n // temporary optimistic layer, in case that ever matters.\n removeOptimistic: removeOptimistic,\n onWatchUpdated: function (watch, diff, lastDiff) {\n var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery;\n if (oq) {\n if (onQueryUpdated) {\n // Since we're about to handle this query now, remove it from\n // includedQueriesById, in case it was added earlier because of\n // options.include.\n includedQueriesById.delete(oq.queryId);\n var result = onQueryUpdated(oq, diff, lastDiff);\n if (result === true) {\n // The onQueryUpdated function requested the default refetching\n // behavior by returning true.\n result = oq.refetch();\n }\n // Record the result in the results Map, as long as onQueryUpdated\n // did not return false to skip/ignore this result.\n if (result !== false) {\n results.set(oq, result);\n }\n // Allow the default cache broadcast to happen, except when\n // onQueryUpdated returns false.\n return result;\n }\n if (onQueryUpdated !== null) {\n // If we don't have an onQueryUpdated function, and onQueryUpdated\n // was not disabled by passing null, make sure this query is\n // \"included\" like any other options.include-specified query.\n includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff });\n }\n }\n },\n });\n }\n if (includedQueriesById.size) {\n includedQueriesById.forEach(function (_a, queryId) {\n var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff;\n var result;\n // If onQueryUpdated is provided, we want to use it for all included\n // queries, even the QueryOptions ones.\n if (onQueryUpdated) {\n if (!diff) {\n var info = oq[\"queryInfo\"];\n info.reset(); // Force info.getDiff() to read from cache.\n diff = info.getDiff();\n }\n result = onQueryUpdated(oq, diff, lastDiff);\n }\n // Otherwise, we fall back to refetching.\n if (!onQueryUpdated || result === true) {\n result = oq.refetch();\n }\n if (result !== false) {\n results.set(oq, result);\n }\n if (queryId.indexOf(\"legacyOneTimeQuery\") >= 0) {\n _this.stopQueryNoBroadcast(queryId);\n }\n });\n }\n if (removeOptimistic) {\n // In case no updateCache callback was provided (so cache.batch was not\n // called above, and thus did not already remove the optimistic layer),\n // remove it here. Since this is a no-op when the layer has already been\n // removed, we do it even if we called cache.batch above, since it's\n // possible this.cache is an instance of some ApolloCache subclass other\n // than InMemoryCache, and does not fully support the removeOptimistic\n // option for cache.batch.\n this.cache.removeOptimistic(removeOptimistic);\n }\n return results;\n };\n QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, \n // The initial networkStatus for this fetch, most often\n // NetworkStatus.loading, but also possibly fetchMore, poll, refetch,\n // or setVariables.\n networkStatus) {\n var _this = this;\n var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange;\n var oldNetworkStatus = queryInfo.networkStatus;\n queryInfo.init({\n document: query,\n variables: variables,\n networkStatus: networkStatus,\n });\n var readCache = function () { return queryInfo.getDiff(); };\n var resultsFromCache = function (diff, networkStatus) {\n if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || NetworkStatus.loading; }\n var data = diff.result;\n if (globalThis.__DEV__ !== false && !returnPartialData && !equal(data, {})) {\n logMissingFieldErrors(diff.missing);\n }\n var fromData = function (data) {\n return Observable.of(__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true })));\n };\n if (data && _this.getDocumentInfo(query).hasForcedResolvers) {\n return _this.localState\n .runResolvers({\n document: query,\n remoteResult: { data: data },\n context: context,\n variables: variables,\n onlyRunForcedResolvers: true,\n })\n .then(function (resolved) { return fromData(resolved.data || void 0); });\n }\n // Resolves https://github.com/apollographql/apollo-client/issues/10317.\n // If errorPolicy is 'none' and notifyOnNetworkStatusChange is true,\n // data was incorrectly returned from the cache on refetch:\n // if diff.missing exists, we should not return cache data.\n if (errorPolicy === \"none\" &&\n networkStatus === NetworkStatus.refetch &&\n Array.isArray(diff.missing)) {\n return fromData(void 0);\n }\n return fromData(data);\n };\n var cacheWriteBehavior = fetchPolicy === \"no-cache\" ? 0 /* CacheWriteBehavior.FORBID */\n // Watched queries must opt into overwriting existing data on refetch,\n // by passing refetchWritePolicy: \"overwrite\" in their WatchQueryOptions.\n : (networkStatus === NetworkStatus.refetch &&\n refetchWritePolicy !== \"merge\") ?\n 1 /* CacheWriteBehavior.OVERWRITE */\n : 2 /* CacheWriteBehavior.MERGE */;\n var resultsFromLink = function () {\n return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {\n query: query,\n variables: variables,\n context: context,\n fetchPolicy: fetchPolicy,\n errorPolicy: errorPolicy,\n });\n };\n var shouldNotify = notifyOnNetworkStatusChange &&\n typeof oldNetworkStatus === \"number\" &&\n oldNetworkStatus !== networkStatus &&\n isNetworkRequestInFlight(networkStatus);\n switch (fetchPolicy) {\n default:\n case \"cache-first\": {\n var diff = readCache();\n if (diff.complete) {\n return {\n fromLink: false,\n sources: [resultsFromCache(diff, queryInfo.markReady())],\n };\n }\n if (returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n case \"cache-and-network\": {\n var diff = readCache();\n if (diff.complete || returnPartialData || shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(diff), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n }\n case \"cache-only\":\n return {\n fromLink: false,\n sources: [resultsFromCache(readCache(), queryInfo.markReady())],\n };\n case \"network-only\":\n if (shouldNotify) {\n return {\n fromLink: true,\n sources: [resultsFromCache(readCache()), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n case \"no-cache\":\n if (shouldNotify) {\n return {\n fromLink: true,\n // Note that queryInfo.getDiff() for no-cache queries does not call\n // cache.diff, but instead returns a { complete: false } stub result\n // when there is no queryInfo.diff already defined.\n sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()],\n };\n }\n return { fromLink: true, sources: [resultsFromLink()] };\n case \"standby\":\n return { fromLink: false, sources: [] };\n }\n };\n QueryManager.prototype.getQuery = function (queryId) {\n if (queryId && !this.queries.has(queryId)) {\n this.queries.set(queryId, new QueryInfo(this, queryId));\n }\n return this.queries.get(queryId);\n };\n QueryManager.prototype.prepareContext = function (context) {\n if (context === void 0) { context = {}; }\n var newContext = this.localState.prepareContext(context);\n return __assign(__assign(__assign({}, this.defaultContext), newContext), { clientAwareness: this.clientAwareness });\n };\n return QueryManager;\n}());\nexport { QueryManager };\n//# sourceMappingURL=QueryManager.js.map","import { __assign } from \"tslib\";\nimport { global } from \"../globals/index.js\";\nvar cacheSizeSymbol = Symbol.for(\"apollo.cacheSize\");\n/**\n *\n * The global cache size configuration for Apollo Client.\n *\n * @remarks\n *\n * You can directly modify this object, but any modification will\n * only have an effect on caches that are created after the modification.\n *\n * So for global caches, such as `parser`, `canonicalStringify` and `print`,\n * you might need to call `.reset` on them, which will essentially re-create them.\n *\n * Alternatively, you can set `globalThis[Symbol.for(\"apollo.cacheSize\")]` before\n * you load the Apollo Client package:\n *\n * @example\n * ```ts\n * globalThis[Symbol.for(\"apollo.cacheSize\")] = {\n * parser: 100\n * } satisfies Partial // the `satisfies` is optional if using TypeScript\n * ```\n */\nexport var cacheSizes = __assign({}, global[cacheSizeSymbol]);\n//# sourceMappingURL=sizes.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { __assign } from \"tslib\";\nimport { invariant, newInvariantError } from \"../utilities/globals/index.js\";\nimport { ApolloLink, execute } from \"../link/core/index.js\";\nimport { version } from \"../version.js\";\nimport { HttpLink } from \"../link/http/index.js\";\nimport { QueryManager } from \"./QueryManager.js\";\nimport { LocalState } from \"./LocalState.js\";\nvar hasSuggestedDevtools = false;\n// Though mergeOptions now resides in @apollo/client/utilities, it was\n// previously declared and exported from this module, and then reexported from\n// @apollo/client/core. Since we need to preserve that API anyway, the easiest\n// solution is to reexport mergeOptions where it was previously declared (here).\nimport { mergeOptions } from \"../utilities/index.js\";\nimport { getApolloClientMemoryInternals } from \"../utilities/caching/getMemoryInternals.js\";\nexport { mergeOptions };\n/**\n * This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries\n * and mutations) to a GraphQL spec-compliant server over an {@link ApolloLink} instance,\n * receive results from the server and cache the results in a store. It also delivers updates\n * to GraphQL queries through {@link Observable} instances.\n */\nvar ApolloClient = /** @class */ (function () {\n /**\n * Constructs an instance of {@link ApolloClient}.\n *\n * @example\n * ```js\n * import { ApolloClient, InMemoryCache } from '@apollo/client';\n *\n * const cache = new InMemoryCache();\n *\n * const client = new ApolloClient({\n * // Provide required constructor fields\n * cache: cache,\n * uri: 'http://localhost:4000/',\n *\n * // Provide some optional constructor fields\n * name: 'react-web-client',\n * version: '1.3',\n * queryDeduplication: false,\n * defaultOptions: {\n * watchQuery: {\n * fetchPolicy: 'cache-and-network',\n * },\n * },\n * });\n * ```\n */\n function ApolloClient(options) {\n var _this = this;\n this.resetStoreCallbacks = [];\n this.clearStoreCallbacks = [];\n if (!options.cache) {\n throw newInvariantError(15);\n }\n var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, \n // Expose the client instance as window.__APOLLO_CLIENT__ and call\n // onBroadcast in queryManager.broadcastQueries to enable browser\n // devtools, but disable them by default in production.\n _c = options.connectToDevTools, \n // Expose the client instance as window.__APOLLO_CLIENT__ and call\n // onBroadcast in queryManager.broadcastQueries to enable browser\n // devtools, but disable them by default in production.\n connectToDevTools = _c === void 0 ? typeof window === \"object\" &&\n !window.__APOLLO_CLIENT__ &&\n globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;\n var link = options.link;\n if (!link) {\n link =\n uri ? new HttpLink({ uri: uri, credentials: credentials, headers: headers }) : ApolloLink.empty();\n }\n this.link = link;\n this.cache = cache;\n this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0;\n this.queryDeduplication = queryDeduplication;\n this.defaultOptions = defaultOptions || Object.create(null);\n this.typeDefs = typeDefs;\n if (ssrForceFetchDelay) {\n setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay);\n }\n this.watchQuery = this.watchQuery.bind(this);\n this.query = this.query.bind(this);\n this.mutate = this.mutate.bind(this);\n this.resetStore = this.resetStore.bind(this);\n this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);\n this.version = version;\n this.localState = new LocalState({\n cache: cache,\n client: this,\n resolvers: resolvers,\n fragmentMatcher: fragmentMatcher,\n });\n this.queryManager = new QueryManager({\n cache: this.cache,\n link: this.link,\n defaultOptions: this.defaultOptions,\n defaultContext: defaultContext,\n documentTransform: documentTransform,\n queryDeduplication: queryDeduplication,\n ssrMode: ssrMode,\n clientAwareness: {\n name: clientAwarenessName,\n version: clientAwarenessVersion,\n },\n localState: this.localState,\n assumeImmutableResults: assumeImmutableResults,\n onBroadcast: connectToDevTools ?\n function () {\n if (_this.devToolsHookCb) {\n _this.devToolsHookCb({\n action: {},\n state: {\n queries: _this.queryManager.getQueryStore(),\n mutations: _this.queryManager.mutationStore || {},\n },\n dataWithOptimisticResults: _this.cache.extract(true),\n });\n }\n }\n : void 0,\n });\n if (connectToDevTools)\n this.connectToDevTools();\n }\n ApolloClient.prototype.connectToDevTools = function () {\n if (typeof window === \"object\") {\n var windowWithDevTools = window;\n var devtoolsSymbol = Symbol.for(\"apollo.devtools\");\n (windowWithDevTools[devtoolsSymbol] =\n windowWithDevTools[devtoolsSymbol] || []).push(this);\n windowWithDevTools.__APOLLO_CLIENT__ = this;\n }\n /**\n * Suggest installing the devtools for developers who don't have them\n */\n if (!hasSuggestedDevtools && globalThis.__DEV__ !== false) {\n hasSuggestedDevtools = true;\n setTimeout(function () {\n if (typeof window !== \"undefined\" &&\n window.document &&\n window.top === window.self &&\n !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {\n var nav = window.navigator;\n var ua = nav && nav.userAgent;\n var url = void 0;\n if (typeof ua === \"string\") {\n if (ua.indexOf(\"Chrome/\") > -1) {\n url =\n \"https://chrome.google.com/webstore/detail/\" +\n \"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm\";\n }\n else if (ua.indexOf(\"Firefox/\") > -1) {\n url =\n \"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/\";\n }\n }\n if (url) {\n globalThis.__DEV__ !== false && invariant.log(\"Download the Apollo DevTools for a better development \" +\n \"experience: %s\", url);\n }\n }\n }, 10000);\n }\n };\n Object.defineProperty(ApolloClient.prototype, \"documentTransform\", {\n /**\n * The `DocumentTransform` used to modify GraphQL documents before a request\n * is made. If a custom `DocumentTransform` is not provided, this will be the\n * default document transform.\n */\n get: function () {\n return this.queryManager.documentTransform;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Call this method to terminate any active client processes, making it safe\n * to dispose of this `ApolloClient` instance.\n */\n ApolloClient.prototype.stop = function () {\n this.queryManager.stop();\n };\n /**\n * This watches the cache store of the query according to the options specified and\n * returns an {@link ObservableQuery}. We can subscribe to this {@link ObservableQuery} and\n * receive updated results through a GraphQL observer when the cache store changes.\n *\n * Note that this method is not an implementation of GraphQL subscriptions. Rather,\n * it uses Apollo's store in order to reactively deliver updates to your query results.\n *\n * For example, suppose you call watchQuery on a GraphQL query that fetches a person's\n * first and last name and this person has a particular object identifier, provided by\n * dataIdFromObject. Later, a different query fetches that same person's\n * first and last name and the first name has now changed. Then, any observers associated\n * with the results of the first query will be updated with a new result object.\n *\n * Note that if the cache does not change, the subscriber will *not* be notified.\n *\n * See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for\n * a description of store reactivity.\n */\n ApolloClient.prototype.watchQuery = function (options) {\n if (this.defaultOptions.watchQuery) {\n options = mergeOptions(this.defaultOptions.watchQuery, options);\n }\n // XXX Overwriting options is probably not the best way to do this long term...\n if (this.disableNetworkFetches &&\n (options.fetchPolicy === \"network-only\" ||\n options.fetchPolicy === \"cache-and-network\")) {\n options = __assign(__assign({}, options), { fetchPolicy: \"cache-first\" });\n }\n return this.queryManager.watchQuery(options);\n };\n /**\n * This resolves a single query according to the options specified and\n * returns a `Promise` which is either resolved with the resulting data\n * or rejected with an error.\n *\n * @param options - An object of type {@link QueryOptions} that allows us to\n * describe how this query should be treated e.g. whether it should hit the\n * server at all or just resolve from the cache, etc.\n */\n ApolloClient.prototype.query = function (options) {\n if (this.defaultOptions.query) {\n options = mergeOptions(this.defaultOptions.query, options);\n }\n invariant(options.fetchPolicy !== \"cache-and-network\", 16);\n if (this.disableNetworkFetches && options.fetchPolicy === \"network-only\") {\n options = __assign(__assign({}, options), { fetchPolicy: \"cache-first\" });\n }\n return this.queryManager.query(options);\n };\n /**\n * This resolves a single mutation according to the options specified and returns a\n * Promise which is either resolved with the resulting data or rejected with an\n * error. In some cases both `data` and `errors` might be undefined, for example\n * when `errorPolicy` is set to `'ignore'`.\n *\n * It takes options as an object with the following keys and values:\n */\n ApolloClient.prototype.mutate = function (options) {\n if (this.defaultOptions.mutate) {\n options = mergeOptions(this.defaultOptions.mutate, options);\n }\n return this.queryManager.mutate(options);\n };\n /**\n * This subscribes to a graphql subscription according to the options specified and returns an\n * {@link Observable} which either emits received data or an error.\n */\n ApolloClient.prototype.subscribe = function (options) {\n return this.queryManager.startGraphQLSubscription(options);\n };\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL query without making a network request. This method will start at\n * the root query. To start at a specific id returned by `dataIdFromObject`\n * use `readFragment`.\n *\n * @param optimistic - Set to `true` to allow `readQuery` to return\n * optimistic results. Is `false` by default.\n */\n ApolloClient.prototype.readQuery = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return this.cache.readQuery(options, optimistic);\n };\n /**\n * Tries to read some data from the store in the shape of the provided\n * GraphQL fragment without making a network request. This method will read a\n * GraphQL fragment from any arbitrary id that is currently cached, unlike\n * `readQuery` which will only read from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are reading. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n *\n * @param optimistic - Set to `true` to allow `readFragment` to return\n * optimistic results. Is `false` by default.\n */\n ApolloClient.prototype.readFragment = function (options, optimistic) {\n if (optimistic === void 0) { optimistic = false; }\n return this.cache.readFragment(options, optimistic);\n };\n /**\n * Writes some data in the shape of the provided GraphQL query directly to\n * the store. This method will start at the root query. To start at a\n * specific id returned by `dataIdFromObject` then use `writeFragment`.\n */\n ApolloClient.prototype.writeQuery = function (options) {\n var ref = this.cache.writeQuery(options);\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n return ref;\n };\n /**\n * Writes some data in the shape of the provided GraphQL fragment directly to\n * the store. This method will write to a GraphQL fragment from any arbitrary\n * id that is currently cached, unlike `writeQuery` which will only write\n * from the root query.\n *\n * You must pass in a GraphQL document with a single fragment or a document\n * with multiple fragments that represent what you are writing. If you pass\n * in a document with multiple fragments then you must also specify a\n * `fragmentName`.\n */\n ApolloClient.prototype.writeFragment = function (options) {\n var ref = this.cache.writeFragment(options);\n if (options.broadcast !== false) {\n this.queryManager.broadcastQueries();\n }\n return ref;\n };\n ApolloClient.prototype.__actionHookForDevTools = function (cb) {\n this.devToolsHookCb = cb;\n };\n ApolloClient.prototype.__requestRaw = function (payload) {\n return execute(this.link, payload);\n };\n /**\n * Resets your entire store by clearing out your cache and then re-executing\n * all of your active queries. This makes it so that you may guarantee that\n * there is no data left in your store from a time before you called this\n * method.\n *\n * `resetStore()` is useful when your user just logged out. You’ve removed the\n * user session, and you now want to make sure that any references to data you\n * might have fetched while the user session was active is gone.\n *\n * It is important to remember that `resetStore()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n ApolloClient.prototype.resetStore = function () {\n var _this = this;\n return Promise.resolve()\n .then(function () {\n return _this.queryManager.clearStore({\n discardWatches: false,\n });\n })\n .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); })\n .then(function () { return _this.reFetchObservableQueries(); });\n };\n /**\n * Remove all data from the store. Unlike `resetStore`, `clearStore` will\n * not refetch any active queries.\n */\n ApolloClient.prototype.clearStore = function () {\n var _this = this;\n return Promise.resolve()\n .then(function () {\n return _this.queryManager.clearStore({\n discardWatches: true,\n });\n })\n .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); });\n };\n /**\n * Allows callbacks to be registered that are executed when the store is\n * reset. `onResetStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n ApolloClient.prototype.onResetStore = function (cb) {\n var _this = this;\n this.resetStoreCallbacks.push(cb);\n return function () {\n _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; });\n };\n };\n /**\n * Allows callbacks to be registered that are executed when the store is\n * cleared. `onClearStore` returns an unsubscribe function that can be used\n * to remove registered callbacks.\n */\n ApolloClient.prototype.onClearStore = function (cb) {\n var _this = this;\n this.clearStoreCallbacks.push(cb);\n return function () {\n _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; });\n };\n };\n /**\n * Refetches all of your active queries.\n *\n * `reFetchObservableQueries()` is useful if you want to bring the client back to proper state in case of a network outage\n *\n * It is important to remember that `reFetchObservableQueries()` *will* refetch any active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n * Takes optional parameter `includeStandby` which will include queries in standby-mode when refetching.\n */\n ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) {\n return this.queryManager.reFetchObservableQueries(includeStandby);\n };\n /**\n * Refetches specified active queries. Similar to \"reFetchObservableQueries()\" but with a specific list of queries.\n *\n * `refetchQueries()` is useful for use cases to imperatively refresh a selection of queries.\n *\n * It is important to remember that `refetchQueries()` *will* refetch specified active\n * queries. This means that any components that might be mounted will execute\n * their queries again using your network interface. If you do not want to\n * re-execute any queries then you should make sure to stop watching any\n * active queries.\n */\n ApolloClient.prototype.refetchQueries = function (options) {\n var map = this.queryManager.refetchQueries(options);\n var queries = [];\n var results = [];\n map.forEach(function (result, obsQuery) {\n queries.push(obsQuery);\n results.push(result);\n });\n var result = Promise.all(results);\n // In case you need the raw results immediately, without awaiting\n // Promise.all(results):\n result.queries = queries;\n result.results = results;\n // If you decide to ignore the result Promise because you're using\n // result.queries and result.results instead, you shouldn't have to worry\n // about preventing uncaught rejections for the Promise.all result.\n result.catch(function (error) {\n globalThis.__DEV__ !== false && invariant.debug(17, error);\n });\n return result;\n };\n /**\n * Get all currently active `ObservableQuery` objects, in a `Map` keyed by\n * query ID strings.\n *\n * An \"active\" query is one that has observers and a `fetchPolicy` other than\n * \"standby\" or \"cache-only\".\n *\n * You can include all `ObservableQuery` objects (including the inactive ones)\n * by passing \"all\" instead of \"active\", or you can include just a subset of\n * active queries by passing an array of query names or DocumentNode objects.\n */\n ApolloClient.prototype.getObservableQueries = function (include) {\n if (include === void 0) { include = \"active\"; }\n return this.queryManager.getObservableQueries(include);\n };\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n ApolloClient.prototype.extract = function (optimistic) {\n return this.cache.extract(optimistic);\n };\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n ApolloClient.prototype.restore = function (serializedState) {\n return this.cache.restore(serializedState);\n };\n /**\n * Add additional local resolvers.\n */\n ApolloClient.prototype.addResolvers = function (resolvers) {\n this.localState.addResolvers(resolvers);\n };\n /**\n * Set (override existing) local resolvers.\n */\n ApolloClient.prototype.setResolvers = function (resolvers) {\n this.localState.setResolvers(resolvers);\n };\n /**\n * Get all registered local resolvers.\n */\n ApolloClient.prototype.getResolvers = function () {\n return this.localState.getResolvers();\n };\n /**\n * Set a custom local state fragment matcher.\n */\n ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) {\n this.localState.setFragmentMatcher(fragmentMatcher);\n };\n /**\n * Define a new ApolloLink (or link chain) that Apollo Client will use.\n */\n ApolloClient.prototype.setLink = function (newLink) {\n this.link = this.queryManager.link = newLink;\n };\n Object.defineProperty(ApolloClient.prototype, \"defaultContext\", {\n get: function () {\n return this.queryManager.defaultContext;\n },\n enumerable: false,\n configurable: true\n });\n return ApolloClient;\n}());\nexport { ApolloClient };\nif (globalThis.__DEV__ !== false) {\n ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals;\n}\n//# sourceMappingURL=ApolloClient.js.map","/* Core */\nexport { ApolloClient, mergeOptions } from \"./ApolloClient.js\";\nexport { ObservableQuery } from \"./ObservableQuery.js\";\nexport { NetworkStatus, isNetworkRequestSettled } from \"./networkStatus.js\";\nexport * from \"./types.js\";\nexport { isApolloError, ApolloError } from \"../errors/index.js\";\nexport { Cache, ApolloCache, InMemoryCache, MissingFieldError, defaultDataIdFromObject, makeVar, } from \"../cache/index.js\";\nexport * from \"../cache/inmemory/types.js\";\n/* Link */\nexport * from \"../link/core/index.js\";\nexport * from \"../link/http/index.js\";\nexport { fromError, toPromise, fromPromise, throwServerError, } from \"../link/utils/index.js\";\nexport { DocumentTransform, Observable, isReference, makeReference, } from \"../utilities/index.js\";\n/* Supporting */\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// (for anyone using the same ts-invariant package) by passing \"log\",\n// \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nimport { setVerbosity } from \"ts-invariant\";\nexport { setVerbosity as setLogVerbosity };\nsetVerbosity(globalThis.__DEV__ !== false ? \"log\" : \"silent\");\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport { gql, resetCaches, disableFragmentWarnings, enableExperimentalFragmentVariables, disableExperimentalFragmentVariables, } from \"graphql-tag\";\n//# sourceMappingURL=index.js.map"],"names":["hasOwnProperty","__spreadArray","__assign","NetworkStatus","__rest","equal","getMainDefinition","createFragmentMap","getFragmentDefinitions","shouldInclude","isField","resultKeyNameFromField","getFragmentFromSelection","__extends","getOperationDefinition","getQueryDefinition","invariant","compact","cloneDeep","iterateObserversSafely","Observable","fixObservableSubclass","mergeDeep","__awaiter","__generator","hasDirectives","removeClientSetsFromDocument","visit","BREAK","buildQueryFromSelectionSet","isInlineFragment","mergeDeepArray","cacheSlot","argumentsObjectFromField","isSelectionNode","canUseWeakMap","DeepMerger","isNonEmptyArray","mergeIncrementalData","graphQLResultHasError","AutoCleanedWeakCache","cacheSizes","Trie","DocumentTransform","newInvariantError","asyncMap","ApolloError","getGraphQLErrorsFromResult","isExecutionPatchIncrementalResult","getOperationName","isExecutionPatchResult","hasClientExports","removeDirectivesFromDocument","getDefaultValues","isDocumentNode","isNonNullObject","makeUniqueId","graphQLResultHasProtocolErrors","errors","PROTOCOL_ERRORS_SYMBOL","print","canonicalStringify","Concast","execute","isApolloError","global","HttpLink","ApolloLink","mergeOptions","setVerbosity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,IAAI,OAAO,GAAG,OAAO;;ACArB,SAAS,eAAe,CAAC,GAAG,EAAE;AACrC,IAAI,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC;AACnD;;ACAO,SAAS,eAAe,CAAC,KAAK,EAAE;AACvC,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAA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AACrD,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,SAAS,EAAE,gBAAgB,EAAE;AACpE,QAAQ,GAAG,EAAE,YAAY;AACzB,YAAY,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;AACpD,SAAS;AACT,QAAQ,UAAU,EAAE,KAAK;AACzB,QAAQ,YAAY,EAAE,IAAI;AAC1B,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,YAAY,CAAC;AACxB,CAAC,EAAE,EAAE;AAEL,IAAI,UAAU,CAAC,OAAO,KAAK,KAAK,EAAE;AAClC,IAAI,YAAY,CAAC,SAAS,CAAC,kBAAkB,GAAG,8BAA8B,CAAC;AAC/E;;ACteAqD,wBAAY,CAAC,UAAU,CAAC,OAAO,KAAK,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/core.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/core/core.cjs.native.js new file mode 100644 index 0000000..f15ae51 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/core.cjs.native.js @@ -0,0 +1,2642 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var globals = require('../utilities/globals'); +var core = require('../link/core'); +var http = require('../link/http'); +var equal = require('@wry/equality'); +var utilities = require('../utilities'); +var cache = require('../cache'); +var errors = require('../errors'); +var graphql = require('graphql'); +var trie = require('@wry/trie'); +var utils = require('../link/utils'); +var tsInvariant = require('ts-invariant'); +var graphqlTag = require('graphql-tag'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; } + +var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal); + +var version = "3.9.5"; + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} + +var hasOwnProperty$2 = Object.prototype.hasOwnProperty; +var defaultReconciler = function (target, source, property) { + return this.merge(target[property], source[property]); +}; +var DeepMerger = (function () { + function DeepMerger(reconciler) { + if (reconciler === void 0) { reconciler = defaultReconciler; } + this.reconciler = reconciler; + this.isObject = isNonNullObject; + this.pastCopies = new Set(); + } + DeepMerger.prototype.merge = function (target, source) { + var _this = this; + var context = []; + for (var _i = 2; _i < arguments.length; _i++) { + context[_i - 2] = arguments[_i]; + } + if (isNonNullObject(source) && isNonNullObject(target)) { + Object.keys(source).forEach(function (sourceKey) { + if (hasOwnProperty$2.call(target, sourceKey)) { + var targetValue = target[sourceKey]; + if (source[sourceKey] !== targetValue) { + var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, + source, + sourceKey], context, false)); + if (result !== targetValue) { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = result; + } + } + } + else { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = source[sourceKey]; + } + }); + return target; + } + return source; + }; + DeepMerger.prototype.shallowCopyForMerge = function (value) { + if (isNonNullObject(value)) { + if (!this.pastCopies.has(value)) { + if (Array.isArray(value)) { + value = value.slice(0); + } + else { + value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + this.pastCopies.add(value); + } + } + return value; + }; + return DeepMerger; +}()); + +function isExecutionPatchIncrementalResult(value) { + return "incremental" in value; +} +function mergeIncrementalData(prevResult, result) { + var mergedData = prevResult; + var merger = new DeepMerger(); + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (_a) { + var data = _a.data, path = _a.path; + for (var i = path.length - 1; i >= 0; --i) { + var key = path[i]; + var isNumericKey = !isNaN(+key); + var parent_1 = isNumericKey ? [] : {}; + parent_1[key] = data; + data = parent_1; + } + mergedData = merger.merge(mergedData, data); + }); + } + return mergedData; +} + +exports.NetworkStatus = void 0; +(function (NetworkStatus) { + NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; + NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; + NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; + NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; + NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; + NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; + NetworkStatus[NetworkStatus["error"] = 8] = "error"; +})(exports.NetworkStatus || (exports.NetworkStatus = {})); +function isNetworkRequestInFlight(networkStatus) { + return networkStatus ? networkStatus < 7 : false; +} +function isNetworkRequestSettled(networkStatus) { + return networkStatus === 7 || networkStatus === 8; +} + +function equalByQuery(query, _a, _b, variables) { + var aData = _a.data, aRest = tslib.__rest(_a, ["data"]); + var bData = _b.data, bRest = tslib.__rest(_b, ["data"]); + return (equal__default(aRest, bRest) && + equalBySelectionSet(utilities.getMainDefinition(query).selectionSet, aData, bData, { + fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(query)), + variables: variables, + })); +} +function equalBySelectionSet(selectionSet, aResult, bResult, context) { + if (aResult === bResult) { + return true; + } + var seenSelections = new Set(); + return selectionSet.selections.every(function (selection) { + if (seenSelections.has(selection)) + return true; + seenSelections.add(selection); + if (!utilities.shouldInclude(selection, context.variables)) + return true; + if (selectionHasNonreactiveDirective(selection)) + return true; + if (utilities.isField(selection)) { + var resultKey = utilities.resultKeyNameFromField(selection); + var aResultChild = aResult && aResult[resultKey]; + var bResultChild = bResult && bResult[resultKey]; + var childSelectionSet = selection.selectionSet; + if (!childSelectionSet) { + return equal__default(aResultChild, bResultChild); + } + var aChildIsArray = Array.isArray(aResultChild); + var bChildIsArray = Array.isArray(bResultChild); + if (aChildIsArray !== bChildIsArray) + return false; + if (aChildIsArray && bChildIsArray) { + var length_1 = aResultChild.length; + if (bResultChild.length !== length_1) { + return false; + } + for (var i = 0; i < length_1; ++i) { + if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) { + return false; + } + } + return true; + } + return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context); + } + else { + var fragment = utilities.getFragmentFromSelection(selection, context.fragmentMap); + if (fragment) { + if (selectionHasNonreactiveDirective(fragment)) + return true; + return equalBySelectionSet(fragment.selectionSet, + aResult, bResult, context); + } + } + }); +} +function selectionHasNonreactiveDirective(selection) { + return (!!selection.directives && selection.directives.some(directiveIsNonreactive)); +} +function directiveIsNonreactive(dir) { + return dir.name.value === "nonreactive"; +} + +var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty; +var ObservableQuery = (function (_super) { + tslib.__extends(ObservableQuery, _super); + function ObservableQuery(_a) { + var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options; + var _this = _super.call(this, function (observer) { + try { + var subObserver = observer._subscription._observer; + if (subObserver && !subObserver.error) { + subObserver.error = defaultSubscriptionObserverErrorCallback; + } + } + catch (_a) { } + var first = !_this.observers.size; + _this.observers.add(observer); + var last = _this.last; + if (last && last.error) { + observer.error && observer.error(last.error); + } + else if (last && last.result) { + observer.next && observer.next(last.result); + } + if (first) { + _this.reobserve().catch(function () { }); + } + return function () { + if (_this.observers.delete(observer) && !_this.observers.size) { + _this.tearDownQuery(); + } + }; + }) || this; + _this.observers = new Set(); + _this.subscriptions = new Set(); + _this.queryInfo = queryInfo; + _this.queryManager = queryManager; + _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy); + _this.isTornDown = false; + var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d; + var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, + _f = options.initialFetchPolicy, + initialFetchPolicy = _f === void 0 ? fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy) : _f; + _this.options = tslib.__assign(tslib.__assign({}, options), { + initialFetchPolicy: initialFetchPolicy, + fetchPolicy: fetchPolicy }); + _this.queryId = queryInfo.queryId || queryManager.generateQueryId(); + var opDef = utilities.getOperationDefinition(_this.query); + _this.queryName = opDef && opDef.name && opDef.name.value; + return _this; + } + Object.defineProperty(ObservableQuery.prototype, "query", { + get: function () { + return this.lastQuery || this.options.query; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservableQuery.prototype, "variables", { + get: function () { + return this.options.variables; + }, + enumerable: false, + configurable: true + }); + ObservableQuery.prototype.result = function () { + var _this = this; + return new Promise(function (resolve, reject) { + var observer = { + next: function (result) { + resolve(result); + _this.observers.delete(observer); + if (!_this.observers.size) { + _this.queryManager.removeQuery(_this.queryId); + } + setTimeout(function () { + subscription.unsubscribe(); + }, 0); + }, + error: reject, + }; + var subscription = _this.subscribe(observer); + }); + }; + ObservableQuery.prototype.resetDiff = function () { + this.queryInfo.resetDiff(); + }; + ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) { + if (saveAsLastResult === void 0) { saveAsLastResult = true; } + var lastResult = this.getLastResult(true); + var networkStatus = this.queryInfo.networkStatus || + (lastResult && lastResult.networkStatus) || + exports.NetworkStatus.ready; + var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }); + var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a; + if ( + skipCacheDataFor(fetchPolicy) || + this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) ; + else if (this.waitForOwnResult) { + this.queryInfo["updateWatch"](); + } + else { + var diff = this.queryInfo.getDiff(); + if (diff.complete || this.options.returnPartialData) { + result.data = diff.result; + } + if (equal.equal(result.data, {})) { + result.data = void 0; + } + if (diff.complete) { + delete result.partial; + if (diff.complete && + result.networkStatus === exports.NetworkStatus.loading && + (fetchPolicy === "cache-first" || fetchPolicy === "cache-only")) { + result.networkStatus = exports.NetworkStatus.ready; + result.loading = false; + } + } + else { + result.partial = true; + } + if (globalThis.__DEV__ !== false && + !diff.complete && + !this.options.partialRefetch && + !result.loading && + !result.data && + !result.error) { + logMissingFieldErrors(diff.missing); + } + } + if (saveAsLastResult) { + this.updateLastResult(result); + } + return result; + }; + ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) { + if (!this.last) { + return true; + } + var resultIsDifferent = this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ? + !equalByQuery(this.query, this.last.result, newResult, this.variables) + : !equal.equal(this.last.result, newResult); + return (resultIsDifferent || (variables && !equal.equal(this.last.variables, variables))); + }; + ObservableQuery.prototype.getLast = function (key, variablesMustMatch) { + var last = this.last; + if (last && + last[key] && + (!variablesMustMatch || equal.equal(last.variables, this.variables))) { + return last[key]; + } + }; + ObservableQuery.prototype.getLastResult = function (variablesMustMatch) { + return this.getLast("result", variablesMustMatch); + }; + ObservableQuery.prototype.getLastError = function (variablesMustMatch) { + return this.getLast("error", variablesMustMatch); + }; + ObservableQuery.prototype.resetLastResults = function () { + delete this.last; + this.isTornDown = false; + }; + ObservableQuery.prototype.resetQueryStoreErrors = function () { + this.queryManager.resetErrors(this.queryId); + }; + ObservableQuery.prototype.refetch = function (variables) { + var _a; + var reobserveOptions = { + pollInterval: 0, + }; + var fetchPolicy = this.options.fetchPolicy; + if (fetchPolicy === "cache-and-network") { + reobserveOptions.fetchPolicy = fetchPolicy; + } + else if (fetchPolicy === "no-cache") { + reobserveOptions.fetchPolicy = "no-cache"; + } + else { + reobserveOptions.fetchPolicy = "network-only"; + } + if (globalThis.__DEV__ !== false && variables && hasOwnProperty$1.call(variables, "variables")) { + var queryDef = utilities.getQueryDefinition(this.query); + var vars = queryDef.variableDefinitions; + if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) { + globalThis.__DEV__ !== false && globals.invariant.warn( + 20, + variables, + ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef + ); + } + } + if (variables && !equal.equal(this.options.variables, variables)) { + reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables); + } + this.queryInfo.resetLastWrite(); + return this.reobserve(reobserveOptions, exports.NetworkStatus.refetch); + }; + ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { + var _this = this; + var combinedOptions = tslib.__assign(tslib.__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: tslib.__assign(tslib.__assign({}, this.options.variables), fetchMoreOptions.variables) })))), { + fetchPolicy: "no-cache" }); + combinedOptions.query = this.transformDocument(combinedOptions.query); + var qid = this.queryManager.generateQueryId(); + this.lastQuery = + fetchMoreOptions.query ? + this.transformDocument(this.options.query) + : combinedOptions.query; + var queryInfo = this.queryInfo; + var originalNetworkStatus = queryInfo.networkStatus; + queryInfo.networkStatus = exports.NetworkStatus.fetchMore; + if (combinedOptions.notifyOnNetworkStatusChange) { + this.observe(); + } + var updatedQuerySet = new Set(); + return this.queryManager + .fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore) + .then(function (fetchMoreResult) { + _this.queryManager.removeQuery(qid); + if (queryInfo.networkStatus === exports.NetworkStatus.fetchMore) { + queryInfo.networkStatus = originalNetworkStatus; + } + _this.queryManager.cache.batch({ + update: function (cache) { + var updateQuery = fetchMoreOptions.updateQuery; + if (updateQuery) { + cache.updateQuery({ + query: _this.query, + variables: _this.variables, + returnPartialData: true, + optimistic: false, + }, function (previous) { + return updateQuery(previous, { + fetchMoreResult: fetchMoreResult.data, + variables: combinedOptions.variables, + }); + }); + } + else { + cache.writeQuery({ + query: combinedOptions.query, + variables: combinedOptions.variables, + data: fetchMoreResult.data, + }); + } + }, + onWatchUpdated: function (watch) { + updatedQuerySet.add(watch.query); + }, + }); + return fetchMoreResult; + }) + .finally(function () { + if (!updatedQuerySet.has(_this.query)) { + reobserveCacheFirst(_this); + } + }); + }; + ObservableQuery.prototype.subscribeToMore = function (options) { + var _this = this; + var subscription = this.queryManager + .startGraphQLSubscription({ + query: options.document, + variables: options.variables, + context: options.context, + }) + .subscribe({ + next: function (subscriptionData) { + var updateQuery = options.updateQuery; + if (updateQuery) { + _this.updateQuery(function (previous, _a) { + var variables = _a.variables; + return updateQuery(previous, { + subscriptionData: subscriptionData, + variables: variables, + }); + }); + } + }, + error: function (err) { + if (options.onError) { + options.onError(err); + return; + } + globalThis.__DEV__ !== false && globals.invariant.error(21, err); + }, + }); + this.subscriptions.add(subscription); + return function () { + if (_this.subscriptions.delete(subscription)) { + subscription.unsubscribe(); + } + }; + }; + ObservableQuery.prototype.setOptions = function (newOptions) { + return this.reobserve(newOptions); + }; + ObservableQuery.prototype.silentSetOptions = function (newOptions) { + var mergedOptions = utilities.compact(this.options, newOptions || {}); + assign(this.options, mergedOptions); + }; + ObservableQuery.prototype.setVariables = function (variables) { + if (equal.equal(this.variables, variables)) { + return this.observers.size ? this.result() : Promise.resolve(); + } + this.options.variables = variables; + if (!this.observers.size) { + return Promise.resolve(); + } + return this.reobserve({ + fetchPolicy: this.options.initialFetchPolicy, + variables: variables, + }, exports.NetworkStatus.setVariables); + }; + ObservableQuery.prototype.updateQuery = function (mapFn) { + var queryManager = this.queryManager; + var result = queryManager.cache.diff({ + query: this.options.query, + variables: this.variables, + returnPartialData: true, + optimistic: false, + }).result; + var newResult = mapFn(result, { + variables: this.variables, + }); + if (newResult) { + queryManager.cache.writeQuery({ + query: this.options.query, + data: newResult, + variables: this.variables, + }); + queryManager.broadcastQueries(); + } + }; + ObservableQuery.prototype.startPolling = function (pollInterval) { + this.options.pollInterval = pollInterval; + this.updatePolling(); + }; + ObservableQuery.prototype.stopPolling = function () { + this.options.pollInterval = 0; + this.updatePolling(); + }; + ObservableQuery.prototype.applyNextFetchPolicy = function (reason, + options) { + if (options.nextFetchPolicy) { + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b; + if (fetchPolicy === "standby") ; + else if (typeof options.nextFetchPolicy === "function") { + options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, { + reason: reason, + options: options, + observable: this, + initialFetchPolicy: initialFetchPolicy, + }); + } + else if (reason === "variables-changed") { + options.fetchPolicy = initialFetchPolicy; + } + else { + options.fetchPolicy = options.nextFetchPolicy; + } + } + return options.fetchPolicy; + }; + ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) { + this.queryManager.setObservableQuery(this); + return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query); + }; + ObservableQuery.prototype.updatePolling = function () { + var _this = this; + if (this.queryManager.ssrMode) { + return; + } + var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval; + if (!pollInterval) { + if (pollingInfo) { + clearTimeout(pollingInfo.timeout); + delete this.pollingInfo; + } + return; + } + if (pollingInfo && pollingInfo.interval === pollInterval) { + return; + } + globals.invariant(pollInterval, 22); + var info = pollingInfo || (this.pollingInfo = {}); + info.interval = pollInterval; + var maybeFetch = function () { + var _a, _b; + if (_this.pollingInfo) { + if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) && + !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) { + _this.reobserve({ + fetchPolicy: _this.options.initialFetchPolicy === "no-cache" ? + "no-cache" + : "network-only", + }, exports.NetworkStatus.poll).then(poll, poll); + } + else { + poll(); + } + } + }; + var poll = function () { + var info = _this.pollingInfo; + if (info) { + clearTimeout(info.timeout); + info.timeout = setTimeout(maybeFetch, info.interval); + } + }; + poll(); + }; + ObservableQuery.prototype.updateLastResult = function (newResult, variables) { + if (variables === void 0) { variables = this.variables; } + var error = this.getLastError(); + if (error && this.last && !equal.equal(variables, this.last.variables)) { + error = void 0; + } + return (this.last = tslib.__assign({ result: this.queryManager.assumeImmutableResults ? + newResult + : utilities.cloneDeep(newResult), variables: variables }, (error ? { error: error } : null))); + }; + ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) { + var _this = this; + this.isTornDown = false; + var useDisposableConcast = + newNetworkStatus === exports.NetworkStatus.refetch || + newNetworkStatus === exports.NetworkStatus.fetchMore || + newNetworkStatus === exports.NetworkStatus.poll; + var oldVariables = this.options.variables; + var oldFetchPolicy = this.options.fetchPolicy; + var mergedOptions = utilities.compact(this.options, newOptions || {}); + var options = useDisposableConcast ? + mergedOptions + : assign(this.options, mergedOptions); + var query = this.transformDocument(options.query); + this.lastQuery = query; + if (!useDisposableConcast) { + this.updatePolling(); + if (newOptions && + newOptions.variables && + !equal.equal(newOptions.variables, oldVariables) && + options.fetchPolicy !== "standby" && + options.fetchPolicy === oldFetchPolicy) { + this.applyNextFetchPolicy("variables-changed", options); + if (newNetworkStatus === void 0) { + newNetworkStatus = exports.NetworkStatus.setVariables; + } + } + } + this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy)); + var finishWaitingForOwnResult = function () { + if (_this.concast === concast) { + _this.waitForOwnResult = false; + } + }; + var variables = options.variables && tslib.__assign({}, options.variables); + var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink; + var observer = { + next: function (result) { + if (equal.equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportResult(result, variables); + } + }, + error: function (error) { + if (equal.equal(_this.variables, variables)) { + finishWaitingForOwnResult(); + _this.reportError(error, variables); + } + }, + }; + if (!useDisposableConcast && (fromLink || !this.concast)) { + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + } + this.concast = concast; + this.observer = observer; + } + concast.addObserver(observer); + return concast; + }; + ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) { + return this.reobserveAsConcast(newOptions, newNetworkStatus) + .promise; + }; + ObservableQuery.prototype.resubscribeAfterError = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var last = this.last; + this.resetLastResults(); + var subscription = this.subscribe.apply(this, args); + this.last = last; + return subscription; + }; + ObservableQuery.prototype.observe = function () { + this.reportResult( + this.getCurrentResult(false), this.variables); + }; + ObservableQuery.prototype.reportResult = function (result, variables) { + var lastError = this.getLastError(); + var isDifferent = this.isDifferentFromLastResult(result, variables); + if (lastError || !result.partial || this.options.returnPartialData) { + this.updateLastResult(result, variables); + } + if (lastError || isDifferent) { + utilities.iterateObserversSafely(this.observers, "next", result); + } + }; + ObservableQuery.prototype.reportError = function (error, variables) { + var errorResult = tslib.__assign(tslib.__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false }); + this.updateLastResult(errorResult, variables); + utilities.iterateObserversSafely(this.observers, "error", (this.last.error = error)); + }; + ObservableQuery.prototype.hasObservers = function () { + return this.observers.size > 0; + }; + ObservableQuery.prototype.tearDownQuery = function () { + if (this.isTornDown) + return; + if (this.concast && this.observer) { + this.concast.removeObserver(this.observer); + delete this.concast; + delete this.observer; + } + this.stopPolling(); + this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); + this.subscriptions.clear(); + this.queryManager.stopQuery(this.queryId); + this.observers.clear(); + this.isTornDown = true; + }; + ObservableQuery.prototype.transformDocument = function (document) { + return this.queryManager.transform(document); + }; + return ObservableQuery; +}(utilities.Observable)); +utilities.fixObservableSubclass(ObservableQuery); +function reobserveCacheFirst(obsQuery) { + var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy; + if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") { + return obsQuery.reobserve({ + fetchPolicy: "cache-first", + nextFetchPolicy: function (currentFetchPolicy, context) { + this.nextFetchPolicy = nextFetchPolicy; + if (typeof this.nextFetchPolicy === "function") { + return this.nextFetchPolicy(currentFetchPolicy, context); + } + return fetchPolicy; + }, + }); + } + return obsQuery.reobserve(); +} +function defaultSubscriptionObserverErrorCallback(error) { + globalThis.__DEV__ !== false && globals.invariant.error(23, error.message, error.stack); +} +function logMissingFieldErrors(missing) { + if (globalThis.__DEV__ !== false && missing) { + globalThis.__DEV__ !== false && globals.invariant.debug(24, missing); + } +} +function skipCacheDataFor(fetchPolicy ) { + return (fetchPolicy === "network-only" || + fetchPolicy === "no-cache" || + fetchPolicy === "standby"); +} + +var LocalState = (function () { + function LocalState(_a) { + var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; + this.selectionsToResolveCache = new WeakMap(); + this.cache = cache; + if (client) { + this.client = client; + } + if (resolvers) { + this.addResolvers(resolvers); + } + if (fragmentMatcher) { + this.setFragmentMatcher(fragmentMatcher); + } + } + LocalState.prototype.addResolvers = function (resolvers) { + var _this = this; + this.resolvers = this.resolvers || {}; + if (Array.isArray(resolvers)) { + resolvers.forEach(function (resolverGroup) { + _this.resolvers = utilities.mergeDeep(_this.resolvers, resolverGroup); + }); + } + else { + this.resolvers = utilities.mergeDeep(this.resolvers, resolvers); + } + }; + LocalState.prototype.setResolvers = function (resolvers) { + this.resolvers = {}; + this.addResolvers(resolvers); + }; + LocalState.prototype.getResolvers = function () { + return this.resolvers || {}; + }; + LocalState.prototype.runResolvers = function (_a) { + var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_c) { + if (document) { + return [2 , this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })]; + } + return [2 , remoteResult]; + }); + }); + }; + LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { + this.fragmentMatcher = fragmentMatcher; + }; + LocalState.prototype.getFragmentMatcher = function () { + return this.fragmentMatcher; + }; + LocalState.prototype.clientQuery = function (document) { + if (utilities.hasDirectives(["client"], document)) { + if (this.resolvers) { + return document; + } + } + return null; + }; + LocalState.prototype.serverQuery = function (document) { + return utilities.removeClientSetsFromDocument(document); + }; + LocalState.prototype.prepareContext = function (context) { + var cache = this.cache; + return tslib.__assign(tslib.__assign({}, context), { cache: cache, + getCacheKey: function (obj) { + return cache.identify(obj); + } }); + }; + LocalState.prototype.addExportedVariables = function (document, variables, context) { + if (variables === void 0) { variables = {}; } + if (context === void 0) { context = {}; } + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + if (document) { + return [2 , this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })]; + } + return [2 , tslib.__assign({}, variables)]; + }); + }); + }; + LocalState.prototype.shouldForceResolvers = function (document) { + var forceResolvers = false; + graphql.visit(document, { + Directive: { + enter: function (node) { + if (node.name.value === "client" && node.arguments) { + forceResolvers = node.arguments.some(function (arg) { + return arg.name.value === "always" && + arg.value.kind === "BooleanValue" && + arg.value.value === true; + }); + if (forceResolvers) { + return graphql.BREAK; + } + } + }, + }, + }); + return forceResolvers; + }; + LocalState.prototype.buildRootValueFromCache = function (document, variables) { + return this.cache.diff({ + query: utilities.buildQueryFromSelectionSet(document), + variables: variables, + returnPartialData: true, + optimistic: false, + }).result; + }; + LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { + if (context === void 0) { context = {}; } + if (variables === void 0) { variables = {}; } + if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } + if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } + return tslib.__awaiter(this, void 0, void 0, function () { + var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant; + return tslib.__generator(this, function (_b) { + mainDefinition = utilities.getMainDefinition(document); + fragments = utilities.getFragmentDefinitions(document); + fragmentMap = utilities.createFragmentMap(fragments); + selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap); + definitionOperation = mainDefinition.operation; + defaultOperationType = definitionOperation ? + definitionOperation.charAt(0).toUpperCase() + + definitionOperation.slice(1) + : "Query"; + _a = this, cache = _a.cache, client = _a.client; + execContext = { + fragmentMap: fragmentMap, + context: tslib.__assign(tslib.__assign({}, context), { cache: cache, client: client }), + variables: variables, + fragmentMatcher: fragmentMatcher, + defaultOperationType: defaultOperationType, + exportedVariables: {}, + selectionsToResolve: selectionsToResolve, + onlyRunForcedResolvers: onlyRunForcedResolvers, + }; + isClientFieldDescendant = false; + return [2 , this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({ + result: result, + exportedVariables: execContext.exportedVariables, + }); })]; + }); + }); + }; + LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var fragmentMap, context, variables, resultsToMerge, execute; + var _this = this; + return tslib.__generator(this, function (_a) { + fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; + resultsToMerge = [rootValue]; + execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () { + var fragment, typeCondition; + return tslib.__generator(this, function (_a) { + if (!isClientFieldDescendant && + !execContext.selectionsToResolve.has(selection)) { + return [2 ]; + } + if (!utilities.shouldInclude(selection, variables)) { + return [2 ]; + } + if (utilities.isField(selection)) { + return [2 , this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) { + var _a; + if (typeof fieldResult !== "undefined") { + resultsToMerge.push((_a = {}, + _a[utilities.resultKeyNameFromField(selection)] = fieldResult, + _a)); + } + })]; + } + if (utilities.isInlineFragment(selection)) { + fragment = selection; + } + else { + fragment = fragmentMap[selection.name.value]; + globals.invariant(fragment, 18, selection.name.value); + } + if (fragment && fragment.typeCondition) { + typeCondition = fragment.typeCondition.name.value; + if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { + return [2 , this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) { + resultsToMerge.push(fragmentResult); + })]; + } + } + return [2 ]; + }); + }); }; + return [2 , Promise.all(selectionSet.selections.map(execute)).then(function () { + return utilities.mergeDeepArray(resultsToMerge); + })]; + }); + }); + }; + LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) { + return tslib.__awaiter(this, void 0, void 0, function () { + var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; + var _this = this; + return tslib.__generator(this, function (_a) { + if (!rootValue) { + return [2 , null]; + } + variables = execContext.variables; + fieldName = field.name.value; + aliasedFieldName = utilities.resultKeyNameFromField(field); + aliasUsed = fieldName !== aliasedFieldName; + defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; + resultPromise = Promise.resolve(defaultResult); + if (!execContext.onlyRunForcedResolvers || + this.shouldForceResolvers(field)) { + resolverType = rootValue.__typename || execContext.defaultOperationType; + resolverMap = this.resolvers && this.resolvers[resolverType]; + if (resolverMap) { + resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; + if (resolve) { + resultPromise = Promise.resolve( + cache.cacheSlot.withValue(this.cache, resolve, [ + rootValue, + utilities.argumentsObjectFromField(field, variables), + execContext.context, + { field: field, fragmentMap: execContext.fragmentMap }, + ])); + } + } + } + return [2 , resultPromise.then(function (result) { + var _a, _b; + if (result === void 0) { result = defaultResult; } + if (field.directives) { + field.directives.forEach(function (directive) { + if (directive.name.value === "export" && directive.arguments) { + directive.arguments.forEach(function (arg) { + if (arg.name.value === "as" && arg.value.kind === "StringValue") { + execContext.exportedVariables[arg.value.value] = result; + } + }); + } + }); + } + if (!field.selectionSet) { + return result; + } + if (result == null) { + return result; + } + var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === "client"; })) !== null && _b !== void 0 ? _b : false; + if (Array.isArray(result)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext); + } + })]; + }); + }); + }; + LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) { + var _this = this; + return Promise.all(result.map(function (item) { + if (item === null) { + return null; + } + if (Array.isArray(item)) { + return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext); + } + if (field.selectionSet) { + return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext); + } + })); + }; + LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) { + var isSingleASTNode = function (node) { return !Array.isArray(node); }; + var selectionsToResolveCache = this.selectionsToResolveCache; + function collectByDefinition(definitionNode) { + if (!selectionsToResolveCache.has(definitionNode)) { + var matches_1 = new Set(); + selectionsToResolveCache.set(definitionNode, matches_1); + graphql.visit(definitionNode, { + Directive: function (node, _, __, ___, ancestors) { + if (node.name.value === "client") { + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && graphql.isSelectionNode(node)) { + matches_1.add(node); + } + }); + } + }, + FragmentSpread: function (spread, _, __, ___, ancestors) { + var fragment = fragmentMap[spread.name.value]; + globals.invariant(fragment, 19, spread.name.value); + var fragmentSelections = collectByDefinition(fragment); + if (fragmentSelections.size > 0) { + ancestors.forEach(function (node) { + if (isSingleASTNode(node) && graphql.isSelectionNode(node)) { + matches_1.add(node); + } + }); + matches_1.add(spread); + fragmentSelections.forEach(function (selection) { + matches_1.add(selection); + }); + } + }, + }); + } + return selectionsToResolveCache.get(definitionNode); + } + return collectByDefinition(mainDefinition); + }; + return LocalState; +}()); + +var destructiveMethodCounts = new (utilities.canUseWeakMap ? WeakMap : Map)(); +function wrapDestructiveCacheMethod(cache, methodName) { + var original = cache[methodName]; + if (typeof original === "function") { + cache[methodName] = function () { + destructiveMethodCounts.set(cache, + (destructiveMethodCounts.get(cache) + 1) % 1e15); + return original.apply(this, arguments); + }; + } +} +function cancelNotifyTimeout(info) { + if (info["notifyTimeout"]) { + clearTimeout(info["notifyTimeout"]); + info["notifyTimeout"] = void 0; + } +} +var QueryInfo = (function () { + function QueryInfo(queryManager, queryId) { + if (queryId === void 0) { queryId = queryManager.generateQueryId(); } + this.queryId = queryId; + this.listeners = new Set(); + this.document = null; + this.lastRequestId = 1; + this.stopped = false; + this.dirty = false; + this.observableQuery = null; + var cache = (this.cache = queryManager.cache); + if (!destructiveMethodCounts.has(cache)) { + destructiveMethodCounts.set(cache, 0); + wrapDestructiveCacheMethod(cache, "evict"); + wrapDestructiveCacheMethod(cache, "modify"); + wrapDestructiveCacheMethod(cache, "reset"); + } + } + QueryInfo.prototype.init = function (query) { + var networkStatus = query.networkStatus || exports.NetworkStatus.loading; + if (this.variables && + this.networkStatus !== exports.NetworkStatus.loading && + !equal.equal(this.variables, query.variables)) { + networkStatus = exports.NetworkStatus.setVariables; + } + if (!equal.equal(query.variables, this.variables)) { + this.lastDiff = void 0; + } + Object.assign(this, { + document: query.document, + variables: query.variables, + networkError: null, + graphQLErrors: this.graphQLErrors || [], + networkStatus: networkStatus, + }); + if (query.observableQuery) { + this.setObservableQuery(query.observableQuery); + } + if (query.lastRequestId) { + this.lastRequestId = query.lastRequestId; + } + return this; + }; + QueryInfo.prototype.reset = function () { + cancelNotifyTimeout(this); + this.dirty = false; + }; + QueryInfo.prototype.resetDiff = function () { + this.lastDiff = void 0; + }; + QueryInfo.prototype.getDiff = function () { + var options = this.getDiffOptions(); + if (this.lastDiff && equal.equal(options, this.lastDiff.options)) { + return this.lastDiff.diff; + } + this.updateWatch(this.variables); + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return { complete: false }; + } + var diff = this.cache.diff(options); + this.updateLastDiff(diff, options); + return diff; + }; + QueryInfo.prototype.updateLastDiff = function (diff, options) { + this.lastDiff = + diff ? + { + diff: diff, + options: options || this.getDiffOptions(), + } + : void 0; + }; + QueryInfo.prototype.getDiffOptions = function (variables) { + var _a; + if (variables === void 0) { variables = this.variables; } + return { + query: this.document, + variables: variables, + returnPartialData: true, + optimistic: true, + canonizeResults: (_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.canonizeResults, + }; + }; + QueryInfo.prototype.setDiff = function (diff) { + var _this = this; + var _a; + var oldDiff = this.lastDiff && this.lastDiff.diff; + if (diff && + !diff.complete && + !((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.returnPartialData) && + !(oldDiff && oldDiff.complete)) { + return; + } + this.updateLastDiff(diff); + if (!this.dirty && !equal.equal(oldDiff && oldDiff.result, diff && diff.result)) { + this.dirty = true; + if (!this.notifyTimeout) { + this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0); + } + } + }; + QueryInfo.prototype.setObservableQuery = function (oq) { + var _this = this; + if (oq === this.observableQuery) + return; + if (this.oqListener) { + this.listeners.delete(this.oqListener); + } + this.observableQuery = oq; + if (oq) { + oq["queryInfo"] = this; + this.listeners.add((this.oqListener = function () { + var diff = _this.getDiff(); + if (diff.fromOptimisticTransaction) { + oq["observe"](); + } + else { + reobserveCacheFirst(oq); + } + })); + } + else { + delete this.oqListener; + } + }; + QueryInfo.prototype.notify = function () { + var _this = this; + cancelNotifyTimeout(this); + if (this.shouldNotify()) { + this.listeners.forEach(function (listener) { return listener(_this); }); + } + this.dirty = false; + }; + QueryInfo.prototype.shouldNotify = function () { + if (!this.dirty || !this.listeners.size) { + return false; + } + if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) { + var fetchPolicy = this.observableQuery.options.fetchPolicy; + if (fetchPolicy !== "cache-only" && fetchPolicy !== "cache-and-network") { + return false; + } + } + return true; + }; + QueryInfo.prototype.stop = function () { + if (!this.stopped) { + this.stopped = true; + this.reset(); + this.cancel(); + this.cancel = QueryInfo.prototype.cancel; + var oq = this.observableQuery; + if (oq) + oq.stopPolling(); + } + }; + QueryInfo.prototype.cancel = function () { }; + QueryInfo.prototype.updateWatch = function (variables) { + var _this = this; + if (variables === void 0) { variables = this.variables; } + var oq = this.observableQuery; + if (oq && oq.options.fetchPolicy === "no-cache") { + return; + } + var watchOptions = tslib.__assign(tslib.__assign({}, this.getDiffOptions(variables)), { watcher: this, callback: function (diff) { return _this.setDiff(diff); } }); + if (!this.lastWatch || !equal.equal(watchOptions, this.lastWatch)) { + this.cancel(); + this.cancel = this.cache.watch((this.lastWatch = watchOptions)); + } + }; + QueryInfo.prototype.resetLastWrite = function () { + this.lastWrite = void 0; + }; + QueryInfo.prototype.shouldWrite = function (result, variables) { + var lastWrite = this.lastWrite; + return !(lastWrite && + lastWrite.dmCount === destructiveMethodCounts.get(this.cache) && + equal.equal(variables, lastWrite.variables) && + equal.equal(result.data, lastWrite.result.data)); + }; + QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) { + var _this = this; + var merger = new utilities.DeepMerger(); + var graphQLErrors = utilities.isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + this.reset(); + if ("incremental" in result && utilities.isNonEmptyArray(result.incremental)) { + var mergedData = utilities.mergeIncrementalData(this.getDiff().result, result); + result.data = mergedData; + } + else if ("hasNext" in result && result.hasNext) { + var diff = this.getDiff(); + result.data = merger.merge(diff.result, result.data); + } + this.graphQLErrors = graphQLErrors; + if (options.fetchPolicy === "no-cache") { + this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables)); + } + else if (cacheWriteBehavior !== 0 ) { + if (shouldWriteResult(result, options.errorPolicy)) { + this.cache.performTransaction(function (cache) { + if (_this.shouldWrite(result, options.variables)) { + cache.writeQuery({ + query: document, + data: result.data, + variables: options.variables, + overwrite: cacheWriteBehavior === 1 , + }); + _this.lastWrite = { + result: result, + variables: options.variables, + dmCount: destructiveMethodCounts.get(_this.cache), + }; + } + else { + if (_this.lastDiff && _this.lastDiff.diff.complete) { + result.data = _this.lastDiff.diff.result; + return; + } + } + var diffOptions = _this.getDiffOptions(options.variables); + var diff = cache.diff(diffOptions); + if (!_this.stopped && equal.equal(_this.variables, options.variables)) { + _this.updateWatch(options.variables); + } + _this.updateLastDiff(diff, diffOptions); + if (diff.complete) { + result.data = diff.result; + } + }); + } + else { + this.lastWrite = void 0; + } + } + }; + QueryInfo.prototype.markReady = function () { + this.networkError = null; + return (this.networkStatus = exports.NetworkStatus.ready); + }; + QueryInfo.prototype.markError = function (error) { + this.networkStatus = exports.NetworkStatus.error; + this.lastWrite = void 0; + this.reset(); + if (error.graphQLErrors) { + this.graphQLErrors = error.graphQLErrors; + } + if (error.networkError) { + this.networkError = error.networkError; + } + return error; + }; + return QueryInfo; +}()); +function shouldWriteResult(result, errorPolicy) { + if (errorPolicy === void 0) { errorPolicy = "none"; } + var ignoreErrors = errorPolicy === "ignore" || errorPolicy === "all"; + var writeWithErrors = !utilities.graphQLResultHasError(result); + if (!writeWithErrors && ignoreErrors && result.data) { + writeWithErrors = true; + } + return writeWithErrors; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +var IGNORE = Object.create(null); +var QueryManager = (function () { + function QueryManager(_a) { + var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext; + var _this = this; + this.clientAwareness = {}; + this.queries = new Map(); + this.fetchCancelFns = new Map(); + this.transformCache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes["queryManager.getDocumentInfo"] || + 2000 ); + this.queryIdCounter = 1; + this.requestIdCounter = 1; + this.mutationIdCounter = 1; + this.inFlightLinkObservables = new trie.Trie(false); + var defaultDocumentTransform = new utilities.DocumentTransform(function (document) { return _this.cache.transformDocument(document); }, + { cache: false }); + this.cache = cache; + this.link = link; + this.defaultOptions = defaultOptions || Object.create(null); + this.queryDeduplication = queryDeduplication; + this.clientAwareness = clientAwareness; + this.localState = localState || new LocalState({ cache: cache }); + this.ssrMode = ssrMode; + this.assumeImmutableResults = assumeImmutableResults; + this.documentTransform = + documentTransform ? + defaultDocumentTransform + .concat(documentTransform) + .concat(defaultDocumentTransform) + : defaultDocumentTransform; + this.defaultContext = defaultContext || Object.create(null); + if ((this.onBroadcast = onBroadcast)) { + this.mutationStore = Object.create(null); + } + } + QueryManager.prototype.stop = function () { + var _this = this; + this.queries.forEach(function (_info, queryId) { + _this.stopQueryNoBroadcast(queryId); + }); + this.cancelPendingFetches(globals.newInvariantError(25)); + }; + QueryManager.prototype.cancelPendingFetches = function (error) { + this.fetchCancelFns.forEach(function (cancel) { return cancel(error); }); + this.fetchCancelFns.clear(); + }; + QueryManager.prototype.mutate = function (_a) { + var _b, _c; + var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || "network-only" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || "none" : _g, keepRootFields = _a.keepRootFields, context = _a.context; + return tslib.__awaiter(this, void 0, void 0, function () { + var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self; + return tslib.__generator(this, function (_h) { + switch (_h.label) { + case 0: + globals.invariant(mutation, 26); + globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27); + mutationId = this.generateMutationId(); + mutation = this.cache.transformForLink(this.transform(mutation)); + hasClientExports = this.getDocumentInfo(mutation).hasClientExports; + variables = this.getVariables(mutation, variables); + if (!hasClientExports) return [3 , 2]; + return [4 , this.localState.addExportedVariables(mutation, variables, context)]; + case 1: + variables = (_h.sent()); + _h.label = 2; + case 2: + mutationStoreValue = this.mutationStore && + (this.mutationStore[mutationId] = { + mutation: mutation, + variables: variables, + loading: true, + error: null, + }); + isOptimistic = optimisticResponse && + this.markMutationOptimistic(optimisticResponse, { + mutationId: mutationId, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + updateQueries: updateQueries, + update: updateWithProxyFn, + keepRootFields: keepRootFields, + }); + this.broadcastQueries(); + self = this; + return [2 , new Promise(function (resolve, reject) { + return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) { + if (utilities.graphQLResultHasError(result) && errorPolicy === "none") { + throw new errors.ApolloError({ + graphQLErrors: utilities.getGraphQLErrorsFromResult(result), + }); + } + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = null; + } + var storeResult = tslib.__assign({}, result); + if (typeof refetchQueries === "function") { + refetchQueries = refetchQueries(storeResult); + } + if (errorPolicy === "ignore" && utilities.graphQLResultHasError(storeResult)) { + delete storeResult.errors; + } + return self.markMutationResult({ + mutationId: mutationId, + result: storeResult, + document: mutation, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + context: context, + update: updateWithProxyFn, + updateQueries: updateQueries, + awaitRefetchQueries: awaitRefetchQueries, + refetchQueries: refetchQueries, + removeOptimistic: isOptimistic ? mutationId : void 0, + onQueryUpdated: onQueryUpdated, + keepRootFields: keepRootFields, + }); + }).subscribe({ + next: function (storeResult) { + self.broadcastQueries(); + if (!("hasNext" in storeResult) || storeResult.hasNext === false) { + resolve(storeResult); + } + }, + error: function (err) { + if (mutationStoreValue) { + mutationStoreValue.loading = false; + mutationStoreValue.error = err; + } + if (isOptimistic) { + self.cache.removeOptimistic(mutationId); + } + self.broadcastQueries(); + reject(err instanceof errors.ApolloError ? err : (new errors.ApolloError({ + networkError: err, + }))); + }, + }); + })]; + } + }); + }); + }; + QueryManager.prototype.markMutationResult = function (mutation, cache) { + var _this = this; + if (cache === void 0) { cache = this.cache; } + var result = mutation.result; + var cacheWrites = []; + var skipCache = mutation.fetchPolicy === "no-cache"; + if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) { + if (!utilities.isExecutionPatchIncrementalResult(result)) { + cacheWrites.push({ + result: result.data, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + if (utilities.isExecutionPatchIncrementalResult(result) && + utilities.isNonEmptyArray(result.incremental)) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + query: this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + var mergedData = void 0; + if (diff.result) { + mergedData = mergeIncrementalData(diff.result, result); + } + if (typeof mergedData !== "undefined") { + result.data = mergedData; + cacheWrites.push({ + result: mergedData, + dataId: "ROOT_MUTATION", + query: mutation.document, + variables: mutation.variables, + }); + } + } + var updateQueries_1 = mutation.updateQueries; + if (updateQueries_1) { + this.queries.forEach(function (_a, queryId) { + var observableQuery = _a.observableQuery; + var queryName = observableQuery && observableQuery.queryName; + if (!queryName || !hasOwnProperty.call(updateQueries_1, queryName)) { + return; + } + var updater = updateQueries_1[queryName]; + var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables; + var _c = cache.diff({ + query: document, + variables: variables, + returnPartialData: true, + optimistic: false, + }), currentQueryResult = _c.result, complete = _c.complete; + if (complete && currentQueryResult) { + var nextQueryResult = updater(currentQueryResult, { + mutationResult: result, + queryName: (document && utilities.getOperationName(document)) || void 0, + queryVariables: variables, + }); + if (nextQueryResult) { + cacheWrites.push({ + result: nextQueryResult, + dataId: "ROOT_QUERY", + query: document, + variables: variables, + }); + } + } + }); + } + } + if (cacheWrites.length > 0 || + (mutation.refetchQueries || "").length > 0 || + mutation.update || + mutation.onQueryUpdated || + mutation.removeOptimistic) { + var results_1 = []; + this.refetchQueries({ + updateCache: function (cache) { + if (!skipCache) { + cacheWrites.forEach(function (write) { return cache.write(write); }); + } + var update = mutation.update; + var isFinalResult = !utilities.isExecutionPatchResult(result) || + (utilities.isExecutionPatchIncrementalResult(result) && !result.hasNext); + if (update) { + if (!skipCache) { + var diff = cache.diff({ + id: "ROOT_MUTATION", + query: _this.getDocumentInfo(mutation.document).asQuery, + variables: mutation.variables, + optimistic: false, + returnPartialData: true, + }); + if (diff.complete) { + result = tslib.__assign(tslib.__assign({}, result), { data: diff.result }); + if ("incremental" in result) { + delete result.incremental; + } + if ("hasNext" in result) { + delete result.hasNext; + } + } + } + if (isFinalResult) { + update(cache, result, { + context: mutation.context, + variables: mutation.variables, + }); + } + } + if (!skipCache && !mutation.keepRootFields && isFinalResult) { + cache.modify({ + id: "ROOT_MUTATION", + fields: function (value, _a) { + var fieldName = _a.fieldName, DELETE = _a.DELETE; + return fieldName === "__typename" ? value : DELETE; + }, + }); + } + }, + include: mutation.refetchQueries, + optimistic: false, + removeOptimistic: mutation.removeOptimistic, + onQueryUpdated: mutation.onQueryUpdated || null, + }).forEach(function (result) { return results_1.push(result); }); + if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) { + return Promise.all(results_1).then(function () { return result; }); + } + } + return Promise.resolve(result); + }; + QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) { + var _this = this; + var data = typeof optimisticResponse === "function" ? + optimisticResponse(mutation.variables, { IGNORE: IGNORE }) + : optimisticResponse; + if (data === IGNORE) { + return false; + } + this.cache.recordOptimisticTransaction(function (cache) { + try { + _this.markMutationResult(tslib.__assign(tslib.__assign({}, mutation), { result: { data: data } }), cache); + } + catch (error) { + globalThis.__DEV__ !== false && globals.invariant.error(error); + } + }, mutation.mutationId); + return true; + }; + QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) { + return this.fetchConcastWithInfo(queryId, options, networkStatus).concast + .promise; + }; + QueryManager.prototype.getQueryStore = function () { + var store = Object.create(null); + this.queries.forEach(function (info, queryId) { + store[queryId] = { + variables: info.variables, + networkStatus: info.networkStatus, + networkError: info.networkError, + graphQLErrors: info.graphQLErrors, + }; + }); + return store; + }; + QueryManager.prototype.resetErrors = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) { + queryInfo.networkError = undefined; + queryInfo.graphQLErrors = []; + } + }; + QueryManager.prototype.transform = function (document) { + return this.documentTransform.transformDocument(document); + }; + QueryManager.prototype.getDocumentInfo = function (document) { + var transformCache = this.transformCache; + if (!transformCache.has(document)) { + var cacheEntry = { + hasClientExports: utilities.hasClientExports(document), + hasForcedResolvers: this.localState.shouldForceResolvers(document), + hasNonreactiveDirective: utilities.hasDirectives(["nonreactive"], document), + clientQuery: this.localState.clientQuery(document), + serverQuery: utilities.removeDirectivesFromDocument([ + { name: "client", remove: true }, + { name: "connection" }, + { name: "nonreactive" }, + ], document), + defaultVars: utilities.getDefaultValues(utilities.getOperationDefinition(document)), + asQuery: tslib.__assign(tslib.__assign({}, document), { definitions: document.definitions.map(function (def) { + if (def.kind === "OperationDefinition" && + def.operation !== "query") { + return tslib.__assign(tslib.__assign({}, def), { operation: "query" }); + } + return def; + }) }), + }; + transformCache.set(document, cacheEntry); + } + return transformCache.get(document); + }; + QueryManager.prototype.getVariables = function (document, variables) { + return tslib.__assign(tslib.__assign({}, this.getDocumentInfo(document).defaultVars), variables); + }; + QueryManager.prototype.watchQuery = function (options) { + var query = this.transform(options.query); + options = tslib.__assign(tslib.__assign({}, options), { variables: this.getVariables(query, options.variables) }); + if (typeof options.notifyOnNetworkStatusChange === "undefined") { + options.notifyOnNetworkStatusChange = false; + } + var queryInfo = new QueryInfo(this); + var observable = new ObservableQuery({ + queryManager: this, + queryInfo: queryInfo, + options: options, + }); + observable["lastQuery"] = query; + this.queries.set(observable.queryId, queryInfo); + queryInfo.init({ + document: query, + observableQuery: observable, + variables: observable.variables, + }); + return observable; + }; + QueryManager.prototype.query = function (options, queryId) { + var _this = this; + if (queryId === void 0) { queryId = this.generateQueryId(); } + globals.invariant(options.query, 28); + globals.invariant(options.query.kind === "Document", 29); + globals.invariant(!options.returnPartialData, 30); + globals.invariant(!options.pollInterval, 31); + return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); }); + }; + QueryManager.prototype.generateQueryId = function () { + return String(this.queryIdCounter++); + }; + QueryManager.prototype.generateRequestId = function () { + return this.requestIdCounter++; + }; + QueryManager.prototype.generateMutationId = function () { + return String(this.mutationIdCounter++); + }; + QueryManager.prototype.stopQueryInStore = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { + var queryInfo = this.queries.get(queryId); + if (queryInfo) + queryInfo.stop(); + }; + QueryManager.prototype.clearStore = function (options) { + if (options === void 0) { options = { + discardWatches: true, + }; } + this.cancelPendingFetches(globals.newInvariantError(32)); + this.queries.forEach(function (queryInfo) { + if (queryInfo.observableQuery) { + queryInfo.networkStatus = exports.NetworkStatus.loading; + } + else { + queryInfo.stop(); + } + }); + if (this.mutationStore) { + this.mutationStore = Object.create(null); + } + return this.cache.reset(options); + }; + QueryManager.prototype.getObservableQueries = function (include) { + var _this = this; + if (include === void 0) { include = "active"; } + var queries = new Map(); + var queryNamesAndDocs = new Map(); + var legacyQueryOptions = new Set(); + if (Array.isArray(include)) { + include.forEach(function (desc) { + if (typeof desc === "string") { + queryNamesAndDocs.set(desc, false); + } + else if (utilities.isDocumentNode(desc)) { + queryNamesAndDocs.set(_this.transform(desc), false); + } + else if (utilities.isNonNullObject(desc) && desc.query) { + legacyQueryOptions.add(desc); + } + }); + } + this.queries.forEach(function (_a, queryId) { + var oq = _a.observableQuery, document = _a.document; + if (oq) { + if (include === "all") { + queries.set(queryId, oq); + return; + } + var queryName = oq.queryName, fetchPolicy = oq.options.fetchPolicy; + if (fetchPolicy === "standby" || + (include === "active" && !oq.hasObservers())) { + return; + } + if (include === "active" || + (queryName && queryNamesAndDocs.has(queryName)) || + (document && queryNamesAndDocs.has(document))) { + queries.set(queryId, oq); + if (queryName) + queryNamesAndDocs.set(queryName, true); + if (document) + queryNamesAndDocs.set(document, true); + } + } + }); + if (legacyQueryOptions.size) { + legacyQueryOptions.forEach(function (options) { + var queryId = utilities.makeUniqueId("legacyOneTimeQuery"); + var queryInfo = _this.getQuery(queryId).init({ + document: options.query, + variables: options.variables, + }); + var oq = new ObservableQuery({ + queryManager: _this, + queryInfo: queryInfo, + options: tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "network-only" }), + }); + globals.invariant(oq.queryId === queryId); + queryInfo.setObservableQuery(oq); + queries.set(queryId, oq); + }); + } + if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) { + queryNamesAndDocs.forEach(function (included, nameOrDoc) { + if (!included) { + globalThis.__DEV__ !== false && globals.invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc); + } + }); + } + return queries; + }; + QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { + var _this = this; + if (includeStandby === void 0) { includeStandby = false; } + var observableQueryPromises = []; + this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) { + var fetchPolicy = observableQuery.options.fetchPolicy; + observableQuery.resetLastResults(); + if (includeStandby || + (fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) { + observableQueryPromises.push(observableQuery.refetch()); + } + _this.getQuery(queryId).setDiff(null); + }); + this.broadcastQueries(); + return Promise.all(observableQueryPromises); + }; + QueryManager.prototype.setObservableQuery = function (observableQuery) { + this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); + }; + QueryManager.prototype.startGraphQLSubscription = function (_a) { + var _this = this; + var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c; + query = this.transform(query); + variables = this.getVariables(query, variables); + var makeObservable = function (variables) { + return _this.getObservableFromLink(query, context, variables).map(function (result) { + if (fetchPolicy !== "no-cache") { + if (shouldWriteResult(result, errorPolicy)) { + _this.cache.write({ + query: query, + result: result.data, + dataId: "ROOT_SUBSCRIPTION", + variables: variables, + }); + } + _this.broadcastQueries(); + } + var hasErrors = utilities.graphQLResultHasError(result); + var hasProtocolErrors = errors.graphQLResultHasProtocolErrors(result); + if (hasErrors || hasProtocolErrors) { + var errors$1 = {}; + if (hasErrors) { + errors$1.graphQLErrors = result.errors; + } + if (hasProtocolErrors) { + errors$1.protocolErrors = result.extensions[errors.PROTOCOL_ERRORS_SYMBOL]; + } + if (errorPolicy === "none" || hasProtocolErrors) { + throw new errors.ApolloError(errors$1); + } + } + if (errorPolicy === "ignore") { + delete result.errors; + } + return result; + }); + }; + if (this.getDocumentInfo(query).hasClientExports) { + var observablePromise_1 = this.localState + .addExportedVariables(query, variables, context) + .then(makeObservable); + return new utilities.Observable(function (observer) { + var sub = null; + observablePromise_1.then(function (observable) { return (sub = observable.subscribe(observer)); }, observer.error); + return function () { return sub && sub.unsubscribe(); }; + }); + } + return makeObservable(variables); + }; + QueryManager.prototype.stopQuery = function (queryId) { + this.stopQueryNoBroadcast(queryId); + this.broadcastQueries(); + }; + QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { + this.stopQueryInStoreNoBroadcast(queryId); + this.removeQuery(queryId); + }; + QueryManager.prototype.removeQuery = function (queryId) { + this.fetchCancelFns.delete(queryId); + if (this.queries.has(queryId)) { + this.getQuery(queryId).stop(); + this.queries.delete(queryId); + } + }; + QueryManager.prototype.broadcastQueries = function () { + if (this.onBroadcast) + this.onBroadcast(); + this.queries.forEach(function (info) { return info.notify(); }); + }; + QueryManager.prototype.getLocalState = function () { + return this.localState; + }; + QueryManager.prototype.getObservableFromLink = function (query, context, variables, + deduplication) { + var _this = this; + var _a; + if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; } + var observable; + var _b = this.getDocumentInfo(query), serverQuery = _b.serverQuery, clientQuery = _b.clientQuery; + if (serverQuery) { + var _c = this, inFlightLinkObservables_1 = _c.inFlightLinkObservables, link = _c.link; + var operation = { + query: serverQuery, + variables: variables, + operationName: utilities.getOperationName(serverQuery) || void 0, + context: this.prepareContext(tslib.__assign(tslib.__assign({}, context), { forceFetch: !deduplication })), + }; + context = operation.context; + if (deduplication) { + var printedServerQuery_1 = utilities.print(serverQuery); + var varJson_1 = cache.canonicalStringify(variables); + var entry = inFlightLinkObservables_1.lookup(printedServerQuery_1, varJson_1); + observable = entry.observable; + if (!observable) { + var concast = new utilities.Concast([ + core.execute(link, operation), + ]); + observable = entry.observable = concast; + concast.beforeNext(function () { + inFlightLinkObservables_1.remove(printedServerQuery_1, varJson_1); + }); + } + } + else { + observable = new utilities.Concast([ + core.execute(link, operation), + ]); + } + } + else { + observable = new utilities.Concast([utilities.Observable.of({ data: {} })]); + context = this.prepareContext(context); + } + if (clientQuery) { + observable = utilities.asyncMap(observable, function (result) { + return _this.localState.runResolvers({ + document: clientQuery, + remoteResult: result, + context: context, + variables: variables, + }); + }); + } + return observable; + }; + QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) { + var requestId = (queryInfo.lastRequestId = this.generateRequestId()); + var linkDocument = this.cache.transformForLink(options.query); + return utilities.asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) { + var graphQLErrors = utilities.getGraphQLErrorsFromResult(result); + var hasErrors = graphQLErrors.length > 0; + if (requestId >= queryInfo.lastRequestId) { + if (hasErrors && options.errorPolicy === "none") { + throw queryInfo.markError(new errors.ApolloError({ + graphQLErrors: graphQLErrors, + })); + } + queryInfo.markResult(result, linkDocument, options, cacheWriteBehavior); + queryInfo.markReady(); + } + var aqr = { + data: result.data, + loading: false, + networkStatus: exports.NetworkStatus.ready, + }; + if (hasErrors && options.errorPolicy !== "ignore") { + aqr.errors = graphQLErrors; + aqr.networkStatus = exports.NetworkStatus.error; + } + return aqr; + }, function (networkError) { + var error = errors.isApolloError(networkError) ? networkError : (new errors.ApolloError({ networkError: networkError })); + if (requestId >= queryInfo.lastRequestId) { + queryInfo.markError(error); + } + throw error; + }); + }; + QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, + networkStatus, query) { + var _this = this; + if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; } + if (query === void 0) { query = options.query; } + var variables = this.getVariables(query, options.variables); + var queryInfo = this.getQuery(queryId); + var defaults = this.defaultOptions.watchQuery; + var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e; + var normalized = Object.assign({}, options, { + query: query, + variables: variables, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + returnPartialData: returnPartialData, + notifyOnNetworkStatusChange: notifyOnNetworkStatusChange, + context: context, + }); + var fromVariables = function (variables) { + normalized.variables = variables; + var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus); + if ( + normalized.fetchPolicy !== "standby" && + sourcesWithInfo.sources.length > 0 && + queryInfo.observableQuery) { + queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options); + } + return sourcesWithInfo; + }; + var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); }; + this.fetchCancelFns.set(queryId, function (reason) { + cleanupCancelFn(); + setTimeout(function () { return concast.cancel(reason); }); + }); + var concast, containsDataFromLink; + if (this.getDocumentInfo(normalized.query).hasClientExports) { + concast = new utilities.Concast(this.localState + .addExportedVariables(normalized.query, normalized.variables, normalized.context) + .then(fromVariables) + .then(function (sourcesWithInfo) { return sourcesWithInfo.sources; })); + containsDataFromLink = true; + } + else { + var sourcesWithInfo = fromVariables(normalized.variables); + containsDataFromLink = sourcesWithInfo.fromLink; + concast = new utilities.Concast(sourcesWithInfo.sources); + } + concast.promise.then(cleanupCancelFn, cleanupCancelFn); + return { + concast: concast, + fromLink: containsDataFromLink, + }; + }; + QueryManager.prototype.refetchQueries = function (_a) { + var _this = this; + var updateCache = _a.updateCache, include = _a.include, _b = _a.optimistic, optimistic = _b === void 0 ? false : _b, _c = _a.removeOptimistic, removeOptimistic = _c === void 0 ? optimistic ? utilities.makeUniqueId("refetchQueries") : void 0 : _c, onQueryUpdated = _a.onQueryUpdated; + var includedQueriesById = new Map(); + if (include) { + this.getObservableQueries(include).forEach(function (oq, queryId) { + includedQueriesById.set(queryId, { + oq: oq, + lastDiff: _this.getQuery(queryId).getDiff(), + }); + }); + } + var results = new Map(); + if (updateCache) { + this.cache.batch({ + update: updateCache, + optimistic: (optimistic && removeOptimistic) || false, + removeOptimistic: removeOptimistic, + onWatchUpdated: function (watch, diff, lastDiff) { + var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery; + if (oq) { + if (onQueryUpdated) { + includedQueriesById.delete(oq.queryId); + var result = onQueryUpdated(oq, diff, lastDiff); + if (result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + return result; + } + if (onQueryUpdated !== null) { + includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff }); + } + } + }, + }); + } + if (includedQueriesById.size) { + includedQueriesById.forEach(function (_a, queryId) { + var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff; + var result; + if (onQueryUpdated) { + if (!diff) { + var info = oq["queryInfo"]; + info.reset(); + diff = info.getDiff(); + } + result = onQueryUpdated(oq, diff, lastDiff); + } + if (!onQueryUpdated || result === true) { + result = oq.refetch(); + } + if (result !== false) { + results.set(oq, result); + } + if (queryId.indexOf("legacyOneTimeQuery") >= 0) { + _this.stopQueryNoBroadcast(queryId); + } + }); + } + if (removeOptimistic) { + this.cache.removeOptimistic(removeOptimistic); + } + return results; + }; + QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a, + networkStatus) { + var _this = this; + var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange; + var oldNetworkStatus = queryInfo.networkStatus; + queryInfo.init({ + document: query, + variables: variables, + networkStatus: networkStatus, + }); + var readCache = function () { return queryInfo.getDiff(); }; + var resultsFromCache = function (diff, networkStatus) { + if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || exports.NetworkStatus.loading; } + var data = diff.result; + if (globalThis.__DEV__ !== false && !returnPartialData && !equal.equal(data, {})) { + logMissingFieldErrors(diff.missing); + } + var fromData = function (data) { + return utilities.Observable.of(tslib.__assign({ data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus }, (diff.complete ? null : { partial: true }))); + }; + if (data && _this.getDocumentInfo(query).hasForcedResolvers) { + return _this.localState + .runResolvers({ + document: query, + remoteResult: { data: data }, + context: context, + variables: variables, + onlyRunForcedResolvers: true, + }) + .then(function (resolved) { return fromData(resolved.data || void 0); }); + } + if (errorPolicy === "none" && + networkStatus === exports.NetworkStatus.refetch && + Array.isArray(diff.missing)) { + return fromData(void 0); + } + return fromData(data); + }; + var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 + : (networkStatus === exports.NetworkStatus.refetch && + refetchWritePolicy !== "merge") ? + 1 + : 2 ; + var resultsFromLink = function () { + return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, { + query: query, + variables: variables, + context: context, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + }); + }; + var shouldNotify = notifyOnNetworkStatusChange && + typeof oldNetworkStatus === "number" && + oldNetworkStatus !== networkStatus && + isNetworkRequestInFlight(networkStatus); + switch (fetchPolicy) { + default: + case "cache-first": { + var diff = readCache(); + if (diff.complete) { + return { + fromLink: false, + sources: [resultsFromCache(diff, queryInfo.markReady())], + }; + } + if (returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-and-network": { + var diff = readCache(); + if (diff.complete || returnPartialData || shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(diff), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + } + case "cache-only": + return { + fromLink: false, + sources: [resultsFromCache(readCache(), queryInfo.markReady())], + }; + case "network-only": + if (shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(readCache()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "no-cache": + if (shouldNotify) { + return { + fromLink: true, + sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()], + }; + } + return { fromLink: true, sources: [resultsFromLink()] }; + case "standby": + return { fromLink: false, sources: [] }; + } + }; + QueryManager.prototype.getQuery = function (queryId) { + if (queryId && !this.queries.has(queryId)) { + this.queries.set(queryId, new QueryInfo(this, queryId)); + } + return this.queries.get(queryId); + }; + QueryManager.prototype.prepareContext = function (context) { + if (context === void 0) { context = {}; } + var newContext = this.localState.prepareContext(context); + return tslib.__assign(tslib.__assign(tslib.__assign({}, this.defaultContext), newContext), { clientAwareness: this.clientAwareness }); + }; + return QueryManager; +}()); + +var cacheSizeSymbol = Symbol.for("apollo.cacheSize"); +var cacheSizes = tslib.__assign({}, globals.global[cacheSizeSymbol]); + +var globalCaches = {}; +var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloClientMemoryInternals + : undefined; +function getCurrentCacheSizes() { + var defaults = { + parser: 1000 , + canonicalStringify: 1000 , + print: 2000 , + "documentTransform.cache": 2000 , + "queryManager.getDocumentInfo": 2000 , + "PersistedQueryLink.persistedQueryHashes": 2000 , + "fragmentRegistry.transform": 2000 , + "fragmentRegistry.lookup": 1000 , + "fragmentRegistry.findFragmentSpreads": 4000 , + "cache.fragmentQueryDocuments": 1000 , + "removeTypenameFromVariables.getVariableDefinitions": 2000 , + "inMemoryCache.maybeBroadcastWatch": 5000 , + "inMemoryCache.executeSelectionSet": 50000 , + "inMemoryCache.executeSubSelectedArray": 10000 , + }; + return Object.fromEntries(Object.entries(defaults).map(function (_a) { + var k = _a[0], v = _a[1]; + return [ + k, + cacheSizes[k] || v, + ]; + })); +} +function _getApolloClientMemoryInternals() { + var _a, _b, _c, _d, _e; + if (!(globalThis.__DEV__ !== false)) + throw new Error("only supported in development mode"); + return { + limits: getCurrentCacheSizes(), + sizes: tslib.__assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: { + getDocumentInfo: this["queryManager"]["transformCache"].size, + documentTransforms: transformInfo(this["queryManager"].documentTransform), + } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)), + }; +} +function isWrapper(f) { + return !!f && "dirtyKey" in f; +} +function getWrapperInformation(f) { + return isWrapper(f) ? f.size : undefined; +} +function isDefined(value) { + return value != null; +} +function transformInfo(transform) { + return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); }); +} +function recurseTransformInfo(transform) { + return transform ? + tslib.__spreadArray(tslib.__spreadArray([ + getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"]) + ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined) + : []; +} +function linkInfo(link) { + var _a; + return link ? + tslib.__spreadArray(tslib.__spreadArray([ + (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link) + ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined) + : []; +} + +var hasSuggestedDevtools = false; +var ApolloClient = (function () { + function ApolloClient(options) { + var _this = this; + this.resetStoreCallbacks = []; + this.clearStoreCallbacks = []; + if (!options.cache) { + throw globals.newInvariantError(15); + } + var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, + _c = options.connectToDevTools, + connectToDevTools = _c === void 0 ? typeof window === "object" && + !window.__APOLLO_CLIENT__ && + globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; + var link = options.link; + if (!link) { + link = + uri ? new http.HttpLink({ uri: uri, credentials: credentials, headers: headers }) : core.ApolloLink.empty(); + } + this.link = link; + this.cache = cache; + this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; + this.queryDeduplication = queryDeduplication; + this.defaultOptions = defaultOptions || Object.create(null); + this.typeDefs = typeDefs; + if (ssrForceFetchDelay) { + setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); + } + this.watchQuery = this.watchQuery.bind(this); + this.query = this.query.bind(this); + this.mutate = this.mutate.bind(this); + this.resetStore = this.resetStore.bind(this); + this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); + this.version = version; + this.localState = new LocalState({ + cache: cache, + client: this, + resolvers: resolvers, + fragmentMatcher: fragmentMatcher, + }); + this.queryManager = new QueryManager({ + cache: this.cache, + link: this.link, + defaultOptions: this.defaultOptions, + defaultContext: defaultContext, + documentTransform: documentTransform, + queryDeduplication: queryDeduplication, + ssrMode: ssrMode, + clientAwareness: { + name: clientAwarenessName, + version: clientAwarenessVersion, + }, + localState: this.localState, + assumeImmutableResults: assumeImmutableResults, + onBroadcast: connectToDevTools ? + function () { + if (_this.devToolsHookCb) { + _this.devToolsHookCb({ + action: {}, + state: { + queries: _this.queryManager.getQueryStore(), + mutations: _this.queryManager.mutationStore || {}, + }, + dataWithOptimisticResults: _this.cache.extract(true), + }); + } + } + : void 0, + }); + if (connectToDevTools) + this.connectToDevTools(); + } + ApolloClient.prototype.connectToDevTools = function () { + if (typeof window === "object") { + var windowWithDevTools = window; + var devtoolsSymbol = Symbol.for("apollo.devtools"); + (windowWithDevTools[devtoolsSymbol] = + windowWithDevTools[devtoolsSymbol] || []).push(this); + windowWithDevTools.__APOLLO_CLIENT__ = this; + } + if (!hasSuggestedDevtools && globalThis.__DEV__ !== false) { + hasSuggestedDevtools = true; + setTimeout(function () { + if (typeof window !== "undefined" && + window.document && + window.top === window.self && + !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) { + var nav = window.navigator; + var ua = nav && nav.userAgent; + var url = void 0; + if (typeof ua === "string") { + if (ua.indexOf("Chrome/") > -1) { + url = + "https://chrome.google.com/webstore/detail/" + + "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm"; + } + else if (ua.indexOf("Firefox/") > -1) { + url = + "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/"; + } + } + if (url) { + globalThis.__DEV__ !== false && globals.invariant.log("Download the Apollo DevTools for a better development " + + "experience: %s", url); + } + } + }, 10000); + } + }; + Object.defineProperty(ApolloClient.prototype, "documentTransform", { + get: function () { + return this.queryManager.documentTransform; + }, + enumerable: false, + configurable: true + }); + ApolloClient.prototype.stop = function () { + this.queryManager.stop(); + }; + ApolloClient.prototype.watchQuery = function (options) { + if (this.defaultOptions.watchQuery) { + options = utilities.mergeOptions(this.defaultOptions.watchQuery, options); + } + if (this.disableNetworkFetches && + (options.fetchPolicy === "network-only" || + options.fetchPolicy === "cache-and-network")) { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.watchQuery(options); + }; + ApolloClient.prototype.query = function (options) { + if (this.defaultOptions.query) { + options = utilities.mergeOptions(this.defaultOptions.query, options); + } + globals.invariant(options.fetchPolicy !== "cache-and-network", 16); + if (this.disableNetworkFetches && options.fetchPolicy === "network-only") { + options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" }); + } + return this.queryManager.query(options); + }; + ApolloClient.prototype.mutate = function (options) { + if (this.defaultOptions.mutate) { + options = utilities.mergeOptions(this.defaultOptions.mutate, options); + } + return this.queryManager.mutate(options); + }; + ApolloClient.prototype.subscribe = function (options) { + return this.queryManager.startGraphQLSubscription(options); + }; + ApolloClient.prototype.readQuery = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readQuery(options, optimistic); + }; + ApolloClient.prototype.readFragment = function (options, optimistic) { + if (optimistic === void 0) { optimistic = false; } + return this.cache.readFragment(options, optimistic); + }; + ApolloClient.prototype.writeQuery = function (options) { + var ref = this.cache.writeQuery(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + ApolloClient.prototype.writeFragment = function (options) { + var ref = this.cache.writeFragment(options); + if (options.broadcast !== false) { + this.queryManager.broadcastQueries(); + } + return ref; + }; + ApolloClient.prototype.__actionHookForDevTools = function (cb) { + this.devToolsHookCb = cb; + }; + ApolloClient.prototype.__requestRaw = function (payload) { + return core.execute(this.link, payload); + }; + ApolloClient.prototype.resetStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: false, + }); + }) + .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) + .then(function () { return _this.reFetchObservableQueries(); }); + }; + ApolloClient.prototype.clearStore = function () { + var _this = this; + return Promise.resolve() + .then(function () { + return _this.queryManager.clearStore({ + discardWatches: true, + }); + }) + .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); + }; + ApolloClient.prototype.onResetStore = function (cb) { + var _this = this; + this.resetStoreCallbacks.push(cb); + return function () { + _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.onClearStore = function (cb) { + var _this = this; + this.clearStoreCallbacks.push(cb); + return function () { + _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); + }; + }; + ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { + return this.queryManager.reFetchObservableQueries(includeStandby); + }; + ApolloClient.prototype.refetchQueries = function (options) { + var map = this.queryManager.refetchQueries(options); + var queries = []; + var results = []; + map.forEach(function (result, obsQuery) { + queries.push(obsQuery); + results.push(result); + }); + var result = Promise.all(results); + result.queries = queries; + result.results = results; + result.catch(function (error) { + globalThis.__DEV__ !== false && globals.invariant.debug(17, error); + }); + return result; + }; + ApolloClient.prototype.getObservableQueries = function (include) { + if (include === void 0) { include = "active"; } + return this.queryManager.getObservableQueries(include); + }; + ApolloClient.prototype.extract = function (optimistic) { + return this.cache.extract(optimistic); + }; + ApolloClient.prototype.restore = function (serializedState) { + return this.cache.restore(serializedState); + }; + ApolloClient.prototype.addResolvers = function (resolvers) { + this.localState.addResolvers(resolvers); + }; + ApolloClient.prototype.setResolvers = function (resolvers) { + this.localState.setResolvers(resolvers); + }; + ApolloClient.prototype.getResolvers = function () { + return this.localState.getResolvers(); + }; + ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { + this.localState.setFragmentMatcher(fragmentMatcher); + }; + ApolloClient.prototype.setLink = function (newLink) { + this.link = this.queryManager.link = newLink; + }; + Object.defineProperty(ApolloClient.prototype, "defaultContext", { + get: function () { + return this.queryManager.defaultContext; + }, + enumerable: false, + configurable: true + }); + return ApolloClient; +}()); +if (globalThis.__DEV__ !== false) { + ApolloClient.prototype.getMemoryInternals = getApolloClientMemoryInternals; +} + +tsInvariant.setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent"); + +exports.DocumentTransform = utilities.DocumentTransform; +exports.Observable = utilities.Observable; +exports.isReference = utilities.isReference; +exports.makeReference = utilities.makeReference; +exports.mergeOptions = utilities.mergeOptions; +exports.ApolloCache = cache.ApolloCache; +exports.Cache = cache.Cache; +exports.InMemoryCache = cache.InMemoryCache; +exports.MissingFieldError = cache.MissingFieldError; +exports.defaultDataIdFromObject = cache.defaultDataIdFromObject; +exports.makeVar = cache.makeVar; +exports.ApolloError = errors.ApolloError; +exports.isApolloError = errors.isApolloError; +exports.fromError = utils.fromError; +exports.fromPromise = utils.fromPromise; +exports.throwServerError = utils.throwServerError; +exports.toPromise = utils.toPromise; +exports.setLogVerbosity = tsInvariant.setVerbosity; +exports.disableExperimentalFragmentVariables = graphqlTag.disableExperimentalFragmentVariables; +exports.disableFragmentWarnings = graphqlTag.disableFragmentWarnings; +exports.enableExperimentalFragmentVariables = graphqlTag.enableExperimentalFragmentVariables; +exports.gql = graphqlTag.gql; +exports.resetCaches = graphqlTag.resetCaches; +exports.ApolloClient = ApolloClient; +exports.ObservableQuery = ObservableQuery; +exports.isNetworkRequestSettled = isNetworkRequestSettled; +for (var k in core) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +} +for (var k in http) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = http[k]; +} +//# sourceMappingURL=core.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.d.ts new file mode 100644 index 0000000..bde5f5b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.d.ts @@ -0,0 +1,4 @@ +import type { DocumentNode } from "graphql"; +import type { ApolloQueryResult, OperationVariables } from "./types.js"; +export declare function equalByQuery(query: DocumentNode, { data: aData, ...aRest }: Partial>, { data: bData, ...bRest }: Partial>, variables?: OperationVariables): boolean; +//# sourceMappingURL=equalByQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js b/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js new file mode 100644 index 0000000..320557d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js @@ -0,0 +1,87 @@ +import { __rest } from "tslib"; +import equal from "@wry/equality"; +import { createFragmentMap, getFragmentDefinitions, getFragmentFromSelection, getMainDefinition, isField, resultKeyNameFromField, shouldInclude, } from "../utilities/index.js"; +// Returns true if aResult and bResult are deeply equal according to the fields +// selected by the given query, ignoring any fields marked as @nonreactive. +export function equalByQuery(query, _a, _b, variables) { + var aData = _a.data, aRest = __rest(_a, ["data"]); + var bData = _b.data, bRest = __rest(_b, ["data"]); + return (equal(aRest, bRest) && + equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, { + fragmentMap: createFragmentMap(getFragmentDefinitions(query)), + variables: variables, + })); +} +function equalBySelectionSet(selectionSet, aResult, bResult, context) { + if (aResult === bResult) { + return true; + } + var seenSelections = new Set(); + // Returning true from this Array.prototype.every callback function skips the + // current field/subtree. Returning false aborts the entire traversal + // immediately, causing equalBySelectionSet to return false. + return selectionSet.selections.every(function (selection) { + // Avoid re-processing the same selection at the same level of recursion, in + // case the same field gets included via multiple indirect fragment spreads. + if (seenSelections.has(selection)) + return true; + seenSelections.add(selection); + // Ignore @skip(if: true) and @include(if: false) fields. + if (!shouldInclude(selection, context.variables)) + return true; + // If the field or (named) fragment spread has a @nonreactive directive on + // it, we don't care if it's different, so we pretend it's the same. + if (selectionHasNonreactiveDirective(selection)) + return true; + if (isField(selection)) { + var resultKey = resultKeyNameFromField(selection); + var aResultChild = aResult && aResult[resultKey]; + var bResultChild = bResult && bResult[resultKey]; + var childSelectionSet = selection.selectionSet; + if (!childSelectionSet) { + // These are scalar values, so we can compare them with deep equal + // without redoing the main recursive work. + return equal(aResultChild, bResultChild); + } + var aChildIsArray = Array.isArray(aResultChild); + var bChildIsArray = Array.isArray(bResultChild); + if (aChildIsArray !== bChildIsArray) + return false; + if (aChildIsArray && bChildIsArray) { + var length_1 = aResultChild.length; + if (bResultChild.length !== length_1) { + return false; + } + for (var i = 0; i < length_1; ++i) { + if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) { + return false; + } + } + return true; + } + return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context); + } + else { + var fragment = getFragmentFromSelection(selection, context.fragmentMap); + if (fragment) { + // The fragment might === selection if it's an inline fragment, but + // could be !== if it's a named fragment ...spread. + if (selectionHasNonreactiveDirective(fragment)) + return true; + return equalBySelectionSet(fragment.selectionSet, + // Notice that we reuse the same aResult and bResult values here, + // since the fragment ...spread does not specify a field name, but + // consists of multiple fields (within the fragment's selection set) + // that should be applied to the current result value(s). + aResult, bResult, context); + } + } + }); +} +function selectionHasNonreactiveDirective(selection) { + return (!!selection.directives && selection.directives.some(directiveIsNonreactive)); +} +function directiveIsNonreactive(dir) { + return dir.name.value === "nonreactive"; +} +//# sourceMappingURL=equalByQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js.map b/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js.map new file mode 100644 index 0000000..f6eeafa --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/equalByQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"equalByQuery.js","sourceRoot":"","sources":["../../src/core/equalByQuery.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,eAAe,CAAC;AAgBlC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,OAAO,EACP,sBAAsB,EACtB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,UAAU,YAAY,CAC1B,KAAmB,EACnB,EAA8D,EAC9D,EAA8D,EAC9D,SAA8B;IAF5B,IAAM,KAAK,UAAA,EAAK,KAAK,cAAvB,QAAyB,CAAF;QACf,KAAK,UAAA,EAA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,yDAAyD;gBACzD,OAAO,EACP,OAAO,EACP,OAAO,CACR,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gCAAgC,CACvC,SAI0B;IAE1B,OAAO,CACL,CAAC,CAAC,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAkB;IAChD,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,aAAa,CAAC;AAC1C,CAAC","sourcesContent":["import equal from \"@wry/equality\";\n\nimport type {\n DirectiveNode,\n DocumentNode,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n SelectionNode,\n SelectionSetNode,\n} from \"graphql\";\n\nimport type { ApolloQueryResult, OperationVariables } from \"./types.js\";\n\nimport type { FragmentMap } from \"../utilities/index.js\";\nimport {\n createFragmentMap,\n getFragmentDefinitions,\n getFragmentFromSelection,\n getMainDefinition,\n isField,\n resultKeyNameFromField,\n shouldInclude,\n} from \"../utilities/index.js\";\n\n// Returns true if aResult and bResult are deeply equal according to the fields\n// selected by the given query, ignoring any fields marked as @nonreactive.\nexport function equalByQuery(\n query: DocumentNode,\n { data: aData, ...aRest }: Partial>,\n { data: bData, ...bRest }: Partial>,\n variables?: OperationVariables\n): boolean {\n return (\n equal(aRest, bRest) &&\n equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {\n fragmentMap: createFragmentMap(getFragmentDefinitions(query)),\n variables,\n })\n );\n}\n\n// Encapsulates the information used by equalBySelectionSet that does not change\n// during the recursion.\ninterface CompareContext {\n fragmentMap: FragmentMap;\n variables: TVariables | undefined;\n}\n\nfunction equalBySelectionSet(\n selectionSet: SelectionSetNode,\n aResult: any,\n bResult: any,\n context: CompareContext\n): boolean {\n if (aResult === bResult) {\n return true;\n }\n\n const seenSelections = new Set();\n\n // Returning true from this Array.prototype.every callback function skips the\n // current field/subtree. Returning false aborts the entire traversal\n // immediately, causing equalBySelectionSet to return false.\n return selectionSet.selections.every((selection) => {\n // Avoid re-processing the same selection at the same level of recursion, in\n // case the same field gets included via multiple indirect fragment spreads.\n if (seenSelections.has(selection)) return true;\n seenSelections.add(selection);\n\n // Ignore @skip(if: true) and @include(if: false) fields.\n if (!shouldInclude(selection, context.variables)) return true;\n\n // If the field or (named) fragment spread has a @nonreactive directive on\n // it, we don't care if it's different, so we pretend it's the same.\n if (selectionHasNonreactiveDirective(selection)) return true;\n\n if (isField(selection)) {\n const resultKey = resultKeyNameFromField(selection);\n const aResultChild = aResult && aResult[resultKey];\n const bResultChild = bResult && bResult[resultKey];\n const childSelectionSet = selection.selectionSet;\n\n if (!childSelectionSet) {\n // These are scalar values, so we can compare them with deep equal\n // without redoing the main recursive work.\n return equal(aResultChild, bResultChild);\n }\n\n const aChildIsArray = Array.isArray(aResultChild);\n const bChildIsArray = Array.isArray(bResultChild);\n if (aChildIsArray !== bChildIsArray) return false;\n if (aChildIsArray && bChildIsArray) {\n const length = aResultChild.length;\n if (bResultChild.length !== length) {\n return false;\n }\n for (let i = 0; i < length; ++i) {\n if (\n !equalBySelectionSet(\n childSelectionSet,\n aResultChild[i],\n bResultChild[i],\n context\n )\n ) {\n return false;\n }\n }\n return true;\n }\n\n return equalBySelectionSet(\n childSelectionSet,\n aResultChild,\n bResultChild,\n context\n );\n } else {\n const fragment = getFragmentFromSelection(selection, context.fragmentMap);\n if (fragment) {\n // The fragment might === selection if it's an inline fragment, but\n // could be !== if it's a named fragment ...spread.\n if (selectionHasNonreactiveDirective(fragment)) return true;\n\n return equalBySelectionSet(\n fragment.selectionSet,\n // Notice that we reuse the same aResult and bResult values here,\n // since the fragment ...spread does not specify a field name, but\n // consists of multiple fields (within the fragment's selection set)\n // that should be applied to the current result value(s).\n aResult,\n bResult,\n context\n );\n }\n }\n });\n}\n\nfunction selectionHasNonreactiveDirective(\n selection:\n | FieldNode\n | InlineFragmentNode\n | FragmentSpreadNode\n | FragmentDefinitionNode\n): boolean {\n return (\n !!selection.directives && selection.directives.some(directiveIsNonreactive)\n );\n}\n\nfunction directiveIsNonreactive(dir: DirectiveNode): boolean {\n return dir.name.value === \"nonreactive\";\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/index.d.ts b/graphql-subscription/node_modules/@apollo/client/core/index.d.ts new file mode 100644 index 0000000..c4214e8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/index.d.ts @@ -0,0 +1,22 @@ +export type { ApolloClientOptions, DefaultOptions } from "./ApolloClient.js"; +export { ApolloClient, mergeOptions } from "./ApolloClient.js"; +export type { FetchMoreOptions, UpdateQueryOptions, } from "./ObservableQuery.js"; +export { ObservableQuery } from "./ObservableQuery.js"; +export type { QueryOptions, WatchQueryOptions, MutationOptions, SubscriptionOptions, FetchPolicy, WatchQueryFetchPolicy, MutationFetchPolicy, RefetchWritePolicy, ErrorPolicy, FetchMoreQueryOptions, SubscribeToMoreOptions, } from "./watchQueryOptions.js"; +export { NetworkStatus, isNetworkRequestSettled } from "./networkStatus.js"; +export * from "./types.js"; +export type { Resolver, FragmentMatcher } from "./LocalState.js"; +export { isApolloError, ApolloError } from "../errors/index.js"; +export type { Transaction, DataProxy, InMemoryCacheConfig, ReactiveVar, TypePolicies, TypePolicy, FieldPolicy, FieldReadFunction, FieldMergeFunction, FieldFunctionOptions, PossibleTypesMap, } from "../cache/index.js"; +export { Cache, ApolloCache, InMemoryCache, MissingFieldError, defaultDataIdFromObject, makeVar, } from "../cache/index.js"; +export * from "../cache/inmemory/types.js"; +export * from "../link/core/index.js"; +export * from "../link/http/index.js"; +export type { ServerError } from "../link/utils/index.js"; +export { fromError, toPromise, fromPromise, throwServerError, } from "../link/utils/index.js"; +export type { DocumentTransformCacheKey, Observer, ObservableSubscription, Reference, StoreObject, } from "../utilities/index.js"; +export { DocumentTransform, Observable, isReference, makeReference, } from "../utilities/index.js"; +import { setVerbosity } from "ts-invariant"; +export { setVerbosity as setLogVerbosity }; +export { gql, resetCaches, disableFragmentWarnings, enableExperimentalFragmentVariables, disableExperimentalFragmentVariables, } from "graphql-tag"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/index.js b/graphql-subscription/node_modules/@apollo/client/core/index.js new file mode 100644 index 0000000..061dfdb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/index.js @@ -0,0 +1,35 @@ +/* Core */ +export { ApolloClient, mergeOptions } from "./ApolloClient.js"; +export { ObservableQuery } from "./ObservableQuery.js"; +export { NetworkStatus, isNetworkRequestSettled } from "./networkStatus.js"; +export * from "./types.js"; +export { isApolloError, ApolloError } from "../errors/index.js"; +export { Cache, ApolloCache, InMemoryCache, MissingFieldError, defaultDataIdFromObject, makeVar, } from "../cache/index.js"; +export * from "../cache/inmemory/types.js"; +/* Link */ +export * from "../link/core/index.js"; +export * from "../link/http/index.js"; +export { fromError, toPromise, fromPromise, throwServerError, } from "../link/utils/index.js"; +export { DocumentTransform, Observable, isReference, makeReference, } from "../utilities/index.js"; +/* Supporting */ +// The verbosity of invariant.{log,warn,error} can be controlled globally +// (for anyone using the same ts-invariant package) by passing "log", +// "warn", "error", or "silent" to setVerbosity ("log" is the default). +// Note that all invariant.* logging is hidden in production. +import { setVerbosity } from "ts-invariant"; +export { setVerbosity as setLogVerbosity }; +setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent"); +// Note that importing `gql` by itself, then destructuring +// additional properties separately before exporting, is intentional. +// Due to the way the `graphql-tag` library is setup, certain bundlers +// can't find the properties added to the exported `gql` function without +// additional guidance (e.g. Rollup - see +// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module). +// Instead of having people that are using bundlers with `@apollo/client` add +// extra bundler config to help `graphql-tag` exports be found (which would be +// awkward since they aren't importing `graphql-tag` themselves), this +// workaround of pulling the extra properties off the `gql` function, +// then re-exporting them separately, helps keeps bundlers happy without any +// additional config changes. +export { gql, resetCaches, disableFragmentWarnings, enableExperimentalFragmentVariables, disableExperimentalFragmentVariables, } from "graphql-tag"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/index.js.map b/graphql-subscription/node_modules/@apollo/client/core/index.js.map new file mode 100644 index 0000000..3aa1393 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,UAAU;AAGV,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAK/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAcvD,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAkBhE,OAAO,EACL,KAAK,EACL,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,OAAO,GACR,MAAM,mBAAmB,CAAC;AAE3B,cAAc,4BAA4B,CAAC;AAE3C,UAAU;AAEV,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAWhC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,gBAAgB;AAEhB,yEAAyE;AACzE,qEAAqE;AACrE,uEAAuE;AACvE,6DAA6D;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,CAAC;AAC3C,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEzC,0DAA0D;AAC1D,qEAAqE;AACrE,sEAAsE;AACtE,yEAAyE;AACzE,yCAAyC;AACzC,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE,qEAAqE;AACrE,4EAA4E;AAC5E,6BAA6B;AAC7B,OAAO,EACL,GAAG,EACH,WAAW,EACX,uBAAuB,EACvB,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,aAAa,CAAC","sourcesContent":["/* Core */\n\nexport type { ApolloClientOptions, DefaultOptions } from \"./ApolloClient.js\";\nexport { ApolloClient, mergeOptions } from \"./ApolloClient.js\";\nexport type {\n FetchMoreOptions,\n UpdateQueryOptions,\n} from \"./ObservableQuery.js\";\nexport { ObservableQuery } from \"./ObservableQuery.js\";\nexport type {\n QueryOptions,\n WatchQueryOptions,\n MutationOptions,\n SubscriptionOptions,\n FetchPolicy,\n WatchQueryFetchPolicy,\n MutationFetchPolicy,\n RefetchWritePolicy,\n ErrorPolicy,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n} from \"./watchQueryOptions.js\";\nexport { NetworkStatus, isNetworkRequestSettled } from \"./networkStatus.js\";\nexport * from \"./types.js\";\nexport type { Resolver, FragmentMatcher } from \"./LocalState.js\";\nexport { isApolloError, ApolloError } from \"../errors/index.js\";\n/* Cache */\n\nexport type {\n // All the exports (types) from ../cache, minus cacheSlot,\n // which we want to keep semi-private.\n Transaction,\n DataProxy,\n InMemoryCacheConfig,\n ReactiveVar,\n TypePolicies,\n TypePolicy,\n FieldPolicy,\n FieldReadFunction,\n FieldMergeFunction,\n FieldFunctionOptions,\n PossibleTypesMap,\n} from \"../cache/index.js\";\nexport {\n Cache,\n ApolloCache,\n InMemoryCache,\n MissingFieldError,\n defaultDataIdFromObject,\n makeVar,\n} from \"../cache/index.js\";\n\nexport * from \"../cache/inmemory/types.js\";\n\n/* Link */\n\nexport * from \"../link/core/index.js\";\nexport * from \"../link/http/index.js\";\nexport type { ServerError } from \"../link/utils/index.js\";\nexport {\n fromError,\n toPromise,\n fromPromise,\n throwServerError,\n} from \"../link/utils/index.js\";\n\n/* Utilities */\n\nexport type {\n DocumentTransformCacheKey,\n Observer,\n ObservableSubscription,\n Reference,\n StoreObject,\n} from \"../utilities/index.js\";\nexport {\n DocumentTransform,\n Observable,\n isReference,\n makeReference,\n} from \"../utilities/index.js\";\n\n/* Supporting */\n\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// (for anyone using the same ts-invariant package) by passing \"log\",\n// \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nimport { setVerbosity } from \"ts-invariant\";\nexport { setVerbosity as setLogVerbosity };\nsetVerbosity(__DEV__ ? \"log\" : \"silent\");\n\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport {\n gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n} from \"graphql-tag\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/networkStatus.d.ts b/graphql-subscription/node_modules/@apollo/client/core/networkStatus.d.ts new file mode 100644 index 0000000..0637bb3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/networkStatus.d.ts @@ -0,0 +1,51 @@ +/** + * The current status of a query’s execution in our system. + */ +export declare enum NetworkStatus { + /** + * The query has never been run before and the query is now currently running. A query will still + * have this network status even if a partial data result was returned from the cache, but a + * query was dispatched anyway. + */ + loading = 1, + /** + * If `setVariables` was called and a query was fired because of that then the network status + * will be `setVariables` until the result of that query comes back. + */ + setVariables = 2, + /** + * Indicates that `fetchMore` was called on this query and that the query created is currently in + * flight. + */ + fetchMore = 3, + /** + * Similar to the `setVariables` network status. It means that `refetch` was called on a query + * and the refetch request is currently in flight. + */ + refetch = 4, + /** + * Indicates that a polling query is currently in flight. So for example if you are polling a + * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever + * a poll request has been sent but not resolved. + */ + poll = 6, + /** + * No request is in flight for this query, and no errors happened. Everything is OK. + */ + ready = 7, + /** + * No request is in flight for this query, but one or more errors were detected. + */ + error = 8 +} +/** + * Returns true if there is currently a network request in flight according to a given network + * status. + */ +export declare function isNetworkRequestInFlight(networkStatus?: NetworkStatus): boolean; +/** + * Returns true if the network request is in ready or error state according to a given network + * status. + */ +export declare function isNetworkRequestSettled(networkStatus?: NetworkStatus): boolean; +//# sourceMappingURL=networkStatus.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/networkStatus.js b/graphql-subscription/node_modules/@apollo/client/core/networkStatus.js new file mode 100644 index 0000000..b1e46c1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/networkStatus.js @@ -0,0 +1,56 @@ +/** + * The current status of a query’s execution in our system. + */ +export var NetworkStatus; +(function (NetworkStatus) { + /** + * The query has never been run before and the query is now currently running. A query will still + * have this network status even if a partial data result was returned from the cache, but a + * query was dispatched anyway. + */ + NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; + /** + * If `setVariables` was called and a query was fired because of that then the network status + * will be `setVariables` until the result of that query comes back. + */ + NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; + /** + * Indicates that `fetchMore` was called on this query and that the query created is currently in + * flight. + */ + NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; + /** + * Similar to the `setVariables` network status. It means that `refetch` was called on a query + * and the refetch request is currently in flight. + */ + NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; + /** + * Indicates that a polling query is currently in flight. So for example if you are polling a + * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever + * a poll request has been sent but not resolved. + */ + NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; + /** + * No request is in flight for this query, and no errors happened. Everything is OK. + */ + NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; + /** + * No request is in flight for this query, but one or more errors were detected. + */ + NetworkStatus[NetworkStatus["error"] = 8] = "error"; +})(NetworkStatus || (NetworkStatus = {})); +/** + * Returns true if there is currently a network request in flight according to a given network + * status. + */ +export function isNetworkRequestInFlight(networkStatus) { + return networkStatus ? networkStatus < 7 : false; +} +/** + * Returns true if the network request is in ready or error state according to a given network + * status. + */ +export function isNetworkRequestSettled(networkStatus) { + return networkStatus === 7 || networkStatus === 8; +} +//# sourceMappingURL=networkStatus.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/networkStatus.js.map b/graphql-subscription/node_modules/@apollo/client/core/networkStatus.js.map new file mode 100644 index 0000000..e5a3dd1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/networkStatus.js.map @@ -0,0 +1 @@ +{"version":3,"file":"networkStatus.js","sourceRoot":"","sources":["../../src/core/networkStatus.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,aA0CX;AA1CD,WAAY,aAAa;IACvB;;;;OAIG;IACH,uDAAW,CAAA;IAEX;;;OAGG;IACH,iEAAgB,CAAA;IAEhB;;;OAGG;IACH,2DAAa,CAAA;IAEb;;;OAGG;IACH,uDAAW,CAAA;IAEX;;;;OAIG;IACH,iDAAQ,CAAA;IAER;;OAEG;IACH,mDAAS,CAAA;IAET;;OAEG;IACH,mDAAS,CAAA;AACX,CAAC,EA1CW,aAAa,KAAb,aAAa,QA0CxB;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAA6B;IAE7B,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAA6B;IAE7B,OAAO,aAAa,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/**\n * The current status of a query’s execution in our system.\n */\nexport enum NetworkStatus {\n /**\n * The query has never been run before and the query is now currently running. A query will still\n * have this network status even if a partial data result was returned from the cache, but a\n * query was dispatched anyway.\n */\n loading = 1,\n\n /**\n * If `setVariables` was called and a query was fired because of that then the network status\n * will be `setVariables` until the result of that query comes back.\n */\n setVariables = 2,\n\n /**\n * Indicates that `fetchMore` was called on this query and that the query created is currently in\n * flight.\n */\n fetchMore = 3,\n\n /**\n * Similar to the `setVariables` network status. It means that `refetch` was called on a query\n * and the refetch request is currently in flight.\n */\n refetch = 4,\n\n /**\n * Indicates that a polling query is currently in flight. So for example if you are polling a\n * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever\n * a poll request has been sent but not resolved.\n */\n poll = 6,\n\n /**\n * No request is in flight for this query, and no errors happened. Everything is OK.\n */\n ready = 7,\n\n /**\n * No request is in flight for this query, but one or more errors were detected.\n */\n error = 8,\n}\n\n/**\n * Returns true if there is currently a network request in flight according to a given network\n * status.\n */\nexport function isNetworkRequestInFlight(\n networkStatus?: NetworkStatus\n): boolean {\n return networkStatus ? networkStatus < 7 : false;\n}\n\n/**\n * Returns true if the network request is in ready or error state according to a given network\n * status.\n */\nexport function isNetworkRequestSettled(\n networkStatus?: NetworkStatus\n): boolean {\n return networkStatus === 7 || networkStatus === 8;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/package.json b/graphql-subscription/node_modules/@apollo/client/core/package.json new file mode 100644 index 0000000..24f30b4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/core", + "type": "module", + "main": "core.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/core/types.d.ts b/graphql-subscription/node_modules/@apollo/client/core/types.d.ts new file mode 100644 index 0000000..ef03f2e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/types.d.ts @@ -0,0 +1,86 @@ +import type { DocumentNode, GraphQLError } from "graphql"; +import type { ApolloCache } from "../cache/index.js"; +import type { FetchResult } from "../link/core/index.js"; +import type { ApolloError } from "../errors/index.js"; +import type { QueryInfo } from "./QueryInfo.js"; +import type { NetworkStatus } from "./networkStatus.js"; +import type { Resolver } from "./LocalState.js"; +import type { ObservableQuery } from "./ObservableQuery.js"; +import type { QueryOptions } from "./watchQueryOptions.js"; +import type { Cache } from "../cache/index.js"; +import type { IsStrictlyAny } from "../utilities/index.js"; +export type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +export type MethodKeys = { + [P in keyof T]: T[P] extends Function ? P : never; +}[keyof T]; +export interface DefaultContext extends Record { +} +export type QueryListener = (queryInfo: QueryInfo) => void; +export type OnQueryUpdated = (observableQuery: ObservableQuery, diff: Cache.DiffResult, lastDiff: Cache.DiffResult | undefined) => boolean | TResult; +export type RefetchQueryDescriptor = string | DocumentNode; +export type InternalRefetchQueryDescriptor = RefetchQueryDescriptor | QueryOptions; +type RefetchQueriesIncludeShorthand = "all" | "active"; +export type RefetchQueriesInclude = RefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand; +export type InternalRefetchQueriesInclude = InternalRefetchQueryDescriptor[] | RefetchQueriesIncludeShorthand; +export interface RefetchQueriesOptions, TResult> { + updateCache?: (cache: TCache) => void; + include?: RefetchQueriesInclude; + optimistic?: boolean; + onQueryUpdated?: OnQueryUpdated | null; +} +export type RefetchQueriesPromiseResults = IsStrictlyAny extends true ? any[] : TResult extends boolean ? ApolloQueryResult[] : TResult extends PromiseLike ? U[] : TResult[]; +export interface RefetchQueriesResult extends Promise> { + queries: ObservableQuery[]; + results: InternalRefetchQueriesResult[]; +} +export interface InternalRefetchQueriesOptions, TResult> extends Omit, "include"> { + include?: InternalRefetchQueriesInclude; + removeOptimistic?: string; +} +export type InternalRefetchQueriesResult = TResult extends boolean ? Promise> : TResult; +export type InternalRefetchQueriesMap = Map, InternalRefetchQueriesResult>; +export type { QueryOptions as PureQueryOptions }; +export type OperationVariables = Record; +export interface ApolloQueryResult { + data: T; + /** + * A list of any errors that occurred during server-side execution of a GraphQL operation. + * See https://www.apollographql.com/docs/react/data/error-handling/ for more information. + */ + errors?: ReadonlyArray; + /** + * The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls. + * This will contain both a NetworkError field and any GraphQLErrors. + * See https://www.apollographql.com/docs/react/data/error-handling/ for more information. + */ + error?: ApolloError; + loading: boolean; + networkStatus: NetworkStatus; + partial?: boolean; +} +export type MutationQueryReducer = (previousResult: Record, options: { + mutationResult: FetchResult; + queryName: string | undefined; + queryVariables: Record; +}) => Record; +export type MutationQueryReducersMap = { + [queryName: string]: MutationQueryReducer; +}; +/** + * @deprecated Use `MutationUpdaterFunction` instead. + */ +export type MutationUpdaterFn = (cache: ApolloCache, mutationResult: FetchResult) => void; +export type MutationUpdaterFunction> = (cache: TCache, result: Omit, "context">, options: { + context?: TContext; + variables?: TVariables; +}) => void; +export interface Resolvers { + [key: string]: { + [field: string]: Resolver; + }; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/types.js b/graphql-subscription/node_modules/@apollo/client/core/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/types.js.map b/graphql-subscription/node_modules/@apollo/client/core/types.js.map new file mode 100644 index 0000000..1e1278e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, GraphQLError } from \"graphql\";\n\nimport type { ApolloCache } from \"../cache/index.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\nimport type { ApolloError } from \"../errors/index.js\";\nimport type { QueryInfo } from \"./QueryInfo.js\";\nimport type { NetworkStatus } from \"./networkStatus.js\";\nimport type { Resolver } from \"./LocalState.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\nimport type { QueryOptions } from \"./watchQueryOptions.js\";\nimport type { Cache } from \"../cache/index.js\";\nimport type { IsStrictlyAny } from \"../utilities/index.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport type MethodKeys = {\n [P in keyof T]: T[P] extends Function ? P : never;\n}[keyof T];\n\nexport interface DefaultContext extends Record {}\n\nexport type QueryListener = (queryInfo: QueryInfo) => void;\n\nexport type OnQueryUpdated = (\n observableQuery: ObservableQuery,\n diff: Cache.DiffResult,\n lastDiff: Cache.DiffResult | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// Used by ApolloClient[\"refetchQueries\"]\n// TODO Improve documentation comments for this public type.\nexport interface RefetchQueriesOptions<\n TCache extends ApolloCache,\n TResult,\n> {\n updateCache?: (cache: TCache) => void;\n // The client.refetchQueries method discourages passing QueryOptions, by\n // restricting the public type of options.include to exclude QueryOptions as\n // an available array element type (see InternalRefetchQueriesInclude for a\n // version of RefetchQueriesInclude that allows legacy QueryOptions objects).\n include?: RefetchQueriesInclude;\n optimistic?: boolean;\n // If no onQueryUpdated function is provided, any queries affected by the\n // updateCache function or included in the options.include array will be\n // refetched by default. Passing null instead of undefined disables this\n // default refetching behavior for affected queries, though included queries\n // will still be refetched.\n onQueryUpdated?: OnQueryUpdated | null;\n}\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsStrictlyAny extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult[], when TResult extends boolean.\n TResult extends boolean ? ApolloQueryResult[]\n : // If onQueryUpdated returns a PromiseLike, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// The result of client.refetchQueries is thenable/awaitable, if you just want\n// an array of fully resolved results, but you can also access the raw results\n// immediately by examining the additional { queries, results } properties of\n// the RefetchQueriesResult object.\nexport interface RefetchQueriesResult\n extends Promise> {\n // An array of ObservableQuery objects corresponding 1:1 to TResult values\n // in the results arrays (both the TResult[] array below, and the results\n // array resolved by the Promise above).\n queries: ObservableQuery[];\n // These are the raw TResult values returned by any onQueryUpdated functions\n // that were invoked by client.refetchQueries.\n results: InternalRefetchQueriesResult[];\n}\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache,\n TResult,\n> extends Omit, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise>.\n TResult extends boolean ? Promise>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap = Map<\n ObservableQuery,\n InternalRefetchQueriesResult\n>;\n\n// TODO Remove this unnecessary type in Apollo Client 4.\nexport type { QueryOptions as PureQueryOptions };\n\nexport type OperationVariables = Record;\n\nexport interface ApolloQueryResult {\n data: T;\n /**\n * A list of any errors that occurred during server-side execution of a GraphQL operation.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n errors?: ReadonlyArray;\n /**\n * The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls.\n * This will contain both a NetworkError field and any GraphQLErrors.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n // If result.data was read from the cache with missing fields,\n // result.partial will be true. Otherwise, result.partial will be falsy\n // (usually because the property is absent from the result object).\n partial?: boolean;\n}\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer = (\n previousResult: Record,\n options: {\n mutationResult: FetchResult;\n queryName: string | undefined;\n queryVariables: Record;\n }\n) => Record;\n\nexport type MutationQueryReducersMap = {\n [queryName: string]: MutationQueryReducer;\n};\n\n/**\n * @deprecated Use `MutationUpdaterFunction` instead.\n */\nexport type MutationUpdaterFn = (\n // The MutationUpdaterFn type is broken because it mistakenly uses the same\n // type parameter T for both the cache and the mutationResult. Do not use this\n // type unless you absolutely need it for backwards compatibility.\n cache: ApolloCache,\n mutationResult: FetchResult\n) => void;\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache,\n> = (\n cache: TCache,\n result: Omit, \"context\">,\n options: {\n context?: TContext;\n variables?: TVariables;\n }\n) => void;\nexport interface Resolvers {\n [key: string]: {\n [field: string]: Resolver;\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.d.ts b/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.d.ts new file mode 100644 index 0000000..1880dee --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.d.ts @@ -0,0 +1,450 @@ +import type { DocumentNode } from "graphql"; +import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +import type { FetchResult } from "../link/core/index.js"; +import type { DefaultContext, MutationQueryReducersMap, OperationVariables, MutationUpdaterFunction, OnQueryUpdated, InternalRefetchQueriesInclude } from "./types.js"; +import type { ApolloCache } from "../cache/index.js"; +import type { ObservableQuery } from "./ObservableQuery.js"; +import type { IgnoreModifier } from "../cache/core/types/common.js"; +/** + * fetchPolicy determines where the client may return a result from. The options are: + * - cache-first (default): return result from cache. Only fetch from network if cached result is not available. + * - cache-and-network: return result from cache first (if it exists), then return network result once it's available. + * - cache-only: return result from cache if available, fail otherwise. + * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache + * - network-only: return result from network, fail if network call doesn't succeed, save to cache + * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries. + */ +export type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | "standby"; +export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; +export type MutationFetchPolicy = Extract; +export type RefetchWritePolicy = "merge" | "overwrite"; +/** + * errorPolicy determines the level of events for errors in the execution result. The options are: + * - none (default): any errors from the request are treated like runtime errors and the observable is stopped + * - ignore: errors from the request do not stop the observable, but also don't call `next` + * - all: errors are treated like data and will notify observables + */ +export type ErrorPolicy = "none" | "ignore" | "all"; +/** + * Query options. + */ +export interface QueryOptions { + /** + * A GraphQL query string parsed into an AST with the gql template literal. + * + * @docGroup + * + * 1. Operation options + */ + query: DocumentNode | TypedDocumentNode; + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: TVariables; + /** + * Specifies how the query handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the query result includes error details but not partial results. + * + * @docGroup + * + * 1. Operation options + */ + errorPolicy?: ErrorPolicy; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: DefaultContext; + /** + * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server). + * + * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + * + * The default value is `cache-first`. + * + * @docGroup + * + * 3. Caching options + */ + fetchPolicy?: FetchPolicy; + /** + * Specifies the interval (in milliseconds) at which the query polls for updated results. + * + * The default value is `0` (no polling). + * + * @docGroup + * + * 2. Networking options + */ + pollInterval?: number; + /** + * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs. + * + * The default value is `false`. + * + * @docGroup + * + * 2. Networking options + */ + notifyOnNetworkStatusChange?: boolean; + /** + * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields. + * + * The default value is `false`. + * + * @docGroup + * + * 3. Caching options + */ + returnPartialData?: boolean; + /** + * If `true`, causes a query refetch if the query result is detected as partial. + * + * The default value is `false`. + * + * @deprecated + * + * Setting this option is unnecessary in Apollo Client 3, thanks to a more consistent application of fetch policies. It might be removed in a future release. + */ + partialRefetch?: boolean; + /** + * Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false. + * + * @deprecated + * + * Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + */ + canonizeResults?: boolean; +} +/** + * Watched query options. + */ +export interface WatchQueryOptions extends SharedWatchQueryOptions { + /** + * A GraphQL query string parsed into an AST with the gql template literal. + * + * @docGroup + * + * 1. Operation options + */ + query: DocumentNode | TypedDocumentNode; +} +export interface SharedWatchQueryOptions { + /** + * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server). + * + * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + * + * The default value is `cache-first`. + * + * @docGroup + * + * 3. Caching options + */ + fetchPolicy?: WatchQueryFetchPolicy; + /** + * Specifies the {@link FetchPolicy} to be used after this query has completed. + * + * @docGroup + * + * 3. Caching options + */ + nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext) => WatchQueryFetchPolicy); + /** + * Defaults to the initial value of options.fetchPolicy, but can be explicitly configured to specify the WatchQueryFetchPolicy to revert back to whenever variables change (unless nextFetchPolicy intervenes). + * + * @docGroup + * + * 3. Caching options + */ + initialFetchPolicy?: WatchQueryFetchPolicy; + /** + * Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x. + * + * @docGroup + * + * 3. Caching options + */ + refetchWritePolicy?: RefetchWritePolicy; + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: TVariables; + /** + * Specifies how the query handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the query result includes error details but not partial results. + * + * @docGroup + * + * 1. Operation options + */ + errorPolicy?: ErrorPolicy; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: DefaultContext; + /** + * Specifies the interval (in milliseconds) at which the query polls for updated results. + * + * The default value is `0` (no polling). + * + * @docGroup + * + * 2. Networking options + */ + pollInterval?: number; + /** + * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs. + * + * The default value is `false`. + * + * @docGroup + * + * 2. Networking options + */ + notifyOnNetworkStatusChange?: boolean; + /** + * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields. + * + * The default value is `false`. + * + * @docGroup + * + * 3. Caching options + */ + returnPartialData?: boolean; + /** + * If `true`, causes a query refetch if the query result is detected as partial. + * + * The default value is `false`. + * + * @deprecated + * + * Setting this option is unnecessary in Apollo Client 3, thanks to a more consistent application of fetch policies. It might be removed in a future release. + */ + partialRefetch?: boolean; + /** + * Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false. + * + * @deprecated + * + * Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + */ + canonizeResults?: boolean; + /** + * A callback function that's called whenever a refetch attempt occurs while polling. If the function returns `true`, the refetch is skipped and not reattempted until the next poll interval. + * + * @docGroup + * + * 2. Networking options + */ + skipPollAttempt?: () => boolean; +} +export interface NextFetchPolicyContext { + reason: "after-fetch" | "variables-changed"; + observable: ObservableQuery; + options: WatchQueryOptions; + initialFetchPolicy: WatchQueryFetchPolicy; +} +export interface FetchMoreQueryOptions { + /** + * A GraphQL query string parsed into an AST with the gql template literal. + * + * @docGroup + * + * 1. Operation options + */ + query?: DocumentNode | TypedDocumentNode; + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: Partial; + context?: DefaultContext; +} +export type UpdateQueryFn = (previousQueryResult: TData, options: { + subscriptionData: { + data: TSubscriptionData; + }; + variables?: TSubscriptionVariables; +}) => TData; +export type SubscribeToMoreOptions = { + document: DocumentNode | TypedDocumentNode; + variables?: TSubscriptionVariables; + updateQuery?: UpdateQueryFn; + onError?: (error: Error) => void; + context?: DefaultContext; +}; +export interface SubscriptionOptions { + /** + * A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single subscription inside of it. + */ + query: DocumentNode | TypedDocumentNode; + /** + * An object containing all of the variables your subscription needs to execute + */ + variables?: TVariables; + /** + * How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + */ + fetchPolicy?: FetchPolicy; + /** + * Specifies the {@link ErrorPolicy} to be used for this operation + */ + errorPolicy?: ErrorPolicy; + /** + * Shared context between your component and your network interface (Apollo Link). + */ + context?: DefaultContext; +} +export interface MutationBaseOptions = ApolloCache> { + /** + * By providing either an object or a callback function that, when invoked after a mutation, allows you to return optimistic data and optionally skip updates via the `IGNORE` sentinel object, Apollo Client caches this temporary (and potentially incorrect) response until the mutation completes, enabling more responsive UI updates. + * + * For more information, see [Optimistic mutation results](https://www.apollographql.com/docs/react/performance/optimistic-ui/). + * + * @docGroup + * + * 3. Caching options + */ + optimisticResponse?: TData | ((vars: TVariables, { IGNORE }: { + IGNORE: IgnoreModifier; + }) => TData); + /** + * A {@link MutationQueryReducersMap}, which is map from query names to mutation query reducers. Briefly, this map defines how to incorporate the results of the mutation into the results of queries that are currently being watched by your application. + */ + updateQueries?: MutationQueryReducersMap; + /** + * An array (or a function that _returns_ an array) that specifies which queries you want to refetch after the mutation occurs. + * + * Each array value can be either: + * + * - An object containing the `query` to execute, along with any `variables` + * + * - A string indicating the operation name of the query to refetch + * + * @docGroup + * + * 1. Operation options + */ + refetchQueries?: ((result: FetchResult) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude; + /** + * If `true`, makes sure all queries included in `refetchQueries` are completed before the mutation is considered complete. + * + * The default value is `false` (queries are refetched asynchronously). + * + * @docGroup + * + * 1. Operation options + */ + awaitRefetchQueries?: boolean; + /** + * A function used to update the Apollo Client cache after the mutation completes. + * + * For more information, see [Updating the cache after a mutation](https://www.apollographql.com/docs/react/data/mutations#updating-the-cache-after-a-mutation). + * + * @docGroup + * + * 3. Caching options + */ + update?: MutationUpdaterFunction; + /** + * Optional callback for intercepting queries whose cache data has been updated by the mutation, as well as any queries specified in the `refetchQueries: [...]` list passed to `client.mutate`. + * + * Returning a `Promise` from `onQueryUpdated` will cause the final mutation `Promise` to await the returned `Promise`. Returning `false` causes the query to be ignored. + * + * @docGroup + * + * 1. Operation options + */ + onQueryUpdated?: OnQueryUpdated; + /** + * Specifies how the mutation handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results. + * + * @docGroup + * + * 1. Operation options + */ + errorPolicy?: ErrorPolicy; + /** + * An object containing all of the GraphQL variables your mutation requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: TVariables; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: TContext; +} +export interface MutationOptions = ApolloCache> extends MutationSharedOptions { + /** + * A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single mutation inside of it. + * + * @docGroup + * + * 1. Operation options + */ + mutation: DocumentNode | TypedDocumentNode; +} +export interface MutationSharedOptions = ApolloCache> extends MutationBaseOptions { + /** + * Provide `no-cache` if the mutation's result should _not_ be written to the Apollo Client cache. + * + * The default value is `network-only` (which means the result _is_ written to the cache). + * + * Unlike queries, mutations _do not_ support [fetch policies](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy) besides `network-only` and `no-cache`. + * + * @docGroup + * + * 3. Caching options + */ + fetchPolicy?: MutationFetchPolicy; + /** + * To avoid retaining sensitive information from mutation root field arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION` fields from the cache after each mutation finishes. If you need this information to remain in the cache, you can prevent the removal by passing `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are also passed to the mutation `update` function, so we recommend obtaining the results that way, rather than using this option, if possible. + */ + keepRootFields?: boolean; +} +//# sourceMappingURL=watchQueryOptions.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js b/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js new file mode 100644 index 0000000..e76ecfa --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=watchQueryOptions.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js.map b/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js.map new file mode 100644 index 0000000..0a74ce7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/core/watchQueryOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type { FetchResult } from \"../link/core/index.js\";\nimport type {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from \"./types.js\";\nimport type { ApolloCache } from \"../cache/index.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\nimport type { IgnoreModifier } from \"../cache/core/types/common.js\";\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | \"cache-first\"\n | \"network-only\"\n | \"cache-only\"\n | \"no-cache\"\n | \"standby\";\n\nexport type WatchQueryFetchPolicy = FetchPolicy | \"cache-and-network\";\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | \"network-only\" // default behavior (mutation results written to cache)\n | \"no-cache\" // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = \"none\" | \"ignore\" | \"all\";\n\n/**\n * Query options.\n */\nexport interface QueryOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#partialRefetch:member} */\n partialRefetch?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n TData = any,\n> extends SharedWatchQueryOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode;\n}\n\nexport interface SharedWatchQueryOptions<\n TVariables extends OperationVariables,\n TData,\n> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#nextFetchPolicy:member} */\n nextFetchPolicy?:\n | WatchQueryFetchPolicy\n | ((\n this: WatchQueryOptions,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext\n ) => WatchQueryFetchPolicy);\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#initialFetchPolicy:member} */\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#partialRefetch:member} */\n partialRefetch?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skipPollAttempt:member} */\n skipPollAttempt?: () => boolean;\n}\n\nexport interface NextFetchPolicyContext<\n TData,\n TVariables extends OperationVariables,\n> {\n reason: \"after-fetch\" | \"variables-changed\";\n observable: ObservableQuery;\n options: WatchQueryOptions;\n initialFetchPolicy: WatchQueryFetchPolicy;\n}\n\nexport interface FetchMoreQueryOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query?: DocumentNode | TypedDocumentNode;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: Partial;\n context?: DefaultContext;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData,\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n }\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData,\n> = {\n document:\n | DocumentNode\n | TypedDocumentNode;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<\n TVariables = OperationVariables,\n TData = any,\n> {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#optimisticResponse:member} */\n optimisticResponse?:\n | TData\n | ((vars: TVariables, { IGNORE }: { IGNORE: IgnoreModifier }) => TData);\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#updateQueries:member} */\n updateQueries?: MutationQueryReducersMap;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#refetchQueries:member} */\n refetchQueries?:\n | ((result: FetchResult) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#awaitRefetchQueries:member} */\n awaitRefetchQueries?: boolean;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#update:member} */\n update?: MutationUpdaterFunction;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onQueryUpdated:member} */\n onQueryUpdated?: OnQueryUpdated;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#context:member} */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> extends MutationSharedOptions {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */\n mutation: DocumentNode | TypedDocumentNode;\n}\nexport interface MutationSharedOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> extends MutationBaseOptions {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: MutationFetchPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#keepRootFields:member} */\n keepRootFields?: boolean;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs b/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs new file mode 100644 index 0000000..5f97aed --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs @@ -0,0 +1,553 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../utilities/globals'); +var tsInvariant = require('ts-invariant'); + +const errorCodes = +{ + 1: { + file: "@apollo/client/cache/inmemory/entityStore.js", + condition: "typeof dataId === \"string\"", + message: "store.merge expects a string ID" + }, + 4: { + file: "@apollo/client/cache/inmemory/key-extractor.js", + condition: "extracted !== void 0", + message: "Missing field '%s' while extracting keyFields from %s" + }, + 5: { + file: "@apollo/client/cache/inmemory/policies.js", + condition: "!old || old === which", + message: "Cannot change root %s __typename more than once" + }, + 8: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Cannot automatically merge arrays" + }, + 9: { + file: "@apollo/client/cache/inmemory/readFromStore.js", + message: "No fragment named %s" + }, + 10: { + file: "@apollo/client/cache/inmemory/readFromStore.js", + condition: "!isReference(value)", + message: "Missing selection set for object of type %s returned for query field %s" + }, + 11: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Could not identify object %s" + }, + 13: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "No fragment named %s" + }, + 15: { + file: "@apollo/client/core/ApolloClient.js", + message: "To initialize Apollo Client, you must specify a 'cache' property " + + "in the options object. \n" + + "For more information, please visit: https://go.apollo.dev/c/docs" + }, + 16: { + file: "@apollo/client/core/ApolloClient.js", + condition: "options.fetchPolicy !== \"cache-and-network\"", + message: "The cache-and-network fetchPolicy does not work with client.query, because " + + "client.query can only return a single result. Please use client.watchQuery " + + "to receive multiple results from the cache and the network, or consider " + + "using a different fetchPolicy, such as cache-first or network-only." + }, + 18: { + file: "@apollo/client/core/LocalState.js", + condition: "fragment", + message: "No fragment named %s" + }, + 19: { + file: "@apollo/client/core/LocalState.js", + condition: "fragment", + message: "No fragment named %s" + }, + 22: { + file: "@apollo/client/core/ObservableQuery.js", + condition: "pollInterval", + message: "Attempted to start a polling query without a polling interval." + }, + 25: { + file: "@apollo/client/core/QueryManager.js", + message: "QueryManager stopped while query was in flight" + }, + 26: { + file: "@apollo/client/core/QueryManager.js", + condition: "mutation", + message: "mutation option is required. You must specify your GraphQL document in the mutation option." + }, + 27: { + file: "@apollo/client/core/QueryManager.js", + condition: "fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\"", + message: "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write." + }, + 28: { + file: "@apollo/client/core/QueryManager.js", + condition: "options.query", + message: "query option is required. You must specify your GraphQL document " + + "in the query option." + }, + 29: { + file: "@apollo/client/core/QueryManager.js", + condition: "options.query.kind === \"Document\"", + message: 'You must wrap the query string in a "gql" tag.' + }, + 30: { + file: "@apollo/client/core/QueryManager.js", + condition: "!options.returnPartialData", + message: "returnPartialData option only supported on watchQuery." + }, + 31: { + file: "@apollo/client/core/QueryManager.js", + condition: "!options.pollInterval", + message: "pollInterval option only supported on watchQuery." + }, + 32: { + file: "@apollo/client/core/QueryManager.js", + message: "Store reset while query was in flight (not completed in link chain)" + }, + 36: { + file: "@apollo/client/link/core/ApolloLink.js", + message: "request is not implemented" + }, + 37: { + file: "@apollo/client/link/http/checkFetcher.js", + message: "\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n " + }, + 39: { + file: "@apollo/client/link/http/serializeFetchParameter.js", + message: "Network request failed. %s is not serializable: %s" + }, + 40: { + file: "@apollo/client/link/persisted-queries/index.js", + condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")", + message: 'Missing/invalid "sha256" or "generateHash" function. Please ' + + 'configure one using the "createPersistedQueryLink(options)" options ' + + "parameter." + }, + 41: { + file: "@apollo/client/link/persisted-queries/index.js", + condition: "forward", + message: "PersistedQueryLink cannot be the last link in the chain." + }, + 43: { + file: "@apollo/client/link/utils/validateOperation.js", + message: "illegal argument: %s" + }, + 44: { + file: "@apollo/client/react/context/ApolloConsumer.js", + condition: "context && context.client", + message: 'Could not find "client" in the context of ApolloConsumer. ' + + "Wrap the root component in an ." + }, + 45: { + file: "@apollo/client/react/context/ApolloContext.js", + condition: "\"createContext\" in React", + message: "Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n" + + "The Apollo Client functionality you are trying to use is only available in React Client Components.\n" + + 'Please make sure to add "use client" at the top of your file.\n' + + "For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components" + }, + 46: { + file: "@apollo/client/react/context/ApolloProvider.js", + condition: "context.client", + message: "ApolloProvider was not passed a client instance. Make " + + 'sure you pass in your client via the "client" prop.' + }, + 47: { + file: "@apollo/client/react/hoc/hoc-utils.js", + condition: "this.withRef", + message: "To access the wrapped instance, you need to specify " + + "{ withRef: true } in the options" + }, + 48: { + file: "@apollo/client/react/hoc/withApollo.js", + condition: "operationOptions.withRef", + message: "To access the wrapped instance, you need to specify " + + "{ withRef: true } in the options" + }, + 49: { + file: "@apollo/client/react/hooks/useApolloClient.js", + condition: "!!client", + message: 'Could not find "client" in the context or passed in as an option. ' + + "Wrap the root component in an , or pass an ApolloClient " + + "instance in via options." + }, + 50: { + file: "@apollo/client/react/hooks/useLoadableQuery.js", + condition: "!calledDuringRender()", + message: "useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook." + }, + 56: { + file: "@apollo/client/react/hooks/useSuspenseQuery.js", + condition: "supportedFetchPolicies.includes(fetchPolicy)", + message: "The fetch policy `%s` is not supported with suspense." + }, + 59: { + file: "@apollo/client/react/parser/index.js", + condition: "!!document && !!document.kind", + message: "Argument of %s passed to parser was not a valid GraphQL " + + "DocumentNode. You may need to use 'graphql-tag' or another method " + + "to convert your operation into a document" + }, + 60: { + file: "@apollo/client/react/parser/index.js", + condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length", + message: "Passing only a fragment to 'graphql' is not yet supported. " + + "You must include a query, subscription or mutation as well" + }, + 61: { + file: "@apollo/client/react/parser/index.js", + condition: "queries.length + mutations.length + subscriptions.length <= 1", + message: "react-apollo only supports a query, subscription, or a mutation per HOC. " + + "%s had %s queries, %s " + + "subscriptions and %s mutations. " + + "You can use 'compose' to join multiple operation types to a component" + }, + 62: { + file: "@apollo/client/react/parser/index.js", + condition: "definitions.length === 1", + message: "react-apollo only supports one definition per HOC. %s had " + + "%s definitions. " + + "You can use 'compose' to join multiple operation types to a component" + }, + 63: { + file: "@apollo/client/react/parser/index.js", + condition: "operation.type === type", + message: "Running a %s requires a graphql " + "%s, but a %s was used instead." + }, + 64: { + file: "@apollo/client/testing/core/mocking/mockLink.js", + condition: "queryWithoutConnection", + message: "query is required" + }, + 65: { + file: "@apollo/client/testing/core/mocking/mockLink.js", + condition: "mockedResponse.maxUsageCount > 0", + message: "Mock response maxUsageCount must be greater than 0, %s given" + }, + 66: { + file: "@apollo/client/utilities/graphql/DocumentTransform.js", + condition: "Array.isArray(cacheKeys)", + message: "`getCacheKey` must return an array or undefined" + }, + 67: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "evaledValue !== void 0", + message: "Invalid variable referenced in @%s directive." + }, + 68: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "directiveArguments && directiveArguments.length === 1", + message: "Incorrect number of arguments for the @%s directive." + }, + 69: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "ifArgument.name && ifArgument.name.value === \"if\"", + message: "Invalid argument for the @%s directive." + }, + 70: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")", + message: "Argument for the @%s directive must be a variable or a boolean value." + }, + 71: { + file: "@apollo/client/utilities/graphql/fragments.js", + message: "Found a %s operation%s. " + + "No operations are allowed when using a fragment as a query. Only fragments are allowed." + }, + 72: { + file: "@apollo/client/utilities/graphql/fragments.js", + condition: "fragments.length === 1", + message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment." + }, + 73: { + file: "@apollo/client/utilities/graphql/fragments.js", + condition: "fragment", + message: "No fragment named %s" + }, + 74: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc && doc.kind === \"Document\"", + message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql" + }, + 75: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + message: "Schema type definitions not allowed in queries. Found: \"%s\"" + }, + 76: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "operations.length <= 1", + message: "Ambiguous GraphQL document: contains %s operations" + }, + 77: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "queryDef && queryDef.operation === \"query\"", + message: "Must contain a query definition." + }, + 78: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc.kind === \"Document\"", + message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql" + }, + 79: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc.definitions.length <= 1", + message: "Fragment must have exactly one definition." + }, + 80: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "fragmentDef.kind === \"FragmentDefinition\"", + message: "Must be a fragment definition." + }, + 81: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment." + }, + 82: { + file: "@apollo/client/utilities/graphql/storeUtils.js", + message: "The inline argument \"%s\" of kind \"%s\"" + + "is not supported. Use variables instead of inline arguments to " + + "overcome this limitation." + } +}; +const devDebug = { + 17: { + file: "@apollo/client/core/ApolloClient.js", + message: "In client.refetchQueries, Promise.all promise rejected with error %o" + }, + 24: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Missing cache result fields: %o" + } +}; +const devLog = {}; +const devWarn = { + 2: { + file: "@apollo/client/cache/inmemory/entityStore.js", + message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" + + "Please make sure to set the `mergeIntoStore` parameter to `true` when creating a Reference that is not part of the store yet:\n" + + "`toReference(object, true)`" + }, + 3: { + file: "@apollo/client/cache/inmemory/entityStore.js", + message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" + + "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`." + }, + 6: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Inferring subtype %s of supertype %s" + }, + 7: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Undefined 'from' passed to readField with arguments %s" + }, + 14: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Cache data may be lost when replacing the %s field of a %s object.\n\nThis could cause additional (usually avoidable) network requests to fetch data that were otherwise cached.\n\nTo address this problem (which is not a bug in Apollo Client), %sdefine a custom merge function for the %s field, so InMemoryCache can safely merge these objects:\n\n existing: %o\n incoming: %o\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n" + }, + 20: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Called refetch(%o) for query %o, which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?" + }, + 33: { + file: "@apollo/client/core/QueryManager.js", + message: "Unknown query named \"%s\" requested in refetchQueries options.include array" + }, + 34: { + file: "@apollo/client/core/QueryManager.js", + message: "Unknown query %o requested in refetchQueries options.include array" + }, + 35: { + file: "@apollo/client/link/core/ApolloLink.js", + message: "You are calling concat on a terminating link, which will have no effect %o" + }, + 38: { + file: "@apollo/client/link/http/createHttpLink.js", + message: "Multipart-subscriptions do not support @defer" + }, + 42: { + file: "@apollo/client/link/utils/toPromise.js", + message: "Promise Wrapper does not support multiple results from Observable" + }, + 51: { + file: "@apollo/client/react/hooks/useQuery.js", + message: "Calling default no-op implementation of InternalState#forceUpdate" + }, + 52: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used." + }, + 53: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead." + }, + 54: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used." + }, + 55: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead." + }, + 57: { + file: "@apollo/client/react/hooks/useSuspenseQuery.js", + message: "Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy." + }, + 84: { + file: "@apollo/client/utilities/graphql/transform.js", + message: "Removing an @connection directive even though it does not have a key. " + + "You may want to use the key parameter to specify a store key." + } +}; +const devError = { + 12: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Missing field '%s' while writing result %o" + }, + 21: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Unhandled GraphQL subscription error" + }, + 23: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Unhandled error" + }, + 58: { + file: "@apollo/client/react/hooks/useSyncExternalStore.js", + message: "The result of getSnapshot should be cached to avoid an infinite loop" + }, + 83: { + file: "@apollo/client/utilities/graphql/transform.js", + message: "Could not find operation or fragment" + } +}; + +var version = "3.9.5"; + +function maybe(thunk) { + try { + return thunk(); + } + catch (_a) { } +} + +var global$1 = (maybe(function () { return globalThis; }) || + maybe(function () { return window; }) || + maybe(function () { return self; }) || + maybe(function () { return global; }) || +maybe(function () { + return maybe.constructor("return this")(); +})); + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} + +function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} + +function wrap(fn) { + return function (message) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof message === "number") { + var arg0 = message; + message = getHandledErrorMsg(arg0); + if (!message) { + message = getFallbackErrorMsg(arg0, args); + args = []; + } + } + fn.apply(void 0, [message].concat(args)); + }; +} +Object.assign(function invariant(condition, message) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (!condition) { + tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args)); + } +}, { + debug: wrap(tsInvariant.invariant.debug), + log: wrap(tsInvariant.invariant.log), + warn: wrap(tsInvariant.invariant.warn), + error: wrap(tsInvariant.invariant.error), +}); +var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version); +function stringify(arg) { + return typeof arg == "string" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000)); +} +function getHandledErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return (global$1[ApolloErrorMessageHandler] && + global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify))); +} +function getFallbackErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({ + version: version, + message: message, + args: messageArgs.map(stringify), + }))); +} + +function loadErrorMessageHandler() { + var errorCodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + errorCodes[_i] = arguments[_i]; + } + if (!globals.global[ApolloErrorMessageHandler]) { + globals.global[ApolloErrorMessageHandler] = handler; + } + for (var _a = 0, errorCodes_1 = errorCodes; _a < errorCodes_1.length; _a++) { + var codes = errorCodes_1[_a]; + Object.assign(globals.global[ApolloErrorMessageHandler], codes); + } + return globals.global[ApolloErrorMessageHandler]; + function handler(message, args) { + if (typeof message === "number") { + var definition = globals.global[ApolloErrorMessageHandler][message]; + if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message)) + return; + message = definition.message; + } + return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message)); + } +} + +function loadDevMessages() { + loadErrorMessageHandler(devDebug, devError, devLog, devWarn); +} + +function loadErrorMessages() { + loadErrorMessageHandler(errorCodes); +} + +exports.loadDevMessages = loadDevMessages; +exports.loadErrorMessageHandler = loadErrorMessageHandler; +exports.loadErrorMessages = loadErrorMessages; +//# sourceMappingURL=dev.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.map b/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.map new file mode 100644 index 0000000..2a1c2b9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"dev.cjs","sources":["../invariantErrorCodes.js","../version.js","../utilities/globals/maybe.js","../utilities/globals/global.js","../utilities/common/makeUniqueId.js","../utilities/common/stringifyForDisplay.js","../utilities/globals/invariantWrappers.js","loadErrorMessageHandler.js","loadDevMessages.js","loadErrorMessages.js"],"sourcesContent":["export const errorCodes = // This file is used by the error message display website and the\n// @apollo/client/includeErrors entry point.\n// This file is not meant to be imported manually.\n{\n 1: {\n file: \"@apollo/client/cache/inmemory/entityStore.js\",\n condition: \"typeof dataId === \\\"string\\\"\",\n message: \"store.merge expects a string ID\"\n },\n\n 4: {\n file: \"@apollo/client/cache/inmemory/key-extractor.js\",\n condition: \"extracted !== void 0\",\n message: \"Missing field '%s' while extracting keyFields from %s\"\n },\n\n 5: {\n file: \"@apollo/client/cache/inmemory/policies.js\",\n condition: \"!old || old === which\",\n message: \"Cannot change root %s __typename more than once\"\n },\n\n 8: {\n file: \"@apollo/client/cache/inmemory/policies.js\",\n message: \"Cannot automatically merge arrays\"\n },\n\n 9: {\n file: \"@apollo/client/cache/inmemory/readFromStore.js\",\n message: \"No fragment named %s\"\n },\n\n 10: {\n file: \"@apollo/client/cache/inmemory/readFromStore.js\",\n condition: \"!isReference(value)\",\n message: \"Missing selection set for object of type %s returned for query field %s\"\n },\n\n 11: {\n file: \"@apollo/client/cache/inmemory/writeToStore.js\",\n message: \"Could not identify object %s\"\n },\n\n 13: {\n file: \"@apollo/client/cache/inmemory/writeToStore.js\",\n message: \"No fragment named %s\"\n },\n\n 15: {\n file: \"@apollo/client/core/ApolloClient.js\",\n\n message: \"To initialize Apollo Client, you must specify a 'cache' property \" +\n \"in the options object. \\n\" +\n \"For more information, please visit: https://go.apollo.dev/c/docs\"\n },\n\n 16: {\n file: \"@apollo/client/core/ApolloClient.js\",\n condition: \"options.fetchPolicy !== \\\"cache-and-network\\\"\",\n\n message: \"The cache-and-network fetchPolicy does not work with client.query, because \" +\n \"client.query can only return a single result. Please use client.watchQuery \" +\n \"to receive multiple results from the cache and the network, or consider \" +\n \"using a different fetchPolicy, such as cache-first or network-only.\"\n },\n\n 18: {\n file: \"@apollo/client/core/LocalState.js\",\n condition: \"fragment\",\n message: \"No fragment named %s\"\n },\n\n 19: {\n file: \"@apollo/client/core/LocalState.js\",\n condition: \"fragment\",\n message: \"No fragment named %s\"\n },\n\n 22: {\n file: \"@apollo/client/core/ObservableQuery.js\",\n condition: \"pollInterval\",\n message: \"Attempted to start a polling query without a polling interval.\"\n },\n\n 25: {\n file: \"@apollo/client/core/QueryManager.js\",\n message: \"QueryManager stopped while query was in flight\"\n },\n\n 26: {\n file: \"@apollo/client/core/QueryManager.js\",\n condition: \"mutation\",\n message: \"mutation option is required. You must specify your GraphQL document in the mutation option.\"\n },\n\n 27: {\n file: \"@apollo/client/core/QueryManager.js\",\n condition: \"fetchPolicy === \\\"network-only\\\" || fetchPolicy === \\\"no-cache\\\"\",\n message: \"Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.\"\n },\n\n 28: {\n file: \"@apollo/client/core/QueryManager.js\",\n condition: \"options.query\",\n\n message: \"query option is required. You must specify your GraphQL document \" +\n \"in the query option.\"\n },\n\n 29: {\n file: \"@apollo/client/core/QueryManager.js\",\n condition: \"options.query.kind === \\\"Document\\\"\",\n message: 'You must wrap the query string in a \"gql\" tag.'\n },\n\n 30: {\n file: \"@apollo/client/core/QueryManager.js\",\n condition: \"!options.returnPartialData\",\n message: \"returnPartialData option only supported on watchQuery.\"\n },\n\n 31: {\n file: \"@apollo/client/core/QueryManager.js\",\n condition: \"!options.pollInterval\",\n message: \"pollInterval option only supported on watchQuery.\"\n },\n\n 32: {\n file: \"@apollo/client/core/QueryManager.js\",\n message: \"Store reset while query was in flight (not completed in link chain)\"\n },\n\n 36: {\n file: \"@apollo/client/link/core/ApolloLink.js\",\n message: \"request is not implemented\"\n },\n\n 37: {\n file: \"@apollo/client/link/http/checkFetcher.js\",\n message: \"\\n\\\"fetch\\\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\\n\\nimport fetch from 'cross-fetch';\\nimport { ApolloClient, HttpLink } from '@apollo/client';\\nconst client = new ApolloClient({\\n link: new HttpLink({ uri: '/graphql', fetch })\\n});\\n \"\n },\n\n 39: {\n file: \"@apollo/client/link/http/serializeFetchParameter.js\",\n message: \"Network request failed. %s is not serializable: %s\"\n },\n\n 40: {\n file: \"@apollo/client/link/persisted-queries/index.js\",\n condition: \"options &&\\n (typeof options.sha256 === \\\"function\\\" ||\\n typeof options.generateHash === \\\"function\\\")\",\n\n message: 'Missing/invalid \"sha256\" or \"generateHash\" function. Please ' +\n 'configure one using the \"createPersistedQueryLink(options)\" options ' +\n \"parameter.\"\n },\n\n 41: {\n file: \"@apollo/client/link/persisted-queries/index.js\",\n condition: \"forward\",\n message: \"PersistedQueryLink cannot be the last link in the chain.\"\n },\n\n 43: {\n file: \"@apollo/client/link/utils/validateOperation.js\",\n message: \"illegal argument: %s\"\n },\n\n 44: {\n file: \"@apollo/client/react/context/ApolloConsumer.js\",\n condition: \"context && context.client\",\n\n message: 'Could not find \"client\" in the context of ApolloConsumer. ' +\n \"Wrap the root component in an .\"\n },\n\n 45: {\n file: \"@apollo/client/react/context/ApolloContext.js\",\n condition: \"\\\"createContext\\\" in React\",\n\n message: \"Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n\" +\n \"The Apollo Client functionality you are trying to use is only available in React Client Components.\\n\" +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n \"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components\"\n },\n\n 46: {\n file: \"@apollo/client/react/context/ApolloProvider.js\",\n condition: \"context.client\",\n\n message: \"ApolloProvider was not passed a client instance. Make \" +\n 'sure you pass in your client via the \"client\" prop.'\n },\n\n 47: {\n file: \"@apollo/client/react/hoc/hoc-utils.js\",\n condition: \"this.withRef\",\n\n message: \"To access the wrapped instance, you need to specify \" +\n \"{ withRef: true } in the options\"\n },\n\n 48: {\n file: \"@apollo/client/react/hoc/withApollo.js\",\n condition: \"operationOptions.withRef\",\n\n message: \"To access the wrapped instance, you need to specify \" +\n \"{ withRef: true } in the options\"\n },\n\n 49: {\n file: \"@apollo/client/react/hooks/useApolloClient.js\",\n condition: \"!!client\",\n\n message: 'Could not find \"client\" in the context or passed in as an option. ' +\n \"Wrap the root component in an , or pass an ApolloClient \" +\n \"instance in via options.\"\n },\n\n 50: {\n file: \"@apollo/client/react/hooks/useLoadableQuery.js\",\n condition: \"!calledDuringRender()\",\n message: \"useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook.\"\n },\n\n 56: {\n file: \"@apollo/client/react/hooks/useSuspenseQuery.js\",\n condition: \"supportedFetchPolicies.includes(fetchPolicy)\",\n message: \"The fetch policy `%s` is not supported with suspense.\"\n },\n\n 59: {\n file: \"@apollo/client/react/parser/index.js\",\n condition: \"!!document && !!document.kind\",\n\n message: \"Argument of %s passed to parser was not a valid GraphQL \" +\n \"DocumentNode. You may need to use 'graphql-tag' or another method \" +\n \"to convert your operation into a document\"\n },\n\n 60: {\n file: \"@apollo/client/react/parser/index.js\",\n condition: \"!fragments.length ||\\n queries.length ||\\n mutations.length ||\\n subscriptions.length\",\n\n message: \"Passing only a fragment to 'graphql' is not yet supported. \" +\n \"You must include a query, subscription or mutation as well\"\n },\n\n 61: {\n file: \"@apollo/client/react/parser/index.js\",\n condition: \"queries.length + mutations.length + subscriptions.length <= 1\",\n\n message: \"react-apollo only supports a query, subscription, or a mutation per HOC. \" +\n \"%s had %s queries, %s \" +\n \"subscriptions and %s mutations. \" +\n \"You can use 'compose' to join multiple operation types to a component\"\n },\n\n 62: {\n file: \"@apollo/client/react/parser/index.js\",\n condition: \"definitions.length === 1\",\n\n message: \"react-apollo only supports one definition per HOC. %s had \" +\n \"%s definitions. \" +\n \"You can use 'compose' to join multiple operation types to a component\"\n },\n\n 63: {\n file: \"@apollo/client/react/parser/index.js\",\n condition: \"operation.type === type\",\n message: \"Running a %s requires a graphql \" + \"%s, but a %s was used instead.\"\n },\n\n 64: {\n file: \"@apollo/client/testing/core/mocking/mockLink.js\",\n condition: \"queryWithoutConnection\",\n message: \"query is required\"\n },\n\n 65: {\n file: \"@apollo/client/testing/core/mocking/mockLink.js\",\n condition: \"mockedResponse.maxUsageCount > 0\",\n message: \"Mock response maxUsageCount must be greater than 0, %s given\"\n },\n\n 66: {\n file: \"@apollo/client/utilities/graphql/DocumentTransform.js\",\n condition: \"Array.isArray(cacheKeys)\",\n message: \"`getCacheKey` must return an array or undefined\"\n },\n\n 67: {\n file: \"@apollo/client/utilities/graphql/directives.js\",\n condition: \"evaledValue !== void 0\",\n message: \"Invalid variable referenced in @%s directive.\"\n },\n\n 68: {\n file: \"@apollo/client/utilities/graphql/directives.js\",\n condition: \"directiveArguments && directiveArguments.length === 1\",\n message: \"Incorrect number of arguments for the @%s directive.\"\n },\n\n 69: {\n file: \"@apollo/client/utilities/graphql/directives.js\",\n condition: \"ifArgument.name && ifArgument.name.value === \\\"if\\\"\",\n message: \"Invalid argument for the @%s directive.\"\n },\n\n 70: {\n file: \"@apollo/client/utilities/graphql/directives.js\",\n condition: \"ifValue &&\\n (ifValue.kind === \\\"Variable\\\" || ifValue.kind === \\\"BooleanValue\\\")\",\n message: \"Argument for the @%s directive must be a variable or a boolean value.\"\n },\n\n 71: {\n file: \"@apollo/client/utilities/graphql/fragments.js\",\n\n message: \"Found a %s operation%s. \" +\n \"No operations are allowed when using a fragment as a query. Only fragments are allowed.\"\n },\n\n 72: {\n file: \"@apollo/client/utilities/graphql/fragments.js\",\n condition: \"fragments.length === 1\",\n message: \"Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment.\"\n },\n\n 73: {\n file: \"@apollo/client/utilities/graphql/fragments.js\",\n condition: \"fragment\",\n message: \"No fragment named %s\"\n },\n\n 74: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n condition: \"doc && doc.kind === \\\"Document\\\"\",\n message: \"Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \\\"gql\\\" tag? http://docs.apollostack.com/apollo-client/core.html#gql\"\n },\n\n 75: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n message: \"Schema type definitions not allowed in queries. Found: \\\"%s\\\"\"\n },\n\n 76: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n condition: \"operations.length <= 1\",\n message: \"Ambiguous GraphQL document: contains %s operations\"\n },\n\n 77: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n condition: \"queryDef && queryDef.operation === \\\"query\\\"\",\n message: \"Must contain a query definition.\"\n },\n\n 78: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n condition: \"doc.kind === \\\"Document\\\"\",\n message: \"Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \\\"gql\\\" tag? http://docs.apollostack.com/apollo-client/core.html#gql\"\n },\n\n 79: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n condition: \"doc.definitions.length <= 1\",\n message: \"Fragment must have exactly one definition.\"\n },\n\n 80: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n condition: \"fragmentDef.kind === \\\"FragmentDefinition\\\"\",\n message: \"Must be a fragment definition.\"\n },\n\n 81: {\n file: \"@apollo/client/utilities/graphql/getFromAST.js\",\n message: \"Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.\"\n },\n\n 82: {\n file: \"@apollo/client/utilities/graphql/storeUtils.js\",\n\n message: \"The inline argument \\\"%s\\\" of kind \\\"%s\\\"\" +\n \"is not supported. Use variables instead of inline arguments to \" +\n \"overcome this limitation.\"\n }\n};\n\nexport const devDebug = {\n 17: {\n file: \"@apollo/client/core/ApolloClient.js\",\n message: \"In client.refetchQueries, Promise.all promise rejected with error %o\"\n },\n\n 24: {\n file: \"@apollo/client/core/ObservableQuery.js\",\n message: \"Missing cache result fields: %o\"\n }\n};\n\nexport const devLog = {};\n\nexport const devWarn = {\n 2: {\n file: \"@apollo/client/cache/inmemory/entityStore.js\",\n\n message: \"cache.modify: You are trying to write a Reference that is not part of the store: %o\\n\" +\n \"Please make sure to set the `mergeIntoStore` parameter to `true` when creating a Reference that is not part of the store yet:\\n\" +\n \"`toReference(object, true)`\"\n },\n\n 3: {\n file: \"@apollo/client/cache/inmemory/entityStore.js\",\n\n message: \"cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\\n\" +\n \"Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`.\"\n },\n\n 6: {\n file: \"@apollo/client/cache/inmemory/policies.js\",\n message: \"Inferring subtype %s of supertype %s\"\n },\n\n 7: {\n file: \"@apollo/client/cache/inmemory/policies.js\",\n message: \"Undefined 'from' passed to readField with arguments %s\"\n },\n\n 14: {\n file: \"@apollo/client/cache/inmemory/writeToStore.js\",\n message: \"Cache data may be lost when replacing the %s field of a %s object.\\n\\nThis could cause additional (usually avoidable) network requests to fetch data that were otherwise cached.\\n\\nTo address this problem (which is not a bug in Apollo Client), %sdefine a custom merge function for the %s field, so InMemoryCache can safely merge these objects:\\n\\n existing: %o\\n incoming: %o\\n\\nFor more information about these options, please refer to the documentation:\\n\\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\\n\"\n },\n\n 20: {\n file: \"@apollo/client/core/ObservableQuery.js\",\n message: \"Called refetch(%o) for query %o, which does not declare a $variables variable.\\nDid you mean to call refetch(variables) instead of refetch({ variables })?\"\n },\n\n 33: {\n file: \"@apollo/client/core/QueryManager.js\",\n message: \"Unknown query named \\\"%s\\\" requested in refetchQueries options.include array\"\n },\n\n 34: {\n file: \"@apollo/client/core/QueryManager.js\",\n message: \"Unknown query %o requested in refetchQueries options.include array\"\n },\n\n 35: {\n file: \"@apollo/client/link/core/ApolloLink.js\",\n message: \"You are calling concat on a terminating link, which will have no effect %o\"\n },\n\n 38: {\n file: \"@apollo/client/link/http/createHttpLink.js\",\n message: \"Multipart-subscriptions do not support @defer\"\n },\n\n 42: {\n file: \"@apollo/client/link/utils/toPromise.js\",\n message: \"Promise Wrapper does not support multiple results from Observable\"\n },\n\n 51: {\n file: \"@apollo/client/react/hooks/useQuery.js\",\n message: \"Calling default no-op implementation of InternalState#forceUpdate\"\n },\n\n 52: {\n file: \"@apollo/client/react/hooks/useSubscription.js\",\n message: \"'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used.\"\n },\n\n 53: {\n file: \"@apollo/client/react/hooks/useSubscription.js\",\n message: \"'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead.\"\n },\n\n 54: {\n file: \"@apollo/client/react/hooks/useSubscription.js\",\n message: \"'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used.\"\n },\n\n 55: {\n file: \"@apollo/client/react/hooks/useSubscription.js\",\n message: \"'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead.\"\n },\n\n 57: {\n file: \"@apollo/client/react/hooks/useSuspenseQuery.js\",\n message: \"Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy.\"\n },\n\n 84: {\n file: \"@apollo/client/utilities/graphql/transform.js\",\n\n message: \"Removing an @connection directive even though it does not have a key. \" +\n \"You may want to use the key parameter to specify a store key.\"\n }\n};\n\nexport const devError = {\n 12: {\n file: \"@apollo/client/cache/inmemory/writeToStore.js\",\n message: \"Missing field '%s' while writing result %o\"\n },\n\n 21: {\n file: \"@apollo/client/core/ObservableQuery.js\",\n message: \"Unhandled GraphQL subscription error\"\n },\n\n 23: {\n file: \"@apollo/client/core/ObservableQuery.js\",\n message: \"Unhandled error\"\n },\n\n 58: {\n file: \"@apollo/client/react/hooks/useSyncExternalStore.js\",\n message: \"The result of getSnapshot should be cached to avoid an infinite loop\"\n },\n\n 83: {\n file: \"@apollo/client/utilities/graphql/transform.js\",\n message: \"Could not find operation or fragment\"\n }\n};\n","export var version = \"3.9.5\";\n//# sourceMappingURL=version.js.map","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as\n// long as at least one of globalThis, window, self, or global is defined, so\n// we are under no obligation to make it easy for static analysis tools to\n// detect syntactic usage of the Function constructor. If you think you can\n// improve your static analysis to detect this obfuscation, think again. This\n// is an arms race you cannot win, at least not in JavaScript.\nmaybe(function () {\n return maybe.constructor(\"return this\")();\n}));\n//# sourceMappingURL=global.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\nfunction wrap(fn) {\n return function (message) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof message === \"number\") {\n var arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn.apply(void 0, [message].concat(args));\n };\n}\nvar invariant = Object.assign(function invariant(condition, message) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (!condition) {\n originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));\n }\n}, {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n});\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(message) {\n var optionalParams = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n optionalParams[_i - 1] = arguments[_i];\n }\n return new InvariantError(getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams));\n}\nvar ApolloErrorMessageHandler = Symbol.for(\"ApolloErrorMessageHandler_\" + version);\nfunction stringify(arg) {\n return typeof arg == \"string\" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000));\n}\nfunction getHandledErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));\n}\nfunction getFallbackErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return \"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#\".concat(encodeURIComponent(JSON.stringify({\n version: version,\n message: message,\n args: messageArgs.map(stringify),\n })));\n}\nexport { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, };\n//# sourceMappingURL=invariantWrappers.js.map","import { global } from \"../utilities/globals/index.js\";\nimport { ApolloErrorMessageHandler } from \"../utilities/globals/invariantWrappers.js\";\nexport function loadErrorMessageHandler() {\n var errorCodes = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n errorCodes[_i] = arguments[_i];\n }\n if (!global[ApolloErrorMessageHandler]) {\n global[ApolloErrorMessageHandler] = handler;\n }\n for (var _a = 0, errorCodes_1 = errorCodes; _a < errorCodes_1.length; _a++) {\n var codes = errorCodes_1[_a];\n Object.assign(global[ApolloErrorMessageHandler], codes);\n }\n return global[ApolloErrorMessageHandler];\n function handler(message, args) {\n if (typeof message === \"number\") {\n var definition = global[ApolloErrorMessageHandler][message];\n if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message))\n return;\n message = definition.message;\n }\n return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message));\n }\n}\n//# sourceMappingURL=loadErrorMessageHandler.js.map","import { devDebug, devError, devLog, devWarn } from \"../invariantErrorCodes.js\";\nimport { loadErrorMessageHandler } from \"./loadErrorMessageHandler.js\";\nexport function loadDevMessages() {\n loadErrorMessageHandler(devDebug, devError, devLog, devWarn);\n}\n//# sourceMappingURL=loadDevMessages.js.map","import { errorCodes } from \"../invariantErrorCodes.js\";\nimport { loadErrorMessageHandler } from \"./loadErrorMessageHandler.js\";\nexport function loadErrorMessages() {\n loadErrorMessageHandler(errorCodes);\n}\n//# sourceMappingURL=loadErrorMessages.js.map"],"names":["originalInvariant","global"],"mappings":";;;;;;;AAAO,MAAM,UAAU;AAGvB;AACA,EAAE,CAAC,EAAE;AACL,IAAI,IAAI,EAAE,8CAA8C;AACxD,IAAI,SAAS,EAAE,8BAA8B;AAC7C,IAAI,OAAO,EAAE,iCAAiC;AAC9C,GAAG;AAEH,EAAE,CAAC,EAAE;AACL,IAAI,IAAI,EAAE,gDAAgD;AAC1D,IAAI,SAAS,EAAE,sBAAsB;AACrC,IAAI,OAAO,EAAE,uDAAuD;AACpE,GAAG;AAEH,EAAE,CAAC,EAAE;AACL,IAAI,IAA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ACtBO,SAAS,eAAe,GAAG;AAClC,IAAI,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACjE;;ACFO,SAAS,iBAAiB,GAAG;AACpC,IAAI,uBAAuB,CAAC,UAAU,CAAC,CAAC;AACxC;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.native.js new file mode 100644 index 0000000..5f97aed --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/dev.cjs.native.js @@ -0,0 +1,553 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../utilities/globals'); +var tsInvariant = require('ts-invariant'); + +const errorCodes = +{ + 1: { + file: "@apollo/client/cache/inmemory/entityStore.js", + condition: "typeof dataId === \"string\"", + message: "store.merge expects a string ID" + }, + 4: { + file: "@apollo/client/cache/inmemory/key-extractor.js", + condition: "extracted !== void 0", + message: "Missing field '%s' while extracting keyFields from %s" + }, + 5: { + file: "@apollo/client/cache/inmemory/policies.js", + condition: "!old || old === which", + message: "Cannot change root %s __typename more than once" + }, + 8: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Cannot automatically merge arrays" + }, + 9: { + file: "@apollo/client/cache/inmemory/readFromStore.js", + message: "No fragment named %s" + }, + 10: { + file: "@apollo/client/cache/inmemory/readFromStore.js", + condition: "!isReference(value)", + message: "Missing selection set for object of type %s returned for query field %s" + }, + 11: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Could not identify object %s" + }, + 13: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "No fragment named %s" + }, + 15: { + file: "@apollo/client/core/ApolloClient.js", + message: "To initialize Apollo Client, you must specify a 'cache' property " + + "in the options object. \n" + + "For more information, please visit: https://go.apollo.dev/c/docs" + }, + 16: { + file: "@apollo/client/core/ApolloClient.js", + condition: "options.fetchPolicy !== \"cache-and-network\"", + message: "The cache-and-network fetchPolicy does not work with client.query, because " + + "client.query can only return a single result. Please use client.watchQuery " + + "to receive multiple results from the cache and the network, or consider " + + "using a different fetchPolicy, such as cache-first or network-only." + }, + 18: { + file: "@apollo/client/core/LocalState.js", + condition: "fragment", + message: "No fragment named %s" + }, + 19: { + file: "@apollo/client/core/LocalState.js", + condition: "fragment", + message: "No fragment named %s" + }, + 22: { + file: "@apollo/client/core/ObservableQuery.js", + condition: "pollInterval", + message: "Attempted to start a polling query without a polling interval." + }, + 25: { + file: "@apollo/client/core/QueryManager.js", + message: "QueryManager stopped while query was in flight" + }, + 26: { + file: "@apollo/client/core/QueryManager.js", + condition: "mutation", + message: "mutation option is required. You must specify your GraphQL document in the mutation option." + }, + 27: { + file: "@apollo/client/core/QueryManager.js", + condition: "fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\"", + message: "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write." + }, + 28: { + file: "@apollo/client/core/QueryManager.js", + condition: "options.query", + message: "query option is required. You must specify your GraphQL document " + + "in the query option." + }, + 29: { + file: "@apollo/client/core/QueryManager.js", + condition: "options.query.kind === \"Document\"", + message: 'You must wrap the query string in a "gql" tag.' + }, + 30: { + file: "@apollo/client/core/QueryManager.js", + condition: "!options.returnPartialData", + message: "returnPartialData option only supported on watchQuery." + }, + 31: { + file: "@apollo/client/core/QueryManager.js", + condition: "!options.pollInterval", + message: "pollInterval option only supported on watchQuery." + }, + 32: { + file: "@apollo/client/core/QueryManager.js", + message: "Store reset while query was in flight (not completed in link chain)" + }, + 36: { + file: "@apollo/client/link/core/ApolloLink.js", + message: "request is not implemented" + }, + 37: { + file: "@apollo/client/link/http/checkFetcher.js", + message: "\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n " + }, + 39: { + file: "@apollo/client/link/http/serializeFetchParameter.js", + message: "Network request failed. %s is not serializable: %s" + }, + 40: { + file: "@apollo/client/link/persisted-queries/index.js", + condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")", + message: 'Missing/invalid "sha256" or "generateHash" function. Please ' + + 'configure one using the "createPersistedQueryLink(options)" options ' + + "parameter." + }, + 41: { + file: "@apollo/client/link/persisted-queries/index.js", + condition: "forward", + message: "PersistedQueryLink cannot be the last link in the chain." + }, + 43: { + file: "@apollo/client/link/utils/validateOperation.js", + message: "illegal argument: %s" + }, + 44: { + file: "@apollo/client/react/context/ApolloConsumer.js", + condition: "context && context.client", + message: 'Could not find "client" in the context of ApolloConsumer. ' + + "Wrap the root component in an ." + }, + 45: { + file: "@apollo/client/react/context/ApolloContext.js", + condition: "\"createContext\" in React", + message: "Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n" + + "The Apollo Client functionality you are trying to use is only available in React Client Components.\n" + + 'Please make sure to add "use client" at the top of your file.\n' + + "For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components" + }, + 46: { + file: "@apollo/client/react/context/ApolloProvider.js", + condition: "context.client", + message: "ApolloProvider was not passed a client instance. Make " + + 'sure you pass in your client via the "client" prop.' + }, + 47: { + file: "@apollo/client/react/hoc/hoc-utils.js", + condition: "this.withRef", + message: "To access the wrapped instance, you need to specify " + + "{ withRef: true } in the options" + }, + 48: { + file: "@apollo/client/react/hoc/withApollo.js", + condition: "operationOptions.withRef", + message: "To access the wrapped instance, you need to specify " + + "{ withRef: true } in the options" + }, + 49: { + file: "@apollo/client/react/hooks/useApolloClient.js", + condition: "!!client", + message: 'Could not find "client" in the context or passed in as an option. ' + + "Wrap the root component in an , or pass an ApolloClient " + + "instance in via options." + }, + 50: { + file: "@apollo/client/react/hooks/useLoadableQuery.js", + condition: "!calledDuringRender()", + message: "useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook." + }, + 56: { + file: "@apollo/client/react/hooks/useSuspenseQuery.js", + condition: "supportedFetchPolicies.includes(fetchPolicy)", + message: "The fetch policy `%s` is not supported with suspense." + }, + 59: { + file: "@apollo/client/react/parser/index.js", + condition: "!!document && !!document.kind", + message: "Argument of %s passed to parser was not a valid GraphQL " + + "DocumentNode. You may need to use 'graphql-tag' or another method " + + "to convert your operation into a document" + }, + 60: { + file: "@apollo/client/react/parser/index.js", + condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length", + message: "Passing only a fragment to 'graphql' is not yet supported. " + + "You must include a query, subscription or mutation as well" + }, + 61: { + file: "@apollo/client/react/parser/index.js", + condition: "queries.length + mutations.length + subscriptions.length <= 1", + message: "react-apollo only supports a query, subscription, or a mutation per HOC. " + + "%s had %s queries, %s " + + "subscriptions and %s mutations. " + + "You can use 'compose' to join multiple operation types to a component" + }, + 62: { + file: "@apollo/client/react/parser/index.js", + condition: "definitions.length === 1", + message: "react-apollo only supports one definition per HOC. %s had " + + "%s definitions. " + + "You can use 'compose' to join multiple operation types to a component" + }, + 63: { + file: "@apollo/client/react/parser/index.js", + condition: "operation.type === type", + message: "Running a %s requires a graphql " + "%s, but a %s was used instead." + }, + 64: { + file: "@apollo/client/testing/core/mocking/mockLink.js", + condition: "queryWithoutConnection", + message: "query is required" + }, + 65: { + file: "@apollo/client/testing/core/mocking/mockLink.js", + condition: "mockedResponse.maxUsageCount > 0", + message: "Mock response maxUsageCount must be greater than 0, %s given" + }, + 66: { + file: "@apollo/client/utilities/graphql/DocumentTransform.js", + condition: "Array.isArray(cacheKeys)", + message: "`getCacheKey` must return an array or undefined" + }, + 67: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "evaledValue !== void 0", + message: "Invalid variable referenced in @%s directive." + }, + 68: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "directiveArguments && directiveArguments.length === 1", + message: "Incorrect number of arguments for the @%s directive." + }, + 69: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "ifArgument.name && ifArgument.name.value === \"if\"", + message: "Invalid argument for the @%s directive." + }, + 70: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")", + message: "Argument for the @%s directive must be a variable or a boolean value." + }, + 71: { + file: "@apollo/client/utilities/graphql/fragments.js", + message: "Found a %s operation%s. " + + "No operations are allowed when using a fragment as a query. Only fragments are allowed." + }, + 72: { + file: "@apollo/client/utilities/graphql/fragments.js", + condition: "fragments.length === 1", + message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment." + }, + 73: { + file: "@apollo/client/utilities/graphql/fragments.js", + condition: "fragment", + message: "No fragment named %s" + }, + 74: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc && doc.kind === \"Document\"", + message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql" + }, + 75: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + message: "Schema type definitions not allowed in queries. Found: \"%s\"" + }, + 76: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "operations.length <= 1", + message: "Ambiguous GraphQL document: contains %s operations" + }, + 77: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "queryDef && queryDef.operation === \"query\"", + message: "Must contain a query definition." + }, + 78: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc.kind === \"Document\"", + message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql" + }, + 79: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc.definitions.length <= 1", + message: "Fragment must have exactly one definition." + }, + 80: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "fragmentDef.kind === \"FragmentDefinition\"", + message: "Must be a fragment definition." + }, + 81: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment." + }, + 82: { + file: "@apollo/client/utilities/graphql/storeUtils.js", + message: "The inline argument \"%s\" of kind \"%s\"" + + "is not supported. Use variables instead of inline arguments to " + + "overcome this limitation." + } +}; +const devDebug = { + 17: { + file: "@apollo/client/core/ApolloClient.js", + message: "In client.refetchQueries, Promise.all promise rejected with error %o" + }, + 24: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Missing cache result fields: %o" + } +}; +const devLog = {}; +const devWarn = { + 2: { + file: "@apollo/client/cache/inmemory/entityStore.js", + message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" + + "Please make sure to set the `mergeIntoStore` parameter to `true` when creating a Reference that is not part of the store yet:\n" + + "`toReference(object, true)`" + }, + 3: { + file: "@apollo/client/cache/inmemory/entityStore.js", + message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" + + "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`." + }, + 6: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Inferring subtype %s of supertype %s" + }, + 7: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Undefined 'from' passed to readField with arguments %s" + }, + 14: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Cache data may be lost when replacing the %s field of a %s object.\n\nThis could cause additional (usually avoidable) network requests to fetch data that were otherwise cached.\n\nTo address this problem (which is not a bug in Apollo Client), %sdefine a custom merge function for the %s field, so InMemoryCache can safely merge these objects:\n\n existing: %o\n incoming: %o\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n" + }, + 20: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Called refetch(%o) for query %o, which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?" + }, + 33: { + file: "@apollo/client/core/QueryManager.js", + message: "Unknown query named \"%s\" requested in refetchQueries options.include array" + }, + 34: { + file: "@apollo/client/core/QueryManager.js", + message: "Unknown query %o requested in refetchQueries options.include array" + }, + 35: { + file: "@apollo/client/link/core/ApolloLink.js", + message: "You are calling concat on a terminating link, which will have no effect %o" + }, + 38: { + file: "@apollo/client/link/http/createHttpLink.js", + message: "Multipart-subscriptions do not support @defer" + }, + 42: { + file: "@apollo/client/link/utils/toPromise.js", + message: "Promise Wrapper does not support multiple results from Observable" + }, + 51: { + file: "@apollo/client/react/hooks/useQuery.js", + message: "Calling default no-op implementation of InternalState#forceUpdate" + }, + 52: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used." + }, + 53: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead." + }, + 54: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used." + }, + 55: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead." + }, + 57: { + file: "@apollo/client/react/hooks/useSuspenseQuery.js", + message: "Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy." + }, + 84: { + file: "@apollo/client/utilities/graphql/transform.js", + message: "Removing an @connection directive even though it does not have a key. " + + "You may want to use the key parameter to specify a store key." + } +}; +const devError = { + 12: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Missing field '%s' while writing result %o" + }, + 21: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Unhandled GraphQL subscription error" + }, + 23: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Unhandled error" + }, + 58: { + file: "@apollo/client/react/hooks/useSyncExternalStore.js", + message: "The result of getSnapshot should be cached to avoid an infinite loop" + }, + 83: { + file: "@apollo/client/utilities/graphql/transform.js", + message: "Could not find operation or fragment" + } +}; + +var version = "3.9.5"; + +function maybe(thunk) { + try { + return thunk(); + } + catch (_a) { } +} + +var global$1 = (maybe(function () { return globalThis; }) || + maybe(function () { return window; }) || + maybe(function () { return self; }) || + maybe(function () { return global; }) || +maybe(function () { + return maybe.constructor("return this")(); +})); + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} + +function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} + +function wrap(fn) { + return function (message) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof message === "number") { + var arg0 = message; + message = getHandledErrorMsg(arg0); + if (!message) { + message = getFallbackErrorMsg(arg0, args); + args = []; + } + } + fn.apply(void 0, [message].concat(args)); + }; +} +Object.assign(function invariant(condition, message) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (!condition) { + tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args)); + } +}, { + debug: wrap(tsInvariant.invariant.debug), + log: wrap(tsInvariant.invariant.log), + warn: wrap(tsInvariant.invariant.warn), + error: wrap(tsInvariant.invariant.error), +}); +var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version); +function stringify(arg) { + return typeof arg == "string" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000)); +} +function getHandledErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return (global$1[ApolloErrorMessageHandler] && + global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify))); +} +function getFallbackErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({ + version: version, + message: message, + args: messageArgs.map(stringify), + }))); +} + +function loadErrorMessageHandler() { + var errorCodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + errorCodes[_i] = arguments[_i]; + } + if (!globals.global[ApolloErrorMessageHandler]) { + globals.global[ApolloErrorMessageHandler] = handler; + } + for (var _a = 0, errorCodes_1 = errorCodes; _a < errorCodes_1.length; _a++) { + var codes = errorCodes_1[_a]; + Object.assign(globals.global[ApolloErrorMessageHandler], codes); + } + return globals.global[ApolloErrorMessageHandler]; + function handler(message, args) { + if (typeof message === "number") { + var definition = globals.global[ApolloErrorMessageHandler][message]; + if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message)) + return; + message = definition.message; + } + return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message)); + } +} + +function loadDevMessages() { + loadErrorMessageHandler(devDebug, devError, devLog, devWarn); +} + +function loadErrorMessages() { + loadErrorMessageHandler(errorCodes); +} + +exports.loadDevMessages = loadDevMessages; +exports.loadErrorMessageHandler = loadErrorMessageHandler; +exports.loadErrorMessages = loadErrorMessages; +//# sourceMappingURL=dev.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/dev/index.d.ts b/graphql-subscription/node_modules/@apollo/client/dev/index.d.ts new file mode 100644 index 0000000..d79a272 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/index.d.ts @@ -0,0 +1,4 @@ +export { loadDevMessages } from "./loadDevMessages.js"; +export { loadErrorMessageHandler } from "./loadErrorMessageHandler.js"; +export { loadErrorMessages } from "./loadErrorMessages.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/index.js b/graphql-subscription/node_modules/@apollo/client/dev/index.js new file mode 100644 index 0000000..8dc0db8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/index.js @@ -0,0 +1,4 @@ +export { loadDevMessages } from "./loadDevMessages.js"; +export { loadErrorMessageHandler } from "./loadErrorMessageHandler.js"; +export { loadErrorMessages } from "./loadErrorMessages.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/index.js.map b/graphql-subscription/node_modules/@apollo/client/dev/index.js.map new file mode 100644 index 0000000..e12ed87 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dev/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { loadDevMessages } from \"./loadDevMessages.js\";\nexport { loadErrorMessageHandler } from \"./loadErrorMessageHandler.js\";\nexport { loadErrorMessages } from \"./loadErrorMessages.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.d.ts b/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.d.ts new file mode 100644 index 0000000..c3d272c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.d.ts @@ -0,0 +1,2 @@ +export declare function loadDevMessages(): void; +//# sourceMappingURL=loadDevMessages.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js b/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js new file mode 100644 index 0000000..30a8c90 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js @@ -0,0 +1,6 @@ +import { devDebug, devError, devLog, devWarn } from "../invariantErrorCodes.js"; +import { loadErrorMessageHandler } from "./loadErrorMessageHandler.js"; +export function loadDevMessages() { + loadErrorMessageHandler(devDebug, devError, devLog, devWarn); +} +//# sourceMappingURL=loadDevMessages.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js.map b/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js.map new file mode 100644 index 0000000..55aeb17 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadDevMessages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loadDevMessages.js","sourceRoot":"","sources":["../../src/dev/loadDevMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,UAAU,eAAe;IAC7B,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import { devDebug, devError, devLog, devWarn } from \"../invariantErrorCodes.js\";\nimport { loadErrorMessageHandler } from \"./loadErrorMessageHandler.js\";\n\nexport function loadDevMessages() {\n loadErrorMessageHandler(devDebug, devError, devLog, devWarn);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.d.ts b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.d.ts new file mode 100644 index 0000000..e925b82 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.d.ts @@ -0,0 +1,3 @@ +import type { ErrorCodes } from "../invariantErrorCodes.js"; +export declare function loadErrorMessageHandler(...errorCodes: ErrorCodes[]): ((message: string | number, args: unknown[]) => string | undefined) & ErrorCodes; +//# sourceMappingURL=loadErrorMessageHandler.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js new file mode 100644 index 0000000..4d62a2b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js @@ -0,0 +1,26 @@ +import { global } from "../utilities/globals/index.js"; +import { ApolloErrorMessageHandler } from "../utilities/globals/invariantWrappers.js"; +export function loadErrorMessageHandler() { + var errorCodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + errorCodes[_i] = arguments[_i]; + } + if (!global[ApolloErrorMessageHandler]) { + global[ApolloErrorMessageHandler] = handler; + } + for (var _a = 0, errorCodes_1 = errorCodes; _a < errorCodes_1.length; _a++) { + var codes = errorCodes_1[_a]; + Object.assign(global[ApolloErrorMessageHandler], codes); + } + return global[ApolloErrorMessageHandler]; + function handler(message, args) { + if (typeof message === "number") { + var definition = global[ApolloErrorMessageHandler][message]; + if (!message || !(definition === null || definition === void 0 ? void 0 : definition.message)) + return; + message = definition.message; + } + return args.reduce(function (msg, arg) { return msg.replace(/%[sdfo]/, String(arg)); }, String(message)); + } +} +//# sourceMappingURL=loadErrorMessageHandler.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js.map b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js.map new file mode 100644 index 0000000..d6c8377 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessageHandler.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loadErrorMessageHandler.js","sourceRoot":"","sources":["../../src/dev/loadErrorMessageHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAEtF,MAAM,UAAU,uBAAuB;IAAC,oBAA2B;SAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;QAA3B,+BAA2B;;IACjE,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,CAAC;QACvC,MAAM,CAAC,yBAAyB,CAAC,GAAG,OAAsC,CAAC;IAC7E,CAAC;IAED,KAAoB,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE,CAAC;QAA5B,IAAM,KAAK,mBAAA;QACd,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAEzC,SAAS,OAAO,CAAC,OAAwB,EAAE,IAAe;QACxD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,IAAM,UAAU,GAAG,MAAM,CAAC,yBAAyB,CAAE,CAAC,OAAO,CAAC,CAAC;YAC/D,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,CAAA;gBAAE,OAAO;YAC7C,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAChB,UAAC,GAAG,EAAE,GAAG,IAAK,OAAA,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAnC,CAAmC,EACjD,MAAM,CAAC,OAAO,CAAC,CAChB,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { ErrorCodes } from \"../invariantErrorCodes.js\";\nimport { global } from \"../utilities/globals/index.js\";\nimport { ApolloErrorMessageHandler } from \"../utilities/globals/invariantWrappers.js\";\n\nexport function loadErrorMessageHandler(...errorCodes: ErrorCodes[]) {\n if (!global[ApolloErrorMessageHandler]) {\n global[ApolloErrorMessageHandler] = handler as typeof handler & ErrorCodes;\n }\n\n for (const codes of errorCodes) {\n Object.assign(global[ApolloErrorMessageHandler], codes);\n }\n\n return global[ApolloErrorMessageHandler];\n\n function handler(message: string | number, args: unknown[]) {\n if (typeof message === \"number\") {\n const definition = global[ApolloErrorMessageHandler]![message];\n if (!message || !definition?.message) return;\n message = definition.message;\n }\n return args.reduce(\n (msg, arg) => msg.replace(/%[sdfo]/, String(arg)),\n String(message)\n );\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.d.ts b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.d.ts new file mode 100644 index 0000000..8f6a4f2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.d.ts @@ -0,0 +1,2 @@ +export declare function loadErrorMessages(): void; +//# sourceMappingURL=loadErrorMessages.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js new file mode 100644 index 0000000..aa73ed6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js @@ -0,0 +1,6 @@ +import { errorCodes } from "../invariantErrorCodes.js"; +import { loadErrorMessageHandler } from "./loadErrorMessageHandler.js"; +export function loadErrorMessages() { + loadErrorMessageHandler(errorCodes); +} +//# sourceMappingURL=loadErrorMessages.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js.map b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js.map new file mode 100644 index 0000000..43778ec --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/loadErrorMessages.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loadErrorMessages.js","sourceRoot":"","sources":["../../src/dev/loadErrorMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,UAAU,iBAAiB;IAC/B,uBAAuB,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { errorCodes } from \"../invariantErrorCodes.js\";\nimport { loadErrorMessageHandler } from \"./loadErrorMessageHandler.js\";\n\nexport function loadErrorMessages() {\n loadErrorMessageHandler(errorCodes);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/dev/package.json b/graphql-subscription/node_modules/@apollo/client/dev/package.json new file mode 100644 index 0000000..864281d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/dev/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/dev", + "type": "module", + "main": "dev.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs b/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs new file mode 100644 index 0000000..324a826 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +require('../utilities/globals'); +var utilities = require('../utilities'); + +var PROTOCOL_ERRORS_SYMBOL = Symbol(); +function graphQLResultHasProtocolErrors(result) { + if (result.extensions) { + return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]); + } + return false; +} +function isApolloError(err) { + return err.hasOwnProperty("graphQLErrors"); +} +var generateErrorMessage = function (err) { + var errors = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true); + if (err.networkError) + errors.push(err.networkError); + return (errors + .map(function (err) { + return (utilities.isNonNullObject(err) && err.message) || "Error message not found."; + }) + .join("\n")); +}; +var ApolloError = (function (_super) { + tslib.__extends(ApolloError, _super); + function ApolloError(_a) { + var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; + var _this = _super.call(this, errorMessage) || this; + _this.name = "ApolloError"; + _this.graphQLErrors = graphQLErrors || []; + _this.protocolErrors = protocolErrors || []; + _this.clientErrors = clientErrors || []; + _this.networkError = networkError || null; + _this.message = errorMessage || generateErrorMessage(_this); + _this.extraInfo = extraInfo; + _this.__proto__ = ApolloError.prototype; + return _this; + } + return ApolloError; +}(Error)); + +exports.ApolloError = ApolloError; +exports.PROTOCOL_ERRORS_SYMBOL = PROTOCOL_ERRORS_SYMBOL; +exports.graphQLResultHasProtocolErrors = graphQLResultHasProtocolErrors; +exports.isApolloError = isApolloError; +//# sourceMappingURL=errors.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.map b/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.map new file mode 100644 index 0000000..04f929e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.cjs","sources":["index.js"],"sourcesContent":["import { __extends, __spreadArray } from \"tslib\";\nimport \"../utilities/globals/index.js\";\nimport { isNonNullObject } from \"../utilities/index.js\";\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport var PROTOCOL_ERRORS_SYMBOL = Symbol();\nexport function graphQLResultHasProtocolErrors(result) {\n if (result.extensions) {\n return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]);\n }\n return false;\n}\nexport function isApolloError(err) {\n return err.hasOwnProperty(\"graphQLErrors\");\n}\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nvar generateErrorMessage = function (err) {\n var errors = __spreadArray(__spreadArray(__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true);\n if (err.networkError)\n errors.push(err.networkError);\n return (errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(function (err) {\n return (isNonNullObject(err) && err.message) || \"Error message not found.\";\n })\n .join(\"\\n\"));\n};\nvar ApolloError = /** @class */ (function (_super) {\n __extends(ApolloError, _super);\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n function ApolloError(_a) {\n var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo;\n var _this = _super.call(this, errorMessage) || this;\n _this.name = \"ApolloError\";\n _this.graphQLErrors = graphQLErrors || [];\n _this.protocolErrors = protocolErrors || [];\n _this.clientErrors = clientErrors || [];\n _this.networkError = networkError || null;\n _this.message = errorMessage || generateErrorMessage(_this);\n _this.extraInfo = extraInfo;\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n _this.__proto__ = ApolloError.prototype;\n return _this;\n }\n return ApolloError;\n}(Error));\nexport { ApolloError };\n//# sourceMappingURL=index.js.map"],"names":["__spreadArray","isNonNullObject","__extends"],"mappings":";;;;;;;;AAMU,IAAC,sBAAsB,GAAG,MAAM,GAAG;AACtC,SAAS,8BAA8B,CAAC,MAAM,EAAE;AACvD,IAAI,IAAI,MAAM,CAAC,UAAU,EAAE;AAC3B,QAAQ,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC;AACxE,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC;AACM,SAAS,aAAa,CAAC,GAAG,EAAE;AACnC,IAAI,OAAO,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAC/C,CAAC;AAKD,IAAI,oBAAoB,GAAG,UAAU,GAAG,EAAE;AAC1C,IAAI,IAAI,MAAM,GAAGA,mBAAa,CAACA,mBAAa,CAACA,mBAAa,CAAC,EAAE,EAAE,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,cAAc,E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,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;AAGpC,QAAQ,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;AAChD,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC,KAAK,CAAC;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.native.js new file mode 100644 index 0000000..324a826 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/errors/errors.cjs.native.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +require('../utilities/globals'); +var utilities = require('../utilities'); + +var PROTOCOL_ERRORS_SYMBOL = Symbol(); +function graphQLResultHasProtocolErrors(result) { + if (result.extensions) { + return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]); + } + return false; +} +function isApolloError(err) { + return err.hasOwnProperty("graphQLErrors"); +} +var generateErrorMessage = function (err) { + var errors = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true); + if (err.networkError) + errors.push(err.networkError); + return (errors + .map(function (err) { + return (utilities.isNonNullObject(err) && err.message) || "Error message not found."; + }) + .join("\n")); +}; +var ApolloError = (function (_super) { + tslib.__extends(ApolloError, _super); + function ApolloError(_a) { + var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; + var _this = _super.call(this, errorMessage) || this; + _this.name = "ApolloError"; + _this.graphQLErrors = graphQLErrors || []; + _this.protocolErrors = protocolErrors || []; + _this.clientErrors = clientErrors || []; + _this.networkError = networkError || null; + _this.message = errorMessage || generateErrorMessage(_this); + _this.extraInfo = extraInfo; + _this.__proto__ = ApolloError.prototype; + return _this; + } + return ApolloError; +}(Error)); + +exports.ApolloError = ApolloError; +exports.PROTOCOL_ERRORS_SYMBOL = PROTOCOL_ERRORS_SYMBOL; +exports.graphQLResultHasProtocolErrors = graphQLResultHasProtocolErrors; +exports.isApolloError = isApolloError; +//# sourceMappingURL=errors.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/errors/index.d.ts b/graphql-subscription/node_modules/@apollo/client/errors/index.d.ts new file mode 100644 index 0000000..79825cb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/errors/index.d.ts @@ -0,0 +1,39 @@ +import "../utilities/globals/index.js"; +import type { GraphQLError, GraphQLErrorExtensions } from "graphql"; +import type { ServerParseError } from "../link/http/index.js"; +import type { ServerError } from "../link/utils/index.js"; +import type { FetchResult } from "../link/core/index.js"; +export declare const PROTOCOL_ERRORS_SYMBOL: unique symbol; +type FetchResultWithSymbolExtensions = FetchResult & { + extensions: Record; +}; +export interface ApolloErrorOptions { + graphQLErrors?: ReadonlyArray; + protocolErrors?: ReadonlyArray<{ + message: string; + extensions?: GraphQLErrorExtensions[]; + }>; + clientErrors?: ReadonlyArray; + networkError?: Error | ServerParseError | ServerError | null; + errorMessage?: string; + extraInfo?: any; +} +export declare function graphQLResultHasProtocolErrors(result: FetchResult): result is FetchResultWithSymbolExtensions; +export declare function isApolloError(err: Error): err is ApolloError; +export type GraphQLErrors = ReadonlyArray; +export type NetworkError = Error | ServerParseError | ServerError | null; +export declare class ApolloError extends Error { + name: string; + message: string; + graphQLErrors: GraphQLErrors; + protocolErrors: ReadonlyArray<{ + message: string; + extensions?: GraphQLErrorExtensions[]; + }>; + clientErrors: ReadonlyArray; + networkError: Error | ServerParseError | ServerError | null; + extraInfo: any; + constructor({ graphQLErrors, protocolErrors, clientErrors, networkError, errorMessage, extraInfo, }: ApolloErrorOptions); +} +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/errors/index.js b/graphql-subscription/node_modules/@apollo/client/errors/index.js new file mode 100644 index 0000000..127bb58 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/errors/index.js @@ -0,0 +1,55 @@ +import { __extends, __spreadArray } from "tslib"; +import "../utilities/globals/index.js"; +import { isNonNullObject } from "../utilities/index.js"; +// This Symbol allows us to pass transport-specific errors from the link chain +// into QueryManager/client internals without risking a naming collision within +// extensions (which implementers can use as they see fit). +export var PROTOCOL_ERRORS_SYMBOL = Symbol(); +export function graphQLResultHasProtocolErrors(result) { + if (result.extensions) { + return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]); + } + return false; +} +export function isApolloError(err) { + return err.hasOwnProperty("graphQLErrors"); +} +// Sets the error message on this error according to the +// the GraphQL and network errors that are present. +// If the error message has already been set through the +// constructor or otherwise, this function is a nop. +var generateErrorMessage = function (err) { + var errors = __spreadArray(__spreadArray(__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true); + if (err.networkError) + errors.push(err.networkError); + return (errors + // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors + .map(function (err) { + return (isNonNullObject(err) && err.message) || "Error message not found."; + }) + .join("\n")); +}; +var ApolloError = /** @class */ (function (_super) { + __extends(ApolloError, _super); + // Constructs an instance of ApolloError given a GraphQLError + // or a network error. Note that one of these has to be a valid + // value or the constructed error will be meaningless. + function ApolloError(_a) { + var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; + var _this = _super.call(this, errorMessage) || this; + _this.name = "ApolloError"; + _this.graphQLErrors = graphQLErrors || []; + _this.protocolErrors = protocolErrors || []; + _this.clientErrors = clientErrors || []; + _this.networkError = networkError || null; + _this.message = errorMessage || generateErrorMessage(_this); + _this.extraInfo = extraInfo; + // We're not using `Object.setPrototypeOf` here as it isn't fully + // supported on Android (see issue #3236). + _this.__proto__ = ApolloError.prototype; + return _this; + } + return ApolloError; +}(Error)); +export { ApolloError }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/errors/index.js.map b/graphql-subscription/node_modules/@apollo/client/errors/index.js.map new file mode 100644 index 0000000..611150a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/errors/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAC;AAIvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,8EAA8E;AAC9E,+EAA+E;AAC/E,2DAA2D;AAC3D,MAAM,CAAC,IAAM,sBAAsB,GAAkB,MAAM,EAAE,CAAC;AAkB9D,MAAM,UAAU,8BAA8B,CAC5C,MAAsB;IAEtB,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,OAAO,CACjB,MAA6C,CAAC,UAAU,CACvD,sBAAsB,CACvB,CACF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAU;IACtC,OAAO,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAC7C,CAAC;AAED,wDAAwD;AACxD,mDAAmD;AACnD,wDAAwD;AACxD,oDAAoD;AACpD,IAAM,oBAAoB,GAAG,UAAC,GAAgB;IAC5C,IAAM,MAAM,iDACP,GAAG,CAAC,aAAa,SACjB,GAAG,CAAC,YAAY,SAChB,GAAG,CAAC,cAAc,OACtB,CAAC;IACF,IAAI,GAAG,CAAC,YAAY;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACpD,OAAO,CACL,MAAM;QACJ,mFAAmF;SAClF,GAAG,CACF,UAAC,GAAG;QACF,OAAA,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,0BAA0B;IAAnE,CAAmE,CACtE;SACA,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;AACJ,CAAC,CAAC;AAMF;IAAiC,+BAAK;IAgBpC,6DAA6D;IAC7D,+DAA+D;IAC/D,sDAAsD;IACtD,qBAAY,EAOS;YANnB,aAAa,mBAAA,EACb,cAAc,oBAAA,EACd,YAAY,kBAAA,EACZ,YAAY,kBAAA,EACZ,YAAY,kBAAA,EACZ,SAAS,eAAA;QAET,YAAA,MAAK,YAAC,YAAY,CAAC,SAAC;QACpB,KAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,KAAI,CAAC,aAAa,GAAG,aAAa,IAAI,EAAE,CAAC;QACzC,KAAI,CAAC,cAAc,GAAG,cAAc,IAAI,EAAE,CAAC;QAC3C,KAAI,CAAC,YAAY,GAAG,YAAY,IAAI,EAAE,CAAC;QACvC,KAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC;QACzC,KAAI,CAAC,OAAO,GAAG,YAAY,IAAI,oBAAoB,CAAC,KAAI,CAAC,CAAC;QAC1D,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,iEAAiE;QACjE,0CAA0C;QACzC,KAAY,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;;IAClD,CAAC;IACH,kBAAC;AAAD,CAAC,AAxCD,CAAiC,KAAK,GAwCrC","sourcesContent":["import \"../utilities/globals/index.js\";\n\nimport type { GraphQLError, GraphQLErrorExtensions } from \"graphql\";\n\nimport { isNonNullObject } from \"../utilities/index.js\";\nimport type { ServerParseError } from \"../link/http/index.js\";\nimport type { ServerError } from \"../link/utils/index.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\n\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport const PROTOCOL_ERRORS_SYMBOL: unique symbol = Symbol();\n\ntype FetchResultWithSymbolExtensions = FetchResult & {\n extensions: Record;\n};\n\nexport interface ApolloErrorOptions {\n graphQLErrors?: ReadonlyArray;\n protocolErrors?: ReadonlyArray<{\n message: string;\n extensions?: GraphQLErrorExtensions[];\n }>;\n clientErrors?: ReadonlyArray;\n networkError?: Error | ServerParseError | ServerError | null;\n errorMessage?: string;\n extraInfo?: any;\n}\n\nexport function graphQLResultHasProtocolErrors(\n result: FetchResult\n): result is FetchResultWithSymbolExtensions {\n if (result.extensions) {\n return Array.isArray(\n (result as FetchResultWithSymbolExtensions).extensions[\n PROTOCOL_ERRORS_SYMBOL\n ]\n );\n }\n return false;\n}\n\nexport function isApolloError(err: Error): err is ApolloError {\n return err.hasOwnProperty(\"graphQLErrors\");\n}\n\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nconst generateErrorMessage = (err: ApolloError) => {\n const errors = [\n ...err.graphQLErrors,\n ...err.clientErrors,\n ...err.protocolErrors,\n ];\n if (err.networkError) errors.push(err.networkError);\n return (\n errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(\n (err) =>\n (isNonNullObject(err) && err.message) || \"Error message not found.\"\n )\n .join(\"\\n\")\n );\n};\n\nexport type GraphQLErrors = ReadonlyArray;\n\nexport type NetworkError = Error | ServerParseError | ServerError | null;\n\nexport class ApolloError extends Error {\n public name: string;\n public message: string;\n public graphQLErrors: GraphQLErrors;\n public protocolErrors: ReadonlyArray<{\n message: string;\n extensions?: GraphQLErrorExtensions[];\n }>;\n public clientErrors: ReadonlyArray;\n public networkError: Error | ServerParseError | ServerError | null;\n\n // An object that can be used to provide some additional information\n // about an error, e.g. specifying the type of error this is. Used\n // internally within Apollo Client.\n public extraInfo: any;\n\n // Constructs an instance of ApolloError given a GraphQLError\n // or a network error. Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n constructor({\n graphQLErrors,\n protocolErrors,\n clientErrors,\n networkError,\n errorMessage,\n extraInfo,\n }: ApolloErrorOptions) {\n super(errorMessage);\n this.name = \"ApolloError\";\n this.graphQLErrors = graphQLErrors || [];\n this.protocolErrors = protocolErrors || [];\n this.clientErrors = clientErrors || [];\n this.networkError = networkError || null;\n this.message = errorMessage || generateErrorMessage(this);\n this.extraInfo = extraInfo;\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n (this as any).__proto__ = ApolloError.prototype;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/errors/package.json b/graphql-subscription/node_modules/@apollo/client/errors/package.json new file mode 100644 index 0000000..9068a1b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/errors/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/errors", + "type": "module", + "main": "errors.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/index.d.ts b/graphql-subscription/node_modules/@apollo/client/index.d.ts new file mode 100644 index 0000000..575388c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/index.d.ts @@ -0,0 +1,3 @@ +export * from "./core/index.js"; +export * from "./react/index.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/index.js b/graphql-subscription/node_modules/@apollo/client/index.js new file mode 100644 index 0000000..ade8e48 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/index.js @@ -0,0 +1,3 @@ +export * from "./core/index.js"; +export * from "./react/index.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/index.js.map b/graphql-subscription/node_modules/@apollo/client/index.js.map new file mode 100644 index 0000000..4ef8c9a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from \"./core/index.js\";\nexport * from \"./react/index.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.d.ts b/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.d.ts new file mode 100644 index 0000000..03419e8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.d.ts @@ -0,0 +1,13 @@ +export interface ErrorCodes { + [key: number]: { + file: string; + condition?: string; + message?: string; + }; +} +export declare const errorCodes: ErrorCodes; +export declare const devDebug: ErrorCodes; +export declare const devLog: ErrorCodes; +export declare const devWarn: ErrorCodes; +export declare const devError: ErrorCodes; +//# sourceMappingURL=invariantErrorCodes.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js b/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js new file mode 100644 index 0000000..e23ebde --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js @@ -0,0 +1,528 @@ +export const errorCodes = // This file is used by the error message display website and the +// @apollo/client/includeErrors entry point. +// This file is not meant to be imported manually. +{ + 1: { + file: "@apollo/client/cache/inmemory/entityStore.js", + condition: "typeof dataId === \"string\"", + message: "store.merge expects a string ID" + }, + + 4: { + file: "@apollo/client/cache/inmemory/key-extractor.js", + condition: "extracted !== void 0", + message: "Missing field '%s' while extracting keyFields from %s" + }, + + 5: { + file: "@apollo/client/cache/inmemory/policies.js", + condition: "!old || old === which", + message: "Cannot change root %s __typename more than once" + }, + + 8: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Cannot automatically merge arrays" + }, + + 9: { + file: "@apollo/client/cache/inmemory/readFromStore.js", + message: "No fragment named %s" + }, + + 10: { + file: "@apollo/client/cache/inmemory/readFromStore.js", + condition: "!isReference(value)", + message: "Missing selection set for object of type %s returned for query field %s" + }, + + 11: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Could not identify object %s" + }, + + 13: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "No fragment named %s" + }, + + 15: { + file: "@apollo/client/core/ApolloClient.js", + + message: "To initialize Apollo Client, you must specify a 'cache' property " + + "in the options object. \n" + + "For more information, please visit: https://go.apollo.dev/c/docs" + }, + + 16: { + file: "@apollo/client/core/ApolloClient.js", + condition: "options.fetchPolicy !== \"cache-and-network\"", + + message: "The cache-and-network fetchPolicy does not work with client.query, because " + + "client.query can only return a single result. Please use client.watchQuery " + + "to receive multiple results from the cache and the network, or consider " + + "using a different fetchPolicy, such as cache-first or network-only." + }, + + 18: { + file: "@apollo/client/core/LocalState.js", + condition: "fragment", + message: "No fragment named %s" + }, + + 19: { + file: "@apollo/client/core/LocalState.js", + condition: "fragment", + message: "No fragment named %s" + }, + + 22: { + file: "@apollo/client/core/ObservableQuery.js", + condition: "pollInterval", + message: "Attempted to start a polling query without a polling interval." + }, + + 25: { + file: "@apollo/client/core/QueryManager.js", + message: "QueryManager stopped while query was in flight" + }, + + 26: { + file: "@apollo/client/core/QueryManager.js", + condition: "mutation", + message: "mutation option is required. You must specify your GraphQL document in the mutation option." + }, + + 27: { + file: "@apollo/client/core/QueryManager.js", + condition: "fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\"", + message: "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write." + }, + + 28: { + file: "@apollo/client/core/QueryManager.js", + condition: "options.query", + + message: "query option is required. You must specify your GraphQL document " + + "in the query option." + }, + + 29: { + file: "@apollo/client/core/QueryManager.js", + condition: "options.query.kind === \"Document\"", + message: 'You must wrap the query string in a "gql" tag.' + }, + + 30: { + file: "@apollo/client/core/QueryManager.js", + condition: "!options.returnPartialData", + message: "returnPartialData option only supported on watchQuery." + }, + + 31: { + file: "@apollo/client/core/QueryManager.js", + condition: "!options.pollInterval", + message: "pollInterval option only supported on watchQuery." + }, + + 32: { + file: "@apollo/client/core/QueryManager.js", + message: "Store reset while query was in flight (not completed in link chain)" + }, + + 36: { + file: "@apollo/client/link/core/ApolloLink.js", + message: "request is not implemented" + }, + + 37: { + file: "@apollo/client/link/http/checkFetcher.js", + message: "\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n " + }, + + 39: { + file: "@apollo/client/link/http/serializeFetchParameter.js", + message: "Network request failed. %s is not serializable: %s" + }, + + 40: { + file: "@apollo/client/link/persisted-queries/index.js", + condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")", + + message: 'Missing/invalid "sha256" or "generateHash" function. Please ' + + 'configure one using the "createPersistedQueryLink(options)" options ' + + "parameter." + }, + + 41: { + file: "@apollo/client/link/persisted-queries/index.js", + condition: "forward", + message: "PersistedQueryLink cannot be the last link in the chain." + }, + + 43: { + file: "@apollo/client/link/utils/validateOperation.js", + message: "illegal argument: %s" + }, + + 44: { + file: "@apollo/client/react/context/ApolloConsumer.js", + condition: "context && context.client", + + message: 'Could not find "client" in the context of ApolloConsumer. ' + + "Wrap the root component in an ." + }, + + 45: { + file: "@apollo/client/react/context/ApolloContext.js", + condition: "\"createContext\" in React", + + message: "Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n" + + "The Apollo Client functionality you are trying to use is only available in React Client Components.\n" + + 'Please make sure to add "use client" at the top of your file.\n' + + // TODO: change to React documentation once React documentation contains information about Client Components + "For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components" + }, + + 46: { + file: "@apollo/client/react/context/ApolloProvider.js", + condition: "context.client", + + message: "ApolloProvider was not passed a client instance. Make " + + 'sure you pass in your client via the "client" prop.' + }, + + 47: { + file: "@apollo/client/react/hoc/hoc-utils.js", + condition: "this.withRef", + + message: "To access the wrapped instance, you need to specify " + + "{ withRef: true } in the options" + }, + + 48: { + file: "@apollo/client/react/hoc/withApollo.js", + condition: "operationOptions.withRef", + + message: "To access the wrapped instance, you need to specify " + + "{ withRef: true } in the options" + }, + + 49: { + file: "@apollo/client/react/hooks/useApolloClient.js", + condition: "!!client", + + message: 'Could not find "client" in the context or passed in as an option. ' + + "Wrap the root component in an , or pass an ApolloClient " + + "instance in via options." + }, + + 50: { + file: "@apollo/client/react/hooks/useLoadableQuery.js", + condition: "!calledDuringRender()", + message: "useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook." + }, + + 56: { + file: "@apollo/client/react/hooks/useSuspenseQuery.js", + condition: "supportedFetchPolicies.includes(fetchPolicy)", + message: "The fetch policy `%s` is not supported with suspense." + }, + + 59: { + file: "@apollo/client/react/parser/index.js", + condition: "!!document && !!document.kind", + + message: "Argument of %s passed to parser was not a valid GraphQL " + + "DocumentNode. You may need to use 'graphql-tag' or another method " + + "to convert your operation into a document" + }, + + 60: { + file: "@apollo/client/react/parser/index.js", + condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length", + + message: "Passing only a fragment to 'graphql' is not yet supported. " + + "You must include a query, subscription or mutation as well" + }, + + 61: { + file: "@apollo/client/react/parser/index.js", + condition: "queries.length + mutations.length + subscriptions.length <= 1", + + message: "react-apollo only supports a query, subscription, or a mutation per HOC. " + + "%s had %s queries, %s " + + "subscriptions and %s mutations. " + + "You can use 'compose' to join multiple operation types to a component" + }, + + 62: { + file: "@apollo/client/react/parser/index.js", + condition: "definitions.length === 1", + + message: "react-apollo only supports one definition per HOC. %s had " + + "%s definitions. " + + "You can use 'compose' to join multiple operation types to a component" + }, + + 63: { + file: "@apollo/client/react/parser/index.js", + condition: "operation.type === type", + message: "Running a %s requires a graphql " + "%s, but a %s was used instead." + }, + + 64: { + file: "@apollo/client/testing/core/mocking/mockLink.js", + condition: "queryWithoutConnection", + message: "query is required" + }, + + 65: { + file: "@apollo/client/testing/core/mocking/mockLink.js", + condition: "mockedResponse.maxUsageCount > 0", + message: "Mock response maxUsageCount must be greater than 0, %s given" + }, + + 66: { + file: "@apollo/client/utilities/graphql/DocumentTransform.js", + condition: "Array.isArray(cacheKeys)", + message: "`getCacheKey` must return an array or undefined" + }, + + 67: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "evaledValue !== void 0", + message: "Invalid variable referenced in @%s directive." + }, + + 68: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "directiveArguments && directiveArguments.length === 1", + message: "Incorrect number of arguments for the @%s directive." + }, + + 69: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "ifArgument.name && ifArgument.name.value === \"if\"", + message: "Invalid argument for the @%s directive." + }, + + 70: { + file: "@apollo/client/utilities/graphql/directives.js", + condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")", + message: "Argument for the @%s directive must be a variable or a boolean value." + }, + + 71: { + file: "@apollo/client/utilities/graphql/fragments.js", + + message: "Found a %s operation%s. " + + "No operations are allowed when using a fragment as a query. Only fragments are allowed." + }, + + 72: { + file: "@apollo/client/utilities/graphql/fragments.js", + condition: "fragments.length === 1", + message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment." + }, + + 73: { + file: "@apollo/client/utilities/graphql/fragments.js", + condition: "fragment", + message: "No fragment named %s" + }, + + 74: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc && doc.kind === \"Document\"", + message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql" + }, + + 75: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + message: "Schema type definitions not allowed in queries. Found: \"%s\"" + }, + + 76: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "operations.length <= 1", + message: "Ambiguous GraphQL document: contains %s operations" + }, + + 77: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "queryDef && queryDef.operation === \"query\"", + message: "Must contain a query definition." + }, + + 78: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc.kind === \"Document\"", + message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql" + }, + + 79: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "doc.definitions.length <= 1", + message: "Fragment must have exactly one definition." + }, + + 80: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + condition: "fragmentDef.kind === \"FragmentDefinition\"", + message: "Must be a fragment definition." + }, + + 81: { + file: "@apollo/client/utilities/graphql/getFromAST.js", + message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment." + }, + + 82: { + file: "@apollo/client/utilities/graphql/storeUtils.js", + + message: "The inline argument \"%s\" of kind \"%s\"" + + "is not supported. Use variables instead of inline arguments to " + + "overcome this limitation." + } +}; + +export const devDebug = { + 17: { + file: "@apollo/client/core/ApolloClient.js", + message: "In client.refetchQueries, Promise.all promise rejected with error %o" + }, + + 24: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Missing cache result fields: %o" + } +}; + +export const devLog = {}; + +export const devWarn = { + 2: { + file: "@apollo/client/cache/inmemory/entityStore.js", + + message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" + + "Please make sure to set the `mergeIntoStore` parameter to `true` when creating a Reference that is not part of the store yet:\n" + + "`toReference(object, true)`" + }, + + 3: { + file: "@apollo/client/cache/inmemory/entityStore.js", + + message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" + + "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`." + }, + + 6: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Inferring subtype %s of supertype %s" + }, + + 7: { + file: "@apollo/client/cache/inmemory/policies.js", + message: "Undefined 'from' passed to readField with arguments %s" + }, + + 14: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Cache data may be lost when replacing the %s field of a %s object.\n\nThis could cause additional (usually avoidable) network requests to fetch data that were otherwise cached.\n\nTo address this problem (which is not a bug in Apollo Client), %sdefine a custom merge function for the %s field, so InMemoryCache can safely merge these objects:\n\n existing: %o\n incoming: %o\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n" + }, + + 20: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Called refetch(%o) for query %o, which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?" + }, + + 33: { + file: "@apollo/client/core/QueryManager.js", + message: "Unknown query named \"%s\" requested in refetchQueries options.include array" + }, + + 34: { + file: "@apollo/client/core/QueryManager.js", + message: "Unknown query %o requested in refetchQueries options.include array" + }, + + 35: { + file: "@apollo/client/link/core/ApolloLink.js", + message: "You are calling concat on a terminating link, which will have no effect %o" + }, + + 38: { + file: "@apollo/client/link/http/createHttpLink.js", + message: "Multipart-subscriptions do not support @defer" + }, + + 42: { + file: "@apollo/client/link/utils/toPromise.js", + message: "Promise Wrapper does not support multiple results from Observable" + }, + + 51: { + file: "@apollo/client/react/hooks/useQuery.js", + message: "Calling default no-op implementation of InternalState#forceUpdate" + }, + + 52: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used." + }, + + 53: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead." + }, + + 54: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used." + }, + + 55: { + file: "@apollo/client/react/hooks/useSubscription.js", + message: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead." + }, + + 57: { + file: "@apollo/client/react/hooks/useSuspenseQuery.js", + message: "Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy." + }, + + 84: { + file: "@apollo/client/utilities/graphql/transform.js", + + message: "Removing an @connection directive even though it does not have a key. " + + "You may want to use the key parameter to specify a store key." + } +}; + +export const devError = { + 12: { + file: "@apollo/client/cache/inmemory/writeToStore.js", + message: "Missing field '%s' while writing result %o" + }, + + 21: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Unhandled GraphQL subscription error" + }, + + 23: { + file: "@apollo/client/core/ObservableQuery.js", + message: "Unhandled error" + }, + + 58: { + file: "@apollo/client/react/hooks/useSyncExternalStore.js", + message: "The result of getSnapshot should be cached to avoid an infinite loop" + }, + + 83: { + file: "@apollo/client/utilities/graphql/transform.js", + message: "Could not find operation or fragment" + } +}; diff --git a/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js.map b/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js.map new file mode 100644 index 0000000..e068cb4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/invariantErrorCodes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"invariantErrorCodes.js","sourceRoot":"","sources":["../src/invariantErrorCodes.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,IAAM,UAAU,GAAe,EAAE,CAAC;AACzC,MAAM,CAAC,IAAM,QAAQ,GAAe,EAAE,CAAC;AACvC,MAAM,CAAC,IAAM,MAAM,GAAe,EAAE,CAAC;AACrC,MAAM,CAAC,IAAM,OAAO,GAAe,EAAE,CAAC;AACtC,MAAM,CAAC,IAAM,QAAQ,GAAe,EAAE,CAAC","sourcesContent":["export interface ErrorCodes {\n [key: number]: { file: string; condition?: string; message?: string };\n}\n\nexport const errorCodes: ErrorCodes = {};\nexport const devDebug: ErrorCodes = {};\nexport const devLog: ErrorCodes = {};\nexport const devWarn: ErrorCodes = {};\nexport const devError: ErrorCodes = {};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs new file mode 100644 index 0000000..f242024 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs @@ -0,0 +1,160 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); +var utils = require('../utils'); +var http = require('../http'); +var batch = require('../batch'); +var graphql = require('graphql'); + +function filterOperationVariables(variables, query) { + var result = tslib.__assign({}, variables); + var unusedNames = new Set(Object.keys(variables)); + graphql.visit(query, { + Variable: function (node, _key, parent) { + if (parent && + parent.kind !== "VariableDefinition") { + unusedNames.delete(node.name.value); + } + }, + }); + unusedNames.forEach(function (name) { + delete result[name]; + }); + return result; +} + +var BatchHttpLink = (function (_super) { + tslib.__extends(BatchHttpLink, _super); + function BatchHttpLink(fetchParams) { + var _this = _super.call(this) || this; + var _a = fetchParams || {}, _b = _a.uri, uri = _b === void 0 ? "/graphql" : _b, + fetcher = _a.fetch, _c = _a.print, print = _c === void 0 ? http.defaultPrinter : _c, includeExtensions = _a.includeExtensions, preserveHeaderCase = _a.preserveHeaderCase, batchInterval = _a.batchInterval, batchDebounce = _a.batchDebounce, batchMax = _a.batchMax, batchKey = _a.batchKey, _d = _a.includeUnusedVariables, includeUnusedVariables = _d === void 0 ? false : _d, requestOptions = tslib.__rest(_a, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "batchInterval", "batchDebounce", "batchMax", "batchKey", "includeUnusedVariables"]); + http.checkFetcher(fetcher); + if (!fetcher) { + fetcher = fetch; + } + var linkConfig = { + http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + _this.batchDebounce = batchDebounce; + _this.batchInterval = batchInterval || 10; + _this.batchMax = batchMax || 10; + var batchHandler = function (operations) { + var chosenURI = http.selectURI(operations[0], uri); + var context = operations[0].getContext(); + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders["apollographql-client-name"] = name_1; + } + if (version) { + clientAwarenessHeaders["apollographql-client-version"] = version; + } + } + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers), + }; + var queries = operations.map(function (_a) { + var query = _a.query; + if (utilities.hasDirectives(["client"], query)) { + return utilities.removeClientSetsFromDocument(query); + } + return query; + }); + if (queries.some(function (query) { return !query; })) { + return utils.fromError(new Error("BatchHttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or enable the `transformOptions.removeClientFields` option.")); + } + var optsAndBody = operations.map(function (operation, index) { + var result = http.selectHttpOptionsAndBodyInternal(tslib.__assign(tslib.__assign({}, operation), { query: queries[index] }), print, http.fallbackHttpConfig, linkConfig, contextConfig); + if (result.body.variables && !includeUnusedVariables) { + result.body.variables = filterOperationVariables(result.body.variables, operation.query); + } + return result; + }); + var loadedBody = optsAndBody.map(function (_a) { + var body = _a.body; + return body; + }); + var options = optsAndBody[0].options; + if (options.method === "GET") { + return utils.fromError(new Error("apollo-link-batch-http does not support GET requests")); + } + try { + options.body = http.serializeFetchParameter(loadedBody, "Payload"); + } + catch (parseError) { + return utils.fromError(parseError); + } + var controller; + if (!options.signal && typeof AbortController !== "undefined") { + controller = new AbortController(); + options.signal = controller.signal; + } + return new utilities.Observable(function (observer) { + fetcher(chosenURI, options) + .then(function (response) { + operations.forEach(function (operation) { + return operation.setContext({ response: response }); + }); + return response; + }) + .then(http.parseAndCheckHttpResponse(operations)) + .then(function (result) { + controller = undefined; + observer.next(result); + observer.complete(); + return result; + }) + .catch(function (err) { + controller = undefined; + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); + }); + return function () { + if (controller) + controller.abort(); + }; + }); + }; + batchKey = + batchKey || + (function (operation) { + var context = operation.getContext(); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: context.headers, + }; + return http.selectURI(operation, uri) + JSON.stringify(contextConfig); + }); + _this.batcher = new batch.BatchLink({ + batchDebounce: _this.batchDebounce, + batchInterval: _this.batchInterval, + batchMax: _this.batchMax, + batchKey: batchKey, + batchHandler: batchHandler, + }); + return _this; + } + BatchHttpLink.prototype.request = function (operation) { + return this.batcher.request(operation); + }; + return BatchHttpLink; +}(core.ApolloLink)); + +exports.BatchHttpLink = BatchHttpLink; +//# sourceMappingURL=batch-http.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs.map new file mode 100644 index 0000000..1906843 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"batch-http.cjs","sources":["../utils/filterOperationVariables.js","batchHttpLink.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { visit } from \"graphql\";\nexport function filterOperationVariables(variables, query) {\n var result = __assign({}, variables);\n var unusedNames = new Set(Object.keys(variables));\n visit(query, {\n Variable: function (node, _key, parent) {\n // A variable type definition at the top level of a query is not\n // enough to silence server-side errors about the variable being\n // unused, so variable definitions do not count as usage.\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n if (parent &&\n parent.kind !== \"VariableDefinition\") {\n unusedNames.delete(node.name.value);\n }\n },\n });\n unusedNames.forEach(function (name) {\n delete result[name];\n });\n return result;\n}\n//# sourceMappingURL=filterOperationVariables.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable, hasDirectives, removeClientSetsFromDocument, } from \"../../utilities/index.js\";\nimport { fromError } from \"../utils/index.js\";\nimport { serializeFetchParameter, selectURI, parseAndCheckHttpResponse, checkFetcher, selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig, } from \"../http/index.js\";\nimport { BatchLink } from \"../batch/index.js\";\nimport { filterOperationVariables } from \"../utils/filterOperationVariables.js\";\n/**\n * Transforms Operation for into HTTP results.\n * context can include the headers property, which will be passed to the fetch function\n */\nvar BatchHttpLink = /** @class */ (function (_super) {\n __extends(BatchHttpLink, _super);\n function BatchHttpLink(fetchParams) {\n var _this = _super.call(this) || this;\n var _a = fetchParams || {}, _b = _a.uri, uri = _b === void 0 ? \"/graphql\" : _b, \n // use default global fetch if nothing is passed in\n fetcher = _a.fetch, _c = _a.print, print = _c === void 0 ? defaultPrinter : _c, includeExtensions = _a.includeExtensions, preserveHeaderCase = _a.preserveHeaderCase, batchInterval = _a.batchInterval, batchDebounce = _a.batchDebounce, batchMax = _a.batchMax, batchKey = _a.batchKey, _d = _a.includeUnusedVariables, includeUnusedVariables = _d === void 0 ? false : _d, requestOptions = __rest(_a, [\"uri\", \"fetch\", \"print\", \"includeExtensions\", \"preserveHeaderCase\", \"batchInterval\", \"batchDebounce\", \"batchMax\", \"batchKey\", \"includeUnusedVariables\"]);\n // dev warnings to ensure fetch is present\n checkFetcher(fetcher);\n //fetcher is set here rather than the destructuring to ensure fetch is\n //declared before referencing it. Reference in the destructuring would cause\n //a ReferenceError\n if (!fetcher) {\n fetcher = fetch;\n }\n var linkConfig = {\n http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase },\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n _this.batchDebounce = batchDebounce;\n _this.batchInterval = batchInterval || 10;\n _this.batchMax = batchMax || 10;\n var batchHandler = function (operations) {\n var chosenURI = selectURI(operations[0], uri);\n var context = operations[0].getContext();\n var clientAwarenessHeaders = {};\n if (context.clientAwareness) {\n var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;\n if (name_1) {\n clientAwarenessHeaders[\"apollographql-client-name\"] = name_1;\n }\n if (version) {\n clientAwarenessHeaders[\"apollographql-client-version\"] = version;\n }\n }\n var contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: __assign(__assign({}, clientAwarenessHeaders), context.headers),\n };\n var queries = operations.map(function (_a) {\n var query = _a.query;\n if (hasDirectives([\"client\"], query)) {\n return removeClientSetsFromDocument(query);\n }\n return query;\n });\n // If we have a query that returned `null` after removing client-only\n // fields, it indicates a query that is using all client-only fields.\n if (queries.some(function (query) { return !query; })) {\n return fromError(new Error(\"BatchHttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or enable the `transformOptions.removeClientFields` option.\"));\n }\n //uses fallback, link, and then context to build options\n var optsAndBody = operations.map(function (operation, index) {\n var result = selectHttpOptionsAndBodyInternal(__assign(__assign({}, operation), { query: queries[index] }), print, fallbackHttpConfig, linkConfig, contextConfig);\n if (result.body.variables && !includeUnusedVariables) {\n result.body.variables = filterOperationVariables(result.body.variables, operation.query);\n }\n return result;\n });\n var loadedBody = optsAndBody.map(function (_a) {\n var body = _a.body;\n return body;\n });\n var options = optsAndBody[0].options;\n // There's no spec for using GET with batches.\n if (options.method === \"GET\") {\n return fromError(new Error(\"apollo-link-batch-http does not support GET requests\"));\n }\n try {\n options.body = serializeFetchParameter(loadedBody, \"Payload\");\n }\n catch (parseError) {\n return fromError(parseError);\n }\n var controller;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n return new Observable(function (observer) {\n fetcher(chosenURI, options)\n .then(function (response) {\n // Make the raw response available in the context.\n operations.forEach(function (operation) {\n return operation.setContext({ response: response });\n });\n return response;\n })\n .then(parseAndCheckHttpResponse(operations))\n .then(function (result) {\n controller = undefined;\n // we have data and can send it to back up the link chain\n observer.next(result);\n observer.complete();\n return result;\n })\n .catch(function (err) {\n controller = undefined;\n // if it is a network error, BUT there is graphql result info\n // fire the next observer before calling error\n // this gives apollo-client (and react-apollo) the `graphqlErrors` and `networkErrors`\n // to pass to UI\n // this should only happen if we *also* have data as part of the response key per\n // the spec\n if (err.result && err.result.errors && err.result.data) {\n // if we dont' call next, the UI can only show networkError because AC didn't\n // get andy graphqlErrors\n // this is graphql execution result info (i.e errors and possibly data)\n // this is because there is no formal spec how errors should translate to\n // http status codes. So an auth error (401) could have both data\n // from a public field, errors from a private field, and a status of 401\n // {\n // user { // this will have errors\n // firstName\n // }\n // products { // this is public so will have data\n // cost\n // }\n // }\n //\n // the result of above *could* look like this:\n // {\n // data: { products: [{ cost: \"$10\" }] },\n // errors: [{\n // message: 'your session has timed out',\n // path: []\n // }]\n // }\n // status code of above would be a 401\n // in the UI you want to show data where you can, errors as data where you can\n // and use correct http status codes\n observer.next(err.result);\n }\n observer.error(err);\n });\n return function () {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller)\n controller.abort();\n };\n });\n };\n batchKey =\n batchKey ||\n (function (operation) {\n var context = operation.getContext();\n var contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n //may throw error if config not serializable\n return selectURI(operation, uri) + JSON.stringify(contextConfig);\n });\n _this.batcher = new BatchLink({\n batchDebounce: _this.batchDebounce,\n batchInterval: _this.batchInterval,\n batchMax: _this.batchMax,\n batchKey: batchKey,\n batchHandler: batchHandler,\n });\n return _this;\n }\n BatchHttpLink.prototype.request = function (operation) {\n return this.batcher.request(operation);\n };\n return BatchHttpLink;\n}(ApolloLink));\nexport { BatchHttpLink };\n//# sourceMappingURL=batchHttpLink.js.map"],"names":["__assign","visit","__extends","defaultPrinter","__rest","checkFetcher","selectURI","hasDirectives","removeClientSetsFromDocument","fromError","selectHttpOptionsAndBodyInternal","fallbackHttpConfig","serializeFetchParameter","Observable","parseAndCheckHttpResponse","BatchLink","ApolloLink"],"mappings":";;;;;;;;;;;;AAEO,SAAS,wBAAwB,CAAC,SAAS,EAAE,KAAK,EAAE;AAC3D,IAAI,IAAI,MAAM,GAAGA,cAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AACzC,IAAI,IAAI,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IA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graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs.native.js new file mode 100644 index 0000000..f242024 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batch-http.cjs.native.js @@ -0,0 +1,160 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); +var utils = require('../utils'); +var http = require('../http'); +var batch = require('../batch'); +var graphql = require('graphql'); + +function filterOperationVariables(variables, query) { + var result = tslib.__assign({}, variables); + var unusedNames = new Set(Object.keys(variables)); + graphql.visit(query, { + Variable: function (node, _key, parent) { + if (parent && + parent.kind !== "VariableDefinition") { + unusedNames.delete(node.name.value); + } + }, + }); + unusedNames.forEach(function (name) { + delete result[name]; + }); + return result; +} + +var BatchHttpLink = (function (_super) { + tslib.__extends(BatchHttpLink, _super); + function BatchHttpLink(fetchParams) { + var _this = _super.call(this) || this; + var _a = fetchParams || {}, _b = _a.uri, uri = _b === void 0 ? "/graphql" : _b, + fetcher = _a.fetch, _c = _a.print, print = _c === void 0 ? http.defaultPrinter : _c, includeExtensions = _a.includeExtensions, preserveHeaderCase = _a.preserveHeaderCase, batchInterval = _a.batchInterval, batchDebounce = _a.batchDebounce, batchMax = _a.batchMax, batchKey = _a.batchKey, _d = _a.includeUnusedVariables, includeUnusedVariables = _d === void 0 ? false : _d, requestOptions = tslib.__rest(_a, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "batchInterval", "batchDebounce", "batchMax", "batchKey", "includeUnusedVariables"]); + http.checkFetcher(fetcher); + if (!fetcher) { + fetcher = fetch; + } + var linkConfig = { + http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + _this.batchDebounce = batchDebounce; + _this.batchInterval = batchInterval || 10; + _this.batchMax = batchMax || 10; + var batchHandler = function (operations) { + var chosenURI = http.selectURI(operations[0], uri); + var context = operations[0].getContext(); + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders["apollographql-client-name"] = name_1; + } + if (version) { + clientAwarenessHeaders["apollographql-client-version"] = version; + } + } + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers), + }; + var queries = operations.map(function (_a) { + var query = _a.query; + if (utilities.hasDirectives(["client"], query)) { + return utilities.removeClientSetsFromDocument(query); + } + return query; + }); + if (queries.some(function (query) { return !query; })) { + return utils.fromError(new Error("BatchHttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or enable the `transformOptions.removeClientFields` option.")); + } + var optsAndBody = operations.map(function (operation, index) { + var result = http.selectHttpOptionsAndBodyInternal(tslib.__assign(tslib.__assign({}, operation), { query: queries[index] }), print, http.fallbackHttpConfig, linkConfig, contextConfig); + if (result.body.variables && !includeUnusedVariables) { + result.body.variables = filterOperationVariables(result.body.variables, operation.query); + } + return result; + }); + var loadedBody = optsAndBody.map(function (_a) { + var body = _a.body; + return body; + }); + var options = optsAndBody[0].options; + if (options.method === "GET") { + return utils.fromError(new Error("apollo-link-batch-http does not support GET requests")); + } + try { + options.body = http.serializeFetchParameter(loadedBody, "Payload"); + } + catch (parseError) { + return utils.fromError(parseError); + } + var controller; + if (!options.signal && typeof AbortController !== "undefined") { + controller = new AbortController(); + options.signal = controller.signal; + } + return new utilities.Observable(function (observer) { + fetcher(chosenURI, options) + .then(function (response) { + operations.forEach(function (operation) { + return operation.setContext({ response: response }); + }); + return response; + }) + .then(http.parseAndCheckHttpResponse(operations)) + .then(function (result) { + controller = undefined; + observer.next(result); + observer.complete(); + return result; + }) + .catch(function (err) { + controller = undefined; + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); + }); + return function () { + if (controller) + controller.abort(); + }; + }); + }; + batchKey = + batchKey || + (function (operation) { + var context = operation.getContext(); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: context.headers, + }; + return http.selectURI(operation, uri) + JSON.stringify(contextConfig); + }); + _this.batcher = new batch.BatchLink({ + batchDebounce: _this.batchDebounce, + batchInterval: _this.batchInterval, + batchMax: _this.batchMax, + batchKey: batchKey, + batchHandler: batchHandler, + }); + return _this; + } + BatchHttpLink.prototype.request = function (operation) { + return this.batcher.request(operation); + }; + return BatchHttpLink; +}(core.ApolloLink)); + +exports.BatchHttpLink = BatchHttpLink; +//# sourceMappingURL=batch-http.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.d.ts b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.d.ts new file mode 100644 index 0000000..bc19737 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.d.ts @@ -0,0 +1,21 @@ +import type { Operation, FetchResult } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +import type { HttpOptions } from "../http/index.js"; +import { BatchLink } from "../batch/index.js"; +export declare namespace BatchHttpLink { + type Options = Pick & Omit; +} +/** + * Transforms Operation for into HTTP results. + * context can include the headers property, which will be passed to the fetch function + */ +export declare class BatchHttpLink extends ApolloLink { + private batchDebounce?; + private batchInterval; + private batchMax; + private batcher; + constructor(fetchParams?: BatchHttpLink.Options); + request(operation: Operation): Observable | null; +} +//# sourceMappingURL=batchHttpLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js new file mode 100644 index 0000000..c8f9ed0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js @@ -0,0 +1,187 @@ +import { __assign, __extends, __rest } from "tslib"; +import { ApolloLink } from "../core/index.js"; +import { Observable, hasDirectives, removeClientSetsFromDocument, } from "../../utilities/index.js"; +import { fromError } from "../utils/index.js"; +import { serializeFetchParameter, selectURI, parseAndCheckHttpResponse, checkFetcher, selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig, } from "../http/index.js"; +import { BatchLink } from "../batch/index.js"; +import { filterOperationVariables } from "../utils/filterOperationVariables.js"; +/** + * Transforms Operation for into HTTP results. + * context can include the headers property, which will be passed to the fetch function + */ +var BatchHttpLink = /** @class */ (function (_super) { + __extends(BatchHttpLink, _super); + function BatchHttpLink(fetchParams) { + var _this = _super.call(this) || this; + var _a = fetchParams || {}, _b = _a.uri, uri = _b === void 0 ? "/graphql" : _b, + // use default global fetch if nothing is passed in + fetcher = _a.fetch, _c = _a.print, print = _c === void 0 ? defaultPrinter : _c, includeExtensions = _a.includeExtensions, preserveHeaderCase = _a.preserveHeaderCase, batchInterval = _a.batchInterval, batchDebounce = _a.batchDebounce, batchMax = _a.batchMax, batchKey = _a.batchKey, _d = _a.includeUnusedVariables, includeUnusedVariables = _d === void 0 ? false : _d, requestOptions = __rest(_a, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "batchInterval", "batchDebounce", "batchMax", "batchKey", "includeUnusedVariables"]); + // dev warnings to ensure fetch is present + checkFetcher(fetcher); + //fetcher is set here rather than the destructuring to ensure fetch is + //declared before referencing it. Reference in the destructuring would cause + //a ReferenceError + if (!fetcher) { + fetcher = fetch; + } + var linkConfig = { + http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + _this.batchDebounce = batchDebounce; + _this.batchInterval = batchInterval || 10; + _this.batchMax = batchMax || 10; + var batchHandler = function (operations) { + var chosenURI = selectURI(operations[0], uri); + var context = operations[0].getContext(); + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders["apollographql-client-name"] = name_1; + } + if (version) { + clientAwarenessHeaders["apollographql-client-version"] = version; + } + } + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: __assign(__assign({}, clientAwarenessHeaders), context.headers), + }; + var queries = operations.map(function (_a) { + var query = _a.query; + if (hasDirectives(["client"], query)) { + return removeClientSetsFromDocument(query); + } + return query; + }); + // If we have a query that returned `null` after removing client-only + // fields, it indicates a query that is using all client-only fields. + if (queries.some(function (query) { return !query; })) { + return fromError(new Error("BatchHttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or enable the `transformOptions.removeClientFields` option.")); + } + //uses fallback, link, and then context to build options + var optsAndBody = operations.map(function (operation, index) { + var result = selectHttpOptionsAndBodyInternal(__assign(__assign({}, operation), { query: queries[index] }), print, fallbackHttpConfig, linkConfig, contextConfig); + if (result.body.variables && !includeUnusedVariables) { + result.body.variables = filterOperationVariables(result.body.variables, operation.query); + } + return result; + }); + var loadedBody = optsAndBody.map(function (_a) { + var body = _a.body; + return body; + }); + var options = optsAndBody[0].options; + // There's no spec for using GET with batches. + if (options.method === "GET") { + return fromError(new Error("apollo-link-batch-http does not support GET requests")); + } + try { + options.body = serializeFetchParameter(loadedBody, "Payload"); + } + catch (parseError) { + return fromError(parseError); + } + var controller; + if (!options.signal && typeof AbortController !== "undefined") { + controller = new AbortController(); + options.signal = controller.signal; + } + return new Observable(function (observer) { + fetcher(chosenURI, options) + .then(function (response) { + // Make the raw response available in the context. + operations.forEach(function (operation) { + return operation.setContext({ response: response }); + }); + return response; + }) + .then(parseAndCheckHttpResponse(operations)) + .then(function (result) { + controller = undefined; + // we have data and can send it to back up the link chain + observer.next(result); + observer.complete(); + return result; + }) + .catch(function (err) { + controller = undefined; + // if it is a network error, BUT there is graphql result info + // fire the next observer before calling error + // this gives apollo-client (and react-apollo) the `graphqlErrors` and `networkErrors` + // to pass to UI + // this should only happen if we *also* have data as part of the response key per + // the spec + if (err.result && err.result.errors && err.result.data) { + // if we dont' call next, the UI can only show networkError because AC didn't + // get andy graphqlErrors + // this is graphql execution result info (i.e errors and possibly data) + // this is because there is no formal spec how errors should translate to + // http status codes. So an auth error (401) could have both data + // from a public field, errors from a private field, and a status of 401 + // { + // user { // this will have errors + // firstName + // } + // products { // this is public so will have data + // cost + // } + // } + // + // the result of above *could* look like this: + // { + // data: { products: [{ cost: "$10" }] }, + // errors: [{ + // message: 'your session has timed out', + // path: [] + // }] + // } + // status code of above would be a 401 + // in the UI you want to show data where you can, errors as data where you can + // and use correct http status codes + observer.next(err.result); + } + observer.error(err); + }); + return function () { + // XXX support canceling this request + // https://developers.google.com/web/updates/2017/09/abortable-fetch + if (controller) + controller.abort(); + }; + }); + }; + batchKey = + batchKey || + (function (operation) { + var context = operation.getContext(); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: context.headers, + }; + //may throw error if config not serializable + return selectURI(operation, uri) + JSON.stringify(contextConfig); + }); + _this.batcher = new BatchLink({ + batchDebounce: _this.batchDebounce, + batchInterval: _this.batchInterval, + batchMax: _this.batchMax, + batchKey: batchKey, + batchHandler: batchHandler, + }); + return _this; + } + BatchHttpLink.prototype.request = function (operation) { + return this.batcher.request(operation); + }; + return BatchHttpLink; +}(ApolloLink)); +export { BatchHttpLink }; +//# sourceMappingURL=batchHttpLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js.map b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js.map new file mode 100644 index 0000000..af58ba8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/batchHttpLink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"batchHttpLink.js","sourceRoot":"","sources":["../../../src/link/batch-http/batchHttpLink.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,aAAa,EACb,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AACl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Result } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport {\n Observable,\n hasDirectives,\n removeClientSetsFromDocument,\n} from \"../../utilities/index.js\";\nimport { fromError } from \"../utils/index.js\";\nimport type { HttpOptions } from \"../http/index.js\";\nimport {\n serializeFetchParameter,\n selectURI,\n parseAndCheckHttpResponse,\n checkFetcher,\n selectHttpOptionsAndBodyInternal,\n defaultPrinter,\n fallbackHttpConfig,\n} from \"../http/index.js\";\nimport { BatchLink } from \"../batch/index.js\";\nimport { filterOperationVariables } from \"../utils/filterOperationVariables.js\";\n\nexport namespace BatchHttpLink {\n export type Options = Pick<\n BatchLink.Options,\n \"batchMax\" | \"batchDebounce\" | \"batchInterval\" | \"batchKey\"\n > &\n Omit;\n}\n\n/**\n * Transforms Operation for into HTTP results.\n * context can include the headers property, which will be passed to the fetch function\n */\nexport class BatchHttpLink extends ApolloLink {\n private batchDebounce?: boolean;\n private batchInterval: number;\n private batchMax: number;\n private batcher: ApolloLink;\n\n constructor(fetchParams?: BatchHttpLink.Options) {\n super();\n\n let {\n uri = \"/graphql\",\n // use default global fetch if nothing is passed in\n fetch: fetcher,\n print = defaultPrinter,\n includeExtensions,\n preserveHeaderCase,\n batchInterval,\n batchDebounce,\n batchMax,\n batchKey,\n includeUnusedVariables = false,\n ...requestOptions\n } = fetchParams || ({} as BatchHttpLink.Options);\n\n // dev warnings to ensure fetch is present\n checkFetcher(fetcher);\n\n //fetcher is set here rather than the destructuring to ensure fetch is\n //declared before referencing it. Reference in the destructuring would cause\n //a ReferenceError\n if (!fetcher) {\n fetcher = fetch;\n }\n\n const linkConfig = {\n http: { includeExtensions, preserveHeaderCase },\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval || 10;\n this.batchMax = batchMax || 10;\n\n const batchHandler = (operations: Operation[]) => {\n const chosenURI = selectURI(operations[0], uri);\n\n const context = operations[0].getContext();\n\n const clientAwarenessHeaders: {\n \"apollographql-client-name\"?: string;\n \"apollographql-client-version\"?: string;\n } = {};\n if (context.clientAwareness) {\n const { name, version } = context.clientAwareness;\n if (name) {\n clientAwarenessHeaders[\"apollographql-client-name\"] = name;\n }\n if (version) {\n clientAwarenessHeaders[\"apollographql-client-version\"] = version;\n }\n }\n\n const contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: { ...clientAwarenessHeaders, ...context.headers },\n };\n\n const queries = operations.map(({ query }) => {\n if (hasDirectives([\"client\"], query)) {\n return removeClientSetsFromDocument(query);\n }\n\n return query;\n });\n\n // If we have a query that returned `null` after removing client-only\n // fields, it indicates a query that is using all client-only fields.\n if (queries.some((query) => !query)) {\n return fromError(\n new Error(\n \"BatchHttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or enable the `transformOptions.removeClientFields` option.\"\n )\n );\n }\n\n //uses fallback, link, and then context to build options\n const optsAndBody = operations.map((operation, index) => {\n const result = selectHttpOptionsAndBodyInternal(\n { ...operation, query: queries[index]! },\n print,\n fallbackHttpConfig,\n linkConfig,\n contextConfig\n );\n\n if (result.body.variables && !includeUnusedVariables) {\n result.body.variables = filterOperationVariables(\n result.body.variables,\n operation.query\n );\n }\n\n return result;\n });\n\n const loadedBody = optsAndBody.map(({ body }) => body);\n const options = optsAndBody[0].options;\n\n // There's no spec for using GET with batches.\n if (options.method === \"GET\") {\n return fromError(\n new Error(\"apollo-link-batch-http does not support GET requests\")\n );\n }\n\n try {\n (options as any).body = serializeFetchParameter(loadedBody, \"Payload\");\n } catch (parseError) {\n return fromError(parseError);\n }\n\n let controller: AbortController | undefined;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n\n return new Observable((observer) => {\n fetcher!(chosenURI, options)\n .then((response) => {\n // Make the raw response available in the context.\n operations.forEach((operation) =>\n operation.setContext({ response })\n );\n return response;\n })\n .then(parseAndCheckHttpResponse(operations))\n .then((result) => {\n controller = undefined;\n // we have data and can send it to back up the link chain\n observer.next(result);\n observer.complete();\n return result;\n })\n .catch((err) => {\n controller = undefined;\n // if it is a network error, BUT there is graphql result info\n // fire the next observer before calling error\n // this gives apollo-client (and react-apollo) the `graphqlErrors` and `networkErrors`\n // to pass to UI\n // this should only happen if we *also* have data as part of the response key per\n // the spec\n if (err.result && err.result.errors && err.result.data) {\n // if we dont' call next, the UI can only show networkError because AC didn't\n // get andy graphqlErrors\n // this is graphql execution result info (i.e errors and possibly data)\n // this is because there is no formal spec how errors should translate to\n // http status codes. So an auth error (401) could have both data\n // from a public field, errors from a private field, and a status of 401\n // {\n // user { // this will have errors\n // firstName\n // }\n // products { // this is public so will have data\n // cost\n // }\n // }\n //\n // the result of above *could* look like this:\n // {\n // data: { products: [{ cost: \"$10\" }] },\n // errors: [{\n // message: 'your session has timed out',\n // path: []\n // }]\n // }\n // status code of above would be a 401\n // in the UI you want to show data where you can, errors as data where you can\n // and use correct http status codes\n observer.next(err.result);\n }\n\n observer.error(err);\n });\n\n return () => {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller) controller.abort();\n };\n });\n };\n\n batchKey =\n batchKey ||\n ((operation: Operation) => {\n const context = operation.getContext();\n\n const contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: context.headers,\n };\n\n //may throw error if config not serializable\n return selectURI(operation, uri) + JSON.stringify(contextConfig);\n });\n\n this.batcher = new BatchLink({\n batchDebounce: this.batchDebounce,\n batchInterval: this.batchInterval,\n batchMax: this.batchMax,\n batchKey,\n batchHandler,\n });\n }\n\n public request(operation: Operation): Observable | null {\n return this.batcher.request(operation);\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.d.ts new file mode 100644 index 0000000..1eb5443 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.d.ts @@ -0,0 +1,2 @@ +export * from "./batchHttpLink.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js b/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js new file mode 100644 index 0000000..b6fd59f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js @@ -0,0 +1,2 @@ +export * from "./batchHttpLink.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js.map new file mode 100644 index 0000000..fc8f990 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/batch-http/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./batchHttpLink.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch-http/package.json b/graphql-subscription/node_modules/@apollo/client/link/batch-http/package.json new file mode 100644 index 0000000..e539c88 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch-http/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/batch-http", + "type": "module", + "main": "batch-http.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs b/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs new file mode 100644 index 0000000..bfe2509 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs @@ -0,0 +1,159 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); + +var OperationBatcher = (function () { + function OperationBatcher(_a) { + var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey; + this.batchesByKey = new Map(); + this.scheduledBatchTimerByKey = new Map(); + this.batchDebounce = batchDebounce; + this.batchInterval = batchInterval; + this.batchMax = batchMax || 0; + this.batchHandler = batchHandler; + this.batchKey = batchKey || (function () { return ""; }); + } + OperationBatcher.prototype.enqueueRequest = function (request) { + var _this = this; + var requestCopy = tslib.__assign(tslib.__assign({}, request), { next: [], error: [], complete: [], subscribers: new Set() }); + var key = this.batchKey(request.operation); + if (!requestCopy.observable) { + requestCopy.observable = new utilities.Observable(function (observer) { + var batch = _this.batchesByKey.get(key); + if (!batch) + _this.batchesByKey.set(key, (batch = new Set())); + var isFirstEnqueuedRequest = batch.size === 0; + var isFirstSubscriber = requestCopy.subscribers.size === 0; + requestCopy.subscribers.add(observer); + if (isFirstSubscriber) { + batch.add(requestCopy); + } + if (observer.next) { + requestCopy.next.push(observer.next.bind(observer)); + } + if (observer.error) { + requestCopy.error.push(observer.error.bind(observer)); + } + if (observer.complete) { + requestCopy.complete.push(observer.complete.bind(observer)); + } + if (isFirstEnqueuedRequest || _this.batchDebounce) { + _this.scheduleQueueConsumption(key); + } + if (batch.size === _this.batchMax) { + _this.consumeQueue(key); + } + return function () { + var _a; + if (requestCopy.subscribers.delete(observer) && + requestCopy.subscribers.size < 1) { + if (batch.delete(requestCopy) && batch.size < 1) { + _this.consumeQueue(key); + (_a = batch.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe(); + } + } + }; + }); + } + return requestCopy.observable; + }; + OperationBatcher.prototype.consumeQueue = function (key) { + if (key === void 0) { key = ""; } + var batch = this.batchesByKey.get(key); + this.batchesByKey.delete(key); + if (!batch || !batch.size) { + return; + } + var operations = []; + var forwards = []; + var observables = []; + var nexts = []; + var errors = []; + var completes = []; + batch.forEach(function (request) { + operations.push(request.operation); + forwards.push(request.forward); + observables.push(request.observable); + nexts.push(request.next); + errors.push(request.error); + completes.push(request.complete); + }); + var batchedObservable = this.batchHandler(operations, forwards) || utilities.Observable.of(); + var onError = function (error) { + errors.forEach(function (rejecters) { + if (rejecters) { + rejecters.forEach(function (e) { return e(error); }); + } + }); + }; + batch.subscription = batchedObservable.subscribe({ + next: function (results) { + if (!Array.isArray(results)) { + results = [results]; + } + if (nexts.length !== results.length) { + var error = new Error("server returned results with length ".concat(results.length, ", expected length of ").concat(nexts.length)); + error.result = results; + return onError(error); + } + results.forEach(function (result, index) { + if (nexts[index]) { + nexts[index].forEach(function (next) { return next(result); }); + } + }); + }, + error: onError, + complete: function () { + completes.forEach(function (complete) { + if (complete) { + complete.forEach(function (c) { return c(); }); + } + }); + }, + }); + return observables; + }; + OperationBatcher.prototype.scheduleQueueConsumption = function (key) { + var _this = this; + clearTimeout(this.scheduledBatchTimerByKey.get(key)); + this.scheduledBatchTimerByKey.set(key, setTimeout(function () { + _this.consumeQueue(key); + _this.scheduledBatchTimerByKey.delete(key); + }, this.batchInterval)); + }; + return OperationBatcher; +}()); + +var BatchLink = (function (_super) { + tslib.__extends(BatchLink, _super); + function BatchLink(fetchParams) { + var _this = _super.call(this) || this; + var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ""; } : _e; + _this.batcher = new OperationBatcher({ + batchDebounce: batchDebounce, + batchInterval: batchInterval, + batchMax: batchMax, + batchHandler: batchHandler, + batchKey: batchKey, + }); + if (fetchParams.batchHandler.length <= 1) { + _this.request = function (operation) { return _this.batcher.enqueueRequest({ operation: operation }); }; + } + return _this; + } + BatchLink.prototype.request = function (operation, forward) { + return this.batcher.enqueueRequest({ + operation: operation, + forward: forward, + }); + }; + return BatchLink; +}(core.ApolloLink)); + +exports.BatchLink = BatchLink; +exports.OperationBatcher = OperationBatcher; +//# sourceMappingURL=batch.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.map new file mode 100644 index 0000000..ff5ef0a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"batch.cjs","sources":["batching.js","batchLink.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { Observable } from \"../../utilities/index.js\";\n// QueryBatcher doesn't fire requests immediately. Requests that were enqueued within\n// a certain amount of time (configurable through `batchInterval`) will be batched together\n// into one query.\nvar OperationBatcher = /** @class */ (function () {\n function OperationBatcher(_a) {\n var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey;\n // Queue on which the QueryBatcher will operate on a per-tick basis.\n this.batchesByKey = new Map();\n this.scheduledBatchTimerByKey = new Map();\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval;\n this.batchMax = batchMax || 0;\n this.batchHandler = batchHandler;\n this.batchKey = batchKey || (function () { return \"\"; });\n }\n OperationBatcher.prototype.enqueueRequest = function (request) {\n var _this = this;\n var requestCopy = __assign(__assign({}, request), { next: [], error: [], complete: [], subscribers: new Set() });\n var key = this.batchKey(request.operation);\n if (!requestCopy.observable) {\n requestCopy.observable = new Observable(function (observer) {\n var batch = _this.batchesByKey.get(key);\n if (!batch)\n _this.batchesByKey.set(key, (batch = new Set()));\n // These booleans seem to me (@benjamn) like they might always be the\n // same (and thus we could do with only one of them), but I'm not 100%\n // sure about that.\n var isFirstEnqueuedRequest = batch.size === 0;\n var isFirstSubscriber = requestCopy.subscribers.size === 0;\n requestCopy.subscribers.add(observer);\n if (isFirstSubscriber) {\n batch.add(requestCopy);\n }\n // called for each subscriber, so need to save all listeners (next, error, complete)\n if (observer.next) {\n requestCopy.next.push(observer.next.bind(observer));\n }\n if (observer.error) {\n requestCopy.error.push(observer.error.bind(observer));\n }\n if (observer.complete) {\n requestCopy.complete.push(observer.complete.bind(observer));\n }\n // The first enqueued request triggers the queue consumption after `batchInterval` milliseconds.\n if (isFirstEnqueuedRequest || _this.batchDebounce) {\n _this.scheduleQueueConsumption(key);\n }\n // When amount of requests reaches `batchMax`, trigger the queue consumption without waiting on the `batchInterval`.\n if (batch.size === _this.batchMax) {\n _this.consumeQueue(key);\n }\n return function () {\n var _a;\n // If this is last subscriber for this request, remove request from queue\n if (requestCopy.subscribers.delete(observer) &&\n requestCopy.subscribers.size < 1) {\n // If this is last request from queue, remove queue entirely\n if (batch.delete(requestCopy) && batch.size < 1) {\n _this.consumeQueue(key);\n // If queue was in flight, cancel it\n (_a = batch.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();\n }\n }\n };\n });\n }\n return requestCopy.observable;\n };\n // Consumes the queue.\n // Returns a list of promises (one for each query).\n OperationBatcher.prototype.consumeQueue = function (key) {\n if (key === void 0) { key = \"\"; }\n var batch = this.batchesByKey.get(key);\n // Delete this batch and process it below.\n this.batchesByKey.delete(key);\n if (!batch || !batch.size) {\n // No requests to be processed.\n return;\n }\n var operations = [];\n var forwards = [];\n var observables = [];\n var nexts = [];\n var errors = [];\n var completes = [];\n // Even though batch is a Set, it preserves the order of first insertion\n // when iterating (per ECMAScript specification), so these requests will be\n // handled in the order they were enqueued (minus any deleted ones).\n batch.forEach(function (request) {\n operations.push(request.operation);\n forwards.push(request.forward);\n observables.push(request.observable);\n nexts.push(request.next);\n errors.push(request.error);\n completes.push(request.complete);\n });\n var batchedObservable = this.batchHandler(operations, forwards) || Observable.of();\n var onError = function (error) {\n //each callback list in batch\n errors.forEach(function (rejecters) {\n if (rejecters) {\n //each subscriber to request\n rejecters.forEach(function (e) { return e(error); });\n }\n });\n };\n batch.subscription = batchedObservable.subscribe({\n next: function (results) {\n if (!Array.isArray(results)) {\n results = [results];\n }\n if (nexts.length !== results.length) {\n var error = new Error(\"server returned results with length \".concat(results.length, \", expected length of \").concat(nexts.length));\n error.result = results;\n return onError(error);\n }\n results.forEach(function (result, index) {\n if (nexts[index]) {\n nexts[index].forEach(function (next) { return next(result); });\n }\n });\n },\n error: onError,\n complete: function () {\n completes.forEach(function (complete) {\n if (complete) {\n //each subscriber to request\n complete.forEach(function (c) { return c(); });\n }\n });\n },\n });\n return observables;\n };\n OperationBatcher.prototype.scheduleQueueConsumption = function (key) {\n var _this = this;\n clearTimeout(this.scheduledBatchTimerByKey.get(key));\n this.scheduledBatchTimerByKey.set(key, setTimeout(function () {\n _this.consumeQueue(key);\n _this.scheduledBatchTimerByKey.delete(key);\n }, this.batchInterval));\n };\n return OperationBatcher;\n}());\nexport { OperationBatcher };\n//# sourceMappingURL=batching.js.map","import { __extends } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { OperationBatcher } from \"./batching.js\";\nexport { OperationBatcher } from \"./batching.js\";\nvar BatchLink = /** @class */ (function (_super) {\n __extends(BatchLink, _super);\n function BatchLink(fetchParams) {\n var _this = _super.call(this) || this;\n var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return \"\"; } : _e;\n _this.batcher = new OperationBatcher({\n batchDebounce: batchDebounce,\n batchInterval: batchInterval,\n batchMax: batchMax,\n batchHandler: batchHandler,\n batchKey: batchKey,\n });\n //make this link terminating\n if (fetchParams.batchHandler.length <= 1) {\n _this.request = function (operation) { return _this.batcher.enqueueRequest({ operation: operation }); };\n }\n return _this;\n }\n BatchLink.prototype.request = function (operation, forward) {\n return this.batcher.enqueueRequest({\n operation: operation,\n forward: forward,\n });\n };\n return BatchLink;\n}(ApolloLink));\nexport { BatchLink };\n//# sourceMappingURL=batchLink.js.map"],"names":["__assign","Observable","__extends","ApolloLink"],"mappings":";;;;;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AAG,EAAE,KAAK,KAAK,CAAC,GAAG,YAAY,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AAChW,QAAQ,KAAK,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC;AAC7C,YAAY,aAAa,EAAE,aAAa;AACxC,YAAY,aAAa,EAAE,aAAa;AACxC,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,YAAY,EAAE,YAAY;AACtC,YAAY,QAAQ,EAAE,QAAQ;AAC9B,SAAS,CAAC,CAAC;AAEX,QAAQ,IAAI,WAAW,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE;AAClD,YAAY,KAAK,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;AACpH,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE,OAAO,EAAE;AAChE,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;AAC3C,YAAY,SAAS,EAAE,SAAS;AAChC,YAAY,OAAO,EAAE,OAAO;AAC5B,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAACC,eAAU,CAAC;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.native.js new file mode 100644 index 0000000..bfe2509 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batch.cjs.native.js @@ -0,0 +1,159 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); + +var OperationBatcher = (function () { + function OperationBatcher(_a) { + var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey; + this.batchesByKey = new Map(); + this.scheduledBatchTimerByKey = new Map(); + this.batchDebounce = batchDebounce; + this.batchInterval = batchInterval; + this.batchMax = batchMax || 0; + this.batchHandler = batchHandler; + this.batchKey = batchKey || (function () { return ""; }); + } + OperationBatcher.prototype.enqueueRequest = function (request) { + var _this = this; + var requestCopy = tslib.__assign(tslib.__assign({}, request), { next: [], error: [], complete: [], subscribers: new Set() }); + var key = this.batchKey(request.operation); + if (!requestCopy.observable) { + requestCopy.observable = new utilities.Observable(function (observer) { + var batch = _this.batchesByKey.get(key); + if (!batch) + _this.batchesByKey.set(key, (batch = new Set())); + var isFirstEnqueuedRequest = batch.size === 0; + var isFirstSubscriber = requestCopy.subscribers.size === 0; + requestCopy.subscribers.add(observer); + if (isFirstSubscriber) { + batch.add(requestCopy); + } + if (observer.next) { + requestCopy.next.push(observer.next.bind(observer)); + } + if (observer.error) { + requestCopy.error.push(observer.error.bind(observer)); + } + if (observer.complete) { + requestCopy.complete.push(observer.complete.bind(observer)); + } + if (isFirstEnqueuedRequest || _this.batchDebounce) { + _this.scheduleQueueConsumption(key); + } + if (batch.size === _this.batchMax) { + _this.consumeQueue(key); + } + return function () { + var _a; + if (requestCopy.subscribers.delete(observer) && + requestCopy.subscribers.size < 1) { + if (batch.delete(requestCopy) && batch.size < 1) { + _this.consumeQueue(key); + (_a = batch.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe(); + } + } + }; + }); + } + return requestCopy.observable; + }; + OperationBatcher.prototype.consumeQueue = function (key) { + if (key === void 0) { key = ""; } + var batch = this.batchesByKey.get(key); + this.batchesByKey.delete(key); + if (!batch || !batch.size) { + return; + } + var operations = []; + var forwards = []; + var observables = []; + var nexts = []; + var errors = []; + var completes = []; + batch.forEach(function (request) { + operations.push(request.operation); + forwards.push(request.forward); + observables.push(request.observable); + nexts.push(request.next); + errors.push(request.error); + completes.push(request.complete); + }); + var batchedObservable = this.batchHandler(operations, forwards) || utilities.Observable.of(); + var onError = function (error) { + errors.forEach(function (rejecters) { + if (rejecters) { + rejecters.forEach(function (e) { return e(error); }); + } + }); + }; + batch.subscription = batchedObservable.subscribe({ + next: function (results) { + if (!Array.isArray(results)) { + results = [results]; + } + if (nexts.length !== results.length) { + var error = new Error("server returned results with length ".concat(results.length, ", expected length of ").concat(nexts.length)); + error.result = results; + return onError(error); + } + results.forEach(function (result, index) { + if (nexts[index]) { + nexts[index].forEach(function (next) { return next(result); }); + } + }); + }, + error: onError, + complete: function () { + completes.forEach(function (complete) { + if (complete) { + complete.forEach(function (c) { return c(); }); + } + }); + }, + }); + return observables; + }; + OperationBatcher.prototype.scheduleQueueConsumption = function (key) { + var _this = this; + clearTimeout(this.scheduledBatchTimerByKey.get(key)); + this.scheduledBatchTimerByKey.set(key, setTimeout(function () { + _this.consumeQueue(key); + _this.scheduledBatchTimerByKey.delete(key); + }, this.batchInterval)); + }; + return OperationBatcher; +}()); + +var BatchLink = (function (_super) { + tslib.__extends(BatchLink, _super); + function BatchLink(fetchParams) { + var _this = _super.call(this) || this; + var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ""; } : _e; + _this.batcher = new OperationBatcher({ + batchDebounce: batchDebounce, + batchInterval: batchInterval, + batchMax: batchMax, + batchHandler: batchHandler, + batchKey: batchKey, + }); + if (fetchParams.batchHandler.length <= 1) { + _this.request = function (operation) { return _this.batcher.enqueueRequest({ operation: operation }); }; + } + return _this; + } + BatchLink.prototype.request = function (operation, forward) { + return this.batcher.enqueueRequest({ + operation: operation, + forward: forward, + }); + }; + return BatchLink; +}(core.ApolloLink)); + +exports.BatchLink = BatchLink; +exports.OperationBatcher = OperationBatcher; +//# sourceMappingURL=batch.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.d.ts b/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.d.ts new file mode 100644 index 0000000..c5c843f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.d.ts @@ -0,0 +1,42 @@ +import type { Operation, FetchResult, NextLink } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import type { Observable } from "../../utilities/index.js"; +import type { BatchHandler } from "./batching.js"; +export type { BatchableRequest, BatchHandler } from "./batching.js"; +export { OperationBatcher } from "./batching.js"; +export declare namespace BatchLink { + interface Options { + /** + * The interval at which to batch, in milliseconds. + * + * Defaults to 10. + */ + batchInterval?: number; + /** + * "batchInterval" is a throttling behavior by default, if you instead wish + * to debounce outbound requests, set "batchDebounce" to true. More useful + * for mutations than queries. + */ + batchDebounce?: boolean; + /** + * The maximum number of operations to include in one fetch. + * + * Defaults to 0 (infinite operations within the interval). + */ + batchMax?: number; + /** + * The handler that should execute a batch of operations. + */ + batchHandler?: BatchHandler; + /** + * creates the key for a batch + */ + batchKey?: (operation: Operation) => string; + } +} +export declare class BatchLink extends ApolloLink { + private batcher; + constructor(fetchParams?: BatchLink.Options); + request(operation: Operation, forward?: NextLink): Observable | null; +} +//# sourceMappingURL=batchLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js b/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js new file mode 100644 index 0000000..1e13744 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js @@ -0,0 +1,32 @@ +import { __extends } from "tslib"; +import { ApolloLink } from "../core/index.js"; +import { OperationBatcher } from "./batching.js"; +export { OperationBatcher } from "./batching.js"; +var BatchLink = /** @class */ (function (_super) { + __extends(BatchLink, _super); + function BatchLink(fetchParams) { + var _this = _super.call(this) || this; + var _a = fetchParams || {}, batchDebounce = _a.batchDebounce, _b = _a.batchInterval, batchInterval = _b === void 0 ? 10 : _b, _c = _a.batchMax, batchMax = _c === void 0 ? 0 : _c, _d = _a.batchHandler, batchHandler = _d === void 0 ? function () { return null; } : _d, _e = _a.batchKey, batchKey = _e === void 0 ? function () { return ""; } : _e; + _this.batcher = new OperationBatcher({ + batchDebounce: batchDebounce, + batchInterval: batchInterval, + batchMax: batchMax, + batchHandler: batchHandler, + batchKey: batchKey, + }); + //make this link terminating + if (fetchParams.batchHandler.length <= 1) { + _this.request = function (operation) { return _this.batcher.enqueueRequest({ operation: operation }); }; + } + return _this; + } + BatchLink.prototype.request = function (operation, forward) { + return this.batcher.enqueueRequest({ + operation: operation, + forward: forward, + }); + }; + return BatchLink; +}(ApolloLink)); +export { BatchLink }; +//# sourceMappingURL=batchLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js.map b/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js.map new file mode 100644 index 0000000..ab37fc2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batchLink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"batchLink.js","sourceRoot":"","sources":["../../../src/link/batch/batchLink.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAqCjD;IAA+B,6BAAU;IAGvC,mBAAY,WAA+B;QACzC,YAAA,MAAK,WAAE,SAAC;QAEF,IAAA,KAMF,WAAW,IAAI,EAAE,EALnB,aAAa,mBAAA,EACb,qBAAkB,EAAlB,aAAa,mBAAG,EAAE,KAAA,EAClB,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,KAAA,EACZ,oBAAyB,EAAzB,YAAY,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA,EACzB,gBAAmB,EAAnB,QAAQ,mBAAG,cAAM,OAAA,EAAE,EAAF,CAAE,KACA,CAAC;QAEtB,KAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC;YAClC,aAAa,eAAA;YACb,aAAa,eAAA;YACb,QAAQ,UAAA;YACR,YAAY,cAAA;YACZ,QAAQ,UAAA;SACT,CAAC,CAAC;QAEH,4BAA4B;QAC5B,IAAI,WAAY,CAAC,YAAa,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC3C,KAAI,CAAC,OAAO,GAAG,UAAC,SAAS,IAAK,OAAA,KAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,SAAS,WAAA,EAAE,CAAC,EAA1C,CAA0C,CAAC;QAC3E,CAAC;;IACH,CAAC;IAEM,2BAAO,GAAd,UACE,SAAoB,EACpB,OAAkB;QAElB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;YACjC,SAAS,WAAA;YACT,OAAO,SAAA;SACR,CAAC,CAAC;IACL,CAAC;IACH,gBAAC;AAAD,CAAC,AArCD,CAA+B,UAAU,GAqCxC","sourcesContent":["import type { Operation, FetchResult, NextLink } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type { Observable } from \"../../utilities/index.js\";\nimport type { BatchHandler } from \"./batching.js\";\nimport { OperationBatcher } from \"./batching.js\";\nexport type { BatchableRequest, BatchHandler } from \"./batching.js\";\nexport { OperationBatcher } from \"./batching.js\";\n\nexport namespace BatchLink {\n export interface Options {\n /**\n * The interval at which to batch, in milliseconds.\n *\n * Defaults to 10.\n */\n batchInterval?: number;\n\n /**\n * \"batchInterval\" is a throttling behavior by default, if you instead wish\n * to debounce outbound requests, set \"batchDebounce\" to true. More useful\n * for mutations than queries.\n */\n batchDebounce?: boolean;\n\n /**\n * The maximum number of operations to include in one fetch.\n *\n * Defaults to 0 (infinite operations within the interval).\n */\n batchMax?: number;\n\n /**\n * The handler that should execute a batch of operations.\n */\n batchHandler?: BatchHandler;\n\n /**\n * creates the key for a batch\n */\n batchKey?: (operation: Operation) => string;\n }\n}\n\nexport class BatchLink extends ApolloLink {\n private batcher: OperationBatcher;\n\n constructor(fetchParams?: BatchLink.Options) {\n super();\n\n const {\n batchDebounce,\n batchInterval = 10,\n batchMax = 0,\n batchHandler = () => null,\n batchKey = () => \"\",\n } = fetchParams || {};\n\n this.batcher = new OperationBatcher({\n batchDebounce,\n batchInterval,\n batchMax,\n batchHandler,\n batchKey,\n });\n\n //make this link terminating\n if (fetchParams!.batchHandler!.length <= 1) {\n this.request = (operation) => this.batcher.enqueueRequest({ operation });\n }\n }\n\n public request(\n operation: Operation,\n forward?: NextLink\n ): Observable | null {\n return this.batcher.enqueueRequest({\n operation,\n forward,\n });\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batching.d.ts b/graphql-subscription/node_modules/@apollo/client/link/batch/batching.d.ts new file mode 100644 index 0000000..0efda92 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batching.d.ts @@ -0,0 +1,27 @@ +import type { FetchResult, NextLink, Operation } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +export type BatchHandler = (operations: Operation[], forward?: (NextLink | undefined)[]) => Observable | null; +export interface BatchableRequest { + operation: Operation; + forward?: NextLink; +} +export declare class OperationBatcher { + private batchesByKey; + private scheduledBatchTimerByKey; + private batchDebounce?; + private batchInterval?; + private batchMax; + private batchHandler; + private batchKey; + constructor({ batchDebounce, batchInterval, batchMax, batchHandler, batchKey, }: { + batchDebounce?: boolean; + batchInterval?: number; + batchMax?: number; + batchHandler: BatchHandler; + batchKey?: (operation: Operation) => string; + }); + enqueueRequest(request: BatchableRequest): Observable; + consumeQueue(key?: string): (Observable | undefined)[] | undefined; + private scheduleQueueConsumption; +} +//# sourceMappingURL=batching.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batching.js b/graphql-subscription/node_modules/@apollo/client/link/batch/batching.js new file mode 100644 index 0000000..9f8e9c1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batching.js @@ -0,0 +1,148 @@ +import { __assign } from "tslib"; +import { Observable } from "../../utilities/index.js"; +// QueryBatcher doesn't fire requests immediately. Requests that were enqueued within +// a certain amount of time (configurable through `batchInterval`) will be batched together +// into one query. +var OperationBatcher = /** @class */ (function () { + function OperationBatcher(_a) { + var batchDebounce = _a.batchDebounce, batchInterval = _a.batchInterval, batchMax = _a.batchMax, batchHandler = _a.batchHandler, batchKey = _a.batchKey; + // Queue on which the QueryBatcher will operate on a per-tick basis. + this.batchesByKey = new Map(); + this.scheduledBatchTimerByKey = new Map(); + this.batchDebounce = batchDebounce; + this.batchInterval = batchInterval; + this.batchMax = batchMax || 0; + this.batchHandler = batchHandler; + this.batchKey = batchKey || (function () { return ""; }); + } + OperationBatcher.prototype.enqueueRequest = function (request) { + var _this = this; + var requestCopy = __assign(__assign({}, request), { next: [], error: [], complete: [], subscribers: new Set() }); + var key = this.batchKey(request.operation); + if (!requestCopy.observable) { + requestCopy.observable = new Observable(function (observer) { + var batch = _this.batchesByKey.get(key); + if (!batch) + _this.batchesByKey.set(key, (batch = new Set())); + // These booleans seem to me (@benjamn) like they might always be the + // same (and thus we could do with only one of them), but I'm not 100% + // sure about that. + var isFirstEnqueuedRequest = batch.size === 0; + var isFirstSubscriber = requestCopy.subscribers.size === 0; + requestCopy.subscribers.add(observer); + if (isFirstSubscriber) { + batch.add(requestCopy); + } + // called for each subscriber, so need to save all listeners (next, error, complete) + if (observer.next) { + requestCopy.next.push(observer.next.bind(observer)); + } + if (observer.error) { + requestCopy.error.push(observer.error.bind(observer)); + } + if (observer.complete) { + requestCopy.complete.push(observer.complete.bind(observer)); + } + // The first enqueued request triggers the queue consumption after `batchInterval` milliseconds. + if (isFirstEnqueuedRequest || _this.batchDebounce) { + _this.scheduleQueueConsumption(key); + } + // When amount of requests reaches `batchMax`, trigger the queue consumption without waiting on the `batchInterval`. + if (batch.size === _this.batchMax) { + _this.consumeQueue(key); + } + return function () { + var _a; + // If this is last subscriber for this request, remove request from queue + if (requestCopy.subscribers.delete(observer) && + requestCopy.subscribers.size < 1) { + // If this is last request from queue, remove queue entirely + if (batch.delete(requestCopy) && batch.size < 1) { + _this.consumeQueue(key); + // If queue was in flight, cancel it + (_a = batch.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe(); + } + } + }; + }); + } + return requestCopy.observable; + }; + // Consumes the queue. + // Returns a list of promises (one for each query). + OperationBatcher.prototype.consumeQueue = function (key) { + if (key === void 0) { key = ""; } + var batch = this.batchesByKey.get(key); + // Delete this batch and process it below. + this.batchesByKey.delete(key); + if (!batch || !batch.size) { + // No requests to be processed. + return; + } + var operations = []; + var forwards = []; + var observables = []; + var nexts = []; + var errors = []; + var completes = []; + // Even though batch is a Set, it preserves the order of first insertion + // when iterating (per ECMAScript specification), so these requests will be + // handled in the order they were enqueued (minus any deleted ones). + batch.forEach(function (request) { + operations.push(request.operation); + forwards.push(request.forward); + observables.push(request.observable); + nexts.push(request.next); + errors.push(request.error); + completes.push(request.complete); + }); + var batchedObservable = this.batchHandler(operations, forwards) || Observable.of(); + var onError = function (error) { + //each callback list in batch + errors.forEach(function (rejecters) { + if (rejecters) { + //each subscriber to request + rejecters.forEach(function (e) { return e(error); }); + } + }); + }; + batch.subscription = batchedObservable.subscribe({ + next: function (results) { + if (!Array.isArray(results)) { + results = [results]; + } + if (nexts.length !== results.length) { + var error = new Error("server returned results with length ".concat(results.length, ", expected length of ").concat(nexts.length)); + error.result = results; + return onError(error); + } + results.forEach(function (result, index) { + if (nexts[index]) { + nexts[index].forEach(function (next) { return next(result); }); + } + }); + }, + error: onError, + complete: function () { + completes.forEach(function (complete) { + if (complete) { + //each subscriber to request + complete.forEach(function (c) { return c(); }); + } + }); + }, + }); + return observables; + }; + OperationBatcher.prototype.scheduleQueueConsumption = function (key) { + var _this = this; + clearTimeout(this.scheduledBatchTimerByKey.get(key)); + this.scheduledBatchTimerByKey.set(key, setTimeout(function () { + _this.consumeQueue(key); + _this.scheduledBatchTimerByKey.delete(key); + }, this.batchInterval)); + }; + return OperationBatcher; +}()); +export { OperationBatcher }; +//# sourceMappingURL=batching.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/batching.js.map b/graphql-subscription/node_modules/@apollo/client/link/batch/batching.js.map new file mode 100644 index 0000000..31ac22d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/batching.js.map @@ -0,0 +1 @@ +{"version":3,"file":"batching.js","sourceRoot":"","sources":["../../../src/link/batch/batching.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AA0BtD,qFAAqF;AACrF,2FAA2F;AAC3F,kBAAkB;AAClB;IAgBE,0BAAY,EAYX;YAXC,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,QAAQ,cAAA,EACR,YAAY,kBAAA,EACZ,QAAQ,cAAA;QApBV,oEAAoE;QAC5D,iBAAY,GAAG,IAAI,GAAG,EAAwB,CAAC;QAE/C,6BAAwB,GAAG,IAAI,GAAG,EAGvC,CAAC;QAsBF,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,cAAM,OAAA,EAAE,EAAF,CAAE,CAAC,CAAC;IACzC,CAAC;IAEM,yCAAc,GAArB,UAAsB,OAAyB;QAA/C,iBAmEC;QAlEC,IAAM,WAAW,yBACZ,OAAO,KACV,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,EAAE,EACT,QAAQ,EAAE,EAAE,EACZ,WAAW,EAAE,IAAI,GAAG,EAAE,GACvB,CAAC;QAEF,IAAM,GAAG,GAAG,I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AC,aAAa,CAAC,CACvB,CAAC;IACJ,CAAC;IACH,uBAAC;AAAD,CAAC,AAnMD,IAmMC","sourcesContent":["import type { FetchResult, NextLink, Operation } from \"../core/index.js\";\nimport type { ObservableSubscription } from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\n\nexport type BatchHandler = (\n operations: Operation[],\n forward?: (NextLink | undefined)[]\n) => Observable | null;\n\nexport interface BatchableRequest {\n operation: Operation;\n forward?: NextLink;\n}\n\ntype QueuedRequest = BatchableRequest & {\n observable?: Observable;\n next: Array<(result: FetchResult) => void>;\n error: Array<(error: Error) => void>;\n complete: Array<() => void>;\n subscribers: Set;\n};\n\n// Batches are primarily a Set, but may have other optional\n// properties, such as batch.subscription.\ntype RequestBatch = Set & {\n subscription?: ObservableSubscription;\n};\n\n// QueryBatcher doesn't fire requests immediately. Requests that were enqueued within\n// a certain amount of time (configurable through `batchInterval`) will be batched together\n// into one query.\nexport class OperationBatcher {\n // Queue on which the QueryBatcher will operate on a per-tick basis.\n private batchesByKey = new Map();\n\n private scheduledBatchTimerByKey = new Map<\n string,\n ReturnType\n >();\n private batchDebounce?: boolean;\n private batchInterval?: number;\n private batchMax: number;\n\n //This function is called to the queries in the queue to the server.\n private batchHandler: BatchHandler;\n private batchKey: (operation: Operation) => string;\n\n constructor({\n batchDebounce,\n batchInterval,\n batchMax,\n batchHandler,\n batchKey,\n }: {\n batchDebounce?: boolean;\n batchInterval?: number;\n batchMax?: number;\n batchHandler: BatchHandler;\n batchKey?: (operation: Operation) => string;\n }) {\n this.batchDebounce = batchDebounce;\n this.batchInterval = batchInterval;\n this.batchMax = batchMax || 0;\n this.batchHandler = batchHandler;\n this.batchKey = batchKey || (() => \"\");\n }\n\n public enqueueRequest(request: BatchableRequest): Observable {\n const requestCopy: QueuedRequest = {\n ...request,\n next: [],\n error: [],\n complete: [],\n subscribers: new Set(),\n };\n\n const key = this.batchKey(request.operation);\n\n if (!requestCopy.observable) {\n requestCopy.observable = new Observable((observer) => {\n let batch = this.batchesByKey.get(key)!;\n if (!batch) this.batchesByKey.set(key, (batch = new Set()));\n\n // These booleans seem to me (@benjamn) like they might always be the\n // same (and thus we could do with only one of them), but I'm not 100%\n // sure about that.\n const isFirstEnqueuedRequest = batch.size === 0;\n const isFirstSubscriber = requestCopy.subscribers.size === 0;\n requestCopy.subscribers.add(observer);\n if (isFirstSubscriber) {\n batch.add(requestCopy);\n }\n\n // called for each subscriber, so need to save all listeners (next, error, complete)\n if (observer.next) {\n requestCopy.next.push(observer.next.bind(observer));\n }\n\n if (observer.error) {\n requestCopy.error.push(observer.error.bind(observer));\n }\n\n if (observer.complete) {\n requestCopy.complete.push(observer.complete.bind(observer));\n }\n\n // The first enqueued request triggers the queue consumption after `batchInterval` milliseconds.\n if (isFirstEnqueuedRequest || this.batchDebounce) {\n this.scheduleQueueConsumption(key);\n }\n\n // When amount of requests reaches `batchMax`, trigger the queue consumption without waiting on the `batchInterval`.\n if (batch.size === this.batchMax) {\n this.consumeQueue(key);\n }\n\n return () => {\n // If this is last subscriber for this request, remove request from queue\n if (\n requestCopy.subscribers.delete(observer) &&\n requestCopy.subscribers.size < 1\n ) {\n // If this is last request from queue, remove queue entirely\n if (batch.delete(requestCopy) && batch.size < 1) {\n this.consumeQueue(key);\n // If queue was in flight, cancel it\n batch.subscription?.unsubscribe();\n }\n }\n };\n });\n }\n\n return requestCopy.observable;\n }\n\n // Consumes the queue.\n // Returns a list of promises (one for each query).\n public consumeQueue(\n key: string = \"\"\n ): (Observable | undefined)[] | undefined {\n const batch = this.batchesByKey.get(key);\n // Delete this batch and process it below.\n this.batchesByKey.delete(key);\n if (!batch || !batch.size) {\n // No requests to be processed.\n return;\n }\n\n const operations: QueuedRequest[\"operation\"][] = [];\n const forwards: QueuedRequest[\"forward\"][] = [];\n const observables: QueuedRequest[\"observable\"][] = [];\n const nexts: QueuedRequest[\"next\"][] = [];\n const errors: QueuedRequest[\"error\"][] = [];\n const completes: QueuedRequest[\"complete\"][] = [];\n\n // Even though batch is a Set, it preserves the order of first insertion\n // when iterating (per ECMAScript specification), so these requests will be\n // handled in the order they were enqueued (minus any deleted ones).\n batch.forEach((request) => {\n operations.push(request.operation);\n forwards.push(request.forward);\n observables.push(request.observable);\n nexts.push(request.next);\n errors.push(request.error);\n completes.push(request.complete);\n });\n\n const batchedObservable =\n this.batchHandler(operations, forwards) || Observable.of();\n\n const onError = (error: Error) => {\n //each callback list in batch\n errors.forEach((rejecters) => {\n if (rejecters) {\n //each subscriber to request\n rejecters.forEach((e) => e(error));\n }\n });\n };\n\n batch.subscription = batchedObservable.subscribe({\n next: (results) => {\n if (!Array.isArray(results)) {\n results = [results];\n }\n\n if (nexts.length !== results.length) {\n const error = new Error(\n `server returned results with length ${results.length}, expected length of ${nexts.length}`\n );\n (error as any).result = results;\n\n return onError(error);\n }\n\n results.forEach((result, index) => {\n if (nexts[index]) {\n nexts[index].forEach((next) => next(result));\n }\n });\n },\n error: onError,\n complete: () => {\n completes.forEach((complete) => {\n if (complete) {\n //each subscriber to request\n complete.forEach((c) => c());\n }\n });\n },\n });\n\n return observables;\n }\n\n private scheduleQueueConsumption(key: string): void {\n clearTimeout(this.scheduledBatchTimerByKey.get(key));\n this.scheduledBatchTimerByKey.set(\n key,\n setTimeout(() => {\n this.consumeQueue(key);\n this.scheduledBatchTimerByKey.delete(key);\n }, this.batchInterval)\n );\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/batch/index.d.ts new file mode 100644 index 0000000..961fde9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/index.d.ts @@ -0,0 +1,2 @@ +export * from "./batchLink.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/index.js b/graphql-subscription/node_modules/@apollo/client/link/batch/index.js new file mode 100644 index 0000000..b33c2a7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/index.js @@ -0,0 +1,2 @@ +export * from "./batchLink.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/batch/index.js.map new file mode 100644 index 0000000..d315de7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/batch/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./batchLink.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/batch/package.json b/graphql-subscription/node_modules/@apollo/client/link/batch/package.json new file mode 100644 index 0000000..8b223ff --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/batch/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/batch", + "type": "module", + "main": "batch.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs b/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs new file mode 100644 index 0000000..5447f7e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); + +function setContext(setter) { + return new core.ApolloLink(function (operation, forward) { + var request = tslib.__rest(operation, []); + return new utilities.Observable(function (observer) { + var handle; + var closed = false; + Promise.resolve(request) + .then(function (req) { return setter(req, operation.getContext()); }) + .then(operation.setContext) + .then(function () { + if (closed) + return; + handle = forward(operation).subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + }) + .catch(observer.error.bind(observer)); + return function () { + closed = true; + if (handle) + handle.unsubscribe(); + }; + }); + }); +} + +exports.setContext = setContext; +//# sourceMappingURL=context.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.map new file mode 100644 index 0000000..6acab17 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"context.cjs","sources":["index.js"],"sourcesContent":["import { __rest } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nexport function setContext(setter) {\n return new ApolloLink(function (operation, forward) {\n var request = __rest(operation, []);\n return new Observable(function (observer) {\n var handle;\n var closed = false;\n Promise.resolve(request)\n .then(function (req) { return setter(req, operation.getContext()); })\n .then(operation.setContext)\n .then(function () {\n // if the observer is already closed, no need to subscribe.\n if (closed)\n return;\n handle = forward(operation).subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n })\n .catch(observer.error.bind(observer));\n return function () {\n closed = true;\n if (handle)\n handle.unsubscribe();\n };\n });\n });\n}\n//# sourceMappingURL=index.js.map"],"names":["ApolloLink","__rest","Observable"],"mappings":";;;;;;;;AAGO,SAAS,UAAU,CAAC,MAAM,EAAE;AACnC,IAAI,OAAO,IAAIA,eAAU,CAAC,UAAU,SAAS,EAAE,OAAO,EAAE;AACxD,QAAQ,IAAI,OAAO,GAAGC,YAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC5C,QAAQ,OAAO,IAAIC,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAClD,YAAY,IAAI,MAAM,CAAC;AACvB,YAAY,IAAI,MAAM,GAAG,KAAK,CAAC;AAC/B,YAAY,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;AACpC,iBAAiB,IAAI,CAAC,UAAU,GAAG,EAAE,EAAE,OAAO,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;AACrF,iBAAiB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;AAC3C,iBAAiB,IAAI,CAAC,YAAY;AAElC,gBAAgB,IAAI,MAAM;AAC1B,oBAAoB,OAAO;AAC3B,gBAAgB,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;AACtD,oBAAoB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;AACtD,oBAAoB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;AACxD,oBAAoB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC9D,iBAAiB,CAAC,CAAC;AACnB,aAAa,CAAC;AACd,iBAAiB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,YAAY,OAAO,YAAY;AAC/B,gBAAgB,MAAM,GAAG,IAAI,CAAC;AAC9B,gBAAgB,IAAI,MAAM;AAC1B,oBAAoB,MAAM,CAAC,WAAW,EAAE,CAAC;AACzC,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK,CAAC,CAAC;AACP;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.native.js new file mode 100644 index 0000000..5447f7e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/context/context.cjs.native.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); + +function setContext(setter) { + return new core.ApolloLink(function (operation, forward) { + var request = tslib.__rest(operation, []); + return new utilities.Observable(function (observer) { + var handle; + var closed = false; + Promise.resolve(request) + .then(function (req) { return setter(req, operation.getContext()); }) + .then(operation.setContext) + .then(function () { + if (closed) + return; + handle = forward(operation).subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + }) + .catch(observer.error.bind(observer)); + return function () { + closed = true; + if (handle) + handle.unsubscribe(); + }; + }); + }); +} + +exports.setContext = setContext; +//# sourceMappingURL=context.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/context/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/context/index.d.ts new file mode 100644 index 0000000..718814e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/context/index.d.ts @@ -0,0 +1,6 @@ +import type { GraphQLRequest } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import type { DefaultContext } from "../../core/index.js"; +export type ContextSetter = (operation: GraphQLRequest, prevContext: DefaultContext) => Promise | DefaultContext; +export declare function setContext(setter: ContextSetter): ApolloLink; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/context/index.js b/graphql-subscription/node_modules/@apollo/client/link/context/index.js new file mode 100644 index 0000000..70fb99f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/context/index.js @@ -0,0 +1,32 @@ +import { __rest } from "tslib"; +import { ApolloLink } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +export function setContext(setter) { + return new ApolloLink(function (operation, forward) { + var request = __rest(operation, []); + return new Observable(function (observer) { + var handle; + var closed = false; + Promise.resolve(request) + .then(function (req) { return setter(req, operation.getContext()); }) + .then(operation.setContext) + .then(function () { + // if the observer is already closed, no need to subscribe. + if (closed) + return; + handle = forward(operation).subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + }) + .catch(observer.error.bind(observer)); + return function () { + closed = true; + if (handle) + handle.unsubscribe(); + }; + }); + }); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/context/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/context/index.js.map new file mode 100644 index 0000000..dd6fe1f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/context/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/context/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAQtD,MAAM,UAAU,UAAU,CAAC,MAAqB;IAC9C,OAAO,IAAI,UAAU,CAAC,UAAC,SAAoB,EAAE,OAAiB;QAC5D,IAAW,OAAO,UAAK,SAAS,EAA1B,EAAc,CAAY,CAAC;QAEjC,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC7B,IAAI,MAA8B,CAAC;YACnC,IAAI,MAAM,GAAG,KAAK,CAAC;YACnB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;iBACrB,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,UAAU,EAAE,CAAC,EAAnC,CAAmC,CAAC;iBAClD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;iBAC1B,IAAI,CAAC;gBACJ,2DAA2D;gBAC3D,IAAI,MAAM;oBAAE,OAAO;gBACnB,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;oBACpC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;oBAClC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;oBACpC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;iBAC3C,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAExC,OAAO;gBACL,MAAM,GAAG,IAAI,CAAC;gBACd,IAAI,MAAM;oBAAE,MAAM,CAAC,WAAW,EAAE,CAAC;YACnC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Operation, GraphQLRequest, NextLink } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type { ObservableSubscription } from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type { DefaultContext } from \"../../core/index.js\";\n\nexport type ContextSetter = (\n operation: GraphQLRequest,\n prevContext: DefaultContext\n) => Promise | DefaultContext;\n\nexport function setContext(setter: ContextSetter): ApolloLink {\n return new ApolloLink((operation: Operation, forward: NextLink) => {\n const { ...request } = operation;\n\n return new Observable((observer) => {\n let handle: ObservableSubscription;\n let closed = false;\n Promise.resolve(request)\n .then((req) => setter(req, operation.getContext()))\n .then(operation.setContext)\n .then(() => {\n // if the observer is already closed, no need to subscribe.\n if (closed) return;\n handle = forward(operation).subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n })\n .catch(observer.error.bind(observer));\n\n return () => {\n closed = true;\n if (handle) handle.unsubscribe();\n };\n });\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/context/package.json b/graphql-subscription/node_modules/@apollo/client/link/context/package.json new file mode 100644 index 0000000..91276b0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/context/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/context", + "type": "module", + "main": "context.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.d.ts new file mode 100644 index 0000000..ec54563 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.d.ts @@ -0,0 +1,32 @@ +import type { Observer } from "../../utilities/index.js"; +import { Observable } from "../../utilities/index.js"; +import type { NextLink, Operation, RequestHandler, FetchResult, GraphQLRequest } from "./types.js"; +export declare class ApolloLink { + static empty(): ApolloLink; + static from(links: (ApolloLink | RequestHandler)[]): ApolloLink; + static split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; + static execute(link: ApolloLink, operation: GraphQLRequest): Observable; + static concat(first: ApolloLink | RequestHandler, second: ApolloLink | RequestHandler): ApolloLink; + constructor(request?: RequestHandler); + split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; + concat(next: ApolloLink | RequestHandler): ApolloLink; + request(operation: Operation, forward?: NextLink): Observable | null; + protected onError(error: any, observer?: Observer): false | void; + setOnError(fn: ApolloLink["onError"]): this; + /** + * @internal + * Used to iterate through all links that are concatenations or `split` links. + */ + readonly left?: ApolloLink; + /** + * @internal + * Used to iterate through all links that are concatenations or `split` links. + */ + readonly right?: ApolloLink; + /** + * @internal + * Can be provided by a link that has an internal cache to report it's memory details. + */ + getMemoryInternals?: () => unknown; +} +//# sourceMappingURL=ApolloLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js b/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js new file mode 100644 index 0000000..943fa62 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js @@ -0,0 +1,101 @@ +import { newInvariantError, invariant } from "../../utilities/globals/index.js"; +import { Observable } from "../../utilities/index.js"; +import { validateOperation, createOperation, transformOperation, } from "../utils/index.js"; +function passthrough(op, forward) { + return (forward ? forward(op) : Observable.of()); +} +function toLink(handler) { + return typeof handler === "function" ? new ApolloLink(handler) : handler; +} +function isTerminating(link) { + return link.request.length <= 1; +} +var ApolloLink = /** @class */ (function () { + function ApolloLink(request) { + if (request) + this.request = request; + } + ApolloLink.empty = function () { + return new ApolloLink(function () { return Observable.of(); }); + }; + ApolloLink.from = function (links) { + if (links.length === 0) + return ApolloLink.empty(); + return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); + }; + ApolloLink.split = function (test, left, right) { + var leftLink = toLink(left); + var rightLink = toLink(right || new ApolloLink(passthrough)); + var ret; + if (isTerminating(leftLink) && isTerminating(rightLink)) { + ret = new ApolloLink(function (operation) { + return test(operation) ? + leftLink.request(operation) || Observable.of() + : rightLink.request(operation) || Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return test(operation) ? + leftLink.request(operation, forward) || Observable.of() + : rightLink.request(operation, forward) || Observable.of(); + }); + } + return Object.assign(ret, { left: leftLink, right: rightLink }); + }; + ApolloLink.execute = function (link, operation) { + return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of()); + }; + ApolloLink.concat = function (first, second) { + var firstLink = toLink(first); + if (isTerminating(firstLink)) { + globalThis.__DEV__ !== false && invariant.warn(35, firstLink); + return firstLink; + } + var nextLink = toLink(second); + var ret; + if (isTerminating(nextLink)) { + ret = new ApolloLink(function (operation) { + return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return (firstLink.request(operation, function (op) { + return nextLink.request(op, forward) || Observable.of(); + }) || Observable.of()); + }); + } + return Object.assign(ret, { left: firstLink, right: nextLink }); + }; + ApolloLink.prototype.split = function (test, left, right) { + return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough))); + }; + ApolloLink.prototype.concat = function (next) { + return ApolloLink.concat(this, next); + }; + ApolloLink.prototype.request = function (operation, forward) { + throw newInvariantError(36); + }; + ApolloLink.prototype.onError = function (error, observer) { + if (observer && observer.error) { + observer.error(error); + // Returning false indicates that observer.error does not need to be + // called again, since it was already called (on the previous line). + // Calling observer.error again would not cause any real problems, + // since only the first call matters, but custom onError functions + // might have other reasons for wanting to prevent the default + // behavior by returning false. + return false; + } + // Throw errors will be passed to observer.error. + throw error; + }; + ApolloLink.prototype.setOnError = function (fn) { + this.onError = fn; + return this; + }; + return ApolloLink; +}()); +export { ApolloLink }; +//# sourceMappingURL=ApolloLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js.map new file mode 100644 index 0000000..c60d867 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/ApolloLink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ApolloLink.js","sourceRoot":"","sources":["../../../src/link/core/ApolloLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAGhF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAQtD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,SAAS,WAAW,CAAC,EAAa,EAAE,OAAiB;IACnD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAA4B,CAAC;AAC9E,CAAC;AAED,SAAS,MAAM,CAAC,OAAoC;IAClD,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3E,CAAC;AAED,SAAS,aAAa,CAAC,IAAgB;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AAClC,CAAC;AAED;IAoFE,oBAAY,OAAwB;QAClC,IAAI,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACtC,CAAC;IArFa,gBAAK,GAAnB;QACE,OAAO,IAAI,UAAU,CAAC,cAAM,OAAA,UAAU,CAAC,EAAE,EAAE,EAAf,CAAe,CAAC,CAAC;IAC/C,CAAC;IAEa,eAAI,GAAlB,UAAm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E,CAAC;gBAC1D,CAAC,CAAC,IAAI,UAAU,CAAC,EAAE,EAAE,CACtB,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IAMM,0BAAK,GAAZ,UACE,IAAgC,EAChC,IAAiC,EACjC,KAAmC;QAEnC,OAAO,IAAI,CAAC,MAAM,CAChB,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CACnE,CAAC;IACJ,CAAC;IAEM,2BAAM,GAAb,UAAc,IAAiC;QAC7C,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAEM,4BAAO,GAAd,UACE,SAAoB,EACpB,OAAkB;QAElB,MAAM,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;IACxD,CAAC;IAES,4BAAO,GAAjB,UACE,KAAU,EACV,QAAgC;QAEhC,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YAC/B,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACtB,oEAAoE;YACpE,oEAAoE;YACpE,kEAAkE;YAClE,kEAAkE;YAClE,8DAA8D;YAC9D,+BAA+B;YAC/B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,iDAAiD;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;IAEM,+BAAU,GAAjB,UAAkB,EAAyB;QACzC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAkBH,iBAAC;AAAD,CAAC,AApJD,IAoJC","sourcesContent":["import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\n\nimport type { Observer } from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type {\n NextLink,\n Operation,\n RequestHandler,\n FetchResult,\n GraphQLRequest,\n} from \"./types.js\";\nimport {\n validateOperation,\n createOperation,\n transformOperation,\n} from \"../utils/index.js\";\n\nfunction passthrough(op: Operation, forward: NextLink) {\n return (forward ? forward(op) : Observable.of()) as Observable;\n}\n\nfunction toLink(handler: RequestHandler | ApolloLink) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\n\nfunction isTerminating(link: ApolloLink): boolean {\n return link.request.length <= 1;\n}\n\nexport class ApolloLink {\n public static empty(): ApolloLink {\n return new ApolloLink(() => Observable.of());\n }\n\n public static from(links: (ApolloLink | RequestHandler)[]): ApolloLink {\n if (links.length === 0) return ApolloLink.empty();\n return links.map(toLink).reduce((x, y) => x.concat(y)) as ApolloLink;\n }\n\n public static split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n const leftLink = toLink(left);\n const rightLink = toLink(right || new ApolloLink(passthrough));\n\n let ret: ApolloLink;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink((operation) => {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n } else {\n ret = new ApolloLink((operation, forward) => {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n }\n\n public static execute(\n link: ApolloLink,\n operation: GraphQLRequest\n ): Observable {\n return (\n link.request(\n createOperation(\n operation.context,\n transformOperation(validateOperation(operation))\n )\n ) || Observable.of()\n );\n }\n\n public static concat(\n first: ApolloLink | RequestHandler,\n second: ApolloLink | RequestHandler\n ) {\n const firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n invariant.warn(\n `You are calling concat on a terminating link, which will have no effect %o`,\n firstLink\n );\n return firstLink;\n }\n const nextLink = toLink(second);\n\n let ret: ApolloLink;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(\n (operation) =>\n firstLink.request(\n operation,\n (op) => nextLink.request(op) || Observable.of()\n ) || Observable.of()\n );\n } else {\n ret = new ApolloLink((operation, forward) => {\n return (\n firstLink.request(operation, (op) => {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of()\n );\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n }\n\n constructor(request?: RequestHandler) {\n if (request) this.request = request;\n }\n\n public split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n return this.concat(\n ApolloLink.split(test, left, right || new ApolloLink(passthrough))\n );\n }\n\n public concat(next: ApolloLink | RequestHandler): ApolloLink {\n return ApolloLink.concat(this, next);\n }\n\n public request(\n operation: Operation,\n forward?: NextLink\n ): Observable | null {\n throw newInvariantError(\"request is not implemented\");\n }\n\n protected onError(\n error: any,\n observer?: Observer\n ): false | void {\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n }\n\n public setOnError(fn: ApolloLink[\"onError\"]): this {\n this.onError = fn;\n return this;\n }\n\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly left?: ApolloLink;\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly right?: ApolloLink;\n\n /**\n * @internal\n * Can be provided by a link that has an internal cache to report it's memory details.\n */\n getMemoryInternals?: () => unknown;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/concat.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/concat.d.ts new file mode 100644 index 0000000..f0da743 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/concat.d.ts @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export declare const concat: typeof ApolloLink.concat; +//# sourceMappingURL=concat.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/concat.js b/graphql-subscription/node_modules/@apollo/client/link/core/concat.js new file mode 100644 index 0000000..62e89fc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/concat.js @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export var concat = ApolloLink.concat; +//# sourceMappingURL=concat.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/concat.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/concat.js.map new file mode 100644 index 0000000..56b0a7b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/concat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/link/core/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,IAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const concat = ApolloLink.concat;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs b/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs new file mode 100644 index 0000000..ff62a38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs @@ -0,0 +1,115 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +var utils = require('../utils'); + +function passthrough(op, forward) { + return (forward ? forward(op) : utilities.Observable.of()); +} +function toLink(handler) { + return typeof handler === "function" ? new ApolloLink(handler) : handler; +} +function isTerminating(link) { + return link.request.length <= 1; +} +var ApolloLink = (function () { + function ApolloLink(request) { + if (request) + this.request = request; + } + ApolloLink.empty = function () { + return new ApolloLink(function () { return utilities.Observable.of(); }); + }; + ApolloLink.from = function (links) { + if (links.length === 0) + return ApolloLink.empty(); + return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); + }; + ApolloLink.split = function (test, left, right) { + var leftLink = toLink(left); + var rightLink = toLink(right || new ApolloLink(passthrough)); + var ret; + if (isTerminating(leftLink) && isTerminating(rightLink)) { + ret = new ApolloLink(function (operation) { + return test(operation) ? + leftLink.request(operation) || utilities.Observable.of() + : rightLink.request(operation) || utilities.Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return test(operation) ? + leftLink.request(operation, forward) || utilities.Observable.of() + : rightLink.request(operation, forward) || utilities.Observable.of(); + }); + } + return Object.assign(ret, { left: leftLink, right: rightLink }); + }; + ApolloLink.execute = function (link, operation) { + return (link.request(utils.createOperation(operation.context, utils.transformOperation(utils.validateOperation(operation)))) || utilities.Observable.of()); + }; + ApolloLink.concat = function (first, second) { + var firstLink = toLink(first); + if (isTerminating(firstLink)) { + globalThis.__DEV__ !== false && globals.invariant.warn(35, firstLink); + return firstLink; + } + var nextLink = toLink(second); + var ret; + if (isTerminating(nextLink)) { + ret = new ApolloLink(function (operation) { + return firstLink.request(operation, function (op) { return nextLink.request(op) || utilities.Observable.of(); }) || utilities.Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return (firstLink.request(operation, function (op) { + return nextLink.request(op, forward) || utilities.Observable.of(); + }) || utilities.Observable.of()); + }); + } + return Object.assign(ret, { left: firstLink, right: nextLink }); + }; + ApolloLink.prototype.split = function (test, left, right) { + return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough))); + }; + ApolloLink.prototype.concat = function (next) { + return ApolloLink.concat(this, next); + }; + ApolloLink.prototype.request = function (operation, forward) { + throw globals.newInvariantError(36); + }; + ApolloLink.prototype.onError = function (error, observer) { + if (observer && observer.error) { + observer.error(error); + return false; + } + throw error; + }; + ApolloLink.prototype.setOnError = function (fn) { + this.onError = fn; + return this; + }; + return ApolloLink; +}()); + +var empty = ApolloLink.empty; + +var from = ApolloLink.from; + +var split = ApolloLink.split; + +var concat = ApolloLink.concat; + +var execute = ApolloLink.execute; + +exports.ApolloLink = ApolloLink; +exports.concat = concat; +exports.empty = empty; +exports.execute = execute; +exports.from = from; +exports.split = split; +//# sourceMappingURL=core.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.map new file mode 100644 index 0000000..7512427 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"core.cjs","sources":["ApolloLink.js","empty.js","from.js","split.js","concat.js","execute.js"],"sourcesContent":["import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { validateOperation, createOperation, transformOperation, } from \"../utils/index.js\";\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar ApolloLink = /** @class */ (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n var ret;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink(function (operation) {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n globalThis.__DEV__ !== false && invariant.warn(35, firstLink);\n return firstLink;\n }\n var nextLink = toLink(second);\n var ret;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw newInvariantError(36);\n };\n ApolloLink.prototype.onError = function (error, observer) {\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n };\n ApolloLink.prototype.setOnError = function (fn) {\n this.onError = fn;\n return this;\n };\n return ApolloLink;\n}());\nexport { ApolloLink };\n//# sourceMappingURL=ApolloLink.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var empty = ApolloLink.empty;\n//# sourceMappingURL=empty.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var from = ApolloLink.from;\n//# sourceMappingURL=from.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var split = ApolloLink.split;\n//# sourceMappingURL=split.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var concat = ApolloLink.concat;\n//# sourceMappingURL=concat.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var execute = ApolloLink.execute;\n//# sourceMappingURL=execute.js.map"],"names":["Observable","createOperation","transformOperation","validateOperation","invariant","newInvariantError"],"mappings":";;;;;;;;AAGA,SAAS,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE;AAClC,IAAI,QAAQ,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,GAAGA,oBAAU,CAAC,EAAE,EAAE,EAAE;AACrD,CAAC;AACD,SAAS,MAAM,CAAC,OAAO,EAAE;AACzB,IAAI,OAAO,OAAO,OAAO,KAAK,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAC7E,CAAC;AACD,SAAS,aAAa,CAAC,IAAI,EAAE;AAC7B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AACpC,CAAC;AACE,IAAC,UAAU,KAAkB,YAAY;AAC5C,IAAI,SAAS,UAAU,CAAC,OAAO,EAAE;AACjC,QAAQ,IAAI,OAAO;AACnB,YAAY,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACnC,KAAK;AACL,IAAI,UAAU,CAAC,KAAK,GAAG,YAAY;AACnC,QAAQ,OAAO,IAAI,UAAU,CAAC,YAAY,EAAE,OAAOA,oBAAU,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AACvE,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,IAAI,GAAG,UAAU,KAAK,EAAE;AACvC,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,YAAY,OAAO,UAAU,CAAC,KAAK,EAAE,CAAC;AACtC,QAAQ,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EA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E,CAAC;AAC1B,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,EAAE;;ACjGO,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,IAAI,GAAG,UAAU,CAAC;;ACAnB,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,MAAM,GAAG,UAAU,CAAC;;ACArB,IAAC,OAAO,GAAG,UAAU,CAAC;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.native.js new file mode 100644 index 0000000..ff62a38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/core.cjs.native.js @@ -0,0 +1,115 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +var utils = require('../utils'); + +function passthrough(op, forward) { + return (forward ? forward(op) : utilities.Observable.of()); +} +function toLink(handler) { + return typeof handler === "function" ? new ApolloLink(handler) : handler; +} +function isTerminating(link) { + return link.request.length <= 1; +} +var ApolloLink = (function () { + function ApolloLink(request) { + if (request) + this.request = request; + } + ApolloLink.empty = function () { + return new ApolloLink(function () { return utilities.Observable.of(); }); + }; + ApolloLink.from = function (links) { + if (links.length === 0) + return ApolloLink.empty(); + return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); + }; + ApolloLink.split = function (test, left, right) { + var leftLink = toLink(left); + var rightLink = toLink(right || new ApolloLink(passthrough)); + var ret; + if (isTerminating(leftLink) && isTerminating(rightLink)) { + ret = new ApolloLink(function (operation) { + return test(operation) ? + leftLink.request(operation) || utilities.Observable.of() + : rightLink.request(operation) || utilities.Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return test(operation) ? + leftLink.request(operation, forward) || utilities.Observable.of() + : rightLink.request(operation, forward) || utilities.Observable.of(); + }); + } + return Object.assign(ret, { left: leftLink, right: rightLink }); + }; + ApolloLink.execute = function (link, operation) { + return (link.request(utils.createOperation(operation.context, utils.transformOperation(utils.validateOperation(operation)))) || utilities.Observable.of()); + }; + ApolloLink.concat = function (first, second) { + var firstLink = toLink(first); + if (isTerminating(firstLink)) { + globalThis.__DEV__ !== false && globals.invariant.warn(35, firstLink); + return firstLink; + } + var nextLink = toLink(second); + var ret; + if (isTerminating(nextLink)) { + ret = new ApolloLink(function (operation) { + return firstLink.request(operation, function (op) { return nextLink.request(op) || utilities.Observable.of(); }) || utilities.Observable.of(); + }); + } + else { + ret = new ApolloLink(function (operation, forward) { + return (firstLink.request(operation, function (op) { + return nextLink.request(op, forward) || utilities.Observable.of(); + }) || utilities.Observable.of()); + }); + } + return Object.assign(ret, { left: firstLink, right: nextLink }); + }; + ApolloLink.prototype.split = function (test, left, right) { + return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough))); + }; + ApolloLink.prototype.concat = function (next) { + return ApolloLink.concat(this, next); + }; + ApolloLink.prototype.request = function (operation, forward) { + throw globals.newInvariantError(36); + }; + ApolloLink.prototype.onError = function (error, observer) { + if (observer && observer.error) { + observer.error(error); + return false; + } + throw error; + }; + ApolloLink.prototype.setOnError = function (fn) { + this.onError = fn; + return this; + }; + return ApolloLink; +}()); + +var empty = ApolloLink.empty; + +var from = ApolloLink.from; + +var split = ApolloLink.split; + +var concat = ApolloLink.concat; + +var execute = ApolloLink.execute; + +exports.ApolloLink = ApolloLink; +exports.concat = concat; +exports.empty = empty; +exports.execute = execute; +exports.from = from; +exports.split = split; +//# sourceMappingURL=core.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/empty.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/empty.d.ts new file mode 100644 index 0000000..33316ab --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/empty.d.ts @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export declare const empty: typeof ApolloLink.empty; +//# sourceMappingURL=empty.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/empty.js b/graphql-subscription/node_modules/@apollo/client/link/core/empty.js new file mode 100644 index 0000000..7311357 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/empty.js @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export var empty = ApolloLink.empty; +//# sourceMappingURL=empty.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/empty.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/empty.js.map new file mode 100644 index 0000000..e42e0ce --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/empty.js.map @@ -0,0 +1 @@ +{"version":3,"file":"empty.js","sourceRoot":"","sources":["../../../src/link/core/empty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,IAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const empty = ApolloLink.empty;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/execute.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/execute.d.ts new file mode 100644 index 0000000..843e927 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/execute.d.ts @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export declare const execute: typeof ApolloLink.execute; +//# sourceMappingURL=execute.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/execute.js b/graphql-subscription/node_modules/@apollo/client/link/core/execute.js new file mode 100644 index 0000000..ec46f49 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/execute.js @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export var execute = ApolloLink.execute; +//# sourceMappingURL=execute.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/execute.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/execute.js.map new file mode 100644 index 0000000..cebcc3d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/execute.js.map @@ -0,0 +1 @@ +{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/link/core/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,IAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const execute = ApolloLink.execute;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/from.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/from.d.ts new file mode 100644 index 0000000..351388b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/from.d.ts @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export declare const from: typeof ApolloLink.from; +//# sourceMappingURL=from.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/from.js b/graphql-subscription/node_modules/@apollo/client/link/core/from.js new file mode 100644 index 0000000..6e659a1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/from.js @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export var from = ApolloLink.from; +//# sourceMappingURL=from.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/from.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/from.js.map new file mode 100644 index 0000000..d8efaa0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/from.js.map @@ -0,0 +1 @@ +{"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/link/core/from.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,IAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const from = ApolloLink.from;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/index.d.ts new file mode 100644 index 0000000..5265f34 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/index.d.ts @@ -0,0 +1,9 @@ +import "../../utilities/globals/index.js"; +export { empty } from "./empty.js"; +export { from } from "./from.js"; +export { split } from "./split.js"; +export { concat } from "./concat.js"; +export { execute } from "./execute.js"; +export { ApolloLink } from "./ApolloLink.js"; +export * from "./types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/index.js b/graphql-subscription/node_modules/@apollo/client/link/core/index.js new file mode 100644 index 0000000..0e47431 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/index.js @@ -0,0 +1,9 @@ +import "../../utilities/globals/index.js"; +export { empty } from "./empty.js"; +export { from } from "./from.js"; +export { split } from "./split.js"; +export { concat } from "./concat.js"; +export { execute } from "./execute.js"; +export { ApolloLink } from "./ApolloLink.js"; +export * from "./types.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/index.js.map new file mode 100644 index 0000000..8b475e3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,cAAc,YAAY,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport { empty } from \"./empty.js\";\nexport { from } from \"./from.js\";\nexport { split } from \"./split.js\";\nexport { concat } from \"./concat.js\";\nexport { execute } from \"./execute.js\";\nexport { ApolloLink } from \"./ApolloLink.js\";\n\nexport * from \"./types.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/package.json b/graphql-subscription/node_modules/@apollo/client/link/core/package.json new file mode 100644 index 0000000..d75b99b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/core", + "type": "module", + "main": "core.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/split.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/split.d.ts new file mode 100644 index 0000000..61f2951 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/split.d.ts @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export declare const split: typeof ApolloLink.split; +//# sourceMappingURL=split.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/split.js b/graphql-subscription/node_modules/@apollo/client/link/core/split.js new file mode 100644 index 0000000..2247788 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/split.js @@ -0,0 +1,3 @@ +import { ApolloLink } from "./ApolloLink.js"; +export var split = ApolloLink.split; +//# sourceMappingURL=split.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/split.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/split.js.map new file mode 100644 index 0000000..2252a76 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/split.js.map @@ -0,0 +1 @@ +{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/link/core/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,IAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC","sourcesContent":["import { ApolloLink } from \"./ApolloLink.js\";\n\nexport const split = ApolloLink.split;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/types.d.ts b/graphql-subscription/node_modules/@apollo/client/link/core/types.d.ts new file mode 100644 index 0000000..602c79d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/types.d.ts @@ -0,0 +1,56 @@ +import type { ExecutionResult, GraphQLError } from "graphql"; +import type { DocumentNode } from "graphql"; +import type { DefaultContext } from "../../core/index.js"; +export type { DocumentNode }; +import type { Observable } from "../../utilities/index.js"; +export type Path = ReadonlyArray; +interface ExecutionPatchResultBase { + hasNext?: boolean; +} +export interface ExecutionPatchInitialResult, TExtensions = Record> extends ExecutionPatchResultBase { + data: TData | null | undefined; + incremental?: never; + errors?: ReadonlyArray; + extensions?: TExtensions; +} +export interface IncrementalPayload { + data: TData | null; + label?: string; + path: Path; + errors?: ReadonlyArray; + extensions?: TExtensions; +} +export interface ExecutionPatchIncrementalResult, TExtensions = Record> extends ExecutionPatchResultBase { + incremental?: IncrementalPayload[]; + data?: never; + errors?: never; + extensions?: never; +} +export interface ApolloPayloadResult, TExtensions = Record> { + payload: SingleExecutionResult | ExecutionPatchResult | null; + errors?: ReadonlyArray; +} +export type ExecutionPatchResult, TExtensions = Record> = ExecutionPatchInitialResult | ExecutionPatchIncrementalResult; +export interface GraphQLRequest> { + query: DocumentNode; + variables?: TVariables; + operationName?: string; + context?: DefaultContext; + extensions?: Record; +} +export interface Operation { + query: DocumentNode; + variables: Record; + operationName: string; + extensions: Record; + setContext: (context: DefaultContext) => DefaultContext; + getContext: () => DefaultContext; +} +export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> extends ExecutionResult { + data?: TData | null; + context?: TContext; +} +export type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +export type NextLink = (operation: Operation) => Observable; +export type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/types.js b/graphql-subscription/node_modules/@apollo/client/link/core/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/core/types.js.map b/graphql-subscription/node_modules/@apollo/client/link/core/types.js.map new file mode 100644 index 0000000..0588d20 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/core/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/link/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ExecutionResult, GraphQLError } from \"graphql\";\nimport type { DocumentNode } from \"graphql\";\nimport type { DefaultContext } from \"../../core/index.js\";\nexport type { DocumentNode };\n\nimport type { Observable } from \"../../utilities/index.js\";\n\nexport type Path = ReadonlyArray;\n\ninterface ExecutionPatchResultBase {\n hasNext?: boolean;\n}\n\nexport interface ExecutionPatchInitialResult<\n TData = Record,\n TExtensions = Record,\n> extends ExecutionPatchResultBase {\n // if data is present, incremental is not\n data: TData | null | undefined;\n incremental?: never;\n errors?: ReadonlyArray;\n extensions?: TExtensions;\n}\n\nexport interface IncrementalPayload {\n // data and path must both be present\n // https://github.com/graphql/graphql-spec/pull/742/files#diff-98d0cd153b72b63c417ad4238e8cc0d3385691ccbde7f7674bc0d2a718b896ecR288-R293\n data: TData | null;\n label?: string;\n path: Path;\n errors?: ReadonlyArray;\n extensions?: TExtensions;\n}\n\nexport interface ExecutionPatchIncrementalResult<\n TData = Record,\n TExtensions = Record,\n> extends ExecutionPatchResultBase {\n // the reverse is also true: if incremental is present,\n // data (and errors and extensions) are not\n incremental?: IncrementalPayload[];\n data?: never;\n // Errors only exist for chunks, not at the top level\n // https://github.com/robrichard/defer-stream-wg/discussions/50#discussioncomment-3466739\n errors?: never;\n extensions?: never;\n}\n\nexport interface ApolloPayloadResult<\n TData = Record,\n TExtensions = Record,\n> {\n payload: SingleExecutionResult | ExecutionPatchResult | null;\n // Transport layer errors (as distinct from GraphQL or NetworkErrors),\n // these are fatal errors that will include done: true.\n errors?: ReadonlyArray;\n}\n\nexport type ExecutionPatchResult<\n TData = Record,\n TExtensions = Record,\n> =\n | ExecutionPatchInitialResult\n | ExecutionPatchIncrementalResult;\n\nexport interface GraphQLRequest> {\n query: DocumentNode;\n variables?: TVariables;\n operationName?: string;\n context?: DefaultContext;\n extensions?: Record;\n}\n\nexport interface Operation {\n query: DocumentNode;\n variables: Record;\n operationName: string;\n extensions: Record;\n setContext: (context: DefaultContext) => DefaultContext;\n getContext: () => DefaultContext;\n}\n\nexport interface SingleExecutionResult<\n TData = Record,\n TContext = DefaultContext,\n TExtensions = Record,\n> extends ExecutionResult {\n // data might be undefined if errorPolicy was set to 'ignore'\n data?: TData | null;\n context?: TContext;\n}\n\nexport type FetchResult<\n TData = Record,\n TContext = Record,\n TExtensions = Record,\n> =\n | SingleExecutionResult\n | ExecutionPatchResult;\n\nexport type NextLink = (operation: Operation) => Observable;\n\nexport type RequestHandler = (\n operation: Operation,\n forward: NextLink\n) => Observable | null;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs b/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs new file mode 100644 index 0000000..a89b081 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs @@ -0,0 +1,90 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var core = require('../core'); + +function onError(errorHandler) { + return new core.ApolloLink(function (operation, forward) { + return new utilities.Observable(function (observer) { + var sub; + var retriedSub; + var retriedResult; + try { + sub = forward(operation).subscribe({ + next: function (result) { + if (result.errors) { + retriedResult = errorHandler({ + graphQLErrors: result.errors, + response: result, + operation: operation, + forward: forward, + }); + if (retriedResult) { + retriedSub = retriedResult.subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + return; + } + } + observer.next(result); + }, + error: function (networkError) { + retriedResult = errorHandler({ + operation: operation, + networkError: networkError, + graphQLErrors: networkError && + networkError.result && + networkError.result.errors, + forward: forward, + }); + if (retriedResult) { + retriedSub = retriedResult.subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + return; + } + observer.error(networkError); + }, + complete: function () { + if (!retriedResult) { + observer.complete.bind(observer)(); + } + }, + }); + } + catch (e) { + errorHandler({ networkError: e, operation: operation, forward: forward }); + observer.error(e); + } + return function () { + if (sub) + sub.unsubscribe(); + if (retriedSub) + sub.unsubscribe(); + }; + }); + }); +} +var ErrorLink = (function (_super) { + tslib.__extends(ErrorLink, _super); + function ErrorLink(errorHandler) { + var _this = _super.call(this) || this; + _this.link = onError(errorHandler); + return _this; + } + ErrorLink.prototype.request = function (operation, forward) { + return this.link.request(operation, forward); + }; + return ErrorLink; +}(core.ApolloLink)); + +exports.ErrorLink = ErrorLink; +exports.onError = onError; +//# sourceMappingURL=error.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.map new file mode 100644 index 0000000..dbd535e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"error.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nexport function onError(errorHandler) {\n return new ApolloLink(function (operation, forward) {\n return new Observable(function (observer) {\n var sub;\n var retriedSub;\n var retriedResult;\n try {\n sub = forward(operation).subscribe({\n next: function (result) {\n if (result.errors) {\n retriedResult = errorHandler({\n graphQLErrors: result.errors,\n response: result,\n operation: operation,\n forward: forward,\n });\n if (retriedResult) {\n retriedSub = retriedResult.subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n return;\n }\n }\n observer.next(result);\n },\n error: function (networkError) {\n retriedResult = errorHandler({\n operation: operation,\n networkError: networkError,\n //Network errors can return GraphQL errors on for example a 403\n graphQLErrors: networkError &&\n networkError.result &&\n networkError.result.errors,\n forward: forward,\n });\n if (retriedResult) {\n retriedSub = retriedResult.subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n return;\n }\n observer.error(networkError);\n },\n complete: function () {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete.bind(observer)();\n }\n },\n });\n }\n catch (e) {\n errorHandler({ networkError: e, operation: operation, forward: forward });\n observer.error(e);\n }\n return function () {\n if (sub)\n sub.unsubscribe();\n if (retriedSub)\n sub.unsubscribe();\n };\n });\n });\n}\nvar ErrorLink = /** @class */ (function (_super) {\n __extends(ErrorLink, _super);\n function ErrorLink(errorHandler) {\n var _this = _super.call(this) || this;\n _this.link = onError(errorHandler);\n return _this;\n }\n ErrorLink.prototype.request = function (operation, forward) {\n return this.link.request(operation, forward);\n };\n return ErrorLink;\n}(ApolloLink));\nexport { ErrorLink };\n//# sourceMappingURL=index.js.map"],"names":["ApolloLink","Observable","__extends"],"mappings":";;;;;;;;AAGO,SAAS,OAAO,CAAC,YAAY,EAAE;AACtC,IAAI,OAAO,IAAIA,eAAU,CAAC,UAAU,SAAS,EAAE,OAAO,EAAE;AACxD,QAAQ,OAAO,IAAIC,oBAAU,CAAC,UAAU,QAAQ,EAAE;A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,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACjC,IAAI,SAAS,SAAS,CAAC,YAAY,EAAE;AACrC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAC3C,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE,OAAO,EAAE;AAChE,QAAQ,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACrD,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAACF,eAAU,CAAC;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.native.js new file mode 100644 index 0000000..a89b081 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/error/error.cjs.native.js @@ -0,0 +1,90 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var core = require('../core'); + +function onError(errorHandler) { + return new core.ApolloLink(function (operation, forward) { + return new utilities.Observable(function (observer) { + var sub; + var retriedSub; + var retriedResult; + try { + sub = forward(operation).subscribe({ + next: function (result) { + if (result.errors) { + retriedResult = errorHandler({ + graphQLErrors: result.errors, + response: result, + operation: operation, + forward: forward, + }); + if (retriedResult) { + retriedSub = retriedResult.subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + return; + } + } + observer.next(result); + }, + error: function (networkError) { + retriedResult = errorHandler({ + operation: operation, + networkError: networkError, + graphQLErrors: networkError && + networkError.result && + networkError.result.errors, + forward: forward, + }); + if (retriedResult) { + retriedSub = retriedResult.subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + return; + } + observer.error(networkError); + }, + complete: function () { + if (!retriedResult) { + observer.complete.bind(observer)(); + } + }, + }); + } + catch (e) { + errorHandler({ networkError: e, operation: operation, forward: forward }); + observer.error(e); + } + return function () { + if (sub) + sub.unsubscribe(); + if (retriedSub) + sub.unsubscribe(); + }; + }); + }); +} +var ErrorLink = (function (_super) { + tslib.__extends(ErrorLink, _super); + function ErrorLink(errorHandler) { + var _this = _super.call(this) || this; + _this.link = onError(errorHandler); + return _this; + } + ErrorLink.prototype.request = function (operation, forward) { + return this.link.request(operation, forward); + }; + return ErrorLink; +}(core.ApolloLink)); + +exports.ErrorLink = ErrorLink; +exports.onError = onError; +//# sourceMappingURL=error.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/error/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/error/index.d.ts new file mode 100644 index 0000000..fa0db8e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/error/index.d.ts @@ -0,0 +1,28 @@ +import type { ExecutionResult } from "graphql"; +import type { NetworkError, GraphQLErrors } from "../../errors/index.js"; +import { Observable } from "../../utilities/index.js"; +import type { Operation, FetchResult, NextLink } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +export interface ErrorResponse { + graphQLErrors?: GraphQLErrors; + networkError?: NetworkError; + response?: ExecutionResult; + operation: Operation; + forward: NextLink; +} +export declare namespace ErrorLink { + /** + * Callback to be triggered when an error occurs within the link stack. + */ + interface ErrorHandler { + (error: ErrorResponse): Observable | void; + } +} +export import ErrorHandler = ErrorLink.ErrorHandler; +export declare function onError(errorHandler: ErrorHandler): ApolloLink; +export declare class ErrorLink extends ApolloLink { + private link; + constructor(errorHandler: ErrorLink.ErrorHandler); + request(operation: Operation, forward: NextLink): Observable | null; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/error/index.js b/graphql-subscription/node_modules/@apollo/client/link/error/index.js new file mode 100644 index 0000000..39c664a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/error/index.js @@ -0,0 +1,86 @@ +import { __extends } from "tslib"; +import { Observable } from "../../utilities/index.js"; +import { ApolloLink } from "../core/index.js"; +export function onError(errorHandler) { + return new ApolloLink(function (operation, forward) { + return new Observable(function (observer) { + var sub; + var retriedSub; + var retriedResult; + try { + sub = forward(operation).subscribe({ + next: function (result) { + if (result.errors) { + retriedResult = errorHandler({ + graphQLErrors: result.errors, + response: result, + operation: operation, + forward: forward, + }); + if (retriedResult) { + retriedSub = retriedResult.subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + return; + } + } + observer.next(result); + }, + error: function (networkError) { + retriedResult = errorHandler({ + operation: operation, + networkError: networkError, + //Network errors can return GraphQL errors on for example a 403 + graphQLErrors: networkError && + networkError.result && + networkError.result.errors, + forward: forward, + }); + if (retriedResult) { + retriedSub = retriedResult.subscribe({ + next: observer.next.bind(observer), + error: observer.error.bind(observer), + complete: observer.complete.bind(observer), + }); + return; + } + observer.error(networkError); + }, + complete: function () { + // disable the previous sub from calling complete on observable + // if retry is in flight. + if (!retriedResult) { + observer.complete.bind(observer)(); + } + }, + }); + } + catch (e) { + errorHandler({ networkError: e, operation: operation, forward: forward }); + observer.error(e); + } + return function () { + if (sub) + sub.unsubscribe(); + if (retriedSub) + sub.unsubscribe(); + }; + }); + }); +} +var ErrorLink = /** @class */ (function (_super) { + __extends(ErrorLink, _super); + function ErrorLink(errorHandler) { + var _this = _super.call(this) || this; + _this.link = onError(errorHandler); + return _this; + } + ErrorLink.prototype.request = function (operation, forward) { + return this.link.request(operation, forward); + }; + return ErrorLink; +}(ApolloLink)); +export { ErrorLink }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/error/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/error/index.js.map new file mode 100644 index 0000000..74bcf58 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/error/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/error/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAsB9C,MAAM,UAAU,OAAO,CAAC,YAA0B;IAChD,OAAO,IAAI,UAAU,CAAC,UAAC,SAAS,EAAE,OAAO;QACvC,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC7B,IAAI,GAAQ,CAAC;YACb,IAAI,UAAe,CAAC;YACpB,IAAI,aAAkB,CAAC;YAEvB,IAAI,CAAC;gBACH,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;oBACjC,IAAI,EAAE,UAAC,MAAM;wBACX,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;4BAClB,aAAa,GAAG,YAAY,CAAC;gCAC3B,aAAa,EAAE,MAAM,CAAC,MAAM;gCAC5B,QAAQ,EAAE,MAAM;gCAChB,SAAS,WAAA;gCACT,OAAO,SAAA;6BACR,CAAC,CAAC;4BAEH,IAAI,aAAa,EAAE,CAAC;gCAClB,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;oCACnC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;oCAClC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;oCACpC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;iCAC3C,CAAC,CAAC;gCACH,OAAO;4BACT,CAAC;wBACH,CAAC;wBACD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACxB,CAAC;oBACD,KAAK,EAAE,UAAC,YAAY;wBAClB,aAAa,GAAG,YAAY,CAAC;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AAK,WAAE,SAAC;QACR,KAAI,CAAC,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;;IACpC,CAAC;IAEM,2BAAO,GAAd,UACE,SAAoB,EACpB,OAAiB;QAEjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACH,gBAAC;AAAD,CAAC,AAbD,CAA+B,UAAU,GAaxC","sourcesContent":["import type { ExecutionResult } from \"graphql\";\n\nimport type { NetworkError, GraphQLErrors } from \"../../errors/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type { Operation, FetchResult, NextLink } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\n\nexport interface ErrorResponse {\n graphQLErrors?: GraphQLErrors;\n networkError?: NetworkError;\n response?: ExecutionResult;\n operation: Operation;\n forward: NextLink;\n}\n\nexport namespace ErrorLink {\n /**\n * Callback to be triggered when an error occurs within the link stack.\n */\n export interface ErrorHandler {\n (error: ErrorResponse): Observable | void;\n }\n}\n\n// For backwards compatibility.\nexport import ErrorHandler = ErrorLink.ErrorHandler;\n\nexport function onError(errorHandler: ErrorHandler): ApolloLink {\n return new ApolloLink((operation, forward) => {\n return new Observable((observer) => {\n let sub: any;\n let retriedSub: any;\n let retriedResult: any;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n if (result.errors) {\n retriedResult = errorHandler({\n graphQLErrors: result.errors,\n response: result,\n operation,\n forward,\n });\n\n if (retriedResult) {\n retriedSub = retriedResult.subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n return;\n }\n }\n observer.next(result);\n },\n error: (networkError) => {\n retriedResult = errorHandler({\n operation,\n networkError,\n //Network errors can return GraphQL errors on for example a 403\n graphQLErrors:\n networkError &&\n networkError.result &&\n networkError.result.errors,\n forward,\n });\n if (retriedResult) {\n retriedSub = retriedResult.subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n return;\n }\n observer.error(networkError);\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete.bind(observer)();\n }\n },\n });\n } catch (e) {\n errorHandler({ networkError: e as Error, operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) sub.unsubscribe();\n };\n });\n });\n}\n\nexport class ErrorLink extends ApolloLink {\n private link: ApolloLink;\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super();\n this.link = onError(errorHandler);\n }\n\n public request(\n operation: Operation,\n forward: NextLink\n ): Observable | null {\n return this.link.request(operation, forward);\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/error/package.json b/graphql-subscription/node_modules/@apollo/client/link/error/package.json new file mode 100644 index 0000000..04a6adc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/error/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/error", + "type": "module", + "main": "error.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.d.ts new file mode 100644 index 0000000..44af323 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.d.ts @@ -0,0 +1,7 @@ +import { ApolloLink } from "../core/index.js"; +import type { HttpOptions } from "./selectHttpOptionsAndBody.js"; +export declare class HttpLink extends ApolloLink { + options: HttpOptions; + constructor(options?: HttpOptions); +} +//# sourceMappingURL=HttpLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js b/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js new file mode 100644 index 0000000..fdea2d5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js @@ -0,0 +1,15 @@ +import { __extends } from "tslib"; +import { ApolloLink } from "../core/index.js"; +import { createHttpLink } from "./createHttpLink.js"; +var HttpLink = /** @class */ (function (_super) { + __extends(HttpLink, _super); + function HttpLink(options) { + if (options === void 0) { options = {}; } + var _this = _super.call(this, createHttpLink(options).request) || this; + _this.options = options; + return _this; + } + return HttpLink; +}(ApolloLink)); +export { HttpLink }; +//# sourceMappingURL=HttpLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js.map new file mode 100644 index 0000000..cb345ef --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"HttpLink.js","sourceRoot":"","sources":["../../../src/link/http/HttpLink.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;IAA8B,4BAAU;IACtC,kBAAmB,OAAyB;QAAzB,wBAAA,EAAA,YAAyB;QAC1C,YAAA,MAAK,YAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,SAAC;QADtB,aAAO,GAAP,OAAO,CAAkB;;IAE5C,CAAC;IACH,eAAC;AAAD,CAAC,AAJD,CAA8B,UAAU,GAIvC","sourcesContent":["import { ApolloLink } from \"../core/index.js\";\nimport type { HttpOptions } from \"./selectHttpOptionsAndBody.js\";\nimport { createHttpLink } from \"./createHttpLink.js\";\n\nexport class HttpLink extends ApolloLink {\n constructor(public options: HttpOptions = {}) {\n super(createHttpLink(options).request);\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.d.ts new file mode 100644 index 0000000..4b9433a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.d.ts @@ -0,0 +1,2 @@ +export declare const checkFetcher: (fetcher: typeof fetch | undefined) => void; +//# sourceMappingURL=checkFetcher.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js b/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js new file mode 100644 index 0000000..2acfb00 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js @@ -0,0 +1,7 @@ +import { newInvariantError } from "../../utilities/globals/index.js"; +export var checkFetcher = function (fetcher) { + if (!fetcher && typeof fetch === "undefined") { + throw newInvariantError(37); + } +}; +//# sourceMappingURL=checkFetcher.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js.map new file mode 100644 index 0000000..4206d6c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checkFetcher.js","sourceRoot":"","sources":["../../../src/link/http/checkFetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,OAAiC;IAC5D,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QAC7C,MAAM,iBAAiB,CAAC,obAWvB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { newInvariantError } from \"../../utilities/globals/index.js\";\n\nexport const checkFetcher = (fetcher: typeof fetch | undefined) => {\n if (!fetcher && typeof fetch === \"undefined\") {\n throw newInvariantError(`\n\"fetch\" has not been found globally and no fetcher has been \\\nconfigured. To fix this, install a fetch package (like \\\nhttps://www.npmjs.com/package/cross-fetch), instantiate the \\\nfetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n `);\n }\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.d.ts new file mode 100644 index 0000000..2a0ce3e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.d.ts @@ -0,0 +1,4 @@ +import { ApolloLink } from "../core/index.js"; +import type { HttpOptions } from "./selectHttpOptionsAndBody.js"; +export declare const createHttpLink: (linkOptions?: HttpOptions) => ApolloLink; +//# sourceMappingURL=createHttpLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js b/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js new file mode 100644 index 0000000..158b43b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js @@ -0,0 +1,156 @@ +import { __assign, __rest } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +import { ApolloLink } from "../core/index.js"; +import { Observable, hasDirectives } from "../../utilities/index.js"; +import { serializeFetchParameter } from "./serializeFetchParameter.js"; +import { selectURI } from "./selectURI.js"; +import { handleError, readMultipartBody, parseAndCheckHttpResponse, } from "./parseAndCheckHttpResponse.js"; +import { checkFetcher } from "./checkFetcher.js"; +import { selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig, } from "./selectHttpOptionsAndBody.js"; +import { rewriteURIForGET } from "./rewriteURIForGET.js"; +import { fromError, filterOperationVariables } from "../utils/index.js"; +import { maybe, getMainDefinition, removeClientSetsFromDocument, } from "../../utilities/index.js"; +var backupFetch = maybe(function () { return fetch; }); +export var createHttpLink = function (linkOptions) { + if (linkOptions === void 0) { linkOptions = {}; } + var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a, + // use default global fetch if nothing passed in + preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = __rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]); + if (globalThis.__DEV__ !== false) { + // Make sure at least one of preferredFetch, window.fetch, or backupFetch is + // defined, so requests won't fail at runtime. + checkFetcher(preferredFetch || backupFetch); + } + var linkConfig = { + http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + return new ApolloLink(function (operation) { + var chosenURI = selectURI(operation, uri); + var context = operation.getContext(); + // `apollographql-client-*` headers are automatically set if a + // `clientAwareness` object is found in the context. These headers are + // set first, followed by the rest of the headers pulled from + // `context.headers`. If desired, `apollographql-client-*` headers set by + // the `clientAwareness` object can be overridden by + // `apollographql-client-*` headers set in `context.headers`. + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders["apollographql-client-name"] = name_1; + } + if (version) { + clientAwarenessHeaders["apollographql-client-version"] = version; + } + } + var contextHeaders = __assign(__assign({}, clientAwarenessHeaders), context.headers); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: contextHeaders, + }; + if (hasDirectives(["client"], operation.query)) { + var transformedQuery = removeClientSetsFromDocument(operation.query); + if (!transformedQuery) { + return fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.")); + } + operation.query = transformedQuery; + } + //uses fallback, link, and then context to build options + var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body; + if (body.variables && !includeUnusedVariables) { + body.variables = filterOperationVariables(body.variables, operation.query); + } + var controller; + if (!options.signal && typeof AbortController !== "undefined") { + controller = new AbortController(); + options.signal = controller.signal; + } + // If requested, set method to GET if there are no mutations. + var definitionIsMutation = function (d) { + return d.kind === "OperationDefinition" && d.operation === "mutation"; + }; + var definitionIsSubscription = function (d) { + return d.kind === "OperationDefinition" && d.operation === "subscription"; + }; + var isSubscription = definitionIsSubscription(getMainDefinition(operation.query)); + // does not match custom directives beginning with @defer + var hasDefer = hasDirectives(["defer"], operation.query); + if (useGETForQueries && + !operation.query.definitions.some(definitionIsMutation)) { + options.method = "GET"; + } + if (hasDefer || isSubscription) { + options.headers = options.headers || {}; + var acceptHeader = "multipart/mixed;"; + // Omit defer-specific headers if the user attempts to defer a selection + // set on a subscription and log a warning. + if (isSubscription && hasDefer) { + globalThis.__DEV__ !== false && invariant.warn(38); + } + if (isSubscription) { + acceptHeader += + "boundary=graphql;subscriptionSpec=1.0,application/json"; + } + else if (hasDefer) { + acceptHeader += "deferSpec=20220824,application/json"; + } + options.headers.accept = acceptHeader; + } + if (options.method === "GET") { + var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError; + if (parseError) { + return fromError(parseError); + } + chosenURI = newURI; + } + else { + try { + options.body = serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + return fromError(parseError); + } + } + return new Observable(function (observer) { + // Prefer linkOptions.fetch (preferredFetch) if provided, and otherwise + // fall back to the *current* global window.fetch function (see issue + // #7832), or (if all else fails) the backupFetch function we saved when + // this module was first evaluated. This last option protects against the + // removal of window.fetch, which is unlikely but not impossible. + var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch; + var observerNext = observer.next.bind(observer); + currentFetch(chosenURI, options) + .then(function (response) { + var _a; + operation.setContext({ response: response }); + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + else { + return parseAndCheckHttpResponse(operation)(response).then(observerNext); + } + }) + .then(function () { + controller = undefined; + observer.complete(); + }) + .catch(function (err) { + controller = undefined; + handleError(err, observer); + }); + return function () { + // XXX support canceling this request + // https://developers.google.com/web/updates/2017/09/abortable-fetch + if (controller) + controller.abort(); + }; + }); + }); +}; +//# sourceMappingURL=createHttpLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js.map new file mode 100644 index 0000000..139c04e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createHttpLink.js","sourceRoot":"","sources":["../../../src/link/http/createHttpLink.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACL,gCAAgC,EAChC,cAAc,EACd,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,IAAM,WAAW,GAAG,KAAK,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC;AA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CAAC,CAAC,IAAI,CACxD,YAAY,CACb,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC;iBACD,IAAI,CAAC;gBACJ,UAAU,GAAG,SAAS,CAAC;gBACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,CAAC,CAAC;iBACD,KAAK,CAAC,UAAC,GAAG;gBACT,UAAU,GAAG,SAAS,CAAC;gBACvB,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;YAEL,OAAO;gBACL,qCAAqC;gBACrC,oEAAoE;gBACpE,IAAI,UAAU;oBAAE,UAAU,CAAC,KAAK,EAAE,CAAC;YACrC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport type { DefinitionNode } from \"graphql\";\n\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable, hasDirectives } from \"../../utilities/index.js\";\nimport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nimport { selectURI } from \"./selectURI.js\";\nimport {\n handleError,\n readMultipartBody,\n parseAndCheckHttpResponse,\n} from \"./parseAndCheckHttpResponse.js\";\nimport { checkFetcher } from \"./checkFetcher.js\";\nimport type { HttpOptions } from \"./selectHttpOptionsAndBody.js\";\nimport {\n selectHttpOptionsAndBodyInternal,\n defaultPrinter,\n fallbackHttpConfig,\n} from \"./selectHttpOptionsAndBody.js\";\nimport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\nimport { fromError, filterOperationVariables } from \"../utils/index.js\";\nimport {\n maybe,\n getMainDefinition,\n removeClientSetsFromDocument,\n} from \"../../utilities/index.js\";\n\nconst backupFetch = maybe(() => fetch);\n\nexport const createHttpLink = (linkOptions: HttpOptions = {}) => {\n let {\n uri = \"/graphql\",\n // use default global fetch if nothing passed in\n fetch: preferredFetch,\n print = defaultPrinter,\n includeExtensions,\n preserveHeaderCase,\n useGETForQueries,\n includeUnusedVariables = false,\n ...requestOptions\n } = linkOptions;\n\n if (__DEV__) {\n // Make sure at least one of preferredFetch, window.fetch, or backupFetch is\n // defined, so requests won't fail at runtime.\n checkFetcher(preferredFetch || backupFetch);\n }\n\n const linkConfig = {\n http: { includeExtensions, preserveHeaderCase },\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n\n return new ApolloLink((operation) => {\n let chosenURI = selectURI(operation, uri);\n\n const context = operation.getContext();\n\n // `apollographql-client-*` headers are automatically set if a\n // `clientAwareness` object is found in the context. These headers are\n // set first, followed by the rest of the headers pulled from\n // `context.headers`. If desired, `apollographql-client-*` headers set by\n // the `clientAwareness` object can be overridden by\n // `apollographql-client-*` headers set in `context.headers`.\n const clientAwarenessHeaders: {\n \"apollographql-client-name\"?: string;\n \"apollographql-client-version\"?: string;\n } = {};\n\n if (context.clientAwareness) {\n const { name, version } = context.clientAwareness;\n if (name) {\n clientAwarenessHeaders[\"apollographql-client-name\"] = name;\n }\n if (version) {\n clientAwarenessHeaders[\"apollographql-client-version\"] = version;\n }\n }\n\n const contextHeaders = { ...clientAwarenessHeaders, ...context.headers };\n\n const contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: contextHeaders,\n };\n\n if (hasDirectives([\"client\"], operation.query)) {\n const transformedQuery = removeClientSetsFromDocument(operation.query);\n\n if (!transformedQuery) {\n return fromError(\n new Error(\n \"HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.\"\n )\n );\n }\n\n operation.query = transformedQuery;\n }\n\n //uses fallback, link, and then context to build options\n const { options, body } = selectHttpOptionsAndBodyInternal(\n operation,\n print,\n fallbackHttpConfig,\n linkConfig,\n contextConfig\n );\n\n if (body.variables && !includeUnusedVariables) {\n body.variables = filterOperationVariables(\n body.variables,\n operation.query\n );\n }\n\n let controller: AbortController | undefined;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n\n // If requested, set method to GET if there are no mutations.\n const definitionIsMutation = (d: DefinitionNode) => {\n return d.kind === \"OperationDefinition\" && d.operation === \"mutation\";\n };\n const definitionIsSubscription = (d: DefinitionNode) => {\n return d.kind === \"OperationDefinition\" && d.operation === \"subscription\";\n };\n const isSubscription = definitionIsSubscription(\n getMainDefinition(operation.query)\n );\n // does not match custom directives beginning with @defer\n const hasDefer = hasDirectives([\"defer\"], operation.query);\n if (\n useGETForQueries &&\n !operation.query.definitions.some(definitionIsMutation)\n ) {\n options.method = \"GET\";\n }\n\n if (hasDefer || isSubscription) {\n options.headers = options.headers || {};\n let acceptHeader = \"multipart/mixed;\";\n // Omit defer-specific headers if the user attempts to defer a selection\n // set on a subscription and log a warning.\n if (isSubscription && hasDefer) {\n invariant.warn(\"Multipart-subscriptions do not support @defer\");\n }\n\n if (isSubscription) {\n acceptHeader +=\n \"boundary=graphql;subscriptionSpec=1.0,application/json\";\n } else if (hasDefer) {\n acceptHeader += \"deferSpec=20220824,application/json\";\n }\n options.headers.accept = acceptHeader;\n }\n\n if (options.method === \"GET\") {\n const { newURI, parseError } = rewriteURIForGET(chosenURI, body);\n if (parseError) {\n return fromError(parseError);\n }\n chosenURI = newURI;\n } else {\n try {\n (options as any).body = serializeFetchParameter(body, \"Payload\");\n } catch (parseError) {\n return fromError(parseError);\n }\n }\n\n return new Observable((observer) => {\n // Prefer linkOptions.fetch (preferredFetch) if provided, and otherwise\n // fall back to the *current* global window.fetch function (see issue\n // #7832), or (if all else fails) the backupFetch function we saved when\n // this module was first evaluated. This last option protects against the\n // removal of window.fetch, which is unlikely but not impossible.\n const currentFetch = preferredFetch || maybe(() => fetch) || backupFetch;\n\n const observerNext = observer.next.bind(observer);\n currentFetch!(chosenURI, options)\n .then((response) => {\n operation.setContext({ response });\n const ctype = response.headers?.get(\"content-type\");\n\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n } else {\n return parseAndCheckHttpResponse(operation)(response).then(\n observerNext\n );\n }\n })\n .then(() => {\n controller = undefined;\n observer.complete();\n })\n .catch((err) => {\n controller = undefined;\n handleError(err, observer);\n });\n\n return () => {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller) controller.abort();\n };\n });\n });\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.d.ts new file mode 100644 index 0000000..9dc972f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.d.ts @@ -0,0 +1,13 @@ +/** + * @deprecated + * This is not used internally any more and will be removed in + * the next major version of Apollo Client. + */ +export declare const createSignalIfSupported: () => { + controller: boolean; + signal: boolean; +} | { + controller: AbortController; + signal: AbortSignal; +}; +//# sourceMappingURL=createSignalIfSupported.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js b/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js new file mode 100644 index 0000000..3d7013f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js @@ -0,0 +1,13 @@ +/** + * @deprecated + * This is not used internally any more and will be removed in + * the next major version of Apollo Client. + */ +export var createSignalIfSupported = function () { + if (typeof AbortController === "undefined") + return { controller: false, signal: false }; + var controller = new AbortController(); + var signal = controller.signal; + return { controller: controller, signal: signal }; +}; +//# sourceMappingURL=createSignalIfSupported.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js.map new file mode 100644 index 0000000..6390c53 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createSignalIfSupported.js","sourceRoot":"","sources":["../../../src/link/http/createSignalIfSupported.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAG;IACrC,IAAI,OAAO,eAAe,KAAK,WAAW;QACxC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAE9C,IAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,IAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,UAAU,YAAA,EAAE,MAAM,QAAA,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["/**\n * @deprecated\n * This is not used internally any more and will be removed in\n * the next major version of Apollo Client.\n */\nexport const createSignalIfSupported = () => {\n if (typeof AbortController === \"undefined\")\n return { controller: false, signal: false };\n\n const controller = new AbortController();\n const signal = controller.signal;\n return { controller, signal };\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs b/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs new file mode 100644 index 0000000..811e232 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs @@ -0,0 +1,631 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var utils = require('../utils'); +var errors = require('../../errors'); +var core = require('../core'); + +function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} + +function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(utilities.canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function readMultipartBody(response, nextValue) { + var _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 , 3]; + return [4 , iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = tslib.__assign({}, result.payload); + } + if ("errors" in result) { + next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + nextValue(result); + } + } + else if ( + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 ]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 , 1]; + case 3: return [2 ]; + } + }); + }); +} +function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +function handleError(err, observer) { + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); +} +function parseAndCheckHttpResponse(operations) { + return function (response) { + return response + .text() + .then(function (bodyText) { return parseJsonBody(response, bodyText); }) + .then(function (result) { + if (!Array.isArray(result) && + !hasOwnProperty.call(result, "data") && + !hasOwnProperty.call(result, "errors")) { + utils.throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ? + operations.map(function (op) { return op.operationName; }) + : operations.operationName, "'.")); + } + return result; + }); + }; +} + +var serializeFetchParameter = function (p, label) { + var serialized; + try { + serialized = JSON.stringify(p); + } + catch (e) { + var parseError = globals.newInvariantError(39, label, e.message); + parseError.parseError = e; + throw parseError; + } + return serialized; +}; + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + accept: "*/*", + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; +var defaultPrinter = function (ast, printer) { return printer(ast); }; +function selectHttpOptionsAndBody(operation, fallbackConfig) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + configs.unshift(fallbackConfig); + return selectHttpOptionsAndBodyInternal.apply(void 0, tslib.__spreadArray([operation, + defaultPrinter], configs, false)); +} +function selectHttpOptionsAndBodyInternal(operation, printer) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + var options = {}; + var http = {}; + configs.forEach(function (config) { + options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), config.headers) }); + if (config.credentials) { + options.credentials = config.credentials; + } + http = tslib.__assign(tslib.__assign({}, http), config.http); + }); + if (options.headers) { + options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase); + } + var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; + var body = { operationName: operationName, variables: variables }; + if (http.includeExtensions) + body.extensions = extensions; + if (http.includeQuery) + body.query = printer(query, utilities.print); + return { + options: options, + body: body, + }; +} +function removeDuplicateHeaders(headers, preserveHeaderCase) { + if (!preserveHeaderCase) { + var normalizedHeaders_1 = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + normalizedHeaders_1[name.toLowerCase()] = headers[name]; + }); + return normalizedHeaders_1; + } + var headerData = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + headerData[name.toLowerCase()] = { + originalName: name, + value: headers[name], + }; + }); + var normalizedHeaders = Object.create(null); + Object.keys(headerData).forEach(function (name) { + normalizedHeaders[headerData[name].originalName] = headerData[name].value; + }); + return normalizedHeaders; +} + +var checkFetcher = function (fetcher) { + if (!fetcher && typeof fetch === "undefined") { + throw globals.newInvariantError(37); + } +}; + +var createSignalIfSupported = function () { + if (typeof AbortController === "undefined") + return { controller: false, signal: false }; + var controller = new AbortController(); + var signal = controller.signal; + return { controller: controller, signal: signal }; +}; + +var selectURI = function (operation, fallbackURI) { + var context = operation.getContext(); + var contextURI = context.uri; + if (contextURI) { + return contextURI; + } + else if (typeof fallbackURI === "function") { + return fallbackURI(operation); + } + else { + return fallbackURI || "/graphql"; + } +}; + +function rewriteURIForGET(chosenURI, body) { + var queryParams = []; + var addQueryParam = function (key, value) { + queryParams.push("".concat(key, "=").concat(encodeURIComponent(value))); + }; + if ("query" in body) { + addQueryParam("query", body.query); + } + if (body.operationName) { + addQueryParam("operationName", body.operationName); + } + if (body.variables) { + var serializedVariables = void 0; + try { + serializedVariables = serializeFetchParameter(body.variables, "Variables map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("variables", serializedVariables); + } + if (body.extensions) { + var serializedExtensions = void 0; + try { + serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("extensions", serializedExtensions); + } + var fragment = "", preFragment = chosenURI; + var fragmentStart = chosenURI.indexOf("#"); + if (fragmentStart !== -1) { + fragment = chosenURI.substr(fragmentStart); + preFragment = chosenURI.substr(0, fragmentStart); + } + var queryParamsPrefix = preFragment.indexOf("?") === -1 ? "?" : "&"; + var newURI = preFragment + queryParamsPrefix + queryParams.join("&") + fragment; + return { newURI: newURI }; +} + +var backupFetch = utilities.maybe(function () { return fetch; }); +var createHttpLink = function (linkOptions) { + if (linkOptions === void 0) { linkOptions = {}; } + var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a, + preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]); + if (globalThis.__DEV__ !== false) { + checkFetcher(preferredFetch || backupFetch); + } + var linkConfig = { + http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + return new core.ApolloLink(function (operation) { + var chosenURI = selectURI(operation, uri); + var context = operation.getContext(); + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders["apollographql-client-name"] = name_1; + } + if (version) { + clientAwarenessHeaders["apollographql-client-version"] = version; + } + } + var contextHeaders = tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: contextHeaders, + }; + if (utilities.hasDirectives(["client"], operation.query)) { + var transformedQuery = utilities.removeClientSetsFromDocument(operation.query); + if (!transformedQuery) { + return utils.fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.")); + } + operation.query = transformedQuery; + } + var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body; + if (body.variables && !includeUnusedVariables) { + body.variables = utils.filterOperationVariables(body.variables, operation.query); + } + var controller; + if (!options.signal && typeof AbortController !== "undefined") { + controller = new AbortController(); + options.signal = controller.signal; + } + var definitionIsMutation = function (d) { + return d.kind === "OperationDefinition" && d.operation === "mutation"; + }; + var definitionIsSubscription = function (d) { + return d.kind === "OperationDefinition" && d.operation === "subscription"; + }; + var isSubscription = definitionIsSubscription(utilities.getMainDefinition(operation.query)); + var hasDefer = utilities.hasDirectives(["defer"], operation.query); + if (useGETForQueries && + !operation.query.definitions.some(definitionIsMutation)) { + options.method = "GET"; + } + if (hasDefer || isSubscription) { + options.headers = options.headers || {}; + var acceptHeader = "multipart/mixed;"; + if (isSubscription && hasDefer) { + globalThis.__DEV__ !== false && globals.invariant.warn(38); + } + if (isSubscription) { + acceptHeader += + "boundary=graphql;subscriptionSpec=1.0,application/json"; + } + else if (hasDefer) { + acceptHeader += "deferSpec=20220824,application/json"; + } + options.headers.accept = acceptHeader; + } + if (options.method === "GET") { + var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError; + if (parseError) { + return utils.fromError(parseError); + } + chosenURI = newURI; + } + else { + try { + options.body = serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + return utils.fromError(parseError); + } + } + return new utilities.Observable(function (observer) { + var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch; + var observerNext = observer.next.bind(observer); + currentFetch(chosenURI, options) + .then(function (response) { + var _a; + operation.setContext({ response: response }); + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + else { + return parseAndCheckHttpResponse(operation)(response).then(observerNext); + } + }) + .then(function () { + controller = undefined; + observer.complete(); + }) + .catch(function (err) { + controller = undefined; + handleError(err, observer); + }); + return function () { + if (controller) + controller.abort(); + }; + }); + }); +}; + +var HttpLink = (function (_super) { + tslib.__extends(HttpLink, _super); + function HttpLink(options) { + if (options === void 0) { options = {}; } + var _this = _super.call(this, createHttpLink(options).request) || this; + _this.options = options; + return _this; + } + return HttpLink; +}(core.ApolloLink)); + +exports.HttpLink = HttpLink; +exports.checkFetcher = checkFetcher; +exports.createHttpLink = createHttpLink; +exports.createSignalIfSupported = createSignalIfSupported; +exports.defaultPrinter = defaultPrinter; +exports.fallbackHttpConfig = fallbackHttpConfig; +exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse; +exports.rewriteURIForGET = rewriteURIForGET; +exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody; +exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal; +exports.selectURI = selectURI; +exports.serializeFetchParameter = serializeFetchParameter; +//# sourceMappingURL=http.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.map new file mode 100644 index 0000000..dbd3086 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"http.cjs","sources":["iterators/async.js","iterators/nodeStream.js","iterators/promise.js","iterators/reader.js","responseIterator.js","../../utilities/common/objects.js","../../utilities/common/incrementalResult.js","parseAndCheckHttpResponse.js","serializeFetchParameter.js","selectHttpOptionsAndBody.js","checkFetcher.js","createSignalIfSupported.js","selectURI.js","rewriteURIForGET.js","createHttpLink.js","HttpLink.js"],"sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts\n */\nexport default function asyncIterator(source) {\n var _a;\n var iterator = source[Symbol.asyncIterator]();\n return _a = {\n next: function () {\n return iterator.next();\n }\n },\n _a[Symbol.asyncIterator] = function () {\n return this;\n },\n _a;\n}\n//# sourceMappingURL=async.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function nodeStreamIterator(stream) {\n var cleanup = null;\n var error = null;\n var done = false;\n var data = [];\n var waiting = [];\n function onData(chunk) {\n if (error)\n return;\n if (waiting.length) {\n var shiftedArr = waiting.shift();\n if (Array.isArray(shiftedArr) && shiftedArr[0]) {\n return shiftedArr[0]({ value: chunk, done: false });\n }\n }\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n cleanup = function () {\n cleanup = null;\n stream.removeListener(\"data\", onData);\n stream.removeListener(\"error\", onError);\n stream.removeListener(\"end\", onEnd);\n stream.removeListener(\"finish\", onEnd);\n stream.removeListener(\"close\", onEnd);\n };\n stream.on(\"data\", onData);\n stream.on(\"error\", onError);\n stream.on(\"end\", onEnd);\n stream.on(\"finish\", onEnd);\n stream.on(\"close\", onEnd);\n function getNext() {\n return new Promise(function (resolve, reject) {\n if (error)\n return reject(error);\n if (data.length)\n return resolve({ value: data.shift(), done: false });\n if (done)\n return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n var iterator = {\n next: function () {\n return getNext();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=nodeStream.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function promiseIterator(promise) {\n var resolved = false;\n var iterator = {\n next: function () {\n if (resolved)\n return Promise.resolve({\n value: undefined,\n done: true,\n });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value: value, done: false });\n })\n .catch(reject);\n });\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=promise.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function readerIterator(reader) {\n var iterator = {\n next: function () {\n return reader.read();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=reader.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../utilities/index.js\";\nimport asyncIterator from \"./iterators/async.js\";\nimport nodeStreamIterator from \"./iterators/nodeStream.js\";\nimport promiseIterator from \"./iterators/promise.js\";\nimport readerIterator from \"./iterators/reader.js\";\nfunction isNodeResponse(value) {\n return !!value.body;\n}\nfunction isReadableStream(value) {\n return !!value.getReader;\n}\nfunction isAsyncIterableIterator(value) {\n return !!(canUseAsyncIteratorSymbol &&\n value[Symbol.asyncIterator]);\n}\nfunction isStreamableBlob(value) {\n return !!value.stream;\n}\nfunction isBlob(value) {\n return !!value.arrayBuffer;\n}\nfunction isNodeReadableStream(value) {\n return !!value.pipe;\n}\nexport function responseIterator(response) {\n var body = response;\n if (isNodeResponse(response))\n body = response.body;\n if (isAsyncIterableIterator(body))\n return asyncIterator(body);\n if (isReadableStream(body))\n return readerIterator(body.getReader());\n // this errors without casting to ReadableStream\n // because Blob.stream() returns a NodeJS ReadableStream\n if (isStreamableBlob(body)) {\n return readerIterator(body.stream().getReader());\n }\n if (isBlob(body))\n return promiseIterator(body.arrayBuffer());\n if (isNodeReadableStream(body))\n return nodeStreamIterator(body);\n throw new Error(\"Unknown body type for responseIterator. Please pass a streamable response.\");\n}\n//# sourceMappingURL=responseIterator.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === \"object\";\n}\nexport function isPlainObject(obj) {\n return (obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null));\n}\n//# sourceMappingURL=objects.js.map","import { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\nexport function isExecutionPatchIncrementalResult(value) {\n return \"incremental\" in value;\n}\nexport function isExecutionPatchInitialResult(value) {\n return \"hasNext\" in value && \"data\" in value;\n}\nexport function isExecutionPatchResult(value) {\n return (isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value));\n}\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(value) {\n return isNonNullObject(value) && \"payload\" in value;\n}\nexport function mergeIncrementalData(prevResult, result) {\n var mergedData = prevResult;\n var merger = new DeepMerger();\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (_a) {\n var data = _a.data, path = _a.path;\n for (var i = path.length - 1; i >= 0; --i) {\n var key = path[i];\n var isNumericKey = !isNaN(+key);\n var parent_1 = isNumericKey ? [] : {};\n parent_1[key] = data;\n data = parent_1;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData;\n}\n//# sourceMappingURL=incrementalResult.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { responseIterator } from \"./responseIterator.js\";\nimport { throwServerError } from \"../utils/index.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../../errors/index.js\";\nimport { isApolloPayloadResult } from \"../../utilities/common/incrementalResult.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function readMultipartBody(response, nextValue) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n if (TextDecoder === undefined) {\n throw new Error(\"TextDecoder must be defined in the environment: please import a polyfill.\");\n }\n decoder = new TextDecoder(\"utf-8\");\n contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n delimiter = \"boundary=\";\n boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?\n contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['\"]/g, \"\").replace(/\\;(.*)/gm, \"\").trim()\n : \"-\";\n boundary = \"\\r\\n--\".concat(boundaryVal);\n buffer = \"\";\n iterator = responseIterator(response);\n running = true;\n _e.label = 1;\n case 1:\n if (!running) return [3 /*break*/, 3];\n return [4 /*yield*/, iterator.next()];\n case 2:\n _b = _e.sent(), value = _b.value, done = _b.done;\n chunk = typeof value === \"string\" ? value : decoder.decode(value);\n searchFrom = buffer.length - boundary.length + 1;\n running = !done;\n buffer += chunk;\n bi = buffer.indexOf(boundary, searchFrom);\n while (bi > -1) {\n message = void 0;\n _c = [\n buffer.slice(0, bi),\n buffer.slice(bi + boundary.length),\n ], message = _c[0], buffer = _c[1];\n i = message.indexOf(\"\\r\\n\\r\\n\");\n headers = parseHeaders(message.slice(0, i));\n contentType_1 = headers[\"content-type\"];\n if (contentType_1 &&\n contentType_1.toLowerCase().indexOf(\"application/json\") === -1) {\n throw new Error(\"Unsupported patch content type: application/json is required.\");\n }\n body = message.slice(i);\n if (body) {\n result = parseJsonBody(response, body);\n if (Object.keys(result).length > 1 ||\n \"data\" in result ||\n \"incremental\" in result ||\n \"errors\" in result ||\n \"payload\" in result) {\n if (isApolloPayloadResult(result)) {\n next = {};\n if (\"payload\" in result) {\n next = __assign({}, result.payload);\n }\n if (\"errors\" in result) {\n next = __assign(__assign({}, next), { extensions: __assign(__assign({}, (\"extensions\" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });\n }\n nextValue(next);\n }\n else {\n // for the last chunk with only `hasNext: false`\n // we don't need to call observer.next as there is no data/errors\n nextValue(result);\n }\n }\n else if (\n // If the chunk contains only a \"hasNext: false\", we can call\n // observer.complete() immediately.\n Object.keys(result).length === 1 &&\n \"hasNext\" in result &&\n !result.hasNext) {\n return [2 /*return*/];\n }\n }\n bi = buffer.indexOf(boundary);\n }\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/];\n }\n });\n });\n}\nexport function parseHeaders(headerText) {\n var headersInit = {};\n headerText.split(\"\\n\").forEach(function (line) {\n var i = line.indexOf(\":\");\n if (i > -1) {\n // normalize headers to lowercase\n var name_1 = line.slice(0, i).trim().toLowerCase();\n var value = line.slice(i + 1).trim();\n headersInit[name_1] = value;\n }\n });\n return headersInit;\n}\nexport function parseJsonBody(response, bodyText) {\n if (response.status >= 300) {\n // Network error\n var getResult = function () {\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n return bodyText;\n }\n };\n throwServerError(response, getResult(), \"Response not successful: Received status code \".concat(response.status));\n }\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n var parseError = err;\n parseError.name = \"ServerParseError\";\n parseError.response = response;\n parseError.statusCode = response.status;\n parseError.bodyText = bodyText;\n throw parseError;\n }\n}\nexport function handleError(err, observer) {\n // if it is a network error, BUT there is graphql result info fire\n // the next observer before calling error this gives apollo-client\n // (and react-apollo) the `graphqlErrors` and `networkErrors` to\n // pass to UI this should only happen if we *also* have data as\n // part of the response key per the spec\n if (err.result && err.result.errors && err.result.data) {\n // if we don't call next, the UI can only show networkError\n // because AC didn't get any graphqlErrors this is graphql\n // execution result info (i.e errors and possibly data) this is\n // because there is no formal spec how errors should translate to\n // http status codes. So an auth error (401) could have both data\n // from a public field, errors from a private field, and a status\n // of 401\n // {\n // user { // this will have errors\n // firstName\n // }\n // products { // this is public so will have data\n // cost\n // }\n // }\n //\n // the result of above *could* look like this:\n // {\n // data: { products: [{ cost: \"$10\" }] },\n // errors: [{\n // message: 'your session has timed out',\n // path: []\n // }]\n // }\n // status code of above would be a 401\n // in the UI you want to show data where you can, errors as data where you can\n // and use correct http status codes\n observer.next(err.result);\n }\n observer.error(err);\n}\nexport function parseAndCheckHttpResponse(operations) {\n return function (response) {\n return response\n .text()\n .then(function (bodyText) { return parseJsonBody(response, bodyText); })\n .then(function (result) {\n if (!Array.isArray(result) &&\n !hasOwnProperty.call(result, \"data\") &&\n !hasOwnProperty.call(result, \"errors\")) {\n // Data error\n throwServerError(response, result, \"Server response was missing for query '\".concat(Array.isArray(operations) ?\n operations.map(function (op) { return op.operationName; })\n : operations.operationName, \"'.\"));\n }\n return result;\n });\n };\n}\n//# sourceMappingURL=parseAndCheckHttpResponse.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport var serializeFetchParameter = function (p, label) {\n var serialized;\n try {\n serialized = JSON.stringify(p);\n }\n catch (e) {\n var parseError = newInvariantError(39, label, e.message);\n parseError.parseError = e;\n throw parseError;\n }\n return serialized;\n};\n//# sourceMappingURL=serializeFetchParameter.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { print } from \"../../utilities/index.js\";\nvar defaultHttpOptions = {\n includeQuery: true,\n includeExtensions: false,\n preserveHeaderCase: false,\n};\nvar defaultHeaders = {\n // headers are case insensitive (https://stackoverflow.com/a/5259004)\n accept: \"*/*\",\n // The content-type header describes the type of the body of the request, and\n // so it typically only is sent with requests that actually have bodies. One\n // could imagine that Apollo Client would remove this header when constructing\n // a GET request (which has no body), but we historically have not done that.\n // This means that browsers will preflight all Apollo Client requests (even\n // GET requests). Apollo Server's CSRF prevention feature (introduced in\n // AS3.7) takes advantage of this fact and does not block requests with this\n // header. If you want to drop this header from GET requests, then you should\n // probably replace it with a `apollo-require-preflight` header, or servers\n // with CSRF prevention enabled might block your GET request. See\n // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf\n // for more details.\n \"content-type\": \"application/json\",\n};\nvar defaultOptions = {\n method: \"POST\",\n};\nexport var fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\nexport var defaultPrinter = function (ast, printer) { return printer(ast); };\nexport function selectHttpOptionsAndBody(operation, fallbackConfig) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal.apply(void 0, __spreadArray([operation,\n defaultPrinter], configs, false));\n}\nexport function selectHttpOptionsAndBodyInternal(operation, printer) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n var options = {};\n var http = {};\n configs.forEach(function (config) {\n options = __assign(__assign(__assign({}, options), config.options), { headers: __assign(__assign({}, options.headers), config.headers) });\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n http = __assign(__assign({}, http), config.http);\n });\n if (options.headers) {\n options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);\n }\n //The body depends on the http options\n var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;\n var body = { operationName: operationName, variables: variables };\n if (http.includeExtensions)\n body.extensions = extensions;\n // not sending the query (i.e persisted queries)\n if (http.includeQuery)\n body.query = printer(query, print);\n return {\n options: options,\n body: body,\n };\n}\n// Remove potential duplicate header names, preserving last (by insertion order).\n// This is done to prevent unintentionally duplicating a header instead of\n// overwriting it (See #8447 and #8449).\nfunction removeDuplicateHeaders(headers, preserveHeaderCase) {\n // If we're not preserving the case, just remove duplicates w/ normalization.\n if (!preserveHeaderCase) {\n var normalizedHeaders_1 = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n normalizedHeaders_1[name.toLowerCase()] = headers[name];\n });\n return normalizedHeaders_1;\n }\n // If we are preserving the case, remove duplicates w/ normalization,\n // preserving the original name.\n // This allows for non-http-spec-compliant servers that expect intentionally\n // capitalized header names (See #6741).\n var headerData = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n headerData[name.toLowerCase()] = {\n originalName: name,\n value: headers[name],\n };\n });\n var normalizedHeaders = Object.create(null);\n Object.keys(headerData).forEach(function (name) {\n normalizedHeaders[headerData[name].originalName] = headerData[name].value;\n });\n return normalizedHeaders;\n}\n//# sourceMappingURL=selectHttpOptionsAndBody.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport var checkFetcher = function (fetcher) {\n if (!fetcher && typeof fetch === \"undefined\") {\n throw newInvariantError(37);\n }\n};\n//# sourceMappingURL=checkFetcher.js.map","/**\n * @deprecated\n * This is not used internally any more and will be removed in\n * the next major version of Apollo Client.\n */\nexport var createSignalIfSupported = function () {\n if (typeof AbortController === \"undefined\")\n return { controller: false, signal: false };\n var controller = new AbortController();\n var signal = controller.signal;\n return { controller: controller, signal: signal };\n};\n//# sourceMappingURL=createSignalIfSupported.js.map","export var selectURI = function (operation, fallbackURI) {\n var context = operation.getContext();\n var contextURI = context.uri;\n if (contextURI) {\n return contextURI;\n }\n else if (typeof fallbackURI === \"function\") {\n return fallbackURI(operation);\n }\n else {\n return fallbackURI || \"/graphql\";\n }\n};\n//# sourceMappingURL=selectURI.js.map","import { serializeFetchParameter } from \"./serializeFetchParameter.js\";\n// For GET operations, returns the given URI rewritten with parameters, or a\n// parse error.\nexport function rewriteURIForGET(chosenURI, body) {\n // Implement the standard HTTP GET serialization, plus 'extensions'. Note\n // the extra level of JSON serialization!\n var queryParams = [];\n var addQueryParam = function (key, value) {\n queryParams.push(\"\".concat(key, \"=\").concat(encodeURIComponent(value)));\n };\n if (\"query\" in body) {\n addQueryParam(\"query\", body.query);\n }\n if (body.operationName) {\n addQueryParam(\"operationName\", body.operationName);\n }\n if (body.variables) {\n var serializedVariables = void 0;\n try {\n serializedVariables = serializeFetchParameter(body.variables, \"Variables map\");\n }\n catch (parseError) {\n return { parseError: parseError };\n }\n addQueryParam(\"variables\", serializedVariables);\n }\n if (body.extensions) {\n var serializedExtensions = void 0;\n try {\n serializedExtensions = serializeFetchParameter(body.extensions, \"Extensions map\");\n }\n catch (parseError) {\n return { parseError: parseError };\n }\n addQueryParam(\"extensions\", serializedExtensions);\n }\n // Reconstruct the URI with added query params.\n // XXX This assumes that the URI is well-formed and that it doesn't\n // already contain any of these query params. We could instead use the\n // URL API and take a polyfill (whatwg-url@6) for older browsers that\n // don't support URLSearchParams. Note that some browsers (and\n // versions of whatwg-url) support URL but not URLSearchParams!\n var fragment = \"\", preFragment = chosenURI;\n var fragmentStart = chosenURI.indexOf(\"#\");\n if (fragmentStart !== -1) {\n fragment = chosenURI.substr(fragmentStart);\n preFragment = chosenURI.substr(0, fragmentStart);\n }\n var queryParamsPrefix = preFragment.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n var newURI = preFragment + queryParamsPrefix + queryParams.join(\"&\") + fragment;\n return { newURI: newURI };\n}\n//# sourceMappingURL=rewriteURIForGET.js.map","import { __assign, __rest } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable, hasDirectives } from \"../../utilities/index.js\";\nimport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nimport { selectURI } from \"./selectURI.js\";\nimport { handleError, readMultipartBody, parseAndCheckHttpResponse, } from \"./parseAndCheckHttpResponse.js\";\nimport { checkFetcher } from \"./checkFetcher.js\";\nimport { selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig, } from \"./selectHttpOptionsAndBody.js\";\nimport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\nimport { fromError, filterOperationVariables } from \"../utils/index.js\";\nimport { maybe, getMainDefinition, removeClientSetsFromDocument, } from \"../../utilities/index.js\";\nvar backupFetch = maybe(function () { return fetch; });\nexport var createHttpLink = function (linkOptions) {\n if (linkOptions === void 0) { linkOptions = {}; }\n var _a = linkOptions.uri, uri = _a === void 0 ? \"/graphql\" : _a, \n // use default global fetch if nothing passed in\n preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = __rest(linkOptions, [\"uri\", \"fetch\", \"print\", \"includeExtensions\", \"preserveHeaderCase\", \"useGETForQueries\", \"includeUnusedVariables\"]);\n if (globalThis.__DEV__ !== false) {\n // Make sure at least one of preferredFetch, window.fetch, or backupFetch is\n // defined, so requests won't fail at runtime.\n checkFetcher(preferredFetch || backupFetch);\n }\n var linkConfig = {\n http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase },\n options: requestOptions.fetchOptions,\n credentials: requestOptions.credentials,\n headers: requestOptions.headers,\n };\n return new ApolloLink(function (operation) {\n var chosenURI = selectURI(operation, uri);\n var context = operation.getContext();\n // `apollographql-client-*` headers are automatically set if a\n // `clientAwareness` object is found in the context. These headers are\n // set first, followed by the rest of the headers pulled from\n // `context.headers`. If desired, `apollographql-client-*` headers set by\n // the `clientAwareness` object can be overridden by\n // `apollographql-client-*` headers set in `context.headers`.\n var clientAwarenessHeaders = {};\n if (context.clientAwareness) {\n var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;\n if (name_1) {\n clientAwarenessHeaders[\"apollographql-client-name\"] = name_1;\n }\n if (version) {\n clientAwarenessHeaders[\"apollographql-client-version\"] = version;\n }\n }\n var contextHeaders = __assign(__assign({}, clientAwarenessHeaders), context.headers);\n var contextConfig = {\n http: context.http,\n options: context.fetchOptions,\n credentials: context.credentials,\n headers: contextHeaders,\n };\n if (hasDirectives([\"client\"], operation.query)) {\n var transformedQuery = removeClientSetsFromDocument(operation.query);\n if (!transformedQuery) {\n return fromError(new Error(\"HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.\"));\n }\n operation.query = transformedQuery;\n }\n //uses fallback, link, and then context to build options\n var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;\n if (body.variables && !includeUnusedVariables) {\n body.variables = filterOperationVariables(body.variables, operation.query);\n }\n var controller;\n if (!options.signal && typeof AbortController !== \"undefined\") {\n controller = new AbortController();\n options.signal = controller.signal;\n }\n // If requested, set method to GET if there are no mutations.\n var definitionIsMutation = function (d) {\n return d.kind === \"OperationDefinition\" && d.operation === \"mutation\";\n };\n var definitionIsSubscription = function (d) {\n return d.kind === \"OperationDefinition\" && d.operation === \"subscription\";\n };\n var isSubscription = definitionIsSubscription(getMainDefinition(operation.query));\n // does not match custom directives beginning with @defer\n var hasDefer = hasDirectives([\"defer\"], operation.query);\n if (useGETForQueries &&\n !operation.query.definitions.some(definitionIsMutation)) {\n options.method = \"GET\";\n }\n if (hasDefer || isSubscription) {\n options.headers = options.headers || {};\n var acceptHeader = \"multipart/mixed;\";\n // Omit defer-specific headers if the user attempts to defer a selection\n // set on a subscription and log a warning.\n if (isSubscription && hasDefer) {\n globalThis.__DEV__ !== false && invariant.warn(38);\n }\n if (isSubscription) {\n acceptHeader +=\n \"boundary=graphql;subscriptionSpec=1.0,application/json\";\n }\n else if (hasDefer) {\n acceptHeader += \"deferSpec=20220824,application/json\";\n }\n options.headers.accept = acceptHeader;\n }\n if (options.method === \"GET\") {\n var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError;\n if (parseError) {\n return fromError(parseError);\n }\n chosenURI = newURI;\n }\n else {\n try {\n options.body = serializeFetchParameter(body, \"Payload\");\n }\n catch (parseError) {\n return fromError(parseError);\n }\n }\n return new Observable(function (observer) {\n // Prefer linkOptions.fetch (preferredFetch) if provided, and otherwise\n // fall back to the *current* global window.fetch function (see issue\n // #7832), or (if all else fails) the backupFetch function we saved when\n // this module was first evaluated. This last option protects against the\n // removal of window.fetch, which is unlikely but not impossible.\n var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch;\n var observerNext = observer.next.bind(observer);\n currentFetch(chosenURI, options)\n .then(function (response) {\n var _a;\n operation.setContext({ response: response });\n var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n }\n else {\n return parseAndCheckHttpResponse(operation)(response).then(observerNext);\n }\n })\n .then(function () {\n controller = undefined;\n observer.complete();\n })\n .catch(function (err) {\n controller = undefined;\n handleError(err, observer);\n });\n return function () {\n // XXX support canceling this request\n // https://developers.google.com/web/updates/2017/09/abortable-fetch\n if (controller)\n controller.abort();\n };\n });\n });\n};\n//# sourceMappingURL=createHttpLink.js.map","import { __extends } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { createHttpLink } from \"./createHttpLink.js\";\nvar HttpLink = /** @class */ (function (_super) {\n __extends(HttpLink, _super);\n function HttpLink(options) {\n if (options === void 0) { options = {}; }\n var _this = _super.call(this, createHttpLink(options).request) || this;\n _this.options = options;\n return _this;\n }\n return HttpLink;\n}(ApolloLink));\nexport { HttpLink };\n//# sourceMappingURL=HttpLink.js.map"],"names":["canUseAsyncIteratorSymbol","__awaiter","__generator","__assign","PROTOCOL_ERRORS_SYMBOL","throwServerError","newInvariantError","__spreadArray","print","maybe","__rest","ApolloLink","hasDirectives","removeClientSetsFromDocument","fromError","filterOperationVariables","getMainDefinition","invariant","Observable","__extends"],"mappings":";;;;;;;;;;;AAIe,SAAS,aAAa,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;AAClD,IAAI,OAAO,EAAE,GAAG;AAChB,YAAY,IAAI,EAAE,YAAY;AAC9B,gBAAgB,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACvC,aAAa;AACb,SAAS;AACT,QAAQ,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,YAAY;AAC/C,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS;AACT,QAAQ,EAAE,CAAC;AACX;;ACXe,SAAS,kBAAkB,CAAC,MAAM,EAAE;AACnD,IAAI,IAAI,OAAO,GAAG,IAAI,CAAC;AACvB,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC;AACrB,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC;AACrB,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;AAClB,IAAI,IAAI,OAAO,GAAG,EAAE,CAAC;AACrB,IAAI,SAAS,MAAM,CAAC,KAAK,EAAE;AAC3B,QAAQ,IAAI,KAAK;AACjB,YAAY,OAAO;AACnB,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE;AAC5B,YAAY,IAAI,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;AAC7C,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU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,EAAE;AAC/B,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AACjD,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;AAC/E,QAAQ,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;AAChC,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,QAAQ,CAAC;AACpB,CAAC,CAACR,eAAU,CAAC;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.native.js new file mode 100644 index 0000000..811e232 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.native.js @@ -0,0 +1,631 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var utils = require('../utils'); +var errors = require('../../errors'); +var core = require('../core'); + +function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} + +function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(utilities.canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function readMultipartBody(response, nextValue) { + var _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 , 3]; + return [4 , iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = tslib.__assign({}, result.payload); + } + if ("errors" in result) { + next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + nextValue(result); + } + } + else if ( + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 ]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 , 1]; + case 3: return [2 ]; + } + }); + }); +} +function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +function handleError(err, observer) { + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); +} +function parseAndCheckHttpResponse(operations) { + return function (response) { + return response + .text() + .then(function (bodyText) { return parseJsonBody(response, bodyText); }) + .then(function (result) { + if (!Array.isArray(result) && + !hasOwnProperty.call(result, "data") && + !hasOwnProperty.call(result, "errors")) { + utils.throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ? + operations.map(function (op) { return op.operationName; }) + : operations.operationName, "'.")); + } + return result; + }); + }; +} + +var serializeFetchParameter = function (p, label) { + var serialized; + try { + serialized = JSON.stringify(p); + } + catch (e) { + var parseError = globals.newInvariantError(39, label, e.message); + parseError.parseError = e; + throw parseError; + } + return serialized; +}; + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + accept: "*/*", + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; +var defaultPrinter = function (ast, printer) { return printer(ast); }; +function selectHttpOptionsAndBody(operation, fallbackConfig) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + configs.unshift(fallbackConfig); + return selectHttpOptionsAndBodyInternal.apply(void 0, tslib.__spreadArray([operation, + defaultPrinter], configs, false)); +} +function selectHttpOptionsAndBodyInternal(operation, printer) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + var options = {}; + var http = {}; + configs.forEach(function (config) { + options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), config.headers) }); + if (config.credentials) { + options.credentials = config.credentials; + } + http = tslib.__assign(tslib.__assign({}, http), config.http); + }); + if (options.headers) { + options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase); + } + var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; + var body = { operationName: operationName, variables: variables }; + if (http.includeExtensions) + body.extensions = extensions; + if (http.includeQuery) + body.query = printer(query, utilities.print); + return { + options: options, + body: body, + }; +} +function removeDuplicateHeaders(headers, preserveHeaderCase) { + if (!preserveHeaderCase) { + var normalizedHeaders_1 = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + normalizedHeaders_1[name.toLowerCase()] = headers[name]; + }); + return normalizedHeaders_1; + } + var headerData = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + headerData[name.toLowerCase()] = { + originalName: name, + value: headers[name], + }; + }); + var normalizedHeaders = Object.create(null); + Object.keys(headerData).forEach(function (name) { + normalizedHeaders[headerData[name].originalName] = headerData[name].value; + }); + return normalizedHeaders; +} + +var checkFetcher = function (fetcher) { + if (!fetcher && typeof fetch === "undefined") { + throw globals.newInvariantError(37); + } +}; + +var createSignalIfSupported = function () { + if (typeof AbortController === "undefined") + return { controller: false, signal: false }; + var controller = new AbortController(); + var signal = controller.signal; + return { controller: controller, signal: signal }; +}; + +var selectURI = function (operation, fallbackURI) { + var context = operation.getContext(); + var contextURI = context.uri; + if (contextURI) { + return contextURI; + } + else if (typeof fallbackURI === "function") { + return fallbackURI(operation); + } + else { + return fallbackURI || "/graphql"; + } +}; + +function rewriteURIForGET(chosenURI, body) { + var queryParams = []; + var addQueryParam = function (key, value) { + queryParams.push("".concat(key, "=").concat(encodeURIComponent(value))); + }; + if ("query" in body) { + addQueryParam("query", body.query); + } + if (body.operationName) { + addQueryParam("operationName", body.operationName); + } + if (body.variables) { + var serializedVariables = void 0; + try { + serializedVariables = serializeFetchParameter(body.variables, "Variables map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("variables", serializedVariables); + } + if (body.extensions) { + var serializedExtensions = void 0; + try { + serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("extensions", serializedExtensions); + } + var fragment = "", preFragment = chosenURI; + var fragmentStart = chosenURI.indexOf("#"); + if (fragmentStart !== -1) { + fragment = chosenURI.substr(fragmentStart); + preFragment = chosenURI.substr(0, fragmentStart); + } + var queryParamsPrefix = preFragment.indexOf("?") === -1 ? "?" : "&"; + var newURI = preFragment + queryParamsPrefix + queryParams.join("&") + fragment; + return { newURI: newURI }; +} + +var backupFetch = utilities.maybe(function () { return fetch; }); +var createHttpLink = function (linkOptions) { + if (linkOptions === void 0) { linkOptions = {}; } + var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a, + preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]); + if (globalThis.__DEV__ !== false) { + checkFetcher(preferredFetch || backupFetch); + } + var linkConfig = { + http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase }, + options: requestOptions.fetchOptions, + credentials: requestOptions.credentials, + headers: requestOptions.headers, + }; + return new core.ApolloLink(function (operation) { + var chosenURI = selectURI(operation, uri); + var context = operation.getContext(); + var clientAwarenessHeaders = {}; + if (context.clientAwareness) { + var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; + if (name_1) { + clientAwarenessHeaders["apollographql-client-name"] = name_1; + } + if (version) { + clientAwarenessHeaders["apollographql-client-version"] = version; + } + } + var contextHeaders = tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers); + var contextConfig = { + http: context.http, + options: context.fetchOptions, + credentials: context.credentials, + headers: contextHeaders, + }; + if (utilities.hasDirectives(["client"], operation.query)) { + var transformedQuery = utilities.removeClientSetsFromDocument(operation.query); + if (!transformedQuery) { + return utils.fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.")); + } + operation.query = transformedQuery; + } + var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body; + if (body.variables && !includeUnusedVariables) { + body.variables = utils.filterOperationVariables(body.variables, operation.query); + } + var controller; + if (!options.signal && typeof AbortController !== "undefined") { + controller = new AbortController(); + options.signal = controller.signal; + } + var definitionIsMutation = function (d) { + return d.kind === "OperationDefinition" && d.operation === "mutation"; + }; + var definitionIsSubscription = function (d) { + return d.kind === "OperationDefinition" && d.operation === "subscription"; + }; + var isSubscription = definitionIsSubscription(utilities.getMainDefinition(operation.query)); + var hasDefer = utilities.hasDirectives(["defer"], operation.query); + if (useGETForQueries && + !operation.query.definitions.some(definitionIsMutation)) { + options.method = "GET"; + } + if (hasDefer || isSubscription) { + options.headers = options.headers || {}; + var acceptHeader = "multipart/mixed;"; + if (isSubscription && hasDefer) { + globalThis.__DEV__ !== false && globals.invariant.warn(38); + } + if (isSubscription) { + acceptHeader += + "boundary=graphql;subscriptionSpec=1.0,application/json"; + } + else if (hasDefer) { + acceptHeader += "deferSpec=20220824,application/json"; + } + options.headers.accept = acceptHeader; + } + if (options.method === "GET") { + var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError; + if (parseError) { + return utils.fromError(parseError); + } + chosenURI = newURI; + } + else { + try { + options.body = serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + return utils.fromError(parseError); + } + } + return new utilities.Observable(function (observer) { + var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch; + var observerNext = observer.next.bind(observer); + currentFetch(chosenURI, options) + .then(function (response) { + var _a; + operation.setContext({ response: response }); + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + else { + return parseAndCheckHttpResponse(operation)(response).then(observerNext); + } + }) + .then(function () { + controller = undefined; + observer.complete(); + }) + .catch(function (err) { + controller = undefined; + handleError(err, observer); + }); + return function () { + if (controller) + controller.abort(); + }; + }); + }); +}; + +var HttpLink = (function (_super) { + tslib.__extends(HttpLink, _super); + function HttpLink(options) { + if (options === void 0) { options = {}; } + var _this = _super.call(this, createHttpLink(options).request) || this; + _this.options = options; + return _this; + } + return HttpLink; +}(core.ApolloLink)); + +exports.HttpLink = HttpLink; +exports.checkFetcher = checkFetcher; +exports.createHttpLink = createHttpLink; +exports.createSignalIfSupported = createSignalIfSupported; +exports.defaultPrinter = defaultPrinter; +exports.fallbackHttpConfig = fallbackHttpConfig; +exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse; +exports.rewriteURIForGET = rewriteURIForGET; +exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody; +exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal; +exports.selectURI = selectURI; +exports.serializeFetchParameter = serializeFetchParameter; +//# sourceMappingURL=http.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/index.d.ts new file mode 100644 index 0000000..93cc812 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/index.d.ts @@ -0,0 +1,14 @@ +import "../../utilities/globals/index.js"; +export type { ServerParseError } from "./parseAndCheckHttpResponse.js"; +export { parseAndCheckHttpResponse } from "./parseAndCheckHttpResponse.js"; +export type { ClientParseError } from "./serializeFetchParameter.js"; +export { serializeFetchParameter } from "./serializeFetchParameter.js"; +export type { HttpOptions, UriFunction } from "./selectHttpOptionsAndBody.js"; +export { fallbackHttpConfig, defaultPrinter, selectHttpOptionsAndBody, selectHttpOptionsAndBodyInternal, } from "./selectHttpOptionsAndBody.js"; +export { checkFetcher } from "./checkFetcher.js"; +export { createSignalIfSupported } from "./createSignalIfSupported.js"; +export { selectURI } from "./selectURI.js"; +export { createHttpLink } from "./createHttpLink.js"; +export { HttpLink } from "./HttpLink.js"; +export { rewriteURIForGET } from "./rewriteURIForGET.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/index.js b/graphql-subscription/node_modules/@apollo/client/link/http/index.js new file mode 100644 index 0000000..8fb0d62 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/index.js @@ -0,0 +1,12 @@ +import "../../utilities/globals/index.js"; +export { parseAndCheckHttpResponse } from "./parseAndCheckHttpResponse.js"; +export { serializeFetchParameter } from "./serializeFetchParameter.js"; +export { fallbackHttpConfig, defaultPrinter, selectHttpOptionsAndBody, selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public + } from "./selectHttpOptionsAndBody.js"; +export { checkFetcher } from "./checkFetcher.js"; +export { createSignalIfSupported } from "./createSignalIfSupported.js"; +export { selectURI } from "./selectURI.js"; +export { createHttpLink } from "./createHttpLink.js"; +export { HttpLink } from "./HttpLink.js"; +export { rewriteURIForGET } from "./rewriteURIForGET.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/index.js.map new file mode 100644 index 0000000..6f057df --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAG1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,gCAAgC,EAAE,yCAAyC;EAC5E,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport type { ServerParseError } from \"./parseAndCheckHttpResponse.js\";\nexport { parseAndCheckHttpResponse } from \"./parseAndCheckHttpResponse.js\";\nexport type { ClientParseError } from \"./serializeFetchParameter.js\";\nexport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nexport type { HttpOptions, UriFunction } from \"./selectHttpOptionsAndBody.js\";\nexport {\n fallbackHttpConfig,\n defaultPrinter,\n selectHttpOptionsAndBody,\n selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public\n} from \"./selectHttpOptionsAndBody.js\";\nexport { checkFetcher } from \"./checkFetcher.js\";\nexport { createSignalIfSupported } from \"./createSignalIfSupported.js\";\nexport { selectURI } from \"./selectURI.js\";\nexport { createHttpLink } from \"./createHttpLink.js\";\nexport { HttpLink } from \"./HttpLink.js\";\nexport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.d.ts new file mode 100644 index 0000000..3b14b2c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.d.ts @@ -0,0 +1,6 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts + */ +export default function asyncIterator(source: AsyncIterableIterator): AsyncIterableIterator; +//# sourceMappingURL=async.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js new file mode 100644 index 0000000..52ddd12 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js @@ -0,0 +1,18 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts + */ +export default function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} +//# sourceMappingURL=async.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js.map new file mode 100644 index 0000000..fc9e5c8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js.map @@ -0,0 +1 @@ +{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../src/link/http/iterators/async.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,MAAgC;;IAEhC,IAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;IAChD;YACE,IAAI;gBACF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;YACzB,CAAC;;QACD,GAAC,MAAM,CAAC,aAAa,IAArB;YACE,OAAO,IAAI,CAAC;QACd,CAAC;WACD;AACJ,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts\n */\n\nexport default function asyncIterator(\n source: AsyncIterableIterator\n): AsyncIterableIterator {\n const iterator = source[Symbol.asyncIterator]();\n return {\n next(): Promise> {\n return iterator.next();\n },\n [Symbol.asyncIterator](): AsyncIterableIterator {\n return this;\n },\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.d.ts new file mode 100644 index 0000000..da95f32 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.d.ts @@ -0,0 +1,8 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts + */ +/// +import type { Readable as NodeReadableStream } from "stream"; +export default function nodeStreamIterator(stream: NodeReadableStream): AsyncIterableIterator; +//# sourceMappingURL=nodeStream.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js new file mode 100644 index 0000000..b5b0b1b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js @@ -0,0 +1,75 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts + */ +import { canUseAsyncIteratorSymbol } from "../../../utilities/index.js"; +export default function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} +//# sourceMappingURL=nodeStream.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js.map new file mode 100644 index 0000000..c81e6c3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nodeStream.js","sourceRoot":"","sources":["../../../../src/link/http/iterators/nodeStream.ts"],"names":[],"mappings":"AAAA;;;GAGG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AAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAM,QAAQ,GAA0B;QACtC,IAAI;YACF,OAAO,OAAO,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;IAEF,IAAI,yBAAyB,EAAE,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,QAAoC,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts\n */\n\nimport type { Readable as NodeReadableStream } from \"stream\";\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\n\ninterface NodeStreamIterator {\n next(): Promise>;\n [Symbol.asyncIterator]?(): AsyncIterator;\n}\n\nexport default function nodeStreamIterator(\n stream: NodeReadableStream\n): AsyncIterableIterator {\n let cleanup: (() => void) | null = null;\n let error: Error | null = null;\n let done = false;\n const data: unknown[] = [];\n\n const waiting: [\n (\n value:\n | IteratorResult\n | PromiseLike>\n ) => void,\n (reason?: any) => void,\n ][] = [];\n\n function onData(chunk: any) {\n if (error) return;\n if (waiting.length) {\n const shiftedArr = waiting.shift();\n if (Array.isArray(shiftedArr) && shiftedArr[0]) {\n return shiftedArr[0]({ value: chunk, done: false });\n }\n }\n data.push(chunk);\n }\n function onError(err: Error) {\n error = err;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n\n cleanup = function () {\n cleanup = null;\n stream.removeListener(\"data\", onData);\n stream.removeListener(\"error\", onError);\n stream.removeListener(\"end\", onEnd);\n stream.removeListener(\"finish\", onEnd);\n stream.removeListener(\"close\", onEnd);\n };\n stream.on(\"data\", onData);\n stream.on(\"error\", onError);\n stream.on(\"end\", onEnd);\n stream.on(\"finish\", onEnd);\n stream.on(\"close\", onEnd);\n\n function getNext(): Promise> {\n return new Promise(function (resolve, reject) {\n if (error) return reject(error);\n if (data.length)\n return resolve({ value: data.shift() as T, done: false });\n if (done) return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n\n const iterator: NodeStreamIterator = {\n next(): Promise> {\n return getNext();\n },\n };\n\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.d.ts new file mode 100644 index 0000000..af5240f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.d.ts @@ -0,0 +1,6 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts + */ +export default function promiseIterator(promise: Promise): AsyncIterableIterator; +//# sourceMappingURL=promise.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js new file mode 100644 index 0000000..4b51847 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js @@ -0,0 +1,32 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts + */ +import { canUseAsyncIteratorSymbol } from "../../../utilities/index.js"; +export default function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} +//# sourceMappingURL=promise.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js.map new file mode 100644 index 0000000..c7dc77f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js.map @@ -0,0 +1 @@ +{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../../../src/link/http/iterators/promise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAOxE,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,OAA6B;IAE7B,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,IAAM,QAAQ,GAAuB;QACnC,IAAI;YACF,IAAI,QAAQ;gBACV,OAAO,OAAO,CAAC,OAAO,CAAC;oBACrB,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,IAAI;iBACX,CAAC,CAAC;YACL,QAAQ,GAAG,IAAI,CAAC;YAChB,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;gBAC1C,OAAO;qBACJ,IAAI,CAAC,UAAU,KAAK;oBACnB,OAAO,CAAC,EAAE,KAAK,EAAE,KAAqB,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;gBACzD,CAAC,CAAC;qBACD,KAAK,CAAC,MAAM,CAAC,CAAC;YACnB,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,IAAI,yBAAyB,EAAE,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,QAAoC,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts\n */\n\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\n\ninterface PromiseIterator {\n next(): Promise>;\n [Symbol.asyncIterator]?(): AsyncIterator;\n}\n\nexport default function promiseIterator(\n promise: Promise\n): AsyncIterableIterator {\n let resolved = false;\n\n const iterator: PromiseIterator = {\n next(): Promise> {\n if (resolved)\n return Promise.resolve({\n value: undefined,\n done: true,\n });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value: value as unknown as T, done: false });\n })\n .catch(reject);\n });\n },\n };\n\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.d.ts new file mode 100644 index 0000000..bfd3b47 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.d.ts @@ -0,0 +1,6 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts + */ +export default function readerIterator(reader: ReadableStreamDefaultReader): AsyncIterableIterator; +//# sourceMappingURL=reader.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js new file mode 100644 index 0000000..c0daa0d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js @@ -0,0 +1,19 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts + */ +import { canUseAsyncIteratorSymbol } from "../../../utilities/index.js"; +export default function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} +//# sourceMappingURL=reader.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js.map new file mode 100644 index 0000000..775b41d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../../../src/link/http/iterators/reader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAOxE,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,MAAsC;IAEtC,IAAM,QAAQ,GAAsB;QAClC,IAAI;YACF,OAAO,MAAM,CAAC,IAAI,EAKjB,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,IAAI,yBAAyB,EAAE,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;YAI/B,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,QAAoC,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts\n */\n\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\n\ninterface ReaderIterator {\n next(): Promise>;\n [Symbol.asyncIterator]?(): AsyncIterator;\n}\n\nexport default function readerIterator(\n reader: ReadableStreamDefaultReader\n): AsyncIterableIterator {\n const iterator: ReaderIterator = {\n next() {\n return reader.read() as Promise<\n | ReadableStreamReadValueResult\n // DoneResult has `value` optional, which doesn't comply with an\n // `IteratorResult`, so we assert it to `T | undefined` instead\n | Required>\n >;\n },\n };\n\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator<\n T,\n T | undefined\n > {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/package.json b/graphql-subscription/node_modules/@apollo/client/link/http/package.json new file mode 100644 index 0000000..9c2f0ee --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/http", + "type": "module", + "main": "http.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.d.ts new file mode 100644 index 0000000..baec159 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.d.ts @@ -0,0 +1,13 @@ +import type { Operation } from "../core/index.js"; +import type { SubscriptionObserver } from "zen-observable-ts"; +export type ServerParseError = Error & { + response: Response; + statusCode: number; + bodyText: string; +}; +export declare function readMultipartBody>(response: Response, nextValue: (value: T) => void): Promise; +export declare function parseHeaders(headerText: string): Record; +export declare function parseJsonBody(response: Response, bodyText: string): T; +export declare function handleError(err: any, observer: SubscriptionObserver): void; +export declare function parseAndCheckHttpResponse(operations: Operation | Operation[]): (response: Response) => Promise; +//# sourceMappingURL=parseAndCheckHttpResponse.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js b/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js new file mode 100644 index 0000000..b658ce0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js @@ -0,0 +1,187 @@ +import { __assign, __awaiter, __generator } from "tslib"; +import { responseIterator } from "./responseIterator.js"; +import { throwServerError } from "../utils/index.js"; +import { PROTOCOL_ERRORS_SYMBOL } from "../../errors/index.js"; +import { isApolloPayloadResult } from "../../utilities/common/incrementalResult.js"; +var hasOwnProperty = Object.prototype.hasOwnProperty; +export function readMultipartBody(response, nextValue) { + var _a; + return __awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 /*break*/, 3]; + return [4 /*yield*/, iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = __assign({}, result.payload); + } + if ("errors" in result) { + next = __assign(__assign({}, next), { extensions: __assign(__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + // for the last chunk with only `hasNext: false` + // we don't need to call observer.next as there is no data/errors + nextValue(result); + } + } + else if ( + // If the chunk contains only a "hasNext: false", we can call + // observer.complete() immediately. + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 /*return*/]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 /*break*/, 1]; + case 3: return [2 /*return*/]; + } + }); + }); +} +export function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + // normalize headers to lowercase + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +export function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + // Network error + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +export function handleError(err, observer) { + // if it is a network error, BUT there is graphql result info fire + // the next observer before calling error this gives apollo-client + // (and react-apollo) the `graphqlErrors` and `networkErrors` to + // pass to UI this should only happen if we *also* have data as + // part of the response key per the spec + if (err.result && err.result.errors && err.result.data) { + // if we don't call next, the UI can only show networkError + // because AC didn't get any graphqlErrors this is graphql + // execution result info (i.e errors and possibly data) this is + // because there is no formal spec how errors should translate to + // http status codes. So an auth error (401) could have both data + // from a public field, errors from a private field, and a status + // of 401 + // { + // user { // this will have errors + // firstName + // } + // products { // this is public so will have data + // cost + // } + // } + // + // the result of above *could* look like this: + // { + // data: { products: [{ cost: "$10" }] }, + // errors: [{ + // message: 'your session has timed out', + // path: [] + // }] + // } + // status code of above would be a 401 + // in the UI you want to show data where you can, errors as data where you can + // and use correct http status codes + observer.next(err.result); + } + observer.error(err); +} +export function parseAndCheckHttpResponse(operations) { + return function (response) { + return response + .text() + .then(function (bodyText) { return parseJsonBody(response, bodyText); }) + .then(function (result) { + if (!Array.isArray(result) && + !hasOwnProperty.call(result, "data") && + !hasOwnProperty.call(result, "errors")) { + // Data error + throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ? + operations.map(function (op) { return op.operationName; }) + : operations.operationName, "'.")); + } + return result; + }); + }; +} +//# sourceMappingURL=parseAndCheckHttpResponse.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js.map new file mode 100644 index 0000000..15952d8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseAndCheckHttpResponse.js","sourceRoot":"","sources":["../../../src/link/http/parseAndCheckHttpResponse.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAG5E,IAAA,cAAc,GAAK,MAAM,CAAC,SAAS,eAArB,CAAsB;AAQ5C,MAAM,UAAgB,iBAAiB,CAErC,QAAkB,EAAE,SAA6B;;;;;;;;oBACjD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;wBAC9B,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;oBACJ,CAAC;oBACK,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;oBACnC,WAAW,GAAG,MAAA,QAAQ,CAAC,OAAO,0CAAE,GAAG,CAAC,cAAc,CAAC,CAAC;oBACpD,SAAS,GAAG,WAAW,CAAC;oBAMxB,WAAW,GACf,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,CAAC,SAAS,CAAC,EAAC,CAAC;wBAChC,WAAW,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CAAC,UAAmC;IAC3E,OAAO,UAAC,QAAkB;QACxB,OAAA,QAAQ;aACL,IAAI,EAAE;aACN,IAAI,CAAC,UAAC,QAAQ,IAAK,OAAA,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAjC,CAAiC,CAAC;aACrD,IAAI,CAAC,UAAC,MAAW;YAChB,IACE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBACtB,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;gBACpC,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EACtC,CAAC;gBACD,aAAa;gBACb,gBAAgB,CACd,QAAQ,EACR,MAAM,EACN,iDACE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;oBACzB,UAAU,CAAC,GAAG,CAAC,UAAC,EAAE,IAAK,OAAA,EAAE,CAAC,aAAa,EAAhB,CAAgB,CAAC;oBAC1C,CAAC,CAAC,UAAU,CAAC,aAAa,OACxB,CACL,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;IArBJ,CAqBI,CAAC;AACT,CAAC","sourcesContent":["import { responseIterator } from \"./responseIterator.js\";\nimport type { Operation } from \"../core/index.js\";\nimport { throwServerError } from \"../utils/index.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../../errors/index.js\";\nimport { isApolloPayloadResult } from \"../../utilities/common/incrementalResult.js\";\nimport type { SubscriptionObserver } from \"zen-observable-ts\";\n\nconst { hasOwnProperty } = Object.prototype;\n\nexport type ServerParseError = Error & {\n response: Response;\n statusCode: number;\n bodyText: string;\n};\n\nexport async function readMultipartBody<\n T extends object = Record,\n>(response: Response, nextValue: (value: T) => void) {\n if (TextDecoder === undefined) {\n throw new Error(\n \"TextDecoder must be defined in the environment: please import a polyfill.\"\n );\n }\n const decoder = new TextDecoder(\"utf-8\");\n const contentType = response.headers?.get(\"content-type\");\n const delimiter = \"boundary=\";\n\n // parse boundary value and ignore any subsequent name/value pairs after ;\n // https://www.rfc-editor.org/rfc/rfc9110.html#name-parameters\n // e.g. multipart/mixed;boundary=\"graphql\";deferSpec=20220824\n // if no boundary is specified, default to -\n const boundaryVal =\n contentType?.includes(delimiter) ?\n contentType\n ?.substring(contentType?.indexOf(delimiter) + delimiter.length)\n .replace(/['\"]/g, \"\")\n .replace(/\\;(.*)/gm, \"\")\n .trim()\n : \"-\";\n\n const boundary = `\\r\\n--${boundaryVal}`;\n let buffer = \"\";\n const iterator = responseIterator(response);\n let running = true;\n\n while (running) {\n const { value, done } = await iterator.next();\n const chunk = typeof value === \"string\" ? value : decoder.decode(value);\n const searchFrom = buffer.length - boundary.length + 1;\n running = !done;\n buffer += chunk;\n let bi = buffer.indexOf(boundary, searchFrom);\n\n while (bi > -1) {\n let message: string;\n [message, buffer] = [\n buffer.slice(0, bi),\n buffer.slice(bi + boundary.length),\n ];\n const i = message.indexOf(\"\\r\\n\\r\\n\");\n const headers = parseHeaders(message.slice(0, i));\n const contentType = headers[\"content-type\"];\n if (\n contentType &&\n contentType.toLowerCase().indexOf(\"application/json\") === -1\n ) {\n throw new Error(\n \"Unsupported patch content type: application/json is required.\"\n );\n }\n // nb: Technically you'd want to slice off the beginning \"\\r\\n\" but since\n // this is going to be `JSON.parse`d there is no need.\n const body = message.slice(i);\n\n if (body) {\n const result = parseJsonBody(response, body);\n if (\n Object.keys(result).length > 1 ||\n \"data\" in result ||\n \"incremental\" in result ||\n \"errors\" in result ||\n \"payload\" in result\n ) {\n if (isApolloPayloadResult(result)) {\n let next = {};\n if (\"payload\" in result) {\n next = { ...result.payload };\n }\n if (\"errors\" in result) {\n next = {\n ...next,\n extensions: {\n ...(\"extensions\" in next ? next.extensions : (null as any)),\n [PROTOCOL_ERRORS_SYMBOL]: result.errors,\n },\n };\n }\n nextValue(next as T);\n } else {\n // for the last chunk with only `hasNext: false`\n // we don't need to call observer.next as there is no data/errors\n nextValue(result);\n }\n } else if (\n // If the chunk contains only a \"hasNext: false\", we can call\n // observer.complete() immediately.\n Object.keys(result).length === 1 &&\n \"hasNext\" in result &&\n !result.hasNext\n ) {\n return;\n }\n }\n bi = buffer.indexOf(boundary);\n }\n }\n}\n\nexport function parseHeaders(headerText: string): Record {\n const headersInit: Record = {};\n headerText.split(\"\\n\").forEach((line) => {\n const i = line.indexOf(\":\");\n if (i > -1) {\n // normalize headers to lowercase\n const name = line.slice(0, i).trim().toLowerCase();\n const value = line.slice(i + 1).trim();\n headersInit[name] = value;\n }\n });\n return headersInit;\n}\n\nexport function parseJsonBody(response: Response, bodyText: string): T {\n if (response.status >= 300) {\n // Network error\n const getResult = (): Record | string => {\n try {\n return JSON.parse(bodyText);\n } catch (err) {\n return bodyText;\n }\n };\n throwServerError(\n response,\n getResult(),\n `Response not successful: Received status code ${response.status}`\n );\n }\n\n try {\n return JSON.parse(bodyText) as T;\n } catch (err) {\n const parseError = err as ServerParseError;\n parseError.name = \"ServerParseError\";\n parseError.response = response;\n parseError.statusCode = response.status;\n parseError.bodyText = bodyText;\n throw parseError;\n }\n}\n\nexport function handleError(err: any, observer: SubscriptionObserver) {\n // if it is a network error, BUT there is graphql result info fire\n // the next observer before calling error this gives apollo-client\n // (and react-apollo) the `graphqlErrors` and `networkErrors` to\n // pass to UI this should only happen if we *also* have data as\n // part of the response key per the spec\n if (err.result && err.result.errors && err.result.data) {\n // if we don't call next, the UI can only show networkError\n // because AC didn't get any graphqlErrors this is graphql\n // execution result info (i.e errors and possibly data) this is\n // because there is no formal spec how errors should translate to\n // http status codes. So an auth error (401) could have both data\n // from a public field, errors from a private field, and a status\n // of 401\n // {\n // user { // this will have errors\n // firstName\n // }\n // products { // this is public so will have data\n // cost\n // }\n // }\n //\n // the result of above *could* look like this:\n // {\n // data: { products: [{ cost: \"$10\" }] },\n // errors: [{\n // message: 'your session has timed out',\n // path: []\n // }]\n // }\n // status code of above would be a 401\n // in the UI you want to show data where you can, errors as data where you can\n // and use correct http status codes\n observer.next(err.result);\n }\n\n observer.error(err);\n}\n\nexport function parseAndCheckHttpResponse(operations: Operation | Operation[]) {\n return (response: Response) =>\n response\n .text()\n .then((bodyText) => parseJsonBody(response, bodyText))\n .then((result: any) => {\n if (\n !Array.isArray(result) &&\n !hasOwnProperty.call(result, \"data\") &&\n !hasOwnProperty.call(result, \"errors\")\n ) {\n // Data error\n throwServerError(\n response,\n result,\n `Server response was missing for query '${\n Array.isArray(operations) ?\n operations.map((op) => op.operationName)\n : operations.operationName\n }'.`\n );\n }\n return result;\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.d.ts new file mode 100644 index 0000000..26d9ba3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.d.ts @@ -0,0 +1,7 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts + */ +import type { Response as NodeResponse } from "node-fetch"; +export declare function responseIterator(response: Response | NodeResponse): AsyncIterableIterator; +//# sourceMappingURL=responseIterator.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js b/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js new file mode 100644 index 0000000..9c3a33a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js @@ -0,0 +1,48 @@ +/** + * Original source: + * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts + */ +import { canUseAsyncIteratorSymbol } from "../../utilities/index.js"; +import asyncIterator from "./iterators/async.js"; +import nodeStreamIterator from "./iterators/nodeStream.js"; +import promiseIterator from "./iterators/promise.js"; +import readerIterator from "./iterators/reader.js"; +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +export function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + // this errors without casting to ReadableStream + // because Blob.stream() returns a NodeJS ReadableStream + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} +//# sourceMappingURL=responseIterator.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js.map new file mode 100644 index 0000000..a5dbf12 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"responseIterator.js","sourceRoot":"","sources":["../../../src/link/http/responseIterator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAEnD,SAAS,cAAc,CAAC,KAAU;IAChC,OAAO,CAAC,CAAE,KAAsB,CAAC,IAAI,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAU;IAClC,OAAO,CAAC,CAAE,KAA6B,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAU;IAEV,OAAO,CAAC,CAAC,CACP,yBAAyB;QACxB,KAAoC,CAAC,MAAM,CAAC,aAAa,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAU;IAClC,OAAO,CAAC,CAAE,KAAc,CAAC,MAAM,CAAC;AAClC,CAAC;AAED,SAAS,MAAM,CAAC,KAAU;IACxB,OAAO,CAAC,CAAE,KAAc,CAAC,WAAW,CAAC;AACvC,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAU;IACtC,OAAO,CAAC,CAAE,KAA4B,CAAC,IAAI,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,QAAiC;IAEjC,IAAI,IAAI,GAAY,QAAQ,CAAC;IAE7B,IAAI,cAAc,CAAC,QAAQ,CAAC;QAAE,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAEnD,IAAI,uBAAuB,CAAC,IAAI,CAAC;QAAE,OAAO,aAAa,CAAI,IAAI,CAAC,CAAC;IAEjE,IAAI,gBAAgB,CAAC,IAAI,CAAC;QAAE,OAAO,cAAc,CAAI,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAEvE,mDAAmD;IACnD,wDAAwD;IACxD,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,cAAc,CAClB,IAAI,CAAC,MAAM,EAAmC,CAAC,SAAS,EAAE,CAC5D,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,eAAe,CAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAEhE,IAAI,oBAAoB,CAAC,IAAI,CAAC;QAAE,OAAO,kBAAkB,CAAI,IAAI,CAAC,CAAC;IAEnE,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts\n */\n\nimport type { Response as NodeResponse } from \"node-fetch\";\nimport type { Readable as NodeReadableStream } from \"stream\";\nimport { canUseAsyncIteratorSymbol } from \"../../utilities/index.js\";\n\nimport asyncIterator from \"./iterators/async.js\";\nimport nodeStreamIterator from \"./iterators/nodeStream.js\";\nimport promiseIterator from \"./iterators/promise.js\";\nimport readerIterator from \"./iterators/reader.js\";\n\nfunction isNodeResponse(value: any): value is NodeResponse {\n return !!(value as NodeResponse).body;\n}\n\nfunction isReadableStream(value: any): value is ReadableStream {\n return !!(value as ReadableStream).getReader;\n}\n\nfunction isAsyncIterableIterator(\n value: any\n): value is AsyncIterableIterator {\n return !!(\n canUseAsyncIteratorSymbol &&\n (value as AsyncIterableIterator)[Symbol.asyncIterator]\n );\n}\n\nfunction isStreamableBlob(value: any): value is Blob {\n return !!(value as Blob).stream;\n}\n\nfunction isBlob(value: any): value is Blob {\n return !!(value as Blob).arrayBuffer;\n}\n\nfunction isNodeReadableStream(value: any): value is NodeReadableStream {\n return !!(value as NodeReadableStream).pipe;\n}\n\nexport function responseIterator(\n response: Response | NodeResponse\n): AsyncIterableIterator {\n let body: unknown = response;\n\n if (isNodeResponse(response)) body = response.body;\n\n if (isAsyncIterableIterator(body)) return asyncIterator(body);\n\n if (isReadableStream(body)) return readerIterator(body.getReader());\n\n // this errors without casting to ReadableStream\n // because Blob.stream() returns a NodeJS ReadableStream\n if (isStreamableBlob(body)) {\n return readerIterator(\n (body.stream() as unknown as ReadableStream).getReader()\n );\n }\n\n if (isBlob(body)) return promiseIterator(body.arrayBuffer());\n\n if (isNodeReadableStream(body)) return nodeStreamIterator(body);\n\n throw new Error(\n \"Unknown body type for responseIterator. Please pass a streamable response.\"\n );\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.d.ts new file mode 100644 index 0000000..63edfcb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.d.ts @@ -0,0 +1,9 @@ +import type { Body } from "./selectHttpOptionsAndBody.js"; +export declare function rewriteURIForGET(chosenURI: string, body: Body): { + parseError: unknown; + newURI?: undefined; +} | { + newURI: string; + parseError?: undefined; +}; +//# sourceMappingURL=rewriteURIForGET.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js b/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js new file mode 100644 index 0000000..f0ff8fd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js @@ -0,0 +1,53 @@ +import { serializeFetchParameter } from "./serializeFetchParameter.js"; +// For GET operations, returns the given URI rewritten with parameters, or a +// parse error. +export function rewriteURIForGET(chosenURI, body) { + // Implement the standard HTTP GET serialization, plus 'extensions'. Note + // the extra level of JSON serialization! + var queryParams = []; + var addQueryParam = function (key, value) { + queryParams.push("".concat(key, "=").concat(encodeURIComponent(value))); + }; + if ("query" in body) { + addQueryParam("query", body.query); + } + if (body.operationName) { + addQueryParam("operationName", body.operationName); + } + if (body.variables) { + var serializedVariables = void 0; + try { + serializedVariables = serializeFetchParameter(body.variables, "Variables map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("variables", serializedVariables); + } + if (body.extensions) { + var serializedExtensions = void 0; + try { + serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map"); + } + catch (parseError) { + return { parseError: parseError }; + } + addQueryParam("extensions", serializedExtensions); + } + // Reconstruct the URI with added query params. + // XXX This assumes that the URI is well-formed and that it doesn't + // already contain any of these query params. We could instead use the + // URL API and take a polyfill (whatwg-url@6) for older browsers that + // don't support URLSearchParams. Note that some browsers (and + // versions of whatwg-url) support URL but not URLSearchParams! + var fragment = "", preFragment = chosenURI; + var fragmentStart = chosenURI.indexOf("#"); + if (fragmentStart !== -1) { + fragment = chosenURI.substr(fragmentStart); + preFragment = chosenURI.substr(0, fragmentStart); + } + var queryParamsPrefix = preFragment.indexOf("?") === -1 ? "?" : "&"; + var newURI = preFragment + queryParamsPrefix + queryParams.join("&") + fragment; + return { newURI: newURI }; +} +//# sourceMappingURL=rewriteURIForGET.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js.map new file mode 100644 index 0000000..a0ed32c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rewriteURIForGET.js","sourceRoot":"","sources":["../../../src/link/http/rewriteURIForGET.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,4EAA4E;AAC5E,eAAe;AACf,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,IAAU;IAC5D,yEAAyE;IACzE,yCAAyC;IACzC,IAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAM,aAAa,GAAG,UAAC,GAAW,EAAE,KAAa;QAC/C,WAAW,CAAC,IAAI,CAAC,UAAG,GAAG,cAAI,kBAAkB,CAAC,KAAK,CAAC,CAAE,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEF,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,KAAM,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,IAAI,mBAAmB,SAAA,CAAC;QACxB,IAAI,CAAC;YACH,mBAAmB,GAAG,uBAAuB,CAC3C,IAAI,CAAC,SAAS,EACd,eAAe,CAChB,CAAC;QACJ,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACpB,OAAO,EAAE,UAAU,YAAA,EAAE,CAAC;QACxB,CAAC;QACD,aAAa,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,IAAI,oBAAoB,SAAA,CAAC;QACzB,IAAI,CAAC;YACH,oBAAoB,GAAG,uBAAuB,CAC5C,IAAI,CAAC,UAAU,EACf,gBAAgB,CACjB,CAAC;QACJ,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACpB,OAAO,EAAE,UAAU,YAAA,EAAE,CAAC;QACxB,CAAC;QACD,aAAa,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IACpD,CAAC;IAED,+CAA+C;IAC/C,mEAAmE;IACnE,0EAA0E;IAC1E,yEAAyE;IACzE,kEAAkE;IAClE,mEAAmE;IACnE,IAAI,QAAQ,GAAG,EAAE,EACf,WAAW,GAAG,SAAS,CAAC;IAC1B,IAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACzB,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC3C,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IACD,IAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACtE,IAAM,MAAM,GACV,WAAW,GAAG,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACrE,OAAO,EAAE,MAAM,QAAA,EAAE,CAAC;AACpB,CAAC","sourcesContent":["import { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nimport type { Body } from \"./selectHttpOptionsAndBody.js\";\n\n// For GET operations, returns the given URI rewritten with parameters, or a\n// parse error.\nexport function rewriteURIForGET(chosenURI: string, body: Body) {\n // Implement the standard HTTP GET serialization, plus 'extensions'. Note\n // the extra level of JSON serialization!\n const queryParams: string[] = [];\n const addQueryParam = (key: string, value: string) => {\n queryParams.push(`${key}=${encodeURIComponent(value)}`);\n };\n\n if (\"query\" in body) {\n addQueryParam(\"query\", body.query!);\n }\n if (body.operationName) {\n addQueryParam(\"operationName\", body.operationName);\n }\n if (body.variables) {\n let serializedVariables;\n try {\n serializedVariables = serializeFetchParameter(\n body.variables,\n \"Variables map\"\n );\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"variables\", serializedVariables);\n }\n if (body.extensions) {\n let serializedExtensions;\n try {\n serializedExtensions = serializeFetchParameter(\n body.extensions,\n \"Extensions map\"\n );\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"extensions\", serializedExtensions);\n }\n\n // Reconstruct the URI with added query params.\n // XXX This assumes that the URI is well-formed and that it doesn't\n // already contain any of these query params. We could instead use the\n // URL API and take a polyfill (whatwg-url@6) for older browsers that\n // don't support URLSearchParams. Note that some browsers (and\n // versions of whatwg-url) support URL but not URLSearchParams!\n let fragment = \"\",\n preFragment = chosenURI;\n const fragmentStart = chosenURI.indexOf(\"#\");\n if (fragmentStart !== -1) {\n fragment = chosenURI.substr(fragmentStart);\n preFragment = chosenURI.substr(0, fragmentStart);\n }\n const queryParamsPrefix = preFragment.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n const newURI =\n preFragment + queryParamsPrefix + queryParams.join(\"&\") + fragment;\n return { newURI };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.d.ts new file mode 100644 index 0000000..0641afd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.d.ts @@ -0,0 +1,103 @@ +import type { ASTNode } from "graphql"; +import { print } from "../../utilities/index.js"; +import type { Operation } from "../core/index.js"; +export interface Printer { + (node: ASTNode, originalPrint: typeof print): string; +} +export interface UriFunction { + (operation: Operation): string; +} +export interface Body { + query?: string; + operationName?: string; + variables?: Record; + extensions?: Record; +} +export interface HttpOptions { + /** + * The URI to use when fetching operations. + * + * Defaults to '/graphql'. + */ + uri?: string | UriFunction; + /** + * Passes the extensions field to your graphql server. + * + * Defaults to false. + */ + includeExtensions?: boolean; + /** + * A `fetch`-compatible API to use when making requests. + */ + fetch?: typeof fetch; + /** + * An object representing values to be sent as headers on the request. + */ + headers?: Record; + /** + * If set to true, header names won't be automatically normalized to + * lowercase. This allows for non-http-spec-compliant servers that might + * expect capitalized header names. + */ + preserveHeaderCase?: boolean; + /** + * The credentials policy you want to use for the fetch call. + */ + credentials?: string; + /** + * Any overrides of the fetch options argument to pass to the fetch call. + */ + fetchOptions?: any; + /** + * If set to true, use the HTTP GET method for query operations. Mutations + * will still use the method specified in fetchOptions.method (which defaults + * to POST). + */ + useGETForQueries?: boolean; + /** + * If set to true, the default behavior of stripping unused variables + * from the request will be disabled. + * + * Unused variables are likely to trigger server-side validation errors, + * per https://spec.graphql.org/draft/#sec-All-Variables-Used, but this + * includeUnusedVariables option can be useful if your server deviates + * from the GraphQL specification by not strictly enforcing that rule. + */ + includeUnusedVariables?: boolean; + /** + * A function to substitute for the default query print function. Can be + * used to apply changes to the results of the print function. + */ + print?: Printer; +} +export interface HttpQueryOptions { + includeQuery?: boolean; + includeExtensions?: boolean; + preserveHeaderCase?: boolean; +} +export interface HttpConfig { + http?: HttpQueryOptions; + options?: any; + headers?: Record; + credentials?: any; +} +export declare const fallbackHttpConfig: { + http: HttpQueryOptions; + headers: { + accept: string; + "content-type": string; + }; + options: { + method: string; + }; +}; +export declare const defaultPrinter: Printer; +export declare function selectHttpOptionsAndBody(operation: Operation, fallbackConfig: HttpConfig, ...configs: Array): { + options: HttpConfig & Record; + body: Body; +}; +export declare function selectHttpOptionsAndBodyInternal(operation: Operation, printer: Printer, ...configs: HttpConfig[]): { + options: HttpConfig & Record; + body: Body; +}; +//# sourceMappingURL=selectHttpOptionsAndBody.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js b/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js new file mode 100644 index 0000000..d116f03 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js @@ -0,0 +1,102 @@ +import { __assign, __spreadArray } from "tslib"; +import { print } from "../../utilities/index.js"; +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + // headers are case insensitive (https://stackoverflow.com/a/5259004) + accept: "*/*", + // The content-type header describes the type of the body of the request, and + // so it typically only is sent with requests that actually have bodies. One + // could imagine that Apollo Client would remove this header when constructing + // a GET request (which has no body), but we historically have not done that. + // This means that browsers will preflight all Apollo Client requests (even + // GET requests). Apollo Server's CSRF prevention feature (introduced in + // AS3.7) takes advantage of this fact and does not block requests with this + // header. If you want to drop this header from GET requests, then you should + // probably replace it with a `apollo-require-preflight` header, or servers + // with CSRF prevention enabled might block your GET request. See + // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf + // for more details. + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +export var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; +export var defaultPrinter = function (ast, printer) { return printer(ast); }; +export function selectHttpOptionsAndBody(operation, fallbackConfig) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + configs.unshift(fallbackConfig); + return selectHttpOptionsAndBodyInternal.apply(void 0, __spreadArray([operation, + defaultPrinter], configs, false)); +} +export function selectHttpOptionsAndBodyInternal(operation, printer) { + var configs = []; + for (var _i = 2; _i < arguments.length; _i++) { + configs[_i - 2] = arguments[_i]; + } + var options = {}; + var http = {}; + configs.forEach(function (config) { + options = __assign(__assign(__assign({}, options), config.options), { headers: __assign(__assign({}, options.headers), config.headers) }); + if (config.credentials) { + options.credentials = config.credentials; + } + http = __assign(__assign({}, http), config.http); + }); + if (options.headers) { + options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase); + } + //The body depends on the http options + var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; + var body = { operationName: operationName, variables: variables }; + if (http.includeExtensions) + body.extensions = extensions; + // not sending the query (i.e persisted queries) + if (http.includeQuery) + body.query = printer(query, print); + return { + options: options, + body: body, + }; +} +// Remove potential duplicate header names, preserving last (by insertion order). +// This is done to prevent unintentionally duplicating a header instead of +// overwriting it (See #8447 and #8449). +function removeDuplicateHeaders(headers, preserveHeaderCase) { + // If we're not preserving the case, just remove duplicates w/ normalization. + if (!preserveHeaderCase) { + var normalizedHeaders_1 = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + normalizedHeaders_1[name.toLowerCase()] = headers[name]; + }); + return normalizedHeaders_1; + } + // If we are preserving the case, remove duplicates w/ normalization, + // preserving the original name. + // This allows for non-http-spec-compliant servers that expect intentionally + // capitalized header names (See #6741). + var headerData = Object.create(null); + Object.keys(Object(headers)).forEach(function (name) { + headerData[name.toLowerCase()] = { + originalName: name, + value: headers[name], + }; + }); + var normalizedHeaders = Object.create(null); + Object.keys(headerData).forEach(function (name) { + normalizedHeaders[headerData[name].originalName] = headerData[name].value; + }); + return normalizedHeaders; +} +//# sourceMappingURL=selectHttpOptionsAndBody.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js.map new file mode 100644 index 0000000..e7a4bfd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectHttpOptionsAndBody.js","sourceRoot":"","sources":["../../../src/link/http/selectHttpOptionsAndBody.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAkGjD,IAAM,kBAAkB,GAAqB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C,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QACH,OAAO,mBAAiB,CAAC;IAC3B,CAAC;IAED,qEAAqE;IACrE,gCAAgC;IAChC,4EAA4E;IAC5E,wCAAwC;IACxC,IAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI;QACxC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG;YAC/B,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;SACrB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI;QACnC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;IAC5E,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["import type { ASTNode } from \"graphql\";\nimport { print } from \"../../utilities/index.js\";\n\nimport type { Operation } from \"../core/index.js\";\n\nexport interface Printer {\n (node: ASTNode, originalPrint: typeof print): string;\n}\n\nexport interface UriFunction {\n (operation: Operation): string;\n}\n\nexport interface Body {\n query?: string;\n operationName?: string;\n variables?: Record;\n extensions?: Record;\n}\n\nexport interface HttpOptions {\n /**\n * The URI to use when fetching operations.\n *\n * Defaults to '/graphql'.\n */\n uri?: string | UriFunction;\n\n /**\n * Passes the extensions field to your graphql server.\n *\n * Defaults to false.\n */\n includeExtensions?: boolean;\n\n /**\n * A `fetch`-compatible API to use when making requests.\n */\n fetch?: typeof fetch;\n\n /**\n * An object representing values to be sent as headers on the request.\n */\n headers?: Record;\n\n /**\n * If set to true, header names won't be automatically normalized to\n * lowercase. This allows for non-http-spec-compliant servers that might\n * expect capitalized header names.\n */\n preserveHeaderCase?: boolean;\n\n /**\n * The credentials policy you want to use for the fetch call.\n */\n credentials?: string;\n\n /**\n * Any overrides of the fetch options argument to pass to the fetch call.\n */\n fetchOptions?: any;\n\n /**\n * If set to true, use the HTTP GET method for query operations. Mutations\n * will still use the method specified in fetchOptions.method (which defaults\n * to POST).\n */\n useGETForQueries?: boolean;\n\n /**\n * If set to true, the default behavior of stripping unused variables\n * from the request will be disabled.\n *\n * Unused variables are likely to trigger server-side validation errors,\n * per https://spec.graphql.org/draft/#sec-All-Variables-Used, but this\n * includeUnusedVariables option can be useful if your server deviates\n * from the GraphQL specification by not strictly enforcing that rule.\n */\n includeUnusedVariables?: boolean;\n /**\n * A function to substitute for the default query print function. Can be\n * used to apply changes to the results of the print function.\n */\n print?: Printer;\n}\n\nexport interface HttpQueryOptions {\n includeQuery?: boolean;\n includeExtensions?: boolean;\n preserveHeaderCase?: boolean;\n}\n\nexport interface HttpConfig {\n http?: HttpQueryOptions;\n options?: any;\n headers?: Record;\n credentials?: any;\n}\n\nconst defaultHttpOptions: HttpQueryOptions = {\n includeQuery: true,\n includeExtensions: false,\n preserveHeaderCase: false,\n};\n\nconst defaultHeaders = {\n // headers are case insensitive (https://stackoverflow.com/a/5259004)\n accept: \"*/*\",\n // The content-type header describes the type of the body of the request, and\n // so it typically only is sent with requests that actually have bodies. One\n // could imagine that Apollo Client would remove this header when constructing\n // a GET request (which has no body), but we historically have not done that.\n // This means that browsers will preflight all Apollo Client requests (even\n // GET requests). Apollo Server's CSRF prevention feature (introduced in\n // AS3.7) takes advantage of this fact and does not block requests with this\n // header. If you want to drop this header from GET requests, then you should\n // probably replace it with a `apollo-require-preflight` header, or servers\n // with CSRF prevention enabled might block your GET request. See\n // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf\n // for more details.\n \"content-type\": \"application/json\",\n};\n\nconst defaultOptions = {\n method: \"POST\",\n};\n\nexport const fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\n\nexport const defaultPrinter: Printer = (ast, printer) => printer(ast);\n\nexport function selectHttpOptionsAndBody(\n operation: Operation,\n fallbackConfig: HttpConfig,\n ...configs: Array\n) {\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal(\n operation,\n defaultPrinter,\n ...configs\n );\n}\n\nexport function selectHttpOptionsAndBodyInternal(\n operation: Operation,\n printer: Printer,\n ...configs: HttpConfig[]\n) {\n let options = {} as HttpConfig & Record;\n let http = {} as HttpQueryOptions;\n\n configs.forEach((config) => {\n options = {\n ...options,\n ...config.options,\n headers: {\n ...options.headers,\n ...config.headers,\n },\n };\n\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n\n http = {\n ...http,\n ...config.http,\n };\n });\n\n if (options.headers) {\n options.headers = removeDuplicateHeaders(\n options.headers,\n http.preserveHeaderCase\n );\n }\n\n //The body depends on the http options\n const { operationName, extensions, variables, query } = operation;\n const body: Body = { operationName, variables };\n\n if (http.includeExtensions) (body as any).extensions = extensions;\n\n // not sending the query (i.e persisted queries)\n if (http.includeQuery) (body as any).query = printer(query, print);\n\n return {\n options,\n body,\n };\n}\n\n// Remove potential duplicate header names, preserving last (by insertion order).\n// This is done to prevent unintentionally duplicating a header instead of\n// overwriting it (See #8447 and #8449).\nfunction removeDuplicateHeaders(\n headers: Record,\n preserveHeaderCase: boolean | undefined\n): typeof headers {\n // If we're not preserving the case, just remove duplicates w/ normalization.\n if (!preserveHeaderCase) {\n const normalizedHeaders = Object.create(null);\n Object.keys(Object(headers)).forEach((name) => {\n normalizedHeaders[name.toLowerCase()] = headers[name];\n });\n return normalizedHeaders;\n }\n\n // If we are preserving the case, remove duplicates w/ normalization,\n // preserving the original name.\n // This allows for non-http-spec-compliant servers that expect intentionally\n // capitalized header names (See #6741).\n const headerData = Object.create(null);\n Object.keys(Object(headers)).forEach((name) => {\n headerData[name.toLowerCase()] = {\n originalName: name,\n value: headers[name],\n };\n });\n\n const normalizedHeaders = Object.create(null);\n Object.keys(headerData).forEach((name) => {\n normalizedHeaders[headerData[name].originalName] = headerData[name].value;\n });\n return normalizedHeaders;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.d.ts new file mode 100644 index 0000000..f45c413 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.d.ts @@ -0,0 +1,3 @@ +import type { Operation } from "../core/index.js"; +export declare const selectURI: (operation: Operation, fallbackURI?: string | ((operation: Operation) => string) | undefined) => any; +//# sourceMappingURL=selectURI.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js b/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js new file mode 100644 index 0000000..af24740 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js @@ -0,0 +1,14 @@ +export var selectURI = function (operation, fallbackURI) { + var context = operation.getContext(); + var contextURI = context.uri; + if (contextURI) { + return contextURI; + } + else if (typeof fallbackURI === "function") { + return fallbackURI(operation); + } + else { + return fallbackURI || "/graphql"; + } +}; +//# sourceMappingURL=selectURI.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js.map new file mode 100644 index 0000000..5697b97 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectURI.js","sourceRoot":"","sources":["../../../src/link/http/selectURI.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,SAAS,GAAG,UACvB,SAAoB,EACpB,WAAyD;IAEzD,IAAM,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;IACvC,IAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAE/B,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAQ,WAAsB,IAAI,UAAU,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { Operation } from \"../core/index.js\";\n\nexport const selectURI = (\n operation: Operation,\n fallbackURI?: string | ((operation: Operation) => string)\n) => {\n const context = operation.getContext();\n const contextURI = context.uri;\n\n if (contextURI) {\n return contextURI;\n } else if (typeof fallbackURI === \"function\") {\n return fallbackURI(operation);\n } else {\n return (fallbackURI as string) || \"/graphql\";\n }\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.d.ts b/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.d.ts new file mode 100644 index 0000000..9502c81 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.d.ts @@ -0,0 +1,6 @@ +import type { InvariantError } from "../../utilities/globals/index.js"; +export type ClientParseError = InvariantError & { + parseError: Error; +}; +export declare const serializeFetchParameter: (p: any, label: string) => string; +//# sourceMappingURL=serializeFetchParameter.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js b/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js new file mode 100644 index 0000000..8277d69 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js @@ -0,0 +1,14 @@ +import { newInvariantError } from "../../utilities/globals/index.js"; +export var serializeFetchParameter = function (p, label) { + var serialized; + try { + serialized = JSON.stringify(p); + } + catch (e) { + var parseError = newInvariantError(39, label, e.message); + parseError.parseError = e; + throw parseError; + } + return serialized; +}; +//# sourceMappingURL=serializeFetchParameter.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js.map b/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js.map new file mode 100644 index 0000000..1e2b85a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"serializeFetchParameter.js","sourceRoot":"","sources":["../../../src/link/http/serializeFetchParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAOrE,MAAM,CAAC,IAAM,uBAAuB,GAAG,UAAC,CAAM,EAAE,KAAa;IAC3D,IAAI,UAAU,CAAC;IACf,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAM,UAAU,GAAG,iBAAiB,CAClC,oDAAoD,EACpD,KAAK,EACL,CAAC,CAAC,OAAO,CACU,CAAC;QACtB,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC;QAC1B,MAAM,UAAU,CAAC;IACnB,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { newInvariantError } from \"../../utilities/globals/index.js\";\nimport type { InvariantError } from \"../../utilities/globals/index.js\";\n\nexport type ClientParseError = InvariantError & {\n parseError: Error;\n};\n\nexport const serializeFetchParameter = (p: any, label: string) => {\n let serialized;\n try {\n serialized = JSON.stringify(p);\n } catch (e: any) {\n const parseError = newInvariantError(\n `Network request failed. %s is not serializable: %s`,\n label,\n e.message\n ) as ClientParseError;\n parseError.parseError = e;\n throw parseError;\n }\n return serialized;\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.d.ts new file mode 100644 index 0000000..ff7977f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.d.ts @@ -0,0 +1,48 @@ +import type { DocumentNode, ExecutionResult, GraphQLError } from "graphql"; +import type { Operation } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import type { NetworkError } from "../../errors/index.js"; +export declare const VERSION = 1; +export interface ErrorResponse { + graphQLErrors?: readonly GraphQLError[]; + networkError?: NetworkError; + response?: ExecutionResult; + operation: Operation; + meta: ErrorMeta; +} +type ErrorMeta = { + persistedQueryNotSupported: boolean; + persistedQueryNotFound: boolean; +}; +type SHA256Function = (...args: any[]) => string | PromiseLike; +type GenerateHashFunction = (document: DocumentNode) => string | PromiseLike; +interface BaseOptions { + disable?: (error: ErrorResponse) => boolean; + retry?: (error: ErrorResponse) => boolean; + useGETForHashedQueries?: boolean; +} +export declare namespace PersistedQueryLink { + interface SHA256Options extends BaseOptions { + sha256: SHA256Function; + generateHash?: never; + } + interface GenerateHashOptions extends BaseOptions { + sha256?: never; + generateHash: GenerateHashFunction; + } + export type Options = SHA256Options | GenerateHashOptions; + export {}; +} +export declare const createPersistedQueryLink: (options: PersistedQueryLink.Options) => ApolloLink & { + resetHashCache: () => void; +} & ({ + getMemoryInternals(): { + PersistedQueryLink: { + persistedQueryHashes: number; + }; + }; +} | { + getMemoryInternals?: undefined; +}); +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js new file mode 100644 index 0000000..b1d9394 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js @@ -0,0 +1,219 @@ +import { __assign } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +import { print } from "../../utilities/index.js"; +import { ApolloLink } from "../core/index.js"; +import { Observable, compact, isNonEmptyArray } from "../../utilities/index.js"; +import { cacheSizes, AutoCleanedWeakCache, } from "../../utilities/index.js"; +export var VERSION = 1; +function processErrors(graphQLErrors) { + var byMessage = Object.create(null), byCode = Object.create(null); + if (isNonEmptyArray(graphQLErrors)) { + graphQLErrors.forEach(function (error) { + var _a; + byMessage[error.message] = error; + if (typeof ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.code) == "string") + byCode[error.extensions.code] = error; + }); + } + return { + persistedQueryNotSupported: !!(byMessage.PersistedQueryNotSupported || + byCode.PERSISTED_QUERY_NOT_SUPPORTED), + persistedQueryNotFound: !!(byMessage.PersistedQueryNotFound || byCode.PERSISTED_QUERY_NOT_FOUND), + }; +} +var defaultOptions = { + disable: function (_a) { + var meta = _a.meta; + return meta.persistedQueryNotSupported; + }, + retry: function (_a) { + var meta = _a.meta; + return meta.persistedQueryNotSupported || meta.persistedQueryNotFound; + }, + useGETForHashedQueries: false, +}; +function operationDefinesMutation(operation) { + return operation.query.definitions.some(function (d) { return d.kind === "OperationDefinition" && d.operation === "mutation"; }); +} +export var createPersistedQueryLink = function (options) { + var hashesByQuery; + function resetHashCache() { + hashesByQuery = undefined; + } + // Ensure a SHA-256 hash function is provided, if a custom hash + // generation function is not provided. We don't supply a SHA-256 hash + // function by default, to avoid forcing one as a dependency. Developers + // should pick the most appropriate SHA-256 function (sync or async) for + // their needs/environment, or provide a fully custom hash generation + // function (via the `generateHash` option) if they want to handle + // hashing with something other than SHA-256. + invariant(options && + (typeof options.sha256 === "function" || + typeof options.generateHash === "function"), 40); + var _a = compact(defaultOptions, options), sha256 = _a.sha256, + // If both a `sha256` and `generateHash` option are provided, the + // `sha256` option will be ignored. Developers can configure and + // use any hashing approach they want in a custom `generateHash` + // function; they aren't limited to SHA-256. + _b = _a.generateHash, + // If both a `sha256` and `generateHash` option are provided, the + // `sha256` option will be ignored. Developers can configure and + // use any hashing approach they want in a custom `generateHash` + // function; they aren't limited to SHA-256. + generateHash = _b === void 0 ? function (query) { + return Promise.resolve(sha256(print(query))); + } : _b, disable = _a.disable, retry = _a.retry, useGETForHashedQueries = _a.useGETForHashedQueries; + var supportsPersistedQueries = true; + var getHashPromise = function (query) { + return new Promise(function (resolve) { return resolve(generateHash(query)); }); + }; + function getQueryHash(query) { + if (!query || typeof query !== "object") { + // If the query is not an object, we won't be able to store its hash as + // a property of query[hashesKey], so we let generateHash(query) decide + // what to do with the bogus query. + return getHashPromise(query); + } + if (!hashesByQuery) { + hashesByQuery = new AutoCleanedWeakCache(cacheSizes["PersistedQueryLink.persistedQueryHashes"] || + 2000 /* defaultCacheSizes["PersistedQueryLink.persistedQueryHashes"] */); + } + var hash = hashesByQuery.get(query); + if (!hash) + hashesByQuery.set(query, (hash = getHashPromise(query))); + return hash; + } + return Object.assign(new ApolloLink(function (operation, forward) { + invariant(forward, 41); + var query = operation.query; + return new Observable(function (observer) { + var subscription; + var retried = false; + var originalFetchOptions; + var setFetchOptions = false; + var maybeRetry = function (_a, cb) { + var response = _a.response, networkError = _a.networkError; + if (!retried && ((response && response.errors) || networkError)) { + retried = true; + var graphQLErrors = []; + var responseErrors = response && response.errors; + if (isNonEmptyArray(responseErrors)) { + graphQLErrors.push.apply(graphQLErrors, responseErrors); + } + // Network errors can return GraphQL errors on for example a 403 + var networkErrors = void 0; + if (typeof (networkError === null || networkError === void 0 ? void 0 : networkError.result) !== "string") { + networkErrors = + networkError && + networkError.result && + networkError.result.errors; + } + if (isNonEmptyArray(networkErrors)) { + graphQLErrors.push.apply(graphQLErrors, networkErrors); + } + var disablePayload = { + response: response, + networkError: networkError, + operation: operation, + graphQLErrors: isNonEmptyArray(graphQLErrors) ? graphQLErrors : void 0, + meta: processErrors(graphQLErrors), + }; + // if the server doesn't support persisted queries, don't try anymore + supportsPersistedQueries = !disable(disablePayload); + if (!supportsPersistedQueries) { + // clear hashes from cache, we don't need them anymore + resetHashCache(); + } + // if its not found, we can try it again, otherwise just report the error + if (retry(disablePayload)) { + // need to recall the link chain + if (subscription) + subscription.unsubscribe(); + // actually send the query this time + operation.setContext({ + http: { + includeQuery: true, + includeExtensions: supportsPersistedQueries, + }, + fetchOptions: { + // Since we're including the full query, which may be + // large, we should send it in the body of a POST request. + // See issue #7456. + method: "POST", + }, + }); + if (setFetchOptions) { + operation.setContext({ fetchOptions: originalFetchOptions }); + } + subscription = forward(operation).subscribe(handler); + return; + } + } + cb(); + }; + var handler = { + next: function (response) { + maybeRetry({ response: response }, function () { return observer.next(response); }); + }, + error: function (networkError) { + maybeRetry({ networkError: networkError }, function () { return observer.error(networkError); }); + }, + complete: observer.complete.bind(observer), + }; + // don't send the query the first time + operation.setContext({ + http: { + includeQuery: !supportsPersistedQueries, + includeExtensions: supportsPersistedQueries, + }, + }); + // If requested, set method to GET if there are no mutations. Remember the + // original fetchOptions so we can restore them if we fall back to a + // non-hashed request. + if (useGETForHashedQueries && + supportsPersistedQueries && + !operationDefinesMutation(operation)) { + operation.setContext(function (_a) { + var _b = _a.fetchOptions, fetchOptions = _b === void 0 ? {} : _b; + originalFetchOptions = fetchOptions; + return { + fetchOptions: __assign(__assign({}, fetchOptions), { method: "GET" }), + }; + }); + setFetchOptions = true; + } + if (supportsPersistedQueries) { + getQueryHash(query) + .then(function (sha256Hash) { + operation.extensions.persistedQuery = { + version: VERSION, + sha256Hash: sha256Hash, + }; + subscription = forward(operation).subscribe(handler); + }) + .catch(observer.error.bind(observer)); + } + else { + subscription = forward(operation).subscribe(handler); + } + return function () { + if (subscription) + subscription.unsubscribe(); + }; + }); + }), { + resetHashCache: resetHashCache, + }, globalThis.__DEV__ !== false ? + { + getMemoryInternals: function () { + var _a; + return { + PersistedQueryLink: { + persistedQueryHashes: (_a = hashesByQuery === null || hashesByQuery === void 0 ? void 0 : hashesByQuery.size) !== null && _a !== void 0 ? _a : 0, + }, + }; + }, + } + : {}); +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js.map new file mode 100644 index 0000000..52b738d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/persisted-queries/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAK9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhF,OAAO,EACL,UAAU,EACV,oBAAoB,GAErB,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,IAAM,OAAO,GAAG,CAAC,CAAC;AAwCzB,SAAS,aAAa,CACpB,aAAmE;IAEnE,IAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EACnC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,eAAe,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,aAAa,CAAC,OAAO,CAAC,UAAC,KAAK;;YAC1B,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACjC,IAAI,OAAO,CAAA,MAAA,KAAK,CAAC,UAAU,0CAAE,IAAI,CAAA,IAAI,QAAQ;gBAC3C,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO;QACL,0BAA0B,EAAE,CAAC,CAAC,CAC5B,SAAS,CAAC,0BAA0B;YACpC,MAAM,CAAC,6BAA6B,CACrC;QACD,sBAAsB,EAAE,CAAC,CAAC,CACxB,SAAS,CAAC,sBAAsB,IAAI,MAAM,CAAC,yBAAyB,CACrE;KACF,CAAC;AACJ,CAAC;AAED,IAAM,cAAc,GAA0B;IAC5C,OAAO,EAAE,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,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport { print } from \"../../utilities/index.js\";\nimport type { DocumentNode, ExecutionResult, GraphQLError } from \"graphql\";\n\nimport type { Operation } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type {\n Observer,\n ObservableSubscription,\n} from \"../../utilities/index.js\";\nimport { Observable, compact, isNonEmptyArray } from \"../../utilities/index.js\";\nimport type { NetworkError } from \"../../errors/index.js\";\nimport type { ServerError } from \"../utils/index.js\";\nimport {\n cacheSizes,\n AutoCleanedWeakCache,\n defaultCacheSizes,\n} from \"../../utilities/index.js\";\n\nexport const VERSION = 1;\n\nexport interface ErrorResponse {\n graphQLErrors?: readonly GraphQLError[];\n networkError?: NetworkError;\n response?: ExecutionResult;\n operation: Operation;\n meta: ErrorMeta;\n}\n\ntype ErrorMeta = {\n persistedQueryNotSupported: boolean;\n persistedQueryNotFound: boolean;\n};\n\ntype SHA256Function = (...args: any[]) => string | PromiseLike;\ntype GenerateHashFunction = (\n document: DocumentNode\n) => string | PromiseLike;\n\ninterface BaseOptions {\n disable?: (error: ErrorResponse) => boolean;\n retry?: (error: ErrorResponse) => boolean;\n useGETForHashedQueries?: boolean;\n}\n\nexport namespace PersistedQueryLink {\n interface SHA256Options extends BaseOptions {\n sha256: SHA256Function;\n generateHash?: never;\n }\n\n interface GenerateHashOptions extends BaseOptions {\n sha256?: never;\n generateHash: GenerateHashFunction;\n }\n\n export type Options = SHA256Options | GenerateHashOptions;\n}\n\nfunction processErrors(\n graphQLErrors: GraphQLError[] | readonly GraphQLError[] | undefined\n): ErrorMeta {\n const byMessage = Object.create(null),\n byCode = Object.create(null);\n\n if (isNonEmptyArray(graphQLErrors)) {\n graphQLErrors.forEach((error) => {\n byMessage[error.message] = error;\n if (typeof error.extensions?.code == \"string\")\n byCode[error.extensions.code] = error;\n });\n }\n return {\n persistedQueryNotSupported: !!(\n byMessage.PersistedQueryNotSupported ||\n byCode.PERSISTED_QUERY_NOT_SUPPORTED\n ),\n persistedQueryNotFound: !!(\n byMessage.PersistedQueryNotFound || byCode.PERSISTED_QUERY_NOT_FOUND\n ),\n };\n}\n\nconst defaultOptions: Required = {\n disable: ({ meta }) => meta.persistedQueryNotSupported,\n retry: ({ meta }) =>\n meta.persistedQueryNotSupported || meta.persistedQueryNotFound,\n useGETForHashedQueries: false,\n};\n\nfunction operationDefinesMutation(operation: Operation) {\n return operation.query.definitions.some(\n (d) => d.kind === \"OperationDefinition\" && d.operation === \"mutation\"\n );\n}\n\nexport const createPersistedQueryLink = (\n options: PersistedQueryLink.Options\n) => {\n let hashesByQuery:\n | AutoCleanedWeakCache>\n | undefined;\n function resetHashCache() {\n hashesByQuery = undefined;\n }\n // Ensure a SHA-256 hash function is provided, if a custom hash\n // generation function is not provided. We don't supply a SHA-256 hash\n // function by default, to avoid forcing one as a dependency. Developers\n // should pick the most appropriate SHA-256 function (sync or async) for\n // their needs/environment, or provide a fully custom hash generation\n // function (via the `generateHash` option) if they want to handle\n // hashing with something other than SHA-256.\n invariant(\n options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\"),\n 'Missing/invalid \"sha256\" or \"generateHash\" function. Please ' +\n 'configure one using the \"createPersistedQueryLink(options)\" options ' +\n \"parameter.\"\n );\n\n const {\n sha256,\n // If both a `sha256` and `generateHash` option are provided, the\n // `sha256` option will be ignored. Developers can configure and\n // use any hashing approach they want in a custom `generateHash`\n // function; they aren't limited to SHA-256.\n generateHash = (query: DocumentNode) =>\n Promise.resolve(sha256!(print(query))),\n disable,\n retry,\n useGETForHashedQueries,\n } = compact(defaultOptions, options);\n\n let supportsPersistedQueries = true;\n\n const getHashPromise = (query: DocumentNode) =>\n new Promise((resolve) => resolve(generateHash(query)));\n\n function getQueryHash(query: DocumentNode): Promise {\n if (!query || typeof query !== \"object\") {\n // If the query is not an object, we won't be able to store its hash as\n // a property of query[hashesKey], so we let generateHash(query) decide\n // what to do with the bogus query.\n return getHashPromise(query);\n }\n if (!hashesByQuery) {\n hashesByQuery = new AutoCleanedWeakCache(\n cacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] ||\n defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"]\n );\n }\n let hash = hashesByQuery.get(query)!;\n if (!hash) hashesByQuery.set(query, (hash = getHashPromise(query)));\n return hash;\n }\n\n return Object.assign(\n new ApolloLink((operation, forward) => {\n invariant(\n forward,\n \"PersistedQueryLink cannot be the last link in the chain.\"\n );\n\n const { query } = operation;\n\n return new Observable((observer: Observer) => {\n let subscription: ObservableSubscription;\n let retried = false;\n let originalFetchOptions: any;\n let setFetchOptions = false;\n const maybeRetry = (\n {\n response,\n networkError,\n }: { response?: ExecutionResult; networkError?: ServerError },\n cb: () => void\n ) => {\n if (!retried && ((response && response.errors) || networkError)) {\n retried = true;\n\n const graphQLErrors: GraphQLError[] = [];\n\n const responseErrors = response && response.errors;\n if (isNonEmptyArray(responseErrors)) {\n graphQLErrors.push(...responseErrors);\n }\n\n // Network errors can return GraphQL errors on for example a 403\n let networkErrors;\n if (typeof networkError?.result !== \"string\") {\n networkErrors =\n networkError &&\n networkError.result &&\n (networkError.result.errors as GraphQLError[]);\n }\n if (isNonEmptyArray(networkErrors)) {\n graphQLErrors.push(...networkErrors);\n }\n\n const disablePayload: ErrorResponse = {\n response,\n networkError,\n operation,\n graphQLErrors:\n isNonEmptyArray(graphQLErrors) ? graphQLErrors : void 0,\n meta: processErrors(graphQLErrors),\n };\n\n // if the server doesn't support persisted queries, don't try anymore\n supportsPersistedQueries = !disable(disablePayload);\n if (!supportsPersistedQueries) {\n // clear hashes from cache, we don't need them anymore\n resetHashCache();\n }\n\n // if its not found, we can try it again, otherwise just report the error\n if (retry(disablePayload)) {\n // need to recall the link chain\n if (subscription) subscription.unsubscribe();\n // actually send the query this time\n operation.setContext({\n http: {\n includeQuery: true,\n includeExtensions: supportsPersistedQueries,\n },\n fetchOptions: {\n // Since we're including the full query, which may be\n // large, we should send it in the body of a POST request.\n // See issue #7456.\n method: \"POST\",\n },\n });\n if (setFetchOptions) {\n operation.setContext({ fetchOptions: originalFetchOptions });\n }\n subscription = forward(operation).subscribe(handler);\n\n return;\n }\n }\n cb();\n };\n const handler = {\n next: (response: ExecutionResult) => {\n maybeRetry({ response }, () => observer.next!(response));\n },\n error: (networkError: ServerError) => {\n maybeRetry({ networkError }, () => observer.error!(networkError));\n },\n complete: observer.complete!.bind(observer),\n };\n\n // don't send the query the first time\n operation.setContext({\n http: {\n includeQuery: !supportsPersistedQueries,\n includeExtensions: supportsPersistedQueries,\n },\n });\n\n // If requested, set method to GET if there are no mutations. Remember the\n // original fetchOptions so we can restore them if we fall back to a\n // non-hashed request.\n if (\n useGETForHashedQueries &&\n supportsPersistedQueries &&\n !operationDefinesMutation(operation)\n ) {\n operation.setContext(\n ({ fetchOptions = {} }: { fetchOptions: Record }) => {\n originalFetchOptions = fetchOptions;\n return {\n fetchOptions: {\n ...fetchOptions,\n method: \"GET\",\n },\n };\n }\n );\n setFetchOptions = true;\n }\n\n if (supportsPersistedQueries) {\n getQueryHash(query)\n .then((sha256Hash) => {\n operation.extensions.persistedQuery = {\n version: VERSION,\n sha256Hash,\n };\n subscription = forward(operation).subscribe(handler);\n })\n .catch(observer.error!.bind(observer));\n } else {\n subscription = forward(operation).subscribe(handler);\n }\n\n return () => {\n if (subscription) subscription.unsubscribe();\n };\n });\n }),\n {\n resetHashCache,\n },\n __DEV__ ?\n {\n getMemoryInternals() {\n return {\n PersistedQueryLink: {\n persistedQueryHashes: hashesByQuery?.size ?? 0,\n },\n };\n },\n }\n : {}\n );\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/package.json b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/package.json new file mode 100644 index 0000000..a4794f5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/persisted-queries", + "type": "module", + "main": "persisted-queries.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs new file mode 100644 index 0000000..78f52a8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs @@ -0,0 +1,194 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +var core = require('../core'); + +var VERSION = 1; +function processErrors(graphQLErrors) { + var byMessage = Object.create(null), byCode = Object.create(null); + if (utilities.isNonEmptyArray(graphQLErrors)) { + graphQLErrors.forEach(function (error) { + var _a; + byMessage[error.message] = error; + if (typeof ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.code) == "string") + byCode[error.extensions.code] = error; + }); + } + return { + persistedQueryNotSupported: !!(byMessage.PersistedQueryNotSupported || + byCode.PERSISTED_QUERY_NOT_SUPPORTED), + persistedQueryNotFound: !!(byMessage.PersistedQueryNotFound || byCode.PERSISTED_QUERY_NOT_FOUND), + }; +} +var defaultOptions = { + disable: function (_a) { + var meta = _a.meta; + return meta.persistedQueryNotSupported; + }, + retry: function (_a) { + var meta = _a.meta; + return meta.persistedQueryNotSupported || meta.persistedQueryNotFound; + }, + useGETForHashedQueries: false, +}; +function operationDefinesMutation(operation) { + return operation.query.definitions.some(function (d) { return d.kind === "OperationDefinition" && d.operation === "mutation"; }); +} +var createPersistedQueryLink = function (options) { + var hashesByQuery; + function resetHashCache() { + hashesByQuery = undefined; + } + globals.invariant(options && + (typeof options.sha256 === "function" || + typeof options.generateHash === "function"), 40); + var _a = utilities.compact(defaultOptions, options), sha256 = _a.sha256, + _b = _a.generateHash, + generateHash = _b === void 0 ? function (query) { + return Promise.resolve(sha256(utilities.print(query))); + } : _b, disable = _a.disable, retry = _a.retry, useGETForHashedQueries = _a.useGETForHashedQueries; + var supportsPersistedQueries = true; + var getHashPromise = function (query) { + return new Promise(function (resolve) { return resolve(generateHash(query)); }); + }; + function getQueryHash(query) { + if (!query || typeof query !== "object") { + return getHashPromise(query); + } + if (!hashesByQuery) { + hashesByQuery = new utilities.AutoCleanedWeakCache(utilities.cacheSizes["PersistedQueryLink.persistedQueryHashes"] || + 2000 ); + } + var hash = hashesByQuery.get(query); + if (!hash) + hashesByQuery.set(query, (hash = getHashPromise(query))); + return hash; + } + return Object.assign(new core.ApolloLink(function (operation, forward) { + globals.invariant(forward, 41); + var query = operation.query; + return new utilities.Observable(function (observer) { + var subscription; + var retried = false; + var originalFetchOptions; + var setFetchOptions = false; + var maybeRetry = function (_a, cb) { + var response = _a.response, networkError = _a.networkError; + if (!retried && ((response && response.errors) || networkError)) { + retried = true; + var graphQLErrors = []; + var responseErrors = response && response.errors; + if (utilities.isNonEmptyArray(responseErrors)) { + graphQLErrors.push.apply(graphQLErrors, responseErrors); + } + var networkErrors = void 0; + if (typeof (networkError === null || networkError === void 0 ? void 0 : networkError.result) !== "string") { + networkErrors = + networkError && + networkError.result && + networkError.result.errors; + } + if (utilities.isNonEmptyArray(networkErrors)) { + graphQLErrors.push.apply(graphQLErrors, networkErrors); + } + var disablePayload = { + response: response, + networkError: networkError, + operation: operation, + graphQLErrors: utilities.isNonEmptyArray(graphQLErrors) ? graphQLErrors : void 0, + meta: processErrors(graphQLErrors), + }; + supportsPersistedQueries = !disable(disablePayload); + if (!supportsPersistedQueries) { + resetHashCache(); + } + if (retry(disablePayload)) { + if (subscription) + subscription.unsubscribe(); + operation.setContext({ + http: { + includeQuery: true, + includeExtensions: supportsPersistedQueries, + }, + fetchOptions: { + method: "POST", + }, + }); + if (setFetchOptions) { + operation.setContext({ fetchOptions: originalFetchOptions }); + } + subscription = forward(operation).subscribe(handler); + return; + } + } + cb(); + }; + var handler = { + next: function (response) { + maybeRetry({ response: response }, function () { return observer.next(response); }); + }, + error: function (networkError) { + maybeRetry({ networkError: networkError }, function () { return observer.error(networkError); }); + }, + complete: observer.complete.bind(observer), + }; + operation.setContext({ + http: { + includeQuery: !supportsPersistedQueries, + includeExtensions: supportsPersistedQueries, + }, + }); + if (useGETForHashedQueries && + supportsPersistedQueries && + !operationDefinesMutation(operation)) { + operation.setContext(function (_a) { + var _b = _a.fetchOptions, fetchOptions = _b === void 0 ? {} : _b; + originalFetchOptions = fetchOptions; + return { + fetchOptions: tslib.__assign(tslib.__assign({}, fetchOptions), { method: "GET" }), + }; + }); + setFetchOptions = true; + } + if (supportsPersistedQueries) { + getQueryHash(query) + .then(function (sha256Hash) { + operation.extensions.persistedQuery = { + version: VERSION, + sha256Hash: sha256Hash, + }; + subscription = forward(operation).subscribe(handler); + }) + .catch(observer.error.bind(observer)); + } + else { + subscription = forward(operation).subscribe(handler); + } + return function () { + if (subscription) + subscription.unsubscribe(); + }; + }); + }), { + resetHashCache: resetHashCache, + }, globalThis.__DEV__ !== false ? + { + getMemoryInternals: function () { + var _a; + return { + PersistedQueryLink: { + persistedQueryHashes: (_a = hashesByQuery === null || hashesByQuery === void 0 ? void 0 : hashesByQuery.size) !== null && _a !== void 0 ? _a : 0, + }, + }; + }, + } + : {}); +}; + +exports.VERSION = VERSION; +exports.createPersistedQueryLink = createPersistedQueryLink; +//# sourceMappingURL=persisted-queries.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.map new file mode 100644 index 0000000..b22ae01 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"persisted-queries.cjs","sources":["index.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { print } from \"../../utilities/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable, compact, isNonEmptyArray } from \"../../utilities/index.js\";\nimport { cacheSizes, AutoCleanedWeakCache, } from \"../../utilities/index.js\";\nexport var VERSION = 1;\nfunction processErrors(graphQLErrors) {\n var byMessage = Object.create(null), byCode = Object.create(null);\n if (isNonEmptyArray(graphQLErrors)) {\n graphQLErrors.forEach(function (error) {\n var _a;\n byMessage[error.message] = error;\n if (typeof ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.code) == \"string\")\n byCode[error.extensions.code] = error;\n });\n }\n return {\n persistedQueryNotSupported: !!(byMessage.PersistedQueryNotSupported ||\n byCode.PERSISTED_QUERY_NOT_SUPPORTED),\n persistedQueryNotFound: !!(byMessage.PersistedQueryNotFound || byCode.PERSISTED_QUERY_NOT_FOUND),\n };\n}\nvar defaultOptions = {\n disable: function (_a) {\n var meta = _a.meta;\n return meta.persistedQueryNotSupported;\n },\n retry: function (_a) {\n var meta = _a.meta;\n return meta.persistedQueryNotSupported || meta.persistedQueryNotFound;\n },\n useGETForHashedQueries: false,\n};\nfunction operationDefinesMutation(operation) {\n return operation.query.definitions.some(function (d) { return d.kind === \"OperationDefinition\" && d.operation === \"mutation\"; });\n}\nexport var createPersistedQueryLink = function (options) {\n var hashesByQuery;\n function resetHashCache() {\n hashesByQuery = undefined;\n }\n // Ensure a SHA-256 hash function is provided, if a custom hash\n // generation function is not provided. We don't supply a SHA-256 hash\n // function by default, to avoid forcing one as a dependency. Developers\n // should pick the most appropriate SHA-256 function (sync or async) for\n // their needs/environment, or provide a fully custom hash generation\n // function (via the `generateHash` option) if they want to handle\n // hashing with something other than SHA-256.\n invariant(options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\"), 40);\n var _a = compact(defaultOptions, options), sha256 = _a.sha256, \n // If both a `sha256` and `generateHash` option are provided, the\n // `sha256` option will be ignored. Developers can configure and\n // use any hashing approach they want in a custom `generateHash`\n // function; they aren't limited to SHA-256.\n _b = _a.generateHash, \n // If both a `sha256` and `generateHash` option are provided, the\n // `sha256` option will be ignored. Developers can configure and\n // use any hashing approach they want in a custom `generateHash`\n // function; they aren't limited to SHA-256.\n generateHash = _b === void 0 ? function (query) {\n return Promise.resolve(sha256(print(query)));\n } : _b, disable = _a.disable, retry = _a.retry, useGETForHashedQueries = _a.useGETForHashedQueries;\n var supportsPersistedQueries = true;\n var getHashPromise = function (query) {\n return new Promise(function (resolve) { return resolve(generateHash(query)); });\n };\n function getQueryHash(query) {\n if (!query || typeof query !== \"object\") {\n // If the query is not an object, we won't be able to store its hash as\n // a property of query[hashesKey], so we let generateHash(query) decide\n // what to do with the bogus query.\n return getHashPromise(query);\n }\n if (!hashesByQuery) {\n hashesByQuery = new AutoCleanedWeakCache(cacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] ||\n 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */);\n }\n var hash = hashesByQuery.get(query);\n if (!hash)\n hashesByQuery.set(query, (hash = getHashPromise(query)));\n return hash;\n }\n return Object.assign(new ApolloLink(function (operation, forward) {\n invariant(forward, 41);\n var query = operation.query;\n return new Observable(function (observer) {\n var subscription;\n var retried = false;\n var originalFetchOptions;\n var setFetchOptions = false;\n var maybeRetry = function (_a, cb) {\n var response = _a.response, networkError = _a.networkError;\n if (!retried && ((response && response.errors) || networkError)) {\n retried = true;\n var graphQLErrors = [];\n var responseErrors = response && response.errors;\n if (isNonEmptyArray(responseErrors)) {\n graphQLErrors.push.apply(graphQLErrors, responseErrors);\n }\n // Network errors can return GraphQL errors on for example a 403\n var networkErrors = void 0;\n if (typeof (networkError === null || networkError === void 0 ? void 0 : networkError.result) !== \"string\") {\n networkErrors =\n networkError &&\n networkError.result &&\n networkError.result.errors;\n }\n if (isNonEmptyArray(networkErrors)) {\n graphQLErrors.push.apply(graphQLErrors, networkErrors);\n }\n var disablePayload = {\n response: response,\n networkError: networkError,\n operation: operation,\n graphQLErrors: isNonEmptyArray(graphQLErrors) ? graphQLErrors : void 0,\n meta: processErrors(graphQLErrors),\n };\n // if the server doesn't support persisted queries, don't try anymore\n supportsPersistedQueries = !disable(disablePayload);\n if (!supportsPersistedQueries) {\n // clear hashes from cache, we don't need them anymore\n resetHashCache();\n }\n // if its not found, we can try it again, otherwise just report the error\n if (retry(disablePayload)) {\n // need to recall the link chain\n if (subscription)\n subscription.unsubscribe();\n // actually send the query this time\n operation.setContext({\n http: {\n includeQuery: true,\n includeExtensions: supportsPersistedQueries,\n },\n fetchOptions: {\n // Since we're including the full query, which may be\n // large, we should send it in the body of a POST request.\n // See issue #7456.\n method: \"POST\",\n },\n });\n if (setFetchOptions) {\n operation.setContext({ fetchOptions: originalFetchOptions });\n }\n subscription = forward(operation).subscribe(handler);\n return;\n }\n }\n cb();\n };\n var handler = {\n next: function (response) {\n maybeRetry({ response: response }, function () { return observer.next(response); });\n },\n error: function (networkError) {\n maybeRetry({ networkError: networkError }, function () { return observer.error(networkError); });\n },\n complete: observer.complete.bind(observer),\n };\n // don't send the query the first time\n operation.setContext({\n http: {\n includeQuery: !supportsPersistedQueries,\n includeExtensions: supportsPersistedQueries,\n },\n });\n // If requested, set method to GET if there are no mutations. Remember the\n // original fetchOptions so we can restore them if we fall back to a\n // non-hashed request.\n if (useGETForHashedQueries &&\n supportsPersistedQueries &&\n !operationDefinesMutation(operation)) {\n operation.setContext(function (_a) {\n var _b = _a.fetchOptions, fetchOptions = _b === void 0 ? {} : _b;\n originalFetchOptions = fetchOptions;\n return {\n fetchOptions: __assign(__assign({}, fetchOptions), { method: \"GET\" }),\n };\n });\n setFetchOptions = true;\n }\n if (supportsPersistedQueries) {\n getQueryHash(query)\n .then(function (sha256Hash) {\n operation.extensions.persistedQuery = {\n version: VERSION,\n sha256Hash: sha256Hash,\n };\n subscription = forward(operation).subscribe(handler);\n })\n .catch(observer.error.bind(observer));\n }\n else {\n subscription = forward(operation).subscribe(handler);\n }\n return function () {\n if (subscription)\n subscription.unsubscribe();\n };\n });\n }), {\n resetHashCache: resetHashCache,\n }, globalThis.__DEV__ !== false ?\n {\n getMemoryInternals: function () {\n var _a;\n return {\n PersistedQueryLink: {\n persistedQueryHashes: (_a = hashesByQuery === null || hashesByQuery === void 0 ? void 0 : hashesByQuery.size) !== null && _a !== void 0 ? _a : 0,\n },\n };\n },\n }\n : {});\n};\n//# sourceMappingURL=index.js.map"],"names":["isNonEmptyArray","invariant","compact","print","AutoCleanedWeakCache","cacheSizes","ApolloLink","Observable","__assign"],"mappings":";;;;;;;;;AAMU,IAAC,OAAO,GAAG,EAAE;AACvB,SAAS,aAAa,CAAC,aAAa,EAAE;AACtC,IAAI,IAAI,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACtE,IAAI,IAAIA,yBAAe,CAAC,aAAa,CAAC,EAAE;AACxC,QAAQ,aAAa,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE;AAC/C,YAAY,IAAI,EAAE,CAAC;AACnB,YAAY,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;AAC7C,YAAY,IAAI,QAAQ,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,QAAQ;AACzG,gBAAgB,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;AACtD,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,0BAA0B,EAAE,CAAC,EAAE,SAAS,CAAC,0BAA0B;AAC3E,YAAY,MAAM,CAAC,6BAA6B,CAAC;AACjD,QAAQ,sBAAsB,EAAE,CAAC,EAAE,SAAS,CAAC,sBAAsB,IAAI,MAAM,CAAC,yBAAyB,CAAC;AACxG,KAAK,CAAC;AACN,CAAC;AACD,IAAI,cAAc,GAAG;AACrB,IAAI,OAAO,EAAE,UAAU,EAAE,EAAE;AAC3B,QA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UAAU,UAAU,EAAE;AAChD,oBAAoB,SAAS,CAAC,UAAU,CAAC,cAAc,GAAG;AAC1D,wBAAwB,OAAO,EAAE,OAAO;AACxC,wBAAwB,UAAU,EAAE,UAAU;AAC9C,qBAAqB,CAAC;AACtB,oBAAoB,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACzE,iBAAiB,CAAC;AAClB,qBAAqB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC1D,aAAa;AACb,iBAAiB;AACjB,gBAAgB,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACrE,aAAa;AACb,YAAY,OAAO,YAAY;AAC/B,gBAAgB,IAAI,YAAY;AAChC,oBAAoB,YAAY,CAAC,WAAW,EAAE,CAAC;AAC/C,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK,CAAC,EAAE;AACR,QAAQ,cAAc,EAAE,cAAc;AACtC,KAAK,EAAE,UAAU,CAAC,OAAO,KAAK,KAAK;AACnC,QAAQ;AACR,YAAY,kBAAkB,EAAE,YAAY;AAC5C,gBAAgB,IAAI,EAAE,CAAC;AACvB,gBAAgB,OAAO;AACvB,oBAAoB,kBAAkB,EAAE;AACxC,wBAAwB,oBAAoB,EAAE,CAAC,EAAE,GAAG,aAAa,KAAK,IAAI,IAAI,aAAa,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,aAAa,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;AACxK,qBAAqB;AACrB,iBAAiB,CAAC;AAClB,aAAa;AACb,SAAS;AACT,UAAU,EAAE,CAAC,CAAC;AACd;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.native.js new file mode 100644 index 0000000..78f52a8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/persisted-queries/persisted-queries.cjs.native.js @@ -0,0 +1,194 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +var core = require('../core'); + +var VERSION = 1; +function processErrors(graphQLErrors) { + var byMessage = Object.create(null), byCode = Object.create(null); + if (utilities.isNonEmptyArray(graphQLErrors)) { + graphQLErrors.forEach(function (error) { + var _a; + byMessage[error.message] = error; + if (typeof ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.code) == "string") + byCode[error.extensions.code] = error; + }); + } + return { + persistedQueryNotSupported: !!(byMessage.PersistedQueryNotSupported || + byCode.PERSISTED_QUERY_NOT_SUPPORTED), + persistedQueryNotFound: !!(byMessage.PersistedQueryNotFound || byCode.PERSISTED_QUERY_NOT_FOUND), + }; +} +var defaultOptions = { + disable: function (_a) { + var meta = _a.meta; + return meta.persistedQueryNotSupported; + }, + retry: function (_a) { + var meta = _a.meta; + return meta.persistedQueryNotSupported || meta.persistedQueryNotFound; + }, + useGETForHashedQueries: false, +}; +function operationDefinesMutation(operation) { + return operation.query.definitions.some(function (d) { return d.kind === "OperationDefinition" && d.operation === "mutation"; }); +} +var createPersistedQueryLink = function (options) { + var hashesByQuery; + function resetHashCache() { + hashesByQuery = undefined; + } + globals.invariant(options && + (typeof options.sha256 === "function" || + typeof options.generateHash === "function"), 40); + var _a = utilities.compact(defaultOptions, options), sha256 = _a.sha256, + _b = _a.generateHash, + generateHash = _b === void 0 ? function (query) { + return Promise.resolve(sha256(utilities.print(query))); + } : _b, disable = _a.disable, retry = _a.retry, useGETForHashedQueries = _a.useGETForHashedQueries; + var supportsPersistedQueries = true; + var getHashPromise = function (query) { + return new Promise(function (resolve) { return resolve(generateHash(query)); }); + }; + function getQueryHash(query) { + if (!query || typeof query !== "object") { + return getHashPromise(query); + } + if (!hashesByQuery) { + hashesByQuery = new utilities.AutoCleanedWeakCache(utilities.cacheSizes["PersistedQueryLink.persistedQueryHashes"] || + 2000 ); + } + var hash = hashesByQuery.get(query); + if (!hash) + hashesByQuery.set(query, (hash = getHashPromise(query))); + return hash; + } + return Object.assign(new core.ApolloLink(function (operation, forward) { + globals.invariant(forward, 41); + var query = operation.query; + return new utilities.Observable(function (observer) { + var subscription; + var retried = false; + var originalFetchOptions; + var setFetchOptions = false; + var maybeRetry = function (_a, cb) { + var response = _a.response, networkError = _a.networkError; + if (!retried && ((response && response.errors) || networkError)) { + retried = true; + var graphQLErrors = []; + var responseErrors = response && response.errors; + if (utilities.isNonEmptyArray(responseErrors)) { + graphQLErrors.push.apply(graphQLErrors, responseErrors); + } + var networkErrors = void 0; + if (typeof (networkError === null || networkError === void 0 ? void 0 : networkError.result) !== "string") { + networkErrors = + networkError && + networkError.result && + networkError.result.errors; + } + if (utilities.isNonEmptyArray(networkErrors)) { + graphQLErrors.push.apply(graphQLErrors, networkErrors); + } + var disablePayload = { + response: response, + networkError: networkError, + operation: operation, + graphQLErrors: utilities.isNonEmptyArray(graphQLErrors) ? graphQLErrors : void 0, + meta: processErrors(graphQLErrors), + }; + supportsPersistedQueries = !disable(disablePayload); + if (!supportsPersistedQueries) { + resetHashCache(); + } + if (retry(disablePayload)) { + if (subscription) + subscription.unsubscribe(); + operation.setContext({ + http: { + includeQuery: true, + includeExtensions: supportsPersistedQueries, + }, + fetchOptions: { + method: "POST", + }, + }); + if (setFetchOptions) { + operation.setContext({ fetchOptions: originalFetchOptions }); + } + subscription = forward(operation).subscribe(handler); + return; + } + } + cb(); + }; + var handler = { + next: function (response) { + maybeRetry({ response: response }, function () { return observer.next(response); }); + }, + error: function (networkError) { + maybeRetry({ networkError: networkError }, function () { return observer.error(networkError); }); + }, + complete: observer.complete.bind(observer), + }; + operation.setContext({ + http: { + includeQuery: !supportsPersistedQueries, + includeExtensions: supportsPersistedQueries, + }, + }); + if (useGETForHashedQueries && + supportsPersistedQueries && + !operationDefinesMutation(operation)) { + operation.setContext(function (_a) { + var _b = _a.fetchOptions, fetchOptions = _b === void 0 ? {} : _b; + originalFetchOptions = fetchOptions; + return { + fetchOptions: tslib.__assign(tslib.__assign({}, fetchOptions), { method: "GET" }), + }; + }); + setFetchOptions = true; + } + if (supportsPersistedQueries) { + getQueryHash(query) + .then(function (sha256Hash) { + operation.extensions.persistedQuery = { + version: VERSION, + sha256Hash: sha256Hash, + }; + subscription = forward(operation).subscribe(handler); + }) + .catch(observer.error.bind(observer)); + } + else { + subscription = forward(operation).subscribe(handler); + } + return function () { + if (subscription) + subscription.unsubscribe(); + }; + }); + }), { + resetHashCache: resetHashCache, + }, globalThis.__DEV__ !== false ? + { + getMemoryInternals: function () { + var _a; + return { + PersistedQueryLink: { + persistedQueryHashes: (_a = hashesByQuery === null || hashesByQuery === void 0 ? void 0 : hashesByQuery.size) !== null && _a !== void 0 ? _a : 0, + }, + }; + }, + } + : {}); +}; + +exports.VERSION = VERSION; +exports.createPersistedQueryLink = createPersistedQueryLink; +//# sourceMappingURL=persisted-queries.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.d.ts new file mode 100644 index 0000000..5f9a9f5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.d.ts @@ -0,0 +1,3 @@ +export type { RemoveTypenameFromVariablesOptions } from "./removeTypenameFromVariables.js"; +export { removeTypenameFromVariables, KEEP, } from "./removeTypenameFromVariables.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js new file mode 100644 index 0000000..415d0e1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js @@ -0,0 +1,2 @@ +export { removeTypenameFromVariables, KEEP, } from "./removeTypenameFromVariables.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js.map new file mode 100644 index 0000000..8eb9e24 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/remove-typename/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,IAAI,GACL,MAAM,kCAAkC,CAAC","sourcesContent":["export type { RemoveTypenameFromVariablesOptions } from \"./removeTypenameFromVariables.js\";\nexport {\n removeTypenameFromVariables,\n KEEP,\n} from \"./removeTypenameFromVariables.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/package.json b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/package.json new file mode 100644 index 0000000..89e01bd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/remove-typename", + "type": "module", + "main": "remove-typename.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs new file mode 100644 index 0000000..fbf2a57 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs @@ -0,0 +1,100 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var optimism = require('optimism'); +var graphql = require('graphql'); +var core = require('../core'); +var utilities = require('../../utilities'); +var caches = require('@wry/caches'); + +var KEEP = "__KEEP"; +function removeTypenameFromVariables(options) { + if (options === void 0) { options = Object.create(null); } + return Object.assign(new core.ApolloLink(function (operation, forward) { + var except = options.except; + var query = operation.query, variables = operation.variables; + if (variables) { + operation.variables = + except ? + maybeStripTypenameUsingConfig(query, variables, except) + : utilities.stripTypename(variables); + } + return forward(operation); + }), globalThis.__DEV__ !== false ? + { + getMemoryInternals: function () { + var _a; + return { + removeTypenameFromVariables: { + getVariableDefinitions: (_a = getVariableDefinitions === null || getVariableDefinitions === void 0 ? void 0 : getVariableDefinitions.size) !== null && _a !== void 0 ? _a : 0, + }, + }; + }, + } + : {}); +} +function maybeStripTypenameUsingConfig(query, variables, config) { + var variableDefinitions = getVariableDefinitions(query); + return Object.fromEntries(Object.entries(variables).map(function (keyVal) { + var key = keyVal[0], value = keyVal[1]; + var typename = variableDefinitions[key]; + var typenameConfig = config[typename]; + keyVal[1] = + typenameConfig ? + maybeStripTypename(value, typenameConfig) + : utilities.stripTypename(value); + return keyVal; + })); +} +function maybeStripTypename(value, config) { + if (config === KEEP) { + return value; + } + if (Array.isArray(value)) { + return value.map(function (item) { return maybeStripTypename(item, config); }); + } + if (utilities.isPlainObject(value)) { + var modified_1 = {}; + Object.keys(value).forEach(function (key) { + var child = value[key]; + if (key === "__typename") { + return; + } + var fieldConfig = config[key]; + modified_1[key] = + fieldConfig ? + maybeStripTypename(child, fieldConfig) + : utilities.stripTypename(child); + }); + return modified_1; + } + return value; +} +var getVariableDefinitions = optimism.wrap(function (document) { + var definitions = {}; + graphql.visit(document, { + VariableDefinition: function (node) { + definitions[node.variable.name.value] = unwrapType(node.type); + }, + }); + return definitions; +}, { + max: utilities.cacheSizes["removeTypenameFromVariables.getVariableDefinitions"] || + 2000 , + cache: caches.WeakCache, +}); +function unwrapType(node) { + switch (node.kind) { + case graphql.Kind.NON_NULL_TYPE: + return unwrapType(node.type); + case graphql.Kind.LIST_TYPE: + return unwrapType(node.type); + case graphql.Kind.NAMED_TYPE: + return node.name.value; + } +} + +exports.KEEP = KEEP; +exports.removeTypenameFromVariables = removeTypenameFromVariables; +//# sourceMappingURL=remove-typename.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.map new file mode 100644 index 0000000..be79493 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"remove-typename.cjs","sources":["removeTypenameFromVariables.js"],"sourcesContent":["import { wrap } from \"optimism\";\nimport { Kind, visit } from \"graphql\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { stripTypename, isPlainObject, cacheSizes, } from \"../../utilities/index.js\";\nimport { WeakCache } from \"@wry/caches\";\nexport var KEEP = \"__KEEP\";\nexport function removeTypenameFromVariables(options) {\n if (options === void 0) { options = Object.create(null); }\n return Object.assign(new ApolloLink(function (operation, forward) {\n var except = options.except;\n var query = operation.query, variables = operation.variables;\n if (variables) {\n operation.variables =\n except ?\n maybeStripTypenameUsingConfig(query, variables, except)\n : stripTypename(variables);\n }\n return forward(operation);\n }), globalThis.__DEV__ !== false ?\n {\n getMemoryInternals: function () {\n var _a;\n return {\n removeTypenameFromVariables: {\n getVariableDefinitions: (_a = getVariableDefinitions === null || getVariableDefinitions === void 0 ? void 0 : getVariableDefinitions.size) !== null && _a !== void 0 ? _a : 0,\n },\n };\n },\n }\n : {});\n}\nfunction maybeStripTypenameUsingConfig(query, variables, config) {\n var variableDefinitions = getVariableDefinitions(query);\n return Object.fromEntries(Object.entries(variables).map(function (keyVal) {\n var key = keyVal[0], value = keyVal[1];\n var typename = variableDefinitions[key];\n var typenameConfig = config[typename];\n keyVal[1] =\n typenameConfig ?\n maybeStripTypename(value, typenameConfig)\n : stripTypename(value);\n return keyVal;\n }));\n}\nfunction maybeStripTypename(value, config) {\n if (config === KEEP) {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map(function (item) { return maybeStripTypename(item, config); });\n }\n if (isPlainObject(value)) {\n var modified_1 = {};\n Object.keys(value).forEach(function (key) {\n var child = value[key];\n if (key === \"__typename\") {\n return;\n }\n var fieldConfig = config[key];\n modified_1[key] =\n fieldConfig ?\n maybeStripTypename(child, fieldConfig)\n : stripTypename(child);\n });\n return modified_1;\n }\n return value;\n}\nvar getVariableDefinitions = wrap(function (document) {\n var definitions = {};\n visit(document, {\n VariableDefinition: function (node) {\n definitions[node.variable.name.value] = unwrapType(node.type);\n },\n });\n return definitions;\n}, {\n max: cacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] ||\n 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n cache: WeakCache,\n});\nfunction unwrapType(node) {\n switch (node.kind) {\n case Kind.NON_NULL_TYPE:\n return unwrapType(node.type);\n case Kind.LIST_TYPE:\n return unwrapType(node.type);\n case Kind.NAMED_TYPE:\n return node.name.value;\n }\n}\n//# sourceMappingURL=removeTypenameFromVariables.js.map"],"names":["ApolloLink","stripTypename","isPlainObject","wrap","visit","cacheSizes","WeakCache","Kind"],"mappings":";;;;;;;;;;AAKU,IAAC,IAAI,GAAG,SAAS;AACpB,SAAS,2BAA2B,CAAC,OAAO,EAAE;AACrD,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;AAC9D,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,IAAIA,eAAU,CAAC,UAAU,SAAS,EAAE,OAAO,EAAE;AACtE,QAAQ,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AACpC,QAAQ,IAAI,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;AACrE,QAAQ,IAAI,SAAS,EAAE;AACvB,YAAY,SAAS,CAAC,SAAS;AAC/B,gBAAgB,MAAM;AACtB,oBAAoB,6BAA6B,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC;AAC3E,sBAAsBC,uBAAa,CAAC,SAAS,CAAC,CAAC;AAC/C,SAAS;AACT,QAAQ,OAAO,OAAO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AC,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1E,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,WAAW,CAAC;AACvB,CAAC,EAAE;AACH,IAAI,GAAG,EAAEC,oBAAU,CAAC,oDAAoD,CAAC;AACzE,QAAQ,IAAI;AACZ,IAAI,KAAK,EAAEC,gBAAS;AACpB,CAAC,CAAC,CAAC;AACH,SAAS,UAAU,CAAC,IAAI,EAAE;AAC1B,IAAI,QAAQ,IAAI,CAAC,IAAI;AACrB,QAAQ,KAAKC,YAAI,CAAC,aAAa;AAC/B,YAAY,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,QAAQ,KAAKA,YAAI,CAAC,SAAS;AAC3B,YAAY,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,QAAQ,KAAKA,YAAI,CAAC,UAAU;AAC5B,YAAY,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACnC,KAAK;AACL;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.native.js new file mode 100644 index 0000000..fbf2a57 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/remove-typename.cjs.native.js @@ -0,0 +1,100 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var optimism = require('optimism'); +var graphql = require('graphql'); +var core = require('../core'); +var utilities = require('../../utilities'); +var caches = require('@wry/caches'); + +var KEEP = "__KEEP"; +function removeTypenameFromVariables(options) { + if (options === void 0) { options = Object.create(null); } + return Object.assign(new core.ApolloLink(function (operation, forward) { + var except = options.except; + var query = operation.query, variables = operation.variables; + if (variables) { + operation.variables = + except ? + maybeStripTypenameUsingConfig(query, variables, except) + : utilities.stripTypename(variables); + } + return forward(operation); + }), globalThis.__DEV__ !== false ? + { + getMemoryInternals: function () { + var _a; + return { + removeTypenameFromVariables: { + getVariableDefinitions: (_a = getVariableDefinitions === null || getVariableDefinitions === void 0 ? void 0 : getVariableDefinitions.size) !== null && _a !== void 0 ? _a : 0, + }, + }; + }, + } + : {}); +} +function maybeStripTypenameUsingConfig(query, variables, config) { + var variableDefinitions = getVariableDefinitions(query); + return Object.fromEntries(Object.entries(variables).map(function (keyVal) { + var key = keyVal[0], value = keyVal[1]; + var typename = variableDefinitions[key]; + var typenameConfig = config[typename]; + keyVal[1] = + typenameConfig ? + maybeStripTypename(value, typenameConfig) + : utilities.stripTypename(value); + return keyVal; + })); +} +function maybeStripTypename(value, config) { + if (config === KEEP) { + return value; + } + if (Array.isArray(value)) { + return value.map(function (item) { return maybeStripTypename(item, config); }); + } + if (utilities.isPlainObject(value)) { + var modified_1 = {}; + Object.keys(value).forEach(function (key) { + var child = value[key]; + if (key === "__typename") { + return; + } + var fieldConfig = config[key]; + modified_1[key] = + fieldConfig ? + maybeStripTypename(child, fieldConfig) + : utilities.stripTypename(child); + }); + return modified_1; + } + return value; +} +var getVariableDefinitions = optimism.wrap(function (document) { + var definitions = {}; + graphql.visit(document, { + VariableDefinition: function (node) { + definitions[node.variable.name.value] = unwrapType(node.type); + }, + }); + return definitions; +}, { + max: utilities.cacheSizes["removeTypenameFromVariables.getVariableDefinitions"] || + 2000 , + cache: caches.WeakCache, +}); +function unwrapType(node) { + switch (node.kind) { + case graphql.Kind.NON_NULL_TYPE: + return unwrapType(node.type); + case graphql.Kind.LIST_TYPE: + return unwrapType(node.type); + case graphql.Kind.NAMED_TYPE: + return node.name.value; + } +} + +exports.KEEP = KEEP; +exports.removeTypenameFromVariables = removeTypenameFromVariables; +//# sourceMappingURL=remove-typename.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.d.ts b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.d.ts new file mode 100644 index 0000000..4060abb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.d.ts @@ -0,0 +1,19 @@ +import { ApolloLink } from "../core/index.js"; +export declare const KEEP = "__KEEP"; +interface KeepTypenameConfig { + [key: string]: typeof KEEP | KeepTypenameConfig; +} +export interface RemoveTypenameFromVariablesOptions { + except?: KeepTypenameConfig; +} +export declare function removeTypenameFromVariables(options?: RemoveTypenameFromVariablesOptions): ApolloLink & ({ + getMemoryInternals(): { + removeTypenameFromVariables: { + getVariableDefinitions: number; + }; + }; +} | { + getMemoryInternals?: undefined; +}); +export {}; +//# sourceMappingURL=removeTypenameFromVariables.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js new file mode 100644 index 0000000..6763adf --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js @@ -0,0 +1,92 @@ +import { wrap } from "optimism"; +import { Kind, visit } from "graphql"; +import { ApolloLink } from "../core/index.js"; +import { stripTypename, isPlainObject, cacheSizes, } from "../../utilities/index.js"; +import { WeakCache } from "@wry/caches"; +export var KEEP = "__KEEP"; +export function removeTypenameFromVariables(options) { + if (options === void 0) { options = Object.create(null); } + return Object.assign(new ApolloLink(function (operation, forward) { + var except = options.except; + var query = operation.query, variables = operation.variables; + if (variables) { + operation.variables = + except ? + maybeStripTypenameUsingConfig(query, variables, except) + : stripTypename(variables); + } + return forward(operation); + }), globalThis.__DEV__ !== false ? + { + getMemoryInternals: function () { + var _a; + return { + removeTypenameFromVariables: { + getVariableDefinitions: (_a = getVariableDefinitions === null || getVariableDefinitions === void 0 ? void 0 : getVariableDefinitions.size) !== null && _a !== void 0 ? _a : 0, + }, + }; + }, + } + : {}); +} +function maybeStripTypenameUsingConfig(query, variables, config) { + var variableDefinitions = getVariableDefinitions(query); + return Object.fromEntries(Object.entries(variables).map(function (keyVal) { + var key = keyVal[0], value = keyVal[1]; + var typename = variableDefinitions[key]; + var typenameConfig = config[typename]; + keyVal[1] = + typenameConfig ? + maybeStripTypename(value, typenameConfig) + : stripTypename(value); + return keyVal; + })); +} +function maybeStripTypename(value, config) { + if (config === KEEP) { + return value; + } + if (Array.isArray(value)) { + return value.map(function (item) { return maybeStripTypename(item, config); }); + } + if (isPlainObject(value)) { + var modified_1 = {}; + Object.keys(value).forEach(function (key) { + var child = value[key]; + if (key === "__typename") { + return; + } + var fieldConfig = config[key]; + modified_1[key] = + fieldConfig ? + maybeStripTypename(child, fieldConfig) + : stripTypename(child); + }); + return modified_1; + } + return value; +} +var getVariableDefinitions = wrap(function (document) { + var definitions = {}; + visit(document, { + VariableDefinition: function (node) { + definitions[node.variable.name.value] = unwrapType(node.type); + }, + }); + return definitions; +}, { + max: cacheSizes["removeTypenameFromVariables.getVariableDefinitions"] || + 2000 /* defaultCacheSizes["removeTypenameFromVariables.getVariableDefinitions"] */, + cache: WeakCache, +}); +function unwrapType(node) { + switch (node.kind) { + case Kind.NON_NULL_TYPE: + return unwrapType(node.type); + case Kind.LIST_TYPE: + return unwrapType(node.type); + case Kind.NAMED_TYPE: + return node.name.value; + } +} +//# sourceMappingURL=removeTypenameFromVariables.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js.map b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js.map new file mode 100644 index 0000000..6c3500a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/remove-typename/removeTypenameFromVariables.js.map @@ -0,0 +1 @@ +{"version":3,"file":"removeTypenameFromVariables.js","sourceRoot":"","sources":["../../../src/link/remove-typename/removeTypenameFromVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAA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C,CAAC,CAAC;QAEH,OAAO,UAAQ,CAAC;IAClB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,IAAM,sBAAsB,GAAG,IAAI,CACjC,UAAC,QAAsB;IACrB,IAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,KAAK,CAAC,QAAQ,EAAE;QACd,kBAAkB,YAAC,IAAI;YACrB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC,EACD;IACE,GAAG,EACD,UAAU,CAAC,oDAAoD,CAAC;0FACO;IACzE,KAAK,EAAE,SAAS;CACjB,CACF,CAAC;AAEF,SAAS,UAAU,CAAC,IAAc;IAChC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,aAAa;YACrB,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,IAAI,CAAC,SAAS;YACjB,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,IAAI,CAAC,UAAU;YAClB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["import { wrap } from \"optimism\";\nimport type { DocumentNode, TypeNode } from \"graphql\";\nimport { Kind, visit } from \"graphql\";\nimport { ApolloLink } from \"../core/index.js\";\nimport {\n stripTypename,\n isPlainObject,\n cacheSizes,\n defaultCacheSizes,\n} from \"../../utilities/index.js\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { WeakCache } from \"@wry/caches\";\n\nexport const KEEP = \"__KEEP\";\n\ninterface KeepTypenameConfig {\n [key: string]: typeof KEEP | KeepTypenameConfig;\n}\n\nexport interface RemoveTypenameFromVariablesOptions {\n except?: KeepTypenameConfig;\n}\n\nexport function removeTypenameFromVariables(\n options: RemoveTypenameFromVariablesOptions = Object.create(null)\n) {\n return Object.assign(\n new ApolloLink((operation, forward) => {\n const { except } = options;\n const { query, variables } = operation;\n\n if (variables) {\n operation.variables =\n except ?\n maybeStripTypenameUsingConfig(query, variables, except)\n : stripTypename(variables);\n }\n\n return forward(operation);\n }),\n __DEV__ ?\n {\n getMemoryInternals() {\n return {\n removeTypenameFromVariables: {\n getVariableDefinitions: getVariableDefinitions?.size ?? 0,\n },\n };\n },\n }\n : {}\n );\n}\n\nfunction maybeStripTypenameUsingConfig(\n query: DocumentNode,\n variables: OperationVariables,\n config: KeepTypenameConfig\n) {\n const variableDefinitions = getVariableDefinitions(query);\n\n return Object.fromEntries(\n Object.entries(variables).map((keyVal) => {\n const [key, value] = keyVal;\n const typename = variableDefinitions[key];\n const typenameConfig = config[typename];\n\n keyVal[1] =\n typenameConfig ?\n maybeStripTypename(value, typenameConfig)\n : stripTypename(value);\n\n return keyVal;\n })\n );\n}\n\ntype JSONPrimitive = string | number | null | boolean;\ntype JSONValue = JSONPrimitive | JSONValue[] | { [key: string]: JSONValue };\n\nfunction maybeStripTypename(\n value: JSONValue,\n config: KeepTypenameConfig[string]\n): JSONValue {\n if (config === KEEP) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => maybeStripTypename(item, config));\n }\n\n if (isPlainObject(value)) {\n const modified: Record = {};\n\n Object.keys(value).forEach((key) => {\n const child = value[key];\n\n if (key === \"__typename\") {\n return;\n }\n\n const fieldConfig = config[key];\n\n modified[key] =\n fieldConfig ?\n maybeStripTypename(child, fieldConfig)\n : stripTypename(child);\n });\n\n return modified;\n }\n\n return value;\n}\n\nconst getVariableDefinitions = wrap(\n (document: DocumentNode) => {\n const definitions: Record = {};\n\n visit(document, {\n VariableDefinition(node) {\n definitions[node.variable.name.value] = unwrapType(node.type);\n },\n });\n\n return definitions;\n },\n {\n max:\n cacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] ||\n defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"],\n cache: WeakCache,\n }\n);\n\nfunction unwrapType(node: TypeNode): string {\n switch (node.kind) {\n case Kind.NON_NULL_TYPE:\n return unwrapType(node.type);\n case Kind.LIST_TYPE:\n return unwrapType(node.type);\n case Kind.NAMED_TYPE:\n return node.name.value;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.d.ts b/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.d.ts new file mode 100644 index 0000000..af11b00 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.d.ts @@ -0,0 +1,40 @@ +import type { Operation } from "../core/index.js"; +/** + * Advanced mode: a function that implements the strategy for calculating delays + * for particular responses. + */ +export interface DelayFunction { + (count: number, operation: Operation, error: any): number; +} +export interface DelayFunctionOptions { + /** + * The number of milliseconds to wait before attempting the first retry. + * + * Delays will increase exponentially for each attempt. E.g. if this is + * set to 100, subsequent retries will be delayed by 200, 400, 800, etc, + * until they reach maxDelay. + * + * Note that if jittering is enabled, this is the _average_ delay. + * + * Defaults to 300. + */ + initial?: number; + /** + * The maximum number of milliseconds that the link should wait for any + * retry. + * + * Defaults to Infinity. + */ + max?: number; + /** + * Whether delays between attempts should be randomized. + * + * This helps avoid thundering herd type situations by better distributing + * load during major outages. + * + * Defaults to true. + */ + jitter?: boolean; +} +export declare function buildDelayFunction(delayOptions?: DelayFunctionOptions): DelayFunction; +//# sourceMappingURL=delayFunction.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js b/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js new file mode 100644 index 0000000..e13c985 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js @@ -0,0 +1,18 @@ +export function buildDelayFunction(delayOptions) { + var _a = delayOptions || {}, _b = _a.initial, initial = _b === void 0 ? 300 : _b, _c = _a.jitter, jitter = _c === void 0 ? true : _c, _d = _a.max, max = _d === void 0 ? Infinity : _d; + // If we're jittering, baseDelay is half of the maximum delay for that + // attempt (and is, on average, the delay we will encounter). + // If we're not jittering, adjust baseDelay so that the first attempt + // lines up with initialDelay, for everyone's sanity. + var baseDelay = jitter ? initial : initial / 2; + return function delayFunction(count) { + var delay = Math.min(max, baseDelay * Math.pow(2, count)); + if (jitter) { + // We opt for a full jitter approach for a mostly uniform distribution, + // but bound it within initialDelay and delay for everyone's sanity. + delay = Math.random() * delay; + } + return delay; + }; +} +//# sourceMappingURL=delayFunction.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js.map b/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js.map new file mode 100644 index 0000000..b34ab40 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/delayFunction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"delayFunction.js","sourceRoot":"","sources":["../../../src/link/retry/delayFunction.ts"],"names":[],"mappings":"AA2CA,MAAM,UAAU,kBAAkB,CAChC,YAAmC;IAE7B,IAAA,KAAmD,YAAY,IAAI,EAAE,EAAnE,eAAa,EAAb,OAAO,mBAAG,GAAG,KAAA,EAAE,cAAa,EAAb,MAAM,mBAAG,IAAI,KAAA,EAAE,WAAc,EAAd,GAAG,mBAAG,QAAQ,KAAuB,CAAC;IAC5E,sEAAsE;IACtE,6DAA6D;IAC7D,qEAAqE;IACrE,qDAAqD;IACrD,IAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;IAEjD,OAAO,SAAS,aAAa,CAAC,KAAa;QACzC,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,SAAA,CAAC,EAAI,KAAK,CAAA,CAAC,CAAC;QAClD,IAAI,MAAM,EAAE,CAAC;YACX,uEAAuE;YACvE,oEAAoE;YACpE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;QAChC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Operation } from \"../core/index.js\";\n\n/**\n * Advanced mode: a function that implements the strategy for calculating delays\n * for particular responses.\n */\nexport interface DelayFunction {\n (count: number, operation: Operation, error: any): number;\n}\n\nexport interface DelayFunctionOptions {\n /**\n * The number of milliseconds to wait before attempting the first retry.\n *\n * Delays will increase exponentially for each attempt. E.g. if this is\n * set to 100, subsequent retries will be delayed by 200, 400, 800, etc,\n * until they reach maxDelay.\n *\n * Note that if jittering is enabled, this is the _average_ delay.\n *\n * Defaults to 300.\n */\n initial?: number;\n\n /**\n * The maximum number of milliseconds that the link should wait for any\n * retry.\n *\n * Defaults to Infinity.\n */\n max?: number;\n\n /**\n * Whether delays between attempts should be randomized.\n *\n * This helps avoid thundering herd type situations by better distributing\n * load during major outages.\n *\n * Defaults to true.\n */\n jitter?: boolean;\n}\n\nexport function buildDelayFunction(\n delayOptions?: DelayFunctionOptions\n): DelayFunction {\n const { initial = 300, jitter = true, max = Infinity } = delayOptions || {};\n // If we're jittering, baseDelay is half of the maximum delay for that\n // attempt (and is, on average, the delay we will encounter).\n // If we're not jittering, adjust baseDelay so that the first attempt\n // lines up with initialDelay, for everyone's sanity.\n const baseDelay = jitter ? initial : initial / 2;\n\n return function delayFunction(count: number) {\n let delay = Math.min(max, baseDelay * 2 ** count);\n if (jitter) {\n // We opt for a full jitter approach for a mostly uniform distribution,\n // but bound it within initialDelay and delay for everyone's sanity.\n delay = Math.random() * delay;\n }\n\n return delay;\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/retry/index.d.ts new file mode 100644 index 0000000..b0bf346 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/index.d.ts @@ -0,0 +1,2 @@ +export * from "./retryLink.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/index.js b/graphql-subscription/node_modules/@apollo/client/link/retry/index.js new file mode 100644 index 0000000..ccc48f0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/index.js @@ -0,0 +1,2 @@ +export * from "./retryLink.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/retry/index.js.map new file mode 100644 index 0000000..dcfd8ed --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/retry/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./retryLink.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/package.json b/graphql-subscription/node_modules/@apollo/client/link/retry/package.json new file mode 100644 index 0000000..1e067ee --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/retry", + "type": "module", + "main": "retry.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs b/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs new file mode 100644 index 0000000..d8d4a34 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs @@ -0,0 +1,111 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); + +function buildDelayFunction(delayOptions) { + var _a = delayOptions || {}, _b = _a.initial, initial = _b === void 0 ? 300 : _b, _c = _a.jitter, jitter = _c === void 0 ? true : _c, _d = _a.max, max = _d === void 0 ? Infinity : _d; + var baseDelay = jitter ? initial : initial / 2; + return function delayFunction(count) { + var delay = Math.min(max, baseDelay * Math.pow(2, count)); + if (jitter) { + delay = Math.random() * delay; + } + return delay; + }; +} + +function buildRetryFunction(retryOptions) { + var _a = retryOptions || {}, retryIf = _a.retryIf, _b = _a.max, max = _b === void 0 ? 5 : _b; + return function retryFunction(count, operation, error) { + if (count >= max) + return false; + return retryIf ? retryIf(error, operation) : !!error; + }; +} + +var RetryableOperation = (function () { + function RetryableOperation(observer, operation, forward, delayFor, retryIf) { + var _this = this; + this.observer = observer; + this.operation = operation; + this.forward = forward; + this.delayFor = delayFor; + this.retryIf = retryIf; + this.retryCount = 0; + this.currentSubscription = null; + this.onError = function (error) { return tslib.__awaiter(_this, void 0, void 0, function () { + var shouldRetry; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + this.retryCount += 1; + return [4 , this.retryIf(this.retryCount, this.operation, error)]; + case 1: + shouldRetry = _a.sent(); + if (shouldRetry) { + this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error)); + return [2 ]; + } + this.observer.error(error); + return [2 ]; + } + }); + }); }; + this.try(); + } + RetryableOperation.prototype.cancel = function () { + if (this.currentSubscription) { + this.currentSubscription.unsubscribe(); + } + clearTimeout(this.timerId); + this.timerId = undefined; + this.currentSubscription = null; + }; + RetryableOperation.prototype.try = function () { + this.currentSubscription = this.forward(this.operation).subscribe({ + next: this.observer.next.bind(this.observer), + error: this.onError, + complete: this.observer.complete.bind(this.observer), + }); + }; + RetryableOperation.prototype.scheduleRetry = function (delay) { + var _this = this; + if (this.timerId) { + throw new Error("RetryLink BUG! Encountered overlapping retries"); + } + this.timerId = setTimeout(function () { + _this.timerId = undefined; + _this.try(); + }, delay); + }; + return RetryableOperation; +}()); +var RetryLink = (function (_super) { + tslib.__extends(RetryLink, _super); + function RetryLink(options) { + var _this = _super.call(this) || this; + var _a = options || {}, attempts = _a.attempts, delay = _a.delay; + _this.delayFor = + typeof delay === "function" ? delay : buildDelayFunction(delay); + _this.retryIf = + typeof attempts === "function" ? attempts : buildRetryFunction(attempts); + return _this; + } + RetryLink.prototype.request = function (operation, nextLink) { + var _this = this; + return new utilities.Observable(function (observer) { + var retryable = new RetryableOperation(observer, operation, nextLink, _this.delayFor, _this.retryIf); + return function () { + retryable.cancel(); + }; + }); + }; + return RetryLink; +}(core.ApolloLink)); + +exports.RetryLink = RetryLink; +//# sourceMappingURL=retry.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.map new file mode 100644 index 0000000..ca0cbf3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"retry.cjs","sources":["delayFunction.js","retryFunction.js","retryLink.js"],"sourcesContent":["export function buildDelayFunction(delayOptions) {\n var _a = delayOptions || {}, _b = _a.initial, initial = _b === void 0 ? 300 : _b, _c = _a.jitter, jitter = _c === void 0 ? true : _c, _d = _a.max, max = _d === void 0 ? Infinity : _d;\n // If we're jittering, baseDelay is half of the maximum delay for that\n // attempt (and is, on average, the delay we will encounter).\n // If we're not jittering, adjust baseDelay so that the first attempt\n // lines up with initialDelay, for everyone's sanity.\n var baseDelay = jitter ? initial : initial / 2;\n return function delayFunction(count) {\n var delay = Math.min(max, baseDelay * Math.pow(2, count));\n if (jitter) {\n // We opt for a full jitter approach for a mostly uniform distribution,\n // but bound it within initialDelay and delay for everyone's sanity.\n delay = Math.random() * delay;\n }\n return delay;\n };\n}\n//# sourceMappingURL=delayFunction.js.map","export function buildRetryFunction(retryOptions) {\n var _a = retryOptions || {}, retryIf = _a.retryIf, _b = _a.max, max = _b === void 0 ? 5 : _b;\n return function retryFunction(count, operation, error) {\n if (count >= max)\n return false;\n return retryIf ? retryIf(error, operation) : !!error;\n };\n}\n//# sourceMappingURL=retryFunction.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { buildDelayFunction } from \"./delayFunction.js\";\nimport { buildRetryFunction } from \"./retryFunction.js\";\n/**\n * Tracking and management of operations that may be (or currently are) retried.\n */\nvar RetryableOperation = /** @class */ (function () {\n function RetryableOperation(observer, operation, forward, delayFor, retryIf) {\n var _this = this;\n this.observer = observer;\n this.operation = operation;\n this.forward = forward;\n this.delayFor = delayFor;\n this.retryIf = retryIf;\n this.retryCount = 0;\n this.currentSubscription = null;\n this.onError = function (error) { return __awaiter(_this, void 0, void 0, function () {\n var shouldRetry;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.retryCount += 1;\n return [4 /*yield*/, this.retryIf(this.retryCount, this.operation, error)];\n case 1:\n shouldRetry = _a.sent();\n if (shouldRetry) {\n this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error));\n return [2 /*return*/];\n }\n this.observer.error(error);\n return [2 /*return*/];\n }\n });\n }); };\n this.try();\n }\n /**\n * Stop retrying for the operation, and cancel any in-progress requests.\n */\n RetryableOperation.prototype.cancel = function () {\n if (this.currentSubscription) {\n this.currentSubscription.unsubscribe();\n }\n clearTimeout(this.timerId);\n this.timerId = undefined;\n this.currentSubscription = null;\n };\n RetryableOperation.prototype.try = function () {\n this.currentSubscription = this.forward(this.operation).subscribe({\n next: this.observer.next.bind(this.observer),\n error: this.onError,\n complete: this.observer.complete.bind(this.observer),\n });\n };\n RetryableOperation.prototype.scheduleRetry = function (delay) {\n var _this = this;\n if (this.timerId) {\n throw new Error(\"RetryLink BUG! Encountered overlapping retries\");\n }\n this.timerId = setTimeout(function () {\n _this.timerId = undefined;\n _this.try();\n }, delay);\n };\n return RetryableOperation;\n}());\nvar RetryLink = /** @class */ (function (_super) {\n __extends(RetryLink, _super);\n function RetryLink(options) {\n var _this = _super.call(this) || this;\n var _a = options || {}, attempts = _a.attempts, delay = _a.delay;\n _this.delayFor =\n typeof delay === \"function\" ? delay : buildDelayFunction(delay);\n _this.retryIf =\n typeof attempts === \"function\" ? attempts : buildRetryFunction(attempts);\n return _this;\n }\n RetryLink.prototype.request = function (operation, nextLink) {\n var _this = this;\n return new Observable(function (observer) {\n var retryable = new RetryableOperation(observer, operation, nextLink, _this.delayFor, _this.retryIf);\n return function () {\n retryable.cancel();\n };\n });\n };\n return RetryLink;\n}(ApolloLink));\nexport { RetryLink };\n//# sourceMappingURL=retryLink.js.map"],"names":["__awaiter","__generator","__extends","Observable","ApolloLink"],"mappings":";;;;;;;;AAAO,SAAS,kBAAkB,CAAC,YAAY,EAAE;AACjD,IAAI,IAAI,EAAE,GAAG,YAAY,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,KAAK,KAAK,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAC;AAK3L,IAAI,IAAI,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,CAAC,CAAC;AACnD,IAAI,OAAO,SAAS,aAAa,CAAC,KAAK,EAAE;AACzC,QAAQ,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAClE,QAAQ,IAAI,MAAM,EAAE;AAGpB,YAAY,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;AAC1C,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK,CAAC;AACN;;AChBO,SAAS,kBAAkB,CAAC,YAAY,EAAE;AACjD,IAAI,IAAI,EAAE,GAAG,YAAY,IAAI,EAAE,EAAE,OAAO,GAAG,E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CAAC,CAAC;AAC5E,QAAQ,KAAK,CAAC,OAAO;AACrB,YAAY,OAAO,QAAQ,KAAK,UAAU,GAAG,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACrF,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE,QAAQ,EAAE;AACjE,QAAQ,IAAI,KAAK,GAAG,IAAI,CAAC;AACzB,QAAQ,OAAO,IAAIC,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAClD,YAAY,IAAI,SAAS,GAAG,IAAI,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AACjH,YAAY,OAAO,YAAY;AAC/B,gBAAgB,SAAS,CAAC,MAAM,EAAE,CAAC;AACnC,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,CAACC,eAAU,CAAC;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.native.js new file mode 100644 index 0000000..d8d4a34 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retry.cjs.native.js @@ -0,0 +1,111 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var core = require('../core'); +var utilities = require('../../utilities'); + +function buildDelayFunction(delayOptions) { + var _a = delayOptions || {}, _b = _a.initial, initial = _b === void 0 ? 300 : _b, _c = _a.jitter, jitter = _c === void 0 ? true : _c, _d = _a.max, max = _d === void 0 ? Infinity : _d; + var baseDelay = jitter ? initial : initial / 2; + return function delayFunction(count) { + var delay = Math.min(max, baseDelay * Math.pow(2, count)); + if (jitter) { + delay = Math.random() * delay; + } + return delay; + }; +} + +function buildRetryFunction(retryOptions) { + var _a = retryOptions || {}, retryIf = _a.retryIf, _b = _a.max, max = _b === void 0 ? 5 : _b; + return function retryFunction(count, operation, error) { + if (count >= max) + return false; + return retryIf ? retryIf(error, operation) : !!error; + }; +} + +var RetryableOperation = (function () { + function RetryableOperation(observer, operation, forward, delayFor, retryIf) { + var _this = this; + this.observer = observer; + this.operation = operation; + this.forward = forward; + this.delayFor = delayFor; + this.retryIf = retryIf; + this.retryCount = 0; + this.currentSubscription = null; + this.onError = function (error) { return tslib.__awaiter(_this, void 0, void 0, function () { + var shouldRetry; + return tslib.__generator(this, function (_a) { + switch (_a.label) { + case 0: + this.retryCount += 1; + return [4 , this.retryIf(this.retryCount, this.operation, error)]; + case 1: + shouldRetry = _a.sent(); + if (shouldRetry) { + this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error)); + return [2 ]; + } + this.observer.error(error); + return [2 ]; + } + }); + }); }; + this.try(); + } + RetryableOperation.prototype.cancel = function () { + if (this.currentSubscription) { + this.currentSubscription.unsubscribe(); + } + clearTimeout(this.timerId); + this.timerId = undefined; + this.currentSubscription = null; + }; + RetryableOperation.prototype.try = function () { + this.currentSubscription = this.forward(this.operation).subscribe({ + next: this.observer.next.bind(this.observer), + error: this.onError, + complete: this.observer.complete.bind(this.observer), + }); + }; + RetryableOperation.prototype.scheduleRetry = function (delay) { + var _this = this; + if (this.timerId) { + throw new Error("RetryLink BUG! Encountered overlapping retries"); + } + this.timerId = setTimeout(function () { + _this.timerId = undefined; + _this.try(); + }, delay); + }; + return RetryableOperation; +}()); +var RetryLink = (function (_super) { + tslib.__extends(RetryLink, _super); + function RetryLink(options) { + var _this = _super.call(this) || this; + var _a = options || {}, attempts = _a.attempts, delay = _a.delay; + _this.delayFor = + typeof delay === "function" ? delay : buildDelayFunction(delay); + _this.retryIf = + typeof attempts === "function" ? attempts : buildRetryFunction(attempts); + return _this; + } + RetryLink.prototype.request = function (operation, nextLink) { + var _this = this; + return new utilities.Observable(function (observer) { + var retryable = new RetryableOperation(observer, operation, nextLink, _this.delayFor, _this.retryIf); + return function () { + retryable.cancel(); + }; + }); + }; + return RetryLink; +}(core.ApolloLink)); + +exports.RetryLink = RetryLink; +//# sourceMappingURL=retry.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.d.ts b/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.d.ts new file mode 100644 index 0000000..f3b44ae --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.d.ts @@ -0,0 +1,30 @@ +import type { Operation } from "../core/index.js"; +/** + * Advanced mode: a function that determines both whether a particular + * response should be retried. + */ +export interface RetryFunction { + (count: number, operation: Operation, error: any): boolean | Promise; +} +export interface RetryFunctionOptions { + /** + * The max number of times to try a single operation before giving up. + * + * Note that this INCLUDES the initial request as part of the count. + * E.g. maxTries of 1 indicates no retrying should occur. + * + * Defaults to 5. Pass Infinity for infinite retries. + */ + max?: number; + /** + * Predicate function that determines whether a particular error should + * trigger a retry. + * + * For example, you may want to not retry 4xx class HTTP errors. + * + * By default, all errors are retried. + */ + retryIf?: (error: any, operation: Operation) => boolean | Promise; +} +export declare function buildRetryFunction(retryOptions?: RetryFunctionOptions): RetryFunction; +//# sourceMappingURL=retryFunction.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js b/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js new file mode 100644 index 0000000..15337ae --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js @@ -0,0 +1,9 @@ +export function buildRetryFunction(retryOptions) { + var _a = retryOptions || {}, retryIf = _a.retryIf, _b = _a.max, max = _b === void 0 ? 5 : _b; + return function retryFunction(count, operation, error) { + if (count >= max) + return false; + return retryIf ? retryIf(error, operation) : !!error; + }; +} +//# sourceMappingURL=retryFunction.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js.map b/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js.map new file mode 100644 index 0000000..325c186 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retryFunction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"retryFunction.js","sourceRoot":"","sources":["../../../src/link/retry/retryFunction.ts"],"names":[],"mappings":"AAgCA,MAAM,UAAU,kBAAkB,CAChC,YAAmC;IAE7B,IAAA,KAAuB,YAAY,IAAK,EAA2B,EAAjE,OAAO,aAAA,EAAE,WAAO,EAAP,GAAG,mBAAG,CAAC,KAAiD,CAAC;IAC1E,OAAO,SAAS,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK;QACnD,IAAI,KAAK,IAAI,GAAG;YAAE,OAAO,KAAK,CAAC;QAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Operation } from \"../core/index.js\";\n\n/**\n * Advanced mode: a function that determines both whether a particular\n * response should be retried.\n */\nexport interface RetryFunction {\n (count: number, operation: Operation, error: any): boolean | Promise;\n}\n\nexport interface RetryFunctionOptions {\n /**\n * The max number of times to try a single operation before giving up.\n *\n * Note that this INCLUDES the initial request as part of the count.\n * E.g. maxTries of 1 indicates no retrying should occur.\n *\n * Defaults to 5. Pass Infinity for infinite retries.\n */\n max?: number;\n\n /**\n * Predicate function that determines whether a particular error should\n * trigger a retry.\n *\n * For example, you may want to not retry 4xx class HTTP errors.\n *\n * By default, all errors are retried.\n */\n retryIf?: (error: any, operation: Operation) => boolean | Promise;\n}\n\nexport function buildRetryFunction(\n retryOptions?: RetryFunctionOptions\n): RetryFunction {\n const { retryIf, max = 5 } = retryOptions || ({} as RetryFunctionOptions);\n return function retryFunction(count, operation, error) {\n if (count >= max) return false;\n return retryIf ? retryIf(error, operation) : !!error;\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.d.ts b/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.d.ts new file mode 100644 index 0000000..4ff028c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.d.ts @@ -0,0 +1,24 @@ +import type { Operation, FetchResult, NextLink } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +import type { DelayFunction, DelayFunctionOptions } from "./delayFunction.js"; +import type { RetryFunction, RetryFunctionOptions } from "./retryFunction.js"; +export declare namespace RetryLink { + interface Options { + /** + * Configuration for the delay strategy to use, or a custom delay strategy. + */ + delay?: DelayFunctionOptions | DelayFunction; + /** + * Configuration for the retry strategy to use, or a custom retry strategy. + */ + attempts?: RetryFunctionOptions | RetryFunction; + } +} +export declare class RetryLink extends ApolloLink { + private delayFor; + private retryIf; + constructor(options?: RetryLink.Options); + request(operation: Operation, nextLink: NextLink): Observable; +} +//# sourceMappingURL=retryLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js b/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js new file mode 100644 index 0000000..5c36f23 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js @@ -0,0 +1,92 @@ +import { __awaiter, __extends, __generator } from "tslib"; +import { ApolloLink } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +import { buildDelayFunction } from "./delayFunction.js"; +import { buildRetryFunction } from "./retryFunction.js"; +/** + * Tracking and management of operations that may be (or currently are) retried. + */ +var RetryableOperation = /** @class */ (function () { + function RetryableOperation(observer, operation, forward, delayFor, retryIf) { + var _this = this; + this.observer = observer; + this.operation = operation; + this.forward = forward; + this.delayFor = delayFor; + this.retryIf = retryIf; + this.retryCount = 0; + this.currentSubscription = null; + this.onError = function (error) { return __awaiter(_this, void 0, void 0, function () { + var shouldRetry; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + this.retryCount += 1; + return [4 /*yield*/, this.retryIf(this.retryCount, this.operation, error)]; + case 1: + shouldRetry = _a.sent(); + if (shouldRetry) { + this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error)); + return [2 /*return*/]; + } + this.observer.error(error); + return [2 /*return*/]; + } + }); + }); }; + this.try(); + } + /** + * Stop retrying for the operation, and cancel any in-progress requests. + */ + RetryableOperation.prototype.cancel = function () { + if (this.currentSubscription) { + this.currentSubscription.unsubscribe(); + } + clearTimeout(this.timerId); + this.timerId = undefined; + this.currentSubscription = null; + }; + RetryableOperation.prototype.try = function () { + this.currentSubscription = this.forward(this.operation).subscribe({ + next: this.observer.next.bind(this.observer), + error: this.onError, + complete: this.observer.complete.bind(this.observer), + }); + }; + RetryableOperation.prototype.scheduleRetry = function (delay) { + var _this = this; + if (this.timerId) { + throw new Error("RetryLink BUG! Encountered overlapping retries"); + } + this.timerId = setTimeout(function () { + _this.timerId = undefined; + _this.try(); + }, delay); + }; + return RetryableOperation; +}()); +var RetryLink = /** @class */ (function (_super) { + __extends(RetryLink, _super); + function RetryLink(options) { + var _this = _super.call(this) || this; + var _a = options || {}, attempts = _a.attempts, delay = _a.delay; + _this.delayFor = + typeof delay === "function" ? delay : buildDelayFunction(delay); + _this.retryIf = + typeof attempts === "function" ? attempts : buildRetryFunction(attempts); + return _this; + } + RetryLink.prototype.request = function (operation, nextLink) { + var _this = this; + return new Observable(function (observer) { + var retryable = new RetryableOperation(observer, operation, nextLink, _this.delayFor, _this.retryIf); + return function () { + retryable.cancel(); + }; + }); + }; + return RetryLink; +}(ApolloLink)); +export { RetryLink }; +//# sourceMappingURL=retryLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js.map b/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js.map new file mode 100644 index 0000000..3128327 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/retry/retryLink.js.map @@ -0,0 +1 @@ +{"version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AAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;;IAC7E,CAAC;IAEM,2BAAO,GAAd,UACE,SAAoB,EACpB,QAAkB;QAFpB,iBAgBC;QAZC,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC7B,IAAM,SAAS,GAAG,IAAI,kBAAkB,CACtC,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,KAAI,CAAC,QAAQ,EACb,KAAI,CAAC,OAAO,CACb,CAAC;YACF,OAAO;gBACL,SAAS,CAAC,MAAM,EAAE,CAAC;YACrB,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACH,gBAAC;AAAD,CAAC,AA9BD,CAA+B,UAAU,GA8BxC","sourcesContent":["import type { Operation, FetchResult, NextLink } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type { ObservableSubscription } from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type { DelayFunction, DelayFunctionOptions } from \"./delayFunction.js\";\nimport { buildDelayFunction } from \"./delayFunction.js\";\nimport type { RetryFunction, RetryFunctionOptions } from \"./retryFunction.js\";\nimport { buildRetryFunction } from \"./retryFunction.js\";\nimport type { SubscriptionObserver } from \"zen-observable-ts\";\n\nexport namespace RetryLink {\n export interface Options {\n /**\n * Configuration for the delay strategy to use, or a custom delay strategy.\n */\n delay?: DelayFunctionOptions | DelayFunction;\n\n /**\n * Configuration for the retry strategy to use, or a custom retry strategy.\n */\n attempts?: RetryFunctionOptions | RetryFunction;\n }\n}\n\n/**\n * Tracking and management of operations that may be (or currently are) retried.\n */\nclass RetryableOperation {\n private retryCount: number = 0;\n private currentSubscription: ObservableSubscription | null = null;\n private timerId: number | undefined;\n\n constructor(\n private observer: SubscriptionObserver,\n private operation: Operation,\n private forward: NextLink,\n private delayFor: DelayFunction,\n private retryIf: RetryFunction\n ) {\n this.try();\n }\n\n /**\n * Stop retrying for the operation, and cancel any in-progress requests.\n */\n public cancel() {\n if (this.currentSubscription) {\n this.currentSubscription.unsubscribe();\n }\n clearTimeout(this.timerId);\n this.timerId = undefined;\n this.currentSubscription = null;\n }\n\n private try() {\n this.currentSubscription = this.forward(this.operation).subscribe({\n next: this.observer.next.bind(this.observer),\n error: this.onError,\n complete: this.observer.complete.bind(this.observer),\n });\n }\n\n private onError = async (error: any) => {\n this.retryCount += 1;\n\n // Should we retry?\n const shouldRetry = await this.retryIf(\n this.retryCount,\n this.operation,\n error\n );\n if (shouldRetry) {\n this.scheduleRetry(this.delayFor(this.retryCount, this.operation, error));\n return;\n }\n\n this.observer.error(error);\n };\n\n private scheduleRetry(delay: number) {\n if (this.timerId) {\n throw new Error(`RetryLink BUG! Encountered overlapping retries`);\n }\n\n this.timerId = setTimeout(() => {\n this.timerId = undefined;\n this.try();\n }, delay) as any as number;\n }\n}\n\nexport class RetryLink extends ApolloLink {\n private delayFor: DelayFunction;\n private retryIf: RetryFunction;\n\n constructor(options?: RetryLink.Options) {\n super();\n const { attempts, delay } = options || ({} as RetryLink.Options);\n this.delayFor =\n typeof delay === \"function\" ? delay : buildDelayFunction(delay);\n this.retryIf =\n typeof attempts === \"function\" ? attempts : buildRetryFunction(attempts);\n }\n\n public request(\n operation: Operation,\n nextLink: NextLink\n ): Observable {\n return new Observable((observer) => {\n const retryable = new RetryableOperation(\n observer,\n operation,\n nextLink,\n this.delayFor,\n this.retryIf\n );\n return () => {\n retryable.cancel();\n };\n });\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/schema/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/schema/index.d.ts new file mode 100644 index 0000000..1132346 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/schema/index.d.ts @@ -0,0 +1,36 @@ +import type { GraphQLSchema } from "graphql"; +import type { Operation, FetchResult } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +export declare namespace SchemaLink { + type ResolverContext = Record; + type ResolverContextFunction = (operation: Operation) => ResolverContext | PromiseLike; + interface Options { + /** + * The schema to generate responses from. + */ + schema: GraphQLSchema; + /** + * The root value to use when generating responses. + */ + rootValue?: any; + /** + * A context to provide to resolvers declared within the schema. + */ + context?: ResolverContext | ResolverContextFunction; + /** + * Validate incoming queries against the given schema, returning + * validation errors as a GraphQL server would. + */ + validate?: boolean; + } +} +export declare class SchemaLink extends ApolloLink { + schema: SchemaLink.Options["schema"]; + rootValue: SchemaLink.Options["rootValue"]; + context: SchemaLink.Options["context"]; + validate: boolean; + constructor(options: SchemaLink.Options); + request(operation: Operation): Observable; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/schema/index.js b/graphql-subscription/node_modules/@apollo/client/link/schema/index.js new file mode 100644 index 0000000..d1234aa --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/schema/index.js @@ -0,0 +1,55 @@ +import { __extends } from "tslib"; +import { validate, execute } from "graphql"; +import { ApolloLink } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +var SchemaLink = /** @class */ (function (_super) { + __extends(SchemaLink, _super); + function SchemaLink(options) { + var _this = _super.call(this) || this; + _this.schema = options.schema; + _this.rootValue = options.rootValue; + _this.context = options.context; + _this.validate = !!options.validate; + return _this; + } + SchemaLink.prototype.request = function (operation) { + var _this = this; + return new Observable(function (observer) { + new Promise(function (resolve) { + return resolve(typeof _this.context === "function" ? + _this.context(operation) + : _this.context); + }) + .then(function (context) { + if (_this.validate) { + var validationErrors = validate(_this.schema, operation.query); + if (validationErrors.length > 0) { + return { errors: validationErrors }; + } + } + return execute({ + schema: _this.schema, + document: operation.query, + rootValue: _this.rootValue, + contextValue: context, + variableValues: operation.variables, + operationName: operation.operationName, + }); + }) + .then(function (data) { + if (!observer.closed) { + observer.next(data); + observer.complete(); + } + }) + .catch(function (error) { + if (!observer.closed) { + observer.error(error); + } + }); + }); + }; + return SchemaLink; +}(ApolloLink)); +export { SchemaLink }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/schema/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/schema/index.js.map new file mode 100644 index 0000000..c4dd8b9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/schema/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAgCtD;IAAgC,8BAAU;IAMxC,oBAAY,OAA2B;QACrC,YAAA,MAAK,WAAE,SAAC;QACR,KAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,KAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;;IACrC,CAAC;IAEM,4BAAO,GAAd,UAAe,SAAoB;QAAnC,iBAsCC;QArCC,OAAO,IAAI,UAAU,CAAc,UAAC,QAAQ;YAC1C,IAAI,OAAO,CAA6B,UAAC,OAAO;gBAC9C,OAAA,OAAO,CACL,OAAO,KAAI,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;oBAClC,KAAI,CAAC,OAAO,CAAC,SAAS,CAAC;oBACzB,CAAC,CAAC,KAAI,CAAC,OAAO,CACf;YAJD,CAIC,CACF;iBACE,IAAI,CAAC,UAAC,OAAO;gBACZ,IAAI,KAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,IAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAI,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;oBAChE,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAChC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;oBACtC,CAAC;gBACH,CAAC;gBAED,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,KAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,SAAS,CAAC,KAAK;oBACzB,SAAS,EAAE,KAAI,CAAC,SAAS;oBACzB,YAAY,EAAE,OAAO;oBACrB,cAAc,EAAE,SAAS,CAAC,SAAS;oBACnC,aAAa,EAAE,SAAS,CAAC,aAAa;iBACvC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,IAAI,CAAC,UAAC,IAAI;gBACT,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACpB,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACtB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,UAAC,KAAK;gBACX,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AArDD,CAAgC,UAAU,GAqDzC","sourcesContent":["import type { GraphQLSchema } from \"graphql\";\nimport { validate, execute } from \"graphql\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\n\nexport namespace SchemaLink {\n export type ResolverContext = Record;\n export type ResolverContextFunction = (\n operation: Operation\n ) => ResolverContext | PromiseLike;\n\n export interface Options {\n /**\n * The schema to generate responses from.\n */\n schema: GraphQLSchema;\n\n /**\n * The root value to use when generating responses.\n */\n rootValue?: any;\n\n /**\n * A context to provide to resolvers declared within the schema.\n */\n context?: ResolverContext | ResolverContextFunction;\n\n /**\n * Validate incoming queries against the given schema, returning\n * validation errors as a GraphQL server would.\n */\n validate?: boolean;\n }\n}\n\nexport class SchemaLink extends ApolloLink {\n public schema: SchemaLink.Options[\"schema\"];\n public rootValue: SchemaLink.Options[\"rootValue\"];\n public context: SchemaLink.Options[\"context\"];\n public validate: boolean;\n\n constructor(options: SchemaLink.Options) {\n super();\n this.schema = options.schema;\n this.rootValue = options.rootValue;\n this.context = options.context;\n this.validate = !!options.validate;\n }\n\n public request(operation: Operation): Observable {\n return new Observable((observer) => {\n new Promise((resolve) =>\n resolve(\n typeof this.context === \"function\" ?\n this.context(operation)\n : this.context\n )\n )\n .then((context) => {\n if (this.validate) {\n const validationErrors = validate(this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n\n return execute({\n schema: this.schema,\n document: operation.query,\n rootValue: this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then((data) => {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch((error) => {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/schema/package.json b/graphql-subscription/node_modules/@apollo/client/link/schema/package.json new file mode 100644 index 0000000..d47ad33 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/schema/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/schema", + "type": "module", + "main": "schema.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs b/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs new file mode 100644 index 0000000..daf2e1a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var graphql = require('graphql'); +var core = require('../core'); +var utilities = require('../../utilities'); + +var SchemaLink = (function (_super) { + tslib.__extends(SchemaLink, _super); + function SchemaLink(options) { + var _this = _super.call(this) || this; + _this.schema = options.schema; + _this.rootValue = options.rootValue; + _this.context = options.context; + _this.validate = !!options.validate; + return _this; + } + SchemaLink.prototype.request = function (operation) { + var _this = this; + return new utilities.Observable(function (observer) { + new Promise(function (resolve) { + return resolve(typeof _this.context === "function" ? + _this.context(operation) + : _this.context); + }) + .then(function (context) { + if (_this.validate) { + var validationErrors = graphql.validate(_this.schema, operation.query); + if (validationErrors.length > 0) { + return { errors: validationErrors }; + } + } + return graphql.execute({ + schema: _this.schema, + document: operation.query, + rootValue: _this.rootValue, + contextValue: context, + variableValues: operation.variables, + operationName: operation.operationName, + }); + }) + .then(function (data) { + if (!observer.closed) { + observer.next(data); + observer.complete(); + } + }) + .catch(function (error) { + if (!observer.closed) { + observer.error(error); + } + }); + }); + }; + return SchemaLink; +}(core.ApolloLink)); + +exports.SchemaLink = SchemaLink; +//# sourceMappingURL=schema.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.map new file mode 100644 index 0000000..5cd0775 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"schema.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { validate, execute } from \"graphql\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nvar SchemaLink = /** @class */ (function (_super) {\n __extends(SchemaLink, _super);\n function SchemaLink(options) {\n var _this = _super.call(this) || this;\n _this.schema = options.schema;\n _this.rootValue = options.rootValue;\n _this.context = options.context;\n _this.validate = !!options.validate;\n return _this;\n }\n SchemaLink.prototype.request = function (operation) {\n var _this = this;\n return new Observable(function (observer) {\n new Promise(function (resolve) {\n return resolve(typeof _this.context === \"function\" ?\n _this.context(operation)\n : _this.context);\n })\n .then(function (context) {\n if (_this.validate) {\n var validationErrors = validate(_this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n return execute({\n schema: _this.schema,\n document: operation.query,\n rootValue: _this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then(function (data) {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch(function (error) {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n };\n return SchemaLink;\n}(ApolloLink));\nexport { SchemaLink };\n//# sourceMappingURL=index.js.map"],"names":["__extends","Observable","validate","execute","ApolloLink"],"mappings":";;;;;;;;;AAIG,IAAC,UAAU,KAAkB,UAAU,MAAM,EAAE;AAClD,IAAIA,eAAS,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAClC,IAAI,SAAS,UAAU,CAAC,OAAO,EAAE;AACjC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AACtC,QAAQ,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;AAC5C,QAAQ,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACxC,QAAQ,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;AAC5C,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,UAAU,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE;AACxD,QAAQ,IAAI,KAAK,GAAG,IAAI,CAAC;AACzB,QAAQ,OAAO,IAAIC,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAClD,YAAY,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE;AAC3C,gBAA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CAAC;AAC1C,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,CAACC,eAAU,CAAC;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.native.js new file mode 100644 index 0000000..daf2e1a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/schema/schema.cjs.native.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var graphql = require('graphql'); +var core = require('../core'); +var utilities = require('../../utilities'); + +var SchemaLink = (function (_super) { + tslib.__extends(SchemaLink, _super); + function SchemaLink(options) { + var _this = _super.call(this) || this; + _this.schema = options.schema; + _this.rootValue = options.rootValue; + _this.context = options.context; + _this.validate = !!options.validate; + return _this; + } + SchemaLink.prototype.request = function (operation) { + var _this = this; + return new utilities.Observable(function (observer) { + new Promise(function (resolve) { + return resolve(typeof _this.context === "function" ? + _this.context(operation) + : _this.context); + }) + .then(function (context) { + if (_this.validate) { + var validationErrors = graphql.validate(_this.schema, operation.query); + if (validationErrors.length > 0) { + return { errors: validationErrors }; + } + } + return graphql.execute({ + schema: _this.schema, + document: operation.query, + rootValue: _this.rootValue, + contextValue: context, + variableValues: operation.variables, + operationName: operation.operationName, + }); + }) + .then(function (data) { + if (!observer.closed) { + observer.next(data); + observer.complete(); + } + }) + .catch(function (error) { + if (!observer.closed) { + observer.error(error); + } + }); + }); + }; + return SchemaLink; +}(core.ApolloLink)); + +exports.SchemaLink = SchemaLink; +//# sourceMappingURL=schema.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.d.ts new file mode 100644 index 0000000..99f24f9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.d.ts @@ -0,0 +1,10 @@ +import type { Client } from "graphql-ws"; +import type { Operation, FetchResult } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import { Observable } from "../../utilities/index.js"; +export declare class GraphQLWsLink extends ApolloLink { + readonly client: Client; + constructor(client: Client); + request(operation: Operation): Observable; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js new file mode 100644 index 0000000..c551840 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js @@ -0,0 +1,77 @@ +// This file is adapted from the graphql-ws npm package: +// https://github.com/enisdenjo/graphql-ws +// +// Most of the file comes from that package's README; some other parts (such as +// isLikeCloseEvent) come from its source. +// +// Here's the license of the original code: +// +// The MIT License (MIT) +// +// Copyright (c) 2020-2021 Denis Badurina +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +import { __assign, __extends } from "tslib"; +import { print } from "../../utilities/index.js"; +import { ApolloLink } from "../core/index.js"; +import { isNonNullObject, Observable } from "../../utilities/index.js"; +import { ApolloError } from "../../errors/index.js"; +// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event +function isLikeCloseEvent(val) { + return isNonNullObject(val) && "code" in val && "reason" in val; +} +// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event +function isLikeErrorEvent(err) { + var _a; + return isNonNullObject(err) && ((_a = err.target) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.CLOSED; +} +var GraphQLWsLink = /** @class */ (function (_super) { + __extends(GraphQLWsLink, _super); + function GraphQLWsLink(client) { + var _this = _super.call(this) || this; + _this.client = client; + return _this; + } + GraphQLWsLink.prototype.request = function (operation) { + var _this = this; + return new Observable(function (observer) { + return _this.client.subscribe(__assign(__assign({}, operation), { query: print(operation.query) }), { + next: observer.next.bind(observer), + complete: observer.complete.bind(observer), + error: function (err) { + if (err instanceof Error) { + return observer.error(err); + } + var likeClose = isLikeCloseEvent(err); + if (likeClose || isLikeErrorEvent(err)) { + return observer.error( + // reason will be available on clean closes + new Error("Socket closed".concat(likeClose ? " with event ".concat(err.code) : "").concat(likeClose ? " ".concat(err.reason) : ""))); + } + return observer.error(new ApolloError({ + graphQLErrors: Array.isArray(err) ? err : [err], + })); + }, + }); + }); + }; + return GraphQLWsLink; +}(ApolloLink)); +export { GraphQLWsLink }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js.map new file mode 100644 index 0000000..78b7ba0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/subscriptions/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,0CAA0C;AAC1C,EAAE;AACF,+EAA+E;AAC/E,0CAA0C;AAC1C,EAAE;AACF,2CA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,IAAI,CAAC,QAAQ,CAAC;gBAClC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC1C,KAAK,EAAE,UAAC,GAAG;oBACT,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;wBACzB,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAC7B,CAAC;oBACD,IAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;oBACxC,IAAI,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;wBACvC,OAAO,QAAQ,CAAC,KAAK;wBACnB,2CAA2C;wBAC3C,IAAI,KAAK,CACP,uBAAgB,SAAS,CAAC,CAAC,CAAC,sBAAe,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,EAAE,SACxD,SAAS,CAAC,CAAC,CAAC,WAAI,GAAG,CAAC,MAAM,CAAE,CAAC,CAAC,CAAC,EAAE,CACjC,CACH,CACF,CAAC;oBACJ,CAAC;oBAED,OAAO,QAAQ,CAAC,KAAK,CACnB,IAAI,WAAW,CAAC;wBACd,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;qBAChD,CAAC,CACH,CAAC;gBACJ,CAAC;aACF,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AAtCD,CAAmC,UAAU,GAsC5C","sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport { print } from \"../../utilities/index.js\";\nimport type { Client } from \"graphql-ws\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { isNonNullObject, Observable } from \"../../utilities/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val: unknown): val is CloseEvent {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err: unknown): err is Event {\n return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;\n}\n\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(operation: Operation): Observable {\n return new Observable((observer) => {\n return this.client.subscribe(\n { ...operation, query: print(operation.query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n const likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\n `Socket closed${likeClose ? ` with event ${err.code}` : \"\"}${\n likeClose ? ` ${err.reason}` : \"\"\n }`\n )\n );\n }\n\n return observer.error(\n new ApolloError({\n graphQLErrors: Array.isArray(err) ? err : [err],\n })\n );\n },\n }\n );\n });\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/subscriptions/package.json b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/package.json new file mode 100644 index 0000000..0c7a1b1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/subscriptions", + "type": "module", + "main": "subscriptions.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs new file mode 100644 index 0000000..85b8c44 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var core = require('../core'); +var errors = require('../../errors'); + +function isLikeCloseEvent(val) { + return utilities.isNonNullObject(val) && "code" in val && "reason" in val; +} +function isLikeErrorEvent(err) { + var _a; + return utilities.isNonNullObject(err) && ((_a = err.target) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.CLOSED; +} +var GraphQLWsLink = (function (_super) { + tslib.__extends(GraphQLWsLink, _super); + function GraphQLWsLink(client) { + var _this = _super.call(this) || this; + _this.client = client; + return _this; + } + GraphQLWsLink.prototype.request = function (operation) { + var _this = this; + return new utilities.Observable(function (observer) { + return _this.client.subscribe(tslib.__assign(tslib.__assign({}, operation), { query: utilities.print(operation.query) }), { + next: observer.next.bind(observer), + complete: observer.complete.bind(observer), + error: function (err) { + if (err instanceof Error) { + return observer.error(err); + } + var likeClose = isLikeCloseEvent(err); + if (likeClose || isLikeErrorEvent(err)) { + return observer.error( + new Error("Socket closed".concat(likeClose ? " with event ".concat(err.code) : "").concat(likeClose ? " ".concat(err.reason) : ""))); + } + return observer.error(new errors.ApolloError({ + graphQLErrors: Array.isArray(err) ? err : [err], + })); + }, + }); + }); + }; + return GraphQLWsLink; +}(core.ApolloLink)); + +exports.GraphQLWsLink = GraphQLWsLink; +//# sourceMappingURL=subscriptions.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.map new file mode 100644 index 0000000..50dae01 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriptions.cjs","sources":["index.js"],"sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { __assign, __extends } from \"tslib\";\nimport { print } from \"../../utilities/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { isNonNullObject, Observable } from \"../../utilities/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val) {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err) {\n var _a;\n return isNonNullObject(err) && ((_a = err.target) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.CLOSED;\n}\nvar GraphQLWsLink = /** @class */ (function (_super) {\n __extends(GraphQLWsLink, _super);\n function GraphQLWsLink(client) {\n var _this = _super.call(this) || this;\n _this.client = client;\n return _this;\n }\n GraphQLWsLink.prototype.request = function (operation) {\n var _this = this;\n return new Observable(function (observer) {\n return _this.client.subscribe(__assign(__assign({}, operation), { query: print(operation.query) }), {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: function (err) {\n if (err instanceof Error) {\n return observer.error(err);\n }\n var likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\"Socket closed\".concat(likeClose ? \" with event \".concat(err.code) : \"\").concat(likeClose ? \" \".concat(err.reason) : \"\")));\n }\n return observer.error(new ApolloError({\n graphQLErrors: Array.isArray(err) ? err : [err],\n }));\n },\n });\n });\n };\n return GraphQLWsLink;\n}(ApolloLink));\nexport { GraphQLWsLink };\n//# sourceMappingURL=index.js.map"],"names":["isNonNullObject","__extends","Observable","__assign","print","ApolloError","ApolloLink"],"mappings":";;;;;;;;;AAmCA,SAAS,gBAA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CAAC,QAAQ,CAAC;AAC1D,gBAAgB,KAAK,EAAE,UAAU,GAAG,EAAE;AACtC,oBAAoB,IAAI,GAAG,YAAY,KAAK,EAAE;AAC9C,wBAAwB,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACnD,qBAAqB;AACrB,oBAAoB,IAAI,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC1D,oBAAoB,IAAI,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE;AAC5D,wBAAwB,OAAO,QAAQ,CAAC,KAAK;AAE7C,wBAAwB,IAAI,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7J,qBAAqB;AACrB,oBAAoB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAIC,kBAAW,CAAC;AAC1D,wBAAwB,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;AACvE,qBAAqB,CAAC,CAAC,CAAC;AACxB,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAACC,eAAU,CAAC;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.native.js new file mode 100644 index 0000000..85b8c44 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/subscriptions/subscriptions.cjs.native.js @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var core = require('../core'); +var errors = require('../../errors'); + +function isLikeCloseEvent(val) { + return utilities.isNonNullObject(val) && "code" in val && "reason" in val; +} +function isLikeErrorEvent(err) { + var _a; + return utilities.isNonNullObject(err) && ((_a = err.target) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.CLOSED; +} +var GraphQLWsLink = (function (_super) { + tslib.__extends(GraphQLWsLink, _super); + function GraphQLWsLink(client) { + var _this = _super.call(this) || this; + _this.client = client; + return _this; + } + GraphQLWsLink.prototype.request = function (operation) { + var _this = this; + return new utilities.Observable(function (observer) { + return _this.client.subscribe(tslib.__assign(tslib.__assign({}, operation), { query: utilities.print(operation.query) }), { + next: observer.next.bind(observer), + complete: observer.complete.bind(observer), + error: function (err) { + if (err instanceof Error) { + return observer.error(err); + } + var likeClose = isLikeCloseEvent(err); + if (likeClose || isLikeErrorEvent(err)) { + return observer.error( + new Error("Socket closed".concat(likeClose ? " with event ".concat(err.code) : "").concat(likeClose ? " ".concat(err.reason) : ""))); + } + return observer.error(new errors.ApolloError({ + graphQLErrors: Array.isArray(err) ? err : [err], + })); + }, + }); + }); + }; + return GraphQLWsLink; +}(core.ApolloLink)); + +exports.GraphQLWsLink = GraphQLWsLink; +//# sourceMappingURL=subscriptions.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.d.ts new file mode 100644 index 0000000..ae70ce6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.d.ts @@ -0,0 +1,3 @@ +import type { GraphQLRequest, Operation } from "../core/index.js"; +export declare function createOperation(starting: any, operation: GraphQLRequest): Operation; +//# sourceMappingURL=createOperation.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js b/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js new file mode 100644 index 0000000..6d295c3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js @@ -0,0 +1,23 @@ +import { __assign } from "tslib"; +export function createOperation(starting, operation) { + var context = __assign({}, starting); + var setContext = function (next) { + if (typeof next === "function") { + context = __assign(__assign({}, context), next(context)); + } + else { + context = __assign(__assign({}, context), next); + } + }; + var getContext = function () { return (__assign({}, context)); }; + Object.defineProperty(operation, "setContext", { + enumerable: false, + value: setContext, + }); + Object.defineProperty(operation, "getContext", { + enumerable: false, + value: getContext, + }); + return operation; +} +//# sourceMappingURL=createOperation.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js.map new file mode 100644 index 0000000..b93d7a2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/createOperation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createOperation.js","sourceRoot":"","sources":["../../../src/link/utils/createOperation.ts"],"names":[],"mappings":";AAEA,MAAM,UAAU,eAAe,CAC7B,QAAa,EACb,SAAyB;IAEzB,IAAI,OAAO,gBAAQ,QAAQ,CAAE,CAAC;IAC9B,IAAM,UAAU,GAAG,UAAC,IAAS;QAC3B,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YAC/B,OAAO,yBAAQ,OAAO,GAAK,IAAI,CAAC,OAAO,CAAC,CAAE,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,OAAO,yBAAQ,OAAO,GAAK,IAAI,CAAE,CAAC;QACpC,CAAC;IACH,CAAC,CAAC;IACF,IAAM,UAAU,GAAG,cAAM,OAAA,cAAM,OAAO,EAAG,EAAhB,CAAgB,CAAC;IAE1C,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE;QAC7C,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE;QAC7C,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,OAAO,SAAsB,CAAC;AAChC,CAAC","sourcesContent":["import type { GraphQLRequest, Operation } from \"../core/index.js\";\n\nexport function createOperation(\n starting: any,\n operation: GraphQLRequest\n): Operation {\n let context = { ...starting };\n const setContext = (next: any) => {\n if (typeof next === \"function\") {\n context = { ...context, ...next(context) };\n } else {\n context = { ...context, ...next };\n }\n };\n const getContext = () => ({ ...context });\n\n Object.defineProperty(operation, \"setContext\", {\n enumerable: false,\n value: setContext,\n });\n\n Object.defineProperty(operation, \"getContext\", {\n enumerable: false,\n value: getContext,\n });\n\n return operation as Operation;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.d.ts new file mode 100644 index 0000000..d1ed433 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.d.ts @@ -0,0 +1,5 @@ +import type { DocumentNode } from "graphql"; +export declare function filterOperationVariables(variables: Record, query: DocumentNode): { + [x: string]: any; +}; +//# sourceMappingURL=filterOperationVariables.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js b/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js new file mode 100644 index 0000000..45f2656 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js @@ -0,0 +1,23 @@ +import { __assign } from "tslib"; +import { visit } from "graphql"; +export function filterOperationVariables(variables, query) { + var result = __assign({}, variables); + var unusedNames = new Set(Object.keys(variables)); + visit(query, { + Variable: function (node, _key, parent) { + // A variable type definition at the top level of a query is not + // enough to silence server-side errors about the variable being + // unused, so variable definitions do not count as usage. + // https://spec.graphql.org/draft/#sec-All-Variables-Used + if (parent && + parent.kind !== "VariableDefinition") { + unusedNames.delete(node.name.value); + } + }, + }); + unusedNames.forEach(function (name) { + delete result[name]; + }); + return result; +} +//# sourceMappingURL=filterOperationVariables.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js.map new file mode 100644 index 0000000..2ca89cf --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/filterOperationVariables.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filterOperationVariables.js","sourceRoot":"","sources":["../../../src/link/utils/filterOperationVariables.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,UAAU,wBAAwB,CACtC,SAA8B,EAC9B,KAAmB;IAEnB,IAAM,MAAM,gBAAQ,SAAS,CAAE,CAAC;IAChC,IAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,KAAK,CAAC,KAAK,EAAE;QACX,QAAQ,YAAC,IAAI,EAAE,IAAI,EAAE,MAAM;YACzB,gEAAgE;YAChE,gEAAgE;YAChE,yDAAyD;YACzD,yDAAyD;YACzD,IACE,MAAM;gBACL,MAAiC,CAAC,IAAI,KAAK,oBAAoB,EAChE,CAAC;gBACD,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IACH,WAAW,CAAC,OAAO,CAAC,UAAC,IAAI;QACvB,OAAO,MAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { VariableDefinitionNode, DocumentNode } from \"graphql\";\nimport { visit } from \"graphql\";\n\nexport function filterOperationVariables(\n variables: Record,\n query: DocumentNode\n) {\n const result = { ...variables };\n const unusedNames = new Set(Object.keys(variables));\n visit(query, {\n Variable(node, _key, parent) {\n // A variable type definition at the top level of a query is not\n // enough to silence server-side errors about the variable being\n // unused, so variable definitions do not count as usage.\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n if (\n parent &&\n (parent as VariableDefinitionNode).kind !== \"VariableDefinition\"\n ) {\n unusedNames.delete(node.name.value);\n }\n },\n });\n unusedNames.forEach((name) => {\n delete result![name];\n });\n return result;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.d.ts new file mode 100644 index 0000000..af993a9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.d.ts @@ -0,0 +1,3 @@ +import { Observable } from "../../utilities/index.js"; +export declare function fromError(errorValue: any): Observable; +//# sourceMappingURL=fromError.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js b/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js new file mode 100644 index 0000000..d37c9c7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js @@ -0,0 +1,7 @@ +import { Observable } from "../../utilities/index.js"; +export function fromError(errorValue) { + return new Observable(function (observer) { + observer.error(errorValue); + }); +} +//# sourceMappingURL=fromError.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js.map new file mode 100644 index 0000000..ef651f3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/fromError.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fromError.js","sourceRoot":"","sources":["../../../src/link/utils/fromError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,UAAU,SAAS,CAAI,UAAe;IAC1C,OAAO,IAAI,UAAU,CAAI,UAAC,QAAQ;QAChC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Observable } from \"../../utilities/index.js\";\n\nexport function fromError(errorValue: any): Observable {\n return new Observable((observer) => {\n observer.error(errorValue);\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.d.ts new file mode 100644 index 0000000..91da668 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.d.ts @@ -0,0 +1,3 @@ +import { Observable } from "../../utilities/index.js"; +export declare function fromPromise(promise: Promise): Observable; +//# sourceMappingURL=fromPromise.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js b/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js new file mode 100644 index 0000000..2621648 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js @@ -0,0 +1,12 @@ +import { Observable } from "../../utilities/index.js"; +export function fromPromise(promise) { + return new Observable(function (observer) { + promise + .then(function (value) { + observer.next(value); + observer.complete(); + }) + .catch(observer.error.bind(observer)); + }); +} +//# sourceMappingURL=fromPromise.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js.map new file mode 100644 index 0000000..8501a11 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/fromPromise.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fromPromise.js","sourceRoot":"","sources":["../../../src/link/utils/fromPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,UAAU,WAAW,CAAI,OAAmB;IAChD,OAAO,IAAI,UAAU,CAAI,UAAC,QAAQ;QAChC,OAAO;aACJ,IAAI,CAAC,UAAC,KAAQ;YACb,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACtB,CAAC,CAAC;aACD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { Observable } from \"../../utilities/index.js\";\n\nexport function fromPromise(promise: Promise): Observable {\n return new Observable((observer) => {\n promise\n .then((value: T) => {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/index.d.ts new file mode 100644 index 0000000..82d620a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/index.d.ts @@ -0,0 +1,11 @@ +import "../../utilities/globals/index.js"; +export { fromError } from "./fromError.js"; +export { toPromise } from "./toPromise.js"; +export { fromPromise } from "./fromPromise.js"; +export type { ServerError } from "./throwServerError.js"; +export { throwServerError } from "./throwServerError.js"; +export { validateOperation } from "./validateOperation.js"; +export { createOperation } from "./createOperation.js"; +export { transformOperation } from "./transformOperation.js"; +export { filterOperationVariables } from "./filterOperationVariables.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/index.js b/graphql-subscription/node_modules/@apollo/client/link/utils/index.js new file mode 100644 index 0000000..e030c37 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/index.js @@ -0,0 +1,10 @@ +import "../../utilities/globals/index.js"; +export { fromError } from "./fromError.js"; +export { toPromise } from "./toPromise.js"; +export { fromPromise } from "./fromPromise.js"; +export { throwServerError } from "./throwServerError.js"; +export { validateOperation } from "./validateOperation.js"; +export { createOperation } from "./createOperation.js"; +export { transformOperation } from "./transformOperation.js"; +export { filterOperationVariables } from "./filterOperationVariables.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/index.js.map new file mode 100644 index 0000000..2c4d458 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport { fromError } from \"./fromError.js\";\nexport { toPromise } from \"./toPromise.js\";\nexport { fromPromise } from \"./fromPromise.js\";\nexport type { ServerError } from \"./throwServerError.js\";\nexport { throwServerError } from \"./throwServerError.js\";\nexport { validateOperation } from \"./validateOperation.js\";\nexport { createOperation } from \"./createOperation.js\";\nexport { transformOperation } from \"./transformOperation.js\";\nexport { filterOperationVariables } from \"./filterOperationVariables.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/package.json b/graphql-subscription/node_modules/@apollo/client/link/utils/package.json new file mode 100644 index 0000000..21c2e1a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/utils", + "type": "module", + "main": "utils.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.d.ts new file mode 100644 index 0000000..2147ef8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.d.ts @@ -0,0 +1,7 @@ +export type ServerError = Error & { + response: Response; + result: Record | string; + statusCode: number; +}; +export declare const throwServerError: (response: Response, result: any, message: string) => never; +//# sourceMappingURL=throwServerError.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js b/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js new file mode 100644 index 0000000..a29496f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js @@ -0,0 +1,9 @@ +export var throwServerError = function (response, result, message) { + var error = new Error(message); + error.name = "ServerError"; + error.response = response; + error.statusCode = response.status; + error.result = result; + throw error; +}; +//# sourceMappingURL=throwServerError.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js.map new file mode 100644 index 0000000..b8ed3b2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/throwServerError.js.map @@ -0,0 +1 @@ +{"version":3,"file":"throwServerError.js","sourceRoot":"","sources":["../../../src/link/utils/throwServerError.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAC9B,QAAkB,EAClB,MAAW,EACX,OAAe;IAEf,IAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAgB,CAAC;IAChD,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC;IAC3B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;IACnC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,KAAK,CAAC;AACd,CAAC,CAAC","sourcesContent":["export type ServerError = Error & {\n response: Response;\n result: Record | string;\n statusCode: number;\n};\n\nexport const throwServerError = (\n response: Response,\n result: any,\n message: string\n) => {\n const error = new Error(message) as ServerError;\n error.name = \"ServerError\";\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.d.ts new file mode 100644 index 0000000..2b41436 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.d.ts @@ -0,0 +1,3 @@ +import type { Observable } from "../../utilities/index.js"; +export declare function toPromise(observable: Observable): Promise; +//# sourceMappingURL=toPromise.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js b/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js new file mode 100644 index 0000000..3de5d93 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js @@ -0,0 +1,19 @@ +import { invariant } from "../../utilities/globals/index.js"; +export function toPromise(observable) { + var completed = false; + return new Promise(function (resolve, reject) { + observable.subscribe({ + next: function (data) { + if (completed) { + globalThis.__DEV__ !== false && invariant.warn(42); + } + else { + completed = true; + resolve(data); + } + }, + error: reject, + }); + }); +} +//# sourceMappingURL=toPromise.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js.map new file mode 100644 index 0000000..4b1c19d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/toPromise.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toPromise.js","sourceRoot":"","sources":["../../../src/link/utils/toPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAG7D,MAAM,UAAU,SAAS,CAAI,UAAyB;IACpD,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;QACpC,UAAU,CAAC,SAAS,CAAC;YACnB,IAAI,EAAE,UAAC,IAAI;gBACT,IAAI,SAAS,EAAE,CAAC;oBACd,SAAS,CAAC,IAAI,CACZ,mEAAmE,CACpE,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,SAAS,GAAG,IAAI,CAAC;oBACjB,OAAO,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC;YACD,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport type { Observable } from \"../../utilities/index.js\";\n\nexport function toPromise(observable: Observable): Promise {\n let completed = false;\n return new Promise((resolve, reject) => {\n observable.subscribe({\n next: (data) => {\n if (completed) {\n invariant.warn(\n `Promise Wrapper does not support multiple results from Observable`\n );\n } else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.d.ts new file mode 100644 index 0000000..90a495e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.d.ts @@ -0,0 +1,3 @@ +import type { GraphQLRequest } from "../core/index.js"; +export declare function transformOperation(operation: GraphQLRequest): GraphQLRequest; +//# sourceMappingURL=transformOperation.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js b/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js new file mode 100644 index 0000000..ef6bc79 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js @@ -0,0 +1,18 @@ +import { getOperationName } from "../../utilities/index.js"; +export function transformOperation(operation) { + var transformedOperation = { + variables: operation.variables || {}, + extensions: operation.extensions || {}, + operationName: operation.operationName, + query: operation.query, + }; + // Best guess at an operation name + if (!transformedOperation.operationName) { + transformedOperation.operationName = + typeof transformedOperation.query !== "string" ? + getOperationName(transformedOperation.query) || undefined + : ""; + } + return transformedOperation; +} +//# sourceMappingURL=transformOperation.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js.map new file mode 100644 index 0000000..100bd17 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/transformOperation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transformOperation.js","sourceRoot":"","sources":["../../../src/link/utils/transformOperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,UAAU,kBAAkB,CAAC,SAAyB;IAC1D,IAAM,oBAAoB,GAAmB;QAC3C,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,EAAE;QACpC,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,EAAE;QACtC,aAAa,EAAE,SAAS,CAAC,aAAa;QACtC,KAAK,EAAE,SAAS,CAAC,KAAK;KACvB,CAAC;IAEF,kCAAkC;IAClC,IAAI,CAAC,oBAAoB,CAAC,aAAa,EAAE,CAAC;QACxC,oBAAoB,CAAC,aAAa;YAChC,OAAO,oBAAoB,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;gBAC9C,gBAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,SAAS;gBAC3D,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;IAED,OAAO,oBAAiC,CAAC;AAC3C,CAAC","sourcesContent":["import type { GraphQLRequest, Operation } from \"../core/index.js\";\nimport { getOperationName } from \"../../utilities/index.js\";\n\nexport function transformOperation(operation: GraphQLRequest): GraphQLRequest {\n const transformedOperation: GraphQLRequest = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n\n // Best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== \"string\" ?\n getOperationName(transformedOperation.query) || undefined\n : \"\";\n }\n\n return transformedOperation as Operation;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs b/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs new file mode 100644 index 0000000..a8f038c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs @@ -0,0 +1,134 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +var tslib = require('tslib'); +var graphql = require('graphql'); + +function fromError(errorValue) { + return new utilities.Observable(function (observer) { + observer.error(errorValue); + }); +} + +function toPromise(observable) { + var completed = false; + return new Promise(function (resolve, reject) { + observable.subscribe({ + next: function (data) { + if (completed) { + globalThis.__DEV__ !== false && globals.invariant.warn(42); + } + else { + completed = true; + resolve(data); + } + }, + error: reject, + }); + }); +} + +function fromPromise(promise) { + return new utilities.Observable(function (observer) { + promise + .then(function (value) { + observer.next(value); + observer.complete(); + }) + .catch(observer.error.bind(observer)); + }); +} + +var throwServerError = function (response, result, message) { + var error = new Error(message); + error.name = "ServerError"; + error.response = response; + error.statusCode = response.status; + error.result = result; + throw error; +}; + +function validateOperation(operation) { + var OPERATION_FIELDS = [ + "query", + "operationName", + "variables", + "extensions", + "context", + ]; + for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { + var key = _a[_i]; + if (OPERATION_FIELDS.indexOf(key) < 0) { + throw globals.newInvariantError(43, key); + } + } + return operation; +} + +function createOperation(starting, operation) { + var context = tslib.__assign({}, starting); + var setContext = function (next) { + if (typeof next === "function") { + context = tslib.__assign(tslib.__assign({}, context), next(context)); + } + else { + context = tslib.__assign(tslib.__assign({}, context), next); + } + }; + var getContext = function () { return (tslib.__assign({}, context)); }; + Object.defineProperty(operation, "setContext", { + enumerable: false, + value: setContext, + }); + Object.defineProperty(operation, "getContext", { + enumerable: false, + value: getContext, + }); + return operation; +} + +function transformOperation(operation) { + var transformedOperation = { + variables: operation.variables || {}, + extensions: operation.extensions || {}, + operationName: operation.operationName, + query: operation.query, + }; + if (!transformedOperation.operationName) { + transformedOperation.operationName = + typeof transformedOperation.query !== "string" ? + utilities.getOperationName(transformedOperation.query) || undefined + : ""; + } + return transformedOperation; +} + +function filterOperationVariables(variables, query) { + var result = tslib.__assign({}, variables); + var unusedNames = new Set(Object.keys(variables)); + graphql.visit(query, { + Variable: function (node, _key, parent) { + if (parent && + parent.kind !== "VariableDefinition") { + unusedNames.delete(node.name.value); + } + }, + }); + unusedNames.forEach(function (name) { + delete result[name]; + }); + return result; +} + +exports.createOperation = createOperation; +exports.filterOperationVariables = filterOperationVariables; +exports.fromError = fromError; +exports.fromPromise = fromPromise; +exports.throwServerError = throwServerError; +exports.toPromise = toPromise; +exports.transformOperation = transformOperation; +exports.validateOperation = validateOperation; +//# sourceMappingURL=utils.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.map new file mode 100644 index 0000000..728d971 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.cjs","sources":["fromError.js","toPromise.js","fromPromise.js","throwServerError.js","validateOperation.js","createOperation.js","transformOperation.js","filterOperationVariables.js"],"sourcesContent":["import { Observable } from \"../../utilities/index.js\";\nexport function fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\n//# sourceMappingURL=fromError.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nexport function toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n globalThis.__DEV__ !== false && invariant.warn(42);\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n//# sourceMappingURL=toPromise.js.map","import { Observable } from \"../../utilities/index.js\";\nexport function fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n//# sourceMappingURL=fromPromise.js.map","export var throwServerError = function (response, result, message) {\n var error = new Error(message);\n error.name = \"ServerError\";\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n//# sourceMappingURL=throwServerError.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport function validateOperation(operation) {\n var OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(43, key);\n }\n }\n return operation;\n}\n//# sourceMappingURL=validateOperation.js.map","import { __assign } from \"tslib\";\nexport function createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === \"function\") {\n context = __assign(__assign({}, context), next(context));\n }\n else {\n context = __assign(__assign({}, context), next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, \"setContext\", {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, \"getContext\", {\n enumerable: false,\n value: getContext,\n });\n return operation;\n}\n//# sourceMappingURL=createOperation.js.map","import { getOperationName } from \"../../utilities/index.js\";\nexport function transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n // Best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== \"string\" ?\n getOperationName(transformedOperation.query) || undefined\n : \"\";\n }\n return transformedOperation;\n}\n//# sourceMappingURL=transformOperation.js.map","import { __assign } from \"tslib\";\nimport { visit } from \"graphql\";\nexport function filterOperationVariables(variables, query) {\n var result = __assign({}, variables);\n var unusedNames = new Set(Object.keys(variables));\n visit(query, {\n Variable: function (node, _key, parent) {\n // A variable type definition at the top level of a query is not\n // enough to silence server-side errors about the variable being\n // unused, so variable definitions do not count as usage.\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n if (parent &&\n parent.kind !== \"VariableDefinition\") {\n unusedNames.delete(node.name.value);\n }\n },\n });\n unusedNames.forEach(function (name) {\n delete result[name];\n });\n return result;\n}\n//# sourceMappingURL=filterOperationVariables.js.map"],"names":["Observable","invariant","newInvariantError","__assign","getOperationName","visit"],"mappings":";;;;;;;;;AACO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,OAAO,IAAIA,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAC9C,QAAQ,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACnC,KAAK,CAAC,CAAC;AACP;;ACJO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,IAAI,SAAS,GAAG,KAAK,CAAC;AAC1B,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM,EAAE;AAClD,QAAQ,UAAU,CAAC,SAAS,CAAC;AAC7B,YAAY,IAAI,EAAE,UAAU,IAAI,EAAE;AAClC,gBAAgB,IAAI,SAAS,EAAE;AAC/B,oBAAoB,UAAU,CAAC,OAAO,KAAK,KAAK,IAAIC,iBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvE,iBAAiB;AACjB,qBAAqB;AACrB,oBAAoB,SAAS,GAAG,IAAI,CAAC;AACrC,oBAAoB,OAAO,CAAC,IAAI,CAAC,CAAC;AAClC,iBAAiB;AACjB,aAAa;AACb,YAAY,KAAK,EAAE,MAAM;AACzB,SAAS,CAAC,CAAC;AACX,KAAK,CAAC,CAAC;AACP;;AChBO,SAAS,WAAW,CAAC,OAAO,EAAE;AACrC,IAAI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,SAAS,CAAC,aAAa;AAC9C,QAAQ,KAAK,EAAE,SAAS,CAAC,KAAK;AAC9B,KAAK,CAAC;AAEN,IAAI,IAAI,CAAC,oBAAoB,CAAC,aAAa,EAAE;AAC7C,QAAQ,oBAAoB,CAAC,aAAa;AAC1C,YAAY,OAAO,oBAAoB,CAAC,KAAK,KAAK,QAAQ;AAC1D,gBAAgBC,0BAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,SAAS;AACzE,kBAAkB,EAAE,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,oBAAoB,CAAC;AAChC;;ACdO,SAAS,wBAAwB,CAAC,SAAS,EAAE,KAAK,EAAE;AAC3D,IAAI,IAAI,MAAM,GAAGD,cAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AACzC,IAAI,IAAI,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AACtD,IAAIE,aAAK,CAAC,KAAK,EAAE;AACjB,QAAQ,QAAQ,EAAE,UAAU,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;AAKhD,YAAY,IAAI,MAAM;AACtB,gBAAgB,MAAM,CAAC,IAAI,KAAK,oBAAoB,EAAE;AACtD,gBAAgB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpD,aAAa;AACb,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,WAAW,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE;AACxC,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5B,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,MAAM,CAAC;AAClB;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.native.js new file mode 100644 index 0000000..a8f038c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/utils.cjs.native.js @@ -0,0 +1,134 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +var tslib = require('tslib'); +var graphql = require('graphql'); + +function fromError(errorValue) { + return new utilities.Observable(function (observer) { + observer.error(errorValue); + }); +} + +function toPromise(observable) { + var completed = false; + return new Promise(function (resolve, reject) { + observable.subscribe({ + next: function (data) { + if (completed) { + globalThis.__DEV__ !== false && globals.invariant.warn(42); + } + else { + completed = true; + resolve(data); + } + }, + error: reject, + }); + }); +} + +function fromPromise(promise) { + return new utilities.Observable(function (observer) { + promise + .then(function (value) { + observer.next(value); + observer.complete(); + }) + .catch(observer.error.bind(observer)); + }); +} + +var throwServerError = function (response, result, message) { + var error = new Error(message); + error.name = "ServerError"; + error.response = response; + error.statusCode = response.status; + error.result = result; + throw error; +}; + +function validateOperation(operation) { + var OPERATION_FIELDS = [ + "query", + "operationName", + "variables", + "extensions", + "context", + ]; + for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { + var key = _a[_i]; + if (OPERATION_FIELDS.indexOf(key) < 0) { + throw globals.newInvariantError(43, key); + } + } + return operation; +} + +function createOperation(starting, operation) { + var context = tslib.__assign({}, starting); + var setContext = function (next) { + if (typeof next === "function") { + context = tslib.__assign(tslib.__assign({}, context), next(context)); + } + else { + context = tslib.__assign(tslib.__assign({}, context), next); + } + }; + var getContext = function () { return (tslib.__assign({}, context)); }; + Object.defineProperty(operation, "setContext", { + enumerable: false, + value: setContext, + }); + Object.defineProperty(operation, "getContext", { + enumerable: false, + value: getContext, + }); + return operation; +} + +function transformOperation(operation) { + var transformedOperation = { + variables: operation.variables || {}, + extensions: operation.extensions || {}, + operationName: operation.operationName, + query: operation.query, + }; + if (!transformedOperation.operationName) { + transformedOperation.operationName = + typeof transformedOperation.query !== "string" ? + utilities.getOperationName(transformedOperation.query) || undefined + : ""; + } + return transformedOperation; +} + +function filterOperationVariables(variables, query) { + var result = tslib.__assign({}, variables); + var unusedNames = new Set(Object.keys(variables)); + graphql.visit(query, { + Variable: function (node, _key, parent) { + if (parent && + parent.kind !== "VariableDefinition") { + unusedNames.delete(node.name.value); + } + }, + }); + unusedNames.forEach(function (name) { + delete result[name]; + }); + return result; +} + +exports.createOperation = createOperation; +exports.filterOperationVariables = filterOperationVariables; +exports.fromError = fromError; +exports.fromPromise = fromPromise; +exports.throwServerError = throwServerError; +exports.toPromise = toPromise; +exports.transformOperation = transformOperation; +exports.validateOperation = validateOperation; +//# sourceMappingURL=utils.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.d.ts b/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.d.ts new file mode 100644 index 0000000..a13638f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.d.ts @@ -0,0 +1,3 @@ +import type { GraphQLRequest } from "../core/index.js"; +export declare function validateOperation(operation: GraphQLRequest): GraphQLRequest; +//# sourceMappingURL=validateOperation.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js b/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js new file mode 100644 index 0000000..1392119 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js @@ -0,0 +1,18 @@ +import { newInvariantError } from "../../utilities/globals/index.js"; +export function validateOperation(operation) { + var OPERATION_FIELDS = [ + "query", + "operationName", + "variables", + "extensions", + "context", + ]; + for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { + var key = _a[_i]; + if (OPERATION_FIELDS.indexOf(key) < 0) { + throw newInvariantError(43, key); + } + } + return operation; +} +//# sourceMappingURL=validateOperation.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js.map b/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js.map new file mode 100644 index 0000000..c154c32 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/utils/validateOperation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validateOperation.js","sourceRoot":"","sources":["../../../src/link/utils/validateOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,MAAM,UAAU,iBAAiB,CAAC,SAAyB;IACzD,IAAM,gBAAgB,GAAG;QACvB,OAAO;QACP,eAAe;QACf,WAAW;QACX,YAAY;QACZ,SAAS;KACV,CAAC;IACF,KAAgB,UAAsB,EAAtB,KAAA,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAtB,cAAsB,EAAtB,IAAsB,EAAE,CAAC;QAApC,IAAI,GAAG,SAAA;QACV,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,iBAAiB,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { newInvariantError } from \"../../utilities/globals/index.js\";\nimport type { GraphQLRequest } from \"../core/index.js\";\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(`illegal argument: %s`, key);\n }\n }\n\n return operation;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/ws/index.d.ts b/graphql-subscription/node_modules/@apollo/client/link/ws/index.d.ts new file mode 100644 index 0000000..124b985 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/ws/index.d.ts @@ -0,0 +1,31 @@ +import type { ClientOptions } from "subscriptions-transport-ws"; +import { SubscriptionClient } from "subscriptions-transport-ws"; +import type { Operation, FetchResult } from "../core/index.js"; +import { ApolloLink } from "../core/index.js"; +import type { Observable } from "../../utilities/index.js"; +export declare namespace WebSocketLink { + /** + * Configuration to use when constructing the subscription client (subscriptions-transport-ws). + */ + interface Configuration { + /** + * The endpoint to connect to. + */ + uri: string; + /** + * Options to pass when constructing the subscription client. + */ + options?: ClientOptions; + /** + * A custom WebSocket implementation to use. + */ + webSocketImpl?: any; + } +} +export import WebSocketParams = WebSocketLink.Configuration; +export declare class WebSocketLink extends ApolloLink { + private subscriptionClient; + constructor(paramsOrClient: WebSocketLink.Configuration | SubscriptionClient); + request(operation: Operation): Observable | null; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/ws/index.js b/graphql-subscription/node_modules/@apollo/client/link/ws/index.js new file mode 100644 index 0000000..80fc2f8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/ws/index.js @@ -0,0 +1,22 @@ +import { __extends } from "tslib"; +import { SubscriptionClient } from "subscriptions-transport-ws"; +import { ApolloLink } from "../core/index.js"; +var WebSocketLink = /** @class */ (function (_super) { + __extends(WebSocketLink, _super); + function WebSocketLink(paramsOrClient) { + var _this = _super.call(this) || this; + if (paramsOrClient instanceof SubscriptionClient) { + _this.subscriptionClient = paramsOrClient; + } + else { + _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl); + } + return _this; + } + WebSocketLink.prototype.request = function (operation) { + return this.subscriptionClient.request(operation); + }; + return WebSocketLink; +}(ApolloLink)); +export { WebSocketLink }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/ws/index.js.map b/graphql-subscription/node_modules/@apollo/client/link/ws/index.js.map new file mode 100644 index 0000000..751ec6b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/ws/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/ws/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4B9C;IAAmC,iCAAU;IAG3C,uBACE,cAAgE;QAEhE,YAAA,MAAK,WAAE,SAAC;QAER,IAAI,cAAc,YAAY,kBAAkB,EAAE,CAAC;YACjD,KAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,KAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAC9C,cAAc,CAAC,GAAG,EAClB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,aAAa,CAC7B,CAAC;QACJ,CAAC;;IACH,CAAC;IAEM,+BAAO,GAAd,UAAe,SAAoB;QACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CACpC,SAAS,CACiB,CAAC;IAC/B,CAAC;IACH,oBAAC;AAAD,CAAC,AAxBD,CAAmC,UAAU,GAwB5C","sourcesContent":["import type { ClientOptions } from \"subscriptions-transport-ws\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type { Observable } from \"../../utilities/index.js\";\n\nexport namespace WebSocketLink {\n /**\n * Configuration to use when constructing the subscription client (subscriptions-transport-ws).\n */\n export interface Configuration {\n /**\n * The endpoint to connect to.\n */\n uri: string;\n\n /**\n * Options to pass when constructing the subscription client.\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use.\n */\n webSocketImpl?: any;\n }\n}\n\n// For backwards compatibility.\nexport import WebSocketParams = WebSocketLink.Configuration;\n\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient\n ) {\n super();\n\n if (paramsOrClient instanceof SubscriptionClient) {\n this.subscriptionClient = paramsOrClient;\n } else {\n this.subscriptionClient = new SubscriptionClient(\n paramsOrClient.uri,\n paramsOrClient.options,\n paramsOrClient.webSocketImpl\n );\n }\n }\n\n public request(operation: Operation): Observable | null {\n return this.subscriptionClient.request(\n operation\n ) as Observable;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/ws/package.json b/graphql-subscription/node_modules/@apollo/client/link/ws/package.json new file mode 100644 index 0000000..8478b6f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/ws/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/link/ws", + "type": "module", + "main": "ws.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs b/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs new file mode 100644 index 0000000..456fcca --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs @@ -0,0 +1,28 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var subscriptionsTransportWs = require('subscriptions-transport-ws'); +var core = require('../core'); + +var WebSocketLink = (function (_super) { + tslib.__extends(WebSocketLink, _super); + function WebSocketLink(paramsOrClient) { + var _this = _super.call(this) || this; + if (paramsOrClient instanceof subscriptionsTransportWs.SubscriptionClient) { + _this.subscriptionClient = paramsOrClient; + } + else { + _this.subscriptionClient = new subscriptionsTransportWs.SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl); + } + return _this; + } + WebSocketLink.prototype.request = function (operation) { + return this.subscriptionClient.request(operation); + }; + return WebSocketLink; +}(core.ApolloLink)); + +exports.WebSocketLink = WebSocketLink; +//# sourceMappingURL=ws.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.map b/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.map new file mode 100644 index 0000000..5b95391 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\nimport { ApolloLink } from \"../core/index.js\";\nvar WebSocketLink = /** @class */ (function (_super) {\n __extends(WebSocketLink, _super);\n function WebSocketLink(paramsOrClient) {\n var _this = _super.call(this) || this;\n if (paramsOrClient instanceof SubscriptionClient) {\n _this.subscriptionClient = paramsOrClient;\n }\n else {\n _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);\n }\n return _this;\n }\n WebSocketLink.prototype.request = function (operation) {\n return this.subscriptionClient.request(operation);\n };\n return WebSocketLink;\n}(ApolloLink));\nexport { WebSocketLink };\n//# sourceMappingURL=index.js.map"],"names":["__extends","SubscriptionClient","ApolloLink"],"mappings":";;;;;;;;AAGG,IAAC,aAAa,KAAkB,UAAU,MAAM,EAAE;AACrD,IAAIA,eAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACrC,IAAI,SAAS,aAAa,CAAC,cAAc,EAAE;AAC3C,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,IAAI,cAAc,YAAYC,2CAAkB,EAAE;AAC1D,YAAY,KAAK,CAAC,kBAAkB,GAAG,cAAc,CAAC;AACtD,SAAS;AACT,aAAa;AACb,YAAY,KAAK,CAAC,kBAAkB,GAAG,IAAIA,2CAAkB,CAAC,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;AACxI,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE;AAC3D,QAAQ,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAC1D,KAAK,CAAC;AACN,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAACC,eAAU,CAAC;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.native.js new file mode 100644 index 0000000..456fcca --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/link/ws/ws.cjs.native.js @@ -0,0 +1,28 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var subscriptionsTransportWs = require('subscriptions-transport-ws'); +var core = require('../core'); + +var WebSocketLink = (function (_super) { + tslib.__extends(WebSocketLink, _super); + function WebSocketLink(paramsOrClient) { + var _this = _super.call(this) || this; + if (paramsOrClient instanceof subscriptionsTransportWs.SubscriptionClient) { + _this.subscriptionClient = paramsOrClient; + } + else { + _this.subscriptionClient = new subscriptionsTransportWs.SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl); + } + return _this; + } + WebSocketLink.prototype.request = function (operation) { + return this.subscriptionClient.request(operation); + }; + return WebSocketLink; +}(core.ApolloLink)); + +exports.WebSocketLink = WebSocketLink; +//# sourceMappingURL=ws.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/main.cjs b/graphql-subscription/node_modules/@apollo/client/main.cjs new file mode 100644 index 0000000..2cb971f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/main.cjs @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var core = require('./core'); +var react = require('./react'); + + + +for (var k in core) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +} +for (var k in react) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = react[k]; +} +//# sourceMappingURL=main.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/main.cjs.map b/graphql-subscription/node_modules/@apollo/client/main.cjs.map new file mode 100644 index 0000000..9500ead --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/main.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"main.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/main.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/main.cjs.native.js new file mode 100644 index 0000000..2cb971f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/main.cjs.native.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var core = require('./core'); +var react = require('./react'); + + + +for (var k in core) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +} +for (var k in react) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = react[k]; +} +//# sourceMappingURL=main.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/package.json b/graphql-subscription/node_modules/@apollo/client/package.json new file mode 100644 index 0000000..a9cc4b9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/package.json @@ -0,0 +1,161 @@ +{ + "name": "@apollo/client", + "version": "3.9.5", + "description": "A fully-featured caching GraphQL client.", + "private": false, + "keywords": [ + "apollo", + "graphql", + "react", + "hooks", + "client", + "cache" + ], + "author": "packages@apollographql.com", + "license": "MIT", + "main": "./main.cjs", + "module": "./index.js", + "types": "./index.d.ts", + "sideEffects": false, + "react-native": { + "./dist/cache/inmemory/fixPolyfills.js": "./cache/inmemory/fixPolyfills.native.js", + "react-dom/server": false + }, + "repository": { + "type": "git", + "url": "git+https://github.com/apollographql/apollo-client.git" + }, + "bugs": { + "url": "https://github.com/apollographql/apollo-client/issues" + }, + "homepage": "https://www.apollographql.com/docs/react/", + "peerDependencies": { + "graphql": "^15.0.0 || ^16.0.0", + "graphql-ws": "^5.5.5", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0", + "subscriptions-transport-ws": "^0.9.0 || ^0.11.0" + }, + "peerDependenciesMeta": { + "graphql-ws": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "subscriptions-transport-ws": { + "optional": true + } + }, + "dependencies": { + "@graphql-typed-document-node/core": "^3.1.1", + "@wry/caches": "^1.0.0", + "@wry/equality": "^0.5.6", + "@wry/trie": "^0.5.0", + "graphql-tag": "^2.12.6", + "hoist-non-react-statics": "^3.3.2", + "optimism": "^0.18.0", + "prop-types": "^15.7.2", + "rehackt": "0.0.5", + "response-iterator": "^0.2.6", + "symbol-observable": "^4.0.0", + "ts-invariant": "^0.10.3", + "tslib": "^2.3.0", + "zen-observable-ts": "^1.2.5" + }, + "devDependencies": { + "@arethetypeswrong/cli": "0.13.8", + "@babel/parser": "7.23.9", + "@changesets/changelog-github": "0.5.0", + "@changesets/cli": "2.27.1", + "@graphql-tools/schema": "10.0.2", + "@microsoft/api-extractor": "7.40.1", + "@rollup/plugin-node-resolve": "11.2.1", + "@size-limit/esbuild-why": "11.0.2", + "@size-limit/preset-small-lib": "11.0.2", + "@testing-library/jest-dom": "6.4.2", + "@testing-library/react": "14.2.1", + "@testing-library/react-12": "npm:@testing-library/react@^12", + "@testing-library/user-event": "14.5.2", + "@tsconfig/node20": "20.1.2", + "@types/bytes": "3.1.4", + "@types/fetch-mock": "7.3.8", + "@types/glob": "8.1.0", + "@types/hoist-non-react-statics": "3.3.5", + "@types/jest": "29.5.12", + "@types/lodash": "4.14.202", + "@types/node": "20.11.17", + "@types/node-fetch": "2.6.11", + "@types/react": "18.2.55", + "@types/react-dom": "18.2.19", + "@types/relay-runtime": "14.1.23", + "@types/use-sync-external-store": "0.0.6", + "@typescript-eslint/eslint-plugin": "6.21.0", + "@typescript-eslint/parser": "6.21.0", + "@typescript-eslint/rule-tester": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "acorn": "8.11.3", + "blob-polyfill": "7.0.20220408", + "bytes": "3.1.2", + "cross-fetch": "4.0.0", + "eslint": "8.56.0", + "eslint-import-resolver-typescript": "3.6.1", + "eslint-plugin-import": "npm:@phryneas/eslint-plugin-import@2.27.5-pr.2813.2817.199971c", + "eslint-plugin-local-rules": "2.0.1", + "eslint-plugin-testing-library": "6.2.0", + "expect-type": "0.17.3", + "fetch-mock": "9.11.0", + "glob": "8.1.0", + "graphql": "16.8.1", + "graphql-ws": "5.15.0", + "jest": "29.7.0", + "jest-environment-jsdom": "29.7.0", + "jest-junit": "16.0.0", + "lodash": "4.17.21", + "patch-package": "8.0.0", + "prettier": "3.1.1", + "react": "18.2.0", + "react-17": "npm:react@^17", + "react-dom": "18.2.0", + "react-dom-17": "npm:react-dom@^17", + "react-error-boundary": "4.0.12", + "recast": "0.23.4", + "resolve": "1.22.8", + "rimraf": "5.0.5", + "rollup": "2.79.1", + "rollup-plugin-cleanup": "3.2.1", + "rollup-plugin-terser": "7.0.2", + "rxjs": "7.8.1", + "size-limit": "11.0.2", + "subscriptions-transport-ws": "0.11.0", + "terser": "5.27.0", + "ts-api-utils": "1.2.1", + "ts-jest": "29.1.2", + "ts-jest-resolver": "2.0.1", + "ts-morph": "21.0.1", + "ts-node": "10.9.2", + "typedoc": "0.25.0", + "typescript": "5.3.3", + "wait-for-observables": "1.0.3", + "web-streams-polyfill": "3.3.2", + "whatwg-fetch": "3.6.20" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "LICENSE", + "**/*.md", + "**/*.cjs", + "**/*.cjs.map", + "**/*.js", + "**/*.js.map", + "**/*.d.ts", + "**/*.json" + ], + "type": "module" +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.d.ts b/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.d.ts new file mode 100644 index 0000000..0ee7913 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.d.ts @@ -0,0 +1,18 @@ +import * as PropTypes from "prop-types"; +import type * as ReactTypes from "react"; +import type { OperationVariables } from "../../core/index.js"; +import type { MutationComponentOptions } from "./types.js"; +/** + * @deprecated + * Official support for React Apollo render prop components ended in March 2020. + * This library is still included in the `@apollo/client` package, + * but it no longer receives feature updates or bug fixes. + */ +export declare function Mutation(props: MutationComponentOptions): ReactTypes.JSX.Element | null; +export declare namespace Mutation { + var propTypes: PropTypes.InferProps>>; +} +export interface Mutation { + propTypes: PropTypes.InferProps>; +} +//# sourceMappingURL=Mutation.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js b/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js new file mode 100644 index 0000000..633ae7a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js @@ -0,0 +1,28 @@ +import * as PropTypes from "prop-types"; +import { useMutation } from "../hooks/index.js"; +/** + * @deprecated + * Official support for React Apollo render prop components ended in March 2020. + * This library is still included in the `@apollo/client` package, + * but it no longer receives feature updates or bug fixes. + */ +export function Mutation(props) { + var _a = useMutation(props.mutation, props), runMutation = _a[0], result = _a[1]; + return props.children ? props.children(runMutation, result) : null; +} +Mutation.propTypes = { + mutation: PropTypes.object.isRequired, + variables: PropTypes.object, + optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]), + refetchQueries: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])), + PropTypes.func, + ]), + awaitRefetchQueries: PropTypes.bool, + update: PropTypes.func, + children: PropTypes.func.isRequired, + onCompleted: PropTypes.func, + onError: PropTypes.func, + fetchPolicy: PropTypes.string, +}; +//# sourceMappingURL=Mutation.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js.map b/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js.map new file mode 100644 index 0000000..f2bbab7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Mutation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Mutation.js","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAkD;IAE5C,IAAA,KAAwB,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAzD,WAAW,QAAA,EAAE,MAAM,QAAsC,CAAC;IACjE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAMD,QAAQ,CAAC,SAAS,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACrC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,kBAAkB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3E,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC;QAClC,SAAS,CAAC,OAAO,CACf,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAC1D;QACD,SAAS,CAAC,IAAI;KACf,CAAC;IACF,mBAAmB,EAAE,SAAS,CAAC,IAAI;IACnC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;CACK,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { MutationComponentOptions } from \"./types.js\";\nimport { useMutation } from \"../hooks/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Mutation(\n props: MutationComponentOptions\n): ReactTypes.JSX.Element | null {\n const [runMutation, result] = useMutation(props.mutation, props);\n return props.children ? props.children(runMutation, result) : null;\n}\n\nexport interface Mutation {\n propTypes: PropTypes.InferProps>;\n}\n\nMutation.propTypes = {\n mutation: PropTypes.object.isRequired,\n variables: PropTypes.object,\n optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),\n refetchQueries: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.string, PropTypes.object])\n ),\n PropTypes.func,\n ]),\n awaitRefetchQueries: PropTypes.bool,\n update: PropTypes.func,\n children: PropTypes.func.isRequired,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n fetchPolicy: PropTypes.string,\n} as Mutation[\"propTypes\"];\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Query.d.ts b/graphql-subscription/node_modules/@apollo/client/react/components/Query.d.ts new file mode 100644 index 0000000..40e94f3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Query.d.ts @@ -0,0 +1,18 @@ +import * as PropTypes from "prop-types"; +import type * as ReactTypes from "react"; +import type { OperationVariables } from "../../core/index.js"; +import type { QueryComponentOptions } from "./types.js"; +/** + * @deprecated + * Official support for React Apollo render prop components ended in March 2020. + * This library is still included in the `@apollo/client` package, + * but it no longer receives feature updates or bug fixes. + */ +export declare function Query(props: QueryComponentOptions): ReactTypes.JSX.Element | null; +export declare namespace Query { + var propTypes: PropTypes.InferProps>; +} +export interface Query { + propTypes: PropTypes.InferProps>; +} +//# sourceMappingURL=Query.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Query.js b/graphql-subscription/node_modules/@apollo/client/react/components/Query.js new file mode 100644 index 0000000..4f0a2ca --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Query.js @@ -0,0 +1,29 @@ +import { __rest } from "tslib"; +import * as PropTypes from "prop-types"; +import { useQuery } from "../hooks/index.js"; +/** + * @deprecated + * Official support for React Apollo render prop components ended in March 2020. + * This library is still included in the `@apollo/client` package, + * but it no longer receives feature updates or bug fixes. + */ +export function Query(props) { + var children = props.children, query = props.query, options = __rest(props, ["children", "query"]); + var result = useQuery(query, options); + return result ? children(result) : null; +} +Query.propTypes = { + client: PropTypes.object, + children: PropTypes.func.isRequired, + fetchPolicy: PropTypes.string, + notifyOnNetworkStatusChange: PropTypes.bool, + onCompleted: PropTypes.func, + onError: PropTypes.func, + pollInterval: PropTypes.number, + query: PropTypes.object.isRequired, + variables: PropTypes.object, + ssr: PropTypes.bool, + partialRefetch: PropTypes.bool, + returnPartialData: PropTypes.bool, +}; +//# sourceMappingURL=Query.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Query.js.map b/graphql-subscription/node_modules/@apollo/client/react/components/Query.js.map new file mode 100644 index 0000000..5ec600d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Query.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Query.js","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAInB,KAA+C;IAEvC,IAAA,QAAQ,GAAwB,KAAK,SAA7B,EAAE,KAAK,GAAiB,KAAK,MAAtB,EAAK,OAAO,UAAK,KAAK,EAAvC,qBAA+B,CAAF,CAAW;IAC9C,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAMD,KAAK,CAAC,SAAS,GAAG;IAChB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,2BAA2B,EAAE,SAAS,CAAC,IAAI;IAC3C,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM;IAC9B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,GAAG,EAAE,SAAS,CAAC,IAAI;IACnB,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,iBAAiB,EAAE,SAAS,CAAC,IAAI;CACF,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { QueryComponentOptions } from \"./types.js\";\nimport { useQuery } from \"../hooks/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Query<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n props: QueryComponentOptions\n): ReactTypes.JSX.Element | null {\n const { children, query, ...options } = props;\n const result = useQuery(query, options);\n return result ? children(result as any) : null;\n}\n\nexport interface Query {\n propTypes: PropTypes.InferProps>;\n}\n\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool,\n} as Query[\"propTypes\"];\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.d.ts b/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.d.ts new file mode 100644 index 0000000..a107b7e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.d.ts @@ -0,0 +1,18 @@ +import * as PropTypes from "prop-types"; +import type * as ReactTypes from "react"; +import type { OperationVariables } from "../../core/index.js"; +import type { SubscriptionComponentOptions } from "./types.js"; +/** + * @deprecated + * Official support for React Apollo render prop components ended in March 2020. + * This library is still included in the `@apollo/client` package, + * but it no longer receives feature updates or bug fixes. + */ +export declare function Subscription(props: SubscriptionComponentOptions): ReactTypes.JSX.Element | null; +export declare namespace Subscription { + var propTypes: PropTypes.InferProps>; +} +export interface Subscription { + propTypes: PropTypes.InferProps>; +} +//# sourceMappingURL=Subscription.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js b/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js new file mode 100644 index 0000000..237b470 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js @@ -0,0 +1,23 @@ +import * as PropTypes from "prop-types"; +import { useSubscription } from "../hooks/index.js"; +/** + * @deprecated + * Official support for React Apollo render prop components ended in March 2020. + * This library is still included in the `@apollo/client` package, + * but it no longer receives feature updates or bug fixes. + */ +export function Subscription(props) { + var result = useSubscription(props.subscription, props); + return props.children && result ? props.children(result) : null; +} +Subscription.propTypes = { + subscription: PropTypes.object.isRequired, + variables: PropTypes.object, + children: PropTypes.func, + onSubscriptionData: PropTypes.func, + onData: PropTypes.func, + onSubscriptionComplete: PropTypes.func, + onComplete: PropTypes.func, + shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]), +}; +//# sourceMappingURL=Subscription.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js.map b/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js.map new file mode 100644 index 0000000..11e73f0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/Subscription.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAKxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAI1B,KAAsD;IAEtD,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAQD,YAAY,CAAC,SAAS,GAAG;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,sBAAsB,EAAE,SAAS,CAAC,IAAI;IACtC,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,iBAAiB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC","sourcesContent":["import * as PropTypes from \"prop-types\";\nimport type * as ReactTypes from \"react\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { SubscriptionComponentOptions } from \"./types.js\";\nimport { useSubscription } from \"../hooks/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Subscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n props: SubscriptionComponentOptions\n): ReactTypes.JSX.Element | null {\n const result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\n\nexport interface Subscription {\n propTypes: PropTypes.InferProps<\n SubscriptionComponentOptions\n >;\n}\n\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),\n} as Subscription[\"propTypes\"];\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs b/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs new file mode 100644 index 0000000..ddafb29 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs @@ -0,0 +1,81 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var PropTypes = require('prop-types'); +var hooks = require('../hooks'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes); + +function Query(props) { + var children = props.children, query = props.query, options = tslib.__rest(props, ["children", "query"]); + var result = hooks.useQuery(query, options); + return result ? children(result) : null; +} +Query.propTypes = { + client: PropTypes__namespace.object, + children: PropTypes__namespace.func.isRequired, + fetchPolicy: PropTypes__namespace.string, + notifyOnNetworkStatusChange: PropTypes__namespace.bool, + onCompleted: PropTypes__namespace.func, + onError: PropTypes__namespace.func, + pollInterval: PropTypes__namespace.number, + query: PropTypes__namespace.object.isRequired, + variables: PropTypes__namespace.object, + ssr: PropTypes__namespace.bool, + partialRefetch: PropTypes__namespace.bool, + returnPartialData: PropTypes__namespace.bool, +}; + +function Mutation(props) { + var _a = hooks.useMutation(props.mutation, props), runMutation = _a[0], result = _a[1]; + return props.children ? props.children(runMutation, result) : null; +} +Mutation.propTypes = { + mutation: PropTypes__namespace.object.isRequired, + variables: PropTypes__namespace.object, + optimisticResponse: PropTypes__namespace.oneOfType([PropTypes__namespace.object, PropTypes__namespace.func]), + refetchQueries: PropTypes__namespace.oneOfType([ + PropTypes__namespace.arrayOf(PropTypes__namespace.oneOfType([PropTypes__namespace.string, PropTypes__namespace.object])), + PropTypes__namespace.func, + ]), + awaitRefetchQueries: PropTypes__namespace.bool, + update: PropTypes__namespace.func, + children: PropTypes__namespace.func.isRequired, + onCompleted: PropTypes__namespace.func, + onError: PropTypes__namespace.func, + fetchPolicy: PropTypes__namespace.string, +}; + +function Subscription(props) { + var result = hooks.useSubscription(props.subscription, props); + return props.children && result ? props.children(result) : null; +} +Subscription.propTypes = { + subscription: PropTypes__namespace.object.isRequired, + variables: PropTypes__namespace.object, + children: PropTypes__namespace.func, + onSubscriptionData: PropTypes__namespace.func, + onData: PropTypes__namespace.func, + onSubscriptionComplete: PropTypes__namespace.func, + onComplete: PropTypes__namespace.func, + shouldResubscribe: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.bool]), +}; + +exports.Mutation = Mutation; +exports.Query = Query; +exports.Subscription = Subscription; +//# sourceMappingURL=components.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.map new file mode 100644 index 0000000..0a1437f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"components.cjs","sources":["Query.js","Mutation.js","Subscription.js"],"sourcesContent":["import { __rest } from \"tslib\";\nimport * as PropTypes from \"prop-types\";\nimport { useQuery } from \"../hooks/index.js\";\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Query(props) {\n var children = props.children, query = props.query, options = __rest(props, [\"children\", \"query\"]);\n var result = useQuery(query, options);\n return result ? children(result) : null;\n}\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool,\n};\n//# sourceMappingURL=Query.js.map","import * as PropTypes from \"prop-types\";\nimport { useMutation } from \"../hooks/index.js\";\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Mutation(props) {\n var _a = useMutation(props.mutation, props), runMutation = _a[0], result = _a[1];\n return props.children ? props.children(runMutation, result) : null;\n}\nMutation.propTypes = {\n mutation: PropTypes.object.isRequired,\n variables: PropTypes.object,\n optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),\n refetchQueries: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),\n PropTypes.func,\n ]),\n awaitRefetchQueries: PropTypes.bool,\n update: PropTypes.func,\n children: PropTypes.func.isRequired,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n fetchPolicy: PropTypes.string,\n};\n//# sourceMappingURL=Mutation.js.map","import * as PropTypes from \"prop-types\";\nimport { useSubscription } from \"../hooks/index.js\";\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Subscription(props) {\n var result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),\n};\n//# sourceMappingURL=Subscription.js.map"],"names":["__rest","useQuery","PropTypes","useMutation","useSubscription"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,OAAO,GAAGA,YAAM,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AACvG,IAAI,IAAI,MAAM,GAAGC,cAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1C,IAAI,OAAO,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAC5C,CAAC;AACD,KAAK,CAAC,SAAS,GAAG;AAClB,IAAI,MAAM,EAAEC,oBAAS,CAAC,MAAM;AAC5B,IAAI,QAAQ,EAAEA,oBAAS,CAAC,IAAI,CAAC,UAAU;AACvC,IAAI,WAAW,EAAEA,oBAAS,CAAC,MAAM;AACjC,IAAI,2BAA2B,EAAEA,oBAAS,CAAC,IAAI;AAC/C,IAAI,WAAW,EAAEA,oBAAS,CAAC,IAAI;AAC/B,IAAI,OAAO,EAAEA,oBAAS,CAAC,IAAI;AAC3B,IAAI,YAAY,EAAEA,oBAAS,CAAC,MAAM;AAClC,IAAI,KAAK,EAAEA,oBAAS,CAAC,MAAM,CAAC,UAAU;AACtC,IAAI,SAAS,EAAEA,oBAAS,CAAC,MAAM;AAC/B,IAAI,GAAG,EAAEA,oBAAS,CAAC,IAAI;AACvB,IAAI,cAAc,EAAEA,oBAAS,CAAC,IAAI;AAClC,IAAI,iBAAiB,EAAEA,oBAAS,CAAC,IAAI;AACrC,CAAC;;ACnBM,SAAS,QAAQ,CAAC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,KAAK,CAAC,QAAQ,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACpE,CAAC;AACD,YAAY,CAAC,SAAS,GAAG;AACzB,IAAI,YAAY,EAAEF,oBAAS,CAAC,MAAM,CAAC,UAAU;AAC7C,IAAI,SAAS,EAAEA,oBAAS,CAAC,MAAM;AAC/B,IAAI,QAAQ,EAAEA,oBAAS,CAAC,IAAI;AAC5B,IAAI,kBAAkB,EAAEA,oBAAS,CAAC,IAAI;AACtC,IAAI,MAAM,EAAEA,oBAAS,CAAC,IAAI;AAC1B,IAAI,sBAAsB,EAAEA,oBAAS,CAAC,IAAI;AAC1C,IAAI,UAAU,EAAEA,oBAAS,CAAC,IAAI;AAC9B,IAAI,iBAAiB,EAAEA,oBAAS,CAAC,SAAS,CAAC,CAACA,oBAAS,CAAC,IAAI,EAAEA,oBAAS,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.native.js new file mode 100644 index 0000000..ddafb29 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/components.cjs.native.js @@ -0,0 +1,81 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var PropTypes = require('prop-types'); +var hooks = require('../hooks'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes); + +function Query(props) { + var children = props.children, query = props.query, options = tslib.__rest(props, ["children", "query"]); + var result = hooks.useQuery(query, options); + return result ? children(result) : null; +} +Query.propTypes = { + client: PropTypes__namespace.object, + children: PropTypes__namespace.func.isRequired, + fetchPolicy: PropTypes__namespace.string, + notifyOnNetworkStatusChange: PropTypes__namespace.bool, + onCompleted: PropTypes__namespace.func, + onError: PropTypes__namespace.func, + pollInterval: PropTypes__namespace.number, + query: PropTypes__namespace.object.isRequired, + variables: PropTypes__namespace.object, + ssr: PropTypes__namespace.bool, + partialRefetch: PropTypes__namespace.bool, + returnPartialData: PropTypes__namespace.bool, +}; + +function Mutation(props) { + var _a = hooks.useMutation(props.mutation, props), runMutation = _a[0], result = _a[1]; + return props.children ? props.children(runMutation, result) : null; +} +Mutation.propTypes = { + mutation: PropTypes__namespace.object.isRequired, + variables: PropTypes__namespace.object, + optimisticResponse: PropTypes__namespace.oneOfType([PropTypes__namespace.object, PropTypes__namespace.func]), + refetchQueries: PropTypes__namespace.oneOfType([ + PropTypes__namespace.arrayOf(PropTypes__namespace.oneOfType([PropTypes__namespace.string, PropTypes__namespace.object])), + PropTypes__namespace.func, + ]), + awaitRefetchQueries: PropTypes__namespace.bool, + update: PropTypes__namespace.func, + children: PropTypes__namespace.func.isRequired, + onCompleted: PropTypes__namespace.func, + onError: PropTypes__namespace.func, + fetchPolicy: PropTypes__namespace.string, +}; + +function Subscription(props) { + var result = hooks.useSubscription(props.subscription, props); + return props.children && result ? props.children(result) : null; +} +Subscription.propTypes = { + subscription: PropTypes__namespace.object.isRequired, + variables: PropTypes__namespace.object, + children: PropTypes__namespace.func, + onSubscriptionData: PropTypes__namespace.func, + onData: PropTypes__namespace.func, + onSubscriptionComplete: PropTypes__namespace.func, + onComplete: PropTypes__namespace.func, + shouldResubscribe: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.bool]), +}; + +exports.Mutation = Mutation; +exports.Query = Query; +exports.Subscription = Subscription; +//# sourceMappingURL=components.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/components/index.d.ts new file mode 100644 index 0000000..3dbd2ae --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/index.d.ts @@ -0,0 +1,5 @@ +export { Query } from "./Query.js"; +export { Mutation } from "./Mutation.js"; +export { Subscription } from "./Subscription.js"; +export * from "./types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/index.js b/graphql-subscription/node_modules/@apollo/client/react/components/index.js new file mode 100644 index 0000000..04a92a8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/index.js @@ -0,0 +1,5 @@ +export { Query } from "./Query.js"; +export { Mutation } from "./Mutation.js"; +export { Subscription } from "./Subscription.js"; +export * from "./types.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/components/index.js.map new file mode 100644 index 0000000..8aed0f7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,cAAc,YAAY,CAAC","sourcesContent":["export { Query } from \"./Query.js\";\nexport { Mutation } from \"./Mutation.js\";\nexport { Subscription } from \"./Subscription.js\";\n\nexport * from \"./types.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/package.json b/graphql-subscription/node_modules/@apollo/client/react/components/package.json new file mode 100644 index 0000000..8a80038 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react/components", + "type": "module", + "main": "components.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/types.d.ts b/graphql-subscription/node_modules/@apollo/client/react/components/types.d.ts new file mode 100644 index 0000000..8fae6c0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/types.d.ts @@ -0,0 +1,21 @@ +import type { DocumentNode } from "graphql"; +import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +import type * as ReactTypes from "react"; +import type { OperationVariables, DefaultContext, ApolloCache } from "../../core/index.js"; +import type { QueryFunctionOptions, QueryResult, BaseMutationOptions, MutationFunction, MutationResult, BaseSubscriptionOptions, SubscriptionResult } from "../types/types.js"; +export interface QueryComponentOptions extends QueryFunctionOptions { + children: (result: QueryResult) => ReactTypes.JSX.Element | null; + query: DocumentNode | TypedDocumentNode; +} +export interface MutationComponentOptions = ApolloCache> extends BaseMutationOptions { + mutation: DocumentNode | TypedDocumentNode; + children: (mutateFunction: MutationFunction, result: MutationResult) => ReactTypes.JSX.Element | null; +} +export interface SubscriptionComponentOptions extends BaseSubscriptionOptions { + /** + * A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single subscription inside of it. + */ + subscription: DocumentNode | TypedDocumentNode; + children?: null | ((result: SubscriptionResult) => ReactTypes.JSX.Element | null); +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/types.js b/graphql-subscription/node_modules/@apollo/client/react/components/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/components/types.js.map b/graphql-subscription/node_modules/@apollo/client/react/components/types.js.map new file mode 100644 index 0000000..85e00aa --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/components/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type * as ReactTypes from \"react\";\n\nimport type {\n OperationVariables,\n DefaultContext,\n ApolloCache,\n} from \"../../core/index.js\";\nimport type {\n QueryFunctionOptions,\n QueryResult,\n BaseMutationOptions,\n MutationFunction,\n MutationResult,\n BaseSubscriptionOptions,\n SubscriptionResult,\n} from \"../types/types.js\";\n\nexport interface QueryComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions {\n children: (\n result: QueryResult\n ) => ReactTypes.JSX.Element | null;\n query: DocumentNode | TypedDocumentNode;\n}\n\nexport interface MutationComponentOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> extends BaseMutationOptions {\n mutation: DocumentNode | TypedDocumentNode;\n children: (\n mutateFunction: MutationFunction,\n result: MutationResult\n ) => ReactTypes.JSX.Element | null;\n}\n\nexport interface SubscriptionComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#query:member} */\n subscription: DocumentNode | TypedDocumentNode;\n children?:\n | null\n | ((result: SubscriptionResult) => ReactTypes.JSX.Element | null);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.d.ts b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.d.ts new file mode 100644 index 0000000..bab9146 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.d.ts @@ -0,0 +1,7 @@ +import type * as ReactTypes from "react"; +import type { ApolloClient } from "../../core/index.js"; +export interface ApolloConsumerProps { + children: (client: ApolloClient) => ReactTypes.ReactChild | null; +} +export declare const ApolloConsumer: ReactTypes.FC; +//# sourceMappingURL=ApolloConsumer.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js new file mode 100644 index 0000000..9aeee80 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js @@ -0,0 +1,11 @@ +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +import { getApolloContext } from "./ApolloContext.js"; +export var ApolloConsumer = function (props) { + var ApolloContext = getApolloContext(); + return (React.createElement(ApolloContext.Consumer, null, function (context) { + invariant(context && context.client, 44); + return props.children(context.client); + })); +}; +//# sourceMappingURL=ApolloConsumer.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js.map b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js.map new file mode 100644 index 0000000..8666279 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloConsumer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,KAAK;IACtE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient) => ReactTypes.ReactChild | null;\n}\n\nexport const ApolloConsumer: ReactTypes.FC = (props) => {\n const ApolloContext = getApolloContext();\n return (\n \n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n \"Wrap the root component in an .\"\n );\n return props.children(context.client);\n }}\n \n );\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.d.ts b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.d.ts new file mode 100644 index 0000000..b977f5e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.d.ts @@ -0,0 +1,15 @@ +import type * as ReactTypes from "react"; +import type { ApolloClient } from "../../core/index.js"; +import type { RenderPromises } from "../ssr/index.js"; +export interface ApolloContextValue { + client?: ApolloClient; + renderPromises?: RenderPromises; +} +export declare function getApolloContext(): ReactTypes.Context; +/** + * @deprecated This function has no "resetting" effect since Apollo Client 3.4.12, + * and will be removed in the next major version of Apollo Client. + * If you want to get the Apollo Context, use `getApolloContext` instead. + */ +export declare const resetApolloContext: typeof getApolloContext; +//# sourceMappingURL=ApolloContext.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js new file mode 100644 index 0000000..ce7a5c0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js @@ -0,0 +1,29 @@ +import * as React from "rehackt"; +import { canUseSymbol } from "../../utilities/index.js"; +import { invariant } from "../../utilities/globals/index.js"; +// To make sure Apollo Client doesn't create more than one React context +// (which can lead to problems like having an Apollo Client instance added +// in one context, then attempting to retrieve it from another different +// context), a single Apollo context is created and tracked in global state. +var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__"; +export function getApolloContext() { + invariant("createContext" in React, 45); + var context = React.createContext[contextKey]; + if (!context) { + Object.defineProperty(React.createContext, contextKey, { + value: (context = React.createContext({})), + enumerable: false, + writable: false, + configurable: true, + }); + context.displayName = "ApolloContext"; + } + return context; +} +/** + * @deprecated This function has no "resetting" effect since Apollo Client 3.4.12, + * and will be removed in the next major version of Apollo Client. + * If you want to get the Apollo Context, use `getApolloContext` instead. + */ +export var resetApolloContext = getApolloContext; +//# sourceMappingURL=ApolloContext.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js.map b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js.map new file mode 100644 index 0000000..8a56657 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloContext.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAO7D,wEAAwE;AACxE,0EAA0E;AAC1E,wEAAwE;AACxE,4EAA4E;AAC5E,IAAM,UAAU,GACd,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC;AAEzE,MAAM,UAAU,gBAAgB;IAC9B,SAAS,CACP,eAAe,IAAI,KAAK,EACxB,+FAA+F;QAC7F,uGAAuG;QACvG,iEAAiE;QACjE,4GAA4G;QAC5G,sGAAsG,CACzG,CAAC;IAEF,IAAI,OAAO,GAAI,KAAK,CAAC,aAAqB,CACxC,UAAU,CAC0B,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE;YACrD,KAAK,EAAE,CAAC,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC;YAC9D,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;IACxC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport type { RenderPromises } from \"../ssr/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n\nexport interface ApolloContextValue {\n client?: ApolloClient;\n renderPromises?: RenderPromises;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey =\n canUseSymbol ? Symbol.for(\"__APOLLO_CONTEXT__\") : \"__APOLLO_CONTEXT__\";\n\nexport function getApolloContext(): ReactTypes.Context {\n invariant(\n \"createContext\" in React,\n \"Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n\" +\n \"The Apollo Client functionality you are trying to use is only available in React Client Components.\\n\" +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n \"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components\"\n );\n\n let context = (React.createContext as any)[\n contextKey\n ] as React.Context;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport const resetApolloContext = getApolloContext;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.d.ts b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.d.ts new file mode 100644 index 0000000..05889bc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.d.ts @@ -0,0 +1,8 @@ +import type * as ReactTypes from "react"; +import type { ApolloClient } from "../../core/index.js"; +export interface ApolloProviderProps { + client: ApolloClient; + children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null; +} +export declare const ApolloProvider: ReactTypes.FC>; +//# sourceMappingURL=ApolloProvider.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js new file mode 100644 index 0000000..2f22b72 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js @@ -0,0 +1,15 @@ +import { __assign } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +import { getApolloContext } from "./ApolloContext.js"; +export var ApolloProvider = function (_a) { + var client = _a.client, children = _a.children; + var ApolloContext = getApolloContext(); + var parentContext = React.useContext(ApolloContext); + var context = React.useMemo(function () { + return __assign(__assign({}, parentContext), { client: client || parentContext.client }); + }, [parentContext, client]); + invariant(context.client, 46); + return (React.createElement(ApolloContext.Provider, { value: context }, children)); +}; +//# sourceMappingURL=ApolloProvider.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js.map b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js.map new file mode 100644 index 0000000..ca3f861 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/ApolloProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD,MAAM,CAAC,IAAM,cAAc,GAA4C,UAAC,EAGvE;QAFC,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,IAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEtD,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,6BACK,aAAa,KAChB,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,IACtC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAE5B,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;QACtD,qDAAqD,CACxD,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAG,QAAQ,CAA0B,CAC5E,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\n\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"./ApolloContext.js\";\n\nexport interface ApolloProviderProps {\n client: ApolloClient;\n children: ReactTypes.ReactNode | ReactTypes.ReactNode[] | null;\n}\n\nexport const ApolloProvider: ReactTypes.FC> = ({\n client,\n children,\n}) => {\n const ApolloContext = getApolloContext();\n const parentContext = React.useContext(ApolloContext);\n\n const context = React.useMemo(() => {\n return {\n ...parentContext,\n client: client || parentContext.client,\n };\n }, [parentContext, client]);\n\n invariant(\n context.client,\n \"ApolloProvider was not passed a client instance. Make \" +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n {children}\n );\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs b/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs new file mode 100644 index 0000000..a58672d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var React = require('rehackt'); +var utilities = require('../../utilities'); +var tslib = require('tslib'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +var contextKey = utilities.canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__"; +function getApolloContext() { + globals.invariant("createContext" in React__namespace, 45); + var context = React__namespace.createContext[contextKey]; + if (!context) { + Object.defineProperty(React__namespace.createContext, contextKey, { + value: (context = React__namespace.createContext({})), + enumerable: false, + writable: false, + configurable: true, + }); + context.displayName = "ApolloContext"; + } + return context; +} +var resetApolloContext = getApolloContext; + +var ApolloConsumer = function (props) { + var ApolloContext = getApolloContext(); + return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) { + globals.invariant(context && context.client, 44); + return props.children(context.client); + })); +}; + +var ApolloProvider = function (_a) { + var client = _a.client, children = _a.children; + var ApolloContext = getApolloContext(); + var parentContext = React__namespace.useContext(ApolloContext); + var context = React__namespace.useMemo(function () { + return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client }); + }, [parentContext, client]); + globals.invariant(context.client, 46); + return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children)); +}; + +exports.ApolloConsumer = ApolloConsumer; +exports.ApolloProvider = ApolloProvider; +exports.getApolloContext = getApolloContext; +exports.resetApolloContext = resetApolloContext; +//# sourceMappingURL=context.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.map new file mode 100644 index 0000000..c044986 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from \"rehackt\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nvar contextKey = canUseSymbol ? Symbol.for(\"__APOLLO_CONTEXT__\") : \"__APOLLO_CONTEXT__\";\nexport function getApolloContext() {\n invariant(\"createContext\" in React, 45);\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport var resetApolloContext = getApolloContext;\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n invariant(context && context.client, 44);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { __assign } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"./ApolloContext.js\";\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n var parentContext = React.useContext(ApolloContext);\n var context = React.useMemo(function () {\n return __assign(__assign({}, parentContext), { client: client || parentContext.client });\n }, [parentContext, client]);\n invariant(context.client, 46);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","invariant","React","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAI,UAAU,GAAGA,sBAAY,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;AACjF,SAAS,gBAAgB,GAAG;AACnC,IAAIC,iBAAS,CAAC,eAAe,IAAIC,gBAAK,EAAE,EAAE,CAAC,CAAC;AAC5C,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,MAAM,CAAC,cAAc,CAACA,gBAAK,CAAC,aAAa,EAAE,UAAU,EAAE;AAC/D,YAAY,KAAK,GAAG,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AACtD,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY,EAAE,IAAI;AAC9B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;AAC9C,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AAMS,IAAC,kBAAkB,GAAG;;ACxBtB,IAAC,cAAc,GAAG,UAAU,KAAK,EAAE;AAC7C,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,QAAQA,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AACjF,QAAQD,iBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjD,QAAQ,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9C,KAAK,CAAC,EAAE;AACR;;ACLU,IAAC,cAAc,GAAG,UAAU,EAAE,EAAE;AAC1C,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AACnD,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,IAAI,aAAa,GAAGC,gBAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACxD,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,OAAO,CAAC,YAAY;AAC5C,QAAQ,OAAOC,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;AACjG,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAChC,IAAIF,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAClC,IAAI,QAAQC,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AACvF;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.native.js new file mode 100644 index 0000000..a58672d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/context.cjs.native.js @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var React = require('rehackt'); +var utilities = require('../../utilities'); +var tslib = require('tslib'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +var contextKey = utilities.canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__"; +function getApolloContext() { + globals.invariant("createContext" in React__namespace, 45); + var context = React__namespace.createContext[contextKey]; + if (!context) { + Object.defineProperty(React__namespace.createContext, contextKey, { + value: (context = React__namespace.createContext({})), + enumerable: false, + writable: false, + configurable: true, + }); + context.displayName = "ApolloContext"; + } + return context; +} +var resetApolloContext = getApolloContext; + +var ApolloConsumer = function (props) { + var ApolloContext = getApolloContext(); + return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) { + globals.invariant(context && context.client, 44); + return props.children(context.client); + })); +}; + +var ApolloProvider = function (_a) { + var client = _a.client, children = _a.children; + var ApolloContext = getApolloContext(); + var parentContext = React__namespace.useContext(ApolloContext); + var context = React__namespace.useMemo(function () { + return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client }); + }, [parentContext, client]); + globals.invariant(context.client, 46); + return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children)); +}; + +exports.ApolloConsumer = ApolloConsumer; +exports.ApolloProvider = ApolloProvider; +exports.getApolloContext = getApolloContext; +exports.resetApolloContext = resetApolloContext; +//# sourceMappingURL=context.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/context/index.d.ts new file mode 100644 index 0000000..ea0383b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/index.d.ts @@ -0,0 +1,8 @@ +import "../../utilities/globals/index.js"; +export type { ApolloConsumerProps } from "./ApolloConsumer.js"; +export { ApolloConsumer } from "./ApolloConsumer.js"; +export type { ApolloContextValue } from "./ApolloContext.js"; +export { getApolloContext, resetApolloContext } from "./ApolloContext.js"; +export type { ApolloProviderProps } from "./ApolloProvider.js"; +export { ApolloProvider } from "./ApolloProvider.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/index.js b/graphql-subscription/node_modules/@apollo/client/react/context/index.js new file mode 100644 index 0000000..3135080 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/index.js @@ -0,0 +1,5 @@ +import "../../utilities/globals/index.js"; +export { ApolloConsumer } from "./ApolloConsumer.js"; +export { getApolloContext, resetApolloContext } from "./ApolloContext.js"; +export { ApolloProvider } from "./ApolloProvider.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/context/index.js.map new file mode 100644 index 0000000..0c476e4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport type { ApolloConsumerProps } from \"./ApolloConsumer.js\";\nexport { ApolloConsumer } from \"./ApolloConsumer.js\";\nexport type { ApolloContextValue } from \"./ApolloContext.js\";\nexport { getApolloContext, resetApolloContext } from \"./ApolloContext.js\";\nexport type { ApolloProviderProps } from \"./ApolloProvider.js\";\nexport { ApolloProvider } from \"./ApolloProvider.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/context/package.json b/graphql-subscription/node_modules/@apollo/client/react/context/package.json new file mode 100644 index 0000000..981d4bd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/context/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react/context", + "type": "module", + "main": "context.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.d.ts new file mode 100644 index 0000000..a0def29 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.d.ts @@ -0,0 +1,11 @@ +import type { DocumentNode } from "graphql"; +import type * as ReactTypes from "react"; +import type { OperationOption, DataProps, MutateProps } from "./types.js"; +import type { OperationVariables } from "../../core/index.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export declare function graphql> & Partial>>(document: DocumentNode, operationOptions?: OperationOption): (WrappedComponent: ReactTypes.ComponentType) => ReactTypes.ComponentClass; +//# sourceMappingURL=graphql.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js new file mode 100644 index 0000000..23b6617 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js @@ -0,0 +1,22 @@ +import { parser, DocumentType } from "../parser/index.js"; +import { withQuery } from "./query-hoc.js"; +import { withMutation } from "./mutation-hoc.js"; +import { withSubscription } from "./subscription-hoc.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export function graphql(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + switch (parser(document).type) { + case DocumentType.Mutation: + return withMutation(document, operationOptions); + case DocumentType.Subscription: + return withSubscription(document, operationOptions); + case DocumentType.Query: + default: + return withQuery(document, operationOptions); + } +} +//# sourceMappingURL=graphql.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js.map new file mode 100644 index 0000000..4e61f6e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/graphql.js.map @@ -0,0 +1 @@ +{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/react/hoc/graphql.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAOrB,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAIN,QAAQ,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9B,KAAK,YAAY,CAAC,QAAQ;YACxB,OAAO,YAAY,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAClD,KAAK,YAAY,CAAC,YAAY;YAC5B,OAAO,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACtD,KAAK,YAAY,CAAC,KAAK,CAAC;QACxB;YACE,OAAO,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IACjD,CAAC;AACH,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type * as ReactTypes from \"react\";\n\nimport { parser, DocumentType } from \"../parser/index.js\";\nimport { withQuery } from \"./query-hoc.js\";\nimport { withMutation } from \"./mutation-hoc.js\";\nimport { withSubscription } from \"./subscription-hoc.js\";\nimport type { OperationOption, DataProps, MutateProps } from \"./types.js\";\nimport type { OperationVariables } from \"../../core/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function graphql<\n TProps extends TGraphQLVariables | {} = {},\n TData extends object = {},\n TGraphQLVariables extends OperationVariables = {},\n TChildProps extends object = Partial> &\n Partial>,\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n): (\n WrappedComponent: ReactTypes.ComponentType\n) => ReactTypes.ComponentClass {\n switch (parser(document).type) {\n case DocumentType.Mutation:\n return withMutation(document, operationOptions);\n case DocumentType.Subscription:\n return withSubscription(document, operationOptions);\n case DocumentType.Query:\n default:\n return withQuery(document, operationOptions);\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.d.ts new file mode 100644 index 0000000..fd0697e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.d.ts @@ -0,0 +1,18 @@ +/// +import * as React from "rehackt"; +import type { OperationVariables } from "../../core/index.js"; +import type { IDocumentDefinition } from "../parser/index.js"; +export declare const defaultMapPropsToOptions: () => {}; +export declare const defaultMapResultToProps:

    (props: P) => P; +export declare const defaultMapPropsToSkip: () => boolean; +export declare function getDisplayName

    (WrappedComponent: React.ComponentType

    ): string; +export declare function calculateVariablesFromProps(operation: IDocumentDefinition, props: TProps): OperationVariables; +export type RefSetter = (ref: React.ComponentClass) => void | void; +export declare class GraphQLBase extends React.Component { + withRef: boolean; + private wrappedInstance?; + constructor(props: TProps); + getWrappedInstance(): React.ComponentClass | undefined; + setWrappedInstance(ref: React.ComponentClass): void; +} +//# sourceMappingURL=hoc-utils.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js new file mode 100644 index 0000000..efabca2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js @@ -0,0 +1,48 @@ +import { __extends } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +export var defaultMapPropsToOptions = function () { return ({}); }; +export var defaultMapResultToProps = function (props) { return props; }; +export var defaultMapPropsToSkip = function () { return false; }; +export function getDisplayName(WrappedComponent) { + return WrappedComponent.displayName || WrappedComponent.name || "Component"; +} +export function calculateVariablesFromProps(operation, props) { + var variables = {}; + for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) { + var _b = _a[_i], variable = _b.variable, type = _b.type; + if (!variable.name || !variable.name.value) + continue; + var variableName = variable.name.value; + var variableProp = props[variableName]; + if (typeof variableProp !== "undefined") { + variables[variableName] = variableProp; + continue; + } + // Allow optional props + if (type.kind !== "NonNullType") { + variables[variableName] = undefined; + } + } + return variables; +} +// base class for hocs to easily manage refs +var GraphQLBase = /** @class */ (function (_super) { + __extends(GraphQLBase, _super); + function GraphQLBase(props) { + var _this = _super.call(this, props) || this; + _this.withRef = false; + _this.setWrappedInstance = _this.setWrappedInstance.bind(_this); + return _this; + } + GraphQLBase.prototype.getWrappedInstance = function () { + invariant(this.withRef, 47); + return this.wrappedInstance; + }; + GraphQLBase.prototype.setWrappedInstance = function (ref) { + this.wrappedInstance = ref; + }; + return GraphQLBase; +}(React.Component)); +export { GraphQLBase }; +//# sourceMappingURL=hoc-utils.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js.map new file mode 100644 index 0000000..c87df0f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hoc-utils.js","sourceRoot":"","sources":["../../../src/react/hoc/hoc-utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC,MAAM,CAAC,IAAM,wBAAwB,GAAG,cAAM,OAAA,CAAC,EAAE,CAAC,EAAJ,CAAI,CAAC;AACnD,MAAM,CAAC,IAAM,uBAAuB,GAAuB,UAAC,KAAK,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lB;QACE,SAAS,CACP,IAAI,CAAC,OAAO,EACZ,sDAAsD;YACpD,kCAAkC,CACrC,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,wCAAkB,GAAlB,UAAmB,GAAsC;QACvD,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;IAC7B,CAAC;IACH,kBAAC;AAAD,CAAC,AA3BD,CAIU,KAAK,CAAC,SAAS,GAuBxB","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport type { IDocumentDefinition } from \"../parser/index.js\";\n\nexport const defaultMapPropsToOptions = () => ({});\nexport const defaultMapResultToProps:

    (props: P) => P = (props) => props;\nexport const defaultMapPropsToSkip = () => false;\n\nexport function getDisplayName

    (WrappedComponent: React.ComponentType

    ) {\n return WrappedComponent.displayName || WrappedComponent.name || \"Component\";\n}\n\nexport function calculateVariablesFromProps(\n operation: IDocumentDefinition,\n props: TProps\n) {\n let variables: OperationVariables = {};\n for (let { variable, type } of operation.variables) {\n if (!variable.name || !variable.name.value) continue;\n\n const variableName = variable.name.value;\n const variableProp = (props as any)[variableName];\n\n if (typeof variableProp !== \"undefined\") {\n variables[variableName] = variableProp;\n continue;\n }\n\n // Allow optional props\n if (type.kind !== \"NonNullType\") {\n variables[variableName] = undefined;\n }\n }\n return variables;\n}\n\nexport type RefSetter = (\n ref: React.ComponentClass\n) => void | void;\n\n// base class for hocs to easily manage refs\nexport class GraphQLBase<\n TProps,\n TChildProps,\n TState = any,\n> extends React.Component {\n public withRef: boolean = false;\n // wrapped instance\n private wrappedInstance?: React.ComponentClass;\n\n constructor(props: TProps) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n this.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(ref: React.ComponentClass) {\n this.wrappedInstance = ref;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs new file mode 100644 index 0000000..6f4dab5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs @@ -0,0 +1,316 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var parser = require('../parser'); +var tslib = require('tslib'); +var React = require('rehackt'); +var hoistNonReactStatics = require('hoist-non-react-statics'); +var components = require('../components'); +var context = require('../context'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); +var hoistNonReactStatics__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatics); + +var defaultMapPropsToOptions = function () { return ({}); }; +var defaultMapPropsToSkip = function () { return false; }; +function getDisplayName$1(WrappedComponent) { + return WrappedComponent.displayName || WrappedComponent.name || "Component"; +} +function calculateVariablesFromProps(operation, props) { + var variables = {}; + for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) { + var _b = _a[_i], variable = _b.variable, type = _b.type; + if (!variable.name || !variable.name.value) + continue; + var variableName = variable.name.value; + var variableProp = props[variableName]; + if (typeof variableProp !== "undefined") { + variables[variableName] = variableProp; + continue; + } + if (type.kind !== "NonNullType") { + variables[variableName] = undefined; + } + } + return variables; +} +var GraphQLBase = (function (_super) { + tslib.__extends(GraphQLBase, _super); + function GraphQLBase(props) { + var _this = _super.call(this, props) || this; + _this.withRef = false; + _this.setWrappedInstance = _this.setWrappedInstance.bind(_this); + return _this; + } + GraphQLBase.prototype.getWrappedInstance = function () { + globals.invariant(this.withRef, 47); + return this.wrappedInstance; + }; + GraphQLBase.prototype.setWrappedInstance = function (ref) { + this.wrappedInstance = ref; + }; + return GraphQLBase; +}(React__namespace.Component)); + +function withQuery(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var operation = parser.parser(document); + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") { + mapPropsToOptions = function () { return options; }; + } + var mapPropsToSkip = skip; + if (typeof mapPropsToSkip !== "function") { + mapPropsToSkip = function () { return skip; }; + } + var lastResultProps; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")"); + var GraphQL = (function (_super) { + tslib.__extends(GraphQL, _super); + function GraphQL() { + return _super !== null && _super.apply(this, arguments) || this; + } + GraphQL.prototype.render = function () { + var _this = this; + var props = this.props; + var shouldSkip = mapPropsToSkip(props); + var opts = shouldSkip ? Object.create(null) : tslib.__assign({}, mapPropsToOptions(props)); + if (!shouldSkip && !opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React__namespace.createElement(components.Query, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) { + var _b, _c; + _a.client; var data = _a.data, r = tslib.__rest(_a, ["client", "data"]); + if (operationOptions.withRef) { + _this.withRef = true; + props = Object.assign({}, props, { + ref: _this.setWrappedInstance, + }); + } + if (shouldSkip) { + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {}))); + } + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "data"; + var childProps = (_b = {}, _b[name] = result, _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = result, + _c.ownProps = props, + _c); + lastResultProps = operationOptions.props(newResult, lastResultProps); + childProps = lastResultProps; + } + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps))); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + return hoistNonReactStatics__default(GraphQL, WrappedComponent, {}); + }; +} + +function withMutation(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var operation = parser.parser(document); + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? "Apollo" : _b; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") + mapPropsToOptions = function () { + return options; + }; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")"); + var GraphQL = (function (_super) { + tslib.__extends(GraphQL, _super); + function GraphQL() { + return _super !== null && _super.apply(this, arguments) || this; + } + GraphQL.prototype.render = function () { + var props = this.props; + var opts = mapPropsToOptions(props); + if (operationOptions.withRef) { + this.withRef = true; + props = Object.assign({}, props, { + ref: this.setWrappedInstance, + }); + } + if (!opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React__namespace.createElement(components.Mutation, tslib.__assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) { + var _b, _c; + var data = _a.data, r = tslib.__rest(_a, ["data"]); + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "mutate"; + var resultName = operationOptions.name ? "".concat(name, "Result") : "result"; + var childProps = (_b = {}, + _b[name] = mutate, + _b[resultName] = result, + _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = mutate, + _c[resultName] = result, + _c.ownProps = props, + _c); + childProps = operationOptions.props(newResult); + } + return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + return hoistNonReactStatics__default(GraphQL, WrappedComponent, {}); + }; +} + +function withSubscription(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var operation = parser.parser(document); + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c, shouldResubscribe = operationOptions.shouldResubscribe; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") + mapPropsToOptions = function () { return options; }; + var mapPropsToSkip = skip; + if (typeof mapPropsToSkip !== "function") + mapPropsToSkip = function () { return skip; }; + var lastResultProps; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")"); + var GraphQL = (function (_super) { + tslib.__extends(GraphQL, _super); + function GraphQL(props) { + var _this = _super.call(this, props) || this; + _this.state = { resubscribe: false }; + return _this; + } + GraphQL.prototype.updateResubscribe = function (resubscribe) { + this.setState({ resubscribe: resubscribe }); + }; + GraphQL.prototype.componentDidUpdate = function (prevProps) { + var resubscribe = !!(shouldResubscribe && shouldResubscribe(prevProps, this.props)); + if (this.state.resubscribe !== resubscribe) { + this.updateResubscribe(resubscribe); + } + }; + GraphQL.prototype.render = function () { + var _this = this; + var props = this.props; + var shouldSkip = mapPropsToSkip(props); + var opts = shouldSkip ? Object.create(null) : mapPropsToOptions(props); + if (!shouldSkip && !opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React__namespace.createElement(components.Subscription, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) { + var _b, _c; + var data = _a.data, r = tslib.__rest(_a, ["data"]); + if (operationOptions.withRef) { + _this.withRef = true; + props = Object.assign({}, props, { + ref: _this.setWrappedInstance, + }); + } + if (shouldSkip) { + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {}))); + } + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "data"; + var childProps = (_b = {}, _b[name] = result, _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = result, + _c.ownProps = props, + _c); + lastResultProps = operationOptions.props(newResult, lastResultProps); + childProps = lastResultProps; + } + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps))); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + return hoistNonReactStatics__default(GraphQL, WrappedComponent, {}); + }; +} + +function graphql(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + switch (parser.parser(document).type) { + case parser.DocumentType.Mutation: + return withMutation(document, operationOptions); + case parser.DocumentType.Subscription: + return withSubscription(document, operationOptions); + case parser.DocumentType.Query: + default: + return withQuery(document, operationOptions); + } +} + +function getDisplayName(WrappedComponent) { + return WrappedComponent.displayName || WrappedComponent.name || "Component"; +} +function withApollo(WrappedComponent, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var withDisplayName = "withApollo(".concat(getDisplayName(WrappedComponent), ")"); + var WithApollo = (function (_super) { + tslib.__extends(WithApollo, _super); + function WithApollo(props) { + var _this = _super.call(this, props) || this; + _this.setWrappedInstance = _this.setWrappedInstance.bind(_this); + return _this; + } + WithApollo.prototype.getWrappedInstance = function () { + globals.invariant(operationOptions.withRef, 48); + return this.wrappedInstance; + }; + WithApollo.prototype.setWrappedInstance = function (ref) { + this.wrappedInstance = ref; + }; + WithApollo.prototype.render = function () { + var _this = this; + return (React__namespace.createElement(context.ApolloConsumer, null, function (client) { + var props = Object.assign({}, _this.props, { + client: client, + ref: operationOptions.withRef ? _this.setWrappedInstance : undefined, + }); + return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props)); + })); + }; + WithApollo.displayName = withDisplayName; + WithApollo.WrappedComponent = WrappedComponent; + return WithApollo; + }(React__namespace.Component)); + return hoistNonReactStatics__default(WithApollo, WrappedComponent, {}); +} + +exports.graphql = graphql; +exports.withApollo = withApollo; +exports.withMutation = withMutation; +exports.withQuery = withQuery; +exports.withSubscription = withSubscription; +//# sourceMappingURL=hoc.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.map new file mode 100644 index 0000000..fbabe35 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"hoc.cjs","sources":["hoc-utils.js","query-hoc.js","mutation-hoc.js","subscription-hoc.js","graphql.js","withApollo.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nexport var defaultMapPropsToOptions = function () { return ({}); };\nexport var defaultMapResultToProps = function (props) { return props; };\nexport var defaultMapPropsToSkip = function () { return false; };\nexport function getDisplayName(WrappedComponent) {\n return WrappedComponent.displayName || WrappedComponent.name || \"Component\";\n}\nexport function calculateVariablesFromProps(operation, props) {\n var variables = {};\n for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) {\n var _b = _a[_i], variable = _b.variable, type = _b.type;\n if (!variable.name || !variable.name.value)\n continue;\n var variableName = variable.name.value;\n var variableProp = props[variableName];\n if (typeof variableProp !== \"undefined\") {\n variables[variableName] = variableProp;\n continue;\n }\n // Allow optional props\n if (type.kind !== \"NonNullType\") {\n variables[variableName] = undefined;\n }\n }\n return variables;\n}\n// base class for hocs to easily manage refs\nvar GraphQLBase = /** @class */ (function (_super) {\n __extends(GraphQLBase, _super);\n function GraphQLBase(props) {\n var _this = _super.call(this, props) || this;\n _this.withRef = false;\n _this.setWrappedInstance = _this.setWrappedInstance.bind(_this);\n return _this;\n }\n GraphQLBase.prototype.getWrappedInstance = function () {\n invariant(this.withRef, 47);\n return this.wrappedInstance;\n };\n GraphQLBase.prototype.setWrappedInstance = function (ref) {\n this.wrappedInstance = ref;\n };\n return GraphQLBase;\n}(React.Component));\nexport { GraphQLBase };\n//# sourceMappingURL=hoc-utils.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport * as React from \"rehackt\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport { parser } from \"../parser/index.js\";\nimport { Query } from \"../components/index.js\";\nimport { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip, } from \"./hoc-utils.js\";\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withQuery(document, operationOptions) {\n if (operationOptions === void 0) { operationOptions = {}; }\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n var operation = parser(document);\n // extract options\n var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? \"Apollo\" : _c;\n var mapPropsToOptions = options;\n if (typeof mapPropsToOptions !== \"function\") {\n mapPropsToOptions = function () { return options; };\n }\n var mapPropsToSkip = skip;\n if (typeof mapPropsToSkip !== \"function\") {\n mapPropsToSkip = function () { return skip; };\n }\n // allow for advanced referential equality checks\n var lastResultProps;\n return function (WrappedComponent) {\n var graphQLDisplayName = \"\".concat(alias, \"(\").concat(getDisplayName(WrappedComponent), \")\");\n var GraphQL = /** @class */ (function (_super) {\n __extends(GraphQL, _super);\n function GraphQL() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n GraphQL.prototype.render = function () {\n var _this = this;\n var props = this.props;\n var shouldSkip = mapPropsToSkip(props);\n var opts = shouldSkip ? Object.create(null) : __assign({}, mapPropsToOptions(props));\n if (!shouldSkip && !opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n return (React.createElement(Query, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) {\n var _b, _c;\n var _ = _a.client, data = _a.data, r = __rest(_a, [\"client\", \"data\"]);\n if (operationOptions.withRef) {\n _this.withRef = true;\n props = Object.assign({}, props, {\n ref: _this.setWrappedInstance,\n });\n }\n // if we have skipped, no reason to manage any reshaping\n if (shouldSkip) {\n return (React.createElement(WrappedComponent, __assign({}, props, {})));\n }\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Query components shape here to replicate that\n var result = Object.assign(r, data || {});\n var name = operationOptions.name || \"data\";\n var childProps = (_b = {}, _b[name] = result, _b);\n if (operationOptions.props) {\n var newResult = (_c = {},\n _c[name] = result,\n _c.ownProps = props,\n _c);\n lastResultProps = operationOptions.props(newResult, lastResultProps);\n childProps = lastResultProps;\n }\n return (React.createElement(WrappedComponent, __assign({}, props, childProps)));\n }));\n };\n GraphQL.displayName = graphQLDisplayName;\n GraphQL.WrappedComponent = WrappedComponent;\n return GraphQL;\n }(GraphQLBase));\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n//# sourceMappingURL=query-hoc.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport * as React from \"rehackt\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport { parser } from \"../parser/index.js\";\nimport { Mutation } from \"../components/index.js\";\nimport { defaultMapPropsToOptions, getDisplayName, calculateVariablesFromProps, GraphQLBase, } from \"./hoc-utils.js\";\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withMutation(document, operationOptions) {\n if (operationOptions === void 0) { operationOptions = {}; }\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n var operation = parser(document);\n // extract options\n var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? \"Apollo\" : _b;\n var mapPropsToOptions = options;\n if (typeof mapPropsToOptions !== \"function\")\n mapPropsToOptions = function () {\n return options;\n };\n return function (WrappedComponent) {\n var graphQLDisplayName = \"\".concat(alias, \"(\").concat(getDisplayName(WrappedComponent), \")\");\n var GraphQL = /** @class */ (function (_super) {\n __extends(GraphQL, _super);\n function GraphQL() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n GraphQL.prototype.render = function () {\n var props = this.props;\n var opts = mapPropsToOptions(props);\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance,\n });\n }\n if (!opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n return (React.createElement(Mutation, __assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) {\n var _b, _c;\n var data = _a.data, r = __rest(_a, [\"data\"]);\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Mutation component's shape here to replicate that\n // this matches the query HoC\n var result = Object.assign(r, data || {});\n var name = operationOptions.name || \"mutate\";\n var resultName = operationOptions.name ? \"\".concat(name, \"Result\") : \"result\";\n var childProps = (_b = {},\n _b[name] = mutate,\n _b[resultName] = result,\n _b);\n if (operationOptions.props) {\n var newResult = (_c = {},\n _c[name] = mutate,\n _c[resultName] = result,\n _c.ownProps = props,\n _c);\n childProps = operationOptions.props(newResult);\n }\n return React.createElement(WrappedComponent, __assign({}, props, childProps));\n }));\n };\n GraphQL.displayName = graphQLDisplayName;\n GraphQL.WrappedComponent = WrappedComponent;\n return GraphQL;\n }(GraphQLBase));\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n//# sourceMappingURL=mutation-hoc.js.map","import { __assign, __extends, __rest } from \"tslib\";\nimport * as React from \"rehackt\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport { parser } from \"../parser/index.js\";\nimport { Subscription } from \"../components/index.js\";\nimport { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip, } from \"./hoc-utils.js\";\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withSubscription(document, operationOptions) {\n if (operationOptions === void 0) { operationOptions = {}; }\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n var operation = parser(document);\n // extract options\n var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? \"Apollo\" : _c, shouldResubscribe = operationOptions.shouldResubscribe;\n var mapPropsToOptions = options;\n if (typeof mapPropsToOptions !== \"function\")\n mapPropsToOptions = function () { return options; };\n var mapPropsToSkip = skip;\n if (typeof mapPropsToSkip !== \"function\")\n mapPropsToSkip = function () { return skip; };\n // allow for advanced referential equality checks\n var lastResultProps;\n return function (WrappedComponent) {\n var graphQLDisplayName = \"\".concat(alias, \"(\").concat(getDisplayName(WrappedComponent), \")\");\n var GraphQL = /** @class */ (function (_super) {\n __extends(GraphQL, _super);\n function GraphQL(props) {\n var _this = _super.call(this, props) || this;\n _this.state = { resubscribe: false };\n return _this;\n }\n GraphQL.prototype.updateResubscribe = function (resubscribe) {\n this.setState({ resubscribe: resubscribe });\n };\n GraphQL.prototype.componentDidUpdate = function (prevProps) {\n var resubscribe = !!(shouldResubscribe && shouldResubscribe(prevProps, this.props));\n if (this.state.resubscribe !== resubscribe) {\n this.updateResubscribe(resubscribe);\n }\n };\n GraphQL.prototype.render = function () {\n var _this = this;\n var props = this.props;\n var shouldSkip = mapPropsToSkip(props);\n var opts = shouldSkip ? Object.create(null) : mapPropsToOptions(props);\n if (!shouldSkip && !opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n return (React.createElement(Subscription, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) {\n var _b, _c;\n var data = _a.data, r = __rest(_a, [\"data\"]);\n if (operationOptions.withRef) {\n _this.withRef = true;\n props = Object.assign({}, props, {\n ref: _this.setWrappedInstance,\n });\n }\n // if we have skipped, no reason to manage any reshaping\n if (shouldSkip) {\n return (React.createElement(WrappedComponent, __assign({}, props, {})));\n }\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Query components shape here to replicate that\n var result = Object.assign(r, data || {});\n var name = operationOptions.name || \"data\";\n var childProps = (_b = {}, _b[name] = result, _b);\n if (operationOptions.props) {\n var newResult = (_c = {},\n _c[name] = result,\n _c.ownProps = props,\n _c);\n lastResultProps = operationOptions.props(newResult, lastResultProps);\n childProps = lastResultProps;\n }\n return (React.createElement(WrappedComponent, __assign({}, props, childProps)));\n }));\n };\n GraphQL.displayName = graphQLDisplayName;\n GraphQL.WrappedComponent = WrappedComponent;\n return GraphQL;\n }(GraphQLBase));\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n//# sourceMappingURL=subscription-hoc.js.map","import { parser, DocumentType } from \"../parser/index.js\";\nimport { withQuery } from \"./query-hoc.js\";\nimport { withMutation } from \"./mutation-hoc.js\";\nimport { withSubscription } from \"./subscription-hoc.js\";\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function graphql(document, operationOptions) {\n if (operationOptions === void 0) { operationOptions = {}; }\n switch (parser(document).type) {\n case DocumentType.Mutation:\n return withMutation(document, operationOptions);\n case DocumentType.Subscription:\n return withSubscription(document, operationOptions);\n case DocumentType.Query:\n default:\n return withQuery(document, operationOptions);\n }\n}\n//# sourceMappingURL=graphql.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport { ApolloConsumer } from \"../context/index.js\";\nfunction getDisplayName(WrappedComponent) {\n return WrappedComponent.displayName || WrappedComponent.name || \"Component\";\n}\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withApollo(WrappedComponent, operationOptions) {\n if (operationOptions === void 0) { operationOptions = {}; }\n var withDisplayName = \"withApollo(\".concat(getDisplayName(WrappedComponent), \")\");\n var WithApollo = /** @class */ (function (_super) {\n __extends(WithApollo, _super);\n function WithApollo(props) {\n var _this = _super.call(this, props) || this;\n _this.setWrappedInstance = _this.setWrappedInstance.bind(_this);\n return _this;\n }\n WithApollo.prototype.getWrappedInstance = function () {\n invariant(operationOptions.withRef, 48);\n return this.wrappedInstance;\n };\n WithApollo.prototype.setWrappedInstance = function (ref) {\n this.wrappedInstance = ref;\n };\n WithApollo.prototype.render = function () {\n var _this = this;\n return (React.createElement(ApolloConsumer, null, function (client) {\n var props = Object.assign({}, _this.props, {\n client: client,\n ref: operationOptions.withRef ? _this.setWrappedInstance : undefined,\n });\n return React.createElement(WrappedComponent, __assign({}, props));\n }));\n };\n WithApollo.displayName = withDisplayName;\n WithApollo.WrappedComponent = WrappedComponent;\n return WithApollo;\n }(React.Component));\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(WithApollo, WrappedComponent, {});\n}\n//# sourceMappingURL=withApollo.js.map"],"names":["getDisplayName","__extends","invariant","React","parser","__assign","Query","__rest","hoistNonReactStatics","Mutation","Subscription","DocumentType","ApolloConsumer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAI,wBAAwB,GAAG,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAE5D,IAAI,qBAAqB,GAAG,YAAY,EAAE,OAAO,KAAK,CAAC,EAAE,CAAC;AAC1D,SAASA,gBAAc,CAAC,gBAAgB,EAAE;AACjD,IAAI,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAChF,CAAC;AACM,SAAS,2BAA2B,C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AAC;AAClE;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.native.js new file mode 100644 index 0000000..6f4dab5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/hoc.cjs.native.js @@ -0,0 +1,316 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var parser = require('../parser'); +var tslib = require('tslib'); +var React = require('rehackt'); +var hoistNonReactStatics = require('hoist-non-react-statics'); +var components = require('../components'); +var context = require('../context'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); +var hoistNonReactStatics__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatics); + +var defaultMapPropsToOptions = function () { return ({}); }; +var defaultMapPropsToSkip = function () { return false; }; +function getDisplayName$1(WrappedComponent) { + return WrappedComponent.displayName || WrappedComponent.name || "Component"; +} +function calculateVariablesFromProps(operation, props) { + var variables = {}; + for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) { + var _b = _a[_i], variable = _b.variable, type = _b.type; + if (!variable.name || !variable.name.value) + continue; + var variableName = variable.name.value; + var variableProp = props[variableName]; + if (typeof variableProp !== "undefined") { + variables[variableName] = variableProp; + continue; + } + if (type.kind !== "NonNullType") { + variables[variableName] = undefined; + } + } + return variables; +} +var GraphQLBase = (function (_super) { + tslib.__extends(GraphQLBase, _super); + function GraphQLBase(props) { + var _this = _super.call(this, props) || this; + _this.withRef = false; + _this.setWrappedInstance = _this.setWrappedInstance.bind(_this); + return _this; + } + GraphQLBase.prototype.getWrappedInstance = function () { + globals.invariant(this.withRef, 47); + return this.wrappedInstance; + }; + GraphQLBase.prototype.setWrappedInstance = function (ref) { + this.wrappedInstance = ref; + }; + return GraphQLBase; +}(React__namespace.Component)); + +function withQuery(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var operation = parser.parser(document); + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") { + mapPropsToOptions = function () { return options; }; + } + var mapPropsToSkip = skip; + if (typeof mapPropsToSkip !== "function") { + mapPropsToSkip = function () { return skip; }; + } + var lastResultProps; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")"); + var GraphQL = (function (_super) { + tslib.__extends(GraphQL, _super); + function GraphQL() { + return _super !== null && _super.apply(this, arguments) || this; + } + GraphQL.prototype.render = function () { + var _this = this; + var props = this.props; + var shouldSkip = mapPropsToSkip(props); + var opts = shouldSkip ? Object.create(null) : tslib.__assign({}, mapPropsToOptions(props)); + if (!shouldSkip && !opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React__namespace.createElement(components.Query, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) { + var _b, _c; + _a.client; var data = _a.data, r = tslib.__rest(_a, ["client", "data"]); + if (operationOptions.withRef) { + _this.withRef = true; + props = Object.assign({}, props, { + ref: _this.setWrappedInstance, + }); + } + if (shouldSkip) { + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {}))); + } + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "data"; + var childProps = (_b = {}, _b[name] = result, _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = result, + _c.ownProps = props, + _c); + lastResultProps = operationOptions.props(newResult, lastResultProps); + childProps = lastResultProps; + } + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps))); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + return hoistNonReactStatics__default(GraphQL, WrappedComponent, {}); + }; +} + +function withMutation(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var operation = parser.parser(document); + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? "Apollo" : _b; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") + mapPropsToOptions = function () { + return options; + }; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")"); + var GraphQL = (function (_super) { + tslib.__extends(GraphQL, _super); + function GraphQL() { + return _super !== null && _super.apply(this, arguments) || this; + } + GraphQL.prototype.render = function () { + var props = this.props; + var opts = mapPropsToOptions(props); + if (operationOptions.withRef) { + this.withRef = true; + props = Object.assign({}, props, { + ref: this.setWrappedInstance, + }); + } + if (!opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React__namespace.createElement(components.Mutation, tslib.__assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) { + var _b, _c; + var data = _a.data, r = tslib.__rest(_a, ["data"]); + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "mutate"; + var resultName = operationOptions.name ? "".concat(name, "Result") : "result"; + var childProps = (_b = {}, + _b[name] = mutate, + _b[resultName] = result, + _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = mutate, + _c[resultName] = result, + _c.ownProps = props, + _c); + childProps = operationOptions.props(newResult); + } + return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps)); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + return hoistNonReactStatics__default(GraphQL, WrappedComponent, {}); + }; +} + +function withSubscription(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var operation = parser.parser(document); + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c, shouldResubscribe = operationOptions.shouldResubscribe; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") + mapPropsToOptions = function () { return options; }; + var mapPropsToSkip = skip; + if (typeof mapPropsToSkip !== "function") + mapPropsToSkip = function () { return skip; }; + var lastResultProps; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName$1(WrappedComponent), ")"); + var GraphQL = (function (_super) { + tslib.__extends(GraphQL, _super); + function GraphQL(props) { + var _this = _super.call(this, props) || this; + _this.state = { resubscribe: false }; + return _this; + } + GraphQL.prototype.updateResubscribe = function (resubscribe) { + this.setState({ resubscribe: resubscribe }); + }; + GraphQL.prototype.componentDidUpdate = function (prevProps) { + var resubscribe = !!(shouldResubscribe && shouldResubscribe(prevProps, this.props)); + if (this.state.resubscribe !== resubscribe) { + this.updateResubscribe(resubscribe); + } + }; + GraphQL.prototype.render = function () { + var _this = this; + var props = this.props; + var shouldSkip = mapPropsToSkip(props); + var opts = shouldSkip ? Object.create(null) : mapPropsToOptions(props); + if (!shouldSkip && !opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React__namespace.createElement(components.Subscription, tslib.__assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) { + var _b, _c; + var data = _a.data, r = tslib.__rest(_a, ["data"]); + if (operationOptions.withRef) { + _this.withRef = true; + props = Object.assign({}, props, { + ref: _this.setWrappedInstance, + }); + } + if (shouldSkip) { + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, {}))); + } + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "data"; + var childProps = (_b = {}, _b[name] = result, _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = result, + _c.ownProps = props, + _c); + lastResultProps = operationOptions.props(newResult, lastResultProps); + childProps = lastResultProps; + } + return (React__namespace.createElement(WrappedComponent, tslib.__assign({}, props, childProps))); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + return hoistNonReactStatics__default(GraphQL, WrappedComponent, {}); + }; +} + +function graphql(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + switch (parser.parser(document).type) { + case parser.DocumentType.Mutation: + return withMutation(document, operationOptions); + case parser.DocumentType.Subscription: + return withSubscription(document, operationOptions); + case parser.DocumentType.Query: + default: + return withQuery(document, operationOptions); + } +} + +function getDisplayName(WrappedComponent) { + return WrappedComponent.displayName || WrappedComponent.name || "Component"; +} +function withApollo(WrappedComponent, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var withDisplayName = "withApollo(".concat(getDisplayName(WrappedComponent), ")"); + var WithApollo = (function (_super) { + tslib.__extends(WithApollo, _super); + function WithApollo(props) { + var _this = _super.call(this, props) || this; + _this.setWrappedInstance = _this.setWrappedInstance.bind(_this); + return _this; + } + WithApollo.prototype.getWrappedInstance = function () { + globals.invariant(operationOptions.withRef, 48); + return this.wrappedInstance; + }; + WithApollo.prototype.setWrappedInstance = function (ref) { + this.wrappedInstance = ref; + }; + WithApollo.prototype.render = function () { + var _this = this; + return (React__namespace.createElement(context.ApolloConsumer, null, function (client) { + var props = Object.assign({}, _this.props, { + client: client, + ref: operationOptions.withRef ? _this.setWrappedInstance : undefined, + }); + return React__namespace.createElement(WrappedComponent, tslib.__assign({}, props)); + })); + }; + WithApollo.displayName = withDisplayName; + WithApollo.WrappedComponent = WrappedComponent; + return WithApollo; + }(React__namespace.Component)); + return hoistNonReactStatics__default(WithApollo, WrappedComponent, {}); +} + +exports.graphql = graphql; +exports.withApollo = withApollo; +exports.withMutation = withMutation; +exports.withQuery = withQuery; +exports.withSubscription = withSubscription; +//# sourceMappingURL=hoc.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/index.d.ts new file mode 100644 index 0000000..db7d9b6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/index.d.ts @@ -0,0 +1,8 @@ +import "../../utilities/globals/index.js"; +export { graphql } from "./graphql.js"; +export { withQuery } from "./query-hoc.js"; +export { withMutation } from "./mutation-hoc.js"; +export { withSubscription } from "./subscription-hoc.js"; +export { withApollo } from "./withApollo.js"; +export * from "./types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/index.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/index.js new file mode 100644 index 0000000..f21868b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/index.js @@ -0,0 +1,8 @@ +import "../../utilities/globals/index.js"; +export { graphql } from "./graphql.js"; +export { withQuery } from "./query-hoc.js"; +export { withMutation } from "./mutation-hoc.js"; +export { withSubscription } from "./subscription-hoc.js"; +export { withApollo } from "./withApollo.js"; +export * from "./types.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/index.js.map new file mode 100644 index 0000000..b97e4f2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,cAAc,YAAY,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport { graphql } from \"./graphql.js\";\n\nexport { withQuery } from \"./query-hoc.js\";\nexport { withMutation } from \"./mutation-hoc.js\";\nexport { withSubscription } from \"./subscription-hoc.js\";\nexport { withApollo } from \"./withApollo.js\";\n\nexport * from \"./types.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.d.ts new file mode 100644 index 0000000..d1df67f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.d.ts @@ -0,0 +1,12 @@ +import type * as ReactTypes from "react"; +import type { DocumentNode } from "graphql"; +import type { DefaultContext, OperationVariables } from "../../core/types.js"; +import type { OperationOption, MutateProps } from "./types.js"; +import type { ApolloCache } from "../../core/index.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export declare function withMutation = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps = MutateProps, TContext extends Record = DefaultContext, TCache extends ApolloCache = ApolloCache>(document: DocumentNode, operationOptions?: OperationOption): (WrappedComponent: ReactTypes.ComponentType) => ReactTypes.ComponentClass; +//# sourceMappingURL=mutation-hoc.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js new file mode 100644 index 0000000..29bc8a1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js @@ -0,0 +1,75 @@ +import { __assign, __extends, __rest } from "tslib"; +import * as React from "rehackt"; +import hoistNonReactStatics from "hoist-non-react-statics"; +import { parser } from "../parser/index.js"; +import { Mutation } from "../components/index.js"; +import { defaultMapPropsToOptions, getDisplayName, calculateVariablesFromProps, GraphQLBase, } from "./hoc-utils.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export function withMutation(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + // this is memoized so if coming from `graphql` there is nearly no extra cost + var operation = parser(document); + // extract options + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.alias, alias = _b === void 0 ? "Apollo" : _b; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") + mapPropsToOptions = function () { + return options; + }; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")"); + var GraphQL = /** @class */ (function (_super) { + __extends(GraphQL, _super); + function GraphQL() { + return _super !== null && _super.apply(this, arguments) || this; + } + GraphQL.prototype.render = function () { + var props = this.props; + var opts = mapPropsToOptions(props); + if (operationOptions.withRef) { + this.withRef = true; + props = Object.assign({}, props, { + ref: this.setWrappedInstance, + }); + } + if (!opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React.createElement(Mutation, __assign({ ignoreResults: true }, opts, { mutation: document }), function (mutate, _a) { + var _b, _c; + var data = _a.data, r = __rest(_a, ["data"]); + // the HOC's historically hoisted the data from the execution result + // up onto the result since it was passed as a nested prop + // we massage the Mutation component's shape here to replicate that + // this matches the query HoC + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "mutate"; + var resultName = operationOptions.name ? "".concat(name, "Result") : "result"; + var childProps = (_b = {}, + _b[name] = mutate, + _b[resultName] = result, + _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = mutate, + _c[resultName] = result, + _c.ownProps = props, + _c); + childProps = operationOptions.props(newResult); + } + return React.createElement(WrappedComponent, __assign({}, props, childProps)); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + // Make sure we preserve any custom statics on the original component. + return hoistNonReactStatics(GraphQL, WrappedComponent, {}); + }; +} +//# sourceMappingURL=mutation-hoc.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js.map new file mode 100644 index 0000000..5d76dca --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/mutation-hoc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mutation-hoc.js","sourceRoot":"","sources":["../../../src/react/hoc/mutation-hoc.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAO5C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,2BAA2B,EAC3B,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAIxB;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAQ1B,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAEN,6EAA6E;IAC7E,IAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,kBAAkB;IAEV,IAAA,KACN,gBAAgB,QADwB,EAAlC,OAAO,mBAAG,wBAAwB,KAAA,EAAE,KAC1C,gBAAgB,MAD0C,EAAhB,KAAK,mBAAG,QAAQ,KAAA,CACzC;IAEnB,IAAI,iBAAiB,GAAG,OAE4C,CAAC;IACrE,IAAI,OAAO,iBAAiB,KAAK,UAAU;QACzC,iBAAiB,GAAG;YAClB,OAAA,OAKC;QALD,CAKC,CAAC;IAEN,OAAO,UACL,gBAAgE;QAEhE,IAAM,kBAAkB,G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,UAAU,IAAG,MAAM;0BACC,CAAA,CAAC;oBACxB,IAAI,gBAAgB,CAAC,KAAK,EAAE,CAAC;wBAC3B,IAAM,SAAS;4BAEX,GAAC,IAAI,IAAG,MAAM;4BACd,GAAC,UAAU,IAAG,MAAM;4BACpB,WAAQ,GAAE,KAAK;+BAChB,CAAC;wBACJ,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAQ,CAAC;oBACxD,CAAC;oBAED,OAAO,oBAAC,gBAAgB,eAAK,KAAK,EAAM,UAAU,EAAI,CAAC;gBACzD,CAAC,CACQ,CACZ,CAAC;YACJ,CAAC;YAzDM,mBAAW,GAAG,kBAAkB,CAAC;YACjC,wBAAgB,GAAG,gBAAgB,CAAC;YAyD7C,cAAC;SAAA,AA3DD,CAAsB,WAAW,GA2DhC;QAED,sEAAsE;QACtE,OAAO,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\n\nimport { parser } from \"../parser/index.js\";\nimport type { DefaultContext, OperationVariables } from \"../../core/types.js\";\nimport type {\n BaseMutationOptions,\n MutationFunction,\n MutationResult,\n} from \"../types/types.js\";\nimport { Mutation } from \"../components/index.js\";\n\nimport {\n defaultMapPropsToOptions,\n getDisplayName,\n calculateVariablesFromProps,\n GraphQLBase,\n} from \"./hoc-utils.js\";\nimport type { OperationOption, OptionProps, MutateProps } from \"./types.js\";\nimport type { ApolloCache } from \"../../core/index.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withMutation<\n TProps extends TGraphQLVariables | {} = {},\n TData extends Record = {},\n TGraphQLVariables extends OperationVariables = {},\n TChildProps = MutateProps,\n TContext extends Record = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n) {\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n const operation = parser(document);\n // extract options\n\n const { options = defaultMapPropsToOptions, alias = \"Apollo\" } =\n operationOptions;\n\n let mapPropsToOptions = options as (\n props: any\n ) => BaseMutationOptions;\n if (typeof mapPropsToOptions !== \"function\")\n mapPropsToOptions = () =>\n options as BaseMutationOptions<\n TData,\n TGraphQLVariables,\n TContext,\n TCache\n >;\n\n return (\n WrappedComponent: ReactTypes.ComponentType\n ): ReactTypes.ComponentClass => {\n const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;\n class GraphQL extends GraphQLBase {\n static displayName = graphQLDisplayName;\n static WrappedComponent = WrappedComponent;\n render() {\n let props = this.props as TProps;\n const opts = mapPropsToOptions(props) as BaseMutationOptions<\n TData,\n TGraphQLVariables,\n TContext,\n TCache\n >;\n\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance,\n });\n }\n if (!opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(\n operation,\n props\n ) as TGraphQLVariables;\n }\n\n return (\n \n {/* @ts-expect-error */}\n {(\n mutate: MutationFunction,\n { data, ...r }: MutationResult\n ) => {\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Mutation component's shape here to replicate that\n // this matches the query HoC\n const result = Object.assign(r, data || {});\n const name = operationOptions.name || \"mutate\";\n const resultName =\n operationOptions.name ? `${name}Result` : \"result\";\n let childProps = {\n [name]: mutate,\n [resultName]: result,\n } as any as TChildProps;\n if (operationOptions.props) {\n const newResult: OptionProps =\n {\n [name]: mutate,\n [resultName]: result,\n ownProps: props,\n };\n childProps = operationOptions.props(newResult) as any;\n }\n\n return ;\n }}\n \n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/package.json b/graphql-subscription/node_modules/@apollo/client/react/hoc/package.json new file mode 100644 index 0000000..665fe88 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react/hoc", + "type": "module", + "main": "hoc.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.d.ts new file mode 100644 index 0000000..7362d00 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.d.ts @@ -0,0 +1,10 @@ +import type * as ReactTypes from "react"; +import type { DocumentNode } from "graphql"; +import type { OperationOption, DataProps } from "./types.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export declare function withQuery = Record, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps>(document: DocumentNode, operationOptions?: OperationOption): (WrappedComponent: ReactTypes.ComponentType) => ReactTypes.ComponentClass; +//# sourceMappingURL=query-hoc.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js new file mode 100644 index 0000000..1a349c6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js @@ -0,0 +1,81 @@ +import { __assign, __extends, __rest } from "tslib"; +import * as React from "rehackt"; +import hoistNonReactStatics from "hoist-non-react-statics"; +import { parser } from "../parser/index.js"; +import { Query } from "../components/index.js"; +import { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip, } from "./hoc-utils.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export function withQuery(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + // this is memoized so if coming from `graphql` there is nearly no extra cost + var operation = parser(document); + // extract options + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") { + mapPropsToOptions = function () { return options; }; + } + var mapPropsToSkip = skip; + if (typeof mapPropsToSkip !== "function") { + mapPropsToSkip = function () { return skip; }; + } + // allow for advanced referential equality checks + var lastResultProps; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")"); + var GraphQL = /** @class */ (function (_super) { + __extends(GraphQL, _super); + function GraphQL() { + return _super !== null && _super.apply(this, arguments) || this; + } + GraphQL.prototype.render = function () { + var _this = this; + var props = this.props; + var shouldSkip = mapPropsToSkip(props); + var opts = shouldSkip ? Object.create(null) : __assign({}, mapPropsToOptions(props)); + if (!shouldSkip && !opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React.createElement(Query, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, query: document }), function (_a) { + var _b, _c; + var _ = _a.client, data = _a.data, r = __rest(_a, ["client", "data"]); + if (operationOptions.withRef) { + _this.withRef = true; + props = Object.assign({}, props, { + ref: _this.setWrappedInstance, + }); + } + // if we have skipped, no reason to manage any reshaping + if (shouldSkip) { + return (React.createElement(WrappedComponent, __assign({}, props, {}))); + } + // the HOC's historically hoisted the data from the execution result + // up onto the result since it was passed as a nested prop + // we massage the Query components shape here to replicate that + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "data"; + var childProps = (_b = {}, _b[name] = result, _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = result, + _c.ownProps = props, + _c); + lastResultProps = operationOptions.props(newResult, lastResultProps); + childProps = lastResultProps; + } + return (React.createElement(WrappedComponent, __assign({}, props, childProps))); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + // Make sure we preserve any custom statics on the original component. + return hoistNonReactStatics(GraphQL, WrappedComponent, {}); + }; +} +//# sourceMappingURL=query-hoc.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js.map new file mode 100644 index 0000000..dba9840 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/query-hoc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"query-hoc.js","sourceRoot":"","sources":["../../../src/react/hoc/query-hoc.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,WAAW,EACX,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAGxB;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAMvB,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAEN,6EAA6E;IAC7E,IAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,kBAAkB;IAEhB,IAAA,KAGE,gBAAgB,QAHgB,EAAlC,OAAO,mBAAG,wBAAwB,KAAA,EAClC,KAEE,gBAAgB,KAFU,EAA5B,IAAI,mBAAG,qBAAqB,KAAA,EAC5B,KACE,gBAAgB,MADF,EAAhB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AC;AACJ,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\n\nimport { parser } from \"../parser/index.js\";\nimport type { BaseQueryOptions } from \"../types/types.js\";\nimport { Query } from \"../components/index.js\";\nimport {\n getDisplayName,\n GraphQLBase,\n calculateVariablesFromProps,\n defaultMapPropsToOptions,\n defaultMapPropsToSkip,\n} from \"./hoc-utils.js\";\nimport type { OperationOption, OptionProps, DataProps } from \"./types.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withQuery<\n TProps extends TGraphQLVariables | Record = Record,\n TData extends object = {},\n TGraphQLVariables extends object = {},\n TChildProps extends object = DataProps,\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n) {\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n const operation = parser(document);\n // extract options\n const {\n options = defaultMapPropsToOptions,\n skip = defaultMapPropsToSkip,\n alias = \"Apollo\",\n } = operationOptions;\n\n let mapPropsToOptions = options as (props: any) => BaseQueryOptions;\n if (typeof mapPropsToOptions !== \"function\") {\n mapPropsToOptions = () => options as BaseQueryOptions;\n }\n\n let mapPropsToSkip = skip as (props: any) => boolean;\n if (typeof mapPropsToSkip !== \"function\") {\n mapPropsToSkip = () => skip as any;\n }\n\n // allow for advanced referential equality checks\n let lastResultProps: TChildProps | void;\n return (\n WrappedComponent: ReactTypes.ComponentType\n ): ReactTypes.ComponentClass => {\n const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;\n class GraphQL extends GraphQLBase {\n static displayName = graphQLDisplayName;\n static WrappedComponent = WrappedComponent;\n\n render() {\n let props = this.props;\n const shouldSkip = mapPropsToSkip(props);\n const opts =\n shouldSkip ? Object.create(null) : { ...mapPropsToOptions(props) };\n\n if (!shouldSkip && !opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n\n return (\n \n {({ client: _, data, ...r }: any) => {\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance,\n });\n }\n\n // if we have skipped, no reason to manage any reshaping\n if (shouldSkip) {\n return (\n \n );\n }\n\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Query components shape here to replicate that\n const result = Object.assign(r, data || {});\n const name = operationOptions.name || \"data\";\n let childProps = { [name]: result };\n if (operationOptions.props) {\n const newResult: OptionProps =\n {\n [name]: result,\n ownProps: props as TProps,\n };\n lastResultProps = operationOptions.props(\n newResult,\n lastResultProps\n );\n childProps = lastResultProps;\n }\n\n return (\n \n );\n }}\n \n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.d.ts new file mode 100644 index 0000000..c0ce0e4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.d.ts @@ -0,0 +1,10 @@ +import type * as ReactTypes from "react"; +import type { DocumentNode } from "graphql"; +import type { OperationOption, DataProps } from "./types.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export declare function withSubscription>(document: DocumentNode, operationOptions?: OperationOption): (WrappedComponent: ReactTypes.ComponentType) => ReactTypes.ComponentClass; +//# sourceMappingURL=subscription-hoc.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js new file mode 100644 index 0000000..3f4e52a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js @@ -0,0 +1,90 @@ +import { __assign, __extends, __rest } from "tslib"; +import * as React from "rehackt"; +import hoistNonReactStatics from "hoist-non-react-statics"; +import { parser } from "../parser/index.js"; +import { Subscription } from "../components/index.js"; +import { getDisplayName, GraphQLBase, calculateVariablesFromProps, defaultMapPropsToOptions, defaultMapPropsToSkip, } from "./hoc-utils.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export function withSubscription(document, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + // this is memoized so if coming from `graphql` there is nearly no extra cost + var operation = parser(document); + // extract options + var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? "Apollo" : _c, shouldResubscribe = operationOptions.shouldResubscribe; + var mapPropsToOptions = options; + if (typeof mapPropsToOptions !== "function") + mapPropsToOptions = function () { return options; }; + var mapPropsToSkip = skip; + if (typeof mapPropsToSkip !== "function") + mapPropsToSkip = function () { return skip; }; + // allow for advanced referential equality checks + var lastResultProps; + return function (WrappedComponent) { + var graphQLDisplayName = "".concat(alias, "(").concat(getDisplayName(WrappedComponent), ")"); + var GraphQL = /** @class */ (function (_super) { + __extends(GraphQL, _super); + function GraphQL(props) { + var _this = _super.call(this, props) || this; + _this.state = { resubscribe: false }; + return _this; + } + GraphQL.prototype.updateResubscribe = function (resubscribe) { + this.setState({ resubscribe: resubscribe }); + }; + GraphQL.prototype.componentDidUpdate = function (prevProps) { + var resubscribe = !!(shouldResubscribe && shouldResubscribe(prevProps, this.props)); + if (this.state.resubscribe !== resubscribe) { + this.updateResubscribe(resubscribe); + } + }; + GraphQL.prototype.render = function () { + var _this = this; + var props = this.props; + var shouldSkip = mapPropsToSkip(props); + var opts = shouldSkip ? Object.create(null) : mapPropsToOptions(props); + if (!shouldSkip && !opts.variables && operation.variables.length > 0) { + opts.variables = calculateVariablesFromProps(operation, props); + } + return (React.createElement(Subscription, __assign({}, opts, { displayName: graphQLDisplayName, skip: shouldSkip, subscription: document, shouldResubscribe: this.state.resubscribe }), function (_a) { + var _b, _c; + var data = _a.data, r = __rest(_a, ["data"]); + if (operationOptions.withRef) { + _this.withRef = true; + props = Object.assign({}, props, { + ref: _this.setWrappedInstance, + }); + } + // if we have skipped, no reason to manage any reshaping + if (shouldSkip) { + return (React.createElement(WrappedComponent, __assign({}, props, {}))); + } + // the HOC's historically hoisted the data from the execution result + // up onto the result since it was passed as a nested prop + // we massage the Query components shape here to replicate that + var result = Object.assign(r, data || {}); + var name = operationOptions.name || "data"; + var childProps = (_b = {}, _b[name] = result, _b); + if (operationOptions.props) { + var newResult = (_c = {}, + _c[name] = result, + _c.ownProps = props, + _c); + lastResultProps = operationOptions.props(newResult, lastResultProps); + childProps = lastResultProps; + } + return (React.createElement(WrappedComponent, __assign({}, props, childProps))); + })); + }; + GraphQL.displayName = graphQLDisplayName; + GraphQL.WrappedComponent = WrappedComponent; + return GraphQL; + }(GraphQLBase)); + // Make sure we preserve any custom statics on the original component. + return hoistNonReactStatics(GraphQL, WrappedComponent, {}); + }; +} +//# sourceMappingURL=subscription-hoc.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js.map new file mode 100644 index 0000000..0eab300 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/subscription-hoc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscription-hoc.js","sourceRoot":"","sources":["../../../src/react/hoc/subscription-hoc.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,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E;4BAC/B,GAAG,EAAE,KAAI,CAAC,kBAAkB;yBAC7B,CAAC,CAAC;oBACL,CAAC;oBACD,wDAAwD;oBACxD,IAAI,UAAU,EAAE,CAAC;wBACf,OAAO,CACL,oBAAC,gBAAgB,eACV,KAAgB,EAChB,EAAkB,EACvB,CACH,CAAC;oBACJ,CAAC;oBAED,oEAAoE;oBACpE,0DAA0D;oBAC1D,+DAA+D;oBAC/D,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;oBAC5C,IAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,IAAI,MAAM,CAAC;oBAC7C,IAAI,UAAU,aAAK,GAAC,IAAI,IAAG,MAAM,KAAE,CAAC;oBACpC,IAAI,gBAAgB,CAAC,KAAK,EAAE,CAAC;wBAC3B,IAAM,SAAS;4BAEX,GAAC,IAAI,IAAG,MAAM;4BACd,WAAQ,GAAE,KAAe;+BAC1B,CAAC;wBACJ,eAAe,GAAG,gBAAgB,CAAC,KAAK,CACtC,SAAS,EACT,eAAe,CAChB,CAAC;wBACF,UAAU,GAAG,eAAe,CAAC;oBAC/B,CAAC;oBAED,OAAO,CACL,oBAAC,gBAAgB,eACV,KAAgB,EAChB,UAA0B,EAC/B,CACH,CAAC;gBACJ,CAAC,CACY,CAChB,CAAC;YACJ,CAAC;YAlFM,mBAAW,GAAG,kBAAkB,CAAC;YACjC,wBAAgB,GAAG,gBAAgB,CAAC;YAkF7C,cAAC;SAAA,AAxFD,CAAsB,WAAW,GAwFhC;QAED,sEAAsE;QACtE,OAAO,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\n\nimport { parser } from \"../parser/index.js\";\nimport type { BaseQueryOptions } from \"../types/types.js\";\nimport { Subscription } from \"../components/index.js\";\nimport {\n getDisplayName,\n GraphQLBase,\n calculateVariablesFromProps,\n defaultMapPropsToOptions,\n defaultMapPropsToSkip,\n} from \"./hoc-utils.js\";\nimport type { OperationOption, OptionProps, DataProps } from \"./types.js\";\n\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withSubscription<\n TProps extends TGraphQLVariables | {} = {},\n TData extends object = {},\n TGraphQLVariables extends object = {},\n TChildProps extends object = DataProps,\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n) {\n // this is memoized so if coming from `graphql` there is nearly no extra cost\n const operation = parser(document);\n // extract options\n const {\n options = defaultMapPropsToOptions,\n skip = defaultMapPropsToSkip,\n alias = \"Apollo\",\n shouldResubscribe,\n } = operationOptions;\n\n let mapPropsToOptions = options as (props: any) => BaseQueryOptions;\n if (typeof mapPropsToOptions !== \"function\")\n mapPropsToOptions = () => options as BaseQueryOptions;\n\n let mapPropsToSkip = skip as (props: any) => boolean;\n if (typeof mapPropsToSkip !== \"function\") mapPropsToSkip = () => skip as any;\n\n // allow for advanced referential equality checks\n let lastResultProps: TChildProps | void;\n return (\n WrappedComponent: ReactTypes.ComponentType\n ): ReactTypes.ComponentClass => {\n const graphQLDisplayName = `${alias}(${getDisplayName(WrappedComponent)})`;\n class GraphQL extends GraphQLBase<\n TProps,\n TChildProps,\n { resubscribe: boolean }\n > {\n static displayName = graphQLDisplayName;\n static WrappedComponent = WrappedComponent;\n constructor(props: TProps) {\n super(props);\n this.state = { resubscribe: false };\n }\n\n updateResubscribe(resubscribe: boolean) {\n this.setState({ resubscribe });\n }\n\n componentDidUpdate(prevProps: TProps) {\n const resubscribe = !!(\n shouldResubscribe && shouldResubscribe(prevProps, this.props)\n );\n if (this.state.resubscribe !== resubscribe) {\n this.updateResubscribe(resubscribe);\n }\n }\n\n render() {\n let props = this.props;\n const shouldSkip = mapPropsToSkip(props);\n const opts =\n shouldSkip ? Object.create(null) : mapPropsToOptions(props);\n\n if (!shouldSkip && !opts.variables && operation.variables.length > 0) {\n opts.variables = calculateVariablesFromProps(operation, props);\n }\n return (\n \n {({ data, ...r }: any) => {\n if (operationOptions.withRef) {\n this.withRef = true;\n props = Object.assign({}, props, {\n ref: this.setWrappedInstance,\n });\n }\n // if we have skipped, no reason to manage any reshaping\n if (shouldSkip) {\n return (\n \n );\n }\n\n // the HOC's historically hoisted the data from the execution result\n // up onto the result since it was passed as a nested prop\n // we massage the Query components shape here to replicate that\n const result = Object.assign(r, data || {});\n const name = operationOptions.name || \"data\";\n let childProps = { [name]: result };\n if (operationOptions.props) {\n const newResult: OptionProps =\n {\n [name]: result,\n ownProps: props as TProps,\n };\n lastResultProps = operationOptions.props(\n newResult,\n lastResultProps\n );\n childProps = lastResultProps;\n }\n\n return (\n \n );\n }}\n \n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(GraphQL, WrappedComponent, {});\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/types.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/types.d.ts new file mode 100644 index 0000000..cb235e3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/types.d.ts @@ -0,0 +1,43 @@ +import type { ApolloCache, ApolloClient } from "../../core/index.js"; +import type { ApolloError } from "../../errors/index.js"; +import type { ApolloQueryResult, OperationVariables, FetchMoreOptions, UpdateQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions, DefaultContext } from "../../core/index.js"; +import type { MutationFunction, BaseQueryOptions, BaseMutationOptions, MutationResult } from "../types/types.js"; +export interface QueryControls { + error?: ApolloError; + networkStatus: number; + loading: boolean; + variables: TGraphQLVariables; + fetchMore: (fetchMoreOptions: FetchMoreQueryOptions & FetchMoreOptions) => Promise>; + refetch: (variables?: TGraphQLVariables) => Promise>; + startPolling: (pollInterval: number) => void; + stopPolling: () => void; + subscribeToMore: (options: SubscribeToMoreOptions) => () => void; + updateQuery: (mapFn: (previousQueryResult: any, options: UpdateQueryOptions) => any) => void; +} +export type DataValue = QueryControls & Partial; +export interface DataProps { + data: DataValue; +} +export interface MutateProps { + mutate: MutationFunction; + result: MutationResult; +} +export type ChildProps = TProps & Partial> & Partial>; +export type ChildDataProps = TProps & DataProps; +export type ChildMutateProps = TProps & MutateProps; +export interface OptionProps extends Partial>, Partial> { + ownProps: TProps; +} +export interface OperationOption, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> { + options?: BaseQueryOptions | BaseMutationOptions | ((props: TProps) => BaseQueryOptions | BaseMutationOptions); + props?: (props: OptionProps, lastProps?: TChildProps | void) => TChildProps; + skip?: boolean | ((props: TProps) => boolean); + name?: string; + withRef?: boolean; + shouldResubscribe?: (props: TProps, nextProps: TProps) => boolean; + alias?: string; +} +export type WithApolloClient

    = P & { + client?: ApolloClient; +}; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/types.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/types.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/types.js.map new file mode 100644 index 0000000..39c4f5a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/hoc/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ApolloCache, ApolloClient } from \"../../core/index.js\";\nimport type { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloQueryResult,\n OperationVariables,\n FetchMoreOptions,\n UpdateQueryOptions,\n FetchMoreQueryOptions,\n SubscribeToMoreOptions,\n DefaultContext,\n} from \"../../core/index.js\";\nimport type {\n MutationFunction,\n BaseQueryOptions,\n BaseMutationOptions,\n MutationResult,\n} from \"../types/types.js\";\n\nexport interface QueryControls<\n TData = any,\n TGraphQLVariables = OperationVariables,\n> {\n error?: ApolloError;\n networkStatus: number;\n loading: boolean;\n variables: TGraphQLVariables;\n fetchMore: (\n fetchMoreOptions: FetchMoreQueryOptions &\n FetchMoreOptions\n ) => Promise>;\n refetch: (variables?: TGraphQLVariables) => Promise>;\n startPolling: (pollInterval: number) => void;\n stopPolling: () => void;\n subscribeToMore: (options: SubscribeToMoreOptions) => () => void;\n updateQuery: (\n mapFn: (previousQueryResult: any, options: UpdateQueryOptions) => any\n ) => void;\n}\n\nexport type DataValue<\n TData,\n TGraphQLVariables = OperationVariables,\n> = QueryControls &\n // data may not yet be loaded\n Partial;\n\nexport interface DataProps {\n data: DataValue;\n}\n\nexport interface MutateProps<\n TData = any,\n TGraphQLVariables = OperationVariables,\n> {\n mutate: MutationFunction;\n result: MutationResult;\n}\n\nexport type ChildProps<\n TProps = {},\n TData = {},\n TGraphQLVariables = OperationVariables,\n> = TProps &\n Partial> &\n Partial>;\n\nexport type ChildDataProps<\n TProps = {},\n TData = {},\n TGraphQLVariables = OperationVariables,\n> = TProps & DataProps;\n\nexport type ChildMutateProps<\n TProps = {},\n TData = {},\n TGraphQLVariables = OperationVariables,\n> = TProps & MutateProps;\n\nexport interface OptionProps<\n TProps = any,\n TData = any,\n TGraphQLVariables = OperationVariables,\n> extends Partial>,\n Partial> {\n ownProps: TProps;\n}\n\nexport interface OperationOption<\n TProps,\n TData,\n TGraphQLVariables extends OperationVariables = OperationVariables,\n TChildProps = ChildProps,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> {\n options?:\n | BaseQueryOptions\n | BaseMutationOptions\n | ((\n props: TProps\n ) =>\n | BaseQueryOptions\n | BaseMutationOptions);\n props?: (\n props: OptionProps,\n lastProps?: TChildProps | void\n ) => TChildProps;\n skip?: boolean | ((props: TProps) => boolean);\n name?: string;\n withRef?: boolean;\n shouldResubscribe?: (props: TProps, nextProps: TProps) => boolean;\n alias?: string;\n}\n\nexport type WithApolloClient

    = P & { client?: ApolloClient };\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.d.ts new file mode 100644 index 0000000..12af192 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.d.ts @@ -0,0 +1,9 @@ +import type * as ReactTypes from "react"; +import type { OperationOption, WithApolloClient } from "./types.js"; +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export declare function withApollo(WrappedComponent: ReactTypes.ComponentType>>, operationOptions?: OperationOption): ReactTypes.ComponentClass>; +//# sourceMappingURL=withApollo.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js b/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js new file mode 100644 index 0000000..472eb0a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js @@ -0,0 +1,48 @@ +import { __assign, __extends } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +import hoistNonReactStatics from "hoist-non-react-statics"; +import { ApolloConsumer } from "../context/index.js"; +function getDisplayName(WrappedComponent) { + return WrappedComponent.displayName || WrappedComponent.name || "Component"; +} +/** + * @deprecated + * Official support for React Apollo higher order components ended in March 2020. + * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes. + */ +export function withApollo(WrappedComponent, operationOptions) { + if (operationOptions === void 0) { operationOptions = {}; } + var withDisplayName = "withApollo(".concat(getDisplayName(WrappedComponent), ")"); + var WithApollo = /** @class */ (function (_super) { + __extends(WithApollo, _super); + function WithApollo(props) { + var _this = _super.call(this, props) || this; + _this.setWrappedInstance = _this.setWrappedInstance.bind(_this); + return _this; + } + WithApollo.prototype.getWrappedInstance = function () { + invariant(operationOptions.withRef, 48); + return this.wrappedInstance; + }; + WithApollo.prototype.setWrappedInstance = function (ref) { + this.wrappedInstance = ref; + }; + WithApollo.prototype.render = function () { + var _this = this; + return (React.createElement(ApolloConsumer, null, function (client) { + var props = Object.assign({}, _this.props, { + client: client, + ref: operationOptions.withRef ? _this.setWrappedInstance : undefined, + }); + return React.createElement(WrappedComponent, __assign({}, props)); + })); + }; + WithApollo.displayName = withDisplayName; + WithApollo.WrappedComponent = WrappedComponent; + return WithApollo; + }(React.Component)); + // Make sure we preserve any custom statics on the original component. + return hoistNonReactStatics(WithApollo, WrappedComponent, {}); +} +//# sourceMappingURL=withApollo.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js.map b/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js.map new file mode 100644 index 0000000..60191cb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hoc/withApollo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"withApollo.js","sourceRoot":"","sources":["../../../src/react/hoc/withApollo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,SAAS,cAAc,CAAI,gBAA6C;IACtE,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAC9E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,gBAEC,EACD,gBAAuD;IAAvD,iCAAA,EAAA,qBAAuD;IAEvD,IAAM,eAAe,GAAG,qBAAc,cAAc,CAAC,gBAAgB,CAAC,MAAG,CAAC;IAE1E;QAAyB,8BAAuC;QAO9D,oBAAY,KAA6B;YACvC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YACb,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;QAC/D,CAAC;QAED,uCAAkB,GAAlB;YACE,SAAS,CACP,gBAAgB,CAAC,OAAO,EACxB,sDAAsD;gBACpD,kCAAkC,CACrC,CAAC;YAEF,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;QAED,uCAAkB,GAAlB,UACE,GAAuD;YAEvD,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;QAC7B,CAAC;QAED,2BAAM,GAAN;YAAA,iBAaC;YAZC,OAAO,CACL,oBAAC,cAAc,QACZ,UAAC,MAAM;gBACN,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAI,CAAC,KAAK,EAAE;oBAC1C,MAAM,QAAA;oBACN,GAAG,EACD,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;iBACjE,CAAC,CAAC;gBACH,OAAO,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CAAC;YACzC,CAAC,CACc,CAClB,CAAC;QACJ,CAAC;QAxCM,sBAAW,GAAG,eAAe,CAAC;QAC9B,2BAAgB,GAAG,gBAAgB,CAAC;QAwC7C,iBAAC;KAAA,AA1CD,CAAyB,KAAK,CAAC,SAAS,GA0CvC;IAED,sEAAsE;IACtE,OAAO,oBAAoB,CAAC,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\n\nimport { ApolloConsumer } from \"../context/index.js\";\nimport type { OperationOption, WithApolloClient } from \"./types.js\";\n\nfunction getDisplayName

    (WrappedComponent: ReactTypes.ComponentType

    ) {\n return WrappedComponent.displayName || WrappedComponent.name || \"Component\";\n}\n\n/**\n * @deprecated\n * Official support for React Apollo higher order components ended in March 2020.\n * This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.\n */\nexport function withApollo(\n WrappedComponent: ReactTypes.ComponentType<\n WithApolloClient>\n >,\n operationOptions: OperationOption = {}\n): ReactTypes.ComponentClass> {\n const withDisplayName = `withApollo(${getDisplayName(WrappedComponent)})`;\n\n class WithApollo extends React.Component> {\n static displayName = withDisplayName;\n static WrappedComponent = WrappedComponent;\n\n // wrapped instance\n private wrappedInstance: any;\n\n constructor(props: Omit) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n operationOptions.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(\n ref: ReactTypes.ComponentType>\n ) {\n this.wrappedInstance = ref;\n }\n\n render() {\n return (\n \n {(client) => {\n const props = Object.assign({}, this.props, {\n client,\n ref:\n operationOptions.withRef ? this.setWrappedInstance : undefined,\n });\n return ;\n }}\n \n );\n }\n }\n\n // Make sure we preserve any custom statics on the original component.\n return hoistNonReactStatics(WithApollo, WrappedComponent, {});\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.d.ts new file mode 100644 index 0000000..c174b3b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.d.ts @@ -0,0 +1,3 @@ +export declare const skipToken: unique symbol; +export type SkipToken = typeof skipToken; +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js new file mode 100644 index 0000000..00ddcde --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js @@ -0,0 +1,2 @@ +export var skipToken = Symbol.for("apollo.skipToken"); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js.map new file mode 100644 index 0000000..af3493f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/react/hooks/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["export const skipToken = Symbol.for(\"apollo.skipToken\");\nexport type SkipToken = typeof skipToken;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs b/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs new file mode 100644 index 0000000..d8d7304 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs @@ -0,0 +1,1045 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var React = require('rehackt'); +var context = require('../context'); +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var equality = require('@wry/equality'); +var errors = require('../../errors'); +var core = require('../../core'); +var parser = require('../parser'); +var internal = require('../internal'); +var cache = require('../../cache'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +function useApolloClient(override) { + var context$1 = React__namespace.useContext(context.getApolloContext()); + var client = override || context$1.client; + globals.invariant(!!client, 49); + return client; +} + +var didWarnUncachedGetSnapshot = false; +var uSESKey = "useSyncExternalStore"; +var realHook$1 = React__namespace[uSESKey]; +var useSyncExternalStore = realHook$1 || + (function (subscribe, getSnapshot, getServerSnapshot) { + var value = getSnapshot(); + if ( + globalThis.__DEV__ !== false && + !didWarnUncachedGetSnapshot && + value !== getSnapshot()) { + didWarnUncachedGetSnapshot = true; + globalThis.__DEV__ !== false && globals.invariant.error(58); + } + var _a = React__namespace.useState({ + inst: { value: value, getSnapshot: getSnapshot }, + }), inst = _a[0].inst, forceUpdate = _a[1]; + if (utilities.canUseLayoutEffect) { + React__namespace.useLayoutEffect(function () { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + }, [subscribe, value, getSnapshot]); + } + else { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + } + React__namespace.useEffect(function () { + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + return subscribe(function handleStoreChange() { + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + }); + }, [subscribe]); + return value; + }); +function checkIfSnapshotChanged(_a) { + var value = _a.value, getSnapshot = _a.getSnapshot; + try { + return value !== getSnapshot(); + } + catch (_b) { + return true; + } +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function useQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + return useInternalState(useApolloClient(options.client), query).useQuery(options); +} +function useInternalState(client, query) { + var stateRef = React__namespace.useRef(); + if (!stateRef.current || + client !== stateRef.current.client || + query !== stateRef.current.query) { + stateRef.current = new InternalState(client, query, stateRef.current); + } + var state = stateRef.current; + state.forceUpdateState = React__namespace.useReducer(function (tick) { return tick + 1; }, 0)[1]; + return state; +} +var InternalState = (function () { + function InternalState(client, query, previous) { + var _this = this; + this.client = client; + this.query = query; + this.forceUpdate = function () { return _this.forceUpdateState(); }; + this.ssrDisabledResult = utilities.maybeDeepFreeze({ + loading: true, + data: void 0, + error: void 0, + networkStatus: core.NetworkStatus.loading, + }); + this.skipStandbyResult = utilities.maybeDeepFreeze({ + loading: false, + data: void 0, + error: void 0, + networkStatus: core.NetworkStatus.ready, + }); + this.toQueryResultCache = new (utilities.canUseWeakMap ? WeakMap : Map)(); + parser.verifyDocumentType(query, parser.DocumentType.Query); + var previousResult = previous && previous.result; + var previousData = previousResult && previousResult.data; + if (previousData) { + this.previousData = previousData; + } + } + InternalState.prototype.forceUpdateState = function () { + globalThis.__DEV__ !== false && globals.invariant.warn(51); + }; + InternalState.prototype.executeQuery = function (options) { + var _this = this; + var _a; + if (options.query) { + Object.assign(this, { query: options.query }); + } + this.watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + var concast = this.observable.reobserveAsConcast(this.getObsQueryOptions()); + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + this.forceUpdate(); + return new Promise(function (resolve) { + var result; + concast.subscribe({ + next: function (value) { + result = value; + }, + error: function () { + resolve(_this.toQueryResult(_this.observable.getCurrentResult())); + }, + complete: function () { + resolve(_this.toQueryResult(result)); + }, + }); + }); + }; + InternalState.prototype.useQuery = function (options) { + var _this = this; + this.renderPromises = React__namespace.useContext(context.getApolloContext()).renderPromises; + this.useOptions(options); + var obsQuery = this.useObservableQuery(); + var result = useSyncExternalStore(React__namespace.useCallback(function (handleStoreChange) { + if (_this.renderPromises) { + return function () { }; + } + _this.forceUpdate = handleStoreChange; + var onNext = function () { + var previousResult = _this.result; + var result = obsQuery.getCurrentResult(); + if (previousResult && + previousResult.loading === result.loading && + previousResult.networkStatus === result.networkStatus && + equality.equal(previousResult.data, result.data)) { + return; + } + _this.setResult(result); + }; + var onError = function (error) { + subscription.unsubscribe(); + subscription = obsQuery.resubscribeAfterError(onNext, onError); + if (!hasOwnProperty.call(error, "graphQLErrors")) { + throw error; + } + var previousResult = _this.result; + if (!previousResult || + (previousResult && previousResult.loading) || + !equality.equal(error, previousResult.error)) { + _this.setResult({ + data: (previousResult && previousResult.data), + error: error, + loading: false, + networkStatus: core.NetworkStatus.error, + }); + } + }; + var subscription = obsQuery.subscribe(onNext, onError); + return function () { + setTimeout(function () { return subscription.unsubscribe(); }); + _this.forceUpdate = function () { return _this.forceUpdateState(); }; + }; + }, [ + obsQuery, + this.renderPromises, + this.client.disableNetworkFetches, + ]), function () { return _this.getCurrentResult(); }, function () { return _this.getCurrentResult(); }); + this.unsafeHandlePartialRefetch(result); + return this.toQueryResult(result); + }; + InternalState.prototype.useOptions = function (options) { + var _a; + var watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + var currentWatchQueryOptions = this.watchQueryOptions; + if (!equality.equal(watchQueryOptions, currentWatchQueryOptions)) { + this.watchQueryOptions = watchQueryOptions; + if (currentWatchQueryOptions && this.observable) { + this.observable.reobserve(this.getObsQueryOptions()); + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + } + } + this.onCompleted = + options.onCompleted || InternalState.prototype.onCompleted; + this.onError = options.onError || InternalState.prototype.onError; + if ((this.renderPromises || this.client.disableNetworkFetches) && + this.queryHookOptions.ssr === false && + !this.queryHookOptions.skip) { + this.result = this.ssrDisabledResult; + } + else if (this.queryHookOptions.skip || + this.watchQueryOptions.fetchPolicy === "standby") { + this.result = this.skipStandbyResult; + } + else if (this.result === this.ssrDisabledResult || + this.result === this.skipStandbyResult) { + this.result = void 0; + } + }; + InternalState.prototype.getObsQueryOptions = function () { + var toMerge = []; + var globalDefaults = this.client.defaultOptions.watchQuery; + if (globalDefaults) + toMerge.push(globalDefaults); + if (this.queryHookOptions.defaultOptions) { + toMerge.push(this.queryHookOptions.defaultOptions); + } + toMerge.push(utilities.compact(this.observable && this.observable.options, this.watchQueryOptions)); + return toMerge.reduce(utilities.mergeOptions); + }; + InternalState.prototype.createWatchQueryOptions = function (_a) { + var _b; + if (_a === void 0) { _a = {}; } + var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions; + var otherOptions = tslib.__rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]); + var watchQueryOptions = Object.assign(otherOptions, { query: this.query }); + if (this.renderPromises && + (watchQueryOptions.fetchPolicy === "network-only" || + watchQueryOptions.fetchPolicy === "cache-and-network")) { + watchQueryOptions.fetchPolicy = "cache-first"; + } + if (!watchQueryOptions.variables) { + watchQueryOptions.variables = {}; + } + if (skip) { + var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d; + Object.assign(watchQueryOptions, { + initialFetchPolicy: initialFetchPolicy, + fetchPolicy: "standby", + }); + } + else if (!watchQueryOptions.fetchPolicy) { + watchQueryOptions.fetchPolicy = + ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) || + this.getDefaultFetchPolicy(); + } + return watchQueryOptions; + }; + InternalState.prototype.getDefaultFetchPolicy = function () { + var _a, _b; + return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + "cache-first"); + }; + InternalState.prototype.onCompleted = function (data) { }; + InternalState.prototype.onError = function (error) { }; + InternalState.prototype.useObservableQuery = function () { + var obsQuery = (this.observable = + (this.renderPromises && + this.renderPromises.getSSRObservable(this.watchQueryOptions)) || + this.observable || + this.client.watchQuery(this.getObsQueryOptions())); + this.obsQueryFields = React__namespace.useMemo(function () { return ({ + refetch: obsQuery.refetch.bind(obsQuery), + reobserve: obsQuery.reobserve.bind(obsQuery), + fetchMore: obsQuery.fetchMore.bind(obsQuery), + updateQuery: obsQuery.updateQuery.bind(obsQuery), + startPolling: obsQuery.startPolling.bind(obsQuery), + stopPolling: obsQuery.stopPolling.bind(obsQuery), + subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery), + }); }, [obsQuery]); + var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip); + if (this.renderPromises && ssrAllowed) { + this.renderPromises.registerSSRObservable(obsQuery); + if (obsQuery.getCurrentResult().loading) { + this.renderPromises.addObservableQueryPromise(obsQuery); + } + } + return obsQuery; + }; + InternalState.prototype.setResult = function (nextResult) { + var previousResult = this.result; + if (previousResult && previousResult.data) { + this.previousData = previousResult.data; + } + this.result = nextResult; + this.forceUpdate(); + this.handleErrorOrCompleted(nextResult, previousResult); + }; + InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) { + var _this = this; + if (!result.loading) { + var error_1 = this.toApolloError(result); + Promise.resolve() + .then(function () { + if (error_1) { + _this.onError(error_1); + } + else if (result.data && + (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus && + result.networkStatus === core.NetworkStatus.ready) { + _this.onCompleted(result.data); + } + }) + .catch(function (error) { + globalThis.__DEV__ !== false && globals.invariant.warn(error); + }); + } + }; + InternalState.prototype.toApolloError = function (result) { + return utilities.isNonEmptyArray(result.errors) ? + new errors.ApolloError({ graphQLErrors: result.errors }) + : result.error; + }; + InternalState.prototype.getCurrentResult = function () { + if (!this.result) { + this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult())); + } + return this.result; + }; + InternalState.prototype.toQueryResult = function (result) { + var queryResult = this.toQueryResultCache.get(result); + if (queryResult) + return queryResult; + var data = result.data; result.partial; var resultWithoutPartial = tslib.__rest(result, ["data", "partial"]); + this.toQueryResultCache.set(result, (queryResult = tslib.__assign(tslib.__assign(tslib.__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData }))); + if (!queryResult.error && utilities.isNonEmptyArray(result.errors)) { + queryResult.error = new errors.ApolloError({ graphQLErrors: result.errors }); + } + return queryResult; + }; + InternalState.prototype.unsafeHandlePartialRefetch = function (result) { + if (result.partial && + this.queryHookOptions.partialRefetch && + !result.loading && + (!result.data || Object.keys(result.data).length === 0) && + this.observable.options.fetchPolicy !== "cache-only") { + Object.assign(result, { + loading: true, + networkStatus: core.NetworkStatus.refetch, + }); + this.observable.refetch(); + } + }; + return InternalState; +}()); + +var EAGER_METHODS = [ + "refetch", + "reobserve", + "fetchMore", + "updateQuery", + "startPolling", + "subscribeToMore", +]; +function useLazyQuery(query, options) { + var _a; + var execOptionsRef = React__namespace.useRef(); + var optionsRef = React__namespace.useRef(); + var queryRef = React__namespace.useRef(); + var merged = utilities.mergeOptions(options, execOptionsRef.current || {}); + var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query; + optionsRef.current = options; + queryRef.current = document; + var internalState = useInternalState(useApolloClient(options && options.client), document); + var useQueryResult = internalState.useQuery(tslib.__assign(tslib.__assign({}, merged), { skip: !execOptionsRef.current })); + var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy || + internalState.getDefaultFetchPolicy(); + var result = Object.assign(useQueryResult, { + called: !!execOptionsRef.current, + }); + var eagerMethods = React__namespace.useMemo(function () { + var eagerMethods = {}; + var _loop_1 = function (key) { + var method = result[key]; + eagerMethods[key] = function () { + if (!execOptionsRef.current) { + execOptionsRef.current = Object.create(null); + internalState.forceUpdateState(); + } + return method.apply(this, arguments); + }; + }; + for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) { + var key = EAGER_METHODS_1[_i]; + _loop_1(key); + } + return eagerMethods; + }, []); + Object.assign(result, eagerMethods); + var execute = React__namespace.useCallback(function (executeOptions) { + execOptionsRef.current = + executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : { + fetchPolicy: initialFetchPolicy, + }; + var options = utilities.mergeOptions(optionsRef.current, tslib.__assign({ query: queryRef.current }, execOptionsRef.current)); + var promise = internalState + .executeQuery(tslib.__assign(tslib.__assign({}, options), { skip: false })) + .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); }); + promise.catch(function () { }); + return promise; + }, []); + return [execute, result]; +} + +function useMutation(mutation, options) { + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + parser.verifyDocumentType(mutation, parser.DocumentType.Mutation); + var _a = React__namespace.useState({ + called: false, + loading: false, + client: client, + }), result = _a[0], setResult = _a[1]; + var ref = React__namespace.useRef({ + result: result, + mutationId: 0, + isMounted: true, + client: client, + mutation: mutation, + options: options, + }); + { + Object.assign(ref.current, { client: client, options: options, mutation: mutation }); + } + var execute = React__namespace.useCallback(function (executeOptions) { + if (executeOptions === void 0) { executeOptions = {}; } + var _a = ref.current, options = _a.options, mutation = _a.mutation; + var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation }); + var client = executeOptions.client || ref.current.client; + if (!ref.current.result.loading && + !baseOptions.ignoreResults && + ref.current.isMounted) { + setResult((ref.current.result = { + loading: true, + error: void 0, + data: void 0, + called: true, + client: client, + })); + } + var mutationId = ++ref.current.mutationId; + var clientOptions = utilities.mergeOptions(baseOptions, executeOptions); + return client + .mutate(clientOptions) + .then(function (response) { + var _a, _b; + var data = response.data, errors$1 = response.errors; + var error = errors$1 && errors$1.length > 0 ? + new errors.ApolloError({ graphQLErrors: errors$1 }) + : void 0; + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (error && onError) { + onError(error, clientOptions); + } + if (mutationId === ref.current.mutationId && + !clientOptions.ignoreResults) { + var result_1 = { + called: true, + loading: false, + data: data, + error: error, + client: client, + }; + if (ref.current.isMounted && !equality.equal(ref.current.result, result_1)) { + setResult((ref.current.result = result_1)); + } + } + var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted); + if (!error) { + onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions); + } + return response; + }) + .catch(function (error) { + var _a; + if (mutationId === ref.current.mutationId && ref.current.isMounted) { + var result_2 = { + loading: false, + error: error, + data: void 0, + called: true, + client: client, + }; + if (!equality.equal(ref.current.result, result_2)) { + setResult((ref.current.result = result_2)); + } + } + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (onError) { + onError(error, clientOptions); + return { data: void 0, errors: error }; + } + throw error; + }); + }, []); + var reset = React__namespace.useCallback(function () { + if (ref.current.isMounted) { + var result_3 = { called: false, loading: false, client: client }; + Object.assign(ref.current, { mutationId: 0, result: result_3 }); + setResult(result_3); + } + }, []); + React__namespace.useEffect(function () { + ref.current.isMounted = true; + return function () { + ref.current.isMounted = false; + }; + }, []); + return [execute, tslib.__assign({ reset: reset }, result)]; +} + +function useSubscription(subscription, options) { + var hasIssuedDeprecationWarningRef = React__namespace.useRef(false); + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + parser.verifyDocumentType(subscription, parser.DocumentType.Subscription); + var _a = React__namespace.useState({ + loading: !(options === null || options === void 0 ? void 0 : options.skip), + error: void 0, + data: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }), result = _a[0], setResult = _a[1]; + if (!hasIssuedDeprecationWarningRef.current) { + hasIssuedDeprecationWarningRef.current = true; + if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) { + globalThis.__DEV__ !== false && globals.invariant.warn(options.onData ? 52 : 53); + } + if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) { + globalThis.__DEV__ !== false && globals.invariant.warn(options.onComplete ? 54 : 55); + } + } + var _b = React__namespace.useState(function () { + if (options === null || options === void 0 ? void 0 : options.skip) { + return null; + } + return client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + }); + }), observable = _b[0], setObservable = _b[1]; + var canResetObservableRef = React__namespace.useRef(false); + React__namespace.useEffect(function () { + return function () { + canResetObservableRef.current = true; + }; + }, []); + var ref = React__namespace.useRef({ client: client, subscription: subscription, options: options }); + React__namespace.useEffect(function () { + var _a, _b, _c, _d; + var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe; + if (typeof shouldResubscribe === "function") { + shouldResubscribe = !!shouldResubscribe(options); + } + if (options === null || options === void 0 ? void 0 : options.skip) { + if (!(options === null || options === void 0 ? void 0 : options.skip) !== !((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.skip) || + canResetObservableRef.current) { + setResult({ + loading: false, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(null); + canResetObservableRef.current = false; + } + } + else if ((shouldResubscribe !== false && + (client !== ref.current.client || + subscription !== ref.current.subscription || + (options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + !(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) || + !equality.equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) || + canResetObservableRef.current) { + setResult({ + loading: true, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + })); + canResetObservableRef.current = false; + } + Object.assign(ref.current, { client: client, subscription: subscription, options: options }); + }, [client, subscription, options, canResetObservableRef.current]); + React__namespace.useEffect(function () { + if (!observable) { + return; + } + var subscriptionStopped = false; + var subscription = observable.subscribe({ + next: function (fetchResult) { + var _a, _b; + if (subscriptionStopped) { + return; + } + var result = { + loading: false, + data: fetchResult.data, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }; + setResult(result); + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) { + ref.current.options.onData({ + client: client, + data: result, + }); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) { + ref.current.options.onSubscriptionData({ + client: client, + subscriptionData: result, + }); + } + }, + error: function (error) { + var _a, _b; + if (!subscriptionStopped) { + setResult({ + loading: false, + data: void 0, + error: error, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error); + } + }, + complete: function () { + var _a, _b; + if (!subscriptionStopped) { + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) { + ref.current.options.onComplete(); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) { + ref.current.options.onSubscriptionComplete(); + } + } + }, + }); + return function () { + subscriptionStopped = true; + setTimeout(function () { + subscription.unsubscribe(); + }); + }; + }, [observable]); + return result; +} + +function useReactiveVar(rv) { + return useSyncExternalStore(React__namespace.useCallback(function (update) { + return rv.onNextChange(function onNext() { + update(); + rv.onNextChange(onNext); + }); + }, [rv]), rv, rv); +} + +function useDeepMemo(memoFn, deps) { + var ref = React__namespace.useRef(); + if (!ref.current || !equality.equal(ref.current.deps, deps)) { + ref.current = { value: memoFn(), deps: deps }; + } + return ref.current.value; +} + +function getRenderDispatcher() { + var _a, _b; + return (_b = (_a = React__namespace.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentDispatcher) === null || _b === void 0 ? void 0 : _b.current; +} +var RenderDispatcher = null; +function useRenderGuard() { + RenderDispatcher = getRenderDispatcher(); + return React__namespace.useCallback(function () { + return (RenderDispatcher !== null && RenderDispatcher === getRenderDispatcher()); + }, []); +} + +var INIT = {}; +function useLazyRef(getInitialValue) { + var ref = React__namespace.useRef(INIT); + if (ref.current === INIT) { + ref.current = getInitialValue(); + } + return ref; +} + +var useKey = "use"; +var realHook = React__namespace[useKey]; +var __use = realHook || + function __use(promise) { + var statefulPromise = utilities.wrapPromiseWithState(promise); + switch (statefulPromise.status) { + case "pending": + throw statefulPromise; + case "rejected": + throw statefulPromise.reason; + case "fulfilled": + return statefulPromise.value; + } + }; + +function useFragment(options) { + var cache = useApolloClient(options.client).cache; + var diffOptions = useDeepMemo(function () { + var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]); + return tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic }); + }, [options]); + var resultRef = useLazyRef(function () { + return diffToResult(cache.diff(diffOptions)); + }); + var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []); + return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) { + var lastTimeout = 0; + var unsubscribe = cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) { + if (!equality.equal(diff.result, resultRef.current.data)) { + resultRef.current = diffToResult(diff); + clearTimeout(lastTimeout); + lastTimeout = setTimeout(forceUpdate); + } + } })); + return function () { + unsubscribe(); + clearTimeout(lastTimeout); + }; + }, [cache, diffOptions]), getSnapshot, getSnapshot); +} +function diffToResult(diff) { + var result = { + data: diff.result, + complete: !!diff.complete, + }; + if (diff.missing) { + result.missing = utilities.mergeDeepArray(diff.missing.map(function (error) { return error.missing; })); + } + return result; +} + +var skipToken = Symbol.for("apollo.skipToken"); + +function useSuspenseQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = internal.getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ + client: client, + query: query, + options: options, + }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var cacheKey = tslib.__spreadArray([ + query, + cache.canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React__namespace.useState([queryRef.key, queryRef.promise]), current = _b[0], setPromise = _b[1]; + if (current[0] !== queryRef.key) { + current[0] = queryRef.key; + current[1] = queryRef.promise; + } + var promise = current[1]; + if (queryRef.didChangeOptions(watchQueryOptions)) { + current[1] = promise = queryRef.applyOptions(watchQueryOptions); + } + React__namespace.useEffect(function () { + var dispose = queryRef.retain(); + var removeListener = queryRef.listen(function (promise) { + setPromise([queryRef.key, promise]); + }); + return function () { + removeListener(); + dispose(); + }; + }, [queryRef]); + var skipResult = React__namespace.useMemo(function () { + var error = toApolloError(queryRef.result); + return { + loading: false, + data: queryRef.result.data, + networkStatus: error ? core.NetworkStatus.error : core.NetworkStatus.ready, + error: error, + }; + }, [queryRef.result]); + var result = fetchPolicy === "standby" ? skipResult : __use(promise); + var fetchMore = React__namespace.useCallback((function (options) { + var promise = queryRef.fetchMore(options); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }), [queryRef]); + var refetch = React__namespace.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }, [queryRef]); + var subscribeToMore = React__namespace.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]); + return React__namespace.useMemo(function () { + return { + client: client, + data: result.data, + error: toApolloError(result), + networkStatus: result.networkStatus, + fetchMore: fetchMore, + refetch: refetch, + subscribeToMore: subscribeToMore, + }; + }, [client, fetchMore, refetch, result, subscribeToMore]); +} +function validateOptions(options) { + var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData; + parser.verifyDocumentType(query, parser.DocumentType.Query); + validateFetchPolicy(fetchPolicy); + validatePartialDataReturn(fetchPolicy, returnPartialData); +} +function validateFetchPolicy(fetchPolicy) { + if (fetchPolicy === void 0) { fetchPolicy = "cache-first"; } + var supportedFetchPolicies = [ + "cache-first", + "network-only", + "no-cache", + "cache-and-network", + ]; + globals.invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy); +} +function validatePartialDataReturn(fetchPolicy, returnPartialData) { + if (fetchPolicy === "no-cache" && returnPartialData) { + globalThis.__DEV__ !== false && globals.invariant.warn(57); + } +} +function toApolloError(result) { + return utilities.isNonEmptyArray(result.errors) ? + new core.ApolloError({ graphQLErrors: result.errors }) + : result.error; +} +function useWatchQueryOptions(_a) { + var client = _a.client, query = _a.query, options = _a.options; + return useDeepMemo(function () { + var _a; + if (options === skipToken) { + return { query: query, fetchPolicy: "standby" }; + } + var fetchPolicy = options.fetchPolicy || + ((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + "cache-first"; + var watchQueryOptions = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 }); + if (globalThis.__DEV__ !== false) { + validateOptions(watchQueryOptions); + } + if (options.skip) { + watchQueryOptions.fetchPolicy = "standby"; + } + return watchQueryOptions; + }, [client, options, query]); +} + +function useBackgroundQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = internal.getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var didFetchResult = React__namespace.useRef(fetchPolicy !== "standby"); + didFetchResult.current || (didFetchResult.current = fetchPolicy !== "standby"); + var cacheKey = tslib.__spreadArray([ + query, + cache.canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React__namespace.useState(internal.wrapQueryRef(queryRef)), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + if (internal.unwrapQueryRef(wrappedQueryRef) !== queryRef) { + setWrappedQueryRef(internal.wrapQueryRef(queryRef)); + } + if (queryRef.didChangeOptions(watchQueryOptions)) { + var promise = queryRef.applyOptions(watchQueryOptions); + internal.updateWrappedQueryRef(wrappedQueryRef, promise); + } + var fetchMore = React__namespace.useCallback(function (options) { + var promise = queryRef.fetchMore(options); + setWrappedQueryRef(internal.wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + var refetch = React__namespace.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setWrappedQueryRef(internal.wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + return [ + didFetchResult.current ? wrappedQueryRef : void 0, + { fetchMore: fetchMore, refetch: refetch }, + ]; +} + +function useLoadableQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = internal.getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var _b = React__namespace.useState(null), queryRef = _b[0], setQueryRef = _b[1]; + var internalQueryRef = queryRef && internal.unwrapQueryRef(queryRef); + if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) { + var promise = internalQueryRef.applyOptions(watchQueryOptions); + internal.updateWrappedQueryRef(queryRef, promise); + } + var calledDuringRender = useRenderGuard(); + var fetchMore = React__namespace.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.fetchMore(options); + setQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var refetch = React__namespace.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.refetch(options); + setQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var loadQuery = React__namespace.useCallback(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + globals.invariant(!calledDuringRender(), 50); + var variables = args[0]; + var cacheKey = tslib.__spreadArray([ + query, + cache.canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(tslib.__assign(tslib.__assign({}, watchQueryOptions), { variables: variables })); + }); + setQueryRef(internal.wrapQueryRef(queryRef)); + }, [query, queryKey, suspenseCache, watchQueryOptions, calledDuringRender]); + var reset = React__namespace.useCallback(function () { + setQueryRef(null); + }, [queryRef]); + return [loadQuery, queryRef, { fetchMore: fetchMore, refetch: refetch, reset: reset }]; +} + +function useQueryRefHandlers(queryRef) { + var _a = React__namespace.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1]; + var _b = React__namespace.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + var internalQueryRef = internal.unwrapQueryRef(queryRef); + if (previousQueryRef !== queryRef) { + setPreviousQueryRef(queryRef); + setWrappedQueryRef(queryRef); + } + else { + internal.updateWrappedQueryRef(queryRef, internal.getWrappedPromise(wrappedQueryRef)); + } + var refetch = React__namespace.useCallback(function (variables) { + var promise = internalQueryRef.refetch(variables); + setWrappedQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var fetchMore = React__namespace.useCallback(function (options) { + var promise = internalQueryRef.fetchMore(options); + setWrappedQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + return { refetch: refetch, fetchMore: fetchMore }; +} + +function useReadQuery(queryRef) { + var internalQueryRef = React__namespace.useMemo(function () { return internal.unwrapQueryRef(queryRef); }, [queryRef]); + var getPromise = React__namespace.useCallback(function () { return internal.getWrappedPromise(queryRef); }, [queryRef]); + if (internalQueryRef.disposed) { + internalQueryRef.reinitialize(); + internal.updateWrappedQueryRef(queryRef, internalQueryRef.promise); + } + React__namespace.useEffect(function () { return internalQueryRef.retain(); }, [internalQueryRef]); + var promise = useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) { + return internalQueryRef.listen(function (promise) { + internal.updateWrappedQueryRef(queryRef, promise); + forceUpdate(); + }); + }, [internalQueryRef]), getPromise, getPromise); + var result = __use(promise); + return React__namespace.useMemo(function () { + return { + data: result.data, + networkStatus: result.networkStatus, + error: toApolloError(result), + }; + }, [result]); +} + +exports.skipToken = skipToken; +exports.useApolloClient = useApolloClient; +exports.useBackgroundQuery = useBackgroundQuery; +exports.useFragment = useFragment; +exports.useLazyQuery = useLazyQuery; +exports.useLoadableQuery = useLoadableQuery; +exports.useMutation = useMutation; +exports.useQuery = useQuery; +exports.useQueryRefHandlers = useQueryRefHandlers; +exports.useReactiveVar = useReactiveVar; +exports.useReadQuery = useReadQuery; +exports.useSubscription = useSubscription; +exports.useSuspenseQuery = useSuspenseQuery; +//# sourceMappingURL=hooks.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.map new file mode 100644 index 0000000..2dccdde --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"hooks.cjs","sources":["useApolloClient.js","useSyncExternalStore.js","useQuery.js","useLazyQuery.js","useMutation.js","useSubscription.js","useReactiveVar.js","internal/useDeepMemo.js","internal/useRenderGuard.js","internal/useLazyRef.js","internal/__use.js","useFragment.js","constants.js","useSuspenseQuery.js","useBackgroundQuery.js","useLoadableQuery.js","useQueryRefHandlers.js","useReadQuery.js"],"sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"../context/index.js\";\n/**\n * @example\n * ```jsx\n * import { useApolloClient } from '@apollo/client';\n *\n * function SomeComponent() {\n * const client = useApolloClient();\n * // `client` is now set to the `ApolloClient` instance being used by the\n * // application (that was configured using something like `ApolloProvider`)\n * }\n * ```\n *\n * @since 3.0.0\n * @returns The `ApolloClient` instance being used by the application.\n */\nexport function useApolloClient(override) {\n var context = React.useContext(getApolloContext());\n var client = override || context.client;\n invariant(!!client, 49);\n return client;\n}\n//# sourceMappingURL=useApolloClient.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { canUseLayoutEffect } from \"../../utilities/index.js\";\nvar didWarnUncachedGetSnapshot = false;\n// Prevent webpack from complaining about our feature detection of the\n// useSyncExternalStore property of the React namespace, which is expected not\n// to exist when using React 17 and earlier, and that's fine.\nvar uSESKey = \"useSyncExternalStore\";\nvar realHook = React[uSESKey];\n// Adapted from https://www.npmjs.com/package/use-sync-external-store, with\n// Apollo Client deviations called out by \"// DEVIATION ...\" comments.\n// When/if React.useSyncExternalStore is defined, delegate fully to it.\nexport var useSyncExternalStore = realHook ||\n (function (subscribe, getSnapshot, getServerSnapshot) {\n // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n var value = getSnapshot();\n if (\n // DEVIATION: Using __DEV__\n globalThis.__DEV__ !== false &&\n !didWarnUncachedGetSnapshot &&\n // DEVIATION: Not using Object.is because we know our snapshots will never\n // be exotic primitive values like NaN, which is !== itself.\n value !== getSnapshot()) {\n didWarnUncachedGetSnapshot = true;\n // DEVIATION: Using invariant.error instead of console.error directly.\n globalThis.__DEV__ !== false && invariant.error(58);\n }\n // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n var _a = React.useState({\n inst: { value: value, getSnapshot: getSnapshot },\n }), inst = _a[0].inst, forceUpdate = _a[1];\n // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n if (canUseLayoutEffect) {\n // DEVIATION: We avoid calling useLayoutEffect when !canUseLayoutEffect,\n // which may seem like a conditional hook, but this code ends up behaving\n // unconditionally (one way or the other) because canUseLayoutEffect is\n // constant.\n React.useLayoutEffect(function () {\n Object.assign(inst, { value: value, getSnapshot: getSnapshot });\n // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n }, [subscribe, value, getSnapshot]);\n }\n else {\n Object.assign(inst, { value: value, getSnapshot: getSnapshot });\n }\n React.useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n // Subscribe to the store and return a clean-up function.\n return subscribe(function handleStoreChange() {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n });\n }, [subscribe]);\n return value;\n });\nfunction checkIfSnapshotChanged(_a) {\n var value = _a.value, getSnapshot = _a.getSnapshot;\n try {\n return value !== getSnapshot();\n }\n catch (_b) {\n return true;\n }\n}\n//# sourceMappingURL=useSyncExternalStore.js.map","import { __assign, __rest } from \"tslib\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { equal } from \"@wry/equality\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { getApolloContext } from \"../context/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { NetworkStatus } from \"../../core/index.js\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { canUseWeakMap, compact, isNonEmptyArray, maybeDeepFreeze, } from \"../../utilities/index.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * A hook for executing queries in an Apollo application.\n *\n * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.\n *\n * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, and `data` properties you can use to render your UI.\n *\n * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useQuery } from '@apollo/client';\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const { loading, error, data } = useQuery(GET_GREETING, {\n * variables: { language: 'english' },\n * });\n * if (loading) return

    Loading ...

    ;\n * return

    Hello {data.greeting.message}!

    ;\n * }\n * ```\n * @since 3.0.0\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Options to control how the query is executed.\n * @returns Query result object\n */\nexport function useQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n return useInternalState(useApolloClient(options.client), query).useQuery(options);\n}\nexport function useInternalState(client, query) {\n var stateRef = React.useRef();\n if (!stateRef.current ||\n client !== stateRef.current.client ||\n query !== stateRef.current.query) {\n stateRef.current = new InternalState(client, query, stateRef.current);\n }\n var state = stateRef.current;\n // By default, InternalState.prototype.forceUpdate is an empty function, but\n // we replace it here (before anyone has had a chance to see this state yet)\n // with a function that unconditionally forces an update, using the latest\n // setTick function. Updating this state by calling state.forceUpdate is the\n // only way we trigger React component updates (no other useState calls within\n // the InternalState class).\n state.forceUpdateState = React.useReducer(function (tick) { return tick + 1; }, 0)[1];\n return state;\n}\nvar InternalState = /** @class */ (function () {\n function InternalState(client, query, previous) {\n var _this = this;\n this.client = client;\n this.query = query;\n /**\n * Will be overwritten by the `useSyncExternalStore` \"force update\" method\n * whenever it is available and reset to `forceUpdateState` when it isn't.\n */\n this.forceUpdate = function () { return _this.forceUpdateState(); };\n this.ssrDisabledResult = maybeDeepFreeze({\n loading: true,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.loading,\n });\n this.skipStandbyResult = maybeDeepFreeze({\n loading: false,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.ready,\n });\n // This cache allows the referential stability of this.result (as returned by\n // getCurrentResult) to translate into referential stability of the resulting\n // QueryResult object returned by toQueryResult.\n this.toQueryResultCache = new (canUseWeakMap ? WeakMap : Map)();\n verifyDocumentType(query, DocumentType.Query);\n // Reuse previousData from previous InternalState (if any) to provide\n // continuity of previousData even if/when the query or client changes.\n var previousResult = previous && previous.result;\n var previousData = previousResult && previousResult.data;\n if (previousData) {\n this.previousData = previousData;\n }\n }\n /**\n * Forces an update using local component state.\n * As this is not batched with `useSyncExternalStore` updates,\n * this is only used as a fallback if the `useSyncExternalStore` \"force update\"\n * method is not registered at the moment.\n * See https://github.com/facebook/react/issues/25191\n * */\n InternalState.prototype.forceUpdateState = function () {\n // Replaced (in useInternalState) with a method that triggers an update.\n globalThis.__DEV__ !== false && invariant.warn(51);\n };\n InternalState.prototype.executeQuery = function (options) {\n var _this = this;\n var _a;\n if (options.query) {\n Object.assign(this, { query: options.query });\n }\n this.watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options));\n var concast = this.observable.reobserveAsConcast(this.getObsQueryOptions());\n // Make sure getCurrentResult returns a fresh ApolloQueryResult,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData;\n this.result = void 0;\n this.forceUpdate();\n return new Promise(function (resolve) {\n var result;\n // Subscribe to the concast independently of the ObservableQuery in case\n // the component gets unmounted before the promise resolves. This prevents\n // the concast from terminating early and resolving with `undefined` when\n // there are no more subscribers for the concast.\n concast.subscribe({\n next: function (value) {\n result = value;\n },\n error: function () {\n resolve(_this.toQueryResult(_this.observable.getCurrentResult()));\n },\n complete: function () {\n resolve(_this.toQueryResult(result));\n },\n });\n });\n };\n // Methods beginning with use- should be called according to the standard\n // rules of React hooks: only at the top level of the calling function, and\n // without any dynamic conditional logic.\n InternalState.prototype.useQuery = function (options) {\n var _this = this;\n // The renderPromises field gets initialized here in the useQuery method, at\n // the beginning of everything (for a given component rendering, at least),\n // so we can safely use this.renderPromises in other/later InternalState\n // methods without worrying it might be uninitialized. Even after\n // initialization, this.renderPromises is usually undefined (unless SSR is\n // happening), but that's fine as long as it has been initialized that way,\n // rather than left uninitialized.\n this.renderPromises = React.useContext(getApolloContext()).renderPromises;\n this.useOptions(options);\n var obsQuery = this.useObservableQuery();\n var result = useSyncExternalStore(React.useCallback(function (handleStoreChange) {\n if (_this.renderPromises) {\n return function () { };\n }\n _this.forceUpdate = handleStoreChange;\n var onNext = function () {\n var previousResult = _this.result;\n // We use `getCurrentResult()` instead of the onNext argument because\n // the values differ slightly. Specifically, loading results will have\n // an empty object for data instead of `undefined` for some reason.\n var result = obsQuery.getCurrentResult();\n // Make sure we're not attempting to re-render similar results\n if (previousResult &&\n previousResult.loading === result.loading &&\n previousResult.networkStatus === result.networkStatus &&\n equal(previousResult.data, result.data)) {\n return;\n }\n _this.setResult(result);\n };\n var onError = function (error) {\n subscription.unsubscribe();\n subscription = obsQuery.resubscribeAfterError(onNext, onError);\n if (!hasOwnProperty.call(error, \"graphQLErrors\")) {\n // The error is not a GraphQL error\n throw error;\n }\n var previousResult = _this.result;\n if (!previousResult ||\n (previousResult && previousResult.loading) ||\n !equal(error, previousResult.error)) {\n _this.setResult({\n data: (previousResult && previousResult.data),\n error: error,\n loading: false,\n networkStatus: NetworkStatus.error,\n });\n }\n };\n var subscription = obsQuery.subscribe(onNext, onError);\n // Do the \"unsubscribe\" with a short delay.\n // This way, an existing subscription can be reused without an additional\n // request if \"unsubscribe\" and \"resubscribe\" to the same ObservableQuery\n // happen in very fast succession.\n return function () {\n setTimeout(function () { return subscription.unsubscribe(); });\n _this.forceUpdate = function () { return _this.forceUpdateState(); };\n };\n }, [\n // We memoize the subscribe function using useCallback and the following\n // dependency keys, because the subscribe function reference is all that\n // useSyncExternalStore uses internally as a dependency key for the\n // useEffect ultimately responsible for the subscription, so we are\n // effectively passing this dependency array to that useEffect buried\n // inside useSyncExternalStore, as desired.\n obsQuery,\n this.renderPromises,\n this.client.disableNetworkFetches,\n ]), function () { return _this.getCurrentResult(); }, function () { return _this.getCurrentResult(); });\n // TODO Remove this method when we remove support for options.partialRefetch.\n this.unsafeHandlePartialRefetch(result);\n return this.toQueryResult(result);\n };\n InternalState.prototype.useOptions = function (options) {\n var _a;\n var watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options));\n // Update this.watchQueryOptions, but only when they have changed, which\n // allows us to depend on the referential stability of\n // this.watchQueryOptions elsewhere.\n var currentWatchQueryOptions = this.watchQueryOptions;\n if (!equal(watchQueryOptions, currentWatchQueryOptions)) {\n this.watchQueryOptions = watchQueryOptions;\n if (currentWatchQueryOptions && this.observable) {\n // Though it might be tempting to postpone this reobserve call to the\n // useEffect block, we need getCurrentResult to return an appropriate\n // loading:true result synchronously (later within the same call to\n // useQuery). Since we already have this.observable here (not true for\n // the very first call to useQuery), we are not initiating any new\n // subscriptions, though it does feel less than ideal that reobserve\n // (potentially) kicks off a network request (for example, when the\n // variables have changed), which is technically a side-effect.\n this.observable.reobserve(this.getObsQueryOptions());\n // Make sure getCurrentResult returns a fresh ApolloQueryResult,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData;\n this.result = void 0;\n }\n }\n // Make sure state.onCompleted and state.onError always reflect the latest\n // options.onCompleted and options.onError callbacks provided to useQuery,\n // since those functions are often recreated every time useQuery is called.\n // Like the forceUpdate method, the versions of these methods inherited from\n // InternalState.prototype are empty no-ops, but we can override them on the\n // base state object (without modifying the prototype).\n this.onCompleted =\n options.onCompleted || InternalState.prototype.onCompleted;\n this.onError = options.onError || InternalState.prototype.onError;\n if ((this.renderPromises || this.client.disableNetworkFetches) &&\n this.queryHookOptions.ssr === false &&\n !this.queryHookOptions.skip) {\n // If SSR has been explicitly disabled, and this function has been called\n // on the server side, return the default loading state.\n this.result = this.ssrDisabledResult;\n }\n else if (this.queryHookOptions.skip ||\n this.watchQueryOptions.fetchPolicy === \"standby\") {\n // When skipping a query (ie. we're not querying for data but still want to\n // render children), make sure the `data` is cleared out and `loading` is\n // set to `false` (since we aren't loading anything).\n //\n // NOTE: We no longer think this is the correct behavior. Skipping should\n // not automatically set `data` to `undefined`, but instead leave the\n // previous data in place. In other words, skipping should not mandate that\n // previously received data is all of a sudden removed. Unfortunately,\n // changing this is breaking, so we'll have to wait until Apollo Client 4.0\n // to address this.\n this.result = this.skipStandbyResult;\n }\n else if (this.result === this.ssrDisabledResult ||\n this.result === this.skipStandbyResult) {\n this.result = void 0;\n }\n };\n InternalState.prototype.getObsQueryOptions = function () {\n var toMerge = [];\n var globalDefaults = this.client.defaultOptions.watchQuery;\n if (globalDefaults)\n toMerge.push(globalDefaults);\n if (this.queryHookOptions.defaultOptions) {\n toMerge.push(this.queryHookOptions.defaultOptions);\n }\n // We use compact rather than mergeOptions for this part of the merge,\n // because we want watchQueryOptions.variables (if defined) to replace\n // this.observable.options.variables whole. This replacement allows\n // removing variables by removing them from the variables input to\n // useQuery. If the variables were always merged together (rather than\n // replaced), there would be no way to remove existing variables.\n // However, the variables from options.defaultOptions and globalDefaults\n // (if provided) should be merged, to ensure individual defaulted\n // variables always have values, if not otherwise defined in\n // observable.options or watchQueryOptions.\n toMerge.push(compact(this.observable && this.observable.options, this.watchQueryOptions));\n return toMerge.reduce(mergeOptions);\n };\n // A function to massage options before passing them to ObservableQuery.\n InternalState.prototype.createWatchQueryOptions = function (_a) {\n var _b;\n if (_a === void 0) { _a = {}; }\n var skip = _a.skip, ssr = _a.ssr, onCompleted = _a.onCompleted, onError = _a.onError, defaultOptions = _a.defaultOptions, \n // The above options are useQuery-specific, so this ...otherOptions spread\n // makes otherOptions almost a WatchQueryOptions object, except for the\n // query property that we add below.\n otherOptions = __rest(_a, [\"skip\", \"ssr\", \"onCompleted\", \"onError\", \"defaultOptions\"]);\n // This Object.assign is safe because otherOptions is a fresh ...rest object\n // that did not exist until just now, so modifications are still allowed.\n var watchQueryOptions = Object.assign(otherOptions, { query: this.query });\n if (this.renderPromises &&\n (watchQueryOptions.fetchPolicy === \"network-only\" ||\n watchQueryOptions.fetchPolicy === \"cache-and-network\")) {\n // this behavior was added to react-apollo without explanation in this PR\n // https://github.com/apollographql/react-apollo/pull/1579\n watchQueryOptions.fetchPolicy = \"cache-first\";\n }\n if (!watchQueryOptions.variables) {\n watchQueryOptions.variables = {};\n }\n if (skip) {\n var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d;\n // When skipping, we set watchQueryOptions.fetchPolicy initially to\n // \"standby\", but we also need/want to preserve the initial non-standby\n // fetchPolicy that would have been used if not skipping.\n Object.assign(watchQueryOptions, {\n initialFetchPolicy: initialFetchPolicy,\n fetchPolicy: \"standby\",\n });\n }\n else if (!watchQueryOptions.fetchPolicy) {\n watchQueryOptions.fetchPolicy =\n ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) ||\n this.getDefaultFetchPolicy();\n }\n return watchQueryOptions;\n };\n InternalState.prototype.getDefaultFetchPolicy = function () {\n var _a, _b;\n return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||\n ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||\n \"cache-first\");\n };\n // Defining these methods as no-ops on the prototype allows us to call\n // state.onCompleted and/or state.onError without worrying about whether a\n // callback was provided.\n InternalState.prototype.onCompleted = function (data) { };\n InternalState.prototype.onError = function (error) { };\n InternalState.prototype.useObservableQuery = function () {\n // See if there is an existing observable that was used to fetch the same\n // data and if so, use it instead since it will contain the proper queryId\n // to fetch the result set. This is used during SSR.\n var obsQuery = (this.observable =\n (this.renderPromises &&\n this.renderPromises.getSSRObservable(this.watchQueryOptions)) ||\n this.observable || // Reuse this.observable if possible (and not SSR)\n this.client.watchQuery(this.getObsQueryOptions()));\n this.obsQueryFields = React.useMemo(function () { return ({\n refetch: obsQuery.refetch.bind(obsQuery),\n reobserve: obsQuery.reobserve.bind(obsQuery),\n fetchMore: obsQuery.fetchMore.bind(obsQuery),\n updateQuery: obsQuery.updateQuery.bind(obsQuery),\n startPolling: obsQuery.startPolling.bind(obsQuery),\n stopPolling: obsQuery.stopPolling.bind(obsQuery),\n subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery),\n }); }, [obsQuery]);\n var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip);\n if (this.renderPromises && ssrAllowed) {\n this.renderPromises.registerSSRObservable(obsQuery);\n if (obsQuery.getCurrentResult().loading) {\n // TODO: This is a legacy API which could probably be cleaned up\n this.renderPromises.addObservableQueryPromise(obsQuery);\n }\n }\n return obsQuery;\n };\n InternalState.prototype.setResult = function (nextResult) {\n var previousResult = this.result;\n if (previousResult && previousResult.data) {\n this.previousData = previousResult.data;\n }\n this.result = nextResult;\n // Calling state.setResult always triggers an update, though some call sites\n // perform additional equality checks before committing to an update.\n this.forceUpdate();\n this.handleErrorOrCompleted(nextResult, previousResult);\n };\n InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) {\n var _this = this;\n if (!result.loading) {\n var error_1 = this.toApolloError(result);\n // wait a tick in case we are in the middle of rendering a component\n Promise.resolve()\n .then(function () {\n if (error_1) {\n _this.onError(error_1);\n }\n else if (result.data &&\n (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus &&\n result.networkStatus === NetworkStatus.ready) {\n _this.onCompleted(result.data);\n }\n })\n .catch(function (error) {\n globalThis.__DEV__ !== false && invariant.warn(error);\n });\n }\n };\n InternalState.prototype.toApolloError = function (result) {\n return isNonEmptyArray(result.errors) ?\n new ApolloError({ graphQLErrors: result.errors })\n : result.error;\n };\n InternalState.prototype.getCurrentResult = function () {\n // Using this.result as a cache ensures getCurrentResult continues returning\n // the same (===) result object, unless state.setResult has been called, or\n // we're doing server rendering and therefore override the result below.\n if (!this.result) {\n this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult()));\n }\n return this.result;\n };\n InternalState.prototype.toQueryResult = function (result) {\n var queryResult = this.toQueryResultCache.get(result);\n if (queryResult)\n return queryResult;\n var data = result.data, partial = result.partial, resultWithoutPartial = __rest(result, [\"data\", \"partial\"]);\n this.toQueryResultCache.set(result, (queryResult = __assign(__assign(__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData })));\n if (!queryResult.error && isNonEmptyArray(result.errors)) {\n // Until a set naming convention for networkError and graphQLErrors is\n // decided upon, we map errors (graphQLErrors) to the error options.\n // TODO: Is it possible for both result.error and result.errors to be\n // defined here?\n queryResult.error = new ApolloError({ graphQLErrors: result.errors });\n }\n return queryResult;\n };\n InternalState.prototype.unsafeHandlePartialRefetch = function (result) {\n // WARNING: SIDE-EFFECTS IN THE RENDER FUNCTION\n //\n // TODO: This code should be removed when the partialRefetch option is\n // removed. I was unable to get this hook to behave reasonably in certain\n // edge cases when this block was put in an effect.\n if (result.partial &&\n this.queryHookOptions.partialRefetch &&\n !result.loading &&\n (!result.data || Object.keys(result.data).length === 0) &&\n this.observable.options.fetchPolicy !== \"cache-only\") {\n Object.assign(result, {\n loading: true,\n networkStatus: NetworkStatus.refetch,\n });\n this.observable.refetch();\n }\n };\n return InternalState;\n}());\n//# sourceMappingURL=useQuery.js.map","import { __assign } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { useInternalState } from \"./useQuery.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n// The following methods, when called will execute the query, regardless of\n// whether the useLazyQuery execute function was called before.\nvar EAGER_METHODS = [\n \"refetch\",\n \"reobserve\",\n \"fetchMore\",\n \"updateQuery\",\n \"startPolling\",\n \"subscribeToMore\",\n];\n/**\n * A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction.\n *\n * > Refer to the [Queries - Manual execution with useLazyQuery](https://www.apollographql.com/docs/react/data/queries#manual-execution-with-uselazyquery) section for a more in-depth overview of `useLazyQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useLazyQuery } from \"@apollo/client\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const [loadGreeting, { called, loading, data }] = useLazyQuery(\n * GET_GREETING,\n * { variables: { language: \"english\" } }\n * );\n * if (called && loading) return

    Loading ...

    \n * if (!called) {\n * return \n * }\n * return

    Hello {data.greeting.message}!

    ;\n * }\n * ```\n * @since 3.0.0\n *\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Default options to control how the query is executed.\n * @returns A tuple in the form of `[execute, result]`\n */\nexport function useLazyQuery(query, options) {\n var _a;\n var execOptionsRef = React.useRef();\n var optionsRef = React.useRef();\n var queryRef = React.useRef();\n var merged = mergeOptions(options, execOptionsRef.current || {});\n var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;\n // Use refs to track options and the used query to ensure the `execute`\n // function remains referentially stable between renders.\n optionsRef.current = options;\n queryRef.current = document;\n var internalState = useInternalState(useApolloClient(options && options.client), document);\n var useQueryResult = internalState.useQuery(__assign(__assign({}, merged), { skip: !execOptionsRef.current }));\n var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy ||\n internalState.getDefaultFetchPolicy();\n var result = Object.assign(useQueryResult, {\n called: !!execOptionsRef.current,\n });\n // We use useMemo here to make sure the eager methods have a stable identity.\n var eagerMethods = React.useMemo(function () {\n var eagerMethods = {};\n var _loop_1 = function (key) {\n var method = result[key];\n eagerMethods[key] = function () {\n if (!execOptionsRef.current) {\n execOptionsRef.current = Object.create(null);\n // Only the first time populating execOptionsRef.current matters here.\n internalState.forceUpdateState();\n }\n // @ts-expect-error this is just too generic to type\n return method.apply(this, arguments);\n };\n };\n for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) {\n var key = EAGER_METHODS_1[_i];\n _loop_1(key);\n }\n return eagerMethods;\n }, []);\n Object.assign(result, eagerMethods);\n var execute = React.useCallback(function (executeOptions) {\n execOptionsRef.current =\n executeOptions ? __assign(__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {\n fetchPolicy: initialFetchPolicy,\n };\n var options = mergeOptions(optionsRef.current, __assign({ query: queryRef.current }, execOptionsRef.current));\n var promise = internalState\n .executeQuery(__assign(__assign({}, options), { skip: false }))\n .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); });\n // Because the return value of `useLazyQuery` is usually floated, we need\n // to catch the promise to prevent unhandled rejections.\n promise.catch(function () { });\n return promise;\n }, []);\n return [execute, result];\n}\n//# sourceMappingURL=useLazyQuery.js.map","import { __assign } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n/**\n *\n *\n * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`.\n *\n * @example\n * ```jsx\n * import { gql, useMutation } from '@apollo/client';\n *\n * const ADD_TODO = gql`\n * mutation AddTodo($type: String!) {\n * addTodo(type: $type) {\n * id\n * type\n * }\n * }\n * `;\n *\n * function AddTodo() {\n * let input;\n * const [addTodo, { data }] = useMutation(ADD_TODO);\n *\n * return (\n *
    \n * {\n * e.preventDefault();\n * addTodo({ variables: { type: input.value } });\n * input.value = '';\n * }}\n * >\n * {\n * input = node;\n * }}\n * />\n * \n * \n *
    \n * );\n * }\n * ```\n * @since 3.0.0\n * @param mutation - A GraphQL mutation document parsed into an AST by `gql`.\n * @param options - Options to control how the mutation is executed.\n * @returns A tuple in the form of `[mutate, result]`\n */\nexport function useMutation(mutation, options) {\n var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);\n verifyDocumentType(mutation, DocumentType.Mutation);\n var _a = React.useState({\n called: false,\n loading: false,\n client: client,\n }), result = _a[0], setResult = _a[1];\n var ref = React.useRef({\n result: result,\n mutationId: 0,\n isMounted: true,\n client: client,\n mutation: mutation,\n options: options,\n });\n // TODO: Trying to assign these in a useEffect or useLayoutEffect breaks\n // higher-order components.\n {\n Object.assign(ref.current, { client: client, options: options, mutation: mutation });\n }\n var execute = React.useCallback(function (executeOptions) {\n if (executeOptions === void 0) { executeOptions = {}; }\n var _a = ref.current, options = _a.options, mutation = _a.mutation;\n var baseOptions = __assign(__assign({}, options), { mutation: mutation });\n var client = executeOptions.client || ref.current.client;\n if (!ref.current.result.loading &&\n !baseOptions.ignoreResults &&\n ref.current.isMounted) {\n setResult((ref.current.result = {\n loading: true,\n error: void 0,\n data: void 0,\n called: true,\n client: client,\n }));\n }\n var mutationId = ++ref.current.mutationId;\n var clientOptions = mergeOptions(baseOptions, executeOptions);\n return client\n .mutate(clientOptions)\n .then(function (response) {\n var _a, _b;\n var data = response.data, errors = response.errors;\n var error = errors && errors.length > 0 ?\n new ApolloError({ graphQLErrors: errors })\n : void 0;\n var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);\n if (error && onError) {\n onError(error, clientOptions);\n }\n if (mutationId === ref.current.mutationId &&\n !clientOptions.ignoreResults) {\n var result_1 = {\n called: true,\n loading: false,\n data: data,\n error: error,\n client: client,\n };\n if (ref.current.isMounted && !equal(ref.current.result, result_1)) {\n setResult((ref.current.result = result_1));\n }\n }\n var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted);\n if (!error) {\n onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions);\n }\n return response;\n })\n .catch(function (error) {\n var _a;\n if (mutationId === ref.current.mutationId && ref.current.isMounted) {\n var result_2 = {\n loading: false,\n error: error,\n data: void 0,\n called: true,\n client: client,\n };\n if (!equal(ref.current.result, result_2)) {\n setResult((ref.current.result = result_2));\n }\n }\n var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);\n if (onError) {\n onError(error, clientOptions);\n // TODO(brian): why are we returning this here???\n return { data: void 0, errors: error };\n }\n throw error;\n });\n }, []);\n var reset = React.useCallback(function () {\n if (ref.current.isMounted) {\n var result_3 = { called: false, loading: false, client: client };\n Object.assign(ref.current, { mutationId: 0, result: result_3 });\n setResult(result_3);\n }\n }, []);\n React.useEffect(function () {\n ref.current.isMounted = true;\n return function () {\n ref.current.isMounted = false;\n };\n }, []);\n return [execute, __assign({ reset: reset }, result)];\n}\n//# sourceMappingURL=useMutation.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n/**\n * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`.\n *\n * @example\n * ```jsx\n * const COMMENTS_SUBSCRIPTION = gql`\n * subscription OnCommentAdded($repoFullName: String!) {\n * commentAdded(repoFullName: $repoFullName) {\n * id\n * content\n * }\n * }\n * `;\n *\n * function DontReadTheComments({ repoFullName }) {\n * const {\n * data: { commentAdded },\n * loading,\n * } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } });\n * return

    New comment: {!loading && commentAdded.content}

    ;\n * }\n * ```\n * @remarks\n * #### Subscriptions and React 18 Automatic Batching\n *\n * With React 18's [automatic batching](https://react.dev/blog/2022/03/29/react-v18#new-feature-automatic-batching), multiple state updates may be grouped into a single re-render for better performance.\n *\n * If your subscription API sends multiple messages at the same time or in very fast succession (within fractions of a millisecond), it is likely that only the last message received in that narrow time frame will result in a re-render.\n *\n * Consider the following component:\n *\n * ```jsx\n * export function Subscriptions() {\n * const { data, error, loading } = useSubscription(query);\n * const [accumulatedData, setAccumulatedData] = useState([]);\n *\n * useEffect(() => {\n * setAccumulatedData((prev) => [...prev, data]);\n * }, [data]);\n *\n * return (\n * <>\n * {loading &&

    Loading...

    }\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * \n * );\n * }\n * ```\n *\n * If your subscription back-end emits two messages with the same timestamp, only the last message received by Apollo Client will be rendered. This is because React 18 will batch these two state updates into a single re-render.\n *\n * Since the component above is using `useEffect` to push `data` into a piece of local state on each `Subscriptions` re-render, the first message will never be added to the `accumulatedData` array since its render was skipped.\n *\n * Instead of using `useEffect` here, we can re-write this component to use the `onData` callback function accepted in `useSubscription`'s `options` object:\n *\n * ```jsx\n * export function Subscriptions() {\n * const [accumulatedData, setAccumulatedData] = useState([]);\n * const { data, error, loading } = useSubscription(\n * query,\n * {\n * onData({ data }) {\n * setAccumulatedData((prev) => [...prev, data])\n * }\n * }\n * );\n *\n * return (\n * <>\n * {loading &&

    Loading...

    }\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * \n * );\n * }\n * ```\n *\n * > ⚠️ **Note:** The `useSubscription` option `onData` is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named `onSubscriptionData`.\n *\n * Now, the first message will be added to the `accumulatedData` array since `onData` is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with `onData` we can guarantee each message received after the component mounts is added to `accumulatedData`.\n *\n * @since 3.0.0\n * @param subscription - A GraphQL subscription document parsed into an AST by `gql`.\n * @param options - Options to control how the subscription is executed.\n * @returns Query result object\n */\nexport function useSubscription(subscription, options) {\n var hasIssuedDeprecationWarningRef = React.useRef(false);\n var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);\n verifyDocumentType(subscription, DocumentType.Subscription);\n var _a = React.useState({\n loading: !(options === null || options === void 0 ? void 0 : options.skip),\n error: void 0,\n data: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n }), result = _a[0], setResult = _a[1];\n if (!hasIssuedDeprecationWarningRef.current) {\n hasIssuedDeprecationWarningRef.current = true;\n if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {\n globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53);\n }\n if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {\n globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55);\n }\n }\n var _b = React.useState(function () {\n if (options === null || options === void 0 ? void 0 : options.skip) {\n return null;\n }\n return client.subscribe({\n query: subscription,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,\n context: options === null || options === void 0 ? void 0 : options.context,\n });\n }), observable = _b[0], setObservable = _b[1];\n var canResetObservableRef = React.useRef(false);\n React.useEffect(function () {\n return function () {\n canResetObservableRef.current = true;\n };\n }, []);\n var ref = React.useRef({ client: client, subscription: subscription, options: options });\n React.useEffect(function () {\n var _a, _b, _c, _d;\n var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe;\n if (typeof shouldResubscribe === \"function\") {\n shouldResubscribe = !!shouldResubscribe(options);\n }\n if (options === null || options === void 0 ? void 0 : options.skip) {\n if (!(options === null || options === void 0 ? void 0 : options.skip) !== !((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.skip) ||\n canResetObservableRef.current) {\n setResult({\n loading: false,\n data: void 0,\n error: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n });\n setObservable(null);\n canResetObservableRef.current = false;\n }\n }\n else if ((shouldResubscribe !== false &&\n (client !== ref.current.client ||\n subscription !== ref.current.subscription ||\n (options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) ||\n !(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) ||\n !equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) ||\n canResetObservableRef.current) {\n setResult({\n loading: true,\n data: void 0,\n error: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n });\n setObservable(client.subscribe({\n query: subscription,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,\n context: options === null || options === void 0 ? void 0 : options.context,\n }));\n canResetObservableRef.current = false;\n }\n Object.assign(ref.current, { client: client, subscription: subscription, options: options });\n }, [client, subscription, options, canResetObservableRef.current]);\n React.useEffect(function () {\n if (!observable) {\n return;\n }\n var subscriptionStopped = false;\n var subscription = observable.subscribe({\n next: function (fetchResult) {\n var _a, _b;\n if (subscriptionStopped) {\n return;\n }\n var result = {\n loading: false,\n // TODO: fetchResult.data can be null but SubscriptionResult.data\n // expects TData | undefined only\n data: fetchResult.data,\n error: void 0,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n };\n setResult(result);\n if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) {\n ref.current.options.onData({\n client: client,\n data: result,\n });\n }\n else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) {\n ref.current.options.onSubscriptionData({\n client: client,\n subscriptionData: result,\n });\n }\n },\n error: function (error) {\n var _a, _b;\n if (!subscriptionStopped) {\n setResult({\n loading: false,\n data: void 0,\n error: error,\n variables: options === null || options === void 0 ? void 0 : options.variables,\n });\n (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);\n }\n },\n complete: function () {\n var _a, _b;\n if (!subscriptionStopped) {\n if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {\n ref.current.options.onComplete();\n }\n else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {\n ref.current.options.onSubscriptionComplete();\n }\n }\n },\n });\n return function () {\n // immediately stop receiving subscription values, but do not unsubscribe\n // until after a short delay in case another useSubscription hook is\n // reusing the same underlying observable and is about to subscribe\n subscriptionStopped = true;\n setTimeout(function () {\n subscription.unsubscribe();\n });\n };\n }, [observable]);\n return result;\n}\n//# sourceMappingURL=useSubscription.js.map","import * as React from \"rehackt\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\n/**\n * Reads the value of a [reactive variable](https://www.apollographql.com/docs/react/local-state/reactive-variables/) and re-renders the containing component whenever that variable's value changes. This enables a reactive variable to trigger changes _without_ relying on the `useQuery` hook.\n *\n * @example\n * ```jsx\n * import { makeVar, useReactiveVar } from \"@apollo/client\";\n * export const cartItemsVar = makeVar([]);\n *\n * export function Cart() {\n * const cartItems = useReactiveVar(cartItemsVar);\n * // ...\n * }\n * ```\n * @since 3.2.0\n * @param rv - A reactive variable.\n * @returns The current value of the reactive variable.\n */\nexport function useReactiveVar(rv) {\n return useSyncExternalStore(React.useCallback(function (update) {\n // By reusing the same onNext function in the nested call to\n // rv.onNextChange(onNext), we can keep using the initial clean-up function\n // returned by rv.onNextChange(function onNext(v){...}), without having to\n // register the new clean-up function (returned by the nested\n // rv.onNextChange(onNext)) with yet another callback.\n return rv.onNextChange(function onNext() {\n update();\n rv.onNextChange(onNext);\n });\n }, [rv]), rv, rv);\n}\n//# sourceMappingURL=useReactiveVar.js.map","import * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\nexport function useDeepMemo(memoFn, deps) {\n var ref = React.useRef();\n if (!ref.current || !equal(ref.current.deps, deps)) {\n ref.current = { value: memoFn(), deps: deps };\n }\n return ref.current.value;\n}\n//# sourceMappingURL=useDeepMemo.js.map","import * as React from \"rehackt\";\nfunction getRenderDispatcher() {\n var _a, _b;\n return (_b = (_a = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentDispatcher) === null || _b === void 0 ? void 0 : _b.current;\n}\nvar RenderDispatcher = null;\n/*\nRelay does this too, so we hope this is safe.\nhttps://github.com/facebook/relay/blob/8651fbca19adbfbb79af7a3bc40834d105fd7747/packages/react-relay/relay-hooks/loadQuery.js#L90-L98\n*/\nexport function useRenderGuard() {\n RenderDispatcher = getRenderDispatcher();\n return React.useCallback(function () {\n return (RenderDispatcher !== null && RenderDispatcher === getRenderDispatcher());\n }, []);\n}\n//# sourceMappingURL=useRenderGuard.js.map","import * as React from \"rehackt\";\nvar INIT = {};\nexport function useLazyRef(getInitialValue) {\n var ref = React.useRef(INIT);\n if (ref.current === INIT) {\n ref.current = getInitialValue();\n }\n return ref;\n}\n//# sourceMappingURL=useLazyRef.js.map","import { wrapPromiseWithState } from \"../../../utilities/index.js\";\nimport * as React from \"rehackt\";\n// Prevent webpack from complaining about our feature detection of the\n// use property of the React namespace, which is expected not\n// to exist when using current stable versions, and that's fine.\nvar useKey = \"use\";\nvar realHook = React[useKey];\n// This is named with two underscores to allow this hook to evade typical rules of\n// hooks (i.e. it can be used conditionally)\nexport var __use = realHook ||\n function __use(promise) {\n var statefulPromise = wrapPromiseWithState(promise);\n switch (statefulPromise.status) {\n case \"pending\":\n throw statefulPromise;\n case \"rejected\":\n throw statefulPromise.reason;\n case \"fulfilled\":\n return statefulPromise.value;\n }\n };\n//# sourceMappingURL=__use.js.map","import { __assign, __rest } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\nimport { mergeDeepArray } from \"../../utilities/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { useDeepMemo, useLazyRef } from \"./internal/index.js\";\nexport function useFragment(options) {\n var cache = useApolloClient(options.client).cache;\n var diffOptions = useDeepMemo(function () {\n var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = __rest(options, [\"fragment\", \"fragmentName\", \"from\", \"optimistic\"]);\n return __assign(__assign({}, rest), { returnPartialData: true, id: typeof from === \"string\" ? from : cache.identify(from), query: cache[\"getFragmentDoc\"](fragment, fragmentName), optimistic: optimistic });\n }, [options]);\n var resultRef = useLazyRef(function () {\n return diffToResult(cache.diff(diffOptions));\n });\n // Used for both getSnapshot and getServerSnapshot\n var getSnapshot = React.useCallback(function () { return resultRef.current; }, []);\n return useSyncExternalStore(React.useCallback(function (forceUpdate) {\n var lastTimeout = 0;\n var unsubscribe = cache.watch(__assign(__assign({}, diffOptions), { immediate: true, callback: function (diff) {\n if (!equal(diff.result, resultRef.current.data)) {\n resultRef.current = diffToResult(diff);\n // If we get another update before we've re-rendered, bail out of\n // the update and try again. This ensures that the relative timing\n // between useQuery and useFragment stays roughly the same as\n // fixed in https://github.com/apollographql/apollo-client/pull/11083\n clearTimeout(lastTimeout);\n lastTimeout = setTimeout(forceUpdate);\n }\n } }));\n return function () {\n unsubscribe();\n clearTimeout(lastTimeout);\n };\n }, [cache, diffOptions]), getSnapshot, getSnapshot);\n}\nfunction diffToResult(diff) {\n var result = {\n data: diff.result,\n complete: !!diff.complete,\n };\n if (diff.missing) {\n result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));\n }\n return result;\n}\n//# sourceMappingURL=useFragment.js.map","export var skipToken = Symbol.for(\"apollo.skipToken\");\n//# sourceMappingURL=constants.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { ApolloError, NetworkStatus } from \"../../core/index.js\";\nimport { isNonEmptyArray } from \"../../utilities/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { __use, useDeepMemo } from \"./internal/index.js\";\nimport { getSuspenseCache } from \"../internal/index.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { skipToken } from \"./constants.js\";\nexport function useSuspenseQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n var client = useApolloClient(options.client);\n var suspenseCache = getSuspenseCache(client);\n var watchQueryOptions = useWatchQueryOptions({\n client: client,\n query: query,\n options: options,\n });\n var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;\n var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;\n var cacheKey = __spreadArray([\n query,\n canonicalStringify(variables)\n ], [].concat(queryKey), true);\n var queryRef = suspenseCache.getQueryRef(cacheKey, function () {\n return client.watchQuery(watchQueryOptions);\n });\n var _b = React.useState([queryRef.key, queryRef.promise]), current = _b[0], setPromise = _b[1];\n // This saves us a re-execution of the render function when a variable changed.\n if (current[0] !== queryRef.key) {\n current[0] = queryRef.key;\n current[1] = queryRef.promise;\n }\n var promise = current[1];\n if (queryRef.didChangeOptions(watchQueryOptions)) {\n current[1] = promise = queryRef.applyOptions(watchQueryOptions);\n }\n React.useEffect(function () {\n var dispose = queryRef.retain();\n var removeListener = queryRef.listen(function (promise) {\n setPromise([queryRef.key, promise]);\n });\n return function () {\n removeListener();\n dispose();\n };\n }, [queryRef]);\n var skipResult = React.useMemo(function () {\n var error = toApolloError(queryRef.result);\n return {\n loading: false,\n data: queryRef.result.data,\n networkStatus: error ? NetworkStatus.error : NetworkStatus.ready,\n error: error,\n };\n }, [queryRef.result]);\n var result = fetchPolicy === \"standby\" ? skipResult : __use(promise);\n var fetchMore = React.useCallback((function (options) {\n var promise = queryRef.fetchMore(options);\n setPromise([queryRef.key, queryRef.promise]);\n return promise;\n }), [queryRef]);\n var refetch = React.useCallback(function (variables) {\n var promise = queryRef.refetch(variables);\n setPromise([queryRef.key, queryRef.promise]);\n return promise;\n }, [queryRef]);\n var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);\n return React.useMemo(function () {\n return {\n client: client,\n data: result.data,\n error: toApolloError(result),\n networkStatus: result.networkStatus,\n fetchMore: fetchMore,\n refetch: refetch,\n subscribeToMore: subscribeToMore,\n };\n }, [client, fetchMore, refetch, result, subscribeToMore]);\n}\nfunction validateOptions(options) {\n var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData;\n verifyDocumentType(query, DocumentType.Query);\n validateFetchPolicy(fetchPolicy);\n validatePartialDataReturn(fetchPolicy, returnPartialData);\n}\nfunction validateFetchPolicy(fetchPolicy) {\n if (fetchPolicy === void 0) { fetchPolicy = \"cache-first\"; }\n var supportedFetchPolicies = [\n \"cache-first\",\n \"network-only\",\n \"no-cache\",\n \"cache-and-network\",\n ];\n invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy);\n}\nfunction validatePartialDataReturn(fetchPolicy, returnPartialData) {\n if (fetchPolicy === \"no-cache\" && returnPartialData) {\n globalThis.__DEV__ !== false && invariant.warn(57);\n }\n}\nexport function toApolloError(result) {\n return isNonEmptyArray(result.errors) ?\n new ApolloError({ graphQLErrors: result.errors })\n : result.error;\n}\nexport function useWatchQueryOptions(_a) {\n var client = _a.client, query = _a.query, options = _a.options;\n return useDeepMemo(function () {\n var _a;\n if (options === skipToken) {\n return { query: query, fetchPolicy: \"standby\" };\n }\n var fetchPolicy = options.fetchPolicy ||\n ((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||\n \"cache-first\";\n var watchQueryOptions = __assign(__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 });\n if (globalThis.__DEV__ !== false) {\n validateOptions(watchQueryOptions);\n }\n // Assign the updated fetch policy after our validation since `standby` is\n // not a supported fetch policy on its own without the use of `skip`.\n if (options.skip) {\n watchQueryOptions.fetchPolicy = \"standby\";\n }\n return watchQueryOptions;\n }, [client, options, query]);\n}\n//# sourceMappingURL=useSuspenseQuery.js.map","import { __spreadArray } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from \"../internal/index.js\";\nimport { useWatchQueryOptions } from \"./useSuspenseQuery.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nexport function useBackgroundQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n var client = useApolloClient(options.client);\n var suspenseCache = getSuspenseCache(client);\n var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });\n var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;\n var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;\n // This ref tracks the first time query execution is enabled to determine\n // whether to return a query ref or `undefined`. When initialized\n // in a skipped state (either via `skip: true` or `skipToken`) we return\n // `undefined` for the `queryRef` until the query has been enabled. Once\n // enabled, a query ref is always returned regardless of whether the query is\n // skipped again later.\n var didFetchResult = React.useRef(fetchPolicy !== \"standby\");\n didFetchResult.current || (didFetchResult.current = fetchPolicy !== \"standby\");\n var cacheKey = __spreadArray([\n query,\n canonicalStringify(variables)\n ], [].concat(queryKey), true);\n var queryRef = suspenseCache.getQueryRef(cacheKey, function () {\n return client.watchQuery(watchQueryOptions);\n });\n var _b = React.useState(wrapQueryRef(queryRef)), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];\n if (unwrapQueryRef(wrappedQueryRef) !== queryRef) {\n setWrappedQueryRef(wrapQueryRef(queryRef));\n }\n if (queryRef.didChangeOptions(watchQueryOptions)) {\n var promise = queryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(wrappedQueryRef, promise);\n }\n var fetchMore = React.useCallback(function (options) {\n var promise = queryRef.fetchMore(options);\n setWrappedQueryRef(wrapQueryRef(queryRef));\n return promise;\n }, [queryRef]);\n var refetch = React.useCallback(function (variables) {\n var promise = queryRef.refetch(variables);\n setWrappedQueryRef(wrapQueryRef(queryRef));\n return promise;\n }, [queryRef]);\n return [\n didFetchResult.current ? wrappedQueryRef : void 0,\n { fetchMore: fetchMore, refetch: refetch },\n ];\n}\n//# sourceMappingURL=useBackgroundQuery.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from \"../internal/index.js\";\nimport { useRenderGuard } from \"./internal/index.js\";\nimport { useWatchQueryOptions } from \"./useSuspenseQuery.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nexport function useLoadableQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n var client = useApolloClient(options.client);\n var suspenseCache = getSuspenseCache(client);\n var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });\n var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;\n var _b = React.useState(null), queryRef = _b[0], setQueryRef = _b[1];\n var internalQueryRef = queryRef && unwrapQueryRef(queryRef);\n if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) {\n var promise = internalQueryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(queryRef, promise);\n }\n var calledDuringRender = useRenderGuard();\n var fetchMore = React.useCallback(function (options) {\n if (!internalQueryRef) {\n throw new Error(\"The query has not been loaded. Please load the query.\");\n }\n var promise = internalQueryRef.fetchMore(options);\n setQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n var refetch = React.useCallback(function (options) {\n if (!internalQueryRef) {\n throw new Error(\"The query has not been loaded. Please load the query.\");\n }\n var promise = internalQueryRef.refetch(options);\n setQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n var loadQuery = React.useCallback(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n invariant(!calledDuringRender(), 50);\n var variables = args[0];\n var cacheKey = __spreadArray([\n query,\n canonicalStringify(variables)\n ], [].concat(queryKey), true);\n var queryRef = suspenseCache.getQueryRef(cacheKey, function () {\n return client.watchQuery(__assign(__assign({}, watchQueryOptions), { variables: variables }));\n });\n setQueryRef(wrapQueryRef(queryRef));\n }, [query, queryKey, suspenseCache, watchQueryOptions, calledDuringRender]);\n var reset = React.useCallback(function () {\n setQueryRef(null);\n }, [queryRef]);\n return [loadQuery, queryRef, { fetchMore: fetchMore, refetch: refetch, reset: reset }];\n}\n//# sourceMappingURL=useLoadableQuery.js.map","import * as React from \"rehackt\";\nimport { getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from \"../internal/index.js\";\n/**\n * A React hook that returns a `refetch` and `fetchMore` function for a given\n * `queryRef`.\n *\n * This is useful to get access to handlers for a `queryRef` that was created by\n * `createQueryPreloader` or when the handlers for a `queryRef` produced in\n * a different component are inaccessible.\n *\n * @example\n * ```tsx\n * const MyComponent({ queryRef }) {\n * const { refetch, fetchMore } = useQueryRefHandlers(queryRef);\n *\n * // ...\n * }\n * ```\n * @since 3.9.0\n * @param queryRef - A `QueryReference` returned from `useBackgroundQuery`, `useLoadableQuery`, or `createQueryPreloader`.\n */\nexport function useQueryRefHandlers(queryRef) {\n var _a = React.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1];\n var _b = React.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];\n var internalQueryRef = unwrapQueryRef(queryRef);\n // To ensure we can support React transitions, this hook needs to manage the\n // queryRef state and apply React's state value immediately to the existing\n // queryRef since this hook doesn't return the queryRef directly\n if (previousQueryRef !== queryRef) {\n setPreviousQueryRef(queryRef);\n setWrappedQueryRef(queryRef);\n }\n else {\n updateWrappedQueryRef(queryRef, getWrappedPromise(wrappedQueryRef));\n }\n var refetch = React.useCallback(function (variables) {\n var promise = internalQueryRef.refetch(variables);\n setWrappedQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n var fetchMore = React.useCallback(function (options) {\n var promise = internalQueryRef.fetchMore(options);\n setWrappedQueryRef(wrapQueryRef(internalQueryRef));\n return promise;\n }, [internalQueryRef]);\n return { refetch: refetch, fetchMore: fetchMore };\n}\n//# sourceMappingURL=useQueryRefHandlers.js.map","import * as React from \"rehackt\";\nimport { getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, } from \"../internal/index.js\";\nimport { __use } from \"./internal/index.js\";\nimport { toApolloError } from \"./useSuspenseQuery.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nexport function useReadQuery(queryRef) {\n var internalQueryRef = React.useMemo(function () { return unwrapQueryRef(queryRef); }, [queryRef]);\n var getPromise = React.useCallback(function () { return getWrappedPromise(queryRef); }, [queryRef]);\n if (internalQueryRef.disposed) {\n internalQueryRef.reinitialize();\n updateWrappedQueryRef(queryRef, internalQueryRef.promise);\n }\n React.useEffect(function () { return internalQueryRef.retain(); }, [internalQueryRef]);\n var promise = useSyncExternalStore(React.useCallback(function (forceUpdate) {\n return internalQueryRef.listen(function (promise) {\n updateWrappedQueryRef(queryRef, promise);\n forceUpdate();\n });\n }, [internalQueryRef]), getPromise, getPromise);\n var result = __use(promise);\n return React.useMemo(function () {\n return {\n data: result.data,\n networkStatus: result.networkStatus,\n error: toApolloError(result),\n };\n }, [result]);\n}\n//# sourceMappingURL=useReadQuery.js.map"],"names":["context","React","getApolloContext","invariant","realHook","canUseLayoutEffect","maybeDeepFreeze","NetworkStatus","canUseWeakMap","verifyDocumentType","DocumentType","equal","compact","mergeOptions","__rest","isNonEmptyArray","ApolloError","__assign","errors","wrapPromiseWithState","mergeDeepArray","getSuspenseCache","__spreadArray","canonicalStringify","wrapQueryRef","unwrapQueryRef","updateWrappedQueryRef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AAM,EAAE,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAC3F,IAAI,IAAI,OAAO,GAAG,oBAAoB,CAACA,gBAAK,CAAC,WAAW,CAAC,UAAU,WAAW,EAAE;AAChF,QAAQ,OAAO,gBAAgB,CAAC,MAAM,CAAC,UAAU,OAAO,EAAE;AAC1D,YAAYyB,8BAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACrD,YAAY,WAAW,EAAE,CAAC;AAC1B,SAAS,CAAC,CAAC;AACX,KAAK,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACpD,IAAI,IAAI,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAChC,IAAI,OAAOzB,gBAAK,CAAC,OAAO,CAAC,YAAY;AACrC,QAAQ,OAAO;AACf,YAAY,IAAI,EAAE,MAAM,CAAC,IAAI;AAC7B,YAAY,aAAa,EAAE,MAAM,CAAC,aAAa;AAC/C,YAAY,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC;AACxC,SAAS,CAAC;AACV,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACjB;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.native.js new file mode 100644 index 0000000..d8d7304 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/hooks.cjs.native.js @@ -0,0 +1,1045 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var React = require('rehackt'); +var context = require('../context'); +var tslib = require('tslib'); +var utilities = require('../../utilities'); +var equality = require('@wry/equality'); +var errors = require('../../errors'); +var core = require('../../core'); +var parser = require('../parser'); +var internal = require('../internal'); +var cache = require('../../cache'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +function useApolloClient(override) { + var context$1 = React__namespace.useContext(context.getApolloContext()); + var client = override || context$1.client; + globals.invariant(!!client, 49); + return client; +} + +var didWarnUncachedGetSnapshot = false; +var uSESKey = "useSyncExternalStore"; +var realHook$1 = React__namespace[uSESKey]; +var useSyncExternalStore = realHook$1 || + (function (subscribe, getSnapshot, getServerSnapshot) { + var value = getSnapshot(); + if ( + globalThis.__DEV__ !== false && + !didWarnUncachedGetSnapshot && + value !== getSnapshot()) { + didWarnUncachedGetSnapshot = true; + globalThis.__DEV__ !== false && globals.invariant.error(58); + } + var _a = React__namespace.useState({ + inst: { value: value, getSnapshot: getSnapshot }, + }), inst = _a[0].inst, forceUpdate = _a[1]; + if (utilities.canUseLayoutEffect) { + React__namespace.useLayoutEffect(function () { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + }, [subscribe, value, getSnapshot]); + } + else { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + } + React__namespace.useEffect(function () { + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + return subscribe(function handleStoreChange() { + if (checkIfSnapshotChanged(inst)) { + forceUpdate({ inst: inst }); + } + }); + }, [subscribe]); + return value; + }); +function checkIfSnapshotChanged(_a) { + var value = _a.value, getSnapshot = _a.getSnapshot; + try { + return value !== getSnapshot(); + } + catch (_b) { + return true; + } +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function useQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + return useInternalState(useApolloClient(options.client), query).useQuery(options); +} +function useInternalState(client, query) { + var stateRef = React__namespace.useRef(); + if (!stateRef.current || + client !== stateRef.current.client || + query !== stateRef.current.query) { + stateRef.current = new InternalState(client, query, stateRef.current); + } + var state = stateRef.current; + state.forceUpdateState = React__namespace.useReducer(function (tick) { return tick + 1; }, 0)[1]; + return state; +} +var InternalState = (function () { + function InternalState(client, query, previous) { + var _this = this; + this.client = client; + this.query = query; + this.forceUpdate = function () { return _this.forceUpdateState(); }; + this.ssrDisabledResult = utilities.maybeDeepFreeze({ + loading: true, + data: void 0, + error: void 0, + networkStatus: core.NetworkStatus.loading, + }); + this.skipStandbyResult = utilities.maybeDeepFreeze({ + loading: false, + data: void 0, + error: void 0, + networkStatus: core.NetworkStatus.ready, + }); + this.toQueryResultCache = new (utilities.canUseWeakMap ? WeakMap : Map)(); + parser.verifyDocumentType(query, parser.DocumentType.Query); + var previousResult = previous && previous.result; + var previousData = previousResult && previousResult.data; + if (previousData) { + this.previousData = previousData; + } + } + InternalState.prototype.forceUpdateState = function () { + globalThis.__DEV__ !== false && globals.invariant.warn(51); + }; + InternalState.prototype.executeQuery = function (options) { + var _this = this; + var _a; + if (options.query) { + Object.assign(this, { query: options.query }); + } + this.watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + var concast = this.observable.reobserveAsConcast(this.getObsQueryOptions()); + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + this.forceUpdate(); + return new Promise(function (resolve) { + var result; + concast.subscribe({ + next: function (value) { + result = value; + }, + error: function () { + resolve(_this.toQueryResult(_this.observable.getCurrentResult())); + }, + complete: function () { + resolve(_this.toQueryResult(result)); + }, + }); + }); + }; + InternalState.prototype.useQuery = function (options) { + var _this = this; + this.renderPromises = React__namespace.useContext(context.getApolloContext()).renderPromises; + this.useOptions(options); + var obsQuery = this.useObservableQuery(); + var result = useSyncExternalStore(React__namespace.useCallback(function (handleStoreChange) { + if (_this.renderPromises) { + return function () { }; + } + _this.forceUpdate = handleStoreChange; + var onNext = function () { + var previousResult = _this.result; + var result = obsQuery.getCurrentResult(); + if (previousResult && + previousResult.loading === result.loading && + previousResult.networkStatus === result.networkStatus && + equality.equal(previousResult.data, result.data)) { + return; + } + _this.setResult(result); + }; + var onError = function (error) { + subscription.unsubscribe(); + subscription = obsQuery.resubscribeAfterError(onNext, onError); + if (!hasOwnProperty.call(error, "graphQLErrors")) { + throw error; + } + var previousResult = _this.result; + if (!previousResult || + (previousResult && previousResult.loading) || + !equality.equal(error, previousResult.error)) { + _this.setResult({ + data: (previousResult && previousResult.data), + error: error, + loading: false, + networkStatus: core.NetworkStatus.error, + }); + } + }; + var subscription = obsQuery.subscribe(onNext, onError); + return function () { + setTimeout(function () { return subscription.unsubscribe(); }); + _this.forceUpdate = function () { return _this.forceUpdateState(); }; + }; + }, [ + obsQuery, + this.renderPromises, + this.client.disableNetworkFetches, + ]), function () { return _this.getCurrentResult(); }, function () { return _this.getCurrentResult(); }); + this.unsafeHandlePartialRefetch(result); + return this.toQueryResult(result); + }; + InternalState.prototype.useOptions = function (options) { + var _a; + var watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + var currentWatchQueryOptions = this.watchQueryOptions; + if (!equality.equal(watchQueryOptions, currentWatchQueryOptions)) { + this.watchQueryOptions = watchQueryOptions; + if (currentWatchQueryOptions && this.observable) { + this.observable.reobserve(this.getObsQueryOptions()); + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + } + } + this.onCompleted = + options.onCompleted || InternalState.prototype.onCompleted; + this.onError = options.onError || InternalState.prototype.onError; + if ((this.renderPromises || this.client.disableNetworkFetches) && + this.queryHookOptions.ssr === false && + !this.queryHookOptions.skip) { + this.result = this.ssrDisabledResult; + } + else if (this.queryHookOptions.skip || + this.watchQueryOptions.fetchPolicy === "standby") { + this.result = this.skipStandbyResult; + } + else if (this.result === this.ssrDisabledResult || + this.result === this.skipStandbyResult) { + this.result = void 0; + } + }; + InternalState.prototype.getObsQueryOptions = function () { + var toMerge = []; + var globalDefaults = this.client.defaultOptions.watchQuery; + if (globalDefaults) + toMerge.push(globalDefaults); + if (this.queryHookOptions.defaultOptions) { + toMerge.push(this.queryHookOptions.defaultOptions); + } + toMerge.push(utilities.compact(this.observable && this.observable.options, this.watchQueryOptions)); + return toMerge.reduce(utilities.mergeOptions); + }; + InternalState.prototype.createWatchQueryOptions = function (_a) { + var _b; + if (_a === void 0) { _a = {}; } + var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions; + var otherOptions = tslib.__rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]); + var watchQueryOptions = Object.assign(otherOptions, { query: this.query }); + if (this.renderPromises && + (watchQueryOptions.fetchPolicy === "network-only" || + watchQueryOptions.fetchPolicy === "cache-and-network")) { + watchQueryOptions.fetchPolicy = "cache-first"; + } + if (!watchQueryOptions.variables) { + watchQueryOptions.variables = {}; + } + if (skip) { + var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d; + Object.assign(watchQueryOptions, { + initialFetchPolicy: initialFetchPolicy, + fetchPolicy: "standby", + }); + } + else if (!watchQueryOptions.fetchPolicy) { + watchQueryOptions.fetchPolicy = + ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) || + this.getDefaultFetchPolicy(); + } + return watchQueryOptions; + }; + InternalState.prototype.getDefaultFetchPolicy = function () { + var _a, _b; + return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + "cache-first"); + }; + InternalState.prototype.onCompleted = function (data) { }; + InternalState.prototype.onError = function (error) { }; + InternalState.prototype.useObservableQuery = function () { + var obsQuery = (this.observable = + (this.renderPromises && + this.renderPromises.getSSRObservable(this.watchQueryOptions)) || + this.observable || + this.client.watchQuery(this.getObsQueryOptions())); + this.obsQueryFields = React__namespace.useMemo(function () { return ({ + refetch: obsQuery.refetch.bind(obsQuery), + reobserve: obsQuery.reobserve.bind(obsQuery), + fetchMore: obsQuery.fetchMore.bind(obsQuery), + updateQuery: obsQuery.updateQuery.bind(obsQuery), + startPolling: obsQuery.startPolling.bind(obsQuery), + stopPolling: obsQuery.stopPolling.bind(obsQuery), + subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery), + }); }, [obsQuery]); + var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip); + if (this.renderPromises && ssrAllowed) { + this.renderPromises.registerSSRObservable(obsQuery); + if (obsQuery.getCurrentResult().loading) { + this.renderPromises.addObservableQueryPromise(obsQuery); + } + } + return obsQuery; + }; + InternalState.prototype.setResult = function (nextResult) { + var previousResult = this.result; + if (previousResult && previousResult.data) { + this.previousData = previousResult.data; + } + this.result = nextResult; + this.forceUpdate(); + this.handleErrorOrCompleted(nextResult, previousResult); + }; + InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) { + var _this = this; + if (!result.loading) { + var error_1 = this.toApolloError(result); + Promise.resolve() + .then(function () { + if (error_1) { + _this.onError(error_1); + } + else if (result.data && + (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus && + result.networkStatus === core.NetworkStatus.ready) { + _this.onCompleted(result.data); + } + }) + .catch(function (error) { + globalThis.__DEV__ !== false && globals.invariant.warn(error); + }); + } + }; + InternalState.prototype.toApolloError = function (result) { + return utilities.isNonEmptyArray(result.errors) ? + new errors.ApolloError({ graphQLErrors: result.errors }) + : result.error; + }; + InternalState.prototype.getCurrentResult = function () { + if (!this.result) { + this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult())); + } + return this.result; + }; + InternalState.prototype.toQueryResult = function (result) { + var queryResult = this.toQueryResultCache.get(result); + if (queryResult) + return queryResult; + var data = result.data; result.partial; var resultWithoutPartial = tslib.__rest(result, ["data", "partial"]); + this.toQueryResultCache.set(result, (queryResult = tslib.__assign(tslib.__assign(tslib.__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData }))); + if (!queryResult.error && utilities.isNonEmptyArray(result.errors)) { + queryResult.error = new errors.ApolloError({ graphQLErrors: result.errors }); + } + return queryResult; + }; + InternalState.prototype.unsafeHandlePartialRefetch = function (result) { + if (result.partial && + this.queryHookOptions.partialRefetch && + !result.loading && + (!result.data || Object.keys(result.data).length === 0) && + this.observable.options.fetchPolicy !== "cache-only") { + Object.assign(result, { + loading: true, + networkStatus: core.NetworkStatus.refetch, + }); + this.observable.refetch(); + } + }; + return InternalState; +}()); + +var EAGER_METHODS = [ + "refetch", + "reobserve", + "fetchMore", + "updateQuery", + "startPolling", + "subscribeToMore", +]; +function useLazyQuery(query, options) { + var _a; + var execOptionsRef = React__namespace.useRef(); + var optionsRef = React__namespace.useRef(); + var queryRef = React__namespace.useRef(); + var merged = utilities.mergeOptions(options, execOptionsRef.current || {}); + var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query; + optionsRef.current = options; + queryRef.current = document; + var internalState = useInternalState(useApolloClient(options && options.client), document); + var useQueryResult = internalState.useQuery(tslib.__assign(tslib.__assign({}, merged), { skip: !execOptionsRef.current })); + var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy || + internalState.getDefaultFetchPolicy(); + var result = Object.assign(useQueryResult, { + called: !!execOptionsRef.current, + }); + var eagerMethods = React__namespace.useMemo(function () { + var eagerMethods = {}; + var _loop_1 = function (key) { + var method = result[key]; + eagerMethods[key] = function () { + if (!execOptionsRef.current) { + execOptionsRef.current = Object.create(null); + internalState.forceUpdateState(); + } + return method.apply(this, arguments); + }; + }; + for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) { + var key = EAGER_METHODS_1[_i]; + _loop_1(key); + } + return eagerMethods; + }, []); + Object.assign(result, eagerMethods); + var execute = React__namespace.useCallback(function (executeOptions) { + execOptionsRef.current = + executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : { + fetchPolicy: initialFetchPolicy, + }; + var options = utilities.mergeOptions(optionsRef.current, tslib.__assign({ query: queryRef.current }, execOptionsRef.current)); + var promise = internalState + .executeQuery(tslib.__assign(tslib.__assign({}, options), { skip: false })) + .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); }); + promise.catch(function () { }); + return promise; + }, []); + return [execute, result]; +} + +function useMutation(mutation, options) { + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + parser.verifyDocumentType(mutation, parser.DocumentType.Mutation); + var _a = React__namespace.useState({ + called: false, + loading: false, + client: client, + }), result = _a[0], setResult = _a[1]; + var ref = React__namespace.useRef({ + result: result, + mutationId: 0, + isMounted: true, + client: client, + mutation: mutation, + options: options, + }); + { + Object.assign(ref.current, { client: client, options: options, mutation: mutation }); + } + var execute = React__namespace.useCallback(function (executeOptions) { + if (executeOptions === void 0) { executeOptions = {}; } + var _a = ref.current, options = _a.options, mutation = _a.mutation; + var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation }); + var client = executeOptions.client || ref.current.client; + if (!ref.current.result.loading && + !baseOptions.ignoreResults && + ref.current.isMounted) { + setResult((ref.current.result = { + loading: true, + error: void 0, + data: void 0, + called: true, + client: client, + })); + } + var mutationId = ++ref.current.mutationId; + var clientOptions = utilities.mergeOptions(baseOptions, executeOptions); + return client + .mutate(clientOptions) + .then(function (response) { + var _a, _b; + var data = response.data, errors$1 = response.errors; + var error = errors$1 && errors$1.length > 0 ? + new errors.ApolloError({ graphQLErrors: errors$1 }) + : void 0; + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (error && onError) { + onError(error, clientOptions); + } + if (mutationId === ref.current.mutationId && + !clientOptions.ignoreResults) { + var result_1 = { + called: true, + loading: false, + data: data, + error: error, + client: client, + }; + if (ref.current.isMounted && !equality.equal(ref.current.result, result_1)) { + setResult((ref.current.result = result_1)); + } + } + var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted); + if (!error) { + onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions); + } + return response; + }) + .catch(function (error) { + var _a; + if (mutationId === ref.current.mutationId && ref.current.isMounted) { + var result_2 = { + loading: false, + error: error, + data: void 0, + called: true, + client: client, + }; + if (!equality.equal(ref.current.result, result_2)) { + setResult((ref.current.result = result_2)); + } + } + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (onError) { + onError(error, clientOptions); + return { data: void 0, errors: error }; + } + throw error; + }); + }, []); + var reset = React__namespace.useCallback(function () { + if (ref.current.isMounted) { + var result_3 = { called: false, loading: false, client: client }; + Object.assign(ref.current, { mutationId: 0, result: result_3 }); + setResult(result_3); + } + }, []); + React__namespace.useEffect(function () { + ref.current.isMounted = true; + return function () { + ref.current.isMounted = false; + }; + }, []); + return [execute, tslib.__assign({ reset: reset }, result)]; +} + +function useSubscription(subscription, options) { + var hasIssuedDeprecationWarningRef = React__namespace.useRef(false); + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + parser.verifyDocumentType(subscription, parser.DocumentType.Subscription); + var _a = React__namespace.useState({ + loading: !(options === null || options === void 0 ? void 0 : options.skip), + error: void 0, + data: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }), result = _a[0], setResult = _a[1]; + if (!hasIssuedDeprecationWarningRef.current) { + hasIssuedDeprecationWarningRef.current = true; + if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) { + globalThis.__DEV__ !== false && globals.invariant.warn(options.onData ? 52 : 53); + } + if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) { + globalThis.__DEV__ !== false && globals.invariant.warn(options.onComplete ? 54 : 55); + } + } + var _b = React__namespace.useState(function () { + if (options === null || options === void 0 ? void 0 : options.skip) { + return null; + } + return client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + }); + }), observable = _b[0], setObservable = _b[1]; + var canResetObservableRef = React__namespace.useRef(false); + React__namespace.useEffect(function () { + return function () { + canResetObservableRef.current = true; + }; + }, []); + var ref = React__namespace.useRef({ client: client, subscription: subscription, options: options }); + React__namespace.useEffect(function () { + var _a, _b, _c, _d; + var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe; + if (typeof shouldResubscribe === "function") { + shouldResubscribe = !!shouldResubscribe(options); + } + if (options === null || options === void 0 ? void 0 : options.skip) { + if (!(options === null || options === void 0 ? void 0 : options.skip) !== !((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.skip) || + canResetObservableRef.current) { + setResult({ + loading: false, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(null); + canResetObservableRef.current = false; + } + } + else if ((shouldResubscribe !== false && + (client !== ref.current.client || + subscription !== ref.current.subscription || + (options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + !(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) || + !equality.equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) || + canResetObservableRef.current) { + setResult({ + loading: true, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + })); + canResetObservableRef.current = false; + } + Object.assign(ref.current, { client: client, subscription: subscription, options: options }); + }, [client, subscription, options, canResetObservableRef.current]); + React__namespace.useEffect(function () { + if (!observable) { + return; + } + var subscriptionStopped = false; + var subscription = observable.subscribe({ + next: function (fetchResult) { + var _a, _b; + if (subscriptionStopped) { + return; + } + var result = { + loading: false, + data: fetchResult.data, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }; + setResult(result); + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) { + ref.current.options.onData({ + client: client, + data: result, + }); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) { + ref.current.options.onSubscriptionData({ + client: client, + subscriptionData: result, + }); + } + }, + error: function (error) { + var _a, _b; + if (!subscriptionStopped) { + setResult({ + loading: false, + data: void 0, + error: error, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error); + } + }, + complete: function () { + var _a, _b; + if (!subscriptionStopped) { + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) { + ref.current.options.onComplete(); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) { + ref.current.options.onSubscriptionComplete(); + } + } + }, + }); + return function () { + subscriptionStopped = true; + setTimeout(function () { + subscription.unsubscribe(); + }); + }; + }, [observable]); + return result; +} + +function useReactiveVar(rv) { + return useSyncExternalStore(React__namespace.useCallback(function (update) { + return rv.onNextChange(function onNext() { + update(); + rv.onNextChange(onNext); + }); + }, [rv]), rv, rv); +} + +function useDeepMemo(memoFn, deps) { + var ref = React__namespace.useRef(); + if (!ref.current || !equality.equal(ref.current.deps, deps)) { + ref.current = { value: memoFn(), deps: deps }; + } + return ref.current.value; +} + +function getRenderDispatcher() { + var _a, _b; + return (_b = (_a = React__namespace.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentDispatcher) === null || _b === void 0 ? void 0 : _b.current; +} +var RenderDispatcher = null; +function useRenderGuard() { + RenderDispatcher = getRenderDispatcher(); + return React__namespace.useCallback(function () { + return (RenderDispatcher !== null && RenderDispatcher === getRenderDispatcher()); + }, []); +} + +var INIT = {}; +function useLazyRef(getInitialValue) { + var ref = React__namespace.useRef(INIT); + if (ref.current === INIT) { + ref.current = getInitialValue(); + } + return ref; +} + +var useKey = "use"; +var realHook = React__namespace[useKey]; +var __use = realHook || + function __use(promise) { + var statefulPromise = utilities.wrapPromiseWithState(promise); + switch (statefulPromise.status) { + case "pending": + throw statefulPromise; + case "rejected": + throw statefulPromise.reason; + case "fulfilled": + return statefulPromise.value; + } + }; + +function useFragment(options) { + var cache = useApolloClient(options.client).cache; + var diffOptions = useDeepMemo(function () { + var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]); + return tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic }); + }, [options]); + var resultRef = useLazyRef(function () { + return diffToResult(cache.diff(diffOptions)); + }); + var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []); + return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) { + var lastTimeout = 0; + var unsubscribe = cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) { + if (!equality.equal(diff.result, resultRef.current.data)) { + resultRef.current = diffToResult(diff); + clearTimeout(lastTimeout); + lastTimeout = setTimeout(forceUpdate); + } + } })); + return function () { + unsubscribe(); + clearTimeout(lastTimeout); + }; + }, [cache, diffOptions]), getSnapshot, getSnapshot); +} +function diffToResult(diff) { + var result = { + data: diff.result, + complete: !!diff.complete, + }; + if (diff.missing) { + result.missing = utilities.mergeDeepArray(diff.missing.map(function (error) { return error.missing; })); + } + return result; +} + +var skipToken = Symbol.for("apollo.skipToken"); + +function useSuspenseQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = internal.getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ + client: client, + query: query, + options: options, + }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var cacheKey = tslib.__spreadArray([ + query, + cache.canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React__namespace.useState([queryRef.key, queryRef.promise]), current = _b[0], setPromise = _b[1]; + if (current[0] !== queryRef.key) { + current[0] = queryRef.key; + current[1] = queryRef.promise; + } + var promise = current[1]; + if (queryRef.didChangeOptions(watchQueryOptions)) { + current[1] = promise = queryRef.applyOptions(watchQueryOptions); + } + React__namespace.useEffect(function () { + var dispose = queryRef.retain(); + var removeListener = queryRef.listen(function (promise) { + setPromise([queryRef.key, promise]); + }); + return function () { + removeListener(); + dispose(); + }; + }, [queryRef]); + var skipResult = React__namespace.useMemo(function () { + var error = toApolloError(queryRef.result); + return { + loading: false, + data: queryRef.result.data, + networkStatus: error ? core.NetworkStatus.error : core.NetworkStatus.ready, + error: error, + }; + }, [queryRef.result]); + var result = fetchPolicy === "standby" ? skipResult : __use(promise); + var fetchMore = React__namespace.useCallback((function (options) { + var promise = queryRef.fetchMore(options); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }), [queryRef]); + var refetch = React__namespace.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }, [queryRef]); + var subscribeToMore = React__namespace.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]); + return React__namespace.useMemo(function () { + return { + client: client, + data: result.data, + error: toApolloError(result), + networkStatus: result.networkStatus, + fetchMore: fetchMore, + refetch: refetch, + subscribeToMore: subscribeToMore, + }; + }, [client, fetchMore, refetch, result, subscribeToMore]); +} +function validateOptions(options) { + var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData; + parser.verifyDocumentType(query, parser.DocumentType.Query); + validateFetchPolicy(fetchPolicy); + validatePartialDataReturn(fetchPolicy, returnPartialData); +} +function validateFetchPolicy(fetchPolicy) { + if (fetchPolicy === void 0) { fetchPolicy = "cache-first"; } + var supportedFetchPolicies = [ + "cache-first", + "network-only", + "no-cache", + "cache-and-network", + ]; + globals.invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy); +} +function validatePartialDataReturn(fetchPolicy, returnPartialData) { + if (fetchPolicy === "no-cache" && returnPartialData) { + globalThis.__DEV__ !== false && globals.invariant.warn(57); + } +} +function toApolloError(result) { + return utilities.isNonEmptyArray(result.errors) ? + new core.ApolloError({ graphQLErrors: result.errors }) + : result.error; +} +function useWatchQueryOptions(_a) { + var client = _a.client, query = _a.query, options = _a.options; + return useDeepMemo(function () { + var _a; + if (options === skipToken) { + return { query: query, fetchPolicy: "standby" }; + } + var fetchPolicy = options.fetchPolicy || + ((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + "cache-first"; + var watchQueryOptions = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 }); + if (globalThis.__DEV__ !== false) { + validateOptions(watchQueryOptions); + } + if (options.skip) { + watchQueryOptions.fetchPolicy = "standby"; + } + return watchQueryOptions; + }, [client, options, query]); +} + +function useBackgroundQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = internal.getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var didFetchResult = React__namespace.useRef(fetchPolicy !== "standby"); + didFetchResult.current || (didFetchResult.current = fetchPolicy !== "standby"); + var cacheKey = tslib.__spreadArray([ + query, + cache.canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React__namespace.useState(internal.wrapQueryRef(queryRef)), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + if (internal.unwrapQueryRef(wrappedQueryRef) !== queryRef) { + setWrappedQueryRef(internal.wrapQueryRef(queryRef)); + } + if (queryRef.didChangeOptions(watchQueryOptions)) { + var promise = queryRef.applyOptions(watchQueryOptions); + internal.updateWrappedQueryRef(wrappedQueryRef, promise); + } + var fetchMore = React__namespace.useCallback(function (options) { + var promise = queryRef.fetchMore(options); + setWrappedQueryRef(internal.wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + var refetch = React__namespace.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setWrappedQueryRef(internal.wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + return [ + didFetchResult.current ? wrappedQueryRef : void 0, + { fetchMore: fetchMore, refetch: refetch }, + ]; +} + +function useLoadableQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = internal.getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var _b = React__namespace.useState(null), queryRef = _b[0], setQueryRef = _b[1]; + var internalQueryRef = queryRef && internal.unwrapQueryRef(queryRef); + if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) { + var promise = internalQueryRef.applyOptions(watchQueryOptions); + internal.updateWrappedQueryRef(queryRef, promise); + } + var calledDuringRender = useRenderGuard(); + var fetchMore = React__namespace.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.fetchMore(options); + setQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var refetch = React__namespace.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.refetch(options); + setQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var loadQuery = React__namespace.useCallback(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + globals.invariant(!calledDuringRender(), 50); + var variables = args[0]; + var cacheKey = tslib.__spreadArray([ + query, + cache.canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(tslib.__assign(tslib.__assign({}, watchQueryOptions), { variables: variables })); + }); + setQueryRef(internal.wrapQueryRef(queryRef)); + }, [query, queryKey, suspenseCache, watchQueryOptions, calledDuringRender]); + var reset = React__namespace.useCallback(function () { + setQueryRef(null); + }, [queryRef]); + return [loadQuery, queryRef, { fetchMore: fetchMore, refetch: refetch, reset: reset }]; +} + +function useQueryRefHandlers(queryRef) { + var _a = React__namespace.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1]; + var _b = React__namespace.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + var internalQueryRef = internal.unwrapQueryRef(queryRef); + if (previousQueryRef !== queryRef) { + setPreviousQueryRef(queryRef); + setWrappedQueryRef(queryRef); + } + else { + internal.updateWrappedQueryRef(queryRef, internal.getWrappedPromise(wrappedQueryRef)); + } + var refetch = React__namespace.useCallback(function (variables) { + var promise = internalQueryRef.refetch(variables); + setWrappedQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var fetchMore = React__namespace.useCallback(function (options) { + var promise = internalQueryRef.fetchMore(options); + setWrappedQueryRef(internal.wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + return { refetch: refetch, fetchMore: fetchMore }; +} + +function useReadQuery(queryRef) { + var internalQueryRef = React__namespace.useMemo(function () { return internal.unwrapQueryRef(queryRef); }, [queryRef]); + var getPromise = React__namespace.useCallback(function () { return internal.getWrappedPromise(queryRef); }, [queryRef]); + if (internalQueryRef.disposed) { + internalQueryRef.reinitialize(); + internal.updateWrappedQueryRef(queryRef, internalQueryRef.promise); + } + React__namespace.useEffect(function () { return internalQueryRef.retain(); }, [internalQueryRef]); + var promise = useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) { + return internalQueryRef.listen(function (promise) { + internal.updateWrappedQueryRef(queryRef, promise); + forceUpdate(); + }); + }, [internalQueryRef]), getPromise, getPromise); + var result = __use(promise); + return React__namespace.useMemo(function () { + return { + data: result.data, + networkStatus: result.networkStatus, + error: toApolloError(result), + }; + }, [result]); +} + +exports.skipToken = skipToken; +exports.useApolloClient = useApolloClient; +exports.useBackgroundQuery = useBackgroundQuery; +exports.useFragment = useFragment; +exports.useLazyQuery = useLazyQuery; +exports.useLoadableQuery = useLoadableQuery; +exports.useMutation = useMutation; +exports.useQuery = useQuery; +exports.useQueryRefHandlers = useQueryRefHandlers; +exports.useReactiveVar = useReactiveVar; +exports.useReadQuery = useReadQuery; +exports.useSubscription = useSubscription; +exports.useSuspenseQuery = useSuspenseQuery; +//# sourceMappingURL=hooks.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/index.d.ts new file mode 100644 index 0000000..2e33734 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/index.d.ts @@ -0,0 +1,21 @@ +import "../../utilities/globals/index.js"; +export * from "./useApolloClient.js"; +export * from "./useLazyQuery.js"; +export * from "./useMutation.js"; +export { useQuery } from "./useQuery.js"; +export * from "./useSubscription.js"; +export * from "./useReactiveVar.js"; +export * from "./useFragment.js"; +export type { UseSuspenseQueryResult } from "./useSuspenseQuery.js"; +export { useSuspenseQuery } from "./useSuspenseQuery.js"; +export type { UseBackgroundQueryResult } from "./useBackgroundQuery.js"; +export { useBackgroundQuery } from "./useBackgroundQuery.js"; +export type { LoadQueryFunction, UseLoadableQueryResult, } from "./useLoadableQuery.js"; +export { useLoadableQuery } from "./useLoadableQuery.js"; +export type { UseQueryRefHandlersResult } from "./useQueryRefHandlers.js"; +export { useQueryRefHandlers } from "./useQueryRefHandlers.js"; +export type { UseReadQueryResult } from "./useReadQuery.js"; +export { useReadQuery } from "./useReadQuery.js"; +export { skipToken } from "./constants.js"; +export type { SkipToken } from "./constants.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/index.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/index.js new file mode 100644 index 0000000..808a3f1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/index.js @@ -0,0 +1,15 @@ +import "../../utilities/globals/index.js"; +export * from "./useApolloClient.js"; +export * from "./useLazyQuery.js"; +export * from "./useMutation.js"; +export { useQuery } from "./useQuery.js"; +export * from "./useSubscription.js"; +export * from "./useReactiveVar.js"; +export * from "./useFragment.js"; +export { useSuspenseQuery } from "./useSuspenseQuery.js"; +export { useBackgroundQuery } from "./useBackgroundQuery.js"; +export { useLoadableQuery } from "./useLoadableQuery.js"; +export { useQueryRefHandlers } from "./useQueryRefHandlers.js"; +export { useReadQuery } from "./useReadQuery.js"; +export { skipToken } from "./constants.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/index.js.map new file mode 100644 index 0000000..e2e7dfb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAK7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport * from \"./useApolloClient.js\";\nexport * from \"./useLazyQuery.js\";\nexport * from \"./useMutation.js\";\nexport { useQuery } from \"./useQuery.js\";\nexport * from \"./useSubscription.js\";\nexport * from \"./useReactiveVar.js\";\nexport * from \"./useFragment.js\";\nexport type { UseSuspenseQueryResult } from \"./useSuspenseQuery.js\";\nexport { useSuspenseQuery } from \"./useSuspenseQuery.js\";\nexport type { UseBackgroundQueryResult } from \"./useBackgroundQuery.js\";\nexport { useBackgroundQuery } from \"./useBackgroundQuery.js\";\nexport type {\n LoadQueryFunction,\n UseLoadableQueryResult,\n} from \"./useLoadableQuery.js\";\nexport { useLoadableQuery } from \"./useLoadableQuery.js\";\nexport type { UseQueryRefHandlersResult } from \"./useQueryRefHandlers.js\";\nexport { useQueryRefHandlers } from \"./useQueryRefHandlers.js\";\nexport type { UseReadQueryResult } from \"./useReadQuery.js\";\nexport { useReadQuery } from \"./useReadQuery.js\";\nexport { skipToken } from \"./constants.js\";\nexport type { SkipToken } from \"./constants.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.d.ts new file mode 100644 index 0000000..1a5577c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.d.ts @@ -0,0 +1,4 @@ +type Use = (promise: Promise) => T; +export declare const __use: Use; +export {}; +//# sourceMappingURL=__use.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js new file mode 100644 index 0000000..78c8f5a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js @@ -0,0 +1,22 @@ +import { wrapPromiseWithState } from "../../../utilities/index.js"; +import * as React from "rehackt"; +// Prevent webpack from complaining about our feature detection of the +// use property of the React namespace, which is expected not +// to exist when using current stable versions, and that's fine. +var useKey = "use"; +var realHook = React[useKey]; +// This is named with two underscores to allow this hook to evade typical rules of +// hooks (i.e. it can be used conditionally) +export var __use = realHook || + function __use(promise) { + var statefulPromise = wrapPromiseWithState(promise); + switch (statefulPromise.status) { + case "pending": + throw statefulPromise; + case "rejected": + throw statefulPromise.reason; + case "fulfilled": + return statefulPromise.value; + } + }; +//# sourceMappingURL=__use.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js.map new file mode 100644 index 0000000..b86ca16 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/__use.js.map @@ -0,0 +1 @@ +{"version":3,"file":"__use.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/__use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,sEAAsE;AACtE,6DAA6D;AAC7D,gEAAgE;AAChE,IAAM,MAAM,GAAG,KAA2B,CAAC;AAC3C,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAoB,CAAC;AAElD,kFAAkF;AAClF,4CAA4C;AAC5C,MAAM,CAAC,IAAM,KAAK,GAChB,QAAQ;IACR,SAAS,KAAK,CAAS,OAAwB;QAC7C,IAAM,eAAe,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAEtD,QAAQ,eAAe,CAAC,MAAM,EAAE,CAAC;YAC/B,KAAK,SAAS;gBACZ,MAAM,eAAe,CAAC;YACxB,KAAK,UAAU;gBACb,MAAM,eAAe,CAAC,MAAM,CAAC;YAC/B,KAAK,WAAW;gBACd,OAAO,eAAe,CAAC,KAAK,CAAC;QACjC,CAAC;IACH,CAAC,CAAC","sourcesContent":["import { wrapPromiseWithState } from \"../../../utilities/index.js\";\nimport * as React from \"rehackt\";\n\ntype Use = (promise: Promise) => T;\n// Prevent webpack from complaining about our feature detection of the\n// use property of the React namespace, which is expected not\n// to exist when using current stable versions, and that's fine.\nconst useKey = \"use\" as keyof typeof React;\nconst realHook = React[useKey] as Use | undefined;\n\n// This is named with two underscores to allow this hook to evade typical rules of\n// hooks (i.e. it can be used conditionally)\nexport const __use =\n realHook ||\n function __use(promise: Promise) {\n const statefulPromise = wrapPromiseWithState(promise);\n\n switch (statefulPromise.status) {\n case \"pending\":\n throw statefulPromise;\n case \"rejected\":\n throw statefulPromise.reason;\n case \"fulfilled\":\n return statefulPromise.value;\n }\n };\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.d.ts new file mode 100644 index 0000000..8ebe527 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.d.ts @@ -0,0 +1,6 @@ +export { useDeepMemo } from "./useDeepMemo.js"; +export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js"; +export { useRenderGuard } from "./useRenderGuard.js"; +export { useLazyRef } from "./useLazyRef.js"; +export { __use } from "./__use.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js new file mode 100644 index 0000000..ce4564d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js @@ -0,0 +1,7 @@ +// These hooks are used internally and are not exported publicly by the library +export { useDeepMemo } from "./useDeepMemo.js"; +export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js"; +export { useRenderGuard } from "./useRenderGuard.js"; +export { useLazyRef } from "./useLazyRef.js"; +export { __use } from "./__use.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js.map new file mode 100644 index 0000000..65522b1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// These hooks are used internally and are not exported publicly by the library\nexport { useDeepMemo } from \"./useDeepMemo.js\";\nexport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect.js\";\nexport { useRenderGuard } from \"./useRenderGuard.js\";\nexport { useLazyRef } from \"./useLazyRef.js\";\nexport { __use } from \"./__use.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.d.ts new file mode 100644 index 0000000..2e9a0df --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.d.ts @@ -0,0 +1,3 @@ +import type { DependencyList } from "react"; +export declare function useDeepMemo(memoFn: () => TValue, deps: DependencyList): TValue; +//# sourceMappingURL=useDeepMemo.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js new file mode 100644 index 0000000..8470ea8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js @@ -0,0 +1,10 @@ +import * as React from "rehackt"; +import { equal } from "@wry/equality"; +export function useDeepMemo(memoFn, deps) { + var ref = React.useRef(); + if (!ref.current || !equal(ref.current.deps, deps)) { + ref.current = { value: memoFn(), deps: deps }; + } + return ref.current.value; +} +//# sourceMappingURL=useDeepMemo.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js.map new file mode 100644 index 0000000..1766c22 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useDeepMemo.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useDeepMemo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,MAAM,UAAU,WAAW,CACzB,MAAoB,EACpB,IAAoB;IAEpB,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAA2C,CAAC;IAEpE,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import type { DependencyList } from \"react\";\nimport * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\n\nexport function useDeepMemo(\n memoFn: () => TValue,\n deps: DependencyList\n) {\n const ref = React.useRef<{ deps: DependencyList; value: TValue }>();\n\n if (!ref.current || !equal(ref.current.deps, deps)) {\n ref.current = { value: memoFn(), deps };\n }\n\n return ref.current.value;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.d.ts new file mode 100644 index 0000000..2689b7e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.d.ts @@ -0,0 +1,4 @@ +/// +import * as React from "rehackt"; +export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect; +//# sourceMappingURL=useIsomorphicLayoutEffect.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js new file mode 100644 index 0000000..d81d07f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js @@ -0,0 +1,9 @@ +import * as React from "rehackt"; +import { canUseDOM } from "../../../utilities/index.js"; +// use canUseDOM here instead of canUseLayoutEffect because we want to be able +// to use useLayoutEffect in our jest tests. useLayoutEffect seems to work fine +// in useSuspenseQuery tests, but to honor the original comment about the +// warnings for useSyncExternalStore implementation, canUseLayoutEffect is left +// alone. +export var useIsomorphicLayoutEffect = canUseDOM ? React.useLayoutEffect : React.useEffect; +//# sourceMappingURL=useIsomorphicLayoutEffect.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js.map new file mode 100644 index 0000000..8a473d8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useIsomorphicLayoutEffect.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useIsomorphicLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,+EAA+E;AAC/E,SAAS;AACT,MAAM,CAAC,IAAM,yBAAyB,GACpC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport { canUseDOM } from \"../../../utilities/index.js\";\n\n// use canUseDOM here instead of canUseLayoutEffect because we want to be able\n// to use useLayoutEffect in our jest tests. useLayoutEffect seems to work fine\n// in useSuspenseQuery tests, but to honor the original comment about the\n// warnings for useSyncExternalStore implementation, canUseLayoutEffect is left\n// alone.\nexport const useIsomorphicLayoutEffect =\n canUseDOM ? React.useLayoutEffect : React.useEffect;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.d.ts new file mode 100644 index 0000000..0a6b6ee --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.d.ts @@ -0,0 +1,4 @@ +/// +import * as React from "rehackt"; +export declare function useLazyRef(getInitialValue: () => T): React.MutableRefObject; +//# sourceMappingURL=useLazyRef.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js new file mode 100644 index 0000000..313cd27 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js @@ -0,0 +1,10 @@ +import * as React from "rehackt"; +var INIT = {}; +export function useLazyRef(getInitialValue) { + var ref = React.useRef(INIT); + if (ref.current === INIT) { + ref.current = getInitialValue(); + } + return ref; +} +//# sourceMappingURL=useLazyRef.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js.map new file mode 100644 index 0000000..e6ee091 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useLazyRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useLazyRef.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useLazyRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,IAAM,IAAI,GAAG,EAAE,CAAC;AAEhB,MAAM,UAAU,UAAU,CAAI,eAAwB;IACpD,IAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAI,IAAoB,CAAC,CAAC;IAElD,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import * as React from \"rehackt\";\n\nconst INIT = {};\n\nexport function useLazyRef(getInitialValue: () => T) {\n const ref = React.useRef(INIT as unknown as T);\n\n if (ref.current === INIT) {\n ref.current = getInitialValue();\n }\n\n return ref;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.d.ts new file mode 100644 index 0000000..f85f62f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.d.ts @@ -0,0 +1,2 @@ +export declare function useRenderGuard(): () => boolean; +//# sourceMappingURL=useRenderGuard.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js new file mode 100644 index 0000000..d7bc0bd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js @@ -0,0 +1,17 @@ +import * as React from "rehackt"; +function getRenderDispatcher() { + var _a, _b; + return (_b = (_a = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentDispatcher) === null || _b === void 0 ? void 0 : _b.current; +} +var RenderDispatcher = null; +/* +Relay does this too, so we hope this is safe. +https://github.com/facebook/relay/blob/8651fbca19adbfbb79af7a3bc40834d105fd7747/packages/react-relay/relay-hooks/loadQuery.js#L90-L98 +*/ +export function useRenderGuard() { + RenderDispatcher = getRenderDispatcher(); + return React.useCallback(function () { + return (RenderDispatcher !== null && RenderDispatcher === getRenderDispatcher()); + }, []); +} +//# sourceMappingURL=useRenderGuard.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js.map new file mode 100644 index 0000000..619ce16 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/internal/useRenderGuard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useRenderGuard.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useRenderGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,SAAS,mBAAmB;;IAC1B,OAAO,MAAA,MAAC,KAAa,CAAC,kDAAkD,0CACpE,sBAAsB,0CAAE,OAAO,CAAC;AACtC,CAAC;AAED,IAAI,gBAAgB,GAAY,IAAI,CAAC;AAErC;;;EAGE;AACF,MAAM,UAAU,cAAc;IAC5B,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAEzC,OAAO,KAAK,CAAC,WAAW,CAAC;QACvB,OAAO,CACL,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,KAAK,mBAAmB,EAAE,CACxE,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC","sourcesContent":["import * as React from \"rehackt\";\n\nfunction getRenderDispatcher() {\n return (React as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n ?.ReactCurrentDispatcher?.current;\n}\n\nlet RenderDispatcher: unknown = null;\n\n/*\nRelay does this too, so we hope this is safe.\nhttps://github.com/facebook/relay/blob/8651fbca19adbfbb79af7a3bc40834d105fd7747/packages/react-relay/relay-hooks/loadQuery.js#L90-L98\n*/\nexport function useRenderGuard() {\n RenderDispatcher = getRenderDispatcher();\n\n return React.useCallback(() => {\n return (\n RenderDispatcher !== null && RenderDispatcher === getRenderDispatcher()\n );\n }, []);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/package.json b/graphql-subscription/node_modules/@apollo/client/react/hooks/package.json new file mode 100644 index 0000000..48e7852 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react/hooks", + "type": "module", + "main": "hooks.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.d.ts new file mode 100644 index 0000000..bbd0c93 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.d.ts @@ -0,0 +1,18 @@ +import type { ApolloClient } from "../../core/index.js"; +/** + * @example + * ```jsx + * import { useApolloClient } from '@apollo/client'; + * + * function SomeComponent() { + * const client = useApolloClient(); + * // `client` is now set to the `ApolloClient` instance being used by the + * // application (that was configured using something like `ApolloProvider`) + * } + * ``` + * + * @since 3.0.0 + * @returns The `ApolloClient` instance being used by the application. + */ +export declare function useApolloClient(override?: ApolloClient): ApolloClient; +//# sourceMappingURL=useApolloClient.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js new file mode 100644 index 0000000..77aafff --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js @@ -0,0 +1,25 @@ +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +import { getApolloContext } from "../context/index.js"; +/** + * @example + * ```jsx + * import { useApolloClient } from '@apollo/client'; + * + * function SomeComponent() { + * const client = useApolloClient(); + * // `client` is now set to the `ApolloClient` instance being used by the + * // application (that was configured using something like `ApolloProvider`) + * } + * ``` + * + * @since 3.0.0 + * @returns The `ApolloClient` instance being used by the application. + */ +export function useApolloClient(override) { + var context = React.useContext(getApolloContext()); + var client = override || context.client; + invariant(!!client, 49); + return client; +} +//# sourceMappingURL=useApolloClient.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js.map new file mode 100644 index 0000000..e1d691b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useApolloClient.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useApolloClient.js","sourceRoot":"","sources":["../../../src/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAC7B,QAA+B;IAE/B,IAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACrD,IAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAC1C,SAAS,CACP,CAAC,CAAC,MAAM,EACR,oEAAoE;QAClE,0EAA0E;QAC1E,0BAA0B,CAC7B,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { getApolloContext } from \"../context/index.js\";\n\n/**\n * @example\n * ```jsx\n * import { useApolloClient } from '@apollo/client';\n *\n * function SomeComponent() {\n * const client = useApolloClient();\n * // `client` is now set to the `ApolloClient` instance being used by the\n * // application (that was configured using something like `ApolloProvider`)\n * }\n * ```\n *\n * @since 3.0.0\n * @returns The `ApolloClient` instance being used by the application.\n */\nexport function useApolloClient(\n override?: ApolloClient\n): ApolloClient {\n const context = React.useContext(getApolloContext());\n const client = override || context.client;\n invariant(\n !!client,\n 'Could not find \"client\" in the context or passed in as an option. ' +\n \"Wrap the root component in an , or pass an ApolloClient \" +\n \"instance in via options.\"\n );\n\n return client;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.d.ts new file mode 100644 index 0000000..945d7af --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.d.ts @@ -0,0 +1,64 @@ +import type { DocumentNode, OperationVariables, TypedDocumentNode } from "../../core/index.js"; +import type { QueryReference } from "../internal/index.js"; +import type { BackgroundQueryHookOptions, NoInfer } from "../types/types.js"; +import type { FetchMoreFunction, RefetchFunction } from "./useSuspenseQuery.js"; +import type { DeepPartial } from "../../utilities/index.js"; +import type { SkipToken } from "./constants.js"; +export type UseBackgroundQueryResult = { + fetchMore: FetchMoreFunction; + refetch: RefetchFunction; +}; +type BackgroundQueryHookOptionsNoInfer = BackgroundQueryHookOptions, NoInfer>; +export declare function useBackgroundQuery, "variables">>(query: DocumentNode | TypedDocumentNode, options?: BackgroundQueryHookOptionsNoInfer & TOptions): [ + (QueryReference | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial : TData, TVariables> | (TOptions["skip"] extends boolean ? undefined : never)), + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { + returnPartialData: true; + errorPolicy: "ignore" | "all"; +}): [ + QueryReference | undefined, TVariables>, + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { + errorPolicy: "ignore" | "all"; +}): [ + QueryReference, + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { + skip: boolean; + returnPartialData: true; +}): [ + QueryReference, TVariables> | undefined, + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { + returnPartialData: true; +}): [ + QueryReference, TVariables>, + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: BackgroundQueryHookOptionsNoInfer & { + skip: boolean; +}): [ + QueryReference | undefined, + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options?: BackgroundQueryHookOptionsNoInfer): [ + QueryReference, + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: SkipToken): [undefined, UseBackgroundQueryResult]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options: SkipToken | (BackgroundQueryHookOptionsNoInfer & { + returnPartialData: true; +})): [ + QueryReference, TVariables> | undefined, + UseBackgroundQueryResult +]; +export declare function useBackgroundQuery(query: DocumentNode | TypedDocumentNode, options?: SkipToken | BackgroundQueryHookOptionsNoInfer): [ + QueryReference | undefined, + UseBackgroundQueryResult +]; +export {}; +//# sourceMappingURL=useBackgroundQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js new file mode 100644 index 0000000..6acaa12 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js @@ -0,0 +1,52 @@ +import { __spreadArray } from "tslib"; +import * as React from "rehackt"; +import { useApolloClient } from "./useApolloClient.js"; +import { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "../internal/index.js"; +import { useWatchQueryOptions } from "./useSuspenseQuery.js"; +import { canonicalStringify } from "../../cache/index.js"; +export function useBackgroundQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + // This ref tracks the first time query execution is enabled to determine + // whether to return a query ref or `undefined`. When initialized + // in a skipped state (either via `skip: true` or `skipToken`) we return + // `undefined` for the `queryRef` until the query has been enabled. Once + // enabled, a query ref is always returned regardless of whether the query is + // skipped again later. + var didFetchResult = React.useRef(fetchPolicy !== "standby"); + didFetchResult.current || (didFetchResult.current = fetchPolicy !== "standby"); + var cacheKey = __spreadArray([ + query, + canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React.useState(wrapQueryRef(queryRef)), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + if (unwrapQueryRef(wrappedQueryRef) !== queryRef) { + setWrappedQueryRef(wrapQueryRef(queryRef)); + } + if (queryRef.didChangeOptions(watchQueryOptions)) { + var promise = queryRef.applyOptions(watchQueryOptions); + updateWrappedQueryRef(wrappedQueryRef, promise); + } + var fetchMore = React.useCallback(function (options) { + var promise = queryRef.fetchMore(options); + setWrappedQueryRef(wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + var refetch = React.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setWrappedQueryRef(wrapQueryRef(queryRef)); + return promise; + }, [queryRef]); + return [ + didFetchResult.current ? wrappedQueryRef : void 0, + { fetchMore: fetchMore, refetch: refetch }, + ]; +} +//# sourceMappingURL=useBackgroundQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js.map new file mode 100644 index 0000000..5dd8ef6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useBackgroundQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useBackgroundQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useBackgroundQuery.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAQjC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAwJ1D,MAAM,UAAU,kBAAkB,CAIhC,KAA0D,EAC1D,OAG8E;IAH9E,wBAAA,EAAA,UAG2D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAK9E,IAAM,MAAM,GAAG,eAAe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AC,iBAAiB,CAAC,CAAC;QACzD,qBAAqB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,IAAM,SAAS,GAAyC,KAAK,CAAC,WAAW,CACvE,UAAC,OAAO;QACN,IAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAqC,CAAC,CAAC;QAE1E,kBAAkB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE3C,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,IAAM,OAAO,GAAuC,KAAK,CAAC,WAAW,CACnE,UAAC,SAAS;QACR,IAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE5C,kBAAkB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE3C,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO;QACL,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;QACjD,EAAE,SAAS,WAAA,EAAE,OAAO,SAAA,EAAE;KACvB,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type {\n DocumentNode,\n FetchMoreQueryOptions,\n OperationVariables,\n TypedDocumentNode,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport {\n getSuspenseCache,\n unwrapQueryRef,\n updateWrappedQueryRef,\n wrapQueryRef,\n} from \"../internal/index.js\";\nimport type { CacheKey, QueryReference } from \"../internal/index.js\";\nimport type { BackgroundQueryHookOptions, NoInfer } from \"../types/types.js\";\nimport { __use } from \"./internal/index.js\";\nimport { useWatchQueryOptions } from \"./useSuspenseQuery.js\";\nimport type { FetchMoreFunction, RefetchFunction } from \"./useSuspenseQuery.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport type { DeepPartial } from \"../../utilities/index.js\";\nimport type { SkipToken } from \"./constants.js\";\n\nexport type UseBackgroundQueryResult<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> = {\n fetchMore: FetchMoreFunction;\n refetch: RefetchFunction;\n};\n\ntype BackgroundQueryHookOptionsNoInfer<\n TData,\n TVariables extends OperationVariables,\n> = BackgroundQueryHookOptions, NoInfer>;\n\nexport function useBackgroundQuery<\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit, \"variables\">,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: BackgroundQueryHookOptionsNoInfer & TOptions\n): [\n (\n | QueryReference<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ? DeepPartial\n : TData,\n TVariables\n >\n | (TOptions[\"skip\"] extends boolean ? undefined : never)\n ),\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: BackgroundQueryHookOptionsNoInfer & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n): [\n QueryReference | undefined, TVariables>,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: BackgroundQueryHookOptionsNoInfer & {\n errorPolicy: \"ignore\" | \"all\";\n }\n): [\n QueryReference,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: BackgroundQueryHookOptionsNoInfer & {\n skip: boolean;\n returnPartialData: true;\n }\n): [\n QueryReference, TVariables> | undefined,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: BackgroundQueryHookOptionsNoInfer & {\n returnPartialData: true;\n }\n): [\n QueryReference, TVariables>,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: BackgroundQueryHookOptionsNoInfer & {\n skip: boolean;\n }\n): [\n QueryReference | undefined,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: BackgroundQueryHookOptionsNoInfer\n): [\n QueryReference,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: SkipToken\n): [undefined, UseBackgroundQueryResult];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options:\n | SkipToken\n | (BackgroundQueryHookOptionsNoInfer & {\n returnPartialData: true;\n })\n): [\n QueryReference, TVariables> | undefined,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: SkipToken | BackgroundQueryHookOptionsNoInfer\n): [\n QueryReference | undefined,\n UseBackgroundQueryResult,\n];\n\nexport function useBackgroundQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options:\n | (SkipToken &\n Partial>)\n | BackgroundQueryHookOptionsNoInfer = Object.create(null)\n): [\n QueryReference | undefined,\n UseBackgroundQueryResult,\n] {\n const client = useApolloClient(options.client);\n const suspenseCache = getSuspenseCache(client);\n const watchQueryOptions = useWatchQueryOptions({ client, query, options });\n const { fetchPolicy, variables } = watchQueryOptions;\n const { queryKey = [] } = options;\n\n // This ref tracks the first time query execution is enabled to determine\n // whether to return a query ref or `undefined`. When initialized\n // in a skipped state (either via `skip: true` or `skipToken`) we return\n // `undefined` for the `queryRef` until the query has been enabled. Once\n // enabled, a query ref is always returned regardless of whether the query is\n // skipped again later.\n const didFetchResult = React.useRef(fetchPolicy !== \"standby\");\n didFetchResult.current ||= fetchPolicy !== \"standby\";\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n\n const queryRef = suspenseCache.getQueryRef(cacheKey, () =>\n client.watchQuery(watchQueryOptions as WatchQueryOptions)\n );\n\n const [wrappedQueryRef, setWrappedQueryRef] = React.useState(\n wrapQueryRef(queryRef)\n );\n if (unwrapQueryRef(wrappedQueryRef) !== queryRef) {\n setWrappedQueryRef(wrapQueryRef(queryRef));\n }\n if (queryRef.didChangeOptions(watchQueryOptions)) {\n const promise = queryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(wrappedQueryRef, promise);\n }\n\n const fetchMore: FetchMoreFunction = React.useCallback(\n (options) => {\n const promise = queryRef.fetchMore(options as FetchMoreQueryOptions);\n\n setWrappedQueryRef(wrapQueryRef(queryRef));\n\n return promise;\n },\n [queryRef]\n );\n\n const refetch: RefetchFunction = React.useCallback(\n (variables) => {\n const promise = queryRef.refetch(variables);\n\n setWrappedQueryRef(wrapQueryRef(queryRef));\n\n return promise;\n },\n [queryRef]\n );\n\n return [\n didFetchResult.current ? wrappedQueryRef : void 0,\n { fetchMore, refetch },\n ];\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.d.ts new file mode 100644 index 0000000..088b715 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.d.ts @@ -0,0 +1,28 @@ +import type { DeepPartial } from "../../utilities/index.js"; +import type { Cache, Reference, StoreObject, MissingTree } from "../../cache/index.js"; +import type { ApolloClient, OperationVariables } from "../../core/index.js"; +import type { NoInfer } from "../types/types.js"; +export interface UseFragmentOptions extends Omit, NoInfer>, "id" | "query" | "optimistic" | "previousResult" | "returnPartialData">, Omit, "id" | "variables" | "returnPartialData"> { + from: StoreObject | Reference | string; + optimistic?: boolean; + /** + * The instance of {@link ApolloClient} to use to look up the fragment. + * + * By default, the instance that's passed down via context is used, but you + * can provide a different instance here. + * + * @docGroup 1. Operation options + */ + client?: ApolloClient; +} +export type UseFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing?: MissingTree; +}; +export declare function useFragment(options: UseFragmentOptions): UseFragmentResult; +//# sourceMappingURL=useFragment.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js new file mode 100644 index 0000000..d72da7f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js @@ -0,0 +1,48 @@ +import { __assign, __rest } from "tslib"; +import * as React from "rehackt"; +import { equal } from "@wry/equality"; +import { mergeDeepArray } from "../../utilities/index.js"; +import { useApolloClient } from "./useApolloClient.js"; +import { useSyncExternalStore } from "./useSyncExternalStore.js"; +import { useDeepMemo, useLazyRef } from "./internal/index.js"; +export function useFragment(options) { + var cache = useApolloClient(options.client).cache; + var diffOptions = useDeepMemo(function () { + var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = __rest(options, ["fragment", "fragmentName", "from", "optimistic"]); + return __assign(__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic }); + }, [options]); + var resultRef = useLazyRef(function () { + return diffToResult(cache.diff(diffOptions)); + }); + // Used for both getSnapshot and getServerSnapshot + var getSnapshot = React.useCallback(function () { return resultRef.current; }, []); + return useSyncExternalStore(React.useCallback(function (forceUpdate) { + var lastTimeout = 0; + var unsubscribe = cache.watch(__assign(__assign({}, diffOptions), { immediate: true, callback: function (diff) { + if (!equal(diff.result, resultRef.current.data)) { + resultRef.current = diffToResult(diff); + // If we get another update before we've re-rendered, bail out of + // the update and try again. This ensures that the relative timing + // between useQuery and useFragment stays roughly the same as + // fixed in https://github.com/apollographql/apollo-client/pull/11083 + clearTimeout(lastTimeout); + lastTimeout = setTimeout(forceUpdate); + } + } })); + return function () { + unsubscribe(); + clearTimeout(lastTimeout); + }; + }, [cache, diffOptions]), getSnapshot, getSnapshot); +} +function diffToResult(diff) { + var result = { + data: diff.result, + complete: !!diff.complete, + }; + if (diff.missing) { + result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; })); + } + return result; +} +//# sourceMappingURL=useFragment.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js.map new file mode 100644 index 0000000..c6c8bd9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useFragment.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useFragment.js","sourceRoot":"","sources":["../../../src/react/hooks/useFragment.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAqC9D,MAAM,UAAU,WAAW,CACzB,OAAyC;IAEjC,IAAA,KAAK,GAAK,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,MAApC,CAA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C7D,qEAAqE;oBACrE,YAAY,CAAC,WAAW,CAAC,CAAC;oBAC1B,WAAW,GAAG,UAAU,CAAC,WAAW,CAAQ,CAAC;gBAC/C,CAAC;YACH,CAAC,IACD,CAAC;QACH,OAAO;YACL,WAAW,EAAE,CAAC;YACd,YAAY,CAAC,WAAW,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EACD,CAAC,KAAK,EAAE,WAAW,CAAC,CACrB,EACD,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,IAA6B;IAE7B,IAAM,MAAM,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,MAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ;KACE,CAAC;IAE9B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport { equal } from \"@wry/equality\";\n\nimport type { DeepPartial } from \"../../utilities/index.js\";\nimport { mergeDeepArray } from \"../../utilities/index.js\";\nimport type {\n Cache,\n Reference,\n StoreObject,\n MissingTree,\n} from \"../../cache/index.js\";\n\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport type { ApolloClient, OperationVariables } from \"../../core/index.js\";\nimport type { NoInfer } from \"../types/types.js\";\nimport { useDeepMemo, useLazyRef } from \"./internal/index.js\";\n\nexport interface UseFragmentOptions\n extends Omit<\n Cache.DiffOptions, NoInfer>,\n \"id\" | \"query\" | \"optimistic\" | \"previousResult\" | \"returnPartialData\"\n >,\n Omit<\n Cache.ReadFragmentOptions,\n \"id\" | \"variables\" | \"returnPartialData\"\n > {\n from: StoreObject | Reference | string;\n // Override this field to make it optional (default: true).\n optimistic?: boolean;\n /**\n * The instance of {@link ApolloClient} to use to look up the fragment.\n *\n * By default, the instance that's passed down via context is used, but you\n * can provide a different instance here.\n *\n * @docGroup 1. Operation options\n */\n client?: ApolloClient;\n}\n\nexport type UseFragmentResult =\n | {\n data: TData;\n complete: true;\n missing?: never;\n }\n | {\n data: DeepPartial;\n complete: false;\n missing?: MissingTree;\n };\n\nexport function useFragment(\n options: UseFragmentOptions\n): UseFragmentResult {\n const { cache } = useApolloClient(options.client);\n\n const diffOptions = useDeepMemo>(() => {\n const {\n fragment,\n fragmentName,\n from,\n optimistic = true,\n ...rest\n } = options;\n\n return {\n ...rest,\n returnPartialData: true,\n id: typeof from === \"string\" ? from : cache.identify(from),\n query: cache[\"getFragmentDoc\"](fragment, fragmentName),\n optimistic,\n };\n }, [options]);\n\n const resultRef = useLazyRef>(() =>\n diffToResult(cache.diff(diffOptions))\n );\n\n // Used for both getSnapshot and getServerSnapshot\n const getSnapshot = React.useCallback(() => resultRef.current, []);\n\n return useSyncExternalStore(\n React.useCallback(\n (forceUpdate) => {\n let lastTimeout = 0;\n const unsubscribe = cache.watch({\n ...diffOptions,\n immediate: true,\n callback(diff) {\n if (!equal(diff.result, resultRef.current.data)) {\n resultRef.current = diffToResult(diff);\n // If we get another update before we've re-rendered, bail out of\n // the update and try again. This ensures that the relative timing\n // between useQuery and useFragment stays roughly the same as\n // fixed in https://github.com/apollographql/apollo-client/pull/11083\n clearTimeout(lastTimeout);\n lastTimeout = setTimeout(forceUpdate) as any;\n }\n },\n });\n return () => {\n unsubscribe();\n clearTimeout(lastTimeout);\n };\n },\n [cache, diffOptions]\n ),\n getSnapshot,\n getSnapshot\n );\n}\n\nfunction diffToResult(\n diff: Cache.DiffResult\n): UseFragmentResult {\n const result = {\n data: diff.result!,\n complete: !!diff.complete,\n } as UseFragmentResult;\n\n if (diff.missing) {\n result.missing = mergeDeepArray(diff.missing.map((error) => error.missing));\n }\n\n return result;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.d.ts new file mode 100644 index 0000000..aba3578 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.d.ts @@ -0,0 +1,41 @@ +import type { DocumentNode } from "graphql"; +import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +import type { OperationVariables } from "../../core/index.js"; +import type { LazyQueryHookOptions, LazyQueryResultTuple, NoInfer } from "../types/types.js"; +/** + * A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction. + * + * > Refer to the [Queries - Manual execution with useLazyQuery](https://www.apollographql.com/docs/react/data/queries#manual-execution-with-uselazyquery) section for a more in-depth overview of `useLazyQuery`. + * + * @example + * ```jsx + * import { gql, useLazyQuery } from "@apollo/client"; + * + * const GET_GREETING = gql` + * query GetGreeting($language: String!) { + * greeting(language: $language) { + * message + * } + * } + * `; + * + * function Hello() { + * const [loadGreeting, { called, loading, data }] = useLazyQuery( + * GET_GREETING, + * { variables: { language: "english" } } + * ); + * if (called && loading) return

    Loading ...

    + * if (!called) { + * return + * } + * return

    Hello {data.greeting.message}!

    ; + * } + * ``` + * @since 3.0.0 + * + * @param query - A GraphQL query document parsed into an AST by `gql`. + * @param options - Default options to control how the query is executed. + * @returns A tuple in the form of `[execute, result]` + */ +export declare function useLazyQuery(query: DocumentNode | TypedDocumentNode, options?: LazyQueryHookOptions, NoInfer>): LazyQueryResultTuple; +//# sourceMappingURL=useLazyQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js new file mode 100644 index 0000000..1f9a632 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js @@ -0,0 +1,107 @@ +import { __assign } from "tslib"; +import * as React from "rehackt"; +import { mergeOptions } from "../../utilities/index.js"; +import { useInternalState } from "./useQuery.js"; +import { useApolloClient } from "./useApolloClient.js"; +// The following methods, when called will execute the query, regardless of +// whether the useLazyQuery execute function was called before. +var EAGER_METHODS = [ + "refetch", + "reobserve", + "fetchMore", + "updateQuery", + "startPolling", + "subscribeToMore", +]; +/** + * A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction. + * + * > Refer to the [Queries - Manual execution with useLazyQuery](https://www.apollographql.com/docs/react/data/queries#manual-execution-with-uselazyquery) section for a more in-depth overview of `useLazyQuery`. + * + * @example + * ```jsx + * import { gql, useLazyQuery } from "@apollo/client"; + * + * const GET_GREETING = gql` + * query GetGreeting($language: String!) { + * greeting(language: $language) { + * message + * } + * } + * `; + * + * function Hello() { + * const [loadGreeting, { called, loading, data }] = useLazyQuery( + * GET_GREETING, + * { variables: { language: "english" } } + * ); + * if (called && loading) return

    Loading ...

    + * if (!called) { + * return + * } + * return

    Hello {data.greeting.message}!

    ; + * } + * ``` + * @since 3.0.0 + * + * @param query - A GraphQL query document parsed into an AST by `gql`. + * @param options - Default options to control how the query is executed. + * @returns A tuple in the form of `[execute, result]` + */ +export function useLazyQuery(query, options) { + var _a; + var execOptionsRef = React.useRef(); + var optionsRef = React.useRef(); + var queryRef = React.useRef(); + var merged = mergeOptions(options, execOptionsRef.current || {}); + var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query; + // Use refs to track options and the used query to ensure the `execute` + // function remains referentially stable between renders. + optionsRef.current = options; + queryRef.current = document; + var internalState = useInternalState(useApolloClient(options && options.client), document); + var useQueryResult = internalState.useQuery(__assign(__assign({}, merged), { skip: !execOptionsRef.current })); + var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy || + internalState.getDefaultFetchPolicy(); + var result = Object.assign(useQueryResult, { + called: !!execOptionsRef.current, + }); + // We use useMemo here to make sure the eager methods have a stable identity. + var eagerMethods = React.useMemo(function () { + var eagerMethods = {}; + var _loop_1 = function (key) { + var method = result[key]; + eagerMethods[key] = function () { + if (!execOptionsRef.current) { + execOptionsRef.current = Object.create(null); + // Only the first time populating execOptionsRef.current matters here. + internalState.forceUpdateState(); + } + // @ts-expect-error this is just too generic to type + return method.apply(this, arguments); + }; + }; + for (var _i = 0, EAGER_METHODS_1 = EAGER_METHODS; _i < EAGER_METHODS_1.length; _i++) { + var key = EAGER_METHODS_1[_i]; + _loop_1(key); + } + return eagerMethods; + }, []); + Object.assign(result, eagerMethods); + var execute = React.useCallback(function (executeOptions) { + execOptionsRef.current = + executeOptions ? __assign(__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : { + fetchPolicy: initialFetchPolicy, + }; + var options = mergeOptions(optionsRef.current, __assign({ query: queryRef.current }, execOptionsRef.current)); + var promise = internalState + .executeQuery(__assign(__assign({}, options), { skip: false })) + .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); }); + // Because the return value of `useLazyQuery` is usually floated, we need + // to catch the promise to prevent unhandled rejections. + promise.catch(function () { }); + return promise; + }, []); + return [execute, result]; +} +//# sourceMappingURL=useLazyQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js.map new file mode 100644 index 0000000..5ce8488 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLazyQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useLazyQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useLazyQuery.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,2EAA2E;AAC3E,+DA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QACxD,OAAO,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;QAExB,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport * as React from \"rehackt\";\n\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport type {\n LazyQueryHookExecOptions,\n LazyQueryHookOptions,\n LazyQueryResultTuple,\n NoInfer,\n QueryResult,\n} from \"../types/types.js\";\nimport { useInternalState } from \"./useQuery.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\n// The following methods, when called will execute the query, regardless of\n// whether the useLazyQuery execute function was called before.\nconst EAGER_METHODS = [\n \"refetch\",\n \"reobserve\",\n \"fetchMore\",\n \"updateQuery\",\n \"startPolling\",\n \"subscribeToMore\",\n] as const;\n\n/**\n * A hook for imperatively executing queries in an Apollo application, e.g. in response to user interaction.\n *\n * > Refer to the [Queries - Manual execution with useLazyQuery](https://www.apollographql.com/docs/react/data/queries#manual-execution-with-uselazyquery) section for a more in-depth overview of `useLazyQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useLazyQuery } from \"@apollo/client\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const [loadGreeting, { called, loading, data }] = useLazyQuery(\n * GET_GREETING,\n * { variables: { language: \"english\" } }\n * );\n * if (called && loading) return

    Loading ...

    \n * if (!called) {\n * return \n * }\n * return

    Hello {data.greeting.message}!

    ;\n * }\n * ```\n * @since 3.0.0\n *\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Default options to control how the query is executed.\n * @returns A tuple in the form of `[execute, result]`\n */\nexport function useLazyQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: LazyQueryHookOptions, NoInfer>\n): LazyQueryResultTuple {\n const execOptionsRef =\n React.useRef>>();\n const optionsRef = React.useRef>();\n const queryRef = React.useRef<\n DocumentNode | TypedDocumentNode\n >();\n const merged = mergeOptions(options, execOptionsRef.current || {});\n const document = merged?.query ?? query;\n\n // Use refs to track options and the used query to ensure the `execute`\n // function remains referentially stable between renders.\n optionsRef.current = options;\n queryRef.current = document;\n\n const internalState = useInternalState(\n useApolloClient(options && options.client),\n document\n );\n\n const useQueryResult = internalState.useQuery({\n ...merged,\n skip: !execOptionsRef.current,\n });\n\n const initialFetchPolicy =\n useQueryResult.observable.options.initialFetchPolicy ||\n internalState.getDefaultFetchPolicy();\n\n const result: QueryResult = Object.assign(useQueryResult, {\n called: !!execOptionsRef.current,\n });\n\n // We use useMemo here to make sure the eager methods have a stable identity.\n const eagerMethods = React.useMemo(() => {\n const eagerMethods: Record = {};\n for (const key of EAGER_METHODS) {\n const method = result[key];\n eagerMethods[key] = function () {\n if (!execOptionsRef.current) {\n execOptionsRef.current = Object.create(null);\n // Only the first time populating execOptionsRef.current matters here.\n internalState.forceUpdateState();\n }\n // @ts-expect-error this is just too generic to type\n return method.apply(this, arguments);\n };\n }\n\n return eagerMethods;\n }, []);\n\n Object.assign(result, eagerMethods);\n\n const execute = React.useCallback[0]>(\n (executeOptions) => {\n execOptionsRef.current =\n executeOptions ?\n {\n ...executeOptions,\n fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy,\n }\n : {\n fetchPolicy: initialFetchPolicy,\n };\n\n const options = mergeOptions(optionsRef.current, {\n query: queryRef.current,\n ...execOptionsRef.current,\n });\n\n const promise = internalState\n .executeQuery({ ...options, skip: false })\n .then((queryResult) => Object.assign(queryResult, eagerMethods));\n\n // Because the return value of `useLazyQuery` is usually floated, we need\n // to catch the promise to prevent unhandled rejections.\n promise.catch(() => {});\n\n return promise;\n },\n []\n );\n\n return [execute, result];\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.d.ts new file mode 100644 index 0000000..e1327b7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.d.ts @@ -0,0 +1,97 @@ +import type { DocumentNode, OperationVariables, TypedDocumentNode } from "../../core/index.js"; +import type { QueryReference } from "../internal/index.js"; +import type { LoadableQueryHookOptions } from "../types/types.js"; +import type { FetchMoreFunction, RefetchFunction } from "./useSuspenseQuery.js"; +import type { DeepPartial, OnlyRequiredProperties } from "../../utilities/index.js"; +export type LoadQueryFunction = (...args: [TVariables] extends [never] ? [] : {} extends OnlyRequiredProperties ? [variables?: TVariables] : [variables: TVariables]) => void; +type ResetFunction = () => void; +export type UseLoadableQueryResult = [ + loadQuery: LoadQueryFunction, + queryRef: QueryReference | null, + { + /** + * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/). + * + * + * @docGroup + * + * 3. Helper functions + */ + fetchMore: FetchMoreFunction; + /** + * A function that enables you to re-execute the query, optionally passing in new `variables`. + * + * To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request). + * + * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching). + * + * @docGroup + * + * 3. Helper functions + */ + refetch: RefetchFunction; + /** + * A function that resets the `queryRef` back to `null`. + */ + reset: ResetFunction; + } +]; +export declare function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options?: LoadableQueryHookOptions & TOptions): UseLoadableQueryResult | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial : TData, TVariables>; +export declare function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options: LoadableQueryHookOptions & { + returnPartialData: true; + errorPolicy: "ignore" | "all"; +}): UseLoadableQueryResult | undefined, TVariables>; +export declare function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options: LoadableQueryHookOptions & { + errorPolicy: "ignore" | "all"; +}): UseLoadableQueryResult; +export declare function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options: LoadableQueryHookOptions & { + returnPartialData: true; +}): UseLoadableQueryResult, TVariables>; +/** + * A hook for imperatively loading a query, such as responding to a user + * interaction. + * + * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`. + * + * @example + * ```jsx + * import { gql, useLoadableQuery } from "@apollo/client"; + * + * const GET_GREETING = gql` + * query GetGreeting($language: String!) { + * greeting(language: $language) { + * message + * } + * } + * `; + * + * function App() { + * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING); + * + * return ( + * <> + * + * Loading...}> + * {queryRef && } + * + * + * ); + * } + * + * function Hello({ queryRef }) { + * const { data } = useReadQuery(queryRef); + * + * return
    {data.greeting.message}
    ; + * } + * ``` + * + * @since 3.9.0 + * @param query - A GraphQL query document parsed into an AST by `gql`. + * @param options - Options to control how the query is executed. + * @returns A tuple in the form of `[loadQuery, queryRef, handlers]` + */ +export declare function useLoadableQuery(query: DocumentNode | TypedDocumentNode, options?: LoadableQueryHookOptions): UseLoadableQueryResult; +export {}; +//# sourceMappingURL=useLoadableQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js new file mode 100644 index 0000000..71e3b49 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js @@ -0,0 +1,59 @@ +import { __assign, __spreadArray } from "tslib"; +import * as React from "rehackt"; +import { useApolloClient } from "./useApolloClient.js"; +import { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "../internal/index.js"; +import { useRenderGuard } from "./internal/index.js"; +import { useWatchQueryOptions } from "./useSuspenseQuery.js"; +import { canonicalStringify } from "../../cache/index.js"; +import { invariant } from "../../utilities/globals/index.js"; +export function useLoadableQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options }); + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var _b = React.useState(null), queryRef = _b[0], setQueryRef = _b[1]; + var internalQueryRef = queryRef && unwrapQueryRef(queryRef); + if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) { + var promise = internalQueryRef.applyOptions(watchQueryOptions); + updateWrappedQueryRef(queryRef, promise); + } + var calledDuringRender = useRenderGuard(); + var fetchMore = React.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.fetchMore(options); + setQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var refetch = React.useCallback(function (options) { + if (!internalQueryRef) { + throw new Error("The query has not been loaded. Please load the query."); + } + var promise = internalQueryRef.refetch(options); + setQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var loadQuery = React.useCallback(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + invariant(!calledDuringRender(), 50); + var variables = args[0]; + var cacheKey = __spreadArray([ + query, + canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(__assign(__assign({}, watchQueryOptions), { variables: variables })); + }); + setQueryRef(wrapQueryRef(queryRef)); + }, [query, queryKey, suspenseCache, watchQueryOptions, calledDuringRender]); + var reset = React.useCallback(function () { + setQueryRef(null); + }, [queryRef]); + return [loadQuery, queryRef, { fetchMore: fetchMore, refetch: refetch, reset: reset }]; +} +//# sourceMappingURL=useLoadableQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js.map new file mode 100644 index 0000000..dc57bd5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useLoadableQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useLoadableQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useLoadableQuery.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAQjC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAS,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAqI7D,MAAM,UAAU,gBAAgB,CAI9B,KAA0D,EAC1D,OAAuD;IAAvD,wBAAA,EAAA,UAAoC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEvD,IAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAM,iBAAiB,GAAG,oBAAoB,CAAC,EAAE,MAAM,QAAA,EAAE,KAAK,OAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IACnE,IAAA,KAAkB,OAAO,SAAZ,EAAb,QAAQ,mBAAG,EAAE,KAAA,CAAa;IAE5B,IAAA,KAA0B,KAAK,CAAC,QAAQ,CAGpC,IAAI,CAAC,EAHR,QAAQ,QAAA,EAAE,WAAW,QAGb,CAAC;IAEhB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E,EACrB,sIAAsI,CACvI,CAAC;QAEK,IAAA,SAAS,GAAI,IAAI,GAAR,CAAS;QAEzB,IAAM,QAAQ;YACZ,KAAK;YACL,kBAAkB,CAAC,SAAS,CAAC;WACzB,EAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,OAClC,CAAC;QAEF,IAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,CAAC,QAAQ,EAAE;YACnD,OAAA,MAAM,CAAC,UAAU,CAAC,sBACb,iBAAiB,KACpB,SAAS,WAAA,GACqB,CAAC;QAHjC,CAGiC,CAClC,CAAC;QAEF,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtC,CAAC,EACD,CAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CACxE,CAAC;IAEF,IAAM,KAAK,GAAkB,KAAK,CAAC,WAAW,CAAC;QAC7C,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,SAAS,WAAA,EAAE,OAAO,SAAA,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type {\n DocumentNode,\n FetchMoreQueryOptions,\n OperationVariables,\n TypedDocumentNode,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport {\n getSuspenseCache,\n unwrapQueryRef,\n updateWrappedQueryRef,\n wrapQueryRef,\n} from \"../internal/index.js\";\nimport type { CacheKey, QueryReference } from \"../internal/index.js\";\nimport type { LoadableQueryHookOptions } from \"../types/types.js\";\nimport { __use, useRenderGuard } from \"./internal/index.js\";\nimport { useWatchQueryOptions } from \"./useSuspenseQuery.js\";\nimport type { FetchMoreFunction, RefetchFunction } from \"./useSuspenseQuery.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport type {\n DeepPartial,\n OnlyRequiredProperties,\n} from \"../../utilities/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n\nexport type LoadQueryFunction = (\n // Use variadic args to handle cases where TVariables is type `never`, in\n // which case we don't want to allow a variables argument. In other\n // words, we don't want to allow variables to be passed as an argument to this\n // function if the query does not expect variables in the document.\n ...args: [TVariables] extends [never] ? []\n : {} extends OnlyRequiredProperties ? [variables?: TVariables]\n : [variables: TVariables]\n) => void;\n\ntype ResetFunction = () => void;\n\nexport type UseLoadableQueryResult<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> = [\n loadQuery: LoadQueryFunction,\n queryRef: QueryReference | null,\n {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: FetchMoreFunction;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: RefetchFunction;\n /**\n * A function that resets the `queryRef` back to `null`.\n */\n reset: ResetFunction;\n },\n];\n\nexport function useLoadableQuery<\n TData,\n TVariables extends OperationVariables,\n TOptions extends LoadableQueryHookOptions,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: LoadableQueryHookOptions & TOptions\n): UseLoadableQueryResult<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ? DeepPartial\n : TData,\n TVariables\n>;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: LoadableQueryHookOptions & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n): UseLoadableQueryResult | undefined, TVariables>;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: LoadableQueryHookOptions & {\n errorPolicy: \"ignore\" | \"all\";\n }\n): UseLoadableQueryResult;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: LoadableQueryHookOptions & {\n returnPartialData: true;\n }\n): UseLoadableQueryResult, TVariables>;\n\n/**\n * A hook for imperatively loading a query, such as responding to a user\n * interaction.\n *\n * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useLoadableQuery } from \"@apollo/client\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function App() {\n * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);\n *\n * return (\n * <>\n * \n * Loading...}>\n * {queryRef && }\n * \n * \n * );\n * }\n *\n * function Hello({ queryRef }) {\n * const { data } = useReadQuery(queryRef);\n *\n * return
    {data.greeting.message}
    ;\n * }\n * ```\n *\n * @since 3.9.0\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Options to control how the query is executed.\n * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`\n */\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: LoadableQueryHookOptions\n): UseLoadableQueryResult;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: LoadableQueryHookOptions = Object.create(null)\n): UseLoadableQueryResult {\n const client = useApolloClient(options.client);\n const suspenseCache = getSuspenseCache(client);\n const watchQueryOptions = useWatchQueryOptions({ client, query, options });\n const { queryKey = [] } = options;\n\n const [queryRef, setQueryRef] = React.useState | null>(null);\n\n const internalQueryRef = queryRef && unwrapQueryRef(queryRef);\n\n if (queryRef && internalQueryRef?.didChangeOptions(watchQueryOptions)) {\n const promise = internalQueryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(queryRef, promise);\n }\n\n const calledDuringRender = useRenderGuard();\n\n const fetchMore: FetchMoreFunction = React.useCallback(\n (options) => {\n if (!internalQueryRef) {\n throw new Error(\n \"The query has not been loaded. Please load the query.\"\n );\n }\n\n const promise = internalQueryRef.fetchMore(\n options as FetchMoreQueryOptions\n );\n\n setQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n const refetch: RefetchFunction = React.useCallback(\n (options) => {\n if (!internalQueryRef) {\n throw new Error(\n \"The query has not been loaded. Please load the query.\"\n );\n }\n\n const promise = internalQueryRef.refetch(options);\n\n setQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n const loadQuery: LoadQueryFunction = React.useCallback(\n (...args) => {\n invariant(\n !calledDuringRender(),\n \"useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook.\"\n );\n\n const [variables] = args;\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n\n const queryRef = suspenseCache.getQueryRef(cacheKey, () =>\n client.watchQuery({\n ...watchQueryOptions,\n variables,\n } as WatchQueryOptions)\n );\n\n setQueryRef(wrapQueryRef(queryRef));\n },\n [query, queryKey, suspenseCache, watchQueryOptions, calledDuringRender]\n );\n\n const reset: ResetFunction = React.useCallback(() => {\n setQueryRef(null);\n }, [queryRef]);\n\n return [loadQuery, queryRef, { fetchMore, refetch, reset }];\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.d.ts new file mode 100644 index 0000000..0cf6aa6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.d.ts @@ -0,0 +1,53 @@ +import type { DocumentNode } from "graphql"; +import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +import type { MutationHookOptions, MutationTuple, NoInfer } from "../types/types.js"; +import type { ApolloCache, DefaultContext, OperationVariables } from "../../core/index.js"; +/** + * + * + * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`. + * + * @example + * ```jsx + * import { gql, useMutation } from '@apollo/client'; + * + * const ADD_TODO = gql` + * mutation AddTodo($type: String!) { + * addTodo(type: $type) { + * id + * type + * } + * } + * `; + * + * function AddTodo() { + * let input; + * const [addTodo, { data }] = useMutation(ADD_TODO); + * + * return ( + *
    + *
    { + * e.preventDefault(); + * addTodo({ variables: { type: input.value } }); + * input.value = ''; + * }} + * > + * { + * input = node; + * }} + * /> + * + *
    + *
    + * ); + * } + * ``` + * @since 3.0.0 + * @param mutation - A GraphQL mutation document parsed into an AST by `gql`. + * @param options - Options to control how the mutation is executed. + * @returns A tuple in the form of `[mutate, result]` + */ +export declare function useMutation = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer, TContext, TCache>): MutationTuple; +//# sourceMappingURL=useMutation.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js new file mode 100644 index 0000000..6d453c1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js @@ -0,0 +1,163 @@ +import { __assign } from "tslib"; +import * as React from "rehackt"; +import { mergeOptions } from "../../utilities/index.js"; +import { equal } from "@wry/equality"; +import { DocumentType, verifyDocumentType } from "../parser/index.js"; +import { ApolloError } from "../../errors/index.js"; +import { useApolloClient } from "./useApolloClient.js"; +/** + * + * + * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`. + * + * @example + * ```jsx + * import { gql, useMutation } from '@apollo/client'; + * + * const ADD_TODO = gql` + * mutation AddTodo($type: String!) { + * addTodo(type: $type) { + * id + * type + * } + * } + * `; + * + * function AddTodo() { + * let input; + * const [addTodo, { data }] = useMutation(ADD_TODO); + * + * return ( + *
    + *
    { + * e.preventDefault(); + * addTodo({ variables: { type: input.value } }); + * input.value = ''; + * }} + * > + * { + * input = node; + * }} + * /> + * + *
    + *
    + * ); + * } + * ``` + * @since 3.0.0 + * @param mutation - A GraphQL mutation document parsed into an AST by `gql`. + * @param options - Options to control how the mutation is executed. + * @returns A tuple in the form of `[mutate, result]` + */ +export function useMutation(mutation, options) { + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + verifyDocumentType(mutation, DocumentType.Mutation); + var _a = React.useState({ + called: false, + loading: false, + client: client, + }), result = _a[0], setResult = _a[1]; + var ref = React.useRef({ + result: result, + mutationId: 0, + isMounted: true, + client: client, + mutation: mutation, + options: options, + }); + // TODO: Trying to assign these in a useEffect or useLayoutEffect breaks + // higher-order components. + { + Object.assign(ref.current, { client: client, options: options, mutation: mutation }); + } + var execute = React.useCallback(function (executeOptions) { + if (executeOptions === void 0) { executeOptions = {}; } + var _a = ref.current, options = _a.options, mutation = _a.mutation; + var baseOptions = __assign(__assign({}, options), { mutation: mutation }); + var client = executeOptions.client || ref.current.client; + if (!ref.current.result.loading && + !baseOptions.ignoreResults && + ref.current.isMounted) { + setResult((ref.current.result = { + loading: true, + error: void 0, + data: void 0, + called: true, + client: client, + })); + } + var mutationId = ++ref.current.mutationId; + var clientOptions = mergeOptions(baseOptions, executeOptions); + return client + .mutate(clientOptions) + .then(function (response) { + var _a, _b; + var data = response.data, errors = response.errors; + var error = errors && errors.length > 0 ? + new ApolloError({ graphQLErrors: errors }) + : void 0; + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (error && onError) { + onError(error, clientOptions); + } + if (mutationId === ref.current.mutationId && + !clientOptions.ignoreResults) { + var result_1 = { + called: true, + loading: false, + data: data, + error: error, + client: client, + }; + if (ref.current.isMounted && !equal(ref.current.result, result_1)) { + setResult((ref.current.result = result_1)); + } + } + var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted); + if (!error) { + onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions); + } + return response; + }) + .catch(function (error) { + var _a; + if (mutationId === ref.current.mutationId && ref.current.isMounted) { + var result_2 = { + loading: false, + error: error, + data: void 0, + called: true, + client: client, + }; + if (!equal(ref.current.result, result_2)) { + setResult((ref.current.result = result_2)); + } + } + var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError); + if (onError) { + onError(error, clientOptions); + // TODO(brian): why are we returning this here??? + return { data: void 0, errors: error }; + } + throw error; + }); + }, []); + var reset = React.useCallback(function () { + if (ref.current.isMounted) { + var result_3 = { called: false, loading: false, client: client }; + Object.assign(ref.current, { mutationId: 0, result: result_3 }); + setResult(result_3); + } + }, []); + React.useEffect(function () { + ref.current.isMounted = true; + return function () { + ref.current.isMounted = false; + }; + }, []); + return [execute, __assign({ reset: reset }, result)]; +} +//# sourceMappingURL=useMutation.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js.map new file mode 100644 index 0000000..404b8e7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useMutation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useMutation.js","sourceRoot":"","sources":["../../../src/react/hooks/useMutation.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAiBjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EA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AAK,EAAE,CAAC;YACzC,CAAC;YAED,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,EACD,EAAE,CACH,CAAC;IAEF,IAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC1B,IAAM,QAAM,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAA,EAAE,CAAC;YACzD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,UAAA,EAAE,CAAC,CAAC;YACtD,SAAS,CAAC,QAAM,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,KAAK,CAAC,SAAS,CAAC;QACd,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAE7B,OAAO;YACL,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;QAChC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,OAAO,aAAI,KAAK,OAAA,IAAK,MAAM,EAAG,CAAC;AACzC,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport type {\n MutationFunctionOptions,\n MutationHookOptions,\n MutationResult,\n MutationTuple,\n NoInfer,\n} from \"../types/types.js\";\n\nimport type {\n ApolloCache,\n DefaultContext,\n MutationOptions,\n OperationVariables,\n} from \"../../core/index.js\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\n/**\n *\n *\n * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`.\n *\n * @example\n * ```jsx\n * import { gql, useMutation } from '@apollo/client';\n *\n * const ADD_TODO = gql`\n * mutation AddTodo($type: String!) {\n * addTodo(type: $type) {\n * id\n * type\n * }\n * }\n * `;\n *\n * function AddTodo() {\n * let input;\n * const [addTodo, { data }] = useMutation(ADD_TODO);\n *\n * return (\n *
    \n * {\n * e.preventDefault();\n * addTodo({ variables: { type: input.value } });\n * input.value = '';\n * }}\n * >\n * {\n * input = node;\n * }}\n * />\n * \n * \n *
    \n * );\n * }\n * ```\n * @since 3.0.0\n * @param mutation - A GraphQL mutation document parsed into an AST by `gql`.\n * @param options - Options to control how the mutation is executed.\n * @returns A tuple in the form of `[mutate, result]`\n */\nexport function useMutation<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n>(\n mutation: DocumentNode | TypedDocumentNode,\n options?: MutationHookOptions<\n NoInfer,\n NoInfer,\n TContext,\n TCache\n >\n): MutationTuple {\n const client = useApolloClient(options?.client);\n verifyDocumentType(mutation, DocumentType.Mutation);\n const [result, setResult] = React.useState>({\n called: false,\n loading: false,\n client,\n });\n\n const ref = React.useRef({\n result,\n mutationId: 0,\n isMounted: true,\n client,\n mutation,\n options,\n });\n\n // TODO: Trying to assign these in a useEffect or useLayoutEffect breaks\n // higher-order components.\n {\n Object.assign(ref.current, { client, options, mutation });\n }\n\n const execute = React.useCallback(\n (\n executeOptions: MutationFunctionOptions<\n TData,\n TVariables,\n TContext,\n TCache\n > = {}\n ) => {\n const { options, mutation } = ref.current;\n const baseOptions = { ...options, mutation };\n const client = executeOptions.client || ref.current.client;\n\n if (\n !ref.current.result.loading &&\n !baseOptions.ignoreResults &&\n ref.current.isMounted\n ) {\n setResult(\n (ref.current.result = {\n loading: true,\n error: void 0,\n data: void 0,\n called: true,\n client,\n })\n );\n }\n\n const mutationId = ++ref.current.mutationId;\n const clientOptions = mergeOptions(baseOptions, executeOptions);\n\n return client\n .mutate(clientOptions as MutationOptions)\n .then((response) => {\n const { data, errors } = response;\n const error =\n errors && errors.length > 0 ?\n new ApolloError({ graphQLErrors: errors })\n : void 0;\n\n const onError =\n executeOptions.onError || ref.current.options?.onError;\n\n if (error && onError) {\n onError(\n error,\n clientOptions as MutationOptions\n );\n }\n\n if (\n mutationId === ref.current.mutationId &&\n !clientOptions.ignoreResults\n ) {\n const result = {\n called: true,\n loading: false,\n data,\n error,\n client,\n };\n\n if (ref.current.isMounted && !equal(ref.current.result, result)) {\n setResult((ref.current.result = result));\n }\n }\n\n const onCompleted =\n executeOptions.onCompleted || ref.current.options?.onCompleted;\n\n if (!error) {\n onCompleted?.(\n response.data!,\n clientOptions as MutationOptions\n );\n }\n\n return response;\n })\n .catch((error) => {\n if (mutationId === ref.current.mutationId && ref.current.isMounted) {\n const result = {\n loading: false,\n error,\n data: void 0,\n called: true,\n client,\n };\n\n if (!equal(ref.current.result, result)) {\n setResult((ref.current.result = result));\n }\n }\n\n const onError =\n executeOptions.onError || ref.current.options?.onError;\n\n if (onError) {\n onError(\n error,\n clientOptions as MutationOptions\n );\n\n // TODO(brian): why are we returning this here???\n return { data: void 0, errors: error };\n }\n\n throw error;\n });\n },\n []\n );\n\n const reset = React.useCallback(() => {\n if (ref.current.isMounted) {\n const result = { called: false, loading: false, client };\n Object.assign(ref.current, { mutationId: 0, result });\n setResult(result);\n }\n }, []);\n\n React.useEffect(() => {\n ref.current.isMounted = true;\n\n return () => {\n ref.current.isMounted = false;\n };\n }, []);\n\n return [execute, { reset, ...result }];\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.d.ts new file mode 100644 index 0000000..9c848fb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.d.ts @@ -0,0 +1,87 @@ +import type { OperationVariables, WatchQueryFetchPolicy } from "../../core/index.js"; +import type { ApolloClient, ApolloQueryResult, DocumentNode, TypedDocumentNode } from "../../core/index.js"; +import type { QueryHookOptions, QueryResult, NoInfer } from "../types/types.js"; +import { useApolloClient } from "./useApolloClient.js"; +/** + * A hook for executing queries in an Apollo application. + * + * To run a query within a React component, call `useQuery` and pass it a GraphQL query document. + * + * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, and `data` properties you can use to render your UI. + * + * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`. + * + * @example + * ```jsx + * import { gql, useQuery } from '@apollo/client'; + * + * const GET_GREETING = gql` + * query GetGreeting($language: String!) { + * greeting(language: $language) { + * message + * } + * } + * `; + * + * function Hello() { + * const { loading, error, data } = useQuery(GET_GREETING, { + * variables: { language: 'english' }, + * }); + * if (loading) return

    Loading ...

    ; + * return

    Hello {data.greeting.message}!

    ; + * } + * ``` + * @since 3.0.0 + * @param query - A GraphQL query document parsed into an AST by `gql`. + * @param options - Options to control how the query is executed. + * @returns Query result object + */ +export declare function useQuery(query: DocumentNode | TypedDocumentNode, options?: QueryHookOptions, NoInfer>): QueryResult; +export declare function useInternalState(client: ApolloClient, query: DocumentNode | TypedDocumentNode): InternalState; +declare class InternalState { + readonly client: ReturnType; + readonly query: DocumentNode | TypedDocumentNode; + constructor(client: ReturnType, query: DocumentNode | TypedDocumentNode, previous?: InternalState); + /** + * Forces an update using local component state. + * As this is not batched with `useSyncExternalStore` updates, + * this is only used as a fallback if the `useSyncExternalStore` "force update" + * method is not registered at the moment. + * See https://github.com/facebook/react/issues/25191 + * */ + forceUpdateState(): void; + /** + * Will be overwritten by the `useSyncExternalStore` "force update" method + * whenever it is available and reset to `forceUpdateState` when it isn't. + */ + forceUpdate: () => void; + executeQuery(options: QueryHookOptions & { + query?: DocumentNode; + }): Promise>; + useQuery(options: QueryHookOptions): QueryResult; + private renderPromises; + private queryHookOptions; + private watchQueryOptions; + private useOptions; + private getObsQueryOptions; + private ssrDisabledResult; + private skipStandbyResult; + private createWatchQueryOptions; + getDefaultFetchPolicy(): WatchQueryFetchPolicy; + private onCompleted; + private onError; + private observable; + private obsQueryFields; + private useObservableQuery; + private result; + private previousData; + private setResult; + private handleErrorOrCompleted; + private toApolloError; + private getCurrentResult; + private toQueryResultCache; + toQueryResult(result: ApolloQueryResult): QueryResult; + private unsafeHandlePartialRefetch; +} +export {}; +//# sourceMappingURL=useQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js new file mode 100644 index 0000000..5bb13e3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js @@ -0,0 +1,467 @@ +import { __assign, __rest } from "tslib"; +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +import { useSyncExternalStore } from "./useSyncExternalStore.js"; +import { equal } from "@wry/equality"; +import { mergeOptions } from "../../utilities/index.js"; +import { getApolloContext } from "../context/index.js"; +import { ApolloError } from "../../errors/index.js"; +import { NetworkStatus } from "../../core/index.js"; +import { DocumentType, verifyDocumentType } from "../parser/index.js"; +import { useApolloClient } from "./useApolloClient.js"; +import { canUseWeakMap, compact, isNonEmptyArray, maybeDeepFreeze, } from "../../utilities/index.js"; +var hasOwnProperty = Object.prototype.hasOwnProperty; +/** + * A hook for executing queries in an Apollo application. + * + * To run a query within a React component, call `useQuery` and pass it a GraphQL query document. + * + * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, and `data` properties you can use to render your UI. + * + * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`. + * + * @example + * ```jsx + * import { gql, useQuery } from '@apollo/client'; + * + * const GET_GREETING = gql` + * query GetGreeting($language: String!) { + * greeting(language: $language) { + * message + * } + * } + * `; + * + * function Hello() { + * const { loading, error, data } = useQuery(GET_GREETING, { + * variables: { language: 'english' }, + * }); + * if (loading) return

    Loading ...

    ; + * return

    Hello {data.greeting.message}!

    ; + * } + * ``` + * @since 3.0.0 + * @param query - A GraphQL query document parsed into an AST by `gql`. + * @param options - Options to control how the query is executed. + * @returns Query result object + */ +export function useQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + return useInternalState(useApolloClient(options.client), query).useQuery(options); +} +export function useInternalState(client, query) { + var stateRef = React.useRef(); + if (!stateRef.current || + client !== stateRef.current.client || + query !== stateRef.current.query) { + stateRef.current = new InternalState(client, query, stateRef.current); + } + var state = stateRef.current; + // By default, InternalState.prototype.forceUpdate is an empty function, but + // we replace it here (before anyone has had a chance to see this state yet) + // with a function that unconditionally forces an update, using the latest + // setTick function. Updating this state by calling state.forceUpdate is the + // only way we trigger React component updates (no other useState calls within + // the InternalState class). + state.forceUpdateState = React.useReducer(function (tick) { return tick + 1; }, 0)[1]; + return state; +} +var InternalState = /** @class */ (function () { + function InternalState(client, query, previous) { + var _this = this; + this.client = client; + this.query = query; + /** + * Will be overwritten by the `useSyncExternalStore` "force update" method + * whenever it is available and reset to `forceUpdateState` when it isn't. + */ + this.forceUpdate = function () { return _this.forceUpdateState(); }; + this.ssrDisabledResult = maybeDeepFreeze({ + loading: true, + data: void 0, + error: void 0, + networkStatus: NetworkStatus.loading, + }); + this.skipStandbyResult = maybeDeepFreeze({ + loading: false, + data: void 0, + error: void 0, + networkStatus: NetworkStatus.ready, + }); + // This cache allows the referential stability of this.result (as returned by + // getCurrentResult) to translate into referential stability of the resulting + // QueryResult object returned by toQueryResult. + this.toQueryResultCache = new (canUseWeakMap ? WeakMap : Map)(); + verifyDocumentType(query, DocumentType.Query); + // Reuse previousData from previous InternalState (if any) to provide + // continuity of previousData even if/when the query or client changes. + var previousResult = previous && previous.result; + var previousData = previousResult && previousResult.data; + if (previousData) { + this.previousData = previousData; + } + } + /** + * Forces an update using local component state. + * As this is not batched with `useSyncExternalStore` updates, + * this is only used as a fallback if the `useSyncExternalStore` "force update" + * method is not registered at the moment. + * See https://github.com/facebook/react/issues/25191 + * */ + InternalState.prototype.forceUpdateState = function () { + // Replaced (in useInternalState) with a method that triggers an update. + globalThis.__DEV__ !== false && invariant.warn(51); + }; + InternalState.prototype.executeQuery = function (options) { + var _this = this; + var _a; + if (options.query) { + Object.assign(this, { query: options.query }); + } + this.watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + var concast = this.observable.reobserveAsConcast(this.getObsQueryOptions()); + // Make sure getCurrentResult returns a fresh ApolloQueryResult, + // but save the current data as this.previousData, just like setResult + // usually does. + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + this.forceUpdate(); + return new Promise(function (resolve) { + var result; + // Subscribe to the concast independently of the ObservableQuery in case + // the component gets unmounted before the promise resolves. This prevents + // the concast from terminating early and resolving with `undefined` when + // there are no more subscribers for the concast. + concast.subscribe({ + next: function (value) { + result = value; + }, + error: function () { + resolve(_this.toQueryResult(_this.observable.getCurrentResult())); + }, + complete: function () { + resolve(_this.toQueryResult(result)); + }, + }); + }); + }; + // Methods beginning with use- should be called according to the standard + // rules of React hooks: only at the top level of the calling function, and + // without any dynamic conditional logic. + InternalState.prototype.useQuery = function (options) { + var _this = this; + // The renderPromises field gets initialized here in the useQuery method, at + // the beginning of everything (for a given component rendering, at least), + // so we can safely use this.renderPromises in other/later InternalState + // methods without worrying it might be uninitialized. Even after + // initialization, this.renderPromises is usually undefined (unless SSR is + // happening), but that's fine as long as it has been initialized that way, + // rather than left uninitialized. + this.renderPromises = React.useContext(getApolloContext()).renderPromises; + this.useOptions(options); + var obsQuery = this.useObservableQuery(); + var result = useSyncExternalStore(React.useCallback(function (handleStoreChange) { + if (_this.renderPromises) { + return function () { }; + } + _this.forceUpdate = handleStoreChange; + var onNext = function () { + var previousResult = _this.result; + // We use `getCurrentResult()` instead of the onNext argument because + // the values differ slightly. Specifically, loading results will have + // an empty object for data instead of `undefined` for some reason. + var result = obsQuery.getCurrentResult(); + // Make sure we're not attempting to re-render similar results + if (previousResult && + previousResult.loading === result.loading && + previousResult.networkStatus === result.networkStatus && + equal(previousResult.data, result.data)) { + return; + } + _this.setResult(result); + }; + var onError = function (error) { + subscription.unsubscribe(); + subscription = obsQuery.resubscribeAfterError(onNext, onError); + if (!hasOwnProperty.call(error, "graphQLErrors")) { + // The error is not a GraphQL error + throw error; + } + var previousResult = _this.result; + if (!previousResult || + (previousResult && previousResult.loading) || + !equal(error, previousResult.error)) { + _this.setResult({ + data: (previousResult && previousResult.data), + error: error, + loading: false, + networkStatus: NetworkStatus.error, + }); + } + }; + var subscription = obsQuery.subscribe(onNext, onError); + // Do the "unsubscribe" with a short delay. + // This way, an existing subscription can be reused without an additional + // request if "unsubscribe" and "resubscribe" to the same ObservableQuery + // happen in very fast succession. + return function () { + setTimeout(function () { return subscription.unsubscribe(); }); + _this.forceUpdate = function () { return _this.forceUpdateState(); }; + }; + }, [ + // We memoize the subscribe function using useCallback and the following + // dependency keys, because the subscribe function reference is all that + // useSyncExternalStore uses internally as a dependency key for the + // useEffect ultimately responsible for the subscription, so we are + // effectively passing this dependency array to that useEffect buried + // inside useSyncExternalStore, as desired. + obsQuery, + this.renderPromises, + this.client.disableNetworkFetches, + ]), function () { return _this.getCurrentResult(); }, function () { return _this.getCurrentResult(); }); + // TODO Remove this method when we remove support for options.partialRefetch. + this.unsafeHandlePartialRefetch(result); + return this.toQueryResult(result); + }; + InternalState.prototype.useOptions = function (options) { + var _a; + var watchQueryOptions = this.createWatchQueryOptions((this.queryHookOptions = options)); + // Update this.watchQueryOptions, but only when they have changed, which + // allows us to depend on the referential stability of + // this.watchQueryOptions elsewhere. + var currentWatchQueryOptions = this.watchQueryOptions; + if (!equal(watchQueryOptions, currentWatchQueryOptions)) { + this.watchQueryOptions = watchQueryOptions; + if (currentWatchQueryOptions && this.observable) { + // Though it might be tempting to postpone this reobserve call to the + // useEffect block, we need getCurrentResult to return an appropriate + // loading:true result synchronously (later within the same call to + // useQuery). Since we already have this.observable here (not true for + // the very first call to useQuery), we are not initiating any new + // subscriptions, though it does feel less than ideal that reobserve + // (potentially) kicks off a network request (for example, when the + // variables have changed), which is technically a side-effect. + this.observable.reobserve(this.getObsQueryOptions()); + // Make sure getCurrentResult returns a fresh ApolloQueryResult, + // but save the current data as this.previousData, just like setResult + // usually does. + this.previousData = ((_a = this.result) === null || _a === void 0 ? void 0 : _a.data) || this.previousData; + this.result = void 0; + } + } + // Make sure state.onCompleted and state.onError always reflect the latest + // options.onCompleted and options.onError callbacks provided to useQuery, + // since those functions are often recreated every time useQuery is called. + // Like the forceUpdate method, the versions of these methods inherited from + // InternalState.prototype are empty no-ops, but we can override them on the + // base state object (without modifying the prototype). + this.onCompleted = + options.onCompleted || InternalState.prototype.onCompleted; + this.onError = options.onError || InternalState.prototype.onError; + if ((this.renderPromises || this.client.disableNetworkFetches) && + this.queryHookOptions.ssr === false && + !this.queryHookOptions.skip) { + // If SSR has been explicitly disabled, and this function has been called + // on the server side, return the default loading state. + this.result = this.ssrDisabledResult; + } + else if (this.queryHookOptions.skip || + this.watchQueryOptions.fetchPolicy === "standby") { + // When skipping a query (ie. we're not querying for data but still want to + // render children), make sure the `data` is cleared out and `loading` is + // set to `false` (since we aren't loading anything). + // + // NOTE: We no longer think this is the correct behavior. Skipping should + // not automatically set `data` to `undefined`, but instead leave the + // previous data in place. In other words, skipping should not mandate that + // previously received data is all of a sudden removed. Unfortunately, + // changing this is breaking, so we'll have to wait until Apollo Client 4.0 + // to address this. + this.result = this.skipStandbyResult; + } + else if (this.result === this.ssrDisabledResult || + this.result === this.skipStandbyResult) { + this.result = void 0; + } + }; + InternalState.prototype.getObsQueryOptions = function () { + var toMerge = []; + var globalDefaults = this.client.defaultOptions.watchQuery; + if (globalDefaults) + toMerge.push(globalDefaults); + if (this.queryHookOptions.defaultOptions) { + toMerge.push(this.queryHookOptions.defaultOptions); + } + // We use compact rather than mergeOptions for this part of the merge, + // because we want watchQueryOptions.variables (if defined) to replace + // this.observable.options.variables whole. This replacement allows + // removing variables by removing them from the variables input to + // useQuery. If the variables were always merged together (rather than + // replaced), there would be no way to remove existing variables. + // However, the variables from options.defaultOptions and globalDefaults + // (if provided) should be merged, to ensure individual defaulted + // variables always have values, if not otherwise defined in + // observable.options or watchQueryOptions. + toMerge.push(compact(this.observable && this.observable.options, this.watchQueryOptions)); + return toMerge.reduce(mergeOptions); + }; + // A function to massage options before passing them to ObservableQuery. + InternalState.prototype.createWatchQueryOptions = function (_a) { + var _b; + if (_a === void 0) { _a = {}; } + var skip = _a.skip, ssr = _a.ssr, onCompleted = _a.onCompleted, onError = _a.onError, defaultOptions = _a.defaultOptions, + // The above options are useQuery-specific, so this ...otherOptions spread + // makes otherOptions almost a WatchQueryOptions object, except for the + // query property that we add below. + otherOptions = __rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]); + // This Object.assign is safe because otherOptions is a fresh ...rest object + // that did not exist until just now, so modifications are still allowed. + var watchQueryOptions = Object.assign(otherOptions, { query: this.query }); + if (this.renderPromises && + (watchQueryOptions.fetchPolicy === "network-only" || + watchQueryOptions.fetchPolicy === "cache-and-network")) { + // this behavior was added to react-apollo without explanation in this PR + // https://github.com/apollographql/react-apollo/pull/1579 + watchQueryOptions.fetchPolicy = "cache-first"; + } + if (!watchQueryOptions.variables) { + watchQueryOptions.variables = {}; + } + if (skip) { + var _c = watchQueryOptions.fetchPolicy, fetchPolicy = _c === void 0 ? this.getDefaultFetchPolicy() : _c, _d = watchQueryOptions.initialFetchPolicy, initialFetchPolicy = _d === void 0 ? fetchPolicy : _d; + // When skipping, we set watchQueryOptions.fetchPolicy initially to + // "standby", but we also need/want to preserve the initial non-standby + // fetchPolicy that would have been used if not skipping. + Object.assign(watchQueryOptions, { + initialFetchPolicy: initialFetchPolicy, + fetchPolicy: "standby", + }); + } + else if (!watchQueryOptions.fetchPolicy) { + watchQueryOptions.fetchPolicy = + ((_b = this.observable) === null || _b === void 0 ? void 0 : _b.options.initialFetchPolicy) || + this.getDefaultFetchPolicy(); + } + return watchQueryOptions; + }; + InternalState.prototype.getDefaultFetchPolicy = function () { + var _a, _b; + return (((_a = this.queryHookOptions.defaultOptions) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + ((_b = this.client.defaultOptions.watchQuery) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + "cache-first"); + }; + // Defining these methods as no-ops on the prototype allows us to call + // state.onCompleted and/or state.onError without worrying about whether a + // callback was provided. + InternalState.prototype.onCompleted = function (data) { }; + InternalState.prototype.onError = function (error) { }; + InternalState.prototype.useObservableQuery = function () { + // See if there is an existing observable that was used to fetch the same + // data and if so, use it instead since it will contain the proper queryId + // to fetch the result set. This is used during SSR. + var obsQuery = (this.observable = + (this.renderPromises && + this.renderPromises.getSSRObservable(this.watchQueryOptions)) || + this.observable || // Reuse this.observable if possible (and not SSR) + this.client.watchQuery(this.getObsQueryOptions())); + this.obsQueryFields = React.useMemo(function () { return ({ + refetch: obsQuery.refetch.bind(obsQuery), + reobserve: obsQuery.reobserve.bind(obsQuery), + fetchMore: obsQuery.fetchMore.bind(obsQuery), + updateQuery: obsQuery.updateQuery.bind(obsQuery), + startPolling: obsQuery.startPolling.bind(obsQuery), + stopPolling: obsQuery.stopPolling.bind(obsQuery), + subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery), + }); }, [obsQuery]); + var ssrAllowed = !(this.queryHookOptions.ssr === false || this.queryHookOptions.skip); + if (this.renderPromises && ssrAllowed) { + this.renderPromises.registerSSRObservable(obsQuery); + if (obsQuery.getCurrentResult().loading) { + // TODO: This is a legacy API which could probably be cleaned up + this.renderPromises.addObservableQueryPromise(obsQuery); + } + } + return obsQuery; + }; + InternalState.prototype.setResult = function (nextResult) { + var previousResult = this.result; + if (previousResult && previousResult.data) { + this.previousData = previousResult.data; + } + this.result = nextResult; + // Calling state.setResult always triggers an update, though some call sites + // perform additional equality checks before committing to an update. + this.forceUpdate(); + this.handleErrorOrCompleted(nextResult, previousResult); + }; + InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) { + var _this = this; + if (!result.loading) { + var error_1 = this.toApolloError(result); + // wait a tick in case we are in the middle of rendering a component + Promise.resolve() + .then(function () { + if (error_1) { + _this.onError(error_1); + } + else if (result.data && + (previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus && + result.networkStatus === NetworkStatus.ready) { + _this.onCompleted(result.data); + } + }) + .catch(function (error) { + globalThis.__DEV__ !== false && invariant.warn(error); + }); + } + }; + InternalState.prototype.toApolloError = function (result) { + return isNonEmptyArray(result.errors) ? + new ApolloError({ graphQLErrors: result.errors }) + : result.error; + }; + InternalState.prototype.getCurrentResult = function () { + // Using this.result as a cache ensures getCurrentResult continues returning + // the same (===) result object, unless state.setResult has been called, or + // we're doing server rendering and therefore override the result below. + if (!this.result) { + this.handleErrorOrCompleted((this.result = this.observable.getCurrentResult())); + } + return this.result; + }; + InternalState.prototype.toQueryResult = function (result) { + var queryResult = this.toQueryResultCache.get(result); + if (queryResult) + return queryResult; + var data = result.data, partial = result.partial, resultWithoutPartial = __rest(result, ["data", "partial"]); + this.toQueryResultCache.set(result, (queryResult = __assign(__assign(__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData }))); + if (!queryResult.error && isNonEmptyArray(result.errors)) { + // Until a set naming convention for networkError and graphQLErrors is + // decided upon, we map errors (graphQLErrors) to the error options. + // TODO: Is it possible for both result.error and result.errors to be + // defined here? + queryResult.error = new ApolloError({ graphQLErrors: result.errors }); + } + return queryResult; + }; + InternalState.prototype.unsafeHandlePartialRefetch = function (result) { + // WARNING: SIDE-EFFECTS IN THE RENDER FUNCTION + // + // TODO: This code should be removed when the partialRefetch option is + // removed. I was unable to get this hook to behave reasonably in certain + // edge cases when this block was put in an effect. + if (result.partial && + this.queryHookOptions.partialRefetch && + !result.loading && + (!result.data || Object.keys(result.data).length === 0) && + this.observable.options.fetchPolicy !== "cache-only") { + Object.assign(result, { + loading: true, + networkStatus: NetworkStatus.refetch, + }); + this.observable.refetch(); + } + }; + return InternalState; +}()); +//# sourceMappingURL=useQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js.map new file mode 100644 index 0000000..3f38441 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useQuery.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAMtC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQpD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,aAAa,EACb,OAAO,EACP,eAAe,EACf,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAGnB,IAAA,cAAc,GACzB,MAAM,yBADmB,CAClB;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,QAAQ,CAItB,KAA0D,EAC1D,OAGuB;IAHvB,wBAAA,EAAA,UAGI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEvB,OAAO,gBAAgB,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK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EAAE,IAAI,CAAC,YAAY,GAChC,CAAC,CACH,CAAC;QAEF,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACzD,sEAAsE;YACtE,oEAAoE;YACpE,qEAAqE;YACrE,gBAAgB;YAChB,WAAW,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,kDAA0B,GAAlC,UAAmC,MAAgC;QACjE,+CAA+C;QAC/C,EAAE;QACF,sEAAsE;QACtE,yEAAyE;QACzE,mDAAmD;QACnD,IACE,MAAM,CAAC,OAAO;YACd,IAAI,CAAC,gBAAgB,CAAC,cAAc;YACpC,CAAC,MAAM,CAAC,OAAO;YACf,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;YACvD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,KAAK,YAAY,EACpD,CAAC;YACD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;gBACpB,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,aAAa,CAAC,OAAO;aACrC,CAAC,CAAC;YACH,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AApiBD,IAoiBC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport * as React from \"rehackt\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { equal } from \"@wry/equality\";\n\nimport type {\n OperationVariables,\n WatchQueryFetchPolicy,\n} from \"../../core/index.js\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport type { ApolloContextValue } from \"../context/index.js\";\nimport { getApolloContext } from \"../context/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloClient,\n ApolloQueryResult,\n ObservableQuery,\n DocumentNode,\n TypedDocumentNode,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport { NetworkStatus } from \"../../core/index.js\";\nimport type {\n QueryHookOptions,\n QueryResult,\n ObservableQueryFields,\n NoInfer,\n} from \"../types/types.js\";\n\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport {\n canUseWeakMap,\n compact,\n isNonEmptyArray,\n maybeDeepFreeze,\n} from \"../../utilities/index.js\";\n\nconst {\n prototype: { hasOwnProperty },\n} = Object;\n\n/**\n * A hook for executing queries in an Apollo application.\n *\n * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.\n *\n * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, and `data` properties you can use to render your UI.\n *\n * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useQuery } from '@apollo/client';\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const { loading, error, data } = useQuery(GET_GREETING, {\n * variables: { language: 'english' },\n * });\n * if (loading) return

    Loading ...

    ;\n * return

    Hello {data.greeting.message}!

    ;\n * }\n * ```\n * @since 3.0.0\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Options to control how the query is executed.\n * @returns Query result object\n */\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: QueryHookOptions<\n NoInfer,\n NoInfer\n > = Object.create(null)\n): QueryResult {\n return useInternalState(useApolloClient(options.client), query).useQuery(\n options\n );\n}\n\nexport function useInternalState(\n client: ApolloClient,\n query: DocumentNode | TypedDocumentNode\n): InternalState {\n const stateRef = React.useRef>();\n if (\n !stateRef.current ||\n client !== stateRef.current.client ||\n query !== stateRef.current.query\n ) {\n stateRef.current = new InternalState(client, query, stateRef.current);\n }\n const state = stateRef.current;\n\n // By default, InternalState.prototype.forceUpdate is an empty function, but\n // we replace it here (before anyone has had a chance to see this state yet)\n // with a function that unconditionally forces an update, using the latest\n // setTick function. Updating this state by calling state.forceUpdate is the\n // only way we trigger React component updates (no other useState calls within\n // the InternalState class).\n state.forceUpdateState = React.useReducer((tick) => tick + 1, 0)[1];\n\n return state;\n}\n\nclass InternalState {\n constructor(\n public readonly client: ReturnType,\n public readonly query: DocumentNode | TypedDocumentNode,\n previous?: InternalState\n ) {\n verifyDocumentType(query, DocumentType.Query);\n\n // Reuse previousData from previous InternalState (if any) to provide\n // continuity of previousData even if/when the query or client changes.\n const previousResult = previous && previous.result;\n const previousData = previousResult && previousResult.data;\n if (previousData) {\n this.previousData = previousData;\n }\n }\n\n /**\n * Forces an update using local component state.\n * As this is not batched with `useSyncExternalStore` updates,\n * this is only used as a fallback if the `useSyncExternalStore` \"force update\"\n * method is not registered at the moment.\n * See https://github.com/facebook/react/issues/25191\n * */\n forceUpdateState() {\n // Replaced (in useInternalState) with a method that triggers an update.\n invariant.warn(\n \"Calling default no-op implementation of InternalState#forceUpdate\"\n );\n }\n\n /**\n * Will be overwritten by the `useSyncExternalStore` \"force update\" method\n * whenever it is available and reset to `forceUpdateState` when it isn't.\n */\n forceUpdate = () => this.forceUpdateState();\n\n executeQuery(\n options: QueryHookOptions & {\n query?: DocumentNode;\n }\n ) {\n if (options.query) {\n Object.assign(this, { query: options.query });\n }\n\n this.watchQueryOptions = this.createWatchQueryOptions(\n (this.queryHookOptions = options)\n );\n\n const concast = this.observable.reobserveAsConcast(\n this.getObsQueryOptions()\n );\n\n // Make sure getCurrentResult returns a fresh ApolloQueryResult,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n this.previousData = this.result?.data || this.previousData;\n this.result = void 0;\n this.forceUpdate();\n\n return new Promise>((resolve) => {\n let result: ApolloQueryResult;\n\n // Subscribe to the concast independently of the ObservableQuery in case\n // the component gets unmounted before the promise resolves. This prevents\n // the concast from terminating early and resolving with `undefined` when\n // there are no more subscribers for the concast.\n concast.subscribe({\n next: (value) => {\n result = value;\n },\n error: () => {\n resolve(this.toQueryResult(this.observable.getCurrentResult()));\n },\n complete: () => {\n resolve(this.toQueryResult(result));\n },\n });\n });\n }\n\n // Methods beginning with use- should be called according to the standard\n // rules of React hooks: only at the top level of the calling function, and\n // without any dynamic conditional logic.\n useQuery(options: QueryHookOptions) {\n // The renderPromises field gets initialized here in the useQuery method, at\n // the beginning of everything (for a given component rendering, at least),\n // so we can safely use this.renderPromises in other/later InternalState\n // methods without worrying it might be uninitialized. Even after\n // initialization, this.renderPromises is usually undefined (unless SSR is\n // happening), but that's fine as long as it has been initialized that way,\n // rather than left uninitialized.\n this.renderPromises = React.useContext(getApolloContext()).renderPromises;\n\n this.useOptions(options);\n\n const obsQuery = this.useObservableQuery();\n\n const result = useSyncExternalStore(\n React.useCallback(\n (handleStoreChange) => {\n if (this.renderPromises) {\n return () => {};\n }\n\n this.forceUpdate = handleStoreChange;\n\n const onNext = () => {\n const previousResult = this.result;\n // We use `getCurrentResult()` instead of the onNext argument because\n // the values differ slightly. Specifically, loading results will have\n // an empty object for data instead of `undefined` for some reason.\n const result = obsQuery.getCurrentResult();\n // Make sure we're not attempting to re-render similar results\n if (\n previousResult &&\n previousResult.loading === result.loading &&\n previousResult.networkStatus === result.networkStatus &&\n equal(previousResult.data, result.data)\n ) {\n return;\n }\n\n this.setResult(result);\n };\n\n const onError = (error: Error) => {\n subscription.unsubscribe();\n subscription = obsQuery.resubscribeAfterError(onNext, onError);\n\n if (!hasOwnProperty.call(error, \"graphQLErrors\")) {\n // The error is not a GraphQL error\n throw error;\n }\n\n const previousResult = this.result;\n if (\n !previousResult ||\n (previousResult && previousResult.loading) ||\n !equal(error, previousResult.error)\n ) {\n this.setResult({\n data: (previousResult && previousResult.data) as TData,\n error: error as ApolloError,\n loading: false,\n networkStatus: NetworkStatus.error,\n });\n }\n };\n\n let subscription = obsQuery.subscribe(onNext, onError);\n\n // Do the \"unsubscribe\" with a short delay.\n // This way, an existing subscription can be reused without an additional\n // request if \"unsubscribe\" and \"resubscribe\" to the same ObservableQuery\n // happen in very fast succession.\n return () => {\n setTimeout(() => subscription.unsubscribe());\n this.forceUpdate = () => this.forceUpdateState();\n };\n },\n [\n // We memoize the subscribe function using useCallback and the following\n // dependency keys, because the subscribe function reference is all that\n // useSyncExternalStore uses internally as a dependency key for the\n // useEffect ultimately responsible for the subscription, so we are\n // effectively passing this dependency array to that useEffect buried\n // inside useSyncExternalStore, as desired.\n obsQuery,\n this.renderPromises,\n this.client.disableNetworkFetches,\n ]\n ),\n\n () => this.getCurrentResult(),\n () => this.getCurrentResult()\n );\n\n // TODO Remove this method when we remove support for options.partialRefetch.\n this.unsafeHandlePartialRefetch(result);\n\n return this.toQueryResult(result);\n }\n\n // These members (except for renderPromises) are all populated by the\n // useOptions method, which is called unconditionally at the beginning of the\n // useQuery method, so we can safely use these members in other/later methods\n // without worrying they might be uninitialized.\n private renderPromises: ApolloContextValue[\"renderPromises\"];\n private queryHookOptions!: QueryHookOptions;\n private watchQueryOptions!: WatchQueryOptions;\n\n private useOptions(options: QueryHookOptions) {\n const watchQueryOptions = this.createWatchQueryOptions(\n (this.queryHookOptions = options)\n );\n\n // Update this.watchQueryOptions, but only when they have changed, which\n // allows us to depend on the referential stability of\n // this.watchQueryOptions elsewhere.\n const currentWatchQueryOptions = this.watchQueryOptions;\n\n if (!equal(watchQueryOptions, currentWatchQueryOptions)) {\n this.watchQueryOptions = watchQueryOptions;\n\n if (currentWatchQueryOptions && this.observable) {\n // Though it might be tempting to postpone this reobserve call to the\n // useEffect block, we need getCurrentResult to return an appropriate\n // loading:true result synchronously (later within the same call to\n // useQuery). Since we already have this.observable here (not true for\n // the very first call to useQuery), we are not initiating any new\n // subscriptions, though it does feel less than ideal that reobserve\n // (potentially) kicks off a network request (for example, when the\n // variables have changed), which is technically a side-effect.\n this.observable.reobserve(this.getObsQueryOptions());\n\n // Make sure getCurrentResult returns a fresh ApolloQueryResult,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n this.previousData = this.result?.data || this.previousData;\n this.result = void 0;\n }\n }\n\n // Make sure state.onCompleted and state.onError always reflect the latest\n // options.onCompleted and options.onError callbacks provided to useQuery,\n // since those functions are often recreated every time useQuery is called.\n // Like the forceUpdate method, the versions of these methods inherited from\n // InternalState.prototype are empty no-ops, but we can override them on the\n // base state object (without modifying the prototype).\n this.onCompleted =\n options.onCompleted || InternalState.prototype.onCompleted;\n this.onError = options.onError || InternalState.prototype.onError;\n\n if (\n (this.renderPromises || this.client.disableNetworkFetches) &&\n this.queryHookOptions.ssr === false &&\n !this.queryHookOptions.skip\n ) {\n // If SSR has been explicitly disabled, and this function has been called\n // on the server side, return the default loading state.\n this.result = this.ssrDisabledResult;\n } else if (\n this.queryHookOptions.skip ||\n this.watchQueryOptions.fetchPolicy === \"standby\"\n ) {\n // When skipping a query (ie. we're not querying for data but still want to\n // render children), make sure the `data` is cleared out and `loading` is\n // set to `false` (since we aren't loading anything).\n //\n // NOTE: We no longer think this is the correct behavior. Skipping should\n // not automatically set `data` to `undefined`, but instead leave the\n // previous data in place. In other words, skipping should not mandate that\n // previously received data is all of a sudden removed. Unfortunately,\n // changing this is breaking, so we'll have to wait until Apollo Client 4.0\n // to address this.\n this.result = this.skipStandbyResult;\n } else if (\n this.result === this.ssrDisabledResult ||\n this.result === this.skipStandbyResult\n ) {\n this.result = void 0;\n }\n }\n\n private getObsQueryOptions(): WatchQueryOptions {\n const toMerge: Array>> = [];\n\n const globalDefaults = this.client.defaultOptions.watchQuery;\n if (globalDefaults) toMerge.push(globalDefaults);\n\n if (this.queryHookOptions.defaultOptions) {\n toMerge.push(this.queryHookOptions.defaultOptions);\n }\n\n // We use compact rather than mergeOptions for this part of the merge,\n // because we want watchQueryOptions.variables (if defined) to replace\n // this.observable.options.variables whole. This replacement allows\n // removing variables by removing them from the variables input to\n // useQuery. If the variables were always merged together (rather than\n // replaced), there would be no way to remove existing variables.\n // However, the variables from options.defaultOptions and globalDefaults\n // (if provided) should be merged, to ensure individual defaulted\n // variables always have values, if not otherwise defined in\n // observable.options or watchQueryOptions.\n toMerge.push(\n compact(\n this.observable && this.observable.options,\n this.watchQueryOptions\n )\n );\n\n return toMerge.reduce(mergeOptions) as WatchQueryOptions;\n }\n\n private ssrDisabledResult = maybeDeepFreeze({\n loading: true,\n data: void 0 as unknown as TData,\n error: void 0,\n networkStatus: NetworkStatus.loading,\n });\n\n private skipStandbyResult = maybeDeepFreeze({\n loading: false,\n data: void 0 as unknown as TData,\n error: void 0,\n networkStatus: NetworkStatus.ready,\n });\n\n // A function to massage options before passing them to ObservableQuery.\n private createWatchQueryOptions({\n skip,\n ssr,\n onCompleted,\n onError,\n defaultOptions,\n // The above options are useQuery-specific, so this ...otherOptions spread\n // makes otherOptions almost a WatchQueryOptions object, except for the\n // query property that we add below.\n ...otherOptions\n }: QueryHookOptions = {}): WatchQueryOptions<\n TVariables,\n TData\n > {\n // This Object.assign is safe because otherOptions is a fresh ...rest object\n // that did not exist until just now, so modifications are still allowed.\n const watchQueryOptions: WatchQueryOptions =\n Object.assign(otherOptions, { query: this.query });\n\n if (\n this.renderPromises &&\n (watchQueryOptions.fetchPolicy === \"network-only\" ||\n watchQueryOptions.fetchPolicy === \"cache-and-network\")\n ) {\n // this behavior was added to react-apollo without explanation in this PR\n // https://github.com/apollographql/react-apollo/pull/1579\n watchQueryOptions.fetchPolicy = \"cache-first\";\n }\n\n if (!watchQueryOptions.variables) {\n watchQueryOptions.variables = {} as TVariables;\n }\n\n if (skip) {\n const {\n fetchPolicy = this.getDefaultFetchPolicy(),\n initialFetchPolicy = fetchPolicy,\n } = watchQueryOptions;\n\n // When skipping, we set watchQueryOptions.fetchPolicy initially to\n // \"standby\", but we also need/want to preserve the initial non-standby\n // fetchPolicy that would have been used if not skipping.\n Object.assign(watchQueryOptions, {\n initialFetchPolicy,\n fetchPolicy: \"standby\",\n });\n } else if (!watchQueryOptions.fetchPolicy) {\n watchQueryOptions.fetchPolicy =\n this.observable?.options.initialFetchPolicy ||\n this.getDefaultFetchPolicy();\n }\n\n return watchQueryOptions;\n }\n\n getDefaultFetchPolicy(): WatchQueryFetchPolicy {\n return (\n this.queryHookOptions.defaultOptions?.fetchPolicy ||\n this.client.defaultOptions.watchQuery?.fetchPolicy ||\n \"cache-first\"\n );\n }\n\n // Defining these methods as no-ops on the prototype allows us to call\n // state.onCompleted and/or state.onError without worrying about whether a\n // callback was provided.\n private onCompleted(data: TData) {}\n private onError(error: ApolloError) {}\n\n private observable!: ObservableQuery;\n private obsQueryFields!: Omit<\n ObservableQueryFields,\n \"variables\"\n >;\n\n private useObservableQuery() {\n // See if there is an existing observable that was used to fetch the same\n // data and if so, use it instead since it will contain the proper queryId\n // to fetch the result set. This is used during SSR.\n const obsQuery = (this.observable =\n (this.renderPromises &&\n this.renderPromises.getSSRObservable(this.watchQueryOptions)) ||\n this.observable || // Reuse this.observable if possible (and not SSR)\n this.client.watchQuery(this.getObsQueryOptions()));\n\n this.obsQueryFields = React.useMemo(\n () => ({\n refetch: obsQuery.refetch.bind(obsQuery),\n reobserve: obsQuery.reobserve.bind(obsQuery),\n fetchMore: obsQuery.fetchMore.bind(obsQuery),\n updateQuery: obsQuery.updateQuery.bind(obsQuery),\n startPolling: obsQuery.startPolling.bind(obsQuery),\n stopPolling: obsQuery.stopPolling.bind(obsQuery),\n subscribeToMore: obsQuery.subscribeToMore.bind(obsQuery),\n }),\n [obsQuery]\n );\n\n const ssrAllowed = !(\n this.queryHookOptions.ssr === false || this.queryHookOptions.skip\n );\n\n if (this.renderPromises && ssrAllowed) {\n this.renderPromises.registerSSRObservable(obsQuery);\n\n if (obsQuery.getCurrentResult().loading) {\n // TODO: This is a legacy API which could probably be cleaned up\n this.renderPromises.addObservableQueryPromise(obsQuery);\n }\n }\n\n return obsQuery;\n }\n\n // These members are populated by getCurrentResult and setResult, and it's\n // okay/normal for them to be initially undefined.\n private result: undefined | ApolloQueryResult;\n private previousData: undefined | TData;\n\n private setResult(nextResult: ApolloQueryResult) {\n const previousResult = this.result;\n if (previousResult && previousResult.data) {\n this.previousData = previousResult.data;\n }\n this.result = nextResult;\n // Calling state.setResult always triggers an update, though some call sites\n // perform additional equality checks before committing to an update.\n this.forceUpdate();\n this.handleErrorOrCompleted(nextResult, previousResult);\n }\n\n private handleErrorOrCompleted(\n result: ApolloQueryResult,\n previousResult?: ApolloQueryResult\n ) {\n if (!result.loading) {\n const error = this.toApolloError(result);\n\n // wait a tick in case we are in the middle of rendering a component\n Promise.resolve()\n .then(() => {\n if (error) {\n this.onError(error);\n } else if (\n result.data &&\n previousResult?.networkStatus !== result.networkStatus &&\n result.networkStatus === NetworkStatus.ready\n ) {\n this.onCompleted(result.data);\n }\n })\n .catch((error) => {\n invariant.warn(error);\n });\n }\n }\n\n private toApolloError(\n result: ApolloQueryResult\n ): ApolloError | undefined {\n return isNonEmptyArray(result.errors) ?\n new ApolloError({ graphQLErrors: result.errors })\n : result.error;\n }\n\n private getCurrentResult(): ApolloQueryResult {\n // Using this.result as a cache ensures getCurrentResult continues returning\n // the same (===) result object, unless state.setResult has been called, or\n // we're doing server rendering and therefore override the result below.\n if (!this.result) {\n this.handleErrorOrCompleted(\n (this.result = this.observable.getCurrentResult())\n );\n }\n return this.result;\n }\n\n // This cache allows the referential stability of this.result (as returned by\n // getCurrentResult) to translate into referential stability of the resulting\n // QueryResult object returned by toQueryResult.\n private toQueryResultCache = new (canUseWeakMap ? WeakMap : Map)<\n ApolloQueryResult,\n QueryResult\n >();\n\n toQueryResult(\n result: ApolloQueryResult\n ): QueryResult {\n let queryResult = this.toQueryResultCache.get(result);\n if (queryResult) return queryResult;\n\n const { data, partial, ...resultWithoutPartial } = result;\n this.toQueryResultCache.set(\n result,\n (queryResult = {\n data, // Ensure always defined, even if result.data is missing.\n ...resultWithoutPartial,\n ...this.obsQueryFields,\n client: this.client,\n observable: this.observable,\n variables: this.observable.variables,\n called: !this.queryHookOptions.skip,\n previousData: this.previousData,\n })\n );\n\n if (!queryResult.error && isNonEmptyArray(result.errors)) {\n // Until a set naming convention for networkError and graphQLErrors is\n // decided upon, we map errors (graphQLErrors) to the error options.\n // TODO: Is it possible for both result.error and result.errors to be\n // defined here?\n queryResult.error = new ApolloError({ graphQLErrors: result.errors });\n }\n\n return queryResult;\n }\n\n private unsafeHandlePartialRefetch(result: ApolloQueryResult) {\n // WARNING: SIDE-EFFECTS IN THE RENDER FUNCTION\n //\n // TODO: This code should be removed when the partialRefetch option is\n // removed. I was unable to get this hook to behave reasonably in certain\n // edge cases when this block was put in an effect.\n if (\n result.partial &&\n this.queryHookOptions.partialRefetch &&\n !result.loading &&\n (!result.data || Object.keys(result.data).length === 0) &&\n this.observable.options.fetchPolicy !== \"cache-only\"\n ) {\n Object.assign(result, {\n loading: true,\n networkStatus: NetworkStatus.refetch,\n });\n this.observable.refetch();\n }\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.d.ts new file mode 100644 index 0000000..9b7c4c6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.d.ts @@ -0,0 +1,36 @@ +import type { QueryReference } from "../internal/index.js"; +import type { OperationVariables } from "../../core/types.js"; +import type { RefetchFunction, FetchMoreFunction } from "./useSuspenseQuery.js"; +export interface UseQueryRefHandlersResult { + /** + * Update the variables of this observable query, and fetch the new results. This method should be preferred over `setVariables` in most use cases. + * + * @param variables - The new set of variables. If there are missing variables, the previous values of those variables will be used. + */ + refetch: RefetchFunction; + /** + * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/). + */ + fetchMore: FetchMoreFunction; +} +/** + * A React hook that returns a `refetch` and `fetchMore` function for a given + * `queryRef`. + * + * This is useful to get access to handlers for a `queryRef` that was created by + * `createQueryPreloader` or when the handlers for a `queryRef` produced in + * a different component are inaccessible. + * + * @example + * ```tsx + * const MyComponent({ queryRef }) { + * const { refetch, fetchMore } = useQueryRefHandlers(queryRef); + * + * // ... + * } + * ``` + * @since 3.9.0 + * @param queryRef - A `QueryReference` returned from `useBackgroundQuery`, `useLoadableQuery`, or `createQueryPreloader`. + */ +export declare function useQueryRefHandlers(queryRef: QueryReference): UseQueryRefHandlersResult; +//# sourceMappingURL=useQueryRefHandlers.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js new file mode 100644 index 0000000..ba60b8d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js @@ -0,0 +1,48 @@ +import * as React from "rehackt"; +import { getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "../internal/index.js"; +/** + * A React hook that returns a `refetch` and `fetchMore` function for a given + * `queryRef`. + * + * This is useful to get access to handlers for a `queryRef` that was created by + * `createQueryPreloader` or when the handlers for a `queryRef` produced in + * a different component are inaccessible. + * + * @example + * ```tsx + * const MyComponent({ queryRef }) { + * const { refetch, fetchMore } = useQueryRefHandlers(queryRef); + * + * // ... + * } + * ``` + * @since 3.9.0 + * @param queryRef - A `QueryReference` returned from `useBackgroundQuery`, `useLoadableQuery`, or `createQueryPreloader`. + */ +export function useQueryRefHandlers(queryRef) { + var _a = React.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1]; + var _b = React.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1]; + var internalQueryRef = unwrapQueryRef(queryRef); + // To ensure we can support React transitions, this hook needs to manage the + // queryRef state and apply React's state value immediately to the existing + // queryRef since this hook doesn't return the queryRef directly + if (previousQueryRef !== queryRef) { + setPreviousQueryRef(queryRef); + setWrappedQueryRef(queryRef); + } + else { + updateWrappedQueryRef(queryRef, getWrappedPromise(wrappedQueryRef)); + } + var refetch = React.useCallback(function (variables) { + var promise = internalQueryRef.refetch(variables); + setWrappedQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + var fetchMore = React.useCallback(function (options) { + var promise = internalQueryRef.fetchMore(options); + setWrappedQueryRef(wrapQueryRef(internalQueryRef)); + return promise; + }, [internalQueryRef]); + return { refetch: refetch, fetchMore: fetchMore }; +} +//# sourceMappingURL=useQueryRefHandlers.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js.map new file mode 100644 index 0000000..ce51884 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useQueryRefHandlers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useQueryRefHandlers.js","sourceRoot":"","sources":["../../../src/react/hooks/useQueryRefHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAgB9B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mBAAmB,CAIjC,QAA2C;IAErC,IAAA,KAA0C,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAjE,gBAAgB,QAAA,EAAE,mBAAmB,QAA4B,CAAC;IACnE,IAAA,KAAwC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAA/D,eAAe,QAAA,EAAE,kBAAkB,QAA4B,CAAC;IACvE,IAAM,gBAAgB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAElD,4EAA4E;IAC5E,2EAA2E;IAC3E,gEAAgE;IAChE,IAAI,gBAAgB,KAAK,QAAQ,EAAE,CAAC;QAClC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC9B,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,qBAAqB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,IAAM,OAAO,GAAuC,KAAK,CAAC,WAAW,CACnE,UAAC,SAAS;QACR,IAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEpD,kBAAkB,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,IAAM,SAAS,GAAyC,KAAK,CAAC,WAAW,CACvE,UAAC,OAAO;QACN,IAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,CACxC,OAA0C,CAC3C,CAAC;QAEF,kBAAkB,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,EAAE,OAAO,SAAA,EAAE,SAAS,WAAA,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport {\n getWrappedPromise,\n unwrapQueryRef,\n updateWrappedQueryRef,\n wrapQueryRef,\n} from \"../internal/index.js\";\nimport type { QueryReference } from \"../internal/index.js\";\nimport type { OperationVariables } from \"../../core/types.js\";\nimport type { RefetchFunction, FetchMoreFunction } from \"./useSuspenseQuery.js\";\nimport type { FetchMoreQueryOptions } from \"../../core/watchQueryOptions.js\";\n\nexport interface UseQueryRefHandlersResult<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!ObservableQuery#refetch:member(1)} */\n refetch: RefetchFunction;\n /** {@inheritDoc @apollo/client!ObservableQuery#fetchMore:member(1)} */\n fetchMore: FetchMoreFunction;\n}\n\n/**\n * A React hook that returns a `refetch` and `fetchMore` function for a given\n * `queryRef`.\n *\n * This is useful to get access to handlers for a `queryRef` that was created by\n * `createQueryPreloader` or when the handlers for a `queryRef` produced in\n * a different component are inaccessible.\n *\n * @example\n * ```tsx\n * const MyComponent({ queryRef }) {\n * const { refetch, fetchMore } = useQueryRefHandlers(queryRef);\n *\n * // ...\n * }\n * ```\n * @since 3.9.0\n * @param queryRef - A `QueryReference` returned from `useBackgroundQuery`, `useLoadableQuery`, or `createQueryPreloader`.\n */\nexport function useQueryRefHandlers<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n queryRef: QueryReference\n): UseQueryRefHandlersResult {\n const [previousQueryRef, setPreviousQueryRef] = React.useState(queryRef);\n const [wrappedQueryRef, setWrappedQueryRef] = React.useState(queryRef);\n const internalQueryRef = unwrapQueryRef(queryRef);\n\n // To ensure we can support React transitions, this hook needs to manage the\n // queryRef state and apply React's state value immediately to the existing\n // queryRef since this hook doesn't return the queryRef directly\n if (previousQueryRef !== queryRef) {\n setPreviousQueryRef(queryRef);\n setWrappedQueryRef(queryRef);\n } else {\n updateWrappedQueryRef(queryRef, getWrappedPromise(wrappedQueryRef));\n }\n\n const refetch: RefetchFunction = React.useCallback(\n (variables) => {\n const promise = internalQueryRef.refetch(variables);\n\n setWrappedQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n const fetchMore: FetchMoreFunction = React.useCallback(\n (options) => {\n const promise = internalQueryRef.fetchMore(\n options as FetchMoreQueryOptions\n );\n\n setWrappedQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n return { refetch, fetchMore };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.d.ts new file mode 100644 index 0000000..7396702 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.d.ts @@ -0,0 +1,20 @@ +import type { ReactiveVar } from "../../core/index.js"; +/** + * Reads the value of a [reactive variable](https://www.apollographql.com/docs/react/local-state/reactive-variables/) and re-renders the containing component whenever that variable's value changes. This enables a reactive variable to trigger changes _without_ relying on the `useQuery` hook. + * + * @example + * ```jsx + * import { makeVar, useReactiveVar } from "@apollo/client"; + * export const cartItemsVar = makeVar([]); + * + * export function Cart() { + * const cartItems = useReactiveVar(cartItemsVar); + * // ... + * } + * ``` + * @since 3.2.0 + * @param rv - A reactive variable. + * @returns The current value of the reactive variable. + */ +export declare function useReactiveVar(rv: ReactiveVar): T; +//# sourceMappingURL=useReactiveVar.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js new file mode 100644 index 0000000..523dca6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js @@ -0,0 +1,33 @@ +import * as React from "rehackt"; +import { useSyncExternalStore } from "./useSyncExternalStore.js"; +/** + * Reads the value of a [reactive variable](https://www.apollographql.com/docs/react/local-state/reactive-variables/) and re-renders the containing component whenever that variable's value changes. This enables a reactive variable to trigger changes _without_ relying on the `useQuery` hook. + * + * @example + * ```jsx + * import { makeVar, useReactiveVar } from "@apollo/client"; + * export const cartItemsVar = makeVar([]); + * + * export function Cart() { + * const cartItems = useReactiveVar(cartItemsVar); + * // ... + * } + * ``` + * @since 3.2.0 + * @param rv - A reactive variable. + * @returns The current value of the reactive variable. + */ +export function useReactiveVar(rv) { + return useSyncExternalStore(React.useCallback(function (update) { + // By reusing the same onNext function in the nested call to + // rv.onNextChange(onNext), we can keep using the initial clean-up function + // returned by rv.onNextChange(function onNext(v){...}), without having to + // register the new clean-up function (returned by the nested + // rv.onNextChange(onNext)) with yet another callback. + return rv.onNextChange(function onNext() { + update(); + rv.onNextChange(onNext); + }); + }, [rv]), rv, rv); +} +//# sourceMappingURL=useReactiveVar.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js.map new file mode 100644 index 0000000..ad2ed7c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReactiveVar.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useReactiveVar.js","sourceRoot":"","sources":["../../../src/react/hooks/useReactiveVar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAAI,EAAkB;IAClD,OAAO,oBAAoB,CACzB,KAAK,CAAC,WAAW,CACf,UAAC,MAAM;QACL,4DAA4D;QAC5D,2EAA2E;QAC3E,0EAA0E;QAC1E,6DAA6D;QAC7D,sDAAsD;QACtD,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,MAAM;YACpC,MAAM,EAAE,CAAC;YACT,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC,EACD,CAAC,EAAE,CAAC,CACL,EACD,EAAE,EACF,EAAE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type { ReactiveVar } from \"../../core/index.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\n\n/**\n * Reads the value of a [reactive variable](https://www.apollographql.com/docs/react/local-state/reactive-variables/) and re-renders the containing component whenever that variable's value changes. This enables a reactive variable to trigger changes _without_ relying on the `useQuery` hook.\n *\n * @example\n * ```jsx\n * import { makeVar, useReactiveVar } from \"@apollo/client\";\n * export const cartItemsVar = makeVar([]);\n *\n * export function Cart() {\n * const cartItems = useReactiveVar(cartItemsVar);\n * // ...\n * }\n * ```\n * @since 3.2.0\n * @param rv - A reactive variable.\n * @returns The current value of the reactive variable.\n */\nexport function useReactiveVar(rv: ReactiveVar): T {\n return useSyncExternalStore(\n React.useCallback(\n (update) => {\n // By reusing the same onNext function in the nested call to\n // rv.onNextChange(onNext), we can keep using the initial clean-up function\n // returned by rv.onNextChange(function onNext(v){...}), without having to\n // register the new clean-up function (returned by the nested\n // rv.onNextChange(onNext)) with yet another callback.\n return rv.onNextChange(function onNext() {\n update();\n rv.onNextChange(onNext);\n });\n },\n [rv]\n ),\n rv,\n rv\n );\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.d.ts new file mode 100644 index 0000000..8d16dbb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.d.ts @@ -0,0 +1,29 @@ +import type { QueryReference } from "../internal/index.js"; +import type { ApolloError } from "../../errors/index.js"; +import type { NetworkStatus } from "../../core/index.js"; +export interface UseReadQueryResult { + /** + * An object containing the result of your GraphQL query after it completes. + * + * This value might be `undefined` if a query results in one or more errors + * (depending on the query's `errorPolicy`). + */ + data: TData; + /** + * If the query produces one or more errors, this object contains either an + * array of `graphQLErrors` or a single `networkError`. Otherwise, this value + * is `undefined`. + * + * This property can be ignored when using the default `errorPolicy` or an + * `errorPolicy` of `none`. The hook will throw the error instead of setting + * this property. + */ + error: ApolloError | undefined; + /** + * A number indicating the current network state of the query's associated + * request. {@link https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4 | See possible values}. + */ + networkStatus: NetworkStatus; +} +export declare function useReadQuery(queryRef: QueryReference): UseReadQueryResult; +//# sourceMappingURL=useReadQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js new file mode 100644 index 0000000..2502ff3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js @@ -0,0 +1,29 @@ +import * as React from "rehackt"; +import { getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, } from "../internal/index.js"; +import { __use } from "./internal/index.js"; +import { toApolloError } from "./useSuspenseQuery.js"; +import { useSyncExternalStore } from "./useSyncExternalStore.js"; +export function useReadQuery(queryRef) { + var internalQueryRef = React.useMemo(function () { return unwrapQueryRef(queryRef); }, [queryRef]); + var getPromise = React.useCallback(function () { return getWrappedPromise(queryRef); }, [queryRef]); + if (internalQueryRef.disposed) { + internalQueryRef.reinitialize(); + updateWrappedQueryRef(queryRef, internalQueryRef.promise); + } + React.useEffect(function () { return internalQueryRef.retain(); }, [internalQueryRef]); + var promise = useSyncExternalStore(React.useCallback(function (forceUpdate) { + return internalQueryRef.listen(function (promise) { + updateWrappedQueryRef(queryRef, promise); + forceUpdate(); + }); + }, [internalQueryRef]), getPromise, getPromise); + var result = __use(promise); + return React.useMemo(function () { + return { + data: result.data, + networkStatus: result.networkStatus, + error: toApolloError(result), + }; + }, [result]); +} +//# sourceMappingURL=useReadQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js.map new file mode 100644 index 0000000..c4b4c9a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useReadQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useReadQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useReadQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,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,CAAC;AACf,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport {\n getWrappedPromise,\n unwrapQueryRef,\n updateWrappedQueryRef,\n} from \"../internal/index.js\";\nimport type { QueryReference } from \"../internal/index.js\";\nimport { __use } from \"./internal/index.js\";\nimport { toApolloError } from \"./useSuspenseQuery.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport type { ApolloError } from \"../../errors/index.js\";\nimport type { NetworkStatus } from \"../../core/index.js\";\n\nexport interface UseReadQueryResult {\n /**\n * An object containing the result of your GraphQL query after it completes.\n *\n * This value might be `undefined` if a query results in one or more errors\n * (depending on the query's `errorPolicy`).\n */\n data: TData;\n /**\n * If the query produces one or more errors, this object contains either an\n * array of `graphQLErrors` or a single `networkError`. Otherwise, this value\n * is `undefined`.\n *\n * This property can be ignored when using the default `errorPolicy` or an\n * `errorPolicy` of `none`. The hook will throw the error instead of setting\n * this property.\n */\n error: ApolloError | undefined;\n /**\n * A number indicating the current network state of the query's associated\n * request. {@link https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4 | See possible values}.\n */\n networkStatus: NetworkStatus;\n}\n\nexport function useReadQuery(\n queryRef: QueryReference\n): UseReadQueryResult {\n const internalQueryRef = React.useMemo(\n () => unwrapQueryRef(queryRef),\n [queryRef]\n );\n\n const getPromise = React.useCallback(\n () => getWrappedPromise(queryRef),\n [queryRef]\n );\n\n if (internalQueryRef.disposed) {\n internalQueryRef.reinitialize();\n updateWrappedQueryRef(queryRef, internalQueryRef.promise);\n }\n\n React.useEffect(() => internalQueryRef.retain(), [internalQueryRef]);\n\n const promise = useSyncExternalStore(\n React.useCallback(\n (forceUpdate) => {\n return internalQueryRef.listen((promise) => {\n updateWrappedQueryRef(queryRef, promise);\n forceUpdate();\n });\n },\n [internalQueryRef]\n ),\n getPromise,\n getPromise\n );\n\n const result = __use(promise);\n\n return React.useMemo(() => {\n return {\n data: result.data,\n networkStatus: result.networkStatus,\n error: toApolloError(result),\n };\n }, [result]);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.d.ts new file mode 100644 index 0000000..602f1ad --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.d.ts @@ -0,0 +1,91 @@ +import type { DocumentNode } from "graphql"; +import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +import type { NoInfer, SubscriptionHookOptions, SubscriptionResult } from "../types/types.js"; +import type { OperationVariables } from "../../core/index.js"; +/** + * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`. + * + * @example + * ```jsx + * const COMMENTS_SUBSCRIPTION = gql` + * subscription OnCommentAdded($repoFullName: String!) { + * commentAdded(repoFullName: $repoFullName) { + * id + * content + * } + * } + * `; + * + * function DontReadTheComments({ repoFullName }) { + * const { + * data: { commentAdded }, + * loading, + * } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } }); + * return

    New comment: {!loading && commentAdded.content}

    ; + * } + * ``` + * @remarks + * #### Subscriptions and React 18 Automatic Batching + * + * With React 18's [automatic batching](https://react.dev/blog/2022/03/29/react-v18#new-feature-automatic-batching), multiple state updates may be grouped into a single re-render for better performance. + * + * If your subscription API sends multiple messages at the same time or in very fast succession (within fractions of a millisecond), it is likely that only the last message received in that narrow time frame will result in a re-render. + * + * Consider the following component: + * + * ```jsx + * export function Subscriptions() { + * const { data, error, loading } = useSubscription(query); + * const [accumulatedData, setAccumulatedData] = useState([]); + * + * useEffect(() => { + * setAccumulatedData((prev) => [...prev, data]); + * }, [data]); + * + * return ( + * <> + * {loading &&

    Loading...

    } + * {JSON.stringify(accumulatedData, undefined, 2)} + * + * ); + * } + * ``` + * + * If your subscription back-end emits two messages with the same timestamp, only the last message received by Apollo Client will be rendered. This is because React 18 will batch these two state updates into a single re-render. + * + * Since the component above is using `useEffect` to push `data` into a piece of local state on each `Subscriptions` re-render, the first message will never be added to the `accumulatedData` array since its render was skipped. + * + * Instead of using `useEffect` here, we can re-write this component to use the `onData` callback function accepted in `useSubscription`'s `options` object: + * + * ```jsx + * export function Subscriptions() { + * const [accumulatedData, setAccumulatedData] = useState([]); + * const { data, error, loading } = useSubscription( + * query, + * { + * onData({ data }) { + * setAccumulatedData((prev) => [...prev, data]) + * } + * } + * ); + * + * return ( + * <> + * {loading &&

    Loading...

    } + * {JSON.stringify(accumulatedData, undefined, 2)} + * + * ); + * } + * ``` + * + * > ⚠️ **Note:** The `useSubscription` option `onData` is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named `onSubscriptionData`. + * + * Now, the first message will be added to the `accumulatedData` array since `onData` is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with `onData` we can guarantee each message received after the component mounts is added to `accumulatedData`. + * + * @since 3.0.0 + * @param subscription - A GraphQL subscription document parsed into an AST by `gql`. + * @param options - Options to control how the subscription is executed. + * @returns Query result object + */ +export declare function useSubscription(subscription: DocumentNode | TypedDocumentNode, options?: SubscriptionHookOptions, NoInfer>): SubscriptionResult; +//# sourceMappingURL=useSubscription.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js new file mode 100644 index 0000000..209e1b2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js @@ -0,0 +1,239 @@ +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +import { equal } from "@wry/equality"; +import { DocumentType, verifyDocumentType } from "../parser/index.js"; +import { useApolloClient } from "./useApolloClient.js"; +/** + * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`. + * + * @example + * ```jsx + * const COMMENTS_SUBSCRIPTION = gql` + * subscription OnCommentAdded($repoFullName: String!) { + * commentAdded(repoFullName: $repoFullName) { + * id + * content + * } + * } + * `; + * + * function DontReadTheComments({ repoFullName }) { + * const { + * data: { commentAdded }, + * loading, + * } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } }); + * return

    New comment: {!loading && commentAdded.content}

    ; + * } + * ``` + * @remarks + * #### Subscriptions and React 18 Automatic Batching + * + * With React 18's [automatic batching](https://react.dev/blog/2022/03/29/react-v18#new-feature-automatic-batching), multiple state updates may be grouped into a single re-render for better performance. + * + * If your subscription API sends multiple messages at the same time or in very fast succession (within fractions of a millisecond), it is likely that only the last message received in that narrow time frame will result in a re-render. + * + * Consider the following component: + * + * ```jsx + * export function Subscriptions() { + * const { data, error, loading } = useSubscription(query); + * const [accumulatedData, setAccumulatedData] = useState([]); + * + * useEffect(() => { + * setAccumulatedData((prev) => [...prev, data]); + * }, [data]); + * + * return ( + * <> + * {loading &&

    Loading...

    } + * {JSON.stringify(accumulatedData, undefined, 2)} + * + * ); + * } + * ``` + * + * If your subscription back-end emits two messages with the same timestamp, only the last message received by Apollo Client will be rendered. This is because React 18 will batch these two state updates into a single re-render. + * + * Since the component above is using `useEffect` to push `data` into a piece of local state on each `Subscriptions` re-render, the first message will never be added to the `accumulatedData` array since its render was skipped. + * + * Instead of using `useEffect` here, we can re-write this component to use the `onData` callback function accepted in `useSubscription`'s `options` object: + * + * ```jsx + * export function Subscriptions() { + * const [accumulatedData, setAccumulatedData] = useState([]); + * const { data, error, loading } = useSubscription( + * query, + * { + * onData({ data }) { + * setAccumulatedData((prev) => [...prev, data]) + * } + * } + * ); + * + * return ( + * <> + * {loading &&

    Loading...

    } + * {JSON.stringify(accumulatedData, undefined, 2)} + * + * ); + * } + * ``` + * + * > ⚠️ **Note:** The `useSubscription` option `onData` is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named `onSubscriptionData`. + * + * Now, the first message will be added to the `accumulatedData` array since `onData` is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with `onData` we can guarantee each message received after the component mounts is added to `accumulatedData`. + * + * @since 3.0.0 + * @param subscription - A GraphQL subscription document parsed into an AST by `gql`. + * @param options - Options to control how the subscription is executed. + * @returns Query result object + */ +export function useSubscription(subscription, options) { + var hasIssuedDeprecationWarningRef = React.useRef(false); + var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client); + verifyDocumentType(subscription, DocumentType.Subscription); + var _a = React.useState({ + loading: !(options === null || options === void 0 ? void 0 : options.skip), + error: void 0, + data: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }), result = _a[0], setResult = _a[1]; + if (!hasIssuedDeprecationWarningRef.current) { + hasIssuedDeprecationWarningRef.current = true; + if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) { + globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53); + } + if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) { + globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55); + } + } + var _b = React.useState(function () { + if (options === null || options === void 0 ? void 0 : options.skip) { + return null; + } + return client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + }); + }), observable = _b[0], setObservable = _b[1]; + var canResetObservableRef = React.useRef(false); + React.useEffect(function () { + return function () { + canResetObservableRef.current = true; + }; + }, []); + var ref = React.useRef({ client: client, subscription: subscription, options: options }); + React.useEffect(function () { + var _a, _b, _c, _d; + var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe; + if (typeof shouldResubscribe === "function") { + shouldResubscribe = !!shouldResubscribe(options); + } + if (options === null || options === void 0 ? void 0 : options.skip) { + if (!(options === null || options === void 0 ? void 0 : options.skip) !== !((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.skip) || + canResetObservableRef.current) { + setResult({ + loading: false, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(null); + canResetObservableRef.current = false; + } + } + else if ((shouldResubscribe !== false && + (client !== ref.current.client || + subscription !== ref.current.subscription || + (options === null || options === void 0 ? void 0 : options.fetchPolicy) !== ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || + !(options === null || options === void 0 ? void 0 : options.skip) !== !((_c = ref.current.options) === null || _c === void 0 ? void 0 : _c.skip) || + !equal(options === null || options === void 0 ? void 0 : options.variables, (_d = ref.current.options) === null || _d === void 0 ? void 0 : _d.variables))) || + canResetObservableRef.current) { + setResult({ + loading: true, + data: void 0, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + setObservable(client.subscribe({ + query: subscription, + variables: options === null || options === void 0 ? void 0 : options.variables, + fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy, + context: options === null || options === void 0 ? void 0 : options.context, + })); + canResetObservableRef.current = false; + } + Object.assign(ref.current, { client: client, subscription: subscription, options: options }); + }, [client, subscription, options, canResetObservableRef.current]); + React.useEffect(function () { + if (!observable) { + return; + } + var subscriptionStopped = false; + var subscription = observable.subscribe({ + next: function (fetchResult) { + var _a, _b; + if (subscriptionStopped) { + return; + } + var result = { + loading: false, + // TODO: fetchResult.data can be null but SubscriptionResult.data + // expects TData | undefined only + data: fetchResult.data, + error: void 0, + variables: options === null || options === void 0 ? void 0 : options.variables, + }; + setResult(result); + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) { + ref.current.options.onData({ + client: client, + data: result, + }); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) { + ref.current.options.onSubscriptionData({ + client: client, + subscriptionData: result, + }); + } + }, + error: function (error) { + var _a, _b; + if (!subscriptionStopped) { + setResult({ + loading: false, + data: void 0, + error: error, + variables: options === null || options === void 0 ? void 0 : options.variables, + }); + (_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error); + } + }, + complete: function () { + var _a, _b; + if (!subscriptionStopped) { + if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) { + ref.current.options.onComplete(); + } + else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) { + ref.current.options.onSubscriptionComplete(); + } + } + }, + }); + return function () { + // immediately stop receiving subscription values, but do not unsubscribe + // until after a short delay in case another useSubscription hook is + // reusing the same underlying observable and is about to subscribe + subscriptionStopped = true; + setTimeout(function () { + subscription.unsubscribe(); + }); + }; + }, [observable]); + return result; +} +//# sourceMappingURL=useSubscription.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js.map new file mode 100644 index 0000000..ea55809 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSubscription.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useSubscription.js","sourceRoot":"","sources":["../../../src/react/hooks/useSubscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAOtE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,MAAM,UAAU,eAAe,CAI7B,YAAiE,EACjE,OAAsE;IAEtE,IAAM,8BAA8B,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAM,MAAM,GAAG,eAAe,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,CAAC;IAChD,kBAAkB,CAAC,YAA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ACH,MAAA,MAAA,GAAG,CAAC,OAAO,CAAC,OAAO,0CAAE,OAAO,mDAAG,KAAK,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC;YACD,QAAQ;;gBACN,IAAI,CAAC,mBAAmB,EAAE,CAAC;oBACzB,IAAI,MAAA,GAAG,CAAC,OAAO,CAAC,OAAO,0CAAE,UAAU,EAAE,CAAC;wBACpC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;oBACnC,CAAC;yBAAM,IAAI,MAAA,GAAG,CAAC,OAAO,CAAC,OAAO,0CAAE,sBAAsB,EAAE,CAAC;wBACvD,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;oBAC/C,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO;YACL,yEAAyE;YACzE,oEAAoE;YACpE,mEAAmE;YACnE,mBAAmB,GAAG,IAAI,CAAC;YAC3B,UAAU,CAAC;gBACT,YAAY,CAAC,WAAW,EAAE,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport { equal } from \"@wry/equality\";\n\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport type {\n NoInfer,\n SubscriptionHookOptions,\n SubscriptionResult,\n} from \"../types/types.js\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n/**\n * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`.\n *\n * @example\n * ```jsx\n * const COMMENTS_SUBSCRIPTION = gql`\n * subscription OnCommentAdded($repoFullName: String!) {\n * commentAdded(repoFullName: $repoFullName) {\n * id\n * content\n * }\n * }\n * `;\n *\n * function DontReadTheComments({ repoFullName }) {\n * const {\n * data: { commentAdded },\n * loading,\n * } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } });\n * return

    New comment: {!loading && commentAdded.content}

    ;\n * }\n * ```\n * @remarks\n * #### Subscriptions and React 18 Automatic Batching\n *\n * With React 18's [automatic batching](https://react.dev/blog/2022/03/29/react-v18#new-feature-automatic-batching), multiple state updates may be grouped into a single re-render for better performance.\n *\n * If your subscription API sends multiple messages at the same time or in very fast succession (within fractions of a millisecond), it is likely that only the last message received in that narrow time frame will result in a re-render.\n *\n * Consider the following component:\n *\n * ```jsx\n * export function Subscriptions() {\n * const { data, error, loading } = useSubscription(query);\n * const [accumulatedData, setAccumulatedData] = useState([]);\n *\n * useEffect(() => {\n * setAccumulatedData((prev) => [...prev, data]);\n * }, [data]);\n *\n * return (\n * <>\n * {loading &&

    Loading...

    }\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * \n * );\n * }\n * ```\n *\n * If your subscription back-end emits two messages with the same timestamp, only the last message received by Apollo Client will be rendered. This is because React 18 will batch these two state updates into a single re-render.\n *\n * Since the component above is using `useEffect` to push `data` into a piece of local state on each `Subscriptions` re-render, the first message will never be added to the `accumulatedData` array since its render was skipped.\n *\n * Instead of using `useEffect` here, we can re-write this component to use the `onData` callback function accepted in `useSubscription`'s `options` object:\n *\n * ```jsx\n * export function Subscriptions() {\n * const [accumulatedData, setAccumulatedData] = useState([]);\n * const { data, error, loading } = useSubscription(\n * query,\n * {\n * onData({ data }) {\n * setAccumulatedData((prev) => [...prev, data])\n * }\n * }\n * );\n *\n * return (\n * <>\n * {loading &&

    Loading...

    }\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * \n * );\n * }\n * ```\n *\n * > ⚠️ **Note:** The `useSubscription` option `onData` is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named `onSubscriptionData`.\n *\n * Now, the first message will be added to the `accumulatedData` array since `onData` is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with `onData` we can guarantee each message received after the component mounts is added to `accumulatedData`.\n *\n * @since 3.0.0\n * @param subscription - A GraphQL subscription document parsed into an AST by `gql`.\n * @param options - Options to control how the subscription is executed.\n * @returns Query result object\n */\nexport function useSubscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n subscription: DocumentNode | TypedDocumentNode,\n options?: SubscriptionHookOptions, NoInfer>\n) {\n const hasIssuedDeprecationWarningRef = React.useRef(false);\n const client = useApolloClient(options?.client);\n verifyDocumentType(subscription, DocumentType.Subscription);\n const [result, setResult] = React.useState<\n SubscriptionResult\n >({\n loading: !options?.skip,\n error: void 0,\n data: void 0,\n variables: options?.variables,\n });\n\n if (!hasIssuedDeprecationWarningRef.current) {\n hasIssuedDeprecationWarningRef.current = true;\n\n if (options?.onSubscriptionData) {\n invariant.warn(\n options.onData ?\n \"'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used.\"\n : \"'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead.\"\n );\n }\n\n if (options?.onSubscriptionComplete) {\n invariant.warn(\n options.onComplete ?\n \"'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used.\"\n : \"'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead.\"\n );\n }\n }\n\n const [observable, setObservable] = React.useState(() => {\n if (options?.skip) {\n return null;\n }\n\n return client.subscribe({\n query: subscription,\n variables: options?.variables,\n fetchPolicy: options?.fetchPolicy,\n context: options?.context,\n });\n });\n\n const canResetObservableRef = React.useRef(false);\n React.useEffect(() => {\n return () => {\n canResetObservableRef.current = true;\n };\n }, []);\n\n const ref = React.useRef({ client, subscription, options });\n React.useEffect(() => {\n let shouldResubscribe = options?.shouldResubscribe;\n if (typeof shouldResubscribe === \"function\") {\n shouldResubscribe = !!shouldResubscribe(options!);\n }\n\n if (options?.skip) {\n if (\n !options?.skip !== !ref.current.options?.skip ||\n canResetObservableRef.current\n ) {\n setResult({\n loading: false,\n data: void 0,\n error: void 0,\n variables: options?.variables,\n });\n setObservable(null);\n canResetObservableRef.current = false;\n }\n } else if (\n (shouldResubscribe !== false &&\n (client !== ref.current.client ||\n subscription !== ref.current.subscription ||\n options?.fetchPolicy !== ref.current.options?.fetchPolicy ||\n !options?.skip !== !ref.current.options?.skip ||\n !equal(options?.variables, ref.current.options?.variables))) ||\n canResetObservableRef.current\n ) {\n setResult({\n loading: true,\n data: void 0,\n error: void 0,\n variables: options?.variables,\n });\n setObservable(\n client.subscribe({\n query: subscription,\n variables: options?.variables,\n fetchPolicy: options?.fetchPolicy,\n context: options?.context,\n })\n );\n canResetObservableRef.current = false;\n }\n\n Object.assign(ref.current, { client, subscription, options });\n }, [client, subscription, options, canResetObservableRef.current]);\n\n React.useEffect(() => {\n if (!observable) {\n return;\n }\n\n let subscriptionStopped = false;\n const subscription = observable.subscribe({\n next(fetchResult) {\n if (subscriptionStopped) {\n return;\n }\n\n const result = {\n loading: false,\n // TODO: fetchResult.data can be null but SubscriptionResult.data\n // expects TData | undefined only\n data: fetchResult.data!,\n error: void 0,\n variables: options?.variables,\n };\n setResult(result);\n\n if (ref.current.options?.onData) {\n ref.current.options.onData({\n client,\n data: result,\n });\n } else if (ref.current.options?.onSubscriptionData) {\n ref.current.options.onSubscriptionData({\n client,\n subscriptionData: result,\n });\n }\n },\n error(error) {\n if (!subscriptionStopped) {\n setResult({\n loading: false,\n data: void 0,\n error,\n variables: options?.variables,\n });\n ref.current.options?.onError?.(error);\n }\n },\n complete() {\n if (!subscriptionStopped) {\n if (ref.current.options?.onComplete) {\n ref.current.options.onComplete();\n } else if (ref.current.options?.onSubscriptionComplete) {\n ref.current.options.onSubscriptionComplete();\n }\n }\n },\n });\n\n return () => {\n // immediately stop receiving subscription values, but do not unsubscribe\n // until after a short delay in case another useSubscription hook is\n // reusing the same underlying observable and is about to subscribe\n subscriptionStopped = true;\n setTimeout(() => {\n subscription.unsubscribe();\n });\n };\n }, [observable]);\n\n return result;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.d.ts new file mode 100644 index 0000000..6ef84a9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.d.ts @@ -0,0 +1,54 @@ +import type { ApolloClient, ApolloQueryResult, DocumentNode, OperationVariables, TypedDocumentNode, FetchMoreQueryOptions, WatchQueryOptions } from "../../core/index.js"; +import { ApolloError, NetworkStatus } from "../../core/index.js"; +import type { DeepPartial } from "../../utilities/index.js"; +import type { SuspenseQueryHookOptions, ObservableQueryFields, NoInfer } from "../types/types.js"; +import type { SkipToken } from "./constants.js"; +export interface UseSuspenseQueryResult { + client: ApolloClient; + data: TData; + error: ApolloError | undefined; + fetchMore: FetchMoreFunction; + networkStatus: NetworkStatus; + refetch: RefetchFunction; + subscribeToMore: SubscribeToMoreFunction; +} +export type FetchMoreFunction = (fetchMoreOptions: FetchMoreQueryOptions & { + updateQuery?: (previousQueryResult: TData, options: { + fetchMoreResult: TData; + variables: TVariables; + }) => TData; +}) => Promise>; +export type RefetchFunction = ObservableQueryFields["refetch"]; +export type SubscribeToMoreFunction = ObservableQueryFields["subscribeToMore"]; +export declare function useSuspenseQuery, "variables">>(query: DocumentNode | TypedDocumentNode, options?: SuspenseQueryHookOptions, NoInfer> & TOptions): UseSuspenseQueryResult | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? TOptions["skip"] extends boolean ? DeepPartial | undefined : DeepPartial : TOptions["skip"] extends boolean ? TData | undefined : TData, TVariables>; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer> & { + returnPartialData: true; + errorPolicy: "ignore" | "all"; +}): UseSuspenseQueryResult | undefined, TVariables>; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer> & { + errorPolicy: "ignore" | "all"; +}): UseSuspenseQueryResult; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer> & { + skip: boolean; + returnPartialData: true; +}): UseSuspenseQueryResult | undefined, TVariables>; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer> & { + returnPartialData: true; +}): UseSuspenseQueryResult, TVariables>; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SuspenseQueryHookOptions, NoInfer> & { + skip: boolean; +}): UseSuspenseQueryResult; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options?: SuspenseQueryHookOptions, NoInfer>): UseSuspenseQueryResult; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options: SkipToken | (SuspenseQueryHookOptions, NoInfer> & { + returnPartialData: true; +})): UseSuspenseQueryResult | undefined, TVariables>; +export declare function useSuspenseQuery(query: DocumentNode | TypedDocumentNode, options?: SkipToken | SuspenseQueryHookOptions, NoInfer>): UseSuspenseQueryResult; +export declare function toApolloError(result: ApolloQueryResult): ApolloError | undefined; +interface UseWatchQueryOptionsHookOptions { + client: ApolloClient; + query: DocumentNode | TypedDocumentNode; + options: SkipToken | SuspenseQueryHookOptions; +} +export declare function useWatchQueryOptions({ client, query, options, }: UseWatchQueryOptionsHookOptions): WatchQueryOptions; +export {}; +//# sourceMappingURL=useSuspenseQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js new file mode 100644 index 0000000..9df2ddd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js @@ -0,0 +1,131 @@ +import { __assign, __spreadArray } from "tslib"; +import * as React from "rehackt"; +import { invariant } from "../../utilities/globals/index.js"; +import { ApolloError, NetworkStatus } from "../../core/index.js"; +import { isNonEmptyArray } from "../../utilities/index.js"; +import { useApolloClient } from "./useApolloClient.js"; +import { DocumentType, verifyDocumentType } from "../parser/index.js"; +import { __use, useDeepMemo } from "./internal/index.js"; +import { getSuspenseCache } from "../internal/index.js"; +import { canonicalStringify } from "../../cache/index.js"; +import { skipToken } from "./constants.js"; +export function useSuspenseQuery(query, options) { + if (options === void 0) { options = Object.create(null); } + var client = useApolloClient(options.client); + var suspenseCache = getSuspenseCache(client); + var watchQueryOptions = useWatchQueryOptions({ + client: client, + query: query, + options: options, + }); + var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables; + var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a; + var cacheKey = __spreadArray([ + query, + canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = suspenseCache.getQueryRef(cacheKey, function () { + return client.watchQuery(watchQueryOptions); + }); + var _b = React.useState([queryRef.key, queryRef.promise]), current = _b[0], setPromise = _b[1]; + // This saves us a re-execution of the render function when a variable changed. + if (current[0] !== queryRef.key) { + current[0] = queryRef.key; + current[1] = queryRef.promise; + } + var promise = current[1]; + if (queryRef.didChangeOptions(watchQueryOptions)) { + current[1] = promise = queryRef.applyOptions(watchQueryOptions); + } + React.useEffect(function () { + var dispose = queryRef.retain(); + var removeListener = queryRef.listen(function (promise) { + setPromise([queryRef.key, promise]); + }); + return function () { + removeListener(); + dispose(); + }; + }, [queryRef]); + var skipResult = React.useMemo(function () { + var error = toApolloError(queryRef.result); + return { + loading: false, + data: queryRef.result.data, + networkStatus: error ? NetworkStatus.error : NetworkStatus.ready, + error: error, + }; + }, [queryRef.result]); + var result = fetchPolicy === "standby" ? skipResult : __use(promise); + var fetchMore = React.useCallback((function (options) { + var promise = queryRef.fetchMore(options); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }), [queryRef]); + var refetch = React.useCallback(function (variables) { + var promise = queryRef.refetch(variables); + setPromise([queryRef.key, queryRef.promise]); + return promise; + }, [queryRef]); + var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]); + return React.useMemo(function () { + return { + client: client, + data: result.data, + error: toApolloError(result), + networkStatus: result.networkStatus, + fetchMore: fetchMore, + refetch: refetch, + subscribeToMore: subscribeToMore, + }; + }, [client, fetchMore, refetch, result, subscribeToMore]); +} +function validateOptions(options) { + var query = options.query, fetchPolicy = options.fetchPolicy, returnPartialData = options.returnPartialData; + verifyDocumentType(query, DocumentType.Query); + validateFetchPolicy(fetchPolicy); + validatePartialDataReturn(fetchPolicy, returnPartialData); +} +function validateFetchPolicy(fetchPolicy) { + if (fetchPolicy === void 0) { fetchPolicy = "cache-first"; } + var supportedFetchPolicies = [ + "cache-first", + "network-only", + "no-cache", + "cache-and-network", + ]; + invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy); +} +function validatePartialDataReturn(fetchPolicy, returnPartialData) { + if (fetchPolicy === "no-cache" && returnPartialData) { + globalThis.__DEV__ !== false && invariant.warn(57); + } +} +export function toApolloError(result) { + return isNonEmptyArray(result.errors) ? + new ApolloError({ graphQLErrors: result.errors }) + : result.error; +} +export function useWatchQueryOptions(_a) { + var client = _a.client, query = _a.query, options = _a.options; + return useDeepMemo(function () { + var _a; + if (options === skipToken) { + return { query: query, fetchPolicy: "standby" }; + } + var fetchPolicy = options.fetchPolicy || + ((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) || + "cache-first"; + var watchQueryOptions = __assign(__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 }); + if (globalThis.__DEV__ !== false) { + validateOptions(watchQueryOptions); + } + // Assign the updated fetch policy after our validation since `standby` is + // not a supported fetch policy on its own without the use of `skip`. + if (options.skip) { + watchQueryOptions.fetchPolicy = "standby"; + } + return watchQueryOptions; + }, [client, options, query]); +} +//# sourceMappingURL=useSuspenseQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js.map new file mode 100644 index 0000000..afa7bca --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSuspenseQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useSuspenseQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useSuspenseQuery.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAW7D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAMtE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA+I3C,MAAM,UAAU,gBAAgB,CAI9B,KAA0D,EAC1D,OAEqE;IAFrE,wBAAA,EAAA,UAEkD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAErE,IAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAM,iBAAiB,GAAG,oBAAoB,CAAW;QACvD,MAAM,QAAA;QACN,KAAK,OAAA;QACL,OAAO,SAAA;KACR,CAAC,CAAC;IACK,IA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,wJAAwJ,CACzJ,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAA8B;IAC1D,OAAO,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACnC,IAAI,WAAW,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QACnD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AACnB,CAAC;AAWD,MAAM,UAAU,oBAAoB,CAGlC,EAImD;QAHnD,MAAM,YAAA,EACN,KAAK,WAAA,EACL,OAAO,aAAA;IAKP,OAAO,WAAW,CAAuC;;QACvD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,EAAE,KAAK,OAAA,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;QAC3C,CAAC;QAED,IAAM,WAAW,GACf,OAAO,CAAC,WAAW;aACnB,MAAA,MAAM,CAAC,cAAc,CAAC,UAAU,0CAAE,WAAW,CAAA;YAC7C,aAAa,CAAC;QAEhB,IAAM,iBAAiB,yBAClB,OAAO,KACV,WAAW,aAAA,EACX,KAAK,OAAA,EACL,2BAA2B,EAAE,KAAK,EAClC,eAAe,EAAE,KAAK,CAAC,GACxB,CAAC;QAEF,IAAI,OAAO,EAAE,CAAC;YACZ,eAAe,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QAED,0EAA0E;QAC1E,qEAAqE;QACrE,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,iBAAiB,CAAC,WAAW,GAAG,SAAS,CAAC;QAC5C,CAAC;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport type {\n ApolloClient,\n ApolloQueryResult,\n DocumentNode,\n OperationVariables,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n FetchMoreQueryOptions,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport { ApolloError, NetworkStatus } from \"../../core/index.js\";\nimport type { DeepPartial } from \"../../utilities/index.js\";\nimport { isNonEmptyArray } from \"../../utilities/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport type {\n SuspenseQueryHookOptions,\n ObservableQueryFields,\n NoInfer,\n} from \"../types/types.js\";\nimport { __use, useDeepMemo } from \"./internal/index.js\";\nimport { getSuspenseCache } from \"../internal/index.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { skipToken } from \"./constants.js\";\nimport type { SkipToken } from \"./constants.js\";\nimport type { CacheKey, QueryKey } from \"../internal/index.js\";\n\nexport interface UseSuspenseQueryResult<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> {\n client: ApolloClient;\n data: TData;\n error: ApolloError | undefined;\n fetchMore: FetchMoreFunction;\n networkStatus: NetworkStatus;\n refetch: RefetchFunction;\n subscribeToMore: SubscribeToMoreFunction;\n}\n\nexport type FetchMoreFunction = (\n fetchMoreOptions: FetchMoreQueryOptions & {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult: TData;\n variables: TVariables;\n }\n ) => TData;\n }\n) => Promise>;\n\nexport type RefetchFunction<\n TData,\n TVariables extends OperationVariables,\n> = ObservableQueryFields[\"refetch\"];\n\nexport type SubscribeToMoreFunction<\n TData,\n TVariables extends OperationVariables,\n> = ObservableQueryFields[\"subscribeToMore\"];\n\nexport function useSuspenseQuery<\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit, \"variables\">,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: SuspenseQueryHookOptions, NoInfer> &\n TOptions\n): UseSuspenseQueryResult<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ?\n TOptions[\"skip\"] extends boolean ?\n DeepPartial | undefined\n : DeepPartial\n : TOptions[\"skip\"] extends boolean ? TData | undefined\n : TData,\n TVariables\n>;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: SuspenseQueryHookOptions, NoInfer> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n): UseSuspenseQueryResult | undefined, TVariables>;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: SuspenseQueryHookOptions, NoInfer> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n): UseSuspenseQueryResult;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: SuspenseQueryHookOptions, NoInfer> & {\n skip: boolean;\n returnPartialData: true;\n }\n): UseSuspenseQueryResult | undefined, TVariables>;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: SuspenseQueryHookOptions, NoInfer> & {\n returnPartialData: true;\n }\n): UseSuspenseQueryResult, TVariables>;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: SuspenseQueryHookOptions, NoInfer> & {\n skip: boolean;\n }\n): UseSuspenseQueryResult;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?: SuspenseQueryHookOptions, NoInfer>\n): UseSuspenseQueryResult;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options:\n | SkipToken\n | (SuspenseQueryHookOptions, NoInfer> & {\n returnPartialData: true;\n })\n): UseSuspenseQueryResult | undefined, TVariables>;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options?:\n | SkipToken\n | SuspenseQueryHookOptions, NoInfer>\n): UseSuspenseQueryResult;\n\nexport function useSuspenseQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options:\n | (SkipToken & Partial>)\n | SuspenseQueryHookOptions = Object.create(null)\n): UseSuspenseQueryResult {\n const client = useApolloClient(options.client);\n const suspenseCache = getSuspenseCache(client);\n const watchQueryOptions = useWatchQueryOptions({\n client,\n query,\n options,\n });\n const { fetchPolicy, variables } = watchQueryOptions;\n const { queryKey = [] } = options;\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n\n const queryRef = suspenseCache.getQueryRef(cacheKey, () =>\n client.watchQuery(watchQueryOptions)\n );\n\n let [current, setPromise] = React.useState<\n [QueryKey, Promise>]\n >([queryRef.key, queryRef.promise]);\n\n // This saves us a re-execution of the render function when a variable changed.\n if (current[0] !== queryRef.key) {\n current[0] = queryRef.key;\n current[1] = queryRef.promise;\n }\n let promise = current[1];\n\n if (queryRef.didChangeOptions(watchQueryOptions)) {\n current[1] = promise = queryRef.applyOptions(watchQueryOptions);\n }\n\n React.useEffect(() => {\n const dispose = queryRef.retain();\n\n const removeListener = queryRef.listen((promise) => {\n setPromise([queryRef.key, promise]);\n });\n\n return () => {\n removeListener();\n dispose();\n };\n }, [queryRef]);\n\n const skipResult = React.useMemo(() => {\n const error = toApolloError(queryRef.result);\n\n return {\n loading: false,\n data: queryRef.result.data,\n networkStatus: error ? NetworkStatus.error : NetworkStatus.ready,\n error,\n };\n }, [queryRef.result]);\n\n const result = fetchPolicy === \"standby\" ? skipResult : __use(promise);\n const fetchMore = React.useCallback(\n ((options) => {\n const promise = queryRef.fetchMore(options);\n setPromise([queryRef.key, queryRef.promise]);\n\n return promise;\n }) satisfies FetchMoreFunction<\n unknown,\n OperationVariables\n > as FetchMoreFunction,\n [queryRef]\n );\n\n const refetch: RefetchFunction = React.useCallback(\n (variables) => {\n const promise = queryRef.refetch(variables);\n setPromise([queryRef.key, queryRef.promise]);\n\n return promise;\n },\n [queryRef]\n );\n\n const subscribeToMore: SubscribeToMoreFunction<\n TData | undefined,\n TVariables\n > = React.useCallback(\n (options) => queryRef.observable.subscribeToMore(options),\n [queryRef]\n );\n\n return React.useMemo<\n UseSuspenseQueryResult\n >(() => {\n return {\n client,\n data: result.data,\n error: toApolloError(result),\n networkStatus: result.networkStatus,\n fetchMore,\n refetch,\n subscribeToMore,\n };\n }, [client, fetchMore, refetch, result, subscribeToMore]);\n}\n\nfunction validateOptions(options: WatchQueryOptions) {\n const { query, fetchPolicy, returnPartialData } = options;\n\n verifyDocumentType(query, DocumentType.Query);\n validateFetchPolicy(fetchPolicy);\n validatePartialDataReturn(fetchPolicy, returnPartialData);\n}\n\nfunction validateFetchPolicy(\n fetchPolicy: WatchQueryFetchPolicy = \"cache-first\"\n) {\n const supportedFetchPolicies: WatchQueryFetchPolicy[] = [\n \"cache-first\",\n \"network-only\",\n \"no-cache\",\n \"cache-and-network\",\n ];\n\n invariant(\n supportedFetchPolicies.includes(fetchPolicy),\n `The fetch policy \\`%s\\` is not supported with suspense.`,\n fetchPolicy\n );\n}\n\nfunction validatePartialDataReturn(\n fetchPolicy: WatchQueryFetchPolicy | undefined,\n returnPartialData: boolean | undefined\n) {\n if (fetchPolicy === \"no-cache\" && returnPartialData) {\n invariant.warn(\n \"Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy.\"\n );\n }\n}\n\nexport function toApolloError(result: ApolloQueryResult) {\n return isNonEmptyArray(result.errors) ?\n new ApolloError({ graphQLErrors: result.errors })\n : result.error;\n}\n\ninterface UseWatchQueryOptionsHookOptions<\n TData,\n TVariables extends OperationVariables,\n> {\n client: ApolloClient;\n query: DocumentNode | TypedDocumentNode;\n options: SkipToken | SuspenseQueryHookOptions;\n}\n\nexport function useWatchQueryOptions<\n TData,\n TVariables extends OperationVariables,\n>({\n client,\n query,\n options,\n}: UseWatchQueryOptionsHookOptions): WatchQueryOptions<\n TVariables,\n TData\n> {\n return useDeepMemo>(() => {\n if (options === skipToken) {\n return { query, fetchPolicy: \"standby\" };\n }\n\n const fetchPolicy =\n options.fetchPolicy ||\n client.defaultOptions.watchQuery?.fetchPolicy ||\n \"cache-first\";\n\n const watchQueryOptions = {\n ...options,\n fetchPolicy,\n query,\n notifyOnNetworkStatusChange: false,\n nextFetchPolicy: void 0,\n };\n\n if (__DEV__) {\n validateOptions(watchQueryOptions);\n }\n\n // Assign the updated fetch policy after our validation since `standby` is\n // not a supported fetch policy on its own without the use of `skip`.\n if (options.skip) {\n watchQueryOptions.fetchPolicy = \"standby\";\n }\n\n return watchQueryOptions;\n }, [client, options, query]);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.d.ts b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.d.ts new file mode 100644 index 0000000..ac60746 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.d.ts @@ -0,0 +1,4 @@ +type RealUseSESHookType = typeof import("use-sync-external-store").useSyncExternalStore; +export declare const useSyncExternalStore: RealUseSESHookType; +export {}; +//# sourceMappingURL=useSyncExternalStore.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js new file mode 100644 index 0000000..1d9014d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js @@ -0,0 +1,103 @@ +import { invariant } from "../../utilities/globals/index.js"; +import * as React from "rehackt"; +import { canUseLayoutEffect } from "../../utilities/index.js"; +var didWarnUncachedGetSnapshot = false; +// Prevent webpack from complaining about our feature detection of the +// useSyncExternalStore property of the React namespace, which is expected not +// to exist when using React 17 and earlier, and that's fine. +var uSESKey = "useSyncExternalStore"; +var realHook = React[uSESKey]; +// Adapted from https://www.npmjs.com/package/use-sync-external-store, with +// Apollo Client deviations called out by "// DEVIATION ..." comments. +// When/if React.useSyncExternalStore is defined, delegate fully to it. +export var useSyncExternalStore = realHook || + (function (subscribe, getSnapshot, getServerSnapshot) { + // Read the current snapshot from the store on every render. Again, this + // breaks the rules of React, and only works here because of specific + // implementation details, most importantly that updates are + // always synchronous. + var value = getSnapshot(); + if ( + // DEVIATION: Using __DEV__ + globalThis.__DEV__ !== false && + !didWarnUncachedGetSnapshot && + // DEVIATION: Not using Object.is because we know our snapshots will never + // be exotic primitive values like NaN, which is !== itself. + value !== getSnapshot()) { + didWarnUncachedGetSnapshot = true; + // DEVIATION: Using invariant.error instead of console.error directly. + globalThis.__DEV__ !== false && invariant.error(58); + } + // Because updates are synchronous, we don't queue them. Instead we force a + // re-render whenever the subscribed state changes by updating an some + // arbitrary useState hook. Then, during render, we call getSnapshot to read + // the current value. + // + // Because we don't actually use the state returned by the useState hook, we + // can save a bit of memory by storing other stuff in that slot. + // + // To implement the early bailout, we need to track some things on a mutable + // object. Usually, we would put that in a useRef hook, but we can stash it in + // our useState hook instead. + // + // To force a re-render, we call forceUpdate({inst}). That works because the + // new object always fails an equality check. + var _a = React.useState({ + inst: { value: value, getSnapshot: getSnapshot }, + }), inst = _a[0].inst, forceUpdate = _a[1]; + // Track the latest getSnapshot function with a ref. This needs to be updated + // in the layout phase so we can access it during the tearing check that + // happens on subscribe. + if (canUseLayoutEffect) { + // DEVIATION: We avoid calling useLayoutEffect when !canUseLayoutEffect, + // which may seem like a conditional hook, but this code ends up behaving + // unconditionally (one way or the other) because canUseLayoutEffect is + // constant. + React.useLayoutEffect(function () { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + // Whenever getSnapshot or subscribe changes, we need to check in the + // commit phase if there was an interleaved mutation. In concurrent mode + // this can happen all the time, but even in synchronous mode, an earlier + // effect may have mutated the store. + if (checkIfSnapshotChanged(inst)) { + // Force a re-render. + forceUpdate({ inst: inst }); + } + }, [subscribe, value, getSnapshot]); + } + else { + Object.assign(inst, { value: value, getSnapshot: getSnapshot }); + } + React.useEffect(function () { + // Check for changes right before subscribing. Subsequent changes will be + // detected in the subscription handler. + if (checkIfSnapshotChanged(inst)) { + // Force a re-render. + forceUpdate({ inst: inst }); + } + // Subscribe to the store and return a clean-up function. + return subscribe(function handleStoreChange() { + // TODO: Because there is no cross-renderer API for batching updates, it's + // up to the consumer of this library to wrap their subscription event + // with unstable_batchedUpdates. Should we try to detect when this isn't + // the case and print a warning in development? + // The store changed. Check if the snapshot changed since the last time we + // read from the store. + if (checkIfSnapshotChanged(inst)) { + // Force a re-render. + forceUpdate({ inst: inst }); + } + }); + }, [subscribe]); + return value; + }); +function checkIfSnapshotChanged(_a) { + var value = _a.value, getSnapshot = _a.getSnapshot; + try { + return value !== getSnapshot(); + } + catch (_b) { + return true; + } +} +//# sourceMappingURL=useSyncExternalStore.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js.map b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js.map new file mode 100644 index 0000000..695dc09 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"useSyncExternalStore.js","sourceRoot":"","sources":["../../../src/react/hooks/useSyncExternalStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,IAAI,0BAA0B,GAAG,KAAK,CAAC;AASvC,sEAAsE;AACt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as React from \"rehackt\";\n\nimport { canUseLayoutEffect } from \"../../utilities/index.js\";\n\nlet didWarnUncachedGetSnapshot = false;\n\ntype RealUseSESHookType =\n // This import depends only on the @types/use-sync-external-store package, not\n // the actual use-sync-external-store package, which is not installed. It\n // might be nice to get this type from React 18, but it still needs to work\n // when only React 17 or earlier is installed.\n typeof import(\"use-sync-external-store\").useSyncExternalStore;\n\n// Prevent webpack from complaining about our feature detection of the\n// useSyncExternalStore property of the React namespace, which is expected not\n// to exist when using React 17 and earlier, and that's fine.\nconst uSESKey = \"useSyncExternalStore\" as keyof typeof React;\nconst realHook = React[uSESKey] as RealUseSESHookType | undefined;\n\n// Adapted from https://www.npmjs.com/package/use-sync-external-store, with\n// Apollo Client deviations called out by \"// DEVIATION ...\" comments.\n\n// When/if React.useSyncExternalStore is defined, delegate fully to it.\nexport const useSyncExternalStore: RealUseSESHookType =\n realHook ||\n ((subscribe, getSnapshot, getServerSnapshot) => {\n // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n const value = getSnapshot();\n if (\n // DEVIATION: Using __DEV__\n __DEV__ &&\n !didWarnUncachedGetSnapshot &&\n // DEVIATION: Not using Object.is because we know our snapshots will never\n // be exotic primitive values like NaN, which is !== itself.\n value !== getSnapshot()\n ) {\n didWarnUncachedGetSnapshot = true;\n // DEVIATION: Using invariant.error instead of console.error directly.\n invariant.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n );\n }\n\n // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n const [{ inst }, forceUpdate] = React.useState({\n inst: { value, getSnapshot },\n });\n\n // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n if (canUseLayoutEffect) {\n // DEVIATION: We avoid calling useLayoutEffect when !canUseLayoutEffect,\n // which may seem like a conditional hook, but this code ends up behaving\n // unconditionally (one way or the other) because canUseLayoutEffect is\n // constant.\n React.useLayoutEffect(() => {\n Object.assign(inst, { value, getSnapshot });\n // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n }, [subscribe, value, getSnapshot]);\n } else {\n Object.assign(inst, { value, getSnapshot });\n }\n\n React.useEffect(() => {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n\n // Subscribe to the store and return a clean-up function.\n return subscribe(function handleStoreChange() {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst });\n }\n });\n }, [subscribe]);\n\n return value;\n });\n\nfunction checkIfSnapshotChanged({\n value,\n getSnapshot,\n}: {\n value: Snapshot;\n getSnapshot: () => Snapshot;\n}): boolean {\n try {\n return value !== getSnapshot();\n } catch {\n return true;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/index.d.ts new file mode 100644 index 0000000..130ff2a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/index.d.ts @@ -0,0 +1,10 @@ +import "../utilities/globals/index.js"; +export type { ApolloContextValue } from "./context/index.js"; +export { ApolloProvider, ApolloConsumer, getApolloContext, resetApolloContext, } from "./context/index.js"; +export * from "./hooks/index.js"; +export type { IDocumentDefinition } from "./parser/index.js"; +export { DocumentType, operationName, parser } from "./parser/index.js"; +export type { PreloadQueryOptions, PreloadQueryFetchPolicy, PreloadQueryFunction, } from "./query-preloader/createQueryPreloader.js"; +export { createQueryPreloader } from "./query-preloader/createQueryPreloader.js"; +export * from "./types/types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/index.js b/graphql-subscription/node_modules/@apollo/client/react/index.js new file mode 100644 index 0000000..960638f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/index.js @@ -0,0 +1,7 @@ +import "../utilities/globals/index.js"; +export { ApolloProvider, ApolloConsumer, getApolloContext, resetApolloContext, } from "./context/index.js"; +export * from "./hooks/index.js"; +export { DocumentType, operationName, parser } from "./parser/index.js"; +export { createQueryPreloader } from "./query-preloader/createQueryPreloader.js"; +export * from "./types/types.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/index.js.map new file mode 100644 index 0000000..884ba2a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAGvC,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,cAAc,kBAAkB,CAAC","sourcesContent":["import \"../utilities/globals/index.js\";\n\nexport type { ApolloContextValue } from \"./context/index.js\";\nexport {\n ApolloProvider,\n ApolloConsumer,\n getApolloContext,\n resetApolloContext,\n} from \"./context/index.js\";\n\nexport * from \"./hooks/index.js\";\n\nexport type { IDocumentDefinition } from \"./parser/index.js\";\nexport { DocumentType, operationName, parser } from \"./parser/index.js\";\n\nexport type {\n PreloadQueryOptions,\n PreloadQueryFetchPolicy,\n PreloadQueryFunction,\n} from \"./query-preloader/createQueryPreloader.js\";\nexport { createQueryPreloader } from \"./query-preloader/createQueryPreloader.js\";\n\nexport * from \"./types/types.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.d.ts b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.d.ts new file mode 100644 index 0000000..71bc95c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.d.ts @@ -0,0 +1,100 @@ +import type { ApolloQueryResult, ObservableQuery, OperationVariables, WatchQueryOptions } from "../../../core/index.js"; +import type { PromiseWithState } from "../../../utilities/index.js"; +import type { QueryKey } from "./types.js"; +type QueryRefPromise = PromiseWithState>; +type Listener = (promise: QueryRefPromise) => void; +type FetchMoreOptions = Parameters["fetchMore"]>[0]; +declare const QUERY_REFERENCE_SYMBOL: unique symbol; +declare const PROMISE_SYMBOL: unique symbol; +/** + * A `QueryReference` is an opaque object returned by {@link useBackgroundQuery}. + * A child component reading the `QueryReference` via {@link useReadQuery} will + * suspend until the promise resolves. + */ +export interface QueryReference { + /** @internal */ + readonly [QUERY_REFERENCE_SYMBOL]: InternalQueryReference; + /** @internal */ + [PROMISE_SYMBOL]: QueryRefPromise; + /** + * A function that returns a promise that resolves when the query has finished + * loading. The promise resolves with the `QueryReference` itself. + * + * @remarks + * This method is useful for preloading queries in data loading routers, such + * as [React Router](https://reactrouter.com/en/main) or [TanStack Router](https://tanstack.com/router), + * to prevent routes from transitioning until the query has finished loading. + * `data` is not exposed on the promise to discourage using the data in + * `loader` functions and exposing it to your route components. Instead, we + * prefer you rely on `useReadQuery` to access the data to ensure your + * component can rerender with cache updates. If you need to access raw query + * data, use `client.query()` directly. + * + * @example + * Here's an example using React Router's `loader` function: + * ```ts + * import { createQueryPreloader } from "@apollo/client"; + * + * const preloadQuery = createQueryPreloader(client); + * + * export async function loader() { + * const queryRef = preloadQuery(GET_DOGS_QUERY); + * + * return queryRef.toPromise(); + * } + * + * export function RouteComponent() { + * const queryRef = useLoaderData(); + * const { data } = useReadQuery(queryRef); + * + * // ... + * } + * ``` + * + * @alpha + */ + toPromise(): Promise>; +} +interface InternalQueryReferenceOptions { + onDispose?: () => void; + autoDisposeTimeoutMs?: number; +} +export declare function wrapQueryRef(internalQueryRef: InternalQueryReference): QueryReference; +export declare function getWrappedPromise(queryRef: QueryReference): QueryRefPromise; +export declare function unwrapQueryRef(queryRef: QueryReference): InternalQueryReference; +export declare function updateWrappedQueryRef(queryRef: QueryReference, promise: QueryRefPromise): void; +declare const OBSERVED_CHANGED_OPTIONS: readonly ["canonizeResults", "context", "errorPolicy", "fetchPolicy", "refetchWritePolicy", "returnPartialData"]; +type ObservedOptions = Pick; +export declare class InternalQueryReference { + result: ApolloQueryResult; + readonly key: QueryKey; + readonly observable: ObservableQuery; + promise: QueryRefPromise; + private subscription; + private listeners; + private autoDisposeTimeoutId?; + private resolve; + private reject; + private references; + constructor(observable: ObservableQuery, options: InternalQueryReferenceOptions); + get disposed(): boolean; + get watchQueryOptions(): WatchQueryOptions; + reinitialize(): void; + retain(): () => void; + didChangeOptions(watchQueryOptions: ObservedOptions): boolean; + applyOptions(watchQueryOptions: ObservedOptions): QueryRefPromise; + listen(listener: Listener): () => void; + refetch(variables: OperationVariables | undefined): Promise>; + fetchMore(options: FetchMoreOptions): Promise>; + private dispose; + private onDispose; + private handleNext; + private handleError; + private deliver; + private initiateFetch; + private subscribeToQuery; + private setResult; + private createPendingPromise; +} +export {}; +//# sourceMappingURL=QueryReference.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js new file mode 100644 index 0000000..d92c836 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js @@ -0,0 +1,279 @@ +import { __assign } from "tslib"; +import { equal } from "@wry/equality"; +import { createFulfilledPromise, createRejectedPromise, } from "../../../utilities/index.js"; +import { wrapPromiseWithState } from "../../../utilities/index.js"; +var QUERY_REFERENCE_SYMBOL = Symbol(); +var PROMISE_SYMBOL = Symbol(); +export function wrapQueryRef(internalQueryRef) { + var _a; + var ref = (_a = { + toPromise: function () { + // We avoid resolving this promise with the query data because we want to + // discourage using the server data directly from the queryRef. Instead, + // the data should be accessed through `useReadQuery`. When the server + // data is needed, its better to use `client.query()` directly. + // + // Here we resolve with the ref itself to make using this in React Router + // or TanStack Router `loader` functions a bit more ergonomic e.g. + // + // function loader() { + // return { queryRef: await preloadQuery(query).toPromise() } + // } + return getWrappedPromise(ref).then(function () { return ref; }); + } + }, + _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef, + _a[PROMISE_SYMBOL] = internalQueryRef.promise, + _a); + return ref; +} +export function getWrappedPromise(queryRef) { + var internalQueryRef = unwrapQueryRef(queryRef); + return internalQueryRef.promise.status === "fulfilled" ? + internalQueryRef.promise + : queryRef[PROMISE_SYMBOL]; +} +export function unwrapQueryRef(queryRef) { + return queryRef[QUERY_REFERENCE_SYMBOL]; +} +export function updateWrappedQueryRef(queryRef, promise) { + queryRef[PROMISE_SYMBOL] = promise; +} +var OBSERVED_CHANGED_OPTIONS = [ + "canonizeResults", + "context", + "errorPolicy", + "fetchPolicy", + "refetchWritePolicy", + "returnPartialData", +]; +var InternalQueryReference = /** @class */ (function () { + function InternalQueryReference(observable, options) { + var _this = this; + this.key = {}; + this.listeners = new Set(); + this.references = 0; + this.handleNext = this.handleNext.bind(this); + this.handleError = this.handleError.bind(this); + this.dispose = this.dispose.bind(this); + this.observable = observable; + if (options.onDispose) { + this.onDispose = options.onDispose; + } + this.setResult(); + this.subscribeToQuery(); + // Start a timer that will automatically dispose of the query if the + // suspended resource does not use this queryRef in the given time. This + // helps prevent memory leaks when a component has unmounted before the + // query has finished loading. + var startDisposeTimer = function () { + var _a; + if (!_this.references) { + _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000); + } + }; + // We wait until the request has settled to ensure we don't dispose of the + // query ref before the request finishes, otherwise we would leave the + // promise in a pending state rendering the suspense boundary indefinitely. + this.promise.then(startDisposeTimer, startDisposeTimer); + } + Object.defineProperty(InternalQueryReference.prototype, "disposed", { + get: function () { + return this.subscription.closed; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", { + get: function () { + return this.observable.options; + }, + enumerable: false, + configurable: true + }); + InternalQueryReference.prototype.reinitialize = function () { + var observable = this.observable; + var originalFetchPolicy = this.watchQueryOptions.fetchPolicy; + try { + if (originalFetchPolicy !== "no-cache") { + observable.resetLastResults(); + observable.silentSetOptions({ fetchPolicy: "cache-first" }); + } + else { + observable.silentSetOptions({ fetchPolicy: "standby" }); + } + this.subscribeToQuery(); + if (originalFetchPolicy === "no-cache") { + return; + } + observable.resetDiff(); + this.setResult(); + } + finally { + observable.silentSetOptions({ fetchPolicy: originalFetchPolicy }); + } + }; + InternalQueryReference.prototype.retain = function () { + var _this = this; + this.references++; + clearTimeout(this.autoDisposeTimeoutId); + var disposed = false; + return function () { + if (disposed) { + return; + } + disposed = true; + _this.references--; + // Wait before fully disposing in case the app is running in strict mode. + setTimeout(function () { + if (!_this.references) { + _this.dispose(); + } + }); + }; + }; + InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) { + var _this = this; + return OBSERVED_CHANGED_OPTIONS.some(function (option) { + return !equal(_this.watchQueryOptions[option], watchQueryOptions[option]); + }); + }; + InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) { + var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults; + // "standby" is used when `skip` is set to `true`. Detect when we've + // enabled the query (i.e. `skip` is `false`) to execute a network request. + if (currentFetchPolicy === "standby" && + currentFetchPolicy !== watchQueryOptions.fetchPolicy) { + this.initiateFetch(this.observable.reobserve(watchQueryOptions)); + } + else { + this.observable.silentSetOptions(watchQueryOptions); + if (currentCanonizeResults !== watchQueryOptions.canonizeResults) { + this.result = __assign(__assign({}, this.result), this.observable.getCurrentResult()); + this.promise = createFulfilledPromise(this.result); + } + } + return this.promise; + }; + InternalQueryReference.prototype.listen = function (listener) { + var _this = this; + this.listeners.add(listener); + return function () { + _this.listeners.delete(listener); + }; + }; + InternalQueryReference.prototype.refetch = function (variables) { + return this.initiateFetch(this.observable.refetch(variables)); + }; + InternalQueryReference.prototype.fetchMore = function (options) { + return this.initiateFetch(this.observable.fetchMore(options)); + }; + InternalQueryReference.prototype.dispose = function () { + this.subscription.unsubscribe(); + this.onDispose(); + }; + InternalQueryReference.prototype.onDispose = function () { + // noop. overridable by options + }; + InternalQueryReference.prototype.handleNext = function (result) { + var _a; + switch (this.promise.status) { + case "pending": { + // Maintain the last successful `data` value if the next result does not + // have one. + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result); + break; + } + default: { + // This occurs when switching to a result that is fully cached when this + // class is instantiated. ObservableQuery will run reobserve when + // subscribing, which delivers a result from the cache. + if (result.data === this.result.data && + result.networkStatus === this.result.networkStatus) { + return; + } + // Maintain the last successful `data` value if the next result does not + // have one. + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + this.promise = createFulfilledPromise(result); + this.deliver(this.promise); + break; + } + } + }; + InternalQueryReference.prototype.handleError = function (error) { + var _a; + this.subscription.unsubscribe(); + this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError); + switch (this.promise.status) { + case "pending": { + (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error); + break; + } + default: { + this.promise = createRejectedPromise(error); + this.deliver(this.promise); + } + } + }; + InternalQueryReference.prototype.deliver = function (promise) { + this.listeners.forEach(function (listener) { return listener(promise); }); + }; + InternalQueryReference.prototype.initiateFetch = function (returnedPromise) { + var _this = this; + this.promise = this.createPendingPromise(); + this.promise.catch(function () { }); + // If the data returned from the fetch is deeply equal to the data already + // in the cache, `handleNext` will not be triggered leaving the promise we + // created in a pending state forever. To avoid this situtation, we attempt + // to resolve the promise if `handleNext` hasn't been run to ensure the + // promise is resolved correctly. + returnedPromise + .then(function (result) { + var _a; + if (_this.promise.status === "pending") { + _this.result = result; + (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result); + } + }) + .catch(function () { }); + return returnedPromise; + }; + InternalQueryReference.prototype.subscribeToQuery = function () { + var _this = this; + this.subscription = this.observable + .filter(function (result) { return !equal(result.data, {}) && !equal(result, _this.result); }) + .subscribe(this.handleNext, this.handleError); + }; + InternalQueryReference.prototype.setResult = function () { + // Don't save this result as last result to prevent delivery of last result + // when first subscribing + var result = this.observable.getCurrentResult(false); + if (equal(result, this.result)) { + return; + } + this.result = result; + this.promise = + (result.data && + (!result.partial || this.watchQueryOptions.returnPartialData)) ? + createFulfilledPromise(result) + : this.createPendingPromise(); + }; + InternalQueryReference.prototype.createPendingPromise = function () { + var _this = this; + return wrapPromiseWithState(new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + })); + }; + return InternalQueryReference; +}()); +export { InternalQueryReference }; +//# sourceMappingURL=QueryReference.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js.map b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js.map new file mode 100644 index 0000000..b28c69b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/QueryReference.js.map @@ -0,0 +1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AC;gBAChC,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAClC,CAAC;IAEO,qDAAoB,GAA5B;QAAA,iBAOC;QANC,OAAO,oBAAoB,CACzB,IAAI,OAAO,CAA2B,UAAC,OAAO,EAAE,MAAM;YACpD,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IACH,6BAAC;AAAD,CAAC,AAxRD,IAwRC","sourcesContent":["import { equal } from \"@wry/equality\";\nimport type {\n ApolloError,\n ApolloQueryResult,\n ObservableQuery,\n OperationVariables,\n WatchQueryOptions,\n} from \"../../../core/index.js\";\nimport type {\n ObservableSubscription,\n PromiseWithState,\n} from \"../../../utilities/index.js\";\nimport {\n createFulfilledPromise,\n createRejectedPromise,\n} from \"../../../utilities/index.js\";\nimport type { QueryKey } from \"./types.js\";\nimport type { useBackgroundQuery, useReadQuery } from \"../../hooks/index.js\";\nimport { wrapPromiseWithState } from \"../../../utilities/index.js\";\n\ntype QueryRefPromise = PromiseWithState>;\n\ntype Listener = (promise: QueryRefPromise) => void;\n\ntype FetchMoreOptions = Parameters<\n ObservableQuery[\"fetchMore\"]\n>[0];\n\nconst QUERY_REFERENCE_SYMBOL: unique symbol = Symbol();\nconst PROMISE_SYMBOL: unique symbol = Symbol();\n\n/**\n * A `QueryReference` is an opaque object returned by {@link useBackgroundQuery}.\n * A child component reading the `QueryReference` via {@link useReadQuery} will\n * suspend until the promise resolves.\n */\nexport interface QueryReference {\n /** @internal */\n readonly [QUERY_REFERENCE_SYMBOL]: InternalQueryReference;\n /** @internal */\n [PROMISE_SYMBOL]: QueryRefPromise;\n /**\n * A function that returns a promise that resolves when the query has finished\n * loading. The promise resolves with the `QueryReference` itself.\n *\n * @remarks\n * This method is useful for preloading queries in data loading routers, such\n * as [React Router](https://reactrouter.com/en/main) or [TanStack Router](https://tanstack.com/router),\n * to prevent routes from transitioning until the query has finished loading.\n * `data` is not exposed on the promise to discourage using the data in\n * `loader` functions and exposing it to your route components. Instead, we\n * prefer you rely on `useReadQuery` to access the data to ensure your\n * component can rerender with cache updates. If you need to access raw query\n * data, use `client.query()` directly.\n *\n * @example\n * Here's an example using React Router's `loader` function:\n * ```ts\n * import { createQueryPreloader } from \"@apollo/client\";\n *\n * const preloadQuery = createQueryPreloader(client);\n *\n * export async function loader() {\n * const queryRef = preloadQuery(GET_DOGS_QUERY);\n *\n * return queryRef.toPromise();\n * }\n *\n * export function RouteComponent() {\n * const queryRef = useLoaderData();\n * const { data } = useReadQuery(queryRef);\n *\n * // ...\n * }\n * ```\n *\n * @alpha\n */\n toPromise(): Promise>;\n}\n\ninterface InternalQueryReferenceOptions {\n onDispose?: () => void;\n autoDisposeTimeoutMs?: number;\n}\n\nexport function wrapQueryRef(\n internalQueryRef: InternalQueryReference\n) {\n const ref: QueryReference = {\n toPromise() {\n // We avoid resolving this promise with the query data because we want to\n // discourage using the server data directly from the queryRef. Instead,\n // the data should be accessed through `useReadQuery`. When the server\n // data is needed, its better to use `client.query()` directly.\n //\n // Here we resolve with the ref itself to make using this in React Router\n // or TanStack Router `loader` functions a bit more ergonomic e.g.\n //\n // function loader() {\n // return { queryRef: await preloadQuery(query).toPromise() }\n // }\n return getWrappedPromise(ref).then(() => ref);\n },\n [QUERY_REFERENCE_SYMBOL]: internalQueryRef,\n [PROMISE_SYMBOL]: internalQueryRef.promise,\n };\n\n return ref;\n}\n\nexport function getWrappedPromise(queryRef: QueryReference) {\n const internalQueryRef = unwrapQueryRef(queryRef);\n\n return internalQueryRef.promise.status === \"fulfilled\" ?\n internalQueryRef.promise\n : queryRef[PROMISE_SYMBOL];\n}\n\nexport function unwrapQueryRef(\n queryRef: QueryReference\n): InternalQueryReference {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\n\nexport function updateWrappedQueryRef(\n queryRef: QueryReference,\n promise: QueryRefPromise\n) {\n queryRef[PROMISE_SYMBOL] = promise;\n}\n\nconst OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n] as const;\n\ntype ObservedOptions = Pick<\n WatchQueryOptions,\n (typeof OBSERVED_CHANGED_OPTIONS)[number]\n>;\n\nexport class InternalQueryReference {\n public result!: ApolloQueryResult;\n public readonly key: QueryKey = {};\n public readonly observable: ObservableQuery;\n\n public promise!: QueryRefPromise;\n\n private subscription!: ObservableSubscription;\n private listeners = new Set>();\n private autoDisposeTimeoutId?: NodeJS.Timeout;\n\n private resolve: ((result: ApolloQueryResult) => void) | undefined;\n private reject: ((error: unknown) => void) | undefined;\n\n private references = 0;\n\n constructor(\n observable: ObservableQuery,\n options: InternalQueryReferenceOptions\n ) {\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n\n this.setResult();\n this.subscribeToQuery();\n\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n const startDisposeTimer = () => {\n if (!this.references) {\n this.autoDisposeTimeoutId = setTimeout(\n this.dispose,\n options.autoDisposeTimeoutMs ?? 30_000\n );\n }\n };\n\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n\n get disposed() {\n return this.subscription.closed;\n }\n\n get watchQueryOptions() {\n return this.observable.options;\n }\n\n reinitialize() {\n const { observable } = this;\n\n const originalFetchPolicy = this.watchQueryOptions.fetchPolicy;\n\n try {\n if (originalFetchPolicy !== \"no-cache\") {\n observable.resetLastResults();\n observable.silentSetOptions({ fetchPolicy: \"cache-first\" });\n } else {\n observable.silentSetOptions({ fetchPolicy: \"standby\" });\n }\n\n this.subscribeToQuery();\n\n if (originalFetchPolicy === \"no-cache\") {\n return;\n }\n\n observable.resetDiff();\n this.setResult();\n } finally {\n observable.silentSetOptions({ fetchPolicy: originalFetchPolicy });\n }\n }\n\n retain() {\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n let disposed = false;\n\n return () => {\n if (disposed) {\n return;\n }\n\n disposed = true;\n this.references--;\n\n // Wait before fully disposing in case the app is running in strict mode.\n setTimeout(() => {\n if (!this.references) {\n this.dispose();\n }\n });\n };\n }\n\n didChangeOptions(watchQueryOptions: ObservedOptions) {\n return OBSERVED_CHANGED_OPTIONS.some(\n (option) =>\n !equal(this.watchQueryOptions[option], watchQueryOptions[option])\n );\n }\n\n applyOptions(watchQueryOptions: ObservedOptions) {\n const {\n fetchPolicy: currentFetchPolicy,\n canonizeResults: currentCanonizeResults,\n } = this.watchQueryOptions;\n\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (\n currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy\n ) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n } else {\n this.observable.silentSetOptions(watchQueryOptions);\n\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = { ...this.result, ...this.observable.getCurrentResult() };\n this.promise = createFulfilledPromise(this.result);\n }\n }\n\n return this.promise;\n }\n\n listen(listener: Listener) {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n refetch(variables: OperationVariables | undefined) {\n return this.initiateFetch(this.observable.refetch(variables));\n }\n\n fetchMore(options: FetchMoreOptions) {\n return this.initiateFetch(this.observable.fetchMore(options));\n }\n\n private dispose() {\n this.subscription.unsubscribe();\n this.onDispose();\n }\n\n private onDispose() {\n // noop. overridable by options\n }\n\n private handleNext(result: ApolloQueryResult) {\n switch (this.promise.status) {\n case \"pending\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n this.resolve?.(result);\n break;\n }\n default: {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (\n result.data === this.result.data &&\n result.networkStatus === this.result.networkStatus\n ) {\n return;\n }\n\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n }\n\n private handleError(error: ApolloError) {\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(\n this.handleNext,\n this.handleError\n );\n\n switch (this.promise.status) {\n case \"pending\": {\n this.reject?.(error);\n break;\n }\n default: {\n this.promise = createRejectedPromise>(error);\n this.deliver(this.promise);\n }\n }\n }\n\n private deliver(promise: QueryRefPromise) {\n this.listeners.forEach((listener) => listener(promise));\n }\n\n private initiateFetch(returnedPromise: Promise>) {\n this.promise = this.createPendingPromise();\n this.promise.catch(() => {});\n\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then((result) => {\n if (this.promise.status === \"pending\") {\n this.result = result;\n this.resolve?.(result);\n }\n })\n .catch(() => {});\n\n return returnedPromise;\n }\n\n private subscribeToQuery() {\n this.subscription = this.observable\n .filter(\n (result) => !equal(result.data, {}) && !equal(result, this.result)\n )\n .subscribe(this.handleNext, this.handleError);\n }\n\n private setResult() {\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n const result = this.observable.getCurrentResult(false);\n\n if (equal(result, this.result)) {\n return;\n }\n\n this.result = result;\n this.promise =\n (\n result.data &&\n (!result.partial || this.watchQueryOptions.returnPartialData)\n ) ?\n createFulfilledPromise(result)\n : this.createPendingPromise();\n }\n\n private createPendingPromise() {\n return wrapPromiseWithState(\n new Promise>((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n })\n );\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.d.ts b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.d.ts new file mode 100644 index 0000000..50b631d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.d.ts @@ -0,0 +1,23 @@ +import type { ObservableQuery } from "../../../core/index.js"; +import { InternalQueryReference } from "./QueryReference.js"; +import type { CacheKey } from "./types.js"; +export interface SuspenseCacheOptions { + /** + * Specifies the amount of time, in milliseconds, the suspense cache will wait + * for a suspended component to read from the suspense cache before it + * automatically disposes of the query. This prevents memory leaks when a + * component unmounts before a suspended resource finishes loading. Increase + * the timeout if your queries take longer than than the specified time to + * prevent your queries from suspending over and over. + * + * Defaults to 30 seconds. + */ + autoDisposeTimeoutMs?: number; +} +export declare class SuspenseCache { + private queryRefs; + private options; + constructor(options?: SuspenseCacheOptions); + getQueryRef(cacheKey: CacheKey, createObservable: () => ObservableQuery): InternalQueryReference; +} +//# sourceMappingURL=SuspenseCache.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js new file mode 100644 index 0000000..5e9507e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js @@ -0,0 +1,25 @@ +import { Trie } from "@wry/trie"; +import { canUseWeakMap } from "../../../utilities/index.js"; +import { InternalQueryReference } from "./QueryReference.js"; +var SuspenseCache = /** @class */ (function () { + function SuspenseCache(options) { + if (options === void 0) { options = Object.create(null); } + this.queryRefs = new Trie(canUseWeakMap); + this.options = options; + } + SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) { + var ref = this.queryRefs.lookupArray(cacheKey); + if (!ref.current) { + ref.current = new InternalQueryReference(createObservable(), { + autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs, + onDispose: function () { + delete ref.current; + }, + }); + } + return ref.current; + }; + return SuspenseCache; +}()); +export { SuspenseCache }; +//# sourceMappingURL=SuspenseCache.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js.map b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js.map new file mode 100644 index 0000000..47cd2de --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/SuspenseCache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SuspenseCache.js","sourceRoot":"","sources":["../../../../src/react/internal/cache/SuspenseCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAiB7D;IAME,uBAAY,OAAmD;QAAnD,wBAAA,EAAA,UAAgC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QALvD,cAAS,GAAG,IAAI,IAAI,CAC1B,aAAa,CACd,CAAC;QAIA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,mCAAW,GAAX,UACE,QAAkB,EAClB,gBAA8C;QAE9C,IAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAE9C,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,GAAG,CAAC,OAAO,GAAG,IAAI,sBAAsB,CAAC,gBAAgB,EAAE,EAAE;gBAC3D,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB;gBACvD,SAAS,EAAE;oBACT,OAAO,GAAG,CAAC,OAAO,CAAC;gBACrB,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IACH,oBAAC;AAAD,CAAC,AA7BD,IA6BC","sourcesContent":["import { Trie } from \"@wry/trie\";\nimport type { ObservableQuery } from \"../../../core/index.js\";\nimport { canUseWeakMap } from \"../../../utilities/index.js\";\nimport { InternalQueryReference } from \"./QueryReference.js\";\nimport type { CacheKey } from \"./types.js\";\n\nexport interface SuspenseCacheOptions {\n /**\n * Specifies the amount of time, in milliseconds, the suspense cache will wait\n * for a suspended component to read from the suspense cache before it\n * automatically disposes of the query. This prevents memory leaks when a\n * component unmounts before a suspended resource finishes loading. Increase\n * the timeout if your queries take longer than than the specified time to\n * prevent your queries from suspending over and over.\n *\n * Defaults to 30 seconds.\n */\n autoDisposeTimeoutMs?: number;\n}\n\nexport class SuspenseCache {\n private queryRefs = new Trie<{ current?: InternalQueryReference }>(\n canUseWeakMap\n );\n private options: SuspenseCacheOptions;\n\n constructor(options: SuspenseCacheOptions = Object.create(null)) {\n this.options = options;\n }\n\n getQueryRef(\n cacheKey: CacheKey,\n createObservable: () => ObservableQuery\n ) {\n const ref = this.queryRefs.lookupArray(cacheKey) as {\n current?: InternalQueryReference;\n };\n\n if (!ref.current) {\n ref.current = new InternalQueryReference(createObservable(), {\n autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,\n onDispose: () => {\n delete ref.current;\n },\n });\n }\n\n return ref.current;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.d.ts b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.d.ts new file mode 100644 index 0000000..0bb57fb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.d.ts @@ -0,0 +1,16 @@ +import type { SuspenseCacheOptions } from "../index.js"; +import { SuspenseCache } from "./SuspenseCache.js"; +import type { ApolloClient } from "../../../core/ApolloClient.js"; +declare module "../../../core/ApolloClient.js" { + interface DefaultOptions { + react?: { + suspense?: Readonly; + }; + } +} +declare const suspenseCacheSymbol: unique symbol; +export declare function getSuspenseCache(client: ApolloClient & { + [suspenseCacheSymbol]?: SuspenseCache; +}): SuspenseCache; +export {}; +//# sourceMappingURL=getSuspenseCache.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js new file mode 100644 index 0000000..3596f9c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js @@ -0,0 +1,10 @@ +import { SuspenseCache } from "./SuspenseCache.js"; +var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache"); +export function getSuspenseCache(client) { + var _a; + if (!client[suspenseCacheSymbol]) { + client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense); + } + return client[suspenseCacheSymbol]; +} +//# sourceMappingURL=getSuspenseCache.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js.map b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js.map new file mode 100644 index 0000000..0c452e5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/getSuspenseCache.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getSuspenseCache.js","sourceRoot":"","sources":["../../../../src/react/internal/cache/getSuspenseCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAWnD,IAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAE/D,MAAM,UAAU,gBAAgB,CAC9B,MAEC;;IAED,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI,aAAa,CAC7C,MAAA,MAAM,CAAC,cAAc,CAAC,KAAK,0CAAE,QAAQ,CACtC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import type { SuspenseCacheOptions } from \"../index.js\";\nimport { SuspenseCache } from \"./SuspenseCache.js\";\nimport type { ApolloClient } from \"../../../core/ApolloClient.js\";\n\ndeclare module \"../../../core/ApolloClient.js\" {\n interface DefaultOptions {\n react?: {\n suspense?: Readonly;\n };\n }\n}\n\nconst suspenseCacheSymbol = Symbol.for(\"apollo.suspenseCache\");\n\nexport function getSuspenseCache(\n client: ApolloClient & {\n [suspenseCacheSymbol]?: SuspenseCache;\n }\n) {\n if (!client[suspenseCacheSymbol]) {\n client[suspenseCacheSymbol] = new SuspenseCache(\n client.defaultOptions.react?.suspense\n );\n }\n\n return client[suspenseCacheSymbol];\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.d.ts b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.d.ts new file mode 100644 index 0000000..16c75ea --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.d.ts @@ -0,0 +1,10 @@ +import type { DocumentNode } from "graphql"; +export type CacheKey = [ + query: DocumentNode, + stringifiedVariables: string, + ...queryKey: any[] +]; +export interface QueryKey { + __queryKey?: string; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js.map b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js.map new file mode 100644 index 0000000..fbc4ba2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/cache/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/react/internal/cache/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\";\n\nexport type CacheKey = [\n query: DocumentNode,\n stringifiedVariables: string,\n ...queryKey: any[],\n];\n\nexport interface QueryKey {\n __queryKey?: string;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/internal/index.d.ts new file mode 100644 index 0000000..c4d6729 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/index.d.ts @@ -0,0 +1,6 @@ +export { getSuspenseCache } from "./cache/getSuspenseCache.js"; +export type { CacheKey, QueryKey } from "./cache/types.js"; +export type { QueryReference } from "./cache/QueryReference.js"; +export { InternalQueryReference, getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "./cache/QueryReference.js"; +export type { SuspenseCacheOptions } from "./cache/SuspenseCache.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/index.js b/graphql-subscription/node_modules/@apollo/client/react/internal/index.js new file mode 100644 index 0000000..4132ca2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/index.js @@ -0,0 +1,3 @@ +export { getSuspenseCache } from "./cache/getSuspenseCache.js"; +export { InternalQueryReference, getWrappedPromise, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "./cache/QueryReference.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/internal/index.js.map new file mode 100644 index 0000000..30e8ea6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/internal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,YAAY,GACb,MAAM,2BAA2B,CAAC","sourcesContent":["export { getSuspenseCache } from \"./cache/getSuspenseCache.js\";\nexport type { CacheKey, QueryKey } from \"./cache/types.js\";\nexport type { QueryReference } from \"./cache/QueryReference.js\";\nexport {\n InternalQueryReference,\n getWrappedPromise,\n unwrapQueryRef,\n updateWrappedQueryRef,\n wrapQueryRef,\n} from \"./cache/QueryReference.js\";\nexport type { SuspenseCacheOptions } from \"./cache/SuspenseCache.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs b/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs new file mode 100644 index 0000000..4b2d91a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs @@ -0,0 +1,284 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var trie = require('@wry/trie'); +var utilities = require('../../utilities'); +var tslib = require('tslib'); +var equality = require('@wry/equality'); + +var QUERY_REFERENCE_SYMBOL = Symbol(); +var PROMISE_SYMBOL = Symbol(); +function wrapQueryRef(internalQueryRef) { + var _a; + var ref = (_a = { + toPromise: function () { + return getWrappedPromise(ref).then(function () { return ref; }); + } + }, + _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef, + _a[PROMISE_SYMBOL] = internalQueryRef.promise, + _a); + return ref; +} +function getWrappedPromise(queryRef) { + var internalQueryRef = unwrapQueryRef(queryRef); + return internalQueryRef.promise.status === "fulfilled" ? + internalQueryRef.promise + : queryRef[PROMISE_SYMBOL]; +} +function unwrapQueryRef(queryRef) { + return queryRef[QUERY_REFERENCE_SYMBOL]; +} +function updateWrappedQueryRef(queryRef, promise) { + queryRef[PROMISE_SYMBOL] = promise; +} +var OBSERVED_CHANGED_OPTIONS = [ + "canonizeResults", + "context", + "errorPolicy", + "fetchPolicy", + "refetchWritePolicy", + "returnPartialData", +]; +var InternalQueryReference = (function () { + function InternalQueryReference(observable, options) { + var _this = this; + this.key = {}; + this.listeners = new Set(); + this.references = 0; + this.handleNext = this.handleNext.bind(this); + this.handleError = this.handleError.bind(this); + this.dispose = this.dispose.bind(this); + this.observable = observable; + if (options.onDispose) { + this.onDispose = options.onDispose; + } + this.setResult(); + this.subscribeToQuery(); + var startDisposeTimer = function () { + var _a; + if (!_this.references) { + _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000); + } + }; + this.promise.then(startDisposeTimer, startDisposeTimer); + } + Object.defineProperty(InternalQueryReference.prototype, "disposed", { + get: function () { + return this.subscription.closed; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", { + get: function () { + return this.observable.options; + }, + enumerable: false, + configurable: true + }); + InternalQueryReference.prototype.reinitialize = function () { + var observable = this.observable; + var originalFetchPolicy = this.watchQueryOptions.fetchPolicy; + try { + if (originalFetchPolicy !== "no-cache") { + observable.resetLastResults(); + observable.silentSetOptions({ fetchPolicy: "cache-first" }); + } + else { + observable.silentSetOptions({ fetchPolicy: "standby" }); + } + this.subscribeToQuery(); + if (originalFetchPolicy === "no-cache") { + return; + } + observable.resetDiff(); + this.setResult(); + } + finally { + observable.silentSetOptions({ fetchPolicy: originalFetchPolicy }); + } + }; + InternalQueryReference.prototype.retain = function () { + var _this = this; + this.references++; + clearTimeout(this.autoDisposeTimeoutId); + var disposed = false; + return function () { + if (disposed) { + return; + } + disposed = true; + _this.references--; + setTimeout(function () { + if (!_this.references) { + _this.dispose(); + } + }); + }; + }; + InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) { + var _this = this; + return OBSERVED_CHANGED_OPTIONS.some(function (option) { + return !equality.equal(_this.watchQueryOptions[option], watchQueryOptions[option]); + }); + }; + InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) { + var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults; + if (currentFetchPolicy === "standby" && + currentFetchPolicy !== watchQueryOptions.fetchPolicy) { + this.initiateFetch(this.observable.reobserve(watchQueryOptions)); + } + else { + this.observable.silentSetOptions(watchQueryOptions); + if (currentCanonizeResults !== watchQueryOptions.canonizeResults) { + this.result = tslib.__assign(tslib.__assign({}, this.result), this.observable.getCurrentResult()); + this.promise = utilities.createFulfilledPromise(this.result); + } + } + return this.promise; + }; + InternalQueryReference.prototype.listen = function (listener) { + var _this = this; + this.listeners.add(listener); + return function () { + _this.listeners.delete(listener); + }; + }; + InternalQueryReference.prototype.refetch = function (variables) { + return this.initiateFetch(this.observable.refetch(variables)); + }; + InternalQueryReference.prototype.fetchMore = function (options) { + return this.initiateFetch(this.observable.fetchMore(options)); + }; + InternalQueryReference.prototype.dispose = function () { + this.subscription.unsubscribe(); + this.onDispose(); + }; + InternalQueryReference.prototype.onDispose = function () { + }; + InternalQueryReference.prototype.handleNext = function (result) { + var _a; + switch (this.promise.status) { + case "pending": { + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result); + break; + } + default: { + if (result.data === this.result.data && + result.networkStatus === this.result.networkStatus) { + return; + } + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + this.promise = utilities.createFulfilledPromise(result); + this.deliver(this.promise); + break; + } + } + }; + InternalQueryReference.prototype.handleError = function (error) { + var _a; + this.subscription.unsubscribe(); + this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError); + switch (this.promise.status) { + case "pending": { + (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error); + break; + } + default: { + this.promise = utilities.createRejectedPromise(error); + this.deliver(this.promise); + } + } + }; + InternalQueryReference.prototype.deliver = function (promise) { + this.listeners.forEach(function (listener) { return listener(promise); }); + }; + InternalQueryReference.prototype.initiateFetch = function (returnedPromise) { + var _this = this; + this.promise = this.createPendingPromise(); + this.promise.catch(function () { }); + returnedPromise + .then(function (result) { + var _a; + if (_this.promise.status === "pending") { + _this.result = result; + (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result); + } + }) + .catch(function () { }); + return returnedPromise; + }; + InternalQueryReference.prototype.subscribeToQuery = function () { + var _this = this; + this.subscription = this.observable + .filter(function (result) { return !equality.equal(result.data, {}) && !equality.equal(result, _this.result); }) + .subscribe(this.handleNext, this.handleError); + }; + InternalQueryReference.prototype.setResult = function () { + var result = this.observable.getCurrentResult(false); + if (equality.equal(result, this.result)) { + return; + } + this.result = result; + this.promise = + (result.data && + (!result.partial || this.watchQueryOptions.returnPartialData)) ? + utilities.createFulfilledPromise(result) + : this.createPendingPromise(); + }; + InternalQueryReference.prototype.createPendingPromise = function () { + var _this = this; + return utilities.wrapPromiseWithState(new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + })); + }; + return InternalQueryReference; +}()); + +var SuspenseCache = (function () { + function SuspenseCache(options) { + if (options === void 0) { options = Object.create(null); } + this.queryRefs = new trie.Trie(utilities.canUseWeakMap); + this.options = options; + } + SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) { + var ref = this.queryRefs.lookupArray(cacheKey); + if (!ref.current) { + ref.current = new InternalQueryReference(createObservable(), { + autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs, + onDispose: function () { + delete ref.current; + }, + }); + } + return ref.current; + }; + return SuspenseCache; +}()); + +var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache"); +function getSuspenseCache(client) { + var _a; + if (!client[suspenseCacheSymbol]) { + client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense); + } + return client[suspenseCacheSymbol]; +} + +exports.InternalQueryReference = InternalQueryReference; +exports.getSuspenseCache = getSuspenseCache; +exports.getWrappedPromise = getWrappedPromise; +exports.unwrapQueryRef = unwrapQueryRef; +exports.updateWrappedQueryRef = updateWrappedQueryRef; +exports.wrapQueryRef = wrapQueryRef; +//# sourceMappingURL=internal.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.map new file mode 100644 index 0000000..af035f3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"internal.cjs","sources":["cache/QueryReference.js","cache/SuspenseCache.js","cache/getSuspenseCache.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { createFulfilledPromise, createRejectedPromise, } from \"../../../utilities/index.js\";\nimport { wrapPromiseWithState } from \"../../../utilities/index.js\";\nvar QUERY_REFERENCE_SYMBOL = Symbol();\nvar PROMISE_SYMBOL = Symbol();\nexport function wrapQueryRef(internalQueryRef) {\n var _a;\n var ref = (_a = {\n toPromise: function () {\n // We avoid resolving this promise with the query data because we want to\n // discourage using the server data directly from the queryRef. Instead,\n // the data should be accessed through `useReadQuery`. When the server\n // data is needed, its better to use `client.query()` directly.\n //\n // Here we resolve with the ref itself to make using this in React Router\n // or TanStack Router `loader` functions a bit more ergonomic e.g.\n //\n // function loader() {\n // return { queryRef: await preloadQuery(query).toPromise() }\n // }\n return getWrappedPromise(ref).then(function () { return ref; });\n }\n },\n _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef,\n _a[PROMISE_SYMBOL] = internalQueryRef.promise,\n _a);\n return ref;\n}\nexport function getWrappedPromise(queryRef) {\n var internalQueryRef = unwrapQueryRef(queryRef);\n return internalQueryRef.promise.status === \"fulfilled\" ?\n internalQueryRef.promise\n : queryRef[PROMISE_SYMBOL];\n}\nexport function unwrapQueryRef(queryRef) {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\nexport function updateWrappedQueryRef(queryRef, promise) {\n queryRef[PROMISE_SYMBOL] = promise;\n}\nvar OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n];\nvar InternalQueryReference = /** @class */ (function () {\n function InternalQueryReference(observable, options) {\n var _this = this;\n this.key = {};\n this.listeners = new Set();\n this.references = 0;\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n this.setResult();\n this.subscribeToQuery();\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n var startDisposeTimer = function () {\n var _a;\n if (!_this.references) {\n _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);\n }\n };\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n Object.defineProperty(InternalQueryReference.prototype, \"disposed\", {\n get: function () {\n return this.subscription.closed;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InternalQueryReference.prototype, \"watchQueryOptions\", {\n get: function () {\n return this.observable.options;\n },\n enumerable: false,\n configurable: true\n });\n InternalQueryReference.prototype.reinitialize = function () {\n var observable = this.observable;\n var originalFetchPolicy = this.watchQueryOptions.fetchPolicy;\n try {\n if (originalFetchPolicy !== \"no-cache\") {\n observable.resetLastResults();\n observable.silentSetOptions({ fetchPolicy: \"cache-first\" });\n }\n else {\n observable.silentSetOptions({ fetchPolicy: \"standby\" });\n }\n this.subscribeToQuery();\n if (originalFetchPolicy === \"no-cache\") {\n return;\n }\n observable.resetDiff();\n this.setResult();\n }\n finally {\n observable.silentSetOptions({ fetchPolicy: originalFetchPolicy });\n }\n };\n InternalQueryReference.prototype.retain = function () {\n var _this = this;\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n var disposed = false;\n return function () {\n if (disposed) {\n return;\n }\n disposed = true;\n _this.references--;\n // Wait before fully disposing in case the app is running in strict mode.\n setTimeout(function () {\n if (!_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {\n var _this = this;\n return OBSERVED_CHANGED_OPTIONS.some(function (option) {\n return !equal(_this.watchQueryOptions[option], watchQueryOptions[option]);\n });\n };\n InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {\n var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n }\n else {\n this.observable.silentSetOptions(watchQueryOptions);\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = __assign(__assign({}, this.result), this.observable.getCurrentResult());\n this.promise = createFulfilledPromise(this.result);\n }\n }\n return this.promise;\n };\n InternalQueryReference.prototype.listen = function (listener) {\n var _this = this;\n this.listeners.add(listener);\n return function () {\n _this.listeners.delete(listener);\n };\n };\n InternalQueryReference.prototype.refetch = function (variables) {\n return this.initiateFetch(this.observable.refetch(variables));\n };\n InternalQueryReference.prototype.fetchMore = function (options) {\n return this.initiateFetch(this.observable.fetchMore(options));\n };\n InternalQueryReference.prototype.dispose = function () {\n this.subscription.unsubscribe();\n this.onDispose();\n };\n InternalQueryReference.prototype.onDispose = function () {\n // noop. overridable by options\n };\n InternalQueryReference.prototype.handleNext = function (result) {\n var _a;\n switch (this.promise.status) {\n case \"pending\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);\n break;\n }\n default: {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data &&\n result.networkStatus === this.result.networkStatus) {\n return;\n }\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n };\n InternalQueryReference.prototype.handleError = function (error) {\n var _a;\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError);\n switch (this.promise.status) {\n case \"pending\": {\n (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);\n break;\n }\n default: {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n };\n InternalQueryReference.prototype.deliver = function (promise) {\n this.listeners.forEach(function (listener) { return listener(promise); });\n };\n InternalQueryReference.prototype.initiateFetch = function (returnedPromise) {\n var _this = this;\n this.promise = this.createPendingPromise();\n this.promise.catch(function () { });\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then(function (result) {\n var _a;\n if (_this.promise.status === \"pending\") {\n _this.result = result;\n (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);\n }\n })\n .catch(function () { });\n return returnedPromise;\n };\n InternalQueryReference.prototype.subscribeToQuery = function () {\n var _this = this;\n this.subscription = this.observable\n .filter(function (result) { return !equal(result.data, {}) && !equal(result, _this.result); })\n .subscribe(this.handleNext, this.handleError);\n };\n InternalQueryReference.prototype.setResult = function () {\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n var result = this.observable.getCurrentResult(false);\n if (equal(result, this.result)) {\n return;\n }\n this.result = result;\n this.promise =\n (result.data &&\n (!result.partial || this.watchQueryOptions.returnPartialData)) ?\n createFulfilledPromise(result)\n : this.createPendingPromise();\n };\n InternalQueryReference.prototype.createPendingPromise = function () {\n var _this = this;\n return wrapPromiseWithState(new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n }));\n };\n return InternalQueryReference;\n}());\nexport { InternalQueryReference };\n//# sourceMappingURL=QueryReference.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap } from \"../../../utilities/index.js\";\nimport { InternalQueryReference } from \"./QueryReference.js\";\nvar SuspenseCache = /** @class */ (function () {\n function SuspenseCache(options) {\n if (options === void 0) { options = Object.create(null); }\n this.queryRefs = new Trie(canUseWeakMap);\n this.options = options;\n }\n SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n if (!ref.current) {\n ref.current = new InternalQueryReference(createObservable(), {\n autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,\n onDispose: function () {\n delete ref.current;\n },\n });\n }\n return ref.current;\n };\n return SuspenseCache;\n}());\nexport { SuspenseCache };\n//# sourceMappingURL=SuspenseCache.js.map","import { SuspenseCache } from \"./SuspenseCache.js\";\nvar suspenseCacheSymbol = Symbol.for(\"apollo.suspenseCache\");\nexport function getSuspenseCache(client) {\n var _a;\n if (!client[suspenseCacheSymbol]) {\n client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);\n }\n return client[suspenseCacheSymbol];\n}\n//# sourceMappingURL=getSuspenseCache.js.map"],"names":["equal","__assign","createFulfilledPromise","createRejectedPromise","wrapPromiseWithState","Trie","canUseWeakMap"],"mappings":";;;;;;;;;AAIA,IAAI,sBAAsB,GAAG,MAAM,EAAE,CAAC;AACtC,IAAI,cAAc,GAAG,MAAM,EAAE,CAAC;AACvB,SAAS,YAAY,CAAC,gBAAgB,EAAE;AAC/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G,OAAO,CAAC;AAC/B,KAAK;AACL,IAAI,aAAa,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,QAAQ,EAAE,gBAAgB,EAAE;AAChF,QAAQ,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACvD,QAAQ,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;AAC1B,YAAY,GAAG,CAAC,OAAO,GAAG,IAAI,sBAAsB,CAAC,gBAAgB,EAAE,EAAE;AACzE,gBAAgB,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB;AACvE,gBAAgB,SAAS,EAAE,YAAY;AACvC,oBAAoB,OAAO,GAAG,CAAC,OAAO,CAAC;AACvC,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS;AACT,QAAQ,OAAO,GAAG,CAAC,OAAO,CAAC;AAC3B,KAAK,CAAC;AACN,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,EAAE,CAAC;;ACrBJ,IAAI,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACtD,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE;AACtC,QAAQ,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI,aAAa,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC7I,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvC;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.native.js new file mode 100644 index 0000000..4b2d91a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/internal.cjs.native.js @@ -0,0 +1,284 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var trie = require('@wry/trie'); +var utilities = require('../../utilities'); +var tslib = require('tslib'); +var equality = require('@wry/equality'); + +var QUERY_REFERENCE_SYMBOL = Symbol(); +var PROMISE_SYMBOL = Symbol(); +function wrapQueryRef(internalQueryRef) { + var _a; + var ref = (_a = { + toPromise: function () { + return getWrappedPromise(ref).then(function () { return ref; }); + } + }, + _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef, + _a[PROMISE_SYMBOL] = internalQueryRef.promise, + _a); + return ref; +} +function getWrappedPromise(queryRef) { + var internalQueryRef = unwrapQueryRef(queryRef); + return internalQueryRef.promise.status === "fulfilled" ? + internalQueryRef.promise + : queryRef[PROMISE_SYMBOL]; +} +function unwrapQueryRef(queryRef) { + return queryRef[QUERY_REFERENCE_SYMBOL]; +} +function updateWrappedQueryRef(queryRef, promise) { + queryRef[PROMISE_SYMBOL] = promise; +} +var OBSERVED_CHANGED_OPTIONS = [ + "canonizeResults", + "context", + "errorPolicy", + "fetchPolicy", + "refetchWritePolicy", + "returnPartialData", +]; +var InternalQueryReference = (function () { + function InternalQueryReference(observable, options) { + var _this = this; + this.key = {}; + this.listeners = new Set(); + this.references = 0; + this.handleNext = this.handleNext.bind(this); + this.handleError = this.handleError.bind(this); + this.dispose = this.dispose.bind(this); + this.observable = observable; + if (options.onDispose) { + this.onDispose = options.onDispose; + } + this.setResult(); + this.subscribeToQuery(); + var startDisposeTimer = function () { + var _a; + if (!_this.references) { + _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000); + } + }; + this.promise.then(startDisposeTimer, startDisposeTimer); + } + Object.defineProperty(InternalQueryReference.prototype, "disposed", { + get: function () { + return this.subscription.closed; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", { + get: function () { + return this.observable.options; + }, + enumerable: false, + configurable: true + }); + InternalQueryReference.prototype.reinitialize = function () { + var observable = this.observable; + var originalFetchPolicy = this.watchQueryOptions.fetchPolicy; + try { + if (originalFetchPolicy !== "no-cache") { + observable.resetLastResults(); + observable.silentSetOptions({ fetchPolicy: "cache-first" }); + } + else { + observable.silentSetOptions({ fetchPolicy: "standby" }); + } + this.subscribeToQuery(); + if (originalFetchPolicy === "no-cache") { + return; + } + observable.resetDiff(); + this.setResult(); + } + finally { + observable.silentSetOptions({ fetchPolicy: originalFetchPolicy }); + } + }; + InternalQueryReference.prototype.retain = function () { + var _this = this; + this.references++; + clearTimeout(this.autoDisposeTimeoutId); + var disposed = false; + return function () { + if (disposed) { + return; + } + disposed = true; + _this.references--; + setTimeout(function () { + if (!_this.references) { + _this.dispose(); + } + }); + }; + }; + InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) { + var _this = this; + return OBSERVED_CHANGED_OPTIONS.some(function (option) { + return !equality.equal(_this.watchQueryOptions[option], watchQueryOptions[option]); + }); + }; + InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) { + var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults; + if (currentFetchPolicy === "standby" && + currentFetchPolicy !== watchQueryOptions.fetchPolicy) { + this.initiateFetch(this.observable.reobserve(watchQueryOptions)); + } + else { + this.observable.silentSetOptions(watchQueryOptions); + if (currentCanonizeResults !== watchQueryOptions.canonizeResults) { + this.result = tslib.__assign(tslib.__assign({}, this.result), this.observable.getCurrentResult()); + this.promise = utilities.createFulfilledPromise(this.result); + } + } + return this.promise; + }; + InternalQueryReference.prototype.listen = function (listener) { + var _this = this; + this.listeners.add(listener); + return function () { + _this.listeners.delete(listener); + }; + }; + InternalQueryReference.prototype.refetch = function (variables) { + return this.initiateFetch(this.observable.refetch(variables)); + }; + InternalQueryReference.prototype.fetchMore = function (options) { + return this.initiateFetch(this.observable.fetchMore(options)); + }; + InternalQueryReference.prototype.dispose = function () { + this.subscription.unsubscribe(); + this.onDispose(); + }; + InternalQueryReference.prototype.onDispose = function () { + }; + InternalQueryReference.prototype.handleNext = function (result) { + var _a; + switch (this.promise.status) { + case "pending": { + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result); + break; + } + default: { + if (result.data === this.result.data && + result.networkStatus === this.result.networkStatus) { + return; + } + if (result.data === void 0) { + result.data = this.result.data; + } + this.result = result; + this.promise = utilities.createFulfilledPromise(result); + this.deliver(this.promise); + break; + } + } + }; + InternalQueryReference.prototype.handleError = function (error) { + var _a; + this.subscription.unsubscribe(); + this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError); + switch (this.promise.status) { + case "pending": { + (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error); + break; + } + default: { + this.promise = utilities.createRejectedPromise(error); + this.deliver(this.promise); + } + } + }; + InternalQueryReference.prototype.deliver = function (promise) { + this.listeners.forEach(function (listener) { return listener(promise); }); + }; + InternalQueryReference.prototype.initiateFetch = function (returnedPromise) { + var _this = this; + this.promise = this.createPendingPromise(); + this.promise.catch(function () { }); + returnedPromise + .then(function (result) { + var _a; + if (_this.promise.status === "pending") { + _this.result = result; + (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result); + } + }) + .catch(function () { }); + return returnedPromise; + }; + InternalQueryReference.prototype.subscribeToQuery = function () { + var _this = this; + this.subscription = this.observable + .filter(function (result) { return !equality.equal(result.data, {}) && !equality.equal(result, _this.result); }) + .subscribe(this.handleNext, this.handleError); + }; + InternalQueryReference.prototype.setResult = function () { + var result = this.observable.getCurrentResult(false); + if (equality.equal(result, this.result)) { + return; + } + this.result = result; + this.promise = + (result.data && + (!result.partial || this.watchQueryOptions.returnPartialData)) ? + utilities.createFulfilledPromise(result) + : this.createPendingPromise(); + }; + InternalQueryReference.prototype.createPendingPromise = function () { + var _this = this; + return utilities.wrapPromiseWithState(new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + })); + }; + return InternalQueryReference; +}()); + +var SuspenseCache = (function () { + function SuspenseCache(options) { + if (options === void 0) { options = Object.create(null); } + this.queryRefs = new trie.Trie(utilities.canUseWeakMap); + this.options = options; + } + SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) { + var ref = this.queryRefs.lookupArray(cacheKey); + if (!ref.current) { + ref.current = new InternalQueryReference(createObservable(), { + autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs, + onDispose: function () { + delete ref.current; + }, + }); + } + return ref.current; + }; + return SuspenseCache; +}()); + +var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache"); +function getSuspenseCache(client) { + var _a; + if (!client[suspenseCacheSymbol]) { + client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense); + } + return client[suspenseCacheSymbol]; +} + +exports.InternalQueryReference = InternalQueryReference; +exports.getSuspenseCache = getSuspenseCache; +exports.getWrappedPromise = getWrappedPromise; +exports.unwrapQueryRef = unwrapQueryRef; +exports.updateWrappedQueryRef = updateWrappedQueryRef; +exports.wrapQueryRef = wrapQueryRef; +//# sourceMappingURL=internal.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/internal/package.json b/graphql-subscription/node_modules/@apollo/client/react/internal/package.json new file mode 100644 index 0000000..15bb1a0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react/internal", + "type": "module", + "main": "internal.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/package.json b/graphql-subscription/node_modules/@apollo/client/react/package.json new file mode 100644 index 0000000..5a52dcf --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react", + "type": "module", + "main": "react.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/parser/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/parser/index.d.ts new file mode 100644 index 0000000..e357dd2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/parser/index.d.ts @@ -0,0 +1,18 @@ +import type { DocumentNode, VariableDefinitionNode } from "graphql"; +export declare enum DocumentType { + Query = 0, + Mutation = 1, + Subscription = 2 +} +export interface IDocumentDefinition { + type: DocumentType; + name: string; + variables: ReadonlyArray; +} +export declare function operationName(type: DocumentType): string; +export declare function parser(document: DocumentNode): IDocumentDefinition; +export declare namespace parser { + var resetCache: () => void; +} +export declare function verifyDocumentType(document: DocumentNode, type: DocumentType): void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/parser/index.js b/graphql-subscription/node_modules/@apollo/client/react/parser/index.js new file mode 100644 index 0000000..689c64a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/parser/index.js @@ -0,0 +1,109 @@ +import { invariant } from "../../utilities/globals/index.js"; +import { AutoCleanedWeakCache, cacheSizes, } from "../../utilities/index.js"; +import { registerGlobalCache } from "../../utilities/caching/getMemoryInternals.js"; +export var DocumentType; +(function (DocumentType) { + DocumentType[DocumentType["Query"] = 0] = "Query"; + DocumentType[DocumentType["Mutation"] = 1] = "Mutation"; + DocumentType[DocumentType["Subscription"] = 2] = "Subscription"; +})(DocumentType || (DocumentType = {})); +var cache; +export function operationName(type) { + var name; + switch (type) { + case DocumentType.Query: + name = "Query"; + break; + case DocumentType.Mutation: + name = "Mutation"; + break; + case DocumentType.Subscription: + name = "Subscription"; + break; + } + return name; +} +// This parser is mostly used to safety check incoming documents. +export function parser(document) { + if (!cache) { + cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 /* defaultCacheSizes.parser */); + } + var cached = cache.get(document); + if (cached) + return cached; + var variables, type, name; + invariant(!!document && !!document.kind, 59, document); + var fragments = []; + var queries = []; + var mutations = []; + var subscriptions = []; + for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) { + var x = _a[_i]; + if (x.kind === "FragmentDefinition") { + fragments.push(x); + continue; + } + if (x.kind === "OperationDefinition") { + switch (x.operation) { + case "query": + queries.push(x); + break; + case "mutation": + mutations.push(x); + break; + case "subscription": + subscriptions.push(x); + break; + } + } + } + invariant(!fragments.length || + queries.length || + mutations.length || + subscriptions.length, 60); + invariant( + queries.length + mutations.length + subscriptions.length <= 1, + 61, + document, + queries.length, + subscriptions.length, + mutations.length + ); + type = queries.length ? DocumentType.Query : DocumentType.Mutation; + if (!queries.length && !mutations.length) + type = DocumentType.Subscription; + var definitions = queries.length ? queries + : mutations.length ? mutations + : subscriptions; + invariant(definitions.length === 1, 62, document, definitions.length); + var definition = definitions[0]; + variables = definition.variableDefinitions || []; + if (definition.name && definition.name.kind === "Name") { + name = definition.name.value; + } + else { + name = "data"; // fallback to using data if no name + } + var payload = { name: name, type: type, variables: variables }; + cache.set(document, payload); + return payload; +} +parser.resetCache = function () { + cache = undefined; +}; +if (globalThis.__DEV__ !== false) { + registerGlobalCache("parser", function () { return (cache ? cache.size : 0); }); +} +export function verifyDocumentType(document, type) { + var operation = parser(document); + var requiredOperationName = operationName(type); + var usedOperationName = operationName(operation.type); + invariant( + operation.type === type, + 63, + requiredOperationName, + requiredOperationName, + usedOperationName + ); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/parser/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/parser/index.js.map new file mode 100644 index 0000000..26e55eb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/parser/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAQ7D,OAAO,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AAC;IACnC,IAAM,qBAAqB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAClD,IAAM,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxD,SAAS,CACP,SAAS,CAAC,IAAI,KAAK,IAAI,EACvB,kCAAkC,GAAG,gCAAgC,EACrE,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,CAClB,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\n\nimport type {\n DocumentNode,\n DefinitionNode,\n VariableDefinitionNode,\n OperationDefinitionNode,\n} from \"graphql\";\nimport {\n AutoCleanedWeakCache,\n cacheSizes,\n defaultCacheSizes,\n} from \"../../utilities/index.js\";\nimport { registerGlobalCache } from \"../../utilities/caching/getMemoryInternals.js\";\n\nexport enum DocumentType {\n Query,\n Mutation,\n Subscription,\n}\n\nexport interface IDocumentDefinition {\n type: DocumentType;\n name: string;\n variables: ReadonlyArray;\n}\n\nlet cache:\n | undefined\n | AutoCleanedWeakCache<\n DocumentNode,\n {\n name: string;\n type: DocumentType;\n variables: readonly VariableDefinitionNode[];\n }\n >;\n\nexport function operationName(type: DocumentType) {\n let name;\n switch (type) {\n case DocumentType.Query:\n name = \"Query\";\n break;\n case DocumentType.Mutation:\n name = \"Mutation\";\n break;\n case DocumentType.Subscription:\n name = \"Subscription\";\n break;\n }\n return name;\n}\n\n// This parser is mostly used to safety check incoming documents.\nexport function parser(document: DocumentNode): IDocumentDefinition {\n if (!cache) {\n cache = new AutoCleanedWeakCache(\n cacheSizes.parser || defaultCacheSizes.parser\n );\n }\n const cached = cache.get(document);\n if (cached) return cached;\n\n let variables, type, name;\n\n invariant(\n !!document && !!document.kind,\n `Argument of %s passed to parser was not a valid GraphQL ` +\n `DocumentNode. You may need to use 'graphql-tag' or another method ` +\n `to convert your operation into a document`,\n document\n );\n\n const fragments: DefinitionNode[] = [];\n const queries: DefinitionNode[] = [];\n const mutations: DefinitionNode[] = [];\n const subscriptions: DefinitionNode[] = [];\n\n for (const x of document.definitions) {\n if (x.kind === \"FragmentDefinition\") {\n fragments.push(x);\n continue;\n }\n\n if (x.kind === \"OperationDefinition\") {\n switch (x.operation) {\n case \"query\":\n queries.push(x);\n break;\n case \"mutation\":\n mutations.push(x);\n break;\n case \"subscription\":\n subscriptions.push(x);\n break;\n }\n }\n }\n\n invariant(\n !fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length,\n `Passing only a fragment to 'graphql' is not yet supported. ` +\n `You must include a query, subscription or mutation as well`\n );\n\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n `react-apollo only supports a query, subscription, or a mutation per HOC. ` +\n `%s had %s queries, %s ` +\n `subscriptions and %s mutations. ` +\n `You can use 'compose' to join multiple operation types to a component`,\n document,\n queries.length,\n subscriptions.length,\n mutations.length\n );\n\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length) type = DocumentType.Subscription;\n\n const definitions =\n queries.length ? queries\n : mutations.length ? mutations\n : subscriptions;\n\n invariant(\n definitions.length === 1,\n `react-apollo only supports one definition per HOC. %s had ` +\n `%s definitions. ` +\n `You can use 'compose' to join multiple operation types to a component`,\n document,\n definitions.length\n );\n\n const definition = definitions[0] as OperationDefinitionNode;\n variables = definition.variableDefinitions || [];\n\n if (definition.name && definition.name.kind === \"Name\") {\n name = definition.name.value;\n } else {\n name = \"data\"; // fallback to using data if no name\n }\n\n const payload = { name, type, variables };\n cache.set(document, payload);\n return payload;\n}\n\nparser.resetCache = () => {\n cache = undefined;\n};\n\nif (__DEV__) {\n registerGlobalCache(\"parser\", () => (cache ? cache.size : 0));\n}\n\nexport function verifyDocumentType(document: DocumentNode, type: DocumentType) {\n const operation = parser(document);\n const requiredOperationName = operationName(type);\n const usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n `Running a %s requires a graphql ` + `%s, but a %s was used instead.`,\n requiredOperationName,\n requiredOperationName,\n usedOperationName\n );\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/parser/package.json b/graphql-subscription/node_modules/@apollo/client/react/parser/package.json new file mode 100644 index 0000000..72bf0c2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/parser/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react/parser", + "type": "module", + "main": "parser.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs b/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs new file mode 100644 index 0000000..ad63e81 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs @@ -0,0 +1,122 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +require('tslib'); + +var globalCaches = {}; +function registerGlobalCache(name, getSize) { + globalCaches[name] = getSize; +} + +exports.DocumentType = void 0; +(function (DocumentType) { + DocumentType[DocumentType["Query"] = 0] = "Query"; + DocumentType[DocumentType["Mutation"] = 1] = "Mutation"; + DocumentType[DocumentType["Subscription"] = 2] = "Subscription"; +})(exports.DocumentType || (exports.DocumentType = {})); +var cache; +function operationName(type) { + var name; + switch (type) { + case exports.DocumentType.Query: + name = "Query"; + break; + case exports.DocumentType.Mutation: + name = "Mutation"; + break; + case exports.DocumentType.Subscription: + name = "Subscription"; + break; + } + return name; +} +function parser(document) { + if (!cache) { + cache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes.parser || 1000 ); + } + var cached = cache.get(document); + if (cached) + return cached; + var variables, type, name; + globals.invariant(!!document && !!document.kind, 59, document); + var fragments = []; + var queries = []; + var mutations = []; + var subscriptions = []; + for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) { + var x = _a[_i]; + if (x.kind === "FragmentDefinition") { + fragments.push(x); + continue; + } + if (x.kind === "OperationDefinition") { + switch (x.operation) { + case "query": + queries.push(x); + break; + case "mutation": + mutations.push(x); + break; + case "subscription": + subscriptions.push(x); + break; + } + } + } + globals.invariant(!fragments.length || + queries.length || + mutations.length || + subscriptions.length, 60); + globals.invariant( + queries.length + mutations.length + subscriptions.length <= 1, + 61, + document, + queries.length, + subscriptions.length, + mutations.length + ); + type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation; + if (!queries.length && !mutations.length) + type = exports.DocumentType.Subscription; + var definitions = queries.length ? queries + : mutations.length ? mutations + : subscriptions; + globals.invariant(definitions.length === 1, 62, document, definitions.length); + var definition = definitions[0]; + variables = definition.variableDefinitions || []; + if (definition.name && definition.name.kind === "Name") { + name = definition.name.value; + } + else { + name = "data"; + } + var payload = { name: name, type: type, variables: variables }; + cache.set(document, payload); + return payload; +} +parser.resetCache = function () { + cache = undefined; +}; +if (globalThis.__DEV__ !== false) { + registerGlobalCache("parser", function () { return (cache ? cache.size : 0); }); +} +function verifyDocumentType(document, type) { + var operation = parser(document); + var requiredOperationName = operationName(type); + var usedOperationName = operationName(operation.type); + globals.invariant( + operation.type === type, + 63, + requiredOperationName, + requiredOperationName, + usedOperationName + ); +} + +exports.operationName = operationName; +exports.parser = parser; +exports.verifyDocumentType = verifyDocumentType; +//# sourceMappingURL=parser.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.map new file mode 100644 index 0000000..ca546ef --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"parser.cjs","sources":["../../utilities/caching/getMemoryInternals.js","index.js"],"sourcesContent":["import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { AutoCleanedWeakCache, cacheSizes, } from \"../../utilities/index.js\";\nimport { registerGlobalCache } from \"../../utilities/caching/getMemoryInternals.js\";\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache;\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = \"Query\";\n break;\n case DocumentType.Mutation:\n name = \"Mutation\";\n break;\n case DocumentType.Subscription:\n name = \"Subscription\";\n break;\n }\n return name;\n}\n// This parser is mostly used to safety check incoming documents.\nexport function parser(document) {\n if (!cache) {\n cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 /* defaultCacheSizes.parser */);\n }\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n invariant(!!document && !!document.kind, 59, document);\n var fragments = [];\n var queries = [];\n var mutations = [];\n var subscriptions = [];\n for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {\n var x = _a[_i];\n if (x.kind === \"FragmentDefinition\") {\n fragments.push(x);\n continue;\n }\n if (x.kind === \"OperationDefinition\") {\n switch (x.operation) {\n case \"query\":\n queries.push(x);\n break;\n case \"mutation\":\n mutations.push(x);\n break;\n case \"subscription\":\n subscriptions.push(x);\n break;\n }\n }\n }\n invariant(!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length, 60);\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n 61,\n document,\n queries.length,\n subscriptions.length,\n mutations.length\n );\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length ? queries\n : mutations.length ? mutations\n : subscriptions;\n invariant(definitions.length === 1, 62, document, definitions.length);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === \"Name\") {\n name = definition.name.value;\n }\n else {\n name = \"data\"; // fallback to using data if no name\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\nparser.resetCache = function () {\n cache = undefined;\n};\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"parser\", function () { return (cache ? cache.size : 0); });\n}\nexport function verifyDocumentType(document, type) {\n var operation = parser(document);\n var requiredOperationName = operationName(type);\n var usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n 63,\n requiredOperationName,\n requiredOperationName,\n usedOperationName\n );\n}\n//# sourceMappingURL=index.js.map"],"names":["DocumentType","AutoCleanedWeakCache","cacheSizes","invariant"],"mappings":";;;;;;;;AAEA,IAAI,YAAY,GAAG,EAAE,CAAC;AACf,SAAS,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE;AACnD,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AACj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AC;AACjC,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AACD,MAAM,CAAC,UAAU,GAAG,YAAY;AAChC,IAAI,KAAK,GAAG,SAAS,CAAC;AACtB,CAAC,CAAC;AACF,IAAI,UAAU,CAAC,OAAO,KAAK,KAAK,EAAE;AAClC,IAAI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,KAAK,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACpF,CAAC;AACM,SAAS,kBAAkB,CAAC,QAAQ,EAAE,IAAI,EAAE;AACnD,IAAI,IAAI,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AACrC,IAAI,IAAI,qBAAqB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AACpD,IAAI,IAAI,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC1D,IAAIA,iBAAS;AACb,QAAQ,SAAS,CAAC,IAAI,KAAK,IAAI;AAC/B,QAAQ,EAAE;AACV,QAAQ,qBAAqB;AAC7B,QAAQ,qBAAqB;AAC7B,QAAQ,iBAAiB;AACzB,KAAK,CAAC;AACN;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.native.js new file mode 100644 index 0000000..ad63e81 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/parser/parser.cjs.native.js @@ -0,0 +1,122 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('../../utilities/globals'); +var utilities = require('../../utilities'); +require('tslib'); + +var globalCaches = {}; +function registerGlobalCache(name, getSize) { + globalCaches[name] = getSize; +} + +exports.DocumentType = void 0; +(function (DocumentType) { + DocumentType[DocumentType["Query"] = 0] = "Query"; + DocumentType[DocumentType["Mutation"] = 1] = "Mutation"; + DocumentType[DocumentType["Subscription"] = 2] = "Subscription"; +})(exports.DocumentType || (exports.DocumentType = {})); +var cache; +function operationName(type) { + var name; + switch (type) { + case exports.DocumentType.Query: + name = "Query"; + break; + case exports.DocumentType.Mutation: + name = "Mutation"; + break; + case exports.DocumentType.Subscription: + name = "Subscription"; + break; + } + return name; +} +function parser(document) { + if (!cache) { + cache = new utilities.AutoCleanedWeakCache(utilities.cacheSizes.parser || 1000 ); + } + var cached = cache.get(document); + if (cached) + return cached; + var variables, type, name; + globals.invariant(!!document && !!document.kind, 59, document); + var fragments = []; + var queries = []; + var mutations = []; + var subscriptions = []; + for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) { + var x = _a[_i]; + if (x.kind === "FragmentDefinition") { + fragments.push(x); + continue; + } + if (x.kind === "OperationDefinition") { + switch (x.operation) { + case "query": + queries.push(x); + break; + case "mutation": + mutations.push(x); + break; + case "subscription": + subscriptions.push(x); + break; + } + } + } + globals.invariant(!fragments.length || + queries.length || + mutations.length || + subscriptions.length, 60); + globals.invariant( + queries.length + mutations.length + subscriptions.length <= 1, + 61, + document, + queries.length, + subscriptions.length, + mutations.length + ); + type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation; + if (!queries.length && !mutations.length) + type = exports.DocumentType.Subscription; + var definitions = queries.length ? queries + : mutations.length ? mutations + : subscriptions; + globals.invariant(definitions.length === 1, 62, document, definitions.length); + var definition = definitions[0]; + variables = definition.variableDefinitions || []; + if (definition.name && definition.name.kind === "Name") { + name = definition.name.value; + } + else { + name = "data"; + } + var payload = { name: name, type: type, variables: variables }; + cache.set(document, payload); + return payload; +} +parser.resetCache = function () { + cache = undefined; +}; +if (globalThis.__DEV__ !== false) { + registerGlobalCache("parser", function () { return (cache ? cache.size : 0); }); +} +function verifyDocumentType(document, type) { + var operation = parser(document); + var requiredOperationName = operationName(type); + var usedOperationName = operationName(operation.type); + globals.invariant( + operation.type === type, + 63, + requiredOperationName, + requiredOperationName, + usedOperationName + ); +} + +exports.operationName = operationName; +exports.parser = parser; +exports.verifyDocumentType = verifyDocumentType; +//# sourceMappingURL=parser.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.d.ts b/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.d.ts new file mode 100644 index 0000000..9532a52 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.d.ts @@ -0,0 +1,285 @@ +import type { ApolloClient, DefaultContext, DocumentNode, ErrorPolicy, OperationVariables, RefetchWritePolicy, TypedDocumentNode, WatchQueryFetchPolicy } from "../../core/index.js"; +import type { DeepPartial, OnlyRequiredProperties } from "../../utilities/index.js"; +import type { QueryReference } from "../internal/index.js"; +import type { NoInfer } from "../index.js"; +type VariablesOption = [ + TVariables +] extends [never] ? { + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: Record; +} : {} extends OnlyRequiredProperties ? { + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: TVariables; +} : { + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables: TVariables; +}; +export type PreloadQueryFetchPolicy = Extract; +export type PreloadQueryOptions = { + /** + * Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false. + * + * @deprecated + * + * Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + */ + canonizeResults?: boolean; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: DefaultContext; + /** + * Specifies how the query handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the query result includes error details but not partial results. + * + * @docGroup + * + * 1. Operation options + */ + errorPolicy?: ErrorPolicy; + /** + * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server). + * + * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + * + * The default value is `cache-first`. + * + * @docGroup + * + * 3. Caching options + */ + fetchPolicy?: PreloadQueryFetchPolicy; + /** + * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields. + * + * The default value is `false`. + * + * @docGroup + * + * 3. Caching options + */ + returnPartialData?: boolean; + /** + * Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x. + * + * @docGroup + * + * 3. Caching options + */ + refetchWritePolicy?: RefetchWritePolicy; +} & VariablesOption; +type PreloadQueryOptionsArg = [TVariables] extends [never] ? [ + options?: PreloadQueryOptions & TOptions +] : {} extends OnlyRequiredProperties ? [ + options?: PreloadQueryOptions> & Omit +] : [ + options: PreloadQueryOptions> & Omit +]; +/** + * A function that will begin loading a query when called. It's result can be + * read by {@link useReadQuery} which will suspend until the query is loaded. + * This is useful when you want to start loading a query as early as possible + * outside of a React component. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * const queryRef = preloadQuery(query, { variables, ...otherOptions }); + * + * function App() { + * return ( + * Loading}> + * + * + * ); + * } + * + * function MyQuery() { + * const { data } = useReadQuery(queryRef); + * + * // do something with `data` + * } + * ``` + */ +export interface PreloadQueryFunction { + /** + * A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * const queryRef = preloadQuery(query, { variables, ...otherOptions }); + * + * function App() { + * return ( + * Loading}> + * + * + * ); + * } + * + * function MyQuery() { + * const { data } = useReadQuery(queryRef); + * + * // do something with `data` + * } + * ``` + */ + >(query: DocumentNode | TypedDocumentNode, ...[options]: PreloadQueryOptionsArg, TOptions>): QueryReference | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial : TData, TVariables>; + /** + * A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * const queryRef = preloadQuery(query, { variables, ...otherOptions }); + * + * function App() { + * return ( + * Loading}> + * + * + * ); + * } + * + * function MyQuery() { + * const { data } = useReadQuery(queryRef); + * + * // do something with `data` + * } + * ``` + */ + (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { + returnPartialData: true; + errorPolicy: "ignore" | "all"; + }): QueryReference | undefined, TVariables>; + /** + * A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * const queryRef = preloadQuery(query, { variables, ...otherOptions }); + * + * function App() { + * return ( + * Loading}> + * + * + * ); + * } + * + * function MyQuery() { + * const { data } = useReadQuery(queryRef); + * + * // do something with `data` + * } + * ``` + */ + (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { + errorPolicy: "ignore" | "all"; + }): QueryReference; + /** + * A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * const queryRef = preloadQuery(query, { variables, ...otherOptions }); + * + * function App() { + * return ( + * Loading}> + * + * + * ); + * } + * + * function MyQuery() { + * const { data } = useReadQuery(queryRef); + * + * // do something with `data` + * } + * ``` + */ + (query: DocumentNode | TypedDocumentNode, options: PreloadQueryOptions> & { + returnPartialData: true; + }): QueryReference, TVariables>; + /** + * A function that will begin loading a query when called. It's result can be read by {@link useReadQuery} which will suspend until the query is loaded. This is useful when you want to start loading a query as early as possible outside of a React component. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * const queryRef = preloadQuery(query, { variables, ...otherOptions }); + * + * function App() { + * return ( + * Loading}> + * + * + * ); + * } + * + * function MyQuery() { + * const { data } = useReadQuery(queryRef); + * + * // do something with `data` + * } + * ``` + */ + (query: DocumentNode | TypedDocumentNode, ...[options]: PreloadQueryOptionsArg>): QueryReference; +} +/** + * A higher order function that returns a `preloadQuery` function which + * can be used to begin loading a query with the given `client`. This is useful + * when you want to start loading a query as early as possible outside of a + * React component. + * + * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview. + * + * @param client - The `ApolloClient` instance that will be used to load queries + * from the returned `preloadQuery` function. + * @returns The `preloadQuery` function. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * ``` + * @since 3.9.0 + * @alpha + */ +export declare function createQueryPreloader(client: ApolloClient): PreloadQueryFunction; +export {}; +//# sourceMappingURL=createQueryPreloader.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js b/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js new file mode 100644 index 0000000..32e6592 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js @@ -0,0 +1,32 @@ +import { __assign } from "tslib"; +import { InternalQueryReference, wrapQueryRef } from "../internal/index.js"; +/** + * A higher order function that returns a `preloadQuery` function which + * can be used to begin loading a query with the given `client`. This is useful + * when you want to start loading a query as early as possible outside of a + * React component. + * + * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview. + * + * @param client - The `ApolloClient` instance that will be used to load queries + * from the returned `preloadQuery` function. + * @returns The `preloadQuery` function. + * + * @example + * ```js + * const preloadQuery = createQueryPreloader(client); + * ``` + * @since 3.9.0 + * @alpha + */ +export function createQueryPreloader(client) { + return function preloadQuery(query, options) { + var _a, _b; + if (options === void 0) { options = Object.create(null); } + var queryRef = new InternalQueryReference(client.watchQuery(__assign(__assign({}, options), { query: query })), { + autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs, + }); + return wrapQueryRef(queryRef); + }; +} +//# sourceMappingURL=createQueryPreloader.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js.map b/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js.map new file mode 100644 index 0000000..1dc79e9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/query-preloader/createQueryPreloader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createQueryPreloader.js","sourceRoot":"","sources":["../../../src/react/query-preloader/createQueryPreloader.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAsI5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAyB;IAEzB,OAAO,SAAS,YAAY,CAI1B,KAA0D,EAC1D,OACmD;;QADnD,wBAAA,EAAA,UACgC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAEnD,IAAM,QAAQ,GAAG,IAAI,sBAAsB,CACzC,MAAM,CAAC,UAAU,CAAC,sBACb,OAAO,KACV,KAAK,OAAA,GACyB,CAAC,EACjC;YACE,oBAAoB,EAClB,MAAA,MAAA,MAAM,CAAC,cAAc,CAAC,KAAK,0CAAE,QAAQ,0CAAE,oBAAoB;SAC9D,CACF,CAAC;QAEF,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ApolloClient,\n DefaultContext,\n DocumentNode,\n ErrorPolicy,\n OperationVariables,\n RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"../../core/index.js\";\nimport type {\n DeepPartial,\n OnlyRequiredProperties,\n} from \"../../utilities/index.js\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\nimport type { QueryReference } from \"../internal/index.js\";\nimport type { NoInfer } from \"../index.js\";\n\ntype VariablesOption =\n [TVariables] extends [never] ?\n {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: Record;\n }\n : {} extends OnlyRequiredProperties ?\n {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n }\n : {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables: TVariables;\n };\n\nexport type PreloadQueryFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport type PreloadQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n> = {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: PreloadQueryFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n} & VariablesOption;\n\ntype PreloadQueryOptionsArg<\n TVariables extends OperationVariables,\n TOptions = unknown,\n> = [TVariables] extends [never] ?\n [options?: PreloadQueryOptions & TOptions]\n: {} extends OnlyRequiredProperties ?\n [\n options?: PreloadQueryOptions> &\n Omit,\n ]\n: [\n options: PreloadQueryOptions> &\n Omit,\n ];\n\n/**\n * A function that will begin loading a query when called. It's result can be\n * read by {@link useReadQuery} which will suspend until the query is loaded.\n * This is useful when you want to start loading a query as early as possible\n * outside of a React component.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * const queryRef = preloadQuery(query, { variables, ...otherOptions });\n *\n * function App() {\n * return (\n * Loading}>\n * \n * \n * );\n * }\n *\n * function MyQuery() {\n * const { data } = useReadQuery(queryRef);\n *\n * // do something with `data`\n * }\n * ```\n */\nexport interface PreloadQueryFunction {\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n <\n TData,\n TVariables extends OperationVariables,\n TOptions extends Omit,\n >(\n query: DocumentNode | TypedDocumentNode,\n ...[options]: PreloadQueryOptionsArg, TOptions>\n ): QueryReference<\n TOptions[\"errorPolicy\"] extends \"ignore\" | \"all\" ?\n TOptions[\"returnPartialData\"] extends true ?\n DeepPartial | undefined\n : TData | undefined\n : TOptions[\"returnPartialData\"] extends true ? DeepPartial\n : TData,\n TVariables\n >;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n (\n query: DocumentNode | TypedDocumentNode,\n options: PreloadQueryOptions> & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n ): QueryReference | undefined, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n (\n query: DocumentNode | TypedDocumentNode,\n options: PreloadQueryOptions> & {\n errorPolicy: \"ignore\" | \"all\";\n }\n ): QueryReference;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n (\n query: DocumentNode | TypedDocumentNode,\n options: PreloadQueryOptions> & {\n returnPartialData: true;\n }\n ): QueryReference, TVariables>;\n\n /** {@inheritDoc @apollo/client!PreloadQueryFunction:interface} */\n (\n query: DocumentNode | TypedDocumentNode,\n ...[options]: PreloadQueryOptionsArg>\n ): QueryReference;\n}\n\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n * @alpha\n */\nexport function createQueryPreloader(\n client: ApolloClient\n): PreloadQueryFunction {\n return function preloadQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode,\n options: PreloadQueryOptions> &\n VariablesOption = Object.create(null)\n ): QueryReference {\n const queryRef = new InternalQueryReference(\n client.watchQuery({\n ...options,\n query,\n } as WatchQueryOptions),\n {\n autoDisposeTimeoutMs:\n client.defaultOptions.react?.suspense?.autoDisposeTimeoutMs,\n }\n );\n\n return wrapQueryRef(queryRef);\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/react.cjs b/graphql-subscription/node_modules/@apollo/client/react/react.cjs new file mode 100644 index 0000000..de87700 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/react.cjs @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +require('../utilities/globals'); +var context = require('./context'); +var hooks = require('./hooks'); +var parser = require('./parser'); +var tslib = require('tslib'); +var internal = require('./internal'); + +function createQueryPreloader(client) { + return function preloadQuery(query, options) { + var _a, _b; + if (options === void 0) { options = Object.create(null); } + var queryRef = new internal.InternalQueryReference(client.watchQuery(tslib.__assign(tslib.__assign({}, options), { query: query })), { + autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs, + }); + return internal.wrapQueryRef(queryRef); + }; +} + +exports.ApolloConsumer = context.ApolloConsumer; +exports.ApolloProvider = context.ApolloProvider; +exports.getApolloContext = context.getApolloContext; +exports.resetApolloContext = context.resetApolloContext; +exports.DocumentType = parser.DocumentType; +exports.operationName = parser.operationName; +exports.parser = parser.parser; +exports.createQueryPreloader = createQueryPreloader; +for (var k in hooks) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = hooks[k]; +} +//# sourceMappingURL=react.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/react.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/react.cjs.map new file mode 100644 index 0000000..4c1e79e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/react.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"react.cjs","sources":["query-preloader/createQueryPreloader.js"],"sourcesContent":["import { __assign } from \"tslib\";\nimport { InternalQueryReference, wrapQueryRef } from \"../internal/index.js\";\n/**\n * A higher order function that returns a `preloadQuery` function which\n * can be used to begin loading a query with the given `client`. This is useful\n * when you want to start loading a query as early as possible outside of a\n * React component.\n *\n * > Refer to the [Suspense - Initiating queries outside React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react) section for a more in-depth overview.\n *\n * @param client - The `ApolloClient` instance that will be used to load queries\n * from the returned `preloadQuery` function.\n * @returns The `preloadQuery` function.\n *\n * @example\n * ```js\n * const preloadQuery = createQueryPreloader(client);\n * ```\n * @since 3.9.0\n * @alpha\n */\nexport function createQueryPreloader(client) {\n return function preloadQuery(query, options) {\n var _a, _b;\n if (options === void 0) { options = Object.create(null); }\n var queryRef = new InternalQueryReference(client.watchQuery(__assign(__assign({}, options), { query: query })), {\n autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs,\n });\n return wrapQueryRef(queryRef);\n };\n}\n//# sourceMappingURL=createQueryPreloader.js.map"],"names":["InternalQueryReference","__assign","wrapQueryRef"],"mappings":";;;;;;;;;;;AAqBO,SAAS,oBAAoB,CAAC,MAAM,EAAE;AAC7C,IAAI,OAAO,SAAS,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE;AACjD,QAAQ,IAAI,EAAE,EAAE,EAAE,CAAC;AACnB,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;AAClE,QAAQ,IAAI,QAAQ,GAAG,IAAIA,+BAAsB,CAAC,MAAM,CAAC,UAAU,CAACC,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE;AACxH,YAAY,oBAAoB,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,oBAAoB;AACzL,SAAS,CAAC,CAAC;AACX,QAAQ,OAAOC,qBAAY,CAAC,QAAQ,CAAC,CAAC;AACtC,KAAK,CAAC;AACN;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/react.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/react.cjs.native.js new file mode 100644 index 0000000..de87700 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/react.cjs.native.js @@ -0,0 +1,34 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +require('../utilities/globals'); +var context = require('./context'); +var hooks = require('./hooks'); +var parser = require('./parser'); +var tslib = require('tslib'); +var internal = require('./internal'); + +function createQueryPreloader(client) { + return function preloadQuery(query, options) { + var _a, _b; + if (options === void 0) { options = Object.create(null); } + var queryRef = new internal.InternalQueryReference(client.watchQuery(tslib.__assign(tslib.__assign({}, options), { query: query })), { + autoDisposeTimeoutMs: (_b = (_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense) === null || _b === void 0 ? void 0 : _b.autoDisposeTimeoutMs, + }); + return internal.wrapQueryRef(queryRef); + }; +} + +exports.ApolloConsumer = context.ApolloConsumer; +exports.ApolloProvider = context.ApolloProvider; +exports.getApolloContext = context.getApolloContext; +exports.resetApolloContext = context.resetApolloContext; +exports.DocumentType = parser.DocumentType; +exports.operationName = parser.operationName; +exports.parser = parser.parser; +exports.createQueryPreloader = createQueryPreloader; +for (var k in hooks) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = hooks[k]; +} +//# sourceMappingURL=react.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.d.ts b/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.d.ts new file mode 100644 index 0000000..d74d388 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.d.ts @@ -0,0 +1,22 @@ +import type * as ReactTypes from "react"; +import type { ObservableQuery, OperationVariables } from "../../core/index.js"; +import type { QueryDataOptions } from "../types/types.js"; +interface QueryData { + getOptions(): any; + fetchData(): Promise; +} +export declare class RenderPromises { + private queryPromises; + private queryInfoTrie; + private stopped; + stop(): void; + registerSSRObservable(observable: ObservableQuery): void; + getSSRObservable(props: QueryDataOptions): ObservableQuery | null; + addQueryPromise(queryInstance: QueryData, finish?: () => ReactTypes.ReactNode): ReactTypes.ReactNode; + addObservableQueryPromise(obsQuery: ObservableQuery): ReactTypes.ReactNode; + hasPromises(): boolean; + consumeAndAwaitPromises(): Promise; + private lookupQueryInfo; +} +export {}; +//# sourceMappingURL=RenderPromises.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js b/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js new file mode 100644 index 0000000..fd10239 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js @@ -0,0 +1,112 @@ +function makeDefaultQueryInfo() { + return { + seen: false, + observable: null, + }; +} +var RenderPromises = /** @class */ (function () { + function RenderPromises() { + // Map from Query component instances to pending fetchData promises. + this.queryPromises = new Map(); + // Two-layered map from (query document, stringified variables) to QueryInfo + // objects. These QueryInfo objects are intended to survive through the whole + // getMarkupFromTree process, whereas specific Query instances do not survive + // beyond a single call to renderToStaticMarkup. + this.queryInfoTrie = new Map(); + this.stopped = false; + } + RenderPromises.prototype.stop = function () { + if (!this.stopped) { + this.queryPromises.clear(); + this.queryInfoTrie.clear(); + this.stopped = true; + } + }; + // Registers the server side rendered observable. + RenderPromises.prototype.registerSSRObservable = function (observable) { + if (this.stopped) + return; + this.lookupQueryInfo(observable.options).observable = observable; + }; + // Get's the cached observable that matches the SSR Query instances query and variables. + RenderPromises.prototype.getSSRObservable = function (props) { + return this.lookupQueryInfo(props).observable; + }; + RenderPromises.prototype.addQueryPromise = function (queryInstance, finish) { + if (!this.stopped) { + var info = this.lookupQueryInfo(queryInstance.getOptions()); + if (!info.seen) { + this.queryPromises.set(queryInstance.getOptions(), new Promise(function (resolve) { + resolve(queryInstance.fetchData()); + })); + // Render null to abandon this subtree for this rendering, so that we + // can wait for the data to arrive. + return null; + } + } + return finish ? finish() : null; + }; + RenderPromises.prototype.addObservableQueryPromise = function (obsQuery) { + return this.addQueryPromise({ + // The only options which seem to actually be used by the + // RenderPromises class are query and variables. + getOptions: function () { return obsQuery.options; }, + fetchData: function () { + return new Promise(function (resolve) { + var sub = obsQuery.subscribe({ + next: function (result) { + if (!result.loading) { + resolve(); + sub.unsubscribe(); + } + }, + error: function () { + resolve(); + sub.unsubscribe(); + }, + complete: function () { + resolve(); + }, + }); + }); + }, + }); + }; + RenderPromises.prototype.hasPromises = function () { + return this.queryPromises.size > 0; + }; + RenderPromises.prototype.consumeAndAwaitPromises = function () { + var _this = this; + var promises = []; + this.queryPromises.forEach(function (promise, queryInstance) { + // Make sure we never try to call fetchData for this query document and + // these variables again. Since the queryInstance objects change with + // every rendering, deduplicating them by query and variables is the + // best we can do. If a different Query component happens to have the + // same query document and variables, it will be immediately rendered + // by calling finish() in addQueryPromise, which could result in the + // rendering of an unwanted loading state, but that's not nearly as bad + // as getting stuck in an infinite rendering loop because we kept calling + // queryInstance.fetchData for the same Query component indefinitely. + _this.lookupQueryInfo(queryInstance).seen = true; + promises.push(promise); + }); + this.queryPromises.clear(); + return Promise.all(promises); + }; + RenderPromises.prototype.lookupQueryInfo = function (props) { + var queryInfoTrie = this.queryInfoTrie; + var query = props.query, variables = props.variables; + var varMap = queryInfoTrie.get(query) || new Map(); + if (!queryInfoTrie.has(query)) + queryInfoTrie.set(query, varMap); + var variablesString = JSON.stringify(variables); + var info = varMap.get(variablesString) || makeDefaultQueryInfo(); + if (!varMap.has(variablesString)) + varMap.set(variablesString, info); + return info; + }; + return RenderPromises; +}()); +export { RenderPromises }; +//# sourceMappingURL=RenderPromises.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js.map b/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js.map new file mode 100644 index 0000000..a073c78 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/RenderPromises.js.map @@ -0,0 +1 @@ +{"version":3,"file":"RenderPromises.js","sourceRoot":"","sources":["../../../src/react/ssr/RenderPromises.ts"],"names":[],"mappings":"AAkBA,SAAS,oBAAoB;IAC3B,OAAO;QACL,IAAI,EAAE,KAAK;QACX,UAAU,EAAE,IAAI;KACjB,CAAC;AACJ,CAAC;AAED;IAAA;QACE,oEAAoE;QAC5D,kBAAa,GAAG,IAAI,GAAG,EAA4C,CAAC;QAE5E,4EAA4E;QAC5E,6EAA6E;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B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAEO,wCAAe,GAAvB,UACE,KAA0C;QAElC,IAAA,aAAa,GAAK,IAAI,cAAT,CAAU;QACvB,IAAA,KAAK,GAAgB,KAAK,MAArB,EAAE,SAAS,GAAK,KAAK,UAAV,CAAW;QACnC,IAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,EAAqB,CAAC;QACxE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAChE,IAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAClD,IAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,oBAAoB,EAAE,CAAC;QACnE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IACH,qBAAC;AAAD,CAAC,AAvHD,IAuHC","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type * as ReactTypes from \"react\";\n\nimport type { ObservableQuery, OperationVariables } from \"../../core/index.js\";\nimport type { QueryDataOptions } from \"../types/types.js\";\n\n// TODO: A vestigial interface from when hooks were implemented with utility\n// classes, which should be deleted in the future.\ninterface QueryData {\n getOptions(): any;\n fetchData(): Promise;\n}\n\ntype QueryInfo = {\n seen: boolean;\n observable: ObservableQuery | null;\n};\n\nfunction makeDefaultQueryInfo(): QueryInfo {\n return {\n seen: false,\n observable: null,\n };\n}\n\nexport class RenderPromises {\n // Map from Query component instances to pending fetchData promises.\n private queryPromises = new Map, Promise>();\n\n // Two-layered map from (query document, stringified variables) to QueryInfo\n // objects. These QueryInfo objects are intended to survive through the whole\n // getMarkupFromTree process, whereas specific Query instances do not survive\n // beyond a single call to renderToStaticMarkup.\n private queryInfoTrie = new Map>();\n\n private stopped = false;\n public stop() {\n if (!this.stopped) {\n this.queryPromises.clear();\n this.queryInfoTrie.clear();\n this.stopped = true;\n }\n }\n\n // Registers the server side rendered observable.\n public registerSSRObservable(\n observable: ObservableQuery\n ) {\n if (this.stopped) return;\n this.lookupQueryInfo(observable.options).observable = observable;\n }\n\n // Get's the cached observable that matches the SSR Query instances query and variables.\n public getSSRObservable(\n props: QueryDataOptions\n ): ObservableQuery | null {\n return this.lookupQueryInfo(props).observable;\n }\n\n public addQueryPromise(\n queryInstance: QueryData,\n finish?: () => ReactTypes.ReactNode\n ): ReactTypes.ReactNode {\n if (!this.stopped) {\n const info = this.lookupQueryInfo(queryInstance.getOptions());\n if (!info.seen) {\n this.queryPromises.set(\n queryInstance.getOptions(),\n new Promise((resolve) => {\n resolve(queryInstance.fetchData());\n })\n );\n // Render null to abandon this subtree for this rendering, so that we\n // can wait for the data to arrive.\n return null;\n }\n }\n return finish ? finish() : null;\n }\n\n public addObservableQueryPromise<\n TData,\n TVariables extends OperationVariables,\n >(obsQuery: ObservableQuery) {\n return this.addQueryPromise({\n // The only options which seem to actually be used by the\n // RenderPromises class are query and variables.\n getOptions: () => obsQuery.options,\n fetchData: () =>\n new Promise((resolve) => {\n const sub = obsQuery.subscribe({\n next(result) {\n if (!result.loading) {\n resolve();\n sub.unsubscribe();\n }\n },\n error() {\n resolve();\n sub.unsubscribe();\n },\n complete() {\n resolve();\n },\n });\n }),\n });\n }\n\n public hasPromises() {\n return this.queryPromises.size > 0;\n }\n\n public consumeAndAwaitPromises() {\n const promises: Promise[] = [];\n this.queryPromises.forEach((promise, queryInstance) => {\n // Make sure we never try to call fetchData for this query document and\n // these variables again. Since the queryInstance objects change with\n // every rendering, deduplicating them by query and variables is the\n // best we can do. If a different Query component happens to have the\n // same query document and variables, it will be immediately rendered\n // by calling finish() in addQueryPromise, which could result in the\n // rendering of an unwanted loading state, but that's not nearly as bad\n // as getting stuck in an infinite rendering loop because we kept calling\n // queryInstance.fetchData for the same Query component indefinitely.\n this.lookupQueryInfo(queryInstance).seen = true;\n promises.push(promise);\n });\n this.queryPromises.clear();\n return Promise.all(promises);\n }\n\n private lookupQueryInfo(\n props: QueryDataOptions\n ): QueryInfo {\n const { queryInfoTrie } = this;\n const { query, variables } = props;\n const varMap = queryInfoTrie.get(query) || new Map();\n if (!queryInfoTrie.has(query)) queryInfoTrie.set(query, varMap);\n const variablesString = JSON.stringify(variables);\n const info = varMap.get(variablesString) || makeDefaultQueryInfo();\n if (!varMap.has(variablesString)) varMap.set(variablesString, info);\n return info;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.d.ts b/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.d.ts new file mode 100644 index 0000000..4183ffc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.d.ts @@ -0,0 +1,13 @@ +import type * as ReactTypes from "react"; +export declare function getDataFromTree(tree: ReactTypes.ReactNode, context?: { + [key: string]: any; +}): Promise; +export type GetMarkupFromTreeOptions = { + tree: ReactTypes.ReactNode; + context?: { + [key: string]: any; + }; + renderFunction?: (tree: ReactTypes.ReactElement) => string | PromiseLike; +}; +export declare function getMarkupFromTree({ tree, context, renderFunction, }: GetMarkupFromTreeOptions): Promise; +//# sourceMappingURL=getDataFromTree.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js b/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js new file mode 100644 index 0000000..e1ffe6d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js @@ -0,0 +1,49 @@ +import { __assign } from "tslib"; +import * as React from "rehackt"; +import { getApolloContext } from "../context/index.js"; +import { RenderPromises } from "./RenderPromises.js"; +import { renderToStaticMarkup } from "react-dom/server"; +export function getDataFromTree(tree, context) { + if (context === void 0) { context = {}; } + return getMarkupFromTree({ + tree: tree, + context: context, + // If you need to configure this renderFunction, call getMarkupFromTree + // directly instead of getDataFromTree. + renderFunction: renderToStaticMarkup, + }); +} +export function getMarkupFromTree(_a) { + var tree = _a.tree, _b = _a.context, context = _b === void 0 ? {} : _b, + // The rendering function is configurable! We use renderToStaticMarkup as + // the default, because it's a little less expensive than renderToString, + // and legacy usage of getDataFromTree ignores the return value anyway. + _c = _a.renderFunction, + // The rendering function is configurable! We use renderToStaticMarkup as + // the default, because it's a little less expensive than renderToString, + // and legacy usage of getDataFromTree ignores the return value anyway. + renderFunction = _c === void 0 ? renderToStaticMarkup : _c; + var renderPromises = new RenderPromises(); + function process() { + // Always re-render from the rootElement, even though it might seem + // better to render the children of the component responsible for the + // promise, because it is not possible to reconstruct the full context + // of the original rendering (including all unknown context provider + // elements) for a subtree of the original component tree. + var ApolloContext = getApolloContext(); + return new Promise(function (resolve) { + var element = React.createElement(ApolloContext.Provider, { value: __assign(__assign({}, context), { renderPromises: renderPromises }) }, tree); + resolve(renderFunction(element)); + }) + .then(function (html) { + return renderPromises.hasPromises() ? + renderPromises.consumeAndAwaitPromises().then(process) + : html; + }) + .finally(function () { + renderPromises.stop(); + }); + } + return Promise.resolve().then(process); +} +//# sourceMappingURL=getDataFromTree.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js.map b/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js.map new file mode 100644 index 0000000..fbfbf74 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/getDataFromTree.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getDataFromTree.js","sourceRoot":"","sources":["../../../src/react/ssr/getDataFromTree.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAA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AI,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type * as ReactTypes from \"react\";\nimport { getApolloContext } from \"../context/index.js\";\nimport { RenderPromises } from \"./RenderPromises.js\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\n\nexport function getDataFromTree(\n tree: ReactTypes.ReactNode,\n context: { [key: string]: any } = {}\n) {\n return getMarkupFromTree({\n tree,\n context,\n // If you need to configure this renderFunction, call getMarkupFromTree\n // directly instead of getDataFromTree.\n renderFunction: renderToStaticMarkup,\n });\n}\n\nexport type GetMarkupFromTreeOptions = {\n tree: ReactTypes.ReactNode;\n context?: { [key: string]: any };\n renderFunction?: (\n tree: ReactTypes.ReactElement\n ) => string | PromiseLike;\n};\n\nexport function getMarkupFromTree({\n tree,\n context = {},\n // The rendering function is configurable! We use renderToStaticMarkup as\n // the default, because it's a little less expensive than renderToString,\n // and legacy usage of getDataFromTree ignores the return value anyway.\n renderFunction = renderToStaticMarkup,\n}: GetMarkupFromTreeOptions): Promise {\n const renderPromises = new RenderPromises();\n\n function process(): Promise {\n // Always re-render from the rootElement, even though it might seem\n // better to render the children of the component responsible for the\n // promise, because it is not possible to reconstruct the full context\n // of the original rendering (including all unknown context provider\n // elements) for a subtree of the original component tree.\n const ApolloContext = getApolloContext();\n\n return new Promise((resolve) => {\n const element = React.createElement(\n ApolloContext.Provider,\n { value: { ...context, renderPromises } },\n tree\n );\n resolve(renderFunction(element));\n })\n .then((html) => {\n return renderPromises.hasPromises() ?\n renderPromises.consumeAndAwaitPromises().then(process)\n : html;\n })\n .finally(() => {\n renderPromises.stop();\n });\n }\n\n return Promise.resolve().then(process);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/index.d.ts b/graphql-subscription/node_modules/@apollo/client/react/ssr/index.d.ts new file mode 100644 index 0000000..e6a85c3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/index.d.ts @@ -0,0 +1,4 @@ +export { getMarkupFromTree, getDataFromTree } from "./getDataFromTree.js"; +export { renderToStringWithData } from "./renderToStringWithData.js"; +export { RenderPromises } from "./RenderPromises.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/index.js b/graphql-subscription/node_modules/@apollo/client/react/ssr/index.js new file mode 100644 index 0000000..b3db69f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/index.js @@ -0,0 +1,4 @@ +export { getMarkupFromTree, getDataFromTree } from "./getDataFromTree.js"; +export { renderToStringWithData } from "./renderToStringWithData.js"; +export { RenderPromises } from "./RenderPromises.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/index.js.map b/graphql-subscription/node_modules/@apollo/client/react/ssr/index.js.map new file mode 100644 index 0000000..faa7f87 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/ssr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { getMarkupFromTree, getDataFromTree } from \"./getDataFromTree.js\";\nexport { renderToStringWithData } from \"./renderToStringWithData.js\";\nexport { RenderPromises } from \"./RenderPromises.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/package.json b/graphql-subscription/node_modules/@apollo/client/react/ssr/package.json new file mode 100644 index 0000000..54bea23 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/react/ssr", + "type": "module", + "main": "ssr.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.d.ts b/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.d.ts new file mode 100644 index 0000000..88eabbb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.d.ts @@ -0,0 +1,3 @@ +import type * as ReactTypes from "react"; +export declare function renderToStringWithData(component: ReactTypes.ReactElement): Promise; +//# sourceMappingURL=renderToStringWithData.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js b/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js new file mode 100644 index 0000000..df8b8cd --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js @@ -0,0 +1,9 @@ +import { getMarkupFromTree } from "./getDataFromTree.js"; +import { renderToString } from "react-dom/server"; +export function renderToStringWithData(component) { + return getMarkupFromTree({ + tree: component, + renderFunction: renderToString, + }); +} +//# sourceMappingURL=renderToStringWithData.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js.map b/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js.map new file mode 100644 index 0000000..4fe925a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/renderToStringWithData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"renderToStringWithData.js","sourceRoot":"","sources":["../../../src/react/ssr/renderToStringWithData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,sBAAsB,CACpC,SAAuC;IAEvC,OAAO,iBAAiB,CAAC;QACvB,IAAI,EAAE,SAAS;QACf,cAAc,EAAE,cAAc;KAC/B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type * as ReactTypes from \"react\";\nimport { getMarkupFromTree } from \"./getDataFromTree.js\";\nimport { renderToString } from \"react-dom/server\";\n\nexport function renderToStringWithData(\n component: ReactTypes.ReactElement\n): Promise {\n return getMarkupFromTree({\n tree: component,\n renderFunction: renderToString,\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs b/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs new file mode 100644 index 0000000..94009f9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs @@ -0,0 +1,157 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var React = require('rehackt'); +var context = require('../context'); +var server = require('react-dom/server'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +function makeDefaultQueryInfo() { + return { + seen: false, + observable: null, + }; +} +var RenderPromises = (function () { + function RenderPromises() { + this.queryPromises = new Map(); + this.queryInfoTrie = new Map(); + this.stopped = false; + } + RenderPromises.prototype.stop = function () { + if (!this.stopped) { + this.queryPromises.clear(); + this.queryInfoTrie.clear(); + this.stopped = true; + } + }; + RenderPromises.prototype.registerSSRObservable = function (observable) { + if (this.stopped) + return; + this.lookupQueryInfo(observable.options).observable = observable; + }; + RenderPromises.prototype.getSSRObservable = function (props) { + return this.lookupQueryInfo(props).observable; + }; + RenderPromises.prototype.addQueryPromise = function (queryInstance, finish) { + if (!this.stopped) { + var info = this.lookupQueryInfo(queryInstance.getOptions()); + if (!info.seen) { + this.queryPromises.set(queryInstance.getOptions(), new Promise(function (resolve) { + resolve(queryInstance.fetchData()); + })); + return null; + } + } + return finish ? finish() : null; + }; + RenderPromises.prototype.addObservableQueryPromise = function (obsQuery) { + return this.addQueryPromise({ + getOptions: function () { return obsQuery.options; }, + fetchData: function () { + return new Promise(function (resolve) { + var sub = obsQuery.subscribe({ + next: function (result) { + if (!result.loading) { + resolve(); + sub.unsubscribe(); + } + }, + error: function () { + resolve(); + sub.unsubscribe(); + }, + complete: function () { + resolve(); + }, + }); + }); + }, + }); + }; + RenderPromises.prototype.hasPromises = function () { + return this.queryPromises.size > 0; + }; + RenderPromises.prototype.consumeAndAwaitPromises = function () { + var _this = this; + var promises = []; + this.queryPromises.forEach(function (promise, queryInstance) { + _this.lookupQueryInfo(queryInstance).seen = true; + promises.push(promise); + }); + this.queryPromises.clear(); + return Promise.all(promises); + }; + RenderPromises.prototype.lookupQueryInfo = function (props) { + var queryInfoTrie = this.queryInfoTrie; + var query = props.query, variables = props.variables; + var varMap = queryInfoTrie.get(query) || new Map(); + if (!queryInfoTrie.has(query)) + queryInfoTrie.set(query, varMap); + var variablesString = JSON.stringify(variables); + var info = varMap.get(variablesString) || makeDefaultQueryInfo(); + if (!varMap.has(variablesString)) + varMap.set(variablesString, info); + return info; + }; + return RenderPromises; +}()); + +function getDataFromTree(tree, context) { + if (context === void 0) { context = {}; } + return getMarkupFromTree({ + tree: tree, + context: context, + renderFunction: server.renderToStaticMarkup, + }); +} +function getMarkupFromTree(_a) { + var tree = _a.tree, _b = _a.context, context$1 = _b === void 0 ? {} : _b, + _c = _a.renderFunction, + renderFunction = _c === void 0 ? server.renderToStaticMarkup : _c; + var renderPromises = new RenderPromises(); + function process() { + var ApolloContext = context.getApolloContext(); + return new Promise(function (resolve) { + var element = React__namespace.createElement(ApolloContext.Provider, { value: tslib.__assign(tslib.__assign({}, context$1), { renderPromises: renderPromises }) }, tree); + resolve(renderFunction(element)); + }) + .then(function (html) { + return renderPromises.hasPromises() ? + renderPromises.consumeAndAwaitPromises().then(process) + : html; + }) + .finally(function () { + renderPromises.stop(); + }); + } + return Promise.resolve().then(process); +} + +function renderToStringWithData(component) { + return getMarkupFromTree({ + tree: component, + renderFunction: server.renderToString, + }); +} + +exports.RenderPromises = RenderPromises; +exports.getDataFromTree = getDataFromTree; +exports.getMarkupFromTree = getMarkupFromTree; +exports.renderToStringWithData = renderToStringWithData; +//# sourceMappingURL=ssr.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.map b/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.map new file mode 100644 index 0000000..afd09b7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"ssr.cjs","sources":["RenderPromises.js","getDataFromTree.js","renderToStringWithData.js"],"sourcesContent":["function makeDefaultQueryInfo() {\n return {\n seen: false,\n observable: null,\n };\n}\nvar RenderPromises = /** @class */ (function () {\n function RenderPromises() {\n // Map from Query component instances to pending fetchData promises.\n this.queryPromises = new Map();\n // Two-layered map from (query document, stringified variables) to QueryInfo\n // objects. These QueryInfo objects are intended to survive through the whole\n // getMarkupFromTree process, whereas specific Query instances do not survive\n // beyond a single call to renderToStaticMarkup.\n this.queryInfoTrie = new Map();\n this.stopped = false;\n }\n RenderPromises.prototype.stop = function () {\n if (!this.stopped) {\n this.queryPromises.clear();\n this.queryInfoTrie.clear();\n this.stopped = true;\n }\n };\n // Registers the server side rendered observable.\n RenderPromises.prototype.registerSSRObservable = function (observable) {\n if (this.stopped)\n return;\n this.lookupQueryInfo(observable.options).observable = observable;\n };\n // Get's the cached observable that matches the SSR Query instances query and variables.\n RenderPromises.prototype.getSSRObservable = function (props) {\n return this.lookupQueryInfo(props).observable;\n };\n RenderPromises.prototype.addQueryPromise = function (queryInstance, finish) {\n if (!this.stopped) {\n var info = this.lookupQueryInfo(queryInstance.getOptions());\n if (!info.seen) {\n this.queryPromises.set(queryInstance.getOptions(), new Promise(function (resolve) {\n resolve(queryInstance.fetchData());\n }));\n // Render null to abandon this subtree for this rendering, so that we\n // can wait for the data to arrive.\n return null;\n }\n }\n return finish ? finish() : null;\n };\n RenderPromises.prototype.addObservableQueryPromise = function (obsQuery) {\n return this.addQueryPromise({\n // The only options which seem to actually be used by the\n // RenderPromises class are query and variables.\n getOptions: function () { return obsQuery.options; },\n fetchData: function () {\n return new Promise(function (resolve) {\n var sub = obsQuery.subscribe({\n next: function (result) {\n if (!result.loading) {\n resolve();\n sub.unsubscribe();\n }\n },\n error: function () {\n resolve();\n sub.unsubscribe();\n },\n complete: function () {\n resolve();\n },\n });\n });\n },\n });\n };\n RenderPromises.prototype.hasPromises = function () {\n return this.queryPromises.size > 0;\n };\n RenderPromises.prototype.consumeAndAwaitPromises = function () {\n var _this = this;\n var promises = [];\n this.queryPromises.forEach(function (promise, queryInstance) {\n // Make sure we never try to call fetchData for this query document and\n // these variables again. Since the queryInstance objects change with\n // every rendering, deduplicating them by query and variables is the\n // best we can do. If a different Query component happens to have the\n // same query document and variables, it will be immediately rendered\n // by calling finish() in addQueryPromise, which could result in the\n // rendering of an unwanted loading state, but that's not nearly as bad\n // as getting stuck in an infinite rendering loop because we kept calling\n // queryInstance.fetchData for the same Query component indefinitely.\n _this.lookupQueryInfo(queryInstance).seen = true;\n promises.push(promise);\n });\n this.queryPromises.clear();\n return Promise.all(promises);\n };\n RenderPromises.prototype.lookupQueryInfo = function (props) {\n var queryInfoTrie = this.queryInfoTrie;\n var query = props.query, variables = props.variables;\n var varMap = queryInfoTrie.get(query) || new Map();\n if (!queryInfoTrie.has(query))\n queryInfoTrie.set(query, varMap);\n var variablesString = JSON.stringify(variables);\n var info = varMap.get(variablesString) || makeDefaultQueryInfo();\n if (!varMap.has(variablesString))\n varMap.set(variablesString, info);\n return info;\n };\n return RenderPromises;\n}());\nexport { RenderPromises };\n//# sourceMappingURL=RenderPromises.js.map","import { __assign } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"../context/index.js\";\nimport { RenderPromises } from \"./RenderPromises.js\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nexport function getDataFromTree(tree, context) {\n if (context === void 0) { context = {}; }\n return getMarkupFromTree({\n tree: tree,\n context: context,\n // If you need to configure this renderFunction, call getMarkupFromTree\n // directly instead of getDataFromTree.\n renderFunction: renderToStaticMarkup,\n });\n}\nexport function getMarkupFromTree(_a) {\n var tree = _a.tree, _b = _a.context, context = _b === void 0 ? {} : _b, \n // The rendering function is configurable! We use renderToStaticMarkup as\n // the default, because it's a little less expensive than renderToString,\n // and legacy usage of getDataFromTree ignores the return value anyway.\n _c = _a.renderFunction, \n // The rendering function is configurable! We use renderToStaticMarkup as\n // the default, because it's a little less expensive than renderToString,\n // and legacy usage of getDataFromTree ignores the return value anyway.\n renderFunction = _c === void 0 ? renderToStaticMarkup : _c;\n var renderPromises = new RenderPromises();\n function process() {\n // Always re-render from the rootElement, even though it might seem\n // better to render the children of the component responsible for the\n // promise, because it is not possible to reconstruct the full context\n // of the original rendering (including all unknown context provider\n // elements) for a subtree of the original component tree.\n var ApolloContext = getApolloContext();\n return new Promise(function (resolve) {\n var element = React.createElement(ApolloContext.Provider, { value: __assign(__assign({}, context), { renderPromises: renderPromises }) }, tree);\n resolve(renderFunction(element));\n })\n .then(function (html) {\n return renderPromises.hasPromises() ?\n renderPromises.consumeAndAwaitPromises().then(process)\n : html;\n })\n .finally(function () {\n renderPromises.stop();\n });\n }\n return Promise.resolve().then(process);\n}\n//# sourceMappingURL=getDataFromTree.js.map","import { getMarkupFromTree } from \"./getDataFromTree.js\";\nimport { renderToString } from \"react-dom/server\";\nexport function renderToStringWithData(component) {\n return getMarkupFromTree({\n tree: component,\n renderFunction: renderToString,\n });\n}\n//# sourceMappingURL=renderToStringWithData.js.map"],"names":["renderToStaticMarkup","context","getApolloContext","React","__assign","renderToString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,oBAAoB,GAAG;AAChC,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,KAAK;AACnB,QAAQ,UAAU,EAAE,IAAI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AC,EAAE,EAAE,IAAI,CAAC,CAAC;AAC5J,YAAY,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7C,SAAS,CAAC;AACV,aAAa,IAAI,CAAC,UAAU,IAAI,EAAE;AAClC,YAAY,OAAO,cAAc,CAAC,WAAW,EAAE;AAC/C,gBAAgB,cAAc,CAAC,uBAAuB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;AACtE,kBAAkB,IAAI,CAAC;AACvB,SAAS,CAAC;AACV,aAAa,OAAO,CAAC,YAAY;AACjC,YAAY,cAAc,CAAC,IAAI,EAAE,CAAC;AAClC,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC3C;;AC7CO,SAAS,sBAAsB,CAAC,SAAS,EAAE;AAClD,IAAI,OAAO,iBAAiB,CAAC;AAC7B,QAAQ,IAAI,EAAE,SAAS;AACvB,QAAQ,cAAc,EAAEI,qBAAc;AACtC,KAAK,CAAC,CAAC;AACP;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.native.js new file mode 100644 index 0000000..94009f9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/ssr/ssr.cjs.native.js @@ -0,0 +1,157 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var React = require('rehackt'); +var context = require('../context'); +var server = require('react-dom/server'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +function makeDefaultQueryInfo() { + return { + seen: false, + observable: null, + }; +} +var RenderPromises = (function () { + function RenderPromises() { + this.queryPromises = new Map(); + this.queryInfoTrie = new Map(); + this.stopped = false; + } + RenderPromises.prototype.stop = function () { + if (!this.stopped) { + this.queryPromises.clear(); + this.queryInfoTrie.clear(); + this.stopped = true; + } + }; + RenderPromises.prototype.registerSSRObservable = function (observable) { + if (this.stopped) + return; + this.lookupQueryInfo(observable.options).observable = observable; + }; + RenderPromises.prototype.getSSRObservable = function (props) { + return this.lookupQueryInfo(props).observable; + }; + RenderPromises.prototype.addQueryPromise = function (queryInstance, finish) { + if (!this.stopped) { + var info = this.lookupQueryInfo(queryInstance.getOptions()); + if (!info.seen) { + this.queryPromises.set(queryInstance.getOptions(), new Promise(function (resolve) { + resolve(queryInstance.fetchData()); + })); + return null; + } + } + return finish ? finish() : null; + }; + RenderPromises.prototype.addObservableQueryPromise = function (obsQuery) { + return this.addQueryPromise({ + getOptions: function () { return obsQuery.options; }, + fetchData: function () { + return new Promise(function (resolve) { + var sub = obsQuery.subscribe({ + next: function (result) { + if (!result.loading) { + resolve(); + sub.unsubscribe(); + } + }, + error: function () { + resolve(); + sub.unsubscribe(); + }, + complete: function () { + resolve(); + }, + }); + }); + }, + }); + }; + RenderPromises.prototype.hasPromises = function () { + return this.queryPromises.size > 0; + }; + RenderPromises.prototype.consumeAndAwaitPromises = function () { + var _this = this; + var promises = []; + this.queryPromises.forEach(function (promise, queryInstance) { + _this.lookupQueryInfo(queryInstance).seen = true; + promises.push(promise); + }); + this.queryPromises.clear(); + return Promise.all(promises); + }; + RenderPromises.prototype.lookupQueryInfo = function (props) { + var queryInfoTrie = this.queryInfoTrie; + var query = props.query, variables = props.variables; + var varMap = queryInfoTrie.get(query) || new Map(); + if (!queryInfoTrie.has(query)) + queryInfoTrie.set(query, varMap); + var variablesString = JSON.stringify(variables); + var info = varMap.get(variablesString) || makeDefaultQueryInfo(); + if (!varMap.has(variablesString)) + varMap.set(variablesString, info); + return info; + }; + return RenderPromises; +}()); + +function getDataFromTree(tree, context) { + if (context === void 0) { context = {}; } + return getMarkupFromTree({ + tree: tree, + context: context, + renderFunction: server.renderToStaticMarkup, + }); +} +function getMarkupFromTree(_a) { + var tree = _a.tree, _b = _a.context, context$1 = _b === void 0 ? {} : _b, + _c = _a.renderFunction, + renderFunction = _c === void 0 ? server.renderToStaticMarkup : _c; + var renderPromises = new RenderPromises(); + function process() { + var ApolloContext = context.getApolloContext(); + return new Promise(function (resolve) { + var element = React__namespace.createElement(ApolloContext.Provider, { value: tslib.__assign(tslib.__assign({}, context$1), { renderPromises: renderPromises }) }, tree); + resolve(renderFunction(element)); + }) + .then(function (html) { + return renderPromises.hasPromises() ? + renderPromises.consumeAndAwaitPromises().then(process) + : html; + }) + .finally(function () { + renderPromises.stop(); + }); + } + return Promise.resolve().then(process); +} + +function renderToStringWithData(component) { + return getMarkupFromTree({ + tree: component, + renderFunction: server.renderToString, + }); +} + +exports.RenderPromises = RenderPromises; +exports.getDataFromTree = getDataFromTree; +exports.getMarkupFromTree = getMarkupFromTree; +exports.renderToStringWithData = renderToStringWithData; +//# sourceMappingURL=ssr.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/react/types/types.d.ts b/graphql-subscription/node_modules/@apollo/client/react/types/types.d.ts new file mode 100644 index 0000000..7bc69b5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/types/types.d.ts @@ -0,0 +1,756 @@ +import type * as ReactTypes from "react"; +import type { DocumentNode } from "graphql"; +import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; +import type { Observable, ObservableSubscription } from "../../utilities/index.js"; +import type { FetchResult } from "../../link/core/index.js"; +import type { ApolloError } from "../../errors/index.js"; +import type { ApolloCache, ApolloClient, DefaultContext, FetchPolicy, NetworkStatus, ObservableQuery, OperationVariables, InternalRefetchQueriesInclude, WatchQueryOptions, WatchQueryFetchPolicy, SubscribeToMoreOptions, ApolloQueryResult, FetchMoreQueryOptions, ErrorPolicy, RefetchWritePolicy } from "../../core/index.js"; +import type { MutationSharedOptions, SharedWatchQueryOptions } from "../../core/watchQueryOptions.js"; +export type { QueryReference } from "../internal/index.js"; +export type { DefaultContext as Context } from "../../core/index.js"; +export type CommonOptions = TOptions & { + client?: ApolloClient; +}; +export interface BaseQueryOptions extends SharedWatchQueryOptions { + /** + * Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/). + * + * @docGroup + * + * 2. Networking options + */ + ssr?: boolean; + /** + * The instance of {@link ApolloClient} to use to execute the query. + * + * By default, the instance that's passed down via context is used, but you can provide a different instance here. + * + * @docGroup + * + * 1. Operation options + */ + client?: ApolloClient; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: DefaultContext; +} +export interface QueryFunctionOptions extends BaseQueryOptions { + /** + * If true, the query is not executed. + * + * The default value is `false`. + * + * @docGroup + * + * 1. Operation options + */ + skip?: boolean; + /** + * A callback function that's called when your query successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned). + * + * This function is passed the query's result `data`. + * + * @docGroup + * + * 1. Operation options + */ + onCompleted?: (data: TData) => void; + /** + * A callback function that's called when the query encounters one or more errors (unless `errorPolicy` is `ignore`). + * + * This function is passed an `ApolloError` object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred. + * + * @docGroup + * + * 1. Operation options + */ + onError?: (error: ApolloError) => void; + /** @internal */ + defaultOptions?: Partial>; +} +export interface ObservableQueryFields { + /** + * A function that instructs the query to begin re-executing at a specified interval (in milliseconds). + * + * + * @docGroup + * + * 3. Helper functions + */ + startPolling: (pollInterval: number) => void; + /** + * A function that instructs the query to stop polling after a previous call to `startPolling`. + * + * + * @docGroup + * + * 3. Helper functions + */ + stopPolling: () => void; + /** + * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query. + * + * This function returns _another_ function that you can call to terminate the subscription. + * + * + * @docGroup + * + * 3. Helper functions + */ + subscribeToMore: (options: SubscribeToMoreOptions) => () => void; + /** + * A function that enables you to update the query's cached result without executing a followup GraphQL operation. + * + * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information. + * + * + * @docGroup + * + * 3. Helper functions + */ + updateQuery: (mapFn: (previousQueryResult: TData, options: Pick, "variables">) => TData) => void; + /** + * A function that enables you to re-execute the query, optionally passing in new `variables`. + * + * To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request). + * + * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching). + * + * @docGroup + * + * 3. Helper functions + */ + refetch: (variables?: Partial) => Promise>; + /** @internal */ + reobserve: (newOptions?: Partial>, newNetworkStatus?: NetworkStatus) => Promise>; + /** + * An object containing the variables that were provided for the query. + * + * @docGroup + * + * 1. Operation data + */ + variables: TVariables | undefined; + /** + * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/). + * + * + * @docGroup + * + * 3. Helper functions + */ + fetchMore: (fetchMoreOptions: FetchMoreQueryOptions & { + updateQuery?: (previousQueryResult: TData, options: { + fetchMoreResult: TFetchData; + variables: TFetchVars; + }) => TData; + }) => Promise>; +} +export interface QueryResult extends ObservableQueryFields { + /** + * The instance of Apollo Client that executed the query. Can be useful for manually executing followup queries or writing data to the cache. + * + * @docGroup + * + * 2. Network info + */ + client: ApolloClient; + /** + * A reference to the internal `ObservableQuery` used by the hook. + */ + observable: ObservableQuery; + /** + * An object containing the result of your GraphQL query after it completes. + * + * This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`). + * + * @docGroup + * + * 1. Operation data + */ + data: TData | undefined; + /** + * An object containing the result from the most recent _previous_ execution of this query. + * + * This value is `undefined` if this is the query's first execution. + * + * @docGroup + * + * 1. Operation data + */ + previousData?: TData; + /** + * If the query produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`. + * + * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/). + * + * @docGroup + * + * 1. Operation data + */ + error?: ApolloError; + /** + * If `true`, the query is still in flight and results have not yet been returned. + * + * @docGroup + * + * 2. Network info + */ + loading: boolean; + /** + * A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4) + * + * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option. + * + * @docGroup + * + * 2. Network info + */ + networkStatus: NetworkStatus; + /** + * If `true`, the associated lazy query has been executed. + * + * This field is only present on the result object returned by [`useLazyQuery`](/react/data/queries/#executing-queries-manually). + * + * @docGroup + * + * 2. Network info + */ + called: boolean; +} +export interface QueryDataOptions extends QueryFunctionOptions { + children?: (result: QueryResult) => ReactTypes.ReactNode; + /** + * A GraphQL query string parsed into an AST with the gql template literal. + * + * @docGroup + * + * 1. Operation options + */ + query: DocumentNode | TypedDocumentNode; +} +export interface QueryHookOptions extends QueryFunctionOptions { +} +export interface LazyQueryHookOptions extends BaseQueryOptions { + /** + * A callback function that's called when your query successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned). + * + * This function is passed the query's result `data`. + * + * @docGroup + * + * 1. Operation options + */ + onCompleted?: (data: TData) => void; + /** + * A callback function that's called when the query encounters one or more errors (unless `errorPolicy` is `ignore`). + * + * This function is passed an `ApolloError` object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred. + * + * @docGroup + * + * 1. Operation options + */ + onError?: (error: ApolloError) => void; + /** @internal */ + defaultOptions?: Partial>; +} +export interface LazyQueryHookExecOptions extends LazyQueryHookOptions { + query?: DocumentNode | TypedDocumentNode; +} +export type SuspenseQueryHookFetchPolicy = Extract; +export interface SuspenseQueryHookOptions { + /** + * The instance of {@link ApolloClient} to use to execute the query. + * + * By default, the instance that's passed down via context is used, but you can provide a different instance here. + * + * @docGroup + * + * 1. Operation options + */ + client?: ApolloClient; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: DefaultContext; + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: TVariables; + /** + * Specifies how the query handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the query result includes error details but not partial results. + * + * @docGroup + * + * 1. Operation options + */ + errorPolicy?: ErrorPolicy; + /** + * Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false. + * + * @deprecated + * + * Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + */ + canonizeResults?: boolean; + /** + * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields. + * + * The default value is `false`. + * + * @docGroup + * + * 3. Caching options + */ + returnPartialData?: boolean; + /** + * Watched queries must opt into overwriting existing data on refetch, by passing refetchWritePolicy: "overwrite" in their WatchQueryOptions. + * + * The default value is "overwrite". + * + * @docGroup + * + * 3. Caching options + */ + refetchWritePolicy?: RefetchWritePolicy; + /** + * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server). + * + * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + * + * The default value is `cache-first`. + * + * @docGroup + * + * 3. Caching options + */ + fetchPolicy?: SuspenseQueryHookFetchPolicy; + /** + * A unique identifier for the query. Each item in the array must be a stable identifier to prevent infinite fetches. + * + * This is useful when using the same query and variables combination in more than one component, otherwise the components may clobber each other. This can also be used to force the query to re-evaluate fresh. + * + * @docGroup + * + * 1. Operation options + */ + queryKey?: string | number | any[]; + /** + * If `true`, the query is not executed. The default value is `false`. + * + * @deprecated + * + * We recommend using `skipToken` in place of the `skip` option as it is more type-safe. + * + * This option is deprecated and only supported to ease the migration from useQuery. It will be removed in a future release. + * + * @docGroup + * + * 1. Operation options + * + * + * @example Recommended usage of `skipToken`: + * ```ts + * import { skipToken, useSuspenseQuery } from '@apollo/client'; + * + * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken); + * ``` + */ + skip?: boolean; +} +export type BackgroundQueryHookFetchPolicy = Extract; +export interface BackgroundQueryHookOptions extends Pick, "client" | "variables" | "errorPolicy" | "context" | "canonizeResults" | "returnPartialData" | "refetchWritePolicy"> { + fetchPolicy?: BackgroundQueryHookFetchPolicy; + queryKey?: string | number | any[]; + /** + * If `true`, the query is not executed. The default value is `false`. + * + * @deprecated + * + * We recommend using `skipToken` in place of the `skip` option as it is more type-safe. + * + * This option is deprecated and only supported to ease the migration from useQuery. It will be removed in a future release. + * + * @docGroup + * + * 1. Operation options + * + * + * @example Recommended usage of `skipToken`: + * ```ts + * import { skipToken, useBackgroundQuery } from '@apollo/client'; + * + * const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken); + * ``` + */ + skip?: boolean; +} +export type LoadableQueryHookFetchPolicy = Extract; +export interface LoadableQueryHookOptions { + /** + * Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false. + * + * @deprecated + * + * Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. + */ + canonizeResults?: boolean; + /** + * The instance of {@link ApolloClient} to use to execute the query. + * + * By default, the instance that's passed down via context is used, but you can provide a different instance here. + * + * @docGroup + * + * 1. Operation options + */ + client?: ApolloClient; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: DefaultContext; + /** + * Specifies how the query handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the query result includes error details but not partial results. + * + * @docGroup + * + * 1. Operation options + */ + errorPolicy?: ErrorPolicy; + /** + * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server). + * + * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + * + * The default value is `cache-first`. + * + * @docGroup + * + * 3. Caching options + */ + fetchPolicy?: LoadableQueryHookFetchPolicy; + /** + * A unique identifier for the query. Each item in the array must be a stable identifier to prevent infinite fetches. + * + * This is useful when using the same query and variables combination in more than one component, otherwise the components may clobber each other. This can also be used to force the query to re-evaluate fresh. + * + * @docGroup + * + * 1. Operation options + */ + queryKey?: string | number | any[]; + /** + * Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x. + * + * @docGroup + * + * 3. Caching options + */ + refetchWritePolicy?: RefetchWritePolicy; + /** + * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields. + * + * The default value is `false`. + * + * @docGroup + * + * 3. Caching options + */ + returnPartialData?: boolean; +} +/** + * @deprecated This type will be removed in the next major version of Apollo Client + */ +export interface QueryLazyOptions { + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup + * + * 1. Operation options + */ + variables?: TVariables; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup + * + * 2. Networking options + */ + context?: DefaultContext; +} +/** + * @deprecated This type will be removed in the next major version of Apollo Client + */ +export type LazyQueryResult = QueryResult; +/** + * @deprecated This type will be removed in the next major version of Apollo Client + */ +export type QueryTuple = LazyQueryResultTuple; +export type LazyQueryExecFunction = (options?: Partial>) => Promise>; +export type LazyQueryResultTuple = [ + execute: LazyQueryExecFunction, + result: QueryResult +]; +export type RefetchQueriesFunction = (...args: any[]) => InternalRefetchQueriesInclude; +export interface BaseMutationOptions = ApolloCache> extends MutationSharedOptions { + /** + * The instance of `ApolloClient` to use to execute the mutation. + * + * By default, the instance that's passed down via context is used, but you can provide a different instance here. + * + * @docGroup + * + * 2. Networking options + */ + client?: ApolloClient; + /** + * If `true`, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs. + * + * The default value is `false`. + * + * @docGroup + * + * 2. Networking options + */ + notifyOnNetworkStatusChange?: boolean; + /** + * A callback function that's called when your mutation successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned). + * + * This function is passed the mutation's result `data` and any options passed to the mutation. + * + * @docGroup + * + * 1. Operation options + */ + onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void; + /** + * A callback function that's called when the mutation encounters one or more errors (unless `errorPolicy` is `ignore`). + * + * This function is passed an [`ApolloError`](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/errors/index.ts#L36-L39) object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred, as well as any options passed the mutation. + * + * @docGroup + * + * 1. Operation options + */ + onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void; + /** + * If `true`, the mutation's `data` property is not updated with the mutation's result. + * + * The default value is `false`. + * + * @docGroup + * + * 1. Operation options + */ + ignoreResults?: boolean; +} +export interface MutationFunctionOptions = ApolloCache> extends BaseMutationOptions { + /** + * A GraphQL document, often created with `gql` from the `graphql-tag` package, that contains a single mutation inside of it. + * + * @docGroup + * + * 1. Operation options + */ + mutation?: DocumentNode | TypedDocumentNode; +} +export interface MutationResult { + /** + * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`. + */ + data?: TData | null; + /** + * If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`. + * + * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/). + */ + error?: ApolloError; + /** + * If `true`, the mutation is currently in flight. + */ + loading: boolean; + /** + * If `true`, the mutation's mutate function has been called. + */ + called: boolean; + /** + * The instance of Apollo Client that executed the mutation. + * + * Can be useful for manually executing followup operations or writing data to the cache. + */ + client: ApolloClient; + /** + * A function that you can call to reset the mutation's result to its initial, uncalled state. + */ + reset(): void; +} +export declare type MutationFunction = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; +export interface MutationHookOptions = ApolloCache> extends BaseMutationOptions { +} +export interface MutationDataOptions = ApolloCache> extends BaseMutationOptions { + mutation: DocumentNode | TypedDocumentNode; +} +export type MutationTuple = ApolloCache> = [ + mutate: (options?: MutationFunctionOptions) => Promise>, + result: MutationResult +]; +export interface OnDataOptions { + client: ApolloClient; + data: SubscriptionResult; +} +export interface OnSubscriptionDataOptions { + client: ApolloClient; + subscriptionData: SubscriptionResult; +} +export interface BaseSubscriptionOptions { + /** + * An object containing all of the variables your subscription needs to execute + */ + variables?: TVariables; + /** + * How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + */ + fetchPolicy?: FetchPolicy; + /** + * Determines if your subscription should be unsubscribed and subscribed again when an input to the hook (such as `subscription` or `variables`) changes. + */ + shouldResubscribe?: boolean | ((options: BaseSubscriptionOptions) => boolean); + /** + * An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in. + */ + client?: ApolloClient; + /** + * Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet. + */ + skip?: boolean; + /** + * Shared context between your component and your network interface (Apollo Link). + */ + context?: DefaultContext; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription. + * + * @since + * + * 3.7.0 + */ + onComplete?: () => void; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`. + * + * @since + * + * 3.7.0 + */ + onData?: (options: OnDataOptions) => any; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `subscriptionData`. + * + * @deprecated + * + * Use `onData` instead + */ + onSubscriptionData?: (options: OnSubscriptionDataOptions) => any; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives an error. + * + * @since + * + * 3.7.0 + */ + onError?: (error: ApolloError) => void; + /** + * Allows the registration of a callback function that will be triggered when the `useSubscription` Hook / `Subscription` component completes the subscription. + * + * @deprecated + * + * Use `onComplete` instead + */ + onSubscriptionComplete?: () => void; +} +export interface SubscriptionResult { + /** + * A boolean that indicates whether any initial data has been returned + */ + loading: boolean; + /** + * An object containing the result of your GraphQL subscription. Defaults to an empty object. + */ + data?: TData; + /** + * A runtime error with `graphQLErrors` and `networkError` properties + */ + error?: ApolloError; + /** + * @internal + */ + variables?: TVariables; +} +export interface SubscriptionHookOptions extends BaseSubscriptionOptions { +} +export interface SubscriptionDataOptions extends BaseSubscriptionOptions { + subscription: DocumentNode | TypedDocumentNode; + children?: null | ((result: SubscriptionResult) => JSX.Element | null); +} +export interface SubscriptionCurrentObservable { + query?: Observable; + subscription?: ObservableSubscription; +} +/** +Helper type that allows using a type in a way that cannot be "widened" by inference on the value it is used on. + +This type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546). + +Example usage: +```ts +export function useQuery< + TData = any, + TVariables extends OperationVariables = OperationVariables, +>( + query: DocumentNode | TypedDocumentNode, + options: QueryHookOptions, NoInfer> = Object.create(null), +) +``` +In this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`. + +So, in this code example: +```ts +declare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }> +const { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: "string" } }); +``` +Without the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: "string" }`. +With `NoInfer`, it will instead give an error on `nonExistingVariable`. + */ +export type NoInfer = [T][T extends any ? 0 : never]; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.d.ts b/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.d.ts new file mode 100644 index 0000000..1c485ea --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.d.ts @@ -0,0 +1,559 @@ +export interface QueryOptionsDocumentation { + /** + * A GraphQL query string parsed into an AST with the gql template literal. + * + * @docGroup 1. Operation options + */ + query: unknown; + /** + * An object containing all of the GraphQL variables your query requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup 1. Operation options + */ + variables: unknown; + /** + * Specifies how the query handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the query result includes error details but not partial results. + * + * @docGroup 1. Operation options + */ + errorPolicy: unknown; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup 2. Networking options + */ + context: unknown; + /** + * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server). + * + * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + * + * The default value is `cache-first`. + * + * @docGroup 3. Caching options + */ + fetchPolicy: unknown; + /** + * Specifies the {@link FetchPolicy} to be used after this query has completed. + * + * @docGroup 3. Caching options + */ + nextFetchPolicy: unknown; + /** + * Defaults to the initial value of options.fetchPolicy, but can be explicitly + * configured to specify the WatchQueryFetchPolicy to revert back to whenever + * variables change (unless nextFetchPolicy intervenes). + * + * @docGroup 3. Caching options + */ + initialFetchPolicy: unknown; + /** + * Specifies the interval (in milliseconds) at which the query polls for updated results. + * + * The default value is `0` (no polling). + * + * @docGroup 2. Networking options + */ + pollInterval: unknown; + /** + * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs. + * + * The default value is `false`. + * + * @docGroup 2. Networking options + */ + notifyOnNetworkStatusChange: unknown; + /** + * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields. + * + * The default value is `false`. + * + * @docGroup 3. Caching options + */ + returnPartialData: unknown; + /** + * Specifies whether a `NetworkStatus.refetch` operation should merge + * incoming field data with existing data, or overwrite the existing data. + * Overwriting is probably preferable, but merging is currently the default + * behavior, for backwards compatibility with Apollo Client 3.x. + * + * @docGroup 3. Caching options + */ + refetchWritePolicy: unknown; + /** + * Watched queries must opt into overwriting existing data on refetch, by passing refetchWritePolicy: "overwrite" in their WatchQueryOptions. + * + * The default value is "overwrite". + * + * @docGroup 3. Caching options + */ + refetchWritePolicy_suspense: unknown; + /** + * If `true`, causes a query refetch if the query result is detected as partial. + * + * The default value is `false`. + * + * @deprecated + * Setting this option is unnecessary in Apollo Client 3, thanks to a more consistent application of fetch policies. It might be removed in a future release. + */ + partialRefetch: unknown; + /** + * Whether to canonize cache results before returning them. Canonization + * takes some extra time, but it speeds up future deep equality comparisons. + * Defaults to false. + * + * @deprecated + * Using `canonizeResults` can result in memory leaks so we generally do not + * recommend using this option anymore. + * A future version of Apollo Client will contain a similar feature without + * the risk of memory leaks. + */ + canonizeResults: unknown; + /** + * If true, the query is not executed. + * + * The default value is `false`. + * + * @docGroup 1. Operation options + */ + skip: unknown; + /** + * If `true`, the query is not executed. The default value is `false`. + * + * @deprecated We recommend using `skipToken` in place of the `skip` option as + * it is more type-safe. + * + * This option is deprecated and only supported to ease the migration from useQuery. It will be removed in a future release. + * + * @docGroup 1. Operation options + */ + skip_deprecated: unknown; + /** + * A callback function that's called when your query successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned). + * + * This function is passed the query's result `data`. + * + * @docGroup 1. Operation options + */ + onCompleted: unknown; + /** + * A callback function that's called when the query encounters one or more errors (unless `errorPolicy` is `ignore`). + * + * This function is passed an `ApolloError` object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred. + * + * @docGroup 1. Operation options + */ + onError: unknown; + /** + * The instance of {@link ApolloClient} to use to execute the query. + * + * By default, the instance that's passed down via context is used, but you + * can provide a different instance here. + * + * @docGroup 1. Operation options + */ + client: unknown; + /** + * A unique identifier for the query. Each item in the array must be a stable + * identifier to prevent infinite fetches. + * + * This is useful when using the same query and variables combination in more + * than one component, otherwise the components may clobber each other. This + * can also be used to force the query to re-evaluate fresh. + * + * @docGroup 1. Operation options + */ + queryKey: unknown; + /** + * Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/). + * + * @docGroup 2. Networking options + */ + ssr: unknown; + /** + * A callback function that's called whenever a refetch attempt occurs + * while polling. If the function returns `true`, the refetch is + * skipped and not reattempted until the next poll interval. + * + * @docGroup 2. Networking options + */ + skipPollAttempt: unknown; +} +export interface QueryResultDocumentation { + /** + * The instance of Apollo Client that executed the query. + * Can be useful for manually executing followup queries or writing data to the cache. + * + * @docGroup 2. Network info + */ + client: unknown; + /** + * A reference to the internal `ObservableQuery` used by the hook. + */ + observable: unknown; + /** + * An object containing the result of your GraphQL query after it completes. + * + * This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`). + * + * @docGroup 1. Operation data + */ + data: unknown; + /** + * An object containing the result from the most recent _previous_ execution of this query. + * + * This value is `undefined` if this is the query's first execution. + * + * @docGroup 1. Operation data + */ + previousData: unknown; + /** + * If the query produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`. + * + * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/). + * + * @docGroup 1. Operation data + */ + error: unknown; + /** + * If `true`, the query is still in flight and results have not yet been returned. + * + * @docGroup 2. Network info + */ + loading: unknown; + /** + * A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4) + * + * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option. + * + * @docGroup 2. Network info + */ + networkStatus: unknown; + /** + * If `true`, the associated lazy query has been executed. + * + * This field is only present on the result object returned by [`useLazyQuery`](/react/data/queries/#executing-queries-manually). + * + * @docGroup 2. Network info + */ + called: unknown; + /** + * An object containing the variables that were provided for the query. + * + * @docGroup 1. Operation data + */ + variables: unknown; + /** + * A function that enables you to re-execute the query, optionally passing in new `variables`. + * + * To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request). + * + * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching). + * + * @docGroup 3. Helper functions + */ + refetch: unknown; + /** + * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/). + * + * + * @docGroup 3. Helper functions + */ + fetchMore: unknown; + /** + * A function that instructs the query to begin re-executing at a specified interval (in milliseconds). + * + * + * @docGroup 3. Helper functions + */ + startPolling: unknown; + /** + * A function that instructs the query to stop polling after a previous call to `startPolling`. + * + * + * @docGroup 3. Helper functions + */ + stopPolling: unknown; + /** + * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query. + * + * This function returns _another_ function that you can call to terminate the subscription. + * + * + * @docGroup 3. Helper functions + */ + subscribeToMore: unknown; + /** + * A function that enables you to update the query's cached result without executing a followup GraphQL operation. + * + * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information. + * + * + * @docGroup 3. Helper functions + */ + updateQuery: unknown; +} +export interface MutationOptionsDocumentation { + /** + * A GraphQL document, often created with `gql` from the `graphql-tag` + * package, that contains a single mutation inside of it. + * + * @docGroup 1. Operation options + */ + mutation: unknown; + /** + * Provide `no-cache` if the mutation's result should _not_ be written to the Apollo Client cache. + * + * The default value is `network-only` (which means the result _is_ written to the cache). + * + * Unlike queries, mutations _do not_ support [fetch policies](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy) besides `network-only` and `no-cache`. + * + * @docGroup 3. Caching options + */ + fetchPolicy: unknown; + /** + * To avoid retaining sensitive information from mutation root field + * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION` + * fields from the cache after each mutation finishes. If you need this + * information to remain in the cache, you can prevent the removal by passing + * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are + * also passed to the mutation `update` function, so we recommend obtaining + * the results that way, rather than using this option, if possible. + */ + keepRootFields: unknown; + /** + * By providing either an object or a callback function that, when invoked after + * a mutation, allows you to return optimistic data and optionally skip updates + * via the `IGNORE` sentinel object, Apollo Client caches this temporary + * (and potentially incorrect) response until the mutation completes, enabling + * more responsive UI updates. + * + * For more information, see [Optimistic mutation results](https://www.apollographql.com/docs/react/performance/optimistic-ui/). + * + * @docGroup 3. Caching options + */ + optimisticResponse: unknown; + /** + * A {@link MutationQueryReducersMap}, which is map from query names to + * mutation query reducers. Briefly, this map defines how to incorporate the + * results of the mutation into the results of queries that are currently + * being watched by your application. + */ + updateQueries: unknown; + /** + * An array (or a function that _returns_ an array) that specifies which queries you want to refetch after the mutation occurs. + * + * Each array value can be either: + * + * - An object containing the `query` to execute, along with any `variables` + * + * - A string indicating the operation name of the query to refetch + * + * @docGroup 1. Operation options + */ + refetchQueries: unknown; + /** + * If `true`, makes sure all queries included in `refetchQueries` are completed before the mutation is considered complete. + * + * The default value is `false` (queries are refetched asynchronously). + * + * @docGroup 1. Operation options + */ + awaitRefetchQueries: unknown; + /** + * A function used to update the Apollo Client cache after the mutation completes. + * + * For more information, see [Updating the cache after a mutation](https://www.apollographql.com/docs/react/data/mutations#updating-the-cache-after-a-mutation). + * + * @docGroup 3. Caching options + */ + update: unknown; + /** + * Optional callback for intercepting queries whose cache data has been updated by the mutation, as well as any queries specified in the `refetchQueries: [...]` list passed to `client.mutate`. + * + * Returning a `Promise` from `onQueryUpdated` will cause the final mutation `Promise` to await the returned `Promise`. Returning `false` causes the query to be ignored. + * + * @docGroup 1. Operation options + */ + onQueryUpdated: unknown; + /** + * Specifies how the mutation handles a response that returns both GraphQL errors and partial results. + * + * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies). + * + * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results. + * + * @docGroup 1. Operation options + */ + errorPolicy: unknown; + /** + * An object containing all of the GraphQL variables your mutation requires to execute. + * + * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value. + * + * @docGroup 1. Operation options + */ + variables: unknown; + /** + * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain. + * + * @docGroup 2. Networking options + */ + context: unknown; + /** + * The instance of `ApolloClient` to use to execute the mutation. + * + * By default, the instance that's passed down via context is used, but you can provide a different instance here. + * + * @docGroup 2. Networking options + */ + client: unknown; + /** + * If `true`, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs. + * + * The default value is `false`. + * + * @docGroup 2. Networking options + */ + notifyOnNetworkStatusChange: unknown; + /** + * A callback function that's called when your mutation successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned). + * + * This function is passed the mutation's result `data` and any options passed to the mutation. + * + * @docGroup 1. Operation options + */ + onCompleted: unknown; + /** + * A callback function that's called when the mutation encounters one or more errors (unless `errorPolicy` is `ignore`). + * + * This function is passed an [`ApolloError`](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/errors/index.ts#L36-L39) object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred, as well as any options passed the mutation. + * + * @docGroup 1. Operation options + */ + onError: unknown; + /** + * If `true`, the mutation's `data` property is not updated with the mutation's result. + * + * The default value is `false`. + * + * @docGroup 1. Operation options + */ + ignoreResults: unknown; +} +export interface MutationResultDocumentation { + /** + * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`. + */ + data: unknown; + /** + * If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`. + * + * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/). + */ + error: unknown; + /** + * If `true`, the mutation is currently in flight. + */ + loading: unknown; + /** + * If `true`, the mutation's mutate function has been called. + */ + called: unknown; + /** + * The instance of Apollo Client that executed the mutation. + * + * Can be useful for manually executing followup operations or writing data to the cache. + */ + client: unknown; + /** + * A function that you can call to reset the mutation's result to its initial, uncalled state. + */ + reset: unknown; +} +export interface SubscriptionOptionsDocumentation { + /** + * A GraphQL document, often created with `gql` from the `graphql-tag` + * package, that contains a single subscription inside of it. + */ + query: unknown; + /** + * An object containing all of the variables your subscription needs to execute + */ + variables: unknown; + /** + * Specifies the {@link ErrorPolicy} to be used for this operation + */ + errorPolicy: unknown; + /** + * How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy). + */ + fetchPolicy: unknown; + /** + * Determines if your subscription should be unsubscribed and subscribed again when an input to the hook (such as `subscription` or `variables`) changes. + */ + shouldResubscribe: unknown; + /** + * An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in. + */ + client: unknown; + /** + * Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet. + */ + skip: unknown; + /** + * Shared context between your component and your network interface (Apollo Link). + */ + context: unknown; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription. + * + * @since 3.7.0 + */ + onComplete: unknown; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`. + * + * @since 3.7.0 + */ + onData: unknown; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `subscriptionData`. + * + * @deprecated Use `onData` instead + */ + onSubscriptionData: unknown; + /** + * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives an error. + * + * @since 3.7.0 + */ + onError: unknown; + /** + * Allows the registration of a callback function that will be triggered when the `useSubscription` Hook / `Subscription` component completes the subscription. + * + * @deprecated Use `onComplete` instead + */ + onSubscriptionComplete: unknown; +} +export interface SubscriptionResultDocumentation { + /** + * A boolean that indicates whether any initial data has been returned + */ + loading: unknown; + /** + * An object containing the result of your GraphQL subscription. Defaults to an empty object. + */ + data: unknown; + /** + * A runtime error with `graphQLErrors` and `networkError` properties + */ + error: unknown; +} +//# sourceMappingURL=types.documentation.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js b/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js new file mode 100644 index 0000000..e254224 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.documentation.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js.map b/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js.map new file mode 100644 index 0000000..0fa6857 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/types/types.documentation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.documentation.js","sourceRoot":"","sources":["../../../src/react/types/types.documentation.ts"],"names":[],"mappings":"","sourcesContent":["export interface QueryOptionsDocumentation {\n /**\n * A GraphQL query string parsed into an AST with the gql template literal.\n *\n * @docGroup 1. Operation options\n */\n query: unknown;\n\n /**\n * An object containing all of the GraphQL variables your query requires to execute.\n *\n * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.\n *\n * @docGroup 1. Operation options\n */\n variables: unknown;\n\n /**\n * Specifies how the query handles a response that returns both GraphQL errors and partial results.\n *\n * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).\n *\n * The default value is `none`, meaning that the query result includes error details but not partial results.\n *\n * @docGroup 1. Operation options\n */\n errorPolicy: unknown;\n\n /**\n * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.\n *\n * @docGroup 2. Networking options\n */\n context: unknown;\n\n /**\n * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).\n *\n * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).\n *\n * The default value is `cache-first`.\n *\n * @docGroup 3. Caching options\n */\n fetchPolicy: unknown;\n\n /**\n * Specifies the {@link FetchPolicy} to be used after this query has completed.\n *\n * @docGroup 3. Caching options\n */\n nextFetchPolicy: unknown;\n\n /**\n * Defaults to the initial value of options.fetchPolicy, but can be explicitly\n * configured to specify the WatchQueryFetchPolicy to revert back to whenever\n * variables change (unless nextFetchPolicy intervenes).\n *\n * @docGroup 3. Caching options\n */\n initialFetchPolicy: unknown;\n\n /**\n * Specifies the interval (in milliseconds) at which the query polls for updated results.\n *\n * The default value is `0` (no polling).\n *\n * @docGroup 2. Networking options\n */\n pollInterval: unknown;\n\n /**\n * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.\n *\n * The default value is `false`.\n *\n * @docGroup 2. Networking options\n */\n notifyOnNetworkStatusChange: unknown;\n\n /**\n * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.\n *\n * The default value is `false`.\n *\n * @docGroup 3. Caching options\n */\n returnPartialData: unknown;\n\n /**\n * Specifies whether a `NetworkStatus.refetch` operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n *\n * @docGroup 3. Caching options\n */\n refetchWritePolicy: unknown;\n\n /**\n * Watched queries must opt into overwriting existing data on refetch, by passing refetchWritePolicy: \"overwrite\" in their WatchQueryOptions.\n *\n * The default value is \"overwrite\".\n *\n * @docGroup 3. Caching options\n */\n refetchWritePolicy_suspense: unknown;\n\n /**\n * If `true`, causes a query refetch if the query result is detected as partial.\n *\n * The default value is `false`.\n *\n * @deprecated\n * Setting this option is unnecessary in Apollo Client 3, thanks to a more consistent application of fetch policies. It might be removed in a future release.\n */\n partialRefetch: unknown;\n\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n *\n * @deprecated\n * Using `canonizeResults` can result in memory leaks so we generally do not\n * recommend using this option anymore.\n * A future version of Apollo Client will contain a similar feature without\n * the risk of memory leaks.\n */\n canonizeResults: unknown;\n\n /**\n * If true, the query is not executed.\n *\n * The default value is `false`.\n *\n * @docGroup 1. Operation options\n */\n skip: unknown;\n\n /**\n * If `true`, the query is not executed. The default value is `false`.\n *\n * @deprecated We recommend using `skipToken` in place of the `skip` option as\n * it is more type-safe.\n *\n * This option is deprecated and only supported to ease the migration from useQuery. It will be removed in a future release.\n *\n * @docGroup 1. Operation options\n */\n skip_deprecated: unknown;\n\n /**\n * A callback function that's called when your query successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned).\n *\n * This function is passed the query's result `data`.\n *\n * @docGroup 1. Operation options\n */\n onCompleted: unknown;\n /**\n * A callback function that's called when the query encounters one or more errors (unless `errorPolicy` is `ignore`).\n *\n * This function is passed an `ApolloError` object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred.\n *\n * @docGroup 1. Operation options\n */\n onError: unknown;\n\n /**\n * The instance of {@link ApolloClient} to use to execute the query.\n *\n * By default, the instance that's passed down via context is used, but you\n * can provide a different instance here.\n *\n * @docGroup 1. Operation options\n */\n client: unknown;\n\n /**\n * A unique identifier for the query. Each item in the array must be a stable\n * identifier to prevent infinite fetches.\n *\n * This is useful when using the same query and variables combination in more\n * than one component, otherwise the components may clobber each other. This\n * can also be used to force the query to re-evaluate fresh.\n *\n * @docGroup 1. Operation options\n */\n queryKey: unknown;\n\n /**\n * Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).\n *\n * @docGroup 2. Networking options\n */\n ssr: unknown;\n\n /**\n * A callback function that's called whenever a refetch attempt occurs\n * while polling. If the function returns `true`, the refetch is\n * skipped and not reattempted until the next poll interval.\n *\n * @docGroup 2. Networking options\n */\n skipPollAttempt: unknown;\n}\n\nexport interface QueryResultDocumentation {\n /**\n * The instance of Apollo Client that executed the query.\n * Can be useful for manually executing followup queries or writing data to the cache.\n *\n * @docGroup 2. Network info\n */\n client: unknown;\n /**\n * A reference to the internal `ObservableQuery` used by the hook.\n */\n observable: unknown;\n /**\n * An object containing the result of your GraphQL query after it completes.\n *\n * This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).\n *\n * @docGroup 1. Operation data\n */\n data: unknown;\n /**\n * An object containing the result from the most recent _previous_ execution of this query.\n *\n * This value is `undefined` if this is the query's first execution.\n *\n * @docGroup 1. Operation data\n */\n previousData: unknown;\n /**\n * If the query produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.\n *\n * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).\n *\n * @docGroup 1. Operation data\n */\n error: unknown;\n /**\n * If `true`, the query is still in flight and results have not yet been returned.\n *\n * @docGroup 2. Network info\n */\n loading: unknown;\n /**\n * A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4)\n *\n * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.\n *\n * @docGroup 2. Network info\n */\n networkStatus: unknown;\n /**\n * If `true`, the associated lazy query has been executed.\n *\n * This field is only present on the result object returned by [`useLazyQuery`](/react/data/queries/#executing-queries-manually).\n *\n * @docGroup 2. Network info\n */\n called: unknown;\n /**\n * An object containing the variables that were provided for the query.\n *\n * @docGroup 1. Operation data\n */\n variables: unknown;\n\n /**\n * A function that enables you to re-execute the query, optionally passing in new `variables`.\n *\n * To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).\n *\n * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).\n *\n * @docGroup 3. Helper functions\n */\n refetch: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#fetchMore:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n fetchMore: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#startPolling:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n startPolling: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#stopPolling:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n stopPolling: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#subscribeToMore:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n subscribeToMore: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#updateQuery:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n updateQuery: unknown;\n}\n\nexport interface MutationOptionsDocumentation {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n *\n * @docGroup 1. Operation options\n */\n mutation: unknown;\n\n /**\n * Provide `no-cache` if the mutation's result should _not_ be written to the Apollo Client cache.\n *\n * The default value is `network-only` (which means the result _is_ written to the cache).\n *\n * Unlike queries, mutations _do not_ support [fetch policies](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy) besides `network-only` and `no-cache`.\n *\n * @docGroup 3. Caching options\n */\n fetchPolicy: unknown;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields: unknown;\n\n /**\n * By providing either an object or a callback function that, when invoked after\n * a mutation, allows you to return optimistic data and optionally skip updates\n * via the `IGNORE` sentinel object, Apollo Client caches this temporary\n * (and potentially incorrect) response until the mutation completes, enabling\n * more responsive UI updates.\n *\n * For more information, see [Optimistic mutation results](https://www.apollographql.com/docs/react/performance/optimistic-ui/).\n *\n * @docGroup 3. Caching options\n */\n optimisticResponse: unknown;\n\n /**\n * A {@link MutationQueryReducersMap}, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries: unknown;\n\n /**\n * An array (or a function that _returns_ an array) that specifies which queries you want to refetch after the mutation occurs.\n *\n * Each array value can be either:\n *\n * - An object containing the `query` to execute, along with any `variables`\n *\n * - A string indicating the operation name of the query to refetch\n *\n * @docGroup 1. Operation options\n */\n refetchQueries: unknown;\n\n /**\n * If `true`, makes sure all queries included in `refetchQueries` are completed before the mutation is considered complete.\n *\n * The default value is `false` (queries are refetched asynchronously).\n *\n * @docGroup 1. Operation options\n */\n awaitRefetchQueries: unknown;\n\n /**\n * A function used to update the Apollo Client cache after the mutation completes.\n *\n * For more information, see [Updating the cache after a mutation](https://www.apollographql.com/docs/react/data/mutations#updating-the-cache-after-a-mutation).\n *\n * @docGroup 3. Caching options\n */\n update: unknown;\n\n /**\n * Optional callback for intercepting queries whose cache data has been updated by the mutation, as well as any queries specified in the `refetchQueries: [...]` list passed to `client.mutate`.\n *\n * Returning a `Promise` from `onQueryUpdated` will cause the final mutation `Promise` to await the returned `Promise`. Returning `false` causes the query to be ignored.\n *\n * @docGroup 1. Operation options\n */\n onQueryUpdated: unknown;\n\n /**\n * Specifies how the mutation handles a response that returns both GraphQL errors and partial results.\n *\n * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).\n *\n * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.\n *\n * @docGroup 1. Operation options\n */\n errorPolicy: unknown;\n\n /**\n * An object containing all of the GraphQL variables your mutation requires to execute.\n *\n * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.\n *\n * @docGroup 1. Operation options\n */\n variables: unknown;\n\n /**\n * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.\n *\n * @docGroup 2. Networking options\n */\n context: unknown;\n\n /**\n * The instance of `ApolloClient` to use to execute the mutation.\n *\n * By default, the instance that's passed down via context is used, but you can provide a different instance here.\n *\n * @docGroup 2. Networking options\n */\n client: unknown;\n /**\n * If `true`, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs.\n *\n * The default value is `false`.\n *\n * @docGroup 2. Networking options\n */\n notifyOnNetworkStatusChange: unknown;\n /**\n * A callback function that's called when your mutation successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned).\n *\n * This function is passed the mutation's result `data` and any options passed to the mutation.\n *\n * @docGroup 1. Operation options\n */\n onCompleted: unknown;\n /**\n * A callback function that's called when the mutation encounters one or more errors (unless `errorPolicy` is `ignore`).\n *\n * This function is passed an [`ApolloError`](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/errors/index.ts#L36-L39) object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred, as well as any options passed the mutation.\n *\n * @docGroup 1. Operation options\n */\n onError: unknown;\n /**\n * If `true`, the mutation's `data` property is not updated with the mutation's result.\n *\n * The default value is `false`.\n *\n * @docGroup 1. Operation options\n */\n ignoreResults: unknown;\n}\n\nexport interface MutationResultDocumentation {\n /**\n * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.\n */\n data: unknown;\n /**\n * If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.\n *\n * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).\n */\n error: unknown;\n /**\n * If `true`, the mutation is currently in flight.\n */\n loading: unknown;\n /**\n * If `true`, the mutation's mutate function has been called.\n */\n called: unknown;\n /**\n * The instance of Apollo Client that executed the mutation.\n *\n * Can be useful for manually executing followup operations or writing data to the cache.\n */\n client: unknown;\n /**\n * A function that you can call to reset the mutation's result to its initial, uncalled state.\n */\n reset: unknown;\n}\n\nexport interface SubscriptionOptionsDocumentation {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: unknown;\n /**\n * An object containing all of the variables your subscription needs to execute\n */\n variables: unknown;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy: unknown;\n\n /**\n * How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).\n */\n fetchPolicy: unknown;\n\n /**\n * Determines if your subscription should be unsubscribed and subscribed again when an input to the hook (such as `subscription` or `variables`) changes.\n */\n shouldResubscribe: unknown;\n\n /**\n * An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in.\n */\n client: unknown;\n\n /**\n * Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet.\n */\n skip: unknown;\n\n /**\n * Shared context between your component and your network interface (Apollo Link).\n */\n context: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription.\n *\n * @since 3.7.0\n */\n onComplete: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`.\n *\n * @since 3.7.0\n */\n onData: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `subscriptionData`.\n *\n * @deprecated Use `onData` instead\n */\n onSubscriptionData: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives an error.\n *\n * @since 3.7.0\n */\n onError: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered when the `useSubscription` Hook / `Subscription` component completes the subscription.\n *\n * @deprecated Use `onComplete` instead\n */\n onSubscriptionComplete: unknown;\n}\n\nexport interface SubscriptionResultDocumentation {\n /**\n * A boolean that indicates whether any initial data has been returned\n */\n loading: unknown;\n /**\n * An object containing the result of your GraphQL subscription. Defaults to an empty object.\n */\n data: unknown;\n /**\n * A runtime error with `graphQLErrors` and `networkError` properties\n */\n error: unknown;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/types/types.js b/graphql-subscription/node_modules/@apollo/client/react/types/types.js new file mode 100644 index 0000000..718fd38 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/types/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/react/types/types.js.map b/graphql-subscription/node_modules/@apollo/client/react/types/types.js.map new file mode 100644 index 0000000..0d54527 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/react/types/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as ReactTypes from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type {\n Observable,\n ObservableSubscription,\n} from \"../../utilities/index.js\";\nimport type { FetchResult } from \"../../link/core/index.js\";\nimport type { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n FetchPolicy,\n NetworkStatus,\n ObservableQuery,\n OperationVariables,\n InternalRefetchQueriesInclude,\n WatchQueryOptions,\n WatchQueryFetchPolicy,\n SubscribeToMoreOptions,\n ApolloQueryResult,\n FetchMoreQueryOptions,\n ErrorPolicy,\n RefetchWritePolicy,\n} from \"../../core/index.js\";\nimport type {\n MutationSharedOptions,\n SharedWatchQueryOptions,\n} from \"../../core/watchQueryOptions.js\";\n\n/* QueryReference type */\n\nexport type { QueryReference } from \"../internal/index.js\";\n\n/* Common types */\n\nexport type { DefaultContext as Context } from \"../../core/index.js\";\n\nexport type CommonOptions = TOptions & {\n client?: ApolloClient;\n};\n\n/* Query types */\n\nexport interface BaseQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n TData = any,\n> extends SharedWatchQueryOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#ssr:member} */\n ssr?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\nexport interface QueryFunctionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseQueryOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip:member} */\n skip?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData) => void;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n\n // Default WatchQueryOptions for this useQuery, providing initial values for\n // unspecified options, superseding client.defaultOptions.watchQuery (option\n // by option, not whole), but never overriding options previously passed to\n // useQuery (or options added/modified later by other means).\n // TODO What about about default values that are expensive to evaluate?\n /** @internal */\n defaultOptions?: Partial>;\n}\n\nexport interface ObservableQueryFields<\n TData,\n TVariables extends OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#startPolling:member} */\n startPolling: (pollInterval: number) => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#stopPolling:member} */\n stopPolling: () => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member} */\n subscribeToMore: <\n TSubscriptionData = TData,\n TSubscriptionVariables extends OperationVariables = TVariables,\n >(\n options: SubscribeToMoreOptions<\n TData,\n TSubscriptionVariables,\n TSubscriptionData\n >\n ) => () => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#updateQuery:member} */\n updateQuery: (\n mapFn: (\n previousQueryResult: TData,\n options: Pick, \"variables\">\n ) => TData\n ) => void;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: (\n variables?: Partial\n ) => Promise>;\n /** @internal */\n reobserve: (\n newOptions?: Partial>,\n newNetworkStatus?: NetworkStatus\n ) => Promise>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#variables:member} */\n variables: TVariables | undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: <\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(\n fetchMoreOptions: FetchMoreQueryOptions & {\n updateQuery?: (\n previousQueryResult: TData,\n options: {\n fetchMoreResult: TFetchData;\n variables: TFetchVars;\n }\n ) => TData;\n }\n ) => Promise>;\n}\n\nexport interface QueryResult<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends ObservableQueryFields {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#client:member} */\n client: ApolloClient;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#observable:member} */\n observable: ObservableQuery;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: TData | undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#previousData:member} */\n previousData?: TData;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#error:member} */\n error?: ApolloError;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#networkStatus:member} */\n networkStatus: NetworkStatus;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#called:member} */\n called: boolean;\n}\n\nexport interface QueryDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions {\n children?: (result: QueryResult) => ReactTypes.ReactNode;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode;\n}\n\nexport interface QueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions {}\n\nexport interface LazyQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseQueryOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData) => void;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n\n /** @internal */\n defaultOptions?: Partial>;\n}\nexport interface LazyQueryHookExecOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends LazyQueryHookOptions {\n query?: DocumentNode | TypedDocumentNode;\n}\n\nexport type SuspenseQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface SuspenseQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy_suspense:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: SuspenseQueryHookFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n\n /**\n * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member}\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useSuspenseQuery } from '@apollo/client';\n *\n * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type BackgroundQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface BackgroundQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> extends Pick<\n QueryHookOptions,\n | \"client\"\n | \"variables\"\n | \"errorPolicy\"\n | \"context\"\n | \"canonizeResults\"\n | \"returnPartialData\"\n | \"refetchWritePolicy\"\n > {\n fetchPolicy?: BackgroundQueryHookFetchPolicy;\n queryKey?: string | number | any[];\n\n /**\n * {@inheritDoc @apollo/client!QueryOptionsDocumentation#skip_deprecated:member}\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useBackgroundQuery } from '@apollo/client';\n *\n * const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type LoadableQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface LoadableQueryHookOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: LoadableQueryHookFetchPolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n}\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport interface QueryLazyOptions {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport type LazyQueryResult<\n TData,\n TVariables extends OperationVariables,\n> = QueryResult;\n\n/**\n * @deprecated This type will be removed in the next major version of Apollo Client\n */\nexport type QueryTuple<\n TData,\n TVariables extends OperationVariables,\n> = LazyQueryResultTuple;\n\nexport type LazyQueryExecFunction<\n TData,\n TVariables extends OperationVariables,\n> = (\n options?: Partial>\n) => Promise>;\n\nexport type LazyQueryResultTuple<\n TData,\n TVariables extends OperationVariables,\n> = [\n execute: LazyQueryExecFunction,\n result: QueryResult,\n];\n\n/* Mutation types */\n\nexport type RefetchQueriesFunction = (\n ...args: any[]\n) => InternalRefetchQueriesInclude;\n\nexport interface BaseMutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> extends MutationSharedOptions {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#client:member} */\n client?: ApolloClient;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onCompleted:member} */\n onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#ignoreResults:member} */\n ignoreResults?: boolean;\n}\n\nexport interface MutationFunctionOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> extends BaseMutationOptions {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */\n mutation?: DocumentNode | TypedDocumentNode;\n}\n\nexport interface MutationResult {\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#data:member} */\n data?: TData | null;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#error:member} */\n error?: ApolloError;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#called:member} */\n called: boolean;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#client:member} */\n client: ApolloClient;\n /** {@inheritDoc @apollo/client!MutationResultDocumentation#reset:member} */\n reset(): void;\n}\n\nexport declare type MutationFunction<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> = (\n options?: MutationFunctionOptions\n) => Promise>;\n\nexport interface MutationHookOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> extends BaseMutationOptions {}\n\nexport interface MutationDataOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> extends BaseMutationOptions {\n mutation: DocumentNode | TypedDocumentNode;\n}\n\nexport type MutationTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache = ApolloCache,\n> = [\n mutate: (\n options?: MutationFunctionOptions\n // TODO This FetchResult seems strange here, as opposed to an\n // ApolloQueryResult\n ) => Promise>,\n result: MutationResult,\n];\n\n/* Subscription types */\n\nexport interface OnDataOptions {\n client: ApolloClient;\n data: SubscriptionResult;\n}\n\nexport interface OnSubscriptionDataOptions {\n client: ApolloClient;\n subscriptionData: SubscriptionResult;\n}\n\nexport interface BaseSubscriptionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#variables:member} */\n variables?: TVariables;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#shouldResubscribe:member} */\n shouldResubscribe?:\n | boolean\n | ((options: BaseSubscriptionOptions) => boolean);\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#client:member} */\n client?: ApolloClient;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#skip:member} */\n skip?: boolean;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */\n context?: DefaultContext;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onComplete:member} */\n onComplete?: () => void;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onData:member} */\n onData?: (options: OnDataOptions) => any;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onSubscriptionData:member} */\n onSubscriptionData?: (options: OnSubscriptionDataOptions) => any;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onError:member} */\n onError?: (error: ApolloError) => void;\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onSubscriptionComplete:member} */\n onSubscriptionComplete?: () => void;\n}\n\nexport interface SubscriptionResult {\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#loading:member} */\n loading: boolean;\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#data:member} */\n data?: TData;\n /** {@inheritDoc @apollo/client!SubscriptionResultDocumentation#error:member} */\n error?: ApolloError;\n // This was added by the legacy useSubscription type, and is tested in unit\n // tests, but probably shouldn’t be added to the result.\n /**\n * @internal\n */\n variables?: TVariables;\n}\n\nexport interface SubscriptionHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions {}\n\nexport interface SubscriptionDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions {\n subscription: DocumentNode | TypedDocumentNode;\n children?: null | ((result: SubscriptionResult) => JSX.Element | null);\n}\n\nexport interface SubscriptionCurrentObservable {\n query?: Observable;\n subscription?: ObservableSubscription;\n}\n\n/**\nHelper type that allows using a type in a way that cannot be \"widened\" by inference on the value it is used on.\n\nThis type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546).\n\nExample usage:\n```ts\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode,\n options: QueryHookOptions, NoInfer> = Object.create(null),\n)\n```\nIn this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`.\n\nSo, in this code example:\n```ts\ndeclare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }>\nconst { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: \"string\" } });\n```\nWithout the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: \"string\" }`.\nWith `NoInfer`, it will instead give an error on `nonExistingVariable`.\n */\nexport type NoInfer = [T][T extends any ? 0 : never];\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs b/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs new file mode 100644 index 0000000..506ff9f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs @@ -0,0 +1,353 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var globals = require('../../utilities/globals'); +var equality = require('@wry/equality'); +var core = require('../../link/core'); +var utilities = require('../../utilities'); +var core$1 = require('../../core'); +var cache = require('../../cache'); + +function requestToKey(request, addTypename) { + var queryString = request.query && + utilities.print(addTypename ? utilities.addTypenameToDocument(request.query) : request.query); + var requestKey = { query: queryString }; + return JSON.stringify(requestKey); +} +var MockLink = (function (_super) { + tslib.__extends(MockLink, _super); + function MockLink(mockedResponses, addTypename, options) { + if (addTypename === void 0) { addTypename = true; } + if (options === void 0) { options = Object.create(null); } + var _a; + var _this = _super.call(this) || this; + _this.addTypename = true; + _this.showWarnings = true; + _this.mockedResponsesByKey = {}; + _this.addTypename = addTypename; + _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true; + if (mockedResponses) { + mockedResponses.forEach(function (mockedResponse) { + _this.addMockedResponse(mockedResponse); + }); + } + return _this; + } + MockLink.prototype.addMockedResponse = function (mockedResponse) { + var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse); + var key = requestToKey(normalizedMockedResponse.request, this.addTypename); + var mockedResponses = this.mockedResponsesByKey[key]; + if (!mockedResponses) { + mockedResponses = []; + this.mockedResponsesByKey[key] = mockedResponses; + } + mockedResponses.push(normalizedMockedResponse); + }; + MockLink.prototype.request = function (operation) { + var _this = this; + var _a; + this.operation = operation; + var key = requestToKey(operation, this.addTypename); + var unmatchedVars = []; + var requestVariables = operation.variables || {}; + var mockedResponses = this.mockedResponsesByKey[key]; + var responseIndex = mockedResponses ? + mockedResponses.findIndex(function (res, index) { + var mockedResponseVars = res.request.variables || {}; + if (equality.equal(requestVariables, mockedResponseVars)) { + return true; + } + if (res.variableMatcher && res.variableMatcher(operation.variables)) { + return true; + } + unmatchedVars.push(mockedResponseVars); + return false; + }) + : -1; + var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0; + var delay = (response === null || response === void 0 ? void 0 : response.delay) === Infinity ? 0 : (_a = response === null || response === void 0 ? void 0 : response.delay) !== null && _a !== void 0 ? _a : 0; + var configError; + if (!response) { + configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0 ? + "\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(utilities.stringifyForDisplay(d)); }).join("\n"), "\n") + : "")); + if (this.showWarnings) { + console.warn(configError.message + + "\nThis typically indicates a configuration error in your mocks " + + "setup, usually due to a typo or mismatched variable."); + } + } + else { + if (response.maxUsageCount && response.maxUsageCount > 1) { + response.maxUsageCount--; + } + else { + mockedResponses.splice(responseIndex, 1); + } + var newData = response.newData; + if (newData) { + response.result = newData(operation.variables); + mockedResponses.push(response); + } + if (!response.result && !response.error && response.delay !== Infinity) { + configError = new Error("Mocked response should contain either `result`, `error` or a `delay` of `Infinity`: ".concat(key)); + } + } + return new utilities.Observable(function (observer) { + var timer = setTimeout(function () { + if (configError) { + try { + if (_this.onError(configError, observer) !== false) { + throw configError; + } + } + catch (error) { + observer.error(error); + } + } + else if (response && response.delay !== Infinity) { + if (response.error) { + observer.error(response.error); + } + else { + if (response.result) { + observer.next(typeof response.result === "function" ? + response.result(operation.variables) + : response.result); + } + observer.complete(); + } + } + }, delay); + return function () { + clearTimeout(timer); + }; + }); + }; + MockLink.prototype.normalizeMockedResponse = function (mockedResponse) { + var _a; + var newMockedResponse = utilities.cloneDeep(mockedResponse); + var queryWithoutConnection = utilities.removeConnectionDirectiveFromDocument(newMockedResponse.request.query); + globals.invariant(queryWithoutConnection, 64); + newMockedResponse.request.query = queryWithoutConnection; + var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query); + if (query) { + newMockedResponse.request.query = query; + } + mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1; + globals.invariant(mockedResponse.maxUsageCount > 0, 65, mockedResponse.maxUsageCount); + this.normalizeVariableMatching(newMockedResponse); + return newMockedResponse; + }; + MockLink.prototype.normalizeVariableMatching = function (mockedResponse) { + var variables = mockedResponse.request.variables; + if (mockedResponse.variableMatcher && variables) { + throw new Error("Mocked response should contain either variableMatcher or request.variables"); + } + if (!mockedResponse.variableMatcher) { + mockedResponse.variableMatcher = function (vars) { + var requestVariables = vars || {}; + var mockedResponseVariables = variables || {}; + return equality.equal(requestVariables, mockedResponseVariables); + }; + } + }; + return MockLink; +}(core.ApolloLink)); +function mockSingleLink() { + var mockedResponses = []; + for (var _i = 0; _i < arguments.length; _i++) { + mockedResponses[_i] = arguments[_i]; + } + var maybeTypename = mockedResponses[mockedResponses.length - 1]; + var mocks = mockedResponses.slice(0, mockedResponses.length - 1); + if (typeof maybeTypename !== "boolean") { + mocks = mockedResponses; + maybeTypename = true; + } + return new MockLink(mocks, maybeTypename); +} + +var MockSubscriptionLink = (function (_super) { + tslib.__extends(MockSubscriptionLink, _super); + function MockSubscriptionLink() { + var _this = _super.call(this) || this; + _this.unsubscribers = []; + _this.setups = []; + _this.observers = []; + return _this; + } + MockSubscriptionLink.prototype.request = function (operation) { + var _this = this; + this.operation = operation; + return new utilities.Observable(function (observer) { + _this.setups.forEach(function (x) { return x(); }); + _this.observers.push(observer); + return function () { + _this.unsubscribers.forEach(function (x) { return x(); }); + }; + }); + }; + MockSubscriptionLink.prototype.simulateResult = function (result, complete) { + var _this = this; + if (complete === void 0) { complete = false; } + setTimeout(function () { + var observers = _this.observers; + if (!observers.length) + throw new Error("subscription torn down"); + observers.forEach(function (observer) { + if (result.result && observer.next) + observer.next(result.result); + if (result.error && observer.error) + observer.error(result.error); + if (complete && observer.complete) + observer.complete(); + }); + }, result.delay || 0); + }; + MockSubscriptionLink.prototype.simulateComplete = function () { + var observers = this.observers; + if (!observers.length) + throw new Error("subscription torn down"); + observers.forEach(function (observer) { + if (observer.complete) + observer.complete(); + }); + }; + MockSubscriptionLink.prototype.onSetup = function (listener) { + this.setups = this.setups.concat([listener]); + }; + MockSubscriptionLink.prototype.onUnsubscribe = function (listener) { + this.unsubscribers = this.unsubscribers.concat([listener]); + }; + return MockSubscriptionLink; +}(core.ApolloLink)); +function mockObservableLink() { + return new MockSubscriptionLink(); +} + +function createMockClient(data, query, variables) { + if (variables === void 0) { variables = {}; } + return new core$1.ApolloClient({ + link: mockSingleLink({ + request: { query: query, variables: variables }, + result: { data: data }, + }).setOnError(function (error) { + throw error; + }), + cache: new cache.InMemoryCache({ addTypename: false }), + }); +} + +function subscribeAndCount(reject, observable, cb) { + var queue = Promise.resolve(); + var handleCount = 0; + var subscription = utilities.asyncMap(observable, function (result) { + return (queue = queue + .then(function () { + return cb(++handleCount, result); + }) + .catch(error)); + }).subscribe({ error: error }); + function error(e) { + subscription.unsubscribe(); + reject(e); + } + return subscription; +} + +function wrap(key) { + return function (message, callback, timeout) { + return (key ? it[key] : it)(message, function () { + var _this = this; + return new Promise(function (resolve, reject) { + return callback.call(_this, resolve, reject); + }); + }, timeout); + }; +} +var wrappedIt = wrap(); +var itAsync = Object.assign(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return wrappedIt.apply(this, args); +}, { + only: wrap("only"), + skip: wrap("skip"), + todo: wrap("todo"), +}); + +function wait(ms) { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 , new Promise(function (resolve) { return setTimeout(resolve, ms); })]; + }); + }); +} +function tick() { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 , wait(0)]; + }); + }); +} + +function wrapTestFunction(fn, consoleMethodName) { + return function () { + var _this = this; + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var spy = jest.spyOn(console, consoleMethodName); + spy.mockImplementation(function () { }); + return new Promise(function (resolve) { + resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args)); + }).finally(function () { + expect(spy).toMatchSnapshot(); + spy.mockReset(); + }); + }; +} +function withErrorSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "error"); + return it.apply(void 0, args); +} +function withWarningSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "warn"); + return it.apply(void 0, args); +} +function withLogSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "log"); + return it.apply(void 0, args); +} + +exports.MockLink = MockLink; +exports.MockSubscriptionLink = MockSubscriptionLink; +exports.createMockClient = createMockClient; +exports.itAsync = itAsync; +exports.mockObservableLink = mockObservableLink; +exports.mockSingleLink = mockSingleLink; +exports.subscribeAndCount = subscribeAndCount; +exports.tick = tick; +exports.wait = wait; +exports.withErrorSpy = withErrorSpy; +exports.withLogSpy = withLogSpy; +exports.withWarningSpy = withWarningSpy; +//# sourceMappingURL=core.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.map b/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.map new file mode 100644 index 0000000..33b63a3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"core.cjs","sources":["mocking/mockLink.js","mocking/mockSubscriptionLink.js","mocking/mockClient.js","subscribeAndCount.js","itAsync.js","wait.js","withConsoleSpy.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { invariant } from \"../../../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { ApolloLink } from \"../../../link/core/index.js\";\nimport { Observable, addTypenameToDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, cloneDeep, stringifyForDisplay, print, } from \"../../../utilities/index.js\";\nfunction requestToKey(request, addTypename) {\n var queryString = request.query &&\n print(addTypename ? addTypenameToDocument(request.query) : request.query);\n var requestKey = { query: queryString };\n return JSON.stringify(requestKey);\n}\nvar MockLink = /** @class */ (function (_super) {\n __extends(MockLink, _super);\n function MockLink(mockedResponses, addTypename, options) {\n if (addTypename === void 0) { addTypename = true; }\n if (options === void 0) { options = Object.create(null); }\n var _a;\n var _this = _super.call(this) || this;\n _this.addTypename = true;\n _this.showWarnings = true;\n _this.mockedResponsesByKey = {};\n _this.addTypename = addTypename;\n _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;\n if (mockedResponses) {\n mockedResponses.forEach(function (mockedResponse) {\n _this.addMockedResponse(mockedResponse);\n });\n }\n return _this;\n }\n MockLink.prototype.addMockedResponse = function (mockedResponse) {\n var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);\n var key = requestToKey(normalizedMockedResponse.request, this.addTypename);\n var mockedResponses = this.mockedResponsesByKey[key];\n if (!mockedResponses) {\n mockedResponses = [];\n this.mockedResponsesByKey[key] = mockedResponses;\n }\n mockedResponses.push(normalizedMockedResponse);\n };\n MockLink.prototype.request = function (operation) {\n var _this = this;\n var _a;\n this.operation = operation;\n var key = requestToKey(operation, this.addTypename);\n var unmatchedVars = [];\n var requestVariables = operation.variables || {};\n var mockedResponses = this.mockedResponsesByKey[key];\n var responseIndex = mockedResponses ?\n mockedResponses.findIndex(function (res, index) {\n var mockedResponseVars = res.request.variables || {};\n if (equal(requestVariables, mockedResponseVars)) {\n return true;\n }\n if (res.variableMatcher && res.variableMatcher(operation.variables)) {\n return true;\n }\n unmatchedVars.push(mockedResponseVars);\n return false;\n })\n : -1;\n var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;\n // There have been platform- and engine-dependent differences with\n // setInterval(fn, Infinity), so we pass 0 instead (but detect\n // Infinity where we call observer.error or observer.next to pend\n // indefinitely in those cases.)\n var delay = (response === null || response === void 0 ? void 0 : response.delay) === Infinity ? 0 : (_a = response === null || response === void 0 ? void 0 : response.delay) !== null && _a !== void 0 ? _a : 0;\n var configError;\n if (!response) {\n configError = new Error(\"No more mocked responses for the query: \".concat(print(operation.query), \"\\nExpected variables: \").concat(stringifyForDisplay(operation.variables), \"\\n\").concat(unmatchedVars.length > 0 ?\n \"\\nFailed to match \".concat(unmatchedVars.length, \" mock\").concat(unmatchedVars.length === 1 ? \"\" : \"s\", \" for this query. The mocked response had the following variables:\\n\").concat(unmatchedVars.map(function (d) { return \" \".concat(stringifyForDisplay(d)); }).join(\"\\n\"), \"\\n\")\n : \"\"));\n if (this.showWarnings) {\n console.warn(configError.message +\n \"\\nThis typically indicates a configuration error in your mocks \" +\n \"setup, usually due to a typo or mismatched variable.\");\n }\n }\n else {\n if (response.maxUsageCount && response.maxUsageCount > 1) {\n response.maxUsageCount--;\n }\n else {\n mockedResponses.splice(responseIndex, 1);\n }\n var newData = response.newData;\n if (newData) {\n response.result = newData(operation.variables);\n mockedResponses.push(response);\n }\n if (!response.result && !response.error && response.delay !== Infinity) {\n configError = new Error(\"Mocked response should contain either `result`, `error` or a `delay` of `Infinity`: \".concat(key));\n }\n }\n return new Observable(function (observer) {\n var timer = setTimeout(function () {\n if (configError) {\n try {\n // The onError function can return false to indicate that\n // configError need not be passed to observer.error. For\n // example, the default implementation of onError calls\n // observer.error(configError) and then returns false to\n // prevent this extra (harmless) observer.error call.\n if (_this.onError(configError, observer) !== false) {\n throw configError;\n }\n }\n catch (error) {\n observer.error(error);\n }\n }\n else if (response && response.delay !== Infinity) {\n if (response.error) {\n observer.error(response.error);\n }\n else {\n if (response.result) {\n observer.next(typeof response.result === \"function\" ?\n response.result(operation.variables)\n : response.result);\n }\n observer.complete();\n }\n }\n }, delay);\n return function () {\n clearTimeout(timer);\n };\n });\n };\n MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {\n var _a;\n var newMockedResponse = cloneDeep(mockedResponse);\n var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query);\n invariant(queryWithoutConnection, 64);\n newMockedResponse.request.query = queryWithoutConnection;\n var query = removeClientSetsFromDocument(newMockedResponse.request.query);\n if (query) {\n newMockedResponse.request.query = query;\n }\n mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1;\n invariant(mockedResponse.maxUsageCount > 0, 65, mockedResponse.maxUsageCount);\n this.normalizeVariableMatching(newMockedResponse);\n return newMockedResponse;\n };\n MockLink.prototype.normalizeVariableMatching = function (mockedResponse) {\n var variables = mockedResponse.request.variables;\n if (mockedResponse.variableMatcher && variables) {\n throw new Error(\"Mocked response should contain either variableMatcher or request.variables\");\n }\n if (!mockedResponse.variableMatcher) {\n mockedResponse.variableMatcher = function (vars) {\n var requestVariables = vars || {};\n var mockedResponseVariables = variables || {};\n return equal(requestVariables, mockedResponseVariables);\n };\n }\n };\n return MockLink;\n}(ApolloLink));\nexport { MockLink };\n// Pass in multiple mocked responses, so that you can test flows that end up\n// making multiple queries to the server.\n// NOTE: The last arg can optionally be an `addTypename` arg.\nexport function mockSingleLink() {\n var mockedResponses = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n mockedResponses[_i] = arguments[_i];\n }\n // To pull off the potential typename. If this isn't a boolean, we'll just\n // set it true later.\n var maybeTypename = mockedResponses[mockedResponses.length - 1];\n var mocks = mockedResponses.slice(0, mockedResponses.length - 1);\n if (typeof maybeTypename !== \"boolean\") {\n mocks = mockedResponses;\n maybeTypename = true;\n }\n return new MockLink(mocks, maybeTypename);\n}\n//# sourceMappingURL=mockLink.js.map","import { __extends } from \"tslib\";\nimport { Observable } from \"../../../utilities/index.js\";\nimport { ApolloLink } from \"../../../link/core/index.js\";\nvar MockSubscriptionLink = /** @class */ (function (_super) {\n __extends(MockSubscriptionLink, _super);\n function MockSubscriptionLink() {\n var _this = _super.call(this) || this;\n _this.unsubscribers = [];\n _this.setups = [];\n _this.observers = [];\n return _this;\n }\n MockSubscriptionLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n return new Observable(function (observer) {\n _this.setups.forEach(function (x) { return x(); });\n _this.observers.push(observer);\n return function () {\n _this.unsubscribers.forEach(function (x) { return x(); });\n };\n });\n };\n MockSubscriptionLink.prototype.simulateResult = function (result, complete) {\n var _this = this;\n if (complete === void 0) { complete = false; }\n setTimeout(function () {\n var observers = _this.observers;\n if (!observers.length)\n throw new Error(\"subscription torn down\");\n observers.forEach(function (observer) {\n if (result.result && observer.next)\n observer.next(result.result);\n if (result.error && observer.error)\n observer.error(result.error);\n if (complete && observer.complete)\n observer.complete();\n });\n }, result.delay || 0);\n };\n MockSubscriptionLink.prototype.simulateComplete = function () {\n var observers = this.observers;\n if (!observers.length)\n throw new Error(\"subscription torn down\");\n observers.forEach(function (observer) {\n if (observer.complete)\n observer.complete();\n });\n };\n MockSubscriptionLink.prototype.onSetup = function (listener) {\n this.setups = this.setups.concat([listener]);\n };\n MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {\n this.unsubscribers = this.unsubscribers.concat([listener]);\n };\n return MockSubscriptionLink;\n}(ApolloLink));\nexport { MockSubscriptionLink };\nexport function mockObservableLink() {\n return new MockSubscriptionLink();\n}\n//# sourceMappingURL=mockSubscriptionLink.js.map","import { ApolloClient } from \"../../../core/index.js\";\nimport { InMemoryCache } from \"../../../cache/index.js\";\nimport { mockSingleLink } from \"./mockLink.js\";\nexport function createMockClient(data, query, variables) {\n if (variables === void 0) { variables = {}; }\n return new ApolloClient({\n link: mockSingleLink({\n request: { query: query, variables: variables },\n result: { data: data },\n }).setOnError(function (error) {\n throw error;\n }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n//# sourceMappingURL=mockClient.js.map","import { asyncMap } from \"../../utilities/index.js\";\nexport default function subscribeAndCount(reject, observable, cb) {\n // Use a Promise queue to prevent callbacks from being run out of order.\n var queue = Promise.resolve();\n var handleCount = 0;\n var subscription = asyncMap(observable, function (result) {\n // All previous asynchronous callbacks must complete before cb can\n // be invoked with this result.\n return (queue = queue\n .then(function () {\n return cb(++handleCount, result);\n })\n .catch(error));\n }).subscribe({ error: error });\n function error(e) {\n subscription.unsubscribe();\n reject(e);\n }\n return subscription;\n}\n//# sourceMappingURL=subscribeAndCount.js.map","function wrap(key) {\n return function (message, callback, timeout) {\n return (key ? it[key] : it)(message, function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n return callback.call(_this, resolve, reject);\n });\n }, timeout);\n };\n}\nvar wrappedIt = wrap();\nexport var itAsync = Object.assign(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return wrappedIt.apply(this, args);\n}, {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n});\n//# sourceMappingURL=itAsync.js.map","import { __awaiter, __generator } from \"tslib\";\nexport function wait(ms) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })];\n });\n });\n}\nexport function tick() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, wait(0)];\n });\n });\n}\n//# sourceMappingURL=wait.js.map","function wrapTestFunction(fn, consoleMethodName) {\n return function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var spy = jest.spyOn(console, consoleMethodName);\n spy.mockImplementation(function () { });\n return new Promise(function (resolve) {\n resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));\n }).finally(function () {\n expect(spy).toMatchSnapshot();\n spy.mockReset();\n });\n };\n}\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withErrorSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"error\");\n return it.apply(void 0, args);\n}\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withWarningSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"warn\");\n return it.apply(void 0, args);\n}\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withLogSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"log\");\n return it.apply(void 0, args);\n}\n//# sourceMappingURL=withConsoleSpy.js.map"],"names":["print","addTypenameToDocument","__extends","equal","stringifyForDisplay","Observable","cloneDeep","removeConnectionDirectiveFromDocument","invariant","removeClientSetsFromDocument","ApolloLink","ApolloClient","InMemoryCache","asyncMap","__awaiter","__generator"],"mappings":";;;;;;;;;;;;AAKA,SAAS,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE;AAC5C,IAAI,IAAI,WAAW,GAAG,OAAO,CAAC,KAAK;AACnC,QAAQA,eAAK,CAAC,WAAW,GAAGC,+BAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAClF,IAAI,IAAI,UAAU,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AACE,IAAC,QAAQ,KAAkB,UAAU,MAAM,EAAE;AAChD,IAAIC,eAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAChC,IAAI,SAAS,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE;AAC7D,QAAQ,IAAI,WAAW,KAAK,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC,EAAE;AAC3D,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;AAClE,QAAQ,IAAI,EAAE,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git a/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.native.js new file mode 100644 index 0000000..506ff9f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/core.cjs.native.js @@ -0,0 +1,353 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); +var globals = require('../../utilities/globals'); +var equality = require('@wry/equality'); +var core = require('../../link/core'); +var utilities = require('../../utilities'); +var core$1 = require('../../core'); +var cache = require('../../cache'); + +function requestToKey(request, addTypename) { + var queryString = request.query && + utilities.print(addTypename ? utilities.addTypenameToDocument(request.query) : request.query); + var requestKey = { query: queryString }; + return JSON.stringify(requestKey); +} +var MockLink = (function (_super) { + tslib.__extends(MockLink, _super); + function MockLink(mockedResponses, addTypename, options) { + if (addTypename === void 0) { addTypename = true; } + if (options === void 0) { options = Object.create(null); } + var _a; + var _this = _super.call(this) || this; + _this.addTypename = true; + _this.showWarnings = true; + _this.mockedResponsesByKey = {}; + _this.addTypename = addTypename; + _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true; + if (mockedResponses) { + mockedResponses.forEach(function (mockedResponse) { + _this.addMockedResponse(mockedResponse); + }); + } + return _this; + } + MockLink.prototype.addMockedResponse = function (mockedResponse) { + var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse); + var key = requestToKey(normalizedMockedResponse.request, this.addTypename); + var mockedResponses = this.mockedResponsesByKey[key]; + if (!mockedResponses) { + mockedResponses = []; + this.mockedResponsesByKey[key] = mockedResponses; + } + mockedResponses.push(normalizedMockedResponse); + }; + MockLink.prototype.request = function (operation) { + var _this = this; + var _a; + this.operation = operation; + var key = requestToKey(operation, this.addTypename); + var unmatchedVars = []; + var requestVariables = operation.variables || {}; + var mockedResponses = this.mockedResponsesByKey[key]; + var responseIndex = mockedResponses ? + mockedResponses.findIndex(function (res, index) { + var mockedResponseVars = res.request.variables || {}; + if (equality.equal(requestVariables, mockedResponseVars)) { + return true; + } + if (res.variableMatcher && res.variableMatcher(operation.variables)) { + return true; + } + unmatchedVars.push(mockedResponseVars); + return false; + }) + : -1; + var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0; + var delay = (response === null || response === void 0 ? void 0 : response.delay) === Infinity ? 0 : (_a = response === null || response === void 0 ? void 0 : response.delay) !== null && _a !== void 0 ? _a : 0; + var configError; + if (!response) { + configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0 ? + "\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(utilities.stringifyForDisplay(d)); }).join("\n"), "\n") + : "")); + if (this.showWarnings) { + console.warn(configError.message + + "\nThis typically indicates a configuration error in your mocks " + + "setup, usually due to a typo or mismatched variable."); + } + } + else { + if (response.maxUsageCount && response.maxUsageCount > 1) { + response.maxUsageCount--; + } + else { + mockedResponses.splice(responseIndex, 1); + } + var newData = response.newData; + if (newData) { + response.result = newData(operation.variables); + mockedResponses.push(response); + } + if (!response.result && !response.error && response.delay !== Infinity) { + configError = new Error("Mocked response should contain either `result`, `error` or a `delay` of `Infinity`: ".concat(key)); + } + } + return new utilities.Observable(function (observer) { + var timer = setTimeout(function () { + if (configError) { + try { + if (_this.onError(configError, observer) !== false) { + throw configError; + } + } + catch (error) { + observer.error(error); + } + } + else if (response && response.delay !== Infinity) { + if (response.error) { + observer.error(response.error); + } + else { + if (response.result) { + observer.next(typeof response.result === "function" ? + response.result(operation.variables) + : response.result); + } + observer.complete(); + } + } + }, delay); + return function () { + clearTimeout(timer); + }; + }); + }; + MockLink.prototype.normalizeMockedResponse = function (mockedResponse) { + var _a; + var newMockedResponse = utilities.cloneDeep(mockedResponse); + var queryWithoutConnection = utilities.removeConnectionDirectiveFromDocument(newMockedResponse.request.query); + globals.invariant(queryWithoutConnection, 64); + newMockedResponse.request.query = queryWithoutConnection; + var query = utilities.removeClientSetsFromDocument(newMockedResponse.request.query); + if (query) { + newMockedResponse.request.query = query; + } + mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1; + globals.invariant(mockedResponse.maxUsageCount > 0, 65, mockedResponse.maxUsageCount); + this.normalizeVariableMatching(newMockedResponse); + return newMockedResponse; + }; + MockLink.prototype.normalizeVariableMatching = function (mockedResponse) { + var variables = mockedResponse.request.variables; + if (mockedResponse.variableMatcher && variables) { + throw new Error("Mocked response should contain either variableMatcher or request.variables"); + } + if (!mockedResponse.variableMatcher) { + mockedResponse.variableMatcher = function (vars) { + var requestVariables = vars || {}; + var mockedResponseVariables = variables || {}; + return equality.equal(requestVariables, mockedResponseVariables); + }; + } + }; + return MockLink; +}(core.ApolloLink)); +function mockSingleLink() { + var mockedResponses = []; + for (var _i = 0; _i < arguments.length; _i++) { + mockedResponses[_i] = arguments[_i]; + } + var maybeTypename = mockedResponses[mockedResponses.length - 1]; + var mocks = mockedResponses.slice(0, mockedResponses.length - 1); + if (typeof maybeTypename !== "boolean") { + mocks = mockedResponses; + maybeTypename = true; + } + return new MockLink(mocks, maybeTypename); +} + +var MockSubscriptionLink = (function (_super) { + tslib.__extends(MockSubscriptionLink, _super); + function MockSubscriptionLink() { + var _this = _super.call(this) || this; + _this.unsubscribers = []; + _this.setups = []; + _this.observers = []; + return _this; + } + MockSubscriptionLink.prototype.request = function (operation) { + var _this = this; + this.operation = operation; + return new utilities.Observable(function (observer) { + _this.setups.forEach(function (x) { return x(); }); + _this.observers.push(observer); + return function () { + _this.unsubscribers.forEach(function (x) { return x(); }); + }; + }); + }; + MockSubscriptionLink.prototype.simulateResult = function (result, complete) { + var _this = this; + if (complete === void 0) { complete = false; } + setTimeout(function () { + var observers = _this.observers; + if (!observers.length) + throw new Error("subscription torn down"); + observers.forEach(function (observer) { + if (result.result && observer.next) + observer.next(result.result); + if (result.error && observer.error) + observer.error(result.error); + if (complete && observer.complete) + observer.complete(); + }); + }, result.delay || 0); + }; + MockSubscriptionLink.prototype.simulateComplete = function () { + var observers = this.observers; + if (!observers.length) + throw new Error("subscription torn down"); + observers.forEach(function (observer) { + if (observer.complete) + observer.complete(); + }); + }; + MockSubscriptionLink.prototype.onSetup = function (listener) { + this.setups = this.setups.concat([listener]); + }; + MockSubscriptionLink.prototype.onUnsubscribe = function (listener) { + this.unsubscribers = this.unsubscribers.concat([listener]); + }; + return MockSubscriptionLink; +}(core.ApolloLink)); +function mockObservableLink() { + return new MockSubscriptionLink(); +} + +function createMockClient(data, query, variables) { + if (variables === void 0) { variables = {}; } + return new core$1.ApolloClient({ + link: mockSingleLink({ + request: { query: query, variables: variables }, + result: { data: data }, + }).setOnError(function (error) { + throw error; + }), + cache: new cache.InMemoryCache({ addTypename: false }), + }); +} + +function subscribeAndCount(reject, observable, cb) { + var queue = Promise.resolve(); + var handleCount = 0; + var subscription = utilities.asyncMap(observable, function (result) { + return (queue = queue + .then(function () { + return cb(++handleCount, result); + }) + .catch(error)); + }).subscribe({ error: error }); + function error(e) { + subscription.unsubscribe(); + reject(e); + } + return subscription; +} + +function wrap(key) { + return function (message, callback, timeout) { + return (key ? it[key] : it)(message, function () { + var _this = this; + return new Promise(function (resolve, reject) { + return callback.call(_this, resolve, reject); + }); + }, timeout); + }; +} +var wrappedIt = wrap(); +var itAsync = Object.assign(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return wrappedIt.apply(this, args); +}, { + only: wrap("only"), + skip: wrap("skip"), + todo: wrap("todo"), +}); + +function wait(ms) { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 , new Promise(function (resolve) { return setTimeout(resolve, ms); })]; + }); + }); +} +function tick() { + return tslib.__awaiter(this, void 0, void 0, function () { + return tslib.__generator(this, function (_a) { + return [2 , wait(0)]; + }); + }); +} + +function wrapTestFunction(fn, consoleMethodName) { + return function () { + var _this = this; + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var spy = jest.spyOn(console, consoleMethodName); + spy.mockImplementation(function () { }); + return new Promise(function (resolve) { + resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args)); + }).finally(function () { + expect(spy).toMatchSnapshot(); + spy.mockReset(); + }); + }; +} +function withErrorSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "error"); + return it.apply(void 0, args); +} +function withWarningSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "warn"); + return it.apply(void 0, args); +} +function withLogSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "log"); + return it.apply(void 0, args); +} + +exports.MockLink = MockLink; +exports.MockSubscriptionLink = MockSubscriptionLink; +exports.createMockClient = createMockClient; +exports.itAsync = itAsync; +exports.mockObservableLink = mockObservableLink; +exports.mockSingleLink = mockSingleLink; +exports.subscribeAndCount = subscribeAndCount; +exports.tick = tick; +exports.wait = wait; +exports.withErrorSpy = withErrorSpy; +exports.withLogSpy = withLogSpy; +exports.withWarningSpy = withWarningSpy; +//# sourceMappingURL=core.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/index.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/index.d.ts new file mode 100644 index 0000000..a1eca85 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/index.d.ts @@ -0,0 +1,9 @@ +export type { MockedResponse, MockLinkOptions, ResultFunction, } from "./mocking/mockLink.js"; +export { MockLink, mockSingleLink } from "./mocking/mockLink.js"; +export { MockSubscriptionLink, mockObservableLink, } from "./mocking/mockSubscriptionLink.js"; +export { createMockClient } from "./mocking/mockClient.js"; +export { default as subscribeAndCount } from "./subscribeAndCount.js"; +export { itAsync } from "./itAsync.js"; +export { wait, tick } from "./wait.js"; +export * from "./withConsoleSpy.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/index.js b/graphql-subscription/node_modules/@apollo/client/testing/core/index.js new file mode 100644 index 0000000..3ec544c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/index.js @@ -0,0 +1,8 @@ +export { MockLink, mockSingleLink } from "./mocking/mockLink.js"; +export { MockSubscriptionLink, mockObservableLink, } from "./mocking/mockSubscriptionLink.js"; +export { createMockClient } from "./mocking/mockClient.js"; +export { default as subscribeAndCount } from "./subscribeAndCount.js"; +export { itAsync } from "./itAsync.js"; +export { wait, tick } from "./wait.js"; +export * from "./withConsoleSpy.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/index.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/index.js.map new file mode 100644 index 0000000..fba50b9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/core/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACvC,cAAc,qBAAqB,CAAC","sourcesContent":["export type {\n MockedResponse,\n MockLinkOptions,\n ResultFunction,\n} from \"./mocking/mockLink.js\";\nexport { MockLink, mockSingleLink } from \"./mocking/mockLink.js\";\nexport {\n MockSubscriptionLink,\n mockObservableLink,\n} from \"./mocking/mockSubscriptionLink.js\";\nexport { createMockClient } from \"./mocking/mockClient.js\";\nexport { default as subscribeAndCount } from \"./subscribeAndCount.js\";\nexport { itAsync } from \"./itAsync.js\";\nexport { wait, tick } from \"./wait.js\";\nexport * from \"./withConsoleSpy.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.d.ts new file mode 100644 index 0000000..988d330 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.d.ts @@ -0,0 +1,6 @@ +export declare const itAsync: ((this: unknown, message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number | undefined) => void) & { + only: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; + skip: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; + todo: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; +}; +//# sourceMappingURL=itAsync.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js b/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js new file mode 100644 index 0000000..5f16f7e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js @@ -0,0 +1,23 @@ +function wrap(key) { + return function (message, callback, timeout) { + return (key ? it[key] : it)(message, function () { + var _this = this; + return new Promise(function (resolve, reject) { + return callback.call(_this, resolve, reject); + }); + }, timeout); + }; +} +var wrappedIt = wrap(); +export var itAsync = Object.assign(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return wrappedIt.apply(this, args); +}, { + only: wrap("only"), + skip: wrap("skip"), + todo: wrap("todo"), +}); +//# sourceMappingURL=itAsync.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js.map new file mode 100644 index 0000000..3018375 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/itAsync.js.map @@ -0,0 +1 @@ +{"version":3,"file":"itAsync.js","sourceRoot":"","sources":["../../../src/testing/core/itAsync.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,CAAC,GAA8B;IAC1C,OAAO,UACL,OAAe,EACf,QAGQ,EACR,OAAgB;QAEhB,OAAA,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAClB,OAAO,EACP;YAAA,iBAIC;YAHC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;gBACjC,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAI,EAAE,OAAO,EAAE,MAAM,CAAC;YAApC,CAAoC,CACrC,CAAC;QACJ,CAAC,EACD,OAAO,CACR;IARD,CAQC,CAAC;AACN,CAAC;AAED,IAAM,SAAS,GAAG,IAAI,EAAE,CAAC;AAEzB,MAAM,CAAC,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAClC;IAAyB,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IAC5D,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC,EACD;IACE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;CACnB,CACF,CAAC","sourcesContent":["function wrap(key?: \"only\" | \"skip\" | \"todo\") {\n return (\n message: string,\n callback: (\n resolve: (result?: any) => void,\n reject: (reason?: any) => void\n ) => any,\n timeout?: number\n ) =>\n (key ? it[key] : it)(\n message,\n function (this: unknown) {\n return new Promise((resolve, reject) =>\n callback.call(this, resolve, reject)\n );\n },\n timeout\n );\n}\n\nconst wrappedIt = wrap();\n\nexport const itAsync = Object.assign(\n function (this: unknown, ...args: Parameters) {\n return wrappedIt.apply(this, args);\n },\n {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n }\n);\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.d.ts new file mode 100644 index 0000000..3d27d5a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.d.ts @@ -0,0 +1,5 @@ +import type { DocumentNode } from "graphql"; +import { ApolloClient } from "../../../core/index.js"; +import type { NormalizedCacheObject } from "../../../cache/index.js"; +export declare function createMockClient(data: TData, query: DocumentNode, variables?: {}): ApolloClient; +//# sourceMappingURL=mockClient.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js new file mode 100644 index 0000000..7942d3d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js @@ -0,0 +1,16 @@ +import { ApolloClient } from "../../../core/index.js"; +import { InMemoryCache } from "../../../cache/index.js"; +import { mockSingleLink } from "./mockLink.js"; +export function createMockClient(data, query, variables) { + if (variables === void 0) { variables = {}; } + return new ApolloClient({ + link: mockSingleLink({ + request: { query: query, variables: variables }, + result: { data: data }, + }).setOnError(function (error) { + throw error; + }), + cache: new InMemoryCache({ addTypename: false }), + }); +} +//# sourceMappingURL=mockClient.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js.map new file mode 100644 index 0000000..881f044 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockClient.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mockClient.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAC9B,IAAW,EACX,KAAmB,EACnB,SAAc;IAAd,0BAAA,EAAA,cAAc;IAEd,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,cAAc,CAAC;YACnB,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE;YAC7B,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE;SACjB,CAAC,CAAC,UAAU,CAAC,UAAC,KAAK;YAClB,MAAM,KAAK,CAAC;QACd,CAAC,CAAC;QACF,KAAK,EAAE,IAAI,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\n\nimport { ApolloClient } from \"../../../core/index.js\";\nimport type { NormalizedCacheObject } from \"../../../cache/index.js\";\nimport { InMemoryCache } from \"../../../cache/index.js\";\nimport { mockSingleLink } from \"./mockLink.js\";\n\nexport function createMockClient(\n data: TData,\n query: DocumentNode,\n variables = {}\n): ApolloClient {\n return new ApolloClient({\n link: mockSingleLink({\n request: { query, variables },\n result: { data },\n }).setOnError((error) => {\n throw error;\n }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.d.ts new file mode 100644 index 0000000..bac7d77 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.d.ts @@ -0,0 +1,24 @@ +import "whatwg-fetch"; +export interface MockedIResponse { + ok: boolean; + status: number; + statusText?: string; + json(): Promise; +} +export interface MockedFetchResponse { + url: string; + opts: RequestInit; + result: MockedIResponse; + delay?: number; +} +export declare function createMockedIResponse(result: Object, options?: any): MockedIResponse; +export declare class MockFetch { + private mockedResponsesByKey; + constructor(...mockedResponses: MockedFetchResponse[]); + addMockedResponse(mockedResponse: MockedFetchResponse): void; + fetch(url: string, opts: RequestInit): Promise; + fetchParamsToKey(url: string, opts: RequestInit): string; + getFetch(): (url: string, opts: RequestInit) => Promise; +} +export declare function createMockFetch(...mockedResponses: MockedFetchResponse[]): (url: string, opts: RequestInit) => Promise; +//# sourceMappingURL=mockFetch.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js new file mode 100644 index 0000000..d2c29cf --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js @@ -0,0 +1,87 @@ +import { __spreadArray } from "tslib"; +import "whatwg-fetch"; +export function createMockedIResponse(result, options) { + var status = (options && options.status) || 200; + var statusText = (options && options.statusText) || undefined; + return { + ok: status === 200, + status: status, + statusText: statusText, + json: function () { + return Promise.resolve(result); + }, + }; +} +var MockFetch = /** @class */ (function () { + function MockFetch() { + var mockedResponses = []; + for (var _i = 0; _i < arguments.length; _i++) { + mockedResponses[_i] = arguments[_i]; + } + var _this = this; + this.mockedResponsesByKey = {}; + mockedResponses.forEach(function (mockedResponse) { + _this.addMockedResponse(mockedResponse); + }); + } + MockFetch.prototype.addMockedResponse = function (mockedResponse) { + var key = this.fetchParamsToKey(mockedResponse.url, mockedResponse.opts); + var mockedResponses = this.mockedResponsesByKey[key]; + if (!mockedResponses) { + mockedResponses = []; + this.mockedResponsesByKey[key] = mockedResponses; + } + mockedResponses.push(mockedResponse); + }; + MockFetch.prototype.fetch = function (url, opts) { + var key = this.fetchParamsToKey(url, opts); + var responses = this.mockedResponsesByKey[key]; + if (!responses || responses.length === 0) { + throw new Error("No more mocked fetch responses for the params ".concat(url, " and ").concat(opts)); + } + var _a = responses.shift(), result = _a.result, delay = _a.delay; + if (!result) { + throw new Error("Mocked fetch response should contain a result."); + } + return new Promise(function (resolve) { + setTimeout(function () { + resolve(result); + }, delay ? delay : 0); + }); + }; + MockFetch.prototype.fetchParamsToKey = function (url, opts) { + return JSON.stringify({ + url: url, + opts: sortByKey(opts), + }); + }; + // Returns a "fetch" function equivalent that mocks the given responses. + // The function by returned by this should be tacked onto the global scope + // in order to test functions that use "fetch". + MockFetch.prototype.getFetch = function () { + return this.fetch.bind(this); + }; + return MockFetch; +}()); +export { MockFetch }; +function sortByKey(obj) { + return Object.keys(obj) + .sort() + .reduce(function (ret, key) { + var _a; + return Object.assign((_a = {}, + _a[key] = (Object.prototype.toString.call(obj[key]).slice(8, -1) === + "Object") ? + sortByKey(obj[key]) + : obj[key], + _a), ret); + }, {}); +} +export function createMockFetch() { + var mockedResponses = []; + for (var _i = 0; _i < arguments.length; _i++) { + mockedResponses[_i] = arguments[_i]; + } + return new (MockFetch.bind.apply(MockFetch, __spreadArray([void 0], mockedResponses, false)))().getFetch(); +} +//# sourceMappingURL=mockFetch.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js.map new file mode 100644 index 0000000..5ab78d2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockFetch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mockFetch.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockFetch.ts"],"names":[],"mappings":";AAAA,OAAO,cAAc,CAAC;AAmBtB,MAAM,UAAU,qBAAqB,CACnC,MAA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,CAAC,CAAC;gBACrD,QAAQ,CACT,CAAC,CAAC;gBACD,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;iBAEd,GAAG,CACJ;IAXD,CAWC,EACH,EAAE,CACH,CAAC;AACN,CAAC;AAED,MAAM,UAAU,eAAe;IAAC,yBAAyC;SAAzC,UAAyC,EAAzC,qBAAyC,EAAzC,IAAyC;QAAzC,oCAAyC;;IACvE,OAAO,KAAI,SAAS,YAAT,SAAS,0BAAI,eAAe,aAAE,QAAQ,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import \"whatwg-fetch\";\n\n// This is an implementation of a mocked window.fetch implementation similar in\n// structure to the MockedNetworkInterface.\n\nexport interface MockedIResponse {\n ok: boolean;\n status: number;\n statusText?: string;\n json(): Promise;\n}\n\nexport interface MockedFetchResponse {\n url: string;\n opts: RequestInit;\n result: MockedIResponse;\n delay?: number;\n}\n\nexport function createMockedIResponse(\n result: Object,\n options?: any\n): MockedIResponse {\n const status = (options && options.status) || 200;\n const statusText = (options && options.statusText) || undefined;\n\n return {\n ok: status === 200,\n status,\n statusText,\n json() {\n return Promise.resolve(result);\n },\n };\n}\n\nexport class MockFetch {\n private mockedResponsesByKey: { [key: string]: MockedFetchResponse[] };\n\n constructor(...mockedResponses: MockedFetchResponse[]) {\n this.mockedResponsesByKey = {};\n\n mockedResponses.forEach((mockedResponse) => {\n this.addMockedResponse(mockedResponse);\n });\n }\n\n public addMockedResponse(mockedResponse: MockedFetchResponse) {\n const key = this.fetchParamsToKey(mockedResponse.url, mockedResponse.opts);\n let mockedResponses = this.mockedResponsesByKey[key];\n\n if (!mockedResponses) {\n mockedResponses = [];\n this.mockedResponsesByKey[key] = mockedResponses;\n }\n\n mockedResponses.push(mockedResponse);\n }\n\n public fetch(url: string, opts: RequestInit) {\n const key = this.fetchParamsToKey(url, opts);\n const responses = this.mockedResponsesByKey[key];\n if (!responses || responses.length === 0) {\n throw new Error(\n `No more mocked fetch responses for the params ${url} and ${opts}`\n );\n }\n\n const { result, delay } = responses.shift()!;\n\n if (!result) {\n throw new Error(`Mocked fetch response should contain a result.`);\n }\n\n return new Promise((resolve) => {\n setTimeout(\n () => {\n resolve(result);\n },\n delay ? delay : 0\n );\n });\n }\n\n public fetchParamsToKey(url: string, opts: RequestInit): string {\n return JSON.stringify({\n url,\n opts: sortByKey(opts),\n });\n }\n\n // Returns a \"fetch\" function equivalent that mocks the given responses.\n // The function by returned by this should be tacked onto the global scope\n // in order to test functions that use \"fetch\".\n public getFetch() {\n return this.fetch.bind(this);\n }\n}\n\nfunction sortByKey(obj: any): Object {\n return Object.keys(obj)\n .sort()\n .reduce(\n (ret: any, key: string): Object =>\n Object.assign(\n {\n [key]:\n (\n Object.prototype.toString.call(obj[key]).slice(8, -1) ===\n \"Object\"\n ) ?\n sortByKey(obj[key])\n : obj[key],\n },\n ret\n ),\n {}\n );\n}\n\nexport function createMockFetch(...mockedResponses: MockedFetchResponse[]) {\n return new MockFetch(...mockedResponses).getFetch();\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.d.ts new file mode 100644 index 0000000..1af49cb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.d.ts @@ -0,0 +1,33 @@ +import type { Operation, GraphQLRequest, FetchResult } from "../../../link/core/index.js"; +import { ApolloLink } from "../../../link/core/index.js"; +import { Observable } from "../../../utilities/index.js"; +export type ResultFunction> = (variables: V) => T; +export type VariableMatcher> = (variables: V) => boolean; +export interface MockedResponse, TVariables = Record> { + request: GraphQLRequest; + maxUsageCount?: number; + result?: FetchResult | ResultFunction, TVariables>; + error?: Error; + delay?: number; + variableMatcher?: VariableMatcher; + newData?: ResultFunction, TVariables>; +} +export interface MockLinkOptions { + showWarnings?: boolean; +} +export declare class MockLink extends ApolloLink { + operation: Operation; + addTypename: Boolean; + showWarnings: boolean; + private mockedResponsesByKey; + constructor(mockedResponses: ReadonlyArray>, addTypename?: Boolean, options?: MockLinkOptions); + addMockedResponse(mockedResponse: MockedResponse): void; + request(operation: Operation): Observable | null; + private normalizeMockedResponse; + private normalizeVariableMatching; +} +export interface MockApolloLink extends ApolloLink { + operation?: Operation; +} +export declare function mockSingleLink(...mockedResponses: Array): MockApolloLink; +//# sourceMappingURL=mockLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js new file mode 100644 index 0000000..093c621 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js @@ -0,0 +1,180 @@ +import { __extends } from "tslib"; +import { invariant } from "../../../utilities/globals/index.js"; +import { equal } from "@wry/equality"; +import { ApolloLink } from "../../../link/core/index.js"; +import { Observable, addTypenameToDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, cloneDeep, stringifyForDisplay, print, } from "../../../utilities/index.js"; +function requestToKey(request, addTypename) { + var queryString = request.query && + print(addTypename ? addTypenameToDocument(request.query) : request.query); + var requestKey = { query: queryString }; + return JSON.stringify(requestKey); +} +var MockLink = /** @class */ (function (_super) { + __extends(MockLink, _super); + function MockLink(mockedResponses, addTypename, options) { + if (addTypename === void 0) { addTypename = true; } + if (options === void 0) { options = Object.create(null); } + var _a; + var _this = _super.call(this) || this; + _this.addTypename = true; + _this.showWarnings = true; + _this.mockedResponsesByKey = {}; + _this.addTypename = addTypename; + _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true; + if (mockedResponses) { + mockedResponses.forEach(function (mockedResponse) { + _this.addMockedResponse(mockedResponse); + }); + } + return _this; + } + MockLink.prototype.addMockedResponse = function (mockedResponse) { + var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse); + var key = requestToKey(normalizedMockedResponse.request, this.addTypename); + var mockedResponses = this.mockedResponsesByKey[key]; + if (!mockedResponses) { + mockedResponses = []; + this.mockedResponsesByKey[key] = mockedResponses; + } + mockedResponses.push(normalizedMockedResponse); + }; + MockLink.prototype.request = function (operation) { + var _this = this; + var _a; + this.operation = operation; + var key = requestToKey(operation, this.addTypename); + var unmatchedVars = []; + var requestVariables = operation.variables || {}; + var mockedResponses = this.mockedResponsesByKey[key]; + var responseIndex = mockedResponses ? + mockedResponses.findIndex(function (res, index) { + var mockedResponseVars = res.request.variables || {}; + if (equal(requestVariables, mockedResponseVars)) { + return true; + } + if (res.variableMatcher && res.variableMatcher(operation.variables)) { + return true; + } + unmatchedVars.push(mockedResponseVars); + return false; + }) + : -1; + var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0; + // There have been platform- and engine-dependent differences with + // setInterval(fn, Infinity), so we pass 0 instead (but detect + // Infinity where we call observer.error or observer.next to pend + // indefinitely in those cases.) + var delay = (response === null || response === void 0 ? void 0 : response.delay) === Infinity ? 0 : (_a = response === null || response === void 0 ? void 0 : response.delay) !== null && _a !== void 0 ? _a : 0; + var configError; + if (!response) { + configError = new Error("No more mocked responses for the query: ".concat(print(operation.query), "\nExpected variables: ").concat(stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0 ? + "\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(stringifyForDisplay(d)); }).join("\n"), "\n") + : "")); + if (this.showWarnings) { + console.warn(configError.message + + "\nThis typically indicates a configuration error in your mocks " + + "setup, usually due to a typo or mismatched variable."); + } + } + else { + if (response.maxUsageCount && response.maxUsageCount > 1) { + response.maxUsageCount--; + } + else { + mockedResponses.splice(responseIndex, 1); + } + var newData = response.newData; + if (newData) { + response.result = newData(operation.variables); + mockedResponses.push(response); + } + if (!response.result && !response.error && response.delay !== Infinity) { + configError = new Error("Mocked response should contain either `result`, `error` or a `delay` of `Infinity`: ".concat(key)); + } + } + return new Observable(function (observer) { + var timer = setTimeout(function () { + if (configError) { + try { + // The onError function can return false to indicate that + // configError need not be passed to observer.error. For + // example, the default implementation of onError calls + // observer.error(configError) and then returns false to + // prevent this extra (harmless) observer.error call. + if (_this.onError(configError, observer) !== false) { + throw configError; + } + } + catch (error) { + observer.error(error); + } + } + else if (response && response.delay !== Infinity) { + if (response.error) { + observer.error(response.error); + } + else { + if (response.result) { + observer.next(typeof response.result === "function" ? + response.result(operation.variables) + : response.result); + } + observer.complete(); + } + } + }, delay); + return function () { + clearTimeout(timer); + }; + }); + }; + MockLink.prototype.normalizeMockedResponse = function (mockedResponse) { + var _a; + var newMockedResponse = cloneDeep(mockedResponse); + var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query); + invariant(queryWithoutConnection, 64); + newMockedResponse.request.query = queryWithoutConnection; + var query = removeClientSetsFromDocument(newMockedResponse.request.query); + if (query) { + newMockedResponse.request.query = query; + } + mockedResponse.maxUsageCount = (_a = mockedResponse.maxUsageCount) !== null && _a !== void 0 ? _a : 1; + invariant(mockedResponse.maxUsageCount > 0, 65, mockedResponse.maxUsageCount); + this.normalizeVariableMatching(newMockedResponse); + return newMockedResponse; + }; + MockLink.prototype.normalizeVariableMatching = function (mockedResponse) { + var variables = mockedResponse.request.variables; + if (mockedResponse.variableMatcher && variables) { + throw new Error("Mocked response should contain either variableMatcher or request.variables"); + } + if (!mockedResponse.variableMatcher) { + mockedResponse.variableMatcher = function (vars) { + var requestVariables = vars || {}; + var mockedResponseVariables = variables || {}; + return equal(requestVariables, mockedResponseVariables); + }; + } + }; + return MockLink; +}(ApolloLink)); +export { MockLink }; +// Pass in multiple mocked responses, so that you can test flows that end up +// making multiple queries to the server. +// NOTE: The last arg can optionally be an `addTypename` arg. +export function mockSingleLink() { + var mockedResponses = []; + for (var _i = 0; _i < arguments.length; _i++) { + mockedResponses[_i] = arguments[_i]; + } + // To pull off the potential typename. If this isn't a boolean, we'll just + // set it true later. + var maybeTypename = mockedResponses[mockedResponses.length - 1]; + var mocks = mockedResponses.slice(0, mockedResponses.length - 1); + if (typeof maybeTypename !== "boolean") { + mocks = mockedResponses; + maybeTypename = true; + } + return new MockLink(mocks, maybeTypename); +} +//# sourceMappingURL=mockLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js.map new file mode 100644 index 0000000..1b5ad54 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockLink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mockLink.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockLink.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAOtC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,qCAAqC,EACrC,SAAS,EACT,mBAAmB,EACnB,KAAK,GACN,MAAM,6BAA6B,CAAC;AAyBrC,SAAS,YAAY,CAAC,OAAuB,EAAE,WAAoB;IACjE,IAAM,WAAW,GACf,OAAO,CAAC,KAAK;QACb,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5E,IAAM,UAAU,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC;AAED;IAA8B,4BAAU;IAMtC,kBACE,eAAwD,EACxD,WAA2B,EAC3B,OAA8C;QAD9C,4BAAA,EAAA,kBAA2B;QAC3B,wBAAA,EAAA,UAA2B,MAAM,CAAC,MAAM,CA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AG,CAAC,CAAC,CAAC;IAChE,IAAI,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEjE,IAAI,OAAO,aAAa,KAAK,SAAS,EAAE,CAAC;QACvC,KAAK,GAAG,eAAe,CAAC;QACxB,aAAa,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { invariant } from \"../../../utilities/globals/index.js\";\n\nimport { equal } from \"@wry/equality\";\n\nimport type {\n Operation,\n GraphQLRequest,\n FetchResult,\n} from \"../../../link/core/index.js\";\nimport { ApolloLink } from \"../../../link/core/index.js\";\n\nimport {\n Observable,\n addTypenameToDocument,\n removeClientSetsFromDocument,\n removeConnectionDirectiveFromDocument,\n cloneDeep,\n stringifyForDisplay,\n print,\n} from \"../../../utilities/index.js\";\n\nexport type ResultFunction> = (variables: V) => T;\n\nexport type VariableMatcher> = (\n variables: V\n) => boolean;\n\nexport interface MockedResponse<\n TData = Record,\n TVariables = Record,\n> {\n request: GraphQLRequest;\n maxUsageCount?: number;\n result?: FetchResult | ResultFunction, TVariables>;\n error?: Error;\n delay?: number;\n variableMatcher?: VariableMatcher;\n newData?: ResultFunction, TVariables>;\n}\n\nexport interface MockLinkOptions {\n showWarnings?: boolean;\n}\n\nfunction requestToKey(request: GraphQLRequest, addTypename: Boolean): string {\n const queryString =\n request.query &&\n print(addTypename ? addTypenameToDocument(request.query) : request.query);\n const requestKey = { query: queryString };\n return JSON.stringify(requestKey);\n}\n\nexport class MockLink extends ApolloLink {\n public operation!: Operation;\n public addTypename: Boolean = true;\n public showWarnings: boolean = true;\n private mockedResponsesByKey: { [key: string]: MockedResponse[] } = {};\n\n constructor(\n mockedResponses: ReadonlyArray>,\n addTypename: Boolean = true,\n options: MockLinkOptions = Object.create(null)\n ) {\n super();\n this.addTypename = addTypename;\n this.showWarnings = options.showWarnings ?? true;\n\n if (mockedResponses) {\n mockedResponses.forEach((mockedResponse) => {\n this.addMockedResponse(mockedResponse);\n });\n }\n }\n\n public addMockedResponse(mockedResponse: MockedResponse) {\n const normalizedMockedResponse =\n this.normalizeMockedResponse(mockedResponse);\n const key = requestToKey(\n normalizedMockedResponse.request,\n this.addTypename\n );\n let mockedResponses = this.mockedResponsesByKey[key];\n if (!mockedResponses) {\n mockedResponses = [];\n this.mockedResponsesByKey[key] = mockedResponses;\n }\n mockedResponses.push(normalizedMockedResponse);\n }\n\n public request(operation: Operation): Observable | null {\n this.operation = operation;\n const key = requestToKey(operation, this.addTypename);\n const unmatchedVars: Array> = [];\n const requestVariables = operation.variables || {};\n const mockedResponses = this.mockedResponsesByKey[key];\n const responseIndex =\n mockedResponses ?\n mockedResponses.findIndex((res, index) => {\n const mockedResponseVars = res.request.variables || {};\n if (equal(requestVariables, mockedResponseVars)) {\n return true;\n }\n if (res.variableMatcher && res.variableMatcher(operation.variables)) {\n return true;\n }\n unmatchedVars.push(mockedResponseVars);\n return false;\n })\n : -1;\n\n const response =\n responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;\n\n // There have been platform- and engine-dependent differences with\n // setInterval(fn, Infinity), so we pass 0 instead (but detect\n // Infinity where we call observer.error or observer.next to pend\n // indefinitely in those cases.)\n const delay = response?.delay === Infinity ? 0 : response?.delay ?? 0;\n\n let configError: Error;\n\n if (!response) {\n configError = new Error(\n `No more mocked responses for the query: ${print(operation.query)}\nExpected variables: ${stringifyForDisplay(operation.variables)}\n${\n unmatchedVars.length > 0 ?\n `\nFailed to match ${unmatchedVars.length} mock${\n unmatchedVars.length === 1 ? \"\" : \"s\"\n } for this query. The mocked response had the following variables:\n${unmatchedVars.map((d) => ` ${stringifyForDisplay(d)}`).join(\"\\n\")}\n`\n : \"\"\n}`\n );\n\n if (this.showWarnings) {\n console.warn(\n configError.message +\n \"\\nThis typically indicates a configuration error in your mocks \" +\n \"setup, usually due to a typo or mismatched variable.\"\n );\n }\n } else {\n if (response.maxUsageCount && response.maxUsageCount > 1) {\n response.maxUsageCount--;\n } else {\n mockedResponses.splice(responseIndex, 1);\n }\n const { newData } = response;\n if (newData) {\n response.result = newData(operation.variables);\n mockedResponses.push(response);\n }\n\n if (!response.result && !response.error && response.delay !== Infinity) {\n configError = new Error(\n `Mocked response should contain either \\`result\\`, \\`error\\` or a \\`delay\\` of \\`Infinity\\`: ${key}`\n );\n }\n }\n\n return new Observable((observer) => {\n const timer = setTimeout(() => {\n if (configError) {\n try {\n // The onError function can return false to indicate that\n // configError need not be passed to observer.error. For\n // example, the default implementation of onError calls\n // observer.error(configError) and then returns false to\n // prevent this extra (harmless) observer.error call.\n if (this.onError(configError, observer) !== false) {\n throw configError;\n }\n } catch (error) {\n observer.error(error);\n }\n } else if (response && response.delay !== Infinity) {\n if (response.error) {\n observer.error(response.error);\n } else {\n if (response.result) {\n observer.next(\n typeof response.result === \"function\" ?\n response.result(operation.variables)\n : response.result\n );\n }\n observer.complete();\n }\n }\n }, delay);\n\n return () => {\n clearTimeout(timer);\n };\n });\n }\n\n private normalizeMockedResponse(\n mockedResponse: MockedResponse\n ): MockedResponse {\n const newMockedResponse = cloneDeep(mockedResponse);\n const queryWithoutConnection = removeConnectionDirectiveFromDocument(\n newMockedResponse.request.query\n );\n invariant(queryWithoutConnection, \"query is required\");\n newMockedResponse.request.query = queryWithoutConnection!;\n const query = removeClientSetsFromDocument(newMockedResponse.request.query);\n if (query) {\n newMockedResponse.request.query = query;\n }\n\n mockedResponse.maxUsageCount = mockedResponse.maxUsageCount ?? 1;\n invariant(\n mockedResponse.maxUsageCount > 0,\n `Mock response maxUsageCount must be greater than 0, %s given`,\n mockedResponse.maxUsageCount\n );\n\n this.normalizeVariableMatching(newMockedResponse);\n return newMockedResponse;\n }\n\n private normalizeVariableMatching(mockedResponse: MockedResponse) {\n const variables = mockedResponse.request.variables;\n if (mockedResponse.variableMatcher && variables) {\n throw new Error(\n \"Mocked response should contain either variableMatcher or request.variables\"\n );\n }\n\n if (!mockedResponse.variableMatcher) {\n mockedResponse.variableMatcher = (vars) => {\n const requestVariables = vars || {};\n const mockedResponseVariables = variables || {};\n return equal(requestVariables, mockedResponseVariables);\n };\n }\n }\n}\n\nexport interface MockApolloLink extends ApolloLink {\n operation?: Operation;\n}\n\n// Pass in multiple mocked responses, so that you can test flows that end up\n// making multiple queries to the server.\n// NOTE: The last arg can optionally be an `addTypename` arg.\nexport function mockSingleLink(...mockedResponses: Array): MockApolloLink {\n // To pull off the potential typename. If this isn't a boolean, we'll just\n // set it true later.\n let maybeTypename = mockedResponses[mockedResponses.length - 1];\n let mocks = mockedResponses.slice(0, mockedResponses.length - 1);\n\n if (typeof maybeTypename !== \"boolean\") {\n mocks = mockedResponses;\n maybeTypename = true;\n }\n\n return new MockLink(mocks, maybeTypename);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.d.ts new file mode 100644 index 0000000..387544d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.d.ts @@ -0,0 +1,5 @@ +import { QueryManager } from "../../../core/QueryManager.js"; +import type { MockedResponse } from "./mockLink.js"; +declare const _default: (...mockedResponses: MockedResponse[]) => QueryManager; +export default _default; +//# sourceMappingURL=mockQueryManager.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js new file mode 100644 index 0000000..223b831 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js @@ -0,0 +1,16 @@ +import { QueryManager } from "../../../core/QueryManager.js"; +import { mockSingleLink } from "./mockLink.js"; +import { InMemoryCache } from "../../../cache/index.js"; +// Helper method for the tests that construct a query manager out of a +// a list of mocked responses for a mocked network interface. +export default (function() { + var mockedResponses = []; + for (var _i = 0; _i < arguments.length; _i++) { + mockedResponses[_i] = arguments[_i]; + } + return new QueryManager({ + link: mockSingleLink.apply(void 0, mockedResponses), + cache: new InMemoryCache({ addTypename: false }), + }); +}); +//# sourceMappingURL=mockQueryManager.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js.map new file mode 100644 index 0000000..8c71fe8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockQueryManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mockQueryManager.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockQueryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,sEAAsE;AACtE,6DAA6D;AAC7D,gBAAe;IAAC,yBAAoC;SAApC,UAAoC,EAApC,qBAAoC,EAApC,IAAoC;QAApC,oCAAoC;;IAClD,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,cAAc,eAAI,eAAe,CAAC;QACxC,KAAK,EAAE,IAAI,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC,EAAC","sourcesContent":["import { QueryManager } from \"../../../core/QueryManager.js\";\nimport type { MockedResponse } from \"./mockLink.js\";\nimport { mockSingleLink } from \"./mockLink.js\";\nimport { InMemoryCache } from \"../../../cache/index.js\";\n\n// Helper method for the tests that construct a query manager out of a\n// a list of mocked responses for a mocked network interface.\nexport default (...mockedResponses: MockedResponse[]) => {\n return new QueryManager({\n link: mockSingleLink(...mockedResponses),\n cache: new InMemoryCache({ addTypename: false }),\n });\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.d.ts new file mode 100644 index 0000000..6b0bc4b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.d.ts @@ -0,0 +1,25 @@ +import { Observable } from "../../../utilities/index.js"; +import type { FetchResult, Operation } from "../../../link/core/index.js"; +import { ApolloLink } from "../../../link/core/index.js"; +export interface MockedSubscription { + request: Operation; +} +export interface MockedSubscriptionResult { + result?: FetchResult; + error?: Error; + delay?: number; +} +export declare class MockSubscriptionLink extends ApolloLink { + unsubscribers: any[]; + setups: any[]; + operation?: Operation; + private observers; + constructor(); + request(operation: Operation): Observable; + simulateResult(result: MockedSubscriptionResult, complete?: boolean): void; + simulateComplete(): void; + onSetup(listener: any): void; + onUnsubscribe(listener: any): void; +} +export declare function mockObservableLink(): MockSubscriptionLink; +//# sourceMappingURL=mockSubscriptionLink.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js new file mode 100644 index 0000000..0f428b1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js @@ -0,0 +1,62 @@ +import { __extends } from "tslib"; +import { Observable } from "../../../utilities/index.js"; +import { ApolloLink } from "../../../link/core/index.js"; +var MockSubscriptionLink = /** @class */ (function (_super) { + __extends(MockSubscriptionLink, _super); + function MockSubscriptionLink() { + var _this = _super.call(this) || this; + _this.unsubscribers = []; + _this.setups = []; + _this.observers = []; + return _this; + } + MockSubscriptionLink.prototype.request = function (operation) { + var _this = this; + this.operation = operation; + return new Observable(function (observer) { + _this.setups.forEach(function (x) { return x(); }); + _this.observers.push(observer); + return function () { + _this.unsubscribers.forEach(function (x) { return x(); }); + }; + }); + }; + MockSubscriptionLink.prototype.simulateResult = function (result, complete) { + var _this = this; + if (complete === void 0) { complete = false; } + setTimeout(function () { + var observers = _this.observers; + if (!observers.length) + throw new Error("subscription torn down"); + observers.forEach(function (observer) { + if (result.result && observer.next) + observer.next(result.result); + if (result.error && observer.error) + observer.error(result.error); + if (complete && observer.complete) + observer.complete(); + }); + }, result.delay || 0); + }; + MockSubscriptionLink.prototype.simulateComplete = function () { + var observers = this.observers; + if (!observers.length) + throw new Error("subscription torn down"); + observers.forEach(function (observer) { + if (observer.complete) + observer.complete(); + }); + }; + MockSubscriptionLink.prototype.onSetup = function (listener) { + this.setups = this.setups.concat([listener]); + }; + MockSubscriptionLink.prototype.onUnsubscribe = function (listener) { + this.unsubscribers = this.unsubscribers.concat([listener]); + }; + return MockSubscriptionLink; +}(ApolloLink)); +export { MockSubscriptionLink }; +export function mockObservableLink() { + return new MockSubscriptionLink(); +} +//# sourceMappingURL=mockSubscriptionLink.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js.map new file mode 100644 index 0000000..5ed40b1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockSubscriptionLink.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mockSubscriptionLink.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockSubscriptionLink.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAYzD;IAA0C,wCAAU;IAOlD;QACE,YAAA,MAAK,WAAE,SAAC;QAPH,mBAAa,GAAU,EAAE,CAAC;QAC1B,YAAM,GAAU,EAAE,CAAC;QAGlB,eAAS,GAAU,EAAE,CAAC;;IAI9B,CAAC;IAEM,sCAAO,GAAd,UAAe,SAAoB;QAAnC,iBASC;Q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AAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACjE,SAAS,CAAC,OAAO,CAAC,UAAC,QAAQ;YACzB,IAAI,QAAQ,CAAC,QAAQ;gBAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,sCAAO,GAAd,UAAe,QAAa;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEM,4CAAa,GAApB,UAAqB,QAAa;QAChC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7D,CAAC;IACH,2BAAC;AAAD,CAAC,AAjDD,CAA0C,UAAU,GAiDnD;;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import { Observable } from \"../../../utilities/index.js\";\nimport type { FetchResult, Operation } from \"../../../link/core/index.js\";\nimport { ApolloLink } from \"../../../link/core/index.js\";\n\nexport interface MockedSubscription {\n request: Operation;\n}\n\nexport interface MockedSubscriptionResult {\n result?: FetchResult;\n error?: Error;\n delay?: number;\n}\n\nexport class MockSubscriptionLink extends ApolloLink {\n public unsubscribers: any[] = [];\n public setups: any[] = [];\n public operation?: Operation;\n\n private observers: any[] = [];\n\n constructor() {\n super();\n }\n\n public request(operation: Operation) {\n this.operation = operation;\n return new Observable((observer) => {\n this.setups.forEach((x) => x());\n this.observers.push(observer);\n return () => {\n this.unsubscribers.forEach((x) => x());\n };\n });\n }\n\n public simulateResult(result: MockedSubscriptionResult, complete = false) {\n setTimeout(() => {\n const { observers } = this;\n if (!observers.length) throw new Error(\"subscription torn down\");\n observers.forEach((observer) => {\n if (result.result && observer.next) observer.next(result.result);\n if (result.error && observer.error) observer.error(result.error);\n if (complete && observer.complete) observer.complete();\n });\n }, result.delay || 0);\n }\n\n public simulateComplete() {\n const { observers } = this;\n if (!observers.length) throw new Error(\"subscription torn down\");\n observers.forEach((observer) => {\n if (observer.complete) observer.complete();\n });\n }\n\n public onSetup(listener: any): void {\n this.setups = this.setups.concat([listener]);\n }\n\n public onUnsubscribe(listener: any): void {\n this.unsubscribers = this.unsubscribers.concat([listener]);\n }\n}\n\nexport function mockObservableLink(): MockSubscriptionLink {\n return new MockSubscriptionLink();\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.d.ts new file mode 100644 index 0000000..3b35957 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.d.ts @@ -0,0 +1,5 @@ +import type { MockedResponse } from "./mockLink.js"; +import type { ObservableQuery } from "../../../core/index.js"; +declare const _default: (...mockedResponses: MockedResponse[]) => ObservableQuery; +export default _default; +//# sourceMappingURL=mockWatchQuery.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js new file mode 100644 index 0000000..7286ef4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js @@ -0,0 +1,15 @@ +import mockQueryManager from "./mockQueryManager.js"; +export default (function() { + var mockedResponses = []; + for (var _i = 0; _i < arguments.length; _i++) { + mockedResponses[_i] = arguments[_i]; + } + var queryManager = mockQueryManager.apply(void 0, mockedResponses); + var firstRequest = mockedResponses[0].request; + return queryManager.watchQuery({ + query: firstRequest.query, + variables: firstRequest.variables, + notifyOnNetworkStatusChange: false, // XXX might not always be the right option. Set for legacy reasons. + }); +}); +//# sourceMappingURL=mockWatchQuery.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js.map new file mode 100644 index 0000000..78cc9bf --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/mocking/mockWatchQuery.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mockWatchQuery.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockWatchQuery.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAGrD,gBAAe;IAAC,yBAAoC;SAApC,UAAoC,EAApC,qBAAoC,EAApC,IAAoC;QAApC,oCAAoC;;IAClD,IAAM,YAAY,GAAG,gBAAgB,eAAI,eAAe,CAAC,CAAC;IAC1D,IAAM,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChD,OAAO,YAAY,CAAC,UAAU,CAAC;QAC7B,KAAK,EAAE,YAAY,CAAC,KAAM;QAC1B,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,2BAA2B,EAAE,KAAK,EAAE,oEAAoE;KACzG,CAAC,CAAC;AACL,CAAC,EAAC","sourcesContent":["import type { MockedResponse } from \"./mockLink.js\";\nimport mockQueryManager from \"./mockQueryManager.js\";\nimport type { ObservableQuery } from \"../../../core/index.js\";\n\nexport default (...mockedResponses: MockedResponse[]): ObservableQuery => {\n const queryManager = mockQueryManager(...mockedResponses);\n const firstRequest = mockedResponses[0].request;\n return queryManager.watchQuery({\n query: firstRequest.query!,\n variables: firstRequest.variables,\n notifyOnNetworkStatusChange: false, // XXX might not always be the right option. Set for legacy reasons.\n });\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.d.ts new file mode 100644 index 0000000..105d4fa --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.d.ts @@ -0,0 +1,29 @@ +import type { ObservableQuery, ApolloQueryResult } from "../../core/index.js"; +import type { ObservableSubscription } from "../../utilities/index.js"; +export interface Options { + /** + * The ObservableQuery to subscribe to. + */ + observable: ObservableQuery; + /** + * Should we resolve after seeing all our callbacks? [default: true] + * (use this if you are racing the promise against another) + */ + shouldResolve?: boolean; + /** + * How long to wait after seeing desired callbacks before resolving? + * [default: -1 => don't wait] + */ + wait?: number; + /** + * An expected set of errors. + */ + errorCallbacks?: ((error: Error) => any)[]; +} +export type ResultCallback = (result: ApolloQueryResult) => any; +export declare function observableToPromiseAndSubscription({ observable, shouldResolve, wait, errorCallbacks }: Options, ...cbs: ResultCallback[]): { + promise: Promise; + subscription: ObservableSubscription; +}; +export default function (options: Options, ...cbs: ResultCallback[]): Promise; +//# sourceMappingURL=observableToPromise.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js b/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js new file mode 100644 index 0000000..4f0681d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js @@ -0,0 +1,74 @@ +import { __spreadArray } from "tslib"; +// Take an observable and N callbacks, and observe the observable, +// ensuring it is called exactly N times, resolving once it has done so. +// Optionally takes a timeout, which it will wait X ms after the Nth callback +// to ensure it is not called again. +export function observableToPromiseAndSubscription(_a) { + var observable = _a.observable, _b = _a.shouldResolve, shouldResolve = _b === void 0 ? true : _b, _c = _a.wait, wait = _c === void 0 ? -1 : _c, _d = _a.errorCallbacks, errorCallbacks = _d === void 0 ? [] : _d; + var cbs = []; + for (var _i = 1; _i < arguments.length; _i++) { + cbs[_i - 1] = arguments[_i]; + } + var subscription = null; + var promise = new Promise(function (resolve, reject) { + var errorIndex = 0; + var cbIndex = 0; + var results = []; + var tryToResolve = function () { + if (!shouldResolve) { + return; + } + var done = function () { + subscription.unsubscribe(); + // XXX: we could pass a few other things out here? + resolve(results); + }; + if (cbIndex === cbs.length && errorIndex === errorCallbacks.length) { + if (wait === -1) { + done(); + } + else { + setTimeout(done, wait); + } + } + }; + var queue = Promise.resolve(); + subscription = observable.subscribe({ + next: function (result) { + queue = queue + .then(function () { + var cb = cbs[cbIndex++]; + if (cb) + return cb(result); + reject(new Error("Observable 'next' method called more than ".concat(cbs.length, " times"))); + }) + .then(function (res) { + results.push(res); + tryToResolve(); + }, reject); + }, + error: function (error) { + queue = queue + .then(function () { + var errorCb = errorCallbacks[errorIndex++]; + if (errorCb) + return errorCb(error); + reject(error); + }) + .then(tryToResolve, reject); + }, + }); + }); + return { + promise: promise, + subscription: subscription, + }; +} +export default function (options) { + var cbs = []; + for (var _i = 1; _i < arguments.length; _i++) { + cbs[_i - 1] = arguments[_i]; + } + return observableToPromiseAndSubscription.apply(void 0, __spreadArray([options], cbs, false)).promise; +} +//# sourceMappingURL=observableToPromise.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js.map new file mode 100644 index 0000000..4dd1f2e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/observableToPromise.js.map @@ -0,0 +1 @@ +{"version":3,"file":"observableToPromise.js","sourceRoot":"","sources":["../../../src/testing/core/observableToPromise.ts"],"names":[],"mappings":";AA0BA,kEAAkE;AAClE,wEAAwE;AACxE,6EAA6E;AAC7E,oCAAoC;AACpC,MAAM,UAAU,kCAAkC,CAChD,EAA6E;QAA3E,UAAU,gBAAA,EAAE,qBAAoB,EAApB,aAAa,mBAAG,IAAI,KAAA,EAAE,YAAS,EAAT,IAAI,mBAAG,CAAC,CAAC,KAAA,EAAE,sBAAmB,EAAnB,cAAc,mBAAG,EAAE,KAAA;IAClE,aAAwB;SAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;QAAxB,4BAAwB;;IAExB,IAAI,YAAY,GAA2B,IAAa,CAAC;IACzD,IAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,UAAC,OAAO,EAAE,MAAM;QACjD,IAAI,UAAU,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,CAAC,UAAU,EAAE,CAAC,CAAC;oBAC7C,IAAI,OAAO;wBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;oBACnC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC,CAAC;qBACD,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAChC,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,SAAA;QACP,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,WACZ,OAAgB;IAChB,aAAwB;SAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;QAAxB,4BAAwB;;IAExB,OAAO,kCAAkC,8BAAC,OAAO,GAAK,GAAG,UAAE,OAAO,CAAC;AACrE,CAAC","sourcesContent":["import type { ObservableQuery, ApolloQueryResult } from \"../../core/index.js\";\nimport type { ObservableSubscription } from \"../../utilities/index.js\";\n\nexport interface Options {\n /**\n * The ObservableQuery to subscribe to.\n */\n observable: ObservableQuery;\n /**\n * Should we resolve after seeing all our callbacks? [default: true]\n * (use this if you are racing the promise against another)\n */\n shouldResolve?: boolean;\n /**\n * How long to wait after seeing desired callbacks before resolving?\n * [default: -1 => don't wait]\n */\n wait?: number;\n /**\n * An expected set of errors.\n */\n errorCallbacks?: ((error: Error) => any)[];\n}\n\nexport type ResultCallback = (result: ApolloQueryResult) => any;\n\n// Take an observable and N callbacks, and observe the observable,\n// ensuring it is called exactly N times, resolving once it has done so.\n// Optionally takes a timeout, which it will wait X ms after the Nth callback\n// to ensure it is not called again.\nexport function observableToPromiseAndSubscription(\n { observable, shouldResolve = true, wait = -1, errorCallbacks = [] }: Options,\n ...cbs: ResultCallback[]\n): { promise: Promise; subscription: ObservableSubscription } {\n let subscription: ObservableSubscription = null as never;\n const promise = new Promise((resolve, reject) => {\n let errorIndex = 0;\n let cbIndex = 0;\n const results: any[] = [];\n\n const tryToResolve = () => {\n if (!shouldResolve) {\n return;\n }\n\n const done = () => {\n subscription.unsubscribe();\n // XXX: we could pass a few other things out here?\n resolve(results);\n };\n\n if (cbIndex === cbs.length && errorIndex === errorCallbacks.length) {\n if (wait === -1) {\n done();\n } else {\n setTimeout(done, wait);\n }\n }\n };\n\n let queue = Promise.resolve();\n\n subscription = observable.subscribe({\n next(result: ApolloQueryResult) {\n queue = queue\n .then(() => {\n const cb = cbs[cbIndex++];\n if (cb) return cb(result);\n reject(\n new Error(\n `Observable 'next' method called more than ${cbs.length} times`\n )\n );\n })\n .then((res) => {\n results.push(res);\n tryToResolve();\n }, reject);\n },\n error(error: Error) {\n queue = queue\n .then(() => {\n const errorCb = errorCallbacks[errorIndex++];\n if (errorCb) return errorCb(error);\n reject(error);\n })\n .then(tryToResolve, reject);\n },\n });\n });\n\n return {\n promise,\n subscription,\n };\n}\n\nexport default function (\n options: Options,\n ...cbs: ResultCallback[]\n): Promise {\n return observableToPromiseAndSubscription(options, ...cbs).promise;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/package.json b/graphql-subscription/node_modules/@apollo/client/testing/core/package.json new file mode 100644 index 0000000..3a00628 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/testing/core", + "type": "module", + "main": "core.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.d.ts new file mode 100644 index 0000000..4c049a2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.d.ts @@ -0,0 +1,3 @@ +import type { ObservableSubscription, Observable } from "../../utilities/index.js"; +export default function subscribeAndCount(reject: (reason: any) => any, observable: Observable, cb: (handleCount: number, result: TResult) => any): ObservableSubscription; +//# sourceMappingURL=subscribeAndCount.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js b/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js new file mode 100644 index 0000000..f7f4252 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js @@ -0,0 +1,21 @@ +import { asyncMap } from "../../utilities/index.js"; +export default function subscribeAndCount(reject, observable, cb) { + // Use a Promise queue to prevent callbacks from being run out of order. + var queue = Promise.resolve(); + var handleCount = 0; + var subscription = asyncMap(observable, function (result) { + // All previous asynchronous callbacks must complete before cb can + // be invoked with this result. + return (queue = queue + .then(function () { + return cb(++handleCount, result); + }) + .catch(error)); + }).subscribe({ error: error }); + function error(e) { + subscription.unsubscribe(); + reject(e); + } + return subscription; +} +//# sourceMappingURL=subscribeAndCount.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js.map new file mode 100644 index 0000000..e638591 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/subscribeAndCount.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscribeAndCount.js","sourceRoot":"","sources":["../../../src/testing/core/subscribeAndCount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAA4B,EAC5B,UAA+B,EAC/B,EAAiD;IAEjD,wEAAwE;IACxE,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9B,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,IAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,EAAE,UAAC,MAAM;QAC/C,kEAAkE;QAClE,+BAA+B;QAC/B,OAAO,CAAC,KAAK,GAAG,KAAK;aAClB,IAAI,CAAC;YACJ,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC;aACD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IAExB,SAAS,KAAK,CAAC,CAAM;QACnB,YAAY,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,CAAC,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import type {\n ObservableSubscription,\n Observable,\n} from \"../../utilities/index.js\";\nimport { asyncMap } from \"../../utilities/index.js\";\n\nexport default function subscribeAndCount(\n reject: (reason: any) => any,\n observable: Observable,\n cb: (handleCount: number, result: TResult) => any\n): ObservableSubscription {\n // Use a Promise queue to prevent callbacks from being run out of order.\n let queue = Promise.resolve();\n let handleCount = 0;\n\n const subscription = asyncMap(observable, (result) => {\n // All previous asynchronous callbacks must complete before cb can\n // be invoked with this result.\n return (queue = queue\n .then(() => {\n return cb(++handleCount, result);\n })\n .catch(error));\n }).subscribe({ error });\n\n function error(e: any) {\n subscription.unsubscribe();\n reject(e);\n }\n\n return subscription;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/wait.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/wait.d.ts new file mode 100644 index 0000000..4664f27 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/wait.d.ts @@ -0,0 +1,3 @@ +export declare function wait(ms: number): Promise; +export declare function tick(): Promise; +//# sourceMappingURL=wait.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/wait.js b/graphql-subscription/node_modules/@apollo/client/testing/core/wait.js new file mode 100644 index 0000000..366e24e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/wait.js @@ -0,0 +1,16 @@ +import { __awaiter, __generator } from "tslib"; +export function wait(ms) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })]; + }); + }); +} +export function tick() { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, wait(0)]; + }); + }); +} +//# sourceMappingURL=wait.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/wait.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/wait.js.map new file mode 100644 index 0000000..6ecca2d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/wait.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wait.js","sourceRoot":"","sources":["../../../src/testing/core/wait.ts"],"names":[],"mappings":";AAAA,MAAM,UAAgB,IAAI,CAAC,EAAU;;;YACnC,sBAAO,IAAI,OAAO,CAAO,UAAC,OAAO,IAAK,OAAA,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,EAAvB,CAAuB,CAAC,EAAC;;;CAChE;AAED,MAAM,UAAgB,IAAI;;;YACxB,sBAAO,IAAI,CAAC,CAAC,CAAC,EAAC;;;CAChB","sourcesContent":["export async function wait(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport async function tick() {\n return wait(0);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.d.ts new file mode 100644 index 0000000..ca1bb70 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.d.ts @@ -0,0 +1,7 @@ +/** @deprecated This method will be removed in the next major version of Apollo Client */ +export declare function withErrorSpy(it: (...args: TArgs) => TResult, ...args: TArgs): TResult; +/** @deprecated This method will be removed in the next major version of Apollo Client */ +export declare function withWarningSpy(it: (...args: TArgs) => TResult, ...args: TArgs): TResult; +/** @deprecated This method will be removed in the next major version of Apollo Client */ +export declare function withLogSpy(it: (...args: TArgs) => TResult, ...args: TArgs): TResult; +//# sourceMappingURL=withConsoleSpy.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js b/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js new file mode 100644 index 0000000..75a471d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js @@ -0,0 +1,45 @@ +function wrapTestFunction(fn, consoleMethodName) { + return function () { + var _this = this; + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var spy = jest.spyOn(console, consoleMethodName); + spy.mockImplementation(function () { }); + return new Promise(function (resolve) { + resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args)); + }).finally(function () { + expect(spy).toMatchSnapshot(); + spy.mockReset(); + }); + }; +} +/** @deprecated This method will be removed in the next major version of Apollo Client */ +export function withErrorSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "error"); + return it.apply(void 0, args); +} +/** @deprecated This method will be removed in the next major version of Apollo Client */ +export function withWarningSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "warn"); + return it.apply(void 0, args); +} +/** @deprecated This method will be removed in the next major version of Apollo Client */ +export function withLogSpy(it) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + args[1] = wrapTestFunction(args[1], "log"); + return it.apply(void 0, args); +} +//# sourceMappingURL=withConsoleSpy.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js.map new file mode 100644 index 0000000..6763c0f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/withConsoleSpy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"withConsoleSpy.js","sourceRoot":"","sources":["../../../src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AAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;IAEd,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3C,OAAO,EAAE,eAAI,IAAI,EAAE;AACrB,CAAC","sourcesContent":["function wrapTestFunction(\n fn: (...args: any[]) => any,\n consoleMethodName: \"log\" | \"warn\" | \"error\"\n) {\n return function (this: any, ...args: any[]) {\n const spy = jest.spyOn(console, consoleMethodName);\n spy.mockImplementation(() => {});\n return new Promise((resolve) => {\n resolve(fn?.apply(this, args));\n }).finally(() => {\n expect(spy).toMatchSnapshot();\n spy.mockReset();\n });\n };\n}\n\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withErrorSpy(\n it: (...args: TArgs) => TResult,\n ...args: TArgs\n) {\n args[1] = wrapTestFunction(args[1], \"error\");\n return it(...args);\n}\n\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withWarningSpy(\n it: (...args: TArgs) => TResult,\n ...args: TArgs\n) {\n args[1] = wrapTestFunction(args[1], \"warn\");\n return it(...args);\n}\n\n/** @deprecated This method will be removed in the next major version of Apollo Client */\nexport function withLogSpy(\n it: (...args: TArgs) => TResult,\n ...args: TArgs\n) {\n args[1] = wrapTestFunction(args[1], \"log\");\n return it(...args);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.d.ts new file mode 100644 index 0000000..57fdf01 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.d.ts @@ -0,0 +1,4 @@ +declare const _default: (reject: (reason: any) => any, cb: (...args: TArgs) => TResult) => (...args: TArgs) => TResult | undefined; +export default _default; +export declare function withError(func: Function, regex: RegExp): any; +//# sourceMappingURL=wrap.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js b/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js new file mode 100644 index 0000000..a40c14f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js @@ -0,0 +1,30 @@ +// I'm not sure why mocha doesn't provide something like this, you can't +// always use promises +export default (function(reject, cb) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + try { + return cb.apply(void 0, args); + } + catch (e) { + reject(e); + } + }; +}); +export function withError(func, regex) { + var message = null; + var oldError = console.error; + console.error = function (m) { return (message = m); }; + try { + var result = func(); + expect(message).toMatch(regex); + return result; + } + finally { + console.error = oldError; + } +} +//# sourceMappingURL=wrap.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js.map b/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js.map new file mode 100644 index 0000000..003a6ad --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/core/wrap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../src/testing/core/wrap.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,sBAAsB;AACtB,gBAAe,UACX,MAA4B,EAC5B,EAA+B;IAEjC,OAAA;QAAC,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACb,IAAI,CAAC;YACH,OAAO,EAAE,eAAI,IAAI,EAAE;QACrB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC;IACH,CAAC;AAND,CAMC,EAAC;AAEJ,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,KAAa;IACrD,IAAI,OAAO,GAAW,IAAa,CAAC;IACpC,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;IAE/B,OAAO,CAAC,KAAK,GAAG,UAAC,CAAS,IAAK,OAAA,CAAC,OAAO,GAAG,CAAC,CAAC,EAAb,CAAa,CAAC;IAE7C,IAAI,CAAC;QACH,IAAM,MAAM,GAAG,IAAI,EAAE,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["// I'm not sure why mocha doesn't provide something like this, you can't\n// always use promises\nexport default (\n reject: (reason: any) => any,\n cb: (...args: TArgs) => TResult\n ) =>\n (...args: TArgs) => {\n try {\n return cb(...args);\n } catch (e) {\n reject(e);\n }\n };\n\nexport function withError(func: Function, regex: RegExp) {\n let message: string = null as never;\n const oldError = console.error;\n\n console.error = (m: string) => (message = m);\n\n try {\n const result = func();\n expect(message).toMatch(regex);\n return result;\n } finally {\n console.error = oldError;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/index.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/index.d.ts new file mode 100644 index 0000000..05fbf7f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/index.d.ts @@ -0,0 +1,5 @@ +import "../utilities/globals/index.js"; +export type { MockedProviderProps } from "./react/MockedProvider.js"; +export { MockedProvider } from "./react/MockedProvider.js"; +export * from "./core/index.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/index.js b/graphql-subscription/node_modules/@apollo/client/testing/index.js new file mode 100644 index 0000000..f1e0882 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/index.js @@ -0,0 +1,4 @@ +import "../utilities/globals/index.js"; +export { MockedProvider } from "./react/MockedProvider.js"; +export * from "./core/index.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/index.js.map b/graphql-subscription/node_modules/@apollo/client/testing/index.js.map new file mode 100644 index 0000000..1a7caea --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,cAAc,iBAAiB,CAAC","sourcesContent":["import \"../utilities/globals/index.js\";\nexport type { MockedProviderProps } from \"./react/MockedProvider.js\";\nexport { MockedProvider } from \"./react/MockedProvider.js\";\nexport * from \"./core/index.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.d.ts new file mode 100644 index 0000000..2c48ab1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.d.ts @@ -0,0 +1,26 @@ +import type { Observable } from "../../utilities/index.js"; +interface TakeOptions { + timeout?: number; +} +type ObservableEvent = { + type: "next"; + value: T; +} | { + type: "error"; + error: any; +} | { + type: "complete"; +}; +declare class IteratorStream { + private iterator; + constructor(iterator: AsyncGenerator); + take({ timeout }?: TakeOptions): Promise; +} +export declare class ObservableStream extends IteratorStream> { + constructor(observable: Observable); + takeNext(options?: TakeOptions): Promise; + takeError(options?: TakeOptions): Promise; + takeComplete(options?: TakeOptions): Promise; +} +export {}; +//# sourceMappingURL=ObservableStream.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js new file mode 100644 index 0000000..bf927e4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js @@ -0,0 +1,109 @@ +import { __asyncGenerator, __await, __awaiter, __extends, __generator } from "tslib"; +function observableToAsyncEventIterator(observable) { + return __asyncGenerator(this, arguments, function observableToAsyncEventIterator_1() { + function queuePromise() { + promises.push(new Promise(function (resolve) { + resolveNext = function (event) { + resolve(event); + queuePromise(); + }; + })); + } + var resolveNext, promises; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + promises = []; + queuePromise(); + observable.subscribe(function (value) { return resolveNext({ type: "next", value: value }); }, function (error) { return resolveNext({ type: "error", error: error }); }, function () { return resolveNext({ type: "complete" }); }); + return [4 /*yield*/, __await("initialization value")]; + case 1: return [4 /*yield*/, _a.sent()]; + case 2: + _a.sent(); + _a.label = 3; + case 3: + if (!true) return [3 /*break*/, 6]; + return [4 /*yield*/, __await(promises.shift())]; + case 4: return [4 /*yield*/, _a.sent()]; + case 5: + _a.sent(); + return [3 /*break*/, 3]; + case 6: return [2 /*return*/]; + } + }); + }); +} +var IteratorStream = /** @class */ (function () { + function IteratorStream(iterator) { + this.iterator = iterator; + } + IteratorStream.prototype.take = function (_a) { + var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 100 : _c; + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_d) { + return [2 /*return*/, Promise.race([ + this.iterator.next().then(function (result) { return result.value; }), + new Promise(function (_, reject) { + setTimeout(reject, timeout, new Error("Timeout waiting for next event")); + }), + ])]; + }); + }); + }; + return IteratorStream; +}()); +var ObservableStream = /** @class */ (function (_super) { + __extends(ObservableStream, _super); + function ObservableStream(observable) { + var iterator = observableToAsyncEventIterator(observable); + // we need to call next() once to start the generator so we immediately subscribe. + // the first value is always "initialization value" which we don't care about + iterator.next(); + return _super.call(this, iterator) || this; + } + ObservableStream.prototype.takeNext = function (options) { + return __awaiter(this, void 0, void 0, function () { + var event; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.take(options)]; + case 1: + event = _a.sent(); + expect(event).toEqual({ type: "next", value: expect.anything() }); + return [2 /*return*/, event.value]; + } + }); + }); + }; + ObservableStream.prototype.takeError = function (options) { + return __awaiter(this, void 0, void 0, function () { + var event; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.take(options)]; + case 1: + event = _a.sent(); + expect(event).toEqual({ type: "error", error: expect.anything() }); + return [2 /*return*/, event.error]; + } + }); + }); + }; + ObservableStream.prototype.takeComplete = function (options) { + return __awaiter(this, void 0, void 0, function () { + var event; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.take(options)]; + case 1: + event = _a.sent(); + expect(event).toEqual({ type: "complete" }); + return [2 /*return*/]; + } + }); + }); + }; + return ObservableStream; +}(IteratorStream)); +export { ObservableStream }; +//# sourceMappingURL=ObservableStream.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js.map new file mode 100644 index 0000000..21d8e5b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/ObservableStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ObservableStream.js","sourceRoot":"","sources":["../../../src/testing/internal/ObservableStream.ts"],"names":[],"mappings":";AAUA,SAAgB,8BAA8B,CAAI,UAAyB;;QAKzE,SAAS,YAAY;YACnB,QAAQ,CAAC,IAAI,CACX,IAAI,OAAO,CAAqB,UAAC,OAAO;gBACtC,WAAW,GAAG,UAAC,KAAyB;oBACtC,OAAO,CAAC,KAAK,CAAC,CAAC;oBACf,YAAY,EAAE,CAAC;gBACjB,CAAC,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;;;;;oBAZK,QAAQ,GAAkC,EAAE,CAAC;oBACnD,YAAY,EAAE,CAAC;oBAaf,UAAU,CAAC,SAAS,CAClB,UAAC,KAAK,IAAK,OAAA,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAA,EAAE,CAAC,EAApC,CAAoC,EAC/C,UAAC,KAAK,IAAK,OAAA,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,OAAA,EAAE,CAAC,EAArC,CAAqC,EAChD,cAAM,OAAA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,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBAClE,sBAAQ,KAA+C,CAAC,KAAK,EAAC;;;;KAC/D;IAEK,oCAAS,GAAf,UAAgB,OAAqB;;;;;4BACrB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBACnE,sBAAQ,KAAgD,CAAC,KAAK,EAAC;;;;KAChE;IAEK,uCAAY,GAAlB,UAAmB,OAAqB;;;;;4BACxB,qBAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAA;;wBAAhC,KAAK,GAAG,SAAwB;wBACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;;;;;KAC7C;IACH,uBAAC;AAAD,CAAC,AAzBD,CAAyC,cAAc,GAyBtD","sourcesContent":["import type { Observable } from \"../../utilities/index.js\";\n\ninterface TakeOptions {\n timeout?: number;\n}\ntype ObservableEvent =\n | { type: \"next\"; value: T }\n | { type: \"error\"; error: any }\n | { type: \"complete\" };\n\nasync function* observableToAsyncEventIterator(observable: Observable) {\n let resolveNext: (value: ObservableEvent) => void;\n const promises: Promise>[] = [];\n queuePromise();\n\n function queuePromise() {\n promises.push(\n new Promise>((resolve) => {\n resolveNext = (event: ObservableEvent) => {\n resolve(event);\n queuePromise();\n };\n })\n );\n }\n\n observable.subscribe(\n (value) => resolveNext({ type: \"next\", value }),\n (error) => resolveNext({ type: \"error\", error }),\n () => resolveNext({ type: \"complete\" })\n );\n yield \"initialization value\" as unknown as Promise>;\n\n while (true) {\n yield promises.shift()!;\n }\n}\n\nclass IteratorStream {\n constructor(private iterator: AsyncGenerator) {}\n\n async take({ timeout = 100 }: TakeOptions = {}): Promise {\n return Promise.race([\n this.iterator.next().then((result) => result.value!),\n new Promise((_, reject) => {\n setTimeout(\n reject,\n timeout,\n new Error(\"Timeout waiting for next event\")\n );\n }),\n ]);\n }\n}\n\nexport class ObservableStream extends IteratorStream> {\n constructor(observable: Observable) {\n const iterator = observableToAsyncEventIterator(observable);\n // we need to call next() once to start the generator so we immediately subscribe.\n // the first value is always \"initialization value\" which we don't care about\n iterator.next();\n super(iterator);\n }\n\n async takeNext(options?: TakeOptions): Promise {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"next\", value: expect.anything() });\n return (event as ObservableEvent & { type: \"next\" }).value;\n }\n\n async takeError(options?: TakeOptions): Promise {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"error\", error: expect.anything() });\n return (event as ObservableEvent & { type: \"error\" }).error;\n }\n\n async takeComplete(options?: TakeOptions): Promise {\n const event = await this.take(options);\n expect(event).toEqual({ type: \"complete\" });\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.d.ts new file mode 100644 index 0000000..0e685e7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.d.ts @@ -0,0 +1,10 @@ +/// +/** + * Temporarily disable act warnings. + * + * https://github.com/reactwg/react-18/discussions/102 + */ +export declare function disableActWarnings(): { + prevActEnv: any; +} & Disposable; +//# sourceMappingURL=disableActWarnings.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js new file mode 100644 index 0000000..7156c73 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js @@ -0,0 +1,15 @@ +import { withCleanup } from "./withCleanup.js"; +/** + * Temporarily disable act warnings. + * + * https://github.com/reactwg/react-18/discussions/102 + */ +export function disableActWarnings() { + var prev = { prevActEnv: globalThis.IS_REACT_ACT_ENVIRONMENT }; + globalThis.IS_REACT_ACT_ENVIRONMENT = false; + return withCleanup(prev, function (_a) { + var prevActEnv = _a.prevActEnv; + globalThis.IS_REACT_ACT_ENVIRONMENT = prevActEnv; + }); +} +//# sourceMappingURL=disableActWarnings.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js.map new file mode 100644 index 0000000..fc19d23 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/disableActWarnings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"disableActWarnings.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/disableActWarnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAM,IAAI,GAAG,EAAE,UAAU,EAAG,UAAkB,CAAC,wBAAwB,EAAE,CAAC;IACzE,UAAkB,CAAC,wBAAwB,GAAG,KAAK,CAAC;IAErD,OAAO,WAAW,CAAC,IAAI,EAAE,UAAC,EAAc;YAAZ,UAAU,gBAAA;QACnC,UAAkB,CAAC,wBAAwB,GAAG,UAAU,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { withCleanup } from \"./withCleanup.js\";\n\n/**\n * Temporarily disable act warnings.\n *\n * https://github.com/reactwg/react-18/discussions/102\n */\nexport function disableActWarnings() {\n const prev = { prevActEnv: (globalThis as any).IS_REACT_ACT_ENVIRONMENT };\n (globalThis as any).IS_REACT_ACT_ENVIRONMENT = false;\n\n return withCleanup(prev, ({ prevActEnv }) => {\n (globalThis as any).IS_REACT_ACT_ENVIRONMENT = prevActEnv;\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.d.ts new file mode 100644 index 0000000..0513ff0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.d.ts @@ -0,0 +1,4 @@ +export { disableActWarnings } from "./disableActWarnings.js"; +export { spyOnConsole } from "./spyOnConsole.js"; +export { withCleanup } from "./withCleanup.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js new file mode 100644 index 0000000..17c3cea --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js @@ -0,0 +1,4 @@ +export { disableActWarnings } from "./disableActWarnings.js"; +export { spyOnConsole } from "./spyOnConsole.js"; +export { withCleanup } from "./withCleanup.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js.map new file mode 100644 index 0000000..2866145 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { disableActWarnings } from \"./disableActWarnings.js\";\nexport { spyOnConsole } from \"./spyOnConsole.js\";\nexport { withCleanup } from \"./withCleanup.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.d.ts new file mode 100644 index 0000000..3204b13 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.d.ts @@ -0,0 +1,11 @@ +/// +/// +type ConsoleMethod = "log" | "info" | "warn" | "error" | "debug"; +type Spies = Record>; +/** @internal */ +export declare function spyOnConsole(...spyOn: Keys): Spies & Disposable; +export declare namespace spyOnConsole { + var takeSnapshots: (...spyOn: Keys) => Spies & Disposable; +} +export {}; +//# sourceMappingURL=spyOnConsole.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js new file mode 100644 index 0000000..022bee3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js @@ -0,0 +1,35 @@ +import { withCleanup } from "./withCleanup.js"; +var noOp = function () { }; +var restore = function (spy) { return spy.mockRestore(); }; +/** @internal */ +export function spyOnConsole() { + var spyOn = []; + for (var _i = 0; _i < arguments.length; _i++) { + spyOn[_i] = arguments[_i]; + } + var spies = {}; + for (var _a = 0, spyOn_1 = spyOn; _a < spyOn_1.length; _a++) { + var key = spyOn_1[_a]; + // @ts-ignore + spies[key] = jest.spyOn(console, key).mockImplementation(noOp); + } + return withCleanup(spies, function (spies) { + for (var _i = 0, _a = Object.values(spies); _i < _a.length; _i++) { + var spy = _a[_i]; + restore(spy); + } + }); +} +spyOnConsole.takeSnapshots = function () { + var spyOn = []; + for (var _i = 0; _i < arguments.length; _i++) { + spyOn[_i] = arguments[_i]; + } + return withCleanup(spyOnConsole.apply(void 0, spyOn), function (spies) { + for (var _i = 0, _a = Object.values(spies); _i < _a.length; _i++) { + var spy = _a[_i]; + expect(spy).toMatchSnapshot(); + } + }); +}; +//# sourceMappingURL=spyOnConsole.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js.map new file mode 100644 index 0000000..e651afe --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/spyOnConsole.js.map @@ -0,0 +1 @@ +{"version":3,"file":"spyOnConsole.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/spyOnConsole.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,IAAM,IAAI,GAAG,cAAO,CAAC,CAAC;AACtB,IAAM,OAAO,GAAG,UAAC,GAAqB,IAAK,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC;AAS7D,gBAAgB;AAChB,MAAM,UAAU,YAAY;IAC1B,eAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,0BAAc;;IAEd,IAAM,KAAK,GAAG,EAAiB,CAAC;IAChC,KAAkB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE,CAAC;QAArB,IAAM,GAAG,cAAA;QACZ,aAAa;QACb,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,WAAW,CAAC,KAAK,EAAE,UAAC,KAAK;QAC9B,KAAkB,UAA0C,EAA1C,KAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAuB,EAA1C,cAA0C,EAA1C,IAA0C,EAAE,CAAC;YAA1D,IAAM,GAAG,SAAA;YACZ,OAAO,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,YAAY,CAAC,aAAa,GAAG;IAC3B,eAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,0BAAc;;IAEd,OAAA,WAAW,CAAC,YAAY,eAAI,KAAK,GAAG,UAAC,KAAK;QACxC,KAAkB,UAA0C,EAA1C,KAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAuB,EAA1C,cAA0C,EAA1C,IAA0C,EAAE,CAAC;YAA1D,IAAM,GAAG,SAAA;YACZ,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC;QAChC,CAAC;IACH,CAAC,CAAC;AAJF,CAIE,CAAC","sourcesContent":["import { withCleanup } from \"./withCleanup.js\";\n\nconst noOp = () => {};\nconst restore = (spy: jest.SpyInstance) => spy.mockRestore();\n\ntype ConsoleMethod = \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n\ntype Spies = Record<\n Keys[number],\n jest.SpyInstance\n>;\n\n/** @internal */\nexport function spyOnConsole(\n ...spyOn: Keys\n): Spies & Disposable {\n const spies = {} as Spies;\n for (const key of spyOn) {\n // @ts-ignore\n spies[key] = jest.spyOn(console, key).mockImplementation(noOp);\n }\n return withCleanup(spies, (spies) => {\n for (const spy of Object.values(spies) as jest.SpyInstance[]) {\n restore(spy);\n }\n });\n}\n\nspyOnConsole.takeSnapshots = (\n ...spyOn: Keys\n): Spies & Disposable =>\n withCleanup(spyOnConsole(...spyOn), (spies) => {\n for (const spy of Object.values(spies) as jest.SpyInstance[]) {\n expect(spy).toMatchSnapshot();\n }\n });\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.d.ts new file mode 100644 index 0000000..ef5d429 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.d.ts @@ -0,0 +1,4 @@ +/// +/** @internal */ +export declare function withCleanup(item: T, cleanup: (item: T) => void): T & Disposable; +//# sourceMappingURL=withCleanup.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js new file mode 100644 index 0000000..c8c976a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js @@ -0,0 +1,14 @@ +import { __assign } from "tslib"; +/** @internal */ +export function withCleanup(item, cleanup) { + var _a; + return __assign(__assign({}, item), (_a = {}, _a[Symbol.dispose] = function () { + cleanup(item); + // if `item` already has a cleanup function, we also need to call the original cleanup function + // (e.g. if something is wrapped in `withCleanup` twice) + if (Symbol.dispose in item) { + item[Symbol.dispose](); + } + }, _a)); +} +//# sourceMappingURL=withCleanup.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js.map new file mode 100644 index 0000000..d0102c3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/disposables/withCleanup.js.map @@ -0,0 +1 @@ +{"version":3,"file":"withCleanup.js","sourceRoot":"","sources":["../../../../src/testing/internal/disposables/withCleanup.ts"],"names":[],"mappings":";AAAA,gBAAgB;AAChB,MAAM,UAAU,WAAW,CACzB,IAAO,EACP,OAA0B;;IAE1B,6BACK,IAAI,aACP,GAAC,MAAM,CAAC,OAAO,IAAf;QACE,OAAO,CAAC,IAAI,CAAC,CAAC;QACd,+FAA+F;QAC/F,wDAAwD;QACxD,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;YAC1B,IAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,CAAC;IACH,CAAC,OACD;AACJ,CAAC","sourcesContent":["/** @internal */\nexport function withCleanup(\n item: T,\n cleanup: (item: T) => void\n): T & Disposable {\n return {\n ...item,\n [Symbol.dispose]() {\n cleanup(item);\n // if `item` already has a cleanup function, we also need to call the original cleanup function\n // (e.g. if something is wrapped in `withCleanup` twice)\n if (Symbol.dispose in item) {\n (item as Disposable)[Symbol.dispose]();\n }\n },\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/index.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/index.d.ts new file mode 100644 index 0000000..7ecf88c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/index.d.ts @@ -0,0 +1,8 @@ +export * from "./profile/index.js"; +export * from "./disposables/index.js"; +export { ObservableStream } from "./ObservableStream.js"; +export type { SimpleCaseData, PaginatedCaseData, PaginatedCaseVariables, VariablesCaseData, VariablesCaseVariables, } from "./scenarios/index.js"; +export { setupSimpleCase, setupVariablesCase, setupPaginatedCase, } from "./scenarios/index.js"; +export type { RenderWithClientOptions, RenderWithMocksOptions, } from "./renderHelpers.js"; +export { renderWithClient, renderWithMocks } from "./renderHelpers.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/index.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/index.js new file mode 100644 index 0000000..a772606 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/index.js @@ -0,0 +1,6 @@ +export * from "./profile/index.js"; +export * from "./disposables/index.js"; +export { ObservableStream } from "./ObservableStream.js"; +export { setupSimpleCase, setupVariablesCase, setupPaginatedCase, } from "./scenarios/index.js"; +export { renderWithClient, renderWithMocks } from "./renderHelpers.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/index.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/index.js.map new file mode 100644 index 0000000..6f5d150 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AASzD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export * from \"./profile/index.js\";\nexport * from \"./disposables/index.js\";\nexport { ObservableStream } from \"./ObservableStream.js\";\n\nexport type {\n SimpleCaseData,\n PaginatedCaseData,\n PaginatedCaseVariables,\n VariablesCaseData,\n VariablesCaseVariables,\n} from \"./scenarios/index.js\";\nexport {\n setupSimpleCase,\n setupVariablesCase,\n setupPaginatedCase,\n} from \"./scenarios/index.js\";\n\nexport type {\n RenderWithClientOptions,\n RenderWithMocksOptions,\n} from \"./renderHelpers.js\";\nexport { renderWithClient, renderWithMocks } from \"./renderHelpers.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.d.ts new file mode 100644 index 0000000..f5ce4a3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.d.ts @@ -0,0 +1,171 @@ +/// +import { screen } from "@testing-library/dom"; +/** @internal */ +export interface BaseRender { + id: string; + phase: "mount" | "update" | "nested-update"; + actualDuration: number; + baseDuration: number; + startTime: number; + commitTime: number; + /** + * The number of renders that have happened so far (including this render). + */ + count: number; +} +type Screen = typeof screen; +/** @internal */ +export type SyncScreen = { + [K in keyof Screen]: K extends `find${string}` ? { + /** @deprecated A snapshot is static, so avoid async queries! */ + (...args: Parameters): ReturnType; + } : Screen[K]; +}; +/** @internal */ +export interface Render extends BaseRender { + /** + * The snapshot, as returned by the `takeSnapshot` option of `profile`. + * (If using `profileHook`, this is the return value of the hook.) + */ + snapshot: Snapshot; + /** + * A DOM snapshot of the rendered component, if the `snapshotDOM` + * option of `profile` was enabled. + */ + readonly domSnapshot: HTMLElement; + /** + * Returns a callback to receive a `screen` instance that is scoped to the + * DOM snapshot of this `Render` instance. + * Note: this is used as a callback to prevent linter errors. + * @example + * ```diff + * const { withinDOM } = RenderedComponent.takeRender(); + * -expect(screen.getByText("foo")).toBeInTheDocument(); + * +expect(withinDOM().getByText("foo")).toBeInTheDocument(); + * ``` + */ + withinDOM: () => SyncScreen; + renderedComponents: Array; +} +/** @internal */ +export declare class RenderInstance implements Render { + snapshot: Snapshot; + private stringifiedDOM; + renderedComponents: Array; + id: string; + phase: "mount" | "update" | "nested-update"; + actualDuration: number; + baseDuration: number; + startTime: number; + commitTime: number; + count: number; + constructor(baseRender: BaseRender, snapshot: Snapshot, stringifiedDOM: string | undefined, renderedComponents: Array); + private _domSnapshot; + get domSnapshot(): HTMLElement; + get withinDOM(): () => { + getByLabelText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T; + getAllByLabelText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_1[]; + queryByLabelText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_2 | null; + queryAllByLabelText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_3[]; + findByLabelText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByLabelText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + getByPlaceholderText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_6; + getAllByPlaceholderText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_7[]; + queryByPlaceholderText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_8 | null; + queryAllByPlaceholderText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_9[]; + findByPlaceholderText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByPlaceholderText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + getByText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_12; + getAllByText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_13[]; + queryByText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_14 | null; + queryAllByText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): T_15[]; + findByText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + getByAltText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_18; + getAllByAltText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_19[]; + queryByAltText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_20 | null; + queryAllByAltText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_21[]; + findByAltText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByAltText(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + getByTitle(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_24; + getAllByTitle(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_25[]; + queryByTitle(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_26 | null; + queryAllByTitle(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_27[]; + findByTitle(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByTitle(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + getByDisplayValue(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_30; + getAllByDisplayValue(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_31[]; + queryByDisplayValue(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_32 | null; + queryAllByDisplayValue(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_33[]; + findByDisplayValue(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByDisplayValue(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + getByRole(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_36; + getAllByRole(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_37[]; + queryByRole(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_38 | null; + queryAllByRole(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined): T_39[]; + findByRole(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByRole(role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + getByTestId(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_42; + getAllByTestId(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_43[]; + queryByTestId(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_44 | null; + queryAllByTestId(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): T_45[]; + findByTestId(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + findAllByTestId(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): Promise; + } & { + getByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement; + getAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]; + queryByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null; + queryAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]; + findByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + getByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement; + getAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + queryByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null; + queryAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + findByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + getByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement; + getAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]; + queryByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null; + queryAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[]; + findByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + getByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement; + getAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + queryByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null; + queryAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + findByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + getByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement; + getAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + queryByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null; + queryAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + findByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + getByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement; + getAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + queryByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null; + queryAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + findByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + getByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement; + getAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement[]; + queryByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement | null; + queryAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined) => HTMLElement[]; + findByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: import("@testing-library/dom").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + getByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement; + getAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + queryByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null; + queryAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[]; + findByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + findAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise; + } & { + debug: (element?: Element | HTMLDocument | (Element | HTMLDocument)[] | undefined, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void; + logTestingPlaygroundURL: (element?: Element | HTMLDocument | undefined) => void; + }; +} +/** @internal */ +export declare function errorOnDomInteraction(): void; +export {}; +//# sourceMappingURL=Render.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js new file mode 100644 index 0000000..8a72db4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js @@ -0,0 +1,144 @@ +/* istanbul ignore file */ +import { __spreadArray } from "tslib"; +/* +Something in this file does not compile correctly while measuring code coverage +and will lead to a + Uncaught [ReferenceError: cov_1zb8w312au is not defined] +if we do not ignore this file in code coverage. + +As we only use this file in our internal tests, we can safely ignore it. +*/ +import { within, screen } from "@testing-library/dom"; +import { JSDOM, VirtualConsole } from "jsdom"; +import { applyStackTrace, captureStackTrace } from "./traces.js"; +/** @internal */ +var RenderInstance = /** @class */ (function () { + function RenderInstance(baseRender, snapshot, stringifiedDOM, renderedComponents) { + this.snapshot = snapshot; + this.stringifiedDOM = stringifiedDOM; + this.renderedComponents = renderedComponents; + this.id = baseRender.id; + this.phase = baseRender.phase; + this.actualDuration = baseRender.actualDuration; + this.baseDuration = baseRender.baseDuration; + this.startTime = baseRender.startTime; + this.commitTime = baseRender.commitTime; + this.count = baseRender.count; + } + Object.defineProperty(RenderInstance.prototype, "domSnapshot", { + get: function () { + if (this._domSnapshot) + return this._domSnapshot; + if (!this.stringifiedDOM) { + throw new Error("DOM snapshot is not available - please set the `snapshotDOM` option"); + } + var virtualConsole = new VirtualConsole(); + var stackTrace = captureStackTrace("RenderInstance.get"); + virtualConsole.on("jsdomError", function (error) { + throw applyStackTrace(error, stackTrace); + }); + var snapDOM = new JSDOM(this.stringifiedDOM, { + runScripts: "dangerously", + virtualConsole: virtualConsole, + }); + var document = snapDOM.window.document; + var body = document.body; + var script = document.createElement("script"); + script.type = "text/javascript"; + script.text = "\n ".concat(errorOnDomInteraction.toString(), ";\n ").concat(errorOnDomInteraction.name, "();\n "); + body.appendChild(script); + body.removeChild(script); + return (this._domSnapshot = body); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(RenderInstance.prototype, "withinDOM", { + get: function () { + var _this = this; + var snapScreen = Object.assign(within(this.domSnapshot), { + debug: function () { + var _a = []; + for (var _i = 0; _i < arguments.length; _i++) { + _a[_i] = arguments[_i]; + } + var _b = _a[0], dom = _b === void 0 ? _this.domSnapshot : _b, rest = _a.slice(1); + screen.debug.apply(screen, __spreadArray([dom], rest, false)); + }, + logTestingPlaygroundURL: function () { + var _a = []; + for (var _i = 0; _i < arguments.length; _i++) { + _a[_i] = arguments[_i]; + } + var _b = _a[0], dom = _b === void 0 ? _this.domSnapshot : _b, rest = _a.slice(1); + screen.logTestingPlaygroundURL.apply(screen, __spreadArray([dom], rest, false)); + }, + }); + return function () { return snapScreen; }; + }, + enumerable: false, + configurable: true + }); + return RenderInstance; +}()); +export { RenderInstance }; +/** @internal */ +export function errorOnDomInteraction() { + var events = [ + "auxclick", + "blur", + "change", + "click", + "copy", + "cut", + "dblclick", + "drag", + "dragend", + "dragenter", + "dragleave", + "dragover", + "dragstart", + "drop", + "focus", + "focusin", + "focusout", + "input", + "keydown", + "keypress", + "keyup", + "mousedown", + "mouseenter", + "mouseleave", + "mousemove", + "mouseout", + "mouseover", + "mouseup", + "paste", + "pointercancel", + "pointerdown", + "pointerenter", + "pointerleave", + "pointermove", + "pointerout", + "pointerover", + "pointerup", + "scroll", + "select", + "selectionchange", + "selectstart", + "submit", + "toggle", + "touchcancel", + "touchend", + "touchmove", + "touchstart", + "wheel", + ]; + function warnOnDomInteraction() { + throw new Error("\n DOM interaction with a snapshot detected in test.\n Please don't interact with the DOM you get from `withinDOM`,\n but still use `screen' to get elements for simulating user interaction.\n "); + } + events.forEach(function (event) { + document.addEventListener(event, warnOnDomInteraction); + }); +} +//# sourceMappingURL=Render.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js.map new file mode 100644 index 0000000..98aaee0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/Render.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Render.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/Render.tsx"],"names":[],"mappings":"AAAA,0BAA0B;;AAE1B;;;;;;;EAOE;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAuDjE,gBAAgB;AAChB;IASE,wBACE,UAAsB,EACf,QAAkB,EACjB,cAAkC,EACnC,kBAAuD;QAFvD,aAAQ,GAAR,QAAQ,CAAU;QACjB,mBAAc,GAAd,cAAc,CAAoB;QACnC,uBAAkB,GAAlB,kBAAkB,CAAqC;QAE9D,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,KAAK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aAAa;QACb,UAAU;QACV,WAAW;QACX,YAAY;QACZ,OAAO;KACR,CAAC;IACF,SAAS,oBAAoB;QAC3B,MAAM,IAAI,KAAK,CAAC,8MAIf,CAAC,CAAC;IACL,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,UAAC,KAAK;QACnB,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* istanbul ignore file */\n\n/*\nSomething in this file does not compile correctly while measuring code coverage\nand will lead to a\n Uncaught [ReferenceError: cov_1zb8w312au is not defined]\nif we do not ignore this file in code coverage.\n\nAs we only use this file in our internal tests, we can safely ignore it.\n*/\n\nimport { within, screen } from \"@testing-library/dom\";\nimport { JSDOM, VirtualConsole } from \"jsdom\";\nimport { applyStackTrace, captureStackTrace } from \"./traces.js\";\n\n/** @internal */\nexport interface BaseRender {\n id: string;\n phase: \"mount\" | \"update\" | \"nested-update\";\n actualDuration: number;\n baseDuration: number;\n startTime: number;\n commitTime: number;\n /**\n * The number of renders that have happened so far (including this render).\n */\n count: number;\n}\n\ntype Screen = typeof screen;\n/** @internal */\nexport type SyncScreen = {\n [K in keyof Screen]: K extends `find${string}` ?\n {\n /** @deprecated A snapshot is static, so avoid async queries! */\n (...args: Parameters): ReturnType;\n }\n : Screen[K];\n};\n\n/** @internal */\nexport interface Render extends BaseRender {\n /**\n * The snapshot, as returned by the `takeSnapshot` option of `profile`.\n * (If using `profileHook`, this is the return value of the hook.)\n */\n snapshot: Snapshot;\n /**\n * A DOM snapshot of the rendered component, if the `snapshotDOM`\n * option of `profile` was enabled.\n */\n readonly domSnapshot: HTMLElement;\n /**\n * Returns a callback to receive a `screen` instance that is scoped to the\n * DOM snapshot of this `Render` instance.\n * Note: this is used as a callback to prevent linter errors.\n * @example\n * ```diff\n * const { withinDOM } = RenderedComponent.takeRender();\n * -expect(screen.getByText(\"foo\")).toBeInTheDocument();\n * +expect(withinDOM().getByText(\"foo\")).toBeInTheDocument();\n * ```\n */\n withinDOM: () => SyncScreen;\n\n renderedComponents: Array;\n}\n\n/** @internal */\nexport class RenderInstance implements Render {\n id: string;\n phase: \"mount\" | \"update\" | \"nested-update\";\n actualDuration: number;\n baseDuration: number;\n startTime: number;\n commitTime: number;\n count: number;\n\n constructor(\n baseRender: BaseRender,\n public snapshot: Snapshot,\n private stringifiedDOM: string | undefined,\n public renderedComponents: Array\n ) {\n this.id = baseRender.id;\n this.phase = baseRender.phase;\n this.actualDuration = baseRender.actualDuration;\n this.baseDuration = baseRender.baseDuration;\n this.startTime = baseRender.startTime;\n this.commitTime = baseRender.commitTime;\n this.count = baseRender.count;\n }\n\n private _domSnapshot: HTMLElement | undefined;\n get domSnapshot() {\n if (this._domSnapshot) return this._domSnapshot;\n if (!this.stringifiedDOM) {\n throw new Error(\n \"DOM snapshot is not available - please set the `snapshotDOM` option\"\n );\n }\n\n const virtualConsole = new VirtualConsole();\n const stackTrace = captureStackTrace(\"RenderInstance.get\");\n virtualConsole.on(\"jsdomError\", (error) => {\n throw applyStackTrace(error, stackTrace);\n });\n\n const snapDOM = new JSDOM(this.stringifiedDOM, {\n runScripts: \"dangerously\",\n virtualConsole,\n });\n const document = snapDOM.window.document;\n const body = document.body;\n const script = document.createElement(\"script\");\n script.type = \"text/javascript\";\n script.text = `\n ${errorOnDomInteraction.toString()};\n ${errorOnDomInteraction.name}();\n `;\n body.appendChild(script);\n body.removeChild(script);\n\n return (this._domSnapshot = body);\n }\n\n get withinDOM() {\n const snapScreen = Object.assign(within(this.domSnapshot), {\n debug: (\n ...[dom = this.domSnapshot, ...rest]: Parameters\n ) => {\n screen.debug(dom, ...rest);\n },\n logTestingPlaygroundURL: (\n ...[dom = this.domSnapshot, ...rest]: Parameters<\n typeof screen.logTestingPlaygroundURL\n >\n ) => {\n screen.logTestingPlaygroundURL(dom, ...rest);\n },\n });\n return () => snapScreen;\n }\n}\n/** @internal */\nexport function errorOnDomInteraction() {\n const events: Array = [\n \"auxclick\",\n \"blur\",\n \"change\",\n \"click\",\n \"copy\",\n \"cut\",\n \"dblclick\",\n \"drag\",\n \"dragend\",\n \"dragenter\",\n \"dragleave\",\n \"dragover\",\n \"dragstart\",\n \"drop\",\n \"focus\",\n \"focusin\",\n \"focusout\",\n \"input\",\n \"keydown\",\n \"keypress\",\n \"keyup\",\n \"mousedown\",\n \"mouseenter\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseout\",\n \"mouseover\",\n \"mouseup\",\n \"paste\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerenter\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerout\",\n \"pointerover\",\n \"pointerup\",\n \"scroll\",\n \"select\",\n \"selectionchange\",\n \"selectstart\",\n \"submit\",\n \"toggle\",\n \"touchcancel\",\n \"touchend\",\n \"touchmove\",\n \"touchstart\",\n \"wheel\",\n ];\n function warnOnDomInteraction() {\n throw new Error(`\n DOM interaction with a snapshot detected in test.\n Please don't interact with the DOM you get from \\`withinDOM\\`,\n but still use \\`screen\\' to get elements for simulating user interaction.\n `);\n }\n events.forEach((event) => {\n document.addEventListener(event, warnOnDomInteraction);\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.d.ts new file mode 100644 index 0000000..1b24f02 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.d.ts @@ -0,0 +1,10 @@ +import * as React from "react"; +export interface ProfilerContextValue { + renderedComponents: Array; +} +export declare function ProfilerContextProvider({ children, value, }: { + children: React.ReactNode; + value: ProfilerContextValue; +}): React.JSX.Element; +export declare function useProfilerContext(): ProfilerContextValue | undefined; +//# sourceMappingURL=context.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js new file mode 100644 index 0000000..51837f4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js @@ -0,0 +1,14 @@ +import * as React from "react"; +var ProfilerContext = React.createContext(undefined); +export function ProfilerContextProvider(_a) { + var children = _a.children, value = _a.value; + var parentContext = useProfilerContext(); + if (parentContext) { + throw new Error("Profilers should not be nested in the same tree"); + } + return (React.createElement(ProfilerContext.Provider, { value: value }, children)); +} +export function useProfilerContext() { + return React.useContext(ProfilerContext); +} +//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js.map new file mode 100644 index 0000000..08bcd80 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/context.js.map @@ -0,0 +1 @@ +{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,IAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CACzC,SAAS,CACV,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,EAMvC;QALC,QAAQ,cAAA,EACR,KAAK,WAAA;IAKL,IAAM,aAAa,GAAG,kBAAkB,EAAE,CAAC;IAE3C,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,CACL,oBAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IACnC,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import * as React from \"react\";\n\nexport interface ProfilerContextValue {\n renderedComponents: Array;\n}\n\nconst ProfilerContext = React.createContext(\n undefined\n);\n\nexport function ProfilerContextProvider({\n children,\n value,\n}: {\n children: React.ReactNode;\n value: ProfilerContextValue;\n}) {\n const parentContext = useProfilerContext();\n\n if (parentContext) {\n throw new Error(\"Profilers should not be nested in the same tree\");\n }\n\n return (\n \n {children}\n \n );\n}\n\nexport function useProfilerContext() {\n return React.useContext(ProfilerContext);\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.d.ts new file mode 100644 index 0000000..d149e66 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.d.ts @@ -0,0 +1,4 @@ +export type { NextRenderOptions, Profiler, ProfiledComponent, ProfiledHook, } from "./profile.js"; +export { createProfiler, profile, profileHook, useTrackRenders, WaitForRenderTimeoutError, } from "./profile.js"; +export type { SyncScreen } from "./Render.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js new file mode 100644 index 0000000..2dfa327 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js @@ -0,0 +1,2 @@ +export { createProfiler, profile, profileHook, useTrackRenders, WaitForRenderTimeoutError, } from "./profile.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js.map new file mode 100644 index 0000000..0c16182 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EACd,OAAO,EACP,WAAW,EACX,eAAe,EACf,yBAAyB,GAC1B,MAAM,cAAc,CAAC","sourcesContent":["export type {\n NextRenderOptions,\n Profiler,\n ProfiledComponent,\n ProfiledHook,\n} from \"./profile.js\";\nexport {\n createProfiler,\n profile,\n profileHook,\n useTrackRenders,\n WaitForRenderTimeoutError,\n} from \"./profile.js\";\n\nexport type { SyncScreen } from \"./Render.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.d.ts new file mode 100644 index 0000000..00ac53f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.d.ts @@ -0,0 +1,109 @@ +import * as React from "react"; +import type { Render, BaseRender } from "./Render.js"; +type ValidSnapshot = void | (object & { + call?: never; +}); +/** only used for passing around data internally */ +declare const _stackTrace: unique symbol; +/** @internal */ +export interface NextRenderOptions { + timeout?: number; + [_stackTrace]?: string; +} +/** @internal */ +interface ProfilerProps { + children: React.ReactNode; +} +/** @internal */ +export interface Profiler extends React.FC, ProfiledComponentFields, ProfiledComponentOnlyFields { +} +interface ReplaceSnapshot { + (newSnapshot: Snapshot): void; + (updateSnapshot: (lastSnapshot: Readonly) => Snapshot): void; +} +interface MergeSnapshot { + (partialSnapshot: Partial): void; + (updatePartialSnapshot: (lastSnapshot: Readonly) => Partial): void; +} +interface ProfiledComponentOnlyFields { + mergeSnapshot: MergeSnapshot; + replaceSnapshot: ReplaceSnapshot; +} +interface ProfiledComponentFields { + /** + * An array of all renders that have happened so far. + * Errors thrown during component render will be captured here, too. + */ + renders: Array | { + phase: "snapshotError"; + count: number; + error: unknown; + }>; + /** + * Peeks the next render from the current iterator position, without advancing the iterator. + * If no render has happened yet, it will wait for the next render to happen. + * @throws {WaitForRenderTimeoutError} if no render happens within the timeout + */ + peekRender(options?: NextRenderOptions): Promise>; + /** + * Iterates to the next render and returns it. + * If no render has happened yet, it will wait for the next render to happen. + * @throws {WaitForRenderTimeoutError} if no render happens within the timeout + */ + takeRender(options?: NextRenderOptions): Promise>; + /** + * Returns the total number of renders. + */ + totalRenderCount(): number; + /** + * Returns the current render. + * @throws {Error} if no render has happened yet + */ + getCurrentRender(): Render; + /** + * Waits for the next render to happen. + * Does not advance the render iterator. + */ + waitForNextRender(options?: NextRenderOptions): Promise>; +} +export interface ProfiledComponent extends React.FC, ProfiledComponentFields, ProfiledComponentOnlyFields { +} +/** @internal */ +export declare function profile({ Component, ...options }: Parameters>[0] & { + Component: React.ComponentType; +}): ProfiledComponent; +/** @internal */ +export declare function createProfiler({ onRender, snapshotDOM, initialSnapshot, skipNonTrackingRenders, }?: { + onRender?: (info: BaseRender & { + snapshot: Snapshot; + replaceSnapshot: ReplaceSnapshot; + mergeSnapshot: MergeSnapshot; + }) => void; + snapshotDOM?: boolean; + initialSnapshot?: Snapshot; + /** + * This will skip renders during which no renders tracked by + * `useTrackRenders` occured. + */ + skipNonTrackingRenders?: boolean; +}): Profiler; +/** @internal */ +export declare class WaitForRenderTimeoutError extends Error { + constructor(); +} +type StringReplaceRenderWithSnapshot = T extends `${infer Pre}Render${infer Post}` ? `${Pre}Snapshot${Post}` : T; +type ResultReplaceRenderWithSnapshot = T extends (...args: infer Args) => Render ? (...args: Args) => Snapshot : T extends (...args: infer Args) => Promise> ? (...args: Args) => Promise : T; +type ProfiledHookFields = ProfiledComponentFields extends infer PC ? { + [K in keyof PC as StringReplaceRenderWithSnapshot]: ResultReplaceRenderWithSnapshot; +} : never; +/** @internal */ +export interface ProfiledHook extends React.FC, ProfiledHookFields { + Profiler: Profiler; +} +/** @internal */ +export declare function profileHook(renderCallback: (props: Props) => ReturnValue): ProfiledHook; +export declare function useTrackRenders({ name }?: { + name?: string; +}): void; +export {}; +//# sourceMappingURL=profile.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js new file mode 100644 index 0000000..eae6e52 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js @@ -0,0 +1,296 @@ +var _a, _b; +import { __addDisposableResource, __assign, __awaiter, __disposeResources, __extends, __generator, __rest } from "tslib"; +import * as React from "react"; +import { TextEncoder, TextDecoder } from "util"; +(_a = global.TextEncoder) !== null && _a !== void 0 ? _a : (global.TextEncoder = TextEncoder); +// @ts-ignore +(_b = global.TextDecoder) !== null && _b !== void 0 ? _b : (global.TextDecoder = TextDecoder); +import { RenderInstance } from "./Render.js"; +import { applyStackTrace, captureStackTrace } from "./traces.js"; +import { ProfilerContextProvider, useProfilerContext } from "./context.js"; +import { disableActWarnings } from "../disposables/index.js"; +/** only used for passing around data internally */ +var _stackTrace = Symbol(); +/** @internal */ +export function profile(_a) { + var Component = _a.Component, options = __rest(_a, ["Component"]); + var Profiler = createProfiler(options); + return Object.assign(function ProfiledComponent(props) { + return (React.createElement(Profiler, null, + React.createElement(Component, __assign({}, props)))); + }, { + mergeSnapshot: Profiler.mergeSnapshot, + replaceSnapshot: Profiler.replaceSnapshot, + getCurrentRender: Profiler.getCurrentRender, + peekRender: Profiler.peekRender, + takeRender: Profiler.takeRender, + totalRenderCount: Profiler.totalRenderCount, + waitForNextRender: Profiler.waitForNextRender, + get renders() { + return Profiler.renders; + }, + }); +} +/** @internal */ +export function createProfiler(_a) { + var _b = _a === void 0 ? {} : _a, onRender = _b.onRender, _c = _b.snapshotDOM, snapshotDOM = _c === void 0 ? false : _c, initialSnapshot = _b.initialSnapshot, skipNonTrackingRenders = _b.skipNonTrackingRenders; + var nextRender; + var resolveNextRender; + var rejectNextRender; + var snapshotRef = { current: initialSnapshot }; + var replaceSnapshot = function (snap) { + if (typeof snap === "function") { + if (!initialSnapshot) { + throw new Error("Cannot use a function to update the snapshot if no initial snapshot was provided."); + } + snapshotRef.current = snap(typeof snapshotRef.current === "object" ? __assign({}, snapshotRef.current) : snapshotRef.current); + } + else { + snapshotRef.current = snap; + } + }; + var mergeSnapshot = function (partialSnapshot) { + replaceSnapshot(function (snapshot) { return (__assign(__assign({}, snapshot), (typeof partialSnapshot === "function" ? + partialSnapshot(snapshot) + : partialSnapshot))); }); + }; + var profilerContext = { + renderedComponents: [], + }; + var profilerOnRender = function (id, phase, actualDuration, baseDuration, startTime, commitTime) { + if (skipNonTrackingRenders && + profilerContext.renderedComponents.length === 0) { + return; + } + var baseRender = { + id: id, + phase: phase, + actualDuration: actualDuration, + baseDuration: baseDuration, + startTime: startTime, + commitTime: commitTime, + count: Profiler.renders.length + 1, + }; + try { + /* + * The `onRender` function could contain `expect` calls that throw + * `JestAssertionError`s - but we are still inside of React, where errors + * might be swallowed. + * So we record them and re-throw them in `takeRender` + * Additionally, we reject the `waitForNextRender` promise. + */ + onRender === null || onRender === void 0 ? void 0 : onRender(__assign(__assign({}, baseRender), { replaceSnapshot: replaceSnapshot, mergeSnapshot: mergeSnapshot, snapshot: snapshotRef.current })); + var snapshot = snapshotRef.current; + var domSnapshot = snapshotDOM ? window.document.body.innerHTML : undefined; + var render = new RenderInstance(baseRender, snapshot, domSnapshot, profilerContext.renderedComponents); + profilerContext.renderedComponents = []; + Profiler.renders.push(render); + resolveNextRender === null || resolveNextRender === void 0 ? void 0 : resolveNextRender(render); + } + catch (error) { + Profiler.renders.push({ + phase: "snapshotError", + count: Profiler.renders.length, + error: error, + }); + rejectNextRender === null || rejectNextRender === void 0 ? void 0 : rejectNextRender(error); + } + finally { + nextRender = resolveNextRender = rejectNextRender = undefined; + } + }; + var iteratorPosition = 0; + var Profiler = Object.assign(function (_a) { + var children = _a.children; + return (React.createElement(ProfilerContextProvider, { value: profilerContext }, + React.createElement(React.Profiler, { id: "test", onRender: profilerOnRender }, children))); + }, { + replaceSnapshot: replaceSnapshot, + mergeSnapshot: mergeSnapshot, + }, { + renders: new Array(), + totalRenderCount: function () { + return Profiler.renders.length; + }, + peekRender: function (options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var render; + var _a; + return __generator(this, function (_b) { + if (iteratorPosition < Profiler.renders.length) { + render = Profiler.renders[iteratorPosition]; + if (render.phase === "snapshotError") { + throw render.error; + } + return [2 /*return*/, render]; + } + return [2 /*return*/, Profiler.waitForNextRender(__assign((_a = {}, _a[_stackTrace] = captureStackTrace(Profiler.peekRender), _a), options))]; + }); + }); + }, + takeRender: function (options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var env_1, _disabledActWarnings, error, e_1, e_2; + var _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + env_1 = { stack: [], error: void 0, hasError: false }; + _b.label = 1; + case 1: + _b.trys.push([1, 7, 8, 9]); + _disabledActWarnings = __addDisposableResource(env_1, disableActWarnings(), false); + error = undefined; + _b.label = 2; + case 2: + _b.trys.push([2, 4, 5, 6]); + return [4 /*yield*/, Profiler.peekRender(__assign((_a = {}, _a[_stackTrace] = captureStackTrace(Profiler.takeRender), _a), options))]; + case 3: return [2 /*return*/, _b.sent()]; + case 4: + e_1 = _b.sent(); + error = e_1; + throw e_1; + case 5: + if (!(error && error instanceof WaitForRenderTimeoutError)) { + iteratorPosition++; + } + return [7 /*endfinally*/]; + case 6: return [3 /*break*/, 9]; + case 7: + e_2 = _b.sent(); + env_1.error = e_2; + env_1.hasError = true; + return [3 /*break*/, 9]; + case 8: + __disposeResources(env_1); + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + } + }); + }); + }, + getCurrentRender: function () { + // The "current" render should point at the same render that the most + // recent `takeRender` call returned, so we need to get the "previous" + // iterator position, otherwise `takeRender` advances the iterator + // to the next render. This means we need to call `takeRender` at least + // once before we can get a current render. + var currentPosition = iteratorPosition - 1; + if (currentPosition < 0) { + throw new Error("No current render available. You need to call `takeRender` before you can get the current render."); + } + var render = Profiler.renders[currentPosition]; + if (render.phase === "snapshotError") { + throw render.error; + } + return render; + }, + waitForNextRender: function (_a) { + var _b = _a === void 0 ? {} : _a, _c = _b.timeout, timeout = _c === void 0 ? 1000 : _c, + // capture the stack trace here so its stack trace is as close to the calling code as possible + _d = _stackTrace, + // capture the stack trace here so its stack trace is as close to the calling code as possible + _e = _b[_d], + // capture the stack trace here so its stack trace is as close to the calling code as possible + stackTrace = _e === void 0 ? captureStackTrace(Profiler.waitForNextRender) : _e; + if (!nextRender) { + nextRender = Promise.race([ + new Promise(function (resolve, reject) { + resolveNextRender = resolve; + rejectNextRender = reject; + }), + new Promise(function (_, reject) { + return setTimeout(function () { + return reject(applyStackTrace(new WaitForRenderTimeoutError(), stackTrace)); + }, timeout); + }), + ]); + } + return nextRender; + }, + }); + return Profiler; +} +/** @internal */ +var WaitForRenderTimeoutError = /** @class */ (function (_super) { + __extends(WaitForRenderTimeoutError, _super); + function WaitForRenderTimeoutError() { + var _newTarget = this.constructor; + var _this = _super.call(this, "Exceeded timeout waiting for next render.") || this; + Object.setPrototypeOf(_this, _newTarget.prototype); + return _this; + } + return WaitForRenderTimeoutError; +}(Error)); +export { WaitForRenderTimeoutError }; +/** @internal */ +export function profileHook(renderCallback) { + var Profiler = createProfiler(); + var ProfiledHook = function (props) { + Profiler.replaceSnapshot(renderCallback(props)); + return null; + }; + return Object.assign(function App(props) { + return (React.createElement(Profiler, null, + React.createElement(ProfiledHook, __assign({}, props)))); + }, { + Profiler: Profiler, + }, { + renders: Profiler.renders, + totalSnapshotCount: Profiler.totalRenderCount, + peekSnapshot: function (options) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, Profiler.peekRender(options)]; + case 1: return [2 /*return*/, (_a.sent()).snapshot]; + } + }); + }); + }, + takeSnapshot: function (options) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, Profiler.takeRender(options)]; + case 1: return [2 /*return*/, (_a.sent()).snapshot]; + } + }); + }); + }, + getCurrentSnapshot: function () { + return Profiler.getCurrentRender().snapshot; + }, + waitForNextSnapshot: function (options) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, Profiler.waitForNextRender(options)]; + case 1: return [2 /*return*/, (_a.sent()).snapshot]; + } + }); + }); + }, + }); +} +function resolveHookOwner() { + var _a, _b, _c; + return (_c = (_b = (_a = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _a === void 0 ? void 0 : _a.ReactCurrentOwner) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.elementType; +} +export function useTrackRenders(_a) { + var _b = _a === void 0 ? {} : _a, name = _b.name; + var component = name || resolveHookOwner(); + if (!component) { + throw new Error("useTrackRender: Unable to determine component. Please ensure the hook is called inside a rendered component or provide a `name` option."); + } + var ctx = useProfilerContext(); + if (!ctx) { + throw new Error("useTrackComponentRender: A Profiler must be created and rendered to track component renders"); + } + React.useLayoutEffect(function () { + ctx.renderedComponents.unshift(component); + }); +} +//# sourceMappingURL=profile.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js.map new file mode 100644 index 0000000..c18f8c6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/profile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/profile.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEhD,MAAA,MAAM,CAAC,WAAW,oCAAlB,MAAM,CAAC,WAAW,GAAK,WAAW,EAAC;AACnC,aAAa;AACb,MAAA,MAAM,CAAC,WAAW,oCAAlB,MAAM,CAAC,WAAW,GAAK,WAAW,EAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC3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;AAC9C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAAgC;QAAhC,qBAA8B,EAAE,KAAA,EAA9B,IAAI,UAAA;IACpC,IAAM,SAAS,GAAG,IAAI,IAAI,gBAAgB,EAAE,CAAC;IAE7C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,yIAAyI,CAC1I,CAAC;IACJ,CAAC;IAED,IAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;IAEjC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,eAAe,CAAC;QACpB,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as React from \"react\";\n\nimport { TextEncoder, TextDecoder } from \"util\";\n\nglobal.TextEncoder ??= TextEncoder;\n// @ts-ignore\nglobal.TextDecoder ??= TextDecoder;\nimport type { Render, BaseRender } from \"./Render.js\";\nimport { RenderInstance } from \"./Render.js\";\nimport { applyStackTrace, captureStackTrace } from \"./traces.js\";\nimport type { ProfilerContextValue } from \"./context.js\";\nimport { ProfilerContextProvider, useProfilerContext } from \"./context.js\";\nimport { disableActWarnings } from \"../disposables/index.js\";\n\ntype ValidSnapshot = void | (object & { /* not a function */ call?: never });\n\n/** only used for passing around data internally */\nconst _stackTrace = Symbol();\n/** @internal */\nexport interface NextRenderOptions {\n timeout?: number;\n [_stackTrace]?: string;\n}\n\n/** @internal */\ninterface ProfilerProps {\n children: React.ReactNode;\n}\n\n/** @internal */\nexport interface Profiler\n extends React.FC,\n ProfiledComponentFields,\n ProfiledComponentOnlyFields {}\n\ninterface ReplaceSnapshot {\n (newSnapshot: Snapshot): void;\n (updateSnapshot: (lastSnapshot: Readonly) => Snapshot): void;\n}\n\ninterface MergeSnapshot {\n (partialSnapshot: Partial): void;\n (\n updatePartialSnapshot: (\n lastSnapshot: Readonly\n ) => Partial\n ): void;\n}\n\ninterface ProfiledComponentOnlyFields {\n // Allows for partial updating of the snapshot by shallow merging the results\n mergeSnapshot: MergeSnapshot;\n // Performs a full replacement of the snapshot\n replaceSnapshot: ReplaceSnapshot;\n}\ninterface ProfiledComponentFields {\n /**\n * An array of all renders that have happened so far.\n * Errors thrown during component render will be captured here, too.\n */\n renders: Array<\n Render | { phase: \"snapshotError\"; count: number; error: unknown }\n >;\n /**\n * Peeks the next render from the current iterator position, without advancing the iterator.\n * If no render has happened yet, it will wait for the next render to happen.\n * @throws {WaitForRenderTimeoutError} if no render happens within the timeout\n */\n peekRender(options?: NextRenderOptions): Promise>;\n /**\n * Iterates to the next render and returns it.\n * If no render has happened yet, it will wait for the next render to happen.\n * @throws {WaitForRenderTimeoutError} if no render happens within the timeout\n */\n takeRender(options?: NextRenderOptions): Promise>;\n /**\n * Returns the total number of renders.\n */\n totalRenderCount(): number;\n /**\n * Returns the current render.\n * @throws {Error} if no render has happened yet\n */\n getCurrentRender(): Render;\n /**\n * Waits for the next render to happen.\n * Does not advance the render iterator.\n */\n waitForNextRender(options?: NextRenderOptions): Promise>;\n}\n\nexport interface ProfiledComponent\n extends React.FC,\n ProfiledComponentFields,\n ProfiledComponentOnlyFields {}\n\n/** @internal */\nexport function profile({\n Component,\n ...options\n}: Parameters>[0] & {\n Component: React.ComponentType;\n}): ProfiledComponent {\n const Profiler = createProfiler(options);\n\n return Object.assign(\n function ProfiledComponent(props: Props) {\n return (\n \n \n \n );\n },\n {\n mergeSnapshot: Profiler.mergeSnapshot,\n replaceSnapshot: Profiler.replaceSnapshot,\n getCurrentRender: Profiler.getCurrentRender,\n peekRender: Profiler.peekRender,\n takeRender: Profiler.takeRender,\n totalRenderCount: Profiler.totalRenderCount,\n waitForNextRender: Profiler.waitForNextRender,\n get renders() {\n return Profiler.renders;\n },\n }\n );\n}\n\n/** @internal */\nexport function createProfiler({\n onRender,\n snapshotDOM = false,\n initialSnapshot,\n skipNonTrackingRenders,\n}: {\n onRender?: (\n info: BaseRender & {\n snapshot: Snapshot;\n replaceSnapshot: ReplaceSnapshot;\n mergeSnapshot: MergeSnapshot;\n }\n ) => void;\n snapshotDOM?: boolean;\n initialSnapshot?: Snapshot;\n /**\n * This will skip renders during which no renders tracked by\n * `useTrackRenders` occured.\n */\n skipNonTrackingRenders?: boolean;\n} = {}) {\n let nextRender: Promise> | undefined;\n let resolveNextRender: ((render: Render) => void) | undefined;\n let rejectNextRender: ((error: unknown) => void) | undefined;\n const snapshotRef = { current: initialSnapshot };\n const replaceSnapshot: ReplaceSnapshot = (snap) => {\n if (typeof snap === \"function\") {\n if (!initialSnapshot) {\n throw new Error(\n \"Cannot use a function to update the snapshot if no initial snapshot was provided.\"\n );\n }\n snapshotRef.current = snap(\n typeof snapshotRef.current === \"object\" ?\n // \"cheap best effort\" to prevent accidental mutation of the last snapshot\n { ...snapshotRef.current! }\n : snapshotRef.current!\n );\n } else {\n snapshotRef.current = snap;\n }\n };\n\n const mergeSnapshot: MergeSnapshot = (partialSnapshot) => {\n replaceSnapshot((snapshot) => ({\n ...snapshot,\n ...(typeof partialSnapshot === \"function\" ?\n partialSnapshot(snapshot)\n : partialSnapshot),\n }));\n };\n\n const profilerContext: ProfilerContextValue = {\n renderedComponents: [],\n };\n\n const profilerOnRender: React.ProfilerOnRenderCallback = (\n id,\n phase,\n actualDuration,\n baseDuration,\n startTime,\n commitTime\n ) => {\n if (\n skipNonTrackingRenders &&\n profilerContext.renderedComponents.length === 0\n ) {\n return;\n }\n const baseRender = {\n id,\n phase,\n actualDuration,\n baseDuration,\n startTime,\n commitTime,\n count: Profiler.renders.length + 1,\n };\n try {\n /*\n * The `onRender` function could contain `expect` calls that throw\n * `JestAssertionError`s - but we are still inside of React, where errors\n * might be swallowed.\n * So we record them and re-throw them in `takeRender`\n * Additionally, we reject the `waitForNextRender` promise.\n */\n onRender?.({\n ...baseRender,\n replaceSnapshot,\n mergeSnapshot,\n snapshot: snapshotRef.current!,\n });\n\n const snapshot = snapshotRef.current as Snapshot;\n const domSnapshot =\n snapshotDOM ? window.document.body.innerHTML : undefined;\n const render = new RenderInstance(\n baseRender,\n snapshot,\n domSnapshot,\n profilerContext.renderedComponents\n );\n profilerContext.renderedComponents = [];\n Profiler.renders.push(render);\n resolveNextRender?.(render);\n } catch (error) {\n Profiler.renders.push({\n phase: \"snapshotError\",\n count: Profiler.renders.length,\n error,\n });\n rejectNextRender?.(error);\n } finally {\n nextRender = resolveNextRender = rejectNextRender = undefined;\n }\n };\n\n let iteratorPosition = 0;\n const Profiler: Profiler = Object.assign(\n ({ children }: ProfilerProps) => {\n return (\n \n \n {children}\n \n \n );\n },\n {\n replaceSnapshot,\n mergeSnapshot,\n } satisfies ProfiledComponentOnlyFields,\n {\n renders: new Array<\n | Render\n | { phase: \"snapshotError\"; count: number; error: unknown }\n >(),\n totalRenderCount() {\n return Profiler.renders.length;\n },\n async peekRender(options: NextRenderOptions = {}) {\n if (iteratorPosition < Profiler.renders.length) {\n const render = Profiler.renders[iteratorPosition];\n\n if (render.phase === \"snapshotError\") {\n throw render.error;\n }\n\n return render;\n }\n return Profiler.waitForNextRender({\n [_stackTrace]: captureStackTrace(Profiler.peekRender),\n ...options,\n });\n },\n async takeRender(options: NextRenderOptions = {}) {\n // In many cases we do not control the resolution of the suspended\n // promise which results in noisy tests when the profiler due to\n // repeated act warnings.\n using _disabledActWarnings = disableActWarnings();\n\n let error: unknown = undefined;\n\n try {\n return await Profiler.peekRender({\n [_stackTrace]: captureStackTrace(Profiler.takeRender),\n ...options,\n });\n } catch (e) {\n error = e;\n throw e;\n } finally {\n if (!(error && error instanceof WaitForRenderTimeoutError)) {\n iteratorPosition++;\n }\n }\n },\n getCurrentRender() {\n // The \"current\" render should point at the same render that the most\n // recent `takeRender` call returned, so we need to get the \"previous\"\n // iterator position, otherwise `takeRender` advances the iterator\n // to the next render. This means we need to call `takeRender` at least\n // once before we can get a current render.\n const currentPosition = iteratorPosition - 1;\n\n if (currentPosition < 0) {\n throw new Error(\n \"No current render available. You need to call `takeRender` before you can get the current render.\"\n );\n }\n\n const render = Profiler.renders[currentPosition];\n\n if (render.phase === \"snapshotError\") {\n throw render.error;\n }\n return render;\n },\n waitForNextRender({\n timeout = 1000,\n // capture the stack trace here so its stack trace is as close to the calling code as possible\n [_stackTrace]: stackTrace = captureStackTrace(\n Profiler.waitForNextRender\n ),\n }: NextRenderOptions = {}) {\n if (!nextRender) {\n nextRender = Promise.race>([\n new Promise>((resolve, reject) => {\n resolveNextRender = resolve;\n rejectNextRender = reject;\n }),\n new Promise>((_, reject) =>\n setTimeout(\n () =>\n reject(\n applyStackTrace(new WaitForRenderTimeoutError(), stackTrace)\n ),\n timeout\n )\n ),\n ]);\n }\n return nextRender;\n },\n } satisfies ProfiledComponentFields\n );\n return Profiler;\n}\n\n/** @internal */\nexport class WaitForRenderTimeoutError extends Error {\n constructor() {\n super(\"Exceeded timeout waiting for next render.\");\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\ntype StringReplaceRenderWithSnapshot =\n T extends `${infer Pre}Render${infer Post}` ? `${Pre}Snapshot${Post}` : T;\n\ntype ResultReplaceRenderWithSnapshot =\n T extends (...args: infer Args) => Render ?\n (...args: Args) => Snapshot\n : T extends (...args: infer Args) => Promise> ?\n (...args: Args) => Promise\n : T;\n\ntype ProfiledHookFields =\n ProfiledComponentFields extends infer PC ?\n {\n [K in keyof PC as StringReplaceRenderWithSnapshot<\n K & string\n >]: ResultReplaceRenderWithSnapshot;\n }\n : never;\n\n/** @internal */\nexport interface ProfiledHook\n extends React.FC,\n ProfiledHookFields {\n Profiler: Profiler;\n}\n\n/** @internal */\nexport function profileHook(\n renderCallback: (props: Props) => ReturnValue\n): ProfiledHook {\n const Profiler = createProfiler();\n\n const ProfiledHook = (props: Props) => {\n Profiler.replaceSnapshot(renderCallback(props));\n return null;\n };\n\n return Object.assign(\n function App(props: Props) {\n return (\n \n \n \n );\n },\n {\n Profiler,\n },\n {\n renders: Profiler.renders,\n totalSnapshotCount: Profiler.totalRenderCount,\n async peekSnapshot(options) {\n return (await Profiler.peekRender(options)).snapshot;\n },\n async takeSnapshot(options) {\n return (await Profiler.takeRender(options)).snapshot;\n },\n getCurrentSnapshot() {\n return Profiler.getCurrentRender().snapshot;\n },\n async waitForNextSnapshot(options) {\n return (await Profiler.waitForNextRender(options)).snapshot;\n },\n } satisfies ProfiledHookFields\n );\n}\n\nfunction resolveHookOwner(): React.ComponentType | undefined {\n return (React as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n ?.ReactCurrentOwner?.current?.elementType;\n}\n\nexport function useTrackRenders({ name }: { name?: string } = {}) {\n const component = name || resolveHookOwner();\n\n if (!component) {\n throw new Error(\n \"useTrackRender: Unable to determine component. Please ensure the hook is called inside a rendered component or provide a `name` option.\"\n );\n }\n\n const ctx = useProfilerContext();\n\n if (!ctx) {\n throw new Error(\n \"useTrackComponentRender: A Profiler must be created and rendered to track component renders\"\n );\n }\n\n React.useLayoutEffect(() => {\n ctx.renderedComponents.unshift(component);\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.d.ts new file mode 100644 index 0000000..8ddfe65 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.d.ts @@ -0,0 +1,7 @@ +/** + * Captures a StackTrace and (if passed) cuts off + * the first lines including the calling function. + */ +export declare function captureStackTrace(callingFunction?: string | (() => {})): string; +export declare function applyStackTrace(error: Error, stackTrace: string): Error; +//# sourceMappingURL=traces.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js new file mode 100644 index 0000000..eed0725 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js @@ -0,0 +1,30 @@ +/** + * Captures a StackTrace and (if passed) cuts off + * the first lines including the calling function. + */ +export function captureStackTrace(callingFunction) { + var stack = ""; + try { + throw new Error(""); + } + catch (e) { + (stack = e.stack); + } + var callerName = typeof callingFunction === "string" ? callingFunction + : callingFunction ? callingFunction.name + : undefined; + if (callerName && stack.includes(callerName)) { + var lines = stack.split("\n"); + stack = lines + .slice( + // @ts-expect-error this is too old of a TS target, but node has it + lines.findLastIndex(function (line) { return line.includes(callerName); }) + 1) + .join("\n"); + } + return stack; +} +export function applyStackTrace(error, stackTrace) { + error.stack = error.message + "\n" + stackTrace; + return error; +} +//# sourceMappingURL=traces.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js.map new file mode 100644 index 0000000..9dbd95f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/profile/traces.js.map @@ -0,0 +1 @@ +{"version":3,"file":"traces.js","sourceRoot":"","sources":["../../../../src/testing/internal/profile/traces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,eAAqC;IACrE,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,CAAG,KAAK,GAAK,CAAC,MAAN,CAAO,CAAC;IAClB,CAAC;IAED,IAAM,UAAU,GACd,OAAO,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe;QACrD,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI;YACxC,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,UAAU,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEhC,KAAK,GAAG,KAAK;aACV,KAAK;QACJ,mEAAmE;QACnE,KAAK,CAAC,aAAa,CAAC,UAAC,IAAY,IAAK,OAAA,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAzB,CAAyB,CAAC,GAAG,CAAC,CACrE;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAY,EAAE,UAAkB;IAC9D,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,UAAU,CAAC;IAChD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Captures a StackTrace and (if passed) cuts off\n * the first lines including the calling function.\n */\nexport function captureStackTrace(callingFunction?: string | (() => {})) {\n let stack = \"\";\n try {\n throw new Error(\"\");\n } catch (e: any) {\n ({ stack } = e);\n }\n\n const callerName =\n typeof callingFunction === \"string\" ? callingFunction\n : callingFunction ? callingFunction.name\n : undefined;\n\n if (callerName && stack.includes(callerName)) {\n const lines = stack.split(\"\\n\");\n\n stack = lines\n .slice(\n // @ts-expect-error this is too old of a TS target, but node has it\n lines.findLastIndex((line: string) => line.includes(callerName)) + 1\n )\n .join(\"\\n\");\n }\n\n return stack;\n}\n\nexport function applyStackTrace(error: Error, stackTrace: string) {\n error.stack = error.message + \"\\n\" + stackTrace;\n return error;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.d.ts new file mode 100644 index 0000000..51b34b2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.d.ts @@ -0,0 +1,12 @@ +import type { ReactElement } from "react"; +import type { Queries, RenderOptions, queries } from "@testing-library/react"; +import type { ApolloClient } from "../../core/index.js"; +import type { MockedProviderProps } from "../react/MockedProvider.js"; +export interface RenderWithClientOptions extends RenderOptions { + client: ApolloClient; +} +export declare function renderWithClient(ui: ReactElement, { client, wrapper: Wrapper, ...renderOptions }: RenderWithClientOptions): import("@testing-library/react").RenderResult; +export interface RenderWithMocksOptions extends RenderOptions, MockedProviderProps { +} +export declare function renderWithMocks(ui: ReactElement, { wrapper: Wrapper, ...renderOptions }: RenderWithMocksOptions): import("@testing-library/react").RenderResult; +//# sourceMappingURL=renderHelpers.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js new file mode 100644 index 0000000..b51cac3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js @@ -0,0 +1,22 @@ +import { __assign, __rest } from "tslib"; +import * as React from "react"; +import { render } from "@testing-library/react"; +import { ApolloProvider } from "../../react/index.js"; +import { MockedProvider } from "../react/MockedProvider.js"; +export function renderWithClient(ui, _a) { + var client = _a.client, _b = _a.wrapper, Wrapper = _b === void 0 ? React.Fragment : _b, renderOptions = __rest(_a, ["client", "wrapper"]); + return render(ui, __assign(__assign({}, renderOptions), { wrapper: function (_a) { + var children = _a.children; + return (React.createElement(ApolloProvider, { client: client }, + React.createElement(Wrapper, null, children))); + } })); +} +export function renderWithMocks(ui, _a) { + var _b = _a.wrapper, Wrapper = _b === void 0 ? React.Fragment : _b, renderOptions = __rest(_a, ["wrapper"]); + return render(ui, __assign(__assign({}, renderOptions), { wrapper: function (_a) { + var children = _a.children; + return (React.createElement(MockedProvider, __assign({}, renderOptions), + React.createElement(Wrapper, null, children))); + } })); +} +//# sourceMappingURL=renderHelpers.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js.map new file mode 100644 index 0000000..fc6c9e2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/renderHelpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"renderHelpers.js","sourceRoot":"","sources":["../../../src/testing/internal/renderHelpers.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAU5D,MAAM,UAAU,gBAAgB,CAK9B,EAAgB,EAChB,EAIqD;IAHnD,IAAA,MAAM,YAAA,EACN,eAAiC,EAAxB,OAAO,mBAAG,KAAK,CAAC,QAAQ,KAAA,EAC9B,aAAa,cAHlB,qBAIC,CADiB;IAGlB,OAAO,MAAM,CAAC,EAAE,wBACX,aAAa,KAChB,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAClB,OAAO,CACL,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM;gBAC5B,oBAAC,OAAO,QAAE,QAAQ,CAAW,CACd,CAClB,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC;AASD,MAAM,UAAU,eAAe,CAK7B,EAAgB,EAChB,EAGoD;IAFlD,IAAA,eAAiC,EAAxB,OAAO,mBAAG,KAAK,CAAC,QAAQ,KAAA,EAC9B,aAAa,cAFlB,WAGC,CADiB;IAGlB,OAAO,MAAM,CAAC,EAAE,wBACX,aAAa,KAChB,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAClB,OAAO,CACL,oBAAC,cAAc,eAAK,aAAa;gBAC/B,oBAAC,OAAO,QAAE,QAAQ,CAAW,CACd,CAClB,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC","sourcesContent":["import * as React from \"react\";\nimport type { ReactElement } from \"react\";\nimport { render } from \"@testing-library/react\";\nimport type { Queries, RenderOptions, queries } from \"@testing-library/react\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport { ApolloProvider } from \"../../react/index.js\";\nimport type { MockedProviderProps } from \"../react/MockedProvider.js\";\nimport { MockedProvider } from \"../react/MockedProvider.js\";\n\nexport interface RenderWithClientOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions {\n client: ApolloClient;\n}\n\nexport function renderWithClient<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n client,\n wrapper: Wrapper = React.Fragment,\n ...renderOptions\n }: RenderWithClientOptions\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: ({ children }) => {\n return (\n \n {children}\n \n );\n },\n });\n}\n\nexport interface RenderWithMocksOptions<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n> extends RenderOptions,\n MockedProviderProps {}\n\nexport function renderWithMocks<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container,\n>(\n ui: ReactElement,\n {\n wrapper: Wrapper = React.Fragment,\n ...renderOptions\n }: RenderWithMocksOptions\n) {\n return render(ui, {\n ...renderOptions,\n wrapper: ({ children }) => {\n return (\n \n {children}\n \n );\n },\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.d.ts new file mode 100644 index 0000000..883559f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.d.ts @@ -0,0 +1,41 @@ +import { ApolloLink } from "../../../core/index.js"; +import type { TypedDocumentNode } from "../../../core/index.js"; +import type { MockedResponse } from "../../core/index.js"; +export interface SimpleCaseData { + greeting: string; +} +export declare function setupSimpleCase(): { + query: TypedDocumentNode>; + mocks: MockedResponse>[]; +}; +export interface VariablesCaseData { + character: { + __typename: "Character"; + id: string; + name: string; + }; +} +export interface VariablesCaseVariables { + id: string; +} +export declare function setupVariablesCase(): { + mocks: MockedResponse>[]; + query: TypedDocumentNode; +}; +interface Letter { + letter: string; + position: number; +} +export interface PaginatedCaseData { + letters: Letter[]; +} +export interface PaginatedCaseVariables { + limit?: number; + offset?: number; +} +export declare function setupPaginatedCase(): { + query: TypedDocumentNode; + link: ApolloLink; +}; +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js b/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js new file mode 100644 index 0000000..d582f91 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js @@ -0,0 +1,48 @@ +import { __makeTemplateObject, __spreadArray } from "tslib"; +import { ApolloLink, Observable, gql } from "../../../core/index.js"; +export function setupSimpleCase() { + var query = gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query GreetingQuery {\n greeting\n }\n "], ["\n query GreetingQuery {\n greeting\n }\n "]))); + var mocks = [ + { + request: { query: query }, + result: { data: { greeting: "Hello" } }, + delay: 10, + }, + ]; + return { query: query, mocks: mocks }; +} +export function setupVariablesCase() { + var query = gql(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query CharacterQuery($id: ID!) {\n character(id: $id) {\n id\n name\n }\n }\n "], ["\n query CharacterQuery($id: ID!) {\n character(id: $id) {\n id\n name\n }\n }\n "]))); + var CHARACTERS = ["Spider-Man", "Black Widow", "Iron Man", "Hulk"]; + var mocks = __spreadArray([], CHARACTERS, true).map(function (name, index) { return ({ + request: { query: query, variables: { id: String(index + 1) } }, + result: { + data: { + character: { __typename: "Character", id: String(index + 1), name: name }, + }, + }, + delay: 20, + }); }); + return { mocks: mocks, query: query }; +} +export function setupPaginatedCase() { + var query = gql(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n query letters($limit: Int, $offset: Int) {\n letters(limit: $limit) {\n letter\n position\n }\n }\n "], ["\n query letters($limit: Int, $offset: Int) {\n letters(limit: $limit) {\n letter\n position\n }\n }\n "]))); + var data = "ABCDEFGHIJKLMNOPQRSTUV".split("").map(function (letter, index) { return ({ + __typename: "Letter", + letter: letter, + position: index + 1, + }); }); + var link = new ApolloLink(function (operation) { + var _a = operation.variables, _b = _a.offset, offset = _b === void 0 ? 0 : _b, _c = _a.limit, limit = _c === void 0 ? 2 : _c; + var letters = data.slice(offset, offset + limit); + return new Observable(function (observer) { + setTimeout(function () { + observer.next({ data: { letters: letters } }); + observer.complete(); + }, 10); + }); + }); + return { query: query, link: link }; +} +var templateObject_1, templateObject_2, templateObject_3; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js.map b/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js.map new file mode 100644 index 0000000..6ba1ec0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/internal/scenarios/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/testing/internal/scenarios/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAQrE,MAAM,UAAU,eAAe;IAC7B,IAAM,KAAK,GAA6D,GAAG,2HAAA,wDAI1E,IAAA,CAAC;IAEF,IAAM,KAAK,GAAqC;QAC9C;YACE,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE;YAClB,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;YACvC,KAAK,EAAE,EAAE;SACV;KACF,CAAC;IAEF,OAAO,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,EAAE,CAAC;AAC1B,CAAC;AAcD,MAAM,UAAU,kBAAkB;IAChC,IAAM,KAAK,GACT,GAAG,mMAAA,gIAOF,IAAA,CAAC;IACJ,I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,QAAQ;YAC7B,UAAU,CAAC;gBACT,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,EAAE,CAAC,CAAC;gBACrC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,OAAA,EAAE,IAAI,MAAA,EAAE,CAAC;AACzB,CAAC","sourcesContent":["import { ApolloLink, Observable, gql } from \"../../../core/index.js\";\nimport type { TypedDocumentNode } from \"../../../core/index.js\";\nimport type { MockedResponse } from \"../../core/index.js\";\n\nexport interface SimpleCaseData {\n greeting: string;\n}\n\nexport function setupSimpleCase() {\n const query: TypedDocumentNode> = gql`\n query GreetingQuery {\n greeting\n }\n `;\n\n const mocks: MockedResponse[] = [\n {\n request: { query },\n result: { data: { greeting: \"Hello\" } },\n delay: 10,\n },\n ];\n\n return { query, mocks };\n}\n\nexport interface VariablesCaseData {\n character: {\n __typename: \"Character\";\n id: string;\n name: string;\n };\n}\n\nexport interface VariablesCaseVariables {\n id: string;\n}\n\nexport function setupVariablesCase() {\n const query: TypedDocumentNode =\n gql`\n query CharacterQuery($id: ID!) {\n character(id: $id) {\n id\n name\n }\n }\n `;\n const CHARACTERS = [\"Spider-Man\", \"Black Widow\", \"Iron Man\", \"Hulk\"];\n\n const mocks: MockedResponse[] = [...CHARACTERS].map(\n (name, index) => ({\n request: { query, variables: { id: String(index + 1) } },\n result: {\n data: {\n character: { __typename: \"Character\", id: String(index + 1), name },\n },\n },\n delay: 20,\n })\n );\n\n return { mocks, query };\n}\n\ninterface Letter {\n letter: string;\n position: number;\n}\n\nexport interface PaginatedCaseData {\n letters: Letter[];\n}\n\nexport interface PaginatedCaseVariables {\n limit?: number;\n offset?: number;\n}\n\nexport function setupPaginatedCase() {\n const query: TypedDocumentNode =\n gql`\n query letters($limit: Int, $offset: Int) {\n letters(limit: $limit) {\n letter\n position\n }\n }\n `;\n\n const data = \"ABCDEFGHIJKLMNOPQRSTUV\".split(\"\").map((letter, index) => ({\n __typename: \"Letter\",\n letter,\n position: index + 1,\n }));\n\n const link = new ApolloLink((operation) => {\n const { offset = 0, limit = 2 } = operation.variables;\n const letters = data.slice(offset, offset + limit);\n\n return new Observable((observer) => {\n setTimeout(() => {\n observer.next({ data: { letters } });\n observer.complete();\n }, 10);\n });\n });\n\n return { query, link };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.d.ts new file mode 100644 index 0000000..93a5e44 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.d.ts @@ -0,0 +1,8 @@ +import type { MatcherFunction } from "expect"; +import type { NextRenderOptions } from "../internal/index.js"; +export declare const toRerender: MatcherFunction<[options?: NextRenderOptions]>; +export declare const toRenderExactlyTimes: MatcherFunction<[ + times: number, + options?: NextRenderOptions +]>; +//# sourceMappingURL=ProfiledComponent.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js b/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js new file mode 100644 index 0000000..a3ef5c1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js @@ -0,0 +1,110 @@ +import { __assign, __awaiter, __generator } from "tslib"; +import { WaitForRenderTimeoutError } from "../internal/index.js"; +export var toRerender = function (actual, options) { + return __awaiter(this, void 0, void 0, function () { + var _profiler, profiler, hint, pass, e_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _profiler = actual; + profiler = "Profiler" in _profiler ? _profiler.Profiler : _profiler; + hint = this.utils.matcherHint("toRerender", "ProfiledComponent", ""); + pass = true; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, profiler.peekRender(__assign({ timeout: 100 }, options))]; + case 2: + _a.sent(); + return [3 /*break*/, 4]; + case 3: + e_1 = _a.sent(); + if (e_1 instanceof WaitForRenderTimeoutError) { + pass = false; + } + else { + throw e_1; + } + return [3 /*break*/, 4]; + case 4: return [2 /*return*/, { + pass: pass, + message: function () { + return (hint + + "\n\nExpected component to".concat(pass ? " not" : "", " rerender, ") + + "but it did".concat(pass ? "" : " not", ".")); + }, + }]; + } + }); + }); +}; +/** to be thrown to "break" test execution and fail it */ +var failed = {}; +export var toRenderExactlyTimes = function (actual, times, optionsPerRender) { + return __awaiter(this, void 0, void 0, function () { + var _profiler, profiler, options, hint, pass, e_2, e_3, e_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _profiler = actual; + profiler = "Profiler" in _profiler ? _profiler.Profiler : _profiler; + options = __assign({ timeout: 100 }, optionsPerRender); + hint = this.utils.matcherHint("toRenderExactlyTimes"); + pass = true; + _a.label = 1; + case 1: + _a.trys.push([1, 11, , 12]); + if (profiler.totalRenderCount() > times) { + throw failed; + } + _a.label = 2; + case 2: + _a.trys.push([2, 6, , 7]); + _a.label = 3; + case 3: + if (!(profiler.totalRenderCount() < times)) return [3 /*break*/, 5]; + return [4 /*yield*/, profiler.waitForNextRender(options)]; + case 4: + _a.sent(); + return [3 /*break*/, 3]; + case 5: return [3 /*break*/, 7]; + case 6: + e_2 = _a.sent(); + // timeouts here should just fail the test, rethrow other errors + throw e_2 instanceof WaitForRenderTimeoutError ? failed : e_2; + case 7: + _a.trys.push([7, 9, , 10]); + return [4 /*yield*/, profiler.waitForNextRender(options)]; + case 8: + _a.sent(); + return [3 /*break*/, 10]; + case 9: + e_3 = _a.sent(); + // we are expecting a timeout here, so swallow that error, rethrow others + if (!(e_3 instanceof WaitForRenderTimeoutError)) { + throw e_3; + } + return [3 /*break*/, 10]; + case 10: return [3 /*break*/, 12]; + case 11: + e_4 = _a.sent(); + if (e_4 === failed) { + pass = false; + } + else { + throw e_4; + } + return [3 /*break*/, 12]; + case 12: return [2 /*return*/, { + pass: pass, + message: function () { + return (hint + + " Expected component to".concat(pass ? " not" : "", " render exactly ").concat(times, ".") + + " It rendered ".concat(profiler.totalRenderCount(), " times.")); + }, + }]; + } + }); + }); +}; +//# sourceMappingURL=ProfiledComponent.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js.map b/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js.map new file mode 100644 index 0000000..d63997d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/ProfiledComponent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ProfiledComponent.js","sourceRoot":"","sources":["../../../src/testing/matchers/ProfiledComponent.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAQjE,MAAM,CAAC,IAAM,UAAU,GACrB,UAAgB,MAAM,EAAE,OAAO;;;;;;oBACvB,SAAS,GAAG,MAGQ,CAAC;oBACrB,QAAQ,GAAG,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;oBACpE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC;oBACvE,IAAI,GAAG,IAAI,CAAC;;;;oBAEd,qBAAM,QAAQ,CAAC,UAAU,YAAG,OAAO,EAAE,GAAG,IAAK,OAAO,EAAG,EAAA;;oBAAvD,SAAuD,CAAC;;;;oBAExD,IAAI,GAAC,YAAY,yBAAyB,EAAE,CAAC;wBAC3C,IAAI,GAAG,KAAK,CAAC;oBACf,CAAC;yBAAM,CAAC;wBACN,MAAM,GAAC,CAAC;oBACV,CAAC;;wBAGH,sBAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,mCAA4B,IAAI,CAAC,CAAC,CAA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AAC;wBACjB,IAAI,GAAG,KAAK,CAAC;oBACf,CAAC;yBAAM,CAAC;wBACN,MAAM,GAAC,CAAC;oBACV,CAAC;;yBAEH,sBAAO;wBACL,IAAI,MAAA;wBACJ,OAAO;4BACL,OAAO,CACL,IAAI;gCACJ,gCAAyB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,6BAAmB,KAAK,MAAG;gCACtE,uBAAgB,QAAQ,CAAC,gBAAgB,EAAE,YAAS,CACrD,CAAC;wBACJ,CAAC;qBACF,EAAC;;;;CACH,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport { WaitForRenderTimeoutError } from \"../internal/index.js\";\nimport type {\n NextRenderOptions,\n Profiler,\n ProfiledComponent,\n ProfiledHook,\n} from \"../internal/index.js\";\n\nexport const toRerender: MatcherFunction<[options?: NextRenderOptions]> =\n async function (actual, options) {\n const _profiler = actual as\n | Profiler\n | ProfiledComponent\n | ProfiledHook;\n const profiler = \"Profiler\" in _profiler ? _profiler.Profiler : _profiler;\n const hint = this.utils.matcherHint(\"toRerender\", \"ProfiledComponent\", \"\");\n let pass = true;\n try {\n await profiler.peekRender({ timeout: 100, ...options });\n } catch (e) {\n if (e instanceof WaitForRenderTimeoutError) {\n pass = false;\n } else {\n throw e;\n }\n }\n\n return {\n pass,\n message() {\n return (\n hint +\n `\\n\\nExpected component to${pass ? \" not\" : \"\"} rerender, ` +\n `but it did${pass ? \"\" : \" not\"}.`\n );\n },\n };\n };\n\n/** to be thrown to \"break\" test execution and fail it */\nconst failed = {};\n\nexport const toRenderExactlyTimes: MatcherFunction<\n [times: number, options?: NextRenderOptions]\n> = async function (actual, times, optionsPerRender) {\n const _profiler = actual as\n | Profiler\n | ProfiledComponent\n | ProfiledHook;\n const profiler = \"Profiler\" in _profiler ? _profiler.Profiler : _profiler;\n const options = { timeout: 100, ...optionsPerRender };\n const hint = this.utils.matcherHint(\"toRenderExactlyTimes\");\n let pass = true;\n try {\n if (profiler.totalRenderCount() > times) {\n throw failed;\n }\n try {\n while (profiler.totalRenderCount() < times) {\n await profiler.waitForNextRender(options);\n }\n } catch (e) {\n // timeouts here should just fail the test, rethrow other errors\n throw e instanceof WaitForRenderTimeoutError ? failed : e;\n }\n try {\n await profiler.waitForNextRender(options);\n } catch (e) {\n // we are expecting a timeout here, so swallow that error, rethrow others\n if (!(e instanceof WaitForRenderTimeoutError)) {\n throw e;\n }\n }\n } catch (e) {\n if (e === failed) {\n pass = false;\n } else {\n throw e;\n }\n }\n return {\n pass,\n message() {\n return (\n hint +\n ` Expected component to${pass ? \" not\" : \"\"} render exactly ${times}.` +\n ` It rendered ${profiler.totalRenderCount()} times.`\n );\n },\n };\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.d.ts new file mode 100644 index 0000000..e26a57a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js b/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js new file mode 100644 index 0000000..a04bf3a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js @@ -0,0 +1,15 @@ +import { expect } from "@jest/globals"; +import { toMatchDocument } from "./toMatchDocument.js"; +import { toHaveSuspenseCacheEntryUsing } from "./toHaveSuspenseCacheEntryUsing.js"; +import { toRerender, toRenderExactlyTimes } from "./ProfiledComponent.js"; +import { toBeGarbageCollected } from "./toBeGarbageCollected.js"; +import { toBeDisposed } from "./toBeDisposed.js"; +expect.extend({ + toBeDisposed: toBeDisposed, + toHaveSuspenseCacheEntryUsing: toHaveSuspenseCacheEntryUsing, + toMatchDocument: toMatchDocument, + toRerender: toRerender, + toRenderExactlyTimes: toRenderExactlyTimes, + toBeGarbageCollected: toBeGarbageCollected, +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js.map b/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js.map new file mode 100644 index 0000000..fe82508 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/matchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,CAAC;IACZ,YAAY,cAAA;IACZ,6BAA6B,+BAAA;IAC7B,eAAe,iBAAA;IACf,UAAU,YAAA;IACV,oBAAoB,sBAAA;IACpB,oBAAoB,sBAAA;CACrB,CAAC,CAAC","sourcesContent":["import { expect } from \"@jest/globals\";\nimport { toMatchDocument } from \"./toMatchDocument.js\";\nimport { toHaveSuspenseCacheEntryUsing } from \"./toHaveSuspenseCacheEntryUsing.js\";\nimport { toRerender, toRenderExactlyTimes } from \"./ProfiledComponent.js\";\nimport { toBeGarbageCollected } from \"./toBeGarbageCollected.js\";\nimport { toBeDisposed } from \"./toBeDisposed.js\";\n\nexpect.extend({\n toBeDisposed,\n toHaveSuspenseCacheEntryUsing,\n toMatchDocument,\n toRerender,\n toRenderExactlyTimes,\n toBeGarbageCollected,\n});\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.d.ts new file mode 100644 index 0000000..ed0c720 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.d.ts @@ -0,0 +1,3 @@ +import type { MatcherFunction } from "expect"; +export declare const toBeDisposed: MatcherFunction<[]>; +//# sourceMappingURL=toBeDisposed.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js new file mode 100644 index 0000000..50649c2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js @@ -0,0 +1,26 @@ +import { InternalQueryReference, unwrapQueryRef, } from "../../react/internal/index.js"; +function isQueryRef(queryRef) { + try { + return unwrapQueryRef(queryRef) instanceof InternalQueryReference; + } + catch (e) { + return false; + } +} +export var toBeDisposed = function (queryRef) { + var _this = this; + var hint = this.utils.matcherHint("toBeDisposed", "queryRef", "", { + isNot: this.isNot, + }); + if (!isQueryRef(queryRef)) { + throw new Error("\n".concat(hint, "\n\nmust be called with a valid QueryReference")); + } + var pass = unwrapQueryRef(queryRef).disposed; + return { + pass: pass, + message: function () { + return "".concat(hint, "\n\nExpected queryRef ").concat(_this.isNot ? "not " : "", "to be disposed, but it was").concat(_this.isNot ? "" : " not", "."); + }, + }; +}; +//# sourceMappingURL=toBeDisposed.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js.map b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js.map new file mode 100644 index 0000000..18020f1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeDisposed.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toBeDisposed.js","sourceRoot":"","sources":["../../../src/testing/matchers/toBeDisposed.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC,SAAS,UAAU,CAAC,QAAiB;IACnC,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,QAAe,CAAC,YAAY,sBAAsB,CAAC;IAC3E,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,IAAM,YAAY,GAAwB,UAAU,QAAQ;IAAlB,iBAmBhD;IAlBC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE;QAClE,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,YAAK,IAAI,mDAAgD,CAAC,CAAC;IAC7E,CAAC;IAED,IAAM,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;IAE/C,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP,OAAO,UAAG,IAAI,mCACZ,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,uCACG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,MAAG,CAAC;QAC3D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport type { QueryReference } from \"../../react/internal/index.js\";\nimport {\n InternalQueryReference,\n unwrapQueryRef,\n} from \"../../react/internal/index.js\";\n\nfunction isQueryRef(queryRef: unknown): queryRef is QueryReference {\n try {\n return unwrapQueryRef(queryRef as any) instanceof InternalQueryReference;\n } catch (e) {\n return false;\n }\n}\n\nexport const toBeDisposed: MatcherFunction<[]> = function (queryRef) {\n const hint = this.utils.matcherHint(\"toBeDisposed\", \"queryRef\", \"\", {\n isNot: this.isNot,\n });\n\n if (!isQueryRef(queryRef)) {\n throw new Error(`\\n${hint}\\n\\nmust be called with a valid QueryReference`);\n }\n\n const pass = unwrapQueryRef(queryRef).disposed;\n\n return {\n pass,\n message: () => {\n return `${hint}\\n\\nExpected queryRef ${\n this.isNot ? \"not \" : \"\"\n }to be disposed, but it was${this.isNot ? \"\" : \" not\"}.`;\n },\n };\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.d.ts new file mode 100644 index 0000000..983d6dc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.d.ts @@ -0,0 +1,8 @@ +import type { MatcherFunction } from "expect"; +declare class WeakRef { + constructor(target: T); + deref(): T | undefined; +} +export declare const toBeGarbageCollected: MatcherFunction<[weakRef: WeakRef]>; +export {}; +//# sourceMappingURL=toBeGarbageCollected.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js new file mode 100644 index 0000000..0a8329c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js @@ -0,0 +1,48 @@ +import { __awaiter, __generator } from "tslib"; +export var toBeGarbageCollected = function (actual) { + return __awaiter(this, void 0, void 0, function () { + var hint, pass, interval, timeout; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + hint = this.utils.matcherHint("toBeGarbageCollected"); + if (!(actual instanceof WeakRef)) { + throw new Error(hint + + "\n\n" + + "Expected value to be a WeakRef, but it was a ".concat(typeof actual, ".")); + } + pass = false; + return [4 /*yield*/, Promise.race([ + new Promise(function (resolve) { + timeout = setTimeout(resolve, 1000); + }), + new Promise(function (resolve) { + interval = setInterval(function () { + global.gc(); + pass = actual.deref() === undefined; + if (pass) { + resolve(); + } + }, 1); + }), + ])]; + case 1: + _a.sent(); + clearInterval(interval); + clearTimeout(timeout); + return [2 /*return*/, { + pass: pass, + message: function () { + if (pass) { + return (hint + + "\n\n" + + "Expected value to not be cache-collected, but it was."); + } + return (hint + "\n\n Expected value to be cache-collected, but it was not."); + }, + }]; + } + }); + }); +}; +//# sourceMappingURL=toBeGarbageCollected.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js.map b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js.map new file mode 100644 index 0000000..d45070f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toBeGarbageCollected.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toBeGarbageCollected.js","sourceRoot":"","sources":["../../../src/testing/matchers/toBeGarbageCollected.ts"],"names":[],"mappings":";AASA,MAAM,CAAC,IAAM,oBAAoB,GAC/B,UAAgB,MAAM;;;;;;oBACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;oBAE5D,IAAI,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,EAAE,CAAC;wBACjC,MAAM,IAAI,KAAK,CACb,IAAI;4BACF,MAAM;4BACN,uDAAgD,OAAO,MAAM,MAAG,CACnE,CAAC;oBACJ,CAAC;oBAEG,IAAI,GAAG,KAAK,CAAC;oBAGjB,qBAAM,OAAO,CAAC,IAAI,CAAC;4BACjB,IAAI,OAAO,CAAO,UAAC,OAAO;gCACxB,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;4BACtC,CAAC,CAAC;4BACF,IAAI,OAAO,CAAO,UAAC,OAAO;gCACxB,QAAQ,GAAG,WAAW,CAAC;oCACrB,MAAM,CAAC,EAAG,EAAE,CAAC;oCACb,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,SAAS,CAAC;oCACpC,IAAI,IAAI,EAAE,CAAC;wCACT,OAAO,EAAE,CAAC;oCACZ,CAAC;gCACH,CAAC,EAAE,CAAC,CAAC,CAAC;4BACR,CAAC,CAAC;yBACH,CAAC,EAAA;;oBAbF,SAaE,CAAC;oBAEH,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,YAAY,CAAC,OAAO,CAAC,CAAC;oBAEtB,sBAAO;4BACL,IAAI,MAAA;4BACJ,OAAO,EAAE;gCACP,IAAI,IAAI,EAAE,CAAC;oCACT,OAAO,CACL,IAAI;wCACJ,MAAM;wCACN,uDAAuD,CACxD,CAAC;gCACJ,CAAC;gCAED,OAAO,CACL,IAAI,GAAG,4DAA4D,CACpE,CAAC;4BACJ,CAAC;yBACF,EAAC;;;;CACH,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\n\n// this is necessary because this file is picked up by `tsc` (it's not a test),\n// but our main `tsconfig.json` doesn't include `\"ES2021.WeakRef\"` on purpose\ndeclare class WeakRef {\n constructor(target: T);\n deref(): T | undefined;\n}\n\nexport const toBeGarbageCollected: MatcherFunction<[weakRef: WeakRef]> =\n async function (actual) {\n const hint = this.utils.matcherHint(\"toBeGarbageCollected\");\n\n if (!(actual instanceof WeakRef)) {\n throw new Error(\n hint +\n \"\\n\\n\" +\n `Expected value to be a WeakRef, but it was a ${typeof actual}.`\n );\n }\n\n let pass = false;\n let interval: NodeJS.Timeout | undefined;\n let timeout: NodeJS.Timeout | undefined;\n await Promise.race([\n new Promise((resolve) => {\n timeout = setTimeout(resolve, 1000);\n }),\n new Promise((resolve) => {\n interval = setInterval(() => {\n global.gc!();\n pass = actual.deref() === undefined;\n if (pass) {\n resolve();\n }\n }, 1);\n }),\n ]);\n\n clearInterval(interval);\n clearTimeout(timeout);\n\n return {\n pass,\n message: () => {\n if (pass) {\n return (\n hint +\n \"\\n\\n\" +\n \"Expected value to not be cache-collected, but it was.\"\n );\n }\n\n return (\n hint + \"\\n\\n Expected value to be cache-collected, but it was not.\"\n );\n },\n };\n };\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts new file mode 100644 index 0000000..3035f75 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts @@ -0,0 +1,11 @@ +import type { MatcherFunction } from "expect"; +import type { DocumentNode } from "graphql"; +import type { OperationVariables } from "../../core/index.js"; +export declare const toHaveSuspenseCacheEntryUsing: MatcherFunction<[ + query: DocumentNode, + options: { + variables?: OperationVariables; + queryKey?: string | number | any[]; + } +]>; +//# sourceMappingURL=toHaveSuspenseCacheEntryUsing.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js new file mode 100644 index 0000000..13de151 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js @@ -0,0 +1,24 @@ +import { __spreadArray } from "tslib"; +import { ApolloClient } from "../../core/index.js"; +import { canonicalStringify } from "../../cache/index.js"; +import { getSuspenseCache } from "../../react/internal/index.js"; +export var toHaveSuspenseCacheEntryUsing = function (client, query, _a) { + var _b; + var _c = _a === void 0 ? Object.create(null) : _a, variables = _c.variables, _d = _c.queryKey, queryKey = _d === void 0 ? [] : _d; + if (!(client instanceof ApolloClient)) { + throw new Error("Actual must be an instance of `ApolloClient`"); + } + var suspenseCache = getSuspenseCache(client); + var cacheKey = __spreadArray([ + query, + canonicalStringify(variables) + ], [].concat(queryKey), true); + var queryRef = (_b = suspenseCache["queryRefs"].lookupArray(cacheKey)) === null || _b === void 0 ? void 0 : _b.current; + return { + pass: !!queryRef, + message: function () { + return "Expected suspense cache ".concat(queryRef ? "not " : "", "to have cache entry using key"); + }, + }; +}; +//# sourceMappingURL=toHaveSuspenseCacheEntryUsing.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map new file mode 100644 index 0000000..36580fb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toHaveSuspenseCacheEntryUsing.js","sourceRoot":"","sources":["../../../src/testing/matchers/toHaveSuspenseCacheEntryUsing.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,CAAC,IAAM,6BAA6B,GAQtC,UACF,MAAM,EACN,KAAK,EACL,EAAkD;;QAAlD,qBAA+B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAA,EAAhD,SAAS,eAAA,EAAE,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA;IAE1B,IAAI,CAAC,CAAC,MAAM,YAAY,YAAY,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,IAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE/C,IAAM,QAAQ;QACZ,KAAK;QACL,kBAAkB,CAAC,SAAS,CAAC;OACzB,EAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,OAClC,CAAC;IACF,IAAM,QAAQ,GAAG,MAAA,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,0CAAE,OAAO,CAAC;IAE3E,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,QAAQ;QAChB,OAAO,EAAE;YACP,OAAO,kCACL,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,kCACO,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { MatcherFunction } from \"expect\";\nimport type { DocumentNode } from \"graphql\";\nimport type { OperationVariables } from \"../../core/index.js\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { canonicalStringify } from \"../../cache/index.js\";\nimport { getSuspenseCache } from \"../../react/internal/index.js\";\nimport type { CacheKey } from \"../../react/internal/index.js\";\n\nexport const toHaveSuspenseCacheEntryUsing: MatcherFunction<\n [\n query: DocumentNode,\n options: {\n variables?: OperationVariables;\n queryKey?: string | number | any[];\n },\n ]\n> = function (\n client,\n query,\n { variables, queryKey = [] } = Object.create(null)\n) {\n if (!(client instanceof ApolloClient)) {\n throw new Error(\"Actual must be an instance of `ApolloClient`\");\n }\n\n const suspenseCache = getSuspenseCache(client);\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n const queryRef = suspenseCache[\"queryRefs\"].lookupArray(cacheKey)?.current;\n\n return {\n pass: !!queryRef,\n message: () => {\n return `Expected suspense cache ${\n queryRef ? \"not \" : \"\"\n }to have cache entry using key`;\n },\n };\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.d.ts new file mode 100644 index 0000000..26457f0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.d.ts @@ -0,0 +1,4 @@ +import type { DocumentNode } from "../../core/index.js"; +import type { MatcherFunction } from "expect"; +export declare const toMatchDocument: MatcherFunction<[document: DocumentNode]>; +//# sourceMappingURL=toMatchDocument.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js new file mode 100644 index 0000000..43bdb6c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js @@ -0,0 +1,33 @@ +import { checkDocument, print } from "../../utilities/index.js"; +export var toMatchDocument = function (actual, document) { + var _this = this; + var hint = this.utils.matcherHint("toMatchDocument"); + var actualDocument = print(validateDocument(actual, hint + + "\n\n".concat(this.utils.RECEIVED_COLOR("received"), " document must be a parsed document."))); + var expectedDocument = print(validateDocument(document, hint + + "\n\n".concat(this.utils.EXPECTED_COLOR("expected"), " document must be a parsed document."))); + var pass = actualDocument === expectedDocument; + return { + pass: pass, + message: function () { + var hint = _this.utils.matcherHint("toMatchDocument", undefined, undefined, { isNot: _this.isNot }); + if (pass) { + return (hint + + "\n\n" + + "Received:\n\n" + + _this.utils.RECEIVED_COLOR(actualDocument)); + } + return (hint + "\n\n" + _this.utils.diff(expectedDocument, actualDocument)); + }, + }; +}; +function validateDocument(document, message) { + try { + checkDocument(document); + } + catch (e) { + throw new Error(message); + } + return document; +} +//# sourceMappingURL=toMatchDocument.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js.map b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js.map new file mode 100644 index 0000000..2d0ad9e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/matchers/toMatchDocument.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toMatchDocument.js","sourceRoot":"","sources":["../../../src/testing/matchers/toMatchDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAIhE,MAAM,CAAC,IAAM,eAAe,GAC1B,UAAU,MAAM,EAAE,QAAQ;IAA1B,iBA+CC;IA9CC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IACvD,IAAM,cAAc,GAAG,KAAK,CAC1B,gBAAgB,CACd,MAAM,EACN,IAAI;QACF,cAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAC9B,UAAU,CACX,yCAAsC,CAC1C,CACF,CAAC;IACF,IAAM,gBAAgB,GAAG,KAAK,CAC5B,gBAAgB,CACd,QAAQ,EACR,IAAI;QACF,cAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAC9B,UAAU,CACX,yCAAsC,CAC1C,CACF,CAAC;IAEF,IAAM,IAAI,GAAG,cAAc,KAAK,gBAAgB,CAAC;IAEjD,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,EAAE;YACP,IAAM,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,WAAW,CACjC,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,EAAE,KAAK,EAAE,KAAI,CAAC,KAAK,EAAE,CACtB,CAAC;YAEF,IAAI,IAAI,EAAE,CAAC;gBACT,OAAO,CACL,IAAI;oBACJ,MAAM;oBACN,eAAe;oBACf,KAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAC1C,CAAC;YACJ,CAAC;YAED,OAAO,CACL,IAAI,GAAG,MAAM,GAAG,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAClE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEJ,SAAS,gBAAgB,CAAC,QAAiB,EAAE,OAAe;IAC1D,IAAI,CAAC;QACH,aAAa,CAAC,QAAwB,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,QAAwB,CAAC;AAClC,CAAC","sourcesContent":["import { checkDocument, print } from \"../../utilities/index.js\";\nimport type { DocumentNode } from \"../../core/index.js\";\nimport type { MatcherFunction } from \"expect\";\n\nexport const toMatchDocument: MatcherFunction<[document: DocumentNode]> =\n function (actual, document) {\n const hint = this.utils.matcherHint(\"toMatchDocument\");\n const actualDocument = print(\n validateDocument(\n actual,\n hint +\n `\\n\\n${this.utils.RECEIVED_COLOR(\n \"received\"\n )} document must be a parsed document.`\n )\n );\n const expectedDocument = print(\n validateDocument(\n document,\n hint +\n `\\n\\n${this.utils.EXPECTED_COLOR(\n \"expected\"\n )} document must be a parsed document.`\n )\n );\n\n const pass = actualDocument === expectedDocument;\n\n return {\n pass,\n message: () => {\n const hint = this.utils.matcherHint(\n \"toMatchDocument\",\n undefined,\n undefined,\n { isNot: this.isNot }\n );\n\n if (pass) {\n return (\n hint +\n \"\\n\\n\" +\n \"Received:\\n\\n\" +\n this.utils.RECEIVED_COLOR(actualDocument)\n );\n }\n\n return (\n hint + \"\\n\\n\" + this.utils.diff(expectedDocument, actualDocument)\n );\n },\n };\n };\n\nfunction validateDocument(document: unknown, message: string) {\n try {\n checkDocument(document as DocumentNode);\n } catch (e) {\n throw new Error(message);\n }\n\n return document as DocumentNode;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/package.json b/graphql-subscription/node_modules/@apollo/client/testing/package.json new file mode 100644 index 0000000..99feaf1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/testing", + "type": "module", + "main": "testing.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.d.ts b/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.d.ts new file mode 100644 index 0000000..efea7f3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.d.ts @@ -0,0 +1,33 @@ +import * as React from "react"; +import type { DefaultOptions } from "../../core/index.js"; +import { ApolloClient } from "../../core/index.js"; +import type { MockedResponse } from "../core/index.js"; +import type { ApolloLink } from "../../link/core/index.js"; +import type { Resolvers } from "../../core/index.js"; +import type { ApolloCache } from "../../cache/index.js"; +export interface MockedProviderProps { + mocks?: ReadonlyArray>; + addTypename?: boolean; + defaultOptions?: DefaultOptions; + cache?: ApolloCache; + resolvers?: Resolvers; + childProps?: object; + children?: any; + link?: ApolloLink; + showWarnings?: boolean; + /** + * If set to true, the MockedProvider will try to connect to the Apollo DevTools. + * Defaults to false. + */ + connectToDevTools?: boolean; +} +export interface MockedProviderState { + client: ApolloClient; +} +export declare class MockedProvider extends React.Component { + static defaultProps: MockedProviderProps; + constructor(props: MockedProviderProps); + render(): React.JSX.Element | null; + componentWillUnmount(): void; +} +//# sourceMappingURL=MockedProvider.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js b/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js new file mode 100644 index 0000000..d075cce --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js @@ -0,0 +1,42 @@ +import { __assign, __extends } from "tslib"; +import * as React from "react"; +import { ApolloClient } from "../../core/index.js"; +import { InMemoryCache as Cache } from "../../cache/index.js"; +import { ApolloProvider } from "../../react/context/index.js"; +import { MockLink } from "../core/index.js"; +var MockedProvider = /** @class */ (function (_super) { + __extends(MockedProvider, _super); + function MockedProvider(props) { + var _this = _super.call(this, props) || this; + var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache = _a.cache, resolvers = _a.resolvers, link = _a.link, showWarnings = _a.showWarnings, _b = _a.connectToDevTools, connectToDevTools = _b === void 0 ? false : _b; + var client = new ApolloClient({ + cache: cache || new Cache({ addTypename: addTypename }), + defaultOptions: defaultOptions, + connectToDevTools: connectToDevTools, + link: link || new MockLink(mocks || [], addTypename, { showWarnings: showWarnings }), + resolvers: resolvers, + }); + _this.state = { + client: client, + }; + return _this; + } + MockedProvider.prototype.render = function () { + var _a = this.props, children = _a.children, childProps = _a.childProps; + var client = this.state.client; + return React.isValidElement(children) ? + React.createElement(ApolloProvider, { client: client }, React.cloneElement(React.Children.only(children), __assign({}, childProps))) + : null; + }; + MockedProvider.prototype.componentWillUnmount = function () { + // Since this.state.client was created in the constructor, it's this + // MockedProvider's responsibility to terminate it. + this.state.client.stop(); + }; + MockedProvider.defaultProps = { + addTypename: true, + }; + return MockedProvider; +}(React.Component)); +export { MockedProvider }; +//# sourceMappingURL=MockedProvider.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js.map b/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js.map new file mode 100644 index 0000000..ecd973c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/react/MockedProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MockedProvider.js","sourceRoot":"","sources":["../../../src/testing/react/MockedProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA0B5C;IAAoC,kCAGnC;IAKC,wBAAY,KAA0B;QACpC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QAEP,IAAA,KASF,KAAI,CAAC,KAAK,EARZ,KAAK,WAAA,EACL,WAAW,iBAAA,EACX,cAAc,oBAAA,EACd,KAAK,WAAA,EACL,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,YAAY,kBAAA,EACZ,yBAAyB,EAAzB,iBAAiB,mBAAG,KAAK,KACb,CAAC;QACf,IAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC9B,KAAK,EAAE,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,WAAW,aAAA,EAAE,CAAC;YAC1C,cAAc,gBAAA;YACd,iBAAiB,mBAAA;YACjB,IAAI,EAAE,IAAI,IAAI,IAAI,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,YAAY,cAAA,EAAE,CAAC;YACtE,SAAS,WAAA;SACV,CAAC,CAAC;QAEH,KAAI,CAAC,KAAK,GAAG;YACX,MAAM,QAAA;SACP,CAAC;;IACJ,CAAC;IAEM,+BAAM,GAAb;QACQ,IAAA,KAA2B,IAAI,CAAC,KAAK,EAAnC,QAAQ,cAAA,EAAE,UAAU,gBAAe,CAAC;QACpC,IAAA,MAAM,GAAK,IAAI,CAAC,KAAK,OAAf,CAAgB;QAE9B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnC,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM,IAC3B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAO,UAAU,EAAG,CACtD;YACnB,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAEM,6CAAoB,GAA3B;QACE,oEAAoE;QACpE,mDAAmD;QACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IA7Ca,2BAAY,GAAwB;QAChD,WAAW,EAAE,IAAI;KAClB,CAAC;IA4CJ,qBAAC;CAAA,AAlDD,CAAoC,KAAK,CAAC,SAAS,GAkDlD;SAlDY,cAAc","sourcesContent":["import * as React from \"react\";\n\nimport type { DefaultOptions } from \"../../core/index.js\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { InMemoryCache as Cache } from \"../../cache/index.js\";\nimport { ApolloProvider } from \"../../react/context/index.js\";\nimport type { MockedResponse } from \"../core/index.js\";\nimport { MockLink } from \"../core/index.js\";\nimport type { ApolloLink } from \"../../link/core/index.js\";\nimport type { Resolvers } from \"../../core/index.js\";\nimport type { ApolloCache } from \"../../cache/index.js\";\n\nexport interface MockedProviderProps {\n mocks?: ReadonlyArray>;\n addTypename?: boolean;\n defaultOptions?: DefaultOptions;\n cache?: ApolloCache;\n resolvers?: Resolvers;\n childProps?: object;\n children?: any;\n link?: ApolloLink;\n showWarnings?: boolean;\n /**\n * If set to true, the MockedProvider will try to connect to the Apollo DevTools.\n * Defaults to false.\n */\n connectToDevTools?: boolean;\n}\n\nexport interface MockedProviderState {\n client: ApolloClient;\n}\n\nexport class MockedProvider extends React.Component<\n MockedProviderProps,\n MockedProviderState\n> {\n public static defaultProps: MockedProviderProps = {\n addTypename: true,\n };\n\n constructor(props: MockedProviderProps) {\n super(props);\n\n const {\n mocks,\n addTypename,\n defaultOptions,\n cache,\n resolvers,\n link,\n showWarnings,\n connectToDevTools = false,\n } = this.props;\n const client = new ApolloClient({\n cache: cache || new Cache({ addTypename }),\n defaultOptions,\n connectToDevTools,\n link: link || new MockLink(mocks || [], addTypename, { showWarnings }),\n resolvers,\n });\n\n this.state = {\n client,\n };\n }\n\n public render() {\n const { children, childProps } = this.props;\n const { client } = this.state;\n\n return React.isValidElement(children) ?\n \n {React.cloneElement(React.Children.only(children), { ...childProps })}\n \n : null;\n }\n\n public componentWillUnmount() {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs b/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs new file mode 100644 index 0000000..18350ec --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +require('../utilities/globals'); +var tslib = require('tslib'); +var React = require('react'); +var core$1 = require('../core'); +var cache = require('../cache'); +var context = require('../react/context'); +var core = require('./core'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +var MockedProvider = (function (_super) { + tslib.__extends(MockedProvider, _super); + function MockedProvider(props) { + var _this = _super.call(this, props) || this; + var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache$1 = _a.cache, resolvers = _a.resolvers, link = _a.link, showWarnings = _a.showWarnings, _b = _a.connectToDevTools, connectToDevTools = _b === void 0 ? false : _b; + var client = new core$1.ApolloClient({ + cache: cache$1 || new cache.InMemoryCache({ addTypename: addTypename }), + defaultOptions: defaultOptions, + connectToDevTools: connectToDevTools, + link: link || new core.MockLink(mocks || [], addTypename, { showWarnings: showWarnings }), + resolvers: resolvers, + }); + _this.state = { + client: client, + }; + return _this; + } + MockedProvider.prototype.render = function () { + var _a = this.props, children = _a.children, childProps = _a.childProps; + var client = this.state.client; + return React__namespace.isValidElement(children) ? + React__namespace.createElement(context.ApolloProvider, { client: client }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps))) + : null; + }; + MockedProvider.prototype.componentWillUnmount = function () { + this.state.client.stop(); + }; + MockedProvider.defaultProps = { + addTypename: true, + }; + return MockedProvider; +}(React__namespace.Component)); + +exports.MockedProvider = MockedProvider; +for (var k in core) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +} +//# sourceMappingURL=testing.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.map b/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.map new file mode 100644 index 0000000..8bc4730 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"testing.cjs","sources":["react/MockedProvider.js"],"sourcesContent":["import { __assign, __extends } from \"tslib\";\nimport * as React from \"react\";\nimport { ApolloClient } from \"../../core/index.js\";\nimport { InMemoryCache as Cache } from \"../../cache/index.js\";\nimport { ApolloProvider } from \"../../react/context/index.js\";\nimport { MockLink } from \"../core/index.js\";\nvar MockedProvider = /** @class */ (function (_super) {\n __extends(MockedProvider, _super);\n function MockedProvider(props) {\n var _this = _super.call(this, props) || this;\n var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache = _a.cache, resolvers = _a.resolvers, link = _a.link, showWarnings = _a.showWarnings, _b = _a.connectToDevTools, connectToDevTools = _b === void 0 ? false : _b;\n var client = new ApolloClient({\n cache: cache || new Cache({ addTypename: addTypename }),\n defaultOptions: defaultOptions,\n connectToDevTools: connectToDevTools,\n link: link || new MockLink(mocks || [], addTypename, { showWarnings: showWarnings }),\n resolvers: resolvers,\n });\n _this.state = {\n client: client,\n };\n return _this;\n }\n MockedProvider.prototype.render = function () {\n var _a = this.props, children = _a.children, childProps = _a.childProps;\n var client = this.state.client;\n return React.isValidElement(children) ?\n React.createElement(ApolloProvider, { client: client }, React.cloneElement(React.Children.only(children), __assign({}, childProps)))\n : null;\n };\n MockedProvider.prototype.componentWillUnmount = function () {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n };\n MockedProvider.defaultProps = {\n addTypename: true,\n };\n return MockedProvider;\n}(React.Component));\nexport { MockedProvider };\n//# sourceMappingURL=MockedProvider.js.map"],"names":["__extends","cache","ApolloClient","Cache","MockLink","React","ApolloProvider","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMG,IAAC,cAAc,KAAkB,UAAU,MAAM,EAAE;AACtD,IAAIA,eAAS,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AACtC,IAAI,SAAS,cAAc,CAAC,KAAK,EAAE;AACnC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;AACrD,QAAQ,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,WAAW,GAAG,EAAE,CAAC,WAAW,EAAE,cAAc,GAAG,EAAE,CAAC,cAAc,EAAEC,OAAK,GAAG,EAAE,CAAC,KAAK,EAAE,SAAS,GA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AE,UAAU,CAAC,CAAC,CAAC;AAChJ,cAAc,IAAI,CAAC;AACnB,KAAK,CAAC;AACN,IAAI,cAAc,CAAC,SAAS,CAAC,oBAAoB,GAAG,YAAY;AAGhE,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACjC,KAAK,CAAC;AACN,IAAI,cAAc,CAAC,YAAY,GAAG;AAClC,QAAQ,WAAW,EAAE,IAAI;AACzB,KAAK,CAAC;AACN,IAAI,OAAO,cAAc,CAAC;AAC1B,CAAC,CAACF,gBAAK,CAAC,SAAS,CAAC;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.native.js new file mode 100644 index 0000000..18350ec --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/testing/testing.cjs.native.js @@ -0,0 +1,64 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +require('../utilities/globals'); +var tslib = require('tslib'); +var React = require('react'); +var core$1 = require('../core'); +var cache = require('../cache'); +var context = require('../react/context'); +var core = require('./core'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + for (var k in e) { + n[k] = e[k]; + } + } + n["default"] = e; + return Object.freeze(n); +} + +var React__namespace = /*#__PURE__*/_interopNamespace(React); + +var MockedProvider = (function (_super) { + tslib.__extends(MockedProvider, _super); + function MockedProvider(props) { + var _this = _super.call(this, props) || this; + var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache$1 = _a.cache, resolvers = _a.resolvers, link = _a.link, showWarnings = _a.showWarnings, _b = _a.connectToDevTools, connectToDevTools = _b === void 0 ? false : _b; + var client = new core$1.ApolloClient({ + cache: cache$1 || new cache.InMemoryCache({ addTypename: addTypename }), + defaultOptions: defaultOptions, + connectToDevTools: connectToDevTools, + link: link || new core.MockLink(mocks || [], addTypename, { showWarnings: showWarnings }), + resolvers: resolvers, + }); + _this.state = { + client: client, + }; + return _this; + } + MockedProvider.prototype.render = function () { + var _a = this.props, children = _a.children, childProps = _a.childProps; + var client = this.state.client; + return React__namespace.isValidElement(children) ? + React__namespace.createElement(context.ApolloProvider, { client: client }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps))) + : null; + }; + MockedProvider.prototype.componentWillUnmount = function () { + this.state.client.stop(); + }; + MockedProvider.defaultProps = { + addTypename: true, + }; + return MockedProvider; +}(React__namespace.Component)); + +exports.MockedProvider = MockedProvider; +for (var k in core) { + if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = core[k]; +} +//# sourceMappingURL=testing.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.d.ts new file mode 100644 index 0000000..b5f3ec3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.d.ts @@ -0,0 +1,34 @@ +import { WeakCache, StrongCache } from "@wry/caches"; +/** + * @internal + * A version of WeakCache that will auto-schedule a cleanup of the cache when + * a new item is added. + * Throttled to once per 100ms. + * + * @privateRemarks + * Should be used throughout the rest of the codebase instead of WeakCache, + * with the notable exception of usage in `wrap` from `optimism` - that one + * already handles cleanup and should remain a `WeakCache`. + */ +export declare const AutoCleanedWeakCache: typeof WeakCache; +/** + * @internal + */ +export type AutoCleanedWeakCache = WeakCache; +/** + * @internal + * A version of StrongCache that will auto-schedule a cleanup of the cache when + * a new item is added. + * Throttled to once per 100ms. + * + * @privateRemarks + * Should be used throughout the rest of the codebase instead of StrongCache, + * with the notable exception of usage in `wrap` from `optimism` - that one + * already handles cleanup and should remain a `StrongCache`. + */ +export declare const AutoCleanedStrongCache: typeof StrongCache; +/** + * @internal + */ +export type AutoCleanedStrongCache = StrongCache; +//# sourceMappingURL=caches.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js b/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js new file mode 100644 index 0000000..c1a82aa --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js @@ -0,0 +1,64 @@ +import { WeakCache, StrongCache } from "@wry/caches"; +var scheduledCleanup = new WeakSet(); +function schedule(cache) { + if (!scheduledCleanup.has(cache)) { + scheduledCleanup.add(cache); + setTimeout(function () { + cache.clean(); + scheduledCleanup.delete(cache); + }, 100); + } +} +/** + * @internal + * A version of WeakCache that will auto-schedule a cleanup of the cache when + * a new item is added. + * Throttled to once per 100ms. + * + * @privateRemarks + * Should be used throughout the rest of the codebase instead of WeakCache, + * with the notable exception of usage in `wrap` from `optimism` - that one + * already handles cleanup and should remain a `WeakCache`. + */ +export var AutoCleanedWeakCache = function (max, dispose) { + /* + Some builds of `WeakCache` are function prototypes, some are classes. + This library still builds with an ES5 target, so we can't extend the + real classes. + Instead, we have to use this workaround until we switch to a newer build + target. + */ + var cache = new WeakCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return WeakCache.prototype.set.call(this, key, value); + }; + return cache; +}; +/** + * @internal + * A version of StrongCache that will auto-schedule a cleanup of the cache when + * a new item is added. + * Throttled to once per 100ms. + * + * @privateRemarks + * Should be used throughout the rest of the codebase instead of StrongCache, + * with the notable exception of usage in `wrap` from `optimism` - that one + * already handles cleanup and should remain a `StrongCache`. + */ +export var AutoCleanedStrongCache = function (max, dispose) { + /* + Some builds of `StrongCache` are function prototypes, some are classes. + This library still builds with an ES5 target, so we can't extend the + real classes. + Instead, we have to use this workaround until we switch to a newer build + target. + */ + var cache = new StrongCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return StrongCache.prototype.set.call(this, key, value); + }; + return cache; +}; +//# sourceMappingURL=caches.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js.map new file mode 100644 index 0000000..c34904c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/caches.js.map @@ -0,0 +1 @@ +{"version":3,"file":"caches.js","sourceRoot":"","sources":["../../../src/utilities/caching/caches.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAErD,IAAM,gBAAgB,GAAG,IAAI,OAAO,EAAyB,CAAC;AAC9D,SAAS,QAAQ,CAAC,KAA4B;IAC5C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,UAAU,CAAC;YACT,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AACD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAClC,GAAwB,EACxB,OAAsD;IAEtD;;;;;;MAME;IACF,IAAM,KAAK,GAAG,IAAI,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1C,KAAK,CAAC,GAAG,GAAG,UAAU,GAAQ,EAAE,KAAU;QACxC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,OAAO,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAA4B,CAAC;AAM7B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,IAAM,sBAAsB,GAAG,UACpC,GAAwB,EACxB,OAAsD;IAEtD;;;;;;MAME;IACF,IAAM,KAAK,GAAG,IAAI,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,KAAK,CAAC,GAAG,GAAG,UAAU,GAAQ,EAAE,KAAU;QACxC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,OAAO,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAA8B,CAAC","sourcesContent":["import type { CommonCache } from \"@wry/caches\";\nimport { WeakCache, StrongCache } from \"@wry/caches\";\n\nconst scheduledCleanup = new WeakSet>();\nfunction schedule(cache: CommonCache) {\n if (!scheduledCleanup.has(cache)) {\n scheduledCleanup.add(cache);\n setTimeout(() => {\n cache.clean();\n scheduledCleanup.delete(cache);\n }, 100);\n }\n}\n/**\n * @internal\n * A version of WeakCache that will auto-schedule a cleanup of the cache when\n * a new item is added.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of WeakCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `WeakCache`.\n */\nexport const AutoCleanedWeakCache = function (\n max?: number | undefined,\n dispose?: ((value: any, key: any) => void) | undefined\n) {\n /*\n Some builds of `WeakCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n const cache = new WeakCache(max, dispose);\n cache.set = function (key: any, value: any) {\n schedule(this);\n return WeakCache.prototype.set.call(this, key, value);\n };\n return cache;\n} as any as typeof WeakCache;\n/**\n * @internal\n */\nexport type AutoCleanedWeakCache = WeakCache;\n\n/**\n * @internal\n * A version of StrongCache that will auto-schedule a cleanup of the cache when\n * a new item is added.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of StrongCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `StrongCache`.\n */\nexport const AutoCleanedStrongCache = function (\n max?: number | undefined,\n dispose?: ((value: any, key: any) => void) | undefined\n) {\n /*\n Some builds of `StrongCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n const cache = new StrongCache(max, dispose);\n cache.set = function (key: any, value: any) {\n schedule(this);\n return StrongCache.prototype.set.call(this, key, value);\n };\n return cache;\n} as any as typeof StrongCache;\n/**\n * @internal\n */\nexport type AutoCleanedStrongCache = StrongCache;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.d.ts new file mode 100644 index 0000000..a47306e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.d.ts @@ -0,0 +1,76 @@ +declare const globalCaches: { + print?: () => number; + parser?: () => number; + canonicalStringify?: () => number; +}; +export declare function registerGlobalCache(name: keyof typeof globalCaches, getSize: () => number): void; +/** + * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead + * @internal + */ +export declare const getApolloClientMemoryInternals: (() => { + limits: { + [k: string]: number; + }; + sizes: { + cache?: { + fragmentQueryDocuments: number | undefined; + } | undefined; + addTypenameDocumentTransform?: { + cache: number; + }[] | undefined; + inMemoryCache?: { + executeSelectionSet: number | undefined; + executeSubSelectedArray: number | undefined; + maybeBroadcastWatch: number | undefined; + } | undefined; + fragmentRegistry?: { + findFragmentSpreads: number | undefined; + lookup: number | undefined; + transform: number | undefined; + } | undefined; + print: number | undefined; + parser: number | undefined; + canonicalStringify: number | undefined; + links: unknown[]; + queryManager: { + getDocumentInfo: number; + documentTransforms: { + cache: number; + }[]; + }; + }; +}) | undefined; +/** + * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead + * @internal + */ +export declare const getInMemoryCacheMemoryInternals: (() => { + addTypenameDocumentTransform: { + cache: number; + }[]; + inMemoryCache: { + executeSelectionSet: number | undefined; + executeSubSelectedArray: number | undefined; + maybeBroadcastWatch: number | undefined; + }; + fragmentRegistry: { + findFragmentSpreads: number | undefined; + lookup: number | undefined; + transform: number | undefined; + }; + cache: { + fragmentQueryDocuments: number | undefined; + }; +}) | undefined; +/** + * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead + * @internal + */ +export declare const getApolloCacheMemoryInternals: (() => { + cache: { + fragmentQueryDocuments: number | undefined; + }; +}) | undefined; +export {}; +//# sourceMappingURL=getMemoryInternals.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js b/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js new file mode 100644 index 0000000..dd1b40e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js @@ -0,0 +1,112 @@ +import { __assign, __spreadArray } from "tslib"; +import { cacheSizes } from "./sizes.js"; +var globalCaches = {}; +export function registerGlobalCache(name, getSize) { + globalCaches[name] = getSize; +} +/** + * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead + * @internal + */ +export var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloClientMemoryInternals + : undefined; +/** + * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead + * @internal + */ +export var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getInMemoryCacheMemoryInternals + : undefined; +/** + * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead + * @internal + */ +export var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ? + _getApolloCacheMemoryInternals + : undefined; +function getCurrentCacheSizes() { + // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here + var defaults = { + parser: 1000 /* defaultCacheSizes["parser"] */, + canonicalStringify: 1000 /* defaultCacheSizes["canonicalStringify"] */, + print: 2000 /* defaultCacheSizes["print"] */, + "documentTransform.cache": 2000 /* defaultCacheSizes["documentTransform.cache"] */, + "queryManager.getDocumentInfo": 2000 /* defaultCacheSizes["queryManager.getDocumentInfo"] */, + "PersistedQueryLink.persistedQueryHashes": 2000 /* defaultCacheSizes["PersistedQueryLink.persistedQueryHashes"] */, + "fragmentRegistry.transform": 2000 /* defaultCacheSizes["fragmentRegistry.transform"] */, + "fragmentRegistry.lookup": 1000 /* defaultCacheSizes["fragmentRegistry.lookup"] */, + "fragmentRegistry.findFragmentSpreads": 4000 /* defaultCacheSizes["fragmentRegistry.findFragmentSpreads"] */, + "cache.fragmentQueryDocuments": 1000 /* defaultCacheSizes["cache.fragmentQueryDocuments"] */, + "removeTypenameFromVariables.getVariableDefinitions": 2000 /* defaultCacheSizes["removeTypenameFromVariables.getVariableDefinitions"] */, + "inMemoryCache.maybeBroadcastWatch": 5000 /* defaultCacheSizes["inMemoryCache.maybeBroadcastWatch"] */, + "inMemoryCache.executeSelectionSet": 50000 /* defaultCacheSizes["inMemoryCache.executeSelectionSet"] */, + "inMemoryCache.executeSubSelectedArray": 10000 /* defaultCacheSizes["inMemoryCache.executeSubSelectedArray"] */, + }; + return Object.fromEntries(Object.entries(defaults).map(function (_a) { + var k = _a[0], v = _a[1]; + return [ + k, + cacheSizes[k] || v, + ]; + })); +} +function _getApolloClientMemoryInternals() { + var _a, _b, _c, _d, _e; + if (!(globalThis.__DEV__ !== false)) + throw new Error("only supported in development mode"); + return { + limits: getCurrentCacheSizes(), + sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: { + getDocumentInfo: this["queryManager"]["transformCache"].size, + documentTransforms: transformInfo(this["queryManager"].documentTransform), + } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)), + }; +} +function _getApolloCacheMemoryInternals() { + return { + cache: { + fragmentQueryDocuments: getWrapperInformation(this["getFragmentDoc"]), + }, + }; +} +function _getInMemoryCacheMemoryInternals() { + var fragments = this.config.fragments; + return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this["addTypenameTransform"]), inMemoryCache: { + executeSelectionSet: getWrapperInformation(this["storeReader"]["executeSelectionSet"]), + executeSubSelectedArray: getWrapperInformation(this["storeReader"]["executeSubSelectedArray"]), + maybeBroadcastWatch: getWrapperInformation(this["maybeBroadcastWatch"]), + }, fragmentRegistry: { + findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads), + lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup), + transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform), + } }); +} +function isWrapper(f) { + return !!f && "dirtyKey" in f; +} +function getWrapperInformation(f) { + return isWrapper(f) ? f.size : undefined; +} +function isDefined(value) { + return value != null; +} +function transformInfo(transform) { + return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); }); +} +function recurseTransformInfo(transform) { + return transform ? + __spreadArray(__spreadArray([ + getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform["performWork"]) + ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["left"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform["right"]), true).filter(isDefined) + : []; +} +function linkInfo(link) { + var _a; + return link ? + __spreadArray(__spreadArray([ + (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link) + ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined) + : []; +} +//# sourceMappingURL=getMemoryInternals.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js.map new file mode 100644 index 0000000..8ab3ec2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/getMemoryInternals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getMemoryInternals.js","sourceRoot":"","sources":["../../../src/utilities/caching/getMemoryInternals.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAC;AAE3D,IAAM,YAAY,GAId,EAAE,CAAC;AAEP,MAAM,UAAU,mBAAmB,CACjC,IAA+B,EAC/B,OAAqB;IAErB,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AAC/B,CAAC;AAwCD;;;GAGG;AACH,MAAM,CAAC,IAAM,8BAA8B,GACzC,OAAO,CAAC,CAAC;IACN,+BAEC;IACJ,CAAC,CAAC,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,CAAC,IAAM,+BAA+B,GAC1C,OAAO,CAAC,CAAC;IACN,gCAEC;IACJ,CAAC,CAAC,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,CAAC,IAAM,6BAA6B,GACxC,OAAO,CAAC,CAAC;IACN,8BAEC;IACJ,CAAC,CAAC,SAAS,CAAC;AAEd,SAAS,oBAAoB;IAC3B,qHAAqH;IACrH,IAAM,QAAQ,GAAqC;QACjD,MAAM,wCAA6B;QACnC,kBAAkB,oDAAyC;QAC3D,KAAK,uCAA4B;QACjC,yBAAyB,yDAA8C;QACvE,8BAA8B,8DACqB;QACnD,yCAAyC,yEACqB;QAC9D,4BAA4B,4DACqB;QACjD,yBAAyB,yDAA8C;QACvE,sCAAsC,sEACqB;QAC3D,8BAA8B,8DACqB;QACnD,oDAAoD,oFACqB;QACzE,mCAAmC,mEACqB;QACxD,mCAAmC,oEACqB;QACxD,uCAAuC,wEACqB;KAC7D,CAAC;IACF,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAC,EAAM;YAAL,CAAC,QAAA,EAAE,CAAC,QAAA;QAAM,OAAA;YACvC,CAAC;YACD,UAAU,CAAC,CAAqB,CAAC,IAAI,CAAC;SACvC;IAHwC,CAGxC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IACjC,OAAO,IAAI,CAAC,CAAC;QACT;YACE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,kBAAkB,oDAAI;WACzB,QAAQ,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,SACpB,QAAQ,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,QACxB,MAAM,CAAC,SAAS,CAAC;QACrB,CAAC,CAAC,EAAE,CAAC;AACT,CAAC","sourcesContent":["import type { OptimisticWrapperFunction } from \"optimism\";\nimport type {\n InMemoryCache,\n DocumentTransform,\n ApolloLink,\n ApolloCache,\n} from \"../../core/index.js\";\nimport type { ApolloClient } from \"../../core/index.js\";\nimport type { CacheSizes } from \"./sizes.js\";\nimport { cacheSizes, defaultCacheSizes } from \"./sizes.js\";\n\nconst globalCaches: {\n print?: () => number;\n parser?: () => number;\n canonicalStringify?: () => number;\n} = {};\n\nexport function registerGlobalCache(\n name: keyof typeof globalCaches,\n getSize: () => number\n) {\n globalCaches[name] = getSize;\n}\n\n/**\n * Transformative helper type to turn a function of the form\n * ```ts\n * (this: any) => R\n * ```\n * into a function of the form\n * ```ts\n * () => R\n * ```\n * preserving the return type, but removing the `this` parameter.\n *\n * @remarks\n *\n * Further down in the definitions of `_getApolloClientMemoryInternals`,\n * `_getApolloCacheMemoryInternals` and `_getInMemoryCacheMemoryInternals`,\n * having the `this` parameter annotation is extremely useful for type checking\n * inside the function.\n *\n * If this is preserved in the exported types, though, it leads to a situation\n * where `ApolloCache.getMemoryInternals` is a function that requires a `this`\n * of the type `ApolloCache`, while the extending class `InMemoryCache` has a\n * `getMemoryInternals` function that requires a `this` of the type\n * `InMemoryCache`.\n * This is not compatible with TypeScript's inheritence system (although it is\n * perfectly correct), and so TypeScript will complain loudly.\n *\n * We still want to define our functions with the `this` annotation, though,\n * and have the return type inferred.\n * (This requirement for return type inference here makes it impossible to use\n * a function overload that is more explicit on the inner overload than it is\n * on the external overload.)\n *\n * So in the end, we use this helper to remove the `this` annotation from the\n * exported function types, while keeping it in the internal implementation.\n *\n */\ntype RemoveThis = T extends (this: any) => infer R ? () => R : never;\n\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport const getApolloClientMemoryInternals =\n __DEV__ ?\n (_getApolloClientMemoryInternals as RemoveThis<\n typeof _getApolloClientMemoryInternals\n >)\n : undefined;\n\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport const getInMemoryCacheMemoryInternals =\n __DEV__ ?\n (_getInMemoryCacheMemoryInternals as RemoveThis<\n typeof _getInMemoryCacheMemoryInternals\n >)\n : undefined;\n\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport const getApolloCacheMemoryInternals =\n __DEV__ ?\n (_getApolloCacheMemoryInternals as RemoveThis<\n typeof _getApolloCacheMemoryInternals\n >)\n : undefined;\n\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n const defaults: Record = {\n parser: defaultCacheSizes[\"parser\"],\n canonicalStringify: defaultCacheSizes[\"canonicalStringify\"],\n print: defaultCacheSizes[\"print\"],\n \"documentTransform.cache\": defaultCacheSizes[\"documentTransform.cache\"],\n \"queryManager.getDocumentInfo\":\n defaultCacheSizes[\"queryManager.getDocumentInfo\"],\n \"PersistedQueryLink.persistedQueryHashes\":\n defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"],\n \"fragmentRegistry.transform\":\n defaultCacheSizes[\"fragmentRegistry.transform\"],\n \"fragmentRegistry.lookup\": defaultCacheSizes[\"fragmentRegistry.lookup\"],\n \"fragmentRegistry.findFragmentSpreads\":\n defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"],\n \"cache.fragmentQueryDocuments\":\n defaultCacheSizes[\"cache.fragmentQueryDocuments\"],\n \"removeTypenameFromVariables.getVariableDefinitions\":\n defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"],\n \"inMemoryCache.maybeBroadcastWatch\":\n defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"],\n \"inMemoryCache.executeSelectionSet\":\n defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"],\n \"inMemoryCache.executeSubSelectedArray\":\n defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"],\n };\n return Object.fromEntries(\n Object.entries(defaults).map(([k, v]) => [\n k,\n cacheSizes[k as keyof CacheSizes] || v,\n ])\n );\n}\n\nfunction _getApolloClientMemoryInternals(this: ApolloClient) {\n if (!__DEV__) throw new Error(\"only supported in development mode\");\n\n return {\n limits: getCurrentCacheSizes(),\n sizes: {\n print: globalCaches.print?.(),\n parser: globalCaches.parser?.(),\n canonicalStringify: globalCaches.canonicalStringify?.(),\n links: linkInfo(this.link),\n queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(\n this[\"queryManager\"].documentTransform\n ),\n },\n ...(this.cache.getMemoryInternals?.() as Partial<\n ReturnType\n > &\n Partial>),\n },\n };\n}\n\nfunction _getApolloCacheMemoryInternals(this: ApolloCache) {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\n\nfunction _getInMemoryCacheMemoryInternals(this: InMemoryCache) {\n const fragments = this.config.fragments as\n | undefined\n | {\n findFragmentSpreads?: Function;\n transform?: Function;\n lookup?: Function;\n };\n\n return {\n ..._getApolloCacheMemoryInternals.apply(this as any),\n addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]),\n inMemoryCache: {\n executeSelectionSet: getWrapperInformation(\n this[\"storeReader\"][\"executeSelectionSet\"]\n ),\n executeSubSelectedArray: getWrapperInformation(\n this[\"storeReader\"][\"executeSubSelectedArray\"]\n ),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n },\n fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(\n fragments?.findFragmentSpreads\n ),\n lookup: getWrapperInformation(fragments?.lookup),\n transform: getWrapperInformation(fragments?.transform),\n },\n };\n}\n\nfunction isWrapper(f?: Function): f is OptimisticWrapperFunction {\n return !!f && \"dirtyKey\" in f;\n}\n\nfunction getWrapperInformation(f?: Function) {\n return isWrapper(f) ? f.size : undefined;\n}\n\nfunction isDefined(value: T | undefined | null): value is T {\n return value != null;\n}\n\nfunction transformInfo(transform?: DocumentTransform) {\n return recurseTransformInfo(transform).map((cache) => ({ cache }));\n}\n\nfunction recurseTransformInfo(transform?: DocumentTransform): number[] {\n return transform ?\n [\n getWrapperInformation(transform?.[\"performWork\"]),\n ...recurseTransformInfo(transform?.[\"left\"]),\n ...recurseTransformInfo(transform?.[\"right\"]),\n ].filter(isDefined)\n : [];\n}\n\nfunction linkInfo(link?: ApolloLink): unknown[] {\n return link ?\n [\n link?.getMemoryInternals?.(),\n ...linkInfo(link?.left),\n ...linkInfo(link?.right),\n ].filter(isDefined)\n : [];\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.d.ts new file mode 100644 index 0000000..5b0a1c5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.d.ts @@ -0,0 +1,4 @@ +export { AutoCleanedStrongCache, AutoCleanedWeakCache } from "./caches.js"; +export type { CacheSizes } from "./sizes.js"; +export { cacheSizes, defaultCacheSizes } from "./sizes.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js b/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js new file mode 100644 index 0000000..01dbe62 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js @@ -0,0 +1,3 @@ +export { AutoCleanedStrongCache, AutoCleanedWeakCache } from "./caches.js"; +export { cacheSizes } from "./sizes.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js.map new file mode 100644 index 0000000..2bb3441 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/caching/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAC","sourcesContent":["export { AutoCleanedStrongCache, AutoCleanedWeakCache } from \"./caches.js\";\nexport type { CacheSizes } from \"./sizes.js\";\nexport { cacheSizes, defaultCacheSizes } from \"./sizes.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.d.ts new file mode 100644 index 0000000..1f7bf33 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.d.ts @@ -0,0 +1,311 @@ +declare global { + interface Window { + [cacheSizeSymbol]?: Partial; + } +} +/** + * The cache sizes used by various Apollo Client caches. + * + * @remarks + * All configurable caches hold memoized values. If an item is + * cache-collected, it incurs only a small performance impact and + * doesn't cause data loss. A smaller cache size might save you memory. + * + * You should choose cache sizes appropriate for storing a reasonable + * number of values rather than every value. To prevent too much recalculation, + * choose cache sizes that are at least large enough to hold memoized values for + * all hooks/queries on the screen at any given time. + */ +export interface CacheSizes { + /** + * Cache size for the [`print`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/print.ts) function. + * + * It is called with transformed `DocumentNode`s. + * + * @defaultValue + * Defaults to `2000`. + * + * @remarks + * This method is called to transform a GraphQL query AST parsed by `gql` + * back into a GraphQL string. + * + * @privateRemarks + * This method is called from the `QueryManager` and various `ApolloLink`s, + * always with the "serverQuery", so the server-facing part of a transformed + * `DocumentNode`. + */ + print: number; + /** + * Cache size for the [`parser`](https://github.com/apollographql/apollo-client/blob/main/src/react/parser/index.ts) function. + * + * It is called with user-provided `DocumentNode`s. + * + * @defaultValue + * Defaults to `1000`. + * + * @remarks + * This method is called by HOCs and hooks. + * + * @privateRemarks + * This function is used directly in HOCs, and nowadays mainly accessed by + * calling `verifyDocumentType` from various hooks. + * It is called with a user-provided DocumentNode. + */ + parser: number; + /** + * Cache size for the cache of [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts) + * instances with the `cache` option set to `true`. + * + * Can be called with user-defined or already-transformed `DocumentNode`s. + * + * @defaultValue + * Defaults to `2000`. + * + * @remarks + * The cache size here should be chosen with other `DocumentTransform`s in mind. + * For example, if there was a `DocumentTransform` that would take `x` `DocumentNode`s, + * and returned a differently-transformed `DocumentNode` depending if the app is + * online or offline, then we assume that the cache returns `2*x` documents. + * If that were concatenated with another `DocumentTransform` that would + * also duplicate the cache size, you'd need to account for `4*x` documents + * returned by the second transform. + * + * Due to an implementation detail of Apollo Client, if you use custom document + * transforms you should always add `n` (the "base" number of user-provided + * Documents) to the resulting cache size. + * + * If we assume that the user-provided transforms receive `n` documents and + * return `n` documents, the cache size should be `2*n`. + * + * If we assume that the chain of user-provided transforms receive `n` documents and + * return `4*n` documents, the cache size should be `5*n`. + * + * This size should also then be used in every other cache that mentions that + * it operates on a "transformed" `DocumentNode`. + * + * @privateRemarks + * Cache size for the `performWork` method of each [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts). + * + * No user-provided DocumentNode will actually be "the last one", as we run the + * `defaultDocumentTransform` before *and* after the user-provided transforms. + * For that reason, we need the extra `n` here - `n` for "before transformation" + * plus the actual maximum cache size of the user-provided transform chain. + * + * This method is called from `transformDocument`, which is called from + * `QueryManager` with a user-provided DocumentNode. + * It is also called with already-transformed DocumentNodes, assuming the + * user provided additional transforms. + * + */ + "documentTransform.cache": number; + /** + * A cache inside of [`QueryManager`](https://github.com/apollographql/apollo-client/blob/main/src/core/QueryManager.ts). + * + * It is called with transformed `DocumentNode`s. + * + * @defaultValue + * Defaults to `2000`. + * + * @privateRemarks + * Cache size for the `transformCache` used in the `getDocumentInfo` method of `QueryManager`. + * Called throughout the `QueryManager` with transformed DocumentNodes. + */ + "queryManager.getDocumentInfo": number; + /** + * A cache inside of [`PersistedQueryLink`](https://github.com/apollographql/apollo-client/blob/main/src/link/persisted-queries/index.ts). + * + * It is called with transformed `DocumentNode`s. + * + * @defaultValue + * Defaults to `2000`. + * + * @remarks + * This cache is used to cache the hashes of persisted queries. + * + * @privateRemarks + * Cache size for the `hashesByQuery` cache in the `PersistedQueryLink`. + */ + "PersistedQueryLink.persistedQueryHashes": number; + /** + * Cache used by [`canonicalStringify`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/common/canonicalStringify.ts). + * + * @defaultValue + * Defaults to `1000`. + * + * @remarks + * This cache contains the sorted keys of objects that are stringified by + * `canonicalStringify`. + * It uses the stringified unsorted keys of objects as keys. + * The cache will not grow beyond the size of different object **shapes** + * encountered in an application, no matter how much actual data gets stringified. + * + * @privateRemarks + * Cache size for the `sortingMap` in `canonicalStringify`. + */ + canonicalStringify: number; + /** + * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts). + * + * Can be called with user-defined or already-transformed `DocumentNode`s. + * + * @defaultValue + * Defaults to `2000`. + * + * @privateRemarks + * + * Cache size for the `transform` method of FragmentRegistry. + * This function is called as part of the `defaultDocumentTransform` which will be called with + * user-provided and already-transformed DocumentNodes. + * + */ + "fragmentRegistry.transform": number; + /** + * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts). + * + * This function is called with fragment names in the form of a string. + * + * @defaultValue + * Defaults to `1000`. + * + * @remarks + * The size of this case should be chosen with the number of fragments in + * your application in mind. + * + * Note: + * This function is a dependency of `fragmentRegistry.transform`, so having too small of a cache size here + * might involuntarily invalidate values in the `transform` cache. + * + * @privateRemarks + * Cache size for the `lookup` method of FragmentRegistry. + */ + "fragmentRegistry.lookup": number; + /** + * Cache size for the `findFragmentSpreads` method of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts). + * + * This function is called with transformed `DocumentNode`s, as well as recursively + * with every fragment spread referenced within that, or a fragment referenced by a + * fragment spread. + * + * @defaultValue + * Defaults to `4000`. + * + * @remarks + * + * Note: This function is a dependency of `fragmentRegistry.transform`, so having too small of cache size here + * might involuntarily invalidate values in the `transform` cache. + */ + "fragmentRegistry.findFragmentSpreads": number; + /** + * Cache size for the `getFragmentDoc` method of [`ApolloCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/core/cache.ts). + * + * This function is called with user-provided fragment definitions. + * + * @defaultValue + * Defaults to `1000`. + * + * @remarks + * This function is called from `readFragment` with user-provided fragment definitions. + */ + "cache.fragmentQueryDocuments": number; + /** + * Cache used in [`removeTypenameFromVariables`](https://github.com/apollographql/apollo-client/blob/main/src/link/remove-typename/removeTypenameFromVariables.ts). + * + * This function is called transformed `DocumentNode`s. + * + * @defaultValue + * Defaults to `2000`. + * + * @privateRemarks + * Cache size for the `getVariableDefinitions` function of `removeTypenameFromVariables`. + */ + "removeTypenameFromVariables.getVariableDefinitions": number; + /** + * Cache size for the `maybeBroadcastWatch` method on [`InMemoryCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/inMemoryCache.ts). + * + * Note: `maybeBroadcastWatch` will be set to the `resultCacheMaxSize` option and + * will fall back to this configuration value if the option is not set. + * + * @defaultValue + * Defaults to `5000`. + * + * @remarks + * This method is used for dependency tracking in the `InMemoryCache` and + * prevents from unnecessary re-renders. + * It is recommended to keep this value significantly higher than the number of + * possible subscribers you will have active at the same time in your application + * at any time. + */ + "inMemoryCache.maybeBroadcastWatch": number; + /** + * Cache size for the `executeSelectionSet` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts). + * + * Note: + * `executeSelectionSet` will be set to the `resultCacheMaxSize` option and + * will fall back to this configuration value if the option is not set. + * + * @defaultValue + * Defaults to `10000`. + * + * @remarks + * Every object that is read from the cache will be cached here, so it is + * recommended to set this to a high value. + */ + "inMemoryCache.executeSelectionSet": number; + /** + * Cache size for the `executeSubSelectedArray` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts). + * + * Note: + * `executeSubSelectedArray` will be set to the `resultCacheMaxSize` option and + * will fall back to this configuration value if the option is not set. + * + * @defaultValue + * Defaults to `5000`. + * + * @remarks + * Every array that is read from the cache will be cached here, so it is + * recommended to set this to a high value. + */ + "inMemoryCache.executeSubSelectedArray": number; +} +declare const cacheSizeSymbol: unique symbol; +/** + * + * The global cache size configuration for Apollo Client. + * + * @remarks + * + * You can directly modify this object, but any modification will + * only have an effect on caches that are created after the modification. + * + * So for global caches, such as `parser`, `canonicalStringify` and `print`, + * you might need to call `.reset` on them, which will essentially re-create them. + * + * Alternatively, you can set `globalThis[Symbol.for("apollo.cacheSize")]` before + * you load the Apollo Client package: + * + * @example + * ```ts + * globalThis[Symbol.for("apollo.cacheSize")] = { + * parser: 100 + * } satisfies Partial // the `satisfies` is optional if using TypeScript + * ``` + */ +export declare const cacheSizes: Partial; +export declare const enum defaultCacheSizes { + parser = 1000, + canonicalStringify = 1000, + print = 2000, + "documentTransform.cache" = 2000, + "queryManager.getDocumentInfo" = 2000, + "PersistedQueryLink.persistedQueryHashes" = 2000, + "fragmentRegistry.transform" = 2000, + "fragmentRegistry.lookup" = 1000, + "fragmentRegistry.findFragmentSpreads" = 4000, + "cache.fragmentQueryDocuments" = 1000, + "removeTypenameFromVariables.getVariableDefinitions" = 2000, + "inMemoryCache.maybeBroadcastWatch" = 5000, + "inMemoryCache.executeSelectionSet" = 50000, + "inMemoryCache.executeSubSelectedArray" = 10000 +} +export {}; +//# sourceMappingURL=sizes.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js b/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js new file mode 100644 index 0000000..a237338 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js @@ -0,0 +1,27 @@ +import { __assign } from "tslib"; +import { global } from "../globals/index.js"; +var cacheSizeSymbol = Symbol.for("apollo.cacheSize"); +/** + * + * The global cache size configuration for Apollo Client. + * + * @remarks + * + * You can directly modify this object, but any modification will + * only have an effect on caches that are created after the modification. + * + * So for global caches, such as `parser`, `canonicalStringify` and `print`, + * you might need to call `.reset` on them, which will essentially re-create them. + * + * Alternatively, you can set `globalThis[Symbol.for("apollo.cacheSize")]` before + * you load the Apollo Client package: + * + * @example + * ```ts + * globalThis[Symbol.for("apollo.cacheSize")] = { + * parser: 100 + * } satisfies Partial // the `satisfies` is optional if using TypeScript + * ``` + */ +export var cacheSizes = __assign({}, global[cacheSizeSymbol]); +//# sourceMappingURL=sizes.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js.map new file mode 100644 index 0000000..6e5ea49 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/caching/sizes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sizes.js","sourceRoot":"","sources":["../../../src/utilities/caching/sizes.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAsR7C,IAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACvD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,IAAM,UAAU,gBAA6B,MAAM,CAAC,eAAe,CAAC,CAAE,CAAC","sourcesContent":["import { global } from \"../globals/index.js\";\n\ndeclare global {\n interface Window {\n [cacheSizeSymbol]?: Partial;\n }\n}\n\n/**\n * The cache sizes used by various Apollo Client caches.\n *\n * @remarks\n * All configurable caches hold memoized values. If an item is\n * cache-collected, it incurs only a small performance impact and\n * doesn't cause data loss. A smaller cache size might save you memory.\n *\n * You should choose cache sizes appropriate for storing a reasonable\n * number of values rather than every value. To prevent too much recalculation,\n * choose cache sizes that are at least large enough to hold memoized values for\n * all hooks/queries on the screen at any given time.\n */\n/*\n * We assume a \"base value\" of 1000 here, which is already very generous.\n * In most applications, it will be very unlikely that 1000 different queries\n * are on screen at the same time.\n */\nexport interface CacheSizes {\n /**\n * Cache size for the [`print`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/print.ts) function.\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * This method is called to transform a GraphQL query AST parsed by `gql`\n * back into a GraphQL string.\n *\n * @privateRemarks\n * This method is called from the `QueryManager` and various `ApolloLink`s,\n * always with the \"serverQuery\", so the server-facing part of a transformed\n * `DocumentNode`.\n */\n print: number;\n /**\n * Cache size for the [`parser`](https://github.com/apollographql/apollo-client/blob/main/src/react/parser/index.ts) function.\n *\n * It is called with user-provided `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * This method is called by HOCs and hooks.\n *\n * @privateRemarks\n * This function is used directly in HOCs, and nowadays mainly accessed by\n * calling `verifyDocumentType` from various hooks.\n * It is called with a user-provided DocumentNode.\n */\n parser: number;\n /**\n * Cache size for the cache of [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts)\n * instances with the `cache` option set to `true`.\n *\n * Can be called with user-defined or already-transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * The cache size here should be chosen with other `DocumentTransform`s in mind.\n * For example, if there was a `DocumentTransform` that would take `x` `DocumentNode`s,\n * and returned a differently-transformed `DocumentNode` depending if the app is\n * online or offline, then we assume that the cache returns `2*x` documents.\n * If that were concatenated with another `DocumentTransform` that would\n * also duplicate the cache size, you'd need to account for `4*x` documents\n * returned by the second transform.\n *\n * Due to an implementation detail of Apollo Client, if you use custom document\n * transforms you should always add `n` (the \"base\" number of user-provided\n * Documents) to the resulting cache size.\n *\n * If we assume that the user-provided transforms receive `n` documents and\n * return `n` documents, the cache size should be `2*n`.\n *\n * If we assume that the chain of user-provided transforms receive `n` documents and\n * return `4*n` documents, the cache size should be `5*n`.\n *\n * This size should also then be used in every other cache that mentions that\n * it operates on a \"transformed\" `DocumentNode`.\n *\n * @privateRemarks\n * Cache size for the `performWork` method of each [`DocumentTransform`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/graphql/DocumentTransform.ts).\n *\n * No user-provided DocumentNode will actually be \"the last one\", as we run the\n * `defaultDocumentTransform` before *and* after the user-provided transforms.\n * For that reason, we need the extra `n` here - `n` for \"before transformation\"\n * plus the actual maximum cache size of the user-provided transform chain.\n *\n * This method is called from `transformDocument`, which is called from\n * `QueryManager` with a user-provided DocumentNode.\n * It is also called with already-transformed DocumentNodes, assuming the\n * user provided additional transforms.\n *\n */\n \"documentTransform.cache\": number;\n /**\n * A cache inside of [`QueryManager`](https://github.com/apollographql/apollo-client/blob/main/src/core/QueryManager.ts).\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n * Cache size for the `transformCache` used in the `getDocumentInfo` method of `QueryManager`.\n * Called throughout the `QueryManager` with transformed DocumentNodes.\n */\n \"queryManager.getDocumentInfo\": number;\n /**\n * A cache inside of [`PersistedQueryLink`](https://github.com/apollographql/apollo-client/blob/main/src/link/persisted-queries/index.ts).\n *\n * It is called with transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @remarks\n * This cache is used to cache the hashes of persisted queries.\n *\n * @privateRemarks\n * Cache size for the `hashesByQuery` cache in the `PersistedQueryLink`.\n */\n \"PersistedQueryLink.persistedQueryHashes\": number;\n /**\n * Cache used by [`canonicalStringify`](https://github.com/apollographql/apollo-client/blob/main/src/utilities/common/canonicalStringify.ts).\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * This cache contains the sorted keys of objects that are stringified by\n * `canonicalStringify`.\n * It uses the stringified unsorted keys of objects as keys.\n * The cache will not grow beyond the size of different object **shapes**\n * encountered in an application, no matter how much actual data gets stringified.\n *\n * @privateRemarks\n * Cache size for the `sortingMap` in `canonicalStringify`.\n */\n canonicalStringify: number;\n /**\n * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * Can be called with user-defined or already-transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n *\n * Cache size for the `transform` method of FragmentRegistry.\n * This function is called as part of the `defaultDocumentTransform` which will be called with\n * user-provided and already-transformed DocumentNodes.\n *\n */\n \"fragmentRegistry.transform\": number;\n /**\n * A cache inside of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * This function is called with fragment names in the form of a string.\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * The size of this case should be chosen with the number of fragments in\n * your application in mind.\n *\n * Note:\n * This function is a dependency of `fragmentRegistry.transform`, so having too small of a cache size here\n * might involuntarily invalidate values in the `transform` cache.\n *\n * @privateRemarks\n * Cache size for the `lookup` method of FragmentRegistry.\n */\n \"fragmentRegistry.lookup\": number;\n /**\n * Cache size for the `findFragmentSpreads` method of [`FragmentRegistry`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/fragmentRegistry.ts).\n *\n * This function is called with transformed `DocumentNode`s, as well as recursively\n * with every fragment spread referenced within that, or a fragment referenced by a\n * fragment spread.\n *\n * @defaultValue\n * Defaults to `4000`.\n *\n * @remarks\n *\n * Note: This function is a dependency of `fragmentRegistry.transform`, so having too small of cache size here\n * might involuntarily invalidate values in the `transform` cache.\n */\n \"fragmentRegistry.findFragmentSpreads\": number;\n /**\n * Cache size for the `getFragmentDoc` method of [`ApolloCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/core/cache.ts).\n *\n * This function is called with user-provided fragment definitions.\n *\n * @defaultValue\n * Defaults to `1000`.\n *\n * @remarks\n * This function is called from `readFragment` with user-provided fragment definitions.\n */\n \"cache.fragmentQueryDocuments\": number;\n /**\n * Cache used in [`removeTypenameFromVariables`](https://github.com/apollographql/apollo-client/blob/main/src/link/remove-typename/removeTypenameFromVariables.ts).\n *\n * This function is called transformed `DocumentNode`s.\n *\n * @defaultValue\n * Defaults to `2000`.\n *\n * @privateRemarks\n * Cache size for the `getVariableDefinitions` function of `removeTypenameFromVariables`.\n */\n \"removeTypenameFromVariables.getVariableDefinitions\": number;\n /**\n * Cache size for the `maybeBroadcastWatch` method on [`InMemoryCache`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/inMemoryCache.ts).\n *\n * Note: `maybeBroadcastWatch` will be set to the `resultCacheMaxSize` option and\n * will fall back to this configuration value if the option is not set.\n *\n * @defaultValue\n * Defaults to `5000`.\n *\n * @remarks\n * This method is used for dependency tracking in the `InMemoryCache` and\n * prevents from unnecessary re-renders.\n * It is recommended to keep this value significantly higher than the number of\n * possible subscribers you will have active at the same time in your application\n * at any time.\n */\n \"inMemoryCache.maybeBroadcastWatch\": number;\n /**\n * Cache size for the `executeSelectionSet` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * Note:\n * `executeSelectionSet` will be set to the `resultCacheMaxSize` option and\n * will fall back to this configuration value if the option is not set.\n *\n * @defaultValue\n * Defaults to `10000`.\n *\n * @remarks\n * Every object that is read from the cache will be cached here, so it is\n * recommended to set this to a high value.\n */\n \"inMemoryCache.executeSelectionSet\": number;\n /**\n * Cache size for the `executeSubSelectedArray` method on [`StoreReader`](https://github.com/apollographql/apollo-client/blob/main/src/cache/inmemory/readFromStore.ts).\n *\n * Note:\n * `executeSubSelectedArray` will be set to the `resultCacheMaxSize` option and\n * will fall back to this configuration value if the option is not set.\n *\n * @defaultValue\n * Defaults to `5000`.\n *\n * @remarks\n * Every array that is read from the cache will be cached here, so it is\n * recommended to set this to a high value.\n */\n \"inMemoryCache.executeSubSelectedArray\": number;\n}\n\nconst cacheSizeSymbol = Symbol.for(\"apollo.cacheSize\");\n/**\n *\n * The global cache size configuration for Apollo Client.\n *\n * @remarks\n *\n * You can directly modify this object, but any modification will\n * only have an effect on caches that are created after the modification.\n *\n * So for global caches, such as `parser`, `canonicalStringify` and `print`,\n * you might need to call `.reset` on them, which will essentially re-create them.\n *\n * Alternatively, you can set `globalThis[Symbol.for(\"apollo.cacheSize\")]` before\n * you load the Apollo Client package:\n *\n * @example\n * ```ts\n * globalThis[Symbol.for(\"apollo.cacheSize\")] = {\n * parser: 100\n * } satisfies Partial // the `satisfies` is optional if using TypeScript\n * ```\n */\nexport const cacheSizes: Partial = { ...global[cacheSizeSymbol] };\n\nexport const enum defaultCacheSizes {\n parser = 1000,\n canonicalStringify = 1000,\n print = 2000,\n \"documentTransform.cache\" = 2000,\n \"queryManager.getDocumentInfo\" = 2000,\n \"PersistedQueryLink.persistedQueryHashes\" = 2000,\n \"fragmentRegistry.transform\" = 2000,\n \"fragmentRegistry.lookup\" = 1000,\n \"fragmentRegistry.findFragmentSpreads\" = 4000,\n \"cache.fragmentQueryDocuments\" = 1000,\n \"removeTypenameFromVariables.getVariableDefinitions\" = 2000,\n \"inMemoryCache.maybeBroadcastWatch\" = 5000,\n \"inMemoryCache.executeSelectionSet\" = 50000,\n \"inMemoryCache.executeSubSelectedArray\" = 10000,\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.d.ts new file mode 100644 index 0000000..4359bb3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.d.ts @@ -0,0 +1,3 @@ +export declare const isArray: (a: any) => a is any[] | readonly any[]; +export declare function isNonEmptyArray(value?: ArrayLike): value is Array; +//# sourceMappingURL=arrays.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js new file mode 100644 index 0000000..ec2842d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js @@ -0,0 +1,6 @@ +// A version of Array.isArray that works better with readonly arrays. +export var isArray = Array.isArray; +export function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} +//# sourceMappingURL=arrays.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js.map new file mode 100644 index 0000000..74a588c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/arrays.js.map @@ -0,0 +1 @@ +{"version":3,"file":"arrays.js","sourceRoot":"","sources":["../../../src/utilities/common/arrays.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,CAAC,IAAM,OAAO,GAA4C,KAAK,CAAC,OAAO,CAAC;AAE9E,MAAM,UAAU,eAAe,CAAI,KAAoB;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAClD,CAAC","sourcesContent":["// A version of Array.isArray that works better with readonly arrays.\nexport const isArray: (a: any) => a is any[] | readonly any[] = Array.isArray;\n\nexport function isNonEmptyArray(value?: ArrayLike): value is Array {\n return Array.isArray(value) && value.length > 0;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.d.ts new file mode 100644 index 0000000..9204f7a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.d.ts @@ -0,0 +1,7 @@ +export declare const canUseWeakMap: boolean; +export declare const canUseWeakSet: boolean; +export declare const canUseSymbol: boolean; +export declare const canUseAsyncIteratorSymbol: false | typeof Symbol.asyncIterator; +export declare const canUseDOM: boolean; +export declare const canUseLayoutEffect: boolean; +//# sourceMappingURL=canUse.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js new file mode 100644 index 0000000..d3c76ad --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js @@ -0,0 +1,25 @@ +import { maybe } from "../globals/index.js"; +export var canUseWeakMap = typeof WeakMap === "function" && + !maybe(function () { return navigator.product == "ReactNative" && !global.HermesInternal; }); +export var canUseWeakSet = typeof WeakSet === "function"; +export var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function"; +export var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator; +export var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === "function"; +var usingJSDOM = +// Following advice found in this comment from @domenic (maintainer of jsdom): +// https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327 +// +// Since we control the version of Jest and jsdom used when running Apollo +// Client tests, and that version is recent enought to include " jsdom/x.y.z" +// at the end of the user agent string, I believe this case is all we need to +// check. Testing for "Node.js" was recommended for backwards compatibility +// with older version of jsdom, but we don't have that problem. +maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false; +// Our tests should all continue to pass if we remove this !usingJSDOM +// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately, +// if we allow useLayoutEffect, then useSyncExternalStore generates many +// warnings about useLayoutEffect doing nothing on the server. While these +// warnings are harmless, this !usingJSDOM condition seems to be the best way to +// prevent them (i.e. skipping useLayoutEffect when using jsdom). +export var canUseLayoutEffect = canUseDOM && !usingJSDOM; +//# sourceMappingURL=canUse.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js.map new file mode 100644 index 0000000..83d2e6c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/canUse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"canUse.js","sourceRoot":"","sources":["../../../src/utilities/common/canUse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,CAAC,IAAM,aAAa,GACxB,OAAO,OAAO,KAAK,UAAU;IAC7B,CAAC,KAAK,CACJ,cAAM,OAAA,SAAS,CAAC,OAAO,IAAI,aAAa,IAAI,CAAE,MAAc,CAAC,cAAc,EAArE,CAAqE,CAC5E,CAAC;AAEJ,MAAM,CAAC,IAAM,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC;AAE3D,MAAM,CAAC,IAAM,YAAY,GACvB,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC;AAEnE,MAAM,CAAC,IAAM,yBAAyB,GAAG,YAAY,IAAI,MAAM,CAAC,aAAa,CAAC;AAE9E,MAAM,CAAC,IAAM,SAAS,GACpB,OAAO,KAAK,CAAC,cAAM,OAAA,MAAM,CAAC,QAAQ,CAAC,aAAa,EAA7B,CAA6B,CAAC,KAAK,UAAU,CAAC;AAEnE,IAAM,UAAU;AACd,8EAA8E;AAC9E,oEAAoE;AACpE,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,+DAA+D;AAC/D,KAAK,CAAC,cAAM,OAAA,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAzC,CAAyC,CAAC,IAAI,KAAK,CAAC;AAElE,sEAAsE;AACtE,+EAA+E;AAC/E,wEAAwE;AACxE,0EAA0E;AAC1E,gFAAgF;AAChF,iEAAiE;AACjE,MAAM,CAAC,IAAM,kBAAkB,GAAG,SAAS,IAAI,CAAC,UAAU,CAAC","sourcesContent":["import { maybe } from \"../globals/index.js\";\n\nexport const canUseWeakMap =\n typeof WeakMap === \"function\" &&\n !maybe(\n () => navigator.product == \"ReactNative\" && !(global as any).HermesInternal\n );\n\nexport const canUseWeakSet = typeof WeakSet === \"function\";\n\nexport const canUseSymbol =\n typeof Symbol === \"function\" && typeof Symbol.for === \"function\";\n\nexport const canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;\n\nexport const canUseDOM =\n typeof maybe(() => window.document.createElement) === \"function\";\n\nconst usingJSDOM: boolean =\n // Following advice found in this comment from @domenic (maintainer of jsdom):\n // https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327\n //\n // Since we control the version of Jest and jsdom used when running Apollo\n // Client tests, and that version is recent enought to include \" jsdom/x.y.z\"\n // at the end of the user agent string, I believe this case is all we need to\n // check. Testing for \"Node.js\" was recommended for backwards compatibility\n // with older version of jsdom, but we don't have that problem.\n maybe(() => navigator.userAgent.indexOf(\"jsdom\") >= 0) || false;\n\n// Our tests should all continue to pass if we remove this !usingJSDOM\n// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,\n// if we allow useLayoutEffect, then useSyncExternalStore generates many\n// warnings about useLayoutEffect doing nothing on the server. While these\n// warnings are harmless, this !usingJSDOM condition seems to be the best way to\n// prevent them (i.e. skipping useLayoutEffect when using jsdom).\nexport const canUseLayoutEffect = canUseDOM && !usingJSDOM;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.d.ts new file mode 100644 index 0000000..ea951e8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.d.ts @@ -0,0 +1,21 @@ +/** + * Like JSON.stringify, but with object keys always sorted in the same order. + * + * To achieve performant sorting, this function uses a Map from JSON-serialized + * arrays of keys (in any order) to sorted arrays of the same keys, with a + * single sorted array reference shared by all permutations of the keys. + * + * As a drawback, this function will add a little bit more memory for every + * object encountered that has different (more, less, a different order of) keys + * than in the past. + * + * In a typical application, this extra memory usage should not play a + * significant role, as `canonicalStringify` will be called for only a limited + * number of object shapes, and the cache will not grow beyond a certain point. + * But in some edge cases, this could be a problem, so we provide + * canonicalStringify.reset() as a way of clearing the cache. + * */ +export declare const canonicalStringify: ((value: any) => string) & { + reset(): void; +}; +//# sourceMappingURL=canonicalStringify.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js new file mode 100644 index 0000000..0b2c990 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js @@ -0,0 +1,84 @@ +import { AutoCleanedStrongCache, cacheSizes, } from "../../utilities/caching/index.js"; +import { registerGlobalCache } from "../caching/getMemoryInternals.js"; +/** + * Like JSON.stringify, but with object keys always sorted in the same order. + * + * To achieve performant sorting, this function uses a Map from JSON-serialized + * arrays of keys (in any order) to sorted arrays of the same keys, with a + * single sorted array reference shared by all permutations of the keys. + * + * As a drawback, this function will add a little bit more memory for every + * object encountered that has different (more, less, a different order of) keys + * than in the past. + * + * In a typical application, this extra memory usage should not play a + * significant role, as `canonicalStringify` will be called for only a limited + * number of object shapes, and the cache will not grow beyond a certain point. + * But in some edge cases, this could be a problem, so we provide + * canonicalStringify.reset() as a way of clearing the cache. + * */ +export var canonicalStringify = Object.assign(function canonicalStringify(value) { + return JSON.stringify(value, stableObjectReplacer); +}, { + reset: function () { + // Clearing the sortingMap will reclaim all cached memory, without + // affecting the logical results of canonicalStringify, but potentially + // sacrificing performance until the cache is refilled. + sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 /* defaultCacheSizes.canonicalStringify */); + }, +}); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("canonicalStringify", function () { return sortingMap.size; }); +} +// Values are JSON-serialized arrays of object keys (in any order), and values +// are sorted arrays of the same keys. +var sortingMap; +canonicalStringify.reset(); +// The JSON.stringify function takes an optional second argument called a +// replacer function. This function is called for each key-value pair in the +// object being stringified, and its return value is used instead of the +// original value. If the replacer function returns a new value, that value is +// stringified as JSON instead of the original value of the property. +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter +function stableObjectReplacer(key, value) { + if (value && typeof value === "object") { + var proto = Object.getPrototypeOf(value); + // We don't want to mess with objects that are not "plain" objects, which + // means their prototype is either Object.prototype or null. This check also + // prevents needlessly rearranging the indices of arrays. + if (proto === Object.prototype || proto === null) { + var keys = Object.keys(value); + // If keys is already sorted, let JSON.stringify serialize the original + // value instead of creating a new object with keys in the same order. + if (keys.every(everyKeyInOrder)) + return value; + var unsortedKey = JSON.stringify(keys); + var sortedKeys = sortingMap.get(unsortedKey); + if (!sortedKeys) { + keys.sort(); + var sortedKey = JSON.stringify(keys); + // Checking for sortedKey in the sortingMap allows us to share the same + // sorted array reference for all permutations of the same set of keys. + sortedKeys = sortingMap.get(sortedKey) || keys; + sortingMap.set(unsortedKey, sortedKeys); + sortingMap.set(sortedKey, sortedKeys); + } + var sortedObject_1 = Object.create(proto); + // Reassigning the keys in sorted order will cause JSON.stringify to + // serialize them in sorted order. + sortedKeys.forEach(function (key) { + sortedObject_1[key] = value[key]; + }); + return sortedObject_1; + } + } + return value; +} +// Since everything that happens in stableObjectReplacer benefits from being as +// efficient as possible, we use a static function as the callback for +// keys.every in order to test if the provided keys are already sorted without +// allocating extra memory for a callback. +function everyKeyInOrder(key, i, keys) { + return i === 0 || keys[i - 1] <= key; +} +//# sourceMappingURL=canonicalStringify.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js.map new file mode 100644 index 0000000..13aa843 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/canonicalStringify.js.map @@ -0,0 +1 @@ +{"version":3,"file":"canonicalStringify.js","sourceRoot":"","sources":["../../../src/utilities/common/canonicalStringify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,UAAU,GAEX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE;;;;;;;;;;;;;;;;KAgBK;AACL,MAAM,CAAC,IAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAC7C,SAAS,kBAAkB,CAAC,KAAU;IACpC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;AACrD,CAAC,EACD;IACE,KAAK;QACH,kEAAkE;QAClE,uEAAuE;QACvE,uDAAuD;QACvD,UAAU,GAAG,IAAI,sBAAsB,CACrC,UAAU,CAAC,kBAAkB,mDAAwC,CACtE,CAAC;IACJ,CAAC;CACF,CACF,CAAC;AAEF,IAAI,OAAO,EAAE,CAAC;IACZ,mBAAmB,CAAC,oBAAoB,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,EAAf,CAAe,CAAC,CAAC;AACnE,CAAC;AAED,8EAA8E;AAC9E,sCAAsC;AACtC,IAAI,UAA8D,CAAC;AACnE,kBAAkB,CAAC,KAAK,EAAE,CAAC;AAE3B,yEAAyE;AACzE,4EAA4E;AAC5E,wEAAwE;AACxE,8EAA8E;AAC9E,qEAAqE;AACrE,yHAAyH;AACzH,SAAS,oBAAoB,CAAC,GAAW,EAAE,KAAU;IACnD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,IAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC3C,yEAAyE;QACzE,4EAA4E;QAC5E,yDAAyD;QACzD,IAAI,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACjD,I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\n cacheSizes,\n defaultCacheSizes,\n} from \"../../utilities/caching/index.js\";\nimport { registerGlobalCache } from \"../caching/getMemoryInternals.js\";\n\n/**\n * Like JSON.stringify, but with object keys always sorted in the same order.\n *\n * To achieve performant sorting, this function uses a Map from JSON-serialized\n * arrays of keys (in any order) to sorted arrays of the same keys, with a\n * single sorted array reference shared by all permutations of the keys.\n *\n * As a drawback, this function will add a little bit more memory for every\n * object encountered that has different (more, less, a different order of) keys\n * than in the past.\n *\n * In a typical application, this extra memory usage should not play a\n * significant role, as `canonicalStringify` will be called for only a limited\n * number of object shapes, and the cache will not grow beyond a certain point.\n * But in some edge cases, this could be a problem, so we provide\n * canonicalStringify.reset() as a way of clearing the cache.\n * */\nexport const canonicalStringify = Object.assign(\n function canonicalStringify(value: any): string {\n return JSON.stringify(value, stableObjectReplacer);\n },\n {\n reset() {\n // Clearing the sortingMap will reclaim all cached memory, without\n // affecting the logical results of canonicalStringify, but potentially\n // sacrificing performance until the cache is refilled.\n sortingMap = new AutoCleanedStrongCache(\n cacheSizes.canonicalStringify || defaultCacheSizes.canonicalStringify\n );\n },\n }\n);\n\nif (__DEV__) {\n registerGlobalCache(\"canonicalStringify\", () => sortingMap.size);\n}\n\n// Values are JSON-serialized arrays of object keys (in any order), and values\n// are sorted arrays of the same keys.\nlet sortingMap!: AutoCleanedStrongCache;\ncanonicalStringify.reset();\n\n// The JSON.stringify function takes an optional second argument called a\n// replacer function. This function is called for each key-value pair in the\n// object being stringified, and its return value is used instead of the\n// original value. If the replacer function returns a new value, that value is\n// stringified as JSON instead of the original value of the property.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter\nfunction stableObjectReplacer(key: string, value: any) {\n if (value && typeof value === \"object\") {\n const proto = Object.getPrototypeOf(value);\n // We don't want to mess with objects that are not \"plain\" objects, which\n // means their prototype is either Object.prototype or null. This check also\n // prevents needlessly rearranging the indices of arrays.\n if (proto === Object.prototype || proto === null) {\n const keys = Object.keys(value);\n // If keys is already sorted, let JSON.stringify serialize the original\n // value instead of creating a new object with keys in the same order.\n if (keys.every(everyKeyInOrder)) return value;\n const unsortedKey = JSON.stringify(keys);\n let sortedKeys = sortingMap.get(unsortedKey);\n if (!sortedKeys) {\n keys.sort();\n const sortedKey = JSON.stringify(keys);\n // Checking for sortedKey in the sortingMap allows us to share the same\n // sorted array reference for all permutations of the same set of keys.\n sortedKeys = sortingMap.get(sortedKey) || keys;\n sortingMap.set(unsortedKey, sortedKeys);\n sortingMap.set(sortedKey, sortedKeys);\n }\n const sortedObject = Object.create(proto);\n // Reassigning the keys in sorted order will cause JSON.stringify to\n // serialize them in sorted order.\n sortedKeys.forEach((key) => {\n sortedObject[key] = value[key];\n });\n return sortedObject;\n }\n }\n return value;\n}\n\n// Since everything that happens in stableObjectReplacer benefits from being as\n// efficient as possible, we use a static function as the callback for\n// keys.every in order to test if the provided keys are already sorted without\n// allocating extra memory for a callback.\nfunction everyKeyInOrder(\n key: string,\n i: number,\n keys: readonly string[]\n): boolean {\n return i === 0 || keys[i - 1] <= key;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.d.ts new file mode 100644 index 0000000..eef4f02 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.d.ts @@ -0,0 +1,5 @@ +/** + * Deeply clones a value to create a new instance. + */ +export declare function cloneDeep(value: T): T; +//# sourceMappingURL=cloneDeep.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js new file mode 100644 index 0000000..ff170cc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js @@ -0,0 +1,38 @@ +var toString = Object.prototype.toString; +/** + * Deeply clones a value to create a new instance. + */ +export function cloneDeep(value) { + return cloneDeepHelper(value); +} +function cloneDeepHelper(val, seen) { + switch (toString.call(val)) { + case "[object Array]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + var copy_1 = val.slice(0); + seen.set(val, copy_1); + copy_1.forEach(function (child, i) { + copy_1[i] = cloneDeepHelper(child, seen); + }); + return copy_1; + } + case "[object Object]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + // High fidelity polyfills of Object.create and Object.getPrototypeOf are + // possible in all JS environments, so we will assume they exist/work. + var copy_2 = Object.create(Object.getPrototypeOf(val)); + seen.set(val, copy_2); + Object.keys(val).forEach(function (key) { + copy_2[key] = cloneDeepHelper(val[key], seen); + }); + return copy_2; + } + default: + return val; + } +} +//# sourceMappingURL=cloneDeep.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js.map new file mode 100644 index 0000000..0f29426 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/cloneDeep.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cloneDeep.js","sourceRoot":"","sources":["../../../src/utilities/common/cloneDeep.ts"],"names":[],"mappings":"AAAQ,IAAA,QAAQ,GAAK,MAAM,CAAC,SAAS,SAArB,CAAsB;AAEtC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAI,KAAQ;IACnC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,eAAe,CAAI,GAAM,EAAE,IAAoB;IACtD,QAAQ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,gBAAgB,CAAC,CAAC,CAAC;YACtB,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAM,MAAI,GAAe,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAI,CAAC,OAAO,CAAC,UAAU,KAAK,EAAE,CAAC;gBAC7B,MAAI,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;QACd,CAAC;QAED,KAAK,iBAAiB,CAAC,CAAC,CAAC;YACvB,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,yEAAyE;YACzE,sEAAsE;YACtE,IAAM,MAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAI,CAAC,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAA8B,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;gBACtD,MAAI,CAAC,GAAG,CAAC,GAAG,eAAe,CAAE,GAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;YACH,OAAO,MAAI,CAAC;QACd,CAAC;QAED;YACE,OAAO,GAAG,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["const { toString } = Object.prototype;\n\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value: T): T {\n return cloneDeepHelper(value);\n}\n\nfunction cloneDeepHelper(val: T, seen?: Map): T {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n seen = seen || new Map();\n if (seen.has(val)) return seen.get(val);\n const copy: T & any[] = (val as any).slice(0);\n seen.set(val, copy);\n copy.forEach(function (child, i) {\n copy[i] = cloneDeepHelper(child, seen);\n });\n return copy;\n }\n\n case \"[object Object]\": {\n seen = seen || new Map();\n if (seen.has(val)) return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n const copy = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy);\n Object.keys(val as T & Record).forEach((key) => {\n copy[key] = cloneDeepHelper((val as any)[key], seen);\n });\n return copy;\n }\n\n default:\n return val;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.d.ts new file mode 100644 index 0000000..cb49bb4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.d.ts @@ -0,0 +1,7 @@ +import type { TupleToIntersection } from "./mergeDeep.js"; +/** + * Merges the provided objects shallowly and removes + * all properties with an `undefined` value + */ +export declare function compact(...objects: TArgs): TupleToIntersection; +//# sourceMappingURL=compact.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js new file mode 100644 index 0000000..1f6eb19 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js @@ -0,0 +1,23 @@ +/** + * Merges the provided objects shallowly and removes + * all properties with an `undefined` value + */ +export function compact() { + var objects = []; + for (var _i = 0; _i < arguments.length; _i++) { + objects[_i] = arguments[_i]; + } + var result = Object.create(null); + objects.forEach(function (obj) { + if (!obj) + return; + Object.keys(obj).forEach(function (key) { + var value = obj[key]; + if (value !== void 0) { + result[key] = value; + } + }); + }); + return result; +} +//# sourceMappingURL=compact.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js.map new file mode 100644 index 0000000..3b0a77b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/compact.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../../src/utilities/common/compact.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,OAAO;IACrB,iBAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,4BAAiB;;IAEjB,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,CAAC,OAAO,CAAC,UAAC,GAAG;QAClB,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC3B,IAAM,KAAK,GAAI,GAAW,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE,CAAC;gBACrB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACtB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { TupleToIntersection } from \"./mergeDeep.js\";\n\n/**\n * Merges the provided objects shallowly and removes\n * all properties with an `undefined` value\n */\nexport function compact(\n ...objects: TArgs\n): TupleToIntersection {\n const result = Object.create(null);\n\n objects.forEach((obj) => {\n if (!obj) return;\n Object.keys(obj).forEach((key) => {\n const value = (obj as any)[key];\n if (value !== void 0) {\n result[key] = value;\n }\n });\n });\n\n return result;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.d.ts new file mode 100644 index 0000000..e32aa2f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.d.ts @@ -0,0 +1,4 @@ +import type { FetchResult } from "../../link/core/index.js"; +export declare function graphQLResultHasError(result: FetchResult): boolean; +export declare function getGraphQLErrorsFromResult(result: FetchResult): import("graphql").GraphQLError[]; +//# sourceMappingURL=errorHandling.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js new file mode 100644 index 0000000..5ac4e4c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js @@ -0,0 +1,19 @@ +import { isNonEmptyArray } from "./arrays.js"; +import { isExecutionPatchIncrementalResult } from "./incrementalResult.js"; +export function graphQLResultHasError(result) { + var errors = getGraphQLErrorsFromResult(result); + return isNonEmptyArray(errors); +} +export function getGraphQLErrorsFromResult(result) { + var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (incrementalResult) { + if (incrementalResult.errors) { + graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors); + } + }); + } + return graphQLErrors; +} +//# sourceMappingURL=errorHandling.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js.map new file mode 100644 index 0000000..e9ad581 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/errorHandling.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../../src/utilities/common/errorHandling.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAE3E,MAAM,UAAU,qBAAqB,CAAI,MAAsB;IAC7D,IAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAI,MAAsB;IAClE,IAAM,aAAa,GACjB,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/D,IACE,iCAAiC,CAAC,MAAM,CAAC;QACzC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EACnC,CAAC;QACD,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,iBAAiB;YAC3C,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC;gBAC7B,aAAa,CAAC,IAAI,OAAlB,aAAa,EAAS,iBAAiB,CAAC,MAAM,EAAE;YAClD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { FetchResult } from \"../../link/core/index.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { isExecutionPatchIncrementalResult } from \"./incrementalResult.js\";\n\nexport function graphQLResultHasError(result: FetchResult): boolean {\n const errors = getGraphQLErrorsFromResult(result);\n return isNonEmptyArray(errors);\n}\n\nexport function getGraphQLErrorsFromResult(result: FetchResult) {\n const graphQLErrors =\n isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];\n\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n result.incremental.forEach((incrementalResult) => {\n if (incrementalResult.errors) {\n graphQLErrors.push(...incrementalResult.errors);\n }\n });\n }\n return graphQLErrors;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.d.ts new file mode 100644 index 0000000..ad9f91b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.d.ts @@ -0,0 +1,7 @@ +import type { ExecutionPatchIncrementalResult, ExecutionPatchInitialResult, ExecutionPatchResult, ApolloPayloadResult, FetchResult } from "../../link/core/index.js"; +export declare function isExecutionPatchIncrementalResult(value: FetchResult): value is ExecutionPatchIncrementalResult; +export declare function isExecutionPatchInitialResult(value: FetchResult): value is ExecutionPatchInitialResult; +export declare function isExecutionPatchResult(value: FetchResult): value is ExecutionPatchResult; +export declare function isApolloPayloadResult(value: unknown): value is ApolloPayloadResult; +export declare function mergeIncrementalData(prevResult: TData, result: ExecutionPatchResult): TData; +//# sourceMappingURL=incrementalResult.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js new file mode 100644 index 0000000..d46ef50 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js @@ -0,0 +1,39 @@ +import { isNonNullObject } from "./objects.js"; +import { isNonEmptyArray } from "./arrays.js"; +import { DeepMerger } from "./mergeDeep.js"; +export function isExecutionPatchIncrementalResult(value) { + return "incremental" in value; +} +export function isExecutionPatchInitialResult(value) { + return "hasNext" in value && "data" in value; +} +export function isExecutionPatchResult(value) { + return (isExecutionPatchIncrementalResult(value) || + isExecutionPatchInitialResult(value)); +} +// This function detects an Apollo payload result before it is transformed +// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult +// once it leaves the link chain. +export function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} +export function mergeIncrementalData(prevResult, result) { + var mergedData = prevResult; + var merger = new DeepMerger(); + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (_a) { + var data = _a.data, path = _a.path; + for (var i = path.length - 1; i >= 0; --i) { + var key = path[i]; + var isNumericKey = !isNaN(+key); + var parent_1 = isNumericKey ? [] : {}; + parent_1[key] = data; + data = parent_1; + } + mergedData = merger.merge(mergedData, data); + }); + } + return mergedData; +} +//# sourceMappingURL=incrementalResult.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js.map new file mode 100644 index 0000000..f59e2b9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/incrementalResult.js.map @@ -0,0 +1 @@ +{"version":3,"file":"incrementalResult.js","sourceRoot":"","sources":["../../../src/utilities/common/incrementalResult.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,iCAAiC,CAC/C,KAAqB;IAErB,OAAO,aAAa,IAAI,KAAK,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAqB;IAErB,OAAO,SAAS,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAqB;IAErB,OAAO,CACL,iCAAiC,CAAC,KAAK,CAAC;QACxC,6BAA6B,CAAC,KAAK,CAAC,CACrC,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,2EAA2E;AAC3E,iCAAiC;AACjC,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,KAAK,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAAiB,EACjB,MAAmC;IAEnC,IAAI,UAAU,GAAG,UAAU,CAAC;IAC5B,IAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,IACE,iCAAiC,CAAC,MAAM,CAAC;QACzC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EACnC,CAAC;QACD,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,EAAc;gBAAZ,IAAI,UAAA,EAAE,IAAI,UAAA;YACtC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;gBAC1C,IAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,IAAM,YAAY,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;gBAClC,IAAM,QAAM,GAAiC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpE,QAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACnB,IAAI,GAAG,QAAqB,CAAC;YAC/B,CAAC;YACD,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,UAAmB,CAAC;AAC7B,CAAC","sourcesContent":["import type {\n ExecutionPatchIncrementalResult,\n ExecutionPatchInitialResult,\n ExecutionPatchResult,\n ApolloPayloadResult,\n FetchResult,\n} from \"../../link/core/index.js\";\nimport { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\n\nexport function isExecutionPatchIncrementalResult(\n value: FetchResult\n): value is ExecutionPatchIncrementalResult {\n return \"incremental\" in value;\n}\n\nexport function isExecutionPatchInitialResult(\n value: FetchResult\n): value is ExecutionPatchInitialResult {\n return \"hasNext\" in value && \"data\" in value;\n}\n\nexport function isExecutionPatchResult(\n value: FetchResult\n): value is ExecutionPatchResult {\n return (\n isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value)\n );\n}\n\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(\n value: unknown\n): value is ApolloPayloadResult {\n return isNonNullObject(value) && \"payload\" in value;\n}\n\nexport function mergeIncrementalData(\n prevResult: TData,\n result: ExecutionPatchResult\n) {\n let mergedData = prevResult;\n const merger = new DeepMerger();\n if (\n isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)\n ) {\n result.incremental.forEach(({ data, path }) => {\n for (let i = path.length - 1; i >= 0; --i) {\n const key = path[i];\n const isNumericKey = !isNaN(+key);\n const parent: Record = isNumericKey ? [] : {};\n parent[key] = data;\n data = parent as typeof data;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData as TData;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.d.ts new file mode 100644 index 0000000..78c8cce --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.d.ts @@ -0,0 +1,2 @@ +export declare function makeUniqueId(prefix: string): string; +//# sourceMappingURL=makeUniqueId.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js new file mode 100644 index 0000000..eff7cb8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js @@ -0,0 +1,9 @@ +var prefixCounts = new Map(); +// These IDs won't be globally unique, but they will be unique within this +// process, thanks to the counter, and unguessable thanks to the random suffix. +export function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} +//# sourceMappingURL=makeUniqueId.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js.map new file mode 100644 index 0000000..adefc4c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/makeUniqueId.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeUniqueId.js","sourceRoot":"","sources":["../../../src/utilities/common/makeUniqueId.ts"],"names":[],"mappings":"AAAA,IAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE/C,0EAA0E;AAC1E,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,IAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5C,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACpC,OAAO,UAAG,MAAM,cAAI,KAAK,cAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,CAAC;AACrE,CAAC","sourcesContent":["const prefixCounts = new Map();\n\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix: string) {\n const count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return `${prefix}:${count}:${Math.random().toString(36).slice(2)}`;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.d.ts new file mode 100644 index 0000000..1cce5f1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.d.ts @@ -0,0 +1,2 @@ +export declare function maybeDeepFreeze(obj: T): T; +//# sourceMappingURL=maybeDeepFreeze.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js new file mode 100644 index 0000000..ad943bf --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js @@ -0,0 +1,36 @@ +import { isNonNullObject } from "./objects.js"; +function deepFreeze(value) { + var workSet = new Set([value]); + workSet.forEach(function (obj) { + if (isNonNullObject(obj) && shallowFreeze(obj) === obj) { + Object.getOwnPropertyNames(obj).forEach(function (name) { + if (isNonNullObject(obj[name])) + workSet.add(obj[name]); + }); + } + }); + return value; +} +function shallowFreeze(obj) { + if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) { + try { + Object.freeze(obj); + } + catch (e) { + // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but + // they all throw a TypeError when you try, so we re-throw any exceptions + // that are not TypeErrors, since that would be unexpected. + if (e instanceof TypeError) + return null; + throw e; + } + } + return obj; +} +export function maybeDeepFreeze(obj) { + if (globalThis.__DEV__ !== false) { + deepFreeze(obj); + } + return obj; +} +//# sourceMappingURL=maybeDeepFreeze.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js.map new file mode 100644 index 0000000..ceb24f4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js.map @@ -0,0 +1 @@ +{"version":3,"file":"maybeDeepFreeze.js","sourceRoot":"","sources":["../../../src/utilities/common/maybeDeepFreeze.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,SAAS,UAAU,CAAC,KAAU;IAC5B,IAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,OAAO,CAAC,UAAC,GAAG;QAClB,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;YACvD,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI;gBAC3C,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAmB,GAAM;IAC7C,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,wEAAwE;YACxE,yEAAyE;YACzE,2DAA2D;YAC3D,IAAI,CAAC,YAAY,SAAS;gBAAE,OAAO,IAAI,CAAC;YACxC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,eAAe,CAAI,GAAM;IACvC,IAAI,OAAO,EAAE,CAAC;QACZ,UAAU,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { isNonNullObject } from \"./objects.js\";\n\nfunction deepFreeze(value: any) {\n const workSet = new Set([value]);\n workSet.forEach((obj) => {\n if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {\n Object.getOwnPropertyNames(obj).forEach((name) => {\n if (isNonNullObject(obj[name])) workSet.add(obj[name]);\n });\n }\n });\n return value;\n}\n\nfunction shallowFreeze(obj: T): T | null {\n if (__DEV__ && !Object.isFrozen(obj)) {\n try {\n Object.freeze(obj);\n } catch (e) {\n // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but\n // they all throw a TypeError when you try, so we re-throw any exceptions\n // that are not TypeErrors, since that would be unexpected.\n if (e instanceof TypeError) return null;\n throw e;\n }\n }\n return obj;\n}\n\nexport function maybeDeepFreeze(obj: T): T {\n if (__DEV__) {\n deepFreeze(obj);\n }\n return obj;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.d.ts new file mode 100644 index 0000000..bc73e98 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.d.ts @@ -0,0 +1,14 @@ +import { isNonNullObject } from "./objects.js"; +export type TupleToIntersection = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any; +export declare function mergeDeep(...sources: T): TupleToIntersection; +export declare function mergeDeepArray(sources: T[]): T; +export type ReconcilerFunction = (this: DeepMerger, target: Record, source: Record, property: string | number, ...context: TContextArgs) => any; +export declare class DeepMerger { + private reconciler; + constructor(reconciler?: ReconcilerFunction); + merge(target: any, source: any, ...context: TContextArgs): any; + isObject: typeof isNonNullObject; + private pastCopies; + shallowCopyForMerge(value: T): T; +} +//# sourceMappingURL=mergeDeep.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js new file mode 100644 index 0000000..f1b9637 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js @@ -0,0 +1,89 @@ +import { __assign, __spreadArray } from "tslib"; +import { isNonNullObject } from "./objects.js"; +var hasOwnProperty = Object.prototype.hasOwnProperty; +export function mergeDeep() { + var sources = []; + for (var _i = 0; _i < arguments.length; _i++) { + sources[_i] = arguments[_i]; + } + return mergeDeepArray(sources); +} +// In almost any situation where you could succeed in getting the +// TypeScript compiler to infer a tuple type for the sources array, you +// could just use mergeDeep instead of mergeDeepArray, so instead of +// trying to convert T[] to an intersection type we just infer the array +// element type, which works perfectly when the sources array has a +// consistent element type. +export function mergeDeepArray(sources) { + var target = sources[0] || {}; + var count = sources.length; + if (count > 1) { + var merger = new DeepMerger(); + for (var i = 1; i < count; ++i) { + target = merger.merge(target, sources[i]); + } + } + return target; +} +var defaultReconciler = function (target, source, property) { + return this.merge(target[property], source[property]); +}; +var DeepMerger = /** @class */ (function () { + function DeepMerger(reconciler) { + if (reconciler === void 0) { reconciler = defaultReconciler; } + this.reconciler = reconciler; + this.isObject = isNonNullObject; + this.pastCopies = new Set(); + } + DeepMerger.prototype.merge = function (target, source) { + var _this = this; + var context = []; + for (var _i = 2; _i < arguments.length; _i++) { + context[_i - 2] = arguments[_i]; + } + if (isNonNullObject(source) && isNonNullObject(target)) { + Object.keys(source).forEach(function (sourceKey) { + if (hasOwnProperty.call(target, sourceKey)) { + var targetValue = target[sourceKey]; + if (source[sourceKey] !== targetValue) { + var result = _this.reconciler.apply(_this, __spreadArray([target, + source, + sourceKey], context, false)); + // A well-implemented reconciler may return targetValue to indicate + // the merge changed nothing about the structure of the target. + if (result !== targetValue) { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = result; + } + } + } + else { + // If there is no collision, the target can safely share memory with + // the source, and the recursion can terminate here. + target = _this.shallowCopyForMerge(target); + target[sourceKey] = source[sourceKey]; + } + }); + return target; + } + // If source (or target) is not an object, let source replace target. + return source; + }; + DeepMerger.prototype.shallowCopyForMerge = function (value) { + if (isNonNullObject(value)) { + if (!this.pastCopies.has(value)) { + if (Array.isArray(value)) { + value = value.slice(0); + } + else { + value = __assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + this.pastCopies.add(value); + } + } + return value; + }; + return DeepMerger; +}()); +export { DeepMerger }; +//# sourceMappingURL=mergeDeep.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js.map new file mode 100644 index 0000000..3376a72 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeDeep.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mergeDeep.js","s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C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,KAAK,GAAI,KAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAClC,CAAC;qBAAM,CAAC;oBACN,KAAK,cACH,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,IACpC,KAAK,CACT,CAAC;gBACJ,CAAC;gBACD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACH,iBAAC;AAAD,CAAC,AA3DD,IA2DC","sourcesContent":["import { isNonNullObject } from \"./objects.js\";\n\nconst { hasOwnProperty } = Object.prototype;\n\n// These mergeDeep and mergeDeepArray utilities merge any number of objects\n// together, sharing as much memory as possible with the source objects, while\n// remaining careful to avoid modifying any source objects.\n\n// Logically, the return type of mergeDeep should be the intersection of\n// all the argument types. The binary call signature is by far the most\n// common, but we support 0- through 5-ary as well. After that, the\n// resulting type is just the inferred array element type. Note to nerds:\n// there is a more clever way of doing this that converts the tuple type\n// first to a union type (easy enough: T[number]) and then converts the\n// union to an intersection type using distributive conditional type\n// inference, but that approach has several fatal flaws (boolean becomes\n// true & false, and the inferred type ends up as unknown in many cases),\n// in addition to being nearly impossible to explain/understand.\nexport type TupleToIntersection =\n T extends [infer A] ? A\n : T extends [infer A, infer B] ? A & B\n : T extends [infer A, infer B, infer C] ? A & B & C\n : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D\n : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E\n : T extends (infer U)[] ? U\n : any;\n\nexport function mergeDeep(\n ...sources: T\n): TupleToIntersection {\n return mergeDeepArray(sources);\n}\n\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources: T[]): T {\n let target = sources[0] || ({} as T);\n const count = sources.length;\n if (count > 1) {\n const merger = new DeepMerger();\n for (let i = 1; i < count; ++i) {\n target = merger.merge(target, sources[i]);\n }\n }\n return target;\n}\n\nexport type ReconcilerFunction = (\n this: DeepMerger,\n target: Record,\n source: Record,\n property: string | number,\n ...context: TContextArgs\n) => any;\n\nconst defaultReconciler: ReconcilerFunction = function (\n target,\n source,\n property\n) {\n return this.merge(target[property], source[property]);\n};\n\nexport class DeepMerger {\n constructor(\n private reconciler: ReconcilerFunction = defaultReconciler as any as ReconcilerFunction\n ) {}\n\n public merge(target: any, source: any, ...context: TContextArgs): any {\n if (isNonNullObject(source) && isNonNullObject(target)) {\n Object.keys(source).forEach((sourceKey) => {\n if (hasOwnProperty.call(target, sourceKey)) {\n const targetValue = target[sourceKey];\n if (source[sourceKey] !== targetValue) {\n const result = this.reconciler(\n target,\n source,\n sourceKey,\n ...context\n );\n // A well-implemented reconciler may return targetValue to indicate\n // the merge changed nothing about the structure of the target.\n if (result !== targetValue) {\n target = this.shallowCopyForMerge(target);\n target[sourceKey] = result;\n }\n }\n } else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target = this.shallowCopyForMerge(target);\n target[sourceKey] = source[sourceKey];\n }\n });\n\n return target;\n }\n\n // If source (or target) is not an object, let source replace target.\n return source;\n }\n\n public isObject = isNonNullObject;\n\n private pastCopies = new Set();\n\n public shallowCopyForMerge(value: T): T {\n if (isNonNullObject(value)) {\n if (!this.pastCopies.has(value)) {\n if (Array.isArray(value)) {\n value = (value as any).slice(0);\n } else {\n value = {\n __proto__: Object.getPrototypeOf(value),\n ...value,\n };\n }\n this.pastCopies.add(value);\n }\n }\n return value;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.d.ts new file mode 100644 index 0000000..67050d3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.d.ts @@ -0,0 +1,5 @@ +import type { QueryOptions, WatchQueryOptions, MutationOptions, OperationVariables } from "../../core/index.js"; +type OptionsUnion = WatchQueryOptions | QueryOptions | MutationOptions; +export declare function mergeOptions>, TOptions extends TDefaultOptions>(defaults: TDefaultOptions | Partial | undefined, options: TOptions | Partial): TOptions & TDefaultOptions; +export {}; +//# sourceMappingURL=mergeOptions.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js new file mode 100644 index 0000000..86d9764 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js @@ -0,0 +1,8 @@ +import { __assign } from "tslib"; +import { compact } from "./compact.js"; +export function mergeOptions(defaults, options) { + return compact(defaults, options, options.variables && { + variables: compact(__assign(__assign({}, (defaults && defaults.variables)), options.variables)), + }); +} +//# sourceMappingURL=mergeOptions.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js.map new file mode 100644 index 0000000..db0f1d7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/mergeOptions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mergeOptions.js","sourceRoot":"","sources":["../../../src/utilities/common/mergeOptions.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAOvC,MAAM,UAAU,YAAY,CAI1B,QAAgE,EAChE,OAAqC;IAErC,OAAO,OAAO,CACZ,QAAQ,EACR,OAAO,EACP,OAAO,CAAC,SAAS,IAAI;QACnB,SAAS,EAAE,OAAO,uBACb,CAAC,QAAQ,IAAI,QAAQ,CAAC,SAAS,CAAC,GAChC,OAAO,CAAC,SAAS,EACpB;KACH,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n QueryOptions,\n WatchQueryOptions,\n MutationOptions,\n OperationVariables,\n} from \"../../core/index.js\";\n\nimport { compact } from \"./compact.js\";\n\ntype OptionsUnion =\n | WatchQueryOptions\n | QueryOptions\n | MutationOptions;\n\nexport function mergeOptions<\n TDefaultOptions extends Partial>,\n TOptions extends TDefaultOptions,\n>(\n defaults: TDefaultOptions | Partial | undefined,\n options: TOptions | Partial\n): TOptions & TDefaultOptions {\n return compact(\n defaults,\n options,\n options.variables && {\n variables: compact({\n ...(defaults && defaults.variables),\n ...options.variables,\n }),\n }\n );\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.d.ts new file mode 100644 index 0000000..9569688 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.d.ts @@ -0,0 +1,3 @@ +export declare function isNonNullObject(obj: any): obj is Record; +export declare function isPlainObject(obj: any): obj is Record; +//# sourceMappingURL=objects.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js new file mode 100644 index 0000000..58d9914 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js @@ -0,0 +1,10 @@ +export function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} +export function isPlainObject(obj) { + return (obj !== null && + typeof obj === "object" && + (Object.getPrototypeOf(obj) === Object.prototype || + Object.getPrototypeOf(obj) === null)); +} +//# sourceMappingURL=objects.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js.map new file mode 100644 index 0000000..c13b688 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/objects.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../../src/utilities/common/objects.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,GAAQ;IACtC,OAAO,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAQ;IACpC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,SAAS;YAC9C,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CACvC,CAAC;AACJ,CAAC","sourcesContent":["export function isNonNullObject(obj: any): obj is Record {\n return obj !== null && typeof obj === \"object\";\n}\n\nexport function isPlainObject(obj: any): obj is Record {\n return (\n obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null)\n );\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.d.ts new file mode 100644 index 0000000..4c96f5a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.d.ts @@ -0,0 +1,3 @@ +import type { DeepOmit } from "../types/DeepOmit.js"; +export declare function omitDeep(value: T, key: K): DeepOmit; +//# sourceMappingURL=omitDeep.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js new file mode 100644 index 0000000..5d8e61d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js @@ -0,0 +1,41 @@ +import { isPlainObject } from "./objects.js"; +export function omitDeep(value, key) { + return __omitDeep(value, key); +} +function __omitDeep(value, key, known) { + if (known === void 0) { known = new Map(); } + if (known.has(value)) { + return known.get(value); + } + var modified = false; + if (Array.isArray(value)) { + var array_1 = []; + known.set(value, array_1); + value.forEach(function (value, index) { + var result = __omitDeep(value, key, known); + modified || (modified = result !== value); + array_1[index] = result; + }); + if (modified) { + return array_1; + } + } + else if (isPlainObject(value)) { + var obj_1 = Object.create(Object.getPrototypeOf(value)); + known.set(value, obj_1); + Object.keys(value).forEach(function (k) { + if (k === key) { + modified = true; + return; + } + var result = __omitDeep(value[k], key, known); + modified || (modified = result !== value[k]); + obj_1[k] = result; + }); + if (modified) { + return obj_1; + } + } + return value; +} +//# sourceMappingURL=omitDeep.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js.map new file mode 100644 index 0000000..752c851 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/omitDeep.js.map @@ -0,0 +1 @@ +{"version":3,"file":"omitDeep.js","sourceRoot":"","sources":["../../../src/utilities/common/omitDeep.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,UAAU,QAAQ,CAAsB,KAAQ,EAAE,GAAM;IAC5D,OAAO,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,UAAU,CACjB,KAAQ,EACR,GAAM,EACN,KAA2B;IAA3B,sBAAA,EAAA,YAAY,GAAG,EAAY;IAE3B,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,IAAM,OAAK,GAAU,EAAE,CAAC;QACxB,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,OAAK,CAAC,CAAC;QAExB,KAAK,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,KAAK;YACzB,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAC7C,QAAQ,KAAR,QAAQ,GAAK,MAAM,KAAK,KAAK,EAAC;YAE9B,OAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,OAAuB,CAAC;QACjC,CAAC;IACH,CAAC;SAAM,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,IAAM,KAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;QACxD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,KAAG,CAAC,CAAC;QAEtB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,CAAC;YAC3B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;gBACd,QAAQ,GAAG,IAAI,CAAC;gBAChB,OAAO;YACT,CAAC;YAED,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAChD,QAAQ,KAAR,QAAQ,GAAK,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,EAAC;YAEjC,KAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,KAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,KAAuB,CAAC;AACjC,CAAC","sourcesContent":["import type { DeepOmit } from \"../types/DeepOmit.js\";\nimport { isPlainObject } from \"./objects.js\";\n\nexport function omitDeep(value: T, key: K) {\n return __omitDeep(value, key);\n}\n\nfunction __omitDeep(\n value: T,\n key: K,\n known = new Map()\n): DeepOmit {\n if (known.has(value)) {\n return known.get(value);\n }\n\n let modified = false;\n\n if (Array.isArray(value)) {\n const array: any[] = [];\n known.set(value, array);\n\n value.forEach((value, index) => {\n const result = __omitDeep(value, key, known);\n modified ||= result !== value;\n\n array[index] = result;\n });\n\n if (modified) {\n return array as DeepOmit;\n }\n } else if (isPlainObject(value)) {\n const obj = Object.create(Object.getPrototypeOf(value));\n known.set(value, obj);\n\n Object.keys(value).forEach((k) => {\n if (k === key) {\n modified = true;\n return;\n }\n\n const result = __omitDeep(value[k], key, known);\n modified ||= result !== value[k];\n\n obj[k] = result;\n });\n\n if (modified) {\n return obj;\n }\n }\n\n return value as DeepOmit;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.d.ts new file mode 100644 index 0000000..42f8118 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.d.ts @@ -0,0 +1,2 @@ +export declare function stringifyForDisplay(value: any, space?: number): string; +//# sourceMappingURL=stringifyForDisplay.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js new file mode 100644 index 0000000..693b3f1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js @@ -0,0 +1,11 @@ +import { makeUniqueId } from "./makeUniqueId.js"; +export function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} +//# sourceMappingURL=stringifyForDisplay.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js.map new file mode 100644 index 0000000..5fafd08 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/stringifyForDisplay.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stringifyForDisplay.js","sourceRoot":"","sources":["../../../src/utilities/common/stringifyForDisplay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,mBAAmB,CAAC,KAAU,EAAE,KAAS;IAAT,sBAAA,EAAA,SAAS;IACvD,IAAM,OAAO,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC,SAAS,CACnB,KAAK,EACL,UAAC,GAAG,EAAE,KAAK;QACT,OAAO,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,EACD,KAAK,CACN;SACE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SAC9B,IAAI,CAAC,aAAa,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import { makeUniqueId } from \"./makeUniqueId.js\";\n\nexport function stringifyForDisplay(value: any, space = 0): string {\n const undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(\n value,\n (key, value) => {\n return value === void 0 ? undefId : value;\n },\n space\n )\n .split(JSON.stringify(undefId))\n .join(\"\");\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.d.ts new file mode 100644 index 0000000..c8c0881 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.d.ts @@ -0,0 +1,2 @@ +export declare function stripTypename(value: T): import("../index.js").DeepOmit; +//# sourceMappingURL=stripTypename.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js b/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js new file mode 100644 index 0000000..458f0fc --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js @@ -0,0 +1,5 @@ +import { omitDeep } from "./omitDeep.js"; +export function stripTypename(value) { + return omitDeep(value, "__typename"); +} +//# sourceMappingURL=stripTypename.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js.map new file mode 100644 index 0000000..40d7c87 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/common/stripTypename.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stripTypename.js","sourceRoot":"","sources":["../../../src/utilities/common/stripTypename.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,aAAa,CAAI,KAAQ;IACvC,OAAO,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { omitDeep } from \"./omitDeep.js\";\n\nexport function stripTypename(value: T) {\n return omitDeep(value, \"__typename\");\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.d.ts new file mode 100644 index 0000000..8468052 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.d.ts @@ -0,0 +1,8 @@ +declare global { + interface Window { + __DEV__?: boolean; + } +} +declare const _default: typeof globalThis & Window; +export default _default; +//# sourceMappingURL=global.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js b/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js new file mode 100644 index 0000000..15d80b5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js @@ -0,0 +1,14 @@ +import { maybe } from "./maybe.js"; +export default (maybe(function () { return globalThis; }) || + maybe(function () { return window; }) || + maybe(function () { return self; }) || + maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as +// long as at least one of globalThis, window, self, or global is defined, so +// we are under no obligation to make it easy for static analysis tools to +// detect syntactic usage of the Function constructor. If you think you can +// improve your static analysis to detect this obfuscation, think again. This +// is an arms race you cannot win, at least not in JavaScript. +maybe(function () { + return maybe.constructor("return this")(); +})); +//# sourceMappingURL=global.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js.map new file mode 100644 index 0000000..42adb65 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/global.js.map @@ -0,0 +1 @@ +{"version":3,"file":"global.js","sourceRoot":"","sources":["../../../src/utilities/globals/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AASnC,eAAe,CAAC,KAAK,CAAC,cAAM,OAAA,UAAU,EAAV,CAAU,CAAC;IACrC,KAAK,CAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;IACnB,KAAK,CAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;IACjB,KAAK,CAAC,cAAM,OAAA,MAAM,EAAN,CAAM,CAAC;IACnB,6EAA6E;IAC7E,6EAA6E;IAC7E,0EAA0E;IAC1E,2EAA2E;IAC3E,6EAA6E;IAC7E,8DAA8D;IAC9D,KAAK,CAAC;QACJ,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;IAC5C,CAAC,CAAC,CAA+B,CAAC","sourcesContent":["import { maybe } from \"./maybe.js\";\n\ndeclare global {\n const __DEV__: boolean; // will be removed in `dist` by the `postprocessDist` script\n interface Window {\n __DEV__?: boolean;\n }\n}\n\nexport default (maybe(() => globalThis) ||\n maybe(() => window) ||\n maybe(() => self) ||\n maybe(() => global) ||\n // We don't expect the Function constructor ever to be invoked at runtime, as\n // long as at least one of globalThis, window, self, or global is defined, so\n // we are under no obligation to make it easy for static analysis tools to\n // detect syntactic usage of the Function constructor. If you think you can\n // improve your static analysis to detect this obfuscation, think again. This\n // is an arms race you cannot win, at least not in JavaScript.\n maybe(function () {\n return maybe.constructor(\"return this\")();\n })) as typeof globalThis & Window;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs b/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs new file mode 100644 index 0000000..6993042 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs @@ -0,0 +1,111 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tsInvariant = require('ts-invariant'); + +var version = "3.9.5"; + +function maybe(thunk) { + try { + return thunk(); + } + catch (_a) { } +} + +var global$1 = (maybe(function () { return globalThis; }) || + maybe(function () { return window; }) || + maybe(function () { return self; }) || + maybe(function () { return global; }) || +maybe(function () { + return maybe.constructor("return this")(); +})); + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} + +function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} + +function wrap(fn) { + return function (message) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof message === "number") { + var arg0 = message; + message = getHandledErrorMsg(arg0); + if (!message) { + message = getFallbackErrorMsg(arg0, args); + args = []; + } + } + fn.apply(void 0, [message].concat(args)); + }; +} +var invariant = Object.assign(function invariant(condition, message) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (!condition) { + tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args)); + } +}, { + debug: wrap(tsInvariant.invariant.debug), + log: wrap(tsInvariant.invariant.log), + warn: wrap(tsInvariant.invariant.warn), + error: wrap(tsInvariant.invariant.error), +}); +function newInvariantError(message) { + var optionalParams = []; + for (var _i = 1; _i < arguments.length; _i++) { + optionalParams[_i - 1] = arguments[_i]; + } + return new tsInvariant.InvariantError(getHandledErrorMsg(message, optionalParams) || + getFallbackErrorMsg(message, optionalParams)); +} +var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version); +function stringify(arg) { + return typeof arg == "string" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000)); +} +function getHandledErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return (global$1[ApolloErrorMessageHandler] && + global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify))); +} +function getFallbackErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({ + version: version, + message: message, + args: messageArgs.map(stringify), + }))); +} + +var DEV = globalThis.__DEV__ !== false; + +exports.InvariantError = tsInvariant.InvariantError; +exports.DEV = DEV; +exports.__DEV__ = DEV; +exports.global = global$1; +exports.invariant = invariant; +exports.maybe = maybe; +exports.newInvariantError = newInvariantError; +//# sourceMappingURL=globals.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.map b/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.map new file mode 100644 index 0000000..b4ceebb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"globals.cjs","sources":["../../version.js","maybe.js","global.js","../common/makeUniqueId.js","../common/stringifyForDisplay.js","invariantWrappers.js","index.js"],"sourcesContent":["export var version = \"3.9.5\";\n//# sourceMappingURL=version.js.map","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as\n// long as at least one of globalThis, window, self, or global is defined, so\n// we are under no obligation to make it easy for static analysis tools to\n// detect syntactic usage of the Function constructor. If you think you can\n// improve your static analysis to detect this obfuscation, think again. This\n// is an arms race you cannot win, at least not in JavaScript.\nmaybe(function () {\n return maybe.constructor(\"return this\")();\n}));\n//# sourceMappingURL=global.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\nfunction wrap(fn) {\n return function (message) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof message === \"number\") {\n var arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn.apply(void 0, [message].concat(args));\n };\n}\nvar invariant = Object.assign(function invariant(condition, message) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (!condition) {\n originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));\n }\n}, {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n});\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(message) {\n var optionalParams = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n optionalParams[_i - 1] = arguments[_i];\n }\n return new InvariantError(getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams));\n}\nvar ApolloErrorMessageHandler = Symbol.for(\"ApolloErrorMessageHandler_\" + version);\nfunction stringify(arg) {\n return typeof arg == \"string\" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000));\n}\nfunction getHandledErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));\n}\nfunction getFallbackErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return \"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#\".concat(encodeURIComponent(JSON.stringify({\n version: version,\n message: message,\n args: messageArgs.map(stringify),\n })));\n}\nexport { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, };\n//# sourceMappingURL=invariantWrappers.js.map","import { invariant, newInvariantError, InvariantError, } from \"./invariantWrappers.js\";\nexport { maybe } from \"./maybe.js\";\nexport { default as global } from \"./global.js\";\nexport { invariant, newInvariantError, InvariantError };\n/**\n * @deprecated we do not use this internally anymore,\n * it is just exported for backwards compatibility\n */\n// this file is extempt from automatic `__DEV__` replacement\n// so we have to write it out here\n// @ts-ignore\nexport var DEV = globalThis.__DEV__ !== false;\nexport { DEV as __DEV__ };\n//# sourceMappingURL=index.js.map"],"names":["originalInvariant","InvariantError","global"],"mappings":";;;;;;AAAO,IAAI,OAAO,GAAG,OAAO;;ACArB,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI;AACR,QAAQ,OAAO,KAAK,EAAE,CAAC;AACvB,KAAK;AACL,IAAI,OAAO,EAAE,EAAE,GAAG;AAClB;;ACJA,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,UAAU,CAAC,EAAE,CAAC;AACzD,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AACzC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;AACvC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AAMzC,KAAK,CAAC,YAAY;AAClB,IAAI,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;AAC9C,CAAC,CAAC;;ACZF,IAAI,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAGtB,SAAS,YAAY,CAAC,MAAM,EAAE;AACrC,IAAI,IAAI,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;AACxC,IAAI,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ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;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.native.js new file mode 100644 index 0000000..6993042 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/globals.cjs.native.js @@ -0,0 +1,111 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tsInvariant = require('ts-invariant'); + +var version = "3.9.5"; + +function maybe(thunk) { + try { + return thunk(); + } + catch (_a) { } +} + +var global$1 = (maybe(function () { return globalThis; }) || + maybe(function () { return window; }) || + maybe(function () { return self; }) || + maybe(function () { return global; }) || +maybe(function () { + return maybe.constructor("return this")(); +})); + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} + +function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} + +function wrap(fn) { + return function (message) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof message === "number") { + var arg0 = message; + message = getHandledErrorMsg(arg0); + if (!message) { + message = getFallbackErrorMsg(arg0, args); + args = []; + } + } + fn.apply(void 0, [message].concat(args)); + }; +} +var invariant = Object.assign(function invariant(condition, message) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (!condition) { + tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args)); + } +}, { + debug: wrap(tsInvariant.invariant.debug), + log: wrap(tsInvariant.invariant.log), + warn: wrap(tsInvariant.invariant.warn), + error: wrap(tsInvariant.invariant.error), +}); +function newInvariantError(message) { + var optionalParams = []; + for (var _i = 1; _i < arguments.length; _i++) { + optionalParams[_i - 1] = arguments[_i]; + } + return new tsInvariant.InvariantError(getHandledErrorMsg(message, optionalParams) || + getFallbackErrorMsg(message, optionalParams)); +} +var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version); +function stringify(arg) { + return typeof arg == "string" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000)); +} +function getHandledErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return (global$1[ApolloErrorMessageHandler] && + global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify))); +} +function getFallbackErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({ + version: version, + message: message, + args: messageArgs.map(stringify), + }))); +} + +var DEV = globalThis.__DEV__ !== false; + +exports.InvariantError = tsInvariant.InvariantError; +exports.DEV = DEV; +exports.__DEV__ = DEV; +exports.global = global$1; +exports.invariant = invariant; +exports.maybe = maybe; +exports.newInvariantError = newInvariantError; +//# sourceMappingURL=globals.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.d.ts new file mode 100644 index 0000000..8414142 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.d.ts @@ -0,0 +1,11 @@ +import { invariant, newInvariantError, InvariantError } from "./invariantWrappers.js"; +export { maybe } from "./maybe.js"; +export { default as global } from "./global.js"; +export { invariant, newInvariantError, InvariantError }; +/** + * @deprecated we do not use this internally anymore, + * it is just exported for backwards compatibility + */ +export declare const DEV: boolean; +export { DEV as __DEV__ }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js b/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js new file mode 100644 index 0000000..a62ebd2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js @@ -0,0 +1,14 @@ +import { invariant, newInvariantError, InvariantError, } from "./invariantWrappers.js"; +export { maybe } from "./maybe.js"; +export { default as global } from "./global.js"; +export { invariant, newInvariantError, InvariantError }; +/** + * @deprecated we do not use this internally anymore, + * it is just exported for backwards compatibility + */ +// this file is extempt from automatic `__DEV__` replacement +// so we have to write it out here +// @ts-ignore +export var DEV = globalThis.__DEV__ !== false; +export { DEV as __DEV__ }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js.map new file mode 100644 index 0000000..db1e605 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/globals/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,cAAc,GACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC;AAExD;;;GAGG;AACH,4DAA4D;AAC5D,kCAAkC;AAClC,aAAa;AACb,MAAM,CAAC,IAAM,GAAG,GAAG,UAAU,CAAC,OAAO,KAAK,KAAK,CAAC;AAChD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC","sourcesContent":["import {\n invariant,\n newInvariantError,\n InvariantError,\n} from \"./invariantWrappers.js\";\n\nexport { maybe } from \"./maybe.js\";\nexport { default as global } from \"./global.js\";\nexport { invariant, newInvariantError, InvariantError };\n\n/**\n * @deprecated we do not use this internally anymore,\n * it is just exported for backwards compatibility\n */\n// this file is extempt from automatic `__DEV__` replacement\n// so we have to write it out here\n// @ts-ignore\nexport const DEV = globalThis.__DEV__ !== false;\nexport { DEV as __DEV__ };\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.d.ts new file mode 100644 index 0000000..53ad5d1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.d.ts @@ -0,0 +1,64 @@ +import { InvariantError } from "ts-invariant"; +import type { ErrorCodes } from "../../invariantErrorCodes.js"; +type LogFunction = { + /** + * Logs a `$level` message if the user used `ts-invariant`'s `setVerbosity` to set + * a verbosity level of `$level` or lower. (defaults to `"log"`). + * + * The user will either be presented with a link to the documentation for the message, + * or they can use the `loadDevMessages` to add the message strings to the bundle. + * The documentation will display the message without argument substitution. + * Instead, the arguments will be printed on the console after the link. + * + * `message` can only be a string, a concatenation of strings, or a ternary statement + * that results in a string. This will be enforced on build, where the message will + * be replaced with a message number. + * + * String substitutions like %s, %o, %d or %f are supported. + */ + (message?: any, ...optionalParams: unknown[]): void; +}; +type WrappedInvariant = { + /** + * Throws and InvariantError with the given message if the condition is false. + * + * `message` can only be a string, a concatenation of strings, or a ternary statement + * that results in a string. This will be enforced on build, where the message will + * be replaced with a message number. + * + * The user will either be presented with a link to the documentation for the message, + * or they can use the `loadErrorMessages` to add the message strings to the bundle. + * The documentation will display the message with the arguments substituted. + * + * String substitutions with %s are supported and will also return + * pretty-stringified objects. + * Excess `optionalParams` will be swallowed. + */ + (condition: any, message?: string | number, ...optionalParams: unknown[]): asserts condition; + debug: LogFunction; + log: LogFunction; + warn: LogFunction; + error: LogFunction; +}; +declare const invariant: WrappedInvariant; +/** + * Returns an InvariantError. + * + * `message` can only be a string, a concatenation of strings, or a ternary statement + * that results in a string. This will be enforced on build, where the message will + * be replaced with a message number. + * String substitutions with %s are supported and will also return + * pretty-stringified objects. + * Excess `optionalParams` will be swallowed. + */ +declare function newInvariantError(message?: string | number, ...optionalParams: unknown[]): InvariantError; +declare const ApolloErrorMessageHandler: unique symbol; +declare global { + interface Window { + [ApolloErrorMessageHandler]?: { + (message: string | number, args: unknown[]): string | undefined; + } & ErrorCodes; + } +} +export { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, }; +//# sourceMappingURL=invariantWrappers.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js b/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js new file mode 100644 index 0000000..124e31b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js @@ -0,0 +1,76 @@ +import { invariant as originalInvariant, InvariantError } from "ts-invariant"; +import { version } from "../../version.js"; +import global from "./global.js"; +import { stringifyForDisplay } from "../common/stringifyForDisplay.js"; +function wrap(fn) { + return function (message) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof message === "number") { + var arg0 = message; + message = getHandledErrorMsg(arg0); + if (!message) { + message = getFallbackErrorMsg(arg0, args); + args = []; + } + } + fn.apply(void 0, [message].concat(args)); + }; +} +var invariant = Object.assign(function invariant(condition, message) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (!condition) { + originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args)); + } +}, { + debug: wrap(originalInvariant.debug), + log: wrap(originalInvariant.log), + warn: wrap(originalInvariant.warn), + error: wrap(originalInvariant.error), +}); +/** + * Returns an InvariantError. + * + * `message` can only be a string, a concatenation of strings, or a ternary statement + * that results in a string. This will be enforced on build, where the message will + * be replaced with a message number. + * String substitutions with %s are supported and will also return + * pretty-stringified objects. + * Excess `optionalParams` will be swallowed. + */ +function newInvariantError(message) { + var optionalParams = []; + for (var _i = 1; _i < arguments.length; _i++) { + optionalParams[_i - 1] = arguments[_i]; + } + return new InvariantError(getHandledErrorMsg(message, optionalParams) || + getFallbackErrorMsg(message, optionalParams)); +} +var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version); +function stringify(arg) { + return typeof arg == "string" ? arg : (stringifyForDisplay(arg, 2).slice(0, 1000)); +} +function getHandledErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return (global[ApolloErrorMessageHandler] && + global[ApolloErrorMessageHandler](message, messageArgs.map(stringify))); +} +function getFallbackErrorMsg(message, messageArgs) { + if (messageArgs === void 0) { messageArgs = []; } + if (!message) + return; + return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({ + version: version, + message: message, + args: messageArgs.map(stringify), + }))); +} +export { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, }; +//# sourceMappingURL=invariantWrappers.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js.map new file mode 100644 index 0000000..93f7609 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/invariantWrappers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"invariantWrappers.js","sourceRoot":"","sources":["../../../src/utilities/globals/invariantWrappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,SAAS,IAAI,CAAC,EAA0C;IACtD,OAAO,UAAU,OAAyB;QAAE,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,6BAAc;;QACxD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,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,GAAG,CAC1C,4BAA4B,GAAG,OAAO,CACvC,CAAC;AASF,SAAS,SAAS,CAAC,GAAQ;IACzB,OAAO,OAAO,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAClC,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAC3C,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CACzB,OAAyB,EACzB,WAA2B;IAA3B,4BAAA,EAAA,gBAA2B;IAE3B,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,OAAO,CACL,MAAM,CAAC,yBAAyB,CAAC;QACjC,MAAM,CAAC,yBAAyB,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CACvE,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,OAAyB,EACzB,WAA2B;IAA3B,4BAAA,EAAA,gBAA2B;IAE3B,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,OAAO,sGAA+F,kBAAkB,CACtH,IAAI,CAAC,SAAS,CAAC;QACb,OAAO,SAAA;QACP,OAAO,SAAA;QACP,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC;KACjC,CAAC,CACH,CAAE,CAAC;AACN,CAAC;AAED,OAAO,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,yBAAyB,GAC1B,CAAC","sourcesContent":["import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport type { ErrorCodes } from \"../../invariantErrorCodes.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\n\nfunction wrap(fn: (msg?: string, ...args: any[]) => void) {\n return function (message?: string | number, ...args: any[]) {\n if (typeof message === \"number\") {\n const arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn(...[message].concat(args));\n };\n}\n\ntype LogFunction = {\n /**\n * Logs a `$level` message if the user used `ts-invariant`'s `setVerbosity` to set\n * a verbosity level of `$level` or lower. (defaults to `\"log\"`).\n *\n * The user will either be presented with a link to the documentation for the message,\n * or they can use the `loadDevMessages` to add the message strings to the bundle.\n * The documentation will display the message without argument substitution.\n * Instead, the arguments will be printed on the console after the link.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n *\n * String substitutions like %s, %o, %d or %f are supported.\n */\n (message?: any, ...optionalParams: unknown[]): void;\n};\n\ntype WrappedInvariant = {\n /**\n * Throws and InvariantError with the given message if the condition is false.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n *\n * The user will either be presented with a link to the documentation for the message,\n * or they can use the `loadErrorMessages` to add the message strings to the bundle.\n * The documentation will display the message with the arguments substituted.\n *\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\n (\n condition: any,\n message?: string | number,\n ...optionalParams: unknown[]\n ): asserts condition;\n\n debug: LogFunction;\n log: LogFunction;\n warn: LogFunction;\n error: LogFunction;\n};\nconst invariant: WrappedInvariant = Object.assign(\n function invariant(\n condition: any,\n message?: string | number,\n ...args: unknown[]\n ): asserts condition {\n if (!condition) {\n originalInvariant(\n condition,\n getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args)\n );\n }\n },\n {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n }\n);\n\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(\n message?: string | number,\n ...optionalParams: unknown[]\n) {\n return new InvariantError(\n getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams)\n );\n}\n\nconst ApolloErrorMessageHandler = Symbol.for(\n \"ApolloErrorMessageHandler_\" + version\n);\ndeclare global {\n interface Window {\n [ApolloErrorMessageHandler]?: {\n (message: string | number, args: unknown[]): string | undefined;\n } & ErrorCodes;\n }\n}\n\nfunction stringify(arg: any) {\n return typeof arg == \"string\" ? arg : (\n stringifyForDisplay(arg, 2).slice(0, 1000)\n );\n}\n\nfunction getHandledErrorMsg(\n message?: string | number,\n messageArgs: unknown[] = []\n) {\n if (!message) return;\n return (\n global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify))\n );\n}\n\nfunction getFallbackErrorMsg(\n message?: string | number,\n messageArgs: unknown[] = []\n) {\n if (!message) return;\n return `An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#${encodeURIComponent(\n JSON.stringify({\n version,\n message,\n args: messageArgs.map(stringify),\n })\n )}`;\n}\n\nexport {\n invariant,\n InvariantError,\n newInvariantError,\n ApolloErrorMessageHandler,\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.d.ts new file mode 100644 index 0000000..c47e59f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.d.ts @@ -0,0 +1,2 @@ +export declare function maybe(thunk: () => T): T | undefined; +//# sourceMappingURL=maybe.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js b/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js new file mode 100644 index 0000000..cc09be5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js @@ -0,0 +1,7 @@ +export function maybe(thunk) { + try { + return thunk(); + } + catch (_a) { } +} +//# sourceMappingURL=maybe.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js.map new file mode 100644 index 0000000..07862ed --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/maybe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"maybe.js","sourceRoot":"","sources":["../../../src/utilities/globals/maybe.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAI,KAAc;IACrC,IAAI,CAAC;QACH,OAAO,KAAK,EAAE,CAAC;IACjB,CAAC;IAAC,WAAM,CAAC,CAAA,CAAC;AACZ,CAAC","sourcesContent":["export function maybe(thunk: () => T): T | undefined {\n try {\n return thunk();\n } catch {}\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/globals/package.json b/graphql-subscription/node_modules/@apollo/client/utilities/globals/package.json new file mode 100644 index 0000000..4c63fea --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/globals/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/utilities/globals", + "type": "module", + "main": "globals.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": true +} diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.d.ts new file mode 100644 index 0000000..a57f274 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.d.ts @@ -0,0 +1,50 @@ +import type { DocumentNode } from "graphql"; +export type DocumentTransformCacheKey = ReadonlyArray; +type TransformFn = (document: DocumentNode) => DocumentNode; +interface DocumentTransformOptions { + /** + * Determines whether to cache the transformed GraphQL document. Caching can speed up repeated calls to the document transform for the same input document. Set to `false` to completely disable caching for the document transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey) option. + * + * The default value is `true`. + */ + cache?: boolean; + /** + * Defines a custom cache key for a GraphQL document that will determine whether to re-run the document transform when given the same input GraphQL document. Returns an array that defines the cache key. Return `undefined` to disable caching for that GraphQL document. + * + * > **Note:** The items in the array may be any type, but also need to be referentially stable to guarantee a stable cache key. + * + * The default implementation of this function returns the `document` as the cache key. + */ + getCacheKey?: (document: DocumentNode) => DocumentTransformCacheKey | undefined; +} +export declare class DocumentTransform { + private readonly transform; + private cached; + private readonly resultCache; + private getCacheKey; + static identity(): DocumentTransform; + static split(predicate: (document: DocumentNode) => boolean, left: DocumentTransform, right?: DocumentTransform): DocumentTransform & { + left: DocumentTransform; + right: DocumentTransform; + }; + constructor(transform: TransformFn, options?: DocumentTransformOptions); + /** + * Resets the internal cache of this transform, if it has one. + */ + resetCache(): void; + private performWork; + transformDocument(document: DocumentNode): DocumentNode; + concat(otherTransform: DocumentTransform): DocumentTransform; + /** + * @internal + * Used to iterate through all transforms that are concatenations or `split` links. + */ + readonly left?: DocumentTransform; + /** + * @internal + * Used to iterate through all transforms that are concatenations or `split` links. + */ + readonly right?: DocumentTransform; +} +export {}; +//# sourceMappingURL=DocumentTransform.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js new file mode 100644 index 0000000..eb961ad --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js @@ -0,0 +1,94 @@ +import { Trie } from "@wry/trie"; +import { canUseWeakMap, canUseWeakSet } from "../common/canUse.js"; +import { checkDocument } from "./getFromAST.js"; +import { invariant } from "../globals/index.js"; +import { WeakCache } from "@wry/caches"; +import { wrap } from "optimism"; +import { cacheSizes } from "../caching/index.js"; +function identity(document) { + return document; +} +var DocumentTransform = /** @class */ (function () { + function DocumentTransform(transform, options) { + if (options === void 0) { options = Object.create(null); } + this.resultCache = canUseWeakSet ? new WeakSet() : new Set(); + this.transform = transform; + if (options.getCacheKey) { + // Override default `getCacheKey` function, which returns [document]. + this.getCacheKey = options.getCacheKey; + } + this.cached = options.cache !== false; + this.resetCache(); + } + // This default implementation of getCacheKey can be overridden by providing + // options.getCacheKey to the DocumentTransform constructor. In general, a + // getCacheKey function may either return an array of keys (often including + // the document) to be used as a cache key, or undefined to indicate the + // transform for this document should not be cached. + DocumentTransform.prototype.getCacheKey = function (document) { + return [document]; + }; + DocumentTransform.identity = function () { + // No need to cache this transform since it just returns the document + // unchanged. This should save a bit of memory that would otherwise be + // needed to populate the `documentCache` of this transform. + return new DocumentTransform(identity, { cache: false }); + }; + DocumentTransform.split = function (predicate, left, right) { + if (right === void 0) { right = DocumentTransform.identity(); } + return Object.assign(new DocumentTransform(function (document) { + var documentTransform = predicate(document) ? left : right; + return documentTransform.transformDocument(document); + }, + // Reasonably assume both `left` and `right` transforms handle their own caching + { cache: false }), { left: left, right: right }); + }; + /** + * Resets the internal cache of this transform, if it has one. + */ + DocumentTransform.prototype.resetCache = function () { + var _this = this; + if (this.cached) { + var stableCacheKeys_1 = new Trie(canUseWeakMap); + this.performWork = wrap(DocumentTransform.prototype.performWork.bind(this), { + makeCacheKey: function (document) { + var cacheKeys = _this.getCacheKey(document); + if (cacheKeys) { + invariant(Array.isArray(cacheKeys), 66); + return stableCacheKeys_1.lookupArray(cacheKeys); + } + }, + max: cacheSizes["documentTransform.cache"], + cache: (WeakCache), + }); + } + }; + DocumentTransform.prototype.performWork = function (document) { + checkDocument(document); + return this.transform(document); + }; + DocumentTransform.prototype.transformDocument = function (document) { + // If a user passes an already transformed result back to this function, + // immediately return it. + if (this.resultCache.has(document)) { + return document; + } + var transformedDocument = this.performWork(document); + this.resultCache.add(transformedDocument); + return transformedDocument; + }; + DocumentTransform.prototype.concat = function (otherTransform) { + var _this = this; + return Object.assign(new DocumentTransform(function (document) { + return otherTransform.transformDocument(_this.transformDocument(document)); + }, + // Reasonably assume both transforms handle their own caching + { cache: false }), { + left: this, + right: otherTransform, + }); + }; + return DocumentTransform; +}()); +export { DocumentTransform }; +//# sourceMappingURL=DocumentTransform.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js.map new file mode 100644 index 0000000..59ed6f4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/DocumentTransform.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DocumentTransform.js","sourceRoot":"","sources":["../../../src/utilities/graphql/DocumentTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAyBjD,SAAS,QAAQ,CAAC,QAAsB;IACtC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;IA4CE,2BACE,SAAsB,EACtB,OAAuD;QAAvD,wBAAA,EAAA,UAAoC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QA1CxC,gBAAW,GAC1B,aAAa,CAAC,CAAC,CAAC,IAAI,OAAO,EAAgB,CAAC,CAAC,CAAC,IAAI,GAAG,EAAgB,CAAC;QA2CtE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,qEAAqE;YACrE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC;QAEtC,IAAI,CAAC,UAAU,EA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.js\";\nimport { checkDocument } from \"./getFromAST.js\";\nimport { invariant } from \"../globals/index.js\";\nimport type { DocumentNode } from \"graphql\";\nimport { WeakCache } from \"@wry/caches\";\nimport { wrap } from \"optimism\";\nimport { cacheSizes } from \"../caching/index.js\";\n\nexport type DocumentTransformCacheKey = ReadonlyArray;\n\ntype TransformFn = (document: DocumentNode) => DocumentNode;\n\ninterface DocumentTransformOptions {\n /**\n * Determines whether to cache the transformed GraphQL document. Caching can speed up repeated calls to the document transform for the same input document. Set to `false` to completely disable caching for the document transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey) option.\n *\n * The default value is `true`.\n */\n cache?: boolean;\n /**\n * Defines a custom cache key for a GraphQL document that will determine whether to re-run the document transform when given the same input GraphQL document. Returns an array that defines the cache key. Return `undefined` to disable caching for that GraphQL document.\n *\n * > **Note:** The items in the array may be any type, but also need to be referentially stable to guarantee a stable cache key.\n *\n * The default implementation of this function returns the `document` as the cache key.\n */\n getCacheKey?: (\n document: DocumentNode\n ) => DocumentTransformCacheKey | undefined;\n}\n\nfunction identity(document: DocumentNode) {\n return document;\n}\n\nexport class DocumentTransform {\n private readonly transform: TransformFn;\n private cached: boolean;\n\n private readonly resultCache =\n canUseWeakSet ? new WeakSet() : new Set();\n\n // This default implementation of getCacheKey can be overridden by providing\n // options.getCacheKey to the DocumentTransform constructor. In general, a\n // getCacheKey function may either return an array of keys (often including\n // the document) to be used as a cache key, or undefined to indicate the\n // transform for this document should not be cached.\n private getCacheKey(\n document: DocumentNode\n ): DocumentTransformCacheKey | undefined {\n return [document];\n }\n\n static identity() {\n // No need to cache this transform since it just returns the document\n // unchanged. This should save a bit of memory that would otherwise be\n // needed to populate the `documentCache` of this transform.\n return new DocumentTransform(identity, { cache: false });\n }\n\n static split(\n predicate: (document: DocumentNode) => boolean,\n left: DocumentTransform,\n right: DocumentTransform = DocumentTransform.identity()\n ) {\n return Object.assign(\n new DocumentTransform(\n (document) => {\n const documentTransform = predicate(document) ? left : right;\n\n return documentTransform.transformDocument(document);\n },\n // Reasonably assume both `left` and `right` transforms handle their own caching\n { cache: false }\n ),\n { left, right }\n );\n }\n\n constructor(\n transform: TransformFn,\n options: DocumentTransformOptions = Object.create(null)\n ) {\n this.transform = transform;\n\n if (options.getCacheKey) {\n // Override default `getCacheKey` function, which returns [document].\n this.getCacheKey = options.getCacheKey;\n }\n this.cached = options.cache !== false;\n\n this.resetCache();\n }\n\n /**\n * Resets the internal cache of this transform, if it has one.\n */\n resetCache() {\n if (this.cached) {\n const stableCacheKeys = new Trie(canUseWeakMap);\n this.performWork = wrap(\n DocumentTransform.prototype.performWork.bind(this),\n {\n makeCacheKey: (document) => {\n const cacheKeys = this.getCacheKey(document);\n if (cacheKeys) {\n invariant(\n Array.isArray(cacheKeys),\n \"`getCacheKey` must return an array or undefined\"\n );\n return stableCacheKeys.lookupArray(cacheKeys);\n }\n },\n max: cacheSizes[\"documentTransform.cache\"],\n cache: WeakCache,\n }\n );\n }\n }\n\n private performWork(document: DocumentNode) {\n checkDocument(document);\n return this.transform(document);\n }\n\n transformDocument(document: DocumentNode) {\n // If a user passes an already transformed result back to this function,\n // immediately return it.\n if (this.resultCache.has(document)) {\n return document;\n }\n\n const transformedDocument = this.performWork(document);\n\n this.resultCache.add(transformedDocument);\n\n return transformedDocument;\n }\n\n concat(otherTransform: DocumentTransform): DocumentTransform {\n return Object.assign(\n new DocumentTransform(\n (document) => {\n return otherTransform.transformDocument(\n this.transformDocument(document)\n );\n },\n // Reasonably assume both transforms handle their own caching\n { cache: false }\n ),\n {\n left: this,\n right: otherTransform,\n }\n );\n }\n\n /**\n * @internal\n * Used to iterate through all transforms that are concatenations or `split` links.\n */\n readonly left?: DocumentTransform;\n /**\n * @internal\n * Used to iterate through all transforms that are concatenations or `split` links.\n */\n readonly right?: DocumentTransform;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.d.ts new file mode 100644 index 0000000..a2ed5ea --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.d.ts @@ -0,0 +1,18 @@ +import type { SelectionNode, DirectiveNode, DocumentNode, ArgumentNode, ASTNode } from "graphql"; +export type DirectiveInfo = { + [fieldName: string]: { + [argName: string]: any; + }; +}; +export declare function shouldInclude({ directives }: SelectionNode, variables?: Record): boolean; +export declare function getDirectiveNames(root: ASTNode): string[]; +export declare const hasAnyDirectives: (names: string[], root: ASTNode) => boolean; +export declare const hasAllDirectives: (names: string[], root: ASTNode) => boolean; +export declare function hasDirectives(names: string[], root: ASTNode, all?: boolean): boolean; +export declare function hasClientExports(document: DocumentNode): boolean; +export type InclusionDirectives = Array<{ + directive: DirectiveNode; + ifArgument: ArgumentNode; +}>; +export declare function getInclusionDirectives(directives: ReadonlyArray): InclusionDirectives; +//# sourceMappingURL=directives.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js new file mode 100644 index 0000000..c805368 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js @@ -0,0 +1,78 @@ +import { invariant } from "../globals/index.js"; +import { visit, BREAK } from "graphql"; +export function shouldInclude(_a, variables) { + var directives = _a.directives; + if (!directives || !directives.length) { + return true; + } + return getInclusionDirectives(directives).every(function (_a) { + var directive = _a.directive, ifArgument = _a.ifArgument; + var evaledValue = false; + if (ifArgument.value.kind === "Variable") { + evaledValue = + variables && variables[ifArgument.value.name.value]; + invariant(evaledValue !== void 0, 67, directive.name.value); + } + else { + evaledValue = ifArgument.value.value; + } + return directive.name.value === "skip" ? !evaledValue : evaledValue; + }); +} +export function getDirectiveNames(root) { + var names = []; + visit(root, { + Directive: function (node) { + names.push(node.name.value); + }, + }); + return names; +} +export var hasAnyDirectives = function (names, root) { + return hasDirectives(names, root, false); +}; +export var hasAllDirectives = function (names, root) { + return hasDirectives(names, root, true); +}; +export function hasDirectives(names, root, all) { + var nameSet = new Set(names); + var uniqueCount = nameSet.size; + visit(root, { + Directive: function (node) { + if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) { + return BREAK; + } + }, + }); + // If we found all the names, nameSet will be empty. If we only care about + // finding some of them, the < condition is sufficient. + return all ? !nameSet.size : nameSet.size < uniqueCount; +} +export function hasClientExports(document) { + return document && hasDirectives(["client", "export"], document, true); +} +function isInclusionDirective(_a) { + var value = _a.name.value; + return value === "skip" || value === "include"; +} +export function getInclusionDirectives(directives) { + var result = []; + if (directives && directives.length) { + directives.forEach(function (directive) { + if (!isInclusionDirective(directive)) + return; + var directiveArguments = directive.arguments; + var directiveName = directive.name.value; + invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName); + var ifArgument = directiveArguments[0]; + invariant(ifArgument.name && ifArgument.name.value === "if", 69, directiveName); + var ifValue = ifArgument.value; + // means it has to be a variable value if this is a valid @skip or @include directive + invariant(ifValue && + (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 70, directiveName); + result.push({ directive: directive, ifArgument: ifArgument }); + }); + } + return result; +} +//# sourceMappingURL=directives.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js.map new file mode 100644 index 0000000..ed87860 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/directives.js.map @@ -0,0 +1 @@ +{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../../src/utilities/graphql/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAchD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMvC,MAAM,UAAU,aAAa,CAC3B,EAA6B,EAC7B,SAA+B;QAD7B,UAAU,gBAAA;IAGZ,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,E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,KAAK,CAAC;YAE3C,SAAS,CACP,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EACrD,sDAAsD,EACtD,aAAa,CACd,CAAC;YAEF,IAAM,UAAU,GAAG,kBAAmB,CAAC,CAAC,CAAC,CAAC;YAC1C,SAAS,CACP,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,EACjD,yCAAyC,EACzC,aAAa,CACd,CAAC;YAEF,IAAM,OAAO,GAAc,UAAU,CAAC,KAAK,CAAC;YAE5C,qFAAqF;YACrF,SAAS,CACP,OAAO;gBACL,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,EAClE,uEAAuE,EACvE,aAAa,CACd,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,WAAA,EAAE,UAAU,YAAA,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { invariant } from \"../globals/index.js\";\n\n// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport type {\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n ASTNode,\n} from \"graphql\";\nimport { visit, BREAK } from \"graphql\";\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function shouldInclude(\n { directives }: SelectionNode,\n variables?: Record\n): boolean {\n if (!directives || !directives.length) {\n return true;\n }\n return getInclusionDirectives(directives).every(\n ({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === \"Variable\") {\n evaledValue =\n variables && variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @%s directive.`,\n directive.name.value\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === \"skip\" ? !evaledValue : evaledValue;\n }\n );\n}\n\nexport function getDirectiveNames(root: ASTNode) {\n const names: string[] = [];\n\n visit(root, {\n Directive(node: DirectiveNode) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport const hasAnyDirectives = (names: string[], root: ASTNode) =>\n hasDirectives(names, root, false);\n\nexport const hasAllDirectives = (names: string[], root: ASTNode) =>\n hasDirectives(names, root, true);\n\nexport function hasDirectives(names: string[], root: ASTNode, all?: boolean) {\n const nameSet = new Set(names);\n const uniqueCount = nameSet.size;\n\n visit(root, {\n Directive(node) {\n if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) {\n return BREAK;\n }\n },\n });\n\n // If we found all the names, nameSet will be empty. If we only care about\n // finding some of them, the < condition is sufficient.\n return all ? !nameSet.size : nameSet.size < uniqueCount;\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return document && hasDirectives([\"client\", \"export\"], document, true);\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === \"skip\" || value === \"include\";\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray\n): InclusionDirectives {\n const result: InclusionDirectives = [];\n\n if (directives && directives.length) {\n directives.forEach((directive) => {\n if (!isInclusionDirective(directive)) return;\n\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @%s directive.`,\n directiveName\n );\n\n const ifArgument = directiveArguments![0];\n invariant(\n ifArgument.name && ifArgument.name.value === \"if\",\n `Invalid argument for the @%s directive.`,\n directiveName\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\"),\n `Argument for the @%s directive must be a variable or a boolean value.`,\n directiveName\n );\n\n result.push({ directive, ifArgument });\n });\n }\n\n return result;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.d.ts new file mode 100644 index 0000000..cfee127 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.d.ts @@ -0,0 +1,34 @@ +import type { DocumentNode, FragmentDefinitionNode, InlineFragmentNode, SelectionNode } from "graphql"; +/** + * Returns a query document which adds a single query operation that only + * spreads the target fragment inside of it. + * + * So for example a document of: + * + * ```graphql + * fragment foo on Foo { a b c } + * ``` + * + * Turns into: + * + * ```graphql + * { ...foo } + * + * fragment foo on Foo { a b c } + * ``` + * + * The target fragment will either be the only fragment in the document, or a + * fragment specified by the provided `fragmentName`. If there is more than one + * fragment, but a `fragmentName` was not defined then an error will be thrown. + */ +export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode; +/** + * This is an interface that describes a map from fragment names to fragment definitions. + */ +export interface FragmentMap { + [fragmentName: string]: FragmentDefinitionNode; +} +export type FragmentMapFunction = (fragmentName: string) => FragmentDefinitionNode | null; +export declare function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap; +export declare function getFragmentFromSelection(selection: SelectionNode, fragmentMap?: FragmentMap | FragmentMapFunction): InlineFragmentNode | FragmentDefinitionNode | null; +//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js new file mode 100644 index 0000000..d5a1f10 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js @@ -0,0 +1,103 @@ +import { __assign, __spreadArray } from "tslib"; +import { invariant, newInvariantError } from "../globals/index.js"; +/** + * Returns a query document which adds a single query operation that only + * spreads the target fragment inside of it. + * + * So for example a document of: + * + * ```graphql + * fragment foo on Foo { a b c } + * ``` + * + * Turns into: + * + * ```graphql + * { ...foo } + * + * fragment foo on Foo { a b c } + * ``` + * + * The target fragment will either be the only fragment in the document, or a + * fragment specified by the provided `fragmentName`. If there is more than one + * fragment, but a `fragmentName` was not defined then an error will be thrown. + */ +export function getFragmentQueryDocument(document, fragmentName) { + var actualFragmentName = fragmentName; + // Build an array of all our fragment definitions that will be used for + // validations. We also do some validations on the other definitions in the + // document while building this list. + var fragments = []; + document.definitions.forEach(function (definition) { + // Throw an error if we encounter an operation definition because we will + // define our own operation definition later on. + if (definition.kind === "OperationDefinition") { + throw newInvariantError( + 71, + definition.operation, + definition.name ? " named '".concat(definition.name.value, "'") : "" + ); + } + // Add our definition to the fragments array if it is a fragment + // definition. + if (definition.kind === "FragmentDefinition") { + fragments.push(definition); + } + }); + // If the user did not give us a fragment name then let us try to get a + // name from a single fragment in the definition. + if (typeof actualFragmentName === "undefined") { + invariant(fragments.length === 1, 72, fragments.length); + actualFragmentName = fragments[0].name.value; + } + // Generate a query document with an operation that simply spreads the + // fragment inside of it. + var query = __assign(__assign({}, document), { definitions: __spreadArray([ + { + kind: "OperationDefinition", + // OperationTypeNode is an enum + operation: "query", + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "FragmentSpread", + name: { + kind: "Name", + value: actualFragmentName, + }, + }, + ], + }, + } + ], document.definitions, true) }); + return query; +} +// Utility function that takes a list of fragment definitions and makes a hash out of them +// that maps the name of the fragment to the fragment definition. +export function createFragmentMap(fragments) { + if (fragments === void 0) { fragments = []; } + var symTable = {}; + fragments.forEach(function (fragment) { + symTable[fragment.name.value] = fragment; + }); + return symTable; +} +export function getFragmentFromSelection(selection, fragmentMap) { + switch (selection.kind) { + case "InlineFragment": + return selection; + case "FragmentSpread": { + var fragmentName = selection.name.value; + if (typeof fragmentMap === "function") { + return fragmentMap(fragmentName); + } + var fragment = fragmentMap && fragmentMap[fragmentName]; + invariant(fragment, 73, fragmentName); + return fragment || null; + } + default: + return null; + } +} +//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js.map new file mode 100644 index 0000000..5a46595 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/fragments.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../src/utilities/graphql/fragments.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAYnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAEtC,uEAAuE;IACvE,2EAA2E;IAC3E,qCAAqC;IACrC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;QACtC,yEAAyE;QACzE,gDAAgD;QAChD,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;YAC9C,MAAM,iBAAiB,CACrB,0BAA0B;gBACxB,yFAAyF,EAC3F,UAAU,CAAC,SAAS,EACpB,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,CAC3D,CAAC;QACJ,CAAC;QACD,gEAAgE;QAChE,cAAc;QACd,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;YAC7C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,uEAAuE;IACvE,iDAAiD;IACjD,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE,CAAC;QAC9C,SAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,2FAA6F,E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W,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC;YAC1D,SAAS,CAAC,QAAQ,EAAE,sBAAsB,EAAE,YAAY,CAAC,CAAC;YAC1D,OAAO,QAAQ,IAAI,IAAI,CAAC;QAC1B,CAAC;QACD;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../globals/index.js\";\n\nimport type {\n DocumentNode,\n FragmentDefinitionNode,\n InlineFragmentNode,\n SelectionNode,\n} from \"graphql\";\n\n// TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356)\ntype Kind = any;\ntype OperationTypeNode = any;\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array = [];\n document.definitions.forEach((definition) => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === \"OperationDefinition\") {\n throw newInvariantError(\n `Found a %s operation%s. ` +\n \"No operations are allowed when using a fragment as a query. Only fragments are allowed.\",\n definition.operation,\n definition.name ? ` named '${definition.name.value}'` : \"\"\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === \"FragmentDefinition\") {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === \"undefined\") {\n invariant(\n fragments.length === 1,\n `Found %s fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n fragments.length\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: \"OperationDefinition\" as Kind,\n // OperationTypeNode is an enum\n operation: \"query\" as OperationTypeNode,\n selectionSet: {\n kind: \"SelectionSet\" as Kind,\n selections: [\n {\n kind: \"FragmentSpread\" as Kind,\n name: {\n kind: \"Name\" as Kind,\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\nexport type FragmentMapFunction = (\n fragmentName: string\n) => FragmentDefinitionNode | null;\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = []\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach((fragment) => {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\n\nexport function getFragmentFromSelection(\n selection: SelectionNode,\n fragmentMap?: FragmentMap | FragmentMapFunction\n): InlineFragmentNode | FragmentDefinitionNode | null {\n switch (selection.kind) {\n case \"InlineFragment\":\n return selection;\n case \"FragmentSpread\": {\n const fragmentName = selection.name.value;\n if (typeof fragmentMap === \"function\") {\n return fragmentMap(fragmentName);\n }\n const fragment = fragmentMap && fragmentMap[fragmentName];\n invariant(fragment, `No fragment named %s`, fragmentName);\n return fragment || null;\n }\n default:\n return null;\n }\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.d.ts new file mode 100644 index 0000000..fc0a631 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.d.ts @@ -0,0 +1,15 @@ +import type { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from "graphql"; +export declare function checkDocument(doc: DocumentNode): DocumentNode; +export declare function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined; +export declare function getOperationName(doc: DocumentNode): string | null; +export declare function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[]; +export declare function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode; +export declare function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode; +/** + * Returns the first operation definition found in this document. + * If no operation definition is found, the first fragment definition will be returned. + * If no definitions are found, an error will be thrown. + */ +export declare function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode; +export declare function getDefaultValues(definition: OperationDefinitionNode | undefined): Record; +//# sourceMappingURL=getFromAST.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js new file mode 100644 index 0000000..c60be92 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js @@ -0,0 +1,89 @@ +import { invariant, newInvariantError } from "../globals/index.js"; +import { valueToObjectRepresentation } from "./storeUtils.js"; +// Checks the document for errors and throws an exception if there is an error. +export function checkDocument(doc) { + invariant(doc && doc.kind === "Document", 74); + var operations = doc.definitions + .filter(function (d) { return d.kind !== "FragmentDefinition"; }) + .map(function (definition) { + if (definition.kind !== "OperationDefinition") { + throw newInvariantError(75, definition.kind); + } + return definition; + }); + invariant(operations.length <= 1, 76, operations.length); + return doc; +} +export function getOperationDefinition(doc) { + checkDocument(doc); + return doc.definitions.filter(function (definition) { + return definition.kind === "OperationDefinition"; + })[0]; +} +export function getOperationName(doc) { + return (doc.definitions + .filter(function (definition) { + return definition.kind === "OperationDefinition" && !!definition.name; + }) + .map(function (x) { return x.name.value; })[0] || null); +} +// Returns the FragmentDefinitions from a particular document as an array +export function getFragmentDefinitions(doc) { + return doc.definitions.filter(function (definition) { + return definition.kind === "FragmentDefinition"; + }); +} +export function getQueryDefinition(doc) { + var queryDef = getOperationDefinition(doc); + invariant(queryDef && queryDef.operation === "query", 77); + return queryDef; +} +export function getFragmentDefinition(doc) { + invariant(doc.kind === "Document", 78); + invariant(doc.definitions.length <= 1, 79); + var fragmentDef = doc.definitions[0]; + invariant(fragmentDef.kind === "FragmentDefinition", 80); + return fragmentDef; +} +/** + * Returns the first operation definition found in this document. + * If no operation definition is found, the first fragment definition will be returned. + * If no definitions are found, an error will be thrown. + */ +export function getMainDefinition(queryDoc) { + checkDocument(queryDoc); + var fragmentDefinition; + for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { + var definition = _a[_i]; + if (definition.kind === "OperationDefinition") { + var operation = definition.operation; + if (operation === "query" || + operation === "mutation" || + operation === "subscription") { + return definition; + } + } + if (definition.kind === "FragmentDefinition" && !fragmentDefinition) { + // we do this because we want to allow multiple fragment definitions + // to precede an operation definition. + fragmentDefinition = definition; + } + } + if (fragmentDefinition) { + return fragmentDefinition; + } + throw newInvariantError(81); +} +export function getDefaultValues(definition) { + var defaultValues = Object.create(null); + var defs = definition && definition.variableDefinitions; + if (defs && defs.length) { + defs.forEach(function (def) { + if (def.defaultValue) { + valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue); + } + }); + } + return defaultValues; +} +//# sourceMappingURL=getFromAST.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js.map new file mode 100644 index 0000000..488ed00 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/getFromAST.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getFromAST.js","sourceRoot":"","sources":["../../../src/utilities/graphql/getFromAST.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CA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,KAAK,UAAU;gBACxB,SAAS,KAAK,cAAc,EAC5B,CAAC;gBACD,OAAO,UAAqC,CAAC;YAC/C,CAAC;QACH,CAAC;QACD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACpE,oEAAoE;YACpE,sCAAsC;YACtC,kBAAkB,GAAG,UAAoC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,IAAI,kBAAkB,EAAE,CAAC;QACvB,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,MAAM,iBAAiB,CACrB,sFAAsF,CACvF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,UAA+C;IAE/C,IAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAM,IAAI,GAAG,UAAU,IAAI,UAAU,CAAC,mBAAmB,CAAC;IAC1D,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG;YACf,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;gBACrB,2BAA2B,CACzB,aAAa,EACb,GAAG,CAAC,QAAQ,CAAC,IAAI,EACjB,GAAG,CAAC,YAAyB,CAC9B,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../globals/index.js\";\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from \"graphql\";\n\nimport { valueToObjectRepresentation } from \"./storeUtils.js\";\n\ntype OperationDefinitionWithName = OperationDefinitionNode & {\n name: NonNullable;\n};\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === \"Document\",\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`\n );\n\n const operations = doc.definitions\n .filter((d) => d.kind !== \"FragmentDefinition\")\n .map((definition) => {\n if (definition.kind !== \"OperationDefinition\") {\n throw newInvariantError(\n `Schema type definitions not allowed in queries. Found: \"%s\"`,\n definition.kind\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains %s operations`,\n operations.length\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n (definition): definition is OperationDefinitionNode =>\n definition.kind === \"OperationDefinition\"\n )[0];\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n (definition): definition is OperationDefinitionWithName =>\n definition.kind === \"OperationDefinition\" && !!definition.name\n )\n .map((x) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n (definition): definition is FragmentDefinitionNode =>\n definition.kind === \"FragmentDefinition\"\n );\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc)!;\n\n invariant(\n queryDef && queryDef.operation === \"query\",\n \"Must contain a query definition.\"\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode\n): FragmentDefinitionNode {\n invariant(\n doc.kind === \"Document\",\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`\n );\n\n invariant(\n doc.definitions.length <= 1,\n \"Fragment must have exactly one definition.\"\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === \"FragmentDefinition\",\n \"Must be a fragment definition.\"\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === \"OperationDefinition\") {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === \"query\" ||\n operation === \"mutation\" ||\n operation === \"subscription\"\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === \"FragmentDefinition\" && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw newInvariantError(\n \"Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.\"\n );\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined\n): Record {\n const defaultValues = Object.create(null);\n const defs = definition && definition.variableDefinitions;\n if (defs && defs.length) {\n defs.forEach((def) => {\n if (def.defaultValue) {\n valueToObjectRepresentation(\n defaultValues,\n def.variable.name,\n def.defaultValue as ValueNode\n );\n }\n });\n }\n return defaultValues;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.d.ts new file mode 100644 index 0000000..1364585 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.d.ts @@ -0,0 +1,5 @@ +import type { DocumentNode } from "../../core/index.js"; +export declare function isMutationOperation(document: DocumentNode): boolean; +export declare function isQueryOperation(document: DocumentNode): boolean; +export declare function isSubscriptionOperation(document: DocumentNode): boolean; +//# sourceMappingURL=operations.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js new file mode 100644 index 0000000..42ad52b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js @@ -0,0 +1,15 @@ +import { getOperationDefinition } from "./getFromAST.js"; +function isOperation(document, operation) { + var _a; + return ((_a = getOperationDefinition(document)) === null || _a === void 0 ? void 0 : _a.operation) === operation; +} +export function isMutationOperation(document) { + return isOperation(document, "mutation"); +} +export function isQueryOperation(document) { + return isOperation(document, "query"); +} +export function isSubscriptionOperation(document) { + return isOperation(document, "subscription"); +} +//# sourceMappingURL=operations.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js.map new file mode 100644 index 0000000..f449f67 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/operations.js.map @@ -0,0 +1 @@ +{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/utilities/graphql/operations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,SAAS,WAAW,CAClB,QAAsB,EACtB,SAAgD;;IAEhD,OAAO,CAAA,MAAA,sBAAsB,CAAC,QAAQ,CAAC,0CAAE,SAAS,MAAK,SAAS,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAsB;IACxD,OAAO,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAsB;IACrD,OAAO,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAsB;IAC5D,OAAO,WAAW,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { DocumentNode } from \"../../core/index.js\";\nimport { getOperationDefinition } from \"./getFromAST.js\";\n\nfunction isOperation(\n document: DocumentNode,\n operation: \"query\" | \"mutation\" | \"subscription\"\n) {\n return getOperationDefinition(document)?.operation === operation;\n}\n\nexport function isMutationOperation(document: DocumentNode) {\n return isOperation(document, \"mutation\");\n}\n\nexport function isQueryOperation(document: DocumentNode) {\n return isOperation(document, \"query\");\n}\n\nexport function isSubscriptionOperation(document: DocumentNode) {\n return isOperation(document, \"subscription\");\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.d.ts new file mode 100644 index 0000000..b7be72c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.d.ts @@ -0,0 +1,5 @@ +import type { ASTNode } from "graphql"; +export declare const print: ((ast: ASTNode) => string) & { + reset(): void; +}; +//# sourceMappingURL=print.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js new file mode 100644 index 0000000..2b7e67f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js @@ -0,0 +1,21 @@ +import { print as origPrint } from "graphql"; +import { AutoCleanedWeakCache, cacheSizes, } from "../caching/index.js"; +import { registerGlobalCache } from "../caching/getMemoryInternals.js"; +var printCache; +export var print = Object.assign(function (ast) { + var result = printCache.get(ast); + if (!result) { + result = origPrint(ast); + printCache.set(ast, result); + } + return result; +}, { + reset: function () { + printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 /* defaultCacheSizes.print */); + }, +}); +print.reset(); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("print", function () { return (printCache ? printCache.size : 0); }); +} +//# sourceMappingURL=print.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js.map new file mode 100644 index 0000000..69bd912 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/print.js.map @@ -0,0 +1 @@ +{"version":3,"file":"print.js","sourceRoot":"","sources":["../../../src/utilities/graphql/print.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EACL,oBAAoB,EACpB,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,IAAI,UAAkD,CAAC;AACvD,MAAM,CAAC,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAChC,UAAC,GAAY;IACX,IAAI,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEjC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QACxB,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,EACD;IACE,KAAK;QACH,UAAU,GAAG,IAAI,oBAAoB,CACnC,UAAU,CAAC,KAAK,sCAA2B,CAC5C,CAAC;IACJ,CAAC;CACF,CACF,CAAC;AACF,KAAK,CAAC,KAAK,EAAE,CAAC;AAEd,IAAI,OAAO,EAAE,CAAC;IACZ,mBAAmB,CAAC,OAAO,EAAE,cAAM,OAAA,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAlC,CAAkC,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import type { ASTNode } from \"graphql\";\nimport { print as origPrint } from \"graphql\";\nimport {\n AutoCleanedWeakCache,\n cacheSizes,\n defaultCacheSizes,\n} from \"../caching/index.js\";\nimport { registerGlobalCache } from \"../caching/getMemoryInternals.js\";\n\nlet printCache!: AutoCleanedWeakCache;\nexport const print = Object.assign(\n (ast: ASTNode) => {\n let result = printCache.get(ast);\n\n if (!result) {\n result = origPrint(ast);\n printCache.set(ast, result);\n }\n return result;\n },\n {\n reset() {\n printCache = new AutoCleanedWeakCache(\n cacheSizes.print || defaultCacheSizes.print\n );\n },\n }\n);\nprint.reset();\n\nif (__DEV__) {\n registerGlobalCache(\"print\", () => (printCache ? printCache.size : 0));\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.d.ts new file mode 100644 index 0000000..6df21cb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.d.ts @@ -0,0 +1,51 @@ +import type { DirectiveNode, FieldNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode, SelectionSetNode, DocumentNode } from "graphql"; +import type { FragmentMap } from "./fragments.js"; +export interface Reference { + readonly __ref: string; +} +export declare function makeReference(id: string): Reference; +export declare function isReference(obj: any): obj is Reference; +export type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object; +export interface StoreObject { + __typename?: string; + [storeFieldName: string]: StoreValue; +} +/** + * Workaround for a TypeScript quirk: + * types per default have an implicit index signature that makes them + * assignable to `StoreObject`. + * interfaces do not have that implicit index signature, so they cannot + * be assigned to `StoreObject`. + * This type just maps over a type or interface that is passed in, + * implicitly adding the index signature. + * That way, the result can be assigned to `StoreObject`. + * + * This is important if some user-defined interface is used e.g. + * in cache.modify, where the `toReference` method expects a + * `StoreObject` as input. + */ +export type AsStoreObject = { + [K in keyof T]: T[K]; +}; +export declare function isDocumentNode(value: any): value is DocumentNode; +export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void; +export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string; +export type Directives = { + [directiveName: string]: { + [argName: string]: any; + }; +}; +declare let storeKeyNameStringify: (value: any) => string; +export declare const getStoreKeyName: ((fieldName: string, args?: Record | null, directives?: Directives) => string) & { + setStringify(s: typeof storeKeyNameStringify): (value: any) => string; +}; +export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables?: Record): Object | null; +export declare function resultKeyNameFromField(field: FieldNode): string; +export declare function getTypenameFromResult(result: Record, selectionSet: SelectionSetNode, fragmentMap?: FragmentMap): string | undefined; +export declare function isField(selection: SelectionNode): selection is FieldNode; +export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode; +export type VariableValue = (node: VariableNode) => any; +export {}; +//# sourceMappingURL=storeUtils.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js new file mode 100644 index 0000000..f92f650 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js @@ -0,0 +1,213 @@ +import { newInvariantError } from "../globals/index.js"; +import { isNonNullObject } from "../common/objects.js"; +import { getFragmentFromSelection } from "./fragments.js"; +import { canonicalStringify } from "../common/canonicalStringify.js"; +export function makeReference(id) { + return { __ref: String(id) }; +} +export function isReference(obj) { + return Boolean(obj && typeof obj === "object" && typeof obj.__ref === "string"); +} +export function isDocumentNode(value) { + return (isNonNullObject(value) && + value.kind === "Document" && + Array.isArray(value.definitions)); +} +function isStringValue(value) { + return value.kind === "StringValue"; +} +function isBooleanValue(value) { + return value.kind === "BooleanValue"; +} +function isIntValue(value) { + return value.kind === "IntValue"; +} +function isFloatValue(value) { + return value.kind === "FloatValue"; +} +function isVariable(value) { + return value.kind === "Variable"; +} +function isObjectValue(value) { + return value.kind === "ObjectValue"; +} +function isListValue(value) { + return value.kind === "ListValue"; +} +function isEnumValue(value) { + return value.kind === "EnumValue"; +} +function isNullValue(value) { + return value.kind === "NullValue"; +} +export function valueToObjectRepresentation(argObj, name, value, variables) { + if (isIntValue(value) || isFloatValue(value)) { + argObj[name.value] = Number(value.value); + } + else if (isBooleanValue(value) || isStringValue(value)) { + argObj[name.value] = value.value; + } + else if (isObjectValue(value)) { + var nestedArgObj_1 = {}; + value.fields.map(function (obj) { + return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); + }); + argObj[name.value] = nestedArgObj_1; + } + else if (isVariable(value)) { + var variableValue = (variables || {})[value.name.value]; + argObj[name.value] = variableValue; + } + else if (isListValue(value)) { + argObj[name.value] = value.values.map(function (listValue) { + var nestedArgArrayObj = {}; + valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); + return nestedArgArrayObj[name.value]; + }); + } + else if (isEnumValue(value)) { + argObj[name.value] = value.value; + } + else if (isNullValue(value)) { + argObj[name.value] = null; + } + else { + throw newInvariantError(82, name.value, value.kind); + } +} +export function storeKeyNameFromField(field, variables) { + var directivesObj = null; + if (field.directives) { + directivesObj = {}; + field.directives.forEach(function (directive) { + directivesObj[directive.name.value] = {}; + if (directive.arguments) { + directive.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); + }); + } + }); + } + var argObj = null; + if (field.arguments && field.arguments.length) { + argObj = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj, name, value, variables); + }); + } + return getStoreKeyName(field.name.value, argObj, directivesObj); +} +var KNOWN_DIRECTIVES = [ + "connection", + "include", + "skip", + "client", + "rest", + "export", + "nonreactive", +]; +// Default stable JSON.stringify implementation used by getStoreKeyName. Can be +// updated/replaced with something better by calling +// getStoreKeyName.setStringify(newStringifyFunction). +var storeKeyNameStringify = canonicalStringify; +export var getStoreKeyName = Object.assign(function (fieldName, args, directives) { + if (args && + directives && + directives["connection"] && + directives["connection"]["key"]) { + if (directives["connection"]["filter"] && + directives["connection"]["filter"].length > 0) { + var filterKeys = directives["connection"]["filter"] ? + directives["connection"]["filter"] + : []; + filterKeys.sort(); + var filteredArgs_1 = {}; + filterKeys.forEach(function (key) { + filteredArgs_1[key] = args[key]; + }); + return "".concat(directives["connection"]["key"], "(").concat(storeKeyNameStringify(filteredArgs_1), ")"); + } + else { + return directives["connection"]["key"]; + } + } + var completeFieldName = fieldName; + if (args) { + // We can't use `JSON.stringify` here since it's non-deterministic, + // and can lead to different store key names being created even though + // the `args` object used during creation has the same properties/values. + var stringifiedArgs = storeKeyNameStringify(args); + completeFieldName += "(".concat(stringifiedArgs, ")"); + } + if (directives) { + Object.keys(directives).forEach(function (key) { + if (KNOWN_DIRECTIVES.indexOf(key) !== -1) + return; + if (directives[key] && Object.keys(directives[key]).length) { + completeFieldName += "@".concat(key, "(").concat(storeKeyNameStringify(directives[key]), ")"); + } + else { + completeFieldName += "@".concat(key); + } + }); + } + return completeFieldName; +}, { + setStringify: function (s) { + var previous = storeKeyNameStringify; + storeKeyNameStringify = s; + return previous; + }, +}); +export function argumentsObjectFromField(field, variables) { + if (field.arguments && field.arguments.length) { + var argObj_1 = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj_1, name, value, variables); + }); + return argObj_1; + } + return null; +} +export function resultKeyNameFromField(field) { + return field.alias ? field.alias.value : field.name.value; +} +export function getTypenameFromResult(result, selectionSet, fragmentMap) { + var fragments; + for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) { + var selection = _a[_i]; + if (isField(selection)) { + if (selection.name.value === "__typename") { + return result[resultKeyNameFromField(selection)]; + } + } + else if (fragments) { + fragments.push(selection); + } + else { + fragments = [selection]; + } + } + if (typeof result.__typename === "string") { + return result.__typename; + } + if (fragments) { + for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) { + var selection = fragments_1[_b]; + var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap); + if (typeof typename === "string") { + return typename; + } + } + } +} +export function isField(selection) { + return selection.kind === "Field"; +} +export function isInlineFragment(selection) { + return selection.kind === "InlineFragment"; +} +//# sourceMappingURL=storeUtils.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js.map new file mode 100644 index 0000000..c5edd11 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/storeUtils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"storeUtils.js","sourceRoot":"","sources":["../../../src/utilities/graphql/storeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAuBxD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAMrE,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAQ;IAClC,OAAO,OAAO,CACZ,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,CAChE,CAAC;AACJ,CAAC;AAoCD,MAAM,UAAU,cAAc,CAAC,KAAU;IACvC,OAAO,CACL,eAAe,CAAC,KAAK,CAAC;QACrB,KAAsB,CAAC,IAAI,KAAK,UAAU;QAC3C,KAAK,CAAC,OAAO,CAAE,KAAsB,CAAC,WAAW,CAAC,CACnD,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,KAAgB;IACrC,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,KAAgB;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;AACvC,CAAC;AAED,SAAS,UAAU,CAAC,KAAgB;IAClC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB;IACpC,OAAO,KAAK,CAAC,IAAI,KAAK,YAA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7C,IAAM,SAAS,SAAA;QAClB,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACvB,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,EAAE,CAAC;gBAC1C,OAAO,MAAM,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;aAAM,IAAI,SAAS,EAAE,CAAC;YACrB,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,SAAS,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,MAAM,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,KAAwB,UAAS,EAAT,uBAAS,EAAT,uBAAS,EAAT,IAAS,EAAE,CAAC;YAA/B,IAAM,SAAS,kBAAA;YAClB,IAAM,QAAQ,GAAG,qBAAqB,CACpC,MAAM,EACN,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAE,CAAC,YAAY,EAC9D,WAAW,CACZ,CAAC;YACF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,OAAO,QAAQ,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,SAAwB;IAC9C,OAAO,SAAS,CAAC,IAAI,KAAK,OAAO,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,SAAwB;IAExB,OAAO,SAAS,CAAC,IAAI,KAAK,gBAAgB,CAAC;AAC7C,CAAC","sourcesContent":["import { newInvariantError } from \"../globals/index.js\";\n\nimport type {\n DirectiveNode,\n FieldNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n ObjectValueNode,\n ListValueNode,\n EnumValueNode,\n NullValueNode,\n VariableNode,\n InlineFragmentNode,\n ValueNode,\n SelectionNode,\n NameNode,\n SelectionSetNode,\n DocumentNode,\n FragmentSpreadNode,\n} from \"graphql\";\n\nimport { isNonNullObject } from \"../common/objects.js\";\nimport type { FragmentMap } from \"./fragments.js\";\nimport { getFragmentFromSelection } from \"./fragments.js\";\nimport { canonicalStringify } from \"../common/canonicalStringify.js\";\n\nexport interface Reference {\n readonly __ref: string;\n}\n\nexport function makeReference(id: string): Reference {\n return { __ref: String(id) };\n}\n\nexport function isReference(obj: any): obj is Reference {\n return Boolean(\n obj && typeof obj === \"object\" && typeof obj.__ref === \"string\"\n );\n}\n\nexport type StoreValue =\n | number\n | string\n | string[]\n | Reference\n | Reference[]\n | null\n | undefined\n | void\n | Object;\n\nexport interface StoreObject {\n __typename?: string;\n [storeFieldName: string]: StoreValue;\n}\n\n/**\n * Workaround for a TypeScript quirk:\n * types per default have an implicit index signature that makes them\n * assignable to `StoreObject`.\n * interfaces do not have that implicit index signature, so they cannot\n * be assigned to `StoreObject`.\n * This type just maps over a type or interface that is passed in,\n * implicitly adding the index signature.\n * That way, the result can be assigned to `StoreObject`.\n *\n * This is important if some user-defined interface is used e.g.\n * in cache.modify, where the `toReference` method expects a\n * `StoreObject` as input.\n */\nexport type AsStoreObject = {\n [K in keyof T]: T[K];\n};\n\nexport function isDocumentNode(value: any): value is DocumentNode {\n return (\n isNonNullObject(value) &&\n (value as DocumentNode).kind === \"Document\" &&\n Array.isArray((value as DocumentNode).definitions)\n );\n}\n\nfunction isStringValue(value: ValueNode): value is StringValueNode {\n return value.kind === \"StringValue\";\n}\n\nfunction isBooleanValue(value: ValueNode): value is BooleanValueNode {\n return value.kind === \"BooleanValue\";\n}\n\nfunction isIntValue(value: ValueNode): value is IntValueNode {\n return value.kind === \"IntValue\";\n}\n\nfunction isFloatValue(value: ValueNode): value is FloatValueNode {\n return value.kind === \"FloatValue\";\n}\n\nfunction isVariable(value: ValueNode): value is VariableNode {\n return value.kind === \"Variable\";\n}\n\nfunction isObjectValue(value: ValueNode): value is ObjectValueNode {\n return value.kind === \"ObjectValue\";\n}\n\nfunction isListValue(value: ValueNode): value is ListValueNode {\n return value.kind === \"ListValue\";\n}\n\nfunction isEnumValue(value: ValueNode): value is EnumValueNode {\n return value.kind === \"EnumValue\";\n}\n\nfunction isNullValue(value: ValueNode): value is NullValueNode {\n return value.kind === \"NullValue\";\n}\n\nexport function valueToObjectRepresentation(\n argObj: any,\n name: NameNode,\n value: ValueNode,\n variables?: Object\n) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n } else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n } else if (isObjectValue(value)) {\n const nestedArgObj = {};\n value.fields.map((obj) =>\n valueToObjectRepresentation(nestedArgObj, obj.name, obj.value, variables)\n );\n argObj[name.value] = nestedArgObj;\n } else if (isVariable(value)) {\n const variableValue = (variables || ({} as any))[value.name.value];\n argObj[name.value] = variableValue;\n } else if (isListValue(value)) {\n argObj[name.value] = value.values.map((listValue) => {\n const nestedArgArrayObj = {};\n valueToObjectRepresentation(\n nestedArgArrayObj,\n name,\n listValue,\n variables\n );\n return (nestedArgArrayObj as any)[name.value];\n });\n } else if (isEnumValue(value)) {\n argObj[name.value] = (value as EnumValueNode).value;\n } else if (isNullValue(value)) {\n argObj[name.value] = null;\n } else {\n throw newInvariantError(\n `The inline argument \"%s\" of kind \"%s\"` +\n \"is not supported. Use variables instead of inline arguments to \" +\n \"overcome this limitation.\",\n name.value,\n (value as any).kind\n );\n }\n}\n\nexport function storeKeyNameFromField(\n field: FieldNode,\n variables?: Object\n): string {\n let directivesObj: any = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach((directive) => {\n directivesObj[directive.name.value] = {};\n\n if (directive.arguments) {\n directive.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(\n directivesObj[directive.name.value],\n name,\n value,\n variables\n )\n );\n }\n });\n }\n\n let argObj: any = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables)\n );\n }\n\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\n\nexport type Directives = {\n [directiveName: string]: {\n [argName: string]: any;\n };\n};\n\nconst KNOWN_DIRECTIVES: string[] = [\n \"connection\",\n \"include\",\n \"skip\",\n \"client\",\n \"rest\",\n \"export\",\n \"nonreactive\",\n];\n\n// Default stable JSON.stringify implementation used by getStoreKeyName. Can be\n// updated/replaced with something better by calling\n// getStoreKeyName.setStringify(newStringifyFunction).\nlet storeKeyNameStringify: (value: any) => string = canonicalStringify;\n\nexport const getStoreKeyName = Object.assign(\n function (\n fieldName: string,\n args?: Record | null,\n directives?: Directives\n ): string {\n if (\n args &&\n directives &&\n directives[\"connection\"] &&\n directives[\"connection\"][\"key\"]\n ) {\n if (\n directives[\"connection\"][\"filter\"] &&\n (directives[\"connection\"][\"filter\"] as string[]).length > 0\n ) {\n const filterKeys =\n directives[\"connection\"][\"filter\"] ?\n (directives[\"connection\"][\"filter\"] as string[])\n : [];\n filterKeys.sort();\n\n const filteredArgs = {} as { [key: string]: any };\n filterKeys.forEach((key) => {\n filteredArgs[key] = args[key];\n });\n\n return `${directives[\"connection\"][\"key\"]}(${storeKeyNameStringify(\n filteredArgs\n )})`;\n } else {\n return directives[\"connection\"][\"key\"];\n }\n }\n\n let completeFieldName: string = fieldName;\n\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n const stringifiedArgs: string = storeKeyNameStringify(args);\n completeFieldName += `(${stringifiedArgs})`;\n }\n\n if (directives) {\n Object.keys(directives).forEach((key) => {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += `@${key}(${storeKeyNameStringify(\n directives[key]\n )})`;\n } else {\n completeFieldName += `@${key}`;\n }\n });\n }\n\n return completeFieldName;\n },\n {\n setStringify(s: typeof storeKeyNameStringify) {\n const previous = storeKeyNameStringify;\n storeKeyNameStringify = s;\n return previous;\n },\n }\n);\n\nexport function argumentsObjectFromField(\n field: FieldNode | DirectiveNode,\n variables?: Record\n): Object | null {\n if (field.arguments && field.arguments.length) {\n const argObj: Object = {};\n field.arguments.forEach(({ name, value }) =>\n valueToObjectRepresentation(argObj, name, value, variables)\n );\n return argObj;\n }\n return null;\n}\n\nexport function resultKeyNameFromField(field: FieldNode): string {\n return field.alias ? field.alias.value : field.name.value;\n}\n\nexport function getTypenameFromResult(\n result: Record,\n selectionSet: SelectionSetNode,\n fragmentMap?: FragmentMap\n): string | undefined {\n let fragments: undefined | Array;\n for (const selection of selectionSet.selections) {\n if (isField(selection)) {\n if (selection.name.value === \"__typename\") {\n return result[resultKeyNameFromField(selection)];\n }\n } else if (fragments) {\n fragments.push(selection);\n } else {\n fragments = [selection];\n }\n }\n if (typeof result.__typename === \"string\") {\n return result.__typename;\n }\n if (fragments) {\n for (const selection of fragments) {\n const typename = getTypenameFromResult(\n result,\n getFragmentFromSelection(selection, fragmentMap)!.selectionSet,\n fragmentMap\n );\n if (typeof typename === \"string\") {\n return typename;\n }\n }\n }\n}\n\nexport function isField(selection: SelectionNode): selection is FieldNode {\n return selection.kind === \"Field\";\n}\n\nexport function isInlineFragment(\n selection: SelectionNode\n): selection is InlineFragmentNode {\n return selection.kind === \"InlineFragment\";\n}\n\nexport type VariableValue = (node: VariableNode) => any;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.d.ts new file mode 100644 index 0000000..5dda55d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.d.ts @@ -0,0 +1,27 @@ +import type { DocumentNode, FieldNode, DirectiveNode, FragmentDefinitionNode, ArgumentNode, FragmentSpreadNode, VariableDefinitionNode, ASTNode } from "graphql"; +export type RemoveNodeConfig = { + name?: string; + test?: (node: N) => boolean; + remove?: boolean; +}; +export type GetNodeConfig = { + name?: string; + test?: (node: N) => boolean; +}; +export type RemoveDirectiveConfig = RemoveNodeConfig; +export type GetDirectiveConfig = GetNodeConfig; +export type RemoveArgumentsConfig = RemoveNodeConfig; +export type GetFragmentSpreadConfig = GetNodeConfig; +export type RemoveFragmentSpreadConfig = RemoveNodeConfig; +export type RemoveFragmentDefinitionConfig = RemoveNodeConfig; +export type RemoveVariableDefinitionConfig = RemoveNodeConfig; +export declare function removeDirectivesFromDocument(directives: RemoveDirectiveConfig[], doc: DocumentNode): DocumentNode | null; +export declare const addTypenameToDocument: ((doc: TNode) => TNode) & { + added(field: FieldNode): boolean; +}; +export declare function removeConnectionDirectiveFromDocument(doc: DocumentNode): DocumentNode | null; +export declare function removeArgumentsFromDocument(config: RemoveArgumentsConfig[], doc: DocumentNode): DocumentNode | null; +export declare function removeFragmentSpreadFromDocument(config: RemoveFragmentSpreadConfig[], doc: DocumentNode): DocumentNode | null; +export declare function buildQueryFromSelectionSet(document: DocumentNode): DocumentNode; +export declare function removeClientSetsFromDocument(document: DocumentNode): DocumentNode | null; +//# sourceMappingURL=transform.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js new file mode 100644 index 0000000..b757d6f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js @@ -0,0 +1,482 @@ +import { __assign, __spreadArray } from "tslib"; +import { invariant } from "../globals/index.js"; +import { visit, Kind } from "graphql"; +import { checkDocument, getOperationDefinition, getFragmentDefinition, getFragmentDefinitions, getMainDefinition, } from "./getFromAST.js"; +import { isField } from "./storeUtils.js"; +import { createFragmentMap } from "./fragments.js"; +import { isArray, isNonEmptyArray } from "../common/arrays.js"; +var TYPENAME_FIELD = { + kind: Kind.FIELD, + name: { + kind: Kind.NAME, + value: "__typename", + }, +}; +function isEmpty(op, fragmentMap) { + return (!op || + op.selectionSet.selections.every(function (selection) { + return selection.kind === Kind.FRAGMENT_SPREAD && + isEmpty(fragmentMap[selection.name.value], fragmentMap); + })); +} +function nullIfDocIsEmpty(doc) { + return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ? + null + : doc; +} +function getDirectiveMatcher(configs) { + var names = new Map(); + var tests = new Map(); + configs.forEach(function (directive) { + if (directive) { + if (directive.name) { + names.set(directive.name, directive); + } + else if (directive.test) { + tests.set(directive.test, directive); + } + } + }); + return function (directive) { + var config = names.get(directive.name.value); + if (!config && tests.size) { + tests.forEach(function (testConfig, test) { + if (test(directive)) { + config = testConfig; + } + }); + } + return config; + }; +} +function makeInUseGetterFunction(defaultKey) { + var map = new Map(); + return function inUseGetterFunction(key) { + if (key === void 0) { key = defaultKey; } + var inUse = map.get(key); + if (!inUse) { + map.set(key, (inUse = { + // Variable and fragment spread names used directly within this + // operation or fragment definition, as identified by key. These sets + // will be populated during the first traversal of the document in + // removeDirectivesFromDocument below. + variables: new Set(), + fragmentSpreads: new Set(), + })); + } + return inUse; + }; +} +export function removeDirectivesFromDocument(directives, doc) { + checkDocument(doc); + // Passing empty strings to makeInUseGetterFunction means we handle anonymous + // operations as if their names were "". Anonymous fragment definitions are + // not supposed to be possible, but the same default naming strategy seems + // appropriate for that case as well. + var getInUseByOperationName = makeInUseGetterFunction(""); + var getInUseByFragmentName = makeInUseGetterFunction(""); + var getInUse = function (ancestors) { + for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) { + if (isArray(ancestor)) + continue; + if (ancestor.kind === Kind.OPERATION_DEFINITION) { + // If an operation is anonymous, we use the empty string as its key. + return getInUseByOperationName(ancestor.name && ancestor.name.value); + } + if (ancestor.kind === Kind.FRAGMENT_DEFINITION) { + return getInUseByFragmentName(ancestor.name.value); + } + } + globalThis.__DEV__ !== false && invariant.error(83); + return null; + }; + var operationCount = 0; + for (var i = doc.definitions.length - 1; i >= 0; --i) { + if (doc.definitions[i].kind === Kind.OPERATION_DEFINITION) { + ++operationCount; + } + } + var directiveMatcher = getDirectiveMatcher(directives); + var shouldRemoveField = function (nodeDirectives) { + return isNonEmptyArray(nodeDirectives) && + nodeDirectives + .map(directiveMatcher) + .some(function (config) { return config && config.remove; }); + }; + var originalFragmentDefsByPath = new Map(); + // Any time the first traversal of the document below makes a change like + // removing a fragment (by returning null), this variable should be set to + // true. Once it becomes true, it should never be set to false again. If this + // variable remains false throughout the traversal, then we can return the + // original doc immediately without any modifications. + var firstVisitMadeChanges = false; + var fieldOrInlineFragmentVisitor = { + enter: function (node) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + }, + }; + var docWithoutDirectiveSubtrees = visit(doc, { + // These two AST node types share the same implementation, defined above. + Field: fieldOrInlineFragmentVisitor, + InlineFragment: fieldOrInlineFragmentVisitor, + VariableDefinition: { + enter: function () { + // VariableDefinition nodes do not count as variables in use, though + // they do contain Variable nodes that might be visited below. To avoid + // counting variable declarations as usages, we skip visiting the + // contents of this VariableDefinition node by returning false. + return false; + }, + }, + Variable: { + enter: function (node, _key, _parent, _path, ancestors) { + var inUse = getInUse(ancestors); + if (inUse) { + inUse.variables.add(node.name.value); + } + }, + }, + FragmentSpread: { + enter: function (node, _key, _parent, _path, ancestors) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + var inUse = getInUse(ancestors); + if (inUse) { + inUse.fragmentSpreads.add(node.name.value); + } + // We might like to remove this FragmentSpread by returning null here if + // the corresponding FragmentDefinition node is also going to be removed + // by the logic below, but we can't control the relative order of those + // events, so we have to postpone the removal of dangling FragmentSpread + // nodes until after the current visit of the document has finished. + }, + }, + FragmentDefinition: { + enter: function (node, _key, _parent, path) { + originalFragmentDefsByPath.set(JSON.stringify(path), node); + }, + leave: function (node, _key, _parent, path) { + var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path)); + if (node === originalNode) { + // If the FragmentNode received by this leave function is identical to + // the one received by the corresponding enter function (above), then + // the visitor must not have made any changes within this + // FragmentDefinition node. This fragment definition may still be + // removed if there are no ...spread references to it, but it won't be + // removed just because it has only a __typename field. + return node; + } + if ( + // This logic applies only if the document contains one or more + // operations, since removing all fragments from a document containing + // only fragments makes the document useless. + operationCount > 0 && + node.selectionSet.selections.every(function (selection) { + return selection.kind === Kind.FIELD && + selection.name.value === "__typename"; + })) { + // This is a somewhat opinionated choice: if a FragmentDefinition ends + // up having no fields other than __typename, we remove the whole + // fragment definition, and later prune ...spread references to it. + getInUseByFragmentName(node.name.value).removed = true; + firstVisitMadeChanges = true; + return null; + } + }, + }, + Directive: { + leave: function (node) { + // If a matching directive is found, remove the directive itself. Note + // that this does not remove the target (field, argument, etc) of the + // directive, but only the directive itself. + if (directiveMatcher(node)) { + firstVisitMadeChanges = true; + return null; + } + }, + }, + }); + if (!firstVisitMadeChanges) { + // If our first pass did not change anything about the document, then there + // is no cleanup we need to do, and we can return the original doc. + return doc; + } + // Utility for making sure inUse.transitiveVars is recursively populated. + // Because this logic assumes inUse.fragmentSpreads has been completely + // populated and inUse.removed has been set if appropriate, + // populateTransitiveVars must be called after that information has been + // collected by the first traversal of the document. + var populateTransitiveVars = function (inUse) { + if (!inUse.transitiveVars) { + inUse.transitiveVars = new Set(inUse.variables); + if (!inUse.removed) { + inUse.fragmentSpreads.forEach(function (childFragmentName) { + populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) { + inUse.transitiveVars.add(varName); + }); + }); + } + } + return inUse; + }; + // Since we've been keeping track of fragment spreads used by particular + // operations and fragment definitions, we now need to compute the set of all + // spreads used (transitively) by any operations in the document. + var allFragmentNamesUsed = new Set(); + docWithoutDirectiveSubtrees.definitions.forEach(function (def) { + if (def.kind === Kind.OPERATION_DEFINITION) { + populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + } + else if (def.kind === Kind.FRAGMENT_DEFINITION && + // If there are no operations in the document, then all fragment + // definitions count as usages of their own fragment names. This heuristic + // prevents accidentally removing all fragment definitions from the + // document just because it contains no operations that use the fragments. + operationCount === 0 && + !getInUseByFragmentName(def.name.value).removed) { + allFragmentNamesUsed.add(def.name.value); + } + }); + // Now that we have added all fragment spreads used by operations to the + // allFragmentNamesUsed set, we can complete the set by transitively adding + // all fragment spreads used by those fragments, and so on. + allFragmentNamesUsed.forEach(function (fragmentName) { + // Once all the childFragmentName strings added here have been seen already, + // the top-level allFragmentNamesUsed.forEach loop will terminate. + populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + }); + var fragmentWillBeRemoved = function (fragmentName) { + return !!( + // A fragment definition will be removed if there are no spreads that refer + // to it, or the fragment was explicitly removed because it had no fields + // other than __typename. + (!allFragmentNamesUsed.has(fragmentName) || + getInUseByFragmentName(fragmentName).removed)); + }; + var enterVisitor = { + enter: function (node) { + if (fragmentWillBeRemoved(node.name.value)) { + return null; + } + }, + }; + return nullIfDocIsEmpty(visit(docWithoutDirectiveSubtrees, { + // If the fragment is going to be removed, then leaving any dangling + // FragmentSpread nodes with the same name would be a mistake. + FragmentSpread: enterVisitor, + // This is where the fragment definition is actually removed. + FragmentDefinition: enterVisitor, + OperationDefinition: { + leave: function (node) { + // Upon leaving each operation in the depth-first AST traversal, prune + // any variables that are declared by the operation but unused within. + if (node.variableDefinitions) { + var usedVariableNames_1 = populateTransitiveVars( + // If an operation is anonymous, we use the empty string as its key. + getInUseByOperationName(node.name && node.name.value)).transitiveVars; + // According to the GraphQL spec, all variables declared by an + // operation must either be used by that operation or used by some + // fragment included transitively into that operation: + // https://spec.graphql.org/draft/#sec-All-Variables-Used + // + // To stay on the right side of this validation rule, if/when we + // remove the last $var references from an operation or its fragments, + // we must also remove the corresponding $var declaration from the + // enclosing operation. This pruning applies only to operations and + // not fragment definitions, at the moment. Fragments may be able to + // declare variables eventually, but today they can only consume them. + if (usedVariableNames_1.size < node.variableDefinitions.length) { + return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { + return usedVariableNames_1.has(varDef.variable.name.value); + }) }); + } + } + }, + }, + })); +} +export var addTypenameToDocument = Object.assign(function (doc) { + return visit(doc, { + SelectionSet: { + enter: function (node, _key, parent) { + // Don't add __typename to OperationDefinitions. + if (parent && + parent.kind === + Kind.OPERATION_DEFINITION) { + return; + } + // No changes if no selections. + var selections = node.selections; + if (!selections) { + return; + } + // If selections already have a __typename, or are part of an + // introspection query, do nothing. + var skip = selections.some(function (selection) { + return (isField(selection) && + (selection.name.value === "__typename" || + selection.name.value.lastIndexOf("__", 0) === 0)); + }); + if (skip) { + return; + } + // If this SelectionSet is @export-ed as an input variable, it should + // not have a __typename field (see issue #4691). + var field = parent; + if (isField(field) && + field.directives && + field.directives.some(function (d) { return d.name.value === "export"; })) { + return; + } + // Create and return a new SelectionSet with a __typename Field. + return __assign(__assign({}, node), { selections: __spreadArray(__spreadArray([], selections, true), [TYPENAME_FIELD], false) }); + }, + }, + }); +}, { + added: function (field) { + return field === TYPENAME_FIELD; + }, +}); +var connectionRemoveConfig = { + test: function (directive) { + var willRemove = directive.name.value === "connection"; + if (willRemove) { + if (!directive.arguments || + !directive.arguments.some(function (arg) { return arg.name.value === "key"; })) { + globalThis.__DEV__ !== false && invariant.warn(84); + } + } + return willRemove; + }, +}; +export function removeConnectionDirectiveFromDocument(doc) { + return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); +} +function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { + if (nestedCheck === void 0) { nestedCheck = true; } + return (!!selectionSet && + selectionSet.selections && + selectionSet.selections.some(function (selection) { + return hasDirectivesInSelection(directives, selection, nestedCheck); + })); +} +function hasDirectivesInSelection(directives, selection, nestedCheck) { + if (nestedCheck === void 0) { nestedCheck = true; } + if (!isField(selection)) { + return true; + } + if (!selection.directives) { + return false; + } + return (selection.directives.some(getDirectiveMatcher(directives)) || + (nestedCheck && + hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); +} +function getArgumentMatcher(config) { + return function argumentMatcher(argument) { + return config.some(function (aConfig) { + return argument.value && + argument.value.kind === Kind.VARIABLE && + argument.value.name && + (aConfig.name === argument.value.name.value || + (aConfig.test && aConfig.test(argument))); + }); + }; +} +export function removeArgumentsFromDocument(config, doc) { + var argMatcher = getArgumentMatcher(config); + return nullIfDocIsEmpty(visit(doc, { + OperationDefinition: { + enter: function (node) { + return __assign(__assign({}, node), { + // Remove matching top level variables definitions. + variableDefinitions: node.variableDefinitions ? + node.variableDefinitions.filter(function (varDef) { + return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); + }) + : [] }); + }, + }, + Field: { + enter: function (node) { + // If `remove` is set to true for an argument, and an argument match + // is found for a field, remove the field as well. + var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); + if (shouldRemoveField) { + var argMatchCount_1 = 0; + if (node.arguments) { + node.arguments.forEach(function (arg) { + if (argMatcher(arg)) { + argMatchCount_1 += 1; + } + }); + } + if (argMatchCount_1 === 1) { + return null; + } + } + }, + }, + Argument: { + enter: function (node) { + // Remove all matching arguments. + if (argMatcher(node)) { + return null; + } + }, + }, + })); +} +export function removeFragmentSpreadFromDocument(config, doc) { + function enter(node) { + if (config.some(function (def) { return def.name === node.name.value; })) { + return null; + } + } + return nullIfDocIsEmpty(visit(doc, { + FragmentSpread: { enter: enter }, + FragmentDefinition: { enter: enter }, + })); +} +// If the incoming document is a query, return it as is. Otherwise, build a +// new document containing a query operation based on the selection set +// of the previous main operation. +export function buildQueryFromSelectionSet(document) { + var definition = getMainDefinition(document); + var definitionOperation = definition.operation; + if (definitionOperation === "query") { + // Already a query, so return the existing document. + return document; + } + // Build a new query using the selection set of the main operation. + var modifiedDoc = visit(document, { + OperationDefinition: { + enter: function (node) { + return __assign(__assign({}, node), { operation: "query" }); + }, + }, + }); + return modifiedDoc; +} +// Remove fields / selection sets that include an @client directive. +export function removeClientSetsFromDocument(document) { + checkDocument(document); + var modifiedDoc = removeDirectivesFromDocument([ + { + test: function (directive) { return directive.name.value === "client"; }, + remove: true, + }, + ], document); + return modifiedDoc; +} +//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js.map new file mode 100644 index 0000000..330161b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/graphql/transform.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/utilities/graphql/transform.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAiBhD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA6B/D,IAAM,cAAc,GAAc;IAChC,IAAI,EAAE,IAAI,CAAC,KAAK;IAChB,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,YAAY;KACpB;CACF,CAAC;AAEF,SAAS,OAAO,CACd,EAAoD,EACpD,WAAwB;IAExB,OAAO,CACL,CAAC,EAAE;QACH,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAC9B,UAAC,SAAS;YACR,OAAA,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,eAAe;gBACvC,OAAO,CAAC,WAAW,CAAC,SA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;AAED,oEAAoE;AACpE,MAAM,UAAU,4BAA4B,CAC1C,QAAsB;IAEtB,aAAa,CAAC,QAAQ,CAAC,CAAC;IAExB,IAAI,WAAW,GAAG,4BAA4B,CAC5C;QACE;YACE,IAAI,EAAE,UAAC,SAAwB,IAAK,OAAA,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAjC,CAAiC;YACrE,MAAM,EAAE,IAAI;SACb;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { invariant } from \"../globals/index.js\";\n\nimport type {\n DocumentNode,\n SelectionNode,\n SelectionSetNode,\n OperationDefinitionNode,\n FieldNode,\n DirectiveNode,\n FragmentDefinitionNode,\n ArgumentNode,\n FragmentSpreadNode,\n VariableDefinitionNode,\n ASTNode,\n ASTVisitFn,\n InlineFragmentNode,\n} from \"graphql\";\nimport { visit, Kind } from \"graphql\";\n\nimport {\n checkDocument,\n getOperationDefinition,\n getFragmentDefinition,\n getFragmentDefinitions,\n getMainDefinition,\n} from \"./getFromAST.js\";\nimport { isField } from \"./storeUtils.js\";\nimport type { FragmentMap } from \"./fragments.js\";\nimport { createFragmentMap } from \"./fragments.js\";\nimport { isArray, isNonEmptyArray } from \"../common/arrays.js\";\n\n// https://github.com/graphql/graphql-js/blob/8d7c8fccf5a9846a50785de04abda58a7eb13fc0/src/language/visitor.ts#L20-L23\ninterface EnterLeaveVisitor {\n readonly enter?: ASTVisitFn;\n readonly leave?: ASTVisitFn;\n}\n\nexport type RemoveNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n remove?: boolean;\n};\n\nexport type GetNodeConfig = {\n name?: string;\n test?: (node: N) => boolean;\n};\n\nexport type RemoveDirectiveConfig = RemoveNodeConfig;\nexport type GetDirectiveConfig = GetNodeConfig;\nexport type RemoveArgumentsConfig = RemoveNodeConfig;\nexport type GetFragmentSpreadConfig = GetNodeConfig;\nexport type RemoveFragmentSpreadConfig = RemoveNodeConfig;\nexport type RemoveFragmentDefinitionConfig =\n RemoveNodeConfig;\nexport type RemoveVariableDefinitionConfig =\n RemoveNodeConfig;\n\nconst TYPENAME_FIELD: FieldNode = {\n kind: Kind.FIELD,\n name: {\n kind: Kind.NAME,\n value: \"__typename\",\n },\n};\n\nfunction isEmpty(\n op: OperationDefinitionNode | FragmentDefinitionNode,\n fragmentMap: FragmentMap\n): boolean {\n return (\n !op ||\n op.selectionSet.selections.every(\n (selection) =>\n selection.kind === Kind.FRAGMENT_SPREAD &&\n isEmpty(fragmentMap[selection.name.value], fragmentMap)\n )\n );\n}\n\nfunction nullIfDocIsEmpty(doc: DocumentNode) {\n return (\n isEmpty(\n getOperationDefinition(doc) || getFragmentDefinition(doc),\n createFragmentMap(getFragmentDefinitions(doc))\n )\n ) ?\n null\n : doc;\n}\n\nfunction getDirectiveMatcher(\n configs: (RemoveDirectiveConfig | GetDirectiveConfig)[]\n) {\n const names = new Map();\n\n const tests = new Map<\n (directive: DirectiveNode) => boolean,\n RemoveDirectiveConfig | GetDirectiveConfig\n >();\n\n configs.forEach((directive) => {\n if (directive) {\n if (directive.name) {\n names.set(directive.name, directive);\n } else if (directive.test) {\n tests.set(directive.test, directive);\n }\n }\n });\n\n return (directive: DirectiveNode) => {\n let config = names.get(directive.name.value);\n if (!config && tests.size) {\n tests.forEach((testConfig, test) => {\n if (test(directive)) {\n config = testConfig;\n }\n });\n }\n return config;\n };\n}\n\n// Helper interface and function used by removeDirectivesFromDocument to keep\n// track of variable references and fragments spreads found within a given\n// operation or fragment definition.\ninterface InternalInUseInfo {\n variables: Set;\n fragmentSpreads: Set;\n // Set to true when we deliberately remove a fragment definition, so we can\n // make sure also to remove dangling ...spreads that refer to it.\n removed?: boolean;\n // Populated by the populateTransitiveVars helper function below.\n transitiveVars?: Set;\n}\nfunction makeInUseGetterFunction(defaultKey: TKey) {\n const map = new Map();\n\n return function inUseGetterFunction(\n key: TKey = defaultKey\n ): InternalInUseInfo {\n let inUse = map.get(key);\n if (!inUse) {\n map.set(\n key,\n (inUse = {\n // Variable and fragment spread names used directly within this\n // operation or fragment definition, as identified by key. These sets\n // will be populated during the first traversal of the document in\n // removeDirectivesFromDocument below.\n variables: new Set(),\n fragmentSpreads: new Set(),\n })\n );\n }\n return inUse;\n };\n}\n\nexport function removeDirectivesFromDocument(\n directives: RemoveDirectiveConfig[],\n doc: DocumentNode\n): DocumentNode | null {\n checkDocument(doc);\n\n // Passing empty strings to makeInUseGetterFunction means we handle anonymous\n // operations as if their names were \"\". Anonymous fragment definitions are\n // not supposed to be possible, but the same default naming strategy seems\n // appropriate for that case as well.\n const getInUseByOperationName = makeInUseGetterFunction(\"\");\n const getInUseByFragmentName = makeInUseGetterFunction(\"\");\n const getInUse = (\n ancestors: readonly (ASTNode | readonly ASTNode[])[]\n ): InternalInUseInfo | null => {\n for (\n let p = 0, ancestor: ASTNode | readonly ASTNode[];\n p < ancestors.length && (ancestor = ancestors[p]);\n ++p\n ) {\n if (isArray(ancestor)) continue;\n if (ancestor.kind === Kind.OPERATION_DEFINITION) {\n // If an operation is anonymous, we use the empty string as its key.\n return getInUseByOperationName(ancestor.name && ancestor.name.value);\n }\n if (ancestor.kind === Kind.FRAGMENT_DEFINITION) {\n return getInUseByFragmentName(ancestor.name.value);\n }\n }\n invariant.error(`Could not find operation or fragment`);\n return null;\n };\n\n let operationCount = 0;\n for (let i = doc.definitions.length - 1; i >= 0; --i) {\n if (doc.definitions[i].kind === Kind.OPERATION_DEFINITION) {\n ++operationCount;\n }\n }\n\n const directiveMatcher = getDirectiveMatcher(directives);\n const shouldRemoveField = (nodeDirectives: FieldNode[\"directives\"]) =>\n isNonEmptyArray(nodeDirectives) &&\n nodeDirectives\n .map(directiveMatcher)\n .some(\n (config: RemoveDirectiveConfig | undefined) => config && config.remove\n );\n\n const originalFragmentDefsByPath = new Map();\n\n // Any time the first traversal of the document below makes a change like\n // removing a fragment (by returning null), this variable should be set to\n // true. Once it becomes true, it should never be set to false again. If this\n // variable remains false throughout the traversal, then we can return the\n // original doc immediately without any modifications.\n let firstVisitMadeChanges = false;\n\n const fieldOrInlineFragmentVisitor: EnterLeaveVisitor<\n FieldNode | InlineFragmentNode\n > = {\n enter(node) {\n if (shouldRemoveField(node.directives)) {\n firstVisitMadeChanges = true;\n return null;\n }\n },\n };\n\n const docWithoutDirectiveSubtrees = visit(doc, {\n // These two AST node types share the same implementation, defined above.\n Field: fieldOrInlineFragmentVisitor,\n InlineFragment: fieldOrInlineFragmentVisitor,\n\n VariableDefinition: {\n enter() {\n // VariableDefinition nodes do not count as variables in use, though\n // they do contain Variable nodes that might be visited below. To avoid\n // counting variable declarations as usages, we skip visiting the\n // contents of this VariableDefinition node by returning false.\n return false;\n },\n },\n\n Variable: {\n enter(node, _key, _parent, _path, ancestors) {\n const inUse = getInUse(ancestors);\n if (inUse) {\n inUse.variables.add(node.name.value);\n }\n },\n },\n\n FragmentSpread: {\n enter(node, _key, _parent, _path, ancestors) {\n if (shouldRemoveField(node.directives)) {\n firstVisitMadeChanges = true;\n return null;\n }\n const inUse = getInUse(ancestors);\n if (inUse) {\n inUse.fragmentSpreads.add(node.name.value);\n }\n // We might like to remove this FragmentSpread by returning null here if\n // the corresponding FragmentDefinition node is also going to be removed\n // by the logic below, but we can't control the relative order of those\n // events, so we have to postpone the removal of dangling FragmentSpread\n // nodes until after the current visit of the document has finished.\n },\n },\n\n FragmentDefinition: {\n enter(node, _key, _parent, path) {\n originalFragmentDefsByPath.set(JSON.stringify(path), node);\n },\n leave(node, _key, _parent, path) {\n const originalNode = originalFragmentDefsByPath.get(\n JSON.stringify(path)\n );\n if (node === originalNode) {\n // If the FragmentNode received by this leave function is identical to\n // the one received by the corresponding enter function (above), then\n // the visitor must not have made any changes within this\n // FragmentDefinition node. This fragment definition may still be\n // removed if there are no ...spread references to it, but it won't be\n // removed just because it has only a __typename field.\n return node;\n }\n\n if (\n // This logic applies only if the document contains one or more\n // operations, since removing all fragments from a document containing\n // only fragments makes the document useless.\n operationCount > 0 &&\n node.selectionSet.selections.every(\n (selection) =>\n selection.kind === Kind.FIELD &&\n selection.name.value === \"__typename\"\n )\n ) {\n // This is a somewhat opinionated choice: if a FragmentDefinition ends\n // up having no fields other than __typename, we remove the whole\n // fragment definition, and later prune ...spread references to it.\n getInUseByFragmentName(node.name.value).removed = true;\n firstVisitMadeChanges = true;\n return null;\n }\n },\n },\n\n Directive: {\n leave(node) {\n // If a matching directive is found, remove the directive itself. Note\n // that this does not remove the target (field, argument, etc) of the\n // directive, but only the directive itself.\n if (directiveMatcher(node)) {\n firstVisitMadeChanges = true;\n return null;\n }\n },\n },\n });\n\n if (!firstVisitMadeChanges) {\n // If our first pass did not change anything about the document, then there\n // is no cleanup we need to do, and we can return the original doc.\n return doc;\n }\n\n // Utility for making sure inUse.transitiveVars is recursively populated.\n // Because this logic assumes inUse.fragmentSpreads has been completely\n // populated and inUse.removed has been set if appropriate,\n // populateTransitiveVars must be called after that information has been\n // collected by the first traversal of the document.\n const populateTransitiveVars = (inUse: InternalInUseInfo) => {\n if (!inUse.transitiveVars) {\n inUse.transitiveVars = new Set(inUse.variables);\n if (!inUse.removed) {\n inUse.fragmentSpreads.forEach((childFragmentName) => {\n populateTransitiveVars(\n getInUseByFragmentName(childFragmentName)\n ).transitiveVars!.forEach((varName) => {\n inUse.transitiveVars!.add(varName);\n });\n });\n }\n }\n return inUse;\n };\n\n // Since we've been keeping track of fragment spreads used by particular\n // operations and fragment definitions, we now need to compute the set of all\n // spreads used (transitively) by any operations in the document.\n const allFragmentNamesUsed = new Set();\n docWithoutDirectiveSubtrees.definitions.forEach((def) => {\n if (def.kind === Kind.OPERATION_DEFINITION) {\n populateTransitiveVars(\n getInUseByOperationName(def.name && def.name.value)\n ).fragmentSpreads.forEach((childFragmentName) => {\n allFragmentNamesUsed.add(childFragmentName);\n });\n } else if (\n def.kind === Kind.FRAGMENT_DEFINITION &&\n // If there are no operations in the document, then all fragment\n // definitions count as usages of their own fragment names. This heuristic\n // prevents accidentally removing all fragment definitions from the\n // document just because it contains no operations that use the fragments.\n operationCount === 0 &&\n !getInUseByFragmentName(def.name.value).removed\n ) {\n allFragmentNamesUsed.add(def.name.value);\n }\n });\n // Now that we have added all fragment spreads used by operations to the\n // allFragmentNamesUsed set, we can complete the set by transitively adding\n // all fragment spreads used by those fragments, and so on.\n allFragmentNamesUsed.forEach((fragmentName) => {\n // Once all the childFragmentName strings added here have been seen already,\n // the top-level allFragmentNamesUsed.forEach loop will terminate.\n populateTransitiveVars(\n getInUseByFragmentName(fragmentName)\n ).fragmentSpreads.forEach((childFragmentName) => {\n allFragmentNamesUsed.add(childFragmentName);\n });\n });\n\n const fragmentWillBeRemoved = (fragmentName: string) =>\n !!(\n // A fragment definition will be removed if there are no spreads that refer\n // to it, or the fragment was explicitly removed because it had no fields\n // other than __typename.\n (\n !allFragmentNamesUsed.has(fragmentName) ||\n getInUseByFragmentName(fragmentName).removed\n )\n );\n\n const enterVisitor: EnterLeaveVisitor<\n FragmentSpreadNode | FragmentDefinitionNode\n > = {\n enter(node) {\n if (fragmentWillBeRemoved(node.name.value)) {\n return null;\n }\n },\n };\n\n return nullIfDocIsEmpty(\n visit(docWithoutDirectiveSubtrees, {\n // If the fragment is going to be removed, then leaving any dangling\n // FragmentSpread nodes with the same name would be a mistake.\n FragmentSpread: enterVisitor,\n\n // This is where the fragment definition is actually removed.\n FragmentDefinition: enterVisitor,\n\n OperationDefinition: {\n leave(node) {\n // Upon leaving each operation in the depth-first AST traversal, prune\n // any variables that are declared by the operation but unused within.\n if (node.variableDefinitions) {\n const usedVariableNames = populateTransitiveVars(\n // If an operation is anonymous, we use the empty string as its key.\n getInUseByOperationName(node.name && node.name.value)\n ).transitiveVars!;\n\n // According to the GraphQL spec, all variables declared by an\n // operation must either be used by that operation or used by some\n // fragment included transitively into that operation:\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n //\n // To stay on the right side of this validation rule, if/when we\n // remove the last $var references from an operation or its fragments,\n // we must also remove the corresponding $var declaration from the\n // enclosing operation. This pruning applies only to operations and\n // not fragment definitions, at the moment. Fragments may be able to\n // declare variables eventually, but today they can only consume them.\n if (usedVariableNames.size < node.variableDefinitions.length) {\n return {\n ...node,\n variableDefinitions: node.variableDefinitions.filter((varDef) =>\n usedVariableNames.has(varDef.variable.name.value)\n ),\n };\n }\n }\n },\n },\n })\n );\n}\n\nexport const addTypenameToDocument = Object.assign(\n function (doc: TNode): TNode {\n return visit(doc, {\n SelectionSet: {\n enter(node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (\n parent &&\n (parent as OperationDefinitionNode).kind ===\n Kind.OPERATION_DEFINITION\n ) {\n return;\n }\n\n // No changes if no selections.\n const { selections } = node;\n if (!selections) {\n return;\n }\n\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n const skip = selections.some((selection) => {\n return (\n isField(selection) &&\n (selection.name.value === \"__typename\" ||\n selection.name.value.lastIndexOf(\"__\", 0) === 0)\n );\n });\n if (skip) {\n return;\n }\n\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n const field = parent as FieldNode;\n if (\n isField(field) &&\n field.directives &&\n field.directives.some((d) => d.name.value === \"export\")\n ) {\n return;\n }\n\n // Create and return a new SelectionSet with a __typename Field.\n return {\n ...node,\n selections: [...selections, TYPENAME_FIELD],\n };\n },\n },\n });\n },\n {\n added(field: FieldNode): boolean {\n return field === TYPENAME_FIELD;\n },\n }\n);\n\nconst connectionRemoveConfig = {\n test: (directive: DirectiveNode) => {\n const willRemove = directive.name.value === \"connection\";\n if (willRemove) {\n if (\n !directive.arguments ||\n !directive.arguments.some((arg) => arg.name.value === \"key\")\n ) {\n invariant.warn(\n \"Removing an @connection directive even though it does not have a key. \" +\n \"You may want to use the key parameter to specify a store key.\"\n );\n }\n }\n\n return willRemove;\n },\n};\n\nexport function removeConnectionDirectiveFromDocument(doc: DocumentNode) {\n return removeDirectivesFromDocument(\n [connectionRemoveConfig],\n checkDocument(doc)\n );\n}\n\nfunction hasDirectivesInSelectionSet(\n directives: GetDirectiveConfig[],\n selectionSet: SelectionSetNode | undefined,\n nestedCheck = true\n): boolean {\n return (\n !!selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some((selection) =>\n hasDirectivesInSelection(directives, selection, nestedCheck)\n )\n );\n}\n\nfunction hasDirectivesInSelection(\n directives: GetDirectiveConfig[],\n selection: SelectionNode,\n nestedCheck = true\n): boolean {\n if (!isField(selection)) {\n return true;\n }\n\n if (!selection.directives) {\n return false;\n }\n\n return (\n selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(\n directives,\n selection.selectionSet,\n nestedCheck\n ))\n );\n}\n\nfunction getArgumentMatcher(config: RemoveArgumentsConfig[]) {\n return function argumentMatcher(argument: ArgumentNode) {\n return config.some(\n (aConfig: RemoveArgumentsConfig) =>\n argument.value &&\n argument.value.kind === Kind.VARIABLE &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument)))\n );\n };\n}\n\nexport function removeArgumentsFromDocument(\n config: RemoveArgumentsConfig[],\n doc: DocumentNode\n): DocumentNode | null {\n const argMatcher = getArgumentMatcher(config);\n\n return nullIfDocIsEmpty(\n visit(doc, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n // Remove matching top level variables definitions.\n variableDefinitions:\n node.variableDefinitions ?\n node.variableDefinitions.filter(\n (varDef) =>\n !config.some(\n (arg) => arg.name === varDef.variable.name.value\n )\n )\n : [],\n };\n },\n },\n\n Field: {\n enter(node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n const shouldRemoveField = config.some(\n (argConfig) => argConfig.remove\n );\n\n if (shouldRemoveField) {\n let argMatchCount = 0;\n if (node.arguments) {\n node.arguments.forEach((arg) => {\n if (argMatcher(arg)) {\n argMatchCount += 1;\n }\n });\n }\n\n if (argMatchCount === 1) {\n return null;\n }\n }\n },\n },\n\n Argument: {\n enter(node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n })\n );\n}\n\nexport function removeFragmentSpreadFromDocument(\n config: RemoveFragmentSpreadConfig[],\n doc: DocumentNode\n): DocumentNode | null {\n function enter(\n node: FragmentSpreadNode | FragmentDefinitionNode\n ): null | void {\n if (config.some((def) => def.name === node.name.value)) {\n return null;\n }\n }\n\n return nullIfDocIsEmpty(\n visit(doc, {\n FragmentSpread: { enter },\n FragmentDefinition: { enter },\n })\n );\n}\n\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(\n document: DocumentNode\n): DocumentNode {\n const definition = getMainDefinition(document);\n const definitionOperation = (definition).operation;\n\n if (definitionOperation === \"query\") {\n // Already a query, so return the existing document.\n return document;\n }\n\n // Build a new query using the selection set of the main operation.\n const modifiedDoc = visit(document, {\n OperationDefinition: {\n enter(node) {\n return {\n ...node,\n operation: \"query\",\n };\n },\n },\n });\n return modifiedDoc;\n}\n\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(\n document: DocumentNode\n): DocumentNode | null {\n checkDocument(document);\n\n let modifiedDoc = removeDirectivesFromDocument(\n [\n {\n test: (directive: DirectiveNode) => directive.name.value === \"client\",\n remove: true,\n },\n ],\n document\n );\n\n return modifiedDoc;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/index.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/index.d.ts new file mode 100644 index 0000000..2476866 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/index.d.ts @@ -0,0 +1,45 @@ +export { DEV, maybe } from "./globals/index.js"; +export type { DirectiveInfo, InclusionDirectives, } from "./graphql/directives.js"; +export { shouldInclude, hasDirectives, hasAnyDirectives, hasAllDirectives, hasClientExports, getDirectiveNames, getInclusionDirectives, } from "./graphql/directives.js"; +export type { DocumentTransformCacheKey } from "./graphql/DocumentTransform.js"; +export { DocumentTransform } from "./graphql/DocumentTransform.js"; +export type { FragmentMap, FragmentMapFunction } from "./graphql/fragments.js"; +export { createFragmentMap, getFragmentQueryDocument, getFragmentFromSelection, } from "./graphql/fragments.js"; +export { checkDocument, getOperationDefinition, getOperationName, getFragmentDefinitions, getQueryDefinition, getFragmentDefinition, getMainDefinition, getDefaultValues, } from "./graphql/getFromAST.js"; +export { print } from "./graphql/print.js"; +export type { StoreObject, AsStoreObject, Reference, StoreValue, Directives, VariableValue, } from "./graphql/storeUtils.js"; +export { makeReference, isDocumentNode, isReference, isField, isInlineFragment, valueToObjectRepresentation, storeKeyNameFromField, argumentsObjectFromField, resultKeyNameFromField, getStoreKeyName, getTypenameFromResult, } from "./graphql/storeUtils.js"; +export type { RemoveNodeConfig, GetNodeConfig, RemoveDirectiveConfig, GetDirectiveConfig, RemoveArgumentsConfig, GetFragmentSpreadConfig, RemoveFragmentSpreadConfig, RemoveFragmentDefinitionConfig, RemoveVariableDefinitionConfig, } from "./graphql/transform.js"; +export { addTypenameToDocument, buildQueryFromSelectionSet, removeDirectivesFromDocument, removeConnectionDirectiveFromDocument, removeArgumentsFromDocument, removeFragmentSpreadFromDocument, removeClientSetsFromDocument, } from "./graphql/transform.js"; +export { isMutationOperation, isQueryOperation, isSubscriptionOperation, } from "./graphql/operations.js"; +export { concatPagination, offsetLimitPagination, relayStylePagination, } from "./policies/pagination.js"; +export type { Observer, ObservableSubscription, } from "./observables/Observable.js"; +export { Observable } from "./observables/Observable.js"; +export type { PromiseWithState } from "./promises/decoration.js"; +export { isStatefulPromise, createFulfilledPromise, createRejectedPromise, wrapPromiseWithState, } from "./promises/decoration.js"; +export * from "./common/mergeDeep.js"; +export * from "./common/cloneDeep.js"; +export * from "./common/maybeDeepFreeze.js"; +export * from "./observables/iteration.js"; +export * from "./observables/asyncMap.js"; +export * from "./observables/Concast.js"; +export * from "./observables/subclassing.js"; +export * from "./common/arrays.js"; +export * from "./common/objects.js"; +export * from "./common/errorHandling.js"; +export * from "./common/canUse.js"; +export * from "./common/compact.js"; +export * from "./common/makeUniqueId.js"; +export * from "./common/stringifyForDisplay.js"; +export * from "./common/mergeOptions.js"; +export * from "./common/incrementalResult.js"; +export { canonicalStringify } from "./common/canonicalStringify.js"; +export { omitDeep } from "./common/omitDeep.js"; +export { stripTypename } from "./common/stripTypename.js"; +export * from "./types/IsStrictlyAny.js"; +export type { DeepOmit } from "./types/DeepOmit.js"; +export type { DeepPartial } from "./types/DeepPartial.js"; +export type { OnlyRequiredProperties } from "./types/OnlyRequiredProperties.js"; +export { AutoCleanedStrongCache, AutoCleanedWeakCache, cacheSizes, defaultCacheSizes, } from "./caching/index.js"; +export type { CacheSizes } from "./caching/index.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/index.js b/graphql-subscription/node_modules/@apollo/client/utilities/index.js new file mode 100644 index 0000000..978444c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/index.js @@ -0,0 +1,34 @@ +export { DEV, maybe } from "./globals/index.js"; +export { shouldInclude, hasDirectives, hasAnyDirectives, hasAllDirectives, hasClientExports, getDirectiveNames, getInclusionDirectives, } from "./graphql/directives.js"; +export { DocumentTransform } from "./graphql/DocumentTransform.js"; +export { createFragmentMap, getFragmentQueryDocument, getFragmentFromSelection, } from "./graphql/fragments.js"; +export { checkDocument, getOperationDefinition, getOperationName, getFragmentDefinitions, getQueryDefinition, getFragmentDefinition, getMainDefinition, getDefaultValues, } from "./graphql/getFromAST.js"; +export { print } from "./graphql/print.js"; +export { makeReference, isDocumentNode, isReference, isField, isInlineFragment, valueToObjectRepresentation, storeKeyNameFromField, argumentsObjectFromField, resultKeyNameFromField, getStoreKeyName, getTypenameFromResult, } from "./graphql/storeUtils.js"; +export { addTypenameToDocument, buildQueryFromSelectionSet, removeDirectivesFromDocument, removeConnectionDirectiveFromDocument, removeArgumentsFromDocument, removeFragmentSpreadFromDocument, removeClientSetsFromDocument, } from "./graphql/transform.js"; +export { isMutationOperation, isQueryOperation, isSubscriptionOperation, } from "./graphql/operations.js"; +export { concatPagination, offsetLimitPagination, relayStylePagination, } from "./policies/pagination.js"; +export { Observable } from "./observables/Observable.js"; +export { isStatefulPromise, createFulfilledPromise, createRejectedPromise, wrapPromiseWithState, } from "./promises/decoration.js"; +export * from "./common/mergeDeep.js"; +export * from "./common/cloneDeep.js"; +export * from "./common/maybeDeepFreeze.js"; +export * from "./observables/iteration.js"; +export * from "./observables/asyncMap.js"; +export * from "./observables/Concast.js"; +export * from "./observables/subclassing.js"; +export * from "./common/arrays.js"; +export * from "./common/objects.js"; +export * from "./common/errorHandling.js"; +export * from "./common/canUse.js"; +export * from "./common/compact.js"; +export * from "./common/makeUniqueId.js"; +export * from "./common/stringifyForDisplay.js"; +export * from "./common/mergeOptions.js"; +export * from "./common/incrementalResult.js"; +export { canonicalStringify } from "./common/canonicalStringify.js"; +export { omitDeep } from "./common/omitDeep.js"; +export { stripTypename } from "./common/stripTypename.js"; +export * from "./types/IsStrictlyAny.js"; +export { AutoCleanedStrongCache, AutoCleanedWeakCache, cacheSizes, } from "./caching/index.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/index.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/index.js.map new file mode 100644 index 0000000..77a60e1 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAMhD,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EACL,iBAAi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BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,cAAc,0BAA0B,CAAC;AAKzC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,GAEX,MAAM,oBAAoB,CAAC","sourcesContent":["export { DEV, maybe } from \"./globals/index.js\";\n\nexport type {\n DirectiveInfo,\n InclusionDirectives,\n} from \"./graphql/directives.js\";\nexport {\n shouldInclude,\n hasDirectives,\n hasAnyDirectives,\n hasAllDirectives,\n hasClientExports,\n getDirectiveNames,\n getInclusionDirectives,\n} from \"./graphql/directives.js\";\n\nexport type { DocumentTransformCacheKey } from \"./graphql/DocumentTransform.js\";\nexport { DocumentTransform } from \"./graphql/DocumentTransform.js\";\n\nexport type { FragmentMap, FragmentMapFunction } from \"./graphql/fragments.js\";\nexport {\n createFragmentMap,\n getFragmentQueryDocument,\n getFragmentFromSelection,\n} from \"./graphql/fragments.js\";\n\nexport {\n checkDocument,\n getOperationDefinition,\n getOperationName,\n getFragmentDefinitions,\n getQueryDefinition,\n getFragmentDefinition,\n getMainDefinition,\n getDefaultValues,\n} from \"./graphql/getFromAST.js\";\n\nexport { print } from \"./graphql/print.js\";\n\nexport type {\n StoreObject,\n AsStoreObject,\n Reference,\n StoreValue,\n Directives,\n VariableValue,\n} from \"./graphql/storeUtils.js\";\nexport {\n makeReference,\n isDocumentNode,\n isReference,\n isField,\n isInlineFragment,\n valueToObjectRepresentation,\n storeKeyNameFromField,\n argumentsObjectFromField,\n resultKeyNameFromField,\n getStoreKeyName,\n getTypenameFromResult,\n} from \"./graphql/storeUtils.js\";\n\nexport type {\n RemoveNodeConfig,\n GetNodeConfig,\n RemoveDirectiveConfig,\n GetDirectiveConfig,\n RemoveArgumentsConfig,\n GetFragmentSpreadConfig,\n RemoveFragmentSpreadConfig,\n RemoveFragmentDefinitionConfig,\n RemoveVariableDefinitionConfig,\n} from \"./graphql/transform.js\";\nexport {\n addTypenameToDocument,\n buildQueryFromSelectionSet,\n removeDirectivesFromDocument,\n removeConnectionDirectiveFromDocument,\n removeArgumentsFromDocument,\n removeFragmentSpreadFromDocument,\n removeClientSetsFromDocument,\n} from \"./graphql/transform.js\";\n\nexport {\n isMutationOperation,\n isQueryOperation,\n isSubscriptionOperation,\n} from \"./graphql/operations.js\";\n\nexport {\n concatPagination,\n offsetLimitPagination,\n relayStylePagination,\n} from \"./policies/pagination.js\";\n\nexport type {\n Observer,\n ObservableSubscription,\n} from \"./observables/Observable.js\";\nexport { Observable } from \"./observables/Observable.js\";\n\nexport type { PromiseWithState } from \"./promises/decoration.js\";\nexport {\n isStatefulPromise,\n createFulfilledPromise,\n createRejectedPromise,\n wrapPromiseWithState,\n} from \"./promises/decoration.js\";\n\nexport * from \"./common/mergeDeep.js\";\nexport * from \"./common/cloneDeep.js\";\nexport * from \"./common/maybeDeepFreeze.js\";\nexport * from \"./observables/iteration.js\";\nexport * from \"./observables/asyncMap.js\";\nexport * from \"./observables/Concast.js\";\nexport * from \"./observables/subclassing.js\";\nexport * from \"./common/arrays.js\";\nexport * from \"./common/objects.js\";\nexport * from \"./common/errorHandling.js\";\nexport * from \"./common/canUse.js\";\nexport * from \"./common/compact.js\";\nexport * from \"./common/makeUniqueId.js\";\nexport * from \"./common/stringifyForDisplay.js\";\nexport * from \"./common/mergeOptions.js\";\nexport * from \"./common/incrementalResult.js\";\n\nexport { canonicalStringify } from \"./common/canonicalStringify.js\";\nexport { omitDeep } from \"./common/omitDeep.js\";\nexport { stripTypename } from \"./common/stripTypename.js\";\n\nexport * from \"./types/IsStrictlyAny.js\";\nexport type { DeepOmit } from \"./types/DeepOmit.js\";\nexport type { DeepPartial } from \"./types/DeepPartial.js\";\nexport type { OnlyRequiredProperties } from \"./types/OnlyRequiredProperties.js\";\n\nexport {\n AutoCleanedStrongCache,\n AutoCleanedWeakCache,\n cacheSizes,\n defaultCacheSizes,\n} from \"./caching/index.js\";\nexport type { CacheSizes } from \"./caching/index.js\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.d.ts new file mode 100644 index 0000000..a8706a9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.d.ts @@ -0,0 +1,28 @@ +import type { Observer, Subscriber } from "./Observable.js"; +import { Observable } from "./Observable.js"; +type MaybeAsync = T | PromiseLike; +type Source = MaybeAsync>; +export type ConcastSourcesIterable = Iterable>; +export type ConcastSourcesArray = Array>; +export declare class Concast extends Observable { + private observers; + private sub?; + constructor(sources: MaybeAsync> | Subscriber); + private sources; + private start; + private deliverLastMessage; + addObserver(observer: Observer): void; + removeObserver(observer: Observer): void; + private resolve; + private reject; + readonly promise: Promise; + private latest?; + private handlers; + private nextResultListeners; + private notify; + beforeNext(callback: NextResultListener): void; + cancel: (reason: any) => void; +} +type NextResultListener = (method: "next" | "error" | "complete", arg?: any) => any; +export {}; +//# sourceMappingURL=Concast.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js new file mode 100644 index 0000000..4889a6e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js @@ -0,0 +1,216 @@ +import { __extends } from "tslib"; +import { Observable } from "./Observable.js"; +import { iterateObserversSafely } from "./iteration.js"; +import { fixObservableSubclass } from "./subclassing.js"; +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +// A Concast observable concatenates the given sources into a single +// non-overlapping sequence of Ts, automatically unwrapping any promises, +// and broadcasts the T elements of that sequence to any number of +// subscribers, all without creating a bunch of intermediary Observable +// wrapper objects. +// +// Even though any number of observers can subscribe to the Concast, each +// source observable is guaranteed to receive at most one subscribe call, +// and the results are multicast to all observers. +// +// In addition to broadcasting every next/error message to this.observers, +// the Concast stores the most recent message using this.latest, so any +// new observers can immediately receive the latest message, even if it +// was originally delivered in the past. This behavior means we can assume +// every active observer in this.observers has received the same most +// recent message. +// +// With the exception of this.latest replay, a Concast is a "hot" +// observable in the sense that it does not replay past results from the +// beginning of time for each new observer. +// +// Could we have used some existing RxJS class instead? Concast is +// similar to a BehaviorSubject, because it is multicast and redelivers +// the latest next/error message to new subscribers. Unlike Subject, +// Concast does not expose an Observer interface (this.handlers is +// intentionally private), since Concast gets its inputs from the +// concatenated sources. If we ever switch to RxJS, there may be some +// value in reusing their code, but for now we use zen-observable, which +// does not contain any Subject implementations. +var Concast = /** @class */ (function (_super) { + __extends(Concast, _super); + // Not only can the individual elements of the iterable be promises, but + // also the iterable itself can be wrapped in a promise. + function Concast(sources) { + var _this = _super.call(this, function (observer) { + _this.addObserver(observer); + return function () { return _this.removeObserver(observer); }; + }) || this; + // Active observers receiving broadcast messages. Thanks to this.latest, + // we can assume all observers in this Set have received the same most + // recent message, though possibly at different times in the past. + _this.observers = new Set(); + _this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + // Bound handler functions that can be reused for every internal + // subscription. + _this.handlers = { + next: function (result) { + if (_this.sub !== null) { + _this.latest = ["next", result]; + _this.notify("next", result); + iterateObserversSafely(_this.observers, "next", result); + } + }, + error: function (error) { + var sub = _this.sub; + if (sub !== null) { + // Delay unsubscribing from the underlying subscription slightly, + // so that immediately subscribing another observer can keep the + // subscription active. + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + _this.latest = ["error", error]; + _this.reject(error); + _this.notify("error", error); + iterateObserversSafely(_this.observers, "error", error); + } + }, + complete: function () { + var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b; + if (sub !== null) { + // If complete is called before concast.start, this.sources may be + // undefined, so we use a default value of [] for sources. That works + // here because it falls into the if (!value) {...} block, which + // appropriately terminates the Concast, even if this.sources might + // eventually have been initialized to a non-empty array. + var value = sources.shift(); + if (!value) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + if (_this.latest && _this.latest[0] === "next") { + _this.resolve(_this.latest[1]); + } + else { + _this.resolve(); + } + _this.notify("complete"); + // We do not store this.latest = ["complete"], because doing so + // discards useful information about the previous next (or + // error) message. Instead, if new observers subscribe after + // this Concast has completed, they will receive the final + // 'next' message (unless there was an error) immediately + // followed by a 'complete' message (see addObserver). + iterateObserversSafely(_this.observers, "complete"); + } + else if (isPromiseLike(value)) { + value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error); + } + else { + _this.sub = value.subscribe(_this.handlers); + } + } + }, + }; + _this.nextResultListeners = new Set(); + // A public way to abort observation and broadcast. + _this.cancel = function (reason) { + _this.reject(reason); + _this.sources = []; + _this.handlers.complete(); + }; + // Suppress rejection warnings for this.promise, since it's perfectly + // acceptable to pay no attention to this.promise if you're consuming + // the results through the normal observable API. + _this.promise.catch(function (_) { }); + // If someone accidentally tries to create a Concast using a subscriber + // function, recover by creating an Observable from that subscriber and + // using it as the source. + if (typeof sources === "function") { + sources = [new Observable(sources)]; + } + if (isPromiseLike(sources)) { + sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error); + } + else { + _this.start(sources); + } + return _this; + } + Concast.prototype.start = function (sources) { + if (this.sub !== void 0) + return; + // In practice, sources is most often simply an Array of observables. + // TODO Consider using sources[Symbol.iterator]() to take advantage + // of the laziness of non-Array iterables. + this.sources = Array.from(sources); + // Calling this.handlers.complete() kicks off consumption of the first + // source observable. It's tempting to do this step lazily in + // addObserver, but this.promise can be accessed without calling + // addObserver, so consumption needs to begin eagerly. + this.handlers.complete(); + }; + Concast.prototype.deliverLastMessage = function (observer) { + if (this.latest) { + var nextOrError = this.latest[0]; + var method = observer[nextOrError]; + if (method) { + method.call(observer, this.latest[1]); + } + // If the subscription is already closed, and the last message was + // a 'next' message, simulate delivery of the final 'complete' + // message again. + if (this.sub === null && nextOrError === "next" && observer.complete) { + observer.complete(); + } + } + }; + Concast.prototype.addObserver = function (observer) { + if (!this.observers.has(observer)) { + // Immediately deliver the most recent message, so we can always + // be sure all observers have the latest information. + this.deliverLastMessage(observer); + this.observers.add(observer); + } + }; + Concast.prototype.removeObserver = function (observer) { + if (this.observers.delete(observer) && this.observers.size < 1) { + // In case there are still any listeners in this.nextResultListeners, and + // no error or completion has been broadcast yet, make sure those + // observers have a chance to run and then remove themselves from + // this.observers. + this.handlers.complete(); + } + }; + Concast.prototype.notify = function (method, arg) { + var nextResultListeners = this.nextResultListeners; + if (nextResultListeners.size) { + // Replacing this.nextResultListeners first ensures it does not grow while + // we are iterating over it, potentially leading to infinite loops. + this.nextResultListeners = new Set(); + nextResultListeners.forEach(function (listener) { return listener(method, arg); }); + } + }; + // We need a way to run callbacks just *before* the next result (or error or + // completion) is delivered by this Concast, so we can be sure any code that + // runs as a result of delivering that result/error observes the effects of + // running the callback(s). It was tempting to reuse the Observer type instead + // of introducing NextResultListener, but that messes with the sizing and + // maintenance of this.observers, and ends up being more code overall. + Concast.prototype.beforeNext = function (callback) { + var called = false; + this.nextResultListeners.add(function (method, arg) { + if (!called) { + called = true; + callback(method, arg); + } + }); + }; + return Concast; +}(Observable)); +export { Concast }; +// Necessary because the Concast constructor has a different signature +// than the Observable constructor. +fixObservableSubclass(Concast); +//# sourceMappingURL=Concast.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js.map new file mode 100644 index 0000000..607bfdf --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Concast.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Concast.js","sourceRoot":"","sources":["../../../src/utilities/observables/Concast.ts"],"names":[],"mappings":";A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AAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,8EAA8E;IAC9E,yEAAyE;IACzE,sEAAsE;IACtE,4BAAU,GAAV,UAAW,QAA4B;QACrC,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,GAAG;YACvC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,GAAG,IAAI,CAAC;gBACd,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAQH,cAAC;AAAD,CAAC,AAlND,CAAgC,UAAU,GAkNzC;;AAOD,sEAAsE;AACtE,mCAAmC;AACnC,qBAAqB,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import type {\n Observer,\n ObservableSubscription,\n Subscriber,\n} from \"./Observable.js\";\nimport { Observable } from \"./Observable.js\";\nimport { iterateObserversSafely } from \"./iteration.js\";\nimport { fixObservableSubclass } from \"./subclassing.js\";\n\ntype MaybeAsync = T | PromiseLike;\n\nfunction isPromiseLike(value: MaybeAsync): value is PromiseLike {\n return value && typeof (value as any).then === \"function\";\n}\n\n// Any individual Source can be an Observable or a promise for one.\ntype Source = MaybeAsync>;\n\nexport type ConcastSourcesIterable = Iterable>;\nexport type ConcastSourcesArray = Array>;\n\n// A Concast observable concatenates the given sources into a single\n// non-overlapping sequence of Ts, automatically unwrapping any promises,\n// and broadcasts the T elements of that sequence to any number of\n// subscribers, all without creating a bunch of intermediary Observable\n// wrapper objects.\n//\n// Even though any number of observers can subscribe to the Concast, each\n// source observable is guaranteed to receive at most one subscribe call,\n// and the results are multicast to all observers.\n//\n// In addition to broadcasting every next/error message to this.observers,\n// the Concast stores the most recent message using this.latest, so any\n// new observers can immediately receive the latest message, even if it\n// was originally delivered in the past. This behavior means we can assume\n// every active observer in this.observers has received the same most\n// recent message.\n//\n// With the exception of this.latest replay, a Concast is a \"hot\"\n// observable in the sense that it does not replay past results from the\n// beginning of time for each new observer.\n//\n// Could we have used some existing RxJS class instead? Concast is\n// similar to a BehaviorSubject, because it is multicast and redelivers\n// the latest next/error message to new subscribers. Unlike Subject,\n// Concast does not expose an Observer interface (this.handlers is\n// intentionally private), since Concast gets its inputs from the\n// concatenated sources. If we ever switch to RxJS, there may be some\n// value in reusing their code, but for now we use zen-observable, which\n// does not contain any Subject implementations.\nexport class Concast extends Observable {\n // Active observers receiving broadcast messages. Thanks to this.latest,\n // we can assume all observers in this Set have received the same most\n // recent message, though possibly at different times in the past.\n private observers = new Set>();\n\n // This property starts off undefined to indicate the initial\n // subscription has not yet begun, then points to each source\n // subscription in turn, and finally becomes null after the sources have\n // been exhausted. After that, it stays null.\n private sub?: ObservableSubscription | null;\n\n // Not only can the individual elements of the iterable be promises, but\n // also the iterable itself can be wrapped in a promise.\n constructor(sources: MaybeAsync> | Subscriber) {\n super((observer) => {\n this.addObserver(observer);\n return () => this.removeObserver(observer);\n });\n\n // Suppress rejection warnings for this.promise, since it's perfectly\n // acceptable to pay no attention to this.promise if you're consuming\n // the results through the normal observable API.\n this.promise.catch((_) => {});\n\n // If someone accidentally tries to create a Concast using a subscriber\n // function, recover by creating an Observable from that subscriber and\n // using it as the source.\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n\n if (isPromiseLike(sources)) {\n sources.then((iterable) => this.start(iterable), this.handlers.error);\n } else {\n this.start(sources);\n }\n }\n\n // A consumable array of source observables, incrementally consumed each time\n // this.handlers.complete is called. This private field is not initialized\n // until the concast.start method is called, which can happen asynchronously\n // if a Promise is passed to the Concast constructor, so undefined is a\n // possible value for this.sources before concast.start is called.\n private sources: Source[] | undefined;\n\n private start(sources: ConcastSourcesIterable) {\n if (this.sub !== void 0) return;\n\n // In practice, sources is most often simply an Array of observables.\n // TODO Consider using sources[Symbol.iterator]() to take advantage\n // of the laziness of non-Array iterables.\n this.sources = Array.from(sources);\n\n // Calling this.handlers.complete() kicks off consumption of the first\n // source observable. It's tempting to do this step lazily in\n // addObserver, but this.promise can be accessed without calling\n // addObserver, so consumption needs to begin eagerly.\n this.handlers.complete();\n }\n\n private deliverLastMessage(observer: Observer) {\n if (this.latest) {\n const nextOrError = this.latest[0];\n const method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n // If the subscription is already closed, and the last message was\n // a 'next' message, simulate delivery of the final 'complete'\n // message again.\n if (this.sub === null && nextOrError === \"next\" && observer.complete) {\n observer.complete();\n }\n }\n }\n\n public addObserver(observer: Observer) {\n if (!this.observers.has(observer)) {\n // Immediately deliver the most recent message, so we can always\n // be sure all observers have the latest information.\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n }\n }\n\n public removeObserver(observer: Observer) {\n if (this.observers.delete(observer) && this.observers.size < 1) {\n // In case there are still any listeners in this.nextResultListeners, and\n // no error or completion has been broadcast yet, make sure those\n // observers have a chance to run and then remove themselves from\n // this.observers.\n this.handlers.complete();\n }\n }\n\n // Any Concast object can be trivially converted to a Promise, without\n // having to create a new wrapper Observable. This promise provides an\n // easy way to observe the final state of the Concast.\n private resolve!: (result?: T | PromiseLike) => void;\n private reject!: (reason: any) => void;\n public readonly promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n\n // Name and argument of the most recently invoked observer method, used\n // to deliver latest results immediately to new observers.\n private latest?: [\"next\", T] | [\"error\", any];\n\n // Bound handler functions that can be reused for every internal\n // subscription.\n private handlers = {\n next: (result: T) => {\n if (this.sub !== null) {\n this.latest = [\"next\", result];\n this.notify(\"next\", result);\n iterateObserversSafely(this.observers, \"next\", result);\n }\n },\n\n error: (error: any) => {\n const { sub } = this;\n if (sub !== null) {\n // Delay unsubscribing from the underlying subscription slightly,\n // so that immediately subscribing another observer can keep the\n // subscription active.\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n this.latest = [\"error\", error];\n this.reject(error);\n this.notify(\"error\", error);\n iterateObserversSafely(this.observers, \"error\", error);\n }\n },\n\n complete: () => {\n const { sub, sources = [] } = this;\n if (sub !== null) {\n // If complete is called before concast.start, this.sources may be\n // undefined, so we use a default value of [] for sources. That works\n // here because it falls into the if (!value) {...} block, which\n // appropriately terminates the Concast, even if this.sources might\n // eventually have been initialized to a non-empty array.\n const value = sources.shift();\n if (!value) {\n if (sub) setTimeout(() => sub.unsubscribe());\n this.sub = null;\n if (this.latest && this.latest[0] === \"next\") {\n this.resolve(this.latest[1]);\n } else {\n this.resolve();\n }\n this.notify(\"complete\");\n // We do not store this.latest = [\"complete\"], because doing so\n // discards useful information about the previous next (or\n // error) message. Instead, if new observers subscribe after\n // this Concast has completed, they will receive the final\n // 'next' message (unless there was an error) immediately\n // followed by a 'complete' message (see addObserver).\n iterateObserversSafely(this.observers, \"complete\");\n } else if (isPromiseLike(value)) {\n value.then(\n (obs) => (this.sub = obs.subscribe(this.handlers)),\n this.handlers.error\n );\n } else {\n this.sub = value.subscribe(this.handlers);\n }\n }\n },\n };\n\n private nextResultListeners = new Set();\n\n private notify(\n method: Parameters[0],\n arg?: Parameters[1]\n ) {\n const { nextResultListeners } = this;\n if (nextResultListeners.size) {\n // Replacing this.nextResultListeners first ensures it does not grow while\n // we are iterating over it, potentially leading to infinite loops.\n this.nextResultListeners = new Set();\n nextResultListeners.forEach((listener) => listener(method, arg));\n }\n }\n\n // We need a way to run callbacks just *before* the next result (or error or\n // completion) is delivered by this Concast, so we can be sure any code that\n // runs as a result of delivering that result/error observes the effects of\n // running the callback(s). It was tempting to reuse the Observer type instead\n // of introducing NextResultListener, but that messes with the sizing and\n // maintenance of this.observers, and ends up being more code overall.\n beforeNext(callback: NextResultListener) {\n let called = false;\n this.nextResultListeners.add((method, arg) => {\n if (!called) {\n called = true;\n callback(method, arg);\n }\n });\n }\n\n // A public way to abort observation and broadcast.\n public cancel = (reason: any) => {\n this.reject(reason);\n this.sources = [];\n this.handlers.complete();\n };\n}\n\ntype NextResultListener = (\n method: \"next\" | \"error\" | \"complete\",\n arg?: any\n) => any;\n\n// Necessary because the Concast constructor has a different signature\n// than the Observable constructor.\nfixObservableSubclass(Concast);\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.d.ts new file mode 100644 index 0000000..ecd5de2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.d.ts @@ -0,0 +1,6 @@ +import type { Observer, Subscription as ObservableSubscription, Subscriber } from "zen-observable-ts"; +import { Observable } from "zen-observable-ts"; +import "symbol-observable"; +export type { Observer, ObservableSubscription, Subscriber }; +export { Observable }; +//# sourceMappingURL=Observable.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js new file mode 100644 index 0000000..838c133 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js @@ -0,0 +1,17 @@ +import { Observable } from "zen-observable-ts"; +// This simplified polyfill attempts to follow the ECMAScript Observable +// proposal (https://github.com/zenparsing/es-observable) +import "symbol-observable"; +// The zen-observable package defines Observable.prototype[Symbol.observable] +// when Symbol is supported, but RxJS interop depends on also setting this fake +// '@@observable' string as a polyfill for Symbol.observable. +var prototype = Observable.prototype; +var fakeObsSymbol = "@@observable"; +if (!prototype[fakeObsSymbol]) { + // @ts-expect-error + prototype[fakeObsSymbol] = function () { + return this; + }; +} +export { Observable }; +//# sourceMappingURL=Observable.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js.map new file mode 100644 index 0000000..5c89ee6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/Observable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Observable.js","sourceRoot":"","sources":["../../../src/utilities/observables/Observable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wEAAwE;AACxE,yDAAyD;AACzD,OAAO,mBAAmB,CAAC;AAI3B,6EAA6E;AAC7E,+EAA+E;AAC/E,6DAA6D;AACrD,IAAA,SAAS,GAAK,UAAU,UAAf,CAAgB;AACjC,IAAM,aAAa,GAAG,cAAwC,CAAC;AAC/D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;IAC9B,mBAAmB;IACnB,SAAS,CAAC,aAAa,CAAC,GAAG;QACzB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type {\n Observer,\n Subscription as ObservableSubscription,\n Subscriber,\n} from \"zen-observable-ts\";\nimport { Observable } from \"zen-observable-ts\";\n\n// This simplified polyfill attempts to follow the ECMAScript Observable\n// proposal (https://github.com/zenparsing/es-observable)\nimport \"symbol-observable\";\n\nexport type { Observer, ObservableSubscription, Subscriber };\n\n// The zen-observable package defines Observable.prototype[Symbol.observable]\n// when Symbol is supported, but RxJS interop depends on also setting this fake\n// '@@observable' string as a polyfill for Symbol.observable.\nconst { prototype } = Observable;\nconst fakeObsSymbol = \"@@observable\" as keyof typeof prototype;\nif (!prototype[fakeObsSymbol]) {\n // @ts-expect-error\n prototype[fakeObsSymbol] = function () {\n return this;\n };\n}\n\nexport { Observable };\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.d.ts new file mode 100644 index 0000000..fb94970 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.d.ts @@ -0,0 +1,3 @@ +import { Observable } from "./Observable.js"; +export declare function asyncMap(observable: Observable, mapFn: (value: V) => R | PromiseLike, catchFn?: (error: any) => R | PromiseLike): Observable; +//# sourceMappingURL=asyncMap.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js b/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js new file mode 100644 index 0000000..22e6272 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js @@ -0,0 +1,44 @@ +import { Observable } from "./Observable.js"; +// Like Observable.prototype.map, except that the mapping function can +// optionally return a Promise (or be async). +export function asyncMap(observable, mapFn, catchFn) { + return new Observable(function (observer) { + var promiseQueue = { + // Normally we would initialize promiseQueue to Promise.resolve(), but + // in this case, for backwards compatibility, we need to be careful to + // invoke the first callback synchronously. + then: function (callback) { + return new Promise(function (resolve) { return resolve(callback()); }); + }, + }; + function makeCallback(examiner, key) { + return function (arg) { + if (examiner) { + var both = function () { + // If the observer is closed, we don't want to continue calling the + // mapping function - it's result will be swallowed anyways. + return observer.closed ? + /* will be swallowed */ 0 + : examiner(arg); + }; + promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); }); + } + else { + observer[key](arg); + } + }; + } + var handler = { + next: makeCallback(mapFn, "next"), + error: makeCallback(catchFn, "error"), + complete: function () { + // no need to reassign `promiseQueue`, after `observer.complete`, + // the observer will be closed and short-circuit everything anyways + /*promiseQueue = */ promiseQueue.then(function () { return observer.complete(); }); + }, + }; + var sub = observable.subscribe(handler); + return function () { return sub.unsubscribe(); }; + }); +} +//# sourceMappingURL=asyncMap.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js.map new file mode 100644 index 0000000..3404340 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/asyncMap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"asyncMap.js","sourceRoot":"","sources":["../../../src/utilities/observables/asyncMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,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E,mEAAmE;gBACnE,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,cAAM,OAAA,QAAQ,CAAC,QAAQ,EAAE,EAAnB,CAAmB,CAAC,CAAC;YACnE,CAAC;SACF,CAAC;QAEF,IAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,cAAM,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\nimport { Observable } from \"./Observable.js\";\n\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap(\n observable: Observable,\n mapFn: (value: V) => R | PromiseLike,\n catchFn?: (error: any) => R | PromiseLike\n): Observable {\n return new Observable((observer) => {\n let promiseQueue = {\n // Normally we would initialize promiseQueue to Promise.resolve(), but\n // in this case, for backwards compatibility, we need to be careful to\n // invoke the first callback synchronously.\n then(callback: () => any) {\n return new Promise((resolve) => resolve(callback()));\n },\n } as Promise;\n\n function makeCallback(\n examiner: typeof mapFn | typeof catchFn,\n key: \"next\" | \"error\"\n ): (arg: any) => void {\n return (arg) => {\n if (examiner) {\n const both = () =>\n // If the observer is closed, we don't want to continue calling the\n // mapping function - it's result will be swallowed anyways.\n observer.closed ?\n /* will be swallowed */ (0 as any)\n : examiner(arg);\n\n promiseQueue = promiseQueue.then(both, both).then(\n (result) => observer.next(result),\n (error) => observer.error(error)\n );\n } else {\n observer[key](arg);\n }\n };\n }\n\n const handler: Observer = {\n next: makeCallback(mapFn, \"next\"),\n error: makeCallback(catchFn, \"error\"),\n complete() {\n // no need to reassign `promiseQueue`, after `observer.complete`,\n // the observer will be closed and short-circuit everything anyways\n /*promiseQueue = */ promiseQueue.then(() => observer.complete());\n },\n };\n\n const sub = observable.subscribe(handler);\n return () => sub.unsubscribe();\n });\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.d.ts new file mode 100644 index 0000000..fe34bd0 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.d.ts @@ -0,0 +1,3 @@ +import type { Observer } from "./Observable.js"; +export declare function iterateObserversSafely(observers: Set>, method: keyof Observer, argument?: A): void; +//# sourceMappingURL=iteration.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js b/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js new file mode 100644 index 0000000..f2515c4 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js @@ -0,0 +1,9 @@ +export function iterateObserversSafely(observers, method, argument) { + // In case observers is modified during iteration, we need to commit to the + // original elements, which also provides an opportunity to filter them down + // to just the observers with the given method. + var observersWithMethod = []; + observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); + observersWithMethod.forEach(function (obs) { return obs[method](argument); }); +} +//# sourceMappingURL=iteration.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js.map new file mode 100644 index 0000000..468efea --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/iteration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"iteration.js","sourceRoot":"","sources":["../../../src/utilities/observables/iteration.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CACpC,SAA2B,EAC3B,MAAyB,EACzB,QAAY;IAEZ,2EAA2E;IAC3E,4EAA4E;IAC5E,+CAA+C;IAC/C,IAAM,mBAAmB,GAAkB,EAAE,CAAC;IAC9C,SAAS,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,MAAM,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAA5C,CAA4C,CAAC,CAAC;IACzE,mBAAmB,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAC,GAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAA9B,CAA8B,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import type { Observer } from \"./Observable.js\";\n\nexport function iterateObserversSafely(\n observers: Set>,\n method: keyof Observer,\n argument?: A\n) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n const observersWithMethod: Observer[] = [];\n observers.forEach((obs) => obs[method] && observersWithMethod.push(obs));\n observersWithMethod.forEach((obs) => (obs as any)[method](argument));\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.d.ts new file mode 100644 index 0000000..a68cc13 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.d.ts @@ -0,0 +1,3 @@ +import { Observable } from "./Observable.js"; +export declare function fixObservableSubclass Observable>(subclass: S): S; +//# sourceMappingURL=subclassing.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js b/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js new file mode 100644 index 0000000..0ec13a5 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js @@ -0,0 +1,27 @@ +import { Observable } from "./Observable.js"; +import { canUseSymbol } from "../common/canUse.js"; +// Generic implementations of Observable.prototype methods like map and +// filter need to know how to create a new Observable from an Observable +// subclass (like Concast or ObservableQuery). Those methods assume +// (perhaps unwisely?) that they can call the subtype's constructor with a +// Subscriber function, even though the subclass constructor might expect +// different parameters. Defining this static Symbol.species property on +// the subclass is a hint to generic Observable code to use the default +// constructor instead of trying to do `new Subclass(observer => ...)`. +export function fixObservableSubclass(subclass) { + function set(key) { + // Object.defineProperty is necessary because the Symbol.species + // property is a getter by default in modern JS environments, so we + // can't assign to it with a normal assignment expression. + Object.defineProperty(subclass, key, { value: Observable }); + } + if (canUseSymbol && Symbol.species) { + set(Symbol.species); + } + // The "@@species" string is used as a fake Symbol.species value in some + // polyfill systems (including the SymbolSpecies variable used by + // zen-observable), so we should set it as well, to be safe. + set("@@species"); + return subclass; +} +//# sourceMappingURL=subclassing.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js.map new file mode 100644 index 0000000..ce8b050 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/observables/subclassing.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subclassing.js","sourceRoot":"","sources":["../../../src/utilities/observables/subclassing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,uEAAuE;AACvE,wEAAwE;AACxE,mEAAmE;AACnE,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,uEAAuE;AACvE,MAAM,UAAU,qBAAqB,CAEnC,QAAW;IACX,SAAS,GAAG,CAAC,GAAoB;QAC/B,gEAAgE;QAChE,mEAAmE;QACnE,0DAA0D;QAC1D,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,YAAY,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IACD,wEAAwE;IACxE,iEAAiE;IACjE,4DAA4D;IAC5D,GAAG,CAAC,WAAW,CAAC,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { Observable } from \"./Observable.js\";\nimport { canUseSymbol } from \"../common/canUse.js\";\n\n// Generic implementations of Observable.prototype methods like map and\n// filter need to know how to create a new Observable from an Observable\n// subclass (like Concast or ObservableQuery). Those methods assume\n// (perhaps unwisely?) that they can call the subtype's constructor with a\n// Subscriber function, even though the subclass constructor might expect\n// different parameters. Defining this static Symbol.species property on\n// the subclass is a hint to generic Observable code to use the default\n// constructor instead of trying to do `new Subclass(observer => ...)`.\nexport function fixObservableSubclass<\n S extends new (...args: any[]) => Observable,\n>(subclass: S): S {\n function set(key: symbol | string) {\n // Object.defineProperty is necessary because the Symbol.species\n // property is a getter by default in modern JS environments, so we\n // can't assign to it with a normal assignment expression.\n Object.defineProperty(subclass, key, { value: Observable });\n }\n if (canUseSymbol && Symbol.species) {\n set(Symbol.species);\n }\n // The \"@@species\" string is used as a fake Symbol.species value in some\n // polyfill systems (including the SymbolSpecies variable used by\n // zen-observable), so we should set it as well, to be safe.\n set(\"@@species\");\n return subclass;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/package.json b/graphql-subscription/node_modules/@apollo/client/utilities/package.json new file mode 100644 index 0000000..4ada65f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/utilities", + "type": "module", + "main": "utilities.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.d.ts new file mode 100644 index 0000000..4152368 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.d.ts @@ -0,0 +1,28 @@ +import type { FieldPolicy, Reference } from "../../cache/index.js"; +type KeyArgs = FieldPolicy["keyArgs"]; +export declare function concatPagination(keyArgs?: KeyArgs): FieldPolicy; +export declare function offsetLimitPagination(keyArgs?: KeyArgs): FieldPolicy; +export type TRelayEdge = { + cursor?: string; + node: TNode; +} | (Reference & { + cursor?: string; +}); +export type TRelayPageInfo = { + hasPreviousPage: boolean; + hasNextPage: boolean; + startCursor: string; + endCursor: string; +}; +export type TExistingRelay = Readonly<{ + edges: TRelayEdge[]; + pageInfo: TRelayPageInfo; +}>; +export type TIncomingRelay = { + edges?: TRelayEdge[]; + pageInfo?: TRelayPageInfo; +}; +export type RelayFieldPolicy = FieldPolicy | null, TIncomingRelay | null, TIncomingRelay | null>; +export declare function relayStylePagination(keyArgs?: KeyArgs): RelayFieldPolicy; +export {}; +//# sourceMappingURL=pagination.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js b/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js new file mode 100644 index 0000000..e25a485 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js @@ -0,0 +1,200 @@ +import { __assign, __rest as __rest_1, __spreadArray } from "tslib"; +import { __rest } from "tslib"; +import { mergeDeep } from "../common/mergeDeep.js"; +// A very basic pagination field policy that always concatenates new +// results onto the existing array, without examining options.args. +export function concatPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming) { + return existing ? __spreadArray(__spreadArray([], existing, true), incoming, true) : incoming; + }, + }; +} +// A basic field policy that uses options.args.{offset,limit} to splice +// the incoming data into the existing array. If your arguments are called +// something different (like args.{start,count}), feel free to copy/paste +// this implementation and make the appropriate changes. +export function offsetLimitPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming, _a) { + var args = _a.args; + var merged = existing ? existing.slice(0) : []; + if (incoming) { + if (args) { + // Assume an offset of 0 if args.offset omitted. + var _b = args.offset, offset = _b === void 0 ? 0 : _b; + for (var i = 0; i < incoming.length; ++i) { + merged[offset + i] = incoming[i]; + } + } + else { + // It's unusual (probably a mistake) for a paginated field not + // to receive any arguments, so you might prefer to throw an + // exception here, instead of recovering by appending incoming + // onto the existing array. + merged.push.apply(merged, incoming); + } + } + return merged; + }, + }; +} +// As proof of the flexibility of field policies, this function generates +// one that handles Relay-style pagination, without Apollo Client knowing +// anything about connections, edges, cursors, or pageInfo objects. +export function relayStylePagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + read: function (existing, _a) { + var canRead = _a.canRead, readField = _a.readField; + if (!existing) + return existing; + var edges = []; + var firstEdgeCursor = ""; + var lastEdgeCursor = ""; + existing.edges.forEach(function (edge) { + // Edges themselves could be Reference objects, so it's important + // to use readField to access the edge.edge.node property. + if (canRead(readField("node", edge))) { + edges.push(edge); + if (edge.cursor) { + firstEdgeCursor = firstEdgeCursor || edge.cursor || ""; + lastEdgeCursor = edge.cursor || lastEdgeCursor; + } + } + }); + if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) { + firstEdgeCursor = ""; + } + var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor; + return __assign(__assign({}, getExtras(existing)), { edges: edges, pageInfo: __assign(__assign({}, existing.pageInfo), { + // If existing.pageInfo.{start,end}Cursor are undefined or "", default + // to firstEdgeCursor and/or lastEdgeCursor. + startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) }); + }, + merge: function (existing, incoming, _a) { + var args = _a.args, isReference = _a.isReference, readField = _a.readField; + if (!existing) { + existing = makeEmptyData(); + } + if (!incoming) { + return existing; + } + var incomingEdges = incoming.edges ? + incoming.edges.map(function (edge) { + if (isReference((edge = __assign({}, edge)))) { + // In case edge is a Reference, we read out its cursor field and + // store it as an extra property of the Reference object. + edge.cursor = readField("cursor", edge); + } + return edge; + }) + : []; + if (incoming.pageInfo) { + var pageInfo_1 = incoming.pageInfo; + var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor; + var firstEdge = incomingEdges[0]; + var lastEdge = incomingEdges[incomingEdges.length - 1]; + // In case we did not request the cursor field for edges in this + // query, we can still infer cursors from pageInfo. + if (firstEdge && startCursor) { + firstEdge.cursor = startCursor; + } + if (lastEdge && endCursor) { + lastEdge.cursor = endCursor; + } + // Cursors can also come from edges, so we default + // pageInfo.{start,end}Cursor to {first,last}Edge.cursor. + var firstCursor = firstEdge && firstEdge.cursor; + if (firstCursor && !startCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + startCursor: firstCursor, + }, + }); + } + var lastCursor = lastEdge && lastEdge.cursor; + if (lastCursor && !endCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + endCursor: lastCursor, + }, + }); + } + } + var prefix = existing.edges; + var suffix = []; + if (args && args.after) { + // This comparison does not need to use readField("cursor", edge), + // because we stored the cursor field of any Reference edges as an + // extra property of the Reference object. + var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; }); + if (index >= 0) { + prefix = prefix.slice(0, index + 1); + // suffix = []; // already true + } + } + else if (args && args.before) { + var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; }); + suffix = index < 0 ? prefix : prefix.slice(index); + prefix = []; + } + else if (incoming.edges) { + // If we have neither args.after nor args.before, the incoming + // edges cannot be spliced into the existing edges, so they must + // replace the existing edges. See #6592 for a motivating example. + prefix = []; + } + var edges = __spreadArray(__spreadArray(__spreadArray([], prefix, true), incomingEdges, true), suffix, true); + var pageInfo = __assign(__assign({}, incoming.pageInfo), existing.pageInfo); + if (incoming.pageInfo) { + var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = __rest_1(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]); + // If incoming.pageInfo had any extra non-standard properties, + // assume they should take precedence over any existing properties + // of the same name, regardless of where this page falls with + // respect to the existing data. + Object.assign(pageInfo, extras); + // Keep existing.pageInfo.has{Previous,Next}Page unless the + // placement of the incoming edges means incoming.hasPreviousPage + // or incoming.hasNextPage should become the new values for those + // properties in existing.pageInfo. Note that these updates are + // only permitted when the beginning or end of the incoming page + // coincides with the beginning or end of the existing data, as + // determined using prefix.length and suffix.length. + if (!prefix.length) { + if (void 0 !== hasPreviousPage) + pageInfo.hasPreviousPage = hasPreviousPage; + if (void 0 !== startCursor) + pageInfo.startCursor = startCursor; + } + if (!suffix.length) { + if (void 0 !== hasNextPage) + pageInfo.hasNextPage = hasNextPage; + if (void 0 !== endCursor) + pageInfo.endCursor = endCursor; + } + } + return __assign(__assign(__assign({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo }); + }, + }; +} +// Returns any unrecognized properties of the given object. +var getExtras = function (obj) { return __rest(obj, notExtras); }; +var notExtras = ["edges", "pageInfo"]; +function makeEmptyData() { + return { + edges: [], + pageInfo: { + hasPreviousPage: false, + hasNextPage: true, + startCursor: "", + endCursor: "", + }, + }; +} +//# sourceMappingURL=pagination.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js.map new file mode 100644 index 0000000..a64636a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/policies/pagination.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/utilities/policies/pagination.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,oEAAoE;AACpE,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAC9B,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ;YACtB,OAAO,QAAQ,CAAC,CAAC,iCAAK,QAAQ,SAAK,QAAQ,QAAE,CAAC,CAAC,QAAQ,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,wDAAwD;AACxD,MAAM,UAAU,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AO,EAAE,UAAU,CAAC,CAAC;AAExC,SAAS,aAAa;IACpB,OAAO;QACL,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;SACd;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { __rest } from \"tslib\";\n\nimport type { FieldPolicy, Reference } from \"../../cache/index.js\";\nimport { mergeDeep } from \"../common/mergeDeep.js\";\n\ntype KeyArgs = FieldPolicy[\"keyArgs\"];\n\n// A very basic pagination field policy that always concatenates new\n// results onto the existing array, without examining options.args.\nexport function concatPagination(\n keyArgs: KeyArgs = false\n): FieldPolicy {\n return {\n keyArgs,\n merge(existing, incoming) {\n return existing ? [...existing, ...incoming] : incoming;\n },\n };\n}\n\n// A basic field policy that uses options.args.{offset,limit} to splice\n// the incoming data into the existing array. If your arguments are called\n// something different (like args.{start,count}), feel free to copy/paste\n// this implementation and make the appropriate changes.\nexport function offsetLimitPagination(\n keyArgs: KeyArgs = false\n): FieldPolicy {\n return {\n keyArgs,\n merge(existing, incoming, { args }) {\n const merged = existing ? existing.slice(0) : [];\n\n if (incoming) {\n if (args) {\n // Assume an offset of 0 if args.offset omitted.\n const { offset = 0 } = args;\n for (let i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n } else {\n // It's unusual (probably a mistake) for a paginated field not\n // to receive any arguments, so you might prefer to throw an\n // exception here, instead of recovering by appending incoming\n // onto the existing array.\n merged.push(...incoming);\n }\n }\n\n return merged;\n },\n };\n}\n\n// Whether TRelayEdge is a normalized Reference or a non-normalized\n// object, it needs a .cursor property where the relayStylePagination\n// merge function can store cursor strings taken from pageInfo. Storing an\n// extra reference.cursor property should be safe, and is easier than\n// attempting to update the cursor field of the normalized StoreObject\n// that the reference refers to, or managing edge wrapper objects\n// (something I attempted in #7023, but abandoned because of #7088).\nexport type TRelayEdge =\n | {\n cursor?: string;\n node: TNode;\n }\n | (Reference & { cursor?: string });\n\nexport type TRelayPageInfo = {\n hasPreviousPage: boolean;\n hasNextPage: boolean;\n startCursor: string;\n endCursor: string;\n};\n\nexport type TExistingRelay = Readonly<{\n edges: TRelayEdge[];\n pageInfo: TRelayPageInfo;\n}>;\n\nexport type TIncomingRelay = {\n edges?: TRelayEdge[];\n pageInfo?: TRelayPageInfo;\n};\n\nexport type RelayFieldPolicy = FieldPolicy<\n TExistingRelay | null,\n TIncomingRelay | null,\n TIncomingRelay | null\n>;\n\n// As proof of the flexibility of field policies, this function generates\n// one that handles Relay-style pagination, without Apollo Client knowing\n// anything about connections, edges, cursors, or pageInfo objects.\nexport function relayStylePagination(\n keyArgs: KeyArgs = false\n): RelayFieldPolicy {\n return {\n keyArgs,\n\n read(existing, { canRead, readField }) {\n if (!existing) return existing;\n\n const edges: TRelayEdge[] = [];\n let firstEdgeCursor = \"\";\n let lastEdgeCursor = \"\";\n existing.edges.forEach((edge) => {\n // Edges themselves could be Reference objects, so it's important\n // to use readField to access the edge.edge.node property.\n if (canRead(readField(\"node\", edge))) {\n edges.push(edge);\n if (edge.cursor) {\n firstEdgeCursor = firstEdgeCursor || edge.cursor || \"\";\n lastEdgeCursor = edge.cursor || lastEdgeCursor;\n }\n }\n });\n\n if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) {\n firstEdgeCursor = \"\";\n }\n\n const { startCursor, endCursor } = existing.pageInfo || {};\n\n return {\n // Some implementations return additional Connection fields, such\n // as existing.totalCount. These fields are saved by the merge\n // function, so the read function should also preserve them.\n ...getExtras(existing),\n edges,\n pageInfo: {\n ...existing.pageInfo,\n // If existing.pageInfo.{start,end}Cursor are undefined or \"\", default\n // to firstEdgeCursor and/or lastEdgeCursor.\n startCursor: startCursor || firstEdgeCursor,\n endCursor: endCursor || lastEdgeCursor,\n },\n };\n },\n\n merge(existing, incoming, { args, isReference, readField }) {\n if (!existing) {\n existing = makeEmptyData();\n }\n\n if (!incoming) {\n return existing;\n }\n\n const incomingEdges =\n incoming.edges ?\n incoming.edges.map((edge) => {\n if (isReference((edge = { ...edge }))) {\n // In case edge is a Reference, we read out its cursor field and\n // store it as an extra property of the Reference object.\n edge.cursor = readField(\"cursor\", edge);\n }\n return edge;\n })\n : [];\n\n if (incoming.pageInfo) {\n const { pageInfo } = incoming;\n const { startCursor, endCursor } = pageInfo;\n const firstEdge = incomingEdges[0];\n const lastEdge = incomingEdges[incomingEdges.length - 1];\n // In case we did not request the cursor field for edges in this\n // query, we can still infer cursors from pageInfo.\n if (firstEdge && startCursor) {\n firstEdge.cursor = startCursor;\n }\n if (lastEdge && endCursor) {\n lastEdge.cursor = endCursor;\n }\n // Cursors can also come from edges, so we default\n // pageInfo.{start,end}Cursor to {first,last}Edge.cursor.\n const firstCursor = firstEdge && firstEdge.cursor;\n if (firstCursor && !startCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n startCursor: firstCursor,\n },\n });\n }\n const lastCursor = lastEdge && lastEdge.cursor;\n if (lastCursor && !endCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n endCursor: lastCursor,\n },\n });\n }\n }\n\n let prefix = existing.edges;\n let suffix: typeof prefix = [];\n\n if (args && args.after) {\n // This comparison does not need to use readField(\"cursor\", edge),\n // because we stored the cursor field of any Reference edges as an\n // extra property of the Reference object.\n const index = prefix.findIndex((edge) => edge.cursor === args.after);\n if (index >= 0) {\n prefix = prefix.slice(0, index + 1);\n // suffix = []; // already true\n }\n } else if (args && args.before) {\n const index = prefix.findIndex((edge) => edge.cursor === args.before);\n suffix = index < 0 ? prefix : prefix.slice(index);\n prefix = [];\n } else if (incoming.edges) {\n // If we have neither args.after nor args.before, the incoming\n // edges cannot be spliced into the existing edges, so they must\n // replace the existing edges. See #6592 for a motivating example.\n prefix = [];\n }\n\n const edges = [...prefix, ...incomingEdges, ...suffix];\n\n const pageInfo: TRelayPageInfo = {\n // The ordering of these two ...spreads may be surprising, but it\n // makes sense because we want to combine PageInfo properties with a\n // preference for existing values, *unless* the existing values are\n // overridden by the logic below, which is permitted only when the\n // incoming page falls at the beginning or end of the data.\n ...incoming.pageInfo,\n ...existing.pageInfo,\n };\n\n if (incoming.pageInfo) {\n const {\n hasPreviousPage,\n hasNextPage,\n startCursor,\n endCursor,\n ...extras\n } = incoming.pageInfo;\n\n // If incoming.pageInfo had any extra non-standard properties,\n // assume they should take precedence over any existing properties\n // of the same name, regardless of where this page falls with\n // respect to the existing data.\n Object.assign(pageInfo, extras);\n\n // Keep existing.pageInfo.has{Previous,Next}Page unless the\n // placement of the incoming edges means incoming.hasPreviousPage\n // or incoming.hasNextPage should become the new values for those\n // properties in existing.pageInfo. Note that these updates are\n // only permitted when the beginning or end of the incoming page\n // coincides with the beginning or end of the existing data, as\n // determined using prefix.length and suffix.length.\n if (!prefix.length) {\n if (void 0 !== hasPreviousPage)\n pageInfo.hasPreviousPage = hasPreviousPage;\n if (void 0 !== startCursor) pageInfo.startCursor = startCursor;\n }\n if (!suffix.length) {\n if (void 0 !== hasNextPage) pageInfo.hasNextPage = hasNextPage;\n if (void 0 !== endCursor) pageInfo.endCursor = endCursor;\n }\n }\n\n return {\n ...getExtras(existing),\n ...getExtras(incoming),\n edges,\n pageInfo,\n };\n },\n };\n}\n\n// Returns any unrecognized properties of the given object.\nconst getExtras = (obj: Record) => __rest(obj, notExtras);\nconst notExtras = [\"edges\", \"pageInfo\"];\n\nfunction makeEmptyData(): TExistingRelay {\n return {\n edges: [],\n pageInfo: {\n hasPreviousPage: false,\n hasNextPage: true,\n startCursor: \"\",\n endCursor: \"\",\n },\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.d.ts new file mode 100644 index 0000000..ad61305 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.d.ts @@ -0,0 +1,17 @@ +export interface PendingPromise extends Promise { + status: "pending"; +} +export interface FulfilledPromise extends Promise { + status: "fulfilled"; + value: TValue; +} +export interface RejectedPromise extends Promise { + status: "rejected"; + reason: unknown; +} +export type PromiseWithState = PendingPromise | FulfilledPromise | RejectedPromise; +export declare function createFulfilledPromise(value: TValue): FulfilledPromise; +export declare function createRejectedPromise(reason: unknown): RejectedPromise; +export declare function isStatefulPromise(promise: Promise): promise is PromiseWithState; +export declare function wrapPromiseWithState(promise: Promise): PromiseWithState; +//# sourceMappingURL=decoration.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js b/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js new file mode 100644 index 0000000..392b09d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js @@ -0,0 +1,39 @@ +export function createFulfilledPromise(value) { + var promise = Promise.resolve(value); + promise.status = "fulfilled"; + promise.value = value; + return promise; +} +export function createRejectedPromise(reason) { + var promise = Promise.reject(reason); + // prevent potential edge cases leaking unhandled error rejections + promise.catch(function () { }); + promise.status = "rejected"; + promise.reason = reason; + return promise; +} +export function isStatefulPromise(promise) { + return "status" in promise; +} +export function wrapPromiseWithState(promise) { + if (isStatefulPromise(promise)) { + return promise; + } + var pendingPromise = promise; + pendingPromise.status = "pending"; + pendingPromise.then(function (value) { + if (pendingPromise.status === "pending") { + var fulfilledPromise = pendingPromise; + fulfilledPromise.status = "fulfilled"; + fulfilledPromise.value = value; + } + }, function (reason) { + if (pendingPromise.status === "pending") { + var rejectedPromise = pendingPromise; + rejectedPromise.status = "rejected"; + rejectedPromise.reason = reason; + } + }); + return promise; +} +//# sourceMappingURL=decoration.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js.map new file mode 100644 index 0000000..fb7eeee --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/promises/decoration.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decoration.js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YAEvD,eAAe,CAAC,MAAM,GAAG,UAAU,CAAC;YACpC,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;QAClC,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,OAAmC,CAAC;AAC7C,CAAC","sourcesContent":["export interface PendingPromise extends Promise {\n status: \"pending\";\n}\n\nexport interface FulfilledPromise extends Promise {\n status: \"fulfilled\";\n value: TValue;\n}\n\nexport interface RejectedPromise extends Promise {\n status: \"rejected\";\n reason: unknown;\n}\n\nexport type PromiseWithState =\n | PendingPromise\n | FulfilledPromise\n | RejectedPromise;\n\nexport function createFulfilledPromise(value: TValue) {\n const promise = Promise.resolve(value) as FulfilledPromise;\n\n promise.status = \"fulfilled\";\n promise.value = value;\n\n return promise;\n}\n\nexport function createRejectedPromise(reason: unknown) {\n const promise = Promise.reject(reason) as RejectedPromise;\n\n // prevent potential edge cases leaking unhandled error rejections\n promise.catch(() => {});\n\n promise.status = \"rejected\";\n promise.reason = reason;\n\n return promise;\n}\n\nexport function isStatefulPromise(\n promise: Promise\n): promise is PromiseWithState {\n return \"status\" in promise;\n}\n\nexport function wrapPromiseWithState(\n promise: Promise\n): PromiseWithState {\n if (isStatefulPromise(promise)) {\n return promise;\n }\n\n const pendingPromise = promise as PendingPromise;\n pendingPromise.status = \"pending\";\n\n pendingPromise.then(\n (value) => {\n if (pendingPromise.status === \"pending\") {\n const fulfilledPromise =\n pendingPromise as unknown as FulfilledPromise;\n\n fulfilledPromise.status = \"fulfilled\";\n fulfilledPromise.value = value;\n }\n },\n (reason: unknown) => {\n if (pendingPromise.status === \"pending\") {\n const rejectedPromise =\n pendingPromise as unknown as RejectedPromise;\n\n rejectedPromise.status = \"rejected\";\n rejectedPromise.reason = reason;\n }\n }\n );\n\n return promise as PromiseWithState;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.d.ts new file mode 100644 index 0000000..2da0cac --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.d.ts @@ -0,0 +1,6 @@ +import { Observable } from "relay-runtime"; +import type { RequestParameters, GraphQLResponse } from "relay-runtime"; +import type { OperationVariables } from "../../../core/index.js"; +import type { CreateMultipartSubscriptionOptions } from "../shared.js"; +export declare function createFetchMultipartSubscription(uri: string, { fetch: preferredFetch, headers }?: CreateMultipartSubscriptionOptions): (operation: RequestParameters, variables: OperationVariables) => Observable; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js new file mode 100644 index 0000000..9fbb409 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js @@ -0,0 +1,43 @@ +import { Observable } from "relay-runtime"; +import { handleError, readMultipartBody, } from "../../../link/http/parseAndCheckHttpResponse.js"; +import { maybe } from "../../index.js"; +import { serializeFetchParameter } from "../../../core/index.js"; +import { generateOptionsForMultipartSubscription } from "../shared.js"; +var backupFetch = maybe(function () { return fetch; }); +export function createFetchMultipartSubscription(uri, _a) { + var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers; + return function fetchMultipartSubscription(operation, variables) { + var body = { + operationName: operation.name, + variables: variables, + query: operation.text || "", + }; + var options = generateOptionsForMultipartSubscription(headers || {}); + return Observable.create(function (sink) { + try { + options.body = serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + sink.error(parseError); + } + var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch; + var observerNext = sink.next.bind(sink); + currentFetch(uri, options) + .then(function (response) { + var _a; + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + sink.error(new Error("Expected multipart response")); + }) + .then(function () { + sink.complete(); + }) + .catch(function (err) { + handleError(err, sink); + }); + }); + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js.map new file mode 100644 index 0000000..f6754ed --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/subscriptions/relay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAIjE,OAAO,EAAE,uCAAuC,EAAE,MAAM,cAAc,CAAC;AAGvE,IAAM,WAAW,GAAG,KAAK,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC;AAEvC,MAAM,UAAU,gCAAgC,CAC9C,GAAW,EACX,EAA2E;QAA3E,qBAAyE,EAAE,KAAA,EAAlE,cAAc,WAAA,EAAE,OAAO,aAAA;IAEhC,OAAO,SAAS,0BAA0B,CACxC,SAA4B,EAC5B,SAA6B;QAE7B,IAAM,IAAI,GAAS;YACjB,aAAa,EAAE,SAAS,CAAC,IAAI;YAC7B,SAAS,WAAA;YACT,KAAK,EAAE,SAAS,CAAC,IAAI,IAAI,EAAE;SAC5B,CAAC;QACF,IAAM,OAAO,GAAG,uCAAuC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAEvE,OAAO,UAAU,CAAC,MAAM,CAAC,UAAC,IAAI;YAC5B,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,GAAG,uBAAuB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC1D,CAAC;YAAC,OAAO,UAAU,EAAE,CAAC;gBACpB,IAAI,CAAC,KAAK,CAAC,UAAmB,CAAC,CAAC;YAClC,CAAC;YAED,IAAM,YAAY,GAAG,cAAc,IAAI,KAAK,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,IAAI,WAAW,CAAC;YACzE,IAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE1C,YAAa,CAAC,GAAG,EAAE,OAAO,CAAC;iBACxB,IAAI,CAAC,UAAC,QAAQ;;gBACb,IAAM,KAAK,GAAG,MAAA,QAAQ,CAAC,OAAO,0CAAE,GAAG,CAAC,cAAc,CAAC,CAAC;gBAEpD,IAAI,KAAK,KAAK,IAAI,IAAI,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBACvD,OAAO,iBAAiB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;gBACnD,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;YACvD,CAAC,CAAC;iBACD,IAAI,CAAC;gBACJ,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,CAAC,CAAC;iBACD,KAAK,CAAC,UAAC,GAAQ;gBACd,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Observable } from \"relay-runtime\";\nimport type { RequestParameters, GraphQLResponse } from \"relay-runtime\";\nimport {\n handleError,\n readMultipartBody,\n} from \"../../../link/http/parseAndCheckHttpResponse.js\";\nimport { maybe } from \"../../index.js\";\nimport { serializeFetchParameter } from \"../../../core/index.js\";\n\nimport type { OperationVariables } from \"../../../core/index.js\";\nimport type { Body } from \"../../../link/http/selectHttpOptionsAndBody.js\";\nimport { generateOptionsForMultipartSubscription } from \"../shared.js\";\nimport type { CreateMultipartSubscriptionOptions } from \"../shared.js\";\n\nconst backupFetch = maybe(() => fetch);\n\nexport function createFetchMultipartSubscription(\n uri: string,\n { fetch: preferredFetch, headers }: CreateMultipartSubscriptionOptions = {}\n) {\n return function fetchMultipartSubscription(\n operation: RequestParameters,\n variables: OperationVariables\n ): Observable {\n const body: Body = {\n operationName: operation.name,\n variables,\n query: operation.text || \"\",\n };\n const options = generateOptionsForMultipartSubscription(headers || {});\n\n return Observable.create((sink) => {\n try {\n options.body = serializeFetchParameter(body, \"Payload\");\n } catch (parseError) {\n sink.error(parseError as Error);\n }\n\n const currentFetch = preferredFetch || maybe(() => fetch) || backupFetch;\n const observerNext = sink.next.bind(sink);\n\n currentFetch!(uri, options)\n .then((response) => {\n const ctype = response.headers?.get(\"content-type\");\n\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n }\n\n sink.error(new Error(\"Expected multipart response\"));\n })\n .then(() => {\n sink.complete();\n })\n .catch((err: any) => {\n handleError(err, sink);\n });\n });\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/package.json b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/package.json new file mode 100644 index 0000000..5afc6db --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/utilities/subscriptions/relay", + "type": "module", + "main": "relay.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs new file mode 100644 index 0000000..e8398d2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs @@ -0,0 +1,369 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var relayRuntime = require('relay-runtime'); +var tslib = require('tslib'); +var utilities = require('../..'); +var utils = require('../../../link/utils'); +var errors = require('../../../errors'); +var core = require('../../../core'); + +function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} + +function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(utilities.canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} + +function readMultipartBody(response, nextValue) { + var _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 , 3]; + return [4 , iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = tslib.__assign({}, result.payload); + } + if ("errors" in result) { + next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + nextValue(result); + } + } + else if ( + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 ]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 , 1]; + case 3: return [2 ]; + } + }); + }); +} +function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +function handleError(err, observer) { + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); +} + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + accept: "*/*", + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; + +function generateOptionsForMultipartSubscription(headers) { + var options = tslib.__assign(tslib.__assign({}, fallbackHttpConfig.options), { headers: tslib.__assign(tslib.__assign(tslib.__assign({}, (headers || {})), fallbackHttpConfig.headers), { accept: "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json" }) }); + return options; +} + +var backupFetch = utilities.maybe(function () { return fetch; }); +function createFetchMultipartSubscription(uri, _a) { + var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers; + return function fetchMultipartSubscription(operation, variables) { + var body = { + operationName: operation.name, + variables: variables, + query: operation.text || "", + }; + var options = generateOptionsForMultipartSubscription(headers || {}); + return relayRuntime.Observable.create(function (sink) { + try { + options.body = core.serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + sink.error(parseError); + } + var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch; + var observerNext = sink.next.bind(sink); + currentFetch(uri, options) + .then(function (response) { + var _a; + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + sink.error(new Error("Expected multipart response")); + }) + .then(function () { + sink.complete(); + }) + .catch(function (err) { + handleError(err, sink); + }); + }); + }; +} + +exports.createFetchMultipartSubscription = createFetchMultipartSubscription; +//# sourceMappingURL=relay.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.map b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.map new file mode 100644 index 0000000..7c299b6 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"relay.cjs","sources":["../../../link/http/iterators/async.js","../../../link/http/iterators/nodeStream.js","../../../link/http/iterators/promise.js","../../../link/http/iterators/reader.js","../../../link/http/responseIterator.js","../../common/objects.js","../../common/incrementalResult.js","../../../link/http/parseAndCheckHttpResponse.js","../../../link/http/selectHttpOptionsAndBody.js","../shared.js","index.js"],"sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts\n */\nexport default function asyncIterator(source) {\n var _a;\n var iterator = source[Symbol.asyncIterator]();\n return _a = {\n next: function () {\n return iterator.next();\n }\n },\n _a[Symbol.asyncIterator] = function () {\n return this;\n },\n _a;\n}\n//# sourceMappingURL=async.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function nodeStreamIterator(stream) {\n var cleanup = null;\n var error = null;\n var done = false;\n var data = [];\n var waiting = [];\n function onData(chunk) {\n if (error)\n return;\n if (waiting.length) {\n var shiftedArr = waiting.shift();\n if (Array.isArray(shiftedArr) && shiftedArr[0]) {\n return shiftedArr[0]({ value: chunk, done: false });\n }\n }\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n cleanup = function () {\n cleanup = null;\n stream.removeListener(\"data\", onData);\n stream.removeListener(\"error\", onError);\n stream.removeListener(\"end\", onEnd);\n stream.removeListener(\"finish\", onEnd);\n stream.removeListener(\"close\", onEnd);\n };\n stream.on(\"data\", onData);\n stream.on(\"error\", onError);\n stream.on(\"end\", onEnd);\n stream.on(\"finish\", onEnd);\n stream.on(\"close\", onEnd);\n function getNext() {\n return new Promise(function (resolve, reject) {\n if (error)\n return reject(error);\n if (data.length)\n return resolve({ value: data.shift(), done: false });\n if (done)\n return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n var iterator = {\n next: function () {\n return getNext();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=nodeStream.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function promiseIterator(promise) {\n var resolved = false;\n var iterator = {\n next: function () {\n if (resolved)\n return Promise.resolve({\n value: undefined,\n done: true,\n });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value: value, done: false });\n })\n .catch(reject);\n });\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=promise.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function readerIterator(reader) {\n var iterator = {\n next: function () {\n return reader.read();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=reader.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../utilities/index.js\";\nimport asyncIterator from \"./iterators/async.js\";\nimport nodeStreamIterator from \"./iterators/nodeStream.js\";\nimport promiseIterator from \"./iterators/promise.js\";\nimport readerIterator from \"./iterators/reader.js\";\nfunction isNodeResponse(value) {\n return !!value.body;\n}\nfunction isReadableStream(value) {\n return !!value.getReader;\n}\nfunction isAsyncIterableIterator(value) {\n return !!(canUseAsyncIteratorSymbol &&\n value[Symbol.asyncIterator]);\n}\nfunction isStreamableBlob(value) {\n return !!value.stream;\n}\nfunction isBlob(value) {\n return !!value.arrayBuffer;\n}\nfunction isNodeReadableStream(value) {\n return !!value.pipe;\n}\nexport function responseIterator(response) {\n var body = response;\n if (isNodeResponse(response))\n body = response.body;\n if (isAsyncIterableIterator(body))\n return asyncIterator(body);\n if (isReadableStream(body))\n return readerIterator(body.getReader());\n // this errors without casting to ReadableStream\n // because Blob.stream() returns a NodeJS ReadableStream\n if (isStreamableBlob(body)) {\n return readerIterator(body.stream().getReader());\n }\n if (isBlob(body))\n return promiseIterator(body.arrayBuffer());\n if (isNodeReadableStream(body))\n return nodeStreamIterator(body);\n throw new Error(\"Unknown body type for responseIterator. Please pass a streamable response.\");\n}\n//# sourceMappingURL=responseIterator.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === \"object\";\n}\nexport function isPlainObject(obj) {\n return (obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null));\n}\n//# sourceMappingURL=objects.js.map","import { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\nexport function isExecutionPatchIncrementalResult(value) {\n return \"incremental\" in value;\n}\nexport function isExecutionPatchInitialResult(value) {\n return \"hasNext\" in value && \"data\" in value;\n}\nexport function isExecutionPatchResult(value) {\n return (isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value));\n}\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(value) {\n return isNonNullObject(value) && \"payload\" in value;\n}\nexport function mergeIncrementalData(prevResult, result) {\n var mergedData = prevResult;\n var merger = new DeepMerger();\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (_a) {\n var data = _a.data, path = _a.path;\n for (var i = path.length - 1; i >= 0; --i) {\n var key = path[i];\n var isNumericKey = !isNaN(+key);\n var parent_1 = isNumericKey ? [] : {};\n parent_1[key] = data;\n data = parent_1;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData;\n}\n//# sourceMappingURL=incrementalResult.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { responseIterator } from \"./responseIterator.js\";\nimport { throwServerError } from \"../utils/index.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../../errors/index.js\";\nimport { isApolloPayloadResult } from \"../../utilities/common/incrementalResult.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function readMultipartBody(response, nextValue) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n if (TextDecoder === undefined) {\n throw new Error(\"TextDecoder must be defined in the environment: please import a polyfill.\");\n }\n decoder = new TextDecoder(\"utf-8\");\n contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n delimiter = \"boundary=\";\n boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?\n contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['\"]/g, \"\").replace(/\\;(.*)/gm, \"\").trim()\n : \"-\";\n boundary = \"\\r\\n--\".concat(boundaryVal);\n buffer = \"\";\n iterator = responseIterator(response);\n running = true;\n _e.label = 1;\n case 1:\n if (!running) return [3 /*break*/, 3];\n return [4 /*yield*/, iterator.next()];\n case 2:\n _b = _e.sent(), value = _b.value, done = _b.done;\n chunk = typeof value === \"string\" ? value : decoder.decode(value);\n searchFrom = buffer.length - boundary.length + 1;\n running = !done;\n buffer += chunk;\n bi = buffer.indexOf(boundary, searchFrom);\n while (bi > -1) {\n message = void 0;\n _c = [\n buffer.slice(0, bi),\n buffer.slice(bi + boundary.length),\n ], message = _c[0], buffer = _c[1];\n i = message.indexOf(\"\\r\\n\\r\\n\");\n headers = parseHeaders(message.slice(0, i));\n contentType_1 = headers[\"content-type\"];\n if (contentType_1 &&\n contentType_1.toLowerCase().indexOf(\"application/json\") === -1) {\n throw new Error(\"Unsupported patch content type: application/json is required.\");\n }\n body = message.slice(i);\n if (body) {\n result = parseJsonBody(response, body);\n if (Object.keys(result).length > 1 ||\n \"data\" in result ||\n \"incremental\" in result ||\n \"errors\" in result ||\n \"payload\" in result) {\n if (isApolloPayloadResult(result)) {\n next = {};\n if (\"payload\" in result) {\n next = __assign({}, result.payload);\n }\n if (\"errors\" in result) {\n next = __assign(__assign({}, next), { extensions: __assign(__assign({}, (\"extensions\" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });\n }\n nextValue(next);\n }\n else {\n // for the last chunk with only `hasNext: false`\n // we don't need to call observer.next as there is no data/errors\n nextValue(result);\n }\n }\n else if (\n // If the chunk contains only a \"hasNext: false\", we can call\n // observer.complete() immediately.\n Object.keys(result).length === 1 &&\n \"hasNext\" in result &&\n !result.hasNext) {\n return [2 /*return*/];\n }\n }\n bi = buffer.indexOf(boundary);\n }\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/];\n }\n });\n });\n}\nexport function parseHeaders(headerText) {\n var headersInit = {};\n headerText.split(\"\\n\").forEach(function (line) {\n var i = line.indexOf(\":\");\n if (i > -1) {\n // normalize headers to lowercase\n var name_1 = line.slice(0, i).trim().toLowerCase();\n var value = line.slice(i + 1).trim();\n headersInit[name_1] = value;\n }\n });\n return headersInit;\n}\nexport function parseJsonBody(response, bodyText) {\n if (response.status >= 300) {\n // Network error\n var getResult = function () {\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n return bodyText;\n }\n };\n throwServerError(response, getResult(), \"Response not successful: Received status code \".concat(response.status));\n }\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n var parseError = err;\n parseError.name = \"ServerParseError\";\n parseError.response = response;\n parseError.statusCode = response.status;\n parseError.bodyText = bodyText;\n throw parseError;\n }\n}\nexport function handleError(err, observer) {\n // if it is a network error, BUT there is graphql result info fire\n // the next observer before calling error this gives apollo-client\n // (and react-apollo) the `graphqlErrors` and `networkErrors` to\n // pass to UI this should only happen if we *also* have data as\n // part of the response key per the spec\n if (err.result && err.result.errors && err.result.data) {\n // if we don't call next, the UI can only show networkError\n // because AC didn't get any graphqlErrors this is graphql\n // execution result info (i.e errors and possibly data) this is\n // because there is no formal spec how errors should translate to\n // http status codes. So an auth error (401) could have both data\n // from a public field, errors from a private field, and a status\n // of 401\n // {\n // user { // this will have errors\n // firstName\n // }\n // products { // this is public so will have data\n // cost\n // }\n // }\n //\n // the result of above *could* look like this:\n // {\n // data: { products: [{ cost: \"$10\" }] },\n // errors: [{\n // message: 'your session has timed out',\n // path: []\n // }]\n // }\n // status code of above would be a 401\n // in the UI you want to show data where you can, errors as data where you can\n // and use correct http status codes\n observer.next(err.result);\n }\n observer.error(err);\n}\nexport function parseAndCheckHttpResponse(operations) {\n return function (response) {\n return response\n .text()\n .then(function (bodyText) { return parseJsonBody(response, bodyText); })\n .then(function (result) {\n if (!Array.isArray(result) &&\n !hasOwnProperty.call(result, \"data\") &&\n !hasOwnProperty.call(result, \"errors\")) {\n // Data error\n throwServerError(response, result, \"Server response was missing for query '\".concat(Array.isArray(operations) ?\n operations.map(function (op) { return op.operationName; })\n : operations.operationName, \"'.\"));\n }\n return result;\n });\n };\n}\n//# sourceMappingURL=parseAndCheckHttpResponse.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { print } from \"../../utilities/index.js\";\nvar defaultHttpOptions = {\n includeQuery: true,\n includeExtensions: false,\n preserveHeaderCase: false,\n};\nvar defaultHeaders = {\n // headers are case insensitive (https://stackoverflow.com/a/5259004)\n accept: \"*/*\",\n // The content-type header describes the type of the body of the request, and\n // so it typically only is sent with requests that actually have bodies. One\n // could imagine that Apollo Client would remove this header when constructing\n // a GET request (which has no body), but we historically have not done that.\n // This means that browsers will preflight all Apollo Client requests (even\n // GET requests). Apollo Server's CSRF prevention feature (introduced in\n // AS3.7) takes advantage of this fact and does not block requests with this\n // header. If you want to drop this header from GET requests, then you should\n // probably replace it with a `apollo-require-preflight` header, or servers\n // with CSRF prevention enabled might block your GET request. See\n // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf\n // for more details.\n \"content-type\": \"application/json\",\n};\nvar defaultOptions = {\n method: \"POST\",\n};\nexport var fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\nexport var defaultPrinter = function (ast, printer) { return printer(ast); };\nexport function selectHttpOptionsAndBody(operation, fallbackConfig) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal.apply(void 0, __spreadArray([operation,\n defaultPrinter], configs, false));\n}\nexport function selectHttpOptionsAndBodyInternal(operation, printer) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n var options = {};\n var http = {};\n configs.forEach(function (config) {\n options = __assign(__assign(__assign({}, options), config.options), { headers: __assign(__assign({}, options.headers), config.headers) });\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n http = __assign(__assign({}, http), config.http);\n });\n if (options.headers) {\n options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);\n }\n //The body depends on the http options\n var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;\n var body = { operationName: operationName, variables: variables };\n if (http.includeExtensions)\n body.extensions = extensions;\n // not sending the query (i.e persisted queries)\n if (http.includeQuery)\n body.query = printer(query, print);\n return {\n options: options,\n body: body,\n };\n}\n// Remove potential duplicate header names, preserving last (by insertion order).\n// This is done to prevent unintentionally duplicating a header instead of\n// overwriting it (See #8447 and #8449).\nfunction removeDuplicateHeaders(headers, preserveHeaderCase) {\n // If we're not preserving the case, just remove duplicates w/ normalization.\n if (!preserveHeaderCase) {\n var normalizedHeaders_1 = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n normalizedHeaders_1[name.toLowerCase()] = headers[name];\n });\n return normalizedHeaders_1;\n }\n // If we are preserving the case, remove duplicates w/ normalization,\n // preserving the original name.\n // This allows for non-http-spec-compliant servers that expect intentionally\n // capitalized header names (See #6741).\n var headerData = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n headerData[name.toLowerCase()] = {\n originalName: name,\n value: headers[name],\n };\n });\n var normalizedHeaders = Object.create(null);\n Object.keys(headerData).forEach(function (name) {\n normalizedHeaders[headerData[name].originalName] = headerData[name].value;\n });\n return normalizedHeaders;\n}\n//# sourceMappingURL=selectHttpOptionsAndBody.js.map","import { __assign } from \"tslib\";\nimport { fallbackHttpConfig } from \"../../link/http/selectHttpOptionsAndBody.js\";\nexport function generateOptionsForMultipartSubscription(headers) {\n var options = __assign(__assign({}, fallbackHttpConfig.options), { headers: __assign(__assign(__assign({}, (headers || {})), fallbackHttpConfig.headers), { accept: \"multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json\" }) });\n return options;\n}\n//# sourceMappingURL=shared.js.map","import { Observable } from \"relay-runtime\";\nimport { handleError, readMultipartBody, } from \"../../../link/http/parseAndCheckHttpResponse.js\";\nimport { maybe } from \"../../index.js\";\nimport { serializeFetchParameter } from \"../../../core/index.js\";\nimport { generateOptionsForMultipartSubscription } from \"../shared.js\";\nvar backupFetch = maybe(function () { return fetch; });\nexport function createFetchMultipartSubscription(uri, _a) {\n var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers;\n return function fetchMultipartSubscription(operation, variables) {\n var body = {\n operationName: operation.name,\n variables: variables,\n query: operation.text || \"\",\n };\n var options = generateOptionsForMultipartSubscription(headers || {});\n return Observable.create(function (sink) {\n try {\n options.body = serializeFetchParameter(body, \"Payload\");\n }\n catch (parseError) {\n sink.error(parseError);\n }\n var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch;\n var observerNext = sink.next.bind(sink);\n currentFetch(uri, options)\n .then(function (response) {\n var _a;\n var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n }\n sink.error(new Error(\"Expected multipart response\"));\n })\n .then(function () {\n sink.complete();\n })\n .catch(function (err) {\n handleError(err, sink);\n });\n });\n };\n}\n//# sourceMappingURL=index.js.map"],"names":["canUseAsyncIteratorSymbol","__awaiter","__generator","__assign","PROTOCOL_ERRORS_SYMBOL","throwServerError","maybe","Observable","serializeFetchParameter"],"mappings":";;;;;;;;;;;AAIe,SAAS,aAAa,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;AAClD,IAAI,OAAO,EAAE,GAAG;AAChB,YAAY,IAAI,EAAE,YAAY;AAC9B,gBAAgB,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACvC,aAAa;AACb,SAAS;AACT,QAAQ,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,YAAY;AAC/C,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS;AACT,QAAQ,EAAE,CAAC;AACX;;ACXe,SAAS,kBAAkB,CAAC,MAAM,EAAE;AACn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O,CAAC;AACtC,iBAAiB,IAAI,CAAC,UAAU,QAAQ,EAAE;AAC1C,gBAAgB,IAAI,EAAE,CAAC;AACvB,gBAAgB,IAAI,KAAK,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAChH,gBAAgB,IAAI,KAAK,KAAK,IAAI,IAAI,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACxE,oBAAoB,OAAO,iBAAiB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACrE,iBAAiB;AACjB,gBAAgB,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;AACrE,aAAa,CAAC;AACd,iBAAiB,IAAI,CAAC,YAAY;AAClC,gBAAgB,IAAI,CAAC,QAAQ,EAAE,CAAC;AAChC,aAAa,CAAC;AACd,iBAAiB,KAAK,CAAC,UAAU,GAAG,EAAE;AACtC,gBAAgB,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACvC,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.native.js new file mode 100644 index 0000000..e8398d2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/relay/relay.cjs.native.js @@ -0,0 +1,369 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var relayRuntime = require('relay-runtime'); +var tslib = require('tslib'); +var utilities = require('../..'); +var utils = require('../../../link/utils'); +var errors = require('../../../errors'); +var core = require('../../../core'); + +function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} + +function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(utilities.canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} + +function readMultipartBody(response, nextValue) { + var _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 , 3]; + return [4 , iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = tslib.__assign({}, result.payload); + } + if ("errors" in result) { + next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + nextValue(result); + } + } + else if ( + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 ]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 , 1]; + case 3: return [2 ]; + } + }); + }); +} +function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +function handleError(err, observer) { + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); +} + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + accept: "*/*", + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; + +function generateOptionsForMultipartSubscription(headers) { + var options = tslib.__assign(tslib.__assign({}, fallbackHttpConfig.options), { headers: tslib.__assign(tslib.__assign(tslib.__assign({}, (headers || {})), fallbackHttpConfig.headers), { accept: "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json" }) }); + return options; +} + +var backupFetch = utilities.maybe(function () { return fetch; }); +function createFetchMultipartSubscription(uri, _a) { + var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers; + return function fetchMultipartSubscription(operation, variables) { + var body = { + operationName: operation.name, + variables: variables, + query: operation.text || "", + }; + var options = generateOptionsForMultipartSubscription(headers || {}); + return relayRuntime.Observable.create(function (sink) { + try { + options.body = core.serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + sink.error(parseError); + } + var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch; + var observerNext = sink.next.bind(sink); + currentFetch(uri, options) + .then(function (response) { + var _a; + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + sink.error(new Error("Expected multipart response")); + }) + .then(function () { + sink.complete(); + }) + .catch(function (err) { + handleError(err, sink); + }); + }); + }; +} + +exports.createFetchMultipartSubscription = createFetchMultipartSubscription; +//# sourceMappingURL=relay.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.d.ts new file mode 100644 index 0000000..2804b09 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.d.ts @@ -0,0 +1,9 @@ +export type CreateMultipartSubscriptionOptions = { + fetch?: WindowOrWorkerGlobalScope["fetch"]; + headers?: Record; +}; +export declare function generateOptionsForMultipartSubscription(headers: Record): { + headers: Record; + body?: string | undefined; +}; +//# sourceMappingURL=shared.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js new file mode 100644 index 0000000..ee7141e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js @@ -0,0 +1,7 @@ +import { __assign } from "tslib"; +import { fallbackHttpConfig } from "../../link/http/selectHttpOptionsAndBody.js"; +export function generateOptionsForMultipartSubscription(headers) { + var options = __assign(__assign({}, fallbackHttpConfig.options), { headers: __assign(__assign(__assign({}, (headers || {})), fallbackHttpConfig.headers), { accept: "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json" }) }); + return options; +} +//# sourceMappingURL=shared.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js.map new file mode 100644 index 0000000..89ec588 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/shared.js.map @@ -0,0 +1 @@ +{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/utilities/subscriptions/shared.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAOjF,MAAM,UAAU,uCAAuC,CACrD,OAA+B;IAE/B,IAAM,OAAO,yBACR,kBAAkB,CAAC,OAAO,KAC7B,OAAO,iCACF,CAAC,OAAO,IAAI,EAAE,CAAC,GACf,kBAAkB,CAAC,OAAO,KAC7B,MAAM,EACJ,wEAAwE,MAE7E,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { fallbackHttpConfig } from \"../../link/http/selectHttpOptionsAndBody.js\";\n\nexport type CreateMultipartSubscriptionOptions = {\n fetch?: WindowOrWorkerGlobalScope[\"fetch\"];\n headers?: Record;\n};\n\nexport function generateOptionsForMultipartSubscription(\n headers: Record\n) {\n const options: { headers: Record; body?: string } = {\n ...fallbackHttpConfig.options,\n headers: {\n ...(headers || {}),\n ...fallbackHttpConfig.headers,\n accept:\n \"multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json\",\n },\n };\n return options;\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.d.ts new file mode 100644 index 0000000..87356f8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.d.ts @@ -0,0 +1,7 @@ +import { Observable } from "../../index.js"; +import type { CreateMultipartSubscriptionOptions } from "../shared.js"; +export declare function createFetchMultipartSubscription(uri: string, { fetch: preferredFetch, headers }?: CreateMultipartSubscriptionOptions): ({ query, variables, }: { + query?: string | undefined; + variables: undefined | Record; +}) => Observable; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js new file mode 100644 index 0000000..1fe1401 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js @@ -0,0 +1,40 @@ +import { Observable } from "../../index.js"; +import { handleError, readMultipartBody, } from "../../../link/http/parseAndCheckHttpResponse.js"; +import { maybe } from "../../index.js"; +import { serializeFetchParameter } from "../../../core/index.js"; +import { generateOptionsForMultipartSubscription } from "../shared.js"; +var backupFetch = maybe(function () { return fetch; }); +export function createFetchMultipartSubscription(uri, _a) { + var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers; + return function multipartSubscriptionForwarder(_a) { + var query = _a.query, variables = _a.variables; + var body = { variables: variables, query: query }; + var options = generateOptionsForMultipartSubscription(headers || {}); + return new Observable(function (observer) { + try { + options.body = serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + observer.error(parseError); + } + var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch; + var observerNext = observer.next.bind(observer); + currentFetch(uri, options) + .then(function (response) { + var _a; + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + observer.error(new Error("Expected multipart response")); + }) + .then(function () { + observer.complete(); + }) + .catch(function (err) { + handleError(err, observer); + }); + }); + }; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js.map new file mode 100644 index 0000000..9c5f3eb --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utilities/subscriptions/urql/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,uCAAuC,EAAE,MAAM,cAAc,CAAC;AAGvE,IAAM,WAAW,GAAG,KAAK,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC;AAEvC,MAAM,UAAU,gCAAgC,CAC9C,GAAW,EACX,EAA2E;QAA3E,qBAAyE,EAAE,KAAA,EAAlE,cAAc,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AC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Observable } from \"../../index.js\";\nimport {\n handleError,\n readMultipartBody,\n} from \"../../../link/http/parseAndCheckHttpResponse.js\";\nimport { maybe } from \"../../index.js\";\nimport { serializeFetchParameter } from \"../../../core/index.js\";\nimport type { Body } from \"../../../link/http/selectHttpOptionsAndBody.js\";\nimport { generateOptionsForMultipartSubscription } from \"../shared.js\";\nimport type { CreateMultipartSubscriptionOptions } from \"../shared.js\";\n\nconst backupFetch = maybe(() => fetch);\n\nexport function createFetchMultipartSubscription(\n uri: string,\n { fetch: preferredFetch, headers }: CreateMultipartSubscriptionOptions = {}\n) {\n return function multipartSubscriptionForwarder({\n query,\n variables,\n }: {\n query?: string;\n variables: undefined | Record;\n }) {\n const body: Body = { variables, query };\n const options = generateOptionsForMultipartSubscription(headers || {});\n\n return new Observable((observer) => {\n try {\n options.body = serializeFetchParameter(body, \"Payload\");\n } catch (parseError) {\n observer.error(parseError);\n }\n\n const currentFetch = preferredFetch || maybe(() => fetch) || backupFetch;\n const observerNext = observer.next.bind(observer);\n\n currentFetch!(uri, options)\n .then((response) => {\n const ctype = response.headers?.get(\"content-type\");\n\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n }\n\n observer.error(new Error(\"Expected multipart response\"));\n })\n .then(() => {\n observer.complete();\n })\n .catch((err: any) => {\n handleError(err, observer);\n });\n });\n };\n}\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/package.json b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/package.json new file mode 100644 index 0000000..ab18227 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/package.json @@ -0,0 +1,8 @@ +{ + "name": "@apollo/client/utilities/subscriptions/urql", + "type": "module", + "main": "urql.cjs", + "module": "index.js", + "types": "index.d.ts", + "sideEffects": false +} diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs new file mode 100644 index 0000000..342b7a8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs @@ -0,0 +1,365 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var utilities = require('../..'); +var tslib = require('tslib'); +var utils = require('../../../link/utils'); +var errors = require('../../../errors'); +var core = require('../../../core'); + +function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} + +function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(utilities.canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} + +function readMultipartBody(response, nextValue) { + var _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 , 3]; + return [4 , iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = tslib.__assign({}, result.payload); + } + if ("errors" in result) { + next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + nextValue(result); + } + } + else if ( + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 ]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 , 1]; + case 3: return [2 ]; + } + }); + }); +} +function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +function handleError(err, observer) { + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); +} + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + accept: "*/*", + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; + +function generateOptionsForMultipartSubscription(headers) { + var options = tslib.__assign(tslib.__assign({}, fallbackHttpConfig.options), { headers: tslib.__assign(tslib.__assign(tslib.__assign({}, (headers || {})), fallbackHttpConfig.headers), { accept: "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json" }) }); + return options; +} + +var backupFetch = utilities.maybe(function () { return fetch; }); +function createFetchMultipartSubscription(uri, _a) { + var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers; + return function multipartSubscriptionForwarder(_a) { + var query = _a.query, variables = _a.variables; + var body = { variables: variables, query: query }; + var options = generateOptionsForMultipartSubscription(headers || {}); + return new utilities.Observable(function (observer) { + try { + options.body = core.serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + observer.error(parseError); + } + var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch; + var observerNext = observer.next.bind(observer); + currentFetch(uri, options) + .then(function (response) { + var _a; + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + observer.error(new Error("Expected multipart response")); + }) + .then(function () { + observer.complete(); + }) + .catch(function (err) { + handleError(err, observer); + }); + }); + }; +} + +exports.createFetchMultipartSubscription = createFetchMultipartSubscription; +//# sourceMappingURL=urql.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.map b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.map new file mode 100644 index 0000000..9ca069a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"urql.cjs","sources":["../../../link/http/iterators/async.js","../../../link/http/iterators/nodeStream.js","../../../link/http/iterators/promise.js","../../../link/http/iterators/reader.js","../../../link/http/responseIterator.js","../../common/objects.js","../../common/incrementalResult.js","../../../link/http/parseAndCheckHttpResponse.js","../../../link/http/selectHttpOptionsAndBody.js","../shared.js","index.js"],"sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts\n */\nexport default function asyncIterator(source) {\n var _a;\n var iterator = source[Symbol.asyncIterator]();\n return _a = {\n next: function () {\n return iterator.next();\n }\n },\n _a[Symbol.asyncIterator] = function () {\n return this;\n },\n _a;\n}\n//# sourceMappingURL=async.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function nodeStreamIterator(stream) {\n var cleanup = null;\n var error = null;\n var done = false;\n var data = [];\n var waiting = [];\n function onData(chunk) {\n if (error)\n return;\n if (waiting.length) {\n var shiftedArr = waiting.shift();\n if (Array.isArray(shiftedArr) && shiftedArr[0]) {\n return shiftedArr[0]({ value: chunk, done: false });\n }\n }\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n var all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n cleanup = function () {\n cleanup = null;\n stream.removeListener(\"data\", onData);\n stream.removeListener(\"error\", onError);\n stream.removeListener(\"end\", onEnd);\n stream.removeListener(\"finish\", onEnd);\n stream.removeListener(\"close\", onEnd);\n };\n stream.on(\"data\", onData);\n stream.on(\"error\", onError);\n stream.on(\"end\", onEnd);\n stream.on(\"finish\", onEnd);\n stream.on(\"close\", onEnd);\n function getNext() {\n return new Promise(function (resolve, reject) {\n if (error)\n return reject(error);\n if (data.length)\n return resolve({ value: data.shift(), done: false });\n if (done)\n return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n var iterator = {\n next: function () {\n return getNext();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=nodeStream.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function promiseIterator(promise) {\n var resolved = false;\n var iterator = {\n next: function () {\n if (resolved)\n return Promise.resolve({\n value: undefined,\n done: true,\n });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value: value, done: false });\n })\n .catch(reject);\n });\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=promise.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\nexport default function readerIterator(reader) {\n var iterator = {\n next: function () {\n return reader.read();\n },\n };\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function () {\n return this;\n };\n }\n return iterator;\n}\n//# sourceMappingURL=reader.js.map","/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts\n */\nimport { canUseAsyncIteratorSymbol } from \"../../utilities/index.js\";\nimport asyncIterator from \"./iterators/async.js\";\nimport nodeStreamIterator from \"./iterators/nodeStream.js\";\nimport promiseIterator from \"./iterators/promise.js\";\nimport readerIterator from \"./iterators/reader.js\";\nfunction isNodeResponse(value) {\n return !!value.body;\n}\nfunction isReadableStream(value) {\n return !!value.getReader;\n}\nfunction isAsyncIterableIterator(value) {\n return !!(canUseAsyncIteratorSymbol &&\n value[Symbol.asyncIterator]);\n}\nfunction isStreamableBlob(value) {\n return !!value.stream;\n}\nfunction isBlob(value) {\n return !!value.arrayBuffer;\n}\nfunction isNodeReadableStream(value) {\n return !!value.pipe;\n}\nexport function responseIterator(response) {\n var body = response;\n if (isNodeResponse(response))\n body = response.body;\n if (isAsyncIterableIterator(body))\n return asyncIterator(body);\n if (isReadableStream(body))\n return readerIterator(body.getReader());\n // this errors without casting to ReadableStream\n // because Blob.stream() returns a NodeJS ReadableStream\n if (isStreamableBlob(body)) {\n return readerIterator(body.stream().getReader());\n }\n if (isBlob(body))\n return promiseIterator(body.arrayBuffer());\n if (isNodeReadableStream(body))\n return nodeStreamIterator(body);\n throw new Error(\"Unknown body type for responseIterator. Please pass a streamable response.\");\n}\n//# sourceMappingURL=responseIterator.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === \"object\";\n}\nexport function isPlainObject(obj) {\n return (obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null));\n}\n//# sourceMappingURL=objects.js.map","import { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\nexport function isExecutionPatchIncrementalResult(value) {\n return \"incremental\" in value;\n}\nexport function isExecutionPatchInitialResult(value) {\n return \"hasNext\" in value && \"data\" in value;\n}\nexport function isExecutionPatchResult(value) {\n return (isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value));\n}\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(value) {\n return isNonNullObject(value) && \"payload\" in value;\n}\nexport function mergeIncrementalData(prevResult, result) {\n var mergedData = prevResult;\n var merger = new DeepMerger();\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (_a) {\n var data = _a.data, path = _a.path;\n for (var i = path.length - 1; i >= 0; --i) {\n var key = path[i];\n var isNumericKey = !isNaN(+key);\n var parent_1 = isNumericKey ? [] : {};\n parent_1[key] = data;\n data = parent_1;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData;\n}\n//# sourceMappingURL=incrementalResult.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { responseIterator } from \"./responseIterator.js\";\nimport { throwServerError } from \"../utils/index.js\";\nimport { PROTOCOL_ERRORS_SYMBOL } from \"../../errors/index.js\";\nimport { isApolloPayloadResult } from \"../../utilities/common/incrementalResult.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function readMultipartBody(response, nextValue) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;\n var _c, _d;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n if (TextDecoder === undefined) {\n throw new Error(\"TextDecoder must be defined in the environment: please import a polyfill.\");\n }\n decoder = new TextDecoder(\"utf-8\");\n contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n delimiter = \"boundary=\";\n boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?\n contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['\"]/g, \"\").replace(/\\;(.*)/gm, \"\").trim()\n : \"-\";\n boundary = \"\\r\\n--\".concat(boundaryVal);\n buffer = \"\";\n iterator = responseIterator(response);\n running = true;\n _e.label = 1;\n case 1:\n if (!running) return [3 /*break*/, 3];\n return [4 /*yield*/, iterator.next()];\n case 2:\n _b = _e.sent(), value = _b.value, done = _b.done;\n chunk = typeof value === \"string\" ? value : decoder.decode(value);\n searchFrom = buffer.length - boundary.length + 1;\n running = !done;\n buffer += chunk;\n bi = buffer.indexOf(boundary, searchFrom);\n while (bi > -1) {\n message = void 0;\n _c = [\n buffer.slice(0, bi),\n buffer.slice(bi + boundary.length),\n ], message = _c[0], buffer = _c[1];\n i = message.indexOf(\"\\r\\n\\r\\n\");\n headers = parseHeaders(message.slice(0, i));\n contentType_1 = headers[\"content-type\"];\n if (contentType_1 &&\n contentType_1.toLowerCase().indexOf(\"application/json\") === -1) {\n throw new Error(\"Unsupported patch content type: application/json is required.\");\n }\n body = message.slice(i);\n if (body) {\n result = parseJsonBody(response, body);\n if (Object.keys(result).length > 1 ||\n \"data\" in result ||\n \"incremental\" in result ||\n \"errors\" in result ||\n \"payload\" in result) {\n if (isApolloPayloadResult(result)) {\n next = {};\n if (\"payload\" in result) {\n next = __assign({}, result.payload);\n }\n if (\"errors\" in result) {\n next = __assign(__assign({}, next), { extensions: __assign(__assign({}, (\"extensions\" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });\n }\n nextValue(next);\n }\n else {\n // for the last chunk with only `hasNext: false`\n // we don't need to call observer.next as there is no data/errors\n nextValue(result);\n }\n }\n else if (\n // If the chunk contains only a \"hasNext: false\", we can call\n // observer.complete() immediately.\n Object.keys(result).length === 1 &&\n \"hasNext\" in result &&\n !result.hasNext) {\n return [2 /*return*/];\n }\n }\n bi = buffer.indexOf(boundary);\n }\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/];\n }\n });\n });\n}\nexport function parseHeaders(headerText) {\n var headersInit = {};\n headerText.split(\"\\n\").forEach(function (line) {\n var i = line.indexOf(\":\");\n if (i > -1) {\n // normalize headers to lowercase\n var name_1 = line.slice(0, i).trim().toLowerCase();\n var value = line.slice(i + 1).trim();\n headersInit[name_1] = value;\n }\n });\n return headersInit;\n}\nexport function parseJsonBody(response, bodyText) {\n if (response.status >= 300) {\n // Network error\n var getResult = function () {\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n return bodyText;\n }\n };\n throwServerError(response, getResult(), \"Response not successful: Received status code \".concat(response.status));\n }\n try {\n return JSON.parse(bodyText);\n }\n catch (err) {\n var parseError = err;\n parseError.name = \"ServerParseError\";\n parseError.response = response;\n parseError.statusCode = response.status;\n parseError.bodyText = bodyText;\n throw parseError;\n }\n}\nexport function handleError(err, observer) {\n // if it is a network error, BUT there is graphql result info fire\n // the next observer before calling error this gives apollo-client\n // (and react-apollo) the `graphqlErrors` and `networkErrors` to\n // pass to UI this should only happen if we *also* have data as\n // part of the response key per the spec\n if (err.result && err.result.errors && err.result.data) {\n // if we don't call next, the UI can only show networkError\n // because AC didn't get any graphqlErrors this is graphql\n // execution result info (i.e errors and possibly data) this is\n // because there is no formal spec how errors should translate to\n // http status codes. So an auth error (401) could have both data\n // from a public field, errors from a private field, and a status\n // of 401\n // {\n // user { // this will have errors\n // firstName\n // }\n // products { // this is public so will have data\n // cost\n // }\n // }\n //\n // the result of above *could* look like this:\n // {\n // data: { products: [{ cost: \"$10\" }] },\n // errors: [{\n // message: 'your session has timed out',\n // path: []\n // }]\n // }\n // status code of above would be a 401\n // in the UI you want to show data where you can, errors as data where you can\n // and use correct http status codes\n observer.next(err.result);\n }\n observer.error(err);\n}\nexport function parseAndCheckHttpResponse(operations) {\n return function (response) {\n return response\n .text()\n .then(function (bodyText) { return parseJsonBody(response, bodyText); })\n .then(function (result) {\n if (!Array.isArray(result) &&\n !hasOwnProperty.call(result, \"data\") &&\n !hasOwnProperty.call(result, \"errors\")) {\n // Data error\n throwServerError(response, result, \"Server response was missing for query '\".concat(Array.isArray(operations) ?\n operations.map(function (op) { return op.operationName; })\n : operations.operationName, \"'.\"));\n }\n return result;\n });\n };\n}\n//# sourceMappingURL=parseAndCheckHttpResponse.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { print } from \"../../utilities/index.js\";\nvar defaultHttpOptions = {\n includeQuery: true,\n includeExtensions: false,\n preserveHeaderCase: false,\n};\nvar defaultHeaders = {\n // headers are case insensitive (https://stackoverflow.com/a/5259004)\n accept: \"*/*\",\n // The content-type header describes the type of the body of the request, and\n // so it typically only is sent with requests that actually have bodies. One\n // could imagine that Apollo Client would remove this header when constructing\n // a GET request (which has no body), but we historically have not done that.\n // This means that browsers will preflight all Apollo Client requests (even\n // GET requests). Apollo Server's CSRF prevention feature (introduced in\n // AS3.7) takes advantage of this fact and does not block requests with this\n // header. If you want to drop this header from GET requests, then you should\n // probably replace it with a `apollo-require-preflight` header, or servers\n // with CSRF prevention enabled might block your GET request. See\n // https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf\n // for more details.\n \"content-type\": \"application/json\",\n};\nvar defaultOptions = {\n method: \"POST\",\n};\nexport var fallbackHttpConfig = {\n http: defaultHttpOptions,\n headers: defaultHeaders,\n options: defaultOptions,\n};\nexport var defaultPrinter = function (ast, printer) { return printer(ast); };\nexport function selectHttpOptionsAndBody(operation, fallbackConfig) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n configs.unshift(fallbackConfig);\n return selectHttpOptionsAndBodyInternal.apply(void 0, __spreadArray([operation,\n defaultPrinter], configs, false));\n}\nexport function selectHttpOptionsAndBodyInternal(operation, printer) {\n var configs = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n configs[_i - 2] = arguments[_i];\n }\n var options = {};\n var http = {};\n configs.forEach(function (config) {\n options = __assign(__assign(__assign({}, options), config.options), { headers: __assign(__assign({}, options.headers), config.headers) });\n if (config.credentials) {\n options.credentials = config.credentials;\n }\n http = __assign(__assign({}, http), config.http);\n });\n if (options.headers) {\n options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);\n }\n //The body depends on the http options\n var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;\n var body = { operationName: operationName, variables: variables };\n if (http.includeExtensions)\n body.extensions = extensions;\n // not sending the query (i.e persisted queries)\n if (http.includeQuery)\n body.query = printer(query, print);\n return {\n options: options,\n body: body,\n };\n}\n// Remove potential duplicate header names, preserving last (by insertion order).\n// This is done to prevent unintentionally duplicating a header instead of\n// overwriting it (See #8447 and #8449).\nfunction removeDuplicateHeaders(headers, preserveHeaderCase) {\n // If we're not preserving the case, just remove duplicates w/ normalization.\n if (!preserveHeaderCase) {\n var normalizedHeaders_1 = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n normalizedHeaders_1[name.toLowerCase()] = headers[name];\n });\n return normalizedHeaders_1;\n }\n // If we are preserving the case, remove duplicates w/ normalization,\n // preserving the original name.\n // This allows for non-http-spec-compliant servers that expect intentionally\n // capitalized header names (See #6741).\n var headerData = Object.create(null);\n Object.keys(Object(headers)).forEach(function (name) {\n headerData[name.toLowerCase()] = {\n originalName: name,\n value: headers[name],\n };\n });\n var normalizedHeaders = Object.create(null);\n Object.keys(headerData).forEach(function (name) {\n normalizedHeaders[headerData[name].originalName] = headerData[name].value;\n });\n return normalizedHeaders;\n}\n//# sourceMappingURL=selectHttpOptionsAndBody.js.map","import { __assign } from \"tslib\";\nimport { fallbackHttpConfig } from \"../../link/http/selectHttpOptionsAndBody.js\";\nexport function generateOptionsForMultipartSubscription(headers) {\n var options = __assign(__assign({}, fallbackHttpConfig.options), { headers: __assign(__assign(__assign({}, (headers || {})), fallbackHttpConfig.headers), { accept: \"multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json\" }) });\n return options;\n}\n//# sourceMappingURL=shared.js.map","import { Observable } from \"../../index.js\";\nimport { handleError, readMultipartBody, } from \"../../../link/http/parseAndCheckHttpResponse.js\";\nimport { maybe } from \"../../index.js\";\nimport { serializeFetchParameter } from \"../../../core/index.js\";\nimport { generateOptionsForMultipartSubscription } from \"../shared.js\";\nvar backupFetch = maybe(function () { return fetch; });\nexport function createFetchMultipartSubscription(uri, _a) {\n var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers;\n return function multipartSubscriptionForwarder(_a) {\n var query = _a.query, variables = _a.variables;\n var body = { variables: variables, query: query };\n var options = generateOptionsForMultipartSubscription(headers || {});\n return new Observable(function (observer) {\n try {\n options.body = serializeFetchParameter(body, \"Payload\");\n }\n catch (parseError) {\n observer.error(parseError);\n }\n var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch;\n var observerNext = observer.next.bind(observer);\n currentFetch(uri, options)\n .then(function (response) {\n var _a;\n var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get(\"content-type\");\n if (ctype !== null && /^multipart\\/mixed/i.test(ctype)) {\n return readMultipartBody(response, observerNext);\n }\n observer.error(new Error(\"Expected multipart response\"));\n })\n .then(function () {\n observer.complete();\n })\n .catch(function (err) {\n handleError(err, observer);\n });\n });\n };\n}\n//# sourceMappingURL=index.js.map"],"names":["canUseAsyncIteratorSymbol","__awaiter","__generator","__assign","PROTOCOL_ERRORS_SYMBOL","throwServerError","maybe","Observable","serializeFetchParameter"],"mappings":";;;;;;;;;;AAIe,SAAS,aAAa,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;AAClD,IAAI,OAAO,EAAE,GAAG;AAChB,YAAY,IAAI,EAAE,YAAY;AAC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AAa;AACb,YAAY,IAAI,YAAY,GAAG,cAAc,IAAIF,eAAK,CAAC,YAAY,EAAE,OAAO,KAAK,CAAC,EAAE,CAAC,IAAI,WAAW,CAAC;AACrG,YAAY,IAAI,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5D,YAAY,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC;AACtC,iBAAiB,IAAI,CAAC,UAAU,QAAQ,EAAE;AAC1C,gBAAgB,IAAI,EAAE,CAAC;AACvB,gBAAgB,IAAI,KAAK,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAChH,gBAAgB,IAAI,KAAK,KAAK,IAAI,IAAI,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACxE,oBAAoB,OAAO,iBAAiB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACrE,iBAAiB;AACjB,gBAAgB,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;AACzE,aAAa,CAAC;AACd,iBAAiB,IAAI,CAAC,YAAY;AAClC,gBAAgB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpC,aAAa,CAAC;AACd,iBAAiB,KAAK,CAAC,UAAU,GAAG,EAAE;AACtC,gBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC3C,aAAa,CAAC,CAAC;AACf,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.native.js new file mode 100644 index 0000000..342b7a8 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/subscriptions/urql/urql.cjs.native.js @@ -0,0 +1,365 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var utilities = require('../..'); +var tslib = require('tslib'); +var utils = require('../../../link/utils'); +var errors = require('../../../errors'); +var core = require('../../../core'); + +function asyncIterator(source) { + var _a; + var iterator = source[Symbol.asyncIterator](); + return _a = { + next: function () { + return iterator.next(); + } + }, + _a[Symbol.asyncIterator] = function () { + return this; + }, + _a; +} + +function nodeStreamIterator(stream) { + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + function onData(chunk) { + if (error) + return; + if (waiting.length) { + var shiftedArr = waiting.shift(); + if (Array.isArray(shiftedArr) && shiftedArr[0]) { + return shiftedArr[0]({ value: chunk, done: false }); + } + } + data.push(chunk); + } + function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function (pair) { + pair[0]({ value: undefined, done: true }); + }); + !cleanup || cleanup(); + } + cleanup = function () { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + function getNext() { + return new Promise(function (resolve, reject) { + if (error) + return reject(error); + if (data.length) + return resolve({ value: data.shift(), done: false }); + if (done) + return resolve({ value: undefined, done: true }); + waiting.push([resolve, reject]); + }); + } + var iterator = { + next: function () { + return getNext(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function () { + if (resolved) + return Promise.resolve({ + value: undefined, + done: true, + }); + resolved = true; + return new Promise(function (resolve, reject) { + promise + .then(function (value) { + resolve({ value: value, done: false }); + }) + .catch(reject); + }); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function readerIterator(reader) { + var iterator = { + next: function () { + return reader.read(); + }, + }; + if (utilities.canUseAsyncIteratorSymbol) { + iterator[Symbol.asyncIterator] = function () { + return this; + }; + } + return iterator; +} + +function isNodeResponse(value) { + return !!value.body; +} +function isReadableStream(value) { + return !!value.getReader; +} +function isAsyncIterableIterator(value) { + return !!(utilities.canUseAsyncIteratorSymbol && + value[Symbol.asyncIterator]); +} +function isStreamableBlob(value) { + return !!value.stream; +} +function isBlob(value) { + return !!value.arrayBuffer; +} +function isNodeReadableStream(value) { + return !!value.pipe; +} +function responseIterator(response) { + var body = response; + if (isNodeResponse(response)) + body = response.body; + if (isAsyncIterableIterator(body)) + return asyncIterator(body); + if (isReadableStream(body)) + return readerIterator(body.getReader()); + if (isStreamableBlob(body)) { + return readerIterator(body.stream().getReader()); + } + if (isBlob(body)) + return promiseIterator(body.arrayBuffer()); + if (isNodeReadableStream(body)) + return nodeStreamIterator(body); + throw new Error("Unknown body type for responseIterator. Please pass a streamable response."); +} + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} + +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} + +function readMultipartBody(response, nextValue) { + var _a; + return tslib.__awaiter(this, void 0, void 0, function () { + var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next; + var _c, _d; + return tslib.__generator(this, function (_e) { + switch (_e.label) { + case 0: + if (TextDecoder === undefined) { + throw new Error("TextDecoder must be defined in the environment: please import a polyfill."); + } + decoder = new TextDecoder("utf-8"); + contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + delimiter = "boundary="; + boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ? + contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim() + : "-"; + boundary = "\r\n--".concat(boundaryVal); + buffer = ""; + iterator = responseIterator(response); + running = true; + _e.label = 1; + case 1: + if (!running) return [3 , 3]; + return [4 , iterator.next()]; + case 2: + _b = _e.sent(), value = _b.value, done = _b.done; + chunk = typeof value === "string" ? value : decoder.decode(value); + searchFrom = buffer.length - boundary.length + 1; + running = !done; + buffer += chunk; + bi = buffer.indexOf(boundary, searchFrom); + while (bi > -1) { + message = void 0; + _c = [ + buffer.slice(0, bi), + buffer.slice(bi + boundary.length), + ], message = _c[0], buffer = _c[1]; + i = message.indexOf("\r\n\r\n"); + headers = parseHeaders(message.slice(0, i)); + contentType_1 = headers["content-type"]; + if (contentType_1 && + contentType_1.toLowerCase().indexOf("application/json") === -1) { + throw new Error("Unsupported patch content type: application/json is required."); + } + body = message.slice(i); + if (body) { + result = parseJsonBody(response, body); + if (Object.keys(result).length > 1 || + "data" in result || + "incremental" in result || + "errors" in result || + "payload" in result) { + if (isApolloPayloadResult(result)) { + next = {}; + if ("payload" in result) { + next = tslib.__assign({}, result.payload); + } + if ("errors" in result) { + next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) }); + } + nextValue(next); + } + else { + nextValue(result); + } + } + else if ( + Object.keys(result).length === 1 && + "hasNext" in result && + !result.hasNext) { + return [2 ]; + } + } + bi = buffer.indexOf(boundary); + } + return [3 , 1]; + case 3: return [2 ]; + } + }); + }); +} +function parseHeaders(headerText) { + var headersInit = {}; + headerText.split("\n").forEach(function (line) { + var i = line.indexOf(":"); + if (i > -1) { + var name_1 = line.slice(0, i).trim().toLowerCase(); + var value = line.slice(i + 1).trim(); + headersInit[name_1] = value; + } + }); + return headersInit; +} +function parseJsonBody(response, bodyText) { + if (response.status >= 300) { + var getResult = function () { + try { + return JSON.parse(bodyText); + } + catch (err) { + return bodyText; + } + }; + utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status)); + } + try { + return JSON.parse(bodyText); + } + catch (err) { + var parseError = err; + parseError.name = "ServerParseError"; + parseError.response = response; + parseError.statusCode = response.status; + parseError.bodyText = bodyText; + throw parseError; + } +} +function handleError(err, observer) { + if (err.result && err.result.errors && err.result.data) { + observer.next(err.result); + } + observer.error(err); +} + +var defaultHttpOptions = { + includeQuery: true, + includeExtensions: false, + preserveHeaderCase: false, +}; +var defaultHeaders = { + accept: "*/*", + "content-type": "application/json", +}; +var defaultOptions = { + method: "POST", +}; +var fallbackHttpConfig = { + http: defaultHttpOptions, + headers: defaultHeaders, + options: defaultOptions, +}; + +function generateOptionsForMultipartSubscription(headers) { + var options = tslib.__assign(tslib.__assign({}, fallbackHttpConfig.options), { headers: tslib.__assign(tslib.__assign(tslib.__assign({}, (headers || {})), fallbackHttpConfig.headers), { accept: "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json" }) }); + return options; +} + +var backupFetch = utilities.maybe(function () { return fetch; }); +function createFetchMultipartSubscription(uri, _a) { + var _b = _a === void 0 ? {} : _a, preferredFetch = _b.fetch, headers = _b.headers; + return function multipartSubscriptionForwarder(_a) { + var query = _a.query, variables = _a.variables; + var body = { variables: variables, query: query }; + var options = generateOptionsForMultipartSubscription(headers || {}); + return new utilities.Observable(function (observer) { + try { + options.body = core.serializeFetchParameter(body, "Payload"); + } + catch (parseError) { + observer.error(parseError); + } + var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch; + var observerNext = observer.next.bind(observer); + currentFetch(uri, options) + .then(function (response) { + var _a; + var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type"); + if (ctype !== null && /^multipart\/mixed/i.test(ctype)) { + return readMultipartBody(response, observerNext); + } + observer.error(new Error("Expected multipart response")); + }) + .then(function () { + observer.complete(); + }) + .catch(function (err) { + handleError(err, observer); + }); + }); + }; +} + +exports.createFetchMultipartSubscription = createFetchMultipartSubscription; +//# sourceMappingURL=urql.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.d.ts new file mode 100644 index 0000000..34827b9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.d.ts @@ -0,0 +1,10 @@ +import type { Primitive } from "./Primitive.js"; +type DeepOmitPrimitive = Primitive | Function; +export type DeepOmitArray = { + [P in keyof T]: DeepOmit; +}; +export type DeepOmit = T extends DeepOmitPrimitive ? T : { + [P in Exclude]: T[P] extends infer TP ? TP extends DeepOmitPrimitive ? TP : TP extends any[] ? DeepOmitArray : DeepOmit : never; +}; +export {}; +//# sourceMappingURL=DeepOmit.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js new file mode 100644 index 0000000..09cda9d --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=DeepOmit.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js.map new file mode 100644 index 0000000..4b3cc29 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepOmit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DeepOmit.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepOmit.ts"],"names":[],"mappings":"","sourcesContent":["import type { Primitive } from \"./Primitive.js\";\n\n// DeepOmit primitives include functions since these are unmodified.\ntype DeepOmitPrimitive = Primitive | Function;\n\nexport type DeepOmitArray = {\n [P in keyof T]: DeepOmit;\n};\n\n// Unfortunately there is one major flaw in this type: This will omit properties\n// from class instances in the return type even though our omitDeep helper\n// ignores class instances, therefore resulting in a type mismatch between\n// the return value and the runtime value.\n//\n// It is not currently possible with TypeScript to distinguish between plain\n// objects and class instances.\n// https://github.com/microsoft/TypeScript/issues/29063\n//\n// This should be fine as of the time of this writing until omitDeep gets\n// broader use since this utility is only used to strip __typename from\n// `variables`; a case in which class instances are invalid anyways.\nexport type DeepOmit =\n T extends DeepOmitPrimitive ? T\n : {\n [P in Exclude]: T[P] extends infer TP ?\n TP extends DeepOmitPrimitive ? TP\n : TP extends any[] ? DeepOmitArray\n : DeepOmit\n : never;\n };\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.d.ts new file mode 100644 index 0000000..14ddf71 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.d.ts @@ -0,0 +1,12 @@ +import type { Primitive } from "./Primitive.js"; +type DeepPartialPrimitive = Primitive | Date | RegExp; +export type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; +type DeepPartialMap = {} & Map, DeepPartial>; +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; +type DeepPartialSet = {} & Set>; +type DeepPartialReadonlySet = {} & ReadonlySet>; +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; +export {}; +//# sourceMappingURL=DeepPartial.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js new file mode 100644 index 0000000..6db6995 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js @@ -0,0 +1,6 @@ +// Inspired by type-fest PartialDeep: https://github.com/sindresorhus/type-fest/blob/9feb8c89be9a0f2f688bf2f497230298a8e2472e/source/partial-deep.d.ts +// +// We're including the license to give credit to the original implementation. +// https://github.com/sindresorhus/type-fest/blob/main/license-mit +export {}; +//# sourceMappingURL=DeepPartial.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js.map new file mode 100644 index 0000000..0672827 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/DeepPartial.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DeepPartial.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepPartial.ts"],"names":[],"mappings":"AAAA,sJAAsJ;AACtJ,EAAE;AACF,6EAA6E;AAC7E,kEAAkE","sourcesContent":["// Inspired by type-fest PartialDeep: https://github.com/sindresorhus/type-fest/blob/9feb8c89be9a0f2f688bf2f497230298a8e2472e/source/partial-deep.d.ts\n//\n// We're including the license to give credit to the original implementation.\n// https://github.com/sindresorhus/type-fest/blob/main/license-mit\n\n/*\n * MIT License\n *\n * Copyright (c) Sindre Sorhus (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nimport type { Primitive } from \"./Primitive.js\";\n\ntype DeepPartialPrimitive = Primitive | Date | RegExp;\n\nexport type DeepPartial =\n T extends DeepPartialPrimitive ? T\n : T extends Map ? DeepPartialMap\n : T extends ReadonlyMap ?\n DeepPartialReadonlyMap\n : T extends Set ? DeepPartialSet\n : T extends ReadonlySet ? DeepPartialReadonlySet\n : T extends (...args: any[]) => unknown ? T | undefined\n : T extends object ?\n T extends (\n ReadonlyArray // Test for arrays/tuples\n ) ?\n TItem[] extends (\n T // Test for non-tuples\n ) ?\n readonly TItem[] extends T ?\n ReadonlyArray>\n : Array>\n : DeepPartialObject\n : DeepPartialObject\n : unknown;\n\ntype DeepPartialMap = {} & Map<\n DeepPartial,\n DeepPartial\n>;\n\ntype DeepPartialReadonlyMap = {} & ReadonlyMap<\n DeepPartial,\n DeepPartial\n>;\n\ntype DeepPartialSet = {} & Set>;\ntype DeepPartialReadonlySet = {} & ReadonlySet>;\n\ntype DeepPartialObject = {\n [K in keyof T]?: DeepPartial;\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.d.ts new file mode 100644 index 0000000..7ae75e2 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.d.ts @@ -0,0 +1,5 @@ +export type IsStrictlyAny = UnionToIntersection> extends never ? true : false; +type UnionForAny = T extends never ? "a" : 1; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +export {}; +//# sourceMappingURL=IsStrictlyAny.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js b/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js new file mode 100644 index 0000000..5c91c3e --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=IsStrictlyAny.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js.map new file mode 100644 index 0000000..fe80f4f --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/IsStrictlyAny.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IsStrictlyAny.js","sourceRoot":"","sources":["../../../src/utilities/types/IsStrictlyAny.ts"],"names":[],"mappings":"","sourcesContent":["// Returns true if T is any, or false for any other type.\n// Inspired by https://stackoverflow.com/a/61625296/128454.\nexport type IsStrictlyAny =\n UnionToIntersection> extends never ? true : false;\n\n// If (and only if) T is any, the union 'a' | 1 is returned here, representing\n// both branches of this conditional type. Only UnionForAny produces this\n// union type; all other inputs produce the 1 literal type.\ntype UnionForAny = T extends never ? \"a\" : 1;\n\n// If that 'a' | 1 union is then passed to UnionToIntersection, the result\n// should be 'a' & 1, which TypeScript simplifies to the never type, since the\n// literal type 'a' and the literal type 1 are incompatible. More explanation of\n// this helper type: https://stackoverflow.com/a/50375286/62076.\ntype UnionToIntersection =\n (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I\n : never;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.d.ts new file mode 100644 index 0000000..1f2b243 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.d.ts @@ -0,0 +1,7 @@ +/** + * Returns a new type that only contains the required properties from `T` + */ +export type OnlyRequiredProperties = { + [K in keyof T as {} extends Pick ? never : K]: T[K]; +}; +//# sourceMappingURL=OnlyRequiredProperties.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js b/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js new file mode 100644 index 0000000..1992ba7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=OnlyRequiredProperties.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js.map new file mode 100644 index 0000000..cf6ac9c --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/OnlyRequiredProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"OnlyRequiredProperties.js","sourceRoot":"","sources":["../../../src/utilities/types/OnlyRequiredProperties.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Returns a new type that only contains the required properties from `T`\n */\nexport type OnlyRequiredProperties = {\n [K in keyof T as {} extends Pick ? never : K]: T[K];\n};\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.d.ts new file mode 100644 index 0000000..8e68350 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.d.ts @@ -0,0 +1,2 @@ +export type Primitive = null | undefined | string | number | boolean | symbol | bigint; +//# sourceMappingURL=Primitive.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js b/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js new file mode 100644 index 0000000..1930fe3 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Primitive.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js.map new file mode 100644 index 0000000..3c5deb9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/Primitive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Primitive.js","sourceRoot":"","sources":["../../../src/utilities/types/Primitive.ts"],"names":[],"mappings":"","sourcesContent":["// Matches any primitive value: https://developer.mozilla.org/en-US/docs/Glossary/Primitive.\nexport type Primitive =\n | null\n | undefined\n | string\n | number\n | boolean\n | symbol\n | bigint;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.d.ts b/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.d.ts new file mode 100644 index 0000000..d84838b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.d.ts @@ -0,0 +1,3 @@ +/** @internal */ +export type TODO = any; +//# sourceMappingURL=TODO.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js b/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js new file mode 100644 index 0000000..a1b3678 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=TODO.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js.map b/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js.map new file mode 100644 index 0000000..82f386a --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/types/TODO.js.map @@ -0,0 +1 @@ +{"version":3,"file":"TODO.js","sourceRoot":"","sources":["../../../src/utilities/types/TODO.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal */\nexport type TODO = any;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs b/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs new file mode 100644 index 0000000..e059cc9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs @@ -0,0 +1,1730 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('./globals'); +var graphql = require('graphql'); +var trie = require('@wry/trie'); +var tslib = require('tslib'); +var caches = require('@wry/caches'); +var optimism = require('optimism'); +var zenObservableTs = require('zen-observable-ts'); +require('symbol-observable'); + +function shouldInclude(_a, variables) { + var directives = _a.directives; + if (!directives || !directives.length) { + return true; + } + return getInclusionDirectives(directives).every(function (_a) { + var directive = _a.directive, ifArgument = _a.ifArgument; + var evaledValue = false; + if (ifArgument.value.kind === "Variable") { + evaledValue = + variables && variables[ifArgument.value.name.value]; + globals.invariant(evaledValue !== void 0, 67, directive.name.value); + } + else { + evaledValue = ifArgument.value.value; + } + return directive.name.value === "skip" ? !evaledValue : evaledValue; + }); +} +function getDirectiveNames(root) { + var names = []; + graphql.visit(root, { + Directive: function (node) { + names.push(node.name.value); + }, + }); + return names; +} +var hasAnyDirectives = function (names, root) { + return hasDirectives(names, root, false); +}; +var hasAllDirectives = function (names, root) { + return hasDirectives(names, root, true); +}; +function hasDirectives(names, root, all) { + var nameSet = new Set(names); + var uniqueCount = nameSet.size; + graphql.visit(root, { + Directive: function (node) { + if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) { + return graphql.BREAK; + } + }, + }); + return all ? !nameSet.size : nameSet.size < uniqueCount; +} +function hasClientExports(document) { + return document && hasDirectives(["client", "export"], document, true); +} +function isInclusionDirective(_a) { + var value = _a.name.value; + return value === "skip" || value === "include"; +} +function getInclusionDirectives(directives) { + var result = []; + if (directives && directives.length) { + directives.forEach(function (directive) { + if (!isInclusionDirective(directive)) + return; + var directiveArguments = directive.arguments; + var directiveName = directive.name.value; + globals.invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName); + var ifArgument = directiveArguments[0]; + globals.invariant(ifArgument.name && ifArgument.name.value === "if", 69, directiveName); + var ifValue = ifArgument.value; + globals.invariant(ifValue && + (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 70, directiveName); + result.push({ directive: directive, ifArgument: ifArgument }); + }); + } + return result; +} + +var canUseWeakMap = typeof WeakMap === "function" && + !globals.maybe(function () { return navigator.product == "ReactNative" && !global.HermesInternal; }); +var canUseWeakSet = typeof WeakSet === "function"; +var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function"; +var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator; +var canUseDOM = typeof globals.maybe(function () { return window.document.createElement; }) === "function"; +var usingJSDOM = +globals.maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false; +var canUseLayoutEffect = canUseDOM && !usingJSDOM; + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} +function isPlainObject(obj) { + return (obj !== null && + typeof obj === "object" && + (Object.getPrototypeOf(obj) === Object.prototype || + Object.getPrototypeOf(obj) === null)); +} + +function getFragmentQueryDocument(document, fragmentName) { + var actualFragmentName = fragmentName; + var fragments = []; + document.definitions.forEach(function (definition) { + if (definition.kind === "OperationDefinition") { + throw globals.newInvariantError( + 71, + definition.operation, + definition.name ? " named '".concat(definition.name.value, "'") : "" + ); + } + if (definition.kind === "FragmentDefinition") { + fragments.push(definition); + } + }); + if (typeof actualFragmentName === "undefined") { + globals.invariant(fragments.length === 1, 72, fragments.length); + actualFragmentName = fragments[0].name.value; + } + var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([ + { + kind: "OperationDefinition", + operation: "query", + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "FragmentSpread", + name: { + kind: "Name", + value: actualFragmentName, + }, + }, + ], + }, + } + ], document.definitions, true) }); + return query; +} +function createFragmentMap(fragments) { + if (fragments === void 0) { fragments = []; } + var symTable = {}; + fragments.forEach(function (fragment) { + symTable[fragment.name.value] = fragment; + }); + return symTable; +} +function getFragmentFromSelection(selection, fragmentMap) { + switch (selection.kind) { + case "InlineFragment": + return selection; + case "FragmentSpread": { + var fragmentName = selection.name.value; + if (typeof fragmentMap === "function") { + return fragmentMap(fragmentName); + } + var fragment = fragmentMap && fragmentMap[fragmentName]; + globals.invariant(fragment, 73, fragmentName); + return fragment || null; + } + default: + return null; + } +} + +var scheduledCleanup = new WeakSet(); +function schedule(cache) { + if (!scheduledCleanup.has(cache)) { + scheduledCleanup.add(cache); + setTimeout(function () { + cache.clean(); + scheduledCleanup.delete(cache); + }, 100); + } +} +var AutoCleanedWeakCache = function (max, dispose) { + var cache = new caches.WeakCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return caches.WeakCache.prototype.set.call(this, key, value); + }; + return cache; +}; +var AutoCleanedStrongCache = function (max, dispose) { + var cache = new caches.StrongCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return caches.StrongCache.prototype.set.call(this, key, value); + }; + return cache; +}; + +var cacheSizeSymbol = Symbol.for("apollo.cacheSize"); +var cacheSizes = tslib.__assign({}, globals.global[cacheSizeSymbol]); + +var globalCaches = {}; +function registerGlobalCache(name, getSize) { + globalCaches[name] = getSize; +} + +var canonicalStringify = Object.assign(function canonicalStringify(value) { + return JSON.stringify(value, stableObjectReplacer); +}, { + reset: function () { + sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 ); + }, +}); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("canonicalStringify", function () { return sortingMap.size; }); +} +var sortingMap; +canonicalStringify.reset(); +function stableObjectReplacer(key, value) { + if (value && typeof value === "object") { + var proto = Object.getPrototypeOf(value); + if (proto === Object.prototype || proto === null) { + var keys = Object.keys(value); + if (keys.every(everyKeyInOrder)) + return value; + var unsortedKey = JSON.stringify(keys); + var sortedKeys = sortingMap.get(unsortedKey); + if (!sortedKeys) { + keys.sort(); + var sortedKey = JSON.stringify(keys); + sortedKeys = sortingMap.get(sortedKey) || keys; + sortingMap.set(unsortedKey, sortedKeys); + sortingMap.set(sortedKey, sortedKeys); + } + var sortedObject_1 = Object.create(proto); + sortedKeys.forEach(function (key) { + sortedObject_1[key] = value[key]; + }); + return sortedObject_1; + } + } + return value; +} +function everyKeyInOrder(key, i, keys) { + return i === 0 || keys[i - 1] <= key; +} + +function makeReference(id) { + return { __ref: String(id) }; +} +function isReference(obj) { + return Boolean(obj && typeof obj === "object" && typeof obj.__ref === "string"); +} +function isDocumentNode(value) { + return (isNonNullObject(value) && + value.kind === "Document" && + Array.isArray(value.definitions)); +} +function isStringValue(value) { + return value.kind === "StringValue"; +} +function isBooleanValue(value) { + return value.kind === "BooleanValue"; +} +function isIntValue(value) { + return value.kind === "IntValue"; +} +function isFloatValue(value) { + return value.kind === "FloatValue"; +} +function isVariable(value) { + return value.kind === "Variable"; +} +function isObjectValue(value) { + return value.kind === "ObjectValue"; +} +function isListValue(value) { + return value.kind === "ListValue"; +} +function isEnumValue(value) { + return value.kind === "EnumValue"; +} +function isNullValue(value) { + return value.kind === "NullValue"; +} +function valueToObjectRepresentation(argObj, name, value, variables) { + if (isIntValue(value) || isFloatValue(value)) { + argObj[name.value] = Number(value.value); + } + else if (isBooleanValue(value) || isStringValue(value)) { + argObj[name.value] = value.value; + } + else if (isObjectValue(value)) { + var nestedArgObj_1 = {}; + value.fields.map(function (obj) { + return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); + }); + argObj[name.value] = nestedArgObj_1; + } + else if (isVariable(value)) { + var variableValue = (variables || {})[value.name.value]; + argObj[name.value] = variableValue; + } + else if (isListValue(value)) { + argObj[name.value] = value.values.map(function (listValue) { + var nestedArgArrayObj = {}; + valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); + return nestedArgArrayObj[name.value]; + }); + } + else if (isEnumValue(value)) { + argObj[name.value] = value.value; + } + else if (isNullValue(value)) { + argObj[name.value] = null; + } + else { + throw globals.newInvariantError(82, name.value, value.kind); + } +} +function storeKeyNameFromField(field, variables) { + var directivesObj = null; + if (field.directives) { + directivesObj = {}; + field.directives.forEach(function (directive) { + directivesObj[directive.name.value] = {}; + if (directive.arguments) { + directive.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); + }); + } + }); + } + var argObj = null; + if (field.arguments && field.arguments.length) { + argObj = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj, name, value, variables); + }); + } + return getStoreKeyName(field.name.value, argObj, directivesObj); +} +var KNOWN_DIRECTIVES = [ + "connection", + "include", + "skip", + "client", + "rest", + "export", + "nonreactive", +]; +var storeKeyNameStringify = canonicalStringify; +var getStoreKeyName = Object.assign(function (fieldName, args, directives) { + if (args && + directives && + directives["connection"] && + directives["connection"]["key"]) { + if (directives["connection"]["filter"] && + directives["connection"]["filter"].length > 0) { + var filterKeys = directives["connection"]["filter"] ? + directives["connection"]["filter"] + : []; + filterKeys.sort(); + var filteredArgs_1 = {}; + filterKeys.forEach(function (key) { + filteredArgs_1[key] = args[key]; + }); + return "".concat(directives["connection"]["key"], "(").concat(storeKeyNameStringify(filteredArgs_1), ")"); + } + else { + return directives["connection"]["key"]; + } + } + var completeFieldName = fieldName; + if (args) { + var stringifiedArgs = storeKeyNameStringify(args); + completeFieldName += "(".concat(stringifiedArgs, ")"); + } + if (directives) { + Object.keys(directives).forEach(function (key) { + if (KNOWN_DIRECTIVES.indexOf(key) !== -1) + return; + if (directives[key] && Object.keys(directives[key]).length) { + completeFieldName += "@".concat(key, "(").concat(storeKeyNameStringify(directives[key]), ")"); + } + else { + completeFieldName += "@".concat(key); + } + }); + } + return completeFieldName; +}, { + setStringify: function (s) { + var previous = storeKeyNameStringify; + storeKeyNameStringify = s; + return previous; + }, +}); +function argumentsObjectFromField(field, variables) { + if (field.arguments && field.arguments.length) { + var argObj_1 = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj_1, name, value, variables); + }); + return argObj_1; + } + return null; +} +function resultKeyNameFromField(field) { + return field.alias ? field.alias.value : field.name.value; +} +function getTypenameFromResult(result, selectionSet, fragmentMap) { + var fragments; + for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) { + var selection = _a[_i]; + if (isField(selection)) { + if (selection.name.value === "__typename") { + return result[resultKeyNameFromField(selection)]; + } + } + else if (fragments) { + fragments.push(selection); + } + else { + fragments = [selection]; + } + } + if (typeof result.__typename === "string") { + return result.__typename; + } + if (fragments) { + for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) { + var selection = fragments_1[_b]; + var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap); + if (typeof typename === "string") { + return typename; + } + } + } +} +function isField(selection) { + return selection.kind === "Field"; +} +function isInlineFragment(selection) { + return selection.kind === "InlineFragment"; +} + +function checkDocument(doc) { + globals.invariant(doc && doc.kind === "Document", 74); + var operations = doc.definitions + .filter(function (d) { return d.kind !== "FragmentDefinition"; }) + .map(function (definition) { + if (definition.kind !== "OperationDefinition") { + throw globals.newInvariantError(75, definition.kind); + } + return definition; + }); + globals.invariant(operations.length <= 1, 76, operations.length); + return doc; +} +function getOperationDefinition(doc) { + checkDocument(doc); + return doc.definitions.filter(function (definition) { + return definition.kind === "OperationDefinition"; + })[0]; +} +function getOperationName(doc) { + return (doc.definitions + .filter(function (definition) { + return definition.kind === "OperationDefinition" && !!definition.name; + }) + .map(function (x) { return x.name.value; })[0] || null); +} +function getFragmentDefinitions(doc) { + return doc.definitions.filter(function (definition) { + return definition.kind === "FragmentDefinition"; + }); +} +function getQueryDefinition(doc) { + var queryDef = getOperationDefinition(doc); + globals.invariant(queryDef && queryDef.operation === "query", 77); + return queryDef; +} +function getFragmentDefinition(doc) { + globals.invariant(doc.kind === "Document", 78); + globals.invariant(doc.definitions.length <= 1, 79); + var fragmentDef = doc.definitions[0]; + globals.invariant(fragmentDef.kind === "FragmentDefinition", 80); + return fragmentDef; +} +function getMainDefinition(queryDoc) { + checkDocument(queryDoc); + var fragmentDefinition; + for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { + var definition = _a[_i]; + if (definition.kind === "OperationDefinition") { + var operation = definition.operation; + if (operation === "query" || + operation === "mutation" || + operation === "subscription") { + return definition; + } + } + if (definition.kind === "FragmentDefinition" && !fragmentDefinition) { + fragmentDefinition = definition; + } + } + if (fragmentDefinition) { + return fragmentDefinition; + } + throw globals.newInvariantError(81); +} +function getDefaultValues(definition) { + var defaultValues = Object.create(null); + var defs = definition && definition.variableDefinitions; + if (defs && defs.length) { + defs.forEach(function (def) { + if (def.defaultValue) { + valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue); + } + }); + } + return defaultValues; +} + +function identity(document) { + return document; +} +var DocumentTransform = (function () { + function DocumentTransform(transform, options) { + if (options === void 0) { options = Object.create(null); } + this.resultCache = canUseWeakSet ? new WeakSet() : new Set(); + this.transform = transform; + if (options.getCacheKey) { + this.getCacheKey = options.getCacheKey; + } + this.cached = options.cache !== false; + this.resetCache(); + } + DocumentTransform.prototype.getCacheKey = function (document) { + return [document]; + }; + DocumentTransform.identity = function () { + return new DocumentTransform(identity, { cache: false }); + }; + DocumentTransform.split = function (predicate, left, right) { + if (right === void 0) { right = DocumentTransform.identity(); } + return Object.assign(new DocumentTransform(function (document) { + var documentTransform = predicate(document) ? left : right; + return documentTransform.transformDocument(document); + }, + { cache: false }), { left: left, right: right }); + }; + DocumentTransform.prototype.resetCache = function () { + var _this = this; + if (this.cached) { + var stableCacheKeys_1 = new trie.Trie(canUseWeakMap); + this.performWork = optimism.wrap(DocumentTransform.prototype.performWork.bind(this), { + makeCacheKey: function (document) { + var cacheKeys = _this.getCacheKey(document); + if (cacheKeys) { + globals.invariant(Array.isArray(cacheKeys), 66); + return stableCacheKeys_1.lookupArray(cacheKeys); + } + }, + max: cacheSizes["documentTransform.cache"], + cache: (caches.WeakCache), + }); + } + }; + DocumentTransform.prototype.performWork = function (document) { + checkDocument(document); + return this.transform(document); + }; + DocumentTransform.prototype.transformDocument = function (document) { + if (this.resultCache.has(document)) { + return document; + } + var transformedDocument = this.performWork(document); + this.resultCache.add(transformedDocument); + return transformedDocument; + }; + DocumentTransform.prototype.concat = function (otherTransform) { + var _this = this; + return Object.assign(new DocumentTransform(function (document) { + return otherTransform.transformDocument(_this.transformDocument(document)); + }, + { cache: false }), { + left: this, + right: otherTransform, + }); + }; + return DocumentTransform; +}()); + +var printCache; +var print = Object.assign(function (ast) { + var result = printCache.get(ast); + if (!result) { + result = graphql.print(ast); + printCache.set(ast, result); + } + return result; +}, { + reset: function () { + printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 ); + }, +}); +print.reset(); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("print", function () { return (printCache ? printCache.size : 0); }); +} + +var isArray = Array.isArray; +function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} + +var TYPENAME_FIELD = { + kind: graphql.Kind.FIELD, + name: { + kind: graphql.Kind.NAME, + value: "__typename", + }, +}; +function isEmpty(op, fragmentMap) { + return (!op || + op.selectionSet.selections.every(function (selection) { + return selection.kind === graphql.Kind.FRAGMENT_SPREAD && + isEmpty(fragmentMap[selection.name.value], fragmentMap); + })); +} +function nullIfDocIsEmpty(doc) { + return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ? + null + : doc; +} +function getDirectiveMatcher(configs) { + var names = new Map(); + var tests = new Map(); + configs.forEach(function (directive) { + if (directive) { + if (directive.name) { + names.set(directive.name, directive); + } + else if (directive.test) { + tests.set(directive.test, directive); + } + } + }); + return function (directive) { + var config = names.get(directive.name.value); + if (!config && tests.size) { + tests.forEach(function (testConfig, test) { + if (test(directive)) { + config = testConfig; + } + }); + } + return config; + }; +} +function makeInUseGetterFunction(defaultKey) { + var map = new Map(); + return function inUseGetterFunction(key) { + if (key === void 0) { key = defaultKey; } + var inUse = map.get(key); + if (!inUse) { + map.set(key, (inUse = { + variables: new Set(), + fragmentSpreads: new Set(), + })); + } + return inUse; + }; +} +function removeDirectivesFromDocument(directives, doc) { + checkDocument(doc); + var getInUseByOperationName = makeInUseGetterFunction(""); + var getInUseByFragmentName = makeInUseGetterFunction(""); + var getInUse = function (ancestors) { + for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) { + if (isArray(ancestor)) + continue; + if (ancestor.kind === graphql.Kind.OPERATION_DEFINITION) { + return getInUseByOperationName(ancestor.name && ancestor.name.value); + } + if (ancestor.kind === graphql.Kind.FRAGMENT_DEFINITION) { + return getInUseByFragmentName(ancestor.name.value); + } + } + globalThis.__DEV__ !== false && globals.invariant.error(83); + return null; + }; + var operationCount = 0; + for (var i = doc.definitions.length - 1; i >= 0; --i) { + if (doc.definitions[i].kind === graphql.Kind.OPERATION_DEFINITION) { + ++operationCount; + } + } + var directiveMatcher = getDirectiveMatcher(directives); + var shouldRemoveField = function (nodeDirectives) { + return isNonEmptyArray(nodeDirectives) && + nodeDirectives + .map(directiveMatcher) + .some(function (config) { return config && config.remove; }); + }; + var originalFragmentDefsByPath = new Map(); + var firstVisitMadeChanges = false; + var fieldOrInlineFragmentVisitor = { + enter: function (node) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + }, + }; + var docWithoutDirectiveSubtrees = graphql.visit(doc, { + Field: fieldOrInlineFragmentVisitor, + InlineFragment: fieldOrInlineFragmentVisitor, + VariableDefinition: { + enter: function () { + return false; + }, + }, + Variable: { + enter: function (node, _key, _parent, _path, ancestors) { + var inUse = getInUse(ancestors); + if (inUse) { + inUse.variables.add(node.name.value); + } + }, + }, + FragmentSpread: { + enter: function (node, _key, _parent, _path, ancestors) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + var inUse = getInUse(ancestors); + if (inUse) { + inUse.fragmentSpreads.add(node.name.value); + } + }, + }, + FragmentDefinition: { + enter: function (node, _key, _parent, path) { + originalFragmentDefsByPath.set(JSON.stringify(path), node); + }, + leave: function (node, _key, _parent, path) { + var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path)); + if (node === originalNode) { + return node; + } + if ( + operationCount > 0 && + node.selectionSet.selections.every(function (selection) { + return selection.kind === graphql.Kind.FIELD && + selection.name.value === "__typename"; + })) { + getInUseByFragmentName(node.name.value).removed = true; + firstVisitMadeChanges = true; + return null; + } + }, + }, + Directive: { + leave: function (node) { + if (directiveMatcher(node)) { + firstVisitMadeChanges = true; + return null; + } + }, + }, + }); + if (!firstVisitMadeChanges) { + return doc; + } + var populateTransitiveVars = function (inUse) { + if (!inUse.transitiveVars) { + inUse.transitiveVars = new Set(inUse.variables); + if (!inUse.removed) { + inUse.fragmentSpreads.forEach(function (childFragmentName) { + populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) { + inUse.transitiveVars.add(varName); + }); + }); + } + } + return inUse; + }; + var allFragmentNamesUsed = new Set(); + docWithoutDirectiveSubtrees.definitions.forEach(function (def) { + if (def.kind === graphql.Kind.OPERATION_DEFINITION) { + populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + } + else if (def.kind === graphql.Kind.FRAGMENT_DEFINITION && + operationCount === 0 && + !getInUseByFragmentName(def.name.value).removed) { + allFragmentNamesUsed.add(def.name.value); + } + }); + allFragmentNamesUsed.forEach(function (fragmentName) { + populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + }); + var fragmentWillBeRemoved = function (fragmentName) { + return !!( + (!allFragmentNamesUsed.has(fragmentName) || + getInUseByFragmentName(fragmentName).removed)); + }; + var enterVisitor = { + enter: function (node) { + if (fragmentWillBeRemoved(node.name.value)) { + return null; + } + }, + }; + return nullIfDocIsEmpty(graphql.visit(docWithoutDirectiveSubtrees, { + FragmentSpread: enterVisitor, + FragmentDefinition: enterVisitor, + OperationDefinition: { + leave: function (node) { + if (node.variableDefinitions) { + var usedVariableNames_1 = populateTransitiveVars( + getInUseByOperationName(node.name && node.name.value)).transitiveVars; + if (usedVariableNames_1.size < node.variableDefinitions.length) { + return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { + return usedVariableNames_1.has(varDef.variable.name.value); + }) }); + } + } + }, + }, + })); +} +var addTypenameToDocument = Object.assign(function (doc) { + return graphql.visit(doc, { + SelectionSet: { + enter: function (node, _key, parent) { + if (parent && + parent.kind === + graphql.Kind.OPERATION_DEFINITION) { + return; + } + var selections = node.selections; + if (!selections) { + return; + } + var skip = selections.some(function (selection) { + return (isField(selection) && + (selection.name.value === "__typename" || + selection.name.value.lastIndexOf("__", 0) === 0)); + }); + if (skip) { + return; + } + var field = parent; + if (isField(field) && + field.directives && + field.directives.some(function (d) { return d.name.value === "export"; })) { + return; + } + return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) }); + }, + }, + }); +}, { + added: function (field) { + return field === TYPENAME_FIELD; + }, +}); +var connectionRemoveConfig = { + test: function (directive) { + var willRemove = directive.name.value === "connection"; + if (willRemove) { + if (!directive.arguments || + !directive.arguments.some(function (arg) { return arg.name.value === "key"; })) { + globalThis.__DEV__ !== false && globals.invariant.warn(84); + } + } + return willRemove; + }, +}; +function removeConnectionDirectiveFromDocument(doc) { + return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); +} +function getArgumentMatcher(config) { + return function argumentMatcher(argument) { + return config.some(function (aConfig) { + return argument.value && + argument.value.kind === graphql.Kind.VARIABLE && + argument.value.name && + (aConfig.name === argument.value.name.value || + (aConfig.test && aConfig.test(argument))); + }); + }; +} +function removeArgumentsFromDocument(config, doc) { + var argMatcher = getArgumentMatcher(config); + return nullIfDocIsEmpty(graphql.visit(doc, { + OperationDefinition: { + enter: function (node) { + return tslib.__assign(tslib.__assign({}, node), { + variableDefinitions: node.variableDefinitions ? + node.variableDefinitions.filter(function (varDef) { + return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); + }) + : [] }); + }, + }, + Field: { + enter: function (node) { + var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); + if (shouldRemoveField) { + var argMatchCount_1 = 0; + if (node.arguments) { + node.arguments.forEach(function (arg) { + if (argMatcher(arg)) { + argMatchCount_1 += 1; + } + }); + } + if (argMatchCount_1 === 1) { + return null; + } + } + }, + }, + Argument: { + enter: function (node) { + if (argMatcher(node)) { + return null; + } + }, + }, + })); +} +function removeFragmentSpreadFromDocument(config, doc) { + function enter(node) { + if (config.some(function (def) { return def.name === node.name.value; })) { + return null; + } + } + return nullIfDocIsEmpty(graphql.visit(doc, { + FragmentSpread: { enter: enter }, + FragmentDefinition: { enter: enter }, + })); +} +function buildQueryFromSelectionSet(document) { + var definition = getMainDefinition(document); + var definitionOperation = definition.operation; + if (definitionOperation === "query") { + return document; + } + var modifiedDoc = graphql.visit(document, { + OperationDefinition: { + enter: function (node) { + return tslib.__assign(tslib.__assign({}, node), { operation: "query" }); + }, + }, + }); + return modifiedDoc; +} +function removeClientSetsFromDocument(document) { + checkDocument(document); + var modifiedDoc = removeDirectivesFromDocument([ + { + test: function (directive) { return directive.name.value === "client"; }, + remove: true, + }, + ], document); + return modifiedDoc; +} + +function isOperation(document, operation) { + var _a; + return ((_a = getOperationDefinition(document)) === null || _a === void 0 ? void 0 : _a.operation) === operation; +} +function isMutationOperation(document) { + return isOperation(document, "mutation"); +} +function isQueryOperation(document) { + return isOperation(document, "query"); +} +function isSubscriptionOperation(document) { + return isOperation(document, "subscription"); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function mergeDeep() { + var sources = []; + for (var _i = 0; _i < arguments.length; _i++) { + sources[_i] = arguments[_i]; + } + return mergeDeepArray(sources); +} +function mergeDeepArray(sources) { + var target = sources[0] || {}; + var count = sources.length; + if (count > 1) { + var merger = new DeepMerger(); + for (var i = 1; i < count; ++i) { + target = merger.merge(target, sources[i]); + } + } + return target; +} +var defaultReconciler = function (target, source, property) { + return this.merge(target[property], source[property]); +}; +var DeepMerger = (function () { + function DeepMerger(reconciler) { + if (reconciler === void 0) { reconciler = defaultReconciler; } + this.reconciler = reconciler; + this.isObject = isNonNullObject; + this.pastCopies = new Set(); + } + DeepMerger.prototype.merge = function (target, source) { + var _this = this; + var context = []; + for (var _i = 2; _i < arguments.length; _i++) { + context[_i - 2] = arguments[_i]; + } + if (isNonNullObject(source) && isNonNullObject(target)) { + Object.keys(source).forEach(function (sourceKey) { + if (hasOwnProperty.call(target, sourceKey)) { + var targetValue = target[sourceKey]; + if (source[sourceKey] !== targetValue) { + var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, + source, + sourceKey], context, false)); + if (result !== targetValue) { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = result; + } + } + } + else { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = source[sourceKey]; + } + }); + return target; + } + return source; + }; + DeepMerger.prototype.shallowCopyForMerge = function (value) { + if (isNonNullObject(value)) { + if (!this.pastCopies.has(value)) { + if (Array.isArray(value)) { + value = value.slice(0); + } + else { + value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + this.pastCopies.add(value); + } + } + return value; + }; + return DeepMerger; +}()); + +function concatPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming) { + return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing, true), incoming, true) : incoming; + }, + }; +} +function offsetLimitPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming, _a) { + var args = _a.args; + var merged = existing ? existing.slice(0) : []; + if (incoming) { + if (args) { + var _b = args.offset, offset = _b === void 0 ? 0 : _b; + for (var i = 0; i < incoming.length; ++i) { + merged[offset + i] = incoming[i]; + } + } + else { + merged.push.apply(merged, incoming); + } + } + return merged; + }, + }; +} +function relayStylePagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + read: function (existing, _a) { + var canRead = _a.canRead, readField = _a.readField; + if (!existing) + return existing; + var edges = []; + var firstEdgeCursor = ""; + var lastEdgeCursor = ""; + existing.edges.forEach(function (edge) { + if (canRead(readField("node", edge))) { + edges.push(edge); + if (edge.cursor) { + firstEdgeCursor = firstEdgeCursor || edge.cursor || ""; + lastEdgeCursor = edge.cursor || lastEdgeCursor; + } + } + }); + if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) { + firstEdgeCursor = ""; + } + var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor; + return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), { + startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) }); + }, + merge: function (existing, incoming, _a) { + var args = _a.args, isReference = _a.isReference, readField = _a.readField; + if (!existing) { + existing = makeEmptyData(); + } + if (!incoming) { + return existing; + } + var incomingEdges = incoming.edges ? + incoming.edges.map(function (edge) { + if (isReference((edge = tslib.__assign({}, edge)))) { + edge.cursor = readField("cursor", edge); + } + return edge; + }) + : []; + if (incoming.pageInfo) { + var pageInfo_1 = incoming.pageInfo; + var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor; + var firstEdge = incomingEdges[0]; + var lastEdge = incomingEdges[incomingEdges.length - 1]; + if (firstEdge && startCursor) { + firstEdge.cursor = startCursor; + } + if (lastEdge && endCursor) { + lastEdge.cursor = endCursor; + } + var firstCursor = firstEdge && firstEdge.cursor; + if (firstCursor && !startCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + startCursor: firstCursor, + }, + }); + } + var lastCursor = lastEdge && lastEdge.cursor; + if (lastCursor && !endCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + endCursor: lastCursor, + }, + }); + } + } + var prefix = existing.edges; + var suffix = []; + if (args && args.after) { + var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; }); + if (index >= 0) { + prefix = prefix.slice(0, index + 1); + } + } + else if (args && args.before) { + var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; }); + suffix = index < 0 ? prefix : prefix.slice(index); + prefix = []; + } + else if (incoming.edges) { + prefix = []; + } + var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix, true), incomingEdges, true), suffix, true); + var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo); + if (incoming.pageInfo) { + var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]); + Object.assign(pageInfo, extras); + if (!prefix.length) { + if (void 0 !== hasPreviousPage) + pageInfo.hasPreviousPage = hasPreviousPage; + if (void 0 !== startCursor) + pageInfo.startCursor = startCursor; + } + if (!suffix.length) { + if (void 0 !== hasNextPage) + pageInfo.hasNextPage = hasNextPage; + if (void 0 !== endCursor) + pageInfo.endCursor = endCursor; + } + } + return tslib.__assign(tslib.__assign(tslib.__assign({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo }); + }, + }; +} +var getExtras = function (obj) { return tslib.__rest(obj, notExtras); }; +var notExtras = ["edges", "pageInfo"]; +function makeEmptyData() { + return { + edges: [], + pageInfo: { + hasPreviousPage: false, + hasNextPage: true, + startCursor: "", + endCursor: "", + }, + }; +} + +function createFulfilledPromise(value) { + var promise = Promise.resolve(value); + promise.status = "fulfilled"; + promise.value = value; + return promise; +} +function createRejectedPromise(reason) { + var promise = Promise.reject(reason); + promise.catch(function () { }); + promise.status = "rejected"; + promise.reason = reason; + return promise; +} +function isStatefulPromise(promise) { + return "status" in promise; +} +function wrapPromiseWithState(promise) { + if (isStatefulPromise(promise)) { + return promise; + } + var pendingPromise = promise; + pendingPromise.status = "pending"; + pendingPromise.then(function (value) { + if (pendingPromise.status === "pending") { + var fulfilledPromise = pendingPromise; + fulfilledPromise.status = "fulfilled"; + fulfilledPromise.value = value; + } + }, function (reason) { + if (pendingPromise.status === "pending") { + var rejectedPromise = pendingPromise; + rejectedPromise.status = "rejected"; + rejectedPromise.reason = reason; + } + }); + return promise; +} + +var toString = Object.prototype.toString; +function cloneDeep(value) { + return cloneDeepHelper(value); +} +function cloneDeepHelper(val, seen) { + switch (toString.call(val)) { + case "[object Array]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + var copy_1 = val.slice(0); + seen.set(val, copy_1); + copy_1.forEach(function (child, i) { + copy_1[i] = cloneDeepHelper(child, seen); + }); + return copy_1; + } + case "[object Object]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + var copy_2 = Object.create(Object.getPrototypeOf(val)); + seen.set(val, copy_2); + Object.keys(val).forEach(function (key) { + copy_2[key] = cloneDeepHelper(val[key], seen); + }); + return copy_2; + } + default: + return val; + } +} + +function deepFreeze(value) { + var workSet = new Set([value]); + workSet.forEach(function (obj) { + if (isNonNullObject(obj) && shallowFreeze(obj) === obj) { + Object.getOwnPropertyNames(obj).forEach(function (name) { + if (isNonNullObject(obj[name])) + workSet.add(obj[name]); + }); + } + }); + return value; +} +function shallowFreeze(obj) { + if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) { + try { + Object.freeze(obj); + } + catch (e) { + if (e instanceof TypeError) + return null; + throw e; + } + } + return obj; +} +function maybeDeepFreeze(obj) { + if (globalThis.__DEV__ !== false) { + deepFreeze(obj); + } + return obj; +} + +function iterateObserversSafely(observers, method, argument) { + var observersWithMethod = []; + observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); + observersWithMethod.forEach(function (obs) { return obs[method](argument); }); +} + +function asyncMap(observable, mapFn, catchFn) { + return new zenObservableTs.Observable(function (observer) { + var promiseQueue = { + then: function (callback) { + return new Promise(function (resolve) { return resolve(callback()); }); + }, + }; + function makeCallback(examiner, key) { + return function (arg) { + if (examiner) { + var both = function () { + return observer.closed ? + 0 + : examiner(arg); + }; + promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); }); + } + else { + observer[key](arg); + } + }; + } + var handler = { + next: makeCallback(mapFn, "next"), + error: makeCallback(catchFn, "error"), + complete: function () { + promiseQueue.then(function () { return observer.complete(); }); + }, + }; + var sub = observable.subscribe(handler); + return function () { return sub.unsubscribe(); }; + }); +} + +function fixObservableSubclass(subclass) { + function set(key) { + Object.defineProperty(subclass, key, { value: zenObservableTs.Observable }); + } + if (canUseSymbol && Symbol.species) { + set(Symbol.species); + } + set("@@species"); + return subclass; +} + +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +var Concast = (function (_super) { + tslib.__extends(Concast, _super); + function Concast(sources) { + var _this = _super.call(this, function (observer) { + _this.addObserver(observer); + return function () { return _this.removeObserver(observer); }; + }) || this; + _this.observers = new Set(); + _this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + _this.handlers = { + next: function (result) { + if (_this.sub !== null) { + _this.latest = ["next", result]; + _this.notify("next", result); + iterateObserversSafely(_this.observers, "next", result); + } + }, + error: function (error) { + var sub = _this.sub; + if (sub !== null) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + _this.latest = ["error", error]; + _this.reject(error); + _this.notify("error", error); + iterateObserversSafely(_this.observers, "error", error); + } + }, + complete: function () { + var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b; + if (sub !== null) { + var value = sources.shift(); + if (!value) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + if (_this.latest && _this.latest[0] === "next") { + _this.resolve(_this.latest[1]); + } + else { + _this.resolve(); + } + _this.notify("complete"); + iterateObserversSafely(_this.observers, "complete"); + } + else if (isPromiseLike(value)) { + value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error); + } + else { + _this.sub = value.subscribe(_this.handlers); + } + } + }, + }; + _this.nextResultListeners = new Set(); + _this.cancel = function (reason) { + _this.reject(reason); + _this.sources = []; + _this.handlers.complete(); + }; + _this.promise.catch(function (_) { }); + if (typeof sources === "function") { + sources = [new zenObservableTs.Observable(sources)]; + } + if (isPromiseLike(sources)) { + sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error); + } + else { + _this.start(sources); + } + return _this; + } + Concast.prototype.start = function (sources) { + if (this.sub !== void 0) + return; + this.sources = Array.from(sources); + this.handlers.complete(); + }; + Concast.prototype.deliverLastMessage = function (observer) { + if (this.latest) { + var nextOrError = this.latest[0]; + var method = observer[nextOrError]; + if (method) { + method.call(observer, this.latest[1]); + } + if (this.sub === null && nextOrError === "next" && observer.complete) { + observer.complete(); + } + } + }; + Concast.prototype.addObserver = function (observer) { + if (!this.observers.has(observer)) { + this.deliverLastMessage(observer); + this.observers.add(observer); + } + }; + Concast.prototype.removeObserver = function (observer) { + if (this.observers.delete(observer) && this.observers.size < 1) { + this.handlers.complete(); + } + }; + Concast.prototype.notify = function (method, arg) { + var nextResultListeners = this.nextResultListeners; + if (nextResultListeners.size) { + this.nextResultListeners = new Set(); + nextResultListeners.forEach(function (listener) { return listener(method, arg); }); + } + }; + Concast.prototype.beforeNext = function (callback) { + var called = false; + this.nextResultListeners.add(function (method, arg) { + if (!called) { + called = true; + callback(method, arg); + } + }); + }; + return Concast; +}(zenObservableTs.Observable)); +fixObservableSubclass(Concast); + +function isExecutionPatchIncrementalResult(value) { + return "incremental" in value; +} +function isExecutionPatchInitialResult(value) { + return "hasNext" in value && "data" in value; +} +function isExecutionPatchResult(value) { + return (isExecutionPatchIncrementalResult(value) || + isExecutionPatchInitialResult(value)); +} +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} +function mergeIncrementalData(prevResult, result) { + var mergedData = prevResult; + var merger = new DeepMerger(); + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (_a) { + var data = _a.data, path = _a.path; + for (var i = path.length - 1; i >= 0; --i) { + var key = path[i]; + var isNumericKey = !isNaN(+key); + var parent_1 = isNumericKey ? [] : {}; + parent_1[key] = data; + data = parent_1; + } + mergedData = merger.merge(mergedData, data); + }); + } + return mergedData; +} + +function graphQLResultHasError(result) { + var errors = getGraphQLErrorsFromResult(result); + return isNonEmptyArray(errors); +} +function getGraphQLErrorsFromResult(result) { + var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (incrementalResult) { + if (incrementalResult.errors) { + graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors); + } + }); + } + return graphQLErrors; +} + +function compact() { + var objects = []; + for (var _i = 0; _i < arguments.length; _i++) { + objects[_i] = arguments[_i]; + } + var result = Object.create(null); + objects.forEach(function (obj) { + if (!obj) + return; + Object.keys(obj).forEach(function (key) { + var value = obj[key]; + if (value !== void 0) { + result[key] = value; + } + }); + }); + return result; +} + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} + +function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} + +function mergeOptions(defaults, options) { + return compact(defaults, options, options.variables && { + variables: compact(tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables)), + }); +} + +function omitDeep(value, key) { + return __omitDeep(value, key); +} +function __omitDeep(value, key, known) { + if (known === void 0) { known = new Map(); } + if (known.has(value)) { + return known.get(value); + } + var modified = false; + if (Array.isArray(value)) { + var array_1 = []; + known.set(value, array_1); + value.forEach(function (value, index) { + var result = __omitDeep(value, key, known); + modified || (modified = result !== value); + array_1[index] = result; + }); + if (modified) { + return array_1; + } + } + else if (isPlainObject(value)) { + var obj_1 = Object.create(Object.getPrototypeOf(value)); + known.set(value, obj_1); + Object.keys(value).forEach(function (k) { + if (k === key) { + modified = true; + return; + } + var result = __omitDeep(value[k], key, known); + modified || (modified = result !== value[k]); + obj_1[k] = result; + }); + if (modified) { + return obj_1; + } + } + return value; +} + +function stripTypename(value) { + return omitDeep(value, "__typename"); +} + +exports.DEV = globals.DEV; +exports.maybe = globals.maybe; +exports.Observable = zenObservableTs.Observable; +exports.AutoCleanedStrongCache = AutoCleanedStrongCache; +exports.AutoCleanedWeakCache = AutoCleanedWeakCache; +exports.Concast = Concast; +exports.DeepMerger = DeepMerger; +exports.DocumentTransform = DocumentTransform; +exports.addTypenameToDocument = addTypenameToDocument; +exports.argumentsObjectFromField = argumentsObjectFromField; +exports.asyncMap = asyncMap; +exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; +exports.cacheSizes = cacheSizes; +exports.canUseAsyncIteratorSymbol = canUseAsyncIteratorSymbol; +exports.canUseDOM = canUseDOM; +exports.canUseLayoutEffect = canUseLayoutEffect; +exports.canUseSymbol = canUseSymbol; +exports.canUseWeakMap = canUseWeakMap; +exports.canUseWeakSet = canUseWeakSet; +exports.canonicalStringify = canonicalStringify; +exports.checkDocument = checkDocument; +exports.cloneDeep = cloneDeep; +exports.compact = compact; +exports.concatPagination = concatPagination; +exports.createFragmentMap = createFragmentMap; +exports.createFulfilledPromise = createFulfilledPromise; +exports.createRejectedPromise = createRejectedPromise; +exports.fixObservableSubclass = fixObservableSubclass; +exports.getDefaultValues = getDefaultValues; +exports.getDirectiveNames = getDirectiveNames; +exports.getFragmentDefinition = getFragmentDefinition; +exports.getFragmentDefinitions = getFragmentDefinitions; +exports.getFragmentFromSelection = getFragmentFromSelection; +exports.getFragmentQueryDocument = getFragmentQueryDocument; +exports.getGraphQLErrorsFromResult = getGraphQLErrorsFromResult; +exports.getInclusionDirectives = getInclusionDirectives; +exports.getMainDefinition = getMainDefinition; +exports.getOperationDefinition = getOperationDefinition; +exports.getOperationName = getOperationName; +exports.getQueryDefinition = getQueryDefinition; +exports.getStoreKeyName = getStoreKeyName; +exports.getTypenameFromResult = getTypenameFromResult; +exports.graphQLResultHasError = graphQLResultHasError; +exports.hasAllDirectives = hasAllDirectives; +exports.hasAnyDirectives = hasAnyDirectives; +exports.hasClientExports = hasClientExports; +exports.hasDirectives = hasDirectives; +exports.isApolloPayloadResult = isApolloPayloadResult; +exports.isArray = isArray; +exports.isDocumentNode = isDocumentNode; +exports.isExecutionPatchIncrementalResult = isExecutionPatchIncrementalResult; +exports.isExecutionPatchInitialResult = isExecutionPatchInitialResult; +exports.isExecutionPatchResult = isExecutionPatchResult; +exports.isField = isField; +exports.isInlineFragment = isInlineFragment; +exports.isMutationOperation = isMutationOperation; +exports.isNonEmptyArray = isNonEmptyArray; +exports.isNonNullObject = isNonNullObject; +exports.isPlainObject = isPlainObject; +exports.isQueryOperation = isQueryOperation; +exports.isReference = isReference; +exports.isStatefulPromise = isStatefulPromise; +exports.isSubscriptionOperation = isSubscriptionOperation; +exports.iterateObserversSafely = iterateObserversSafely; +exports.makeReference = makeReference; +exports.makeUniqueId = makeUniqueId; +exports.maybeDeepFreeze = maybeDeepFreeze; +exports.mergeDeep = mergeDeep; +exports.mergeDeepArray = mergeDeepArray; +exports.mergeIncrementalData = mergeIncrementalData; +exports.mergeOptions = mergeOptions; +exports.offsetLimitPagination = offsetLimitPagination; +exports.omitDeep = omitDeep; +exports.print = print; +exports.relayStylePagination = relayStylePagination; +exports.removeArgumentsFromDocument = removeArgumentsFromDocument; +exports.removeClientSetsFromDocument = removeClientSetsFromDocument; +exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; +exports.removeDirectivesFromDocument = removeDirectivesFromDocument; +exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; +exports.resultKeyNameFromField = resultKeyNameFromField; +exports.shouldInclude = shouldInclude; +exports.storeKeyNameFromField = storeKeyNameFromField; +exports.stringifyForDisplay = stringifyForDisplay; +exports.stripTypename = stripTypename; +exports.valueToObjectRepresentation = valueToObjectRepresentation; +exports.wrapPromiseWithState = wrapPromiseWithState; +//# sourceMappingURL=utilities.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.map b/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.map new file mode 100644 index 0000000..d83ddf7 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"utilities.cjs","sources":["graphql/directives.js","common/canUse.js","common/objects.js","graphql/fragments.js","caching/caches.js","caching/sizes.js","caching/getMemoryInternals.js","common/canonicalStringify.js","graphql/storeUtils.js","graphql/getFromAST.js","graphql/DocumentTransform.js","graphql/print.js","common/arrays.js","graphql/transform.js","graphql/operations.js","common/mergeDeep.js","policies/pagination.js","promises/decoration.js","common/cloneDeep.js","common/maybeDeepFreeze.js","observables/iteration.js","observables/asyncMap.js","observables/subclassing.js","observables/Concast.js","common/incrementalResult.js","common/errorHandling.js","common/compact.js","common/makeUniqueId.js","common/stringifyForDisplay.js","common/mergeOptions.js","common/omitDeep.js","common/stripTypename.js"],"sourcesContent":["import { invariant } from \"../globals/index.js\";\nimport { visit, BREAK } from \"graphql\";\nexport function shouldInclude(_a, variables) {\n var directives = _a.directives;\n if (!directives || !directives.length) {\n return true;\n }\n return getInclusionDirectives(directives).every(function (_a) {\n var directive = _a.directive, ifArgument = _a.ifArgument;\n var evaledValue = false;\n if (ifArgument.value.kind === \"Variable\") {\n evaledValue =\n variables && variables[ifArgument.value.name.value];\n invariant(evaledValue !== void 0, 67, directive.name.value);\n }\n else {\n evaledValue = ifArgument.value.value;\n }\n return directive.name.value === \"skip\" ? !evaledValue : evaledValue;\n });\n}\nexport function getDirectiveNames(root) {\n var names = [];\n visit(root, {\n Directive: function (node) {\n names.push(node.name.value);\n },\n });\n return names;\n}\nexport var hasAnyDirectives = function (names, root) {\n return hasDirectives(names, root, false);\n};\nexport var hasAllDirectives = function (names, root) {\n return hasDirectives(names, root, true);\n};\nexport function hasDirectives(names, root, all) {\n var nameSet = new Set(names);\n var uniqueCount = nameSet.size;\n visit(root, {\n Directive: function (node) {\n if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) {\n return BREAK;\n }\n },\n });\n // If we found all the names, nameSet will be empty. If we only care about\n // finding some of them, the < condition is sufficient.\n return all ? !nameSet.size : nameSet.size < uniqueCount;\n}\nexport function hasClientExports(document) {\n return document && hasDirectives([\"client\", \"export\"], document, true);\n}\nfunction isInclusionDirective(_a) {\n var value = _a.name.value;\n return value === \"skip\" || value === \"include\";\n}\nexport function getInclusionDirectives(directives) {\n var result = [];\n if (directives && directives.length) {\n directives.forEach(function (directive) {\n if (!isInclusionDirective(directive))\n return;\n var directiveArguments = directive.arguments;\n var directiveName = directive.name.value;\n invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName);\n var ifArgument = directiveArguments[0];\n invariant(ifArgument.name && ifArgument.name.value === \"if\", 69, directiveName);\n var ifValue = ifArgument.value;\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\"), 70, directiveName);\n result.push({ directive: directive, ifArgument: ifArgument });\n });\n }\n return result;\n}\n//# sourceMappingURL=directives.js.map","import { maybe } from \"../globals/index.js\";\nexport var canUseWeakMap = typeof WeakMap === \"function\" &&\n !maybe(function () { return navigator.product == \"ReactNative\" && !global.HermesInternal; });\nexport var canUseWeakSet = typeof WeakSet === \"function\";\nexport var canUseSymbol = typeof Symbol === \"function\" && typeof Symbol.for === \"function\";\nexport var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;\nexport var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === \"function\";\nvar usingJSDOM = \n// Following advice found in this comment from @domenic (maintainer of jsdom):\n// https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327\n//\n// Since we control the version of Jest and jsdom used when running Apollo\n// Client tests, and that version is recent enought to include \" jsdom/x.y.z\"\n// at the end of the user agent string, I believe this case is all we need to\n// check. Testing for \"Node.js\" was recommended for backwards compatibility\n// with older version of jsdom, but we don't have that problem.\nmaybe(function () { return navigator.userAgent.indexOf(\"jsdom\") >= 0; }) || false;\n// Our tests should all continue to pass if we remove this !usingJSDOM\n// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,\n// if we allow useLayoutEffect, then useSyncExternalStore generates many\n// warnings about useLayoutEffect doing nothing on the server. While these\n// warnings are harmless, this !usingJSDOM condition seems to be the best way to\n// prevent them (i.e. skipping useLayoutEffect when using jsdom).\nexport var canUseLayoutEffect = canUseDOM && !usingJSDOM;\n//# sourceMappingURL=canUse.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === \"object\";\n}\nexport function isPlainObject(obj) {\n return (obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null));\n}\n//# sourceMappingURL=objects.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { invariant, newInvariantError } from \"../globals/index.js\";\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(document, fragmentName) {\n var actualFragmentName = fragmentName;\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n var fragments = [];\n document.definitions.forEach(function (definition) {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === \"OperationDefinition\") {\n throw newInvariantError(\n 71,\n definition.operation,\n definition.name ? \" named '\".concat(definition.name.value, \"'\") : \"\"\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === \"FragmentDefinition\") {\n fragments.push(definition);\n }\n });\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === \"undefined\") {\n invariant(fragments.length === 1, 72, fragments.length);\n actualFragmentName = fragments[0].name.value;\n }\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n var query = __assign(__assign({}, document), { definitions: __spreadArray([\n {\n kind: \"OperationDefinition\",\n // OperationTypeNode is an enum\n operation: \"query\",\n selectionSet: {\n kind: \"SelectionSet\",\n selections: [\n {\n kind: \"FragmentSpread\",\n name: {\n kind: \"Name\",\n value: actualFragmentName,\n },\n },\n ],\n },\n }\n ], document.definitions, true) });\n return query;\n}\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(fragments) {\n if (fragments === void 0) { fragments = []; }\n var symTable = {};\n fragments.forEach(function (fragment) {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\nexport function getFragmentFromSelection(selection, fragmentMap) {\n switch (selection.kind) {\n case \"InlineFragment\":\n return selection;\n case \"FragmentSpread\": {\n var fragmentName = selection.name.value;\n if (typeof fragmentMap === \"function\") {\n return fragmentMap(fragmentName);\n }\n var fragment = fragmentMap && fragmentMap[fragmentName];\n invariant(fragment, 73, fragmentName);\n return fragment || null;\n }\n default:\n return null;\n }\n}\n//# sourceMappingURL=fragments.js.map","import { WeakCache, StrongCache } from \"@wry/caches\";\nvar scheduledCleanup = new WeakSet();\nfunction schedule(cache) {\n if (!scheduledCleanup.has(cache)) {\n scheduledCleanup.add(cache);\n setTimeout(function () {\n cache.clean();\n scheduledCleanup.delete(cache);\n }, 100);\n }\n}\n/**\n * @internal\n * A version of WeakCache that will auto-schedule a cleanup of the cache when\n * a new item is added.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of WeakCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `WeakCache`.\n */\nexport var AutoCleanedWeakCache = function (max, dispose) {\n /*\n Some builds of `WeakCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n var cache = new WeakCache(max, dispose);\n cache.set = function (key, value) {\n schedule(this);\n return WeakCache.prototype.set.call(this, key, value);\n };\n return cache;\n};\n/**\n * @internal\n * A version of StrongCache that will auto-schedule a cleanup of the cache when\n * a new item is added.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of StrongCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `StrongCache`.\n */\nexport var AutoCleanedStrongCache = function (max, dispose) {\n /*\n Some builds of `StrongCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n var cache = new StrongCache(max, dispose);\n cache.set = function (key, value) {\n schedule(this);\n return StrongCache.prototype.set.call(this, key, value);\n };\n return cache;\n};\n//# sourceMappingURL=caches.js.map","import { __assign } from \"tslib\";\nimport { global } from \"../globals/index.js\";\nvar cacheSizeSymbol = Symbol.for(\"apollo.cacheSize\");\n/**\n *\n * The global cache size configuration for Apollo Client.\n *\n * @remarks\n *\n * You can directly modify this object, but any modification will\n * only have an effect on caches that are created after the modification.\n *\n * So for global caches, such as `parser`, `canonicalStringify` and `print`,\n * you might need to call `.reset` on them, which will essentially re-create them.\n *\n * Alternatively, you can set `globalThis[Symbol.for(\"apollo.cacheSize\")]` before\n * you load the Apollo Client package:\n *\n * @example\n * ```ts\n * globalThis[Symbol.for(\"apollo.cacheSize\")] = {\n * parser: 100\n * } satisfies Partial // the `satisfies` is optional if using TypeScript\n * ```\n */\nexport var cacheSizes = __assign({}, global[cacheSizeSymbol]);\n//# sourceMappingURL=sizes.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { AutoCleanedStrongCache, cacheSizes, } from \"../../utilities/caching/index.js\";\nimport { registerGlobalCache } from \"../caching/getMemoryInternals.js\";\n/**\n * Like JSON.stringify, but with object keys always sorted in the same order.\n *\n * To achieve performant sorting, this function uses a Map from JSON-serialized\n * arrays of keys (in any order) to sorted arrays of the same keys, with a\n * single sorted array reference shared by all permutations of the keys.\n *\n * As a drawback, this function will add a little bit more memory for every\n * object encountered that has different (more, less, a different order of) keys\n * than in the past.\n *\n * In a typical application, this extra memory usage should not play a\n * significant role, as `canonicalStringify` will be called for only a limited\n * number of object shapes, and the cache will not grow beyond a certain point.\n * But in some edge cases, this could be a problem, so we provide\n * canonicalStringify.reset() as a way of clearing the cache.\n * */\nexport var canonicalStringify = Object.assign(function canonicalStringify(value) {\n return JSON.stringify(value, stableObjectReplacer);\n}, {\n reset: function () {\n // Clearing the sortingMap will reclaim all cached memory, without\n // affecting the logical results of canonicalStringify, but potentially\n // sacrificing performance until the cache is refilled.\n sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 /* defaultCacheSizes.canonicalStringify */);\n },\n});\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"canonicalStringify\", function () { return sortingMap.size; });\n}\n// Values are JSON-serialized arrays of object keys (in any order), and values\n// are sorted arrays of the same keys.\nvar sortingMap;\ncanonicalStringify.reset();\n// The JSON.stringify function takes an optional second argument called a\n// replacer function. This function is called for each key-value pair in the\n// object being stringified, and its return value is used instead of the\n// original value. If the replacer function returns a new value, that value is\n// stringified as JSON instead of the original value of the property.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter\nfunction stableObjectReplacer(key, value) {\n if (value && typeof value === \"object\") {\n var proto = Object.getPrototypeOf(value);\n // We don't want to mess with objects that are not \"plain\" objects, which\n // means their prototype is either Object.prototype or null. This check also\n // prevents needlessly rearranging the indices of arrays.\n if (proto === Object.prototype || proto === null) {\n var keys = Object.keys(value);\n // If keys is already sorted, let JSON.stringify serialize the original\n // value instead of creating a new object with keys in the same order.\n if (keys.every(everyKeyInOrder))\n return value;\n var unsortedKey = JSON.stringify(keys);\n var sortedKeys = sortingMap.get(unsortedKey);\n if (!sortedKeys) {\n keys.sort();\n var sortedKey = JSON.stringify(keys);\n // Checking for sortedKey in the sortingMap allows us to share the same\n // sorted array reference for all permutations of the same set of keys.\n sortedKeys = sortingMap.get(sortedKey) || keys;\n sortingMap.set(unsortedKey, sortedKeys);\n sortingMap.set(sortedKey, sortedKeys);\n }\n var sortedObject_1 = Object.create(proto);\n // Reassigning the keys in sorted order will cause JSON.stringify to\n // serialize them in sorted order.\n sortedKeys.forEach(function (key) {\n sortedObject_1[key] = value[key];\n });\n return sortedObject_1;\n }\n }\n return value;\n}\n// Since everything that happens in stableObjectReplacer benefits from being as\n// efficient as possible, we use a static function as the callback for\n// keys.every in order to test if the provided keys are already sorted without\n// allocating extra memory for a callback.\nfunction everyKeyInOrder(key, i, keys) {\n return i === 0 || keys[i - 1] <= key;\n}\n//# sourceMappingURL=canonicalStringify.js.map","import { newInvariantError } from \"../globals/index.js\";\nimport { isNonNullObject } from \"../common/objects.js\";\nimport { getFragmentFromSelection } from \"./fragments.js\";\nimport { canonicalStringify } from \"../common/canonicalStringify.js\";\nexport function makeReference(id) {\n return { __ref: String(id) };\n}\nexport function isReference(obj) {\n return Boolean(obj && typeof obj === \"object\" && typeof obj.__ref === \"string\");\n}\nexport function isDocumentNode(value) {\n return (isNonNullObject(value) &&\n value.kind === \"Document\" &&\n Array.isArray(value.definitions));\n}\nfunction isStringValue(value) {\n return value.kind === \"StringValue\";\n}\nfunction isBooleanValue(value) {\n return value.kind === \"BooleanValue\";\n}\nfunction isIntValue(value) {\n return value.kind === \"IntValue\";\n}\nfunction isFloatValue(value) {\n return value.kind === \"FloatValue\";\n}\nfunction isVariable(value) {\n return value.kind === \"Variable\";\n}\nfunction isObjectValue(value) {\n return value.kind === \"ObjectValue\";\n}\nfunction isListValue(value) {\n return value.kind === \"ListValue\";\n}\nfunction isEnumValue(value) {\n return value.kind === \"EnumValue\";\n}\nfunction isNullValue(value) {\n return value.kind === \"NullValue\";\n}\nexport function valueToObjectRepresentation(argObj, name, value, variables) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n }\n else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isObjectValue(value)) {\n var nestedArgObj_1 = {};\n value.fields.map(function (obj) {\n return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables);\n });\n argObj[name.value] = nestedArgObj_1;\n }\n else if (isVariable(value)) {\n var variableValue = (variables || {})[value.name.value];\n argObj[name.value] = variableValue;\n }\n else if (isListValue(value)) {\n argObj[name.value] = value.values.map(function (listValue) {\n var nestedArgArrayObj = {};\n valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables);\n return nestedArgArrayObj[name.value];\n });\n }\n else if (isEnumValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isNullValue(value)) {\n argObj[name.value] = null;\n }\n else {\n throw newInvariantError(82, name.value, value.kind);\n }\n}\nexport function storeKeyNameFromField(field, variables) {\n var directivesObj = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(function (directive) {\n directivesObj[directive.name.value] = {};\n if (directive.arguments) {\n directive.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables);\n });\n }\n });\n }\n var argObj = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj, name, value, variables);\n });\n }\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\nvar KNOWN_DIRECTIVES = [\n \"connection\",\n \"include\",\n \"skip\",\n \"client\",\n \"rest\",\n \"export\",\n \"nonreactive\",\n];\n// Default stable JSON.stringify implementation used by getStoreKeyName. Can be\n// updated/replaced with something better by calling\n// getStoreKeyName.setStringify(newStringifyFunction).\nvar storeKeyNameStringify = canonicalStringify;\nexport var getStoreKeyName = Object.assign(function (fieldName, args, directives) {\n if (args &&\n directives &&\n directives[\"connection\"] &&\n directives[\"connection\"][\"key\"]) {\n if (directives[\"connection\"][\"filter\"] &&\n directives[\"connection\"][\"filter\"].length > 0) {\n var filterKeys = directives[\"connection\"][\"filter\"] ?\n directives[\"connection\"][\"filter\"]\n : [];\n filterKeys.sort();\n var filteredArgs_1 = {};\n filterKeys.forEach(function (key) {\n filteredArgs_1[key] = args[key];\n });\n return \"\".concat(directives[\"connection\"][\"key\"], \"(\").concat(storeKeyNameStringify(filteredArgs_1), \")\");\n }\n else {\n return directives[\"connection\"][\"key\"];\n }\n }\n var completeFieldName = fieldName;\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n var stringifiedArgs = storeKeyNameStringify(args);\n completeFieldName += \"(\".concat(stringifiedArgs, \")\");\n }\n if (directives) {\n Object.keys(directives).forEach(function (key) {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1)\n return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += \"@\".concat(key, \"(\").concat(storeKeyNameStringify(directives[key]), \")\");\n }\n else {\n completeFieldName += \"@\".concat(key);\n }\n });\n }\n return completeFieldName;\n}, {\n setStringify: function (s) {\n var previous = storeKeyNameStringify;\n storeKeyNameStringify = s;\n return previous;\n },\n});\nexport function argumentsObjectFromField(field, variables) {\n if (field.arguments && field.arguments.length) {\n var argObj_1 = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj_1, name, value, variables);\n });\n return argObj_1;\n }\n return null;\n}\nexport function resultKeyNameFromField(field) {\n return field.alias ? field.alias.value : field.name.value;\n}\nexport function getTypenameFromResult(result, selectionSet, fragmentMap) {\n var fragments;\n for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {\n var selection = _a[_i];\n if (isField(selection)) {\n if (selection.name.value === \"__typename\") {\n return result[resultKeyNameFromField(selection)];\n }\n }\n else if (fragments) {\n fragments.push(selection);\n }\n else {\n fragments = [selection];\n }\n }\n if (typeof result.__typename === \"string\") {\n return result.__typename;\n }\n if (fragments) {\n for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {\n var selection = fragments_1[_b];\n var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);\n if (typeof typename === \"string\") {\n return typename;\n }\n }\n }\n}\nexport function isField(selection) {\n return selection.kind === \"Field\";\n}\nexport function isInlineFragment(selection) {\n return selection.kind === \"InlineFragment\";\n}\n//# sourceMappingURL=storeUtils.js.map","import { invariant, newInvariantError } from \"../globals/index.js\";\nimport { valueToObjectRepresentation } from \"./storeUtils.js\";\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc) {\n invariant(doc && doc.kind === \"Document\", 74);\n var operations = doc.definitions\n .filter(function (d) { return d.kind !== \"FragmentDefinition\"; })\n .map(function (definition) {\n if (definition.kind !== \"OperationDefinition\") {\n throw newInvariantError(75, definition.kind);\n }\n return definition;\n });\n invariant(operations.length <= 1, 76, operations.length);\n return doc;\n}\nexport function getOperationDefinition(doc) {\n checkDocument(doc);\n return doc.definitions.filter(function (definition) {\n return definition.kind === \"OperationDefinition\";\n })[0];\n}\nexport function getOperationName(doc) {\n return (doc.definitions\n .filter(function (definition) {\n return definition.kind === \"OperationDefinition\" && !!definition.name;\n })\n .map(function (x) { return x.name.value; })[0] || null);\n}\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(doc) {\n return doc.definitions.filter(function (definition) {\n return definition.kind === \"FragmentDefinition\";\n });\n}\nexport function getQueryDefinition(doc) {\n var queryDef = getOperationDefinition(doc);\n invariant(queryDef && queryDef.operation === \"query\", 77);\n return queryDef;\n}\nexport function getFragmentDefinition(doc) {\n invariant(doc.kind === \"Document\", 78);\n invariant(doc.definitions.length <= 1, 79);\n var fragmentDef = doc.definitions[0];\n invariant(fragmentDef.kind === \"FragmentDefinition\", 80);\n return fragmentDef;\n}\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(queryDoc) {\n checkDocument(queryDoc);\n var fragmentDefinition;\n for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) {\n var definition = _a[_i];\n if (definition.kind === \"OperationDefinition\") {\n var operation = definition.operation;\n if (operation === \"query\" ||\n operation === \"mutation\" ||\n operation === \"subscription\") {\n return definition;\n }\n }\n if (definition.kind === \"FragmentDefinition\" && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition;\n }\n }\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n throw newInvariantError(81);\n}\nexport function getDefaultValues(definition) {\n var defaultValues = Object.create(null);\n var defs = definition && definition.variableDefinitions;\n if (defs && defs.length) {\n defs.forEach(function (def) {\n if (def.defaultValue) {\n valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue);\n }\n });\n }\n return defaultValues;\n}\n//# sourceMappingURL=getFromAST.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap, canUseWeakSet } from \"../common/canUse.js\";\nimport { checkDocument } from \"./getFromAST.js\";\nimport { invariant } from \"../globals/index.js\";\nimport { WeakCache } from \"@wry/caches\";\nimport { wrap } from \"optimism\";\nimport { cacheSizes } from \"../caching/index.js\";\nfunction identity(document) {\n return document;\n}\nvar DocumentTransform = /** @class */ (function () {\n function DocumentTransform(transform, options) {\n if (options === void 0) { options = Object.create(null); }\n this.resultCache = canUseWeakSet ? new WeakSet() : new Set();\n this.transform = transform;\n if (options.getCacheKey) {\n // Override default `getCacheKey` function, which returns [document].\n this.getCacheKey = options.getCacheKey;\n }\n this.cached = options.cache !== false;\n this.resetCache();\n }\n // This default implementation of getCacheKey can be overridden by providing\n // options.getCacheKey to the DocumentTransform constructor. In general, a\n // getCacheKey function may either return an array of keys (often including\n // the document) to be used as a cache key, or undefined to indicate the\n // transform for this document should not be cached.\n DocumentTransform.prototype.getCacheKey = function (document) {\n return [document];\n };\n DocumentTransform.identity = function () {\n // No need to cache this transform since it just returns the document\n // unchanged. This should save a bit of memory that would otherwise be\n // needed to populate the `documentCache` of this transform.\n return new DocumentTransform(identity, { cache: false });\n };\n DocumentTransform.split = function (predicate, left, right) {\n if (right === void 0) { right = DocumentTransform.identity(); }\n return Object.assign(new DocumentTransform(function (document) {\n var documentTransform = predicate(document) ? left : right;\n return documentTransform.transformDocument(document);\n }, \n // Reasonably assume both `left` and `right` transforms handle their own caching\n { cache: false }), { left: left, right: right });\n };\n /**\n * Resets the internal cache of this transform, if it has one.\n */\n DocumentTransform.prototype.resetCache = function () {\n var _this = this;\n if (this.cached) {\n var stableCacheKeys_1 = new Trie(canUseWeakMap);\n this.performWork = wrap(DocumentTransform.prototype.performWork.bind(this), {\n makeCacheKey: function (document) {\n var cacheKeys = _this.getCacheKey(document);\n if (cacheKeys) {\n invariant(Array.isArray(cacheKeys), 66);\n return stableCacheKeys_1.lookupArray(cacheKeys);\n }\n },\n max: cacheSizes[\"documentTransform.cache\"],\n cache: (WeakCache),\n });\n }\n };\n DocumentTransform.prototype.performWork = function (document) {\n checkDocument(document);\n return this.transform(document);\n };\n DocumentTransform.prototype.transformDocument = function (document) {\n // If a user passes an already transformed result back to this function,\n // immediately return it.\n if (this.resultCache.has(document)) {\n return document;\n }\n var transformedDocument = this.performWork(document);\n this.resultCache.add(transformedDocument);\n return transformedDocument;\n };\n DocumentTransform.prototype.concat = function (otherTransform) {\n var _this = this;\n return Object.assign(new DocumentTransform(function (document) {\n return otherTransform.transformDocument(_this.transformDocument(document));\n }, \n // Reasonably assume both transforms handle their own caching\n { cache: false }), {\n left: this,\n right: otherTransform,\n });\n };\n return DocumentTransform;\n}());\nexport { DocumentTransform };\n//# sourceMappingURL=DocumentTransform.js.map","import { print as origPrint } from \"graphql\";\nimport { AutoCleanedWeakCache, cacheSizes, } from \"../caching/index.js\";\nimport { registerGlobalCache } from \"../caching/getMemoryInternals.js\";\nvar printCache;\nexport var print = Object.assign(function (ast) {\n var result = printCache.get(ast);\n if (!result) {\n result = origPrint(ast);\n printCache.set(ast, result);\n }\n return result;\n}, {\n reset: function () {\n printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 /* defaultCacheSizes.print */);\n },\n});\nprint.reset();\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"print\", function () { return (printCache ? printCache.size : 0); });\n}\n//# sourceMappingURL=print.js.map","// A version of Array.isArray that works better with readonly arrays.\nexport var isArray = Array.isArray;\nexport function isNonEmptyArray(value) {\n return Array.isArray(value) && value.length > 0;\n}\n//# sourceMappingURL=arrays.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { invariant } from \"../globals/index.js\";\nimport { visit, Kind } from \"graphql\";\nimport { checkDocument, getOperationDefinition, getFragmentDefinition, getFragmentDefinitions, getMainDefinition, } from \"./getFromAST.js\";\nimport { isField } from \"./storeUtils.js\";\nimport { createFragmentMap } from \"./fragments.js\";\nimport { isArray, isNonEmptyArray } from \"../common/arrays.js\";\nvar TYPENAME_FIELD = {\n kind: Kind.FIELD,\n name: {\n kind: Kind.NAME,\n value: \"__typename\",\n },\n};\nfunction isEmpty(op, fragmentMap) {\n return (!op ||\n op.selectionSet.selections.every(function (selection) {\n return selection.kind === Kind.FRAGMENT_SPREAD &&\n isEmpty(fragmentMap[selection.name.value], fragmentMap);\n }));\n}\nfunction nullIfDocIsEmpty(doc) {\n return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ?\n null\n : doc;\n}\nfunction getDirectiveMatcher(configs) {\n var names = new Map();\n var tests = new Map();\n configs.forEach(function (directive) {\n if (directive) {\n if (directive.name) {\n names.set(directive.name, directive);\n }\n else if (directive.test) {\n tests.set(directive.test, directive);\n }\n }\n });\n return function (directive) {\n var config = names.get(directive.name.value);\n if (!config && tests.size) {\n tests.forEach(function (testConfig, test) {\n if (test(directive)) {\n config = testConfig;\n }\n });\n }\n return config;\n };\n}\nfunction makeInUseGetterFunction(defaultKey) {\n var map = new Map();\n return function inUseGetterFunction(key) {\n if (key === void 0) { key = defaultKey; }\n var inUse = map.get(key);\n if (!inUse) {\n map.set(key, (inUse = {\n // Variable and fragment spread names used directly within this\n // operation or fragment definition, as identified by key. These sets\n // will be populated during the first traversal of the document in\n // removeDirectivesFromDocument below.\n variables: new Set(),\n fragmentSpreads: new Set(),\n }));\n }\n return inUse;\n };\n}\nexport function removeDirectivesFromDocument(directives, doc) {\n checkDocument(doc);\n // Passing empty strings to makeInUseGetterFunction means we handle anonymous\n // operations as if their names were \"\". Anonymous fragment definitions are\n // not supposed to be possible, but the same default naming strategy seems\n // appropriate for that case as well.\n var getInUseByOperationName = makeInUseGetterFunction(\"\");\n var getInUseByFragmentName = makeInUseGetterFunction(\"\");\n var getInUse = function (ancestors) {\n for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) {\n if (isArray(ancestor))\n continue;\n if (ancestor.kind === Kind.OPERATION_DEFINITION) {\n // If an operation is anonymous, we use the empty string as its key.\n return getInUseByOperationName(ancestor.name && ancestor.name.value);\n }\n if (ancestor.kind === Kind.FRAGMENT_DEFINITION) {\n return getInUseByFragmentName(ancestor.name.value);\n }\n }\n globalThis.__DEV__ !== false && invariant.error(83);\n return null;\n };\n var operationCount = 0;\n for (var i = doc.definitions.length - 1; i >= 0; --i) {\n if (doc.definitions[i].kind === Kind.OPERATION_DEFINITION) {\n ++operationCount;\n }\n }\n var directiveMatcher = getDirectiveMatcher(directives);\n var shouldRemoveField = function (nodeDirectives) {\n return isNonEmptyArray(nodeDirectives) &&\n nodeDirectives\n .map(directiveMatcher)\n .some(function (config) { return config && config.remove; });\n };\n var originalFragmentDefsByPath = new Map();\n // Any time the first traversal of the document below makes a change like\n // removing a fragment (by returning null), this variable should be set to\n // true. Once it becomes true, it should never be set to false again. If this\n // variable remains false throughout the traversal, then we can return the\n // original doc immediately without any modifications.\n var firstVisitMadeChanges = false;\n var fieldOrInlineFragmentVisitor = {\n enter: function (node) {\n if (shouldRemoveField(node.directives)) {\n firstVisitMadeChanges = true;\n return null;\n }\n },\n };\n var docWithoutDirectiveSubtrees = visit(doc, {\n // These two AST node types share the same implementation, defined above.\n Field: fieldOrInlineFragmentVisitor,\n InlineFragment: fieldOrInlineFragmentVisitor,\n VariableDefinition: {\n enter: function () {\n // VariableDefinition nodes do not count as variables in use, though\n // they do contain Variable nodes that might be visited below. To avoid\n // counting variable declarations as usages, we skip visiting the\n // contents of this VariableDefinition node by returning false.\n return false;\n },\n },\n Variable: {\n enter: function (node, _key, _parent, _path, ancestors) {\n var inUse = getInUse(ancestors);\n if (inUse) {\n inUse.variables.add(node.name.value);\n }\n },\n },\n FragmentSpread: {\n enter: function (node, _key, _parent, _path, ancestors) {\n if (shouldRemoveField(node.directives)) {\n firstVisitMadeChanges = true;\n return null;\n }\n var inUse = getInUse(ancestors);\n if (inUse) {\n inUse.fragmentSpreads.add(node.name.value);\n }\n // We might like to remove this FragmentSpread by returning null here if\n // the corresponding FragmentDefinition node is also going to be removed\n // by the logic below, but we can't control the relative order of those\n // events, so we have to postpone the removal of dangling FragmentSpread\n // nodes until after the current visit of the document has finished.\n },\n },\n FragmentDefinition: {\n enter: function (node, _key, _parent, path) {\n originalFragmentDefsByPath.set(JSON.stringify(path), node);\n },\n leave: function (node, _key, _parent, path) {\n var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path));\n if (node === originalNode) {\n // If the FragmentNode received by this leave function is identical to\n // the one received by the corresponding enter function (above), then\n // the visitor must not have made any changes within this\n // FragmentDefinition node. This fragment definition may still be\n // removed if there are no ...spread references to it, but it won't be\n // removed just because it has only a __typename field.\n return node;\n }\n if (\n // This logic applies only if the document contains one or more\n // operations, since removing all fragments from a document containing\n // only fragments makes the document useless.\n operationCount > 0 &&\n node.selectionSet.selections.every(function (selection) {\n return selection.kind === Kind.FIELD &&\n selection.name.value === \"__typename\";\n })) {\n // This is a somewhat opinionated choice: if a FragmentDefinition ends\n // up having no fields other than __typename, we remove the whole\n // fragment definition, and later prune ...spread references to it.\n getInUseByFragmentName(node.name.value).removed = true;\n firstVisitMadeChanges = true;\n return null;\n }\n },\n },\n Directive: {\n leave: function (node) {\n // If a matching directive is found, remove the directive itself. Note\n // that this does not remove the target (field, argument, etc) of the\n // directive, but only the directive itself.\n if (directiveMatcher(node)) {\n firstVisitMadeChanges = true;\n return null;\n }\n },\n },\n });\n if (!firstVisitMadeChanges) {\n // If our first pass did not change anything about the document, then there\n // is no cleanup we need to do, and we can return the original doc.\n return doc;\n }\n // Utility for making sure inUse.transitiveVars is recursively populated.\n // Because this logic assumes inUse.fragmentSpreads has been completely\n // populated and inUse.removed has been set if appropriate,\n // populateTransitiveVars must be called after that information has been\n // collected by the first traversal of the document.\n var populateTransitiveVars = function (inUse) {\n if (!inUse.transitiveVars) {\n inUse.transitiveVars = new Set(inUse.variables);\n if (!inUse.removed) {\n inUse.fragmentSpreads.forEach(function (childFragmentName) {\n populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) {\n inUse.transitiveVars.add(varName);\n });\n });\n }\n }\n return inUse;\n };\n // Since we've been keeping track of fragment spreads used by particular\n // operations and fragment definitions, we now need to compute the set of all\n // spreads used (transitively) by any operations in the document.\n var allFragmentNamesUsed = new Set();\n docWithoutDirectiveSubtrees.definitions.forEach(function (def) {\n if (def.kind === Kind.OPERATION_DEFINITION) {\n populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) {\n allFragmentNamesUsed.add(childFragmentName);\n });\n }\n else if (def.kind === Kind.FRAGMENT_DEFINITION &&\n // If there are no operations in the document, then all fragment\n // definitions count as usages of their own fragment names. This heuristic\n // prevents accidentally removing all fragment definitions from the\n // document just because it contains no operations that use the fragments.\n operationCount === 0 &&\n !getInUseByFragmentName(def.name.value).removed) {\n allFragmentNamesUsed.add(def.name.value);\n }\n });\n // Now that we have added all fragment spreads used by operations to the\n // allFragmentNamesUsed set, we can complete the set by transitively adding\n // all fragment spreads used by those fragments, and so on.\n allFragmentNamesUsed.forEach(function (fragmentName) {\n // Once all the childFragmentName strings added here have been seen already,\n // the top-level allFragmentNamesUsed.forEach loop will terminate.\n populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) {\n allFragmentNamesUsed.add(childFragmentName);\n });\n });\n var fragmentWillBeRemoved = function (fragmentName) {\n return !!(\n // A fragment definition will be removed if there are no spreads that refer\n // to it, or the fragment was explicitly removed because it had no fields\n // other than __typename.\n (!allFragmentNamesUsed.has(fragmentName) ||\n getInUseByFragmentName(fragmentName).removed));\n };\n var enterVisitor = {\n enter: function (node) {\n if (fragmentWillBeRemoved(node.name.value)) {\n return null;\n }\n },\n };\n return nullIfDocIsEmpty(visit(docWithoutDirectiveSubtrees, {\n // If the fragment is going to be removed, then leaving any dangling\n // FragmentSpread nodes with the same name would be a mistake.\n FragmentSpread: enterVisitor,\n // This is where the fragment definition is actually removed.\n FragmentDefinition: enterVisitor,\n OperationDefinition: {\n leave: function (node) {\n // Upon leaving each operation in the depth-first AST traversal, prune\n // any variables that are declared by the operation but unused within.\n if (node.variableDefinitions) {\n var usedVariableNames_1 = populateTransitiveVars(\n // If an operation is anonymous, we use the empty string as its key.\n getInUseByOperationName(node.name && node.name.value)).transitiveVars;\n // According to the GraphQL spec, all variables declared by an\n // operation must either be used by that operation or used by some\n // fragment included transitively into that operation:\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n //\n // To stay on the right side of this validation rule, if/when we\n // remove the last $var references from an operation or its fragments,\n // we must also remove the corresponding $var declaration from the\n // enclosing operation. This pruning applies only to operations and\n // not fragment definitions, at the moment. Fragments may be able to\n // declare variables eventually, but today they can only consume them.\n if (usedVariableNames_1.size < node.variableDefinitions.length) {\n return __assign(__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) {\n return usedVariableNames_1.has(varDef.variable.name.value);\n }) });\n }\n }\n },\n },\n }));\n}\nexport var addTypenameToDocument = Object.assign(function (doc) {\n return visit(doc, {\n SelectionSet: {\n enter: function (node, _key, parent) {\n // Don't add __typename to OperationDefinitions.\n if (parent &&\n parent.kind ===\n Kind.OPERATION_DEFINITION) {\n return;\n }\n // No changes if no selections.\n var selections = node.selections;\n if (!selections) {\n return;\n }\n // If selections already have a __typename, or are part of an\n // introspection query, do nothing.\n var skip = selections.some(function (selection) {\n return (isField(selection) &&\n (selection.name.value === \"__typename\" ||\n selection.name.value.lastIndexOf(\"__\", 0) === 0));\n });\n if (skip) {\n return;\n }\n // If this SelectionSet is @export-ed as an input variable, it should\n // not have a __typename field (see issue #4691).\n var field = parent;\n if (isField(field) &&\n field.directives &&\n field.directives.some(function (d) { return d.name.value === \"export\"; })) {\n return;\n }\n // Create and return a new SelectionSet with a __typename Field.\n return __assign(__assign({}, node), { selections: __spreadArray(__spreadArray([], selections, true), [TYPENAME_FIELD], false) });\n },\n },\n });\n}, {\n added: function (field) {\n return field === TYPENAME_FIELD;\n },\n});\nvar connectionRemoveConfig = {\n test: function (directive) {\n var willRemove = directive.name.value === \"connection\";\n if (willRemove) {\n if (!directive.arguments ||\n !directive.arguments.some(function (arg) { return arg.name.value === \"key\"; })) {\n globalThis.__DEV__ !== false && invariant.warn(84);\n }\n }\n return willRemove;\n },\n};\nexport function removeConnectionDirectiveFromDocument(doc) {\n return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));\n}\nfunction hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) {\n if (nestedCheck === void 0) { nestedCheck = true; }\n return (!!selectionSet &&\n selectionSet.selections &&\n selectionSet.selections.some(function (selection) {\n return hasDirectivesInSelection(directives, selection, nestedCheck);\n }));\n}\nfunction hasDirectivesInSelection(directives, selection, nestedCheck) {\n if (nestedCheck === void 0) { nestedCheck = true; }\n if (!isField(selection)) {\n return true;\n }\n if (!selection.directives) {\n return false;\n }\n return (selection.directives.some(getDirectiveMatcher(directives)) ||\n (nestedCheck &&\n hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck)));\n}\nfunction getArgumentMatcher(config) {\n return function argumentMatcher(argument) {\n return config.some(function (aConfig) {\n return argument.value &&\n argument.value.kind === Kind.VARIABLE &&\n argument.value.name &&\n (aConfig.name === argument.value.name.value ||\n (aConfig.test && aConfig.test(argument)));\n });\n };\n}\nexport function removeArgumentsFromDocument(config, doc) {\n var argMatcher = getArgumentMatcher(config);\n return nullIfDocIsEmpty(visit(doc, {\n OperationDefinition: {\n enter: function (node) {\n return __assign(__assign({}, node), { \n // Remove matching top level variables definitions.\n variableDefinitions: node.variableDefinitions ?\n node.variableDefinitions.filter(function (varDef) {\n return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });\n })\n : [] });\n },\n },\n Field: {\n enter: function (node) {\n // If `remove` is set to true for an argument, and an argument match\n // is found for a field, remove the field as well.\n var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; });\n if (shouldRemoveField) {\n var argMatchCount_1 = 0;\n if (node.arguments) {\n node.arguments.forEach(function (arg) {\n if (argMatcher(arg)) {\n argMatchCount_1 += 1;\n }\n });\n }\n if (argMatchCount_1 === 1) {\n return null;\n }\n }\n },\n },\n Argument: {\n enter: function (node) {\n // Remove all matching arguments.\n if (argMatcher(node)) {\n return null;\n }\n },\n },\n }));\n}\nexport function removeFragmentSpreadFromDocument(config, doc) {\n function enter(node) {\n if (config.some(function (def) { return def.name === node.name.value; })) {\n return null;\n }\n }\n return nullIfDocIsEmpty(visit(doc, {\n FragmentSpread: { enter: enter },\n FragmentDefinition: { enter: enter },\n }));\n}\n// If the incoming document is a query, return it as is. Otherwise, build a\n// new document containing a query operation based on the selection set\n// of the previous main operation.\nexport function buildQueryFromSelectionSet(document) {\n var definition = getMainDefinition(document);\n var definitionOperation = definition.operation;\n if (definitionOperation === \"query\") {\n // Already a query, so return the existing document.\n return document;\n }\n // Build a new query using the selection set of the main operation.\n var modifiedDoc = visit(document, {\n OperationDefinition: {\n enter: function (node) {\n return __assign(__assign({}, node), { operation: \"query\" });\n },\n },\n });\n return modifiedDoc;\n}\n// Remove fields / selection sets that include an @client directive.\nexport function removeClientSetsFromDocument(document) {\n checkDocument(document);\n var modifiedDoc = removeDirectivesFromDocument([\n {\n test: function (directive) { return directive.name.value === \"client\"; },\n remove: true,\n },\n ], document);\n return modifiedDoc;\n}\n//# sourceMappingURL=transform.js.map","import { getOperationDefinition } from \"./getFromAST.js\";\nfunction isOperation(document, operation) {\n var _a;\n return ((_a = getOperationDefinition(document)) === null || _a === void 0 ? void 0 : _a.operation) === operation;\n}\nexport function isMutationOperation(document) {\n return isOperation(document, \"mutation\");\n}\nexport function isQueryOperation(document) {\n return isOperation(document, \"query\");\n}\nexport function isSubscriptionOperation(document) {\n return isOperation(document, \"subscription\");\n}\n//# sourceMappingURL=operations.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { isNonNullObject } from \"./objects.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nexport function mergeDeep() {\n var sources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n sources[_i] = arguments[_i];\n }\n return mergeDeepArray(sources);\n}\n// In almost any situation where you could succeed in getting the\n// TypeScript compiler to infer a tuple type for the sources array, you\n// could just use mergeDeep instead of mergeDeepArray, so instead of\n// trying to convert T[] to an intersection type we just infer the array\n// element type, which works perfectly when the sources array has a\n// consistent element type.\nexport function mergeDeepArray(sources) {\n var target = sources[0] || {};\n var count = sources.length;\n if (count > 1) {\n var merger = new DeepMerger();\n for (var i = 1; i < count; ++i) {\n target = merger.merge(target, sources[i]);\n }\n }\n return target;\n}\nvar defaultReconciler = function (target, source, property) {\n return this.merge(target[property], source[property]);\n};\nvar DeepMerger = /** @class */ (function () {\n function DeepMerger(reconciler) {\n if (reconciler === void 0) { reconciler = defaultReconciler; }\n this.reconciler = reconciler;\n this.isObject = isNonNullObject;\n this.pastCopies = new Set();\n }\n DeepMerger.prototype.merge = function (target, source) {\n var _this = this;\n var context = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n context[_i - 2] = arguments[_i];\n }\n if (isNonNullObject(source) && isNonNullObject(target)) {\n Object.keys(source).forEach(function (sourceKey) {\n if (hasOwnProperty.call(target, sourceKey)) {\n var targetValue = target[sourceKey];\n if (source[sourceKey] !== targetValue) {\n var result = _this.reconciler.apply(_this, __spreadArray([target,\n source,\n sourceKey], context, false));\n // A well-implemented reconciler may return targetValue to indicate\n // the merge changed nothing about the structure of the target.\n if (result !== targetValue) {\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = result;\n }\n }\n }\n else {\n // If there is no collision, the target can safely share memory with\n // the source, and the recursion can terminate here.\n target = _this.shallowCopyForMerge(target);\n target[sourceKey] = source[sourceKey];\n }\n });\n return target;\n }\n // If source (or target) is not an object, let source replace target.\n return source;\n };\n DeepMerger.prototype.shallowCopyForMerge = function (value) {\n if (isNonNullObject(value)) {\n if (!this.pastCopies.has(value)) {\n if (Array.isArray(value)) {\n value = value.slice(0);\n }\n else {\n value = __assign({ __proto__: Object.getPrototypeOf(value) }, value);\n }\n this.pastCopies.add(value);\n }\n }\n return value;\n };\n return DeepMerger;\n}());\nexport { DeepMerger };\n//# sourceMappingURL=mergeDeep.js.map","import { __assign, __rest as __rest_1, __spreadArray } from \"tslib\";\nimport { __rest } from \"tslib\";\nimport { mergeDeep } from \"../common/mergeDeep.js\";\n// A very basic pagination field policy that always concatenates new\n// results onto the existing array, without examining options.args.\nexport function concatPagination(keyArgs) {\n if (keyArgs === void 0) { keyArgs = false; }\n return {\n keyArgs: keyArgs,\n merge: function (existing, incoming) {\n return existing ? __spreadArray(__spreadArray([], existing, true), incoming, true) : incoming;\n },\n };\n}\n// A basic field policy that uses options.args.{offset,limit} to splice\n// the incoming data into the existing array. If your arguments are called\n// something different (like args.{start,count}), feel free to copy/paste\n// this implementation and make the appropriate changes.\nexport function offsetLimitPagination(keyArgs) {\n if (keyArgs === void 0) { keyArgs = false; }\n return {\n keyArgs: keyArgs,\n merge: function (existing, incoming, _a) {\n var args = _a.args;\n var merged = existing ? existing.slice(0) : [];\n if (incoming) {\n if (args) {\n // Assume an offset of 0 if args.offset omitted.\n var _b = args.offset, offset = _b === void 0 ? 0 : _b;\n for (var i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n }\n else {\n // It's unusual (probably a mistake) for a paginated field not\n // to receive any arguments, so you might prefer to throw an\n // exception here, instead of recovering by appending incoming\n // onto the existing array.\n merged.push.apply(merged, incoming);\n }\n }\n return merged;\n },\n };\n}\n// As proof of the flexibility of field policies, this function generates\n// one that handles Relay-style pagination, without Apollo Client knowing\n// anything about connections, edges, cursors, or pageInfo objects.\nexport function relayStylePagination(keyArgs) {\n if (keyArgs === void 0) { keyArgs = false; }\n return {\n keyArgs: keyArgs,\n read: function (existing, _a) {\n var canRead = _a.canRead, readField = _a.readField;\n if (!existing)\n return existing;\n var edges = [];\n var firstEdgeCursor = \"\";\n var lastEdgeCursor = \"\";\n existing.edges.forEach(function (edge) {\n // Edges themselves could be Reference objects, so it's important\n // to use readField to access the edge.edge.node property.\n if (canRead(readField(\"node\", edge))) {\n edges.push(edge);\n if (edge.cursor) {\n firstEdgeCursor = firstEdgeCursor || edge.cursor || \"\";\n lastEdgeCursor = edge.cursor || lastEdgeCursor;\n }\n }\n });\n if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) {\n firstEdgeCursor = \"\";\n }\n var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor;\n return __assign(__assign({}, getExtras(existing)), { edges: edges, pageInfo: __assign(__assign({}, existing.pageInfo), { \n // If existing.pageInfo.{start,end}Cursor are undefined or \"\", default\n // to firstEdgeCursor and/or lastEdgeCursor.\n startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });\n },\n merge: function (existing, incoming, _a) {\n var args = _a.args, isReference = _a.isReference, readField = _a.readField;\n if (!existing) {\n existing = makeEmptyData();\n }\n if (!incoming) {\n return existing;\n }\n var incomingEdges = incoming.edges ?\n incoming.edges.map(function (edge) {\n if (isReference((edge = __assign({}, edge)))) {\n // In case edge is a Reference, we read out its cursor field and\n // store it as an extra property of the Reference object.\n edge.cursor = readField(\"cursor\", edge);\n }\n return edge;\n })\n : [];\n if (incoming.pageInfo) {\n var pageInfo_1 = incoming.pageInfo;\n var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor;\n var firstEdge = incomingEdges[0];\n var lastEdge = incomingEdges[incomingEdges.length - 1];\n // In case we did not request the cursor field for edges in this\n // query, we can still infer cursors from pageInfo.\n if (firstEdge && startCursor) {\n firstEdge.cursor = startCursor;\n }\n if (lastEdge && endCursor) {\n lastEdge.cursor = endCursor;\n }\n // Cursors can also come from edges, so we default\n // pageInfo.{start,end}Cursor to {first,last}Edge.cursor.\n var firstCursor = firstEdge && firstEdge.cursor;\n if (firstCursor && !startCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n startCursor: firstCursor,\n },\n });\n }\n var lastCursor = lastEdge && lastEdge.cursor;\n if (lastCursor && !endCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n endCursor: lastCursor,\n },\n });\n }\n }\n var prefix = existing.edges;\n var suffix = [];\n if (args && args.after) {\n // This comparison does not need to use readField(\"cursor\", edge),\n // because we stored the cursor field of any Reference edges as an\n // extra property of the Reference object.\n var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; });\n if (index >= 0) {\n prefix = prefix.slice(0, index + 1);\n // suffix = []; // already true\n }\n }\n else if (args && args.before) {\n var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; });\n suffix = index < 0 ? prefix : prefix.slice(index);\n prefix = [];\n }\n else if (incoming.edges) {\n // If we have neither args.after nor args.before, the incoming\n // edges cannot be spliced into the existing edges, so they must\n // replace the existing edges. See #6592 for a motivating example.\n prefix = [];\n }\n var edges = __spreadArray(__spreadArray(__spreadArray([], prefix, true), incomingEdges, true), suffix, true);\n var pageInfo = __assign(__assign({}, incoming.pageInfo), existing.pageInfo);\n if (incoming.pageInfo) {\n var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = __rest_1(_b, [\"hasPreviousPage\", \"hasNextPage\", \"startCursor\", \"endCursor\"]);\n // If incoming.pageInfo had any extra non-standard properties,\n // assume they should take precedence over any existing properties\n // of the same name, regardless of where this page falls with\n // respect to the existing data.\n Object.assign(pageInfo, extras);\n // Keep existing.pageInfo.has{Previous,Next}Page unless the\n // placement of the incoming edges means incoming.hasPreviousPage\n // or incoming.hasNextPage should become the new values for those\n // properties in existing.pageInfo. Note that these updates are\n // only permitted when the beginning or end of the incoming page\n // coincides with the beginning or end of the existing data, as\n // determined using prefix.length and suffix.length.\n if (!prefix.length) {\n if (void 0 !== hasPreviousPage)\n pageInfo.hasPreviousPage = hasPreviousPage;\n if (void 0 !== startCursor)\n pageInfo.startCursor = startCursor;\n }\n if (!suffix.length) {\n if (void 0 !== hasNextPage)\n pageInfo.hasNextPage = hasNextPage;\n if (void 0 !== endCursor)\n pageInfo.endCursor = endCursor;\n }\n }\n return __assign(__assign(__assign({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo });\n },\n };\n}\n// Returns any unrecognized properties of the given object.\nvar getExtras = function (obj) { return __rest(obj, notExtras); };\nvar notExtras = [\"edges\", \"pageInfo\"];\nfunction makeEmptyData() {\n return {\n edges: [],\n pageInfo: {\n hasPreviousPage: false,\n hasNextPage: true,\n startCursor: \"\",\n endCursor: \"\",\n },\n };\n}\n//# sourceMappingURL=pagination.js.map","export function createFulfilledPromise(value) {\n var promise = Promise.resolve(value);\n promise.status = \"fulfilled\";\n promise.value = value;\n return promise;\n}\nexport function createRejectedPromise(reason) {\n var promise = Promise.reject(reason);\n // prevent potential edge cases leaking unhandled error rejections\n promise.catch(function () { });\n promise.status = \"rejected\";\n promise.reason = reason;\n return promise;\n}\nexport function isStatefulPromise(promise) {\n return \"status\" in promise;\n}\nexport function wrapPromiseWithState(promise) {\n if (isStatefulPromise(promise)) {\n return promise;\n }\n var pendingPromise = promise;\n pendingPromise.status = \"pending\";\n pendingPromise.then(function (value) {\n if (pendingPromise.status === \"pending\") {\n var fulfilledPromise = pendingPromise;\n fulfilledPromise.status = \"fulfilled\";\n fulfilledPromise.value = value;\n }\n }, function (reason) {\n if (pendingPromise.status === \"pending\") {\n var rejectedPromise = pendingPromise;\n rejectedPromise.status = \"rejected\";\n rejectedPromise.reason = reason;\n }\n });\n return promise;\n}\n//# sourceMappingURL=decoration.js.map","var toString = Object.prototype.toString;\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value) {\n return cloneDeepHelper(value);\n}\nfunction cloneDeepHelper(val, seen) {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n seen = seen || new Map();\n if (seen.has(val))\n return seen.get(val);\n var copy_1 = val.slice(0);\n seen.set(val, copy_1);\n copy_1.forEach(function (child, i) {\n copy_1[i] = cloneDeepHelper(child, seen);\n });\n return copy_1;\n }\n case \"[object Object]\": {\n seen = seen || new Map();\n if (seen.has(val))\n return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n var copy_2 = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy_2);\n Object.keys(val).forEach(function (key) {\n copy_2[key] = cloneDeepHelper(val[key], seen);\n });\n return copy_2;\n }\n default:\n return val;\n }\n}\n//# sourceMappingURL=cloneDeep.js.map","import { isNonNullObject } from \"./objects.js\";\nfunction deepFreeze(value) {\n var workSet = new Set([value]);\n workSet.forEach(function (obj) {\n if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {\n Object.getOwnPropertyNames(obj).forEach(function (name) {\n if (isNonNullObject(obj[name]))\n workSet.add(obj[name]);\n });\n }\n });\n return value;\n}\nfunction shallowFreeze(obj) {\n if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) {\n try {\n Object.freeze(obj);\n }\n catch (e) {\n // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but\n // they all throw a TypeError when you try, so we re-throw any exceptions\n // that are not TypeErrors, since that would be unexpected.\n if (e instanceof TypeError)\n return null;\n throw e;\n }\n }\n return obj;\n}\nexport function maybeDeepFreeze(obj) {\n if (globalThis.__DEV__ !== false) {\n deepFreeze(obj);\n }\n return obj;\n}\n//# sourceMappingURL=maybeDeepFreeze.js.map","export function iterateObserversSafely(observers, method, argument) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n var observersWithMethod = [];\n observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); });\n observersWithMethod.forEach(function (obs) { return obs[method](argument); });\n}\n//# sourceMappingURL=iteration.js.map","import { Observable } from \"./Observable.js\";\n// Like Observable.prototype.map, except that the mapping function can\n// optionally return a Promise (or be async).\nexport function asyncMap(observable, mapFn, catchFn) {\n return new Observable(function (observer) {\n var promiseQueue = {\n // Normally we would initialize promiseQueue to Promise.resolve(), but\n // in this case, for backwards compatibility, we need to be careful to\n // invoke the first callback synchronously.\n then: function (callback) {\n return new Promise(function (resolve) { return resolve(callback()); });\n },\n };\n function makeCallback(examiner, key) {\n return function (arg) {\n if (examiner) {\n var both = function () {\n // If the observer is closed, we don't want to continue calling the\n // mapping function - it's result will be swallowed anyways.\n return observer.closed ?\n /* will be swallowed */ 0\n : examiner(arg);\n };\n promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });\n }\n else {\n observer[key](arg);\n }\n };\n }\n var handler = {\n next: makeCallback(mapFn, \"next\"),\n error: makeCallback(catchFn, \"error\"),\n complete: function () {\n // no need to reassign `promiseQueue`, after `observer.complete`,\n // the observer will be closed and short-circuit everything anyways\n /*promiseQueue = */ promiseQueue.then(function () { return observer.complete(); });\n },\n };\n var sub = observable.subscribe(handler);\n return function () { return sub.unsubscribe(); };\n });\n}\n//# sourceMappingURL=asyncMap.js.map","import { Observable } from \"./Observable.js\";\nimport { canUseSymbol } from \"../common/canUse.js\";\n// Generic implementations of Observable.prototype methods like map and\n// filter need to know how to create a new Observable from an Observable\n// subclass (like Concast or ObservableQuery). Those methods assume\n// (perhaps unwisely?) that they can call the subtype's constructor with a\n// Subscriber function, even though the subclass constructor might expect\n// different parameters. Defining this static Symbol.species property on\n// the subclass is a hint to generic Observable code to use the default\n// constructor instead of trying to do `new Subclass(observer => ...)`.\nexport function fixObservableSubclass(subclass) {\n function set(key) {\n // Object.defineProperty is necessary because the Symbol.species\n // property is a getter by default in modern JS environments, so we\n // can't assign to it with a normal assignment expression.\n Object.defineProperty(subclass, key, { value: Observable });\n }\n if (canUseSymbol && Symbol.species) {\n set(Symbol.species);\n }\n // The \"@@species\" string is used as a fake Symbol.species value in some\n // polyfill systems (including the SymbolSpecies variable used by\n // zen-observable), so we should set it as well, to be safe.\n set(\"@@species\");\n return subclass;\n}\n//# sourceMappingURL=subclassing.js.map","import { __extends } from \"tslib\";\nimport { Observable } from \"./Observable.js\";\nimport { iterateObserversSafely } from \"./iteration.js\";\nimport { fixObservableSubclass } from \"./subclassing.js\";\nfunction isPromiseLike(value) {\n return value && typeof value.then === \"function\";\n}\n// A Concast observable concatenates the given sources into a single\n// non-overlapping sequence of Ts, automatically unwrapping any promises,\n// and broadcasts the T elements of that sequence to any number of\n// subscribers, all without creating a bunch of intermediary Observable\n// wrapper objects.\n//\n// Even though any number of observers can subscribe to the Concast, each\n// source observable is guaranteed to receive at most one subscribe call,\n// and the results are multicast to all observers.\n//\n// In addition to broadcasting every next/error message to this.observers,\n// the Concast stores the most recent message using this.latest, so any\n// new observers can immediately receive the latest message, even if it\n// was originally delivered in the past. This behavior means we can assume\n// every active observer in this.observers has received the same most\n// recent message.\n//\n// With the exception of this.latest replay, a Concast is a \"hot\"\n// observable in the sense that it does not replay past results from the\n// beginning of time for each new observer.\n//\n// Could we have used some existing RxJS class instead? Concast is\n// similar to a BehaviorSubject, because it is multicast and redelivers\n// the latest next/error message to new subscribers. Unlike Subject,\n// Concast does not expose an Observer interface (this.handlers is\n// intentionally private), since Concast gets its inputs from the\n// concatenated sources. If we ever switch to RxJS, there may be some\n// value in reusing their code, but for now we use zen-observable, which\n// does not contain any Subject implementations.\nvar Concast = /** @class */ (function (_super) {\n __extends(Concast, _super);\n // Not only can the individual elements of the iterable be promises, but\n // also the iterable itself can be wrapped in a promise.\n function Concast(sources) {\n var _this = _super.call(this, function (observer) {\n _this.addObserver(observer);\n return function () { return _this.removeObserver(observer); };\n }) || this;\n // Active observers receiving broadcast messages. Thanks to this.latest,\n // we can assume all observers in this Set have received the same most\n // recent message, though possibly at different times in the past.\n _this.observers = new Set();\n _this.promise = new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n });\n // Bound handler functions that can be reused for every internal\n // subscription.\n _this.handlers = {\n next: function (result) {\n if (_this.sub !== null) {\n _this.latest = [\"next\", result];\n _this.notify(\"next\", result);\n iterateObserversSafely(_this.observers, \"next\", result);\n }\n },\n error: function (error) {\n var sub = _this.sub;\n if (sub !== null) {\n // Delay unsubscribing from the underlying subscription slightly,\n // so that immediately subscribing another observer can keep the\n // subscription active.\n if (sub)\n setTimeout(function () { return sub.unsubscribe(); });\n _this.sub = null;\n _this.latest = [\"error\", error];\n _this.reject(error);\n _this.notify(\"error\", error);\n iterateObserversSafely(_this.observers, \"error\", error);\n }\n },\n complete: function () {\n var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b;\n if (sub !== null) {\n // If complete is called before concast.start, this.sources may be\n // undefined, so we use a default value of [] for sources. That works\n // here because it falls into the if (!value) {...} block, which\n // appropriately terminates the Concast, even if this.sources might\n // eventually have been initialized to a non-empty array.\n var value = sources.shift();\n if (!value) {\n if (sub)\n setTimeout(function () { return sub.unsubscribe(); });\n _this.sub = null;\n if (_this.latest && _this.latest[0] === \"next\") {\n _this.resolve(_this.latest[1]);\n }\n else {\n _this.resolve();\n }\n _this.notify(\"complete\");\n // We do not store this.latest = [\"complete\"], because doing so\n // discards useful information about the previous next (or\n // error) message. Instead, if new observers subscribe after\n // this Concast has completed, they will receive the final\n // 'next' message (unless there was an error) immediately\n // followed by a 'complete' message (see addObserver).\n iterateObserversSafely(_this.observers, \"complete\");\n }\n else if (isPromiseLike(value)) {\n value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error);\n }\n else {\n _this.sub = value.subscribe(_this.handlers);\n }\n }\n },\n };\n _this.nextResultListeners = new Set();\n // A public way to abort observation and broadcast.\n _this.cancel = function (reason) {\n _this.reject(reason);\n _this.sources = [];\n _this.handlers.complete();\n };\n // Suppress rejection warnings for this.promise, since it's perfectly\n // acceptable to pay no attention to this.promise if you're consuming\n // the results through the normal observable API.\n _this.promise.catch(function (_) { });\n // If someone accidentally tries to create a Concast using a subscriber\n // function, recover by creating an Observable from that subscriber and\n // using it as the source.\n if (typeof sources === \"function\") {\n sources = [new Observable(sources)];\n }\n if (isPromiseLike(sources)) {\n sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error);\n }\n else {\n _this.start(sources);\n }\n return _this;\n }\n Concast.prototype.start = function (sources) {\n if (this.sub !== void 0)\n return;\n // In practice, sources is most often simply an Array of observables.\n // TODO Consider using sources[Symbol.iterator]() to take advantage\n // of the laziness of non-Array iterables.\n this.sources = Array.from(sources);\n // Calling this.handlers.complete() kicks off consumption of the first\n // source observable. It's tempting to do this step lazily in\n // addObserver, but this.promise can be accessed without calling\n // addObserver, so consumption needs to begin eagerly.\n this.handlers.complete();\n };\n Concast.prototype.deliverLastMessage = function (observer) {\n if (this.latest) {\n var nextOrError = this.latest[0];\n var method = observer[nextOrError];\n if (method) {\n method.call(observer, this.latest[1]);\n }\n // If the subscription is already closed, and the last message was\n // a 'next' message, simulate delivery of the final 'complete'\n // message again.\n if (this.sub === null && nextOrError === \"next\" && observer.complete) {\n observer.complete();\n }\n }\n };\n Concast.prototype.addObserver = function (observer) {\n if (!this.observers.has(observer)) {\n // Immediately deliver the most recent message, so we can always\n // be sure all observers have the latest information.\n this.deliverLastMessage(observer);\n this.observers.add(observer);\n }\n };\n Concast.prototype.removeObserver = function (observer) {\n if (this.observers.delete(observer) && this.observers.size < 1) {\n // In case there are still any listeners in this.nextResultListeners, and\n // no error or completion has been broadcast yet, make sure those\n // observers have a chance to run and then remove themselves from\n // this.observers.\n this.handlers.complete();\n }\n };\n Concast.prototype.notify = function (method, arg) {\n var nextResultListeners = this.nextResultListeners;\n if (nextResultListeners.size) {\n // Replacing this.nextResultListeners first ensures it does not grow while\n // we are iterating over it, potentially leading to infinite loops.\n this.nextResultListeners = new Set();\n nextResultListeners.forEach(function (listener) { return listener(method, arg); });\n }\n };\n // We need a way to run callbacks just *before* the next result (or error or\n // completion) is delivered by this Concast, so we can be sure any code that\n // runs as a result of delivering that result/error observes the effects of\n // running the callback(s). It was tempting to reuse the Observer type instead\n // of introducing NextResultListener, but that messes with the sizing and\n // maintenance of this.observers, and ends up being more code overall.\n Concast.prototype.beforeNext = function (callback) {\n var called = false;\n this.nextResultListeners.add(function (method, arg) {\n if (!called) {\n called = true;\n callback(method, arg);\n }\n });\n };\n return Concast;\n}(Observable));\nexport { Concast };\n// Necessary because the Concast constructor has a different signature\n// than the Observable constructor.\nfixObservableSubclass(Concast);\n//# sourceMappingURL=Concast.js.map","import { isNonNullObject } from \"./objects.js\";\nimport { isNonEmptyArray } from \"./arrays.js\";\nimport { DeepMerger } from \"./mergeDeep.js\";\nexport function isExecutionPatchIncrementalResult(value) {\n return \"incremental\" in value;\n}\nexport function isExecutionPatchInitialResult(value) {\n return \"hasNext\" in value && \"data\" in value;\n}\nexport function isExecutionPatchResult(value) {\n return (isExecutionPatchIncrementalResult(value) ||\n isExecutionPatchInitialResult(value));\n}\n// This function detects an Apollo payload result before it is transformed\n// into a FetchResult via HttpLink; it cannot detect an ApolloPayloadResult\n// once it leaves the link chain.\nexport function isApolloPayloadResult(value) {\n return isNonNullObject(value) && \"payload\" in value;\n}\nexport function mergeIncrementalData(prevResult, result) {\n var mergedData = prevResult;\n var merger = new DeepMerger();\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (_a) {\n var data = _a.data, path = _a.path;\n for (var i = path.length - 1; i >= 0; --i) {\n var key = path[i];\n var isNumericKey = !isNaN(+key);\n var parent_1 = isNumericKey ? [] : {};\n parent_1[key] = data;\n data = parent_1;\n }\n mergedData = merger.merge(mergedData, data);\n });\n }\n return mergedData;\n}\n//# sourceMappingURL=incrementalResult.js.map","import { isNonEmptyArray } from \"./arrays.js\";\nimport { isExecutionPatchIncrementalResult } from \"./incrementalResult.js\";\nexport function graphQLResultHasError(result) {\n var errors = getGraphQLErrorsFromResult(result);\n return isNonEmptyArray(errors);\n}\nexport function getGraphQLErrorsFromResult(result) {\n var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];\n if (isExecutionPatchIncrementalResult(result) &&\n isNonEmptyArray(result.incremental)) {\n result.incremental.forEach(function (incrementalResult) {\n if (incrementalResult.errors) {\n graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);\n }\n });\n }\n return graphQLErrors;\n}\n//# sourceMappingURL=errorHandling.js.map","/**\n * Merges the provided objects shallowly and removes\n * all properties with an `undefined` value\n */\nexport function compact() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n var result = Object.create(null);\n objects.forEach(function (obj) {\n if (!obj)\n return;\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n if (value !== void 0) {\n result[key] = value;\n }\n });\n });\n return result;\n}\n//# sourceMappingURL=compact.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { __assign } from \"tslib\";\nimport { compact } from \"./compact.js\";\nexport function mergeOptions(defaults, options) {\n return compact(defaults, options, options.variables && {\n variables: compact(__assign(__assign({}, (defaults && defaults.variables)), options.variables)),\n });\n}\n//# sourceMappingURL=mergeOptions.js.map","import { isPlainObject } from \"./objects.js\";\nexport function omitDeep(value, key) {\n return __omitDeep(value, key);\n}\nfunction __omitDeep(value, key, known) {\n if (known === void 0) { known = new Map(); }\n if (known.has(value)) {\n return known.get(value);\n }\n var modified = false;\n if (Array.isArray(value)) {\n var array_1 = [];\n known.set(value, array_1);\n value.forEach(function (value, index) {\n var result = __omitDeep(value, key, known);\n modified || (modified = result !== value);\n array_1[index] = result;\n });\n if (modified) {\n return array_1;\n }\n }\n else if (isPlainObject(value)) {\n var obj_1 = Object.create(Object.getPrototypeOf(value));\n known.set(value, obj_1);\n Object.keys(value).forEach(function (k) {\n if (k === key) {\n modified = true;\n return;\n }\n var result = __omitDeep(value[k], key, known);\n modified || (modified = result !== value[k]);\n obj_1[k] = result;\n });\n if (modified) {\n return obj_1;\n }\n }\n return value;\n}\n//# sourceMappingURL=omitDeep.js.map","import { omitDeep } from \"./omitDeep.js\";\nexport function stripTypename(value) {\n return omitDeep(value, \"__typename\");\n}\n//# sourceMappingURL=stripTypename.js.map"],"names":["invariant","visit","BREAK","maybe","newInvariantError","__assign","__spreadArray","WeakCache","StrongCache","global","Trie","wrap","origPrint","Kind","__rest_1","__rest","Observable","__extends"],"mappings":";;;;;;;;;;;;;AAEO,SAAS,aAAa,CAAC,EAAE,EAAE,SAAS,EAAE;AAC7C,IAAI,IAAI,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;AACnC,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;AAC3C,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK;AACL,IAAI,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC,KAAK,CAA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AAC9B,SAAS,CAAC,CAAC;AACX,QAAQ,IAAI,QAAQ,EAAE;AACtB,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB;;ACtCO,SAAS,aAAa,CAAC,KAAK,EAAE;AACrC,IAAI,OAAO,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.native.js b/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.native.js new file mode 100644 index 0000000..e059cc9 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/utilities/utilities.cjs.native.js @@ -0,0 +1,1730 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var globals = require('./globals'); +var graphql = require('graphql'); +var trie = require('@wry/trie'); +var tslib = require('tslib'); +var caches = require('@wry/caches'); +var optimism = require('optimism'); +var zenObservableTs = require('zen-observable-ts'); +require('symbol-observable'); + +function shouldInclude(_a, variables) { + var directives = _a.directives; + if (!directives || !directives.length) { + return true; + } + return getInclusionDirectives(directives).every(function (_a) { + var directive = _a.directive, ifArgument = _a.ifArgument; + var evaledValue = false; + if (ifArgument.value.kind === "Variable") { + evaledValue = + variables && variables[ifArgument.value.name.value]; + globals.invariant(evaledValue !== void 0, 67, directive.name.value); + } + else { + evaledValue = ifArgument.value.value; + } + return directive.name.value === "skip" ? !evaledValue : evaledValue; + }); +} +function getDirectiveNames(root) { + var names = []; + graphql.visit(root, { + Directive: function (node) { + names.push(node.name.value); + }, + }); + return names; +} +var hasAnyDirectives = function (names, root) { + return hasDirectives(names, root, false); +}; +var hasAllDirectives = function (names, root) { + return hasDirectives(names, root, true); +}; +function hasDirectives(names, root, all) { + var nameSet = new Set(names); + var uniqueCount = nameSet.size; + graphql.visit(root, { + Directive: function (node) { + if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) { + return graphql.BREAK; + } + }, + }); + return all ? !nameSet.size : nameSet.size < uniqueCount; +} +function hasClientExports(document) { + return document && hasDirectives(["client", "export"], document, true); +} +function isInclusionDirective(_a) { + var value = _a.name.value; + return value === "skip" || value === "include"; +} +function getInclusionDirectives(directives) { + var result = []; + if (directives && directives.length) { + directives.forEach(function (directive) { + if (!isInclusionDirective(directive)) + return; + var directiveArguments = directive.arguments; + var directiveName = directive.name.value; + globals.invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName); + var ifArgument = directiveArguments[0]; + globals.invariant(ifArgument.name && ifArgument.name.value === "if", 69, directiveName); + var ifValue = ifArgument.value; + globals.invariant(ifValue && + (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 70, directiveName); + result.push({ directive: directive, ifArgument: ifArgument }); + }); + } + return result; +} + +var canUseWeakMap = typeof WeakMap === "function" && + !globals.maybe(function () { return navigator.product == "ReactNative" && !global.HermesInternal; }); +var canUseWeakSet = typeof WeakSet === "function"; +var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function"; +var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator; +var canUseDOM = typeof globals.maybe(function () { return window.document.createElement; }) === "function"; +var usingJSDOM = +globals.maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false; +var canUseLayoutEffect = canUseDOM && !usingJSDOM; + +function isNonNullObject(obj) { + return obj !== null && typeof obj === "object"; +} +function isPlainObject(obj) { + return (obj !== null && + typeof obj === "object" && + (Object.getPrototypeOf(obj) === Object.prototype || + Object.getPrototypeOf(obj) === null)); +} + +function getFragmentQueryDocument(document, fragmentName) { + var actualFragmentName = fragmentName; + var fragments = []; + document.definitions.forEach(function (definition) { + if (definition.kind === "OperationDefinition") { + throw globals.newInvariantError( + 71, + definition.operation, + definition.name ? " named '".concat(definition.name.value, "'") : "" + ); + } + if (definition.kind === "FragmentDefinition") { + fragments.push(definition); + } + }); + if (typeof actualFragmentName === "undefined") { + globals.invariant(fragments.length === 1, 72, fragments.length); + actualFragmentName = fragments[0].name.value; + } + var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([ + { + kind: "OperationDefinition", + operation: "query", + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "FragmentSpread", + name: { + kind: "Name", + value: actualFragmentName, + }, + }, + ], + }, + } + ], document.definitions, true) }); + return query; +} +function createFragmentMap(fragments) { + if (fragments === void 0) { fragments = []; } + var symTable = {}; + fragments.forEach(function (fragment) { + symTable[fragment.name.value] = fragment; + }); + return symTable; +} +function getFragmentFromSelection(selection, fragmentMap) { + switch (selection.kind) { + case "InlineFragment": + return selection; + case "FragmentSpread": { + var fragmentName = selection.name.value; + if (typeof fragmentMap === "function") { + return fragmentMap(fragmentName); + } + var fragment = fragmentMap && fragmentMap[fragmentName]; + globals.invariant(fragment, 73, fragmentName); + return fragment || null; + } + default: + return null; + } +} + +var scheduledCleanup = new WeakSet(); +function schedule(cache) { + if (!scheduledCleanup.has(cache)) { + scheduledCleanup.add(cache); + setTimeout(function () { + cache.clean(); + scheduledCleanup.delete(cache); + }, 100); + } +} +var AutoCleanedWeakCache = function (max, dispose) { + var cache = new caches.WeakCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return caches.WeakCache.prototype.set.call(this, key, value); + }; + return cache; +}; +var AutoCleanedStrongCache = function (max, dispose) { + var cache = new caches.StrongCache(max, dispose); + cache.set = function (key, value) { + schedule(this); + return caches.StrongCache.prototype.set.call(this, key, value); + }; + return cache; +}; + +var cacheSizeSymbol = Symbol.for("apollo.cacheSize"); +var cacheSizes = tslib.__assign({}, globals.global[cacheSizeSymbol]); + +var globalCaches = {}; +function registerGlobalCache(name, getSize) { + globalCaches[name] = getSize; +} + +var canonicalStringify = Object.assign(function canonicalStringify(value) { + return JSON.stringify(value, stableObjectReplacer); +}, { + reset: function () { + sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 ); + }, +}); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("canonicalStringify", function () { return sortingMap.size; }); +} +var sortingMap; +canonicalStringify.reset(); +function stableObjectReplacer(key, value) { + if (value && typeof value === "object") { + var proto = Object.getPrototypeOf(value); + if (proto === Object.prototype || proto === null) { + var keys = Object.keys(value); + if (keys.every(everyKeyInOrder)) + return value; + var unsortedKey = JSON.stringify(keys); + var sortedKeys = sortingMap.get(unsortedKey); + if (!sortedKeys) { + keys.sort(); + var sortedKey = JSON.stringify(keys); + sortedKeys = sortingMap.get(sortedKey) || keys; + sortingMap.set(unsortedKey, sortedKeys); + sortingMap.set(sortedKey, sortedKeys); + } + var sortedObject_1 = Object.create(proto); + sortedKeys.forEach(function (key) { + sortedObject_1[key] = value[key]; + }); + return sortedObject_1; + } + } + return value; +} +function everyKeyInOrder(key, i, keys) { + return i === 0 || keys[i - 1] <= key; +} + +function makeReference(id) { + return { __ref: String(id) }; +} +function isReference(obj) { + return Boolean(obj && typeof obj === "object" && typeof obj.__ref === "string"); +} +function isDocumentNode(value) { + return (isNonNullObject(value) && + value.kind === "Document" && + Array.isArray(value.definitions)); +} +function isStringValue(value) { + return value.kind === "StringValue"; +} +function isBooleanValue(value) { + return value.kind === "BooleanValue"; +} +function isIntValue(value) { + return value.kind === "IntValue"; +} +function isFloatValue(value) { + return value.kind === "FloatValue"; +} +function isVariable(value) { + return value.kind === "Variable"; +} +function isObjectValue(value) { + return value.kind === "ObjectValue"; +} +function isListValue(value) { + return value.kind === "ListValue"; +} +function isEnumValue(value) { + return value.kind === "EnumValue"; +} +function isNullValue(value) { + return value.kind === "NullValue"; +} +function valueToObjectRepresentation(argObj, name, value, variables) { + if (isIntValue(value) || isFloatValue(value)) { + argObj[name.value] = Number(value.value); + } + else if (isBooleanValue(value) || isStringValue(value)) { + argObj[name.value] = value.value; + } + else if (isObjectValue(value)) { + var nestedArgObj_1 = {}; + value.fields.map(function (obj) { + return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); + }); + argObj[name.value] = nestedArgObj_1; + } + else if (isVariable(value)) { + var variableValue = (variables || {})[value.name.value]; + argObj[name.value] = variableValue; + } + else if (isListValue(value)) { + argObj[name.value] = value.values.map(function (listValue) { + var nestedArgArrayObj = {}; + valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); + return nestedArgArrayObj[name.value]; + }); + } + else if (isEnumValue(value)) { + argObj[name.value] = value.value; + } + else if (isNullValue(value)) { + argObj[name.value] = null; + } + else { + throw globals.newInvariantError(82, name.value, value.kind); + } +} +function storeKeyNameFromField(field, variables) { + var directivesObj = null; + if (field.directives) { + directivesObj = {}; + field.directives.forEach(function (directive) { + directivesObj[directive.name.value] = {}; + if (directive.arguments) { + directive.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); + }); + } + }); + } + var argObj = null; + if (field.arguments && field.arguments.length) { + argObj = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj, name, value, variables); + }); + } + return getStoreKeyName(field.name.value, argObj, directivesObj); +} +var KNOWN_DIRECTIVES = [ + "connection", + "include", + "skip", + "client", + "rest", + "export", + "nonreactive", +]; +var storeKeyNameStringify = canonicalStringify; +var getStoreKeyName = Object.assign(function (fieldName, args, directives) { + if (args && + directives && + directives["connection"] && + directives["connection"]["key"]) { + if (directives["connection"]["filter"] && + directives["connection"]["filter"].length > 0) { + var filterKeys = directives["connection"]["filter"] ? + directives["connection"]["filter"] + : []; + filterKeys.sort(); + var filteredArgs_1 = {}; + filterKeys.forEach(function (key) { + filteredArgs_1[key] = args[key]; + }); + return "".concat(directives["connection"]["key"], "(").concat(storeKeyNameStringify(filteredArgs_1), ")"); + } + else { + return directives["connection"]["key"]; + } + } + var completeFieldName = fieldName; + if (args) { + var stringifiedArgs = storeKeyNameStringify(args); + completeFieldName += "(".concat(stringifiedArgs, ")"); + } + if (directives) { + Object.keys(directives).forEach(function (key) { + if (KNOWN_DIRECTIVES.indexOf(key) !== -1) + return; + if (directives[key] && Object.keys(directives[key]).length) { + completeFieldName += "@".concat(key, "(").concat(storeKeyNameStringify(directives[key]), ")"); + } + else { + completeFieldName += "@".concat(key); + } + }); + } + return completeFieldName; +}, { + setStringify: function (s) { + var previous = storeKeyNameStringify; + storeKeyNameStringify = s; + return previous; + }, +}); +function argumentsObjectFromField(field, variables) { + if (field.arguments && field.arguments.length) { + var argObj_1 = {}; + field.arguments.forEach(function (_a) { + var name = _a.name, value = _a.value; + return valueToObjectRepresentation(argObj_1, name, value, variables); + }); + return argObj_1; + } + return null; +} +function resultKeyNameFromField(field) { + return field.alias ? field.alias.value : field.name.value; +} +function getTypenameFromResult(result, selectionSet, fragmentMap) { + var fragments; + for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) { + var selection = _a[_i]; + if (isField(selection)) { + if (selection.name.value === "__typename") { + return result[resultKeyNameFromField(selection)]; + } + } + else if (fragments) { + fragments.push(selection); + } + else { + fragments = [selection]; + } + } + if (typeof result.__typename === "string") { + return result.__typename; + } + if (fragments) { + for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) { + var selection = fragments_1[_b]; + var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap); + if (typeof typename === "string") { + return typename; + } + } + } +} +function isField(selection) { + return selection.kind === "Field"; +} +function isInlineFragment(selection) { + return selection.kind === "InlineFragment"; +} + +function checkDocument(doc) { + globals.invariant(doc && doc.kind === "Document", 74); + var operations = doc.definitions + .filter(function (d) { return d.kind !== "FragmentDefinition"; }) + .map(function (definition) { + if (definition.kind !== "OperationDefinition") { + throw globals.newInvariantError(75, definition.kind); + } + return definition; + }); + globals.invariant(operations.length <= 1, 76, operations.length); + return doc; +} +function getOperationDefinition(doc) { + checkDocument(doc); + return doc.definitions.filter(function (definition) { + return definition.kind === "OperationDefinition"; + })[0]; +} +function getOperationName(doc) { + return (doc.definitions + .filter(function (definition) { + return definition.kind === "OperationDefinition" && !!definition.name; + }) + .map(function (x) { return x.name.value; })[0] || null); +} +function getFragmentDefinitions(doc) { + return doc.definitions.filter(function (definition) { + return definition.kind === "FragmentDefinition"; + }); +} +function getQueryDefinition(doc) { + var queryDef = getOperationDefinition(doc); + globals.invariant(queryDef && queryDef.operation === "query", 77); + return queryDef; +} +function getFragmentDefinition(doc) { + globals.invariant(doc.kind === "Document", 78); + globals.invariant(doc.definitions.length <= 1, 79); + var fragmentDef = doc.definitions[0]; + globals.invariant(fragmentDef.kind === "FragmentDefinition", 80); + return fragmentDef; +} +function getMainDefinition(queryDoc) { + checkDocument(queryDoc); + var fragmentDefinition; + for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { + var definition = _a[_i]; + if (definition.kind === "OperationDefinition") { + var operation = definition.operation; + if (operation === "query" || + operation === "mutation" || + operation === "subscription") { + return definition; + } + } + if (definition.kind === "FragmentDefinition" && !fragmentDefinition) { + fragmentDefinition = definition; + } + } + if (fragmentDefinition) { + return fragmentDefinition; + } + throw globals.newInvariantError(81); +} +function getDefaultValues(definition) { + var defaultValues = Object.create(null); + var defs = definition && definition.variableDefinitions; + if (defs && defs.length) { + defs.forEach(function (def) { + if (def.defaultValue) { + valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue); + } + }); + } + return defaultValues; +} + +function identity(document) { + return document; +} +var DocumentTransform = (function () { + function DocumentTransform(transform, options) { + if (options === void 0) { options = Object.create(null); } + this.resultCache = canUseWeakSet ? new WeakSet() : new Set(); + this.transform = transform; + if (options.getCacheKey) { + this.getCacheKey = options.getCacheKey; + } + this.cached = options.cache !== false; + this.resetCache(); + } + DocumentTransform.prototype.getCacheKey = function (document) { + return [document]; + }; + DocumentTransform.identity = function () { + return new DocumentTransform(identity, { cache: false }); + }; + DocumentTransform.split = function (predicate, left, right) { + if (right === void 0) { right = DocumentTransform.identity(); } + return Object.assign(new DocumentTransform(function (document) { + var documentTransform = predicate(document) ? left : right; + return documentTransform.transformDocument(document); + }, + { cache: false }), { left: left, right: right }); + }; + DocumentTransform.prototype.resetCache = function () { + var _this = this; + if (this.cached) { + var stableCacheKeys_1 = new trie.Trie(canUseWeakMap); + this.performWork = optimism.wrap(DocumentTransform.prototype.performWork.bind(this), { + makeCacheKey: function (document) { + var cacheKeys = _this.getCacheKey(document); + if (cacheKeys) { + globals.invariant(Array.isArray(cacheKeys), 66); + return stableCacheKeys_1.lookupArray(cacheKeys); + } + }, + max: cacheSizes["documentTransform.cache"], + cache: (caches.WeakCache), + }); + } + }; + DocumentTransform.prototype.performWork = function (document) { + checkDocument(document); + return this.transform(document); + }; + DocumentTransform.prototype.transformDocument = function (document) { + if (this.resultCache.has(document)) { + return document; + } + var transformedDocument = this.performWork(document); + this.resultCache.add(transformedDocument); + return transformedDocument; + }; + DocumentTransform.prototype.concat = function (otherTransform) { + var _this = this; + return Object.assign(new DocumentTransform(function (document) { + return otherTransform.transformDocument(_this.transformDocument(document)); + }, + { cache: false }), { + left: this, + right: otherTransform, + }); + }; + return DocumentTransform; +}()); + +var printCache; +var print = Object.assign(function (ast) { + var result = printCache.get(ast); + if (!result) { + result = graphql.print(ast); + printCache.set(ast, result); + } + return result; +}, { + reset: function () { + printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 ); + }, +}); +print.reset(); +if (globalThis.__DEV__ !== false) { + registerGlobalCache("print", function () { return (printCache ? printCache.size : 0); }); +} + +var isArray = Array.isArray; +function isNonEmptyArray(value) { + return Array.isArray(value) && value.length > 0; +} + +var TYPENAME_FIELD = { + kind: graphql.Kind.FIELD, + name: { + kind: graphql.Kind.NAME, + value: "__typename", + }, +}; +function isEmpty(op, fragmentMap) { + return (!op || + op.selectionSet.selections.every(function (selection) { + return selection.kind === graphql.Kind.FRAGMENT_SPREAD && + isEmpty(fragmentMap[selection.name.value], fragmentMap); + })); +} +function nullIfDocIsEmpty(doc) { + return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ? + null + : doc; +} +function getDirectiveMatcher(configs) { + var names = new Map(); + var tests = new Map(); + configs.forEach(function (directive) { + if (directive) { + if (directive.name) { + names.set(directive.name, directive); + } + else if (directive.test) { + tests.set(directive.test, directive); + } + } + }); + return function (directive) { + var config = names.get(directive.name.value); + if (!config && tests.size) { + tests.forEach(function (testConfig, test) { + if (test(directive)) { + config = testConfig; + } + }); + } + return config; + }; +} +function makeInUseGetterFunction(defaultKey) { + var map = new Map(); + return function inUseGetterFunction(key) { + if (key === void 0) { key = defaultKey; } + var inUse = map.get(key); + if (!inUse) { + map.set(key, (inUse = { + variables: new Set(), + fragmentSpreads: new Set(), + })); + } + return inUse; + }; +} +function removeDirectivesFromDocument(directives, doc) { + checkDocument(doc); + var getInUseByOperationName = makeInUseGetterFunction(""); + var getInUseByFragmentName = makeInUseGetterFunction(""); + var getInUse = function (ancestors) { + for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) { + if (isArray(ancestor)) + continue; + if (ancestor.kind === graphql.Kind.OPERATION_DEFINITION) { + return getInUseByOperationName(ancestor.name && ancestor.name.value); + } + if (ancestor.kind === graphql.Kind.FRAGMENT_DEFINITION) { + return getInUseByFragmentName(ancestor.name.value); + } + } + globalThis.__DEV__ !== false && globals.invariant.error(83); + return null; + }; + var operationCount = 0; + for (var i = doc.definitions.length - 1; i >= 0; --i) { + if (doc.definitions[i].kind === graphql.Kind.OPERATION_DEFINITION) { + ++operationCount; + } + } + var directiveMatcher = getDirectiveMatcher(directives); + var shouldRemoveField = function (nodeDirectives) { + return isNonEmptyArray(nodeDirectives) && + nodeDirectives + .map(directiveMatcher) + .some(function (config) { return config && config.remove; }); + }; + var originalFragmentDefsByPath = new Map(); + var firstVisitMadeChanges = false; + var fieldOrInlineFragmentVisitor = { + enter: function (node) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + }, + }; + var docWithoutDirectiveSubtrees = graphql.visit(doc, { + Field: fieldOrInlineFragmentVisitor, + InlineFragment: fieldOrInlineFragmentVisitor, + VariableDefinition: { + enter: function () { + return false; + }, + }, + Variable: { + enter: function (node, _key, _parent, _path, ancestors) { + var inUse = getInUse(ancestors); + if (inUse) { + inUse.variables.add(node.name.value); + } + }, + }, + FragmentSpread: { + enter: function (node, _key, _parent, _path, ancestors) { + if (shouldRemoveField(node.directives)) { + firstVisitMadeChanges = true; + return null; + } + var inUse = getInUse(ancestors); + if (inUse) { + inUse.fragmentSpreads.add(node.name.value); + } + }, + }, + FragmentDefinition: { + enter: function (node, _key, _parent, path) { + originalFragmentDefsByPath.set(JSON.stringify(path), node); + }, + leave: function (node, _key, _parent, path) { + var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path)); + if (node === originalNode) { + return node; + } + if ( + operationCount > 0 && + node.selectionSet.selections.every(function (selection) { + return selection.kind === graphql.Kind.FIELD && + selection.name.value === "__typename"; + })) { + getInUseByFragmentName(node.name.value).removed = true; + firstVisitMadeChanges = true; + return null; + } + }, + }, + Directive: { + leave: function (node) { + if (directiveMatcher(node)) { + firstVisitMadeChanges = true; + return null; + } + }, + }, + }); + if (!firstVisitMadeChanges) { + return doc; + } + var populateTransitiveVars = function (inUse) { + if (!inUse.transitiveVars) { + inUse.transitiveVars = new Set(inUse.variables); + if (!inUse.removed) { + inUse.fragmentSpreads.forEach(function (childFragmentName) { + populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) { + inUse.transitiveVars.add(varName); + }); + }); + } + } + return inUse; + }; + var allFragmentNamesUsed = new Set(); + docWithoutDirectiveSubtrees.definitions.forEach(function (def) { + if (def.kind === graphql.Kind.OPERATION_DEFINITION) { + populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + } + else if (def.kind === graphql.Kind.FRAGMENT_DEFINITION && + operationCount === 0 && + !getInUseByFragmentName(def.name.value).removed) { + allFragmentNamesUsed.add(def.name.value); + } + }); + allFragmentNamesUsed.forEach(function (fragmentName) { + populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) { + allFragmentNamesUsed.add(childFragmentName); + }); + }); + var fragmentWillBeRemoved = function (fragmentName) { + return !!( + (!allFragmentNamesUsed.has(fragmentName) || + getInUseByFragmentName(fragmentName).removed)); + }; + var enterVisitor = { + enter: function (node) { + if (fragmentWillBeRemoved(node.name.value)) { + return null; + } + }, + }; + return nullIfDocIsEmpty(graphql.visit(docWithoutDirectiveSubtrees, { + FragmentSpread: enterVisitor, + FragmentDefinition: enterVisitor, + OperationDefinition: { + leave: function (node) { + if (node.variableDefinitions) { + var usedVariableNames_1 = populateTransitiveVars( + getInUseByOperationName(node.name && node.name.value)).transitiveVars; + if (usedVariableNames_1.size < node.variableDefinitions.length) { + return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { + return usedVariableNames_1.has(varDef.variable.name.value); + }) }); + } + } + }, + }, + })); +} +var addTypenameToDocument = Object.assign(function (doc) { + return graphql.visit(doc, { + SelectionSet: { + enter: function (node, _key, parent) { + if (parent && + parent.kind === + graphql.Kind.OPERATION_DEFINITION) { + return; + } + var selections = node.selections; + if (!selections) { + return; + } + var skip = selections.some(function (selection) { + return (isField(selection) && + (selection.name.value === "__typename" || + selection.name.value.lastIndexOf("__", 0) === 0)); + }); + if (skip) { + return; + } + var field = parent; + if (isField(field) && + field.directives && + field.directives.some(function (d) { return d.name.value === "export"; })) { + return; + } + return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) }); + }, + }, + }); +}, { + added: function (field) { + return field === TYPENAME_FIELD; + }, +}); +var connectionRemoveConfig = { + test: function (directive) { + var willRemove = directive.name.value === "connection"; + if (willRemove) { + if (!directive.arguments || + !directive.arguments.some(function (arg) { return arg.name.value === "key"; })) { + globalThis.__DEV__ !== false && globals.invariant.warn(84); + } + } + return willRemove; + }, +}; +function removeConnectionDirectiveFromDocument(doc) { + return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); +} +function getArgumentMatcher(config) { + return function argumentMatcher(argument) { + return config.some(function (aConfig) { + return argument.value && + argument.value.kind === graphql.Kind.VARIABLE && + argument.value.name && + (aConfig.name === argument.value.name.value || + (aConfig.test && aConfig.test(argument))); + }); + }; +} +function removeArgumentsFromDocument(config, doc) { + var argMatcher = getArgumentMatcher(config); + return nullIfDocIsEmpty(graphql.visit(doc, { + OperationDefinition: { + enter: function (node) { + return tslib.__assign(tslib.__assign({}, node), { + variableDefinitions: node.variableDefinitions ? + node.variableDefinitions.filter(function (varDef) { + return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); + }) + : [] }); + }, + }, + Field: { + enter: function (node) { + var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); + if (shouldRemoveField) { + var argMatchCount_1 = 0; + if (node.arguments) { + node.arguments.forEach(function (arg) { + if (argMatcher(arg)) { + argMatchCount_1 += 1; + } + }); + } + if (argMatchCount_1 === 1) { + return null; + } + } + }, + }, + Argument: { + enter: function (node) { + if (argMatcher(node)) { + return null; + } + }, + }, + })); +} +function removeFragmentSpreadFromDocument(config, doc) { + function enter(node) { + if (config.some(function (def) { return def.name === node.name.value; })) { + return null; + } + } + return nullIfDocIsEmpty(graphql.visit(doc, { + FragmentSpread: { enter: enter }, + FragmentDefinition: { enter: enter }, + })); +} +function buildQueryFromSelectionSet(document) { + var definition = getMainDefinition(document); + var definitionOperation = definition.operation; + if (definitionOperation === "query") { + return document; + } + var modifiedDoc = graphql.visit(document, { + OperationDefinition: { + enter: function (node) { + return tslib.__assign(tslib.__assign({}, node), { operation: "query" }); + }, + }, + }); + return modifiedDoc; +} +function removeClientSetsFromDocument(document) { + checkDocument(document); + var modifiedDoc = removeDirectivesFromDocument([ + { + test: function (directive) { return directive.name.value === "client"; }, + remove: true, + }, + ], document); + return modifiedDoc; +} + +function isOperation(document, operation) { + var _a; + return ((_a = getOperationDefinition(document)) === null || _a === void 0 ? void 0 : _a.operation) === operation; +} +function isMutationOperation(document) { + return isOperation(document, "mutation"); +} +function isQueryOperation(document) { + return isOperation(document, "query"); +} +function isSubscriptionOperation(document) { + return isOperation(document, "subscription"); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +function mergeDeep() { + var sources = []; + for (var _i = 0; _i < arguments.length; _i++) { + sources[_i] = arguments[_i]; + } + return mergeDeepArray(sources); +} +function mergeDeepArray(sources) { + var target = sources[0] || {}; + var count = sources.length; + if (count > 1) { + var merger = new DeepMerger(); + for (var i = 1; i < count; ++i) { + target = merger.merge(target, sources[i]); + } + } + return target; +} +var defaultReconciler = function (target, source, property) { + return this.merge(target[property], source[property]); +}; +var DeepMerger = (function () { + function DeepMerger(reconciler) { + if (reconciler === void 0) { reconciler = defaultReconciler; } + this.reconciler = reconciler; + this.isObject = isNonNullObject; + this.pastCopies = new Set(); + } + DeepMerger.prototype.merge = function (target, source) { + var _this = this; + var context = []; + for (var _i = 2; _i < arguments.length; _i++) { + context[_i - 2] = arguments[_i]; + } + if (isNonNullObject(source) && isNonNullObject(target)) { + Object.keys(source).forEach(function (sourceKey) { + if (hasOwnProperty.call(target, sourceKey)) { + var targetValue = target[sourceKey]; + if (source[sourceKey] !== targetValue) { + var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, + source, + sourceKey], context, false)); + if (result !== targetValue) { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = result; + } + } + } + else { + target = _this.shallowCopyForMerge(target); + target[sourceKey] = source[sourceKey]; + } + }); + return target; + } + return source; + }; + DeepMerger.prototype.shallowCopyForMerge = function (value) { + if (isNonNullObject(value)) { + if (!this.pastCopies.has(value)) { + if (Array.isArray(value)) { + value = value.slice(0); + } + else { + value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value); + } + this.pastCopies.add(value); + } + } + return value; + }; + return DeepMerger; +}()); + +function concatPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming) { + return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing, true), incoming, true) : incoming; + }, + }; +} +function offsetLimitPagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + merge: function (existing, incoming, _a) { + var args = _a.args; + var merged = existing ? existing.slice(0) : []; + if (incoming) { + if (args) { + var _b = args.offset, offset = _b === void 0 ? 0 : _b; + for (var i = 0; i < incoming.length; ++i) { + merged[offset + i] = incoming[i]; + } + } + else { + merged.push.apply(merged, incoming); + } + } + return merged; + }, + }; +} +function relayStylePagination(keyArgs) { + if (keyArgs === void 0) { keyArgs = false; } + return { + keyArgs: keyArgs, + read: function (existing, _a) { + var canRead = _a.canRead, readField = _a.readField; + if (!existing) + return existing; + var edges = []; + var firstEdgeCursor = ""; + var lastEdgeCursor = ""; + existing.edges.forEach(function (edge) { + if (canRead(readField("node", edge))) { + edges.push(edge); + if (edge.cursor) { + firstEdgeCursor = firstEdgeCursor || edge.cursor || ""; + lastEdgeCursor = edge.cursor || lastEdgeCursor; + } + } + }); + if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) { + firstEdgeCursor = ""; + } + var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor; + return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), { + startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) }); + }, + merge: function (existing, incoming, _a) { + var args = _a.args, isReference = _a.isReference, readField = _a.readField; + if (!existing) { + existing = makeEmptyData(); + } + if (!incoming) { + return existing; + } + var incomingEdges = incoming.edges ? + incoming.edges.map(function (edge) { + if (isReference((edge = tslib.__assign({}, edge)))) { + edge.cursor = readField("cursor", edge); + } + return edge; + }) + : []; + if (incoming.pageInfo) { + var pageInfo_1 = incoming.pageInfo; + var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor; + var firstEdge = incomingEdges[0]; + var lastEdge = incomingEdges[incomingEdges.length - 1]; + if (firstEdge && startCursor) { + firstEdge.cursor = startCursor; + } + if (lastEdge && endCursor) { + lastEdge.cursor = endCursor; + } + var firstCursor = firstEdge && firstEdge.cursor; + if (firstCursor && !startCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + startCursor: firstCursor, + }, + }); + } + var lastCursor = lastEdge && lastEdge.cursor; + if (lastCursor && !endCursor) { + incoming = mergeDeep(incoming, { + pageInfo: { + endCursor: lastCursor, + }, + }); + } + } + var prefix = existing.edges; + var suffix = []; + if (args && args.after) { + var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; }); + if (index >= 0) { + prefix = prefix.slice(0, index + 1); + } + } + else if (args && args.before) { + var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; }); + suffix = index < 0 ? prefix : prefix.slice(index); + prefix = []; + } + else if (incoming.edges) { + prefix = []; + } + var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix, true), incomingEdges, true), suffix, true); + var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo); + if (incoming.pageInfo) { + var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]); + Object.assign(pageInfo, extras); + if (!prefix.length) { + if (void 0 !== hasPreviousPage) + pageInfo.hasPreviousPage = hasPreviousPage; + if (void 0 !== startCursor) + pageInfo.startCursor = startCursor; + } + if (!suffix.length) { + if (void 0 !== hasNextPage) + pageInfo.hasNextPage = hasNextPage; + if (void 0 !== endCursor) + pageInfo.endCursor = endCursor; + } + } + return tslib.__assign(tslib.__assign(tslib.__assign({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo }); + }, + }; +} +var getExtras = function (obj) { return tslib.__rest(obj, notExtras); }; +var notExtras = ["edges", "pageInfo"]; +function makeEmptyData() { + return { + edges: [], + pageInfo: { + hasPreviousPage: false, + hasNextPage: true, + startCursor: "", + endCursor: "", + }, + }; +} + +function createFulfilledPromise(value) { + var promise = Promise.resolve(value); + promise.status = "fulfilled"; + promise.value = value; + return promise; +} +function createRejectedPromise(reason) { + var promise = Promise.reject(reason); + promise.catch(function () { }); + promise.status = "rejected"; + promise.reason = reason; + return promise; +} +function isStatefulPromise(promise) { + return "status" in promise; +} +function wrapPromiseWithState(promise) { + if (isStatefulPromise(promise)) { + return promise; + } + var pendingPromise = promise; + pendingPromise.status = "pending"; + pendingPromise.then(function (value) { + if (pendingPromise.status === "pending") { + var fulfilledPromise = pendingPromise; + fulfilledPromise.status = "fulfilled"; + fulfilledPromise.value = value; + } + }, function (reason) { + if (pendingPromise.status === "pending") { + var rejectedPromise = pendingPromise; + rejectedPromise.status = "rejected"; + rejectedPromise.reason = reason; + } + }); + return promise; +} + +var toString = Object.prototype.toString; +function cloneDeep(value) { + return cloneDeepHelper(value); +} +function cloneDeepHelper(val, seen) { + switch (toString.call(val)) { + case "[object Array]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + var copy_1 = val.slice(0); + seen.set(val, copy_1); + copy_1.forEach(function (child, i) { + copy_1[i] = cloneDeepHelper(child, seen); + }); + return copy_1; + } + case "[object Object]": { + seen = seen || new Map(); + if (seen.has(val)) + return seen.get(val); + var copy_2 = Object.create(Object.getPrototypeOf(val)); + seen.set(val, copy_2); + Object.keys(val).forEach(function (key) { + copy_2[key] = cloneDeepHelper(val[key], seen); + }); + return copy_2; + } + default: + return val; + } +} + +function deepFreeze(value) { + var workSet = new Set([value]); + workSet.forEach(function (obj) { + if (isNonNullObject(obj) && shallowFreeze(obj) === obj) { + Object.getOwnPropertyNames(obj).forEach(function (name) { + if (isNonNullObject(obj[name])) + workSet.add(obj[name]); + }); + } + }); + return value; +} +function shallowFreeze(obj) { + if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) { + try { + Object.freeze(obj); + } + catch (e) { + if (e instanceof TypeError) + return null; + throw e; + } + } + return obj; +} +function maybeDeepFreeze(obj) { + if (globalThis.__DEV__ !== false) { + deepFreeze(obj); + } + return obj; +} + +function iterateObserversSafely(observers, method, argument) { + var observersWithMethod = []; + observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); + observersWithMethod.forEach(function (obs) { return obs[method](argument); }); +} + +function asyncMap(observable, mapFn, catchFn) { + return new zenObservableTs.Observable(function (observer) { + var promiseQueue = { + then: function (callback) { + return new Promise(function (resolve) { return resolve(callback()); }); + }, + }; + function makeCallback(examiner, key) { + return function (arg) { + if (examiner) { + var both = function () { + return observer.closed ? + 0 + : examiner(arg); + }; + promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); }); + } + else { + observer[key](arg); + } + }; + } + var handler = { + next: makeCallback(mapFn, "next"), + error: makeCallback(catchFn, "error"), + complete: function () { + promiseQueue.then(function () { return observer.complete(); }); + }, + }; + var sub = observable.subscribe(handler); + return function () { return sub.unsubscribe(); }; + }); +} + +function fixObservableSubclass(subclass) { + function set(key) { + Object.defineProperty(subclass, key, { value: zenObservableTs.Observable }); + } + if (canUseSymbol && Symbol.species) { + set(Symbol.species); + } + set("@@species"); + return subclass; +} + +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +var Concast = (function (_super) { + tslib.__extends(Concast, _super); + function Concast(sources) { + var _this = _super.call(this, function (observer) { + _this.addObserver(observer); + return function () { return _this.removeObserver(observer); }; + }) || this; + _this.observers = new Set(); + _this.promise = new Promise(function (resolve, reject) { + _this.resolve = resolve; + _this.reject = reject; + }); + _this.handlers = { + next: function (result) { + if (_this.sub !== null) { + _this.latest = ["next", result]; + _this.notify("next", result); + iterateObserversSafely(_this.observers, "next", result); + } + }, + error: function (error) { + var sub = _this.sub; + if (sub !== null) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + _this.latest = ["error", error]; + _this.reject(error); + _this.notify("error", error); + iterateObserversSafely(_this.observers, "error", error); + } + }, + complete: function () { + var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b; + if (sub !== null) { + var value = sources.shift(); + if (!value) { + if (sub) + setTimeout(function () { return sub.unsubscribe(); }); + _this.sub = null; + if (_this.latest && _this.latest[0] === "next") { + _this.resolve(_this.latest[1]); + } + else { + _this.resolve(); + } + _this.notify("complete"); + iterateObserversSafely(_this.observers, "complete"); + } + else if (isPromiseLike(value)) { + value.then(function (obs) { return (_this.sub = obs.subscribe(_this.handlers)); }, _this.handlers.error); + } + else { + _this.sub = value.subscribe(_this.handlers); + } + } + }, + }; + _this.nextResultListeners = new Set(); + _this.cancel = function (reason) { + _this.reject(reason); + _this.sources = []; + _this.handlers.complete(); + }; + _this.promise.catch(function (_) { }); + if (typeof sources === "function") { + sources = [new zenObservableTs.Observable(sources)]; + } + if (isPromiseLike(sources)) { + sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error); + } + else { + _this.start(sources); + } + return _this; + } + Concast.prototype.start = function (sources) { + if (this.sub !== void 0) + return; + this.sources = Array.from(sources); + this.handlers.complete(); + }; + Concast.prototype.deliverLastMessage = function (observer) { + if (this.latest) { + var nextOrError = this.latest[0]; + var method = observer[nextOrError]; + if (method) { + method.call(observer, this.latest[1]); + } + if (this.sub === null && nextOrError === "next" && observer.complete) { + observer.complete(); + } + } + }; + Concast.prototype.addObserver = function (observer) { + if (!this.observers.has(observer)) { + this.deliverLastMessage(observer); + this.observers.add(observer); + } + }; + Concast.prototype.removeObserver = function (observer) { + if (this.observers.delete(observer) && this.observers.size < 1) { + this.handlers.complete(); + } + }; + Concast.prototype.notify = function (method, arg) { + var nextResultListeners = this.nextResultListeners; + if (nextResultListeners.size) { + this.nextResultListeners = new Set(); + nextResultListeners.forEach(function (listener) { return listener(method, arg); }); + } + }; + Concast.prototype.beforeNext = function (callback) { + var called = false; + this.nextResultListeners.add(function (method, arg) { + if (!called) { + called = true; + callback(method, arg); + } + }); + }; + return Concast; +}(zenObservableTs.Observable)); +fixObservableSubclass(Concast); + +function isExecutionPatchIncrementalResult(value) { + return "incremental" in value; +} +function isExecutionPatchInitialResult(value) { + return "hasNext" in value && "data" in value; +} +function isExecutionPatchResult(value) { + return (isExecutionPatchIncrementalResult(value) || + isExecutionPatchInitialResult(value)); +} +function isApolloPayloadResult(value) { + return isNonNullObject(value) && "payload" in value; +} +function mergeIncrementalData(prevResult, result) { + var mergedData = prevResult; + var merger = new DeepMerger(); + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (_a) { + var data = _a.data, path = _a.path; + for (var i = path.length - 1; i >= 0; --i) { + var key = path[i]; + var isNumericKey = !isNaN(+key); + var parent_1 = isNumericKey ? [] : {}; + parent_1[key] = data; + data = parent_1; + } + mergedData = merger.merge(mergedData, data); + }); + } + return mergedData; +} + +function graphQLResultHasError(result) { + var errors = getGraphQLErrorsFromResult(result); + return isNonEmptyArray(errors); +} +function getGraphQLErrorsFromResult(result) { + var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; + if (isExecutionPatchIncrementalResult(result) && + isNonEmptyArray(result.incremental)) { + result.incremental.forEach(function (incrementalResult) { + if (incrementalResult.errors) { + graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors); + } + }); + } + return graphQLErrors; +} + +function compact() { + var objects = []; + for (var _i = 0; _i < arguments.length; _i++) { + objects[_i] = arguments[_i]; + } + var result = Object.create(null); + objects.forEach(function (obj) { + if (!obj) + return; + Object.keys(obj).forEach(function (key) { + var value = obj[key]; + if (value !== void 0) { + result[key] = value; + } + }); + }); + return result; +} + +var prefixCounts = new Map(); +function makeUniqueId(prefix) { + var count = prefixCounts.get(prefix) || 1; + prefixCounts.set(prefix, count + 1); + return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2)); +} + +function stringifyForDisplay(value, space) { + if (space === void 0) { space = 0; } + var undefId = makeUniqueId("stringifyForDisplay"); + return JSON.stringify(value, function (key, value) { + return value === void 0 ? undefId : value; + }, space) + .split(JSON.stringify(undefId)) + .join(""); +} + +function mergeOptions(defaults, options) { + return compact(defaults, options, options.variables && { + variables: compact(tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables)), + }); +} + +function omitDeep(value, key) { + return __omitDeep(value, key); +} +function __omitDeep(value, key, known) { + if (known === void 0) { known = new Map(); } + if (known.has(value)) { + return known.get(value); + } + var modified = false; + if (Array.isArray(value)) { + var array_1 = []; + known.set(value, array_1); + value.forEach(function (value, index) { + var result = __omitDeep(value, key, known); + modified || (modified = result !== value); + array_1[index] = result; + }); + if (modified) { + return array_1; + } + } + else if (isPlainObject(value)) { + var obj_1 = Object.create(Object.getPrototypeOf(value)); + known.set(value, obj_1); + Object.keys(value).forEach(function (k) { + if (k === key) { + modified = true; + return; + } + var result = __omitDeep(value[k], key, known); + modified || (modified = result !== value[k]); + obj_1[k] = result; + }); + if (modified) { + return obj_1; + } + } + return value; +} + +function stripTypename(value) { + return omitDeep(value, "__typename"); +} + +exports.DEV = globals.DEV; +exports.maybe = globals.maybe; +exports.Observable = zenObservableTs.Observable; +exports.AutoCleanedStrongCache = AutoCleanedStrongCache; +exports.AutoCleanedWeakCache = AutoCleanedWeakCache; +exports.Concast = Concast; +exports.DeepMerger = DeepMerger; +exports.DocumentTransform = DocumentTransform; +exports.addTypenameToDocument = addTypenameToDocument; +exports.argumentsObjectFromField = argumentsObjectFromField; +exports.asyncMap = asyncMap; +exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet; +exports.cacheSizes = cacheSizes; +exports.canUseAsyncIteratorSymbol = canUseAsyncIteratorSymbol; +exports.canUseDOM = canUseDOM; +exports.canUseLayoutEffect = canUseLayoutEffect; +exports.canUseSymbol = canUseSymbol; +exports.canUseWeakMap = canUseWeakMap; +exports.canUseWeakSet = canUseWeakSet; +exports.canonicalStringify = canonicalStringify; +exports.checkDocument = checkDocument; +exports.cloneDeep = cloneDeep; +exports.compact = compact; +exports.concatPagination = concatPagination; +exports.createFragmentMap = createFragmentMap; +exports.createFulfilledPromise = createFulfilledPromise; +exports.createRejectedPromise = createRejectedPromise; +exports.fixObservableSubclass = fixObservableSubclass; +exports.getDefaultValues = getDefaultValues; +exports.getDirectiveNames = getDirectiveNames; +exports.getFragmentDefinition = getFragmentDefinition; +exports.getFragmentDefinitions = getFragmentDefinitions; +exports.getFragmentFromSelection = getFragmentFromSelection; +exports.getFragmentQueryDocument = getFragmentQueryDocument; +exports.getGraphQLErrorsFromResult = getGraphQLErrorsFromResult; +exports.getInclusionDirectives = getInclusionDirectives; +exports.getMainDefinition = getMainDefinition; +exports.getOperationDefinition = getOperationDefinition; +exports.getOperationName = getOperationName; +exports.getQueryDefinition = getQueryDefinition; +exports.getStoreKeyName = getStoreKeyName; +exports.getTypenameFromResult = getTypenameFromResult; +exports.graphQLResultHasError = graphQLResultHasError; +exports.hasAllDirectives = hasAllDirectives; +exports.hasAnyDirectives = hasAnyDirectives; +exports.hasClientExports = hasClientExports; +exports.hasDirectives = hasDirectives; +exports.isApolloPayloadResult = isApolloPayloadResult; +exports.isArray = isArray; +exports.isDocumentNode = isDocumentNode; +exports.isExecutionPatchIncrementalResult = isExecutionPatchIncrementalResult; +exports.isExecutionPatchInitialResult = isExecutionPatchInitialResult; +exports.isExecutionPatchResult = isExecutionPatchResult; +exports.isField = isField; +exports.isInlineFragment = isInlineFragment; +exports.isMutationOperation = isMutationOperation; +exports.isNonEmptyArray = isNonEmptyArray; +exports.isNonNullObject = isNonNullObject; +exports.isPlainObject = isPlainObject; +exports.isQueryOperation = isQueryOperation; +exports.isReference = isReference; +exports.isStatefulPromise = isStatefulPromise; +exports.isSubscriptionOperation = isSubscriptionOperation; +exports.iterateObserversSafely = iterateObserversSafely; +exports.makeReference = makeReference; +exports.makeUniqueId = makeUniqueId; +exports.maybeDeepFreeze = maybeDeepFreeze; +exports.mergeDeep = mergeDeep; +exports.mergeDeepArray = mergeDeepArray; +exports.mergeIncrementalData = mergeIncrementalData; +exports.mergeOptions = mergeOptions; +exports.offsetLimitPagination = offsetLimitPagination; +exports.omitDeep = omitDeep; +exports.print = print; +exports.relayStylePagination = relayStylePagination; +exports.removeArgumentsFromDocument = removeArgumentsFromDocument; +exports.removeClientSetsFromDocument = removeClientSetsFromDocument; +exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument; +exports.removeDirectivesFromDocument = removeDirectivesFromDocument; +exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument; +exports.resultKeyNameFromField = resultKeyNameFromField; +exports.shouldInclude = shouldInclude; +exports.storeKeyNameFromField = storeKeyNameFromField; +exports.stringifyForDisplay = stringifyForDisplay; +exports.stripTypename = stripTypename; +exports.valueToObjectRepresentation = valueToObjectRepresentation; +exports.wrapPromiseWithState = wrapPromiseWithState; +//# sourceMappingURL=utilities.cjs.map diff --git a/graphql-subscription/node_modules/@apollo/client/version.d.ts b/graphql-subscription/node_modules/@apollo/client/version.d.ts new file mode 100644 index 0000000..ddfcd3b --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/version.d.ts @@ -0,0 +1,2 @@ +export declare const version = "local"; +//# sourceMappingURL=version.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/version.js b/graphql-subscription/node_modules/@apollo/client/version.js new file mode 100644 index 0000000..9380f32 --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/version.js @@ -0,0 +1,2 @@ +export var version = "3.9.5"; +//# sourceMappingURL=version.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@apollo/client/version.js.map b/graphql-subscription/node_modules/@apollo/client/version.js.map new file mode 100644 index 0000000..94992db --- /dev/null +++ b/graphql-subscription/node_modules/@apollo/client/version.js.map @@ -0,0 +1 @@ +{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const version = \"local\";\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@graphql-typed-document-node/core/LICENSE b/graphql-subscription/node_modules/@graphql-typed-document-node/core/LICENSE new file mode 100644 index 0000000..1e90edd --- /dev/null +++ b/graphql-subscription/node_modules/@graphql-typed-document-node/core/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2020-2023 Dotan Simha + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription/node_modules/@graphql-typed-document-node/core/package.json b/graphql-subscription/node_modules/@graphql-typed-document-node/core/package.json new file mode 100644 index 0000000..c8d2e68 --- /dev/null +++ b/graphql-subscription/node_modules/@graphql-typed-document-node/core/package.json @@ -0,0 +1,15 @@ +{ + "name": "@graphql-typed-document-node/core", + "version": "3.2.0", + "peerDependencies": { + "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" + }, + "repository": "git@github.com:dotansimha/graphql-typed-document-node.git", + "author": "Dotan Simha ", + "license": "MIT", + "main": "", + "typings": "typings/index.d.ts", + "typescript": { + "definition": "typings/index.d.ts" + } +} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@graphql-typed-document-node/core/typings/index.d.ts b/graphql-subscription/node_modules/@graphql-typed-document-node/core/typings/index.d.ts new file mode 100644 index 0000000..ac98637 --- /dev/null +++ b/graphql-subscription/node_modules/@graphql-typed-document-node/core/typings/index.d.ts @@ -0,0 +1,29 @@ +import type { DocumentNode } from "graphql"; +export interface DocumentTypeDecoration { + /** + * This type is used to ensure that the variables you pass in to the query are assignable to Variables + * and that the Result is assignable to whatever you pass your result to. The method is never actually + * implemented, but the type is valid because we list it as optional + */ + __apiType?: (variables: TVariables) => TResult; +} +export interface TypedDocumentNode extends DocumentNode, DocumentTypeDecoration { +} +/** + * Helper for extracting a TypeScript type for operation result from a TypedDocumentNode and TypedDocumentString. + * @example + * const myQuery = { ... }; // TypedDocumentNode + * type ResultType = ResultOf; // Now it's R + */ +export type ResultOf = T extends DocumentTypeDecoration ? ResultType : never; +/** + * Helper for extracting a TypeScript type for operation variables from a TypedDocumentNode and TypedDocumentString. + * @example + * const myQuery = { ... }; // TypedDocumentNode + * type VariablesType = VariablesOf; // Now it's V + */ +export type VariablesOf = T extends DocumentTypeDecoration ? VariablesType : never; diff --git a/graphql-subscription/node_modules/@wry/caches/LICENSE b/graphql-subscription/node_modules/@wry/caches/LICENSE new file mode 100644 index 0000000..8a112f6 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2021 Ben Newman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/@wry/caches/README.md b/graphql-subscription/node_modules/@wry/caches/README.md new file mode 100644 index 0000000..fa0ba63 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/README.md @@ -0,0 +1,9 @@ +# @wry/caches + +Various cache implementations, including but not limited to + +* `StrongCache`: A standard `Map`-like cache with a least-recently-used (LRU) + eviction policy and a callback hook for removed entries. + +* `WeakCache`: Another LRU cache that holds its keys only weakly, so entries can be removed + once no longer retained elsewhere in the application. diff --git a/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs b/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs new file mode 100644 index 0000000..fa47fe4 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs @@ -0,0 +1,245 @@ +'use strict'; + +function defaultDispose$1() { } +var StrongCache = /** @class */ (function () { + function StrongCache(max, dispose) { + if (max === void 0) { max = Infinity; } + if (dispose === void 0) { dispose = defaultDispose$1; } + this.max = max; + this.dispose = dispose; + this.map = new Map(); + this.newest = null; + this.oldest = null; + } + StrongCache.prototype.has = function (key) { + return this.map.has(key); + }; + StrongCache.prototype.get = function (key) { + var node = this.getNode(key); + return node && node.value; + }; + Object.defineProperty(StrongCache.prototype, "size", { + get: function () { + return this.map.size; + }, + enumerable: false, + configurable: true + }); + StrongCache.prototype.getNode = function (key) { + var node = this.map.get(key); + if (node && node !== this.newest) { + var older = node.older, newer = node.newer; + if (newer) { + newer.older = older; + } + if (older) { + older.newer = newer; + } + node.older = this.newest; + node.older.newer = node; + node.newer = null; + this.newest = node; + if (node === this.oldest) { + this.oldest = newer; + } + } + return node; + }; + StrongCache.prototype.set = function (key, value) { + var node = this.getNode(key); + if (node) { + return node.value = value; + } + node = { + key: key, + value: value, + newer: null, + older: this.newest + }; + if (this.newest) { + this.newest.newer = node; + } + this.newest = node; + this.oldest = this.oldest || node; + this.map.set(key, node); + return node.value; + }; + StrongCache.prototype.clean = function () { + while (this.oldest && this.map.size > this.max) { + this.delete(this.oldest.key); + } + }; + StrongCache.prototype.delete = function (key) { + var node = this.map.get(key); + if (node) { + if (node === this.newest) { + this.newest = node.older; + } + if (node === this.oldest) { + this.oldest = node.newer; + } + if (node.newer) { + node.newer.older = node.older; + } + if (node.older) { + node.older.newer = node.newer; + } + this.map.delete(key); + this.dispose(node.value, key); + return true; + } + return false; + }; + return StrongCache; +}()); + +function noop() { } +var defaultDispose = noop; +var _WeakRef = typeof WeakRef !== "undefined" + ? WeakRef + : function (value) { + return { deref: function () { return value; } }; + }; +var _WeakMap = typeof WeakMap !== "undefined" ? WeakMap : Map; +var _FinalizationRegistry = typeof FinalizationRegistry !== "undefined" + ? FinalizationRegistry + : function () { + return { + register: noop, + unregister: noop, + }; + }; +var finalizationBatchSize = 10024; +var WeakCache = /** @class */ (function () { + function WeakCache(max, dispose) { + if (max === void 0) { max = Infinity; } + if (dispose === void 0) { dispose = defaultDispose; } + var _this = this; + this.max = max; + this.dispose = dispose; + this.map = new _WeakMap(); + this.newest = null; + this.oldest = null; + this.unfinalizedNodes = new Set(); + this.finalizationScheduled = false; + this.size = 0; + this.finalize = function () { + var iterator = _this.unfinalizedNodes.values(); + for (var i = 0; i < finalizationBatchSize; i++) { + var node = iterator.next().value; + if (!node) + break; + _this.unfinalizedNodes.delete(node); + var key = node.key; + delete node.key; + node.keyRef = new _WeakRef(key); + _this.registry.register(key, node, node); + } + if (_this.unfinalizedNodes.size > 0) { + queueMicrotask(_this.finalize); + } + else { + _this.finalizationScheduled = false; + } + }; + this.registry = new _FinalizationRegistry(this.deleteNode.bind(this)); + } + WeakCache.prototype.has = function (key) { + return this.map.has(key); + }; + WeakCache.prototype.get = function (key) { + var node = this.getNode(key); + return node && node.value; + }; + WeakCache.prototype.getNode = function (key) { + var node = this.map.get(key); + if (node && node !== this.newest) { + var older = node.older, newer = node.newer; + if (newer) { + newer.older = older; + } + if (older) { + older.newer = newer; + } + node.older = this.newest; + node.older.newer = node; + node.newer = null; + this.newest = node; + if (node === this.oldest) { + this.oldest = newer; + } + } + return node; + }; + WeakCache.prototype.set = function (key, value) { + var node = this.getNode(key); + if (node) { + return (node.value = value); + } + node = { + key: key, + value: value, + newer: null, + older: this.newest, + }; + if (this.newest) { + this.newest.newer = node; + } + this.newest = node; + this.oldest = this.oldest || node; + this.scheduleFinalization(node); + this.map.set(key, node); + this.size++; + return node.value; + }; + WeakCache.prototype.clean = function () { + while (this.oldest && this.size > this.max) { + this.deleteNode(this.oldest); + } + }; + WeakCache.prototype.deleteNode = function (node) { + if (node === this.newest) { + this.newest = node.older; + } + if (node === this.oldest) { + this.oldest = node.newer; + } + if (node.newer) { + node.newer.older = node.older; + } + if (node.older) { + node.older.newer = node.newer; + } + this.size--; + var key = node.key || (node.keyRef && node.keyRef.deref()); + this.dispose(node.value, key); + if (!node.keyRef) { + this.unfinalizedNodes.delete(node); + } + else { + this.registry.unregister(node); + } + if (key) + this.map.delete(key); + }; + WeakCache.prototype.delete = function (key) { + var node = this.map.get(key); + if (node) { + this.deleteNode(node); + return true; + } + return false; + }; + WeakCache.prototype.scheduleFinalization = function (node) { + this.unfinalizedNodes.add(node); + if (!this.finalizationScheduled) { + this.finalizationScheduled = true; + queueMicrotask(this.finalize); + } + }; + return WeakCache; +}()); + +exports.StrongCache = StrongCache; +exports.WeakCache = WeakCache; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.map b/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.map new file mode 100644 index 0000000..5f0325e --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.cjs","sources":["es5/strong.js","es5/weak.js"],"sourcesContent":["function defaultDispose() { }\nvar StrongCache = /** @class */ (function () {\n function StrongCache(max, dispose) {\n if (max === void 0) { max = Infinity; }\n if (dispose === void 0) { dispose = defaultDispose; }\n this.max = max;\n this.dispose = dispose;\n this.map = new Map();\n this.newest = null;\n this.oldest = null;\n }\n StrongCache.prototype.has = function (key) {\n return this.map.has(key);\n };\n StrongCache.prototype.get = function (key) {\n var node = this.getNode(key);\n return node && node.value;\n };\n Object.defineProperty(StrongCache.prototype, \"size\", {\n get: function () {\n return this.map.size;\n },\n enumerable: false,\n configurable: true\n });\n StrongCache.prototype.getNode = function (key) {\n var node = this.map.get(key);\n if (node && node !== this.newest) {\n var older = node.older, newer = node.newer;\n if (newer) {\n newer.older = older;\n }\n if (older) {\n older.newer = newer;\n }\n node.older = this.newest;\n node.older.newer = node;\n node.newer = null;\n this.newest = node;\n if (node === this.oldest) {\n this.oldest = newer;\n }\n }\n return node;\n };\n StrongCache.prototype.set = function (key, value) {\n var node = this.getNode(key);\n if (node) {\n return node.value = value;\n }\n node = {\n key: key,\n value: value,\n newer: null,\n older: this.newest\n };\n if (this.newest) {\n this.newest.newer = node;\n }\n this.newest = node;\n this.oldest = this.oldest || node;\n this.map.set(key, node);\n return node.value;\n };\n StrongCache.prototype.clean = function () {\n while (this.oldest && this.map.size > this.max) {\n this.delete(this.oldest.key);\n }\n };\n StrongCache.prototype.delete = function (key) {\n var node = this.map.get(key);\n if (node) {\n if (node === this.newest) {\n this.newest = node.older;\n }\n if (node === this.oldest) {\n this.oldest = node.newer;\n }\n if (node.newer) {\n node.newer.older = node.older;\n }\n if (node.older) {\n node.older.newer = node.newer;\n }\n this.map.delete(key);\n this.dispose(node.value, key);\n return true;\n }\n return false;\n };\n return StrongCache;\n}());\nexport { StrongCache };\n//# sourceMappingURL=strong.js.map","function noop() { }\nvar defaultDispose = noop;\nvar _WeakRef = typeof WeakRef !== \"undefined\"\n ? WeakRef\n : function (value) {\n return { deref: function () { return value; } };\n };\nvar _WeakMap = typeof WeakMap !== \"undefined\" ? WeakMap : Map;\nvar _FinalizationRegistry = typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : function () {\n return {\n register: noop,\n unregister: noop,\n };\n };\nvar finalizationBatchSize = 10024;\nvar WeakCache = /** @class */ (function () {\n function WeakCache(max, dispose) {\n if (max === void 0) { max = Infinity; }\n if (dispose === void 0) { dispose = defaultDispose; }\n var _this = this;\n this.max = max;\n this.dispose = dispose;\n this.map = new _WeakMap();\n this.newest = null;\n this.oldest = null;\n this.unfinalizedNodes = new Set();\n this.finalizationScheduled = false;\n this.size = 0;\n this.finalize = function () {\n var iterator = _this.unfinalizedNodes.values();\n for (var i = 0; i < finalizationBatchSize; i++) {\n var node = iterator.next().value;\n if (!node)\n break;\n _this.unfinalizedNodes.delete(node);\n var key = node.key;\n delete node.key;\n node.keyRef = new _WeakRef(key);\n _this.registry.register(key, node, node);\n }\n if (_this.unfinalizedNodes.size > 0) {\n queueMicrotask(_this.finalize);\n }\n else {\n _this.finalizationScheduled = false;\n }\n };\n this.registry = new _FinalizationRegistry(this.deleteNode.bind(this));\n }\n WeakCache.prototype.has = function (key) {\n return this.map.has(key);\n };\n WeakCache.prototype.get = function (key) {\n var node = this.getNode(key);\n return node && node.value;\n };\n WeakCache.prototype.getNode = function (key) {\n var node = this.map.get(key);\n if (node && node !== this.newest) {\n var older = node.older, newer = node.newer;\n if (newer) {\n newer.older = older;\n }\n if (older) {\n older.newer = newer;\n }\n node.older = this.newest;\n node.older.newer = node;\n node.newer = null;\n this.newest = node;\n if (node === this.oldest) {\n this.oldest = newer;\n }\n }\n return node;\n };\n WeakCache.prototype.set = function (key, value) {\n var node = this.getNode(key);\n if (node) {\n return (node.value = value);\n }\n node = {\n key: key,\n value: value,\n newer: null,\n older: this.newest,\n };\n if (this.newest) {\n this.newest.newer = node;\n }\n this.newest = node;\n this.oldest = this.oldest || node;\n this.scheduleFinalization(node);\n this.map.set(key, node);\n this.size++;\n return node.value;\n };\n WeakCache.prototype.clean = function () {\n while (this.oldest && this.size > this.max) {\n this.deleteNode(this.oldest);\n }\n };\n WeakCache.prototype.deleteNode = function (node) {\n if (node === this.newest) {\n this.newest = node.older;\n }\n if (node === this.oldest) {\n this.oldest = node.newer;\n }\n if (node.newer) {\n node.newer.older = node.older;\n }\n if (node.older) {\n node.older.newer = node.newer;\n }\n this.size--;\n var key = node.key || (node.keyRef && node.keyRef.deref());\n this.dispose(node.value, key);\n if (!node.keyRef) {\n this.unfinalizedNodes.delete(node);\n }\n else {\n this.registry.unregister(node);\n }\n if (key)\n this.map.delete(key);\n };\n WeakCache.prototype.delete = function (key) {\n var node = this.map.get(key);\n if (node) {\n this.deleteNode(node);\n return true;\n }\n return false;\n };\n WeakCache.prototype.scheduleFinalization = function (node) {\n this.unfinalizedNodes.add(node);\n if (!this.finalizationScheduled) {\n this.finalizationScheduled = true;\n queueMicrotask(this.finalize);\n }\n };\n return WeakCache;\n}());\nexport { WeakCache };\n//# sourceMappingURL=weak.js.map"],"names":["defaultDispose"],"mappings":";;AAAA,SAASA,gBAAc,GAAG,GAAG;AAC1B,IAAC,WAAW,kBAAkB,YAAY;AAC7C,IAAI,SAAS,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE;AACvC,QAAQ,IAAI,GAAG,KAAK,KAAK,CAAC,EAAE,EAAE,GAAG,GAAG,QAAQ,CAAC,EAAE;AAC/C,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAGA,gBAAc,CAAC,EAAE;AAC7D,QAAQ,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AACvB,QAAQ,IAAI,CAAC,OAAO,GAAG,OA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QAAQ,IAAI,IAAI,EAAE;AAClB,YAAY,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAClC,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK,CAAC;AACN,IAAI,SAAS,CAAC,SAAS,CAAC,oBAAoB,GAAG,UAAU,IAAI,EAAE;AAC/D,QAAQ,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxC,QAAQ,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;AACzC,YAAY,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;AAC9C,YAAY,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1C,SAAS;AACT,KAAK,CAAC;AACN,IAAI,OAAO,SAAS,CAAC;AACrB,CAAC,EAAE;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.native.js b/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.native.js new file mode 100644 index 0000000..fa47fe4 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/bundle.cjs.native.js @@ -0,0 +1,245 @@ +'use strict'; + +function defaultDispose$1() { } +var StrongCache = /** @class */ (function () { + function StrongCache(max, dispose) { + if (max === void 0) { max = Infinity; } + if (dispose === void 0) { dispose = defaultDispose$1; } + this.max = max; + this.dispose = dispose; + this.map = new Map(); + this.newest = null; + this.oldest = null; + } + StrongCache.prototype.has = function (key) { + return this.map.has(key); + }; + StrongCache.prototype.get = function (key) { + var node = this.getNode(key); + return node && node.value; + }; + Object.defineProperty(StrongCache.prototype, "size", { + get: function () { + return this.map.size; + }, + enumerable: false, + configurable: true + }); + StrongCache.prototype.getNode = function (key) { + var node = this.map.get(key); + if (node && node !== this.newest) { + var older = node.older, newer = node.newer; + if (newer) { + newer.older = older; + } + if (older) { + older.newer = newer; + } + node.older = this.newest; + node.older.newer = node; + node.newer = null; + this.newest = node; + if (node === this.oldest) { + this.oldest = newer; + } + } + return node; + }; + StrongCache.prototype.set = function (key, value) { + var node = this.getNode(key); + if (node) { + return node.value = value; + } + node = { + key: key, + value: value, + newer: null, + older: this.newest + }; + if (this.newest) { + this.newest.newer = node; + } + this.newest = node; + this.oldest = this.oldest || node; + this.map.set(key, node); + return node.value; + }; + StrongCache.prototype.clean = function () { + while (this.oldest && this.map.size > this.max) { + this.delete(this.oldest.key); + } + }; + StrongCache.prototype.delete = function (key) { + var node = this.map.get(key); + if (node) { + if (node === this.newest) { + this.newest = node.older; + } + if (node === this.oldest) { + this.oldest = node.newer; + } + if (node.newer) { + node.newer.older = node.older; + } + if (node.older) { + node.older.newer = node.newer; + } + this.map.delete(key); + this.dispose(node.value, key); + return true; + } + return false; + }; + return StrongCache; +}()); + +function noop() { } +var defaultDispose = noop; +var _WeakRef = typeof WeakRef !== "undefined" + ? WeakRef + : function (value) { + return { deref: function () { return value; } }; + }; +var _WeakMap = typeof WeakMap !== "undefined" ? WeakMap : Map; +var _FinalizationRegistry = typeof FinalizationRegistry !== "undefined" + ? FinalizationRegistry + : function () { + return { + register: noop, + unregister: noop, + }; + }; +var finalizationBatchSize = 10024; +var WeakCache = /** @class */ (function () { + function WeakCache(max, dispose) { + if (max === void 0) { max = Infinity; } + if (dispose === void 0) { dispose = defaultDispose; } + var _this = this; + this.max = max; + this.dispose = dispose; + this.map = new _WeakMap(); + this.newest = null; + this.oldest = null; + this.unfinalizedNodes = new Set(); + this.finalizationScheduled = false; + this.size = 0; + this.finalize = function () { + var iterator = _this.unfinalizedNodes.values(); + for (var i = 0; i < finalizationBatchSize; i++) { + var node = iterator.next().value; + if (!node) + break; + _this.unfinalizedNodes.delete(node); + var key = node.key; + delete node.key; + node.keyRef = new _WeakRef(key); + _this.registry.register(key, node, node); + } + if (_this.unfinalizedNodes.size > 0) { + queueMicrotask(_this.finalize); + } + else { + _this.finalizationScheduled = false; + } + }; + this.registry = new _FinalizationRegistry(this.deleteNode.bind(this)); + } + WeakCache.prototype.has = function (key) { + return this.map.has(key); + }; + WeakCache.prototype.get = function (key) { + var node = this.getNode(key); + return node && node.value; + }; + WeakCache.prototype.getNode = function (key) { + var node = this.map.get(key); + if (node && node !== this.newest) { + var older = node.older, newer = node.newer; + if (newer) { + newer.older = older; + } + if (older) { + older.newer = newer; + } + node.older = this.newest; + node.older.newer = node; + node.newer = null; + this.newest = node; + if (node === this.oldest) { + this.oldest = newer; + } + } + return node; + }; + WeakCache.prototype.set = function (key, value) { + var node = this.getNode(key); + if (node) { + return (node.value = value); + } + node = { + key: key, + value: value, + newer: null, + older: this.newest, + }; + if (this.newest) { + this.newest.newer = node; + } + this.newest = node; + this.oldest = this.oldest || node; + this.scheduleFinalization(node); + this.map.set(key, node); + this.size++; + return node.value; + }; + WeakCache.prototype.clean = function () { + while (this.oldest && this.size > this.max) { + this.deleteNode(this.oldest); + } + }; + WeakCache.prototype.deleteNode = function (node) { + if (node === this.newest) { + this.newest = node.older; + } + if (node === this.oldest) { + this.oldest = node.newer; + } + if (node.newer) { + node.newer.older = node.older; + } + if (node.older) { + node.older.newer = node.newer; + } + this.size--; + var key = node.key || (node.keyRef && node.keyRef.deref()); + this.dispose(node.value, key); + if (!node.keyRef) { + this.unfinalizedNodes.delete(node); + } + else { + this.registry.unregister(node); + } + if (key) + this.map.delete(key); + }; + WeakCache.prototype.delete = function (key) { + var node = this.map.get(key); + if (node) { + this.deleteNode(node); + return true; + } + return false; + }; + WeakCache.prototype.scheduleFinalization = function (node) { + this.unfinalizedNodes.add(node); + if (!this.finalizationScheduled) { + this.finalizationScheduled = true; + queueMicrotask(this.finalize); + } + }; + return WeakCache; +}()); + +exports.StrongCache = StrongCache; +exports.WeakCache = WeakCache; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/caches/lib/common.d.ts b/graphql-subscription/node_modules/@wry/caches/lib/common.d.ts new file mode 100644 index 0000000..4e1e2d1 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/common.d.ts @@ -0,0 +1,8 @@ +export interface CommonCache { + has(key: K): boolean; + get(key: K): V | undefined; + set(key: K, value: V): V; + delete(key: K): boolean; + clean(): void; + readonly size: number; +} diff --git a/graphql-subscription/node_modules/@wry/caches/lib/common.js b/graphql-subscription/node_modules/@wry/caches/lib/common.js new file mode 100644 index 0000000..6b84ded --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/common.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/common.js.map b/graphql-subscription/node_modules/@wry/caches/lib/common.js.map new file mode 100644 index 0000000..8842d30 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/common.js.map @@ -0,0 +1 @@ +{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/index.d.ts b/graphql-subscription/node_modules/@wry/caches/lib/index.d.ts new file mode 100644 index 0000000..bddd192 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/index.d.ts @@ -0,0 +1,3 @@ +export type { CommonCache } from "./common.js"; +export { StrongCache } from "./strong.js"; +export { WeakCache } from "./weak.js"; diff --git a/graphql-subscription/node_modules/@wry/caches/lib/index.js b/graphql-subscription/node_modules/@wry/caches/lib/index.js new file mode 100644 index 0000000..fa8d43e --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/index.js @@ -0,0 +1,3 @@ +export { StrongCache } from "./strong.js"; +export { WeakCache } from "./weak.js"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/index.js.map b/graphql-subscription/node_modules/@wry/caches/lib/index.js.map new file mode 100644 index 0000000..2d916a0 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/strong.d.ts b/graphql-subscription/node_modules/@wry/caches/lib/strong.d.ts new file mode 100644 index 0000000..6eee5bf --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/strong.d.ts @@ -0,0 +1,16 @@ +import type { CommonCache } from "./common"; +export declare class StrongCache implements CommonCache { + private max; + dispose: (value: V, key: K) => void; + private map; + private newest; + private oldest; + constructor(max?: number, dispose?: (value: V, key: K) => void); + has(key: K): boolean; + get(key: K): V | undefined; + get size(): number; + private getNode; + set(key: K, value: V): V; + clean(): void; + delete(key: K): boolean; +} diff --git a/graphql-subscription/node_modules/@wry/caches/lib/strong.js b/graphql-subscription/node_modules/@wry/caches/lib/strong.js new file mode 100644 index 0000000..4a41d84 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/strong.js @@ -0,0 +1,86 @@ +function defaultDispose() { } +export class StrongCache { + constructor(max = Infinity, dispose = defaultDispose) { + this.max = max; + this.dispose = dispose; + this.map = new Map(); + this.newest = null; + this.oldest = null; + } + has(key) { + return this.map.has(key); + } + get(key) { + const node = this.getNode(key); + return node && node.value; + } + get size() { + return this.map.size; + } + getNode(key) { + const node = this.map.get(key); + if (node && node !== this.newest) { + const { older, newer } = node; + if (newer) { + newer.older = older; + } + if (older) { + older.newer = newer; + } + node.older = this.newest; + node.older.newer = node; + node.newer = null; + this.newest = node; + if (node === this.oldest) { + this.oldest = newer; + } + } + return node; + } + set(key, value) { + let node = this.getNode(key); + if (node) { + return node.value = value; + } + node = { + key, + value, + newer: null, + older: this.newest + }; + if (this.newest) { + this.newest.newer = node; + } + this.newest = node; + this.oldest = this.oldest || node; + this.map.set(key, node); + return node.value; + } + clean() { + while (this.oldest && this.map.size > this.max) { + this.delete(this.oldest.key); + } + } + delete(key) { + const node = this.map.get(key); + if (node) { + if (node === this.newest) { + this.newest = node.older; + } + if (node === this.oldest) { + this.oldest = node.newer; + } + if (node.newer) { + node.newer.older = node.older; + } + if (node.older) { + node.older.newer = node.newer; + } + this.map.delete(key); + this.dispose(node.value, key); + return true; + } + return false; + } +} +//# sourceMappingURL=strong.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/strong.js.map b/graphql-subscription/node_modules/@wry/caches/lib/strong.js.map new file mode 100644 index 0000000..1de0423 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/strong.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strong.js","sourceRoot":"","sources":["../src/strong.ts"],"names":[],"mappings":"AASA,SAAS,cAAc,KAAI,CAAC;AAE5B,MAAM,OAAO,WAAW;IAKtB,YACU,MAAM,QAAQ,EACf,UAAsC,cAAc;QADnD,QAAG,GAAH,GAAG,CAAW;QACf,YAAO,GAAP,OAAO,CAA6C;QANrD,QAAG,GAAG,IAAI,GAAG,EAAiB,CAAC;QAC/B,WAAM,GAAsB,IAAI,CAAC;QACjC,WAAM,GAAsB,IAAI,CAAC;IAKtC,CAAC;IAEG,GAAG,CAAC,GAAM;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAEM,GAAG,CAAC,GAAM;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACvB,CAAC;IAEO,OAAO,CAAC,GAAM;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE/B,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,E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AAG,IAAI,CAAC,GAAG,EAAE;YAC9C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC9B;IACH,CAAC;IAEM,MAAM,CAAC,GAAM;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,IAAI,EAAE;YACR,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE;gBACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;aAC1B;YAED,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE;gBACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;aAC1B;YAED,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC/B;YAED,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC/B;YAED,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAE9B,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/weak.d.ts b/graphql-subscription/node_modules/@wry/caches/lib/weak.d.ts new file mode 100644 index 0000000..4b5920f --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/weak.d.ts @@ -0,0 +1,22 @@ +import type { CommonCache } from "./common"; +export declare class WeakCache implements CommonCache { + private max; + dispose: (value: V, key?: K) => void; + private map; + private registry; + private newest; + private oldest; + private unfinalizedNodes; + private finalizationScheduled; + size: number; + constructor(max?: number, dispose?: (value: V, key?: K) => void); + has(key: K): boolean; + get(key: K): V | undefined; + private getNode; + set(key: K, value: V): V; + clean(): void; + private deleteNode; + delete(key: K): boolean; + private scheduleFinalization; + private finalize; +} diff --git a/graphql-subscription/node_modules/@wry/caches/lib/weak.js b/graphql-subscription/node_modules/@wry/caches/lib/weak.js new file mode 100644 index 0000000..1439ff9 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/weak.js @@ -0,0 +1,143 @@ +function noop() { } +const defaultDispose = noop; +const _WeakRef = typeof WeakRef !== "undefined" + ? WeakRef + : function (value) { + return { deref: () => value }; + }; +const _WeakMap = typeof WeakMap !== "undefined" ? WeakMap : Map; +const _FinalizationRegistry = typeof FinalizationRegistry !== "undefined" + ? FinalizationRegistry + : function () { + return { + register: noop, + unregister: noop, + }; + }; +const finalizationBatchSize = 10024; +export class WeakCache { + constructor(max = Infinity, dispose = defaultDispose) { + this.max = max; + this.dispose = dispose; + this.map = new _WeakMap(); + this.newest = null; + this.oldest = null; + this.unfinalizedNodes = new Set(); + this.finalizationScheduled = false; + this.size = 0; + this.finalize = () => { + const iterator = this.unfinalizedNodes.values(); + for (let i = 0; i < finalizationBatchSize; i++) { + const node = iterator.next().value; + if (!node) + break; + this.unfinalizedNodes.delete(node); + const key = node.key; + delete node.key; + node.keyRef = new _WeakRef(key); + this.registry.register(key, node, node); + } + if (this.unfinalizedNodes.size > 0) { + queueMicrotask(this.finalize); + } + else { + this.finalizationScheduled = false; + } + }; + this.registry = new _FinalizationRegistry(this.deleteNode.bind(this)); + } + has(key) { + return this.map.has(key); + } + get(key) { + const node = this.getNode(key); + return node && node.value; + } + getNode(key) { + const node = this.map.get(key); + if (node && node !== this.newest) { + const { older, newer } = node; + if (newer) { + newer.older = older; + } + if (older) { + older.newer = newer; + } + node.older = this.newest; + node.older.newer = node; + node.newer = null; + this.newest = node; + if (node === this.oldest) { + this.oldest = newer; + } + } + return node; + } + set(key, value) { + let node = this.getNode(key); + if (node) { + return (node.value = value); + } + node = { + key, + value, + newer: null, + older: this.newest, + }; + if (this.newest) { + this.newest.newer = node; + } + this.newest = node; + this.oldest = this.oldest || node; + this.scheduleFinalization(node); + this.map.set(key, node); + this.size++; + return node.value; + } + clean() { + while (this.oldest && this.size > this.max) { + this.deleteNode(this.oldest); + } + } + deleteNode(node) { + if (node === this.newest) { + this.newest = node.older; + } + if (node === this.oldest) { + this.oldest = node.newer; + } + if (node.newer) { + node.newer.older = node.older; + } + if (node.older) { + node.older.newer = node.newer; + } + this.size--; + const key = node.key || (node.keyRef && node.keyRef.deref()); + this.dispose(node.value, key); + if (!node.keyRef) { + this.unfinalizedNodes.delete(node); + } + else { + this.registry.unregister(node); + } + if (key) + this.map.delete(key); + } + delete(key) { + const node = this.map.get(key); + if (node) { + this.deleteNode(node); + return true; + } + return false; + } + scheduleFinalization(node) { + this.unfinalizedNodes.add(node); + if (!this.finalizationScheduled) { + this.finalizationScheduled = true; + queueMicrotask(this.finalize); + } + } +} +//# sourceMappingURL=weak.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/lib/weak.js.map b/graphql-subscription/node_modules/@wry/caches/lib/weak.js.map new file mode 100644 index 0000000..1a0a3ac --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/lib/weak.js.map @@ -0,0 +1 @@ +{"version":3,"file":"weak.js","sourceRoot":"","sources":["../src/weak.ts"],"names":[],"mappings":"AAoBA,SAAS,IAAI,KAAI,CAAC;AAClB,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,QAAQ,GACZ,OAAO,OAAO,KAAK,WAAW;IAC5B,CAAC,CAAC,OAAO;IACT,CAAC,CAAE,UAAa,KAAQ;QACpB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,EAG1B,CAAC;IACJ,CAA2B,CAAC;AAClC,MAAM,QAAQ,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAChE,MAAM,qBAAqB,GACz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AC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;SAC/B;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACpC;aAAM;YACL,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAChC;QACD,IAAI,GAAG;YAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAEM,MAAM,CAAC,GAAM;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEtB,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,oBAAoB,CAAC,IAA2B;QACtD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;YAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;YAClC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC/B;IACH,CAAC;CAmBF"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/caches/package.json b/graphql-subscription/node_modules/@wry/caches/package.json new file mode 100644 index 0000000..85251c2 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/package.json @@ -0,0 +1,41 @@ +{ + "name": "@wry/caches", + "version": "1.0.1", + "author": "Ben Newman ", + "description": "Various cache implementations", + "license": "MIT", + "type": "module", + "sideEffects": false, + "main": "lib/bundle.cjs", + "module": "lib/index.js", + "types": "lib/index.d.ts", + "keywords": [], + "homepage": "https://github.com/benjamn/wryware", + "repository": { + "type": "git", + "url": "git+https://github.com/benjamn/wryware.git" + }, + "bugs": { + "url": "https://github.com/benjamn/wryware/issues" + }, + "scripts": { + "build": "npm run clean:before && npm run tsc && npm run rollup && npm run clean:after", + "clean:before": "rimraf lib", + "tsc": "npm run tsc:es5 && npm run tsc:esm", + "tsc:es5": "tsc -p tsconfig.es5.json", + "tsc:esm": "tsc -p tsconfig.json", + "rollup": "rollup -c rollup.config.js", + "clean:after": "rimraf lib/es5", + "prepare": "npm run build", + "test:cjs": "../../shared/test.sh lib/tests/bundle.cjs", + "test:esm": "../../shared/test.sh lib/tests/bundle.js", + "test": "npm run test:esm && npm run test:cjs" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + }, + "gitHead": "fc1400e8db54eb763822c69748c866909363a2c3" +} diff --git a/graphql-subscription/node_modules/@wry/caches/rollup.config.js b/graphql-subscription/node_modules/@wry/caches/rollup.config.js new file mode 100644 index 0000000..ef8e33b --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/rollup.config.js @@ -0,0 +1 @@ +export { default } from "../../shared/rollup.config.js"; diff --git a/graphql-subscription/node_modules/@wry/caches/src/common.ts b/graphql-subscription/node_modules/@wry/caches/src/common.ts new file mode 100644 index 0000000..773d32b --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/src/common.ts @@ -0,0 +1,8 @@ +export interface CommonCache { + has(key: K): boolean; + get(key: K): V | undefined; + set(key: K, value: V): V; + delete(key: K): boolean; + clean(): void; + readonly size: number; +} diff --git a/graphql-subscription/node_modules/@wry/caches/src/index.ts b/graphql-subscription/node_modules/@wry/caches/src/index.ts new file mode 100644 index 0000000..bddd192 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/src/index.ts @@ -0,0 +1,3 @@ +export type { CommonCache } from "./common.js"; +export { StrongCache } from "./strong.js"; +export { WeakCache } from "./weak.js"; diff --git a/graphql-subscription/node_modules/@wry/caches/src/strong.ts b/graphql-subscription/node_modules/@wry/caches/src/strong.ts new file mode 100644 index 0000000..a064385 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/src/strong.ts @@ -0,0 +1,121 @@ +import type { CommonCache } from "./common"; + +interface Node { + key: K; + value: V; + newer: Node | null; + older: Node | null; +} + +function defaultDispose() {} + +export class StrongCache implements CommonCache { + private map = new Map>(); + private newest: Node | null = null; + private oldest: Node | null = null; + + constructor( + private max = Infinity, + public dispose: (value: V, key: K) => void = defaultDispose, + ) {} + + public has(key: K): boolean { + return this.map.has(key); + } + + public get(key: K): V | undefined { + const node = this.getNode(key); + return node && node.value; + } + + public get size() { + return this.map.size; + } + + private getNode(key: K): Node | undefined { + const node = this.map.get(key); + + if (node && node !== this.newest) { + const { older, newer } = node; + + if (newer) { + newer.older = older; + } + + if (older) { + older.newer = newer; + } + + node.older = this.newest; + node.older!.newer = node; + + node.newer = null; + this.newest = node; + + if (node === this.oldest) { + this.oldest = newer; + } + } + + return node; + } + + public set(key: K, value: V): V { + let node = this.getNode(key); + if (node) { + return node.value = value; + } + + node = { + key, + value, + newer: null, + older: this.newest + }; + + if (this.newest) { + this.newest.newer = node; + } + + this.newest = node; + this.oldest = this.oldest || node; + + this.map.set(key, node); + + return node.value; + } + + public clean() { + while (this.oldest && this.map.size > this.max) { + this.delete(this.oldest.key); + } + } + + public delete(key: K): boolean { + const node = this.map.get(key); + if (node) { + if (node === this.newest) { + this.newest = node.older; + } + + if (node === this.oldest) { + this.oldest = node.newer; + } + + if (node.newer) { + node.newer.older = node.older; + } + + if (node.older) { + node.older.newer = node.newer; + } + + this.map.delete(key); + this.dispose(node.value, key); + + return true; + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/@wry/caches/src/tests/main.ts b/graphql-subscription/node_modules/@wry/caches/src/tests/main.ts new file mode 100644 index 0000000..87d1205 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/src/tests/main.ts @@ -0,0 +1,2 @@ +import "./strong.js"; +import "./weak.js"; diff --git a/graphql-subscription/node_modules/@wry/caches/src/tests/strong.ts b/graphql-subscription/node_modules/@wry/caches/src/tests/strong.ts new file mode 100644 index 0000000..ba31677 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/src/tests/strong.ts @@ -0,0 +1,108 @@ +import * as assert from "assert"; +import { StrongCache } from "../strong.js"; + +describe("least-recently-used cache", function () { + it("can hold lots of elements", function () { + const cache = new StrongCache; + const count = 1000000; + + for (let i = 0; i < count; ++i) { + cache.set(i, String(i)); + } + + cache.clean(); + + assert.strictEqual((cache as any).map.size, count); + assert.ok(cache.has(0)); + assert.ok(cache.has(count - 1)); + assert.strictEqual(cache.get(43), "43"); + }); + + it("evicts excess old elements", function () { + const max = 10; + const evicted = []; + const cache = new StrongCache(max, (value, key) => { + assert.strictEqual(String(key), value); + evicted.push(key); + }); + + const count = 100; + const keys = []; + for (let i = 0; i < count; ++i) { + cache.set(i, String(i)); + keys.push(i); + } + + cache.clean(); + + assert.strictEqual((cache as any).map.size, max); + assert.strictEqual(evicted.length, count - max); + + for (let i = count - max; i < count; ++i) { + assert.ok(cache.has(i)); + } + }); + + it("can cope with small max values", function () { + const cache = new StrongCache(2); + + function check(...sequence: number[]) { + cache.clean(); + + let entry = (cache as any).newest; + const forwards = []; + while (entry) { + forwards.push(entry.key); + entry = entry.older; + } + assert.deepEqual(forwards, sequence); + + const backwards = []; + entry = (cache as any).oldest; + while (entry) { + backwards.push(entry.key); + entry = entry.newer; + } + backwards.reverse(); + assert.deepEqual(backwards, sequence); + + sequence.forEach(function (n) { + assert.strictEqual((cache as any).map.get(n).value, n + 1); + }); + + if (sequence.length > 0) { + assert.strictEqual((cache as any).newest.key, sequence[0]); + assert.strictEqual((cache as any).oldest.key, + sequence[sequence.length - 1]); + } + } + + cache.set(1, 2); + check(1); + + cache.set(2, 3); + check(2, 1); + + cache.set(3, 4); + check(3, 2); + + cache.get(2); + check(2, 3); + + cache.set(4, 5); + check(4, 2); + + assert.strictEqual(cache.has(1), false); + assert.strictEqual(cache.get(2), 3); + assert.strictEqual(cache.has(3), false); + assert.strictEqual(cache.get(4), 5); + + cache.delete(2); + check(4); + cache.delete(4); + check(); + + assert.strictEqual((cache as any).newest, null); + assert.strictEqual((cache as any).oldest, null); + }); +}); diff --git a/graphql-subscription/node_modules/@wry/caches/src/tests/weak.ts b/graphql-subscription/node_modules/@wry/caches/src/tests/weak.ts new file mode 100644 index 0000000..8c06ae9 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/src/tests/weak.ts @@ -0,0 +1,170 @@ +import * as assert from "assert"; +import { WeakCache } from "../weak.js"; + +describe("weak least-recently-used cache", function () { + it("can hold lots of elements", async function () { + this.timeout(10000); + const cache = new WeakCache(); + const count = 1000000; + const keys = []; + + for (let i = 0; i < count; ++i) { + const key = {}; + cache.set(key, String(i)); + keys[i] = key; + } + await waitForCache(cache); + + cache.clean(); + + assert.strictEqual(cache.size, count); + assert.ok(cache.has(keys[0])); + assert.ok(cache.has(keys[count - 1])); + assert.strictEqual(cache.get(keys[43]), "43"); + }); + + it("evicts excess old elements", function () { + const max = 10; + const evicted = []; + const cache = new WeakCache(max, (value, key) => { + assert.strictEqual(key.valueOf(), value.valueOf()); + evicted.push(key); + }); + + const count = 100; + const keys = []; + for (let i = 0; i < count; ++i) { + const key = new String(i); + cache.set(key, String(i)); + keys[i] = key; + } + + cache.clean(); + + assert.strictEqual((cache as any).size, max); + assert.strictEqual(evicted.length, count - max); + + for (let i = count - max; i < count; ++i) { + assert.ok(cache.has(keys[i])); + } + }); + + it("evicts elements that are garbage collected", async function () { + const cache = new WeakCache(); + + const count = 100; + const keys: Array = []; + for (let i = 0; i < count; ++i) { + keys[i] = new String(i); + cache.set(keys[i], String(i)); + } + + assert.strictEqual(cache.size, 100); + await waitForCache(cache); + assert.strictEqual(cache.size, 100); + + for (let i = 0; i < 50; ++i) { + keys[i] = null; + } + + return gcPromise(() => { + return cache.size > 50 ? null : () => { + assert.strictEqual(cache.size, 50); + assert.strictEqual(keys.length, 100); + assert.strictEqual(new Set(keys).size, 51); + }; + }); + }); + + function gcPromise(test: () => null | (() => void)) { + return new Promise(function (resolve, reject) { + function pollGC() { + global.gc!(); + const testCallback = test(); + if (!testCallback) { + setTimeout(pollGC, 20); + } else try { + testCallback(); + resolve(); + } catch (e) { + reject(e); + } + } + pollGC(); + }); + } + + it("can cope with small max values", async function () { + const cache = new WeakCache(2); + const keys = Array(10) + .fill(null) + .map((_, i) => new Number(i)); + + async function check(...sequence: number[]) { + await waitForCache(cache); + cache.clean(); + + let entry = cache["newest"]; + const forwards = []; + while (entry) { + forwards.push(entry.keyRef?.deref()); + entry = entry.older; + } + assert.deepEqual(forwards.map(Number), sequence); + + const backwards = []; + entry = cache["oldest"]; + while (entry) { + backwards.push(entry.keyRef?.deref()); + entry = entry.newer; + } + backwards.reverse(); + assert.deepEqual(backwards.map(Number), sequence); + + sequence.forEach(function (n) { + assert.strictEqual(cache["map"].get(keys[n])?.value, n + 1); + }); + + if (sequence.length > 0) { + assert.strictEqual( + cache["oldest"]?.keyRef?.deref().valueOf(), + sequence[sequence.length - 1] + ); + } + } + + cache.set(keys[1], 2); + await check(1); + + cache.set(keys[2], 3); + await check(2, 1); + + cache.set(keys[3], 4); + await check(3, 2); + + cache.get(keys[2]); + await check(2, 3); + + cache.set(keys[4], 5); + await check(4, 2); + + assert.strictEqual(cache.has(keys[1]), false); + assert.strictEqual(cache.get(keys[2]), 3); + assert.strictEqual(cache.has(keys[3]), false); + assert.strictEqual(cache.get(keys[4]), 5); + + cache.delete(keys[2]); + await check(4); + cache.delete(keys[4]); + await check(); + + assert.strictEqual((cache as any).newest, null); + assert.strictEqual((cache as any).oldest, null); + }); +}); + +async function waitForCache(cache: WeakCache) { + while (cache["finalizationScheduled"]) { + await new Promise(queueMicrotask); + } +} diff --git a/graphql-subscription/node_modules/@wry/caches/src/weak.ts b/graphql-subscription/node_modules/@wry/caches/src/weak.ts new file mode 100644 index 0000000..d5380c6 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/caches/src/weak.ts @@ -0,0 +1,200 @@ +import type { CommonCache } from "./common"; + +interface PartialNode { + value: V; + newer: Node | null; + older: Node | null; +} + +interface UnfinalizedNode extends PartialNode { + keyRef?: undefined; + key: K; +} + +interface FullNode extends PartialNode { + keyRef: WeakRef; + key?: undefined; +} + +type Node = FullNode | UnfinalizedNode; + +function noop() {} +const defaultDispose = noop; + +const _WeakRef = + typeof WeakRef !== "undefined" + ? WeakRef + : (function (value: T) { + return { deref: () => value } satisfies Omit< + WeakRef, + typeof Symbol.toStringTag + >; + } as any as typeof WeakRef); +const _WeakMap = typeof WeakMap !== "undefined" ? WeakMap : Map; +const _FinalizationRegistry = + typeof FinalizationRegistry !== "undefined" + ? FinalizationRegistry + : (function () { + return { + register: noop, + unregister: noop, + } satisfies Omit, typeof Symbol.toStringTag>; + } as any as typeof FinalizationRegistry); + +const finalizationBatchSize = 10024; + +export class WeakCache + implements CommonCache +{ + private map = new _WeakMap>(); + private registry: FinalizationRegistry>; + private newest: Node | null = null; + private oldest: Node | null = null; + private unfinalizedNodes: Set> = new Set(); + private finalizationScheduled = false; + public size = 0; + + constructor( + private max = Infinity, + public dispose: (value: V, key?: K) => void = defaultDispose + ) { + this.registry = new _FinalizationRegistry>( + this.deleteNode.bind(this) + ); + } + + public has(key: K): boolean { + return this.map.has(key); + } + + public get(key: K): V | undefined { + const node = this.getNode(key); + return node && node.value; + } + + private getNode(key: K): Node | undefined { + const node = this.map.get(key); + + if (node && node !== this.newest) { + const { older, newer } = node; + + if (newer) { + newer.older = older; + } + + if (older) { + older.newer = newer; + } + + node.older = this.newest; + node.older!.newer = node; + + node.newer = null; + this.newest = node; + + if (node === this.oldest) { + this.oldest = newer; + } + } + + return node; + } + + public set(key: K, value: V): V { + let node = this.getNode(key); + if (node) { + return (node.value = value); + } + + node = { + key, + value, + newer: null, + older: this.newest, + }; + + if (this.newest) { + this.newest.newer = node; + } + + this.newest = node; + this.oldest = this.oldest || node; + + this.scheduleFinalization(node); + this.map.set(key, node); + this.size++; + + return node.value; + } + + public clean() { + while (this.oldest && this.size > this.max) { + this.deleteNode(this.oldest); + } + } + + private deleteNode(node: Node) { + if (node === this.newest) { + this.newest = node.older; + } + + if (node === this.oldest) { + this.oldest = node.newer; + } + + if (node.newer) { + node.newer.older = node.older; + } + + if (node.older) { + node.older.newer = node.newer; + } + + this.size--; + const key = node.key || (node.keyRef && node.keyRef.deref()); + this.dispose(node.value, key); + if (!node.keyRef) { + this.unfinalizedNodes.delete(node); + } else { + this.registry.unregister(node); + } + if (key) this.map.delete(key); + } + + public delete(key: K): boolean { + const node = this.map.get(key); + if (node) { + this.deleteNode(node); + + return true; + } + + return false; + } + + private scheduleFinalization(node: UnfinalizedNode) { + this.unfinalizedNodes.add(node); + if (!this.finalizationScheduled) { + this.finalizationScheduled = true; + queueMicrotask(this.finalize); + } + } + + private finalize = () => { + const iterator = this.unfinalizedNodes.values(); + for (let i = 0; i < finalizationBatchSize; i++) { + const node = iterator.next().value; + if (!node) break; + this.unfinalizedNodes.delete(node); + const key = node.key; + delete (node as unknown as FullNode).key; + (node as unknown as FullNode).keyRef = new _WeakRef(key); + this.registry.register(key, node, node); + } + if (this.unfinalizedNodes.size > 0) { + queueMicrotask(this.finalize); + } else { + this.finalizationScheduled = false; + } + }; +} diff --git a/graphql-subscription/node_modules/@wry/context/README.md b/graphql-subscription/node_modules/@wry/context/README.md new file mode 100644 index 0000000..e294499 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/README.md @@ -0,0 +1,4 @@ +# @wry/context + +Manage contextual information needed by synchronous or asynchronous +tasks without explicitly passing objects around. diff --git a/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs b/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs new file mode 100644 index 0000000..eee08f1 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs @@ -0,0 +1,235 @@ +'use strict'; + +// This currentContext variable will only be used if the makeSlotClass +// function is called, which happens only if this is the first copy of the +// @wry/context package to be imported. +var currentContext = null; +// This unique internal object is used to denote the absence of a value +// for a given Slot, and is never exposed to outside code. +var MISSING_VALUE = {}; +var idCounter = 1; +// Although we can't do anything about the cost of duplicated code from +// accidentally bundling multiple copies of the @wry/context package, we can +// avoid creating the Slot class more than once using makeSlotClass. +var makeSlotClass = function () { return /** @class */ (function () { + function Slot() { + // If you have a Slot object, you can find out its slot.id, but you cannot + // guess the slot.id of a Slot you don't have access to, thanks to the + // randomized suffix. + this.id = [ + "slot", + idCounter++, + Date.now(), + Math.random().toString(36).slice(2), + ].join(":"); + } + Slot.prototype.hasValue = function () { + for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { + // We use the Slot object iself as a key to its value, which means the + // value cannot be obtained without a reference to the Slot object. + if (this.id in context_1.slots) { + var value = context_1.slots[this.id]; + if (value === MISSING_VALUE) + break; + if (context_1 !== currentContext) { + // Cache the value in currentContext.slots so the next lookup will + // be faster. This caching is safe because the tree of contexts and + // the values of the slots are logically immutable. + currentContext.slots[this.id] = value; + } + return true; + } + } + if (currentContext) { + // If a value was not found for this Slot, it's never going to be found + // no matter how many times we look it up, so we might as well cache + // the absence of the value, too. + currentContext.slots[this.id] = MISSING_VALUE; + } + return false; + }; + Slot.prototype.getValue = function () { + if (this.hasValue()) { + return currentContext.slots[this.id]; + } + }; + Slot.prototype.withValue = function (value, callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + var _a; + var slots = (_a = { + __proto__: null + }, + _a[this.id] = value, + _a); + var parent = currentContext; + currentContext = { parent: parent, slots: slots }; + try { + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = parent; + } + }; + // Capture the current context and wrap a callback function so that it + // reestablishes the captured context when called. + Slot.bind = function (callback) { + var context = currentContext; + return function () { + var saved = currentContext; + try { + currentContext = context; + return callback.apply(this, arguments); + } + finally { + currentContext = saved; + } + }; + }; + // Immediately run a callback function without any captured context. + Slot.noContext = function (callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + if (currentContext) { + var saved = currentContext; + try { + currentContext = null; + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = saved; + } + } + else { + return callback.apply(thisArg, args); + } + }; + return Slot; +}()); }; +function maybe(fn) { + try { + return fn(); + } + catch (ignored) { } +} +// We store a single global implementation of the Slot class as a permanent +// non-enumerable property of the globalThis object. This obfuscation does +// nothing to prevent access to the Slot class, but at least it ensures the +// implementation (i.e. currentContext) cannot be tampered with, and all copies +// of the @wry/context package (hopefully just one) will share the same Slot +// implementation. Since the first copy of the @wry/context package to be +// imported wins, this technique imposes a steep cost for any future breaking +// changes to the Slot class. +var globalKey = "@wry/context:Slot"; +var host = +// Prefer globalThis when available. +// https://github.com/benjamn/wryware/issues/347 +maybe(function () { return globalThis; }) || + // Fall back to global, which works in Node.js and may be converted by some + // bundlers to the appropriate identifier (window, self, ...) depending on the + // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224 + maybe(function () { return global; }) || + // Otherwise, use a dummy host that's local to this module. We used to fall + // back to using the Array constructor as a namespace, but that was flagged in + // https://github.com/benjamn/wryware/issues/347, and can be avoided. + Object.create(null); +// Whichever globalHost we're using, make TypeScript happy about the additional +// globalKey property. +var globalHost = host; +var Slot = globalHost[globalKey] || + // Earlier versions of this package stored the globalKey property on the Array + // constructor, so we check there as well, to prevent Slot class duplication. + Array[globalKey] || + (function (Slot) { + try { + Object.defineProperty(globalHost, globalKey, { + value: Slot, + enumerable: false, + writable: false, + // When it was possible for globalHost to be the Array constructor (a + // legacy Slot dedup strategy), it was important for the property to be + // configurable:true so it could be deleted. That does not seem to be as + // important when globalHost is the global object, but I don't want to + // cause similar problems again, and configurable:true seems safest. + // https://github.com/endojs/endo/issues/576#issuecomment-1178274008 + configurable: true + }); + } + finally { + return Slot; + } + })(makeSlotClass()); + +var bind = Slot.bind, noContext = Slot.noContext; +function setTimeoutWithContext(callback, delay) { + return setTimeout(bind(callback), delay); +} +// Turn any generator function into an async function (using yield instead +// of await), with context automatically preserved across yields. +function asyncFromGen(genFn) { + return function () { + var gen = genFn.apply(this, arguments); + var boundNext = bind(gen.next); + var boundThrow = bind(gen.throw); + return new Promise(function (resolve, reject) { + function invoke(method, argument) { + try { + var result = method.call(gen, argument); + } + catch (error) { + return reject(error); + } + var next = result.done ? resolve : invokeNext; + if (isPromiseLike(result.value)) { + result.value.then(next, result.done ? reject : invokeThrow); + } + else { + next(result.value); + } + } + var invokeNext = function (value) { return invoke(boundNext, value); }; + var invokeThrow = function (error) { return invoke(boundThrow, error); }; + invokeNext(); + }); + }; +} +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +// If you use the fibers npm package to implement coroutines in Node.js, +// you should call this function at least once to ensure context management +// remains coherent across any yields. +var wrappedFibers = []; +function wrapYieldingFiberMethods(Fiber) { + // There can be only one implementation of Fiber per process, so this array + // should never grow longer than one element. + if (wrappedFibers.indexOf(Fiber) < 0) { + var wrap = function (obj, method) { + var fn = obj[method]; + obj[method] = function () { + return noContext(fn, arguments, this); + }; + }; + // These methods can yield, according to + // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 + wrap(Fiber, "yield"); + wrap(Fiber.prototype, "run"); + wrap(Fiber.prototype, "throwInto"); + wrappedFibers.push(Fiber); + } + return Fiber; +} + +exports.Slot = Slot; +exports.asyncFromGen = asyncFromGen; +exports.bind = bind; +exports.noContext = noContext; +exports.setTimeout = setTimeoutWithContext; +exports.wrapYieldingFiberMethods = wrapYieldingFiberMethods; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.map b/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.map new file mode 100644 index 0000000..0d6a24f --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.cjs","sources":["es5/slot.js","es5/index.js"],"sourcesContent":["// This currentContext variable will only be used if the makeSlotClass\n// function is called, which happens only if this is the first copy of the\n// @wry/context package to be imported.\nvar currentContext = null;\n// This unique internal object is used to denote the absence of a value\n// for a given Slot, and is never exposed to outside code.\nvar MISSING_VALUE = {};\nvar idCounter = 1;\n// Although we can't do anything about the cost of duplicated code from\n// accidentally bundling multiple copies of the @wry/context package, we can\n// avoid creating the Slot class more than once using makeSlotClass.\nvar makeSlotClass = function () { return /** @class */ (function () {\n function Slot() {\n // If you have a Slot object, you can find out its slot.id, but you cannot\n // guess the slot.id of a Slot you don't have access to, thanks to the\n // randomized suffix.\n this.id = [\n \"slot\",\n idCounter++,\n Date.now(),\n Math.random().toString(36).slice(2),\n ].join(\":\");\n }\n Slot.prototype.hasValue = function () {\n for (var context_1 = currentContext; context_1; context_1 = context_1.parent) {\n // We use the Slot object iself as a key to its value, which means the\n // value cannot be obtained without a reference to the Slot object.\n if (this.id in context_1.slots) {\n var value = context_1.slots[this.id];\n if (value === MISSING_VALUE)\n break;\n if (context_1 !== currentContext) {\n // Cache the value in currentContext.slots so the next lookup will\n // be faster. This caching is safe because the tree of contexts and\n // the values of the slots are logically immutable.\n currentContext.slots[this.id] = value;\n }\n return true;\n }\n }\n if (currentContext) {\n // If a value was not found for this Slot, it's never going to be found\n // no matter how many times we look it up, so we might as well cache\n // the absence of the value, too.\n currentContext.slots[this.id] = MISSING_VALUE;\n }\n return false;\n };\n Slot.prototype.getValue = function () {\n if (this.hasValue()) {\n return currentContext.slots[this.id];\n }\n };\n Slot.prototype.withValue = function (value, callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args, thisArg) {\n var _a;\n var slots = (_a = {\n __proto__: null\n },\n _a[this.id] = value,\n _a);\n var parent = currentContext;\n currentContext = { parent: parent, slots: slots };\n try {\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg, args);\n }\n finally {\n currentContext = parent;\n }\n };\n // Capture the current context and wrap a callback function so that it\n // reestablishes the captured context when called.\n Slot.bind = function (callback) {\n var context = currentContext;\n return function () {\n var saved = currentContext;\n try {\n currentContext = context;\n return callback.apply(this, arguments);\n }\n finally {\n currentContext = saved;\n }\n };\n };\n // Immediately run a callback function without any captured context.\n Slot.noContext = function (callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args, thisArg) {\n if (currentContext) {\n var saved = currentContext;\n try {\n currentContext = null;\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg, args);\n }\n finally {\n currentContext = saved;\n }\n }\n else {\n return callback.apply(thisArg, args);\n }\n };\n return Slot;\n}()); };\nfunction maybe(fn) {\n try {\n return fn();\n }\n catch (ignored) { }\n}\n// We store a single global implementation of the Slot class as a permanent\n// non-enumerable property of the globalThis object. This obfuscation does\n// nothing to prevent access to the Slot class, but at least it ensures the\n// implementation (i.e. currentContext) cannot be tampered with, and all copies\n// of the @wry/context package (hopefully just one) will share the same Slot\n// implementation. Since the first copy of the @wry/context package to be\n// imported wins, this technique imposes a steep cost for any future breaking\n// changes to the Slot class.\nvar globalKey = \"@wry/context:Slot\";\nvar host = \n// Prefer globalThis when available.\n// https://github.com/benjamn/wryware/issues/347\nmaybe(function () { return globalThis; }) ||\n // Fall back to global, which works in Node.js and may be converted by some\n // bundlers to the appropriate identifier (window, self, ...) depending on the\n // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224\n maybe(function () { return global; }) ||\n // Otherwise, use a dummy host that's local to this module. We used to fall\n // back to using the Array constructor as a namespace, but that was flagged in\n // https://github.com/benjamn/wryware/issues/347, and can be avoided.\n Object.create(null);\n// Whichever globalHost we're using, make TypeScript happy about the additional\n// globalKey property.\nvar globalHost = host;\nexport var Slot = globalHost[globalKey] ||\n // Earlier versions of this package stored the globalKey property on the Array\n // constructor, so we check there as well, to prevent Slot class duplication.\n Array[globalKey] ||\n (function (Slot) {\n try {\n Object.defineProperty(globalHost, globalKey, {\n value: Slot,\n enumerable: false,\n writable: false,\n // When it was possible for globalHost to be the Array constructor (a\n // legacy Slot dedup strategy), it was important for the property to be\n // configurable:true so it could be deleted. That does not seem to be as\n // important when globalHost is the global object, but I don't want to\n // cause similar problems again, and configurable:true seems safest.\n // https://github.com/endojs/endo/issues/576#issuecomment-1178274008\n configurable: true\n });\n }\n finally {\n return Slot;\n }\n })(makeSlotClass());\n//# sourceMappingURL=slot.js.map","import { Slot } from \"./slot.js\";\nexport { Slot };\nexport var bind = Slot.bind, noContext = Slot.noContext;\n// Like global.setTimeout, except the callback runs with captured context.\nexport { setTimeoutWithContext as setTimeout };\nfunction setTimeoutWithContext(callback, delay) {\n return setTimeout(bind(callback), delay);\n}\n// Turn any generator function into an async function (using yield instead\n// of await), with context automatically preserved across yields.\nexport function asyncFromGen(genFn) {\n return function () {\n var gen = genFn.apply(this, arguments);\n var boundNext = bind(gen.next);\n var boundThrow = bind(gen.throw);\n return new Promise(function (resolve, reject) {\n function invoke(method, argument) {\n try {\n var result = method.call(gen, argument);\n }\n catch (error) {\n return reject(error);\n }\n var next = result.done ? resolve : invokeNext;\n if (isPromiseLike(result.value)) {\n result.value.then(next, result.done ? reject : invokeThrow);\n }\n else {\n next(result.value);\n }\n }\n var invokeNext = function (value) { return invoke(boundNext, value); };\n var invokeThrow = function (error) { return invoke(boundThrow, error); };\n invokeNext();\n });\n };\n}\nfunction isPromiseLike(value) {\n return value && typeof value.then === \"function\";\n}\n// If you use the fibers npm package to implement coroutines in Node.js,\n// you should call this function at least once to ensure context management\n// remains coherent across any yields.\nvar wrappedFibers = [];\nexport function wrapYieldingFiberMethods(Fiber) {\n // There can be only one implementation of Fiber per process, so this array\n // should never grow longer than one element.\n if (wrappedFibers.indexOf(Fiber) < 0) {\n var wrap = function (obj, method) {\n var fn = obj[method];\n obj[method] = function () {\n return noContext(fn, arguments, this);\n };\n };\n // These methods can yield, according to\n // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100\n wrap(Fiber, \"yield\");\n wrap(Fiber.prototype, \"run\");\n wrap(Fiber.prototype, \"throwInto\");\n wrappedFibers.push(Fiber);\n }\n return Fiber;\n}\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA,IAAI,cAAc,GAAG,IAAI,CAAC;AAC1B;AACA;AACA,IAAI,aAAa,GAAG,EAAE,CAAC;AACvB,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB;AACA;AACA;AACA,IAAI,aAAa,GAAG,YAAY,EAAE,sBAAsB,YAAY;AACpE,IAAI,SAAS,IAAI,GAAG;AACpB;AACA;AACA;AACA,QAAQ,IAAI,CAAC,EAAE,GAAG;AAClB,YAAY,MAAM;AAClB,YAAY,SAAS,EAAE;AACvB,YAAY,IAAI,CAAC,GAAG,EAAE;AACtB,YAAY,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpB,KAAK;AACL,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,YAAY;AAC1C,QAAQ,KAAK,IAAI,SAAS,GAAG,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC,MAAM,EAAE;AACtF;AACA;AACA,YAAY,IAAI,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC,KAAK,EAAE;AAC5C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ACX,KAAK,CAAC;AACN,CAAC;AACD,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACrD,CAAC;AACD;AACA;AACA;AACA,IAAI,aAAa,GAAG,EAAE,CAAC;AAChB,SAAS,wBAAwB,CAAC,KAAK,EAAE;AAChD;AACA;AACA,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;AAC1C,QAAQ,IAAI,IAAI,GAAG,UAAU,GAAG,EAAE,MAAM,EAAE;AAC1C,YAAY,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AACjC,YAAY,GAAG,CAAC,MAAM,CAAC,GAAG,YAAY;AACtC,gBAAgB,OAAO,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACtD,aAAa,CAAC;AACd,SAAS,CAAC;AACV;AACA;AACA,QAAQ,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC7B,QAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AACrC,QAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC3C,QAAQ,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClC,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.native.js b/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.native.js new file mode 100644 index 0000000..eee08f1 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/bundle.cjs.native.js @@ -0,0 +1,235 @@ +'use strict'; + +// This currentContext variable will only be used if the makeSlotClass +// function is called, which happens only if this is the first copy of the +// @wry/context package to be imported. +var currentContext = null; +// This unique internal object is used to denote the absence of a value +// for a given Slot, and is never exposed to outside code. +var MISSING_VALUE = {}; +var idCounter = 1; +// Although we can't do anything about the cost of duplicated code from +// accidentally bundling multiple copies of the @wry/context package, we can +// avoid creating the Slot class more than once using makeSlotClass. +var makeSlotClass = function () { return /** @class */ (function () { + function Slot() { + // If you have a Slot object, you can find out its slot.id, but you cannot + // guess the slot.id of a Slot you don't have access to, thanks to the + // randomized suffix. + this.id = [ + "slot", + idCounter++, + Date.now(), + Math.random().toString(36).slice(2), + ].join(":"); + } + Slot.prototype.hasValue = function () { + for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { + // We use the Slot object iself as a key to its value, which means the + // value cannot be obtained without a reference to the Slot object. + if (this.id in context_1.slots) { + var value = context_1.slots[this.id]; + if (value === MISSING_VALUE) + break; + if (context_1 !== currentContext) { + // Cache the value in currentContext.slots so the next lookup will + // be faster. This caching is safe because the tree of contexts and + // the values of the slots are logically immutable. + currentContext.slots[this.id] = value; + } + return true; + } + } + if (currentContext) { + // If a value was not found for this Slot, it's never going to be found + // no matter how many times we look it up, so we might as well cache + // the absence of the value, too. + currentContext.slots[this.id] = MISSING_VALUE; + } + return false; + }; + Slot.prototype.getValue = function () { + if (this.hasValue()) { + return currentContext.slots[this.id]; + } + }; + Slot.prototype.withValue = function (value, callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + var _a; + var slots = (_a = { + __proto__: null + }, + _a[this.id] = value, + _a); + var parent = currentContext; + currentContext = { parent: parent, slots: slots }; + try { + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = parent; + } + }; + // Capture the current context and wrap a callback function so that it + // reestablishes the captured context when called. + Slot.bind = function (callback) { + var context = currentContext; + return function () { + var saved = currentContext; + try { + currentContext = context; + return callback.apply(this, arguments); + } + finally { + currentContext = saved; + } + }; + }; + // Immediately run a callback function without any captured context. + Slot.noContext = function (callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + if (currentContext) { + var saved = currentContext; + try { + currentContext = null; + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = saved; + } + } + else { + return callback.apply(thisArg, args); + } + }; + return Slot; +}()); }; +function maybe(fn) { + try { + return fn(); + } + catch (ignored) { } +} +// We store a single global implementation of the Slot class as a permanent +// non-enumerable property of the globalThis object. This obfuscation does +// nothing to prevent access to the Slot class, but at least it ensures the +// implementation (i.e. currentContext) cannot be tampered with, and all copies +// of the @wry/context package (hopefully just one) will share the same Slot +// implementation. Since the first copy of the @wry/context package to be +// imported wins, this technique imposes a steep cost for any future breaking +// changes to the Slot class. +var globalKey = "@wry/context:Slot"; +var host = +// Prefer globalThis when available. +// https://github.com/benjamn/wryware/issues/347 +maybe(function () { return globalThis; }) || + // Fall back to global, which works in Node.js and may be converted by some + // bundlers to the appropriate identifier (window, self, ...) depending on the + // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224 + maybe(function () { return global; }) || + // Otherwise, use a dummy host that's local to this module. We used to fall + // back to using the Array constructor as a namespace, but that was flagged in + // https://github.com/benjamn/wryware/issues/347, and can be avoided. + Object.create(null); +// Whichever globalHost we're using, make TypeScript happy about the additional +// globalKey property. +var globalHost = host; +var Slot = globalHost[globalKey] || + // Earlier versions of this package stored the globalKey property on the Array + // constructor, so we check there as well, to prevent Slot class duplication. + Array[globalKey] || + (function (Slot) { + try { + Object.defineProperty(globalHost, globalKey, { + value: Slot, + enumerable: false, + writable: false, + // When it was possible for globalHost to be the Array constructor (a + // legacy Slot dedup strategy), it was important for the property to be + // configurable:true so it could be deleted. That does not seem to be as + // important when globalHost is the global object, but I don't want to + // cause similar problems again, and configurable:true seems safest. + // https://github.com/endojs/endo/issues/576#issuecomment-1178274008 + configurable: true + }); + } + finally { + return Slot; + } + })(makeSlotClass()); + +var bind = Slot.bind, noContext = Slot.noContext; +function setTimeoutWithContext(callback, delay) { + return setTimeout(bind(callback), delay); +} +// Turn any generator function into an async function (using yield instead +// of await), with context automatically preserved across yields. +function asyncFromGen(genFn) { + return function () { + var gen = genFn.apply(this, arguments); + var boundNext = bind(gen.next); + var boundThrow = bind(gen.throw); + return new Promise(function (resolve, reject) { + function invoke(method, argument) { + try { + var result = method.call(gen, argument); + } + catch (error) { + return reject(error); + } + var next = result.done ? resolve : invokeNext; + if (isPromiseLike(result.value)) { + result.value.then(next, result.done ? reject : invokeThrow); + } + else { + next(result.value); + } + } + var invokeNext = function (value) { return invoke(boundNext, value); }; + var invokeThrow = function (error) { return invoke(boundThrow, error); }; + invokeNext(); + }); + }; +} +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +// If you use the fibers npm package to implement coroutines in Node.js, +// you should call this function at least once to ensure context management +// remains coherent across any yields. +var wrappedFibers = []; +function wrapYieldingFiberMethods(Fiber) { + // There can be only one implementation of Fiber per process, so this array + // should never grow longer than one element. + if (wrappedFibers.indexOf(Fiber) < 0) { + var wrap = function (obj, method) { + var fn = obj[method]; + obj[method] = function () { + return noContext(fn, arguments, this); + }; + }; + // These methods can yield, according to + // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 + wrap(Fiber, "yield"); + wrap(Fiber.prototype, "run"); + wrap(Fiber.prototype, "throwInto"); + wrappedFibers.push(Fiber); + } + return Fiber; +} + +exports.Slot = Slot; +exports.asyncFromGen = asyncFromGen; +exports.bind = bind; +exports.noContext = noContext; +exports.setTimeout = setTimeoutWithContext; +exports.wrapYieldingFiberMethods = wrapYieldingFiberMethods; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/context/lib/index.d.ts b/graphql-subscription/node_modules/@wry/context/lib/index.d.ts new file mode 100644 index 0000000..41c2ff2 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/index.d.ts @@ -0,0 +1,7 @@ +import { Slot } from "./slot.js"; +export { Slot }; +export declare const bind: (callback: (this: TThis, ...args: TArgs) => TResult) => (this: TThis, ...args: TArgs) => TResult, noContext: (callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined) => TResult; +export { setTimeoutWithContext as setTimeout }; +declare function setTimeoutWithContext(callback: () => any, delay: number): any; +export declare function asyncFromGen(genFn: (...args: TArgs) => Generator): (...args: TArgs) => Promise; +export declare function wrapYieldingFiberMethods(Fiber: F): F; diff --git a/graphql-subscription/node_modules/@wry/context/lib/index.js b/graphql-subscription/node_modules/@wry/context/lib/index.js new file mode 100644 index 0000000..c7b99c5 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/index.js @@ -0,0 +1,64 @@ +import { Slot } from "./slot.js"; +export { Slot }; +export const { bind, noContext } = Slot; +// Like global.setTimeout, except the callback runs with captured context. +export { setTimeoutWithContext as setTimeout }; +function setTimeoutWithContext(callback, delay) { + return setTimeout(bind(callback), delay); +} +// Turn any generator function into an async function (using yield instead +// of await), with context automatically preserved across yields. +export function asyncFromGen(genFn) { + return function () { + const gen = genFn.apply(this, arguments); + const boundNext = bind(gen.next); + const boundThrow = bind(gen.throw); + return new Promise((resolve, reject) => { + function invoke(method, argument) { + try { + var result = method.call(gen, argument); + } + catch (error) { + return reject(error); + } + const next = result.done ? resolve : invokeNext; + if (isPromiseLike(result.value)) { + result.value.then(next, result.done ? reject : invokeThrow); + } + else { + next(result.value); + } + } + const invokeNext = (value) => invoke(boundNext, value); + const invokeThrow = (error) => invoke(boundThrow, error); + invokeNext(); + }); + }; +} +function isPromiseLike(value) { + return value && typeof value.then === "function"; +} +// If you use the fibers npm package to implement coroutines in Node.js, +// you should call this function at least once to ensure context management +// remains coherent across any yields. +const wrappedFibers = []; +export function wrapYieldingFiberMethods(Fiber) { + // There can be only one implementation of Fiber per process, so this array + // should never grow longer than one element. + if (wrappedFibers.indexOf(Fiber) < 0) { + const wrap = (obj, method) => { + const fn = obj[method]; + obj[method] = function () { + return noContext(fn, arguments, this); + }; + }; + // These methods can yield, according to + // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 + wrap(Fiber, "yield"); + wrap(Fiber.prototype, "run"); + wrap(Fiber.prototype, "throwInto"); + wrappedFibers.push(Fiber); + } + return Fiber; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/context/lib/index.js.map b/graphql-subscription/node_modules/@wry/context/lib/index.js.map new file mode 100644 index 0000000..2e2bbd9 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,CAAA;AACf,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;AAUxC,0EAA0E;AAC1E,OAAO,EAAE,qBAAqB,IAAI,UAAU,EAAE,CAAC;AAC/C,SAAS,qBAAqB,CAAC,QAAmB,EAAE,KAAa;IAC/D,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,0EAA0E;AAC1E,iEAAiE;AACjE,MAAM,UAAU,YAAY,CAM1B,KAA4D;IAE5D,OAAO;QACL,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC,CAAC;QAOhD,MAAM,SAAS,GAAW,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,UAAU,GAAW,IAAI,CAAC,GAAG,CAAC,KAAM,CAAC,CAAC;QAE5C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,SAAS,MAAM,CAAC,MAAc,EAAE,QAAa;gBAC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AC,MAAM,CAAC,CAAC;YACvB,GAAG,CAAC,MAAM,CAAC,GAAG;gBACZ,OAAO,SAAS,CAAC,EAAE,EAAE,SAAgB,EAAE,IAAI,CAAC,CAAC;YAC/C,CAAC,CAAC;QACJ,CAAC,CAAA;QACD,wCAAwC;QACxC,2GAA2G;QAC3G,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACnC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC3B;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/context/lib/slot.d.ts b/graphql-subscription/node_modules/@wry/context/lib/slot.d.ts new file mode 100644 index 0000000..d33aecc --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/slot.d.ts @@ -0,0 +1,12 @@ +declare const makeSlotClass: () => { + new (): { + readonly id: string; + hasValue(): boolean; + getValue(): TValue | undefined; + withValue(value: TValue, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult; + }; + bind(callback: (this: TThis_1, ...args: TArgs_1) => TResult_1): (this: TThis_1, ...args: TArgs_1) => TResult_1; + noContext(callback: (this: TThis_2, ...args: TArgs_2) => TResult_2, args?: TArgs_2 | undefined, thisArg?: TThis_2 | undefined): TResult_2; +}; +export declare const Slot: ReturnType; +export {}; diff --git a/graphql-subscription/node_modules/@wry/context/lib/slot.js b/graphql-subscription/node_modules/@wry/context/lib/slot.js new file mode 100644 index 0000000..e6dc11a --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/lib/slot.js @@ -0,0 +1,163 @@ +// This currentContext variable will only be used if the makeSlotClass +// function is called, which happens only if this is the first copy of the +// @wry/context package to be imported. +let currentContext = null; +// This unique internal object is used to denote the absence of a value +// for a given Slot, and is never exposed to outside code. +const MISSING_VALUE = {}; +let idCounter = 1; +// Although we can't do anything about the cost of duplicated code from +// accidentally bundling multiple copies of the @wry/context package, we can +// avoid creating the Slot class more than once using makeSlotClass. +const makeSlotClass = () => class Slot { + constructor() { + // If you have a Slot object, you can find out its slot.id, but you cannot + // guess the slot.id of a Slot you don't have access to, thanks to the + // randomized suffix. + this.id = [ + "slot", + idCounter++, + Date.now(), + Math.random().toString(36).slice(2), + ].join(":"); + } + hasValue() { + for (let context = currentContext; context; context = context.parent) { + // We use the Slot object iself as a key to its value, which means the + // value cannot be obtained without a reference to the Slot object. + if (this.id in context.slots) { + const value = context.slots[this.id]; + if (value === MISSING_VALUE) + break; + if (context !== currentContext) { + // Cache the value in currentContext.slots so the next lookup will + // be faster. This caching is safe because the tree of contexts and + // the values of the slots are logically immutable. + currentContext.slots[this.id] = value; + } + return true; + } + } + if (currentContext) { + // If a value was not found for this Slot, it's never going to be found + // no matter how many times we look it up, so we might as well cache + // the absence of the value, too. + currentContext.slots[this.id] = MISSING_VALUE; + } + return false; + } + getValue() { + if (this.hasValue()) { + return currentContext.slots[this.id]; + } + } + withValue(value, callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + const slots = { + __proto__: null, + [this.id]: value, + }; + const parent = currentContext; + currentContext = { parent, slots }; + try { + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = parent; + } + } + // Capture the current context and wrap a callback function so that it + // reestablishes the captured context when called. + static bind(callback) { + const context = currentContext; + return function () { + const saved = currentContext; + try { + currentContext = context; + return callback.apply(this, arguments); + } + finally { + currentContext = saved; + } + }; + } + // Immediately run a callback function without any captured context. + static noContext(callback, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args, thisArg) { + if (currentContext) { + const saved = currentContext; + try { + currentContext = null; + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg, args); + } + finally { + currentContext = saved; + } + } + else { + return callback.apply(thisArg, args); + } + } +}; +function maybe(fn) { + try { + return fn(); + } + catch (ignored) { } +} +// We store a single global implementation of the Slot class as a permanent +// non-enumerable property of the globalThis object. This obfuscation does +// nothing to prevent access to the Slot class, but at least it ensures the +// implementation (i.e. currentContext) cannot be tampered with, and all copies +// of the @wry/context package (hopefully just one) will share the same Slot +// implementation. Since the first copy of the @wry/context package to be +// imported wins, this technique imposes a steep cost for any future breaking +// changes to the Slot class. +const globalKey = "@wry/context:Slot"; +const host = +// Prefer globalThis when available. +// https://github.com/benjamn/wryware/issues/347 +maybe(() => globalThis) || + // Fall back to global, which works in Node.js and may be converted by some + // bundlers to the appropriate identifier (window, self, ...) depending on the + // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224 + maybe(() => global) || + // Otherwise, use a dummy host that's local to this module. We used to fall + // back to using the Array constructor as a namespace, but that was flagged in + // https://github.com/benjamn/wryware/issues/347, and can be avoided. + Object.create(null); +// Whichever globalHost we're using, make TypeScript happy about the additional +// globalKey property. +const globalHost = host; +export const Slot = globalHost[globalKey] || + // Earlier versions of this package stored the globalKey property on the Array + // constructor, so we check there as well, to prevent Slot class duplication. + Array[globalKey] || + (function (Slot) { + try { + Object.defineProperty(globalHost, globalKey, { + value: Slot, + enumerable: false, + writable: false, + // When it was possible for globalHost to be the Array constructor (a + // legacy Slot dedup strategy), it was important for the property to be + // configurable:true so it could be deleted. That does not seem to be as + // important when globalHost is the global object, but I don't want to + // cause similar problems again, and configurable:true seems safest. + // https://github.com/endojs/endo/issues/576#issuecomment-1178274008 + configurable: true + }); + } + finally { + return Slot; + } + })(makeSlotClass()); +//# sourceMappingURL=slot.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/context/lib/slot.js.map b/graphql-subscription/node_modules/@wry/context/lib/slot.js.map new file mode 100644 index 0000000..d4be909 --- /dev/null +++ b/graphql-subsc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rE,uEAAuE;gBACvE,wEAAwE;gBACxE,sEAAsE;gBACtE,oEAAoE;gBACpE,oEAAoE;gBACpE,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;SACJ;gBAAS;YACR,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/context/package.json b/graphql-subscription/node_modules/@wry/context/package.json new file mode 100644 index 0000000..6e5dd38 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/package.json @@ -0,0 +1,39 @@ +{ + "name": "@wry/context", + "version": "0.7.4", + "author": "Ben Newman ", + "description": "Manage contextual information needed by (a)synchronous tasks without explicitly passing objects around", + "license": "MIT", + "type": "module", + "main": "lib/bundle.cjs", + "module": "lib/index.js", + "types": "lib/index.d.ts", + "keywords": [], + "homepage": "https://github.com/benjamn/wryware", + "repository": { + "type": "git", + "url": "git+https://github.com/benjamn/wryware.git" + }, + "bugs": { + "url": "https://github.com/benjamn/wryware/issues" + }, + "scripts": { + "build": "npm run clean:before && npm run tsc && npm run rollup && npm run clean:after", + "clean:before": "rimraf lib", + "tsc": "npm run tsc:es5 && npm run tsc:esm", + "tsc:es5": "tsc -p tsconfig.es5.json", + "tsc:esm": "tsc -p tsconfig.json", + "rollup": "rollup -c rollup.config.js", + "clean:after": "rimraf lib/es5", + "prepare": "npm run build", + "test:cjs": "../../shared/test.sh lib/tests/bundle.cjs", + "test:esm": "../../shared/test.sh lib/tests/bundle.js", + "test": "npm run test:esm && npm run test:cjs" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } +} diff --git a/graphql-subscription/node_modules/@wry/context/rollup.config.js b/graphql-subscription/node_modules/@wry/context/rollup.config.js new file mode 100644 index 0000000..ef8e33b --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/rollup.config.js @@ -0,0 +1 @@ +export { default } from "../../shared/rollup.config.js"; diff --git a/graphql-subscription/node_modules/@wry/context/src/index.ts b/graphql-subscription/node_modules/@wry/context/src/index.ts new file mode 100644 index 0000000..9658712 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/src/index.ts @@ -0,0 +1,87 @@ +import { Slot } from "./slot.js"; +export { Slot } +export const { bind, noContext } = Slot; + +// Relying on the @types/node declaration of global.setTimeout can make +// things tricky for dowstream projects (see PR #7). +declare function setTimeout( + callback: (...args: any[]) => any, + ms?: number, + ...args: any[] +): any; + +// Like global.setTimeout, except the callback runs with captured context. +export { setTimeoutWithContext as setTimeout }; +function setTimeoutWithContext(callback: () => any, delay: number) { + return setTimeout(bind(callback), delay); +} + +// Turn any generator function into an async function (using yield instead +// of await), with context automatically preserved across yields. +export function asyncFromGen< + TArgs extends any[], + TYield = any, + TReturn = any, + TNext = any, +>( + genFn: (...args: TArgs) => Generator +) { + return function (this: any) { + const gen = genFn.apply(this, arguments as any); + + type Method = ( + this: Generator, + arg: any, + ) => IteratorResult; + + const boundNext: Method = bind(gen.next); + const boundThrow: Method = bind(gen.throw!); + + return new Promise((resolve, reject) => { + function invoke(method: Method, argument: any) { + try { + var result: any = method.call(gen, argument); + } catch (error) { + return reject(error); + } + const next = result.done ? resolve : invokeNext; + if (isPromiseLike(result.value)) { + result.value.then(next, result.done ? reject : invokeThrow); + } else { + next(result.value); + } + } + const invokeNext = (value?: any) => invoke(boundNext, value); + const invokeThrow = (error: any) => invoke(boundThrow, error); + invokeNext(); + }); + } as (...args: TArgs) => Promise; +} + +function isPromiseLike(value: any): value is PromiseLike { + return value && typeof value.then === "function"; +} + +// If you use the fibers npm package to implement coroutines in Node.js, +// you should call this function at least once to ensure context management +// remains coherent across any yields. +const wrappedFibers: Function[] = []; +export function wrapYieldingFiberMethods(Fiber: F): F { + // There can be only one implementation of Fiber per process, so this array + // should never grow longer than one element. + if (wrappedFibers.indexOf(Fiber) < 0) { + const wrap = (obj: any, method: string) => { + const fn = obj[method]; + obj[method] = function () { + return noContext(fn, arguments as any, this); + }; + } + // These methods can yield, according to + // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 + wrap(Fiber, "yield"); + wrap(Fiber.prototype, "run"); + wrap(Fiber.prototype, "throwInto"); + wrappedFibers.push(Fiber); + } + return Fiber; +} diff --git a/graphql-subscription/node_modules/@wry/context/src/slot.ts b/graphql-subscription/node_modules/@wry/context/src/slot.ts new file mode 100644 index 0000000..bc2c63e --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/src/slot.ts @@ -0,0 +1,183 @@ +type Context = { + parent: Context | null; + slots: { [slotId: string]: any }; +} + +// This currentContext variable will only be used if the makeSlotClass +// function is called, which happens only if this is the first copy of the +// @wry/context package to be imported. +let currentContext: Context | null = null; + +// This unique internal object is used to denote the absence of a value +// for a given Slot, and is never exposed to outside code. +const MISSING_VALUE: any = {}; + +let idCounter = 1; + +// Although we can't do anything about the cost of duplicated code from +// accidentally bundling multiple copies of the @wry/context package, we can +// avoid creating the Slot class more than once using makeSlotClass. +const makeSlotClass = () => class Slot { + // If you have a Slot object, you can find out its slot.id, but you cannot + // guess the slot.id of a Slot you don't have access to, thanks to the + // randomized suffix. + public readonly id = [ + "slot", + idCounter++, + Date.now(), + Math.random().toString(36).slice(2), + ].join(":"); + + public hasValue() { + for (let context = currentContext; context; context = context.parent) { + // We use the Slot object iself as a key to its value, which means the + // value cannot be obtained without a reference to the Slot object. + if (this.id in context.slots) { + const value = context.slots[this.id]; + if (value === MISSING_VALUE) break; + if (context !== currentContext) { + // Cache the value in currentContext.slots so the next lookup will + // be faster. This caching is safe because the tree of contexts and + // the values of the slots are logically immutable. + currentContext!.slots[this.id] = value; + } + return true; + } + } + if (currentContext) { + // If a value was not found for this Slot, it's never going to be found + // no matter how many times we look it up, so we might as well cache + // the absence of the value, too. + currentContext.slots[this.id] = MISSING_VALUE; + } + return false; + } + + public getValue(): TValue | undefined { + if (this.hasValue()) { + return currentContext!.slots[this.id] as TValue; + } + } + + public withValue( + value: TValue, + callback: (this: TThis, ...args: TArgs) => TResult, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args?: TArgs, + thisArg?: TThis, + ): TResult { + const slots = { + __proto__: null, + [this.id]: value, + }; + const parent = currentContext; + currentContext = { parent, slots }; + try { + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg!, args!); + } finally { + currentContext = parent; + } + } + + // Capture the current context and wrap a callback function so that it + // reestablishes the captured context when called. + static bind( + callback: (this: TThis, ...args: TArgs) => TResult, + ) { + const context = currentContext; + return function (this: TThis) { + const saved = currentContext; + try { + currentContext = context; + return callback.apply(this, arguments as any); + } finally { + currentContext = saved; + } + } as typeof callback; + } + + // Immediately run a callback function without any captured context. + static noContext( + callback: (this: TThis, ...args: TArgs) => TResult, + // Given the prevalence of arrow functions, specifying arguments is likely + // to be much more common than specifying `this`, hence this ordering: + args?: TArgs, + thisArg?: TThis, + ) { + if (currentContext) { + const saved = currentContext; + try { + currentContext = null; + // Function.prototype.apply allows the arguments array argument to be + // omitted or undefined, so args! is fine here. + return callback.apply(thisArg!, args!); + } finally { + currentContext = saved; + } + } else { + return callback.apply(thisArg!, args!); + } + } +}; + +function maybe(fn: () => T): T | undefined { + try { + return fn(); + } catch (ignored) {} +} + +// We store a single global implementation of the Slot class as a permanent +// non-enumerable property of the globalThis object. This obfuscation does +// nothing to prevent access to the Slot class, but at least it ensures the +// implementation (i.e. currentContext) cannot be tampered with, and all copies +// of the @wry/context package (hopefully just one) will share the same Slot +// implementation. Since the first copy of the @wry/context package to be +// imported wins, this technique imposes a steep cost for any future breaking +// changes to the Slot class. +const globalKey = "@wry/context:Slot"; + +const host = + // Prefer globalThis when available. + // https://github.com/benjamn/wryware/issues/347 + maybe(() => globalThis) || + // Fall back to global, which works in Node.js and may be converted by some + // bundlers to the appropriate identifier (window, self, ...) depending on the + // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224 + maybe(() => global) || + // Otherwise, use a dummy host that's local to this module. We used to fall + // back to using the Array constructor as a namespace, but that was flagged in + // https://github.com/benjamn/wryware/issues/347, and can be avoided. + Object.create(null) as typeof Array; + +// Whichever globalHost we're using, make TypeScript happy about the additional +// globalKey property. +const globalHost: typeof host & { + [globalKey]?: typeof Slot; +} = host; + +export const Slot: ReturnType = + globalHost[globalKey] || + // Earlier versions of this package stored the globalKey property on the Array + // constructor, so we check there as well, to prevent Slot class duplication. + (Array as typeof globalHost)[globalKey] || + (function (Slot) { + try { + Object.defineProperty(globalHost, globalKey, { + value: Slot, + enumerable: false, + writable: false, + // When it was possible for globalHost to be the Array constructor (a + // legacy Slot dedup strategy), it was important for the property to be + // configurable:true so it could be deleted. That does not seem to be as + // important when globalHost is the global object, but I don't want to + // cause similar problems again, and configurable:true seems safest. + // https://github.com/endojs/endo/issues/576#issuecomment-1178274008 + configurable: true + }); + } finally { + return Slot; + } + })(makeSlotClass()); diff --git a/graphql-subscription/node_modules/@wry/context/src/tests/main.ts b/graphql-subscription/node_modules/@wry/context/src/tests/main.ts new file mode 100644 index 0000000..99070cb --- /dev/null +++ b/graphql-subscription/node_modules/@wry/context/src/tests/main.ts @@ -0,0 +1,478 @@ +import * as assert from "assert"; +import { + Slot, + bind, + noContext, + setTimeout, + asyncFromGen +} from "../index.js"; + +function repeat(s: string, times: number) { + let result = ""; + while (times --> 0) result += s; + return result; +} + +describe("Slot", function () { + it("is importable", function () { + assert.strictEqual(typeof Slot, "function"); + }); + + it("has no value initially", function () { + const slot = new Slot; + assert.strictEqual(slot.hasValue(), false); + assert.strictEqual(typeof slot.getValue(), "undefined"); + }); + + it("retains values set by withValue", function () { + const slot = new Slot(); + + const results = slot.withValue(123, () => { + assert.strictEqual(slot.hasValue(), true); + assert.strictEqual(slot.getValue(), 123); + + const results = [ + slot.getValue(), + slot.withValue(456, () => { + assert.strictEqual(slot.hasValue(), true); + return slot.getValue(); + }), + slot.withValue(789, () => { + assert.strictEqual(slot.hasValue(), true); + return slot.getValue(); + }), + ]; + + assert.strictEqual(slot.hasValue(), true); + assert.strictEqual(slot.getValue(), 123); + + return results; + }); + + assert.strictEqual(slot.hasValue(), false); + assert.deepEqual(results, [123, 456, 789]); + }); + + it("is not confused by other slots", function () { + const stringSlot = new Slot(); + const numberSlot = new Slot(); + + function inner() { + return repeat( + stringSlot.getValue()!, + numberSlot.getValue()!, + ); + } + + const oneWay = stringSlot.withValue("oyez", () => { + return numberSlot.withValue(3, inner); + }); + + assert.strictEqual(stringSlot.hasValue(), false); + assert.strictEqual(numberSlot.hasValue(), false); + + const otherWay = numberSlot.withValue(3, () => { + return stringSlot.withValue("oyez", inner); + }); + + assert.strictEqual(stringSlot.hasValue(), false); + assert.strictEqual(numberSlot.hasValue(), false); + + assert.strictEqual(oneWay, otherWay); + assert.strictEqual(oneWay, "oyezoyezoyez"); + }); + + it("is a singleton", async function () { + const cjsSlotModule = await import("../slot.js"); + assert.ok(new Slot() instanceof cjsSlotModule.Slot); + assert.ok(new cjsSlotModule.Slot() instanceof Slot); + assert.strictEqual(cjsSlotModule.Slot, Slot); + const globalKey = "@wry/context:Slot"; + assert.strictEqual((global as any)[globalKey], Slot); + assert.deepEqual(Object.keys(Array), []); + assert.strictEqual( + Object.keys(global).indexOf(globalKey), + -1, + ); + }); + + it("can be subclassed", function () { + class NamedSlot extends Slot { + constructor(public readonly name: string) { + super(); + (this as any).id = name + ":" + this.id; + } + } + + const ageSlot = new NamedSlot("age"); + assert.strictEqual(ageSlot.hasValue(), false); + ageSlot.withValue(87, () => { + assert.strictEqual(ageSlot.hasValue(), true); + const age = ageSlot.getValue()!; + assert.strictEqual(age, 87); + assert.strictEqual(ageSlot.name, "age"); + assert.ok(ageSlot.id.startsWith("age:slot:")); + }); + + class DefaultSlot extends Slot { + constructor(public readonly defaultValue: T) { + super(); + } + + hasValue() { + return true; + } + + getValue() { + return super.hasValue() ? super.getValue() : this.defaultValue; + } + } + + const defaultSlot = new DefaultSlot("default"); + assert.strictEqual(defaultSlot.hasValue(), true); + assert.strictEqual(defaultSlot.getValue(), "default"); + const check = defaultSlot.withValue("real", function () { + assert.strictEqual(defaultSlot.hasValue(), true); + assert.strictEqual(defaultSlot.getValue(), "real"); + return bind(function () { + assert.strictEqual(defaultSlot.hasValue(), true); + assert.strictEqual(defaultSlot.getValue(), "real"); + }); + }); + assert.strictEqual(defaultSlot.hasValue(), true); + assert.strictEqual(defaultSlot.getValue(), "default"); + check(); + }); +}); + +describe("bind", function () { + it("is importable", function () { + assert.strictEqual(typeof bind, "function"); + }); + + it("preserves multiple slots", function () { + const stringSlot = new Slot(); + const numberSlot = new Slot(); + + function neither() { + assert.strictEqual(stringSlot.hasValue(), false); + assert.strictEqual(numberSlot.hasValue(), false); + } + + const checks = [bind(neither)]; + + stringSlot.withValue("asdf", () => { + function justStringAsdf() { + assert.strictEqual(stringSlot.hasValue(), true); + assert.strictEqual(stringSlot.getValue(), "asdf"); + assert.strictEqual(numberSlot.hasValue(), false); + } + + checks.push(bind(justStringAsdf)); + + numberSlot.withValue(54321, () => { + checks.push(bind(function both() { + assert.strictEqual(stringSlot.hasValue(), true); + assert.strictEqual(stringSlot.getValue(), "asdf"); + assert.strictEqual(numberSlot.hasValue(), true); + assert.strictEqual(numberSlot.getValue(), 54321); + })); + }); + + stringSlot.withValue("oyez", () => { + checks.push(bind(function justStringOyez() { + assert.strictEqual(stringSlot.hasValue(), true); + assert.strictEqual(stringSlot.getValue(), "oyez"); + assert.strictEqual(numberSlot.hasValue(), false); + })); + + numberSlot.withValue(12345, () => { + checks.push(bind(function bothAgain() { + assert.strictEqual(stringSlot.hasValue(), true); + assert.strictEqual(stringSlot.getValue(), "oyez"); + assert.strictEqual(numberSlot.hasValue(), true); + assert.strictEqual(numberSlot.getValue(), 12345); + })); + }); + }); + + checks.push(bind(justStringAsdf)); + }); + + checks.push(bind(neither)); + + checks.forEach(check => check()); + }); + + it("does not permit rebinding", function () { + const slot = new Slot(); + const bound = slot.withValue(1, () => bind(function () { + assert.strictEqual(slot.hasValue(), true); + assert.strictEqual(slot.getValue(), 1); + return slot.getValue(); + })); + assert.strictEqual(bound(), 1); + const rebound = slot.withValue(2, () => bind(bound)); + assert.strictEqual(rebound(), 1); + assert.strictEqual(slot.hasValue(), false); + }); +}); + +describe("noContext", function () { + it("is importable", function () { + assert.strictEqual(typeof noContext, "function"); + }); + + it("severs context set by withValue", function () { + const slot = new Slot(); + const result = slot.withValue("asdf", function () { + assert.strictEqual(slot.getValue(), "asdf"); + return noContext(() => { + assert.strictEqual(slot.hasValue(), false); + return "inner"; + }); + }); + assert.strictEqual(result, "inner"); + }); + + it("severs bound context", function () { + const slot = new Slot(); + const bound = slot.withValue("asdf", function () { + assert.strictEqual(slot.getValue(), "asdf"); + return bind(function () { + assert.strictEqual(slot.getValue(), "asdf"); + return noContext(() => { + assert.strictEqual(slot.hasValue(), false); + return "inner"; + }); + }); + }); + assert.strictEqual(slot.hasValue(), false); + assert.strictEqual(bound(), "inner"); + }); + + it("permits reestablishing inner context values", function () { + const slot = new Slot(); + const bound = slot.withValue("asdf", function () { + assert.strictEqual(slot.getValue(), "asdf"); + return bind(function () { + assert.strictEqual(slot.getValue(), "asdf"); + return noContext(() => { + assert.strictEqual(slot.hasValue(), false); + return slot.withValue("oyez", () => { + assert.strictEqual(slot.hasValue(), true); + return slot.getValue(); + }); + }); + }); + }); + assert.strictEqual(slot.hasValue(), false); + assert.strictEqual(bound(), "oyez"); + }); + + it("permits passing arguments and this", function () { + const slot = new Slot(); + const self = {}; + const notSelf = {}; + const result = slot.withValue(1, function (a: number) { + assert.strictEqual(slot.hasValue(), true); + assert.strictEqual(slot.getValue(), 1); + assert.strictEqual(this, self); + return noContext(function (b: number) { + assert.strictEqual(slot.hasValue(), false); + assert.strictEqual(this, notSelf); + return slot.withValue(b, (aArg, bArg) => { + assert.strictEqual(slot.hasValue(), true); + assert.strictEqual(slot.getValue(), b); + assert.strictEqual(this, notSelf); + assert.strictEqual(a, aArg); + assert.strictEqual(b, bArg); + return aArg * bArg; + }, [a, b], self); + }, [3], notSelf); + }, [2], self); + assert.strictEqual(result, 2 * 3); + }); + + it("works with Array-like (arguments) objects", function () { + function multiply(a: number, b: number) { + return noContext(function inner(a, b) { + return a * b; + }, arguments as any); + } + assert.strictEqual(multiply(3, 7) * 2, 42); + }); +}); + +describe("setTimeout", function () { + it("is importable", function () { + assert.strictEqual(typeof setTimeout, "function"); + }); + + it("binds its callback", function () { + const booleanSlot = new Slot(); + const objectSlot = new Slot<{ foo: number }>(); + + return new Promise((resolve, reject) => { + booleanSlot.withValue(true, () => { + assert.strictEqual(booleanSlot.getValue(), true); + objectSlot.withValue({ foo: 42 }, () => { + setTimeout(function () { + try { + assert.strictEqual(booleanSlot.hasValue(), true); + assert.strictEqual(booleanSlot.getValue(), true); + assert.strictEqual(objectSlot.hasValue(), true); + assert.strictEqual(objectSlot.getValue()!.foo, 42); + resolve(); + } catch (error) { + reject(error); + } + }, 10); + }) + }); + }).then(() => { + assert.strictEqual(booleanSlot.hasValue(), false); + assert.strictEqual(objectSlot.hasValue(), false); + }); + }); +}); + +describe("asyncFromGen", function () { + it("is importable", function () { + assert.strictEqual(typeof asyncFromGen, "function"); + }); + + it("works like an async function", asyncFromGen( + function*(): Generator, Promise, number> { + let sum = 0; + const limit = yield new Promise(resolve => { + setTimeout(() => resolve(10), 10); + }); + for (let i = 0; i < limit; ++i) { + sum += yield i + 1; + } + assert.strictEqual(sum, 55); + return Promise.resolve("ok"); + }, + )); + + it("properly handles exceptions", async function () { + const fn = asyncFromGen(function*(throwee?: object) { + const result = yield Promise.resolve("ok"); + if (throwee) { + throw yield throwee; + } + return result; + }); + + const okPromise = fn(); + const expected = {}; + const koPromise = fn(expected); + + assert.strictEqual(await okPromise, "ok"); + + try { + await koPromise; + throw new Error("not reached"); + } catch (error) { + assert.strictEqual(error, expected); + } + + try { + await fn(Promise.resolve("oyez")); + throw new Error("not reached"); + } catch (thrown) { + assert.strictEqual(thrown, "oyez"); + } + }); + + it("propagates contextual slot values across yields", function () { + const stringSlot = new Slot(); + const numberSlot = new Slot(); + + function checkNoValues() { + assert.strictEqual(stringSlot.hasValue(), false); + assert.strictEqual(numberSlot.hasValue(), false); + } + + const inner = asyncFromGen(function*( + stringValue: string, + numberValue: number, + ) { + function checkValues() { + assert.strictEqual(stringSlot.getValue(), stringValue); + assert.strictEqual(numberSlot.getValue(), numberValue); + } + + checkValues(); + + yield new Promise(resolve => setTimeout(function () { + checkValues(); + resolve(); + }, 10)); + + checkValues(); + + yield new Promise(resolve => { + checkValues(); + resolve(); + }); + + checkValues(); + + yield Promise.resolve().then(checkNoValues); + + checkValues(); + + return repeat(stringValue, numberValue); + }); + + const outer = asyncFromGen(function*() { + checkNoValues(); + + const oyezPromise = stringSlot.withValue("oyez", () => { + return numberSlot.withValue(3, () => inner("oyez", 3)); + }); + + checkNoValues(); + + const hahaPromise = numberSlot.withValue(4, () => { + return stringSlot.withValue("ha", () => inner("ha", 4)); + }); + + checkNoValues(); + + assert.strictEqual(yield oyezPromise, "oyezoyezoyez"); + assert.strictEqual(yield hahaPromise, "hahahaha"); + + checkNoValues(); + + return Promise.all([oyezPromise, hahaPromise]); + }); + + return outer().then(results => { + checkNoValues(); + + assert.deepEqual(results, [ + "oyezoyezoyez", + "hahahaha", + ]); + }); + }); + + it("allows Promise rejections to be caught", function () { + const fn = asyncFromGen(function*() { + try { + yield Promise.reject(new Error("expected")); + throw new Error("not reached"); + } catch (error: any) { + assert.strictEqual(error?.message, "expected"); + } + return "ok"; + }); + + return fn().then(result => { + assert.strictEqual(result, "ok"); + }); + }); +}); diff --git a/graphql-subscription/node_modules/@wry/equality/LICENSE b/graphql-subscription/node_modules/@wry/equality/LICENSE new file mode 100644 index 0000000..306c285 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Ben Newman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/@wry/equality/README.md b/graphql-subscription/node_modules/@wry/equality/README.md new file mode 100644 index 0000000..4505ebc --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/README.md @@ -0,0 +1,4 @@ +# @wry/equality + +Structural equality checking for JavaScript values, with correct handling +of cyclic references, and minimal bundle size. diff --git a/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs b/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs new file mode 100644 index 0000000..de6aea5 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs @@ -0,0 +1,202 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +const { toString, hasOwnProperty } = Object.prototype; +const fnToStr = Function.prototype.toString; +const previousComparisons = new Map(); +/** + * Performs a deep equality check on two JavaScript values, tolerating cycles. + */ +function equal(a, b) { + try { + return check(a, b); + } + finally { + previousComparisons.clear(); + } +} +function check(a, b) { + // If the two values are strictly equal, our job is easy. + if (a === b) { + return true; + } + // Object.prototype.toString returns a representation of the runtime type of + // the given value that is considerably more precise than typeof. + const aTag = toString.call(a); + const bTag = toString.call(b); + // If the runtime types of a and b are different, they could maybe be equal + // under some interpretation of equality, but for simplicity and performance + // we just return false instead. + if (aTag !== bTag) { + return false; + } + switch (aTag) { + case '[object Array]': + // Arrays are a lot like other objects, but we can cheaply compare their + // lengths as a short-cut before comparing their elements. + if (a.length !== b.length) + return false; + // Fall through to object case... + case '[object Object]': { + if (previouslyCompared(a, b)) + return true; + const aKeys = definedKeys(a); + const bKeys = definedKeys(b); + // If `a` and `b` have a different number of enumerable keys, they + // must be different. + const keyCount = aKeys.length; + if (keyCount !== bKeys.length) + return false; + // Now make sure they have the same keys. + for (let k = 0; k < keyCount; ++k) { + if (!hasOwnProperty.call(b, aKeys[k])) { + return false; + } + } + // Finally, check deep equality of all child properties. + for (let k = 0; k < keyCount; ++k) { + const key = aKeys[k]; + if (!check(a[key], b[key])) { + return false; + } + } + return true; + } + case '[object Error]': + return a.name === b.name && a.message === b.message; + case '[object Number]': + // Handle NaN, which is !== itself. + if (a !== a) + return b !== b; + // Fall through to shared +a === +b case... + case '[object Boolean]': + case '[object Date]': + return +a === +b; + case '[object RegExp]': + case '[object String]': + return a == `${b}`; + case '[object Map]': + case '[object Set]': { + if (a.size !== b.size) + return false; + if (previouslyCompared(a, b)) + return true; + const aIterator = a.entries(); + const isMap = aTag === '[object Map]'; + while (true) { + const info = aIterator.next(); + if (info.done) + break; + // If a instanceof Set, aValue === aKey. + const [aKey, aValue] = info.value; + // So this works the same way for both Set and Map. + if (!b.has(aKey)) { + return false; + } + // However, we care about deep equality of values only when dealing + // with Map structures. + if (isMap && !check(aValue, b.get(aKey))) { + return false; + } + } + return true; + } + case '[object Uint16Array]': + case '[object Uint8Array]': // Buffer, in Node.js. + case '[object Uint32Array]': + case '[object Int32Array]': + case '[object Int8Array]': + case '[object Int16Array]': + case '[object ArrayBuffer]': + // DataView doesn't need these conversions, but the equality check is + // otherwise the same. + a = new Uint8Array(a); + b = new Uint8Array(b); + // Fall through... + case '[object DataView]': { + let len = a.byteLength; + if (len === b.byteLength) { + while (len-- && a[len] === b[len]) { + // Keep looping as long as the bytes are equal. + } + } + return len === -1; + } + case '[object AsyncFunction]': + case '[object GeneratorFunction]': + case '[object AsyncGeneratorFunction]': + case '[object Function]': { + const aCode = fnToStr.call(a); + if (aCode !== fnToStr.call(b)) { + return false; + } + // We consider non-native functions equal if they have the same code + // (native functions require === because their code is censored). + // Note that this behavior is not entirely sound, since !== function + // objects with the same code can behave differently depending on + // their closure scope. However, any function can behave differently + // depending on the values of its input arguments (including this) + // and its calling context (including its closure scope), even + // though the function object is === to itself; and it is entirely + // possible for functions that are not === to behave exactly the + // same under all conceivable circumstances. Because none of these + // factors are statically decidable in JavaScript, JS function + // equality is not well-defined. This ambiguity allows us to + // consider the best possible heuristic among various imperfect + // options, and equating non-native functions that have the same + // code has enormous practical benefits, such as when comparing + // functions that are repeatedly passed as fresh function + // expressions within objects that are otherwise deeply equal. Since + // any function created from the same syntactic expression (in the + // same code location) will always stringify to the same code + // according to fnToStr.call, we can reasonably expect these + // repeatedly passed function expressions to have the same code, and + // thus behave "the same" (with all the caveats mentioned above), + // even though the runtime function objects are !== to one another. + return !endsWith(aCode, nativeCodeSuffix); + } + } + // Otherwise the values are not equal. + return false; +} +function definedKeys(obj) { + // Remember that the second argument to Array.prototype.filter will be + // used as `this` within the callback function. + return Object.keys(obj).filter(isDefinedKey, obj); +} +function isDefinedKey(key) { + return this[key] !== void 0; +} +const nativeCodeSuffix = "{ [native code] }"; +function endsWith(full, suffix) { + const fromIndex = full.length - suffix.length; + return fromIndex >= 0 && + full.indexOf(suffix, fromIndex) === fromIndex; +} +function previouslyCompared(a, b) { + // Though cyclic references can make an object graph appear infinite from the + // perspective of a depth-first traversal, the graph still contains a finite + // number of distinct object references. We use the previousComparisons cache + // to avoid comparing the same pair of object references more than once, which + // guarantees termination (even if we end up comparing every object in one + // graph to every object in the other graph, which is extremely unlikely), + // while still allowing weird isomorphic structures (like rings with different + // lengths) a chance to pass the equality test. + let bSet = previousComparisons.get(a); + if (bSet) { + // Return true here because we can be sure false will be returned somewhere + // else if the objects are not equivalent. + if (bSet.has(b)) + return true; + } + else { + previousComparisons.set(a, bSet = new Set); + } + bSet.add(b); + return false; +} + +exports.default = equal; +exports.equal = equal; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.map b/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.map new file mode 100644 index 0000000..8f134dc --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.cjs","sources":["index.js"],"sourcesContent":["const { toString, hasOwnProperty } = Object.prototype;\nconst fnToStr = Function.prototype.toString;\nconst previousComparisons = new Map();\n/**\n * Performs a deep equality check on two JavaScript values, tolerating cycles.\n */\nexport function equal(a, b) {\n try {\n return check(a, b);\n }\n finally {\n previousComparisons.clear();\n }\n}\n// Allow default imports as well.\nexport default equal;\nfunction check(a, b) {\n // If the two values are strictly equal, our job is easy.\n if (a === b) {\n return true;\n }\n // Object.prototype.toString returns a representation of the runtime type of\n // the given value that is considerably more precise than typeof.\n const aTag = toString.call(a);\n const bTag = toString.call(b);\n // If the runtime types of a and b are different, they could maybe be equal\n // under some interpretation of equality, but for simplicity and performance\n // we just return false instead.\n if (aTag !== bTag) {\n return false;\n }\n switch (aTag) {\n case '[object Array]':\n // Arrays are a lot like other objects, but we can cheaply compare their\n // lengths as a short-cut before comparing their elements.\n if (a.length !== b.length)\n return false;\n // Fall through to object case...\n case '[object Object]': {\n if (previouslyCompared(a, b))\n return true;\n const aKeys = definedKeys(a);\n const bKeys = definedKeys(b);\n // If `a` and `b` have a different number of enumerable keys, they\n // must be different.\n const keyCount = aKeys.length;\n if (keyCount !== bKeys.length)\n return false;\n // Now make sure they have the same keys.\n for (let k = 0; k < keyCount; ++k) {\n if (!hasOwnProperty.call(b, aKeys[k])) {\n return false;\n }\n }\n // Finally, check deep equality of all child properties.\n for (let k = 0; k < keyCount; ++k) {\n const key = aKeys[k];\n if (!check(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n case '[object Error]':\n return a.name === b.name && a.message === b.message;\n case '[object Number]':\n // Handle NaN, which is !== itself.\n if (a !== a)\n return b !== b;\n // Fall through to shared +a === +b case...\n case '[object Boolean]':\n case '[object Date]':\n return +a === +b;\n case '[object RegExp]':\n case '[object String]':\n return a == `${b}`;\n case '[object Map]':\n case '[object Set]': {\n if (a.size !== b.size)\n return false;\n if (previouslyCompared(a, b))\n return true;\n const aIterator = a.entries();\n const isMap = aTag === '[object Map]';\n while (true) {\n const info = aIterator.next();\n if (info.done)\n break;\n // If a instanceof Set, aValue === aKey.\n const [aKey, aValue] = info.value;\n // So this works the same way for both Set and Map.\n if (!b.has(aKey)) {\n return false;\n }\n // However, we care about deep equality of values only when dealing\n // with Map structures.\n if (isMap && !check(aValue, b.get(aKey))) {\n return false;\n }\n }\n return true;\n }\n case '[object Uint16Array]':\n case '[object Uint8Array]': // Buffer, in Node.js.\n case '[object Uint32Array]':\n case '[object Int32Array]':\n case '[object Int8Array]':\n case '[object Int16Array]':\n case '[object ArrayBuffer]':\n // DataView doesn't need these conversions, but the equality check is\n // otherwise the same.\n a = new Uint8Array(a);\n b = new Uint8Array(b);\n // Fall through...\n case '[object DataView]': {\n let len = a.byteLength;\n if (len === b.byteLength) {\n while (len-- && a[len] === b[len]) {\n // Keep looping as long as the bytes are equal.\n }\n }\n return len === -1;\n }\n case '[object AsyncFunction]':\n case '[object GeneratorFunction]':\n case '[object AsyncGeneratorFunction]':\n case '[object Function]': {\n const aCode = fnToStr.call(a);\n if (aCode !== fnToStr.call(b)) {\n return false;\n }\n // We consider non-native functions equal if they have the same code\n // (native functions require === because their code is censored).\n // Note that this behavior is not entirely sound, since !== function\n // objects with the same code can behave differently depending on\n // their closure scope. However, any function can behave differently\n // depending on the values of its input arguments (including this)\n // and its calling context (including its closure scope), even\n // though the function object is === to itself; and it is entirely\n // possible for functions that are not === to behave exactly the\n // same under all conceivable circumstances. Because none of these\n // factors are statically decidable in JavaScript, JS function\n // equality is not well-defined. This ambiguity allows us to\n // consider the best possible heuristic among various imperfect\n // options, and equating non-native functions that have the same\n // code has enormous practical benefits, such as when comparing\n // functions that are repeatedly passed as fresh function\n // expressions within objects that are otherwise deeply equal. Since\n // any function created from the same syntactic expression (in the\n // same code location) will always stringify to the same code\n // according to fnToStr.call, we can reasonably expect these\n // repeatedly passed function expressions to have the same code, and\n // thus behave \"the same\" (with all the caveats mentioned above),\n // even though the runtime function objects are !== to one another.\n return !endsWith(aCode, nativeCodeSuffix);\n }\n }\n // Otherwise the values are not equal.\n return false;\n}\nfunction definedKeys(obj) {\n // Remember that the second argument to Array.prototype.filter will be\n // used as `this` within the callback function.\n return Object.keys(obj).filter(isDefinedKey, obj);\n}\nfunction isDefinedKey(key) {\n return this[key] !== void 0;\n}\nconst nativeCodeSuffix = \"{ [native code] }\";\nfunction endsWith(full, suffix) {\n const fromIndex = full.length - suffix.length;\n return fromIndex >= 0 &&\n full.indexOf(suffix, fromIndex) === fromIndex;\n}\nfunction previouslyCompared(a, b) {\n // Though cyclic references can make an object graph appear infinite from the\n // perspective of a depth-first traversal, the graph still contains a finite\n // number of distinct object references. We use the previousComparisons cache\n // to avoid comparing the same pair of object references more than once, which\n // guarantees termination (even if we end up comparing every object in one\n // graph to every object in the other graph, which is extremely unlikely),\n // while still allowing weird isomorphic structures (like rings with different\n // lengths) a chance to pass the equality test.\n let bSet = previousComparisons.get(a);\n if (bSet) {\n // Return true here because we can be sure false will be returned somewhere\n // else if the objects are not equivalent.\n if (bSet.has(b))\n return true;\n }\n else {\n previousComparisons.set(a, bSet = new Set);\n }\n bSet.add(b);\n return false;\n}\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;AAAA,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;AACtD,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC;AAC5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,MAAM,EAAE;AAChC,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAClD,IAAI,OAAO,SAAS,IAAI,CAAC;AACzB,QAAQ,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,SAAS,CAAC;AACtD,CAAC;AACD,SAAS,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,IAAI,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1C,IAAI,IAAI,IAAI,EAAE;AACd;AACA;AACA,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACvB,YAAY,OAAO,IAAI,CAAC;AACxB,KAAK;AACL,SAAS;AACT,QAAQ,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;AACnD,KAAK;AACL,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChB,IAAI,OAAO,KAAK,CAAC;AACjB;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.native.js b/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.native.js new file mode 100644 index 0000000..de6aea5 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/lib/bundle.cjs.native.js @@ -0,0 +1,202 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +const { toString, hasOwnProperty } = Object.prototype; +const fnToStr = Function.prototype.toString; +const previousComparisons = new Map(); +/** + * Performs a deep equality check on two JavaScript values, tolerating cycles. + */ +function equal(a, b) { + try { + return check(a, b); + } + finally { + previousComparisons.clear(); + } +} +function check(a, b) { + // If the two values are strictly equal, our job is easy. + if (a === b) { + return true; + } + // Object.prototype.toString returns a representation of the runtime type of + // the given value that is considerably more precise than typeof. + const aTag = toString.call(a); + const bTag = toString.call(b); + // If the runtime types of a and b are different, they could maybe be equal + // under some interpretation of equality, but for simplicity and performance + // we just return false instead. + if (aTag !== bTag) { + return false; + } + switch (aTag) { + case '[object Array]': + // Arrays are a lot like other objects, but we can cheaply compare their + // lengths as a short-cut before comparing their elements. + if (a.length !== b.length) + return false; + // Fall through to object case... + case '[object Object]': { + if (previouslyCompared(a, b)) + return true; + const aKeys = definedKeys(a); + const bKeys = definedKeys(b); + // If `a` and `b` have a different number of enumerable keys, they + // must be different. + const keyCount = aKeys.length; + if (keyCount !== bKeys.length) + return false; + // Now make sure they have the same keys. + for (let k = 0; k < keyCount; ++k) { + if (!hasOwnProperty.call(b, aKeys[k])) { + return false; + } + } + // Finally, check deep equality of all child properties. + for (let k = 0; k < keyCount; ++k) { + const key = aKeys[k]; + if (!check(a[key], b[key])) { + return false; + } + } + return true; + } + case '[object Error]': + return a.name === b.name && a.message === b.message; + case '[object Number]': + // Handle NaN, which is !== itself. + if (a !== a) + return b !== b; + // Fall through to shared +a === +b case... + case '[object Boolean]': + case '[object Date]': + return +a === +b; + case '[object RegExp]': + case '[object String]': + return a == `${b}`; + case '[object Map]': + case '[object Set]': { + if (a.size !== b.size) + return false; + if (previouslyCompared(a, b)) + return true; + const aIterator = a.entries(); + const isMap = aTag === '[object Map]'; + while (true) { + const info = aIterator.next(); + if (info.done) + break; + // If a instanceof Set, aValue === aKey. + const [aKey, aValue] = info.value; + // So this works the same way for both Set and Map. + if (!b.has(aKey)) { + return false; + } + // However, we care about deep equality of values only when dealing + // with Map structures. + if (isMap && !check(aValue, b.get(aKey))) { + return false; + } + } + return true; + } + case '[object Uint16Array]': + case '[object Uint8Array]': // Buffer, in Node.js. + case '[object Uint32Array]': + case '[object Int32Array]': + case '[object Int8Array]': + case '[object Int16Array]': + case '[object ArrayBuffer]': + // DataView doesn't need these conversions, but the equality check is + // otherwise the same. + a = new Uint8Array(a); + b = new Uint8Array(b); + // Fall through... + case '[object DataView]': { + let len = a.byteLength; + if (len === b.byteLength) { + while (len-- && a[len] === b[len]) { + // Keep looping as long as the bytes are equal. + } + } + return len === -1; + } + case '[object AsyncFunction]': + case '[object GeneratorFunction]': + case '[object AsyncGeneratorFunction]': + case '[object Function]': { + const aCode = fnToStr.call(a); + if (aCode !== fnToStr.call(b)) { + return false; + } + // We consider non-native functions equal if they have the same code + // (native functions require === because their code is censored). + // Note that this behavior is not entirely sound, since !== function + // objects with the same code can behave differently depending on + // their closure scope. However, any function can behave differently + // depending on the values of its input arguments (including this) + // and its calling context (including its closure scope), even + // though the function object is === to itself; and it is entirely + // possible for functions that are not === to behave exactly the + // same under all conceivable circumstances. Because none of these + // factors are statically decidable in JavaScript, JS function + // equality is not well-defined. This ambiguity allows us to + // consider the best possible heuristic among various imperfect + // options, and equating non-native functions that have the same + // code has enormous practical benefits, such as when comparing + // functions that are repeatedly passed as fresh function + // expressions within objects that are otherwise deeply equal. Since + // any function created from the same syntactic expression (in the + // same code location) will always stringify to the same code + // according to fnToStr.call, we can reasonably expect these + // repeatedly passed function expressions to have the same code, and + // thus behave "the same" (with all the caveats mentioned above), + // even though the runtime function objects are !== to one another. + return !endsWith(aCode, nativeCodeSuffix); + } + } + // Otherwise the values are not equal. + return false; +} +function definedKeys(obj) { + // Remember that the second argument to Array.prototype.filter will be + // used as `this` within the callback function. + return Object.keys(obj).filter(isDefinedKey, obj); +} +function isDefinedKey(key) { + return this[key] !== void 0; +} +const nativeCodeSuffix = "{ [native code] }"; +function endsWith(full, suffix) { + const fromIndex = full.length - suffix.length; + return fromIndex >= 0 && + full.indexOf(suffix, fromIndex) === fromIndex; +} +function previouslyCompared(a, b) { + // Though cyclic references can make an object graph appear infinite from the + // perspective of a depth-first traversal, the graph still contains a finite + // number of distinct object references. We use the previousComparisons cache + // to avoid comparing the same pair of object references more than once, which + // guarantees termination (even if we end up comparing every object in one + // graph to every object in the other graph, which is extremely unlikely), + // while still allowing weird isomorphic structures (like rings with different + // lengths) a chance to pass the equality test. + let bSet = previousComparisons.get(a); + if (bSet) { + // Return true here because we can be sure false will be returned somewhere + // else if the objects are not equivalent. + if (bSet.has(b)) + return true; + } + else { + previousComparisons.set(a, bSet = new Set); + } + bSet.add(b); + return false; +} + +exports.default = equal; +exports.equal = equal; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/equality/lib/index.d.ts b/graphql-subscription/node_modules/@wry/equality/lib/index.d.ts new file mode 100644 index 0000000..fa9e8a4 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/lib/index.d.ts @@ -0,0 +1,5 @@ +/** + * Performs a deep equality check on two JavaScript values, tolerating cycles. + */ +export declare function equal(a: any, b: any): boolean; +export default equal; diff --git a/graphql-subscription/node_modules/@wry/equality/lib/index.js b/graphql-subscription/node_modules/@wry/equality/lib/index.js new file mode 100644 index 0000000..e1b1e0c --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/lib/index.js @@ -0,0 +1,197 @@ +const { toString, hasOwnProperty } = Object.prototype; +const fnToStr = Function.prototype.toString; +const previousComparisons = new Map(); +/** + * Performs a deep equality check on two JavaScript values, tolerating cycles. + */ +export function equal(a, b) { + try { + return check(a, b); + } + finally { + previousComparisons.clear(); + } +} +// Allow default imports as well. +export default equal; +function check(a, b) { + // If the two values are strictly equal, our job is easy. + if (a === b) { + return true; + } + // Object.prototype.toString returns a representation of the runtime type of + // the given value that is considerably more precise than typeof. + const aTag = toString.call(a); + const bTag = toString.call(b); + // If the runtime types of a and b are different, they could maybe be equal + // under some interpretation of equality, but for simplicity and performance + // we just return false instead. + if (aTag !== bTag) { + return false; + } + switch (aTag) { + case '[object Array]': + // Arrays are a lot like other objects, but we can cheaply compare their + // lengths as a short-cut before comparing their elements. + if (a.length !== b.length) + return false; + // Fall through to object case... + case '[object Object]': { + if (previouslyCompared(a, b)) + return true; + const aKeys = definedKeys(a); + const bKeys = definedKeys(b); + // If `a` and `b` have a different number of enumerable keys, they + // must be different. + const keyCount = aKeys.length; + if (keyCount !== bKeys.length) + return false; + // Now make sure they have the same keys. + for (let k = 0; k < keyCount; ++k) { + if (!hasOwnProperty.call(b, aKeys[k])) { + return false; + } + } + // Finally, check deep equality of all child properties. + for (let k = 0; k < keyCount; ++k) { + const key = aKeys[k]; + if (!check(a[key], b[key])) { + return false; + } + } + return true; + } + case '[object Error]': + return a.name === b.name && a.message === b.message; + case '[object Number]': + // Handle NaN, which is !== itself. + if (a !== a) + return b !== b; + // Fall through to shared +a === +b case... + case '[object Boolean]': + case '[object Date]': + return +a === +b; + case '[object RegExp]': + case '[object String]': + return a == `${b}`; + case '[object Map]': + case '[object Set]': { + if (a.size !== b.size) + return false; + if (previouslyCompared(a, b)) + return true; + const aIterator = a.entries(); + const isMap = aTag === '[object Map]'; + while (true) { + const info = aIterator.next(); + if (info.done) + break; + // If a instanceof Set, aValue === aKey. + const [aKey, aValue] = info.value; + // So this works the same way for both Set and Map. + if (!b.has(aKey)) { + return false; + } + // However, we care about deep equality of values only when dealing + // with Map structures. + if (isMap && !check(aValue, b.get(aKey))) { + return false; + } + } + return true; + } + case '[object Uint16Array]': + case '[object Uint8Array]': // Buffer, in Node.js. + case '[object Uint32Array]': + case '[object Int32Array]': + case '[object Int8Array]': + case '[object Int16Array]': + case '[object ArrayBuffer]': + // DataView doesn't need these conversions, but the equality check is + // otherwise the same. + a = new Uint8Array(a); + b = new Uint8Array(b); + // Fall through... + case '[object DataView]': { + let len = a.byteLength; + if (len === b.byteLength) { + while (len-- && a[len] === b[len]) { + // Keep looping as long as the bytes are equal. + } + } + return len === -1; + } + case '[object AsyncFunction]': + case '[object GeneratorFunction]': + case '[object AsyncGeneratorFunction]': + case '[object Function]': { + const aCode = fnToStr.call(a); + if (aCode !== fnToStr.call(b)) { + return false; + } + // We consider non-native functions equal if they have the same code + // (native functions require === because their code is censored). + // Note that this behavior is not entirely sound, since !== function + // objects with the same code can behave differently depending on + // their closure scope. However, any function can behave differently + // depending on the values of its input arguments (including this) + // and its calling context (including its closure scope), even + // though the function object is === to itself; and it is entirely + // possible for functions that are not === to behave exactly the + // same under all conceivable circumstances. Because none of these + // factors are statically decidable in JavaScript, JS function + // equality is not well-defined. This ambiguity allows us to + // consider the best possible heuristic among various imperfect + // options, and equating non-native functions that have the same + // code has enormous practical benefits, such as when comparing + // functions that are repeatedly passed as fresh function + // expressions within objects that are otherwise deeply equal. Since + // any function created from the same syntactic expression (in the + // same code location) will always stringify to the same code + // according to fnToStr.call, we can reasonably expect these + // repeatedly passed function expressions to have the same code, and + // thus behave "the same" (with all the caveats mentioned above), + // even though the runtime function objects are !== to one another. + return !endsWith(aCode, nativeCodeSuffix); + } + } + // Otherwise the values are not equal. + return false; +} +function definedKeys(obj) { + // Remember that the second argument to Array.prototype.filter will be + // used as `this` within the callback function. + return Object.keys(obj).filter(isDefinedKey, obj); +} +function isDefinedKey(key) { + return this[key] !== void 0; +} +const nativeCodeSuffix = "{ [native code] }"; +function endsWith(full, suffix) { + const fromIndex = full.length - suffix.length; + return fromIndex >= 0 && + full.indexOf(suffix, fromIndex) === fromIndex; +} +function previouslyCompared(a, b) { + // Though cyclic references can make an object graph appear infinite from the + // perspective of a depth-first traversal, the graph still contains a finite + // number of distinct object references. We use the previousComparisons cache + // to avoid comparing the same pair of object references more than once, which + // guarantees termination (even if we end up comparing every object in one + // graph to every object in the other graph, which is extremely unlikely), + // while still allowing weird isomorphic structures (like rings with different + // lengths) a chance to pass the equality test. + let bSet = previousComparisons.get(a); + if (bSet) { + // Return true here because we can be sure false will be returned somewhere + // else if the objects are not equivalent. + if (bSet.has(b)) + return true; + } + else { + previousComparisons.set(a, bSet = new Set); + } + bSet.add(b); + return false; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/equality/lib/index.js.map b/graphql-subscription/node_modules/@wry/equality/lib/index.js.map new file mode 100644 index 0000000..91ca35f --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sour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AC,IAAY,EAAE,MAAc;IAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,OAAO,SAAS,IAAI,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,SAAS,CAAC;AAClD,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAS,EAAE,CAAS;IAC9C,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,8EAA8E;IAC9E,0EAA0E;IAC1E,0EAA0E;IAC1E,8EAA8E;IAC9E,+CAA+C;IAC/C,IAAI,IAAI,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,IAAI,EAAE;QACR,2EAA2E;QAC3E,0CAA0C;QAC1C,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;KAC9B;SAAM;QACL,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;KAC5C;IACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/equality/package.json b/graphql-subscription/node_modules/@wry/equality/package.json new file mode 100644 index 0000000..c79f0f9 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/package.json @@ -0,0 +1,36 @@ +{ + "name": "@wry/equality", + "version": "0.5.7", + "author": "Ben Newman ", + "description": "Structural equality checking for JavaScript values", + "license": "MIT", + "type": "module", + "main": "lib/bundle.cjs", + "module": "lib/index.js", + "types": "lib/index.d.ts", + "keywords": [], + "homepage": "https://github.com/benjamn/wryware", + "repository": { + "type": "git", + "url": "git+https://github.com/benjamn/wryware.git" + }, + "bugs": { + "url": "https://github.com/benjamn/wryware/issues" + }, + "scripts": { + "build": "npm run clean:before && npm run tsc && npm run rollup", + "clean:before": "rimraf lib", + "tsc": "tsc", + "rollup": "rollup -c rollup.config.js", + "prepare": "npm run build", + "test:cjs": "../../shared/test.sh lib/tests/bundle.cjs", + "test:esm": "../../shared/test.sh lib/tests/bundle.js", + "test": "npm run test:esm && npm run test:cjs" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } +} diff --git a/graphql-subscription/node_modules/@wry/equality/rollup.config.js b/graphql-subscription/node_modules/@wry/equality/rollup.config.js new file mode 100644 index 0000000..e34e6ad --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/rollup.config.js @@ -0,0 +1,21 @@ +import { build } from "../../shared/rollup.config.js"; + +// This package doesn't use the lib/es5 directory, so we need to override the +// default export from ../../shared/rollup.config.js. +export default [ + build( + "lib/index.js", + "lib/bundle.cjs", + "cjs" + ), + build( + "lib/tests/main.js", + "lib/tests/bundle.js", + "esm" + ), + build( + "lib/tests/main.js", + "lib/tests/bundle.cjs", + "cjs" + ), +]; diff --git a/graphql-subscription/node_modules/@wry/equality/src/index.ts b/graphql-subscription/node_modules/@wry/equality/src/index.ts new file mode 100644 index 0000000..00b03c4 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/src/index.ts @@ -0,0 +1,218 @@ +const { toString, hasOwnProperty } = Object.prototype; +const fnToStr = Function.prototype.toString; +const previousComparisons = new Map>(); + +/** + * Performs a deep equality check on two JavaScript values, tolerating cycles. + */ +export function equal(a: any, b: any): boolean { + try { + return check(a, b); + } finally { + previousComparisons.clear(); + } +} + +// Allow default imports as well. +export default equal; + +function check(a: any, b: any): boolean { + // If the two values are strictly equal, our job is easy. + if (a === b) { + return true; + } + + // Object.prototype.toString returns a representation of the runtime type of + // the given value that is considerably more precise than typeof. + const aTag = toString.call(a); + const bTag = toString.call(b); + + // If the runtime types of a and b are different, they could maybe be equal + // under some interpretation of equality, but for simplicity and performance + // we just return false instead. + if (aTag !== bTag) { + return false; + } + + switch (aTag) { + case '[object Array]': + // Arrays are a lot like other objects, but we can cheaply compare their + // lengths as a short-cut before comparing their elements. + if (a.length !== b.length) return false; + // Fall through to object case... + case '[object Object]': { + if (previouslyCompared(a, b)) return true; + + const aKeys = definedKeys(a); + const bKeys = definedKeys(b); + + // If `a` and `b` have a different number of enumerable keys, they + // must be different. + const keyCount = aKeys.length; + if (keyCount !== bKeys.length) return false; + + // Now make sure they have the same keys. + for (let k = 0; k < keyCount; ++k) { + if (!hasOwnProperty.call(b, aKeys[k])) { + return false; + } + } + + // Finally, check deep equality of all child properties. + for (let k = 0; k < keyCount; ++k) { + const key = aKeys[k]; + if (!check(a[key], b[key])) { + return false; + } + } + + return true; + } + + case '[object Error]': + return a.name === b.name && a.message === b.message; + + case '[object Number]': + // Handle NaN, which is !== itself. + if (a !== a) return b !== b; + // Fall through to shared +a === +b case... + case '[object Boolean]': + case '[object Date]': + return +a === +b; + + case '[object RegExp]': + case '[object String]': + return a == `${b}`; + + case '[object Map]': + case '[object Set]': { + if (a.size !== b.size) return false; + if (previouslyCompared(a, b)) return true; + + const aIterator = a.entries(); + const isMap = aTag === '[object Map]'; + + while (true) { + const info = aIterator.next(); + if (info.done) break; + + // If a instanceof Set, aValue === aKey. + const [aKey, aValue] = info.value; + + // So this works the same way for both Set and Map. + if (!b.has(aKey)) { + return false; + } + + // However, we care about deep equality of values only when dealing + // with Map structures. + if (isMap && !check(aValue, b.get(aKey))) { + return false; + } + } + + return true; + } + + case '[object Uint16Array]': + case '[object Uint8Array]': // Buffer, in Node.js. + case '[object Uint32Array]': + case '[object Int32Array]': + case '[object Int8Array]': + case '[object Int16Array]': + case '[object ArrayBuffer]': + // DataView doesn't need these conversions, but the equality check is + // otherwise the same. + a = new Uint8Array(a); + b = new Uint8Array(b); + // Fall through... + case '[object DataView]': { + let len = a.byteLength; + if (len === b.byteLength) { + while (len-- && a[len] === b[len]) { + // Keep looping as long as the bytes are equal. + } + } + return len === -1; + } + + case '[object AsyncFunction]': + case '[object GeneratorFunction]': + case '[object AsyncGeneratorFunction]': + case '[object Function]': { + const aCode = fnToStr.call(a); + if (aCode !== fnToStr.call(b)) { + return false; + } + + // We consider non-native functions equal if they have the same code + // (native functions require === because their code is censored). + // Note that this behavior is not entirely sound, since !== function + // objects with the same code can behave differently depending on + // their closure scope. However, any function can behave differently + // depending on the values of its input arguments (including this) + // and its calling context (including its closure scope), even + // though the function object is === to itself; and it is entirely + // possible for functions that are not === to behave exactly the + // same under all conceivable circumstances. Because none of these + // factors are statically decidable in JavaScript, JS function + // equality is not well-defined. This ambiguity allows us to + // consider the best possible heuristic among various imperfect + // options, and equating non-native functions that have the same + // code has enormous practical benefits, such as when comparing + // functions that are repeatedly passed as fresh function + // expressions within objects that are otherwise deeply equal. Since + // any function created from the same syntactic expression (in the + // same code location) will always stringify to the same code + // according to fnToStr.call, we can reasonably expect these + // repeatedly passed function expressions to have the same code, and + // thus behave "the same" (with all the caveats mentioned above), + // even though the runtime function objects are !== to one another. + return !endsWith(aCode, nativeCodeSuffix); + } + } + + // Otherwise the values are not equal. + return false; +} + +function definedKeys(obj: TObject) { + // Remember that the second argument to Array.prototype.filter will be + // used as `this` within the callback function. + return Object.keys(obj).filter(isDefinedKey, obj); +} +function isDefinedKey( + this: TObject, + key: keyof TObject, +) { + return this[key] !== void 0; +} + +const nativeCodeSuffix = "{ [native code] }"; + +function endsWith(full: string, suffix: string) { + const fromIndex = full.length - suffix.length; + return fromIndex >= 0 && + full.indexOf(suffix, fromIndex) === fromIndex; +} + +function previouslyCompared(a: object, b: object): boolean { + // Though cyclic references can make an object graph appear infinite from the + // perspective of a depth-first traversal, the graph still contains a finite + // number of distinct object references. We use the previousComparisons cache + // to avoid comparing the same pair of object references more than once, which + // guarantees termination (even if we end up comparing every object in one + // graph to every object in the other graph, which is extremely unlikely), + // while still allowing weird isomorphic structures (like rings with different + // lengths) a chance to pass the equality test. + let bSet = previousComparisons.get(a); + if (bSet) { + // Return true here because we can be sure false will be returned somewhere + // else if the objects are not equivalent. + if (bSet.has(b)) return true; + } else { + previousComparisons.set(a, bSet = new Set); + } + bSet.add(b); + return false; +} diff --git a/graphql-subscription/node_modules/@wry/equality/src/tests/main.ts b/graphql-subscription/node_modules/@wry/equality/src/tests/main.ts new file mode 100644 index 0000000..c3430c1 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/equality/src/tests/main.ts @@ -0,0 +1,411 @@ +import * as assert from "assert"; +import defaultEqual, { equal } from "../index.js"; + +function toStr(value: any) { + try { + return JSON.stringify(value); + } catch { + return String(value); + } +} + +function assertEqual(a: any, b: any) { + assert.strictEqual(equal(a, b), true, `unexpectedly not equal(${toStr(a)}}, ${toStr(b)})`); + assert.strictEqual(equal(b, a), true, `unexpectedly not equal(${toStr(b)}, ${toStr(a)})`); +} + +function assertNotEqual(a: any, b: any) { + assert.strictEqual(equal(a, b), false, `unexpectedly equal(${toStr(a)}, ${toStr(b)})`); + assert.strictEqual(equal(b, a), false, `unexpectedly equal(${toStr(b)}, ${toStr(a)})`); +} + +describe("equality", function () { + it("should work with named and default imports", function () { + assert.strictEqual(defaultEqual, equal); + }); + + it("should work for primitive types", function () { + assertEqual(2 + 2, 4); + assertNotEqual(2 + 2, 5); + + assertEqual("oyez", "oyez"); + assertNotEqual("oyez", "onoz"); + + assertEqual(null, null); + assertEqual(void 0, void 1); + assertEqual(NaN, NaN); + + assertNotEqual(void 0, null); + assertNotEqual(void 0, false); + assertNotEqual(false, null); + assertNotEqual(0, null); + assertNotEqual(0, false); + assertNotEqual(0, void 0); + + assertEqual(123, new Number(123)); + assertEqual(true, new Boolean(true)); + assertEqual(false, new Boolean(false)); + assertEqual("oyez", new String("oyez")); + }); + + it("should work for arrays", function () { + assertEqual([1, 2, 3], [1, 2, 3]); + assertEqual([1, [2], 3], [1, [2], 3]); + + const a: any[] = [1]; + a.push(a, 2); + const b: any[] = [1]; + b.push(b, 2); + assertEqual(a, b); + + assertEqual( + [1, /*hole*/, 3], + [1, /*hole*/, 3], + ); + + assertEqual( + [1, /*hole*/, 3], + [1, void 0, 3], + ); + + // Not equal because the arrays are a different length. + assertNotEqual( + [1, 2, /*hole*/,], + [1, 2], + ); + }); + + it("should work for objects", function () { + assertEqual({ + a: 1, + b: 2, + }, { + b: 2, + a: 1, + }); + + assertNotEqual({ + a: 1, + b: 2, + c: 3, + }, { + b: 2, + a: 1, + }); + + const a: any = {}; + a.self = a; + const b: any = {}; + b.self = b; + assertEqual(a, b); + + b.foo = 42; + assertNotEqual(a, b); + }); + + it("should consider undefined and missing object properties equivalent", function () { + assertEqual({ + a: 1, + b: void 0, + c: 3, + }, { + a: 1, + c: 3, + }); + + assertEqual({ + a: void 0, + b: void 0, + c: void 0, + }, {}); + }); + + it("should work for Error objects", function () { + assertEqual(new Error("oyez"), new Error("oyez")); + assertNotEqual(new Error("oyez"), new Error("onoz")); + }); + + it("should work for Date objects", function () { + const now = new Date; + const alsoNow = new Date(+now); + assert.notStrictEqual(now, alsoNow); + assertEqual(now, alsoNow); + const later = new Date(+now + 10); + assertNotEqual(now, later); + }); + + it("should work for RegExp objects", function () { + assert.notStrictEqual(/xy/, /xy/); + assertEqual(/xy/img, /xy/mgi); + assertNotEqual(/xy/img, /x.y/img); + }); + + it("should work for Set objects", function () { + assertEqual( + new Set().add(1).add(2).add(3).add(2), + new Set().add(3).add(1).add(2).add(1), + ); + + const obj = {}; + assertEqual( + new Set().add(1).add(obj).add(3).add(2), + new Set().add(3).add(obj).add(2).add(1), + ); + + assertNotEqual( + new Set(), + new Set().add(void 0), + ); + }); + + it("should work for Map objects", function () { + assertEqual( + new Map().set(1, 2).set(2, 3), + new Map().set(2, 3).set(1, 2), + ); + + assertEqual( + new Map().set(1, 2).set(2, 3).set(1, 0), + new Map().set(2, 3).set(1, 2).set(1, 0), + ); + + assertNotEqual( + new Map().set(1, 2).set(2, 3).set(1, 0), + new Map().set(2, 3).set(1, 2).set(3, 4), + ); + + assertEqual( + new Map().set(1, new Set().add(2)), + new Map().set(1, new Set().add(2)), + ); + + assertNotEqual( + new Map().set(1, new Set().add(2)), + new Map().set(1, new Set().add(2).add(3)), + ); + + const a = new Map; + a.set(a, a); + const b = new Map; + b.set(a, b); + assertEqual(a, b); + + a.set(1, 2); + b.set(1, 2); + assertEqual(a, b); + + a.set(3, 4); + assertNotEqual(a, b); + }); + + it("should tolerate cycles", function () { + const a: any[] = []; + a.push(a); + const b: any[] = []; + b.push(b); + assertEqual(a, b); + assertEqual([a], b); + assertEqual(a, [b]); + assertEqual([a], [b]); + + a.push(1); + b.push(1); + assertEqual(a, b); + assertEqual([a, 1], b); + assertEqual(a, [b, 1]); + + const ring1 = { self: { self: { self: {} as any }}}; + ring1.self.self.self.self = ring1; + const ring2 = { self: { self: {} as any }}; + ring2.self.self.self = ring2; + assertEqual(ring1, ring2); + + ring1.self.self.self.self = ring1.self; + assertEqual(ring1, ring2); + }); + + it("should not care about repeated references", function () { + const r = { foo: 42 }; + assertEqual( + [r, r, r], + JSON.parse(JSON.stringify([r, r, r])), + ); + }); + + it("should equate non-native functions with the same code", function () { + const fn = () => 1234; + assertEqual(fn, fn); + assertEqual(fn, () => 1234); + + // These functions are behaviorally the same, but there's no way to + // decide that question statically. + assertNotEqual( + (a: number) => a + 1, + (b: number) => b + 1, + ); + + assertEqual( + { before: 123, fn() { return 4 }, after: 321 }, + { after: 321, before: 123, fn() { return 4 } }, + ); + + assertEqual(Object.assign, Object.assign); + + // Since these slice methods are native functions, they happen to have + // exactly the same (censored) code, but we can test their equality by + // reference, since we can generally assume native functions are pure. + assertNotEqual(String.prototype.slice, Array.prototype.slice); + assertEqual( + Function.prototype.toString.call(String.prototype.slice), + Function.prototype.toString.call(Array.prototype.slice), + ); + }); + + it("should equate async functions with the same code", function () { + const fn = async () => 1234; + assertEqual(fn, fn); + assertEqual(fn, async () => 1234); + + // These functions are behaviorally the same, but there's no way to + // decide that question statically. + assertNotEqual( + async (a: number) => a + 1, + async (b: number) => b + 1, + ); + + assertEqual( + { before: 123, async fn() { return 4 }, after: 321 }, + { after: 321, before: 123, async fn() { return 4 } }, + ); + }); + + it("should equate generator functions with the same code", function () { + const fn = function *(): Generator { return yield 1234 }; + assertEqual(fn, fn); + assertEqual(fn, function *(): Generator { return yield 1234 }); + + // These functions are behaviorally the same, but there's no way to + // decide that question statically. + assertNotEqual( + function *(a: number): Generator { return yield a + 1 }, + function *(b: number): Generator { return yield b + 1 }, + ); + + assertEqual( + { before: 123, *fn() { return 4 }, after: 321 }, + { after: 321, before: 123, *fn() { return 4 } }, + ); + }); + + it("should equate async generator functions with the same code", function () { + const fn = async function *(): AsyncGenerator { return await (yield 1234) }; + assertEqual(fn, fn); + assertEqual(fn, async function *(): AsyncGenerator { return await (yield 1234) }); + + // These functions are behaviorally the same, but there's no way to + // decide that question statically. + assertNotEqual( + async function *(a: number): AsyncGenerator { return yield a + 1 }, + async function *(b: number): AsyncGenerator { return yield b + 1 }, + ); + + assertEqual( + { before: 123, async *fn() { return 4 }, after: 321 }, + { after: 321, before: 123, async *fn() { return 4 } }, + ); + }); + + it('should work for Array Buffers And Typed Arrays', function () { + const hello = new Int8Array([1, 2, 3, 4, 5]); + const world = new Int8Array([1, 2, 3, 4, 5]); + const small = new Int8Array([1, 2, 3, 4]) + assertEqual(new DataView(new ArrayBuffer(4)), new DataView(new ArrayBuffer(4))) + assertEqual(new Int16Array([42]), new Int16Array([42])); + assertEqual(new Int32Array(new ArrayBuffer(4)), new Int32Array(new ArrayBuffer(4))) + assertEqual(new ArrayBuffer(2), new ArrayBuffer(2)) + assertNotEqual(new Int16Array([1, 2, 3]), new Int16Array([1, 2])); + assertNotEqual(new Int16Array([1, 2, 3]), new Uint16Array([1, 2, 3])) + assertNotEqual(new Int16Array([1, 2, 3]), new Int8Array([1, 2, 3])) + assertNotEqual(new Int32Array(8), new Uint32Array(8)); + assertNotEqual(new Int32Array(new ArrayBuffer(8)), new Int32Array(Array.from({ length: 8 }))); + assertNotEqual(new ArrayBuffer(1), new ArrayBuffer(2)); + assertEqual(hello, world); + assertEqual(hello.buffer, world.buffer); + assertEqual(new DataView(hello.buffer), new DataView(world.buffer)); + assertNotEqual(small, world) + assertNotEqual(small.buffer, world.buffer); + assertNotEqual(new DataView(small.buffer), new DataView(world.buffer)); + }); + + it('should work with a kitchen sink', function () { + const foo = { + foo: 'value1', + bar: new Set([1, 2, 3]), + baz: /foo/i, + bat: { + hello: new Map([ ['hello', 'world'] ]), + world: { + aaa: new Map([ + [{ foo: /bar/ }, 'sub sub value1'], + ]), + bbb: [1, 2, { prop2:1, prop:2 }, 4, 5] + } + }, + quz: new Set([{ a:1 , b:2 }]), + qut: new Date(2016, 2, 10), + qar: new Uint8Array([1, 2, 3, 4, 5]), + } + + const bar = { + quz: new Set([{ a:1 , b:2 }]), + baz: /foo/i, + foo: 'value1', + bar: new Set([1, 2, 3]), + qar: new Uint8Array([1, 2, 3, 4, 5]), + qut: new Date('2016/03/10'), + bat: { + world: { + aaa: new Map([ + [{ foo: /bar/ }, 'sub sub value1'], + ]), + bbb: [1, 2, { prop2:1, prop:2 }, 4, 5] + }, + hello: new Map([ ['hello', 'world'] ]) + } + }; + + assertNotEqual(foo, bar) + }); + + describe("performance", function () { + const limit = 1e6; + this.timeout(20000); + + function check(a: any, bEqual: any, bNotEqual: any) { + for (let i = 0; i < limit; ++i) { + assert.strictEqual(equal(a, bEqual), true); + assert.strictEqual(equal(bEqual, a), true); + assert.strictEqual(equal(a, bNotEqual), false); + assert.strictEqual(equal(bNotEqual, a), false); + } + } + + it("should be fast for arrays", function () { + const a = [1, 2, 3]; + check(a, a.slice(0), [1, 2, 4]); + }); + + it("should be fast for objects", function () { + const a = { a: 1, b: 2, c: 3 }; + check(a, { ...a }, { a: 1, b: 3 }); + }); + + it("should be fast for strings", function () { + check('foo', new String('foo'), 'bar'); + }); + + it("should be fast for functions", function () { + check(() => 123, () => 123, () => 321); + }); + }); +}); diff --git a/graphql-subscription/node_modules/@wry/trie/README.md b/graphql-subscription/node_modules/@wry/trie/README.md new file mode 100644 index 0000000..c838b3f --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/README.md @@ -0,0 +1,4 @@ +# @wry/trie + +A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +object keys weakly, yet can also hold non-object keys, unlike `WeakMap`. diff --git a/graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs b/graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs new file mode 100644 index 0000000..7863ba6 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs @@ -0,0 +1,89 @@ +'use strict'; + +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +var defaultMakeData = function () { return Object.create(null); }; +// Useful for processing arguments objects as well as arrays. +var _a = Array.prototype, forEach = _a.forEach, slice = _a.slice; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var Trie = /** @class */ (function () { + function Trie(weakness, makeData) { + if (weakness === void 0) { weakness = true; } + if (makeData === void 0) { makeData = defaultMakeData; } + this.weakness = weakness; + this.makeData = makeData; + } + Trie.prototype.lookup = function () { + return this.lookupArray(arguments); + }; + Trie.prototype.lookupArray = function (array) { + var node = this; + forEach.call(array, function (key) { return node = node.getChildTrie(key); }); + return hasOwnProperty.call(node, "data") + ? node.data + : node.data = this.makeData(slice.call(array)); + }; + Trie.prototype.peek = function () { + return this.peekArray(arguments); + }; + Trie.prototype.peekArray = function (array) { + var node = this; + for (var i = 0, len = array.length; node && i < len; ++i) { + var map = node.mapFor(array[i], false); + node = map && map.get(array[i]); + } + return node && node.data; + }; + Trie.prototype.remove = function () { + return this.removeArray(arguments); + }; + Trie.prototype.removeArray = function (array) { + var data; + if (array.length) { + var head = array[0]; + var map = this.mapFor(head, false); + var child = map && map.get(head); + if (child) { + data = child.removeArray(slice.call(array, 1)); + if (!child.data && !child.weak && !(child.strong && child.strong.size)) { + map.delete(head); + } + } + } + else { + data = this.data; + delete this.data; + } + return data; + }; + Trie.prototype.getChildTrie = function (key) { + var map = this.mapFor(key, true); + var child = map.get(key); + if (!child) + map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + }; + Trie.prototype.mapFor = function (key, create) { + return this.weakness && isObjRef(key) + ? this.weak || (create ? this.weak = new WeakMap : void 0) + : this.strong || (create ? this.strong = new Map : void 0); + }; + return Trie; +}()); +function isObjRef(value) { + switch (typeof value) { + case "object": + if (value === null) + break; + // Fall through to return true... + case "function": + return true; + } + return false; +} + +exports.Trie = Trie; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs.map b/graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs.map new file mode 100644 index 0000000..e9d92e9 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.cjs","sources":["es5/index.js"],"sourcesContent":["// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds\n// object keys weakly, yet can also hold non-object keys, unlike the\n// native `WeakMap`.\n// If no makeData function is supplied, the looked-up data will be an empty,\n// null-prototype Object.\nvar defaultMakeData = function () { return Object.create(null); };\n// Useful for processing arguments objects as well as arrays.\nvar _a = Array.prototype, forEach = _a.forEach, slice = _a.slice;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar Trie = /** @class */ (function () {\n function Trie(weakness, makeData) {\n if (weakness === void 0) { weakness = true; }\n if (makeData === void 0) { makeData = defaultMakeData; }\n this.weakness = weakness;\n this.makeData = makeData;\n }\n Trie.prototype.lookup = function () {\n return this.lookupArray(arguments);\n };\n Trie.prototype.lookupArray = function (array) {\n var node = this;\n forEach.call(array, function (key) { return node = node.getChildTrie(key); });\n return hasOwnProperty.call(node, \"data\")\n ? node.data\n : node.data = this.makeData(slice.call(array));\n };\n Trie.prototype.peek = function () {\n return this.peekArray(arguments);\n };\n Trie.prototype.peekArray = function (array) {\n var node = this;\n for (var i = 0, len = array.length; node && i < len; ++i) {\n var map = node.mapFor(array[i], false);\n node = map && map.get(array[i]);\n }\n return node && node.data;\n };\n Trie.prototype.remove = function () {\n return this.removeArray(arguments);\n };\n Trie.prototype.removeArray = function (array) {\n var data;\n if (array.length) {\n var head = array[0];\n var map = this.mapFor(head, false);\n var child = map && map.get(head);\n if (child) {\n data = child.removeArray(slice.call(array, 1));\n if (!child.data && !child.weak && !(child.strong && child.strong.size)) {\n map.delete(head);\n }\n }\n }\n else {\n data = this.data;\n delete this.data;\n }\n return data;\n };\n Trie.prototype.getChildTrie = function (key) {\n var map = this.mapFor(key, true);\n var child = map.get(key);\n if (!child)\n map.set(key, child = new Trie(this.weakness, this.makeData));\n return child;\n };\n Trie.prototype.mapFor = function (key, create) {\n return this.weakness && isObjRef(key)\n ? this.weak || (create ? this.weak = new WeakMap : void 0)\n : this.strong || (create ? this.strong = new Map : void 0);\n };\n return Trie;\n}());\nexport { Trie };\nfunction isObjRef(value) {\n switch (typeof value) {\n case \"object\":\n if (value === null)\n break;\n // Fall through to return true...\n case \"function\":\n return true;\n }\n return false;\n}\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,IAAI,eAAe,GAAG,YAAY,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;AAClE;AACA,IAAI,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;AACjE,IAAI,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AAClD,IAAC,IAAI,kBAAkB,YAAY;AACtC,IAAI,SAAS,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE;AACtC,QAAQ,IAAI,QAAQ,KAAK,KAAK,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAC,EAAE;AACrD,QAAQ,IAAI,QAAQ,KAAK,KAAK,CAAC,EAAE,EAAE,QAAQ,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ql-subscription/node_modules/@wry/trie/lib/bundle.cjs.native.js new file mode 100644 index 0000000..7863ba6 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/lib/bundle.cjs.native.js @@ -0,0 +1,89 @@ +'use strict'; + +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +var defaultMakeData = function () { return Object.create(null); }; +// Useful for processing arguments objects as well as arrays. +var _a = Array.prototype, forEach = _a.forEach, slice = _a.slice; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var Trie = /** @class */ (function () { + function Trie(weakness, makeData) { + if (weakness === void 0) { weakness = true; } + if (makeData === void 0) { makeData = defaultMakeData; } + this.weakness = weakness; + this.makeData = makeData; + } + Trie.prototype.lookup = function () { + return this.lookupArray(arguments); + }; + Trie.prototype.lookupArray = function (array) { + var node = this; + forEach.call(array, function (key) { return node = node.getChildTrie(key); }); + return hasOwnProperty.call(node, "data") + ? node.data + : node.data = this.makeData(slice.call(array)); + }; + Trie.prototype.peek = function () { + return this.peekArray(arguments); + }; + Trie.prototype.peekArray = function (array) { + var node = this; + for (var i = 0, len = array.length; node && i < len; ++i) { + var map = node.mapFor(array[i], false); + node = map && map.get(array[i]); + } + return node && node.data; + }; + Trie.prototype.remove = function () { + return this.removeArray(arguments); + }; + Trie.prototype.removeArray = function (array) { + var data; + if (array.length) { + var head = array[0]; + var map = this.mapFor(head, false); + var child = map && map.get(head); + if (child) { + data = child.removeArray(slice.call(array, 1)); + if (!child.data && !child.weak && !(child.strong && child.strong.size)) { + map.delete(head); + } + } + } + else { + data = this.data; + delete this.data; + } + return data; + }; + Trie.prototype.getChildTrie = function (key) { + var map = this.mapFor(key, true); + var child = map.get(key); + if (!child) + map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + }; + Trie.prototype.mapFor = function (key, create) { + return this.weakness && isObjRef(key) + ? this.weak || (create ? this.weak = new WeakMap : void 0) + : this.strong || (create ? this.strong = new Map : void 0); + }; + return Trie; +}()); +function isObjRef(value) { + switch (typeof value) { + case "object": + if (value === null) + break; + // Fall through to return true... + case "function": + return true; + } + return false; +} + +exports.Trie = Trie; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/@wry/trie/lib/index.d.ts b/graphql-subscription/node_modules/@wry/trie/lib/index.d.ts new file mode 100644 index 0000000..ded3180 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/lib/index.d.ts @@ -0,0 +1,16 @@ +export declare class Trie { + private weakness; + private makeData; + private weak?; + private strong?; + private data?; + constructor(weakness?: boolean, makeData?: (array: any[]) => Data); + lookup(...array: T): Data; + lookupArray(array: T): Data; + peek(...array: T): Data | undefined; + peekArray(array: T): Data | undefined; + remove(...array: any[]): Data | undefined; + removeArray(array: T): Data | undefined; + private getChildTrie; + private mapFor; +} diff --git a/graphql-subscription/node_modules/@wry/trie/lib/index.js b/graphql-subscription/node_modules/@wry/trie/lib/index.js new file mode 100644 index 0000000..6d8db27 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/lib/index.js @@ -0,0 +1,82 @@ +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +const defaultMakeData = () => Object.create(null); +// Useful for processing arguments objects as well as arrays. +const { forEach, slice } = Array.prototype; +const { hasOwnProperty } = Object.prototype; +export class Trie { + constructor(weakness = true, makeData = defaultMakeData) { + this.weakness = weakness; + this.makeData = makeData; + } + lookup() { + return this.lookupArray(arguments); + } + lookupArray(array) { + let node = this; + forEach.call(array, key => node = node.getChildTrie(key)); + return hasOwnProperty.call(node, "data") + ? node.data + : node.data = this.makeData(slice.call(array)); + } + peek() { + return this.peekArray(arguments); + } + peekArray(array) { + let node = this; + for (let i = 0, len = array.length; node && i < len; ++i) { + const map = node.mapFor(array[i], false); + node = map && map.get(array[i]); + } + return node && node.data; + } + remove() { + return this.removeArray(arguments); + } + removeArray(array) { + let data; + if (array.length) { + const head = array[0]; + const map = this.mapFor(head, false); + const child = map && map.get(head); + if (child) { + data = child.removeArray(slice.call(array, 1)); + if (!child.data && !child.weak && !(child.strong && child.strong.size)) { + map.delete(head); + } + } + } + else { + data = this.data; + delete this.data; + } + return data; + } + getChildTrie(key) { + const map = this.mapFor(key, true); + let child = map.get(key); + if (!child) + map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + } + mapFor(key, create) { + return this.weakness && isObjRef(key) + ? this.weak || (create ? this.weak = new WeakMap : void 0) + : this.strong || (create ? this.strong = new Map : void 0); + } +} +function isObjRef(value) { + switch (typeof value) { + case "object": + if (value === null) + break; + // Fall through to return true... + case "function": + return true; + } + return false; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/trie/lib/index.js.map b/graphql-subscription/node_modules/@wry/trie/lib/index.js.map new file mode 100644 index 0000000..d80c2c8 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,oEAAoE;AACpE,oBAAoB;AAEpB,4EAA4E;AAC5E,yBAAyB;AACzB,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAElD,6DAA6D;AAC7D,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;AAC3C,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;AAE5C,MAAM,OAAO,IAAI;IAQf,YACU,WAAW,IAAI,EACf,WAAmC,eAAe;QADlD,aAAQ,GAAR,QAAQ,CAAO;QACf,aAAQ,GAAR,QAAQ,CAA0C;IACzD,CAAC;IAGG,MAAM;QACX,O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AC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,KAAU;IAC1B,QAAQ,OAAO,KAAK,EAAE;QACtB,KAAK,QAAQ;YACX,IAAI,KAAK,KAAK,IAAI;gBAAE,MAAM;QAC1B,iCAAiC;QACnC,KAAK,UAAU;YACb,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/@wry/trie/package.json b/graphql-subscription/node_modules/@wry/trie/package.json new file mode 100644 index 0000000..f618d1c --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/package.json @@ -0,0 +1,45 @@ +{ + "name": "@wry/trie", + "version": "0.5.0", + "author": "Ben Newman ", + "description": "https://en.wikipedia.org/wiki/Trie", + "license": "MIT", + "type": "module", + "main": "lib/bundle.cjs", + "module": "lib/index.js", + "types": "lib/index.d.ts", + "keywords": [ + "trie", + "prefix", + "weak", + "dictionary", + "lexicon" + ], + "homepage": "https://github.com/benjamn/wryware", + "repository": { + "type": "git", + "url": "git+https://github.com/benjamn/wryware.git" + }, + "bugs": { + "url": "https://github.com/benjamn/wryware/issues" + }, + "scripts": { + "build": "npm run clean:before && npm run tsc && npm run rollup && npm run clean:after", + "clean:before": "rimraf lib", + "tsc": "npm run tsc:es5 && npm run tsc:esm", + "tsc:es5": "tsc -p tsconfig.es5.json", + "tsc:esm": "tsc -p tsconfig.json", + "rollup": "rollup -c rollup.config.js", + "clean:after": "rimraf lib/es5", + "prepare": "npm run build", + "test:cjs": "../../shared/test.sh lib/tests/bundle.cjs", + "test:esm": "../../shared/test.sh lib/tests/bundle.js", + "test": "npm run test:esm && npm run test:cjs" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } +} diff --git a/graphql-subscription/node_modules/@wry/trie/rollup.config.js b/graphql-subscription/node_modules/@wry/trie/rollup.config.js new file mode 100644 index 0000000..ef8e33b --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/rollup.config.js @@ -0,0 +1 @@ +export { default } from "../../shared/rollup.config.js"; diff --git a/graphql-subscription/node_modules/@wry/trie/src/index.ts b/graphql-subscription/node_modules/@wry/trie/src/index.ts new file mode 100644 index 0000000..2f47012 --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/src/index.ts @@ -0,0 +1,104 @@ +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. + +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +const defaultMakeData = () => Object.create(null); + +// Useful for processing arguments objects as well as arrays. +const { forEach, slice } = Array.prototype; +const { hasOwnProperty } = Object.prototype; + +export class Trie { + // Since a `WeakMap` cannot hold primitive values as keys, we need a + // backup `Map` instance to hold primitive keys. Both `this._weakMap` + // and `this._strongMap` are lazily initialized. + private weak?: WeakMap>; + private strong?: Map>; + private data?: Data; + + constructor( + private weakness = true, + private makeData: (array: any[]) => Data = defaultMakeData, + ) {} + + public lookup(...array: T): Data; + public lookup(): Data { + return this.lookupArray(arguments); + } + + public lookupArray(array: T): Data { + let node: Trie = this; + forEach.call(array, key => node = node.getChildTrie(key)); + return hasOwnProperty.call(node, "data") + ? node.data as Data + : node.data = this.makeData(slice.call(array)); + } + + public peek(...array: T): Data | undefined; + public peek(): Data | undefined { + return this.peekArray(arguments); + } + + public peekArray(array: T): Data | undefined { + let node: Trie | undefined = this; + + for (let i = 0, len = array.length; node && i < len; ++i) { + const map = node.mapFor(array[i], false); + node = map && map.get(array[i]); + } + + return node && node.data; + } + + public remove(...array: any[]): Data | undefined; + public remove(): Data | undefined { + return this.removeArray(arguments); + } + + public removeArray(array: T): Data | undefined { + let data: Data | undefined; + + if (array.length) { + const head = array[0]; + const map = this.mapFor(head, false); + const child = map && map.get(head); + if (child) { + data = child.removeArray(slice.call(array, 1)); + if (!child.data && !child.weak && !(child.strong && child.strong.size)) { + map.delete(head); + } + } + } else { + data = this.data; + delete this.data; + } + + return data; + } + + private getChildTrie(key: any) { + const map = this.mapFor(key, true)!; + let child = map.get(key); + if (!child) map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + } + + private mapFor(key: any, create: boolean): Trie["weak" | "strong"] | undefined { + return this.weakness && isObjRef(key) + ? this.weak || (create ? this.weak = new WeakMap : void 0) + : this.strong || (create ? this.strong = new Map : void 0); + } +} + +function isObjRef(value: any) { + switch (typeof value) { + case "object": + if (value === null) break; + // Fall through to return true... + case "function": + return true; + } + return false; +} diff --git a/graphql-subscription/node_modules/@wry/trie/src/tests/main.ts b/graphql-subscription/node_modules/@wry/trie/src/tests/main.ts new file mode 100644 index 0000000..4707fce --- /dev/null +++ b/graphql-subscription/node_modules/@wry/trie/src/tests/main.ts @@ -0,0 +1,207 @@ +import * as assert from "assert"; +import { Trie } from "../index.js"; + +describe("Trie", function () { + it("can be imported", function () { + assert.strictEqual(typeof Trie, "function"); + }); + + it("can hold objects weakly", function () { + const trie = new Trie(true); + assert.strictEqual((trie as any).weakness, true); + const obj1 = {}; + assert.strictEqual( + trie.lookup(obj1, 2, 3), + trie.lookup(obj1, 2, 3), + ); + const obj2 = {}; + assert.notStrictEqual( + trie.lookup(1, obj2), + trie.lookup(1, obj2, 3), + ); + assert.strictEqual((trie as any).weak.has(obj1), true); + assert.strictEqual((trie as any).strong.has(obj1), false); + assert.strictEqual((trie as any).strong.get(1).weak.has(obj2), true); + assert.strictEqual((trie as any).strong.get(1).weak.get(obj2).strong.has(3), true); + }); + + it("can disable WeakMap", function () { + const trie = new Trie(false); + assert.strictEqual((trie as any).weakness, false); + const obj1 = {}; + assert.strictEqual( + trie.lookup(obj1, 2, 3), + trie.lookup(obj1, 2, 3), + ); + const obj2 = {}; + assert.notStrictEqual( + trie.lookup(1, obj2), + trie.lookup(1, obj2, 3), + ); + assert.strictEqual(typeof (trie as any).weak, "undefined"); + assert.strictEqual((trie as any).strong.has(obj1), true); + assert.strictEqual((trie as any).strong.has(1), true); + assert.strictEqual((trie as any).strong.get(1).strong.has(obj2), true); + assert.strictEqual((trie as any).strong.get(1).strong.get(obj2).strong.has(3), true); + }); + + it("can produce data types other than Object", function () { + const symbolTrie = new Trie(true, args => Symbol.for(args.join("."))); + const s123 = symbolTrie.lookup(1, 2, 3); + assert.strictEqual(s123.toString(), "Symbol(1.2.3)"); + assert.strictEqual(s123, symbolTrie.lookup(1, 2, 3)); + assert.strictEqual(s123, symbolTrie.lookupArray([1, 2, 3])); + const sNull = symbolTrie.lookup(); + assert.strictEqual(sNull.toString(), "Symbol()"); + + const regExpTrie = new Trie(true, args => new RegExp("^(" + args.join("|") + ")$")); + const rXYZ = regExpTrie.lookup("x", "y", "z"); + assert.strictEqual(rXYZ.test("w"), false); + assert.strictEqual(rXYZ.test("x"), true); + assert.strictEqual(rXYZ.test("y"), true); + assert.strictEqual(rXYZ.test("z"), true); + assert.strictEqual(String(rXYZ), "/^(x|y|z)$/"); + + class Data { + constructor(public readonly args: any[]) {} + } + const dataTrie = new Trie(true, args => new Data(args)); + function checkData(...args: any[]) { + const data = dataTrie.lookupArray(args); + assert.strictEqual(data instanceof Data, true); + assert.notStrictEqual(data.args, args); + assert.deepStrictEqual(data.args, args); + assert.strictEqual(data, dataTrie.lookup(...args)); + assert.strictEqual(data, dataTrie.lookupArray(arguments)); + return data; + } + const datas = [ + checkData(), + checkData(1), + checkData(1, 2), + checkData(2), + checkData(2, 3), + checkData(true, "a"), + checkData(/asdf/i, "b", function oyez() {}), + ]; + // Verify that all Data objects are distinct. + assert.strictEqual(new Set(datas).size, datas.length); + }); + + it("can peek at values", function () { + const trie = new Trie(true, (args) => args); + + const obj = {}; + assert.strictEqual(trie.peek(1, 2, 'x'), undefined); + assert.strictEqual(trie.peek(1, 2, obj), undefined); + assert.strictEqual(trie.peekArray([1, 2, 'x']), undefined); + assert.strictEqual(trie.peekArray([1, 2, obj]), undefined); + // peek/peekArray should not create anything on its own + assert.strictEqual(trie['weak'], undefined); + assert.strictEqual(trie['strong'], undefined); + assert.strictEqual(trie['data'], undefined); + + const data1 = trie.lookup(1, 2, 'x'); + const data2 = trie.lookup(1, 2, obj); + + assert.strictEqual(trie.peek(1, 2, 'x'), data1); + assert.strictEqual(trie.peek(1, 2, obj), data2); + assert.strictEqual(trie.peekArray([1, 2, 'x']), data1); + assert.strictEqual(trie.peekArray([1, 2, obj]), data2); + }); + + describe("can remove values", function () { + it("will remove values", () => { + const trie = new Trie(true, (args) => args); + + trie.lookup(1, 2, "x"); + trie.remove(1, 2, "x"); + assert.strictEqual(trie.peek(1, 2, "x"), undefined); + }); + + it("removing will return the value", () => { + const trie = new Trie(true, (args) => args); + + const data = trie.lookup(1, 2, "x"); + assert.strictEqual(trie.remove(1, 2, "x"), data); + }); + + it("will remove empty parent nodes", () => { + const trie = new Trie(true, (args) => args); + + const data = trie.lookup(1, 2, "x"); + assert.strictEqual(trie.peek(1, 2, "x"), data); + assert.equal(pathExistsInTrie(trie, 1, 2, "x"), true); + assert.strictEqual(trie.remove(1, 2, "x"), data); + assert.equal(pathExistsInTrie(trie, 1), false); + }); + + it("will not remove parent nodes with other children", () => { + const trie = new Trie(true, (args) => args); + + trie.lookup(1, 2, "x"); + const data = trie.lookup(1, 2); + trie.remove(1, 2, "x"); + assert.strictEqual(trie.peek(1, 2, "x"), undefined); + assert.strictEqual(trie.peek(1, 2), data); + }); + + it("will remove data, not the full node, if a node still has children", () => { + const trie = new Trie(true, (args) => args); + + trie.lookup(1, 2); + const data = trie.lookup(1, 2, "x"); + trie.remove(1, 2); + assert.strictEqual(trie.peek(1, 2), undefined); + assert.strictEqual(trie.peek(1, 2, "x"), data); + }); + + it("will remove direct children", () => { + const trie = new Trie(true, (args) => args); + + trie.lookup(1); + trie.remove(1); + assert.strictEqual(trie.peek(1), undefined); + }); + + it("will remove nodes from WeakMaps", () => { + const trie = new Trie(true, (args) => args); + const obj = {}; + const data = trie.lookup(1, obj, "x"); + assert.equal(pathExistsInTrie(trie, 1), true); + assert.strictEqual(trie.remove(1, obj, "x"), data); + assert.strictEqual(trie.peek(1, obj, "x"), undefined); + assert.equal(pathExistsInTrie(trie, 1, obj), false); + }); + + it("will not remove nodes if they contain an (even empty) WeakMap", () => { + const trie = new Trie(true, (args) => args); + const obj = {}; + + const data = trie.lookup(1, 2, "x"); + trie.lookup(1, obj); + trie.remove(1, obj); + + assert.strictEqual(trie.peek(1, 2, "x"), data); + assert.equal(pathExistsInTrie(trie, 1), true); + assert.equal(pathExistsInTrie(trie, 1, 2), true); + assert.strictEqual(trie.remove(1, 2, "x"), data); + assert.equal(pathExistsInTrie(trie, 1), true); + assert.equal(pathExistsInTrie(trie, 1, 2), false); + }); + }); + + function pathExistsInTrie(trie: Trie, ...path: any[]) { + return ( + path.reduce((node: Trie | undefined, key: any) => { + const map: Trie["weak" | "strong"] = + // not the full implementation but enough for a test + trie["weakness"] && typeof key === "object" + ? node?.["weak"] + : node?.["strong"]; + + return map?.get(key); + }, trie) !== undefined + ); + } +}); diff --git a/graphql-subscription/node_modules/graphql-tag/CHANGELOG.md b/graphql-subscription/node_modules/graphql-tag/CHANGELOG.md new file mode 100644 index 0000000..38eb0a3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/CHANGELOG.md @@ -0,0 +1,236 @@ +# Change log + +### v2.12.6 + +* Update peer dependencies to allow `graphql` ^16.0.0.
    + [@brainkim](https://github.com/brainkim) in [#530](https://github.com/apollographql/graphql-tag/pull/530) + +### v2.12.5 + +* Also publish `src/` directory to npm, enabling source maps.
    + [@maclockard](https://github.com/maclockard) in [#403](https://github.com/apollographql/graphql-tag/pull/403) + +### v2.12.4 (2021-04-29) + +* Allow fragments to be imported by name when using the webpack loader.
    + [@dobesv](https://github.com/dobesv) in [#257](https://github.com/apollographql/graphql-tag/pull/257) + +### v2.12.3 + +* Update `tslib` dependency to version 2.1.0.
    + [@benjamn](http://github.com/benjamn) in [#381](https://github.com/apollographql/graphql-tag/pull/381) + +### v2.12.2 + +* Avoid using `Object.assign` to attach extra properties to `gql`.
    + [@benjamn](http://github.com/benjamn) in [#380](https://github.com/apollographql/graphql-tag/pull/380) + +### v2.12.1 + +* To accommodate older versions of TypeScript, usage of the `import type ...` syntax (introduced by [#325](https://github.com/apollographql/graphql-tag/pull/325)) has been removed, fixing issue [#345](https://github.com/apollographql/graphql-tag/issues/345).
    + [@benjamn](http://github.com/benjamn) in [#352](https://github.com/apollographql/graphql-tag/pull/352) + +### v2.12.0 + +* The `graphql-tag` repository has been converted to TypeScript, adding type safety and enabling both ECMAScript and CommonJS module exports. While these changes are intended to be as backwards-compatible as possible, we decided to bump the minor version to reflect the significant refactoring.
    + [@PowerKiKi](http://github.com/PowerKiKi) and [@benjamn](http://github.com/benjamn) in [#325](https://github.com/apollographql/graphql-tag/pull/325) + +### v2.11.0 (2020-07-28) + +* `package.json` `sideEffects` changes to clearly identify that `graphql-tag` doesn't have side effects.
    + [@hwillson](http://github.com/hwillson) in [#313](https://github.com/apollographql/graphql-tag/pull/313) + +### v2.10.4 (2020-07-08) + +* Bump dev/peer deps to accommodate `graphql` 15.
    + [@adriencohen](https://github.com/adriencohen) in [#299](https://github.com/apollographql/graphql-tag/pull/299) + +### v2.10.3 (2020-02-05) + +* Further adjustments to the TS `index.d.ts` declaration file.
    + [@Guillaumez](https://github.com/Guillaumez) in [#289](https://github.com/apollographql/graphql-tag/pull/289) + +### v2.10.2 (2020-02-04) + +* Update/fix the existing TS `index.d.ts` declaration file.
    + [@hwillson](https://github.com/hwillson) in [#285](https://github.com/apollographql/graphql-tag/pull/285) + +### v2.10.1 + +* Fix failures in IE11 by avoiding unsupported (by IE11) constructor arguments to `Set` by [rocwang](https://github.com/rocwang) in [#190](https://github.com/apollographql/graphql-tag/pull/190) + +### v2.10.0 +* Add support for `graphql@14` by [timsuchanek](https://github.com/timsuchanek) in [#210](https://github.com/apollographql/graphql-tag/pull/210), [#211](https://github.com/apollographql/graphql-tag/pull/211) + +### v2.9.1 +* Fix IE11 support by using a regular for-loop by [vitorbal](https://github.com/vitorbal) in [#176](https://github.com/apollographql/graphql-tag/pull/176) + +### v2.9.0 +* Remove duplicate exports in named exports by [wacii](https://github.com/wacii) in [#170](https://github.com/apollographql/graphql-tag/pull/170) +* Add `experimentalFragmentVariables` compatibility by [lucasconstantino](https://github.com/lucasconstantino) in [#167](https://github.com/apollographql/graphql-tag/pull/167/) + +### v2.8.0 + +* Update `graphql` to ^0.13, support testing all compatible versions [jnwng](https://github.com/jnwng) in + [PR #156](https://github.com/apollographql/graphql-tag/pull/156) +* Export single queries as both default and named [stonexer](https://github.com/stonexer) in + [PR #154](https://github.com/apollographql/graphql-tag/pull/154) + +### v2.7.{0,1,2,3} + +* Merge and then revert [PR #141](https://github.com/apollographql/graphql-tag/pull/141) due to errors being thrown + +### v2.6.1 + +* Accept `graphql@^0.12.0` as peerDependency [jnwng](https://github.com/jnwng) + addressing [#134](https://github.com/apollographql/graphql-tag/issues/134) + +### v2.6.0 + +* Support multiple query definitions when using Webpack loader [jfaust](https://github.com/jfaust) in + [PR #122](https://github.com/apollographql/graphql-tag/pull/122) + +### v2.5.0 + +* Update graphql to ^0.11.0, add graphql@^0.11.0 to peerDependencies [pleunv](https://github.com/pleunv) in + [PR #124](https://github.com/apollographql/graphql-tag/pull/124) + +### v2.4.{1,2} + +* Temporarily reverting [PR #99](https://github.com/apollographql/graphql-tag/pull/99) to investigate issues with + bundling + +### v2.4.0 + +* Add support for descriptors [jamiter](https://github.com/jamiter) in + [PR #99](https://github.com/apollographql/graphql-tag/pull/99) + +### v2.3.0 + +* Add flow support [michalkvasnicak](https://github.com/michalkvasnicak) in + [PR #98](https://github.com/apollographql/graphql-tag/pull/98) + +### v2.2.2 + +* Make parsing line endings kind agnostic [vlasenko](https://github.com/vlasenko) in + [PR #95](https://github.com/apollographql/graphql-tag/pull/95) + +### v2.2.1 + +* Fix #61: split('/n') does not work on Windows [dnalborczyk](https://github.com/dnalborczyk) in + [PR #89](https://github.com/apollographql/graphql-tag/pull/89) + +### v2.2.0 + +* Bumping `graphql` peer dependency to ^0.10.0 [dotansimha](https://github.com/dotansimha) in + [PR #85](https://github.com/apollographql/graphql-tag/pull/85) + +### v2.1.0 + +* Add support for calling `gql` as a function [matthewerwin](https://github.com/matthewerwin) in + [PR #66](https://github.com/apollographql/graphql-tag/pull/66) +* Including yarn.lock file [PowerKiKi](https://github.com/PowerKiKi) in + [PR #72](https://github.com/apollographql/graphql-tag/pull/72) +* Ignore duplicate fragments when using the Webpack loader [czert](https://github.com/czert) in + [PR #52](https://github.com/apollographql/graphql-tag/pull/52) +* Fixing `graphql-tag/loader` by properly stringifying GraphQL Source [jnwng](https://github.com/jnwng) in + [PR #65](https://github.com/apollographql/graphql-tag/pull/65) + +### v2.0.0 + +Restore dependence on `graphql` module [abhiaiyer91](https://github.com/abhiaiyer91) in +[PR #46](https://github.com/apollographql/graphql-tag/pull/46) addressing +[#6](https://github.com/apollographql/graphql-tag/issues/6) + +* Added `graphql` as a + [peerDependency](https://github.com/apollographql/graphql-tag/commit/ac061dd16440e75c166c85b4bff5ba06c79c9356) + +### v1.3.2 + +* Add typescript definitions for the bundledPrinter [PR #63](https://github.com/apollographql/graphql-tag/pull/63) + +### v1.3.1 + +* Making sure not to log deprecation warnings for internal use of deprecated module [jnwng](https://github.com/jnwng) + addressing [#54](https://github.com/apollographql/graphql-tag/issues/54#issuecomment-283301475) + +### v1.3.0 + +* Bump bundled `graphql` packages to v0.9.1 [jnwng](https://github.com/jnwng) in + [PR #55](https://github.com/apollographql/graphql-tag/pull/55). +* Deprecate the `graphql/language/parser` and `graphql/language/printer` exports [jnwng](https://github.com/jnwng) in + [PR #55](https://github.com/apollographql/graphql-tag/pull/55) + +### v1.2.4 + +Restore Node < 6 compatibility. [DragosRotaru](https://github.com/DragosRotaru) in +[PR #41](https://github.com/apollographql/graphql-tag/pull/41) addressing +[#39](https://github.com/apollographql/graphql-tag/issues/39) + +### v1.2.1 + +Fixed an issue with fragment imports. [PR #35](https://github.com/apollostack/graphql-tag/issues/35). + +### v1.2.0 + +Added ability to import other GraphQL documents with fragments using `#import` comments. +[PR #33](https://github.com/apollostack/graphql-tag/pull/33) + +### v1.1.2 + +Fix issue with interpolating undefined values [Issue #19](https://github.com/apollostack/graphql-tag/issues/19) + +### v1.1.1 + +Added typescript definitions for the below. + +### v1.1.0 + +We now emit warnings if you use the same name for two different fragments. + +You can disable this with: + +```js +import { disableFragmentWarnings } from 'graphql-tag'; + +disableFragmentWarnings(); +``` + +### v1.0.0 + +Releasing 0.1.17 as 1.0.0 in order to be explicit about Semantic Versioning. + +### v0.1.17 + +* Allow embedding fragments inside document strings, as in + +```js +import gql from 'graphql-tag'; + +const fragment = gql` + fragment Foo on Bar { + field + } +`; + +const query = gql` +{ + ...Foo +} +${Foo} +`; +``` + +See also http://dev.apollodata.com/react/fragments.html + +### v0.1.16 + +* Add caching to Webpack loader. [PR #16](https://github.com/apollostack/graphql-tag/pull/16) + +### v0.1.15 + +* Add Webpack loader to `graphql-tag/loader`. + +### v0.1.14 + +Changes were not tracked before this version. diff --git a/graphql-subscription/node_modules/graphql-tag/LICENSE b/graphql-subscription/node_modules/graphql-tag/LICENSE new file mode 100644 index 0000000..35bf148 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/graphql-tag/README.md b/graphql-subscription/node_modules/graphql-tag/README.md new file mode 100644 index 0000000..2d1979c --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/README.md @@ -0,0 +1,251 @@ +# graphql-tag +[![npm version](https://badge.fury.io/js/graphql-tag.svg)](https://badge.fury.io/js/graphql-tag) +[![Build Status](https://travis-ci.org/apollographql/graphql-tag.svg?branch=master)](https://travis-ci.org/apollographql/graphql-tag) +[![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](http://www.apollodata.com/#slack) + +Helpful utilities for parsing GraphQL queries. Includes: + +- `gql` A JavaScript template literal tag that parses GraphQL query strings into the standard GraphQL AST. +- `/loader` A webpack loader to preprocess queries + +`graphql-tag` uses [the reference `graphql` library](https://github.com/graphql/graphql-js) under the hood as a peer dependency, so in addition to installing this module, you'll also have to install `graphql`. + +### gql + +The `gql` template literal tag can be used to concisely write a GraphQL query that is parsed into a standard GraphQL AST. It is the recommended method for passing queries to [Apollo Client](https://github.com/apollographql/apollo-client). While it is primarily built for Apollo Client, it generates a generic GraphQL AST which can be used by any GraphQL client. + +```js +import gql from 'graphql-tag'; + +const query = gql` + { + user(id: 5) { + firstName + lastName + } + } +` +``` + +The above query now contains the following syntax tree. + +```js +{ + "kind": "Document", + "definitions": [ + { + "kind": "OperationDefinition", + "operation": "query", + "name": null, + "variableDefinitions": null, + "directives": [], + "selectionSet": { + "kind": "SelectionSet", + "selections": [ + { + "kind": "Field", + "alias": null, + "name": { + "kind": "Name", + "value": "user", + ... + } + } + ] + } + } + ] +} +``` + +#### Fragments + +The `gql` tag can also be used to define reusable fragments, which can easily be added to queries or other fragments. + +```js +import gql from 'graphql-tag'; + +const userFragment = gql` + fragment User_user on User { + firstName + lastName + } +` +``` + +The above `userFragment` document can be embedded in another document using a template literal placeholder. + +```js +const query = gql` + { + user(id: 5) { + ...User_user + } + } + ${userFragment} +` +``` + +**Note:** _While it may seem redundant to have to both embed the `userFragment` variable in the template literal **AND** spread the `...User_user` fragment in the graphQL selection set, this requirement makes static analysis by tools such as `eslint-plugin-graphql` possible._ + +#### Why use this? + +GraphQL strings are the right way to write queries in your code, because they can be statically analyzed using tools like [eslint-plugin-graphql](https://github.com/apollographql/eslint-plugin-graphql). However, strings are inconvenient to manipulate, if you are trying to do things like add extra fields, merge multiple queries together, or other interesting stuff. + +That's where this package comes in - it lets you write your queries with [ES2015 template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) and compile them into an AST with the `gql` tag. + +#### Caching parse results + +This package only has one feature - it caches previous parse results in a simple dictionary. This means that if you call the tag on the same query multiple times, it doesn't waste time parsing it again. It also means you can use `===` to compare queries to check if they are identical. + + +### Importing graphQL files + +_To add support for importing `.graphql`/`.gql` files, see [Webpack loading and preprocessing](#webpack-loading-and-preprocessing) below._ + +Given a file `MyQuery.graphql` + +```graphql +query MyQuery { + ... +} +``` + +If you have configured [the webpack graphql-tag/loader](#webpack-loading-and-preprocessing), you can import modules containing graphQL queries. The imported value will be the pre-built AST. + +```js +import MyQuery from 'query.graphql' +``` + +#### Importing queries by name + +You can also import query and fragment documents by name. + +```graphql +query MyQuery1 { + ... +} + +query MyQuery2 { + ... +} +``` + +And in your JavaScript: + +```javascript +import { MyQuery1, MyQuery2 } from 'query.graphql' +``` + +### Preprocessing queries and fragments + +Preprocessing GraphQL queries and fragments into ASTs at build time can greatly improve load times. + +#### Babel preprocessing + +GraphQL queries can be compiled at build time using [babel-plugin-graphql-tag](https://github.com/gajus/babel-plugin-graphql-tag). Pre-compiling queries decreases script initialization time and reduces bundle sizes by potentially removing the need for `graphql-tag` at runtime. + +#### TypeScript preprocessing + +Try this custom transformer to pre-compile your GraphQL queries in TypeScript: [ts-transform-graphql-tag](https://github.com/firede/ts-transform-graphql-tag). + +#### React Native and Next.js preprocessing + +Preprocessing queries via the webpack loader is not always possible. [babel-plugin-import-graphql](https://www.npmjs.com/package/babel-plugin-import-graphql) supports importing graphql files directly into your JavaScript by preprocessing GraphQL queries into ASTs at compile-time. + +E.g.: + +```javascript +import myImportedQuery from './productsQuery.graphql' + +class ProductsPage extends React.Component { + ... +} +``` + +#### Webpack loading and preprocessing + +Using the included `graphql-tag/loader` it is possible to maintain query logic that is separate from the rest of your application logic. With the loader configured, imported graphQL files will be converted to AST during the webpack build process. + +_**Example webpack configuration**_ + +```js +{ + ... + loaders: [ + { + test: /\.(graphql|gql)$/, + exclude: /node_modules/, + loader: 'graphql-tag/loader' + } + ], + ... +} +``` + +#### Create React App + +Preprocessing GraphQL imports is supported in **create-react-app** >= v2 using [evenchange4/graphql.macro](https://github.com/evenchange4/graphql.macro). + +For **create-react-app** < v2, you'll either need to eject or use [react-app-rewire-inline-import-graphql-ast](https://www.npmjs.com/package/react-app-rewire-inline-import-graphql-ast). + +#### Testing + +Testing environments that don't support Webpack require additional configuration. For [Jest](https://facebook.github.io/jest/) use [jest-transform-graphql](https://github.com/remind101/jest-transform-graphql). + +#### Support for fragments + +With the webpack loader, you can import fragments by name: + +In a file called `query.gql`: + +```graphql +fragment MyFragment1 on MyType1 { + ... +} + +fragment MyFragment2 on MyType2 { + ... +} +``` + +And in your JavaScript: + +```javascript +import { MyFragment1, MyFragment2 } from 'query.gql' +``` + +Note: If your fragment references other fragments, the resulting document will +have multiple fragments in it. In this case you must still specify the fragment name when using the fragment. For example, with `@apollo/client` you would specify the `fragmentName` option when using the fragment for cache operations. + +### Warnings + +This package will emit a warning if you have multiple fragments of the same name. You can disable this with: + +```js +import { disableFragmentWarnings } from 'graphql-tag'; + +disableFragmentWarnings() +``` + +### Experimental Fragment Variables + +This package exports an `experimentalFragmentVariables` flag that allows you to use experimental support for [parameterized fragments](https://github.com/facebook/graphql/issues/204). + +You can enable / disable this with: + +```js +import { enableExperimentalFragmentVariables, disableExperimentalFragmentVariables } from 'graphql-tag'; +``` + +Enabling this feature allows you declare documents of the form + +```graphql +fragment SomeFragment ($arg: String!) on SomeType { + someField +} +``` + +### Resources + +You can easily generate and explore a GraphQL AST on [astexplorer.net](https://astexplorer.net/#/drYr8X1rnP/1). diff --git a/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js b/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js new file mode 100644 index 0000000..e563a66 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js @@ -0,0 +1,136 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('graphql')) : + typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'graphql'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['graphql-tag'] = {}, global.tslib, global.graphql)); +}(this, (function (exports, tslib, graphql) { 'use strict'; + + var docCache = new Map(); + var fragmentSourceMap = new Map(); + var printFragmentWarnings = true; + var experimentalFragmentVariables = false; + function normalize(string) { + return string.replace(/[\s,]+/g, ' ').trim(); + } + function cacheKeyFromLoc(loc) { + return normalize(loc.source.body.substring(loc.start, loc.end)); + } + function processFragments(ast) { + var seenKeys = new Set(); + var definitions = []; + ast.definitions.forEach(function (fragmentDefinition) { + if (fragmentDefinition.kind === 'FragmentDefinition') { + var fragmentName = fragmentDefinition.name.value; + var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); + var sourceKeySet = fragmentSourceMap.get(fragmentName); + if (sourceKeySet && !sourceKeySet.has(sourceKey)) { + if (printFragmentWarnings) { + console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); + } + } + else if (!sourceKeySet) { + fragmentSourceMap.set(fragmentName, sourceKeySet = new Set); + } + sourceKeySet.add(sourceKey); + if (!seenKeys.has(sourceKey)) { + seenKeys.add(sourceKey); + definitions.push(fragmentDefinition); + } + } + else { + definitions.push(fragmentDefinition); + } + }); + return tslib.__assign(tslib.__assign({}, ast), { definitions: definitions }); + } + function stripLoc(doc) { + var workSet = new Set(doc.definitions); + workSet.forEach(function (node) { + if (node.loc) + delete node.loc; + Object.keys(node).forEach(function (key) { + var value = node[key]; + if (value && typeof value === 'object') { + workSet.add(value); + } + }); + }); + var loc = doc.loc; + if (loc) { + delete loc.startToken; + delete loc.endToken; + } + return doc; + } + function parseDocument(source) { + var cacheKey = normalize(source); + if (!docCache.has(cacheKey)) { + var parsed = graphql.parse(source, { + experimentalFragmentVariables: experimentalFragmentVariables, + allowLegacyFragmentVariables: experimentalFragmentVariables + }); + if (!parsed || parsed.kind !== 'Document') { + throw new Error('Not a valid GraphQL document.'); + } + docCache.set(cacheKey, stripLoc(processFragments(parsed))); + } + return docCache.get(cacheKey); + } + function gql(literals) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof literals === 'string') { + literals = [literals]; + } + var result = literals[0]; + args.forEach(function (arg, i) { + if (arg && arg.kind === 'Document') { + result += arg.loc.source.body; + } + else { + result += arg; + } + result += literals[i + 1]; + }); + return parseDocument(result); + } + function resetCaches() { + docCache.clear(); + fragmentSourceMap.clear(); + } + function disableFragmentWarnings() { + printFragmentWarnings = false; + } + function enableExperimentalFragmentVariables() { + experimentalFragmentVariables = true; + } + function disableExperimentalFragmentVariables() { + experimentalFragmentVariables = false; + } + var extras = { + gql: gql, + resetCaches: resetCaches, + disableFragmentWarnings: disableFragmentWarnings, + enableExperimentalFragmentVariables: enableExperimentalFragmentVariables, + disableExperimentalFragmentVariables: disableExperimentalFragmentVariables + }; + (function (gql_1) { + gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables; + })(gql || (gql = {})); + gql["default"] = gql; + var gql$1 = gql; + + exports.default = gql$1; + exports.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables; + exports.disableFragmentWarnings = disableFragmentWarnings; + exports.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables; + exports.gql = gql; + exports.resetCaches = resetCaches; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=graphql-tag.umd.js.map diff --git a/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow b/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow new file mode 100644 index 0000000..7acb623 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.flow @@ -0,0 +1,7 @@ +// @flow + +import type { DocumentNode } from 'graphql'; + +declare export default function gql(literals: any, ...placeholders: any[]): DocumentNode; +declare export function resetCaches(): void; +declare export function disableFragmentWarnings(): void; diff --git a/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.map b/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.map new file mode 100644 index 0000000..6e63171 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/graphql-tag.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"graphql-tag.umd.js","sources":["../src/index.ts"],"sourcesContent":["import { parse } from 'graphql';\n\nimport {\n DocumentNode,\n DefinitionNode,\n Location,\n} from 'graphql/language/ast';\n\n// A map docString -> graphql document\nconst docCache = new Map();\n\n// A map fragmentName -> [normalized source]\nconst fragmentSourceMap = new Map>();\n\nlet printFragmentWarnings = true;\nlet experimentalFragmentVariables = false;\n\n// Strip insignificant whitespace\n// Note that this could do a lot more, such as reorder fields etc.\nfunction normalize(string: string) {\n return string.replace(/[\\s,]+/g, ' ').trim();\n}\n\nfunction cacheKeyFromLoc(loc: Location) {\n return normalize(loc.source.body.substring(loc.start, loc.end));\n}\n\n// Take a unstripped parsed document (query/mutation or even fragment), and\n// check all fragment definitions, checking for name->source uniqueness.\n// We also want to make sure only unique fragments exist in the document.\nfunction processFragments(ast: DocumentNode) {\n const seenKeys = new Set();\n const definitions: DefinitionNode[] = [];\n\n ast.definitions.forEach(fragmentDefinition => {\n if (fragmentDefinition.kind === 'FragmentDefinition') {\n var fragmentName = fragmentDefinition.name.value;\n var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc!);\n\n // We know something about this fragment\n let sourceKeySet = fragmentSourceMap.get(fragmentName)!;\n if (sourceKeySet && !sourceKeySet.has(sourceKey)) {\n // this is a problem because the app developer is trying to register another fragment with\n // the same name as one previously registered. So, we tell them about it.\n if (printFragmentWarnings) {\n console.warn(\"Warning: fragment with name \" + fragmentName + \" already exists.\\n\"\n + \"graphql-tag enforces all fragment names across your application to be unique; read more about\\n\"\n + \"this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names\");\n }\n } else if (!sourceKeySet) {\n fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);\n }\n\n sourceKeySet.add(sourceKey);\n\n if (!seenKeys.has(sourceKey)) {\n seenKeys.add(sourceKey);\n definitions.push(fragmentDefinition);\n }\n } else {\n definitions.push(fragmentDefinition);\n }\n });\n\n return {\n ...ast,\n definitions,\n };\n}\n\nfunction stripLoc(doc: DocumentNode) {\n const workSet = new Set>(doc.definitions);\n\n workSet.forEach(node => {\n if (node.loc) delete node.loc;\n Object.keys(node).forEach(key => {\n const value = node[key];\n if (value && typeof value === 'object') {\n workSet.add(value);\n }\n });\n });\n\n const loc = doc.loc as Record;\n if (loc) {\n delete loc.startToken;\n delete loc.endToken;\n }\n\n return doc;\n}\n\nfunction parseDocument(source: string) {\n var cacheKey = normalize(source);\n if (!docCache.has(cacheKey)) {\n const parsed = parse(source, {\n experimentalFragmentVariables,\n allowLegacyFragmentVariables: experimentalFragmentVariables,\n } as any);\n if (!parsed || parsed.kind !== 'Document') {\n throw new Error('Not a valid GraphQL document.');\n }\n docCache.set(\n cacheKey,\n // check that all \"new\" fragments inside the documents are consistent with\n // existing fragments of the same name\n stripLoc(processFragments(parsed)),\n );\n }\n return docCache.get(cacheKey)!;\n}\n\n// XXX This should eventually disallow arbitrary string interpolation, like Relay does\nexport function gql(\n literals: string | readonly string[],\n ...args: any[]\n) {\n\n if (typeof literals === 'string') {\n literals = [literals];\n }\n\n let result = literals[0];\n\n args.forEach((arg, i) => {\n if (arg && arg.kind === 'Document') {\n result += arg.loc.source.body;\n } else {\n result += arg;\n }\n result += literals[i + 1];\n });\n\n return parseDocument(result);\n}\n\nexport function resetCaches() {\n docCache.clear();\n fragmentSourceMap.clear();\n}\n\nexport function disableFragmentWarnings() {\n printFragmentWarnings = false;\n}\n\nexport function enableExperimentalFragmentVariables() {\n experimentalFragmentVariables = true;\n}\n\nexport function disableExperimentalFragmentVariables() {\n experimentalFragmentVariables = false;\n}\n\nconst extras = {\n gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n};\n\nexport namespace gql {\n export const {\n gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n } = extras;\n}\n\ngql.default = gql;\n\nexport default gql;\n"],"names":["parse"],"mappings":";;;;;;IASA,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IAGjD,IAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEzD,IAAI,qBAAqB,GAAG,IAAI,CAAC;IACjC,IAAI,6BAA6B,GAAG,KAAK,CAAC;IAI1C,SAAS,SAAS,CAAC,MAAc;QAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAA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BAAuB,GAGrB,MAAM,wBAHe,EACvB,yCAAmC,GAEjC,MAAM,oCAF2B,EACnC,0CAAoC,GAClC,MAAM,qCAD4B,CAC3B;IACb,CAAC,EARgB,GAAG,KAAH,GAAG,QAQnB;IAED,GAAG,CAAC,SAAO,CAAA,GAAG,GAAG,CAAC;AAElB,gBAAe,GAAG;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/index.d.ts b/graphql-subscription/node_modules/graphql-tag/lib/index.d.ts new file mode 100644 index 0000000..5164fac --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/index.d.ts @@ -0,0 +1,15 @@ +import { DocumentNode } from 'graphql/language/ast'; +export declare function gql(literals: string | readonly string[], ...args: any[]): DocumentNode; +export declare namespace gql { + var _a: typeof import(".").gql; + export { _a as default }; +} +export declare function resetCaches(): void; +export declare function disableFragmentWarnings(): void; +export declare function enableExperimentalFragmentVariables(): void; +export declare function disableExperimentalFragmentVariables(): void; +export declare namespace gql { + const gql: typeof import(".").gql, resetCaches: typeof import(".").resetCaches, disableFragmentWarnings: typeof import(".").disableFragmentWarnings, enableExperimentalFragmentVariables: typeof import(".").enableExperimentalFragmentVariables, disableExperimentalFragmentVariables: typeof import(".").disableExperimentalFragmentVariables; +} +export default gql; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/index.d.ts.map b/graphql-subscription/node_modules/graphql-tag/lib/index.d.ts.map new file mode 100644 index 0000000..3a0defa --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAGb,MAAM,sBAAsB,CAAC;AA2G9B,wBAAgB,GAAG,CACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EACpC,GAAG,IAAI,EAAE,GAAG,EAAE,gBAmBf;yBArBe,GAAG;;;;AAuBnB,wBAAgB,WAAW,SAG1B;AAED,wBAAgB,uBAAuB,SAEtC;AAED,wBAAgB,mCAAmC,SAElD;AAED,wBAAgB,oCAAoC,SAEnD;AAUD,yBAAiB,GAAG,CAAC;IACZ,MACL,GAAG,0BACH,WAAW,kCACX,uBAAuB,8CACvB,mCAAmC,0DACnC,oCAAoC,yDAC5B,CAAC;CACZ;AAID,eAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/index.js b/graphql-subscription/node_modules/graphql-tag/lib/index.js new file mode 100644 index 0000000..54a1f96 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/index.js @@ -0,0 +1,121 @@ +import { __assign } from "tslib"; +import { parse } from 'graphql'; +var docCache = new Map(); +var fragmentSourceMap = new Map(); +var printFragmentWarnings = true; +var experimentalFragmentVariables = false; +function normalize(string) { + return string.replace(/[\s,]+/g, ' ').trim(); +} +function cacheKeyFromLoc(loc) { + return normalize(loc.source.body.substring(loc.start, loc.end)); +} +function processFragments(ast) { + var seenKeys = new Set(); + var definitions = []; + ast.definitions.forEach(function (fragmentDefinition) { + if (fragmentDefinition.kind === 'FragmentDefinition') { + var fragmentName = fragmentDefinition.name.value; + var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); + var sourceKeySet = fragmentSourceMap.get(fragmentName); + if (sourceKeySet && !sourceKeySet.has(sourceKey)) { + if (printFragmentWarnings) { + console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); + } + } + else if (!sourceKeySet) { + fragmentSourceMap.set(fragmentName, sourceKeySet = new Set); + } + sourceKeySet.add(sourceKey); + if (!seenKeys.has(sourceKey)) { + seenKeys.add(sourceKey); + definitions.push(fragmentDefinition); + } + } + else { + definitions.push(fragmentDefinition); + } + }); + return __assign(__assign({}, ast), { definitions: definitions }); +} +function stripLoc(doc) { + var workSet = new Set(doc.definitions); + workSet.forEach(function (node) { + if (node.loc) + delete node.loc; + Object.keys(node).forEach(function (key) { + var value = node[key]; + if (value && typeof value === 'object') { + workSet.add(value); + } + }); + }); + var loc = doc.loc; + if (loc) { + delete loc.startToken; + delete loc.endToken; + } + return doc; +} +function parseDocument(source) { + var cacheKey = normalize(source); + if (!docCache.has(cacheKey)) { + var parsed = parse(source, { + experimentalFragmentVariables: experimentalFragmentVariables, + allowLegacyFragmentVariables: experimentalFragmentVariables + }); + if (!parsed || parsed.kind !== 'Document') { + throw new Error('Not a valid GraphQL document.'); + } + docCache.set(cacheKey, stripLoc(processFragments(parsed))); + } + return docCache.get(cacheKey); +} +export function gql(literals) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof literals === 'string') { + literals = [literals]; + } + var result = literals[0]; + args.forEach(function (arg, i) { + if (arg && arg.kind === 'Document') { + result += arg.loc.source.body; + } + else { + result += arg; + } + result += literals[i + 1]; + }); + return parseDocument(result); +} +export function resetCaches() { + docCache.clear(); + fragmentSourceMap.clear(); +} +export function disableFragmentWarnings() { + printFragmentWarnings = false; +} +export function enableExperimentalFragmentVariables() { + experimentalFragmentVariables = true; +} +export function disableExperimentalFragmentVariables() { + experimentalFragmentVariables = false; +} +var extras = { + gql: gql, + resetCaches: resetCaches, + disableFragmentWarnings: disableFragmentWarnings, + enableExperimentalFragmentVariables: enableExperimentalFragmentVariables, + disableExperimentalFragmentVariables: disableExperimentalFragmentVariables +}; +(function (gql_1) { + gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables; +})(gql || (gql = {})); +gql["default"] = gql; +export default gql; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/index.js.map b/graphql-subscription/node_modules/graphql-tag/lib/index.js.map new file mode 100644 index 0000000..2d51564 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAShC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;AAGjD,IAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;AAEzD,IAAI,qBAAqB,GAAG,IAAI,CAAC;AACjC,IAAI,6BAA6B,GAAG,KAAK,CAAC;AAI1C,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC;AAKD,SAAS,gBAAgB,CAAC,GAAiB;IACzC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,IAAM,WAAW,GAAqB,EAAE,CAAC;IAEzC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,kBAAkB;QACxC,IAAI,kBAAkB,CAAC,IAAI,KAAK,oBAAoB,EAAE;YACpD,IAAI,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;YACjD,IAAI,SAAS,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAI,CAAC,CAAC;YAGzD,IAAI,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC;YACxD,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SA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OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,qBAAqB,GAAG,KAAK,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,mCAAmC;IACjD,6BAA6B,GAAG,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,oCAAoC;IAClD,6BAA6B,GAAG,KAAK,CAAC;AACxC,CAAC;AAED,IAAM,MAAM,GAAG;IACb,GAAG,KAAA;IACH,WAAW,aAAA;IACX,uBAAuB,yBAAA;IACvB,mCAAmC,qCAAA;IACnC,oCAAoC,sCAAA;CACrC,CAAC;AAEF,WAAiB,KAAG;IAEhB,SAAG,GAKD,MAAM,IALL,EACH,iBAAW,GAIT,MAAM,YAJG,EACX,6BAAuB,GAGrB,MAAM,wBAHe,EACvB,yCAAmC,GAEjC,MAAM,oCAF2B,EACnC,0CAAoC,GAClC,MAAM,qCAD4B,CAC3B;AACb,CAAC,EARgB,GAAG,KAAH,GAAG,QAQnB;AAED,GAAG,CAAC,SAAO,CAAA,GAAG,GAAG,CAAC;AAElB,eAAe,GAAG,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js b/graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js new file mode 100644 index 0000000..9e6d0a4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js @@ -0,0 +1,409 @@ +'use strict'; + +var tslib = require('tslib'); +require('source-map-support/register'); +var chai = require('chai'); +var graphql = require('graphql'); + +var docCache = new Map(); +var fragmentSourceMap = new Map(); +var printFragmentWarnings = true; +var experimentalFragmentVariables = false; +function normalize(string) { + return string.replace(/[\s,]+/g, ' ').trim(); +} +function cacheKeyFromLoc(loc) { + return normalize(loc.source.body.substring(loc.start, loc.end)); +} +function processFragments(ast) { + var seenKeys = new Set(); + var definitions = []; + ast.definitions.forEach(function (fragmentDefinition) { + if (fragmentDefinition.kind === 'FragmentDefinition') { + var fragmentName = fragmentDefinition.name.value; + var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); + var sourceKeySet = fragmentSourceMap.get(fragmentName); + if (sourceKeySet && !sourceKeySet.has(sourceKey)) { + if (printFragmentWarnings) { + console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); + } + } + else if (!sourceKeySet) { + fragmentSourceMap.set(fragmentName, sourceKeySet = new Set); + } + sourceKeySet.add(sourceKey); + if (!seenKeys.has(sourceKey)) { + seenKeys.add(sourceKey); + definitions.push(fragmentDefinition); + } + } + else { + definitions.push(fragmentDefinition); + } + }); + return tslib.__assign(tslib.__assign({}, ast), { definitions: definitions }); +} +function stripLoc(doc) { + var workSet = new Set(doc.definitions); + workSet.forEach(function (node) { + if (node.loc) + delete node.loc; + Object.keys(node).forEach(function (key) { + var value = node[key]; + if (value && typeof value === 'object') { + workSet.add(value); + } + }); + }); + var loc = doc.loc; + if (loc) { + delete loc.startToken; + delete loc.endToken; + } + return doc; +} +function parseDocument(source) { + var cacheKey = normalize(source); + if (!docCache.has(cacheKey)) { + var parsed = graphql.parse(source, { + experimentalFragmentVariables: experimentalFragmentVariables, + allowLegacyFragmentVariables: experimentalFragmentVariables + }); + if (!parsed || parsed.kind !== 'Document') { + throw new Error('Not a valid GraphQL document.'); + } + docCache.set(cacheKey, stripLoc(processFragments(parsed))); + } + return docCache.get(cacheKey); +} +function gql(literals) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof literals === 'string') { + literals = [literals]; + } + var result = literals[0]; + args.forEach(function (arg, i) { + if (arg && arg.kind === 'Document') { + result += arg.loc.source.body; + } + else { + result += arg; + } + result += literals[i + 1]; + }); + return parseDocument(result); +} +function resetCaches() { + docCache.clear(); + fragmentSourceMap.clear(); +} +function disableFragmentWarnings() { + printFragmentWarnings = false; +} +function enableExperimentalFragmentVariables() { + experimentalFragmentVariables = true; +} +function disableExperimentalFragmentVariables() { + experimentalFragmentVariables = false; +} +var extras = { + gql: gql, + resetCaches: resetCaches, + disableFragmentWarnings: disableFragmentWarnings, + enableExperimentalFragmentVariables: enableExperimentalFragmentVariables, + disableExperimentalFragmentVariables: disableExperimentalFragmentVariables +}; +(function (gql_1) { + gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables; +})(gql || (gql = {})); +gql["default"] = gql; +var gql$1 = gql; + +var loader = require('../loader'); +describe('gql', function () { + it('parses queries', function () { + chai.assert.equal(gql$1(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["{ testQuery }"], ["{ testQuery }"]))).kind, 'Document'); + }); + it('parses queries when called as a function', function () { + chai.assert.equal(gql$1('{ testQuery }').kind, 'Document'); + }); + it('parses queries with weird substitutions', function () { + var obj = Object.create(null); + chai.assert.equal(gql$1(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), obj.missing).kind, 'Document'); + chai.assert.equal(gql$1(templateObject_3 || (templateObject_3 = tslib.__makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), null).kind, 'Document'); + chai.assert.equal(gql$1(templateObject_4 || (templateObject_4 = tslib.__makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), 0).kind, 'Document'); + }); + it('allows interpolation of documents generated by the webpack loader', function () { + var sameFragment = "fragment SomeFragmentName on SomeType { someField }"; + var jsSource = loader.call({ cacheable: function () { } }, sameFragment); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + var document = gql$1(templateObject_5 || (templateObject_5 = tslib.__makeTemplateObject(["query { ...SomeFragmentName } ", ""], ["query { ...SomeFragmentName } ", ""])), module.exports); + chai.assert.equal(document.kind, 'Document'); + chai.assert.equal(document.definitions.length, 2); + chai.assert.equal(document.definitions[0].kind, 'OperationDefinition'); + chai.assert.equal(document.definitions[1].kind, 'FragmentDefinition'); + }); + it('parses queries through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, '{ testQuery }'); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.equal(module.exports.kind, 'Document'); + }); + it('parses single query through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.equal(module.exports.kind, 'Document'); + chai.assert.exists(module.exports.Q1); + chai.assert.equal(module.exports.Q1.kind, 'Document'); + chai.assert.equal(module.exports.Q1.definitions.length, 1); + }); + it('parses single query and exports as default', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions); + }); + it('parses multiple queries through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.exists(module.exports.Q1); + chai.assert.exists(module.exports.Q2); + chai.assert.equal(module.exports.Q1.kind, 'Document'); + chai.assert.equal(module.exports.Q2.kind, 'Document'); + chai.assert.equal(module.exports.Q1.definitions.length, 1); + chai.assert.equal(module.exports.Q2.definitions.length, 1); + }); + it('parses fragments with variable definitions', function () { + gql$1.enableExperimentalFragmentVariables(); + var parsed = gql$1(templateObject_6 || (templateObject_6 = tslib.__makeTemplateObject(["fragment A ($arg: String!) on Type { testQuery }"], ["fragment A ($arg: String!) on Type { testQuery }"]))); + chai.assert.equal(parsed.kind, 'Document'); + chai.assert.exists(parsed.definitions[0].variableDefinitions); + gql$1.disableExperimentalFragmentVariables(); + }); + it('does not nest queries needlessly in named exports', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n query Q3 { test Query3 }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.notExists(module.exports.Q2.Q1); + chai.assert.notExists(module.exports.Q3.Q1); + chai.assert.notExists(module.exports.Q3.Q2); + }); + it('tracks fragment dependencies from multiple queries through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F1 on F { testQuery }\n fragment F2 on F { testQuery2 }\n fragment F3 on F { testQuery3 }\n query Q1 { ...F1 }\n query Q2 { ...F2 }\n query Q3 {\n ...F1\n ...F2\n }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.exists(module.exports.Q1); + chai.assert.exists(module.exports.Q2); + chai.assert.exists(module.exports.Q3); + var Q1 = module.exports.Q1.definitions; + var Q2 = module.exports.Q2.definitions; + var Q3 = module.exports.Q3.definitions; + chai.assert.equal(Q1.length, 2); + chai.assert.equal(Q1[0].name.value, 'Q1'); + chai.assert.equal(Q1[1].name.value, 'F1'); + chai.assert.equal(Q2.length, 2); + chai.assert.equal(Q2[0].name.value, 'Q2'); + chai.assert.equal(Q2[1].name.value, 'F2'); + chai.assert.equal(Q3.length, 3); + chai.assert.equal(Q3[0].name.value, 'Q3'); + chai.assert.equal(Q3[1].name.value, 'F1'); + chai.assert.equal(Q3[2].name.value, 'F2'); + var F1 = module.exports.F1.definitions; + var F2 = module.exports.F2.definitions; + var F3 = module.exports.F3.definitions; + chai.assert.equal(F1.length, 1); + chai.assert.equal(F1[0].name.value, 'F1'); + chai.assert.equal(F2.length, 1); + chai.assert.equal(F2[0].name.value, 'F2'); + chai.assert.equal(F3.length, 1); + chai.assert.equal(F3[0].name.value, 'F3'); + }); + it('tracks fragment dependencies across nested fragments', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F11 on F { testQuery }\n fragment F22 on F {\n ...F11\n testQuery2\n }\n fragment F33 on F {\n ...F22\n testQuery3\n }\n\n query Q1 {\n ...F33\n }\n\n query Q2 {\n id\n }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.exists(module.exports.Q1); + chai.assert.exists(module.exports.Q2); + var Q1 = module.exports.Q1.definitions; + var Q2 = module.exports.Q2.definitions; + chai.assert.equal(Q1.length, 4); + chai.assert.equal(Q1[0].name.value, 'Q1'); + chai.assert.equal(Q1[1].name.value, 'F33'); + chai.assert.equal(Q1[2].name.value, 'F22'); + chai.assert.equal(Q1[3].name.value, 'F11'); + chai.assert.equal(Q2.length, 1); + var F11 = module.exports.F11.definitions; + var F22 = module.exports.F22.definitions; + var F33 = module.exports.F33.definitions; + chai.assert.equal(F11.length, 1); + chai.assert.equal(F11[0].name.value, 'F11'); + chai.assert.equal(F22.length, 2); + chai.assert.equal(F22[0].name.value, 'F22'); + chai.assert.equal(F22[1].name.value, 'F11'); + chai.assert.equal(F33.length, 3); + chai.assert.equal(F33[0].name.value, 'F33'); + chai.assert.equal(F33[1].name.value, 'F22'); + chai.assert.equal(F33[2].name.value, 'F11'); + }); + it('correctly imports other files through the webpack loader', function () { + var query = "#import \"./fragment_definition.graphql\"\n query {\n author {\n ...authorDetails\n }\n }"; + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + var require = function (path) { + chai.assert.equal(path, './fragment_definition.graphql'); + return gql$1(templateObject_7 || (templateObject_7 = tslib.__makeTemplateObject(["\n fragment authorDetails on Author {\n firstName\n lastName\n }"], ["\n fragment authorDetails on Author {\n firstName\n lastName\n }"]))); + }; + Function("module,require", jsSource)(module, require); + chai.assert.equal(module.exports.kind, 'Document'); + var definitions = module.exports.definitions; + chai.assert.equal(definitions.length, 2); + chai.assert.equal(definitions[0].kind, 'OperationDefinition'); + chai.assert.equal(definitions[1].kind, 'FragmentDefinition'); + }); + it('tracks fragment dependencies across fragments loaded via the webpack loader', function () { + var query = "#import \"./fragment_definition.graphql\"\n fragment F111 on F {\n ...F222\n }\n\n query Q1 {\n ...F111\n }\n\n query Q2 {\n a\n }\n "; + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + var require = function (path) { + chai.assert.equal(path, './fragment_definition.graphql'); + return gql$1(templateObject_8 || (templateObject_8 = tslib.__makeTemplateObject(["\n fragment F222 on F {\n f1\n f2\n }"], ["\n fragment F222 on F {\n f1\n f2\n }"]))); + }; + Function("module,require", jsSource)(module, require); + chai.assert.exists(module.exports.Q1); + chai.assert.exists(module.exports.Q2); + var Q1 = module.exports.Q1.definitions; + var Q2 = module.exports.Q2.definitions; + chai.assert.equal(Q1.length, 3); + chai.assert.equal(Q1[0].name.value, 'Q1'); + chai.assert.equal(Q1[1].name.value, 'F111'); + chai.assert.equal(Q1[2].name.value, 'F222'); + chai.assert.equal(Q2.length, 1); + }); + it('does not complain when presented with normal comments', function (done) { + chai.assert.doesNotThrow(function () { + var query = "#normal comment\n query {\n author {\n ...authorDetails\n }\n }"; + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + chai.assert.equal(module.exports.kind, 'Document'); + done(); + }); + }); + it('returns the same object for the same query', function () { + chai.assert.isTrue(gql$1(templateObject_9 || (templateObject_9 = tslib.__makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql$1(templateObject_10 || (templateObject_10 = tslib.__makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"])))); + }); + it('returns the same object for the same query, even with whitespace differences', function () { + chai.assert.isTrue(gql$1(templateObject_11 || (templateObject_11 = tslib.__makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql$1(templateObject_12 || (templateObject_12 = tslib.__makeTemplateObject([" { sameQuery, }"], [" { sameQuery, }"])))); + }); + var fragmentAst = gql$1(templateObject_13 || (templateObject_13 = tslib.__makeTemplateObject(["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"], ["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"]))); + it('returns the same object for the same fragment', function () { + chai.assert.isTrue(gql$1(templateObject_14 || (templateObject_14 = tslib.__makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"]))) === gql$1(templateObject_15 || (templateObject_15 = tslib.__makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"])))); + }); + it('returns the same object for the same document with substitution', function () { + chai.assert.isTrue(gql$1(templateObject_16 || (templateObject_16 = tslib.__makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst) === gql$1(templateObject_17 || (templateObject_17 = tslib.__makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst)); + }); + it('can reference a fragment that references as fragment', function () { + var secondFragmentAst = gql$1(templateObject_18 || (templateObject_18 = tslib.__makeTemplateObject(["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "], ["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "])), fragmentAst); + var ast = gql$1(templateObject_19 || (templateObject_19 = tslib.__makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "])), secondFragmentAst); + chai.assert.deepEqual(ast, gql$1(templateObject_20 || (templateObject_20 = tslib.__makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "])))); + }); + describe('fragment warnings', function () { + var warnings = []; + var oldConsoleWarn = console.warn; + beforeEach(function () { + gql$1.resetCaches(); + warnings = []; + console.warn = function (w) { return warnings.push(w); }; + }); + afterEach(function () { + console.warn = oldConsoleWarn; + }); + it('warns if you use the same fragment name for different fragments', function () { + var frag1 = gql$1(templateObject_21 || (templateObject_21 = tslib.__makeTemplateObject(["fragment TestSame on Bar { fieldOne }"], ["fragment TestSame on Bar { fieldOne }"]))); + var frag2 = gql$1(templateObject_22 || (templateObject_22 = tslib.__makeTemplateObject(["fragment TestSame on Bar { fieldTwo }"], ["fragment TestSame on Bar { fieldTwo }"]))); + chai.assert.isFalse(frag1 === frag2); + chai.assert.equal(warnings.length, 1); + }); + it('does not warn if you use the same fragment name for the same fragment', function () { + var frag1 = gql$1(templateObject_23 || (templateObject_23 = tslib.__makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"]))); + var frag2 = gql$1(templateObject_24 || (templateObject_24 = tslib.__makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"]))); + chai.assert.isTrue(frag1 === frag2); + chai.assert.equal(warnings.length, 0); + }); + it('does not warn if you use the same embedded fragment in two different queries', function () { + var frag1 = gql$1(templateObject_25 || (templateObject_25 = tslib.__makeTemplateObject(["fragment TestEmbedded on Bar { field }"], ["fragment TestEmbedded on Bar { field }"]))); + var query1 = gql$1(templateObject_26 || (templateObject_26 = tslib.__makeTemplateObject(["{ bar { fieldOne ...TestEmbedded } } ", ""], ["{ bar { fieldOne ...TestEmbedded } } ", ""])), frag1); + var query2 = gql$1(templateObject_27 || (templateObject_27 = tslib.__makeTemplateObject(["{ bar { fieldTwo ...TestEmbedded } } ", ""], ["{ bar { fieldTwo ...TestEmbedded } } ", ""])), frag1); + chai.assert.isFalse(query1 === query2); + chai.assert.equal(warnings.length, 0); + }); + it('does not warn if you use the same fragment name for embedded and non-embedded fragments', function () { + var frag1 = gql$1(templateObject_28 || (templateObject_28 = tslib.__makeTemplateObject(["fragment TestEmbeddedTwo on Bar { field }"], ["fragment TestEmbeddedTwo on Bar { field }"]))); + gql$1(templateObject_29 || (templateObject_29 = tslib.__makeTemplateObject(["{ bar { ...TestEmbedded } } ", ""], ["{ bar { ...TestEmbedded } } ", ""])), frag1); + gql$1(templateObject_30 || (templateObject_30 = tslib.__makeTemplateObject(["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"], ["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"]))); + chai.assert.equal(warnings.length, 0); + }); + }); + describe('unique fragments', function () { + beforeEach(function () { + gql$1.resetCaches(); + }); + it('strips duplicate fragments from the document', function () { + var frag1 = gql$1(templateObject_31 || (templateObject_31 = tslib.__makeTemplateObject(["fragment TestDuplicate on Bar { field }"], ["fragment TestDuplicate on Bar { field }"]))); + var query1 = gql$1(templateObject_32 || (templateObject_32 = tslib.__makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", " ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", " ", ""])), frag1, frag1); + var query2 = gql$1(templateObject_33 || (templateObject_33 = tslib.__makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", ""])), frag1); + chai.assert.equal(query1.definitions.length, 2); + chai.assert.equal(query1.definitions[1].kind, 'FragmentDefinition'); + chai.assert.deepEqual(query1.definitions, query2.definitions); + }); + it('ignores duplicate fragments from second-level imports when using the webpack loader', function () { + var load = function (require, query) { + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + Function("require,module", jsSource)(require, module); + return module.exports; + }; + var test_require = function (path) { + switch (path) { + case './friends.graphql': + return load(test_require, [ + '#import "./person.graphql"', + 'fragment friends on Hero { friends { ...person } }', + ].join('\n')); + case './enemies.graphql': + return load(test_require, [ + '#import "./person.graphql"', + 'fragment enemies on Hero { enemies { ...person } }', + ].join('\n')); + case './person.graphql': + return load(test_require, 'fragment person on Person { name }\n'); + default: + return null; + } + }; + var result = load(test_require, [ + '#import "./friends.graphql"', + '#import "./enemies.graphql"', + 'query { hero { ...friends ...enemies } }', + ].join('\n')); + chai.assert.equal(result.kind, 'Document'); + chai.assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain'); + chai.assert.equal(result.definitions[0].kind, 'OperationDefinition'); + var fragments = result.definitions.slice(1); + chai.assert(fragments.every(function (fragment) { return fragment.kind === 'FragmentDefinition'; })); + chai.assert(fragments.some(function (fragment) { return fragment.name.value === 'friends'; })); + chai.assert(fragments.some(function (fragment) { return fragment.name.value === 'enemies'; })); + chai.assert(fragments.some(function (fragment) { return fragment.name.value === 'person'; })); + }); + }); +}); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33; +//# sourceMappingURL=tests.cjs.js.map diff --git a/graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js.map b/graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js.map new file mode 100644 index 0000000..d38ac6f --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/tests.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tests.cjs.js","sources":["../src/index.ts","../src/tests.ts"],"sourcesContent":["import { parse } from 'graphql';\n\nimport {\n DocumentNode,\n DefinitionNode,\n Location,\n} from 'graphql/language/ast';\n\n// A map docString -> graphql document\nconst docCache = new Map();\n\n// A map fragmentName -> [normalized source]\nconst fragmentSourceMap = new Map>();\n\nlet printFragmentWarnings = true;\nlet experimentalFragmentVariables = false;\n\n// Strip insignificant whitespace\n// Note that this could do a lot more, such as reorder fields etc.\nfunction normalize(string: string) {\n return string.replace(/[\\s,]+/g, ' ').trim();\n}\n\nfunction cacheKeyFromLoc(loc: Location) {\n return normalize(loc.source.body.substring(loc.start, loc.end));\n}\n\n// Take a unstripped parsed document (query/mutation or even fragment), and\n// check all fragment definitions, checking for name->source uniqueness.\n// We also want to make sure only unique fragments exist in the document.\nfunction processFragments(ast: DocumentNode) {\n const seenKeys = new Set();\n const definitions: DefinitionNode[] = [];\n\n ast.definitions.forEach(fragmentDefinition => {\n if (fragmentDefinition.kind === 'FragmentDefinition') {\n var fragmentName = fragmentDefinition.name.value;\n var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc!);\n\n // We know something about this fragment\n let sourceKeySet = fragmentSourceMap.get(fragmentName)!;\n if (sourceKeySet && !sourceKeySet.has(sourceKey)) {\n // this is a problem because the app developer is trying to register another fragment with\n // the same name as one previously registered. So, we tell them about it.\n if (printFragmentWarnings) {\n console.warn(\"Warning: fragment with name \" + fragmentName + \" already exists.\\n\"\n + \"graphql-tag enforces all fragment names across your application to be unique; read more about\\n\"\n + \"this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names\");\n }\n } else if (!sourceKeySet) {\n fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);\n }\n\n sourceKeySet.add(sourceKey);\n\n if (!seenKeys.has(sourceKey)) {\n seenKeys.add(sourceKey);\n definitions.push(fragmentDefinition);\n }\n } else {\n definitions.push(fragmentDefinition);\n }\n });\n\n return {\n ...ast,\n definitions,\n };\n}\n\nfunction stripLoc(doc: DocumentNode) {\n const workSet = new Set>(doc.definitions);\n\n workSet.forEach(node => {\n if (node.loc) delete node.loc;\n Object.keys(node).forEach(key => {\n const value = node[key];\n if (value && typeof value === 'object') {\n workSet.add(value);\n }\n });\n });\n\n const loc = doc.loc as Record;\n if (loc) {\n delete loc.startToken;\n delete loc.endToken;\n }\n\n return doc;\n}\n\nfunction parseDocument(source: string) {\n var cacheKey = normalize(source);\n if (!docCache.has(cacheKey)) {\n const parsed = parse(source, {\n experimentalFragmentVariables,\n allowLegacyFragmentVariables: experimentalFragmentVariables,\n } as any);\n if (!parsed || parsed.kind !== 'Document') {\n throw new Error('Not a valid GraphQL document.');\n }\n docCache.set(\n cacheKey,\n // check that all \"new\" fragments inside the documents are consistent with\n // existing fragments of the same name\n stripLoc(processFragments(parsed)),\n );\n }\n return docCache.get(cacheKey)!;\n}\n\n// XXX This should eventually disallow arbitrary string interpolation, like Relay does\nexport function gql(\n literals: string | readonly string[],\n ...args: any[]\n) {\n\n if (typeof literals === 'string') {\n literals = [literals];\n }\n\n let result = literals[0];\n\n args.forEach((arg, i) => {\n if (arg && arg.kind === 'Document') {\n result += arg.loc.source.body;\n } else {\n result += arg;\n }\n result += literals[i + 1];\n });\n\n return parseDocument(result);\n}\n\nexport function resetCaches() {\n docCache.clear();\n fragmentSourceMap.clear();\n}\n\nexport function disableFragmentWarnings() {\n printFragmentWarnings = false;\n}\n\nexport function enableExperimentalFragmentVariables() {\n experimentalFragmentVariables = true;\n}\n\nexport function disableExperimentalFragmentVariables() {\n experimentalFragmentVariables = false;\n}\n\nconst extras = {\n gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n};\n\nexport namespace gql {\n export const {\n gql,\n resetCaches,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables,\n } = extras;\n}\n\ngql.default = gql;\n\nexport default gql;\n","import 'source-map-support/register';\n\nimport { assert } from 'chai';\nimport { DocumentNode, FragmentDefinitionNode } from 'graphql';\n\nimport gql from './index';\nconst loader = require('../loader');\n\ndescribe('gql', () => {\n it('parses queries', () => {\n assert.equal(gql`{ testQuery }`.kind, 'Document');\n });\n\n it('parses queries when called as a function', () => {\n assert.equal(gql('{ testQuery }').kind, 'Document');\n });\n\n it('parses queries with weird substitutions', () => {\n const obj = Object.create(null);\n assert.equal(gql`{ field(input: \"${obj.missing}\") }`.kind, 'Document');\n assert.equal(gql`{ field(input: \"${null}\") }`.kind, 'Document');\n assert.equal(gql`{ field(input: \"${0}\") }`.kind, 'Document');\n });\n\n it('allows interpolation of documents generated by the webpack loader', () => {\n const sameFragment = \"fragment SomeFragmentName on SomeType { someField }\";\n\n const jsSource = loader.call(\n { cacheable() {} },\n sameFragment,\n );\n const module = { exports: Object.create(null) };\n\n Function(\"module\", jsSource)(module);\n\n const document = gql`query { ...SomeFragmentName } ${module.exports}`;\n assert.equal(document.kind, 'Document');\n assert.equal(document.definitions.length, 2);\n assert.equal(document.definitions[0].kind, 'OperationDefinition');\n assert.equal(document.definitions[1].kind, 'FragmentDefinition');\n });\n\n it('parses queries through webpack loader', () => {\n const jsSource = loader.call({ cacheable() {} }, '{ testQuery }');\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n assert.equal(module.exports.kind, 'Document');\n });\n\n it('parses single query through webpack loader', () => {\n const jsSource = loader.call({ cacheable() {} }, `\n query Q1 { testQuery }\n `);\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n\n assert.equal(module.exports.kind, 'Document');\n assert.exists(module.exports.Q1);\n assert.equal(module.exports.Q1.kind, 'Document');\n assert.equal(module.exports.Q1.definitions.length, 1);\n });\n\n it('parses single query and exports as default', () => {\n const jsSource = loader.call({ cacheable() {} }, `\n query Q1 { testQuery }\n `);\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions);\n });\n\n it('parses multiple queries through webpack loader', () => {\n const jsSource = loader.call({ cacheable() {} }, `\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n `);\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n\n assert.exists(module.exports.Q1);\n assert.exists(module.exports.Q2);\n assert.equal(module.exports.Q1.kind, 'Document');\n assert.equal(module.exports.Q2.kind, 'Document');\n assert.equal(module.exports.Q1.definitions.length, 1);\n assert.equal(module.exports.Q2.definitions.length, 1);\n });\n\n it('parses fragments with variable definitions', () => {\n gql.enableExperimentalFragmentVariables();\n\n const parsed: any = gql`fragment A ($arg: String!) on Type { testQuery }`;\n assert.equal(parsed.kind, 'Document');\n assert.exists(parsed.definitions[0].variableDefinitions);\n\n gql.disableExperimentalFragmentVariables()\n });\n\n // see https://github.com/apollographql/graphql-tag/issues/168\n it('does not nest queries needlessly in named exports', () => {\n const jsSource = loader.call({ cacheable() {} }, `\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n query Q3 { test Query3 }\n `);\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n\n assert.notExists(module.exports.Q2.Q1);\n assert.notExists(module.exports.Q3.Q1);\n assert.notExists(module.exports.Q3.Q2);\n });\n\n it('tracks fragment dependencies from multiple queries through webpack loader', () => {\n const jsSource = loader.call({ cacheable() {} }, `\n fragment F1 on F { testQuery }\n fragment F2 on F { testQuery2 }\n fragment F3 on F { testQuery3 }\n query Q1 { ...F1 }\n query Q2 { ...F2 }\n query Q3 {\n ...F1\n ...F2\n }\n `);\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n\n assert.exists(module.exports.Q1);\n assert.exists(module.exports.Q2);\n assert.exists(module.exports.Q3);\n const Q1 = module.exports.Q1.definitions;\n const Q2 = module.exports.Q2.definitions;\n const Q3 = module.exports.Q3.definitions;\n\n assert.equal(Q1.length, 2);\n assert.equal(Q1[0].name.value, 'Q1');\n assert.equal(Q1[1].name.value, 'F1');\n\n assert.equal(Q2.length, 2);\n assert.equal(Q2[0].name.value, 'Q2');\n assert.equal(Q2[1].name.value, 'F2');\n\n assert.equal(Q3.length, 3);\n assert.equal(Q3[0].name.value, 'Q3');\n assert.equal(Q3[1].name.value, 'F1');\n assert.equal(Q3[2].name.value, 'F2');\n\n const F1 = module.exports.F1.definitions;\n const F2 = module.exports.F2.definitions;\n const F3 = module.exports.F3.definitions;\n\n assert.equal(F1.length, 1);\n assert.equal(F1[0].name.value, 'F1');\n assert.equal(F2.length, 1);\n assert.equal(F2[0].name.value, 'F2');\n assert.equal(F3.length, 1);\n assert.equal(F3[0].name.value, 'F3');\n\n });\n\n it('tracks fragment dependencies across nested fragments', () => {\n const jsSource = loader.call({ cacheable() {} }, `\n fragment F11 on F { testQuery }\n fragment F22 on F {\n ...F11\n testQuery2\n }\n fragment F33 on F {\n ...F22\n testQuery3\n }\n\n query Q1 {\n ...F33\n }\n\n query Q2 {\n id\n }\n `);\n\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n\n assert.exists(module.exports.Q1);\n assert.exists(module.exports.Q2);\n\n const Q1 = module.exports.Q1.definitions;\n const Q2 = module.exports.Q2.definitions;\n\n assert.equal(Q1.length, 4);\n assert.equal(Q1[0].name.value, 'Q1');\n assert.equal(Q1[1].name.value, 'F33');\n assert.equal(Q1[2].name.value, 'F22');\n assert.equal(Q1[3].name.value, 'F11');\n\n assert.equal(Q2.length, 1);\n\n const F11 = module.exports.F11.definitions;\n const F22 = module.exports.F22.definitions;\n const F33 = module.exports.F33.definitions;\n\n assert.equal(F11.length, 1);\n assert.equal(F11[0].name.value, 'F11');\n assert.equal(F22.length, 2);\n assert.equal(F22[0].name.value, 'F22');\n assert.equal(F22[1].name.value, 'F11');\n assert.equal(F33.length, 3);\n assert.equal(F33[0].name.value, 'F33');\n assert.equal(F33[1].name.value, 'F22');\n assert.equal(F33[2].name.value, 'F11');\n });\n\n it('correctly imports other files through the webpack loader', () => {\n const query = `#import \"./fragment_definition.graphql\"\n query {\n author {\n ...authorDetails\n }\n }`;\n const jsSource = loader.call({ cacheable() {} }, query);\n const module = { exports: Object.create(null) };\n const require = (path: string) => {\n assert.equal(path, './fragment_definition.graphql');\n return gql`\n fragment authorDetails on Author {\n firstName\n lastName\n }`;\n };\n Function(\"module,require\", jsSource)(module, require);\n assert.equal(module.exports.kind, 'Document');\n const definitions = module.exports.definitions;\n assert.equal(definitions.length, 2);\n assert.equal(definitions[0].kind, 'OperationDefinition');\n assert.equal(definitions[1].kind, 'FragmentDefinition');\n });\n\n it('tracks fragment dependencies across fragments loaded via the webpack loader', () => {\n const query = `#import \"./fragment_definition.graphql\"\n fragment F111 on F {\n ...F222\n }\n\n query Q1 {\n ...F111\n }\n\n query Q2 {\n a\n }\n `;\n const jsSource = loader.call({ cacheable() {} }, query);\n const module = { exports: Object.create(null) };\n const require = (path: string) => {\n assert.equal(path, './fragment_definition.graphql');\n return gql`\n fragment F222 on F {\n f1\n f2\n }`;\n };\n Function(\"module,require\", jsSource)(module, require);\n\n assert.exists(module.exports.Q1);\n assert.exists(module.exports.Q2);\n\n const Q1 = module.exports.Q1.definitions;\n const Q2 = module.exports.Q2.definitions;\n\n assert.equal(Q1.length, 3);\n assert.equal(Q1[0].name.value, 'Q1');\n assert.equal(Q1[1].name.value, 'F111');\n assert.equal(Q1[2].name.value, 'F222');\n\n assert.equal(Q2.length, 1);\n });\n\n it('does not complain when presented with normal comments', (done) => {\n assert.doesNotThrow(() => {\n const query = `#normal comment\n query {\n author {\n ...authorDetails\n }\n }`;\n const jsSource = loader.call({ cacheable() {} }, query);\n const module = { exports: Object.create(null) };\n Function(\"module\", jsSource)(module);\n assert.equal(module.exports.kind, 'Document');\n done();\n });\n });\n\n it('returns the same object for the same query', () => {\n assert.isTrue(gql`{ sameQuery }` === gql`{ sameQuery }`);\n });\n\n it('returns the same object for the same query, even with whitespace differences', () => {\n assert.isTrue(gql`{ sameQuery }` === gql` { sameQuery, }`);\n });\n\n const fragmentAst = gql`\n fragment UserFragment on User {\n firstName\n lastName\n }\n`;\n\n it('returns the same object for the same fragment', () => {\n assert.isTrue(gql`fragment same on Same { sameQuery }` ===\n gql`fragment same on Same { sameQuery }`);\n });\n\n it('returns the same object for the same document with substitution', () => {\n // We know that calling `gql` on a fragment string will always return\n // the same document, so we can reuse `fragmentAst`\n assert.isTrue(gql`{ ...UserFragment } ${fragmentAst}` ===\n gql`{ ...UserFragment } ${fragmentAst}`);\n });\n\n it('can reference a fragment that references as fragment', () => {\n const secondFragmentAst = gql`\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ${fragmentAst}\n `;\n\n const ast = gql`\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ${secondFragmentAst}\n `;\n\n assert.deepEqual(ast, gql`\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n `);\n });\n\n describe('fragment warnings', () => {\n let warnings = [];\n const oldConsoleWarn = console.warn;\n beforeEach(() => {\n gql.resetCaches();\n warnings = [];\n console.warn = (w: string) => warnings.push(w);\n });\n afterEach(() => {\n console.warn = oldConsoleWarn;\n });\n\n it('warns if you use the same fragment name for different fragments', () => {\n const frag1 = gql`fragment TestSame on Bar { fieldOne }`;\n const frag2 = gql`fragment TestSame on Bar { fieldTwo }`;\n\n assert.isFalse(frag1 === frag2);\n assert.equal(warnings.length, 1);\n });\n\n it('does not warn if you use the same fragment name for the same fragment', () => {\n const frag1 = gql`fragment TestDifferent on Bar { fieldOne }`;\n const frag2 = gql`fragment TestDifferent on Bar { fieldOne }`;\n\n assert.isTrue(frag1 === frag2);\n assert.equal(warnings.length, 0);\n });\n\n it('does not warn if you use the same embedded fragment in two different queries', () => {\n const frag1 = gql`fragment TestEmbedded on Bar { field }`;\n const query1 = gql`{ bar { fieldOne ...TestEmbedded } } ${frag1}`;\n const query2 = gql`{ bar { fieldTwo ...TestEmbedded } } ${frag1}`;\n\n assert.isFalse(query1 === query2);\n assert.equal(warnings.length, 0);\n });\n\n it('does not warn if you use the same fragment name for embedded and non-embedded fragments', () => {\n const frag1 = gql`fragment TestEmbeddedTwo on Bar { field }`;\n gql`{ bar { ...TestEmbedded } } ${frag1}`;\n gql`{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }`;\n\n assert.equal(warnings.length, 0);\n });\n });\n\n describe('unique fragments', () => {\n beforeEach(() => {\n gql.resetCaches();\n });\n\n it('strips duplicate fragments from the document', () => {\n const frag1 = gql`fragment TestDuplicate on Bar { field }`;\n const query1 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1} ${frag1}`;\n const query2 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1}`;\n\n assert.equal(query1.definitions.length, 2);\n assert.equal(query1.definitions[1].kind, 'FragmentDefinition');\n // We don't test strict equality between the two queries because the source.body parsed from the\n // document is not the same, but the set of definitions should be.\n assert.deepEqual(query1.definitions, query2.definitions);\n });\n\n it('ignores duplicate fragments from second-level imports when using the webpack loader', () => {\n // take a require function and a query string, use the webpack loader to process it\n const load = (\n require: (path: string) => DocumentNode | null,\n query: string,\n ): DocumentNode | null => {\n const jsSource = loader.call({ cacheable() {} }, query);\n const module = { exports: Object.create(null) };\n Function(\"require,module\", jsSource)(require, module);\n return module.exports;\n }\n\n const test_require = (path: string) => {\n switch (path) {\n case './friends.graphql':\n return load(test_require, [\n '#import \"./person.graphql\"',\n 'fragment friends on Hero { friends { ...person } }',\n ].join('\\n'));\n case './enemies.graphql':\n return load(test_require, [\n '#import \"./person.graphql\"',\n 'fragment enemies on Hero { enemies { ...person } }',\n ].join('\\n'));\n case './person.graphql':\n return load(test_require, 'fragment person on Person { name }\\n');\n default:\n return null;\n };\n };\n\n const result = load(test_require, [\n '#import \"./friends.graphql\"',\n '#import \"./enemies.graphql\"',\n 'query { hero { ...friends ...enemies } }',\n ].join('\\n'))!;\n\n assert.equal(result.kind, 'Document');\n assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain');\n assert.equal(result.definitions[0].kind, 'OperationDefinition');\n\n // the rest of the definitions should be fragments and contain one of\n // each: \"friends\", \"enemies\", \"person\". Order does not matter\n const fragments = result.definitions.slice(1) as FragmentDefinitionNode[];\n assert(fragments.every(fragment => fragment.kind === 'FragmentDefinition'))\n assert(fragments.some(fragment => fragment.name.value === 'friends'))\n assert(fragments.some(fragment => fragment.name.value === 'enemies'))\n assert(fragments.some(fragment => fragment.name.value === 'person'))\n });\n });\n\n // How to make this work?\n // it.only('can reference a fragment passed as a document via shorthand', () => {\n // const ast = gql`\n // {\n // user(id: 5) {\n // ...${userFragmentDocument}\n // }\n // }\n // `;\n //\n // assert.deepEqual(ast, gql`\n // {\n // user(id: 5) {\n // ...UserFragment\n // }\n // }\n // fragment UserFragment on User {\n // firstName\n // lastName\n // }\n // `);\n // });\n});\n"],"names":["parse","assert","gql"],"mappings":";;;;;;;AASA,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;AAGjD,IAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;AAEzD,IAAI,qBAAqB,GAAG,IAAI,CAAC;AACjC,IAAI,6BAA6B,GAAG,KAAK,CAAC;AAI1C,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC;AAKD,SAAS,gBAAgB,CAAC,GAAiB;IACzC,IAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,IAAM,WAAW,GAAqB,EAAE,CAAC;IAEzC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,kBAAkB;QACxC,IAAI,kBAAkB,CAAC,IAAI,KAAK,oBAAoB,EAAE;YACpD,IAAI,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;YACjD,IAAI,SAAS,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAI,CAAC,CAAC;YAGzD,IAAI,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC;YACxD,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;gBAGhD,IAAI,qBA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ription/node_modules/graphql-tag/lib/tests.d.ts b/graphql-subscription/node_modules/graphql-tag/lib/tests.d.ts new file mode 100644 index 0000000..c85b6c3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/tests.d.ts @@ -0,0 +1,2 @@ +import 'source-map-support/register'; +//# sourceMappingURL=tests.d.ts.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/tests.d.ts.map b/graphql-subscription/node_modules/graphql-tag/lib/tests.d.ts.map new file mode 100644 index 0000000..fc32419 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/tests.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../src/tests.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/tests.js b/graphql-subscription/node_modules/graphql-tag/lib/tests.js new file mode 100644 index 0000000..866f9d5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/tests.js @@ -0,0 +1,288 @@ +import { __makeTemplateObject } from "tslib"; +import 'source-map-support/register'; +import { assert } from 'chai'; +import gql from './index'; +var loader = require('../loader'); +describe('gql', function () { + it('parses queries', function () { + assert.equal(gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["{ testQuery }"], ["{ testQuery }"]))).kind, 'Document'); + }); + it('parses queries when called as a function', function () { + assert.equal(gql('{ testQuery }').kind, 'Document'); + }); + it('parses queries with weird substitutions', function () { + var obj = Object.create(null); + assert.equal(gql(templateObject_2 || (templateObject_2 = __makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), obj.missing).kind, 'Document'); + assert.equal(gql(templateObject_3 || (templateObject_3 = __makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), null).kind, 'Document'); + assert.equal(gql(templateObject_4 || (templateObject_4 = __makeTemplateObject(["{ field(input: \"", "\") }"], ["{ field(input: \"", "\") }"])), 0).kind, 'Document'); + }); + it('allows interpolation of documents generated by the webpack loader', function () { + var sameFragment = "fragment SomeFragmentName on SomeType { someField }"; + var jsSource = loader.call({ cacheable: function () { } }, sameFragment); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + var document = gql(templateObject_5 || (templateObject_5 = __makeTemplateObject(["query { ...SomeFragmentName } ", ""], ["query { ...SomeFragmentName } ", ""])), module.exports); + assert.equal(document.kind, 'Document'); + assert.equal(document.definitions.length, 2); + assert.equal(document.definitions[0].kind, 'OperationDefinition'); + assert.equal(document.definitions[1].kind, 'FragmentDefinition'); + }); + it('parses queries through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, '{ testQuery }'); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.equal(module.exports.kind, 'Document'); + }); + it('parses single query through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.equal(module.exports.kind, 'Document'); + assert.exists(module.exports.Q1); + assert.equal(module.exports.Q1.kind, 'Document'); + assert.equal(module.exports.Q1.definitions.length, 1); + }); + it('parses single query and exports as default', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions); + }); + it('parses multiple queries through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + assert.equal(module.exports.Q1.kind, 'Document'); + assert.equal(module.exports.Q2.kind, 'Document'); + assert.equal(module.exports.Q1.definitions.length, 1); + assert.equal(module.exports.Q2.definitions.length, 1); + }); + it('parses fragments with variable definitions', function () { + gql.enableExperimentalFragmentVariables(); + var parsed = gql(templateObject_6 || (templateObject_6 = __makeTemplateObject(["fragment A ($arg: String!) on Type { testQuery }"], ["fragment A ($arg: String!) on Type { testQuery }"]))); + assert.equal(parsed.kind, 'Document'); + assert.exists(parsed.definitions[0].variableDefinitions); + gql.disableExperimentalFragmentVariables(); + }); + it('does not nest queries needlessly in named exports', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n query Q1 { testQuery }\n query Q2 { testQuery2 }\n query Q3 { test Query3 }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.notExists(module.exports.Q2.Q1); + assert.notExists(module.exports.Q3.Q1); + assert.notExists(module.exports.Q3.Q2); + }); + it('tracks fragment dependencies from multiple queries through webpack loader', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F1 on F { testQuery }\n fragment F2 on F { testQuery2 }\n fragment F3 on F { testQuery3 }\n query Q1 { ...F1 }\n query Q2 { ...F2 }\n query Q3 {\n ...F1\n ...F2\n }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + assert.exists(module.exports.Q3); + var Q1 = module.exports.Q1.definitions; + var Q2 = module.exports.Q2.definitions; + var Q3 = module.exports.Q3.definitions; + assert.equal(Q1.length, 2); + assert.equal(Q1[0].name.value, 'Q1'); + assert.equal(Q1[1].name.value, 'F1'); + assert.equal(Q2.length, 2); + assert.equal(Q2[0].name.value, 'Q2'); + assert.equal(Q2[1].name.value, 'F2'); + assert.equal(Q3.length, 3); + assert.equal(Q3[0].name.value, 'Q3'); + assert.equal(Q3[1].name.value, 'F1'); + assert.equal(Q3[2].name.value, 'F2'); + var F1 = module.exports.F1.definitions; + var F2 = module.exports.F2.definitions; + var F3 = module.exports.F3.definitions; + assert.equal(F1.length, 1); + assert.equal(F1[0].name.value, 'F1'); + assert.equal(F2.length, 1); + assert.equal(F2[0].name.value, 'F2'); + assert.equal(F3.length, 1); + assert.equal(F3[0].name.value, 'F3'); + }); + it('tracks fragment dependencies across nested fragments', function () { + var jsSource = loader.call({ cacheable: function () { } }, "\n fragment F11 on F { testQuery }\n fragment F22 on F {\n ...F11\n testQuery2\n }\n fragment F33 on F {\n ...F22\n testQuery3\n }\n\n query Q1 {\n ...F33\n }\n\n query Q2 {\n id\n }\n "); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + var Q1 = module.exports.Q1.definitions; + var Q2 = module.exports.Q2.definitions; + assert.equal(Q1.length, 4); + assert.equal(Q1[0].name.value, 'Q1'); + assert.equal(Q1[1].name.value, 'F33'); + assert.equal(Q1[2].name.value, 'F22'); + assert.equal(Q1[3].name.value, 'F11'); + assert.equal(Q2.length, 1); + var F11 = module.exports.F11.definitions; + var F22 = module.exports.F22.definitions; + var F33 = module.exports.F33.definitions; + assert.equal(F11.length, 1); + assert.equal(F11[0].name.value, 'F11'); + assert.equal(F22.length, 2); + assert.equal(F22[0].name.value, 'F22'); + assert.equal(F22[1].name.value, 'F11'); + assert.equal(F33.length, 3); + assert.equal(F33[0].name.value, 'F33'); + assert.equal(F33[1].name.value, 'F22'); + assert.equal(F33[2].name.value, 'F11'); + }); + it('correctly imports other files through the webpack loader', function () { + var query = "#import \"./fragment_definition.graphql\"\n query {\n author {\n ...authorDetails\n }\n }"; + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + var require = function (path) { + assert.equal(path, './fragment_definition.graphql'); + return gql(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n fragment authorDetails on Author {\n firstName\n lastName\n }"], ["\n fragment authorDetails on Author {\n firstName\n lastName\n }"]))); + }; + Function("module,require", jsSource)(module, require); + assert.equal(module.exports.kind, 'Document'); + var definitions = module.exports.definitions; + assert.equal(definitions.length, 2); + assert.equal(definitions[0].kind, 'OperationDefinition'); + assert.equal(definitions[1].kind, 'FragmentDefinition'); + }); + it('tracks fragment dependencies across fragments loaded via the webpack loader', function () { + var query = "#import \"./fragment_definition.graphql\"\n fragment F111 on F {\n ...F222\n }\n\n query Q1 {\n ...F111\n }\n\n query Q2 {\n a\n }\n "; + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + var require = function (path) { + assert.equal(path, './fragment_definition.graphql'); + return gql(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n fragment F222 on F {\n f1\n f2\n }"], ["\n fragment F222 on F {\n f1\n f2\n }"]))); + }; + Function("module,require", jsSource)(module, require); + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + var Q1 = module.exports.Q1.definitions; + var Q2 = module.exports.Q2.definitions; + assert.equal(Q1.length, 3); + assert.equal(Q1[0].name.value, 'Q1'); + assert.equal(Q1[1].name.value, 'F111'); + assert.equal(Q1[2].name.value, 'F222'); + assert.equal(Q2.length, 1); + }); + it('does not complain when presented with normal comments', function (done) { + assert.doesNotThrow(function () { + var query = "#normal comment\n query {\n author {\n ...authorDetails\n }\n }"; + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.equal(module.exports.kind, 'Document'); + done(); + }); + }); + it('returns the same object for the same query', function () { + assert.isTrue(gql(templateObject_9 || (templateObject_9 = __makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql(templateObject_10 || (templateObject_10 = __makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"])))); + }); + it('returns the same object for the same query, even with whitespace differences', function () { + assert.isTrue(gql(templateObject_11 || (templateObject_11 = __makeTemplateObject(["{ sameQuery }"], ["{ sameQuery }"]))) === gql(templateObject_12 || (templateObject_12 = __makeTemplateObject([" { sameQuery, }"], [" { sameQuery, }"])))); + }); + var fragmentAst = gql(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"], ["\n fragment UserFragment on User {\n firstName\n lastName\n }\n"]))); + it('returns the same object for the same fragment', function () { + assert.isTrue(gql(templateObject_14 || (templateObject_14 = __makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"]))) === gql(templateObject_15 || (templateObject_15 = __makeTemplateObject(["fragment same on Same { sameQuery }"], ["fragment same on Same { sameQuery }"])))); + }); + it('returns the same object for the same document with substitution', function () { + assert.isTrue(gql(templateObject_16 || (templateObject_16 = __makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst) === gql(templateObject_17 || (templateObject_17 = __makeTemplateObject(["{ ...UserFragment } ", ""], ["{ ...UserFragment } ", ""])), fragmentAst)); + }); + it('can reference a fragment that references as fragment', function () { + var secondFragmentAst = gql(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "], ["\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n ", "\n "])), fragmentAst); + var ast = gql(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n ", "\n "])), secondFragmentAst); + assert.deepEqual(ast, gql(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "], ["\n {\n user(id: 5) {\n ...SecondUserFragment\n }\n }\n fragment SecondUserFragment on User {\n ...UserFragment\n }\n fragment UserFragment on User {\n firstName\n lastName\n }\n "])))); + }); + describe('fragment warnings', function () { + var warnings = []; + var oldConsoleWarn = console.warn; + beforeEach(function () { + gql.resetCaches(); + warnings = []; + console.warn = function (w) { return warnings.push(w); }; + }); + afterEach(function () { + console.warn = oldConsoleWarn; + }); + it('warns if you use the same fragment name for different fragments', function () { + var frag1 = gql(templateObject_21 || (templateObject_21 = __makeTemplateObject(["fragment TestSame on Bar { fieldOne }"], ["fragment TestSame on Bar { fieldOne }"]))); + var frag2 = gql(templateObject_22 || (templateObject_22 = __makeTemplateObject(["fragment TestSame on Bar { fieldTwo }"], ["fragment TestSame on Bar { fieldTwo }"]))); + assert.isFalse(frag1 === frag2); + assert.equal(warnings.length, 1); + }); + it('does not warn if you use the same fragment name for the same fragment', function () { + var frag1 = gql(templateObject_23 || (templateObject_23 = __makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"]))); + var frag2 = gql(templateObject_24 || (templateObject_24 = __makeTemplateObject(["fragment TestDifferent on Bar { fieldOne }"], ["fragment TestDifferent on Bar { fieldOne }"]))); + assert.isTrue(frag1 === frag2); + assert.equal(warnings.length, 0); + }); + it('does not warn if you use the same embedded fragment in two different queries', function () { + var frag1 = gql(templateObject_25 || (templateObject_25 = __makeTemplateObject(["fragment TestEmbedded on Bar { field }"], ["fragment TestEmbedded on Bar { field }"]))); + var query1 = gql(templateObject_26 || (templateObject_26 = __makeTemplateObject(["{ bar { fieldOne ...TestEmbedded } } ", ""], ["{ bar { fieldOne ...TestEmbedded } } ", ""])), frag1); + var query2 = gql(templateObject_27 || (templateObject_27 = __makeTemplateObject(["{ bar { fieldTwo ...TestEmbedded } } ", ""], ["{ bar { fieldTwo ...TestEmbedded } } ", ""])), frag1); + assert.isFalse(query1 === query2); + assert.equal(warnings.length, 0); + }); + it('does not warn if you use the same fragment name for embedded and non-embedded fragments', function () { + var frag1 = gql(templateObject_28 || (templateObject_28 = __makeTemplateObject(["fragment TestEmbeddedTwo on Bar { field }"], ["fragment TestEmbeddedTwo on Bar { field }"]))); + gql(templateObject_29 || (templateObject_29 = __makeTemplateObject(["{ bar { ...TestEmbedded } } ", ""], ["{ bar { ...TestEmbedded } } ", ""])), frag1); + gql(templateObject_30 || (templateObject_30 = __makeTemplateObject(["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"], ["{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }"]))); + assert.equal(warnings.length, 0); + }); + }); + describe('unique fragments', function () { + beforeEach(function () { + gql.resetCaches(); + }); + it('strips duplicate fragments from the document', function () { + var frag1 = gql(templateObject_31 || (templateObject_31 = __makeTemplateObject(["fragment TestDuplicate on Bar { field }"], ["fragment TestDuplicate on Bar { field }"]))); + var query1 = gql(templateObject_32 || (templateObject_32 = __makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", " ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", " ", ""])), frag1, frag1); + var query2 = gql(templateObject_33 || (templateObject_33 = __makeTemplateObject(["{ bar { fieldOne ...TestDuplicate } } ", ""], ["{ bar { fieldOne ...TestDuplicate } } ", ""])), frag1); + assert.equal(query1.definitions.length, 2); + assert.equal(query1.definitions[1].kind, 'FragmentDefinition'); + assert.deepEqual(query1.definitions, query2.definitions); + }); + it('ignores duplicate fragments from second-level imports when using the webpack loader', function () { + var load = function (require, query) { + var jsSource = loader.call({ cacheable: function () { } }, query); + var module = { exports: Object.create(null) }; + Function("require,module", jsSource)(require, module); + return module.exports; + }; + var test_require = function (path) { + switch (path) { + case './friends.graphql': + return load(test_require, [ + '#import "./person.graphql"', + 'fragment friends on Hero { friends { ...person } }', + ].join('\n')); + case './enemies.graphql': + return load(test_require, [ + '#import "./person.graphql"', + 'fragment enemies on Hero { enemies { ...person } }', + ].join('\n')); + case './person.graphql': + return load(test_require, 'fragment person on Person { name }\n'); + default: + return null; + } + ; + }; + var result = load(test_require, [ + '#import "./friends.graphql"', + '#import "./enemies.graphql"', + 'query { hero { ...friends ...enemies } }', + ].join('\n')); + assert.equal(result.kind, 'Document'); + assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain'); + assert.equal(result.definitions[0].kind, 'OperationDefinition'); + var fragments = result.definitions.slice(1); + assert(fragments.every(function (fragment) { return fragment.kind === 'FragmentDefinition'; })); + assert(fragments.some(function (fragment) { return fragment.name.value === 'friends'; })); + assert(fragments.some(function (fragment) { return fragment.name.value === 'enemies'; })); + assert(fragments.some(function (fragment) { return fragment.name.value === 'person'; })); + }); + }); +}); +var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33; +//# sourceMappingURL=tests.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/lib/tests.js.map b/graphql-subscription/node_modules/graphql-tag/lib/tests.js.map new file mode 100644 index 0000000..b0b5550 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/lib/tests.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tests.js","sourceRoot":"","sources":["../src/tests.ts"],"names":[],"mappings":";AAAA,OAAO,6BAA6B,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,GAAG,MAAM,SAAS,CAAC;AAC1B,IAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEpC,QAAQ,CAAC,KAAK,EAAE;IACd,EAAE,CAAC,gBAAgB,EAAE;QACnB,MAAM,CAAC,KAAK,CAAC,GAAG,kFAAA,eAAe,KAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE;QAC7C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE;QAC5C,IAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,GAAG,+FAAA,mBAAmB,EAAW,OAAM,KAAjB,GAAG,CAAC,OAAO,EA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C,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAhC,CAAgC,CAAC,CAAC,CAAA;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AAwBL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql-tag/loader.js b/graphql-subscription/node_modules/graphql-tag/loader.js new file mode 100644 index 0000000..9825813 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/loader.js @@ -0,0 +1,190 @@ +"use strict"; + +const os = require('os'); +const gql = require('./main.js'); + +// Takes `source` (the source GraphQL query string) +// and `doc` (the parsed GraphQL document) and tacks on +// the imported definitions. +function expandImports(source, doc) { + const lines = source.split(/\r\n|\r|\n/); + let outputCode = ` + var names = {}; + function unique(defs) { + return defs.filter( + function(def) { + if (def.kind !== 'FragmentDefinition') return true; + var name = def.name.value + if (names[name]) { + return false; + } else { + names[name] = true; + return true; + } + } + ) + } + `; + + lines.some((line) => { + if (line[0] === '#' && line.slice(1).split(' ')[0] === 'import') { + const importFile = line.slice(1).split(' ')[1]; + const parseDocument = `require(${importFile})`; + const appendDef = `doc.definitions = doc.definitions.concat(unique(${parseDocument}.definitions));`; + outputCode += appendDef + os.EOL; + } + return (line.length !== 0 && line[0] !== '#'); + }); + + return outputCode; +} + +module.exports = function(source) { + this.cacheable(); + const doc = gql`${source}`; + let headerCode = ` + var doc = ${JSON.stringify(doc)}; + doc.loc.source = ${JSON.stringify(doc.loc.source)}; + `; + + let outputCode = ""; + + // Allow multiple query/mutation definitions in a file. This parses out dependencies + // at compile time, and then uses those at load time to create minimal query documents + // We cannot do the latter at compile time due to how the #import code works. + let operationCount = doc.definitions.reduce(function(accum, op) { + if (op.kind === "OperationDefinition" || op.kind === "FragmentDefinition") { + return accum + 1; + } + + return accum; + }, 0); + + if (operationCount < 1) { + outputCode += ` + module.exports = doc; + ` + } else { + outputCode += ` + // Collect any fragment/type references from a node, adding them to the refs Set + function collectFragmentReferences(node, refs) { + if (node.kind === "FragmentSpread") { + refs.add(node.name.value); + } else if (node.kind === "VariableDefinition") { + var type = node.type; + if (type.kind === "NamedType") { + refs.add(type.name.value); + } + } + + if (node.selectionSet) { + node.selectionSet.selections.forEach(function(selection) { + collectFragmentReferences(selection, refs); + }); + } + + if (node.variableDefinitions) { + node.variableDefinitions.forEach(function(def) { + collectFragmentReferences(def, refs); + }); + } + + if (node.definitions) { + node.definitions.forEach(function(def) { + collectFragmentReferences(def, refs); + }); + } + } + + var definitionRefs = {}; + (function extractReferences() { + doc.definitions.forEach(function(def) { + if (def.name) { + var refs = new Set(); + collectFragmentReferences(def, refs); + definitionRefs[def.name.value] = refs; + } + }); + })(); + + function findOperation(doc, name) { + for (var i = 0; i < doc.definitions.length; i++) { + var element = doc.definitions[i]; + if (element.name && element.name.value == name) { + return element; + } + } + } + + function oneQuery(doc, operationName) { + // Copy the DocumentNode, but clear out the definitions + var newDoc = { + kind: doc.kind, + definitions: [findOperation(doc, operationName)] + }; + if (doc.hasOwnProperty("loc")) { + newDoc.loc = doc.loc; + } + + // Now, for the operation we're running, find any fragments referenced by + // it or the fragments it references + var opRefs = definitionRefs[operationName] || new Set(); + var allRefs = new Set(); + var newRefs = new Set(); + + // IE 11 doesn't support "new Set(iterable)", so we add the members of opRefs to newRefs one by one + opRefs.forEach(function(refName) { + newRefs.add(refName); + }); + + while (newRefs.size > 0) { + var prevRefs = newRefs; + newRefs = new Set(); + + prevRefs.forEach(function(refName) { + if (!allRefs.has(refName)) { + allRefs.add(refName); + var childRefs = definitionRefs[refName] || new Set(); + childRefs.forEach(function(childRef) { + newRefs.add(childRef); + }); + } + }); + } + + allRefs.forEach(function(refName) { + var op = findOperation(doc, refName); + if (op) { + newDoc.definitions.push(op); + } + }); + + return newDoc; + } + + module.exports = doc; + ` + + for (const op of doc.definitions) { + if (op.kind === "OperationDefinition" || op.kind === "FragmentDefinition") { + if (!op.name) { + if (operationCount > 1) { + throw new Error("Query/mutation names are required for a document with multiple definitions"); + } else { + continue; + } + } + + const opName = op.name.value; + outputCode += ` + module.exports["${opName}"] = oneQuery(doc, "${opName}"); + ` + } + } + } + + const importOutputCode = expandImports(source, doc); + const allCode = headerCode + os.EOL + importOutputCode + os.EOL + outputCode + os.EOL; + + return allCode; +}; diff --git a/graphql-subscription/node_modules/graphql-tag/main.js b/graphql-subscription/node_modules/graphql-tag/main.js new file mode 100644 index 0000000..2a4de05 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/main.js @@ -0,0 +1,3 @@ +// For backwards compatibility, make sure require("graphql-tag") returns +// the gql function, rather than an exports object. +module.exports = require('./lib/graphql-tag.umd.js').gql; diff --git a/graphql-subscription/node_modules/graphql-tag/package.json b/graphql-subscription/node_modules/graphql-tag/package.json new file mode 100644 index 0000000..1de0edf --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/package.json @@ -0,0 +1,59 @@ +{ + "name": "graphql-tag", + "version": "2.12.6", + "description": "A JavaScript template literal tag that parses GraphQL queries", + "main": "./main.js", + "module": "./lib/index.js", + "jsnext:main": "./lib/index.js", + "types": "./lib/index.d.ts", + "sideEffects": false, + "scripts": { + "prebuild": "rimraf lib", + "build": "tsc && rollup -c && npm run flow", + "flow": "cp src/index.js.flow lib/graphql-tag.umd.js.flow", + "test": "npm run test:ts3 && npm run test:ts4", + "test:ts3": "npm i typescript@3.7.x graphql@15.x.x && npm run test:mocha", + "test:ts4": "npm i typescript@4.x.x graphql@16.x.x && npm run test:mocha", + "test:mocha": "npm run build && mocha lib/tests.cjs.js", + "prepublish": "npm run build" + }, + "files": [ + "lib/", + "src/", + "loader.js", + "main.js" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/apollographql/graphql-tag.git" + }, + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/apollographql/graphql-tag/issues" + }, + "homepage": "https://github.com/apollographql/graphql-tag#readme", + "dependencies": { + "tslib": "^2.1.0" + }, + "devDependencies": { + "@types/chai": "^4.2.14", + "@types/mocha": "^8.2.0", + "@types/node": "^14.14.22", + "chai": "^4.2.0", + "graphql": "^16.0.1", + "mocha": "^9.0.1", + "rimraf": "^3.0.2", + "rollup": "^2.33.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "source-map-support": "^0.5.19", + "test-all-versions": "^5.0.1", + "typescript": "^4.4.4" + }, + "peerDependencies": { + "graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" + }, + "engines": { + "node": ">=10" + } +} diff --git a/graphql-subscription/node_modules/graphql-tag/src/index.js.flow b/graphql-subscription/node_modules/graphql-tag/src/index.js.flow new file mode 100644 index 0000000..7acb623 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/src/index.js.flow @@ -0,0 +1,7 @@ +// @flow + +import type { DocumentNode } from 'graphql'; + +declare export default function gql(literals: any, ...placeholders: any[]): DocumentNode; +declare export function resetCaches(): void; +declare export function disableFragmentWarnings(): void; diff --git a/graphql-subscription/node_modules/graphql-tag/src/index.ts b/graphql-subscription/node_modules/graphql-tag/src/index.ts new file mode 100644 index 0000000..90ba15b --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/src/index.ts @@ -0,0 +1,174 @@ +import { parse } from 'graphql'; + +import { + DocumentNode, + DefinitionNode, + Location, +} from 'graphql/language/ast'; + +// A map docString -> graphql document +const docCache = new Map(); + +// A map fragmentName -> [normalized source] +const fragmentSourceMap = new Map>(); + +let printFragmentWarnings = true; +let experimentalFragmentVariables = false; + +// Strip insignificant whitespace +// Note that this could do a lot more, such as reorder fields etc. +function normalize(string: string) { + return string.replace(/[\s,]+/g, ' ').trim(); +} + +function cacheKeyFromLoc(loc: Location) { + return normalize(loc.source.body.substring(loc.start, loc.end)); +} + +// Take a unstripped parsed document (query/mutation or even fragment), and +// check all fragment definitions, checking for name->source uniqueness. +// We also want to make sure only unique fragments exist in the document. +function processFragments(ast: DocumentNode) { + const seenKeys = new Set(); + const definitions: DefinitionNode[] = []; + + ast.definitions.forEach(fragmentDefinition => { + if (fragmentDefinition.kind === 'FragmentDefinition') { + var fragmentName = fragmentDefinition.name.value; + var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc!); + + // We know something about this fragment + let sourceKeySet = fragmentSourceMap.get(fragmentName)!; + if (sourceKeySet && !sourceKeySet.has(sourceKey)) { + // this is a problem because the app developer is trying to register another fragment with + // the same name as one previously registered. So, we tell them about it. + if (printFragmentWarnings) { + console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); + } + } else if (!sourceKeySet) { + fragmentSourceMap.set(fragmentName, sourceKeySet = new Set); + } + + sourceKeySet.add(sourceKey); + + if (!seenKeys.has(sourceKey)) { + seenKeys.add(sourceKey); + definitions.push(fragmentDefinition); + } + } else { + definitions.push(fragmentDefinition); + } + }); + + return { + ...ast, + definitions, + }; +} + +function stripLoc(doc: DocumentNode) { + const workSet = new Set>(doc.definitions); + + workSet.forEach(node => { + if (node.loc) delete node.loc; + Object.keys(node).forEach(key => { + const value = node[key]; + if (value && typeof value === 'object') { + workSet.add(value); + } + }); + }); + + const loc = doc.loc as Record; + if (loc) { + delete loc.startToken; + delete loc.endToken; + } + + return doc; +} + +function parseDocument(source: string) { + var cacheKey = normalize(source); + if (!docCache.has(cacheKey)) { + const parsed = parse(source, { + experimentalFragmentVariables, + allowLegacyFragmentVariables: experimentalFragmentVariables, + } as any); + if (!parsed || parsed.kind !== 'Document') { + throw new Error('Not a valid GraphQL document.'); + } + docCache.set( + cacheKey, + // check that all "new" fragments inside the documents are consistent with + // existing fragments of the same name + stripLoc(processFragments(parsed)), + ); + } + return docCache.get(cacheKey)!; +} + +// XXX This should eventually disallow arbitrary string interpolation, like Relay does +export function gql( + literals: string | readonly string[], + ...args: any[] +) { + + if (typeof literals === 'string') { + literals = [literals]; + } + + let result = literals[0]; + + args.forEach((arg, i) => { + if (arg && arg.kind === 'Document') { + result += arg.loc.source.body; + } else { + result += arg; + } + result += literals[i + 1]; + }); + + return parseDocument(result); +} + +export function resetCaches() { + docCache.clear(); + fragmentSourceMap.clear(); +} + +export function disableFragmentWarnings() { + printFragmentWarnings = false; +} + +export function enableExperimentalFragmentVariables() { + experimentalFragmentVariables = true; +} + +export function disableExperimentalFragmentVariables() { + experimentalFragmentVariables = false; +} + +const extras = { + gql, + resetCaches, + disableFragmentWarnings, + enableExperimentalFragmentVariables, + disableExperimentalFragmentVariables, +}; + +export namespace gql { + export const { + gql, + resetCaches, + disableFragmentWarnings, + enableExperimentalFragmentVariables, + disableExperimentalFragmentVariables, + } = extras; +} + +gql.default = gql; + +export default gql; diff --git a/graphql-subscription/node_modules/graphql-tag/src/tests.ts b/graphql-subscription/node_modules/graphql-tag/src/tests.ts new file mode 100644 index 0000000..3a19b75 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-tag/src/tests.ts @@ -0,0 +1,491 @@ +import 'source-map-support/register'; + +import { assert } from 'chai'; +import { DocumentNode, FragmentDefinitionNode } from 'graphql'; + +import gql from './index'; +const loader = require('../loader'); + +describe('gql', () => { + it('parses queries', () => { + assert.equal(gql`{ testQuery }`.kind, 'Document'); + }); + + it('parses queries when called as a function', () => { + assert.equal(gql('{ testQuery }').kind, 'Document'); + }); + + it('parses queries with weird substitutions', () => { + const obj = Object.create(null); + assert.equal(gql`{ field(input: "${obj.missing}") }`.kind, 'Document'); + assert.equal(gql`{ field(input: "${null}") }`.kind, 'Document'); + assert.equal(gql`{ field(input: "${0}") }`.kind, 'Document'); + }); + + it('allows interpolation of documents generated by the webpack loader', () => { + const sameFragment = "fragment SomeFragmentName on SomeType { someField }"; + + const jsSource = loader.call( + { cacheable() {} }, + sameFragment, + ); + const module = { exports: Object.create(null) }; + + Function("module", jsSource)(module); + + const document = gql`query { ...SomeFragmentName } ${module.exports}`; + assert.equal(document.kind, 'Document'); + assert.equal(document.definitions.length, 2); + assert.equal(document.definitions[0].kind, 'OperationDefinition'); + assert.equal(document.definitions[1].kind, 'FragmentDefinition'); + }); + + it('parses queries through webpack loader', () => { + const jsSource = loader.call({ cacheable() {} }, '{ testQuery }'); + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.equal(module.exports.kind, 'Document'); + }); + + it('parses single query through webpack loader', () => { + const jsSource = loader.call({ cacheable() {} }, ` + query Q1 { testQuery } + `); + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + + assert.equal(module.exports.kind, 'Document'); + assert.exists(module.exports.Q1); + assert.equal(module.exports.Q1.kind, 'Document'); + assert.equal(module.exports.Q1.definitions.length, 1); + }); + + it('parses single query and exports as default', () => { + const jsSource = loader.call({ cacheable() {} }, ` + query Q1 { testQuery } + `); + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.deepEqual(module.exports.definitions, module.exports.Q1.definitions); + }); + + it('parses multiple queries through webpack loader', () => { + const jsSource = loader.call({ cacheable() {} }, ` + query Q1 { testQuery } + query Q2 { testQuery2 } + `); + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + assert.equal(module.exports.Q1.kind, 'Document'); + assert.equal(module.exports.Q2.kind, 'Document'); + assert.equal(module.exports.Q1.definitions.length, 1); + assert.equal(module.exports.Q2.definitions.length, 1); + }); + + it('parses fragments with variable definitions', () => { + gql.enableExperimentalFragmentVariables(); + + const parsed: any = gql`fragment A ($arg: String!) on Type { testQuery }`; + assert.equal(parsed.kind, 'Document'); + assert.exists(parsed.definitions[0].variableDefinitions); + + gql.disableExperimentalFragmentVariables() + }); + + // see https://github.com/apollographql/graphql-tag/issues/168 + it('does not nest queries needlessly in named exports', () => { + const jsSource = loader.call({ cacheable() {} }, ` + query Q1 { testQuery } + query Q2 { testQuery2 } + query Q3 { test Query3 } + `); + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + + assert.notExists(module.exports.Q2.Q1); + assert.notExists(module.exports.Q3.Q1); + assert.notExists(module.exports.Q3.Q2); + }); + + it('tracks fragment dependencies from multiple queries through webpack loader', () => { + const jsSource = loader.call({ cacheable() {} }, ` + fragment F1 on F { testQuery } + fragment F2 on F { testQuery2 } + fragment F3 on F { testQuery3 } + query Q1 { ...F1 } + query Q2 { ...F2 } + query Q3 { + ...F1 + ...F2 + } + `); + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + assert.exists(module.exports.Q3); + const Q1 = module.exports.Q1.definitions; + const Q2 = module.exports.Q2.definitions; + const Q3 = module.exports.Q3.definitions; + + assert.equal(Q1.length, 2); + assert.equal(Q1[0].name.value, 'Q1'); + assert.equal(Q1[1].name.value, 'F1'); + + assert.equal(Q2.length, 2); + assert.equal(Q2[0].name.value, 'Q2'); + assert.equal(Q2[1].name.value, 'F2'); + + assert.equal(Q3.length, 3); + assert.equal(Q3[0].name.value, 'Q3'); + assert.equal(Q3[1].name.value, 'F1'); + assert.equal(Q3[2].name.value, 'F2'); + + const F1 = module.exports.F1.definitions; + const F2 = module.exports.F2.definitions; + const F3 = module.exports.F3.definitions; + + assert.equal(F1.length, 1); + assert.equal(F1[0].name.value, 'F1'); + assert.equal(F2.length, 1); + assert.equal(F2[0].name.value, 'F2'); + assert.equal(F3.length, 1); + assert.equal(F3[0].name.value, 'F3'); + + }); + + it('tracks fragment dependencies across nested fragments', () => { + const jsSource = loader.call({ cacheable() {} }, ` + fragment F11 on F { testQuery } + fragment F22 on F { + ...F11 + testQuery2 + } + fragment F33 on F { + ...F22 + testQuery3 + } + + query Q1 { + ...F33 + } + + query Q2 { + id + } + `); + + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + + const Q1 = module.exports.Q1.definitions; + const Q2 = module.exports.Q2.definitions; + + assert.equal(Q1.length, 4); + assert.equal(Q1[0].name.value, 'Q1'); + assert.equal(Q1[1].name.value, 'F33'); + assert.equal(Q1[2].name.value, 'F22'); + assert.equal(Q1[3].name.value, 'F11'); + + assert.equal(Q2.length, 1); + + const F11 = module.exports.F11.definitions; + const F22 = module.exports.F22.definitions; + const F33 = module.exports.F33.definitions; + + assert.equal(F11.length, 1); + assert.equal(F11[0].name.value, 'F11'); + assert.equal(F22.length, 2); + assert.equal(F22[0].name.value, 'F22'); + assert.equal(F22[1].name.value, 'F11'); + assert.equal(F33.length, 3); + assert.equal(F33[0].name.value, 'F33'); + assert.equal(F33[1].name.value, 'F22'); + assert.equal(F33[2].name.value, 'F11'); + }); + + it('correctly imports other files through the webpack loader', () => { + const query = `#import "./fragment_definition.graphql" + query { + author { + ...authorDetails + } + }`; + const jsSource = loader.call({ cacheable() {} }, query); + const module = { exports: Object.create(null) }; + const require = (path: string) => { + assert.equal(path, './fragment_definition.graphql'); + return gql` + fragment authorDetails on Author { + firstName + lastName + }`; + }; + Function("module,require", jsSource)(module, require); + assert.equal(module.exports.kind, 'Document'); + const definitions = module.exports.definitions; + assert.equal(definitions.length, 2); + assert.equal(definitions[0].kind, 'OperationDefinition'); + assert.equal(definitions[1].kind, 'FragmentDefinition'); + }); + + it('tracks fragment dependencies across fragments loaded via the webpack loader', () => { + const query = `#import "./fragment_definition.graphql" + fragment F111 on F { + ...F222 + } + + query Q1 { + ...F111 + } + + query Q2 { + a + } + `; + const jsSource = loader.call({ cacheable() {} }, query); + const module = { exports: Object.create(null) }; + const require = (path: string) => { + assert.equal(path, './fragment_definition.graphql'); + return gql` + fragment F222 on F { + f1 + f2 + }`; + }; + Function("module,require", jsSource)(module, require); + + assert.exists(module.exports.Q1); + assert.exists(module.exports.Q2); + + const Q1 = module.exports.Q1.definitions; + const Q2 = module.exports.Q2.definitions; + + assert.equal(Q1.length, 3); + assert.equal(Q1[0].name.value, 'Q1'); + assert.equal(Q1[1].name.value, 'F111'); + assert.equal(Q1[2].name.value, 'F222'); + + assert.equal(Q2.length, 1); + }); + + it('does not complain when presented with normal comments', (done) => { + assert.doesNotThrow(() => { + const query = `#normal comment + query { + author { + ...authorDetails + } + }`; + const jsSource = loader.call({ cacheable() {} }, query); + const module = { exports: Object.create(null) }; + Function("module", jsSource)(module); + assert.equal(module.exports.kind, 'Document'); + done(); + }); + }); + + it('returns the same object for the same query', () => { + assert.isTrue(gql`{ sameQuery }` === gql`{ sameQuery }`); + }); + + it('returns the same object for the same query, even with whitespace differences', () => { + assert.isTrue(gql`{ sameQuery }` === gql` { sameQuery, }`); + }); + + const fragmentAst = gql` + fragment UserFragment on User { + firstName + lastName + } +`; + + it('returns the same object for the same fragment', () => { + assert.isTrue(gql`fragment same on Same { sameQuery }` === + gql`fragment same on Same { sameQuery }`); + }); + + it('returns the same object for the same document with substitution', () => { + // We know that calling `gql` on a fragment string will always return + // the same document, so we can reuse `fragmentAst` + assert.isTrue(gql`{ ...UserFragment } ${fragmentAst}` === + gql`{ ...UserFragment } ${fragmentAst}`); + }); + + it('can reference a fragment that references as fragment', () => { + const secondFragmentAst = gql` + fragment SecondUserFragment on User { + ...UserFragment + } + ${fragmentAst} + `; + + const ast = gql` + { + user(id: 5) { + ...SecondUserFragment + } + } + ${secondFragmentAst} + `; + + assert.deepEqual(ast, gql` + { + user(id: 5) { + ...SecondUserFragment + } + } + fragment SecondUserFragment on User { + ...UserFragment + } + fragment UserFragment on User { + firstName + lastName + } + `); + }); + + describe('fragment warnings', () => { + let warnings = []; + const oldConsoleWarn = console.warn; + beforeEach(() => { + gql.resetCaches(); + warnings = []; + console.warn = (w: string) => warnings.push(w); + }); + afterEach(() => { + console.warn = oldConsoleWarn; + }); + + it('warns if you use the same fragment name for different fragments', () => { + const frag1 = gql`fragment TestSame on Bar { fieldOne }`; + const frag2 = gql`fragment TestSame on Bar { fieldTwo }`; + + assert.isFalse(frag1 === frag2); + assert.equal(warnings.length, 1); + }); + + it('does not warn if you use the same fragment name for the same fragment', () => { + const frag1 = gql`fragment TestDifferent on Bar { fieldOne }`; + const frag2 = gql`fragment TestDifferent on Bar { fieldOne }`; + + assert.isTrue(frag1 === frag2); + assert.equal(warnings.length, 0); + }); + + it('does not warn if you use the same embedded fragment in two different queries', () => { + const frag1 = gql`fragment TestEmbedded on Bar { field }`; + const query1 = gql`{ bar { fieldOne ...TestEmbedded } } ${frag1}`; + const query2 = gql`{ bar { fieldTwo ...TestEmbedded } } ${frag1}`; + + assert.isFalse(query1 === query2); + assert.equal(warnings.length, 0); + }); + + it('does not warn if you use the same fragment name for embedded and non-embedded fragments', () => { + const frag1 = gql`fragment TestEmbeddedTwo on Bar { field }`; + gql`{ bar { ...TestEmbedded } } ${frag1}`; + gql`{ bar { ...TestEmbedded } } fragment TestEmbeddedTwo on Bar { field }`; + + assert.equal(warnings.length, 0); + }); + }); + + describe('unique fragments', () => { + beforeEach(() => { + gql.resetCaches(); + }); + + it('strips duplicate fragments from the document', () => { + const frag1 = gql`fragment TestDuplicate on Bar { field }`; + const query1 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1} ${frag1}`; + const query2 = gql`{ bar { fieldOne ...TestDuplicate } } ${frag1}`; + + assert.equal(query1.definitions.length, 2); + assert.equal(query1.definitions[1].kind, 'FragmentDefinition'); + // We don't test strict equality between the two queries because the source.body parsed from the + // document is not the same, but the set of definitions should be. + assert.deepEqual(query1.definitions, query2.definitions); + }); + + it('ignores duplicate fragments from second-level imports when using the webpack loader', () => { + // take a require function and a query string, use the webpack loader to process it + const load = ( + require: (path: string) => DocumentNode | null, + query: string, + ): DocumentNode | null => { + const jsSource = loader.call({ cacheable() {} }, query); + const module = { exports: Object.create(null) }; + Function("require,module", jsSource)(require, module); + return module.exports; + } + + const test_require = (path: string) => { + switch (path) { + case './friends.graphql': + return load(test_require, [ + '#import "./person.graphql"', + 'fragment friends on Hero { friends { ...person } }', + ].join('\n')); + case './enemies.graphql': + return load(test_require, [ + '#import "./person.graphql"', + 'fragment enemies on Hero { enemies { ...person } }', + ].join('\n')); + case './person.graphql': + return load(test_require, 'fragment person on Person { name }\n'); + default: + return null; + }; + }; + + const result = load(test_require, [ + '#import "./friends.graphql"', + '#import "./enemies.graphql"', + 'query { hero { ...friends ...enemies } }', + ].join('\n'))!; + + assert.equal(result.kind, 'Document'); + assert.equal(result.definitions.length, 4, 'after deduplication, only 4 fragments should remain'); + assert.equal(result.definitions[0].kind, 'OperationDefinition'); + + // the rest of the definitions should be fragments and contain one of + // each: "friends", "enemies", "person". Order does not matter + const fragments = result.definitions.slice(1) as FragmentDefinitionNode[]; + assert(fragments.every(fragment => fragment.kind === 'FragmentDefinition')) + assert(fragments.some(fragment => fragment.name.value === 'friends')) + assert(fragments.some(fragment => fragment.name.value === 'enemies')) + assert(fragments.some(fragment => fragment.name.value === 'person')) + }); + }); + + // How to make this work? + // it.only('can reference a fragment passed as a document via shorthand', () => { + // const ast = gql` + // { + // user(id: 5) { + // ...${userFragmentDocument} + // } + // } + // `; + // + // assert.deepEqual(ast, gql` + // { + // user(id: 5) { + // ...UserFragment + // } + // } + // fragment UserFragment on User { + // firstName + // lastName + // } + // `); + // }); +}); diff --git a/graphql-subscription/node_modules/graphql-ws/LICENSE.md b/graphql-subscription/node_modules/graphql-ws/LICENSE.md new file mode 100644 index 0000000..8920ca2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/LICENSE.md @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2020-2021 Denis Badurina + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription/node_modules/graphql-ws/PROTOCOL.md b/graphql-subscription/node_modules/graphql-ws/PROTOCOL.md new file mode 100644 index 0000000..ca70a78 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/PROTOCOL.md @@ -0,0 +1,251 @@ +# GraphQL over WebSocket Protocol + +## Nomenclature + +- **Socket** is the main WebSocket communication channel between the _server_ and the _client_ +- **Connection** is a connection **within the established socket** describing a "connection" through which the operation requests will be communicated + +## Communication + +The WebSocket sub-protocol for this specification is: `graphql-transport-ws`. + +Messages are represented through the JSON structure and are stringified before being sent over the network. They are bidirectional, meaning both the server and the client must conform to the specified message structure. + +**All** messages contain the `type` field outlining the action this message describes. + +Messages corresponding to operations must contain the `id` field used for uniquely identifying server responses and connecting them with the client's requests. + +Multiple operations identified with separate IDs can be active at any time and their messages can be interleaved on the connection. + +The server can close the socket (kick the client off) at any time. The close event dispatched by the server is used to describe the fatal error to the client. + +The client closes the socket and the connection by dispatching a `1000: Normal Closure` close event to the server indicating a normal closure. + +## Message types + +### `ConnectionInit` + +Direction: **Client -> Server** + +Indicates that the client wants to establish a connection within the existing socket. This connection is **not** the actual WebSocket communication channel, but is rather a frame within it asking the server to allow future operation requests. + +The server must receive the connection initialisation message within the allowed waiting time specified in the `connectionInitWaitTimeout` parameter during the server setup. If the client does not request a connection within the allowed timeout, the server will close the socket with the event: `4408: Connection initialisation timeout`. + +If the server receives more than one `ConnectionInit` message at any given time, the server will close the socket with the event `4429: Too many initialisation requests`. + +If the server wishes to reject the connection, for example during authentication, it is recommended to close the socket with `4403: Forbidden`. + +```typescript +interface ConnectionInitMessage { + type: 'connection_init'; + payload?: Record | null; +} +``` + +### `ConnectionAck` + +Direction: **Server -> Client** + +Expected response to the `ConnectionInit` message from the client acknowledging a successful connection with the server. + +The server can use the optional `payload` field to transfer additional details about the connection. + +```typescript +interface ConnectionAckMessage { + type: 'connection_ack'; + payload?: Record | null; +} +``` + +The client is now **ready** to request subscription operations. + +### `Ping` + +Direction: **bidirectional** + +Useful for detecting failed connections, displaying latency metrics or other types of network probing. + +A `Pong` must be sent in response from the receiving party as soon as possible. + +The `Ping` message can be sent at any time within the established socket. + +The optional `payload` field can be used to transfer additional details about the ping. + +```typescript +interface PingMessage { + type: 'ping'; + payload?: Record | null; +} +``` + +### `Pong` + +Direction: **bidirectional** + +The response to the `Ping` message. Must be sent as soon as the `Ping` message is received. + +The `Pong` message can be sent at any time within the established socket. Furthermore, the `Pong` message may even be sent unsolicited as an unidirectional heartbeat. + +The optional `payload` field can be used to transfer additional details about the pong. + +```typescript +interface PongMessage { + type: 'pong'; + payload?: Record | null; +} +``` + +### `Subscribe` + +Direction: **Client -> Server** + +Requests an operation specified in the message `payload`. This message provides a unique ID field to connect published messages to the operation requested by this message. + +If there is already an active subscriber for an operation matching the provided ID, regardless of the operation type, the server **must** close the socket immediately with the event `4409: Subscriber for already exists`. + +The server needs only keep track of IDs for as long as the subscription is active. Once a client completes an operation, it is free to re-use that ID. + +```typescript +interface SubscribeMessage { + id: ''; + type: 'subscribe'; + payload: { + operationName?: string | null; + query: string; + variables?: Record | null; + extensions?: Record | null; + }; +} +``` + +Executing operations is allowed **only** after the server has acknowledged the connection through the `ConnectionAck` message, if the connection is not acknowledged, the socket will be closed immediately with the event `4401: Unauthorized`. + +### `Next` + +Direction: **Server -> Client** + +Operation execution result(s) from the source stream created by the binding `Subscribe` message. After all results have been emitted, the `Complete` message will follow indicating stream completion. + +```typescript +import { ExecutionResult } from 'graphql'; + +interface NextMessage { + id: ''; + type: 'next'; + payload: ExecutionResult; +} +``` + +### `Error` + +Direction: **Server -> Client** + +Operation execution error(s) in response to the `Subscribe` message. This can occur _before_ execution starts, usually due to validation errors, or _during_ the execution of the request. This message terminates the operation and no further messages will be sent. + +```typescript +import { GraphQLError } from 'graphql'; + +interface ErrorMessage { + id: ''; + type: 'error'; + payload: GraphQLError[]; +} +``` + +### `Complete` + +Direction: **bidirectional** + +- **Server -> Client** indicates that the requested operation execution has completed. If the server dispatched the `Error` message relative to the original `Subscribe` message, no `Complete` message will be emitted. + +- **Client -> Server** indicates that the client has stopped listening and wants to complete the subscription. No further events, relevant to the original subscription, should be sent through. Even if the client sent a `Complete` message for a _single-result-operation_ before it resolved, the result should not be sent through once it does. + +Note: The asynchronous nature of the full-duplex connection means that a client can send a `Complete` message to the server even when messages are in-flight to the client, or when the server has itself completed the operation (via a `Error` or `Complete` message). Both client and server must therefore be prepared to receive (and ignore) messages for operations that they consider already completed. + +```typescript +interface CompleteMessage { + id: ''; + type: 'complete'; +} +``` + +### Invalid message + +Direction: **bidirectional** + +Receiving a message of a type or format which is not specified in this document will result in an **immediate** socket closure with the event `4400: `. The `` can be vaguely descriptive on why the received message is invalid. + +Receiving a message (other than `Subscribe`) with an ID that belongs to an operation that has been previously completed does not constitute an error. It is permissable to simply ignore all _unknown_ IDs without closing the connection. + +## Examples + +For the sake of clarity, the following examples demonstrate the communication protocol. + +

    Successful connection initialisation

    + +1. _Client_ sends a WebSocket handshake request with the sub-protocol: `graphql-transport-ws` +1. _Server_ accepts the handshake and establishes a WebSocket communication channel (which we call "socket") +1. _Client_ immediately dispatches a `ConnectionInit` message optionally providing a payload as agreed with the server +1. _Server_ validates the connection initialisation request and dispatches a `ConnectionAck` message to the client on successful connection +1. _Client_ has received the acknowledgement message and is now ready to request operation executions + +### Connection initialisation timeout + +1. _Client_ sends a WebSocket handshake request with the sub-protocol: `graphql-transport-ws` +1. _Server_ accepts the handshake and establishes a WebSocket communication channel (which we call "socket") +1. _Client_ does not dispatch a `ConnectionInit` message +1. _Server_ waits for the `ConnectionInit` message for the duration specified in the `connectionInitWaitTimeout` parameter +1. _Server_ waiting time has passed +1. _Server_ closes the socket by dispatching the event `4408: Connection initialisation timeout` + +### Streaming operation + +#### `subscription` operation and queries with streaming directives + +_The client and the server has already gone through [successful connection initialisation](#successful-connection-initialisation)._ + +1. _Client_ generates a unique ID for the following operation +1. _Client_ dispatches the `Subscribe` message with the generated ID through the `id` field and the requested operation passed through the `payload` field +
    _All future communication is linked through this unique ID_ +1. _Server_ executes the streaming GraphQL operation +1. _Server_ checks if the generated ID is unique across active streaming subscriptions + + - If **not** unique, the _server_ will close the socket with the event `4409: Subscriber for already exists` + - If unique, continue... + +1. _Server_ _optionally_ checks if the operation is valid before starting executing it, e.g. checking permissions + + - If **not** valid, the _server_ sends an `Error` message and deems the operation complete. + - If valid, continue... + +1. _Server_ dispatches results over time with the `Next` message +1. - _Server_ dispatches the `Complete` message indicating that the source stream has completed + - _Client_ completes the stream observer +
    **or** + - _Client_ stops the subscription by dispatching a `Complete` message + - _Server_ receives `Complete` message and completes the source stream + - _Client_ ignores all further messages that it receives with this ID +
    **or** + - _Server_ dispatches the `Complete` message indicating that the source stream has completed + - **Simultaneously** _client_ stops the subscription by dispatching a `Complete` message + - _Client_ ignores all further messages that it receives with this ID + - _Server_ ignores the `Complete` message from the client + +### Single result operation + +#### `query` and `mutation` operations without streaming directives + +A single result operation is identical to a streaming operation except that _at most one_ `Next` message is sent. + +It shares the same name-space for IDs as streaming operations and can be multiplexed with other operations on the connection. + +_The client and the server has already gone through [successful connection initialisation](#successful-connection-initialisation)._ + +1. _Client_ generates a unique ID for the following operation +1. _Client_ dispatches the `Subscribe` message with the generated ID through the `id` field and the requested operation passed through the `payload` field +
    _All future communication is linked through this unique ID_ +1. _Server_ executes the single result GraphQL operation +1. _Server_ dispatches the result with the `Next` message +1. _Server_ dispatches the `Complete` message indicating that the execution has completed + +The _client_ may dispatch a `Complete` message at any time, just as shown in the streaming operations examples above, and the same interactions ensue. diff --git a/graphql-subscription/node_modules/graphql-ws/README.md b/graphql-subscription/node_modules/graphql-ws/README.md new file mode 100644 index 0000000..b55c98a --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/README.md @@ -0,0 +1,39 @@ +
    +
    + +![GraphQLOverWebSocket](https://user-images.githubusercontent.com/25294569/94527042-172dba00-023f-11eb-944b-88c0bd58a8d2.gif) + +
    Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
    + +[![Continuous integration](https://github.com/enisdenjo/graphql-ws/workflows/Continuous%20integration/badge.svg)](https://github.com/enisdenjo/graphql-ws/actions?query=workflow%3A%22Continuous+integration%22) [![graphql-ws](https://img.shields.io/npm/v/graphql-ws.svg?label=graphql-ws&logo=npm)](https://www.npmjs.com/package/graphql-ws) + +Use [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) instead? Check out [graphql-sse](https://github.com/enisdenjo/graphql-sse)! + +
    +
    + +## [Get started](https://the-guild.dev/graphql/ws/get-started) + +Swiftly start with the [get started guide on the website](https://the-guild.dev/graphql/ws/get-started). + +## [Recipes](https://the-guild.dev/graphql/ws/recipes) + +Short and concise code snippets for starting with common use-cases. [Available on the website.](https://the-guild.dev/graphql/ws/recipes) + +## [Documentation](https://the-guild.dev/graphql/ws/docs) + +Auto-generated by [TypeDoc](https://typedoc.org) and then [rendered on the website](https://the-guild.dev/graphql/ws/docs). + +## [How does it work?](PROTOCOL.md) + +Read about the exact transport intricacies used by the library in the [GraphQL over WebSocket Protocol document](PROTOCOL.md). + +## [Want to help?](CONTRIBUTING.md) + +File a bug, contribute with code, or improve documentation? Read up on our guidelines for [contributing](CONTRIBUTING.md) and drive development with `yarn test --watch` away! + +## Disclaimer + +This library and the [GraphQL over WebSocket Protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) are **not** cross-compatible with the [deprecated `subscriptions-transport-ws`](https://github.com/apollographql/subscriptions-transport-ws) and its [accompanying Protocol](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md). + +You must use `graphql-ws` coherently and implement the [GraphQL over WebSocket Protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md) on both sides, server and the client. diff --git a/graphql-subscription/node_modules/graphql-ws/lib/client.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/client.d.mts new file mode 100644 index 0000000..1d664c5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/client.d.mts @@ -0,0 +1,407 @@ +/** + * + * client + * + */ +import { ExecutionResult } from 'graphql'; +import { Sink, ID, Disposable, Message, ConnectionInitMessage, ConnectionAckMessage, PingMessage, PongMessage, SubscribePayload, JSONMessageReviver, JSONMessageReplacer } from './common.mjs'; +/** This file is the entry point for browsers, re-export common elements. */ +export * from './common.mjs'; +/** + * WebSocket started connecting. + * + * @category Client + */ +export type EventConnecting = 'connecting'; +/** + * WebSocket has opened. + * + * @category Client + */ +export type EventOpened = 'opened'; +/** + * Open WebSocket connection has been acknowledged. + * + * @category Client + */ +export type EventConnected = 'connected'; +/** + * `PingMessage` has been received or sent. + * + * @category Client + */ +export type EventPing = 'ping'; +/** + * `PongMessage` has been received or sent. + * + * @category Client + */ +export type EventPong = 'pong'; +/** + * A message has been received. + * + * @category Client + */ +export type EventMessage = 'message'; +/** + * WebSocket connection has closed. + * + * @category Client + */ +export type EventClosed = 'closed'; +/** + * WebSocket connection had an error or client had an internal error. + * + * @category Client + */ +export type EventError = 'error'; +/** + * All events that could occur. + * + * @category Client + */ +export type Event = EventConnecting | EventOpened | EventConnected | EventPing | EventPong | EventMessage | EventClosed | EventError; +/** @category Client */ +export type EventConnectingListener = (isRetry: boolean) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventOpenedListener = (socket: unknown) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * Also, the second argument is the optional payload that the server may + * send through the `ConnectionAck` message. + * + * @category Client + */ +export type EventConnectedListener = (socket: unknown, payload: ConnectionAckMessage['payload'], wasRetry: boolean) => void; +/** + * The first argument communicates whether the ping was received from the server. + * If `false`, the ping was sent by the client. + * + * @category Client + */ +export type EventPingListener = (received: boolean, payload: PingMessage['payload']) => void; +/** + * The first argument communicates whether the pong was received from the server. + * If `false`, the pong was sent by the client. + * + * @category Client + */ +export type EventPongListener = (received: boolean, payload: PongMessage['payload']) => void; +/** + * Called for all **valid** messages received by the client. Mainly useful for + * debugging and logging received messages. + * + * @category Client + */ +export type EventMessageListener = (message: Message) => void; +/** + * The argument is actually the websocket `CloseEvent`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventClosedListener = (event: unknown) => void; +/** + * Events dispatched from the WebSocket `onerror` are handled in this listener, + * as well as all internal client errors that could throw. + * + * @category Client + */ +export type EventErrorListener = (error: unknown) => void; +/** @category Client */ +export type EventListener = E extends EventConnecting ? EventConnectingListener : E extends EventOpened ? EventOpenedListener : E extends EventConnected ? EventConnectedListener : E extends EventPing ? EventPingListener : E extends EventPong ? EventPongListener : E extends EventMessage ? EventMessageListener : E extends EventClosed ? EventClosedListener : E extends EventError ? EventErrorListener : never; +/** + * Configuration used for the GraphQL over WebSocket client. + * + * @category Client + */ +export interface ClientOptions

    { + /** + * URL of the GraphQL over WebSocket Protocol compliant server to connect. + * + * If the option is a function, it will be called on every WebSocket connection attempt. + * Returning a promise is supported too and the connecting phase will stall until it + * resolves with the URL. + * + * A good use-case for having a function is when using the URL for authentication, + * where subsequent reconnects (due to auth) may have a refreshed identity token in + * the URL. + */ + url: string | (() => Promise | string); + /** + * Optional parameters, passed through the `payload` field with the `ConnectionInit` message, + * that the client specifies when establishing a connection with the server. You can use this + * for securely passing arguments for authentication. + * + * If you decide to return a promise, keep in mind that the server might kick you off if it + * takes too long to resolve! Check the `connectionInitWaitTimeout` on the server for more info. + * + * Throwing an error from within this function will close the socket with the `Error` message + * in the close event reason. + */ + connectionParams?: P | (() => Promise

    | P); + /** + * Controls when should the connection be established. + * + * - `false`: Establish a connection immediately. Use `onNonLazyError` to handle errors. + * - `true`: Establish a connection on first subscribe and close on last unsubscribe. Use + * the subscription sink's `error` to handle errors. + * + * @default true + */ + lazy?: boolean; + /** + * Used ONLY when the client is in non-lazy mode (`lazy = false`). When + * using this mode, the errors might have no sinks to report to; however, + * to avoid swallowing errors, consider using `onNonLazyError`, which will + * be called when either: + * - An unrecoverable error/close event occurs + * - Silent retry attempts have been exceeded + * + * After a client has errored out, it will NOT perform any automatic actions. + * + * The argument can be a websocket `CloseEvent` or an `Error`. To avoid bundling + * DOM types, you should derive and assert the correct type. When receiving: + * - A `CloseEvent`: retry attempts have been exceeded or the specific + * close event is labeled as fatal (read more in `retryAttempts`). + * - An `Error`: some internal issue has occured, all internal errors are + * fatal by nature. + * + * @default console.error + */ + onNonLazyError?: (errorOrCloseEvent: unknown) => void; + /** + * How long should the client wait before closing the socket after the last oparation has + * completed. This is meant to be used in combination with `lazy`. You might want to have + * a calmdown time before actually closing the connection. Kinda' like a lazy close "debounce". + * + * @default 0 + */ + lazyCloseTimeout?: number; + /** + * The timout between dispatched keep-alive messages, naimly server pings. Internally + * dispatches the `PingMessage` type to the server and expects a `PongMessage` in response. + * This helps with making sure that the connection with the server is alive and working. + * + * Timeout countdown starts from the moment the socket was opened and subsequently + * after every received `PongMessage`. + * + * Note that NOTHING will happen automatically with the client if the server never + * responds to a `PingMessage` with a `PongMessage`. If you want the connection to close, + * you should implement your own logic on top of the client. A simple example looks like this: + * + * ```js + * import { createClient } from 'graphql-ws'; + * + * let activeSocket, timedOut; + * createClient({ + * url: 'ws://i.time.out:4000/after-5/seconds', + * keepAlive: 10_000, // ping server every 10 seconds + * on: { + * connected: (socket) => (activeSocket = socket), + * ping: (received) => { + * if (!received) // sent + * timedOut = setTimeout(() => { + * if (activeSocket.readyState === WebSocket.OPEN) + * activeSocket.close(4408, 'Request Timeout'); + * }, 5_000); // wait 5 seconds for the pong and then close the connection + * }, + * pong: (received) => { + * if (received) clearTimeout(timedOut); // pong is received, clear connection close timeout + * }, + * }, + * }); + * ``` + * + * @default 0 + */ + keepAlive?: number; + /** + * The amount of time for which the client will wait + * for `ConnectionAck` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the server + * has not responded with `ConnectionAck` message, + * the client will terminate the socket by + * dispatching a close event `4418: Connection acknowledgement timeout` + * + * @default 0 + */ + connectionAckWaitTimeout?: number; + /** + * Disable sending the `PongMessage` automatically. + * + * Useful for when integrating your own custom client pinger that performs + * custom actions before responding to a ping, or to pass along the optional pong + * message payload. Please check the readme recipes for a concrete example. + */ + disablePong?: boolean; + /** + * How many times should the client try to reconnect on abnormal socket closure before it errors out? + * + * The library classifies the following close events as fatal: + * - _All internal WebSocket fatal close codes (check `isFatalInternalCloseCode` in `src/client.ts` for exact list)_ + * - `4500: Internal server error` + * - `4005: Internal client error` + * - `4400: Bad request` + * - `4004: Bad response` + * - `4401: Unauthorized` _tried subscribing before connect ack_ + * - `4406: Subprotocol not acceptable` + * - `4409: Subscriber for already exists` _distinction is very important_ + * - `4429: Too many initialisation requests` + * + * In addition to the aforementioned close events, any _non-CloseEvent_ connection problem + * is considered fatal by default. However, this specific behaviour can be altered by using + * the `shouldRetry` option. + * + * These events are reported immediately and the client will not reconnect. + * + * @default 5 + */ + retryAttempts?: number; + /** + * Control the wait time between retries. You may implement your own strategy + * by timing the resolution of the returned promise with the retries count. + * `retries` argument counts actual connection attempts, so it will begin with + * 0 after the first retryable disconnect. + * + * @default 'Randomised exponential backoff' + */ + retryWait?: (retries: number) => Promise; + /** + * Check if the close event or connection error is fatal. If you return `false`, + * the client will fail immediately without additional retries; however, if you + * return `true`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is whatever has been thrown during the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned here. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Only `CloseEvent`s' + */ + shouldRetry?: (errOrCloseEvent: unknown) => boolean; + /** + * @deprecated Use `shouldRetry` instead. + * + * Check if the close event or connection error is fatal. If you return `true`, + * the client will fail immediately without additional retries; however, if you + * return `false`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is either a WebSocket `CloseEvent` or an error thrown during + * the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Any non-`CloseEvent`' + */ + isFatalConnectionProblem?: (errOrCloseEvent: unknown) => boolean; + /** + * Register listeners before initialising the client. This way + * you can ensure to catch all client relevant emitted events. + * + * The listeners passed in will **always** be the first ones + * to get the emitted event before other registered listeners. + */ + on?: Partial<{ + [event in Event]: EventListener; + }>; + /** + * A custom WebSocket implementation to use instead of the + * one provided by the global scope. Mostly useful for when + * using the client outside of the browser environment. + */ + webSocketImpl?: unknown; + /** + * A custom ID generator for identifying subscriptions. + * + * The default generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID?: (payload: SubscribePayload) => ID; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this client. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages from this client. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Client */ +export interface Client extends Disposable { + /** + * Listens on the client which dispatches events about the socket state. + */ + on(event: E, listener: EventListener): () => void; + /** + * Subscribes through the WebSocket following the config parameters. It + * uses the `sink` to emit received data or errors. Returns a _cleanup_ + * function used for dropping the subscription and cleaning stuff up. + */ + subscribe, Extensions = unknown>(payload: SubscribePayload, sink: Sink>): () => void; + /** + * Subscribes and iterates over emitted results from the WebSocket + * through the returned async iterator. + */ + iterate, Extensions = unknown>(payload: SubscribePayload): AsyncIterableIterator>; + /** + * Terminates the WebSocket abruptly and immediately. + * + * A close event `4499: Terminated` is issued to the current WebSocket and a + * syntetic {@link TerminatedCloseEvent} is immediately emitted without waiting for + * the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ + terminate(): void; +} +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +export declare function createClient

    (options: ClientOptions

    ): Client; +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +export declare class TerminatedCloseEvent extends Error { + name: string; + message: string; + code: number; + reason: string; + wasClean: boolean; +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/client.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/client.d.ts new file mode 100644 index 0000000..c077ed6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/client.d.ts @@ -0,0 +1,407 @@ +/** + * + * client + * + */ +import { ExecutionResult } from 'graphql'; +import { Sink, ID, Disposable, Message, ConnectionInitMessage, ConnectionAckMessage, PingMessage, PongMessage, SubscribePayload, JSONMessageReviver, JSONMessageReplacer } from './common'; +/** This file is the entry point for browsers, re-export common elements. */ +export * from './common'; +/** + * WebSocket started connecting. + * + * @category Client + */ +export type EventConnecting = 'connecting'; +/** + * WebSocket has opened. + * + * @category Client + */ +export type EventOpened = 'opened'; +/** + * Open WebSocket connection has been acknowledged. + * + * @category Client + */ +export type EventConnected = 'connected'; +/** + * `PingMessage` has been received or sent. + * + * @category Client + */ +export type EventPing = 'ping'; +/** + * `PongMessage` has been received or sent. + * + * @category Client + */ +export type EventPong = 'pong'; +/** + * A message has been received. + * + * @category Client + */ +export type EventMessage = 'message'; +/** + * WebSocket connection has closed. + * + * @category Client + */ +export type EventClosed = 'closed'; +/** + * WebSocket connection had an error or client had an internal error. + * + * @category Client + */ +export type EventError = 'error'; +/** + * All events that could occur. + * + * @category Client + */ +export type Event = EventConnecting | EventOpened | EventConnected | EventPing | EventPong | EventMessage | EventClosed | EventError; +/** @category Client */ +export type EventConnectingListener = (isRetry: boolean) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventOpenedListener = (socket: unknown) => void; +/** + * The first argument is actually the `WebSocket`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * Also, the second argument is the optional payload that the server may + * send through the `ConnectionAck` message. + * + * @category Client + */ +export type EventConnectedListener = (socket: unknown, payload: ConnectionAckMessage['payload'], wasRetry: boolean) => void; +/** + * The first argument communicates whether the ping was received from the server. + * If `false`, the ping was sent by the client. + * + * @category Client + */ +export type EventPingListener = (received: boolean, payload: PingMessage['payload']) => void; +/** + * The first argument communicates whether the pong was received from the server. + * If `false`, the pong was sent by the client. + * + * @category Client + */ +export type EventPongListener = (received: boolean, payload: PongMessage['payload']) => void; +/** + * Called for all **valid** messages received by the client. Mainly useful for + * debugging and logging received messages. + * + * @category Client + */ +export type EventMessageListener = (message: Message) => void; +/** + * The argument is actually the websocket `CloseEvent`, but to avoid + * bundling DOM typings because the client can run in Node env too, + * you should assert the websocket type during implementation. + * + * @category Client + */ +export type EventClosedListener = (event: unknown) => void; +/** + * Events dispatched from the WebSocket `onerror` are handled in this listener, + * as well as all internal client errors that could throw. + * + * @category Client + */ +export type EventErrorListener = (error: unknown) => void; +/** @category Client */ +export type EventListener = E extends EventConnecting ? EventConnectingListener : E extends EventOpened ? EventOpenedListener : E extends EventConnected ? EventConnectedListener : E extends EventPing ? EventPingListener : E extends EventPong ? EventPongListener : E extends EventMessage ? EventMessageListener : E extends EventClosed ? EventClosedListener : E extends EventError ? EventErrorListener : never; +/** + * Configuration used for the GraphQL over WebSocket client. + * + * @category Client + */ +export interface ClientOptions

    { + /** + * URL of the GraphQL over WebSocket Protocol compliant server to connect. + * + * If the option is a function, it will be called on every WebSocket connection attempt. + * Returning a promise is supported too and the connecting phase will stall until it + * resolves with the URL. + * + * A good use-case for having a function is when using the URL for authentication, + * where subsequent reconnects (due to auth) may have a refreshed identity token in + * the URL. + */ + url: string | (() => Promise | string); + /** + * Optional parameters, passed through the `payload` field with the `ConnectionInit` message, + * that the client specifies when establishing a connection with the server. You can use this + * for securely passing arguments for authentication. + * + * If you decide to return a promise, keep in mind that the server might kick you off if it + * takes too long to resolve! Check the `connectionInitWaitTimeout` on the server for more info. + * + * Throwing an error from within this function will close the socket with the `Error` message + * in the close event reason. + */ + connectionParams?: P | (() => Promise

    | P); + /** + * Controls when should the connection be established. + * + * - `false`: Establish a connection immediately. Use `onNonLazyError` to handle errors. + * - `true`: Establish a connection on first subscribe and close on last unsubscribe. Use + * the subscription sink's `error` to handle errors. + * + * @default true + */ + lazy?: boolean; + /** + * Used ONLY when the client is in non-lazy mode (`lazy = false`). When + * using this mode, the errors might have no sinks to report to; however, + * to avoid swallowing errors, consider using `onNonLazyError`, which will + * be called when either: + * - An unrecoverable error/close event occurs + * - Silent retry attempts have been exceeded + * + * After a client has errored out, it will NOT perform any automatic actions. + * + * The argument can be a websocket `CloseEvent` or an `Error`. To avoid bundling + * DOM types, you should derive and assert the correct type. When receiving: + * - A `CloseEvent`: retry attempts have been exceeded or the specific + * close event is labeled as fatal (read more in `retryAttempts`). + * - An `Error`: some internal issue has occured, all internal errors are + * fatal by nature. + * + * @default console.error + */ + onNonLazyError?: (errorOrCloseEvent: unknown) => void; + /** + * How long should the client wait before closing the socket after the last oparation has + * completed. This is meant to be used in combination with `lazy`. You might want to have + * a calmdown time before actually closing the connection. Kinda' like a lazy close "debounce". + * + * @default 0 + */ + lazyCloseTimeout?: number; + /** + * The timout between dispatched keep-alive messages, naimly server pings. Internally + * dispatches the `PingMessage` type to the server and expects a `PongMessage` in response. + * This helps with making sure that the connection with the server is alive and working. + * + * Timeout countdown starts from the moment the socket was opened and subsequently + * after every received `PongMessage`. + * + * Note that NOTHING will happen automatically with the client if the server never + * responds to a `PingMessage` with a `PongMessage`. If you want the connection to close, + * you should implement your own logic on top of the client. A simple example looks like this: + * + * ```js + * import { createClient } from 'graphql-ws'; + * + * let activeSocket, timedOut; + * createClient({ + * url: 'ws://i.time.out:4000/after-5/seconds', + * keepAlive: 10_000, // ping server every 10 seconds + * on: { + * connected: (socket) => (activeSocket = socket), + * ping: (received) => { + * if (!received) // sent + * timedOut = setTimeout(() => { + * if (activeSocket.readyState === WebSocket.OPEN) + * activeSocket.close(4408, 'Request Timeout'); + * }, 5_000); // wait 5 seconds for the pong and then close the connection + * }, + * pong: (received) => { + * if (received) clearTimeout(timedOut); // pong is received, clear connection close timeout + * }, + * }, + * }); + * ``` + * + * @default 0 + */ + keepAlive?: number; + /** + * The amount of time for which the client will wait + * for `ConnectionAck` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the server + * has not responded with `ConnectionAck` message, + * the client will terminate the socket by + * dispatching a close event `4418: Connection acknowledgement timeout` + * + * @default 0 + */ + connectionAckWaitTimeout?: number; + /** + * Disable sending the `PongMessage` automatically. + * + * Useful for when integrating your own custom client pinger that performs + * custom actions before responding to a ping, or to pass along the optional pong + * message payload. Please check the readme recipes for a concrete example. + */ + disablePong?: boolean; + /** + * How many times should the client try to reconnect on abnormal socket closure before it errors out? + * + * The library classifies the following close events as fatal: + * - _All internal WebSocket fatal close codes (check `isFatalInternalCloseCode` in `src/client.ts` for exact list)_ + * - `4500: Internal server error` + * - `4005: Internal client error` + * - `4400: Bad request` + * - `4004: Bad response` + * - `4401: Unauthorized` _tried subscribing before connect ack_ + * - `4406: Subprotocol not acceptable` + * - `4409: Subscriber for already exists` _distinction is very important_ + * - `4429: Too many initialisation requests` + * + * In addition to the aforementioned close events, any _non-CloseEvent_ connection problem + * is considered fatal by default. However, this specific behaviour can be altered by using + * the `shouldRetry` option. + * + * These events are reported immediately and the client will not reconnect. + * + * @default 5 + */ + retryAttempts?: number; + /** + * Control the wait time between retries. You may implement your own strategy + * by timing the resolution of the returned promise with the retries count. + * `retries` argument counts actual connection attempts, so it will begin with + * 0 after the first retryable disconnect. + * + * @default 'Randomised exponential backoff' + */ + retryWait?: (retries: number) => Promise; + /** + * Check if the close event or connection error is fatal. If you return `false`, + * the client will fail immediately without additional retries; however, if you + * return `true`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is whatever has been thrown during the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned here. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Only `CloseEvent`s' + */ + shouldRetry?: (errOrCloseEvent: unknown) => boolean; + /** + * @deprecated Use `shouldRetry` instead. + * + * Check if the close event or connection error is fatal. If you return `true`, + * the client will fail immediately without additional retries; however, if you + * return `false`, the client will keep retrying until the `retryAttempts` have + * been exceeded. + * + * The argument is either a WebSocket `CloseEvent` or an error thrown during + * the connection phase. + * + * Beware, the library classifies a few close events as fatal regardless of + * what is returned. They are listed in the documentation of the `retryAttempts` + * option. + * + * @default 'Any non-`CloseEvent`' + */ + isFatalConnectionProblem?: (errOrCloseEvent: unknown) => boolean; + /** + * Register listeners before initialising the client. This way + * you can ensure to catch all client relevant emitted events. + * + * The listeners passed in will **always** be the first ones + * to get the emitted event before other registered listeners. + */ + on?: Partial<{ + [event in Event]: EventListener; + }>; + /** + * A custom WebSocket implementation to use instead of the + * one provided by the global scope. Mostly useful for when + * using the client outside of the browser environment. + */ + webSocketImpl?: unknown; + /** + * A custom ID generator for identifying subscriptions. + * + * The default generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID?: (payload: SubscribePayload) => ID; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this client. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages from this client. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Client */ +export interface Client extends Disposable { + /** + * Listens on the client which dispatches events about the socket state. + */ + on(event: E, listener: EventListener): () => void; + /** + * Subscribes through the WebSocket following the config parameters. It + * uses the `sink` to emit received data or errors. Returns a _cleanup_ + * function used for dropping the subscription and cleaning stuff up. + */ + subscribe, Extensions = unknown>(payload: SubscribePayload, sink: Sink>): () => void; + /** + * Subscribes and iterates over emitted results from the WebSocket + * through the returned async iterator. + */ + iterate, Extensions = unknown>(payload: SubscribePayload): AsyncIterableIterator>; + /** + * Terminates the WebSocket abruptly and immediately. + * + * A close event `4499: Terminated` is issued to the current WebSocket and a + * syntetic {@link TerminatedCloseEvent} is immediately emitted without waiting for + * the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ + terminate(): void; +} +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +export declare function createClient

    (options: ClientOptions

    ): Client; +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +export declare class TerminatedCloseEvent extends Error { + name: string; + message: string; + code: number; + reason: string; + wasClean: boolean; +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/client.js b/graphql-subscription/node_modules/graphql-ws/lib/client.js new file mode 100644 index 0000000..c1a5c6e --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/client.js @@ -0,0 +1,575 @@ +"use strict"; +/** + * + * client + * + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } +var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TerminatedCloseEvent = exports.createClient = void 0; +const common_1 = require("./common"); +const utils_1 = require("./utils"); +/** This file is the entry point for browsers, re-export common elements. */ +__exportStar(require("./common"), exports); +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +function createClient(options) { + const { url, connectionParams, lazy = true, onNonLazyError = console.error, lazyCloseTimeout: lazyCloseTimeoutMs = 0, keepAlive = 0, disablePong, connectionAckWaitTimeout = 0, retryAttempts = 5, retryWait = async function randomisedExponentialBackoff(retries) { + let retryDelay = 1000; // start with 1s delay + for (let i = 0; i < retries; i++) { + retryDelay *= 2; + } + await new Promise((resolve) => setTimeout(resolve, retryDelay + + // add random timeout from 300ms to 3s + Math.floor(Math.random() * (3000 - 300) + 300))); + }, shouldRetry = isLikeCloseEvent, isFatalConnectionProblem, on, webSocketImpl, + /** + * Generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID = function generateUUID() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); + }, jsonMessageReplacer: replacer, jsonMessageReviver: reviver, } = options; + let ws; + if (webSocketImpl) { + if (!isWebSocket(webSocketImpl)) { + throw new Error('Invalid WebSocket implementation provided'); + } + ws = webSocketImpl; + } + else if (typeof WebSocket !== 'undefined') { + ws = WebSocket; + } + else if (typeof global !== 'undefined') { + ws = + global.WebSocket || + // @ts-expect-error: Support more browsers + global.MozWebSocket; + } + else if (typeof window !== 'undefined') { + ws = + window.WebSocket || + // @ts-expect-error: Support more browsers + window.MozWebSocket; + } + if (!ws) + throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`"); + const WebSocketImpl = ws; + // websocket status emitter, subscriptions are handled differently + const emitter = (() => { + const message = (() => { + const listeners = {}; + return { + on(id, listener) { + listeners[id] = listener; + return () => { + delete listeners[id]; + }; + }, + emit(message) { + var _a; + if ('id' in message) + (_a = listeners[message.id]) === null || _a === void 0 ? void 0 : _a.call(listeners, message); + }, + }; + })(); + const listeners = { + connecting: (on === null || on === void 0 ? void 0 : on.connecting) ? [on.connecting] : [], + opened: (on === null || on === void 0 ? void 0 : on.opened) ? [on.opened] : [], + connected: (on === null || on === void 0 ? void 0 : on.connected) ? [on.connected] : [], + ping: (on === null || on === void 0 ? void 0 : on.ping) ? [on.ping] : [], + pong: (on === null || on === void 0 ? void 0 : on.pong) ? [on.pong] : [], + message: (on === null || on === void 0 ? void 0 : on.message) ? [message.emit, on.message] : [message.emit], + closed: (on === null || on === void 0 ? void 0 : on.closed) ? [on.closed] : [], + error: (on === null || on === void 0 ? void 0 : on.error) ? [on.error] : [], + }; + return { + onMessage: message.on, + on(event, listener) { + const l = listeners[event]; + l.push(listener); + return () => { + l.splice(l.indexOf(listener), 1); + }; + }, + emit(event, ...args) { + // we copy the listeners so that unlistens dont "pull the rug under our feet" + for (const listener of [...listeners[event]]) { + // @ts-expect-error: The args should fit + listener(...args); + } + }, + }; + })(); + // invokes the callback either when an error or closed event is emitted, + // first one that gets called prevails, other emissions are ignored + function errorOrClosed(cb) { + const listening = [ + // errors are fatal and more critical than close events, throw them first + emitter.on('error', (err) => { + listening.forEach((unlisten) => unlisten()); + cb(err); + }), + // closes can be graceful and not fatal, throw them second (if error didnt throw) + emitter.on('closed', (event) => { + listening.forEach((unlisten) => unlisten()); + cb(event); + }), + ]; + } + let connecting, locks = 0, lazyCloseTimeout, retrying = false, retries = 0, disposed = false; + async function connect() { + // clear the lazy close timeout immediatelly so that close gets debounced + // see: https://github.com/enisdenjo/graphql-ws/issues/388 + clearTimeout(lazyCloseTimeout); + const [socket, throwOnClose] = await (connecting !== null && connecting !== void 0 ? connecting : (connecting = new Promise((connected, denied) => (async () => { + if (retrying) { + await retryWait(retries); + // subscriptions might complete while waiting for retry + if (!locks) { + connecting = undefined; + return denied({ code: 1000, reason: 'All Subscriptions Gone' }); + } + retries++; + } + emitter.emit('connecting', retrying); + const socket = new WebSocketImpl(typeof url === 'function' ? await url() : url, common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL); + let connectionAckTimeout, queuedPing; + function enqueuePing() { + if (isFinite(keepAlive) && keepAlive > 0) { + clearTimeout(queuedPing); // in case where a pong was received before a ping (this is valid behaviour) + queuedPing = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) { + socket.send((0, common_1.stringifyMessage)({ type: common_1.MessageType.Ping })); + emitter.emit('ping', false, undefined); + } + }, keepAlive); + } + } + errorOrClosed((errOrEvent) => { + connecting = undefined; + clearTimeout(connectionAckTimeout); + clearTimeout(queuedPing); + denied(errOrEvent); + if (errOrEvent instanceof TerminatedCloseEvent) { + socket.close(4499, 'Terminated'); // close event is artificial and emitted manually, see `Client.terminate()` below + socket.onerror = null; + socket.onclose = null; + } + }); + socket.onerror = (err) => emitter.emit('error', err); + socket.onclose = (event) => emitter.emit('closed', event); + socket.onopen = async () => { + try { + emitter.emit('opened', socket); + const payload = typeof connectionParams === 'function' + ? await connectionParams() + : connectionParams; + // connectionParams might take too long causing the server to kick off the client + // the necessary error/close event is already reported - simply stop execution + if (socket.readyState !== WebSocketImpl.OPEN) + return; + socket.send((0, common_1.stringifyMessage)(payload + ? { + type: common_1.MessageType.ConnectionInit, + payload, + } + : { + type: common_1.MessageType.ConnectionInit, + // payload is completely absent if not provided + }, replacer)); + if (isFinite(connectionAckWaitTimeout) && + connectionAckWaitTimeout > 0) { + connectionAckTimeout = setTimeout(() => { + socket.close(common_1.CloseCode.ConnectionAcknowledgementTimeout, 'Connection acknowledgement timeout'); + }, connectionAckWaitTimeout); + } + enqueuePing(); // enqueue ping (noop if disabled) + } + catch (err) { + emitter.emit('error', err); + socket.close(common_1.CloseCode.InternalClientError, (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : new Error(err).message, 'Internal client error')); + } + }; + let acknowledged = false; + socket.onmessage = ({ data }) => { + try { + const message = (0, common_1.parseMessage)(data, reviver); + emitter.emit('message', message); + if (message.type === 'ping' || message.type === 'pong') { + emitter.emit(message.type, true, message.payload); // received + if (message.type === 'pong') { + enqueuePing(); // enqueue next ping (noop if disabled) + } + else if (!disablePong) { + // respond with pong on ping + socket.send((0, common_1.stringifyMessage)(message.payload + ? { + type: common_1.MessageType.Pong, + payload: message.payload, + } + : { + type: common_1.MessageType.Pong, + // payload is completely absent if not provided + })); + emitter.emit('pong', false, message.payload); + } + return; // ping and pongs can be received whenever + } + if (acknowledged) + return; // already connected and acknowledged + if (message.type !== common_1.MessageType.ConnectionAck) + throw new Error(`First message cannot be of type ${message.type}`); + clearTimeout(connectionAckTimeout); + acknowledged = true; + emitter.emit('connected', socket, message.payload, retrying); // connected = socket opened + acknowledged + retrying = false; // future lazy connects are not retries + retries = 0; // reset the retries on connect + connected([ + socket, + new Promise((_, reject) => errorOrClosed(reject)), + ]); + } + catch (err) { + socket.onmessage = null; // stop reading messages as soon as reading breaks once + emitter.emit('error', err); + socket.close(common_1.CloseCode.BadResponse, (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : new Error(err).message, 'Bad response')); + } + }; + })()))); + // if the provided socket is in a closing state, wait for the throw on close + if (socket.readyState === WebSocketImpl.CLOSING) + await throwOnClose; + let release = () => { + // releases this connection + }; + const released = new Promise((resolve) => (release = resolve)); + return [ + socket, + release, + Promise.race([ + // wait for + released.then(() => { + if (!locks) { + // and if no more locks are present, complete the connection + const complete = () => socket.close(1000, 'Normal Closure'); + if (isFinite(lazyCloseTimeoutMs) && lazyCloseTimeoutMs > 0) { + // if the keepalive is set, allow for the specified calmdown time and + // then complete if the socket is still open. + lazyCloseTimeout = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) + complete(); + }, lazyCloseTimeoutMs); + } + else { + // otherwise complete immediately + complete(); + } + } + }), + // or + throwOnClose, + ]), + ]; + } + /** + * Checks the `connect` problem and evaluates if the client should retry. + */ + function shouldRetryConnectOrThrow(errOrCloseEvent) { + // some close codes are worth reporting immediately + if (isLikeCloseEvent(errOrCloseEvent) && + (isFatalInternalCloseCode(errOrCloseEvent.code) || + [ + common_1.CloseCode.InternalServerError, + common_1.CloseCode.InternalClientError, + common_1.CloseCode.BadRequest, + common_1.CloseCode.BadResponse, + common_1.CloseCode.Unauthorized, + // CloseCode.Forbidden, might grant access out after retry + common_1.CloseCode.SubprotocolNotAcceptable, + // CloseCode.ConnectionInitialisationTimeout, might not time out after retry + // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry + common_1.CloseCode.SubscriberAlreadyExists, + common_1.CloseCode.TooManyInitialisationRequests, + // 4499, // Terminated, probably because the socket froze, we want to retry + ].includes(errOrCloseEvent.code))) + throw errOrCloseEvent; + // client was disposed, no retries should proceed regardless + if (disposed) + return false; + // normal closure (possibly all subscriptions have completed) + // if no locks were acquired in the meantime, shouldnt try again + if (isLikeCloseEvent(errOrCloseEvent) && errOrCloseEvent.code === 1000) + return locks > 0; + // retries are not allowed or we tried to many times, report error + if (!retryAttempts || retries >= retryAttempts) + throw errOrCloseEvent; + // throw non-retryable connection problems + if (!shouldRetry(errOrCloseEvent)) + throw errOrCloseEvent; + // @deprecated throw fatal connection problems immediately + if (isFatalConnectionProblem === null || isFatalConnectionProblem === void 0 ? void 0 : isFatalConnectionProblem(errOrCloseEvent)) + throw errOrCloseEvent; + // looks good, start retrying + return (retrying = true); + } + // in non-lazy (hot?) mode always hold one connection lock to persist the socket + if (!lazy) { + (async () => { + locks++; + for (;;) { + try { + const [, , throwOnClose] = await connect(); + await throwOnClose; // will always throw because releaser is not used + } + catch (errOrCloseEvent) { + try { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + catch (errOrCloseEvent) { + // report thrown error, no further retries + return onNonLazyError === null || onNonLazyError === void 0 ? void 0 : onNonLazyError(errOrCloseEvent); + } + } + } + })(); + } + function subscribe(payload, sink) { + const id = generateID(payload); + let done = false, errored = false, releaser = () => { + // for handling completions before connect + locks--; + done = true; + }; + (async () => { + locks++; + for (;;) { + try { + const [socket, release, waitForReleaseOrThrowOnClose] = await connect(); + // if done while waiting for connect, release the connection lock right away + if (done) + return release(); + const unlisten = emitter.onMessage(id, (message) => { + switch (message.type) { + case common_1.MessageType.Next: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- payload will fit type + sink.next(message.payload); + return; + } + case common_1.MessageType.Error: { + (errored = true), (done = true); + sink.error(message.payload); + releaser(); + return; + } + case common_1.MessageType.Complete: { + done = true; + releaser(); // release completes the sink + return; + } + } + }); + socket.send((0, common_1.stringifyMessage)({ + id, + type: common_1.MessageType.Subscribe, + payload, + }, replacer)); + releaser = () => { + if (!done && socket.readyState === WebSocketImpl.OPEN) + // if not completed already and socket is open, send complete message to server on release + socket.send((0, common_1.stringifyMessage)({ + id, + type: common_1.MessageType.Complete, + }, replacer)); + locks--; + done = true; + release(); + }; + // either the releaser will be called, connection completed and + // the promise resolved or the socket closed and the promise rejected. + // whatever happens though, we want to stop listening for messages + await waitForReleaseOrThrowOnClose.finally(unlisten); + return; // completed, shouldnt try again + } + catch (errOrCloseEvent) { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + } + })() + .then(() => { + // delivering either an error or a complete terminates the sequence + if (!errored) + sink.complete(); + }) // resolves on release or normal closure + .catch((err) => { + sink.error(err); + }); // rejects on close events and errors + return () => { + // dispose only of active subscriptions + if (!done) + releaser(); + }; + } + return { + on: emitter.on, + subscribe, + iterate(request) { + const pending = []; + const deferred = { + done: false, + error: null, + resolve: () => { + // noop + }, + }; + const dispose = subscribe(request, { + next(val) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + pending.push(val); + deferred.resolve(); + }, + error(err) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + }, + complete() { + deferred.done = true; + deferred.resolve(); + }, + }); + const iterator = (function iterator() { + return __asyncGenerator(this, arguments, function* iterator_1() { + for (;;) { + if (!pending.length) { + // only wait if there are no pending messages available + yield __await(new Promise((resolve) => (deferred.resolve = resolve))); + } + // first flush + while (pending.length) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + yield yield __await(pending.shift()); + } + // then error + if (deferred.error) { + throw deferred.error; + } + // or complete + if (deferred.done) { + return yield __await(void 0); + } + } + }); + })(); + iterator.throw = async (err) => { + if (!deferred.done) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + } + return { done: true, value: undefined }; + }; + iterator.return = async () => { + dispose(); + return { done: true, value: undefined }; + }; + return iterator; + }, + async dispose() { + disposed = true; + if (connecting) { + // if there is a connection, close it + const [socket] = await connecting; + socket.close(1000, 'Normal Closure'); + } + }, + terminate() { + if (connecting) { + // only if there is a connection + emitter.emit('closed', new TerminatedCloseEvent()); + } + }, + }; +} +exports.createClient = createClient; +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +class TerminatedCloseEvent extends Error { + constructor() { + super(...arguments); + this.name = 'TerminatedCloseEvent'; + this.message = '4499: Terminated'; + this.code = 4499; + this.reason = 'Terminated'; + this.wasClean = false; + } +} +exports.TerminatedCloseEvent = TerminatedCloseEvent; +function isLikeCloseEvent(val) { + return (0, utils_1.isObject)(val) && 'code' in val && 'reason' in val; +} +function isFatalInternalCloseCode(code) { + if ([ + 1000, + 1001, + 1006, + 1005, + 1012, + 1013, + 1014, // Bad Gateway + ].includes(code)) + return false; + // all other internal errors are fatal + return code >= 1000 && code <= 1999; +} +function isWebSocket(val) { + return (typeof val === 'function' && + 'constructor' in val && + 'CLOSED' in val && + 'CLOSING' in val && + 'CONNECTING' in val && + 'OPEN' in val); +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/client.mjs b/graphql-subscription/node_modules/graphql-ws/lib/client.mjs new file mode 100644 index 0000000..0ad440c --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/client.mjs @@ -0,0 +1,556 @@ +/** + * + * client + * + */ +var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } +var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +}; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, CloseCode, MessageType, parseMessage, stringifyMessage, } from './common.mjs'; +import { isObject, limitCloseReason } from './utils.mjs'; +/** This file is the entry point for browsers, re-export common elements. */ +export * from './common.mjs'; +/** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ +export function createClient(options) { + const { url, connectionParams, lazy = true, onNonLazyError = console.error, lazyCloseTimeout: lazyCloseTimeoutMs = 0, keepAlive = 0, disablePong, connectionAckWaitTimeout = 0, retryAttempts = 5, retryWait = async function randomisedExponentialBackoff(retries) { + let retryDelay = 1000; // start with 1s delay + for (let i = 0; i < retries; i++) { + retryDelay *= 2; + } + await new Promise((resolve) => setTimeout(resolve, retryDelay + + // add random timeout from 300ms to 3s + Math.floor(Math.random() * (3000 - 300) + 300))); + }, shouldRetry = isLikeCloseEvent, isFatalConnectionProblem, on, webSocketImpl, + /** + * Generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID = function generateUUID() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); + }, jsonMessageReplacer: replacer, jsonMessageReviver: reviver, } = options; + let ws; + if (webSocketImpl) { + if (!isWebSocket(webSocketImpl)) { + throw new Error('Invalid WebSocket implementation provided'); + } + ws = webSocketImpl; + } + else if (typeof WebSocket !== 'undefined') { + ws = WebSocket; + } + else if (typeof global !== 'undefined') { + ws = + global.WebSocket || + // @ts-expect-error: Support more browsers + global.MozWebSocket; + } + else if (typeof window !== 'undefined') { + ws = + window.WebSocket || + // @ts-expect-error: Support more browsers + window.MozWebSocket; + } + if (!ws) + throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`"); + const WebSocketImpl = ws; + // websocket status emitter, subscriptions are handled differently + const emitter = (() => { + const message = (() => { + const listeners = {}; + return { + on(id, listener) { + listeners[id] = listener; + return () => { + delete listeners[id]; + }; + }, + emit(message) { + var _a; + if ('id' in message) + (_a = listeners[message.id]) === null || _a === void 0 ? void 0 : _a.call(listeners, message); + }, + }; + })(); + const listeners = { + connecting: (on === null || on === void 0 ? void 0 : on.connecting) ? [on.connecting] : [], + opened: (on === null || on === void 0 ? void 0 : on.opened) ? [on.opened] : [], + connected: (on === null || on === void 0 ? void 0 : on.connected) ? [on.connected] : [], + ping: (on === null || on === void 0 ? void 0 : on.ping) ? [on.ping] : [], + pong: (on === null || on === void 0 ? void 0 : on.pong) ? [on.pong] : [], + message: (on === null || on === void 0 ? void 0 : on.message) ? [message.emit, on.message] : [message.emit], + closed: (on === null || on === void 0 ? void 0 : on.closed) ? [on.closed] : [], + error: (on === null || on === void 0 ? void 0 : on.error) ? [on.error] : [], + }; + return { + onMessage: message.on, + on(event, listener) { + const l = listeners[event]; + l.push(listener); + return () => { + l.splice(l.indexOf(listener), 1); + }; + }, + emit(event, ...args) { + // we copy the listeners so that unlistens dont "pull the rug under our feet" + for (const listener of [...listeners[event]]) { + // @ts-expect-error: The args should fit + listener(...args); + } + }, + }; + })(); + // invokes the callback either when an error or closed event is emitted, + // first one that gets called prevails, other emissions are ignored + function errorOrClosed(cb) { + const listening = [ + // errors are fatal and more critical than close events, throw them first + emitter.on('error', (err) => { + listening.forEach((unlisten) => unlisten()); + cb(err); + }), + // closes can be graceful and not fatal, throw them second (if error didnt throw) + emitter.on('closed', (event) => { + listening.forEach((unlisten) => unlisten()); + cb(event); + }), + ]; + } + let connecting, locks = 0, lazyCloseTimeout, retrying = false, retries = 0, disposed = false; + async function connect() { + // clear the lazy close timeout immediatelly so that close gets debounced + // see: https://github.com/enisdenjo/graphql-ws/issues/388 + clearTimeout(lazyCloseTimeout); + const [socket, throwOnClose] = await (connecting !== null && connecting !== void 0 ? connecting : (connecting = new Promise((connected, denied) => (async () => { + if (retrying) { + await retryWait(retries); + // subscriptions might complete while waiting for retry + if (!locks) { + connecting = undefined; + return denied({ code: 1000, reason: 'All Subscriptions Gone' }); + } + retries++; + } + emitter.emit('connecting', retrying); + const socket = new WebSocketImpl(typeof url === 'function' ? await url() : url, GRAPHQL_TRANSPORT_WS_PROTOCOL); + let connectionAckTimeout, queuedPing; + function enqueuePing() { + if (isFinite(keepAlive) && keepAlive > 0) { + clearTimeout(queuedPing); // in case where a pong was received before a ping (this is valid behaviour) + queuedPing = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) { + socket.send(stringifyMessage({ type: MessageType.Ping })); + emitter.emit('ping', false, undefined); + } + }, keepAlive); + } + } + errorOrClosed((errOrEvent) => { + connecting = undefined; + clearTimeout(connectionAckTimeout); + clearTimeout(queuedPing); + denied(errOrEvent); + if (errOrEvent instanceof TerminatedCloseEvent) { + socket.close(4499, 'Terminated'); // close event is artificial and emitted manually, see `Client.terminate()` below + socket.onerror = null; + socket.onclose = null; + } + }); + socket.onerror = (err) => emitter.emit('error', err); + socket.onclose = (event) => emitter.emit('closed', event); + socket.onopen = async () => { + try { + emitter.emit('opened', socket); + const payload = typeof connectionParams === 'function' + ? await connectionParams() + : connectionParams; + // connectionParams might take too long causing the server to kick off the client + // the necessary error/close event is already reported - simply stop execution + if (socket.readyState !== WebSocketImpl.OPEN) + return; + socket.send(stringifyMessage(payload + ? { + type: MessageType.ConnectionInit, + payload, + } + : { + type: MessageType.ConnectionInit, + // payload is completely absent if not provided + }, replacer)); + if (isFinite(connectionAckWaitTimeout) && + connectionAckWaitTimeout > 0) { + connectionAckTimeout = setTimeout(() => { + socket.close(CloseCode.ConnectionAcknowledgementTimeout, 'Connection acknowledgement timeout'); + }, connectionAckWaitTimeout); + } + enqueuePing(); // enqueue ping (noop if disabled) + } + catch (err) { + emitter.emit('error', err); + socket.close(CloseCode.InternalClientError, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Internal client error')); + } + }; + let acknowledged = false; + socket.onmessage = ({ data }) => { + try { + const message = parseMessage(data, reviver); + emitter.emit('message', message); + if (message.type === 'ping' || message.type === 'pong') { + emitter.emit(message.type, true, message.payload); // received + if (message.type === 'pong') { + enqueuePing(); // enqueue next ping (noop if disabled) + } + else if (!disablePong) { + // respond with pong on ping + socket.send(stringifyMessage(message.payload + ? { + type: MessageType.Pong, + payload: message.payload, + } + : { + type: MessageType.Pong, + // payload is completely absent if not provided + })); + emitter.emit('pong', false, message.payload); + } + return; // ping and pongs can be received whenever + } + if (acknowledged) + return; // already connected and acknowledged + if (message.type !== MessageType.ConnectionAck) + throw new Error(`First message cannot be of type ${message.type}`); + clearTimeout(connectionAckTimeout); + acknowledged = true; + emitter.emit('connected', socket, message.payload, retrying); // connected = socket opened + acknowledged + retrying = false; // future lazy connects are not retries + retries = 0; // reset the retries on connect + connected([ + socket, + new Promise((_, reject) => errorOrClosed(reject)), + ]); + } + catch (err) { + socket.onmessage = null; // stop reading messages as soon as reading breaks once + emitter.emit('error', err); + socket.close(CloseCode.BadResponse, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Bad response')); + } + }; + })()))); + // if the provided socket is in a closing state, wait for the throw on close + if (socket.readyState === WebSocketImpl.CLOSING) + await throwOnClose; + let release = () => { + // releases this connection + }; + const released = new Promise((resolve) => (release = resolve)); + return [ + socket, + release, + Promise.race([ + // wait for + released.then(() => { + if (!locks) { + // and if no more locks are present, complete the connection + const complete = () => socket.close(1000, 'Normal Closure'); + if (isFinite(lazyCloseTimeoutMs) && lazyCloseTimeoutMs > 0) { + // if the keepalive is set, allow for the specified calmdown time and + // then complete if the socket is still open. + lazyCloseTimeout = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) + complete(); + }, lazyCloseTimeoutMs); + } + else { + // otherwise complete immediately + complete(); + } + } + }), + // or + throwOnClose, + ]), + ]; + } + /** + * Checks the `connect` problem and evaluates if the client should retry. + */ + function shouldRetryConnectOrThrow(errOrCloseEvent) { + // some close codes are worth reporting immediately + if (isLikeCloseEvent(errOrCloseEvent) && + (isFatalInternalCloseCode(errOrCloseEvent.code) || + [ + CloseCode.InternalServerError, + CloseCode.InternalClientError, + CloseCode.BadRequest, + CloseCode.BadResponse, + CloseCode.Unauthorized, + // CloseCode.Forbidden, might grant access out after retry + CloseCode.SubprotocolNotAcceptable, + // CloseCode.ConnectionInitialisationTimeout, might not time out after retry + // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry + CloseCode.SubscriberAlreadyExists, + CloseCode.TooManyInitialisationRequests, + // 4499, // Terminated, probably because the socket froze, we want to retry + ].includes(errOrCloseEvent.code))) + throw errOrCloseEvent; + // client was disposed, no retries should proceed regardless + if (disposed) + return false; + // normal closure (possibly all subscriptions have completed) + // if no locks were acquired in the meantime, shouldnt try again + if (isLikeCloseEvent(errOrCloseEvent) && errOrCloseEvent.code === 1000) + return locks > 0; + // retries are not allowed or we tried to many times, report error + if (!retryAttempts || retries >= retryAttempts) + throw errOrCloseEvent; + // throw non-retryable connection problems + if (!shouldRetry(errOrCloseEvent)) + throw errOrCloseEvent; + // @deprecated throw fatal connection problems immediately + if (isFatalConnectionProblem === null || isFatalConnectionProblem === void 0 ? void 0 : isFatalConnectionProblem(errOrCloseEvent)) + throw errOrCloseEvent; + // looks good, start retrying + return (retrying = true); + } + // in non-lazy (hot?) mode always hold one connection lock to persist the socket + if (!lazy) { + (async () => { + locks++; + for (;;) { + try { + const [, , throwOnClose] = await connect(); + await throwOnClose; // will always throw because releaser is not used + } + catch (errOrCloseEvent) { + try { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + catch (errOrCloseEvent) { + // report thrown error, no further retries + return onNonLazyError === null || onNonLazyError === void 0 ? void 0 : onNonLazyError(errOrCloseEvent); + } + } + } + })(); + } + function subscribe(payload, sink) { + const id = generateID(payload); + let done = false, errored = false, releaser = () => { + // for handling completions before connect + locks--; + done = true; + }; + (async () => { + locks++; + for (;;) { + try { + const [socket, release, waitForReleaseOrThrowOnClose] = await connect(); + // if done while waiting for connect, release the connection lock right away + if (done) + return release(); + const unlisten = emitter.onMessage(id, (message) => { + switch (message.type) { + case MessageType.Next: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- payload will fit type + sink.next(message.payload); + return; + } + case MessageType.Error: { + (errored = true), (done = true); + sink.error(message.payload); + releaser(); + return; + } + case MessageType.Complete: { + done = true; + releaser(); // release completes the sink + return; + } + } + }); + socket.send(stringifyMessage({ + id, + type: MessageType.Subscribe, + payload, + }, replacer)); + releaser = () => { + if (!done && socket.readyState === WebSocketImpl.OPEN) + // if not completed already and socket is open, send complete message to server on release + socket.send(stringifyMessage({ + id, + type: MessageType.Complete, + }, replacer)); + locks--; + done = true; + release(); + }; + // either the releaser will be called, connection completed and + // the promise resolved or the socket closed and the promise rejected. + // whatever happens though, we want to stop listening for messages + await waitForReleaseOrThrowOnClose.finally(unlisten); + return; // completed, shouldnt try again + } + catch (errOrCloseEvent) { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + } + })() + .then(() => { + // delivering either an error or a complete terminates the sequence + if (!errored) + sink.complete(); + }) // resolves on release or normal closure + .catch((err) => { + sink.error(err); + }); // rejects on close events and errors + return () => { + // dispose only of active subscriptions + if (!done) + releaser(); + }; + } + return { + on: emitter.on, + subscribe, + iterate(request) { + const pending = []; + const deferred = { + done: false, + error: null, + resolve: () => { + // noop + }, + }; + const dispose = subscribe(request, { + next(val) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + pending.push(val); + deferred.resolve(); + }, + error(err) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + }, + complete() { + deferred.done = true; + deferred.resolve(); + }, + }); + const iterator = (function iterator() { + return __asyncGenerator(this, arguments, function* iterator_1() { + for (;;) { + if (!pending.length) { + // only wait if there are no pending messages available + yield __await(new Promise((resolve) => (deferred.resolve = resolve))); + } + // first flush + while (pending.length) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + yield yield __await(pending.shift()); + } + // then error + if (deferred.error) { + throw deferred.error; + } + // or complete + if (deferred.done) { + return yield __await(void 0); + } + } + }); + })(); + iterator.throw = async (err) => { + if (!deferred.done) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + } + return { done: true, value: undefined }; + }; + iterator.return = async () => { + dispose(); + return { done: true, value: undefined }; + }; + return iterator; + }, + async dispose() { + disposed = true; + if (connecting) { + // if there is a connection, close it + const [socket] = await connecting; + socket.close(1000, 'Normal Closure'); + } + }, + terminate() { + if (connecting) { + // only if there is a connection + emitter.emit('closed', new TerminatedCloseEvent()); + } + }, + }; +} +/** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ +export class TerminatedCloseEvent extends Error { + constructor() { + super(...arguments); + this.name = 'TerminatedCloseEvent'; + this.message = '4499: Terminated'; + this.code = 4499; + this.reason = 'Terminated'; + this.wasClean = false; + } +} +function isLikeCloseEvent(val) { + return isObject(val) && 'code' in val && 'reason' in val; +} +function isFatalInternalCloseCode(code) { + if ([ + 1000, + 1001, + 1006, + 1005, + 1012, + 1013, + 1014, // Bad Gateway + ].includes(code)) + return false; + // all other internal errors are fatal + return code >= 1000 && code <= 1999; +} +function isWebSocket(val) { + return (typeof val === 'function' && + 'constructor' in val && + 'CLOSED' in val && + 'CLOSING' in val && + 'CONNECTING' in val && + 'OPEN' in val); +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/common.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/common.d.mts new file mode 100644 index 0000000..4f3d9cc --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/common.d.mts @@ -0,0 +1,201 @@ +/** + * + * common + * + */ +import { GraphQLError } from 'graphql'; +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare const GRAPHQL_TRANSPORT_WS_PROTOCOL = "graphql-transport-ws"; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +export declare const DEPRECATED_GRAPHQL_WS_PROTOCOL = "graphql-ws"; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare enum CloseCode { + InternalServerError = 4500, + InternalClientError = 4005, + BadRequest = 4400, + BadResponse = 4004, + /** Tried subscribing before connect ack */ + Unauthorized = 4401, + Forbidden = 4403, + SubprotocolNotAcceptable = 4406, + ConnectionInitialisationTimeout = 4408, + ConnectionAcknowledgementTimeout = 4504, + /** Subscriber distinction is very important */ + SubscriberAlreadyExists = 4409, + TooManyInitialisationRequests = 4429 +} +/** + * ID is a string type alias representing + * the globally unique ID used for identifying + * subscriptions established by the client. + * + * @category Common + */ +export type ID = string; +/** @category Common */ +export interface Disposable { + /** Dispose of the instance and clear up resources. */ + dispose: () => void | Promise; +} +/** + * A representation of any set of values over any amount of time. + * + * @category Common + */ +export interface Sink { + /** Next value arriving. */ + next(value: T): void; + /** + * An error that has occured. Calling this function "closes" the sink. + * Besides the errors being `Error` and `readonly GraphQLError[]`, it + * can also be a `CloseEvent`, but to avoid bundling DOM typings because + * the client can run in Node env too, you should assert the close event + * type during implementation. + */ + error(error: unknown): void; + /** The sink has completed. This function "closes" the sink. */ + complete(): void; +} +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +export declare enum MessageType { + ConnectionInit = "connection_init", + ConnectionAck = "connection_ack", + Ping = "ping", + Pong = "pong", + Subscribe = "subscribe", + Next = "next", + Error = "error", + Complete = "complete" +} +/** @category Common */ +export interface ConnectionInitMessage { + readonly type: MessageType.ConnectionInit; + readonly payload?: Record; +} +/** @category Common */ +export interface ConnectionAckMessage { + readonly type: MessageType.ConnectionAck; + readonly payload?: Record; +} +/** @category Common */ +export interface PingMessage { + readonly type: MessageType.Ping; + readonly payload?: Record; +} +/** @category Common */ +export interface PongMessage { + readonly type: MessageType.Pong; + readonly payload?: Record; +} +/** @category Common */ +export interface SubscribeMessage { + readonly id: ID; + readonly type: MessageType.Subscribe; + readonly payload: SubscribePayload; +} +/** @category Common */ +export interface SubscribePayload { + readonly operationName?: string | null; + readonly query: string; + readonly variables?: Record | null; + readonly extensions?: Record | null; +} +/** @category Common */ +export interface ExecutionResult, Extensions = Record> { + errors?: ReadonlyArray; + data?: Data | null; + hasNext?: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface ExecutionPatchResult> { + errors?: ReadonlyArray; + data?: Data | null; + path?: ReadonlyArray; + label?: string; + hasNext: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface NextMessage { + readonly id: ID; + readonly type: MessageType.Next; + readonly payload: ExecutionResult | ExecutionPatchResult; +} +/** @category Common */ +export interface ErrorMessage { + readonly id: ID; + readonly type: MessageType.Error; + readonly payload: readonly GraphQLError[]; +} +/** @category Common */ +export interface CompleteMessage { + readonly id: ID; + readonly type: MessageType.Complete; +} +/** @category Common */ +export type Message = T extends MessageType.ConnectionAck ? ConnectionAckMessage : T extends MessageType.ConnectionInit ? ConnectionInitMessage : T extends MessageType.Ping ? PingMessage : T extends MessageType.Pong ? PongMessage : T extends MessageType.Subscribe ? SubscribeMessage : T extends MessageType.Next ? NextMessage : T extends MessageType.Error ? ErrorMessage : T extends MessageType.Complete ? CompleteMessage : never; +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +export declare function validateMessage(val: unknown): Message; +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +export declare function isMessage(val: unknown): val is Message; +/** + * Function for transforming values within a message during JSON parsing + * The values are produced by parsing the incoming raw JSON. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter + * + * @category Common + */ +export type JSONMessageReviver = (this: any, key: string, value: any) => any; +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +export declare function parseMessage(data: unknown, reviver?: JSONMessageReviver): Message; +/** + * Function that allows customization of the produced JSON string + * for the elements of an outgoing `Message` object. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter + * + * @category Common + */ +export type JSONMessageReplacer = (this: any, key: string, value: any) => any; +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +export declare function stringifyMessage(msg: Message, replacer?: JSONMessageReplacer): string; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/common.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/common.d.ts new file mode 100644 index 0000000..4f3d9cc --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/common.d.ts @@ -0,0 +1,201 @@ +/** + * + * common + * + */ +import { GraphQLError } from 'graphql'; +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare const GRAPHQL_TRANSPORT_WS_PROTOCOL = "graphql-transport-ws"; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +export declare const DEPRECATED_GRAPHQL_WS_PROTOCOL = "graphql-ws"; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export declare enum CloseCode { + InternalServerError = 4500, + InternalClientError = 4005, + BadRequest = 4400, + BadResponse = 4004, + /** Tried subscribing before connect ack */ + Unauthorized = 4401, + Forbidden = 4403, + SubprotocolNotAcceptable = 4406, + ConnectionInitialisationTimeout = 4408, + ConnectionAcknowledgementTimeout = 4504, + /** Subscriber distinction is very important */ + SubscriberAlreadyExists = 4409, + TooManyInitialisationRequests = 4429 +} +/** + * ID is a string type alias representing + * the globally unique ID used for identifying + * subscriptions established by the client. + * + * @category Common + */ +export type ID = string; +/** @category Common */ +export interface Disposable { + /** Dispose of the instance and clear up resources. */ + dispose: () => void | Promise; +} +/** + * A representation of any set of values over any amount of time. + * + * @category Common + */ +export interface Sink { + /** Next value arriving. */ + next(value: T): void; + /** + * An error that has occured. Calling this function "closes" the sink. + * Besides the errors being `Error` and `readonly GraphQLError[]`, it + * can also be a `CloseEvent`, but to avoid bundling DOM typings because + * the client can run in Node env too, you should assert the close event + * type during implementation. + */ + error(error: unknown): void; + /** The sink has completed. This function "closes" the sink. */ + complete(): void; +} +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +export declare enum MessageType { + ConnectionInit = "connection_init", + ConnectionAck = "connection_ack", + Ping = "ping", + Pong = "pong", + Subscribe = "subscribe", + Next = "next", + Error = "error", + Complete = "complete" +} +/** @category Common */ +export interface ConnectionInitMessage { + readonly type: MessageType.ConnectionInit; + readonly payload?: Record; +} +/** @category Common */ +export interface ConnectionAckMessage { + readonly type: MessageType.ConnectionAck; + readonly payload?: Record; +} +/** @category Common */ +export interface PingMessage { + readonly type: MessageType.Ping; + readonly payload?: Record; +} +/** @category Common */ +export interface PongMessage { + readonly type: MessageType.Pong; + readonly payload?: Record; +} +/** @category Common */ +export interface SubscribeMessage { + readonly id: ID; + readonly type: MessageType.Subscribe; + readonly payload: SubscribePayload; +} +/** @category Common */ +export interface SubscribePayload { + readonly operationName?: string | null; + readonly query: string; + readonly variables?: Record | null; + readonly extensions?: Record | null; +} +/** @category Common */ +export interface ExecutionResult, Extensions = Record> { + errors?: ReadonlyArray; + data?: Data | null; + hasNext?: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface ExecutionPatchResult> { + errors?: ReadonlyArray; + data?: Data | null; + path?: ReadonlyArray; + label?: string; + hasNext: boolean; + extensions?: Extensions; +} +/** @category Common */ +export interface NextMessage { + readonly id: ID; + readonly type: MessageType.Next; + readonly payload: ExecutionResult | ExecutionPatchResult; +} +/** @category Common */ +export interface ErrorMessage { + readonly id: ID; + readonly type: MessageType.Error; + readonly payload: readonly GraphQLError[]; +} +/** @category Common */ +export interface CompleteMessage { + readonly id: ID; + readonly type: MessageType.Complete; +} +/** @category Common */ +export type Message = T extends MessageType.ConnectionAck ? ConnectionAckMessage : T extends MessageType.ConnectionInit ? ConnectionInitMessage : T extends MessageType.Ping ? PingMessage : T extends MessageType.Pong ? PongMessage : T extends MessageType.Subscribe ? SubscribeMessage : T extends MessageType.Next ? NextMessage : T extends MessageType.Error ? ErrorMessage : T extends MessageType.Complete ? CompleteMessage : never; +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +export declare function validateMessage(val: unknown): Message; +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +export declare function isMessage(val: unknown): val is Message; +/** + * Function for transforming values within a message during JSON parsing + * The values are produced by parsing the incoming raw JSON. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter + * + * @category Common + */ +export type JSONMessageReviver = (this: any, key: string, value: any) => any; +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +export declare function parseMessage(data: unknown, reviver?: JSONMessageReviver): Message; +/** + * Function that allows customization of the produced JSON string + * for the elements of an outgoing `Message` object. + * + * Read more about using it: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter + * + * @category Common + */ +export type JSONMessageReplacer = (this: any, key: string, value: any) => any; +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +export declare function stringifyMessage(msg: Message, replacer?: JSONMessageReplacer): string; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/common.js b/graphql-subscription/node_modules/graphql-ws/lib/common.js new file mode 100644 index 0000000..135d1d4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/common.js @@ -0,0 +1,185 @@ +"use strict"; +/** + * + * common + * + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stringifyMessage = exports.parseMessage = exports.isMessage = exports.validateMessage = exports.MessageType = exports.CloseCode = exports.DEPRECATED_GRAPHQL_WS_PROTOCOL = exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = void 0; +const utils_1 = require("./utils"); +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = 'graphql-transport-ws'; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +exports.DEPRECATED_GRAPHQL_WS_PROTOCOL = 'graphql-ws'; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +var CloseCode; +(function (CloseCode) { + CloseCode[CloseCode["InternalServerError"] = 4500] = "InternalServerError"; + CloseCode[CloseCode["InternalClientError"] = 4005] = "InternalClientError"; + CloseCode[CloseCode["BadRequest"] = 4400] = "BadRequest"; + CloseCode[CloseCode["BadResponse"] = 4004] = "BadResponse"; + /** Tried subscribing before connect ack */ + CloseCode[CloseCode["Unauthorized"] = 4401] = "Unauthorized"; + CloseCode[CloseCode["Forbidden"] = 4403] = "Forbidden"; + CloseCode[CloseCode["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable"; + CloseCode[CloseCode["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout"; + CloseCode[CloseCode["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout"; + /** Subscriber distinction is very important */ + CloseCode[CloseCode["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists"; + CloseCode[CloseCode["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests"; +})(CloseCode || (exports.CloseCode = CloseCode = {})); +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +var MessageType; +(function (MessageType) { + MessageType["ConnectionInit"] = "connection_init"; + MessageType["ConnectionAck"] = "connection_ack"; + MessageType["Ping"] = "ping"; + MessageType["Pong"] = "pong"; + MessageType["Subscribe"] = "subscribe"; + MessageType["Next"] = "next"; + MessageType["Error"] = "error"; + MessageType["Complete"] = "complete"; +})(MessageType || (exports.MessageType = MessageType = {})); +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +function validateMessage(val) { + if (!(0, utils_1.isObject)(val)) { + throw new Error(`Message is expected to be an object, but got ${(0, utils_1.extendedTypeof)(val)}`); + } + if (!val.type) { + throw new Error(`Message is missing the 'type' property`); + } + if (typeof val.type !== 'string') { + throw new Error(`Message is expects the 'type' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.type)}`); + } + switch (val.type) { + case MessageType.ConnectionInit: + case MessageType.ConnectionAck: + case MessageType.Ping: + case MessageType.Pong: { + if (val.payload != null && !(0, utils_1.isObject)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${val.payload}"`); + } + break; + } + case MessageType.Subscribe: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!(0, utils_1.isObject)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${(0, utils_1.extendedTypeof)(val.payload)}`); + } + if (typeof val.payload.query !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'query' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.payload.query)}`); + } + if (val.payload.variables != null && !(0, utils_1.isObject)(val.payload.variables)) { + throw new Error(`"${val.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${(0, utils_1.extendedTypeof)(val.payload.variables)}`); + } + if (val.payload.operationName != null && + (0, utils_1.extendedTypeof)(val.payload.operationName) !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${(0, utils_1.extendedTypeof)(val.payload.operationName)}`); + } + if (val.payload.extensions != null && !(0, utils_1.isObject)(val.payload.extensions)) { + throw new Error(`"${val.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${(0, utils_1.extendedTypeof)(val.payload.extensions)}`); + } + break; + } + case MessageType.Next: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!(0, utils_1.isObject)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${(0, utils_1.extendedTypeof)(val.payload)}`); + } + break; + } + case MessageType.Error: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!(0, utils_1.areGraphQLErrors)(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(val.payload)}`); + } + break; + } + case MessageType.Complete: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${(0, utils_1.extendedTypeof)(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + break; + } + default: + throw new Error(`Invalid message 'type' property "${val.type}"`); + } + return val; +} +exports.validateMessage = validateMessage; +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +function isMessage(val) { + try { + validateMessage(val); + return true; + } + catch (_a) { + return false; + } +} +exports.isMessage = isMessage; +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +function parseMessage(data, reviver) { + return validateMessage(typeof data === 'string' ? JSON.parse(data, reviver) : data); +} +exports.parseMessage = parseMessage; +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +function stringifyMessage(msg, replacer) { + validateMessage(msg); + return JSON.stringify(msg, replacer); +} +exports.stringifyMessage = stringifyMessage; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/common.mjs b/graphql-subscription/node_modules/graphql-ws/lib/common.mjs new file mode 100644 index 0000000..e65e0ce --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/common.mjs @@ -0,0 +1,178 @@ +/** + * + * common + * + */ +import { areGraphQLErrors, extendedTypeof, isObject } from './utils.mjs'; +/** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export const GRAPHQL_TRANSPORT_WS_PROTOCOL = 'graphql-transport-ws'; +/** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ +export const DEPRECATED_GRAPHQL_WS_PROTOCOL = 'graphql-ws'; +/** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ +export var CloseCode; +(function (CloseCode) { + CloseCode[CloseCode["InternalServerError"] = 4500] = "InternalServerError"; + CloseCode[CloseCode["InternalClientError"] = 4005] = "InternalClientError"; + CloseCode[CloseCode["BadRequest"] = 4400] = "BadRequest"; + CloseCode[CloseCode["BadResponse"] = 4004] = "BadResponse"; + /** Tried subscribing before connect ack */ + CloseCode[CloseCode["Unauthorized"] = 4401] = "Unauthorized"; + CloseCode[CloseCode["Forbidden"] = 4403] = "Forbidden"; + CloseCode[CloseCode["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable"; + CloseCode[CloseCode["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout"; + CloseCode[CloseCode["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout"; + /** Subscriber distinction is very important */ + CloseCode[CloseCode["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists"; + CloseCode[CloseCode["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests"; +})(CloseCode || (CloseCode = {})); +/** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ +export var MessageType; +(function (MessageType) { + MessageType["ConnectionInit"] = "connection_init"; + MessageType["ConnectionAck"] = "connection_ack"; + MessageType["Ping"] = "ping"; + MessageType["Pong"] = "pong"; + MessageType["Subscribe"] = "subscribe"; + MessageType["Next"] = "next"; + MessageType["Error"] = "error"; + MessageType["Complete"] = "complete"; +})(MessageType || (MessageType = {})); +/** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ +export function validateMessage(val) { + if (!isObject(val)) { + throw new Error(`Message is expected to be an object, but got ${extendedTypeof(val)}`); + } + if (!val.type) { + throw new Error(`Message is missing the 'type' property`); + } + if (typeof val.type !== 'string') { + throw new Error(`Message is expects the 'type' property to be a string, but got ${extendedTypeof(val.type)}`); + } + switch (val.type) { + case MessageType.ConnectionInit: + case MessageType.ConnectionAck: + case MessageType.Ping: + case MessageType.Pong: { + if (val.payload != null && !isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${val.payload}"`); + } + break; + } + case MessageType.Subscribe: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + if (typeof val.payload.query !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'query' property to be a string, but got ${extendedTypeof(val.payload.query)}`); + } + if (val.payload.variables != null && !isObject(val.payload.variables)) { + throw new Error(`"${val.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.variables)}`); + } + if (val.payload.operationName != null && + extendedTypeof(val.payload.operationName) !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${extendedTypeof(val.payload.operationName)}`); + } + if (val.payload.extensions != null && !isObject(val.payload.extensions)) { + throw new Error(`"${val.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.extensions)}`); + } + break; + } + case MessageType.Next: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + break; + } + case MessageType.Error: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!areGraphQLErrors(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(val.payload)}`); + } + break; + } + case MessageType.Complete: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + break; + } + default: + throw new Error(`Invalid message 'type' property "${val.type}"`); + } + return val; +} +/** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ +export function isMessage(val) { + try { + validateMessage(val); + return true; + } + catch (_a) { + return false; + } +} +/** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ +export function parseMessage(data, reviver) { + return validateMessage(typeof data === 'string' ? JSON.parse(data, reviver) : data); +} +/** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ +export function stringifyMessage(msg, replacer) { + validateMessage(msg); + return JSON.stringify(msg, replacer); +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/index.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/index.d.mts new file mode 100644 index 0000000..bd2eb71 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/index.d.mts @@ -0,0 +1,3 @@ +export * from './client.mjs'; +export * from './server.mjs'; +export * from './common.mjs'; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/index.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/index.d.ts new file mode 100644 index 0000000..1bb4712 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/index.d.ts @@ -0,0 +1,3 @@ +export * from './client'; +export * from './server'; +export * from './common'; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/index.js b/graphql-subscription/node_modules/graphql-ws/lib/index.js new file mode 100644 index 0000000..8d08c8b --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/index.js @@ -0,0 +1,19 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./client"), exports); +__exportStar(require("./server"), exports); +__exportStar(require("./common"), exports); diff --git a/graphql-subscription/node_modules/graphql-ws/lib/index.mjs b/graphql-subscription/node_modules/graphql-ws/lib/index.mjs new file mode 100644 index 0000000..bd2eb71 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/index.mjs @@ -0,0 +1,3 @@ +export * from './client.mjs'; +export * from './server.mjs'; +export * from './common.mjs'; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/server.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/server.d.mts new file mode 100644 index 0000000..77859c6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/server.d.mts @@ -0,0 +1,417 @@ +/** + * + * server + * + */ +import { OperationTypeNode, GraphQLSchema, ExecutionArgs, validate as graphqlValidate, GraphQLError, SubscriptionArgs } from 'graphql'; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, ID, ConnectionInitMessage, SubscribeMessage, NextMessage, ErrorMessage, CompleteMessage, JSONMessageReplacer, JSONMessageReviver, PingMessage, PongMessage, ExecutionResult, ExecutionPatchResult } from './common.mjs'; +/** @category Server */ +export type OperationResult = Promise | AsyncIterable | ExecutionResult> | AsyncGenerator | AsyncIterable | ExecutionResult; +/** + * A concrete GraphQL execution context value type. + * + * Mainly used because TypeScript collapses unions + * with `any` or `unknown` to `any` or `unknown`. So, + * we use a custom type to allow definitions such as + * the `context` server option. + * + * @category Server + */ +export type GraphQLExecutionContextValue = object | symbol | number | string | boolean | undefined | null; +/** @category Server */ +export interface ServerOptions

    { + /** + * The GraphQL schema on which the operations + * will be executed and validated against. + * + * If a function is provided, it will be called on + * every subscription request allowing you to manipulate + * schema dynamically. + * + * If the schema is left undefined, you're trusted to + * provide one in the returned `ExecutionArgs` from the + * `onSubscribe` callback. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + schema?: GraphQLSchema | ((ctx: Context, message: SubscribeMessage, args: Omit) => Promise | GraphQLSchema); + /** + * A value which is provided to every resolver and holds + * important contextual information like the currently + * logged in user, or access to a database. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `contextValue` field, this context will be used + * instead. + * + * If you use the function signature, the final execution arguments + * will be passed in (also the returned value from `onSubscribe`). + * Since the context is injected on every subscribe, the `SubscribeMessage` + * with the regular `Context` will be passed in through the arguments too. + * + * Note that the context function is invoked on each operation only once. + * Meaning, for subscriptions, only at the point of initialising the subscription; + * not on every subscription event emission. Read more about the context lifecycle + * in subscriptions here: https://github.com/graphql/graphql-js/issues/894. + */ + context?: GraphQLExecutionContextValue | ((ctx: Context, message: SubscribeMessage, args: ExecutionArgs) => Promise | GraphQLExecutionContextValue); + /** + * The GraphQL root fields or resolvers to go + * alongside the schema. Learn more about them + * here: https://graphql.org/learn/execution/#root-fields-resolvers. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `rootValue` field, the relevant operation root + * will be used instead. + */ + roots?: { + [operation in OperationTypeNode]?: Record>; + }; + /** + * A custom GraphQL validate function allowing you to apply your + * own validation rules. + * + * Returned, non-empty, array of `GraphQLError`s will be communicated + * to the client through the `ErrorMessage`. Use an empty array if the + * document is valid and no errors have been encountered. + * + * Will not be used when implementing a custom `onSubscribe`. + * + * Throwing an error from within this function will close the socket + * with the `Error` message in the close event reason. + */ + validate?: typeof graphqlValidate; + /** + * Is the `execute` function from GraphQL which is + * used to execute the query and mutation operations. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + execute?: (args: ExecutionArgs) => OperationResult; + /** + * Is the `subscribe` function from GraphQL which is + * used to execute the subscription operation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + subscribe?: (args: ExecutionArgs) => OperationResult; + /** + * The amount of time for which the server will wait + * for `ConnectionInit` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the client + * has not sent the `ConnectionInit` message, + * the server will terminate the socket by + * dispatching a close event `4408: Connection initialisation timeout` + * + * @default 3_000 // 3 seconds + */ + connectionInitWaitTimeout?: number; + /** + * Is the connection callback called when the + * client requests the connection initialisation + * through the message `ConnectionInit`. + * + * The message payload (`connectionParams` from the + * client) is present in the `Context.connectionParams`. + * + * - Returning `true` or nothing from the callback will + * allow the client to connect. + * + * - Returning `false` from the callback will + * terminate the socket by dispatching the + * close event `4403: Forbidden`. + * + * - Returning a `Record` from the callback will + * allow the client to connect and pass the returned + * value to the client through the optional `payload` + * field in the `ConnectionAck` message. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onConnect?: (ctx: Context) => Promise | boolean | void> | Record | boolean | void; + /** + * Called when the client disconnects for whatever reason after + * he successfully went through the connection initialisation phase. + * Provides the close event too. Beware that this callback happens + * AFTER all subscriptions have been gracefully completed and BEFORE + * the `onClose` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * This callback will be called EXCLUSIVELY if the client connection + * is acknowledged. Meaning, `onConnect` will be called before the `onDisconnect`. + * + * For tracking socket closures at any point in time, regardless + * of the connection state - consider using the `onClose` callback. + */ + onDisconnect?: (ctx: Context, code: number, reason: string) => Promise | void; + /** + * Called when the socket closes for whatever reason, at any + * point in time. Provides the close event too. Beware + * that this callback happens AFTER all subscriptions have + * been gracefully completed and AFTER the `onDisconnect` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * In comparison to `onDisconnect`, this callback will ALWAYS + * be called, regardless if the user successfully went through + * the connection initialisation or not. `onConnect` might not + * called before the `onClose`. + */ + onClose?: (ctx: Context, code: number, reason: string) => Promise | void; + /** + * The subscribe callback executed right after + * acknowledging the request before any payload + * processing has been performed. + * + * If you return `ExecutionArgs` from the callback, + * it will be used instead of trying to build one + * internally. In this case, you are responsible + * for providing a ready set of arguments which will + * be directly plugged in the operation execution. + * + * Omitting the fields `contextValue` or `rootValue` + * from the returned value will have the provided server + * options fill in the gaps. + * + * To report GraphQL errors simply return an array + * of them from the callback, they will be reported + * to the client through the error message. + * + * Useful for preparing the execution arguments + * following a custom logic. A typical use case are + * persisted queries, you can identify the query from + * the subscribe message and create the GraphQL operation + * execution args which are then returned by the function. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onSubscribe?: (ctx: Context, message: SubscribeMessage) => Promise | ExecutionArgs | readonly GraphQLError[] | void; + /** + * Executed after the operation call resolves. For streaming + * operations, triggering this callback does not necessarily + * mean that there is already a result available - it means + * that the subscription process for the stream has resolved + * and that the client is now subscribed. + * + * The `OperationResult` argument is the result of operation + * execution. It can be an iterator or already a value. + * + * If you want the single result and the events from a streaming + * operation, use the `onNext` callback. + * + * Use this callback to listen for subscribe operation and + * execution result manipulation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onOperation?: (ctx: Context, message: SubscribeMessage, args: ExecutionArgs, result: OperationResult) => Promise | OperationResult | void; + /** + * Executed after an error occurred right before it + * has been dispatched to the client. + * + * Use this callback to format the outgoing GraphQL + * errors before they reach the client. + * + * Returned result will be injected in the error message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onError?: (ctx: Context, message: ErrorMessage, errors: readonly GraphQLError[]) => Promise | readonly GraphQLError[] | void; + /** + * Executed after an operation has emitted a result right before + * that result has been sent to the client. Results from both + * single value and streaming operations will appear in this callback. + * + * Use this callback if you want to format the execution result + * before it reaches the client. + * + * Returned result will be injected in the next message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onNext?: (ctx: Context, message: NextMessage, args: ExecutionArgs, result: ExecutionResult | ExecutionPatchResult) => Promise | ExecutionResult | ExecutionPatchResult | void; + /** + * The complete callback is executed after the + * operation has completed right before sending + * the complete message to the client. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + * + * Since the library makes sure to complete streaming + * operations even after an abrupt closure, this callback + * will still be called. + */ + onComplete?: (ctx: Context, message: CompleteMessage) => Promise | void; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this server. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages to from server. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Server */ +export interface Server { + /** + * New socket has been established. The lib will validate + * the protocol and use the socket accordingly. Returned promise + * will resolve after the socket closes. + * + * The second argument will be passed in the `extra` field + * of the `Context`. You may pass the initial request or the + * original WebSocket, if you need it down the road. + * + * Returns a function that should be called when the same socket + * has been closed, for whatever reason. The close code and reason + * must be passed for reporting to the `onDisconnect` callback. Returned + * promise will resolve once the internal cleanup is complete. + */ + opened(socket: WebSocket, ctxExtra: E): (code: number, reason: string) => Promise; +} +/** @category Server */ +export interface WebSocket { + /** + * The subprotocol of the WebSocket. Will be used + * to validate against the supported ones. + */ + readonly protocol: string; + /** + * Sends a message through the socket. Will always + * provide a `string` message. + * + * Please take care that the send is ready. Meaning, + * only provide a truly OPEN socket through the `opened` + * method of the `Server`. + * + * The returned promise is used to control the flow of data + * (like handling backpressure). + */ + send(data: string): Promise | void; + /** + * Closes the socket gracefully. Will always provide + * the appropriate code and close reason. `onDisconnect` + * callback will be called. + * + * The returned promise is used to control the graceful + * closure. + */ + close(code: number, reason: string): Promise | void; + /** + * Called when message is received. The library requires the data + * to be a `string`. + * + * All operations requested from the client will block the promise until + * completed, this means that the callback will not resolve until all + * subscription events have been emitted (or until the client has completed + * the stream), or until the query/mutation resolves. + * + * Exceptions raised during any phase of operation processing will + * reject the callback's promise, catch them and communicate them + * to your clients however you wish. + */ + onMessage(cb: (data: string) => Promise): void; + /** + * Implement a listener for the `PingMessage` sent from the client to the server. + * If the client sent the ping with a payload, it will be passed through the + * first argument. + * + * If this listener is implemented, the server will NOT automatically reply + * to any pings from the client. Implementing it makes it your responsibility + * to decide how and when to respond. + */ + onPing?(payload: PingMessage['payload']): Promise | void; + /** + * Implement a listener for the `PongMessage` sent from the client to the server. + * If the client sent the pong with a payload, it will be passed through the + * first argument. + */ + onPong?(payload: PongMessage['payload']): Promise | void; +} +/** @category Server */ +export interface Context

    { + /** + * Indicates that the `ConnectionInit` message + * has been received by the server. If this is + * `true`, the client wont be kicked off after + * the wait timeout has passed. + */ + readonly connectionInitReceived: boolean; + /** + * Indicates that the connection was acknowledged + * by having dispatched the `ConnectionAck` message + * to the related client. + */ + readonly acknowledged: boolean; + /** The parameters passed during the connection initialisation. */ + readonly connectionParams?: Readonly

    ; + /** + * Holds the active subscriptions for this context. **All operations** + * that are taking place are aggregated here. The user is _subscribed_ + * to an operation when waiting for result(s). + * + * If the subscription behind an ID is an `AsyncIterator` - the operation + * is streaming; on the contrary, if the subscription is `null` - it is simply + * a reservation, meaning - the operation resolves to a single result or is still + * pending/being prepared. + */ + readonly subscriptions: Record | AsyncIterable | null>; + /** + * An extra field where you can store your own context values + * to pass between callbacks. + */ + extra: E; +} +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +export declare function makeServer

    (options: ServerOptions): Server; +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +export declare function handleProtocols(protocols: Set | string[] | string): typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/server.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/server.d.ts new file mode 100644 index 0000000..52766fb --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/server.d.ts @@ -0,0 +1,417 @@ +/** + * + * server + * + */ +import { OperationTypeNode, GraphQLSchema, ExecutionArgs, validate as graphqlValidate, GraphQLError, SubscriptionArgs } from 'graphql'; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, ID, ConnectionInitMessage, SubscribeMessage, NextMessage, ErrorMessage, CompleteMessage, JSONMessageReplacer, JSONMessageReviver, PingMessage, PongMessage, ExecutionResult, ExecutionPatchResult } from './common'; +/** @category Server */ +export type OperationResult = Promise | AsyncIterable | ExecutionResult> | AsyncGenerator | AsyncIterable | ExecutionResult; +/** + * A concrete GraphQL execution context value type. + * + * Mainly used because TypeScript collapses unions + * with `any` or `unknown` to `any` or `unknown`. So, + * we use a custom type to allow definitions such as + * the `context` server option. + * + * @category Server + */ +export type GraphQLExecutionContextValue = object | symbol | number | string | boolean | undefined | null; +/** @category Server */ +export interface ServerOptions

    { + /** + * The GraphQL schema on which the operations + * will be executed and validated against. + * + * If a function is provided, it will be called on + * every subscription request allowing you to manipulate + * schema dynamically. + * + * If the schema is left undefined, you're trusted to + * provide one in the returned `ExecutionArgs` from the + * `onSubscribe` callback. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + schema?: GraphQLSchema | ((ctx: Context, message: SubscribeMessage, args: Omit) => Promise | GraphQLSchema); + /** + * A value which is provided to every resolver and holds + * important contextual information like the currently + * logged in user, or access to a database. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `contextValue` field, this context will be used + * instead. + * + * If you use the function signature, the final execution arguments + * will be passed in (also the returned value from `onSubscribe`). + * Since the context is injected on every subscribe, the `SubscribeMessage` + * with the regular `Context` will be passed in through the arguments too. + * + * Note that the context function is invoked on each operation only once. + * Meaning, for subscriptions, only at the point of initialising the subscription; + * not on every subscription event emission. Read more about the context lifecycle + * in subscriptions here: https://github.com/graphql/graphql-js/issues/894. + */ + context?: GraphQLExecutionContextValue | ((ctx: Context, message: SubscribeMessage, args: ExecutionArgs) => Promise | GraphQLExecutionContextValue); + /** + * The GraphQL root fields or resolvers to go + * alongside the schema. Learn more about them + * here: https://graphql.org/learn/execution/#root-fields-resolvers. + * + * If you return from `onSubscribe`, and the returned value is + * missing the `rootValue` field, the relevant operation root + * will be used instead. + */ + roots?: { + [operation in OperationTypeNode]?: Record>; + }; + /** + * A custom GraphQL validate function allowing you to apply your + * own validation rules. + * + * Returned, non-empty, array of `GraphQLError`s will be communicated + * to the client through the `ErrorMessage`. Use an empty array if the + * document is valid and no errors have been encountered. + * + * Will not be used when implementing a custom `onSubscribe`. + * + * Throwing an error from within this function will close the socket + * with the `Error` message in the close event reason. + */ + validate?: typeof graphqlValidate; + /** + * Is the `execute` function from GraphQL which is + * used to execute the query and mutation operations. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + execute?: (args: ExecutionArgs) => OperationResult; + /** + * Is the `subscribe` function from GraphQL which is + * used to execute the subscription operation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + subscribe?: (args: ExecutionArgs) => OperationResult; + /** + * The amount of time for which the server will wait + * for `ConnectionInit` message. + * + * Set the value to `Infinity`, `''`, `0`, `null` or `undefined` to skip waiting. + * + * If the wait timeout has passed and the client + * has not sent the `ConnectionInit` message, + * the server will terminate the socket by + * dispatching a close event `4408: Connection initialisation timeout` + * + * @default 3_000 // 3 seconds + */ + connectionInitWaitTimeout?: number; + /** + * Is the connection callback called when the + * client requests the connection initialisation + * through the message `ConnectionInit`. + * + * The message payload (`connectionParams` from the + * client) is present in the `Context.connectionParams`. + * + * - Returning `true` or nothing from the callback will + * allow the client to connect. + * + * - Returning `false` from the callback will + * terminate the socket by dispatching the + * close event `4403: Forbidden`. + * + * - Returning a `Record` from the callback will + * allow the client to connect and pass the returned + * value to the client through the optional `payload` + * field in the `ConnectionAck` message. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onConnect?: (ctx: Context) => Promise | boolean | void> | Record | boolean | void; + /** + * Called when the client disconnects for whatever reason after + * he successfully went through the connection initialisation phase. + * Provides the close event too. Beware that this callback happens + * AFTER all subscriptions have been gracefully completed and BEFORE + * the `onClose` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * This callback will be called EXCLUSIVELY if the client connection + * is acknowledged. Meaning, `onConnect` will be called before the `onDisconnect`. + * + * For tracking socket closures at any point in time, regardless + * of the connection state - consider using the `onClose` callback. + */ + onDisconnect?: (ctx: Context, code: number, reason: string) => Promise | void; + /** + * Called when the socket closes for whatever reason, at any + * point in time. Provides the close event too. Beware + * that this callback happens AFTER all subscriptions have + * been gracefully completed and AFTER the `onDisconnect` callback. + * + * If you are interested in tracking the subscriptions completions, + * consider using the `onComplete` callback. + * + * In comparison to `onDisconnect`, this callback will ALWAYS + * be called, regardless if the user successfully went through + * the connection initialisation or not. `onConnect` might not + * called before the `onClose`. + */ + onClose?: (ctx: Context, code: number, reason: string) => Promise | void; + /** + * The subscribe callback executed right after + * acknowledging the request before any payload + * processing has been performed. + * + * If you return `ExecutionArgs` from the callback, + * it will be used instead of trying to build one + * internally. In this case, you are responsible + * for providing a ready set of arguments which will + * be directly plugged in the operation execution. + * + * Omitting the fields `contextValue` or `rootValue` + * from the returned value will have the provided server + * options fill in the gaps. + * + * To report GraphQL errors simply return an array + * of them from the callback, they will be reported + * to the client through the error message. + * + * Useful for preparing the execution arguments + * following a custom logic. A typical use case are + * persisted queries, you can identify the query from + * the subscribe message and create the GraphQL operation + * execution args which are then returned by the function. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onSubscribe?: (ctx: Context, message: SubscribeMessage) => Promise | ExecutionArgs | readonly GraphQLError[] | void; + /** + * Executed after the operation call resolves. For streaming + * operations, triggering this callback does not necessarily + * mean that there is already a result available - it means + * that the subscription process for the stream has resolved + * and that the client is now subscribed. + * + * The `OperationResult` argument is the result of operation + * execution. It can be an iterator or already a value. + * + * If you want the single result and the events from a streaming + * operation, use the `onNext` callback. + * + * Use this callback to listen for subscribe operation and + * execution result manipulation. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onOperation?: (ctx: Context, message: SubscribeMessage, args: ExecutionArgs, result: OperationResult) => Promise | OperationResult | void; + /** + * Executed after an error occurred right before it + * has been dispatched to the client. + * + * Use this callback to format the outgoing GraphQL + * errors before they reach the client. + * + * Returned result will be injected in the error message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onError?: (ctx: Context, message: ErrorMessage, errors: readonly GraphQLError[]) => Promise | readonly GraphQLError[] | void; + /** + * Executed after an operation has emitted a result right before + * that result has been sent to the client. Results from both + * single value and streaming operations will appear in this callback. + * + * Use this callback if you want to format the execution result + * before it reaches the client. + * + * Returned result will be injected in the next message payload. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + */ + onNext?: (ctx: Context, message: NextMessage, args: ExecutionArgs, result: ExecutionResult | ExecutionPatchResult) => Promise | ExecutionResult | ExecutionPatchResult | void; + /** + * The complete callback is executed after the + * operation has completed right before sending + * the complete message to the client. + * + * Throwing an error from within this function will + * close the socket with the `Error` message + * in the close event reason. + * + * Since the library makes sure to complete streaming + * operations even after an abrupt closure, this callback + * will still be called. + */ + onComplete?: (ctx: Context, message: CompleteMessage) => Promise | void; + /** + * An optional override for the JSON.parse function used to hydrate + * incoming messages to this server. Useful for parsing custom datatypes + * out of the incoming JSON. + */ + jsonMessageReviver?: JSONMessageReviver; + /** + * An optional override for the JSON.stringify function used to serialize + * outgoing messages to from server. Useful for serializing custom + * datatypes out to the client. + */ + jsonMessageReplacer?: JSONMessageReplacer; +} +/** @category Server */ +export interface Server { + /** + * New socket has been established. The lib will validate + * the protocol and use the socket accordingly. Returned promise + * will resolve after the socket closes. + * + * The second argument will be passed in the `extra` field + * of the `Context`. You may pass the initial request or the + * original WebSocket, if you need it down the road. + * + * Returns a function that should be called when the same socket + * has been closed, for whatever reason. The close code and reason + * must be passed for reporting to the `onDisconnect` callback. Returned + * promise will resolve once the internal cleanup is complete. + */ + opened(socket: WebSocket, ctxExtra: E): (code: number, reason: string) => Promise; +} +/** @category Server */ +export interface WebSocket { + /** + * The subprotocol of the WebSocket. Will be used + * to validate against the supported ones. + */ + readonly protocol: string; + /** + * Sends a message through the socket. Will always + * provide a `string` message. + * + * Please take care that the send is ready. Meaning, + * only provide a truly OPEN socket through the `opened` + * method of the `Server`. + * + * The returned promise is used to control the flow of data + * (like handling backpressure). + */ + send(data: string): Promise | void; + /** + * Closes the socket gracefully. Will always provide + * the appropriate code and close reason. `onDisconnect` + * callback will be called. + * + * The returned promise is used to control the graceful + * closure. + */ + close(code: number, reason: string): Promise | void; + /** + * Called when message is received. The library requires the data + * to be a `string`. + * + * All operations requested from the client will block the promise until + * completed, this means that the callback will not resolve until all + * subscription events have been emitted (or until the client has completed + * the stream), or until the query/mutation resolves. + * + * Exceptions raised during any phase of operation processing will + * reject the callback's promise, catch them and communicate them + * to your clients however you wish. + */ + onMessage(cb: (data: string) => Promise): void; + /** + * Implement a listener for the `PingMessage` sent from the client to the server. + * If the client sent the ping with a payload, it will be passed through the + * first argument. + * + * If this listener is implemented, the server will NOT automatically reply + * to any pings from the client. Implementing it makes it your responsibility + * to decide how and when to respond. + */ + onPing?(payload: PingMessage['payload']): Promise | void; + /** + * Implement a listener for the `PongMessage` sent from the client to the server. + * If the client sent the pong with a payload, it will be passed through the + * first argument. + */ + onPong?(payload: PongMessage['payload']): Promise | void; +} +/** @category Server */ +export interface Context

    { + /** + * Indicates that the `ConnectionInit` message + * has been received by the server. If this is + * `true`, the client wont be kicked off after + * the wait timeout has passed. + */ + readonly connectionInitReceived: boolean; + /** + * Indicates that the connection was acknowledged + * by having dispatched the `ConnectionAck` message + * to the related client. + */ + readonly acknowledged: boolean; + /** The parameters passed during the connection initialisation. */ + readonly connectionParams?: Readonly

    ; + /** + * Holds the active subscriptions for this context. **All operations** + * that are taking place are aggregated here. The user is _subscribed_ + * to an operation when waiting for result(s). + * + * If the subscription behind an ID is an `AsyncIterator` - the operation + * is streaming; on the contrary, if the subscription is `null` - it is simply + * a reservation, meaning - the operation resolves to a single result or is still + * pending/being prepared. + */ + readonly subscriptions: Record | AsyncIterable | null>; + /** + * An extra field where you can store your own context values + * to pass between callbacks. + */ + extra: E; +} +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +export declare function makeServer

    (options: ServerOptions): Server; +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +export declare function handleProtocols(protocols: Set | string[] | string): typeof GRAPHQL_TRANSPORT_WS_PROTOCOL | false; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/server.js b/graphql-subscription/node_modules/graphql-ws/lib/server.js new file mode 100644 index 0000000..6c3791d --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/server.js @@ -0,0 +1,301 @@ +"use strict"; +/** + * + * server + * + */ +var __asyncValues = (this && this.__asyncValues) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handleProtocols = exports.makeServer = void 0; +const graphql_1 = require("graphql"); +const common_1 = require("./common"); +const utils_1 = require("./utils"); +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +function makeServer(options) { + const { schema, context, roots, validate, execute, subscribe, connectionInitWaitTimeout = 3000, // 3 seconds + onConnect, onDisconnect, onClose, onSubscribe, onOperation, onNext, onError, onComplete, jsonMessageReviver: reviver, jsonMessageReplacer: replacer, } = options; + return { + opened(socket, extra) { + const ctx = { + connectionInitReceived: false, + acknowledged: false, + subscriptions: {}, + extra, + }; + if (socket.protocol !== common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL) { + socket.close(common_1.CloseCode.SubprotocolNotAcceptable, 'Subprotocol not acceptable'); + return async (code, reason) => { + /* nothing was set up, just notify the closure */ + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + } + // kick the client off (close socket) if the connection has + // not been initialised after the specified wait timeout + const connectionInitWait = connectionInitWaitTimeout > 0 && isFinite(connectionInitWaitTimeout) + ? setTimeout(() => { + if (!ctx.connectionInitReceived) + socket.close(common_1.CloseCode.ConnectionInitialisationTimeout, 'Connection initialisation timeout'); + }, connectionInitWaitTimeout) + : null; + socket.onMessage(async function onMessage(data) { + var _a, e_1, _b, _c; + var _d; + let message; + try { + message = (0, common_1.parseMessage)(data, reviver); + } + catch (err) { + return socket.close(common_1.CloseCode.BadRequest, 'Invalid message received'); + } + switch (message.type) { + case common_1.MessageType.ConnectionInit: { + if (ctx.connectionInitReceived) + return socket.close(common_1.CloseCode.TooManyInitialisationRequests, 'Too many initialisation requests'); + // @ts-expect-error: I can write + ctx.connectionInitReceived = true; + if ((0, utils_1.isObject)(message.payload)) + // @ts-expect-error: I can write + ctx.connectionParams = message.payload; + const permittedOrPayload = await (onConnect === null || onConnect === void 0 ? void 0 : onConnect(ctx)); + if (permittedOrPayload === false) + return socket.close(common_1.CloseCode.Forbidden, 'Forbidden'); + // we should acknowledge before send to avoid race conditions (like those exampled in https://github.com/enisdenjo/graphql-ws/issues/501) + // even if the send fails/throws, the connection should be closed because its malfunctioning + // @ts-expect-error: I can write + ctx.acknowledged = true; + await socket.send((0, common_1.stringifyMessage)((0, utils_1.isObject)(permittedOrPayload) + ? { + type: common_1.MessageType.ConnectionAck, + payload: permittedOrPayload, + } + : { + type: common_1.MessageType.ConnectionAck, + // payload is completely absent if not provided + }, replacer)); + return; + } + case common_1.MessageType.Ping: { + if (socket.onPing) + // if the onPing listener is registered, automatic pong is disabled + return await socket.onPing(message.payload); + await socket.send((0, common_1.stringifyMessage)(message.payload + ? { type: common_1.MessageType.Pong, payload: message.payload } + : { + type: common_1.MessageType.Pong, + // payload is completely absent if not provided + })); + return; + } + case common_1.MessageType.Pong: + return await ((_d = socket.onPong) === null || _d === void 0 ? void 0 : _d.call(socket, message.payload)); + case common_1.MessageType.Subscribe: { + if (!ctx.acknowledged) + return socket.close(common_1.CloseCode.Unauthorized, 'Unauthorized'); + const { id, payload } = message; + if (id in ctx.subscriptions) + return socket.close(common_1.CloseCode.SubscriberAlreadyExists, `Subscriber for ${id} already exists`); + // if this turns out to be a streaming operation, the subscription value + // will change to an `AsyncIterable`, otherwise it will stay as is + ctx.subscriptions[id] = null; + const emit = { + next: async (result, args) => { + let nextMessage = { + id, + type: common_1.MessageType.Next, + payload: result, + }; + const maybeResult = await (onNext === null || onNext === void 0 ? void 0 : onNext(ctx, nextMessage, args, result)); + if (maybeResult) + nextMessage = Object.assign(Object.assign({}, nextMessage), { payload: maybeResult }); + await socket.send((0, common_1.stringifyMessage)(nextMessage, replacer)); + }, + error: async (errors) => { + let errorMessage = { + id, + type: common_1.MessageType.Error, + payload: errors, + }; + const maybeErrors = await (onError === null || onError === void 0 ? void 0 : onError(ctx, errorMessage, errors)); + if (maybeErrors) + errorMessage = Object.assign(Object.assign({}, errorMessage), { payload: maybeErrors }); + await socket.send((0, common_1.stringifyMessage)(errorMessage, replacer)); + }, + complete: async (notifyClient) => { + const completeMessage = { + id, + type: common_1.MessageType.Complete, + }; + await (onComplete === null || onComplete === void 0 ? void 0 : onComplete(ctx, completeMessage)); + if (notifyClient) + await socket.send((0, common_1.stringifyMessage)(completeMessage, replacer)); + }, + }; + try { + let execArgs; + const maybeExecArgsOrErrors = await (onSubscribe === null || onSubscribe === void 0 ? void 0 : onSubscribe(ctx, message)); + if (maybeExecArgsOrErrors) { + if ((0, utils_1.areGraphQLErrors)(maybeExecArgsOrErrors)) + return await emit.error(maybeExecArgsOrErrors); + else if (Array.isArray(maybeExecArgsOrErrors)) + throw new Error('Invalid return value from onSubscribe hook, expected an array of GraphQLError objects'); + // not errors, is exec args + execArgs = maybeExecArgsOrErrors; + } + else { + // you either provide a schema dynamically through + // `onSubscribe` or you set one up during the server setup + if (!schema) + throw new Error('The GraphQL schema is not provided'); + const args = { + operationName: payload.operationName, + document: (0, graphql_1.parse)(payload.query), + variableValues: payload.variables, + }; + execArgs = Object.assign(Object.assign({}, args), { schema: typeof schema === 'function' + ? await schema(ctx, message, args) + : schema }); + const validationErrors = (validate !== null && validate !== void 0 ? validate : graphql_1.validate)(execArgs.schema, execArgs.document); + if (validationErrors.length > 0) + return await emit.error(validationErrors); + } + const operationAST = (0, graphql_1.getOperationAST)(execArgs.document, execArgs.operationName); + if (!operationAST) + return await emit.error([ + new graphql_1.GraphQLError('Unable to identify operation'), + ]); + // if `onSubscribe` didn't specify a rootValue, inject one + if (!('rootValue' in execArgs)) + execArgs.rootValue = roots === null || roots === void 0 ? void 0 : roots[operationAST.operation]; + // if `onSubscribe` didn't specify a context, inject one + if (!('contextValue' in execArgs)) + execArgs.contextValue = + typeof context === 'function' + ? await context(ctx, message, execArgs) + : context; + // the execution arguments have been prepared + // perform the operation and act accordingly + let operationResult; + if (operationAST.operation === 'subscription') + operationResult = await (subscribe !== null && subscribe !== void 0 ? subscribe : graphql_1.subscribe)(execArgs); + // operation === 'query' || 'mutation' + else + operationResult = await (execute !== null && execute !== void 0 ? execute : graphql_1.execute)(execArgs); + const maybeResult = await (onOperation === null || onOperation === void 0 ? void 0 : onOperation(ctx, message, execArgs, operationResult)); + if (maybeResult) + operationResult = maybeResult; + if ((0, utils_1.isAsyncIterable)(operationResult)) { + /** multiple emitted results */ + if (!(id in ctx.subscriptions)) { + // subscription was completed/canceled before the operation settled + if ((0, utils_1.isAsyncGenerator)(operationResult)) + operationResult.return(undefined); + } + else { + ctx.subscriptions[id] = operationResult; + try { + for (var _e = true, operationResult_1 = __asyncValues(operationResult), operationResult_1_1; operationResult_1_1 = await operationResult_1.next(), _a = operationResult_1_1.done, !_a; _e = true) { + _c = operationResult_1_1.value; + _e = false; + const result = _c; + await emit.next(result, execArgs); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (!_e && !_a && (_b = operationResult_1.return)) await _b.call(operationResult_1); + } + finally { if (e_1) throw e_1.error; } + } + } + } + else { + /** single emitted result */ + // if the client completed the subscription before the single result + // became available, he effectively canceled it and no data should be sent + if (id in ctx.subscriptions) + await emit.next(operationResult, execArgs); + } + // lack of subscription at this point indicates that the client + // completed the subscription, he doesn't need to be reminded + await emit.complete(id in ctx.subscriptions); + } + finally { + // whatever happens to the subscription, we finally want to get rid of the reservation + delete ctx.subscriptions[id]; + } + return; + } + case common_1.MessageType.Complete: { + const subscription = ctx.subscriptions[message.id]; + delete ctx.subscriptions[message.id]; // deleting the subscription means no further activity should take place + if ((0, utils_1.isAsyncGenerator)(subscription)) + await subscription.return(undefined); + return; + } + default: + throw new Error(`Unexpected message of type ${message.type} received`); + } + }); + // wait for close, cleanup and the disconnect callback + return async (code, reason) => { + if (connectionInitWait) + clearTimeout(connectionInitWait); + for (const [id, sub] of Object.entries(ctx.subscriptions)) { + if ((0, utils_1.isAsyncGenerator)(sub)) + await sub.return(undefined); + delete ctx.subscriptions[id]; // deleting the subscription means no further activity should take place + } + if (ctx.acknowledged) + await (onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect(ctx, code, reason)); + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + }, + }; +} +exports.makeServer = makeServer; +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +function handleProtocols(protocols) { + switch (true) { + case protocols instanceof Set && + protocols.has(common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL): + case Array.isArray(protocols) && + protocols.includes(common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL): + case typeof protocols === 'string' && + protocols + .split(',') + .map((p) => p.trim()) + .includes(common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL): + return common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL; + default: + return false; + } +} +exports.handleProtocols = handleProtocols; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/server.mjs b/graphql-subscription/node_modules/graphql-ws/lib/server.mjs new file mode 100644 index 0000000..02ab7c0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/server.mjs @@ -0,0 +1,296 @@ +/** + * + * server + * + */ +var __asyncValues = (this && this.__asyncValues) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +}; +import { parse, validate as graphqlValidate, execute as graphqlExecute, subscribe as graphqlSubscribe, getOperationAST, GraphQLError, } from 'graphql'; +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, CloseCode, MessageType, stringifyMessage, parseMessage, } from './common.mjs'; +import { isObject, isAsyncGenerator, isAsyncIterable, areGraphQLErrors, } from './utils.mjs'; +/** + * Makes a Protocol compliant WebSocket GraphQL server. The server + * is actually an API which is to be used with your favourite WebSocket + * server library! + * + * Read more about the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Server + */ +export function makeServer(options) { + const { schema, context, roots, validate, execute, subscribe, connectionInitWaitTimeout = 3000, // 3 seconds + onConnect, onDisconnect, onClose, onSubscribe, onOperation, onNext, onError, onComplete, jsonMessageReviver: reviver, jsonMessageReplacer: replacer, } = options; + return { + opened(socket, extra) { + const ctx = { + connectionInitReceived: false, + acknowledged: false, + subscriptions: {}, + extra, + }; + if (socket.protocol !== GRAPHQL_TRANSPORT_WS_PROTOCOL) { + socket.close(CloseCode.SubprotocolNotAcceptable, 'Subprotocol not acceptable'); + return async (code, reason) => { + /* nothing was set up, just notify the closure */ + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + } + // kick the client off (close socket) if the connection has + // not been initialised after the specified wait timeout + const connectionInitWait = connectionInitWaitTimeout > 0 && isFinite(connectionInitWaitTimeout) + ? setTimeout(() => { + if (!ctx.connectionInitReceived) + socket.close(CloseCode.ConnectionInitialisationTimeout, 'Connection initialisation timeout'); + }, connectionInitWaitTimeout) + : null; + socket.onMessage(async function onMessage(data) { + var _a, e_1, _b, _c; + var _d; + let message; + try { + message = parseMessage(data, reviver); + } + catch (err) { + return socket.close(CloseCode.BadRequest, 'Invalid message received'); + } + switch (message.type) { + case MessageType.ConnectionInit: { + if (ctx.connectionInitReceived) + return socket.close(CloseCode.TooManyInitialisationRequests, 'Too many initialisation requests'); + // @ts-expect-error: I can write + ctx.connectionInitReceived = true; + if (isObject(message.payload)) + // @ts-expect-error: I can write + ctx.connectionParams = message.payload; + const permittedOrPayload = await (onConnect === null || onConnect === void 0 ? void 0 : onConnect(ctx)); + if (permittedOrPayload === false) + return socket.close(CloseCode.Forbidden, 'Forbidden'); + // we should acknowledge before send to avoid race conditions (like those exampled in https://github.com/enisdenjo/graphql-ws/issues/501) + // even if the send fails/throws, the connection should be closed because its malfunctioning + // @ts-expect-error: I can write + ctx.acknowledged = true; + await socket.send(stringifyMessage(isObject(permittedOrPayload) + ? { + type: MessageType.ConnectionAck, + payload: permittedOrPayload, + } + : { + type: MessageType.ConnectionAck, + // payload is completely absent if not provided + }, replacer)); + return; + } + case MessageType.Ping: { + if (socket.onPing) + // if the onPing listener is registered, automatic pong is disabled + return await socket.onPing(message.payload); + await socket.send(stringifyMessage(message.payload + ? { type: MessageType.Pong, payload: message.payload } + : { + type: MessageType.Pong, + // payload is completely absent if not provided + })); + return; + } + case MessageType.Pong: + return await ((_d = socket.onPong) === null || _d === void 0 ? void 0 : _d.call(socket, message.payload)); + case MessageType.Subscribe: { + if (!ctx.acknowledged) + return socket.close(CloseCode.Unauthorized, 'Unauthorized'); + const { id, payload } = message; + if (id in ctx.subscriptions) + return socket.close(CloseCode.SubscriberAlreadyExists, `Subscriber for ${id} already exists`); + // if this turns out to be a streaming operation, the subscription value + // will change to an `AsyncIterable`, otherwise it will stay as is + ctx.subscriptions[id] = null; + const emit = { + next: async (result, args) => { + let nextMessage = { + id, + type: MessageType.Next, + payload: result, + }; + const maybeResult = await (onNext === null || onNext === void 0 ? void 0 : onNext(ctx, nextMessage, args, result)); + if (maybeResult) + nextMessage = Object.assign(Object.assign({}, nextMessage), { payload: maybeResult }); + await socket.send(stringifyMessage(nextMessage, replacer)); + }, + error: async (errors) => { + let errorMessage = { + id, + type: MessageType.Error, + payload: errors, + }; + const maybeErrors = await (onError === null || onError === void 0 ? void 0 : onError(ctx, errorMessage, errors)); + if (maybeErrors) + errorMessage = Object.assign(Object.assign({}, errorMessage), { payload: maybeErrors }); + await socket.send(stringifyMessage(errorMessage, replacer)); + }, + complete: async (notifyClient) => { + const completeMessage = { + id, + type: MessageType.Complete, + }; + await (onComplete === null || onComplete === void 0 ? void 0 : onComplete(ctx, completeMessage)); + if (notifyClient) + await socket.send(stringifyMessage(completeMessage, replacer)); + }, + }; + try { + let execArgs; + const maybeExecArgsOrErrors = await (onSubscribe === null || onSubscribe === void 0 ? void 0 : onSubscribe(ctx, message)); + if (maybeExecArgsOrErrors) { + if (areGraphQLErrors(maybeExecArgsOrErrors)) + return await emit.error(maybeExecArgsOrErrors); + else if (Array.isArray(maybeExecArgsOrErrors)) + throw new Error('Invalid return value from onSubscribe hook, expected an array of GraphQLError objects'); + // not errors, is exec args + execArgs = maybeExecArgsOrErrors; + } + else { + // you either provide a schema dynamically through + // `onSubscribe` or you set one up during the server setup + if (!schema) + throw new Error('The GraphQL schema is not provided'); + const args = { + operationName: payload.operationName, + document: parse(payload.query), + variableValues: payload.variables, + }; + execArgs = Object.assign(Object.assign({}, args), { schema: typeof schema === 'function' + ? await schema(ctx, message, args) + : schema }); + const validationErrors = (validate !== null && validate !== void 0 ? validate : graphqlValidate)(execArgs.schema, execArgs.document); + if (validationErrors.length > 0) + return await emit.error(validationErrors); + } + const operationAST = getOperationAST(execArgs.document, execArgs.operationName); + if (!operationAST) + return await emit.error([ + new GraphQLError('Unable to identify operation'), + ]); + // if `onSubscribe` didn't specify a rootValue, inject one + if (!('rootValue' in execArgs)) + execArgs.rootValue = roots === null || roots === void 0 ? void 0 : roots[operationAST.operation]; + // if `onSubscribe` didn't specify a context, inject one + if (!('contextValue' in execArgs)) + execArgs.contextValue = + typeof context === 'function' + ? await context(ctx, message, execArgs) + : context; + // the execution arguments have been prepared + // perform the operation and act accordingly + let operationResult; + if (operationAST.operation === 'subscription') + operationResult = await (subscribe !== null && subscribe !== void 0 ? subscribe : graphqlSubscribe)(execArgs); + // operation === 'query' || 'mutation' + else + operationResult = await (execute !== null && execute !== void 0 ? execute : graphqlExecute)(execArgs); + const maybeResult = await (onOperation === null || onOperation === void 0 ? void 0 : onOperation(ctx, message, execArgs, operationResult)); + if (maybeResult) + operationResult = maybeResult; + if (isAsyncIterable(operationResult)) { + /** multiple emitted results */ + if (!(id in ctx.subscriptions)) { + // subscription was completed/canceled before the operation settled + if (isAsyncGenerator(operationResult)) + operationResult.return(undefined); + } + else { + ctx.subscriptions[id] = operationResult; + try { + for (var _e = true, operationResult_1 = __asyncValues(operationResult), operationResult_1_1; operationResult_1_1 = await operationResult_1.next(), _a = operationResult_1_1.done, !_a; _e = true) { + _c = operationResult_1_1.value; + _e = false; + const result = _c; + await emit.next(result, execArgs); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (!_e && !_a && (_b = operationResult_1.return)) await _b.call(operationResult_1); + } + finally { if (e_1) throw e_1.error; } + } + } + } + else { + /** single emitted result */ + // if the client completed the subscription before the single result + // became available, he effectively canceled it and no data should be sent + if (id in ctx.subscriptions) + await emit.next(operationResult, execArgs); + } + // lack of subscription at this point indicates that the client + // completed the subscription, he doesn't need to be reminded + await emit.complete(id in ctx.subscriptions); + } + finally { + // whatever happens to the subscription, we finally want to get rid of the reservation + delete ctx.subscriptions[id]; + } + return; + } + case MessageType.Complete: { + const subscription = ctx.subscriptions[message.id]; + delete ctx.subscriptions[message.id]; // deleting the subscription means no further activity should take place + if (isAsyncGenerator(subscription)) + await subscription.return(undefined); + return; + } + default: + throw new Error(`Unexpected message of type ${message.type} received`); + } + }); + // wait for close, cleanup and the disconnect callback + return async (code, reason) => { + if (connectionInitWait) + clearTimeout(connectionInitWait); + for (const [id, sub] of Object.entries(ctx.subscriptions)) { + if (isAsyncGenerator(sub)) + await sub.return(undefined); + delete ctx.subscriptions[id]; // deleting the subscription means no further activity should take place + } + if (ctx.acknowledged) + await (onDisconnect === null || onDisconnect === void 0 ? void 0 : onDisconnect(ctx, code, reason)); + await (onClose === null || onClose === void 0 ? void 0 : onClose(ctx, code, reason)); + }; + }, + }; +} +/** + * Helper utility for choosing the "graphql-transport-ws" subprotocol from + * a set of WebSocket subprotocols. + * + * Accepts a set of already extracted WebSocket subprotocols or the raw + * Sec-WebSocket-Protocol header value. In either case, if the right + * protocol appears, it will be returned. + * + * By specification, the server should not provide a value with Sec-WebSocket-Protocol + * if it does not agree with client's subprotocols. The client has a responsibility + * to handle the connection afterwards. + * + * @category Server + */ +export function handleProtocols(protocols) { + switch (true) { + case protocols instanceof Set && + protocols.has(GRAPHQL_TRANSPORT_WS_PROTOCOL): + case Array.isArray(protocols) && + protocols.includes(GRAPHQL_TRANSPORT_WS_PROTOCOL): + case typeof protocols === 'string' && + protocols + .split(',') + .map((p) => p.trim()) + .includes(GRAPHQL_TRANSPORT_WS_PROTOCOL): + return GRAPHQL_TRANSPORT_WS_PROTOCOL; + default: + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts new file mode 100644 index 0000000..6c5b7b0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.mts @@ -0,0 +1,36 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from '@fastify/websocket'; +import { ServerOptions } from '../../server.mjs'; +import { ConnectionInitMessage } from '../../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/@fastify/websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +export declare function makeHandler

    = Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts new file mode 100644 index 0000000..810c0fb --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.d.ts @@ -0,0 +1,36 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from '@fastify/websocket'; +import { ServerOptions } from '../../server'; +import { ConnectionInitMessage } from '../../common'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/@fastify/websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +export declare function makeHandler

    = Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.js b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.js new file mode 100644 index 0000000..9048573 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.js @@ -0,0 +1,126 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = void 0; +const server_1 = require("../../server"); +const common_1 = require("../../common"); +const utils_1 = require("../../utils"); +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = (0, server_1.makeServer)(options); + // we dont have access to the fastify-websocket server instance yet, + // register an error handler on first connection ONCE only + let handlingServerEmittedErrors = false; + return function handler(connection, request) { + const { socket } = connection; + // might be too late, but meh + this.websocketServer.options.handleProtocols = server_1.handleProtocols; + // handle server emitted errors only if not already handling + if (!handlingServerEmittedErrors) { + handlingServerEmittedErrors = true; + this.websocketServer.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of this.websocketServer.clients) { + try { + client.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + } + // used as listener on two streams, prevent superfluous calls on close + let emittedErrorHandled = false; + function handleEmittedError(err) { + if (emittedErrorHandled) + return; + emittedErrorHandled = true; + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + // fastify-websocket uses the WebSocket.createWebSocketStream, + // therefore errors get emitted on both the connection and the socket + connection.once('error', handleEmittedError); + socket.once('error', handleEmittedError); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { connection, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === common_1.CloseCode.SubprotocolNotAcceptable && + socket.protocol === common_1.DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }; +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs new file mode 100644 index 0000000..1940ba1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/@fastify/websocket.mjs @@ -0,0 +1,122 @@ +import { handleProtocols, makeServer } from '../../server.mjs'; +import { DEPRECATED_GRAPHQL_WS_PROTOCOL, CloseCode, } from '../../common.mjs'; +import { limitCloseReason } from '../../utils.mjs'; +/** + * Make a handler to use on a [@fastify/websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/@fastify/websocket + */ +export function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = makeServer(options); + // we dont have access to the fastify-websocket server instance yet, + // register an error handler on first connection ONCE only + let handlingServerEmittedErrors = false; + return function handler(connection, request) { + const { socket } = connection; + // might be too late, but meh + this.websocketServer.options.handleProtocols = handleProtocols; + // handle server emitted errors only if not already handling + if (!handlingServerEmittedErrors) { + handlingServerEmittedErrors = true; + this.websocketServer.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of this.websocketServer.clients) { + try { + client.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + } + // used as listener on two streams, prevent superfluous calls on close + let emittedErrorHandled = false; + function handleEmittedError(err) { + if (emittedErrorHandled) + return; + emittedErrorHandled = true; + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + // fastify-websocket uses the WebSocket.createWebSocketStream, + // therefore errors get emitted on both the connection and the socket + connection.once('error', handleEmittedError); + socket.once('error', handleEmittedError); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { connection, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === CloseCode.SubprotocolNotAcceptable && + socket.protocol === DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }; +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.mts new file mode 100644 index 0000000..7b24b2d --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.mts @@ -0,0 +1,60 @@ +/// +import type { WebSocketHandler, ServerWebSocket } from 'bun'; +import { ConnectionInitMessage } from '../common.mjs'; +import { ServerOptions } from '../server.mjs'; +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +export { handleProtocols } from '../server.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/bun + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: ServerWebSocket; +} +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema/index.mjs'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +export declare function makeHandler

    = Record>(options: ServerOptions>): WebSocketHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.ts new file mode 100644 index 0000000..8c34f1d --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.d.ts @@ -0,0 +1,60 @@ +/// +import type { WebSocketHandler, ServerWebSocket } from 'bun'; +import { ConnectionInitMessage } from '../common'; +import { ServerOptions } from '../server'; +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +export { handleProtocols } from '../server'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/bun + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: ServerWebSocket; +} +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +export declare function makeHandler

    = Record>(options: ServerOptions>): WebSocketHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/bun.js b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.js new file mode 100644 index 0000000..39b76b1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.js @@ -0,0 +1,97 @@ +"use strict"; +/// +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = exports.handleProtocols = void 0; +const common_1 = require("../common"); +const server_1 = require("../server"); +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +var server_2 = require("../server"); +Object.defineProperty(exports, "handleProtocols", { enumerable: true, get: function () { return server_2.handleProtocols; } }); +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +function makeHandler(options) { + const server = (0, server_1.makeServer)(options); + const clients = new WeakMap(); + return { + open(ws) { + const client = { + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + // TODO: use protocol on socket once Bun exposes it + protocol: common_1.GRAPHQL_TRANSPORT_WS_PROTOCOL, + send: async (message) => { + // ws might have been destroyed in the meantime, send only if exists + if (clients.has(ws)) { + ws.sendText(message); + } + }, + close: (code, reason) => { + if (clients.has(ws)) { + ws.close(code, reason); + } + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket: ws }); + clients.set(ws, client); + }, + message(ws, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Message received for a missing client'); + return client.handleMessage(String(message)); + }, + close(ws, code, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Closing a missing client'); + return client.closed(code, message); + }, + }; +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/bun.mjs b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.mjs new file mode 100644 index 0000000..eac61ec --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/bun.mjs @@ -0,0 +1,92 @@ +/// +import { GRAPHQL_TRANSPORT_WS_PROTOCOL, } from '../common.mjs'; +import { makeServer } from '../server.mjs'; +/** + * Convenience export for checking the WebSocket protocol on the request in `Bun.serve`. + */ +export { handleProtocols } from '../server.mjs'; +/** + * Use the server with [Bun](https://bun.sh/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * The WebSocket subprotocol is not available on the established socket and therefore + * needs to be checked during the request handling. + * + * Additionally, the keep-alive logic _seems_ to be handled by Bun seeing that + * they default [`sendPingsAutomatically` to `true`](https://github.com/oven-sh/bun/blob/6a163cf933542506354dc836bd92693bcae5939b/src/deps/uws.zig#L893). + * + * ```ts + * import { makeHandler, handleProtocols } from 'graphql-ws/lib/use/lib/bun'; + * import { schema } from './my-schema/index.mjs'; + * + * Bun.serve({ + * fetch(req, server) { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * if (!handleProtocols(req.headers.get('sec-websocket-protocol') || '')) { + * return new Response('Bad Request', { status: 404 }); + * } + * if (!server.upgrade(req)) { + * return new Response('Internal Server Error', { status: 500 }); + * } + * return new Response(); + * }, + * websocket: makeHandler({ schema }), + * port: 4000, + * }); + * + * console.log('Listening to port 4000'); + * ``` + * + * @category Server/bun + */ +export function makeHandler(options) { + const server = makeServer(options); + const clients = new WeakMap(); + return { + open(ws) { + const client = { + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + // TODO: use protocol on socket once Bun exposes it + protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + send: async (message) => { + // ws might have been destroyed in the meantime, send only if exists + if (clients.has(ws)) { + ws.sendText(message); + } + }, + close: (code, reason) => { + if (clients.has(ws)) { + ws.close(code, reason); + } + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket: ws }); + clients.set(ws, client); + }, + message(ws, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Message received for a missing client'); + return client.handleMessage(String(message)); + }, + close(ws, code, message) { + const client = clients.get(ws); + if (!client) + throw new Error('Closing a missing client'); + return client.closed(code, message); + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.mts new file mode 100644 index 0000000..1d9b80e --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.mts @@ -0,0 +1,56 @@ +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage } from '../common.mjs'; +export { GRAPHQL_TRANSPORT_WS_PROTOCOL } from '../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/deno + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; +} +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts/index.mjs'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +export declare function makeHandler

    = Record>(options: ServerOptions>): (socket: WebSocket) => void; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.ts new file mode 100644 index 0000000..2417c24 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.d.ts @@ -0,0 +1,56 @@ +import { ServerOptions } from '../server'; +import { ConnectionInitMessage } from '../common'; +export { GRAPHQL_TRANSPORT_WS_PROTOCOL } from '../common'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/deno + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; +} +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +export declare function makeHandler

    = Record>(options: ServerOptions>): (socket: WebSocket) => void; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/deno.js b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.js new file mode 100644 index 0000000..bf83f66 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = void 0; +const server_1 = require("../server"); +const common_1 = require("../common"); +var common_2 = require("../common"); +Object.defineProperty(exports, "GRAPHQL_TRANSPORT_WS_PROTOCOL", { enumerable: true, get: function () { return common_2.GRAPHQL_TRANSPORT_WS_PROTOCOL; } }); +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +function makeHandler(options) { + const server = (0, server_1.makeServer)(options); + return function handle(socket) { + socket.onerror = (err) => { + console.error('Internal error emitted on the WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, 'Internal server error'); + }; + let closed = () => { + // noop + }; + socket.onopen = () => { + closed = server.opened({ + protocol: socket.protocol, + send: (msg) => socket.send(msg), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => { + socket.onmessage = async (event) => { + try { + await cb(String(event.data)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, 'Internal server error'); + } + }; + }, + }, { socket }); + }; + socket.onclose = (event) => { + if (event.code === common_1.CloseCode.SubprotocolNotAcceptable && + socket.protocol === common_1.DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(event.code, event.reason); + }; + }; +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/deno.mjs b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.mjs new file mode 100644 index 0000000..3cd9095 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/deno.mjs @@ -0,0 +1,83 @@ +import { makeServer } from '../server.mjs'; +import { DEPRECATED_GRAPHQL_WS_PROTOCOL, CloseCode, } from '../common.mjs'; +export { GRAPHQL_TRANSPORT_WS_PROTOCOL } from '../common.mjs'; +/** + * Use the server with [Deno](https://deno.com/). + * This is a basic starter, feel free to copy the code over and adjust it to your needs. + * + * The keep-alive is set in `Deno.upgradeWebSocket` during the upgrade. + * + * Additionally, the required WebSocket protocol is also defined during the upgrade, + * the correct example being: + * + * ```ts + * import { serve } from 'https://deno.land/std/http/mod.ts'; + * import { + * makeHandler, + * GRAPHQL_TRANSPORT_WS_PROTOCOL, + * } from 'https://esm.sh/graphql-ws/lib/use/deno'; + * import { schema } from './my-schema.ts/index.mjs'; + * + * const handler = makeHandler({ schema }); + * + * serve( + * (req: Request) => { + * const [path, _search] = req.url.split('?'); + * if (!path.endsWith('/graphql')) { + * return new Response('Not Found', { status: 404 }); + * } + * if (req.headers.get('upgrade') != 'websocket') { + * return new Response('Upgrade Required', { status: 426 }); + * } + * const { socket, response } = Deno.upgradeWebSocket(req, { + * protocol: GRAPHQL_TRANSPORT_WS_PROTOCOL, + * idleTimeout: 12_000, + * }); + * handler(socket); + * return response; + * }, + * { port: 4000 }, + * ); + * ``` + * + * @category Server/deno + */ +export function makeHandler(options) { + const server = makeServer(options); + return function handle(socket) { + socket.onerror = (err) => { + console.error('Internal error emitted on the WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, 'Internal server error'); + }; + let closed = () => { + // noop + }; + socket.onopen = () => { + closed = server.opened({ + protocol: socket.protocol, + send: (msg) => socket.send(msg), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => { + socket.onmessage = async (event) => { + try { + await cb(String(event.data)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, 'Internal server error'); + } + }; + }, + }, { socket }); + }; + socket.onclose = (event) => { + if (event.code === CloseCode.SubprotocolNotAcceptable && + socket.protocol === DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(event.code, event.reason); + }; + }; +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts new file mode 100644 index 0000000..aa91314 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.mts @@ -0,0 +1,40 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from 'fastify-websocket'; +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage } from '../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export declare function makeHandler

    = Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts new file mode 100644 index 0000000..3e01ab9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.d.ts @@ -0,0 +1,40 @@ +import type { FastifyRequest } from 'fastify'; +import type * as fastifyWebsocket from 'fastify-websocket'; +import { ServerOptions } from '../server'; +import { ConnectionInitMessage } from '../common'; +/** + * The extra that will be put in the `Context`. + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export interface Extra { + /** + * The underlying socket connection between the server and the client. + * The WebSocket socket is located under the `socket` parameter. + */ + readonly connection: fastifyWebsocket.SocketStream; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: FastifyRequest; +} +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export declare function makeHandler

    = Record>(options: ServerOptions>, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): fastifyWebsocket.WebsocketHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.js b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.js new file mode 100644 index 0000000..e033342 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeHandler = void 0; +const websocket_1 = require("./@fastify/websocket"); +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + // new handler can be reused, the semantics stayed the same + return (0, websocket_1.makeHandler)(options, keepAlive); +} +exports.makeHandler = makeHandler; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.mjs b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.mjs new file mode 100644 index 0000000..e533497 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/fastify-websocket.mjs @@ -0,0 +1,21 @@ +import { makeHandler as makeHandlerCurrent } from './@fastify/websocket.mjs'; +/** + * Make a handler to use on a [fastify-websocket](https://github.com/fastify/fastify-websocket) route. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @deprecated Use `@fastify/websocket` instead. + * + * @category Server/fastify-websocket + */ +export function makeHandler(options, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + // new handler can be reused, the semantics stayed the same + return makeHandlerCurrent(options, keepAlive); +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.mts new file mode 100644 index 0000000..809418c --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.mts @@ -0,0 +1,67 @@ +/// +import type * as uWS from 'uWebSockets.js'; +import type http from 'http'; +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage } from '../common.mjs'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/uWebSockets + */ +export interface Extra extends UpgradeData { + /** + * The actual socket connection between the server and the client + * with the upgrade data. + */ + readonly socket: uWS.WebSocket & UpgradeData; +} +/** + * Data acquired during the HTTP upgrade callback from uWS. + * + * @category Server/uWebSockets + */ +export interface UpgradeData { + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds the relevant values extracted from the uWS's request + * while it is accessible. + */ + readonly persistedRequest: PersistedRequest; +} +/** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds relevant values extracted from the uWS's request + * while it is accessible. + * + * @category Server/uWebSockets + */ +export interface PersistedRequest { + method: string; + url: string; + /** The raw query string (after the `?` sign) or empty string. */ + query: string; + headers: http.IncomingHttpHeaders; +} +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +export declare function makeBehavior

    = Record>(options: ServerOptions>, behavior?: uWS.WebSocketBehavior, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): uWS.WebSocketBehavior; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.ts new file mode 100644 index 0000000..837b7bb --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.d.ts @@ -0,0 +1,67 @@ +/// +import type * as uWS from 'uWebSockets.js'; +import type http from 'http'; +import { ServerOptions } from '../server'; +import { ConnectionInitMessage } from '../common'; +/** + * The extra that will be put in the `Context`. + * + * @category Server/uWebSockets + */ +export interface Extra extends UpgradeData { + /** + * The actual socket connection between the server and the client + * with the upgrade data. + */ + readonly socket: uWS.WebSocket & UpgradeData; +} +/** + * Data acquired during the HTTP upgrade callback from uWS. + * + * @category Server/uWebSockets + */ +export interface UpgradeData { + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds the relevant values extracted from the uWS's request + * while it is accessible. + */ + readonly persistedRequest: PersistedRequest; +} +/** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + * + * uWS's request is stack allocated and cannot be accessed + * from outside of the internal upgrade; therefore, the persisted + * request holds relevant values extracted from the uWS's request + * while it is accessible. + * + * @category Server/uWebSockets + */ +export interface PersistedRequest { + method: string; + url: string; + /** The raw query string (after the `?` sign) or empty string. */ + query: string; + headers: http.IncomingHttpHeaders; +} +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +export declare function makeBehavior

    = Record>(options: ServerOptions>, behavior?: uWS.WebSocketBehavior, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): uWS.WebSocketBehavior; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.js b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.js new file mode 100644 index 0000000..3f9a8c0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.js @@ -0,0 +1,141 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeBehavior = void 0; +const server_1 = require("../server"); +const common_1 = require("../common"); +const utils_1 = require("../utils"); +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +function makeBehavior(options, behavior = {}, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = (0, server_1.makeServer)(options); + const clients = new Map(); + let onDrain = () => { + // gets called when backpressure drains + }; + return Object.assign(Object.assign({}, behavior), { pong(...args) { + var _a; + (_a = behavior.pong) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Pong received for a missing client'); + if (client.pongWaitTimeout) { + clearTimeout(client.pongWaitTimeout); + client.pongWaitTimeout = null; + } + }, + upgrade(...args) { + var _a; + (_a = behavior.upgrade) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [res, req, context] = args; + const headers = {}; + req.forEach((key, value) => { + headers[key] = value; + }); + res.upgrade({ + persistedRequest: { + method: req.getMethod(), + url: req.getUrl(), + query: req.getQuery(), + headers, + }, + }, req.getHeader('sec-websocket-key'), (0, server_1.handleProtocols)(req.getHeader('sec-websocket-protocol')) || + new Uint8Array(), req.getHeader('sec-websocket-extensions'), context); + }, + open(...args) { + var _a; + (_a = behavior.open) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const socket = args[0]; + const persistedRequest = socket.persistedRequest; + // prepare client object + const client = { + pingInterval: null, + pongWaitTimeout: null, + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + protocol: (0, server_1.handleProtocols)(persistedRequest.headers['sec-websocket-protocol'] || '') || '', + send: async (message) => { + // the socket might have been destroyed in the meantime + if (!clients.has(socket)) + return; + if (!socket.send(message)) + // if backpressure is built up wait for drain + await new Promise((resolve) => (onDrain = resolve)); + }, + close: (code, reason) => { + // end socket in next tick making sure the client is registered + setImmediate(() => { + // the socket might have been destroyed before issuing a close + if (clients.has(socket)) + socket.end(code, reason); + }); + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket, persistedRequest }); + if (keepAlive > 0 && isFinite(keepAlive)) { + client.pingInterval = setInterval(() => { + // terminate the connection after pong wait has passed because the client is idle + client.pongWaitTimeout = setTimeout(() => socket.close(), keepAlive); + socket.ping(); + }, keepAlive); + } + clients.set(socket, client); + }, + drain(...args) { + var _a; + (_a = behavior.drain) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + onDrain(); + }, + async message(...args) { + var _a; + (_a = behavior.message) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Message received for a missing client'); + try { + await client.handleMessage(Buffer.from(message).toString()); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.end(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }, + close(...args) { + var _a; + (_a = behavior.close) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, code, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Closing a missing client'); + if (client.pongWaitTimeout) + clearTimeout(client.pongWaitTimeout); + if (client.pingInterval) + clearTimeout(client.pingInterval); + client.closed(code, Buffer.from(message).toString()); + clients.delete(socket); + } }); +} +exports.makeBehavior = makeBehavior; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.mjs b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.mjs new file mode 100644 index 0000000..833ce14 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/uWebSockets.mjs @@ -0,0 +1,137 @@ +import { handleProtocols, makeServer } from '../server.mjs'; +import { CloseCode } from '../common.mjs'; +import { limitCloseReason } from '../utils.mjs'; +/** + * Make the behaviour for using a [uWebSockets.js](https://github.com/uNetworking/uWebSockets.js) WebSocket server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/uWebSockets + */ +export function makeBehavior(options, behavior = {}, +/** + * The timout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = makeServer(options); + const clients = new Map(); + let onDrain = () => { + // gets called when backpressure drains + }; + return Object.assign(Object.assign({}, behavior), { pong(...args) { + var _a; + (_a = behavior.pong) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Pong received for a missing client'); + if (client.pongWaitTimeout) { + clearTimeout(client.pongWaitTimeout); + client.pongWaitTimeout = null; + } + }, + upgrade(...args) { + var _a; + (_a = behavior.upgrade) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [res, req, context] = args; + const headers = {}; + req.forEach((key, value) => { + headers[key] = value; + }); + res.upgrade({ + persistedRequest: { + method: req.getMethod(), + url: req.getUrl(), + query: req.getQuery(), + headers, + }, + }, req.getHeader('sec-websocket-key'), handleProtocols(req.getHeader('sec-websocket-protocol')) || + new Uint8Array(), req.getHeader('sec-websocket-extensions'), context); + }, + open(...args) { + var _a; + (_a = behavior.open) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const socket = args[0]; + const persistedRequest = socket.persistedRequest; + // prepare client object + const client = { + pingInterval: null, + pongWaitTimeout: null, + handleMessage: () => { + throw new Error('Message received before handler was registered'); + }, + closed: () => { + throw new Error('Closed before handler was registered'); + }, + }; + client.closed = server.opened({ + protocol: handleProtocols(persistedRequest.headers['sec-websocket-protocol'] || '') || '', + send: async (message) => { + // the socket might have been destroyed in the meantime + if (!clients.has(socket)) + return; + if (!socket.send(message)) + // if backpressure is built up wait for drain + await new Promise((resolve) => (onDrain = resolve)); + }, + close: (code, reason) => { + // end socket in next tick making sure the client is registered + setImmediate(() => { + // the socket might have been destroyed before issuing a close + if (clients.has(socket)) + socket.end(code, reason); + }); + }, + onMessage: (cb) => (client.handleMessage = cb), + }, { socket, persistedRequest }); + if (keepAlive > 0 && isFinite(keepAlive)) { + client.pingInterval = setInterval(() => { + // terminate the connection after pong wait has passed because the client is idle + client.pongWaitTimeout = setTimeout(() => socket.close(), keepAlive); + socket.ping(); + }, keepAlive); + } + clients.set(socket, client); + }, + drain(...args) { + var _a; + (_a = behavior.drain) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + onDrain(); + }, + async message(...args) { + var _a; + (_a = behavior.message) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Message received for a missing client'); + try { + await client.handleMessage(Buffer.from(message).toString()); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.end(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }, + close(...args) { + var _a; + (_a = behavior.close) === null || _a === void 0 ? void 0 : _a.call(behavior, ...args); + const [socket, code, message] = args; + const client = clients.get(socket); + if (!client) + throw new Error('Closing a missing client'); + if (client.pongWaitTimeout) + clearTimeout(client.pongWaitTimeout); + if (client.pingInterval) + clearTimeout(client.pingInterval); + client.closed(code, Buffer.from(message).toString()); + clients.delete(socket); + } }); +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.mts new file mode 100644 index 0000000..3f49108 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.mts @@ -0,0 +1,38 @@ +import type * as http from 'http'; +import type * as ws from 'ws'; +import { ServerOptions } from '../server.mjs'; +import { ConnectionInitMessage, Disposable } from '../common.mjs'; +type WebSocket = typeof ws.prototype; +type WebSocketServer = ws.Server; +/** + * The extra that will be put in the `Context`. + * + * @category Server/ws + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: http.IncomingMessage; +} +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +export declare function useServer

    = Record>(options: ServerOptions>, ws: WebSocketServer, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): Disposable; +export {}; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.ts new file mode 100644 index 0000000..74a6974 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.d.ts @@ -0,0 +1,38 @@ +import type * as http from 'http'; +import type * as ws from 'ws'; +import { ServerOptions } from '../server'; +import { ConnectionInitMessage, Disposable } from '../common'; +type WebSocket = typeof ws.prototype; +type WebSocketServer = ws.Server; +/** + * The extra that will be put in the `Context`. + * + * @category Server/ws + */ +export interface Extra { + /** + * The actual socket connection between the server and the client. + */ + readonly socket: WebSocket; + /** + * The initial HTTP upgrade request before the actual + * socket and connection is established. + */ + readonly request: http.IncomingMessage; +} +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +export declare function useServer

    = Record>(options: ServerOptions>, ws: WebSocketServer, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive?: number): Disposable; +export {}; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/ws.js b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.js new file mode 100644 index 0000000..894f1a7 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.js @@ -0,0 +1,119 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useServer = void 0; +const server_1 = require("../server"); +const common_1 = require("../common"); +const utils_1 = require("../utils"); +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +function useServer(options, ws, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = (0, server_1.makeServer)(options); + ws.options.handleProtocols = server_1.handleProtocols; + ws.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of ws.clients) { + try { + client.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + ws.on('connection', (socket, request) => { + socket.once('error', (err) => { + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + }); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(common_1.CloseCode.InternalServerError, isProd + ? 'Internal server error' + : (0, utils_1.limitCloseReason)(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { socket, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === common_1.CloseCode.SubprotocolNotAcceptable && + socket.protocol === common_1.DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }); + return { + dispose: async () => { + for (const client of ws.clients) { + client.close(1001, 'Going away'); + } + ws.removeAllListeners(); + await new Promise((resolve, reject) => { + ws.close((err) => (err ? reject(err) : resolve())); + }); + }, + }; +} +exports.useServer = useServer; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/use/ws.mjs b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.mjs new file mode 100644 index 0000000..ee38127 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/use/ws.mjs @@ -0,0 +1,115 @@ +import { handleProtocols, makeServer } from '../server.mjs'; +import { DEPRECATED_GRAPHQL_WS_PROTOCOL, CloseCode, } from '../common.mjs'; +import { limitCloseReason } from '../utils.mjs'; +/** + * Use the server on a [ws](https://github.com/websockets/ws) ws server. + * This is a basic starter, feel free to copy the code over and adjust it to your needs + * + * @category Server/ws + */ +export function useServer(options, ws, +/** + * The timeout between dispatched keep-alive messages. Internally uses the [ws Ping and Pongs]((https://developer.mozilla.org/en-US/docs/Web/API/wss_API/Writing_ws_servers#Pings_and_Pongs_The_Heartbeat_of_wss)) + * to check that the link between the clients and the server is operating and to prevent the link + * from being broken due to idling. + * + * @default 12_000 // 12 seconds + */ +keepAlive = 12000) { + const isProd = process.env.NODE_ENV === 'production'; + const server = makeServer(options); + ws.options.handleProtocols = handleProtocols; + ws.once('error', (err) => { + console.error('Internal error emitted on the WebSocket server. ' + + 'Please check your implementation.', err); + // catch the first thrown error and re-throw it once all clients have been notified + let firstErr = null; + // report server errors by erroring out all clients with the same error + for (const client of ws.clients) { + try { + client.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + catch (err) { + firstErr = firstErr !== null && firstErr !== void 0 ? firstErr : err; + } + } + if (firstErr) + throw firstErr; + }); + ws.on('connection', (socket, request) => { + socket.once('error', (err) => { + console.error('Internal error emitted on a WebSocket socket. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + }); + // keep alive through ping-pong messages + let pongWait = null; + const pingInterval = keepAlive > 0 && isFinite(keepAlive) + ? setInterval(() => { + // ping pong on open sockets only + if (socket.readyState === socket.OPEN) { + // terminate the connection after pong wait has passed because the client is idle + pongWait = setTimeout(() => { + socket.terminate(); + }, keepAlive); + // listen for client's pong and stop socket termination + socket.once('pong', () => { + if (pongWait) { + clearTimeout(pongWait); + pongWait = null; + } + }); + socket.ping(); + } + }, keepAlive) + : null; + const closed = server.opened({ + protocol: socket.protocol, + send: (data) => new Promise((resolve, reject) => { + if (socket.readyState !== socket.OPEN) + return resolve(); + socket.send(data, (err) => (err ? reject(err) : resolve())); + }), + close: (code, reason) => socket.close(code, reason), + onMessage: (cb) => socket.on('message', async (event) => { + try { + await cb(String(event)); + } + catch (err) { + console.error('Internal error occurred during message handling. ' + + 'Please check your implementation.', err); + socket.close(CloseCode.InternalServerError, isProd + ? 'Internal server error' + : limitCloseReason(err instanceof Error ? err.message : String(err), 'Internal server error')); + } + }), + }, { socket, request }); + socket.once('close', (code, reason) => { + if (pongWait) + clearTimeout(pongWait); + if (pingInterval) + clearInterval(pingInterval); + if (!isProd && + code === CloseCode.SubprotocolNotAcceptable && + socket.protocol === DEPRECATED_GRAPHQL_WS_PROTOCOL) + console.warn(`Client provided the unsupported and deprecated subprotocol "${socket.protocol}" used by subscriptions-transport-ws.` + + 'Please see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws.'); + closed(code, String(reason)); + }); + }); + return { + dispose: async () => { + for (const client of ws.clients) { + client.close(1001, 'Going away'); + } + ws.removeAllListeners(); + await new Promise((resolve, reject) => { + ws.close((err) => (err ? reject(err) : resolve())); + }); + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql-ws/lib/utils.d.mts b/graphql-subscription/node_modules/graphql-ws/lib/utils.d.mts new file mode 100644 index 0000000..cc1262d --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/utils.d.mts @@ -0,0 +1,23 @@ +/** + * + * utils + * + */ +import { GraphQLError } from 'graphql'; +/** @private */ +export declare function extendedTypeof(val: unknown): 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'array' | 'null'; +/** @private */ +export declare function isObject(val: unknown): val is Record; +/** @private */ +export declare function isAsyncIterable(val: unknown): val is AsyncIterable; +/** @private */ +export declare function isAsyncGenerator(val: unknown): val is AsyncGenerator; +/** @private */ +export declare function areGraphQLErrors(obj: unknown): obj is readonly GraphQLError[]; +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +export declare function limitCloseReason(reason: string, whenTooLong: string): string; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/utils.d.ts b/graphql-subscription/node_modules/graphql-ws/lib/utils.d.ts new file mode 100644 index 0000000..cc1262d --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/utils.d.ts @@ -0,0 +1,23 @@ +/** + * + * utils + * + */ +import { GraphQLError } from 'graphql'; +/** @private */ +export declare function extendedTypeof(val: unknown): 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'array' | 'null'; +/** @private */ +export declare function isObject(val: unknown): val is Record; +/** @private */ +export declare function isAsyncIterable(val: unknown): val is AsyncIterable; +/** @private */ +export declare function isAsyncGenerator(val: unknown): val is AsyncGenerator; +/** @private */ +export declare function areGraphQLErrors(obj: unknown): obj is readonly GraphQLError[]; +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +export declare function limitCloseReason(reason: string, whenTooLong: string): string; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/utils.js b/graphql-subscription/node_modules/graphql-ws/lib/utils.js new file mode 100644 index 0000000..2b1241a --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/utils.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.limitCloseReason = exports.areGraphQLErrors = exports.isAsyncGenerator = exports.isAsyncIterable = exports.isObject = exports.extendedTypeof = void 0; +/** @private */ +function extendedTypeof(val) { + if (val === null) { + return 'null'; + } + if (Array.isArray(val)) { + return 'array'; + } + return typeof val; +} +exports.extendedTypeof = extendedTypeof; +/** @private */ +function isObject(val) { + return extendedTypeof(val) === 'object'; +} +exports.isObject = isObject; +/** @private */ +function isAsyncIterable(val) { + return typeof Object(val)[Symbol.asyncIterator] === 'function'; +} +exports.isAsyncIterable = isAsyncIterable; +/** @private */ +function isAsyncGenerator(val) { + return (isObject(val) && + typeof Object(val)[Symbol.asyncIterator] === 'function' && + typeof val.return === 'function' + // for lazy ones, we only need the return anyway + // typeof val.throw === 'function' && + // typeof val.next === 'function' + ); +} +exports.isAsyncGenerator = isAsyncGenerator; +/** @private */ +function areGraphQLErrors(obj) { + return (Array.isArray(obj) && + // must be at least one error + obj.length > 0 && + // error has at least a message + obj.every((ob) => 'message' in ob)); +} +exports.areGraphQLErrors = areGraphQLErrors; +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +function limitCloseReason(reason, whenTooLong) { + return reason.length < 124 ? reason : whenTooLong; +} +exports.limitCloseReason = limitCloseReason; diff --git a/graphql-subscription/node_modules/graphql-ws/lib/utils.mjs b/graphql-subscription/node_modules/graphql-ws/lib/utils.mjs new file mode 100644 index 0000000..5820119 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/lib/utils.mjs @@ -0,0 +1,45 @@ +/** @private */ +export function extendedTypeof(val) { + if (val === null) { + return 'null'; + } + if (Array.isArray(val)) { + return 'array'; + } + return typeof val; +} +/** @private */ +export function isObject(val) { + return extendedTypeof(val) === 'object'; +} +/** @private */ +export function isAsyncIterable(val) { + return typeof Object(val)[Symbol.asyncIterator] === 'function'; +} +/** @private */ +export function isAsyncGenerator(val) { + return (isObject(val) && + typeof Object(val)[Symbol.asyncIterator] === 'function' && + typeof val.return === 'function' + // for lazy ones, we only need the return anyway + // typeof val.throw === 'function' && + // typeof val.next === 'function' + ); +} +/** @private */ +export function areGraphQLErrors(obj) { + return (Array.isArray(obj) && + // must be at least one error + obj.length > 0 && + // error has at least a message + obj.every((ob) => 'message' in ob)); +} +/** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ +export function limitCloseReason(reason, whenTooLong) { + return reason.length < 124 ? reason : whenTooLong; +} diff --git a/graphql-subscription/node_modules/graphql-ws/package.json b/graphql-subscription/node_modules/graphql-ws/package.json new file mode 100644 index 0000000..d9f85b0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/package.json @@ -0,0 +1,152 @@ +{ + "name": "graphql-ws", + "version": "5.15.0", + "description": "Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client", + "keywords": [ + "protocol", + "graphql", + "transport", + "subscriptions", + "websockets", + "server", + "client", + "observables", + "express", + "relay", + "apollo", + "fastify", + "uwebsockets" + ], + "author": "Denis Badurina ", + "license": "MIT", + "homepage": "https://github.com/enisdenjo/graphql-ws#readme", + "repository": { + "type": "git", + "url": "https://github.com/enisdenjo/graphql-ws.git" + }, + "engines": { + "node": ">=10" + }, + "packageManager": "yarn@3.6.0", + "types": "lib/index.d.ts", + "main": "lib/index.js", + "module": "lib/index.mjs", + "browser": "umd/graphql-ws.js", + "exports": { + ".": { + "types": "./lib/index.d.ts", + "require": "./lib/index.js", + "import": "./lib/index.mjs", + "browser": "./umd/graphql-ws.js" + }, + "./lib/use/ws": { + "types": "./lib/use/ws.d.ts", + "require": "./lib/use/ws.js", + "import": "./lib/use/ws.mjs" + }, + "./lib/use/uWebSockets": { + "types": "./lib/use/uWebSockets.d.ts", + "require": "./lib/use/uWebSockets.js", + "import": "./lib/use/uWebSockets.mjs" + }, + "./lib/use/@fastify/websocket": { + "types": "./lib/use/@fastify/websocket.d.ts", + "require": "./lib/use/@fastify/websocket.js", + "import": "./lib/use/@fastify/websocket.mjs" + }, + "./lib/use/fastify-websocket": { + "types": "./lib/use/fastify-websocket.d.ts", + "require": "./lib/use/fastify-websocket.js", + "import": "./lib/use/fastify-websocket.mjs" + }, + "./lib/use/bun": { + "bun": "./lib/use/bun.mjs", + "types": "./lib/use/bun.d.ts", + "require": "./lib/use/bun.js", + "import": "./lib/use/bun.mjs" + }, + "./lib/use/deno": { + "types": "./lib/use/deno.d.ts", + "require": "./lib/use/deno.js", + "import": "./lib/use/deno.mjs" + }, + "./package.json": "./package.json" + }, + "files": [ + "lib", + "umd", + "README.md", + "LICENSE.md", + "PROTOCOL.md" + ], + "sideEffects": [ + "umd/*" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "gendocs": "typedoc --options typedoc.js src/ && node scripts/post-gendocs.mjs", + "lint:eslint": "eslint 'src'", + "lint:prettier": "prettier -c .", + "lint": "yarn lint:eslint && yarn lint:prettier", + "type-check": "tsc --noEmit", + "test": "jest", + "bench:start-servers": "NODE_ENV=production node benchmark/servers/index.mjs", + "bench": "k6 run benchmark/k6.mjs", + "build:esm": "tsc -b tsconfig.esm.json && node scripts/esm-post-process.mjs", + "build:cjs": "tsc -b tsconfig.cjs.json", + "build:umd": "rollup --bundleConfigAsCjs --config rollup.config.ts --configPlugin typescript && gzip umd/graphql-ws.min.js -c > umd/graphql-ws.min.js.gz", + "build": "yarn build:esm && yarn build:cjs && yarn build:umd && yarn postbuild", + "postbuild": "node scripts/fix-declaration-directives.mjs", + "prepack": "npm pkg delete workspaces", + "postpack": "npm pkg set 'workspaces[]=website'", + "release": "semantic-release" + }, + "peerDependencies": { + "graphql": ">=0.11 <=16" + }, + "devDependencies": { + "@babel/core": "^7.22.5", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", + "@babel/plugin-proposal-object-rest-spread": "^7.20.7", + "@babel/plugin-proposal-optional-chaining": "^7.21.0", + "@babel/preset-env": "^7.22.5", + "@babel/preset-typescript": "^7.22.5", + "@fastify/websocket": "^7.2.0", + "@rollup/plugin-terser": "^0.4.3", + "@rollup/plugin-typescript": "^11.1.1", + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "@types/eslint": "^8.40.2", + "@types/glob": "^8.1.0", + "@types/jest": "^29.5.2", + "@types/ws": "^8.5.5", + "@typescript-eslint/eslint-plugin": "^5.60.0", + "@typescript-eslint/parser": "^5.60.0", + "babel-jest": "^29.5.0", + "bun-types": "^0.6.9", + "eslint": "^8.43.0", + "eslint-config-prettier": "^8.8.0", + "fastify": "^4.18.0", + "fastify-websocket": "4.2.2", + "glob": "^10.3.0", + "graphql": "^16.7.0", + "jest": "^29.5.0", + "jest-environment-jsdom": "^29.5.0", + "jest-jasmine2": "^29.5.0", + "prettier": "^2.8.8", + "replacestream": "^4.0.3", + "rollup": "^3.25.1", + "semantic-release": "^21.0.5", + "subscriptions-transport-ws": "^0.11.0", + "tslib": "^2.5.3", + "typedoc": "^0.24.8", + "typedoc-plugin-markdown": "^3.15.3", + "typescript": "^5.1.3", + "uWebSockets.js": "uNetworking/uWebSockets.js#v20.30.0", + "ws": "8.12.0", + "ws7": "npm:ws@^7.5.9" + } +} diff --git a/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.js b/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.js new file mode 100644 index 0000000..c51d3bb --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.js @@ -0,0 +1,800 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.graphqlWs = {})); +})(this, (function (exports) { 'use strict'; + + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + /* global Reflect, Promise */ + + + function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + } + + /** @private */ + function extendedTypeof(val) { + if (val === null) { + return 'null'; + } + if (Array.isArray(val)) { + return 'array'; + } + return typeof val; + } + /** @private */ + function isObject(val) { + return extendedTypeof(val) === 'object'; + } + /** @private */ + function areGraphQLErrors(obj) { + return (Array.isArray(obj) && + // must be at least one error + obj.length > 0 && + // error has at least a message + obj.every((ob) => 'message' in ob)); + } + /** + * Limits the WebSocket close event reason to not exceed a length of one frame. + * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2. + * + * @private + */ + function limitCloseReason(reason, whenTooLong) { + return reason.length < 124 ? reason : whenTooLong; + } + + /** + * + * common + * + */ + /** + * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ + const GRAPHQL_TRANSPORT_WS_PROTOCOL = 'graphql-transport-ws'; + /** + * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws). + * + * @private + */ + const DEPRECATED_GRAPHQL_WS_PROTOCOL = 'graphql-ws'; + /** + * `graphql-ws` expected and standard close codes of the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md). + * + * @category Common + */ + exports.CloseCode = void 0; + (function (CloseCode) { + CloseCode[CloseCode["InternalServerError"] = 4500] = "InternalServerError"; + CloseCode[CloseCode["InternalClientError"] = 4005] = "InternalClientError"; + CloseCode[CloseCode["BadRequest"] = 4400] = "BadRequest"; + CloseCode[CloseCode["BadResponse"] = 4004] = "BadResponse"; + /** Tried subscribing before connect ack */ + CloseCode[CloseCode["Unauthorized"] = 4401] = "Unauthorized"; + CloseCode[CloseCode["Forbidden"] = 4403] = "Forbidden"; + CloseCode[CloseCode["SubprotocolNotAcceptable"] = 4406] = "SubprotocolNotAcceptable"; + CloseCode[CloseCode["ConnectionInitialisationTimeout"] = 4408] = "ConnectionInitialisationTimeout"; + CloseCode[CloseCode["ConnectionAcknowledgementTimeout"] = 4504] = "ConnectionAcknowledgementTimeout"; + /** Subscriber distinction is very important */ + CloseCode[CloseCode["SubscriberAlreadyExists"] = 4409] = "SubscriberAlreadyExists"; + CloseCode[CloseCode["TooManyInitialisationRequests"] = 4429] = "TooManyInitialisationRequests"; + })(exports.CloseCode || (exports.CloseCode = {})); + /** + * Types of messages allowed to be sent by the client/server over the WS protocol. + * + * @category Common + */ + exports.MessageType = void 0; + (function (MessageType) { + MessageType["ConnectionInit"] = "connection_init"; + MessageType["ConnectionAck"] = "connection_ack"; + MessageType["Ping"] = "ping"; + MessageType["Pong"] = "pong"; + MessageType["Subscribe"] = "subscribe"; + MessageType["Next"] = "next"; + MessageType["Error"] = "error"; + MessageType["Complete"] = "complete"; + })(exports.MessageType || (exports.MessageType = {})); + /** + * Validates the message against the GraphQL over WebSocket Protocol. + * + * Invalid messages will throw descriptive errors. + * + * @category Common + */ + function validateMessage(val) { + if (!isObject(val)) { + throw new Error(`Message is expected to be an object, but got ${extendedTypeof(val)}`); + } + if (!val.type) { + throw new Error(`Message is missing the 'type' property`); + } + if (typeof val.type !== 'string') { + throw new Error(`Message is expects the 'type' property to be a string, but got ${extendedTypeof(val.type)}`); + } + switch (val.type) { + case exports.MessageType.ConnectionInit: + case exports.MessageType.ConnectionAck: + case exports.MessageType.Ping: + case exports.MessageType.Pong: { + if (val.payload != null && !isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${val.payload}"`); + } + break; + } + case exports.MessageType.Subscribe: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + if (typeof val.payload.query !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'query' property to be a string, but got ${extendedTypeof(val.payload.query)}`); + } + if (val.payload.variables != null && !isObject(val.payload.variables)) { + throw new Error(`"${val.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.variables)}`); + } + if (val.payload.operationName != null && + extendedTypeof(val.payload.operationName) !== 'string') { + throw new Error(`"${val.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${extendedTypeof(val.payload.operationName)}`); + } + if (val.payload.extensions != null && !isObject(val.payload.extensions)) { + throw new Error(`"${val.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${extendedTypeof(val.payload.extensions)}`); + } + break; + } + case exports.MessageType.Next: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!isObject(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`); + } + break; + } + case exports.MessageType.Error: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + if (!areGraphQLErrors(val.payload)) { + throw new Error(`"${val.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(val.payload)}`); + } + break; + } + case exports.MessageType.Complete: { + if (typeof val.id !== 'string') { + throw new Error(`"${val.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`); + } + if (!val.id) { + throw new Error(`"${val.type}" message requires a non-empty 'id' property`); + } + break; + } + default: + throw new Error(`Invalid message 'type' property "${val.type}"`); + } + return val; + } + /** + * Checks if the provided value is a valid GraphQL over WebSocket message. + * + * @deprecated Use `validateMessage` instead. + * + * @category Common + */ + function isMessage(val) { + try { + validateMessage(val); + return true; + } + catch (_a) { + return false; + } + } + /** + * Parses the raw websocket message data to a valid message. + * + * @category Common + */ + function parseMessage(data, reviver) { + return validateMessage(typeof data === 'string' ? JSON.parse(data, reviver) : data); + } + /** + * Stringifies a valid message ready to be sent through the socket. + * + * @category Common + */ + function stringifyMessage(msg, replacer) { + validateMessage(msg); + return JSON.stringify(msg, replacer); + } + + /** + * + * client + * + */ + /** + * Creates a disposable GraphQL over WebSocket client. + * + * @category Client + */ + function createClient(options) { + const { url, connectionParams, lazy = true, onNonLazyError = console.error, lazyCloseTimeout: lazyCloseTimeoutMs = 0, keepAlive = 0, disablePong, connectionAckWaitTimeout = 0, retryAttempts = 5, retryWait = async function randomisedExponentialBackoff(retries) { + let retryDelay = 1000; // start with 1s delay + for (let i = 0; i < retries; i++) { + retryDelay *= 2; + } + await new Promise((resolve) => setTimeout(resolve, retryDelay + + // add random timeout from 300ms to 3s + Math.floor(Math.random() * (3000 - 300) + 300))); + }, shouldRetry = isLikeCloseEvent, isFatalConnectionProblem, on, webSocketImpl, + /** + * Generates a v4 UUID to be used as the ID using `Math` + * as the random number generator. Supply your own generator + * in case you need more uniqueness. + * + * Reference: https://gist.github.com/jed/982883 + */ + generateID = function generateUUID() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); + }, jsonMessageReplacer: replacer, jsonMessageReviver: reviver, } = options; + let ws; + if (webSocketImpl) { + if (!isWebSocket(webSocketImpl)) { + throw new Error('Invalid WebSocket implementation provided'); + } + ws = webSocketImpl; + } + else if (typeof WebSocket !== 'undefined') { + ws = WebSocket; + } + else if (typeof global !== 'undefined') { + ws = + global.WebSocket || + // @ts-expect-error: Support more browsers + global.MozWebSocket; + } + else if (typeof window !== 'undefined') { + ws = + window.WebSocket || + // @ts-expect-error: Support more browsers + window.MozWebSocket; + } + if (!ws) + throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`"); + const WebSocketImpl = ws; + // websocket status emitter, subscriptions are handled differently + const emitter = (() => { + const message = (() => { + const listeners = {}; + return { + on(id, listener) { + listeners[id] = listener; + return () => { + delete listeners[id]; + }; + }, + emit(message) { + var _a; + if ('id' in message) + (_a = listeners[message.id]) === null || _a === void 0 ? void 0 : _a.call(listeners, message); + }, + }; + })(); + const listeners = { + connecting: (on === null || on === void 0 ? void 0 : on.connecting) ? [on.connecting] : [], + opened: (on === null || on === void 0 ? void 0 : on.opened) ? [on.opened] : [], + connected: (on === null || on === void 0 ? void 0 : on.connected) ? [on.connected] : [], + ping: (on === null || on === void 0 ? void 0 : on.ping) ? [on.ping] : [], + pong: (on === null || on === void 0 ? void 0 : on.pong) ? [on.pong] : [], + message: (on === null || on === void 0 ? void 0 : on.message) ? [message.emit, on.message] : [message.emit], + closed: (on === null || on === void 0 ? void 0 : on.closed) ? [on.closed] : [], + error: (on === null || on === void 0 ? void 0 : on.error) ? [on.error] : [], + }; + return { + onMessage: message.on, + on(event, listener) { + const l = listeners[event]; + l.push(listener); + return () => { + l.splice(l.indexOf(listener), 1); + }; + }, + emit(event, ...args) { + // we copy the listeners so that unlistens dont "pull the rug under our feet" + for (const listener of [...listeners[event]]) { + // @ts-expect-error: The args should fit + listener(...args); + } + }, + }; + })(); + // invokes the callback either when an error or closed event is emitted, + // first one that gets called prevails, other emissions are ignored + function errorOrClosed(cb) { + const listening = [ + // errors are fatal and more critical than close events, throw them first + emitter.on('error', (err) => { + listening.forEach((unlisten) => unlisten()); + cb(err); + }), + // closes can be graceful and not fatal, throw them second (if error didnt throw) + emitter.on('closed', (event) => { + listening.forEach((unlisten) => unlisten()); + cb(event); + }), + ]; + } + let connecting, locks = 0, lazyCloseTimeout, retrying = false, retries = 0, disposed = false; + async function connect() { + // clear the lazy close timeout immediatelly so that close gets debounced + // see: https://github.com/enisdenjo/graphql-ws/issues/388 + clearTimeout(lazyCloseTimeout); + const [socket, throwOnClose] = await (connecting !== null && connecting !== void 0 ? connecting : (connecting = new Promise((connected, denied) => (async () => { + if (retrying) { + await retryWait(retries); + // subscriptions might complete while waiting for retry + if (!locks) { + connecting = undefined; + return denied({ code: 1000, reason: 'All Subscriptions Gone' }); + } + retries++; + } + emitter.emit('connecting', retrying); + const socket = new WebSocketImpl(typeof url === 'function' ? await url() : url, GRAPHQL_TRANSPORT_WS_PROTOCOL); + let connectionAckTimeout, queuedPing; + function enqueuePing() { + if (isFinite(keepAlive) && keepAlive > 0) { + clearTimeout(queuedPing); // in case where a pong was received before a ping (this is valid behaviour) + queuedPing = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) { + socket.send(stringifyMessage({ type: exports.MessageType.Ping })); + emitter.emit('ping', false, undefined); + } + }, keepAlive); + } + } + errorOrClosed((errOrEvent) => { + connecting = undefined; + clearTimeout(connectionAckTimeout); + clearTimeout(queuedPing); + denied(errOrEvent); + if (errOrEvent instanceof TerminatedCloseEvent) { + socket.close(4499, 'Terminated'); // close event is artificial and emitted manually, see `Client.terminate()` below + socket.onerror = null; + socket.onclose = null; + } + }); + socket.onerror = (err) => emitter.emit('error', err); + socket.onclose = (event) => emitter.emit('closed', event); + socket.onopen = async () => { + try { + emitter.emit('opened', socket); + const payload = typeof connectionParams === 'function' + ? await connectionParams() + : connectionParams; + // connectionParams might take too long causing the server to kick off the client + // the necessary error/close event is already reported - simply stop execution + if (socket.readyState !== WebSocketImpl.OPEN) + return; + socket.send(stringifyMessage(payload + ? { + type: exports.MessageType.ConnectionInit, + payload, + } + : { + type: exports.MessageType.ConnectionInit, + // payload is completely absent if not provided + }, replacer)); + if (isFinite(connectionAckWaitTimeout) && + connectionAckWaitTimeout > 0) { + connectionAckTimeout = setTimeout(() => { + socket.close(exports.CloseCode.ConnectionAcknowledgementTimeout, 'Connection acknowledgement timeout'); + }, connectionAckWaitTimeout); + } + enqueuePing(); // enqueue ping (noop if disabled) + } + catch (err) { + emitter.emit('error', err); + socket.close(exports.CloseCode.InternalClientError, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Internal client error')); + } + }; + let acknowledged = false; + socket.onmessage = ({ data }) => { + try { + const message = parseMessage(data, reviver); + emitter.emit('message', message); + if (message.type === 'ping' || message.type === 'pong') { + emitter.emit(message.type, true, message.payload); // received + if (message.type === 'pong') { + enqueuePing(); // enqueue next ping (noop if disabled) + } + else if (!disablePong) { + // respond with pong on ping + socket.send(stringifyMessage(message.payload + ? { + type: exports.MessageType.Pong, + payload: message.payload, + } + : { + type: exports.MessageType.Pong, + // payload is completely absent if not provided + })); + emitter.emit('pong', false, message.payload); + } + return; // ping and pongs can be received whenever + } + if (acknowledged) + return; // already connected and acknowledged + if (message.type !== exports.MessageType.ConnectionAck) + throw new Error(`First message cannot be of type ${message.type}`); + clearTimeout(connectionAckTimeout); + acknowledged = true; + emitter.emit('connected', socket, message.payload, retrying); // connected = socket opened + acknowledged + retrying = false; // future lazy connects are not retries + retries = 0; // reset the retries on connect + connected([ + socket, + new Promise((_, reject) => errorOrClosed(reject)), + ]); + } + catch (err) { + socket.onmessage = null; // stop reading messages as soon as reading breaks once + emitter.emit('error', err); + socket.close(exports.CloseCode.BadResponse, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Bad response')); + } + }; + })()))); + // if the provided socket is in a closing state, wait for the throw on close + if (socket.readyState === WebSocketImpl.CLOSING) + await throwOnClose; + let release = () => { + // releases this connection + }; + const released = new Promise((resolve) => (release = resolve)); + return [ + socket, + release, + Promise.race([ + // wait for + released.then(() => { + if (!locks) { + // and if no more locks are present, complete the connection + const complete = () => socket.close(1000, 'Normal Closure'); + if (isFinite(lazyCloseTimeoutMs) && lazyCloseTimeoutMs > 0) { + // if the keepalive is set, allow for the specified calmdown time and + // then complete if the socket is still open. + lazyCloseTimeout = setTimeout(() => { + if (socket.readyState === WebSocketImpl.OPEN) + complete(); + }, lazyCloseTimeoutMs); + } + else { + // otherwise complete immediately + complete(); + } + } + }), + // or + throwOnClose, + ]), + ]; + } + /** + * Checks the `connect` problem and evaluates if the client should retry. + */ + function shouldRetryConnectOrThrow(errOrCloseEvent) { + // some close codes are worth reporting immediately + if (isLikeCloseEvent(errOrCloseEvent) && + (isFatalInternalCloseCode(errOrCloseEvent.code) || + [ + exports.CloseCode.InternalServerError, + exports.CloseCode.InternalClientError, + exports.CloseCode.BadRequest, + exports.CloseCode.BadResponse, + exports.CloseCode.Unauthorized, + // CloseCode.Forbidden, might grant access out after retry + exports.CloseCode.SubprotocolNotAcceptable, + // CloseCode.ConnectionInitialisationTimeout, might not time out after retry + // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry + exports.CloseCode.SubscriberAlreadyExists, + exports.CloseCode.TooManyInitialisationRequests, + // 4499, // Terminated, probably because the socket froze, we want to retry + ].includes(errOrCloseEvent.code))) + throw errOrCloseEvent; + // client was disposed, no retries should proceed regardless + if (disposed) + return false; + // normal closure (possibly all subscriptions have completed) + // if no locks were acquired in the meantime, shouldnt try again + if (isLikeCloseEvent(errOrCloseEvent) && errOrCloseEvent.code === 1000) + return locks > 0; + // retries are not allowed or we tried to many times, report error + if (!retryAttempts || retries >= retryAttempts) + throw errOrCloseEvent; + // throw non-retryable connection problems + if (!shouldRetry(errOrCloseEvent)) + throw errOrCloseEvent; + // @deprecated throw fatal connection problems immediately + if (isFatalConnectionProblem === null || isFatalConnectionProblem === void 0 ? void 0 : isFatalConnectionProblem(errOrCloseEvent)) + throw errOrCloseEvent; + // looks good, start retrying + return (retrying = true); + } + // in non-lazy (hot?) mode always hold one connection lock to persist the socket + if (!lazy) { + (async () => { + locks++; + for (;;) { + try { + const [, , throwOnClose] = await connect(); + await throwOnClose; // will always throw because releaser is not used + } + catch (errOrCloseEvent) { + try { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + catch (errOrCloseEvent) { + // report thrown error, no further retries + return onNonLazyError === null || onNonLazyError === void 0 ? void 0 : onNonLazyError(errOrCloseEvent); + } + } + } + })(); + } + function subscribe(payload, sink) { + const id = generateID(payload); + let done = false, errored = false, releaser = () => { + // for handling completions before connect + locks--; + done = true; + }; + (async () => { + locks++; + for (;;) { + try { + const [socket, release, waitForReleaseOrThrowOnClose] = await connect(); + // if done while waiting for connect, release the connection lock right away + if (done) + return release(); + const unlisten = emitter.onMessage(id, (message) => { + switch (message.type) { + case exports.MessageType.Next: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- payload will fit type + sink.next(message.payload); + return; + } + case exports.MessageType.Error: { + (errored = true), (done = true); + sink.error(message.payload); + releaser(); + return; + } + case exports.MessageType.Complete: { + done = true; + releaser(); // release completes the sink + return; + } + } + }); + socket.send(stringifyMessage({ + id, + type: exports.MessageType.Subscribe, + payload, + }, replacer)); + releaser = () => { + if (!done && socket.readyState === WebSocketImpl.OPEN) + // if not completed already and socket is open, send complete message to server on release + socket.send(stringifyMessage({ + id, + type: exports.MessageType.Complete, + }, replacer)); + locks--; + done = true; + release(); + }; + // either the releaser will be called, connection completed and + // the promise resolved or the socket closed and the promise rejected. + // whatever happens though, we want to stop listening for messages + await waitForReleaseOrThrowOnClose.finally(unlisten); + return; // completed, shouldnt try again + } + catch (errOrCloseEvent) { + if (!shouldRetryConnectOrThrow(errOrCloseEvent)) + return; + } + } + })() + .then(() => { + // delivering either an error or a complete terminates the sequence + if (!errored) + sink.complete(); + }) // resolves on release or normal closure + .catch((err) => { + sink.error(err); + }); // rejects on close events and errors + return () => { + // dispose only of active subscriptions + if (!done) + releaser(); + }; + } + return { + on: emitter.on, + subscribe, + iterate(request) { + const pending = []; + const deferred = { + done: false, + error: null, + resolve: () => { + // noop + }, + }; + const dispose = subscribe(request, { + next(val) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + pending.push(val); + deferred.resolve(); + }, + error(err) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + }, + complete() { + deferred.done = true; + deferred.resolve(); + }, + }); + const iterator = (function iterator() { + return __asyncGenerator(this, arguments, function* iterator_1() { + for (;;) { + if (!pending.length) { + // only wait if there are no pending messages available + yield __await(new Promise((resolve) => (deferred.resolve = resolve))); + } + // first flush + while (pending.length) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + yield yield __await(pending.shift()); + } + // then error + if (deferred.error) { + throw deferred.error; + } + // or complete + if (deferred.done) { + return yield __await(void 0); + } + } + }); + })(); + iterator.throw = async (err) => { + if (!deferred.done) { + deferred.done = true; + deferred.error = err; + deferred.resolve(); + } + return { done: true, value: undefined }; + }; + iterator.return = async () => { + dispose(); + return { done: true, value: undefined }; + }; + return iterator; + }, + async dispose() { + disposed = true; + if (connecting) { + // if there is a connection, close it + const [socket] = await connecting; + socket.close(1000, 'Normal Closure'); + } + }, + terminate() { + if (connecting) { + // only if there is a connection + emitter.emit('closed', new TerminatedCloseEvent()); + } + }, + }; + } + /** + * A syntetic close event `4499: Terminated` is issued to the current to immediately + * close the connection without waiting for the one coming from `WebSocket.onclose`. + * + * Terminating is not considered fatal and a connection retry will occur as expected. + * + * Useful in cases where the WebSocket is stuck and not emitting any events; + * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290. + */ + class TerminatedCloseEvent extends Error { + constructor() { + super(...arguments); + this.name = 'TerminatedCloseEvent'; + this.message = '4499: Terminated'; + this.code = 4499; + this.reason = 'Terminated'; + this.wasClean = false; + } + } + function isLikeCloseEvent(val) { + return isObject(val) && 'code' in val && 'reason' in val; + } + function isFatalInternalCloseCode(code) { + if ([ + 1000, + 1001, + 1006, + 1005, + 1012, + 1013, + 1014, // Bad Gateway + ].includes(code)) + return false; + // all other internal errors are fatal + return code >= 1000 && code <= 1999; + } + function isWebSocket(val) { + return (typeof val === 'function' && + 'constructor' in val && + 'CLOSED' in val && + 'CLOSING' in val && + 'CONNECTING' in val && + 'OPEN' in val); + } + + exports.DEPRECATED_GRAPHQL_WS_PROTOCOL = DEPRECATED_GRAPHQL_WS_PROTOCOL; + exports.GRAPHQL_TRANSPORT_WS_PROTOCOL = GRAPHQL_TRANSPORT_WS_PROTOCOL; + exports.TerminatedCloseEvent = TerminatedCloseEvent; + exports.createClient = createClient; + exports.isMessage = isMessage; + exports.parseMessage = parseMessage; + exports.stringifyMessage = stringifyMessage; + exports.validateMessage = validateMessage; + +})); diff --git a/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.min.js b/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.min.js new file mode 100644 index 0000000..0d43885 --- /dev/null +++ b/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.min.js @@ -0,0 +1 @@ +!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).graphqlWs={})}(this,(function(e){"use strict";function o(e){return this instanceof o?(this.v=e,this):new o(e)}function t(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,s=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){s[e]&&(n[e]=function(o){return new Promise((function(t,r){i.push([e,o,t,r])>1||l(e,o)}))})}function l(e,t){try{(r=s[e](t)).value instanceof o?Promise.resolve(r.value.v).then(c,p):d(i[0][2],r)}catch(e){d(i[0][3],e)}var r}function c(e){l("next",e)}function p(e){l("throw",e)}function d(e,o){e(o),i.shift(),i.length&&l(i[0][0],i[0][1])}}function r(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function n(e){return"object"===r(e)}function s(e,o){return e.length<124?e:o}const i="graphql-transport-ws";var a,l;function c(o){if(!n(o))throw new Error(`Message is expected to be an object, but got ${r(o)}`);if(!o.type)throw new Error("Message is missing the 'type' property");if("string"!=typeof o.type)throw new Error(`Message is expects the 'type' property to be a string, but got ${r(o.type)}`);switch(o.type){case e.MessageType.ConnectionInit:case e.MessageType.ConnectionAck:case e.MessageType.Ping:case e.MessageType.Pong:if(null!=o.payload&&!n(o.payload))throw new Error(`"${o.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${o.payload}"`);break;case e.MessageType.Subscribe:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);if(!n(o.payload))throw new Error(`"${o.type}" message expects the 'payload' property to be an object, but got ${r(o.payload)}`);if("string"!=typeof o.payload.query)throw new Error(`"${o.type}" message payload expects the 'query' property to be a string, but got ${r(o.payload.query)}`);if(null!=o.payload.variables&&!n(o.payload.variables))throw new Error(`"${o.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${r(o.payload.variables)}`);if(null!=o.payload.operationName&&"string"!==r(o.payload.operationName))throw new Error(`"${o.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${r(o.payload.operationName)}`);if(null!=o.payload.extensions&&!n(o.payload.extensions))throw new Error(`"${o.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${r(o.payload.extensions)}`);break;case e.MessageType.Next:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);if(!n(o.payload))throw new Error(`"${o.type}" message expects the 'payload' property to be an object, but got ${r(o.payload)}`);break;case e.MessageType.Error:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);if(t=o.payload,!(Array.isArray(t)&&t.length>0&&t.every((e=>"message"in e))))throw new Error(`"${o.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(o.payload)}`);break;case e.MessageType.Complete:if("string"!=typeof o.id)throw new Error(`"${o.type}" message expects the 'id' property to be a string, but got ${r(o.id)}`);if(!o.id)throw new Error(`"${o.type}" message requires a non-empty 'id' property`);break;default:throw new Error(`Invalid message 'type' property "${o.type}"`)}var t;return o}function p(e,o){return c("string"==typeof e?JSON.parse(e,o):e)}function d(e,o){return c(e),JSON.stringify(e,o)}e.CloseCode=void 0,(a=e.CloseCode||(e.CloseCode={}))[a.InternalServerError=4500]="InternalServerError",a[a.InternalClientError=4005]="InternalClientError",a[a.BadRequest=4400]="BadRequest",a[a.BadResponse=4004]="BadResponse",a[a.Unauthorized=4401]="Unauthorized",a[a.Forbidden=4403]="Forbidden",a[a.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",a[a.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",a[a.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",a[a.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",a[a.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests",e.MessageType=void 0,(l=e.MessageType||(e.MessageType={})).ConnectionInit="connection_init",l.ConnectionAck="connection_ack",l.Ping="ping",l.Pong="pong",l.Subscribe="subscribe",l.Next="next",l.Error="error",l.Complete="complete";class y extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function u(e){return n(e)&&"code"in e&&"reason"in e}e.DEPRECATED_GRAPHQL_WS_PROTOCOL="graphql-ws",e.GRAPHQL_TRANSPORT_WS_PROTOCOL=i,e.TerminatedCloseEvent=y,e.createClient=function(r){const{url:n,connectionParams:a,lazy:l=!0,onNonLazyError:c=console.error,lazyCloseTimeout:g=0,keepAlive:f=0,disablePong:m,connectionAckWaitTimeout:h=0,retryAttempts:w=5,retryWait:b=async function(e){let o=1e3;for(let t=0;tsetTimeout(e,o+Math.floor(2700*Math.random()+300))))},shouldRetry:x=u,isFatalConnectionProblem:C,on:v,webSocketImpl:E,generateID:T=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const o=16*Math.random()|0;return("x"==e?o:3&o|8).toString(16)}))},jsonMessageReplacer:S,jsonMessageReviver:M}=r;let $;if(E){if(!("function"==typeof(P=E)&&"constructor"in P&&"CLOSED"in P&&"CLOSING"in P&&"CONNECTING"in P&&"OPEN"in P))throw new Error("Invalid WebSocket implementation provided");$=E}else"undefined"!=typeof WebSocket?$=WebSocket:"undefined"!=typeof global?$=global.WebSocket||global.MozWebSocket:"undefined"!=typeof window&&($=window.WebSocket||window.MozWebSocket);var P;if(!$)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const I=$,N=(()=>{const e=(()=>{const e={};return{on:(o,t)=>(e[o]=t,()=>{delete e[o]}),emit(o){var t;"id"in o&&(null===(t=e[o.id])||void 0===t||t.call(e,o))}}})(),o={connecting:(null==v?void 0:v.connecting)?[v.connecting]:[],opened:(null==v?void 0:v.opened)?[v.opened]:[],connected:(null==v?void 0:v.connected)?[v.connected]:[],ping:(null==v?void 0:v.ping)?[v.ping]:[],pong:(null==v?void 0:v.pong)?[v.pong]:[],message:(null==v?void 0:v.message)?[e.emit,v.message]:[e.emit],closed:(null==v?void 0:v.closed)?[v.closed]:[],error:(null==v?void 0:v.error)?[v.error]:[]};return{onMessage:e.on,on(e,t){const r=o[e];return r.push(t),()=>{r.splice(r.indexOf(t),1)}},emit(e,...t){for(const r of[...o[e]])r(...t)}}})();function k(e){const o=[N.on("error",(t=>{o.forEach((e=>e())),e(t)})),N.on("closed",(t=>{o.forEach((e=>e())),e(t)}))]}let A,O,R=0,q=!1,W=0,j=!1;async function L(){clearTimeout(O);const[o,t]=await(null!=A?A:A=new Promise(((o,t)=>(async()=>{if(q){if(await b(W),!R)return A=void 0,t({code:1e3,reason:"All Subscriptions Gone"});W++}N.emit("connecting",q);const r=new I("function"==typeof n?await n():n,i);let l,c;function u(){isFinite(f)&&f>0&&(clearTimeout(c),c=setTimeout((()=>{r.readyState===I.OPEN&&(r.send(d({type:e.MessageType.Ping})),N.emit("ping",!1,void 0))}),f))}k((e=>{A=void 0,clearTimeout(l),clearTimeout(c),t(e),e instanceof y&&(r.close(4499,"Terminated"),r.onerror=null,r.onclose=null)})),r.onerror=e=>N.emit("error",e),r.onclose=e=>N.emit("closed",e),r.onopen=async()=>{try{N.emit("opened",r);const o="function"==typeof a?await a():a;if(r.readyState!==I.OPEN)return;r.send(d(o?{type:e.MessageType.ConnectionInit,payload:o}:{type:e.MessageType.ConnectionInit},S)),isFinite(h)&&h>0&&(l=setTimeout((()=>{r.close(e.CloseCode.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")}),h)),u()}catch(o){N.emit("error",o),r.close(e.CloseCode.InternalClientError,s(o instanceof Error?o.message:new Error(o).message,"Internal client error"))}};let g=!1;r.onmessage=({data:t})=>{try{const n=p(t,M);if(N.emit("message",n),"ping"===n.type||"pong"===n.type)return N.emit(n.type,!0,n.payload),void("pong"===n.type?u():m||(r.send(d(n.payload?{type:e.MessageType.Pong,payload:n.payload}:{type:e.MessageType.Pong})),N.emit("pong",!1,n.payload)));if(g)return;if(n.type!==e.MessageType.ConnectionAck)throw new Error(`First message cannot be of type ${n.type}`);clearTimeout(l),g=!0,N.emit("connected",r,n.payload,q),q=!1,W=0,o([r,new Promise(((e,o)=>k(o)))])}catch(o){r.onmessage=null,N.emit("error",o),r.close(e.CloseCode.BadResponse,s(o instanceof Error?o.message:new Error(o).message,"Bad response"))}}})())));o.readyState===I.CLOSING&&await t;let r=()=>{};const l=new Promise((e=>r=e));return[o,r,Promise.race([l.then((()=>{if(!R){const e=()=>o.close(1e3,"Normal Closure");isFinite(g)&&g>0?O=setTimeout((()=>{o.readyState===I.OPEN&&e()}),g):e()}})),t])]}function z(o){if(u(o)&&(t=o.code,![1e3,1001,1006,1005,1012,1013,1014].includes(t)&&t>=1e3&&t<=1999||[e.CloseCode.InternalServerError,e.CloseCode.InternalClientError,e.CloseCode.BadRequest,e.CloseCode.BadResponse,e.CloseCode.Unauthorized,e.CloseCode.SubprotocolNotAcceptable,e.CloseCode.SubscriberAlreadyExists,e.CloseCode.TooManyInitialisationRequests].includes(o.code)))throw o;var t;if(j)return!1;if(u(o)&&1e3===o.code)return R>0;if(!w||W>=w)throw o;if(!x(o))throw o;if(null==C?void 0:C(o))throw o;return q=!0}function B(o,t){const r=T(o);let n=!1,s=!1,i=()=>{R--,n=!0};return(async()=>{for(R++;;)try{const[a,l,c]=await L();if(n)return l();const p=N.onMessage(r,(o=>{switch(o.type){case e.MessageType.Next:return void t.next(o.payload);case e.MessageType.Error:return s=!0,n=!0,t.error(o.payload),void i();case e.MessageType.Complete:return n=!0,void i()}}));return a.send(d({id:r,type:e.MessageType.Subscribe,payload:o},S)),i=()=>{n||a.readyState!==I.OPEN||a.send(d({id:r,type:e.MessageType.Complete},S)),R--,n=!0,l()},void await c.finally(p)}catch(e){if(!z(e))return}})().then((()=>{s||t.complete()})).catch((e=>{t.error(e)})),()=>{n||i()}}return l||(async()=>{for(R++;;)try{const[,,e]=await L();await e}catch(e){try{if(!z(e))return}catch(e){return null==c?void 0:c(e)}}})(),{on:N.on,subscribe:B,iterate(e){const r=[],n={done:!1,error:null,resolve:()=>{}},s=B(e,{next(e){r.push(e),n.resolve()},error(e){n.done=!0,n.error=e,n.resolve()},complete(){n.done=!0,n.resolve()}}),i=function(){return t(this,arguments,(function*(){for(;;){for(r.length||(yield o(new Promise((e=>n.resolve=e))));r.length;)yield yield o(r.shift());if(n.error)throw n.error;if(n.done)return yield o(void 0)}}))}();return i.throw=async e=>(n.done||(n.done=!0,n.error=e,n.resolve()),{done:!0,value:void 0}),i.return=async()=>(s(),{done:!0,value:void 0}),i},async dispose(){if(j=!0,A){const[e]=await A;e.close(1e3,"Normal Closure")}},terminate(){A&&N.emit("closed",new y)}}},e.isMessage=function(e){try{return c(e),!0}catch(e){return!1}},e.parseMessage=p,e.stringifyMessage=d,e.validateMessage=c})); diff --git a/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.min.js.gz b/graphql-subscription/node_modules/graphql-ws/umd/graphql-ws.min.js.gz new file mode 100644 index 0000000000000000000000000000000000000000..13f7106afc94ed6b0e8e4acd2b72bb864c0cdd49 GIT binary patch literal 3841 zcmV+c5B~5UiwFq9Tgqhs17~t!aAUYI6YX8f#PANb>vr3ZbIB(lXJR zgyc5z4laj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V8-85i<7lRGlJ|jC&uGSY^O8f{h)El6@0!_TE zHoV+>0(?#M?!yEEOpdBRr;Qu;jD_?I8|`)2Qvn<-MB2&<==55x&1wi`zd-YZAd}?g zBGYQ;87;p0+7MjvhQZ_80YF!89xa6#Ocd`H?Ieao)x!jK>|BhV>u>)7>5533dn^C| D%Fk@2 literal 0 HcmV?d00001 diff --git a/graphql-subscription/node_modules/graphql/LICENSE b/graphql-subscription/node_modules/graphql/LICENSE new file mode 100644 index 0000000..7bbf892 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) GraphQL Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/graphql/NotSupportedTSVersion.d.ts b/graphql-subscription/node_modules/graphql/NotSupportedTSVersion.d.ts new file mode 100644 index 0000000..af77c30 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/NotSupportedTSVersion.d.ts @@ -0,0 +1 @@ +"Package 'graphql' support only TS versions that are >=4.1.0". \ No newline at end of file diff --git a/graphql-subscription/node_modules/graphql/README.md b/graphql-subscription/node_modules/graphql/README.md new file mode 100644 index 0000000..3475347 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/README.md @@ -0,0 +1,158 @@ +# GraphQL.js + +The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook. + +[![npm version](https://badge.fury.io/js/graphql.svg)](https://badge.fury.io/js/graphql) +[![Build Status](https://github.com/graphql/graphql-js/workflows/CI/badge.svg?branch=main)](https://github.com/graphql/graphql-js/actions?query=branch%3Amain) +[![Coverage Status](https://codecov.io/gh/graphql/graphql-js/branch/main/graph/badge.svg)](https://codecov.io/gh/graphql/graphql-js) + +See more complete documentation at https://graphql.org/ and +https://graphql.org/graphql-js/. + +Looking for help? Find resources [from the community](https://graphql.org/community/). + +## Getting Started + +A general overview of GraphQL is available in the +[README](https://github.com/graphql/graphql-spec/blob/main/README.md) for the +[Specification for GraphQL](https://github.com/graphql/graphql-spec). That overview +describes a simple set of GraphQL examples that exist as [tests](src/__tests__) +in this repository. A good way to get started with this repository is to walk +through that README and the corresponding tests in parallel. + +### Using GraphQL.js + +Install GraphQL.js from npm + +With npm: + +```sh +npm install --save graphql +``` + +or using yarn: + +```sh +yarn add graphql +``` + +GraphQL.js provides two important capabilities: building a type schema and +serving queries against that type schema. + +First, build a GraphQL type schema which maps to your codebase. + +```js +import { + graphql, + GraphQLSchema, + GraphQLObjectType, + GraphQLString, +} from 'graphql'; + +var schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'RootQueryType', + fields: { + hello: { + type: GraphQLString, + resolve() { + return 'world'; + }, + }, + }, + }), +}); +``` + +This defines a simple schema, with one type and one field, that resolves +to a fixed value. The `resolve` function can return a value, a promise, +or an array of promises. A more complex example is included in the top-level [tests](src/__tests__) directory. + +Then, serve the result of a query against that type schema. + +```js +var source = '{ hello }'; + +graphql({ schema, source }).then((result) => { + // Prints + // { + // data: { hello: "world" } + // } + console.log(result); +}); +``` + +This runs a query fetching the one field defined. The `graphql` function will +first ensure the query is syntactically and semantically valid before executing +it, reporting errors otherwise. + +```js +var source = '{ BoyHowdy }'; + +graphql({ schema, source }).then((result) => { + // Prints + // { + // errors: [ + // { message: 'Cannot query field BoyHowdy on RootQueryType', + // locations: [ { line: 1, column: 3 } ] } + // ] + // } + console.log(result); +}); +``` + +**Note**: Please don't forget to set `NODE_ENV=production` if you are running a production server. It will disable some checks that can be useful during development but will significantly improve performance. + +### Want to ride the bleeding edge? + +The `npm` branch in this repository is automatically maintained to be the last +commit to `main` to pass all tests, in the same form found on npm. It is +recommended to use builds deployed to npm for many reasons, but if you want to use +the latest not-yet-released version of graphql-js, you can do so by depending +directly on this branch: + +``` +npm install graphql@git://github.com/graphql/graphql-js.git#npm +``` + +### Experimental features + +Each release of GraphQL.js will be accompanied by an experimental release containing support for the `@defer` and `@stream` directive proposal. We are hoping to get community feedback on these releases before the proposal is accepted into the GraphQL specification. You can use this experimental release of GraphQL.js by adding the following to your project's `package.json` file. + +``` +"graphql": "experimental-stream-defer" +``` + +Community feedback on this experimental release is much appreciated and can be provided on the [issue created for this purpose](https://github.com/graphql/graphql-js/issues/2848). + +### Using in a Browser + +GraphQL.js is a general-purpose library and can be used both in a Node server +and in the browser. As an example, the [GraphiQL](https://github.com/graphql/graphiql/) +tool is built with GraphQL.js! + +Building a project using GraphQL.js with [webpack](https://webpack.js.org) or +[rollup](https://github.com/rollup/rollup) should just work and only include +the portions of the library you use. This works because GraphQL.js is distributed +with both CommonJS (`require()`) and ESModule (`import`) files. Ensure that any +custom build configurations look for `.mjs` files! + +### Contributing + +We actively welcome pull requests. Learn how to [contribute](./.github/CONTRIBUTING.md). + +This repository is managed by EasyCLA. Project participants must sign the free ([GraphQL Specification Membership agreement](https://preview-spec-membership.graphql.org) before making a contribution. You only need to do this one time, and it can be signed by [individual contributors](http://individual-spec-membership.graphql.org/) or their [employers](http://corporate-spec-membership.graphql.org/). + +To initiate the signature process please open a PR against this repo. The EasyCLA bot will block the merge if we still need a membership agreement from you. + +You can find [detailed information here](https://github.com/graphql/graphql-wg/tree/main/membership). If you have issues, please email [operations@graphql.org](mailto:operations@graphql.org). + +If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the [GraphQL Foundation](https://foundation.graphql.org/join). + +### Changelog + +Changes are tracked as [GitHub releases](https://github.com/graphql/graphql-js/releases). + +### License + +GraphQL.js is [MIT-licensed](./LICENSE). diff --git a/graphql-subscription/node_modules/graphql/error/GraphQLError.d.ts b/graphql-subscription/node_modules/graphql/error/GraphQLError.d.ts new file mode 100644 index 0000000..e7f1a6a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/GraphQLError.d.ts @@ -0,0 +1,142 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ASTNode } from '../language/ast'; +import type { SourceLocation } from '../language/location'; +import type { Source } from '../language/source'; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLErrorExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLErrorOptions { + nodes?: ReadonlyArray | ASTNode | null; + source?: Maybe; + positions?: Maybe>; + path?: Maybe>; + originalError?: Maybe< + Error & { + readonly extensions?: unknown; + } + >; + extensions?: Maybe; +} +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ +export declare class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly locations: ReadonlyArray | undefined; + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly path: ReadonlyArray | undefined; + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + readonly nodes: ReadonlyArray | undefined; + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + readonly source: Source | undefined; + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + readonly positions: ReadonlyArray | undefined; + /** + * The original error thrown from a field resolver during execution. + */ + readonly originalError: Error | undefined; + /** + * Extension fields to add to the formatted error. + */ + readonly extensions: GraphQLErrorExtensions; + constructor(message: string, options?: GraphQLErrorOptions); + /** + * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. + */ + constructor( + message: string, + nodes?: ReadonlyArray | ASTNode | null, + source?: Maybe, + positions?: Maybe>, + path?: Maybe>, + originalError?: Maybe< + Error & { + readonly extensions?: unknown; + } + >, + extensions?: Maybe, + ); + get [Symbol.toStringTag](): string; + toString(): string; + toJSON(): GraphQLFormattedError; +} +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ +export interface GraphQLFormattedError { + /** + * A short, human-readable summary of the problem that **SHOULD NOT** change + * from occurrence to occurrence of the problem, except for purposes of + * localization. + */ + readonly message: string; + /** + * If an error can be associated to a particular point in the requested + * GraphQL document, it should contain a list of locations. + */ + readonly locations?: ReadonlyArray; + /** + * If an error can be associated to a particular field in the GraphQL result, + * it _must_ contain an entry with the key `path` that details the path of + * the response field which experienced the error. This allows clients to + * identify whether a null result is intentional or caused by a runtime error. + */ + readonly path?: ReadonlyArray; + /** + * Reserved for implementors to extend the protocol however they see fit, + * and hence there are no additional restrictions on its contents. + */ + readonly extensions?: { + [key: string]: unknown; + }; +} +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +export declare function printError(error: GraphQLError): string; +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toJSON` instead. Will be removed in v17 + */ +export declare function formatError(error: GraphQLError): GraphQLFormattedError; diff --git a/graphql-subscription/node_modules/graphql/error/GraphQLError.js b/graphql-subscription/node_modules/graphql/error/GraphQLError.js new file mode 100644 index 0000000..09d9939 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/GraphQLError.js @@ -0,0 +1,267 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLError = void 0; +exports.formatError = formatError; +exports.printError = printError; + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _location = require('../language/location.js'); + +var _printLocation = require('../language/printLocation.js'); + +function toNormalizedOptions(args) { + const firstArg = args[0]; + + if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) { + return { + nodes: firstArg, + source: args[1], + positions: args[2], + path: args[3], + originalError: args[4], + extensions: args[5], + }; + } + + return firstArg; +} +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ + +class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + + /** + * The original error thrown from a field resolver during execution. + */ + + /** + * Extension fields to add to the formatted error. + */ + + /** + * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. + */ + constructor(message, ...rawArgs) { + var _this$nodes, _nodeLocations$, _ref; + + const { nodes, source, positions, path, originalError, extensions } = + toNormalizedOptions(rawArgs); + super(message); + this.name = 'GraphQLError'; + this.path = path !== null && path !== void 0 ? path : undefined; + this.originalError = + originalError !== null && originalError !== void 0 + ? originalError + : undefined; // Compute list of blame nodes. + + this.nodes = undefinedIfEmpty( + Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined, + ); + const nodeLocations = undefinedIfEmpty( + (_this$nodes = this.nodes) === null || _this$nodes === void 0 + ? void 0 + : _this$nodes.map((node) => node.loc).filter((loc) => loc != null), + ); // Compute locations in the source for the given nodes/positions. + + this.source = + source !== null && source !== void 0 + ? source + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : (_nodeLocations$ = nodeLocations[0]) === null || + _nodeLocations$ === void 0 + ? void 0 + : _nodeLocations$.source; + this.positions = + positions !== null && positions !== void 0 + ? positions + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => loc.start); + this.locations = + positions && source + ? positions.map((pos) => (0, _location.getLocation)(source, pos)) + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => + (0, _location.getLocation)(loc.source, loc.start), + ); + const originalExtensions = (0, _isObjectLike.isObjectLike)( + originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions, + ) + ? originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions + : undefined; + this.extensions = + (_ref = + extensions !== null && extensions !== void 0 + ? extensions + : originalExtensions) !== null && _ref !== void 0 + ? _ref + : Object.create(null); // Only properties prescribed by the spec should be enumerable. + // Keep the rest as non-enumerable. + + Object.defineProperties(this, { + message: { + writable: true, + enumerable: true, + }, + name: { + enumerable: false, + }, + nodes: { + enumerable: false, + }, + source: { + enumerable: false, + }, + positions: { + enumerable: false, + }, + originalError: { + enumerable: false, + }, + }); // Include (non-enumerable) stack trace. + + /* c8 ignore start */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + + if ( + originalError !== null && + originalError !== void 0 && + originalError.stack + ) { + Object.defineProperty(this, 'stack', { + value: originalError.stack, + writable: true, + configurable: true, + }); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, GraphQLError); + } else { + Object.defineProperty(this, 'stack', { + value: Error().stack, + writable: true, + configurable: true, + }); + } + /* c8 ignore stop */ + } + + get [Symbol.toStringTag]() { + return 'GraphQLError'; + } + + toString() { + let output = this.message; + + if (this.nodes) { + for (const node of this.nodes) { + if (node.loc) { + output += '\n\n' + (0, _printLocation.printLocation)(node.loc); + } + } + } else if (this.source && this.locations) { + for (const location of this.locations) { + output += + '\n\n' + + (0, _printLocation.printSourceLocation)(this.source, location); + } + } + + return output; + } + + toJSON() { + const formattedError = { + message: this.message, + }; + + if (this.locations != null) { + formattedError.locations = this.locations; + } + + if (this.path != null) { + formattedError.path = this.path; + } + + if (this.extensions != null && Object.keys(this.extensions).length > 0) { + formattedError.extensions = this.extensions; + } + + return formattedError; + } +} + +exports.GraphQLError = GraphQLError; + +function undefinedIfEmpty(array) { + return array === undefined || array.length === 0 ? undefined : array; +} +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ + +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +function printError(error) { + return error.toString(); +} +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toJSON` instead. Will be removed in v17 + */ + +function formatError(error) { + return error.toJSON(); +} diff --git a/graphql-subscription/node_modules/graphql/error/GraphQLError.mjs b/graphql-subscription/node_modules/graphql/error/GraphQLError.mjs new file mode 100644 index 0000000..d2fe38a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/GraphQLError.mjs @@ -0,0 +1,253 @@ +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { getLocation } from '../language/location.mjs'; +import { + printLocation, + printSourceLocation, +} from '../language/printLocation.mjs'; + +function toNormalizedOptions(args) { + const firstArg = args[0]; + + if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) { + return { + nodes: firstArg, + source: args[1], + positions: args[2], + path: args[3], + originalError: args[4], + extensions: args[5], + }; + } + + return firstArg; +} +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ + +export class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + + /** + * The original error thrown from a field resolver during execution. + */ + + /** + * Extension fields to add to the formatted error. + */ + + /** + * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. + */ + constructor(message, ...rawArgs) { + var _this$nodes, _nodeLocations$, _ref; + + const { nodes, source, positions, path, originalError, extensions } = + toNormalizedOptions(rawArgs); + super(message); + this.name = 'GraphQLError'; + this.path = path !== null && path !== void 0 ? path : undefined; + this.originalError = + originalError !== null && originalError !== void 0 + ? originalError + : undefined; // Compute list of blame nodes. + + this.nodes = undefinedIfEmpty( + Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined, + ); + const nodeLocations = undefinedIfEmpty( + (_this$nodes = this.nodes) === null || _this$nodes === void 0 + ? void 0 + : _this$nodes.map((node) => node.loc).filter((loc) => loc != null), + ); // Compute locations in the source for the given nodes/positions. + + this.source = + source !== null && source !== void 0 + ? source + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : (_nodeLocations$ = nodeLocations[0]) === null || + _nodeLocations$ === void 0 + ? void 0 + : _nodeLocations$.source; + this.positions = + positions !== null && positions !== void 0 + ? positions + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => loc.start); + this.locations = + positions && source + ? positions.map((pos) => getLocation(source, pos)) + : nodeLocations === null || nodeLocations === void 0 + ? void 0 + : nodeLocations.map((loc) => getLocation(loc.source, loc.start)); + const originalExtensions = isObjectLike( + originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions, + ) + ? originalError === null || originalError === void 0 + ? void 0 + : originalError.extensions + : undefined; + this.extensions = + (_ref = + extensions !== null && extensions !== void 0 + ? extensions + : originalExtensions) !== null && _ref !== void 0 + ? _ref + : Object.create(null); // Only properties prescribed by the spec should be enumerable. + // Keep the rest as non-enumerable. + + Object.defineProperties(this, { + message: { + writable: true, + enumerable: true, + }, + name: { + enumerable: false, + }, + nodes: { + enumerable: false, + }, + source: { + enumerable: false, + }, + positions: { + enumerable: false, + }, + originalError: { + enumerable: false, + }, + }); // Include (non-enumerable) stack trace. + + /* c8 ignore start */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + + if ( + originalError !== null && + originalError !== void 0 && + originalError.stack + ) { + Object.defineProperty(this, 'stack', { + value: originalError.stack, + writable: true, + configurable: true, + }); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, GraphQLError); + } else { + Object.defineProperty(this, 'stack', { + value: Error().stack, + writable: true, + configurable: true, + }); + } + /* c8 ignore stop */ + } + + get [Symbol.toStringTag]() { + return 'GraphQLError'; + } + + toString() { + let output = this.message; + + if (this.nodes) { + for (const node of this.nodes) { + if (node.loc) { + output += '\n\n' + printLocation(node.loc); + } + } + } else if (this.source && this.locations) { + for (const location of this.locations) { + output += '\n\n' + printSourceLocation(this.source, location); + } + } + + return output; + } + + toJSON() { + const formattedError = { + message: this.message, + }; + + if (this.locations != null) { + formattedError.locations = this.locations; + } + + if (this.path != null) { + formattedError.path = this.path; + } + + if (this.extensions != null && Object.keys(this.extensions).length > 0) { + formattedError.extensions = this.extensions; + } + + return formattedError; + } +} + +function undefinedIfEmpty(array) { + return array === undefined || array.length === 0 ? undefined : array; +} +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ + +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +export function printError(error) { + return error.toString(); +} +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toJSON` instead. Will be removed in v17 + */ + +export function formatError(error) { + return error.toJSON(); +} diff --git a/graphql-subscription/node_modules/graphql/error/index.d.ts b/graphql-subscription/node_modules/graphql/error/index.d.ts new file mode 100644 index 0000000..d95f96f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/index.d.ts @@ -0,0 +1,8 @@ +export { GraphQLError, printError, formatError } from './GraphQLError'; +export type { + GraphQLErrorOptions, + GraphQLFormattedError, + GraphQLErrorExtensions, +} from './GraphQLError'; +export { syntaxError } from './syntaxError'; +export { locatedError } from './locatedError'; diff --git a/graphql-subscription/node_modules/graphql/error/index.js b/graphql-subscription/node_modules/graphql/error/index.js new file mode 100644 index 0000000..c508370 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/index.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'GraphQLError', { + enumerable: true, + get: function () { + return _GraphQLError.GraphQLError; + }, +}); +Object.defineProperty(exports, 'formatError', { + enumerable: true, + get: function () { + return _GraphQLError.formatError; + }, +}); +Object.defineProperty(exports, 'locatedError', { + enumerable: true, + get: function () { + return _locatedError.locatedError; + }, +}); +Object.defineProperty(exports, 'printError', { + enumerable: true, + get: function () { + return _GraphQLError.printError; + }, +}); +Object.defineProperty(exports, 'syntaxError', { + enumerable: true, + get: function () { + return _syntaxError.syntaxError; + }, +}); + +var _GraphQLError = require('./GraphQLError.js'); + +var _syntaxError = require('./syntaxError.js'); + +var _locatedError = require('./locatedError.js'); diff --git a/graphql-subscription/node_modules/graphql/error/index.mjs b/graphql-subscription/node_modules/graphql/error/index.mjs new file mode 100644 index 0000000..d3507ff --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/index.mjs @@ -0,0 +1,3 @@ +export { GraphQLError, printError, formatError } from './GraphQLError.mjs'; +export { syntaxError } from './syntaxError.mjs'; +export { locatedError } from './locatedError.mjs'; diff --git a/graphql-subscription/node_modules/graphql/error/locatedError.d.ts b/graphql-subscription/node_modules/graphql/error/locatedError.d.ts new file mode 100644 index 0000000..8aa7f4a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/locatedError.d.ts @@ -0,0 +1,13 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ASTNode } from '../language/ast'; +import { GraphQLError } from './GraphQLError'; +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ +export declare function locatedError( + rawOriginalError: unknown, + nodes: ASTNode | ReadonlyArray | undefined | null, + path?: Maybe>, +): GraphQLError; diff --git a/graphql-subscription/node_modules/graphql/error/locatedError.js b/graphql-subscription/node_modules/graphql/error/locatedError.js new file mode 100644 index 0000000..48e5b99 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/locatedError.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.locatedError = locatedError; + +var _toError = require('../jsutils/toError.js'); + +var _GraphQLError = require('./GraphQLError.js'); + +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ +function locatedError(rawOriginalError, nodes, path) { + var _nodes; + + const originalError = (0, _toError.toError)(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + + if (isLocatedGraphQLError(originalError)) { + return originalError; + } + + return new _GraphQLError.GraphQLError(originalError.message, { + nodes: + (_nodes = originalError.nodes) !== null && _nodes !== void 0 + ? _nodes + : nodes, + source: originalError.source, + positions: originalError.positions, + path, + originalError, + }); +} + +function isLocatedGraphQLError(error) { + return Array.isArray(error.path); +} diff --git a/graphql-subscription/node_modules/graphql/error/locatedError.mjs b/graphql-subscription/node_modules/graphql/error/locatedError.mjs new file mode 100644 index 0000000..572e398 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/locatedError.mjs @@ -0,0 +1,32 @@ +import { toError } from '../jsutils/toError.mjs'; +import { GraphQLError } from './GraphQLError.mjs'; +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ + +export function locatedError(rawOriginalError, nodes, path) { + var _nodes; + + const originalError = toError(rawOriginalError); // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + + if (isLocatedGraphQLError(originalError)) { + return originalError; + } + + return new GraphQLError(originalError.message, { + nodes: + (_nodes = originalError.nodes) !== null && _nodes !== void 0 + ? _nodes + : nodes, + source: originalError.source, + positions: originalError.positions, + path, + originalError, + }); +} + +function isLocatedGraphQLError(error) { + return Array.isArray(error.path); +} diff --git a/graphql-subscription/node_modules/graphql/error/syntaxError.d.ts b/graphql-subscription/node_modules/graphql/error/syntaxError.d.ts new file mode 100644 index 0000000..3a4ceba --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/syntaxError.d.ts @@ -0,0 +1,11 @@ +import type { Source } from '../language/source'; +import { GraphQLError } from './GraphQLError'; +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ +export declare function syntaxError( + source: Source, + position: number, + description: string, +): GraphQLError; diff --git a/graphql-subscription/node_modules/graphql/error/syntaxError.js b/graphql-subscription/node_modules/graphql/error/syntaxError.js new file mode 100644 index 0000000..eb7dfc4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/syntaxError.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.syntaxError = syntaxError; + +var _GraphQLError = require('./GraphQLError.js'); + +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ +function syntaxError(source, position, description) { + return new _GraphQLError.GraphQLError(`Syntax Error: ${description}`, { + source, + positions: [position], + }); +} diff --git a/graphql-subscription/node_modules/graphql/error/syntaxError.mjs b/graphql-subscription/node_modules/graphql/error/syntaxError.mjs new file mode 100644 index 0000000..e5b2d74 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/error/syntaxError.mjs @@ -0,0 +1,12 @@ +import { GraphQLError } from './GraphQLError.mjs'; +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ + +export function syntaxError(source, position, description) { + return new GraphQLError(`Syntax Error: ${description}`, { + source, + positions: [position], + }); +} diff --git a/graphql-subscription/node_modules/graphql/execution/collectFields.d.ts b/graphql-subscription/node_modules/graphql/execution/collectFields.d.ts new file mode 100644 index 0000000..67532c5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/collectFields.d.ts @@ -0,0 +1,45 @@ +import type { ObjMap } from '../jsutils/ObjMap'; +import type { + FieldNode, + FragmentDefinitionNode, + SelectionSetNode, +} from '../language/ast'; +import type { GraphQLObjectType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Given a selectionSet, collects all of the fields and returns them. + * + * CollectFields requires the "runtime type" of an object. For a field that + * returns an Interface or Union type, the "runtime type" will be the actual + * object type returned by that field. + * + * @internal + */ +export declare function collectFields( + schema: GraphQLSchema, + fragments: ObjMap, + variableValues: { + [variable: string]: unknown; + }, + runtimeType: GraphQLObjectType, + selectionSet: SelectionSetNode, +): Map>; +/** + * Given an array of field nodes, collects all of the subfields of the passed + * in fields, and returns them at the end. + * + * CollectSubFields requires the "return type" of an object. For a field that + * returns an Interface or Union type, the "return type" will be the actual + * object type returned by that field. + * + * @internal + */ +export declare function collectSubfields( + schema: GraphQLSchema, + fragments: ObjMap, + variableValues: { + [variable: string]: unknown; + }, + returnType: GraphQLObjectType, + fieldNodes: ReadonlyArray, +): Map>; diff --git a/graphql-subscription/node_modules/graphql/execution/collectFields.js b/graphql-subscription/node_modules/graphql/execution/collectFields.js new file mode 100644 index 0000000..4259219 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/collectFields.js @@ -0,0 +1,229 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.collectFields = collectFields; +exports.collectSubfields = collectSubfields; + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _typeFromAST = require('../utilities/typeFromAST.js'); + +var _values = require('./values.js'); + +/** + * Given a selectionSet, collects all of the fields and returns them. + * + * CollectFields requires the "runtime type" of an object. For a field that + * returns an Interface or Union type, the "runtime type" will be the actual + * object type returned by that field. + * + * @internal + */ +function collectFields( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, +) { + const fields = new Map(); + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + new Set(), + ); + return fields; +} +/** + * Given an array of field nodes, collects all of the subfields of the passed + * in fields, and returns them at the end. + * + * CollectSubFields requires the "return type" of an object. For a field that + * returns an Interface or Union type, the "return type" will be the actual + * object type returned by that field. + * + * @internal + */ + +function collectSubfields( + schema, + fragments, + variableValues, + returnType, + fieldNodes, +) { + const subFieldNodes = new Map(); + const visitedFragmentNames = new Set(); + + for (const node of fieldNodes) { + if (node.selectionSet) { + collectFieldsImpl( + schema, + fragments, + variableValues, + returnType, + node.selectionSet, + subFieldNodes, + visitedFragmentNames, + ); + } + } + + return subFieldNodes; +} + +function collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + visitedFragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case _kinds.Kind.FIELD: { + if (!shouldIncludeNode(variableValues, selection)) { + continue; + } + + const name = getFieldEntryKey(selection); + const fieldList = fields.get(name); + + if (fieldList !== undefined) { + fieldList.push(selection); + } else { + fields.set(name, [selection]); + } + + break; + } + + case _kinds.Kind.INLINE_FRAGMENT: { + if ( + !shouldIncludeNode(variableValues, selection) || + !doesFragmentConditionMatch(schema, selection, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selection.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + + case _kinds.Kind.FRAGMENT_SPREAD: { + const fragName = selection.name.value; + + if ( + visitedFragmentNames.has(fragName) || + !shouldIncludeNode(variableValues, selection) + ) { + continue; + } + + visitedFragmentNames.add(fragName); + const fragment = fragments[fragName]; + + if ( + !fragment || + !doesFragmentConditionMatch(schema, fragment, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + fragment.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + } + } +} +/** + * Determines if a field should be included based on the `@include` and `@skip` + * directives, where `@skip` has higher precedence than `@include`. + */ + +function shouldIncludeNode(variableValues, node) { + const skip = (0, _values.getDirectiveValues)( + _directives.GraphQLSkipDirective, + node, + variableValues, + ); + + if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { + return false; + } + + const include = (0, _values.getDirectiveValues)( + _directives.GraphQLIncludeDirective, + node, + variableValues, + ); + + if ( + (include === null || include === void 0 ? void 0 : include.if) === false + ) { + return false; + } + + return true; +} +/** + * Determines if a fragment is applicable to the given type. + */ + +function doesFragmentConditionMatch(schema, fragment, type) { + const typeConditionNode = fragment.typeCondition; + + if (!typeConditionNode) { + return true; + } + + const conditionalType = (0, _typeFromAST.typeFromAST)( + schema, + typeConditionNode, + ); + + if (conditionalType === type) { + return true; + } + + if ((0, _definition.isAbstractType)(conditionalType)) { + return schema.isSubType(conditionalType, type); + } + + return false; +} +/** + * Implements the logic to compute the key of a given field's entry + */ + +function getFieldEntryKey(node) { + return node.alias ? node.alias.value : node.name.value; +} diff --git a/graphql-subscription/node_modules/graphql/execution/collectFields.mjs b/graphql-subscription/node_modules/graphql/execution/collectFields.mjs new file mode 100644 index 0000000..cb88797 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/collectFields.mjs @@ -0,0 +1,213 @@ +import { Kind } from '../language/kinds.mjs'; +import { isAbstractType } from '../type/definition.mjs'; +import { + GraphQLIncludeDirective, + GraphQLSkipDirective, +} from '../type/directives.mjs'; +import { typeFromAST } from '../utilities/typeFromAST.mjs'; +import { getDirectiveValues } from './values.mjs'; +/** + * Given a selectionSet, collects all of the fields and returns them. + * + * CollectFields requires the "runtime type" of an object. For a field that + * returns an Interface or Union type, the "runtime type" will be the actual + * object type returned by that field. + * + * @internal + */ + +export function collectFields( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, +) { + const fields = new Map(); + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + new Set(), + ); + return fields; +} +/** + * Given an array of field nodes, collects all of the subfields of the passed + * in fields, and returns them at the end. + * + * CollectSubFields requires the "return type" of an object. For a field that + * returns an Interface or Union type, the "return type" will be the actual + * object type returned by that field. + * + * @internal + */ + +export function collectSubfields( + schema, + fragments, + variableValues, + returnType, + fieldNodes, +) { + const subFieldNodes = new Map(); + const visitedFragmentNames = new Set(); + + for (const node of fieldNodes) { + if (node.selectionSet) { + collectFieldsImpl( + schema, + fragments, + variableValues, + returnType, + node.selectionSet, + subFieldNodes, + visitedFragmentNames, + ); + } + } + + return subFieldNodes; +} + +function collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + visitedFragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case Kind.FIELD: { + if (!shouldIncludeNode(variableValues, selection)) { + continue; + } + + const name = getFieldEntryKey(selection); + const fieldList = fields.get(name); + + if (fieldList !== undefined) { + fieldList.push(selection); + } else { + fields.set(name, [selection]); + } + + break; + } + + case Kind.INLINE_FRAGMENT: { + if ( + !shouldIncludeNode(variableValues, selection) || + !doesFragmentConditionMatch(schema, selection, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selection.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + + case Kind.FRAGMENT_SPREAD: { + const fragName = selection.name.value; + + if ( + visitedFragmentNames.has(fragName) || + !shouldIncludeNode(variableValues, selection) + ) { + continue; + } + + visitedFragmentNames.add(fragName); + const fragment = fragments[fragName]; + + if ( + !fragment || + !doesFragmentConditionMatch(schema, fragment, runtimeType) + ) { + continue; + } + + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + fragment.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + } + } +} +/** + * Determines if a field should be included based on the `@include` and `@skip` + * directives, where `@skip` has higher precedence than `@include`. + */ + +function shouldIncludeNode(variableValues, node) { + const skip = getDirectiveValues(GraphQLSkipDirective, node, variableValues); + + if ((skip === null || skip === void 0 ? void 0 : skip.if) === true) { + return false; + } + + const include = getDirectiveValues( + GraphQLIncludeDirective, + node, + variableValues, + ); + + if ( + (include === null || include === void 0 ? void 0 : include.if) === false + ) { + return false; + } + + return true; +} +/** + * Determines if a fragment is applicable to the given type. + */ + +function doesFragmentConditionMatch(schema, fragment, type) { + const typeConditionNode = fragment.typeCondition; + + if (!typeConditionNode) { + return true; + } + + const conditionalType = typeFromAST(schema, typeConditionNode); + + if (conditionalType === type) { + return true; + } + + if (isAbstractType(conditionalType)) { + return schema.isSubType(conditionalType, type); + } + + return false; +} +/** + * Implements the logic to compute the key of a given field's entry + */ + +function getFieldEntryKey(node) { + return node.alias ? node.alias.value : node.name.value; +} diff --git a/graphql-subscription/node_modules/graphql/execution/execute.d.ts b/graphql-subscription/node_modules/graphql/execution/execute.d.ts new file mode 100644 index 0000000..fa3dff9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/execute.d.ts @@ -0,0 +1,185 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { Path } from '../jsutils/Path'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +import type { GraphQLFormattedError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError'; +import type { + DocumentNode, + FieldNode, + FragmentDefinitionNode, + OperationDefinitionNode, +} from '../language/ast'; +import type { + GraphQLField, + GraphQLFieldResolver, + GraphQLObjectType, + GraphQLResolveInfo, + GraphQLTypeResolver, +} from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ +export interface ExecutionContext { + schema: GraphQLSchema; + fragments: ObjMap; + rootValue: unknown; + contextValue: unknown; + operation: OperationDefinitionNode; + variableValues: { + [variable: string]: unknown; + }; + fieldResolver: GraphQLFieldResolver; + typeResolver: GraphQLTypeResolver; + subscribeFieldResolver: GraphQLFieldResolver; + errors: Array; +} +/** + * The result of GraphQL execution. + * + * - `errors` is included when any errors occurred as a non-empty array. + * - `data` is the result of a successful execution of the query. + * - `extensions` is reserved for adding non-standard properties. + */ +export interface ExecutionResult< + TData = ObjMap, + TExtensions = ObjMap, +> { + errors?: ReadonlyArray; + data?: TData | null; + extensions?: TExtensions; +} +export interface FormattedExecutionResult< + TData = ObjMap, + TExtensions = ObjMap, +> { + errors?: ReadonlyArray; + data?: TData | null; + extensions?: TExtensions; +} +export interface ExecutionArgs { + schema: GraphQLSchema; + document: DocumentNode; + rootValue?: unknown; + contextValue?: unknown; + variableValues?: Maybe<{ + readonly [variable: string]: unknown; + }>; + operationName?: Maybe; + fieldResolver?: Maybe>; + typeResolver?: Maybe>; + subscribeFieldResolver?: Maybe>; +} +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the arguments to this function do not result in a legal execution context, + * a GraphQLError will be thrown immediately explaining the invalid input. + */ +export declare function execute( + args: ExecutionArgs, +): PromiseOrValue; +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ +export declare function executeSync(args: ExecutionArgs): ExecutionResult; +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ +export declare function assertValidExecutionArguments( + schema: GraphQLSchema, + document: DocumentNode, + rawVariableValues: Maybe<{ + readonly [variable: string]: unknown; + }>, +): void; +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ +export declare function buildExecutionContext( + args: ExecutionArgs, +): ReadonlyArray | ExecutionContext; +/** + * @internal + */ +export declare function buildResolveInfo( + exeContext: ExecutionContext, + fieldDef: GraphQLField, + fieldNodes: ReadonlyArray, + parentType: GraphQLObjectType, + path: Path, +): GraphQLResolveInfo; +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ +export declare const defaultTypeResolver: GraphQLTypeResolver; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ +export declare const defaultFieldResolver: GraphQLFieldResolver< + unknown, + unknown +>; +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ +export declare function getFieldDef( + schema: GraphQLSchema, + parentType: GraphQLObjectType, + fieldNode: FieldNode, +): Maybe>; diff --git a/graphql-subscription/node_modules/graphql/execution/execute.js b/graphql-subscription/node_modules/graphql/execution/execute.js new file mode 100644 index 0000000..cab41cf --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/execute.js @@ -0,0 +1,1037 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidExecutionArguments = assertValidExecutionArguments; +exports.buildExecutionContext = buildExecutionContext; +exports.buildResolveInfo = buildResolveInfo; +exports.defaultTypeResolver = exports.defaultFieldResolver = void 0; +exports.execute = execute; +exports.executeSync = executeSync; +exports.getFieldDef = getFieldDef; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _isIterableObject = require('../jsutils/isIterableObject.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _isPromise = require('../jsutils/isPromise.js'); + +var _memoize = require('../jsutils/memoize3.js'); + +var _Path = require('../jsutils/Path.js'); + +var _promiseForObject = require('../jsutils/promiseForObject.js'); + +var _promiseReduce = require('../jsutils/promiseReduce.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _locatedError = require('../error/locatedError.js'); + +var _ast = require('../language/ast.js'); + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +var _introspection = require('../type/introspection.js'); + +var _validate = require('../type/validate.js'); + +var _collectFields = require('./collectFields.js'); + +var _values = require('./values.js'); + +/** + * A memoized collection of relevant subfields with regard to the return + * type. Memoizing ensures the subfields are not repeatedly calculated, which + * saves overhead when resolving lists of values. + */ +const collectSubfields = (0, _memoize.memoize3)( + (exeContext, returnType, fieldNodes) => + (0, _collectFields.collectSubfields)( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + returnType, + fieldNodes, + ), +); +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ + +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ + +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the arguments to this function do not result in a legal execution context, + * a GraphQLError will be thrown immediately explaining the invalid input. + */ +function execute(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + (0, _devAssert.devAssert)( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { schema, document, variableValues, rootValue } = args; // If arguments are missing or incorrect, throw an error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = buildExecutionContext(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } // Return a Promise that will eventually resolve to the data described by + // The "Response" section of the GraphQL specification. + // + // If errors are encountered while executing a GraphQL field, only that + // field and its descendants will be omitted, and sibling fields will still + // be executed. An execution which encounters errors will still result in a + // resolved Promise. + // + // Errors from sub-fields of a NonNull type may propagate to the top level, + // at which point we still log the error and null the parent field, which + // in this case is the entire response. + + try { + const { operation } = exeContext; + const result = executeOperation(exeContext, operation, rootValue); + + if ((0, _isPromise.isPromise)(result)) { + return result.then( + (data) => buildResponse(data, exeContext.errors), + (error) => { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + }, + ); + } + + return buildResponse(result, exeContext.errors); + } catch (error) { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + } +} +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +function executeSync(args) { + const result = execute(args); // Assert that the execution was synchronous. + + if ((0, _isPromise.isPromise)(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} +/** + * Given a completed execution context and data, build the `{ errors, data }` + * response defined by the "Response" section of the GraphQL specification. + */ + +function buildResponse(data, errors) { + return errors.length === 0 + ? { + data, + } + : { + errors, + data, + }; +} +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ + +function assertValidExecutionArguments(schema, document, rawVariableValues) { + document || (0, _devAssert.devAssert)(false, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. + + (0, _validate.assertValidSchema)(schema); // Variables, if provided, must be an object. + + rawVariableValues == null || + (0, _isObjectLike.isObjectLike)(rawVariableValues) || + (0, _devAssert.devAssert)( + false, + 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', + ); +} +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ + +function buildExecutionContext(args) { + var _definition$name, _operation$variableDe; + + const { + schema, + document, + rootValue, + contextValue, + variableValues: rawVariableValues, + operationName, + fieldResolver, + typeResolver, + subscribeFieldResolver, + } = args; + let operation; + const fragments = Object.create(null); + + for (const definition of document.definitions) { + switch (definition.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + if (operationName == null) { + if (operation !== undefined) { + return [ + new _GraphQLError.GraphQLError( + 'Must provide operation name if query contains multiple operations.', + ), + ]; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + operation = definition; + } + + break; + + case _kinds.Kind.FRAGMENT_DEFINITION: + fragments[definition.name.value] = definition; + break; + + default: // ignore non-executable definitions + } + } + + if (!operation) { + if (operationName != null) { + return [ + new _GraphQLError.GraphQLError( + `Unknown operation named "${operationName}".`, + ), + ]; + } + + return [new _GraphQLError.GraphQLError('Must provide an operation.')]; + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const variableDefinitions = + (_operation$variableDe = operation.variableDefinitions) !== null && + _operation$variableDe !== void 0 + ? _operation$variableDe + : []; + const coercedVariableValues = (0, _values.getVariableValues)( + schema, + variableDefinitions, + rawVariableValues !== null && rawVariableValues !== void 0 + ? rawVariableValues + : {}, + { + maxErrors: 50, + }, + ); + + if (coercedVariableValues.errors) { + return coercedVariableValues.errors; + } + + return { + schema, + fragments, + rootValue, + contextValue, + operation, + variableValues: coercedVariableValues.coerced, + fieldResolver: + fieldResolver !== null && fieldResolver !== void 0 + ? fieldResolver + : defaultFieldResolver, + typeResolver: + typeResolver !== null && typeResolver !== void 0 + ? typeResolver + : defaultTypeResolver, + subscribeFieldResolver: + subscribeFieldResolver !== null && subscribeFieldResolver !== void 0 + ? subscribeFieldResolver + : defaultFieldResolver, + errors: [], + }; +} +/** + * Implements the "Executing operations" section of the spec. + */ + +function executeOperation(exeContext, operation, rootValue) { + const rootType = exeContext.schema.getRootType(operation.operation); + + if (rootType == null) { + throw new _GraphQLError.GraphQLError( + `Schema is not configured to execute ${operation.operation} operation.`, + { + nodes: operation, + }, + ); + } + + const rootFields = (0, _collectFields.collectFields)( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + rootType, + operation.selectionSet, + ); + const path = undefined; + + switch (operation.operation) { + case _ast.OperationTypeNode.QUERY: + return executeFields(exeContext, rootType, rootValue, path, rootFields); + + case _ast.OperationTypeNode.MUTATION: + return executeFieldsSerially( + exeContext, + rootType, + rootValue, + path, + rootFields, + ); + + case _ast.OperationTypeNode.SUBSCRIPTION: + // TODO: deprecate `subscribe` and move all logic here + // Temporary solution until we finish merging execute and subscribe together + return executeFields(exeContext, rootType, rootValue, path, rootFields); + } +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that must be executed serially. + */ + +function executeFieldsSerially( + exeContext, + parentType, + sourceValue, + path, + fields, +) { + return (0, _promiseReduce.promiseReduce)( + fields.entries(), + (results, [responseName, fieldNodes]) => { + const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result === undefined) { + return results; + } + + if ((0, _isPromise.isPromise)(result)) { + return result.then((resolvedResult) => { + results[responseName] = resolvedResult; + return results; + }); + } + + results[responseName] = result; + return results; + }, + Object.create(null), + ); +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that may be executed in parallel. + */ + +function executeFields(exeContext, parentType, sourceValue, path, fields) { + const results = Object.create(null); + let containsPromise = false; + + try { + for (const [responseName, fieldNodes] of fields.entries()) { + const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result !== undefined) { + results[responseName] = result; + + if ((0, _isPromise.isPromise)(result)) { + containsPromise = true; + } + } + } + } catch (error) { + if (containsPromise) { + // Ensure that any promises returned by other fields are handled, as they may also reject. + return (0, _promiseForObject.promiseForObject)(results).finally(() => { + throw error; + }); + } + + throw error; + } // If there are no promises, we can just return the object + + if (!containsPromise) { + return results; + } // Otherwise, results is a map from field name to the result of resolving that + // field, which is possibly a promise. Return a promise that will return this + // same map, but with any promises replaced with the values they resolved to. + + return (0, _promiseForObject.promiseForObject)(results); +} +/** + * Implements the "Executing fields" section of the spec + * In particular, this function figures out the value that the field returns by + * calling its resolve function, then calls completeValue to complete promises, + * serialize scalars, or execute the sub-selection-set for objects. + */ + +function executeField(exeContext, parentType, source, fieldNodes, path) { + var _fieldDef$resolve; + + const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]); + + if (!fieldDef) { + return; + } + + const returnType = fieldDef.type; + const resolveFn = + (_fieldDef$resolve = fieldDef.resolve) !== null && + _fieldDef$resolve !== void 0 + ? _fieldDef$resolve + : exeContext.fieldResolver; + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + parentType, + path, + ); // Get the resolve function, regardless of if its result is normal or abrupt (error). + + try { + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + // TODO: find a way to memoize, in case this field is within a List type. + const args = (0, _values.getArgumentValues)( + fieldDef, + fieldNodes[0], + exeContext.variableValues, + ); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; + const result = resolveFn(source, args, contextValue, info); + let completed; + + if ((0, _isPromise.isPromise)(result)) { + completed = result.then((resolved) => + completeValue(exeContext, returnType, fieldNodes, info, path, resolved), + ); + } else { + completed = completeValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + + if ((0, _isPromise.isPromise)(completed)) { + // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + return completed.then(undefined, (rawError) => { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(path), + ); + return handleFieldError(error, returnType, exeContext); + }); + } + + return completed; + } catch (rawError) { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(path), + ); + return handleFieldError(error, returnType, exeContext); + } +} +/** + * @internal + */ + +function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) { + // The resolve function's optional fourth argument is a collection of + // information about the current execution state. + return { + fieldName: fieldDef.name, + fieldNodes, + returnType: fieldDef.type, + parentType, + path, + schema: exeContext.schema, + fragments: exeContext.fragments, + rootValue: exeContext.rootValue, + operation: exeContext.operation, + variableValues: exeContext.variableValues, + }; +} + +function handleFieldError(error, returnType, exeContext) { + // If the field type is non-nullable, then it is resolved without any + // protection from errors, however it still properly locates the error. + if ((0, _definition.isNonNullType)(returnType)) { + throw error; + } // Otherwise, error protection is applied, logging the error and resolving + // a null value for this field if one is encountered. + + exeContext.errors.push(error); + return null; +} +/** + * Implements the instructions for completeValue as defined in the + * "Value Completion" section of the spec. + * + * If the field type is Non-Null, then this recursively completes the value + * for the inner type. It throws a field error if that completion returns null, + * as per the "Nullability" section of the spec. + * + * If the field type is a List, then this recursively completes the value + * for the inner type on each item in the list. + * + * If the field type is a Scalar or Enum, ensures the completed value is a legal + * value of the type by calling the `serialize` method of GraphQL type + * definition. + * + * If the field is an abstract type, determine the runtime type of the value + * and then complete based on that type + * + * Otherwise, the field type expects a sub-selection set, and will complete the + * value by executing all sub-selections. + */ + +function completeValue(exeContext, returnType, fieldNodes, info, path, result) { + // If result is an Error, throw a located error. + if (result instanceof Error) { + throw result; + } // If field type is NonNull, complete for inner type, and throw field error + // if result is null. + + if ((0, _definition.isNonNullType)(returnType)) { + const completed = completeValue( + exeContext, + returnType.ofType, + fieldNodes, + info, + path, + result, + ); + + if (completed === null) { + throw new Error( + `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`, + ); + } + + return completed; + } // If result value is null or undefined then return null. + + if (result == null) { + return null; + } // If field type is List, complete each item in the list with the inner type + + if ((0, _definition.isListType)(returnType)) { + return completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, + // returning null if serialization is not possible. + + if ((0, _definition.isLeafType)(returnType)) { + return completeLeafValue(returnType, result); + } // If field type is an abstract type, Interface or Union, determine the + // runtime Object type and complete for that type. + + if ((0, _definition.isAbstractType)(returnType)) { + return completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is Object, execute and complete all sub-selections. + + if ((0, _definition.isObjectType)(returnType)) { + return completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + /* c8 ignore next 6 */ + // Not reachable, all possible output types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Cannot complete value of unexpected output type: ' + + (0, _inspect.inspect)(returnType), + ); +} +/** + * Complete a list value by completing each item in the list with the + * inner type + */ + +function completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + if (!(0, _isIterableObject.isIterableObject)(result)) { + throw new _GraphQLError.GraphQLError( + `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`, + ); + } // This is specified as a simple map, however we're optimizing the path + // where the list contains no Promises by avoiding creating another Promise. + + const itemType = returnType.ofType; + let containsPromise = false; + const completedResults = Array.from(result, (item, index) => { + // No need to modify the info object containing the path, + // since from here on it is not ever accessed by resolver functions. + const itemPath = (0, _Path.addPath)(path, index, undefined); + + try { + let completedItem; + + if ((0, _isPromise.isPromise)(item)) { + completedItem = item.then((resolved) => + completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + resolved, + ), + ); + } else { + completedItem = completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + item, + ); + } + + if ((0, _isPromise.isPromise)(completedItem)) { + containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + + return completedItem.then(undefined, (rawError) => { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(itemPath), + ); + return handleFieldError(error, itemType, exeContext); + }); + } + + return completedItem; + } catch (rawError) { + const error = (0, _locatedError.locatedError)( + rawError, + fieldNodes, + (0, _Path.pathToArray)(itemPath), + ); + return handleFieldError(error, itemType, exeContext); + } + }); + return containsPromise ? Promise.all(completedResults) : completedResults; +} +/** + * Complete a Scalar or Enum by serializing to a valid value, returning + * null if serialization is not possible. + */ + +function completeLeafValue(returnType, result) { + const serializedResult = returnType.serialize(result); + + if (serializedResult == null) { + throw new Error( + `Expected \`${(0, _inspect.inspect)(returnType)}.serialize(${(0, + _inspect.inspect)(result)})\` to ` + + `return non-nullable value, returned: ${(0, _inspect.inspect)( + serializedResult, + )}`, + ); + } + + return serializedResult; +} +/** + * Complete a value of an abstract type by determining the runtime object type + * of that value, then complete the value for that type. + */ + +function completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + var _returnType$resolveTy; + + const resolveTypeFn = + (_returnType$resolveTy = returnType.resolveType) !== null && + _returnType$resolveTy !== void 0 + ? _returnType$resolveTy + : exeContext.typeResolver; + const contextValue = exeContext.contextValue; + const runtimeType = resolveTypeFn(result, contextValue, info, returnType); + + if ((0, _isPromise.isPromise)(runtimeType)) { + return runtimeType.then((resolvedRuntimeType) => + completeObjectValue( + exeContext, + ensureValidRuntimeType( + resolvedRuntimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ), + ); + } + + return completeObjectValue( + exeContext, + ensureValidRuntimeType( + runtimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ); +} + +function ensureValidRuntimeType( + runtimeTypeName, + exeContext, + returnType, + fieldNodes, + info, + result, +) { + if (runtimeTypeName == null) { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, + fieldNodes, + ); + } // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` + // TODO: remove in 17.0.0 release + + if ((0, _definition.isObjectType)(runtimeTypeName)) { + throw new _GraphQLError.GraphQLError( + 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', + ); + } + + if (typeof runtimeTypeName !== 'string') { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` + + `value ${(0, _inspect.inspect)(result)}, received "${(0, + _inspect.inspect)(runtimeTypeName)}".`, + ); + } + + const runtimeType = exeContext.schema.getType(runtimeTypeName); + + if (runtimeType == null) { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`, + { + nodes: fieldNodes, + }, + ); + } + + if (!(0, _definition.isObjectType)(runtimeType)) { + throw new _GraphQLError.GraphQLError( + `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`, + { + nodes: fieldNodes, + }, + ); + } + + if (!exeContext.schema.isSubType(returnType, runtimeType)) { + throw new _GraphQLError.GraphQLError( + `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, + { + nodes: fieldNodes, + }, + ); + } + + return runtimeType; +} +/** + * Complete an Object value by executing all sub-selections. + */ + +function completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + // Collect sub-fields to execute to complete this value. + const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); // If there is an isTypeOf predicate function, call it with the + // current result. If isTypeOf returns false, then raise an error rather + // than continuing execution. + + if (returnType.isTypeOf) { + const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); + + if ((0, _isPromise.isPromise)(isTypeOf)) { + return isTypeOf.then((resolvedIsTypeOf) => { + if (!resolvedIsTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + + return executeFields( + exeContext, + returnType, + result, + path, + subFieldNodes, + ); + }); + } + + if (!isTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + } + + return executeFields(exeContext, returnType, result, path, subFieldNodes); +} + +function invalidReturnTypeError(returnType, result, fieldNodes) { + return new _GraphQLError.GraphQLError( + `Expected value of type "${returnType.name}" but got: ${(0, + _inspect.inspect)(result)}.`, + { + nodes: fieldNodes, + }, + ); +} +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ + +const defaultTypeResolver = function (value, contextValue, info, abstractType) { + // First, look for `__typename`. + if ( + (0, _isObjectLike.isObjectLike)(value) && + typeof value.__typename === 'string' + ) { + return value.__typename; + } // Otherwise, test each possible type. + + const possibleTypes = info.schema.getPossibleTypes(abstractType); + const promisedIsTypeOfResults = []; + + for (let i = 0; i < possibleTypes.length; i++) { + const type = possibleTypes[i]; + + if (type.isTypeOf) { + const isTypeOfResult = type.isTypeOf(value, contextValue, info); + + if ((0, _isPromise.isPromise)(isTypeOfResult)) { + promisedIsTypeOfResults[i] = isTypeOfResult; + } else if (isTypeOfResult) { + return type.name; + } + } + } + + if (promisedIsTypeOfResults.length) { + return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => { + for (let i = 0; i < isTypeOfResults.length; i++) { + if (isTypeOfResults[i]) { + return possibleTypes[i].name; + } + } + }); + } +}; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ + +exports.defaultTypeResolver = defaultTypeResolver; + +const defaultFieldResolver = function (source, args, contextValue, info) { + // ensure source is a value for which property access is acceptable. + if ((0, _isObjectLike.isObjectLike)(source) || typeof source === 'function') { + const property = source[info.fieldName]; + + if (typeof property === 'function') { + return source[info.fieldName](args, contextValue, info); + } + + return property; + } +}; +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ + +exports.defaultFieldResolver = defaultFieldResolver; + +function getFieldDef(schema, parentType, fieldNode) { + const fieldName = fieldNode.name.value; + + if ( + fieldName === _introspection.SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.SchemaMetaFieldDef; + } else if ( + fieldName === _introspection.TypeMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.TypeMetaFieldDef; + } else if (fieldName === _introspection.TypeNameMetaFieldDef.name) { + return _introspection.TypeNameMetaFieldDef; + } + + return parentType.getFields()[fieldName]; +} diff --git a/graphql-subscription/node_modules/graphql/execution/execute.mjs b/graphql-subscription/node_modules/graphql/execution/execute.mjs new file mode 100644 index 0000000..bc084be --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/execute.mjs @@ -0,0 +1,1009 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isIterableObject } from '../jsutils/isIterableObject.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { isPromise } from '../jsutils/isPromise.mjs'; +import { memoize3 } from '../jsutils/memoize3.mjs'; +import { addPath, pathToArray } from '../jsutils/Path.mjs'; +import { promiseForObject } from '../jsutils/promiseForObject.mjs'; +import { promiseReduce } from '../jsutils/promiseReduce.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { locatedError } from '../error/locatedError.mjs'; +import { OperationTypeNode } from '../language/ast.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isAbstractType, + isLeafType, + isListType, + isNonNullType, + isObjectType, +} from '../type/definition.mjs'; +import { + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from '../type/introspection.mjs'; +import { assertValidSchema } from '../type/validate.mjs'; +import { + collectFields, + collectSubfields as _collectSubfields, +} from './collectFields.mjs'; +import { getArgumentValues, getVariableValues } from './values.mjs'; +/** + * A memoized collection of relevant subfields with regard to the return + * type. Memoizing ensures the subfields are not repeatedly calculated, which + * saves overhead when resolving lists of values. + */ + +const collectSubfields = memoize3((exeContext, returnType, fieldNodes) => + _collectSubfields( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + returnType, + fieldNodes, + ), +); +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ + +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ + +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the arguments to this function do not result in a legal execution context, + * a GraphQLError will be thrown immediately explaining the invalid input. + */ +export function execute(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + devAssert( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { schema, document, variableValues, rootValue } = args; // If arguments are missing or incorrect, throw an error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = buildExecutionContext(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } // Return a Promise that will eventually resolve to the data described by + // The "Response" section of the GraphQL specification. + // + // If errors are encountered while executing a GraphQL field, only that + // field and its descendants will be omitted, and sibling fields will still + // be executed. An execution which encounters errors will still result in a + // resolved Promise. + // + // Errors from sub-fields of a NonNull type may propagate to the top level, + // at which point we still log the error and null the parent field, which + // in this case is the entire response. + + try { + const { operation } = exeContext; + const result = executeOperation(exeContext, operation, rootValue); + + if (isPromise(result)) { + return result.then( + (data) => buildResponse(data, exeContext.errors), + (error) => { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + }, + ); + } + + return buildResponse(result, exeContext.errors); + } catch (error) { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + } +} +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +export function executeSync(args) { + const result = execute(args); // Assert that the execution was synchronous. + + if (isPromise(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} +/** + * Given a completed execution context and data, build the `{ errors, data }` + * response defined by the "Response" section of the GraphQL specification. + */ + +function buildResponse(data, errors) { + return errors.length === 0 + ? { + data, + } + : { + errors, + data, + }; +} +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ + +export function assertValidExecutionArguments( + schema, + document, + rawVariableValues, +) { + document || devAssert(false, 'Must provide document.'); // If the schema used for execution is invalid, throw an error. + + assertValidSchema(schema); // Variables, if provided, must be an object. + + rawVariableValues == null || + isObjectLike(rawVariableValues) || + devAssert( + false, + 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', + ); +} +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ + +export function buildExecutionContext(args) { + var _definition$name, _operation$variableDe; + + const { + schema, + document, + rootValue, + contextValue, + variableValues: rawVariableValues, + operationName, + fieldResolver, + typeResolver, + subscribeFieldResolver, + } = args; + let operation; + const fragments = Object.create(null); + + for (const definition of document.definitions) { + switch (definition.kind) { + case Kind.OPERATION_DEFINITION: + if (operationName == null) { + if (operation !== undefined) { + return [ + new GraphQLError( + 'Must provide operation name if query contains multiple operations.', + ), + ]; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + operation = definition; + } + + break; + + case Kind.FRAGMENT_DEFINITION: + fragments[definition.name.value] = definition; + break; + + default: // ignore non-executable definitions + } + } + + if (!operation) { + if (operationName != null) { + return [new GraphQLError(`Unknown operation named "${operationName}".`)]; + } + + return [new GraphQLError('Must provide an operation.')]; + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const variableDefinitions = + (_operation$variableDe = operation.variableDefinitions) !== null && + _operation$variableDe !== void 0 + ? _operation$variableDe + : []; + const coercedVariableValues = getVariableValues( + schema, + variableDefinitions, + rawVariableValues !== null && rawVariableValues !== void 0 + ? rawVariableValues + : {}, + { + maxErrors: 50, + }, + ); + + if (coercedVariableValues.errors) { + return coercedVariableValues.errors; + } + + return { + schema, + fragments, + rootValue, + contextValue, + operation, + variableValues: coercedVariableValues.coerced, + fieldResolver: + fieldResolver !== null && fieldResolver !== void 0 + ? fieldResolver + : defaultFieldResolver, + typeResolver: + typeResolver !== null && typeResolver !== void 0 + ? typeResolver + : defaultTypeResolver, + subscribeFieldResolver: + subscribeFieldResolver !== null && subscribeFieldResolver !== void 0 + ? subscribeFieldResolver + : defaultFieldResolver, + errors: [], + }; +} +/** + * Implements the "Executing operations" section of the spec. + */ + +function executeOperation(exeContext, operation, rootValue) { + const rootType = exeContext.schema.getRootType(operation.operation); + + if (rootType == null) { + throw new GraphQLError( + `Schema is not configured to execute ${operation.operation} operation.`, + { + nodes: operation, + }, + ); + } + + const rootFields = collectFields( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + rootType, + operation.selectionSet, + ); + const path = undefined; + + switch (operation.operation) { + case OperationTypeNode.QUERY: + return executeFields(exeContext, rootType, rootValue, path, rootFields); + + case OperationTypeNode.MUTATION: + return executeFieldsSerially( + exeContext, + rootType, + rootValue, + path, + rootFields, + ); + + case OperationTypeNode.SUBSCRIPTION: + // TODO: deprecate `subscribe` and move all logic here + // Temporary solution until we finish merging execute and subscribe together + return executeFields(exeContext, rootType, rootValue, path, rootFields); + } +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that must be executed serially. + */ + +function executeFieldsSerially( + exeContext, + parentType, + sourceValue, + path, + fields, +) { + return promiseReduce( + fields.entries(), + (results, [responseName, fieldNodes]) => { + const fieldPath = addPath(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result === undefined) { + return results; + } + + if (isPromise(result)) { + return result.then((resolvedResult) => { + results[responseName] = resolvedResult; + return results; + }); + } + + results[responseName] = result; + return results; + }, + Object.create(null), + ); +} +/** + * Implements the "Executing selection sets" section of the spec + * for fields that may be executed in parallel. + */ + +function executeFields(exeContext, parentType, sourceValue, path, fields) { + const results = Object.create(null); + let containsPromise = false; + + try { + for (const [responseName, fieldNodes] of fields.entries()) { + const fieldPath = addPath(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result !== undefined) { + results[responseName] = result; + + if (isPromise(result)) { + containsPromise = true; + } + } + } + } catch (error) { + if (containsPromise) { + // Ensure that any promises returned by other fields are handled, as they may also reject. + return promiseForObject(results).finally(() => { + throw error; + }); + } + + throw error; + } // If there are no promises, we can just return the object + + if (!containsPromise) { + return results; + } // Otherwise, results is a map from field name to the result of resolving that + // field, which is possibly a promise. Return a promise that will return this + // same map, but with any promises replaced with the values they resolved to. + + return promiseForObject(results); +} +/** + * Implements the "Executing fields" section of the spec + * In particular, this function figures out the value that the field returns by + * calling its resolve function, then calls completeValue to complete promises, + * serialize scalars, or execute the sub-selection-set for objects. + */ + +function executeField(exeContext, parentType, source, fieldNodes, path) { + var _fieldDef$resolve; + + const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]); + + if (!fieldDef) { + return; + } + + const returnType = fieldDef.type; + const resolveFn = + (_fieldDef$resolve = fieldDef.resolve) !== null && + _fieldDef$resolve !== void 0 + ? _fieldDef$resolve + : exeContext.fieldResolver; + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + parentType, + path, + ); // Get the resolve function, regardless of if its result is normal or abrupt (error). + + try { + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + // TODO: find a way to memoize, in case this field is within a List type. + const args = getArgumentValues( + fieldDef, + fieldNodes[0], + exeContext.variableValues, + ); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; + const result = resolveFn(source, args, contextValue, info); + let completed; + + if (isPromise(result)) { + completed = result.then((resolved) => + completeValue(exeContext, returnType, fieldNodes, info, path, resolved), + ); + } else { + completed = completeValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + + if (isPromise(completed)) { + // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + return completed.then(undefined, (rawError) => { + const error = locatedError(rawError, fieldNodes, pathToArray(path)); + return handleFieldError(error, returnType, exeContext); + }); + } + + return completed; + } catch (rawError) { + const error = locatedError(rawError, fieldNodes, pathToArray(path)); + return handleFieldError(error, returnType, exeContext); + } +} +/** + * @internal + */ + +export function buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + parentType, + path, +) { + // The resolve function's optional fourth argument is a collection of + // information about the current execution state. + return { + fieldName: fieldDef.name, + fieldNodes, + returnType: fieldDef.type, + parentType, + path, + schema: exeContext.schema, + fragments: exeContext.fragments, + rootValue: exeContext.rootValue, + operation: exeContext.operation, + variableValues: exeContext.variableValues, + }; +} + +function handleFieldError(error, returnType, exeContext) { + // If the field type is non-nullable, then it is resolved without any + // protection from errors, however it still properly locates the error. + if (isNonNullType(returnType)) { + throw error; + } // Otherwise, error protection is applied, logging the error and resolving + // a null value for this field if one is encountered. + + exeContext.errors.push(error); + return null; +} +/** + * Implements the instructions for completeValue as defined in the + * "Value Completion" section of the spec. + * + * If the field type is Non-Null, then this recursively completes the value + * for the inner type. It throws a field error if that completion returns null, + * as per the "Nullability" section of the spec. + * + * If the field type is a List, then this recursively completes the value + * for the inner type on each item in the list. + * + * If the field type is a Scalar or Enum, ensures the completed value is a legal + * value of the type by calling the `serialize` method of GraphQL type + * definition. + * + * If the field is an abstract type, determine the runtime type of the value + * and then complete based on that type + * + * Otherwise, the field type expects a sub-selection set, and will complete the + * value by executing all sub-selections. + */ + +function completeValue(exeContext, returnType, fieldNodes, info, path, result) { + // If result is an Error, throw a located error. + if (result instanceof Error) { + throw result; + } // If field type is NonNull, complete for inner type, and throw field error + // if result is null. + + if (isNonNullType(returnType)) { + const completed = completeValue( + exeContext, + returnType.ofType, + fieldNodes, + info, + path, + result, + ); + + if (completed === null) { + throw new Error( + `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`, + ); + } + + return completed; + } // If result value is null or undefined then return null. + + if (result == null) { + return null; + } // If field type is List, complete each item in the list with the inner type + + if (isListType(returnType)) { + return completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is a leaf type, Scalar or Enum, serialize to a valid value, + // returning null if serialization is not possible. + + if (isLeafType(returnType)) { + return completeLeafValue(returnType, result); + } // If field type is an abstract type, Interface or Union, determine the + // runtime Object type and complete for that type. + + if (isAbstractType(returnType)) { + return completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } // If field type is Object, execute and complete all sub-selections. + + if (isObjectType(returnType)) { + return completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + /* c8 ignore next 6 */ + // Not reachable, all possible output types have been considered. + + false || + invariant( + false, + 'Cannot complete value of unexpected output type: ' + inspect(returnType), + ); +} +/** + * Complete a list value by completing each item in the list with the + * inner type + */ + +function completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + if (!isIterableObject(result)) { + throw new GraphQLError( + `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`, + ); + } // This is specified as a simple map, however we're optimizing the path + // where the list contains no Promises by avoiding creating another Promise. + + const itemType = returnType.ofType; + let containsPromise = false; + const completedResults = Array.from(result, (item, index) => { + // No need to modify the info object containing the path, + // since from here on it is not ever accessed by resolver functions. + const itemPath = addPath(path, index, undefined); + + try { + let completedItem; + + if (isPromise(item)) { + completedItem = item.then((resolved) => + completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + resolved, + ), + ); + } else { + completedItem = completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + item, + ); + } + + if (isPromise(completedItem)) { + containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + + return completedItem.then(undefined, (rawError) => { + const error = locatedError( + rawError, + fieldNodes, + pathToArray(itemPath), + ); + return handleFieldError(error, itemType, exeContext); + }); + } + + return completedItem; + } catch (rawError) { + const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); + return handleFieldError(error, itemType, exeContext); + } + }); + return containsPromise ? Promise.all(completedResults) : completedResults; +} +/** + * Complete a Scalar or Enum by serializing to a valid value, returning + * null if serialization is not possible. + */ + +function completeLeafValue(returnType, result) { + const serializedResult = returnType.serialize(result); + + if (serializedResult == null) { + throw new Error( + `Expected \`${inspect(returnType)}.serialize(${inspect(result)})\` to ` + + `return non-nullable value, returned: ${inspect(serializedResult)}`, + ); + } + + return serializedResult; +} +/** + * Complete a value of an abstract type by determining the runtime object type + * of that value, then complete the value for that type. + */ + +function completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + var _returnType$resolveTy; + + const resolveTypeFn = + (_returnType$resolveTy = returnType.resolveType) !== null && + _returnType$resolveTy !== void 0 + ? _returnType$resolveTy + : exeContext.typeResolver; + const contextValue = exeContext.contextValue; + const runtimeType = resolveTypeFn(result, contextValue, info, returnType); + + if (isPromise(runtimeType)) { + return runtimeType.then((resolvedRuntimeType) => + completeObjectValue( + exeContext, + ensureValidRuntimeType( + resolvedRuntimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ), + ); + } + + return completeObjectValue( + exeContext, + ensureValidRuntimeType( + runtimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ); +} + +function ensureValidRuntimeType( + runtimeTypeName, + exeContext, + returnType, + fieldNodes, + info, + result, +) { + if (runtimeTypeName == null) { + throw new GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, + fieldNodes, + ); + } // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` + // TODO: remove in 17.0.0 release + + if (isObjectType(runtimeTypeName)) { + throw new GraphQLError( + 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', + ); + } + + if (typeof runtimeTypeName !== 'string') { + throw new GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` + + `value ${inspect(result)}, received "${inspect(runtimeTypeName)}".`, + ); + } + + const runtimeType = exeContext.schema.getType(runtimeTypeName); + + if (runtimeType == null) { + throw new GraphQLError( + `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`, + { + nodes: fieldNodes, + }, + ); + } + + if (!isObjectType(runtimeType)) { + throw new GraphQLError( + `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`, + { + nodes: fieldNodes, + }, + ); + } + + if (!exeContext.schema.isSubType(returnType, runtimeType)) { + throw new GraphQLError( + `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, + { + nodes: fieldNodes, + }, + ); + } + + return runtimeType; +} +/** + * Complete an Object value by executing all sub-selections. + */ + +function completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, +) { + // Collect sub-fields to execute to complete this value. + const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); // If there is an isTypeOf predicate function, call it with the + // current result. If isTypeOf returns false, then raise an error rather + // than continuing execution. + + if (returnType.isTypeOf) { + const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); + + if (isPromise(isTypeOf)) { + return isTypeOf.then((resolvedIsTypeOf) => { + if (!resolvedIsTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + + return executeFields( + exeContext, + returnType, + result, + path, + subFieldNodes, + ); + }); + } + + if (!isTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + } + + return executeFields(exeContext, returnType, result, path, subFieldNodes); +} + +function invalidReturnTypeError(returnType, result, fieldNodes) { + return new GraphQLError( + `Expected value of type "${returnType.name}" but got: ${inspect(result)}.`, + { + nodes: fieldNodes, + }, + ); +} +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ + +export const defaultTypeResolver = function ( + value, + contextValue, + info, + abstractType, +) { + // First, look for `__typename`. + if (isObjectLike(value) && typeof value.__typename === 'string') { + return value.__typename; + } // Otherwise, test each possible type. + + const possibleTypes = info.schema.getPossibleTypes(abstractType); + const promisedIsTypeOfResults = []; + + for (let i = 0; i < possibleTypes.length; i++) { + const type = possibleTypes[i]; + + if (type.isTypeOf) { + const isTypeOfResult = type.isTypeOf(value, contextValue, info); + + if (isPromise(isTypeOfResult)) { + promisedIsTypeOfResults[i] = isTypeOfResult; + } else if (isTypeOfResult) { + return type.name; + } + } + } + + if (promisedIsTypeOfResults.length) { + return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => { + for (let i = 0; i < isTypeOfResults.length; i++) { + if (isTypeOfResults[i]) { + return possibleTypes[i].name; + } + } + }); + } +}; +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ + +export const defaultFieldResolver = function ( + source, + args, + contextValue, + info, +) { + // ensure source is a value for which property access is acceptable. + if (isObjectLike(source) || typeof source === 'function') { + const property = source[info.fieldName]; + + if (typeof property === 'function') { + return source[info.fieldName](args, contextValue, info); + } + + return property; + } +}; +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ + +export function getFieldDef(schema, parentType, fieldNode) { + const fieldName = fieldNode.name.value; + + if ( + fieldName === SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return SchemaMetaFieldDef; + } else if ( + fieldName === TypeMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return TypeMetaFieldDef; + } else if (fieldName === TypeNameMetaFieldDef.name) { + return TypeNameMetaFieldDef; + } + + return parentType.getFields()[fieldName]; +} diff --git a/graphql-subscription/node_modules/graphql/execution/index.d.ts b/graphql-subscription/node_modules/graphql/execution/index.d.ts new file mode 100644 index 0000000..e9901c1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/index.d.ts @@ -0,0 +1,18 @@ +export { pathToArray as responsePathAsArray } from '../jsutils/Path'; +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, +} from './execute'; +export type { + ExecutionArgs, + ExecutionResult, + FormattedExecutionResult, +} from './execute'; +export { subscribe, createSourceEventStream } from './subscribe'; +export { + getArgumentValues, + getVariableValues, + getDirectiveValues, +} from './values'; diff --git a/graphql-subscription/node_modules/graphql/execution/index.js b/graphql-subscription/node_modules/graphql/execution/index.js new file mode 100644 index 0000000..3fef7fa --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/index.js @@ -0,0 +1,73 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'createSourceEventStream', { + enumerable: true, + get: function () { + return _subscribe.createSourceEventStream; + }, +}); +Object.defineProperty(exports, 'defaultFieldResolver', { + enumerable: true, + get: function () { + return _execute.defaultFieldResolver; + }, +}); +Object.defineProperty(exports, 'defaultTypeResolver', { + enumerable: true, + get: function () { + return _execute.defaultTypeResolver; + }, +}); +Object.defineProperty(exports, 'execute', { + enumerable: true, + get: function () { + return _execute.execute; + }, +}); +Object.defineProperty(exports, 'executeSync', { + enumerable: true, + get: function () { + return _execute.executeSync; + }, +}); +Object.defineProperty(exports, 'getArgumentValues', { + enumerable: true, + get: function () { + return _values.getArgumentValues; + }, +}); +Object.defineProperty(exports, 'getDirectiveValues', { + enumerable: true, + get: function () { + return _values.getDirectiveValues; + }, +}); +Object.defineProperty(exports, 'getVariableValues', { + enumerable: true, + get: function () { + return _values.getVariableValues; + }, +}); +Object.defineProperty(exports, 'responsePathAsArray', { + enumerable: true, + get: function () { + return _Path.pathToArray; + }, +}); +Object.defineProperty(exports, 'subscribe', { + enumerable: true, + get: function () { + return _subscribe.subscribe; + }, +}); + +var _Path = require('../jsutils/Path.js'); + +var _execute = require('./execute.js'); + +var _subscribe = require('./subscribe.js'); + +var _values = require('./values.js'); diff --git a/graphql-subscription/node_modules/graphql/execution/index.mjs b/graphql-subscription/node_modules/graphql/execution/index.mjs new file mode 100644 index 0000000..f1b9756 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/index.mjs @@ -0,0 +1,13 @@ +export { pathToArray as responsePathAsArray } from '../jsutils/Path.mjs'; +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, +} from './execute.mjs'; +export { subscribe, createSourceEventStream } from './subscribe.mjs'; +export { + getArgumentValues, + getVariableValues, + getDirectiveValues, +} from './values.mjs'; diff --git a/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.d.ts b/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.d.ts new file mode 100644 index 0000000..a0a516b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.d.ts @@ -0,0 +1,9 @@ +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +export declare function mapAsyncIterator( + iterable: AsyncGenerator | AsyncIterable, + callback: (value: T) => PromiseOrValue, +): AsyncGenerator; diff --git a/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.js b/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.js new file mode 100644 index 0000000..8fd8f94 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.js @@ -0,0 +1,68 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.mapAsyncIterator = mapAsyncIterator; + +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +function mapAsyncIterator(iterable, callback) { + const iterator = iterable[Symbol.asyncIterator](); + + async function mapResult(result) { + if (result.done) { + return result; + } + + try { + return { + value: await callback(result.value), + done: false, + }; + } catch (error) { + /* c8 ignore start */ + // FIXME: add test case + if (typeof iterator.return === 'function') { + try { + await iterator.return(); + } catch (_e) { + /* ignore error */ + } + } + + throw error; + /* c8 ignore stop */ + } + } + + return { + async next() { + return mapResult(await iterator.next()); + }, + + async return() { + // If iterator.return() does not exist, then type R must be undefined. + return typeof iterator.return === 'function' + ? mapResult(await iterator.return()) + : { + value: undefined, + done: true, + }; + }, + + async throw(error) { + if (typeof iterator.throw === 'function') { + return mapResult(await iterator.throw(error)); + } + + throw error; + }, + + [Symbol.asyncIterator]() { + return this; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.mjs b/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.mjs new file mode 100644 index 0000000..b3d3a27 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/mapAsyncIterator.mjs @@ -0,0 +1,61 @@ +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +export function mapAsyncIterator(iterable, callback) { + const iterator = iterable[Symbol.asyncIterator](); + + async function mapResult(result) { + if (result.done) { + return result; + } + + try { + return { + value: await callback(result.value), + done: false, + }; + } catch (error) { + /* c8 ignore start */ + // FIXME: add test case + if (typeof iterator.return === 'function') { + try { + await iterator.return(); + } catch (_e) { + /* ignore error */ + } + } + + throw error; + /* c8 ignore stop */ + } + } + + return { + async next() { + return mapResult(await iterator.next()); + }, + + async return() { + // If iterator.return() does not exist, then type R must be undefined. + return typeof iterator.return === 'function' + ? mapResult(await iterator.return()) + : { + value: undefined, + done: true, + }; + }, + + async throw(error) { + if (typeof iterator.throw === 'function') { + return mapResult(await iterator.throw(error)); + } + + throw error; + }, + + [Symbol.asyncIterator]() { + return this; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/execution/subscribe.d.ts b/graphql-subscription/node_modules/graphql/execution/subscribe.d.ts new file mode 100644 index 0000000..161f650 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/subscribe.d.ts @@ -0,0 +1,72 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DocumentNode } from '../language/ast'; +import type { GraphQLFieldResolver } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +import type { ExecutionArgs, ExecutionResult } from './execute'; +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ +export declare function subscribe( + args: ExecutionArgs, +): Promise | ExecutionResult>; +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ +export declare function createSourceEventStream( + args: ExecutionArgs, +): Promise | ExecutionResult>; +/** @deprecated will be removed in next major version in favor of named arguments */ +export declare function createSourceEventStream( + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: unknown, + contextValue?: unknown, + variableValues?: Maybe<{ + readonly [variable: string]: unknown; + }>, + operationName?: Maybe, + subscribeFieldResolver?: Maybe>, +): Promise | ExecutionResult>; diff --git a/graphql-subscription/node_modules/graphql/execution/subscribe.js b/graphql-subscription/node_modules/graphql/execution/subscribe.js new file mode 100644 index 0000000..e0c8012 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/subscribe.js @@ -0,0 +1,244 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.createSourceEventStream = createSourceEventStream; +exports.subscribe = subscribe; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _isAsyncIterable = require('../jsutils/isAsyncIterable.js'); + +var _Path = require('../jsutils/Path.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _locatedError = require('../error/locatedError.js'); + +var _collectFields = require('./collectFields.js'); + +var _execute = require('./execute.js'); + +var _mapAsyncIterator = require('./mapAsyncIterator.js'); + +var _values = require('./values.js'); + +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ +async function subscribe(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + (0, _devAssert.devAssert)( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const resultOrStream = await createSourceEventStream(args); + + if (!(0, _isAsyncIterable.isAsyncIterable)(resultOrStream)) { + return resultOrStream; + } // For each payload yielded from a subscription, map it over the normal + // GraphQL `execute` function, with `payload` as the rootValue. + // This implements the "MapSourceToResponseEvent" algorithm described in + // the GraphQL specification. The `execute` function provides the + // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the + // "ExecuteQuery" algorithm, for which `execute` is also used. + + const mapSourceToResponse = (payload) => + (0, _execute.execute)({ ...args, rootValue: payload }); // Map every source value to a ExecutionResult value as described above. + + return (0, _mapAsyncIterator.mapAsyncIterator)( + resultOrStream, + mapSourceToResponse, + ); +} + +function toNormalizedArgs(args) { + const firstArg = args[0]; + + if (firstArg && 'document' in firstArg) { + return firstArg; + } + + return { + schema: firstArg, + // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613 + document: args[1], + rootValue: args[2], + contextValue: args[3], + variableValues: args[4], + operationName: args[5], + subscribeFieldResolver: args[6], + }; +} +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ + +async function createSourceEventStream(...rawArgs) { + const args = toNormalizedArgs(rawArgs); + const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal + // developer mistake which should throw an early error. + + (0, _execute.assertValidExecutionArguments)(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = (0, _execute.buildExecutionContext)(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } + + try { + const eventStream = await executeSubscription(exeContext); // Assert field returned an event stream, otherwise yield an error. + + if (!(0, _isAsyncIterable.isAsyncIterable)(eventStream)) { + throw new Error( + 'Subscription field must return Async Iterable. ' + + `Received: ${(0, _inspect.inspect)(eventStream)}.`, + ); + } + + return eventStream; + } catch (error) { + // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data. + // Otherwise treat the error as a system-class error and re-throw it. + if (error instanceof _GraphQLError.GraphQLError) { + return { + errors: [error], + }; + } + + throw error; + } +} + +async function executeSubscription(exeContext) { + const { schema, fragments, operation, variableValues, rootValue } = + exeContext; + const rootType = schema.getSubscriptionType(); + + if (rootType == null) { + throw new _GraphQLError.GraphQLError( + 'Schema is not configured to execute subscription operation.', + { + nodes: operation, + }, + ); + } + + const rootFields = (0, _collectFields.collectFields)( + schema, + fragments, + variableValues, + rootType, + operation.selectionSet, + ); + const [responseName, fieldNodes] = [...rootFields.entries()][0]; + const fieldDef = (0, _execute.getFieldDef)(schema, rootType, fieldNodes[0]); + + if (!fieldDef) { + const fieldName = fieldNodes[0].name.value; + throw new _GraphQLError.GraphQLError( + `The subscription field "${fieldName}" is not defined.`, + { + nodes: fieldNodes, + }, + ); + } + + const path = (0, _Path.addPath)(undefined, responseName, rootType.name); + const info = (0, _execute.buildResolveInfo)( + exeContext, + fieldDef, + fieldNodes, + rootType, + path, + ); + + try { + var _fieldDef$subscribe; + + // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. + // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + const args = (0, _values.getArgumentValues)( + fieldDef, + fieldNodes[0], + variableValues, + ); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an + // AsyncIterable yielding raw payloads. + + const resolveFn = + (_fieldDef$subscribe = fieldDef.subscribe) !== null && + _fieldDef$subscribe !== void 0 + ? _fieldDef$subscribe + : exeContext.subscribeFieldResolver; + const eventStream = await resolveFn(rootValue, args, contextValue, info); + + if (eventStream instanceof Error) { + throw eventStream; + } + + return eventStream; + } catch (error) { + throw (0, _locatedError.locatedError)( + error, + fieldNodes, + (0, _Path.pathToArray)(path), + ); + } +} diff --git a/graphql-subscription/node_modules/graphql/execution/subscribe.mjs b/graphql-subscription/node_modules/graphql/execution/subscribe.mjs new file mode 100644 index 0000000..e0cf732 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/subscribe.mjs @@ -0,0 +1,222 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { isAsyncIterable } from '../jsutils/isAsyncIterable.mjs'; +import { addPath, pathToArray } from '../jsutils/Path.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { locatedError } from '../error/locatedError.mjs'; +import { collectFields } from './collectFields.mjs'; +import { + assertValidExecutionArguments, + buildExecutionContext, + buildResolveInfo, + execute, + getFieldDef, +} from './execute.mjs'; +import { mapAsyncIterator } from './mapAsyncIterator.mjs'; +import { getArgumentValues } from './values.mjs'; +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ + +export async function subscribe(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + devAssert( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const resultOrStream = await createSourceEventStream(args); + + if (!isAsyncIterable(resultOrStream)) { + return resultOrStream; + } // For each payload yielded from a subscription, map it over the normal + // GraphQL `execute` function, with `payload` as the rootValue. + // This implements the "MapSourceToResponseEvent" algorithm described in + // the GraphQL specification. The `execute` function provides the + // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the + // "ExecuteQuery" algorithm, for which `execute` is also used. + + const mapSourceToResponse = (payload) => + execute({ ...args, rootValue: payload }); // Map every source value to a ExecutionResult value as described above. + + return mapAsyncIterator(resultOrStream, mapSourceToResponse); +} + +function toNormalizedArgs(args) { + const firstArg = args[0]; + + if (firstArg && 'document' in firstArg) { + return firstArg; + } + + return { + schema: firstArg, + // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613 + document: args[1], + rootValue: args[2], + contextValue: args[3], + variableValues: args[4], + operationName: args[5], + subscribeFieldResolver: args[6], + }; +} +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ + +export async function createSourceEventStream(...rawArgs) { + const args = toNormalizedArgs(rawArgs); + const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal + // developer mistake which should throw an early error. + + assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + + const exeContext = buildExecutionContext(args); // Return early errors if execution context failed. + + if (!('schema' in exeContext)) { + return { + errors: exeContext, + }; + } + + try { + const eventStream = await executeSubscription(exeContext); // Assert field returned an event stream, otherwise yield an error. + + if (!isAsyncIterable(eventStream)) { + throw new Error( + 'Subscription field must return Async Iterable. ' + + `Received: ${inspect(eventStream)}.`, + ); + } + + return eventStream; + } catch (error) { + // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data. + // Otherwise treat the error as a system-class error and re-throw it. + if (error instanceof GraphQLError) { + return { + errors: [error], + }; + } + + throw error; + } +} + +async function executeSubscription(exeContext) { + const { schema, fragments, operation, variableValues, rootValue } = + exeContext; + const rootType = schema.getSubscriptionType(); + + if (rootType == null) { + throw new GraphQLError( + 'Schema is not configured to execute subscription operation.', + { + nodes: operation, + }, + ); + } + + const rootFields = collectFields( + schema, + fragments, + variableValues, + rootType, + operation.selectionSet, + ); + const [responseName, fieldNodes] = [...rootFields.entries()][0]; + const fieldDef = getFieldDef(schema, rootType, fieldNodes[0]); + + if (!fieldDef) { + const fieldName = fieldNodes[0].name.value; + throw new GraphQLError( + `The subscription field "${fieldName}" is not defined.`, + { + nodes: fieldNodes, + }, + ); + } + + const path = addPath(undefined, responseName, rootType.name); + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + rootType, + path, + ); + + try { + var _fieldDef$subscribe; + + // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. + // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + const args = getArgumentValues(fieldDef, fieldNodes[0], variableValues); // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + + const contextValue = exeContext.contextValue; // Call the `subscribe()` resolver or the default resolver to produce an + // AsyncIterable yielding raw payloads. + + const resolveFn = + (_fieldDef$subscribe = fieldDef.subscribe) !== null && + _fieldDef$subscribe !== void 0 + ? _fieldDef$subscribe + : exeContext.subscribeFieldResolver; + const eventStream = await resolveFn(rootValue, args, contextValue, info); + + if (eventStream instanceof Error) { + throw eventStream; + } + + return eventStream; + } catch (error) { + throw locatedError(error, fieldNodes, pathToArray(path)); + } +} diff --git a/graphql-subscription/node_modules/graphql/execution/values.d.ts b/graphql-subscription/node_modules/graphql/execution/values.d.ts new file mode 100644 index 0000000..6deec36 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/values.d.ts @@ -0,0 +1,79 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import { GraphQLError } from '../error/GraphQLError'; +import type { + DirectiveNode, + FieldNode, + VariableDefinitionNode, +} from '../language/ast'; +import type { GraphQLField } from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; +declare type CoercedVariableValues = + | { + errors: ReadonlyArray; + coerced?: never; + } + | { + coerced: { + [variable: string]: unknown; + }; + errors?: never; + }; +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export declare function getVariableValues( + schema: GraphQLSchema, + varDefNodes: ReadonlyArray, + inputs: { + readonly [variable: string]: unknown; + }, + options?: { + maxErrors?: number; + }, +): CoercedVariableValues; +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export declare function getArgumentValues( + def: GraphQLField | GraphQLDirective, + node: FieldNode | DirectiveNode, + variableValues?: Maybe>, +): { + [argument: string]: unknown; +}; +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export declare function getDirectiveValues( + directiveDef: GraphQLDirective, + node: { + readonly directives?: ReadonlyArray; + }, + variableValues?: Maybe>, +): + | undefined + | { + [argument: string]: unknown; + }; +export {}; diff --git a/graphql-subscription/node_modules/graphql/execution/values.js b/graphql-subscription/node_modules/graphql/execution/values.js new file mode 100644 index 0000000..97a3a83 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/values.js @@ -0,0 +1,300 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getArgumentValues = getArgumentValues; +exports.getDirectiveValues = getDirectiveValues; +exports.getVariableValues = getVariableValues; + +var _inspect = require('../jsutils/inspect.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _printPathArray = require('../jsutils/printPathArray.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('../type/definition.js'); + +var _coerceInputValue = require('../utilities/coerceInputValue.js'); + +var _typeFromAST = require('../utilities/typeFromAST.js'); + +var _valueFromAST = require('../utilities/valueFromAST.js'); + +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +function getVariableValues(schema, varDefNodes, inputs, options) { + const errors = []; + const maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors; + + try { + const coerced = coerceVariableValues( + schema, + varDefNodes, + inputs, + (error) => { + if (maxErrors != null && errors.length >= maxErrors) { + throw new _GraphQLError.GraphQLError( + 'Too many errors processing variables, error limit reached. Execution aborted.', + ); + } + + errors.push(error); + }, + ); + + if (errors.length === 0) { + return { + coerced, + }; + } + } catch (error) { + errors.push(error); + } + + return { + errors, + }; +} + +function coerceVariableValues(schema, varDefNodes, inputs, onError) { + const coercedValues = {}; + + for (const varDefNode of varDefNodes) { + const varName = varDefNode.variable.name.value; + const varType = (0, _typeFromAST.typeFromAST)(schema, varDefNode.type); + + if (!(0, _definition.isInputType)(varType)) { + // Must use input types for variables. This should be caught during + // validation, however is checked again here for safety. + const varTypeStr = (0, _printer.print)(varDefNode.type); + onError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, + { + nodes: varDefNode.type, + }, + ), + ); + continue; + } + + if (!hasOwnProperty(inputs, varName)) { + if (varDefNode.defaultValue) { + coercedValues[varName] = (0, _valueFromAST.valueFromAST)( + varDefNode.defaultValue, + varType, + ); + } else if ((0, _definition.isNonNullType)(varType)) { + const varTypeStr = (0, _inspect.inspect)(varType); + onError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, + { + nodes: varDefNode, + }, + ), + ); + } + + continue; + } + + const value = inputs[varName]; + + if (value === null && (0, _definition.isNonNullType)(varType)) { + const varTypeStr = (0, _inspect.inspect)(varType); + onError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, + { + nodes: varDefNode, + }, + ), + ); + continue; + } + + coercedValues[varName] = (0, _coerceInputValue.coerceInputValue)( + value, + varType, + (path, invalidValue, error) => { + let prefix = + `Variable "$${varName}" got invalid value ` + + (0, _inspect.inspect)(invalidValue); + + if (path.length > 0) { + prefix += ` at "${varName}${(0, _printPathArray.printPathArray)( + path, + )}"`; + } + + onError( + new _GraphQLError.GraphQLError(prefix + '; ' + error.message, { + nodes: varDefNode, + originalError: error, + }), + ); + }, + ); + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +function getArgumentValues(def, node, variableValues) { + var _node$arguments; + + const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 + ? _node$arguments + : []; + const argNodeMap = (0, _keyMap.keyMap)( + argumentNodes, + (arg) => arg.name.value, + ); + + for (const argDef of def.args) { + const name = argDef.name; + const argType = argDef.type; + const argumentNode = argNodeMap[name]; + + if (!argumentNode) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if ((0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError( + `Argument "${name}" of required type "${(0, _inspect.inspect)( + argType, + )}" ` + 'was not provided.', + { + nodes: node, + }, + ); + } + + continue; + } + + const valueNode = argumentNode.value; + let isNull = valueNode.kind === _kinds.Kind.NULL; + + if (valueNode.kind === _kinds.Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if ( + variableValues == null || + !hasOwnProperty(variableValues, variableName) + ) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if ((0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError( + `Argument "${name}" of required type "${(0, _inspect.inspect)( + argType, + )}" ` + + `was provided the variable "$${variableName}" which was not provided a runtime value.`, + { + nodes: valueNode, + }, + ); + } + + continue; + } + + isNull = variableValues[variableName] == null; + } + + if (isNull && (0, _definition.isNonNullType)(argType)) { + throw new _GraphQLError.GraphQLError( + `Argument "${name}" of non-null type "${(0, _inspect.inspect)( + argType, + )}" ` + 'must not be null.', + { + nodes: valueNode, + }, + ); + } + + const coercedValue = (0, _valueFromAST.valueFromAST)( + valueNode, + argType, + variableValues, + ); + + if (coercedValue === undefined) { + // Note: ValuesOfCorrectTypeRule validation should catch this before + // execution. This is a runtime check to ensure execution does not + // continue with an invalid argument value. + throw new _GraphQLError.GraphQLError( + `Argument "${name}" has invalid value ${(0, _printer.print)( + valueNode, + )}.`, + { + nodes: valueNode, + }, + ); + } + + coercedValues[name] = coercedValue; + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +function getDirectiveValues(directiveDef, node, variableValues) { + var _node$directives; + + const directiveNode = + (_node$directives = node.directives) === null || _node$directives === void 0 + ? void 0 + : _node$directives.find( + (directive) => directive.name.value === directiveDef.name, + ); + + if (directiveNode) { + return getArgumentValues(directiveDef, directiveNode, variableValues); + } +} + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} diff --git a/graphql-subscription/node_modules/graphql/execution/values.mjs b/graphql-subscription/node_modules/graphql/execution/values.mjs new file mode 100644 index 0000000..059f4d2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/execution/values.mjs @@ -0,0 +1,263 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { printPathArray } from '../jsutils/printPathArray.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { isInputType, isNonNullType } from '../type/definition.mjs'; +import { coerceInputValue } from '../utilities/coerceInputValue.mjs'; +import { typeFromAST } from '../utilities/typeFromAST.mjs'; +import { valueFromAST } from '../utilities/valueFromAST.mjs'; + +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export function getVariableValues(schema, varDefNodes, inputs, options) { + const errors = []; + const maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors; + + try { + const coerced = coerceVariableValues( + schema, + varDefNodes, + inputs, + (error) => { + if (maxErrors != null && errors.length >= maxErrors) { + throw new GraphQLError( + 'Too many errors processing variables, error limit reached. Execution aborted.', + ); + } + + errors.push(error); + }, + ); + + if (errors.length === 0) { + return { + coerced, + }; + } + } catch (error) { + errors.push(error); + } + + return { + errors, + }; +} + +function coerceVariableValues(schema, varDefNodes, inputs, onError) { + const coercedValues = {}; + + for (const varDefNode of varDefNodes) { + const varName = varDefNode.variable.name.value; + const varType = typeFromAST(schema, varDefNode.type); + + if (!isInputType(varType)) { + // Must use input types for variables. This should be caught during + // validation, however is checked again here for safety. + const varTypeStr = print(varDefNode.type); + onError( + new GraphQLError( + `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, + { + nodes: varDefNode.type, + }, + ), + ); + continue; + } + + if (!hasOwnProperty(inputs, varName)) { + if (varDefNode.defaultValue) { + coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType); + } else if (isNonNullType(varType)) { + const varTypeStr = inspect(varType); + onError( + new GraphQLError( + `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, + { + nodes: varDefNode, + }, + ), + ); + } + + continue; + } + + const value = inputs[varName]; + + if (value === null && isNonNullType(varType)) { + const varTypeStr = inspect(varType); + onError( + new GraphQLError( + `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, + { + nodes: varDefNode, + }, + ), + ); + continue; + } + + coercedValues[varName] = coerceInputValue( + value, + varType, + (path, invalidValue, error) => { + let prefix = + `Variable "$${varName}" got invalid value ` + inspect(invalidValue); + + if (path.length > 0) { + prefix += ` at "${varName}${printPathArray(path)}"`; + } + + onError( + new GraphQLError(prefix + '; ' + error.message, { + nodes: varDefNode, + originalError: error, + }), + ); + }, + ); + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +export function getArgumentValues(def, node, variableValues) { + var _node$arguments; + + const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_node$arguments = node.arguments) !== null && _node$arguments !== void 0 + ? _node$arguments + : []; + const argNodeMap = keyMap(argumentNodes, (arg) => arg.name.value); + + for (const argDef of def.args) { + const name = argDef.name; + const argType = argDef.type; + const argumentNode = argNodeMap[name]; + + if (!argumentNode) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if (isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of required type "${inspect(argType)}" ` + + 'was not provided.', + { + nodes: node, + }, + ); + } + + continue; + } + + const valueNode = argumentNode.value; + let isNull = valueNode.kind === Kind.NULL; + + if (valueNode.kind === Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if ( + variableValues == null || + !hasOwnProperty(variableValues, variableName) + ) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if (isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of required type "${inspect(argType)}" ` + + `was provided the variable "$${variableName}" which was not provided a runtime value.`, + { + nodes: valueNode, + }, + ); + } + + continue; + } + + isNull = variableValues[variableName] == null; + } + + if (isNull && isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of non-null type "${inspect(argType)}" ` + + 'must not be null.', + { + nodes: valueNode, + }, + ); + } + + const coercedValue = valueFromAST(valueNode, argType, variableValues); + + if (coercedValue === undefined) { + // Note: ValuesOfCorrectTypeRule validation should catch this before + // execution. This is a runtime check to ensure execution does not + // continue with an invalid argument value. + throw new GraphQLError( + `Argument "${name}" has invalid value ${print(valueNode)}.`, + { + nodes: valueNode, + }, + ); + } + + coercedValues[name] = coercedValue; + } + + return coercedValues; +} +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ + +export function getDirectiveValues(directiveDef, node, variableValues) { + var _node$directives; + + const directiveNode = + (_node$directives = node.directives) === null || _node$directives === void 0 + ? void 0 + : _node$directives.find( + (directive) => directive.name.value === directiveDef.name, + ); + + if (directiveNode) { + return getArgumentValues(directiveDef, directiveNode, variableValues); + } +} + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} diff --git a/graphql-subscription/node_modules/graphql/graphql.d.ts b/graphql-subscription/node_modules/graphql/graphql.d.ts new file mode 100644 index 0000000..8c3bf67 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/graphql.d.ts @@ -0,0 +1,67 @@ +import type { Maybe } from './jsutils/Maybe'; +import type { Source } from './language/source'; +import type { + GraphQLFieldResolver, + GraphQLTypeResolver, +} from './type/definition'; +import type { GraphQLSchema } from './type/schema'; +import type { ExecutionResult } from './execution/execute'; +/** + * This is the primary entry point function for fulfilling GraphQL operations + * by parsing, validating, and executing a GraphQL document along side a + * GraphQL schema. + * + * More sophisticated GraphQL servers, such as those which persist queries, + * may wish to separate the validation and execution phases to a static time + * tooling step, and a server runtime step. + * + * Accepts either an object with named arguments, or individual arguments: + * + * schema: + * The GraphQL type system to use when validating and executing a query. + * source: + * A GraphQL language formatted string representing the requested operation. + * rootValue: + * The value provided as the first argument to resolver functions on the top + * level type (e.g. the query object type). + * contextValue: + * The context value is provided as an argument to resolver functions after + * field arguments. It is used to pass shared information useful at any point + * during executing this query, for example the currently logged in user and + * connections to databases or other services. + * variableValues: + * A mapping of variable name to runtime value to use for all variables + * defined in the requestString. + * operationName: + * The name of the operation to use if requestString contains multiple + * possible operations. Can be omitted if requestString contains only + * one operation. + * fieldResolver: + * A resolver function to use when one is not provided by the schema. + * If not provided, the default field resolver is used (which looks for a + * value or method on the source value with the field's name). + * typeResolver: + * A type resolver function to use when none is provided by the schema. + * If not provided, the default type resolver is used (which looks for a + * `__typename` field or alternatively calls the `isTypeOf` method). + */ +export interface GraphQLArgs { + schema: GraphQLSchema; + source: string | Source; + rootValue?: unknown; + contextValue?: unknown; + variableValues?: Maybe<{ + readonly [variable: string]: unknown; + }>; + operationName?: Maybe; + fieldResolver?: Maybe>; + typeResolver?: Maybe>; +} +export declare function graphql(args: GraphQLArgs): Promise; +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ +export declare function graphqlSync(args: GraphQLArgs): ExecutionResult; diff --git a/graphql-subscription/node_modules/graphql/graphql.js b/graphql-subscription/node_modules/graphql/graphql.js new file mode 100644 index 0000000..087f3ba --- /dev/null +++ b/graphql-subscription/node_modules/graphql/graphql.js @@ -0,0 +1,96 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.graphql = graphql; +exports.graphqlSync = graphqlSync; + +var _devAssert = require('./jsutils/devAssert.js'); + +var _isPromise = require('./jsutils/isPromise.js'); + +var _parser = require('./language/parser.js'); + +var _validate = require('./type/validate.js'); + +var _validate2 = require('./validation/validate.js'); + +var _execute = require('./execution/execute.js'); + +function graphql(args) { + // Always return a Promise for a consistent API. + return new Promise((resolve) => resolve(graphqlImpl(args))); +} +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +function graphqlSync(args) { + const result = graphqlImpl(args); // Assert that the execution was synchronous. + + if ((0, _isPromise.isPromise)(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +function graphqlImpl(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + (0, _devAssert.devAssert)( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { + schema, + source, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + } = args; // Validate Schema + + const schemaValidationErrors = (0, _validate.validateSchema)(schema); + + if (schemaValidationErrors.length > 0) { + return { + errors: schemaValidationErrors, + }; + } // Parse + + let document; + + try { + document = (0, _parser.parse)(source); + } catch (syntaxError) { + return { + errors: [syntaxError], + }; + } // Validate + + const validationErrors = (0, _validate2.validate)(schema, document); + + if (validationErrors.length > 0) { + return { + errors: validationErrors, + }; + } // Execute + + return (0, _execute.execute)({ + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + }); +} diff --git a/graphql-subscription/node_modules/graphql/graphql.mjs b/graphql-subscription/node_modules/graphql/graphql.mjs new file mode 100644 index 0000000..c8cfdbc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/graphql.mjs @@ -0,0 +1,122 @@ +import { devAssert } from './jsutils/devAssert.mjs'; +import { isPromise } from './jsutils/isPromise.mjs'; +import { parse } from './language/parser.mjs'; +import { validateSchema } from './type/validate.mjs'; +import { validate } from './validation/validate.mjs'; +import { execute } from './execution/execute.mjs'; +/** + * This is the primary entry point function for fulfilling GraphQL operations + * by parsing, validating, and executing a GraphQL document along side a + * GraphQL schema. + * + * More sophisticated GraphQL servers, such as those which persist queries, + * may wish to separate the validation and execution phases to a static time + * tooling step, and a server runtime step. + * + * Accepts either an object with named arguments, or individual arguments: + * + * schema: + * The GraphQL type system to use when validating and executing a query. + * source: + * A GraphQL language formatted string representing the requested operation. + * rootValue: + * The value provided as the first argument to resolver functions on the top + * level type (e.g. the query object type). + * contextValue: + * The context value is provided as an argument to resolver functions after + * field arguments. It is used to pass shared information useful at any point + * during executing this query, for example the currently logged in user and + * connections to databases or other services. + * variableValues: + * A mapping of variable name to runtime value to use for all variables + * defined in the requestString. + * operationName: + * The name of the operation to use if requestString contains multiple + * possible operations. Can be omitted if requestString contains only + * one operation. + * fieldResolver: + * A resolver function to use when one is not provided by the schema. + * If not provided, the default field resolver is used (which looks for a + * value or method on the source value with the field's name). + * typeResolver: + * A type resolver function to use when none is provided by the schema. + * If not provided, the default type resolver is used (which looks for a + * `__typename` field or alternatively calls the `isTypeOf` method). + */ + +export function graphql(args) { + // Always return a Promise for a consistent API. + return new Promise((resolve) => resolve(graphqlImpl(args))); +} +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ + +export function graphqlSync(args) { + const result = graphqlImpl(args); // Assert that the execution was synchronous. + + if (isPromise(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +function graphqlImpl(args) { + // Temporary for v15 to v16 migration. Remove in v17 + arguments.length < 2 || + devAssert( + false, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const { + schema, + source, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + } = args; // Validate Schema + + const schemaValidationErrors = validateSchema(schema); + + if (schemaValidationErrors.length > 0) { + return { + errors: schemaValidationErrors, + }; + } // Parse + + let document; + + try { + document = parse(source); + } catch (syntaxError) { + return { + errors: [syntaxError], + }; + } // Validate + + const validationErrors = validate(schema, document); + + if (validationErrors.length > 0) { + return { + errors: validationErrors, + }; + } // Execute + + return execute({ + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + }); +} diff --git a/graphql-subscription/node_modules/graphql/index.d.ts b/graphql-subscription/node_modules/graphql/index.d.ts new file mode 100644 index 0000000..2b7e702 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/index.d.ts @@ -0,0 +1,413 @@ +/** + * GraphQL.js provides a reference implementation for the GraphQL specification + * but is also a useful utility for operating on GraphQL files and building + * sophisticated tools. + * + * This primary module exports a general purpose function for fulfilling all + * steps of the GraphQL specification in a single operation, but also includes + * utilities for every part of the GraphQL specification: + * + * - Parsing the GraphQL language. + * - Building a GraphQL type schema. + * - Validating a GraphQL request against a type schema. + * - Executing a GraphQL request against a type schema. + * + * This also includes utility functions for operating on GraphQL types and + * GraphQL documents to facilitate building tools. + * + * You may also import from each sub-directory directly. For example, the + * following two import statements are equivalent: + * + * ```ts + * import { parse } from 'graphql'; + * import { parse } from 'graphql/language'; + * ``` + * + * @packageDocumentation + */ +export { version, versionInfo } from './version'; +export type { GraphQLArgs } from './graphql'; +export { graphql, graphqlSync } from './graphql'; +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, + GraphQLSchema, + GraphQLDirective, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, + TypeKind, + DEFAULT_DEPRECATION_REASON, + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, + isSchema, + isDirective, + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + isSpecifiedScalarType, + isIntrospectionType, + isSpecifiedDirective, + assertSchema, + assertDirective, + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, + getNullableType, + getNamedType, + validateSchema, + assertValidSchema, + assertName, + assertEnumValueName, +} from './type/index'; +export type { + GraphQLType, + GraphQLInputType, + GraphQLOutputType, + GraphQLLeafType, + GraphQLCompositeType, + GraphQLAbstractType, + GraphQLWrappingType, + GraphQLNullableType, + GraphQLNamedType, + GraphQLNamedInputType, + GraphQLNamedOutputType, + ThunkReadonlyArray, + ThunkObjMap, + GraphQLSchemaConfig, + GraphQLSchemaExtensions, + GraphQLDirectiveConfig, + GraphQLDirectiveExtensions, + GraphQLArgument, + GraphQLArgumentConfig, + GraphQLArgumentExtensions, + GraphQLEnumTypeConfig, + GraphQLEnumTypeExtensions, + GraphQLEnumValue, + GraphQLEnumValueConfig, + GraphQLEnumValueConfigMap, + GraphQLEnumValueExtensions, + GraphQLField, + GraphQLFieldConfig, + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLFieldExtensions, + GraphQLFieldMap, + GraphQLFieldResolver, + GraphQLInputField, + GraphQLInputFieldConfig, + GraphQLInputFieldConfigMap, + GraphQLInputFieldExtensions, + GraphQLInputFieldMap, + GraphQLInputObjectTypeConfig, + GraphQLInputObjectTypeExtensions, + GraphQLInterfaceTypeConfig, + GraphQLInterfaceTypeExtensions, + GraphQLIsTypeOfFn, + GraphQLObjectTypeConfig, + GraphQLObjectTypeExtensions, + GraphQLResolveInfo, + ResponsePath, + GraphQLScalarTypeConfig, + GraphQLScalarTypeExtensions, + GraphQLTypeResolver, + GraphQLUnionTypeConfig, + GraphQLUnionTypeExtensions, + GraphQLScalarSerializer, + GraphQLScalarValueParser, + GraphQLScalarLiteralParser, +} from './type/index'; +export { + Token, + Source, + Location, + OperationTypeNode, + getLocation, + printLocation, + printSourceLocation, + Lexer, + TokenKind, + parse, + parseValue, + parseConstValue, + parseType, + print, + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, + Kind, + DirectiveLocation, + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './language/index'; +export type { + ParseOptions, + SourceLocation, + TokenKindEnum, + KindEnum, + DirectiveLocationEnum, + ASTVisitor, + ASTVisitFn, + ASTVisitorKeyMap, + ASTNode, + ASTKindToNode, + NameNode, + DocumentNode, + DefinitionNode, + ExecutableDefinitionNode, + OperationDefinitionNode, + VariableDefinitionNode, + VariableNode, + SelectionSetNode, + SelectionNode, + FieldNode, + ArgumentNode, + ConstArgumentNode, + FragmentSpreadNode, + InlineFragmentNode, + FragmentDefinitionNode, + ValueNode, + ConstValueNode, + IntValueNode, + FloatValueNode, + StringValueNode, + BooleanValueNode, + NullValueNode, + EnumValueNode, + ListValueNode, + ConstListValueNode, + ObjectValueNode, + ConstObjectValueNode, + ObjectFieldNode, + ConstObjectFieldNode, + DirectiveNode, + ConstDirectiveNode, + TypeNode, + NamedTypeNode, + ListTypeNode, + NonNullTypeNode, + TypeSystemDefinitionNode, + SchemaDefinitionNode, + OperationTypeDefinitionNode, + TypeDefinitionNode, + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + DirectiveDefinitionNode, + TypeSystemExtensionNode, + SchemaExtensionNode, + TypeExtensionNode, + ScalarTypeExtensionNode, + ObjectTypeExtensionNode, + InterfaceTypeExtensionNode, + UnionTypeExtensionNode, + EnumTypeExtensionNode, + InputObjectTypeExtensionNode, +} from './language/index'; +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, + responsePathAsArray, + getArgumentValues, + getVariableValues, + getDirectiveValues, + subscribe, + createSourceEventStream, +} from './execution/index'; +export type { + ExecutionArgs, + ExecutionResult, + FormattedExecutionResult, +} from './execution/index'; +export type { SubscriptionArgs } from './subscription/index'; +export { + validate, + ValidationContext, + specifiedRules, + ExecutableDefinitionsRule, + FieldsOnCorrectTypeRule, + FragmentsOnCompositeTypesRule, + KnownArgumentNamesRule, + KnownDirectivesRule, + KnownFragmentNamesRule, + KnownTypeNamesRule, + LoneAnonymousOperationRule, + NoFragmentCyclesRule, + NoUndefinedVariablesRule, + NoUnusedFragmentsRule, + NoUnusedVariablesRule, + OverlappingFieldsCanBeMergedRule, + PossibleFragmentSpreadsRule, + ProvidedRequiredArgumentsRule, + ScalarLeafsRule, + SingleFieldSubscriptionsRule, + UniqueArgumentNamesRule, + UniqueDirectivesPerLocationRule, + UniqueFragmentNamesRule, + UniqueInputFieldNamesRule, + UniqueOperationNamesRule, + UniqueVariableNamesRule, + ValuesOfCorrectTypeRule, + VariablesAreInputTypesRule, + VariablesInAllowedPositionRule, + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + PossibleTypeExtensionsRule, + NoDeprecatedCustomRule, + NoSchemaIntrospectionCustomRule, +} from './validation/index'; +export type { ValidationRule } from './validation/index'; +export { + GraphQLError, + syntaxError, + locatedError, + printError, + formatError, +} from './error/index'; +export type { + GraphQLErrorOptions, + GraphQLFormattedError, + GraphQLErrorExtensions, +} from './error/index'; +export { + getIntrospectionQuery, + getOperationAST, + getOperationRootType, + introspectionFromSchema, + buildClientSchema, + buildASTSchema, + buildSchema, + extendSchema, + lexicographicSortSchema, + printSchema, + printType, + printIntrospectionSchema, + typeFromAST, + valueFromAST, + valueFromASTUntyped, + astFromValue, + TypeInfo, + visitWithTypeInfo, + coerceInputValue, + concatAST, + separateOperations, + stripIgnoredCharacters, + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, + assertValidName, + isValidNameError, + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './utilities/index'; +export type { + IntrospectionOptions, + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionInputType, + IntrospectionOutputType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionInputTypeRef, + IntrospectionOutputTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, + BuildSchemaOptions, + BreakingChange, + DangerousChange, + TypedQueryDocumentNode, +} from './utilities/index'; diff --git a/graphql-subscription/node_modules/graphql/index.js b/graphql-subscription/node_modules/graphql/index.js new file mode 100644 index 0000000..153e908 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/index.js @@ -0,0 +1,1269 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'BREAK', { + enumerable: true, + get: function () { + return _index2.BREAK; + }, +}); +Object.defineProperty(exports, 'BreakingChangeType', { + enumerable: true, + get: function () { + return _index6.BreakingChangeType; + }, +}); +Object.defineProperty(exports, 'DEFAULT_DEPRECATION_REASON', { + enumerable: true, + get: function () { + return _index.DEFAULT_DEPRECATION_REASON; + }, +}); +Object.defineProperty(exports, 'DangerousChangeType', { + enumerable: true, + get: function () { + return _index6.DangerousChangeType; + }, +}); +Object.defineProperty(exports, 'DirectiveLocation', { + enumerable: true, + get: function () { + return _index2.DirectiveLocation; + }, +}); +Object.defineProperty(exports, 'ExecutableDefinitionsRule', { + enumerable: true, + get: function () { + return _index4.ExecutableDefinitionsRule; + }, +}); +Object.defineProperty(exports, 'FieldsOnCorrectTypeRule', { + enumerable: true, + get: function () { + return _index4.FieldsOnCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'FragmentsOnCompositeTypesRule', { + enumerable: true, + get: function () { + return _index4.FragmentsOnCompositeTypesRule; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MAX_INT', { + enumerable: true, + get: function () { + return _index.GRAPHQL_MAX_INT; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MIN_INT', { + enumerable: true, + get: function () { + return _index.GRAPHQL_MIN_INT; + }, +}); +Object.defineProperty(exports, 'GraphQLBoolean', { + enumerable: true, + get: function () { + return _index.GraphQLBoolean; + }, +}); +Object.defineProperty(exports, 'GraphQLDeprecatedDirective', { + enumerable: true, + get: function () { + return _index.GraphQLDeprecatedDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLDirective', { + enumerable: true, + get: function () { + return _index.GraphQLDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLEnumType', { + enumerable: true, + get: function () { + return _index.GraphQLEnumType; + }, +}); +Object.defineProperty(exports, 'GraphQLError', { + enumerable: true, + get: function () { + return _index5.GraphQLError; + }, +}); +Object.defineProperty(exports, 'GraphQLFloat', { + enumerable: true, + get: function () { + return _index.GraphQLFloat; + }, +}); +Object.defineProperty(exports, 'GraphQLID', { + enumerable: true, + get: function () { + return _index.GraphQLID; + }, +}); +Object.defineProperty(exports, 'GraphQLIncludeDirective', { + enumerable: true, + get: function () { + return _index.GraphQLIncludeDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLInputObjectType', { + enumerable: true, + get: function () { + return _index.GraphQLInputObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLInt', { + enumerable: true, + get: function () { + return _index.GraphQLInt; + }, +}); +Object.defineProperty(exports, 'GraphQLInterfaceType', { + enumerable: true, + get: function () { + return _index.GraphQLInterfaceType; + }, +}); +Object.defineProperty(exports, 'GraphQLList', { + enumerable: true, + get: function () { + return _index.GraphQLList; + }, +}); +Object.defineProperty(exports, 'GraphQLNonNull', { + enumerable: true, + get: function () { + return _index.GraphQLNonNull; + }, +}); +Object.defineProperty(exports, 'GraphQLObjectType', { + enumerable: true, + get: function () { + return _index.GraphQLObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLScalarType', { + enumerable: true, + get: function () { + return _index.GraphQLScalarType; + }, +}); +Object.defineProperty(exports, 'GraphQLSchema', { + enumerable: true, + get: function () { + return _index.GraphQLSchema; + }, +}); +Object.defineProperty(exports, 'GraphQLSkipDirective', { + enumerable: true, + get: function () { + return _index.GraphQLSkipDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLSpecifiedByDirective', { + enumerable: true, + get: function () { + return _index.GraphQLSpecifiedByDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLString', { + enumerable: true, + get: function () { + return _index.GraphQLString; + }, +}); +Object.defineProperty(exports, 'GraphQLUnionType', { + enumerable: true, + get: function () { + return _index.GraphQLUnionType; + }, +}); +Object.defineProperty(exports, 'Kind', { + enumerable: true, + get: function () { + return _index2.Kind; + }, +}); +Object.defineProperty(exports, 'KnownArgumentNamesRule', { + enumerable: true, + get: function () { + return _index4.KnownArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownDirectivesRule', { + enumerable: true, + get: function () { + return _index4.KnownDirectivesRule; + }, +}); +Object.defineProperty(exports, 'KnownFragmentNamesRule', { + enumerable: true, + get: function () { + return _index4.KnownFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownTypeNamesRule', { + enumerable: true, + get: function () { + return _index4.KnownTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'Lexer', { + enumerable: true, + get: function () { + return _index2.Lexer; + }, +}); +Object.defineProperty(exports, 'Location', { + enumerable: true, + get: function () { + return _index2.Location; + }, +}); +Object.defineProperty(exports, 'LoneAnonymousOperationRule', { + enumerable: true, + get: function () { + return _index4.LoneAnonymousOperationRule; + }, +}); +Object.defineProperty(exports, 'LoneSchemaDefinitionRule', { + enumerable: true, + get: function () { + return _index4.LoneSchemaDefinitionRule; + }, +}); +Object.defineProperty(exports, 'NoDeprecatedCustomRule', { + enumerable: true, + get: function () { + return _index4.NoDeprecatedCustomRule; + }, +}); +Object.defineProperty(exports, 'NoFragmentCyclesRule', { + enumerable: true, + get: function () { + return _index4.NoFragmentCyclesRule; + }, +}); +Object.defineProperty(exports, 'NoSchemaIntrospectionCustomRule', { + enumerable: true, + get: function () { + return _index4.NoSchemaIntrospectionCustomRule; + }, +}); +Object.defineProperty(exports, 'NoUndefinedVariablesRule', { + enumerable: true, + get: function () { + return _index4.NoUndefinedVariablesRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedFragmentsRule', { + enumerable: true, + get: function () { + return _index4.NoUnusedFragmentsRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedVariablesRule', { + enumerable: true, + get: function () { + return _index4.NoUnusedVariablesRule; + }, +}); +Object.defineProperty(exports, 'OperationTypeNode', { + enumerable: true, + get: function () { + return _index2.OperationTypeNode; + }, +}); +Object.defineProperty(exports, 'OverlappingFieldsCanBeMergedRule', { + enumerable: true, + get: function () { + return _index4.OverlappingFieldsCanBeMergedRule; + }, +}); +Object.defineProperty(exports, 'PossibleFragmentSpreadsRule', { + enumerable: true, + get: function () { + return _index4.PossibleFragmentSpreadsRule; + }, +}); +Object.defineProperty(exports, 'PossibleTypeExtensionsRule', { + enumerable: true, + get: function () { + return _index4.PossibleTypeExtensionsRule; + }, +}); +Object.defineProperty(exports, 'ProvidedRequiredArgumentsRule', { + enumerable: true, + get: function () { + return _index4.ProvidedRequiredArgumentsRule; + }, +}); +Object.defineProperty(exports, 'ScalarLeafsRule', { + enumerable: true, + get: function () { + return _index4.ScalarLeafsRule; + }, +}); +Object.defineProperty(exports, 'SchemaMetaFieldDef', { + enumerable: true, + get: function () { + return _index.SchemaMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'SingleFieldSubscriptionsRule', { + enumerable: true, + get: function () { + return _index4.SingleFieldSubscriptionsRule; + }, +}); +Object.defineProperty(exports, 'Source', { + enumerable: true, + get: function () { + return _index2.Source; + }, +}); +Object.defineProperty(exports, 'Token', { + enumerable: true, + get: function () { + return _index2.Token; + }, +}); +Object.defineProperty(exports, 'TokenKind', { + enumerable: true, + get: function () { + return _index2.TokenKind; + }, +}); +Object.defineProperty(exports, 'TypeInfo', { + enumerable: true, + get: function () { + return _index6.TypeInfo; + }, +}); +Object.defineProperty(exports, 'TypeKind', { + enumerable: true, + get: function () { + return _index.TypeKind; + }, +}); +Object.defineProperty(exports, 'TypeMetaFieldDef', { + enumerable: true, + get: function () { + return _index.TypeMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'TypeNameMetaFieldDef', { + enumerable: true, + get: function () { + return _index.TypeNameMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentDefinitionNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueArgumentDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectiveNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueDirectiveNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectivesPerLocationRule', { + enumerable: true, + get: function () { + return _index4.UniqueDirectivesPerLocationRule; + }, +}); +Object.defineProperty(exports, 'UniqueEnumValueNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueEnumValueNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFieldDefinitionNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueFieldDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFragmentNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueInputFieldNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueInputFieldNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueOperationNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationTypesRule', { + enumerable: true, + get: function () { + return _index4.UniqueOperationTypesRule; + }, +}); +Object.defineProperty(exports, 'UniqueTypeNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueVariableNamesRule', { + enumerable: true, + get: function () { + return _index4.UniqueVariableNamesRule; + }, +}); +Object.defineProperty(exports, 'ValidationContext', { + enumerable: true, + get: function () { + return _index4.ValidationContext; + }, +}); +Object.defineProperty(exports, 'ValuesOfCorrectTypeRule', { + enumerable: true, + get: function () { + return _index4.ValuesOfCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'VariablesAreInputTypesRule', { + enumerable: true, + get: function () { + return _index4.VariablesAreInputTypesRule; + }, +}); +Object.defineProperty(exports, 'VariablesInAllowedPositionRule', { + enumerable: true, + get: function () { + return _index4.VariablesInAllowedPositionRule; + }, +}); +Object.defineProperty(exports, '__Directive', { + enumerable: true, + get: function () { + return _index.__Directive; + }, +}); +Object.defineProperty(exports, '__DirectiveLocation', { + enumerable: true, + get: function () { + return _index.__DirectiveLocation; + }, +}); +Object.defineProperty(exports, '__EnumValue', { + enumerable: true, + get: function () { + return _index.__EnumValue; + }, +}); +Object.defineProperty(exports, '__Field', { + enumerable: true, + get: function () { + return _index.__Field; + }, +}); +Object.defineProperty(exports, '__InputValue', { + enumerable: true, + get: function () { + return _index.__InputValue; + }, +}); +Object.defineProperty(exports, '__Schema', { + enumerable: true, + get: function () { + return _index.__Schema; + }, +}); +Object.defineProperty(exports, '__Type', { + enumerable: true, + get: function () { + return _index.__Type; + }, +}); +Object.defineProperty(exports, '__TypeKind', { + enumerable: true, + get: function () { + return _index.__TypeKind; + }, +}); +Object.defineProperty(exports, 'assertAbstractType', { + enumerable: true, + get: function () { + return _index.assertAbstractType; + }, +}); +Object.defineProperty(exports, 'assertCompositeType', { + enumerable: true, + get: function () { + return _index.assertCompositeType; + }, +}); +Object.defineProperty(exports, 'assertDirective', { + enumerable: true, + get: function () { + return _index.assertDirective; + }, +}); +Object.defineProperty(exports, 'assertEnumType', { + enumerable: true, + get: function () { + return _index.assertEnumType; + }, +}); +Object.defineProperty(exports, 'assertEnumValueName', { + enumerable: true, + get: function () { + return _index.assertEnumValueName; + }, +}); +Object.defineProperty(exports, 'assertInputObjectType', { + enumerable: true, + get: function () { + return _index.assertInputObjectType; + }, +}); +Object.defineProperty(exports, 'assertInputType', { + enumerable: true, + get: function () { + return _index.assertInputType; + }, +}); +Object.defineProperty(exports, 'assertInterfaceType', { + enumerable: true, + get: function () { + return _index.assertInterfaceType; + }, +}); +Object.defineProperty(exports, 'assertLeafType', { + enumerable: true, + get: function () { + return _index.assertLeafType; + }, +}); +Object.defineProperty(exports, 'assertListType', { + enumerable: true, + get: function () { + return _index.assertListType; + }, +}); +Object.defineProperty(exports, 'assertName', { + enumerable: true, + get: function () { + return _index.assertName; + }, +}); +Object.defineProperty(exports, 'assertNamedType', { + enumerable: true, + get: function () { + return _index.assertNamedType; + }, +}); +Object.defineProperty(exports, 'assertNonNullType', { + enumerable: true, + get: function () { + return _index.assertNonNullType; + }, +}); +Object.defineProperty(exports, 'assertNullableType', { + enumerable: true, + get: function () { + return _index.assertNullableType; + }, +}); +Object.defineProperty(exports, 'assertObjectType', { + enumerable: true, + get: function () { + return _index.assertObjectType; + }, +}); +Object.defineProperty(exports, 'assertOutputType', { + enumerable: true, + get: function () { + return _index.assertOutputType; + }, +}); +Object.defineProperty(exports, 'assertScalarType', { + enumerable: true, + get: function () { + return _index.assertScalarType; + }, +}); +Object.defineProperty(exports, 'assertSchema', { + enumerable: true, + get: function () { + return _index.assertSchema; + }, +}); +Object.defineProperty(exports, 'assertType', { + enumerable: true, + get: function () { + return _index.assertType; + }, +}); +Object.defineProperty(exports, 'assertUnionType', { + enumerable: true, + get: function () { + return _index.assertUnionType; + }, +}); +Object.defineProperty(exports, 'assertValidName', { + enumerable: true, + get: function () { + return _index6.assertValidName; + }, +}); +Object.defineProperty(exports, 'assertValidSchema', { + enumerable: true, + get: function () { + return _index.assertValidSchema; + }, +}); +Object.defineProperty(exports, 'assertWrappingType', { + enumerable: true, + get: function () { + return _index.assertWrappingType; + }, +}); +Object.defineProperty(exports, 'astFromValue', { + enumerable: true, + get: function () { + return _index6.astFromValue; + }, +}); +Object.defineProperty(exports, 'buildASTSchema', { + enumerable: true, + get: function () { + return _index6.buildASTSchema; + }, +}); +Object.defineProperty(exports, 'buildClientSchema', { + enumerable: true, + get: function () { + return _index6.buildClientSchema; + }, +}); +Object.defineProperty(exports, 'buildSchema', { + enumerable: true, + get: function () { + return _index6.buildSchema; + }, +}); +Object.defineProperty(exports, 'coerceInputValue', { + enumerable: true, + get: function () { + return _index6.coerceInputValue; + }, +}); +Object.defineProperty(exports, 'concatAST', { + enumerable: true, + get: function () { + return _index6.concatAST; + }, +}); +Object.defineProperty(exports, 'createSourceEventStream', { + enumerable: true, + get: function () { + return _index3.createSourceEventStream; + }, +}); +Object.defineProperty(exports, 'defaultFieldResolver', { + enumerable: true, + get: function () { + return _index3.defaultFieldResolver; + }, +}); +Object.defineProperty(exports, 'defaultTypeResolver', { + enumerable: true, + get: function () { + return _index3.defaultTypeResolver; + }, +}); +Object.defineProperty(exports, 'doTypesOverlap', { + enumerable: true, + get: function () { + return _index6.doTypesOverlap; + }, +}); +Object.defineProperty(exports, 'execute', { + enumerable: true, + get: function () { + return _index3.execute; + }, +}); +Object.defineProperty(exports, 'executeSync', { + enumerable: true, + get: function () { + return _index3.executeSync; + }, +}); +Object.defineProperty(exports, 'extendSchema', { + enumerable: true, + get: function () { + return _index6.extendSchema; + }, +}); +Object.defineProperty(exports, 'findBreakingChanges', { + enumerable: true, + get: function () { + return _index6.findBreakingChanges; + }, +}); +Object.defineProperty(exports, 'findDangerousChanges', { + enumerable: true, + get: function () { + return _index6.findDangerousChanges; + }, +}); +Object.defineProperty(exports, 'formatError', { + enumerable: true, + get: function () { + return _index5.formatError; + }, +}); +Object.defineProperty(exports, 'getArgumentValues', { + enumerable: true, + get: function () { + return _index3.getArgumentValues; + }, +}); +Object.defineProperty(exports, 'getDirectiveValues', { + enumerable: true, + get: function () { + return _index3.getDirectiveValues; + }, +}); +Object.defineProperty(exports, 'getEnterLeaveForKind', { + enumerable: true, + get: function () { + return _index2.getEnterLeaveForKind; + }, +}); +Object.defineProperty(exports, 'getIntrospectionQuery', { + enumerable: true, + get: function () { + return _index6.getIntrospectionQuery; + }, +}); +Object.defineProperty(exports, 'getLocation', { + enumerable: true, + get: function () { + return _index2.getLocation; + }, +}); +Object.defineProperty(exports, 'getNamedType', { + enumerable: true, + get: function () { + return _index.getNamedType; + }, +}); +Object.defineProperty(exports, 'getNullableType', { + enumerable: true, + get: function () { + return _index.getNullableType; + }, +}); +Object.defineProperty(exports, 'getOperationAST', { + enumerable: true, + get: function () { + return _index6.getOperationAST; + }, +}); +Object.defineProperty(exports, 'getOperationRootType', { + enumerable: true, + get: function () { + return _index6.getOperationRootType; + }, +}); +Object.defineProperty(exports, 'getVariableValues', { + enumerable: true, + get: function () { + return _index3.getVariableValues; + }, +}); +Object.defineProperty(exports, 'getVisitFn', { + enumerable: true, + get: function () { + return _index2.getVisitFn; + }, +}); +Object.defineProperty(exports, 'graphql', { + enumerable: true, + get: function () { + return _graphql.graphql; + }, +}); +Object.defineProperty(exports, 'graphqlSync', { + enumerable: true, + get: function () { + return _graphql.graphqlSync; + }, +}); +Object.defineProperty(exports, 'introspectionFromSchema', { + enumerable: true, + get: function () { + return _index6.introspectionFromSchema; + }, +}); +Object.defineProperty(exports, 'introspectionTypes', { + enumerable: true, + get: function () { + return _index.introspectionTypes; + }, +}); +Object.defineProperty(exports, 'isAbstractType', { + enumerable: true, + get: function () { + return _index.isAbstractType; + }, +}); +Object.defineProperty(exports, 'isCompositeType', { + enumerable: true, + get: function () { + return _index.isCompositeType; + }, +}); +Object.defineProperty(exports, 'isConstValueNode', { + enumerable: true, + get: function () { + return _index2.isConstValueNode; + }, +}); +Object.defineProperty(exports, 'isDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isDirective', { + enumerable: true, + get: function () { + return _index.isDirective; + }, +}); +Object.defineProperty(exports, 'isEnumType', { + enumerable: true, + get: function () { + return _index.isEnumType; + }, +}); +Object.defineProperty(exports, 'isEqualType', { + enumerable: true, + get: function () { + return _index6.isEqualType; + }, +}); +Object.defineProperty(exports, 'isExecutableDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isExecutableDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isInputObjectType', { + enumerable: true, + get: function () { + return _index.isInputObjectType; + }, +}); +Object.defineProperty(exports, 'isInputType', { + enumerable: true, + get: function () { + return _index.isInputType; + }, +}); +Object.defineProperty(exports, 'isInterfaceType', { + enumerable: true, + get: function () { + return _index.isInterfaceType; + }, +}); +Object.defineProperty(exports, 'isIntrospectionType', { + enumerable: true, + get: function () { + return _index.isIntrospectionType; + }, +}); +Object.defineProperty(exports, 'isLeafType', { + enumerable: true, + get: function () { + return _index.isLeafType; + }, +}); +Object.defineProperty(exports, 'isListType', { + enumerable: true, + get: function () { + return _index.isListType; + }, +}); +Object.defineProperty(exports, 'isNamedType', { + enumerable: true, + get: function () { + return _index.isNamedType; + }, +}); +Object.defineProperty(exports, 'isNonNullType', { + enumerable: true, + get: function () { + return _index.isNonNullType; + }, +}); +Object.defineProperty(exports, 'isNullableType', { + enumerable: true, + get: function () { + return _index.isNullableType; + }, +}); +Object.defineProperty(exports, 'isObjectType', { + enumerable: true, + get: function () { + return _index.isObjectType; + }, +}); +Object.defineProperty(exports, 'isOutputType', { + enumerable: true, + get: function () { + return _index.isOutputType; + }, +}); +Object.defineProperty(exports, 'isRequiredArgument', { + enumerable: true, + get: function () { + return _index.isRequiredArgument; + }, +}); +Object.defineProperty(exports, 'isRequiredInputField', { + enumerable: true, + get: function () { + return _index.isRequiredInputField; + }, +}); +Object.defineProperty(exports, 'isScalarType', { + enumerable: true, + get: function () { + return _index.isScalarType; + }, +}); +Object.defineProperty(exports, 'isSchema', { + enumerable: true, + get: function () { + return _index.isSchema; + }, +}); +Object.defineProperty(exports, 'isSelectionNode', { + enumerable: true, + get: function () { + return _index2.isSelectionNode; + }, +}); +Object.defineProperty(exports, 'isSpecifiedDirective', { + enumerable: true, + get: function () { + return _index.isSpecifiedDirective; + }, +}); +Object.defineProperty(exports, 'isSpecifiedScalarType', { + enumerable: true, + get: function () { + return _index.isSpecifiedScalarType; + }, +}); +Object.defineProperty(exports, 'isType', { + enumerable: true, + get: function () { + return _index.isType; + }, +}); +Object.defineProperty(exports, 'isTypeDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isTypeDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeExtensionNode', { + enumerable: true, + get: function () { + return _index2.isTypeExtensionNode; + }, +}); +Object.defineProperty(exports, 'isTypeNode', { + enumerable: true, + get: function () { + return _index2.isTypeNode; + }, +}); +Object.defineProperty(exports, 'isTypeSubTypeOf', { + enumerable: true, + get: function () { + return _index6.isTypeSubTypeOf; + }, +}); +Object.defineProperty(exports, 'isTypeSystemDefinitionNode', { + enumerable: true, + get: function () { + return _index2.isTypeSystemDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeSystemExtensionNode', { + enumerable: true, + get: function () { + return _index2.isTypeSystemExtensionNode; + }, +}); +Object.defineProperty(exports, 'isUnionType', { + enumerable: true, + get: function () { + return _index.isUnionType; + }, +}); +Object.defineProperty(exports, 'isValidNameError', { + enumerable: true, + get: function () { + return _index6.isValidNameError; + }, +}); +Object.defineProperty(exports, 'isValueNode', { + enumerable: true, + get: function () { + return _index2.isValueNode; + }, +}); +Object.defineProperty(exports, 'isWrappingType', { + enumerable: true, + get: function () { + return _index.isWrappingType; + }, +}); +Object.defineProperty(exports, 'lexicographicSortSchema', { + enumerable: true, + get: function () { + return _index6.lexicographicSortSchema; + }, +}); +Object.defineProperty(exports, 'locatedError', { + enumerable: true, + get: function () { + return _index5.locatedError; + }, +}); +Object.defineProperty(exports, 'parse', { + enumerable: true, + get: function () { + return _index2.parse; + }, +}); +Object.defineProperty(exports, 'parseConstValue', { + enumerable: true, + get: function () { + return _index2.parseConstValue; + }, +}); +Object.defineProperty(exports, 'parseType', { + enumerable: true, + get: function () { + return _index2.parseType; + }, +}); +Object.defineProperty(exports, 'parseValue', { + enumerable: true, + get: function () { + return _index2.parseValue; + }, +}); +Object.defineProperty(exports, 'print', { + enumerable: true, + get: function () { + return _index2.print; + }, +}); +Object.defineProperty(exports, 'printError', { + enumerable: true, + get: function () { + return _index5.printError; + }, +}); +Object.defineProperty(exports, 'printIntrospectionSchema', { + enumerable: true, + get: function () { + return _index6.printIntrospectionSchema; + }, +}); +Object.defineProperty(exports, 'printLocation', { + enumerable: true, + get: function () { + return _index2.printLocation; + }, +}); +Object.defineProperty(exports, 'printSchema', { + enumerable: true, + get: function () { + return _index6.printSchema; + }, +}); +Object.defineProperty(exports, 'printSourceLocation', { + enumerable: true, + get: function () { + return _index2.printSourceLocation; + }, +}); +Object.defineProperty(exports, 'printType', { + enumerable: true, + get: function () { + return _index6.printType; + }, +}); +Object.defineProperty(exports, 'resolveObjMapThunk', { + enumerable: true, + get: function () { + return _index.resolveObjMapThunk; + }, +}); +Object.defineProperty(exports, 'resolveReadonlyArrayThunk', { + enumerable: true, + get: function () { + return _index.resolveReadonlyArrayThunk; + }, +}); +Object.defineProperty(exports, 'responsePathAsArray', { + enumerable: true, + get: function () { + return _index3.responsePathAsArray; + }, +}); +Object.defineProperty(exports, 'separateOperations', { + enumerable: true, + get: function () { + return _index6.separateOperations; + }, +}); +Object.defineProperty(exports, 'specifiedDirectives', { + enumerable: true, + get: function () { + return _index.specifiedDirectives; + }, +}); +Object.defineProperty(exports, 'specifiedRules', { + enumerable: true, + get: function () { + return _index4.specifiedRules; + }, +}); +Object.defineProperty(exports, 'specifiedScalarTypes', { + enumerable: true, + get: function () { + return _index.specifiedScalarTypes; + }, +}); +Object.defineProperty(exports, 'stripIgnoredCharacters', { + enumerable: true, + get: function () { + return _index6.stripIgnoredCharacters; + }, +}); +Object.defineProperty(exports, 'subscribe', { + enumerable: true, + get: function () { + return _index3.subscribe; + }, +}); +Object.defineProperty(exports, 'syntaxError', { + enumerable: true, + get: function () { + return _index5.syntaxError; + }, +}); +Object.defineProperty(exports, 'typeFromAST', { + enumerable: true, + get: function () { + return _index6.typeFromAST; + }, +}); +Object.defineProperty(exports, 'validate', { + enumerable: true, + get: function () { + return _index4.validate; + }, +}); +Object.defineProperty(exports, 'validateSchema', { + enumerable: true, + get: function () { + return _index.validateSchema; + }, +}); +Object.defineProperty(exports, 'valueFromAST', { + enumerable: true, + get: function () { + return _index6.valueFromAST; + }, +}); +Object.defineProperty(exports, 'valueFromASTUntyped', { + enumerable: true, + get: function () { + return _index6.valueFromASTUntyped; + }, +}); +Object.defineProperty(exports, 'version', { + enumerable: true, + get: function () { + return _version.version; + }, +}); +Object.defineProperty(exports, 'versionInfo', { + enumerable: true, + get: function () { + return _version.versionInfo; + }, +}); +Object.defineProperty(exports, 'visit', { + enumerable: true, + get: function () { + return _index2.visit; + }, +}); +Object.defineProperty(exports, 'visitInParallel', { + enumerable: true, + get: function () { + return _index2.visitInParallel; + }, +}); +Object.defineProperty(exports, 'visitWithTypeInfo', { + enumerable: true, + get: function () { + return _index6.visitWithTypeInfo; + }, +}); + +var _version = require('./version.js'); + +var _graphql = require('./graphql.js'); + +var _index = require('./type/index.js'); + +var _index2 = require('./language/index.js'); + +var _index3 = require('./execution/index.js'); + +var _index4 = require('./validation/index.js'); + +var _index5 = require('./error/index.js'); + +var _index6 = require('./utilities/index.js'); diff --git a/graphql-subscription/node_modules/graphql/index.mjs b/graphql-subscription/node_modules/graphql/index.mjs new file mode 100644 index 0000000..ba8672e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/index.mjs @@ -0,0 +1,255 @@ +/** + * GraphQL.js provides a reference implementation for the GraphQL specification + * but is also a useful utility for operating on GraphQL files and building + * sophisticated tools. + * + * This primary module exports a general purpose function for fulfilling all + * steps of the GraphQL specification in a single operation, but also includes + * utilities for every part of the GraphQL specification: + * + * - Parsing the GraphQL language. + * - Building a GraphQL type schema. + * - Validating a GraphQL request against a type schema. + * - Executing a GraphQL request against a type schema. + * + * This also includes utility functions for operating on GraphQL types and + * GraphQL documents to facilitate building tools. + * + * You may also import from each sub-directory directly. For example, the + * following two import statements are equivalent: + * + * ```ts + * import { parse } from 'graphql'; + * import { parse } from 'graphql/language'; + * ``` + * + * @packageDocumentation + */ +// The GraphQL.js version info. +export { version, versionInfo } from './version.mjs'; // The primary entry point into fulfilling a GraphQL request. + +export { graphql, graphqlSync } from './graphql.mjs'; // Create and operate on GraphQL type definitions and schema. + +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, // Definitions + GraphQLSchema, + GraphQLDirective, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, // Standard GraphQL Scalars + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, // Int boundaries constants + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, // Built-in Directives defined by the Spec + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, // "Enum" of Type Kinds + TypeKind, // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, // GraphQL Types for introspection. + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, // Predicates + isSchema, + isDirective, + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + isSpecifiedScalarType, + isIntrospectionType, + isSpecifiedDirective, // Assertions + assertSchema, + assertDirective, + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, // Un-modifiers + getNullableType, + getNamedType, // Validate GraphQL schema. + validateSchema, + assertValidSchema, // Upholds the spec rules about naming. + assertName, + assertEnumValueName, +} from './type/index.mjs'; +// Parse and operate on GraphQL language source files. +export { + Token, + Source, + Location, + OperationTypeNode, + getLocation, // Print source location. + printLocation, + printSourceLocation, // Lex + Lexer, + TokenKind, // Parse + parse, + parseValue, + parseConstValue, + parseType, // Print + print, // Visit + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, + Kind, + DirectiveLocation, // Predicates + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './language/index.mjs'; +// Execute GraphQL queries. +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, + responsePathAsArray, + getArgumentValues, + getVariableValues, + getDirectiveValues, + subscribe, + createSourceEventStream, +} from './execution/index.mjs'; +// Validate GraphQL documents. +export { + validate, + ValidationContext, // All validation rules in the GraphQL Specification. + specifiedRules, // Individual validation rules. + ExecutableDefinitionsRule, + FieldsOnCorrectTypeRule, + FragmentsOnCompositeTypesRule, + KnownArgumentNamesRule, + KnownDirectivesRule, + KnownFragmentNamesRule, + KnownTypeNamesRule, + LoneAnonymousOperationRule, + NoFragmentCyclesRule, + NoUndefinedVariablesRule, + NoUnusedFragmentsRule, + NoUnusedVariablesRule, + OverlappingFieldsCanBeMergedRule, + PossibleFragmentSpreadsRule, + ProvidedRequiredArgumentsRule, + ScalarLeafsRule, + SingleFieldSubscriptionsRule, + UniqueArgumentNamesRule, + UniqueDirectivesPerLocationRule, + UniqueFragmentNamesRule, + UniqueInputFieldNamesRule, + UniqueOperationNamesRule, + UniqueVariableNamesRule, + ValuesOfCorrectTypeRule, + VariablesAreInputTypesRule, + VariablesInAllowedPositionRule, // SDL-specific validation rules + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + PossibleTypeExtensionsRule, // Custom validation rules + NoDeprecatedCustomRule, + NoSchemaIntrospectionCustomRule, +} from './validation/index.mjs'; +// Create, format, and print GraphQL errors. +export { + GraphQLError, + syntaxError, + locatedError, + printError, + formatError, +} from './error/index.mjs'; +// Utilities for operating on GraphQL type schema and parsed sources. +export { + // Produce the GraphQL query recommended for a full schema introspection. + // Accepts optional IntrospectionOptions. + getIntrospectionQuery, // Gets the target Operation from a Document. + getOperationAST, // Gets the Type for the target Operation AST. + getOperationRootType, // Convert a GraphQLSchema to an IntrospectionQuery. + introspectionFromSchema, // Build a GraphQLSchema from an introspection result. + buildClientSchema, // Build a GraphQLSchema from a parsed GraphQL Schema language AST. + buildASTSchema, // Build a GraphQLSchema from a GraphQL schema language document. + buildSchema, // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. + extendSchema, // Sort a GraphQLSchema. + lexicographicSortSchema, // Print a GraphQLSchema to GraphQL Schema language. + printSchema, // Print a GraphQLType to GraphQL Schema language. + printType, // Prints the built-in introspection schema in the Schema Language format. + printIntrospectionSchema, // Create a GraphQLType from a GraphQL language AST. + typeFromAST, // Create a JavaScript value from a GraphQL language AST with a Type. + valueFromAST, // Create a JavaScript value from a GraphQL language AST without a Type. + valueFromASTUntyped, // Create a GraphQL language AST from a JavaScript value. + astFromValue, // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. + TypeInfo, + visitWithTypeInfo, // Coerces a JavaScript value to a GraphQL type, or produces errors. + coerceInputValue, // Concatenates multiple AST together. + concatAST, // Separates an AST into an AST per Operation. + separateOperations, // Strips characters that are not significant to the validity or execution of a GraphQL document. + stripIgnoredCharacters, // Comparators for types + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, // Asserts a string is a valid GraphQL name. + assertValidName, // Determine if a string is a valid GraphQL name. + isValidNameError, // Compares two GraphQLSchemas and detects breaking changes. + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './utilities/index.mjs'; diff --git a/graphql-subscription/node_modules/graphql/jsutils/Maybe.d.ts b/graphql-subscription/node_modules/graphql/jsutils/Maybe.d.ts new file mode 100644 index 0000000..d86ffcc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/Maybe.d.ts @@ -0,0 +1,2 @@ +/** Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/ */ +export declare type Maybe = null | undefined | T; diff --git a/graphql-subscription/node_modules/graphql/jsutils/Maybe.js b/graphql-subscription/node_modules/graphql/jsutils/Maybe.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/Maybe.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription/node_modules/graphql/jsutils/Maybe.mjs b/graphql-subscription/node_modules/graphql/jsutils/Maybe.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/Maybe.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription/node_modules/graphql/jsutils/ObjMap.d.ts b/graphql-subscription/node_modules/graphql/jsutils/ObjMap.d.ts new file mode 100644 index 0000000..d22215b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/ObjMap.d.ts @@ -0,0 +1,16 @@ +export interface ObjMap { + [key: string]: T; +} +export declare type ObjMapLike = + | ObjMap + | { + [key: string]: T; + }; +export interface ReadOnlyObjMap { + readonly [key: string]: T; +} +export declare type ReadOnlyObjMapLike = + | ReadOnlyObjMap + | { + readonly [key: string]: T; + }; diff --git a/graphql-subscription/node_modules/graphql/jsutils/ObjMap.js b/graphql-subscription/node_modules/graphql/jsutils/ObjMap.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/ObjMap.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription/node_modules/graphql/jsutils/ObjMap.mjs b/graphql-subscription/node_modules/graphql/jsutils/ObjMap.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/ObjMap.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription/node_modules/graphql/jsutils/Path.d.ts b/graphql-subscription/node_modules/graphql/jsutils/Path.d.ts new file mode 100644 index 0000000..af55cc0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/Path.d.ts @@ -0,0 +1,20 @@ +import type { Maybe } from './Maybe'; +export interface Path { + readonly prev: Path | undefined; + readonly key: string | number; + readonly typename: string | undefined; +} +/** + * Given a Path and a key, return a new Path containing the new key. + */ +export declare function addPath( + prev: Readonly | undefined, + key: string | number, + typename: string | undefined, +): Path; +/** + * Given a Path, return an Array of the path keys. + */ +export declare function pathToArray( + path: Maybe>, +): Array; diff --git a/graphql-subscription/node_modules/graphql/jsutils/Path.js b/graphql-subscription/node_modules/graphql/jsutils/Path.js new file mode 100644 index 0000000..9b4540a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/Path.js @@ -0,0 +1,33 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.addPath = addPath; +exports.pathToArray = pathToArray; + +/** + * Given a Path and a key, return a new Path containing the new key. + */ +function addPath(prev, key, typename) { + return { + prev, + key, + typename, + }; +} +/** + * Given a Path, return an Array of the path keys. + */ + +function pathToArray(path) { + const flattened = []; + let curr = path; + + while (curr) { + flattened.push(curr.key); + curr = curr.prev; + } + + return flattened.reverse(); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/Path.mjs b/graphql-subscription/node_modules/graphql/jsutils/Path.mjs new file mode 100644 index 0000000..945f182 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/Path.mjs @@ -0,0 +1,25 @@ +/** + * Given a Path and a key, return a new Path containing the new key. + */ +export function addPath(prev, key, typename) { + return { + prev, + key, + typename, + }; +} +/** + * Given a Path, return an Array of the path keys. + */ + +export function pathToArray(path) { + const flattened = []; + let curr = path; + + while (curr) { + flattened.push(curr.key); + curr = curr.prev; + } + + return flattened.reverse(); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.d.ts b/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.d.ts new file mode 100644 index 0000000..abf2785 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.d.ts @@ -0,0 +1 @@ +export declare type PromiseOrValue = Promise | T; diff --git a/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.js b/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.mjs b/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/PromiseOrValue.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription/node_modules/graphql/jsutils/devAssert.d.ts b/graphql-subscription/node_modules/graphql/jsutils/devAssert.d.ts new file mode 100644 index 0000000..02f90c2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/devAssert.d.ts @@ -0,0 +1 @@ +export declare function devAssert(condition: unknown, message: string): void; diff --git a/graphql-subscription/node_modules/graphql/jsutils/devAssert.js b/graphql-subscription/node_modules/graphql/jsutils/devAssert.js new file mode 100644 index 0000000..c40d406 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/devAssert.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.devAssert = devAssert; + +function devAssert(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error(message); + } +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/devAssert.mjs b/graphql-subscription/node_modules/graphql/jsutils/devAssert.mjs new file mode 100644 index 0000000..5192b32 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/devAssert.mjs @@ -0,0 +1,7 @@ +export function devAssert(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error(message); + } +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/didYouMean.d.ts b/graphql-subscription/node_modules/graphql/jsutils/didYouMean.d.ts new file mode 100644 index 0000000..81afb5d --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/didYouMean.d.ts @@ -0,0 +1,8 @@ +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ +export declare function didYouMean(suggestions: ReadonlyArray): string; +export declare function didYouMean( + subMessage: string, + suggestions: ReadonlyArray, +): string; diff --git a/graphql-subscription/node_modules/graphql/jsutils/didYouMean.js b/graphql-subscription/node_modules/graphql/jsutils/didYouMean.js new file mode 100644 index 0000000..afac8d6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/didYouMean.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.didYouMean = didYouMean; +const MAX_SUGGESTIONS = 5; +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ + +function didYouMean(firstArg, secondArg) { + const [subMessage, suggestionsArg] = secondArg + ? [firstArg, secondArg] + : [undefined, firstArg]; + let message = ' Did you mean '; + + if (subMessage) { + message += subMessage + ' '; + } + + const suggestions = suggestionsArg.map((x) => `"${x}"`); + + switch (suggestions.length) { + case 0: + return ''; + + case 1: + return message + suggestions[0] + '?'; + + case 2: + return message + suggestions[0] + ' or ' + suggestions[1] + '?'; + } + + const selected = suggestions.slice(0, MAX_SUGGESTIONS); + const lastItem = selected.pop(); + return message + selected.join(', ') + ', or ' + lastItem + '?'; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/didYouMean.mjs b/graphql-subscription/node_modules/graphql/jsutils/didYouMean.mjs new file mode 100644 index 0000000..bce3c29 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/didYouMean.mjs @@ -0,0 +1,32 @@ +const MAX_SUGGESTIONS = 5; +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ + +export function didYouMean(firstArg, secondArg) { + const [subMessage, suggestionsArg] = secondArg + ? [firstArg, secondArg] + : [undefined, firstArg]; + let message = ' Did you mean '; + + if (subMessage) { + message += subMessage + ' '; + } + + const suggestions = suggestionsArg.map((x) => `"${x}"`); + + switch (suggestions.length) { + case 0: + return ''; + + case 1: + return message + suggestions[0] + '?'; + + case 2: + return message + suggestions[0] + ' or ' + suggestions[1] + '?'; + } + + const selected = suggestions.slice(0, MAX_SUGGESTIONS); + const lastItem = selected.pop(); + return message + selected.join(', ') + ', or ' + lastItem + '?'; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/groupBy.d.ts b/graphql-subscription/node_modules/graphql/jsutils/groupBy.d.ts new file mode 100644 index 0000000..93b0b45 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/groupBy.d.ts @@ -0,0 +1,7 @@ +/** + * Groups array items into a Map, given a function to produce grouping key. + */ +export declare function groupBy( + list: ReadonlyArray, + keyFn: (item: T) => K, +): Map>; diff --git a/graphql-subscription/node_modules/graphql/jsutils/groupBy.js b/graphql-subscription/node_modules/graphql/jsutils/groupBy.js new file mode 100644 index 0000000..7c2a2c3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/groupBy.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.groupBy = groupBy; + +/** + * Groups array items into a Map, given a function to produce grouping key. + */ +function groupBy(list, keyFn) { + const result = new Map(); + + for (const item of list) { + const key = keyFn(item); + const group = result.get(key); + + if (group === undefined) { + result.set(key, [item]); + } else { + group.push(item); + } + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/groupBy.mjs b/graphql-subscription/node_modules/graphql/jsutils/groupBy.mjs new file mode 100644 index 0000000..032287b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/groupBy.mjs @@ -0,0 +1,19 @@ +/** + * Groups array items into a Map, given a function to produce grouping key. + */ +export function groupBy(list, keyFn) { + const result = new Map(); + + for (const item of list) { + const key = keyFn(item); + const group = result.get(key); + + if (group === undefined) { + result.set(key, [item]); + } else { + group.push(item); + } + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/identityFunc.d.ts b/graphql-subscription/node_modules/graphql/jsutils/identityFunc.d.ts new file mode 100644 index 0000000..bf1bbcb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/identityFunc.d.ts @@ -0,0 +1,4 @@ +/** + * Returns the first argument it receives. + */ +export declare function identityFunc(x: T): T; diff --git a/graphql-subscription/node_modules/graphql/jsutils/identityFunc.js b/graphql-subscription/node_modules/graphql/jsutils/identityFunc.js new file mode 100644 index 0000000..d9614fc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/identityFunc.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.identityFunc = identityFunc; + +/** + * Returns the first argument it receives. + */ +function identityFunc(x) { + return x; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/identityFunc.mjs b/graphql-subscription/node_modules/graphql/jsutils/identityFunc.mjs new file mode 100644 index 0000000..88e3fdc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/identityFunc.mjs @@ -0,0 +1,6 @@ +/** + * Returns the first argument it receives. + */ +export function identityFunc(x) { + return x; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/inspect.d.ts b/graphql-subscription/node_modules/graphql/jsutils/inspect.d.ts new file mode 100644 index 0000000..b6e0815 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/inspect.d.ts @@ -0,0 +1,4 @@ +/** + * Used to print values in error messages. + */ +export declare function inspect(value: unknown): string; diff --git a/graphql-subscription/node_modules/graphql/jsutils/inspect.js b/graphql-subscription/node_modules/graphql/jsutils/inspect.js new file mode 100644 index 0000000..9869702 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/inspect.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.inspect = inspect; +const MAX_ARRAY_LENGTH = 10; +const MAX_RECURSIVE_DEPTH = 2; +/** + * Used to print values in error messages. + */ + +function inspect(value) { + return formatValue(value, []); +} + +function formatValue(value, seenValues) { + switch (typeof value) { + case 'string': + return JSON.stringify(value); + + case 'function': + return value.name ? `[function ${value.name}]` : '[function]'; + + case 'object': + return formatObjectValue(value, seenValues); + + default: + return String(value); + } +} + +function formatObjectValue(value, previouslySeenValues) { + if (value === null) { + return 'null'; + } + + if (previouslySeenValues.includes(value)) { + return '[Circular]'; + } + + const seenValues = [...previouslySeenValues, value]; + + if (isJSONable(value)) { + const jsonValue = value.toJSON(); // check for infinite recursion + + if (jsonValue !== value) { + return typeof jsonValue === 'string' + ? jsonValue + : formatValue(jsonValue, seenValues); + } + } else if (Array.isArray(value)) { + return formatArray(value, seenValues); + } + + return formatObject(value, seenValues); +} + +function isJSONable(value) { + return typeof value.toJSON === 'function'; +} + +function formatObject(object, seenValues) { + const entries = Object.entries(object); + + if (entries.length === 0) { + return '{}'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[' + getObjectTag(object) + ']'; + } + + const properties = entries.map( + ([key, value]) => key + ': ' + formatValue(value, seenValues), + ); + return '{ ' + properties.join(', ') + ' }'; +} + +function formatArray(array, seenValues) { + if (array.length === 0) { + return '[]'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[Array]'; + } + + const len = Math.min(MAX_ARRAY_LENGTH, array.length); + const remaining = array.length - len; + const items = []; + + for (let i = 0; i < len; ++i) { + items.push(formatValue(array[i], seenValues)); + } + + if (remaining === 1) { + items.push('... 1 more item'); + } else if (remaining > 1) { + items.push(`... ${remaining} more items`); + } + + return '[' + items.join(', ') + ']'; +} + +function getObjectTag(object) { + const tag = Object.prototype.toString + .call(object) + .replace(/^\[object /, '') + .replace(/]$/, ''); + + if (tag === 'Object' && typeof object.constructor === 'function') { + const name = object.constructor.name; + + if (typeof name === 'string' && name !== '') { + return name; + } + } + + return tag; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/inspect.mjs b/graphql-subscription/node_modules/graphql/jsutils/inspect.mjs new file mode 100644 index 0000000..00000b8 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/inspect.mjs @@ -0,0 +1,115 @@ +const MAX_ARRAY_LENGTH = 10; +const MAX_RECURSIVE_DEPTH = 2; +/** + * Used to print values in error messages. + */ + +export function inspect(value) { + return formatValue(value, []); +} + +function formatValue(value, seenValues) { + switch (typeof value) { + case 'string': + return JSON.stringify(value); + + case 'function': + return value.name ? `[function ${value.name}]` : '[function]'; + + case 'object': + return formatObjectValue(value, seenValues); + + default: + return String(value); + } +} + +function formatObjectValue(value, previouslySeenValues) { + if (value === null) { + return 'null'; + } + + if (previouslySeenValues.includes(value)) { + return '[Circular]'; + } + + const seenValues = [...previouslySeenValues, value]; + + if (isJSONable(value)) { + const jsonValue = value.toJSON(); // check for infinite recursion + + if (jsonValue !== value) { + return typeof jsonValue === 'string' + ? jsonValue + : formatValue(jsonValue, seenValues); + } + } else if (Array.isArray(value)) { + return formatArray(value, seenValues); + } + + return formatObject(value, seenValues); +} + +function isJSONable(value) { + return typeof value.toJSON === 'function'; +} + +function formatObject(object, seenValues) { + const entries = Object.entries(object); + + if (entries.length === 0) { + return '{}'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[' + getObjectTag(object) + ']'; + } + + const properties = entries.map( + ([key, value]) => key + ': ' + formatValue(value, seenValues), + ); + return '{ ' + properties.join(', ') + ' }'; +} + +function formatArray(array, seenValues) { + if (array.length === 0) { + return '[]'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[Array]'; + } + + const len = Math.min(MAX_ARRAY_LENGTH, array.length); + const remaining = array.length - len; + const items = []; + + for (let i = 0; i < len; ++i) { + items.push(formatValue(array[i], seenValues)); + } + + if (remaining === 1) { + items.push('... 1 more item'); + } else if (remaining > 1) { + items.push(`... ${remaining} more items`); + } + + return '[' + items.join(', ') + ']'; +} + +function getObjectTag(object) { + const tag = Object.prototype.toString + .call(object) + .replace(/^\[object /, '') + .replace(/]$/, ''); + + if (tag === 'Object' && typeof object.constructor === 'function') { + const name = object.constructor.name; + + if (typeof name === 'string' && name !== '') { + return name; + } + } + + return tag; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/instanceOf.d.ts b/graphql-subscription/node_modules/graphql/jsutils/instanceOf.d.ts new file mode 100644 index 0000000..1fca676 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/instanceOf.d.ts @@ -0,0 +1,16 @@ +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production + * See: https://webpack.js.org/guides/production/ + */ +export declare const instanceOf: ( + value: unknown, + constructor: Constructor, +) => boolean; +interface Constructor extends Function { + prototype: { + [Symbol.toStringTag]: string; + }; +} +export {}; diff --git a/graphql-subscription/node_modules/graphql/jsutils/instanceOf.js b/graphql-subscription/node_modules/graphql/jsutils/instanceOf.js new file mode 100644 index 0000000..f489a9a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/instanceOf.js @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.instanceOf = void 0; + +var _inspect = require('./inspect.js'); + +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production + * See: https://webpack.js.org/guides/production/ + */ +const instanceOf = + /* c8 ignore next 6 */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + globalThis.process && globalThis.process.env.NODE_ENV === 'production' + ? function instanceOf(value, constructor) { + return value instanceof constructor; + } + : function instanceOf(value, constructor) { + if (value instanceof constructor) { + return true; + } + + if (typeof value === 'object' && value !== null) { + var _value$constructor; + + // Prefer Symbol.toStringTag since it is immune to minification. + const className = constructor.prototype[Symbol.toStringTag]; + const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library. + Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009 + ? value[Symbol.toStringTag] + : (_value$constructor = value.constructor) === null || + _value$constructor === void 0 + ? void 0 + : _value$constructor.name; + + if (className === valueClassName) { + const stringifiedValue = (0, _inspect.inspect)(value); + throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm. + +Ensure that there is only one instance of "graphql" in the node_modules +directory. If different versions of "graphql" are the dependencies of other +relied on modules, use "resolutions" to ensure only one version is installed. + +https://yarnpkg.com/en/docs/selective-version-resolutions + +Duplicate "graphql" modules cannot be used at the same time since different +versions may have different capabilities and behavior. The data from one +version used in the function from another could produce confusing and +spurious results.`); + } + } + + return false; + }; +exports.instanceOf = instanceOf; diff --git a/graphql-subscription/node_modules/graphql/jsutils/instanceOf.mjs b/graphql-subscription/node_modules/graphql/jsutils/instanceOf.mjs new file mode 100644 index 0000000..0f05267 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/instanceOf.mjs @@ -0,0 +1,52 @@ +import { inspect } from './inspect.mjs'; +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production + * See: https://webpack.js.org/guides/production/ + */ + +export const instanceOf = + /* c8 ignore next 6 */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + globalThis.process && globalThis.process.env.NODE_ENV === 'production' + ? function instanceOf(value, constructor) { + return value instanceof constructor; + } + : function instanceOf(value, constructor) { + if (value instanceof constructor) { + return true; + } + + if (typeof value === 'object' && value !== null) { + var _value$constructor; + + // Prefer Symbol.toStringTag since it is immune to minification. + const className = constructor.prototype[Symbol.toStringTag]; + const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library. + Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009 + ? value[Symbol.toStringTag] + : (_value$constructor = value.constructor) === null || + _value$constructor === void 0 + ? void 0 + : _value$constructor.name; + + if (className === valueClassName) { + const stringifiedValue = inspect(value); + throw new Error(`Cannot use ${className} "${stringifiedValue}" from another module or realm. + +Ensure that there is only one instance of "graphql" in the node_modules +directory. If different versions of "graphql" are the dependencies of other +relied on modules, use "resolutions" to ensure only one version is installed. + +https://yarnpkg.com/en/docs/selective-version-resolutions + +Duplicate "graphql" modules cannot be used at the same time since different +versions may have different capabilities and behavior. The data from one +version used in the function from another could produce confusing and +spurious results.`); + } + } + + return false; + }; diff --git a/graphql-subscription/node_modules/graphql/jsutils/invariant.d.ts b/graphql-subscription/node_modules/graphql/jsutils/invariant.d.ts new file mode 100644 index 0000000..db04500 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/invariant.d.ts @@ -0,0 +1,4 @@ +export declare function invariant( + condition: unknown, + message?: string, +): asserts condition; diff --git a/graphql-subscription/node_modules/graphql/jsutils/invariant.js b/graphql-subscription/node_modules/graphql/jsutils/invariant.js new file mode 100644 index 0000000..9e0cf5b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/invariant.js @@ -0,0 +1,16 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.invariant = invariant; + +function invariant(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error( + message != null ? message : 'Unexpected invariant triggered.', + ); + } +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/invariant.mjs b/graphql-subscription/node_modules/graphql/jsutils/invariant.mjs new file mode 100644 index 0000000..986cc47 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/invariant.mjs @@ -0,0 +1,9 @@ +export function invariant(condition, message) { + const booleanCondition = Boolean(condition); + + if (!booleanCondition) { + throw new Error( + message != null ? message : 'Unexpected invariant triggered.', + ); + } +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.d.ts b/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.d.ts new file mode 100644 index 0000000..8cb226b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.d.ts @@ -0,0 +1,7 @@ +/** + * Returns true if the provided object implements the AsyncIterator protocol via + * implementing a `Symbol.asyncIterator` method. + */ +export declare function isAsyncIterable( + maybeAsyncIterable: any, +): maybeAsyncIterable is AsyncIterable; diff --git a/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.js b/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.js new file mode 100644 index 0000000..c608c0c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isAsyncIterable = isAsyncIterable; + +/** + * Returns true if the provided object implements the AsyncIterator protocol via + * implementing a `Symbol.asyncIterator` method. + */ +function isAsyncIterable(maybeAsyncIterable) { + return ( + typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 + ? void 0 + : maybeAsyncIterable[Symbol.asyncIterator]) === 'function' + ); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.mjs b/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.mjs new file mode 100644 index 0000000..b55e3f0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isAsyncIterable.mjs @@ -0,0 +1,11 @@ +/** + * Returns true if the provided object implements the AsyncIterator protocol via + * implementing a `Symbol.asyncIterator` method. + */ +export function isAsyncIterable(maybeAsyncIterable) { + return ( + typeof (maybeAsyncIterable === null || maybeAsyncIterable === void 0 + ? void 0 + : maybeAsyncIterable[Symbol.asyncIterator]) === 'function' + ); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.d.ts b/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.d.ts new file mode 100644 index 0000000..4fdce25 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.d.ts @@ -0,0 +1,20 @@ +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and implements the Iterator protocol. + * + * This may be used in place of [Array.isArray()][isArray] to determine if + * an object should be iterated-over e.g. Array, Map, Set, Int8Array, + * TypedArray, etc. but excludes string literals. + * + * @example + * ```ts + * isIterableObject([ 1, 2, 3 ]) // true + * isIterableObject(new Map()) // true + * isIterableObject('ABC') // false + * isIterableObject({ key: 'value' }) // false + * isIterableObject({ length: 1, 0: 'Alpha' }) // false + * ``` + */ +export declare function isIterableObject( + maybeIterable: any, +): maybeIterable is Iterable; diff --git a/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.js b/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.js new file mode 100644 index 0000000..33204cc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.js @@ -0,0 +1,32 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isIterableObject = isIterableObject; + +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and implements the Iterator protocol. + * + * This may be used in place of [Array.isArray()][isArray] to determine if + * an object should be iterated-over e.g. Array, Map, Set, Int8Array, + * TypedArray, etc. but excludes string literals. + * + * @example + * ```ts + * isIterableObject([ 1, 2, 3 ]) // true + * isIterableObject(new Map()) // true + * isIterableObject('ABC') // false + * isIterableObject({ key: 'value' }) // false + * isIterableObject({ length: 1, 0: 'Alpha' }) // false + * ``` + */ +function isIterableObject(maybeIterable) { + return ( + typeof maybeIterable === 'object' && + typeof (maybeIterable === null || maybeIterable === void 0 + ? void 0 + : maybeIterable[Symbol.iterator]) === 'function' + ); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.mjs b/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.mjs new file mode 100644 index 0000000..92ca657 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isIterableObject.mjs @@ -0,0 +1,25 @@ +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and implements the Iterator protocol. + * + * This may be used in place of [Array.isArray()][isArray] to determine if + * an object should be iterated-over e.g. Array, Map, Set, Int8Array, + * TypedArray, etc. but excludes string literals. + * + * @example + * ```ts + * isIterableObject([ 1, 2, 3 ]) // true + * isIterableObject(new Map()) // true + * isIterableObject('ABC') // false + * isIterableObject({ key: 'value' }) // false + * isIterableObject({ length: 1, 0: 'Alpha' }) // false + * ``` + */ +export function isIterableObject(maybeIterable) { + return ( + typeof maybeIterable === 'object' && + typeof (maybeIterable === null || maybeIterable === void 0 + ? void 0 + : maybeIterable[Symbol.iterator]) === 'function' + ); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.d.ts b/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.d.ts new file mode 100644 index 0000000..3390639 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.d.ts @@ -0,0 +1,7 @@ +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +export declare function isObjectLike(value: unknown): value is { + [key: string]: unknown; +}; diff --git a/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.js b/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.js new file mode 100644 index 0000000..aeba023 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isObjectLike = isObjectLike; + +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +function isObjectLike(value) { + return typeof value == 'object' && value !== null; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.mjs b/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.mjs new file mode 100644 index 0000000..96e7678 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isObjectLike.mjs @@ -0,0 +1,7 @@ +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +export function isObjectLike(value) { + return typeof value == 'object' && value !== null; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isPromise.d.ts b/graphql-subscription/node_modules/graphql/jsutils/isPromise.d.ts new file mode 100644 index 0000000..786de26 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isPromise.d.ts @@ -0,0 +1,5 @@ +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +export declare function isPromise(value: any): value is Promise; diff --git a/graphql-subscription/node_modules/graphql/jsutils/isPromise.js b/graphql-subscription/node_modules/graphql/jsutils/isPromise.js new file mode 100644 index 0000000..715deed --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isPromise.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isPromise = isPromise; + +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +function isPromise(value) { + return ( + typeof (value === null || value === void 0 ? void 0 : value.then) === + 'function' + ); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/isPromise.mjs b/graphql-subscription/node_modules/graphql/jsutils/isPromise.mjs new file mode 100644 index 0000000..02755c2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/isPromise.mjs @@ -0,0 +1,10 @@ +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +export function isPromise(value) { + return ( + typeof (value === null || value === void 0 ? void 0 : value.then) === + 'function' + ); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/keyMap.d.ts b/graphql-subscription/node_modules/graphql/jsutils/keyMap.d.ts new file mode 100644 index 0000000..9d0df47 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/keyMap.d.ts @@ -0,0 +1,32 @@ +import type { ObjMap } from './ObjMap'; +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { + * // Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } + * // } + * + * const jennyEntry = entriesByName['Jenny'] + * + * // { name: 'Jenny', num: '857-6309' } + * ``` + */ +export declare function keyMap( + list: ReadonlyArray, + keyFn: (item: T) => string, +): ObjMap; diff --git a/graphql-subscription/node_modules/graphql/jsutils/keyMap.js b/graphql-subscription/node_modules/graphql/jsutils/keyMap.js new file mode 100644 index 0000000..f06476e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/keyMap.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.keyMap = keyMap; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { + * // Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } + * // } + * + * const jennyEntry = entriesByName['Jenny'] + * + * // { name: 'Jenny', num: '857-6309' } + * ``` + */ +function keyMap(list, keyFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = item; + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/keyMap.mjs b/graphql-subscription/node_modules/graphql/jsutils/keyMap.mjs new file mode 100644 index 0000000..56712f3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/keyMap.mjs @@ -0,0 +1,36 @@ +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { + * // Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } + * // } + * + * const jennyEntry = entriesByName['Jenny'] + * + * // { name: 'Jenny', num: '857-6309' } + * ``` + */ +export function keyMap(list, keyFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = item; + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/keyValMap.d.ts b/graphql-subscription/node_modules/graphql/jsutils/keyValMap.d.ts new file mode 100644 index 0000000..ed03a1a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/keyValMap.d.ts @@ -0,0 +1,23 @@ +import type { ObjMap } from './ObjMap'; +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * ``` + */ +export declare function keyValMap( + list: ReadonlyArray, + keyFn: (item: T) => string, + valFn: (item: T) => V, +): ObjMap; diff --git a/graphql-subscription/node_modules/graphql/jsutils/keyValMap.js b/graphql-subscription/node_modules/graphql/jsutils/keyValMap.js new file mode 100644 index 0000000..af724b0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/keyValMap.js @@ -0,0 +1,33 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.keyValMap = keyValMap; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * ``` + */ +function keyValMap(list, keyFn, valFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = valFn(item); + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/keyValMap.mjs b/graphql-subscription/node_modules/graphql/jsutils/keyValMap.mjs new file mode 100644 index 0000000..9efe2ae --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/keyValMap.mjs @@ -0,0 +1,26 @@ +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * ``` + */ +export function keyValMap(list, keyFn, valFn) { + const result = Object.create(null); + + for (const item of list) { + result[keyFn(item)] = valFn(item); + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/mapValue.d.ts b/graphql-subscription/node_modules/graphql/jsutils/mapValue.d.ts new file mode 100644 index 0000000..c1a54d4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/mapValue.d.ts @@ -0,0 +1,9 @@ +import type { ObjMap, ReadOnlyObjMap } from './ObjMap'; +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +export declare function mapValue( + map: ReadOnlyObjMap, + fn: (value: T, key: string) => V, +): ObjMap; diff --git a/graphql-subscription/node_modules/graphql/jsutils/mapValue.js b/graphql-subscription/node_modules/graphql/jsutils/mapValue.js new file mode 100644 index 0000000..98c9768 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/mapValue.js @@ -0,0 +1,20 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.mapValue = mapValue; + +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +function mapValue(map, fn) { + const result = Object.create(null); + + for (const key of Object.keys(map)) { + result[key] = fn(map[key], key); + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/mapValue.mjs b/graphql-subscription/node_modules/graphql/jsutils/mapValue.mjs new file mode 100644 index 0000000..c7e2a23 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/mapValue.mjs @@ -0,0 +1,13 @@ +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +export function mapValue(map, fn) { + const result = Object.create(null); + + for (const key of Object.keys(map)) { + result[key] = fn(map[key], key); + } + + return result; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/memoize3.d.ts b/graphql-subscription/node_modules/graphql/jsutils/memoize3.d.ts new file mode 100644 index 0000000..7e7e679 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/memoize3.d.ts @@ -0,0 +1,9 @@ +/** + * Memoizes the provided three-argument function. + */ +export declare function memoize3< + A1 extends object, + A2 extends object, + A3 extends object, + R, +>(fn: (a1: A1, a2: A2, a3: A3) => R): (a1: A1, a2: A2, a3: A3) => R; diff --git a/graphql-subscription/node_modules/graphql/jsutils/memoize3.js b/graphql-subscription/node_modules/graphql/jsutils/memoize3.js new file mode 100644 index 0000000..c3b9ebc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/memoize3.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.memoize3 = memoize3; + +/** + * Memoizes the provided three-argument function. + */ +function memoize3(fn) { + let cache0; + return function memoized(a1, a2, a3) { + if (cache0 === undefined) { + cache0 = new WeakMap(); + } + + let cache1 = cache0.get(a1); + + if (cache1 === undefined) { + cache1 = new WeakMap(); + cache0.set(a1, cache1); + } + + let cache2 = cache1.get(a2); + + if (cache2 === undefined) { + cache2 = new WeakMap(); + cache1.set(a2, cache2); + } + + let fnResult = cache2.get(a3); + + if (fnResult === undefined) { + fnResult = fn(a1, a2, a3); + cache2.set(a3, fnResult); + } + + return fnResult; + }; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/memoize3.mjs b/graphql-subscription/node_modules/graphql/jsutils/memoize3.mjs new file mode 100644 index 0000000..89687f8 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/memoize3.mjs @@ -0,0 +1,34 @@ +/** + * Memoizes the provided three-argument function. + */ +export function memoize3(fn) { + let cache0; + return function memoized(a1, a2, a3) { + if (cache0 === undefined) { + cache0 = new WeakMap(); + } + + let cache1 = cache0.get(a1); + + if (cache1 === undefined) { + cache1 = new WeakMap(); + cache0.set(a1, cache1); + } + + let cache2 = cache1.get(a2); + + if (cache2 === undefined) { + cache2 = new WeakMap(); + cache1.set(a2, cache2); + } + + let fnResult = cache2.get(a3); + + if (fnResult === undefined) { + fnResult = fn(a1, a2, a3); + cache2.set(a3, fnResult); + } + + return fnResult; + }; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.d.ts b/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.d.ts new file mode 100644 index 0000000..9407779 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.d.ts @@ -0,0 +1,8 @@ +/** + * Returns a number indicating whether a reference string comes before, or after, + * or is the same as the given string in natural sort order. + * + * See: https://en.wikipedia.org/wiki/Natural_sort_order + * + */ +export declare function naturalCompare(aStr: string, bStr: string): number; diff --git a/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.js b/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.js new file mode 100644 index 0000000..f6385ae --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.naturalCompare = naturalCompare; + +/** + * Returns a number indicating whether a reference string comes before, or after, + * or is the same as the given string in natural sort order. + * + * See: https://en.wikipedia.org/wiki/Natural_sort_order + * + */ +function naturalCompare(aStr, bStr) { + let aIndex = 0; + let bIndex = 0; + + while (aIndex < aStr.length && bIndex < bStr.length) { + let aChar = aStr.charCodeAt(aIndex); + let bChar = bStr.charCodeAt(bIndex); + + if (isDigit(aChar) && isDigit(bChar)) { + let aNum = 0; + + do { + ++aIndex; + aNum = aNum * 10 + aChar - DIGIT_0; + aChar = aStr.charCodeAt(aIndex); + } while (isDigit(aChar) && aNum > 0); + + let bNum = 0; + + do { + ++bIndex; + bNum = bNum * 10 + bChar - DIGIT_0; + bChar = bStr.charCodeAt(bIndex); + } while (isDigit(bChar) && bNum > 0); + + if (aNum < bNum) { + return -1; + } + + if (aNum > bNum) { + return 1; + } + } else { + if (aChar < bChar) { + return -1; + } + + if (aChar > bChar) { + return 1; + } + + ++aIndex; + ++bIndex; + } + } + + return aStr.length - bStr.length; +} + +const DIGIT_0 = 48; +const DIGIT_9 = 57; + +function isDigit(code) { + return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.mjs b/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.mjs new file mode 100644 index 0000000..e47a484 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/naturalCompare.mjs @@ -0,0 +1,61 @@ +/** + * Returns a number indicating whether a reference string comes before, or after, + * or is the same as the given string in natural sort order. + * + * See: https://en.wikipedia.org/wiki/Natural_sort_order + * + */ +export function naturalCompare(aStr, bStr) { + let aIndex = 0; + let bIndex = 0; + + while (aIndex < aStr.length && bIndex < bStr.length) { + let aChar = aStr.charCodeAt(aIndex); + let bChar = bStr.charCodeAt(bIndex); + + if (isDigit(aChar) && isDigit(bChar)) { + let aNum = 0; + + do { + ++aIndex; + aNum = aNum * 10 + aChar - DIGIT_0; + aChar = aStr.charCodeAt(aIndex); + } while (isDigit(aChar) && aNum > 0); + + let bNum = 0; + + do { + ++bIndex; + bNum = bNum * 10 + bChar - DIGIT_0; + bChar = bStr.charCodeAt(bIndex); + } while (isDigit(bChar) && bNum > 0); + + if (aNum < bNum) { + return -1; + } + + if (aNum > bNum) { + return 1; + } + } else { + if (aChar < bChar) { + return -1; + } + + if (aChar > bChar) { + return 1; + } + + ++aIndex; + ++bIndex; + } + } + + return aStr.length - bStr.length; +} +const DIGIT_0 = 48; +const DIGIT_9 = 57; + +function isDigit(code) { + return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/printPathArray.d.ts b/graphql-subscription/node_modules/graphql/jsutils/printPathArray.d.ts new file mode 100644 index 0000000..189d19e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/printPathArray.d.ts @@ -0,0 +1,6 @@ +/** + * Build a string describing the path. + */ +export declare function printPathArray( + path: ReadonlyArray, +): string; diff --git a/graphql-subscription/node_modules/graphql/jsutils/printPathArray.js b/graphql-subscription/node_modules/graphql/jsutils/printPathArray.js new file mode 100644 index 0000000..355af8e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/printPathArray.js @@ -0,0 +1,17 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printPathArray = printPathArray; + +/** + * Build a string describing the path. + */ +function printPathArray(path) { + return path + .map((key) => + typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key, + ) + .join(''); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/printPathArray.mjs b/graphql-subscription/node_modules/graphql/jsutils/printPathArray.mjs new file mode 100644 index 0000000..4109212 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/printPathArray.mjs @@ -0,0 +1,10 @@ +/** + * Build a string describing the path. + */ +export function printPathArray(path) { + return path + .map((key) => + typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key, + ) + .join(''); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.d.ts b/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.d.ts new file mode 100644 index 0000000..8a682b1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.d.ts @@ -0,0 +1,11 @@ +import type { ObjMap } from './ObjMap'; +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +export declare function promiseForObject( + object: ObjMap>, +): Promise>; diff --git a/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.js b/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.js new file mode 100644 index 0000000..788a3e5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.promiseForObject = promiseForObject; + +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +function promiseForObject(object) { + return Promise.all(Object.values(object)).then((resolvedValues) => { + const resolvedObject = Object.create(null); + + for (const [i, key] of Object.keys(object).entries()) { + resolvedObject[key] = resolvedValues[i]; + } + + return resolvedObject; + }); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.mjs b/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.mjs new file mode 100644 index 0000000..9d24cbd --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/promiseForObject.mjs @@ -0,0 +1,18 @@ +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +export function promiseForObject(object) { + return Promise.all(Object.values(object)).then((resolvedValues) => { + const resolvedObject = Object.create(null); + + for (const [i, key] of Object.keys(object).entries()) { + resolvedObject[key] = resolvedValues[i]; + } + + return resolvedObject; + }); +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.d.ts b/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.d.ts new file mode 100644 index 0000000..cafdf41 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.d.ts @@ -0,0 +1,13 @@ +import type { PromiseOrValue } from './PromiseOrValue'; +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +export declare function promiseReduce( + values: Iterable, + callbackFn: (accumulator: U, currentValue: T) => PromiseOrValue, + initialValue: PromiseOrValue, +): PromiseOrValue; diff --git a/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.js b/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.js new file mode 100644 index 0000000..67c5c94 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.promiseReduce = promiseReduce; + +var _isPromise = require('./isPromise.js'); + +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +function promiseReduce(values, callbackFn, initialValue) { + let accumulator = initialValue; + + for (const value of values) { + accumulator = (0, _isPromise.isPromise)(accumulator) + ? accumulator.then((resolved) => callbackFn(resolved, value)) + : callbackFn(accumulator, value); + } + + return accumulator; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.mjs b/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.mjs new file mode 100644 index 0000000..c9eeddf --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/promiseReduce.mjs @@ -0,0 +1,20 @@ +import { isPromise } from './isPromise.mjs'; + +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +export function promiseReduce(values, callbackFn, initialValue) { + let accumulator = initialValue; + + for (const value of values) { + accumulator = isPromise(accumulator) + ? accumulator.then((resolved) => callbackFn(resolved, value)) + : callbackFn(accumulator, value); + } + + return accumulator; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/suggestionList.d.ts b/graphql-subscription/node_modules/graphql/jsutils/suggestionList.d.ts new file mode 100644 index 0000000..d5d20ea --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/suggestionList.d.ts @@ -0,0 +1,8 @@ +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ +export declare function suggestionList( + input: string, + options: ReadonlyArray, +): Array; diff --git a/graphql-subscription/node_modules/graphql/jsutils/suggestionList.js b/graphql-subscription/node_modules/graphql/jsutils/suggestionList.js new file mode 100644 index 0000000..f2b83c7 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/suggestionList.js @@ -0,0 +1,139 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.suggestionList = suggestionList; + +var _naturalCompare = require('./naturalCompare.js'); + +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ +function suggestionList(input, options) { + const optionsByDistance = Object.create(null); + const lexicalDistance = new LexicalDistance(input); + const threshold = Math.floor(input.length * 0.4) + 1; + + for (const option of options) { + const distance = lexicalDistance.measure(option, threshold); + + if (distance !== undefined) { + optionsByDistance[option] = distance; + } + } + + return Object.keys(optionsByDistance).sort((a, b) => { + const distanceDiff = optionsByDistance[a] - optionsByDistance[b]; + return distanceDiff !== 0 + ? distanceDiff + : (0, _naturalCompare.naturalCompare)(a, b); + }); +} +/** + * Computes the lexical distance between strings A and B. + * + * The "distance" between two strings is given by counting the minimum number + * of edits needed to transform string A into string B. An edit can be an + * insertion, deletion, or substitution of a single character, or a swap of two + * adjacent characters. + * + * Includes a custom alteration from Damerau-Levenshtein to treat case changes + * as a single edit which helps identify mis-cased values with an edit distance + * of 1. + * + * This distance can be useful for detecting typos in input or sorting + */ + +class LexicalDistance { + constructor(input) { + this._input = input; + this._inputLowerCase = input.toLowerCase(); + this._inputArray = stringToArray(this._inputLowerCase); + this._rows = [ + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + ]; + } + + measure(option, threshold) { + if (this._input === option) { + return 0; + } + + const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit + + if (this._inputLowerCase === optionLowerCase) { + return 1; + } + + let a = stringToArray(optionLowerCase); + let b = this._inputArray; + + if (a.length < b.length) { + const tmp = a; + a = b; + b = tmp; + } + + const aLength = a.length; + const bLength = b.length; + + if (aLength - bLength > threshold) { + return undefined; + } + + const rows = this._rows; + + for (let j = 0; j <= bLength; j++) { + rows[0][j] = j; + } + + for (let i = 1; i <= aLength; i++) { + const upRow = rows[(i - 1) % 3]; + const currentRow = rows[i % 3]; + let smallestCell = (currentRow[0] = i); + + for (let j = 1; j <= bLength; j++) { + const cost = a[i - 1] === b[j - 1] ? 0 : 1; + let currentCell = Math.min( + upRow[j] + 1, // delete + currentRow[j - 1] + 1, // insert + upRow[j - 1] + cost, // substitute + ); + + if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { + // transposition + const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; + currentCell = Math.min(currentCell, doubleDiagonalCell + 1); + } + + if (currentCell < smallestCell) { + smallestCell = currentCell; + } + + currentRow[j] = currentCell; + } // Early exit, since distance can't go smaller than smallest element of the previous row. + + if (smallestCell > threshold) { + return undefined; + } + } + + const distance = rows[aLength % 3][bLength]; + return distance <= threshold ? distance : undefined; + } +} + +function stringToArray(str) { + const strLength = str.length; + const array = new Array(strLength); + + for (let i = 0; i < strLength; ++i) { + array[i] = str.charCodeAt(i); + } + + return array; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/suggestionList.mjs b/graphql-subscription/node_modules/graphql/jsutils/suggestionList.mjs new file mode 100644 index 0000000..c3dba2e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/suggestionList.mjs @@ -0,0 +1,130 @@ +import { naturalCompare } from './naturalCompare.mjs'; +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ + +export function suggestionList(input, options) { + const optionsByDistance = Object.create(null); + const lexicalDistance = new LexicalDistance(input); + const threshold = Math.floor(input.length * 0.4) + 1; + + for (const option of options) { + const distance = lexicalDistance.measure(option, threshold); + + if (distance !== undefined) { + optionsByDistance[option] = distance; + } + } + + return Object.keys(optionsByDistance).sort((a, b) => { + const distanceDiff = optionsByDistance[a] - optionsByDistance[b]; + return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b); + }); +} +/** + * Computes the lexical distance between strings A and B. + * + * The "distance" between two strings is given by counting the minimum number + * of edits needed to transform string A into string B. An edit can be an + * insertion, deletion, or substitution of a single character, or a swap of two + * adjacent characters. + * + * Includes a custom alteration from Damerau-Levenshtein to treat case changes + * as a single edit which helps identify mis-cased values with an edit distance + * of 1. + * + * This distance can be useful for detecting typos in input or sorting + */ + +class LexicalDistance { + constructor(input) { + this._input = input; + this._inputLowerCase = input.toLowerCase(); + this._inputArray = stringToArray(this._inputLowerCase); + this._rows = [ + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + ]; + } + + measure(option, threshold) { + if (this._input === option) { + return 0; + } + + const optionLowerCase = option.toLowerCase(); // Any case change counts as a single edit + + if (this._inputLowerCase === optionLowerCase) { + return 1; + } + + let a = stringToArray(optionLowerCase); + let b = this._inputArray; + + if (a.length < b.length) { + const tmp = a; + a = b; + b = tmp; + } + + const aLength = a.length; + const bLength = b.length; + + if (aLength - bLength > threshold) { + return undefined; + } + + const rows = this._rows; + + for (let j = 0; j <= bLength; j++) { + rows[0][j] = j; + } + + for (let i = 1; i <= aLength; i++) { + const upRow = rows[(i - 1) % 3]; + const currentRow = rows[i % 3]; + let smallestCell = (currentRow[0] = i); + + for (let j = 1; j <= bLength; j++) { + const cost = a[i - 1] === b[j - 1] ? 0 : 1; + let currentCell = Math.min( + upRow[j] + 1, // delete + currentRow[j - 1] + 1, // insert + upRow[j - 1] + cost, // substitute + ); + + if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { + // transposition + const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; + currentCell = Math.min(currentCell, doubleDiagonalCell + 1); + } + + if (currentCell < smallestCell) { + smallestCell = currentCell; + } + + currentRow[j] = currentCell; + } // Early exit, since distance can't go smaller than smallest element of the previous row. + + if (smallestCell > threshold) { + return undefined; + } + } + + const distance = rows[aLength % 3][bLength]; + return distance <= threshold ? distance : undefined; + } +} + +function stringToArray(str) { + const strLength = str.length; + const array = new Array(strLength); + + for (let i = 0; i < strLength; ++i) { + array[i] = str.charCodeAt(i); + } + + return array; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/toError.d.ts b/graphql-subscription/node_modules/graphql/jsutils/toError.d.ts new file mode 100644 index 0000000..f9c3729 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/toError.d.ts @@ -0,0 +1,4 @@ +/** + * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + */ +export declare function toError(thrownValue: unknown): Error; diff --git a/graphql-subscription/node_modules/graphql/jsutils/toError.js b/graphql-subscription/node_modules/graphql/jsutils/toError.js new file mode 100644 index 0000000..8a41830 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/toError.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.toError = toError; + +var _inspect = require('./inspect.js'); + +/** + * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + */ +function toError(thrownValue) { + return thrownValue instanceof Error + ? thrownValue + : new NonErrorThrown(thrownValue); +} + +class NonErrorThrown extends Error { + constructor(thrownValue) { + super('Unexpected error value: ' + (0, _inspect.inspect)(thrownValue)); + this.name = 'NonErrorThrown'; + this.thrownValue = thrownValue; + } +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/toError.mjs b/graphql-subscription/node_modules/graphql/jsutils/toError.mjs new file mode 100644 index 0000000..55173ba --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/toError.mjs @@ -0,0 +1,18 @@ +import { inspect } from './inspect.mjs'; +/** + * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + */ + +export function toError(thrownValue) { + return thrownValue instanceof Error + ? thrownValue + : new NonErrorThrown(thrownValue); +} + +class NonErrorThrown extends Error { + constructor(thrownValue) { + super('Unexpected error value: ' + inspect(thrownValue)); + this.name = 'NonErrorThrown'; + this.thrownValue = thrownValue; + } +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/toObjMap.d.ts b/graphql-subscription/node_modules/graphql/jsutils/toObjMap.d.ts new file mode 100644 index 0000000..457a1ec --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/toObjMap.d.ts @@ -0,0 +1,5 @@ +import type { Maybe } from './Maybe'; +import type { ReadOnlyObjMap, ReadOnlyObjMapLike } from './ObjMap'; +export declare function toObjMap( + obj: Maybe>, +): ReadOnlyObjMap; diff --git a/graphql-subscription/node_modules/graphql/jsutils/toObjMap.js b/graphql-subscription/node_modules/graphql/jsutils/toObjMap.js new file mode 100644 index 0000000..95b42ed --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/toObjMap.js @@ -0,0 +1,24 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.toObjMap = toObjMap; + +function toObjMap(obj) { + if (obj == null) { + return Object.create(null); + } + + if (Object.getPrototypeOf(obj) === null) { + return obj; + } + + const map = Object.create(null); + + for (const [key, value] of Object.entries(obj)) { + map[key] = value; + } + + return map; +} diff --git a/graphql-subscription/node_modules/graphql/jsutils/toObjMap.mjs b/graphql-subscription/node_modules/graphql/jsutils/toObjMap.mjs new file mode 100644 index 0000000..61a8284 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/jsutils/toObjMap.mjs @@ -0,0 +1,17 @@ +export function toObjMap(obj) { + if (obj == null) { + return Object.create(null); + } + + if (Object.getPrototypeOf(obj) === null) { + return obj; + } + + const map = Object.create(null); + + for (const [key, value] of Object.entries(obj)) { + map[key] = value; + } + + return map; +} diff --git a/graphql-subscription/node_modules/graphql/language/ast.d.ts b/graphql-subscription/node_modules/graphql/language/ast.d.ts new file mode 100644 index 0000000..7acf626 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/ast.d.ts @@ -0,0 +1,537 @@ +import type { Kind } from './kinds'; +import type { Source } from './source'; +import type { TokenKind } from './tokenKind'; +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +export declare class Location { + /** + * The character offset at which this Node begins. + */ + readonly start: number; + /** + * The character offset at which this Node ends. + */ + readonly end: number; + /** + * The Token at which this Node begins. + */ + readonly startToken: Token; + /** + * The Token at which this Node ends. + */ + readonly endToken: Token; + /** + * The Source document the AST represents. + */ + readonly source: Source; + constructor(startToken: Token, endToken: Token, source: Source); + get [Symbol.toStringTag](): string; + toJSON(): { + start: number; + end: number; + }; +} +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ +export declare class Token { + /** + * The kind of Token. + */ + readonly kind: TokenKind; + /** + * The character offset at which this Node begins. + */ + readonly start: number; + /** + * The character offset at which this Node ends. + */ + readonly end: number; + /** + * The 1-indexed line number on which this Token appears. + */ + readonly line: number; + /** + * The 1-indexed column number at which this Token begins. + */ + readonly column: number; + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + readonly value: string; + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + readonly prev: Token | null; + readonly next: Token | null; + constructor( + kind: TokenKind, + start: number, + end: number, + line: number, + column: number, + value?: string, + ); + get [Symbol.toStringTag](): string; + toJSON(): { + kind: TokenKind; + value?: string; + line: number; + column: number; + }; +} +/** + * The list of all possible AST node types. + */ +export declare type ASTNode = + | NameNode + | DocumentNode + | OperationDefinitionNode + | VariableDefinitionNode + | VariableNode + | SelectionSetNode + | FieldNode + | ArgumentNode + | FragmentSpreadNode + | InlineFragmentNode + | FragmentDefinitionNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode + | ObjectFieldNode + | DirectiveNode + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode + | SchemaDefinitionNode + | OperationTypeDefinitionNode + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | EnumValueDefinitionNode + | InputObjectTypeDefinitionNode + | DirectiveDefinitionNode + | SchemaExtensionNode + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; +/** + * Utility type listing all nodes indexed by their kind. + */ +export declare type ASTKindToNode = { + [NodeT in ASTNode as NodeT['kind']]: NodeT; +}; +/** + * @internal + */ +export declare const QueryDocumentKeys: { + [NodeT in ASTNode as NodeT['kind']]: ReadonlyArray; +}; +/** + * @internal + */ +export declare function isNode(maybeNode: any): maybeNode is ASTNode; +/** Name */ +export interface NameNode { + readonly kind: Kind.NAME; + readonly loc?: Location; + readonly value: string; +} +/** Document */ +export interface DocumentNode { + readonly kind: Kind.DOCUMENT; + readonly loc?: Location; + readonly definitions: ReadonlyArray; +} +export declare type DefinitionNode = + | ExecutableDefinitionNode + | TypeSystemDefinitionNode + | TypeSystemExtensionNode; +export declare type ExecutableDefinitionNode = + | OperationDefinitionNode + | FragmentDefinitionNode; +export interface OperationDefinitionNode { + readonly kind: Kind.OPERATION_DEFINITION; + readonly loc?: Location; + readonly operation: OperationTypeNode; + readonly name?: NameNode; + readonly variableDefinitions?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} +declare enum OperationTypeNode { + QUERY = 'query', + MUTATION = 'mutation', + SUBSCRIPTION = 'subscription', +} +export { OperationTypeNode }; +export interface VariableDefinitionNode { + readonly kind: Kind.VARIABLE_DEFINITION; + readonly loc?: Location; + readonly variable: VariableNode; + readonly type: TypeNode; + readonly defaultValue?: ConstValueNode; + readonly directives?: ReadonlyArray; +} +export interface VariableNode { + readonly kind: Kind.VARIABLE; + readonly loc?: Location; + readonly name: NameNode; +} +export interface SelectionSetNode { + kind: Kind.SELECTION_SET; + loc?: Location; + selections: ReadonlyArray; +} +export declare type SelectionNode = + | FieldNode + | FragmentSpreadNode + | InlineFragmentNode; +export interface FieldNode { + readonly kind: Kind.FIELD; + readonly loc?: Location; + readonly alias?: NameNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly selectionSet?: SelectionSetNode; +} +export interface ArgumentNode { + readonly kind: Kind.ARGUMENT; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ValueNode; +} +export interface ConstArgumentNode { + readonly kind: Kind.ARGUMENT; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ConstValueNode; +} +/** Fragments */ +export interface FragmentSpreadNode { + readonly kind: Kind.FRAGMENT_SPREAD; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface InlineFragmentNode { + readonly kind: Kind.INLINE_FRAGMENT; + readonly loc?: Location; + readonly typeCondition?: NamedTypeNode; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} +export interface FragmentDefinitionNode { + readonly kind: Kind.FRAGMENT_DEFINITION; + readonly loc?: Location; + readonly name: NameNode; + /** @deprecated variableDefinitions will be removed in v17.0.0 */ + readonly variableDefinitions?: ReadonlyArray; + readonly typeCondition: NamedTypeNode; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} +/** Values */ +export declare type ValueNode = + | VariableNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode; +export declare type ConstValueNode = + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ConstListValueNode + | ConstObjectValueNode; +export interface IntValueNode { + readonly kind: Kind.INT; + readonly loc?: Location; + readonly value: string; +} +export interface FloatValueNode { + readonly kind: Kind.FLOAT; + readonly loc?: Location; + readonly value: string; +} +export interface StringValueNode { + readonly kind: Kind.STRING; + readonly loc?: Location; + readonly value: string; + readonly block?: boolean; +} +export interface BooleanValueNode { + readonly kind: Kind.BOOLEAN; + readonly loc?: Location; + readonly value: boolean; +} +export interface NullValueNode { + readonly kind: Kind.NULL; + readonly loc?: Location; +} +export interface EnumValueNode { + readonly kind: Kind.ENUM; + readonly loc?: Location; + readonly value: string; +} +export interface ListValueNode { + readonly kind: Kind.LIST; + readonly loc?: Location; + readonly values: ReadonlyArray; +} +export interface ConstListValueNode { + readonly kind: Kind.LIST; + readonly loc?: Location; + readonly values: ReadonlyArray; +} +export interface ObjectValueNode { + readonly kind: Kind.OBJECT; + readonly loc?: Location; + readonly fields: ReadonlyArray; +} +export interface ConstObjectValueNode { + readonly kind: Kind.OBJECT; + readonly loc?: Location; + readonly fields: ReadonlyArray; +} +export interface ObjectFieldNode { + readonly kind: Kind.OBJECT_FIELD; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ValueNode; +} +export interface ConstObjectFieldNode { + readonly kind: Kind.OBJECT_FIELD; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ConstValueNode; +} +/** Directives */ +export interface DirectiveNode { + readonly kind: Kind.DIRECTIVE; + readonly loc?: Location; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; +} +export interface ConstDirectiveNode { + readonly kind: Kind.DIRECTIVE; + readonly loc?: Location; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; +} +/** Type Reference */ +export declare type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; +export interface NamedTypeNode { + readonly kind: Kind.NAMED_TYPE; + readonly loc?: Location; + readonly name: NameNode; +} +export interface ListTypeNode { + readonly kind: Kind.LIST_TYPE; + readonly loc?: Location; + readonly type: TypeNode; +} +export interface NonNullTypeNode { + readonly kind: Kind.NON_NULL_TYPE; + readonly loc?: Location; + readonly type: NamedTypeNode | ListTypeNode; +} +/** Type System Definition */ +export declare type TypeSystemDefinitionNode = + | SchemaDefinitionNode + | TypeDefinitionNode + | DirectiveDefinitionNode; +export interface SchemaDefinitionNode { + readonly kind: Kind.SCHEMA_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly directives?: ReadonlyArray; + readonly operationTypes: ReadonlyArray; +} +export interface OperationTypeDefinitionNode { + readonly kind: Kind.OPERATION_TYPE_DEFINITION; + readonly loc?: Location; + readonly operation: OperationTypeNode; + readonly type: NamedTypeNode; +} +/** Type Definition */ +export declare type TypeDefinitionNode = + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | InputObjectTypeDefinitionNode; +export interface ScalarTypeDefinitionNode { + readonly kind: Kind.SCALAR_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface ObjectTypeDefinitionNode { + readonly kind: Kind.OBJECT_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface FieldDefinitionNode { + readonly kind: Kind.FIELD_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly type: TypeNode; + readonly directives?: ReadonlyArray; +} +export interface InputValueDefinitionNode { + readonly kind: Kind.INPUT_VALUE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly type: TypeNode; + readonly defaultValue?: ConstValueNode; + readonly directives?: ReadonlyArray; +} +export interface InterfaceTypeDefinitionNode { + readonly kind: Kind.INTERFACE_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface UnionTypeDefinitionNode { + readonly kind: Kind.UNION_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly types?: ReadonlyArray; +} +export interface EnumTypeDefinitionNode { + readonly kind: Kind.ENUM_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly values?: ReadonlyArray; +} +export interface EnumValueDefinitionNode { + readonly kind: Kind.ENUM_VALUE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface InputObjectTypeDefinitionNode { + readonly kind: Kind.INPUT_OBJECT_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +/** Directive Definitions */ +export interface DirectiveDefinitionNode { + readonly kind: Kind.DIRECTIVE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly repeatable: boolean; + readonly locations: ReadonlyArray; +} +/** Type System Extensions */ +export declare type TypeSystemExtensionNode = + | SchemaExtensionNode + | TypeExtensionNode; +export interface SchemaExtensionNode { + readonly kind: Kind.SCHEMA_EXTENSION; + readonly loc?: Location; + readonly directives?: ReadonlyArray; + readonly operationTypes?: ReadonlyArray; +} +/** Type Extensions */ +export declare type TypeExtensionNode = + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; +export interface ScalarTypeExtensionNode { + readonly kind: Kind.SCALAR_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} +export interface ObjectTypeExtensionNode { + readonly kind: Kind.OBJECT_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface InterfaceTypeExtensionNode { + readonly kind: Kind.INTERFACE_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} +export interface UnionTypeExtensionNode { + readonly kind: Kind.UNION_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly types?: ReadonlyArray; +} +export interface EnumTypeExtensionNode { + readonly kind: Kind.ENUM_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly values?: ReadonlyArray; +} +export interface InputObjectTypeExtensionNode { + readonly kind: Kind.INPUT_OBJECT_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} diff --git a/graphql-subscription/node_modules/graphql/language/ast.js b/graphql-subscription/node_modules/graphql/language/ast.js new file mode 100644 index 0000000..eb3bac1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/ast.js @@ -0,0 +1,224 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Token = + exports.QueryDocumentKeys = + exports.OperationTypeNode = + exports.Location = + void 0; +exports.isNode = isNode; + +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +class Location { + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The Token at which this Node begins. + */ + + /** + * The Token at which this Node ends. + */ + + /** + * The Source document the AST represents. + */ + constructor(startToken, endToken, source) { + this.start = startToken.start; + this.end = endToken.end; + this.startToken = startToken; + this.endToken = endToken; + this.source = source; + } + + get [Symbol.toStringTag]() { + return 'Location'; + } + + toJSON() { + return { + start: this.start, + end: this.end, + }; + } +} +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ + +exports.Location = Location; + +class Token { + /** + * The kind of Token. + */ + + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The 1-indexed line number on which this Token appears. + */ + + /** + * The 1-indexed column number at which this Token begins. + */ + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + constructor(kind, start, end, line, column, value) { + this.kind = kind; + this.start = start; + this.end = end; + this.line = line; + this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + this.value = value; + this.prev = null; + this.next = null; + } + + get [Symbol.toStringTag]() { + return 'Token'; + } + + toJSON() { + return { + kind: this.kind, + value: this.value, + line: this.line, + column: this.column, + }; + } +} +/** + * The list of all possible AST node types. + */ + +exports.Token = Token; + +/** + * @internal + */ +const QueryDocumentKeys = { + Name: [], + Document: ['definitions'], + OperationDefinition: [ + 'name', + 'variableDefinitions', + 'directives', + 'selectionSet', + ], + VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], + Variable: ['name'], + SelectionSet: ['selections'], + Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], + Argument: ['name', 'value'], + FragmentSpread: ['name', 'directives'], + InlineFragment: ['typeCondition', 'directives', 'selectionSet'], + FragmentDefinition: [ + 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0 + 'variableDefinitions', + 'typeCondition', + 'directives', + 'selectionSet', + ], + IntValue: [], + FloatValue: [], + StringValue: [], + BooleanValue: [], + NullValue: [], + EnumValue: [], + ListValue: ['values'], + ObjectValue: ['fields'], + ObjectField: ['name', 'value'], + Directive: ['name', 'arguments'], + NamedType: ['name'], + ListType: ['type'], + NonNullType: ['type'], + SchemaDefinition: ['description', 'directives', 'operationTypes'], + OperationTypeDefinition: ['type'], + ScalarTypeDefinition: ['description', 'name', 'directives'], + ObjectTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], + InputValueDefinition: [ + 'description', + 'name', + 'type', + 'defaultValue', + 'directives', + ], + InterfaceTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + UnionTypeDefinition: ['description', 'name', 'directives', 'types'], + EnumTypeDefinition: ['description', 'name', 'directives', 'values'], + EnumValueDefinition: ['description', 'name', 'directives'], + InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], + DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], + SchemaExtension: ['directives', 'operationTypes'], + ScalarTypeExtension: ['name', 'directives'], + ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + UnionTypeExtension: ['name', 'directives', 'types'], + EnumTypeExtension: ['name', 'directives', 'values'], + InputObjectTypeExtension: ['name', 'directives', 'fields'], +}; +exports.QueryDocumentKeys = QueryDocumentKeys; +const kindValues = new Set(Object.keys(QueryDocumentKeys)); +/** + * @internal + */ + +function isNode(maybeNode) { + const maybeKind = + maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind; + return typeof maybeKind === 'string' && kindValues.has(maybeKind); +} +/** Name */ + +var OperationTypeNode; +exports.OperationTypeNode = OperationTypeNode; + +(function (OperationTypeNode) { + OperationTypeNode['QUERY'] = 'query'; + OperationTypeNode['MUTATION'] = 'mutation'; + OperationTypeNode['SUBSCRIPTION'] = 'subscription'; +})(OperationTypeNode || (exports.OperationTypeNode = OperationTypeNode = {})); diff --git a/graphql-subscription/node_modules/graphql/language/ast.mjs b/graphql-subscription/node_modules/graphql/language/ast.mjs new file mode 100644 index 0000000..d6d9ef2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/ast.mjs @@ -0,0 +1,208 @@ +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +export class Location { + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The Token at which this Node begins. + */ + + /** + * The Token at which this Node ends. + */ + + /** + * The Source document the AST represents. + */ + constructor(startToken, endToken, source) { + this.start = startToken.start; + this.end = endToken.end; + this.startToken = startToken; + this.endToken = endToken; + this.source = source; + } + + get [Symbol.toStringTag]() { + return 'Location'; + } + + toJSON() { + return { + start: this.start, + end: this.end, + }; + } +} +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ + +export class Token { + /** + * The kind of Token. + */ + + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The 1-indexed line number on which this Token appears. + */ + + /** + * The 1-indexed column number at which this Token begins. + */ + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + constructor(kind, start, end, line, column, value) { + this.kind = kind; + this.start = start; + this.end = end; + this.line = line; + this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + + this.value = value; + this.prev = null; + this.next = null; + } + + get [Symbol.toStringTag]() { + return 'Token'; + } + + toJSON() { + return { + kind: this.kind, + value: this.value, + line: this.line, + column: this.column, + }; + } +} +/** + * The list of all possible AST node types. + */ + +/** + * @internal + */ +export const QueryDocumentKeys = { + Name: [], + Document: ['definitions'], + OperationDefinition: [ + 'name', + 'variableDefinitions', + 'directives', + 'selectionSet', + ], + VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], + Variable: ['name'], + SelectionSet: ['selections'], + Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], + Argument: ['name', 'value'], + FragmentSpread: ['name', 'directives'], + InlineFragment: ['typeCondition', 'directives', 'selectionSet'], + FragmentDefinition: [ + 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0 + 'variableDefinitions', + 'typeCondition', + 'directives', + 'selectionSet', + ], + IntValue: [], + FloatValue: [], + StringValue: [], + BooleanValue: [], + NullValue: [], + EnumValue: [], + ListValue: ['values'], + ObjectValue: ['fields'], + ObjectField: ['name', 'value'], + Directive: ['name', 'arguments'], + NamedType: ['name'], + ListType: ['type'], + NonNullType: ['type'], + SchemaDefinition: ['description', 'directives', 'operationTypes'], + OperationTypeDefinition: ['type'], + ScalarTypeDefinition: ['description', 'name', 'directives'], + ObjectTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], + InputValueDefinition: [ + 'description', + 'name', + 'type', + 'defaultValue', + 'directives', + ], + InterfaceTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + UnionTypeDefinition: ['description', 'name', 'directives', 'types'], + EnumTypeDefinition: ['description', 'name', 'directives', 'values'], + EnumValueDefinition: ['description', 'name', 'directives'], + InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], + DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], + SchemaExtension: ['directives', 'operationTypes'], + ScalarTypeExtension: ['name', 'directives'], + ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + UnionTypeExtension: ['name', 'directives', 'types'], + EnumTypeExtension: ['name', 'directives', 'values'], + InputObjectTypeExtension: ['name', 'directives', 'fields'], +}; +const kindValues = new Set(Object.keys(QueryDocumentKeys)); +/** + * @internal + */ + +export function isNode(maybeNode) { + const maybeKind = + maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind; + return typeof maybeKind === 'string' && kindValues.has(maybeKind); +} +/** Name */ + +var OperationTypeNode; + +(function (OperationTypeNode) { + OperationTypeNode['QUERY'] = 'query'; + OperationTypeNode['MUTATION'] = 'mutation'; + OperationTypeNode['SUBSCRIPTION'] = 'subscription'; +})(OperationTypeNode || (OperationTypeNode = {})); + +export { OperationTypeNode }; diff --git a/graphql-subscription/node_modules/graphql/language/blockString.d.ts b/graphql-subscription/node_modules/graphql/language/blockString.d.ts new file mode 100644 index 0000000..8441d8b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/blockString.d.ts @@ -0,0 +1,28 @@ +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ +export declare function dedentBlockStringLines( + lines: ReadonlyArray, +): Array; +/** + * @internal + */ +export declare function isPrintableAsBlockString(value: string): boolean; +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ +export declare function printBlockString( + value: string, + options?: { + minimize?: boolean; + }, +): string; diff --git a/graphql-subscription/node_modules/graphql/language/blockString.js b/graphql-subscription/node_modules/graphql/language/blockString.js new file mode 100644 index 0000000..a3f1ea8 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/blockString.js @@ -0,0 +1,195 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.dedentBlockStringLines = dedentBlockStringLines; +exports.isPrintableAsBlockString = isPrintableAsBlockString; +exports.printBlockString = printBlockString; + +var _characterClasses = require('./characterClasses.js'); + +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ +function dedentBlockStringLines(lines) { + var _firstNonEmptyLine2; + + let commonIndent = Number.MAX_SAFE_INTEGER; + let firstNonEmptyLine = null; + let lastNonEmptyLine = -1; + + for (let i = 0; i < lines.length; ++i) { + var _firstNonEmptyLine; + + const line = lines[i]; + const indent = leadingWhitespace(line); + + if (indent === line.length) { + continue; // skip empty lines + } + + firstNonEmptyLine = + (_firstNonEmptyLine = firstNonEmptyLine) !== null && + _firstNonEmptyLine !== void 0 + ? _firstNonEmptyLine + : i; + lastNonEmptyLine = i; + + if (i !== 0 && indent < commonIndent) { + commonIndent = indent; + } + } + + return lines // Remove common indentation from all lines but first. + .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines. + .slice( + (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && + _firstNonEmptyLine2 !== void 0 + ? _firstNonEmptyLine2 + : 0, + lastNonEmptyLine + 1, + ); +} + +function leadingWhitespace(str) { + let i = 0; + + while ( + i < str.length && + (0, _characterClasses.isWhiteSpace)(str.charCodeAt(i)) + ) { + ++i; + } + + return i; +} +/** + * @internal + */ + +function isPrintableAsBlockString(value) { + if (value === '') { + return true; // empty string is printable + } + + let isEmptyLine = true; + let hasIndent = false; + let hasCommonIndent = true; + let seenNonEmptyLine = false; + + for (let i = 0; i < value.length; ++i) { + switch (value.codePointAt(i)) { + case 0x0000: + case 0x0001: + case 0x0002: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + case 0x0008: + case 0x000b: + case 0x000c: + case 0x000e: + case 0x000f: + return false; + // Has non-printable characters + + case 0x000d: + // \r + return false; + // Has \r or \r\n which will be replaced as \n + + case 10: + // \n + if (isEmptyLine && !seenNonEmptyLine) { + return false; // Has leading new line + } + + seenNonEmptyLine = true; + isEmptyLine = true; + hasIndent = false; + break; + + case 9: // \t + + case 32: + // + hasIndent || (hasIndent = isEmptyLine); + break; + + default: + hasCommonIndent && (hasCommonIndent = hasIndent); + isEmptyLine = false; + } + } + + if (isEmptyLine) { + return false; // Has trailing empty lines + } + + if (hasCommonIndent && seenNonEmptyLine) { + return false; // Has internal indent + } + + return true; +} +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ + +function printBlockString(value, options) { + const escapedValue = value.replace(/"""/g, '\\"""'); // Expand a block string's raw value into independent lines. + + const lines = escapedValue.split(/\r\n|[\n\r]/g); + const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line + + const forceLeadingNewLine = + lines.length > 1 && + lines + .slice(1) + .every( + (line) => + line.length === 0 || + (0, _characterClasses.isWhiteSpace)(line.charCodeAt(0)), + ); // Trailing triple quotes just looks confusing but doesn't force trailing new line + + const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); // Trailing quote (single or double) or slash forces trailing new line + + const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; + const hasTrailingSlash = value.endsWith('\\'); + const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; + const printAsMultipleLines = + !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability + (!isSingleLine || + value.length > 70 || + forceTrailingNewline || + forceLeadingNewLine || + hasTrailingTripleQuotes); + let result = ''; // Format a multi-line block quote to account for leading space. + + const skipLeadingNewLine = + isSingleLine && (0, _characterClasses.isWhiteSpace)(value.charCodeAt(0)); + + if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) { + result += '\n'; + } + + result += escapedValue; + + if (printAsMultipleLines || forceTrailingNewline) { + result += '\n'; + } + + return '"""' + result + '"""'; +} diff --git a/graphql-subscription/node_modules/graphql/language/blockString.mjs b/graphql-subscription/node_modules/graphql/language/blockString.mjs new file mode 100644 index 0000000..e050d7f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/blockString.mjs @@ -0,0 +1,178 @@ +import { isWhiteSpace } from './characterClasses.mjs'; +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ + +export function dedentBlockStringLines(lines) { + var _firstNonEmptyLine2; + + let commonIndent = Number.MAX_SAFE_INTEGER; + let firstNonEmptyLine = null; + let lastNonEmptyLine = -1; + + for (let i = 0; i < lines.length; ++i) { + var _firstNonEmptyLine; + + const line = lines[i]; + const indent = leadingWhitespace(line); + + if (indent === line.length) { + continue; // skip empty lines + } + + firstNonEmptyLine = + (_firstNonEmptyLine = firstNonEmptyLine) !== null && + _firstNonEmptyLine !== void 0 + ? _firstNonEmptyLine + : i; + lastNonEmptyLine = i; + + if (i !== 0 && indent < commonIndent) { + commonIndent = indent; + } + } + + return lines // Remove common indentation from all lines but first. + .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines. + .slice( + (_firstNonEmptyLine2 = firstNonEmptyLine) !== null && + _firstNonEmptyLine2 !== void 0 + ? _firstNonEmptyLine2 + : 0, + lastNonEmptyLine + 1, + ); +} + +function leadingWhitespace(str) { + let i = 0; + + while (i < str.length && isWhiteSpace(str.charCodeAt(i))) { + ++i; + } + + return i; +} +/** + * @internal + */ + +export function isPrintableAsBlockString(value) { + if (value === '') { + return true; // empty string is printable + } + + let isEmptyLine = true; + let hasIndent = false; + let hasCommonIndent = true; + let seenNonEmptyLine = false; + + for (let i = 0; i < value.length; ++i) { + switch (value.codePointAt(i)) { + case 0x0000: + case 0x0001: + case 0x0002: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + case 0x0008: + case 0x000b: + case 0x000c: + case 0x000e: + case 0x000f: + return false; + // Has non-printable characters + + case 0x000d: + // \r + return false; + // Has \r or \r\n which will be replaced as \n + + case 10: + // \n + if (isEmptyLine && !seenNonEmptyLine) { + return false; // Has leading new line + } + + seenNonEmptyLine = true; + isEmptyLine = true; + hasIndent = false; + break; + + case 9: // \t + + case 32: + // + hasIndent || (hasIndent = isEmptyLine); + break; + + default: + hasCommonIndent && (hasCommonIndent = hasIndent); + isEmptyLine = false; + } + } + + if (isEmptyLine) { + return false; // Has trailing empty lines + } + + if (hasCommonIndent && seenNonEmptyLine) { + return false; // Has internal indent + } + + return true; +} +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ + +export function printBlockString(value, options) { + const escapedValue = value.replace(/"""/g, '\\"""'); // Expand a block string's raw value into independent lines. + + const lines = escapedValue.split(/\r\n|[\n\r]/g); + const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line + + const forceLeadingNewLine = + lines.length > 1 && + lines + .slice(1) + .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line + + const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); // Trailing quote (single or double) or slash forces trailing new line + + const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; + const hasTrailingSlash = value.endsWith('\\'); + const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; + const printAsMultipleLines = + !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability + (!isSingleLine || + value.length > 70 || + forceTrailingNewline || + forceLeadingNewLine || + hasTrailingTripleQuotes); + let result = ''; // Format a multi-line block quote to account for leading space. + + const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0)); + + if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) { + result += '\n'; + } + + result += escapedValue; + + if (printAsMultipleLines || forceTrailingNewline) { + result += '\n'; + } + + return '"""' + result + '"""'; +} diff --git a/graphql-subscription/node_modules/graphql/language/characterClasses.d.ts b/graphql-subscription/node_modules/graphql/language/characterClasses.d.ts new file mode 100644 index 0000000..1e5da8a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/characterClasses.d.ts @@ -0,0 +1,47 @@ +/** + * ``` + * WhiteSpace :: + * - "Horizontal Tab (U+0009)" + * - "Space (U+0020)" + * ``` + * @internal + */ +export declare function isWhiteSpace(code: number): boolean; +/** + * ``` + * Digit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * ``` + * @internal + */ +export declare function isDigit(code: number): boolean; +/** + * ``` + * Letter :: one of + * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` + * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` + * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` + * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` + * ``` + * @internal + */ +export declare function isLetter(code: number): boolean; +/** + * ``` + * NameStart :: + * - Letter + * - `_` + * ``` + * @internal + */ +export declare function isNameStart(code: number): boolean; +/** + * ``` + * NameContinue :: + * - Letter + * - Digit + * - `_` + * ``` + * @internal + */ +export declare function isNameContinue(code: number): boolean; diff --git a/graphql-subscription/node_modules/graphql/language/characterClasses.js b/graphql-subscription/node_modules/graphql/language/characterClasses.js new file mode 100644 index 0000000..075f740 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/characterClasses.js @@ -0,0 +1,75 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isDigit = isDigit; +exports.isLetter = isLetter; +exports.isNameContinue = isNameContinue; +exports.isNameStart = isNameStart; +exports.isWhiteSpace = isWhiteSpace; + +/** + * ``` + * WhiteSpace :: + * - "Horizontal Tab (U+0009)" + * - "Space (U+0020)" + * ``` + * @internal + */ +function isWhiteSpace(code) { + return code === 0x0009 || code === 0x0020; +} +/** + * ``` + * Digit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * ``` + * @internal + */ + +function isDigit(code) { + return code >= 0x0030 && code <= 0x0039; +} +/** + * ``` + * Letter :: one of + * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` + * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` + * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` + * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` + * ``` + * @internal + */ + +function isLetter(code) { + return ( + (code >= 0x0061 && code <= 0x007a) || // A-Z + (code >= 0x0041 && code <= 0x005a) // a-z + ); +} +/** + * ``` + * NameStart :: + * - Letter + * - `_` + * ``` + * @internal + */ + +function isNameStart(code) { + return isLetter(code) || code === 0x005f; +} +/** + * ``` + * NameContinue :: + * - Letter + * - Digit + * - `_` + * ``` + * @internal + */ + +function isNameContinue(code) { + return isLetter(code) || isDigit(code) || code === 0x005f; +} diff --git a/graphql-subscription/node_modules/graphql/language/characterClasses.mjs b/graphql-subscription/node_modules/graphql/language/characterClasses.mjs new file mode 100644 index 0000000..c75777a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/characterClasses.mjs @@ -0,0 +1,64 @@ +/** + * ``` + * WhiteSpace :: + * - "Horizontal Tab (U+0009)" + * - "Space (U+0020)" + * ``` + * @internal + */ +export function isWhiteSpace(code) { + return code === 0x0009 || code === 0x0020; +} +/** + * ``` + * Digit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * ``` + * @internal + */ + +export function isDigit(code) { + return code >= 0x0030 && code <= 0x0039; +} +/** + * ``` + * Letter :: one of + * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` + * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` + * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` + * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` + * ``` + * @internal + */ + +export function isLetter(code) { + return ( + (code >= 0x0061 && code <= 0x007a) || // A-Z + (code >= 0x0041 && code <= 0x005a) // a-z + ); +} +/** + * ``` + * NameStart :: + * - Letter + * - `_` + * ``` + * @internal + */ + +export function isNameStart(code) { + return isLetter(code) || code === 0x005f; +} +/** + * ``` + * NameContinue :: + * - Letter + * - Digit + * - `_` + * ``` + * @internal + */ + +export function isNameContinue(code) { + return isLetter(code) || isDigit(code) || code === 0x005f; +} diff --git a/graphql-subscription/node_modules/graphql/language/directiveLocation.d.ts b/graphql-subscription/node_modules/graphql/language/directiveLocation.d.ts new file mode 100644 index 0000000..73d944f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/directiveLocation.d.ts @@ -0,0 +1,33 @@ +/** + * The set of allowed directive location values. + */ +declare enum DirectiveLocation { + /** Request Definitions */ + QUERY = 'QUERY', + MUTATION = 'MUTATION', + SUBSCRIPTION = 'SUBSCRIPTION', + FIELD = 'FIELD', + FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION', + FRAGMENT_SPREAD = 'FRAGMENT_SPREAD', + INLINE_FRAGMENT = 'INLINE_FRAGMENT', + VARIABLE_DEFINITION = 'VARIABLE_DEFINITION', + /** Type System Definitions */ + SCHEMA = 'SCHEMA', + SCALAR = 'SCALAR', + OBJECT = 'OBJECT', + FIELD_DEFINITION = 'FIELD_DEFINITION', + ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION', + INTERFACE = 'INTERFACE', + UNION = 'UNION', + ENUM = 'ENUM', + ENUM_VALUE = 'ENUM_VALUE', + INPUT_OBJECT = 'INPUT_OBJECT', + INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION', +} +export { DirectiveLocation }; +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ +export declare type DirectiveLocationEnum = typeof DirectiveLocation; diff --git a/graphql-subscription/node_modules/graphql/language/directiveLocation.js b/graphql-subscription/node_modules/graphql/language/directiveLocation.js new file mode 100644 index 0000000..beff283 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/directiveLocation.js @@ -0,0 +1,39 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.DirectiveLocation = void 0; + +/** + * The set of allowed directive location values. + */ +var DirectiveLocation; +exports.DirectiveLocation = DirectiveLocation; + +(function (DirectiveLocation) { + DirectiveLocation['QUERY'] = 'QUERY'; + DirectiveLocation['MUTATION'] = 'MUTATION'; + DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION'; + DirectiveLocation['FIELD'] = 'FIELD'; + DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION'; + DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD'; + DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT'; + DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION'; + DirectiveLocation['SCHEMA'] = 'SCHEMA'; + DirectiveLocation['SCALAR'] = 'SCALAR'; + DirectiveLocation['OBJECT'] = 'OBJECT'; + DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION'; + DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION'; + DirectiveLocation['INTERFACE'] = 'INTERFACE'; + DirectiveLocation['UNION'] = 'UNION'; + DirectiveLocation['ENUM'] = 'ENUM'; + DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE'; + DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT'; + DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION'; +})(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {})); +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ diff --git a/graphql-subscription/node_modules/graphql/language/directiveLocation.mjs b/graphql-subscription/node_modules/graphql/language/directiveLocation.mjs new file mode 100644 index 0000000..31bfbb1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/directiveLocation.mjs @@ -0,0 +1,33 @@ +/** + * The set of allowed directive location values. + */ +var DirectiveLocation; + +(function (DirectiveLocation) { + DirectiveLocation['QUERY'] = 'QUERY'; + DirectiveLocation['MUTATION'] = 'MUTATION'; + DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION'; + DirectiveLocation['FIELD'] = 'FIELD'; + DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION'; + DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD'; + DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT'; + DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION'; + DirectiveLocation['SCHEMA'] = 'SCHEMA'; + DirectiveLocation['SCALAR'] = 'SCALAR'; + DirectiveLocation['OBJECT'] = 'OBJECT'; + DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION'; + DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION'; + DirectiveLocation['INTERFACE'] = 'INTERFACE'; + DirectiveLocation['UNION'] = 'UNION'; + DirectiveLocation['ENUM'] = 'ENUM'; + DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE'; + DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT'; + DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION'; +})(DirectiveLocation || (DirectiveLocation = {})); + +export { DirectiveLocation }; +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ diff --git a/graphql-subscription/node_modules/graphql/language/index.d.ts b/graphql-subscription/node_modules/graphql/language/index.d.ts new file mode 100644 index 0000000..93d9529 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/index.d.ts @@ -0,0 +1,97 @@ +export { Source } from './source'; +export { getLocation } from './location'; +export type { SourceLocation } from './location'; +export { printLocation, printSourceLocation } from './printLocation'; +export { Kind } from './kinds'; +export type { KindEnum } from './kinds'; +export { TokenKind } from './tokenKind'; +export type { TokenKindEnum } from './tokenKind'; +export { Lexer } from './lexer'; +export { parse, parseValue, parseConstValue, parseType } from './parser'; +export type { ParseOptions } from './parser'; +export { print } from './printer'; +export { + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, +} from './visitor'; +export type { ASTVisitor, ASTVisitFn, ASTVisitorKeyMap } from './visitor'; +export { Location, Token, OperationTypeNode } from './ast'; +export type { + ASTNode, + ASTKindToNode, + NameNode, + DocumentNode, + DefinitionNode, + ExecutableDefinitionNode, + OperationDefinitionNode, + VariableDefinitionNode, + VariableNode, + SelectionSetNode, + SelectionNode, + FieldNode, + ArgumentNode, + ConstArgumentNode, + FragmentSpreadNode, + InlineFragmentNode, + FragmentDefinitionNode, + ValueNode, + ConstValueNode, + IntValueNode, + FloatValueNode, + StringValueNode, + BooleanValueNode, + NullValueNode, + EnumValueNode, + ListValueNode, + ConstListValueNode, + ObjectValueNode, + ConstObjectValueNode, + ObjectFieldNode, + ConstObjectFieldNode, + DirectiveNode, + ConstDirectiveNode, + TypeNode, + NamedTypeNode, + ListTypeNode, + NonNullTypeNode, + TypeSystemDefinitionNode, + SchemaDefinitionNode, + OperationTypeDefinitionNode, + TypeDefinitionNode, + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + DirectiveDefinitionNode, + TypeSystemExtensionNode, + SchemaExtensionNode, + TypeExtensionNode, + ScalarTypeExtensionNode, + ObjectTypeExtensionNode, + InterfaceTypeExtensionNode, + UnionTypeExtensionNode, + EnumTypeExtensionNode, + InputObjectTypeExtensionNode, +} from './ast'; +export { + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './predicates'; +export { DirectiveLocation } from './directiveLocation'; +export type { DirectiveLocationEnum } from './directiveLocation'; diff --git a/graphql-subscription/node_modules/graphql/language/index.js b/graphql-subscription/node_modules/graphql/language/index.js new file mode 100644 index 0000000..b597925 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/index.js @@ -0,0 +1,215 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'BREAK', { + enumerable: true, + get: function () { + return _visitor.BREAK; + }, +}); +Object.defineProperty(exports, 'DirectiveLocation', { + enumerable: true, + get: function () { + return _directiveLocation.DirectiveLocation; + }, +}); +Object.defineProperty(exports, 'Kind', { + enumerable: true, + get: function () { + return _kinds.Kind; + }, +}); +Object.defineProperty(exports, 'Lexer', { + enumerable: true, + get: function () { + return _lexer.Lexer; + }, +}); +Object.defineProperty(exports, 'Location', { + enumerable: true, + get: function () { + return _ast.Location; + }, +}); +Object.defineProperty(exports, 'OperationTypeNode', { + enumerable: true, + get: function () { + return _ast.OperationTypeNode; + }, +}); +Object.defineProperty(exports, 'Source', { + enumerable: true, + get: function () { + return _source.Source; + }, +}); +Object.defineProperty(exports, 'Token', { + enumerable: true, + get: function () { + return _ast.Token; + }, +}); +Object.defineProperty(exports, 'TokenKind', { + enumerable: true, + get: function () { + return _tokenKind.TokenKind; + }, +}); +Object.defineProperty(exports, 'getEnterLeaveForKind', { + enumerable: true, + get: function () { + return _visitor.getEnterLeaveForKind; + }, +}); +Object.defineProperty(exports, 'getLocation', { + enumerable: true, + get: function () { + return _location.getLocation; + }, +}); +Object.defineProperty(exports, 'getVisitFn', { + enumerable: true, + get: function () { + return _visitor.getVisitFn; + }, +}); +Object.defineProperty(exports, 'isConstValueNode', { + enumerable: true, + get: function () { + return _predicates.isConstValueNode; + }, +}); +Object.defineProperty(exports, 'isDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isExecutableDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isExecutableDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isSelectionNode', { + enumerable: true, + get: function () { + return _predicates.isSelectionNode; + }, +}); +Object.defineProperty(exports, 'isTypeDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeExtensionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeExtensionNode; + }, +}); +Object.defineProperty(exports, 'isTypeNode', { + enumerable: true, + get: function () { + return _predicates.isTypeNode; + }, +}); +Object.defineProperty(exports, 'isTypeSystemDefinitionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeSystemDefinitionNode; + }, +}); +Object.defineProperty(exports, 'isTypeSystemExtensionNode', { + enumerable: true, + get: function () { + return _predicates.isTypeSystemExtensionNode; + }, +}); +Object.defineProperty(exports, 'isValueNode', { + enumerable: true, + get: function () { + return _predicates.isValueNode; + }, +}); +Object.defineProperty(exports, 'parse', { + enumerable: true, + get: function () { + return _parser.parse; + }, +}); +Object.defineProperty(exports, 'parseConstValue', { + enumerable: true, + get: function () { + return _parser.parseConstValue; + }, +}); +Object.defineProperty(exports, 'parseType', { + enumerable: true, + get: function () { + return _parser.parseType; + }, +}); +Object.defineProperty(exports, 'parseValue', { + enumerable: true, + get: function () { + return _parser.parseValue; + }, +}); +Object.defineProperty(exports, 'print', { + enumerable: true, + get: function () { + return _printer.print; + }, +}); +Object.defineProperty(exports, 'printLocation', { + enumerable: true, + get: function () { + return _printLocation.printLocation; + }, +}); +Object.defineProperty(exports, 'printSourceLocation', { + enumerable: true, + get: function () { + return _printLocation.printSourceLocation; + }, +}); +Object.defineProperty(exports, 'visit', { + enumerable: true, + get: function () { + return _visitor.visit; + }, +}); +Object.defineProperty(exports, 'visitInParallel', { + enumerable: true, + get: function () { + return _visitor.visitInParallel; + }, +}); + +var _source = require('./source.js'); + +var _location = require('./location.js'); + +var _printLocation = require('./printLocation.js'); + +var _kinds = require('./kinds.js'); + +var _tokenKind = require('./tokenKind.js'); + +var _lexer = require('./lexer.js'); + +var _parser = require('./parser.js'); + +var _printer = require('./printer.js'); + +var _visitor = require('./visitor.js'); + +var _ast = require('./ast.js'); + +var _predicates = require('./predicates.js'); + +var _directiveLocation = require('./directiveLocation.js'); diff --git a/graphql-subscription/node_modules/graphql/language/index.mjs b/graphql-subscription/node_modules/graphql/language/index.mjs new file mode 100644 index 0000000..3f23c6c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/index.mjs @@ -0,0 +1,29 @@ +export { Source } from './source.mjs'; +export { getLocation } from './location.mjs'; +export { printLocation, printSourceLocation } from './printLocation.mjs'; +export { Kind } from './kinds.mjs'; +export { TokenKind } from './tokenKind.mjs'; +export { Lexer } from './lexer.mjs'; +export { parse, parseValue, parseConstValue, parseType } from './parser.mjs'; +export { print } from './printer.mjs'; +export { + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, +} from './visitor.mjs'; +export { Location, Token, OperationTypeNode } from './ast.mjs'; +export { + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './predicates.mjs'; +export { DirectiveLocation } from './directiveLocation.mjs'; diff --git a/graphql-subscription/node_modules/graphql/language/kinds.d.ts b/graphql-subscription/node_modules/graphql/language/kinds.d.ts new file mode 100644 index 0000000..6848fa7 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/kinds.d.ts @@ -0,0 +1,66 @@ +/** + * The set of allowed kind values for AST nodes. + */ +declare enum Kind { + /** Name */ + NAME = 'Name', + /** Document */ + DOCUMENT = 'Document', + OPERATION_DEFINITION = 'OperationDefinition', + VARIABLE_DEFINITION = 'VariableDefinition', + SELECTION_SET = 'SelectionSet', + FIELD = 'Field', + ARGUMENT = 'Argument', + /** Fragments */ + FRAGMENT_SPREAD = 'FragmentSpread', + INLINE_FRAGMENT = 'InlineFragment', + FRAGMENT_DEFINITION = 'FragmentDefinition', + /** Values */ + VARIABLE = 'Variable', + INT = 'IntValue', + FLOAT = 'FloatValue', + STRING = 'StringValue', + BOOLEAN = 'BooleanValue', + NULL = 'NullValue', + ENUM = 'EnumValue', + LIST = 'ListValue', + OBJECT = 'ObjectValue', + OBJECT_FIELD = 'ObjectField', + /** Directives */ + DIRECTIVE = 'Directive', + /** Types */ + NAMED_TYPE = 'NamedType', + LIST_TYPE = 'ListType', + NON_NULL_TYPE = 'NonNullType', + /** Type System Definitions */ + SCHEMA_DEFINITION = 'SchemaDefinition', + OPERATION_TYPE_DEFINITION = 'OperationTypeDefinition', + /** Type Definitions */ + SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition', + OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition', + FIELD_DEFINITION = 'FieldDefinition', + INPUT_VALUE_DEFINITION = 'InputValueDefinition', + INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition', + UNION_TYPE_DEFINITION = 'UnionTypeDefinition', + ENUM_TYPE_DEFINITION = 'EnumTypeDefinition', + ENUM_VALUE_DEFINITION = 'EnumValueDefinition', + INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition', + /** Directive Definitions */ + DIRECTIVE_DEFINITION = 'DirectiveDefinition', + /** Type System Extensions */ + SCHEMA_EXTENSION = 'SchemaExtension', + /** Type Extensions */ + SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension', + OBJECT_TYPE_EXTENSION = 'ObjectTypeExtension', + INTERFACE_TYPE_EXTENSION = 'InterfaceTypeExtension', + UNION_TYPE_EXTENSION = 'UnionTypeExtension', + ENUM_TYPE_EXTENSION = 'EnumTypeExtension', + INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension', +} +export { Kind }; +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ +export declare type KindEnum = typeof Kind; diff --git a/graphql-subscription/node_modules/graphql/language/kinds.js b/graphql-subscription/node_modules/graphql/language/kinds.js new file mode 100644 index 0000000..6423403 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/kinds.js @@ -0,0 +1,63 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Kind = void 0; + +/** + * The set of allowed kind values for AST nodes. + */ +var Kind; +exports.Kind = Kind; + +(function (Kind) { + Kind['NAME'] = 'Name'; + Kind['DOCUMENT'] = 'Document'; + Kind['OPERATION_DEFINITION'] = 'OperationDefinition'; + Kind['VARIABLE_DEFINITION'] = 'VariableDefinition'; + Kind['SELECTION_SET'] = 'SelectionSet'; + Kind['FIELD'] = 'Field'; + Kind['ARGUMENT'] = 'Argument'; + Kind['FRAGMENT_SPREAD'] = 'FragmentSpread'; + Kind['INLINE_FRAGMENT'] = 'InlineFragment'; + Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition'; + Kind['VARIABLE'] = 'Variable'; + Kind['INT'] = 'IntValue'; + Kind['FLOAT'] = 'FloatValue'; + Kind['STRING'] = 'StringValue'; + Kind['BOOLEAN'] = 'BooleanValue'; + Kind['NULL'] = 'NullValue'; + Kind['ENUM'] = 'EnumValue'; + Kind['LIST'] = 'ListValue'; + Kind['OBJECT'] = 'ObjectValue'; + Kind['OBJECT_FIELD'] = 'ObjectField'; + Kind['DIRECTIVE'] = 'Directive'; + Kind['NAMED_TYPE'] = 'NamedType'; + Kind['LIST_TYPE'] = 'ListType'; + Kind['NON_NULL_TYPE'] = 'NonNullType'; + Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition'; + Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition'; + Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition'; + Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition'; + Kind['FIELD_DEFINITION'] = 'FieldDefinition'; + Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition'; + Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition'; + Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition'; + Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition'; + Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition'; + Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition'; + Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition'; + Kind['SCHEMA_EXTENSION'] = 'SchemaExtension'; + Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension'; + Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension'; + Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension'; + Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension'; + Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension'; + Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension'; +})(Kind || (exports.Kind = Kind = {})); +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ diff --git a/graphql-subscription/node_modules/graphql/language/kinds.mjs b/graphql-subscription/node_modules/graphql/language/kinds.mjs new file mode 100644 index 0000000..3205eae --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/kinds.mjs @@ -0,0 +1,57 @@ +/** + * The set of allowed kind values for AST nodes. + */ +var Kind; + +(function (Kind) { + Kind['NAME'] = 'Name'; + Kind['DOCUMENT'] = 'Document'; + Kind['OPERATION_DEFINITION'] = 'OperationDefinition'; + Kind['VARIABLE_DEFINITION'] = 'VariableDefinition'; + Kind['SELECTION_SET'] = 'SelectionSet'; + Kind['FIELD'] = 'Field'; + Kind['ARGUMENT'] = 'Argument'; + Kind['FRAGMENT_SPREAD'] = 'FragmentSpread'; + Kind['INLINE_FRAGMENT'] = 'InlineFragment'; + Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition'; + Kind['VARIABLE'] = 'Variable'; + Kind['INT'] = 'IntValue'; + Kind['FLOAT'] = 'FloatValue'; + Kind['STRING'] = 'StringValue'; + Kind['BOOLEAN'] = 'BooleanValue'; + Kind['NULL'] = 'NullValue'; + Kind['ENUM'] = 'EnumValue'; + Kind['LIST'] = 'ListValue'; + Kind['OBJECT'] = 'ObjectValue'; + Kind['OBJECT_FIELD'] = 'ObjectField'; + Kind['DIRECTIVE'] = 'Directive'; + Kind['NAMED_TYPE'] = 'NamedType'; + Kind['LIST_TYPE'] = 'ListType'; + Kind['NON_NULL_TYPE'] = 'NonNullType'; + Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition'; + Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition'; + Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition'; + Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition'; + Kind['FIELD_DEFINITION'] = 'FieldDefinition'; + Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition'; + Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition'; + Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition'; + Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition'; + Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition'; + Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition'; + Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition'; + Kind['SCHEMA_EXTENSION'] = 'SchemaExtension'; + Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension'; + Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension'; + Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension'; + Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension'; + Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension'; + Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension'; +})(Kind || (Kind = {})); + +export { Kind }; +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ diff --git a/graphql-subscription/node_modules/graphql/language/lexer.d.ts b/graphql-subscription/node_modules/graphql/language/lexer.d.ts new file mode 100644 index 0000000..14abf38 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/lexer.d.ts @@ -0,0 +1,45 @@ +import { Token } from './ast'; +import type { Source } from './source'; +import { TokenKind } from './tokenKind'; +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ +export declare class Lexer { + source: Source; + /** + * The previously focused non-ignored token. + */ + lastToken: Token; + /** + * The currently focused non-ignored token. + */ + token: Token; + /** + * The (1-indexed) line containing the current token. + */ + line: number; + /** + * The character offset at which the current line begins. + */ + lineStart: number; + constructor(source: Source); + get [Symbol.toStringTag](): string; + /** + * Advances the token stream to the next non-ignored token. + */ + advance(): Token; + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + lookahead(): Token; +} +/** + * @internal + */ +export declare function isPunctuatorTokenKind(kind: TokenKind): boolean; diff --git a/graphql-subscription/node_modules/graphql/language/lexer.js b/graphql-subscription/node_modules/graphql/language/lexer.js new file mode 100644 index 0000000..08cea79 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/lexer.js @@ -0,0 +1,1006 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Lexer = void 0; +exports.isPunctuatorTokenKind = isPunctuatorTokenKind; + +var _syntaxError = require('../error/syntaxError.js'); + +var _ast = require('./ast.js'); + +var _blockString = require('./blockString.js'); + +var _characterClasses = require('./characterClasses.js'); + +var _tokenKind = require('./tokenKind.js'); + +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ +class Lexer { + /** + * The previously focused non-ignored token. + */ + + /** + * The currently focused non-ignored token. + */ + + /** + * The (1-indexed) line containing the current token. + */ + + /** + * The character offset at which the current line begins. + */ + constructor(source) { + const startOfFileToken = new _ast.Token( + _tokenKind.TokenKind.SOF, + 0, + 0, + 0, + 0, + ); + this.source = source; + this.lastToken = startOfFileToken; + this.token = startOfFileToken; + this.line = 1; + this.lineStart = 0; + } + + get [Symbol.toStringTag]() { + return 'Lexer'; + } + /** + * Advances the token stream to the next non-ignored token. + */ + + advance() { + this.lastToken = this.token; + const token = (this.token = this.lookahead()); + return token; + } + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + + lookahead() { + let token = this.token; + + if (token.kind !== _tokenKind.TokenKind.EOF) { + do { + if (token.next) { + token = token.next; + } else { + // Read the next token and form a link in the token linked-list. + const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing. + + token.next = nextToken; // @ts-expect-error prev is only mutable during parsing. + + nextToken.prev = token; + token = nextToken; + } + } while (token.kind === _tokenKind.TokenKind.COMMENT); + } + + return token; + } +} +/** + * @internal + */ + +exports.Lexer = Lexer; + +function isPunctuatorTokenKind(kind) { + return ( + kind === _tokenKind.TokenKind.BANG || + kind === _tokenKind.TokenKind.DOLLAR || + kind === _tokenKind.TokenKind.AMP || + kind === _tokenKind.TokenKind.PAREN_L || + kind === _tokenKind.TokenKind.PAREN_R || + kind === _tokenKind.TokenKind.SPREAD || + kind === _tokenKind.TokenKind.COLON || + kind === _tokenKind.TokenKind.EQUALS || + kind === _tokenKind.TokenKind.AT || + kind === _tokenKind.TokenKind.BRACKET_L || + kind === _tokenKind.TokenKind.BRACKET_R || + kind === _tokenKind.TokenKind.BRACE_L || + kind === _tokenKind.TokenKind.PIPE || + kind === _tokenKind.TokenKind.BRACE_R + ); +} +/** + * A Unicode scalar value is any Unicode code point except surrogate code + * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and + * 0xE000 to 0x10FFFF. + * + * SourceCharacter :: + * - "Any Unicode scalar value" + */ + +function isUnicodeScalarValue(code) { + return ( + (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff) + ); +} +/** + * The GraphQL specification defines source text as a sequence of unicode scalar + * values (which Unicode defines to exclude surrogate code points). However + * JavaScript defines strings as a sequence of UTF-16 code units which may + * include surrogates. A surrogate pair is a valid source character as it + * encodes a supplementary code point (above U+FFFF), but unpaired surrogate + * code points are not valid source characters. + */ + +function isSupplementaryCodePoint(body, location) { + return ( + isLeadingSurrogate(body.charCodeAt(location)) && + isTrailingSurrogate(body.charCodeAt(location + 1)) + ); +} + +function isLeadingSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} + +function isTrailingSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +/** + * Prints the code point (or end of file reference) at a given location in a + * source for use in error messages. + * + * Printable ASCII is printed quoted, while other points are printed in Unicode + * code point form (ie. U+1234). + */ + +function printCodePointAt(lexer, location) { + const code = lexer.source.body.codePointAt(location); + + if (code === undefined) { + return _tokenKind.TokenKind.EOF; + } else if (code >= 0x0020 && code <= 0x007e) { + // Printable ASCII + const char = String.fromCodePoint(code); + return char === '"' ? "'\"'" : `"${char}"`; + } // Unicode code point + + return 'U+' + code.toString(16).toUpperCase().padStart(4, '0'); +} +/** + * Create a token with line and column location information. + */ + +function createToken(lexer, kind, start, end, value) { + const line = lexer.line; + const col = 1 + start - lexer.lineStart; + return new _ast.Token(kind, start, end, line, col, value); +} +/** + * Gets the next token from the source starting at the given position. + * + * This skips over whitespace until it finds the next lexable token, then lexes + * punctuators immediately or calls the appropriate helper function for more + * complicated tokens. + */ + +function readNextToken(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // SourceCharacter + + switch (code) { + // Ignored :: + // - UnicodeBOM + // - WhiteSpace + // - LineTerminator + // - Comment + // - Comma + // + // UnicodeBOM :: "Byte Order Mark (U+FEFF)" + // + // WhiteSpace :: + // - "Horizontal Tab (U+0009)" + // - "Space (U+0020)" + // + // Comma :: , + case 0xfeff: // + + case 0x0009: // \t + + case 0x0020: // + + case 0x002c: + // , + ++position; + continue; + // LineTerminator :: + // - "New Line (U+000A)" + // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] + // - "Carriage Return (U+000D)" "New Line (U+000A)" + + case 0x000a: + // \n + ++position; + ++lexer.line; + lexer.lineStart = position; + continue; + + case 0x000d: + // \r + if (body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + ++lexer.line; + lexer.lineStart = position; + continue; + // Comment + + case 0x0023: + // # + return readComment(lexer, position); + // Token :: + // - Punctuator + // - Name + // - IntValue + // - FloatValue + // - StringValue + // + // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } + + case 0x0021: + // ! + return createToken( + lexer, + _tokenKind.TokenKind.BANG, + position, + position + 1, + ); + + case 0x0024: + // $ + return createToken( + lexer, + _tokenKind.TokenKind.DOLLAR, + position, + position + 1, + ); + + case 0x0026: + // & + return createToken( + lexer, + _tokenKind.TokenKind.AMP, + position, + position + 1, + ); + + case 0x0028: + // ( + return createToken( + lexer, + _tokenKind.TokenKind.PAREN_L, + position, + position + 1, + ); + + case 0x0029: + // ) + return createToken( + lexer, + _tokenKind.TokenKind.PAREN_R, + position, + position + 1, + ); + + case 0x002e: + // . + if ( + body.charCodeAt(position + 1) === 0x002e && + body.charCodeAt(position + 2) === 0x002e + ) { + return createToken( + lexer, + _tokenKind.TokenKind.SPREAD, + position, + position + 3, + ); + } + + break; + + case 0x003a: + // : + return createToken( + lexer, + _tokenKind.TokenKind.COLON, + position, + position + 1, + ); + + case 0x003d: + // = + return createToken( + lexer, + _tokenKind.TokenKind.EQUALS, + position, + position + 1, + ); + + case 0x0040: + // @ + return createToken( + lexer, + _tokenKind.TokenKind.AT, + position, + position + 1, + ); + + case 0x005b: + // [ + return createToken( + lexer, + _tokenKind.TokenKind.BRACKET_L, + position, + position + 1, + ); + + case 0x005d: + // ] + return createToken( + lexer, + _tokenKind.TokenKind.BRACKET_R, + position, + position + 1, + ); + + case 0x007b: + // { + return createToken( + lexer, + _tokenKind.TokenKind.BRACE_L, + position, + position + 1, + ); + + case 0x007c: + // | + return createToken( + lexer, + _tokenKind.TokenKind.PIPE, + position, + position + 1, + ); + + case 0x007d: + // } + return createToken( + lexer, + _tokenKind.TokenKind.BRACE_R, + position, + position + 1, + ); + // StringValue + + case 0x0022: + // " + if ( + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + return readBlockString(lexer, position); + } + + return readString(lexer, position); + } // IntValue | FloatValue (Digit | -) + + if ((0, _characterClasses.isDigit)(code) || code === 0x002d) { + return readNumber(lexer, position, code); + } // Name + + if ((0, _characterClasses.isNameStart)(code)) { + return readName(lexer, position); + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + code === 0x0027 + ? 'Unexpected single quote character (\'), did you mean to use a double quote (")?' + : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) + ? `Unexpected character: ${printCodePointAt(lexer, position)}.` + : `Invalid character: ${printCodePointAt(lexer, position)}.`, + ); + } + + return createToken(lexer, _tokenKind.TokenKind.EOF, bodyLength, bodyLength); +} +/** + * Reads a comment token from the source file. + * + * ``` + * Comment :: # CommentChar* [lookahead != CommentChar] + * + * CommentChar :: SourceCharacter but not LineTerminator + * ``` + */ + +function readComment(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + break; + } + } + + return createToken( + lexer, + _tokenKind.TokenKind.COMMENT, + start, + position, + body.slice(start + 1, position), + ); +} +/** + * Reads a number token from the source file, either a FloatValue or an IntValue + * depending on whether a FractionalPart or ExponentPart is encountered. + * + * ``` + * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}] + * + * IntegerPart :: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit Digit* + * + * NegativeSign :: - + * + * NonZeroDigit :: Digit but not `0` + * + * FloatValue :: + * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * + * FractionalPart :: . Digit+ + * + * ExponentPart :: ExponentIndicator Sign? Digit+ + * + * ExponentIndicator :: one of `e` `E` + * + * Sign :: one of + - + * ``` + */ + +function readNumber(lexer, start, firstCode) { + const body = lexer.source.body; + let position = start; + let code = firstCode; + let isFloat = false; // NegativeSign (-) + + if (code === 0x002d) { + code = body.charCodeAt(++position); + } // Zero (0) + + if (code === 0x0030) { + code = body.charCodeAt(++position); + + if ((0, _characterClasses.isDigit)(code)) { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid number, unexpected digit after 0: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } else { + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Full stop (.) + + if (code === 0x002e) { + isFloat = true; + code = body.charCodeAt(++position); + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // E e + + if (code === 0x0045 || code === 0x0065) { + isFloat = true; + code = body.charCodeAt(++position); // + - + + if (code === 0x002b || code === 0x002d) { + code = body.charCodeAt(++position); + } + + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Numbers cannot be followed by . or NameStart + + if (code === 0x002e || (0, _characterClasses.isNameStart)(code)) { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + + return createToken( + lexer, + isFloat ? _tokenKind.TokenKind.FLOAT : _tokenKind.TokenKind.INT, + start, + position, + body.slice(start, position), + ); +} +/** + * Returns the new position in the source after reading one or more digits. + */ + +function readDigits(lexer, start, firstCode) { + if (!(0, _characterClasses.isDigit)(firstCode)) { + throw (0, _syntaxError.syntaxError)( + lexer.source, + start, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + start, + )}.`, + ); + } + + const body = lexer.source.body; + let position = start + 1; // +1 to skip first firstCode + + while ((0, _characterClasses.isDigit)(body.charCodeAt(position))) { + ++position; + } + + return position; +} +/** + * Reads a single-quote string token from the source file. + * + * ``` + * StringValue :: + * - `""` [lookahead != `"`] + * - `"` StringCharacter+ `"` + * + * StringCharacter :: + * - SourceCharacter but not `"` or `\` or LineTerminator + * - `\u` EscapedUnicode + * - `\` EscapedCharacter + * + * EscapedUnicode :: + * - `{` HexDigit+ `}` + * - HexDigit HexDigit HexDigit HexDigit + * + * EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t` + * ``` + */ + +function readString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + let chunkStart = position; + let value = ''; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Quote (") + + if (code === 0x0022) { + value += body.slice(chunkStart, position); + return createToken( + lexer, + _tokenKind.TokenKind.STRING, + start, + position + 1, + value, + ); + } // Escape Sequence (\) + + if (code === 0x005c) { + value += body.slice(chunkStart, position); + const escape = + body.charCodeAt(position + 1) === 0x0075 // u + ? body.charCodeAt(position + 2) === 0x007b // { + ? readEscapedUnicodeVariableWidth(lexer, position) + : readEscapedUnicodeFixedWidth(lexer, position) + : readEscapedCharacter(lexer, position); + value += escape.value; + position += escape.size; + chunkStart = position; + continue; + } // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + 'Unterminated string.', + ); +} // The string value and lexed size of an escape sequence. + +function readEscapedUnicodeVariableWidth(lexer, position) { + const body = lexer.source.body; + let point = 0; + let size = 3; // Cannot be larger than 12 chars (\u{00000000}). + + while (size < 12) { + const code = body.charCodeAt(position + size++); // Closing Brace (}) + + if (code === 0x007d) { + // Must be at least 5 chars (\u{0}) and encode a Unicode scalar value. + if (size < 5 || !isUnicodeScalarValue(point)) { + break; + } + + return { + value: String.fromCodePoint(point), + size, + }; + } // Append this hex digit to the code point. + + point = (point << 4) | readHexDigit(code); + + if (point < 0) { + break; + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice( + position, + position + size, + )}".`, + ); +} + +function readEscapedUnicodeFixedWidth(lexer, position) { + const body = lexer.source.body; + const code = read16BitHexCode(body, position + 2); + + if (isUnicodeScalarValue(code)) { + return { + value: String.fromCodePoint(code), + size: 6, + }; + } // GraphQL allows JSON-style surrogate pair escape sequences, but only when + // a valid pair is formed. + + if (isLeadingSurrogate(code)) { + // \u + if ( + body.charCodeAt(position + 6) === 0x005c && + body.charCodeAt(position + 7) === 0x0075 + ) { + const trailingCode = read16BitHexCode(body, position + 8); + + if (isTrailingSurrogate(trailingCode)) { + // JavaScript defines strings as a sequence of UTF-16 code units and + // encodes Unicode code points above U+FFFF using a surrogate pair of + // code units. Since this is a surrogate pair escape sequence, just + // include both codes into the JavaScript string value. Had JavaScript + // not been internally based on UTF-16, then this surrogate pair would + // be decoded to retrieve the supplementary code point. + return { + value: String.fromCodePoint(code, trailingCode), + size: 12, + }; + } + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`, + ); +} +/** + * Reads four hexadecimal characters and returns the positive integer that 16bit + * hexadecimal string represents. For example, "000f" will return 15, and "dead" + * will return 57005. + * + * Returns a negative number if any char was not a valid hexadecimal digit. + */ + +function read16BitHexCode(body, position) { + // readHexDigit() returns -1 on error. ORing a negative value with any other + // value always produces a negative value. + return ( + (readHexDigit(body.charCodeAt(position)) << 12) | + (readHexDigit(body.charCodeAt(position + 1)) << 8) | + (readHexDigit(body.charCodeAt(position + 2)) << 4) | + readHexDigit(body.charCodeAt(position + 3)) + ); +} +/** + * Reads a hexadecimal character and returns its positive integer value (0-15). + * + * '0' becomes 0, '9' becomes 9 + * 'A' becomes 10, 'F' becomes 15 + * 'a' becomes 10, 'f' becomes 15 + * + * Returns -1 if the provided character code was not a valid hexadecimal digit. + * + * HexDigit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * - `A` `B` `C` `D` `E` `F` + * - `a` `b` `c` `d` `e` `f` + */ + +function readHexDigit(code) { + return code >= 0x0030 && code <= 0x0039 // 0-9 + ? code - 0x0030 + : code >= 0x0041 && code <= 0x0046 // A-F + ? code - 0x0037 + : code >= 0x0061 && code <= 0x0066 // a-f + ? code - 0x0057 + : -1; +} +/** + * | Escaped Character | Code Point | Character Name | + * | ----------------- | ---------- | ---------------------------- | + * | `"` | U+0022 | double quote | + * | `\` | U+005C | reverse solidus (back slash) | + * | `/` | U+002F | solidus (forward slash) | + * | `b` | U+0008 | backspace | + * | `f` | U+000C | form feed | + * | `n` | U+000A | line feed (new line) | + * | `r` | U+000D | carriage return | + * | `t` | U+0009 | horizontal tab | + */ + +function readEscapedCharacter(lexer, position) { + const body = lexer.source.body; + const code = body.charCodeAt(position + 1); + + switch (code) { + case 0x0022: + // " + return { + value: '\u0022', + size: 2, + }; + + case 0x005c: + // \ + return { + value: '\u005c', + size: 2, + }; + + case 0x002f: + // / + return { + value: '\u002f', + size: 2, + }; + + case 0x0062: + // b + return { + value: '\u0008', + size: 2, + }; + + case 0x0066: + // f + return { + value: '\u000c', + size: 2, + }; + + case 0x006e: + // n + return { + value: '\u000a', + size: 2, + }; + + case 0x0072: + // r + return { + value: '\u000d', + size: 2, + }; + + case 0x0074: + // t + return { + value: '\u0009', + size: 2, + }; + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid character escape sequence: "${body.slice( + position, + position + 2, + )}".`, + ); +} +/** + * Reads a block string token from the source file. + * + * ``` + * StringValue :: + * - `"""` BlockStringCharacter* `"""` + * + * BlockStringCharacter :: + * - SourceCharacter but not `"""` or `\"""` + * - `\"""` + * ``` + */ + +function readBlockString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let lineStart = lexer.lineStart; + let position = start + 3; + let chunkStart = position; + let currentLine = ''; + const blockLines = []; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Triple-Quote (""") + + if ( + code === 0x0022 && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + const token = createToken( + lexer, + _tokenKind.TokenKind.BLOCK_STRING, + start, + position + 3, // Return a string of the lines joined with U+000A. + (0, _blockString.dedentBlockStringLines)(blockLines).join('\n'), + ); + lexer.line += blockLines.length - 1; + lexer.lineStart = lineStart; + return token; + } // Escaped Triple-Quote (\""") + + if ( + code === 0x005c && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 && + body.charCodeAt(position + 3) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + chunkStart = position + 1; // skip only slash + + position += 4; + continue; + } // LineTerminator + + if (code === 0x000a || code === 0x000d) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + + if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + currentLine = ''; + chunkStart = position; + lineStart = position; + continue; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw (0, _syntaxError.syntaxError)( + lexer.source, + position, + 'Unterminated string.', + ); +} +/** + * Reads an alphanumeric + underscore name from the source. + * + * ``` + * Name :: + * - NameStart NameContinue* [lookahead != NameContinue] + * ``` + */ + +function readName(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + + if ((0, _characterClasses.isNameContinue)(code)) { + ++position; + } else { + break; + } + } + + return createToken( + lexer, + _tokenKind.TokenKind.NAME, + start, + position, + body.slice(start, position), + ); +} diff --git a/graphql-subscription/node_modules/graphql/language/lexer.mjs b/graphql-subscription/node_modules/graphql/language/lexer.mjs new file mode 100644 index 0000000..75299ca --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/lexer.mjs @@ -0,0 +1,902 @@ +import { syntaxError } from '../error/syntaxError.mjs'; +import { Token } from './ast.mjs'; +import { dedentBlockStringLines } from './blockString.mjs'; +import { isDigit, isNameContinue, isNameStart } from './characterClasses.mjs'; +import { TokenKind } from './tokenKind.mjs'; +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ + +export class Lexer { + /** + * The previously focused non-ignored token. + */ + + /** + * The currently focused non-ignored token. + */ + + /** + * The (1-indexed) line containing the current token. + */ + + /** + * The character offset at which the current line begins. + */ + constructor(source) { + const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0); + this.source = source; + this.lastToken = startOfFileToken; + this.token = startOfFileToken; + this.line = 1; + this.lineStart = 0; + } + + get [Symbol.toStringTag]() { + return 'Lexer'; + } + /** + * Advances the token stream to the next non-ignored token. + */ + + advance() { + this.lastToken = this.token; + const token = (this.token = this.lookahead()); + return token; + } + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + + lookahead() { + let token = this.token; + + if (token.kind !== TokenKind.EOF) { + do { + if (token.next) { + token = token.next; + } else { + // Read the next token and form a link in the token linked-list. + const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing. + + token.next = nextToken; // @ts-expect-error prev is only mutable during parsing. + + nextToken.prev = token; + token = nextToken; + } + } while (token.kind === TokenKind.COMMENT); + } + + return token; + } +} +/** + * @internal + */ + +export function isPunctuatorTokenKind(kind) { + return ( + kind === TokenKind.BANG || + kind === TokenKind.DOLLAR || + kind === TokenKind.AMP || + kind === TokenKind.PAREN_L || + kind === TokenKind.PAREN_R || + kind === TokenKind.SPREAD || + kind === TokenKind.COLON || + kind === TokenKind.EQUALS || + kind === TokenKind.AT || + kind === TokenKind.BRACKET_L || + kind === TokenKind.BRACKET_R || + kind === TokenKind.BRACE_L || + kind === TokenKind.PIPE || + kind === TokenKind.BRACE_R + ); +} +/** + * A Unicode scalar value is any Unicode code point except surrogate code + * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and + * 0xE000 to 0x10FFFF. + * + * SourceCharacter :: + * - "Any Unicode scalar value" + */ + +function isUnicodeScalarValue(code) { + return ( + (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff) + ); +} +/** + * The GraphQL specification defines source text as a sequence of unicode scalar + * values (which Unicode defines to exclude surrogate code points). However + * JavaScript defines strings as a sequence of UTF-16 code units which may + * include surrogates. A surrogate pair is a valid source character as it + * encodes a supplementary code point (above U+FFFF), but unpaired surrogate + * code points are not valid source characters. + */ + +function isSupplementaryCodePoint(body, location) { + return ( + isLeadingSurrogate(body.charCodeAt(location)) && + isTrailingSurrogate(body.charCodeAt(location + 1)) + ); +} + +function isLeadingSurrogate(code) { + return code >= 0xd800 && code <= 0xdbff; +} + +function isTrailingSurrogate(code) { + return code >= 0xdc00 && code <= 0xdfff; +} +/** + * Prints the code point (or end of file reference) at a given location in a + * source for use in error messages. + * + * Printable ASCII is printed quoted, while other points are printed in Unicode + * code point form (ie. U+1234). + */ + +function printCodePointAt(lexer, location) { + const code = lexer.source.body.codePointAt(location); + + if (code === undefined) { + return TokenKind.EOF; + } else if (code >= 0x0020 && code <= 0x007e) { + // Printable ASCII + const char = String.fromCodePoint(code); + return char === '"' ? "'\"'" : `"${char}"`; + } // Unicode code point + + return 'U+' + code.toString(16).toUpperCase().padStart(4, '0'); +} +/** + * Create a token with line and column location information. + */ + +function createToken(lexer, kind, start, end, value) { + const line = lexer.line; + const col = 1 + start - lexer.lineStart; + return new Token(kind, start, end, line, col, value); +} +/** + * Gets the next token from the source starting at the given position. + * + * This skips over whitespace until it finds the next lexable token, then lexes + * punctuators immediately or calls the appropriate helper function for more + * complicated tokens. + */ + +function readNextToken(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // SourceCharacter + + switch (code) { + // Ignored :: + // - UnicodeBOM + // - WhiteSpace + // - LineTerminator + // - Comment + // - Comma + // + // UnicodeBOM :: "Byte Order Mark (U+FEFF)" + // + // WhiteSpace :: + // - "Horizontal Tab (U+0009)" + // - "Space (U+0020)" + // + // Comma :: , + case 0xfeff: // + + case 0x0009: // \t + + case 0x0020: // + + case 0x002c: + // , + ++position; + continue; + // LineTerminator :: + // - "New Line (U+000A)" + // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] + // - "Carriage Return (U+000D)" "New Line (U+000A)" + + case 0x000a: + // \n + ++position; + ++lexer.line; + lexer.lineStart = position; + continue; + + case 0x000d: + // \r + if (body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + ++lexer.line; + lexer.lineStart = position; + continue; + // Comment + + case 0x0023: + // # + return readComment(lexer, position); + // Token :: + // - Punctuator + // - Name + // - IntValue + // - FloatValue + // - StringValue + // + // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } + + case 0x0021: + // ! + return createToken(lexer, TokenKind.BANG, position, position + 1); + + case 0x0024: + // $ + return createToken(lexer, TokenKind.DOLLAR, position, position + 1); + + case 0x0026: + // & + return createToken(lexer, TokenKind.AMP, position, position + 1); + + case 0x0028: + // ( + return createToken(lexer, TokenKind.PAREN_L, position, position + 1); + + case 0x0029: + // ) + return createToken(lexer, TokenKind.PAREN_R, position, position + 1); + + case 0x002e: + // . + if ( + body.charCodeAt(position + 1) === 0x002e && + body.charCodeAt(position + 2) === 0x002e + ) { + return createToken(lexer, TokenKind.SPREAD, position, position + 3); + } + + break; + + case 0x003a: + // : + return createToken(lexer, TokenKind.COLON, position, position + 1); + + case 0x003d: + // = + return createToken(lexer, TokenKind.EQUALS, position, position + 1); + + case 0x0040: + // @ + return createToken(lexer, TokenKind.AT, position, position + 1); + + case 0x005b: + // [ + return createToken(lexer, TokenKind.BRACKET_L, position, position + 1); + + case 0x005d: + // ] + return createToken(lexer, TokenKind.BRACKET_R, position, position + 1); + + case 0x007b: + // { + return createToken(lexer, TokenKind.BRACE_L, position, position + 1); + + case 0x007c: + // | + return createToken(lexer, TokenKind.PIPE, position, position + 1); + + case 0x007d: + // } + return createToken(lexer, TokenKind.BRACE_R, position, position + 1); + // StringValue + + case 0x0022: + // " + if ( + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + return readBlockString(lexer, position); + } + + return readString(lexer, position); + } // IntValue | FloatValue (Digit | -) + + if (isDigit(code) || code === 0x002d) { + return readNumber(lexer, position, code); + } // Name + + if (isNameStart(code)) { + return readName(lexer, position); + } + + throw syntaxError( + lexer.source, + position, + code === 0x0027 + ? 'Unexpected single quote character (\'), did you mean to use a double quote (")?' + : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) + ? `Unexpected character: ${printCodePointAt(lexer, position)}.` + : `Invalid character: ${printCodePointAt(lexer, position)}.`, + ); + } + + return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength); +} +/** + * Reads a comment token from the source file. + * + * ``` + * Comment :: # CommentChar* [lookahead != CommentChar] + * + * CommentChar :: SourceCharacter but not LineTerminator + * ``` + */ + +function readComment(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + break; + } + } + + return createToken( + lexer, + TokenKind.COMMENT, + start, + position, + body.slice(start + 1, position), + ); +} +/** + * Reads a number token from the source file, either a FloatValue or an IntValue + * depending on whether a FractionalPart or ExponentPart is encountered. + * + * ``` + * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}] + * + * IntegerPart :: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit Digit* + * + * NegativeSign :: - + * + * NonZeroDigit :: Digit but not `0` + * + * FloatValue :: + * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * + * FractionalPart :: . Digit+ + * + * ExponentPart :: ExponentIndicator Sign? Digit+ + * + * ExponentIndicator :: one of `e` `E` + * + * Sign :: one of + - + * ``` + */ + +function readNumber(lexer, start, firstCode) { + const body = lexer.source.body; + let position = start; + let code = firstCode; + let isFloat = false; // NegativeSign (-) + + if (code === 0x002d) { + code = body.charCodeAt(++position); + } // Zero (0) + + if (code === 0x0030) { + code = body.charCodeAt(++position); + + if (isDigit(code)) { + throw syntaxError( + lexer.source, + position, + `Invalid number, unexpected digit after 0: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } else { + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Full stop (.) + + if (code === 0x002e) { + isFloat = true; + code = body.charCodeAt(++position); + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // E e + + if (code === 0x0045 || code === 0x0065) { + isFloat = true; + code = body.charCodeAt(++position); // + - + + if (code === 0x002b || code === 0x002d) { + code = body.charCodeAt(++position); + } + + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } // Numbers cannot be followed by . or NameStart + + if (code === 0x002e || isNameStart(code)) { + throw syntaxError( + lexer.source, + position, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + + return createToken( + lexer, + isFloat ? TokenKind.FLOAT : TokenKind.INT, + start, + position, + body.slice(start, position), + ); +} +/** + * Returns the new position in the source after reading one or more digits. + */ + +function readDigits(lexer, start, firstCode) { + if (!isDigit(firstCode)) { + throw syntaxError( + lexer.source, + start, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + start, + )}.`, + ); + } + + const body = lexer.source.body; + let position = start + 1; // +1 to skip first firstCode + + while (isDigit(body.charCodeAt(position))) { + ++position; + } + + return position; +} +/** + * Reads a single-quote string token from the source file. + * + * ``` + * StringValue :: + * - `""` [lookahead != `"`] + * - `"` StringCharacter+ `"` + * + * StringCharacter :: + * - SourceCharacter but not `"` or `\` or LineTerminator + * - `\u` EscapedUnicode + * - `\` EscapedCharacter + * + * EscapedUnicode :: + * - `{` HexDigit+ `}` + * - HexDigit HexDigit HexDigit HexDigit + * + * EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t` + * ``` + */ + +function readString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + let chunkStart = position; + let value = ''; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Quote (") + + if (code === 0x0022) { + value += body.slice(chunkStart, position); + return createToken(lexer, TokenKind.STRING, start, position + 1, value); + } // Escape Sequence (\) + + if (code === 0x005c) { + value += body.slice(chunkStart, position); + const escape = + body.charCodeAt(position + 1) === 0x0075 // u + ? body.charCodeAt(position + 2) === 0x007b // { + ? readEscapedUnicodeVariableWidth(lexer, position) + : readEscapedUnicodeFixedWidth(lexer, position) + : readEscapedCharacter(lexer, position); + value += escape.value; + position += escape.size; + chunkStart = position; + continue; + } // LineTerminator (\n | \r) + + if (code === 0x000a || code === 0x000d) { + break; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw syntaxError( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw syntaxError(lexer.source, position, 'Unterminated string.'); +} // The string value and lexed size of an escape sequence. + +function readEscapedUnicodeVariableWidth(lexer, position) { + const body = lexer.source.body; + let point = 0; + let size = 3; // Cannot be larger than 12 chars (\u{00000000}). + + while (size < 12) { + const code = body.charCodeAt(position + size++); // Closing Brace (}) + + if (code === 0x007d) { + // Must be at least 5 chars (\u{0}) and encode a Unicode scalar value. + if (size < 5 || !isUnicodeScalarValue(point)) { + break; + } + + return { + value: String.fromCodePoint(point), + size, + }; + } // Append this hex digit to the code point. + + point = (point << 4) | readHexDigit(code); + + if (point < 0) { + break; + } + } + + throw syntaxError( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice( + position, + position + size, + )}".`, + ); +} + +function readEscapedUnicodeFixedWidth(lexer, position) { + const body = lexer.source.body; + const code = read16BitHexCode(body, position + 2); + + if (isUnicodeScalarValue(code)) { + return { + value: String.fromCodePoint(code), + size: 6, + }; + } // GraphQL allows JSON-style surrogate pair escape sequences, but only when + // a valid pair is formed. + + if (isLeadingSurrogate(code)) { + // \u + if ( + body.charCodeAt(position + 6) === 0x005c && + body.charCodeAt(position + 7) === 0x0075 + ) { + const trailingCode = read16BitHexCode(body, position + 8); + + if (isTrailingSurrogate(trailingCode)) { + // JavaScript defines strings as a sequence of UTF-16 code units and + // encodes Unicode code points above U+FFFF using a surrogate pair of + // code units. Since this is a surrogate pair escape sequence, just + // include both codes into the JavaScript string value. Had JavaScript + // not been internally based on UTF-16, then this surrogate pair would + // be decoded to retrieve the supplementary code point. + return { + value: String.fromCodePoint(code, trailingCode), + size: 12, + }; + } + } + } + + throw syntaxError( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`, + ); +} +/** + * Reads four hexadecimal characters and returns the positive integer that 16bit + * hexadecimal string represents. For example, "000f" will return 15, and "dead" + * will return 57005. + * + * Returns a negative number if any char was not a valid hexadecimal digit. + */ + +function read16BitHexCode(body, position) { + // readHexDigit() returns -1 on error. ORing a negative value with any other + // value always produces a negative value. + return ( + (readHexDigit(body.charCodeAt(position)) << 12) | + (readHexDigit(body.charCodeAt(position + 1)) << 8) | + (readHexDigit(body.charCodeAt(position + 2)) << 4) | + readHexDigit(body.charCodeAt(position + 3)) + ); +} +/** + * Reads a hexadecimal character and returns its positive integer value (0-15). + * + * '0' becomes 0, '9' becomes 9 + * 'A' becomes 10, 'F' becomes 15 + * 'a' becomes 10, 'f' becomes 15 + * + * Returns -1 if the provided character code was not a valid hexadecimal digit. + * + * HexDigit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * - `A` `B` `C` `D` `E` `F` + * - `a` `b` `c` `d` `e` `f` + */ + +function readHexDigit(code) { + return code >= 0x0030 && code <= 0x0039 // 0-9 + ? code - 0x0030 + : code >= 0x0041 && code <= 0x0046 // A-F + ? code - 0x0037 + : code >= 0x0061 && code <= 0x0066 // a-f + ? code - 0x0057 + : -1; +} +/** + * | Escaped Character | Code Point | Character Name | + * | ----------------- | ---------- | ---------------------------- | + * | `"` | U+0022 | double quote | + * | `\` | U+005C | reverse solidus (back slash) | + * | `/` | U+002F | solidus (forward slash) | + * | `b` | U+0008 | backspace | + * | `f` | U+000C | form feed | + * | `n` | U+000A | line feed (new line) | + * | `r` | U+000D | carriage return | + * | `t` | U+0009 | horizontal tab | + */ + +function readEscapedCharacter(lexer, position) { + const body = lexer.source.body; + const code = body.charCodeAt(position + 1); + + switch (code) { + case 0x0022: + // " + return { + value: '\u0022', + size: 2, + }; + + case 0x005c: + // \ + return { + value: '\u005c', + size: 2, + }; + + case 0x002f: + // / + return { + value: '\u002f', + size: 2, + }; + + case 0x0062: + // b + return { + value: '\u0008', + size: 2, + }; + + case 0x0066: + // f + return { + value: '\u000c', + size: 2, + }; + + case 0x006e: + // n + return { + value: '\u000a', + size: 2, + }; + + case 0x0072: + // r + return { + value: '\u000d', + size: 2, + }; + + case 0x0074: + // t + return { + value: '\u0009', + size: 2, + }; + } + + throw syntaxError( + lexer.source, + position, + `Invalid character escape sequence: "${body.slice( + position, + position + 2, + )}".`, + ); +} +/** + * Reads a block string token from the source file. + * + * ``` + * StringValue :: + * - `"""` BlockStringCharacter* `"""` + * + * BlockStringCharacter :: + * - SourceCharacter but not `"""` or `\"""` + * - `\"""` + * ``` + */ + +function readBlockString(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let lineStart = lexer.lineStart; + let position = start + 3; + let chunkStart = position; + let currentLine = ''; + const blockLines = []; + + while (position < bodyLength) { + const code = body.charCodeAt(position); // Closing Triple-Quote (""") + + if ( + code === 0x0022 && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + const token = createToken( + lexer, + TokenKind.BLOCK_STRING, + start, + position + 3, // Return a string of the lines joined with U+000A. + dedentBlockStringLines(blockLines).join('\n'), + ); + lexer.line += blockLines.length - 1; + lexer.lineStart = lineStart; + return token; + } // Escaped Triple-Quote (\""") + + if ( + code === 0x005c && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 && + body.charCodeAt(position + 3) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + chunkStart = position + 1; // skip only slash + + position += 4; + continue; + } // LineTerminator + + if (code === 0x000a || code === 0x000d) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + + if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + currentLine = ''; + chunkStart = position; + lineStart = position; + continue; + } // SourceCharacter + + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw syntaxError( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw syntaxError(lexer.source, position, 'Unterminated string.'); +} +/** + * Reads an alphanumeric + underscore name from the source. + * + * ``` + * Name :: + * - NameStart NameContinue* [lookahead != NameContinue] + * ``` + */ + +function readName(lexer, start) { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + + if (isNameContinue(code)) { + ++position; + } else { + break; + } + } + + return createToken( + lexer, + TokenKind.NAME, + start, + position, + body.slice(start, position), + ); +} diff --git a/graphql-subscription/node_modules/graphql/language/location.d.ts b/graphql-subscription/node_modules/graphql/language/location.d.ts new file mode 100644 index 0000000..2a274ef --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/location.d.ts @@ -0,0 +1,16 @@ +import type { Source } from './source'; +/** + * Represents a location in a Source. + */ +export interface SourceLocation { + readonly line: number; + readonly column: number; +} +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +export declare function getLocation( + source: Source, + position: number, +): SourceLocation; diff --git a/graphql-subscription/node_modules/graphql/language/location.js b/graphql-subscription/node_modules/graphql/language/location.js new file mode 100644 index 0000000..5ef2316 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/location.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getLocation = getLocation; + +var _invariant = require('../jsutils/invariant.js'); + +const LineRegExp = /\r\n|[\n\r]/g; +/** + * Represents a location in a Source. + */ + +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +function getLocation(source, position) { + let lastLineStart = 0; + let line = 1; + + for (const match of source.body.matchAll(LineRegExp)) { + typeof match.index === 'number' || (0, _invariant.invariant)(false); + + if (match.index >= position) { + break; + } + + lastLineStart = match.index + match[0].length; + line += 1; + } + + return { + line, + column: position + 1 - lastLineStart, + }; +} diff --git a/graphql-subscription/node_modules/graphql/language/location.mjs b/graphql-subscription/node_modules/graphql/language/location.mjs new file mode 100644 index 0000000..6cca4bb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/location.mjs @@ -0,0 +1,30 @@ +import { invariant } from '../jsutils/invariant.mjs'; +const LineRegExp = /\r\n|[\n\r]/g; +/** + * Represents a location in a Source. + */ + +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +export function getLocation(source, position) { + let lastLineStart = 0; + let line = 1; + + for (const match of source.body.matchAll(LineRegExp)) { + typeof match.index === 'number' || invariant(false); + + if (match.index >= position) { + break; + } + + lastLineStart = match.index + match[0].length; + line += 1; + } + + return { + line, + column: position + 1 - lastLineStart, + }; +} diff --git a/graphql-subscription/node_modules/graphql/language/parser.d.ts b/graphql-subscription/node_modules/graphql/language/parser.d.ts new file mode 100644 index 0000000..a158a64 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/parser.d.ts @@ -0,0 +1,564 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { GraphQLError } from '../error/GraphQLError'; +import type { + ArgumentNode, + ConstArgumentNode, + ConstDirectiveNode, + ConstListValueNode, + ConstObjectFieldNode, + ConstObjectValueNode, + ConstValueNode, + DefinitionNode, + DirectiveDefinitionNode, + DirectiveNode, + DocumentNode, + EnumTypeDefinitionNode, + EnumTypeExtensionNode, + EnumValueDefinitionNode, + FieldDefinitionNode, + FieldNode, + FragmentDefinitionNode, + FragmentSpreadNode, + InlineFragmentNode, + InputObjectTypeDefinitionNode, + InputObjectTypeExtensionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + ListValueNode, + NamedTypeNode, + NameNode, + ObjectFieldNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + ObjectValueNode, + OperationDefinitionNode, + OperationTypeDefinitionNode, + ScalarTypeDefinitionNode, + ScalarTypeExtensionNode, + SchemaDefinitionNode, + SchemaExtensionNode, + SelectionNode, + SelectionSetNode, + StringValueNode, + Token, + TypeNode, + TypeSystemExtensionNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, + ValueNode, + VariableDefinitionNode, + VariableNode, +} from './ast'; +import { Location, OperationTypeNode } from './ast'; +import { Lexer } from './lexer'; +import { Source } from './source'; +import { TokenKind } from './tokenKind'; +/** + * Configuration options to control parser behavior + */ +export interface ParseOptions { + /** + * By default, the parser creates AST nodes that know the location + * in the source that they correspond to. This configuration flag + * disables that behavior for performance or testing. + */ + noLocation?: boolean; + /** + * Parser CPU and memory usage is linear to the number of tokens in a document + * however in extreme cases it becomes quadratic due to memory exhaustion. + * Parsing happens before validation so even invalid queries can burn lots of + * CPU time and memory. + * To prevent this you can set a maximum number of tokens allowed within a document. + */ + maxTokens?: number | undefined; + /** + * @deprecated will be removed in the v17.0.0 + * + * If enabled, the parser will understand and parse variable definitions + * contained in a fragment definition. They'll be represented in the + * `variableDefinitions` field of the FragmentDefinitionNode. + * + * The syntax is identical to normal, query-defined variables. For example: + * + * ```graphql + * fragment A($var: Boolean = false) on T { + * ... + * } + * ``` + */ + allowLegacyFragmentVariables?: boolean; +} +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +export declare function parse( + source: string | Source, + options?: ParseOptions | undefined, +): DocumentNode; +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ +export declare function parseValue( + source: string | Source, + options?: ParseOptions | undefined, +): ValueNode; +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + */ +export declare function parseConstValue( + source: string | Source, + options?: ParseOptions | undefined, +): ConstValueNode; +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ +export declare function parseType( + source: string | Source, + options?: ParseOptions | undefined, +): TypeNode; +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ +export declare class Parser { + protected _options: ParseOptions; + protected _lexer: Lexer; + protected _tokenCounter: number; + constructor(source: string | Source, options?: ParseOptions); + /** + * Converts a name lex token into a name parse node. + */ + parseName(): NameNode; + /** + * Document : Definition+ + */ + parseDocument(): DocumentNode; + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + * + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + parseDefinition(): DefinitionNode; + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + parseOperationDefinition(): OperationDefinitionNode; + /** + * OperationType : one of query mutation subscription + */ + parseOperationType(): OperationTypeNode; + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + parseVariableDefinitions(): Array; + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + parseVariableDefinition(): VariableDefinitionNode; + /** + * Variable : $ Name + */ + parseVariable(): VariableNode; + /** + * ``` + * SelectionSet : { Selection+ } + * ``` + */ + parseSelectionSet(): SelectionSetNode; + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + parseSelection(): SelectionNode; + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + parseField(): FieldNode; + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + parseArguments(isConst: true): Array; + parseArguments(isConst: boolean): Array; + /** + * Argument[Const] : Name : Value[?Const] + */ + parseArgument(isConst: true): ConstArgumentNode; + parseArgument(isConst?: boolean): ArgumentNode; + parseConstArgument(): ConstArgumentNode; + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + parseFragment(): FragmentSpreadNode | InlineFragmentNode; + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + parseFragmentDefinition(): FragmentDefinitionNode; + /** + * FragmentName : Name but not `on` + */ + parseFragmentName(): NameNode; + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + parseValueLiteral(isConst: true): ConstValueNode; + parseValueLiteral(isConst: boolean): ValueNode; + parseConstValueLiteral(): ConstValueNode; + parseStringLiteral(): StringValueNode; + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + parseList(isConst: true): ConstListValueNode; + parseList(isConst: boolean): ListValueNode; + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + parseObject(isConst: true): ConstObjectValueNode; + parseObject(isConst: boolean): ObjectValueNode; + /** + * ObjectField[Const] : Name : Value[?Const] + */ + parseObjectField(isConst: true): ConstObjectFieldNode; + parseObjectField(isConst: boolean): ObjectFieldNode; + /** + * Directives[Const] : Directive[?Const]+ + */ + parseDirectives(isConst: true): Array; + parseDirectives(isConst: boolean): Array; + parseConstDirectives(): Array; + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + parseDirective(isConst: true): ConstDirectiveNode; + parseDirective(isConst: boolean): DirectiveNode; + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + parseTypeReference(): TypeNode; + /** + * NamedType : Name + */ + parseNamedType(): NamedTypeNode; + peekDescription(): boolean; + /** + * Description : StringValue + */ + parseDescription(): undefined | StringValueNode; + /** + * ``` + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + * ``` + */ + parseSchemaDefinition(): SchemaDefinitionNode; + /** + * OperationTypeDefinition : OperationType : NamedType + */ + parseOperationTypeDefinition(): OperationTypeDefinitionNode; + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + parseScalarTypeDefinition(): ScalarTypeDefinitionNode; + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + parseObjectTypeDefinition(): ObjectTypeDefinitionNode; + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + parseImplementsInterfaces(): Array; + /** + * ``` + * FieldsDefinition : { FieldDefinition+ } + * ``` + */ + parseFieldsDefinition(): Array; + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + parseFieldDefinition(): FieldDefinitionNode; + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + parseArgumentDefs(): Array; + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + parseInputValueDef(): InputValueDefinitionNode; + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + parseInterfaceTypeDefinition(): InterfaceTypeDefinitionNode; + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + parseUnionTypeDefinition(): UnionTypeDefinitionNode; + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + parseUnionMemberTypes(): Array; + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + parseEnumTypeDefinition(): EnumTypeDefinitionNode; + /** + * ``` + * EnumValuesDefinition : { EnumValueDefinition+ } + * ``` + */ + parseEnumValuesDefinition(): Array; + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + */ + parseEnumValueDefinition(): EnumValueDefinitionNode; + /** + * EnumValue : Name but not `true`, `false` or `null` + */ + parseEnumValueName(): NameNode; + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + parseInputObjectTypeDefinition(): InputObjectTypeDefinitionNode; + /** + * ``` + * InputFieldsDefinition : { InputValueDefinition+ } + * ``` + */ + parseInputFieldsDefinition(): Array; + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + parseTypeSystemExtension(): TypeSystemExtensionNode; + /** + * ``` + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + * ``` + */ + parseSchemaExtension(): SchemaExtensionNode; + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + parseScalarTypeExtension(): ScalarTypeExtensionNode; + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + parseObjectTypeExtension(): ObjectTypeExtensionNode; + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + parseInterfaceTypeExtension(): InterfaceTypeExtensionNode; + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + parseUnionTypeExtension(): UnionTypeExtensionNode; + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + parseEnumTypeExtension(): EnumTypeExtensionNode; + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + parseInputObjectTypeExtension(): InputObjectTypeExtensionNode; + /** + * ``` + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + * ``` + */ + parseDirectiveDefinition(): DirectiveDefinitionNode; + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + parseDirectiveLocations(): Array; + parseDirectiveLocation(): NameNode; + /** + * Returns a node that, if configured to do so, sets a "loc" field as a + * location object, used to identify the place in the source that created a + * given parsed object. + */ + node< + T extends { + loc?: Location; + }, + >(startToken: Token, node: T): T; + /** + * Determines if the next token is of a given kind + */ + peek(kind: TokenKind): boolean; + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + expectToken(kind: TokenKind): Token; + /** + * If the next token is of the given kind, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + expectOptionalToken(kind: TokenKind): boolean; + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + expectKeyword(value: string): void; + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + expectOptionalKeyword(value: string): boolean; + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + unexpected(atToken?: Maybe): GraphQLError; + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + any(openKind: TokenKind, parseFn: () => T, closeKind: TokenKind): Array; + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + optionalMany( + openKind: TokenKind, + parseFn: () => T, + closeKind: TokenKind, + ): Array; + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + many( + openKind: TokenKind, + parseFn: () => T, + closeKind: TokenKind, + ): Array; + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + delimitedMany(delimiterKind: TokenKind, parseFn: () => T): Array; + advanceLexer(): void; +} diff --git a/graphql-subscription/node_modules/graphql/language/parser.js b/graphql-subscription/node_modules/graphql/language/parser.js new file mode 100644 index 0000000..f133239 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/parser.js @@ -0,0 +1,1567 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Parser = void 0; +exports.parse = parse; +exports.parseConstValue = parseConstValue; +exports.parseType = parseType; +exports.parseValue = parseValue; + +var _syntaxError = require('../error/syntaxError.js'); + +var _ast = require('./ast.js'); + +var _directiveLocation = require('./directiveLocation.js'); + +var _kinds = require('./kinds.js'); + +var _lexer = require('./lexer.js'); + +var _source = require('./source.js'); + +var _tokenKind = require('./tokenKind.js'); + +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +function parse(source, options) { + const parser = new Parser(source, options); + return parser.parseDocument(); +} +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ + +function parseValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + const value = parser.parseValueLiteral(false); + parser.expectToken(_tokenKind.TokenKind.EOF); + return value; +} +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + */ + +function parseConstValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + const value = parser.parseConstValueLiteral(); + parser.expectToken(_tokenKind.TokenKind.EOF); + return value; +} +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ + +function parseType(source, options) { + const parser = new Parser(source, options); + parser.expectToken(_tokenKind.TokenKind.SOF); + const type = parser.parseTypeReference(); + parser.expectToken(_tokenKind.TokenKind.EOF); + return type; +} +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ + +class Parser { + constructor(source, options = {}) { + const sourceObj = (0, _source.isSource)(source) + ? source + : new _source.Source(source); + this._lexer = new _lexer.Lexer(sourceObj); + this._options = options; + this._tokenCounter = 0; + } + /** + * Converts a name lex token into a name parse node. + */ + + parseName() { + const token = this.expectToken(_tokenKind.TokenKind.NAME); + return this.node(token, { + kind: _kinds.Kind.NAME, + value: token.value, + }); + } // Implements the parsing rules in the Document section. + + /** + * Document : Definition+ + */ + + parseDocument() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.DOCUMENT, + definitions: this.many( + _tokenKind.TokenKind.SOF, + this.parseDefinition, + _tokenKind.TokenKind.EOF, + ), + }); + } + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + * + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + + parseDefinition() { + if (this.peek(_tokenKind.TokenKind.BRACE_L)) { + return this.parseOperationDefinition(); + } // Many definitions begin with a description and require a lookahead. + + const hasDescription = this.peekDescription(); + const keywordToken = hasDescription + ? this._lexer.lookahead() + : this._lexer.token; + + if (keywordToken.kind === _tokenKind.TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaDefinition(); + + case 'scalar': + return this.parseScalarTypeDefinition(); + + case 'type': + return this.parseObjectTypeDefinition(); + + case 'interface': + return this.parseInterfaceTypeDefinition(); + + case 'union': + return this.parseUnionTypeDefinition(); + + case 'enum': + return this.parseEnumTypeDefinition(); + + case 'input': + return this.parseInputObjectTypeDefinition(); + + case 'directive': + return this.parseDirectiveDefinition(); + } + + if (hasDescription) { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + this._lexer.token.start, + 'Unexpected description, descriptions are supported only on type definitions.', + ); + } + + switch (keywordToken.value) { + case 'query': + case 'mutation': + case 'subscription': + return this.parseOperationDefinition(); + + case 'fragment': + return this.parseFragmentDefinition(); + + case 'extend': + return this.parseTypeSystemExtension(); + } + } + + throw this.unexpected(keywordToken); + } // Implements the parsing rules in the Operations section. + + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + + parseOperationDefinition() { + const start = this._lexer.token; + + if (this.peek(_tokenKind.TokenKind.BRACE_L)) { + return this.node(start, { + kind: _kinds.Kind.OPERATION_DEFINITION, + operation: _ast.OperationTypeNode.QUERY, + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: this.parseSelectionSet(), + }); + } + + const operation = this.parseOperationType(); + let name; + + if (this.peek(_tokenKind.TokenKind.NAME)) { + name = this.parseName(); + } + + return this.node(start, { + kind: _kinds.Kind.OPERATION_DEFINITION, + operation, + name, + variableDefinitions: this.parseVariableDefinitions(), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * OperationType : one of query mutation subscription + */ + + parseOperationType() { + const operationToken = this.expectToken(_tokenKind.TokenKind.NAME); + + switch (operationToken.value) { + case 'query': + return _ast.OperationTypeNode.QUERY; + + case 'mutation': + return _ast.OperationTypeNode.MUTATION; + + case 'subscription': + return _ast.OperationTypeNode.SUBSCRIPTION; + } + + throw this.unexpected(operationToken); + } + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + + parseVariableDefinitions() { + return this.optionalMany( + _tokenKind.TokenKind.PAREN_L, + this.parseVariableDefinition, + _tokenKind.TokenKind.PAREN_R, + ); + } + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + + parseVariableDefinition() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.VARIABLE_DEFINITION, + variable: this.parseVariable(), + type: + (this.expectToken(_tokenKind.TokenKind.COLON), + this.parseTypeReference()), + defaultValue: this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) + ? this.parseConstValueLiteral() + : undefined, + directives: this.parseConstDirectives(), + }); + } + /** + * Variable : $ Name + */ + + parseVariable() { + const start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.DOLLAR); + return this.node(start, { + kind: _kinds.Kind.VARIABLE, + name: this.parseName(), + }); + } + /** + * ``` + * SelectionSet : { Selection+ } + * ``` + */ + + parseSelectionSet() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.SELECTION_SET, + selections: this.many( + _tokenKind.TokenKind.BRACE_L, + this.parseSelection, + _tokenKind.TokenKind.BRACE_R, + ), + }); + } + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + + parseSelection() { + return this.peek(_tokenKind.TokenKind.SPREAD) + ? this.parseFragment() + : this.parseField(); + } + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + + parseField() { + const start = this._lexer.token; + const nameOrAlias = this.parseName(); + let alias; + let name; + + if (this.expectOptionalToken(_tokenKind.TokenKind.COLON)) { + alias = nameOrAlias; + name = this.parseName(); + } else { + name = nameOrAlias; + } + + return this.node(start, { + kind: _kinds.Kind.FIELD, + alias, + name, + arguments: this.parseArguments(false), + directives: this.parseDirectives(false), + selectionSet: this.peek(_tokenKind.TokenKind.BRACE_L) + ? this.parseSelectionSet() + : undefined, + }); + } + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + + parseArguments(isConst) { + const item = isConst ? this.parseConstArgument : this.parseArgument; + return this.optionalMany( + _tokenKind.TokenKind.PAREN_L, + item, + _tokenKind.TokenKind.PAREN_R, + ); + } + /** + * Argument[Const] : Name : Value[?Const] + */ + + parseArgument(isConst = false) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + return this.node(start, { + kind: _kinds.Kind.ARGUMENT, + name, + value: this.parseValueLiteral(isConst), + }); + } + + parseConstArgument() { + return this.parseArgument(true); + } // Implements the parsing rules in the Fragments section. + + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + + parseFragment() { + const start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.SPREAD); + const hasTypeCondition = this.expectOptionalKeyword('on'); + + if (!hasTypeCondition && this.peek(_tokenKind.TokenKind.NAME)) { + return this.node(start, { + kind: _kinds.Kind.FRAGMENT_SPREAD, + name: this.parseFragmentName(), + directives: this.parseDirectives(false), + }); + } + + return this.node(start, { + kind: _kinds.Kind.INLINE_FRAGMENT, + typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + + parseFragmentDefinition() { + const start = this._lexer.token; + this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes + // the grammar of FragmentDefinition: + // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + + if (this._options.allowLegacyFragmentVariables === true) { + return this.node(start, { + kind: _kinds.Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + variableDefinitions: this.parseVariableDefinitions(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + + return this.node(start, { + kind: _kinds.Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentName : Name but not `on` + */ + + parseFragmentName() { + if (this._lexer.token.value === 'on') { + throw this.unexpected(); + } + + return this.parseName(); + } // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseValueLiteral(isConst) { + const token = this._lexer.token; + + switch (token.kind) { + case _tokenKind.TokenKind.BRACKET_L: + return this.parseList(isConst); + + case _tokenKind.TokenKind.BRACE_L: + return this.parseObject(isConst); + + case _tokenKind.TokenKind.INT: + this.advanceLexer(); + return this.node(token, { + kind: _kinds.Kind.INT, + value: token.value, + }); + + case _tokenKind.TokenKind.FLOAT: + this.advanceLexer(); + return this.node(token, { + kind: _kinds.Kind.FLOAT, + value: token.value, + }); + + case _tokenKind.TokenKind.STRING: + case _tokenKind.TokenKind.BLOCK_STRING: + return this.parseStringLiteral(); + + case _tokenKind.TokenKind.NAME: + this.advanceLexer(); + + switch (token.value) { + case 'true': + return this.node(token, { + kind: _kinds.Kind.BOOLEAN, + value: true, + }); + + case 'false': + return this.node(token, { + kind: _kinds.Kind.BOOLEAN, + value: false, + }); + + case 'null': + return this.node(token, { + kind: _kinds.Kind.NULL, + }); + + default: + return this.node(token, { + kind: _kinds.Kind.ENUM, + value: token.value, + }); + } + + case _tokenKind.TokenKind.DOLLAR: + if (isConst) { + this.expectToken(_tokenKind.TokenKind.DOLLAR); + + if (this._lexer.token.kind === _tokenKind.TokenKind.NAME) { + const varName = this._lexer.token.value; + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Unexpected variable "$${varName}" in constant value.`, + ); + } else { + throw this.unexpected(token); + } + } + + return this.parseVariable(); + + default: + throw this.unexpected(); + } + } + + parseConstValueLiteral() { + return this.parseValueLiteral(true); + } + + parseStringLiteral() { + const token = this._lexer.token; + this.advanceLexer(); + return this.node(token, { + kind: _kinds.Kind.STRING, + value: token.value, + block: token.kind === _tokenKind.TokenKind.BLOCK_STRING, + }); + } + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + + parseList(isConst) { + const item = () => this.parseValueLiteral(isConst); + + return this.node(this._lexer.token, { + kind: _kinds.Kind.LIST, + values: this.any( + _tokenKind.TokenKind.BRACKET_L, + item, + _tokenKind.TokenKind.BRACKET_R, + ), + }); + } + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + + parseObject(isConst) { + const item = () => this.parseObjectField(isConst); + + return this.node(this._lexer.token, { + kind: _kinds.Kind.OBJECT, + fields: this.any( + _tokenKind.TokenKind.BRACE_L, + item, + _tokenKind.TokenKind.BRACE_R, + ), + }); + } + /** + * ObjectField[Const] : Name : Value[?Const] + */ + + parseObjectField(isConst) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + return this.node(start, { + kind: _kinds.Kind.OBJECT_FIELD, + name, + value: this.parseValueLiteral(isConst), + }); + } // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + + parseDirectives(isConst) { + const directives = []; + + while (this.peek(_tokenKind.TokenKind.AT)) { + directives.push(this.parseDirective(isConst)); + } + + return directives; + } + + parseConstDirectives() { + return this.parseDirectives(true); + } + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + + parseDirective(isConst) { + const start = this._lexer.token; + this.expectToken(_tokenKind.TokenKind.AT); + return this.node(start, { + kind: _kinds.Kind.DIRECTIVE, + name: this.parseName(), + arguments: this.parseArguments(isConst), + }); + } // Implements the parsing rules in the Types section. + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + + parseTypeReference() { + const start = this._lexer.token; + let type; + + if (this.expectOptionalToken(_tokenKind.TokenKind.BRACKET_L)) { + const innerType = this.parseTypeReference(); + this.expectToken(_tokenKind.TokenKind.BRACKET_R); + type = this.node(start, { + kind: _kinds.Kind.LIST_TYPE, + type: innerType, + }); + } else { + type = this.parseNamedType(); + } + + if (this.expectOptionalToken(_tokenKind.TokenKind.BANG)) { + return this.node(start, { + kind: _kinds.Kind.NON_NULL_TYPE, + type, + }); + } + + return type; + } + /** + * NamedType : Name + */ + + parseNamedType() { + return this.node(this._lexer.token, { + kind: _kinds.Kind.NAMED_TYPE, + name: this.parseName(), + }); + } // Implements the parsing rules in the Type Definition section. + + peekDescription() { + return ( + this.peek(_tokenKind.TokenKind.STRING) || + this.peek(_tokenKind.TokenKind.BLOCK_STRING) + ); + } + /** + * Description : StringValue + */ + + parseDescription() { + if (this.peekDescription()) { + return this.parseStringLiteral(); + } + } + /** + * ``` + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + * ``` + */ + + parseSchemaDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.many( + _tokenKind.TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + return this.node(start, { + kind: _kinds.Kind.SCHEMA_DEFINITION, + description, + directives, + operationTypes, + }); + } + /** + * OperationTypeDefinition : OperationType : NamedType + */ + + parseOperationTypeDefinition() { + const start = this._lexer.token; + const operation = this.parseOperationType(); + this.expectToken(_tokenKind.TokenKind.COLON); + const type = this.parseNamedType(); + return this.node(start, { + kind: _kinds.Kind.OPERATION_TYPE_DEFINITION, + operation, + type, + }); + } + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + + parseScalarTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.SCALAR_TYPE_DEFINITION, + description, + name, + directives, + }); + } + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + + parseObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: _kinds.Kind.OBJECT_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + + parseImplementsInterfaces() { + return this.expectOptionalKeyword('implements') + ? this.delimitedMany(_tokenKind.TokenKind.AMP, this.parseNamedType) + : []; + } + /** + * ``` + * FieldsDefinition : { FieldDefinition+ } + * ``` + */ + + parseFieldsDefinition() { + return this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseFieldDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + } + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + + parseFieldDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + this.expectToken(_tokenKind.TokenKind.COLON); + const type = this.parseTypeReference(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.FIELD_DEFINITION, + description, + name, + arguments: args, + type, + directives, + }); + } + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + + parseArgumentDefs() { + return this.optionalMany( + _tokenKind.TokenKind.PAREN_L, + this.parseInputValueDef, + _tokenKind.TokenKind.PAREN_R, + ); + } + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + + parseInputValueDef() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + this.expectToken(_tokenKind.TokenKind.COLON); + const type = this.parseTypeReference(); + let defaultValue; + + if (this.expectOptionalToken(_tokenKind.TokenKind.EQUALS)) { + defaultValue = this.parseConstValueLiteral(); + } + + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.INPUT_VALUE_DEFINITION, + description, + name, + type, + defaultValue, + directives, + }); + } + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + + parseInterfaceTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: _kinds.Kind.INTERFACE_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + + parseUnionTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + return this.node(start, { + kind: _kinds.Kind.UNION_TYPE_DEFINITION, + description, + name, + directives, + types, + }); + } + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + + parseUnionMemberTypes() { + return this.expectOptionalToken(_tokenKind.TokenKind.EQUALS) + ? this.delimitedMany(_tokenKind.TokenKind.PIPE, this.parseNamedType) + : []; + } + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + + parseEnumTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + return this.node(start, { + kind: _kinds.Kind.ENUM_TYPE_DEFINITION, + description, + name, + directives, + values, + }); + } + /** + * ``` + * EnumValuesDefinition : { EnumValueDefinition+ } + * ``` + */ + + parseEnumValuesDefinition() { + return this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseEnumValueDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + } + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + */ + + parseEnumValueDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseEnumValueName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: _kinds.Kind.ENUM_VALUE_DEFINITION, + description, + name, + directives, + }); + } + /** + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseEnumValueName() { + if ( + this._lexer.token.value === 'true' || + this._lexer.token.value === 'false' || + this._lexer.token.value === 'null' + ) { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + this._lexer.token.start, + `${getTokenDesc( + this._lexer.token, + )} is reserved and cannot be used for an enum value.`, + ); + } + + return this.parseName(); + } + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + + parseInputObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + return this.node(start, { + kind: _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, + description, + name, + directives, + fields, + }); + } + /** + * ``` + * InputFieldsDefinition : { InputValueDefinition+ } + * ``` + */ + + parseInputFieldsDefinition() { + return this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseInputValueDef, + _tokenKind.TokenKind.BRACE_R, + ); + } + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + + parseTypeSystemExtension() { + const keywordToken = this._lexer.lookahead(); + + if (keywordToken.kind === _tokenKind.TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaExtension(); + + case 'scalar': + return this.parseScalarTypeExtension(); + + case 'type': + return this.parseObjectTypeExtension(); + + case 'interface': + return this.parseInterfaceTypeExtension(); + + case 'union': + return this.parseUnionTypeExtension(); + + case 'enum': + return this.parseEnumTypeExtension(); + + case 'input': + return this.parseInputObjectTypeExtension(); + } + } + + throw this.unexpected(keywordToken); + } + /** + * ``` + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + * ``` + */ + + parseSchemaExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.optionalMany( + _tokenKind.TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + _tokenKind.TokenKind.BRACE_R, + ); + + if (directives.length === 0 && operationTypes.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.SCHEMA_EXTENSION, + directives, + operationTypes, + }); + } + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + + parseScalarTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + + if (directives.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.SCALAR_TYPE_EXTENSION, + name, + directives, + }); + } + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + + parseObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.OBJECT_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + + parseInterfaceTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.INTERFACE_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + + parseUnionTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + + if (directives.length === 0 && types.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.UNION_TYPE_EXTENSION, + name, + directives, + types, + }); + } + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + + parseEnumTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + + if (directives.length === 0 && values.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.ENUM_TYPE_EXTENSION, + name, + directives, + values, + }); + } + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + + parseInputObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + + if (directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, + name, + directives, + fields, + }); + } + /** + * ``` + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + * ``` + */ + + parseDirectiveDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('directive'); + this.expectToken(_tokenKind.TokenKind.AT); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + const repeatable = this.expectOptionalKeyword('repeatable'); + this.expectKeyword('on'); + const locations = this.parseDirectiveLocations(); + return this.node(start, { + kind: _kinds.Kind.DIRECTIVE_DEFINITION, + description, + name, + arguments: args, + repeatable, + locations, + }); + } + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + + parseDirectiveLocations() { + return this.delimitedMany( + _tokenKind.TokenKind.PIPE, + this.parseDirectiveLocation, + ); + } + /* + * DirectiveLocation : + * - ExecutableDirectiveLocation + * - TypeSystemDirectiveLocation + * + * ExecutableDirectiveLocation : one of + * `QUERY` + * `MUTATION` + * `SUBSCRIPTION` + * `FIELD` + * `FRAGMENT_DEFINITION` + * `FRAGMENT_SPREAD` + * `INLINE_FRAGMENT` + * + * TypeSystemDirectiveLocation : one of + * `SCHEMA` + * `SCALAR` + * `OBJECT` + * `FIELD_DEFINITION` + * `ARGUMENT_DEFINITION` + * `INTERFACE` + * `UNION` + * `ENUM` + * `ENUM_VALUE` + * `INPUT_OBJECT` + * `INPUT_FIELD_DEFINITION` + */ + + parseDirectiveLocation() { + const start = this._lexer.token; + const name = this.parseName(); + + if ( + Object.prototype.hasOwnProperty.call( + _directiveLocation.DirectiveLocation, + name.value, + ) + ) { + return name; + } + + throw this.unexpected(start); + } // Core parsing utility functions + + /** + * Returns a node that, if configured to do so, sets a "loc" field as a + * location object, used to identify the place in the source that created a + * given parsed object. + */ + + node(startToken, node) { + if (this._options.noLocation !== true) { + node.loc = new _ast.Location( + startToken, + this._lexer.lastToken, + this._lexer.source, + ); + } + + return node; + } + /** + * Determines if the next token is of a given kind + */ + + peek(kind) { + return this._lexer.token.kind === kind; + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return token; + } + + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`, + ); + } + /** + * If the next token is of the given kind, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectKeyword(value) { + const token = this._lexer.token; + + if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { + this.advanceLexer(); + } else { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Expected "${value}", found ${getTokenDesc(token)}.`, + ); + } + } + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalKeyword(value) { + const token = this._lexer.token; + + if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + + unexpected(atToken) { + const token = + atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; + return (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Unexpected ${getTokenDesc(token)}.`, + ); + } + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + any(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + while (!this.expectOptionalToken(closeKind)) { + nodes.push(parseFn.call(this)); + } + + return nodes; + } + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + optionalMany(openKind, parseFn, closeKind) { + if (this.expectOptionalToken(openKind)) { + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + + return []; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + many(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + + delimitedMany(delimiterKind, parseFn) { + this.expectOptionalToken(delimiterKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (this.expectOptionalToken(delimiterKind)); + + return nodes; + } + + advanceLexer() { + const { maxTokens } = this._options; + + const token = this._lexer.advance(); + + if (maxTokens !== undefined && token.kind !== _tokenKind.TokenKind.EOF) { + ++this._tokenCounter; + + if (this._tokenCounter > maxTokens) { + throw (0, _syntaxError.syntaxError)( + this._lexer.source, + token.start, + `Document contains more that ${maxTokens} tokens. Parsing aborted.`, + ); + } + } + } +} +/** + * A helper function to describe a token as a string for debugging. + */ + +exports.Parser = Parser; + +function getTokenDesc(token) { + const value = token.value; + return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ''); +} +/** + * A helper function to describe a token kind as a string for debugging. + */ + +function getTokenKindDesc(kind) { + return (0, _lexer.isPunctuatorTokenKind)(kind) ? `"${kind}"` : kind; +} diff --git a/graphql-subscription/node_modules/graphql/language/parser.mjs b/graphql-subscription/node_modules/graphql/language/parser.mjs new file mode 100644 index 0000000..2ba066c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/parser.mjs @@ -0,0 +1,1524 @@ +import { syntaxError } from '../error/syntaxError.mjs'; +import { Location, OperationTypeNode } from './ast.mjs'; +import { DirectiveLocation } from './directiveLocation.mjs'; +import { Kind } from './kinds.mjs'; +import { isPunctuatorTokenKind, Lexer } from './lexer.mjs'; +import { isSource, Source } from './source.mjs'; +import { TokenKind } from './tokenKind.mjs'; +/** + * Configuration options to control parser behavior + */ + +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +export function parse(source, options) { + const parser = new Parser(source, options); + return parser.parseDocument(); +} +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ + +export function parseValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const value = parser.parseValueLiteral(false); + parser.expectToken(TokenKind.EOF); + return value; +} +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + */ + +export function parseConstValue(source, options) { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const value = parser.parseConstValueLiteral(); + parser.expectToken(TokenKind.EOF); + return value; +} +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ + +export function parseType(source, options) { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const type = parser.parseTypeReference(); + parser.expectToken(TokenKind.EOF); + return type; +} +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ + +export class Parser { + constructor(source, options = {}) { + const sourceObj = isSource(source) ? source : new Source(source); + this._lexer = new Lexer(sourceObj); + this._options = options; + this._tokenCounter = 0; + } + /** + * Converts a name lex token into a name parse node. + */ + + parseName() { + const token = this.expectToken(TokenKind.NAME); + return this.node(token, { + kind: Kind.NAME, + value: token.value, + }); + } // Implements the parsing rules in the Document section. + + /** + * Document : Definition+ + */ + + parseDocument() { + return this.node(this._lexer.token, { + kind: Kind.DOCUMENT, + definitions: this.many( + TokenKind.SOF, + this.parseDefinition, + TokenKind.EOF, + ), + }); + } + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + * + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + + parseDefinition() { + if (this.peek(TokenKind.BRACE_L)) { + return this.parseOperationDefinition(); + } // Many definitions begin with a description and require a lookahead. + + const hasDescription = this.peekDescription(); + const keywordToken = hasDescription + ? this._lexer.lookahead() + : this._lexer.token; + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaDefinition(); + + case 'scalar': + return this.parseScalarTypeDefinition(); + + case 'type': + return this.parseObjectTypeDefinition(); + + case 'interface': + return this.parseInterfaceTypeDefinition(); + + case 'union': + return this.parseUnionTypeDefinition(); + + case 'enum': + return this.parseEnumTypeDefinition(); + + case 'input': + return this.parseInputObjectTypeDefinition(); + + case 'directive': + return this.parseDirectiveDefinition(); + } + + if (hasDescription) { + throw syntaxError( + this._lexer.source, + this._lexer.token.start, + 'Unexpected description, descriptions are supported only on type definitions.', + ); + } + + switch (keywordToken.value) { + case 'query': + case 'mutation': + case 'subscription': + return this.parseOperationDefinition(); + + case 'fragment': + return this.parseFragmentDefinition(); + + case 'extend': + return this.parseTypeSystemExtension(); + } + } + + throw this.unexpected(keywordToken); + } // Implements the parsing rules in the Operations section. + + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + + parseOperationDefinition() { + const start = this._lexer.token; + + if (this.peek(TokenKind.BRACE_L)) { + return this.node(start, { + kind: Kind.OPERATION_DEFINITION, + operation: OperationTypeNode.QUERY, + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: this.parseSelectionSet(), + }); + } + + const operation = this.parseOperationType(); + let name; + + if (this.peek(TokenKind.NAME)) { + name = this.parseName(); + } + + return this.node(start, { + kind: Kind.OPERATION_DEFINITION, + operation, + name, + variableDefinitions: this.parseVariableDefinitions(), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * OperationType : one of query mutation subscription + */ + + parseOperationType() { + const operationToken = this.expectToken(TokenKind.NAME); + + switch (operationToken.value) { + case 'query': + return OperationTypeNode.QUERY; + + case 'mutation': + return OperationTypeNode.MUTATION; + + case 'subscription': + return OperationTypeNode.SUBSCRIPTION; + } + + throw this.unexpected(operationToken); + } + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + + parseVariableDefinitions() { + return this.optionalMany( + TokenKind.PAREN_L, + this.parseVariableDefinition, + TokenKind.PAREN_R, + ); + } + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + + parseVariableDefinition() { + return this.node(this._lexer.token, { + kind: Kind.VARIABLE_DEFINITION, + variable: this.parseVariable(), + type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), + defaultValue: this.expectOptionalToken(TokenKind.EQUALS) + ? this.parseConstValueLiteral() + : undefined, + directives: this.parseConstDirectives(), + }); + } + /** + * Variable : $ Name + */ + + parseVariable() { + const start = this._lexer.token; + this.expectToken(TokenKind.DOLLAR); + return this.node(start, { + kind: Kind.VARIABLE, + name: this.parseName(), + }); + } + /** + * ``` + * SelectionSet : { Selection+ } + * ``` + */ + + parseSelectionSet() { + return this.node(this._lexer.token, { + kind: Kind.SELECTION_SET, + selections: this.many( + TokenKind.BRACE_L, + this.parseSelection, + TokenKind.BRACE_R, + ), + }); + } + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + + parseSelection() { + return this.peek(TokenKind.SPREAD) + ? this.parseFragment() + : this.parseField(); + } + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + + parseField() { + const start = this._lexer.token; + const nameOrAlias = this.parseName(); + let alias; + let name; + + if (this.expectOptionalToken(TokenKind.COLON)) { + alias = nameOrAlias; + name = this.parseName(); + } else { + name = nameOrAlias; + } + + return this.node(start, { + kind: Kind.FIELD, + alias, + name, + arguments: this.parseArguments(false), + directives: this.parseDirectives(false), + selectionSet: this.peek(TokenKind.BRACE_L) + ? this.parseSelectionSet() + : undefined, + }); + } + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + + parseArguments(isConst) { + const item = isConst ? this.parseConstArgument : this.parseArgument; + return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); + } + /** + * Argument[Const] : Name : Value[?Const] + */ + + parseArgument(isConst = false) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + return this.node(start, { + kind: Kind.ARGUMENT, + name, + value: this.parseValueLiteral(isConst), + }); + } + + parseConstArgument() { + return this.parseArgument(true); + } // Implements the parsing rules in the Fragments section. + + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + + parseFragment() { + const start = this._lexer.token; + this.expectToken(TokenKind.SPREAD); + const hasTypeCondition = this.expectOptionalKeyword('on'); + + if (!hasTypeCondition && this.peek(TokenKind.NAME)) { + return this.node(start, { + kind: Kind.FRAGMENT_SPREAD, + name: this.parseFragmentName(), + directives: this.parseDirectives(false), + }); + } + + return this.node(start, { + kind: Kind.INLINE_FRAGMENT, + typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + + parseFragmentDefinition() { + const start = this._lexer.token; + this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes + // the grammar of FragmentDefinition: + // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + + if (this._options.allowLegacyFragmentVariables === true) { + return this.node(start, { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + variableDefinitions: this.parseVariableDefinitions(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + + return this.node(start, { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + /** + * FragmentName : Name but not `on` + */ + + parseFragmentName() { + if (this._lexer.token.value === 'on') { + throw this.unexpected(); + } + + return this.parseName(); + } // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseValueLiteral(isConst) { + const token = this._lexer.token; + + switch (token.kind) { + case TokenKind.BRACKET_L: + return this.parseList(isConst); + + case TokenKind.BRACE_L: + return this.parseObject(isConst); + + case TokenKind.INT: + this.advanceLexer(); + return this.node(token, { + kind: Kind.INT, + value: token.value, + }); + + case TokenKind.FLOAT: + this.advanceLexer(); + return this.node(token, { + kind: Kind.FLOAT, + value: token.value, + }); + + case TokenKind.STRING: + case TokenKind.BLOCK_STRING: + return this.parseStringLiteral(); + + case TokenKind.NAME: + this.advanceLexer(); + + switch (token.value) { + case 'true': + return this.node(token, { + kind: Kind.BOOLEAN, + value: true, + }); + + case 'false': + return this.node(token, { + kind: Kind.BOOLEAN, + value: false, + }); + + case 'null': + return this.node(token, { + kind: Kind.NULL, + }); + + default: + return this.node(token, { + kind: Kind.ENUM, + value: token.value, + }); + } + + case TokenKind.DOLLAR: + if (isConst) { + this.expectToken(TokenKind.DOLLAR); + + if (this._lexer.token.kind === TokenKind.NAME) { + const varName = this._lexer.token.value; + throw syntaxError( + this._lexer.source, + token.start, + `Unexpected variable "$${varName}" in constant value.`, + ); + } else { + throw this.unexpected(token); + } + } + + return this.parseVariable(); + + default: + throw this.unexpected(); + } + } + + parseConstValueLiteral() { + return this.parseValueLiteral(true); + } + + parseStringLiteral() { + const token = this._lexer.token; + this.advanceLexer(); + return this.node(token, { + kind: Kind.STRING, + value: token.value, + block: token.kind === TokenKind.BLOCK_STRING, + }); + } + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + + parseList(isConst) { + const item = () => this.parseValueLiteral(isConst); + + return this.node(this._lexer.token, { + kind: Kind.LIST, + values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R), + }); + } + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + + parseObject(isConst) { + const item = () => this.parseObjectField(isConst); + + return this.node(this._lexer.token, { + kind: Kind.OBJECT, + fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R), + }); + } + /** + * ObjectField[Const] : Name : Value[?Const] + */ + + parseObjectField(isConst) { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + return this.node(start, { + kind: Kind.OBJECT_FIELD, + name, + value: this.parseValueLiteral(isConst), + }); + } // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + + parseDirectives(isConst) { + const directives = []; + + while (this.peek(TokenKind.AT)) { + directives.push(this.parseDirective(isConst)); + } + + return directives; + } + + parseConstDirectives() { + return this.parseDirectives(true); + } + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + + parseDirective(isConst) { + const start = this._lexer.token; + this.expectToken(TokenKind.AT); + return this.node(start, { + kind: Kind.DIRECTIVE, + name: this.parseName(), + arguments: this.parseArguments(isConst), + }); + } // Implements the parsing rules in the Types section. + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + + parseTypeReference() { + const start = this._lexer.token; + let type; + + if (this.expectOptionalToken(TokenKind.BRACKET_L)) { + const innerType = this.parseTypeReference(); + this.expectToken(TokenKind.BRACKET_R); + type = this.node(start, { + kind: Kind.LIST_TYPE, + type: innerType, + }); + } else { + type = this.parseNamedType(); + } + + if (this.expectOptionalToken(TokenKind.BANG)) { + return this.node(start, { + kind: Kind.NON_NULL_TYPE, + type, + }); + } + + return type; + } + /** + * NamedType : Name + */ + + parseNamedType() { + return this.node(this._lexer.token, { + kind: Kind.NAMED_TYPE, + name: this.parseName(), + }); + } // Implements the parsing rules in the Type Definition section. + + peekDescription() { + return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); + } + /** + * Description : StringValue + */ + + parseDescription() { + if (this.peekDescription()) { + return this.parseStringLiteral(); + } + } + /** + * ``` + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + * ``` + */ + + parseSchemaDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.many( + TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + TokenKind.BRACE_R, + ); + return this.node(start, { + kind: Kind.SCHEMA_DEFINITION, + description, + directives, + operationTypes, + }); + } + /** + * OperationTypeDefinition : OperationType : NamedType + */ + + parseOperationTypeDefinition() { + const start = this._lexer.token; + const operation = this.parseOperationType(); + this.expectToken(TokenKind.COLON); + const type = this.parseNamedType(); + return this.node(start, { + kind: Kind.OPERATION_TYPE_DEFINITION, + operation, + type, + }); + } + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + + parseScalarTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.SCALAR_TYPE_DEFINITION, + description, + name, + directives, + }); + } + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + + parseObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: Kind.OBJECT_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + + parseImplementsInterfaces() { + return this.expectOptionalKeyword('implements') + ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) + : []; + } + /** + * ``` + * FieldsDefinition : { FieldDefinition+ } + * ``` + */ + + parseFieldsDefinition() { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseFieldDefinition, + TokenKind.BRACE_R, + ); + } + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + + parseFieldDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + this.expectToken(TokenKind.COLON); + const type = this.parseTypeReference(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.FIELD_DEFINITION, + description, + name, + arguments: args, + type, + directives, + }); + } + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + + parseArgumentDefs() { + return this.optionalMany( + TokenKind.PAREN_L, + this.parseInputValueDef, + TokenKind.PAREN_R, + ); + } + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + + parseInputValueDef() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + const type = this.parseTypeReference(); + let defaultValue; + + if (this.expectOptionalToken(TokenKind.EQUALS)) { + defaultValue = this.parseConstValueLiteral(); + } + + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.INPUT_VALUE_DEFINITION, + description, + name, + type, + defaultValue, + directives, + }); + } + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + + parseInterfaceTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: Kind.INTERFACE_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + + parseUnionTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + return this.node(start, { + kind: Kind.UNION_TYPE_DEFINITION, + description, + name, + directives, + types, + }); + } + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + + parseUnionMemberTypes() { + return this.expectOptionalToken(TokenKind.EQUALS) + ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) + : []; + } + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + + parseEnumTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + return this.node(start, { + kind: Kind.ENUM_TYPE_DEFINITION, + description, + name, + directives, + values, + }); + } + /** + * ``` + * EnumValuesDefinition : { EnumValueDefinition+ } + * ``` + */ + + parseEnumValuesDefinition() { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseEnumValueDefinition, + TokenKind.BRACE_R, + ); + } + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + */ + + parseEnumValueDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseEnumValueName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.ENUM_VALUE_DEFINITION, + description, + name, + directives, + }); + } + /** + * EnumValue : Name but not `true`, `false` or `null` + */ + + parseEnumValueName() { + if ( + this._lexer.token.value === 'true' || + this._lexer.token.value === 'false' || + this._lexer.token.value === 'null' + ) { + throw syntaxError( + this._lexer.source, + this._lexer.token.start, + `${getTokenDesc( + this._lexer.token, + )} is reserved and cannot be used for an enum value.`, + ); + } + + return this.parseName(); + } + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + + parseInputObjectTypeDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + return this.node(start, { + kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, + description, + name, + directives, + fields, + }); + } + /** + * ``` + * InputFieldsDefinition : { InputValueDefinition+ } + * ``` + */ + + parseInputFieldsDefinition() { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseInputValueDef, + TokenKind.BRACE_R, + ); + } + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + + parseTypeSystemExtension() { + const keywordToken = this._lexer.lookahead(); + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaExtension(); + + case 'scalar': + return this.parseScalarTypeExtension(); + + case 'type': + return this.parseObjectTypeExtension(); + + case 'interface': + return this.parseInterfaceTypeExtension(); + + case 'union': + return this.parseUnionTypeExtension(); + + case 'enum': + return this.parseEnumTypeExtension(); + + case 'input': + return this.parseInputObjectTypeExtension(); + } + } + + throw this.unexpected(keywordToken); + } + /** + * ``` + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + * ``` + */ + + parseSchemaExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.optionalMany( + TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + TokenKind.BRACE_R, + ); + + if (directives.length === 0 && operationTypes.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.SCHEMA_EXTENSION, + directives, + operationTypes, + }); + } + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + + parseScalarTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + + if (directives.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.SCALAR_TYPE_EXTENSION, + name, + directives, + }); + } + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + + parseObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.OBJECT_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + + parseInterfaceTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.INTERFACE_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + + parseUnionTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + + if (directives.length === 0 && types.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.UNION_TYPE_EXTENSION, + name, + directives, + types, + }); + } + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + + parseEnumTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + + if (directives.length === 0 && values.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.ENUM_TYPE_EXTENSION, + name, + directives, + values, + }); + } + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + + parseInputObjectTypeExtension() { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + + if (directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return this.node(start, { + kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, + name, + directives, + fields, + }); + } + /** + * ``` + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + * ``` + */ + + parseDirectiveDefinition() { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('directive'); + this.expectToken(TokenKind.AT); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + const repeatable = this.expectOptionalKeyword('repeatable'); + this.expectKeyword('on'); + const locations = this.parseDirectiveLocations(); + return this.node(start, { + kind: Kind.DIRECTIVE_DEFINITION, + description, + name, + arguments: args, + repeatable, + locations, + }); + } + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + + parseDirectiveLocations() { + return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); + } + /* + * DirectiveLocation : + * - ExecutableDirectiveLocation + * - TypeSystemDirectiveLocation + * + * ExecutableDirectiveLocation : one of + * `QUERY` + * `MUTATION` + * `SUBSCRIPTION` + * `FIELD` + * `FRAGMENT_DEFINITION` + * `FRAGMENT_SPREAD` + * `INLINE_FRAGMENT` + * + * TypeSystemDirectiveLocation : one of + * `SCHEMA` + * `SCALAR` + * `OBJECT` + * `FIELD_DEFINITION` + * `ARGUMENT_DEFINITION` + * `INTERFACE` + * `UNION` + * `ENUM` + * `ENUM_VALUE` + * `INPUT_OBJECT` + * `INPUT_FIELD_DEFINITION` + */ + + parseDirectiveLocation() { + const start = this._lexer.token; + const name = this.parseName(); + + if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) { + return name; + } + + throw this.unexpected(start); + } // Core parsing utility functions + + /** + * Returns a node that, if configured to do so, sets a "loc" field as a + * location object, used to identify the place in the source that created a + * given parsed object. + */ + + node(startToken, node) { + if (this._options.noLocation !== true) { + node.loc = new Location( + startToken, + this._lexer.lastToken, + this._lexer.source, + ); + } + + return node; + } + /** + * Determines if the next token is of a given kind + */ + + peek(kind) { + return this._lexer.token.kind === kind; + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return token; + } + + throw syntaxError( + this._lexer.source, + token.start, + `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`, + ); + } + /** + * If the next token is of the given kind, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalToken(kind) { + const token = this._lexer.token; + + if (token.kind === kind) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + + expectKeyword(value) { + const token = this._lexer.token; + + if (token.kind === TokenKind.NAME && token.value === value) { + this.advanceLexer(); + } else { + throw syntaxError( + this._lexer.source, + token.start, + `Expected "${value}", found ${getTokenDesc(token)}.`, + ); + } + } + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + + expectOptionalKeyword(value) { + const token = this._lexer.token; + + if (token.kind === TokenKind.NAME && token.value === value) { + this.advanceLexer(); + return true; + } + + return false; + } + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + + unexpected(atToken) { + const token = + atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; + return syntaxError( + this._lexer.source, + token.start, + `Unexpected ${getTokenDesc(token)}.`, + ); + } + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + any(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + while (!this.expectOptionalToken(closeKind)) { + nodes.push(parseFn.call(this)); + } + + return nodes; + } + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + optionalMany(openKind, parseFn, closeKind) { + if (this.expectOptionalToken(openKind)) { + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + + return []; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + + many(openKind, parseFn, closeKind) { + this.expectToken(openKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + + delimitedMany(delimiterKind, parseFn) { + this.expectOptionalToken(delimiterKind); + const nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (this.expectOptionalToken(delimiterKind)); + + return nodes; + } + + advanceLexer() { + const { maxTokens } = this._options; + + const token = this._lexer.advance(); + + if (maxTokens !== undefined && token.kind !== TokenKind.EOF) { + ++this._tokenCounter; + + if (this._tokenCounter > maxTokens) { + throw syntaxError( + this._lexer.source, + token.start, + `Document contains more that ${maxTokens} tokens. Parsing aborted.`, + ); + } + } + } +} +/** + * A helper function to describe a token as a string for debugging. + */ + +function getTokenDesc(token) { + const value = token.value; + return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ''); +} +/** + * A helper function to describe a token kind as a string for debugging. + */ + +function getTokenKindDesc(kind) { + return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind; +} diff --git a/graphql-subscription/node_modules/graphql/language/predicates.d.ts b/graphql-subscription/node_modules/graphql/language/predicates.d.ts new file mode 100644 index 0000000..3ebad9b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/predicates.d.ts @@ -0,0 +1,33 @@ +import type { + ASTNode, + ConstValueNode, + DefinitionNode, + ExecutableDefinitionNode, + SelectionNode, + TypeDefinitionNode, + TypeExtensionNode, + TypeNode, + TypeSystemDefinitionNode, + TypeSystemExtensionNode, + ValueNode, +} from './ast'; +export declare function isDefinitionNode(node: ASTNode): node is DefinitionNode; +export declare function isExecutableDefinitionNode( + node: ASTNode, +): node is ExecutableDefinitionNode; +export declare function isSelectionNode(node: ASTNode): node is SelectionNode; +export declare function isValueNode(node: ASTNode): node is ValueNode; +export declare function isConstValueNode(node: ASTNode): node is ConstValueNode; +export declare function isTypeNode(node: ASTNode): node is TypeNode; +export declare function isTypeSystemDefinitionNode( + node: ASTNode, +): node is TypeSystemDefinitionNode; +export declare function isTypeDefinitionNode( + node: ASTNode, +): node is TypeDefinitionNode; +export declare function isTypeSystemExtensionNode( + node: ASTNode, +): node is TypeSystemExtensionNode; +export declare function isTypeExtensionNode( + node: ASTNode, +): node is TypeExtensionNode; diff --git a/graphql-subscription/node_modules/graphql/language/predicates.js b/graphql-subscription/node_modules/graphql/language/predicates.js new file mode 100644 index 0000000..da635a8 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/predicates.js @@ -0,0 +1,109 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.isConstValueNode = isConstValueNode; +exports.isDefinitionNode = isDefinitionNode; +exports.isExecutableDefinitionNode = isExecutableDefinitionNode; +exports.isSelectionNode = isSelectionNode; +exports.isTypeDefinitionNode = isTypeDefinitionNode; +exports.isTypeExtensionNode = isTypeExtensionNode; +exports.isTypeNode = isTypeNode; +exports.isTypeSystemDefinitionNode = isTypeSystemDefinitionNode; +exports.isTypeSystemExtensionNode = isTypeSystemExtensionNode; +exports.isValueNode = isValueNode; + +var _kinds = require('./kinds.js'); + +function isDefinitionNode(node) { + return ( + isExecutableDefinitionNode(node) || + isTypeSystemDefinitionNode(node) || + isTypeSystemExtensionNode(node) + ); +} + +function isExecutableDefinitionNode(node) { + return ( + node.kind === _kinds.Kind.OPERATION_DEFINITION || + node.kind === _kinds.Kind.FRAGMENT_DEFINITION + ); +} + +function isSelectionNode(node) { + return ( + node.kind === _kinds.Kind.FIELD || + node.kind === _kinds.Kind.FRAGMENT_SPREAD || + node.kind === _kinds.Kind.INLINE_FRAGMENT + ); +} + +function isValueNode(node) { + return ( + node.kind === _kinds.Kind.VARIABLE || + node.kind === _kinds.Kind.INT || + node.kind === _kinds.Kind.FLOAT || + node.kind === _kinds.Kind.STRING || + node.kind === _kinds.Kind.BOOLEAN || + node.kind === _kinds.Kind.NULL || + node.kind === _kinds.Kind.ENUM || + node.kind === _kinds.Kind.LIST || + node.kind === _kinds.Kind.OBJECT + ); +} + +function isConstValueNode(node) { + return ( + isValueNode(node) && + (node.kind === _kinds.Kind.LIST + ? node.values.some(isConstValueNode) + : node.kind === _kinds.Kind.OBJECT + ? node.fields.some((field) => isConstValueNode(field.value)) + : node.kind !== _kinds.Kind.VARIABLE) + ); +} + +function isTypeNode(node) { + return ( + node.kind === _kinds.Kind.NAMED_TYPE || + node.kind === _kinds.Kind.LIST_TYPE || + node.kind === _kinds.Kind.NON_NULL_TYPE + ); +} + +function isTypeSystemDefinitionNode(node) { + return ( + node.kind === _kinds.Kind.SCHEMA_DEFINITION || + isTypeDefinitionNode(node) || + node.kind === _kinds.Kind.DIRECTIVE_DEFINITION + ); +} + +function isTypeDefinitionNode(node) { + return ( + node.kind === _kinds.Kind.SCALAR_TYPE_DEFINITION || + node.kind === _kinds.Kind.OBJECT_TYPE_DEFINITION || + node.kind === _kinds.Kind.INTERFACE_TYPE_DEFINITION || + node.kind === _kinds.Kind.UNION_TYPE_DEFINITION || + node.kind === _kinds.Kind.ENUM_TYPE_DEFINITION || + node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION + ); +} + +function isTypeSystemExtensionNode(node) { + return ( + node.kind === _kinds.Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node) + ); +} + +function isTypeExtensionNode(node) { + return ( + node.kind === _kinds.Kind.SCALAR_TYPE_EXTENSION || + node.kind === _kinds.Kind.OBJECT_TYPE_EXTENSION || + node.kind === _kinds.Kind.INTERFACE_TYPE_EXTENSION || + node.kind === _kinds.Kind.UNION_TYPE_EXTENSION || + node.kind === _kinds.Kind.ENUM_TYPE_EXTENSION || + node.kind === _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION + ); +} diff --git a/graphql-subscription/node_modules/graphql/language/predicates.mjs b/graphql-subscription/node_modules/graphql/language/predicates.mjs new file mode 100644 index 0000000..858ff4e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/predicates.mjs @@ -0,0 +1,81 @@ +import { Kind } from './kinds.mjs'; +export function isDefinitionNode(node) { + return ( + isExecutableDefinitionNode(node) || + isTypeSystemDefinitionNode(node) || + isTypeSystemExtensionNode(node) + ); +} +export function isExecutableDefinitionNode(node) { + return ( + node.kind === Kind.OPERATION_DEFINITION || + node.kind === Kind.FRAGMENT_DEFINITION + ); +} +export function isSelectionNode(node) { + return ( + node.kind === Kind.FIELD || + node.kind === Kind.FRAGMENT_SPREAD || + node.kind === Kind.INLINE_FRAGMENT + ); +} +export function isValueNode(node) { + return ( + node.kind === Kind.VARIABLE || + node.kind === Kind.INT || + node.kind === Kind.FLOAT || + node.kind === Kind.STRING || + node.kind === Kind.BOOLEAN || + node.kind === Kind.NULL || + node.kind === Kind.ENUM || + node.kind === Kind.LIST || + node.kind === Kind.OBJECT + ); +} +export function isConstValueNode(node) { + return ( + isValueNode(node) && + (node.kind === Kind.LIST + ? node.values.some(isConstValueNode) + : node.kind === Kind.OBJECT + ? node.fields.some((field) => isConstValueNode(field.value)) + : node.kind !== Kind.VARIABLE) + ); +} +export function isTypeNode(node) { + return ( + node.kind === Kind.NAMED_TYPE || + node.kind === Kind.LIST_TYPE || + node.kind === Kind.NON_NULL_TYPE + ); +} +export function isTypeSystemDefinitionNode(node) { + return ( + node.kind === Kind.SCHEMA_DEFINITION || + isTypeDefinitionNode(node) || + node.kind === Kind.DIRECTIVE_DEFINITION + ); +} +export function isTypeDefinitionNode(node) { + return ( + node.kind === Kind.SCALAR_TYPE_DEFINITION || + node.kind === Kind.OBJECT_TYPE_DEFINITION || + node.kind === Kind.INTERFACE_TYPE_DEFINITION || + node.kind === Kind.UNION_TYPE_DEFINITION || + node.kind === Kind.ENUM_TYPE_DEFINITION || + node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION + ); +} +export function isTypeSystemExtensionNode(node) { + return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); +} +export function isTypeExtensionNode(node) { + return ( + node.kind === Kind.SCALAR_TYPE_EXTENSION || + node.kind === Kind.OBJECT_TYPE_EXTENSION || + node.kind === Kind.INTERFACE_TYPE_EXTENSION || + node.kind === Kind.UNION_TYPE_EXTENSION || + node.kind === Kind.ENUM_TYPE_EXTENSION || + node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION + ); +} diff --git a/graphql-subscription/node_modules/graphql/language/printLocation.d.ts b/graphql-subscription/node_modules/graphql/language/printLocation.d.ts new file mode 100644 index 0000000..c3f9b91 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printLocation.d.ts @@ -0,0 +1,14 @@ +import type { Location } from './ast'; +import type { SourceLocation } from './location'; +import type { Source } from './source'; +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export declare function printLocation(location: Location): string; +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export declare function printSourceLocation( + source: Source, + sourceLocation: SourceLocation, +): string; diff --git a/graphql-subscription/node_modules/graphql/language/printLocation.js b/graphql-subscription/node_modules/graphql/language/printLocation.js new file mode 100644 index 0000000..c507ab7 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printLocation.js @@ -0,0 +1,74 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printLocation = printLocation; +exports.printSourceLocation = printSourceLocation; + +var _location = require('./location.js'); + +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +function printLocation(location) { + return printSourceLocation( + location.source, + (0, _location.getLocation)(location.source, location.start), + ); +} +/** + * Render a helpful description of the location in the GraphQL Source document. + */ + +function printSourceLocation(source, sourceLocation) { + const firstLineColumnOffset = source.locationOffset.column - 1; + const body = ''.padStart(firstLineColumnOffset) + source.body; + const lineIndex = sourceLocation.line - 1; + const lineOffset = source.locationOffset.line - 1; + const lineNum = sourceLocation.line + lineOffset; + const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; + const columnNum = sourceLocation.column + columnOffset; + const locationStr = `${source.name}:${lineNum}:${columnNum}\n`; + const lines = body.split(/\r\n|[\n\r]/g); + const locationLine = lines[lineIndex]; // Special case for minified documents + + if (locationLine.length > 120) { + const subLineIndex = Math.floor(columnNum / 80); + const subLineColumnNum = columnNum % 80; + const subLines = []; + + for (let i = 0; i < locationLine.length; i += 80) { + subLines.push(locationLine.slice(i, i + 80)); + } + + return ( + locationStr + + printPrefixedLines([ + [`${lineNum} |`, subLines[0]], + ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]), + ['|', '^'.padStart(subLineColumnNum)], + ['|', subLines[subLineIndex + 1]], + ]) + ); + } + + return ( + locationStr + + printPrefixedLines([ + // Lines specified like this: ["prefix", "string"], + [`${lineNum - 1} |`, lines[lineIndex - 1]], + [`${lineNum} |`, locationLine], + ['|', '^'.padStart(columnNum)], + [`${lineNum + 1} |`, lines[lineIndex + 1]], + ]) + ); +} + +function printPrefixedLines(lines) { + const existingLines = lines.filter(([_, line]) => line !== undefined); + const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); + return existingLines + .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : '')) + .join('\n'); +} diff --git a/graphql-subscription/node_modules/graphql/language/printLocation.mjs b/graphql-subscription/node_modules/graphql/language/printLocation.mjs new file mode 100644 index 0000000..4b9a66f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printLocation.mjs @@ -0,0 +1,66 @@ +import { getLocation } from './location.mjs'; + +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export function printLocation(location) { + return printSourceLocation( + location.source, + getLocation(location.source, location.start), + ); +} +/** + * Render a helpful description of the location in the GraphQL Source document. + */ + +export function printSourceLocation(source, sourceLocation) { + const firstLineColumnOffset = source.locationOffset.column - 1; + const body = ''.padStart(firstLineColumnOffset) + source.body; + const lineIndex = sourceLocation.line - 1; + const lineOffset = source.locationOffset.line - 1; + const lineNum = sourceLocation.line + lineOffset; + const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; + const columnNum = sourceLocation.column + columnOffset; + const locationStr = `${source.name}:${lineNum}:${columnNum}\n`; + const lines = body.split(/\r\n|[\n\r]/g); + const locationLine = lines[lineIndex]; // Special case for minified documents + + if (locationLine.length > 120) { + const subLineIndex = Math.floor(columnNum / 80); + const subLineColumnNum = columnNum % 80; + const subLines = []; + + for (let i = 0; i < locationLine.length; i += 80) { + subLines.push(locationLine.slice(i, i + 80)); + } + + return ( + locationStr + + printPrefixedLines([ + [`${lineNum} |`, subLines[0]], + ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]), + ['|', '^'.padStart(subLineColumnNum)], + ['|', subLines[subLineIndex + 1]], + ]) + ); + } + + return ( + locationStr + + printPrefixedLines([ + // Lines specified like this: ["prefix", "string"], + [`${lineNum - 1} |`, lines[lineIndex - 1]], + [`${lineNum} |`, locationLine], + ['|', '^'.padStart(columnNum)], + [`${lineNum + 1} |`, lines[lineIndex + 1]], + ]) + ); +} + +function printPrefixedLines(lines) { + const existingLines = lines.filter(([_, line]) => line !== undefined); + const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); + return existingLines + .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : '')) + .join('\n'); +} diff --git a/graphql-subscription/node_modules/graphql/language/printString.d.ts b/graphql-subscription/node_modules/graphql/language/printString.d.ts new file mode 100644 index 0000000..34caad6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printString.d.ts @@ -0,0 +1,5 @@ +/** + * Prints a string as a GraphQL StringValue literal. Replaces control characters + * and excluded characters (" U+0022 and \\ U+005C) with escape sequences. + */ +export declare function printString(str: string): string; diff --git a/graphql-subscription/node_modules/graphql/language/printString.js b/graphql-subscription/node_modules/graphql/language/printString.js new file mode 100644 index 0000000..4b3da49 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printString.js @@ -0,0 +1,183 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printString = printString; + +/** + * Prints a string as a GraphQL StringValue literal. Replaces control characters + * and excluded characters (" U+0022 and \\ U+005C) with escape sequences. + */ +function printString(str) { + return `"${str.replace(escapedRegExp, escapedReplacer)}"`; +} // eslint-disable-next-line no-control-regex + +const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; + +function escapedReplacer(str) { + return escapeSequences[str.charCodeAt(0)]; +} // prettier-ignore + +const escapeSequences = [ + '\\u0000', + '\\u0001', + '\\u0002', + '\\u0003', + '\\u0004', + '\\u0005', + '\\u0006', + '\\u0007', + '\\b', + '\\t', + '\\n', + '\\u000B', + '\\f', + '\\r', + '\\u000E', + '\\u000F', + '\\u0010', + '\\u0011', + '\\u0012', + '\\u0013', + '\\u0014', + '\\u0015', + '\\u0016', + '\\u0017', + '\\u0018', + '\\u0019', + '\\u001A', + '\\u001B', + '\\u001C', + '\\u001D', + '\\u001E', + '\\u001F', + '', + '', + '\\"', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 2F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 3F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 4F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\\\', + '', + '', + '', // 5F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 6F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\u007F', + '\\u0080', + '\\u0081', + '\\u0082', + '\\u0083', + '\\u0084', + '\\u0085', + '\\u0086', + '\\u0087', + '\\u0088', + '\\u0089', + '\\u008A', + '\\u008B', + '\\u008C', + '\\u008D', + '\\u008E', + '\\u008F', + '\\u0090', + '\\u0091', + '\\u0092', + '\\u0093', + '\\u0094', + '\\u0095', + '\\u0096', + '\\u0097', + '\\u0098', + '\\u0099', + '\\u009A', + '\\u009B', + '\\u009C', + '\\u009D', + '\\u009E', + '\\u009F', +]; diff --git a/graphql-subscription/node_modules/graphql/language/printString.mjs b/graphql-subscription/node_modules/graphql/language/printString.mjs new file mode 100644 index 0000000..bb034b4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printString.mjs @@ -0,0 +1,176 @@ +/** + * Prints a string as a GraphQL StringValue literal. Replaces control characters + * and excluded characters (" U+0022 and \\ U+005C) with escape sequences. + */ +export function printString(str) { + return `"${str.replace(escapedRegExp, escapedReplacer)}"`; +} // eslint-disable-next-line no-control-regex + +const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; + +function escapedReplacer(str) { + return escapeSequences[str.charCodeAt(0)]; +} // prettier-ignore + +const escapeSequences = [ + '\\u0000', + '\\u0001', + '\\u0002', + '\\u0003', + '\\u0004', + '\\u0005', + '\\u0006', + '\\u0007', + '\\b', + '\\t', + '\\n', + '\\u000B', + '\\f', + '\\r', + '\\u000E', + '\\u000F', + '\\u0010', + '\\u0011', + '\\u0012', + '\\u0013', + '\\u0014', + '\\u0015', + '\\u0016', + '\\u0017', + '\\u0018', + '\\u0019', + '\\u001A', + '\\u001B', + '\\u001C', + '\\u001D', + '\\u001E', + '\\u001F', + '', + '', + '\\"', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 2F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 3F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 4F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\\\', + '', + '', + '', // 5F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', // 6F + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '\\u007F', + '\\u0080', + '\\u0081', + '\\u0082', + '\\u0083', + '\\u0084', + '\\u0085', + '\\u0086', + '\\u0087', + '\\u0088', + '\\u0089', + '\\u008A', + '\\u008B', + '\\u008C', + '\\u008D', + '\\u008E', + '\\u008F', + '\\u0090', + '\\u0091', + '\\u0092', + '\\u0093', + '\\u0094', + '\\u0095', + '\\u0096', + '\\u0097', + '\\u0098', + '\\u0099', + '\\u009A', + '\\u009B', + '\\u009C', + '\\u009D', + '\\u009E', + '\\u009F', +]; diff --git a/graphql-subscription/node_modules/graphql/language/printer.d.ts b/graphql-subscription/node_modules/graphql/language/printer.d.ts new file mode 100644 index 0000000..336dbf4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printer.d.ts @@ -0,0 +1,6 @@ +import type { ASTNode } from './ast'; +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ +export declare function print(ast: ASTNode): string; diff --git a/graphql-subscription/node_modules/graphql/language/printer.js b/graphql-subscription/node_modules/graphql/language/printer.js new file mode 100644 index 0000000..eed3b7c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printer.js @@ -0,0 +1,351 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.print = print; + +var _blockString = require('./blockString.js'); + +var _printString = require('./printString.js'); + +var _visitor = require('./visitor.js'); + +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ +function print(ast) { + return (0, _visitor.visit)(ast, printDocASTReducer); +} + +const MAX_LINE_LENGTH = 80; +const printDocASTReducer = { + Name: { + leave: (node) => node.value, + }, + Variable: { + leave: (node) => '$' + node.name, + }, + // Document + Document: { + leave: (node) => join(node.definitions, '\n\n'), + }, + OperationDefinition: { + leave(node) { + const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); + const prefix = join( + [ + node.operation, + join([node.name, varDefs]), + join(node.directives, ' '), + ], + ' ', + ); // Anonymous queries with no directives or variable definitions can use + // the query short form. + + return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet; + }, + }, + VariableDefinition: { + leave: ({ variable, type, defaultValue, directives }) => + variable + + ': ' + + type + + wrap(' = ', defaultValue) + + wrap(' ', join(directives, ' ')), + }, + SelectionSet: { + leave: ({ selections }) => block(selections), + }, + Field: { + leave({ alias, name, arguments: args, directives, selectionSet }) { + const prefix = wrap('', alias, ': ') + name; + let argsLine = prefix + wrap('(', join(args, ', '), ')'); + + if (argsLine.length > MAX_LINE_LENGTH) { + argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); + } + + return join([argsLine, join(directives, ' '), selectionSet], ' '); + }, + }, + Argument: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Fragments + FragmentSpread: { + leave: ({ name, directives }) => + '...' + name + wrap(' ', join(directives, ' ')), + }, + InlineFragment: { + leave: ({ typeCondition, directives, selectionSet }) => + join( + [ + '...', + wrap('on ', typeCondition), + join(directives, ' '), + selectionSet, + ], + ' ', + ), + }, + FragmentDefinition: { + leave: ( + { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed + ) => + // or removed in the future. + `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` + + `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` + + selectionSet, + }, + // Value + IntValue: { + leave: ({ value }) => value, + }, + FloatValue: { + leave: ({ value }) => value, + }, + StringValue: { + leave: ({ value, block: isBlockString }) => + isBlockString + ? (0, _blockString.printBlockString)(value) + : (0, _printString.printString)(value), + }, + BooleanValue: { + leave: ({ value }) => (value ? 'true' : 'false'), + }, + NullValue: { + leave: () => 'null', + }, + EnumValue: { + leave: ({ value }) => value, + }, + ListValue: { + leave: ({ values }) => '[' + join(values, ', ') + ']', + }, + ObjectValue: { + leave: ({ fields }) => '{' + join(fields, ', ') + '}', + }, + ObjectField: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Directive + Directive: { + leave: ({ name, arguments: args }) => + '@' + name + wrap('(', join(args, ', '), ')'), + }, + // Type + NamedType: { + leave: ({ name }) => name, + }, + ListType: { + leave: ({ type }) => '[' + type + ']', + }, + NonNullType: { + leave: ({ type }) => type + '!', + }, + // Type System Definitions + SchemaDefinition: { + leave: ({ description, directives, operationTypes }) => + wrap('', description, '\n') + + join(['schema', join(directives, ' '), block(operationTypes)], ' '), + }, + OperationTypeDefinition: { + leave: ({ operation, type }) => operation + ': ' + type, + }, + ScalarTypeDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + + join(['scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + FieldDefinition: { + leave: ({ description, name, arguments: args, type, directives }) => + wrap('', description, '\n') + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + ': ' + + type + + wrap(' ', join(directives, ' ')), + }, + InputValueDefinition: { + leave: ({ description, name, type, defaultValue, directives }) => + wrap('', description, '\n') + + join( + [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], + ' ', + ), + }, + InterfaceTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeDefinition: { + leave: ({ description, name, directives, types }) => + wrap('', description, '\n') + + join( + ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], + ' ', + ), + }, + EnumTypeDefinition: { + leave: ({ description, name, directives, values }) => + wrap('', description, '\n') + + join(['enum', name, join(directives, ' '), block(values)], ' '), + }, + EnumValueDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + join([name, join(directives, ' ')], ' '), + }, + InputObjectTypeDefinition: { + leave: ({ description, name, directives, fields }) => + wrap('', description, '\n') + + join(['input', name, join(directives, ' '), block(fields)], ' '), + }, + DirectiveDefinition: { + leave: ({ description, name, arguments: args, repeatable, locations }) => + wrap('', description, '\n') + + 'directive @' + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + (repeatable ? ' repeatable' : '') + + ' on ' + + join(locations, ' | '), + }, + SchemaExtension: { + leave: ({ directives, operationTypes }) => + join( + ['extend schema', join(directives, ' '), block(operationTypes)], + ' ', + ), + }, + ScalarTypeExtension: { + leave: ({ name, directives }) => + join(['extend scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + InterfaceTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeExtension: { + leave: ({ name, directives, types }) => + join( + [ + 'extend union', + name, + join(directives, ' '), + wrap('= ', join(types, ' | ')), + ], + ' ', + ), + }, + EnumTypeExtension: { + leave: ({ name, directives, values }) => + join(['extend enum', name, join(directives, ' '), block(values)], ' '), + }, + InputObjectTypeExtension: { + leave: ({ name, directives, fields }) => + join(['extend input', name, join(directives, ' '), block(fields)], ' '), + }, +}; +/** + * Given maybeArray, print an empty string if it is null or empty, otherwise + * print all items together separated by separator if provided + */ + +function join(maybeArray, separator = '') { + var _maybeArray$filter$jo; + + return (_maybeArray$filter$jo = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.filter((x) => x).join(separator)) !== null && + _maybeArray$filter$jo !== void 0 + ? _maybeArray$filter$jo + : ''; +} +/** + * Given array, print each item on its own line, wrapped in an indented `{ }` block. + */ + +function block(array) { + return wrap('{\n', indent(join(array, '\n')), '\n}'); +} +/** + * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. + */ + +function wrap(start, maybeString, end = '') { + return maybeString != null && maybeString !== '' + ? start + maybeString + end + : ''; +} + +function indent(str) { + return wrap(' ', str.replace(/\n/g, '\n ')); +} + +function hasMultilineItems(maybeArray) { + var _maybeArray$some; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + return (_maybeArray$some = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.some((str) => str.includes('\n'))) !== null && + _maybeArray$some !== void 0 + ? _maybeArray$some + : false; +} diff --git a/graphql-subscription/node_modules/graphql/language/printer.mjs b/graphql-subscription/node_modules/graphql/language/printer.mjs new file mode 100644 index 0000000..cffc2bf --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/printer.mjs @@ -0,0 +1,339 @@ +import { printBlockString } from './blockString.mjs'; +import { printString } from './printString.mjs'; +import { visit } from './visitor.mjs'; +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ + +export function print(ast) { + return visit(ast, printDocASTReducer); +} +const MAX_LINE_LENGTH = 80; +const printDocASTReducer = { + Name: { + leave: (node) => node.value, + }, + Variable: { + leave: (node) => '$' + node.name, + }, + // Document + Document: { + leave: (node) => join(node.definitions, '\n\n'), + }, + OperationDefinition: { + leave(node) { + const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); + const prefix = join( + [ + node.operation, + join([node.name, varDefs]), + join(node.directives, ' '), + ], + ' ', + ); // Anonymous queries with no directives or variable definitions can use + // the query short form. + + return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet; + }, + }, + VariableDefinition: { + leave: ({ variable, type, defaultValue, directives }) => + variable + + ': ' + + type + + wrap(' = ', defaultValue) + + wrap(' ', join(directives, ' ')), + }, + SelectionSet: { + leave: ({ selections }) => block(selections), + }, + Field: { + leave({ alias, name, arguments: args, directives, selectionSet }) { + const prefix = wrap('', alias, ': ') + name; + let argsLine = prefix + wrap('(', join(args, ', '), ')'); + + if (argsLine.length > MAX_LINE_LENGTH) { + argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); + } + + return join([argsLine, join(directives, ' '), selectionSet], ' '); + }, + }, + Argument: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Fragments + FragmentSpread: { + leave: ({ name, directives }) => + '...' + name + wrap(' ', join(directives, ' ')), + }, + InlineFragment: { + leave: ({ typeCondition, directives, selectionSet }) => + join( + [ + '...', + wrap('on ', typeCondition), + join(directives, ' '), + selectionSet, + ], + ' ', + ), + }, + FragmentDefinition: { + leave: ( + { name, typeCondition, variableDefinitions, directives, selectionSet }, // Note: fragment variable definitions are experimental and may be changed + ) => + // or removed in the future. + `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` + + `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` + + selectionSet, + }, + // Value + IntValue: { + leave: ({ value }) => value, + }, + FloatValue: { + leave: ({ value }) => value, + }, + StringValue: { + leave: ({ value, block: isBlockString }) => + isBlockString ? printBlockString(value) : printString(value), + }, + BooleanValue: { + leave: ({ value }) => (value ? 'true' : 'false'), + }, + NullValue: { + leave: () => 'null', + }, + EnumValue: { + leave: ({ value }) => value, + }, + ListValue: { + leave: ({ values }) => '[' + join(values, ', ') + ']', + }, + ObjectValue: { + leave: ({ fields }) => '{' + join(fields, ', ') + '}', + }, + ObjectField: { + leave: ({ name, value }) => name + ': ' + value, + }, + // Directive + Directive: { + leave: ({ name, arguments: args }) => + '@' + name + wrap('(', join(args, ', '), ')'), + }, + // Type + NamedType: { + leave: ({ name }) => name, + }, + ListType: { + leave: ({ type }) => '[' + type + ']', + }, + NonNullType: { + leave: ({ type }) => type + '!', + }, + // Type System Definitions + SchemaDefinition: { + leave: ({ description, directives, operationTypes }) => + wrap('', description, '\n') + + join(['schema', join(directives, ' '), block(operationTypes)], ' '), + }, + OperationTypeDefinition: { + leave: ({ operation, type }) => operation + ': ' + type, + }, + ScalarTypeDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + + join(['scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + FieldDefinition: { + leave: ({ description, name, arguments: args, type, directives }) => + wrap('', description, '\n') + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + ': ' + + type + + wrap(' ', join(directives, ' ')), + }, + InputValueDefinition: { + leave: ({ description, name, type, defaultValue, directives }) => + wrap('', description, '\n') + + join( + [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], + ' ', + ), + }, + InterfaceTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeDefinition: { + leave: ({ description, name, directives, types }) => + wrap('', description, '\n') + + join( + ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], + ' ', + ), + }, + EnumTypeDefinition: { + leave: ({ description, name, directives, values }) => + wrap('', description, '\n') + + join(['enum', name, join(directives, ' '), block(values)], ' '), + }, + EnumValueDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + join([name, join(directives, ' ')], ' '), + }, + InputObjectTypeDefinition: { + leave: ({ description, name, directives, fields }) => + wrap('', description, '\n') + + join(['input', name, join(directives, ' '), block(fields)], ' '), + }, + DirectiveDefinition: { + leave: ({ description, name, arguments: args, repeatable, locations }) => + wrap('', description, '\n') + + 'directive @' + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + (repeatable ? ' repeatable' : '') + + ' on ' + + join(locations, ' | '), + }, + SchemaExtension: { + leave: ({ directives, operationTypes }) => + join( + ['extend schema', join(directives, ' '), block(operationTypes)], + ' ', + ), + }, + ScalarTypeExtension: { + leave: ({ name, directives }) => + join(['extend scalar', name, join(directives, ' ')], ' '), + }, + ObjectTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + InterfaceTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + UnionTypeExtension: { + leave: ({ name, directives, types }) => + join( + [ + 'extend union', + name, + join(directives, ' '), + wrap('= ', join(types, ' | ')), + ], + ' ', + ), + }, + EnumTypeExtension: { + leave: ({ name, directives, values }) => + join(['extend enum', name, join(directives, ' '), block(values)], ' '), + }, + InputObjectTypeExtension: { + leave: ({ name, directives, fields }) => + join(['extend input', name, join(directives, ' '), block(fields)], ' '), + }, +}; +/** + * Given maybeArray, print an empty string if it is null or empty, otherwise + * print all items together separated by separator if provided + */ + +function join(maybeArray, separator = '') { + var _maybeArray$filter$jo; + + return (_maybeArray$filter$jo = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.filter((x) => x).join(separator)) !== null && + _maybeArray$filter$jo !== void 0 + ? _maybeArray$filter$jo + : ''; +} +/** + * Given array, print each item on its own line, wrapped in an indented `{ }` block. + */ + +function block(array) { + return wrap('{\n', indent(join(array, '\n')), '\n}'); +} +/** + * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. + */ + +function wrap(start, maybeString, end = '') { + return maybeString != null && maybeString !== '' + ? start + maybeString + end + : ''; +} + +function indent(str) { + return wrap(' ', str.replace(/\n/g, '\n ')); +} + +function hasMultilineItems(maybeArray) { + var _maybeArray$some; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + return (_maybeArray$some = + maybeArray === null || maybeArray === void 0 + ? void 0 + : maybeArray.some((str) => str.includes('\n'))) !== null && + _maybeArray$some !== void 0 + ? _maybeArray$some + : false; +} diff --git a/graphql-subscription/node_modules/graphql/language/source.d.ts b/graphql-subscription/node_modules/graphql/language/source.d.ts new file mode 100644 index 0000000..8093914 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/source.d.ts @@ -0,0 +1,25 @@ +interface Location { + line: number; + column: number; +} +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +export declare class Source { + body: string; + name: string; + locationOffset: Location; + constructor(body: string, name?: string, locationOffset?: Location); + get [Symbol.toStringTag](): string; +} +/** + * Test if the given value is a Source object. + * + * @internal + */ +export declare function isSource(source: unknown): source is Source; +export {}; diff --git a/graphql-subscription/node_modules/graphql/language/source.js b/graphql-subscription/node_modules/graphql/language/source.js new file mode 100644 index 0000000..4ddef8d --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/source.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.Source = void 0; +exports.isSource = isSource; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +class Source { + constructor( + body, + name = 'GraphQL request', + locationOffset = { + line: 1, + column: 1, + }, + ) { + typeof body === 'string' || + (0, _devAssert.devAssert)( + false, + `Body must be a string. Received: ${(0, _inspect.inspect)(body)}.`, + ); + this.body = body; + this.name = name; + this.locationOffset = locationOffset; + this.locationOffset.line > 0 || + (0, _devAssert.devAssert)( + false, + 'line in locationOffset is 1-indexed and must be positive.', + ); + this.locationOffset.column > 0 || + (0, _devAssert.devAssert)( + false, + 'column in locationOffset is 1-indexed and must be positive.', + ); + } + + get [Symbol.toStringTag]() { + return 'Source'; + } +} +/** + * Test if the given value is a Source object. + * + * @internal + */ + +exports.Source = Source; + +function isSource(source) { + return (0, _instanceOf.instanceOf)(source, Source); +} diff --git a/graphql-subscription/node_modules/graphql/language/source.mjs b/graphql-subscription/node_modules/graphql/language/source.mjs new file mode 100644 index 0000000..c15f85e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/source.mjs @@ -0,0 +1,50 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; + +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +export class Source { + constructor( + body, + name = 'GraphQL request', + locationOffset = { + line: 1, + column: 1, + }, + ) { + typeof body === 'string' || + devAssert(false, `Body must be a string. Received: ${inspect(body)}.`); + this.body = body; + this.name = name; + this.locationOffset = locationOffset; + this.locationOffset.line > 0 || + devAssert( + false, + 'line in locationOffset is 1-indexed and must be positive.', + ); + this.locationOffset.column > 0 || + devAssert( + false, + 'column in locationOffset is 1-indexed and must be positive.', + ); + } + + get [Symbol.toStringTag]() { + return 'Source'; + } +} +/** + * Test if the given value is a Source object. + * + * @internal + */ + +export function isSource(source) { + return instanceOf(source, Source); +} diff --git a/graphql-subscription/node_modules/graphql/language/tokenKind.d.ts b/graphql-subscription/node_modules/graphql/language/tokenKind.d.ts new file mode 100644 index 0000000..6ba30d3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/tokenKind.d.ts @@ -0,0 +1,35 @@ +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +declare enum TokenKind { + SOF = '', + EOF = '', + BANG = '!', + DOLLAR = '$', + AMP = '&', + PAREN_L = '(', + PAREN_R = ')', + SPREAD = '...', + COLON = ':', + EQUALS = '=', + AT = '@', + BRACKET_L = '[', + BRACKET_R = ']', + BRACE_L = '{', + PIPE = '|', + BRACE_R = '}', + NAME = 'Name', + INT = 'Int', + FLOAT = 'Float', + STRING = 'String', + BLOCK_STRING = 'BlockString', + COMMENT = 'Comment', +} +export { TokenKind }; +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ +export declare type TokenKindEnum = typeof TokenKind; diff --git a/graphql-subscription/node_modules/graphql/language/tokenKind.js b/graphql-subscription/node_modules/graphql/language/tokenKind.js new file mode 100644 index 0000000..67482b4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/tokenKind.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.TokenKind = void 0; + +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +var TokenKind; +exports.TokenKind = TokenKind; + +(function (TokenKind) { + TokenKind['SOF'] = ''; + TokenKind['EOF'] = ''; + TokenKind['BANG'] = '!'; + TokenKind['DOLLAR'] = '$'; + TokenKind['AMP'] = '&'; + TokenKind['PAREN_L'] = '('; + TokenKind['PAREN_R'] = ')'; + TokenKind['SPREAD'] = '...'; + TokenKind['COLON'] = ':'; + TokenKind['EQUALS'] = '='; + TokenKind['AT'] = '@'; + TokenKind['BRACKET_L'] = '['; + TokenKind['BRACKET_R'] = ']'; + TokenKind['BRACE_L'] = '{'; + TokenKind['PIPE'] = '|'; + TokenKind['BRACE_R'] = '}'; + TokenKind['NAME'] = 'Name'; + TokenKind['INT'] = 'Int'; + TokenKind['FLOAT'] = 'Float'; + TokenKind['STRING'] = 'String'; + TokenKind['BLOCK_STRING'] = 'BlockString'; + TokenKind['COMMENT'] = 'Comment'; +})(TokenKind || (exports.TokenKind = TokenKind = {})); +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ diff --git a/graphql-subscription/node_modules/graphql/language/tokenKind.mjs b/graphql-subscription/node_modules/graphql/language/tokenKind.mjs new file mode 100644 index 0000000..a9024ec --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/tokenKind.mjs @@ -0,0 +1,37 @@ +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +var TokenKind; + +(function (TokenKind) { + TokenKind['SOF'] = ''; + TokenKind['EOF'] = ''; + TokenKind['BANG'] = '!'; + TokenKind['DOLLAR'] = '$'; + TokenKind['AMP'] = '&'; + TokenKind['PAREN_L'] = '('; + TokenKind['PAREN_R'] = ')'; + TokenKind['SPREAD'] = '...'; + TokenKind['COLON'] = ':'; + TokenKind['EQUALS'] = '='; + TokenKind['AT'] = '@'; + TokenKind['BRACKET_L'] = '['; + TokenKind['BRACKET_R'] = ']'; + TokenKind['BRACE_L'] = '{'; + TokenKind['PIPE'] = '|'; + TokenKind['BRACE_R'] = '}'; + TokenKind['NAME'] = 'Name'; + TokenKind['INT'] = 'Int'; + TokenKind['FLOAT'] = 'Float'; + TokenKind['STRING'] = 'String'; + TokenKind['BLOCK_STRING'] = 'BlockString'; + TokenKind['COMMENT'] = 'Comment'; +})(TokenKind || (TokenKind = {})); + +export { TokenKind }; +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ diff --git a/graphql-subscription/node_modules/graphql/language/visitor.d.ts b/graphql-subscription/node_modules/graphql/language/visitor.d.ts new file mode 100644 index 0000000..1c11366 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/visitor.d.ts @@ -0,0 +1,194 @@ +import type { ASTNode } from './ast'; +import { Kind } from './kinds'; +/** + * A visitor is provided to visit, it contains the collection of + * relevant functions to be called during the visitor's traversal. + */ +export declare type ASTVisitor = EnterLeaveVisitor | KindVisitor; +declare type KindVisitor = { + readonly [NodeT in ASTNode as NodeT['kind']]?: + | ASTVisitFn + | EnterLeaveVisitor; +}; +interface EnterLeaveVisitor { + readonly enter?: ASTVisitFn; + readonly leave?: ASTVisitFn; +} +/** + * A visitor is comprised of visit functions, which are called on each node + * during the visitor's traversal. + */ +export declare type ASTVisitFn = ( + /** The current node being visiting. */ + node: TVisitedNode, + /** The index or key to this node from the parent node or Array. */ + key: string | number | undefined, + /** The parent immediately above this node, which may be an Array. */ + parent: ASTNode | ReadonlyArray | undefined, + /** The key path to get to this node from the root node. */ + path: ReadonlyArray, + /** + * All nodes and Arrays visited before reaching parent of this node. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays which contain the parent of visited node. + */ + ancestors: ReadonlyArray>, +) => any; +/** + * A reducer is comprised of reducer functions which convert AST nodes into + * another form. + */ +export declare type ASTReducer = { + readonly [NodeT in ASTNode as NodeT['kind']]?: { + readonly enter?: ASTVisitFn; + readonly leave: ASTReducerFn; + }; +}; +declare type ASTReducerFn = ( + /** The current node being visiting. */ + node: { + [K in keyof TReducedNode]: ReducedField; + }, + /** The index or key to this node from the parent node or Array. */ + key: string | number | undefined, + /** The parent immediately above this node, which may be an Array. */ + parent: ASTNode | ReadonlyArray | undefined, + /** The key path to get to this node from the root node. */ + path: ReadonlyArray, + /** + * All nodes and Arrays visited before reaching parent of this node. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays which contain the parent of visited node. + */ + ancestors: ReadonlyArray>, +) => R; +declare type ReducedField = T extends null | undefined + ? T + : T extends ReadonlyArray + ? ReadonlyArray + : R; +/** + * A KeyMap describes each the traversable properties of each kind of node. + * + * @deprecated Please inline it. Will be removed in v17 + */ +export declare type ASTVisitorKeyMap = { + [NodeT in ASTNode as NodeT['kind']]?: ReadonlyArray; +}; +export declare const BREAK: unknown; +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ +export declare function visit( + root: N, + visitor: ASTVisitor, + visitorKeys?: ASTVisitorKeyMap, +): N; +export declare function visit( + root: ASTNode, + visitor: ASTReducer, + visitorKeys?: ASTVisitorKeyMap, +): R; +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ +export declare function visitInParallel( + visitors: ReadonlyArray, +): ASTVisitor; +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + */ +export declare function getEnterLeaveForKind( + visitor: ASTVisitor, + kind: Kind, +): EnterLeaveVisitor; +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ +export declare function getVisitFn( + visitor: ASTVisitor, + kind: Kind, + isLeaving: boolean, +): ASTVisitFn | undefined; +export {}; diff --git a/graphql-subscription/node_modules/graphql/language/visitor.js b/graphql-subscription/node_modules/graphql/language/visitor.js new file mode 100644 index 0000000..a9ee5c4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/visitor.js @@ -0,0 +1,377 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.BREAK = void 0; +exports.getEnterLeaveForKind = getEnterLeaveForKind; +exports.getVisitFn = getVisitFn; +exports.visit = visit; +exports.visitInParallel = visitInParallel; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _ast = require('./ast.js'); + +var _kinds = require('./kinds.js'); + +const BREAK = Object.freeze({}); +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ + +exports.BREAK = BREAK; + +function visit(root, visitor, visitorKeys = _ast.QueryDocumentKeys) { + const enterLeaveMap = new Map(); + + for (const kind of Object.values(_kinds.Kind)) { + enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind)); + } + /* eslint-disable no-undef-init */ + + let stack = undefined; + let inArray = Array.isArray(root); + let keys = [root]; + let index = -1; + let edits = []; + let node = root; + let key = undefined; + let parent = undefined; + const path = []; + const ancestors = []; + /* eslint-enable no-undef-init */ + + do { + index++; + const isLeaving = index === keys.length; + const isEdited = isLeaving && edits.length !== 0; + + if (isLeaving) { + key = ancestors.length === 0 ? undefined : path[path.length - 1]; + node = parent; + parent = ancestors.pop(); + + if (isEdited) { + if (inArray) { + node = node.slice(); + let editOffset = 0; + + for (const [editKey, editValue] of edits) { + const arrayKey = editKey - editOffset; + + if (editValue === null) { + node.splice(arrayKey, 1); + editOffset++; + } else { + node[arrayKey] = editValue; + } + } + } else { + node = Object.defineProperties( + {}, + Object.getOwnPropertyDescriptors(node), + ); + + for (const [editKey, editValue] of edits) { + node[editKey] = editValue; + } + } + } + + index = stack.index; + keys = stack.keys; + edits = stack.edits; + inArray = stack.inArray; + stack = stack.prev; + } else if (parent) { + key = inArray ? index : keys[index]; + node = parent[key]; + + if (node === null || node === undefined) { + continue; + } + + path.push(key); + } + + let result; + + if (!Array.isArray(node)) { + var _enterLeaveMap$get, _enterLeaveMap$get2; + + (0, _ast.isNode)(node) || + (0, _devAssert.devAssert)( + false, + `Invalid AST Node: ${(0, _inspect.inspect)(node)}.`, + ); + const visitFn = isLeaving + ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get === void 0 + ? void 0 + : _enterLeaveMap$get.leave + : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get2 === void 0 + ? void 0 + : _enterLeaveMap$get2.enter; + result = + visitFn === null || visitFn === void 0 + ? void 0 + : visitFn.call(visitor, node, key, parent, path, ancestors); + + if (result === BREAK) { + break; + } + + if (result === false) { + if (!isLeaving) { + path.pop(); + continue; + } + } else if (result !== undefined) { + edits.push([key, result]); + + if (!isLeaving) { + if ((0, _ast.isNode)(result)) { + node = result; + } else { + path.pop(); + continue; + } + } + } + } + + if (result === undefined && isEdited) { + edits.push([key, node]); + } + + if (isLeaving) { + path.pop(); + } else { + var _node$kind; + + stack = { + inArray, + index, + keys, + edits, + prev: stack, + }; + inArray = Array.isArray(node); + keys = inArray + ? node + : (_node$kind = visitorKeys[node.kind]) !== null && + _node$kind !== void 0 + ? _node$kind + : []; + index = -1; + edits = []; + + if (parent) { + ancestors.push(parent); + } + + parent = node; + } + } while (stack !== undefined); + + if (edits.length !== 0) { + // New root + return edits[edits.length - 1][1]; + } + + return root; +} +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ + +function visitInParallel(visitors) { + const skipping = new Array(visitors.length).fill(null); + const mergedVisitor = Object.create(null); + + for (const kind of Object.values(_kinds.Kind)) { + let hasVisitor = false; + const enterList = new Array(visitors.length).fill(undefined); + const leaveList = new Array(visitors.length).fill(undefined); + + for (let i = 0; i < visitors.length; ++i) { + const { enter, leave } = getEnterLeaveForKind(visitors[i], kind); + hasVisitor || (hasVisitor = enter != null || leave != null); + enterList[i] = enter; + leaveList[i] = leave; + } + + if (!hasVisitor) { + continue; + } + + const mergedEnterLeave = { + enter(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _enterList$i; + + const result = + (_enterList$i = enterList[i]) === null || _enterList$i === void 0 + ? void 0 + : _enterList$i.apply(visitors[i], args); + + if (result === false) { + skipping[i] = node; + } else if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined) { + return result; + } + } + } + }, + + leave(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _leaveList$i; + + const result = + (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0 + ? void 0 + : _leaveList$i.apply(visitors[i], args); + + if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined && result !== false) { + return result; + } + } else if (skipping[i] === node) { + skipping[i] = null; + } + } + }, + }; + mergedVisitor[kind] = mergedEnterLeave; + } + + return mergedVisitor; +} +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + */ + +function getEnterLeaveForKind(visitor, kind) { + const kindVisitor = visitor[kind]; + + if (typeof kindVisitor === 'object') { + // { Kind: { enter() {}, leave() {} } } + return kindVisitor; + } else if (typeof kindVisitor === 'function') { + // { Kind() {} } + return { + enter: kindVisitor, + leave: undefined, + }; + } // { enter() {}, leave() {} } + + return { + enter: visitor.enter, + leave: visitor.leave, + }; +} +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ + +/* c8 ignore next 8 */ + +function getVisitFn(visitor, kind, isLeaving) { + const { enter, leave } = getEnterLeaveForKind(visitor, kind); + return isLeaving ? leave : enter; +} diff --git a/graphql-subscription/node_modules/graphql/language/visitor.mjs b/graphql-subscription/node_modules/graphql/language/visitor.mjs new file mode 100644 index 0000000..e3173a3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/language/visitor.mjs @@ -0,0 +1,361 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { isNode, QueryDocumentKeys } from './ast.mjs'; +import { Kind } from './kinds.mjs'; +/** + * A visitor is provided to visit, it contains the collection of + * relevant functions to be called during the visitor's traversal. + */ + +export const BREAK = Object.freeze({}); +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ + +export function visit(root, visitor, visitorKeys = QueryDocumentKeys) { + const enterLeaveMap = new Map(); + + for (const kind of Object.values(Kind)) { + enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind)); + } + /* eslint-disable no-undef-init */ + + let stack = undefined; + let inArray = Array.isArray(root); + let keys = [root]; + let index = -1; + let edits = []; + let node = root; + let key = undefined; + let parent = undefined; + const path = []; + const ancestors = []; + /* eslint-enable no-undef-init */ + + do { + index++; + const isLeaving = index === keys.length; + const isEdited = isLeaving && edits.length !== 0; + + if (isLeaving) { + key = ancestors.length === 0 ? undefined : path[path.length - 1]; + node = parent; + parent = ancestors.pop(); + + if (isEdited) { + if (inArray) { + node = node.slice(); + let editOffset = 0; + + for (const [editKey, editValue] of edits) { + const arrayKey = editKey - editOffset; + + if (editValue === null) { + node.splice(arrayKey, 1); + editOffset++; + } else { + node[arrayKey] = editValue; + } + } + } else { + node = Object.defineProperties( + {}, + Object.getOwnPropertyDescriptors(node), + ); + + for (const [editKey, editValue] of edits) { + node[editKey] = editValue; + } + } + } + + index = stack.index; + keys = stack.keys; + edits = stack.edits; + inArray = stack.inArray; + stack = stack.prev; + } else if (parent) { + key = inArray ? index : keys[index]; + node = parent[key]; + + if (node === null || node === undefined) { + continue; + } + + path.push(key); + } + + let result; + + if (!Array.isArray(node)) { + var _enterLeaveMap$get, _enterLeaveMap$get2; + + isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`); + const visitFn = isLeaving + ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get === void 0 + ? void 0 + : _enterLeaveMap$get.leave + : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null || + _enterLeaveMap$get2 === void 0 + ? void 0 + : _enterLeaveMap$get2.enter; + result = + visitFn === null || visitFn === void 0 + ? void 0 + : visitFn.call(visitor, node, key, parent, path, ancestors); + + if (result === BREAK) { + break; + } + + if (result === false) { + if (!isLeaving) { + path.pop(); + continue; + } + } else if (result !== undefined) { + edits.push([key, result]); + + if (!isLeaving) { + if (isNode(result)) { + node = result; + } else { + path.pop(); + continue; + } + } + } + } + + if (result === undefined && isEdited) { + edits.push([key, node]); + } + + if (isLeaving) { + path.pop(); + } else { + var _node$kind; + + stack = { + inArray, + index, + keys, + edits, + prev: stack, + }; + inArray = Array.isArray(node); + keys = inArray + ? node + : (_node$kind = visitorKeys[node.kind]) !== null && + _node$kind !== void 0 + ? _node$kind + : []; + index = -1; + edits = []; + + if (parent) { + ancestors.push(parent); + } + + parent = node; + } + } while (stack !== undefined); + + if (edits.length !== 0) { + // New root + return edits[edits.length - 1][1]; + } + + return root; +} +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ + +export function visitInParallel(visitors) { + const skipping = new Array(visitors.length).fill(null); + const mergedVisitor = Object.create(null); + + for (const kind of Object.values(Kind)) { + let hasVisitor = false; + const enterList = new Array(visitors.length).fill(undefined); + const leaveList = new Array(visitors.length).fill(undefined); + + for (let i = 0; i < visitors.length; ++i) { + const { enter, leave } = getEnterLeaveForKind(visitors[i], kind); + hasVisitor || (hasVisitor = enter != null || leave != null); + enterList[i] = enter; + leaveList[i] = leave; + } + + if (!hasVisitor) { + continue; + } + + const mergedEnterLeave = { + enter(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _enterList$i; + + const result = + (_enterList$i = enterList[i]) === null || _enterList$i === void 0 + ? void 0 + : _enterList$i.apply(visitors[i], args); + + if (result === false) { + skipping[i] = node; + } else if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined) { + return result; + } + } + } + }, + + leave(...args) { + const node = args[0]; + + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + var _leaveList$i; + + const result = + (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0 + ? void 0 + : _leaveList$i.apply(visitors[i], args); + + if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined && result !== false) { + return result; + } + } else if (skipping[i] === node) { + skipping[i] = null; + } + } + }, + }; + mergedVisitor[kind] = mergedEnterLeave; + } + + return mergedVisitor; +} +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + */ + +export function getEnterLeaveForKind(visitor, kind) { + const kindVisitor = visitor[kind]; + + if (typeof kindVisitor === 'object') { + // { Kind: { enter() {}, leave() {} } } + return kindVisitor; + } else if (typeof kindVisitor === 'function') { + // { Kind() {} } + return { + enter: kindVisitor, + leave: undefined, + }; + } // { enter() {}, leave() {} } + + return { + enter: visitor.enter, + leave: visitor.leave, + }; +} +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ + +/* c8 ignore next 8 */ + +export function getVisitFn(visitor, kind, isLeaving) { + const { enter, leave } = getEnterLeaveForKind(visitor, kind); + return isLeaving ? leave : enter; +} diff --git a/graphql-subscription/node_modules/graphql/package.json b/graphql-subscription/node_modules/graphql/package.json new file mode 100644 index 0000000..6781819 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/package.json @@ -0,0 +1,39 @@ +{ + "name": "graphql", + "version": "16.8.1", + "description": "A Query Language and Runtime which can target any service.", + "license": "MIT", + "main": "index", + "module": "index.mjs", + "typesVersions": { + ">=4.1.0": { + "*": [ + "*" + ] + }, + "*": { + "*": [ + "NotSupportedTSVersion.d.ts" + ] + } + }, + "sideEffects": false, + "homepage": "https://github.com/graphql/graphql-js", + "bugs": { + "url": "https://github.com/graphql/graphql-js/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/graphql/graphql-js.git" + }, + "keywords": [ + "graphql", + "graphql-js" + ], + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + }, + "publishConfig": { + "tag": "latest" + } +} diff --git a/graphql-subscription/node_modules/graphql/subscription/index.d.ts b/graphql-subscription/node_modules/graphql/subscription/index.d.ts new file mode 100644 index 0000000..bf81134 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/subscription/index.d.ts @@ -0,0 +1,19 @@ +/** + * NOTE: the `graphql/subscription` module has been deprecated with its + * exported functions integrated into the `graphql/execution` module, to + * better conform with the terminology of the GraphQL specification. + * + * For backwards compatibility, the `graphql/subscription` module + * currently re-exports the moved functions from the `graphql/execution` + * module. In the next major release, the `graphql/subscription` module + * will be dropped entirely. + */ +import type { ExecutionArgs } from '../execution/execute'; +/** + * @deprecated use ExecutionArgs instead. Will be removed in v17 + * + * ExecutionArgs has been broadened to include all properties within SubscriptionArgs. + * The SubscriptionArgs type is retained for backwards compatibility. + */ +export interface SubscriptionArgs extends ExecutionArgs {} +export { subscribe, createSourceEventStream } from '../execution/subscribe'; diff --git a/graphql-subscription/node_modules/graphql/subscription/index.js b/graphql-subscription/node_modules/graphql/subscription/index.js new file mode 100644 index 0000000..7d39b2d --- /dev/null +++ b/graphql-subscription/node_modules/graphql/subscription/index.js @@ -0,0 +1,19 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'createSourceEventStream', { + enumerable: true, + get: function () { + return _subscribe.createSourceEventStream; + }, +}); +Object.defineProperty(exports, 'subscribe', { + enumerable: true, + get: function () { + return _subscribe.subscribe; + }, +}); + +var _subscribe = require('../execution/subscribe.js'); diff --git a/graphql-subscription/node_modules/graphql/subscription/index.mjs b/graphql-subscription/node_modules/graphql/subscription/index.mjs new file mode 100644 index 0000000..222cbcb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/subscription/index.mjs @@ -0,0 +1,19 @@ +/** + * NOTE: the `graphql/subscription` module has been deprecated with its + * exported functions integrated into the `graphql/execution` module, to + * better conform with the terminology of the GraphQL specification. + * + * For backwards compatibility, the `graphql/subscription` module + * currently re-exports the moved functions from the `graphql/execution` + * module. In the next major release, the `graphql/subscription` module + * will be dropped entirely. + */ + +/** + * @deprecated use ExecutionArgs instead. Will be removed in v17 + * + * ExecutionArgs has been broadened to include all properties within SubscriptionArgs. + * The SubscriptionArgs type is retained for backwards compatibility. + */ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export { subscribe, createSourceEventStream } from '../execution/subscribe.mjs'; diff --git a/graphql-subscription/node_modules/graphql/type/assertName.d.ts b/graphql-subscription/node_modules/graphql/type/assertName.d.ts new file mode 100644 index 0000000..1e21508 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/assertName.d.ts @@ -0,0 +1,10 @@ +/** + * Upholds the spec rules about naming. + */ +export declare function assertName(name: string): string; +/** + * Upholds the spec rules about naming enum values. + * + * @internal + */ +export declare function assertEnumValueName(name: string): string; diff --git a/graphql-subscription/node_modules/graphql/type/assertName.js b/graphql-subscription/node_modules/graphql/type/assertName.js new file mode 100644 index 0000000..1519d36 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/assertName.js @@ -0,0 +1,59 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertEnumValueName = assertEnumValueName; +exports.assertName = assertName; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _characterClasses = require('../language/characterClasses.js'); + +/** + * Upholds the spec rules about naming. + */ +function assertName(name) { + name != null || (0, _devAssert.devAssert)(false, 'Must provide name.'); + typeof name === 'string' || + (0, _devAssert.devAssert)(false, 'Expected name to be a string.'); + + if (name.length === 0) { + throw new _GraphQLError.GraphQLError( + 'Expected name to be a non-empty string.', + ); + } + + for (let i = 1; i < name.length; ++i) { + if (!(0, _characterClasses.isNameContinue)(name.charCodeAt(i))) { + throw new _GraphQLError.GraphQLError( + `Names must only contain [_a-zA-Z0-9] but "${name}" does not.`, + ); + } + } + + if (!(0, _characterClasses.isNameStart)(name.charCodeAt(0))) { + throw new _GraphQLError.GraphQLError( + `Names must start with [_a-zA-Z] but "${name}" does not.`, + ); + } + + return name; +} +/** + * Upholds the spec rules about naming enum values. + * + * @internal + */ + +function assertEnumValueName(name) { + if (name === 'true' || name === 'false' || name === 'null') { + throw new _GraphQLError.GraphQLError( + `Enum values cannot be named: ${name}`, + ); + } + + return assertName(name); +} diff --git a/graphql-subscription/node_modules/graphql/type/assertName.mjs b/graphql-subscription/node_modules/graphql/type/assertName.mjs new file mode 100644 index 0000000..960e302 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/assertName.mjs @@ -0,0 +1,44 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { isNameContinue, isNameStart } from '../language/characterClasses.mjs'; +/** + * Upholds the spec rules about naming. + */ + +export function assertName(name) { + name != null || devAssert(false, 'Must provide name.'); + typeof name === 'string' || devAssert(false, 'Expected name to be a string.'); + + if (name.length === 0) { + throw new GraphQLError('Expected name to be a non-empty string.'); + } + + for (let i = 1; i < name.length; ++i) { + if (!isNameContinue(name.charCodeAt(i))) { + throw new GraphQLError( + `Names must only contain [_a-zA-Z0-9] but "${name}" does not.`, + ); + } + } + + if (!isNameStart(name.charCodeAt(0))) { + throw new GraphQLError( + `Names must start with [_a-zA-Z] but "${name}" does not.`, + ); + } + + return name; +} +/** + * Upholds the spec rules about naming enum values. + * + * @internal + */ + +export function assertEnumValueName(name) { + if (name === 'true' || name === 'false' || name === 'null') { + throw new GraphQLError(`Enum values cannot be named: ${name}`); + } + + return assertName(name); +} diff --git a/graphql-subscription/node_modules/graphql/type/definition.d.ts b/graphql-subscription/node_modules/graphql/type/definition.d.ts new file mode 100644 index 0000000..904a449 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/definition.d.ts @@ -0,0 +1,923 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { Path } from '../jsutils/Path'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +import type { + EnumTypeDefinitionNode, + EnumTypeExtensionNode, + EnumValueDefinitionNode, + FieldDefinitionNode, + FieldNode, + FragmentDefinitionNode, + InputObjectTypeDefinitionNode, + InputObjectTypeExtensionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + OperationDefinitionNode, + ScalarTypeDefinitionNode, + ScalarTypeExtensionNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, + ValueNode, +} from '../language/ast'; +import type { GraphQLSchema } from './schema'; +/** + * These are all of the possible kinds of types. + */ +export declare type GraphQLType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + >; +export declare function isType(type: unknown): type is GraphQLType; +export declare function assertType(type: unknown): GraphQLType; +/** + * There are predicates for each kind of GraphQL type. + */ +export declare function isScalarType(type: unknown): type is GraphQLScalarType; +export declare function assertScalarType(type: unknown): GraphQLScalarType; +export declare function isObjectType(type: unknown): type is GraphQLObjectType; +export declare function assertObjectType(type: unknown): GraphQLObjectType; +export declare function isInterfaceType( + type: unknown, +): type is GraphQLInterfaceType; +export declare function assertInterfaceType( + type: unknown, +): GraphQLInterfaceType; +export declare function isUnionType(type: unknown): type is GraphQLUnionType; +export declare function assertUnionType(type: unknown): GraphQLUnionType; +export declare function isEnumType(type: unknown): type is GraphQLEnumType; +export declare function assertEnumType(type: unknown): GraphQLEnumType; +export declare function isInputObjectType( + type: unknown, +): type is GraphQLInputObjectType; +export declare function assertInputObjectType( + type: unknown, +): GraphQLInputObjectType; +export declare function isListType( + type: GraphQLInputType, +): type is GraphQLList; +export declare function isListType( + type: GraphQLOutputType, +): type is GraphQLList; +export declare function isListType( + type: unknown, +): type is GraphQLList; +export declare function assertListType(type: unknown): GraphQLList; +export declare function isNonNullType( + type: GraphQLInputType, +): type is GraphQLNonNull; +export declare function isNonNullType( + type: GraphQLOutputType, +): type is GraphQLNonNull; +export declare function isNonNullType( + type: unknown, +): type is GraphQLNonNull; +export declare function assertNonNullType( + type: unknown, +): GraphQLNonNull; +/** + * These types may be used as input types for arguments and directives. + */ +export declare type GraphQLInputType = + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + >; +export declare function isInputType(type: unknown): type is GraphQLInputType; +export declare function assertInputType(type: unknown): GraphQLInputType; +/** + * These types may be used as output types as the result of fields. + */ +export declare type GraphQLOutputType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + >; +export declare function isOutputType(type: unknown): type is GraphQLOutputType; +export declare function assertOutputType(type: unknown): GraphQLOutputType; +/** + * These types may describe types which may be leaf values. + */ +export declare type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; +export declare function isLeafType(type: unknown): type is GraphQLLeafType; +export declare function assertLeafType(type: unknown): GraphQLLeafType; +/** + * These types may describe the parent context of a selection set. + */ +export declare type GraphQLCompositeType = + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType; +export declare function isCompositeType( + type: unknown, +): type is GraphQLCompositeType; +export declare function assertCompositeType( + type: unknown, +): GraphQLCompositeType; +/** + * These types may describe the parent context of a selection set. + */ +export declare type GraphQLAbstractType = + | GraphQLInterfaceType + | GraphQLUnionType; +export declare function isAbstractType( + type: unknown, +): type is GraphQLAbstractType; +export declare function assertAbstractType(type: unknown): GraphQLAbstractType; +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * ``` + */ +export declare class GraphQLList { + readonly ofType: T; + constructor(ofType: T); + get [Symbol.toStringTag](): string; + toString(): string; + toJSON(): string; +} +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * ``` + * Note: the enforcement of non-nullability occurs within the executor. + */ +export declare class GraphQLNonNull { + readonly ofType: T; + constructor(ofType: T); + get [Symbol.toStringTag](): string; + toString(): string; + toJSON(): string; +} +/** + * These types wrap and modify other types + */ +export declare type GraphQLWrappingType = + | GraphQLList + | GraphQLNonNull; +export declare function isWrappingType( + type: unknown, +): type is GraphQLWrappingType; +export declare function assertWrappingType(type: unknown): GraphQLWrappingType; +/** + * These types can all accept null as a value. + */ +export declare type GraphQLNullableType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList; +export declare function isNullableType( + type: unknown, +): type is GraphQLNullableType; +export declare function assertNullableType(type: unknown): GraphQLNullableType; +export declare function getNullableType(type: undefined | null): void; +export declare function getNullableType( + type: T | GraphQLNonNull, +): T; +export declare function getNullableType( + type: Maybe, +): GraphQLNullableType | undefined; +/** + * These named types do not include modifiers like List or NonNull. + */ +export declare type GraphQLNamedType = + | GraphQLNamedInputType + | GraphQLNamedOutputType; +export declare type GraphQLNamedInputType = + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType; +export declare type GraphQLNamedOutputType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType; +export declare function isNamedType(type: unknown): type is GraphQLNamedType; +export declare function assertNamedType(type: unknown): GraphQLNamedType; +export declare function getNamedType(type: undefined | null): void; +export declare function getNamedType( + type: GraphQLInputType, +): GraphQLNamedInputType; +export declare function getNamedType( + type: GraphQLOutputType, +): GraphQLNamedOutputType; +export declare function getNamedType(type: GraphQLType): GraphQLNamedType; +export declare function getNamedType( + type: Maybe, +): GraphQLNamedType | undefined; +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ +export declare type ThunkReadonlyArray = + | (() => ReadonlyArray) + | ReadonlyArray; +export declare type ThunkObjMap = (() => ObjMap) | ObjMap; +export declare function resolveReadonlyArrayThunk( + thunk: ThunkReadonlyArray, +): ReadonlyArray; +export declare function resolveObjMapThunk(thunk: ThunkObjMap): ObjMap; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLScalarTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function returns `null` or does not return a value + * (i.e. it returns `undefined`) then an error will be raised and a `null` + * value will be returned in the response. It is always better to validate + * + * Example: + * + * ```ts + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (!Number.isFinite(value)) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`, + * ); + * } + * + * if (value % 2 === 0) { + * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`); + * } + * return value; + * } + * }); + * ``` + */ +export declare class GraphQLScalarType< + TInternal = unknown, + TExternal = TInternal, +> { + name: string; + description: Maybe; + specifiedByURL: Maybe; + serialize: GraphQLScalarSerializer; + parseValue: GraphQLScalarValueParser; + parseLiteral: GraphQLScalarLiteralParser; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + toConfig(): GraphQLScalarTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export declare type GraphQLScalarSerializer = ( + outputValue: unknown, +) => TExternal; +export declare type GraphQLScalarValueParser = ( + inputValue: unknown, +) => TInternal; +export declare type GraphQLScalarLiteralParser = ( + valueNode: ValueNode, + variables?: Maybe>, +) => TInternal; +export interface GraphQLScalarTypeConfig { + name: string; + description?: Maybe; + specifiedByURL?: Maybe; + /** Serializes an internal value to include in a response. */ + serialize?: GraphQLScalarSerializer; + /** Parses an externally provided value to use as an input. */ + parseValue?: GraphQLScalarValueParser; + /** Parses an externally provided literal value to use as an input. */ + parseLiteral?: GraphQLScalarLiteralParser; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLScalarTypeNormalizedConfig + extends GraphQLScalarTypeConfig { + serialize: GraphQLScalarSerializer; + parseValue: GraphQLScalarValueParser; + parseLiteral: GraphQLScalarLiteralParser; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * + * We've provided these template arguments because this is an open type and + * you may find them useful. + */ +export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { + [attributeName: string]: unknown; +} +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * ``` + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * ``` + */ +export declare class GraphQLObjectType { + name: string; + description: Maybe; + isTypeOf: Maybe>; + extensions: Readonly>; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _fields; + private _interfaces; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + getFields(): GraphQLFieldMap; + getInterfaces(): ReadonlyArray; + toConfig(): GraphQLObjectTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export declare function defineArguments( + config: GraphQLFieldConfigArgumentMap, +): ReadonlyArray; +/** + * @internal + */ +export declare function argsToArgsConfig( + args: ReadonlyArray, +): GraphQLFieldConfigArgumentMap; +export interface GraphQLObjectTypeConfig { + name: string; + description?: Maybe; + interfaces?: ThunkReadonlyArray; + fields: ThunkObjMap>; + isTypeOf?: Maybe>; + extensions?: Maybe>>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLObjectTypeNormalizedConfig + extends GraphQLObjectTypeConfig { + interfaces: ReadonlyArray; + fields: GraphQLFieldConfigMap; + extensions: Readonly>; + extensionASTNodes: ReadonlyArray; +} +export declare type GraphQLTypeResolver = ( + value: TSource, + context: TContext, + info: GraphQLResolveInfo, + abstractType: GraphQLAbstractType, +) => PromiseOrValue; +export declare type GraphQLIsTypeOfFn = ( + source: TSource, + context: TContext, + info: GraphQLResolveInfo, +) => PromiseOrValue; +export declare type GraphQLFieldResolver< + TSource, + TContext, + TArgs = any, + TResult = unknown, +> = ( + source: TSource, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => TResult; +export interface GraphQLResolveInfo { + readonly fieldName: string; + readonly fieldNodes: ReadonlyArray; + readonly returnType: GraphQLOutputType; + readonly parentType: GraphQLObjectType; + readonly path: Path; + readonly schema: GraphQLSchema; + readonly fragments: ObjMap; + readonly rootValue: unknown; + readonly operation: OperationDefinitionNode; + readonly variableValues: { + [variable: string]: unknown; + }; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * + * We've provided these template arguments because this is an open type and + * you may find them useful. + */ +export interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs = any> { + [attributeName: string]: unknown; +} +export interface GraphQLFieldConfig { + description?: Maybe; + type: GraphQLOutputType; + args?: GraphQLFieldConfigArgumentMap; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason?: Maybe; + extensions?: Maybe< + Readonly> + >; + astNode?: Maybe; +} +export declare type GraphQLFieldConfigArgumentMap = + ObjMap; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLArgumentExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLArgumentConfig { + description?: Maybe; + type: GraphQLInputType; + defaultValue?: unknown; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +export declare type GraphQLFieldConfigMap = ObjMap< + GraphQLFieldConfig +>; +export interface GraphQLField { + name: string; + description: Maybe; + type: GraphQLOutputType; + args: ReadonlyArray; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason: Maybe; + extensions: Readonly>; + astNode: Maybe; +} +export interface GraphQLArgument { + name: string; + description: Maybe; + type: GraphQLInputType; + defaultValue: unknown; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} +export declare function isRequiredArgument(arg: GraphQLArgument): boolean; +export declare type GraphQLFieldMap = ObjMap< + GraphQLField +>; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInterfaceTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * ``` + */ +export declare class GraphQLInterfaceType { + name: string; + description: Maybe; + resolveType: Maybe>; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _fields; + private _interfaces; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + getFields(): GraphQLFieldMap; + getInterfaces(): ReadonlyArray; + toConfig(): GraphQLInterfaceTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLInterfaceTypeConfig { + name: string; + description?: Maybe; + interfaces?: ThunkReadonlyArray; + fields: ThunkObjMap>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +export interface GraphQLInterfaceTypeNormalizedConfig + extends GraphQLInterfaceTypeConfig { + interfaces: ReadonlyArray; + fields: GraphQLFieldConfigMap; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLUnionTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * ``` + */ +export declare class GraphQLUnionType { + name: string; + description: Maybe; + resolveType: Maybe>; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _types; + constructor(config: Readonly>); + get [Symbol.toStringTag](): string; + getTypes(): ReadonlyArray; + toConfig(): GraphQLUnionTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLUnionTypeConfig { + name: string; + description?: Maybe; + types: ThunkReadonlyArray; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLUnionTypeNormalizedConfig + extends GraphQLUnionTypeConfig { + types: ReadonlyArray; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * ```ts + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +export declare class GraphQLEnumType { + name: string; + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _values; + private _valueLookup; + private _nameLookup; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + getValues(): ReadonlyArray; + getValue(name: string): Maybe; + serialize(outputValue: unknown): Maybe; + parseValue(inputValue: unknown): Maybe; + parseLiteral( + valueNode: ValueNode, + _variables: Maybe>, + ): Maybe; + toConfig(): GraphQLEnumTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLEnumTypeConfig { + name: string; + description?: Maybe; + values: GraphQLEnumValueConfigMap; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLEnumTypeNormalizedConfig extends GraphQLEnumTypeConfig { + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +export declare type GraphQLEnumValueConfigMap = ObjMap; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumValueExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLEnumValueConfig { + description?: Maybe; + value?: any; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +export interface GraphQLEnumValue { + name: string; + description: Maybe; + value: any; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputObjectTypeExtensions { + [attributeName: string]: unknown; +} +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * ``` + */ +export declare class GraphQLInputObjectType { + name: string; + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + private _fields; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + getFields(): GraphQLInputFieldMap; + toConfig(): GraphQLInputObjectTypeNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLInputObjectTypeConfig { + name: string; + description?: Maybe; + fields: ThunkObjMap; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +interface GraphQLInputObjectTypeNormalizedConfig + extends GraphQLInputObjectTypeConfig { + fields: GraphQLInputFieldConfigMap; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputFieldExtensions { + [attributeName: string]: unknown; +} +export interface GraphQLInputFieldConfig { + description?: Maybe; + type: GraphQLInputType; + defaultValue?: unknown; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +export declare type GraphQLInputFieldConfigMap = + ObjMap; +export interface GraphQLInputField { + name: string; + description: Maybe; + type: GraphQLInputType; + defaultValue: unknown; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} +export declare function isRequiredInputField(field: GraphQLInputField): boolean; +export declare type GraphQLInputFieldMap = ObjMap; +export {}; diff --git a/graphql-subscription/node_modules/graphql/type/definition.js b/graphql-subscription/node_modules/graphql/type/definition.js new file mode 100644 index 0000000..b27c083 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/definition.js @@ -0,0 +1,1339 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLUnionType = + exports.GraphQLScalarType = + exports.GraphQLObjectType = + exports.GraphQLNonNull = + exports.GraphQLList = + exports.GraphQLInterfaceType = + exports.GraphQLInputObjectType = + exports.GraphQLEnumType = + void 0; +exports.argsToArgsConfig = argsToArgsConfig; +exports.assertAbstractType = assertAbstractType; +exports.assertCompositeType = assertCompositeType; +exports.assertEnumType = assertEnumType; +exports.assertInputObjectType = assertInputObjectType; +exports.assertInputType = assertInputType; +exports.assertInterfaceType = assertInterfaceType; +exports.assertLeafType = assertLeafType; +exports.assertListType = assertListType; +exports.assertNamedType = assertNamedType; +exports.assertNonNullType = assertNonNullType; +exports.assertNullableType = assertNullableType; +exports.assertObjectType = assertObjectType; +exports.assertOutputType = assertOutputType; +exports.assertScalarType = assertScalarType; +exports.assertType = assertType; +exports.assertUnionType = assertUnionType; +exports.assertWrappingType = assertWrappingType; +exports.defineArguments = defineArguments; +exports.getNamedType = getNamedType; +exports.getNullableType = getNullableType; +exports.isAbstractType = isAbstractType; +exports.isCompositeType = isCompositeType; +exports.isEnumType = isEnumType; +exports.isInputObjectType = isInputObjectType; +exports.isInputType = isInputType; +exports.isInterfaceType = isInterfaceType; +exports.isLeafType = isLeafType; +exports.isListType = isListType; +exports.isNamedType = isNamedType; +exports.isNonNullType = isNonNullType; +exports.isNullableType = isNullableType; +exports.isObjectType = isObjectType; +exports.isOutputType = isOutputType; +exports.isRequiredArgument = isRequiredArgument; +exports.isRequiredInputField = isRequiredInputField; +exports.isScalarType = isScalarType; +exports.isType = isType; +exports.isUnionType = isUnionType; +exports.isWrappingType = isWrappingType; +exports.resolveObjMapThunk = resolveObjMapThunk; +exports.resolveReadonlyArrayThunk = resolveReadonlyArrayThunk; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _didYouMean = require('../jsutils/didYouMean.js'); + +var _identityFunc = require('../jsutils/identityFunc.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _mapValue = require('../jsutils/mapValue.js'); + +var _suggestionList = require('../jsutils/suggestionList.js'); + +var _toObjMap = require('../jsutils/toObjMap.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _valueFromASTUntyped = require('../utilities/valueFromASTUntyped.js'); + +var _assertName = require('./assertName.js'); + +function isType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) || + isListType(type) || + isNonNullType(type) + ); +} + +function assertType(type) { + if (!isType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL type.`, + ); + } + + return type; +} +/** + * There are predicates for each kind of GraphQL type. + */ + +function isScalarType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLScalarType); +} + +function assertScalarType(type) { + if (!isScalarType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Scalar type.`, + ); + } + + return type; +} + +function isObjectType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLObjectType); +} + +function assertObjectType(type) { + if (!isObjectType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Object type.`, + ); + } + + return type; +} + +function isInterfaceType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLInterfaceType); +} + +function assertInterfaceType(type) { + if (!isInterfaceType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Interface type.`, + ); + } + + return type; +} + +function isUnionType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLUnionType); +} + +function assertUnionType(type) { + if (!isUnionType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Union type.`, + ); + } + + return type; +} + +function isEnumType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLEnumType); +} + +function assertEnumType(type) { + if (!isEnumType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Enum type.`, + ); + } + + return type; +} + +function isInputObjectType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLInputObjectType); +} + +function assertInputObjectType(type) { + if (!isInputObjectType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)( + type, + )} to be a GraphQL Input Object type.`, + ); + } + + return type; +} + +function isListType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLList); +} + +function assertListType(type) { + if (!isListType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL List type.`, + ); + } + + return type; +} + +function isNonNullType(type) { + return (0, _instanceOf.instanceOf)(type, GraphQLNonNull); +} + +function assertNonNullType(type) { + if (!isNonNullType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Non-Null type.`, + ); + } + + return type; +} +/** + * These types may be used as input types for arguments and directives. + */ + +function isInputType(type) { + return ( + isScalarType(type) || + isEnumType(type) || + isInputObjectType(type) || + (isWrappingType(type) && isInputType(type.ofType)) + ); +} + +function assertInputType(type) { + if (!isInputType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL input type.`, + ); + } + + return type; +} +/** + * These types may be used as output types as the result of fields. + */ + +function isOutputType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + (isWrappingType(type) && isOutputType(type.ofType)) + ); +} + +function assertOutputType(type) { + if (!isOutputType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL output type.`, + ); + } + + return type; +} +/** + * These types may describe types which may be leaf values. + */ + +function isLeafType(type) { + return isScalarType(type) || isEnumType(type); +} + +function assertLeafType(type) { + if (!isLeafType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL leaf type.`, + ); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +function isCompositeType(type) { + return isObjectType(type) || isInterfaceType(type) || isUnionType(type); +} + +function assertCompositeType(type) { + if (!isCompositeType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL composite type.`, + ); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +function isAbstractType(type) { + return isInterfaceType(type) || isUnionType(type); +} + +function assertAbstractType(type) { + if (!isAbstractType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL abstract type.`, + ); + } + + return type; +} +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * ``` + */ + +class GraphQLList { + constructor(ofType) { + isType(ofType) || + (0, _devAssert.devAssert)( + false, + `Expected ${(0, _inspect.inspect)(ofType)} to be a GraphQL type.`, + ); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLList'; + } + + toString() { + return '[' + String(this.ofType) + ']'; + } + + toJSON() { + return this.toString(); + } +} +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * ``` + * Note: the enforcement of non-nullability occurs within the executor. + */ + +exports.GraphQLList = GraphQLList; + +class GraphQLNonNull { + constructor(ofType) { + isNullableType(ofType) || + (0, _devAssert.devAssert)( + false, + `Expected ${(0, _inspect.inspect)( + ofType, + )} to be a GraphQL nullable type.`, + ); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLNonNull'; + } + + toString() { + return String(this.ofType) + '!'; + } + + toJSON() { + return this.toString(); + } +} +/** + * These types wrap and modify other types + */ + +exports.GraphQLNonNull = GraphQLNonNull; + +function isWrappingType(type) { + return isListType(type) || isNonNullType(type); +} + +function assertWrappingType(type) { + if (!isWrappingType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL wrapping type.`, + ); + } + + return type; +} +/** + * These types can all accept null as a value. + */ + +function isNullableType(type) { + return isType(type) && !isNonNullType(type); +} + +function assertNullableType(type) { + if (!isNullableType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL nullable type.`, + ); + } + + return type; +} + +function getNullableType(type) { + if (type) { + return isNonNullType(type) ? type.ofType : type; + } +} +/** + * These named types do not include modifiers like List or NonNull. + */ + +function isNamedType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) + ); +} + +function assertNamedType(type) { + if (!isNamedType(type)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(type)} to be a GraphQL named type.`, + ); + } + + return type; +} + +function getNamedType(type) { + if (type) { + let unwrappedType = type; + + while (isWrappingType(unwrappedType)) { + unwrappedType = unwrappedType.ofType; + } + + return unwrappedType; + } +} +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ + +function resolveReadonlyArrayThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} + +function resolveObjMapThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function returns `null` or does not return a value + * (i.e. it returns `undefined`) then an error will be raised and a `null` + * value will be returned in the response. It is always better to validate + * + * Example: + * + * ```ts + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (!Number.isFinite(value)) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`, + * ); + * } + * + * if (value % 2 === 0) { + * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`); + * } + * return value; + * } + * }); + * ``` + */ +class GraphQLScalarType { + constructor(config) { + var _config$parseValue, + _config$serialize, + _config$parseLiteral, + _config$extensionASTN; + + const parseValue = + (_config$parseValue = config.parseValue) !== null && + _config$parseValue !== void 0 + ? _config$parseValue + : _identityFunc.identityFunc; + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.specifiedByURL = config.specifiedByURL; + this.serialize = + (_config$serialize = config.serialize) !== null && + _config$serialize !== void 0 + ? _config$serialize + : _identityFunc.identityFunc; + this.parseValue = parseValue; + this.parseLiteral = + (_config$parseLiteral = config.parseLiteral) !== null && + _config$parseLiteral !== void 0 + ? _config$parseLiteral + : (node, variables) => + parseValue( + (0, _valueFromASTUntyped.valueFromASTUntyped)(node, variables), + ); + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + config.specifiedByURL == null || + typeof config.specifiedByURL === 'string' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "specifiedByURL" as a string, ` + + `but got: ${(0, _inspect.inspect)(config.specifiedByURL)}.`, + ); + config.serialize == null || + typeof config.serialize === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`, + ); + + if (config.parseLiteral) { + (typeof config.parseValue === 'function' && + typeof config.parseLiteral === 'function') || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide both "parseValue" and "parseLiteral" functions.`, + ); + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLScalarType'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + specifiedByURL: this.specifiedByURL, + serialize: this.serialize, + parseValue: this.parseValue, + parseLiteral: this.parseLiteral, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLScalarType = GraphQLScalarType; + +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * ``` + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * ``` + */ +class GraphQLObjectType { + constructor(config) { + var _config$extensionASTN2; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.isTypeOf = config.isTypeOf; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN2 = config.extensionASTNodes) !== null && + _config$extensionASTN2 !== void 0 + ? _config$extensionASTN2 + : []; + + this._fields = () => defineFieldMap(config); + + this._interfaces = () => defineInterfaces(config); + + config.isTypeOf == null || + typeof config.isTypeOf === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "isTypeOf" as a function, ` + + `but got: ${(0, _inspect.inspect)(config.isTypeOf)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + isTypeOf: this.isTypeOf, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLObjectType = GraphQLObjectType; + +function defineInterfaces(config) { + var _config$interfaces; + + const interfaces = resolveReadonlyArrayThunk( + (_config$interfaces = config.interfaces) !== null && + _config$interfaces !== void 0 + ? _config$interfaces + : [], + ); + Array.isArray(interfaces) || + (0, _devAssert.devAssert)( + false, + `${config.name} interfaces must be an Array or a function which returns an Array.`, + ); + return interfaces; +} + +function defineFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + (0, _devAssert.devAssert)( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => { + var _fieldConfig$args; + + isPlainObj(fieldConfig) || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} field config must be an object.`, + ); + fieldConfig.resolve == null || + typeof fieldConfig.resolve === 'function' || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} field resolver must be a function if ` + + `provided, but got: ${(0, _inspect.inspect)(fieldConfig.resolve)}.`, + ); + const argsConfig = + (_fieldConfig$args = fieldConfig.args) !== null && + _fieldConfig$args !== void 0 + ? _fieldConfig$args + : {}; + isPlainObj(argsConfig) || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} args must be an object with argument names as keys.`, + ); + return { + name: (0, _assertName.assertName)(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + args: defineArguments(argsConfig), + resolve: fieldConfig.resolve, + subscribe: fieldConfig.subscribe, + deprecationReason: fieldConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +function defineArguments(config) { + return Object.entries(config).map(([argName, argConfig]) => ({ + name: (0, _assertName.assertName)(argName), + description: argConfig.description, + type: argConfig.type, + defaultValue: argConfig.defaultValue, + deprecationReason: argConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(argConfig.extensions), + astNode: argConfig.astNode, + })); +} + +function isPlainObj(obj) { + return (0, _isObjectLike.isObjectLike)(obj) && !Array.isArray(obj); +} + +function fieldsToFieldsConfig(fields) { + return (0, _mapValue.mapValue)(fields, (field) => ({ + description: field.description, + type: field.type, + args: argsToArgsConfig(field.args), + resolve: field.resolve, + subscribe: field.subscribe, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); +} +/** + * @internal + */ + +function argsToArgsConfig(args) { + return (0, _keyValMap.keyValMap)( + args, + (arg) => arg.name, + (arg) => ({ + description: arg.description, + type: arg.type, + defaultValue: arg.defaultValue, + deprecationReason: arg.deprecationReason, + extensions: arg.extensions, + astNode: arg.astNode, + }), + ); +} + +function isRequiredArgument(arg) { + return isNonNullType(arg.type) && arg.defaultValue === undefined; +} + +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * ``` + */ +class GraphQLInterfaceType { + constructor(config) { + var _config$extensionASTN3; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN3 = config.extensionASTNodes) !== null && + _config$extensionASTN3 !== void 0 + ? _config$extensionASTN3 + : []; + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${(0, _inspect.inspect)(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInterfaceType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLInterfaceType = GraphQLInterfaceType; + +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * ``` + */ +class GraphQLUnionType { + constructor(config) { + var _config$extensionASTN4; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN4 = config.extensionASTNodes) !== null && + _config$extensionASTN4 !== void 0 + ? _config$extensionASTN4 + : []; + this._types = defineTypes.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + (0, _devAssert.devAssert)( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${(0, _inspect.inspect)(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLUnionType'; + } + + getTypes() { + if (typeof this._types === 'function') { + this._types = this._types(); + } + + return this._types; + } + + toConfig() { + return { + name: this.name, + description: this.description, + types: this.getTypes(), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLUnionType = GraphQLUnionType; + +function defineTypes(config) { + const types = resolveReadonlyArrayThunk(config.types); + Array.isArray(types) || + (0, _devAssert.devAssert)( + false, + `Must provide Array of types or a function which returns such an array for Union ${config.name}.`, + ); + return types; +} + +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * ```ts + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +class GraphQLEnumType { + /* */ + constructor(config) { + var _config$extensionASTN5; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN5 = config.extensionASTNodes) !== null && + _config$extensionASTN5 !== void 0 + ? _config$extensionASTN5 + : []; + this._values = defineEnumValues(this.name, config.values); + this._valueLookup = new Map( + this._values.map((enumValue) => [enumValue.value, enumValue]), + ); + this._nameLookup = (0, _keyMap.keyMap)(this._values, (value) => value.name); + } + + get [Symbol.toStringTag]() { + return 'GraphQLEnumType'; + } + + getValues() { + return this._values; + } + + getValue(name) { + return this._nameLookup[name]; + } + + serialize(outputValue) { + const enumValue = this._valueLookup.get(outputValue); + + if (enumValue === undefined) { + throw new _GraphQLError.GraphQLError( + `Enum "${this.name}" cannot represent value: ${(0, _inspect.inspect)( + outputValue, + )}`, + ); + } + + return enumValue.name; + } + + parseValue(inputValue) /* T */ + { + if (typeof inputValue !== 'string') { + const valueStr = (0, _inspect.inspect)(inputValue); + throw new _GraphQLError.GraphQLError( + `Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + ); + } + + const enumValue = this.getValue(inputValue); + + if (enumValue == null) { + throw new _GraphQLError.GraphQLError( + `Value "${inputValue}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, inputValue), + ); + } + + return enumValue.value; + } + + parseLiteral(valueNode, _variables) /* T */ + { + // Note: variables will be resolved to a value before calling this function. + if (valueNode.kind !== _kinds.Kind.ENUM) { + const valueStr = (0, _printer.print)(valueNode); + throw new _GraphQLError.GraphQLError( + `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + const enumValue = this.getValue(valueNode.value); + + if (enumValue == null) { + const valueStr = (0, _printer.print)(valueNode); + throw new _GraphQLError.GraphQLError( + `Value "${valueStr}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + return enumValue.value; + } + + toConfig() { + const values = (0, _keyValMap.keyValMap)( + this.getValues(), + (value) => value.name, + (value) => ({ + description: value.description, + value: value.value, + deprecationReason: value.deprecationReason, + extensions: value.extensions, + astNode: value.astNode, + }), + ); + return { + name: this.name, + description: this.description, + values, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLEnumType = GraphQLEnumType; + +function didYouMeanEnumValue(enumType, unknownValueStr) { + const allNames = enumType.getValues().map((value) => value.name); + const suggestedValues = (0, _suggestionList.suggestionList)( + unknownValueStr, + allNames, + ); + return (0, _didYouMean.didYouMean)('the enum value', suggestedValues); +} + +function defineEnumValues(typeName, valueMap) { + isPlainObj(valueMap) || + (0, _devAssert.devAssert)( + false, + `${typeName} values must be an object with value names as keys.`, + ); + return Object.entries(valueMap).map(([valueName, valueConfig]) => { + isPlainObj(valueConfig) || + (0, _devAssert.devAssert)( + false, + `${typeName}.${valueName} must refer to an object with a "value" key ` + + `representing an internal value but got: ${(0, _inspect.inspect)( + valueConfig, + )}.`, + ); + return { + name: (0, _assertName.assertEnumValueName)(valueName), + description: valueConfig.description, + value: valueConfig.value !== undefined ? valueConfig.value : valueName, + deprecationReason: valueConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(valueConfig.extensions), + astNode: valueConfig.astNode, + }; + }); +} + +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * ``` + */ +class GraphQLInputObjectType { + constructor(config) { + var _config$extensionASTN6; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN6 = config.extensionASTNodes) !== null && + _config$extensionASTN6 !== void 0 + ? _config$extensionASTN6 + : []; + this._fields = defineInputFieldMap.bind(undefined, config); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInputObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + toConfig() { + const fields = (0, _mapValue.mapValue)(this.getFields(), (field) => ({ + description: field.description, + type: field.type, + defaultValue: field.defaultValue, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); + return { + name: this.name, + description: this.description, + fields, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLInputObjectType = GraphQLInputObjectType; + +function defineInputFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + (0, _devAssert.devAssert)( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => { + !('resolve' in fieldConfig) || + (0, _devAssert.devAssert)( + false, + `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`, + ); + return { + name: (0, _assertName.assertName)(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + defaultValue: fieldConfig.defaultValue, + deprecationReason: fieldConfig.deprecationReason, + extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +function isRequiredInputField(field) { + return isNonNullType(field.type) && field.defaultValue === undefined; +} diff --git a/graphql-subscription/node_modules/graphql/type/definition.mjs b/graphql-subscription/node_modules/graphql/type/definition.mjs new file mode 100644 index 0000000..636afd6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/definition.mjs @@ -0,0 +1,1177 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { didYouMean } from '../jsutils/didYouMean.mjs'; +import { identityFunc } from '../jsutils/identityFunc.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { mapValue } from '../jsutils/mapValue.mjs'; +import { suggestionList } from '../jsutils/suggestionList.mjs'; +import { toObjMap } from '../jsutils/toObjMap.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped.mjs'; +import { assertEnumValueName, assertName } from './assertName.mjs'; +export function isType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) || + isListType(type) || + isNonNullType(type) + ); +} +export function assertType(type) { + if (!isType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`); + } + + return type; +} +/** + * There are predicates for each kind of GraphQL type. + */ + +export function isScalarType(type) { + return instanceOf(type, GraphQLScalarType); +} +export function assertScalarType(type) { + if (!isScalarType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`); + } + + return type; +} +export function isObjectType(type) { + return instanceOf(type, GraphQLObjectType); +} +export function assertObjectType(type) { + if (!isObjectType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`); + } + + return type; +} +export function isInterfaceType(type) { + return instanceOf(type, GraphQLInterfaceType); +} +export function assertInterfaceType(type) { + if (!isInterfaceType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL Interface type.`, + ); + } + + return type; +} +export function isUnionType(type) { + return instanceOf(type, GraphQLUnionType); +} +export function assertUnionType(type) { + if (!isUnionType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`); + } + + return type; +} +export function isEnumType(type) { + return instanceOf(type, GraphQLEnumType); +} +export function assertEnumType(type) { + if (!isEnumType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`); + } + + return type; +} +export function isInputObjectType(type) { + return instanceOf(type, GraphQLInputObjectType); +} +export function assertInputObjectType(type) { + if (!isInputObjectType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL Input Object type.`, + ); + } + + return type; +} +export function isListType(type) { + return instanceOf(type, GraphQLList); +} +export function assertListType(type) { + if (!isListType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`); + } + + return type; +} +export function isNonNullType(type) { + return instanceOf(type, GraphQLNonNull); +} +export function assertNonNullType(type) { + if (!isNonNullType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`); + } + + return type; +} +/** + * These types may be used as input types for arguments and directives. + */ + +export function isInputType(type) { + return ( + isScalarType(type) || + isEnumType(type) || + isInputObjectType(type) || + (isWrappingType(type) && isInputType(type.ofType)) + ); +} +export function assertInputType(type) { + if (!isInputType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`); + } + + return type; +} +/** + * These types may be used as output types as the result of fields. + */ + +export function isOutputType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + (isWrappingType(type) && isOutputType(type.ofType)) + ); +} +export function assertOutputType(type) { + if (!isOutputType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`); + } + + return type; +} +/** + * These types may describe types which may be leaf values. + */ + +export function isLeafType(type) { + return isScalarType(type) || isEnumType(type); +} +export function assertLeafType(type) { + if (!isLeafType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +export function isCompositeType(type) { + return isObjectType(type) || isInterfaceType(type) || isUnionType(type); +} +export function assertCompositeType(type) { + if (!isCompositeType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL composite type.`, + ); + } + + return type; +} +/** + * These types may describe the parent context of a selection set. + */ + +export function isAbstractType(type) { + return isInterfaceType(type) || isUnionType(type); +} +export function assertAbstractType(type) { + if (!isAbstractType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`); + } + + return type; +} +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * ``` + */ + +export class GraphQLList { + constructor(ofType) { + isType(ofType) || + devAssert(false, `Expected ${inspect(ofType)} to be a GraphQL type.`); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLList'; + } + + toString() { + return '[' + String(this.ofType) + ']'; + } + + toJSON() { + return this.toString(); + } +} +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * ``` + * Note: the enforcement of non-nullability occurs within the executor. + */ + +export class GraphQLNonNull { + constructor(ofType) { + isNullableType(ofType) || + devAssert( + false, + `Expected ${inspect(ofType)} to be a GraphQL nullable type.`, + ); + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLNonNull'; + } + + toString() { + return String(this.ofType) + '!'; + } + + toJSON() { + return this.toString(); + } +} +/** + * These types wrap and modify other types + */ + +export function isWrappingType(type) { + return isListType(type) || isNonNullType(type); +} +export function assertWrappingType(type) { + if (!isWrappingType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`); + } + + return type; +} +/** + * These types can all accept null as a value. + */ + +export function isNullableType(type) { + return isType(type) && !isNonNullType(type); +} +export function assertNullableType(type) { + if (!isNullableType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`); + } + + return type; +} +export function getNullableType(type) { + if (type) { + return isNonNullType(type) ? type.ofType : type; + } +} +/** + * These named types do not include modifiers like List or NonNull. + */ + +export function isNamedType(type) { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) + ); +} +export function assertNamedType(type) { + if (!isNamedType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`); + } + + return type; +} +export function getNamedType(type) { + if (type) { + let unwrappedType = type; + + while (isWrappingType(unwrappedType)) { + unwrappedType = unwrappedType.ofType; + } + + return unwrappedType; + } +} +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ + +export function resolveReadonlyArrayThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} +export function resolveObjMapThunk(thunk) { + return typeof thunk === 'function' ? thunk() : thunk; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function returns `null` or does not return a value + * (i.e. it returns `undefined`) then an error will be raised and a `null` + * value will be returned in the response. It is always better to validate + * + * Example: + * + * ```ts + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (!Number.isFinite(value)) { + * throw new Error( + * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`, + * ); + * } + * + * if (value % 2 === 0) { + * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`); + * } + * return value; + * } + * }); + * ``` + */ +export class GraphQLScalarType { + constructor(config) { + var _config$parseValue, + _config$serialize, + _config$parseLiteral, + _config$extensionASTN; + + const parseValue = + (_config$parseValue = config.parseValue) !== null && + _config$parseValue !== void 0 + ? _config$parseValue + : identityFunc; + this.name = assertName(config.name); + this.description = config.description; + this.specifiedByURL = config.specifiedByURL; + this.serialize = + (_config$serialize = config.serialize) !== null && + _config$serialize !== void 0 + ? _config$serialize + : identityFunc; + this.parseValue = parseValue; + this.parseLiteral = + (_config$parseLiteral = config.parseLiteral) !== null && + _config$parseLiteral !== void 0 + ? _config$parseLiteral + : (node, variables) => parseValue(valueFromASTUntyped(node, variables)); + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + config.specifiedByURL == null || + typeof config.specifiedByURL === 'string' || + devAssert( + false, + `${this.name} must provide "specifiedByURL" as a string, ` + + `but got: ${inspect(config.specifiedByURL)}.`, + ); + config.serialize == null || + typeof config.serialize === 'function' || + devAssert( + false, + `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`, + ); + + if (config.parseLiteral) { + (typeof config.parseValue === 'function' && + typeof config.parseLiteral === 'function') || + devAssert( + false, + `${this.name} must provide both "parseValue" and "parseLiteral" functions.`, + ); + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLScalarType'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + specifiedByURL: this.specifiedByURL, + serialize: this.serialize, + parseValue: this.parseValue, + parseLiteral: this.parseLiteral, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * ``` + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * ``` + */ +export class GraphQLObjectType { + constructor(config) { + var _config$extensionASTN2; + + this.name = assertName(config.name); + this.description = config.description; + this.isTypeOf = config.isTypeOf; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN2 = config.extensionASTNodes) !== null && + _config$extensionASTN2 !== void 0 + ? _config$extensionASTN2 + : []; + + this._fields = () => defineFieldMap(config); + + this._interfaces = () => defineInterfaces(config); + + config.isTypeOf == null || + typeof config.isTypeOf === 'function' || + devAssert( + false, + `${this.name} must provide "isTypeOf" as a function, ` + + `but got: ${inspect(config.isTypeOf)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + isTypeOf: this.isTypeOf, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function defineInterfaces(config) { + var _config$interfaces; + + const interfaces = resolveReadonlyArrayThunk( + (_config$interfaces = config.interfaces) !== null && + _config$interfaces !== void 0 + ? _config$interfaces + : [], + ); + Array.isArray(interfaces) || + devAssert( + false, + `${config.name} interfaces must be an Array or a function which returns an Array.`, + ); + return interfaces; +} + +function defineFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + devAssert( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return mapValue(fieldMap, (fieldConfig, fieldName) => { + var _fieldConfig$args; + + isPlainObj(fieldConfig) || + devAssert( + false, + `${config.name}.${fieldName} field config must be an object.`, + ); + fieldConfig.resolve == null || + typeof fieldConfig.resolve === 'function' || + devAssert( + false, + `${config.name}.${fieldName} field resolver must be a function if ` + + `provided, but got: ${inspect(fieldConfig.resolve)}.`, + ); + const argsConfig = + (_fieldConfig$args = fieldConfig.args) !== null && + _fieldConfig$args !== void 0 + ? _fieldConfig$args + : {}; + isPlainObj(argsConfig) || + devAssert( + false, + `${config.name}.${fieldName} args must be an object with argument names as keys.`, + ); + return { + name: assertName(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + args: defineArguments(argsConfig), + resolve: fieldConfig.resolve, + subscribe: fieldConfig.subscribe, + deprecationReason: fieldConfig.deprecationReason, + extensions: toObjMap(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +export function defineArguments(config) { + return Object.entries(config).map(([argName, argConfig]) => ({ + name: assertName(argName), + description: argConfig.description, + type: argConfig.type, + defaultValue: argConfig.defaultValue, + deprecationReason: argConfig.deprecationReason, + extensions: toObjMap(argConfig.extensions), + astNode: argConfig.astNode, + })); +} + +function isPlainObj(obj) { + return isObjectLike(obj) && !Array.isArray(obj); +} + +function fieldsToFieldsConfig(fields) { + return mapValue(fields, (field) => ({ + description: field.description, + type: field.type, + args: argsToArgsConfig(field.args), + resolve: field.resolve, + subscribe: field.subscribe, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); +} +/** + * @internal + */ + +export function argsToArgsConfig(args) { + return keyValMap( + args, + (arg) => arg.name, + (arg) => ({ + description: arg.description, + type: arg.type, + defaultValue: arg.defaultValue, + deprecationReason: arg.deprecationReason, + extensions: arg.extensions, + astNode: arg.astNode, + }), + ); +} +export function isRequiredArgument(arg) { + return isNonNullType(arg.type) && arg.defaultValue === undefined; +} + +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * ``` + */ +export class GraphQLInterfaceType { + constructor(config) { + var _config$extensionASTN3; + + this.name = assertName(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN3 = config.extensionASTNodes) !== null && + _config$extensionASTN3 !== void 0 + ? _config$extensionASTN3 + : []; + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + devAssert( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${inspect(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInterfaceType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + getInterfaces() { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + + return this._interfaces; + } + + toConfig() { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * ``` + */ +export class GraphQLUnionType { + constructor(config) { + var _config$extensionASTN4; + + this.name = assertName(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN4 = config.extensionASTNodes) !== null && + _config$extensionASTN4 !== void 0 + ? _config$extensionASTN4 + : []; + this._types = defineTypes.bind(undefined, config); + config.resolveType == null || + typeof config.resolveType === 'function' || + devAssert( + false, + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${inspect(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLUnionType'; + } + + getTypes() { + if (typeof this._types === 'function') { + this._types = this._types(); + } + + return this._types; + } + + toConfig() { + return { + name: this.name, + description: this.description, + types: this.getTypes(), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function defineTypes(config) { + const types = resolveReadonlyArrayThunk(config.types); + Array.isArray(types) || + devAssert( + false, + `Must provide Array of types or a function which returns such an array for Union ${config.name}.`, + ); + return types; +} + +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * ```ts + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +export class GraphQLEnumType { + /* */ + constructor(config) { + var _config$extensionASTN5; + + this.name = assertName(config.name); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN5 = config.extensionASTNodes) !== null && + _config$extensionASTN5 !== void 0 + ? _config$extensionASTN5 + : []; + this._values = defineEnumValues(this.name, config.values); + this._valueLookup = new Map( + this._values.map((enumValue) => [enumValue.value, enumValue]), + ); + this._nameLookup = keyMap(this._values, (value) => value.name); + } + + get [Symbol.toStringTag]() { + return 'GraphQLEnumType'; + } + + getValues() { + return this._values; + } + + getValue(name) { + return this._nameLookup[name]; + } + + serialize(outputValue) { + const enumValue = this._valueLookup.get(outputValue); + + if (enumValue === undefined) { + throw new GraphQLError( + `Enum "${this.name}" cannot represent value: ${inspect(outputValue)}`, + ); + } + + return enumValue.name; + } + + parseValue(inputValue) /* T */ + { + if (typeof inputValue !== 'string') { + const valueStr = inspect(inputValue); + throw new GraphQLError( + `Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + ); + } + + const enumValue = this.getValue(inputValue); + + if (enumValue == null) { + throw new GraphQLError( + `Value "${inputValue}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, inputValue), + ); + } + + return enumValue.value; + } + + parseLiteral(valueNode, _variables) /* T */ + { + // Note: variables will be resolved to a value before calling this function. + if (valueNode.kind !== Kind.ENUM) { + const valueStr = print(valueNode); + throw new GraphQLError( + `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + const enumValue = this.getValue(valueNode.value); + + if (enumValue == null) { + const valueStr = print(valueNode); + throw new GraphQLError( + `Value "${valueStr}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, valueStr), + { + nodes: valueNode, + }, + ); + } + + return enumValue.value; + } + + toConfig() { + const values = keyValMap( + this.getValues(), + (value) => value.name, + (value) => ({ + description: value.description, + value: value.value, + deprecationReason: value.deprecationReason, + extensions: value.extensions, + astNode: value.astNode, + }), + ); + return { + name: this.name, + description: this.description, + values, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function didYouMeanEnumValue(enumType, unknownValueStr) { + const allNames = enumType.getValues().map((value) => value.name); + const suggestedValues = suggestionList(unknownValueStr, allNames); + return didYouMean('the enum value', suggestedValues); +} + +function defineEnumValues(typeName, valueMap) { + isPlainObj(valueMap) || + devAssert( + false, + `${typeName} values must be an object with value names as keys.`, + ); + return Object.entries(valueMap).map(([valueName, valueConfig]) => { + isPlainObj(valueConfig) || + devAssert( + false, + `${typeName}.${valueName} must refer to an object with a "value" key ` + + `representing an internal value but got: ${inspect(valueConfig)}.`, + ); + return { + name: assertEnumValueName(valueName), + description: valueConfig.description, + value: valueConfig.value !== undefined ? valueConfig.value : valueName, + deprecationReason: valueConfig.deprecationReason, + extensions: toObjMap(valueConfig.extensions), + astNode: valueConfig.astNode, + }; + }); +} + +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * ``` + */ +export class GraphQLInputObjectType { + constructor(config) { + var _config$extensionASTN6; + + this.name = assertName(config.name); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN6 = config.extensionASTNodes) !== null && + _config$extensionASTN6 !== void 0 + ? _config$extensionASTN6 + : []; + this._fields = defineInputFieldMap.bind(undefined, config); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInputObjectType'; + } + + getFields() { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + + return this._fields; + } + + toConfig() { + const fields = mapValue(this.getFields(), (field) => ({ + description: field.description, + type: field.type, + defaultValue: field.defaultValue, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); + return { + name: this.name, + description: this.description, + fields, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString() { + return this.name; + } + + toJSON() { + return this.toString(); + } +} + +function defineInputFieldMap(config) { + const fieldMap = resolveObjMapThunk(config.fields); + isPlainObj(fieldMap) || + devAssert( + false, + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return mapValue(fieldMap, (fieldConfig, fieldName) => { + !('resolve' in fieldConfig) || + devAssert( + false, + `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`, + ); + return { + name: assertName(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + defaultValue: fieldConfig.defaultValue, + deprecationReason: fieldConfig.deprecationReason, + extensions: toObjMap(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +export function isRequiredInputField(field) { + return isNonNullType(field.type) && field.defaultValue === undefined; +} diff --git a/graphql-subscription/node_modules/graphql/type/directives.d.ts b/graphql-subscription/node_modules/graphql/type/directives.d.ts new file mode 100644 index 0000000..bab5e5c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/directives.d.ts @@ -0,0 +1,86 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DirectiveDefinitionNode } from '../language/ast'; +import { DirectiveLocation } from '../language/directiveLocation'; +import type { + GraphQLArgument, + GraphQLFieldConfigArgumentMap, +} from './definition'; +/** + * Test if the given value is a GraphQL directive. + */ +export declare function isDirective( + directive: unknown, +): directive is GraphQLDirective; +export declare function assertDirective(directive: unknown): GraphQLDirective; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLDirectiveExtensions { + [attributeName: string]: unknown; +} +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +export declare class GraphQLDirective { + name: string; + description: Maybe; + locations: ReadonlyArray; + args: ReadonlyArray; + isRepeatable: boolean; + extensions: Readonly; + astNode: Maybe; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + toConfig(): GraphQLDirectiveNormalizedConfig; + toString(): string; + toJSON(): string; +} +export interface GraphQLDirectiveConfig { + name: string; + description?: Maybe; + locations: ReadonlyArray; + args?: Maybe; + isRepeatable?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} +interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig { + args: GraphQLFieldConfigArgumentMap; + isRepeatable: boolean; + extensions: Readonly; +} +/** + * Used to conditionally include fields or fragments. + */ +export declare const GraphQLIncludeDirective: GraphQLDirective; +/** + * Used to conditionally skip (exclude) fields or fragments. + */ +export declare const GraphQLSkipDirective: GraphQLDirective; +/** + * Constant string used for default reason for a deprecation. + */ +export declare const DEFAULT_DEPRECATION_REASON = 'No longer supported'; +/** + * Used to declare element of a GraphQL schema as deprecated. + */ +export declare const GraphQLDeprecatedDirective: GraphQLDirective; +/** + * Used to provide a URL for specifying the behavior of custom scalar definitions. + */ +export declare const GraphQLSpecifiedByDirective: GraphQLDirective; +/** + * The full list of specified directives. + */ +export declare const specifiedDirectives: ReadonlyArray; +export declare function isSpecifiedDirective( + directive: GraphQLDirective, +): boolean; +export {}; diff --git a/graphql-subscription/node_modules/graphql/type/directives.js b/graphql-subscription/node_modules/graphql/type/directives.js new file mode 100644 index 0000000..392e57f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/directives.js @@ -0,0 +1,224 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLSpecifiedByDirective = + exports.GraphQLSkipDirective = + exports.GraphQLIncludeDirective = + exports.GraphQLDirective = + exports.GraphQLDeprecatedDirective = + exports.DEFAULT_DEPRECATION_REASON = + void 0; +exports.assertDirective = assertDirective; +exports.isDirective = isDirective; +exports.isSpecifiedDirective = isSpecifiedDirective; +exports.specifiedDirectives = void 0; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _toObjMap = require('../jsutils/toObjMap.js'); + +var _directiveLocation = require('../language/directiveLocation.js'); + +var _assertName = require('./assertName.js'); + +var _definition = require('./definition.js'); + +var _scalars = require('./scalars.js'); + +/** + * Test if the given value is a GraphQL directive. + */ +function isDirective(directive) { + return (0, _instanceOf.instanceOf)(directive, GraphQLDirective); +} + +function assertDirective(directive) { + if (!isDirective(directive)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(directive)} to be a GraphQL directive.`, + ); + } + + return directive; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +class GraphQLDirective { + constructor(config) { + var _config$isRepeatable, _config$args; + + this.name = (0, _assertName.assertName)(config.name); + this.description = config.description; + this.locations = config.locations; + this.isRepeatable = + (_config$isRepeatable = config.isRepeatable) !== null && + _config$isRepeatable !== void 0 + ? _config$isRepeatable + : false; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + Array.isArray(config.locations) || + (0, _devAssert.devAssert)( + false, + `@${config.name} locations must be an Array.`, + ); + const args = + (_config$args = config.args) !== null && _config$args !== void 0 + ? _config$args + : {}; + ((0, _isObjectLike.isObjectLike)(args) && !Array.isArray(args)) || + (0, _devAssert.devAssert)( + false, + `@${config.name} args must be an object with argument names as keys.`, + ); + this.args = (0, _definition.defineArguments)(args); + } + + get [Symbol.toStringTag]() { + return 'GraphQLDirective'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + locations: this.locations, + args: (0, _definition.argsToArgsConfig)(this.args), + isRepeatable: this.isRepeatable, + extensions: this.extensions, + astNode: this.astNode, + }; + } + + toString() { + return '@' + this.name; + } + + toJSON() { + return this.toString(); + } +} + +exports.GraphQLDirective = GraphQLDirective; + +/** + * Used to conditionally include fields or fragments. + */ +const GraphQLIncludeDirective = new GraphQLDirective({ + name: 'include', + description: + 'Directs the executor to include this field or fragment only when the `if` argument is true.', + locations: [ + _directiveLocation.DirectiveLocation.FIELD, + _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, + _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + description: 'Included when true.', + }, + }, +}); +/** + * Used to conditionally skip (exclude) fields or fragments. + */ + +exports.GraphQLIncludeDirective = GraphQLIncludeDirective; +const GraphQLSkipDirective = new GraphQLDirective({ + name: 'skip', + description: + 'Directs the executor to skip this field or fragment when the `if` argument is true.', + locations: [ + _directiveLocation.DirectiveLocation.FIELD, + _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, + _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + description: 'Skipped when true.', + }, + }, +}); +/** + * Constant string used for default reason for a deprecation. + */ + +exports.GraphQLSkipDirective = GraphQLSkipDirective; +const DEFAULT_DEPRECATION_REASON = 'No longer supported'; +/** + * Used to declare element of a GraphQL schema as deprecated. + */ + +exports.DEFAULT_DEPRECATION_REASON = DEFAULT_DEPRECATION_REASON; +const GraphQLDeprecatedDirective = new GraphQLDirective({ + name: 'deprecated', + description: 'Marks an element of a GraphQL schema as no longer supported.', + locations: [ + _directiveLocation.DirectiveLocation.FIELD_DEFINITION, + _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, + _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, + _directiveLocation.DirectiveLocation.ENUM_VALUE, + ], + args: { + reason: { + type: _scalars.GraphQLString, + description: + 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', + defaultValue: DEFAULT_DEPRECATION_REASON, + }, + }, +}); +/** + * Used to provide a URL for specifying the behavior of custom scalar definitions. + */ + +exports.GraphQLDeprecatedDirective = GraphQLDeprecatedDirective; +const GraphQLSpecifiedByDirective = new GraphQLDirective({ + name: 'specifiedBy', + description: 'Exposes a URL that specifies the behavior of this scalar.', + locations: [_directiveLocation.DirectiveLocation.SCALAR], + args: { + url: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + description: 'The URL that specifies the behavior of this scalar.', + }, + }, +}); +/** + * The full list of specified directives. + */ + +exports.GraphQLSpecifiedByDirective = GraphQLSpecifiedByDirective; +const specifiedDirectives = Object.freeze([ + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, +]); +exports.specifiedDirectives = specifiedDirectives; + +function isSpecifiedDirective(directive) { + return specifiedDirectives.some(({ name }) => name === directive.name); +} diff --git a/graphql-subscription/node_modules/graphql/type/directives.mjs b/graphql-subscription/node_modules/graphql/type/directives.mjs new file mode 100644 index 0000000..c31196e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/directives.mjs @@ -0,0 +1,190 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { toObjMap } from '../jsutils/toObjMap.mjs'; +import { DirectiveLocation } from '../language/directiveLocation.mjs'; +import { assertName } from './assertName.mjs'; +import { + argsToArgsConfig, + defineArguments, + GraphQLNonNull, +} from './definition.mjs'; +import { GraphQLBoolean, GraphQLString } from './scalars.mjs'; +/** + * Test if the given value is a GraphQL directive. + */ + +export function isDirective(directive) { + return instanceOf(directive, GraphQLDirective); +} +export function assertDirective(directive) { + if (!isDirective(directive)) { + throw new Error( + `Expected ${inspect(directive)} to be a GraphQL directive.`, + ); + } + + return directive; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +export class GraphQLDirective { + constructor(config) { + var _config$isRepeatable, _config$args; + + this.name = assertName(config.name); + this.description = config.description; + this.locations = config.locations; + this.isRepeatable = + (_config$isRepeatable = config.isRepeatable) !== null && + _config$isRepeatable !== void 0 + ? _config$isRepeatable + : false; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + Array.isArray(config.locations) || + devAssert(false, `@${config.name} locations must be an Array.`); + const args = + (_config$args = config.args) !== null && _config$args !== void 0 + ? _config$args + : {}; + (isObjectLike(args) && !Array.isArray(args)) || + devAssert( + false, + `@${config.name} args must be an object with argument names as keys.`, + ); + this.args = defineArguments(args); + } + + get [Symbol.toStringTag]() { + return 'GraphQLDirective'; + } + + toConfig() { + return { + name: this.name, + description: this.description, + locations: this.locations, + args: argsToArgsConfig(this.args), + isRepeatable: this.isRepeatable, + extensions: this.extensions, + astNode: this.astNode, + }; + } + + toString() { + return '@' + this.name; + } + + toJSON() { + return this.toString(); + } +} + +/** + * Used to conditionally include fields or fragments. + */ +export const GraphQLIncludeDirective = new GraphQLDirective({ + name: 'include', + description: + 'Directs the executor to include this field or fragment only when the `if` argument is true.', + locations: [ + DirectiveLocation.FIELD, + DirectiveLocation.FRAGMENT_SPREAD, + DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new GraphQLNonNull(GraphQLBoolean), + description: 'Included when true.', + }, + }, +}); +/** + * Used to conditionally skip (exclude) fields or fragments. + */ + +export const GraphQLSkipDirective = new GraphQLDirective({ + name: 'skip', + description: + 'Directs the executor to skip this field or fragment when the `if` argument is true.', + locations: [ + DirectiveLocation.FIELD, + DirectiveLocation.FRAGMENT_SPREAD, + DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new GraphQLNonNull(GraphQLBoolean), + description: 'Skipped when true.', + }, + }, +}); +/** + * Constant string used for default reason for a deprecation. + */ + +export const DEFAULT_DEPRECATION_REASON = 'No longer supported'; +/** + * Used to declare element of a GraphQL schema as deprecated. + */ + +export const GraphQLDeprecatedDirective = new GraphQLDirective({ + name: 'deprecated', + description: 'Marks an element of a GraphQL schema as no longer supported.', + locations: [ + DirectiveLocation.FIELD_DEFINITION, + DirectiveLocation.ARGUMENT_DEFINITION, + DirectiveLocation.INPUT_FIELD_DEFINITION, + DirectiveLocation.ENUM_VALUE, + ], + args: { + reason: { + type: GraphQLString, + description: + 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', + defaultValue: DEFAULT_DEPRECATION_REASON, + }, + }, +}); +/** + * Used to provide a URL for specifying the behavior of custom scalar definitions. + */ + +export const GraphQLSpecifiedByDirective = new GraphQLDirective({ + name: 'specifiedBy', + description: 'Exposes a URL that specifies the behavior of this scalar.', + locations: [DirectiveLocation.SCALAR], + args: { + url: { + type: new GraphQLNonNull(GraphQLString), + description: 'The URL that specifies the behavior of this scalar.', + }, + }, +}); +/** + * The full list of specified directives. + */ + +export const specifiedDirectives = Object.freeze([ + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, +]); +export function isSpecifiedDirective(directive) { + return specifiedDirectives.some(({ name }) => name === directive.name); +} diff --git a/graphql-subscription/node_modules/graphql/type/index.d.ts b/graphql-subscription/node_modules/graphql/type/index.d.ts new file mode 100644 index 0000000..f186273 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/index.d.ts @@ -0,0 +1,150 @@ +export type { Path as ResponsePath } from '../jsutils/Path'; +export { isSchema, assertSchema, GraphQLSchema } from './schema'; +export type { GraphQLSchemaConfig, GraphQLSchemaExtensions } from './schema'; +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, + getNullableType, + getNamedType, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, +} from './definition'; +export type { + GraphQLType, + GraphQLInputType, + GraphQLOutputType, + GraphQLLeafType, + GraphQLCompositeType, + GraphQLAbstractType, + GraphQLWrappingType, + GraphQLNullableType, + GraphQLNamedType, + GraphQLNamedInputType, + GraphQLNamedOutputType, + ThunkReadonlyArray, + ThunkObjMap, + GraphQLArgument, + GraphQLArgumentConfig, + GraphQLArgumentExtensions, + GraphQLEnumTypeConfig, + GraphQLEnumTypeExtensions, + GraphQLEnumValue, + GraphQLEnumValueConfig, + GraphQLEnumValueConfigMap, + GraphQLEnumValueExtensions, + GraphQLField, + GraphQLFieldConfig, + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLFieldExtensions, + GraphQLFieldMap, + GraphQLFieldResolver, + GraphQLInputField, + GraphQLInputFieldConfig, + GraphQLInputFieldConfigMap, + GraphQLInputFieldExtensions, + GraphQLInputFieldMap, + GraphQLInputObjectTypeConfig, + GraphQLInputObjectTypeExtensions, + GraphQLInterfaceTypeConfig, + GraphQLInterfaceTypeExtensions, + GraphQLIsTypeOfFn, + GraphQLObjectTypeConfig, + GraphQLObjectTypeExtensions, + GraphQLResolveInfo, + GraphQLScalarTypeConfig, + GraphQLScalarTypeExtensions, + GraphQLTypeResolver, + GraphQLUnionTypeConfig, + GraphQLUnionTypeExtensions, + GraphQLScalarSerializer, + GraphQLScalarValueParser, + GraphQLScalarLiteralParser, +} from './definition'; +export { + isDirective, + assertDirective, + GraphQLDirective, + isSpecifiedDirective, + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, + DEFAULT_DEPRECATION_REASON, +} from './directives'; +export type { + GraphQLDirectiveConfig, + GraphQLDirectiveExtensions, +} from './directives'; +export { + isSpecifiedScalarType, + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, +} from './scalars'; +export { + isIntrospectionType, + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + TypeKind, + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from './introspection'; +export { validateSchema, assertValidSchema } from './validate'; +export { assertName, assertEnumValueName } from './assertName'; diff --git a/graphql-subscription/node_modules/graphql/type/index.js b/graphql-subscription/node_modules/graphql/type/index.js new file mode 100644 index 0000000..96b2c1b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/index.js @@ -0,0 +1,547 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'DEFAULT_DEPRECATION_REASON', { + enumerable: true, + get: function () { + return _directives.DEFAULT_DEPRECATION_REASON; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MAX_INT', { + enumerable: true, + get: function () { + return _scalars.GRAPHQL_MAX_INT; + }, +}); +Object.defineProperty(exports, 'GRAPHQL_MIN_INT', { + enumerable: true, + get: function () { + return _scalars.GRAPHQL_MIN_INT; + }, +}); +Object.defineProperty(exports, 'GraphQLBoolean', { + enumerable: true, + get: function () { + return _scalars.GraphQLBoolean; + }, +}); +Object.defineProperty(exports, 'GraphQLDeprecatedDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLDeprecatedDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLEnumType', { + enumerable: true, + get: function () { + return _definition.GraphQLEnumType; + }, +}); +Object.defineProperty(exports, 'GraphQLFloat', { + enumerable: true, + get: function () { + return _scalars.GraphQLFloat; + }, +}); +Object.defineProperty(exports, 'GraphQLID', { + enumerable: true, + get: function () { + return _scalars.GraphQLID; + }, +}); +Object.defineProperty(exports, 'GraphQLIncludeDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLIncludeDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLInputObjectType', { + enumerable: true, + get: function () { + return _definition.GraphQLInputObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLInt', { + enumerable: true, + get: function () { + return _scalars.GraphQLInt; + }, +}); +Object.defineProperty(exports, 'GraphQLInterfaceType', { + enumerable: true, + get: function () { + return _definition.GraphQLInterfaceType; + }, +}); +Object.defineProperty(exports, 'GraphQLList', { + enumerable: true, + get: function () { + return _definition.GraphQLList; + }, +}); +Object.defineProperty(exports, 'GraphQLNonNull', { + enumerable: true, + get: function () { + return _definition.GraphQLNonNull; + }, +}); +Object.defineProperty(exports, 'GraphQLObjectType', { + enumerable: true, + get: function () { + return _definition.GraphQLObjectType; + }, +}); +Object.defineProperty(exports, 'GraphQLScalarType', { + enumerable: true, + get: function () { + return _definition.GraphQLScalarType; + }, +}); +Object.defineProperty(exports, 'GraphQLSchema', { + enumerable: true, + get: function () { + return _schema.GraphQLSchema; + }, +}); +Object.defineProperty(exports, 'GraphQLSkipDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLSkipDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLSpecifiedByDirective', { + enumerable: true, + get: function () { + return _directives.GraphQLSpecifiedByDirective; + }, +}); +Object.defineProperty(exports, 'GraphQLString', { + enumerable: true, + get: function () { + return _scalars.GraphQLString; + }, +}); +Object.defineProperty(exports, 'GraphQLUnionType', { + enumerable: true, + get: function () { + return _definition.GraphQLUnionType; + }, +}); +Object.defineProperty(exports, 'SchemaMetaFieldDef', { + enumerable: true, + get: function () { + return _introspection.SchemaMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'TypeKind', { + enumerable: true, + get: function () { + return _introspection.TypeKind; + }, +}); +Object.defineProperty(exports, 'TypeMetaFieldDef', { + enumerable: true, + get: function () { + return _introspection.TypeMetaFieldDef; + }, +}); +Object.defineProperty(exports, 'TypeNameMetaFieldDef', { + enumerable: true, + get: function () { + return _introspection.TypeNameMetaFieldDef; + }, +}); +Object.defineProperty(exports, '__Directive', { + enumerable: true, + get: function () { + return _introspection.__Directive; + }, +}); +Object.defineProperty(exports, '__DirectiveLocation', { + enumerable: true, + get: function () { + return _introspection.__DirectiveLocation; + }, +}); +Object.defineProperty(exports, '__EnumValue', { + enumerable: true, + get: function () { + return _introspection.__EnumValue; + }, +}); +Object.defineProperty(exports, '__Field', { + enumerable: true, + get: function () { + return _introspection.__Field; + }, +}); +Object.defineProperty(exports, '__InputValue', { + enumerable: true, + get: function () { + return _introspection.__InputValue; + }, +}); +Object.defineProperty(exports, '__Schema', { + enumerable: true, + get: function () { + return _introspection.__Schema; + }, +}); +Object.defineProperty(exports, '__Type', { + enumerable: true, + get: function () { + return _introspection.__Type; + }, +}); +Object.defineProperty(exports, '__TypeKind', { + enumerable: true, + get: function () { + return _introspection.__TypeKind; + }, +}); +Object.defineProperty(exports, 'assertAbstractType', { + enumerable: true, + get: function () { + return _definition.assertAbstractType; + }, +}); +Object.defineProperty(exports, 'assertCompositeType', { + enumerable: true, + get: function () { + return _definition.assertCompositeType; + }, +}); +Object.defineProperty(exports, 'assertDirective', { + enumerable: true, + get: function () { + return _directives.assertDirective; + }, +}); +Object.defineProperty(exports, 'assertEnumType', { + enumerable: true, + get: function () { + return _definition.assertEnumType; + }, +}); +Object.defineProperty(exports, 'assertEnumValueName', { + enumerable: true, + get: function () { + return _assertName.assertEnumValueName; + }, +}); +Object.defineProperty(exports, 'assertInputObjectType', { + enumerable: true, + get: function () { + return _definition.assertInputObjectType; + }, +}); +Object.defineProperty(exports, 'assertInputType', { + enumerable: true, + get: function () { + return _definition.assertInputType; + }, +}); +Object.defineProperty(exports, 'assertInterfaceType', { + enumerable: true, + get: function () { + return _definition.assertInterfaceType; + }, +}); +Object.defineProperty(exports, 'assertLeafType', { + enumerable: true, + get: function () { + return _definition.assertLeafType; + }, +}); +Object.defineProperty(exports, 'assertListType', { + enumerable: true, + get: function () { + return _definition.assertListType; + }, +}); +Object.defineProperty(exports, 'assertName', { + enumerable: true, + get: function () { + return _assertName.assertName; + }, +}); +Object.defineProperty(exports, 'assertNamedType', { + enumerable: true, + get: function () { + return _definition.assertNamedType; + }, +}); +Object.defineProperty(exports, 'assertNonNullType', { + enumerable: true, + get: function () { + return _definition.assertNonNullType; + }, +}); +Object.defineProperty(exports, 'assertNullableType', { + enumerable: true, + get: function () { + return _definition.assertNullableType; + }, +}); +Object.defineProperty(exports, 'assertObjectType', { + enumerable: true, + get: function () { + return _definition.assertObjectType; + }, +}); +Object.defineProperty(exports, 'assertOutputType', { + enumerable: true, + get: function () { + return _definition.assertOutputType; + }, +}); +Object.defineProperty(exports, 'assertScalarType', { + enumerable: true, + get: function () { + return _definition.assertScalarType; + }, +}); +Object.defineProperty(exports, 'assertSchema', { + enumerable: true, + get: function () { + return _schema.assertSchema; + }, +}); +Object.defineProperty(exports, 'assertType', { + enumerable: true, + get: function () { + return _definition.assertType; + }, +}); +Object.defineProperty(exports, 'assertUnionType', { + enumerable: true, + get: function () { + return _definition.assertUnionType; + }, +}); +Object.defineProperty(exports, 'assertValidSchema', { + enumerable: true, + get: function () { + return _validate.assertValidSchema; + }, +}); +Object.defineProperty(exports, 'assertWrappingType', { + enumerable: true, + get: function () { + return _definition.assertWrappingType; + }, +}); +Object.defineProperty(exports, 'getNamedType', { + enumerable: true, + get: function () { + return _definition.getNamedType; + }, +}); +Object.defineProperty(exports, 'getNullableType', { + enumerable: true, + get: function () { + return _definition.getNullableType; + }, +}); +Object.defineProperty(exports, 'introspectionTypes', { + enumerable: true, + get: function () { + return _introspection.introspectionTypes; + }, +}); +Object.defineProperty(exports, 'isAbstractType', { + enumerable: true, + get: function () { + return _definition.isAbstractType; + }, +}); +Object.defineProperty(exports, 'isCompositeType', { + enumerable: true, + get: function () { + return _definition.isCompositeType; + }, +}); +Object.defineProperty(exports, 'isDirective', { + enumerable: true, + get: function () { + return _directives.isDirective; + }, +}); +Object.defineProperty(exports, 'isEnumType', { + enumerable: true, + get: function () { + return _definition.isEnumType; + }, +}); +Object.defineProperty(exports, 'isInputObjectType', { + enumerable: true, + get: function () { + return _definition.isInputObjectType; + }, +}); +Object.defineProperty(exports, 'isInputType', { + enumerable: true, + get: function () { + return _definition.isInputType; + }, +}); +Object.defineProperty(exports, 'isInterfaceType', { + enumerable: true, + get: function () { + return _definition.isInterfaceType; + }, +}); +Object.defineProperty(exports, 'isIntrospectionType', { + enumerable: true, + get: function () { + return _introspection.isIntrospectionType; + }, +}); +Object.defineProperty(exports, 'isLeafType', { + enumerable: true, + get: function () { + return _definition.isLeafType; + }, +}); +Object.defineProperty(exports, 'isListType', { + enumerable: true, + get: function () { + return _definition.isListType; + }, +}); +Object.defineProperty(exports, 'isNamedType', { + enumerable: true, + get: function () { + return _definition.isNamedType; + }, +}); +Object.defineProperty(exports, 'isNonNullType', { + enumerable: true, + get: function () { + return _definition.isNonNullType; + }, +}); +Object.defineProperty(exports, 'isNullableType', { + enumerable: true, + get: function () { + return _definition.isNullableType; + }, +}); +Object.defineProperty(exports, 'isObjectType', { + enumerable: true, + get: function () { + return _definition.isObjectType; + }, +}); +Object.defineProperty(exports, 'isOutputType', { + enumerable: true, + get: function () { + return _definition.isOutputType; + }, +}); +Object.defineProperty(exports, 'isRequiredArgument', { + enumerable: true, + get: function () { + return _definition.isRequiredArgument; + }, +}); +Object.defineProperty(exports, 'isRequiredInputField', { + enumerable: true, + get: function () { + return _definition.isRequiredInputField; + }, +}); +Object.defineProperty(exports, 'isScalarType', { + enumerable: true, + get: function () { + return _definition.isScalarType; + }, +}); +Object.defineProperty(exports, 'isSchema', { + enumerable: true, + get: function () { + return _schema.isSchema; + }, +}); +Object.defineProperty(exports, 'isSpecifiedDirective', { + enumerable: true, + get: function () { + return _directives.isSpecifiedDirective; + }, +}); +Object.defineProperty(exports, 'isSpecifiedScalarType', { + enumerable: true, + get: function () { + return _scalars.isSpecifiedScalarType; + }, +}); +Object.defineProperty(exports, 'isType', { + enumerable: true, + get: function () { + return _definition.isType; + }, +}); +Object.defineProperty(exports, 'isUnionType', { + enumerable: true, + get: function () { + return _definition.isUnionType; + }, +}); +Object.defineProperty(exports, 'isWrappingType', { + enumerable: true, + get: function () { + return _definition.isWrappingType; + }, +}); +Object.defineProperty(exports, 'resolveObjMapThunk', { + enumerable: true, + get: function () { + return _definition.resolveObjMapThunk; + }, +}); +Object.defineProperty(exports, 'resolveReadonlyArrayThunk', { + enumerable: true, + get: function () { + return _definition.resolveReadonlyArrayThunk; + }, +}); +Object.defineProperty(exports, 'specifiedDirectives', { + enumerable: true, + get: function () { + return _directives.specifiedDirectives; + }, +}); +Object.defineProperty(exports, 'specifiedScalarTypes', { + enumerable: true, + get: function () { + return _scalars.specifiedScalarTypes; + }, +}); +Object.defineProperty(exports, 'validateSchema', { + enumerable: true, + get: function () { + return _validate.validateSchema; + }, +}); + +var _schema = require('./schema.js'); + +var _definition = require('./definition.js'); + +var _directives = require('./directives.js'); + +var _scalars = require('./scalars.js'); + +var _introspection = require('./introspection.js'); + +var _validate = require('./validate.js'); + +var _assertName = require('./assertName.js'); diff --git a/graphql-subscription/node_modules/graphql/type/index.mjs b/graphql-subscription/node_modules/graphql/type/index.mjs new file mode 100644 index 0000000..027799d --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/index.mjs @@ -0,0 +1,103 @@ +export { + // Predicate + isSchema, // Assertion + assertSchema, // GraphQL Schema definition + GraphQLSchema, +} from './schema.mjs'; +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, // Predicates + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, // Assertions + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, // Un-modifiers + getNullableType, + getNamedType, // Definitions + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, // Type Wrappers + GraphQLList, + GraphQLNonNull, +} from './definition.mjs'; +export { + // Predicate + isDirective, // Assertion + assertDirective, // Directives Definition + GraphQLDirective, // Built-in Directives defined by the Spec + isSpecifiedDirective, + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, +} from './directives.mjs'; +// Common built-in scalar instances. +export { + // Predicate + isSpecifiedScalarType, // Standard GraphQL Scalars + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, // Int boundaries constants + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, +} from './scalars.mjs'; +export { + // Predicate + isIntrospectionType, // GraphQL Types for introspection. + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, // "Enum" of Type Kinds + TypeKind, // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from './introspection.mjs'; // Validate GraphQL schema. + +export { validateSchema, assertValidSchema } from './validate.mjs'; // Upholds the spec rules about naming. + +export { assertName, assertEnumValueName } from './assertName.mjs'; diff --git a/graphql-subscription/node_modules/graphql/type/introspection.d.ts b/graphql-subscription/node_modules/graphql/type/introspection.d.ts new file mode 100644 index 0000000..767ccab --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/introspection.d.ts @@ -0,0 +1,30 @@ +import type { GraphQLField, GraphQLNamedType } from './definition'; +import { GraphQLEnumType, GraphQLObjectType } from './definition'; +export declare const __Schema: GraphQLObjectType; +export declare const __Directive: GraphQLObjectType; +export declare const __DirectiveLocation: GraphQLEnumType; +export declare const __Type: GraphQLObjectType; +export declare const __Field: GraphQLObjectType; +export declare const __InputValue: GraphQLObjectType; +export declare const __EnumValue: GraphQLObjectType; +declare enum TypeKind { + SCALAR = 'SCALAR', + OBJECT = 'OBJECT', + INTERFACE = 'INTERFACE', + UNION = 'UNION', + ENUM = 'ENUM', + INPUT_OBJECT = 'INPUT_OBJECT', + LIST = 'LIST', + NON_NULL = 'NON_NULL', +} +export { TypeKind }; +export declare const __TypeKind: GraphQLEnumType; +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ +export declare const SchemaMetaFieldDef: GraphQLField; +export declare const TypeMetaFieldDef: GraphQLField; +export declare const TypeNameMetaFieldDef: GraphQLField; +export declare const introspectionTypes: ReadonlyArray; +export declare function isIntrospectionType(type: GraphQLNamedType): boolean; diff --git a/graphql-subscription/node_modules/graphql/type/introspection.js b/graphql-subscription/node_modules/graphql/type/introspection.js new file mode 100644 index 0000000..4a5c933 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/introspection.js @@ -0,0 +1,617 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.introspectionTypes = + exports.__TypeKind = + exports.__Type = + exports.__Schema = + exports.__InputValue = + exports.__Field = + exports.__EnumValue = + exports.__DirectiveLocation = + exports.__Directive = + exports.TypeNameMetaFieldDef = + exports.TypeMetaFieldDef = + exports.TypeKind = + exports.SchemaMetaFieldDef = + void 0; +exports.isIntrospectionType = isIntrospectionType; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _directiveLocation = require('../language/directiveLocation.js'); + +var _printer = require('../language/printer.js'); + +var _astFromValue = require('../utilities/astFromValue.js'); + +var _definition = require('./definition.js'); + +var _scalars = require('./scalars.js'); + +const __Schema = new _definition.GraphQLObjectType({ + name: '__Schema', + description: + 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', + fields: () => ({ + description: { + type: _scalars.GraphQLString, + resolve: (schema) => schema.description, + }, + types: { + description: 'A list of all types supported by this server.', + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + ), + + resolve(schema) { + return Object.values(schema.getTypeMap()); + }, + }, + queryType: { + description: 'The type that query operations will be rooted at.', + type: new _definition.GraphQLNonNull(__Type), + resolve: (schema) => schema.getQueryType(), + }, + mutationType: { + description: + 'If this server supports mutation, the type that mutation operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getMutationType(), + }, + subscriptionType: { + description: + 'If this server support subscription, the type that subscription operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getSubscriptionType(), + }, + directives: { + description: 'A list of all directives supported by this server.', + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__Directive), + ), + ), + resolve: (schema) => schema.getDirectives(), + }, + }), +}); + +exports.__Schema = __Schema; + +const __Directive = new _definition.GraphQLObjectType({ + name: '__Directive', + description: + "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (directive) => directive.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (directive) => directive.description, + }, + isRepeatable: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (directive) => directive.isRepeatable, + }, + locations: { + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__DirectiveLocation), + ), + ), + resolve: (directive) => directive.locations, + }, + args: { + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__InputValue), + ), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + }), +}); + +exports.__Directive = __Directive; + +const __DirectiveLocation = new _definition.GraphQLEnumType({ + name: '__DirectiveLocation', + description: + 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', + values: { + QUERY: { + value: _directiveLocation.DirectiveLocation.QUERY, + description: 'Location adjacent to a query operation.', + }, + MUTATION: { + value: _directiveLocation.DirectiveLocation.MUTATION, + description: 'Location adjacent to a mutation operation.', + }, + SUBSCRIPTION: { + value: _directiveLocation.DirectiveLocation.SUBSCRIPTION, + description: 'Location adjacent to a subscription operation.', + }, + FIELD: { + value: _directiveLocation.DirectiveLocation.FIELD, + description: 'Location adjacent to a field.', + }, + FRAGMENT_DEFINITION: { + value: _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION, + description: 'Location adjacent to a fragment definition.', + }, + FRAGMENT_SPREAD: { + value: _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD, + description: 'Location adjacent to a fragment spread.', + }, + INLINE_FRAGMENT: { + value: _directiveLocation.DirectiveLocation.INLINE_FRAGMENT, + description: 'Location adjacent to an inline fragment.', + }, + VARIABLE_DEFINITION: { + value: _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION, + description: 'Location adjacent to a variable definition.', + }, + SCHEMA: { + value: _directiveLocation.DirectiveLocation.SCHEMA, + description: 'Location adjacent to a schema definition.', + }, + SCALAR: { + value: _directiveLocation.DirectiveLocation.SCALAR, + description: 'Location adjacent to a scalar definition.', + }, + OBJECT: { + value: _directiveLocation.DirectiveLocation.OBJECT, + description: 'Location adjacent to an object type definition.', + }, + FIELD_DEFINITION: { + value: _directiveLocation.DirectiveLocation.FIELD_DEFINITION, + description: 'Location adjacent to a field definition.', + }, + ARGUMENT_DEFINITION: { + value: _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION, + description: 'Location adjacent to an argument definition.', + }, + INTERFACE: { + value: _directiveLocation.DirectiveLocation.INTERFACE, + description: 'Location adjacent to an interface definition.', + }, + UNION: { + value: _directiveLocation.DirectiveLocation.UNION, + description: 'Location adjacent to a union definition.', + }, + ENUM: { + value: _directiveLocation.DirectiveLocation.ENUM, + description: 'Location adjacent to an enum definition.', + }, + ENUM_VALUE: { + value: _directiveLocation.DirectiveLocation.ENUM_VALUE, + description: 'Location adjacent to an enum value definition.', + }, + INPUT_OBJECT: { + value: _directiveLocation.DirectiveLocation.INPUT_OBJECT, + description: 'Location adjacent to an input object type definition.', + }, + INPUT_FIELD_DEFINITION: { + value: _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION, + description: 'Location adjacent to an input object field definition.', + }, + }, +}); + +exports.__DirectiveLocation = __DirectiveLocation; + +const __Type = new _definition.GraphQLObjectType({ + name: '__Type', + description: + 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', + fields: () => ({ + kind: { + type: new _definition.GraphQLNonNull(__TypeKind), + + resolve(type) { + if ((0, _definition.isScalarType)(type)) { + return TypeKind.SCALAR; + } + + if ((0, _definition.isObjectType)(type)) { + return TypeKind.OBJECT; + } + + if ((0, _definition.isInterfaceType)(type)) { + return TypeKind.INTERFACE; + } + + if ((0, _definition.isUnionType)(type)) { + return TypeKind.UNION; + } + + if ((0, _definition.isEnumType)(type)) { + return TypeKind.ENUM; + } + + if ((0, _definition.isInputObjectType)(type)) { + return TypeKind.INPUT_OBJECT; + } + + if ((0, _definition.isListType)(type)) { + return TypeKind.LIST; + } + + if ((0, _definition.isNonNullType)(type)) { + return TypeKind.NON_NULL; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered) + + false || + (0, _invariant.invariant)( + false, + `Unexpected type: "${(0, _inspect.inspect)(type)}".`, + ); + }, + }, + name: { + type: _scalars.GraphQLString, + resolve: (type) => ('name' in type ? type.name : undefined), + }, + description: { + type: _scalars.GraphQLString, + resolve: ( + type, // FIXME: add test case + ) => + /* c8 ignore next */ + 'description' in type ? type.description : undefined, + }, + specifiedByURL: { + type: _scalars.GraphQLString, + resolve: (obj) => + 'specifiedByURL' in obj ? obj.specifiedByURL : undefined, + }, + fields: { + type: new _definition.GraphQLList( + new _definition.GraphQLNonNull(__Field), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) + ) { + const fields = Object.values(type.getFields()); + return includeDeprecated + ? fields + : fields.filter((field) => field.deprecationReason == null); + } + }, + }, + interfaces: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + + resolve(type) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) + ) { + return type.getInterfaces(); + } + }, + }, + possibleTypes: { + type: new _definition.GraphQLList(new _definition.GraphQLNonNull(__Type)), + + resolve(type, _args, _context, { schema }) { + if ((0, _definition.isAbstractType)(type)) { + return schema.getPossibleTypes(type); + } + }, + }, + enumValues: { + type: new _definition.GraphQLList( + new _definition.GraphQLNonNull(__EnumValue), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if ((0, _definition.isEnumType)(type)) { + const values = type.getValues(); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + inputFields: { + type: new _definition.GraphQLList( + new _definition.GraphQLNonNull(__InputValue), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if ((0, _definition.isInputObjectType)(type)) { + const values = Object.values(type.getFields()); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + ofType: { + type: __Type, + resolve: (type) => ('ofType' in type ? type.ofType : undefined), + }, + }), +}); + +exports.__Type = __Type; + +const __Field = new _definition.GraphQLObjectType({ + name: '__Field', + description: + 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (field) => field.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (field) => field.description, + }, + args: { + type: new _definition.GraphQLNonNull( + new _definition.GraphQLList( + new _definition.GraphQLNonNull(__InputValue), + ), + ), + args: { + includeDeprecated: { + type: _scalars.GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + type: { + type: new _definition.GraphQLNonNull(__Type), + resolve: (field) => field.type, + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: (field) => field.deprecationReason, + }, + }), +}); + +exports.__Field = __Field; + +const __InputValue = new _definition.GraphQLObjectType({ + name: '__InputValue', + description: + 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (inputValue) => inputValue.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (inputValue) => inputValue.description, + }, + type: { + type: new _definition.GraphQLNonNull(__Type), + resolve: (inputValue) => inputValue.type, + }, + defaultValue: { + type: _scalars.GraphQLString, + description: + 'A GraphQL-formatted string representing the default value for this input value.', + + resolve(inputValue) { + const { type, defaultValue } = inputValue; + const valueAST = (0, _astFromValue.astFromValue)(defaultValue, type); + return valueAST ? (0, _printer.print)(valueAST) : null; + }, + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: (obj) => obj.deprecationReason, + }, + }), +}); + +exports.__InputValue = __InputValue; + +const __EnumValue = new _definition.GraphQLObjectType({ + name: '__EnumValue', + description: + 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', + fields: () => ({ + name: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + resolve: (enumValue) => enumValue.name, + }, + description: { + type: _scalars.GraphQLString, + resolve: (enumValue) => enumValue.description, + }, + isDeprecated: { + type: new _definition.GraphQLNonNull(_scalars.GraphQLBoolean), + resolve: (enumValue) => enumValue.deprecationReason != null, + }, + deprecationReason: { + type: _scalars.GraphQLString, + resolve: (enumValue) => enumValue.deprecationReason, + }, + }), +}); + +exports.__EnumValue = __EnumValue; +var TypeKind; +exports.TypeKind = TypeKind; + +(function (TypeKind) { + TypeKind['SCALAR'] = 'SCALAR'; + TypeKind['OBJECT'] = 'OBJECT'; + TypeKind['INTERFACE'] = 'INTERFACE'; + TypeKind['UNION'] = 'UNION'; + TypeKind['ENUM'] = 'ENUM'; + TypeKind['INPUT_OBJECT'] = 'INPUT_OBJECT'; + TypeKind['LIST'] = 'LIST'; + TypeKind['NON_NULL'] = 'NON_NULL'; +})(TypeKind || (exports.TypeKind = TypeKind = {})); + +const __TypeKind = new _definition.GraphQLEnumType({ + name: '__TypeKind', + description: 'An enum describing what kind of type a given `__Type` is.', + values: { + SCALAR: { + value: TypeKind.SCALAR, + description: 'Indicates this type is a scalar.', + }, + OBJECT: { + value: TypeKind.OBJECT, + description: + 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', + }, + INTERFACE: { + value: TypeKind.INTERFACE, + description: + 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.', + }, + UNION: { + value: TypeKind.UNION, + description: + 'Indicates this type is a union. `possibleTypes` is a valid field.', + }, + ENUM: { + value: TypeKind.ENUM, + description: + 'Indicates this type is an enum. `enumValues` is a valid field.', + }, + INPUT_OBJECT: { + value: TypeKind.INPUT_OBJECT, + description: + 'Indicates this type is an input object. `inputFields` is a valid field.', + }, + LIST: { + value: TypeKind.LIST, + description: 'Indicates this type is a list. `ofType` is a valid field.', + }, + NON_NULL: { + value: TypeKind.NON_NULL, + description: + 'Indicates this type is a non-null. `ofType` is a valid field.', + }, + }, +}); +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ + +exports.__TypeKind = __TypeKind; +const SchemaMetaFieldDef = { + name: '__schema', + type: new _definition.GraphQLNonNull(__Schema), + description: 'Access the current type schema of this server.', + args: [], + resolve: (_source, _args, _context, { schema }) => schema, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +exports.SchemaMetaFieldDef = SchemaMetaFieldDef; +const TypeMetaFieldDef = { + name: '__type', + type: __Type, + description: 'Request the type information of a single type.', + args: [ + { + name: 'name', + description: undefined, + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + defaultValue: undefined, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, + }, + ], + resolve: (_source, { name }, _context, { schema }) => schema.getType(name), + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +exports.TypeMetaFieldDef = TypeMetaFieldDef; +const TypeNameMetaFieldDef = { + name: '__typename', + type: new _definition.GraphQLNonNull(_scalars.GraphQLString), + description: 'The name of the current Object type at runtime.', + args: [], + resolve: (_source, _args, _context, { parentType }) => parentType.name, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +exports.TypeNameMetaFieldDef = TypeNameMetaFieldDef; +const introspectionTypes = Object.freeze([ + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, +]); +exports.introspectionTypes = introspectionTypes; + +function isIntrospectionType(type) { + return introspectionTypes.some(({ name }) => type.name === name); +} diff --git a/graphql-subscription/node_modules/graphql/type/introspection.mjs b/graphql-subscription/node_modules/graphql/type/introspection.mjs new file mode 100644 index 0000000..31ee741 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/introspection.mjs @@ -0,0 +1,551 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { DirectiveLocation } from '../language/directiveLocation.mjs'; +import { print } from '../language/printer.mjs'; +import { astFromValue } from '../utilities/astFromValue.mjs'; +import { + GraphQLEnumType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + isAbstractType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from './definition.mjs'; +import { GraphQLBoolean, GraphQLString } from './scalars.mjs'; +export const __Schema = new GraphQLObjectType({ + name: '__Schema', + description: + 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', + fields: () => ({ + description: { + type: GraphQLString, + resolve: (schema) => schema.description, + }, + types: { + description: 'A list of all types supported by this server.', + type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))), + + resolve(schema) { + return Object.values(schema.getTypeMap()); + }, + }, + queryType: { + description: 'The type that query operations will be rooted at.', + type: new GraphQLNonNull(__Type), + resolve: (schema) => schema.getQueryType(), + }, + mutationType: { + description: + 'If this server supports mutation, the type that mutation operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getMutationType(), + }, + subscriptionType: { + description: + 'If this server support subscription, the type that subscription operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getSubscriptionType(), + }, + directives: { + description: 'A list of all directives supported by this server.', + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__Directive)), + ), + resolve: (schema) => schema.getDirectives(), + }, + }), +}); +export const __Directive = new GraphQLObjectType({ + name: '__Directive', + description: + "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (directive) => directive.name, + }, + description: { + type: GraphQLString, + resolve: (directive) => directive.description, + }, + isRepeatable: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (directive) => directive.isRepeatable, + }, + locations: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__DirectiveLocation)), + ), + resolve: (directive) => directive.locations, + }, + args: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__InputValue)), + ), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + }), +}); +export const __DirectiveLocation = new GraphQLEnumType({ + name: '__DirectiveLocation', + description: + 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', + values: { + QUERY: { + value: DirectiveLocation.QUERY, + description: 'Location adjacent to a query operation.', + }, + MUTATION: { + value: DirectiveLocation.MUTATION, + description: 'Location adjacent to a mutation operation.', + }, + SUBSCRIPTION: { + value: DirectiveLocation.SUBSCRIPTION, + description: 'Location adjacent to a subscription operation.', + }, + FIELD: { + value: DirectiveLocation.FIELD, + description: 'Location adjacent to a field.', + }, + FRAGMENT_DEFINITION: { + value: DirectiveLocation.FRAGMENT_DEFINITION, + description: 'Location adjacent to a fragment definition.', + }, + FRAGMENT_SPREAD: { + value: DirectiveLocation.FRAGMENT_SPREAD, + description: 'Location adjacent to a fragment spread.', + }, + INLINE_FRAGMENT: { + value: DirectiveLocation.INLINE_FRAGMENT, + description: 'Location adjacent to an inline fragment.', + }, + VARIABLE_DEFINITION: { + value: DirectiveLocation.VARIABLE_DEFINITION, + description: 'Location adjacent to a variable definition.', + }, + SCHEMA: { + value: DirectiveLocation.SCHEMA, + description: 'Location adjacent to a schema definition.', + }, + SCALAR: { + value: DirectiveLocation.SCALAR, + description: 'Location adjacent to a scalar definition.', + }, + OBJECT: { + value: DirectiveLocation.OBJECT, + description: 'Location adjacent to an object type definition.', + }, + FIELD_DEFINITION: { + value: DirectiveLocation.FIELD_DEFINITION, + description: 'Location adjacent to a field definition.', + }, + ARGUMENT_DEFINITION: { + value: DirectiveLocation.ARGUMENT_DEFINITION, + description: 'Location adjacent to an argument definition.', + }, + INTERFACE: { + value: DirectiveLocation.INTERFACE, + description: 'Location adjacent to an interface definition.', + }, + UNION: { + value: DirectiveLocation.UNION, + description: 'Location adjacent to a union definition.', + }, + ENUM: { + value: DirectiveLocation.ENUM, + description: 'Location adjacent to an enum definition.', + }, + ENUM_VALUE: { + value: DirectiveLocation.ENUM_VALUE, + description: 'Location adjacent to an enum value definition.', + }, + INPUT_OBJECT: { + value: DirectiveLocation.INPUT_OBJECT, + description: 'Location adjacent to an input object type definition.', + }, + INPUT_FIELD_DEFINITION: { + value: DirectiveLocation.INPUT_FIELD_DEFINITION, + description: 'Location adjacent to an input object field definition.', + }, + }, +}); +export const __Type = new GraphQLObjectType({ + name: '__Type', + description: + 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', + fields: () => ({ + kind: { + type: new GraphQLNonNull(__TypeKind), + + resolve(type) { + if (isScalarType(type)) { + return TypeKind.SCALAR; + } + + if (isObjectType(type)) { + return TypeKind.OBJECT; + } + + if (isInterfaceType(type)) { + return TypeKind.INTERFACE; + } + + if (isUnionType(type)) { + return TypeKind.UNION; + } + + if (isEnumType(type)) { + return TypeKind.ENUM; + } + + if (isInputObjectType(type)) { + return TypeKind.INPUT_OBJECT; + } + + if (isListType(type)) { + return TypeKind.LIST; + } + + if (isNonNullType(type)) { + return TypeKind.NON_NULL; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered) + + false || invariant(false, `Unexpected type: "${inspect(type)}".`); + }, + }, + name: { + type: GraphQLString, + resolve: (type) => ('name' in type ? type.name : undefined), + }, + description: { + type: GraphQLString, + resolve: ( + type, // FIXME: add test case + ) => + /* c8 ignore next */ + 'description' in type ? type.description : undefined, + }, + specifiedByURL: { + type: GraphQLString, + resolve: (obj) => + 'specifiedByURL' in obj ? obj.specifiedByURL : undefined, + }, + fields: { + type: new GraphQLList(new GraphQLNonNull(__Field)), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if (isObjectType(type) || isInterfaceType(type)) { + const fields = Object.values(type.getFields()); + return includeDeprecated + ? fields + : fields.filter((field) => field.deprecationReason == null); + } + }, + }, + interfaces: { + type: new GraphQLList(new GraphQLNonNull(__Type)), + + resolve(type) { + if (isObjectType(type) || isInterfaceType(type)) { + return type.getInterfaces(); + } + }, + }, + possibleTypes: { + type: new GraphQLList(new GraphQLNonNull(__Type)), + + resolve(type, _args, _context, { schema }) { + if (isAbstractType(type)) { + return schema.getPossibleTypes(type); + } + }, + }, + enumValues: { + type: new GraphQLList(new GraphQLNonNull(__EnumValue)), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if (isEnumType(type)) { + const values = type.getValues(); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + inputFields: { + type: new GraphQLList(new GraphQLNonNull(__InputValue)), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(type, { includeDeprecated }) { + if (isInputObjectType(type)) { + const values = Object.values(type.getFields()); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + ofType: { + type: __Type, + resolve: (type) => ('ofType' in type ? type.ofType : undefined), + }, + }), +}); +export const __Field = new GraphQLObjectType({ + name: '__Field', + description: + 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (field) => field.name, + }, + description: { + type: GraphQLString, + resolve: (field) => field.description, + }, + args: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__InputValue)), + ), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + type: { + type: new GraphQLNonNull(__Type), + resolve: (field) => field.type, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (field) => field.deprecationReason, + }, + }), +}); +export const __InputValue = new GraphQLObjectType({ + name: '__InputValue', + description: + 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (inputValue) => inputValue.name, + }, + description: { + type: GraphQLString, + resolve: (inputValue) => inputValue.description, + }, + type: { + type: new GraphQLNonNull(__Type), + resolve: (inputValue) => inputValue.type, + }, + defaultValue: { + type: GraphQLString, + description: + 'A GraphQL-formatted string representing the default value for this input value.', + + resolve(inputValue) { + const { type, defaultValue } = inputValue; + const valueAST = astFromValue(defaultValue, type); + return valueAST ? print(valueAST) : null; + }, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (obj) => obj.deprecationReason, + }, + }), +}); +export const __EnumValue = new GraphQLObjectType({ + name: '__EnumValue', + description: + 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', + fields: () => ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (enumValue) => enumValue.name, + }, + description: { + type: GraphQLString, + resolve: (enumValue) => enumValue.description, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (enumValue) => enumValue.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (enumValue) => enumValue.deprecationReason, + }, + }), +}); +var TypeKind; + +(function (TypeKind) { + TypeKind['SCALAR'] = 'SCALAR'; + TypeKind['OBJECT'] = 'OBJECT'; + TypeKind['INTERFACE'] = 'INTERFACE'; + TypeKind['UNION'] = 'UNION'; + TypeKind['ENUM'] = 'ENUM'; + TypeKind['INPUT_OBJECT'] = 'INPUT_OBJECT'; + TypeKind['LIST'] = 'LIST'; + TypeKind['NON_NULL'] = 'NON_NULL'; +})(TypeKind || (TypeKind = {})); + +export { TypeKind }; +export const __TypeKind = new GraphQLEnumType({ + name: '__TypeKind', + description: 'An enum describing what kind of type a given `__Type` is.', + values: { + SCALAR: { + value: TypeKind.SCALAR, + description: 'Indicates this type is a scalar.', + }, + OBJECT: { + value: TypeKind.OBJECT, + description: + 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', + }, + INTERFACE: { + value: TypeKind.INTERFACE, + description: + 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.', + }, + UNION: { + value: TypeKind.UNION, + description: + 'Indicates this type is a union. `possibleTypes` is a valid field.', + }, + ENUM: { + value: TypeKind.ENUM, + description: + 'Indicates this type is an enum. `enumValues` is a valid field.', + }, + INPUT_OBJECT: { + value: TypeKind.INPUT_OBJECT, + description: + 'Indicates this type is an input object. `inputFields` is a valid field.', + }, + LIST: { + value: TypeKind.LIST, + description: 'Indicates this type is a list. `ofType` is a valid field.', + }, + NON_NULL: { + value: TypeKind.NON_NULL, + description: + 'Indicates this type is a non-null. `ofType` is a valid field.', + }, + }, +}); +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ + +export const SchemaMetaFieldDef = { + name: '__schema', + type: new GraphQLNonNull(__Schema), + description: 'Access the current type schema of this server.', + args: [], + resolve: (_source, _args, _context, { schema }) => schema, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +export const TypeMetaFieldDef = { + name: '__type', + type: __Type, + description: 'Request the type information of a single type.', + args: [ + { + name: 'name', + description: undefined, + type: new GraphQLNonNull(GraphQLString), + defaultValue: undefined, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, + }, + ], + resolve: (_source, { name }, _context, { schema }) => schema.getType(name), + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +export const TypeNameMetaFieldDef = { + name: '__typename', + type: new GraphQLNonNull(GraphQLString), + description: 'The name of the current Object type at runtime.', + args: [], + resolve: (_source, _args, _context, { parentType }) => parentType.name, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; +export const introspectionTypes = Object.freeze([ + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, +]); +export function isIntrospectionType(type) { + return introspectionTypes.some(({ name }) => type.name === name); +} diff --git a/graphql-subscription/node_modules/graphql/type/scalars.d.ts b/graphql-subscription/node_modules/graphql/type/scalars.d.ts new file mode 100644 index 0000000..aa151e5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/scalars.d.ts @@ -0,0 +1,19 @@ +import type { GraphQLNamedType } from './definition'; +import { GraphQLScalarType } from './definition'; +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + * */ +export declare const GRAPHQL_MAX_INT = 2147483647; +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + * */ +export declare const GRAPHQL_MIN_INT = -2147483648; +export declare const GraphQLInt: GraphQLScalarType; +export declare const GraphQLFloat: GraphQLScalarType; +export declare const GraphQLString: GraphQLScalarType; +export declare const GraphQLBoolean: GraphQLScalarType; +export declare const GraphQLID: GraphQLScalarType; +export declare const specifiedScalarTypes: ReadonlyArray; +export declare function isSpecifiedScalarType(type: GraphQLNamedType): boolean; diff --git a/graphql-subscription/node_modules/graphql/type/scalars.js b/graphql-subscription/node_modules/graphql/type/scalars.js new file mode 100644 index 0000000..da04111 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/scalars.js @@ -0,0 +1,369 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLString = + exports.GraphQLInt = + exports.GraphQLID = + exports.GraphQLFloat = + exports.GraphQLBoolean = + exports.GRAPHQL_MIN_INT = + exports.GRAPHQL_MAX_INT = + void 0; +exports.isSpecifiedScalarType = isSpecifiedScalarType; +exports.specifiedScalarTypes = void 0; + +var _inspect = require('../jsutils/inspect.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('./definition.js'); + +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + * */ +const GRAPHQL_MAX_INT = 2147483647; +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + * */ + +exports.GRAPHQL_MAX_INT = GRAPHQL_MAX_INT; +const GRAPHQL_MIN_INT = -2147483648; +exports.GRAPHQL_MIN_INT = GRAPHQL_MIN_INT; +const GraphQLInt = new _definition.GraphQLScalarType({ + name: 'Int', + description: + 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isInteger(num)) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non-integer value: ${(0, _inspect.inspect)( + coercedValue, + )}`, + ); + } + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new _GraphQLError.GraphQLError( + 'Int cannot represent non 32-bit signed integer value: ' + + (0, _inspect.inspect)(coercedValue), + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isInteger(inputValue)) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non-integer value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${inputValue}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.INT) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non-integer value: ${(0, _printer.print)( + valueNode, + )}`, + { + nodes: valueNode, + }, + ); + } + + const num = parseInt(valueNode.value, 10); + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new _GraphQLError.GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, + { + nodes: valueNode, + }, + ); + } + + return num; + }, +}); +exports.GraphQLInt = GraphQLInt; +const GraphQLFloat = new _definition.GraphQLScalarType({ + name: 'Float', + description: + 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isFinite(num)) { + throw new _GraphQLError.GraphQLError( + `Float cannot represent non numeric value: ${(0, _inspect.inspect)( + coercedValue, + )}`, + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isFinite(inputValue)) { + throw new _GraphQLError.GraphQLError( + `Float cannot represent non numeric value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if ( + valueNode.kind !== _kinds.Kind.FLOAT && + valueNode.kind !== _kinds.Kind.INT + ) { + throw new _GraphQLError.GraphQLError( + `Float cannot represent non numeric value: ${(0, _printer.print)( + valueNode, + )}`, + valueNode, + ); + } + + return parseFloat(valueNode.value); + }, +}); +exports.GraphQLFloat = GraphQLFloat; +const GraphQLString = new _definition.GraphQLScalarType({ + name: 'String', + description: + 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not + // attempt to coerce object, function, symbol, or other types as strings. + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 'true' : 'false'; + } + + if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) { + return coercedValue.toString(); + } + + throw new _GraphQLError.GraphQLError( + `String cannot represent value: ${(0, _inspect.inspect)(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'string') { + throw new _GraphQLError.GraphQLError( + `String cannot represent a non string value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.STRING) { + throw new _GraphQLError.GraphQLError( + `String cannot represent a non string value: ${(0, _printer.print)( + valueNode, + )}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +exports.GraphQLString = GraphQLString; +const GraphQLBoolean = new _definition.GraphQLScalarType({ + name: 'Boolean', + description: 'The `Boolean` scalar type represents `true` or `false`.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue; + } + + if (Number.isFinite(coercedValue)) { + return coercedValue !== 0; + } + + throw new _GraphQLError.GraphQLError( + `Boolean cannot represent a non boolean value: ${(0, _inspect.inspect)( + coercedValue, + )}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'boolean') { + throw new _GraphQLError.GraphQLError( + `Boolean cannot represent a non boolean value: ${(0, _inspect.inspect)( + inputValue, + )}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== _kinds.Kind.BOOLEAN) { + throw new _GraphQLError.GraphQLError( + `Boolean cannot represent a non boolean value: ${(0, _printer.print)( + valueNode, + )}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +exports.GraphQLBoolean = GraphQLBoolean; +const GraphQLID = new _definition.GraphQLScalarType({ + name: 'ID', + description: + 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (Number.isInteger(coercedValue)) { + return String(coercedValue); + } + + throw new _GraphQLError.GraphQLError( + `ID cannot represent value: ${(0, _inspect.inspect)(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue === 'string') { + return inputValue; + } + + if (typeof inputValue === 'number' && Number.isInteger(inputValue)) { + return inputValue.toString(); + } + + throw new _GraphQLError.GraphQLError( + `ID cannot represent value: ${(0, _inspect.inspect)(inputValue)}`, + ); + }, + + parseLiteral(valueNode) { + if ( + valueNode.kind !== _kinds.Kind.STRING && + valueNode.kind !== _kinds.Kind.INT + ) { + throw new _GraphQLError.GraphQLError( + 'ID cannot represent a non-string and non-integer value: ' + + (0, _printer.print)(valueNode), + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +exports.GraphQLID = GraphQLID; +const specifiedScalarTypes = Object.freeze([ + GraphQLString, + GraphQLInt, + GraphQLFloat, + GraphQLBoolean, + GraphQLID, +]); +exports.specifiedScalarTypes = specifiedScalarTypes; + +function isSpecifiedScalarType(type) { + return specifiedScalarTypes.some(({ name }) => type.name === name); +} // Support serializing objects with custom valueOf() or toJSON() functions - +// a common way to represent a complex value which can be represented as +// a string (ex: MongoDB id objects). + +function serializeObject(outputValue) { + if ((0, _isObjectLike.isObjectLike)(outputValue)) { + if (typeof outputValue.valueOf === 'function') { + const valueOfResult = outputValue.valueOf(); + + if (!(0, _isObjectLike.isObjectLike)(valueOfResult)) { + return valueOfResult; + } + } + + if (typeof outputValue.toJSON === 'function') { + return outputValue.toJSON(); + } + } + + return outputValue; +} diff --git a/graphql-subscription/node_modules/graphql/type/scalars.mjs b/graphql-subscription/node_modules/graphql/type/scalars.mjs new file mode 100644 index 0000000..3aa154a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/scalars.mjs @@ -0,0 +1,309 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { GraphQLScalarType } from './definition.mjs'; +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + * */ + +export const GRAPHQL_MAX_INT = 2147483647; +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + * */ + +export const GRAPHQL_MIN_INT = -2147483648; +export const GraphQLInt = new GraphQLScalarType({ + name: 'Int', + description: + 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isInteger(num)) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${inspect(coercedValue)}`, + ); + } + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new GraphQLError( + 'Int cannot represent non 32-bit signed integer value: ' + + inspect(coercedValue), + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isInteger(inputValue)) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${inspect(inputValue)}`, + ); + } + + if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) { + throw new GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${inputValue}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.INT) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${print(valueNode)}`, + { + nodes: valueNode, + }, + ); + } + + const num = parseInt(valueNode.value, 10); + + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, + { + nodes: valueNode, + }, + ); + } + + return num; + }, +}); +export const GraphQLFloat = new GraphQLScalarType({ + name: 'Float', + description: + 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isFinite(num)) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${inspect(coercedValue)}`, + ); + } + + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isFinite(inputValue)) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${inspect(inputValue)}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${print(valueNode)}`, + valueNode, + ); + } + + return parseFloat(valueNode.value); + }, +}); +export const GraphQLString = new GraphQLScalarType({ + name: 'String', + description: + 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); // Serialize string, boolean and number values to a string, but do not + // attempt to coerce object, function, symbol, or other types as strings. + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 'true' : 'false'; + } + + if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) { + return coercedValue.toString(); + } + + throw new GraphQLError( + `String cannot represent value: ${inspect(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'string') { + throw new GraphQLError( + `String cannot represent a non string value: ${inspect(inputValue)}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.STRING) { + throw new GraphQLError( + `String cannot represent a non string value: ${print(valueNode)}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +export const GraphQLBoolean = new GraphQLScalarType({ + name: 'Boolean', + description: 'The `Boolean` scalar type represents `true` or `false`.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue; + } + + if (Number.isFinite(coercedValue)) { + return coercedValue !== 0; + } + + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${inspect(coercedValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'boolean') { + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${inspect(inputValue)}`, + ); + } + + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.BOOLEAN) { + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${print(valueNode)}`, + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +export const GraphQLID = new GraphQLScalarType({ + name: 'ID', + description: + 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'string') { + return coercedValue; + } + + if (Number.isInteger(coercedValue)) { + return String(coercedValue); + } + + throw new GraphQLError( + `ID cannot represent value: ${inspect(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue === 'string') { + return inputValue; + } + + if (typeof inputValue === 'number' && Number.isInteger(inputValue)) { + return inputValue.toString(); + } + + throw new GraphQLError(`ID cannot represent value: ${inspect(inputValue)}`); + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) { + throw new GraphQLError( + 'ID cannot represent a non-string and non-integer value: ' + + print(valueNode), + { + nodes: valueNode, + }, + ); + } + + return valueNode.value; + }, +}); +export const specifiedScalarTypes = Object.freeze([ + GraphQLString, + GraphQLInt, + GraphQLFloat, + GraphQLBoolean, + GraphQLID, +]); +export function isSpecifiedScalarType(type) { + return specifiedScalarTypes.some(({ name }) => type.name === name); +} // Support serializing objects with custom valueOf() or toJSON() functions - +// a common way to represent a complex value which can be represented as +// a string (ex: MongoDB id objects). + +function serializeObject(outputValue) { + if (isObjectLike(outputValue)) { + if (typeof outputValue.valueOf === 'function') { + const valueOfResult = outputValue.valueOf(); + + if (!isObjectLike(valueOfResult)) { + return valueOfResult; + } + } + + if (typeof outputValue.toJSON === 'function') { + return outputValue.toJSON(); + } + } + + return outputValue; +} diff --git a/graphql-subscription/node_modules/graphql/type/schema.d.ts b/graphql-subscription/node_modules/graphql/type/schema.d.ts new file mode 100644 index 0000000..7b84bb9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/schema.d.ts @@ -0,0 +1,170 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { GraphQLError } from '../error/GraphQLError'; +import type { + SchemaDefinitionNode, + SchemaExtensionNode, +} from '../language/ast'; +import { OperationTypeNode } from '../language/ast'; +import type { + GraphQLAbstractType, + GraphQLInterfaceType, + GraphQLNamedType, + GraphQLObjectType, +} from './definition'; +import type { GraphQLDirective } from './directives'; +/** + * Test if the given value is a GraphQL schema. + */ +export declare function isSchema(schema: unknown): schema is GraphQLSchema; +export declare function assertSchema(schema: unknown): GraphQLSchema; +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLSchemaExtensions { + [attributeName: string]: unknown; +} +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * ``` + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * ``` + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * ``` + */ +export declare class GraphQLSchema { + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + __validationErrors: Maybe>; + private _queryType; + private _mutationType; + private _subscriptionType; + private _directives; + private _typeMap; + private _subTypeMap; + private _implementationsMap; + constructor(config: Readonly); + get [Symbol.toStringTag](): string; + getQueryType(): Maybe; + getMutationType(): Maybe; + getSubscriptionType(): Maybe; + getRootType(operation: OperationTypeNode): Maybe; + getTypeMap(): TypeMap; + getType(name: string): GraphQLNamedType | undefined; + getPossibleTypes( + abstractType: GraphQLAbstractType, + ): ReadonlyArray; + getImplementations(interfaceType: GraphQLInterfaceType): { + objects: ReadonlyArray; + interfaces: ReadonlyArray; + }; + isSubType( + abstractType: GraphQLAbstractType, + maybeSubType: GraphQLObjectType | GraphQLInterfaceType, + ): boolean; + getDirectives(): ReadonlyArray; + getDirective(name: string): Maybe; + toConfig(): GraphQLSchemaNormalizedConfig; +} +declare type TypeMap = ObjMap; +export interface GraphQLSchemaValidationOptions { + /** + * When building a schema from a GraphQL service's introspection result, it + * might be safe to assume the schema is valid. Set to true to assume the + * produced schema is valid. + * + * Default: false + */ + assumeValid?: boolean; +} +export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions { + description?: Maybe; + query?: Maybe; + mutation?: Maybe; + subscription?: Maybe; + types?: Maybe>; + directives?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} +/** + * @internal + */ +export interface GraphQLSchemaNormalizedConfig extends GraphQLSchemaConfig { + description: Maybe; + types: ReadonlyArray; + directives: ReadonlyArray; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; + assumeValid: boolean; +} +export {}; diff --git a/graphql-subscription/node_modules/graphql/type/schema.js b/graphql-subscription/node_modules/graphql/type/schema.js new file mode 100644 index 0000000..d340e68 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/schema.js @@ -0,0 +1,402 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.GraphQLSchema = void 0; +exports.assertSchema = assertSchema; +exports.isSchema = isSchema; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _instanceOf = require('../jsutils/instanceOf.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _toObjMap = require('../jsutils/toObjMap.js'); + +var _ast = require('../language/ast.js'); + +var _definition = require('./definition.js'); + +var _directives = require('./directives.js'); + +var _introspection = require('./introspection.js'); + +/** + * Test if the given value is a GraphQL schema. + */ +function isSchema(schema) { + return (0, _instanceOf.instanceOf)(schema, GraphQLSchema); +} + +function assertSchema(schema) { + if (!isSchema(schema)) { + throw new Error( + `Expected ${(0, _inspect.inspect)(schema)} to be a GraphQL schema.`, + ); + } + + return schema; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * ``` + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * ``` + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * ``` + */ +class GraphQLSchema { + // Used as a cache for validateSchema(). + constructor(config) { + var _config$extensionASTN, _config$directives; + + // If this schema was built from a source known to be valid, then it may be + // marked with assumeValid to avoid an additional type system validation. + this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. + + (0, _isObjectLike.isObjectLike)(config) || + (0, _devAssert.devAssert)(false, 'Must provide configuration object.'); + !config.types || + Array.isArray(config.types) || + (0, _devAssert.devAssert)( + false, + `"types" must be Array if provided but got: ${(0, _inspect.inspect)( + config.types, + )}.`, + ); + !config.directives || + Array.isArray(config.directives) || + (0, _devAssert.devAssert)( + false, + '"directives" must be Array if provided but got: ' + + `${(0, _inspect.inspect)(config.directives)}.`, + ); + this.description = config.description; + this.extensions = (0, _toObjMap.toObjMap)(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + this._queryType = config.query; + this._mutationType = config.mutation; + this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. + + this._directives = + (_config$directives = config.directives) !== null && + _config$directives !== void 0 + ? _config$directives + : _directives.specifiedDirectives; // To preserve order of user-provided types, we add first to add them to + // the set of "collected" types, so `collectReferencedTypes` ignore them. + + const allReferencedTypes = new Set(config.types); + + if (config.types != null) { + for (const type of config.types) { + // When we ready to process this type, we remove it from "collected" types + // and then add it together with all dependent types in the correct position. + allReferencedTypes.delete(type); + collectReferencedTypes(type, allReferencedTypes); + } + } + + if (this._queryType != null) { + collectReferencedTypes(this._queryType, allReferencedTypes); + } + + if (this._mutationType != null) { + collectReferencedTypes(this._mutationType, allReferencedTypes); + } + + if (this._subscriptionType != null) { + collectReferencedTypes(this._subscriptionType, allReferencedTypes); + } + + for (const directive of this._directives) { + // Directives are not validated until validateSchema() is called. + if ((0, _directives.isDirective)(directive)) { + for (const arg of directive.args) { + collectReferencedTypes(arg.type, allReferencedTypes); + } + } + } + + collectReferencedTypes(_introspection.__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. + + this._typeMap = Object.create(null); + this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. + + this._implementationsMap = Object.create(null); + + for (const namedType of allReferencedTypes) { + if (namedType == null) { + continue; + } + + const typeName = namedType.name; + typeName || + (0, _devAssert.devAssert)( + false, + 'One of the provided types for building the Schema is missing a name.', + ); + + if (this._typeMap[typeName] !== undefined) { + throw new Error( + `Schema must contain uniquely named types but contains multiple types named "${typeName}".`, + ); + } + + this._typeMap[typeName] = namedType; + + if ((0, _definition.isInterfaceType)(namedType)) { + // Store implementations by interface. + for (const iface of namedType.getInterfaces()) { + if ((0, _definition.isInterfaceType)(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.interfaces.push(namedType); + } + } + } else if ((0, _definition.isObjectType)(namedType)) { + // Store implementations by objects. + for (const iface of namedType.getInterfaces()) { + if ((0, _definition.isInterfaceType)(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.objects.push(namedType); + } + } + } + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLSchema'; + } + + getQueryType() { + return this._queryType; + } + + getMutationType() { + return this._mutationType; + } + + getSubscriptionType() { + return this._subscriptionType; + } + + getRootType(operation) { + switch (operation) { + case _ast.OperationTypeNode.QUERY: + return this.getQueryType(); + + case _ast.OperationTypeNode.MUTATION: + return this.getMutationType(); + + case _ast.OperationTypeNode.SUBSCRIPTION: + return this.getSubscriptionType(); + } + } + + getTypeMap() { + return this._typeMap; + } + + getType(name) { + return this.getTypeMap()[name]; + } + + getPossibleTypes(abstractType) { + return (0, _definition.isUnionType)(abstractType) + ? abstractType.getTypes() + : this.getImplementations(abstractType).objects; + } + + getImplementations(interfaceType) { + const implementations = this._implementationsMap[interfaceType.name]; + return implementations !== null && implementations !== void 0 + ? implementations + : { + objects: [], + interfaces: [], + }; + } + + isSubType(abstractType, maybeSubType) { + let map = this._subTypeMap[abstractType.name]; + + if (map === undefined) { + map = Object.create(null); + + if ((0, _definition.isUnionType)(abstractType)) { + for (const type of abstractType.getTypes()) { + map[type.name] = true; + } + } else { + const implementations = this.getImplementations(abstractType); + + for (const type of implementations.objects) { + map[type.name] = true; + } + + for (const type of implementations.interfaces) { + map[type.name] = true; + } + } + + this._subTypeMap[abstractType.name] = map; + } + + return map[maybeSubType.name] !== undefined; + } + + getDirectives() { + return this._directives; + } + + getDirective(name) { + return this.getDirectives().find((directive) => directive.name === name); + } + + toConfig() { + return { + description: this.description, + query: this.getQueryType(), + mutation: this.getMutationType(), + subscription: this.getSubscriptionType(), + types: Object.values(this.getTypeMap()), + directives: this.getDirectives(), + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + assumeValid: this.__validationErrors !== undefined, + }; + } +} + +exports.GraphQLSchema = GraphQLSchema; + +function collectReferencedTypes(type, typeSet) { + const namedType = (0, _definition.getNamedType)(type); + + if (!typeSet.has(namedType)) { + typeSet.add(namedType); + + if ((0, _definition.isUnionType)(namedType)) { + for (const memberType of namedType.getTypes()) { + collectReferencedTypes(memberType, typeSet); + } + } else if ( + (0, _definition.isObjectType)(namedType) || + (0, _definition.isInterfaceType)(namedType) + ) { + for (const interfaceType of namedType.getInterfaces()) { + collectReferencedTypes(interfaceType, typeSet); + } + + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + + for (const arg of field.args) { + collectReferencedTypes(arg.type, typeSet); + } + } + } else if ((0, _definition.isInputObjectType)(namedType)) { + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + } + } + } + + return typeSet; +} diff --git a/graphql-subscription/node_modules/graphql/type/schema.mjs b/graphql-subscription/node_modules/graphql/type/schema.mjs new file mode 100644 index 0000000..39216df --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/schema.mjs @@ -0,0 +1,381 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { instanceOf } from '../jsutils/instanceOf.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { toObjMap } from '../jsutils/toObjMap.mjs'; +import { OperationTypeNode } from '../language/ast.mjs'; +import { + getNamedType, + isInputObjectType, + isInterfaceType, + isObjectType, + isUnionType, +} from './definition.mjs'; +import { isDirective, specifiedDirectives } from './directives.mjs'; +import { __Schema } from './introspection.mjs'; +/** + * Test if the given value is a GraphQL schema. + */ + +export function isSchema(schema) { + return instanceOf(schema, GraphQLSchema); +} +export function assertSchema(schema) { + if (!isSchema(schema)) { + throw new Error(`Expected ${inspect(schema)} to be a GraphQL schema.`); + } + + return schema; +} +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ + +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * ``` + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * ``` + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * ``` + */ +export class GraphQLSchema { + // Used as a cache for validateSchema(). + constructor(config) { + var _config$extensionASTN, _config$directives; + + // If this schema was built from a source known to be valid, then it may be + // marked with assumeValid to avoid an additional type system validation. + this.__validationErrors = config.assumeValid === true ? [] : undefined; // Check for common mistakes during construction to produce early errors. + + isObjectLike(config) || + devAssert(false, 'Must provide configuration object.'); + !config.types || + Array.isArray(config.types) || + devAssert( + false, + `"types" must be Array if provided but got: ${inspect(config.types)}.`, + ); + !config.directives || + Array.isArray(config.directives) || + devAssert( + false, + '"directives" must be Array if provided but got: ' + + `${inspect(config.directives)}.`, + ); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = + (_config$extensionASTN = config.extensionASTNodes) !== null && + _config$extensionASTN !== void 0 + ? _config$extensionASTN + : []; + this._queryType = config.query; + this._mutationType = config.mutation; + this._subscriptionType = config.subscription; // Provide specified directives (e.g. @include and @skip) by default. + + this._directives = + (_config$directives = config.directives) !== null && + _config$directives !== void 0 + ? _config$directives + : specifiedDirectives; // To preserve order of user-provided types, we add first to add them to + // the set of "collected" types, so `collectReferencedTypes` ignore them. + + const allReferencedTypes = new Set(config.types); + + if (config.types != null) { + for (const type of config.types) { + // When we ready to process this type, we remove it from "collected" types + // and then add it together with all dependent types in the correct position. + allReferencedTypes.delete(type); + collectReferencedTypes(type, allReferencedTypes); + } + } + + if (this._queryType != null) { + collectReferencedTypes(this._queryType, allReferencedTypes); + } + + if (this._mutationType != null) { + collectReferencedTypes(this._mutationType, allReferencedTypes); + } + + if (this._subscriptionType != null) { + collectReferencedTypes(this._subscriptionType, allReferencedTypes); + } + + for (const directive of this._directives) { + // Directives are not validated until validateSchema() is called. + if (isDirective(directive)) { + for (const arg of directive.args) { + collectReferencedTypes(arg.type, allReferencedTypes); + } + } + } + + collectReferencedTypes(__Schema, allReferencedTypes); // Storing the resulting map for reference by the schema. + + this._typeMap = Object.create(null); + this._subTypeMap = Object.create(null); // Keep track of all implementations by interface name. + + this._implementationsMap = Object.create(null); + + for (const namedType of allReferencedTypes) { + if (namedType == null) { + continue; + } + + const typeName = namedType.name; + typeName || + devAssert( + false, + 'One of the provided types for building the Schema is missing a name.', + ); + + if (this._typeMap[typeName] !== undefined) { + throw new Error( + `Schema must contain uniquely named types but contains multiple types named "${typeName}".`, + ); + } + + this._typeMap[typeName] = namedType; + + if (isInterfaceType(namedType)) { + // Store implementations by interface. + for (const iface of namedType.getInterfaces()) { + if (isInterfaceType(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.interfaces.push(namedType); + } + } + } else if (isObjectType(namedType)) { + // Store implementations by objects. + for (const iface of namedType.getInterfaces()) { + if (isInterfaceType(iface)) { + let implementations = this._implementationsMap[iface.name]; + + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.objects.push(namedType); + } + } + } + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLSchema'; + } + + getQueryType() { + return this._queryType; + } + + getMutationType() { + return this._mutationType; + } + + getSubscriptionType() { + return this._subscriptionType; + } + + getRootType(operation) { + switch (operation) { + case OperationTypeNode.QUERY: + return this.getQueryType(); + + case OperationTypeNode.MUTATION: + return this.getMutationType(); + + case OperationTypeNode.SUBSCRIPTION: + return this.getSubscriptionType(); + } + } + + getTypeMap() { + return this._typeMap; + } + + getType(name) { + return this.getTypeMap()[name]; + } + + getPossibleTypes(abstractType) { + return isUnionType(abstractType) + ? abstractType.getTypes() + : this.getImplementations(abstractType).objects; + } + + getImplementations(interfaceType) { + const implementations = this._implementationsMap[interfaceType.name]; + return implementations !== null && implementations !== void 0 + ? implementations + : { + objects: [], + interfaces: [], + }; + } + + isSubType(abstractType, maybeSubType) { + let map = this._subTypeMap[abstractType.name]; + + if (map === undefined) { + map = Object.create(null); + + if (isUnionType(abstractType)) { + for (const type of abstractType.getTypes()) { + map[type.name] = true; + } + } else { + const implementations = this.getImplementations(abstractType); + + for (const type of implementations.objects) { + map[type.name] = true; + } + + for (const type of implementations.interfaces) { + map[type.name] = true; + } + } + + this._subTypeMap[abstractType.name] = map; + } + + return map[maybeSubType.name] !== undefined; + } + + getDirectives() { + return this._directives; + } + + getDirective(name) { + return this.getDirectives().find((directive) => directive.name === name); + } + + toConfig() { + return { + description: this.description, + query: this.getQueryType(), + mutation: this.getMutationType(), + subscription: this.getSubscriptionType(), + types: Object.values(this.getTypeMap()), + directives: this.getDirectives(), + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + assumeValid: this.__validationErrors !== undefined, + }; + } +} + +function collectReferencedTypes(type, typeSet) { + const namedType = getNamedType(type); + + if (!typeSet.has(namedType)) { + typeSet.add(namedType); + + if (isUnionType(namedType)) { + for (const memberType of namedType.getTypes()) { + collectReferencedTypes(memberType, typeSet); + } + } else if (isObjectType(namedType) || isInterfaceType(namedType)) { + for (const interfaceType of namedType.getInterfaces()) { + collectReferencedTypes(interfaceType, typeSet); + } + + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + + for (const arg of field.args) { + collectReferencedTypes(arg.type, typeSet); + } + } + } else if (isInputObjectType(namedType)) { + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + } + } + } + + return typeSet; +} diff --git a/graphql-subscription/node_modules/graphql/type/validate.d.ts b/graphql-subscription/node_modules/graphql/type/validate.d.ts new file mode 100644 index 0000000..0528c9b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/validate.d.ts @@ -0,0 +1,17 @@ +import { GraphQLError } from '../error/GraphQLError'; +import type { GraphQLSchema } from './schema'; +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ +export declare function validateSchema( + schema: GraphQLSchema, +): ReadonlyArray; +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ +export declare function assertValidSchema(schema: GraphQLSchema): void; diff --git a/graphql-subscription/node_modules/graphql/type/validate.js b/graphql-subscription/node_modules/graphql/type/validate.js new file mode 100644 index 0000000..f3413d5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/validate.js @@ -0,0 +1,676 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidSchema = assertValidSchema; +exports.validateSchema = validateSchema; + +var _inspect = require('../jsutils/inspect.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _ast = require('../language/ast.js'); + +var _typeComparators = require('../utilities/typeComparators.js'); + +var _definition = require('./definition.js'); + +var _directives = require('./directives.js'); + +var _introspection = require('./introspection.js'); + +var _schema = require('./schema.js'); + +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ +function validateSchema(schema) { + // First check to ensure the provided value is in fact a GraphQLSchema. + (0, _schema.assertSchema)(schema); // If this Schema has already been validated, return the previous results. + + if (schema.__validationErrors) { + return schema.__validationErrors; + } // Validate the schema, producing a list of errors. + + const context = new SchemaValidationContext(schema); + validateRootTypes(context); + validateDirectives(context); + validateTypes(context); // Persist the results of validation before returning to ensure validation + // does not run multiple times for this schema. + + const errors = context.getErrors(); + schema.__validationErrors = errors; + return errors; +} +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ + +function assertValidSchema(schema) { + const errors = validateSchema(schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} + +class SchemaValidationContext { + constructor(schema) { + this._errors = []; + this.schema = schema; + } + + reportError(message, nodes) { + const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; + + this._errors.push( + new _GraphQLError.GraphQLError(message, { + nodes: _nodes, + }), + ); + } + + getErrors() { + return this._errors; + } +} + +function validateRootTypes(context) { + const schema = context.schema; + const queryType = schema.getQueryType(); + + if (!queryType) { + context.reportError('Query root type must be provided.', schema.astNode); + } else if (!(0, _definition.isObjectType)(queryType)) { + var _getOperationTypeNode; + + context.reportError( + `Query root type must be Object type, it cannot be ${(0, + _inspect.inspect)(queryType)}.`, + (_getOperationTypeNode = getOperationTypeNode( + schema, + _ast.OperationTypeNode.QUERY, + )) !== null && _getOperationTypeNode !== void 0 + ? _getOperationTypeNode + : queryType.astNode, + ); + } + + const mutationType = schema.getMutationType(); + + if (mutationType && !(0, _definition.isObjectType)(mutationType)) { + var _getOperationTypeNode2; + + context.reportError( + 'Mutation root type must be Object type if provided, it cannot be ' + + `${(0, _inspect.inspect)(mutationType)}.`, + (_getOperationTypeNode2 = getOperationTypeNode( + schema, + _ast.OperationTypeNode.MUTATION, + )) !== null && _getOperationTypeNode2 !== void 0 + ? _getOperationTypeNode2 + : mutationType.astNode, + ); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && !(0, _definition.isObjectType)(subscriptionType)) { + var _getOperationTypeNode3; + + context.reportError( + 'Subscription root type must be Object type if provided, it cannot be ' + + `${(0, _inspect.inspect)(subscriptionType)}.`, + (_getOperationTypeNode3 = getOperationTypeNode( + schema, + _ast.OperationTypeNode.SUBSCRIPTION, + )) !== null && _getOperationTypeNode3 !== void 0 + ? _getOperationTypeNode3 + : subscriptionType.astNode, + ); + } +} + +function getOperationTypeNode(schema, operation) { + var _flatMap$find; + + return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes] + .flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (schemaNode) => { + var _schemaNode$operation; + + return ( + /* c8 ignore next */ + (_schemaNode$operation = + schemaNode === null || schemaNode === void 0 + ? void 0 + : schemaNode.operationTypes) !== null && + _schemaNode$operation !== void 0 + ? _schemaNode$operation + : [] + ); + }, + ) + .find((operationNode) => operationNode.operation === operation)) === null || + _flatMap$find === void 0 + ? void 0 + : _flatMap$find.type; +} + +function validateDirectives(context) { + for (const directive of context.schema.getDirectives()) { + // Ensure all directives are in fact GraphQL directives. + if (!(0, _directives.isDirective)(directive)) { + context.reportError( + `Expected directive but got: ${(0, _inspect.inspect)(directive)}.`, + directive === null || directive === void 0 ? void 0 : directive.astNode, + ); + continue; + } // Ensure they are named correctly. + + validateName(context, directive); // TODO: Ensure proper locations. + // Ensure the arguments are valid. + + for (const arg of directive.args) { + // Ensure they are named correctly. + validateName(context, arg); // Ensure the type is an input type. + + if (!(0, _definition.isInputType)(arg.type)) { + context.reportError( + `The type of @${directive.name}(${arg.name}:) must be Input Type ` + + `but got: ${(0, _inspect.inspect)(arg.type)}.`, + arg.astNode, + ); + } + + if ( + (0, _definition.isRequiredArgument)(arg) && + arg.deprecationReason != null + ) { + var _arg$astNode; + + context.reportError( + `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 + ? void 0 + : _arg$astNode.type, + ], + ); + } + } + } +} + +function validateName(context, node) { + // Ensure names are valid, however introspection types opt out. + if (node.name.startsWith('__')) { + context.reportError( + `Name "${node.name}" must not begin with "__", which is reserved by GraphQL introspection.`, + node.astNode, + ); + } +} + +function validateTypes(context) { + const validateInputObjectCircularRefs = + createInputObjectCircularRefsValidator(context); + const typeMap = context.schema.getTypeMap(); + + for (const type of Object.values(typeMap)) { + // Ensure all provided types are in fact GraphQL type. + if (!(0, _definition.isNamedType)(type)) { + context.reportError( + `Expected GraphQL named type but got: ${(0, _inspect.inspect)(type)}.`, + type.astNode, + ); + continue; + } // Ensure it is named correctly (excluding introspection types). + + if (!(0, _introspection.isIntrospectionType)(type)) { + validateName(context, type); + } + + if ((0, _definition.isObjectType)(type)) { + // Ensure fields are valid + validateFields(context, type); // Ensure objects implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if ((0, _definition.isInterfaceType)(type)) { + // Ensure fields are valid. + validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if ((0, _definition.isUnionType)(type)) { + // Ensure Unions include valid member types. + validateUnionMembers(context, type); + } else if ((0, _definition.isEnumType)(type)) { + // Ensure Enums have valid values. + validateEnumValues(context, type); + } else if ((0, _definition.isInputObjectType)(type)) { + // Ensure Input Object fields are valid. + validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references + + validateInputObjectCircularRefs(type); + } + } +} + +function validateFields(context, type) { + const fields = Object.values(type.getFields()); // Objects and Interfaces both must define one or more fields. + + if (fields.length === 0) { + context.reportError(`Type ${type.name} must define one or more fields.`, [ + type.astNode, + ...type.extensionASTNodes, + ]); + } + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an output type + + if (!(0, _definition.isOutputType)(field.type)) { + var _field$astNode; + + context.reportError( + `The type of ${type.name}.${field.name} must be Output Type ` + + `but got: ${(0, _inspect.inspect)(field.type)}.`, + (_field$astNode = field.astNode) === null || _field$astNode === void 0 + ? void 0 + : _field$astNode.type, + ); + } // Ensure the arguments are valid + + for (const arg of field.args) { + const argName = arg.name; // Ensure they are named correctly. + + validateName(context, arg); // Ensure the type is an input type + + if (!(0, _definition.isInputType)(arg.type)) { + var _arg$astNode2; + + context.reportError( + `The type of ${type.name}.${field.name}(${argName}:) must be Input ` + + `Type but got: ${(0, _inspect.inspect)(arg.type)}.`, + (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 + ? void 0 + : _arg$astNode2.type, + ); + } + + if ( + (0, _definition.isRequiredArgument)(arg) && + arg.deprecationReason != null + ) { + var _arg$astNode3; + + context.reportError( + `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 + ? void 0 + : _arg$astNode3.type, + ], + ); + } + } + } +} + +function validateInterfaces(context, type) { + const ifaceTypeNames = Object.create(null); + + for (const iface of type.getInterfaces()) { + if (!(0, _definition.isInterfaceType)(iface)) { + context.reportError( + `Type ${(0, _inspect.inspect)( + type, + )} must only implement Interface types, ` + + `it cannot implement ${(0, _inspect.inspect)(iface)}.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (type === iface) { + context.reportError( + `Type ${type.name} cannot implement itself because it would create a circular reference.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (ifaceTypeNames[iface.name]) { + context.reportError( + `Type ${type.name} can only implement ${iface.name} once.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + ifaceTypeNames[iface.name] = true; + validateTypeImplementsAncestors(context, type, iface); + validateTypeImplementsInterface(context, type, iface); + } +} + +function validateTypeImplementsInterface(context, type, iface) { + const typeFieldMap = type.getFields(); // Assert each interface field is implemented. + + for (const ifaceField of Object.values(iface.getFields())) { + const fieldName = ifaceField.name; + const typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. + + if (!typeField) { + context.reportError( + `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, + [ifaceField.astNode, type.astNode, ...type.extensionASTNodes], + ); + continue; + } // Assert interface field type is satisfied by type field type, by being + // a valid subtype. (covariant) + + if ( + !(0, _typeComparators.isTypeSubTypeOf)( + context.schema, + typeField.type, + ifaceField.type, + ) + ) { + var _ifaceField$astNode, _typeField$astNode; + + context.reportError( + `Interface field ${iface.name}.${fieldName} expects type ` + + `${(0, _inspect.inspect)(ifaceField.type)} but ${ + type.name + }.${fieldName} ` + + `is type ${(0, _inspect.inspect)(typeField.type)}.`, + [ + (_ifaceField$astNode = ifaceField.astNode) === null || + _ifaceField$astNode === void 0 + ? void 0 + : _ifaceField$astNode.type, + (_typeField$astNode = typeField.astNode) === null || + _typeField$astNode === void 0 + ? void 0 + : _typeField$astNode.type, + ], + ); + } // Assert each interface field arg is implemented. + + for (const ifaceArg of ifaceField.args) { + const argName = ifaceArg.name; + const typeArg = typeField.args.find((arg) => arg.name === argName); // Assert interface field arg exists on object field. + + if (!typeArg) { + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, + [ifaceArg.astNode, typeField.astNode], + ); + continue; + } // Assert interface field arg type matches object field arg type. + // (invariant) + // TODO: change to contravariant? + + if (!(0, _typeComparators.isEqualType)(ifaceArg.type, typeArg.type)) { + var _ifaceArg$astNode, _typeArg$astNode; + + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + + `expects type ${(0, _inspect.inspect)(ifaceArg.type)} but ` + + `${type.name}.${fieldName}(${argName}:) is type ` + + `${(0, _inspect.inspect)(typeArg.type)}.`, + [ + (_ifaceArg$astNode = ifaceArg.astNode) === null || + _ifaceArg$astNode === void 0 + ? void 0 + : _ifaceArg$astNode.type, + (_typeArg$astNode = typeArg.astNode) === null || + _typeArg$astNode === void 0 + ? void 0 + : _typeArg$astNode.type, + ], + ); + } // TODO: validate default values? + } // Assert additional arguments must not be required. + + for (const typeArg of typeField.args) { + const argName = typeArg.name; + const ifaceArg = ifaceField.args.find((arg) => arg.name === argName); + + if (!ifaceArg && (0, _definition.isRequiredArgument)(typeArg)) { + context.reportError( + `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, + [typeArg.astNode, ifaceField.astNode], + ); + } + } + } +} + +function validateTypeImplementsAncestors(context, type, iface) { + const ifaceInterfaces = type.getInterfaces(); + + for (const transitive of iface.getInterfaces()) { + if (!ifaceInterfaces.includes(transitive)) { + context.reportError( + transitive === type + ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.` + : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`, + [ + ...getAllImplementsInterfaceNodes(iface, transitive), + ...getAllImplementsInterfaceNodes(type, iface), + ], + ); + } + } +} + +function validateUnionMembers(context, union) { + const memberTypes = union.getTypes(); + + if (memberTypes.length === 0) { + context.reportError( + `Union type ${union.name} must define one or more member types.`, + [union.astNode, ...union.extensionASTNodes], + ); + } + + const includedTypeNames = Object.create(null); + + for (const memberType of memberTypes) { + if (includedTypeNames[memberType.name]) { + context.reportError( + `Union type ${union.name} can only include type ${memberType.name} once.`, + getUnionMemberTypeNodes(union, memberType.name), + ); + continue; + } + + includedTypeNames[memberType.name] = true; + + if (!(0, _definition.isObjectType)(memberType)) { + context.reportError( + `Union type ${union.name} can only include Object types, ` + + `it cannot include ${(0, _inspect.inspect)(memberType)}.`, + getUnionMemberTypeNodes(union, String(memberType)), + ); + } + } +} + +function validateEnumValues(context, enumType) { + const enumValues = enumType.getValues(); + + if (enumValues.length === 0) { + context.reportError( + `Enum type ${enumType.name} must define one or more values.`, + [enumType.astNode, ...enumType.extensionASTNodes], + ); + } + + for (const enumValue of enumValues) { + // Ensure valid name. + validateName(context, enumValue); + } +} + +function validateInputFields(context, inputObj) { + const fields = Object.values(inputObj.getFields()); + + if (fields.length === 0) { + context.reportError( + `Input Object type ${inputObj.name} must define one or more fields.`, + [inputObj.astNode, ...inputObj.extensionASTNodes], + ); + } // Ensure the arguments are valid + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an input type + + if (!(0, _definition.isInputType)(field.type)) { + var _field$astNode2; + + context.reportError( + `The type of ${inputObj.name}.${field.name} must be Input Type ` + + `but got: ${(0, _inspect.inspect)(field.type)}.`, + (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 + ? void 0 + : _field$astNode2.type, + ); + } + + if ( + (0, _definition.isRequiredInputField)(field) && + field.deprecationReason != null + ) { + var _field$astNode3; + + context.reportError( + `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(field.astNode), + (_field$astNode3 = field.astNode) === null || + _field$astNode3 === void 0 + ? void 0 + : _field$astNode3.type, + ], + ); + } + } +} + +function createInputObjectCircularRefsValidator(context) { + // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. + // Tracks already visited types to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors + + const fieldPath = []; // Position in the type path + + const fieldPathIndexByTypeName = Object.create(null); + return detectCycleRecursive; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(inputObj) { + if (visitedTypes[inputObj.name]) { + return; + } + + visitedTypes[inputObj.name] = true; + fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; + const fields = Object.values(inputObj.getFields()); + + for (const field of fields) { + if ( + (0, _definition.isNonNullType)(field.type) && + (0, _definition.isInputObjectType)(field.type.ofType) + ) { + const fieldType = field.type.ofType; + const cycleIndex = fieldPathIndexByTypeName[fieldType.name]; + fieldPath.push(field); + + if (cycleIndex === undefined) { + detectCycleRecursive(fieldType); + } else { + const cyclePath = fieldPath.slice(cycleIndex); + const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join('.'); + context.reportError( + `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, + cyclePath.map((fieldObj) => fieldObj.astNode), + ); + } + + fieldPath.pop(); + } + } + + fieldPathIndexByTypeName[inputObj.name] = undefined; + } +} + +function getAllImplementsInterfaceNodes(type, iface) { + const { astNode, extensionASTNodes } = type; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((typeNode) => { + var _typeNode$interfaces; + + return ( + /* c8 ignore next */ + (_typeNode$interfaces = typeNode.interfaces) !== null && + _typeNode$interfaces !== void 0 + ? _typeNode$interfaces + : [] + ); + }) + .filter((ifaceNode) => ifaceNode.name.value === iface.name); +} + +function getUnionMemberTypeNodes(union, typeName) { + const { astNode, extensionASTNodes } = union; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((unionNode) => { + var _unionNode$types; + + return ( + /* c8 ignore next */ + (_unionNode$types = unionNode.types) !== null && + _unionNode$types !== void 0 + ? _unionNode$types + : [] + ); + }) + .filter((typeNode) => typeNode.name.value === typeName); +} + +function getDeprecatedDirectiveNode(definitionNode) { + var _definitionNode$direc; + + return definitionNode === null || definitionNode === void 0 + ? void 0 + : (_definitionNode$direc = definitionNode.directives) === null || + _definitionNode$direc === void 0 + ? void 0 + : _definitionNode$direc.find( + (node) => + node.name.value === _directives.GraphQLDeprecatedDirective.name, + ); +} diff --git a/graphql-subscription/node_modules/graphql/type/validate.mjs b/graphql-subscription/node_modules/graphql/type/validate.mjs new file mode 100644 index 0000000..5792c26 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/type/validate.mjs @@ -0,0 +1,651 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { OperationTypeNode } from '../language/ast.mjs'; +import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators.mjs'; +import { + isEnumType, + isInputObjectType, + isInputType, + isInterfaceType, + isNamedType, + isNonNullType, + isObjectType, + isOutputType, + isRequiredArgument, + isRequiredInputField, + isUnionType, +} from './definition.mjs'; +import { GraphQLDeprecatedDirective, isDirective } from './directives.mjs'; +import { isIntrospectionType } from './introspection.mjs'; +import { assertSchema } from './schema.mjs'; +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ + +export function validateSchema(schema) { + // First check to ensure the provided value is in fact a GraphQLSchema. + assertSchema(schema); // If this Schema has already been validated, return the previous results. + + if (schema.__validationErrors) { + return schema.__validationErrors; + } // Validate the schema, producing a list of errors. + + const context = new SchemaValidationContext(schema); + validateRootTypes(context); + validateDirectives(context); + validateTypes(context); // Persist the results of validation before returning to ensure validation + // does not run multiple times for this schema. + + const errors = context.getErrors(); + schema.__validationErrors = errors; + return errors; +} +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ + +export function assertValidSchema(schema) { + const errors = validateSchema(schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} + +class SchemaValidationContext { + constructor(schema) { + this._errors = []; + this.schema = schema; + } + + reportError(message, nodes) { + const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes; + + this._errors.push( + new GraphQLError(message, { + nodes: _nodes, + }), + ); + } + + getErrors() { + return this._errors; + } +} + +function validateRootTypes(context) { + const schema = context.schema; + const queryType = schema.getQueryType(); + + if (!queryType) { + context.reportError('Query root type must be provided.', schema.astNode); + } else if (!isObjectType(queryType)) { + var _getOperationTypeNode; + + context.reportError( + `Query root type must be Object type, it cannot be ${inspect( + queryType, + )}.`, + (_getOperationTypeNode = getOperationTypeNode( + schema, + OperationTypeNode.QUERY, + )) !== null && _getOperationTypeNode !== void 0 + ? _getOperationTypeNode + : queryType.astNode, + ); + } + + const mutationType = schema.getMutationType(); + + if (mutationType && !isObjectType(mutationType)) { + var _getOperationTypeNode2; + + context.reportError( + 'Mutation root type must be Object type if provided, it cannot be ' + + `${inspect(mutationType)}.`, + (_getOperationTypeNode2 = getOperationTypeNode( + schema, + OperationTypeNode.MUTATION, + )) !== null && _getOperationTypeNode2 !== void 0 + ? _getOperationTypeNode2 + : mutationType.astNode, + ); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && !isObjectType(subscriptionType)) { + var _getOperationTypeNode3; + + context.reportError( + 'Subscription root type must be Object type if provided, it cannot be ' + + `${inspect(subscriptionType)}.`, + (_getOperationTypeNode3 = getOperationTypeNode( + schema, + OperationTypeNode.SUBSCRIPTION, + )) !== null && _getOperationTypeNode3 !== void 0 + ? _getOperationTypeNode3 + : subscriptionType.astNode, + ); + } +} + +function getOperationTypeNode(schema, operation) { + var _flatMap$find; + + return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes] + .flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (schemaNode) => { + var _schemaNode$operation; + + return ( + /* c8 ignore next */ + (_schemaNode$operation = + schemaNode === null || schemaNode === void 0 + ? void 0 + : schemaNode.operationTypes) !== null && + _schemaNode$operation !== void 0 + ? _schemaNode$operation + : [] + ); + }, + ) + .find((operationNode) => operationNode.operation === operation)) === null || + _flatMap$find === void 0 + ? void 0 + : _flatMap$find.type; +} + +function validateDirectives(context) { + for (const directive of context.schema.getDirectives()) { + // Ensure all directives are in fact GraphQL directives. + if (!isDirective(directive)) { + context.reportError( + `Expected directive but got: ${inspect(directive)}.`, + directive === null || directive === void 0 ? void 0 : directive.astNode, + ); + continue; + } // Ensure they are named correctly. + + validateName(context, directive); // TODO: Ensure proper locations. + // Ensure the arguments are valid. + + for (const arg of directive.args) { + // Ensure they are named correctly. + validateName(context, arg); // Ensure the type is an input type. + + if (!isInputType(arg.type)) { + context.reportError( + `The type of @${directive.name}(${arg.name}:) must be Input Type ` + + `but got: ${inspect(arg.type)}.`, + arg.astNode, + ); + } + + if (isRequiredArgument(arg) && arg.deprecationReason != null) { + var _arg$astNode; + + context.reportError( + `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 + ? void 0 + : _arg$astNode.type, + ], + ); + } + } + } +} + +function validateName(context, node) { + // Ensure names are valid, however introspection types opt out. + if (node.name.startsWith('__')) { + context.reportError( + `Name "${node.name}" must not begin with "__", which is reserved by GraphQL introspection.`, + node.astNode, + ); + } +} + +function validateTypes(context) { + const validateInputObjectCircularRefs = + createInputObjectCircularRefsValidator(context); + const typeMap = context.schema.getTypeMap(); + + for (const type of Object.values(typeMap)) { + // Ensure all provided types are in fact GraphQL type. + if (!isNamedType(type)) { + context.reportError( + `Expected GraphQL named type but got: ${inspect(type)}.`, + type.astNode, + ); + continue; + } // Ensure it is named correctly (excluding introspection types). + + if (!isIntrospectionType(type)) { + validateName(context, type); + } + + if (isObjectType(type)) { + // Ensure fields are valid + validateFields(context, type); // Ensure objects implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if (isInterfaceType(type)) { + // Ensure fields are valid. + validateFields(context, type); // Ensure interfaces implement the interfaces they claim to. + + validateInterfaces(context, type); + } else if (isUnionType(type)) { + // Ensure Unions include valid member types. + validateUnionMembers(context, type); + } else if (isEnumType(type)) { + // Ensure Enums have valid values. + validateEnumValues(context, type); + } else if (isInputObjectType(type)) { + // Ensure Input Object fields are valid. + validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references + + validateInputObjectCircularRefs(type); + } + } +} + +function validateFields(context, type) { + const fields = Object.values(type.getFields()); // Objects and Interfaces both must define one or more fields. + + if (fields.length === 0) { + context.reportError(`Type ${type.name} must define one or more fields.`, [ + type.astNode, + ...type.extensionASTNodes, + ]); + } + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an output type + + if (!isOutputType(field.type)) { + var _field$astNode; + + context.reportError( + `The type of ${type.name}.${field.name} must be Output Type ` + + `but got: ${inspect(field.type)}.`, + (_field$astNode = field.astNode) === null || _field$astNode === void 0 + ? void 0 + : _field$astNode.type, + ); + } // Ensure the arguments are valid + + for (const arg of field.args) { + const argName = arg.name; // Ensure they are named correctly. + + validateName(context, arg); // Ensure the type is an input type + + if (!isInputType(arg.type)) { + var _arg$astNode2; + + context.reportError( + `The type of ${type.name}.${field.name}(${argName}:) must be Input ` + + `Type but got: ${inspect(arg.type)}.`, + (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 + ? void 0 + : _arg$astNode2.type, + ); + } + + if (isRequiredArgument(arg) && arg.deprecationReason != null) { + var _arg$astNode3; + + context.reportError( + `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(arg.astNode), + (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 + ? void 0 + : _arg$astNode3.type, + ], + ); + } + } + } +} + +function validateInterfaces(context, type) { + const ifaceTypeNames = Object.create(null); + + for (const iface of type.getInterfaces()) { + if (!isInterfaceType(iface)) { + context.reportError( + `Type ${inspect(type)} must only implement Interface types, ` + + `it cannot implement ${inspect(iface)}.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (type === iface) { + context.reportError( + `Type ${type.name} cannot implement itself because it would create a circular reference.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (ifaceTypeNames[iface.name]) { + context.reportError( + `Type ${type.name} can only implement ${iface.name} once.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + ifaceTypeNames[iface.name] = true; + validateTypeImplementsAncestors(context, type, iface); + validateTypeImplementsInterface(context, type, iface); + } +} + +function validateTypeImplementsInterface(context, type, iface) { + const typeFieldMap = type.getFields(); // Assert each interface field is implemented. + + for (const ifaceField of Object.values(iface.getFields())) { + const fieldName = ifaceField.name; + const typeField = typeFieldMap[fieldName]; // Assert interface field exists on type. + + if (!typeField) { + context.reportError( + `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, + [ifaceField.astNode, type.astNode, ...type.extensionASTNodes], + ); + continue; + } // Assert interface field type is satisfied by type field type, by being + // a valid subtype. (covariant) + + if (!isTypeSubTypeOf(context.schema, typeField.type, ifaceField.type)) { + var _ifaceField$astNode, _typeField$astNode; + + context.reportError( + `Interface field ${iface.name}.${fieldName} expects type ` + + `${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` + + `is type ${inspect(typeField.type)}.`, + [ + (_ifaceField$astNode = ifaceField.astNode) === null || + _ifaceField$astNode === void 0 + ? void 0 + : _ifaceField$astNode.type, + (_typeField$astNode = typeField.astNode) === null || + _typeField$astNode === void 0 + ? void 0 + : _typeField$astNode.type, + ], + ); + } // Assert each interface field arg is implemented. + + for (const ifaceArg of ifaceField.args) { + const argName = ifaceArg.name; + const typeArg = typeField.args.find((arg) => arg.name === argName); // Assert interface field arg exists on object field. + + if (!typeArg) { + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, + [ifaceArg.astNode, typeField.astNode], + ); + continue; + } // Assert interface field arg type matches object field arg type. + // (invariant) + // TODO: change to contravariant? + + if (!isEqualType(ifaceArg.type, typeArg.type)) { + var _ifaceArg$astNode, _typeArg$astNode; + + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + + `expects type ${inspect(ifaceArg.type)} but ` + + `${type.name}.${fieldName}(${argName}:) is type ` + + `${inspect(typeArg.type)}.`, + [ + (_ifaceArg$astNode = ifaceArg.astNode) === null || + _ifaceArg$astNode === void 0 + ? void 0 + : _ifaceArg$astNode.type, + (_typeArg$astNode = typeArg.astNode) === null || + _typeArg$astNode === void 0 + ? void 0 + : _typeArg$astNode.type, + ], + ); + } // TODO: validate default values? + } // Assert additional arguments must not be required. + + for (const typeArg of typeField.args) { + const argName = typeArg.name; + const ifaceArg = ifaceField.args.find((arg) => arg.name === argName); + + if (!ifaceArg && isRequiredArgument(typeArg)) { + context.reportError( + `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, + [typeArg.astNode, ifaceField.astNode], + ); + } + } + } +} + +function validateTypeImplementsAncestors(context, type, iface) { + const ifaceInterfaces = type.getInterfaces(); + + for (const transitive of iface.getInterfaces()) { + if (!ifaceInterfaces.includes(transitive)) { + context.reportError( + transitive === type + ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.` + : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`, + [ + ...getAllImplementsInterfaceNodes(iface, transitive), + ...getAllImplementsInterfaceNodes(type, iface), + ], + ); + } + } +} + +function validateUnionMembers(context, union) { + const memberTypes = union.getTypes(); + + if (memberTypes.length === 0) { + context.reportError( + `Union type ${union.name} must define one or more member types.`, + [union.astNode, ...union.extensionASTNodes], + ); + } + + const includedTypeNames = Object.create(null); + + for (const memberType of memberTypes) { + if (includedTypeNames[memberType.name]) { + context.reportError( + `Union type ${union.name} can only include type ${memberType.name} once.`, + getUnionMemberTypeNodes(union, memberType.name), + ); + continue; + } + + includedTypeNames[memberType.name] = true; + + if (!isObjectType(memberType)) { + context.reportError( + `Union type ${union.name} can only include Object types, ` + + `it cannot include ${inspect(memberType)}.`, + getUnionMemberTypeNodes(union, String(memberType)), + ); + } + } +} + +function validateEnumValues(context, enumType) { + const enumValues = enumType.getValues(); + + if (enumValues.length === 0) { + context.reportError( + `Enum type ${enumType.name} must define one or more values.`, + [enumType.astNode, ...enumType.extensionASTNodes], + ); + } + + for (const enumValue of enumValues) { + // Ensure valid name. + validateName(context, enumValue); + } +} + +function validateInputFields(context, inputObj) { + const fields = Object.values(inputObj.getFields()); + + if (fields.length === 0) { + context.reportError( + `Input Object type ${inputObj.name} must define one or more fields.`, + [inputObj.astNode, ...inputObj.extensionASTNodes], + ); + } // Ensure the arguments are valid + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); // Ensure the type is an input type + + if (!isInputType(field.type)) { + var _field$astNode2; + + context.reportError( + `The type of ${inputObj.name}.${field.name} must be Input Type ` + + `but got: ${inspect(field.type)}.`, + (_field$astNode2 = field.astNode) === null || _field$astNode2 === void 0 + ? void 0 + : _field$astNode2.type, + ); + } + + if (isRequiredInputField(field) && field.deprecationReason != null) { + var _field$astNode3; + + context.reportError( + `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`, + [ + getDeprecatedDirectiveNode(field.astNode), + (_field$astNode3 = field.astNode) === null || + _field$astNode3 === void 0 + ? void 0 + : _field$astNode3.type, + ], + ); + } + } +} + +function createInputObjectCircularRefsValidator(context) { + // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. + // Tracks already visited types to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedTypes = Object.create(null); // Array of types nodes used to produce meaningful errors + + const fieldPath = []; // Position in the type path + + const fieldPathIndexByTypeName = Object.create(null); + return detectCycleRecursive; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(inputObj) { + if (visitedTypes[inputObj.name]) { + return; + } + + visitedTypes[inputObj.name] = true; + fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; + const fields = Object.values(inputObj.getFields()); + + for (const field of fields) { + if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) { + const fieldType = field.type.ofType; + const cycleIndex = fieldPathIndexByTypeName[fieldType.name]; + fieldPath.push(field); + + if (cycleIndex === undefined) { + detectCycleRecursive(fieldType); + } else { + const cyclePath = fieldPath.slice(cycleIndex); + const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join('.'); + context.reportError( + `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, + cyclePath.map((fieldObj) => fieldObj.astNode), + ); + } + + fieldPath.pop(); + } + } + + fieldPathIndexByTypeName[inputObj.name] = undefined; + } +} + +function getAllImplementsInterfaceNodes(type, iface) { + const { astNode, extensionASTNodes } = type; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((typeNode) => { + var _typeNode$interfaces; + + return ( + /* c8 ignore next */ + (_typeNode$interfaces = typeNode.interfaces) !== null && + _typeNode$interfaces !== void 0 + ? _typeNode$interfaces + : [] + ); + }) + .filter((ifaceNode) => ifaceNode.name.value === iface.name); +} + +function getUnionMemberTypeNodes(union, typeName) { + const { astNode, extensionASTNodes } = union; + const nodes = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + return nodes + .flatMap((unionNode) => { + var _unionNode$types; + + return ( + /* c8 ignore next */ + (_unionNode$types = unionNode.types) !== null && + _unionNode$types !== void 0 + ? _unionNode$types + : [] + ); + }) + .filter((typeNode) => typeNode.name.value === typeName); +} + +function getDeprecatedDirectiveNode(definitionNode) { + var _definitionNode$direc; + + return definitionNode === null || definitionNode === void 0 + ? void 0 + : (_definitionNode$direc = definitionNode.directives) === null || + _definitionNode$direc === void 0 + ? void 0 + : _definitionNode$direc.find( + (node) => node.name.value === GraphQLDeprecatedDirective.name, + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/TypeInfo.d.ts b/graphql-subscription/node_modules/graphql/utilities/TypeInfo.d.ts new file mode 100644 index 0000000..78e2402 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/TypeInfo.d.ts @@ -0,0 +1,67 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ASTNode, FieldNode } from '../language/ast'; +import type { ASTVisitor } from '../language/visitor'; +import type { + GraphQLArgument, + GraphQLCompositeType, + GraphQLEnumValue, + GraphQLField, + GraphQLInputType, + GraphQLOutputType, + GraphQLType, +} from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ +export declare class TypeInfo { + private _schema; + private _typeStack; + private _parentTypeStack; + private _inputTypeStack; + private _fieldDefStack; + private _defaultValueStack; + private _directive; + private _argument; + private _enumValue; + private _getFieldDef; + constructor( + schema: GraphQLSchema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType?: Maybe, + /** @deprecated will be removed in 17.0.0 */ + getFieldDefFn?: GetFieldDefFn, + ); + get [Symbol.toStringTag](): string; + getType(): Maybe; + getParentType(): Maybe; + getInputType(): Maybe; + getParentInputType(): Maybe; + getFieldDef(): Maybe>; + getDefaultValue(): Maybe; + getDirective(): Maybe; + getArgument(): Maybe; + getEnumValue(): Maybe; + enter(node: ASTNode): void; + leave(node: ASTNode): void; +} +declare type GetFieldDefFn = ( + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode, +) => Maybe>; +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ +export declare function visitWithTypeInfo( + typeInfo: TypeInfo, + visitor: ASTVisitor, +): ASTVisitor; +export {}; diff --git a/graphql-subscription/node_modules/graphql/utilities/TypeInfo.js b/graphql-subscription/node_modules/graphql/utilities/TypeInfo.js new file mode 100644 index 0000000..d15bc2c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/TypeInfo.js @@ -0,0 +1,418 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.TypeInfo = void 0; +exports.visitWithTypeInfo = visitWithTypeInfo; + +var _ast = require('../language/ast.js'); + +var _kinds = require('../language/kinds.js'); + +var _visitor = require('../language/visitor.js'); + +var _definition = require('../type/definition.js'); + +var _introspection = require('../type/introspection.js'); + +var _typeFromAST = require('./typeFromAST.js'); + +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ +class TypeInfo { + constructor( + schema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType, + /** @deprecated will be removed in 17.0.0 */ + getFieldDefFn, + ) { + this._schema = schema; + this._typeStack = []; + this._parentTypeStack = []; + this._inputTypeStack = []; + this._fieldDefStack = []; + this._defaultValueStack = []; + this._directive = null; + this._argument = null; + this._enumValue = null; + this._getFieldDef = + getFieldDefFn !== null && getFieldDefFn !== void 0 + ? getFieldDefFn + : getFieldDef; + + if (initialType) { + if ((0, _definition.isInputType)(initialType)) { + this._inputTypeStack.push(initialType); + } + + if ((0, _definition.isCompositeType)(initialType)) { + this._parentTypeStack.push(initialType); + } + + if ((0, _definition.isOutputType)(initialType)) { + this._typeStack.push(initialType); + } + } + } + + get [Symbol.toStringTag]() { + return 'TypeInfo'; + } + + getType() { + if (this._typeStack.length > 0) { + return this._typeStack[this._typeStack.length - 1]; + } + } + + getParentType() { + if (this._parentTypeStack.length > 0) { + return this._parentTypeStack[this._parentTypeStack.length - 1]; + } + } + + getInputType() { + if (this._inputTypeStack.length > 0) { + return this._inputTypeStack[this._inputTypeStack.length - 1]; + } + } + + getParentInputType() { + if (this._inputTypeStack.length > 1) { + return this._inputTypeStack[this._inputTypeStack.length - 2]; + } + } + + getFieldDef() { + if (this._fieldDefStack.length > 0) { + return this._fieldDefStack[this._fieldDefStack.length - 1]; + } + } + + getDefaultValue() { + if (this._defaultValueStack.length > 0) { + return this._defaultValueStack[this._defaultValueStack.length - 1]; + } + } + + getDirective() { + return this._directive; + } + + getArgument() { + return this._argument; + } + + getEnumValue() { + return this._enumValue; + } + + enter(node) { + const schema = this._schema; // Note: many of the types below are explicitly typed as "unknown" to drop + // any assumptions of a valid schema to ensure runtime types are properly + // checked before continuing since TypeInfo is used as part of validation + // which occurs before guarantees of schema and document validity. + + switch (node.kind) { + case _kinds.Kind.SELECTION_SET: { + const namedType = (0, _definition.getNamedType)(this.getType()); + + this._parentTypeStack.push( + (0, _definition.isCompositeType)(namedType) ? namedType : undefined, + ); + + break; + } + + case _kinds.Kind.FIELD: { + const parentType = this.getParentType(); + let fieldDef; + let fieldType; + + if (parentType) { + fieldDef = this._getFieldDef(schema, parentType, node); + + if (fieldDef) { + fieldType = fieldDef.type; + } + } + + this._fieldDefStack.push(fieldDef); + + this._typeStack.push( + (0, _definition.isOutputType)(fieldType) ? fieldType : undefined, + ); + + break; + } + + case _kinds.Kind.DIRECTIVE: + this._directive = schema.getDirective(node.name.value); + break; + + case _kinds.Kind.OPERATION_DEFINITION: { + const rootType = schema.getRootType(node.operation); + + this._typeStack.push( + (0, _definition.isObjectType)(rootType) ? rootType : undefined, + ); + + break; + } + + case _kinds.Kind.INLINE_FRAGMENT: + case _kinds.Kind.FRAGMENT_DEFINITION: { + const typeConditionAST = node.typeCondition; + const outputType = typeConditionAST + ? (0, _typeFromAST.typeFromAST)(schema, typeConditionAST) + : (0, _definition.getNamedType)(this.getType()); + + this._typeStack.push( + (0, _definition.isOutputType)(outputType) ? outputType : undefined, + ); + + break; + } + + case _kinds.Kind.VARIABLE_DEFINITION: { + const inputType = (0, _typeFromAST.typeFromAST)(schema, node.type); + + this._inputTypeStack.push( + (0, _definition.isInputType)(inputType) ? inputType : undefined, + ); + + break; + } + + case _kinds.Kind.ARGUMENT: { + var _this$getDirective; + + let argDef; + let argType; + const fieldOrDirective = + (_this$getDirective = this.getDirective()) !== null && + _this$getDirective !== void 0 + ? _this$getDirective + : this.getFieldDef(); + + if (fieldOrDirective) { + argDef = fieldOrDirective.args.find( + (arg) => arg.name === node.name.value, + ); + + if (argDef) { + argType = argDef.type; + } + } + + this._argument = argDef; + + this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); + + this._inputTypeStack.push( + (0, _definition.isInputType)(argType) ? argType : undefined, + ); + + break; + } + + case _kinds.Kind.LIST: { + const listType = (0, _definition.getNullableType)(this.getInputType()); + const itemType = (0, _definition.isListType)(listType) + ? listType.ofType + : listType; // List positions never have a default value. + + this._defaultValueStack.push(undefined); + + this._inputTypeStack.push( + (0, _definition.isInputType)(itemType) ? itemType : undefined, + ); + + break; + } + + case _kinds.Kind.OBJECT_FIELD: { + const objectType = (0, _definition.getNamedType)(this.getInputType()); + let inputFieldType; + let inputField; + + if ((0, _definition.isInputObjectType)(objectType)) { + inputField = objectType.getFields()[node.name.value]; + + if (inputField) { + inputFieldType = inputField.type; + } + } + + this._defaultValueStack.push( + inputField ? inputField.defaultValue : undefined, + ); + + this._inputTypeStack.push( + (0, _definition.isInputType)(inputFieldType) + ? inputFieldType + : undefined, + ); + + break; + } + + case _kinds.Kind.ENUM: { + const enumType = (0, _definition.getNamedType)(this.getInputType()); + let enumValue; + + if ((0, _definition.isEnumType)(enumType)) { + enumValue = enumType.getValue(node.value); + } + + this._enumValue = enumValue; + break; + } + + default: // Ignore other nodes + } + } + + leave(node) { + switch (node.kind) { + case _kinds.Kind.SELECTION_SET: + this._parentTypeStack.pop(); + + break; + + case _kinds.Kind.FIELD: + this._fieldDefStack.pop(); + + this._typeStack.pop(); + + break; + + case _kinds.Kind.DIRECTIVE: + this._directive = null; + break; + + case _kinds.Kind.OPERATION_DEFINITION: + case _kinds.Kind.INLINE_FRAGMENT: + case _kinds.Kind.FRAGMENT_DEFINITION: + this._typeStack.pop(); + + break; + + case _kinds.Kind.VARIABLE_DEFINITION: + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.ARGUMENT: + this._argument = null; + + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.LIST: + case _kinds.Kind.OBJECT_FIELD: + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case _kinds.Kind.ENUM: + this._enumValue = null; + break; + + default: // Ignore other nodes + } + } +} + +exports.TypeInfo = TypeInfo; + +/** + * Not exactly the same as the executor's definition of getFieldDef, in this + * statically evaluated environment we do not always have an Object type, + * and need to handle Interface and Union types. + */ +function getFieldDef(schema, parentType, fieldNode) { + const name = fieldNode.name.value; + + if ( + name === _introspection.SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.SchemaMetaFieldDef; + } + + if ( + name === _introspection.TypeMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return _introspection.TypeMetaFieldDef; + } + + if ( + name === _introspection.TypeNameMetaFieldDef.name && + (0, _definition.isCompositeType)(parentType) + ) { + return _introspection.TypeNameMetaFieldDef; + } + + if ( + (0, _definition.isObjectType)(parentType) || + (0, _definition.isInterfaceType)(parentType) + ) { + return parentType.getFields()[name]; + } +} +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ + +function visitWithTypeInfo(typeInfo, visitor) { + return { + enter(...args) { + const node = args[0]; + typeInfo.enter(node); + const fn = (0, _visitor.getEnterLeaveForKind)(visitor, node.kind).enter; + + if (fn) { + const result = fn.apply(visitor, args); + + if (result !== undefined) { + typeInfo.leave(node); + + if ((0, _ast.isNode)(result)) { + typeInfo.enter(result); + } + } + + return result; + } + }, + + leave(...args) { + const node = args[0]; + const fn = (0, _visitor.getEnterLeaveForKind)(visitor, node.kind).leave; + let result; + + if (fn) { + result = fn.apply(visitor, args); + } + + typeInfo.leave(node); + return result; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/TypeInfo.mjs b/graphql-subscription/node_modules/graphql/utilities/TypeInfo.mjs new file mode 100644 index 0000000..4956e0f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/TypeInfo.mjs @@ -0,0 +1,395 @@ +import { isNode } from '../language/ast.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { getEnterLeaveForKind } from '../language/visitor.mjs'; +import { + getNamedType, + getNullableType, + isCompositeType, + isEnumType, + isInputObjectType, + isInputType, + isInterfaceType, + isListType, + isObjectType, + isOutputType, +} from '../type/definition.mjs'; +import { + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from '../type/introspection.mjs'; +import { typeFromAST } from './typeFromAST.mjs'; +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ + +export class TypeInfo { + constructor( + schema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType, + /** @deprecated will be removed in 17.0.0 */ + getFieldDefFn, + ) { + this._schema = schema; + this._typeStack = []; + this._parentTypeStack = []; + this._inputTypeStack = []; + this._fieldDefStack = []; + this._defaultValueStack = []; + this._directive = null; + this._argument = null; + this._enumValue = null; + this._getFieldDef = + getFieldDefFn !== null && getFieldDefFn !== void 0 + ? getFieldDefFn + : getFieldDef; + + if (initialType) { + if (isInputType(initialType)) { + this._inputTypeStack.push(initialType); + } + + if (isCompositeType(initialType)) { + this._parentTypeStack.push(initialType); + } + + if (isOutputType(initialType)) { + this._typeStack.push(initialType); + } + } + } + + get [Symbol.toStringTag]() { + return 'TypeInfo'; + } + + getType() { + if (this._typeStack.length > 0) { + return this._typeStack[this._typeStack.length - 1]; + } + } + + getParentType() { + if (this._parentTypeStack.length > 0) { + return this._parentTypeStack[this._parentTypeStack.length - 1]; + } + } + + getInputType() { + if (this._inputTypeStack.length > 0) { + return this._inputTypeStack[this._inputTypeStack.length - 1]; + } + } + + getParentInputType() { + if (this._inputTypeStack.length > 1) { + return this._inputTypeStack[this._inputTypeStack.length - 2]; + } + } + + getFieldDef() { + if (this._fieldDefStack.length > 0) { + return this._fieldDefStack[this._fieldDefStack.length - 1]; + } + } + + getDefaultValue() { + if (this._defaultValueStack.length > 0) { + return this._defaultValueStack[this._defaultValueStack.length - 1]; + } + } + + getDirective() { + return this._directive; + } + + getArgument() { + return this._argument; + } + + getEnumValue() { + return this._enumValue; + } + + enter(node) { + const schema = this._schema; // Note: many of the types below are explicitly typed as "unknown" to drop + // any assumptions of a valid schema to ensure runtime types are properly + // checked before continuing since TypeInfo is used as part of validation + // which occurs before guarantees of schema and document validity. + + switch (node.kind) { + case Kind.SELECTION_SET: { + const namedType = getNamedType(this.getType()); + + this._parentTypeStack.push( + isCompositeType(namedType) ? namedType : undefined, + ); + + break; + } + + case Kind.FIELD: { + const parentType = this.getParentType(); + let fieldDef; + let fieldType; + + if (parentType) { + fieldDef = this._getFieldDef(schema, parentType, node); + + if (fieldDef) { + fieldType = fieldDef.type; + } + } + + this._fieldDefStack.push(fieldDef); + + this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined); + + break; + } + + case Kind.DIRECTIVE: + this._directive = schema.getDirective(node.name.value); + break; + + case Kind.OPERATION_DEFINITION: { + const rootType = schema.getRootType(node.operation); + + this._typeStack.push(isObjectType(rootType) ? rootType : undefined); + + break; + } + + case Kind.INLINE_FRAGMENT: + case Kind.FRAGMENT_DEFINITION: { + const typeConditionAST = node.typeCondition; + const outputType = typeConditionAST + ? typeFromAST(schema, typeConditionAST) + : getNamedType(this.getType()); + + this._typeStack.push(isOutputType(outputType) ? outputType : undefined); + + break; + } + + case Kind.VARIABLE_DEFINITION: { + const inputType = typeFromAST(schema, node.type); + + this._inputTypeStack.push( + isInputType(inputType) ? inputType : undefined, + ); + + break; + } + + case Kind.ARGUMENT: { + var _this$getDirective; + + let argDef; + let argType; + const fieldOrDirective = + (_this$getDirective = this.getDirective()) !== null && + _this$getDirective !== void 0 + ? _this$getDirective + : this.getFieldDef(); + + if (fieldOrDirective) { + argDef = fieldOrDirective.args.find( + (arg) => arg.name === node.name.value, + ); + + if (argDef) { + argType = argDef.type; + } + } + + this._argument = argDef; + + this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); + + this._inputTypeStack.push(isInputType(argType) ? argType : undefined); + + break; + } + + case Kind.LIST: { + const listType = getNullableType(this.getInputType()); + const itemType = isListType(listType) ? listType.ofType : listType; // List positions never have a default value. + + this._defaultValueStack.push(undefined); + + this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined); + + break; + } + + case Kind.OBJECT_FIELD: { + const objectType = getNamedType(this.getInputType()); + let inputFieldType; + let inputField; + + if (isInputObjectType(objectType)) { + inputField = objectType.getFields()[node.name.value]; + + if (inputField) { + inputFieldType = inputField.type; + } + } + + this._defaultValueStack.push( + inputField ? inputField.defaultValue : undefined, + ); + + this._inputTypeStack.push( + isInputType(inputFieldType) ? inputFieldType : undefined, + ); + + break; + } + + case Kind.ENUM: { + const enumType = getNamedType(this.getInputType()); + let enumValue; + + if (isEnumType(enumType)) { + enumValue = enumType.getValue(node.value); + } + + this._enumValue = enumValue; + break; + } + + default: // Ignore other nodes + } + } + + leave(node) { + switch (node.kind) { + case Kind.SELECTION_SET: + this._parentTypeStack.pop(); + + break; + + case Kind.FIELD: + this._fieldDefStack.pop(); + + this._typeStack.pop(); + + break; + + case Kind.DIRECTIVE: + this._directive = null; + break; + + case Kind.OPERATION_DEFINITION: + case Kind.INLINE_FRAGMENT: + case Kind.FRAGMENT_DEFINITION: + this._typeStack.pop(); + + break; + + case Kind.VARIABLE_DEFINITION: + this._inputTypeStack.pop(); + + break; + + case Kind.ARGUMENT: + this._argument = null; + + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case Kind.LIST: + case Kind.OBJECT_FIELD: + this._defaultValueStack.pop(); + + this._inputTypeStack.pop(); + + break; + + case Kind.ENUM: + this._enumValue = null; + break; + + default: // Ignore other nodes + } + } +} + +/** + * Not exactly the same as the executor's definition of getFieldDef, in this + * statically evaluated environment we do not always have an Object type, + * and need to handle Interface and Union types. + */ +function getFieldDef(schema, parentType, fieldNode) { + const name = fieldNode.name.value; + + if ( + name === SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return SchemaMetaFieldDef; + } + + if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { + return TypeMetaFieldDef; + } + + if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) { + return TypeNameMetaFieldDef; + } + + if (isObjectType(parentType) || isInterfaceType(parentType)) { + return parentType.getFields()[name]; + } +} +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ + +export function visitWithTypeInfo(typeInfo, visitor) { + return { + enter(...args) { + const node = args[0]; + typeInfo.enter(node); + const fn = getEnterLeaveForKind(visitor, node.kind).enter; + + if (fn) { + const result = fn.apply(visitor, args); + + if (result !== undefined) { + typeInfo.leave(node); + + if (isNode(result)) { + typeInfo.enter(result); + } + } + + return result; + } + }, + + leave(...args) { + const node = args[0]; + const fn = getEnterLeaveForKind(visitor, node.kind).leave; + let result; + + if (fn) { + result = fn.apply(visitor, args); + } + + typeInfo.leave(node); + return result; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/assertValidName.d.ts b/graphql-subscription/node_modules/graphql/utilities/assertValidName.d.ts new file mode 100644 index 0000000..32f475b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/assertValidName.d.ts @@ -0,0 +1,13 @@ +import { GraphQLError } from '../error/GraphQLError'; +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +export declare function assertValidName(name: string): string; +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +export declare function isValidNameError( + name: string, +): GraphQLError | undefined; diff --git a/graphql-subscription/node_modules/graphql/utilities/assertValidName.js b/graphql-subscription/node_modules/graphql/utilities/assertValidName.js new file mode 100644 index 0000000..08e40a7 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/assertValidName.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidName = assertValidName; +exports.isValidNameError = isValidNameError; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _assertName = require('../type/assertName.js'); + +/* c8 ignore start */ + +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +function assertValidName(name) { + const error = isValidNameError(name); + + if (error) { + throw error; + } + + return name; +} +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +function isValidNameError(name) { + typeof name === 'string' || + (0, _devAssert.devAssert)(false, 'Expected name to be a string.'); + + if (name.startsWith('__')) { + return new _GraphQLError.GraphQLError( + `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, + ); + } + + try { + (0, _assertName.assertName)(name); + } catch (error) { + return error; + } +} +/* c8 ignore stop */ diff --git a/graphql-subscription/node_modules/graphql/utilities/assertValidName.mjs b/graphql-subscription/node_modules/graphql/utilities/assertValidName.mjs new file mode 100644 index 0000000..a313a72 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/assertValidName.mjs @@ -0,0 +1,40 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { assertName } from '../type/assertName.mjs'; +/* c8 ignore start */ + +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +export function assertValidName(name) { + const error = isValidNameError(name); + + if (error) { + throw error; + } + + return name; +} +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ + +export function isValidNameError(name) { + typeof name === 'string' || devAssert(false, 'Expected name to be a string.'); + + if (name.startsWith('__')) { + return new GraphQLError( + `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, + ); + } + + try { + assertName(name); + } catch (error) { + return error; + } +} +/* c8 ignore stop */ diff --git a/graphql-subscription/node_modules/graphql/utilities/astFromValue.d.ts b/graphql-subscription/node_modules/graphql/utilities/astFromValue.d.ts new file mode 100644 index 0000000..8b694e7 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/astFromValue.d.ts @@ -0,0 +1,28 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ValueNode } from '../language/ast'; +import type { GraphQLInputType } from '../type/definition'; +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Unknown | Enum Value | + * | null | NullValue | + * + */ +export declare function astFromValue( + value: unknown, + type: GraphQLInputType, +): Maybe; diff --git a/graphql-subscription/node_modules/graphql/utilities/astFromValue.js b/graphql-subscription/node_modules/graphql/utilities/astFromValue.js new file mode 100644 index 0000000..2e7fa61 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/astFromValue.js @@ -0,0 +1,190 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.astFromValue = astFromValue; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _isIterableObject = require('../jsutils/isIterableObject.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +var _scalars = require('../type/scalars.js'); + +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Unknown | Enum Value | + * | null | NullValue | + * + */ +function astFromValue(value, type) { + if ((0, _definition.isNonNullType)(type)) { + const astValue = astFromValue(value, type.ofType); + + if ( + (astValue === null || astValue === void 0 ? void 0 : astValue.kind) === + _kinds.Kind.NULL + ) { + return null; + } + + return astValue; + } // only explicit null, not undefined, NaN + + if (value === null) { + return { + kind: _kinds.Kind.NULL, + }; + } // undefined + + if (value === undefined) { + return null; + } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but + // the value is not an array, convert the value using the list's item type. + + if ((0, _definition.isListType)(type)) { + const itemType = type.ofType; + + if ((0, _isIterableObject.isIterableObject)(value)) { + const valuesNodes = []; + + for (const item of value) { + const itemNode = astFromValue(item, itemType); + + if (itemNode != null) { + valuesNodes.push(itemNode); + } + } + + return { + kind: _kinds.Kind.LIST, + values: valuesNodes, + }; + } + + return astFromValue(value, itemType); + } // Populate the fields of the input object by creating ASTs from each value + // in the JavaScript object according to the fields in the input type. + + if ((0, _definition.isInputObjectType)(type)) { + if (!(0, _isObjectLike.isObjectLike)(value)) { + return null; + } + + const fieldNodes = []; + + for (const field of Object.values(type.getFields())) { + const fieldValue = astFromValue(value[field.name], field.type); + + if (fieldValue) { + fieldNodes.push({ + kind: _kinds.Kind.OBJECT_FIELD, + name: { + kind: _kinds.Kind.NAME, + value: field.name, + }, + value: fieldValue, + }); + } + } + + return { + kind: _kinds.Kind.OBJECT, + fields: fieldNodes, + }; + } + + if ((0, _definition.isLeafType)(type)) { + // Since value is an internally represented value, it must be serialized + // to an externally represented value before converting into an AST. + const serialized = type.serialize(value); + + if (serialized == null) { + return null; + } // Others serialize based on their corresponding JavaScript scalar types. + + if (typeof serialized === 'boolean') { + return { + kind: _kinds.Kind.BOOLEAN, + value: serialized, + }; + } // JavaScript numbers can be Int or Float values. + + if (typeof serialized === 'number' && Number.isFinite(serialized)) { + const stringNum = String(serialized); + return integerStringRegExp.test(stringNum) + ? { + kind: _kinds.Kind.INT, + value: stringNum, + } + : { + kind: _kinds.Kind.FLOAT, + value: stringNum, + }; + } + + if (typeof serialized === 'string') { + // Enum types use Enum literals. + if ((0, _definition.isEnumType)(type)) { + return { + kind: _kinds.Kind.ENUM, + value: serialized, + }; + } // ID types can use Int literals. + + if (type === _scalars.GraphQLID && integerStringRegExp.test(serialized)) { + return { + kind: _kinds.Kind.INT, + value: serialized, + }; + } + + return { + kind: _kinds.Kind.STRING, + value: serialized, + }; + } + + throw new TypeError( + `Cannot convert value to AST: ${(0, _inspect.inspect)(serialized)}.`, + ); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected input type: ' + (0, _inspect.inspect)(type), + ); +} +/** + * IntValue: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit ( Digit+ )? + */ + +const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/graphql-subscription/node_modules/graphql/utilities/astFromValue.mjs b/graphql-subscription/node_modules/graphql/utilities/astFromValue.mjs new file mode 100644 index 0000000..9bdc1f8 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/astFromValue.mjs @@ -0,0 +1,177 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isIterableObject } from '../jsutils/isIterableObject.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isEnumType, + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition.mjs'; +import { GraphQLID } from '../type/scalars.mjs'; +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Unknown | Enum Value | + * | null | NullValue | + * + */ + +export function astFromValue(value, type) { + if (isNonNullType(type)) { + const astValue = astFromValue(value, type.ofType); + + if ( + (astValue === null || astValue === void 0 ? void 0 : astValue.kind) === + Kind.NULL + ) { + return null; + } + + return astValue; + } // only explicit null, not undefined, NaN + + if (value === null) { + return { + kind: Kind.NULL, + }; + } // undefined + + if (value === undefined) { + return null; + } // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but + // the value is not an array, convert the value using the list's item type. + + if (isListType(type)) { + const itemType = type.ofType; + + if (isIterableObject(value)) { + const valuesNodes = []; + + for (const item of value) { + const itemNode = astFromValue(item, itemType); + + if (itemNode != null) { + valuesNodes.push(itemNode); + } + } + + return { + kind: Kind.LIST, + values: valuesNodes, + }; + } + + return astFromValue(value, itemType); + } // Populate the fields of the input object by creating ASTs from each value + // in the JavaScript object according to the fields in the input type. + + if (isInputObjectType(type)) { + if (!isObjectLike(value)) { + return null; + } + + const fieldNodes = []; + + for (const field of Object.values(type.getFields())) { + const fieldValue = astFromValue(value[field.name], field.type); + + if (fieldValue) { + fieldNodes.push({ + kind: Kind.OBJECT_FIELD, + name: { + kind: Kind.NAME, + value: field.name, + }, + value: fieldValue, + }); + } + } + + return { + kind: Kind.OBJECT, + fields: fieldNodes, + }; + } + + if (isLeafType(type)) { + // Since value is an internally represented value, it must be serialized + // to an externally represented value before converting into an AST. + const serialized = type.serialize(value); + + if (serialized == null) { + return null; + } // Others serialize based on their corresponding JavaScript scalar types. + + if (typeof serialized === 'boolean') { + return { + kind: Kind.BOOLEAN, + value: serialized, + }; + } // JavaScript numbers can be Int or Float values. + + if (typeof serialized === 'number' && Number.isFinite(serialized)) { + const stringNum = String(serialized); + return integerStringRegExp.test(stringNum) + ? { + kind: Kind.INT, + value: stringNum, + } + : { + kind: Kind.FLOAT, + value: stringNum, + }; + } + + if (typeof serialized === 'string') { + // Enum types use Enum literals. + if (isEnumType(type)) { + return { + kind: Kind.ENUM, + value: serialized, + }; + } // ID types can use Int literals. + + if (type === GraphQLID && integerStringRegExp.test(serialized)) { + return { + kind: Kind.INT, + value: serialized, + }; + } + + return { + kind: Kind.STRING, + value: serialized, + }; + } + + throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected input type: ' + inspect(type)); +} +/** + * IntValue: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit ( Digit+ )? + */ + +const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.d.ts b/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.d.ts new file mode 100644 index 0000000..e972f80 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.d.ts @@ -0,0 +1,35 @@ +import type { DocumentNode } from '../language/ast'; +import type { ParseOptions } from '../language/parser'; +import type { Source } from '../language/source'; +import type { GraphQLSchemaValidationOptions } from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; +export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + */ + assumeValidSDL?: boolean; +} +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ +export declare function buildASTSchema( + documentAST: DocumentNode, + options?: BuildSchemaOptions, +): GraphQLSchema; +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ +export declare function buildSchema( + source: string | Source, + options?: BuildSchemaOptions & ParseOptions, +): GraphQLSchema; diff --git a/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.js b/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.js new file mode 100644 index 0000000..4684f80 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.js @@ -0,0 +1,115 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.buildASTSchema = buildASTSchema; +exports.buildSchema = buildSchema; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _kinds = require('../language/kinds.js'); + +var _parser = require('../language/parser.js'); + +var _directives = require('../type/directives.js'); + +var _schema = require('../type/schema.js'); + +var _validate = require('../validation/validate.js'); + +var _extendSchema = require('./extendSchema.js'); + +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ +function buildASTSchema(documentAST, options) { + (documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT) || + (0, _devAssert.devAssert)(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + (0, _validate.assertValidSDL)(documentAST); + } + + const emptySchemaConfig = { + description: undefined, + types: [], + directives: [], + extensions: Object.create(null), + extensionASTNodes: [], + assumeValid: false, + }; + const config = (0, _extendSchema.extendSchemaImpl)( + emptySchemaConfig, + documentAST, + options, + ); + + if (config.astNode == null) { + for (const type of config.types) { + switch (type.name) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + case 'Query': + // @ts-expect-error validated in `validateSchema` + config.query = type; + break; + + case 'Mutation': + // @ts-expect-error validated in `validateSchema` + config.mutation = type; + break; + + case 'Subscription': + // @ts-expect-error validated in `validateSchema` + config.subscription = type; + break; + } + } + } + + const directives = [ + ...config.directives, // If specified directives were not explicitly declared, add them. + ..._directives.specifiedDirectives.filter((stdDirective) => + config.directives.every( + (directive) => directive.name !== stdDirective.name, + ), + ), + ]; + return new _schema.GraphQLSchema({ ...config, directives }); +} +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ + +function buildSchema(source, options) { + const document = (0, _parser.parse)(source, { + noLocation: + options === null || options === void 0 ? void 0 : options.noLocation, + allowLegacyFragmentVariables: + options === null || options === void 0 + ? void 0 + : options.allowLegacyFragmentVariables, + }); + return buildASTSchema(document, { + assumeValidSDL: + options === null || options === void 0 ? void 0 : options.assumeValidSDL, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.mjs b/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.mjs new file mode 100644 index 0000000..f1fe080 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/buildASTSchema.mjs @@ -0,0 +1,97 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { parse } from '../language/parser.mjs'; +import { specifiedDirectives } from '../type/directives.mjs'; +import { GraphQLSchema } from '../type/schema.mjs'; +import { assertValidSDL } from '../validation/validate.mjs'; +import { extendSchemaImpl } from './extendSchema.mjs'; + +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ +export function buildASTSchema(documentAST, options) { + (documentAST != null && documentAST.kind === Kind.DOCUMENT) || + devAssert(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + assertValidSDL(documentAST); + } + + const emptySchemaConfig = { + description: undefined, + types: [], + directives: [], + extensions: Object.create(null), + extensionASTNodes: [], + assumeValid: false, + }; + const config = extendSchemaImpl(emptySchemaConfig, documentAST, options); + + if (config.astNode == null) { + for (const type of config.types) { + switch (type.name) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + case 'Query': + // @ts-expect-error validated in `validateSchema` + config.query = type; + break; + + case 'Mutation': + // @ts-expect-error validated in `validateSchema` + config.mutation = type; + break; + + case 'Subscription': + // @ts-expect-error validated in `validateSchema` + config.subscription = type; + break; + } + } + } + + const directives = [ + ...config.directives, // If specified directives were not explicitly declared, add them. + ...specifiedDirectives.filter((stdDirective) => + config.directives.every( + (directive) => directive.name !== stdDirective.name, + ), + ), + ]; + return new GraphQLSchema({ ...config, directives }); +} +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ + +export function buildSchema(source, options) { + const document = parse(source, { + noLocation: + options === null || options === void 0 ? void 0 : options.noLocation, + allowLegacyFragmentVariables: + options === null || options === void 0 + ? void 0 + : options.allowLegacyFragmentVariables, + }); + return buildASTSchema(document, { + assumeValidSDL: + options === null || options === void 0 ? void 0 : options.assumeValidSDL, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.d.ts b/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.d.ts new file mode 100644 index 0000000..fb66a8f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.d.ts @@ -0,0 +1,19 @@ +import type { GraphQLSchemaValidationOptions } from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; +import type { IntrospectionQuery } from './getIntrospectionQuery'; +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ +export declare function buildClientSchema( + introspection: IntrospectionQuery, + options?: GraphQLSchemaValidationOptions, +): GraphQLSchema; diff --git a/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.js b/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.js new file mode 100644 index 0000000..18a96c0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.js @@ -0,0 +1,386 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.buildClientSchema = buildClientSchema; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _parser = require('../language/parser.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _scalars = require('../type/scalars.js'); + +var _schema = require('../type/schema.js'); + +var _valueFromAST = require('./valueFromAST.js'); + +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ +function buildClientSchema(introspection, options) { + ((0, _isObjectLike.isObjectLike)(introspection) && + (0, _isObjectLike.isObjectLike)(introspection.__schema)) || + (0, _devAssert.devAssert)( + false, + `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${(0, + _inspect.inspect)(introspection)}.`, + ); // Get the schema from the introspection result. + + const schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. + + const typeMap = (0, _keyValMap.keyValMap)( + schemaIntrospection.types, + (typeIntrospection) => typeIntrospection.name, + (typeIntrospection) => buildType(typeIntrospection), + ); // Include standard types only if they are used. + + for (const stdType of [ + ..._scalars.specifiedScalarTypes, + ..._introspection.introspectionTypes, + ]) { + if (typeMap[stdType.name]) { + typeMap[stdType.name] = stdType; + } + } // Get the root Query, Mutation, and Subscription types. + + const queryType = schemaIntrospection.queryType + ? getObjectType(schemaIntrospection.queryType) + : null; + const mutationType = schemaIntrospection.mutationType + ? getObjectType(schemaIntrospection.mutationType) + : null; + const subscriptionType = schemaIntrospection.subscriptionType + ? getObjectType(schemaIntrospection.subscriptionType) + : null; // Get the directives supported by Introspection, assuming empty-set if + // directives were not queried for. + + const directives = schemaIntrospection.directives + ? schemaIntrospection.directives.map(buildDirective) + : []; // Then produce and return a Schema with these types. + + return new _schema.GraphQLSchema({ + description: schemaIntrospection.description, + query: queryType, + mutation: mutationType, + subscription: subscriptionType, + types: Object.values(typeMap), + directives, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); // Given a type reference in introspection, return the GraphQLType instance. + // preferring cached instances before building new instances. + + function getType(typeRef) { + if (typeRef.kind === _introspection.TypeKind.LIST) { + const itemRef = typeRef.ofType; + + if (!itemRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + return new _definition.GraphQLList(getType(itemRef)); + } + + if (typeRef.kind === _introspection.TypeKind.NON_NULL) { + const nullableRef = typeRef.ofType; + + if (!nullableRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + const nullableType = getType(nullableRef); + return new _definition.GraphQLNonNull( + (0, _definition.assertNullableType)(nullableType), + ); + } + + return getNamedType(typeRef); + } + + function getNamedType(typeRef) { + const typeName = typeRef.name; + + if (!typeName) { + throw new Error( + `Unknown type reference: ${(0, _inspect.inspect)(typeRef)}.`, + ); + } + + const type = typeMap[typeName]; + + if (!type) { + throw new Error( + `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`, + ); + } + + return type; + } + + function getObjectType(typeRef) { + return (0, _definition.assertObjectType)(getNamedType(typeRef)); + } + + function getInterfaceType(typeRef) { + return (0, _definition.assertInterfaceType)(getNamedType(typeRef)); + } // Given a type's introspection result, construct the correct + // GraphQLType instance. + + function buildType(type) { + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain + if (type != null && type.name != null && type.kind != null) { + // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17 + // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check + switch (type.kind) { + case _introspection.TypeKind.SCALAR: + return buildScalarDef(type); + + case _introspection.TypeKind.OBJECT: + return buildObjectDef(type); + + case _introspection.TypeKind.INTERFACE: + return buildInterfaceDef(type); + + case _introspection.TypeKind.UNION: + return buildUnionDef(type); + + case _introspection.TypeKind.ENUM: + return buildEnumDef(type); + + case _introspection.TypeKind.INPUT_OBJECT: + return buildInputObjectDef(type); + } + } + + const typeStr = (0, _inspect.inspect)(type); + throw new Error( + `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`, + ); + } + + function buildScalarDef(scalarIntrospection) { + return new _definition.GraphQLScalarType({ + name: scalarIntrospection.name, + description: scalarIntrospection.description, + specifiedByURL: scalarIntrospection.specifiedByURL, + }); + } + + function buildImplementationsList(implementingIntrospection) { + // TODO: Temporary workaround until GraphQL ecosystem will fully support + // 'interfaces' on interface types. + if ( + implementingIntrospection.interfaces === null && + implementingIntrospection.kind === _introspection.TypeKind.INTERFACE + ) { + return []; + } + + if (!implementingIntrospection.interfaces) { + const implementingIntrospectionStr = (0, _inspect.inspect)( + implementingIntrospection, + ); + throw new Error( + `Introspection result missing interfaces: ${implementingIntrospectionStr}.`, + ); + } + + return implementingIntrospection.interfaces.map(getInterfaceType); + } + + function buildObjectDef(objectIntrospection) { + return new _definition.GraphQLObjectType({ + name: objectIntrospection.name, + description: objectIntrospection.description, + interfaces: () => buildImplementationsList(objectIntrospection), + fields: () => buildFieldDefMap(objectIntrospection), + }); + } + + function buildInterfaceDef(interfaceIntrospection) { + return new _definition.GraphQLInterfaceType({ + name: interfaceIntrospection.name, + description: interfaceIntrospection.description, + interfaces: () => buildImplementationsList(interfaceIntrospection), + fields: () => buildFieldDefMap(interfaceIntrospection), + }); + } + + function buildUnionDef(unionIntrospection) { + if (!unionIntrospection.possibleTypes) { + const unionIntrospectionStr = (0, _inspect.inspect)(unionIntrospection); + throw new Error( + `Introspection result missing possibleTypes: ${unionIntrospectionStr}.`, + ); + } + + return new _definition.GraphQLUnionType({ + name: unionIntrospection.name, + description: unionIntrospection.description, + types: () => unionIntrospection.possibleTypes.map(getObjectType), + }); + } + + function buildEnumDef(enumIntrospection) { + if (!enumIntrospection.enumValues) { + const enumIntrospectionStr = (0, _inspect.inspect)(enumIntrospection); + throw new Error( + `Introspection result missing enumValues: ${enumIntrospectionStr}.`, + ); + } + + return new _definition.GraphQLEnumType({ + name: enumIntrospection.name, + description: enumIntrospection.description, + values: (0, _keyValMap.keyValMap)( + enumIntrospection.enumValues, + (valueIntrospection) => valueIntrospection.name, + (valueIntrospection) => ({ + description: valueIntrospection.description, + deprecationReason: valueIntrospection.deprecationReason, + }), + ), + }); + } + + function buildInputObjectDef(inputObjectIntrospection) { + if (!inputObjectIntrospection.inputFields) { + const inputObjectIntrospectionStr = (0, _inspect.inspect)( + inputObjectIntrospection, + ); + throw new Error( + `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`, + ); + } + + return new _definition.GraphQLInputObjectType({ + name: inputObjectIntrospection.name, + description: inputObjectIntrospection.description, + fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields), + }); + } + + function buildFieldDefMap(typeIntrospection) { + if (!typeIntrospection.fields) { + throw new Error( + `Introspection result missing fields: ${(0, _inspect.inspect)( + typeIntrospection, + )}.`, + ); + } + + return (0, _keyValMap.keyValMap)( + typeIntrospection.fields, + (fieldIntrospection) => fieldIntrospection.name, + buildField, + ); + } + + function buildField(fieldIntrospection) { + const type = getType(fieldIntrospection.type); + + if (!(0, _definition.isOutputType)(type)) { + const typeStr = (0, _inspect.inspect)(type); + throw new Error( + `Introspection must provide output type for fields, but received: ${typeStr}.`, + ); + } + + if (!fieldIntrospection.args) { + const fieldIntrospectionStr = (0, _inspect.inspect)(fieldIntrospection); + throw new Error( + `Introspection result missing field args: ${fieldIntrospectionStr}.`, + ); + } + + return { + description: fieldIntrospection.description, + deprecationReason: fieldIntrospection.deprecationReason, + type, + args: buildInputValueDefMap(fieldIntrospection.args), + }; + } + + function buildInputValueDefMap(inputValueIntrospections) { + return (0, _keyValMap.keyValMap)( + inputValueIntrospections, + (inputValue) => inputValue.name, + buildInputValue, + ); + } + + function buildInputValue(inputValueIntrospection) { + const type = getType(inputValueIntrospection.type); + + if (!(0, _definition.isInputType)(type)) { + const typeStr = (0, _inspect.inspect)(type); + throw new Error( + `Introspection must provide input type for arguments, but received: ${typeStr}.`, + ); + } + + const defaultValue = + inputValueIntrospection.defaultValue != null + ? (0, _valueFromAST.valueFromAST)( + (0, _parser.parseValue)(inputValueIntrospection.defaultValue), + type, + ) + : undefined; + return { + description: inputValueIntrospection.description, + type, + defaultValue, + deprecationReason: inputValueIntrospection.deprecationReason, + }; + } + + function buildDirective(directiveIntrospection) { + if (!directiveIntrospection.args) { + const directiveIntrospectionStr = (0, _inspect.inspect)( + directiveIntrospection, + ); + throw new Error( + `Introspection result missing directive args: ${directiveIntrospectionStr}.`, + ); + } + + if (!directiveIntrospection.locations) { + const directiveIntrospectionStr = (0, _inspect.inspect)( + directiveIntrospection, + ); + throw new Error( + `Introspection result missing directive locations: ${directiveIntrospectionStr}.`, + ); + } + + return new _directives.GraphQLDirective({ + name: directiveIntrospection.name, + description: directiveIntrospection.description, + isRepeatable: directiveIntrospection.isRepeatable, + locations: directiveIntrospection.locations.slice(), + args: buildInputValueDefMap(directiveIntrospection.args), + }); + } +} diff --git a/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.mjs b/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.mjs new file mode 100644 index 0000000..bed5876 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/buildClientSchema.mjs @@ -0,0 +1,363 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { parseValue } from '../language/parser.mjs'; +import { + assertInterfaceType, + assertNullableType, + assertObjectType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, + isInputType, + isOutputType, +} from '../type/definition.mjs'; +import { GraphQLDirective } from '../type/directives.mjs'; +import { introspectionTypes, TypeKind } from '../type/introspection.mjs'; +import { specifiedScalarTypes } from '../type/scalars.mjs'; +import { GraphQLSchema } from '../type/schema.mjs'; +import { valueFromAST } from './valueFromAST.mjs'; +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ + +export function buildClientSchema(introspection, options) { + (isObjectLike(introspection) && isObjectLike(introspection.__schema)) || + devAssert( + false, + `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${inspect( + introspection, + )}.`, + ); // Get the schema from the introspection result. + + const schemaIntrospection = introspection.__schema; // Iterate through all types, getting the type definition for each. + + const typeMap = keyValMap( + schemaIntrospection.types, + (typeIntrospection) => typeIntrospection.name, + (typeIntrospection) => buildType(typeIntrospection), + ); // Include standard types only if they are used. + + for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) { + if (typeMap[stdType.name]) { + typeMap[stdType.name] = stdType; + } + } // Get the root Query, Mutation, and Subscription types. + + const queryType = schemaIntrospection.queryType + ? getObjectType(schemaIntrospection.queryType) + : null; + const mutationType = schemaIntrospection.mutationType + ? getObjectType(schemaIntrospection.mutationType) + : null; + const subscriptionType = schemaIntrospection.subscriptionType + ? getObjectType(schemaIntrospection.subscriptionType) + : null; // Get the directives supported by Introspection, assuming empty-set if + // directives were not queried for. + + const directives = schemaIntrospection.directives + ? schemaIntrospection.directives.map(buildDirective) + : []; // Then produce and return a Schema with these types. + + return new GraphQLSchema({ + description: schemaIntrospection.description, + query: queryType, + mutation: mutationType, + subscription: subscriptionType, + types: Object.values(typeMap), + directives, + assumeValid: + options === null || options === void 0 ? void 0 : options.assumeValid, + }); // Given a type reference in introspection, return the GraphQLType instance. + // preferring cached instances before building new instances. + + function getType(typeRef) { + if (typeRef.kind === TypeKind.LIST) { + const itemRef = typeRef.ofType; + + if (!itemRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + return new GraphQLList(getType(itemRef)); + } + + if (typeRef.kind === TypeKind.NON_NULL) { + const nullableRef = typeRef.ofType; + + if (!nullableRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + + const nullableType = getType(nullableRef); + return new GraphQLNonNull(assertNullableType(nullableType)); + } + + return getNamedType(typeRef); + } + + function getNamedType(typeRef) { + const typeName = typeRef.name; + + if (!typeName) { + throw new Error(`Unknown type reference: ${inspect(typeRef)}.`); + } + + const type = typeMap[typeName]; + + if (!type) { + throw new Error( + `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`, + ); + } + + return type; + } + + function getObjectType(typeRef) { + return assertObjectType(getNamedType(typeRef)); + } + + function getInterfaceType(typeRef) { + return assertInterfaceType(getNamedType(typeRef)); + } // Given a type's introspection result, construct the correct + // GraphQLType instance. + + function buildType(type) { + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain + if (type != null && type.name != null && type.kind != null) { + // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17 + // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check + switch (type.kind) { + case TypeKind.SCALAR: + return buildScalarDef(type); + + case TypeKind.OBJECT: + return buildObjectDef(type); + + case TypeKind.INTERFACE: + return buildInterfaceDef(type); + + case TypeKind.UNION: + return buildUnionDef(type); + + case TypeKind.ENUM: + return buildEnumDef(type); + + case TypeKind.INPUT_OBJECT: + return buildInputObjectDef(type); + } + } + + const typeStr = inspect(type); + throw new Error( + `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`, + ); + } + + function buildScalarDef(scalarIntrospection) { + return new GraphQLScalarType({ + name: scalarIntrospection.name, + description: scalarIntrospection.description, + specifiedByURL: scalarIntrospection.specifiedByURL, + }); + } + + function buildImplementationsList(implementingIntrospection) { + // TODO: Temporary workaround until GraphQL ecosystem will fully support + // 'interfaces' on interface types. + if ( + implementingIntrospection.interfaces === null && + implementingIntrospection.kind === TypeKind.INTERFACE + ) { + return []; + } + + if (!implementingIntrospection.interfaces) { + const implementingIntrospectionStr = inspect(implementingIntrospection); + throw new Error( + `Introspection result missing interfaces: ${implementingIntrospectionStr}.`, + ); + } + + return implementingIntrospection.interfaces.map(getInterfaceType); + } + + function buildObjectDef(objectIntrospection) { + return new GraphQLObjectType({ + name: objectIntrospection.name, + description: objectIntrospection.description, + interfaces: () => buildImplementationsList(objectIntrospection), + fields: () => buildFieldDefMap(objectIntrospection), + }); + } + + function buildInterfaceDef(interfaceIntrospection) { + return new GraphQLInterfaceType({ + name: interfaceIntrospection.name, + description: interfaceIntrospection.description, + interfaces: () => buildImplementationsList(interfaceIntrospection), + fields: () => buildFieldDefMap(interfaceIntrospection), + }); + } + + function buildUnionDef(unionIntrospection) { + if (!unionIntrospection.possibleTypes) { + const unionIntrospectionStr = inspect(unionIntrospection); + throw new Error( + `Introspection result missing possibleTypes: ${unionIntrospectionStr}.`, + ); + } + + return new GraphQLUnionType({ + name: unionIntrospection.name, + description: unionIntrospection.description, + types: () => unionIntrospection.possibleTypes.map(getObjectType), + }); + } + + function buildEnumDef(enumIntrospection) { + if (!enumIntrospection.enumValues) { + const enumIntrospectionStr = inspect(enumIntrospection); + throw new Error( + `Introspection result missing enumValues: ${enumIntrospectionStr}.`, + ); + } + + return new GraphQLEnumType({ + name: enumIntrospection.name, + description: enumIntrospection.description, + values: keyValMap( + enumIntrospection.enumValues, + (valueIntrospection) => valueIntrospection.name, + (valueIntrospection) => ({ + description: valueIntrospection.description, + deprecationReason: valueIntrospection.deprecationReason, + }), + ), + }); + } + + function buildInputObjectDef(inputObjectIntrospection) { + if (!inputObjectIntrospection.inputFields) { + const inputObjectIntrospectionStr = inspect(inputObjectIntrospection); + throw new Error( + `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`, + ); + } + + return new GraphQLInputObjectType({ + name: inputObjectIntrospection.name, + description: inputObjectIntrospection.description, + fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields), + }); + } + + function buildFieldDefMap(typeIntrospection) { + if (!typeIntrospection.fields) { + throw new Error( + `Introspection result missing fields: ${inspect(typeIntrospection)}.`, + ); + } + + return keyValMap( + typeIntrospection.fields, + (fieldIntrospection) => fieldIntrospection.name, + buildField, + ); + } + + function buildField(fieldIntrospection) { + const type = getType(fieldIntrospection.type); + + if (!isOutputType(type)) { + const typeStr = inspect(type); + throw new Error( + `Introspection must provide output type for fields, but received: ${typeStr}.`, + ); + } + + if (!fieldIntrospection.args) { + const fieldIntrospectionStr = inspect(fieldIntrospection); + throw new Error( + `Introspection result missing field args: ${fieldIntrospectionStr}.`, + ); + } + + return { + description: fieldIntrospection.description, + deprecationReason: fieldIntrospection.deprecationReason, + type, + args: buildInputValueDefMap(fieldIntrospection.args), + }; + } + + function buildInputValueDefMap(inputValueIntrospections) { + return keyValMap( + inputValueIntrospections, + (inputValue) => inputValue.name, + buildInputValue, + ); + } + + function buildInputValue(inputValueIntrospection) { + const type = getType(inputValueIntrospection.type); + + if (!isInputType(type)) { + const typeStr = inspect(type); + throw new Error( + `Introspection must provide input type for arguments, but received: ${typeStr}.`, + ); + } + + const defaultValue = + inputValueIntrospection.defaultValue != null + ? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type) + : undefined; + return { + description: inputValueIntrospection.description, + type, + defaultValue, + deprecationReason: inputValueIntrospection.deprecationReason, + }; + } + + function buildDirective(directiveIntrospection) { + if (!directiveIntrospection.args) { + const directiveIntrospectionStr = inspect(directiveIntrospection); + throw new Error( + `Introspection result missing directive args: ${directiveIntrospectionStr}.`, + ); + } + + if (!directiveIntrospection.locations) { + const directiveIntrospectionStr = inspect(directiveIntrospection); + throw new Error( + `Introspection result missing directive locations: ${directiveIntrospectionStr}.`, + ); + } + + return new GraphQLDirective({ + name: directiveIntrospection.name, + description: directiveIntrospection.description, + isRepeatable: directiveIntrospection.isRepeatable, + locations: directiveIntrospection.locations.slice(), + args: buildInputValueDefMap(directiveIntrospection.args), + }); + } +} diff --git a/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.d.ts b/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.d.ts new file mode 100644 index 0000000..2e580ad --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.d.ts @@ -0,0 +1,16 @@ +import { GraphQLError } from '../error/GraphQLError'; +import type { GraphQLInputType } from '../type/definition'; +declare type OnErrorCB = ( + path: ReadonlyArray, + invalidValue: unknown, + error: GraphQLError, +) => void; +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +export declare function coerceInputValue( + inputValue: unknown, + type: GraphQLInputType, + onError?: OnErrorCB, +): unknown; +export {}; diff --git a/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.js b/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.js new file mode 100644 index 0000000..fd9d313 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.js @@ -0,0 +1,189 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.coerceInputValue = coerceInputValue; + +var _didYouMean = require('../jsutils/didYouMean.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _isIterableObject = require('../jsutils/isIterableObject.js'); + +var _isObjectLike = require('../jsutils/isObjectLike.js'); + +var _Path = require('../jsutils/Path.js'); + +var _printPathArray = require('../jsutils/printPathArray.js'); + +var _suggestionList = require('../jsutils/suggestionList.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _definition = require('../type/definition.js'); + +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +function coerceInputValue(inputValue, type, onError = defaultOnError) { + return coerceInputValueImpl(inputValue, type, onError, undefined); +} + +function defaultOnError(path, invalidValue, error) { + let errorPrefix = 'Invalid value ' + (0, _inspect.inspect)(invalidValue); + + if (path.length > 0) { + errorPrefix += ` at "value${(0, _printPathArray.printPathArray)(path)}"`; + } + + error.message = errorPrefix + ': ' + error.message; + throw error; +} + +function coerceInputValueImpl(inputValue, type, onError, path) { + if ((0, _definition.isNonNullType)(type)) { + if (inputValue != null) { + return coerceInputValueImpl(inputValue, type.ofType, onError, path); + } + + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Expected non-nullable type "${(0, _inspect.inspect)( + type, + )}" not to be null.`, + ), + ); + return; + } + + if (inputValue == null) { + // Explicitly return the value null. + return null; + } + + if ((0, _definition.isListType)(type)) { + const itemType = type.ofType; + + if ((0, _isIterableObject.isIterableObject)(inputValue)) { + return Array.from(inputValue, (itemValue, index) => { + const itemPath = (0, _Path.addPath)(path, index, undefined); + return coerceInputValueImpl(itemValue, itemType, onError, itemPath); + }); + } // Lists accept a non-list value as a list of one. + + return [coerceInputValueImpl(inputValue, itemType, onError, path)]; + } + + if ((0, _definition.isInputObjectType)(type)) { + if (!(0, _isObjectLike.isObjectLike)(inputValue)) { + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Expected type "${type.name}" to be an object.`, + ), + ); + return; + } + + const coercedValue = {}; + const fieldDefs = type.getFields(); + + for (const field of Object.values(fieldDefs)) { + const fieldValue = inputValue[field.name]; + + if (fieldValue === undefined) { + if (field.defaultValue !== undefined) { + coercedValue[field.name] = field.defaultValue; + } else if ((0, _definition.isNonNullType)(field.type)) { + const typeStr = (0, _inspect.inspect)(field.type); + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Field "${field.name}" of required type "${typeStr}" was not provided.`, + ), + ); + } + + continue; + } + + coercedValue[field.name] = coerceInputValueImpl( + fieldValue, + field.type, + onError, + (0, _Path.addPath)(path, field.name, type.name), + ); + } // Ensure every provided field is defined. + + for (const fieldName of Object.keys(inputValue)) { + if (!fieldDefs[fieldName]) { + const suggestions = (0, _suggestionList.suggestionList)( + fieldName, + Object.keys(type.getFields()), + ); + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Field "${fieldName}" is not defined by type "${type.name}".` + + (0, _didYouMean.didYouMean)(suggestions), + ), + ); + } + } + + return coercedValue; + } + + if ((0, _definition.isLeafType)(type)) { + let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), + // which can throw to indicate failure. If it throws, maintain a reference + // to the original error. + + try { + parseResult = type.parseValue(inputValue); + } catch (error) { + if (error instanceof _GraphQLError.GraphQLError) { + onError((0, _Path.pathToArray)(path), inputValue, error); + } else { + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError( + `Expected type "${type.name}". ` + error.message, + { + originalError: error, + }, + ), + ); + } + + return; + } + + if (parseResult === undefined) { + onError( + (0, _Path.pathToArray)(path), + inputValue, + new _GraphQLError.GraphQLError(`Expected type "${type.name}".`), + ); + } + + return parseResult; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected input type: ' + (0, _inspect.inspect)(type), + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.mjs b/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.mjs new file mode 100644 index 0000000..706c5f6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/coerceInputValue.mjs @@ -0,0 +1,167 @@ +import { didYouMean } from '../jsutils/didYouMean.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isIterableObject } from '../jsutils/isIterableObject.mjs'; +import { isObjectLike } from '../jsutils/isObjectLike.mjs'; +import { addPath, pathToArray } from '../jsutils/Path.mjs'; +import { printPathArray } from '../jsutils/printPathArray.mjs'; +import { suggestionList } from '../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition.mjs'; + +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +export function coerceInputValue(inputValue, type, onError = defaultOnError) { + return coerceInputValueImpl(inputValue, type, onError, undefined); +} + +function defaultOnError(path, invalidValue, error) { + let errorPrefix = 'Invalid value ' + inspect(invalidValue); + + if (path.length > 0) { + errorPrefix += ` at "value${printPathArray(path)}"`; + } + + error.message = errorPrefix + ': ' + error.message; + throw error; +} + +function coerceInputValueImpl(inputValue, type, onError, path) { + if (isNonNullType(type)) { + if (inputValue != null) { + return coerceInputValueImpl(inputValue, type.ofType, onError, path); + } + + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Expected non-nullable type "${inspect(type)}" not to be null.`, + ), + ); + return; + } + + if (inputValue == null) { + // Explicitly return the value null. + return null; + } + + if (isListType(type)) { + const itemType = type.ofType; + + if (isIterableObject(inputValue)) { + return Array.from(inputValue, (itemValue, index) => { + const itemPath = addPath(path, index, undefined); + return coerceInputValueImpl(itemValue, itemType, onError, itemPath); + }); + } // Lists accept a non-list value as a list of one. + + return [coerceInputValueImpl(inputValue, itemType, onError, path)]; + } + + if (isInputObjectType(type)) { + if (!isObjectLike(inputValue)) { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}" to be an object.`), + ); + return; + } + + const coercedValue = {}; + const fieldDefs = type.getFields(); + + for (const field of Object.values(fieldDefs)) { + const fieldValue = inputValue[field.name]; + + if (fieldValue === undefined) { + if (field.defaultValue !== undefined) { + coercedValue[field.name] = field.defaultValue; + } else if (isNonNullType(field.type)) { + const typeStr = inspect(field.type); + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Field "${field.name}" of required type "${typeStr}" was not provided.`, + ), + ); + } + + continue; + } + + coercedValue[field.name] = coerceInputValueImpl( + fieldValue, + field.type, + onError, + addPath(path, field.name, type.name), + ); + } // Ensure every provided field is defined. + + for (const fieldName of Object.keys(inputValue)) { + if (!fieldDefs[fieldName]) { + const suggestions = suggestionList( + fieldName, + Object.keys(type.getFields()), + ); + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Field "${fieldName}" is not defined by type "${type.name}".` + + didYouMean(suggestions), + ), + ); + } + } + + return coercedValue; + } + + if (isLeafType(type)) { + let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(), + // which can throw to indicate failure. If it throws, maintain a reference + // to the original error. + + try { + parseResult = type.parseValue(inputValue); + } catch (error) { + if (error instanceof GraphQLError) { + onError(pathToArray(path), inputValue, error); + } else { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}". ` + error.message, { + originalError: error, + }), + ); + } + + return; + } + + if (parseResult === undefined) { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}".`), + ); + } + + return parseResult; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected input type: ' + inspect(type)); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/concatAST.d.ts b/graphql-subscription/node_modules/graphql/utilities/concatAST.d.ts new file mode 100644 index 0000000..c8b91d5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/concatAST.d.ts @@ -0,0 +1,9 @@ +import type { DocumentNode } from '../language/ast'; +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ +export declare function concatAST( + documents: ReadonlyArray, +): DocumentNode; diff --git a/graphql-subscription/node_modules/graphql/utilities/concatAST.js b/graphql-subscription/node_modules/graphql/utilities/concatAST.js new file mode 100644 index 0000000..d45af63 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/concatAST.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.concatAST = concatAST; + +var _kinds = require('../language/kinds.js'); + +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ +function concatAST(documents) { + const definitions = []; + + for (const doc of documents) { + definitions.push(...doc.definitions); + } + + return { + kind: _kinds.Kind.DOCUMENT, + definitions, + }; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/concatAST.mjs b/graphql-subscription/node_modules/graphql/utilities/concatAST.mjs new file mode 100644 index 0000000..ca7b4c3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/concatAST.mjs @@ -0,0 +1,19 @@ +import { Kind } from '../language/kinds.mjs'; +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ + +export function concatAST(documents) { + const definitions = []; + + for (const doc of documents) { + definitions.push(...doc.definitions); + } + + return { + kind: Kind.DOCUMENT, + definitions, + }; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/extendSchema.d.ts b/graphql-subscription/node_modules/graphql/utilities/extendSchema.d.ts new file mode 100644 index 0000000..34d7bf0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/extendSchema.d.ts @@ -0,0 +1,40 @@ +import type { DocumentNode } from '../language/ast'; +import type { + GraphQLSchemaNormalizedConfig, + GraphQLSchemaValidationOptions, +} from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; +interface Options extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + */ + assumeValidSDL?: boolean; +} +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ +export declare function extendSchema( + schema: GraphQLSchema, + documentAST: DocumentNode, + options?: Options, +): GraphQLSchema; +/** + * @internal + */ +export declare function extendSchemaImpl( + schemaConfig: GraphQLSchemaNormalizedConfig, + documentAST: DocumentNode, + options?: Options, +): GraphQLSchemaNormalizedConfig; +export {}; diff --git a/graphql-subscription/node_modules/graphql/utilities/extendSchema.js b/graphql-subscription/node_modules/graphql/utilities/extendSchema.js new file mode 100644 index 0000000..6ca7f5f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/extendSchema.js @@ -0,0 +1,798 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.extendSchema = extendSchema; +exports.extendSchemaImpl = extendSchemaImpl; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _mapValue = require('../jsutils/mapValue.js'); + +var _kinds = require('../language/kinds.js'); + +var _predicates = require('../language/predicates.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _scalars = require('../type/scalars.js'); + +var _schema = require('../type/schema.js'); + +var _validate = require('../validation/validate.js'); + +var _values = require('../execution/values.js'); + +var _valueFromAST = require('./valueFromAST.js'); + +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ +function extendSchema(schema, documentAST, options) { + (0, _schema.assertSchema)(schema); + (documentAST != null && documentAST.kind === _kinds.Kind.DOCUMENT) || + (0, _devAssert.devAssert)(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + (0, _validate.assertValidSDLExtension)(documentAST, schema); + } + + const schemaConfig = schema.toConfig(); + const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); + return schemaConfig === extendedConfig + ? schema + : new _schema.GraphQLSchema(extendedConfig); +} +/** + * @internal + */ + +function extendSchemaImpl(schemaConfig, documentAST, options) { + var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; + + // Collect the type definitions and extensions found in the document. + const typeDefs = []; + const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can + // have the same name. For example, a type named "skip". + + const directiveDefs = []; + let schemaDef; // Schema extensions are collected which may add additional operation types. + + const schemaExtensions = []; + + for (const def of documentAST.definitions) { + if (def.kind === _kinds.Kind.SCHEMA_DEFINITION) { + schemaDef = def; + } else if (def.kind === _kinds.Kind.SCHEMA_EXTENSION) { + schemaExtensions.push(def); + } else if ((0, _predicates.isTypeDefinitionNode)(def)) { + typeDefs.push(def); + } else if ((0, _predicates.isTypeExtensionNode)(def)) { + const extendedTypeName = def.name.value; + const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; + typeExtensionsMap[extendedTypeName] = existingTypeExtensions + ? existingTypeExtensions.concat([def]) + : [def]; + } else if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + directiveDefs.push(def); + } + } // If this document contains no new types, extensions, or directives then + // return the same unmodified GraphQLSchema instance. + + if ( + Object.keys(typeExtensionsMap).length === 0 && + typeDefs.length === 0 && + directiveDefs.length === 0 && + schemaExtensions.length === 0 && + schemaDef == null + ) { + return schemaConfig; + } + + const typeMap = Object.create(null); + + for (const existingType of schemaConfig.types) { + typeMap[existingType.name] = extendNamedType(existingType); + } + + for (const typeNode of typeDefs) { + var _stdTypeMap$name; + + const name = typeNode.name.value; + typeMap[name] = + (_stdTypeMap$name = stdTypeMap[name]) !== null && + _stdTypeMap$name !== void 0 + ? _stdTypeMap$name + : buildType(typeNode); + } + + const operationTypes = { + // Get the extended root operation types. + query: schemaConfig.query && replaceNamedType(schemaConfig.query), + mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), + subscription: + schemaConfig.subscription && replaceNamedType(schemaConfig.subscription), + // Then, incorporate schema definition and all schema extensions. + ...(schemaDef && getOperationTypes([schemaDef])), + ...getOperationTypes(schemaExtensions), + }; // Then produce and return a Schema config with these types. + + return { + description: + (_schemaDef = schemaDef) === null || _schemaDef === void 0 + ? void 0 + : (_schemaDef$descriptio = _schemaDef.description) === null || + _schemaDef$descriptio === void 0 + ? void 0 + : _schemaDef$descriptio.value, + ...operationTypes, + types: Object.values(typeMap), + directives: [ + ...schemaConfig.directives.map(replaceDirective), + ...directiveDefs.map(buildDirective), + ], + extensions: Object.create(null), + astNode: + (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 + ? _schemaDef2 + : schemaConfig.astNode, + extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), + assumeValid: + (_options$assumeValid = + options === null || options === void 0 + ? void 0 + : options.assumeValid) !== null && _options$assumeValid !== void 0 + ? _options$assumeValid + : false, + }; // Below are functions used for producing this schema that have closed over + // this scope and have access to the schema, cache, and newly defined types. + + function replaceType(type) { + if ((0, _definition.isListType)(type)) { + // @ts-expect-error + return new _definition.GraphQLList(replaceType(type.ofType)); + } + + if ((0, _definition.isNonNullType)(type)) { + // @ts-expect-error + return new _definition.GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + // Note: While this could make early assertions to get the correctly + // typed values, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + return typeMap[type.name]; + } + + function replaceDirective(directive) { + const config = directive.toConfig(); + return new _directives.GraphQLDirective({ + ...config, + args: (0, _mapValue.mapValue)(config.args, extendArg), + }); + } + + function extendNamedType(type) { + if ( + (0, _introspection.isIntrospectionType)(type) || + (0, _scalars.isSpecifiedScalarType)(type) + ) { + // Builtin types are not extended. + return type; + } + + if ((0, _definition.isScalarType)(type)) { + return extendScalarType(type); + } + + if ((0, _definition.isObjectType)(type)) { + return extendObjectType(type); + } + + if ((0, _definition.isInterfaceType)(type)) { + return extendInterfaceType(type); + } + + if ((0, _definition.isUnionType)(type)) { + return extendUnionType(type); + } + + if ((0, _definition.isEnumType)(type)) { + return extendEnumType(type); + } + + if ((0, _definition.isInputObjectType)(type)) { + return extendInputObjectType(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible type definition nodes have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); + } + + function extendInputObjectType(type) { + var _typeExtensionsMap$co; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co !== void 0 + ? _typeExtensionsMap$co + : []; + return new _definition.GraphQLInputObjectType({ + ...config, + fields: () => ({ + ...(0, _mapValue.mapValue)(config.fields, (field) => ({ + ...field, + type: replaceType(field.type), + })), + ...buildInputFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendEnumType(type) { + var _typeExtensionsMap$ty; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && + _typeExtensionsMap$ty !== void 0 + ? _typeExtensionsMap$ty + : []; + return new _definition.GraphQLEnumType({ + ...config, + values: { ...config.values, ...buildEnumValueMap(extensions) }, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendScalarType(type) { + var _typeExtensionsMap$co2; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co2 !== void 0 + ? _typeExtensionsMap$co2 + : []; + let specifiedByURL = config.specifiedByURL; + + for (const extensionNode of extensions) { + var _getSpecifiedByURL; + + specifiedByURL = + (_getSpecifiedByURL = getSpecifiedByURL(extensionNode)) !== null && + _getSpecifiedByURL !== void 0 + ? _getSpecifiedByURL + : specifiedByURL; + } + + return new _definition.GraphQLScalarType({ + ...config, + specifiedByURL, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendObjectType(type) { + var _typeExtensionsMap$co3; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co3 !== void 0 + ? _typeExtensionsMap$co3 + : []; + return new _definition.GraphQLObjectType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...(0, _mapValue.mapValue)(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendInterfaceType(type) { + var _typeExtensionsMap$co4; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co4 !== void 0 + ? _typeExtensionsMap$co4 + : []; + return new _definition.GraphQLInterfaceType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...(0, _mapValue.mapValue)(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendUnionType(type) { + var _typeExtensionsMap$co5; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co5 !== void 0 + ? _typeExtensionsMap$co5 + : []; + return new _definition.GraphQLUnionType({ + ...config, + types: () => [ + ...type.getTypes().map(replaceNamedType), + ...buildUnionTypes(extensions), + ], + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendField(field) { + return { + ...field, + type: replaceType(field.type), + args: field.args && (0, _mapValue.mapValue)(field.args, extendArg), + }; + } + + function extendArg(arg) { + return { ...arg, type: replaceType(arg.type) }; + } + + function getOperationTypes(nodes) { + const opTypes = {}; + + for (const node of nodes) { + var _node$operationTypes; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const operationTypesNodes = + /* c8 ignore next */ + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + opTypes[operationType.operation] = getNamedType(operationType.type); + } + } + + return opTypes; + } + + function getNamedType(node) { + var _stdTypeMap$name2; + + const name = node.name.value; + const type = + (_stdTypeMap$name2 = stdTypeMap[name]) !== null && + _stdTypeMap$name2 !== void 0 + ? _stdTypeMap$name2 + : typeMap[name]; + + if (type === undefined) { + throw new Error(`Unknown type: "${name}".`); + } + + return type; + } + + function getWrappedType(node) { + if (node.kind === _kinds.Kind.LIST_TYPE) { + return new _definition.GraphQLList(getWrappedType(node.type)); + } + + if (node.kind === _kinds.Kind.NON_NULL_TYPE) { + return new _definition.GraphQLNonNull(getWrappedType(node.type)); + } + + return getNamedType(node); + } + + function buildDirective(node) { + var _node$description; + + return new _directives.GraphQLDirective({ + name: node.name.value, + description: + (_node$description = node.description) === null || + _node$description === void 0 + ? void 0 + : _node$description.value, + // @ts-expect-error + locations: node.locations.map(({ value }) => value), + isRepeatable: node.repeatable, + args: buildArgumentMap(node.arguments), + astNode: node, + }); + } + + function buildFieldMap(nodes) { + const fieldConfigMap = Object.create(null); + + for (const node of nodes) { + var _node$fields; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const nodeFields = + /* c8 ignore next */ + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + + for (const field of nodeFields) { + var _field$description; + + fieldConfigMap[field.name.value] = { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + type: getWrappedType(field.type), + description: + (_field$description = field.description) === null || + _field$description === void 0 + ? void 0 + : _field$description.value, + args: buildArgumentMap(field.arguments), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return fieldConfigMap; + } + + function buildArgumentMap(args) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const argsNodes = + /* c8 ignore next */ + args !== null && args !== void 0 ? args : []; + const argConfigMap = Object.create(null); + + for (const arg of argsNodes) { + var _arg$description; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(arg.type); + argConfigMap[arg.name.value] = { + type, + description: + (_arg$description = arg.description) === null || + _arg$description === void 0 + ? void 0 + : _arg$description.value, + defaultValue: (0, _valueFromAST.valueFromAST)(arg.defaultValue, type), + deprecationReason: getDeprecationReason(arg), + astNode: arg, + }; + } + + return argConfigMap; + } + + function buildInputFieldMap(nodes) { + const inputFieldMap = Object.create(null); + + for (const node of nodes) { + var _node$fields2; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const fieldsNodes = + /* c8 ignore next */ + (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 + ? _node$fields2 + : []; + + for (const field of fieldsNodes) { + var _field$description2; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(field.type); + inputFieldMap[field.name.value] = { + type, + description: + (_field$description2 = field.description) === null || + _field$description2 === void 0 + ? void 0 + : _field$description2.value, + defaultValue: (0, _valueFromAST.valueFromAST)( + field.defaultValue, + type, + ), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return inputFieldMap; + } + + function buildEnumValueMap(nodes) { + const enumValueMap = Object.create(null); + + for (const node of nodes) { + var _node$values; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const valuesNodes = + /* c8 ignore next */ + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + + for (const value of valuesNodes) { + var _value$description; + + enumValueMap[value.name.value] = { + description: + (_value$description = value.description) === null || + _value$description === void 0 + ? void 0 + : _value$description.value, + deprecationReason: getDeprecationReason(value), + astNode: value, + }; + } + } + + return enumValueMap; + } + + function buildInterfaces(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$interfaces$map, _node$interfaces; + + return ( + /* c8 ignore next */ + (_node$interfaces$map = + (_node$interfaces = node.interfaces) === null || + _node$interfaces === void 0 + ? void 0 + : _node$interfaces.map(getNamedType)) !== null && + _node$interfaces$map !== void 0 + ? _node$interfaces$map + : [] + ); + }, + ); + } + + function buildUnionTypes(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$types$map, _node$types; + + return ( + /* c8 ignore next */ + (_node$types$map = + (_node$types = node.types) === null || _node$types === void 0 + ? void 0 + : _node$types.map(getNamedType)) !== null && + _node$types$map !== void 0 + ? _node$types$map + : [] + ); + }, + ); + } + + function buildType(astNode) { + var _typeExtensionsMap$na; + + const name = astNode.name.value; + const extensionASTNodes = + (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && + _typeExtensionsMap$na !== void 0 + ? _typeExtensionsMap$na + : []; + + switch (astNode.kind) { + case _kinds.Kind.OBJECT_TYPE_DEFINITION: { + var _astNode$description; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLObjectType({ + name, + description: + (_astNode$description = astNode.description) === null || + _astNode$description === void 0 + ? void 0 + : _astNode$description.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.INTERFACE_TYPE_DEFINITION: { + var _astNode$description2; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLInterfaceType({ + name, + description: + (_astNode$description2 = astNode.description) === null || + _astNode$description2 === void 0 + ? void 0 + : _astNode$description2.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.ENUM_TYPE_DEFINITION: { + var _astNode$description3; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLEnumType({ + name, + description: + (_astNode$description3 = astNode.description) === null || + _astNode$description3 === void 0 + ? void 0 + : _astNode$description3.value, + values: buildEnumValueMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.UNION_TYPE_DEFINITION: { + var _astNode$description4; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLUnionType({ + name, + description: + (_astNode$description4 = astNode.description) === null || + _astNode$description4 === void 0 + ? void 0 + : _astNode$description4.value, + types: () => buildUnionTypes(allNodes), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.SCALAR_TYPE_DEFINITION: { + var _astNode$description5; + + return new _definition.GraphQLScalarType({ + name, + description: + (_astNode$description5 = astNode.description) === null || + _astNode$description5 === void 0 + ? void 0 + : _astNode$description5.value, + specifiedByURL: getSpecifiedByURL(astNode), + astNode, + extensionASTNodes, + }); + } + + case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: { + var _astNode$description6; + + const allNodes = [astNode, ...extensionASTNodes]; + return new _definition.GraphQLInputObjectType({ + name, + description: + (_astNode$description6 = astNode.description) === null || + _astNode$description6 === void 0 + ? void 0 + : _astNode$description6.value, + fields: () => buildInputFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + } + } +} + +const stdTypeMap = (0, _keyMap.keyMap)( + [..._scalars.specifiedScalarTypes, ..._introspection.introspectionTypes], + (type) => type.name, +); +/** + * Given a field or enum value node, returns the string value for the + * deprecation reason. + */ + +function getDeprecationReason(node) { + const deprecated = (0, _values.getDirectiveValues)( + _directives.GraphQLDeprecatedDirective, + node, + ); // @ts-expect-error validated by `getDirectiveValues` + + return deprecated === null || deprecated === void 0 + ? void 0 + : deprecated.reason; +} +/** + * Given a scalar node, returns the string value for the specifiedByURL. + */ + +function getSpecifiedByURL(node) { + const specifiedBy = (0, _values.getDirectiveValues)( + _directives.GraphQLSpecifiedByDirective, + node, + ); // @ts-expect-error validated by `getDirectiveValues` + + return specifiedBy === null || specifiedBy === void 0 + ? void 0 + : specifiedBy.url; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/extendSchema.mjs b/graphql-subscription/node_modules/graphql/utilities/extendSchema.mjs new file mode 100644 index 0000000..78e18ea --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/extendSchema.mjs @@ -0,0 +1,789 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { mapValue } from '../jsutils/mapValue.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isTypeDefinitionNode, + isTypeExtensionNode, +} from '../language/predicates.mjs'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { + GraphQLDeprecatedDirective, + GraphQLDirective, + GraphQLSpecifiedByDirective, +} from '../type/directives.mjs'; +import { + introspectionTypes, + isIntrospectionType, +} from '../type/introspection.mjs'; +import { + isSpecifiedScalarType, + specifiedScalarTypes, +} from '../type/scalars.mjs'; +import { assertSchema, GraphQLSchema } from '../type/schema.mjs'; +import { assertValidSDLExtension } from '../validation/validate.mjs'; +import { getDirectiveValues } from '../execution/values.mjs'; +import { valueFromAST } from './valueFromAST.mjs'; + +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ +export function extendSchema(schema, documentAST, options) { + assertSchema(schema); + (documentAST != null && documentAST.kind === Kind.DOCUMENT) || + devAssert(false, 'Must provide valid Document AST.'); + + if ( + (options === null || options === void 0 ? void 0 : options.assumeValid) !== + true && + (options === null || options === void 0 + ? void 0 + : options.assumeValidSDL) !== true + ) { + assertValidSDLExtension(documentAST, schema); + } + + const schemaConfig = schema.toConfig(); + const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); + return schemaConfig === extendedConfig + ? schema + : new GraphQLSchema(extendedConfig); +} +/** + * @internal + */ + +export function extendSchemaImpl(schemaConfig, documentAST, options) { + var _schemaDef, _schemaDef$descriptio, _schemaDef2, _options$assumeValid; + + // Collect the type definitions and extensions found in the document. + const typeDefs = []; + const typeExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can + // have the same name. For example, a type named "skip". + + const directiveDefs = []; + let schemaDef; // Schema extensions are collected which may add additional operation types. + + const schemaExtensions = []; + + for (const def of documentAST.definitions) { + if (def.kind === Kind.SCHEMA_DEFINITION) { + schemaDef = def; + } else if (def.kind === Kind.SCHEMA_EXTENSION) { + schemaExtensions.push(def); + } else if (isTypeDefinitionNode(def)) { + typeDefs.push(def); + } else if (isTypeExtensionNode(def)) { + const extendedTypeName = def.name.value; + const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; + typeExtensionsMap[extendedTypeName] = existingTypeExtensions + ? existingTypeExtensions.concat([def]) + : [def]; + } else if (def.kind === Kind.DIRECTIVE_DEFINITION) { + directiveDefs.push(def); + } + } // If this document contains no new types, extensions, or directives then + // return the same unmodified GraphQLSchema instance. + + if ( + Object.keys(typeExtensionsMap).length === 0 && + typeDefs.length === 0 && + directiveDefs.length === 0 && + schemaExtensions.length === 0 && + schemaDef == null + ) { + return schemaConfig; + } + + const typeMap = Object.create(null); + + for (const existingType of schemaConfig.types) { + typeMap[existingType.name] = extendNamedType(existingType); + } + + for (const typeNode of typeDefs) { + var _stdTypeMap$name; + + const name = typeNode.name.value; + typeMap[name] = + (_stdTypeMap$name = stdTypeMap[name]) !== null && + _stdTypeMap$name !== void 0 + ? _stdTypeMap$name + : buildType(typeNode); + } + + const operationTypes = { + // Get the extended root operation types. + query: schemaConfig.query && replaceNamedType(schemaConfig.query), + mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), + subscription: + schemaConfig.subscription && replaceNamedType(schemaConfig.subscription), + // Then, incorporate schema definition and all schema extensions. + ...(schemaDef && getOperationTypes([schemaDef])), + ...getOperationTypes(schemaExtensions), + }; // Then produce and return a Schema config with these types. + + return { + description: + (_schemaDef = schemaDef) === null || _schemaDef === void 0 + ? void 0 + : (_schemaDef$descriptio = _schemaDef.description) === null || + _schemaDef$descriptio === void 0 + ? void 0 + : _schemaDef$descriptio.value, + ...operationTypes, + types: Object.values(typeMap), + directives: [ + ...schemaConfig.directives.map(replaceDirective), + ...directiveDefs.map(buildDirective), + ], + extensions: Object.create(null), + astNode: + (_schemaDef2 = schemaDef) !== null && _schemaDef2 !== void 0 + ? _schemaDef2 + : schemaConfig.astNode, + extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), + assumeValid: + (_options$assumeValid = + options === null || options === void 0 + ? void 0 + : options.assumeValid) !== null && _options$assumeValid !== void 0 + ? _options$assumeValid + : false, + }; // Below are functions used for producing this schema that have closed over + // this scope and have access to the schema, cache, and newly defined types. + + function replaceType(type) { + if (isListType(type)) { + // @ts-expect-error + return new GraphQLList(replaceType(type.ofType)); + } + + if (isNonNullType(type)) { + // @ts-expect-error + return new GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + // Note: While this could make early assertions to get the correctly + // typed values, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + return typeMap[type.name]; + } + + function replaceDirective(directive) { + const config = directive.toConfig(); + return new GraphQLDirective({ + ...config, + args: mapValue(config.args, extendArg), + }); + } + + function extendNamedType(type) { + if (isIntrospectionType(type) || isSpecifiedScalarType(type)) { + // Builtin types are not extended. + return type; + } + + if (isScalarType(type)) { + return extendScalarType(type); + } + + if (isObjectType(type)) { + return extendObjectType(type); + } + + if (isInterfaceType(type)) { + return extendInterfaceType(type); + } + + if (isUnionType(type)) { + return extendUnionType(type); + } + + if (isEnumType(type)) { + return extendEnumType(type); + } + + if (isInputObjectType(type)) { + return extendInputObjectType(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible type definition nodes have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); + } + + function extendInputObjectType(type) { + var _typeExtensionsMap$co; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co !== void 0 + ? _typeExtensionsMap$co + : []; + return new GraphQLInputObjectType({ + ...config, + fields: () => ({ + ...mapValue(config.fields, (field) => ({ + ...field, + type: replaceType(field.type), + })), + ...buildInputFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendEnumType(type) { + var _typeExtensionsMap$ty; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$ty = typeExtensionsMap[type.name]) !== null && + _typeExtensionsMap$ty !== void 0 + ? _typeExtensionsMap$ty + : []; + return new GraphQLEnumType({ + ...config, + values: { ...config.values, ...buildEnumValueMap(extensions) }, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendScalarType(type) { + var _typeExtensionsMap$co2; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co2 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co2 !== void 0 + ? _typeExtensionsMap$co2 + : []; + let specifiedByURL = config.specifiedByURL; + + for (const extensionNode of extensions) { + var _getSpecifiedByURL; + + specifiedByURL = + (_getSpecifiedByURL = getSpecifiedByURL(extensionNode)) !== null && + _getSpecifiedByURL !== void 0 + ? _getSpecifiedByURL + : specifiedByURL; + } + + return new GraphQLScalarType({ + ...config, + specifiedByURL, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendObjectType(type) { + var _typeExtensionsMap$co3; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co3 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co3 !== void 0 + ? _typeExtensionsMap$co3 + : []; + return new GraphQLObjectType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...mapValue(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendInterfaceType(type) { + var _typeExtensionsMap$co4; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co4 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co4 !== void 0 + ? _typeExtensionsMap$co4 + : []; + return new GraphQLInterfaceType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...mapValue(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendUnionType(type) { + var _typeExtensionsMap$co5; + + const config = type.toConfig(); + const extensions = + (_typeExtensionsMap$co5 = typeExtensionsMap[config.name]) !== null && + _typeExtensionsMap$co5 !== void 0 + ? _typeExtensionsMap$co5 + : []; + return new GraphQLUnionType({ + ...config, + types: () => [ + ...type.getTypes().map(replaceNamedType), + ...buildUnionTypes(extensions), + ], + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendField(field) { + return { + ...field, + type: replaceType(field.type), + args: field.args && mapValue(field.args, extendArg), + }; + } + + function extendArg(arg) { + return { ...arg, type: replaceType(arg.type) }; + } + + function getOperationTypes(nodes) { + const opTypes = {}; + + for (const node of nodes) { + var _node$operationTypes; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const operationTypesNodes = + /* c8 ignore next */ + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + opTypes[operationType.operation] = getNamedType(operationType.type); + } + } + + return opTypes; + } + + function getNamedType(node) { + var _stdTypeMap$name2; + + const name = node.name.value; + const type = + (_stdTypeMap$name2 = stdTypeMap[name]) !== null && + _stdTypeMap$name2 !== void 0 + ? _stdTypeMap$name2 + : typeMap[name]; + + if (type === undefined) { + throw new Error(`Unknown type: "${name}".`); + } + + return type; + } + + function getWrappedType(node) { + if (node.kind === Kind.LIST_TYPE) { + return new GraphQLList(getWrappedType(node.type)); + } + + if (node.kind === Kind.NON_NULL_TYPE) { + return new GraphQLNonNull(getWrappedType(node.type)); + } + + return getNamedType(node); + } + + function buildDirective(node) { + var _node$description; + + return new GraphQLDirective({ + name: node.name.value, + description: + (_node$description = node.description) === null || + _node$description === void 0 + ? void 0 + : _node$description.value, + // @ts-expect-error + locations: node.locations.map(({ value }) => value), + isRepeatable: node.repeatable, + args: buildArgumentMap(node.arguments), + astNode: node, + }); + } + + function buildFieldMap(nodes) { + const fieldConfigMap = Object.create(null); + + for (const node of nodes) { + var _node$fields; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const nodeFields = + /* c8 ignore next */ + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + + for (const field of nodeFields) { + var _field$description; + + fieldConfigMap[field.name.value] = { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + type: getWrappedType(field.type), + description: + (_field$description = field.description) === null || + _field$description === void 0 + ? void 0 + : _field$description.value, + args: buildArgumentMap(field.arguments), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return fieldConfigMap; + } + + function buildArgumentMap(args) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const argsNodes = + /* c8 ignore next */ + args !== null && args !== void 0 ? args : []; + const argConfigMap = Object.create(null); + + for (const arg of argsNodes) { + var _arg$description; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(arg.type); + argConfigMap[arg.name.value] = { + type, + description: + (_arg$description = arg.description) === null || + _arg$description === void 0 + ? void 0 + : _arg$description.value, + defaultValue: valueFromAST(arg.defaultValue, type), + deprecationReason: getDeprecationReason(arg), + astNode: arg, + }; + } + + return argConfigMap; + } + + function buildInputFieldMap(nodes) { + const inputFieldMap = Object.create(null); + + for (const node of nodes) { + var _node$fields2; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const fieldsNodes = + /* c8 ignore next */ + (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0 + ? _node$fields2 + : []; + + for (const field of fieldsNodes) { + var _field$description2; + + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type = getWrappedType(field.type); + inputFieldMap[field.name.value] = { + type, + description: + (_field$description2 = field.description) === null || + _field$description2 === void 0 + ? void 0 + : _field$description2.value, + defaultValue: valueFromAST(field.defaultValue, type), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + + return inputFieldMap; + } + + function buildEnumValueMap(nodes) { + const enumValueMap = Object.create(null); + + for (const node of nodes) { + var _node$values; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const valuesNodes = + /* c8 ignore next */ + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + + for (const value of valuesNodes) { + var _value$description; + + enumValueMap[value.name.value] = { + description: + (_value$description = value.description) === null || + _value$description === void 0 + ? void 0 + : _value$description.value, + deprecationReason: getDeprecationReason(value), + astNode: value, + }; + } + } + + return enumValueMap; + } + + function buildInterfaces(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$interfaces$map, _node$interfaces; + + return ( + /* c8 ignore next */ + (_node$interfaces$map = + (_node$interfaces = node.interfaces) === null || + _node$interfaces === void 0 + ? void 0 + : _node$interfaces.map(getNamedType)) !== null && + _node$interfaces$map !== void 0 + ? _node$interfaces$map + : [] + ); + }, + ); + } + + function buildUnionTypes(nodes) { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => { + var _node$types$map, _node$types; + + return ( + /* c8 ignore next */ + (_node$types$map = + (_node$types = node.types) === null || _node$types === void 0 + ? void 0 + : _node$types.map(getNamedType)) !== null && + _node$types$map !== void 0 + ? _node$types$map + : [] + ); + }, + ); + } + + function buildType(astNode) { + var _typeExtensionsMap$na; + + const name = astNode.name.value; + const extensionASTNodes = + (_typeExtensionsMap$na = typeExtensionsMap[name]) !== null && + _typeExtensionsMap$na !== void 0 + ? _typeExtensionsMap$na + : []; + + switch (astNode.kind) { + case Kind.OBJECT_TYPE_DEFINITION: { + var _astNode$description; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLObjectType({ + name, + description: + (_astNode$description = astNode.description) === null || + _astNode$description === void 0 + ? void 0 + : _astNode$description.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.INTERFACE_TYPE_DEFINITION: { + var _astNode$description2; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLInterfaceType({ + name, + description: + (_astNode$description2 = astNode.description) === null || + _astNode$description2 === void 0 + ? void 0 + : _astNode$description2.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.ENUM_TYPE_DEFINITION: { + var _astNode$description3; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLEnumType({ + name, + description: + (_astNode$description3 = astNode.description) === null || + _astNode$description3 === void 0 + ? void 0 + : _astNode$description3.value, + values: buildEnumValueMap(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.UNION_TYPE_DEFINITION: { + var _astNode$description4; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLUnionType({ + name, + description: + (_astNode$description4 = astNode.description) === null || + _astNode$description4 === void 0 + ? void 0 + : _astNode$description4.value, + types: () => buildUnionTypes(allNodes), + astNode, + extensionASTNodes, + }); + } + + case Kind.SCALAR_TYPE_DEFINITION: { + var _astNode$description5; + + return new GraphQLScalarType({ + name, + description: + (_astNode$description5 = astNode.description) === null || + _astNode$description5 === void 0 + ? void 0 + : _astNode$description5.value, + specifiedByURL: getSpecifiedByURL(astNode), + astNode, + extensionASTNodes, + }); + } + + case Kind.INPUT_OBJECT_TYPE_DEFINITION: { + var _astNode$description6; + + const allNodes = [astNode, ...extensionASTNodes]; + return new GraphQLInputObjectType({ + name, + description: + (_astNode$description6 = astNode.description) === null || + _astNode$description6 === void 0 + ? void 0 + : _astNode$description6.value, + fields: () => buildInputFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + } + } +} +const stdTypeMap = keyMap( + [...specifiedScalarTypes, ...introspectionTypes], + (type) => type.name, +); +/** + * Given a field or enum value node, returns the string value for the + * deprecation reason. + */ + +function getDeprecationReason(node) { + const deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node); // @ts-expect-error validated by `getDirectiveValues` + + return deprecated === null || deprecated === void 0 + ? void 0 + : deprecated.reason; +} +/** + * Given a scalar node, returns the string value for the specifiedByURL. + */ + +function getSpecifiedByURL(node) { + const specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node); // @ts-expect-error validated by `getDirectiveValues` + + return specifiedBy === null || specifiedBy === void 0 + ? void 0 + : specifiedBy.url; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.d.ts b/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.d.ts new file mode 100644 index 0000000..d635b60 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.d.ts @@ -0,0 +1,53 @@ +import type { GraphQLSchema } from '../type/schema'; +declare enum BreakingChangeType { + TYPE_REMOVED = 'TYPE_REMOVED', + TYPE_CHANGED_KIND = 'TYPE_CHANGED_KIND', + TYPE_REMOVED_FROM_UNION = 'TYPE_REMOVED_FROM_UNION', + VALUE_REMOVED_FROM_ENUM = 'VALUE_REMOVED_FROM_ENUM', + REQUIRED_INPUT_FIELD_ADDED = 'REQUIRED_INPUT_FIELD_ADDED', + IMPLEMENTED_INTERFACE_REMOVED = 'IMPLEMENTED_INTERFACE_REMOVED', + FIELD_REMOVED = 'FIELD_REMOVED', + FIELD_CHANGED_KIND = 'FIELD_CHANGED_KIND', + REQUIRED_ARG_ADDED = 'REQUIRED_ARG_ADDED', + ARG_REMOVED = 'ARG_REMOVED', + ARG_CHANGED_KIND = 'ARG_CHANGED_KIND', + DIRECTIVE_REMOVED = 'DIRECTIVE_REMOVED', + DIRECTIVE_ARG_REMOVED = 'DIRECTIVE_ARG_REMOVED', + REQUIRED_DIRECTIVE_ARG_ADDED = 'REQUIRED_DIRECTIVE_ARG_ADDED', + DIRECTIVE_REPEATABLE_REMOVED = 'DIRECTIVE_REPEATABLE_REMOVED', + DIRECTIVE_LOCATION_REMOVED = 'DIRECTIVE_LOCATION_REMOVED', +} +export { BreakingChangeType }; +declare enum DangerousChangeType { + VALUE_ADDED_TO_ENUM = 'VALUE_ADDED_TO_ENUM', + TYPE_ADDED_TO_UNION = 'TYPE_ADDED_TO_UNION', + OPTIONAL_INPUT_FIELD_ADDED = 'OPTIONAL_INPUT_FIELD_ADDED', + OPTIONAL_ARG_ADDED = 'OPTIONAL_ARG_ADDED', + IMPLEMENTED_INTERFACE_ADDED = 'IMPLEMENTED_INTERFACE_ADDED', + ARG_DEFAULT_VALUE_CHANGE = 'ARG_DEFAULT_VALUE_CHANGE', +} +export { DangerousChangeType }; +export interface BreakingChange { + type: BreakingChangeType; + description: string; +} +export interface DangerousChange { + type: DangerousChangeType; + description: string; +} +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +export declare function findBreakingChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array; +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ +export declare function findDangerousChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array; diff --git a/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.js b/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.js new file mode 100644 index 0000000..9fb5e39 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.js @@ -0,0 +1,547 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.DangerousChangeType = exports.BreakingChangeType = void 0; +exports.findBreakingChanges = findBreakingChanges; +exports.findDangerousChanges = findDangerousChanges; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('../type/definition.js'); + +var _scalars = require('../type/scalars.js'); + +var _astFromValue = require('./astFromValue.js'); + +var _sortValueNode = require('./sortValueNode.js'); + +var BreakingChangeType; +exports.BreakingChangeType = BreakingChangeType; + +(function (BreakingChangeType) { + BreakingChangeType['TYPE_REMOVED'] = 'TYPE_REMOVED'; + BreakingChangeType['TYPE_CHANGED_KIND'] = 'TYPE_CHANGED_KIND'; + BreakingChangeType['TYPE_REMOVED_FROM_UNION'] = 'TYPE_REMOVED_FROM_UNION'; + BreakingChangeType['VALUE_REMOVED_FROM_ENUM'] = 'VALUE_REMOVED_FROM_ENUM'; + BreakingChangeType['REQUIRED_INPUT_FIELD_ADDED'] = + 'REQUIRED_INPUT_FIELD_ADDED'; + BreakingChangeType['IMPLEMENTED_INTERFACE_REMOVED'] = + 'IMPLEMENTED_INTERFACE_REMOVED'; + BreakingChangeType['FIELD_REMOVED'] = 'FIELD_REMOVED'; + BreakingChangeType['FIELD_CHANGED_KIND'] = 'FIELD_CHANGED_KIND'; + BreakingChangeType['REQUIRED_ARG_ADDED'] = 'REQUIRED_ARG_ADDED'; + BreakingChangeType['ARG_REMOVED'] = 'ARG_REMOVED'; + BreakingChangeType['ARG_CHANGED_KIND'] = 'ARG_CHANGED_KIND'; + BreakingChangeType['DIRECTIVE_REMOVED'] = 'DIRECTIVE_REMOVED'; + BreakingChangeType['DIRECTIVE_ARG_REMOVED'] = 'DIRECTIVE_ARG_REMOVED'; + BreakingChangeType['REQUIRED_DIRECTIVE_ARG_ADDED'] = + 'REQUIRED_DIRECTIVE_ARG_ADDED'; + BreakingChangeType['DIRECTIVE_REPEATABLE_REMOVED'] = + 'DIRECTIVE_REPEATABLE_REMOVED'; + BreakingChangeType['DIRECTIVE_LOCATION_REMOVED'] = + 'DIRECTIVE_LOCATION_REMOVED'; +})( + BreakingChangeType || (exports.BreakingChangeType = BreakingChangeType = {}), +); + +var DangerousChangeType; +exports.DangerousChangeType = DangerousChangeType; + +(function (DangerousChangeType) { + DangerousChangeType['VALUE_ADDED_TO_ENUM'] = 'VALUE_ADDED_TO_ENUM'; + DangerousChangeType['TYPE_ADDED_TO_UNION'] = 'TYPE_ADDED_TO_UNION'; + DangerousChangeType['OPTIONAL_INPUT_FIELD_ADDED'] = + 'OPTIONAL_INPUT_FIELD_ADDED'; + DangerousChangeType['OPTIONAL_ARG_ADDED'] = 'OPTIONAL_ARG_ADDED'; + DangerousChangeType['IMPLEMENTED_INTERFACE_ADDED'] = + 'IMPLEMENTED_INTERFACE_ADDED'; + DangerousChangeType['ARG_DEFAULT_VALUE_CHANGE'] = 'ARG_DEFAULT_VALUE_CHANGE'; +})( + DangerousChangeType || + (exports.DangerousChangeType = DangerousChangeType = {}), +); + +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +function findBreakingChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in BreakingChangeType, + ); +} +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ + +function findDangerousChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in DangerousChangeType, + ); +} + +function findSchemaChanges(oldSchema, newSchema) { + return [ + ...findTypeChanges(oldSchema, newSchema), + ...findDirectiveChanges(oldSchema, newSchema), + ]; +} + +function findDirectiveChanges(oldSchema, newSchema) { + const schemaChanges = []; + const directivesDiff = diff( + oldSchema.getDirectives(), + newSchema.getDirectives(), + ); + + for (const oldDirective of directivesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: `${oldDirective.name} was removed.`, + }); + } + + for (const [oldDirective, newDirective] of directivesDiff.persisted) { + const argsDiff = diff(oldDirective.args, newDirective.args); + + for (const newArg of argsDiff.added) { + if ((0, _definition.isRequiredArgument)(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`, + }); + } + } + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: `${oldArg.name} was removed from ${oldDirective.name}.`, + }); + } + + if (oldDirective.isRepeatable && !newDirective.isRepeatable) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: `Repeatable flag was removed from ${oldDirective.name}.`, + }); + } + + for (const location of oldDirective.locations) { + if (!newDirective.locations.includes(location)) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: `${location} was removed from ${oldDirective.name}.`, + }); + } + } + } + + return schemaChanges; +} + +function findTypeChanges(oldSchema, newSchema) { + const schemaChanges = []; + const typesDiff = diff( + Object.values(oldSchema.getTypeMap()), + Object.values(newSchema.getTypeMap()), + ); + + for (const oldType of typesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED, + description: (0, _scalars.isSpecifiedScalarType)(oldType) + ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.` + : `${oldType.name} was removed.`, + }); + } + + for (const [oldType, newType] of typesDiff.persisted) { + if ( + (0, _definition.isEnumType)(oldType) && + (0, _definition.isEnumType)(newType) + ) { + schemaChanges.push(...findEnumTypeChanges(oldType, newType)); + } else if ( + (0, _definition.isUnionType)(oldType) && + (0, _definition.isUnionType)(newType) + ) { + schemaChanges.push(...findUnionTypeChanges(oldType, newType)); + } else if ( + (0, _definition.isInputObjectType)(oldType) && + (0, _definition.isInputObjectType)(newType) + ) { + schemaChanges.push(...findInputObjectTypeChanges(oldType, newType)); + } else if ( + (0, _definition.isObjectType)(oldType) && + (0, _definition.isObjectType)(newType) + ) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if ( + (0, _definition.isInterfaceType)(oldType) && + (0, _definition.isInterfaceType)(newType) + ) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (oldType.constructor !== newType.constructor) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + `${oldType.name} changed from ` + + `${typeKindName(oldType)} to ${typeKindName(newType)}.`, + }); + } + } + + return schemaChanges; +} + +function findInputObjectTypeChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const newField of fieldsDiff.added) { + if ((0, _definition.isRequiredInputField)(newField)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, + description: `A required field ${newField.name} on input type ${oldType.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, + description: `An optional field ${newField.name} on input type ${oldType.name} was added.`, + }); + } + } + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findUnionTypeChanges(oldType, newType) { + const schemaChanges = []; + const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); + + for (const newPossibleType of possibleTypesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: `${newPossibleType.name} was added to union type ${oldType.name}.`, + }); + } + + for (const oldPossibleType of possibleTypesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findEnumTypeChanges(oldType, newType) { + const schemaChanges = []; + const valuesDiff = diff(oldType.getValues(), newType.getValues()); + + for (const newValue of valuesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: `${newValue.name} was added to enum type ${oldType.name}.`, + }); + } + + for (const oldValue of valuesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: `${oldValue.name} was removed from enum type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findImplementedInterfacesChanges(oldType, newType) { + const schemaChanges = []; + const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); + + for (const newInterface of interfacesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`, + }); + } + + for (const oldInterface of interfacesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: `${oldType.name} no longer implements interface ${oldInterface.name}.`, + }); + } + + return schemaChanges; +} + +function findFieldChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + schemaChanges.push(...findArgChanges(oldType, oldField, newField)); + const isSafe = isChangeSafeForObjectOrInterfaceField( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findArgChanges(oldType, oldField, newField) { + const schemaChanges = []; + const argsDiff = diff(oldField.args, newField.args); + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.ARG_REMOVED, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.`, + }); + } + + for (const [oldArg, newArg] of argsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldArg.type, + newArg.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` + + `${String(oldArg.type)} to ${String(newArg.type)}.`, + }); + } else if (oldArg.defaultValue !== undefined) { + if (newArg.defaultValue === undefined) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`, + }); + } else { + // Since we looking only for client's observable changes we should + // compare default values in the same representation as they are + // represented inside introspection. + const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type); + const newValueStr = stringifyValue(newArg.defaultValue, newArg.type); + + if (oldValueStr !== newValueStr) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`, + }); + } + } + } + } + + for (const newArg of argsDiff.added) { + if ((0, _definition.isRequiredArgument)(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_ARG_ADDED, + description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_ARG_ADDED, + description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } + } + + return schemaChanges; +} + +function isChangeSafeForObjectOrInterfaceField(oldType, newType) { + if ((0, _definition.isListType)(oldType)) { + return ( + // if they're both lists, make sure the underlying types are compatible + ((0, _definition.isListType)(newType) && + isChangeSafeForObjectOrInterfaceField( + oldType.ofType, + newType.ofType, + )) || // moving from nullable to non-null of the same underlying type is safe + ((0, _definition.isNonNullType)(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); + } + + if ((0, _definition.isNonNullType)(oldType)) { + // if they're both non-null, make sure the underlying types are compatible + return ( + (0, _definition.isNonNullType)(newType) && + isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) + ); + } + + return ( + // if they're both named types, see if their names are equivalent + ((0, _definition.isNamedType)(newType) && oldType.name === newType.name) || // moving from nullable to non-null of the same underlying type is safe + ((0, _definition.isNonNullType)(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); +} + +function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { + if ((0, _definition.isListType)(oldType)) { + // if they're both lists, make sure the underlying types are compatible + return ( + (0, _definition.isListType)(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) + ); + } + + if ((0, _definition.isNonNullType)(oldType)) { + return ( + // if they're both non-null, make sure the underlying types are + // compatible + ((0, _definition.isNonNullType)(newType) && + isChangeSafeForInputObjectFieldOrFieldArg( + oldType.ofType, + newType.ofType, + )) || // moving from non-null to nullable of the same underlying type is safe + (!(0, _definition.isNonNullType)(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)) + ); + } // if they're both named types, see if their names are equivalent + + return (0, _definition.isNamedType)(newType) && oldType.name === newType.name; +} + +function typeKindName(type) { + if ((0, _definition.isScalarType)(type)) { + return 'a Scalar type'; + } + + if ((0, _definition.isObjectType)(type)) { + return 'an Object type'; + } + + if ((0, _definition.isInterfaceType)(type)) { + return 'an Interface type'; + } + + if ((0, _definition.isUnionType)(type)) { + return 'a Union type'; + } + + if ((0, _definition.isEnumType)(type)) { + return 'an Enum type'; + } + + if ((0, _definition.isInputObjectType)(type)) { + return 'an Input type'; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); +} + +function stringifyValue(value, type) { + const ast = (0, _astFromValue.astFromValue)(value, type); + ast != null || (0, _invariant.invariant)(false); + return (0, _printer.print)((0, _sortValueNode.sortValueNode)(ast)); +} + +function diff(oldArray, newArray) { + const added = []; + const removed = []; + const persisted = []; + const oldMap = (0, _keyMap.keyMap)(oldArray, ({ name }) => name); + const newMap = (0, _keyMap.keyMap)(newArray, ({ name }) => name); + + for (const oldItem of oldArray) { + const newItem = newMap[oldItem.name]; + + if (newItem === undefined) { + removed.push(oldItem); + } else { + persisted.push([oldItem, newItem]); + } + } + + for (const newItem of newArray) { + if (oldMap[newItem.name] === undefined) { + added.push(newItem); + } + } + + return { + added, + persisted, + removed, + }; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.mjs b/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.mjs new file mode 100644 index 0000000..50756e3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/findBreakingChanges.mjs @@ -0,0 +1,519 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { print } from '../language/printer.mjs'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNamedType, + isNonNullType, + isObjectType, + isRequiredArgument, + isRequiredInputField, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { isSpecifiedScalarType } from '../type/scalars.mjs'; +import { astFromValue } from './astFromValue.mjs'; +import { sortValueNode } from './sortValueNode.mjs'; +var BreakingChangeType; + +(function (BreakingChangeType) { + BreakingChangeType['TYPE_REMOVED'] = 'TYPE_REMOVED'; + BreakingChangeType['TYPE_CHANGED_KIND'] = 'TYPE_CHANGED_KIND'; + BreakingChangeType['TYPE_REMOVED_FROM_UNION'] = 'TYPE_REMOVED_FROM_UNION'; + BreakingChangeType['VALUE_REMOVED_FROM_ENUM'] = 'VALUE_REMOVED_FROM_ENUM'; + BreakingChangeType['REQUIRED_INPUT_FIELD_ADDED'] = + 'REQUIRED_INPUT_FIELD_ADDED'; + BreakingChangeType['IMPLEMENTED_INTERFACE_REMOVED'] = + 'IMPLEMENTED_INTERFACE_REMOVED'; + BreakingChangeType['FIELD_REMOVED'] = 'FIELD_REMOVED'; + BreakingChangeType['FIELD_CHANGED_KIND'] = 'FIELD_CHANGED_KIND'; + BreakingChangeType['REQUIRED_ARG_ADDED'] = 'REQUIRED_ARG_ADDED'; + BreakingChangeType['ARG_REMOVED'] = 'ARG_REMOVED'; + BreakingChangeType['ARG_CHANGED_KIND'] = 'ARG_CHANGED_KIND'; + BreakingChangeType['DIRECTIVE_REMOVED'] = 'DIRECTIVE_REMOVED'; + BreakingChangeType['DIRECTIVE_ARG_REMOVED'] = 'DIRECTIVE_ARG_REMOVED'; + BreakingChangeType['REQUIRED_DIRECTIVE_ARG_ADDED'] = + 'REQUIRED_DIRECTIVE_ARG_ADDED'; + BreakingChangeType['DIRECTIVE_REPEATABLE_REMOVED'] = + 'DIRECTIVE_REPEATABLE_REMOVED'; + BreakingChangeType['DIRECTIVE_LOCATION_REMOVED'] = + 'DIRECTIVE_LOCATION_REMOVED'; +})(BreakingChangeType || (BreakingChangeType = {})); + +export { BreakingChangeType }; +var DangerousChangeType; + +(function (DangerousChangeType) { + DangerousChangeType['VALUE_ADDED_TO_ENUM'] = 'VALUE_ADDED_TO_ENUM'; + DangerousChangeType['TYPE_ADDED_TO_UNION'] = 'TYPE_ADDED_TO_UNION'; + DangerousChangeType['OPTIONAL_INPUT_FIELD_ADDED'] = + 'OPTIONAL_INPUT_FIELD_ADDED'; + DangerousChangeType['OPTIONAL_ARG_ADDED'] = 'OPTIONAL_ARG_ADDED'; + DangerousChangeType['IMPLEMENTED_INTERFACE_ADDED'] = + 'IMPLEMENTED_INTERFACE_ADDED'; + DangerousChangeType['ARG_DEFAULT_VALUE_CHANGE'] = 'ARG_DEFAULT_VALUE_CHANGE'; +})(DangerousChangeType || (DangerousChangeType = {})); + +export { DangerousChangeType }; + +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +export function findBreakingChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in BreakingChangeType, + ); +} +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ + +export function findDangerousChanges(oldSchema, newSchema) { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in DangerousChangeType, + ); +} + +function findSchemaChanges(oldSchema, newSchema) { + return [ + ...findTypeChanges(oldSchema, newSchema), + ...findDirectiveChanges(oldSchema, newSchema), + ]; +} + +function findDirectiveChanges(oldSchema, newSchema) { + const schemaChanges = []; + const directivesDiff = diff( + oldSchema.getDirectives(), + newSchema.getDirectives(), + ); + + for (const oldDirective of directivesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: `${oldDirective.name} was removed.`, + }); + } + + for (const [oldDirective, newDirective] of directivesDiff.persisted) { + const argsDiff = diff(oldDirective.args, newDirective.args); + + for (const newArg of argsDiff.added) { + if (isRequiredArgument(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`, + }); + } + } + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: `${oldArg.name} was removed from ${oldDirective.name}.`, + }); + } + + if (oldDirective.isRepeatable && !newDirective.isRepeatable) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: `Repeatable flag was removed from ${oldDirective.name}.`, + }); + } + + for (const location of oldDirective.locations) { + if (!newDirective.locations.includes(location)) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: `${location} was removed from ${oldDirective.name}.`, + }); + } + } + } + + return schemaChanges; +} + +function findTypeChanges(oldSchema, newSchema) { + const schemaChanges = []; + const typesDiff = diff( + Object.values(oldSchema.getTypeMap()), + Object.values(newSchema.getTypeMap()), + ); + + for (const oldType of typesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED, + description: isSpecifiedScalarType(oldType) + ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.` + : `${oldType.name} was removed.`, + }); + } + + for (const [oldType, newType] of typesDiff.persisted) { + if (isEnumType(oldType) && isEnumType(newType)) { + schemaChanges.push(...findEnumTypeChanges(oldType, newType)); + } else if (isUnionType(oldType) && isUnionType(newType)) { + schemaChanges.push(...findUnionTypeChanges(oldType, newType)); + } else if (isInputObjectType(oldType) && isInputObjectType(newType)) { + schemaChanges.push(...findInputObjectTypeChanges(oldType, newType)); + } else if (isObjectType(oldType) && isObjectType(newType)) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (isInterfaceType(oldType) && isInterfaceType(newType)) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (oldType.constructor !== newType.constructor) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + `${oldType.name} changed from ` + + `${typeKindName(oldType)} to ${typeKindName(newType)}.`, + }); + } + } + + return schemaChanges; +} + +function findInputObjectTypeChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const newField of fieldsDiff.added) { + if (isRequiredInputField(newField)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, + description: `A required field ${newField.name} on input type ${oldType.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, + description: `An optional field ${newField.name} on input type ${oldType.name} was added.`, + }); + } + } + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findUnionTypeChanges(oldType, newType) { + const schemaChanges = []; + const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); + + for (const newPossibleType of possibleTypesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: `${newPossibleType.name} was added to union type ${oldType.name}.`, + }); + } + + for (const oldPossibleType of possibleTypesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findEnumTypeChanges(oldType, newType) { + const schemaChanges = []; + const valuesDiff = diff(oldType.getValues(), newType.getValues()); + + for (const newValue of valuesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: `${newValue.name} was added to enum type ${oldType.name}.`, + }); + } + + for (const oldValue of valuesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: `${oldValue.name} was removed from enum type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findImplementedInterfacesChanges(oldType, newType) { + const schemaChanges = []; + const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); + + for (const newInterface of interfacesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`, + }); + } + + for (const oldInterface of interfacesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: `${oldType.name} no longer implements interface ${oldInterface.name}.`, + }); + } + + return schemaChanges; +} + +function findFieldChanges(oldType, newType) { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + schemaChanges.push(...findArgChanges(oldType, oldField, newField)); + const isSafe = isChangeSafeForObjectOrInterfaceField( + oldField.type, + newField.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findArgChanges(oldType, oldField, newField) { + const schemaChanges = []; + const argsDiff = diff(oldField.args, newField.args); + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.ARG_REMOVED, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.`, + }); + } + + for (const [oldArg, newArg] of argsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldArg.type, + newArg.type, + ); + + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` + + `${String(oldArg.type)} to ${String(newArg.type)}.`, + }); + } else if (oldArg.defaultValue !== undefined) { + if (newArg.defaultValue === undefined) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`, + }); + } else { + // Since we looking only for client's observable changes we should + // compare default values in the same representation as they are + // represented inside introspection. + const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type); + const newValueStr = stringifyValue(newArg.defaultValue, newArg.type); + + if (oldValueStr !== newValueStr) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`, + }); + } + } + } + } + + for (const newArg of argsDiff.added) { + if (isRequiredArgument(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_ARG_ADDED, + description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_ARG_ADDED, + description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } + } + + return schemaChanges; +} + +function isChangeSafeForObjectOrInterfaceField(oldType, newType) { + if (isListType(oldType)) { + return ( + // if they're both lists, make sure the underlying types are compatible + (isListType(newType) && + isChangeSafeForObjectOrInterfaceField( + oldType.ofType, + newType.ofType, + )) || // moving from nullable to non-null of the same underlying type is safe + (isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); + } + + if (isNonNullType(oldType)) { + // if they're both non-null, make sure the underlying types are compatible + return ( + isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) + ); + } + + return ( + // if they're both named types, see if their names are equivalent + (isNamedType(newType) && oldType.name === newType.name) || // moving from nullable to non-null of the same underlying type is safe + (isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); +} + +function isChangeSafeForInputObjectFieldOrFieldArg(oldType, newType) { + if (isListType(oldType)) { + // if they're both lists, make sure the underlying types are compatible + return ( + isListType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) + ); + } + + if (isNonNullType(oldType)) { + return ( + // if they're both non-null, make sure the underlying types are + // compatible + (isNonNullType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg( + oldType.ofType, + newType.ofType, + )) || // moving from non-null to nullable of the same underlying type is safe + (!isNonNullType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)) + ); + } // if they're both named types, see if their names are equivalent + + return isNamedType(newType) && oldType.name === newType.name; +} + +function typeKindName(type) { + if (isScalarType(type)) { + return 'a Scalar type'; + } + + if (isObjectType(type)) { + return 'an Object type'; + } + + if (isInterfaceType(type)) { + return 'an Interface type'; + } + + if (isUnionType(type)) { + return 'a Union type'; + } + + if (isEnumType(type)) { + return 'an Enum type'; + } + + if (isInputObjectType(type)) { + return 'an Input type'; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function stringifyValue(value, type) { + const ast = astFromValue(value, type); + ast != null || invariant(false); + return print(sortValueNode(ast)); +} + +function diff(oldArray, newArray) { + const added = []; + const removed = []; + const persisted = []; + const oldMap = keyMap(oldArray, ({ name }) => name); + const newMap = keyMap(newArray, ({ name }) => name); + + for (const oldItem of oldArray) { + const newItem = newMap[oldItem.name]; + + if (newItem === undefined) { + removed.push(oldItem); + } else { + persisted.push([oldItem, newItem]); + } + } + + for (const newItem of newArray) { + if (oldMap[newItem.name] === undefined) { + added.push(newItem); + } + } + + return { + added, + persisted, + removed, + }; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.d.ts b/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.d.ts new file mode 100644 index 0000000..9f80268 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.d.ts @@ -0,0 +1,182 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DirectiveLocation } from '../language/directiveLocation'; +export interface IntrospectionOptions { + /** + * Whether to include descriptions in the introspection result. + * Default: true + */ + descriptions?: boolean; + /** + * Whether to include `specifiedByURL` in the introspection result. + * Default: false + */ + specifiedByUrl?: boolean; + /** + * Whether to include `isRepeatable` flag on directives. + * Default: false + */ + directiveIsRepeatable?: boolean; + /** + * Whether to include `description` field on schema. + * Default: false + */ + schemaDescription?: boolean; + /** + * Whether target GraphQL server support deprecation of input values. + * Default: false + */ + inputValueDeprecation?: boolean; +} +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + */ +export declare function getIntrospectionQuery( + options?: IntrospectionOptions, +): string; +export interface IntrospectionQuery { + readonly __schema: IntrospectionSchema; +} +export interface IntrospectionSchema { + readonly description?: Maybe; + readonly queryType: IntrospectionNamedTypeRef; + readonly mutationType: Maybe< + IntrospectionNamedTypeRef + >; + readonly subscriptionType: Maybe< + IntrospectionNamedTypeRef + >; + readonly types: ReadonlyArray; + readonly directives: ReadonlyArray; +} +export declare type IntrospectionType = + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType + | IntrospectionInputObjectType; +export declare type IntrospectionOutputType = + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType; +export declare type IntrospectionInputType = + | IntrospectionScalarType + | IntrospectionEnumType + | IntrospectionInputObjectType; +export interface IntrospectionScalarType { + readonly kind: 'SCALAR'; + readonly name: string; + readonly description?: Maybe; + readonly specifiedByURL?: Maybe; +} +export interface IntrospectionObjectType { + readonly kind: 'OBJECT'; + readonly name: string; + readonly description?: Maybe; + readonly fields: ReadonlyArray; + readonly interfaces: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} +export interface IntrospectionInterfaceType { + readonly kind: 'INTERFACE'; + readonly name: string; + readonly description?: Maybe; + readonly fields: ReadonlyArray; + readonly interfaces: ReadonlyArray< + IntrospectionNamedTypeRef + >; + readonly possibleTypes: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} +export interface IntrospectionUnionType { + readonly kind: 'UNION'; + readonly name: string; + readonly description?: Maybe; + readonly possibleTypes: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} +export interface IntrospectionEnumType { + readonly kind: 'ENUM'; + readonly name: string; + readonly description?: Maybe; + readonly enumValues: ReadonlyArray; +} +export interface IntrospectionInputObjectType { + readonly kind: 'INPUT_OBJECT'; + readonly name: string; + readonly description?: Maybe; + readonly inputFields: ReadonlyArray; +} +export interface IntrospectionListTypeRef< + T extends IntrospectionTypeRef = IntrospectionTypeRef, +> { + readonly kind: 'LIST'; + readonly ofType: T; +} +export interface IntrospectionNonNullTypeRef< + T extends IntrospectionTypeRef = IntrospectionTypeRef, +> { + readonly kind: 'NON_NULL'; + readonly ofType: T; +} +export declare type IntrospectionTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + IntrospectionNamedTypeRef | IntrospectionListTypeRef + >; +export declare type IntrospectionOutputTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + >; +export declare type IntrospectionInputTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + >; +export interface IntrospectionNamedTypeRef< + T extends IntrospectionType = IntrospectionType, +> { + readonly kind: T['kind']; + readonly name: string; +} +export interface IntrospectionField { + readonly name: string; + readonly description?: Maybe; + readonly args: ReadonlyArray; + readonly type: IntrospectionOutputTypeRef; + readonly isDeprecated: boolean; + readonly deprecationReason: Maybe; +} +export interface IntrospectionInputValue { + readonly name: string; + readonly description?: Maybe; + readonly type: IntrospectionInputTypeRef; + readonly defaultValue: Maybe; + readonly isDeprecated?: boolean; + readonly deprecationReason?: Maybe; +} +export interface IntrospectionEnumValue { + readonly name: string; + readonly description?: Maybe; + readonly isDeprecated: boolean; + readonly deprecationReason: Maybe; +} +export interface IntrospectionDirective { + readonly name: string; + readonly description?: Maybe; + readonly isRepeatable?: boolean; + readonly locations: ReadonlyArray; + readonly args: ReadonlyArray; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.js b/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.js new file mode 100644 index 0000000..415ffc0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.js @@ -0,0 +1,142 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getIntrospectionQuery = getIntrospectionQuery; + +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + */ +function getIntrospectionQuery(options) { + const optionsWithDefault = { + descriptions: true, + specifiedByUrl: false, + directiveIsRepeatable: false, + schemaDescription: false, + inputValueDeprecation: false, + ...options, + }; + const descriptions = optionsWithDefault.descriptions ? 'description' : ''; + const specifiedByUrl = optionsWithDefault.specifiedByUrl + ? 'specifiedByURL' + : ''; + const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable + ? 'isRepeatable' + : ''; + const schemaDescription = optionsWithDefault.schemaDescription + ? descriptions + : ''; + + function inputDeprecation(str) { + return optionsWithDefault.inputValueDeprecation ? str : ''; + } + + return ` + query IntrospectionQuery { + __schema { + ${schemaDescription} + queryType { name } + mutationType { name } + subscriptionType { name } + types { + ...FullType + } + directives { + name + ${descriptions} + ${directiveIsRepeatable} + locations + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + ${descriptions} + ${specifiedByUrl} + fields(includeDeprecated: true) { + name + ${descriptions} + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + ${descriptions} + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + ${descriptions} + type { ...TypeRef } + defaultValue + ${inputDeprecation('isDeprecated')} + ${inputDeprecation('deprecationReason')} + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + } + } + } + } + } + } + `; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.mjs b/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.mjs new file mode 100644 index 0000000..ed12f29 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getIntrospectionQuery.mjs @@ -0,0 +1,135 @@ +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + */ +export function getIntrospectionQuery(options) { + const optionsWithDefault = { + descriptions: true, + specifiedByUrl: false, + directiveIsRepeatable: false, + schemaDescription: false, + inputValueDeprecation: false, + ...options, + }; + const descriptions = optionsWithDefault.descriptions ? 'description' : ''; + const specifiedByUrl = optionsWithDefault.specifiedByUrl + ? 'specifiedByURL' + : ''; + const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable + ? 'isRepeatable' + : ''; + const schemaDescription = optionsWithDefault.schemaDescription + ? descriptions + : ''; + + function inputDeprecation(str) { + return optionsWithDefault.inputValueDeprecation ? str : ''; + } + + return ` + query IntrospectionQuery { + __schema { + ${schemaDescription} + queryType { name } + mutationType { name } + subscriptionType { name } + types { + ...FullType + } + directives { + name + ${descriptions} + ${directiveIsRepeatable} + locations + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + ${descriptions} + ${specifiedByUrl} + fields(includeDeprecated: true) { + name + ${descriptions} + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + ${descriptions} + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + ${descriptions} + type { ...TypeRef } + defaultValue + ${inputDeprecation('isDeprecated')} + ${inputDeprecation('deprecationReason')} + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + } + } + } + } + } + } + `; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/getOperationAST.d.ts b/graphql-subscription/node_modules/graphql/utilities/getOperationAST.d.ts new file mode 100644 index 0000000..238cdbd --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getOperationAST.d.ts @@ -0,0 +1,11 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { DocumentNode, OperationDefinitionNode } from '../language/ast'; +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ +export declare function getOperationAST( + documentAST: DocumentNode, + operationName?: Maybe, +): Maybe; diff --git a/graphql-subscription/node_modules/graphql/utilities/getOperationAST.js b/graphql-subscription/node_modules/graphql/utilities/getOperationAST.js new file mode 100644 index 0000000..c102b9a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getOperationAST.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getOperationAST = getOperationAST; + +var _kinds = require('../language/kinds.js'); + +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ +function getOperationAST(documentAST, operationName) { + let operation = null; + + for (const definition of documentAST.definitions) { + if (definition.kind === _kinds.Kind.OPERATION_DEFINITION) { + var _definition$name; + + if (operationName == null) { + // If no operation name was provided, only return an Operation if there + // is one defined in the document. Upon encountering the second, return + // null. + if (operation) { + return null; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + return definition; + } + } + } + + return operation; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/getOperationAST.mjs b/graphql-subscription/node_modules/graphql/utilities/getOperationAST.mjs new file mode 100644 index 0000000..8d1f5b9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getOperationAST.mjs @@ -0,0 +1,36 @@ +import { Kind } from '../language/kinds.mjs'; +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ + +export function getOperationAST(documentAST, operationName) { + let operation = null; + + for (const definition of documentAST.definitions) { + if (definition.kind === Kind.OPERATION_DEFINITION) { + var _definition$name; + + if (operationName == null) { + // If no operation name was provided, only return an Operation if there + // is one defined in the document. Upon encountering the second, return + // null. + if (operation) { + return null; + } + + operation = definition; + } else if ( + ((_definition$name = definition.name) === null || + _definition$name === void 0 + ? void 0 + : _definition$name.value) === operationName + ) { + return definition; + } + } + } + + return operation; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.d.ts b/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.d.ts new file mode 100644 index 0000000..fb813c6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.d.ts @@ -0,0 +1,15 @@ +import type { + OperationDefinitionNode, + OperationTypeDefinitionNode, +} from '../language/ast'; +import type { GraphQLObjectType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +export declare function getOperationRootType( + schema: GraphQLSchema, + operation: OperationDefinitionNode | OperationTypeDefinitionNode, +): GraphQLObjectType; diff --git a/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.js b/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.js new file mode 100644 index 0000000..957f737 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.js @@ -0,0 +1,67 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.getOperationRootType = getOperationRootType; + +var _GraphQLError = require('../error/GraphQLError.js'); + +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +function getOperationRootType(schema, operation) { + if (operation.operation === 'query') { + const queryType = schema.getQueryType(); + + if (!queryType) { + throw new _GraphQLError.GraphQLError( + 'Schema does not define the required query root type.', + { + nodes: operation, + }, + ); + } + + return queryType; + } + + if (operation.operation === 'mutation') { + const mutationType = schema.getMutationType(); + + if (!mutationType) { + throw new _GraphQLError.GraphQLError( + 'Schema is not configured for mutations.', + { + nodes: operation, + }, + ); + } + + return mutationType; + } + + if (operation.operation === 'subscription') { + const subscriptionType = schema.getSubscriptionType(); + + if (!subscriptionType) { + throw new _GraphQLError.GraphQLError( + 'Schema is not configured for subscriptions.', + { + nodes: operation, + }, + ); + } + + return subscriptionType; + } + + throw new _GraphQLError.GraphQLError( + 'Can only have query, mutation and subscription operations.', + { + nodes: operation, + }, + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.mjs b/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.mjs new file mode 100644 index 0000000..27855c5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/getOperationRootType.mjs @@ -0,0 +1,54 @@ +import { GraphQLError } from '../error/GraphQLError.mjs'; + +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +export function getOperationRootType(schema, operation) { + if (operation.operation === 'query') { + const queryType = schema.getQueryType(); + + if (!queryType) { + throw new GraphQLError( + 'Schema does not define the required query root type.', + { + nodes: operation, + }, + ); + } + + return queryType; + } + + if (operation.operation === 'mutation') { + const mutationType = schema.getMutationType(); + + if (!mutationType) { + throw new GraphQLError('Schema is not configured for mutations.', { + nodes: operation, + }); + } + + return mutationType; + } + + if (operation.operation === 'subscription') { + const subscriptionType = schema.getSubscriptionType(); + + if (!subscriptionType) { + throw new GraphQLError('Schema is not configured for subscriptions.', { + nodes: operation, + }); + } + + return subscriptionType; + } + + throw new GraphQLError( + 'Can only have query, mutation and subscription operations.', + { + nodes: operation, + }, + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/index.d.ts b/graphql-subscription/node_modules/graphql/utilities/index.d.ts new file mode 100644 index 0000000..ba8a7fd --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/index.d.ts @@ -0,0 +1,61 @@ +export { getIntrospectionQuery } from './getIntrospectionQuery'; +export type { + IntrospectionOptions, + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionInputType, + IntrospectionOutputType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionInputTypeRef, + IntrospectionOutputTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, +} from './getIntrospectionQuery'; +export { getOperationAST } from './getOperationAST'; +export { getOperationRootType } from './getOperationRootType'; +export { introspectionFromSchema } from './introspectionFromSchema'; +export { buildClientSchema } from './buildClientSchema'; +export { buildASTSchema, buildSchema } from './buildASTSchema'; +export type { BuildSchemaOptions } from './buildASTSchema'; +export { extendSchema } from './extendSchema'; +export { lexicographicSortSchema } from './lexicographicSortSchema'; +export { + printSchema, + printType, + printIntrospectionSchema, +} from './printSchema'; +export { typeFromAST } from './typeFromAST'; +export { valueFromAST } from './valueFromAST'; +export { valueFromASTUntyped } from './valueFromASTUntyped'; +export { astFromValue } from './astFromValue'; +export { TypeInfo, visitWithTypeInfo } from './TypeInfo'; +export { coerceInputValue } from './coerceInputValue'; +export { concatAST } from './concatAST'; +export { separateOperations } from './separateOperations'; +export { stripIgnoredCharacters } from './stripIgnoredCharacters'; +export { + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, +} from './typeComparators'; +export { assertValidName, isValidNameError } from './assertValidName'; +export { + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './findBreakingChanges'; +export type { BreakingChange, DangerousChange } from './findBreakingChanges'; +export type { TypedQueryDocumentNode } from './typedQueryDocumentNode'; diff --git a/graphql-subscription/node_modules/graphql/utilities/index.js b/graphql-subscription/node_modules/graphql/utilities/index.js new file mode 100644 index 0000000..ed50c3e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/index.js @@ -0,0 +1,233 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'BreakingChangeType', { + enumerable: true, + get: function () { + return _findBreakingChanges.BreakingChangeType; + }, +}); +Object.defineProperty(exports, 'DangerousChangeType', { + enumerable: true, + get: function () { + return _findBreakingChanges.DangerousChangeType; + }, +}); +Object.defineProperty(exports, 'TypeInfo', { + enumerable: true, + get: function () { + return _TypeInfo.TypeInfo; + }, +}); +Object.defineProperty(exports, 'assertValidName', { + enumerable: true, + get: function () { + return _assertValidName.assertValidName; + }, +}); +Object.defineProperty(exports, 'astFromValue', { + enumerable: true, + get: function () { + return _astFromValue.astFromValue; + }, +}); +Object.defineProperty(exports, 'buildASTSchema', { + enumerable: true, + get: function () { + return _buildASTSchema.buildASTSchema; + }, +}); +Object.defineProperty(exports, 'buildClientSchema', { + enumerable: true, + get: function () { + return _buildClientSchema.buildClientSchema; + }, +}); +Object.defineProperty(exports, 'buildSchema', { + enumerable: true, + get: function () { + return _buildASTSchema.buildSchema; + }, +}); +Object.defineProperty(exports, 'coerceInputValue', { + enumerable: true, + get: function () { + return _coerceInputValue.coerceInputValue; + }, +}); +Object.defineProperty(exports, 'concatAST', { + enumerable: true, + get: function () { + return _concatAST.concatAST; + }, +}); +Object.defineProperty(exports, 'doTypesOverlap', { + enumerable: true, + get: function () { + return _typeComparators.doTypesOverlap; + }, +}); +Object.defineProperty(exports, 'extendSchema', { + enumerable: true, + get: function () { + return _extendSchema.extendSchema; + }, +}); +Object.defineProperty(exports, 'findBreakingChanges', { + enumerable: true, + get: function () { + return _findBreakingChanges.findBreakingChanges; + }, +}); +Object.defineProperty(exports, 'findDangerousChanges', { + enumerable: true, + get: function () { + return _findBreakingChanges.findDangerousChanges; + }, +}); +Object.defineProperty(exports, 'getIntrospectionQuery', { + enumerable: true, + get: function () { + return _getIntrospectionQuery.getIntrospectionQuery; + }, +}); +Object.defineProperty(exports, 'getOperationAST', { + enumerable: true, + get: function () { + return _getOperationAST.getOperationAST; + }, +}); +Object.defineProperty(exports, 'getOperationRootType', { + enumerable: true, + get: function () { + return _getOperationRootType.getOperationRootType; + }, +}); +Object.defineProperty(exports, 'introspectionFromSchema', { + enumerable: true, + get: function () { + return _introspectionFromSchema.introspectionFromSchema; + }, +}); +Object.defineProperty(exports, 'isEqualType', { + enumerable: true, + get: function () { + return _typeComparators.isEqualType; + }, +}); +Object.defineProperty(exports, 'isTypeSubTypeOf', { + enumerable: true, + get: function () { + return _typeComparators.isTypeSubTypeOf; + }, +}); +Object.defineProperty(exports, 'isValidNameError', { + enumerable: true, + get: function () { + return _assertValidName.isValidNameError; + }, +}); +Object.defineProperty(exports, 'lexicographicSortSchema', { + enumerable: true, + get: function () { + return _lexicographicSortSchema.lexicographicSortSchema; + }, +}); +Object.defineProperty(exports, 'printIntrospectionSchema', { + enumerable: true, + get: function () { + return _printSchema.printIntrospectionSchema; + }, +}); +Object.defineProperty(exports, 'printSchema', { + enumerable: true, + get: function () { + return _printSchema.printSchema; + }, +}); +Object.defineProperty(exports, 'printType', { + enumerable: true, + get: function () { + return _printSchema.printType; + }, +}); +Object.defineProperty(exports, 'separateOperations', { + enumerable: true, + get: function () { + return _separateOperations.separateOperations; + }, +}); +Object.defineProperty(exports, 'stripIgnoredCharacters', { + enumerable: true, + get: function () { + return _stripIgnoredCharacters.stripIgnoredCharacters; + }, +}); +Object.defineProperty(exports, 'typeFromAST', { + enumerable: true, + get: function () { + return _typeFromAST.typeFromAST; + }, +}); +Object.defineProperty(exports, 'valueFromAST', { + enumerable: true, + get: function () { + return _valueFromAST.valueFromAST; + }, +}); +Object.defineProperty(exports, 'valueFromASTUntyped', { + enumerable: true, + get: function () { + return _valueFromASTUntyped.valueFromASTUntyped; + }, +}); +Object.defineProperty(exports, 'visitWithTypeInfo', { + enumerable: true, + get: function () { + return _TypeInfo.visitWithTypeInfo; + }, +}); + +var _getIntrospectionQuery = require('./getIntrospectionQuery.js'); + +var _getOperationAST = require('./getOperationAST.js'); + +var _getOperationRootType = require('./getOperationRootType.js'); + +var _introspectionFromSchema = require('./introspectionFromSchema.js'); + +var _buildClientSchema = require('./buildClientSchema.js'); + +var _buildASTSchema = require('./buildASTSchema.js'); + +var _extendSchema = require('./extendSchema.js'); + +var _lexicographicSortSchema = require('./lexicographicSortSchema.js'); + +var _printSchema = require('./printSchema.js'); + +var _typeFromAST = require('./typeFromAST.js'); + +var _valueFromAST = require('./valueFromAST.js'); + +var _valueFromASTUntyped = require('./valueFromASTUntyped.js'); + +var _astFromValue = require('./astFromValue.js'); + +var _TypeInfo = require('./TypeInfo.js'); + +var _coerceInputValue = require('./coerceInputValue.js'); + +var _concatAST = require('./concatAST.js'); + +var _separateOperations = require('./separateOperations.js'); + +var _stripIgnoredCharacters = require('./stripIgnoredCharacters.js'); + +var _typeComparators = require('./typeComparators.js'); + +var _assertValidName = require('./assertValidName.js'); + +var _findBreakingChanges = require('./findBreakingChanges.js'); diff --git a/graphql-subscription/node_modules/graphql/utilities/index.mjs b/graphql-subscription/node_modules/graphql/utilities/index.mjs new file mode 100644 index 0000000..cb8f6b4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/index.mjs @@ -0,0 +1,55 @@ +// Produce the GraphQL query recommended for a full schema introspection. +export { getIntrospectionQuery } from './getIntrospectionQuery.mjs'; +// Gets the target Operation from a Document. +export { getOperationAST } from './getOperationAST.mjs'; // Gets the Type for the target Operation AST. + +export { getOperationRootType } from './getOperationRootType.mjs'; // Convert a GraphQLSchema to an IntrospectionQuery. + +export { introspectionFromSchema } from './introspectionFromSchema.mjs'; // Build a GraphQLSchema from an introspection result. + +export { buildClientSchema } from './buildClientSchema.mjs'; // Build a GraphQLSchema from GraphQL Schema language. + +export { buildASTSchema, buildSchema } from './buildASTSchema.mjs'; +// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. +export { extendSchema } from './extendSchema.mjs'; // Sort a GraphQLSchema. + +export { lexicographicSortSchema } from './lexicographicSortSchema.mjs'; // Print a GraphQLSchema to GraphQL Schema language. + +export { + printSchema, + printType, + printIntrospectionSchema, +} from './printSchema.mjs'; // Create a GraphQLType from a GraphQL language AST. + +export { typeFromAST } from './typeFromAST.mjs'; // Create a JavaScript value from a GraphQL language AST with a type. + +export { valueFromAST } from './valueFromAST.mjs'; // Create a JavaScript value from a GraphQL language AST without a type. + +export { valueFromASTUntyped } from './valueFromASTUntyped.mjs'; // Create a GraphQL language AST from a JavaScript value. + +export { astFromValue } from './astFromValue.mjs'; // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. + +export { TypeInfo, visitWithTypeInfo } from './TypeInfo.mjs'; // Coerces a JavaScript value to a GraphQL type, or produces errors. + +export { coerceInputValue } from './coerceInputValue.mjs'; // Concatenates multiple AST together. + +export { concatAST } from './concatAST.mjs'; // Separates an AST into an AST per Operation. + +export { separateOperations } from './separateOperations.mjs'; // Strips characters that are not significant to the validity or execution of a GraphQL document. + +export { stripIgnoredCharacters } from './stripIgnoredCharacters.mjs'; // Comparators for types + +export { + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, +} from './typeComparators.mjs'; // Asserts that a string is a valid GraphQL name + +export { assertValidName, isValidNameError } from './assertValidName.mjs'; // Compares two GraphQLSchemas and detects breaking changes. + +export { + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './findBreakingChanges.mjs'; diff --git a/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.d.ts b/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.d.ts new file mode 100644 index 0000000..8d70191 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.d.ts @@ -0,0 +1,18 @@ +import type { GraphQLSchema } from '../type/schema'; +import type { + IntrospectionOptions, + IntrospectionQuery, +} from './getIntrospectionQuery'; +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ +export declare function introspectionFromSchema( + schema: GraphQLSchema, + options?: IntrospectionOptions, +): IntrospectionQuery; diff --git a/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.js b/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.js new file mode 100644 index 0000000..aef2e5a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.introspectionFromSchema = introspectionFromSchema; + +var _invariant = require('../jsutils/invariant.js'); + +var _parser = require('../language/parser.js'); + +var _execute = require('../execution/execute.js'); + +var _getIntrospectionQuery = require('./getIntrospectionQuery.js'); + +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ +function introspectionFromSchema(schema, options) { + const optionsWithDefaults = { + specifiedByUrl: true, + directiveIsRepeatable: true, + schemaDescription: true, + inputValueDeprecation: true, + ...options, + }; + const document = (0, _parser.parse)( + (0, _getIntrospectionQuery.getIntrospectionQuery)(optionsWithDefaults), + ); + const result = (0, _execute.executeSync)({ + schema, + document, + }); + (!result.errors && result.data) || (0, _invariant.invariant)(false); + return result.data; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.mjs b/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.mjs new file mode 100644 index 0000000..6ad7b1f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/introspectionFromSchema.mjs @@ -0,0 +1,30 @@ +import { invariant } from '../jsutils/invariant.mjs'; +import { parse } from '../language/parser.mjs'; +import { executeSync } from '../execution/execute.mjs'; +import { getIntrospectionQuery } from './getIntrospectionQuery.mjs'; +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ + +export function introspectionFromSchema(schema, options) { + const optionsWithDefaults = { + specifiedByUrl: true, + directiveIsRepeatable: true, + schemaDescription: true, + inputValueDeprecation: true, + ...options, + }; + const document = parse(getIntrospectionQuery(optionsWithDefaults)); + const result = executeSync({ + schema, + document, + }); + (!result.errors && result.data) || invariant(false); + return result.data; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.d.ts b/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.d.ts new file mode 100644 index 0000000..01855d9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.d.ts @@ -0,0 +1,9 @@ +import { GraphQLSchema } from '../type/schema'; +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ +export declare function lexicographicSortSchema( + schema: GraphQLSchema, +): GraphQLSchema; diff --git a/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.js b/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.js new file mode 100644 index 0000000..ea884b6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.js @@ -0,0 +1,177 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.lexicographicSortSchema = lexicographicSortSchema; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _naturalCompare = require('../jsutils/naturalCompare.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _schema = require('../type/schema.js'); + +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ +function lexicographicSortSchema(schema) { + const schemaConfig = schema.toConfig(); + const typeMap = (0, _keyValMap.keyValMap)( + sortByName(schemaConfig.types), + (type) => type.name, + sortNamedType, + ); + return new _schema.GraphQLSchema({ + ...schemaConfig, + types: Object.values(typeMap), + directives: sortByName(schemaConfig.directives).map(sortDirective), + query: replaceMaybeType(schemaConfig.query), + mutation: replaceMaybeType(schemaConfig.mutation), + subscription: replaceMaybeType(schemaConfig.subscription), + }); + + function replaceType(type) { + if ((0, _definition.isListType)(type)) { + // @ts-expect-error + return new _definition.GraphQLList(replaceType(type.ofType)); + } else if ((0, _definition.isNonNullType)(type)) { + // @ts-expect-error + return new _definition.GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME: TS Conversion + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + return typeMap[type.name]; + } + + function replaceMaybeType(maybeType) { + return maybeType && replaceNamedType(maybeType); + } + + function sortDirective(directive) { + const config = directive.toConfig(); + return new _directives.GraphQLDirective({ + ...config, + locations: sortBy(config.locations, (x) => x), + args: sortArgs(config.args), + }); + } + + function sortArgs(args) { + return sortObjMap(args, (arg) => ({ ...arg, type: replaceType(arg.type) })); + } + + function sortFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + args: field.args && sortArgs(field.args), + })); + } + + function sortInputFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + })); + } + + function sortTypes(array) { + return sortByName(array).map(replaceNamedType); + } + + function sortNamedType(type) { + if ( + (0, _definition.isScalarType)(type) || + (0, _introspection.isIntrospectionType)(type) + ) { + return type; + } + + if ((0, _definition.isObjectType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLObjectType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if ((0, _definition.isInterfaceType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLInterfaceType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if ((0, _definition.isUnionType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLUnionType({ + ...config, + types: () => sortTypes(config.types), + }); + } + + if ((0, _definition.isEnumType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLEnumType({ + ...config, + values: sortObjMap(config.values, (value) => value), + }); + } + + if ((0, _definition.isInputObjectType)(type)) { + const config = type.toConfig(); + return new _definition.GraphQLInputObjectType({ + ...config, + fields: () => sortInputFields(config.fields), + }); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); + } +} + +function sortObjMap(map, sortValueFn) { + const sortedMap = Object.create(null); + + for (const key of Object.keys(map).sort(_naturalCompare.naturalCompare)) { + sortedMap[key] = sortValueFn(map[key]); + } + + return sortedMap; +} + +function sortByName(array) { + return sortBy(array, (obj) => obj.name); +} + +function sortBy(array, mapToKey) { + return array.slice().sort((obj1, obj2) => { + const key1 = mapToKey(obj1); + const key2 = mapToKey(obj2); + return (0, _naturalCompare.naturalCompare)(key1, key2); + }); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.mjs b/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.mjs new file mode 100644 index 0000000..b734adb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/lexicographicSortSchema.mjs @@ -0,0 +1,172 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { naturalCompare } from '../jsutils/naturalCompare.mjs'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLUnionType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { GraphQLDirective } from '../type/directives.mjs'; +import { isIntrospectionType } from '../type/introspection.mjs'; +import { GraphQLSchema } from '../type/schema.mjs'; +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ + +export function lexicographicSortSchema(schema) { + const schemaConfig = schema.toConfig(); + const typeMap = keyValMap( + sortByName(schemaConfig.types), + (type) => type.name, + sortNamedType, + ); + return new GraphQLSchema({ + ...schemaConfig, + types: Object.values(typeMap), + directives: sortByName(schemaConfig.directives).map(sortDirective), + query: replaceMaybeType(schemaConfig.query), + mutation: replaceMaybeType(schemaConfig.mutation), + subscription: replaceMaybeType(schemaConfig.subscription), + }); + + function replaceType(type) { + if (isListType(type)) { + // @ts-expect-error + return new GraphQLList(replaceType(type.ofType)); + } else if (isNonNullType(type)) { + // @ts-expect-error + return new GraphQLNonNull(replaceType(type.ofType)); + } // @ts-expect-error FIXME: TS Conversion + + return replaceNamedType(type); + } + + function replaceNamedType(type) { + return typeMap[type.name]; + } + + function replaceMaybeType(maybeType) { + return maybeType && replaceNamedType(maybeType); + } + + function sortDirective(directive) { + const config = directive.toConfig(); + return new GraphQLDirective({ + ...config, + locations: sortBy(config.locations, (x) => x), + args: sortArgs(config.args), + }); + } + + function sortArgs(args) { + return sortObjMap(args, (arg) => ({ ...arg, type: replaceType(arg.type) })); + } + + function sortFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + args: field.args && sortArgs(field.args), + })); + } + + function sortInputFields(fieldsMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + })); + } + + function sortTypes(array) { + return sortByName(array).map(replaceNamedType); + } + + function sortNamedType(type) { + if (isScalarType(type) || isIntrospectionType(type)) { + return type; + } + + if (isObjectType(type)) { + const config = type.toConfig(); + return new GraphQLObjectType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if (isInterfaceType(type)) { + const config = type.toConfig(); + return new GraphQLInterfaceType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + + if (isUnionType(type)) { + const config = type.toConfig(); + return new GraphQLUnionType({ + ...config, + types: () => sortTypes(config.types), + }); + } + + if (isEnumType(type)) { + const config = type.toConfig(); + return new GraphQLEnumType({ + ...config, + values: sortObjMap(config.values, (value) => value), + }); + } + + if (isInputObjectType(type)) { + const config = type.toConfig(); + return new GraphQLInputObjectType({ + ...config, + fields: () => sortInputFields(config.fields), + }); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); + } +} + +function sortObjMap(map, sortValueFn) { + const sortedMap = Object.create(null); + + for (const key of Object.keys(map).sort(naturalCompare)) { + sortedMap[key] = sortValueFn(map[key]); + } + + return sortedMap; +} + +function sortByName(array) { + return sortBy(array, (obj) => obj.name); +} + +function sortBy(array, mapToKey) { + return array.slice().sort((obj1, obj2) => { + const key1 = mapToKey(obj1); + const key2 = mapToKey(obj2); + return naturalCompare(key1, key2); + }); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/printSchema.d.ts b/graphql-subscription/node_modules/graphql/utilities/printSchema.d.ts new file mode 100644 index 0000000..5369adb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/printSchema.d.ts @@ -0,0 +1,5 @@ +import type { GraphQLNamedType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +export declare function printSchema(schema: GraphQLSchema): string; +export declare function printIntrospectionSchema(schema: GraphQLSchema): string; +export declare function printType(type: GraphQLNamedType): string; diff --git a/graphql-subscription/node_modules/graphql/utilities/printSchema.js b/graphql-subscription/node_modules/graphql/utilities/printSchema.js new file mode 100644 index 0000000..0d47611 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/printSchema.js @@ -0,0 +1,333 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.printIntrospectionSchema = printIntrospectionSchema; +exports.printSchema = printSchema; +exports.printType = printType; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _blockString = require('../language/blockString.js'); + +var _kinds = require('../language/kinds.js'); + +var _printer = require('../language/printer.js'); + +var _definition = require('../type/definition.js'); + +var _directives = require('../type/directives.js'); + +var _introspection = require('../type/introspection.js'); + +var _scalars = require('../type/scalars.js'); + +var _astFromValue = require('./astFromValue.js'); + +function printSchema(schema) { + return printFilteredSchema( + schema, + (n) => !(0, _directives.isSpecifiedDirective)(n), + isDefinedType, + ); +} + +function printIntrospectionSchema(schema) { + return printFilteredSchema( + schema, + _directives.isSpecifiedDirective, + _introspection.isIntrospectionType, + ); +} + +function isDefinedType(type) { + return ( + !(0, _scalars.isSpecifiedScalarType)(type) && + !(0, _introspection.isIntrospectionType)(type) + ); +} + +function printFilteredSchema(schema, directiveFilter, typeFilter) { + const directives = schema.getDirectives().filter(directiveFilter); + const types = Object.values(schema.getTypeMap()).filter(typeFilter); + return [ + printSchemaDefinition(schema), + ...directives.map((directive) => printDirective(directive)), + ...types.map((type) => printType(type)), + ] + .filter(Boolean) + .join('\n\n'); +} + +function printSchemaDefinition(schema) { + if (schema.description == null && isSchemaOfCommonNames(schema)) { + return; + } + + const operationTypes = []; + const queryType = schema.getQueryType(); + + if (queryType) { + operationTypes.push(` query: ${queryType.name}`); + } + + const mutationType = schema.getMutationType(); + + if (mutationType) { + operationTypes.push(` mutation: ${mutationType.name}`); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + operationTypes.push(` subscription: ${subscriptionType.name}`); + } + + return printDescription(schema) + `schema {\n${operationTypes.join('\n')}\n}`; +} +/** + * GraphQL schema define root types for each type of operation. These types are + * the same as any other type and can be named in any manner, however there is + * a common naming convention: + * + * ```graphql + * schema { + * query: Query + * mutation: Mutation + * subscription: Subscription + * } + * ``` + * + * When using this naming convention, the schema description can be omitted. + */ + +function isSchemaOfCommonNames(schema) { + const queryType = schema.getQueryType(); + + if (queryType && queryType.name !== 'Query') { + return false; + } + + const mutationType = schema.getMutationType(); + + if (mutationType && mutationType.name !== 'Mutation') { + return false; + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && subscriptionType.name !== 'Subscription') { + return false; + } + + return true; +} + +function printType(type) { + if ((0, _definition.isScalarType)(type)) { + return printScalar(type); + } + + if ((0, _definition.isObjectType)(type)) { + return printObject(type); + } + + if ((0, _definition.isInterfaceType)(type)) { + return printInterface(type); + } + + if ((0, _definition.isUnionType)(type)) { + return printUnion(type); + } + + if ((0, _definition.isEnumType)(type)) { + return printEnum(type); + } + + if ((0, _definition.isInputObjectType)(type)) { + return printInputObject(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); +} + +function printScalar(type) { + return ( + printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type) + ); +} + +function printImplementedInterfaces(type) { + const interfaces = type.getInterfaces(); + return interfaces.length + ? ' implements ' + interfaces.map((i) => i.name).join(' & ') + : ''; +} + +function printObject(type) { + return ( + printDescription(type) + + `type ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printInterface(type) { + return ( + printDescription(type) + + `interface ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printUnion(type) { + const types = type.getTypes(); + const possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; + return printDescription(type) + 'union ' + type.name + possibleTypes; +} + +function printEnum(type) { + const values = type + .getValues() + .map( + (value, i) => + printDescription(value, ' ', !i) + + ' ' + + value.name + + printDeprecated(value.deprecationReason), + ); + return printDescription(type) + `enum ${type.name}` + printBlock(values); +} + +function printInputObject(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => printDescription(f, ' ', !i) + ' ' + printInputValue(f), + ); + return printDescription(type) + `input ${type.name}` + printBlock(fields); +} + +function printFields(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => + printDescription(f, ' ', !i) + + ' ' + + f.name + + printArgs(f.args, ' ') + + ': ' + + String(f.type) + + printDeprecated(f.deprecationReason), + ); + return printBlock(fields); +} + +function printBlock(items) { + return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; +} + +function printArgs(args, indentation = '') { + if (args.length === 0) { + return ''; + } // If every arg does not have a description, print them on one line. + + if (args.every((arg) => !arg.description)) { + return '(' + args.map(printInputValue).join(', ') + ')'; + } + + return ( + '(\n' + + args + .map( + (arg, i) => + printDescription(arg, ' ' + indentation, !i) + + ' ' + + indentation + + printInputValue(arg), + ) + .join('\n') + + '\n' + + indentation + + ')' + ); +} + +function printInputValue(arg) { + const defaultAST = (0, _astFromValue.astFromValue)( + arg.defaultValue, + arg.type, + ); + let argDecl = arg.name + ': ' + String(arg.type); + + if (defaultAST) { + argDecl += ` = ${(0, _printer.print)(defaultAST)}`; + } + + return argDecl + printDeprecated(arg.deprecationReason); +} + +function printDirective(directive) { + return ( + printDescription(directive) + + 'directive @' + + directive.name + + printArgs(directive.args) + + (directive.isRepeatable ? ' repeatable' : '') + + ' on ' + + directive.locations.join(' | ') + ); +} + +function printDeprecated(reason) { + if (reason == null) { + return ''; + } + + if (reason !== _directives.DEFAULT_DEPRECATION_REASON) { + const astValue = (0, _printer.print)({ + kind: _kinds.Kind.STRING, + value: reason, + }); + return ` @deprecated(reason: ${astValue})`; + } + + return ' @deprecated'; +} + +function printSpecifiedByURL(scalar) { + if (scalar.specifiedByURL == null) { + return ''; + } + + const astValue = (0, _printer.print)({ + kind: _kinds.Kind.STRING, + value: scalar.specifiedByURL, + }); + return ` @specifiedBy(url: ${astValue})`; +} + +function printDescription(def, indentation = '', firstInBlock = true) { + const { description } = def; + + if (description == null) { + return ''; + } + + const blockString = (0, _printer.print)({ + kind: _kinds.Kind.STRING, + value: description, + block: (0, _blockString.isPrintableAsBlockString)(description), + }); + const prefix = + indentation && !firstInBlock ? '\n' + indentation : indentation; + return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/printSchema.mjs b/graphql-subscription/node_modules/graphql/utilities/printSchema.mjs new file mode 100644 index 0000000..9d0643b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/printSchema.mjs @@ -0,0 +1,309 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { isPrintableAsBlockString } from '../language/blockString.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { print } from '../language/printer.mjs'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition.mjs'; +import { + DEFAULT_DEPRECATION_REASON, + isSpecifiedDirective, +} from '../type/directives.mjs'; +import { isIntrospectionType } from '../type/introspection.mjs'; +import { isSpecifiedScalarType } from '../type/scalars.mjs'; +import { astFromValue } from './astFromValue.mjs'; +export function printSchema(schema) { + return printFilteredSchema( + schema, + (n) => !isSpecifiedDirective(n), + isDefinedType, + ); +} +export function printIntrospectionSchema(schema) { + return printFilteredSchema(schema, isSpecifiedDirective, isIntrospectionType); +} + +function isDefinedType(type) { + return !isSpecifiedScalarType(type) && !isIntrospectionType(type); +} + +function printFilteredSchema(schema, directiveFilter, typeFilter) { + const directives = schema.getDirectives().filter(directiveFilter); + const types = Object.values(schema.getTypeMap()).filter(typeFilter); + return [ + printSchemaDefinition(schema), + ...directives.map((directive) => printDirective(directive)), + ...types.map((type) => printType(type)), + ] + .filter(Boolean) + .join('\n\n'); +} + +function printSchemaDefinition(schema) { + if (schema.description == null && isSchemaOfCommonNames(schema)) { + return; + } + + const operationTypes = []; + const queryType = schema.getQueryType(); + + if (queryType) { + operationTypes.push(` query: ${queryType.name}`); + } + + const mutationType = schema.getMutationType(); + + if (mutationType) { + operationTypes.push(` mutation: ${mutationType.name}`); + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + operationTypes.push(` subscription: ${subscriptionType.name}`); + } + + return printDescription(schema) + `schema {\n${operationTypes.join('\n')}\n}`; +} +/** + * GraphQL schema define root types for each type of operation. These types are + * the same as any other type and can be named in any manner, however there is + * a common naming convention: + * + * ```graphql + * schema { + * query: Query + * mutation: Mutation + * subscription: Subscription + * } + * ``` + * + * When using this naming convention, the schema description can be omitted. + */ + +function isSchemaOfCommonNames(schema) { + const queryType = schema.getQueryType(); + + if (queryType && queryType.name !== 'Query') { + return false; + } + + const mutationType = schema.getMutationType(); + + if (mutationType && mutationType.name !== 'Mutation') { + return false; + } + + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType && subscriptionType.name !== 'Subscription') { + return false; + } + + return true; +} + +export function printType(type) { + if (isScalarType(type)) { + return printScalar(type); + } + + if (isObjectType(type)) { + return printObject(type); + } + + if (isInterfaceType(type)) { + return printInterface(type); + } + + if (isUnionType(type)) { + return printUnion(type); + } + + if (isEnumType(type)) { + return printEnum(type); + } + + if (isInputObjectType(type)) { + return printInputObject(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + + false || invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function printScalar(type) { + return ( + printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type) + ); +} + +function printImplementedInterfaces(type) { + const interfaces = type.getInterfaces(); + return interfaces.length + ? ' implements ' + interfaces.map((i) => i.name).join(' & ') + : ''; +} + +function printObject(type) { + return ( + printDescription(type) + + `type ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printInterface(type) { + return ( + printDescription(type) + + `interface ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printUnion(type) { + const types = type.getTypes(); + const possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; + return printDescription(type) + 'union ' + type.name + possibleTypes; +} + +function printEnum(type) { + const values = type + .getValues() + .map( + (value, i) => + printDescription(value, ' ', !i) + + ' ' + + value.name + + printDeprecated(value.deprecationReason), + ); + return printDescription(type) + `enum ${type.name}` + printBlock(values); +} + +function printInputObject(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => printDescription(f, ' ', !i) + ' ' + printInputValue(f), + ); + return printDescription(type) + `input ${type.name}` + printBlock(fields); +} + +function printFields(type) { + const fields = Object.values(type.getFields()).map( + (f, i) => + printDescription(f, ' ', !i) + + ' ' + + f.name + + printArgs(f.args, ' ') + + ': ' + + String(f.type) + + printDeprecated(f.deprecationReason), + ); + return printBlock(fields); +} + +function printBlock(items) { + return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; +} + +function printArgs(args, indentation = '') { + if (args.length === 0) { + return ''; + } // If every arg does not have a description, print them on one line. + + if (args.every((arg) => !arg.description)) { + return '(' + args.map(printInputValue).join(', ') + ')'; + } + + return ( + '(\n' + + args + .map( + (arg, i) => + printDescription(arg, ' ' + indentation, !i) + + ' ' + + indentation + + printInputValue(arg), + ) + .join('\n') + + '\n' + + indentation + + ')' + ); +} + +function printInputValue(arg) { + const defaultAST = astFromValue(arg.defaultValue, arg.type); + let argDecl = arg.name + ': ' + String(arg.type); + + if (defaultAST) { + argDecl += ` = ${print(defaultAST)}`; + } + + return argDecl + printDeprecated(arg.deprecationReason); +} + +function printDirective(directive) { + return ( + printDescription(directive) + + 'directive @' + + directive.name + + printArgs(directive.args) + + (directive.isRepeatable ? ' repeatable' : '') + + ' on ' + + directive.locations.join(' | ') + ); +} + +function printDeprecated(reason) { + if (reason == null) { + return ''; + } + + if (reason !== DEFAULT_DEPRECATION_REASON) { + const astValue = print({ + kind: Kind.STRING, + value: reason, + }); + return ` @deprecated(reason: ${astValue})`; + } + + return ' @deprecated'; +} + +function printSpecifiedByURL(scalar) { + if (scalar.specifiedByURL == null) { + return ''; + } + + const astValue = print({ + kind: Kind.STRING, + value: scalar.specifiedByURL, + }); + return ` @specifiedBy(url: ${astValue})`; +} + +function printDescription(def, indentation = '', firstInBlock = true) { + const { description } = def; + + if (description == null) { + return ''; + } + + const blockString = print({ + kind: Kind.STRING, + value: description, + block: isPrintableAsBlockString(description), + }); + const prefix = + indentation && !firstInBlock ? '\n' + indentation : indentation; + return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/separateOperations.d.ts b/graphql-subscription/node_modules/graphql/utilities/separateOperations.d.ts new file mode 100644 index 0000000..d5b80a0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/separateOperations.d.ts @@ -0,0 +1,11 @@ +import type { ObjMap } from '../jsutils/ObjMap'; +import type { DocumentNode } from '../language/ast'; +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ +export declare function separateOperations( + documentAST: DocumentNode, +): ObjMap; diff --git a/graphql-subscription/node_modules/graphql/utilities/separateOperations.js b/graphql-subscription/node_modules/graphql/utilities/separateOperations.js new file mode 100644 index 0000000..5dd37d0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/separateOperations.js @@ -0,0 +1,88 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.separateOperations = separateOperations; + +var _kinds = require('../language/kinds.js'); + +var _visitor = require('../language/visitor.js'); + +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ +function separateOperations(documentAST) { + const operations = []; + const depGraph = Object.create(null); // Populate metadata and build a dependency graph. + + for (const definitionNode of documentAST.definitions) { + switch (definitionNode.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + operations.push(definitionNode); + break; + + case _kinds.Kind.FRAGMENT_DEFINITION: + depGraph[definitionNode.name.value] = collectDependencies( + definitionNode.selectionSet, + ); + break; + + default: // ignore non-executable definitions + } + } // For each operation, produce a new synthesized AST which includes only what + // is necessary for completing that operation. + + const separatedDocumentASTs = Object.create(null); + + for (const operation of operations) { + const dependencies = new Set(); + + for (const fragmentName of collectDependencies(operation.selectionSet)) { + collectTransitiveDependencies(dependencies, depGraph, fragmentName); + } // Provides the empty string for anonymous operations. + + const operationName = operation.name ? operation.name.value : ''; // The list of definition nodes to be included for this operation, sorted + // to retain the same order as the original document. + + separatedDocumentASTs[operationName] = { + kind: _kinds.Kind.DOCUMENT, + definitions: documentAST.definitions.filter( + (node) => + node === operation || + (node.kind === _kinds.Kind.FRAGMENT_DEFINITION && + dependencies.has(node.name.value)), + ), + }; + } + + return separatedDocumentASTs; +} + +// From a dependency graph, collects a list of transitive dependencies by +// recursing through a dependency graph. +function collectTransitiveDependencies(collected, depGraph, fromName) { + if (!collected.has(fromName)) { + collected.add(fromName); + const immediateDeps = depGraph[fromName]; + + if (immediateDeps !== undefined) { + for (const toName of immediateDeps) { + collectTransitiveDependencies(collected, depGraph, toName); + } + } + } +} + +function collectDependencies(selectionSet) { + const dependencies = []; + (0, _visitor.visit)(selectionSet, { + FragmentSpread(node) { + dependencies.push(node.name.value); + }, + }); + return dependencies; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/separateOperations.mjs b/graphql-subscription/node_modules/graphql/utilities/separateOperations.mjs new file mode 100644 index 0000000..1d8ab8b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/separateOperations.mjs @@ -0,0 +1,80 @@ +import { Kind } from '../language/kinds.mjs'; +import { visit } from '../language/visitor.mjs'; +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ + +export function separateOperations(documentAST) { + const operations = []; + const depGraph = Object.create(null); // Populate metadata and build a dependency graph. + + for (const definitionNode of documentAST.definitions) { + switch (definitionNode.kind) { + case Kind.OPERATION_DEFINITION: + operations.push(definitionNode); + break; + + case Kind.FRAGMENT_DEFINITION: + depGraph[definitionNode.name.value] = collectDependencies( + definitionNode.selectionSet, + ); + break; + + default: // ignore non-executable definitions + } + } // For each operation, produce a new synthesized AST which includes only what + // is necessary for completing that operation. + + const separatedDocumentASTs = Object.create(null); + + for (const operation of operations) { + const dependencies = new Set(); + + for (const fragmentName of collectDependencies(operation.selectionSet)) { + collectTransitiveDependencies(dependencies, depGraph, fragmentName); + } // Provides the empty string for anonymous operations. + + const operationName = operation.name ? operation.name.value : ''; // The list of definition nodes to be included for this operation, sorted + // to retain the same order as the original document. + + separatedDocumentASTs[operationName] = { + kind: Kind.DOCUMENT, + definitions: documentAST.definitions.filter( + (node) => + node === operation || + (node.kind === Kind.FRAGMENT_DEFINITION && + dependencies.has(node.name.value)), + ), + }; + } + + return separatedDocumentASTs; +} + +// From a dependency graph, collects a list of transitive dependencies by +// recursing through a dependency graph. +function collectTransitiveDependencies(collected, depGraph, fromName) { + if (!collected.has(fromName)) { + collected.add(fromName); + const immediateDeps = depGraph[fromName]; + + if (immediateDeps !== undefined) { + for (const toName of immediateDeps) { + collectTransitiveDependencies(collected, depGraph, toName); + } + } + } +} + +function collectDependencies(selectionSet) { + const dependencies = []; + visit(selectionSet, { + FragmentSpread(node) { + dependencies.push(node.name.value); + }, + }); + return dependencies; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/sortValueNode.d.ts b/graphql-subscription/node_modules/graphql/utilities/sortValueNode.d.ts new file mode 100644 index 0000000..7d7a9de --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/sortValueNode.d.ts @@ -0,0 +1,9 @@ +import type { ValueNode } from '../language/ast'; +/** + * Sort ValueNode. + * + * This function returns a sorted copy of the given ValueNode. + * + * @internal + */ +export declare function sortValueNode(valueNode: ValueNode): ValueNode; diff --git a/graphql-subscription/node_modules/graphql/utilities/sortValueNode.js b/graphql-subscription/node_modules/graphql/utilities/sortValueNode.js new file mode 100644 index 0000000..cf4bbfd --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/sortValueNode.js @@ -0,0 +1,47 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.sortValueNode = sortValueNode; + +var _naturalCompare = require('../jsutils/naturalCompare.js'); + +var _kinds = require('../language/kinds.js'); + +/** + * Sort ValueNode. + * + * This function returns a sorted copy of the given ValueNode. + * + * @internal + */ +function sortValueNode(valueNode) { + switch (valueNode.kind) { + case _kinds.Kind.OBJECT: + return { ...valueNode, fields: sortFields(valueNode.fields) }; + + case _kinds.Kind.LIST: + return { ...valueNode, values: valueNode.values.map(sortValueNode) }; + + case _kinds.Kind.INT: + case _kinds.Kind.FLOAT: + case _kinds.Kind.STRING: + case _kinds.Kind.BOOLEAN: + case _kinds.Kind.NULL: + case _kinds.Kind.ENUM: + case _kinds.Kind.VARIABLE: + return valueNode; + } +} + +function sortFields(fields) { + return fields + .map((fieldNode) => ({ + ...fieldNode, + value: sortValueNode(fieldNode.value), + })) + .sort((fieldA, fieldB) => + (0, _naturalCompare.naturalCompare)(fieldA.name.value, fieldB.name.value), + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/sortValueNode.mjs b/graphql-subscription/node_modules/graphql/utilities/sortValueNode.mjs new file mode 100644 index 0000000..79bece3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/sortValueNode.mjs @@ -0,0 +1,39 @@ +import { naturalCompare } from '../jsutils/naturalCompare.mjs'; +import { Kind } from '../language/kinds.mjs'; +/** + * Sort ValueNode. + * + * This function returns a sorted copy of the given ValueNode. + * + * @internal + */ + +export function sortValueNode(valueNode) { + switch (valueNode.kind) { + case Kind.OBJECT: + return { ...valueNode, fields: sortFields(valueNode.fields) }; + + case Kind.LIST: + return { ...valueNode, values: valueNode.values.map(sortValueNode) }; + + case Kind.INT: + case Kind.FLOAT: + case Kind.STRING: + case Kind.BOOLEAN: + case Kind.NULL: + case Kind.ENUM: + case Kind.VARIABLE: + return valueNode; + } +} + +function sortFields(fields) { + return fields + .map((fieldNode) => ({ + ...fieldNode, + value: sortValueNode(fieldNode.value), + })) + .sort((fieldA, fieldB) => + naturalCompare(fieldA.name.value, fieldB.name.value), + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts b/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts new file mode 100644 index 0000000..7bd6c04 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts @@ -0,0 +1,62 @@ +import { Source } from '../language/source'; +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * + * SDL example: + * + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + */ +export declare function stripIgnoredCharacters(source: string | Source): string; diff --git a/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.js b/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.js new file mode 100644 index 0000000..04f6a1b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.js @@ -0,0 +1,121 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.stripIgnoredCharacters = stripIgnoredCharacters; + +var _blockString = require('../language/blockString.js'); + +var _lexer = require('../language/lexer.js'); + +var _source = require('../language/source.js'); + +var _tokenKind = require('../language/tokenKind.js'); + +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * + * SDL example: + * + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + */ +function stripIgnoredCharacters(source) { + const sourceObj = (0, _source.isSource)(source) + ? source + : new _source.Source(source); + const body = sourceObj.body; + const lexer = new _lexer.Lexer(sourceObj); + let strippedBody = ''; + let wasLastAddedTokenNonPunctuator = false; + + while (lexer.advance().kind !== _tokenKind.TokenKind.EOF) { + const currentToken = lexer.token; + const tokenKind = currentToken.kind; + /** + * Every two non-punctuator tokens should have space between them. + * Also prevent case of non-punctuator token following by spread resulting + * in invalid token (e.g. `1...` is invalid Float token). + */ + + const isNonPunctuator = !(0, _lexer.isPunctuatorTokenKind)( + currentToken.kind, + ); + + if (wasLastAddedTokenNonPunctuator) { + if ( + isNonPunctuator || + currentToken.kind === _tokenKind.TokenKind.SPREAD + ) { + strippedBody += ' '; + } + } + + const tokenBody = body.slice(currentToken.start, currentToken.end); + + if (tokenKind === _tokenKind.TokenKind.BLOCK_STRING) { + strippedBody += (0, _blockString.printBlockString)(currentToken.value, { + minimize: true, + }); + } else { + strippedBody += tokenBody; + } + + wasLastAddedTokenNonPunctuator = isNonPunctuator; + } + + return strippedBody; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.mjs b/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.mjs new file mode 100644 index 0000000..f85bdb9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/stripIgnoredCharacters.mjs @@ -0,0 +1,104 @@ +import { printBlockString } from '../language/blockString.mjs'; +import { isPunctuatorTokenKind, Lexer } from '../language/lexer.mjs'; +import { isSource, Source } from '../language/source.mjs'; +import { TokenKind } from '../language/tokenKind.mjs'; +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * + * SDL example: + * + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + */ + +export function stripIgnoredCharacters(source) { + const sourceObj = isSource(source) ? source : new Source(source); + const body = sourceObj.body; + const lexer = new Lexer(sourceObj); + let strippedBody = ''; + let wasLastAddedTokenNonPunctuator = false; + + while (lexer.advance().kind !== TokenKind.EOF) { + const currentToken = lexer.token; + const tokenKind = currentToken.kind; + /** + * Every two non-punctuator tokens should have space between them. + * Also prevent case of non-punctuator token following by spread resulting + * in invalid token (e.g. `1...` is invalid Float token). + */ + + const isNonPunctuator = !isPunctuatorTokenKind(currentToken.kind); + + if (wasLastAddedTokenNonPunctuator) { + if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) { + strippedBody += ' '; + } + } + + const tokenBody = body.slice(currentToken.start, currentToken.end); + + if (tokenKind === TokenKind.BLOCK_STRING) { + strippedBody += printBlockString(currentToken.value, { + minimize: true, + }); + } else { + strippedBody += tokenBody; + } + + wasLastAddedTokenNonPunctuator = isNonPunctuator; + } + + return strippedBody; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/typeComparators.d.ts b/graphql-subscription/node_modules/graphql/utilities/typeComparators.d.ts new file mode 100644 index 0000000..1e5adbd --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typeComparators.d.ts @@ -0,0 +1,32 @@ +import type { GraphQLCompositeType, GraphQLType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Provided two types, return true if the types are equal (invariant). + */ +export declare function isEqualType( + typeA: GraphQLType, + typeB: GraphQLType, +): boolean; +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ +export declare function isTypeSubTypeOf( + schema: GraphQLSchema, + maybeSubType: GraphQLType, + superType: GraphQLType, +): boolean; +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ +export declare function doTypesOverlap( + schema: GraphQLSchema, + typeA: GraphQLCompositeType, + typeB: GraphQLCompositeType, +): boolean; diff --git a/graphql-subscription/node_modules/graphql/utilities/typeComparators.js b/graphql-subscription/node_modules/graphql/utilities/typeComparators.js new file mode 100644 index 0000000..6669c03 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typeComparators.js @@ -0,0 +1,116 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.doTypesOverlap = doTypesOverlap; +exports.isEqualType = isEqualType; +exports.isTypeSubTypeOf = isTypeSubTypeOf; + +var _definition = require('../type/definition.js'); + +/** + * Provided two types, return true if the types are equal (invariant). + */ +function isEqualType(typeA, typeB) { + // Equivalent types are equal. + if (typeA === typeB) { + return true; + } // If either type is non-null, the other must also be non-null. + + if ( + (0, _definition.isNonNullType)(typeA) && + (0, _definition.isNonNullType)(typeB) + ) { + return isEqualType(typeA.ofType, typeB.ofType); + } // If either type is a list, the other must also be a list. + + if ( + (0, _definition.isListType)(typeA) && + (0, _definition.isListType)(typeB) + ) { + return isEqualType(typeA.ofType, typeB.ofType); + } // Otherwise the types are not equal. + + return false; +} +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ + +function isTypeSubTypeOf(schema, maybeSubType, superType) { + // Equivalent type is a valid subtype + if (maybeSubType === superType) { + return true; + } // If superType is non-null, maybeSubType must also be non-null. + + if ((0, _definition.isNonNullType)(superType)) { + if ((0, _definition.isNonNullType)(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if ((0, _definition.isNonNullType)(maybeSubType)) { + // If superType is nullable, maybeSubType may be non-null or nullable. + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); + } // If superType type is a list, maybeSubType type must also be a list. + + if ((0, _definition.isListType)(superType)) { + if ((0, _definition.isListType)(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if ((0, _definition.isListType)(maybeSubType)) { + // If superType is not a list, maybeSubType must also be not a list. + return false; + } // If superType type is an abstract type, check if it is super type of maybeSubType. + // Otherwise, the child type is not a valid subtype of the parent type. + + return ( + (0, _definition.isAbstractType)(superType) && + ((0, _definition.isInterfaceType)(maybeSubType) || + (0, _definition.isObjectType)(maybeSubType)) && + schema.isSubType(superType, maybeSubType) + ); +} +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ + +function doTypesOverlap(schema, typeA, typeB) { + // Equivalent types overlap + if (typeA === typeB) { + return true; + } + + if ((0, _definition.isAbstractType)(typeA)) { + if ((0, _definition.isAbstractType)(typeB)) { + // If both types are abstract, then determine if there is any intersection + // between possible concrete types of each. + return schema + .getPossibleTypes(typeA) + .some((type) => schema.isSubType(typeB, type)); + } // Determine if the latter type is a possible concrete type of the former. + + return schema.isSubType(typeA, typeB); + } + + if ((0, _definition.isAbstractType)(typeB)) { + // Determine if the former type is a possible concrete type of the latter. + return schema.isSubType(typeB, typeA); + } // Otherwise the types do not overlap. + + return false; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/typeComparators.mjs b/graphql-subscription/node_modules/graphql/utilities/typeComparators.mjs new file mode 100644 index 0000000..a57093a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typeComparators.mjs @@ -0,0 +1,106 @@ +import { + isAbstractType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, +} from '../type/definition.mjs'; + +/** + * Provided two types, return true if the types are equal (invariant). + */ +export function isEqualType(typeA, typeB) { + // Equivalent types are equal. + if (typeA === typeB) { + return true; + } // If either type is non-null, the other must also be non-null. + + if (isNonNullType(typeA) && isNonNullType(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } // If either type is a list, the other must also be a list. + + if (isListType(typeA) && isListType(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } // Otherwise the types are not equal. + + return false; +} +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ + +export function isTypeSubTypeOf(schema, maybeSubType, superType) { + // Equivalent type is a valid subtype + if (maybeSubType === superType) { + return true; + } // If superType is non-null, maybeSubType must also be non-null. + + if (isNonNullType(superType)) { + if (isNonNullType(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if (isNonNullType(maybeSubType)) { + // If superType is nullable, maybeSubType may be non-null or nullable. + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); + } // If superType type is a list, maybeSubType type must also be a list. + + if (isListType(superType)) { + if (isListType(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + + return false; + } + + if (isListType(maybeSubType)) { + // If superType is not a list, maybeSubType must also be not a list. + return false; + } // If superType type is an abstract type, check if it is super type of maybeSubType. + // Otherwise, the child type is not a valid subtype of the parent type. + + return ( + isAbstractType(superType) && + (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && + schema.isSubType(superType, maybeSubType) + ); +} +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ + +export function doTypesOverlap(schema, typeA, typeB) { + // Equivalent types overlap + if (typeA === typeB) { + return true; + } + + if (isAbstractType(typeA)) { + if (isAbstractType(typeB)) { + // If both types are abstract, then determine if there is any intersection + // between possible concrete types of each. + return schema + .getPossibleTypes(typeA) + .some((type) => schema.isSubType(typeB, type)); + } // Determine if the latter type is a possible concrete type of the former. + + return schema.isSubType(typeA, typeB); + } + + if (isAbstractType(typeB)) { + // Determine if the former type is a possible concrete type of the latter. + return schema.isSubType(typeB, typeA); + } // Otherwise the types do not overlap. + + return false; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/typeFromAST.d.ts b/graphql-subscription/node_modules/graphql/utilities/typeFromAST.d.ts new file mode 100644 index 0000000..5823755 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typeFromAST.d.ts @@ -0,0 +1,32 @@ +import type { + ListTypeNode, + NamedTypeNode, + NonNullTypeNode, + TypeNode, +} from '../language/ast'; +import type { GraphQLNamedType, GraphQLType } from '../type/definition'; +import { GraphQLList, GraphQLNonNull } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; +/** + * Given a Schema and an AST node describing a type, return a GraphQLType + * definition which applies to that type. For example, if provided the parsed + * AST node for `[User]`, a GraphQLList instance will be returned, containing + * the type called "User" found in the schema. If a type called "User" is not + * found in the schema, then undefined will be returned. + */ +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: NamedTypeNode, +): GraphQLNamedType | undefined; +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: ListTypeNode, +): GraphQLList | undefined; +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: NonNullTypeNode, +): GraphQLNonNull | undefined; +export declare function typeFromAST( + schema: GraphQLSchema, + typeNode: TypeNode, +): GraphQLType | undefined; diff --git a/graphql-subscription/node_modules/graphql/utilities/typeFromAST.js b/graphql-subscription/node_modules/graphql/utilities/typeFromAST.js new file mode 100644 index 0000000..998f333 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typeFromAST.js @@ -0,0 +1,27 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.typeFromAST = typeFromAST; + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +function typeFromAST(schema, typeNode) { + switch (typeNode.kind) { + case _kinds.Kind.LIST_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new _definition.GraphQLList(innerType); + } + + case _kinds.Kind.NON_NULL_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new _definition.GraphQLNonNull(innerType); + } + + case _kinds.Kind.NAMED_TYPE: + return schema.getType(typeNode.name.value); + } +} diff --git a/graphql-subscription/node_modules/graphql/utilities/typeFromAST.mjs b/graphql-subscription/node_modules/graphql/utilities/typeFromAST.mjs new file mode 100644 index 0000000..edae41b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typeFromAST.mjs @@ -0,0 +1,18 @@ +import { Kind } from '../language/kinds.mjs'; +import { GraphQLList, GraphQLNonNull } from '../type/definition.mjs'; +export function typeFromAST(schema, typeNode) { + switch (typeNode.kind) { + case Kind.LIST_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new GraphQLList(innerType); + } + + case Kind.NON_NULL_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new GraphQLNonNull(innerType); + } + + case Kind.NAMED_TYPE: + return schema.getType(typeNode.name.value); + } +} diff --git a/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts b/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts new file mode 100644 index 0000000..a8289c5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts @@ -0,0 +1,22 @@ +import type { DocumentNode, ExecutableDefinitionNode } from '../language/ast'; +/** + * Wrapper type that contains DocumentNode and types that can be deduced from it. + */ +export interface TypedQueryDocumentNode< + TResponseData = { + [key: string]: any; + }, + TRequestVariables = { + [key: string]: any; + }, +> extends DocumentNode { + readonly definitions: ReadonlyArray; + /** + * This type is used to ensure that the variables you pass in to the query are assignable to Variables + * and that the Result is assignable to whatever you pass your result to. The method is never actually + * implemented, but the type is valid because we list it as optional + */ + __ensureTypesOfVariablesAndResultMatching?: ( + variables: TRequestVariables, + ) => TResponseData; +} diff --git a/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.js b/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.js new file mode 100644 index 0000000..b92811b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.js @@ -0,0 +1,5 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); diff --git a/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.mjs b/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/typedQueryDocumentNode.mjs @@ -0,0 +1 @@ +export {}; diff --git a/graphql-subscription/node_modules/graphql/utilities/valueFromAST.d.ts b/graphql-subscription/node_modules/graphql/utilities/valueFromAST.d.ts new file mode 100644 index 0000000..ee5f74e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/valueFromAST.d.ts @@ -0,0 +1,29 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { ValueNode } from '../language/ast'; +import type { GraphQLInputType } from '../type/definition'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * + */ +export declare function valueFromAST( + valueNode: Maybe, + type: GraphQLInputType, + variables?: Maybe>, +): unknown; diff --git a/graphql-subscription/node_modules/graphql/utilities/valueFromAST.js b/graphql-subscription/node_modules/graphql/utilities/valueFromAST.js new file mode 100644 index 0000000..0d7fe0e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/valueFromAST.js @@ -0,0 +1,185 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.valueFromAST = valueFromAST; + +var _inspect = require('../jsutils/inspect.js'); + +var _invariant = require('../jsutils/invariant.js'); + +var _keyMap = require('../jsutils/keyMap.js'); + +var _kinds = require('../language/kinds.js'); + +var _definition = require('../type/definition.js'); + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * + */ +function valueFromAST(valueNode, type, variables) { + if (!valueNode) { + // When there is no node, then there is also no value. + // Importantly, this is different from returning the value null. + return; + } + + if (valueNode.kind === _kinds.Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if (variables == null || variables[variableName] === undefined) { + // No valid return value. + return; + } + + const variableValue = variables[variableName]; + + if (variableValue === null && (0, _definition.isNonNullType)(type)) { + return; // Invalid: intentionally return no value. + } // Note: This does no further checking that this variable is correct. + // This assumes that this query has been validated and the variable + // usage here is of the correct type. + + return variableValue; + } + + if ((0, _definition.isNonNullType)(type)) { + if (valueNode.kind === _kinds.Kind.NULL) { + return; // Invalid: intentionally return no value. + } + + return valueFromAST(valueNode, type.ofType, variables); + } + + if (valueNode.kind === _kinds.Kind.NULL) { + // This is explicitly returning the value null. + return null; + } + + if ((0, _definition.isListType)(type)) { + const itemType = type.ofType; + + if (valueNode.kind === _kinds.Kind.LIST) { + const coercedValues = []; + + for (const itemNode of valueNode.values) { + if (isMissingVariable(itemNode, variables)) { + // If an array contains a missing variable, it is either coerced to + // null or if the item type is non-null, it considered invalid. + if ((0, _definition.isNonNullType)(itemType)) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(null); + } else { + const itemValue = valueFromAST(itemNode, itemType, variables); + + if (itemValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(itemValue); + } + } + + return coercedValues; + } + + const coercedValue = valueFromAST(valueNode, itemType, variables); + + if (coercedValue === undefined) { + return; // Invalid: intentionally return no value. + } + + return [coercedValue]; + } + + if ((0, _definition.isInputObjectType)(type)) { + if (valueNode.kind !== _kinds.Kind.OBJECT) { + return; // Invalid: intentionally return no value. + } + + const coercedObj = Object.create(null); + const fieldNodes = (0, _keyMap.keyMap)( + valueNode.fields, + (field) => field.name.value, + ); + + for (const field of Object.values(type.getFields())) { + const fieldNode = fieldNodes[field.name]; + + if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { + if (field.defaultValue !== undefined) { + coercedObj[field.name] = field.defaultValue; + } else if ((0, _definition.isNonNullType)(field.type)) { + return; // Invalid: intentionally return no value. + } + + continue; + } + + const fieldValue = valueFromAST(fieldNode.value, field.type, variables); + + if (fieldValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedObj[field.name] = fieldValue; + } + + return coercedObj; + } + + if ((0, _definition.isLeafType)(type)) { + // Scalars and Enums fulfill parsing a literal value via parseLiteral(). + // Invalid values represent a failure to parse correctly, in which case + // no value is returned. + let result; + + try { + result = type.parseLiteral(valueNode, variables); + } catch (_error) { + return; // Invalid: intentionally return no value. + } + + if (result === undefined) { + return; // Invalid: intentionally return no value. + } + + return result; + } + /* c8 ignore next 3 */ + // Not reachable, all possible input types have been considered. + + false || + (0, _invariant.invariant)( + false, + 'Unexpected input type: ' + (0, _inspect.inspect)(type), + ); +} // Returns true if the provided valueNode is a variable which is not defined +// in the set of variables. + +function isMissingVariable(valueNode, variables) { + return ( + valueNode.kind === _kinds.Kind.VARIABLE && + (variables == null || variables[valueNode.name.value] === undefined) + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/valueFromAST.mjs b/graphql-subscription/node_modules/graphql/utilities/valueFromAST.mjs new file mode 100644 index 0000000..da2ab5c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/valueFromAST.mjs @@ -0,0 +1,172 @@ +import { inspect } from '../jsutils/inspect.mjs'; +import { invariant } from '../jsutils/invariant.mjs'; +import { keyMap } from '../jsutils/keyMap.mjs'; +import { Kind } from '../language/kinds.mjs'; +import { + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition.mjs'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * + */ + +export function valueFromAST(valueNode, type, variables) { + if (!valueNode) { + // When there is no node, then there is also no value. + // Importantly, this is different from returning the value null. + return; + } + + if (valueNode.kind === Kind.VARIABLE) { + const variableName = valueNode.name.value; + + if (variables == null || variables[variableName] === undefined) { + // No valid return value. + return; + } + + const variableValue = variables[variableName]; + + if (variableValue === null && isNonNullType(type)) { + return; // Invalid: intentionally return no value. + } // Note: This does no further checking that this variable is correct. + // This assumes that this query has been validated and the variable + // usage here is of the correct type. + + return variableValue; + } + + if (isNonNullType(type)) { + if (valueNode.kind === Kind.NULL) { + return; // Invalid: intentionally return no value. + } + + return valueFromAST(valueNode, type.ofType, variables); + } + + if (valueNode.kind === Kind.NULL) { + // This is explicitly returning the value null. + return null; + } + + if (isListType(type)) { + const itemType = type.ofType; + + if (valueNode.kind === Kind.LIST) { + const coercedValues = []; + + for (const itemNode of valueNode.values) { + if (isMissingVariable(itemNode, variables)) { + // If an array contains a missing variable, it is either coerced to + // null or if the item type is non-null, it considered invalid. + if (isNonNullType(itemType)) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(null); + } else { + const itemValue = valueFromAST(itemNode, itemType, variables); + + if (itemValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedValues.push(itemValue); + } + } + + return coercedValues; + } + + const coercedValue = valueFromAST(valueNode, itemType, variables); + + if (coercedValue === undefined) { + return; // Invalid: intentionally return no value. + } + + return [coercedValue]; + } + + if (isInputObjectType(type)) { + if (valueNode.kind !== Kind.OBJECT) { + return; // Invalid: intentionally return no value. + } + + const coercedObj = Object.create(null); + const fieldNodes = keyMap(valueNode.fields, (field) => field.name.value); + + for (const field of Object.values(type.getFields())) { + const fieldNode = fieldNodes[field.name]; + + if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { + if (field.defaultValue !== undefined) { + coercedObj[field.name] = field.defaultValue; + } else if (isNonNullType(field.type)) { + return; // Invalid: intentionally return no value. + } + + continue; + } + + const fieldValue = valueFromAST(fieldNode.value, field.type, variables); + + if (fieldValue === undefined) { + return; // Invalid: intentionally return no value. + } + + coercedObj[field.name] = fieldValue; + } + + return coercedObj; + } + + if (isLeafType(type)) { + // Scalars and Enums fulfill parsing a literal value via parseLiteral(). + // Invalid values represent a failure to parse correctly, in which case + // no value is returned. + let result; + + try { + result = type.parseLiteral(valueNode, variables); + } catch (_error) { + return; // Invalid: intentionally return no value. + } + + if (result === undefined) { + return; // Invalid: intentionally return no value. + } + + return result; + } + /* c8 ignore next 3 */ + // Not reachable, all possible input types have been considered. + + false || invariant(false, 'Unexpected input type: ' + inspect(type)); +} // Returns true if the provided valueNode is a variable which is not defined +// in the set of variables. + +function isMissingVariable(valueNode, variables) { + return ( + valueNode.kind === Kind.VARIABLE && + (variables == null || variables[valueNode.name.value] === undefined) + ); +} diff --git a/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.d.ts b/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.d.ts new file mode 100644 index 0000000..9200a77 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.d.ts @@ -0,0 +1,23 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { ValueNode } from '../language/ast'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ +export declare function valueFromASTUntyped( + valueNode: ValueNode, + variables?: Maybe>, +): unknown; diff --git a/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.js b/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.js new file mode 100644 index 0000000..3c37229 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.valueFromASTUntyped = valueFromASTUntyped; + +var _keyValMap = require('../jsutils/keyValMap.js'); + +var _kinds = require('../language/kinds.js'); + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ +function valueFromASTUntyped(valueNode, variables) { + switch (valueNode.kind) { + case _kinds.Kind.NULL: + return null; + + case _kinds.Kind.INT: + return parseInt(valueNode.value, 10); + + case _kinds.Kind.FLOAT: + return parseFloat(valueNode.value); + + case _kinds.Kind.STRING: + case _kinds.Kind.ENUM: + case _kinds.Kind.BOOLEAN: + return valueNode.value; + + case _kinds.Kind.LIST: + return valueNode.values.map((node) => + valueFromASTUntyped(node, variables), + ); + + case _kinds.Kind.OBJECT: + return (0, _keyValMap.keyValMap)( + valueNode.fields, + (field) => field.name.value, + (field) => valueFromASTUntyped(field.value, variables), + ); + + case _kinds.Kind.VARIABLE: + return variables === null || variables === void 0 + ? void 0 + : variables[valueNode.name.value]; + } +} diff --git a/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.mjs b/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.mjs new file mode 100644 index 0000000..800d295 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/utilities/valueFromASTUntyped.mjs @@ -0,0 +1,53 @@ +import { keyValMap } from '../jsutils/keyValMap.mjs'; +import { Kind } from '../language/kinds.mjs'; +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ + +export function valueFromASTUntyped(valueNode, variables) { + switch (valueNode.kind) { + case Kind.NULL: + return null; + + case Kind.INT: + return parseInt(valueNode.value, 10); + + case Kind.FLOAT: + return parseFloat(valueNode.value); + + case Kind.STRING: + case Kind.ENUM: + case Kind.BOOLEAN: + return valueNode.value; + + case Kind.LIST: + return valueNode.values.map((node) => + valueFromASTUntyped(node, variables), + ); + + case Kind.OBJECT: + return keyValMap( + valueNode.fields, + (field) => field.name.value, + (field) => valueFromASTUntyped(field.value, variables), + ); + + case Kind.VARIABLE: + return variables === null || variables === void 0 + ? void 0 + : variables[valueNode.name.value]; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/ValidationContext.d.ts b/graphql-subscription/node_modules/graphql/validation/ValidationContext.d.ts new file mode 100644 index 0000000..8fc6ffb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/ValidationContext.d.ts @@ -0,0 +1,95 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { GraphQLError } from '../error/GraphQLError'; +import type { + DocumentNode, + FragmentDefinitionNode, + FragmentSpreadNode, + OperationDefinitionNode, + SelectionSetNode, + VariableNode, +} from '../language/ast'; +import type { ASTVisitor } from '../language/visitor'; +import type { + GraphQLArgument, + GraphQLCompositeType, + GraphQLEnumValue, + GraphQLField, + GraphQLInputType, + GraphQLOutputType, +} from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; +import { TypeInfo } from '../utilities/TypeInfo'; +declare type NodeWithSelectionSet = + | OperationDefinitionNode + | FragmentDefinitionNode; +interface VariableUsage { + readonly node: VariableNode; + readonly type: Maybe; + readonly defaultValue: Maybe; +} +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +export declare class ASTValidationContext { + private _ast; + private _onError; + private _fragments; + private _fragmentSpreads; + private _recursivelyReferencedFragments; + constructor(ast: DocumentNode, onError: (error: GraphQLError) => void); + get [Symbol.toStringTag](): string; + reportError(error: GraphQLError): void; + getDocument(): DocumentNode; + getFragment(name: string): Maybe; + getFragmentSpreads(node: SelectionSetNode): ReadonlyArray; + getRecursivelyReferencedFragments( + operation: OperationDefinitionNode, + ): ReadonlyArray; +} +export declare type ASTValidationRule = ( + context: ASTValidationContext, +) => ASTVisitor; +export declare class SDLValidationContext extends ASTValidationContext { + private _schema; + constructor( + ast: DocumentNode, + schema: Maybe, + onError: (error: GraphQLError) => void, + ); + get [Symbol.toStringTag](): string; + getSchema(): Maybe; +} +export declare type SDLValidationRule = ( + context: SDLValidationContext, +) => ASTVisitor; +export declare class ValidationContext extends ASTValidationContext { + private _schema; + private _typeInfo; + private _variableUsages; + private _recursiveVariableUsages; + constructor( + schema: GraphQLSchema, + ast: DocumentNode, + typeInfo: TypeInfo, + onError: (error: GraphQLError) => void, + ); + get [Symbol.toStringTag](): string; + getSchema(): GraphQLSchema; + getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray; + getRecursiveVariableUsages( + operation: OperationDefinitionNode, + ): ReadonlyArray; + getType(): Maybe; + getParentType(): Maybe; + getInputType(): Maybe; + getParentInputType(): Maybe; + getFieldDef(): Maybe>; + getDirective(): Maybe; + getArgument(): Maybe; + getEnumValue(): Maybe; +} +export declare type ValidationRule = (context: ValidationContext) => ASTVisitor; +export {}; diff --git a/graphql-subscription/node_modules/graphql/validation/ValidationContext.js b/graphql-subscription/node_modules/graphql/validation/ValidationContext.js new file mode 100644 index 0000000..3f6fa82 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/ValidationContext.js @@ -0,0 +1,232 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ValidationContext = + exports.SDLValidationContext = + exports.ASTValidationContext = + void 0; + +var _kinds = require('../language/kinds.js'); + +var _visitor = require('../language/visitor.js'); + +var _TypeInfo = require('../utilities/TypeInfo.js'); + +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +class ASTValidationContext { + constructor(ast, onError) { + this._ast = ast; + this._fragments = undefined; + this._fragmentSpreads = new Map(); + this._recursivelyReferencedFragments = new Map(); + this._onError = onError; + } + + get [Symbol.toStringTag]() { + return 'ASTValidationContext'; + } + + reportError(error) { + this._onError(error); + } + + getDocument() { + return this._ast; + } + + getFragment(name) { + let fragments; + + if (this._fragments) { + fragments = this._fragments; + } else { + fragments = Object.create(null); + + for (const defNode of this.getDocument().definitions) { + if (defNode.kind === _kinds.Kind.FRAGMENT_DEFINITION) { + fragments[defNode.name.value] = defNode; + } + } + + this._fragments = fragments; + } + + return fragments[name]; + } + + getFragmentSpreads(node) { + let spreads = this._fragmentSpreads.get(node); + + if (!spreads) { + spreads = []; + const setsToVisit = [node]; + let set; + + while ((set = setsToVisit.pop())) { + for (const selection of set.selections) { + if (selection.kind === _kinds.Kind.FRAGMENT_SPREAD) { + spreads.push(selection); + } else if (selection.selectionSet) { + setsToVisit.push(selection.selectionSet); + } + } + } + + this._fragmentSpreads.set(node, spreads); + } + + return spreads; + } + + getRecursivelyReferencedFragments(operation) { + let fragments = this._recursivelyReferencedFragments.get(operation); + + if (!fragments) { + fragments = []; + const collectedNames = Object.create(null); + const nodesToVisit = [operation.selectionSet]; + let node; + + while ((node = nodesToVisit.pop())) { + for (const spread of this.getFragmentSpreads(node)) { + const fragName = spread.name.value; + + if (collectedNames[fragName] !== true) { + collectedNames[fragName] = true; + const fragment = this.getFragment(fragName); + + if (fragment) { + fragments.push(fragment); + nodesToVisit.push(fragment.selectionSet); + } + } + } + } + + this._recursivelyReferencedFragments.set(operation, fragments); + } + + return fragments; + } +} + +exports.ASTValidationContext = ASTValidationContext; + +class SDLValidationContext extends ASTValidationContext { + constructor(ast, schema, onError) { + super(ast, onError); + this._schema = schema; + } + + get [Symbol.toStringTag]() { + return 'SDLValidationContext'; + } + + getSchema() { + return this._schema; + } +} + +exports.SDLValidationContext = SDLValidationContext; + +class ValidationContext extends ASTValidationContext { + constructor(schema, ast, typeInfo, onError) { + super(ast, onError); + this._schema = schema; + this._typeInfo = typeInfo; + this._variableUsages = new Map(); + this._recursiveVariableUsages = new Map(); + } + + get [Symbol.toStringTag]() { + return 'ValidationContext'; + } + + getSchema() { + return this._schema; + } + + getVariableUsages(node) { + let usages = this._variableUsages.get(node); + + if (!usages) { + const newUsages = []; + const typeInfo = new _TypeInfo.TypeInfo(this._schema); + (0, _visitor.visit)( + node, + (0, _TypeInfo.visitWithTypeInfo)(typeInfo, { + VariableDefinition: () => false, + + Variable(variable) { + newUsages.push({ + node: variable, + type: typeInfo.getInputType(), + defaultValue: typeInfo.getDefaultValue(), + }); + }, + }), + ); + usages = newUsages; + + this._variableUsages.set(node, usages); + } + + return usages; + } + + getRecursiveVariableUsages(operation) { + let usages = this._recursiveVariableUsages.get(operation); + + if (!usages) { + usages = this.getVariableUsages(operation); + + for (const frag of this.getRecursivelyReferencedFragments(operation)) { + usages = usages.concat(this.getVariableUsages(frag)); + } + + this._recursiveVariableUsages.set(operation, usages); + } + + return usages; + } + + getType() { + return this._typeInfo.getType(); + } + + getParentType() { + return this._typeInfo.getParentType(); + } + + getInputType() { + return this._typeInfo.getInputType(); + } + + getParentInputType() { + return this._typeInfo.getParentInputType(); + } + + getFieldDef() { + return this._typeInfo.getFieldDef(); + } + + getDirective() { + return this._typeInfo.getDirective(); + } + + getArgument() { + return this._typeInfo.getArgument(); + } + + getEnumValue() { + return this._typeInfo.getEnumValue(); + } +} + +exports.ValidationContext = ValidationContext; diff --git a/graphql-subscription/node_modules/graphql/validation/ValidationContext.mjs b/graphql-subscription/node_modules/graphql/validation/ValidationContext.mjs new file mode 100644 index 0000000..4f07f38 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/ValidationContext.mjs @@ -0,0 +1,212 @@ +import { Kind } from '../language/kinds.mjs'; +import { visit } from '../language/visitor.mjs'; +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.mjs'; + +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +export class ASTValidationContext { + constructor(ast, onError) { + this._ast = ast; + this._fragments = undefined; + this._fragmentSpreads = new Map(); + this._recursivelyReferencedFragments = new Map(); + this._onError = onError; + } + + get [Symbol.toStringTag]() { + return 'ASTValidationContext'; + } + + reportError(error) { + this._onError(error); + } + + getDocument() { + return this._ast; + } + + getFragment(name) { + let fragments; + + if (this._fragments) { + fragments = this._fragments; + } else { + fragments = Object.create(null); + + for (const defNode of this.getDocument().definitions) { + if (defNode.kind === Kind.FRAGMENT_DEFINITION) { + fragments[defNode.name.value] = defNode; + } + } + + this._fragments = fragments; + } + + return fragments[name]; + } + + getFragmentSpreads(node) { + let spreads = this._fragmentSpreads.get(node); + + if (!spreads) { + spreads = []; + const setsToVisit = [node]; + let set; + + while ((set = setsToVisit.pop())) { + for (const selection of set.selections) { + if (selection.kind === Kind.FRAGMENT_SPREAD) { + spreads.push(selection); + } else if (selection.selectionSet) { + setsToVisit.push(selection.selectionSet); + } + } + } + + this._fragmentSpreads.set(node, spreads); + } + + return spreads; + } + + getRecursivelyReferencedFragments(operation) { + let fragments = this._recursivelyReferencedFragments.get(operation); + + if (!fragments) { + fragments = []; + const collectedNames = Object.create(null); + const nodesToVisit = [operation.selectionSet]; + let node; + + while ((node = nodesToVisit.pop())) { + for (const spread of this.getFragmentSpreads(node)) { + const fragName = spread.name.value; + + if (collectedNames[fragName] !== true) { + collectedNames[fragName] = true; + const fragment = this.getFragment(fragName); + + if (fragment) { + fragments.push(fragment); + nodesToVisit.push(fragment.selectionSet); + } + } + } + } + + this._recursivelyReferencedFragments.set(operation, fragments); + } + + return fragments; + } +} +export class SDLValidationContext extends ASTValidationContext { + constructor(ast, schema, onError) { + super(ast, onError); + this._schema = schema; + } + + get [Symbol.toStringTag]() { + return 'SDLValidationContext'; + } + + getSchema() { + return this._schema; + } +} +export class ValidationContext extends ASTValidationContext { + constructor(schema, ast, typeInfo, onError) { + super(ast, onError); + this._schema = schema; + this._typeInfo = typeInfo; + this._variableUsages = new Map(); + this._recursiveVariableUsages = new Map(); + } + + get [Symbol.toStringTag]() { + return 'ValidationContext'; + } + + getSchema() { + return this._schema; + } + + getVariableUsages(node) { + let usages = this._variableUsages.get(node); + + if (!usages) { + const newUsages = []; + const typeInfo = new TypeInfo(this._schema); + visit( + node, + visitWithTypeInfo(typeInfo, { + VariableDefinition: () => false, + + Variable(variable) { + newUsages.push({ + node: variable, + type: typeInfo.getInputType(), + defaultValue: typeInfo.getDefaultValue(), + }); + }, + }), + ); + usages = newUsages; + + this._variableUsages.set(node, usages); + } + + return usages; + } + + getRecursiveVariableUsages(operation) { + let usages = this._recursiveVariableUsages.get(operation); + + if (!usages) { + usages = this.getVariableUsages(operation); + + for (const frag of this.getRecursivelyReferencedFragments(operation)) { + usages = usages.concat(this.getVariableUsages(frag)); + } + + this._recursiveVariableUsages.set(operation, usages); + } + + return usages; + } + + getType() { + return this._typeInfo.getType(); + } + + getParentType() { + return this._typeInfo.getParentType(); + } + + getInputType() { + return this._typeInfo.getInputType(); + } + + getParentInputType() { + return this._typeInfo.getParentInputType(); + } + + getFieldDef() { + return this._typeInfo.getFieldDef(); + } + + getDirective() { + return this._typeInfo.getDirective(); + } + + getArgument() { + return this._typeInfo.getArgument(); + } + + getEnumValue() { + return this._typeInfo.getEnumValue(); + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/index.d.ts b/graphql-subscription/node_modules/graphql/validation/index.d.ts new file mode 100644 index 0000000..c0c720a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/index.d.ts @@ -0,0 +1,40 @@ +export { validate } from './validate'; +export { ValidationContext } from './ValidationContext'; +export type { ValidationRule } from './ValidationContext'; +export { specifiedRules } from './specifiedRules'; +export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; +export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; +export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; +export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule'; +export { KnownDirectivesRule } from './rules/KnownDirectivesRule'; +export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; +export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; +export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; +export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; +export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; +export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; +export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; +export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; +export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; +export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule'; +export { ScalarLeafsRule } from './rules/ScalarLeafsRule'; +export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; +export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; +export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; +export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; +export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; +export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; +export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; +export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; +export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; +export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; +export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; +export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; +export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; +export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; +export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; +export { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule'; +export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; +export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; +export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule'; +export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule'; diff --git a/graphql-subscription/node_modules/graphql/validation/index.js b/graphql-subscription/node_modules/graphql/validation/index.js new file mode 100644 index 0000000..bc4ea0b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/index.js @@ -0,0 +1,317 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +Object.defineProperty(exports, 'ExecutableDefinitionsRule', { + enumerable: true, + get: function () { + return _ExecutableDefinitionsRule.ExecutableDefinitionsRule; + }, +}); +Object.defineProperty(exports, 'FieldsOnCorrectTypeRule', { + enumerable: true, + get: function () { + return _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'FragmentsOnCompositeTypesRule', { + enumerable: true, + get: function () { + return _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule; + }, +}); +Object.defineProperty(exports, 'KnownArgumentNamesRule', { + enumerable: true, + get: function () { + return _KnownArgumentNamesRule.KnownArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownDirectivesRule', { + enumerable: true, + get: function () { + return _KnownDirectivesRule.KnownDirectivesRule; + }, +}); +Object.defineProperty(exports, 'KnownFragmentNamesRule', { + enumerable: true, + get: function () { + return _KnownFragmentNamesRule.KnownFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'KnownTypeNamesRule', { + enumerable: true, + get: function () { + return _KnownTypeNamesRule.KnownTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'LoneAnonymousOperationRule', { + enumerable: true, + get: function () { + return _LoneAnonymousOperationRule.LoneAnonymousOperationRule; + }, +}); +Object.defineProperty(exports, 'LoneSchemaDefinitionRule', { + enumerable: true, + get: function () { + return _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule; + }, +}); +Object.defineProperty(exports, 'NoDeprecatedCustomRule', { + enumerable: true, + get: function () { + return _NoDeprecatedCustomRule.NoDeprecatedCustomRule; + }, +}); +Object.defineProperty(exports, 'NoFragmentCyclesRule', { + enumerable: true, + get: function () { + return _NoFragmentCyclesRule.NoFragmentCyclesRule; + }, +}); +Object.defineProperty(exports, 'NoSchemaIntrospectionCustomRule', { + enumerable: true, + get: function () { + return _NoSchemaIntrospectionCustomRule.NoSchemaIntrospectionCustomRule; + }, +}); +Object.defineProperty(exports, 'NoUndefinedVariablesRule', { + enumerable: true, + get: function () { + return _NoUndefinedVariablesRule.NoUndefinedVariablesRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedFragmentsRule', { + enumerable: true, + get: function () { + return _NoUnusedFragmentsRule.NoUnusedFragmentsRule; + }, +}); +Object.defineProperty(exports, 'NoUnusedVariablesRule', { + enumerable: true, + get: function () { + return _NoUnusedVariablesRule.NoUnusedVariablesRule; + }, +}); +Object.defineProperty(exports, 'OverlappingFieldsCanBeMergedRule', { + enumerable: true, + get: function () { + return _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule; + }, +}); +Object.defineProperty(exports, 'PossibleFragmentSpreadsRule', { + enumerable: true, + get: function () { + return _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule; + }, +}); +Object.defineProperty(exports, 'PossibleTypeExtensionsRule', { + enumerable: true, + get: function () { + return _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule; + }, +}); +Object.defineProperty(exports, 'ProvidedRequiredArgumentsRule', { + enumerable: true, + get: function () { + return _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule; + }, +}); +Object.defineProperty(exports, 'ScalarLeafsRule', { + enumerable: true, + get: function () { + return _ScalarLeafsRule.ScalarLeafsRule; + }, +}); +Object.defineProperty(exports, 'SingleFieldSubscriptionsRule', { + enumerable: true, + get: function () { + return _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentDefinitionNamesRule', { + enumerable: true, + get: function () { + return _UniqueArgumentDefinitionNamesRule.UniqueArgumentDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueArgumentNamesRule', { + enumerable: true, + get: function () { + return _UniqueArgumentNamesRule.UniqueArgumentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectiveNamesRule', { + enumerable: true, + get: function () { + return _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueDirectivesPerLocationRule', { + enumerable: true, + get: function () { + return _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule; + }, +}); +Object.defineProperty(exports, 'UniqueEnumValueNamesRule', { + enumerable: true, + get: function () { + return _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFieldDefinitionNamesRule', { + enumerable: true, + get: function () { + return _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueFragmentNamesRule', { + enumerable: true, + get: function () { + return _UniqueFragmentNamesRule.UniqueFragmentNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueInputFieldNamesRule', { + enumerable: true, + get: function () { + return _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationNamesRule', { + enumerable: true, + get: function () { + return _UniqueOperationNamesRule.UniqueOperationNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueOperationTypesRule', { + enumerable: true, + get: function () { + return _UniqueOperationTypesRule.UniqueOperationTypesRule; + }, +}); +Object.defineProperty(exports, 'UniqueTypeNamesRule', { + enumerable: true, + get: function () { + return _UniqueTypeNamesRule.UniqueTypeNamesRule; + }, +}); +Object.defineProperty(exports, 'UniqueVariableNamesRule', { + enumerable: true, + get: function () { + return _UniqueVariableNamesRule.UniqueVariableNamesRule; + }, +}); +Object.defineProperty(exports, 'ValidationContext', { + enumerable: true, + get: function () { + return _ValidationContext.ValidationContext; + }, +}); +Object.defineProperty(exports, 'ValuesOfCorrectTypeRule', { + enumerable: true, + get: function () { + return _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule; + }, +}); +Object.defineProperty(exports, 'VariablesAreInputTypesRule', { + enumerable: true, + get: function () { + return _VariablesAreInputTypesRule.VariablesAreInputTypesRule; + }, +}); +Object.defineProperty(exports, 'VariablesInAllowedPositionRule', { + enumerable: true, + get: function () { + return _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule; + }, +}); +Object.defineProperty(exports, 'specifiedRules', { + enumerable: true, + get: function () { + return _specifiedRules.specifiedRules; + }, +}); +Object.defineProperty(exports, 'validate', { + enumerable: true, + get: function () { + return _validate.validate; + }, +}); + +var _validate = require('./validate.js'); + +var _ValidationContext = require('./ValidationContext.js'); + +var _specifiedRules = require('./specifiedRules.js'); + +var _ExecutableDefinitionsRule = require('./rules/ExecutableDefinitionsRule.js'); + +var _FieldsOnCorrectTypeRule = require('./rules/FieldsOnCorrectTypeRule.js'); + +var _FragmentsOnCompositeTypesRule = require('./rules/FragmentsOnCompositeTypesRule.js'); + +var _KnownArgumentNamesRule = require('./rules/KnownArgumentNamesRule.js'); + +var _KnownDirectivesRule = require('./rules/KnownDirectivesRule.js'); + +var _KnownFragmentNamesRule = require('./rules/KnownFragmentNamesRule.js'); + +var _KnownTypeNamesRule = require('./rules/KnownTypeNamesRule.js'); + +var _LoneAnonymousOperationRule = require('./rules/LoneAnonymousOperationRule.js'); + +var _NoFragmentCyclesRule = require('./rules/NoFragmentCyclesRule.js'); + +var _NoUndefinedVariablesRule = require('./rules/NoUndefinedVariablesRule.js'); + +var _NoUnusedFragmentsRule = require('./rules/NoUnusedFragmentsRule.js'); + +var _NoUnusedVariablesRule = require('./rules/NoUnusedVariablesRule.js'); + +var _OverlappingFieldsCanBeMergedRule = require('./rules/OverlappingFieldsCanBeMergedRule.js'); + +var _PossibleFragmentSpreadsRule = require('./rules/PossibleFragmentSpreadsRule.js'); + +var _ProvidedRequiredArgumentsRule = require('./rules/ProvidedRequiredArgumentsRule.js'); + +var _ScalarLeafsRule = require('./rules/ScalarLeafsRule.js'); + +var _SingleFieldSubscriptionsRule = require('./rules/SingleFieldSubscriptionsRule.js'); + +var _UniqueArgumentNamesRule = require('./rules/UniqueArgumentNamesRule.js'); + +var _UniqueDirectivesPerLocationRule = require('./rules/UniqueDirectivesPerLocationRule.js'); + +var _UniqueFragmentNamesRule = require('./rules/UniqueFragmentNamesRule.js'); + +var _UniqueInputFieldNamesRule = require('./rules/UniqueInputFieldNamesRule.js'); + +var _UniqueOperationNamesRule = require('./rules/UniqueOperationNamesRule.js'); + +var _UniqueVariableNamesRule = require('./rules/UniqueVariableNamesRule.js'); + +var _ValuesOfCorrectTypeRule = require('./rules/ValuesOfCorrectTypeRule.js'); + +var _VariablesAreInputTypesRule = require('./rules/VariablesAreInputTypesRule.js'); + +var _VariablesInAllowedPositionRule = require('./rules/VariablesInAllowedPositionRule.js'); + +var _LoneSchemaDefinitionRule = require('./rules/LoneSchemaDefinitionRule.js'); + +var _UniqueOperationTypesRule = require('./rules/UniqueOperationTypesRule.js'); + +var _UniqueTypeNamesRule = require('./rules/UniqueTypeNamesRule.js'); + +var _UniqueEnumValueNamesRule = require('./rules/UniqueEnumValueNamesRule.js'); + +var _UniqueFieldDefinitionNamesRule = require('./rules/UniqueFieldDefinitionNamesRule.js'); + +var _UniqueArgumentDefinitionNamesRule = require('./rules/UniqueArgumentDefinitionNamesRule.js'); + +var _UniqueDirectiveNamesRule = require('./rules/UniqueDirectiveNamesRule.js'); + +var _PossibleTypeExtensionsRule = require('./rules/PossibleTypeExtensionsRule.js'); + +var _NoDeprecatedCustomRule = require('./rules/custom/NoDeprecatedCustomRule.js'); + +var _NoSchemaIntrospectionCustomRule = require('./rules/custom/NoSchemaIntrospectionCustomRule.js'); diff --git a/graphql-subscription/node_modules/graphql/validation/index.mjs b/graphql-subscription/node_modules/graphql/validation/index.mjs new file mode 100644 index 0000000..ebb103b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/index.mjs @@ -0,0 +1,68 @@ +export { validate } from './validate.mjs'; +export { ValidationContext } from './ValidationContext.mjs'; +// All validation rules in the GraphQL Specification. +export { specifiedRules } from './specifiedRules.mjs'; // Spec Section: "Executable Definitions" + +export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule.mjs'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" + +export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule.mjs'; // Spec Section: "Fragments on Composite Types" + +export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule.mjs'; // Spec Section: "Argument Names" + +export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule.mjs'; // Spec Section: "Directives Are Defined" + +export { KnownDirectivesRule } from './rules/KnownDirectivesRule.mjs'; // Spec Section: "Fragment spread target defined" + +export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule.mjs'; // Spec Section: "Fragment Spread Type Existence" + +export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule.mjs'; // Spec Section: "Lone Anonymous Operation" + +export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule.mjs'; // Spec Section: "Fragments must not form cycles" + +export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule.mjs'; // Spec Section: "All Variable Used Defined" + +export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule.mjs'; // Spec Section: "Fragments must be used" + +export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule.mjs'; // Spec Section: "All Variables Used" + +export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule.mjs'; // Spec Section: "Field Selection Merging" + +export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule.mjs'; // Spec Section: "Fragment spread is possible" + +export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule.mjs'; // Spec Section: "Argument Optionality" + +export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule.mjs'; // Spec Section: "Leaf Field Selections" + +export { ScalarLeafsRule } from './rules/ScalarLeafsRule.mjs'; // Spec Section: "Subscriptions with Single Root Field" + +export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule.mjs'; // Spec Section: "Argument Uniqueness" + +export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule.mjs'; // Spec Section: "Directives Are Unique Per Location" + +export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule.mjs'; // Spec Section: "Fragment Name Uniqueness" + +export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule.mjs'; // Spec Section: "Input Object Field Uniqueness" + +export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule.mjs'; // Spec Section: "Operation Name Uniqueness" + +export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule.mjs'; // Spec Section: "Variable Uniqueness" + +export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule.mjs'; // Spec Section: "Values Type Correctness" + +export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule.mjs'; // Spec Section: "Variables are Input Types" + +export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule.mjs'; // Spec Section: "All Variable Usages Are Allowed" + +export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule.mjs'; // SDL-specific validation rules + +export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule.mjs'; +export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule.mjs'; +export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule.mjs'; +export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule.mjs'; +export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule.mjs'; +export { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule.mjs'; +export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule.mjs'; +export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule.mjs'; // Optional rules not defined by the GraphQL Specification + +export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule.mjs'; +export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule.mjs'; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts new file mode 100644 index 0000000..8f58c78 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + */ +export declare function ExecutableDefinitionsRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js b/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js new file mode 100644 index 0000000..e20c621 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ExecutableDefinitionsRule = ExecutableDefinitionsRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _predicates = require('../../language/predicates.js'); + +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + */ +function ExecutableDefinitionsRule(context) { + return { + Document(node) { + for (const definition of node.definitions) { + if (!(0, _predicates.isExecutableDefinitionNode)(definition)) { + const defName = + definition.kind === _kinds.Kind.SCHEMA_DEFINITION || + definition.kind === _kinds.Kind.SCHEMA_EXTENSION + ? 'schema' + : '"' + definition.name.value + '"'; + context.reportError( + new _GraphQLError.GraphQLError( + `The ${defName} definition is not executable.`, + { + nodes: definition, + }, + ), + ); + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs new file mode 100644 index 0000000..b83cee4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs @@ -0,0 +1,34 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { isExecutableDefinitionNode } from '../../language/predicates.mjs'; + +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + */ +export function ExecutableDefinitionsRule(context) { + return { + Document(node) { + for (const definition of node.definitions) { + if (!isExecutableDefinitionNode(definition)) { + const defName = + definition.kind === Kind.SCHEMA_DEFINITION || + definition.kind === Kind.SCHEMA_EXTENSION + ? 'schema' + : '"' + definition.name.value + '"'; + context.reportError( + new GraphQLError(`The ${defName} definition is not executable.`, { + nodes: definition, + }), + ); + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts new file mode 100644 index 0000000..127335b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + */ +export declare function FieldsOnCorrectTypeRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js b/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js new file mode 100644 index 0000000..d08e1df --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js @@ -0,0 +1,145 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.FieldsOnCorrectTypeRule = FieldsOnCorrectTypeRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _naturalCompare = require('../../jsutils/naturalCompare.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + */ +function FieldsOnCorrectTypeRule(context) { + return { + Field(node) { + const type = context.getParentType(); + + if (type) { + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + // This field doesn't exist, lets look for suggestions. + const schema = context.getSchema(); + const fieldName = node.name.value; // First determine if there are any suggested types to condition on. + + let suggestion = (0, _didYouMean.didYouMean)( + 'to use an inline fragment on', + getSuggestedTypeNames(schema, type, fieldName), + ); // If there are no suggested types, then perhaps this was a typo? + + if (suggestion === '') { + suggestion = (0, _didYouMean.didYouMean)( + getSuggestedFieldNames(type, fieldName), + ); + } // Report an error, including helpful suggestions. + + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot query field "${fieldName}" on type "${type.name}".` + + suggestion, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} +/** + * Go through all of the implementations of type, as well as the interfaces that + * they implement. If any of those types include the provided field, suggest them, + * sorted by how often the type is referenced. + */ + +function getSuggestedTypeNames(schema, type, fieldName) { + if (!(0, _definition.isAbstractType)(type)) { + // Must be an Object type, which does not have possible fields. + return []; + } + + const suggestedTypes = new Set(); + const usageCount = Object.create(null); + + for (const possibleType of schema.getPossibleTypes(type)) { + if (!possibleType.getFields()[fieldName]) { + continue; + } // This object type defines this field. + + suggestedTypes.add(possibleType); + usageCount[possibleType.name] = 1; + + for (const possibleInterface of possibleType.getInterfaces()) { + var _usageCount$possibleI; + + if (!possibleInterface.getFields()[fieldName]) { + continue; + } // This interface type defines this field. + + suggestedTypes.add(possibleInterface); + usageCount[possibleInterface.name] = + ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== + null && _usageCount$possibleI !== void 0 + ? _usageCount$possibleI + : 0) + 1; + } + } + + return [...suggestedTypes] + .sort((typeA, typeB) => { + // Suggest both interface and object types based on how common they are. + const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; + + if (usageCountDiff !== 0) { + return usageCountDiff; + } // Suggest super types first followed by subtypes + + if ( + (0, _definition.isInterfaceType)(typeA) && + schema.isSubType(typeA, typeB) + ) { + return -1; + } + + if ( + (0, _definition.isInterfaceType)(typeB) && + schema.isSubType(typeB, typeA) + ) { + return 1; + } + + return (0, _naturalCompare.naturalCompare)(typeA.name, typeB.name); + }) + .map((x) => x.name); +} +/** + * For the field name provided, determine if there are any similar field names + * that may be the result of a typo. + */ + +function getSuggestedFieldNames(type, fieldName) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) + ) { + const possibleFieldNames = Object.keys(type.getFields()); + return (0, _suggestionList.suggestionList)(fieldName, possibleFieldNames); + } // Otherwise, must be a Union type, which does not define fields. + + return []; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs new file mode 100644 index 0000000..c955265 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs @@ -0,0 +1,127 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { naturalCompare } from '../../jsutils/naturalCompare.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { + isAbstractType, + isInterfaceType, + isObjectType, +} from '../../type/definition.mjs'; + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + */ +export function FieldsOnCorrectTypeRule(context) { + return { + Field(node) { + const type = context.getParentType(); + + if (type) { + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + // This field doesn't exist, lets look for suggestions. + const schema = context.getSchema(); + const fieldName = node.name.value; // First determine if there are any suggested types to condition on. + + let suggestion = didYouMean( + 'to use an inline fragment on', + getSuggestedTypeNames(schema, type, fieldName), + ); // If there are no suggested types, then perhaps this was a typo? + + if (suggestion === '') { + suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); + } // Report an error, including helpful suggestions. + + context.reportError( + new GraphQLError( + `Cannot query field "${fieldName}" on type "${type.name}".` + + suggestion, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} +/** + * Go through all of the implementations of type, as well as the interfaces that + * they implement. If any of those types include the provided field, suggest them, + * sorted by how often the type is referenced. + */ + +function getSuggestedTypeNames(schema, type, fieldName) { + if (!isAbstractType(type)) { + // Must be an Object type, which does not have possible fields. + return []; + } + + const suggestedTypes = new Set(); + const usageCount = Object.create(null); + + for (const possibleType of schema.getPossibleTypes(type)) { + if (!possibleType.getFields()[fieldName]) { + continue; + } // This object type defines this field. + + suggestedTypes.add(possibleType); + usageCount[possibleType.name] = 1; + + for (const possibleInterface of possibleType.getInterfaces()) { + var _usageCount$possibleI; + + if (!possibleInterface.getFields()[fieldName]) { + continue; + } // This interface type defines this field. + + suggestedTypes.add(possibleInterface); + usageCount[possibleInterface.name] = + ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== + null && _usageCount$possibleI !== void 0 + ? _usageCount$possibleI + : 0) + 1; + } + } + + return [...suggestedTypes] + .sort((typeA, typeB) => { + // Suggest both interface and object types based on how common they are. + const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; + + if (usageCountDiff !== 0) { + return usageCountDiff; + } // Suggest super types first followed by subtypes + + if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { + return -1; + } + + if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { + return 1; + } + + return naturalCompare(typeA.name, typeB.name); + }) + .map((x) => x.name); +} +/** + * For the field name provided, determine if there are any similar field names + * that may be the result of a typo. + */ + +function getSuggestedFieldNames(type, fieldName) { + if (isObjectType(type) || isInterfaceType(type)) { + const possibleFieldNames = Object.keys(type.getFields()); + return suggestionList(fieldName, possibleFieldNames); + } // Otherwise, must be a Union type, which does not define fields. + + return []; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts new file mode 100644 index 0000000..a0c5819 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts @@ -0,0 +1,14 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + */ +export declare function FragmentsOnCompositeTypesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js new file mode 100644 index 0000000..26744e5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js @@ -0,0 +1,69 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.FragmentsOnCompositeTypesRule = FragmentsOnCompositeTypesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + */ +function FragmentsOnCompositeTypesRule(context) { + return { + InlineFragment(node) { + const typeCondition = node.typeCondition; + + if (typeCondition) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + typeCondition, + ); + + if (type && !(0, _definition.isCompositeType)(type)) { + const typeStr = (0, _printer.print)(typeCondition); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment cannot condition on non composite type "${typeStr}".`, + { + nodes: typeCondition, + }, + ), + ); + } + } + }, + + FragmentDefinition(node) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + node.typeCondition, + ); + + if (type && !(0, _definition.isCompositeType)(type)) { + const typeStr = (0, _printer.print)(node.typeCondition); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, + { + nodes: node.typeCondition, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs new file mode 100644 index 0000000..2443774 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs @@ -0,0 +1,53 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { print } from '../../language/printer.mjs'; +import { isCompositeType } from '../../type/definition.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + */ +export function FragmentsOnCompositeTypesRule(context) { + return { + InlineFragment(node) { + const typeCondition = node.typeCondition; + + if (typeCondition) { + const type = typeFromAST(context.getSchema(), typeCondition); + + if (type && !isCompositeType(type)) { + const typeStr = print(typeCondition); + context.reportError( + new GraphQLError( + `Fragment cannot condition on non composite type "${typeStr}".`, + { + nodes: typeCondition, + }, + ), + ); + } + } + }, + + FragmentDefinition(node) { + const type = typeFromAST(context.getSchema(), node.typeCondition); + + if (type && !isCompositeType(type)) { + const typeStr = print(node.typeCondition); + context.reportError( + new GraphQLError( + `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, + { + nodes: node.typeCondition, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts new file mode 100644 index 0000000..9e03ac3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts @@ -0,0 +1,23 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + */ +export declare function KnownArgumentNamesRule( + context: ValidationContext, +): ASTVisitor; +/** + * @internal + */ +export declare function KnownArgumentNamesOnDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js new file mode 100644 index 0000000..98f8f36 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js @@ -0,0 +1,120 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownArgumentNamesOnDirectivesRule = KnownArgumentNamesOnDirectivesRule; +exports.KnownArgumentNamesRule = KnownArgumentNamesRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + */ +function KnownArgumentNamesRule(context) { + return { + // eslint-disable-next-line new-cap + ...KnownArgumentNamesOnDirectivesRule(context), + + Argument(argNode) { + const argDef = context.getArgument(); + const fieldDef = context.getFieldDef(); + const parentType = context.getParentType(); + + if (!argDef && fieldDef && parentType) { + const argName = argNode.name.value; + const knownArgsNames = fieldDef.args.map((arg) => arg.name); + const suggestions = (0, _suggestionList.suggestionList)( + argName, + knownArgsNames, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + + (0, _didYouMean.didYouMean)(suggestions), + { + nodes: argNode, + }, + ), + ); + } + }, + }; +} +/** + * @internal + */ + +function KnownArgumentNamesOnDirectivesRule(context) { + const directiveArgs = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + directiveArgs[directive.name] = directive.args.map((arg) => arg.name); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argsNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); + } + } + + return { + Directive(directiveNode) { + const directiveName = directiveNode.name.value; + const knownArgs = directiveArgs[directiveName]; + + if (directiveNode.arguments && knownArgs) { + for (const argNode of directiveNode.arguments) { + const argName = argNode.name.value; + + if (!knownArgs.includes(argName)) { + const suggestions = (0, _suggestionList.suggestionList)( + argName, + knownArgs, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown argument "${argName}" on directive "@${directiveName}".` + + (0, _didYouMean.didYouMean)(suggestions), + { + nodes: argNode, + }, + ), + ); + } + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs new file mode 100644 index 0000000..2213728 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs @@ -0,0 +1,102 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + */ +export function KnownArgumentNamesRule(context) { + return { + // eslint-disable-next-line new-cap + ...KnownArgumentNamesOnDirectivesRule(context), + + Argument(argNode) { + const argDef = context.getArgument(); + const fieldDef = context.getFieldDef(); + const parentType = context.getParentType(); + + if (!argDef && fieldDef && parentType) { + const argName = argNode.name.value; + const knownArgsNames = fieldDef.args.map((arg) => arg.name); + const suggestions = suggestionList(argName, knownArgsNames); + context.reportError( + new GraphQLError( + `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + + didYouMean(suggestions), + { + nodes: argNode, + }, + ), + ); + } + }, + }; +} +/** + * @internal + */ + +export function KnownArgumentNamesOnDirectivesRule(context) { + const directiveArgs = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + + for (const directive of definedDirectives) { + directiveArgs[directive.name] = directive.args.map((arg) => arg.name); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argsNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); + } + } + + return { + Directive(directiveNode) { + const directiveName = directiveNode.name.value; + const knownArgs = directiveArgs[directiveName]; + + if (directiveNode.arguments && knownArgs) { + for (const argNode of directiveNode.arguments) { + const argName = argNode.name.value; + + if (!knownArgs.includes(argName)) { + const suggestions = suggestionList(argName, knownArgs); + context.reportError( + new GraphQLError( + `Unknown argument "${argName}" on directive "@${directiveName}".` + + didYouMean(suggestions), + { + nodes: argNode, + }, + ), + ); + } + } + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts new file mode 100644 index 0000000..9f3fee4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts @@ -0,0 +1,16 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + */ +export declare function KnownDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.js new file mode 100644 index 0000000..8ee4a3f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.js @@ -0,0 +1,167 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownDirectivesRule = KnownDirectivesRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _invariant = require('../../jsutils/invariant.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _ast = require('../../language/ast.js'); + +var _directiveLocation = require('../../language/directiveLocation.js'); + +var _kinds = require('../../language/kinds.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + */ +function KnownDirectivesRule(context) { + const locationsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + locationsMap[directive.name] = directive.locations; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + locationsMap[def.name.value] = def.locations.map((name) => name.value); + } + } + + return { + Directive(node, _key, _parent, _path, ancestors) { + const name = node.name.value; + const locations = locationsMap[name]; + + if (!locations) { + context.reportError( + new _GraphQLError.GraphQLError(`Unknown directive "@${name}".`, { + nodes: node, + }), + ); + return; + } + + const candidateLocation = getDirectiveLocationForASTPath(ancestors); + + if (candidateLocation && !locations.includes(candidateLocation)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${name}" may not be used on ${candidateLocation}.`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getDirectiveLocationForASTPath(ancestors) { + const appliedTo = ancestors[ancestors.length - 1]; + 'kind' in appliedTo || (0, _invariant.invariant)(false); + + switch (appliedTo.kind) { + case _kinds.Kind.OPERATION_DEFINITION: + return getDirectiveLocationForOperation(appliedTo.operation); + + case _kinds.Kind.FIELD: + return _directiveLocation.DirectiveLocation.FIELD; + + case _kinds.Kind.FRAGMENT_SPREAD: + return _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD; + + case _kinds.Kind.INLINE_FRAGMENT: + return _directiveLocation.DirectiveLocation.INLINE_FRAGMENT; + + case _kinds.Kind.FRAGMENT_DEFINITION: + return _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION; + + case _kinds.Kind.VARIABLE_DEFINITION: + return _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION; + + case _kinds.Kind.SCHEMA_DEFINITION: + case _kinds.Kind.SCHEMA_EXTENSION: + return _directiveLocation.DirectiveLocation.SCHEMA; + + case _kinds.Kind.SCALAR_TYPE_DEFINITION: + case _kinds.Kind.SCALAR_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.SCALAR; + + case _kinds.Kind.OBJECT_TYPE_DEFINITION: + case _kinds.Kind.OBJECT_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.OBJECT; + + case _kinds.Kind.FIELD_DEFINITION: + return _directiveLocation.DirectiveLocation.FIELD_DEFINITION; + + case _kinds.Kind.INTERFACE_TYPE_DEFINITION: + case _kinds.Kind.INTERFACE_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.INTERFACE; + + case _kinds.Kind.UNION_TYPE_DEFINITION: + case _kinds.Kind.UNION_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.UNION; + + case _kinds.Kind.ENUM_TYPE_DEFINITION: + case _kinds.Kind.ENUM_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.ENUM; + + case _kinds.Kind.ENUM_VALUE_DEFINITION: + return _directiveLocation.DirectiveLocation.ENUM_VALUE; + + case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: + case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: + return _directiveLocation.DirectiveLocation.INPUT_OBJECT; + + case _kinds.Kind.INPUT_VALUE_DEFINITION: { + const parentNode = ancestors[ancestors.length - 3]; + 'kind' in parentNode || (0, _invariant.invariant)(false); + return parentNode.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION + ? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION + : _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION; + } + // Not reachable, all possible types have been considered. + + /* c8 ignore next */ + + default: + false || + (0, _invariant.invariant)( + false, + 'Unexpected kind: ' + (0, _inspect.inspect)(appliedTo.kind), + ); + } +} + +function getDirectiveLocationForOperation(operation) { + switch (operation) { + case _ast.OperationTypeNode.QUERY: + return _directiveLocation.DirectiveLocation.QUERY; + + case _ast.OperationTypeNode.MUTATION: + return _directiveLocation.DirectiveLocation.MUTATION; + + case _ast.OperationTypeNode.SUBSCRIPTION: + return _directiveLocation.DirectiveLocation.SUBSCRIPTION; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs new file mode 100644 index 0000000..6755ff1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs @@ -0,0 +1,150 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { invariant } from '../../jsutils/invariant.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { OperationTypeNode } from '../../language/ast.mjs'; +import { DirectiveLocation } from '../../language/directiveLocation.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + */ +export function KnownDirectivesRule(context) { + const locationsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + + for (const directive of definedDirectives) { + locationsMap[directive.name] = directive.locations; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + locationsMap[def.name.value] = def.locations.map((name) => name.value); + } + } + + return { + Directive(node, _key, _parent, _path, ancestors) { + const name = node.name.value; + const locations = locationsMap[name]; + + if (!locations) { + context.reportError( + new GraphQLError(`Unknown directive "@${name}".`, { + nodes: node, + }), + ); + return; + } + + const candidateLocation = getDirectiveLocationForASTPath(ancestors); + + if (candidateLocation && !locations.includes(candidateLocation)) { + context.reportError( + new GraphQLError( + `Directive "@${name}" may not be used on ${candidateLocation}.`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getDirectiveLocationForASTPath(ancestors) { + const appliedTo = ancestors[ancestors.length - 1]; + 'kind' in appliedTo || invariant(false); + + switch (appliedTo.kind) { + case Kind.OPERATION_DEFINITION: + return getDirectiveLocationForOperation(appliedTo.operation); + + case Kind.FIELD: + return DirectiveLocation.FIELD; + + case Kind.FRAGMENT_SPREAD: + return DirectiveLocation.FRAGMENT_SPREAD; + + case Kind.INLINE_FRAGMENT: + return DirectiveLocation.INLINE_FRAGMENT; + + case Kind.FRAGMENT_DEFINITION: + return DirectiveLocation.FRAGMENT_DEFINITION; + + case Kind.VARIABLE_DEFINITION: + return DirectiveLocation.VARIABLE_DEFINITION; + + case Kind.SCHEMA_DEFINITION: + case Kind.SCHEMA_EXTENSION: + return DirectiveLocation.SCHEMA; + + case Kind.SCALAR_TYPE_DEFINITION: + case Kind.SCALAR_TYPE_EXTENSION: + return DirectiveLocation.SCALAR; + + case Kind.OBJECT_TYPE_DEFINITION: + case Kind.OBJECT_TYPE_EXTENSION: + return DirectiveLocation.OBJECT; + + case Kind.FIELD_DEFINITION: + return DirectiveLocation.FIELD_DEFINITION; + + case Kind.INTERFACE_TYPE_DEFINITION: + case Kind.INTERFACE_TYPE_EXTENSION: + return DirectiveLocation.INTERFACE; + + case Kind.UNION_TYPE_DEFINITION: + case Kind.UNION_TYPE_EXTENSION: + return DirectiveLocation.UNION; + + case Kind.ENUM_TYPE_DEFINITION: + case Kind.ENUM_TYPE_EXTENSION: + return DirectiveLocation.ENUM; + + case Kind.ENUM_VALUE_DEFINITION: + return DirectiveLocation.ENUM_VALUE; + + case Kind.INPUT_OBJECT_TYPE_DEFINITION: + case Kind.INPUT_OBJECT_TYPE_EXTENSION: + return DirectiveLocation.INPUT_OBJECT; + + case Kind.INPUT_VALUE_DEFINITION: { + const parentNode = ancestors[ancestors.length - 3]; + 'kind' in parentNode || invariant(false); + return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION + ? DirectiveLocation.INPUT_FIELD_DEFINITION + : DirectiveLocation.ARGUMENT_DEFINITION; + } + // Not reachable, all possible types have been considered. + + /* c8 ignore next */ + + default: + false || invariant(false, 'Unexpected kind: ' + inspect(appliedTo.kind)); + } +} + +function getDirectiveLocationForOperation(operation) { + switch (operation) { + case OperationTypeNode.QUERY: + return DirectiveLocation.QUERY; + + case OperationTypeNode.MUTATION: + return DirectiveLocation.MUTATION; + + case OperationTypeNode.SUBSCRIPTION: + return DirectiveLocation.SUBSCRIPTION; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts new file mode 100644 index 0000000..7b783fd --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + */ +export declare function KnownFragmentNamesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js new file mode 100644 index 0000000..92c7646 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js @@ -0,0 +1,36 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownFragmentNamesRule = KnownFragmentNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + */ +function KnownFragmentNamesRule(context) { + return { + FragmentSpread(node) { + const fragmentName = node.name.value; + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown fragment "${fragmentName}".`, + { + nodes: node.name, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs new file mode 100644 index 0000000..f4b5307 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs @@ -0,0 +1,26 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + */ +export function KnownFragmentNamesRule(context) { + return { + FragmentSpread(node) { + const fragmentName = node.name.value; + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + context.reportError( + new GraphQLError(`Unknown fragment "${fragmentName}".`, { + nodes: node.name, + }), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts new file mode 100644 index 0000000..9f761ec --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts @@ -0,0 +1,16 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + */ +export declare function KnownTypeNamesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.js new file mode 100644 index 0000000..67685d2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.js @@ -0,0 +1,89 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.KnownTypeNamesRule = KnownTypeNamesRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _predicates = require('../../language/predicates.js'); + +var _introspection = require('../../type/introspection.js'); + +var _scalars = require('../../type/scalars.js'); + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + */ +function KnownTypeNamesRule(context) { + const schema = context.getSchema(); + const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if ((0, _predicates.isTypeDefinitionNode)(def)) { + definedTypes[def.name.value] = true; + } + } + + const typeNames = [ + ...Object.keys(existingTypesMap), + ...Object.keys(definedTypes), + ]; + return { + NamedType(node, _1, parent, _2, ancestors) { + const typeName = node.name.value; + + if (!existingTypesMap[typeName] && !definedTypes[typeName]) { + var _ancestors$; + + const definitionNode = + (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 + ? _ancestors$ + : parent; + const isSDL = definitionNode != null && isSDLNode(definitionNode); + + if (isSDL && standardTypeNames.includes(typeName)) { + return; + } + + const suggestedTypes = (0, _suggestionList.suggestionList)( + typeName, + isSDL ? standardTypeNames.concat(typeNames) : typeNames, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Unknown type "${typeName}".` + + (0, _didYouMean.didYouMean)(suggestedTypes), + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +const standardTypeNames = [ + ..._scalars.specifiedScalarTypes, + ..._introspection.introspectionTypes, +].map((type) => type.name); + +function isSDLNode(value) { + return ( + 'kind' in value && + ((0, _predicates.isTypeSystemDefinitionNode)(value) || + (0, _predicates.isTypeSystemExtensionNode)(value)) + ); +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs new file mode 100644 index 0000000..424b162 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs @@ -0,0 +1,77 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { + isTypeDefinitionNode, + isTypeSystemDefinitionNode, + isTypeSystemExtensionNode, +} from '../../language/predicates.mjs'; +import { introspectionTypes } from '../../type/introspection.mjs'; +import { specifiedScalarTypes } from '../../type/scalars.mjs'; + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + */ +export function KnownTypeNamesRule(context) { + const schema = context.getSchema(); + const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if (isTypeDefinitionNode(def)) { + definedTypes[def.name.value] = true; + } + } + + const typeNames = [ + ...Object.keys(existingTypesMap), + ...Object.keys(definedTypes), + ]; + return { + NamedType(node, _1, parent, _2, ancestors) { + const typeName = node.name.value; + + if (!existingTypesMap[typeName] && !definedTypes[typeName]) { + var _ancestors$; + + const definitionNode = + (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 + ? _ancestors$ + : parent; + const isSDL = definitionNode != null && isSDLNode(definitionNode); + + if (isSDL && standardTypeNames.includes(typeName)) { + return; + } + + const suggestedTypes = suggestionList( + typeName, + isSDL ? standardTypeNames.concat(typeNames) : typeNames, + ); + context.reportError( + new GraphQLError( + `Unknown type "${typeName}".` + didYouMean(suggestedTypes), + { + nodes: node, + }, + ), + ); + } + }, + }; +} +const standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map( + (type) => type.name, +); + +function isSDLNode(value) { + return ( + 'kind' in value && + (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)) + ); +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts new file mode 100644 index 0000000..60563cb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + */ +export declare function LoneAnonymousOperationRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js b/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js new file mode 100644 index 0000000..46f3f48 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.LoneAnonymousOperationRule = LoneAnonymousOperationRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + */ +function LoneAnonymousOperationRule(context) { + let operationCount = 0; + return { + Document(node) { + operationCount = node.definitions.filter( + (definition) => definition.kind === _kinds.Kind.OPERATION_DEFINITION, + ).length; + }, + + OperationDefinition(node) { + if (!node.name && operationCount > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + 'This anonymous operation must be the only defined operation.', + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs new file mode 100644 index 0000000..1a21a39 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs @@ -0,0 +1,34 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + */ +export function LoneAnonymousOperationRule(context) { + let operationCount = 0; + return { + Document(node) { + operationCount = node.definitions.filter( + (definition) => definition.kind === Kind.OPERATION_DEFINITION, + ).length; + }, + + OperationDefinition(node) { + if (!node.name && operationCount > 1) { + context.reportError( + new GraphQLError( + 'This anonymous operation must be the only defined operation.', + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts new file mode 100644 index 0000000..bf926d2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +export declare function LoneSchemaDefinitionRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js b/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js new file mode 100644 index 0000000..a5757cc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js @@ -0,0 +1,67 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.LoneSchemaDefinitionRule = LoneSchemaDefinitionRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +function LoneSchemaDefinitionRule(context) { + var _ref, _ref2, _oldSchema$astNode; + + const oldSchema = context.getSchema(); + const alreadyDefined = + (_ref = + (_ref2 = + (_oldSchema$astNode = + oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 + ? _oldSchema$astNode + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getQueryType()) !== null && _ref2 !== void 0 + ? _ref2 + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getMutationType()) !== null && _ref !== void 0 + ? _ref + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getSubscriptionType(); + let schemaDefinitionsCount = 0; + return { + SchemaDefinition(node) { + if (alreadyDefined) { + context.reportError( + new _GraphQLError.GraphQLError( + 'Cannot define a new schema within a schema extension.', + { + nodes: node, + }, + ), + ); + return; + } + + if (schemaDefinitionsCount > 0) { + context.reportError( + new _GraphQLError.GraphQLError( + 'Must provide only one schema definition.', + { + nodes: node, + }, + ), + ); + } + + ++schemaDefinitionsCount; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs new file mode 100644 index 0000000..4287eaa --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs @@ -0,0 +1,57 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +export function LoneSchemaDefinitionRule(context) { + var _ref, _ref2, _oldSchema$astNode; + + const oldSchema = context.getSchema(); + const alreadyDefined = + (_ref = + (_ref2 = + (_oldSchema$astNode = + oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 + ? _oldSchema$astNode + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getQueryType()) !== null && _ref2 !== void 0 + ? _ref2 + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getMutationType()) !== null && _ref !== void 0 + ? _ref + : oldSchema === null || oldSchema === void 0 + ? void 0 + : oldSchema.getSubscriptionType(); + let schemaDefinitionsCount = 0; + return { + SchemaDefinition(node) { + if (alreadyDefined) { + context.reportError( + new GraphQLError( + 'Cannot define a new schema within a schema extension.', + { + nodes: node, + }, + ), + ); + return; + } + + if (schemaDefinitionsCount > 0) { + context.reportError( + new GraphQLError('Must provide only one schema definition.', { + nodes: node, + }), + ); + } + + ++schemaDefinitionsCount; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts new file mode 100644 index 0000000..b9fbeef --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + */ +export declare function NoFragmentCyclesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js new file mode 100644 index 0000000..88744ac --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js @@ -0,0 +1,85 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoFragmentCyclesRule = NoFragmentCyclesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + */ +function NoFragmentCyclesRule(context) { + // Tracks already visited fragments to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors + + const spreadPath = []; // Position in the spread path + + const spreadPathIndexByName = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + detectCycleRecursive(node); + return false; + }, + }; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(fragment) { + if (visitedFrags[fragment.name.value]) { + return; + } + + const fragmentName = fragment.name.value; + visitedFrags[fragmentName] = true; + const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); + + if (spreadNodes.length === 0) { + return; + } + + spreadPathIndexByName[fragmentName] = spreadPath.length; + + for (const spreadNode of spreadNodes) { + const spreadName = spreadNode.name.value; + const cycleIndex = spreadPathIndexByName[spreadName]; + spreadPath.push(spreadNode); + + if (cycleIndex === undefined) { + const spreadFragment = context.getFragment(spreadName); + + if (spreadFragment) { + detectCycleRecursive(spreadFragment); + } + } else { + const cyclePath = spreadPath.slice(cycleIndex); + const viaPath = cyclePath + .slice(0, -1) + .map((s) => '"' + s.name.value + '"') + .join(', '); + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot spread fragment "${spreadName}" within itself` + + (viaPath !== '' ? ` via ${viaPath}.` : '.'), + { + nodes: cyclePath, + }, + ), + ); + } + + spreadPath.pop(); + } + + spreadPathIndexByName[fragmentName] = undefined; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs new file mode 100644 index 0000000..014f1d2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs @@ -0,0 +1,78 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + */ +export function NoFragmentCyclesRule(context) { + // Tracks already visited fragments to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors + + const spreadPath = []; // Position in the spread path + + const spreadPathIndexByName = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + detectCycleRecursive(node); + return false; + }, + }; // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + + function detectCycleRecursive(fragment) { + if (visitedFrags[fragment.name.value]) { + return; + } + + const fragmentName = fragment.name.value; + visitedFrags[fragmentName] = true; + const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); + + if (spreadNodes.length === 0) { + return; + } + + spreadPathIndexByName[fragmentName] = spreadPath.length; + + for (const spreadNode of spreadNodes) { + const spreadName = spreadNode.name.value; + const cycleIndex = spreadPathIndexByName[spreadName]; + spreadPath.push(spreadNode); + + if (cycleIndex === undefined) { + const spreadFragment = context.getFragment(spreadName); + + if (spreadFragment) { + detectCycleRecursive(spreadFragment); + } + } else { + const cyclePath = spreadPath.slice(cycleIndex); + const viaPath = cyclePath + .slice(0, -1) + .map((s) => '"' + s.name.value + '"') + .join(', '); + context.reportError( + new GraphQLError( + `Cannot spread fragment "${spreadName}" within itself` + + (viaPath !== '' ? ` via ${viaPath}.` : '.'), + { + nodes: cyclePath, + }, + ), + ); + } + + spreadPath.pop(); + } + + spreadPathIndexByName[fragmentName] = undefined; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts new file mode 100644 index 0000000..40e5d74 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + */ +export declare function NoUndefinedVariablesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js new file mode 100644 index 0000000..2e9bdce --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js @@ -0,0 +1,52 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoUndefinedVariablesRule = NoUndefinedVariablesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + */ +function NoUndefinedVariablesRule(context) { + let variableNameDefined = Object.create(null); + return { + OperationDefinition: { + enter() { + variableNameDefined = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + const varName = node.name.value; + + if (variableNameDefined[varName] !== true) { + context.reportError( + new _GraphQLError.GraphQLError( + operation.name + ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` + : `Variable "$${varName}" is not defined.`, + { + nodes: [node, operation], + }, + ), + ); + } + } + }, + }, + + VariableDefinition(node) { + variableNameDefined[node.variable.name.value] = true; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs new file mode 100644 index 0000000..29b8f37 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs @@ -0,0 +1,45 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + */ +export function NoUndefinedVariablesRule(context) { + let variableNameDefined = Object.create(null); + return { + OperationDefinition: { + enter() { + variableNameDefined = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + const varName = node.name.value; + + if (variableNameDefined[varName] !== true) { + context.reportError( + new GraphQLError( + operation.name + ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` + : `Variable "$${varName}" is not defined.`, + { + nodes: [node, operation], + }, + ), + ); + } + } + }, + }, + + VariableDefinition(node) { + variableNameDefined[node.variable.name.value] = true; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts new file mode 100644 index 0000000..c987878 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + */ +export declare function NoUnusedFragmentsRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js new file mode 100644 index 0000000..c018e21 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoUnusedFragmentsRule = NoUnusedFragmentsRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + */ +function NoUnusedFragmentsRule(context) { + const operationDefs = []; + const fragmentDefs = []; + return { + OperationDefinition(node) { + operationDefs.push(node); + return false; + }, + + FragmentDefinition(node) { + fragmentDefs.push(node); + return false; + }, + + Document: { + leave() { + const fragmentNameUsed = Object.create(null); + + for (const operation of operationDefs) { + for (const fragment of context.getRecursivelyReferencedFragments( + operation, + )) { + fragmentNameUsed[fragment.name.value] = true; + } + } + + for (const fragmentDef of fragmentDefs) { + const fragName = fragmentDef.name.value; + + if (fragmentNameUsed[fragName] !== true) { + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment "${fragName}" is never used.`, + { + nodes: fragmentDef, + }, + ), + ); + } + } + }, + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs new file mode 100644 index 0000000..8ce0735 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs @@ -0,0 +1,51 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + */ +export function NoUnusedFragmentsRule(context) { + const operationDefs = []; + const fragmentDefs = []; + return { + OperationDefinition(node) { + operationDefs.push(node); + return false; + }, + + FragmentDefinition(node) { + fragmentDefs.push(node); + return false; + }, + + Document: { + leave() { + const fragmentNameUsed = Object.create(null); + + for (const operation of operationDefs) { + for (const fragment of context.getRecursivelyReferencedFragments( + operation, + )) { + fragmentNameUsed[fragment.name.value] = true; + } + } + + for (const fragmentDef of fragmentDefs) { + const fragName = fragmentDef.name.value; + + if (fragmentNameUsed[fragName] !== true) { + context.reportError( + new GraphQLError(`Fragment "${fragName}" is never used.`, { + nodes: fragmentDef, + }), + ); + } + } + }, + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts new file mode 100644 index 0000000..118260f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + */ +export declare function NoUnusedVariablesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js new file mode 100644 index 0000000..6377e22 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoUnusedVariablesRule = NoUnusedVariablesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + */ +function NoUnusedVariablesRule(context) { + let variableDefs = []; + return { + OperationDefinition: { + enter() { + variableDefs = []; + }, + + leave(operation) { + const variableNameUsed = Object.create(null); + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + variableNameUsed[node.name.value] = true; + } + + for (const variableDef of variableDefs) { + const variableName = variableDef.variable.name.value; + + if (variableNameUsed[variableName] !== true) { + context.reportError( + new _GraphQLError.GraphQLError( + operation.name + ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` + : `Variable "$${variableName}" is never used.`, + { + nodes: variableDef, + }, + ), + ); + } + } + }, + }, + + VariableDefinition(def) { + variableDefs.push(def); + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs new file mode 100644 index 0000000..07ef8d6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs @@ -0,0 +1,50 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + */ +export function NoUnusedVariablesRule(context) { + let variableDefs = []; + return { + OperationDefinition: { + enter() { + variableDefs = []; + }, + + leave(operation) { + const variableNameUsed = Object.create(null); + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + variableNameUsed[node.name.value] = true; + } + + for (const variableDef of variableDefs) { + const variableName = variableDef.variable.name.value; + + if (variableNameUsed[variableName] !== true) { + context.reportError( + new GraphQLError( + operation.name + ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` + : `Variable "$${variableName}" is never used.`, + { + nodes: variableDef, + }, + ), + ); + } + } + }, + }, + + VariableDefinition(def) { + variableDefs.push(def); + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts new file mode 100644 index 0000000..b5d2c62 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts @@ -0,0 +1,14 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + */ +export declare function OverlappingFieldsCanBeMergedRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js b/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js new file mode 100644 index 0000000..4b29acf --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js @@ -0,0 +1,820 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.OverlappingFieldsCanBeMergedRule = OverlappingFieldsCanBeMergedRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _sortValueNode = require('../../utilities/sortValueNode.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +function reasonMessage(reason) { + if (Array.isArray(reason)) { + return reason + .map( + ([responseName, subReason]) => + `subfields "${responseName}" conflict because ` + + reasonMessage(subReason), + ) + .join(' and '); + } + + return reason; +} +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + */ + +function OverlappingFieldsCanBeMergedRule(context) { + // A memoization for when two fragments are compared "between" each other for + // conflicts. Two fragments may be compared many times, so memoizing this can + // dramatically improve the performance of this validator. + const comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given + // selection set. Selection sets may be asked for this information multiple + // times, so this improves the performance of this validator. + + const cachedFieldsAndFragmentNames = new Map(); + return { + SelectionSet(selectionSet) { + const conflicts = findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + context.getParentType(), + selectionSet, + ); + + for (const [[responseName, reason], fields1, fields2] of conflicts) { + const reasonMsg = reasonMessage(reason); + context.reportError( + new _GraphQLError.GraphQLError( + `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, + { + nodes: fields1.concat(fields2), + }, + ), + ); + } + }, + }; +} + +/** + * Algorithm: + * + * Conflicts occur when two fields exist in a query which will produce the same + * response name, but represent differing values, thus creating a conflict. + * The algorithm below finds all conflicts via making a series of comparisons + * between fields. In order to compare as few fields as possible, this makes + * a series of comparisons "within" sets of fields and "between" sets of fields. + * + * Given any selection set, a collection produces both a set of fields by + * also including all inline fragments, as well as a list of fragments + * referenced by fragment spreads. + * + * A) Each selection set represented in the document first compares "within" its + * collected set of fields, finding any conflicts between every pair of + * overlapping fields. + * Note: This is the *only time* that a the fields "within" a set are compared + * to each other. After this only fields "between" sets are compared. + * + * B) Also, if any fragment is referenced in a selection set, then a + * comparison is made "between" the original set of fields and the + * referenced fragment. + * + * C) Also, if multiple fragments are referenced, then comparisons + * are made "between" each referenced fragment. + * + * D) When comparing "between" a set of fields and a referenced fragment, first + * a comparison is made between each field in the original set of fields and + * each field in the the referenced set of fields. + * + * E) Also, if any fragment is referenced in the referenced selection set, + * then a comparison is made "between" the original set of fields and the + * referenced fragment (recursively referring to step D). + * + * F) When comparing "between" two fragments, first a comparison is made between + * each field in the first referenced set of fields and each field in the the + * second referenced set of fields. + * + * G) Also, any fragments referenced by the first must be compared to the + * second, and any fragments referenced by the second must be compared to the + * first (recursively referring to step F). + * + * H) When comparing two fields, if both have selection sets, then a comparison + * is made "between" both selection sets, first comparing the set of fields in + * the first selection set with the set of fields in the second. + * + * I) Also, if any fragment is referenced in either selection set, then a + * comparison is made "between" the other set of fields and the + * referenced fragment. + * + * J) Also, if two fragments are referenced in both selection sets, then a + * comparison is made "between" the two fragments. + * + */ +// Find all conflicts found "within" a selection set, including those found +// via spreading in fragments. Called when visiting each SelectionSet in the +// GraphQL Document. +function findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentType, + selectionSet, +) { + const conflicts = []; + const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, + ); // (A) Find find all conflicts "within" the fields of this selection set. + // Note: this is the *only place* `collectConflictsWithin` is called. + + collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, + ); + + if (fragmentNames.length !== 0) { + // (B) Then collect conflicts between these fields and those represented by + // each spread fragment name found. + for (let i = 0; i < fragmentNames.length; i++) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fieldMap, + fragmentNames[i], + ); // (C) Then compare this fragment with all other fragments found in this + // selection set to collect conflicts between fragments spread together. + // This compares each item in the list of fragment names to every other + // item in that same list (except for itself). + + for (let j = i + 1; j < fragmentNames.length; j++) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fragmentNames[i], + fragmentNames[j], + ); + } + } + } + + return conflicts; +} // Collect all conflicts found between a set of fields and a fragment reference +// including via spreading in any nested fragments. + +function collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fragmentName, +) { + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + return; + } + + const [fieldMap2, referencedFragmentNames] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, + ); // Do not compare a fragment's fieldMap to itself. + + if (fieldMap === fieldMap2) { + return; + } // (D) First collect any conflicts between the provided collection of fields + // and the collection of fields represented by the given fragment. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fieldMap2, + ); // (E) Then collect any conflicts between the provided collection of fields + // and any fragment names found in the given fragment. + + for (const referencedFragmentName of referencedFragmentNames) { + // Memoize so two fragments are not compared for conflicts more than once. + if ( + comparedFragmentPairs.has( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ) + ) { + continue; + } + + comparedFragmentPairs.add( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ); + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + referencedFragmentName, + ); + } +} // Collect all conflicts found between two fragments, including via spreading in +// any nested fragments. + +function collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, +) { + // No need to compare a fragment to itself. + if (fragmentName1 === fragmentName2) { + return; + } // Memoize so two fragments are not compared for conflicts more than once. + + if ( + comparedFragmentPairs.has( + fragmentName1, + fragmentName2, + areMutuallyExclusive, + ) + ) { + return; + } + + comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); + const fragment1 = context.getFragment(fragmentName1); + const fragment2 = context.getFragment(fragmentName2); + + if (!fragment1 || !fragment2) { + return; + } + + const [fieldMap1, referencedFragmentNames1] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment1, + ); + const [fieldMap2, referencedFragmentNames2] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment2, + ); // (F) First, collect all conflicts between these two collections of fields + // (not including any nested fragments). + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (G) Then collect conflicts between the first fragment and any nested + // fragments spread in the second fragment. + + for (const referencedFragmentName2 of referencedFragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + referencedFragmentName2, + ); + } // (G) Then collect conflicts between the second fragment and any nested + // fragments spread in the first fragment. + + for (const referencedFragmentName1 of referencedFragmentNames1) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + referencedFragmentName1, + fragmentName2, + ); + } +} // Find all conflicts found between two selection sets, including those found +// via spreading in fragments. Called when determining if conflicts exist +// between the sub-fields of two overlapping fields. + +function findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + parentType1, + selectionSet1, + parentType2, + selectionSet2, +) { + const conflicts = []; + const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType1, + selectionSet1, + ); + const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType2, + selectionSet2, + ); // (H) First, collect all conflicts between these two collections of field. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (I) Then collect conflicts between the first collection of fields and + // those referenced by each fragment name associated with the second. + + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fragmentName2, + ); + } // (I) Then collect conflicts between the second collection of fields and + // those referenced by each fragment name associated with the first. + + for (const fragmentName1 of fragmentNames1) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap2, + fragmentName1, + ); + } // (J) Also collect conflicts between any fragment names by the first and + // fragment names by the second. This compares each item in the first set of + // names to each item in the second set of names. + + for (const fragmentName1 of fragmentNames1) { + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, + ); + } + } + + return conflicts; +} // Collect all Conflicts "within" one collection of fields. + +function collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For every response name, if there are multiple fields, they + // must be compared to find a potential conflict. + for (const [responseName, fields] of Object.entries(fieldMap)) { + // This compares every field in the list to every other field in this list + // (except to itself). If the list only has one item, nothing needs to + // be compared. + if (fields.length > 1) { + for (let i = 0; i < fields.length; i++) { + for (let j = i + 1; j < fields.length; j++) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, // within one collection is never mutually exclusive + responseName, + fields[i], + fields[j], + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Collect all Conflicts between two collections of fields. This is similar to, +// but different from the `collectConflictsWithin` function above. This check +// assumes that `collectConflictsWithin` has already been called on each +// provided collection of fields. This is true because this validator traverses +// each individual selection set. + +function collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + fieldMap1, + fieldMap2, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For any response name which appears in both provided field + // maps, each field from the first field map must be compared to every field + // in the second field map to find potential conflicts. + for (const [responseName, fields1] of Object.entries(fieldMap1)) { + const fields2 = fieldMap2[responseName]; + + if (fields2) { + for (const field1 of fields1) { + for (const field2 of fields2) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Determines if there is a conflict between two particular fields, including +// comparing their sub-fields. + +function findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, +) { + const [parentType1, node1, def1] = field1; + const [parentType2, node2, def2] = field2; // If it is known that two fields could not possibly apply at the same + // time, due to the parent types, then it is safe to permit them to diverge + // in aliased field or arguments used as they will not present any ambiguity + // by differing. + // It is known that two parent types could never overlap if they are + // different Object types. Interface or Union types might overlap - if not + // in the current state of the schema, then perhaps in some future version, + // thus may not safely diverge. + + const areMutuallyExclusive = + parentFieldsAreMutuallyExclusive || + (parentType1 !== parentType2 && + (0, _definition.isObjectType)(parentType1) && + (0, _definition.isObjectType)(parentType2)); + + if (!areMutuallyExclusive) { + // Two aliases must refer to the same field. + const name1 = node1.name.value; + const name2 = node2.name.value; + + if (name1 !== name2) { + return [ + [responseName, `"${name1}" and "${name2}" are different fields`], + [node1], + [node2], + ]; + } // Two field calls must have the same arguments. + + if (!sameArguments(node1, node2)) { + return [ + [responseName, 'they have differing arguments'], + [node1], + [node2], + ]; + } + } // The return type for each field. + + const type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; + const type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; + + if (type1 && type2 && doTypesConflict(type1, type2)) { + return [ + [ + responseName, + `they return conflicting types "${(0, _inspect.inspect)( + type1, + )}" and "${(0, _inspect.inspect)(type2)}"`, + ], + [node1], + [node2], + ]; + } // Collect and compare sub-fields. Use the same "visited fragment names" list + // for both collections so fields in a fragment reference are never + // compared to themselves. + + const selectionSet1 = node1.selectionSet; + const selectionSet2 = node2.selectionSet; + + if (selectionSet1 && selectionSet2) { + const conflicts = findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + (0, _definition.getNamedType)(type1), + selectionSet1, + (0, _definition.getNamedType)(type2), + selectionSet2, + ); + return subfieldConflicts(conflicts, responseName, node1, node2); + } +} + +function sameArguments(node1, node2) { + const args1 = node1.arguments; + const args2 = node2.arguments; + + if (args1 === undefined || args1.length === 0) { + return args2 === undefined || args2.length === 0; + } + + if (args2 === undefined || args2.length === 0) { + return false; + } + /* c8 ignore next */ + + if (args1.length !== args2.length) { + /* c8 ignore next */ + return false; + /* c8 ignore next */ + } + + const values2 = new Map(args2.map(({ name, value }) => [name.value, value])); + return args1.every((arg1) => { + const value1 = arg1.value; + const value2 = values2.get(arg1.name.value); + + if (value2 === undefined) { + return false; + } + + return stringifyValue(value1) === stringifyValue(value2); + }); +} + +function stringifyValue(value) { + return (0, _printer.print)((0, _sortValueNode.sortValueNode)(value)); +} // Two types conflict if both types could not apply to a value simultaneously. +// Composite types are ignored as their individual field types will be compared +// later recursively. However List and Non-Null types must match. + +function doTypesConflict(type1, type2) { + if ((0, _definition.isListType)(type1)) { + return (0, _definition.isListType)(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if ((0, _definition.isListType)(type2)) { + return true; + } + + if ((0, _definition.isNonNullType)(type1)) { + return (0, _definition.isNonNullType)(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if ((0, _definition.isNonNullType)(type2)) { + return true; + } + + if ( + (0, _definition.isLeafType)(type1) || + (0, _definition.isLeafType)(type2) + ) { + return type1 !== type2; + } + + return false; +} // Given a selection set, return the collection of fields (a mapping of response +// name to field nodes and definitions) as well as a list of fragment names +// referenced via fragment spreads. + +function getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, +) { + const cached = cachedFieldsAndFragmentNames.get(selectionSet); + + if (cached) { + return cached; + } + + const nodeAndDefs = Object.create(null); + const fragmentNames = Object.create(null); + + _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, + ); + + const result = [nodeAndDefs, Object.keys(fragmentNames)]; + cachedFieldsAndFragmentNames.set(selectionSet, result); + return result; +} // Given a reference to a fragment, return the represented collection of fields +// as well as a list of nested fragment names referenced via fragment spreads. + +function getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, +) { + // Short-circuit building a type from the node if possible. + const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); + + if (cached) { + return cached; + } + + const fragmentType = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + fragment.typeCondition, + ); + return getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragmentType, + fragment.selectionSet, + ); +} + +function _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case _kinds.Kind.FIELD: { + const fieldName = selection.name.value; + let fieldDef; + + if ( + (0, _definition.isObjectType)(parentType) || + (0, _definition.isInterfaceType)(parentType) + ) { + fieldDef = parentType.getFields()[fieldName]; + } + + const responseName = selection.alias + ? selection.alias.value + : fieldName; + + if (!nodeAndDefs[responseName]) { + nodeAndDefs[responseName] = []; + } + + nodeAndDefs[responseName].push([parentType, selection, fieldDef]); + break; + } + + case _kinds.Kind.FRAGMENT_SPREAD: + fragmentNames[selection.name.value] = true; + break; + + case _kinds.Kind.INLINE_FRAGMENT: { + const typeCondition = selection.typeCondition; + const inlineFragmentType = typeCondition + ? (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition) + : parentType; + + _collectFieldsAndFragmentNames( + context, + inlineFragmentType, + selection.selectionSet, + nodeAndDefs, + fragmentNames, + ); + + break; + } + } + } +} // Given a series of Conflicts which occurred between two sub-fields, generate +// a single Conflict. + +function subfieldConflicts(conflicts, responseName, node1, node2) { + if (conflicts.length > 0) { + return [ + [responseName, conflicts.map(([reason]) => reason)], + [node1, ...conflicts.map(([, fields1]) => fields1).flat()], + [node2, ...conflicts.map(([, , fields2]) => fields2).flat()], + ]; + } +} +/** + * A way to keep track of pairs of things when the ordering of the pair does not matter. + */ + +class PairSet { + constructor() { + this._data = new Map(); + } + + has(a, b, areMutuallyExclusive) { + var _this$_data$get; + + const [key1, key2] = a < b ? [a, b] : [b, a]; + const result = + (_this$_data$get = this._data.get(key1)) === null || + _this$_data$get === void 0 + ? void 0 + : _this$_data$get.get(key2); + + if (result === undefined) { + return false; + } // areMutuallyExclusive being false is a superset of being true, hence if + // we want to know if this PairSet "has" these two with no exclusivity, + // we have to ensure it was added as such. + + return areMutuallyExclusive ? true : areMutuallyExclusive === result; + } + + add(a, b, areMutuallyExclusive) { + const [key1, key2] = a < b ? [a, b] : [b, a]; + + const map = this._data.get(key1); + + if (map === undefined) { + this._data.set(key1, new Map([[key2, areMutuallyExclusive]])); + } else { + map.set(key2, areMutuallyExclusive); + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs new file mode 100644 index 0000000..0360344 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs @@ -0,0 +1,805 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { print } from '../../language/printer.mjs'; +import { + getNamedType, + isInterfaceType, + isLeafType, + isListType, + isNonNullType, + isObjectType, +} from '../../type/definition.mjs'; +import { sortValueNode } from '../../utilities/sortValueNode.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +function reasonMessage(reason) { + if (Array.isArray(reason)) { + return reason + .map( + ([responseName, subReason]) => + `subfields "${responseName}" conflict because ` + + reasonMessage(subReason), + ) + .join(' and '); + } + + return reason; +} +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + */ + +export function OverlappingFieldsCanBeMergedRule(context) { + // A memoization for when two fragments are compared "between" each other for + // conflicts. Two fragments may be compared many times, so memoizing this can + // dramatically improve the performance of this validator. + const comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given + // selection set. Selection sets may be asked for this information multiple + // times, so this improves the performance of this validator. + + const cachedFieldsAndFragmentNames = new Map(); + return { + SelectionSet(selectionSet) { + const conflicts = findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + context.getParentType(), + selectionSet, + ); + + for (const [[responseName, reason], fields1, fields2] of conflicts) { + const reasonMsg = reasonMessage(reason); + context.reportError( + new GraphQLError( + `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, + { + nodes: fields1.concat(fields2), + }, + ), + ); + } + }, + }; +} + +/** + * Algorithm: + * + * Conflicts occur when two fields exist in a query which will produce the same + * response name, but represent differing values, thus creating a conflict. + * The algorithm below finds all conflicts via making a series of comparisons + * between fields. In order to compare as few fields as possible, this makes + * a series of comparisons "within" sets of fields and "between" sets of fields. + * + * Given any selection set, a collection produces both a set of fields by + * also including all inline fragments, as well as a list of fragments + * referenced by fragment spreads. + * + * A) Each selection set represented in the document first compares "within" its + * collected set of fields, finding any conflicts between every pair of + * overlapping fields. + * Note: This is the *only time* that a the fields "within" a set are compared + * to each other. After this only fields "between" sets are compared. + * + * B) Also, if any fragment is referenced in a selection set, then a + * comparison is made "between" the original set of fields and the + * referenced fragment. + * + * C) Also, if multiple fragments are referenced, then comparisons + * are made "between" each referenced fragment. + * + * D) When comparing "between" a set of fields and a referenced fragment, first + * a comparison is made between each field in the original set of fields and + * each field in the the referenced set of fields. + * + * E) Also, if any fragment is referenced in the referenced selection set, + * then a comparison is made "between" the original set of fields and the + * referenced fragment (recursively referring to step D). + * + * F) When comparing "between" two fragments, first a comparison is made between + * each field in the first referenced set of fields and each field in the the + * second referenced set of fields. + * + * G) Also, any fragments referenced by the first must be compared to the + * second, and any fragments referenced by the second must be compared to the + * first (recursively referring to step F). + * + * H) When comparing two fields, if both have selection sets, then a comparison + * is made "between" both selection sets, first comparing the set of fields in + * the first selection set with the set of fields in the second. + * + * I) Also, if any fragment is referenced in either selection set, then a + * comparison is made "between" the other set of fields and the + * referenced fragment. + * + * J) Also, if two fragments are referenced in both selection sets, then a + * comparison is made "between" the two fragments. + * + */ +// Find all conflicts found "within" a selection set, including those found +// via spreading in fragments. Called when visiting each SelectionSet in the +// GraphQL Document. +function findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentType, + selectionSet, +) { + const conflicts = []; + const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, + ); // (A) Find find all conflicts "within" the fields of this selection set. + // Note: this is the *only place* `collectConflictsWithin` is called. + + collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, + ); + + if (fragmentNames.length !== 0) { + // (B) Then collect conflicts between these fields and those represented by + // each spread fragment name found. + for (let i = 0; i < fragmentNames.length; i++) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fieldMap, + fragmentNames[i], + ); // (C) Then compare this fragment with all other fragments found in this + // selection set to collect conflicts between fragments spread together. + // This compares each item in the list of fragment names to every other + // item in that same list (except for itself). + + for (let j = i + 1; j < fragmentNames.length; j++) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fragmentNames[i], + fragmentNames[j], + ); + } + } + } + + return conflicts; +} // Collect all conflicts found between a set of fields and a fragment reference +// including via spreading in any nested fragments. + +function collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fragmentName, +) { + const fragment = context.getFragment(fragmentName); + + if (!fragment) { + return; + } + + const [fieldMap2, referencedFragmentNames] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, + ); // Do not compare a fragment's fieldMap to itself. + + if (fieldMap === fieldMap2) { + return; + } // (D) First collect any conflicts between the provided collection of fields + // and the collection of fields represented by the given fragment. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fieldMap2, + ); // (E) Then collect any conflicts between the provided collection of fields + // and any fragment names found in the given fragment. + + for (const referencedFragmentName of referencedFragmentNames) { + // Memoize so two fragments are not compared for conflicts more than once. + if ( + comparedFragmentPairs.has( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ) + ) { + continue; + } + + comparedFragmentPairs.add( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ); + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + referencedFragmentName, + ); + } +} // Collect all conflicts found between two fragments, including via spreading in +// any nested fragments. + +function collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, +) { + // No need to compare a fragment to itself. + if (fragmentName1 === fragmentName2) { + return; + } // Memoize so two fragments are not compared for conflicts more than once. + + if ( + comparedFragmentPairs.has( + fragmentName1, + fragmentName2, + areMutuallyExclusive, + ) + ) { + return; + } + + comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); + const fragment1 = context.getFragment(fragmentName1); + const fragment2 = context.getFragment(fragmentName2); + + if (!fragment1 || !fragment2) { + return; + } + + const [fieldMap1, referencedFragmentNames1] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment1, + ); + const [fieldMap2, referencedFragmentNames2] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment2, + ); // (F) First, collect all conflicts between these two collections of fields + // (not including any nested fragments). + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (G) Then collect conflicts between the first fragment and any nested + // fragments spread in the second fragment. + + for (const referencedFragmentName2 of referencedFragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + referencedFragmentName2, + ); + } // (G) Then collect conflicts between the second fragment and any nested + // fragments spread in the first fragment. + + for (const referencedFragmentName1 of referencedFragmentNames1) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + referencedFragmentName1, + fragmentName2, + ); + } +} // Find all conflicts found between two selection sets, including those found +// via spreading in fragments. Called when determining if conflicts exist +// between the sub-fields of two overlapping fields. + +function findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + parentType1, + selectionSet1, + parentType2, + selectionSet2, +) { + const conflicts = []; + const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType1, + selectionSet1, + ); + const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType2, + selectionSet2, + ); // (H) First, collect all conflicts between these two collections of field. + + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); // (I) Then collect conflicts between the first collection of fields and + // those referenced by each fragment name associated with the second. + + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fragmentName2, + ); + } // (I) Then collect conflicts between the second collection of fields and + // those referenced by each fragment name associated with the first. + + for (const fragmentName1 of fragmentNames1) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap2, + fragmentName1, + ); + } // (J) Also collect conflicts between any fragment names by the first and + // fragment names by the second. This compares each item in the first set of + // names to each item in the second set of names. + + for (const fragmentName1 of fragmentNames1) { + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, + ); + } + } + + return conflicts; +} // Collect all Conflicts "within" one collection of fields. + +function collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For every response name, if there are multiple fields, they + // must be compared to find a potential conflict. + for (const [responseName, fields] of Object.entries(fieldMap)) { + // This compares every field in the list to every other field in this list + // (except to itself). If the list only has one item, nothing needs to + // be compared. + if (fields.length > 1) { + for (let i = 0; i < fields.length; i++) { + for (let j = i + 1; j < fields.length; j++) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, // within one collection is never mutually exclusive + responseName, + fields[i], + fields[j], + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Collect all Conflicts between two collections of fields. This is similar to, +// but different from the `collectConflictsWithin` function above. This check +// assumes that `collectConflictsWithin` has already been called on each +// provided collection of fields. This is true because this validator traverses +// each individual selection set. + +function collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + fieldMap1, + fieldMap2, +) { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For any response name which appears in both provided field + // maps, each field from the first field map must be compared to every field + // in the second field map to find potential conflicts. + for (const [responseName, fields1] of Object.entries(fieldMap1)) { + const fields2 = fieldMap2[responseName]; + + if (fields2) { + for (const field1 of fields1) { + for (const field2 of fields2) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, + ); + + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} // Determines if there is a conflict between two particular fields, including +// comparing their sub-fields. + +function findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, +) { + const [parentType1, node1, def1] = field1; + const [parentType2, node2, def2] = field2; // If it is known that two fields could not possibly apply at the same + // time, due to the parent types, then it is safe to permit them to diverge + // in aliased field or arguments used as they will not present any ambiguity + // by differing. + // It is known that two parent types could never overlap if they are + // different Object types. Interface or Union types might overlap - if not + // in the current state of the schema, then perhaps in some future version, + // thus may not safely diverge. + + const areMutuallyExclusive = + parentFieldsAreMutuallyExclusive || + (parentType1 !== parentType2 && + isObjectType(parentType1) && + isObjectType(parentType2)); + + if (!areMutuallyExclusive) { + // Two aliases must refer to the same field. + const name1 = node1.name.value; + const name2 = node2.name.value; + + if (name1 !== name2) { + return [ + [responseName, `"${name1}" and "${name2}" are different fields`], + [node1], + [node2], + ]; + } // Two field calls must have the same arguments. + + if (!sameArguments(node1, node2)) { + return [ + [responseName, 'they have differing arguments'], + [node1], + [node2], + ]; + } + } // The return type for each field. + + const type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; + const type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; + + if (type1 && type2 && doTypesConflict(type1, type2)) { + return [ + [ + responseName, + `they return conflicting types "${inspect(type1)}" and "${inspect( + type2, + )}"`, + ], + [node1], + [node2], + ]; + } // Collect and compare sub-fields. Use the same "visited fragment names" list + // for both collections so fields in a fragment reference are never + // compared to themselves. + + const selectionSet1 = node1.selectionSet; + const selectionSet2 = node2.selectionSet; + + if (selectionSet1 && selectionSet2) { + const conflicts = findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + getNamedType(type1), + selectionSet1, + getNamedType(type2), + selectionSet2, + ); + return subfieldConflicts(conflicts, responseName, node1, node2); + } +} + +function sameArguments(node1, node2) { + const args1 = node1.arguments; + const args2 = node2.arguments; + + if (args1 === undefined || args1.length === 0) { + return args2 === undefined || args2.length === 0; + } + + if (args2 === undefined || args2.length === 0) { + return false; + } + /* c8 ignore next */ + + if (args1.length !== args2.length) { + /* c8 ignore next */ + return false; + /* c8 ignore next */ + } + + const values2 = new Map(args2.map(({ name, value }) => [name.value, value])); + return args1.every((arg1) => { + const value1 = arg1.value; + const value2 = values2.get(arg1.name.value); + + if (value2 === undefined) { + return false; + } + + return stringifyValue(value1) === stringifyValue(value2); + }); +} + +function stringifyValue(value) { + return print(sortValueNode(value)); +} // Two types conflict if both types could not apply to a value simultaneously. +// Composite types are ignored as their individual field types will be compared +// later recursively. However List and Non-Null types must match. + +function doTypesConflict(type1, type2) { + if (isListType(type1)) { + return isListType(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if (isListType(type2)) { + return true; + } + + if (isNonNullType(type1)) { + return isNonNullType(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + + if (isNonNullType(type2)) { + return true; + } + + if (isLeafType(type1) || isLeafType(type2)) { + return type1 !== type2; + } + + return false; +} // Given a selection set, return the collection of fields (a mapping of response +// name to field nodes and definitions) as well as a list of fragment names +// referenced via fragment spreads. + +function getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, +) { + const cached = cachedFieldsAndFragmentNames.get(selectionSet); + + if (cached) { + return cached; + } + + const nodeAndDefs = Object.create(null); + const fragmentNames = Object.create(null); + + _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, + ); + + const result = [nodeAndDefs, Object.keys(fragmentNames)]; + cachedFieldsAndFragmentNames.set(selectionSet, result); + return result; +} // Given a reference to a fragment, return the represented collection of fields +// as well as a list of nested fragment names referenced via fragment spreads. + +function getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, +) { + // Short-circuit building a type from the node if possible. + const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); + + if (cached) { + return cached; + } + + const fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); + return getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragmentType, + fragment.selectionSet, + ); +} + +function _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, +) { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case Kind.FIELD: { + const fieldName = selection.name.value; + let fieldDef; + + if (isObjectType(parentType) || isInterfaceType(parentType)) { + fieldDef = parentType.getFields()[fieldName]; + } + + const responseName = selection.alias + ? selection.alias.value + : fieldName; + + if (!nodeAndDefs[responseName]) { + nodeAndDefs[responseName] = []; + } + + nodeAndDefs[responseName].push([parentType, selection, fieldDef]); + break; + } + + case Kind.FRAGMENT_SPREAD: + fragmentNames[selection.name.value] = true; + break; + + case Kind.INLINE_FRAGMENT: { + const typeCondition = selection.typeCondition; + const inlineFragmentType = typeCondition + ? typeFromAST(context.getSchema(), typeCondition) + : parentType; + + _collectFieldsAndFragmentNames( + context, + inlineFragmentType, + selection.selectionSet, + nodeAndDefs, + fragmentNames, + ); + + break; + } + } + } +} // Given a series of Conflicts which occurred between two sub-fields, generate +// a single Conflict. + +function subfieldConflicts(conflicts, responseName, node1, node2) { + if (conflicts.length > 0) { + return [ + [responseName, conflicts.map(([reason]) => reason)], + [node1, ...conflicts.map(([, fields1]) => fields1).flat()], + [node2, ...conflicts.map(([, , fields2]) => fields2).flat()], + ]; + } +} +/** + * A way to keep track of pairs of things when the ordering of the pair does not matter. + */ + +class PairSet { + constructor() { + this._data = new Map(); + } + + has(a, b, areMutuallyExclusive) { + var _this$_data$get; + + const [key1, key2] = a < b ? [a, b] : [b, a]; + const result = + (_this$_data$get = this._data.get(key1)) === null || + _this$_data$get === void 0 + ? void 0 + : _this$_data$get.get(key2); + + if (result === undefined) { + return false; + } // areMutuallyExclusive being false is a superset of being true, hence if + // we want to know if this PairSet "has" these two with no exclusivity, + // we have to ensure it was added as such. + + return areMutuallyExclusive ? true : areMutuallyExclusive === result; + } + + add(a, b, areMutuallyExclusive) { + const [key1, key2] = a < b ? [a, b] : [b, a]; + + const map = this._data.get(key1); + + if (map === undefined) { + this._data.set(key1, new Map([[key2, areMutuallyExclusive]])); + } else { + map.set(key2, areMutuallyExclusive); + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts new file mode 100644 index 0000000..e17ff56 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +export declare function PossibleFragmentSpreadsRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js b/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js new file mode 100644 index 0000000..104e805 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js @@ -0,0 +1,95 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.PossibleFragmentSpreadsRule = PossibleFragmentSpreadsRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +var _typeComparators = require('../../utilities/typeComparators.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +function PossibleFragmentSpreadsRule(context) { + return { + InlineFragment(node) { + const fragType = context.getType(); + const parentType = context.getParentType(); + + if ( + (0, _definition.isCompositeType)(fragType) && + (0, _definition.isCompositeType)(parentType) && + !(0, _typeComparators.doTypesOverlap)( + context.getSchema(), + fragType, + parentType, + ) + ) { + const parentTypeStr = (0, _inspect.inspect)(parentType); + const fragTypeStr = (0, _inspect.inspect)(fragType); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + + FragmentSpread(node) { + const fragName = node.name.value; + const fragType = getFragmentType(context, fragName); + const parentType = context.getParentType(); + + if ( + fragType && + parentType && + !(0, _typeComparators.doTypesOverlap)( + context.getSchema(), + fragType, + parentType, + ) + ) { + const parentTypeStr = (0, _inspect.inspect)(parentType); + const fragTypeStr = (0, _inspect.inspect)(fragType); + context.reportError( + new _GraphQLError.GraphQLError( + `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getFragmentType(context, name) { + const frag = context.getFragment(name); + + if (frag) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + frag.typeCondition, + ); + + if ((0, _definition.isCompositeType)(type)) { + return type; + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs new file mode 100644 index 0000000..f1f8711 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs @@ -0,0 +1,73 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { isCompositeType } from '../../type/definition.mjs'; +import { doTypesOverlap } from '../../utilities/typeComparators.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +export function PossibleFragmentSpreadsRule(context) { + return { + InlineFragment(node) { + const fragType = context.getType(); + const parentType = context.getParentType(); + + if ( + isCompositeType(fragType) && + isCompositeType(parentType) && + !doTypesOverlap(context.getSchema(), fragType, parentType) + ) { + const parentTypeStr = inspect(parentType); + const fragTypeStr = inspect(fragType); + context.reportError( + new GraphQLError( + `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + + FragmentSpread(node) { + const fragName = node.name.value; + const fragType = getFragmentType(context, fragName); + const parentType = context.getParentType(); + + if ( + fragType && + parentType && + !doTypesOverlap(context.getSchema(), fragType, parentType) + ) { + const parentTypeStr = inspect(parentType); + const fragTypeStr = inspect(fragType); + context.reportError( + new GraphQLError( + `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} + +function getFragmentType(context, name) { + const frag = context.getFragment(name); + + if (frag) { + const type = typeFromAST(context.getSchema(), frag.typeCondition); + + if (isCompositeType(type)) { + return type; + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts new file mode 100644 index 0000000..7671b93 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +export declare function PossibleTypeExtensionsRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js b/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js new file mode 100644 index 0000000..d55b4e1 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js @@ -0,0 +1,171 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.PossibleTypeExtensionsRule = PossibleTypeExtensionsRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _inspect = require('../../jsutils/inspect.js'); + +var _invariant = require('../../jsutils/invariant.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _predicates = require('../../language/predicates.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +function PossibleTypeExtensionsRule(context) { + const schema = context.getSchema(); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if ((0, _predicates.isTypeDefinitionNode)(def)) { + definedTypes[def.name.value] = def; + } + } + + return { + ScalarTypeExtension: checkExtension, + ObjectTypeExtension: checkExtension, + InterfaceTypeExtension: checkExtension, + UnionTypeExtension: checkExtension, + EnumTypeExtension: checkExtension, + InputObjectTypeExtension: checkExtension, + }; + + function checkExtension(node) { + const typeName = node.name.value; + const defNode = definedTypes[typeName]; + const existingType = + schema === null || schema === void 0 ? void 0 : schema.getType(typeName); + let expectedKind; + + if (defNode) { + expectedKind = defKindToExtKind[defNode.kind]; + } else if (existingType) { + expectedKind = typeToExtKind(existingType); + } + + if (expectedKind) { + if (expectedKind !== node.kind) { + const kindStr = extensionKindToTypeName(node.kind); + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot extend non-${kindStr} type "${typeName}".`, + { + nodes: defNode ? [defNode, node] : node, + }, + ), + ); + } + } else { + const allTypeNames = Object.keys({ + ...definedTypes, + ...(schema === null || schema === void 0 + ? void 0 + : schema.getTypeMap()), + }); + const suggestedTypes = (0, _suggestionList.suggestionList)( + typeName, + allTypeNames, + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Cannot extend type "${typeName}" because it is not defined.` + + (0, _didYouMean.didYouMean)(suggestedTypes), + { + nodes: node.name, + }, + ), + ); + } + } +} + +const defKindToExtKind = { + [_kinds.Kind.SCALAR_TYPE_DEFINITION]: _kinds.Kind.SCALAR_TYPE_EXTENSION, + [_kinds.Kind.OBJECT_TYPE_DEFINITION]: _kinds.Kind.OBJECT_TYPE_EXTENSION, + [_kinds.Kind.INTERFACE_TYPE_DEFINITION]: _kinds.Kind.INTERFACE_TYPE_EXTENSION, + [_kinds.Kind.UNION_TYPE_DEFINITION]: _kinds.Kind.UNION_TYPE_EXTENSION, + [_kinds.Kind.ENUM_TYPE_DEFINITION]: _kinds.Kind.ENUM_TYPE_EXTENSION, + [_kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION]: + _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, +}; + +function typeToExtKind(type) { + if ((0, _definition.isScalarType)(type)) { + return _kinds.Kind.SCALAR_TYPE_EXTENSION; + } + + if ((0, _definition.isObjectType)(type)) { + return _kinds.Kind.OBJECT_TYPE_EXTENSION; + } + + if ((0, _definition.isInterfaceType)(type)) { + return _kinds.Kind.INTERFACE_TYPE_EXTENSION; + } + + if ((0, _definition.isUnionType)(type)) { + return _kinds.Kind.UNION_TYPE_EXTENSION; + } + + if ((0, _definition.isEnumType)(type)) { + return _kinds.Kind.ENUM_TYPE_EXTENSION; + } + + if ((0, _definition.isInputObjectType)(type)) { + return _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION; + } + /* c8 ignore next 3 */ + // Not reachable. All possible types have been considered + + false || + (0, _invariant.invariant)( + false, + 'Unexpected type: ' + (0, _inspect.inspect)(type), + ); +} + +function extensionKindToTypeName(kind) { + switch (kind) { + case _kinds.Kind.SCALAR_TYPE_EXTENSION: + return 'scalar'; + + case _kinds.Kind.OBJECT_TYPE_EXTENSION: + return 'object'; + + case _kinds.Kind.INTERFACE_TYPE_EXTENSION: + return 'interface'; + + case _kinds.Kind.UNION_TYPE_EXTENSION: + return 'union'; + + case _kinds.Kind.ENUM_TYPE_EXTENSION: + return 'enum'; + + case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: + return 'input object'; + // Not reachable. All possible types have been considered + + /* c8 ignore next */ + + default: + false || + (0, _invariant.invariant)( + false, + 'Unexpected kind: ' + (0, _inspect.inspect)(kind), + ); + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs new file mode 100644 index 0000000..a0a05fa --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs @@ -0,0 +1,148 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { inspect } from '../../jsutils/inspect.mjs'; +import { invariant } from '../../jsutils/invariant.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { isTypeDefinitionNode } from '../../language/predicates.mjs'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isObjectType, + isScalarType, + isUnionType, +} from '../../type/definition.mjs'; + +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +export function PossibleTypeExtensionsRule(context) { + const schema = context.getSchema(); + const definedTypes = Object.create(null); + + for (const def of context.getDocument().definitions) { + if (isTypeDefinitionNode(def)) { + definedTypes[def.name.value] = def; + } + } + + return { + ScalarTypeExtension: checkExtension, + ObjectTypeExtension: checkExtension, + InterfaceTypeExtension: checkExtension, + UnionTypeExtension: checkExtension, + EnumTypeExtension: checkExtension, + InputObjectTypeExtension: checkExtension, + }; + + function checkExtension(node) { + const typeName = node.name.value; + const defNode = definedTypes[typeName]; + const existingType = + schema === null || schema === void 0 ? void 0 : schema.getType(typeName); + let expectedKind; + + if (defNode) { + expectedKind = defKindToExtKind[defNode.kind]; + } else if (existingType) { + expectedKind = typeToExtKind(existingType); + } + + if (expectedKind) { + if (expectedKind !== node.kind) { + const kindStr = extensionKindToTypeName(node.kind); + context.reportError( + new GraphQLError(`Cannot extend non-${kindStr} type "${typeName}".`, { + nodes: defNode ? [defNode, node] : node, + }), + ); + } + } else { + const allTypeNames = Object.keys({ + ...definedTypes, + ...(schema === null || schema === void 0 + ? void 0 + : schema.getTypeMap()), + }); + const suggestedTypes = suggestionList(typeName, allTypeNames); + context.reportError( + new GraphQLError( + `Cannot extend type "${typeName}" because it is not defined.` + + didYouMean(suggestedTypes), + { + nodes: node.name, + }, + ), + ); + } + } +} +const defKindToExtKind = { + [Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION, + [Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION, + [Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION, + [Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION, + [Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION, + [Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION, +}; + +function typeToExtKind(type) { + if (isScalarType(type)) { + return Kind.SCALAR_TYPE_EXTENSION; + } + + if (isObjectType(type)) { + return Kind.OBJECT_TYPE_EXTENSION; + } + + if (isInterfaceType(type)) { + return Kind.INTERFACE_TYPE_EXTENSION; + } + + if (isUnionType(type)) { + return Kind.UNION_TYPE_EXTENSION; + } + + if (isEnumType(type)) { + return Kind.ENUM_TYPE_EXTENSION; + } + + if (isInputObjectType(type)) { + return Kind.INPUT_OBJECT_TYPE_EXTENSION; + } + /* c8 ignore next 3 */ + // Not reachable. All possible types have been considered + + false || invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function extensionKindToTypeName(kind) { + switch (kind) { + case Kind.SCALAR_TYPE_EXTENSION: + return 'scalar'; + + case Kind.OBJECT_TYPE_EXTENSION: + return 'object'; + + case Kind.INTERFACE_TYPE_EXTENSION: + return 'interface'; + + case Kind.UNION_TYPE_EXTENSION: + return 'union'; + + case Kind.ENUM_TYPE_EXTENSION: + return 'enum'; + + case Kind.INPUT_OBJECT_TYPE_EXTENSION: + return 'input object'; + // Not reachable. All possible types have been considered + + /* c8 ignore next */ + + default: + false || invariant(false, 'Unexpected kind: ' + inspect(kind)); + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts new file mode 100644 index 0000000..4fbd183 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts @@ -0,0 +1,20 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +export declare function ProvidedRequiredArgumentsRule( + context: ValidationContext, +): ASTVisitor; +/** + * @internal + */ +export declare function ProvidedRequiredArgumentsOnDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js b/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js new file mode 100644 index 0000000..c819df0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js @@ -0,0 +1,162 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ProvidedRequiredArgumentsOnDirectivesRule = + ProvidedRequiredArgumentsOnDirectivesRule; +exports.ProvidedRequiredArgumentsRule = ProvidedRequiredArgumentsRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _keyMap = require('../../jsutils/keyMap.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +function ProvidedRequiredArgumentsRule(context) { + return { + // eslint-disable-next-line new-cap + ...ProvidedRequiredArgumentsOnDirectivesRule(context), + Field: { + // Validate on leave to allow for deeper errors to appear first. + leave(fieldNode) { + var _fieldNode$arguments; + + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + return false; + } + + const providedArgs = new Set( // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + (_fieldNode$arguments = fieldNode.arguments) === null || + _fieldNode$arguments === void 0 + ? void 0 + : _fieldNode$arguments.map((arg) => arg.name.value), + ); + + for (const argDef of fieldDef.args) { + if ( + !providedArgs.has(argDef.name) && + (0, _definition.isRequiredArgument)(argDef) + ) { + const argTypeStr = (0, _inspect.inspect)(argDef.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, + { + nodes: fieldNode, + }, + ), + ); + } + } + }, + }, + }; +} +/** + * @internal + */ + +function ProvidedRequiredArgumentsOnDirectivesRule(context) { + var _schema$getDirectives; + + const requiredArgsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = + (_schema$getDirectives = + schema === null || schema === void 0 + ? void 0 + : schema.getDirectives()) !== null && _schema$getDirectives !== void 0 + ? _schema$getDirectives + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + requiredArgsMap[directive.name] = (0, _keyMap.keyMap)( + directive.args.filter(_definition.isRequiredArgument), + (arg) => arg.name, + ); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + requiredArgsMap[def.name.value] = (0, _keyMap.keyMap)( + argNodes.filter(isRequiredArgumentNode), + (arg) => arg.name.value, + ); + } + } + + return { + Directive: { + // Validate on leave to allow for deeper errors to appear first. + leave(directiveNode) { + const directiveName = directiveNode.name.value; + const requiredArgs = requiredArgsMap[directiveName]; + + if (requiredArgs) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + const argNodeMap = new Set(argNodes.map((arg) => arg.name.value)); + + for (const [argName, argDef] of Object.entries(requiredArgs)) { + if (!argNodeMap.has(argName)) { + const argType = (0, _definition.isType)(argDef.type) + ? (0, _inspect.inspect)(argDef.type) + : (0, _printer.print)(argDef.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${directiveName}" argument "${argName}" of type "${argType}" is required, but it was not provided.`, + { + nodes: directiveNode, + }, + ), + ); + } + } + } + }, + }, + }; +} + +function isRequiredArgumentNode(arg) { + return ( + arg.type.kind === _kinds.Kind.NON_NULL_TYPE && arg.defaultValue == null + ); +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs new file mode 100644 index 0000000..c96da13 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs @@ -0,0 +1,142 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { keyMap } from '../../jsutils/keyMap.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { print } from '../../language/printer.mjs'; +import { isRequiredArgument, isType } from '../../type/definition.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +export function ProvidedRequiredArgumentsRule(context) { + return { + // eslint-disable-next-line new-cap + ...ProvidedRequiredArgumentsOnDirectivesRule(context), + Field: { + // Validate on leave to allow for deeper errors to appear first. + leave(fieldNode) { + var _fieldNode$arguments; + + const fieldDef = context.getFieldDef(); + + if (!fieldDef) { + return false; + } + + const providedArgs = new Set( // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + (_fieldNode$arguments = fieldNode.arguments) === null || + _fieldNode$arguments === void 0 + ? void 0 + : _fieldNode$arguments.map((arg) => arg.name.value), + ); + + for (const argDef of fieldDef.args) { + if (!providedArgs.has(argDef.name) && isRequiredArgument(argDef)) { + const argTypeStr = inspect(argDef.type); + context.reportError( + new GraphQLError( + `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, + { + nodes: fieldNode, + }, + ), + ); + } + } + }, + }, + }; +} +/** + * @internal + */ + +export function ProvidedRequiredArgumentsOnDirectivesRule(context) { + var _schema$getDirectives; + + const requiredArgsMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = + (_schema$getDirectives = + schema === null || schema === void 0 + ? void 0 + : schema.getDirectives()) !== null && _schema$getDirectives !== void 0 + ? _schema$getDirectives + : specifiedDirectives; + + for (const directive of definedDirectives) { + requiredArgsMap[directive.name] = keyMap( + directive.args.filter(isRequiredArgument), + (arg) => arg.name, + ); + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + var _def$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 + ? _def$arguments + : []; + requiredArgsMap[def.name.value] = keyMap( + argNodes.filter(isRequiredArgumentNode), + (arg) => arg.name.value, + ); + } + } + + return { + Directive: { + // Validate on leave to allow for deeper errors to appear first. + leave(directiveNode) { + const directiveName = directiveNode.name.value; + const requiredArgs = requiredArgsMap[directiveName]; + + if (requiredArgs) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + const argNodeMap = new Set(argNodes.map((arg) => arg.name.value)); + + for (const [argName, argDef] of Object.entries(requiredArgs)) { + if (!argNodeMap.has(argName)) { + const argType = isType(argDef.type) + ? inspect(argDef.type) + : print(argDef.type); + context.reportError( + new GraphQLError( + `Directive "@${directiveName}" argument "${argName}" of type "${argType}" is required, but it was not provided.`, + { + nodes: directiveNode, + }, + ), + ); + } + } + } + }, + }, + }; +} + +function isRequiredArgumentNode(arg) { + return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts new file mode 100644 index 0000000..98a3bae --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts @@ -0,0 +1,9 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +export declare function ScalarLeafsRule(context: ValidationContext): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.js b/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.js new file mode 100644 index 0000000..ed6307c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.js @@ -0,0 +1,55 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ScalarLeafsRule = ScalarLeafsRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +function ScalarLeafsRule(context) { + return { + Field(node) { + const type = context.getType(); + const selectionSet = node.selectionSet; + + if (type) { + if ((0, _definition.isLeafType)((0, _definition.getNamedType)(type))) { + if (selectionSet) { + const fieldName = node.name.value; + const typeStr = (0, _inspect.inspect)(type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, + { + nodes: selectionSet, + }, + ), + ); + } + } else if (!selectionSet) { + const fieldName = node.name.value; + const typeStr = (0, _inspect.inspect)(type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs new file mode 100644 index 0000000..4a2f06d --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs @@ -0,0 +1,46 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { getNamedType, isLeafType } from '../../type/definition.mjs'; + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +export function ScalarLeafsRule(context) { + return { + Field(node) { + const type = context.getType(); + const selectionSet = node.selectionSet; + + if (type) { + if (isLeafType(getNamedType(type))) { + if (selectionSet) { + const fieldName = node.name.value; + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, + { + nodes: selectionSet, + }, + ), + ); + } + } else if (!selectionSet) { + const fieldName = node.name.value; + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, + { + nodes: node, + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts new file mode 100644 index 0000000..b57a7ce --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + */ +export declare function SingleFieldSubscriptionsRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js b/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js new file mode 100644 index 0000000..1c5cbf6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js @@ -0,0 +1,86 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.SingleFieldSubscriptionsRule = SingleFieldSubscriptionsRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _collectFields = require('../../execution/collectFields.js'); + +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + */ +function SingleFieldSubscriptionsRule(context) { + return { + OperationDefinition(node) { + if (node.operation === 'subscription') { + const schema = context.getSchema(); + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + const operationName = node.name ? node.name.value : null; + const variableValues = Object.create(null); + const document = context.getDocument(); + const fragments = Object.create(null); + + for (const definition of document.definitions) { + if (definition.kind === _kinds.Kind.FRAGMENT_DEFINITION) { + fragments[definition.name.value] = definition; + } + } + + const fields = (0, _collectFields.collectFields)( + schema, + fragments, + variableValues, + subscriptionType, + node.selectionSet, + ); + + if (fields.size > 1) { + const fieldSelectionLists = [...fields.values()]; + const extraFieldSelectionLists = fieldSelectionLists.slice(1); + const extraFieldSelections = extraFieldSelectionLists.flat(); + context.reportError( + new _GraphQLError.GraphQLError( + operationName != null + ? `Subscription "${operationName}" must select only one top level field.` + : 'Anonymous Subscription must select only one top level field.', + { + nodes: extraFieldSelections, + }, + ), + ); + } + + for (const fieldNodes of fields.values()) { + const field = fieldNodes[0]; + const fieldName = field.name.value; + + if (fieldName.startsWith('__')) { + context.reportError( + new _GraphQLError.GraphQLError( + operationName != null + ? `Subscription "${operationName}" must not select an introspection top level field.` + : 'Anonymous Subscription must not select an introspection top level field.', + { + nodes: fieldNodes, + }, + ), + ); + } + } + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs new file mode 100644 index 0000000..869f54d --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs @@ -0,0 +1,77 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { collectFields } from '../../execution/collectFields.mjs'; + +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + */ +export function SingleFieldSubscriptionsRule(context) { + return { + OperationDefinition(node) { + if (node.operation === 'subscription') { + const schema = context.getSchema(); + const subscriptionType = schema.getSubscriptionType(); + + if (subscriptionType) { + const operationName = node.name ? node.name.value : null; + const variableValues = Object.create(null); + const document = context.getDocument(); + const fragments = Object.create(null); + + for (const definition of document.definitions) { + if (definition.kind === Kind.FRAGMENT_DEFINITION) { + fragments[definition.name.value] = definition; + } + } + + const fields = collectFields( + schema, + fragments, + variableValues, + subscriptionType, + node.selectionSet, + ); + + if (fields.size > 1) { + const fieldSelectionLists = [...fields.values()]; + const extraFieldSelectionLists = fieldSelectionLists.slice(1); + const extraFieldSelections = extraFieldSelectionLists.flat(); + context.reportError( + new GraphQLError( + operationName != null + ? `Subscription "${operationName}" must select only one top level field.` + : 'Anonymous Subscription must select only one top level field.', + { + nodes: extraFieldSelections, + }, + ), + ); + } + + for (const fieldNodes of fields.values()) { + const field = fieldNodes[0]; + const fieldName = field.name.value; + + if (fieldName.startsWith('__')) { + context.reportError( + new GraphQLError( + operationName != null + ? `Subscription "${operationName}" must not select an introspection top level field.` + : 'Anonymous Subscription must not select an introspection top level field.', + { + nodes: fieldNodes, + }, + ), + ); + } + } + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts new file mode 100644 index 0000000..f96b754 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts @@ -0,0 +1,11 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + */ +export declare function UniqueArgumentDefinitionNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js new file mode 100644 index 0000000..fe997d4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js @@ -0,0 +1,92 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueArgumentDefinitionNamesRule = UniqueArgumentDefinitionNamesRule; + +var _groupBy = require('../../jsutils/groupBy.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + */ +function UniqueArgumentDefinitionNamesRule(context) { + return { + DirectiveDefinition(directiveNode) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes); + }, + + InterfaceTypeDefinition: checkArgUniquenessPerField, + InterfaceTypeExtension: checkArgUniquenessPerField, + ObjectTypeDefinition: checkArgUniquenessPerField, + ObjectTypeExtension: checkArgUniquenessPerField, + }; + + function checkArgUniquenessPerField(typeNode) { + var _typeNode$fields; + + const typeName = typeNode.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_typeNode$fields = typeNode.fields) !== null && + _typeNode$fields !== void 0 + ? _typeNode$fields + : []; + + for (const fieldDef of fieldNodes) { + var _fieldDef$arguments; + + const fieldName = fieldDef.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_fieldDef$arguments = fieldDef.arguments) !== null && + _fieldDef$arguments !== void 0 + ? _fieldDef$arguments + : []; + checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes); + } + + return false; + } + + function checkArgUniqueness(parentName, argumentNodes) { + const seenArgs = (0, _groupBy.groupBy)( + argumentNodes, + (arg) => arg.name.value, + ); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + `Argument "${parentName}(${argName}:)" can only be defined once.`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs new file mode 100644 index 0000000..416a954 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs @@ -0,0 +1,81 @@ +import { groupBy } from '../../jsutils/groupBy.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + */ +export function UniqueArgumentDefinitionNamesRule(context) { + return { + DirectiveDefinition(directiveNode) { + var _directiveNode$argume; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_directiveNode$argume = directiveNode.arguments) !== null && + _directiveNode$argume !== void 0 + ? _directiveNode$argume + : []; + return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes); + }, + + InterfaceTypeDefinition: checkArgUniquenessPerField, + InterfaceTypeExtension: checkArgUniquenessPerField, + ObjectTypeDefinition: checkArgUniquenessPerField, + ObjectTypeExtension: checkArgUniquenessPerField, + }; + + function checkArgUniquenessPerField(typeNode) { + var _typeNode$fields; + + const typeName = typeNode.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_typeNode$fields = typeNode.fields) !== null && + _typeNode$fields !== void 0 + ? _typeNode$fields + : []; + + for (const fieldDef of fieldNodes) { + var _fieldDef$arguments; + + const fieldName = fieldDef.name.value; // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const argumentNodes = + (_fieldDef$arguments = fieldDef.arguments) !== null && + _fieldDef$arguments !== void 0 + ? _fieldDef$arguments + : []; + checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes); + } + + return false; + } + + function checkArgUniqueness(parentName, argumentNodes) { + const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new GraphQLError( + `Argument "${parentName}(${argName}:)" can only be defined once.`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts new file mode 100644 index 0000000..ac13f8a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + */ +export declare function UniqueArgumentNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js new file mode 100644 index 0000000..9766737 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js @@ -0,0 +1,55 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueArgumentNamesRule = UniqueArgumentNamesRule; + +var _groupBy = require('../../jsutils/groupBy.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + */ +function UniqueArgumentNamesRule(context) { + return { + Field: checkArgUniqueness, + Directive: checkArgUniqueness, + }; + + function checkArgUniqueness(parentNode) { + var _parentNode$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_parentNode$arguments = parentNode.arguments) !== null && + _parentNode$arguments !== void 0 + ? _parentNode$arguments + : []; + const seenArgs = (0, _groupBy.groupBy)( + argumentNodes, + (arg) => arg.name.value, + ); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one argument named "${argName}".`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs new file mode 100644 index 0000000..9f78a66 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs @@ -0,0 +1,44 @@ +import { groupBy } from '../../jsutils/groupBy.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + */ +export function UniqueArgumentNamesRule(context) { + return { + Field: checkArgUniqueness, + Directive: checkArgUniqueness, + }; + + function checkArgUniqueness(parentNode) { + var _parentNode$arguments; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const argumentNodes = + (_parentNode$arguments = parentNode.arguments) !== null && + _parentNode$arguments !== void 0 + ? _parentNode$arguments + : []; + const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new GraphQLError( + `There can be only one argument named "${argName}".`, + { + nodes: argNodes.map((node) => node.name), + }, + ), + ); + } + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts new file mode 100644 index 0000000..1aa35db --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +export declare function UniqueDirectiveNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js new file mode 100644 index 0000000..b02635e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueDirectiveNamesRule = UniqueDirectiveNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +function UniqueDirectiveNamesRule(context) { + const knownDirectiveNames = Object.create(null); + const schema = context.getSchema(); + return { + DirectiveDefinition(node) { + const directiveName = node.name.value; + + if ( + schema !== null && + schema !== void 0 && + schema.getDirective(directiveName) + ) { + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownDirectiveNames[directiveName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one directive named "@${directiveName}".`, + { + nodes: [knownDirectiveNames[directiveName], node.name], + }, + ), + ); + } else { + knownDirectiveNames[directiveName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs new file mode 100644 index 0000000..fe70dc9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs @@ -0,0 +1,47 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +export function UniqueDirectiveNamesRule(context) { + const knownDirectiveNames = Object.create(null); + const schema = context.getSchema(); + return { + DirectiveDefinition(node) { + const directiveName = node.name.value; + + if ( + schema !== null && + schema !== void 0 && + schema.getDirective(directiveName) + ) { + context.reportError( + new GraphQLError( + `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownDirectiveNames[directiveName]) { + context.reportError( + new GraphQLError( + `There can be only one directive named "@${directiveName}".`, + { + nodes: [knownDirectiveNames[directiveName], node.name], + }, + ), + ); + } else { + knownDirectiveNames[directiveName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts new file mode 100644 index 0000000..b6e16a8 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts @@ -0,0 +1,16 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + */ +export declare function UniqueDirectivesPerLocationRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js new file mode 100644 index 0000000..272f761 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js @@ -0,0 +1,95 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueDirectivesPerLocationRule = UniqueDirectivesPerLocationRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _predicates = require('../../language/predicates.js'); + +var _directives = require('../../type/directives.js'); + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + */ +function UniqueDirectivesPerLocationRule(context) { + const uniqueDirectiveMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : _directives.specifiedDirectives; + + for (const directive of definedDirectives) { + uniqueDirectiveMap[directive.name] = !directive.isRepeatable; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { + uniqueDirectiveMap[def.name.value] = !def.repeatable; + } + } + + const schemaDirectives = Object.create(null); + const typeDirectivesMap = Object.create(null); + return { + // Many different AST nodes may contain directives. Rather than listing + // them all, just listen for entering any node, and check to see if it + // defines any directives. + enter(node) { + if (!('directives' in node) || !node.directives) { + return; + } + + let seenDirectives; + + if ( + node.kind === _kinds.Kind.SCHEMA_DEFINITION || + node.kind === _kinds.Kind.SCHEMA_EXTENSION + ) { + seenDirectives = schemaDirectives; + } else if ( + (0, _predicates.isTypeDefinitionNode)(node) || + (0, _predicates.isTypeExtensionNode)(node) + ) { + const typeName = node.name.value; + seenDirectives = typeDirectivesMap[typeName]; + + if (seenDirectives === undefined) { + typeDirectivesMap[typeName] = seenDirectives = Object.create(null); + } + } else { + seenDirectives = Object.create(null); + } + + for (const directive of node.directives) { + const directiveName = directive.name.value; + + if (uniqueDirectiveMap[directiveName]) { + if (seenDirectives[directiveName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `The directive "@${directiveName}" can only be used once at this location.`, + { + nodes: [seenDirectives[directiveName], directive], + }, + ), + ); + } else { + seenDirectives[directiveName] = directive; + } + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs new file mode 100644 index 0000000..efd6abe --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs @@ -0,0 +1,85 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { + isTypeDefinitionNode, + isTypeExtensionNode, +} from '../../language/predicates.mjs'; +import { specifiedDirectives } from '../../type/directives.mjs'; + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + */ +export function UniqueDirectivesPerLocationRule(context) { + const uniqueDirectiveMap = Object.create(null); + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + + for (const directive of definedDirectives) { + uniqueDirectiveMap[directive.name] = !directive.isRepeatable; + } + + const astDefinitions = context.getDocument().definitions; + + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + uniqueDirectiveMap[def.name.value] = !def.repeatable; + } + } + + const schemaDirectives = Object.create(null); + const typeDirectivesMap = Object.create(null); + return { + // Many different AST nodes may contain directives. Rather than listing + // them all, just listen for entering any node, and check to see if it + // defines any directives. + enter(node) { + if (!('directives' in node) || !node.directives) { + return; + } + + let seenDirectives; + + if ( + node.kind === Kind.SCHEMA_DEFINITION || + node.kind === Kind.SCHEMA_EXTENSION + ) { + seenDirectives = schemaDirectives; + } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { + const typeName = node.name.value; + seenDirectives = typeDirectivesMap[typeName]; + + if (seenDirectives === undefined) { + typeDirectivesMap[typeName] = seenDirectives = Object.create(null); + } + } else { + seenDirectives = Object.create(null); + } + + for (const directive of node.directives) { + const directiveName = directive.name.value; + + if (uniqueDirectiveMap[directiveName]) { + if (seenDirectives[directiveName]) { + context.reportError( + new GraphQLError( + `The directive "@${directiveName}" can only be used once at this location.`, + { + nodes: [seenDirectives[directiveName], directive], + }, + ), + ); + } else { + seenDirectives[directiveName] = directive; + } + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts new file mode 100644 index 0000000..c15414c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +export declare function UniqueEnumValueNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js new file mode 100644 index 0000000..6dba608 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js @@ -0,0 +1,75 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueEnumValueNamesRule = UniqueEnumValueNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +function UniqueEnumValueNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownValueNames = Object.create(null); + return { + EnumTypeDefinition: checkValueUniqueness, + EnumTypeExtension: checkValueUniqueness, + }; + + function checkValueUniqueness(node) { + var _node$values; + + const typeName = node.name.value; + + if (!knownValueNames[typeName]) { + knownValueNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const valueNodes = + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + const valueNames = knownValueNames[typeName]; + + for (const valueDef of valueNodes) { + const valueName = valueDef.name.value; + const existingType = existingTypeMap[typeName]; + + if ( + (0, _definition.isEnumType)(existingType) && + existingType.getValue(valueName) + ) { + context.reportError( + new _GraphQLError.GraphQLError( + `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: valueDef.name, + }, + ), + ); + } else if (valueNames[valueName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `Enum value "${typeName}.${valueName}" can only be defined once.`, + { + nodes: [valueNames[valueName], valueDef.name], + }, + ), + ); + } else { + valueNames[valueName] = valueDef.name; + } + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs new file mode 100644 index 0000000..8e66111 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs @@ -0,0 +1,64 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { isEnumType } from '../../type/definition.mjs'; + +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +export function UniqueEnumValueNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownValueNames = Object.create(null); + return { + EnumTypeDefinition: checkValueUniqueness, + EnumTypeExtension: checkValueUniqueness, + }; + + function checkValueUniqueness(node) { + var _node$values; + + const typeName = node.name.value; + + if (!knownValueNames[typeName]) { + knownValueNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const valueNodes = + (_node$values = node.values) !== null && _node$values !== void 0 + ? _node$values + : []; + const valueNames = knownValueNames[typeName]; + + for (const valueDef of valueNodes) { + const valueName = valueDef.name.value; + const existingType = existingTypeMap[typeName]; + + if (isEnumType(existingType) && existingType.getValue(valueName)) { + context.reportError( + new GraphQLError( + `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: valueDef.name, + }, + ), + ); + } else if (valueNames[valueName]) { + context.reportError( + new GraphQLError( + `Enum value "${typeName}.${valueName}" can only be defined once.`, + { + nodes: [valueNames[valueName], valueDef.name], + }, + ), + ); + } else { + valueNames[valueName] = valueDef.name; + } + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts new file mode 100644 index 0000000..f98be94 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +export declare function UniqueFieldDefinitionNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js new file mode 100644 index 0000000..f0d9fcb --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js @@ -0,0 +1,87 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueFieldDefinitionNamesRule = UniqueFieldDefinitionNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +function UniqueFieldDefinitionNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownFieldNames = Object.create(null); + return { + InputObjectTypeDefinition: checkFieldUniqueness, + InputObjectTypeExtension: checkFieldUniqueness, + InterfaceTypeDefinition: checkFieldUniqueness, + InterfaceTypeExtension: checkFieldUniqueness, + ObjectTypeDefinition: checkFieldUniqueness, + ObjectTypeExtension: checkFieldUniqueness, + }; + + function checkFieldUniqueness(node) { + var _node$fields; + + const typeName = node.name.value; + + if (!knownFieldNames[typeName]) { + knownFieldNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + const fieldNames = knownFieldNames[typeName]; + + for (const fieldDef of fieldNodes) { + const fieldName = fieldDef.name.value; + + if (hasField(existingTypeMap[typeName], fieldName)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: fieldDef.name, + }, + ), + ); + } else if (fieldNames[fieldName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${typeName}.${fieldName}" can only be defined once.`, + { + nodes: [fieldNames[fieldName], fieldDef.name], + }, + ), + ); + } else { + fieldNames[fieldName] = fieldDef.name; + } + } + + return false; + } +} + +function hasField(type, fieldName) { + if ( + (0, _definition.isObjectType)(type) || + (0, _definition.isInterfaceType)(type) || + (0, _definition.isInputObjectType)(type) + ) { + return type.getFields()[fieldName] != null; + } + + return false; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs new file mode 100644 index 0000000..34a7a4a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs @@ -0,0 +1,79 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { + isInputObjectType, + isInterfaceType, + isObjectType, +} from '../../type/definition.mjs'; + +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +export function UniqueFieldDefinitionNamesRule(context) { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownFieldNames = Object.create(null); + return { + InputObjectTypeDefinition: checkFieldUniqueness, + InputObjectTypeExtension: checkFieldUniqueness, + InterfaceTypeDefinition: checkFieldUniqueness, + InterfaceTypeExtension: checkFieldUniqueness, + ObjectTypeDefinition: checkFieldUniqueness, + ObjectTypeExtension: checkFieldUniqueness, + }; + + function checkFieldUniqueness(node) { + var _node$fields; + + const typeName = node.name.value; + + if (!knownFieldNames[typeName]) { + knownFieldNames[typeName] = Object.create(null); + } // FIXME: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + + const fieldNodes = + (_node$fields = node.fields) !== null && _node$fields !== void 0 + ? _node$fields + : []; + const fieldNames = knownFieldNames[typeName]; + + for (const fieldDef of fieldNodes) { + const fieldName = fieldDef.name.value; + + if (hasField(existingTypeMap[typeName], fieldName)) { + context.reportError( + new GraphQLError( + `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, + { + nodes: fieldDef.name, + }, + ), + ); + } else if (fieldNames[fieldName]) { + context.reportError( + new GraphQLError( + `Field "${typeName}.${fieldName}" can only be defined once.`, + { + nodes: [fieldNames[fieldName], fieldDef.name], + }, + ), + ); + } else { + fieldNames[fieldName] = fieldDef.name; + } + } + + return false; + } +} + +function hasField(type, fieldName) { + if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { + return type.getFields()[fieldName] != null; + } + + return false; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts new file mode 100644 index 0000000..77a6437 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + */ +export declare function UniqueFragmentNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js new file mode 100644 index 0000000..3f1533c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueFragmentNamesRule = UniqueFragmentNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + */ +function UniqueFragmentNamesRule(context) { + const knownFragmentNames = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + const fragmentName = node.name.value; + + if (knownFragmentNames[fragmentName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one fragment named "${fragmentName}".`, + { + nodes: [knownFragmentNames[fragmentName], node.name], + }, + ), + ); + } else { + knownFragmentNames[fragmentName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs new file mode 100644 index 0000000..354fff5 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs @@ -0,0 +1,34 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + */ +export function UniqueFragmentNamesRule(context) { + const knownFragmentNames = Object.create(null); + return { + OperationDefinition: () => false, + + FragmentDefinition(node) { + const fragmentName = node.name.value; + + if (knownFragmentNames[fragmentName]) { + context.reportError( + new GraphQLError( + `There can be only one fragment named "${fragmentName}".`, + { + nodes: [knownFragmentNames[fragmentName], node.name], + }, + ), + ); + } else { + knownFragmentNames[fragmentName] = node.name; + } + + return false; + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts new file mode 100644 index 0000000..6133fe9 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + */ +export declare function UniqueInputFieldNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js new file mode 100644 index 0000000..3d32a40 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueInputFieldNamesRule = UniqueInputFieldNamesRule; + +var _invariant = require('../../jsutils/invariant.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + */ +function UniqueInputFieldNamesRule(context) { + const knownNameStack = []; + let knownNames = Object.create(null); + return { + ObjectValue: { + enter() { + knownNameStack.push(knownNames); + knownNames = Object.create(null); + }, + + leave() { + const prevKnownNames = knownNameStack.pop(); + prevKnownNames || (0, _invariant.invariant)(false); + knownNames = prevKnownNames; + }, + }, + + ObjectField(node) { + const fieldName = node.name.value; + + if (knownNames[fieldName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one input field named "${fieldName}".`, + { + nodes: [knownNames[fieldName], node.name], + }, + ), + ); + } else { + knownNames[fieldName] = node.name; + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs new file mode 100644 index 0000000..3b21c3c --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs @@ -0,0 +1,46 @@ +import { invariant } from '../../jsutils/invariant.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + */ +export function UniqueInputFieldNamesRule(context) { + const knownNameStack = []; + let knownNames = Object.create(null); + return { + ObjectValue: { + enter() { + knownNameStack.push(knownNames); + knownNames = Object.create(null); + }, + + leave() { + const prevKnownNames = knownNameStack.pop(); + prevKnownNames || invariant(false); + knownNames = prevKnownNames; + }, + }, + + ObjectField(node) { + const fieldName = node.name.value; + + if (knownNames[fieldName]) { + context.reportError( + new GraphQLError( + `There can be only one input field named "${fieldName}".`, + { + nodes: [knownNames[fieldName], node.name], + }, + ), + ); + } else { + knownNames[fieldName] = node.name; + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts new file mode 100644 index 0000000..a3bf0ca --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + */ +export declare function UniqueOperationNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js new file mode 100644 index 0000000..d024c16 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueOperationNamesRule = UniqueOperationNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + */ +function UniqueOperationNamesRule(context) { + const knownOperationNames = Object.create(null); + return { + OperationDefinition(node) { + const operationName = node.name; + + if (operationName) { + if (knownOperationNames[operationName.value]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one operation named "${operationName.value}".`, + { + nodes: [ + knownOperationNames[operationName.value], + operationName, + ], + }, + ), + ); + } else { + knownOperationNames[operationName.value] = operationName; + } + } + + return false; + }, + + FragmentDefinition: () => false, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs new file mode 100644 index 0000000..c79a88f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs @@ -0,0 +1,39 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + */ +export function UniqueOperationNamesRule(context) { + const knownOperationNames = Object.create(null); + return { + OperationDefinition(node) { + const operationName = node.name; + + if (operationName) { + if (knownOperationNames[operationName.value]) { + context.reportError( + new GraphQLError( + `There can be only one operation named "${operationName.value}".`, + { + nodes: [ + knownOperationNames[operationName.value], + operationName, + ], + }, + ), + ); + } else { + knownOperationNames[operationName.value] = operationName; + } + } + + return false; + }, + + FragmentDefinition: () => false, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts new file mode 100644 index 0000000..3471719 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +export declare function UniqueOperationTypesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js new file mode 100644 index 0000000..3fe791e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js @@ -0,0 +1,71 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueOperationTypesRule = UniqueOperationTypesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +function UniqueOperationTypesRule(context) { + const schema = context.getSchema(); + const definedOperationTypes = Object.create(null); + const existingOperationTypes = schema + ? { + query: schema.getQueryType(), + mutation: schema.getMutationType(), + subscription: schema.getSubscriptionType(), + } + : {}; + return { + SchemaDefinition: checkOperationTypes, + SchemaExtension: checkOperationTypes, + }; + + function checkOperationTypes(node) { + var _node$operationTypes; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const operationTypesNodes = + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + const operation = operationType.operation; + const alreadyDefinedOperationType = definedOperationTypes[operation]; + + if (existingOperationTypes[operation]) { + context.reportError( + new _GraphQLError.GraphQLError( + `Type for ${operation} already defined in the schema. It cannot be redefined.`, + { + nodes: operationType, + }, + ), + ); + } else if (alreadyDefinedOperationType) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one ${operation} type in schema.`, + { + nodes: [alreadyDefinedOperationType, operationType], + }, + ), + ); + } else { + definedOperationTypes[operation] = operationType; + } + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs new file mode 100644 index 0000000..9b56d35 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs @@ -0,0 +1,64 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +export function UniqueOperationTypesRule(context) { + const schema = context.getSchema(); + const definedOperationTypes = Object.create(null); + const existingOperationTypes = schema + ? { + query: schema.getQueryType(), + mutation: schema.getMutationType(), + subscription: schema.getSubscriptionType(), + } + : {}; + return { + SchemaDefinition: checkOperationTypes, + SchemaExtension: checkOperationTypes, + }; + + function checkOperationTypes(node) { + var _node$operationTypes; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const operationTypesNodes = + (_node$operationTypes = node.operationTypes) !== null && + _node$operationTypes !== void 0 + ? _node$operationTypes + : []; + + for (const operationType of operationTypesNodes) { + const operation = operationType.operation; + const alreadyDefinedOperationType = definedOperationTypes[operation]; + + if (existingOperationTypes[operation]) { + context.reportError( + new GraphQLError( + `Type for ${operation} already defined in the schema. It cannot be redefined.`, + { + nodes: operationType, + }, + ), + ); + } else if (alreadyDefinedOperationType) { + context.reportError( + new GraphQLError( + `There can be only one ${operation} type in schema.`, + { + nodes: [alreadyDefinedOperationType, operationType], + }, + ), + ); + } else { + definedOperationTypes[operation] = operationType; + } + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts new file mode 100644 index 0000000..f2ba792 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { SDLValidationContext } from '../ValidationContext'; +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +export declare function UniqueTypeNamesRule( + context: SDLValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js new file mode 100644 index 0000000..f510fb7 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js @@ -0,0 +1,57 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueTypeNamesRule = UniqueTypeNamesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +function UniqueTypeNamesRule(context) { + const knownTypeNames = Object.create(null); + const schema = context.getSchema(); + return { + ScalarTypeDefinition: checkTypeName, + ObjectTypeDefinition: checkTypeName, + InterfaceTypeDefinition: checkTypeName, + UnionTypeDefinition: checkTypeName, + EnumTypeDefinition: checkTypeName, + InputObjectTypeDefinition: checkTypeName, + }; + + function checkTypeName(node) { + const typeName = node.name.value; + + if (schema !== null && schema !== void 0 && schema.getType(typeName)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownTypeNames[typeName]) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one type named "${typeName}".`, + { + nodes: [knownTypeNames[typeName], node.name], + }, + ), + ); + } else { + knownTypeNames[typeName] = node.name; + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs new file mode 100644 index 0000000..becbf21 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs @@ -0,0 +1,47 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +export function UniqueTypeNamesRule(context) { + const knownTypeNames = Object.create(null); + const schema = context.getSchema(); + return { + ScalarTypeDefinition: checkTypeName, + ObjectTypeDefinition: checkTypeName, + InterfaceTypeDefinition: checkTypeName, + UnionTypeDefinition: checkTypeName, + EnumTypeDefinition: checkTypeName, + InputObjectTypeDefinition: checkTypeName, + }; + + function checkTypeName(node) { + const typeName = node.name.value; + + if (schema !== null && schema !== void 0 && schema.getType(typeName)) { + context.reportError( + new GraphQLError( + `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, + { + nodes: node.name, + }, + ), + ); + return; + } + + if (knownTypeNames[typeName]) { + context.reportError( + new GraphQLError(`There can be only one type named "${typeName}".`, { + nodes: [knownTypeNames[typeName], node.name], + }), + ); + } else { + knownTypeNames[typeName] = node.name; + } + + return false; + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts new file mode 100644 index 0000000..05f48ba --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts @@ -0,0 +1,10 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ASTValidationContext } from '../ValidationContext'; +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +export declare function UniqueVariableNamesRule( + context: ASTValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js new file mode 100644 index 0000000..d8dca55 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js @@ -0,0 +1,49 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.UniqueVariableNamesRule = UniqueVariableNamesRule; + +var _groupBy = require('../../jsutils/groupBy.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +function UniqueVariableNamesRule(context) { + return { + OperationDefinition(operationNode) { + var _operationNode$variab; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const variableDefinitions = + (_operationNode$variab = operationNode.variableDefinitions) !== null && + _operationNode$variab !== void 0 + ? _operationNode$variab + : []; + const seenVariableDefinitions = (0, _groupBy.groupBy)( + variableDefinitions, + (node) => node.variable.name.value, + ); + + for (const [variableName, variableNodes] of seenVariableDefinitions) { + if (variableNodes.length > 1) { + context.reportError( + new _GraphQLError.GraphQLError( + `There can be only one variable named "$${variableName}".`, + { + nodes: variableNodes.map((node) => node.variable.name), + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs new file mode 100644 index 0000000..e8b9e62 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs @@ -0,0 +1,41 @@ +import { groupBy } from '../../jsutils/groupBy.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +export function UniqueVariableNamesRule(context) { + return { + OperationDefinition(operationNode) { + var _operationNode$variab; + + // See: https://github.com/graphql/graphql-js/issues/2203 + + /* c8 ignore next */ + const variableDefinitions = + (_operationNode$variab = operationNode.variableDefinitions) !== null && + _operationNode$variab !== void 0 + ? _operationNode$variab + : []; + const seenVariableDefinitions = groupBy( + variableDefinitions, + (node) => node.variable.name.value, + ); + + for (const [variableName, variableNodes] of seenVariableDefinitions) { + if (variableNodes.length > 1) { + context.reportError( + new GraphQLError( + `There can be only one variable named "$${variableName}".`, + { + nodes: variableNodes.map((node) => node.variable.name), + }, + ), + ); + } + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts new file mode 100644 index 0000000..8685e52 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + */ +export declare function ValuesOfCorrectTypeRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js b/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js new file mode 100644 index 0000000..6eede7a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js @@ -0,0 +1,192 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.ValuesOfCorrectTypeRule = ValuesOfCorrectTypeRule; + +var _didYouMean = require('../../jsutils/didYouMean.js'); + +var _inspect = require('../../jsutils/inspect.js'); + +var _keyMap = require('../../jsutils/keyMap.js'); + +var _suggestionList = require('../../jsutils/suggestionList.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + */ +function ValuesOfCorrectTypeRule(context) { + return { + ListValue(node) { + // Note: TypeInfo will traverse into a list's item type, so look to the + // parent input type to check if it is a list. + const type = (0, _definition.getNullableType)( + context.getParentInputType(), + ); + + if (!(0, _definition.isListType)(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } + }, + + ObjectValue(node) { + const type = (0, _definition.getNamedType)(context.getInputType()); + + if (!(0, _definition.isInputObjectType)(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } // Ensure every required field exists. + + const fieldNodeMap = (0, _keyMap.keyMap)( + node.fields, + (field) => field.name.value, + ); + + for (const fieldDef of Object.values(type.getFields())) { + const fieldNode = fieldNodeMap[fieldDef.name]; + + if (!fieldNode && (0, _definition.isRequiredInputField)(fieldDef)) { + const typeStr = (0, _inspect.inspect)(fieldDef.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const parentType = (0, _definition.getNamedType)( + context.getParentInputType(), + ); + const fieldType = context.getInputType(); + + if (!fieldType && (0, _definition.isInputObjectType)(parentType)) { + const suggestions = (0, _suggestionList.suggestionList)( + node.name.value, + Object.keys(parentType.getFields()), + ); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${node.name.value}" is not defined by type "${parentType.name}".` + + (0, _didYouMean.didYouMean)(suggestions), + { + nodes: node, + }, + ), + ); + } + }, + + NullValue(node) { + const type = context.getInputType(); + + if ((0, _definition.isNonNullType)(type)) { + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${(0, _inspect.inspect)( + type, + )}", found ${(0, _printer.print)(node)}.`, + { + nodes: node, + }, + ), + ); + } + }, + + EnumValue: (node) => isValidValueNode(context, node), + IntValue: (node) => isValidValueNode(context, node), + FloatValue: (node) => isValidValueNode(context, node), + StringValue: (node) => isValidValueNode(context, node), + BooleanValue: (node) => isValidValueNode(context, node), + }; +} +/** + * Any value literal may be a valid representation of a Scalar, depending on + * that scalar type. + */ + +function isValidValueNode(context, node) { + // Report any error at the full type expected by the location. + const locationType = context.getInputType(); + + if (!locationType) { + return; + } + + const type = (0, _definition.getNamedType)(locationType); + + if (!(0, _definition.isLeafType)(type)) { + const typeStr = (0, _inspect.inspect)(locationType); + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${typeStr}", found ${(0, _printer.print)( + node, + )}.`, + { + nodes: node, + }, + ), + ); + return; + } // Scalars and Enums determine if a literal value is valid via parseLiteral(), + // which may throw or return an invalid value to indicate failure. + + try { + const parseResult = type.parseLiteral( + node, + undefined, + /* variables */ + ); + + if (parseResult === undefined) { + const typeStr = (0, _inspect.inspect)(locationType); + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${typeStr}", found ${(0, _printer.print)( + node, + )}.`, + { + nodes: node, + }, + ), + ); + } + } catch (error) { + const typeStr = (0, _inspect.inspect)(locationType); + + if (error instanceof _GraphQLError.GraphQLError) { + context.reportError(error); + } else { + context.reportError( + new _GraphQLError.GraphQLError( + `Expected value of type "${typeStr}", found ${(0, _printer.print)( + node, + )}; ` + error.message, + { + nodes: node, + originalError: error, + }, + ), + ); + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs new file mode 100644 index 0000000..ca5ca2f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs @@ -0,0 +1,173 @@ +import { didYouMean } from '../../jsutils/didYouMean.mjs'; +import { inspect } from '../../jsutils/inspect.mjs'; +import { keyMap } from '../../jsutils/keyMap.mjs'; +import { suggestionList } from '../../jsutils/suggestionList.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { print } from '../../language/printer.mjs'; +import { + getNamedType, + getNullableType, + isInputObjectType, + isLeafType, + isListType, + isNonNullType, + isRequiredInputField, +} from '../../type/definition.mjs'; + +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + */ +export function ValuesOfCorrectTypeRule(context) { + return { + ListValue(node) { + // Note: TypeInfo will traverse into a list's item type, so look to the + // parent input type to check if it is a list. + const type = getNullableType(context.getParentInputType()); + + if (!isListType(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } + }, + + ObjectValue(node) { + const type = getNamedType(context.getInputType()); + + if (!isInputObjectType(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } // Ensure every required field exists. + + const fieldNodeMap = keyMap(node.fields, (field) => field.name.value); + + for (const fieldDef of Object.values(type.getFields())) { + const fieldNode = fieldNodeMap[fieldDef.name]; + + if (!fieldNode && isRequiredInputField(fieldDef)) { + const typeStr = inspect(fieldDef.type); + context.reportError( + new GraphQLError( + `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const parentType = getNamedType(context.getParentInputType()); + const fieldType = context.getInputType(); + + if (!fieldType && isInputObjectType(parentType)) { + const suggestions = suggestionList( + node.name.value, + Object.keys(parentType.getFields()), + ); + context.reportError( + new GraphQLError( + `Field "${node.name.value}" is not defined by type "${parentType.name}".` + + didYouMean(suggestions), + { + nodes: node, + }, + ), + ); + } + }, + + NullValue(node) { + const type = context.getInputType(); + + if (isNonNullType(type)) { + context.reportError( + new GraphQLError( + `Expected value of type "${inspect(type)}", found ${print(node)}.`, + { + nodes: node, + }, + ), + ); + } + }, + + EnumValue: (node) => isValidValueNode(context, node), + IntValue: (node) => isValidValueNode(context, node), + FloatValue: (node) => isValidValueNode(context, node), + StringValue: (node) => isValidValueNode(context, node), + BooleanValue: (node) => isValidValueNode(context, node), + }; +} +/** + * Any value literal may be a valid representation of a Scalar, depending on + * that scalar type. + */ + +function isValidValueNode(context, node) { + // Report any error at the full type expected by the location. + const locationType = context.getInputType(); + + if (!locationType) { + return; + } + + const type = getNamedType(locationType); + + if (!isLeafType(type)) { + const typeStr = inspect(locationType); + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}.`, + { + nodes: node, + }, + ), + ); + return; + } // Scalars and Enums determine if a literal value is valid via parseLiteral(), + // which may throw or return an invalid value to indicate failure. + + try { + const parseResult = type.parseLiteral( + node, + undefined, + /* variables */ + ); + + if (parseResult === undefined) { + const typeStr = inspect(locationType); + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}.`, + { + nodes: node, + }, + ), + ); + } + } catch (error) { + const typeStr = inspect(locationType); + + if (error instanceof GraphQLError) { + context.reportError(error); + } else { + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}; ` + + error.message, + { + nodes: node, + originalError: error, + }, + ), + ); + } + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts new file mode 100644 index 0000000..45c7e34 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts @@ -0,0 +1,13 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + */ +export declare function VariablesAreInputTypesRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js b/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js new file mode 100644 index 0000000..20366d4 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js @@ -0,0 +1,46 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.VariablesAreInputTypesRule = VariablesAreInputTypesRule; + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _printer = require('../../language/printer.js'); + +var _definition = require('../../type/definition.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + */ +function VariablesAreInputTypesRule(context) { + return { + VariableDefinition(node) { + const type = (0, _typeFromAST.typeFromAST)( + context.getSchema(), + node.type, + ); + + if (type !== undefined && !(0, _definition.isInputType)(type)) { + const variableName = node.variable.name.value; + const typeName = (0, _printer.print)(node.type); + context.reportError( + new _GraphQLError.GraphQLError( + `Variable "$${variableName}" cannot be non-input type "${typeName}".`, + { + nodes: node.type, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs new file mode 100644 index 0000000..7ad0659 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs @@ -0,0 +1,33 @@ +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { print } from '../../language/printer.mjs'; +import { isInputType } from '../../type/definition.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + */ +export function VariablesAreInputTypesRule(context) { + return { + VariableDefinition(node) { + const type = typeFromAST(context.getSchema(), node.type); + + if (type !== undefined && !isInputType(type)) { + const variableName = node.variable.name.value; + const typeName = print(node.type); + context.reportError( + new GraphQLError( + `Variable "$${variableName}" cannot be non-input type "${typeName}".`, + { + nodes: node.type, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts new file mode 100644 index 0000000..3cac590 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts @@ -0,0 +1,12 @@ +import type { ASTVisitor } from '../../language/visitor'; +import type { ValidationContext } from '../ValidationContext'; +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + */ +export declare function VariablesInAllowedPositionRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js b/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js new file mode 100644 index 0000000..cc8967b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js @@ -0,0 +1,116 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.VariablesInAllowedPositionRule = VariablesInAllowedPositionRule; + +var _inspect = require('../../jsutils/inspect.js'); + +var _GraphQLError = require('../../error/GraphQLError.js'); + +var _kinds = require('../../language/kinds.js'); + +var _definition = require('../../type/definition.js'); + +var _typeComparators = require('../../utilities/typeComparators.js'); + +var _typeFromAST = require('../../utilities/typeFromAST.js'); + +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + */ +function VariablesInAllowedPositionRule(context) { + let varDefMap = Object.create(null); + return { + OperationDefinition: { + enter() { + varDefMap = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node, type, defaultValue } of usages) { + const varName = node.name.value; + const varDef = varDefMap[varName]; + + if (varDef && type) { + // A var type is allowed if it is the same or more strict (e.g. is + // a subtype of) than the expected type. It can be more strict if + // the variable type is non-null when the expected type is nullable. + // If both are list types, the variable item type can be more strict + // than the expected item type (contravariant). + const schema = context.getSchema(); + const varType = (0, _typeFromAST.typeFromAST)(schema, varDef.type); + + if ( + varType && + !allowedVariableUsage( + schema, + varType, + varDef.defaultValue, + type, + defaultValue, + ) + ) { + const varTypeStr = (0, _inspect.inspect)(varType); + const typeStr = (0, _inspect.inspect)(type); + context.reportError( + new _GraphQLError.GraphQLError( + `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, + { + nodes: [varDef, node], + }, + ), + ); + } + } + } + }, + }, + + VariableDefinition(node) { + varDefMap[node.variable.name.value] = node; + }, + }; +} +/** + * Returns true if the variable is allowed in the location it was found, + * which includes considering if default values exist for either the variable + * or the location at which it is located. + */ + +function allowedVariableUsage( + schema, + varType, + varDefaultValue, + locationType, + locationDefaultValue, +) { + if ( + (0, _definition.isNonNullType)(locationType) && + !(0, _definition.isNonNullType)(varType) + ) { + const hasNonNullVariableDefaultValue = + varDefaultValue != null && varDefaultValue.kind !== _kinds.Kind.NULL; + const hasLocationDefaultValue = locationDefaultValue !== undefined; + + if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { + return false; + } + + const nullableLocationType = locationType.ofType; + return (0, _typeComparators.isTypeSubTypeOf)( + schema, + varType, + nullableLocationType, + ); + } + + return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, locationType); +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs new file mode 100644 index 0000000..cd97ffc --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs @@ -0,0 +1,97 @@ +import { inspect } from '../../jsutils/inspect.mjs'; +import { GraphQLError } from '../../error/GraphQLError.mjs'; +import { Kind } from '../../language/kinds.mjs'; +import { isNonNullType } from '../../type/definition.mjs'; +import { isTypeSubTypeOf } from '../../utilities/typeComparators.mjs'; +import { typeFromAST } from '../../utilities/typeFromAST.mjs'; + +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + */ +export function VariablesInAllowedPositionRule(context) { + let varDefMap = Object.create(null); + return { + OperationDefinition: { + enter() { + varDefMap = Object.create(null); + }, + + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node, type, defaultValue } of usages) { + const varName = node.name.value; + const varDef = varDefMap[varName]; + + if (varDef && type) { + // A var type is allowed if it is the same or more strict (e.g. is + // a subtype of) than the expected type. It can be more strict if + // the variable type is non-null when the expected type is nullable. + // If both are list types, the variable item type can be more strict + // than the expected item type (contravariant). + const schema = context.getSchema(); + const varType = typeFromAST(schema, varDef.type); + + if ( + varType && + !allowedVariableUsage( + schema, + varType, + varDef.defaultValue, + type, + defaultValue, + ) + ) { + const varTypeStr = inspect(varType); + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, + { + nodes: [varDef, node], + }, + ), + ); + } + } + } + }, + }, + + VariableDefinition(node) { + varDefMap[node.variable.name.value] = node; + }, + }; +} +/** + * Returns true if the variable is allowed in the location it was found, + * which includes considering if default values exist for either the variable + * or the location at which it is located. + */ + +function allowedVariableUsage( + schema, + varType, + varDefaultValue, + locationType, + locationDefaultValue, +) { + if (isNonNullType(locationType) && !isNonNullType(varType)) { + const hasNonNullVariableDefaultValue = + varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; + const hasLocationDefaultValue = locationDefaultValue !== undefined; + + if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { + return false; + } + + const nullableLocationType = locationType.ofType; + return isTypeSubTypeOf(schema, varType, nullableLocationType); + } + + return isTypeSubTypeOf(schema, varType, locationType); +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts new file mode 100644 index 0000000..fe36482 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts @@ -0,0 +1,15 @@ +import type { ASTVisitor } from '../../../language/visitor'; +import type { ValidationContext } from '../../ValidationContext'; +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +export declare function NoDeprecatedCustomRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js new file mode 100644 index 0000000..0e118f2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js @@ -0,0 +1,131 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoDeprecatedCustomRule = NoDeprecatedCustomRule; + +var _invariant = require('../../../jsutils/invariant.js'); + +var _GraphQLError = require('../../../error/GraphQLError.js'); + +var _definition = require('../../../type/definition.js'); + +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +function NoDeprecatedCustomRule(context) { + return { + Field(node) { + const fieldDef = context.getFieldDef(); + const deprecationReason = + fieldDef === null || fieldDef === void 0 + ? void 0 + : fieldDef.deprecationReason; + + if (fieldDef && deprecationReason != null) { + const parentType = context.getParentType(); + parentType != null || (0, _invariant.invariant)(false); + context.reportError( + new _GraphQLError.GraphQLError( + `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + + Argument(node) { + const argDef = context.getArgument(); + const deprecationReason = + argDef === null || argDef === void 0 + ? void 0 + : argDef.deprecationReason; + + if (argDef && deprecationReason != null) { + const directiveDef = context.getDirective(); + + if (directiveDef != null) { + context.reportError( + new _GraphQLError.GraphQLError( + `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } else { + const parentType = context.getParentType(); + const fieldDef = context.getFieldDef(); + (parentType != null && fieldDef != null) || + (0, _invariant.invariant)(false); + context.reportError( + new _GraphQLError.GraphQLError( + `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const inputObjectDef = (0, _definition.getNamedType)( + context.getParentInputType(), + ); + + if ((0, _definition.isInputObjectType)(inputObjectDef)) { + const inputFieldDef = inputObjectDef.getFields()[node.name.value]; + const deprecationReason = + inputFieldDef === null || inputFieldDef === void 0 + ? void 0 + : inputFieldDef.deprecationReason; + + if (deprecationReason != null) { + context.reportError( + new _GraphQLError.GraphQLError( + `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + EnumValue(node) { + const enumValueDef = context.getEnumValue(); + const deprecationReason = + enumValueDef === null || enumValueDef === void 0 + ? void 0 + : enumValueDef.deprecationReason; + + if (enumValueDef && deprecationReason != null) { + const enumTypeDef = (0, _definition.getNamedType)( + context.getInputType(), + ); + enumTypeDef != null || (0, _invariant.invariant)(false); + context.reportError( + new _GraphQLError.GraphQLError( + `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs new file mode 100644 index 0000000..0e04b4f --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs @@ -0,0 +1,117 @@ +import { invariant } from '../../../jsutils/invariant.mjs'; +import { GraphQLError } from '../../../error/GraphQLError.mjs'; +import { getNamedType, isInputObjectType } from '../../../type/definition.mjs'; + +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +export function NoDeprecatedCustomRule(context) { + return { + Field(node) { + const fieldDef = context.getFieldDef(); + const deprecationReason = + fieldDef === null || fieldDef === void 0 + ? void 0 + : fieldDef.deprecationReason; + + if (fieldDef && deprecationReason != null) { + const parentType = context.getParentType(); + parentType != null || invariant(false); + context.reportError( + new GraphQLError( + `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + + Argument(node) { + const argDef = context.getArgument(); + const deprecationReason = + argDef === null || argDef === void 0 + ? void 0 + : argDef.deprecationReason; + + if (argDef && deprecationReason != null) { + const directiveDef = context.getDirective(); + + if (directiveDef != null) { + context.reportError( + new GraphQLError( + `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } else { + const parentType = context.getParentType(); + const fieldDef = context.getFieldDef(); + (parentType != null && fieldDef != null) || invariant(false); + context.reportError( + new GraphQLError( + `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + ObjectField(node) { + const inputObjectDef = getNamedType(context.getParentInputType()); + + if (isInputObjectType(inputObjectDef)) { + const inputFieldDef = inputObjectDef.getFields()[node.name.value]; + const deprecationReason = + inputFieldDef === null || inputFieldDef === void 0 + ? void 0 + : inputFieldDef.deprecationReason; + + if (deprecationReason != null) { + context.reportError( + new GraphQLError( + `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + } + }, + + EnumValue(node) { + const enumValueDef = context.getEnumValue(); + const deprecationReason = + enumValueDef === null || enumValueDef === void 0 + ? void 0 + : enumValueDef.deprecationReason; + + if (enumValueDef && deprecationReason != null) { + const enumTypeDef = getNamedType(context.getInputType()); + enumTypeDef != null || invariant(false); + context.reportError( + new GraphQLError( + `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts new file mode 100644 index 0000000..a7bc93e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts @@ -0,0 +1,15 @@ +import type { ASTVisitor } from '../../../language/visitor'; +import type { ValidationContext } from '../../ValidationContext'; +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +export declare function NoSchemaIntrospectionCustomRule( + context: ValidationContext, +): ASTVisitor; diff --git a/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js new file mode 100644 index 0000000..f3b4265 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.NoSchemaIntrospectionCustomRule = NoSchemaIntrospectionCustomRule; + +var _GraphQLError = require('../../../error/GraphQLError.js'); + +var _definition = require('../../../type/definition.js'); + +var _introspection = require('../../../type/introspection.js'); + +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +function NoSchemaIntrospectionCustomRule(context) { + return { + Field(node) { + const type = (0, _definition.getNamedType)(context.getType()); + + if (type && (0, _introspection.isIntrospectionType)(type)) { + context.reportError( + new _GraphQLError.GraphQLError( + `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs new file mode 100644 index 0000000..9f7984e --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs @@ -0,0 +1,32 @@ +import { GraphQLError } from '../../../error/GraphQLError.mjs'; +import { getNamedType } from '../../../type/definition.mjs'; +import { isIntrospectionType } from '../../../type/introspection.mjs'; + +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +export function NoSchemaIntrospectionCustomRule(context) { + return { + Field(node) { + const type = getNamedType(context.getType()); + + if (type && isIntrospectionType(type)) { + context.reportError( + new GraphQLError( + `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, + { + nodes: node, + }, + ), + ); + } + }, + }; +} diff --git a/graphql-subscription/node_modules/graphql/validation/specifiedRules.d.ts b/graphql-subscription/node_modules/graphql/validation/specifiedRules.d.ts new file mode 100644 index 0000000..8ab4ec6 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/specifiedRules.d.ts @@ -0,0 +1,12 @@ +import type { SDLValidationRule, ValidationRule } from './ValidationContext'; +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +export declare const specifiedRules: ReadonlyArray; +/** + * @internal + */ +export declare const specifiedSDLRules: ReadonlyArray; diff --git a/graphql-subscription/node_modules/graphql/validation/specifiedRules.js b/graphql-subscription/node_modules/graphql/validation/specifiedRules.js new file mode 100644 index 0000000..014d23b --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/specifiedRules.js @@ -0,0 +1,160 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.specifiedSDLRules = exports.specifiedRules = void 0; + +var _ExecutableDefinitionsRule = require('./rules/ExecutableDefinitionsRule.js'); + +var _FieldsOnCorrectTypeRule = require('./rules/FieldsOnCorrectTypeRule.js'); + +var _FragmentsOnCompositeTypesRule = require('./rules/FragmentsOnCompositeTypesRule.js'); + +var _KnownArgumentNamesRule = require('./rules/KnownArgumentNamesRule.js'); + +var _KnownDirectivesRule = require('./rules/KnownDirectivesRule.js'); + +var _KnownFragmentNamesRule = require('./rules/KnownFragmentNamesRule.js'); + +var _KnownTypeNamesRule = require('./rules/KnownTypeNamesRule.js'); + +var _LoneAnonymousOperationRule = require('./rules/LoneAnonymousOperationRule.js'); + +var _LoneSchemaDefinitionRule = require('./rules/LoneSchemaDefinitionRule.js'); + +var _NoFragmentCyclesRule = require('./rules/NoFragmentCyclesRule.js'); + +var _NoUndefinedVariablesRule = require('./rules/NoUndefinedVariablesRule.js'); + +var _NoUnusedFragmentsRule = require('./rules/NoUnusedFragmentsRule.js'); + +var _NoUnusedVariablesRule = require('./rules/NoUnusedVariablesRule.js'); + +var _OverlappingFieldsCanBeMergedRule = require('./rules/OverlappingFieldsCanBeMergedRule.js'); + +var _PossibleFragmentSpreadsRule = require('./rules/PossibleFragmentSpreadsRule.js'); + +var _PossibleTypeExtensionsRule = require('./rules/PossibleTypeExtensionsRule.js'); + +var _ProvidedRequiredArgumentsRule = require('./rules/ProvidedRequiredArgumentsRule.js'); + +var _ScalarLeafsRule = require('./rules/ScalarLeafsRule.js'); + +var _SingleFieldSubscriptionsRule = require('./rules/SingleFieldSubscriptionsRule.js'); + +var _UniqueArgumentDefinitionNamesRule = require('./rules/UniqueArgumentDefinitionNamesRule.js'); + +var _UniqueArgumentNamesRule = require('./rules/UniqueArgumentNamesRule.js'); + +var _UniqueDirectiveNamesRule = require('./rules/UniqueDirectiveNamesRule.js'); + +var _UniqueDirectivesPerLocationRule = require('./rules/UniqueDirectivesPerLocationRule.js'); + +var _UniqueEnumValueNamesRule = require('./rules/UniqueEnumValueNamesRule.js'); + +var _UniqueFieldDefinitionNamesRule = require('./rules/UniqueFieldDefinitionNamesRule.js'); + +var _UniqueFragmentNamesRule = require('./rules/UniqueFragmentNamesRule.js'); + +var _UniqueInputFieldNamesRule = require('./rules/UniqueInputFieldNamesRule.js'); + +var _UniqueOperationNamesRule = require('./rules/UniqueOperationNamesRule.js'); + +var _UniqueOperationTypesRule = require('./rules/UniqueOperationTypesRule.js'); + +var _UniqueTypeNamesRule = require('./rules/UniqueTypeNamesRule.js'); + +var _UniqueVariableNamesRule = require('./rules/UniqueVariableNamesRule.js'); + +var _ValuesOfCorrectTypeRule = require('./rules/ValuesOfCorrectTypeRule.js'); + +var _VariablesAreInputTypesRule = require('./rules/VariablesAreInputTypesRule.js'); + +var _VariablesInAllowedPositionRule = require('./rules/VariablesInAllowedPositionRule.js'); + +// Spec Section: "Executable Definitions" +// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" +// Spec Section: "Fragments on Composite Types" +// Spec Section: "Argument Names" +// Spec Section: "Directives Are Defined" +// Spec Section: "Fragment spread target defined" +// Spec Section: "Fragment Spread Type Existence" +// Spec Section: "Lone Anonymous Operation" +// SDL-specific validation rules +// Spec Section: "Fragments must not form cycles" +// Spec Section: "All Variable Used Defined" +// Spec Section: "Fragments must be used" +// Spec Section: "All Variables Used" +// Spec Section: "Field Selection Merging" +// Spec Section: "Fragment spread is possible" +// Spec Section: "Argument Optionality" +// Spec Section: "Leaf Field Selections" +// Spec Section: "Subscriptions with Single Root Field" +// Spec Section: "Argument Uniqueness" +// Spec Section: "Directives Are Unique Per Location" +// Spec Section: "Fragment Name Uniqueness" +// Spec Section: "Input Object Field Uniqueness" +// Spec Section: "Operation Name Uniqueness" +// Spec Section: "Variable Uniqueness" +// Spec Section: "Value Type Correctness" +// Spec Section: "Variables are Input Types" +// Spec Section: "All Variable Usages Are Allowed" + +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +const specifiedRules = Object.freeze([ + _ExecutableDefinitionsRule.ExecutableDefinitionsRule, + _UniqueOperationNamesRule.UniqueOperationNamesRule, + _LoneAnonymousOperationRule.LoneAnonymousOperationRule, + _SingleFieldSubscriptionsRule.SingleFieldSubscriptionsRule, + _KnownTypeNamesRule.KnownTypeNamesRule, + _FragmentsOnCompositeTypesRule.FragmentsOnCompositeTypesRule, + _VariablesAreInputTypesRule.VariablesAreInputTypesRule, + _ScalarLeafsRule.ScalarLeafsRule, + _FieldsOnCorrectTypeRule.FieldsOnCorrectTypeRule, + _UniqueFragmentNamesRule.UniqueFragmentNamesRule, + _KnownFragmentNamesRule.KnownFragmentNamesRule, + _NoUnusedFragmentsRule.NoUnusedFragmentsRule, + _PossibleFragmentSpreadsRule.PossibleFragmentSpreadsRule, + _NoFragmentCyclesRule.NoFragmentCyclesRule, + _UniqueVariableNamesRule.UniqueVariableNamesRule, + _NoUndefinedVariablesRule.NoUndefinedVariablesRule, + _NoUnusedVariablesRule.NoUnusedVariablesRule, + _KnownDirectivesRule.KnownDirectivesRule, + _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, + _KnownArgumentNamesRule.KnownArgumentNamesRule, + _UniqueArgumentNamesRule.UniqueArgumentNamesRule, + _ValuesOfCorrectTypeRule.ValuesOfCorrectTypeRule, + _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsRule, + _VariablesInAllowedPositionRule.VariablesInAllowedPositionRule, + _OverlappingFieldsCanBeMergedRule.OverlappingFieldsCanBeMergedRule, + _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, +]); +/** + * @internal + */ + +exports.specifiedRules = specifiedRules; +const specifiedSDLRules = Object.freeze([ + _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule, + _UniqueOperationTypesRule.UniqueOperationTypesRule, + _UniqueTypeNamesRule.UniqueTypeNamesRule, + _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule, + _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule, + _UniqueArgumentDefinitionNamesRule.UniqueArgumentDefinitionNamesRule, + _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule, + _KnownTypeNamesRule.KnownTypeNamesRule, + _KnownDirectivesRule.KnownDirectivesRule, + _UniqueDirectivesPerLocationRule.UniqueDirectivesPerLocationRule, + _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule, + _KnownArgumentNamesRule.KnownArgumentNamesOnDirectivesRule, + _UniqueArgumentNamesRule.UniqueArgumentNamesRule, + _UniqueInputFieldNamesRule.UniqueInputFieldNamesRule, + _ProvidedRequiredArgumentsRule.ProvidedRequiredArgumentsOnDirectivesRule, +]); +exports.specifiedSDLRules = specifiedSDLRules; diff --git a/graphql-subscription/node_modules/graphql/validation/specifiedRules.mjs b/graphql-subscription/node_modules/graphql/validation/specifiedRules.mjs new file mode 100644 index 0000000..c45f0f0 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/specifiedRules.mjs @@ -0,0 +1,123 @@ +// Spec Section: "Executable Definitions" +import { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule.mjs'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" + +import { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule.mjs'; // Spec Section: "Fragments on Composite Types" + +import { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule.mjs'; // Spec Section: "Argument Names" + +import { + KnownArgumentNamesOnDirectivesRule, + KnownArgumentNamesRule, +} from './rules/KnownArgumentNamesRule.mjs'; // Spec Section: "Directives Are Defined" + +import { KnownDirectivesRule } from './rules/KnownDirectivesRule.mjs'; // Spec Section: "Fragment spread target defined" + +import { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule.mjs'; // Spec Section: "Fragment Spread Type Existence" + +import { KnownTypeNamesRule } from './rules/KnownTypeNamesRule.mjs'; // Spec Section: "Lone Anonymous Operation" + +import { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule.mjs'; // SDL-specific validation rules + +import { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule.mjs'; // Spec Section: "Fragments must not form cycles" + +import { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule.mjs'; // Spec Section: "All Variable Used Defined" + +import { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule.mjs'; // Spec Section: "Fragments must be used" + +import { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule.mjs'; // Spec Section: "All Variables Used" + +import { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule.mjs'; // Spec Section: "Field Selection Merging" + +import { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule.mjs'; // Spec Section: "Fragment spread is possible" + +import { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule.mjs'; +import { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule.mjs'; // Spec Section: "Argument Optionality" + +import { + ProvidedRequiredArgumentsOnDirectivesRule, + ProvidedRequiredArgumentsRule, +} from './rules/ProvidedRequiredArgumentsRule.mjs'; // Spec Section: "Leaf Field Selections" + +import { ScalarLeafsRule } from './rules/ScalarLeafsRule.mjs'; // Spec Section: "Subscriptions with Single Root Field" + +import { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule.mjs'; +import { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule.mjs'; // Spec Section: "Argument Uniqueness" + +import { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule.mjs'; +import { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule.mjs'; // Spec Section: "Directives Are Unique Per Location" + +import { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule.mjs'; +import { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule.mjs'; +import { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule.mjs'; // Spec Section: "Fragment Name Uniqueness" + +import { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule.mjs'; // Spec Section: "Input Object Field Uniqueness" + +import { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule.mjs'; // Spec Section: "Operation Name Uniqueness" + +import { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule.mjs'; +import { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule.mjs'; +import { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule.mjs'; // Spec Section: "Variable Uniqueness" + +import { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule.mjs'; // Spec Section: "Value Type Correctness" + +import { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule.mjs'; // Spec Section: "Variables are Input Types" + +import { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule.mjs'; // Spec Section: "All Variable Usages Are Allowed" + +import { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule.mjs'; + +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +export const specifiedRules = Object.freeze([ + ExecutableDefinitionsRule, + UniqueOperationNamesRule, + LoneAnonymousOperationRule, + SingleFieldSubscriptionsRule, + KnownTypeNamesRule, + FragmentsOnCompositeTypesRule, + VariablesAreInputTypesRule, + ScalarLeafsRule, + FieldsOnCorrectTypeRule, + UniqueFragmentNamesRule, + KnownFragmentNamesRule, + NoUnusedFragmentsRule, + PossibleFragmentSpreadsRule, + NoFragmentCyclesRule, + UniqueVariableNamesRule, + NoUndefinedVariablesRule, + NoUnusedVariablesRule, + KnownDirectivesRule, + UniqueDirectivesPerLocationRule, + KnownArgumentNamesRule, + UniqueArgumentNamesRule, + ValuesOfCorrectTypeRule, + ProvidedRequiredArgumentsRule, + VariablesInAllowedPositionRule, + OverlappingFieldsCanBeMergedRule, + UniqueInputFieldNamesRule, +]); +/** + * @internal + */ + +export const specifiedSDLRules = Object.freeze([ + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + KnownTypeNamesRule, + KnownDirectivesRule, + UniqueDirectivesPerLocationRule, + PossibleTypeExtensionsRule, + KnownArgumentNamesOnDirectivesRule, + UniqueArgumentNamesRule, + UniqueInputFieldNamesRule, + ProvidedRequiredArgumentsOnDirectivesRule, +]); diff --git a/graphql-subscription/node_modules/graphql/validation/validate.d.ts b/graphql-subscription/node_modules/graphql/validation/validate.d.ts new file mode 100644 index 0000000..15dae3a --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/validate.d.ts @@ -0,0 +1,61 @@ +import type { Maybe } from '../jsutils/Maybe'; +import { GraphQLError } from '../error/GraphQLError'; +import type { DocumentNode } from '../language/ast'; +import type { GraphQLSchema } from '../type/schema'; +import { TypeInfo } from '../utilities/TypeInfo'; +import type { SDLValidationRule, ValidationRule } from './ValidationContext'; +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so by default `maxErrors` set to 100 errors. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ +export declare function validate( + schema: GraphQLSchema, + documentAST: DocumentNode, + rules?: ReadonlyArray, + options?: { + maxErrors?: number; + }, + /** @deprecated will be removed in 17.0.0 */ + typeInfo?: TypeInfo, +): ReadonlyArray; +/** + * @internal + */ +export declare function validateSDL( + documentAST: DocumentNode, + schemaToExtend?: Maybe, + rules?: ReadonlyArray, +): ReadonlyArray; +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ +export declare function assertValidSDL(documentAST: DocumentNode): void; +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ +export declare function assertValidSDLExtension( + documentAST: DocumentNode, + schema: GraphQLSchema, +): void; diff --git a/graphql-subscription/node_modules/graphql/validation/validate.js b/graphql-subscription/node_modules/graphql/validation/validate.js new file mode 100644 index 0000000..5a2114d --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/validate.js @@ -0,0 +1,151 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.assertValidSDL = assertValidSDL; +exports.assertValidSDLExtension = assertValidSDLExtension; +exports.validate = validate; +exports.validateSDL = validateSDL; + +var _devAssert = require('../jsutils/devAssert.js'); + +var _GraphQLError = require('../error/GraphQLError.js'); + +var _visitor = require('../language/visitor.js'); + +var _validate = require('../type/validate.js'); + +var _TypeInfo = require('../utilities/TypeInfo.js'); + +var _specifiedRules = require('./specifiedRules.js'); + +var _ValidationContext = require('./ValidationContext.js'); + +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so by default `maxErrors` set to 100 errors. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ +function validate( + schema, + documentAST, + rules = _specifiedRules.specifiedRules, + options, + /** @deprecated will be removed in 17.0.0 */ + typeInfo = new _TypeInfo.TypeInfo(schema), +) { + var _options$maxErrors; + + const maxErrors = + (_options$maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors) !== + null && _options$maxErrors !== void 0 + ? _options$maxErrors + : 100; + documentAST || (0, _devAssert.devAssert)(false, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. + + (0, _validate.assertValidSchema)(schema); + const abortObj = Object.freeze({}); + const errors = []; + const context = new _ValidationContext.ValidationContext( + schema, + documentAST, + typeInfo, + (error) => { + if (errors.length >= maxErrors) { + errors.push( + new _GraphQLError.GraphQLError( + 'Too many validation errors, error limit reached. Validation aborted.', + ), + ); // eslint-disable-next-line @typescript-eslint/no-throw-literal + + throw abortObj; + } + + errors.push(error); + }, + ); // This uses a specialized visitor which runs multiple visitors in parallel, + // while maintaining the visitor skip and break API. + + const visitor = (0, _visitor.visitInParallel)( + rules.map((rule) => rule(context)), + ); // Visit the whole document with each instance of all provided rules. + + try { + (0, _visitor.visit)( + documentAST, + (0, _TypeInfo.visitWithTypeInfo)(typeInfo, visitor), + ); + } catch (e) { + if (e !== abortObj) { + throw e; + } + } + + return errors; +} +/** + * @internal + */ + +function validateSDL( + documentAST, + schemaToExtend, + rules = _specifiedRules.specifiedSDLRules, +) { + const errors = []; + const context = new _ValidationContext.SDLValidationContext( + documentAST, + schemaToExtend, + (error) => { + errors.push(error); + }, + ); + const visitors = rules.map((rule) => rule(context)); + (0, _visitor.visit)(documentAST, (0, _visitor.visitInParallel)(visitors)); + return errors; +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +function assertValidSDL(documentAST) { + const errors = validateSDL(documentAST); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +function assertValidSDLExtension(documentAST, schema) { + const errors = validateSDL(documentAST, schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} diff --git a/graphql-subscription/node_modules/graphql/validation/validate.mjs b/graphql-subscription/node_modules/graphql/validation/validate.mjs new file mode 100644 index 0000000..be5a3c2 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/validation/validate.mjs @@ -0,0 +1,133 @@ +import { devAssert } from '../jsutils/devAssert.mjs'; +import { GraphQLError } from '../error/GraphQLError.mjs'; +import { visit, visitInParallel } from '../language/visitor.mjs'; +import { assertValidSchema } from '../type/validate.mjs'; +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.mjs'; +import { specifiedRules, specifiedSDLRules } from './specifiedRules.mjs'; +import { + SDLValidationContext, + ValidationContext, +} from './ValidationContext.mjs'; +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so by default `maxErrors` set to 100 errors. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ + +export function validate( + schema, + documentAST, + rules = specifiedRules, + options, + /** @deprecated will be removed in 17.0.0 */ + typeInfo = new TypeInfo(schema), +) { + var _options$maxErrors; + + const maxErrors = + (_options$maxErrors = + options === null || options === void 0 ? void 0 : options.maxErrors) !== + null && _options$maxErrors !== void 0 + ? _options$maxErrors + : 100; + documentAST || devAssert(false, 'Must provide document.'); // If the schema used for validation is invalid, throw an error. + + assertValidSchema(schema); + const abortObj = Object.freeze({}); + const errors = []; + const context = new ValidationContext( + schema, + documentAST, + typeInfo, + (error) => { + if (errors.length >= maxErrors) { + errors.push( + new GraphQLError( + 'Too many validation errors, error limit reached. Validation aborted.', + ), + ); // eslint-disable-next-line @typescript-eslint/no-throw-literal + + throw abortObj; + } + + errors.push(error); + }, + ); // This uses a specialized visitor which runs multiple visitors in parallel, + // while maintaining the visitor skip and break API. + + const visitor = visitInParallel(rules.map((rule) => rule(context))); // Visit the whole document with each instance of all provided rules. + + try { + visit(documentAST, visitWithTypeInfo(typeInfo, visitor)); + } catch (e) { + if (e !== abortObj) { + throw e; + } + } + + return errors; +} +/** + * @internal + */ + +export function validateSDL( + documentAST, + schemaToExtend, + rules = specifiedSDLRules, +) { + const errors = []; + const context = new SDLValidationContext( + documentAST, + schemaToExtend, + (error) => { + errors.push(error); + }, + ); + const visitors = rules.map((rule) => rule(context)); + visit(documentAST, visitInParallel(visitors)); + return errors; +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +export function assertValidSDL(documentAST) { + const errors = validateSDL(documentAST); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ + +export function assertValidSDLExtension(documentAST, schema) { + const errors = validateSDL(documentAST, schema); + + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} diff --git a/graphql-subscription/node_modules/graphql/version.d.ts b/graphql-subscription/node_modules/graphql/version.d.ts new file mode 100644 index 0000000..c813fd3 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/version.d.ts @@ -0,0 +1,13 @@ +/** + * A string containing the version of the GraphQL.js library + */ +export declare const version: string; +/** + * An object containing the components of the GraphQL.js version string + */ +export declare const versionInfo: Readonly<{ + major: number; + minor: number; + patch: number; + preReleaseTag: string | null; +}>; diff --git a/graphql-subscription/node_modules/graphql/version.js b/graphql-subscription/node_modules/graphql/version.js new file mode 100644 index 0000000..b2ceb43 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/version.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true, +}); +exports.versionInfo = exports.version = void 0; +// Note: This file is autogenerated using "resources/gen-version.js" script and +// automatically updated by "npm version" command. + +/** + * A string containing the version of the GraphQL.js library + */ +const version = '16.8.1'; +/** + * An object containing the components of the GraphQL.js version string + */ + +exports.version = version; +const versionInfo = Object.freeze({ + major: 16, + minor: 8, + patch: 1, + preReleaseTag: null, +}); +exports.versionInfo = versionInfo; diff --git a/graphql-subscription/node_modules/graphql/version.mjs b/graphql-subscription/node_modules/graphql/version.mjs new file mode 100644 index 0000000..05aca30 --- /dev/null +++ b/graphql-subscription/node_modules/graphql/version.mjs @@ -0,0 +1,17 @@ +// Note: This file is autogenerated using "resources/gen-version.js" script and +// automatically updated by "npm version" command. + +/** + * A string containing the version of the GraphQL.js library + */ +export const version = '16.8.1'; +/** + * An object containing the components of the GraphQL.js version string + */ + +export const versionInfo = Object.freeze({ + major: 16, + minor: 8, + patch: 1, + preReleaseTag: null, +}); diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/CHANGELOG.md b/graphql-subscription/node_modules/hoist-non-react-statics/CHANGELOG.md new file mode 100644 index 0000000..59994b4 --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/CHANGELOG.md @@ -0,0 +1,37 @@ +# 3.3.2 (January 22, 2020) +- Fix `React.memo` for v16.12+ (#93) + +# 3.3.1 (November 14, 2019) +- Fix for UMD bundle (#85) +- Tooling changes (#83, #84, #87) + +# 3.3.0 (January 23, 2019) +- Prevent hoisting of React.memo statics (#73) + +# 3.2.1 (December 3, 2018) +- Fixed `defaultProps`, `displayName` and `propTypes` being hoisted from `React.forwardRef` to `React.forwardRef`. ([#71]) + +# 3.2.0 (November 26, 2018) +- Added support for `getDerivedStateFromError`. ([#68]) +- Added support for React versions less than 0.14. ([#69]) + +# 3.1.0 (October 30, 2018) +- Added support for `contextType`. ([#62]) +- Reduced bundle size. ([e89c7a6]) +- Removed TypeScript definitions. ([#61]) + +# 3.0.1 (July 28, 2018) +- Fixed prop-types warnings. ([e0846fe]) + +# 3.0.0 (July 27, 2018) +- Dropped support for React versions less than 0.14. ([#55]) +- Added support for `React.forwardRef` components. ([#55]) + +[#55]: https://github.com/mridgway/hoist-non-react-statics/pull/55 +[#61]: https://github.com/mridgway/hoist-non-react-statics/pull/61 +[#62]: https://github.com/mridgway/hoist-non-react-statics/pull/62 +[#68]: https://github.com/mridgway/hoist-non-react-statics/pull/68 +[#69]: https://github.com/mridgway/hoist-non-react-statics/pull/69 +[#71]: https://github.com/mridgway/hoist-non-react-statics/pull/71 +[e0846fe]: https://github.com/mridgway/hoist-non-react-statics/commit/e0846feefbad8b34d300de9966ffd607aacb81a3 +[e89c7a6]: https://github.com/mridgway/hoist-non-react-statics/commit/e89c7a6168edc19eeadb2d149e600b888e8b0446 diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/LICENSE.md b/graphql-subscription/node_modules/hoist-non-react-statics/LICENSE.md new file mode 100644 index 0000000..2464f59 --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/LICENSE.md @@ -0,0 +1,29 @@ +Software License Agreement (BSD License) +======================================== + +Copyright (c) 2015, Yahoo! Inc. All rights reserved. +---------------------------------------------------- + +Redistribution and use of this software in source and binary forms, with or +without modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Yahoo! Inc. nor the names of YUI's contributors may be + used to endorse or promote products derived from this software without + specific prior written permission of Yahoo! Inc. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/README.md b/graphql-subscription/node_modules/hoist-non-react-statics/README.md new file mode 100644 index 0000000..24ea688 --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/README.md @@ -0,0 +1,55 @@ +# hoist-non-react-statics + +[![NPM version](https://badge.fury.io/js/hoist-non-react-statics.svg)](http://badge.fury.io/js/hoist-non-react-statics) +[![Build Status](https://img.shields.io/travis/mridgway/hoist-non-react-statics.svg)](https://travis-ci.org/mridgway/hoist-non-react-statics) +[![Coverage Status](https://img.shields.io/coveralls/mridgway/hoist-non-react-statics.svg)](https://coveralls.io/r/mridgway/hoist-non-react-statics?branch=master) +[![Dependency Status](https://img.shields.io/david/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics) +[![devDependency Status](https://img.shields.io/david/dev/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics#info=devDependencies) + +Copies non-react specific statics from a child component to a parent component. +Similar to `Object.assign`, but with React static keywords blacklisted from +being overridden. + +```bash +$ npm install --save hoist-non-react-statics +``` + +## Usage + +```js +import hoistNonReactStatics from 'hoist-non-react-statics'; + +hoistNonReactStatics(targetComponent, sourceComponent); +``` + +If you have specific statics that you don't want to be hoisted, you can also pass a third parameter to exclude them: + +```js +hoistNonReactStatics(targetComponent, sourceComponent, { myStatic: true, myOtherStatic: true }); +``` + +## What does this module do? + +See this [explanation](https://facebook.github.io/react/docs/higher-order-components.html#static-methods-must-be-copied-over) from the React docs. + +## Compatible React Versions + +Please use latest 3.x. Versions prior to 3.x will not support ForwardRefs. + +| hoist-non-react-statics Version | Compatible React Version | +|--------------------------|-------------------------------| +| 3.x | 0.13-16.x With ForwardRef Support | +| 2.x | 0.13-16.x Without ForwardRef Support | +| 1.x | 0.13-16.2 | + +## Browser Support + +This package uses `Object.defineProperty` which has a broken implementation in IE8. In order to use this package in IE8, you will need a polyfill that fixes this method. + +## License +This software is free to use under the Yahoo Inc. BSD license. +See the [LICENSE file][] for license text and copyright information. + +[LICENSE file]: https://github.com/mridgway/hoist-non-react-statics/blob/master/LICENSE.md + +Third-party open source code used are listed in our [package.json file]( https://github.com/mridgway/hoist-non-react-statics/blob/master/package.json). diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js b/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js new file mode 100644 index 0000000..60f9c4b --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js @@ -0,0 +1,103 @@ +'use strict'; + +var reactIs = require('react-is'); + +/** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ +var REACT_STATICS = { + childContextTypes: true, + contextType: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromError: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; +var FORWARD_REF_STATICS = { + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true +}; +var MEMO_STATICS = { + '$$typeof': true, + compare: true, + defaultProps: true, + displayName: true, + propTypes: true, + type: true +}; +var TYPE_STATICS = {}; +TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; +TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; + +function getStatics(component) { + // React v16.11 and below + if (reactIs.isMemo(component)) { + return MEMO_STATICS; + } // React v16.12 and above + + + return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; +} + +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = Object.prototype; +function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + var targetStatics = getStatics(targetComponent); + var sourceStatics = getStatics(sourceComponent); + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + + if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + + try { + // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + } + + return targetComponent; +} + +module.exports = hoistNonReactStatics; diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.js b/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.js new file mode 100644 index 0000000..c6d59c7 --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.js @@ -0,0 +1,449 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.hoistNonReactStatics = factory()); +}(this, (function () { 'use strict'; + + function unwrapExports (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var reactIs_production_min = createCommonjsModule(function (module, exports) { + Object.defineProperty(exports,"__esModule",{value:!0}); + var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.suspense_list"): + 60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.fundamental"):60117,w=b?Symbol.for("react.responder"):60118,x=b?Symbol.for("react.scope"):60119;function y(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function z(a){return y(a)===m} + exports.typeOf=y;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p; + exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===v||a.$$typeof===w||a.$$typeof===x)};exports.isAsyncMode=function(a){return z(a)||y(a)===l};exports.isConcurrentMode=z;exports.isContextConsumer=function(a){return y(a)===k};exports.isContextProvider=function(a){return y(a)===h}; + exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return y(a)===n};exports.isFragment=function(a){return y(a)===e};exports.isLazy=function(a){return y(a)===t};exports.isMemo=function(a){return y(a)===r};exports.isPortal=function(a){return y(a)===d};exports.isProfiler=function(a){return y(a)===g};exports.isStrictMode=function(a){return y(a)===f};exports.isSuspense=function(a){return y(a)===p}; + }); + + unwrapExports(reactIs_production_min); + var reactIs_production_min_1 = reactIs_production_min.typeOf; + var reactIs_production_min_2 = reactIs_production_min.AsyncMode; + var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode; + var reactIs_production_min_4 = reactIs_production_min.ContextConsumer; + var reactIs_production_min_5 = reactIs_production_min.ContextProvider; + var reactIs_production_min_6 = reactIs_production_min.Element; + var reactIs_production_min_7 = reactIs_production_min.ForwardRef; + var reactIs_production_min_8 = reactIs_production_min.Fragment; + var reactIs_production_min_9 = reactIs_production_min.Lazy; + var reactIs_production_min_10 = reactIs_production_min.Memo; + var reactIs_production_min_11 = reactIs_production_min.Portal; + var reactIs_production_min_12 = reactIs_production_min.Profiler; + var reactIs_production_min_13 = reactIs_production_min.StrictMode; + var reactIs_production_min_14 = reactIs_production_min.Suspense; + var reactIs_production_min_15 = reactIs_production_min.isValidElementType; + var reactIs_production_min_16 = reactIs_production_min.isAsyncMode; + var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode; + var reactIs_production_min_18 = reactIs_production_min.isContextConsumer; + var reactIs_production_min_19 = reactIs_production_min.isContextProvider; + var reactIs_production_min_20 = reactIs_production_min.isElement; + var reactIs_production_min_21 = reactIs_production_min.isForwardRef; + var reactIs_production_min_22 = reactIs_production_min.isFragment; + var reactIs_production_min_23 = reactIs_production_min.isLazy; + var reactIs_production_min_24 = reactIs_production_min.isMemo; + var reactIs_production_min_25 = reactIs_production_min.isPortal; + var reactIs_production_min_26 = reactIs_production_min.isProfiler; + var reactIs_production_min_27 = reactIs_production_min.isStrictMode; + var reactIs_production_min_28 = reactIs_production_min.isSuspense; + + var reactIs_development = createCommonjsModule(function (module, exports) { + + + + if (process.env.NODE_ENV !== "production") { + (function() { + + Object.defineProperty(exports, '__esModule', { value: true }); + + // The Symbol used to tag the ReactElement-like types. If there is no native Symbol + // nor polyfill, then a plain number is used for performance. + var hasSymbol = typeof Symbol === 'function' && Symbol.for; + var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; + var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; + var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; + var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; + var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; + var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; + var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary + // (unstable) APIs that have been removed. Can we remove the symbols? + + var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; + var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; + var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; + var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; + var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; + var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; + var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; + var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; + var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; + var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + + function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE); + } + + /** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + var lowPriorityWarningWithoutStack = function () {}; + + { + var printWarning = function (format) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + + if (typeof console !== 'undefined') { + console.warn(message); + } + + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + lowPriorityWarningWithoutStack = function (condition, format) { + if (format === undefined) { + throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument'); + } + + if (!condition) { + for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(void 0, [format].concat(args)); + } + }; + } + + var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack; + + function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; + } // AsyncMode is deprecated along with isAsyncMode + + var AsyncMode = REACT_ASYNC_MODE_TYPE; + var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; + var ContextConsumer = REACT_CONTEXT_TYPE; + var ContextProvider = REACT_PROVIDER_TYPE; + var Element = REACT_ELEMENT_TYPE; + var ForwardRef = REACT_FORWARD_REF_TYPE; + var Fragment = REACT_FRAGMENT_TYPE; + var Lazy = REACT_LAZY_TYPE; + var Memo = REACT_MEMO_TYPE; + var Portal = REACT_PORTAL_TYPE; + var Profiler = REACT_PROFILER_TYPE; + var StrictMode = REACT_STRICT_MODE_TYPE; + var Suspense = REACT_SUSPENSE_TYPE; + var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + + function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; + lowPriorityWarningWithoutStack$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; + } + function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; + } + function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; + } + function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; + } + function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; + } + function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; + } + function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; + } + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; + } + function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; + } + function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; + } + function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; + } + + exports.typeOf = typeOf; + exports.AsyncMode = AsyncMode; + exports.ConcurrentMode = ConcurrentMode; + exports.ContextConsumer = ContextConsumer; + exports.ContextProvider = ContextProvider; + exports.Element = Element; + exports.ForwardRef = ForwardRef; + exports.Fragment = Fragment; + exports.Lazy = Lazy; + exports.Memo = Memo; + exports.Portal = Portal; + exports.Profiler = Profiler; + exports.StrictMode = StrictMode; + exports.Suspense = Suspense; + exports.isValidElementType = isValidElementType; + exports.isAsyncMode = isAsyncMode; + exports.isConcurrentMode = isConcurrentMode; + exports.isContextConsumer = isContextConsumer; + exports.isContextProvider = isContextProvider; + exports.isElement = isElement; + exports.isForwardRef = isForwardRef; + exports.isFragment = isFragment; + exports.isLazy = isLazy; + exports.isMemo = isMemo; + exports.isPortal = isPortal; + exports.isProfiler = isProfiler; + exports.isStrictMode = isStrictMode; + exports.isSuspense = isSuspense; + })(); + } + }); + + unwrapExports(reactIs_development); + var reactIs_development_1 = reactIs_development.typeOf; + var reactIs_development_2 = reactIs_development.AsyncMode; + var reactIs_development_3 = reactIs_development.ConcurrentMode; + var reactIs_development_4 = reactIs_development.ContextConsumer; + var reactIs_development_5 = reactIs_development.ContextProvider; + var reactIs_development_6 = reactIs_development.Element; + var reactIs_development_7 = reactIs_development.ForwardRef; + var reactIs_development_8 = reactIs_development.Fragment; + var reactIs_development_9 = reactIs_development.Lazy; + var reactIs_development_10 = reactIs_development.Memo; + var reactIs_development_11 = reactIs_development.Portal; + var reactIs_development_12 = reactIs_development.Profiler; + var reactIs_development_13 = reactIs_development.StrictMode; + var reactIs_development_14 = reactIs_development.Suspense; + var reactIs_development_15 = reactIs_development.isValidElementType; + var reactIs_development_16 = reactIs_development.isAsyncMode; + var reactIs_development_17 = reactIs_development.isConcurrentMode; + var reactIs_development_18 = reactIs_development.isContextConsumer; + var reactIs_development_19 = reactIs_development.isContextProvider; + var reactIs_development_20 = reactIs_development.isElement; + var reactIs_development_21 = reactIs_development.isForwardRef; + var reactIs_development_22 = reactIs_development.isFragment; + var reactIs_development_23 = reactIs_development.isLazy; + var reactIs_development_24 = reactIs_development.isMemo; + var reactIs_development_25 = reactIs_development.isPortal; + var reactIs_development_26 = reactIs_development.isProfiler; + var reactIs_development_27 = reactIs_development.isStrictMode; + var reactIs_development_28 = reactIs_development.isSuspense; + + var reactIs = createCommonjsModule(function (module) { + + if (process.env.NODE_ENV === 'production') { + module.exports = reactIs_production_min; + } else { + module.exports = reactIs_development; + } + }); + var reactIs_1 = reactIs.typeOf; + var reactIs_2 = reactIs.AsyncMode; + var reactIs_3 = reactIs.ConcurrentMode; + var reactIs_4 = reactIs.ContextConsumer; + var reactIs_5 = reactIs.ContextProvider; + var reactIs_6 = reactIs.Element; + var reactIs_7 = reactIs.ForwardRef; + var reactIs_8 = reactIs.Fragment; + var reactIs_9 = reactIs.Lazy; + var reactIs_10 = reactIs.Memo; + var reactIs_11 = reactIs.Portal; + var reactIs_12 = reactIs.Profiler; + var reactIs_13 = reactIs.StrictMode; + var reactIs_14 = reactIs.Suspense; + var reactIs_15 = reactIs.isValidElementType; + var reactIs_16 = reactIs.isAsyncMode; + var reactIs_17 = reactIs.isConcurrentMode; + var reactIs_18 = reactIs.isContextConsumer; + var reactIs_19 = reactIs.isContextProvider; + var reactIs_20 = reactIs.isElement; + var reactIs_21 = reactIs.isForwardRef; + var reactIs_22 = reactIs.isFragment; + var reactIs_23 = reactIs.isLazy; + var reactIs_24 = reactIs.isMemo; + var reactIs_25 = reactIs.isPortal; + var reactIs_26 = reactIs.isProfiler; + var reactIs_27 = reactIs.isStrictMode; + var reactIs_28 = reactIs.isSuspense; + + /** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ + var REACT_STATICS = { + childContextTypes: true, + contextType: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromError: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true + }; + var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true + }; + var FORWARD_REF_STATICS = { + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true + }; + var MEMO_STATICS = { + '$$typeof': true, + compare: true, + defaultProps: true, + displayName: true, + propTypes: true, + type: true + }; + var TYPE_STATICS = {}; + TYPE_STATICS[reactIs_7] = FORWARD_REF_STATICS; + TYPE_STATICS[reactIs_10] = MEMO_STATICS; + + function getStatics(component) { + // React v16.11 and below + if (reactIs_24(component)) { + return MEMO_STATICS; + } // React v16.12 and above + + + return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; + } + + var defineProperty = Object.defineProperty; + var getOwnPropertyNames = Object.getOwnPropertyNames; + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var getPrototypeOf = Object.getPrototypeOf; + var objectPrototype = Object.prototype; + function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + var targetStatics = getStatics(targetComponent); + var sourceStatics = getStatics(sourceComponent); + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + + if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + + try { + // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + } + + return targetComponent; + } + + return hoistNonReactStatics; + +}))); diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.min.js b/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.min.js new file mode 100644 index 0000000..2883e24 --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).hoistNonReactStatics=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e,t){return e(t={exports:{}},t.exports),t.exports}var r=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,n=r?Symbol.for("react.portal"):60106,c=r?Symbol.for("react.fragment"):60107,a=r?Symbol.for("react.strict_mode"):60108,f=r?Symbol.for("react.profiler"):60114,s=r?Symbol.for("react.provider"):60109,i=r?Symbol.for("react.context"):60110,u=r?Symbol.for("react.async_mode"):60111,y=r?Symbol.for("react.concurrent_mode"):60111,l=r?Symbol.for("react.forward_ref"):60112,p=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.suspense_list"):60120,d=r?Symbol.for("react.memo"):60115,b=r?Symbol.for("react.lazy"):60116,S=r?Symbol.for("react.fundamental"):60117,$=r?Symbol.for("react.responder"):60118,v=r?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case u:case y:case c:case f:case a:case p:return e;default:switch(e=e&&e.$$typeof){case i:case l:case b:case d:case s:return e;default:return t}}case n:return t}}}function P(e){return g(e)===y}t.typeOf=g,t.AsyncMode=u,t.ConcurrentMode=y,t.ContextConsumer=i,t.ContextProvider=s,t.Element=o,t.ForwardRef=l,t.Fragment=c,t.Lazy=b,t.Memo=d,t.Portal=n,t.Profiler=f,t.StrictMode=a,t.Suspense=p,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===c||e===y||e===f||e===a||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===d||e.$$typeof===s||e.$$typeof===i||e.$$typeof===l||e.$$typeof===S||e.$$typeof===$||e.$$typeof===v)},t.isAsyncMode=function(e){return P(e)||g(e)===u},t.isConcurrentMode=P,t.isContextConsumer=function(e){return g(e)===i},t.isContextProvider=function(e){return g(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return g(e)===l},t.isFragment=function(e){return g(e)===c},t.isLazy=function(e){return g(e)===b},t.isMemo=function(e){return g(e)===d},t.isPortal=function(e){return g(e)===n},t.isProfiler=function(e){return g(e)===f},t.isStrictMode=function(e){return g(e)===a},t.isSuspense=function(e){return g(e)===p}}));e(r);var o=t((function(e,t){"production"!==process.env.NODE_ENV&&function(){Object.defineProperty(t,"__esModule",{value:!0});var e="function"==typeof Symbol&&Symbol.for,r=e?Symbol.for("react.element"):60103,o=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,c=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,f=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,i=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,y=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,d=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.fundamental"):60117,S=e?Symbol.for("react.responder"):60118,$=e?Symbol.for("react.scope"):60119;var v=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;t>o;o++)r[o-1]=arguments[o];var n=0,c="Warning: "+e.replace(/%s/g,(function(){return r[n++]}));void 0!==console&&console.warn(c);try{throw Error(c)}catch(e){}},g=function(e,t){if(void 0===t)throw Error("`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning message argument");if(!e){for(var r=arguments.length,o=Array(r>2?r-2:0),n=2;r>n;n++)o[n-2]=arguments[n];v.apply(void 0,[t].concat(o))}};function P(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:var p=e.type;switch(p){case i:case u:case n:case a:case c:case l:return p;default:var b=p&&p.$$typeof;switch(b){case s:case y:case d:case m:case f:return b;default:return t}}case o:return t}}}var h=i,w=u,M=s,x=f,C=r,O=y,_=n,j=d,E=m,F=o,N=a,R=c,T=l,A=!1;function z(e){return P(e)===u}t.typeOf=P,t.AsyncMode=h,t.ConcurrentMode=w,t.ContextConsumer=M,t.ContextProvider=x,t.Element=C,t.ForwardRef=O,t.Fragment=_,t.Lazy=j,t.Memo=E,t.Portal=F,t.Profiler=N,t.StrictMode=R,t.Suspense=T,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===u||e===a||e===c||e===l||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===m||e.$$typeof===f||e.$$typeof===s||e.$$typeof===y||e.$$typeof===b||e.$$typeof===S||e.$$typeof===$)},t.isAsyncMode=function(e){return A||(A=!0,g(!1,"The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),z(e)||P(e)===i},t.isConcurrentMode=z,t.isContextConsumer=function(e){return P(e)===s},t.isContextProvider=function(e){return P(e)===f},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return P(e)===y},t.isFragment=function(e){return P(e)===n},t.isLazy=function(e){return P(e)===d},t.isMemo=function(e){return P(e)===m},t.isPortal=function(e){return P(e)===o},t.isProfiler=function(e){return P(e)===a},t.isStrictMode=function(e){return P(e)===c},t.isSuspense=function(e){return P(e)===l}}()}));e(o);var n=t((function(e){e.exports="production"===process.env.NODE_ENV?r:o})),c=n.Memo,a=n.isMemo,f={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},s={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},u={};function y(e){return a(e)?i:u[e.$$typeof]||f}u[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},u[c]=i;var l=Object.defineProperty,p=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,b=Object.getPrototypeOf,S=Object.prototype;return function e(t,r,o){if("string"!=typeof r){if(S){var n=b(r);n&&n!==S&&e(t,n,o)}var c=p(r);m&&(c=c.concat(m(r)));for(var a=y(t),f=y(r),i=0;c.length>i;++i){var u=c[i];if(!(s[u]||o&&o[u]||f&&f[u]||a&&a[u])){var $=d(r,u);try{l(t,u,$)}catch(e){}}}}return t}})); diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/package.json b/graphql-subscription/node_modules/hoist-non-react-statics/package.json new file mode 100644 index 0000000..f5ec09d --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/package.json @@ -0,0 +1,55 @@ +{ + "name": "hoist-non-react-statics", + "version": "3.3.2", + "description": "Copies non-react specific statics from a child component to a parent component", + "main": "dist/hoist-non-react-statics.cjs.js", + "repository": { + "type": "git", + "url": "git://github.com/mridgway/hoist-non-react-statics.git" + }, + "files": [ + "src", + "dist", + "index.d.ts" + ], + "scripts": { + "lint": "eslint src", + "build": "rimraf dist && rollup -c", + "test": "nyc mocha tests/unit/ --recursive --reporter spec --require=@babel/register", + "coverage": "nyc report --reporter=text-lcov | coveralls", + "prepublish": "npm test" + }, + "author": "Michael Ridgway ", + "license": "BSD-3-Clause", + "dependencies": { + "react-is": "^16.7.0" + }, + "devDependencies": { + "@babel/core": "^7.5.0", + "@babel/plugin-proposal-class-properties": "^7.5.0", + "@babel/preset-env": "^7.5.0", + "@babel/preset-react": "^7.0.0", + "@babel/register": "^7.4.4", + "chai": "^4.2.0", + "coveralls": "^2.11.1", + "create-react-class": "^15.5.3", + "eslint": "^4.13.1", + "mocha": "^6.1.4", + "nyc": "^14.1.1", + "pre-commit": "^1.0.7", + "prop-types": "^15.6.2", + "react": "^16.7.0", + "rimraf": "^2.6.2", + "rollup": "^1.16.6", + "rollup-plugin-babel": "^4.3.3", + "rollup-plugin-commonjs": "^10.0.1", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^5.1.1" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "keywords": [ + "react" + ] +} diff --git a/graphql-subscription/node_modules/hoist-non-react-statics/src/index.js b/graphql-subscription/node_modules/hoist-non-react-statics/src/index.js new file mode 100644 index 0000000..40b764b --- /dev/null +++ b/graphql-subscription/node_modules/hoist-non-react-statics/src/index.js @@ -0,0 +1,104 @@ +/** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ +import { ForwardRef, Memo, isMemo } from 'react-is'; + +const REACT_STATICS = { + childContextTypes: true, + contextType: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromError: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; + +const KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; + +const FORWARD_REF_STATICS = { + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true +}; + +const MEMO_STATICS = { + '$$typeof': true, + compare: true, + defaultProps: true, + displayName: true, + propTypes: true, + type: true, +} + +const TYPE_STATICS = {}; +TYPE_STATICS[ForwardRef] = FORWARD_REF_STATICS; +TYPE_STATICS[Memo] = MEMO_STATICS; + +function getStatics(component) { + // React v16.11 and below + if (isMemo(component)) { + return MEMO_STATICS; + } + + // React v16.12 and above + return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; +} + +const defineProperty = Object.defineProperty; +const getOwnPropertyNames = Object.getOwnPropertyNames; +const getOwnPropertySymbols = Object.getOwnPropertySymbols; +const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +const getPrototypeOf = Object.getPrototypeOf; +const objectPrototype = Object.prototype; + +export default function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components + + if (objectPrototype) { + const inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + let keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + const targetStatics = getStatics(targetComponent); + const sourceStatics = getStatics(sourceComponent); + + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (!KNOWN_STATICS[key] && + !(blacklist && blacklist[key]) && + !(sourceStatics && sourceStatics[key]) && + !(targetStatics && targetStatics[key]) + ) { + const descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + } + + return targetComponent; +}; diff --git a/graphql-subscription/node_modules/js-tokens/CHANGELOG.md b/graphql-subscription/node_modules/js-tokens/CHANGELOG.md new file mode 100644 index 0000000..755e6f6 --- /dev/null +++ b/graphql-subscription/node_modules/js-tokens/CHANGELOG.md @@ -0,0 +1,151 @@ +### Version 4.0.0 (2018-01-28) ### + +- Added: Support for ES2018. The only change needed was recognizing the `s` + regex flag. +- Changed: _All_ tokens returned by the `matchToToken` function now have a + `closed` property. It is set to `undefined` for the tokens where “closed” + doesn’t make sense. This means that all tokens objects have the same shape, + which might improve performance. + +These are the breaking changes: + +- `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but + `['/a/s']`. (There are of course other variations of this.) +- Code that rely on some token objects not having the `closed` property could + now behave differently. + + +### Version 3.0.2 (2017-06-28) ### + +- No code changes. Just updates to the readme. + + +### Version 3.0.1 (2017-01-30) ### + +- Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched + correctly. + + +### Version 3.0.0 (2017-01-11) ### + +This release contains one breaking change, that should [improve performance in +V8][v8-perf]: + +> So how can you, as a JavaScript developer, ensure that your RegExps are fast? +> If you are not interested in hooking into RegExp internals, make sure that +> neither the RegExp instance, nor its prototype is modified in order to get the +> best performance: +> +> ```js +> var re = /./g; +> re.exec(''); // Fast path. +> re.new_property = 'slow'; +> ``` + +This module used to export a single regex, with `.matchToToken` bolted +on, just like in the above example. This release changes the exports of +the module to avoid this issue. + +Before: + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens") +var matchToToken = jsTokens.matchToToken +``` + +After: + +```js +import jsTokens, {matchToToken} from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +var matchToToken = require("js-tokens").matchToToken +``` + +[v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html + + +### Version 2.0.0 (2016-06-19) ### + +- Added: Support for ES2016. In other words, support for the `**` exponentiation + operator. + +These are the breaking changes: + +- `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`. +- `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`. + + +### Version 1.0.3 (2016-03-27) ### + +- Improved: Made the regex ever so slightly smaller. +- Updated: The readme. + + +### Version 1.0.2 (2015-10-18) ### + +- Improved: Limited npm package contents for a smaller download. Thanks to + @zertosh! + + +### Version 1.0.1 (2015-06-20) ### + +- Fixed: Declared an undeclared variable. + + +### Version 1.0.0 (2015-02-26) ### + +- Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That + type is now equivalent to the Punctuator token in the ECMAScript + specification. (Backwards-incompatible change.) +- Fixed: A `-` followed by a number is now correctly matched as a punctuator + followed by a number. It used to be matched as just a number, but there is no + such thing as negative number literals. (Possibly backwards-incompatible + change.) + + +### Version 0.4.1 (2015-02-21) ### + +- Added: Support for the regex `u` flag. + + +### Version 0.4.0 (2015-02-21) ### + +- Improved: `jsTokens.matchToToken` performance. +- Added: Support for octal and binary number literals. +- Added: Support for template strings. + + +### Version 0.3.1 (2015-01-06) ### + +- Fixed: Support for unicode spaces. They used to be allowed in names (which is + very confusing), and some unicode newlines were wrongly allowed in strings and + regexes. + + +### Version 0.3.0 (2014-12-19) ### + +- Changed: The `jsTokens.names` array has been replaced with the + `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no + longer part of the public API; instead use said function. See this [gist] for + an example. (Backwards-incompatible change.) +- Changed: The empty string is now considered an “invalid” token, instead an + “empty” token (its own group). (Backwards-incompatible change.) +- Removed: component support. (Backwards-incompatible change.) + +[gist]: https://gist.github.com/lydell/be49dbf80c382c473004 + + +### Version 0.2.0 (2014-06-19) ### + +- Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own + category (“functionArrow”), for simplicity. (Backwards-incompatible change.) +- Added: ES6 splats (`...`) are now matched as an operator (instead of three + punctuations). (Backwards-incompatible change.) + + +### Version 0.1.0 (2014-03-08) ### + +- Initial release. diff --git a/graphql-subscription/node_modules/js-tokens/LICENSE b/graphql-subscription/node_modules/js-tokens/LICENSE new file mode 100644 index 0000000..54aef52 --- /dev/null +++ b/graphql-subscription/node_modules/js-tokens/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription/node_modules/js-tokens/README.md b/graphql-subscription/node_modules/js-tokens/README.md new file mode 100644 index 0000000..00cdf16 --- /dev/null +++ b/graphql-subscription/node_modules/js-tokens/README.md @@ -0,0 +1,240 @@ +Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.svg?branch=master)](https://travis-ci.org/lydell/js-tokens) +======== + +A regex that tokenizes JavaScript. + +```js +var jsTokens = require("js-tokens").default + +var jsString = "var foo=opts.foo;\n..." + +jsString.match(jsTokens) +// ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...] +``` + + +Installation +============ + +`npm install js-tokens` + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +``` + + +Usage +===== + +### `jsTokens` ### + +A regex with the `g` flag that matches JavaScript tokens. + +The regex _always_ matches, even invalid JavaScript and the empty string. + +The next match is always directly after the previous. + +### `var token = matchToToken(match)` ### + +```js +import {matchToToken} from "js-tokens" +// or: +var matchToToken = require("js-tokens").matchToToken +``` + +Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type: +String, value: String}` object. The following types are available: + +- string +- comment +- regex +- number +- name +- punctuator +- whitespace +- invalid + +Multi-line comments and strings also have a `closed` property indicating if the +token was closed or not (see below). + +Comments and strings both come in several flavors. To distinguish them, check if +the token starts with `//`, `/*`, `'`, `"` or `` ` ``. + +Names are ECMAScript IdentifierNames, that is, including both identifiers and +keywords. You may use [is-keyword-js] to tell them apart. + +Whitespace includes both line terminators and other whitespace. + +[is-keyword-js]: https://github.com/crissdev/is-keyword-js + + +ECMAScript support +================== + +The intention is to always support the latest ECMAScript version whose feature +set has been finalized. + +If adding support for a newer version requires changes, a new version with a +major verion bump will be released. + +Currently, ECMAScript 2018 is supported. + + +Invalid code handling +===================== + +Unterminated strings are still matched as strings. JavaScript strings cannot +contain (unescaped) newlines, so unterminated strings simply end at the end of +the line. Unterminated template strings can contain unescaped newlines, though, +so they go on to the end of input. + +Unterminated multi-line comments are also still matched as comments. They +simply go on to the end of the input. + +Unterminated regex literals are likely matched as division and whatever is +inside the regex. + +Invalid ASCII characters have their own capturing group. + +Invalid non-ASCII characters are treated as names, to simplify the matching of +names (except unicode spaces which are treated as whitespace). Note: See also +the [ES2018](#es2018) section. + +Regex literals may contain invalid regex syntax. They are still matched as +regex literals. They may also contain repeated regex flags, to keep the regex +simple. + +Strings may contain invalid escape sequences. + + +Limitations +=========== + +Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be +perfect. But that’s not the point either. + +You may compare jsTokens with [esprima] by using `esprima-compare.js`. +See `npm run esprima-compare`! + +[esprima]: http://esprima.org/ + +### Template string interpolation ### + +Template strings are matched as single tokens, from the starting `` ` `` to the +ending `` ` ``, including interpolations (whose tokens are not matched +individually). + +Matching template string interpolations requires recursive balancing of `{` and +`}`—something that JavaScript regexes cannot do. Only one level of nesting is +supported. + +### Division and regex literals collision ### + +Consider this example: + +```js +var g = 9.82 +var number = bar / 2/g + +var regex = / 2/g +``` + +A human can easily understand that in the `number` line we’re dealing with +division, and in the `regex` line we’re dealing with a regex literal. How come? +Because humans can look at the whole code to put the `/` characters in context. +A JavaScript regex cannot. It only sees forwards. (Well, ES2018 regexes can also +look backwards. See the [ES2018](#es2018) section). + +When the `jsTokens` regex scans throught the above, it will see the following +at the end of both the `number` and `regex` rows: + +```js +/ 2/g +``` + +It is then impossible to know if that is a regex literal, or part of an +expression dealing with division. + +Here is a similar case: + +```js +foo /= 2/g +foo(/= 2/g) +``` + +The first line divides the `foo` variable with `2/g`. The second line calls the +`foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only +sees forwards, it cannot tell the two cases apart. + +There are some cases where we _can_ tell division and regex literals apart, +though. + +First off, we have the simple cases where there’s only one slash in the line: + +```js +var foo = 2/g +foo /= 2 +``` + +Regex literals cannot contain newlines, so the above cases are correctly +identified as division. Things are only problematic when there are more than +one non-comment slash in a single line. + +Secondly, not every character is a valid regex flag. + +```js +var number = bar / 2/e +``` + +The above example is also correctly identified as division, because `e` is not a +valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*` +(any letter) as flags, but it is not worth it since it increases the amount of +ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are +allowed. This means that the above example will be identified as division as +long as you don’t rename the `e` variable to some permutation of `gmiyus` 1 to 6 +characters long. + +Lastly, we can look _forward_ for information. + +- If the token following what looks like a regex literal is not valid after a + regex literal, but is valid in a division expression, then the regex literal + is treated as division instead. For example, a flagless regex cannot be + followed by a string, number or name, but all of those three can be the + denominator of a division. +- Generally, if what looks like a regex literal is followed by an operator, the + regex literal is treated as division instead. This is because regexes are + seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division + could likely be part of such an expression. + +Please consult the regex source and the test cases for precise information on +when regex or division is matched (should you need to know). In short, you +could sum it up as: + +If the end of a statement looks like a regex literal (even if it isn’t), it +will be treated as one. Otherwise it should work as expected (if you write sane +code). + +### ES2018 ### + +ES2018 added some nice regex improvements to the language. + +- [Unicode property escapes] should allow telling names and invalid non-ASCII + characters apart without blowing up the regex size. +- [Lookbehind assertions] should allow matching telling division and regex + literals apart in more cases. +- [Named capture groups] might simplify some things. + +These things would be nice to do, but are not critical. They probably have to +wait until the oldest maintained Node.js LTS release supports those features. + +[Unicode property escapes]: http://2ality.com/2017/07/regexp-unicode-property-escapes.html +[Lookbehind assertions]: http://2ality.com/2017/05/regexp-lookbehind-assertions.html +[Named capture groups]: http://2ality.com/2017/05/regexp-named-capture-groups.html + + +License +======= + +[MIT](LICENSE). diff --git a/graphql-subscription/node_modules/js-tokens/index.js b/graphql-subscription/node_modules/js-tokens/index.js new file mode 100644 index 0000000..b23a4a0 --- /dev/null +++ b/graphql-subscription/node_modules/js-tokens/index.js @@ -0,0 +1,23 @@ +// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell +// License: MIT. (See LICENSE.) + +Object.defineProperty(exports, "__esModule", { + value: true +}) + +// This regex comes from regex.coffee, and is inserted here by generate-index.js +// (run `npm run build`). +exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g + +exports.matchToToken = function(match) { + var token = {type: "invalid", value: match[0], closed: undefined} + if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) + else if (match[ 5]) token.type = "comment" + else if (match[ 6]) token.type = "comment", token.closed = !!match[7] + else if (match[ 8]) token.type = "regex" + else if (match[ 9]) token.type = "number" + else if (match[10]) token.type = "name" + else if (match[11]) token.type = "punctuator" + else if (match[12]) token.type = "whitespace" + return token +} diff --git a/graphql-subscription/node_modules/js-tokens/package.json b/graphql-subscription/node_modules/js-tokens/package.json new file mode 100644 index 0000000..66752fa --- /dev/null +++ b/graphql-subscription/node_modules/js-tokens/package.json @@ -0,0 +1,30 @@ +{ + "name": "js-tokens", + "version": "4.0.0", + "author": "Simon Lydell", + "license": "MIT", + "description": "A regex that tokenizes JavaScript.", + "keywords": [ + "JavaScript", + "js", + "token", + "tokenize", + "regex" + ], + "files": [ + "index.js" + ], + "repository": "lydell/js-tokens", + "scripts": { + "test": "mocha --ui tdd", + "esprima-compare": "node esprima-compare ./index.js everything.js/es5.js", + "build": "node generate-index.js", + "dev": "npm run build && npm test" + }, + "devDependencies": { + "coffeescript": "2.1.1", + "esprima": "4.0.0", + "everything.js": "1.0.3", + "mocha": "5.0.0" + } +} diff --git a/graphql-subscription/node_modules/loose-envify/LICENSE b/graphql-subscription/node_modules/loose-envify/LICENSE new file mode 100644 index 0000000..fbafb48 --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Andres Suarez + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription/node_modules/loose-envify/README.md b/graphql-subscription/node_modules/loose-envify/README.md new file mode 100644 index 0000000..7f4e07b --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/README.md @@ -0,0 +1,45 @@ +# loose-envify + +[![Build Status](https://travis-ci.org/zertosh/loose-envify.svg?branch=master)](https://travis-ci.org/zertosh/loose-envify) + +Fast (and loose) selective `process.env` replacer using [js-tokens](https://github.com/lydell/js-tokens) instead of an AST. Works just like [envify](https://github.com/hughsk/envify) but much faster. + +## Gotchas + +* Doesn't handle broken syntax. +* Doesn't look inside embedded expressions in template strings. + - **this won't work:** + ```js + console.log(`the current env is ${process.env.NODE_ENV}`); + ``` +* Doesn't replace oddly-spaced or oddly-commented expressions. + - **this won't work:** + ```js + console.log(process./*won't*/env./*work*/NODE_ENV); + ``` + +## Usage/Options + +loose-envify has the exact same interface as [envify](https://github.com/hughsk/envify), including the CLI. + +## Benchmark + +``` +envify: + + $ for i in {1..5}; do node bench/bench.js 'envify'; done + 708ms + 727ms + 791ms + 719ms + 720ms + +loose-envify: + + $ for i in {1..5}; do node bench/bench.js '../'; done + 51ms + 52ms + 52ms + 52ms + 52ms +``` diff --git a/graphql-subscription/node_modules/loose-envify/cli.js b/graphql-subscription/node_modules/loose-envify/cli.js new file mode 100755 index 0000000..c0b63cb --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/cli.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +'use strict'; + +var looseEnvify = require('./'); +var fs = require('fs'); + +if (process.argv[2]) { + fs.createReadStream(process.argv[2], {encoding: 'utf8'}) + .pipe(looseEnvify(process.argv[2])) + .pipe(process.stdout); +} else { + process.stdin.resume() + process.stdin + .pipe(looseEnvify(__filename)) + .pipe(process.stdout); +} diff --git a/graphql-subscription/node_modules/loose-envify/custom.js b/graphql-subscription/node_modules/loose-envify/custom.js new file mode 100644 index 0000000..6389bfa --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/custom.js @@ -0,0 +1,4 @@ +// envify compatibility +'use strict'; + +module.exports = require('./loose-envify'); diff --git a/graphql-subscription/node_modules/loose-envify/index.js b/graphql-subscription/node_modules/loose-envify/index.js new file mode 100644 index 0000000..8cd8305 --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./loose-envify')(process.env); diff --git a/graphql-subscription/node_modules/loose-envify/loose-envify.js b/graphql-subscription/node_modules/loose-envify/loose-envify.js new file mode 100644 index 0000000..b5a5be2 --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/loose-envify.js @@ -0,0 +1,36 @@ +'use strict'; + +var stream = require('stream'); +var util = require('util'); +var replace = require('./replace'); + +var jsonExtRe = /\.json$/; + +module.exports = function(rootEnv) { + rootEnv = rootEnv || process.env; + return function (file, trOpts) { + if (jsonExtRe.test(file)) { + return stream.PassThrough(); + } + var envs = trOpts ? [rootEnv, trOpts] : [rootEnv]; + return new LooseEnvify(envs); + }; +}; + +function LooseEnvify(envs) { + stream.Transform.call(this); + this._data = ''; + this._envs = envs; +} +util.inherits(LooseEnvify, stream.Transform); + +LooseEnvify.prototype._transform = function(buf, enc, cb) { + this._data += buf; + cb(); +}; + +LooseEnvify.prototype._flush = function(cb) { + var replaced = replace(this._data, this._envs); + this.push(replaced); + cb(); +}; diff --git a/graphql-subscription/node_modules/loose-envify/package.json b/graphql-subscription/node_modules/loose-envify/package.json new file mode 100644 index 0000000..5e3d0e2 --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/package.json @@ -0,0 +1,36 @@ +{ + "name": "loose-envify", + "version": "1.4.0", + "description": "Fast (and loose) selective `process.env` replacer using js-tokens instead of an AST", + "keywords": [ + "environment", + "variables", + "browserify", + "browserify-transform", + "transform", + "source", + "configuration" + ], + "homepage": "https://github.com/zertosh/loose-envify", + "license": "MIT", + "author": "Andres Suarez ", + "main": "index.js", + "bin": { + "loose-envify": "cli.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/zertosh/loose-envify.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "devDependencies": { + "browserify": "^13.1.1", + "envify": "^3.4.0", + "tap": "^8.0.0" + } +} diff --git a/graphql-subscription/node_modules/loose-envify/replace.js b/graphql-subscription/node_modules/loose-envify/replace.js new file mode 100644 index 0000000..ec15e81 --- /dev/null +++ b/graphql-subscription/node_modules/loose-envify/replace.js @@ -0,0 +1,65 @@ +'use strict'; + +var jsTokens = require('js-tokens').default; + +var processEnvRe = /\bprocess\.env\.[_$a-zA-Z][$\w]+\b/; +var spaceOrCommentRe = /^(?:\s|\/[/*])/; + +function replace(src, envs) { + if (!processEnvRe.test(src)) { + return src; + } + + var out = []; + var purge = envs.some(function(env) { + return env._ && env._.indexOf('purge') !== -1; + }); + + jsTokens.lastIndex = 0 + var parts = src.match(jsTokens); + + for (var i = 0; i < parts.length; i++) { + if (parts[i ] === 'process' && + parts[i + 1] === '.' && + parts[i + 2] === 'env' && + parts[i + 3] === '.') { + var prevCodeToken = getAdjacentCodeToken(-1, parts, i); + var nextCodeToken = getAdjacentCodeToken(1, parts, i + 4); + var replacement = getReplacementString(envs, parts[i + 4], purge); + if (prevCodeToken !== '.' && + nextCodeToken !== '.' && + nextCodeToken !== '=' && + typeof replacement === 'string') { + out.push(replacement); + i += 4; + continue; + } + } + out.push(parts[i]); + } + + return out.join(''); +} + +function getAdjacentCodeToken(dir, parts, i) { + while (true) { + var part = parts[i += dir]; + if (!spaceOrCommentRe.test(part)) { + return part; + } + } +} + +function getReplacementString(envs, name, purge) { + for (var j = 0; j < envs.length; j++) { + var env = envs[j]; + if (typeof env[name] !== 'undefined') { + return JSON.stringify(env[name]); + } + } + if (purge) { + return 'undefined'; + } +} + +module.exports = replace; diff --git a/graphql-subscription/node_modules/object-assign/index.js b/graphql-subscription/node_modules/object-assign/index.js new file mode 100644 index 0000000..0930cf8 --- /dev/null +++ b/graphql-subscription/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/graphql-subscription/node_modules/object-assign/license b/graphql-subscription/node_modules/object-assign/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/graphql-subscription/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription/node_modules/object-assign/package.json b/graphql-subscription/node_modules/object-assign/package.json new file mode 100644 index 0000000..503eb1e --- /dev/null +++ b/graphql-subscription/node_modules/object-assign/package.json @@ -0,0 +1,42 @@ +{ + "name": "object-assign", + "version": "4.1.1", + "description": "ES2015 `Object.assign()` ponyfill", + "license": "MIT", + "repository": "sindresorhus/object-assign", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava", + "bench": "matcha bench.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + } +} diff --git a/graphql-subscription/node_modules/object-assign/readme.md b/graphql-subscription/node_modules/object-assign/readme.md new file mode 100644 index 0000000..1be09d3 --- /dev/null +++ b/graphql-subscription/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/graphql-subscription/node_modules/optimism/.github/dependabot.yml b/graphql-subscription/node_modules/optimism/.github/dependabot.yml new file mode 100644 index 0000000..60fa0ee --- /dev/null +++ b/graphql-subscription/node_modules/optimism/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" diff --git a/graphql-subscription/node_modules/optimism/.github/workflows/main.yml b/graphql-subscription/node_modules/optimism/.github/workflows/main.yml new file mode 100644 index 0000000..23113bb --- /dev/null +++ b/graphql-subscription/node_modules/optimism/.github/workflows/main.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + node_version: ['16', '18', '19', '20', '21'] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node_version }} + + - name: npm install, build and test + run: | + npm install + npm run build --if-present + npm test diff --git a/graphql-subscription/node_modules/optimism/LICENSE b/graphql-subscription/node_modules/optimism/LICENSE new file mode 100644 index 0000000..d56df84 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Ben Newman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/optimism/README.md b/graphql-subscription/node_modules/optimism/README.md new file mode 100644 index 0000000..6ee9dac --- /dev/null +++ b/graphql-subscription/node_modules/optimism/README.md @@ -0,0 +1,3 @@ +# optimism [![Build Status](https://github.com/benjamn/optimism/workflows/CI/badge.svg)](https://github.com/benjamn/optimism/actions) + +Composable reactive caching with efficient invalidation. diff --git a/graphql-subscription/node_modules/optimism/lib/bundle.cjs b/graphql-subscription/node_modules/optimism/lib/bundle.cjs new file mode 100644 index 0000000..07da6fa --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/bundle.cjs @@ -0,0 +1,492 @@ +'use strict'; + +var trie = require('@wry/trie'); +var caches$1 = require('@wry/caches'); +var context = require('@wry/context'); + +var parentEntrySlot = new context.Slot(); +function nonReactive(fn) { + return parentEntrySlot.withValue(void 0, fn); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +var arrayFromSet = Array.from || + function (set) { + var array = []; + set.forEach(function (item) { return array.push(item); }); + return array; + }; +function maybeUnsubscribe(entryOrDep) { + var unsubscribe = entryOrDep.unsubscribe; + if (typeof unsubscribe === "function") { + entryOrDep.unsubscribe = void 0; + unsubscribe(); + } +} + +var emptySetPool = []; +var POOL_TARGET_SIZE = 100; +// Since this package might be used browsers, we should avoid using the +// Node built-in assert module. +function assert(condition, optionalMessage) { + if (!condition) { + throw new Error(optionalMessage || "assertion failure"); + } +} +function valueIs(a, b) { + var len = a.length; + return ( + // Unknown values are not equal to each other. + len > 0 && + // Both values must be ordinary (or both exceptional) to be equal. + len === b.length && + // The underlying value or exception must be the same. + a[len - 1] === b[len - 1]); +} +function valueGet(value) { + switch (value.length) { + case 0: throw new Error("unknown value"); + case 1: return value[0]; + case 2: throw value[1]; + } +} +function valueCopy(value) { + return value.slice(0); +} +var Entry = /** @class */ (function () { + function Entry(fn) { + this.fn = fn; + this.parents = new Set(); + this.childValues = new Map(); + // When this Entry has children that are dirty, this property becomes + // a Set containing other Entry objects, borrowed from emptySetPool. + // When the set becomes empty, it gets recycled back to emptySetPool. + this.dirtyChildren = null; + this.dirty = true; + this.recomputing = false; + this.value = []; + this.deps = null; + ++Entry.count; + } + Entry.prototype.peek = function () { + if (this.value.length === 1 && !mightBeDirty(this)) { + rememberParent(this); + return this.value[0]; + } + }; + // This is the most important method of the Entry API, because it + // determines whether the cached this.value can be returned immediately, + // or must be recomputed. The overall performance of the caching system + // depends on the truth of the following observations: (1) this.dirty is + // usually false, (2) this.dirtyChildren is usually null/empty, and thus + // (3) valueGet(this.value) is usually returned without recomputation. + Entry.prototype.recompute = function (args) { + assert(!this.recomputing, "already recomputing"); + rememberParent(this); + return mightBeDirty(this) + ? reallyRecompute(this, args) + : valueGet(this.value); + }; + Entry.prototype.setDirty = function () { + if (this.dirty) + return; + this.dirty = true; + reportDirty(this); + // We can go ahead and unsubscribe here, since any further dirty + // notifications we receive will be redundant, and unsubscribing may + // free up some resources, e.g. file watchers. + maybeUnsubscribe(this); + }; + Entry.prototype.dispose = function () { + var _this = this; + this.setDirty(); + // Sever any dependency relationships with our own children, so those + // children don't retain this parent Entry in their child.parents sets, + // thereby preventing it from being fully garbage collected. + forgetChildren(this); + // Because this entry has been kicked out of the cache (in index.js), + // we've lost the ability to find out if/when this entry becomes dirty, + // whether that happens through a subscription, because of a direct call + // to entry.setDirty(), or because one of its children becomes dirty. + // Because of this loss of future information, we have to assume the + // worst (that this entry might have become dirty very soon), so we must + // immediately mark this entry's parents as dirty. Normally we could + // just call entry.setDirty() rather than calling parent.setDirty() for + // each parent, but that would leave this entry in parent.childValues + // and parent.dirtyChildren, which would prevent the child from being + // truly forgotten. + eachParent(this, function (parent, child) { + parent.setDirty(); + forgetChild(parent, _this); + }); + }; + Entry.prototype.forget = function () { + // The code that creates Entry objects in index.ts will replace this method + // with one that actually removes the Entry from the cache, which will also + // trigger the entry.dispose method. + this.dispose(); + }; + Entry.prototype.dependOn = function (dep) { + dep.add(this); + if (!this.deps) { + this.deps = emptySetPool.pop() || new Set(); + } + this.deps.add(dep); + }; + Entry.prototype.forgetDeps = function () { + var _this = this; + if (this.deps) { + arrayFromSet(this.deps).forEach(function (dep) { return dep.delete(_this); }); + this.deps.clear(); + emptySetPool.push(this.deps); + this.deps = null; + } + }; + Entry.count = 0; + return Entry; +}()); +function rememberParent(child) { + var parent = parentEntrySlot.getValue(); + if (parent) { + child.parents.add(parent); + if (!parent.childValues.has(child)) { + parent.childValues.set(child, []); + } + if (mightBeDirty(child)) { + reportDirtyChild(parent, child); + } + else { + reportCleanChild(parent, child); + } + return parent; + } +} +function reallyRecompute(entry, args) { + forgetChildren(entry); + // Set entry as the parent entry while calling recomputeNewValue(entry). + parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]); + if (maybeSubscribe(entry, args)) { + // If we successfully recomputed entry.value and did not fail to + // (re)subscribe, then this Entry is no longer explicitly dirty. + setClean(entry); + } + return valueGet(entry.value); +} +function recomputeNewValue(entry, args) { + entry.recomputing = true; + var normalizeResult = entry.normalizeResult; + var oldValueCopy; + if (normalizeResult && entry.value.length === 1) { + oldValueCopy = valueCopy(entry.value); + } + // Make entry.value an empty array, representing an unknown value. + entry.value.length = 0; + try { + // If entry.fn succeeds, entry.value will become a normal Value. + entry.value[0] = entry.fn.apply(null, args); + // If we have a viable oldValueCopy to compare with the (successfully + // recomputed) new entry.value, and they are not already === identical, give + // normalizeResult a chance to pick/choose/reuse parts of oldValueCopy[0] + // and/or entry.value[0] to determine the final cached entry.value. + if (normalizeResult && oldValueCopy && !valueIs(oldValueCopy, entry.value)) { + try { + entry.value[0] = normalizeResult(entry.value[0], oldValueCopy[0]); + } + catch (_a) { + // If normalizeResult throws, just use the newer value, rather than + // saving the exception as entry.value[1]. + } + } + } + catch (e) { + // If entry.fn throws, entry.value will hold that exception. + entry.value[1] = e; + } + // Either way, this line is always reached. + entry.recomputing = false; +} +function mightBeDirty(entry) { + return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); +} +function setClean(entry) { + entry.dirty = false; + if (mightBeDirty(entry)) { + // This Entry may still have dirty children, in which case we can't + // let our parents know we're clean just yet. + return; + } + reportClean(entry); +} +function reportDirty(child) { + eachParent(child, reportDirtyChild); +} +function reportClean(child) { + eachParent(child, reportCleanChild); +} +function eachParent(child, callback) { + var parentCount = child.parents.size; + if (parentCount) { + var parents = arrayFromSet(child.parents); + for (var i = 0; i < parentCount; ++i) { + callback(parents[i], child); + } + } +} +// Let a parent Entry know that one of its children may be dirty. +function reportDirtyChild(parent, child) { + // Must have called rememberParent(child) before calling + // reportDirtyChild(parent, child). + assert(parent.childValues.has(child)); + assert(mightBeDirty(child)); + var parentWasClean = !mightBeDirty(parent); + if (!parent.dirtyChildren) { + parent.dirtyChildren = emptySetPool.pop() || new Set; + } + else if (parent.dirtyChildren.has(child)) { + // If we already know this child is dirty, then we must have already + // informed our own parents that we are dirty, so we can terminate + // the recursion early. + return; + } + parent.dirtyChildren.add(child); + // If parent was clean before, it just became (possibly) dirty (according to + // mightBeDirty), since we just added child to parent.dirtyChildren. + if (parentWasClean) { + reportDirty(parent); + } +} +// Let a parent Entry know that one of its children is no longer dirty. +function reportCleanChild(parent, child) { + // Must have called rememberChild(child) before calling + // reportCleanChild(parent, child). + assert(parent.childValues.has(child)); + assert(!mightBeDirty(child)); + var childValue = parent.childValues.get(child); + if (childValue.length === 0) { + parent.childValues.set(child, valueCopy(child.value)); + } + else if (!valueIs(childValue, child.value)) { + parent.setDirty(); + } + removeDirtyChild(parent, child); + if (mightBeDirty(parent)) { + return; + } + reportClean(parent); +} +function removeDirtyChild(parent, child) { + var dc = parent.dirtyChildren; + if (dc) { + dc.delete(child); + if (dc.size === 0) { + if (emptySetPool.length < POOL_TARGET_SIZE) { + emptySetPool.push(dc); + } + parent.dirtyChildren = null; + } + } +} +// Removes all children from this entry and returns an array of the +// removed children. +function forgetChildren(parent) { + if (parent.childValues.size > 0) { + parent.childValues.forEach(function (_value, child) { + forgetChild(parent, child); + }); + } + // Remove this parent Entry from any sets to which it was added by the + // addToSet method. + parent.forgetDeps(); + // After we forget all our children, this.dirtyChildren must be empty + // and therefore must have been reset to null. + assert(parent.dirtyChildren === null); +} +function forgetChild(parent, child) { + child.parents.delete(parent); + parent.childValues.delete(child); + removeDirtyChild(parent, child); +} +function maybeSubscribe(entry, args) { + if (typeof entry.subscribe === "function") { + try { + maybeUnsubscribe(entry); // Prevent double subscriptions. + entry.unsubscribe = entry.subscribe.apply(null, args); + } + catch (e) { + // If this Entry has a subscribe function and it threw an exception + // (or an unsubscribe function it previously returned now throws), + // return false to indicate that we were not able to subscribe (or + // unsubscribe), and this Entry should remain dirty. + entry.setDirty(); + return false; + } + } + // Returning true indicates either that there was no entry.subscribe + // function or that it succeeded. + return true; +} + +var EntryMethods = { + setDirty: true, + dispose: true, + forget: true, // Fully remove parent Entry from LRU cache and computation graph +}; +function dep(options) { + var depsByKey = new Map(); + var subscribe = options && options.subscribe; + function depend(key) { + var parent = parentEntrySlot.getValue(); + if (parent) { + var dep_1 = depsByKey.get(key); + if (!dep_1) { + depsByKey.set(key, dep_1 = new Set); + } + parent.dependOn(dep_1); + if (typeof subscribe === "function") { + maybeUnsubscribe(dep_1); + dep_1.unsubscribe = subscribe(key); + } + } + } + depend.dirty = function dirty(key, entryMethodName) { + var dep = depsByKey.get(key); + if (dep) { + var m_1 = (entryMethodName && + hasOwnProperty.call(EntryMethods, entryMethodName)) ? entryMethodName : "setDirty"; + // We have to use arrayFromSet(dep).forEach instead of dep.forEach, + // because modifying a Set while iterating over it can cause elements in + // the Set to be removed from the Set before they've been iterated over. + arrayFromSet(dep).forEach(function (entry) { return entry[m_1](); }); + depsByKey.delete(key); + maybeUnsubscribe(dep); + } + }; + return depend; +} + +// The defaultMakeCacheKey function is remarkably powerful, because it gives +// a unique object for any shallow-identical list of arguments. If you need +// to implement a custom makeCacheKey function, you may find it helpful to +// delegate the final work to defaultMakeCacheKey, which is why we export it +// here. However, you may want to avoid defaultMakeCacheKey if your runtime +// does not support WeakMap, or you have the ability to return a string key. +// In those cases, just write your own custom makeCacheKey functions. +var defaultKeyTrie; +function defaultMakeCacheKey() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var trie$1 = defaultKeyTrie || (defaultKeyTrie = new trie.Trie(typeof WeakMap === "function")); + return trie$1.lookupArray(args); +} +var caches = new Set(); +function wrap(originalFunction, _a) { + var _b = _a === void 0 ? Object.create(null) : _a, _c = _b.max, max = _c === void 0 ? Math.pow(2, 16) : _c, keyArgs = _b.keyArgs, _d = _b.makeCacheKey, makeCacheKey = _d === void 0 ? defaultMakeCacheKey : _d, normalizeResult = _b.normalizeResult, subscribe = _b.subscribe, _e = _b.cache, cacheOption = _e === void 0 ? caches$1.StrongCache : _e; + var cache = typeof cacheOption === "function" + ? new cacheOption(max, function (entry) { return entry.dispose(); }) + : cacheOption; + var optimistic = function () { + var key = makeCacheKey.apply(null, keyArgs ? keyArgs.apply(null, arguments) : arguments); + if (key === void 0) { + return originalFunction.apply(null, arguments); + } + var entry = cache.get(key); + if (!entry) { + cache.set(key, entry = new Entry(originalFunction)); + entry.normalizeResult = normalizeResult; + entry.subscribe = subscribe; + // Give the Entry the ability to trigger cache.delete(key), even though + // the Entry itself does not know about key or cache. + entry.forget = function () { return cache.delete(key); }; + } + var value = entry.recompute(Array.prototype.slice.call(arguments)); + // Move this entry to the front of the least-recently used queue, + // since we just finished computing its value. + cache.set(key, entry); + caches.add(cache); + // Clean up any excess entries in the cache, but only if there is no + // active parent entry, meaning we're not in the middle of a larger + // computation that might be flummoxed by the cleaning. + if (!parentEntrySlot.hasValue()) { + caches.forEach(function (cache) { return cache.clean(); }); + caches.clear(); + } + return value; + }; + Object.defineProperty(optimistic, "size", { + get: function () { return cache.size; }, + configurable: false, + enumerable: false, + }); + Object.freeze(optimistic.options = { + max: max, + keyArgs: keyArgs, + makeCacheKey: makeCacheKey, + normalizeResult: normalizeResult, + subscribe: subscribe, + cache: cache, + }); + function dirtyKey(key) { + var entry = key && cache.get(key); + if (entry) { + entry.setDirty(); + } + } + optimistic.dirtyKey = dirtyKey; + optimistic.dirty = function dirty() { + dirtyKey(makeCacheKey.apply(null, arguments)); + }; + function peekKey(key) { + var entry = key && cache.get(key); + if (entry) { + return entry.peek(); + } + } + optimistic.peekKey = peekKey; + optimistic.peek = function peek() { + return peekKey(makeCacheKey.apply(null, arguments)); + }; + function forgetKey(key) { + return key ? cache.delete(key) : false; + } + optimistic.forgetKey = forgetKey; + optimistic.forget = function forget() { + return forgetKey(makeCacheKey.apply(null, arguments)); + }; + optimistic.makeCacheKey = makeCacheKey; + optimistic.getKey = keyArgs ? function getKey() { + return makeCacheKey.apply(null, keyArgs.apply(null, arguments)); + } : makeCacheKey; + return Object.freeze(optimistic); +} + +Object.defineProperty(exports, 'KeyTrie', { + enumerable: true, + get: function () { return trie.Trie; } +}); +Object.defineProperty(exports, 'Slot', { + enumerable: true, + get: function () { return context.Slot; } +}); +Object.defineProperty(exports, 'asyncFromGen', { + enumerable: true, + get: function () { return context.asyncFromGen; } +}); +Object.defineProperty(exports, 'bindContext', { + enumerable: true, + get: function () { return context.bind; } +}); +Object.defineProperty(exports, 'noContext', { + enumerable: true, + get: function () { return context.noContext; } +}); +Object.defineProperty(exports, 'setTimeout', { + enumerable: true, + get: function () { return context.setTimeout; } +}); +exports.defaultMakeCacheKey = defaultMakeCacheKey; +exports.dep = dep; +exports.nonReactive = nonReactive; +exports.wrap = wrap; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/optimism/lib/bundle.cjs.map b/graphql-subscription/node_modules/optimism/lib/bundle.cjs.map new file mode 100644 index 0000000..75aa8ca --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/bundle.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.cjs","sources":["es5/context.js","es5/helpers.js","es5/entry.js","es5/dep.js","es5/index.js"],"sourcesContent":["import { Slot } from \"@wry/context\";\nexport var parentEntrySlot = new Slot();\nexport function nonReactive(fn) {\n return parentEntrySlot.withValue(void 0, fn);\n}\nexport { Slot };\nexport { bind as bindContext, noContext, setTimeout, asyncFromGen, } from \"@wry/context\";\n//# sourceMappingURL=context.js.map","export var hasOwnProperty = Object.prototype.hasOwnProperty;\nexport var arrayFromSet = Array.from ||\n function (set) {\n var array = [];\n set.forEach(function (item) { return array.push(item); });\n return array;\n };\nexport function maybeUnsubscribe(entryOrDep) {\n var unsubscribe = entryOrDep.unsubscribe;\n if (typeof unsubscribe === \"function\") {\n entryOrDep.unsubscribe = void 0;\n unsubscribe();\n }\n}\n//# sourceMappingURL=helpers.js.map","import { parentEntrySlot } from \"./context.js\";\nimport { maybeUnsubscribe, arrayFromSet } from \"./helpers.js\";\nvar emptySetPool = [];\nvar POOL_TARGET_SIZE = 100;\n// Since this package might be used browsers, we should avoid using the\n// Node built-in assert module.\nfunction assert(condition, optionalMessage) {\n if (!condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}\nfunction valueIs(a, b) {\n var len = a.length;\n return (\n // Unknown values are not equal to each other.\n len > 0 &&\n // Both values must be ordinary (or both exceptional) to be equal.\n len === b.length &&\n // The underlying value or exception must be the same.\n a[len - 1] === b[len - 1]);\n}\nfunction valueGet(value) {\n switch (value.length) {\n case 0: throw new Error(\"unknown value\");\n case 1: return value[0];\n case 2: throw value[1];\n }\n}\nfunction valueCopy(value) {\n return value.slice(0);\n}\nexport var Entry = /** @class */ (function () {\n function Entry(fn) {\n this.fn = fn;\n this.parents = new Set();\n this.childValues = new Map();\n // When this Entry has children that are dirty, this property becomes\n // a Set containing other Entry objects, borrowed from emptySetPool.\n // When the set becomes empty, it gets recycled back to emptySetPool.\n this.dirtyChildren = null;\n this.dirty = true;\n this.recomputing = false;\n this.value = [];\n this.deps = null;\n ++Entry.count;\n }\n Entry.prototype.peek = function () {\n if (this.value.length === 1 && !mightBeDirty(this)) {\n rememberParent(this);\n return this.value[0];\n }\n };\n // This is the most important method of the Entry API, because it\n // determines whether the cached this.value can be returned immediately,\n // or must be recomputed. The overall performance of the caching system\n // depends on the truth of the following observations: (1) this.dirty is\n // usually false, (2) this.dirtyChildren is usually null/empty, and thus\n // (3) valueGet(this.value) is usually returned without recomputation.\n Entry.prototype.recompute = function (args) {\n assert(!this.recomputing, \"already recomputing\");\n rememberParent(this);\n return mightBeDirty(this)\n ? reallyRecompute(this, args)\n : valueGet(this.value);\n };\n Entry.prototype.setDirty = function () {\n if (this.dirty)\n return;\n this.dirty = true;\n reportDirty(this);\n // We can go ahead and unsubscribe here, since any further dirty\n // notifications we receive will be redundant, and unsubscribing may\n // free up some resources, e.g. file watchers.\n maybeUnsubscribe(this);\n };\n Entry.prototype.dispose = function () {\n var _this = this;\n this.setDirty();\n // Sever any dependency relationships with our own children, so those\n // children don't retain this parent Entry in their child.parents sets,\n // thereby preventing it from being fully garbage collected.\n forgetChildren(this);\n // Because this entry has been kicked out of the cache (in index.js),\n // we've lost the ability to find out if/when this entry becomes dirty,\n // whether that happens through a subscription, because of a direct call\n // to entry.setDirty(), or because one of its children becomes dirty.\n // Because of this loss of future information, we have to assume the\n // worst (that this entry might have become dirty very soon), so we must\n // immediately mark this entry's parents as dirty. Normally we could\n // just call entry.setDirty() rather than calling parent.setDirty() for\n // each parent, but that would leave this entry in parent.childValues\n // and parent.dirtyChildren, which would prevent the child from being\n // truly forgotten.\n eachParent(this, function (parent, child) {\n parent.setDirty();\n forgetChild(parent, _this);\n });\n };\n Entry.prototype.forget = function () {\n // The code that creates Entry objects in index.ts will replace this method\n // with one that actually removes the Entry from the cache, which will also\n // trigger the entry.dispose method.\n this.dispose();\n };\n Entry.prototype.dependOn = function (dep) {\n dep.add(this);\n if (!this.deps) {\n this.deps = emptySetPool.pop() || new Set();\n }\n this.deps.add(dep);\n };\n Entry.prototype.forgetDeps = function () {\n var _this = this;\n if (this.deps) {\n arrayFromSet(this.deps).forEach(function (dep) { return dep.delete(_this); });\n this.deps.clear();\n emptySetPool.push(this.deps);\n this.deps = null;\n }\n };\n Entry.count = 0;\n return Entry;\n}());\nfunction rememberParent(child) {\n var parent = parentEntrySlot.getValue();\n if (parent) {\n child.parents.add(parent);\n if (!parent.childValues.has(child)) {\n parent.childValues.set(child, []);\n }\n if (mightBeDirty(child)) {\n reportDirtyChild(parent, child);\n }\n else {\n reportCleanChild(parent, child);\n }\n return parent;\n }\n}\nfunction reallyRecompute(entry, args) {\n forgetChildren(entry);\n // Set entry as the parent entry while calling recomputeNewValue(entry).\n parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]);\n if (maybeSubscribe(entry, args)) {\n // If we successfully recomputed entry.value and did not fail to\n // (re)subscribe, then this Entry is no longer explicitly dirty.\n setClean(entry);\n }\n return valueGet(entry.value);\n}\nfunction recomputeNewValue(entry, args) {\n entry.recomputing = true;\n var normalizeResult = entry.normalizeResult;\n var oldValueCopy;\n if (normalizeResult && entry.value.length === 1) {\n oldValueCopy = valueCopy(entry.value);\n }\n // Make entry.value an empty array, representing an unknown value.\n entry.value.length = 0;\n try {\n // If entry.fn succeeds, entry.value will become a normal Value.\n entry.value[0] = entry.fn.apply(null, args);\n // If we have a viable oldValueCopy to compare with the (successfully\n // recomputed) new entry.value, and they are not already === identical, give\n // normalizeResult a chance to pick/choose/reuse parts of oldValueCopy[0]\n // and/or entry.value[0] to determine the final cached entry.value.\n if (normalizeResult && oldValueCopy && !valueIs(oldValueCopy, entry.value)) {\n try {\n entry.value[0] = normalizeResult(entry.value[0], oldValueCopy[0]);\n }\n catch (_a) {\n // If normalizeResult throws, just use the newer value, rather than\n // saving the exception as entry.value[1].\n }\n }\n }\n catch (e) {\n // If entry.fn throws, entry.value will hold that exception.\n entry.value[1] = e;\n }\n // Either way, this line is always reached.\n entry.recomputing = false;\n}\nfunction mightBeDirty(entry) {\n return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size);\n}\nfunction setClean(entry) {\n entry.dirty = false;\n if (mightBeDirty(entry)) {\n // This Entry may still have dirty children, in which case we can't\n // let our parents know we're clean just yet.\n return;\n }\n reportClean(entry);\n}\nfunction reportDirty(child) {\n eachParent(child, reportDirtyChild);\n}\nfunction reportClean(child) {\n eachParent(child, reportCleanChild);\n}\nfunction eachParent(child, callback) {\n var parentCount = child.parents.size;\n if (parentCount) {\n var parents = arrayFromSet(child.parents);\n for (var i = 0; i < parentCount; ++i) {\n callback(parents[i], child);\n }\n }\n}\n// Let a parent Entry know that one of its children may be dirty.\nfunction reportDirtyChild(parent, child) {\n // Must have called rememberParent(child) before calling\n // reportDirtyChild(parent, child).\n assert(parent.childValues.has(child));\n assert(mightBeDirty(child));\n var parentWasClean = !mightBeDirty(parent);\n if (!parent.dirtyChildren) {\n parent.dirtyChildren = emptySetPool.pop() || new Set;\n }\n else if (parent.dirtyChildren.has(child)) {\n // If we already know this child is dirty, then we must have already\n // informed our own parents that we are dirty, so we can terminate\n // the recursion early.\n return;\n }\n parent.dirtyChildren.add(child);\n // If parent was clean before, it just became (possibly) dirty (according to\n // mightBeDirty), since we just added child to parent.dirtyChildren.\n if (parentWasClean) {\n reportDirty(parent);\n }\n}\n// Let a parent Entry know that one of its children is no longer dirty.\nfunction reportCleanChild(parent, child) {\n // Must have called rememberChild(child) before calling\n // reportCleanChild(parent, child).\n assert(parent.childValues.has(child));\n assert(!mightBeDirty(child));\n var childValue = parent.childValues.get(child);\n if (childValue.length === 0) {\n parent.childValues.set(child, valueCopy(child.value));\n }\n else if (!valueIs(childValue, child.value)) {\n parent.setDirty();\n }\n removeDirtyChild(parent, child);\n if (mightBeDirty(parent)) {\n return;\n }\n reportClean(parent);\n}\nfunction removeDirtyChild(parent, child) {\n var dc = parent.dirtyChildren;\n if (dc) {\n dc.delete(child);\n if (dc.size === 0) {\n if (emptySetPool.length < POOL_TARGET_SIZE) {\n emptySetPool.push(dc);\n }\n parent.dirtyChildren = null;\n }\n }\n}\n// Removes all children from this entry and returns an array of the\n// removed children.\nfunction forgetChildren(parent) {\n if (parent.childValues.size > 0) {\n parent.childValues.forEach(function (_value, child) {\n forgetChild(parent, child);\n });\n }\n // Remove this parent Entry from any sets to which it was added by the\n // addToSet method.\n parent.forgetDeps();\n // After we forget all our children, this.dirtyChildren must be empty\n // and therefore must have been reset to null.\n assert(parent.dirtyChildren === null);\n}\nfunction forgetChild(parent, child) {\n child.parents.delete(parent);\n parent.childValues.delete(child);\n removeDirtyChild(parent, child);\n}\nfunction maybeSubscribe(entry, args) {\n if (typeof entry.subscribe === \"function\") {\n try {\n maybeUnsubscribe(entry); // Prevent double subscriptions.\n entry.unsubscribe = entry.subscribe.apply(null, args);\n }\n catch (e) {\n // If this Entry has a subscribe function and it threw an exception\n // (or an unsubscribe function it previously returned now throws),\n // return false to indicate that we were not able to subscribe (or\n // unsubscribe), and this Entry should remain dirty.\n entry.setDirty();\n return false;\n }\n }\n // Returning true indicates either that there was no entry.subscribe\n // function or that it succeeded.\n return true;\n}\n//# sourceMappingURL=entry.js.map","import { parentEntrySlot } from \"./context.js\";\nimport { hasOwnProperty, maybeUnsubscribe, arrayFromSet, } from \"./helpers.js\";\nvar EntryMethods = {\n setDirty: true,\n dispose: true,\n forget: true, // Fully remove parent Entry from LRU cache and computation graph\n};\nexport function dep(options) {\n var depsByKey = new Map();\n var subscribe = options && options.subscribe;\n function depend(key) {\n var parent = parentEntrySlot.getValue();\n if (parent) {\n var dep_1 = depsByKey.get(key);\n if (!dep_1) {\n depsByKey.set(key, dep_1 = new Set);\n }\n parent.dependOn(dep_1);\n if (typeof subscribe === \"function\") {\n maybeUnsubscribe(dep_1);\n dep_1.unsubscribe = subscribe(key);\n }\n }\n }\n depend.dirty = function dirty(key, entryMethodName) {\n var dep = depsByKey.get(key);\n if (dep) {\n var m_1 = (entryMethodName &&\n hasOwnProperty.call(EntryMethods, entryMethodName)) ? entryMethodName : \"setDirty\";\n // We have to use arrayFromSet(dep).forEach instead of dep.forEach,\n // because modifying a Set while iterating over it can cause elements in\n // the Set to be removed from the Set before they've been iterated over.\n arrayFromSet(dep).forEach(function (entry) { return entry[m_1](); });\n depsByKey.delete(key);\n maybeUnsubscribe(dep);\n }\n };\n return depend;\n}\n//# sourceMappingURL=dep.js.map","import { Trie } from \"@wry/trie\";\nimport { StrongCache } from \"@wry/caches\";\nimport { Entry } from \"./entry.js\";\nimport { parentEntrySlot } from \"./context.js\";\n// These helper functions are important for making optimism work with\n// asynchronous code. In order to register parent-child dependencies,\n// optimism needs to know about any currently active parent computations.\n// In ordinary synchronous code, the parent context is implicit in the\n// execution stack, but asynchronous code requires some extra guidance in\n// order to propagate context from one async task segment to the next.\nexport { bindContext, noContext, nonReactive, setTimeout, asyncFromGen, Slot, } from \"./context.js\";\n// A lighter-weight dependency, similar to OptimisticWrapperFunction, except\n// with only one argument, no makeCacheKey, no wrapped function to recompute,\n// and no result value. Useful for representing dependency leaves in the graph\n// of computation. Subscriptions are supported.\nexport { dep } from \"./dep.js\";\n// The defaultMakeCacheKey function is remarkably powerful, because it gives\n// a unique object for any shallow-identical list of arguments. If you need\n// to implement a custom makeCacheKey function, you may find it helpful to\n// delegate the final work to defaultMakeCacheKey, which is why we export it\n// here. However, you may want to avoid defaultMakeCacheKey if your runtime\n// does not support WeakMap, or you have the ability to return a string key.\n// In those cases, just write your own custom makeCacheKey functions.\nvar defaultKeyTrie;\nexport function defaultMakeCacheKey() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var trie = defaultKeyTrie || (defaultKeyTrie = new Trie(typeof WeakMap === \"function\"));\n return trie.lookupArray(args);\n}\n// If you're paranoid about memory leaks, or you want to avoid using WeakMap\n// under the hood, but you still need the behavior of defaultMakeCacheKey,\n// import this constructor to create your own tries.\nexport { Trie as KeyTrie };\n;\nvar caches = new Set();\nexport function wrap(originalFunction, _a) {\n var _b = _a === void 0 ? Object.create(null) : _a, _c = _b.max, max = _c === void 0 ? Math.pow(2, 16) : _c, keyArgs = _b.keyArgs, _d = _b.makeCacheKey, makeCacheKey = _d === void 0 ? defaultMakeCacheKey : _d, normalizeResult = _b.normalizeResult, subscribe = _b.subscribe, _e = _b.cache, cacheOption = _e === void 0 ? StrongCache : _e;\n var cache = typeof cacheOption === \"function\"\n ? new cacheOption(max, function (entry) { return entry.dispose(); })\n : cacheOption;\n var optimistic = function () {\n var key = makeCacheKey.apply(null, keyArgs ? keyArgs.apply(null, arguments) : arguments);\n if (key === void 0) {\n return originalFunction.apply(null, arguments);\n }\n var entry = cache.get(key);\n if (!entry) {\n cache.set(key, entry = new Entry(originalFunction));\n entry.normalizeResult = normalizeResult;\n entry.subscribe = subscribe;\n // Give the Entry the ability to trigger cache.delete(key), even though\n // the Entry itself does not know about key or cache.\n entry.forget = function () { return cache.delete(key); };\n }\n var value = entry.recompute(Array.prototype.slice.call(arguments));\n // Move this entry to the front of the least-recently used queue,\n // since we just finished computing its value.\n cache.set(key, entry);\n caches.add(cache);\n // Clean up any excess entries in the cache, but only if there is no\n // active parent entry, meaning we're not in the middle of a larger\n // computation that might be flummoxed by the cleaning.\n if (!parentEntrySlot.hasValue()) {\n caches.forEach(function (cache) { return cache.clean(); });\n caches.clear();\n }\n return value;\n };\n Object.defineProperty(optimistic, \"size\", {\n get: function () { return cache.size; },\n configurable: false,\n enumerable: false,\n });\n Object.freeze(optimistic.options = {\n max: max,\n keyArgs: keyArgs,\n makeCacheKey: makeCacheKey,\n normalizeResult: normalizeResult,\n subscribe: subscribe,\n cache: cache,\n });\n function dirtyKey(key) {\n var entry = key && cache.get(key);\n if (entry) {\n entry.setDirty();\n }\n }\n optimistic.dirtyKey = dirtyKey;\n optimistic.dirty = function dirty() {\n dirtyKey(makeCacheKey.apply(null, arguments));\n };\n function peekKey(key) {\n var entry = key && cache.get(key);\n if (entry) {\n return entry.peek();\n }\n }\n optimistic.peekKey = peekKey;\n optimistic.peek = function peek() {\n return peekKey(makeCacheKey.apply(null, arguments));\n };\n function forgetKey(key) {\n return key ? cache.delete(key) : false;\n }\n optimistic.forgetKey = forgetKey;\n optimistic.forget = function forget() {\n return forgetKey(makeCacheKey.apply(null, arguments));\n };\n optimistic.makeCacheKey = makeCacheKey;\n optimistic.getKey = keyArgs ? function getKey() {\n return makeCacheKey.apply(null, keyArgs.apply(null, arguments));\n } : makeCacheKey;\n return Object.freeze(optimistic);\n}\n//# sourceMappingURL=index.js.map"],"names":["Slot","trie","Trie","StrongCache"],"mappings":";;;;;;AACO,IAAI,eAAe,GAAG,IAAIA,YAAI,EAAE,CAAC;AACjC,SAAS,WAAW,CAAC,EAAE,EAAE;AAChC,IAAI,OAAO,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AACjD;;ACJO,IAAI,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACrD,IAAI,YAAY,GAAG,KAAK,CAAC,IAAI;AACpC,IAAI,UAAU,GAAG,EAAE;AACnB,QAAQ,IAAI,KAAK,GAAG,EAAE,CAAC;AACvB,QAAQ,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AAClE,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK,CAAC;AACC,SAAS,gBAAgB,CAAC,UAAU,EAAE;AAC7C,IAAI,IAAI,WAAW,GAAG,U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C,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AAC5D,KAAK,CAAC;AACN,IAAI,SAAS,SAAS,CAAC,GAAG,EAAE;AAC5B,QAAQ,OAAO,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC/C,KAAK;AACL,IAAI,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;AACrC,IAAI,UAAU,CAAC,MAAM,GAAG,SAAS,MAAM,GAAG;AAC1C,QAAQ,OAAO,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AAC9D,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC;AAC3C,IAAI,UAAU,CAAC,MAAM,GAAG,OAAO,GAAG,SAAS,MAAM,GAAG;AACpD,QAAQ,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AACxE,KAAK,GAAG,YAAY,CAAC;AACrB,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/bundle.cjs.native.js b/graphql-subscription/node_modules/optimism/lib/bundle.cjs.native.js new file mode 100644 index 0000000..07da6fa --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/bundle.cjs.native.js @@ -0,0 +1,492 @@ +'use strict'; + +var trie = require('@wry/trie'); +var caches$1 = require('@wry/caches'); +var context = require('@wry/context'); + +var parentEntrySlot = new context.Slot(); +function nonReactive(fn) { + return parentEntrySlot.withValue(void 0, fn); +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; +var arrayFromSet = Array.from || + function (set) { + var array = []; + set.forEach(function (item) { return array.push(item); }); + return array; + }; +function maybeUnsubscribe(entryOrDep) { + var unsubscribe = entryOrDep.unsubscribe; + if (typeof unsubscribe === "function") { + entryOrDep.unsubscribe = void 0; + unsubscribe(); + } +} + +var emptySetPool = []; +var POOL_TARGET_SIZE = 100; +// Since this package might be used browsers, we should avoid using the +// Node built-in assert module. +function assert(condition, optionalMessage) { + if (!condition) { + throw new Error(optionalMessage || "assertion failure"); + } +} +function valueIs(a, b) { + var len = a.length; + return ( + // Unknown values are not equal to each other. + len > 0 && + // Both values must be ordinary (or both exceptional) to be equal. + len === b.length && + // The underlying value or exception must be the same. + a[len - 1] === b[len - 1]); +} +function valueGet(value) { + switch (value.length) { + case 0: throw new Error("unknown value"); + case 1: return value[0]; + case 2: throw value[1]; + } +} +function valueCopy(value) { + return value.slice(0); +} +var Entry = /** @class */ (function () { + function Entry(fn) { + this.fn = fn; + this.parents = new Set(); + this.childValues = new Map(); + // When this Entry has children that are dirty, this property becomes + // a Set containing other Entry objects, borrowed from emptySetPool. + // When the set becomes empty, it gets recycled back to emptySetPool. + this.dirtyChildren = null; + this.dirty = true; + this.recomputing = false; + this.value = []; + this.deps = null; + ++Entry.count; + } + Entry.prototype.peek = function () { + if (this.value.length === 1 && !mightBeDirty(this)) { + rememberParent(this); + return this.value[0]; + } + }; + // This is the most important method of the Entry API, because it + // determines whether the cached this.value can be returned immediately, + // or must be recomputed. The overall performance of the caching system + // depends on the truth of the following observations: (1) this.dirty is + // usually false, (2) this.dirtyChildren is usually null/empty, and thus + // (3) valueGet(this.value) is usually returned without recomputation. + Entry.prototype.recompute = function (args) { + assert(!this.recomputing, "already recomputing"); + rememberParent(this); + return mightBeDirty(this) + ? reallyRecompute(this, args) + : valueGet(this.value); + }; + Entry.prototype.setDirty = function () { + if (this.dirty) + return; + this.dirty = true; + reportDirty(this); + // We can go ahead and unsubscribe here, since any further dirty + // notifications we receive will be redundant, and unsubscribing may + // free up some resources, e.g. file watchers. + maybeUnsubscribe(this); + }; + Entry.prototype.dispose = function () { + var _this = this; + this.setDirty(); + // Sever any dependency relationships with our own children, so those + // children don't retain this parent Entry in their child.parents sets, + // thereby preventing it from being fully garbage collected. + forgetChildren(this); + // Because this entry has been kicked out of the cache (in index.js), + // we've lost the ability to find out if/when this entry becomes dirty, + // whether that happens through a subscription, because of a direct call + // to entry.setDirty(), or because one of its children becomes dirty. + // Because of this loss of future information, we have to assume the + // worst (that this entry might have become dirty very soon), so we must + // immediately mark this entry's parents as dirty. Normally we could + // just call entry.setDirty() rather than calling parent.setDirty() for + // each parent, but that would leave this entry in parent.childValues + // and parent.dirtyChildren, which would prevent the child from being + // truly forgotten. + eachParent(this, function (parent, child) { + parent.setDirty(); + forgetChild(parent, _this); + }); + }; + Entry.prototype.forget = function () { + // The code that creates Entry objects in index.ts will replace this method + // with one that actually removes the Entry from the cache, which will also + // trigger the entry.dispose method. + this.dispose(); + }; + Entry.prototype.dependOn = function (dep) { + dep.add(this); + if (!this.deps) { + this.deps = emptySetPool.pop() || new Set(); + } + this.deps.add(dep); + }; + Entry.prototype.forgetDeps = function () { + var _this = this; + if (this.deps) { + arrayFromSet(this.deps).forEach(function (dep) { return dep.delete(_this); }); + this.deps.clear(); + emptySetPool.push(this.deps); + this.deps = null; + } + }; + Entry.count = 0; + return Entry; +}()); +function rememberParent(child) { + var parent = parentEntrySlot.getValue(); + if (parent) { + child.parents.add(parent); + if (!parent.childValues.has(child)) { + parent.childValues.set(child, []); + } + if (mightBeDirty(child)) { + reportDirtyChild(parent, child); + } + else { + reportCleanChild(parent, child); + } + return parent; + } +} +function reallyRecompute(entry, args) { + forgetChildren(entry); + // Set entry as the parent entry while calling recomputeNewValue(entry). + parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]); + if (maybeSubscribe(entry, args)) { + // If we successfully recomputed entry.value and did not fail to + // (re)subscribe, then this Entry is no longer explicitly dirty. + setClean(entry); + } + return valueGet(entry.value); +} +function recomputeNewValue(entry, args) { + entry.recomputing = true; + var normalizeResult = entry.normalizeResult; + var oldValueCopy; + if (normalizeResult && entry.value.length === 1) { + oldValueCopy = valueCopy(entry.value); + } + // Make entry.value an empty array, representing an unknown value. + entry.value.length = 0; + try { + // If entry.fn succeeds, entry.value will become a normal Value. + entry.value[0] = entry.fn.apply(null, args); + // If we have a viable oldValueCopy to compare with the (successfully + // recomputed) new entry.value, and they are not already === identical, give + // normalizeResult a chance to pick/choose/reuse parts of oldValueCopy[0] + // and/or entry.value[0] to determine the final cached entry.value. + if (normalizeResult && oldValueCopy && !valueIs(oldValueCopy, entry.value)) { + try { + entry.value[0] = normalizeResult(entry.value[0], oldValueCopy[0]); + } + catch (_a) { + // If normalizeResult throws, just use the newer value, rather than + // saving the exception as entry.value[1]. + } + } + } + catch (e) { + // If entry.fn throws, entry.value will hold that exception. + entry.value[1] = e; + } + // Either way, this line is always reached. + entry.recomputing = false; +} +function mightBeDirty(entry) { + return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); +} +function setClean(entry) { + entry.dirty = false; + if (mightBeDirty(entry)) { + // This Entry may still have dirty children, in which case we can't + // let our parents know we're clean just yet. + return; + } + reportClean(entry); +} +function reportDirty(child) { + eachParent(child, reportDirtyChild); +} +function reportClean(child) { + eachParent(child, reportCleanChild); +} +function eachParent(child, callback) { + var parentCount = child.parents.size; + if (parentCount) { + var parents = arrayFromSet(child.parents); + for (var i = 0; i < parentCount; ++i) { + callback(parents[i], child); + } + } +} +// Let a parent Entry know that one of its children may be dirty. +function reportDirtyChild(parent, child) { + // Must have called rememberParent(child) before calling + // reportDirtyChild(parent, child). + assert(parent.childValues.has(child)); + assert(mightBeDirty(child)); + var parentWasClean = !mightBeDirty(parent); + if (!parent.dirtyChildren) { + parent.dirtyChildren = emptySetPool.pop() || new Set; + } + else if (parent.dirtyChildren.has(child)) { + // If we already know this child is dirty, then we must have already + // informed our own parents that we are dirty, so we can terminate + // the recursion early. + return; + } + parent.dirtyChildren.add(child); + // If parent was clean before, it just became (possibly) dirty (according to + // mightBeDirty), since we just added child to parent.dirtyChildren. + if (parentWasClean) { + reportDirty(parent); + } +} +// Let a parent Entry know that one of its children is no longer dirty. +function reportCleanChild(parent, child) { + // Must have called rememberChild(child) before calling + // reportCleanChild(parent, child). + assert(parent.childValues.has(child)); + assert(!mightBeDirty(child)); + var childValue = parent.childValues.get(child); + if (childValue.length === 0) { + parent.childValues.set(child, valueCopy(child.value)); + } + else if (!valueIs(childValue, child.value)) { + parent.setDirty(); + } + removeDirtyChild(parent, child); + if (mightBeDirty(parent)) { + return; + } + reportClean(parent); +} +function removeDirtyChild(parent, child) { + var dc = parent.dirtyChildren; + if (dc) { + dc.delete(child); + if (dc.size === 0) { + if (emptySetPool.length < POOL_TARGET_SIZE) { + emptySetPool.push(dc); + } + parent.dirtyChildren = null; + } + } +} +// Removes all children from this entry and returns an array of the +// removed children. +function forgetChildren(parent) { + if (parent.childValues.size > 0) { + parent.childValues.forEach(function (_value, child) { + forgetChild(parent, child); + }); + } + // Remove this parent Entry from any sets to which it was added by the + // addToSet method. + parent.forgetDeps(); + // After we forget all our children, this.dirtyChildren must be empty + // and therefore must have been reset to null. + assert(parent.dirtyChildren === null); +} +function forgetChild(parent, child) { + child.parents.delete(parent); + parent.childValues.delete(child); + removeDirtyChild(parent, child); +} +function maybeSubscribe(entry, args) { + if (typeof entry.subscribe === "function") { + try { + maybeUnsubscribe(entry); // Prevent double subscriptions. + entry.unsubscribe = entry.subscribe.apply(null, args); + } + catch (e) { + // If this Entry has a subscribe function and it threw an exception + // (or an unsubscribe function it previously returned now throws), + // return false to indicate that we were not able to subscribe (or + // unsubscribe), and this Entry should remain dirty. + entry.setDirty(); + return false; + } + } + // Returning true indicates either that there was no entry.subscribe + // function or that it succeeded. + return true; +} + +var EntryMethods = { + setDirty: true, + dispose: true, + forget: true, // Fully remove parent Entry from LRU cache and computation graph +}; +function dep(options) { + var depsByKey = new Map(); + var subscribe = options && options.subscribe; + function depend(key) { + var parent = parentEntrySlot.getValue(); + if (parent) { + var dep_1 = depsByKey.get(key); + if (!dep_1) { + depsByKey.set(key, dep_1 = new Set); + } + parent.dependOn(dep_1); + if (typeof subscribe === "function") { + maybeUnsubscribe(dep_1); + dep_1.unsubscribe = subscribe(key); + } + } + } + depend.dirty = function dirty(key, entryMethodName) { + var dep = depsByKey.get(key); + if (dep) { + var m_1 = (entryMethodName && + hasOwnProperty.call(EntryMethods, entryMethodName)) ? entryMethodName : "setDirty"; + // We have to use arrayFromSet(dep).forEach instead of dep.forEach, + // because modifying a Set while iterating over it can cause elements in + // the Set to be removed from the Set before they've been iterated over. + arrayFromSet(dep).forEach(function (entry) { return entry[m_1](); }); + depsByKey.delete(key); + maybeUnsubscribe(dep); + } + }; + return depend; +} + +// The defaultMakeCacheKey function is remarkably powerful, because it gives +// a unique object for any shallow-identical list of arguments. If you need +// to implement a custom makeCacheKey function, you may find it helpful to +// delegate the final work to defaultMakeCacheKey, which is why we export it +// here. However, you may want to avoid defaultMakeCacheKey if your runtime +// does not support WeakMap, or you have the ability to return a string key. +// In those cases, just write your own custom makeCacheKey functions. +var defaultKeyTrie; +function defaultMakeCacheKey() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var trie$1 = defaultKeyTrie || (defaultKeyTrie = new trie.Trie(typeof WeakMap === "function")); + return trie$1.lookupArray(args); +} +var caches = new Set(); +function wrap(originalFunction, _a) { + var _b = _a === void 0 ? Object.create(null) : _a, _c = _b.max, max = _c === void 0 ? Math.pow(2, 16) : _c, keyArgs = _b.keyArgs, _d = _b.makeCacheKey, makeCacheKey = _d === void 0 ? defaultMakeCacheKey : _d, normalizeResult = _b.normalizeResult, subscribe = _b.subscribe, _e = _b.cache, cacheOption = _e === void 0 ? caches$1.StrongCache : _e; + var cache = typeof cacheOption === "function" + ? new cacheOption(max, function (entry) { return entry.dispose(); }) + : cacheOption; + var optimistic = function () { + var key = makeCacheKey.apply(null, keyArgs ? keyArgs.apply(null, arguments) : arguments); + if (key === void 0) { + return originalFunction.apply(null, arguments); + } + var entry = cache.get(key); + if (!entry) { + cache.set(key, entry = new Entry(originalFunction)); + entry.normalizeResult = normalizeResult; + entry.subscribe = subscribe; + // Give the Entry the ability to trigger cache.delete(key), even though + // the Entry itself does not know about key or cache. + entry.forget = function () { return cache.delete(key); }; + } + var value = entry.recompute(Array.prototype.slice.call(arguments)); + // Move this entry to the front of the least-recently used queue, + // since we just finished computing its value. + cache.set(key, entry); + caches.add(cache); + // Clean up any excess entries in the cache, but only if there is no + // active parent entry, meaning we're not in the middle of a larger + // computation that might be flummoxed by the cleaning. + if (!parentEntrySlot.hasValue()) { + caches.forEach(function (cache) { return cache.clean(); }); + caches.clear(); + } + return value; + }; + Object.defineProperty(optimistic, "size", { + get: function () { return cache.size; }, + configurable: false, + enumerable: false, + }); + Object.freeze(optimistic.options = { + max: max, + keyArgs: keyArgs, + makeCacheKey: makeCacheKey, + normalizeResult: normalizeResult, + subscribe: subscribe, + cache: cache, + }); + function dirtyKey(key) { + var entry = key && cache.get(key); + if (entry) { + entry.setDirty(); + } + } + optimistic.dirtyKey = dirtyKey; + optimistic.dirty = function dirty() { + dirtyKey(makeCacheKey.apply(null, arguments)); + }; + function peekKey(key) { + var entry = key && cache.get(key); + if (entry) { + return entry.peek(); + } + } + optimistic.peekKey = peekKey; + optimistic.peek = function peek() { + return peekKey(makeCacheKey.apply(null, arguments)); + }; + function forgetKey(key) { + return key ? cache.delete(key) : false; + } + optimistic.forgetKey = forgetKey; + optimistic.forget = function forget() { + return forgetKey(makeCacheKey.apply(null, arguments)); + }; + optimistic.makeCacheKey = makeCacheKey; + optimistic.getKey = keyArgs ? function getKey() { + return makeCacheKey.apply(null, keyArgs.apply(null, arguments)); + } : makeCacheKey; + return Object.freeze(optimistic); +} + +Object.defineProperty(exports, 'KeyTrie', { + enumerable: true, + get: function () { return trie.Trie; } +}); +Object.defineProperty(exports, 'Slot', { + enumerable: true, + get: function () { return context.Slot; } +}); +Object.defineProperty(exports, 'asyncFromGen', { + enumerable: true, + get: function () { return context.asyncFromGen; } +}); +Object.defineProperty(exports, 'bindContext', { + enumerable: true, + get: function () { return context.bind; } +}); +Object.defineProperty(exports, 'noContext', { + enumerable: true, + get: function () { return context.noContext; } +}); +Object.defineProperty(exports, 'setTimeout', { + enumerable: true, + get: function () { return context.setTimeout; } +}); +exports.defaultMakeCacheKey = defaultMakeCacheKey; +exports.dep = dep; +exports.nonReactive = nonReactive; +exports.wrap = wrap; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/optimism/lib/context.d.ts b/graphql-subscription/node_modules/optimism/lib/context.d.ts new file mode 100644 index 0000000..844acea --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/context.d.ts @@ -0,0 +1,11 @@ +import { Slot } from "@wry/context"; +import { AnyEntry } from "./entry.js"; +export declare const parentEntrySlot: { + readonly id: string; + hasValue(): boolean; + getValue(): AnyEntry | undefined; + withValue(value: AnyEntry | undefined, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult; +}; +export declare function nonReactive(fn: () => R): R; +export { Slot }; +export { bind as bindContext, noContext, setTimeout, asyncFromGen, } from "@wry/context"; diff --git a/graphql-subscription/node_modules/optimism/lib/context.js b/graphql-subscription/node_modules/optimism/lib/context.js new file mode 100644 index 0000000..ae35117 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/context.js @@ -0,0 +1,8 @@ +import { Slot } from "@wry/context"; +export const parentEntrySlot = new Slot(); +export function nonReactive(fn) { + return parentEntrySlot.withValue(void 0, fn); +} +export { Slot }; +export { bind as bindContext, noContext, setTimeout, asyncFromGen, } from "@wry/context"; +//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/context.js.map b/graphql-subscription/node_modules/optimism/lib/context.js.map new file mode 100644 index 0000000..db48a11 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/context.js.map @@ -0,0 +1 @@ +{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,IAAI,EAAwB,CAAC;AAEhE,MAAM,UAAU,WAAW,CAAI,EAAW;IACxC,OAAO,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA;AACf,OAAO,EACL,IAAI,IAAI,WAAW,EACnB,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/dep.d.ts b/graphql-subscription/node_modules/optimism/lib/dep.d.ts new file mode 100644 index 0000000..8ce47ac --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/dep.d.ts @@ -0,0 +1,19 @@ +import { AnyEntry } from "./entry.js"; +import { OptimisticWrapOptions } from "./index.js"; +import { Unsubscribable } from "./helpers.js"; +type EntryMethodName = keyof typeof EntryMethods; +declare const EntryMethods: { + setDirty: boolean; + dispose: boolean; + forget: boolean; +}; +export type OptimisticDependencyFunction = ((key: TKey) => void) & { + dirty: (key: TKey, entryMethodName?: EntryMethodName) => void; +}; +export type Dep = Set & { + subscribe: OptimisticWrapOptions<[TKey]>["subscribe"]; +} & Unsubscribable; +export declare function dep(options?: { + subscribe: Dep["subscribe"]; +}): OptimisticDependencyFunction; +export {}; diff --git a/graphql-subscription/node_modules/optimism/lib/dep.js b/graphql-subscription/node_modules/optimism/lib/dep.js new file mode 100644 index 0000000..bf4bf84 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/dep.js @@ -0,0 +1,40 @@ +import { parentEntrySlot } from "./context.js"; +import { hasOwnProperty, maybeUnsubscribe, arrayFromSet, } from "./helpers.js"; +const EntryMethods = { + setDirty: true, + dispose: true, + forget: true, // Fully remove parent Entry from LRU cache and computation graph +}; +export function dep(options) { + const depsByKey = new Map(); + const subscribe = options && options.subscribe; + function depend(key) { + const parent = parentEntrySlot.getValue(); + if (parent) { + let dep = depsByKey.get(key); + if (!dep) { + depsByKey.set(key, dep = new Set); + } + parent.dependOn(dep); + if (typeof subscribe === "function") { + maybeUnsubscribe(dep); + dep.unsubscribe = subscribe(key); + } + } + } + depend.dirty = function dirty(key, entryMethodName) { + const dep = depsByKey.get(key); + if (dep) { + const m = (entryMethodName && + hasOwnProperty.call(EntryMethods, entryMethodName)) ? entryMethodName : "setDirty"; + // We have to use arrayFromSet(dep).forEach instead of dep.forEach, + // because modifying a Set while iterating over it can cause elements in + // the Set to be removed from the Set before they've been iterated over. + arrayFromSet(dep).forEach(entry => entry[m]()); + depsByKey.delete(key); + maybeUnsubscribe(dep); + } + }; + return depend; +} +//# sourceMappingURL=dep.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/dep.js.map b/graphql-subscription/node_modules/optimism/lib/dep.js.map new file mode 100644 index 0000000..d0772b0 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/dep.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dep.js","sourceRoot":"","sources":["../src/dep.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,cAAc,EAEd,gBAAgB,EAChB,YAAY,GACZ,MAAM,cAAc,CAAC;AAGvB,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI,EAAI,iEAAiE;CAClF,CAAC;AAWF,MAAM,UAAU,GAAG,CAAO,OAEzB;IACC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC7C,MAAM,SAAS,GAAG,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;IAE/C,SAAS,MAAM,CAAC,GAAS;QACvB,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;QAC1C,IAAI,MAAM,EAAE;YACV,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,EAAE;gBACR,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAgB,CAAC,CAAC;aAChD;YACD,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;gBACnC,gBAAgB,CAAC,GAAG,CAAC,CAAC;gBACtB,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;aAClC;SACF;IACH,CAAC;IAED,MAAM,CAAC,KAAK,GAAG,SAAS,KAAK,CAC3B,GAAS,EACT,eAAiC;QAEjC,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,EAAE;YACP,MAAM,CAAC,GAAoB,CACzB,eAAe;gBACf,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CACnD,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC;YACjC,mEAAmE;YACnE,wEAAwE;YACxE,wEAAwE;YACxE,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC/C,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACtB,gBAAgB,CAAC,GAAG,CAAC,CAAC;SACvB;IACH,CAAC,CAAC;IAEF,OAAO,MAA4C,CAAC;AACtD,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/entry.d.ts b/graphql-subscription/node_modules/optimism/lib/entry.d.ts new file mode 100644 index 0000000..95ca7bb --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/entry.d.ts @@ -0,0 +1,28 @@ +import { OptimisticWrapOptions } from "./index.js"; +import { Dep } from "./dep.js"; +import { Unsubscribable } from "./helpers.js"; +type Value = [] | [T] | [void, any]; +export type AnyEntry = Entry; +export declare class Entry { + readonly fn: (...args: TArgs) => TValue; + static count: number; + normalizeResult: OptimisticWrapOptions["normalizeResult"]; + subscribe: OptimisticWrapOptions["subscribe"]; + unsubscribe: Unsubscribable["unsubscribe"]; + readonly parents: Set; + readonly childValues: Map>; + dirtyChildren: Set | null; + dirty: boolean; + recomputing: boolean; + readonly value: Value; + constructor(fn: (...args: TArgs) => TValue); + peek(): TValue | undefined; + recompute(args: TArgs): TValue; + setDirty(): void; + dispose(): void; + forget(): void; + private deps; + dependOn(dep: Dep): void; + forgetDeps(): void; +} +export {}; diff --git a/graphql-subscription/node_modules/optimism/lib/entry.js b/graphql-subscription/node_modules/optimism/lib/entry.js new file mode 100644 index 0000000..3578b46 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/entry.js @@ -0,0 +1,301 @@ +import { parentEntrySlot } from "./context.js"; +import { maybeUnsubscribe, arrayFromSet } from "./helpers.js"; +const emptySetPool = []; +const POOL_TARGET_SIZE = 100; +// Since this package might be used browsers, we should avoid using the +// Node built-in assert module. +function assert(condition, optionalMessage) { + if (!condition) { + throw new Error(optionalMessage || "assertion failure"); + } +} +function valueIs(a, b) { + const len = a.length; + return ( + // Unknown values are not equal to each other. + len > 0 && + // Both values must be ordinary (or both exceptional) to be equal. + len === b.length && + // The underlying value or exception must be the same. + a[len - 1] === b[len - 1]); +} +function valueGet(value) { + switch (value.length) { + case 0: throw new Error("unknown value"); + case 1: return value[0]; + case 2: throw value[1]; + } +} +function valueCopy(value) { + return value.slice(0); +} +export class Entry { + constructor(fn) { + this.fn = fn; + this.parents = new Set(); + this.childValues = new Map(); + // When this Entry has children that are dirty, this property becomes + // a Set containing other Entry objects, borrowed from emptySetPool. + // When the set becomes empty, it gets recycled back to emptySetPool. + this.dirtyChildren = null; + this.dirty = true; + this.recomputing = false; + this.value = []; + this.deps = null; + ++Entry.count; + } + peek() { + if (this.value.length === 1 && !mightBeDirty(this)) { + rememberParent(this); + return this.value[0]; + } + } + // This is the most important method of the Entry API, because it + // determines whether the cached this.value can be returned immediately, + // or must be recomputed. The overall performance of the caching system + // depends on the truth of the following observations: (1) this.dirty is + // usually false, (2) this.dirtyChildren is usually null/empty, and thus + // (3) valueGet(this.value) is usually returned without recomputation. + recompute(args) { + assert(!this.recomputing, "already recomputing"); + rememberParent(this); + return mightBeDirty(this) + ? reallyRecompute(this, args) + : valueGet(this.value); + } + setDirty() { + if (this.dirty) + return; + this.dirty = true; + reportDirty(this); + // We can go ahead and unsubscribe here, since any further dirty + // notifications we receive will be redundant, and unsubscribing may + // free up some resources, e.g. file watchers. + maybeUnsubscribe(this); + } + dispose() { + this.setDirty(); + // Sever any dependency relationships with our own children, so those + // children don't retain this parent Entry in their child.parents sets, + // thereby preventing it from being fully garbage collected. + forgetChildren(this); + // Because this entry has been kicked out of the cache (in index.js), + // we've lost the ability to find out if/when this entry becomes dirty, + // whether that happens through a subscription, because of a direct call + // to entry.setDirty(), or because one of its children becomes dirty. + // Because of this loss of future information, we have to assume the + // worst (that this entry might have become dirty very soon), so we must + // immediately mark this entry's parents as dirty. Normally we could + // just call entry.setDirty() rather than calling parent.setDirty() for + // each parent, but that would leave this entry in parent.childValues + // and parent.dirtyChildren, which would prevent the child from being + // truly forgotten. + eachParent(this, (parent, child) => { + parent.setDirty(); + forgetChild(parent, this); + }); + } + forget() { + // The code that creates Entry objects in index.ts will replace this method + // with one that actually removes the Entry from the cache, which will also + // trigger the entry.dispose method. + this.dispose(); + } + dependOn(dep) { + dep.add(this); + if (!this.deps) { + this.deps = emptySetPool.pop() || new Set(); + } + this.deps.add(dep); + } + forgetDeps() { + if (this.deps) { + arrayFromSet(this.deps).forEach(dep => dep.delete(this)); + this.deps.clear(); + emptySetPool.push(this.deps); + this.deps = null; + } + } +} +Entry.count = 0; +function rememberParent(child) { + const parent = parentEntrySlot.getValue(); + if (parent) { + child.parents.add(parent); + if (!parent.childValues.has(child)) { + parent.childValues.set(child, []); + } + if (mightBeDirty(child)) { + reportDirtyChild(parent, child); + } + else { + reportCleanChild(parent, child); + } + return parent; + } +} +function reallyRecompute(entry, args) { + forgetChildren(entry); + // Set entry as the parent entry while calling recomputeNewValue(entry). + parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]); + if (maybeSubscribe(entry, args)) { + // If we successfully recomputed entry.value and did not fail to + // (re)subscribe, then this Entry is no longer explicitly dirty. + setClean(entry); + } + return valueGet(entry.value); +} +function recomputeNewValue(entry, args) { + entry.recomputing = true; + const { normalizeResult } = entry; + let oldValueCopy; + if (normalizeResult && entry.value.length === 1) { + oldValueCopy = valueCopy(entry.value); + } + // Make entry.value an empty array, representing an unknown value. + entry.value.length = 0; + try { + // If entry.fn succeeds, entry.value will become a normal Value. + entry.value[0] = entry.fn.apply(null, args); + // If we have a viable oldValueCopy to compare with the (successfully + // recomputed) new entry.value, and they are not already === identical, give + // normalizeResult a chance to pick/choose/reuse parts of oldValueCopy[0] + // and/or entry.value[0] to determine the final cached entry.value. + if (normalizeResult && oldValueCopy && !valueIs(oldValueCopy, entry.value)) { + try { + entry.value[0] = normalizeResult(entry.value[0], oldValueCopy[0]); + } + catch (_a) { + // If normalizeResult throws, just use the newer value, rather than + // saving the exception as entry.value[1]. + } + } + } + catch (e) { + // If entry.fn throws, entry.value will hold that exception. + entry.value[1] = e; + } + // Either way, this line is always reached. + entry.recomputing = false; +} +function mightBeDirty(entry) { + return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); +} +function setClean(entry) { + entry.dirty = false; + if (mightBeDirty(entry)) { + // This Entry may still have dirty children, in which case we can't + // let our parents know we're clean just yet. + return; + } + reportClean(entry); +} +function reportDirty(child) { + eachParent(child, reportDirtyChild); +} +function reportClean(child) { + eachParent(child, reportCleanChild); +} +function eachParent(child, callback) { + const parentCount = child.parents.size; + if (parentCount) { + const parents = arrayFromSet(child.parents); + for (let i = 0; i < parentCount; ++i) { + callback(parents[i], child); + } + } +} +// Let a parent Entry know that one of its children may be dirty. +function reportDirtyChild(parent, child) { + // Must have called rememberParent(child) before calling + // reportDirtyChild(parent, child). + assert(parent.childValues.has(child)); + assert(mightBeDirty(child)); + const parentWasClean = !mightBeDirty(parent); + if (!parent.dirtyChildren) { + parent.dirtyChildren = emptySetPool.pop() || new Set; + } + else if (parent.dirtyChildren.has(child)) { + // If we already know this child is dirty, then we must have already + // informed our own parents that we are dirty, so we can terminate + // the recursion early. + return; + } + parent.dirtyChildren.add(child); + // If parent was clean before, it just became (possibly) dirty (according to + // mightBeDirty), since we just added child to parent.dirtyChildren. + if (parentWasClean) { + reportDirty(parent); + } +} +// Let a parent Entry know that one of its children is no longer dirty. +function reportCleanChild(parent, child) { + // Must have called rememberChild(child) before calling + // reportCleanChild(parent, child). + assert(parent.childValues.has(child)); + assert(!mightBeDirty(child)); + const childValue = parent.childValues.get(child); + if (childValue.length === 0) { + parent.childValues.set(child, valueCopy(child.value)); + } + else if (!valueIs(childValue, child.value)) { + parent.setDirty(); + } + removeDirtyChild(parent, child); + if (mightBeDirty(parent)) { + return; + } + reportClean(parent); +} +function removeDirtyChild(parent, child) { + const dc = parent.dirtyChildren; + if (dc) { + dc.delete(child); + if (dc.size === 0) { + if (emptySetPool.length < POOL_TARGET_SIZE) { + emptySetPool.push(dc); + } + parent.dirtyChildren = null; + } + } +} +// Removes all children from this entry and returns an array of the +// removed children. +function forgetChildren(parent) { + if (parent.childValues.size > 0) { + parent.childValues.forEach((_value, child) => { + forgetChild(parent, child); + }); + } + // Remove this parent Entry from any sets to which it was added by the + // addToSet method. + parent.forgetDeps(); + // After we forget all our children, this.dirtyChildren must be empty + // and therefore must have been reset to null. + assert(parent.dirtyChildren === null); +} +function forgetChild(parent, child) { + child.parents.delete(parent); + parent.childValues.delete(child); + removeDirtyChild(parent, child); +} +function maybeSubscribe(entry, args) { + if (typeof entry.subscribe === "function") { + try { + maybeUnsubscribe(entry); // Prevent double subscriptions. + entry.unsubscribe = entry.subscribe.apply(null, args); + } + catch (e) { + // If this Entry has a subscribe function and it threw an exception + // (or an unsubscribe function it previously returned now throws), + // return false to indicate that we were not able to subscribe (or + // unsubscribe), and this Entry should remain dirty. + entry.setDirty(); + return false; + } + } + // Returning true indicates either that there was no entry.subscribe + // function or that it succeeded. + return true; +} +//# sourceMappingURL=entry.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/entry.js.map b/graphql-subscription/node_modules/optimism/lib/entry.js.map new file mode 100644 index 0000000..e6fe31f --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/entry.js.map @@ -0,0 +1 @@ +{"version":3,"file":"entry.js","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAkB,MAAM,cAAc,CAAC;AAE9E,MAAM,YAAY,GAAe,EAAE,CAAC;AACpC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,uEAAuE;AACvE,+BAA+B;AAC/B,SAAS,MAAM,CAAC,SAAc,EAAE,eAAwB;IACtD,IAAI,CAAE,SAAS,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,mBAAmB,CAAC,CAAC;KACzD;AACH,CAAC;AASD,SAAS,OAAO,CAAC,CAAa,EAAE,CAAa;IAC3C,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC;IACrB,OAAO;IACL,8CAA8C;IAC9C,GAAG,GAAG,CAAC;QACP,kEAAkE;QAClE,GAAG,KAAK,CAAC,CAAC,MAAM;QAChB,sDAAsD;QACtD,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAI,KAAe;IAClC,QAAQ,KAAK,CAAC,MAAM,EAAE;QACpB,KAAK,CAAC,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QACzC,KAAK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/helpers.d.ts b/graphql-subscription/node_modules/optimism/lib/helpers.d.ts new file mode 100644 index 0000000..75812be --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/helpers.d.ts @@ -0,0 +1,7 @@ +export type NoInfer = [T][T extends any ? 0 : never]; +export declare const hasOwnProperty: (v: PropertyKey) => boolean; +export declare const arrayFromSet: (set: Set) => T[]; +export type Unsubscribable = { + unsubscribe?: void | (() => any); +}; +export declare function maybeUnsubscribe(entryOrDep: Unsubscribable): void; diff --git a/graphql-subscription/node_modules/optimism/lib/helpers.js b/graphql-subscription/node_modules/optimism/lib/helpers.js new file mode 100644 index 0000000..53c5352 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/helpers.js @@ -0,0 +1,15 @@ +export const { hasOwnProperty, } = Object.prototype; +export const arrayFromSet = Array.from || + function (set) { + const array = []; + set.forEach(item => array.push(item)); + return array; + }; +export function maybeUnsubscribe(entryOrDep) { + const { unsubscribe } = entryOrDep; + if (typeof unsubscribe === "function") { + entryOrDep.unsubscribe = void 0; + unsubscribe(); + } +} +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/helpers.js.map b/graphql-subscription/node_modules/optimism/lib/helpers.js.map new file mode 100644 index 0000000..b4f4ec1 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/helpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,EACX,cAAc,GACf,GAAG,MAAM,CAAC,SAAS,CAAC;AAErB,MAAM,CAAC,MAAM,YAAY,GACvB,KAAK,CAAC,IAAI;IACV,UAAU,GAAG;QACX,MAAM,KAAK,GAAU,EAAE,CAAC;QACxB,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AAMJ,MAAM,UAAU,gBAAgB,CAAC,UAA0B;IACzD,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IACnC,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;QACrC,UAAU,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;QAChC,WAAW,EAAE,CAAC;KACf;AACH,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/index.d.ts b/graphql-subscription/node_modules/optimism/lib/index.d.ts new file mode 100644 index 0000000..06c3327 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/index.d.ts @@ -0,0 +1,36 @@ +import { Trie } from "@wry/trie"; +import { CommonCache } from "@wry/caches"; +import { Entry } from "./entry.js"; +import type { NoInfer } from "./helpers.js"; +export { bindContext, noContext, nonReactive, setTimeout, asyncFromGen, Slot, } from "./context.js"; +export { dep, OptimisticDependencyFunction } from "./dep.js"; +export declare function defaultMakeCacheKey(...args: any[]): object; +export { Trie as KeyTrie }; +export type OptimisticWrapperFunction = ((...args: TArgs) => TResult) & { + readonly size: number; + options: OptionsWithCacheInstance; + dirty: (...args: TKeyArgs) => void; + dirtyKey: (key: TCacheKey | undefined) => void; + peek: (...args: TKeyArgs) => TResult | undefined; + peekKey: (key: TCacheKey | undefined) => TResult | undefined; + forget: (...args: TKeyArgs) => boolean; + forgetKey: (key: TCacheKey | undefined) => boolean; + getKey: (...args: TArgs) => TCacheKey | undefined; + makeCacheKey: (...args: TKeyArgs) => TCacheKey | undefined; +}; +export { CommonCache }; +export interface CommonCacheConstructor extends Function { + new >(max?: number, dispose?: (value: V, key?: K) => void): CommonCache; +} +export type OptimisticWrapOptions = { + max?: number; + keyArgs?: (...args: TArgs) => TKeyArgs; + makeCacheKey?: (...args: NoInfer) => TCacheKey | undefined; + normalizeResult?: (newer: TResult, older: TResult) => TResult; + subscribe?: (...args: TArgs) => void | (() => any); + cache?: CommonCache, Entry, NoInfer>> | CommonCacheConstructor, NoInfer, NoInfer>; +}; +export interface OptionsWithCacheInstance extends OptimisticWrapOptions { + cache: CommonCache, Entry, NoInfer>>; +} +export declare function wrap(originalFunction: (...args: TArgs) => TResult, { max, keyArgs, makeCacheKey, normalizeResult, subscribe, cache: cacheOption, }?: OptimisticWrapOptions): OptimisticWrapperFunction; diff --git a/graphql-subscription/node_modules/optimism/lib/index.js b/graphql-subscription/node_modules/optimism/lib/index.js new file mode 100644 index 0000000..c0faaa0 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/index.js @@ -0,0 +1,113 @@ +import { Trie } from "@wry/trie"; +import { StrongCache } from "@wry/caches"; +import { Entry } from "./entry.js"; +import { parentEntrySlot } from "./context.js"; +// These helper functions are important for making optimism work with +// asynchronous code. In order to register parent-child dependencies, +// optimism needs to know about any currently active parent computations. +// In ordinary synchronous code, the parent context is implicit in the +// execution stack, but asynchronous code requires some extra guidance in +// order to propagate context from one async task segment to the next. +export { bindContext, noContext, nonReactive, setTimeout, asyncFromGen, Slot, } from "./context.js"; +// A lighter-weight dependency, similar to OptimisticWrapperFunction, except +// with only one argument, no makeCacheKey, no wrapped function to recompute, +// and no result value. Useful for representing dependency leaves in the graph +// of computation. Subscriptions are supported. +export { dep } from "./dep.js"; +// The defaultMakeCacheKey function is remarkably powerful, because it gives +// a unique object for any shallow-identical list of arguments. If you need +// to implement a custom makeCacheKey function, you may find it helpful to +// delegate the final work to defaultMakeCacheKey, which is why we export it +// here. However, you may want to avoid defaultMakeCacheKey if your runtime +// does not support WeakMap, or you have the ability to return a string key. +// In those cases, just write your own custom makeCacheKey functions. +let defaultKeyTrie; +export function defaultMakeCacheKey(...args) { + const trie = defaultKeyTrie || (defaultKeyTrie = new Trie(typeof WeakMap === "function")); + return trie.lookupArray(args); +} +// If you're paranoid about memory leaks, or you want to avoid using WeakMap +// under the hood, but you still need the behavior of defaultMakeCacheKey, +// import this constructor to create your own tries. +export { Trie as KeyTrie }; +; +const caches = new Set(); +export function wrap(originalFunction, { max = Math.pow(2, 16), keyArgs, makeCacheKey = defaultMakeCacheKey, normalizeResult, subscribe, cache: cacheOption = StrongCache, } = Object.create(null)) { + const cache = typeof cacheOption === "function" + ? new cacheOption(max, entry => entry.dispose()) + : cacheOption; + const optimistic = function () { + const key = makeCacheKey.apply(null, keyArgs ? keyArgs.apply(null, arguments) : arguments); + if (key === void 0) { + return originalFunction.apply(null, arguments); + } + let entry = cache.get(key); + if (!entry) { + cache.set(key, entry = new Entry(originalFunction)); + entry.normalizeResult = normalizeResult; + entry.subscribe = subscribe; + // Give the Entry the ability to trigger cache.delete(key), even though + // the Entry itself does not know about key or cache. + entry.forget = () => cache.delete(key); + } + const value = entry.recompute(Array.prototype.slice.call(arguments)); + // Move this entry to the front of the least-recently used queue, + // since we just finished computing its value. + cache.set(key, entry); + caches.add(cache); + // Clean up any excess entries in the cache, but only if there is no + // active parent entry, meaning we're not in the middle of a larger + // computation that might be flummoxed by the cleaning. + if (!parentEntrySlot.hasValue()) { + caches.forEach(cache => cache.clean()); + caches.clear(); + } + return value; + }; + Object.defineProperty(optimistic, "size", { + get: () => cache.size, + configurable: false, + enumerable: false, + }); + Object.freeze(optimistic.options = { + max, + keyArgs, + makeCacheKey, + normalizeResult, + subscribe, + cache, + }); + function dirtyKey(key) { + const entry = key && cache.get(key); + if (entry) { + entry.setDirty(); + } + } + optimistic.dirtyKey = dirtyKey; + optimistic.dirty = function dirty() { + dirtyKey(makeCacheKey.apply(null, arguments)); + }; + function peekKey(key) { + const entry = key && cache.get(key); + if (entry) { + return entry.peek(); + } + } + optimistic.peekKey = peekKey; + optimistic.peek = function peek() { + return peekKey(makeCacheKey.apply(null, arguments)); + }; + function forgetKey(key) { + return key ? cache.delete(key) : false; + } + optimistic.forgetKey = forgetKey; + optimistic.forget = function forget() { + return forgetKey(makeCacheKey.apply(null, arguments)); + }; + optimistic.makeCacheKey = makeCacheKey; + optimistic.getKey = keyArgs ? function getKey() { + return makeCacheKey.apply(null, keyArgs.apply(null, arguments)); + } : makeCacheKey; + return Object.freeze(optimistic); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/lib/index.js.map b/graphql-subscription/node_modules/optimism/lib/index.js.map new file mode 100644 index 0000000..455784d --- /dev/null +++ b/graphql-subscription/node_modules/optimism/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAe,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,KAAK,EAAY,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,qEAAqE;AACrE,qEAAqE;AACrE,yEAAyE;AACzE,sEAAsE;AACtE,yEAAyE;AACzE,sEAAsE;AACtE,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,YAAY,EACZ,IAAI,GACL,MAAM,cAAc,CAAC;AAEtB,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,+CAA+C;AAC/C,OAAO,EAAE,GAAG,EAAgC,MAAM,UAAU,CAAC;AAE7D,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,qEAAqE;AACrE,IAAI,cAAwC,CAAC;AAC7C,MAAM,UAAU,mBAAmB,CAAC,GAAG,IAAW;IAChD,MAAM,IAAI,GAAG,cAAc,IAAI,CAC7B,cAAc,GAAG,IAAI,IAAI,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC,CACzD,CAAC;IACF,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,4EAA4E;AAC5E,0EAA0E;AAC1E,oDAAoD;AACpD,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,CAAA;AAqFzB,CAAC;AAEF,MAAM,M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IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;SACrB;IACH,CAAC;IACD,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAC7B,UAAU,CAAC,IAAI,GAAG,SAAS,IAAI;QAC7B,OAAO,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF,SAAS,SAAS,CAAC,GAA0B;QAC3C,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,CAAC;IACD,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,MAAM,GAAG,SAAS,MAAM;QACjC,OAAO,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC;IAEF,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC;IACvC,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,MAAM;QAC3C,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,SAAgB,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC,CAAC,YAAyD,CAAC;IAE9D,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/LICENSE b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/LICENSE new file mode 100644 index 0000000..8a112f6 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2021 Ben Newman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/README.md b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/README.md new file mode 100644 index 0000000..c838b3f --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/README.md @@ -0,0 +1,4 @@ +# @wry/trie + +A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +object keys weakly, yet can also hold non-object keys, unlike `WeakMap`. diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs new file mode 100644 index 0000000..bbc9c46 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs @@ -0,0 +1,72 @@ +'use strict'; + +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +var defaultMakeData = function () { return Object.create(null); }; +// Useful for processing arguments objects as well as arrays. +var _a = Array.prototype, forEach = _a.forEach, slice = _a.slice; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var Trie = /** @class */ (function () { + function Trie(weakness, makeData) { + if (weakness === void 0) { weakness = true; } + if (makeData === void 0) { makeData = defaultMakeData; } + this.weakness = weakness; + this.makeData = makeData; + } + Trie.prototype.lookup = function () { + var array = []; + for (var _i = 0; _i < arguments.length; _i++) { + array[_i] = arguments[_i]; + } + return this.lookupArray(array); + }; + Trie.prototype.lookupArray = function (array) { + var node = this; + forEach.call(array, function (key) { return node = node.getChildTrie(key); }); + return hasOwnProperty.call(node, "data") + ? node.data + : node.data = this.makeData(slice.call(array)); + }; + Trie.prototype.peek = function () { + var array = []; + for (var _i = 0; _i < arguments.length; _i++) { + array[_i] = arguments[_i]; + } + return this.peekArray(array); + }; + Trie.prototype.peekArray = function (array) { + var node = this; + for (var i = 0, len = array.length; node && i < len; ++i) { + var map = this.weakness && isObjRef(array[i]) ? node.weak : node.strong; + node = map && map.get(array[i]); + } + return node && node.data; + }; + Trie.prototype.getChildTrie = function (key) { + var map = this.weakness && isObjRef(key) + ? this.weak || (this.weak = new WeakMap()) + : this.strong || (this.strong = new Map()); + var child = map.get(key); + if (!child) + map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + }; + return Trie; +}()); +function isObjRef(value) { + switch (typeof value) { + case "object": + if (value === null) + break; + // Fall through to return true... + case "function": + return true; + } + return false; +} + +exports.Trie = Trie; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.map b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.map new file mode 100644 index 0000000..184d47d --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.cjs","sources":["es5/index.js"],"sourcesContent":["// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds\n// object keys weakly, yet can also hold non-object keys, unlike the\n// native `WeakMap`.\n// If no makeData function is supplied, the looked-up data will be an empty,\n// null-prototype Object.\nvar defaultMakeData = function () { return Object.create(null); };\n// Useful for processing arguments objects as well as arrays.\nvar _a = Array.prototype, forEach = _a.forEach, slice = _a.slice;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar Trie = /** @class */ (function () {\n function Trie(weakness, makeData) {\n if (weakness === void 0) { weakness = true; }\n if (makeData === void 0) { makeData = defaultMakeData; }\n this.weakness = weakness;\n this.makeData = makeData;\n }\n Trie.prototype.lookup = function () {\n var array = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n array[_i] = arguments[_i];\n }\n return this.lookupArray(array);\n };\n Trie.prototype.lookupArray = function (array) {\n var node = this;\n forEach.call(array, function (key) { return node = node.getChildTrie(key); });\n return hasOwnProperty.call(node, \"data\")\n ? node.data\n : node.data = this.makeData(slice.call(array));\n };\n Trie.prototype.peek = function () {\n var array = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n array[_i] = arguments[_i];\n }\n return this.peekArray(array);\n };\n Trie.prototype.peekArray = function (array) {\n var node = this;\n for (var i = 0, len = array.length; node && i < len; ++i) {\n var map = this.weakness && isObjRef(array[i]) ? node.weak : node.strong;\n node = map && map.get(array[i]);\n }\n return node && node.data;\n };\n Trie.prototype.getChildTrie = function (key) {\n var map = this.weakness && isObjRef(key)\n ? this.weak || (this.weak = new WeakMap())\n : this.strong || (this.strong = new Map());\n var child = map.get(key);\n if (!child)\n map.set(key, child = new Trie(this.weakness, this.makeData));\n return child;\n };\n return Trie;\n}());\nexport { Trie };\nfunction isObjRef(value) {\n switch (typeof value) {\n case \"object\":\n if (value === null)\n break;\n // Fall through to return true...\n case \"function\":\n return true;\n }\n return false;\n}\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,IAAI,eAAe,GAAG,YAAY,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAA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AAG,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC;AAChD,cAAc,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;AACtD,cAAc,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;AACvD,QAAQ,IAAI,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjC,QAAQ,IAAI,CAAC,KAAK;AAClB,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzE,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK,CAAC;AACN,IAAI,OAAO,IAAI,CAAC;AAChB,CAAC,EAAE,EAAE;AAEL,SAAS,QAAQ,CAAC,KAAK,EAAE;AACzB,IAAI,QAAQ,OAAO,KAAK;AACxB,QAAQ,KAAK,QAAQ;AACrB,YAAY,IAAI,KAAK,KAAK,IAAI;AAC9B,gBAAgB,MAAM;AACtB;AACA,QAAQ,KAAK,UAAU;AACvB,YAAY,OAAO,IAAI,CAAC;AACxB,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.native.js b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.native.js new file mode 100644 index 0000000..bbc9c46 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/bundle.cjs.native.js @@ -0,0 +1,72 @@ +'use strict'; + +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +var defaultMakeData = function () { return Object.create(null); }; +// Useful for processing arguments objects as well as arrays. +var _a = Array.prototype, forEach = _a.forEach, slice = _a.slice; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var Trie = /** @class */ (function () { + function Trie(weakness, makeData) { + if (weakness === void 0) { weakness = true; } + if (makeData === void 0) { makeData = defaultMakeData; } + this.weakness = weakness; + this.makeData = makeData; + } + Trie.prototype.lookup = function () { + var array = []; + for (var _i = 0; _i < arguments.length; _i++) { + array[_i] = arguments[_i]; + } + return this.lookupArray(array); + }; + Trie.prototype.lookupArray = function (array) { + var node = this; + forEach.call(array, function (key) { return node = node.getChildTrie(key); }); + return hasOwnProperty.call(node, "data") + ? node.data + : node.data = this.makeData(slice.call(array)); + }; + Trie.prototype.peek = function () { + var array = []; + for (var _i = 0; _i < arguments.length; _i++) { + array[_i] = arguments[_i]; + } + return this.peekArray(array); + }; + Trie.prototype.peekArray = function (array) { + var node = this; + for (var i = 0, len = array.length; node && i < len; ++i) { + var map = this.weakness && isObjRef(array[i]) ? node.weak : node.strong; + node = map && map.get(array[i]); + } + return node && node.data; + }; + Trie.prototype.getChildTrie = function (key) { + var map = this.weakness && isObjRef(key) + ? this.weak || (this.weak = new WeakMap()) + : this.strong || (this.strong = new Map()); + var child = map.get(key); + if (!child) + map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + }; + return Trie; +}()); +function isObjRef(value) { + switch (typeof value) { + case "object": + if (value === null) + break; + // Fall through to return true... + case "function": + return true; + } + return false; +} + +exports.Trie = Trie; +//# sourceMappingURL=bundle.cjs.map diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.d.ts b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.d.ts new file mode 100644 index 0000000..983a3c2 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.d.ts @@ -0,0 +1,13 @@ +export declare class Trie { + private weakness; + private makeData; + private weak?; + private strong?; + private data?; + constructor(weakness?: boolean, makeData?: (array: any[]) => Data); + lookup(...array: T): Data; + lookupArray(array: T): Data; + peek(...array: T): Data | undefined; + peekArray(array: T): Data | undefined; + private getChildTrie; +} diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js new file mode 100644 index 0000000..e227c14 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js @@ -0,0 +1,57 @@ +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +const defaultMakeData = () => Object.create(null); +// Useful for processing arguments objects as well as arrays. +const { forEach, slice } = Array.prototype; +const { hasOwnProperty } = Object.prototype; +export class Trie { + constructor(weakness = true, makeData = defaultMakeData) { + this.weakness = weakness; + this.makeData = makeData; + } + lookup(...array) { + return this.lookupArray(array); + } + lookupArray(array) { + let node = this; + forEach.call(array, key => node = node.getChildTrie(key)); + return hasOwnProperty.call(node, "data") + ? node.data + : node.data = this.makeData(slice.call(array)); + } + peek(...array) { + return this.peekArray(array); + } + peekArray(array) { + let node = this; + for (let i = 0, len = array.length; node && i < len; ++i) { + const map = this.weakness && isObjRef(array[i]) ? node.weak : node.strong; + node = map && map.get(array[i]); + } + return node && node.data; + } + getChildTrie(key) { + const map = this.weakness && isObjRef(key) + ? this.weak || (this.weak = new WeakMap()) + : this.strong || (this.strong = new Map()); + let child = map.get(key); + if (!child) + map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + } +} +function isObjRef(value) { + switch (typeof value) { + case "object": + if (value === null) + break; + // Fall through to return true... + case "function": + return true; + } + return false; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js.map b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js.map new file mode 100644 index 0000000..4c0fca5 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,oEAAoE;AACpE,oBAAoB;AAEpB,4EAA4E;AAC5E,yBAAyB;AACzB,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAElD,6DAA6D;AAC7D,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;AAC3C,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;AAE5C,MAAM,OAAO,IAAI;IAQf,YACU,WAAW,IAAI,EACf,WAAmC,eAAe;QADlD,aAAQ,GAAR,QAAQ,CAAO;QACf,aAAQ,GAAR,QAAQ,CAA0C;IACzD,CAAC;IAEG,MAAM,CAAkB,GAAG,KAAQ;QACxC,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAEM,WAAW,CAA+B,KAAQ;QACvD,IAAI,IAAI,GAAe,IAAI,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;YACtC,CAAC,CAAC,IAAI,CAAC,IAAY;YACnB,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,CAAC;IAEM,IAAI,CAAkB,GAAG,KAAQ;QACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEM,SAAS,CAA+B,KAAQ;QACrD,IAAI,IAAI,GA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IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/package.json b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/package.json new file mode 100644 index 0000000..23d340c --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/package.json @@ -0,0 +1,46 @@ +{ + "name": "@wry/trie", + "version": "0.4.3", + "author": "Ben Newman ", + "description": "https://en.wikipedia.org/wiki/Trie", + "license": "MIT", + "type": "module", + "main": "lib/bundle.cjs", + "module": "lib/index.js", + "types": "lib/index.d.ts", + "keywords": [ + "trie", + "prefix", + "weak", + "dictionary", + "lexicon" + ], + "homepage": "https://github.com/benjamn/wryware", + "repository": { + "type": "git", + "url": "git+https://github.com/benjamn/wryware.git" + }, + "bugs": { + "url": "https://github.com/benjamn/wryware/issues" + }, + "scripts": { + "build": "npm run clean:before && npm run tsc && npm run rollup && npm run clean:after", + "clean:before": "rimraf lib", + "tsc": "npm run tsc:es5 && npm run tsc:esm", + "tsc:es5": "tsc -p tsconfig.es5.json", + "tsc:esm": "tsc -p tsconfig.json", + "rollup": "rollup -c rollup.config.js", + "clean:after": "rimraf lib/es5", + "prepare": "npm run build", + "test:cjs": "../../shared/test.sh lib/tests/bundle.cjs", + "test:esm": "../../shared/test.sh lib/tests/bundle.js", + "test": "npm run test:esm && npm run test:cjs" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + }, + "gitHead": "307b3f7d1ce327f81c91d8a6cda01e159d7b934b" +} diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/rollup.config.js b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/rollup.config.js new file mode 100644 index 0000000..ef8e33b --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/rollup.config.js @@ -0,0 +1 @@ +export { default } from "../../shared/rollup.config.js"; diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/index.ts b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/index.ts new file mode 100644 index 0000000..b53e1b9 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/index.ts @@ -0,0 +1,74 @@ +// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds +// object keys weakly, yet can also hold non-object keys, unlike the +// native `WeakMap`. + +// If no makeData function is supplied, the looked-up data will be an empty, +// null-prototype Object. +const defaultMakeData = () => Object.create(null); + +// Useful for processing arguments objects as well as arrays. +const { forEach, slice } = Array.prototype; +const { hasOwnProperty } = Object.prototype; + +export class Trie { + // Since a `WeakMap` cannot hold primitive values as keys, we need a + // backup `Map` instance to hold primitive keys. Both `this._weakMap` + // and `this._strongMap` are lazily initialized. + private weak?: WeakMap>; + private strong?: Map>; + private data?: Data; + + constructor( + private weakness = true, + private makeData: (array: any[]) => Data = defaultMakeData, + ) {} + + public lookup(...array: T): Data { + return this.lookupArray(array); + } + + public lookupArray(array: T): Data { + let node: Trie = this; + forEach.call(array, key => node = node.getChildTrie(key)); + return hasOwnProperty.call(node, "data") + ? node.data as Data + : node.data = this.makeData(slice.call(array)); + } + + public peek(...array: T): Data | undefined { + return this.peekArray(array); + } + + public peekArray(array: T): Data | undefined { + let node: Trie | undefined = this; + + for (let i = 0, len = array.length; node && i < len; ++i) { + const map: Trie["weak" | "strong"] = + this.weakness && isObjRef(array[i]) ? node.weak : node.strong; + + node = map && map.get(array[i]); + } + + return node && node.data; + } + + private getChildTrie(key: any) { + const map = this.weakness && isObjRef(key) + ? this.weak || (this.weak = new WeakMap>()) + : this.strong || (this.strong = new Map>()); + let child = map.get(key); + if (!child) map.set(key, child = new Trie(this.weakness, this.makeData)); + return child; + } +} + +function isObjRef(value: any) { + switch (typeof value) { + case "object": + if (value === null) break; + // Fall through to return true... + case "function": + return true; + } + return false; +} diff --git a/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/tests/main.ts b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/tests/main.ts new file mode 100644 index 0000000..a6e6834 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/node_modules/@wry/trie/src/tests/main.ts @@ -0,0 +1,112 @@ +import * as assert from "assert"; +import { Trie } from "../index.js"; + +describe("Trie", function () { + it("can be imported", function () { + assert.strictEqual(typeof Trie, "function"); + }); + + it("can hold objects weakly", function () { + const trie = new Trie(true); + assert.strictEqual((trie as any).weakness, true); + const obj1 = {}; + assert.strictEqual( + trie.lookup(obj1, 2, 3), + trie.lookup(obj1, 2, 3), + ); + const obj2 = {}; + assert.notStrictEqual( + trie.lookup(1, obj2), + trie.lookup(1, obj2, 3), + ); + assert.strictEqual((trie as any).weak.has(obj1), true); + assert.strictEqual((trie as any).strong.has(obj1), false); + assert.strictEqual((trie as any).strong.get(1).weak.has(obj2), true); + assert.strictEqual((trie as any).strong.get(1).weak.get(obj2).strong.has(3), true); + }); + + it("can disable WeakMap", function () { + const trie = new Trie(false); + assert.strictEqual((trie as any).weakness, false); + const obj1 = {}; + assert.strictEqual( + trie.lookup(obj1, 2, 3), + trie.lookup(obj1, 2, 3), + ); + const obj2 = {}; + assert.notStrictEqual( + trie.lookup(1, obj2), + trie.lookup(1, obj2, 3), + ); + assert.strictEqual(typeof (trie as any).weak, "undefined"); + assert.strictEqual((trie as any).strong.has(obj1), true); + assert.strictEqual((trie as any).strong.has(1), true); + assert.strictEqual((trie as any).strong.get(1).strong.has(obj2), true); + assert.strictEqual((trie as any).strong.get(1).strong.get(obj2).strong.has(3), true); + }); + + it("can produce data types other than Object", function () { + const symbolTrie = new Trie(true, args => Symbol.for(args.join("."))); + const s123 = symbolTrie.lookup(1, 2, 3); + assert.strictEqual(s123.toString(), "Symbol(1.2.3)"); + assert.strictEqual(s123, symbolTrie.lookup(1, 2, 3)); + assert.strictEqual(s123, symbolTrie.lookupArray([1, 2, 3])); + const sNull = symbolTrie.lookup(); + assert.strictEqual(sNull.toString(), "Symbol()"); + + const regExpTrie = new Trie(true, args => new RegExp("^(" + args.join("|") + ")$")); + const rXYZ = regExpTrie.lookup("x", "y", "z"); + assert.strictEqual(rXYZ.test("w"), false); + assert.strictEqual(rXYZ.test("x"), true); + assert.strictEqual(rXYZ.test("y"), true); + assert.strictEqual(rXYZ.test("z"), true); + assert.strictEqual(String(rXYZ), "/^(x|y|z)$/"); + + class Data { + constructor(public readonly args: any[]) {} + } + const dataTrie = new Trie(true, args => new Data(args)); + function checkData(...args: any[]) { + const data = dataTrie.lookupArray(args); + assert.strictEqual(data instanceof Data, true); + assert.notStrictEqual(data.args, args); + assert.deepStrictEqual(data.args, args); + assert.strictEqual(data, dataTrie.lookup(...args)); + assert.strictEqual(data, dataTrie.lookupArray(arguments)); + return data; + } + const datas = [ + checkData(), + checkData(1), + checkData(1, 2), + checkData(2), + checkData(2, 3), + checkData(true, "a"), + checkData(/asdf/i, "b", function oyez() {}), + ]; + // Verify that all Data objects are distinct. + assert.strictEqual(new Set(datas).size, datas.length); + }); + + it("can peek at values", function () { + const trie = new Trie(true, (args) => args); + + const obj = {}; + assert.strictEqual(trie.peek(1, 2, 'x'), undefined); + assert.strictEqual(trie.peek(1, 2, obj), undefined); + assert.strictEqual(trie.peekArray([1, 2, 'x']), undefined); + assert.strictEqual(trie.peekArray([1, 2, obj]), undefined); + // peek/peekArray should not create anything on its own + assert.strictEqual(trie['weak'], undefined); + assert.strictEqual(trie['strong'], undefined); + assert.strictEqual(trie['data'], undefined); + + const data1 = trie.lookup(1, 2, 'x'); + const data2 = trie.lookup(1, 2, obj); + + assert.strictEqual(trie.peek(1, 2, 'x'), data1); + assert.strictEqual(trie.peek(1, 2, obj), data2); + assert.strictEqual(trie.peekArray([1, 2, 'x']), data1); + assert.strictEqual(trie.peekArray([1, 2, obj]), data2); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/package.json b/graphql-subscription/node_modules/optimism/package.json new file mode 100644 index 0000000..43ad55f --- /dev/null +++ b/graphql-subscription/node_modules/optimism/package.json @@ -0,0 +1,56 @@ +{ + "name": "optimism", + "version": "0.18.0", + "author": "Ben Newman ", + "description": "Composable reactive caching with efficient invalidation.", + "keywords": [ + "caching", + "cache", + "invalidation", + "reactive", + "reactivity", + "dependency", + "tracking", + "tracker", + "memoization" + ], + "type": "module", + "main": "lib/bundle.cjs", + "module": "lib/index.js", + "types": "lib/index.d.ts", + "license": "MIT", + "homepage": "https://github.com/benjamn/optimism#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/benjamn/optimism.git" + }, + "bugs": { + "url": "https://github.com/benjamn/optimism/issues" + }, + "scripts": { + "build": "npm run clean && npm run tsc:es5 && tsc && rollup -c && rimraf lib/es5", + "tsc:es5": "tsc -p tsconfig.es5.json", + "clean": "rimraf lib", + "prepare": "npm run build", + "mocha": "mocha --require source-map-support/register --reporter spec --full-trace", + "test:cjs": "npm run mocha -- lib/tests/bundle.cjs", + "test:esm": "npm run mocha -- lib/tests/bundle.js", + "test": "npm run test:esm && npm run test:cjs" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^20.2.5", + "@wry/equality": "^0.5.7", + "mocha": "^10.2.0", + "rimraf": "^5.0.0", + "rollup": "^3.20.0", + "source-map-support": "^0.5.19", + "typescript": "^5.0.2" + }, + "dependencies": { + "@wry/caches": "^1.0.0", + "@wry/context": "^0.7.0", + "@wry/trie": "^0.4.3", + "tslib": "^2.3.0" + } +} diff --git a/graphql-subscription/node_modules/optimism/src/context.ts b/graphql-subscription/node_modules/optimism/src/context.ts new file mode 100644 index 0000000..fed6886 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/context.ts @@ -0,0 +1,16 @@ +import { Slot } from "@wry/context"; +import { AnyEntry } from "./entry.js"; + +export const parentEntrySlot = new Slot(); + +export function nonReactive(fn: () => R): R { + return parentEntrySlot.withValue(void 0, fn); +} + +export { Slot } +export { + bind as bindContext, + noContext, + setTimeout, + asyncFromGen, +} from "@wry/context"; diff --git a/graphql-subscription/node_modules/optimism/src/dep.ts b/graphql-subscription/node_modules/optimism/src/dep.ts new file mode 100644 index 0000000..d5aa444 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/dep.ts @@ -0,0 +1,68 @@ +import { AnyEntry } from "./entry.js"; +import { OptimisticWrapOptions } from "./index.js"; +import { parentEntrySlot } from "./context.js"; +import { + hasOwnProperty, + Unsubscribable, + maybeUnsubscribe, + arrayFromSet, + } from "./helpers.js"; + +type EntryMethodName = keyof typeof EntryMethods; +const EntryMethods = { + setDirty: true, // Mark parent Entry as needing to be recomputed (default) + dispose: true, // Detach parent Entry from parents and children, but leave in LRU cache + forget: true, // Fully remove parent Entry from LRU cache and computation graph +}; + +export type OptimisticDependencyFunction = + ((key: TKey) => void) & { + dirty: (key: TKey, entryMethodName?: EntryMethodName) => void; + }; + +export type Dep = Set & { + subscribe: OptimisticWrapOptions<[TKey]>["subscribe"]; +} & Unsubscribable; + +export function dep(options?: { + subscribe: Dep["subscribe"]; +}) { + const depsByKey = new Map>(); + const subscribe = options && options.subscribe; + + function depend(key: TKey) { + const parent = parentEntrySlot.getValue(); + if (parent) { + let dep = depsByKey.get(key); + if (!dep) { + depsByKey.set(key, dep = new Set as Dep); + } + parent.dependOn(dep); + if (typeof subscribe === "function") { + maybeUnsubscribe(dep); + dep.unsubscribe = subscribe(key); + } + } + } + + depend.dirty = function dirty( + key: TKey, + entryMethodName?: EntryMethodName, + ) { + const dep = depsByKey.get(key); + if (dep) { + const m: EntryMethodName = ( + entryMethodName && + hasOwnProperty.call(EntryMethods, entryMethodName) + ) ? entryMethodName : "setDirty"; + // We have to use arrayFromSet(dep).forEach instead of dep.forEach, + // because modifying a Set while iterating over it can cause elements in + // the Set to be removed from the Set before they've been iterated over. + arrayFromSet(dep).forEach(entry => entry[m]()); + depsByKey.delete(key); + maybeUnsubscribe(dep); + } + }; + + return depend as OptimisticDependencyFunction; +} diff --git a/graphql-subscription/node_modules/optimism/src/entry.ts b/graphql-subscription/node_modules/optimism/src/entry.ts new file mode 100644 index 0000000..7a767d1 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/entry.ts @@ -0,0 +1,372 @@ +import { parentEntrySlot } from "./context.js"; +import { OptimisticWrapOptions } from "./index.js"; +import { Dep } from "./dep.js"; +import { maybeUnsubscribe, arrayFromSet, Unsubscribable } from "./helpers.js"; + +const emptySetPool: Set[] = []; +const POOL_TARGET_SIZE = 100; + +// Since this package might be used browsers, we should avoid using the +// Node built-in assert module. +function assert(condition: any, optionalMessage?: string) { + if (! condition) { + throw new Error(optionalMessage || "assertion failure"); + } +} + +// Since exceptions are cached just like normal values, we need an efficient +// way of representing unknown, ordinary, and exceptional values. +type Value = + | [] // unknown + | [T] // known value + | [void, any]; // known exception + +function valueIs(a: Value, b: Value) { + const len = a.length; + return ( + // Unknown values are not equal to each other. + len > 0 && + // Both values must be ordinary (or both exceptional) to be equal. + len === b.length && + // The underlying value or exception must be the same. + a[len - 1] === b[len - 1] + ); +} + +function valueGet(value: Value): T { + switch (value.length) { + case 0: throw new Error("unknown value"); + case 1: return value[0]; + case 2: throw value[1]; + } +} + +function valueCopy(value: Value): Value { + return value.slice(0) as Value; +} + +export type AnyEntry = Entry; + +export class Entry { + public static count = 0; + + public normalizeResult: OptimisticWrapOptions["normalizeResult"]; + public subscribe: OptimisticWrapOptions["subscribe"]; + public unsubscribe: Unsubscribable["unsubscribe"]; + + public readonly parents = new Set(); + public readonly childValues = new Map>(); + + // When this Entry has children that are dirty, this property becomes + // a Set containing other Entry objects, borrowed from emptySetPool. + // When the set becomes empty, it gets recycled back to emptySetPool. + public dirtyChildren: Set | null = null; + + public dirty = true; + public recomputing = false; + public readonly value: Value = []; + + constructor( + public readonly fn: (...args: TArgs) => TValue, + ) { + ++Entry.count; + } + + public peek(): TValue | undefined { + if (this.value.length === 1 && !mightBeDirty(this)) { + rememberParent(this); + return this.value[0]; + } + } + + // This is the most important method of the Entry API, because it + // determines whether the cached this.value can be returned immediately, + // or must be recomputed. The overall performance of the caching system + // depends on the truth of the following observations: (1) this.dirty is + // usually false, (2) this.dirtyChildren is usually null/empty, and thus + // (3) valueGet(this.value) is usually returned without recomputation. + public recompute(args: TArgs): TValue { + assert(! this.recomputing, "already recomputing"); + rememberParent(this); + return mightBeDirty(this) + ? reallyRecompute(this, args) + : valueGet(this.value); + } + + public setDirty() { + if (this.dirty) return; + this.dirty = true; + reportDirty(this); + // We can go ahead and unsubscribe here, since any further dirty + // notifications we receive will be redundant, and unsubscribing may + // free up some resources, e.g. file watchers. + maybeUnsubscribe(this); + } + + public dispose() { + this.setDirty(); + + // Sever any dependency relationships with our own children, so those + // children don't retain this parent Entry in their child.parents sets, + // thereby preventing it from being fully garbage collected. + forgetChildren(this); + + // Because this entry has been kicked out of the cache (in index.js), + // we've lost the ability to find out if/when this entry becomes dirty, + // whether that happens through a subscription, because of a direct call + // to entry.setDirty(), or because one of its children becomes dirty. + // Because of this loss of future information, we have to assume the + // worst (that this entry might have become dirty very soon), so we must + // immediately mark this entry's parents as dirty. Normally we could + // just call entry.setDirty() rather than calling parent.setDirty() for + // each parent, but that would leave this entry in parent.childValues + // and parent.dirtyChildren, which would prevent the child from being + // truly forgotten. + eachParent(this, (parent, child) => { + parent.setDirty(); + forgetChild(parent, this); + }); + } + + public forget() { + // The code that creates Entry objects in index.ts will replace this method + // with one that actually removes the Entry from the cache, which will also + // trigger the entry.dispose method. + this.dispose(); + } + + private deps: Set> | null = null; + + public dependOn(dep: Dep) { + dep.add(this); + if (! this.deps) { + this.deps = emptySetPool.pop() || new Set>(); + } + this.deps.add(dep); + } + + public forgetDeps() { + if (this.deps) { + arrayFromSet(this.deps).forEach(dep => dep.delete(this)); + this.deps.clear(); + emptySetPool.push(this.deps); + this.deps = null; + } + } +} + +function rememberParent(child: AnyEntry) { + const parent = parentEntrySlot.getValue(); + if (parent) { + child.parents.add(parent); + + if (! parent.childValues.has(child)) { + parent.childValues.set(child, []); + } + + if (mightBeDirty(child)) { + reportDirtyChild(parent, child); + } else { + reportCleanChild(parent, child); + } + + return parent; + } +} + +function reallyRecompute(entry: AnyEntry, args: any[]) { + forgetChildren(entry); + + // Set entry as the parent entry while calling recomputeNewValue(entry). + parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]); + + if (maybeSubscribe(entry, args)) { + // If we successfully recomputed entry.value and did not fail to + // (re)subscribe, then this Entry is no longer explicitly dirty. + setClean(entry); + } + + return valueGet(entry.value); +} + +function recomputeNewValue(entry: AnyEntry, args: any[]) { + entry.recomputing = true; + + const { normalizeResult } = entry; + let oldValueCopy: Value | undefined; + if (normalizeResult && entry.value.length === 1) { + oldValueCopy = valueCopy(entry.value); + } + + // Make entry.value an empty array, representing an unknown value. + entry.value.length = 0; + + try { + // If entry.fn succeeds, entry.value will become a normal Value. + entry.value[0] = entry.fn.apply(null, args); + + // If we have a viable oldValueCopy to compare with the (successfully + // recomputed) new entry.value, and they are not already === identical, give + // normalizeResult a chance to pick/choose/reuse parts of oldValueCopy[0] + // and/or entry.value[0] to determine the final cached entry.value. + if (normalizeResult && oldValueCopy && !valueIs(oldValueCopy, entry.value)) { + try { + entry.value[0] = normalizeResult(entry.value[0], oldValueCopy[0]); + } catch { + // If normalizeResult throws, just use the newer value, rather than + // saving the exception as entry.value[1]. + } + } + + } catch (e) { + // If entry.fn throws, entry.value will hold that exception. + entry.value[1] = e; + } + + // Either way, this line is always reached. + entry.recomputing = false; +} + +function mightBeDirty(entry: AnyEntry) { + return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); +} + +function setClean(entry: AnyEntry) { + entry.dirty = false; + + if (mightBeDirty(entry)) { + // This Entry may still have dirty children, in which case we can't + // let our parents know we're clean just yet. + return; + } + + reportClean(entry); +} + +function reportDirty(child: AnyEntry) { + eachParent(child, reportDirtyChild); +} + +function reportClean(child: AnyEntry) { + eachParent(child, reportCleanChild); +} + +function eachParent( + child: AnyEntry, + callback: (parent: AnyEntry, child: AnyEntry) => any, +) { + const parentCount = child.parents.size; + if (parentCount) { + const parents = arrayFromSet(child.parents); + for (let i = 0; i < parentCount; ++i) { + callback(parents[i], child); + } + } +} + +// Let a parent Entry know that one of its children may be dirty. +function reportDirtyChild(parent: AnyEntry, child: AnyEntry) { + // Must have called rememberParent(child) before calling + // reportDirtyChild(parent, child). + assert(parent.childValues.has(child)); + assert(mightBeDirty(child)); + const parentWasClean = !mightBeDirty(parent); + + if (! parent.dirtyChildren) { + parent.dirtyChildren = emptySetPool.pop() || new Set; + + } else if (parent.dirtyChildren.has(child)) { + // If we already know this child is dirty, then we must have already + // informed our own parents that we are dirty, so we can terminate + // the recursion early. + return; + } + + parent.dirtyChildren.add(child); + + // If parent was clean before, it just became (possibly) dirty (according to + // mightBeDirty), since we just added child to parent.dirtyChildren. + if (parentWasClean) { + reportDirty(parent); + } +} + +// Let a parent Entry know that one of its children is no longer dirty. +function reportCleanChild(parent: AnyEntry, child: AnyEntry) { + // Must have called rememberChild(child) before calling + // reportCleanChild(parent, child). + assert(parent.childValues.has(child)); + assert(! mightBeDirty(child)); + + const childValue = parent.childValues.get(child)!; + if (childValue.length === 0) { + parent.childValues.set(child, valueCopy(child.value)); + } else if (! valueIs(childValue, child.value)) { + parent.setDirty(); + } + + removeDirtyChild(parent, child); + + if (mightBeDirty(parent)) { + return; + } + + reportClean(parent); +} + +function removeDirtyChild(parent: AnyEntry, child: AnyEntry) { + const dc = parent.dirtyChildren; + if (dc) { + dc.delete(child); + if (dc.size === 0) { + if (emptySetPool.length < POOL_TARGET_SIZE) { + emptySetPool.push(dc); + } + parent.dirtyChildren = null; + } + } +} + +// Removes all children from this entry and returns an array of the +// removed children. +function forgetChildren(parent: AnyEntry) { + if (parent.childValues.size > 0) { + parent.childValues.forEach((_value, child) => { + forgetChild(parent, child); + }); + } + + // Remove this parent Entry from any sets to which it was added by the + // addToSet method. + parent.forgetDeps(); + + // After we forget all our children, this.dirtyChildren must be empty + // and therefore must have been reset to null. + assert(parent.dirtyChildren === null); +} + +function forgetChild(parent: AnyEntry, child: AnyEntry) { + child.parents.delete(parent); + parent.childValues.delete(child); + removeDirtyChild(parent, child); +} + +function maybeSubscribe(entry: AnyEntry, args: any[]) { + if (typeof entry.subscribe === "function") { + try { + maybeUnsubscribe(entry); // Prevent double subscriptions. + entry.unsubscribe = entry.subscribe.apply(null, args); + } catch (e) { + // If this Entry has a subscribe function and it threw an exception + // (or an unsubscribe function it previously returned now throws), + // return false to indicate that we were not able to subscribe (or + // unsubscribe), and this Entry should remain dirty. + entry.setDirty(); + return false; + } + } + + // Returning true indicates either that there was no entry.subscribe + // function or that it succeeded. + return true; +} diff --git a/graphql-subscription/node_modules/optimism/src/helpers.ts b/graphql-subscription/node_modules/optimism/src/helpers.ts new file mode 100644 index 0000000..0c01ebc --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/helpers.ts @@ -0,0 +1,25 @@ +export type NoInfer = [T][T extends any ? 0 : never]; + +export const { + hasOwnProperty, +} = Object.prototype; + +export const arrayFromSet: (set: Set) => T[] = + Array.from || + function (set) { + const array: any[] = []; + set.forEach(item => array.push(item)); + return array; + }; + +export type Unsubscribable = { + unsubscribe?: void | (() => any); +} + +export function maybeUnsubscribe(entryOrDep: Unsubscribable) { + const { unsubscribe } = entryOrDep; + if (typeof unsubscribe === "function") { + entryOrDep.unsubscribe = void 0; + unsubscribe(); + } +} diff --git a/graphql-subscription/node_modules/optimism/src/index.ts b/graphql-subscription/node_modules/optimism/src/index.ts new file mode 100644 index 0000000..08366c7 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/index.ts @@ -0,0 +1,246 @@ +import { Trie } from "@wry/trie"; + +import { StrongCache, CommonCache } from "@wry/caches"; +import { Entry, AnyEntry } from "./entry.js"; +import { parentEntrySlot } from "./context.js"; +import type { NoInfer } from "./helpers.js"; + +// These helper functions are important for making optimism work with +// asynchronous code. In order to register parent-child dependencies, +// optimism needs to know about any currently active parent computations. +// In ordinary synchronous code, the parent context is implicit in the +// execution stack, but asynchronous code requires some extra guidance in +// order to propagate context from one async task segment to the next. +export { + bindContext, + noContext, + nonReactive, + setTimeout, + asyncFromGen, + Slot, +} from "./context.js"; + +// A lighter-weight dependency, similar to OptimisticWrapperFunction, except +// with only one argument, no makeCacheKey, no wrapped function to recompute, +// and no result value. Useful for representing dependency leaves in the graph +// of computation. Subscriptions are supported. +export { dep, OptimisticDependencyFunction } from "./dep.js"; + +// The defaultMakeCacheKey function is remarkably powerful, because it gives +// a unique object for any shallow-identical list of arguments. If you need +// to implement a custom makeCacheKey function, you may find it helpful to +// delegate the final work to defaultMakeCacheKey, which is why we export it +// here. However, you may want to avoid defaultMakeCacheKey if your runtime +// does not support WeakMap, or you have the ability to return a string key. +// In those cases, just write your own custom makeCacheKey functions. +let defaultKeyTrie: Trie | undefined; +export function defaultMakeCacheKey(...args: any[]): object { + const trie = defaultKeyTrie || ( + defaultKeyTrie = new Trie(typeof WeakMap === "function") + ); + return trie.lookupArray(args); +} + +// If you're paranoid about memory leaks, or you want to avoid using WeakMap +// under the hood, but you still need the behavior of defaultMakeCacheKey, +// import this constructor to create your own tries. +export { Trie as KeyTrie } + +export type OptimisticWrapperFunction< + TArgs extends any[], + TResult, + TKeyArgs extends any[] = TArgs, + TCacheKey = any, +> = ((...args: TArgs) => TResult) & { + // Get the current number of Entry objects in the LRU cache. + readonly size: number; + + // Snapshot of wrap options used to create this wrapper function. + options: OptionsWithCacheInstance; + + // "Dirty" any cached Entry stored for the given arguments, marking that Entry + // and its ancestors as potentially needing to be recomputed. The .dirty(...) + // method of an optimistic function takes the same parameter types as the + // original function by default, unless a keyArgs function is configured, and + // then it matters that .dirty takes TKeyArgs instead of TArgs. + dirty: (...args: TKeyArgs) => void; + // A version of .dirty that accepts a key returned by .getKey. + dirtyKey: (key: TCacheKey | undefined) => void; + + // Examine the current value without recomputing it. + peek: (...args: TKeyArgs) => TResult | undefined; + // A version of .peek that accepts a key returned by .getKey. + peekKey: (key: TCacheKey | undefined) => TResult | undefined; + + // Completely remove the entry from the cache, dirtying any parent entries. + forget: (...args: TKeyArgs) => boolean; + // A version of .forget that accepts a key returned by .getKey. + forgetKey: (key: TCacheKey | undefined) => boolean; + + // In order to use the -Key version of the above functions, you need a key + // rather than the arguments used to compute the key. These two functions take + // TArgs or TKeyArgs and return the corresponding TCacheKey. If no keyArgs + // function has been configured, TArgs will be the same as TKeyArgs, and thus + // getKey and makeCacheKey will be synonymous. + getKey: (...args: TArgs) => TCacheKey | undefined; + + // This property is equivalent to the makeCacheKey function provided in the + // OptimisticWrapOptions, or (if no options.makeCacheKey function is provided) + // a default implementation of makeCacheKey. This function is also exposed as + // optimistic.options.makeCacheKey, somewhat redundantly. + makeCacheKey: (...args: TKeyArgs) => TCacheKey | undefined; +}; + +export { CommonCache } +export interface CommonCacheConstructor extends Function { + new >(max?: number, dispose?: (value: V, key?: K) => void): CommonCache; +} + +export type OptimisticWrapOptions< + TArgs extends any[], + TKeyArgs extends any[] = TArgs, + TCacheKey = any, + TResult = any, +> = { + // The maximum number of cache entries that should be retained before the + // cache begins evicting the oldest ones. + max?: number; + // Transform the raw arguments to some other type of array, which will then + // be passed to makeCacheKey. + keyArgs?: (...args: TArgs) => TKeyArgs; + // The makeCacheKey function takes the same arguments that were passed to + // the wrapper function and returns a single value that can be used as a key + // in a Map to identify the cached result. + makeCacheKey?: (...args: NoInfer) => TCacheKey | undefined; + // Called when a new value is computed to allow efficient normalization of + // results over time, for example by returning older if equal(newer, older). + normalizeResult?: (newer: TResult, older: TResult) => TResult; + // If provided, the subscribe function should either return an unsubscribe + // function or return nothing. + subscribe?: (...args: TArgs) => void | (() => any); + cache?: CommonCache, Entry, NoInfer>> + | CommonCacheConstructor, NoInfer, NoInfer>; +}; + +export interface OptionsWithCacheInstance< + TArgs extends any[], + TKeyArgs extends any[] = TArgs, + TCacheKey = any, + TResult = any, +> extends OptimisticWrapOptions { + cache: CommonCache, Entry, NoInfer>>; +}; + +const caches = new Set>(); + +export function wrap< + TArgs extends any[], + TResult, + TKeyArgs extends any[] = TArgs, + TCacheKey = any, +>(originalFunction: (...args: TArgs) => TResult, { + max = Math.pow(2, 16), + keyArgs, + makeCacheKey = (defaultMakeCacheKey as () => TCacheKey), + normalizeResult, + subscribe, + cache: cacheOption = StrongCache, +}: OptimisticWrapOptions = Object.create(null)) { + const cache: CommonCache> = + typeof cacheOption === "function" + ? new cacheOption(max, entry => entry.dispose()) + : cacheOption; + + const optimistic = function (): TResult { + const key = makeCacheKey.apply( + null, + keyArgs ? keyArgs.apply(null, arguments as any) : arguments as any + ); + + if (key === void 0) { + return originalFunction.apply(null, arguments as any); + } + + let entry = cache.get(key)!; + if (!entry) { + cache.set(key, entry = new Entry(originalFunction)); + entry.normalizeResult = normalizeResult; + entry.subscribe = subscribe; + // Give the Entry the ability to trigger cache.delete(key), even though + // the Entry itself does not know about key or cache. + entry.forget = () => cache.delete(key); + } + + const value = entry.recompute( + Array.prototype.slice.call(arguments) as TArgs, + ); + + // Move this entry to the front of the least-recently used queue, + // since we just finished computing its value. + cache.set(key, entry); + + caches.add(cache); + + // Clean up any excess entries in the cache, but only if there is no + // active parent entry, meaning we're not in the middle of a larger + // computation that might be flummoxed by the cleaning. + if (! parentEntrySlot.hasValue()) { + caches.forEach(cache => cache.clean()); + caches.clear(); + } + + return value; + } as OptimisticWrapperFunction; + + Object.defineProperty(optimistic, "size", { + get: () => cache.size, + configurable: false, + enumerable: false, + }); + + Object.freeze(optimistic.options = { + max, + keyArgs, + makeCacheKey, + normalizeResult, + subscribe, + cache, + }); + + function dirtyKey(key: TCacheKey | undefined) { + const entry = key && cache.get(key); + if (entry) { + entry.setDirty(); + } + } + optimistic.dirtyKey = dirtyKey; + optimistic.dirty = function dirty() { + dirtyKey(makeCacheKey.apply(null, arguments as any)); + }; + + function peekKey(key: TCacheKey | undefined) { + const entry = key && cache.get(key); + if (entry) { + return entry.peek(); + } + } + optimistic.peekKey = peekKey; + optimistic.peek = function peek() { + return peekKey(makeCacheKey.apply(null, arguments as any)); + }; + + function forgetKey(key: TCacheKey | undefined) { + return key ? cache.delete(key) : false; + } + optimistic.forgetKey = forgetKey; + optimistic.forget = function forget() { + return forgetKey(makeCacheKey.apply(null, arguments as any)); + }; + + optimistic.makeCacheKey = makeCacheKey; + optimistic.getKey = keyArgs ? function getKey() { + return makeCacheKey.apply(null, keyArgs.apply(null, arguments as any)); + } : makeCacheKey as (...args: any[]) => TCacheKey | undefined; + + return Object.freeze(optimistic); +} diff --git a/graphql-subscription/node_modules/optimism/src/tests/api.ts b/graphql-subscription/node_modules/optimism/src/tests/api.ts new file mode 100644 index 0000000..8ee0598 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/api.ts @@ -0,0 +1,968 @@ +import * as assert from "assert"; +import { createHash } from "crypto"; +import { + wrap, + defaultMakeCacheKey, + OptimisticWrapperFunction, + CommonCache, +} from "../index"; +import { equal } from '@wry/equality'; +import { wrapYieldingFiberMethods } from '@wry/context'; +import { dep } from "../dep"; +import { permutations } from "./test-utils"; + +type NumThunk = OptimisticWrapperFunction<[], number>; + +describe("optimism", function () { + it("sanity", function () { + assert.strictEqual(typeof wrap, "function"); + assert.strictEqual(typeof defaultMakeCacheKey, "function"); + }); + + it("works with single functions", function () { + const test = wrap(function (x: string) { + return x + salt; + }, { + makeCacheKey: function (x: string) { + return x; + } + }); + + let salt = "salt"; + assert.strictEqual(test("a"), "asalt"); + + salt = "NaCl"; + assert.strictEqual(test("a"), "asalt"); + assert.strictEqual(test("b"), "bNaCl"); + + test.dirty("a"); + assert.strictEqual(test("a"), "aNaCl"); + }); + + it("can manually specify a cache instance", () => { + class Cache implements CommonCache { + private _cache = new Map() + has = this._cache.has.bind(this._cache); + get = this._cache.get.bind(this._cache); + delete = this._cache.delete.bind(this._cache); + get size(){ return this._cache.size } + set(key: K, value: V): V { + this._cache.set(key, value); + return value; + } + clean(){}; + } + + const cache = new Cache(); + + const wrapped = wrap( + (obj: { value: string }) => obj.value + " transformed", + { + cache, + makeCacheKey(obj) { + return obj.value; + }, + } + ); + assert.ok(cache instanceof Cache); + assert.strictEqual(wrapped({ value: "test" }), "test transformed"); + assert.strictEqual(wrapped({ value: "test" }), "test transformed"); + cache.get("test").value[0] = "test modified"; + assert.strictEqual(wrapped({ value: "test" }), "test modified"); + }); + + it("can manually specify a cache constructor", () => { + class Cache implements CommonCache { + private _cache = new Map() + has = this._cache.has.bind(this._cache); + get = this._cache.get.bind(this._cache); + delete = this._cache.delete.bind(this._cache); + get size(){ return this._cache.size } + set(key: K, value: V): V { + this._cache.set(key, value); + return value; + } + clean(){}; + } + + const wrapped = wrap( + (obj: { value: string }) => obj.value + " transformed", + { + cache: Cache, + makeCacheKey(obj) { + return obj.value; + }, + } + ); + assert.ok(wrapped.options.cache instanceof Cache); + assert.strictEqual(wrapped({ value: "test" }), "test transformed"); + assert.strictEqual(wrapped({ value: "test" }), "test transformed"); + wrapped.options.cache.get("test").value[0] = "test modified"; + assert.strictEqual(wrapped({ value: "test" }), "test modified"); + }); + + it("works with two layers of functions", function () { + const files: { [key: string]: string } = { + "a.js": "a", + "b.js": "b" + }; + + const fileNames = Object.keys(files); + + const read = wrap(function (path: string) { + return files[path]; + }); + + const hash = wrap(function (paths: string[]) { + const h = createHash("sha1"); + paths.forEach(function (path) { + h.update(read(path)); + }); + return h.digest("hex"); + }); + + const hash1 = hash(fileNames); + files["a.js"] += "yy"; + const hash2 = hash(fileNames); + read.dirty("a.js"); + const hash3 = hash(fileNames); + files["b.js"] += "ee"; + read.dirty("b.js"); + const hash4 = hash(fileNames); + + assert.strictEqual(hash1, hash2); + assert.notStrictEqual(hash1, hash3); + assert.notStrictEqual(hash1, hash4); + assert.notStrictEqual(hash3, hash4); + }); + + it("works with subscription functions", function () { + let dirty: () => void; + let sep = ","; + const unsubscribed = Object.create(null); + const test = wrap(function (x: string) { + return [x, x, x].join(sep); + }, { + max: 1, + subscribe: function (x: string) { + dirty = function () { + test.dirty(x); + }; + + delete unsubscribed[x]; + + return function () { + unsubscribed[x] = true; + }; + } + }); + + assert.strictEqual(test("a"), "a,a,a"); + + assert.strictEqual(test("b"), "b,b,b"); + assert.deepEqual(unsubscribed, { a: true }); + + assert.strictEqual(test("c"), "c,c,c"); + assert.deepEqual(unsubscribed, { + a: true, + b: true + }); + + sep = ":"; + + assert.strictEqual(test("c"), "c,c,c"); + assert.deepEqual(unsubscribed, { + a: true, + b: true + }); + + dirty!(); + + assert.strictEqual(test("c"), "c:c:c"); + assert.deepEqual(unsubscribed, { + a: true, + b: true + }); + + assert.strictEqual(test("d"), "d:d:d"); + assert.deepEqual(unsubscribed, { + a: true, + b: true, + c: true + }); + }); + + // The fibers coroutine library no longer works with Node.js v16. + it.skip("is not confused by fibers", function () { + const Fiber = wrapYieldingFiberMethods(require("fibers")); + + const order = []; + let result1 = "one"; + let result2 = "two"; + + const f1 = new Fiber(function () { + order.push(1); + + const o1 = wrap(function () { + Fiber.yield(); + return result1; + }); + + order.push(2); + assert.strictEqual(o1(), "one"); + order.push(3); + result1 += ":dirty"; + assert.strictEqual(o1(), "one"); + order.push(4); + Fiber.yield(); + order.push(5); + assert.strictEqual(o1(), "one"); + order.push(6); + o1.dirty(); + order.push(7); + assert.strictEqual(o1(), "one:dirty"); + order.push(8); + assert.strictEqual(o2(), "two:dirty"); + order.push(9); + }); + + result2 = "two" + const o2 = wrap(function () { + return result2; + }); + + order.push(0); + + f1.run(); + assert.deepEqual(order, [0, 1, 2]); + + // The primary goal of this test is to make sure this call to o2() + // does not register a dirty-chain dependency for o1. + assert.strictEqual(o2(), "two"); + + f1.run(); + assert.deepEqual(order, [0, 1, 2, 3, 4]); + + // If the call to o2() captured o1() as a parent, then this o2.dirty() + // call will report the o1() call dirty, which is not what we want. + result2 += ":dirty"; + o2.dirty(); + + f1.run(); + // The call to o1() between order.push(5) and order.push(6) should not + // yield, because it should still be cached, because it should not be + // dirty. However, the call to o1() between order.push(7) and + // order.push(8) should yield, because we call o1.dirty() explicitly, + // which is why this assertion stops at 7. + assert.deepEqual(order, [0, 1, 2, 3, 4, 5, 6, 7]); + + f1.run(); + assert.deepEqual(order, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); + }); + + it("marks evicted cache entries dirty", function () { + let childSalt = "*"; + let child = wrap(function (x: string) { + return x + childSalt; + }, { max: 1 }); + + let parentSalt = "^"; + const parent = wrap(function (x: string) { + return child(x) + parentSalt; + }); + + assert.strictEqual(parent("asdf"), "asdf*^"); + + childSalt = "&"; + parentSalt = "%"; + + assert.strictEqual(parent("asdf"), "asdf*^"); + assert.strictEqual(child("zxcv"), "zxcv&"); + assert.strictEqual(parent("asdf"), "asdf&%"); + }); + + it("handles children throwing exceptions", function () { + const expected = new Error("oyez"); + + const child = wrap(function () { + throw expected; + }); + + const parent = wrap(function () { + try { + child(); + } catch (e) { + return e; + } + }); + + assert.strictEqual(parent(), expected); + assert.strictEqual(parent(), expected); + + child.dirty(); + assert.strictEqual(parent(), expected); + + parent.dirty(); + assert.strictEqual(parent(), expected); + }); + + it("reports clean children to correct parents", function () { + let childResult = "a"; + const child = wrap(function () { + return childResult; + }); + + const parent = wrap(function (x: any) { + return child() + x; + }); + + assert.strictEqual(parent(1), "a1"); + assert.strictEqual(parent(2), "a2"); + + childResult = "b"; + child.dirty(); + + // If this call to parent(1) mistakenly reports child() as clean to + // parent(2), then the second assertion will fail by returning "a2". + assert.strictEqual(parent(1), "b1"); + assert.strictEqual(parent(2), "b2"); + }); + + it("supports object cache keys", function () { + let counter = 0; + const wrapped = wrap(function (a: any, b: any) { + return counter++; + }); + + const a = {}; + const b = {}; + + // Different combinations of distinct object references should + // increment the counter. + assert.strictEqual(wrapped(a, a), 0); + assert.strictEqual(wrapped(a, b), 1); + assert.strictEqual(wrapped(b, a), 2); + assert.strictEqual(wrapped(b, b), 3); + + // But the same combinations of arguments should return the same + // cached values when passed again. + assert.strictEqual(wrapped(a, a), 0); + assert.strictEqual(wrapped(a, b), 1); + assert.strictEqual(wrapped(b, a), 2); + assert.strictEqual(wrapped(b, b), 3); + }); + + it("supports falsy non-void cache keys", function () { + let callCount = 0; + const wrapped = wrap((key: number | string | null | boolean | undefined) => { + ++callCount; + return key; + }, { + makeCacheKey(key) { + return key; + }, + }); + + assert.strictEqual(wrapped(0), 0); + assert.strictEqual(callCount, 1); + assert.strictEqual(wrapped(0), 0); + assert.strictEqual(callCount, 1); + + assert.strictEqual(wrapped(""), ""); + assert.strictEqual(callCount, 2); + assert.strictEqual(wrapped(""), ""); + assert.strictEqual(callCount, 2); + + assert.strictEqual(wrapped(null), null); + assert.strictEqual(callCount, 3); + assert.strictEqual(wrapped(null), null); + assert.strictEqual(callCount, 3); + + assert.strictEqual(wrapped(false), false); + assert.strictEqual(callCount, 4); + assert.strictEqual(wrapped(false), false); + assert.strictEqual(callCount, 4); + + assert.strictEqual(wrapped(0), 0); + assert.strictEqual(wrapped(""), ""); + assert.strictEqual(wrapped(null), null); + assert.strictEqual(wrapped(false), false); + assert.strictEqual(callCount, 4); + + assert.strictEqual(wrapped(1), 1); + assert.strictEqual(wrapped("oyez"), "oyez"); + assert.strictEqual(wrapped(true), true); + assert.strictEqual(callCount, 7); + + assert.strictEqual(wrapped(void 0), void 0); + assert.strictEqual(wrapped(void 0), void 0); + assert.strictEqual(wrapped(void 0), void 0); + assert.strictEqual(callCount, 10); + }); + + it("detects problematic cycles", function () { + const self: NumThunk = wrap(function () { + return self() + 1; + }); + + const mutualA: NumThunk = wrap(function () { + return mutualB() + 1; + }); + + const mutualB: NumThunk = wrap(function () { + return mutualA() + 1; + }); + + function check(fn: typeof self) { + try { + fn(); + throw new Error("should not get here"); + } catch (e: any) { + assert.strictEqual(e.message, "already recomputing"); + } + + // Try dirtying the function, now that there's a cycle in the Entry + // graph. This should succeed. + fn.dirty(); + } + + check(self); + check(mutualA); + check(mutualB); + + let returnZero = true; + const fn: NumThunk = wrap(function () { + if (returnZero) { + returnZero = false; + return 0; + } + returnZero = true; + return fn() + 1; + }); + + assert.strictEqual(fn(), 0); + assert.strictEqual(returnZero, false); + + returnZero = true; + assert.strictEqual(fn(), 0); + assert.strictEqual(returnZero, true); + + fn.dirty(); + + returnZero = false; + check(fn); + }); + + it("tolerates misbehaving makeCacheKey functions", function () { + type NumNum = OptimisticWrapperFunction<[number], number>; + + let chaos = false; + let counter = 0; + const allOddsDep = wrap(() => ++counter); + + const sumOdd: NumNum = wrap((n: number) => { + allOddsDep(); + if (n < 1) return 0; + if (n % 2 === 1) { + return n + sumEven(n - 1); + } + return sumEven(n); + }, { + makeCacheKey(n) { + // Even though the computation completes, returning "constant" causes + // cycles in the Entry graph. + return chaos ? "constant" : n; + } + }); + + const sumEven: NumNum = wrap((n: number) => { + if (n < 1) return 0; + if (n % 2 === 0) { + return n + sumOdd(n - 1); + } + return sumOdd(n); + }); + + function check() { + sumEven.dirty(10); + sumOdd.dirty(10); + if (chaos) { + try { + sumOdd(10); + } catch (e: any) { + assert.strictEqual(e.message, "already recomputing"); + } + try { + sumEven(10); + } catch (e: any) { + assert.strictEqual(e.message, "already recomputing"); + } + } else { + assert.strictEqual(sumEven(10), 55); + assert.strictEqual(sumOdd(10), 55); + } + } + + check(); + + allOddsDep.dirty(); + sumEven.dirty(10); + check(); + + allOddsDep.dirty(); + allOddsDep(); + check(); + + chaos = true; + check(); + + allOddsDep.dirty(); + allOddsDep(); + check(); + + allOddsDep.dirty(); + check(); + + chaos = false; + allOddsDep.dirty(); + check(); + + chaos = true; + sumOdd.dirty(9); + sumOdd.dirty(7); + sumOdd.dirty(5); + check(); + + chaos = false; + check(); + }); + + it("supports options.keyArgs", function () { + const sumNums = wrap((...args: any[]) => ({ + sum: args.reduce( + (sum, arg) => typeof arg === "number" ? arg + sum : sum, + 0, + ) as number, + }), { + keyArgs(...args) { + return args.filter(arg => typeof arg === "number"); + }, + }); + + assert.strictEqual(sumNums().sum, 0); + assert.strictEqual(sumNums("asdf", true, sumNums).sum, 0); + + const sumObj1 = sumNums(1, "zxcv", true, 2, false, 3); + assert.strictEqual(sumObj1.sum, 6); + // These results are === sumObj1 because the numbers involved are identical. + assert.strictEqual(sumNums(1, 2, 3), sumObj1); + assert.strictEqual(sumNums("qwer", 1, 2, true, 3, [3]), sumObj1); + assert.strictEqual(sumNums("backwards", 3, 2, 1).sum, 6); + assert.notStrictEqual(sumNums("backwards", 3, 2, 1), sumObj1); + + sumNums.dirty(1, 2, 3); + const sumObj2 = sumNums(1, 2, 3); + assert.strictEqual(sumObj2.sum, 6); + assert.notStrictEqual(sumObj2, sumObj1); + assert.strictEqual(sumNums("a", 1, "b", 2, "c", 3), sumObj2); + }); + + it("supports wrap(fn, {...}).options to reflect input options", function () { + const keyArgs: () => [] = () => []; + function makeCacheKey() { return "constant"; } + function subscribe() {} + let normalizeCalls: [number, number][] = []; + function normalizeResult(newer: number, older: number) { + normalizeCalls.push([newer, older]); + return newer; + } + + let counter1 = 0; + const wrapped = wrap(() => ++counter1, { + max: 10, + keyArgs, + makeCacheKey, + normalizeResult, + subscribe, + }); + assert.strictEqual(wrapped.options.max, 10); + assert.strictEqual(wrapped.options.keyArgs, keyArgs); + assert.strictEqual(wrapped.options.makeCacheKey, makeCacheKey); + assert.strictEqual(wrapped.options.normalizeResult, normalizeResult); + assert.strictEqual(wrapped.options.subscribe, subscribe); + + assert.deepEqual(normalizeCalls, []); + assert.strictEqual(wrapped(), 1); + assert.deepEqual(normalizeCalls, []); + assert.strictEqual(wrapped(), 1); + assert.deepEqual(normalizeCalls, []); + wrapped.dirty(); + assert.deepEqual(normalizeCalls, []); + assert.strictEqual(wrapped(), 2); + assert.deepEqual(normalizeCalls, [[2, 1]]); + assert.strictEqual(wrapped(), 2); + wrapped.dirty(); + assert.strictEqual(wrapped(), 3); + assert.deepEqual(normalizeCalls, [[2, 1], [3, 2]]); + assert.strictEqual(wrapped(), 3); + assert.deepEqual(normalizeCalls, [[2, 1], [3, 2]]); + assert.strictEqual(wrapped(), 3); + + let counter2 = 0; + const wrappedWithDefaults = wrap(() => ++counter2); + assert.strictEqual(wrappedWithDefaults.options.max, Math.pow(2, 16)); + assert.strictEqual(wrappedWithDefaults.options.keyArgs, void 0); + assert.strictEqual(typeof wrappedWithDefaults.options.makeCacheKey, "function"); + assert.strictEqual(wrappedWithDefaults.options.normalizeResult, void 0); + assert.strictEqual(wrappedWithDefaults.options.subscribe, void 0); + }); + + it("tolerates cycles when propagating dirty/clean signals", function () { + let counter = 0; + const dep = wrap(() => ++counter); + + const callChild = () => child(); + let parentBody = callChild; + const parent = wrap(() => { + dep(); + return parentBody(); + }); + + const callParent = () => parent(); + let childBody = () => "child"; + const child = wrap(() => { + dep(); + return childBody(); + }); + + assert.strictEqual(parent(), "child"); + + childBody = callParent; + parentBody = () => "parent"; + child.dirty(); + assert.strictEqual(child(), "parent"); + dep.dirty(); + assert.strictEqual(child(), "parent"); + }); + + it("is not confused by eviction during recomputation", function () { + const fib: OptimisticWrapperFunction<[number], number> = + wrap(function (n: number) { + if (n > 1) { + return fib(n - 1) + fib(n - 2); + } + return n; + }, { + max: 10 + }); + + assert.strictEqual(fib.options.max, 10); + + assert.strictEqual(fib(78), 8944394323791464); + assert.strictEqual(fib(68), 72723460248141); + assert.strictEqual(fib(58), 591286729879); + assert.strictEqual(fib(48), 4807526976); + assert.strictEqual(fib(38), 39088169); + assert.strictEqual(fib(28), 317811); + assert.strictEqual(fib(18), 2584); + assert.strictEqual(fib(8), 21); + }); + + it("allows peeking the current value", function () { + const sumFirst = wrap(function (n: number): number { + return n < 1 ? 0 : n + sumFirst(n - 1); + }); + + assert.strictEqual(sumFirst.peek(3), void 0); + assert.strictEqual(sumFirst.peek(2), void 0); + assert.strictEqual(sumFirst.peek(1), void 0); + assert.strictEqual(sumFirst.peek(0), void 0); + assert.strictEqual(sumFirst(3), 6); + assert.strictEqual(sumFirst.peek(3), 6); + assert.strictEqual(sumFirst.peek(2), 3); + assert.strictEqual(sumFirst.peek(1), 1); + assert.strictEqual(sumFirst.peek(0), 0); + + assert.strictEqual(sumFirst.peek(7), void 0); + assert.strictEqual(sumFirst(10), 55); + assert.strictEqual(sumFirst.peek(9), 55 - 10); + assert.strictEqual(sumFirst.peek(8), 55 - 10 - 9); + assert.strictEqual(sumFirst.peek(7), 55 - 10 - 9 - 8); + + sumFirst.dirty(7); + // Everything from 7 and above is now unpeekable. + assert.strictEqual(sumFirst.peek(10), void 0); + assert.strictEqual(sumFirst.peek(9), void 0); + assert.strictEqual(sumFirst.peek(8), void 0); + assert.strictEqual(sumFirst.peek(7), void 0); + // Since 6 < 7, its value is still cached. + assert.strictEqual(sumFirst.peek(6), 6 * 7 / 2); + }); + + it("allows forgetting entries", function () { + const ns: number[] = []; + const sumFirst = wrap(function (n: number): number { + ns.push(n); + return n < 1 ? 0 : n + sumFirst(n - 1); + }); + + function inclusiveDescendingRange(n: number, limit = 0) { + const range: number[] = []; + while (n >= limit) range.push(n--); + return range; + } + + assert.strictEqual(sumFirst(10), 55); + assert.deepStrictEqual(ns, inclusiveDescendingRange(10)); + + assert.strictEqual(sumFirst.forget(6), true); + assert.strictEqual(sumFirst(4), 10); + assert.deepStrictEqual(ns, inclusiveDescendingRange(10)); + + assert.strictEqual(sumFirst(11), 66); + assert.deepStrictEqual(ns, [ + ...inclusiveDescendingRange(10), + ...inclusiveDescendingRange(11, 6), + ]); + + assert.strictEqual(sumFirst.forget(3), true); + assert.strictEqual(sumFirst(7), 28); + assert.deepStrictEqual(ns, [ + ...inclusiveDescendingRange(10), + ...inclusiveDescendingRange(11, 6), + ...inclusiveDescendingRange(7, 3), + ]); + + assert.strictEqual(sumFirst.forget(123), false); + assert.strictEqual(sumFirst.forget(-1), false); + assert.strictEqual(sumFirst.forget("7" as any), false); + assert.strictEqual((sumFirst.forget as any)(6, 4), false); + }); + + it("allows forgetting entries by key", function () { + const ns: number[] = []; + const sumFirst = wrap(function (n: number): number { + ns.push(n); + return n < 1 ? 0 : n + sumFirst(n - 1); + }, { + makeCacheKey: function (x: number) { + return x * 2; + } + }); + + assert.strictEqual(sumFirst.options.makeCacheKey!(7), 14); + assert.strictEqual(sumFirst(10), 55); + + /* + * Verify: + * 1- Calling forgetKey will remove the entry. + * 2- Calling forgetKey again will return false. + * 3- Callling forget on the same entry will return false. + */ + assert.strictEqual(sumFirst.forgetKey(6 * 2), true); + assert.strictEqual(sumFirst.forgetKey(6 * 2), false); + assert.strictEqual(sumFirst.forget(6), false); + + /* + * Verify: + * 1- Calling forget will remove the entry. + * 2- Calling forget again will return false. + * 3- Callling forgetKey on the same entry will return false. + */ + assert.strictEqual(sumFirst.forget(7), true); + assert.strictEqual(sumFirst.forget(7), false); + assert.strictEqual(sumFirst.forgetKey(7 * 2), false); + + /* + * Verify you can query an entry key. + */ + assert.strictEqual(sumFirst.getKey(9), 18); + assert.strictEqual(sumFirst.forgetKey(sumFirst.getKey(9)), true); + assert.strictEqual(sumFirst.forgetKey(sumFirst.getKey(9)), false); + assert.strictEqual(sumFirst.forget(9), false); + }); + + it("exposes optimistic.{size,options.cache.size} properties", function () { + const d = dep(); + const fib = wrap((n: number): number => { + d("shared"); + return n > 1 ? fib(n - 1) + fib(n - 2) : n; + }, { + makeCacheKey(n) { + return n; + }, + }); + + function size() { + assert.strictEqual(fib.options.cache.size, fib.size); + return fib.size; + } + + assert.strictEqual(size(), 0); + + assert.strictEqual(fib(0), 0); + assert.strictEqual(fib(1), 1); + assert.strictEqual(fib(2), 1); + assert.strictEqual(fib(3), 2); + assert.strictEqual(fib(4), 3); + assert.strictEqual(fib(5), 5); + assert.strictEqual(fib(6), 8); + assert.strictEqual(fib(7), 13); + assert.strictEqual(fib(8), 21); + + assert.strictEqual(size(), 9); + + fib.dirty(6); + // Merely dirtying an Entry does not remove it from the LRU cache. + assert.strictEqual(size(), 9); + + fib.forget(6); + // Forgetting an Entry both dirties it and removes it from the LRU cache. + assert.strictEqual(size(), 8); + + fib.forget(4); + assert.strictEqual(size(), 7); + + // This way of calling d.dirty causes any parent Entry objects to be + // forgotten (removed from the LRU cache). + d.dirty("shared", "forget"); + assert.strictEqual(size(), 0); + }); + + describe("wrapOptions.normalizeResult", function () { + it("can normalize array results", function () { + const normalizeArgs: [number[], number[]][] = []; + const range = wrap((n: number) => { + let result = []; + for (let i = 0; i < n; ++i) { + result[i] = i; + } + return result; + }, { + normalizeResult(newer, older) { + normalizeArgs.push([newer, older]); + return equal(newer, older) ? older : newer; + }, + }); + + const r3a = range(3); + assert.deepStrictEqual(r3a, [0, 1, 2]); + // Nothing surprising, just regular caching. + assert.strictEqual(r3a, range(3)); + + // Force range(3) to be recomputed below. + range.dirty(3); + + const r3b = range(3); + assert.deepStrictEqual(r3b, [0, 1, 2]); + + assert.strictEqual(r3a, r3b); + + assert.deepStrictEqual(normalizeArgs, [ + [r3b, r3a], + ]); + // Though r3a and r3b ended up ===, the normalizeResult callback should + // have been called with two !== arrays. + assert.notStrictEqual( + normalizeArgs[0][0], + normalizeArgs[0][1], + ); + }); + + it("can normalize recursive array results", function () { + const range = wrap((n: number): number[] => { + if (n <= 0) return []; + return range(n - 1).concat(n - 1); + }, { + normalizeResult: (newer, older) => equal(newer, older) ? older : newer, + }); + + const ranges = [ + range(0), + range(1), + range(2), + range(3), + range(4), + ]; + + assert.deepStrictEqual(ranges[0], []); + assert.deepStrictEqual(ranges[1], [0]); + assert.deepStrictEqual(ranges[2], [0, 1]); + assert.deepStrictEqual(ranges[3], [0, 1, 2]); + assert.deepStrictEqual(ranges[4], [0, 1, 2, 3]); + + const perms = permutations(ranges[4]); + assert.strictEqual(perms.length, 4 * 3 * 2 * 1); + + // For each permutation of the range sizes, check that strict equality + // holds for r[i] and range(i) for all i after dirtying each number. + let count = 0; + perms.forEach(perm => { + perm.forEach(toDirty => { + range.dirty(toDirty); + perm.forEach(i => { + assert.strictEqual(ranges[i], range(i)); + ++count; + }); + }) + }); + assert.strictEqual(count, perms.length * 4 * 4); + }); + + it("exceptions thrown by normalizeResult are ignored", function () { + const normalizeCalls: [string | number, string | number][] = []; + + const maybeThrow = wrap((value: string | number, shouldThrow: boolean) => { + if (shouldThrow) throw value; + return value; + }, { + makeCacheKey(value, shouldThrow) { + return JSON.stringify({ + // Coerce the value to a string so we can trigger normalizeResult + // using either 2 or "2" below. + value: String(value), + shouldThrow, + }); + }, + normalizeResult(a, b) { + normalizeCalls.push([a, b]); + throw new Error("from normalizeResult (expected)"); + }, + }); + + assert.strictEqual(maybeThrow(1, false), 1); + assert.strictEqual(maybeThrow(2, false), 2); + + maybeThrow.dirty(2, false); + assert.strictEqual(maybeThrow("2", false), "2"); + assert.strictEqual(maybeThrow(2, false), "2"); + maybeThrow.dirty(2, false); + assert.strictEqual(maybeThrow(2, false), 2); + assert.strictEqual(maybeThrow("2", false), 2); + + assert.throws( + () => maybeThrow(3, true), + error => error === 3, + ); + + assert.throws( + () => maybeThrow("3", true), + // Still 3 because the previous maybeThrow(3, true) exception is cached. + error => error === 3, + ); + + maybeThrow.dirty(3, true); + assert.throws( + () => maybeThrow("3", true), + error => error === "3", + ); + + // Even though the exception thrown by normalizeResult was ignored, check + // that it was in fact called (twice). + assert.deepStrictEqual(normalizeCalls, [ + ["2", 2], + [2, "2"], + ]); + }); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/src/tests/cache.ts b/graphql-subscription/node_modules/optimism/src/tests/cache.ts new file mode 100644 index 0000000..17a5223 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/cache.ts @@ -0,0 +1,110 @@ +import * as assert from "assert"; +import { StrongCache as Cache } from "@wry/caches"; + +describe("least-recently-used cache", function () { + it("can hold lots of elements", function () { + const cache = new Cache(); + const count = 1000000; + + for (let i = 0; i < count; ++i) { + cache.set(i, String(i)); + } + + cache.clean(); + + assert.strictEqual((cache as any).map.size, count); + assert.ok(cache.has(0)); + assert.ok(cache.has(count - 1)); + assert.strictEqual(cache.get(43), "43"); + }); + + it("evicts excess old elements", function () { + const max = 10; + const evicted = []; + const cache = new Cache(max, (value, key) => { + assert.strictEqual(String(key), value); + evicted.push(key); + }); + + const count = 100; + const keys = []; + for (let i = 0; i < count; ++i) { + cache.set(i, String(i)); + keys.push(i); + } + + cache.clean(); + + assert.strictEqual((cache as any).map.size, max); + assert.strictEqual(evicted.length, count - max); + + for (let i = count - max; i < count; ++i) { + assert.ok(cache.has(i)); + } + }); + + it("can cope with small max values", function () { + const cache = new Cache(2); + + function check(...sequence: number[]) { + cache.clean(); + + let entry = (cache as any).newest; + const forwards = []; + while (entry) { + forwards.push(entry.key); + entry = entry.older; + } + assert.deepEqual(forwards, sequence); + + const backwards = []; + entry = (cache as any).oldest; + while (entry) { + backwards.push(entry.key); + entry = entry.newer; + } + backwards.reverse(); + assert.deepEqual(backwards, sequence); + + sequence.forEach(function (n) { + assert.strictEqual((cache as any).map.get(n).value, n + 1); + }); + + if (sequence.length > 0) { + assert.strictEqual((cache as any).newest.key, sequence[0]); + assert.strictEqual( + (cache as any).oldest.key, + sequence[sequence.length - 1] + ); + } + } + + cache.set(1, 2); + check(1); + + cache.set(2, 3); + check(2, 1); + + cache.set(3, 4); + check(3, 2); + + cache.get(2); + check(2, 3); + + cache.set(4, 5); + check(4, 2); + + assert.strictEqual(cache.has(1), false); + assert.strictEqual(cache.get(2), 3); + assert.strictEqual(cache.has(3), false); + assert.strictEqual(cache.get(4), 5); + + cache.delete(2); + check(4); + cache.delete(4); + check(); + + assert.strictEqual((cache as any).newest, null); + assert.strictEqual((cache as any).oldest, null); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/src/tests/context.ts b/graphql-subscription/node_modules/optimism/src/tests/context.ts new file mode 100644 index 0000000..41aff45 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/context.ts @@ -0,0 +1,208 @@ +import * as assert from "assert"; +import { + wrap, + setTimeout, + asyncFromGen, + noContext, + nonReactive, + Slot, +} from '../index.js'; + +describe("asyncFromGen", function () { + it("is importable", function () { + assert.strictEqual(typeof asyncFromGen, "function"); + }); + + it("works like an async function", asyncFromGen(function*(): Generator< + number | Promise, + Promise, + number + > { + let sum = 0; + const limit = yield new Promise(resolve => { + setTimeout(() => resolve(10), 10); + }); + for (let i = 0; i < limit; ++i) { + sum += yield i + 1; + } + assert.strictEqual(sum, 55); + return Promise.resolve("ok"); + })); + + it("properly handles exceptions", async function () { + const fn = asyncFromGen(function*(throwee?: object): Generator< + Promise | object, + string, + string + > { + const result = yield Promise.resolve("ok"); + if (throwee) { + throw yield throwee; + } + return result; + }); + + const okPromise = fn(); + const expected = {}; + const koPromise = fn(expected); + + assert.strictEqual(await okPromise, "ok"); + + try { + await koPromise; + throw new Error("not reached"); + } catch (error) { + assert.strictEqual(error, expected); + } + + try { + await fn(Promise.resolve("oyez")); + throw new Error("not reached"); + } catch (thrown) { + assert.strictEqual(thrown, "oyez"); + } + + const catcher = asyncFromGen(function*() { + try { + yield Promise.reject(new Error("expected")); + throw new Error("not reached"); + } catch (error: any) { + assert.strictEqual(error.message, "expected"); + } + return "ok"; + }); + + return catcher().then(result => { + assert.strictEqual(result, "ok"); + }); + }); + + it("can be cached", async function () { + let parentCounter = 0; + const parent = wrap(asyncFromGen(function*(x: number): Generator< + Promise, + number, + number + > { + ++parentCounter; + const a = yield new Promise(resolve => setTimeout(() => { + resolve(child(x)); + }, 10)); + const b = yield new Promise(resolve => setTimeout(() => { + resolve(child(x + 1)); + }, 20)); + return a * b; + })); + + let childCounter = 0; + const child = wrap((x: number) => { + return ++childCounter; + }); + + assert.strictEqual(parentCounter, 0); + assert.strictEqual(childCounter, 0); + const parentPromise = parent(123); + assert.strictEqual(parentCounter, 1); + assert.strictEqual(await parentPromise, 2); + assert.strictEqual(childCounter, 2); + + assert.strictEqual(parent(123), parentPromise); + assert.strictEqual(parentCounter, 1); + assert.strictEqual(childCounter, 2); + + child.dirty(123); + + assert.strictEqual(await parent(123), 3 * 2); + assert.strictEqual(parentCounter, 2); + assert.strictEqual(childCounter, 3); + + assert.strictEqual(await parent(456), 4 * 5); + assert.strictEqual(parentCounter, 3); + assert.strictEqual(childCounter, 5); + + assert.strictEqual(parent(666), parent(666)); + assert.strictEqual(await parent(666), await parent(666)); + assert.strictEqual(parentCounter, 4); + assert.strictEqual(childCounter, 7); + + child.dirty(667); + + assert.strictEqual(await parent(667), 8 * 9); + assert.strictEqual(await parent(667), 8 * 9); + assert.strictEqual(parentCounter, 5); + assert.strictEqual(childCounter, 9); + + assert.strictEqual(await parent(123), 3 * 2); + assert.strictEqual(parentCounter, 5); + assert.strictEqual(childCounter, 9); + }); +}); + +describe("noContext", function () { + it("prevents registering dependencies", function () { + let parentCounter = 0; + const parent = wrap(() => { + return [++parentCounter, noContext(child)]; + }); + + let childCounter = 0; + const child = wrap(() => ++childCounter); + + assert.deepEqual(parent(), [1, 1]); + assert.deepEqual(parent(), [1, 1]); + parent.dirty(); + assert.deepEqual(parent(), [2, 1]); + // Calling child.dirty() does not dirty the parent: + child.dirty(); + assert.deepEqual(parent(), [2, 1]); + parent.dirty(); + assert.deepEqual(parent(), [3, 2]); + assert.deepEqual(parent(), [3, 2]); + parent.dirty(); + assert.deepEqual(parent(), [4, 2]); + }); +}); + +describe("nonReactive", function () { + const otherSlot = new Slot(); + + it("censors only optimism-related context", function () { + let innerCounter = 0; + const inner = wrap(() => ++innerCounter); + const outer = wrap(() => ({ + fromInner: nonReactive(() => inner()), + fromOther: nonReactive(() => otherSlot.getValue()), + })); + assert.strictEqual(otherSlot.getValue(), undefined); + otherSlot.withValue("preserved", () => { + assert.deepEqual(outer(), { fromInner: 1, fromOther: "preserved" }); + assert.deepEqual(outer(), { fromInner: 1, fromOther: "preserved" }); + inner.dirty(); + assert.deepEqual(outer(), { fromInner: 1, fromOther: "preserved" }); + assert.strictEqual(inner(), 2); + outer.dirty(); + assert.deepEqual(outer(), { fromInner: 2, fromOther: "preserved" }); + }); + assert.strictEqual(otherSlot.getValue(), undefined); + }); + + it("same test using noContext, for comparison", function () { + let innerCounter = 0; + const inner = wrap(() => ++innerCounter); + const outer = wrap(() => ({ + fromInner: noContext(inner), + fromOther: noContext(() => otherSlot.getValue()), + })); + assert.strictEqual(otherSlot.getValue(), undefined); + otherSlot.withValue("preserved", () => { + assert.deepEqual(outer(), { fromInner: 1, fromOther: void 0 }); + assert.deepEqual(outer(), { fromInner: 1, fromOther: void 0 }); + inner.dirty(); + assert.deepEqual(outer(), { fromInner: 1, fromOther: void 0 }); + assert.strictEqual(inner(), 2); + outer.dirty(); + assert.deepEqual(outer(), { fromInner: 2, fromOther: void 0 }); + }); + assert.strictEqual(otherSlot.getValue(), undefined); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/src/tests/deps.ts b/graphql-subscription/node_modules/optimism/src/tests/deps.ts new file mode 100644 index 0000000..554ded8 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/deps.ts @@ -0,0 +1,183 @@ +import * as assert from "assert"; +import { wrap, dep } from "../index"; + +describe("OptimisticDependencyFunction", () => { + it("can dirty OptimisticWrapperFunctions", () => { + const numberDep = dep(); + const stringDep = dep(); + let callCount = 0; + + const fn = wrap((n: number, s: string) => { + numberDep(n); + stringDep(s); + ++callCount; + return s.repeat(n); + }); + + assert.strictEqual(fn(0, "oyez"), ""); + assert.strictEqual(callCount, 1); + assert.strictEqual(fn(1, "oyez"), "oyez"); + assert.strictEqual(callCount, 2); + assert.strictEqual(fn(2, "oyez"), "oyezoyez"); + assert.strictEqual(callCount, 3); + + assert.strictEqual(fn(0, "oyez"), ""); + assert.strictEqual(fn(1, "oyez"), "oyez"); + assert.strictEqual(fn(2, "oyez"), "oyezoyez"); + assert.strictEqual(callCount, 3); + + numberDep.dirty(0); + assert.strictEqual(fn(0, "oyez"), ""); + assert.strictEqual(callCount, 4); + assert.strictEqual(fn(1, "oyez"), "oyez"); + assert.strictEqual(callCount, 4); + assert.strictEqual(fn(2, "oyez"), "oyezoyez"); + assert.strictEqual(callCount, 4); + + stringDep.dirty("mlem"); + assert.strictEqual(fn(0, "oyez"), ""); + assert.strictEqual(callCount, 4); + + stringDep.dirty("oyez"); + assert.strictEqual(fn(2, "oyez"), "oyezoyez"); + assert.strictEqual(callCount, 5); + assert.strictEqual(fn(1, "oyez"), "oyez"); + assert.strictEqual(callCount, 6); + assert.strictEqual(fn(0, "oyez"), ""); + assert.strictEqual(callCount, 7); + + assert.strictEqual(fn(0, "oyez"), ""); + assert.strictEqual(fn(1, "oyez"), "oyez"); + assert.strictEqual(fn(2, "oyez"), "oyezoyez"); + assert.strictEqual(callCount, 7); + }); + + it("should be forgotten when parent is recomputed", () => { + const d = dep(); + let callCount = 0; + let shouldDepend = true; + + const parent = wrap((id: string) => { + if (shouldDepend) d(id); + return ++callCount; + }); + + assert.strictEqual(parent("oyez"), 1); + assert.strictEqual(parent("oyez"), 1); + assert.strictEqual(parent("mlem"), 2); + assert.strictEqual(parent("mlem"), 2); + + d.dirty("mlem"); + assert.strictEqual(parent("oyez"), 1); + assert.strictEqual(parent("mlem"), 3); + + d.dirty("oyez"); + assert.strictEqual(parent("oyez"), 4); + assert.strictEqual(parent("mlem"), 3); + + parent.dirty("oyez"); + shouldDepend = false; + assert.strictEqual(parent("oyez"), 5); + assert.strictEqual(parent("mlem"), 3); + d.dirty("oyez"); + shouldDepend = true; + assert.strictEqual(parent("oyez"), 5); + assert.strictEqual(parent("mlem"), 3); + // This still has no effect because the previous call to parent("oyez") + // was cached. + d.dirty("oyez"); + assert.strictEqual(parent("oyez"), 5); + assert.strictEqual(parent("mlem"), 3); + parent.dirty("oyez"); + assert.strictEqual(parent("oyez"), 6); + assert.strictEqual(parent("mlem"), 3); + d.dirty("oyez"); + assert.strictEqual(parent("oyez"), 7); + assert.strictEqual(parent("mlem"), 3); + + parent.dirty("mlem"); + shouldDepend = false; + assert.strictEqual(parent("oyez"), 7); + assert.strictEqual(parent("mlem"), 8); + d.dirty("oyez"); + d.dirty("mlem"); + assert.strictEqual(parent("oyez"), 9); + assert.strictEqual(parent("mlem"), 8); + d.dirty("oyez"); + d.dirty("mlem"); + assert.strictEqual(parent("oyez"), 9); + assert.strictEqual(parent("mlem"), 8); + shouldDepend = true; + parent.dirty("mlem"); + assert.strictEqual(parent("oyez"), 9); + assert.strictEqual(parent("mlem"), 10); + d.dirty("oyez"); + d.dirty("mlem"); + assert.strictEqual(parent("oyez"), 9); + assert.strictEqual(parent("mlem"), 11); + }); + + it("supports subscribing and unsubscribing", function () { + let subscribeCallCount = 0; + let unsubscribeCallCount = 0; + let parentCallCount = 0; + + function check(counts: { + subscribe: number; + unsubscribe: number; + parent: number; + }) { + assert.strictEqual(counts.subscribe, subscribeCallCount); + assert.strictEqual(counts.unsubscribe, unsubscribeCallCount); + assert.strictEqual(counts.parent, parentCallCount); + } + + const d = dep({ + subscribe(key: string) { + ++subscribeCallCount; + return () => { + ++unsubscribeCallCount; + }; + }, + }); + + assert.strictEqual(subscribeCallCount, 0); + assert.strictEqual(unsubscribeCallCount, 0); + + const parent = wrap((key: string) => { + d(key); + return ++parentCallCount; + }); + + assert.strictEqual(parent("rawr"), 1); + check({ subscribe: 1, unsubscribe: 0, parent: 1 }); + assert.strictEqual(parent("rawr"), 1); + check({ subscribe: 1, unsubscribe: 0, parent: 1 }); + assert.strictEqual(parent("blep"), 2); + check({ subscribe: 2, unsubscribe: 0, parent: 2 }); + assert.strictEqual(parent("rawr"), 1); + check({ subscribe: 2, unsubscribe: 0, parent: 2 }); + assert.strictEqual(parent("blep"), 2); + check({ subscribe: 2, unsubscribe: 0, parent: 2 }); + + d.dirty("blep"); + check({ subscribe: 2, unsubscribe: 1, parent: 2 }); + assert.strictEqual(parent("rawr"), 1); + check({ subscribe: 2, unsubscribe: 1, parent: 2 }); + d.dirty("blep"); // intentionally redundant + check({ subscribe: 2, unsubscribe: 1, parent: 2 }); + assert.strictEqual(parent("blep"), 3); + check({ subscribe: 3, unsubscribe: 1, parent: 3 }); + assert.strictEqual(parent("blep"), 3); + check({ subscribe: 3, unsubscribe: 1, parent: 3 }); + + d.dirty("rawr"); + check({ subscribe: 3, unsubscribe: 2, parent: 3 }); + assert.strictEqual(parent("blep"), 3); + check({ subscribe: 3, unsubscribe: 2, parent: 3 }); + assert.strictEqual(parent("rawr"), 4); + check({ subscribe: 4, unsubscribe: 2, parent: 4 }); + assert.strictEqual(parent("blep"), 3); + check({ subscribe: 4, unsubscribe: 2, parent: 4 }); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/src/tests/exceptions.ts b/graphql-subscription/node_modules/optimism/src/tests/exceptions.ts new file mode 100644 index 0000000..31f7cd7 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/exceptions.ts @@ -0,0 +1,76 @@ +import * as assert from "assert"; +import { wrap } from "../index.js"; + +describe("exceptions", function () { + it("should be cached", function () { + const error = new Error("expected"); + let threw = false; + function throwOnce() { + if (!threw) { + threw = true; + throw error; + } + return "already threw"; + } + + const wrapper = wrap(throwOnce); + + try { + wrapper(); + throw new Error("unreached"); + } catch (e) { + assert.strictEqual(e, error); + } + + try { + wrapper(); + throw new Error("unreached"); + } catch (e) { + assert.strictEqual(e, error); + } + + wrapper.dirty(); + assert.strictEqual(wrapper(), "already threw"); + assert.strictEqual(wrapper(), "already threw"); + wrapper.dirty(); + assert.strictEqual(wrapper(), "already threw"); + }); + + it("should memoize a throwing fibonacci function", function () { + const fib = wrap((n: number) => { + if (n < 2) throw n; + try { + fib(n - 1); + } catch (minusOne: any) { + try { + fib(n - 2); + } catch (minusTwo: any) { + throw minusOne + minusTwo; + } + } + throw new Error("unreached"); + }); + + function check(n: number, expected: number) { + try { + fib(n); + throw new Error("unreached"); + } catch (result) { + assert.strictEqual(result, expected); + } + } + + check(78, 8944394323791464); + check(68, 72723460248141); + check(58, 591286729879); + check(48, 4807526976); + fib.dirty(28); + check(38, 39088169); + check(28, 317811); + check(18, 2584); + check(8, 21); + fib.dirty(20); + check(78, 8944394323791464); + check(10, 55); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/src/tests/key-trie.ts b/graphql-subscription/node_modules/optimism/src/tests/key-trie.ts new file mode 100644 index 0000000..f5acb51 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/key-trie.ts @@ -0,0 +1,90 @@ +import * as assert from "assert"; +import { KeyTrie } from "../index"; + +describe("KeyTrie", function () { + it("can be imported", function () { + assert.strictEqual(typeof KeyTrie, "function"); + }); + + it("can hold objects weakly", function () { + const trie = new KeyTrie(true); + assert.strictEqual((trie as any).weakness, true); + const obj1 = {}; + assert.strictEqual( + trie.lookup(obj1, 2, 3), + trie.lookup(obj1, 2, 3), + ); + const obj2 = {}; + assert.notStrictEqual( + trie.lookup(1, obj2), + trie.lookup(1, obj2, 3), + ); + assert.strictEqual((trie as any).weak.has(obj1), true); + assert.strictEqual((trie as any).strong.has(obj1), false); + assert.strictEqual((trie as any).strong.get(1).weak.has(obj2), true); + assert.strictEqual((trie as any).strong.get(1).weak.get(obj2).strong.has(3), true); + }); + + it("can disable WeakMap", function () { + const trie = new KeyTrie(false); + assert.strictEqual((trie as any).weakness, false); + const obj1 = {}; + assert.strictEqual( + trie.lookup(obj1, 2, 3), + trie.lookup(obj1, 2, 3), + ); + const obj2 = {}; + assert.notStrictEqual( + trie.lookup(1, obj2), + trie.lookup(1, obj2, 3), + ); + assert.strictEqual(typeof (trie as any).weak, "undefined"); + assert.strictEqual((trie as any).strong.has(obj1), true); + assert.strictEqual((trie as any).strong.has(1), true); + assert.strictEqual((trie as any).strong.get(1).strong.has(obj2), true); + assert.strictEqual((trie as any).strong.get(1).strong.get(obj2).strong.has(3), true); + }); + + it("can produce data types other than Object", function () { + const symbolTrie = new KeyTrie(true, args => Symbol.for(args.join("."))); + const s123 = symbolTrie.lookup(1, 2, 3); + assert.strictEqual(s123.toString(), "Symbol(1.2.3)"); + assert.strictEqual(s123, symbolTrie.lookup(1, 2, 3)); + assert.strictEqual(s123, symbolTrie.lookupArray([1, 2, 3])); + const sNull = symbolTrie.lookup(); + assert.strictEqual(sNull.toString(), "Symbol()"); + + const regExpTrie = new KeyTrie(true, args => new RegExp("^(" + args.join("|") + ")$")); + const rXYZ = regExpTrie.lookup("x", "y", "z"); + assert.strictEqual(rXYZ.test("w"), false); + assert.strictEqual(rXYZ.test("x"), true); + assert.strictEqual(rXYZ.test("y"), true); + assert.strictEqual(rXYZ.test("z"), true); + assert.strictEqual(String(rXYZ), "/^(x|y|z)$/"); + + class Data { + constructor(public readonly args: any[]) {} + } + const dataTrie = new KeyTrie(true, args => new Data(args)); + function checkData(...args: any[]) { + const data = dataTrie.lookupArray(args); + assert.strictEqual(data instanceof Data, true); + assert.notStrictEqual(data.args, args); + assert.deepEqual(data.args, args); + assert.strictEqual(data, dataTrie.lookup(...args)); + assert.strictEqual(data, dataTrie.lookupArray(arguments)); + return data; + } + const datas = [ + checkData(), + checkData(1), + checkData(1, 2), + checkData(2), + checkData(2, 3), + checkData(true, "a"), + checkData(/asdf/i, "b", function oyez() {}), + ]; + // Verify that all Data objects are distinct. + assert.strictEqual(new Set(datas).size, datas.length); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/src/tests/main.ts b/graphql-subscription/node_modules/optimism/src/tests/main.ts new file mode 100644 index 0000000..241bcde --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/main.ts @@ -0,0 +1,7 @@ +import "./api"; +import "./deps"; +import "./cache"; +import "./key-trie"; +import "./context"; +import "./exceptions"; +import "./performance"; diff --git a/graphql-subscription/node_modules/optimism/src/tests/performance.ts b/graphql-subscription/node_modules/optimism/src/tests/performance.ts new file mode 100644 index 0000000..609c6d6 --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/performance.ts @@ -0,0 +1,86 @@ +import * as assert from "assert"; +import { wrap, dep, KeyTrie } from "../index"; + +describe("performance", function () { + this.timeout(30000); + + it("should be able to tolerate lots of Entry objects", function () { + let counter = 0; + const child = wrap((a: any, b: any) => counter++); + const parent = wrap((obj1: object, num: number, obj2: object) => { + child(obj1, counter); + child(counter, obj2); + return counter++; + }); + for (let i = 0; i < 100000; ++i) { + parent({}, i, {}); + } + }); + + const keys: object[] = []; + for (let i = 0; i < 100000; ++i) { + keys.push({ i }); + } + + it("should be able to tolerate lots of deps", function () { + const d = dep(); + const parent = wrap((id: number) => { + keys.forEach(d); + return id; + }); + parent(1); + parent(2); + parent(3); + keys.forEach(key => d.dirty(key)); + }); + + it("can speed up sorting with O(array.length) cache lookup", function () { + let counter = 0; + const trie = new KeyTrie(false); + const sort = wrap((array: number[]) => { + ++counter; + return array.slice(0).sort(); + }, { + makeCacheKey(array) { + return trie.lookupArray(array); + } + }); + + assert.deepEqual(sort([2, 1, 5, 4]), [1, 2, 4, 5]); + assert.strictEqual(counter, 1); + assert.strictEqual( + sort([2, 1, 5, 4]), + sort([2, 1, 5, 4]), + ); + assert.strictEqual(counter, 1); + + assert.deepEqual(sort([3, 2, 1]), [1, 2, 3]); + assert.strictEqual(counter, 2); + + const bigArray: number[] = []; + for (let i = 0; i < 100000; ++i) { + bigArray.push(Math.round(Math.random() * 100)); + } + + const bigArrayCopy = bigArray.slice(0); + const rawSortStartTime = Date.now(); + bigArrayCopy.sort(); + const rawSortTime = Date.now() - rawSortStartTime; + + assert.deepEqual( + sort(bigArray), + bigArrayCopy, + ); + + const cachedSortStartTime = Date.now(); + const cached = sort(bigArray); + const cachedSortTime = Date.now() - cachedSortStartTime; + + assert.deepEqual(cached, bigArrayCopy); + assert.ok( + cachedSortTime <= rawSortTime, + `cached: ${cachedSortTime}ms, raw: ${rawSortTime}ms`, + ); + assert.strictEqual(counter, 3); + }); +}); diff --git a/graphql-subscription/node_modules/optimism/src/tests/test-utils.ts b/graphql-subscription/node_modules/optimism/src/tests/test-utils.ts new file mode 100644 index 0000000..219ef1c --- /dev/null +++ b/graphql-subscription/node_modules/optimism/src/tests/test-utils.ts @@ -0,0 +1,14 @@ +export function permutations(array: T[], start = 0): T[][] { + if (start === array.length) return [[]]; + const item = array[start]; + const results: T[][] = []; + permutations(array, start + 1).forEach(perm => { + perm.forEach((_, i) => { + const copy = perm.slice(0); + copy.splice(i, 0, item); + results.push(copy); + }); + results.push(perm.concat(item)); + }); + return results; +} diff --git a/graphql-subscription/node_modules/prop-types/LICENSE b/graphql-subscription/node_modules/prop-types/LICENSE new file mode 100644 index 0000000..188fb2b --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/prop-types/README.md b/graphql-subscription/node_modules/prop-types/README.md new file mode 100644 index 0000000..e54d435 --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/README.md @@ -0,0 +1,302 @@ +# prop-types [![Build Status](https://travis-ci.com/facebook/prop-types.svg?branch=main)](https://travis-ci.org/facebook/prop-types) + +Runtime type checking for React props and similar objects. + +You can use prop-types to document the intended types of properties passed to +components. React (and potentially other libraries—see the `checkPropTypes()` +reference below) will check props passed to your components against those +definitions, and warn in development if they don’t match. + +## Installation + +```shell +npm install --save prop-types +``` + +## Importing + +```js +import PropTypes from 'prop-types'; // ES6 +var PropTypes = require('prop-types'); // ES5 with npm +``` + +### CDN + +If you prefer to exclude `prop-types` from your application and use it +globally via `window.PropTypes`, the `prop-types` package provides +single-file distributions, which are hosted on the following CDNs: + +* [**unpkg**](https://unpkg.com/prop-types/) +```html + + + + + +``` + +* [**cdnjs**](https://cdnjs.com/libraries/prop-types) +```html + + + + + +``` + +To load a specific version of `prop-types` replace `15.6.0` with the version number. + +## Usage + +PropTypes was originally exposed as part of the React core module, and is +commonly used with React components. +Here is an example of using PropTypes with a React component, which also +documents the different validators provided: + +```js +import React from 'react'; +import PropTypes from 'prop-types'; + +class MyComponent extends React.Component { + render() { + // ... do things with the props + } +} + +MyComponent.propTypes = { + // You can declare that a prop is a specific JS primitive. By default, these + // are all optional. + optionalArray: PropTypes.array, + optionalBigInt: PropTypes.bigint, + optionalBool: PropTypes.bool, + optionalFunc: PropTypes.func, + optionalNumber: PropTypes.number, + optionalObject: PropTypes.object, + optionalString: PropTypes.string, + optionalSymbol: PropTypes.symbol, + + // Anything that can be rendered: numbers, strings, elements or an array + // (or fragment) containing these types. + // see https://reactjs.org/docs/rendering-elements.html for more info + optionalNode: PropTypes.node, + + // A React element (ie. ). + optionalElement: PropTypes.element, + + // A React element type (eg. MyComponent). + // a function, string, or "element-like" object (eg. React.Fragment, Suspense, etc.) + // see https://github.com/facebook/react/blob/HEAD/packages/shared/isValidElementType.js + optionalElementType: PropTypes.elementType, + + // You can also declare that a prop is an instance of a class. This uses + // JS's instanceof operator. + optionalMessage: PropTypes.instanceOf(Message), + + // You can ensure that your prop is limited to specific values by treating + // it as an enum. + optionalEnum: PropTypes.oneOf(['News', 'Photos']), + + // An object that could be one of many types + optionalUnion: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + PropTypes.instanceOf(Message) + ]), + + // An array of a certain type + optionalArrayOf: PropTypes.arrayOf(PropTypes.number), + + // An object with property values of a certain type + optionalObjectOf: PropTypes.objectOf(PropTypes.number), + + // You can chain any of the above with `isRequired` to make sure a warning + // is shown if the prop isn't provided. + + // An object taking on a particular shape + optionalObjectWithShape: PropTypes.shape({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + // An object with warnings on extra properties + optionalObjectWithStrictShape: PropTypes.exact({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + requiredFunc: PropTypes.func.isRequired, + + // A value of any data type + requiredAny: PropTypes.any.isRequired, + + // You can also specify a custom validator. It should return an Error + // object if the validation fails. Don't `console.warn` or throw, as this + // won't work inside `oneOfType`. + customProp: function(props, propName, componentName) { + if (!/matchme/.test(props[propName])) { + return new Error( + 'Invalid prop `' + propName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }, + + // You can also supply a custom validator to `arrayOf` and `objectOf`. + // It should return an Error object if the validation fails. The validator + // will be called for each key in the array or object. The first two + // arguments of the validator are the array or object itself, and the + // current item's key. + customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) { + if (!/matchme/.test(propValue[key])) { + return new Error( + 'Invalid prop `' + propFullName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }) +}; +``` + +Refer to the [React documentation](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) for more information. + +## Migrating from React.PropTypes + +Check out [Migrating from React.PropTypes](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes) for details on how to migrate to `prop-types` from `React.PropTypes`. + +Note that this blog posts **mentions a codemod script that performs the conversion automatically**. + +There are also important notes below. + +## How to Depend on This Package? + +For apps, we recommend putting it in `dependencies` with a caret range. +For example: + +```js + "dependencies": { + "prop-types": "^15.5.7" + } +``` + +For libraries, we *also* recommend leaving it in `dependencies`: + +```js + "dependencies": { + "prop-types": "^15.5.7" + }, + "peerDependencies": { + "react": "^15.5.0" + } +``` + +**Note:** there are known issues in versions before 15.5.7 so we recommend using it as the minimal version. + +Make sure that the version range uses a caret (`^`) and thus is broad enough for npm to efficiently deduplicate packages. + +For UMD bundles of your components, make sure you **don’t** include `PropTypes` in the build. Usually this is done by marking it as an external (the specifics depend on your bundler), just like you do with React. + +## Compatibility + +### React 0.14 + +This package is compatible with **React 0.14.9**. Compared to 0.14.8 (which was released in March of 2016), there are no other changes in 0.14.9, so it should be a painless upgrade. + +```shell +# ATTENTION: Only run this if you still use React 0.14! +npm install --save react@^0.14.9 react-dom@^0.14.9 +``` + +### React 15+ + +This package is compatible with **React 15.3.0** and higher. + +``` +npm install --save react@^15.3.0 react-dom@^15.3.0 +``` + +### What happens on other React versions? + +It outputs warnings with the message below even though the developer doesn’t do anything wrong. Unfortunately there is no solution for this other than updating React to either 15.3.0 or higher, or 0.14.9 if you’re using React 0.14. + +## Difference from `React.PropTypes`: Don’t Call Validator Functions + +First of all, **which version of React are you using**? You might be seeing this message because a component library has updated to use `prop-types` package, but your version of React is incompatible with it. See the [above section](#compatibility) for more details. + +Are you using either React 0.14.9 or a version higher than React 15.3.0? Read on. + +When you migrate components to use the standalone `prop-types`, **all validator functions will start throwing an error if you call them directly**. This makes sure that nobody relies on them in production code, and it is safe to strip their implementations to optimize the bundle size. + +Code like this is still fine: + +```js +MyComponent.propTypes = { + myProp: PropTypes.bool +}; +``` + +However, code like this will not work with the `prop-types` package: + +```js +// Will not work with `prop-types` package! +var errorOrNull = PropTypes.bool(42, 'myProp', 'MyComponent', 'prop'); +``` + +It will throw an error: + +``` +Calling PropTypes validators directly is not supported by the `prop-types` package. +Use PropTypes.checkPropTypes() to call them. +``` + +(If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).) + +This is new behavior, and you will only encounter it when you migrate from `React.PropTypes` to the `prop-types` package. For the vast majority of components, this doesn’t matter, and if you didn’t see [this warning](https://facebook.github.io/react/warnings/dont-call-proptypes.html) in your components, your code is safe to migrate. This is not a breaking change in React because you are only opting into this change for a component by explicitly changing your imports to use `prop-types`. If you temporarily need the old behavior, you can keep using `React.PropTypes` until React 16. + +**If you absolutely need to trigger the validation manually**, call `PropTypes.checkPropTypes()`. Unlike the validators themselves, this function is safe to call in production, as it will be replaced by an empty function: + +```js +// Works with standalone PropTypes +PropTypes.checkPropTypes(MyComponent.propTypes, props, 'prop', 'MyComponent'); +``` +See below for more info. + +**If you DO want to use validation in production**, you can choose to use the **development version** by importing/requiring `prop-types/prop-types` instead of `prop-types`. + +**You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case. + +If you use a bundler like Browserify or Webpack, don’t forget to [follow these instructions](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) to correctly bundle your application in development or production mode. Otherwise you’ll ship unnecessary code to your users. + +## PropTypes.checkPropTypes + +React will automatically check the propTypes you set on the component, but if +you are using PropTypes without React then you may want to manually call +`PropTypes.checkPropTypes`, like so: + +```js +const myPropTypes = { + name: PropTypes.string, + age: PropTypes.number, + // ... define your prop validations +}; + +const props = { + name: 'hello', // is valid + age: 'world', // not valid +}; + +// Let's say your component is called 'MyComponent' + +// Works with standalone PropTypes +PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent'); +// This will warn as follows: +// Warning: Failed prop type: Invalid prop `age` of type `string` supplied to +// `MyComponent`, expected `number`. +``` + +## PropTypes.resetWarningCache() + +`PropTypes.checkPropTypes(...)` only `console.error`s a given message once. To reset the error warning cache in tests, call `PropTypes.resetWarningCache()` + +### License + +prop-types is [MIT licensed](./LICENSE). diff --git a/graphql-subscription/node_modules/prop-types/checkPropTypes.js b/graphql-subscription/node_modules/prop-types/checkPropTypes.js new file mode 100644 index 0000000..481f2cf --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/checkPropTypes.js @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + var loggedTypeFailures = {}; + var has = require('./lib/has'); + + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) { /**/ } + }; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' + ); + err.name = 'Invariant Violation'; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ); + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } + } +} + +/** + * Resets warning cache when testing. + * + * @private + */ +checkPropTypes.resetWarningCache = function() { + if (process.env.NODE_ENV !== 'production') { + loggedTypeFailures = {}; + } +} + +module.exports = checkPropTypes; diff --git a/graphql-subscription/node_modules/prop-types/factory.js b/graphql-subscription/node_modules/prop-types/factory.js new file mode 100644 index 0000000..abdf8e6 --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/factory.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = require('./factoryWithTypeCheckers'); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; diff --git a/graphql-subscription/node_modules/prop-types/factoryWithThrowingShims.js b/graphql-subscription/node_modules/prop-types/factoryWithThrowingShims.js new file mode 100644 index 0000000..ac88267 --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/factoryWithThrowingShims.js @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + +function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bigint: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction + }; + + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/graphql-subscription/node_modules/prop-types/factoryWithTypeCheckers.js b/graphql-subscription/node_modules/prop-types/factoryWithTypeCheckers.js new file mode 100644 index 0000000..a88068e --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/factoryWithTypeCheckers.js @@ -0,0 +1,610 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactIs = require('react-is'); +var assign = require('object-assign'); + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); +var has = require('./lib/has'); +var checkPropTypes = require('./checkPropTypes'); + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +function emptyFunctionThatReturnsNull() { + return null; +} + +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bigint: createPrimitiveTypeChecker('bigint'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message, data) { + this.message = message; + this.data = data && typeof data === 'object' ? data: {}; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), + {expectedType: expectedType} + ); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!ReactIs.isValidElementType(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + if (process.env.NODE_ENV !== 'production') { + if (arguments.length > 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { + return null; + } + if (checkerResult.data && has(checkerResult.data, 'expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } + } + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/graphql-subscription/node_modules/prop-types/index.js b/graphql-subscription/node_modules/prop-types/index.js new file mode 100644 index 0000000..e9ef51d --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/index.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (process.env.NODE_ENV !== 'production') { + var ReactIs = require('react-is'); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} diff --git a/graphql-subscription/node_modules/prop-types/lib/ReactPropTypesSecret.js b/graphql-subscription/node_modules/prop-types/lib/ReactPropTypesSecret.js new file mode 100644 index 0000000..f54525e --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/lib/ReactPropTypesSecret.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; diff --git a/graphql-subscription/node_modules/prop-types/lib/has.js b/graphql-subscription/node_modules/prop-types/lib/has.js new file mode 100644 index 0000000..007bae3 --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/lib/has.js @@ -0,0 +1 @@ +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); diff --git a/graphql-subscription/node_modules/prop-types/package.json b/graphql-subscription/node_modules/prop-types/package.json new file mode 100644 index 0000000..63daf70 --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/package.json @@ -0,0 +1,60 @@ +{ + "name": "prop-types", + "version": "15.8.1", + "description": "Runtime type checking for React props and similar objects.", + "sideEffects": false, + "main": "index.js", + "license": "MIT", + "files": [ + "LICENSE", + "README.md", + "checkPropTypes.js", + "factory.js", + "factoryWithThrowingShims.js", + "factoryWithTypeCheckers.js", + "index.js", + "prop-types.js", + "prop-types.min.js", + "lib" + ], + "repository": "facebook/prop-types", + "keywords": [ + "react" + ], + "bugs": { + "url": "https://github.com/facebook/prop-types/issues" + }, + "homepage": "https://facebook.github.io/react/", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + }, + "scripts": { + "pretest": "npm run lint", + "lint": "eslint .", + "test": "npm run tests-only", + "tests-only": "jest", + "umd": "NODE_ENV=development browserify index.js -t loose-envify --standalone PropTypes -o prop-types.js", + "umd-min": "NODE_ENV=production browserify index.js -t loose-envify -t uglifyify --standalone PropTypes -p bundle-collapser/plugin -o | uglifyjs --compress unused,dead_code -o prop-types.min.js", + "build": "yarn umd && yarn umd-min", + "prepublish": "not-in-publish || yarn build" + }, + "devDependencies": { + "babel-jest": "^19.0.0", + "babel-preset-react": "^6.24.1", + "browserify": "^16.5.0", + "bundle-collapser": "^1.4.0", + "eslint": "^8.6.0", + "in-publish": "^2.0.1", + "jest": "^19.0.2", + "react": "^15.7.0", + "uglifyify": "^5.0.2", + "uglifyjs": "^2.4.11" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + } +} diff --git a/graphql-subscription/node_modules/prop-types/prop-types.js b/graphql-subscription/node_modules/prop-types/prop-types.js new file mode 100644 index 0000000..a5a15dd --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/prop-types.js @@ -0,0 +1,1315 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + "development" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { + return null; + } + if (checkerResult.data.hasOwnProperty('expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } + } + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + +},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"./lib/has":6,"object-assign":7,"react-is":11}],4:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if ("development" !== 'production') { + var ReactIs = require('react-is'); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} + +},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3,"react-is":11}],5:[function(require,module,exports){ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +},{}],6:[function(require,module,exports){ +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); + +},{}],7:[function(require,module,exports){ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + +},{}],8:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],9:[function(require,module,exports){ +(function (process){(function (){ +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + + + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + +var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; +var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; +var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; +var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; +var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + +function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); +} + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; +} // AsyncMode is deprecated along with isAsyncMode + +var AsyncMode = REACT_ASYNC_MODE_TYPE; +var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; +var ContextConsumer = REACT_CONTEXT_TYPE; +var ContextProvider = REACT_PROVIDER_TYPE; +var Element = REACT_ELEMENT_TYPE; +var ForwardRef = REACT_FORWARD_REF_TYPE; +var Fragment = REACT_FRAGMENT_TYPE; +var Lazy = REACT_LAZY_TYPE; +var Memo = REACT_MEMO_TYPE; +var Portal = REACT_PORTAL_TYPE; +var Profiler = REACT_PROFILER_TYPE; +var StrictMode = REACT_STRICT_MODE_TYPE; +var Suspense = REACT_SUSPENSE_TYPE; +var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + +function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; +} +function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; +} +function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; +} +function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; +} +function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} +function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; +} +function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; +} +function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; +} +function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; +} +function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; +} +function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; +} +function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; +} +function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; +} + +exports.AsyncMode = AsyncMode; +exports.ConcurrentMode = ConcurrentMode; +exports.ContextConsumer = ContextConsumer; +exports.ContextProvider = ContextProvider; +exports.Element = Element; +exports.ForwardRef = ForwardRef; +exports.Fragment = Fragment; +exports.Lazy = Lazy; +exports.Memo = Memo; +exports.Portal = Portal; +exports.Profiler = Profiler; +exports.StrictMode = StrictMode; +exports.Suspense = Suspense; +exports.isAsyncMode = isAsyncMode; +exports.isConcurrentMode = isConcurrentMode; +exports.isContextConsumer = isContextConsumer; +exports.isContextProvider = isContextProvider; +exports.isElement = isElement; +exports.isForwardRef = isForwardRef; +exports.isFragment = isFragment; +exports.isLazy = isLazy; +exports.isMemo = isMemo; +exports.isPortal = isPortal; +exports.isProfiler = isProfiler; +exports.isStrictMode = isStrictMode; +exports.isSuspense = isSuspense; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; + })(); +} + +}).call(this)}).call(this,require('_process')) +},{"_process":8}],10:[function(require,module,exports){ +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; + +},{}],11:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} + +}).call(this)}).call(this,require('_process')) +},{"./cjs/react-is.development.js":9,"./cjs/react-is.production.min.js":10,"_process":8}]},{},[4])(4) +}); diff --git a/graphql-subscription/node_modules/prop-types/prop-types.min.js b/graphql-subscription/node_modules/prop-types/prop-types.min.js new file mode 100644 index 0000000..7a746e1 --- /dev/null +++ b/graphql-subscription/node_modules/prop-types/prop-types.min.js @@ -0,0 +1 @@ +!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).PropTypes=f()}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var p="function"==typeof require&&require;if(!f&&p)return p(i,!0);if(u)return u(i,!0);throw(p=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",p}p=n[i]={exports:{}},e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i React.createElement("div"); + +const ForwardRefComponent = React.forwardRef((props, ref) => + React.createElement(Component, { forwardedRef: ref, ...props }) +); + +const Context = React.createContext(false); + +ReactIs.isValidElementType("div"); // true +ReactIs.isValidElementType(ClassComponent); // true +ReactIs.isValidElementType(FunctionComponent); // true +ReactIs.isValidElementType(ForwardRefComponent); // true +ReactIs.isValidElementType(Context.Provider); // true +ReactIs.isValidElementType(Context.Consumer); // true +ReactIs.isValidElementType(React.createFactory("div")); // true +``` + +### Determining an Element's Type + +#### Context + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +const ThemeContext = React.createContext("blue"); + +ReactIs.isContextConsumer(); // true +ReactIs.isContextProvider(); // true +ReactIs.typeOf() === ReactIs.ContextProvider; // true +ReactIs.typeOf() === ReactIs.ContextConsumer; // true +``` + +#### Element + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isElement(
    ); // true +ReactIs.typeOf(
    ) === ReactIs.Element; // true +``` + +#### Fragment + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isFragment(<>); // true +ReactIs.typeOf(<>) === ReactIs.Fragment; // true +``` + +#### Portal + +```js +import React from "react"; +import ReactDOM from "react-dom"; +import * as ReactIs from 'react-is'; + +const div = document.createElement("div"); +const portal = ReactDOM.createPortal(
    , div); + +ReactIs.isPortal(portal); // true +ReactIs.typeOf(portal) === ReactIs.Portal; // true +``` + +#### StrictMode + +```js +import React from "react"; +import * as ReactIs from 'react-is'; + +ReactIs.isStrictMode(); // true +ReactIs.typeOf() === ReactIs.StrictMode; // true +``` diff --git a/graphql-subscription/node_modules/react-is/build-info.json b/graphql-subscription/node_modules/react-is/build-info.json new file mode 100644 index 0000000..4094da6 --- /dev/null +++ b/graphql-subscription/node_modules/react-is/build-info.json @@ -0,0 +1,8 @@ +{ + "branch": "pull/18344", + "buildNumber": "106499", + "checksum": "7fe5a2e", + "commit": "da834083c", + "environment": "ci", + "reactVersion": "16.12.0-da834083c" +} diff --git a/graphql-subscription/node_modules/react-is/cjs/react-is.development.js b/graphql-subscription/node_modules/react-is/cjs/react-is.development.js new file mode 100644 index 0000000..8a80b76 --- /dev/null +++ b/graphql-subscription/node_modules/react-is/cjs/react-is.development.js @@ -0,0 +1,181 @@ +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + + + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +// (unstable) APIs that have been removed. Can we remove the symbols? + +var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; +var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; +var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; +var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; +var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + +function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); +} + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; +} // AsyncMode is deprecated along with isAsyncMode + +var AsyncMode = REACT_ASYNC_MODE_TYPE; +var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; +var ContextConsumer = REACT_CONTEXT_TYPE; +var ContextProvider = REACT_PROVIDER_TYPE; +var Element = REACT_ELEMENT_TYPE; +var ForwardRef = REACT_FORWARD_REF_TYPE; +var Fragment = REACT_FRAGMENT_TYPE; +var Lazy = REACT_LAZY_TYPE; +var Memo = REACT_MEMO_TYPE; +var Portal = REACT_PORTAL_TYPE; +var Profiler = REACT_PROFILER_TYPE; +var StrictMode = REACT_STRICT_MODE_TYPE; +var Suspense = REACT_SUSPENSE_TYPE; +var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + +function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; +} +function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; +} +function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; +} +function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; +} +function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} +function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; +} +function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; +} +function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; +} +function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; +} +function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; +} +function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; +} +function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; +} +function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; +} + +exports.AsyncMode = AsyncMode; +exports.ConcurrentMode = ConcurrentMode; +exports.ContextConsumer = ContextConsumer; +exports.ContextProvider = ContextProvider; +exports.Element = Element; +exports.ForwardRef = ForwardRef; +exports.Fragment = Fragment; +exports.Lazy = Lazy; +exports.Memo = Memo; +exports.Portal = Portal; +exports.Profiler = Profiler; +exports.StrictMode = StrictMode; +exports.Suspense = Suspense; +exports.isAsyncMode = isAsyncMode; +exports.isConcurrentMode = isConcurrentMode; +exports.isContextConsumer = isContextConsumer; +exports.isContextProvider = isContextProvider; +exports.isElement = isElement; +exports.isForwardRef = isForwardRef; +exports.isFragment = isFragment; +exports.isLazy = isLazy; +exports.isMemo = isMemo; +exports.isPortal = isPortal; +exports.isProfiler = isProfiler; +exports.isStrictMode = isStrictMode; +exports.isSuspense = isSuspense; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; + })(); +} diff --git a/graphql-subscription/node_modules/react-is/cjs/react-is.production.min.js b/graphql-subscription/node_modules/react-is/cjs/react-is.production.min.js new file mode 100644 index 0000000..3e83c7a --- /dev/null +++ b/graphql-subscription/node_modules/react-is/cjs/react-is.production.min.js @@ -0,0 +1,15 @@ +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; diff --git a/graphql-subscription/node_modules/react-is/index.js b/graphql-subscription/node_modules/react-is/index.js new file mode 100644 index 0000000..3ae098d --- /dev/null +++ b/graphql-subscription/node_modules/react-is/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} diff --git a/graphql-subscription/node_modules/react-is/package.json b/graphql-subscription/node_modules/react-is/package.json new file mode 100644 index 0000000..5f32de2 --- /dev/null +++ b/graphql-subscription/node_modules/react-is/package.json @@ -0,0 +1,27 @@ +{ + "name": "react-is", + "version": "16.13.1", + "description": "Brand checking of React Elements.", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react-is" + }, + "keywords": [ + "react" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/facebook/react/issues" + }, + "homepage": "https://reactjs.org/", + "files": [ + "LICENSE", + "README.md", + "build-info.json", + "index.js", + "cjs/", + "umd/" + ] +} diff --git a/graphql-subscription/node_modules/react-is/umd/react-is.development.js b/graphql-subscription/node_modules/react-is/umd/react-is.development.js new file mode 100644 index 0000000..a6bc018 --- /dev/null +++ b/graphql-subscription/node_modules/react-is/umd/react-is.development.js @@ -0,0 +1,181 @@ +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.ReactIs = {})); +}(this, (function (exports) { 'use strict'; + + // The Symbol used to tag the ReactElement-like types. If there is no native Symbol + // nor polyfill, then a plain number is used for performance. + var hasSymbol = typeof Symbol === 'function' && Symbol.for; + var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; + var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; + var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; + var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; + var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; + var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; + var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary + // (unstable) APIs that have been removed. Can we remove the symbols? + + var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; + var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; + var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; + var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; + var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; + var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; + var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; + var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; + var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; + var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; + var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; + + function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); + } + + function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + switch (type) { + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + + default: + var $$typeofType = type && type.$$typeof; + + switch ($$typeofType) { + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + + default: + return $$typeof; + } + + } + + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + + return undefined; + } // AsyncMode is deprecated along with isAsyncMode + + var AsyncMode = REACT_ASYNC_MODE_TYPE; + var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; + var ContextConsumer = REACT_CONTEXT_TYPE; + var ContextProvider = REACT_PROVIDER_TYPE; + var Element = REACT_ELEMENT_TYPE; + var ForwardRef = REACT_FORWARD_REF_TYPE; + var Fragment = REACT_FRAGMENT_TYPE; + var Lazy = REACT_LAZY_TYPE; + var Memo = REACT_MEMO_TYPE; + var Portal = REACT_PORTAL_TYPE; + var Profiler = REACT_PROFILER_TYPE; + var StrictMode = REACT_STRICT_MODE_TYPE; + var Suspense = REACT_SUSPENSE_TYPE; + var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + + function isAsyncMode(object) { + { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + + console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; + } + function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; + } + function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; + } + function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; + } + function isElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; + } + function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; + } + function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; + } + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; + } + function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; + } + function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; + } + function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; + } + + exports.AsyncMode = AsyncMode; + exports.ConcurrentMode = ConcurrentMode; + exports.ContextConsumer = ContextConsumer; + exports.ContextProvider = ContextProvider; + exports.Element = Element; + exports.ForwardRef = ForwardRef; + exports.Fragment = Fragment; + exports.Lazy = Lazy; + exports.Memo = Memo; + exports.Portal = Portal; + exports.Profiler = Profiler; + exports.StrictMode = StrictMode; + exports.Suspense = Suspense; + exports.isAsyncMode = isAsyncMode; + exports.isConcurrentMode = isConcurrentMode; + exports.isContextConsumer = isContextConsumer; + exports.isContextProvider = isContextProvider; + exports.isElement = isElement; + exports.isForwardRef = isForwardRef; + exports.isFragment = isFragment; + exports.isLazy = isLazy; + exports.isMemo = isMemo; + exports.isPortal = isPortal; + exports.isProfiler = isProfiler; + exports.isStrictMode = isStrictMode; + exports.isSuspense = isSuspense; + exports.isValidElementType = isValidElementType; + exports.typeOf = typeOf; + +}))); diff --git a/graphql-subscription/node_modules/react-is/umd/react-is.production.min.js b/graphql-subscription/node_modules/react-is/umd/react-is.production.min.js new file mode 100644 index 0000000..62fe6b2 --- /dev/null +++ b/graphql-subscription/node_modules/react-is/umd/react-is.production.min.js @@ -0,0 +1,13 @@ +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';(function(b,d){"object"===typeof exports&&"undefined"!==typeof module?d(exports):"function"===typeof define&&define.amd?define(["exports"],d):(b=b||self,d(b.ReactIs={}))})(this,function(b){function d(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case r:switch(a=a.type,a){case t:case e:case f:case g:case h:case k:return a;default:switch(a=a&&a.$$typeof,a){case l:case m:case n:case p:case q:return a;default:return b}}case u:return b}}}function v(a){return d(a)===e}var c= +"function"===typeof Symbol&&Symbol.for,r=c?Symbol.for("react.element"):60103,u=c?Symbol.for("react.portal"):60106,f=c?Symbol.for("react.fragment"):60107,h=c?Symbol.for("react.strict_mode"):60108,g=c?Symbol.for("react.profiler"):60114,q=c?Symbol.for("react.provider"):60109,l=c?Symbol.for("react.context"):60110,t=c?Symbol.for("react.async_mode"):60111,e=c?Symbol.for("react.concurrent_mode"):60111,m=c?Symbol.for("react.forward_ref"):60112,k=c?Symbol.for("react.suspense"):60113,w=c?Symbol.for("react.suspense_list"): +60120,p=c?Symbol.for("react.memo"):60115,n=c?Symbol.for("react.lazy"):60116,x=c?Symbol.for("react.block"):60121,y=c?Symbol.for("react.fundamental"):60117,z=c?Symbol.for("react.responder"):60118,A=c?Symbol.for("react.scope"):60119;b.AsyncMode=t;b.ConcurrentMode=e;b.ContextConsumer=l;b.ContextProvider=q;b.Element=r;b.ForwardRef=m;b.Fragment=f;b.Lazy=n;b.Memo=p;b.Portal=u;b.Profiler=g;b.StrictMode=h;b.Suspense=k;b.isAsyncMode=function(a){return v(a)||d(a)===t};b.isConcurrentMode=v;b.isContextConsumer= +function(a){return d(a)===l};b.isContextProvider=function(a){return d(a)===q};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===r};b.isForwardRef=function(a){return d(a)===m};b.isFragment=function(a){return d(a)===f};b.isLazy=function(a){return d(a)===n};b.isMemo=function(a){return d(a)===p};b.isPortal=function(a){return d(a)===u};b.isProfiler=function(a){return d(a)===g};b.isStrictMode=function(a){return d(a)===h};b.isSuspense=function(a){return d(a)===k};b.isValidElementType= +function(a){return"string"===typeof a||"function"===typeof a||a===f||a===e||a===g||a===h||a===k||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===n||a.$$typeof===p||a.$$typeof===q||a.$$typeof===l||a.$$typeof===m||a.$$typeof===y||a.$$typeof===z||a.$$typeof===A||a.$$typeof===x)};b.typeOf=d}); diff --git a/graphql-subscription/node_modules/react/LICENSE b/graphql-subscription/node_modules/react/LICENSE new file mode 100644 index 0000000..b96dcb0 --- /dev/null +++ b/graphql-subscription/node_modules/react/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/react/README.md b/graphql-subscription/node_modules/react/README.md new file mode 100644 index 0000000..826563e --- /dev/null +++ b/graphql-subscription/node_modules/react/README.md @@ -0,0 +1,37 @@ +# `react` + +React is a JavaScript library for creating user interfaces. + +The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments. + +**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application. + +## Usage + +```js +import { useState } from 'react'; +import { createRoot } from 'react-dom/client'; + +function Counter() { + const [count, setCount] = useState(0); + return ( + <> +

    {count}

    + + + ); +} + +const root = createRoot(document.getElementById('root')); +root.render(); +``` + +## Documentation + +See https://reactjs.org/ + +## API + +See https://reactjs.org/docs/react-api.html diff --git a/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.development.js b/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.development.js new file mode 100644 index 0000000..3fe63ac --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.development.js @@ -0,0 +1,1296 @@ +/** + * @license React + * react-jsx-dev-runtime.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +var React = require('react'); + +// ATTENTION +// When adding new symbols to this file, +// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' +// The Symbol used to tag the ReactElement-like types. +var REACT_ELEMENT_TYPE = Symbol.for('react.element'); +var REACT_PORTAL_TYPE = Symbol.for('react.portal'); +var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); +var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); +var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); +var REACT_CONTEXT_TYPE = Symbol.for('react.context'); +var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); +var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); +var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); +var REACT_MEMO_TYPE = Symbol.for('react.memo'); +var REACT_LAZY_TYPE = Symbol.for('react.lazy'); +var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); +var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = '@@iterator'; +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== 'object') { + return null; + } + + var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === 'function') { + return maybeIterator; + } + + return null; +} + +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +function error(format) { + { + { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + printWarning('error', format, args); + } + } +} + +function printWarning(level, format, args) { + // When changing this logic, you might want to also + // update consoleWithStackDev.www.js as well. + { + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + + if (stack !== '') { + format += '%s'; + args = args.concat([stack]); + } // eslint-disable-next-line react-internal/safe-string-coercion + + + var argsWithFormat = args.map(function (item) { + return String(item); + }); // Careful: RN currently depends on this prefix + + argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + // eslint-disable-next-line react-internal/no-production-logging + + Function.prototype.apply.call(console[level], console, argsWithFormat); + } +} + +// ----------------------------------------------------------------------------- + +var enableScopeAPI = false; // Experimental Create Event Handle API. +var enableCacheElement = false; +var enableTransitionTracing = false; // No known bugs, but needs performance testing + +var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber +// stuff. Intended to enable React core members to more easily debug scheduling +// issues in DEV builds. + +var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + +var REACT_MODULE_REFERENCE; + +{ + REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); +} + +function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; +} + +function getWrappedName(outerType, innerType, wrapperName) { + var displayName = outerType.displayName; + + if (displayName) { + return displayName; + } + + var functionName = innerType.displayName || innerType.name || ''; + return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; +} // Keep in sync with react-reconciler/getComponentNameFromFiber + + +function getContextName(type) { + return type.displayName || 'Context'; +} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. + + +function getComponentNameFromType(type) { + if (type == null) { + // Host root, text node or just invalid type. + return null; + } + + { + if (typeof type.tag === 'number') { + error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); + } + } + + if (typeof type === 'function') { + return type.displayName || type.name || null; + } + + if (typeof type === 'string') { + return type; + } + + switch (type) { + case REACT_FRAGMENT_TYPE: + return 'Fragment'; + + case REACT_PORTAL_TYPE: + return 'Portal'; + + case REACT_PROFILER_TYPE: + return 'Profiler'; + + case REACT_STRICT_MODE_TYPE: + return 'StrictMode'; + + case REACT_SUSPENSE_TYPE: + return 'Suspense'; + + case REACT_SUSPENSE_LIST_TYPE: + return 'SuspenseList'; + + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + var context = type; + return getContextName(context) + '.Consumer'; + + case REACT_PROVIDER_TYPE: + var provider = type; + return getContextName(provider._context) + '.Provider'; + + case REACT_FORWARD_REF_TYPE: + return getWrappedName(type, type.render, 'ForwardRef'); + + case REACT_MEMO_TYPE: + var outerName = type.displayName || null; + + if (outerName !== null) { + return outerName; + } + + return getComponentNameFromType(type.type) || 'Memo'; + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + return getComponentNameFromType(init(payload)); + } catch (x) { + return null; + } + } + + // eslint-disable-next-line no-fallthrough + } + } + + return null; +} + +var assign = Object.assign; + +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } +} + +var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; +var prefix; +function describeBuiltInComponentFrame(name, source, ownerFn) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } +} +var reentry = false; +var componentFrameCache; + +{ + var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap(); +} + +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if ( !fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + var control; + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher; + + { + previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactCurrentDispatcher.current = null; + disableLogs(); + } + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } + + fn(); + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sample.stack.split('\n'); + var controlLines = control.stack.split('\n'); + var s = sampleLines.length - 1; + var c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactCurrentDispatcher.current = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} +function describeFunctionComponentFrame(fn, source, ownerFn) { + { + return describeNativeComponentFrame(fn, false); + } +} + +function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); +} + +function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { + + if (type == null) { + return ''; + } + + if (typeof type === 'function') { + { + return describeNativeComponentFrame(type, shouldConstruct(type)); + } + } + + if (typeof type === 'string') { + return describeBuiltInComponentFrame(type); + } + + switch (type) { + case REACT_SUSPENSE_TYPE: + return describeBuiltInComponentFrame('Suspense'); + + case REACT_SUSPENSE_LIST_TYPE: + return describeBuiltInComponentFrame('SuspenseList'); + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + return describeFunctionComponentFrame(type.render); + + case REACT_MEMO_TYPE: + // Memo may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); + } catch (x) {} + } + } + } + + return ''; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var loggedTypeFailures = {}; +var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + +function setCurrentlyValidatingElement(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + ReactDebugCurrentFrame.setExtraStackFrame(stack); + } else { + ReactDebugCurrentFrame.setExtraStackFrame(null); + } + } +} + +function checkPropTypes(typeSpecs, values, location, componentName, element) { + { + // $FlowFixMe This is okay but Flow doesn't know it. + var has = Function.call.bind(hasOwnProperty); + + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + // eslint-disable-next-line react-internal/prod-error-codes + var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); + err.name = 'Invariant Violation'; + throw err; + } + + error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); + } catch (ex) { + error$1 = ex; + } + + if (error$1 && !(error$1 instanceof Error)) { + setCurrentlyValidatingElement(element); + + error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); + + setCurrentlyValidatingElement(null); + } + + if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error$1.message] = true; + setCurrentlyValidatingElement(element); + + error('Failed %s type: %s', location, error$1.message); + + setCurrentlyValidatingElement(null); + } + } + } + } +} + +var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + +function isArray(a) { + return isArrayImpl(a); +} + +/* + * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ +// $FlowFixMe only called in DEV, so void return is not possible. +function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; + var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; + return type; + } +} // $FlowFixMe only called in DEV, so void return is not possible. + + +function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } +} + +function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return '' + value; +} +function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } +} + +var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; +var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true +}; +var specialPropKeyWarningShown; +var specialPropRefWarningShown; +var didWarnAboutStringRefs; + +{ + didWarnAboutStringRefs = {}; +} + +function hasValidRef(config) { + { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.ref !== undefined; +} + +function hasValidKey(config) { + { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.key !== undefined; +} + +function warnIfStringRefCannotBeAutoConverted(config, self) { + { + if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) { + var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); + + if (!didWarnAboutStringRefs[componentName]) { + error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref); + + didWarnAboutStringRefs[componentName] = true; + } + } + } +} + +function defineKeyPropWarningGetter(props, displayName) { + { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + + error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + }; + + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); + } +} + +function defineRefPropWarningGetter(props, displayName) { + { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + + error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + }; + + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); + } +} +/** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, instanceof check + * will not work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} props + * @param {*} key + * @param {string|object} ref + * @param {*} owner + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @internal + */ + + +var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + // Record the component responsible for creating this element. + _owner: owner + }; + + { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); // self and source are DEV only properties. + + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; +}; +/** + * https://github.com/reactjs/rfcs/pull/107 + * @param {*} type + * @param {object} props + * @param {string} key + */ + +function jsxDEV(type, config, maybeKey, source, self) { + { + var propName; // Reserved names are extracted + + var props = {}; + var key = null; + var ref = null; // Currently, key can be spread in as a prop. This causes a potential + // issue if key is also explicitly declared (ie.
    + // or
    ). We want to deprecate key spread, + // but as an intermediary step, we will use jsxDEV for everything except + //
    , because we aren't currently able to tell if + // key is explicitly declared to be undefined or not. + + if (maybeKey !== undefined) { + { + checkKeyStringCoercion(maybeKey); + } + + key = '' + maybeKey; + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = '' + config.key; + } + + if (hasValidRef(config)) { + ref = config.ref; + warnIfStringRefCannotBeAutoConverted(config, self); + } // Remaining properties are added to a new props object + + + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } // Resolve default props + + + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + + if (key || ref) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); + } +} + +var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; +var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; + +function setCurrentlyValidatingElement$1(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + ReactDebugCurrentFrame$1.setExtraStackFrame(stack); + } else { + ReactDebugCurrentFrame$1.setExtraStackFrame(null); + } + } +} + +var propTypesMisspellWarningShown; + +{ + propTypesMisspellWarningShown = false; +} +/** + * Verifies the object is a ReactElement. + * See https://reactjs.org/docs/react-api.html#isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a ReactElement. + * @final + */ + + +function isValidElement(object) { + { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } +} + +function getDeclarationErrorAddendum() { + { + if (ReactCurrentOwner$1.current) { + var name = getComponentNameFromType(ReactCurrentOwner$1.current.type); + + if (name) { + return '\n\nCheck the render method of `' + name + '`.'; + } + } + + return ''; + } +} + +function getSourceInfoErrorAddendum(source) { + { + if (source !== undefined) { + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; + } + + return ''; + } +} +/** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + + +var ownerHasKeyUseWarning = {}; + +function getCurrentComponentErrorInfo(parentType) { + { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + + if (parentName) { + info = "\n\nCheck the top-level render call using <" + parentName + ">."; + } + } + + return info; + } +} +/** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ + + +function validateExplicitKey(element, parentType) { + { + if (!element._store || element._store.validated || element.key != null) { + return; + } + + element._store.validated = true; + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + + if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { + return; + } + + ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + var childOwner = ''; + + if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { + // Give the component that originally created this child. + childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; + } + + setCurrentlyValidatingElement$1(element); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + setCurrentlyValidatingElement$1(null); + } +} +/** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ + + +function validateChildKeys(node, parentType) { + { + if (typeof node !== 'object') { + return; + } + + if (isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + + if (isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + + if (typeof iteratorFn === 'function') { + // Entry iterators used to provide implicit keys, + // but now we print a separate warning for them later. + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + + while (!(step = iterator.next()).done) { + if (isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } + } +} +/** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ + + +function validatePropTypes(element) { + { + var type = element.type; + + if (type === null || type === undefined || typeof type === 'string') { + return; + } + + var propTypes; + + if (typeof type === 'function') { + propTypes = type.propTypes; + } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. + // Inner props are checked in the reconciler. + type.$$typeof === REACT_MEMO_TYPE)) { + propTypes = type.propTypes; + } else { + return; + } + + if (propTypes) { + // Intentionally inside to avoid triggering lazy initializers: + var name = getComponentNameFromType(type); + checkPropTypes(propTypes, element.props, 'prop', name, element); + } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { + propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: + + var _name = getComponentNameFromType(type); + + error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); + } + + if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { + error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); + } + } +} +/** + * Given a fragment, validate that it can only be provided with fragment props + * @param {ReactElement} fragment + */ + + +function validateFragmentProps(fragment) { + { + var keys = Object.keys(fragment.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentlyValidatingElement$1(null); + break; + } + } + + if (fragment.ref !== null) { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentlyValidatingElement$1(null); + } + } +} + +function jsxWithValidation(type, props, key, isStaticChildren, source, self) { + { + var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + + if (!validType) { + var info = ''; + + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + var sourceInfo = getSourceInfoErrorAddendum(source); + + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + var typeString; + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; + } + + error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); + } + + var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + + if (element == null) { + return element; + } // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + + + if (validType) { + var children = props.children; + + if (children !== undefined) { + if (isStaticChildren) { + if (isArray(children)) { + for (var i = 0; i < children.length; i++) { + validateChildKeys(children[i], type); + } + + if (Object.freeze) { + Object.freeze(children); + } + } else { + error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.'); + } + } else { + validateChildKeys(children, type); + } + } + } + + if (type === REACT_FRAGMENT_TYPE) { + validateFragmentProps(element); + } else { + validatePropTypes(element); + } + + return element; + } +} // These two functions exist to still get child warnings in dev + +var jsxDEV$1 = jsxWithValidation ; + +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsxDEV = jsxDEV$1; + })(); +} diff --git a/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js b/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js new file mode 100644 index 0000000..d117ce3 --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js @@ -0,0 +1,10 @@ +/** + * @license React + * react-jsx-dev-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var a=Symbol.for("react.fragment");exports.Fragment=a;exports.jsxDEV=void 0; diff --git a/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js b/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js new file mode 100644 index 0000000..1d8cf15 --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js @@ -0,0 +1,10 @@ +/** + * @license React + * react-jsx-dev-runtime.profiling.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var a=Symbol.for("react.fragment");exports.Fragment=a;exports.jsxDEV=void 0; diff --git a/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.development.js b/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.development.js new file mode 100644 index 0000000..946a597 --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.development.js @@ -0,0 +1,1314 @@ +/** + * @license React + * react-jsx-runtime.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; + +var React = require('react'); + +// ATTENTION +// When adding new symbols to this file, +// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' +// The Symbol used to tag the ReactElement-like types. +var REACT_ELEMENT_TYPE = Symbol.for('react.element'); +var REACT_PORTAL_TYPE = Symbol.for('react.portal'); +var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); +var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); +var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); +var REACT_CONTEXT_TYPE = Symbol.for('react.context'); +var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); +var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); +var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); +var REACT_MEMO_TYPE = Symbol.for('react.memo'); +var REACT_LAZY_TYPE = Symbol.for('react.lazy'); +var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); +var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = '@@iterator'; +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== 'object') { + return null; + } + + var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === 'function') { + return maybeIterator; + } + + return null; +} + +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + +function error(format) { + { + { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + printWarning('error', format, args); + } + } +} + +function printWarning(level, format, args) { + // When changing this logic, you might want to also + // update consoleWithStackDev.www.js as well. + { + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + + if (stack !== '') { + format += '%s'; + args = args.concat([stack]); + } // eslint-disable-next-line react-internal/safe-string-coercion + + + var argsWithFormat = args.map(function (item) { + return String(item); + }); // Careful: RN currently depends on this prefix + + argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + // eslint-disable-next-line react-internal/no-production-logging + + Function.prototype.apply.call(console[level], console, argsWithFormat); + } +} + +// ----------------------------------------------------------------------------- + +var enableScopeAPI = false; // Experimental Create Event Handle API. +var enableCacheElement = false; +var enableTransitionTracing = false; // No known bugs, but needs performance testing + +var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber +// stuff. Intended to enable React core members to more easily debug scheduling +// issues in DEV builds. + +var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + +var REACT_MODULE_REFERENCE; + +{ + REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); +} + +function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; +} + +function getWrappedName(outerType, innerType, wrapperName) { + var displayName = outerType.displayName; + + if (displayName) { + return displayName; + } + + var functionName = innerType.displayName || innerType.name || ''; + return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; +} // Keep in sync with react-reconciler/getComponentNameFromFiber + + +function getContextName(type) { + return type.displayName || 'Context'; +} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. + + +function getComponentNameFromType(type) { + if (type == null) { + // Host root, text node or just invalid type. + return null; + } + + { + if (typeof type.tag === 'number') { + error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); + } + } + + if (typeof type === 'function') { + return type.displayName || type.name || null; + } + + if (typeof type === 'string') { + return type; + } + + switch (type) { + case REACT_FRAGMENT_TYPE: + return 'Fragment'; + + case REACT_PORTAL_TYPE: + return 'Portal'; + + case REACT_PROFILER_TYPE: + return 'Profiler'; + + case REACT_STRICT_MODE_TYPE: + return 'StrictMode'; + + case REACT_SUSPENSE_TYPE: + return 'Suspense'; + + case REACT_SUSPENSE_LIST_TYPE: + return 'SuspenseList'; + + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + var context = type; + return getContextName(context) + '.Consumer'; + + case REACT_PROVIDER_TYPE: + var provider = type; + return getContextName(provider._context) + '.Provider'; + + case REACT_FORWARD_REF_TYPE: + return getWrappedName(type, type.render, 'ForwardRef'); + + case REACT_MEMO_TYPE: + var outerName = type.displayName || null; + + if (outerName !== null) { + return outerName; + } + + return getComponentNameFromType(type.type) || 'Memo'; + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + return getComponentNameFromType(init(payload)); + } catch (x) { + return null; + } + } + + // eslint-disable-next-line no-fallthrough + } + } + + return null; +} + +var assign = Object.assign; + +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } +} + +var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; +var prefix; +function describeBuiltInComponentFrame(name, source, ownerFn) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } +} +var reentry = false; +var componentFrameCache; + +{ + var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap(); +} + +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if ( !fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + var control; + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher; + + { + previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactCurrentDispatcher.current = null; + disableLogs(); + } + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } + + fn(); + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sample.stack.split('\n'); + var controlLines = control.stack.split('\n'); + var s = sampleLines.length - 1; + var c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactCurrentDispatcher.current = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} +function describeFunctionComponentFrame(fn, source, ownerFn) { + { + return describeNativeComponentFrame(fn, false); + } +} + +function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); +} + +function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { + + if (type == null) { + return ''; + } + + if (typeof type === 'function') { + { + return describeNativeComponentFrame(type, shouldConstruct(type)); + } + } + + if (typeof type === 'string') { + return describeBuiltInComponentFrame(type); + } + + switch (type) { + case REACT_SUSPENSE_TYPE: + return describeBuiltInComponentFrame('Suspense'); + + case REACT_SUSPENSE_LIST_TYPE: + return describeBuiltInComponentFrame('SuspenseList'); + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + return describeFunctionComponentFrame(type.render); + + case REACT_MEMO_TYPE: + // Memo may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); + } catch (x) {} + } + } + } + + return ''; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var loggedTypeFailures = {}; +var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + +function setCurrentlyValidatingElement(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + ReactDebugCurrentFrame.setExtraStackFrame(stack); + } else { + ReactDebugCurrentFrame.setExtraStackFrame(null); + } + } +} + +function checkPropTypes(typeSpecs, values, location, componentName, element) { + { + // $FlowFixMe This is okay but Flow doesn't know it. + var has = Function.call.bind(hasOwnProperty); + + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + // eslint-disable-next-line react-internal/prod-error-codes + var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); + err.name = 'Invariant Violation'; + throw err; + } + + error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); + } catch (ex) { + error$1 = ex; + } + + if (error$1 && !(error$1 instanceof Error)) { + setCurrentlyValidatingElement(element); + + error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); + + setCurrentlyValidatingElement(null); + } + + if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error$1.message] = true; + setCurrentlyValidatingElement(element); + + error('Failed %s type: %s', location, error$1.message); + + setCurrentlyValidatingElement(null); + } + } + } + } +} + +var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + +function isArray(a) { + return isArrayImpl(a); +} + +/* + * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ +// $FlowFixMe only called in DEV, so void return is not possible. +function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; + var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; + return type; + } +} // $FlowFixMe only called in DEV, so void return is not possible. + + +function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } +} + +function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return '' + value; +} +function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } +} + +var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; +var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true +}; +var specialPropKeyWarningShown; +var specialPropRefWarningShown; +var didWarnAboutStringRefs; + +{ + didWarnAboutStringRefs = {}; +} + +function hasValidRef(config) { + { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.ref !== undefined; +} + +function hasValidKey(config) { + { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.key !== undefined; +} + +function warnIfStringRefCannotBeAutoConverted(config, self) { + { + if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) { + var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); + + if (!didWarnAboutStringRefs[componentName]) { + error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref); + + didWarnAboutStringRefs[componentName] = true; + } + } + } +} + +function defineKeyPropWarningGetter(props, displayName) { + { + var warnAboutAccessingKey = function () { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + + error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + }; + + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); + } +} + +function defineRefPropWarningGetter(props, displayName) { + { + var warnAboutAccessingRef = function () { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + + error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + }; + + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); + } +} +/** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, instanceof check + * will not work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} props + * @param {*} key + * @param {string|object} ref + * @param {*} owner + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @internal + */ + + +var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + // Record the component responsible for creating this element. + _owner: owner + }; + + { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); // self and source are DEV only properties. + + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; +}; +/** + * https://github.com/reactjs/rfcs/pull/107 + * @param {*} type + * @param {object} props + * @param {string} key + */ + +function jsxDEV(type, config, maybeKey, source, self) { + { + var propName; // Reserved names are extracted + + var props = {}; + var key = null; + var ref = null; // Currently, key can be spread in as a prop. This causes a potential + // issue if key is also explicitly declared (ie.
    + // or
    ). We want to deprecate key spread, + // but as an intermediary step, we will use jsxDEV for everything except + //
    , because we aren't currently able to tell if + // key is explicitly declared to be undefined or not. + + if (maybeKey !== undefined) { + { + checkKeyStringCoercion(maybeKey); + } + + key = '' + maybeKey; + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = '' + config.key; + } + + if (hasValidRef(config)) { + ref = config.ref; + warnIfStringRefCannotBeAutoConverted(config, self); + } // Remaining properties are added to a new props object + + + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } // Resolve default props + + + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + + if (key || ref) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); + } +} + +var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; +var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; + +function setCurrentlyValidatingElement$1(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + ReactDebugCurrentFrame$1.setExtraStackFrame(stack); + } else { + ReactDebugCurrentFrame$1.setExtraStackFrame(null); + } + } +} + +var propTypesMisspellWarningShown; + +{ + propTypesMisspellWarningShown = false; +} +/** + * Verifies the object is a ReactElement. + * See https://reactjs.org/docs/react-api.html#isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a ReactElement. + * @final + */ + + +function isValidElement(object) { + { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } +} + +function getDeclarationErrorAddendum() { + { + if (ReactCurrentOwner$1.current) { + var name = getComponentNameFromType(ReactCurrentOwner$1.current.type); + + if (name) { + return '\n\nCheck the render method of `' + name + '`.'; + } + } + + return ''; + } +} + +function getSourceInfoErrorAddendum(source) { + { + if (source !== undefined) { + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; + } + + return ''; + } +} +/** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + + +var ownerHasKeyUseWarning = {}; + +function getCurrentComponentErrorInfo(parentType) { + { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + + if (parentName) { + info = "\n\nCheck the top-level render call using <" + parentName + ">."; + } + } + + return info; + } +} +/** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ + + +function validateExplicitKey(element, parentType) { + { + if (!element._store || element._store.validated || element.key != null) { + return; + } + + element._store.validated = true; + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + + if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { + return; + } + + ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + var childOwner = ''; + + if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { + // Give the component that originally created this child. + childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; + } + + setCurrentlyValidatingElement$1(element); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + setCurrentlyValidatingElement$1(null); + } +} +/** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ + + +function validateChildKeys(node, parentType) { + { + if (typeof node !== 'object') { + return; + } + + if (isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + + if (isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + + if (typeof iteratorFn === 'function') { + // Entry iterators used to provide implicit keys, + // but now we print a separate warning for them later. + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + + while (!(step = iterator.next()).done) { + if (isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } + } +} +/** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ + + +function validatePropTypes(element) { + { + var type = element.type; + + if (type === null || type === undefined || typeof type === 'string') { + return; + } + + var propTypes; + + if (typeof type === 'function') { + propTypes = type.propTypes; + } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. + // Inner props are checked in the reconciler. + type.$$typeof === REACT_MEMO_TYPE)) { + propTypes = type.propTypes; + } else { + return; + } + + if (propTypes) { + // Intentionally inside to avoid triggering lazy initializers: + var name = getComponentNameFromType(type); + checkPropTypes(propTypes, element.props, 'prop', name, element); + } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { + propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: + + var _name = getComponentNameFromType(type); + + error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); + } + + if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { + error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); + } + } +} +/** + * Given a fragment, validate that it can only be provided with fragment props + * @param {ReactElement} fragment + */ + + +function validateFragmentProps(fragment) { + { + var keys = Object.keys(fragment.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentlyValidatingElement$1(null); + break; + } + } + + if (fragment.ref !== null) { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentlyValidatingElement$1(null); + } + } +} + +function jsxWithValidation(type, props, key, isStaticChildren, source, self) { + { + var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + + if (!validType) { + var info = ''; + + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + var sourceInfo = getSourceInfoErrorAddendum(source); + + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + var typeString; + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; + } + + error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); + } + + var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + + if (element == null) { + return element; + } // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + + + if (validType) { + var children = props.children; + + if (children !== undefined) { + if (isStaticChildren) { + if (isArray(children)) { + for (var i = 0; i < children.length; i++) { + validateChildKeys(children[i], type); + } + + if (Object.freeze) { + Object.freeze(children); + } + } else { + error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.'); + } + } else { + validateChildKeys(children, type); + } + } + } + + if (type === REACT_FRAGMENT_TYPE) { + validateFragmentProps(element); + } else { + validatePropTypes(element); + } + + return element; + } +} // These two functions exist to still get child warnings in dev +// even with the prod transform. This means that jsxDEV is purely +// opt-in behavior for better messages but that we won't stop +// giving you warnings if you use production apis. + +function jsxWithValidationStatic(type, props, key) { + { + return jsxWithValidation(type, props, key, true); + } +} +function jsxWithValidationDynamic(type, props, key) { + { + return jsxWithValidation(type, props, key, false); + } +} + +var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children. +// for now we can ship identical prod functions + +var jsxs = jsxWithValidationStatic ; + +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.jsx = jsx; +exports.jsxs = jsxs; + })(); +} diff --git a/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.production.min.js b/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.production.min.js new file mode 100644 index 0000000..6d1e3a3 --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.production.min.js @@ -0,0 +1,11 @@ +/** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var f=require("react"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0}; +function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q; diff --git a/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.profiling.min.js b/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.profiling.min.js new file mode 100644 index 0000000..a392b06 --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react-jsx-runtime.profiling.min.js @@ -0,0 +1,11 @@ +/** + * @license React + * react-jsx-runtime.profiling.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var f=require("react"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0}; +function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q; diff --git a/graphql-subscription/node_modules/react/cjs/react.development.js b/graphql-subscription/node_modules/react/cjs/react.development.js new file mode 100644 index 0000000..304b87e --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react.development.js @@ -0,0 +1,2739 @@ +/** + * @license React + * react.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +if (process.env.NODE_ENV !== "production") { + (function() { + + 'use strict'; + +/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); +} + var ReactVersion = '18.2.0'; + +// ATTENTION +// When adding new symbols to this file, +// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' +// The Symbol used to tag the ReactElement-like types. +var REACT_ELEMENT_TYPE = Symbol.for('react.element'); +var REACT_PORTAL_TYPE = Symbol.for('react.portal'); +var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); +var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); +var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); +var REACT_CONTEXT_TYPE = Symbol.for('react.context'); +var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); +var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); +var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); +var REACT_MEMO_TYPE = Symbol.for('react.memo'); +var REACT_LAZY_TYPE = Symbol.for('react.lazy'); +var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); +var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = '@@iterator'; +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== 'object') { + return null; + } + + var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === 'function') { + return maybeIterator; + } + + return null; +} + +/** + * Keeps track of the current dispatcher. + */ +var ReactCurrentDispatcher = { + /** + * @internal + * @type {ReactComponent} + */ + current: null +}; + +/** + * Keeps track of the current batch's configuration such as how long an update + * should suspend for if it needs to. + */ +var ReactCurrentBatchConfig = { + transition: null +}; + +var ReactCurrentActQueue = { + current: null, + // Used to reproduce behavior of `batchedUpdates` in legacy mode. + isBatchingLegacy: false, + didScheduleLegacyUpdate: false +}; + +/** + * Keeps track of the current owner. + * + * The current owner is the component who should own any components that are + * currently being constructed. + */ +var ReactCurrentOwner = { + /** + * @internal + * @type {ReactComponent} + */ + current: null +}; + +var ReactDebugCurrentFrame = {}; +var currentExtraStackFrame = null; +function setExtraStackFrame(stack) { + { + currentExtraStackFrame = stack; + } +} + +{ + ReactDebugCurrentFrame.setExtraStackFrame = function (stack) { + { + currentExtraStackFrame = stack; + } + }; // Stack implementation injected by the current renderer. + + + ReactDebugCurrentFrame.getCurrentStack = null; + + ReactDebugCurrentFrame.getStackAddendum = function () { + var stack = ''; // Add an extra top frame while an element is being validated + + if (currentExtraStackFrame) { + stack += currentExtraStackFrame; + } // Delegate to the injected renderer-specific implementation + + + var impl = ReactDebugCurrentFrame.getCurrentStack; + + if (impl) { + stack += impl() || ''; + } + + return stack; + }; +} + +// ----------------------------------------------------------------------------- + +var enableScopeAPI = false; // Experimental Create Event Handle API. +var enableCacheElement = false; +var enableTransitionTracing = false; // No known bugs, but needs performance testing + +var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber +// stuff. Intended to enable React core members to more easily debug scheduling +// issues in DEV builds. + +var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + +var ReactSharedInternals = { + ReactCurrentDispatcher: ReactCurrentDispatcher, + ReactCurrentBatchConfig: ReactCurrentBatchConfig, + ReactCurrentOwner: ReactCurrentOwner +}; + +{ + ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; + ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; +} + +// by calls to these methods by a Babel plugin. +// +// In PROD (or in packages without access to React internals), +// they are left as they are instead. + +function warn(format) { + { + { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + printWarning('warn', format, args); + } + } +} +function error(format) { + { + { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + printWarning('error', format, args); + } + } +} + +function printWarning(level, format, args) { + // When changing this logic, you might want to also + // update consoleWithStackDev.www.js as well. + { + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + + if (stack !== '') { + format += '%s'; + args = args.concat([stack]); + } // eslint-disable-next-line react-internal/safe-string-coercion + + + var argsWithFormat = args.map(function (item) { + return String(item); + }); // Careful: RN currently depends on this prefix + + argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + // eslint-disable-next-line react-internal/no-production-logging + + Function.prototype.apply.call(console[level], console, argsWithFormat); + } +} + +var didWarnStateUpdateForUnmountedComponent = {}; + +function warnNoop(publicInstance, callerName) { + { + var _constructor = publicInstance.constructor; + var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; + var warningKey = componentName + "." + callerName; + + if (didWarnStateUpdateForUnmountedComponent[warningKey]) { + return; + } + + error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); + + didWarnStateUpdateForUnmountedComponent[warningKey] = true; + } +} +/** + * This is the abstract API for an update queue. + */ + + +var ReactNoopUpdateQueue = { + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function (publicInstance) { + return false; + }, + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {?function} callback Called after component is updated. + * @param {?string} callerName name of the calling function in the public API. + * @internal + */ + enqueueForceUpdate: function (publicInstance, callback, callerName) { + warnNoop(publicInstance, 'forceUpdate'); + }, + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} completeState Next state. + * @param {?function} callback Called after component is updated. + * @param {?string} callerName name of the calling function in the public API. + * @internal + */ + enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { + warnNoop(publicInstance, 'replaceState'); + }, + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} partialState Next partial state to be merged with state. + * @param {?function} callback Called after component is updated. + * @param {?string} Name of the calling function in the public API. + * @internal + */ + enqueueSetState: function (publicInstance, partialState, callback, callerName) { + warnNoop(publicInstance, 'setState'); + } +}; + +var assign = Object.assign; + +var emptyObject = {}; + +{ + Object.freeze(emptyObject); +} +/** + * Base class helpers for the updating state of a component. + */ + + +function Component(props, context, updater) { + this.props = props; + this.context = context; // If a component has string refs, we will assign a different object later. + + this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the + // renderer. + + this.updater = updater || ReactNoopUpdateQueue; +} + +Component.prototype.isReactComponent = {}; +/** + * Sets a subset of the state. Always use this to mutate + * state. You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * There is no guarantee that calls to `setState` will run synchronously, + * as they may eventually be batched together. You can provide an optional + * callback that will be executed when the call to setState is actually + * completed. + * + * When a function is provided to setState, it will be called at some point in + * the future (not synchronously). It will be called with the up to date + * component arguments (state, props, context). These values can be different + * from this.* because your function may be called after receiveProps but before + * shouldComponentUpdate, and this new state, props, and context will not yet be + * assigned to this. + * + * @param {object|function} partialState Next partial state or function to + * produce next partial state to be merged with current state. + * @param {?function} callback Called after state is updated. + * @final + * @protected + */ + +Component.prototype.setState = function (partialState, callback) { + if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) { + throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.'); + } + + this.updater.enqueueSetState(this, partialState, callback, 'setState'); +}; +/** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {?function} callback Called after update is complete. + * @final + * @protected + */ + + +Component.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); +}; +/** + * Deprecated APIs. These APIs used to exist on classic React classes but since + * we would like to deprecate them, we're not going to move them over to this + * modern base class. Instead, we define a getter that warns if it's accessed. + */ + + +{ + var deprecatedAPIs = { + isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], + replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] + }; + + var defineDeprecationWarning = function (methodName, info) { + Object.defineProperty(Component.prototype, methodName, { + get: function () { + warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); + + return undefined; + } + }); + }; + + for (var fnName in deprecatedAPIs) { + if (deprecatedAPIs.hasOwnProperty(fnName)) { + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + } + } +} + +function ComponentDummy() {} + +ComponentDummy.prototype = Component.prototype; +/** + * Convenience component with default shallow equality check for sCU. + */ + +function PureComponent(props, context, updater) { + this.props = props; + this.context = context; // If a component has string refs, we will assign a different object later. + + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; +} + +var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); +pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. + +assign(pureComponentPrototype, Component.prototype); +pureComponentPrototype.isPureReactComponent = true; + +// an immutable object with a single mutable value +function createRef() { + var refObject = { + current: null + }; + + { + Object.seal(refObject); + } + + return refObject; +} + +var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + +function isArray(a) { + return isArrayImpl(a); +} + +/* + * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ +// $FlowFixMe only called in DEV, so void return is not possible. +function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; + var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; + return type; + } +} // $FlowFixMe only called in DEV, so void return is not possible. + + +function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } +} + +function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return '' + value; +} +function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } +} + +function getWrappedName(outerType, innerType, wrapperName) { + var displayName = outerType.displayName; + + if (displayName) { + return displayName; + } + + var functionName = innerType.displayName || innerType.name || ''; + return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; +} // Keep in sync with react-reconciler/getComponentNameFromFiber + + +function getContextName(type) { + return type.displayName || 'Context'; +} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. + + +function getComponentNameFromType(type) { + if (type == null) { + // Host root, text node or just invalid type. + return null; + } + + { + if (typeof type.tag === 'number') { + error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); + } + } + + if (typeof type === 'function') { + return type.displayName || type.name || null; + } + + if (typeof type === 'string') { + return type; + } + + switch (type) { + case REACT_FRAGMENT_TYPE: + return 'Fragment'; + + case REACT_PORTAL_TYPE: + return 'Portal'; + + case REACT_PROFILER_TYPE: + return 'Profiler'; + + case REACT_STRICT_MODE_TYPE: + return 'StrictMode'; + + case REACT_SUSPENSE_TYPE: + return 'Suspense'; + + case REACT_SUSPENSE_LIST_TYPE: + return 'SuspenseList'; + + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + var context = type; + return getContextName(context) + '.Consumer'; + + case REACT_PROVIDER_TYPE: + var provider = type; + return getContextName(provider._context) + '.Provider'; + + case REACT_FORWARD_REF_TYPE: + return getWrappedName(type, type.render, 'ForwardRef'); + + case REACT_MEMO_TYPE: + var outerName = type.displayName || null; + + if (outerName !== null) { + return outerName; + } + + return getComponentNameFromType(type.type) || 'Memo'; + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + return getComponentNameFromType(init(payload)); + } catch (x) { + return null; + } + } + + // eslint-disable-next-line no-fallthrough + } + } + + return null; +} + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true +}; +var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; + +{ + didWarnAboutStringRefs = {}; +} + +function hasValidRef(config) { + { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.ref !== undefined; +} + +function hasValidKey(config) { + { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.key !== undefined; +} + +function defineKeyPropWarningGetter(props, displayName) { + var warnAboutAccessingKey = function () { + { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + + error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + } + }; + + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); +} + +function defineRefPropWarningGetter(props, displayName) { + var warnAboutAccessingRef = function () { + { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + + error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + } + }; + + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); +} + +function warnIfStringRefCannotBeAutoConverted(config) { + { + if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { + var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); + + if (!didWarnAboutStringRefs[componentName]) { + error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); + + didWarnAboutStringRefs[componentName] = true; + } + } + } +} +/** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, instanceof check + * will not work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} props + * @param {*} key + * @param {string|object} ref + * @param {*} owner + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @internal + */ + + +var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + // Record the component responsible for creating this element. + _owner: owner + }; + + { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); // self and source are DEV only properties. + + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; +}; +/** + * Create and return a new ReactElement of the given type. + * See https://reactjs.org/docs/react-api.html#createelement + */ + +function createElement(type, config, children) { + var propName; // Reserved names are extracted + + var props = {}; + var key = null; + var ref = null; + var self = null; + var source = null; + + if (config != null) { + if (hasValidRef(config)) { + ref = config.ref; + + { + warnIfStringRefCannotBeAutoConverted(config); + } + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = '' + config.key; + } + + self = config.__self === undefined ? null : config.__self; + source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object + + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } + } // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + + + var childrenLength = arguments.length - 2; + + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + + { + if (Object.freeze) { + Object.freeze(childArray); + } + } + + props.children = childArray; + } // Resolve default props + + + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + + { + if (key || ref) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + } + + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); +} +function cloneAndReplaceKey(oldElement, newKey) { + var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); + return newElement; +} +/** + * Clone and return a new ReactElement using element as the starting point. + * See https://reactjs.org/docs/react-api.html#cloneelement + */ + +function cloneElement(element, config, children) { + if (element === null || element === undefined) { + throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); + } + + var propName; // Original props are copied + + var props = assign({}, element.props); // Reserved names are extracted + + var key = element.key; + var ref = element.ref; // Self is preserved since the owner is preserved. + + var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a + // transpiler, and the original source is probably a better indicator of the + // true owner. + + var source = element._source; // Owner will be preserved, unless ref is overridden + + var owner = element._owner; + + if (config != null) { + if (hasValidRef(config)) { + // Silently steal the ref from the parent. + ref = config.ref; + owner = ReactCurrentOwner.current; + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = '' + config.key; + } // Remaining properties override existing props + + + var defaultProps; + + if (element.type && element.type.defaultProps) { + defaultProps = element.type.defaultProps; + } + + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + if (config[propName] === undefined && defaultProps !== undefined) { + // Resolve default props + props[propName] = defaultProps[propName]; + } else { + props[propName] = config[propName]; + } + } + } + } // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + + + var childrenLength = arguments.length - 2; + + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + + props.children = childArray; + } + + return ReactElement(element.type, key, ref, self, source, owner, props); +} +/** + * Verifies the object is a ReactElement. + * See https://reactjs.org/docs/react-api.html#isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a ReactElement. + * @final + */ + +function isValidElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; +} + +var SEPARATOR = '.'; +var SUBSEPARATOR = ':'; +/** + * Escape and wrap key so it is safe to use as a reactid + * + * @param {string} key to be escaped. + * @return {string} the escaped key. + */ + +function escape(key) { + var escapeRegex = /[=:]/g; + var escaperLookup = { + '=': '=0', + ':': '=2' + }; + var escapedString = key.replace(escapeRegex, function (match) { + return escaperLookup[match]; + }); + return '$' + escapedString; +} +/** + * TODO: Test that a single child and an array with one item have the same key + * pattern. + */ + + +var didWarnAboutMaps = false; +var userProvidedKeyEscapeRegex = /\/+/g; + +function escapeUserProvidedKey(text) { + return text.replace(userProvidedKeyEscapeRegex, '$&/'); +} +/** + * Generate a key string that identifies a element within a set. + * + * @param {*} element A element that could contain a manual key. + * @param {number} index Index that is used if a manual key is not provided. + * @return {string} + */ + + +function getElementKey(element, index) { + // Do some typechecking here since we call this blindly. We want to ensure + // that we don't block potential future ES APIs. + if (typeof element === 'object' && element !== null && element.key != null) { + // Explicit key + { + checkKeyStringCoercion(element.key); + } + + return escape('' + element.key); + } // Implicit key determined by the index in the set + + + return index.toString(36); +} + +function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + + if (type === 'undefined' || type === 'boolean') { + // All of the above are perceived as null. + children = null; + } + + var invokeCallback = false; + + if (children === null) { + invokeCallback = true; + } else { + switch (type) { + case 'string': + case 'number': + invokeCallback = true; + break; + + case 'object': + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = true; + } + + } + } + + if (invokeCallback) { + var _child = children; + var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array + // so that it's consistent if the number of children grows: + + var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; + + if (isArray(mappedChild)) { + var escapedChildKey = ''; + + if (childKey != null) { + escapedChildKey = escapeUserProvidedKey(childKey) + '/'; + } + + mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) { + return c; + }); + } else if (mappedChild != null) { + if (isValidElement(mappedChild)) { + { + // The `if` statement here prevents auto-disabling of the safe + // coercion ESLint rule, so we must manually disable it below. + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key + if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { + checkKeyStringCoercion(mappedChild.key); + } + } + + mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as + // traverseAllChildren used to do for objects as children + escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key + mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number + // eslint-disable-next-line react-internal/safe-string-coercion + escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); + } + + array.push(mappedChild); + } + + return 1; + } + + var child; + var nextName; + var subtreeCount = 0; // Count of children found in the current subtree. + + var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; + + if (isArray(children)) { + for (var i = 0; i < children.length; i++) { + child = children[i]; + nextName = nextNamePrefix + getElementKey(child, i); + subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); + } + } else { + var iteratorFn = getIteratorFn(children); + + if (typeof iteratorFn === 'function') { + var iterableChildren = children; + + { + // Warn about using Maps as children + if (iteratorFn === iterableChildren.entries) { + if (!didWarnAboutMaps) { + warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); + } + + didWarnAboutMaps = true; + } + } + + var iterator = iteratorFn.call(iterableChildren); + var step; + var ii = 0; + + while (!(step = iterator.next()).done) { + child = step.value; + nextName = nextNamePrefix + getElementKey(child, ii++); + subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); + } + } else if (type === 'object') { + // eslint-disable-next-line react-internal/safe-string-coercion + var childrenString = String(children); + throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); + } + } + + return subtreeCount; +} + +/** + * Maps children that are typically specified as `props.children`. + * + * See https://reactjs.org/docs/react-api.html#reactchildrenmap + * + * The provided mapFunction(child, index) will be called for each + * leaf child. + * + * @param {?*} children Children tree container. + * @param {function(*, int)} func The map function. + * @param {*} context Context for mapFunction. + * @return {object} Object containing the ordered map of results. + */ +function mapChildren(children, func, context) { + if (children == null) { + return children; + } + + var result = []; + var count = 0; + mapIntoArray(children, result, '', '', function (child) { + return func.call(context, child, count++); + }); + return result; +} +/** + * Count the number of children that are typically specified as + * `props.children`. + * + * See https://reactjs.org/docs/react-api.html#reactchildrencount + * + * @param {?*} children Children tree container. + * @return {number} The number of children. + */ + + +function countChildren(children) { + var n = 0; + mapChildren(children, function () { + n++; // Don't return anything + }); + return n; +} + +/** + * Iterates through children that are typically specified as `props.children`. + * + * See https://reactjs.org/docs/react-api.html#reactchildrenforeach + * + * The provided forEachFunc(child, index) will be called for each + * leaf child. + * + * @param {?*} children Children tree container. + * @param {function(*, int)} forEachFunc + * @param {*} forEachContext Context for forEachContext. + */ +function forEachChildren(children, forEachFunc, forEachContext) { + mapChildren(children, function () { + forEachFunc.apply(this, arguments); // Don't return anything. + }, forEachContext); +} +/** + * Flatten a children object (typically specified as `props.children`) and + * return an array with appropriately re-keyed children. + * + * See https://reactjs.org/docs/react-api.html#reactchildrentoarray + */ + + +function toArray(children) { + return mapChildren(children, function (child) { + return child; + }) || []; +} +/** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. + * + * See https://reactjs.org/docs/react-api.html#reactchildrenonly + * + * The current implementation of this function assumes that a single child gets + * passed without a wrapper, but the purpose of this helper function is to + * abstract away the particular structure of children. + * + * @param {?object} children Child collection structure. + * @return {ReactElement} The first and only `ReactElement` contained in the + * structure. + */ + + +function onlyChild(children) { + if (!isValidElement(children)) { + throw new Error('React.Children.only expected to receive a single React element child.'); + } + + return children; +} + +function createContext(defaultValue) { + // TODO: Second argument used to be an optional `calculateChangedBits` + // function. Warn to reserve for future use? + var context = { + $$typeof: REACT_CONTEXT_TYPE, + // As a workaround to support multiple concurrent renderers, we categorize + // some renderers as primary and others as secondary. We only expect + // there to be two concurrent renderers at most: React Native (primary) and + // Fabric (secondary); React DOM (primary) and React ART (secondary). + // Secondary renderers store their context values on separate fields. + _currentValue: defaultValue, + _currentValue2: defaultValue, + // Used to track how many concurrent renderers this context currently + // supports within in a single renderer. Such as parallel server rendering. + _threadCount: 0, + // These are circular + Provider: null, + Consumer: null, + // Add these to use same hidden class in VM as ServerContext + _defaultValue: null, + _globalName: null + }; + context.Provider = { + $$typeof: REACT_PROVIDER_TYPE, + _context: context + }; + var hasWarnedAboutUsingNestedContextConsumers = false; + var hasWarnedAboutUsingConsumerProvider = false; + var hasWarnedAboutDisplayNameOnConsumer = false; + + { + // A separate object, but proxies back to the original context object for + // backwards compatibility. It has a different $$typeof, so we can properly + // warn for the incorrect usage of Context as a Consumer. + var Consumer = { + $$typeof: REACT_CONTEXT_TYPE, + _context: context + }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here + + Object.defineProperties(Consumer, { + Provider: { + get: function () { + if (!hasWarnedAboutUsingConsumerProvider) { + hasWarnedAboutUsingConsumerProvider = true; + + error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); + } + + return context.Provider; + }, + set: function (_Provider) { + context.Provider = _Provider; + } + }, + _currentValue: { + get: function () { + return context._currentValue; + }, + set: function (_currentValue) { + context._currentValue = _currentValue; + } + }, + _currentValue2: { + get: function () { + return context._currentValue2; + }, + set: function (_currentValue2) { + context._currentValue2 = _currentValue2; + } + }, + _threadCount: { + get: function () { + return context._threadCount; + }, + set: function (_threadCount) { + context._threadCount = _threadCount; + } + }, + Consumer: { + get: function () { + if (!hasWarnedAboutUsingNestedContextConsumers) { + hasWarnedAboutUsingNestedContextConsumers = true; + + error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); + } + + return context.Consumer; + } + }, + displayName: { + get: function () { + return context.displayName; + }, + set: function (displayName) { + if (!hasWarnedAboutDisplayNameOnConsumer) { + warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); + + hasWarnedAboutDisplayNameOnConsumer = true; + } + } + } + }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty + + context.Consumer = Consumer; + } + + { + context._currentRenderer = null; + context._currentRenderer2 = null; + } + + return context; +} + +var Uninitialized = -1; +var Pending = 0; +var Resolved = 1; +var Rejected = 2; + +function lazyInitializer(payload) { + if (payload._status === Uninitialized) { + var ctor = payload._result; + var thenable = ctor(); // Transition to the next state. + // This might throw either because it's missing or throws. If so, we treat it + // as still uninitialized and try again next time. Which is the same as what + // happens if the ctor or any wrappers processing the ctor throws. This might + // end up fixing it if the resolution was a concurrency bug. + + thenable.then(function (moduleObject) { + if (payload._status === Pending || payload._status === Uninitialized) { + // Transition to the next state. + var resolved = payload; + resolved._status = Resolved; + resolved._result = moduleObject; + } + }, function (error) { + if (payload._status === Pending || payload._status === Uninitialized) { + // Transition to the next state. + var rejected = payload; + rejected._status = Rejected; + rejected._result = error; + } + }); + + if (payload._status === Uninitialized) { + // In case, we're still uninitialized, then we're waiting for the thenable + // to resolve. Set it as pending in the meantime. + var pending = payload; + pending._status = Pending; + pending._result = thenable; + } + } + + if (payload._status === Resolved) { + var moduleObject = payload._result; + + { + if (moduleObject === undefined) { + error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. + 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject); + } + } + + { + if (!('default' in moduleObject)) { + error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. + 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); + } + } + + return moduleObject.default; + } else { + throw payload._result; + } +} + +function lazy(ctor) { + var payload = { + // We use these fields to store the result. + _status: Uninitialized, + _result: ctor + }; + var lazyType = { + $$typeof: REACT_LAZY_TYPE, + _payload: payload, + _init: lazyInitializer + }; + + { + // In production, this would just set it on the object. + var defaultProps; + var propTypes; // $FlowFixMe + + Object.defineProperties(lazyType, { + defaultProps: { + configurable: true, + get: function () { + return defaultProps; + }, + set: function (newDefaultProps) { + error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); + + defaultProps = newDefaultProps; // Match production behavior more closely: + // $FlowFixMe + + Object.defineProperty(lazyType, 'defaultProps', { + enumerable: true + }); + } + }, + propTypes: { + configurable: true, + get: function () { + return propTypes; + }, + set: function (newPropTypes) { + error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); + + propTypes = newPropTypes; // Match production behavior more closely: + // $FlowFixMe + + Object.defineProperty(lazyType, 'propTypes', { + enumerable: true + }); + } + } + }); + } + + return lazyType; +} + +function forwardRef(render) { + { + if (render != null && render.$$typeof === REACT_MEMO_TYPE) { + error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); + } else if (typeof render !== 'function') { + error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); + } else { + if (render.length !== 0 && render.length !== 2) { + error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); + } + } + + if (render != null) { + if (render.defaultProps != null || render.propTypes != null) { + error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); + } + } + } + + var elementType = { + $$typeof: REACT_FORWARD_REF_TYPE, + render: render + }; + + { + var ownName; + Object.defineProperty(elementType, 'displayName', { + enumerable: false, + configurable: true, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; // The inner component shouldn't inherit this display name in most cases, + // because the component may be used elsewhere. + // But it's nice for anonymous functions to inherit the name, + // so that our component-stack generation logic will display their frames. + // An anonymous function generally suggests a pattern like: + // React.forwardRef((props, ref) => {...}); + // This kind of inner function is not used elsewhere so the side effect is okay. + + if (!render.name && !render.displayName) { + render.displayName = name; + } + } + }); + } + + return elementType; +} + +var REACT_MODULE_REFERENCE; + +{ + REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); +} + +function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; +} + +function memo(type, compare) { + { + if (!isValidElementType(type)) { + error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); + } + } + + var elementType = { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: compare === undefined ? null : compare + }; + + { + var ownName; + Object.defineProperty(elementType, 'displayName', { + enumerable: false, + configurable: true, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; // The inner component shouldn't inherit this display name in most cases, + // because the component may be used elsewhere. + // But it's nice for anonymous functions to inherit the name, + // so that our component-stack generation logic will display their frames. + // An anonymous function generally suggests a pattern like: + // React.memo((props) => {...}); + // This kind of inner function is not used elsewhere so the side effect is okay. + + if (!type.name && !type.displayName) { + type.displayName = name; + } + } + }); + } + + return elementType; +} + +function resolveDispatcher() { + var dispatcher = ReactCurrentDispatcher.current; + + { + if (dispatcher === null) { + error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); + } + } // Will result in a null access error if accessed outside render phase. We + // intentionally don't throw our own error because this is in a hot path. + // Also helps ensure this is inlined. + + + return dispatcher; +} +function useContext(Context) { + var dispatcher = resolveDispatcher(); + + { + // TODO: add a more generic warning for invalid values. + if (Context._context !== undefined) { + var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs + // and nobody should be using this in existing code. + + if (realContext.Consumer === Context) { + error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); + } else if (realContext.Provider === Context) { + error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); + } + } + } + + return dispatcher.useContext(Context); +} +function useState(initialState) { + var dispatcher = resolveDispatcher(); + return dispatcher.useState(initialState); +} +function useReducer(reducer, initialArg, init) { + var dispatcher = resolveDispatcher(); + return dispatcher.useReducer(reducer, initialArg, init); +} +function useRef(initialValue) { + var dispatcher = resolveDispatcher(); + return dispatcher.useRef(initialValue); +} +function useEffect(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useEffect(create, deps); +} +function useInsertionEffect(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useInsertionEffect(create, deps); +} +function useLayoutEffect(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useLayoutEffect(create, deps); +} +function useCallback(callback, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useCallback(callback, deps); +} +function useMemo(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useMemo(create, deps); +} +function useImperativeHandle(ref, create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useImperativeHandle(ref, create, deps); +} +function useDebugValue(value, formatterFn) { + { + var dispatcher = resolveDispatcher(); + return dispatcher.useDebugValue(value, formatterFn); + } +} +function useTransition() { + var dispatcher = resolveDispatcher(); + return dispatcher.useTransition(); +} +function useDeferredValue(value) { + var dispatcher = resolveDispatcher(); + return dispatcher.useDeferredValue(value); +} +function useId() { + var dispatcher = resolveDispatcher(); + return dispatcher.useId(); +} +function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { + var dispatcher = resolveDispatcher(); + return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); +} + +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } +} + +var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; +var prefix; +function describeBuiltInComponentFrame(name, source, ownerFn) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } +} +var reentry = false; +var componentFrameCache; + +{ + var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap(); +} + +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if ( !fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + var control; + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher; + + { + previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactCurrentDispatcher$1.current = null; + disableLogs(); + } + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } + + fn(); + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sample.stack.split('\n'); + var controlLines = control.stack.split('\n'); + var s = sampleLines.length - 1; + var c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactCurrentDispatcher$1.current = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} +function describeFunctionComponentFrame(fn, source, ownerFn) { + { + return describeNativeComponentFrame(fn, false); + } +} + +function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); +} + +function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { + + if (type == null) { + return ''; + } + + if (typeof type === 'function') { + { + return describeNativeComponentFrame(type, shouldConstruct(type)); + } + } + + if (typeof type === 'string') { + return describeBuiltInComponentFrame(type); + } + + switch (type) { + case REACT_SUSPENSE_TYPE: + return describeBuiltInComponentFrame('Suspense'); + + case REACT_SUSPENSE_LIST_TYPE: + return describeBuiltInComponentFrame('SuspenseList'); + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + return describeFunctionComponentFrame(type.render); + + case REACT_MEMO_TYPE: + // Memo may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); + } catch (x) {} + } + } + } + + return ''; +} + +var loggedTypeFailures = {}; +var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; + +function setCurrentlyValidatingElement(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + ReactDebugCurrentFrame$1.setExtraStackFrame(stack); + } else { + ReactDebugCurrentFrame$1.setExtraStackFrame(null); + } + } +} + +function checkPropTypes(typeSpecs, values, location, componentName, element) { + { + // $FlowFixMe This is okay but Flow doesn't know it. + var has = Function.call.bind(hasOwnProperty); + + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + // eslint-disable-next-line react-internal/prod-error-codes + var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); + err.name = 'Invariant Violation'; + throw err; + } + + error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); + } catch (ex) { + error$1 = ex; + } + + if (error$1 && !(error$1 instanceof Error)) { + setCurrentlyValidatingElement(element); + + error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); + + setCurrentlyValidatingElement(null); + } + + if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error$1.message] = true; + setCurrentlyValidatingElement(element); + + error('Failed %s type: %s', location, error$1.message); + + setCurrentlyValidatingElement(null); + } + } + } + } +} + +function setCurrentlyValidatingElement$1(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + setExtraStackFrame(stack); + } else { + setExtraStackFrame(null); + } + } +} + +var propTypesMisspellWarningShown; + +{ + propTypesMisspellWarningShown = false; +} + +function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = getComponentNameFromType(ReactCurrentOwner.current.type); + + if (name) { + return '\n\nCheck the render method of `' + name + '`.'; + } + } + + return ''; +} + +function getSourceInfoErrorAddendum(source) { + if (source !== undefined) { + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; + } + + return ''; +} + +function getSourceInfoErrorAddendumForProps(elementProps) { + if (elementProps !== null && elementProps !== undefined) { + return getSourceInfoErrorAddendum(elementProps.__source); + } + + return ''; +} +/** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + + +var ownerHasKeyUseWarning = {}; + +function getCurrentComponentErrorInfo(parentType) { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + + if (parentName) { + info = "\n\nCheck the top-level render call using <" + parentName + ">."; + } + } + + return info; +} +/** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ + + +function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + + element._store.validated = true; + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + + if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { + return; + } + + ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + var childOwner = ''; + + if (element && element._owner && element._owner !== ReactCurrentOwner.current) { + // Give the component that originally created this child. + childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; + } + + { + setCurrentlyValidatingElement$1(element); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + setCurrentlyValidatingElement$1(null); + } +} +/** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ + + +function validateChildKeys(node, parentType) { + if (typeof node !== 'object') { + return; + } + + if (isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + + if (isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + + if (typeof iteratorFn === 'function') { + // Entry iterators used to provide implicit keys, + // but now we print a separate warning for them later. + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + + while (!(step = iterator.next()).done) { + if (isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } +} +/** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ + + +function validatePropTypes(element) { + { + var type = element.type; + + if (type === null || type === undefined || typeof type === 'string') { + return; + } + + var propTypes; + + if (typeof type === 'function') { + propTypes = type.propTypes; + } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. + // Inner props are checked in the reconciler. + type.$$typeof === REACT_MEMO_TYPE)) { + propTypes = type.propTypes; + } else { + return; + } + + if (propTypes) { + // Intentionally inside to avoid triggering lazy initializers: + var name = getComponentNameFromType(type); + checkPropTypes(propTypes, element.props, 'prop', name, element); + } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { + propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: + + var _name = getComponentNameFromType(type); + + error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); + } + + if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { + error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); + } + } +} +/** + * Given a fragment, validate that it can only be provided with fragment props + * @param {ReactElement} fragment + */ + + +function validateFragmentProps(fragment) { + { + var keys = Object.keys(fragment.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentlyValidatingElement$1(null); + break; + } + } + + if (fragment.ref !== null) { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentlyValidatingElement$1(null); + } + } +} +function createElementWithValidation(type, props, children) { + var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + + if (!validType) { + var info = ''; + + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + var sourceInfo = getSourceInfoErrorAddendumForProps(props); + + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + var typeString; + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; + } + + { + error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); + } + } + + var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + + if (element == null) { + return element; + } // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + + + if (validType) { + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } + } + + if (type === REACT_FRAGMENT_TYPE) { + validateFragmentProps(element); + } else { + validatePropTypes(element); + } + + return element; +} +var didWarnAboutDeprecatedCreateFactory = false; +function createFactoryWithValidation(type) { + var validatedFactory = createElementWithValidation.bind(null, type); + validatedFactory.type = type; + + { + if (!didWarnAboutDeprecatedCreateFactory) { + didWarnAboutDeprecatedCreateFactory = true; + + warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); + } // Legacy hook: remove it + + + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + get: function () { + warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); + + Object.defineProperty(this, 'type', { + value: type + }); + return type; + } + }); + } + + return validatedFactory; +} +function cloneElementWithValidation(element, props, children) { + var newElement = cloneElement.apply(this, arguments); + + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], newElement.type); + } + + validatePropTypes(newElement); + return newElement; +} + +function startTransition(scope, options) { + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; + var currentTransition = ReactCurrentBatchConfig.transition; + + { + ReactCurrentBatchConfig.transition._updatedFibers = new Set(); + } + + try { + scope(); + } finally { + ReactCurrentBatchConfig.transition = prevTransition; + + { + if (prevTransition === null && currentTransition._updatedFibers) { + var updatedFibersCount = currentTransition._updatedFibers.size; + + if (updatedFibersCount > 10) { + warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); + } + + currentTransition._updatedFibers.clear(); + } + } + } +} + +var didWarnAboutMessageChannel = false; +var enqueueTaskImpl = null; +function enqueueTask(task) { + if (enqueueTaskImpl === null) { + try { + // read require off the module object to get around the bundlers. + // we don't want them to detect a require and bundle a Node polyfill. + var requireString = ('require' + Math.random()).slice(0, 7); + var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's + // version of setImmediate, bypassing fake timers if any. + + enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; + } catch (_err) { + // we're in a browser + // we can't use regular timers because they may still be faked + // so we try MessageChannel+postMessage instead + enqueueTaskImpl = function (callback) { + { + if (didWarnAboutMessageChannel === false) { + didWarnAboutMessageChannel = true; + + if (typeof MessageChannel === 'undefined') { + error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); + } + } + } + + var channel = new MessageChannel(); + channel.port1.onmessage = callback; + channel.port2.postMessage(undefined); + }; + } + } + + return enqueueTaskImpl(task); +} + +var actScopeDepth = 0; +var didWarnNoAwaitAct = false; +function act(callback) { + { + // `act` calls can be nested, so we track the depth. This represents the + // number of `act` scopes on the stack. + var prevActScopeDepth = actScopeDepth; + actScopeDepth++; + + if (ReactCurrentActQueue.current === null) { + // This is the outermost `act` scope. Initialize the queue. The reconciler + // will detect the queue and use it instead of Scheduler. + ReactCurrentActQueue.current = []; + } + + var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; + var result; + + try { + // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only + // set to `true` while the given callback is executed, not for updates + // triggered during an async event, because this is how the legacy + // implementation of `act` behaved. + ReactCurrentActQueue.isBatchingLegacy = true; + result = callback(); // Replicate behavior of original `act` implementation in legacy mode, + // which flushed updates immediately after the scope function exits, even + // if it's an async function. + + if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) { + var queue = ReactCurrentActQueue.current; + + if (queue !== null) { + ReactCurrentActQueue.didScheduleLegacyUpdate = false; + flushActQueue(queue); + } + } + } catch (error) { + popActScope(prevActScopeDepth); + throw error; + } finally { + ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; + } + + if (result !== null && typeof result === 'object' && typeof result.then === 'function') { + var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait + // for it to resolve before exiting the current scope. + + var wasAwaited = false; + var thenable = { + then: function (resolve, reject) { + wasAwaited = true; + thenableResult.then(function (returnValue) { + popActScope(prevActScopeDepth); + + if (actScopeDepth === 0) { + // We've exited the outermost act scope. Recursively flush the + // queue until there's no remaining work. + recursivelyFlushAsyncActWork(returnValue, resolve, reject); + } else { + resolve(returnValue); + } + }, function (error) { + // The callback threw an error. + popActScope(prevActScopeDepth); + reject(error); + }); + } + }; + + { + if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') { + // eslint-disable-next-line no-undef + Promise.resolve().then(function () {}).then(function () { + if (!wasAwaited) { + didWarnNoAwaitAct = true; + + error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);'); + } + }); + } + } + + return thenable; + } else { + var returnValue = result; // The callback is not an async function. Exit the current scope + // immediately, without awaiting. + + popActScope(prevActScopeDepth); + + if (actScopeDepth === 0) { + // Exiting the outermost act scope. Flush the queue. + var _queue = ReactCurrentActQueue.current; + + if (_queue !== null) { + flushActQueue(_queue); + ReactCurrentActQueue.current = null; + } // Return a thenable. If the user awaits it, we'll flush again in + // case additional work was scheduled by a microtask. + + + var _thenable = { + then: function (resolve, reject) { + // Confirm we haven't re-entered another `act` scope, in case + // the user does something weird like await the thenable + // multiple times. + if (ReactCurrentActQueue.current === null) { + // Recursively flush the queue until there's no remaining work. + ReactCurrentActQueue.current = []; + recursivelyFlushAsyncActWork(returnValue, resolve, reject); + } else { + resolve(returnValue); + } + } + }; + return _thenable; + } else { + // Since we're inside a nested `act` scope, the returned thenable + // immediately resolves. The outer scope will flush the queue. + var _thenable2 = { + then: function (resolve, reject) { + resolve(returnValue); + } + }; + return _thenable2; + } + } + } +} + +function popActScope(prevActScopeDepth) { + { + if (prevActScopeDepth !== actScopeDepth - 1) { + error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); + } + + actScopeDepth = prevActScopeDepth; + } +} + +function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { + { + var queue = ReactCurrentActQueue.current; + + if (queue !== null) { + try { + flushActQueue(queue); + enqueueTask(function () { + if (queue.length === 0) { + // No additional work was scheduled. Finish. + ReactCurrentActQueue.current = null; + resolve(returnValue); + } else { + // Keep flushing work until there's none left. + recursivelyFlushAsyncActWork(returnValue, resolve, reject); + } + }); + } catch (error) { + reject(error); + } + } else { + resolve(returnValue); + } + } +} + +var isFlushing = false; + +function flushActQueue(queue) { + { + if (!isFlushing) { + // Prevent re-entrance. + isFlushing = true; + var i = 0; + + try { + for (; i < queue.length; i++) { + var callback = queue[i]; + + do { + callback = callback(true); + } while (callback !== null); + } + + queue.length = 0; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + queue = queue.slice(i + 1); + throw error; + } finally { + isFlushing = false; + } + } + } +} + +var createElement$1 = createElementWithValidation ; +var cloneElement$1 = cloneElementWithValidation ; +var createFactory = createFactoryWithValidation ; +var Children = { + map: mapChildren, + forEach: forEachChildren, + count: countChildren, + toArray: toArray, + only: onlyChild +}; + +exports.Children = Children; +exports.Component = Component; +exports.Fragment = REACT_FRAGMENT_TYPE; +exports.Profiler = REACT_PROFILER_TYPE; +exports.PureComponent = PureComponent; +exports.StrictMode = REACT_STRICT_MODE_TYPE; +exports.Suspense = REACT_SUSPENSE_TYPE; +exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; +exports.cloneElement = cloneElement$1; +exports.createContext = createContext; +exports.createElement = createElement$1; +exports.createFactory = createFactory; +exports.createRef = createRef; +exports.forwardRef = forwardRef; +exports.isValidElement = isValidElement; +exports.lazy = lazy; +exports.memo = memo; +exports.startTransition = startTransition; +exports.unstable_act = act; +exports.useCallback = useCallback; +exports.useContext = useContext; +exports.useDebugValue = useDebugValue; +exports.useDeferredValue = useDeferredValue; +exports.useEffect = useEffect; +exports.useId = useId; +exports.useImperativeHandle = useImperativeHandle; +exports.useInsertionEffect = useInsertionEffect; +exports.useLayoutEffect = useLayoutEffect; +exports.useMemo = useMemo; +exports.useReducer = useReducer; +exports.useRef = useRef; +exports.useState = useState; +exports.useSyncExternalStore = useSyncExternalStore; +exports.useTransition = useTransition; +exports.version = ReactVersion; + /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); +} + + })(); +} diff --git a/graphql-subscription/node_modules/react/cjs/react.production.min.js b/graphql-subscription/node_modules/react/cjs/react.production.min.js new file mode 100644 index 0000000..4953982 --- /dev/null +++ b/graphql-subscription/node_modules/react/cjs/react.production.min.js @@ -0,0 +1,26 @@ +/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return"function"===typeof a?a:null} +var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={}; +E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F; +H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0}; +function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1=0.10.0" + }, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + } +} \ No newline at end of file diff --git a/graphql-subscription/node_modules/react/react.shared-subset.js b/graphql-subscription/node_modules/react/react.shared-subset.js new file mode 100644 index 0000000..694e966 --- /dev/null +++ b/graphql-subscription/node_modules/react/react.shared-subset.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react.shared-subset.production.min.js'); +} else { + module.exports = require('./cjs/react.shared-subset.development.js'); +} diff --git a/graphql-subscription/node_modules/react/umd/react.development.js b/graphql-subscription/node_modules/react/umd/react.development.js new file mode 100644 index 0000000..2f7c8cb --- /dev/null +++ b/graphql-subscription/node_modules/react/umd/react.development.js @@ -0,0 +1,3342 @@ +/** + * @license React + * react.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.React = {})); +}(this, (function (exports) { 'use strict'; + + var ReactVersion = '18.2.0'; + + // ATTENTION + // When adding new symbols to this file, + // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' + // The Symbol used to tag the ReactElement-like types. + var REACT_ELEMENT_TYPE = Symbol.for('react.element'); + var REACT_PORTAL_TYPE = Symbol.for('react.portal'); + var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); + var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); + var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); + var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); + var REACT_CONTEXT_TYPE = Symbol.for('react.context'); + var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); + var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); + var REACT_MEMO_TYPE = Symbol.for('react.memo'); + var REACT_LAZY_TYPE = Symbol.for('react.lazy'); + var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); + var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; + function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== 'object') { + return null; + } + + var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === 'function') { + return maybeIterator; + } + + return null; + } + + /** + * Keeps track of the current dispatcher. + */ + var ReactCurrentDispatcher = { + /** + * @internal + * @type {ReactComponent} + */ + current: null + }; + + /** + * Keeps track of the current batch's configuration such as how long an update + * should suspend for if it needs to. + */ + var ReactCurrentBatchConfig = { + transition: null + }; + + var ReactCurrentActQueue = { + current: null, + // Used to reproduce behavior of `batchedUpdates` in legacy mode. + isBatchingLegacy: false, + didScheduleLegacyUpdate: false + }; + + /** + * Keeps track of the current owner. + * + * The current owner is the component who should own any components that are + * currently being constructed. + */ + var ReactCurrentOwner = { + /** + * @internal + * @type {ReactComponent} + */ + current: null + }; + + var ReactDebugCurrentFrame = {}; + var currentExtraStackFrame = null; + function setExtraStackFrame(stack) { + { + currentExtraStackFrame = stack; + } + } + + { + ReactDebugCurrentFrame.setExtraStackFrame = function (stack) { + { + currentExtraStackFrame = stack; + } + }; // Stack implementation injected by the current renderer. + + + ReactDebugCurrentFrame.getCurrentStack = null; + + ReactDebugCurrentFrame.getStackAddendum = function () { + var stack = ''; // Add an extra top frame while an element is being validated + + if (currentExtraStackFrame) { + stack += currentExtraStackFrame; + } // Delegate to the injected renderer-specific implementation + + + var impl = ReactDebugCurrentFrame.getCurrentStack; + + if (impl) { + stack += impl() || ''; + } + + return stack; + }; + } + + // ----------------------------------------------------------------------------- + + var enableScopeAPI = false; // Experimental Create Event Handle API. + var enableCacheElement = false; + var enableTransitionTracing = false; // No known bugs, but needs performance testing + + var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber + // stuff. Intended to enable React core members to more easily debug scheduling + // issues in DEV builds. + + var enableDebugTracing = false; // Track which Fiber(s) schedule render work. + + var ReactSharedInternals = { + ReactCurrentDispatcher: ReactCurrentDispatcher, + ReactCurrentBatchConfig: ReactCurrentBatchConfig, + ReactCurrentOwner: ReactCurrentOwner + }; + + { + ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; + ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; + } + + // by calls to these methods by a Babel plugin. + // + // In PROD (or in packages without access to React internals), + // they are left as they are instead. + + function warn(format) { + { + { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + printWarning('warn', format, args); + } + } + } + function error(format) { + { + { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + printWarning('error', format, args); + } + } + } + + function printWarning(level, format, args) { + // When changing this logic, you might want to also + // update consoleWithStackDev.www.js as well. + { + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + + if (stack !== '') { + format += '%s'; + args = args.concat([stack]); + } // eslint-disable-next-line react-internal/safe-string-coercion + + + var argsWithFormat = args.map(function (item) { + return String(item); + }); // Careful: RN currently depends on this prefix + + argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + // eslint-disable-next-line react-internal/no-production-logging + + Function.prototype.apply.call(console[level], console, argsWithFormat); + } + } + + var didWarnStateUpdateForUnmountedComponent = {}; + + function warnNoop(publicInstance, callerName) { + { + var _constructor = publicInstance.constructor; + var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; + var warningKey = componentName + "." + callerName; + + if (didWarnStateUpdateForUnmountedComponent[warningKey]) { + return; + } + + error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); + + didWarnStateUpdateForUnmountedComponent[warningKey] = true; + } + } + /** + * This is the abstract API for an update queue. + */ + + + var ReactNoopUpdateQueue = { + /** + * Checks whether or not this composite component is mounted. + * @param {ReactClass} publicInstance The instance we want to test. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function (publicInstance) { + return false; + }, + + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {?function} callback Called after component is updated. + * @param {?string} callerName name of the calling function in the public API. + * @internal + */ + enqueueForceUpdate: function (publicInstance, callback, callerName) { + warnNoop(publicInstance, 'forceUpdate'); + }, + + /** + * Replaces all of the state. Always use this or `setState` to mutate state. + * You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} completeState Next state. + * @param {?function} callback Called after component is updated. + * @param {?string} callerName name of the calling function in the public API. + * @internal + */ + enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { + warnNoop(publicInstance, 'replaceState'); + }, + + /** + * Sets a subset of the state. This only exists because _pendingState is + * internal. This provides a merging strategy that is not available to deep + * properties which is confusing. TODO: Expose pendingState or don't use it + * during the merge. + * + * @param {ReactClass} publicInstance The instance that should rerender. + * @param {object} partialState Next partial state to be merged with state. + * @param {?function} callback Called after component is updated. + * @param {?string} Name of the calling function in the public API. + * @internal + */ + enqueueSetState: function (publicInstance, partialState, callback, callerName) { + warnNoop(publicInstance, 'setState'); + } + }; + + var assign = Object.assign; + + var emptyObject = {}; + + { + Object.freeze(emptyObject); + } + /** + * Base class helpers for the updating state of a component. + */ + + + function Component(props, context, updater) { + this.props = props; + this.context = context; // If a component has string refs, we will assign a different object later. + + this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the + // renderer. + + this.updater = updater || ReactNoopUpdateQueue; + } + + Component.prototype.isReactComponent = {}; + /** + * Sets a subset of the state. Always use this to mutate + * state. You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * There is no guarantee that calls to `setState` will run synchronously, + * as they may eventually be batched together. You can provide an optional + * callback that will be executed when the call to setState is actually + * completed. + * + * When a function is provided to setState, it will be called at some point in + * the future (not synchronously). It will be called with the up to date + * component arguments (state, props, context). These values can be different + * from this.* because your function may be called after receiveProps but before + * shouldComponentUpdate, and this new state, props, and context will not yet be + * assigned to this. + * + * @param {object|function} partialState Next partial state or function to + * produce next partial state to be merged with current state. + * @param {?function} callback Called after state is updated. + * @final + * @protected + */ + + Component.prototype.setState = function (partialState, callback) { + if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) { + throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.'); + } + + this.updater.enqueueSetState(this, partialState, callback, 'setState'); + }; + /** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {?function} callback Called after update is complete. + * @final + * @protected + */ + + + Component.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); + }; + /** + * Deprecated APIs. These APIs used to exist on classic React classes but since + * we would like to deprecate them, we're not going to move them over to this + * modern base class. Instead, we define a getter that warns if it's accessed. + */ + + + { + var deprecatedAPIs = { + isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], + replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] + }; + + var defineDeprecationWarning = function (methodName, info) { + Object.defineProperty(Component.prototype, methodName, { + get: function () { + warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); + + return undefined; + } + }); + }; + + for (var fnName in deprecatedAPIs) { + if (deprecatedAPIs.hasOwnProperty(fnName)) { + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + } + } + } + + function ComponentDummy() {} + + ComponentDummy.prototype = Component.prototype; + /** + * Convenience component with default shallow equality check for sCU. + */ + + function PureComponent(props, context, updater) { + this.props = props; + this.context = context; // If a component has string refs, we will assign a different object later. + + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + } + + var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); + pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. + + assign(pureComponentPrototype, Component.prototype); + pureComponentPrototype.isPureReactComponent = true; + + // an immutable object with a single mutable value + function createRef() { + var refObject = { + current: null + }; + + { + Object.seal(refObject); + } + + return refObject; + } + + var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + + function isArray(a) { + return isArrayImpl(a); + } + + /* + * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ + // $FlowFixMe only called in DEV, so void return is not possible. + function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; + var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; + return type; + } + } // $FlowFixMe only called in DEV, so void return is not possible. + + + function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } + } + + function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return '' + value; + } + function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } + + function getWrappedName(outerType, innerType, wrapperName) { + var displayName = outerType.displayName; + + if (displayName) { + return displayName; + } + + var functionName = innerType.displayName || innerType.name || ''; + return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; + } // Keep in sync with react-reconciler/getComponentNameFromFiber + + + function getContextName(type) { + return type.displayName || 'Context'; + } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. + + + function getComponentNameFromType(type) { + if (type == null) { + // Host root, text node or just invalid type. + return null; + } + + { + if (typeof type.tag === 'number') { + error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); + } + } + + if (typeof type === 'function') { + return type.displayName || type.name || null; + } + + if (typeof type === 'string') { + return type; + } + + switch (type) { + case REACT_FRAGMENT_TYPE: + return 'Fragment'; + + case REACT_PORTAL_TYPE: + return 'Portal'; + + case REACT_PROFILER_TYPE: + return 'Profiler'; + + case REACT_STRICT_MODE_TYPE: + return 'StrictMode'; + + case REACT_SUSPENSE_TYPE: + return 'Suspense'; + + case REACT_SUSPENSE_LIST_TYPE: + return 'SuspenseList'; + + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + var context = type; + return getContextName(context) + '.Consumer'; + + case REACT_PROVIDER_TYPE: + var provider = type; + return getContextName(provider._context) + '.Provider'; + + case REACT_FORWARD_REF_TYPE: + return getWrappedName(type, type.render, 'ForwardRef'); + + case REACT_MEMO_TYPE: + var outerName = type.displayName || null; + + if (outerName !== null) { + return outerName; + } + + return getComponentNameFromType(type.type) || 'Memo'; + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + return getComponentNameFromType(init(payload)); + } catch (x) { + return null; + } + } + + // eslint-disable-next-line no-fallthrough + } + } + + return null; + } + + var hasOwnProperty = Object.prototype.hasOwnProperty; + + var RESERVED_PROPS = { + key: true, + ref: true, + __self: true, + __source: true + }; + var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; + + { + didWarnAboutStringRefs = {}; + } + + function hasValidRef(config) { + { + if (hasOwnProperty.call(config, 'ref')) { + var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.ref !== undefined; + } + + function hasValidKey(config) { + { + if (hasOwnProperty.call(config, 'key')) { + var getter = Object.getOwnPropertyDescriptor(config, 'key').get; + + if (getter && getter.isReactWarning) { + return false; + } + } + } + + return config.key !== undefined; + } + + function defineKeyPropWarningGetter(props, displayName) { + var warnAboutAccessingKey = function () { + { + if (!specialPropKeyWarningShown) { + specialPropKeyWarningShown = true; + + error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + } + }; + + warnAboutAccessingKey.isReactWarning = true; + Object.defineProperty(props, 'key', { + get: warnAboutAccessingKey, + configurable: true + }); + } + + function defineRefPropWarningGetter(props, displayName) { + var warnAboutAccessingRef = function () { + { + if (!specialPropRefWarningShown) { + specialPropRefWarningShown = true; + + error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); + } + } + }; + + warnAboutAccessingRef.isReactWarning = true; + Object.defineProperty(props, 'ref', { + get: warnAboutAccessingRef, + configurable: true + }); + } + + function warnIfStringRefCannotBeAutoConverted(config) { + { + if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { + var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); + + if (!didWarnAboutStringRefs[componentName]) { + error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + } + /** + * Factory method to create a new React element. This no longer adheres to + * the class pattern, so do not use new to call it. Also, instanceof check + * will not work. Instead test $$typeof field against Symbol.for('react.element') to check + * if something is a React Element. + * + * @param {*} type + * @param {*} props + * @param {*} key + * @param {string|object} ref + * @param {*} owner + * @param {*} self A *temporary* helper to detect places where `this` is + * different from the `owner` when React.createElement is called, so that we + * can warn. We want to get rid of owner and replace string `ref`s with arrow + * functions, and as long as `this` and owner are the same, there will be no + * change in behavior. + * @param {*} source An annotation object (added by a transpiler or otherwise) + * indicating filename, line number, and/or other information. + * @internal + */ + + + var ReactElement = function (type, key, ref, self, source, owner, props) { + var element = { + // This tag allows us to uniquely identify this as a React Element + $$typeof: REACT_ELEMENT_TYPE, + // Built-in properties that belong on the element + type: type, + key: key, + ref: ref, + props: props, + // Record the component responsible for creating this element. + _owner: owner + }; + + { + // The validation flag is currently mutative. We put it on + // an external backing store so that we can freeze the whole object. + // This can be replaced with a WeakMap once they are implemented in + // commonly used development environments. + element._store = {}; // To make comparing ReactElements easier for testing purposes, we make + // the validation flag non-enumerable (where possible, which should + // include every environment we run tests in), so the test framework + // ignores it. + + Object.defineProperty(element._store, 'validated', { + configurable: false, + enumerable: false, + writable: true, + value: false + }); // self and source are DEV only properties. + + Object.defineProperty(element, '_self', { + configurable: false, + enumerable: false, + writable: false, + value: self + }); // Two elements created in two different places should be considered + // equal for testing purposes and therefore we hide it from enumeration. + + Object.defineProperty(element, '_source', { + configurable: false, + enumerable: false, + writable: false, + value: source + }); + + if (Object.freeze) { + Object.freeze(element.props); + Object.freeze(element); + } + } + + return element; + }; + /** + * Create and return a new ReactElement of the given type. + * See https://reactjs.org/docs/react-api.html#createelement + */ + + function createElement(type, config, children) { + var propName; // Reserved names are extracted + + var props = {}; + var key = null; + var ref = null; + var self = null; + var source = null; + + if (config != null) { + if (hasValidRef(config)) { + ref = config.ref; + + { + warnIfStringRefCannotBeAutoConverted(config); + } + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = '' + config.key; + } + + self = config.__self === undefined ? null : config.__self; + source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object + + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + props[propName] = config[propName]; + } + } + } // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + + + var childrenLength = arguments.length - 2; + + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + + { + if (Object.freeze) { + Object.freeze(childArray); + } + } + + props.children = childArray; + } // Resolve default props + + + if (type && type.defaultProps) { + var defaultProps = type.defaultProps; + + for (propName in defaultProps) { + if (props[propName] === undefined) { + props[propName] = defaultProps[propName]; + } + } + } + + { + if (key || ref) { + var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; + + if (key) { + defineKeyPropWarningGetter(props, displayName); + } + + if (ref) { + defineRefPropWarningGetter(props, displayName); + } + } + } + + return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); + } + function cloneAndReplaceKey(oldElement, newKey) { + var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); + return newElement; + } + /** + * Clone and return a new ReactElement using element as the starting point. + * See https://reactjs.org/docs/react-api.html#cloneelement + */ + + function cloneElement(element, config, children) { + if (element === null || element === undefined) { + throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); + } + + var propName; // Original props are copied + + var props = assign({}, element.props); // Reserved names are extracted + + var key = element.key; + var ref = element.ref; // Self is preserved since the owner is preserved. + + var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a + // transpiler, and the original source is probably a better indicator of the + // true owner. + + var source = element._source; // Owner will be preserved, unless ref is overridden + + var owner = element._owner; + + if (config != null) { + if (hasValidRef(config)) { + // Silently steal the ref from the parent. + ref = config.ref; + owner = ReactCurrentOwner.current; + } + + if (hasValidKey(config)) { + { + checkKeyStringCoercion(config.key); + } + + key = '' + config.key; + } // Remaining properties override existing props + + + var defaultProps; + + if (element.type && element.type.defaultProps) { + defaultProps = element.type.defaultProps; + } + + for (propName in config) { + if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { + if (config[propName] === undefined && defaultProps !== undefined) { + // Resolve default props + props[propName] = defaultProps[propName]; + } else { + props[propName] = config[propName]; + } + } + } + } // Children can be more than one argument, and those are transferred onto + // the newly allocated props object. + + + var childrenLength = arguments.length - 2; + + if (childrenLength === 1) { + props.children = children; + } else if (childrenLength > 1) { + var childArray = Array(childrenLength); + + for (var i = 0; i < childrenLength; i++) { + childArray[i] = arguments[i + 2]; + } + + props.children = childArray; + } + + return ReactElement(element.type, key, ref, self, source, owner, props); + } + /** + * Verifies the object is a ReactElement. + * See https://reactjs.org/docs/react-api.html#isvalidelement + * @param {?object} object + * @return {boolean} True if `object` is a ReactElement. + * @final + */ + + function isValidElement(object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + + var SEPARATOR = '.'; + var SUBSEPARATOR = ':'; + /** + * Escape and wrap key so it is safe to use as a reactid + * + * @param {string} key to be escaped. + * @return {string} the escaped key. + */ + + function escape(key) { + var escapeRegex = /[=:]/g; + var escaperLookup = { + '=': '=0', + ':': '=2' + }; + var escapedString = key.replace(escapeRegex, function (match) { + return escaperLookup[match]; + }); + return '$' + escapedString; + } + /** + * TODO: Test that a single child and an array with one item have the same key + * pattern. + */ + + + var didWarnAboutMaps = false; + var userProvidedKeyEscapeRegex = /\/+/g; + + function escapeUserProvidedKey(text) { + return text.replace(userProvidedKeyEscapeRegex, '$&/'); + } + /** + * Generate a key string that identifies a element within a set. + * + * @param {*} element A element that could contain a manual key. + * @param {number} index Index that is used if a manual key is not provided. + * @return {string} + */ + + + function getElementKey(element, index) { + // Do some typechecking here since we call this blindly. We want to ensure + // that we don't block potential future ES APIs. + if (typeof element === 'object' && element !== null && element.key != null) { + // Explicit key + { + checkKeyStringCoercion(element.key); + } + + return escape('' + element.key); + } // Implicit key determined by the index in the set + + + return index.toString(36); + } + + function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { + var type = typeof children; + + if (type === 'undefined' || type === 'boolean') { + // All of the above are perceived as null. + children = null; + } + + var invokeCallback = false; + + if (children === null) { + invokeCallback = true; + } else { + switch (type) { + case 'string': + case 'number': + invokeCallback = true; + break; + + case 'object': + switch (children.$$typeof) { + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + invokeCallback = true; + } + + } + } + + if (invokeCallback) { + var _child = children; + var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array + // so that it's consistent if the number of children grows: + + var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; + + if (isArray(mappedChild)) { + var escapedChildKey = ''; + + if (childKey != null) { + escapedChildKey = escapeUserProvidedKey(childKey) + '/'; + } + + mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) { + return c; + }); + } else if (mappedChild != null) { + if (isValidElement(mappedChild)) { + { + // The `if` statement here prevents auto-disabling of the safe + // coercion ESLint rule, so we must manually disable it below. + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key + if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { + checkKeyStringCoercion(mappedChild.key); + } + } + + mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as + // traverseAllChildren used to do for objects as children + escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key + mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number + // eslint-disable-next-line react-internal/safe-string-coercion + escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); + } + + array.push(mappedChild); + } + + return 1; + } + + var child; + var nextName; + var subtreeCount = 0; // Count of children found in the current subtree. + + var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; + + if (isArray(children)) { + for (var i = 0; i < children.length; i++) { + child = children[i]; + nextName = nextNamePrefix + getElementKey(child, i); + subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); + } + } else { + var iteratorFn = getIteratorFn(children); + + if (typeof iteratorFn === 'function') { + var iterableChildren = children; + + { + // Warn about using Maps as children + if (iteratorFn === iterableChildren.entries) { + if (!didWarnAboutMaps) { + warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); + } + + didWarnAboutMaps = true; + } + } + + var iterator = iteratorFn.call(iterableChildren); + var step; + var ii = 0; + + while (!(step = iterator.next()).done) { + child = step.value; + nextName = nextNamePrefix + getElementKey(child, ii++); + subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); + } + } else if (type === 'object') { + // eslint-disable-next-line react-internal/safe-string-coercion + var childrenString = String(children); + throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); + } + } + + return subtreeCount; + } + + /** + * Maps children that are typically specified as `props.children`. + * + * See https://reactjs.org/docs/react-api.html#reactchildrenmap + * + * The provided mapFunction(child, index) will be called for each + * leaf child. + * + * @param {?*} children Children tree container. + * @param {function(*, int)} func The map function. + * @param {*} context Context for mapFunction. + * @return {object} Object containing the ordered map of results. + */ + function mapChildren(children, func, context) { + if (children == null) { + return children; + } + + var result = []; + var count = 0; + mapIntoArray(children, result, '', '', function (child) { + return func.call(context, child, count++); + }); + return result; + } + /** + * Count the number of children that are typically specified as + * `props.children`. + * + * See https://reactjs.org/docs/react-api.html#reactchildrencount + * + * @param {?*} children Children tree container. + * @return {number} The number of children. + */ + + + function countChildren(children) { + var n = 0; + mapChildren(children, function () { + n++; // Don't return anything + }); + return n; + } + + /** + * Iterates through children that are typically specified as `props.children`. + * + * See https://reactjs.org/docs/react-api.html#reactchildrenforeach + * + * The provided forEachFunc(child, index) will be called for each + * leaf child. + * + * @param {?*} children Children tree container. + * @param {function(*, int)} forEachFunc + * @param {*} forEachContext Context for forEachContext. + */ + function forEachChildren(children, forEachFunc, forEachContext) { + mapChildren(children, function () { + forEachFunc.apply(this, arguments); // Don't return anything. + }, forEachContext); + } + /** + * Flatten a children object (typically specified as `props.children`) and + * return an array with appropriately re-keyed children. + * + * See https://reactjs.org/docs/react-api.html#reactchildrentoarray + */ + + + function toArray(children) { + return mapChildren(children, function (child) { + return child; + }) || []; + } + /** + * Returns the first child in a collection of children and verifies that there + * is only one child in the collection. + * + * See https://reactjs.org/docs/react-api.html#reactchildrenonly + * + * The current implementation of this function assumes that a single child gets + * passed without a wrapper, but the purpose of this helper function is to + * abstract away the particular structure of children. + * + * @param {?object} children Child collection structure. + * @return {ReactElement} The first and only `ReactElement` contained in the + * structure. + */ + + + function onlyChild(children) { + if (!isValidElement(children)) { + throw new Error('React.Children.only expected to receive a single React element child.'); + } + + return children; + } + + function createContext(defaultValue) { + // TODO: Second argument used to be an optional `calculateChangedBits` + // function. Warn to reserve for future use? + var context = { + $$typeof: REACT_CONTEXT_TYPE, + // As a workaround to support multiple concurrent renderers, we categorize + // some renderers as primary and others as secondary. We only expect + // there to be two concurrent renderers at most: React Native (primary) and + // Fabric (secondary); React DOM (primary) and React ART (secondary). + // Secondary renderers store their context values on separate fields. + _currentValue: defaultValue, + _currentValue2: defaultValue, + // Used to track how many concurrent renderers this context currently + // supports within in a single renderer. Such as parallel server rendering. + _threadCount: 0, + // These are circular + Provider: null, + Consumer: null, + // Add these to use same hidden class in VM as ServerContext + _defaultValue: null, + _globalName: null + }; + context.Provider = { + $$typeof: REACT_PROVIDER_TYPE, + _context: context + }; + var hasWarnedAboutUsingNestedContextConsumers = false; + var hasWarnedAboutUsingConsumerProvider = false; + var hasWarnedAboutDisplayNameOnConsumer = false; + + { + // A separate object, but proxies back to the original context object for + // backwards compatibility. It has a different $$typeof, so we can properly + // warn for the incorrect usage of Context as a Consumer. + var Consumer = { + $$typeof: REACT_CONTEXT_TYPE, + _context: context + }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here + + Object.defineProperties(Consumer, { + Provider: { + get: function () { + if (!hasWarnedAboutUsingConsumerProvider) { + hasWarnedAboutUsingConsumerProvider = true; + + error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); + } + + return context.Provider; + }, + set: function (_Provider) { + context.Provider = _Provider; + } + }, + _currentValue: { + get: function () { + return context._currentValue; + }, + set: function (_currentValue) { + context._currentValue = _currentValue; + } + }, + _currentValue2: { + get: function () { + return context._currentValue2; + }, + set: function (_currentValue2) { + context._currentValue2 = _currentValue2; + } + }, + _threadCount: { + get: function () { + return context._threadCount; + }, + set: function (_threadCount) { + context._threadCount = _threadCount; + } + }, + Consumer: { + get: function () { + if (!hasWarnedAboutUsingNestedContextConsumers) { + hasWarnedAboutUsingNestedContextConsumers = true; + + error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); + } + + return context.Consumer; + } + }, + displayName: { + get: function () { + return context.displayName; + }, + set: function (displayName) { + if (!hasWarnedAboutDisplayNameOnConsumer) { + warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); + + hasWarnedAboutDisplayNameOnConsumer = true; + } + } + } + }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty + + context.Consumer = Consumer; + } + + { + context._currentRenderer = null; + context._currentRenderer2 = null; + } + + return context; + } + + var Uninitialized = -1; + var Pending = 0; + var Resolved = 1; + var Rejected = 2; + + function lazyInitializer(payload) { + if (payload._status === Uninitialized) { + var ctor = payload._result; + var thenable = ctor(); // Transition to the next state. + // This might throw either because it's missing or throws. If so, we treat it + // as still uninitialized and try again next time. Which is the same as what + // happens if the ctor or any wrappers processing the ctor throws. This might + // end up fixing it if the resolution was a concurrency bug. + + thenable.then(function (moduleObject) { + if (payload._status === Pending || payload._status === Uninitialized) { + // Transition to the next state. + var resolved = payload; + resolved._status = Resolved; + resolved._result = moduleObject; + } + }, function (error) { + if (payload._status === Pending || payload._status === Uninitialized) { + // Transition to the next state. + var rejected = payload; + rejected._status = Rejected; + rejected._result = error; + } + }); + + if (payload._status === Uninitialized) { + // In case, we're still uninitialized, then we're waiting for the thenable + // to resolve. Set it as pending in the meantime. + var pending = payload; + pending._status = Pending; + pending._result = thenable; + } + } + + if (payload._status === Resolved) { + var moduleObject = payload._result; + + { + if (moduleObject === undefined) { + error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. + 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject); + } + } + + { + if (!('default' in moduleObject)) { + error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. + 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); + } + } + + return moduleObject.default; + } else { + throw payload._result; + } + } + + function lazy(ctor) { + var payload = { + // We use these fields to store the result. + _status: Uninitialized, + _result: ctor + }; + var lazyType = { + $$typeof: REACT_LAZY_TYPE, + _payload: payload, + _init: lazyInitializer + }; + + { + // In production, this would just set it on the object. + var defaultProps; + var propTypes; // $FlowFixMe + + Object.defineProperties(lazyType, { + defaultProps: { + configurable: true, + get: function () { + return defaultProps; + }, + set: function (newDefaultProps) { + error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); + + defaultProps = newDefaultProps; // Match production behavior more closely: + // $FlowFixMe + + Object.defineProperty(lazyType, 'defaultProps', { + enumerable: true + }); + } + }, + propTypes: { + configurable: true, + get: function () { + return propTypes; + }, + set: function (newPropTypes) { + error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); + + propTypes = newPropTypes; // Match production behavior more closely: + // $FlowFixMe + + Object.defineProperty(lazyType, 'propTypes', { + enumerable: true + }); + } + } + }); + } + + return lazyType; + } + + function forwardRef(render) { + { + if (render != null && render.$$typeof === REACT_MEMO_TYPE) { + error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); + } else if (typeof render !== 'function') { + error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); + } else { + if (render.length !== 0 && render.length !== 2) { + error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); + } + } + + if (render != null) { + if (render.defaultProps != null || render.propTypes != null) { + error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); + } + } + } + + var elementType = { + $$typeof: REACT_FORWARD_REF_TYPE, + render: render + }; + + { + var ownName; + Object.defineProperty(elementType, 'displayName', { + enumerable: false, + configurable: true, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; // The inner component shouldn't inherit this display name in most cases, + // because the component may be used elsewhere. + // But it's nice for anonymous functions to inherit the name, + // so that our component-stack generation logic will display their frames. + // An anonymous function generally suggests a pattern like: + // React.forwardRef((props, ref) => {...}); + // This kind of inner function is not used elsewhere so the side effect is okay. + + if (!render.name && !render.displayName) { + render.displayName = name; + } + } + }); + } + + return elementType; + } + + var REACT_MODULE_REFERENCE; + + { + REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); + } + + function isValidElementType(type) { + if (typeof type === 'string' || typeof type === 'function') { + return true; + } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). + + + if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { + return true; + } + + if (typeof type === 'object' && type !== null) { + if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object + // types supported by any Flight configuration anywhere since + // we don't know which Flight build this will end up being used + // with. + type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { + return true; + } + } + + return false; + } + + function memo(type, compare) { + { + if (!isValidElementType(type)) { + error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); + } + } + + var elementType = { + $$typeof: REACT_MEMO_TYPE, + type: type, + compare: compare === undefined ? null : compare + }; + + { + var ownName; + Object.defineProperty(elementType, 'displayName', { + enumerable: false, + configurable: true, + get: function () { + return ownName; + }, + set: function (name) { + ownName = name; // The inner component shouldn't inherit this display name in most cases, + // because the component may be used elsewhere. + // But it's nice for anonymous functions to inherit the name, + // so that our component-stack generation logic will display their frames. + // An anonymous function generally suggests a pattern like: + // React.memo((props) => {...}); + // This kind of inner function is not used elsewhere so the side effect is okay. + + if (!type.name && !type.displayName) { + type.displayName = name; + } + } + }); + } + + return elementType; + } + + function resolveDispatcher() { + var dispatcher = ReactCurrentDispatcher.current; + + { + if (dispatcher === null) { + error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); + } + } // Will result in a null access error if accessed outside render phase. We + // intentionally don't throw our own error because this is in a hot path. + // Also helps ensure this is inlined. + + + return dispatcher; + } + function useContext(Context) { + var dispatcher = resolveDispatcher(); + + { + // TODO: add a more generic warning for invalid values. + if (Context._context !== undefined) { + var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs + // and nobody should be using this in existing code. + + if (realContext.Consumer === Context) { + error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); + } else if (realContext.Provider === Context) { + error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); + } + } + } + + return dispatcher.useContext(Context); + } + function useState(initialState) { + var dispatcher = resolveDispatcher(); + return dispatcher.useState(initialState); + } + function useReducer(reducer, initialArg, init) { + var dispatcher = resolveDispatcher(); + return dispatcher.useReducer(reducer, initialArg, init); + } + function useRef(initialValue) { + var dispatcher = resolveDispatcher(); + return dispatcher.useRef(initialValue); + } + function useEffect(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useEffect(create, deps); + } + function useInsertionEffect(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useInsertionEffect(create, deps); + } + function useLayoutEffect(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useLayoutEffect(create, deps); + } + function useCallback(callback, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useCallback(callback, deps); + } + function useMemo(create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useMemo(create, deps); + } + function useImperativeHandle(ref, create, deps) { + var dispatcher = resolveDispatcher(); + return dispatcher.useImperativeHandle(ref, create, deps); + } + function useDebugValue(value, formatterFn) { + { + var dispatcher = resolveDispatcher(); + return dispatcher.useDebugValue(value, formatterFn); + } + } + function useTransition() { + var dispatcher = resolveDispatcher(); + return dispatcher.useTransition(); + } + function useDeferredValue(value) { + var dispatcher = resolveDispatcher(); + return dispatcher.useDeferredValue(value); + } + function useId() { + var dispatcher = resolveDispatcher(); + return dispatcher.useId(); + } + function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { + var dispatcher = resolveDispatcher(); + return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); + } + + // Helpers to patch console.logs to avoid logging during side-effect free + // replaying on render function. This currently only patches the object + // lazily which won't cover if the log function was extracted eagerly. + // We could also eagerly patch the method. + var disabledDepth = 0; + var prevLog; + var prevInfo; + var prevWarn; + var prevError; + var prevGroup; + var prevGroupCollapsed; + var prevGroupEnd; + + function disabledLog() {} + + disabledLog.__reactDisabledLog = true; + function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } + } + function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } + } + + var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; + var prefix; + function describeBuiltInComponentFrame(name, source, ownerFn) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } + } + var reentry = false; + var componentFrameCache; + + { + var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap(); + } + + function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if ( !fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + var control; + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher; + + { + previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactCurrentDispatcher$1.current = null; + disableLogs(); + } + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } + + fn(); + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sample.stack.split('\n'); + var controlLines = control.stack.split('\n'); + var s = sampleLines.length - 1; + var c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactCurrentDispatcher$1.current = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; + } + function describeFunctionComponentFrame(fn, source, ownerFn) { + { + return describeNativeComponentFrame(fn, false); + } + } + + function shouldConstruct(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); + } + + function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { + + if (type == null) { + return ''; + } + + if (typeof type === 'function') { + { + return describeNativeComponentFrame(type, shouldConstruct(type)); + } + } + + if (typeof type === 'string') { + return describeBuiltInComponentFrame(type); + } + + switch (type) { + case REACT_SUSPENSE_TYPE: + return describeBuiltInComponentFrame('Suspense'); + + case REACT_SUSPENSE_LIST_TYPE: + return describeBuiltInComponentFrame('SuspenseList'); + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + return describeFunctionComponentFrame(type.render); + + case REACT_MEMO_TYPE: + // Memo may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); + + case REACT_LAZY_TYPE: + { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); + } catch (x) {} + } + } + } + + return ''; + } + + var loggedTypeFailures = {}; + var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; + + function setCurrentlyValidatingElement(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + ReactDebugCurrentFrame$1.setExtraStackFrame(stack); + } else { + ReactDebugCurrentFrame$1.setExtraStackFrame(null); + } + } + } + + function checkPropTypes(typeSpecs, values, location, componentName, element) { + { + // $FlowFixMe This is okay but Flow doesn't know it. + var has = Function.call.bind(hasOwnProperty); + + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + // eslint-disable-next-line react-internal/prod-error-codes + var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); + err.name = 'Invariant Violation'; + throw err; + } + + error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); + } catch (ex) { + error$1 = ex; + } + + if (error$1 && !(error$1 instanceof Error)) { + setCurrentlyValidatingElement(element); + + error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); + + setCurrentlyValidatingElement(null); + } + + if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error$1.message] = true; + setCurrentlyValidatingElement(element); + + error('Failed %s type: %s', location, error$1.message); + + setCurrentlyValidatingElement(null); + } + } + } + } + } + + function setCurrentlyValidatingElement$1(element) { + { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + setExtraStackFrame(stack); + } else { + setExtraStackFrame(null); + } + } + } + + var propTypesMisspellWarningShown; + + { + propTypesMisspellWarningShown = false; + } + + function getDeclarationErrorAddendum() { + if (ReactCurrentOwner.current) { + var name = getComponentNameFromType(ReactCurrentOwner.current.type); + + if (name) { + return '\n\nCheck the render method of `' + name + '`.'; + } + } + + return ''; + } + + function getSourceInfoErrorAddendum(source) { + if (source !== undefined) { + var fileName = source.fileName.replace(/^.*[\\\/]/, ''); + var lineNumber = source.lineNumber; + return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; + } + + return ''; + } + + function getSourceInfoErrorAddendumForProps(elementProps) { + if (elementProps !== null && elementProps !== undefined) { + return getSourceInfoErrorAddendum(elementProps.__source); + } + + return ''; + } + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ + + + var ownerHasKeyUseWarning = {}; + + function getCurrentComponentErrorInfo(parentType) { + var info = getDeclarationErrorAddendum(); + + if (!info) { + var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; + + if (parentName) { + info = "\n\nCheck the top-level render call using <" + parentName + ">."; + } + } + + return info; + } + /** + * Warn if the element doesn't have an explicit key assigned to it. + * This element is in an array. The array could grow and shrink or be + * reordered. All children that haven't already been validated are required to + * have a "key" property assigned to it. Error statuses are cached so a warning + * will only be shown once. + * + * @internal + * @param {ReactElement} element Element that requires a key. + * @param {*} parentType element's parent's type. + */ + + + function validateExplicitKey(element, parentType) { + if (!element._store || element._store.validated || element.key != null) { + return; + } + + element._store.validated = true; + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); + + if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { + return; + } + + ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + var childOwner = ''; + + if (element && element._owner && element._owner !== ReactCurrentOwner.current) { + // Give the component that originally created this child. + childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; + } + + { + setCurrentlyValidatingElement$1(element); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + setCurrentlyValidatingElement$1(null); + } + } + /** + * Ensure that every element either is passed in a static location, in an + * array with an explicit keys property defined, or in an object literal + * with valid key property. + * + * @internal + * @param {ReactNode} node Statically passed child of any type. + * @param {*} parentType node's parent's type. + */ + + + function validateChildKeys(node, parentType) { + if (typeof node !== 'object') { + return; + } + + if (isArray(node)) { + for (var i = 0; i < node.length; i++) { + var child = node[i]; + + if (isValidElement(child)) { + validateExplicitKey(child, parentType); + } + } + } else if (isValidElement(node)) { + // This element was passed in a valid location. + if (node._store) { + node._store.validated = true; + } + } else if (node) { + var iteratorFn = getIteratorFn(node); + + if (typeof iteratorFn === 'function') { + // Entry iterators used to provide implicit keys, + // but now we print a separate warning for them later. + if (iteratorFn !== node.entries) { + var iterator = iteratorFn.call(node); + var step; + + while (!(step = iterator.next()).done) { + if (isValidElement(step.value)) { + validateExplicitKey(step.value, parentType); + } + } + } + } + } + } + /** + * Given an element, validate that its props follow the propTypes definition, + * provided by the type. + * + * @param {ReactElement} element + */ + + + function validatePropTypes(element) { + { + var type = element.type; + + if (type === null || type === undefined || typeof type === 'string') { + return; + } + + var propTypes; + + if (typeof type === 'function') { + propTypes = type.propTypes; + } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. + // Inner props are checked in the reconciler. + type.$$typeof === REACT_MEMO_TYPE)) { + propTypes = type.propTypes; + } else { + return; + } + + if (propTypes) { + // Intentionally inside to avoid triggering lazy initializers: + var name = getComponentNameFromType(type); + checkPropTypes(propTypes, element.props, 'prop', name, element); + } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { + propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: + + var _name = getComponentNameFromType(type); + + error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); + } + + if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { + error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); + } + } + } + /** + * Given a fragment, validate that it can only be provided with fragment props + * @param {ReactElement} fragment + */ + + + function validateFragmentProps(fragment) { + { + var keys = Object.keys(fragment.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentlyValidatingElement$1(null); + break; + } + } + + if (fragment.ref !== null) { + setCurrentlyValidatingElement$1(fragment); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentlyValidatingElement$1(null); + } + } + } + function createElementWithValidation(type, props, children) { + var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to + // succeed and there will likely be errors in render. + + if (!validType) { + var info = ''; + + if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + var sourceInfo = getSourceInfoErrorAddendumForProps(props); + + if (sourceInfo) { + info += sourceInfo; + } else { + info += getDeclarationErrorAddendum(); + } + + var typeString; + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; + } + + { + error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); + } + } + + var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + + if (element == null) { + return element; + } // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + + + if (validType) { + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], type); + } + } + + if (type === REACT_FRAGMENT_TYPE) { + validateFragmentProps(element); + } else { + validatePropTypes(element); + } + + return element; + } + var didWarnAboutDeprecatedCreateFactory = false; + function createFactoryWithValidation(type) { + var validatedFactory = createElementWithValidation.bind(null, type); + validatedFactory.type = type; + + { + if (!didWarnAboutDeprecatedCreateFactory) { + didWarnAboutDeprecatedCreateFactory = true; + + warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); + } // Legacy hook: remove it + + + Object.defineProperty(validatedFactory, 'type', { + enumerable: false, + get: function () { + warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); + + Object.defineProperty(this, 'type', { + value: type + }); + return type; + } + }); + } + + return validatedFactory; + } + function cloneElementWithValidation(element, props, children) { + var newElement = cloneElement.apply(this, arguments); + + for (var i = 2; i < arguments.length; i++) { + validateChildKeys(arguments[i], newElement.type); + } + + validatePropTypes(newElement); + return newElement; + } + + var enableSchedulerDebugging = false; + var enableProfiling = false; + var frameYieldMs = 5; + + function push(heap, node) { + var index = heap.length; + heap.push(node); + siftUp(heap, node, index); + } + function peek(heap) { + return heap.length === 0 ? null : heap[0]; + } + function pop(heap) { + if (heap.length === 0) { + return null; + } + + var first = heap[0]; + var last = heap.pop(); + + if (last !== first) { + heap[0] = last; + siftDown(heap, last, 0); + } + + return first; + } + + function siftUp(heap, node, i) { + var index = i; + + while (index > 0) { + var parentIndex = index - 1 >>> 1; + var parent = heap[parentIndex]; + + if (compare(parent, node) > 0) { + // The parent is larger. Swap positions. + heap[parentIndex] = node; + heap[index] = parent; + index = parentIndex; + } else { + // The parent is smaller. Exit. + return; + } + } + } + + function siftDown(heap, node, i) { + var index = i; + var length = heap.length; + var halfLength = length >>> 1; + + while (index < halfLength) { + var leftIndex = (index + 1) * 2 - 1; + var left = heap[leftIndex]; + var rightIndex = leftIndex + 1; + var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. + + if (compare(left, node) < 0) { + if (rightIndex < length && compare(right, left) < 0) { + heap[index] = right; + heap[rightIndex] = node; + index = rightIndex; + } else { + heap[index] = left; + heap[leftIndex] = node; + index = leftIndex; + } + } else if (rightIndex < length && compare(right, node) < 0) { + heap[index] = right; + heap[rightIndex] = node; + index = rightIndex; + } else { + // Neither child is smaller. Exit. + return; + } + } + } + + function compare(a, b) { + // Compare sort index first, then task id. + var diff = a.sortIndex - b.sortIndex; + return diff !== 0 ? diff : a.id - b.id; + } + + // TODO: Use symbols? + var ImmediatePriority = 1; + var UserBlockingPriority = 2; + var NormalPriority = 3; + var LowPriority = 4; + var IdlePriority = 5; + + function markTaskErrored(task, ms) { + } + + /* eslint-disable no-var */ + var getCurrentTime; + var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; + + if (hasPerformanceNow) { + var localPerformance = performance; + + getCurrentTime = function () { + return localPerformance.now(); + }; + } else { + var localDate = Date; + var initialTime = localDate.now(); + + getCurrentTime = function () { + return localDate.now() - initialTime; + }; + } // Max 31 bit integer. The max integer size in V8 for 32-bit systems. + // Math.pow(2, 30) - 1 + // 0b111111111111111111111111111111 + + + var maxSigned31BitInt = 1073741823; // Times out immediately + + var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out + + var USER_BLOCKING_PRIORITY_TIMEOUT = 250; + var NORMAL_PRIORITY_TIMEOUT = 5000; + var LOW_PRIORITY_TIMEOUT = 10000; // Never times out + + var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap + + var taskQueue = []; + var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. + + var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. + var currentTask = null; + var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. + + var isPerformingWork = false; + var isHostCallbackScheduled = false; + var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them. + + var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null; + var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null; + var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom + + var isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; + + function advanceTimers(currentTime) { + // Check for tasks that are no longer delayed and add them to the queue. + var timer = peek(timerQueue); + + while (timer !== null) { + if (timer.callback === null) { + // Timer was cancelled. + pop(timerQueue); + } else if (timer.startTime <= currentTime) { + // Timer fired. Transfer to the task queue. + pop(timerQueue); + timer.sortIndex = timer.expirationTime; + push(taskQueue, timer); + } else { + // Remaining timers are pending. + return; + } + + timer = peek(timerQueue); + } + } + + function handleTimeout(currentTime) { + isHostTimeoutScheduled = false; + advanceTimers(currentTime); + + if (!isHostCallbackScheduled) { + if (peek(taskQueue) !== null) { + isHostCallbackScheduled = true; + requestHostCallback(flushWork); + } else { + var firstTimer = peek(timerQueue); + + if (firstTimer !== null) { + requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + } + } + } + } + + function flushWork(hasTimeRemaining, initialTime) { + + + isHostCallbackScheduled = false; + + if (isHostTimeoutScheduled) { + // We scheduled a timeout but it's no longer needed. Cancel it. + isHostTimeoutScheduled = false; + cancelHostTimeout(); + } + + isPerformingWork = true; + var previousPriorityLevel = currentPriorityLevel; + + try { + if (enableProfiling) { + try { + return workLoop(hasTimeRemaining, initialTime); + } catch (error) { + if (currentTask !== null) { + var currentTime = getCurrentTime(); + markTaskErrored(currentTask, currentTime); + currentTask.isQueued = false; + } + + throw error; + } + } else { + // No catch in prod code path. + return workLoop(hasTimeRemaining, initialTime); + } + } finally { + currentTask = null; + currentPriorityLevel = previousPriorityLevel; + isPerformingWork = false; + } + } + + function workLoop(hasTimeRemaining, initialTime) { + var currentTime = initialTime; + advanceTimers(currentTime); + currentTask = peek(taskQueue); + + while (currentTask !== null && !(enableSchedulerDebugging )) { + if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { + // This currentTask hasn't expired, and we've reached the deadline. + break; + } + + var callback = currentTask.callback; + + if (typeof callback === 'function') { + currentTask.callback = null; + currentPriorityLevel = currentTask.priorityLevel; + var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; + + var continuationCallback = callback(didUserCallbackTimeout); + currentTime = getCurrentTime(); + + if (typeof continuationCallback === 'function') { + currentTask.callback = continuationCallback; + } else { + + if (currentTask === peek(taskQueue)) { + pop(taskQueue); + } + } + + advanceTimers(currentTime); + } else { + pop(taskQueue); + } + + currentTask = peek(taskQueue); + } // Return whether there's additional work + + + if (currentTask !== null) { + return true; + } else { + var firstTimer = peek(timerQueue); + + if (firstTimer !== null) { + requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + } + + return false; + } + } + + function unstable_runWithPriority(priorityLevel, eventHandler) { + switch (priorityLevel) { + case ImmediatePriority: + case UserBlockingPriority: + case NormalPriority: + case LowPriority: + case IdlePriority: + break; + + default: + priorityLevel = NormalPriority; + } + + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = priorityLevel; + + try { + return eventHandler(); + } finally { + currentPriorityLevel = previousPriorityLevel; + } + } + + function unstable_next(eventHandler) { + var priorityLevel; + + switch (currentPriorityLevel) { + case ImmediatePriority: + case UserBlockingPriority: + case NormalPriority: + // Shift down to normal priority + priorityLevel = NormalPriority; + break; + + default: + // Anything lower than normal priority should remain at the current level. + priorityLevel = currentPriorityLevel; + break; + } + + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = priorityLevel; + + try { + return eventHandler(); + } finally { + currentPriorityLevel = previousPriorityLevel; + } + } + + function unstable_wrapCallback(callback) { + var parentPriorityLevel = currentPriorityLevel; + return function () { + // This is a fork of runWithPriority, inlined for performance. + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = parentPriorityLevel; + + try { + return callback.apply(this, arguments); + } finally { + currentPriorityLevel = previousPriorityLevel; + } + }; + } + + function unstable_scheduleCallback(priorityLevel, callback, options) { + var currentTime = getCurrentTime(); + var startTime; + + if (typeof options === 'object' && options !== null) { + var delay = options.delay; + + if (typeof delay === 'number' && delay > 0) { + startTime = currentTime + delay; + } else { + startTime = currentTime; + } + } else { + startTime = currentTime; + } + + var timeout; + + switch (priorityLevel) { + case ImmediatePriority: + timeout = IMMEDIATE_PRIORITY_TIMEOUT; + break; + + case UserBlockingPriority: + timeout = USER_BLOCKING_PRIORITY_TIMEOUT; + break; + + case IdlePriority: + timeout = IDLE_PRIORITY_TIMEOUT; + break; + + case LowPriority: + timeout = LOW_PRIORITY_TIMEOUT; + break; + + case NormalPriority: + default: + timeout = NORMAL_PRIORITY_TIMEOUT; + break; + } + + var expirationTime = startTime + timeout; + var newTask = { + id: taskIdCounter++, + callback: callback, + priorityLevel: priorityLevel, + startTime: startTime, + expirationTime: expirationTime, + sortIndex: -1 + }; + + if (startTime > currentTime) { + // This is a delayed task. + newTask.sortIndex = startTime; + push(timerQueue, newTask); + + if (peek(taskQueue) === null && newTask === peek(timerQueue)) { + // All tasks are delayed, and this is the task with the earliest delay. + if (isHostTimeoutScheduled) { + // Cancel an existing timeout. + cancelHostTimeout(); + } else { + isHostTimeoutScheduled = true; + } // Schedule a timeout. + + + requestHostTimeout(handleTimeout, startTime - currentTime); + } + } else { + newTask.sortIndex = expirationTime; + push(taskQueue, newTask); + // wait until the next time we yield. + + + if (!isHostCallbackScheduled && !isPerformingWork) { + isHostCallbackScheduled = true; + requestHostCallback(flushWork); + } + } + + return newTask; + } + + function unstable_pauseExecution() { + } + + function unstable_continueExecution() { + + if (!isHostCallbackScheduled && !isPerformingWork) { + isHostCallbackScheduled = true; + requestHostCallback(flushWork); + } + } + + function unstable_getFirstCallbackNode() { + return peek(taskQueue); + } + + function unstable_cancelCallback(task) { + // remove from the queue because you can't remove arbitrary nodes from an + // array based heap, only the first one.) + + + task.callback = null; + } + + function unstable_getCurrentPriorityLevel() { + return currentPriorityLevel; + } + + var isMessageLoopRunning = false; + var scheduledHostCallback = null; + var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main + // thread, like user events. By default, it yields multiple times per frame. + // It does not attempt to align with frame boundaries, since most tasks don't + // need to be frame aligned; for those that do, use requestAnimationFrame. + + var frameInterval = frameYieldMs; + var startTime = -1; + + function shouldYieldToHost() { + var timeElapsed = getCurrentTime() - startTime; + + if (timeElapsed < frameInterval) { + // The main thread has only been blocked for a really short amount of time; + // smaller than a single frame. Don't yield yet. + return false; + } // The main thread has been blocked for a non-negligible amount of time. We + + + return true; + } + + function requestPaint() { + + } + + function forceFrameRate(fps) { + if (fps < 0 || fps > 125) { + // Using console['error'] to evade Babel and ESLint + console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); + return; + } + + if (fps > 0) { + frameInterval = Math.floor(1000 / fps); + } else { + // reset the framerate + frameInterval = frameYieldMs; + } + } + + var performWorkUntilDeadline = function () { + if (scheduledHostCallback !== null) { + var currentTime = getCurrentTime(); // Keep track of the start time so we can measure how long the main thread + // has been blocked. + + startTime = currentTime; + var hasTimeRemaining = true; // If a scheduler task throws, exit the current browser task so the + // error can be observed. + // + // Intentionally not using a try-catch, since that makes some debugging + // techniques harder. Instead, if `scheduledHostCallback` errors, then + // `hasMoreWork` will remain true, and we'll continue the work loop. + + var hasMoreWork = true; + + try { + hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); + } finally { + if (hasMoreWork) { + // If there's more work, schedule the next message event at the end + // of the preceding one. + schedulePerformWorkUntilDeadline(); + } else { + isMessageLoopRunning = false; + scheduledHostCallback = null; + } + } + } else { + isMessageLoopRunning = false; + } // Yielding to the browser will give it a chance to paint, so we can + }; + + var schedulePerformWorkUntilDeadline; + + if (typeof localSetImmediate === 'function') { + // Node.js and old IE. + // There's a few reasons for why we prefer setImmediate. + // + // Unlike MessageChannel, it doesn't prevent a Node.js process from exiting. + // (Even though this is a DOM fork of the Scheduler, you could get here + // with a mix of Node.js 15+, which has a MessageChannel, and jsdom.) + // https://github.com/facebook/react/issues/20756 + // + // But also, it runs earlier which is the semantic we want. + // If other browsers ever implement it, it's better to use it. + // Although both of these would be inferior to native scheduling. + schedulePerformWorkUntilDeadline = function () { + localSetImmediate(performWorkUntilDeadline); + }; + } else if (typeof MessageChannel !== 'undefined') { + // DOM and Worker environments. + // We prefer MessageChannel because of the 4ms setTimeout clamping. + var channel = new MessageChannel(); + var port = channel.port2; + channel.port1.onmessage = performWorkUntilDeadline; + + schedulePerformWorkUntilDeadline = function () { + port.postMessage(null); + }; + } else { + // We should only fallback here in non-browser environments. + schedulePerformWorkUntilDeadline = function () { + localSetTimeout(performWorkUntilDeadline, 0); + }; + } + + function requestHostCallback(callback) { + scheduledHostCallback = callback; + + if (!isMessageLoopRunning) { + isMessageLoopRunning = true; + schedulePerformWorkUntilDeadline(); + } + } + + function requestHostTimeout(callback, ms) { + taskTimeoutID = localSetTimeout(function () { + callback(getCurrentTime()); + }, ms); + } + + function cancelHostTimeout() { + localClearTimeout(taskTimeoutID); + taskTimeoutID = -1; + } + + var unstable_requestPaint = requestPaint; + var unstable_Profiling = null; + + + + var Scheduler = /*#__PURE__*/Object.freeze({ + __proto__: null, + unstable_ImmediatePriority: ImmediatePriority, + unstable_UserBlockingPriority: UserBlockingPriority, + unstable_NormalPriority: NormalPriority, + unstable_IdlePriority: IdlePriority, + unstable_LowPriority: LowPriority, + unstable_runWithPriority: unstable_runWithPriority, + unstable_next: unstable_next, + unstable_scheduleCallback: unstable_scheduleCallback, + unstable_cancelCallback: unstable_cancelCallback, + unstable_wrapCallback: unstable_wrapCallback, + unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel, + unstable_shouldYield: shouldYieldToHost, + unstable_requestPaint: unstable_requestPaint, + unstable_continueExecution: unstable_continueExecution, + unstable_pauseExecution: unstable_pauseExecution, + unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, + get unstable_now () { return getCurrentTime; }, + unstable_forceFrameRate: forceFrameRate, + unstable_Profiling: unstable_Profiling + }); + + var ReactSharedInternals$1 = { + ReactCurrentDispatcher: ReactCurrentDispatcher, + ReactCurrentOwner: ReactCurrentOwner, + ReactCurrentBatchConfig: ReactCurrentBatchConfig, + // Re-export the schedule API(s) for UMD bundles. + // This avoids introducing a dependency on a new UMD global in a minor update, + // Since that would be a breaking change (e.g. for all existing CodeSandboxes). + // This re-export is only required for UMD bundles; + // CJS bundles use the shared NPM package. + Scheduler: Scheduler + }; + + { + ReactSharedInternals$1.ReactCurrentActQueue = ReactCurrentActQueue; + ReactSharedInternals$1.ReactDebugCurrentFrame = ReactDebugCurrentFrame; + } + + function startTransition(scope, options) { + var prevTransition = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = {}; + var currentTransition = ReactCurrentBatchConfig.transition; + + { + ReactCurrentBatchConfig.transition._updatedFibers = new Set(); + } + + try { + scope(); + } finally { + ReactCurrentBatchConfig.transition = prevTransition; + + { + if (prevTransition === null && currentTransition._updatedFibers) { + var updatedFibersCount = currentTransition._updatedFibers.size; + + if (updatedFibersCount > 10) { + warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); + } + + currentTransition._updatedFibers.clear(); + } + } + } + } + + var didWarnAboutMessageChannel = false; + var enqueueTaskImpl = null; + function enqueueTask(task) { + if (enqueueTaskImpl === null) { + try { + // read require off the module object to get around the bundlers. + // we don't want them to detect a require and bundle a Node polyfill. + var requireString = ('require' + Math.random()).slice(0, 7); + var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's + // version of setImmediate, bypassing fake timers if any. + + enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; + } catch (_err) { + // we're in a browser + // we can't use regular timers because they may still be faked + // so we try MessageChannel+postMessage instead + enqueueTaskImpl = function (callback) { + { + if (didWarnAboutMessageChannel === false) { + didWarnAboutMessageChannel = true; + + if (typeof MessageChannel === 'undefined') { + error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); + } + } + } + + var channel = new MessageChannel(); + channel.port1.onmessage = callback; + channel.port2.postMessage(undefined); + }; + } + } + + return enqueueTaskImpl(task); + } + + var actScopeDepth = 0; + var didWarnNoAwaitAct = false; + function act(callback) { + { + // `act` calls can be nested, so we track the depth. This represents the + // number of `act` scopes on the stack. + var prevActScopeDepth = actScopeDepth; + actScopeDepth++; + + if (ReactCurrentActQueue.current === null) { + // This is the outermost `act` scope. Initialize the queue. The reconciler + // will detect the queue and use it instead of Scheduler. + ReactCurrentActQueue.current = []; + } + + var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; + var result; + + try { + // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only + // set to `true` while the given callback is executed, not for updates + // triggered during an async event, because this is how the legacy + // implementation of `act` behaved. + ReactCurrentActQueue.isBatchingLegacy = true; + result = callback(); // Replicate behavior of original `act` implementation in legacy mode, + // which flushed updates immediately after the scope function exits, even + // if it's an async function. + + if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) { + var queue = ReactCurrentActQueue.current; + + if (queue !== null) { + ReactCurrentActQueue.didScheduleLegacyUpdate = false; + flushActQueue(queue); + } + } + } catch (error) { + popActScope(prevActScopeDepth); + throw error; + } finally { + ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; + } + + if (result !== null && typeof result === 'object' && typeof result.then === 'function') { + var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait + // for it to resolve before exiting the current scope. + + var wasAwaited = false; + var thenable = { + then: function (resolve, reject) { + wasAwaited = true; + thenableResult.then(function (returnValue) { + popActScope(prevActScopeDepth); + + if (actScopeDepth === 0) { + // We've exited the outermost act scope. Recursively flush the + // queue until there's no remaining work. + recursivelyFlushAsyncActWork(returnValue, resolve, reject); + } else { + resolve(returnValue); + } + }, function (error) { + // The callback threw an error. + popActScope(prevActScopeDepth); + reject(error); + }); + } + }; + + { + if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') { + // eslint-disable-next-line no-undef + Promise.resolve().then(function () {}).then(function () { + if (!wasAwaited) { + didWarnNoAwaitAct = true; + + error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);'); + } + }); + } + } + + return thenable; + } else { + var returnValue = result; // The callback is not an async function. Exit the current scope + // immediately, without awaiting. + + popActScope(prevActScopeDepth); + + if (actScopeDepth === 0) { + // Exiting the outermost act scope. Flush the queue. + var _queue = ReactCurrentActQueue.current; + + if (_queue !== null) { + flushActQueue(_queue); + ReactCurrentActQueue.current = null; + } // Return a thenable. If the user awaits it, we'll flush again in + // case additional work was scheduled by a microtask. + + + var _thenable = { + then: function (resolve, reject) { + // Confirm we haven't re-entered another `act` scope, in case + // the user does something weird like await the thenable + // multiple times. + if (ReactCurrentActQueue.current === null) { + // Recursively flush the queue until there's no remaining work. + ReactCurrentActQueue.current = []; + recursivelyFlushAsyncActWork(returnValue, resolve, reject); + } else { + resolve(returnValue); + } + } + }; + return _thenable; + } else { + // Since we're inside a nested `act` scope, the returned thenable + // immediately resolves. The outer scope will flush the queue. + var _thenable2 = { + then: function (resolve, reject) { + resolve(returnValue); + } + }; + return _thenable2; + } + } + } + } + + function popActScope(prevActScopeDepth) { + { + if (prevActScopeDepth !== actScopeDepth - 1) { + error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); + } + + actScopeDepth = prevActScopeDepth; + } + } + + function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { + { + var queue = ReactCurrentActQueue.current; + + if (queue !== null) { + try { + flushActQueue(queue); + enqueueTask(function () { + if (queue.length === 0) { + // No additional work was scheduled. Finish. + ReactCurrentActQueue.current = null; + resolve(returnValue); + } else { + // Keep flushing work until there's none left. + recursivelyFlushAsyncActWork(returnValue, resolve, reject); + } + }); + } catch (error) { + reject(error); + } + } else { + resolve(returnValue); + } + } + } + + var isFlushing = false; + + function flushActQueue(queue) { + { + if (!isFlushing) { + // Prevent re-entrance. + isFlushing = true; + var i = 0; + + try { + for (; i < queue.length; i++) { + var callback = queue[i]; + + do { + callback = callback(true); + } while (callback !== null); + } + + queue.length = 0; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + queue = queue.slice(i + 1); + throw error; + } finally { + isFlushing = false; + } + } + } + } + + var createElement$1 = createElementWithValidation ; + var cloneElement$1 = cloneElementWithValidation ; + var createFactory = createFactoryWithValidation ; + var Children = { + map: mapChildren, + forEach: forEachChildren, + count: countChildren, + toArray: toArray, + only: onlyChild + }; + + exports.Children = Children; + exports.Component = Component; + exports.Fragment = REACT_FRAGMENT_TYPE; + exports.Profiler = REACT_PROFILER_TYPE; + exports.PureComponent = PureComponent; + exports.StrictMode = REACT_STRICT_MODE_TYPE; + exports.Suspense = REACT_SUSPENSE_TYPE; + exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1; + exports.cloneElement = cloneElement$1; + exports.createContext = createContext; + exports.createElement = createElement$1; + exports.createFactory = createFactory; + exports.createRef = createRef; + exports.forwardRef = forwardRef; + exports.isValidElement = isValidElement; + exports.lazy = lazy; + exports.memo = memo; + exports.startTransition = startTransition; + exports.unstable_act = act; + exports.useCallback = useCallback; + exports.useContext = useContext; + exports.useDebugValue = useDebugValue; + exports.useDeferredValue = useDeferredValue; + exports.useEffect = useEffect; + exports.useId = useId; + exports.useImperativeHandle = useImperativeHandle; + exports.useInsertionEffect = useInsertionEffect; + exports.useLayoutEffect = useLayoutEffect; + exports.useMemo = useMemo; + exports.useReducer = useReducer; + exports.useRef = useRef; + exports.useState = useState; + exports.useSyncExternalStore = useSyncExternalStore; + exports.useTransition = useTransition; + exports.version = ReactVersion; + +}))); diff --git a/graphql-subscription/node_modules/react/umd/react.production.min.js b/graphql-subscription/node_modules/react/umd/react.production.min.js new file mode 100644 index 0000000..82db034 --- /dev/null +++ b/graphql-subscription/node_modules/react/umd/react.production.min.js @@ -0,0 +1,31 @@ +/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +(function(){'use strict';(function(c,x){"object"===typeof exports&&"undefined"!==typeof module?x(exports):"function"===typeof define&&define.amd?define(["exports"],x):(c=c||self,x(c.React={}))})(this,function(c){function x(a){if(null===a||"object"!==typeof a)return null;a=V&&a[V]||a["@@iterator"];return"function"===typeof a?a:null}function w(a,b,e){this.props=a;this.context=b;this.refs=W;this.updater=e||X}function Y(){}function K(a,b,e){this.props=a;this.context=b;this.refs=W;this.updater=e||X}function Z(a,b, +e){var m,d={},c=null,h=null;if(null!=b)for(m in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(c=""+b.key),b)aa.call(b,m)&&!ba.hasOwnProperty(m)&&(d[m]=b[m]);var l=arguments.length-2;if(1===l)d.children=e;else if(1>>1,d=a[c];if(0>>1;cD(l,e))fD(g,l)?(a[c]=g,a[f]=e,c=f):(a[c]=l,a[h]=e,c=h);else if(fD(g,e))a[c]=g,a[f]=e,c=f;else break a}}return b} +function D(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}function P(a){for(var b=p(r);null!==b;){if(null===b.callback)E(r);else if(b.startTime<=a)E(r),b.sortIndex=b.expirationTime,O(q,b);else break;b=p(r)}}function Q(a){z=!1;P(a);if(!u)if(null!==p(q))u=!0,R(S);else{var b=p(r);null!==b&&T(Q,b.startTime-a)}}function S(a,b){u=!1;z&&(z=!1,ea(A),A=-1);F=!0;var c=k;try{P(b);for(n=p(q);null!==n&&(!(n.expirationTime>b)||a&&!fa());){var m=n.callback;if("function"===typeof m){n.callback=null; +k=n.priorityLevel;var d=m(n.expirationTime<=b);b=v();"function"===typeof d?n.callback=d:n===p(q)&&E(q);P(b)}else E(q);n=p(q)}if(null!==n)var g=!0;else{var h=p(r);null!==h&&T(Q,h.startTime-b);g=!1}return g}finally{n=null,k=c,F=!1}}function fa(){return v()-hae?(a.sortIndex=c,O(r,a),null===p(q)&&a===p(r)&&(z?(ea(A),A=-1):z=!0,T(Q,c-e))):(a.sortIndex=d,O(q,a),u||F||(u=!0,R(S)));return a},unstable_cancelCallback:function(a){a.callback=null},unstable_wrapCallback:function(a){var b=k;return function(){var c=k;k=b;try{return a.apply(this,arguments)}finally{k=c}}},unstable_getCurrentPriorityLevel:function(){return k},unstable_shouldYield:fa, +unstable_requestPaint:function(){},unstable_continueExecution:function(){u||F||(u=!0,R(S))},unstable_pauseExecution:function(){},unstable_getFirstCallbackNode:function(){return p(q)},get unstable_now(){return v},unstable_forceFrameRate:function(a){0>a||125>>1,d=a[c];if(0>>1;cD(l,e))fD(g,l)?(a[c]=g,a[f]=e,c=f):(a[c]=l,a[h]=e,c=h);else if(fD(g,e))a[c]=g,a[f]=e,c=f;else break a}}return b} +function D(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}function P(a){for(var b=p(r);null!==b;){if(null===b.callback)E(r);else if(b.startTime<=a)E(r),b.sortIndex=b.expirationTime,O(q,b);else break;b=p(r)}}function Q(a){z=!1;P(a);if(!u)if(null!==p(q))u=!0,R(S);else{var b=p(r);null!==b&&T(Q,b.startTime-a)}}function S(a,b){u=!1;z&&(z=!1,ea(A),A=-1);F=!0;var c=k;try{P(b);for(n=p(q);null!==n&&(!(n.expirationTime>b)||a&&!fa());){var m=n.callback;if("function"===typeof m){n.callback=null; +k=n.priorityLevel;var d=m(n.expirationTime<=b);b=v();"function"===typeof d?n.callback=d:n===p(q)&&E(q);P(b)}else E(q);n=p(q)}if(null!==n)var g=!0;else{var h=p(r);null!==h&&T(Q,h.startTime-b);g=!1}return g}finally{n=null,k=c,F=!1}}function fa(){return v()-hae?(a.sortIndex=c,O(r,a),null===p(q)&&a===p(r)&&(z?(ea(A),A=-1):z=!0,T(Q,c-e))):(a.sortIndex=d,O(q,a),u||F||(u=!0,R(S)));return a},unstable_cancelCallback:function(a){a.callback=null},unstable_wrapCallback:function(a){var b=k;return function(){var c=k;k=b;try{return a.apply(this,arguments)}finally{k=c}}},unstable_getCurrentPriorityLevel:function(){return k},unstable_shouldYield:fa, +unstable_requestPaint:function(){},unstable_continueExecution:function(){u||F||(u=!0,R(S))},unstable_pauseExecution:function(){},unstable_getFirstCallbackNode:function(){return p(q)},get unstable_now(){return v},unstable_forceFrameRate:function(a){0>a||125 This package is fairly advanced and is only intended for library developers that want to maintain high interop with Next.js server actions. + +Rehackt invisibly wraps `react` so that you're able to use shared imports with `react` in server-side Next.js code without throwing an error to your users. + +## Explainer + +Assume you have the following code in a Next.js codebase: + +```tsx +"use client" + +import { useFormState } from "react-dom" +import someAction from "./action"; + +export const ClientComp = () => { + const [data, action] = useFormState(someAction, "Hello client"); + + return
    +

    {data}

    + +
    +} +``` + +```tsx +"use server" +// action.ts + +import {data} from "./shared-code"; + +export default async function someAction() { + return "Hello " + data.name; +} +``` + +```tsx +// shared-code.ts +import {useState} from "react"; + +export const data = { + useForm: (val: T) => { + useState(val) + }, + name: "server" +} +``` + +While you're not intending to use `data.useForm` in your `action.ts` server-only file, you'll still receive the following error from Next.js' build process when trying to use this code: + +```shell +./src/app/shared-code.ts +ReactServerComponentsError: + +You're importing a component that needs useState. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default. +Learn more: https://nextjs.org/docs/getting-started/react-essentials + + ╭─[/src/app/shared-code.ts:1:1] + 1 │ import {useState} from "react"; + · ──────── + 2 │ + 3 │ export const data = { + 3 │ useForm: (val: T) => { + ╰──── + +Maybe one of these should be marked as a client entry with "use client": +./src/app/shared-code.ts +./src/app/action.ts +``` + +This is because Next.js statically analyzes usage of `useState` to ensure it's not being utilized in server-only code. + +By replacing the import from `react` to `rehackt`: + +```tsx +// shared-code.ts +import {useState} from "rehackt"; + +export const data = { + useForm: (val: T) => { + useState(val) + }, + name: "server" +} +``` + +You'll no longer see this error. + +> Keep in mind, this does not enable usage of `useState` in server-only code, this just removes the error described above. + +## Further Reading + +The following is a list of reading resources that pertain to this package: + +- [My take on the current React & Server Components controversy - Lenz Weber-Tronic](https://phryneas.de/react-server-components-controversy) + +- [apollographql/apollo-client#10974](https://github.com/apollographql/apollo-client/issues/10974) + +- [TanStack/form#480](https://github.com/TanStack/form/issues/480#issuecomment-1793576645) diff --git a/graphql-subscription/node_modules/rehackt/index.d.ts b/graphql-subscription/node_modules/rehackt/index.d.ts new file mode 100644 index 0000000..190ada3 --- /dev/null +++ b/graphql-subscription/node_modules/rehackt/index.d.ts @@ -0,0 +1,3 @@ +/// +import * as React from "react"; +export = React; diff --git a/graphql-subscription/node_modules/rehackt/index.js b/graphql-subscription/node_modules/rehackt/index.js new file mode 100644 index 0000000..73a123f --- /dev/null +++ b/graphql-subscription/node_modules/rehackt/index.js @@ -0,0 +1,2 @@ +"use strict"; +module.exports = require("react"); diff --git a/graphql-subscription/node_modules/rehackt/package.json b/graphql-subscription/node_modules/rehackt/package.json new file mode 100644 index 0000000..ac05e19 --- /dev/null +++ b/graphql-subscription/node_modules/rehackt/package.json @@ -0,0 +1,47 @@ +{ + "name": "rehackt", + "version": "0.0.5", + "description": "A wrapper around React that will hide hooks from the React Server Component compiler", + "author": "Lenz Weber-Tronic", + "repository": { + "type": "git", + "url": "git+https://github.com/phryneas/rehackt.git" + }, + "homepage": "https://github.com/phryneas/rehackt", + "license": "MIT", + "main": "index.js", + "exports": { + ".": { + "types": "./index.d.ts", + "react-server": "./rsc.js", + "default": "./index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "index.js", + "index.d.ts", + "rsc.js", + "package.json", + "README.md" + ], + "peerDependencies": { + "react": "*", + "@types/react": "*" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "@types/react": { + "optional": true + } + }, + "devDependencies": { + "react": "^18.3.0-canary-ab31a9ed2-20230824", + "@types/node": "^20.5.7" + }, + "prettier": { + "printWidth": 120 + } +} diff --git a/graphql-subscription/node_modules/rehackt/rsc.js b/graphql-subscription/node_modules/rehackt/rsc.js new file mode 100644 index 0000000..a4a5edf --- /dev/null +++ b/graphql-subscription/node_modules/rehackt/rsc.js @@ -0,0 +1,76 @@ +// @ts-check + +if (0) { + // Trick cjs-module-lexer into adding named exports for all React exports. + // (if imported with `import()`, they will appear in `.default` as well.) + // This way, cjs-module-lexer will let all of react's (named) exports through unchanged. + module.exports = require("react"); +} + +// missing functions +module.exports.createContext = polyfillMissingFn("createContext"); +module.exports.createFactory = polyfillMissingFn("createFactory"); +module.exports.act = polyfillMissingFn("act"); +module.exports.unstable_act = polyfillMissingFn("unstable_act"); +module.exports.unstable_useCacheRefresh = polyfillMissingFn("unstable_useCacheRefresh"); +module.exports.useContext = polyfillMissingFn("useContext"); +module.exports.useDeferredValue = polyfillMissingFn("useDeferredValue"); +module.exports.useEffect = polyfillMissingFn("useEffect"); +module.exports.useImperativeHandle = polyfillMissingFn("useImperativeHandle"); +module.exports.useInsertionEffect = polyfillMissingFn("useInsertionEffect"); +module.exports.useLayoutEffect = polyfillMissingFn("useLayoutEffect"); +module.exports.useReducer = polyfillMissingFn("useReducer"); +module.exports.useRef = polyfillMissingFn("useRef"); +module.exports.useState = polyfillMissingFn("useState"); +module.exports.useSyncExternalStore = polyfillMissingFn("useSyncExternalStore"); +module.exports.useTransition = polyfillMissingFn("useTransition"); +module.exports.useOptimistic = polyfillMissingFn("useOptimistic"); + +// missing classes +module.exports.Component = polyfillMissingClass("Component"); +module.exports.PureComponent = polyfillMissingClass("PureComponent"); + +module.exports.createContext = function unsupportedCreateContext() { + return { + Provider: function throwNoContext() { + throw new Error("Context is not available in this environment."); + }, + Consumer: function throwNoContext() { + throw new Error("Context is not available in this environment."); + }, + }; +}; + +module.exports.createFactory = function unsupportedCreateFactory() { + return function throwNoCreateFactory() { + throw new Error("createFactory is not available in this environment."); + }; +}; + +// Here we actually pull in the React library and add everything +// it exports to our own `module.exports`. +// If React suddenly were to add one of the above "polyfilled" exports, +// the React version would overwrite our version, so this should be +// future-proof. +Object.assign(module.exports, require("react")); + +function polyfillMissingFn(exportName) { + const name = "nonExistingExport__" + exportName; + return /** @type {any} */ ( + { + [name]() { + throw new Error(`React functionality '${exportName}' is not available in this environment.`); + }, + }[name] + ); +} + +function polyfillMissingClass(exportName) { + return /** @type {any} */ ( + class NonExistentClass { + constructor() { + throw new Error(`React class '${exportName}' is not available in this environment.`); + } + } + ); +} diff --git a/graphql-subscription/node_modules/response-iterator/LICENSE b/graphql-subscription/node_modules/response-iterator/LICENSE new file mode 100644 index 0000000..30f6012 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-2022 Kevin Malakoff + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/README.md b/graphql-subscription/node_modules/response-iterator/README.md new file mode 100644 index 0000000..2b5467a --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/README.md @@ -0,0 +1,37 @@ +## response-iterator + +Creates an async iterator for a variety of inputs in the browser and node. Supports fetch, node-fetch, cross-fetch, axios, got, undici. + +### Example 1 + +```typescript +// import "isomorphic-fetch"; // node only +import responseIterator from 'response-iterator'; + +const res = await fetch('https://raw.githubusercontent.com/kmalakoff/response-iterator/master/package.json'); + +let data = ''; +for await (const chunk of responseIterator(res)) { + data += chunk; +} +console.log(JSON.parse(data).name); // "response-iterator" +``` + +### Example 2 + +```typescript +import crossFetch from 'cross-fetch'; +import responseIterator from 'response-iterator'; + +const res = await crossFetch('https://raw.githubusercontent.com/kmalakoff/response-iterator/master/package.json'); + +let data = ''; +for await (const chunk of responseIterator(res)) { + data += chunk; +} +console.log(JSON.parse(data).name); // "response-iterator" +``` + +### Documentation + +[API Docs](https://kmalakoff.github.io/response-iterator/) diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/index.js b/graphql-subscription/node_modules/response-iterator/dist/cjs/index.js new file mode 100644 index 0000000..528e3f3 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/index.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +module.exports = responseIterator; +var _asyncTs = _interopRequireDefault(require("./iterators/async.js")); +var _nodeStreamTs = _interopRequireDefault(require("./iterators/nodeStream.js")); +var _promiseTs = _interopRequireDefault(require("./iterators/promise.js")); +var _readerTs = _interopRequireDefault(require("./iterators/reader.js")); +function responseIterator(response) { + if (response === undefined) throw new Error("Missing response for responseIterator"); + // determine the body + var body = response; + if (response.body) body = response.body; + else if (response.data) body = response.data; + else if (response._bodyBlob) body = response._bodyBlob; // cross-fetch + /* c8 ignore stop */ // adapt the body + if (hasIterator && body[Symbol.asyncIterator]) return (0, _asyncTs).default(body); + /* c8 ignore start */ if (body.getReader) return (0, _readerTs).default(body.getReader()); + if (body.stream) return (0, _readerTs).default(body.stream().getReader()); + if (body.arrayBuffer) return (0, _promiseTs).default(body.arrayBuffer()); + if (body.pipe) return (0, _nodeStreamTs).default(body); + /* c8 ignore stop */ throw new Error("Unknown body type for responseIterator. Maybe you are not passing a streamable response"); +} +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +var hasIterator = typeof Symbol !== "undefined" && Symbol.asyncIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/index.js.map b/graphql-subscription/node_modules/response-iterator/dist/cjs/index.js.map new file mode 100644 index 0000000..949e796 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"sourcesContent":["import { AxiosResponse } from 'axios';\nimport { Response as NodeResponse } from 'node-fetch';\nimport { Readable as NodeReadableStream } from 'stream';\n\n// @ts-ignore\nimport asyncIterator from './iterators/async.ts';\n// @ts-ignore\nimport nodeStreamIterator from './iterators/nodeStream.ts';\n// @ts-ignore\nimport promiseIterator from './iterators/promise.ts';\n// @ts-ignore\nimport readerIterator from './iterators/reader.ts';\n\ninterface CrossFetchResponse {\n _bodyBlob: Blob;\n}\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/**\n * @param response A response. Supports fetch, node-fetch, and cross-fetch\n */\nexport default function responseIterator(response: unknown): AsyncIterableIterator {\n if (response === undefined) throw new Error('Missing response for responseIterator');\n\n // determine the body\n let body: unknown = response;\n if ((response as NodeResponse).body) body = (response as NodeResponse).body;\n // node-fetch, browser fetch, undici\n else if ((response as AxiosResponse).data) body = (response as AxiosResponse).data;\n // axios\n /* c8 ignore start */ else if ((response as CrossFetchResponse)._bodyBlob) body = (response as CrossFetchResponse)._bodyBlob; // cross-fetch\n /* c8 ignore stop */\n\n // adapt the body\n if (hasIterator && body[Symbol.asyncIterator]) return asyncIterator(body as AsyncIterableIterator);\n /* c8 ignore start */\n if ((body as ReadableStream).getReader) return readerIterator((body as ReadableStream).getReader());\n if ((body as Blob).stream) return readerIterator(((body as Blob).stream() as unknown as ReadableStream).getReader());\n if ((body as Blob).arrayBuffer) return promiseIterator((body as Blob).arrayBuffer());\n if ((body as NodeReadableStream).pipe) return nodeStreamIterator(body as NodeReadableStream);\n /* c8 ignore stop */\n\n throw new Error('Unknown body type for responseIterator. Maybe you are not passing a streamable response');\n}\n"],"names":["responseIterator","response","undefined","Error","body","data","_bodyBlob","hasIterator","Symbol","asyncIterator","getReader","readerIterator","stream","arrayBuffer","promiseIterator","pipe","nodeStreamIterator"],"mappings":"AAAA;;;;kBAsBwBA,gBAAgB;AAjBd,IAAA,QAAsB,kCAAtB,sBAAsB,EAAA;AAEjB,IAAA,aAA2B,kCAA3B,2BAA2B,EAAA;AAE9B,IAAA,UAAwB,kCAAxB,wBAAwB,EAAA;AAEzB,IAAA,SAAuB,kCAAvB,uBAAuB,EAAA;AAWnC,SAASA,gBAAgB,CAAIC,QAAiB,EAA4B;IACvF,IAAIA,QAAQ,KAAKC,SAAS,EAAE,MAAM,IAAIC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAErF,qBAAqB;IACrB,IAAIC,IAAI,GAAYH,QAAQ,AAAC;IAC7B,IAAI,AAACA,QAAQ,CAAkBG,IAAI,EAAEA,IAAI,GAAG,AAACH,QAAQ,CAAkBG,IAAI,CAAC;SAEvE,IAAI,AAACH,QAAQ,CAAmBI,IAAI,EAAED,IAAI,GAAG,AAACH,QAAQ,CAAmBI,IAAI,CAAC;SAExD,IAAI,AAACJ,QAAQ,CAAwBK,SAAS,EAAEF,IAAI,GAAG,AAACH,QAAQ,CAAwBK,SAAS,CAAC,CAAC,cAAc;IAC5I,oBAAoB,CAEpB,iBAAiB;IACjB,IAAIC,WAAW,IAAIH,IAAI,CAACI,MAAM,CAACC,aAAa,CAAC,EAAE,OAAOA,CAAAA,GAAAA,QAAa,AAAqC,CAAA,QAArC,CAAIL,IAAI,CAA6B,CAAC;IACzG,qBAAqB,CACrB,IAAI,AAACA,IAAI,CAAuBM,SAAS,EAAE,OAAOC,CAAAA,GAAAA,SAAc,AAA4C,CAAA,QAA5C,CAAI,AAACP,IAAI,CAAuBM,SAAS,EAAE,CAAC,CAAC;IAC7G,IAAI,AAACN,IAAI,CAAUQ,MAAM,EAAE,OAAOD,CAAAA,GAAAA,SAAc,AAA0E,CAAA,QAA1E,CAAI,AAAC,AAACP,IAAI,CAAUQ,MAAM,EAAE,CAAkCF,SAAS,EAAE,CAAC,CAAC;IAC3H,IAAI,AAACN,IAAI,CAAUS,WAAW,EAAE,OAAOC,CAAAA,GAAAA,UAAe,AAAiC,CAAA,QAAjC,CAAI,AAACV,IAAI,CAAUS,WAAW,EAAE,CAAC,CAAC;IACxF,IAAI,AAACT,IAAI,CAAwBW,IAAI,EAAE,OAAOC,CAAAA,GAAAA,aAAkB,AAA+B,CAAA,QAA/B,CAAIZ,IAAI,CAAuB,CAAC;IAChG,oBAAoB,CAEpB,MAAM,IAAID,KAAK,CAAC,yFAAyF,CAAC,CAAC;CAC5G;;;;;;AA3BD,IAAMI,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,aAAa,AAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js new file mode 100644 index 0000000..e6b9cee --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +module.exports = asyncIterator; +function asyncIterator(source) { + var iterator = source[Symbol.asyncIterator](); + return _defineProperty({ + next: function next() { + return iterator.next(); + } + }, Symbol.asyncIterator, function() { + return this; + }); +} +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +} diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js.map b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js.map new file mode 100644 index 0000000..8bbf113 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/async.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["async.ts"],"sourcesContent":["export default function asyncIterator(source): AsyncIterableIterator {\n const iterator = source[Symbol.asyncIterator]();\n return {\n next(): Promise> {\n return iterator.next();\n },\n [Symbol.asyncIterator](): AsyncIterator {\n return this;\n },\n } as AsyncIterableIterator;\n}\n"],"names":["asyncIterator","source","iterator","Symbol","next"],"mappings":"AAAA;;;;kBAAwBA,aAAa;AAAtB,SAASA,aAAa,CAAIC,MAAM,EAA4B;IACzE,IAAMC,QAAQ,GAAGD,MAAM,CAACE,MAAM,CAACH,aAAa,CAAC,EAAE,AAAC;IAChD,OAIE;QAHAI,IAAI,EAAJA,SAAAA,IAAI,GAAwC;YAC1C,OAAOF,QAAQ,CAACE,IAAI,EAAE,CAAC;SACxB;OACAD,MAAM,CAACH,aAAa,EAArB,WAA2C;QACzC,OAAO,IAAI,CAAC;KACb,CAAA,CAC2B;CAC/B"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js new file mode 100644 index 0000000..53816f3 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +module.exports = nodeStreamIterator; +function nodeStreamIterator(stream) { + var onData = function onData(chunk) { + if (error) return; + if (waiting.length) return waiting.shift()[0]({ + value: chunk, + done: false + }); + data.push(chunk); + }; + var onError = function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function(pair) { + pair[1](err); + }); + !cleanup || cleanup(); + }; + var onEnd = function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function(pair) { + pair[0]({ + value: undefined, + done: true + }); + }); + !cleanup || cleanup(); + }; + var getNext = function getNext() { + return new Promise(function(resolve, reject) { + if (error) return reject(error); + if (data.length) return resolve({ + value: data.shift(), + done: false + }); + if (done) return resolve({ + value: undefined, + done: true + }); + waiting.push([ + resolve, + reject + ]); + }); + }; + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + cleanup = function() { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + var iterator = { + next: function next() { + return getNext(); + } + }; + if (hasIterator) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; +} /* c8 ignore stop */ +var hasIterator = typeof Symbol !== "undefined" && Symbol.asyncIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js.map b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js.map new file mode 100644 index 0000000..86ae82f --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/nodeStream.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["nodeStream.ts"],"sourcesContent":["import { Readable as NodeReadableStream } from 'stream';\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function nodeStreamIterator(stream: NodeReadableStream): AsyncIterableIterator {\n let cleanup = null;\n let error = null;\n let done = false;\n const data = [];\n const waiting = [];\n\n function onData(chunk) {\n if (error) return;\n if (waiting.length) return waiting.shift()[0]({ value: chunk, done: false });\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n\n cleanup = function () {\n cleanup = null;\n stream.removeListener('data', onData);\n stream.removeListener('error', onError);\n stream.removeListener('end', onEnd);\n stream.removeListener('finish', onEnd);\n stream.removeListener('close', onEnd);\n };\n stream.on('data', onData);\n stream.on('error', onError);\n stream.on('end', onEnd);\n stream.on('finish', onEnd);\n stream.on('close', onEnd);\n\n function getNext(): Promise> {\n return new Promise(function (resolve, reject) {\n if (error) return reject(error);\n if (data.length) return resolve({ value: data.shift(), done: false });\n if (done) return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n\n const iterator = {\n next(): Promise> {\n return getNext();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n"],"names":["nodeStreamIterator","stream","onData","chunk","error","waiting","length","shift","value","done","data","push","onError","err","all","slice","forEach","pair","cleanup","onEnd","undefined","getNext","Promise","resolve","reject","removeListener","on","iterator","next","hasIterator","Symbol","asyncIterator"],"mappings":"AAAA;;;;kBAKwBA,kBAAkB;AAA3B,SAASA,kBAAkB,CAAIC,MAA0B,EAA4B;QAOzFC,MAAM,GAAf,SAASA,MAAM,CAACC,KAAK,EAAE;QACrB,IAAIC,KAAK,EAAE,OAAO;QAClB,IAAIC,OAAO,CAACC,MAAM,EAAE,OAAOD,OAAO,CAACE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;YAAEC,KAAK,EAAE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OAAOJ,QAAQ,CAA6B;CAC7C,CACD,oBAAoB;AArEpB,IAAME,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,aAAa,AAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js new file mode 100644 index 0000000..66f16e4 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +module.exports = promiseIterator; +function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function next() { + if (resolved) return Promise.resolve({ + value: undefined, + done: true + }); + resolved = true; + return new Promise(function(resolve, reject) { + promise.then(function(value) { + resolve({ + value: value, + done: false + }); + }).catch(reject); + }); + } + }; + if (hasIterator) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; +} /* c8 ignore stop */ +var hasIterator = typeof Symbol !== "undefined" && Symbol.asyncIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js.map b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js.map new file mode 100644 index 0000000..8a35b78 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/promise.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["promise.ts"],"sourcesContent":["const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function promiseIterator(promise): AsyncIterableIterator {\n let resolved = false;\n\n const iterator = {\n next(): Promise> {\n if (resolved) return Promise.resolve({ value: undefined, done: true });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value, done: false });\n })\n .catch(reject);\n });\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n"],"names":["promiseIterator","promise","resolved","iterator","next","Promise","resolve","value","undefined","done","reject","then","catch","hasIterator","Symbol","asyncIterator"],"mappings":"AAAA;;;;kBAGwBA,eAAe;AAAxB,SAASA,eAAe,CAAIC,OAAO,EAA4B;IAC5E,IAAIC,QAAQ,GAAG,KAAK,AAAC;IAErB,IAAMC,QAAQ,GAAG;QACfC,IAAI,EAAJA,SAAAA,IAAI,GAAwC;YAC1C,IAAIF,QAAQ,EAAE,OAAOG,OAAO,CAACC,OAAO,CAAC;gBAAEC,KAAK,EAAEC,SAAS;gBAAEC,IAAI,EAAE,IAAI;aAAE,CAAC,CAAC;YACvEP,QAAQ,GAAG,IAAI,CAAC;YAChB,OAAO,IAAIG,OAAO,CAAC,SAAUC,OAAO,EAAEI,MAAM,EAAE;gBAC5CT,OAAO,CACJU,IAAI,CAAC,SAAUJ,KAAK,EAAE;oBACrBD,OAAO,CAAC;wBAAEC,KAAK,EAALA,KAAK;wBAAEE,IAAI,EAAE,KAAK;qBAAE,CAAC,CAAC;iBACjC,CAAC,CACDG,KAAK,CAACF,MAAM,CAAC,CAAC;aAClB,CAAC,CAAC;SACJ;KACF,AAAC;IAEF,IAAIG,WAAW,EAAE;QACfV,QAAQ,CAACW,MAAM,CAACC,aAAa,CAAC,GAAG,WAA8B;YAC7D,OAAO,IAAI,CAAC;SACb,CAAC;KACH;IAED,OAAOZ,QAAQ,CAA6B;CAC7C,CACD,oBAAoB;AA5BpB,IAAMU,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,aAAa,AAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js new file mode 100644 index 0000000..d80e26c --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +module.exports = readerIterator; +function readerIterator(reader) { + var iterator = { + next: function next() { + return reader.read(); + } + }; + if (hasIterator) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; +} /* c8 ignore stop */ +var hasIterator = typeof Symbol !== "undefined" && Symbol.asyncIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js.map b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js.map new file mode 100644 index 0000000..7316d24 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/iterators/reader.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["reader.ts"],"sourcesContent":["const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function readerIterator(reader): AsyncIterableIterator {\n const iterator = {\n next(): Promise> {\n return reader.read();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n"],"names":["readerIterator","reader","iterator","next","read","hasIterator","Symbol","asyncIterator"],"mappings":"AAAA;;;;kBAGwBA,cAAc;AAAvB,SAASA,cAAc,CAAIC,MAAM,EAA4B;IAC1E,IAAMC,QAAQ,GAAG;QACfC,IAAI,EAAJA,SAAAA,IAAI,GAAwC;YAC1C,OAAOF,MAAM,CAACG,IAAI,EAAE,CAAC;SACtB;KACF,AAAC;IAEF,IAAIC,WAAW,EAAE;QACfH,QAAQ,CAACI,MAAM,CAACC,aAAa,CAAC,GAAG,WAA8B;YAC7D,OAAO,IAAI,CAAC;SACb,CAAC;KACH;IAED,OAAOL,QAAQ,CAA6B;CAC7C,CACD,oBAAoB;AAlBpB,IAAMG,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,aAAa,AAAC"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/cjs/package.json b/graphql-subscription/node_modules/response-iterator/dist/cjs/package.json new file mode 100644 index 0000000..6acf458 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/cjs/package.json @@ -0,0 +1 @@ +{ "type": "commonjs" } \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs b/graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs new file mode 100644 index 0000000..dfa0e8b --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs @@ -0,0 +1,26 @@ +// @ts-ignore +import asyncIterator from './iterators/async.mjs'; +// @ts-ignore +import nodeStreamIterator from './iterators/nodeStream.mjs'; +// @ts-ignore +import promiseIterator from './iterators/promise.mjs'; +// @ts-ignore +import readerIterator from './iterators/reader.mjs'; +const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator; +/** + * @param response A response. Supports fetch, node-fetch, and cross-fetch + */ export default function responseIterator(response) { + if (response === undefined) throw new Error('Missing response for responseIterator'); + // determine the body + let body = response; + if (response.body) body = response.body; + else if (response.data) body = response.data; + else if (response._bodyBlob) body = response._bodyBlob; // cross-fetch + /* c8 ignore stop */ // adapt the body + if (hasIterator && body[Symbol.asyncIterator]) return asyncIterator(body); + /* c8 ignore start */ if (body.getReader) return readerIterator(body.getReader()); + if (body.stream) return readerIterator(body.stream().getReader()); + if (body.arrayBuffer) return promiseIterator(body.arrayBuffer()); + if (body.pipe) return nodeStreamIterator(body); + /* c8 ignore stop */ throw new Error('Unknown body type for responseIterator. Maybe you are not passing a streamable response'); +}; diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs.map b/graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs.map new file mode 100644 index 0000000..56eb1d3 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["index.ts"],"sourcesContent":["import { AxiosResponse } from 'axios';\nimport { Response as NodeResponse } from 'node-fetch';\nimport { Readable as NodeReadableStream } from 'stream';\n\n// @ts-ignore\nimport asyncIterator from './iterators/async.ts';\n// @ts-ignore\nimport nodeStreamIterator from './iterators/nodeStream.ts';\n// @ts-ignore\nimport promiseIterator from './iterators/promise.ts';\n// @ts-ignore\nimport readerIterator from './iterators/reader.ts';\n\ninterface CrossFetchResponse {\n _bodyBlob: Blob;\n}\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/**\n * @param response A response. Supports fetch, node-fetch, and cross-fetch\n */\nexport default function responseIterator(response: unknown): AsyncIterableIterator {\n if (response === undefined) throw new Error('Missing response for responseIterator');\n\n // determine the body\n let body: unknown = response;\n if ((response as NodeResponse).body) body = (response as NodeResponse).body;\n // node-fetch, browser fetch, undici\n else if ((response as AxiosResponse).data) body = (response as AxiosResponse).data;\n // axios\n /* c8 ignore start */ else if ((response as CrossFetchResponse)._bodyBlob) body = (response as CrossFetchResponse)._bodyBlob; // cross-fetch\n /* c8 ignore stop */\n\n // adapt the body\n if (hasIterator && body[Symbol.asyncIterator]) return asyncIterator(body as AsyncIterableIterator);\n /* c8 ignore start */\n if ((body as ReadableStream).getReader) return readerIterator((body as ReadableStream).getReader());\n if ((body as Blob).stream) return readerIterator(((body as Blob).stream() as unknown as ReadableStream).getReader());\n if ((body as Blob).arrayBuffer) return promiseIterator((body as Blob).arrayBuffer());\n if ((body as NodeReadableStream).pipe) return nodeStreamIterator(body as NodeReadableStream);\n /* c8 ignore stop */\n\n throw new Error('Unknown body type for responseIterator. Maybe you are not passing a streamable response');\n}\n"],"names":["asyncIterator","nodeStreamIterator","promiseIterator","readerIterator","hasIterator","Symbol","responseIterator","response","undefined","Error","body","data","_bodyBlob","getReader","stream","arrayBuffer","pipe"],"mappings":"AAIA,aAAa;AACb,OAAOA,aAAa,MAAM,sBAAsB,CAAC;AACjD,aAAa;AACb,OAAOC,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,aAAa;AACb,OAAOC,eAAe,MAAM,wBAAwB,CAAC;AACrD,aAAa;AACb,OAAOC,cAA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AC,yFAAyF,CAAC,CAAC;CAC5G,CAAA"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs new file mode 100644 index 0000000..2d55a37 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs @@ -0,0 +1,11 @@ +export default function asyncIterator(source) { + const iterator = source[Symbol.asyncIterator](); + return { + next () { + return iterator.next(); + }, + [Symbol.asyncIterator] () { + return this; + } + }; +}; diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs.map b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs.map new file mode 100644 index 0000000..3fbdfd9 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/async.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["async.ts"],"sourcesContent":["export default function asyncIterator(source): AsyncIterableIterator {\n const iterator = source[Symbol.asyncIterator]();\n return {\n next(): Promise> {\n return iterator.next();\n },\n [Symbol.asyncIterator](): AsyncIterator {\n return this;\n },\n } as AsyncIterableIterator;\n}\n"],"names":["asyncIterator","source","iterator","Symbol","next"],"mappings":"AAAA,eAAe,SAASA,aAAa,CAAIC,MAAM,EAA4B;IACzE,MAAMC,QAAQ,GAAGD,MAAM,CAACE,MAAM,CAACH,aAAa,CAAC,EAAE,AAAC;IAChD,OAAO;QACLI,IAAI,IAAwC;YAC1C,OAAOF,QAAQ,CAACE,IAAI,EAAE,CAAC;SACxB;QACD,CAACD,MAAM,CAACH,aAAa,CAAC,IAAqB;YACzC,OAAO,IAAI,CAAC;SACb;KACF,CAA6B;CAC/B,CAAA"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs new file mode 100644 index 0000000..1fc01f7 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs @@ -0,0 +1,76 @@ +const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator; +/* c8 ignore start */ export default function nodeStreamIterator(stream) { + let cleanup = null; + let error = null; + let done = false; + const data = []; + const waiting = []; + function onData(chunk) { + if (error) return; + if (waiting.length) return waiting.shift()[0]({ + value: chunk, + done: false + }); + data.push(chunk); + } + function onError(err) { + error = err; + const all = waiting.slice(); + all.forEach(function(pair) { + pair[1](err); + }); + !cleanup || cleanup(); + } + function onEnd() { + done = true; + const all = waiting.slice(); + all.forEach(function(pair) { + pair[0]({ + value: undefined, + done: true + }); + }); + !cleanup || cleanup(); + } + cleanup = function() { + cleanup = null; + stream.removeListener('data', onData); + stream.removeListener('error', onError); + stream.removeListener('end', onEnd); + stream.removeListener('finish', onEnd); + stream.removeListener('close', onEnd); + }; + stream.on('data', onData); + stream.on('error', onError); + stream.on('end', onEnd); + stream.on('finish', onEnd); + stream.on('close', onEnd); + function getNext() { + return new Promise(function(resolve, reject) { + if (error) return reject(error); + if (data.length) return resolve({ + value: data.shift(), + done: false + }); + if (done) return resolve({ + value: undefined, + done: true + }); + waiting.push([ + resolve, + reject + ]); + }); + } + const iterator = { + next () { + return getNext(); + } + }; + if (hasIterator) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; +}; /* c8 ignore stop */ diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs.map b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs.map new file mode 100644 index 0000000..b357c89 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/nodeStream.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["nodeStream.ts"],"sourcesContent":["import { Readable as NodeReadableStream } from 'stream';\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function nodeStreamIterator(stream: NodeReadableStream): AsyncIterableIterator {\n let cleanup = null;\n let error = null;\n let done = false;\n const data = [];\n const waiting = [];\n\n function onData(chunk) {\n if (error) return;\n if (waiting.length) return waiting.shift()[0]({ value: chunk, done: false });\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n\n cleanup = function () {\n cleanup = null;\n stream.removeListener('data', onData);\n stream.removeListener('error', onError);\n stream.removeListener('end', onEnd);\n stream.removeListener('finish', onEnd);\n stream.removeListener('close', onEnd);\n };\n stream.on('data', onData);\n stream.on('error', onError);\n stream.on('end', onEnd);\n stream.on('finish', onEnd);\n stream.on('close', onEnd);\n\n function getNext(): Promise> {\n return new Promise(function (resolve, reject) {\n if (error) return reject(error);\n if (data.length) return resolve({ value: data.shift(), done: false });\n if (done) return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n\n const iterator = {\n next(): Promise> {\n return getNext();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n"],"names":["hasIterator","Symbol","asyncIterator","nodeStreamIterator","stream","cleanup","error","done","data","waiting","onData","chunk","length","shift","value","push","onError","err","all","slice","forEach","pair","onEnd","undefined","removeListener","on","getNext","Promise","resolve","reject","iterator","next"],"mappings":"AAEA,MAAMA,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,aAAa,AAAC;AAE1E,qBAAqB,CACrB,eAAe,SAASC,kBAAkB,CAAIC,MAA0B,EAA4B;IAClG,IAAIC,OAAO,GAAG,IAAI,AAAC;IACnB,IAAIC,KAAK,GAAG,IAAI,AAAC;IACjB,IAAIC,IAAI,GAAG,KAAK,AAAC;IACjB,MAAMC,IAAI,GAAG,E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;CAC7C,CAAA,CACD,oBAAoB"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs new file mode 100644 index 0000000..7b072fe --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs @@ -0,0 +1,27 @@ +const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator; +/* c8 ignore start */ export default function promiseIterator(promise) { + let resolved = false; + const iterator = { + next () { + if (resolved) return Promise.resolve({ + value: undefined, + done: true + }); + resolved = true; + return new Promise(function(resolve, reject) { + promise.then(function(value) { + resolve({ + value, + done: false + }); + }).catch(reject); + }); + } + }; + if (hasIterator) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; +}; /* c8 ignore stop */ diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs.map b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs.map new file mode 100644 index 0000000..decbc60 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/promise.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["promise.ts"],"sourcesContent":["const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function promiseIterator(promise): AsyncIterableIterator {\n let resolved = false;\n\n const iterator = {\n next(): Promise> {\n if (resolved) return Promise.resolve({ value: undefined, done: true });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value, done: false });\n })\n .catch(reject);\n });\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n"],"names":["hasIterator","Symbol","asyncIterator","promiseIterator","promise","resolved","iterator","next","Promise","resolve","value","undefined","done","reject","then","catch"],"mappings":"AAAA,MAAMA,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,aAAa,AAAC;AAE1E,qBAAqB,CACrB,eAAe,SAASC,eAAe,CAAIC,OAAO,EAA4B;IAC5E,IAAIC,QAAQ,GAAG,KAAK,AAAC;IAErB,MAAMC,QAAQ,GAAG;QACfC,IAAI,IAAwC;YAC1C,IAAIF,QAAQ,EAAE,OAAOG,OAAO,CAACC,OAAO,CAAC;gBAAEC,KAAK,EAAEC,SAAS;gBAAEC,IAAI,EAAE,IAAI;aAAE,CAAC,CAAC;YACvEP,QAAQ,GAAG,IAAI,CAAC;YAChB,OAAO,IAAIG,OAAO,CAAC,SAAUC,OAAO,EAAEI,MAAM,EAAE;gBAC5CT,OAAO,CACJU,IAAI,CAAC,SAAUJ,KAAK,EAAE;oBACrBD,OAAO,CAAC;wBAAEC,KAAK;wBAAEE,IAAI,EAAE,KAAK;qBAAE,CAAC,CAAC;iBACjC,CAAC,CACDG,KAAK,CAACF,MAAM,CAAC,CAAC;aAClB,CAAC,CAAC;SACJ;KACF,AAAC;IAEF,IAAIb,WAAW,EAAE;QACfM,QAAQ,CAACL,MAAM,CAACC,aAAa,CAAC,GAAG,WAA8B;YAC7D,OAAO,IAAI,CAAC;SACb,CAAC;KACH;IAED,OAAOI,QAAQ,CAA6B;CAC7C,CAAA,CACD,oBAAoB"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs new file mode 100644 index 0000000..b440435 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs @@ -0,0 +1,14 @@ +const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator; +/* c8 ignore start */ export default function readerIterator(reader) { + const iterator = { + next () { + return reader.read(); + } + }; + if (hasIterator) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; +}; /* c8 ignore stop */ diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs.map b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs.map new file mode 100644 index 0000000..68856ba --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/iterators/reader.mjs.map @@ -0,0 +1 @@ +{"version":3,"sources":["reader.ts"],"sourcesContent":["const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function readerIterator(reader): AsyncIterableIterator {\n const iterator = {\n next(): Promise> {\n return reader.read();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n"],"names":["hasIterator","Symbol","asyncIterator","readerIterator","reader","iterator","next","read"],"mappings":"AAAA,MAAMA,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,aAAa,AAAC;AAE1E,qBAAqB,CACrB,eAAe,SAASC,cAAc,CAAIC,MAAM,EAA4B;IAC1E,MAAMC,QAAQ,GAAG;QACfC,IAAI,IAAwC;YAC1C,OAAOF,MAAM,CAACG,IAAI,EAAE,CAAC;SACtB;KACF,AAAC;IAEF,IAAIP,WAAW,EAAE;QACfK,QAAQ,CAACJ,MAAM,CAACC,aAAa,CAAC,GAAG,WAA8B;YAC7D,OAAO,IAAI,CAAC;SACb,CAAC;KACH;IAED,OAAOG,QAAQ,CAA6B;CAC7C,CAAA,CACD,oBAAoB"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/esm/package.json b/graphql-subscription/node_modules/response-iterator/dist/esm/package.json new file mode 100644 index 0000000..bb34440 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/esm/package.json @@ -0,0 +1 @@ +{ "type": "module" } \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/types/async.d.ts b/graphql-subscription/node_modules/response-iterator/dist/types/async.d.ts new file mode 100644 index 0000000..12704ec --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/types/async.d.ts @@ -0,0 +1 @@ +export default function asyncIterator(source: any): AsyncIterableIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/types/index.d.ts b/graphql-subscription/node_modules/response-iterator/dist/types/index.d.ts new file mode 100644 index 0000000..11ee47d --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/types/index.d.ts @@ -0,0 +1,4 @@ +/** + * @param response A response. Supports fetch, node-fetch, and cross-fetch + */ +export default function responseIterator(response: unknown): AsyncIterableIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/types/nodeStream.d.ts b/graphql-subscription/node_modules/response-iterator/dist/types/nodeStream.d.ts new file mode 100644 index 0000000..5418f87 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/types/nodeStream.d.ts @@ -0,0 +1,3 @@ +/// +import { Readable as NodeReadableStream } from 'stream'; +export default function nodeStreamIterator(stream: NodeReadableStream): AsyncIterableIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/types/promise.d.ts b/graphql-subscription/node_modules/response-iterator/dist/types/promise.d.ts new file mode 100644 index 0000000..abec44a --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/types/promise.d.ts @@ -0,0 +1 @@ +export default function promiseIterator(promise: any): AsyncIterableIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/types/reader.d.ts b/graphql-subscription/node_modules/response-iterator/dist/types/reader.d.ts new file mode 100644 index 0000000..60c8f02 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/types/reader.d.ts @@ -0,0 +1 @@ +export default function readerIterator(reader: any): AsyncIterableIterator; diff --git a/graphql-subscription/node_modules/response-iterator/dist/umd/package.json b/graphql-subscription/node_modules/response-iterator/dist/umd/package.json new file mode 100644 index 0000000..6acf458 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/umd/package.json @@ -0,0 +1 @@ +{ "type": "commonjs" } \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js new file mode 100644 index 0000000..a873d97 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js @@ -0,0 +1,174 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.responseIterator = factory()); +})(this, (function () { 'use strict'; + + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function asyncIterator(source) { + var iterator = source[Symbol.asyncIterator](); + return _defineProperty({ + next: function next() { + return iterator.next(); + } + }, Symbol.asyncIterator, function() { + return this; + }); + } + + var hasIterator$3 = typeof Symbol !== "undefined" && Symbol.asyncIterator; + /* c8 ignore start */ function nodeStreamIterator(stream) { + var onData = function onData(chunk) { + if (error) return; + if (waiting.length) return waiting.shift()[0]({ + value: chunk, + done: false + }); + data.push(chunk); + }; + var onError = function onError(err) { + error = err; + var all = waiting.slice(); + all.forEach(function(pair) { + pair[1](err); + }); + !cleanup || cleanup(); + }; + var onEnd = function onEnd() { + done = true; + var all = waiting.slice(); + all.forEach(function(pair) { + pair[0]({ + value: undefined, + done: true + }); + }); + !cleanup || cleanup(); + }; + var getNext = function getNext() { + return new Promise(function(resolve, reject) { + if (error) return reject(error); + if (data.length) return resolve({ + value: data.shift(), + done: false + }); + if (done) return resolve({ + value: undefined, + done: true + }); + waiting.push([ + resolve, + reject + ]); + }); + }; + var cleanup = null; + var error = null; + var done = false; + var data = []; + var waiting = []; + cleanup = function() { + cleanup = null; + stream.removeListener("data", onData); + stream.removeListener("error", onError); + stream.removeListener("end", onEnd); + stream.removeListener("finish", onEnd); + stream.removeListener("close", onEnd); + }; + stream.on("data", onData); + stream.on("error", onError); + stream.on("end", onEnd); + stream.on("finish", onEnd); + stream.on("close", onEnd); + var iterator = { + next: function next() { + return getNext(); + } + }; + if (hasIterator$3) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; + } + + var hasIterator$2 = typeof Symbol !== "undefined" && Symbol.asyncIterator; + /* c8 ignore start */ function promiseIterator(promise) { + var resolved = false; + var iterator = { + next: function next() { + if (resolved) return Promise.resolve({ + value: undefined, + done: true + }); + resolved = true; + return new Promise(function(resolve, reject) { + promise.then(function(value) { + resolve({ + value: value, + done: false + }); + }).catch(reject); + }); + } + }; + if (hasIterator$2) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; + } + + var hasIterator$1 = typeof Symbol !== "undefined" && Symbol.asyncIterator; + /* c8 ignore start */ function readerIterator(reader) { + var iterator = { + next: function next() { + return reader.read(); + } + }; + if (hasIterator$1) { + iterator[Symbol.asyncIterator] = function() { + return this; + }; + } + return iterator; + } + + // @ts-ignore + var hasIterator = typeof Symbol !== "undefined" && Symbol.asyncIterator; + /** + * @param response A response. Supports fetch, node-fetch, and cross-fetch + */ function responseIterator(response) { + if (response === undefined) throw new Error("Missing response for responseIterator"); + // determine the body + var body = response; + if (response.body) body = response.body; + else if (response.data) body = response.data; + else if (response._bodyBlob) body = response._bodyBlob; // cross-fetch + /* c8 ignore stop */ // adapt the body + if (hasIterator && body[Symbol.asyncIterator]) return asyncIterator(body); + /* c8 ignore start */ if (body.getReader) return readerIterator(body.getReader()); + if (body.stream) return readerIterator(body.stream().getReader()); + if (body.arrayBuffer) return promiseIterator(body.arrayBuffer()); + if (body.pipe) return nodeStreamIterator(body); + /* c8 ignore stop */ throw new Error("Unknown body type for responseIterator. Maybe you are not passing a streamable response"); + } + + return responseIterator; + +})); +//# sourceMappingURL=response-iterator.js.map diff --git a/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js.map b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js.map new file mode 100644 index 0000000..7b897b6 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"response-iterator.js","sources":["../../src/iterators/async.ts","../../src/iterators/nodeStream.ts","../../src/iterators/promise.ts","../../src/iterators/reader.ts","../../src/index.ts"],"sourcesContent":["export default function asyncIterator(source): AsyncIterableIterator {\n const iterator = source[Symbol.asyncIterator]();\n return {\n next(): Promise> {\n return iterator.next();\n },\n [Symbol.asyncIterator](): AsyncIterator {\n return this;\n },\n } as AsyncIterableIterator;\n}\n","import { Readable as NodeReadableStream } from 'stream';\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function nodeStreamIterator(stream: NodeReadableStream): AsyncIterableIterator {\n let cleanup = null;\n let error = null;\n let done = false;\n const data = [];\n const waiting = [];\n\n function onData(chunk) {\n if (error) return;\n if (waiting.length) return waiting.shift()[0]({ value: chunk, done: false });\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n\n cleanup = function () {\n cleanup = null;\n stream.removeListener('data', onData);\n stream.removeListener('error', onError);\n stream.removeListener('end', onEnd);\n stream.removeListener('finish', onEnd);\n stream.removeListener('close', onEnd);\n };\n stream.on('data', onData);\n stream.on('error', onError);\n stream.on('end', onEnd);\n stream.on('finish', onEnd);\n stream.on('close', onEnd);\n\n function getNext(): Promise> {\n return new Promise(function (resolve, reject) {\n if (error) return reject(error);\n if (data.length) return resolve({ value: data.shift(), done: false });\n if (done) return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n\n const iterator = {\n next(): Promise> {\n return getNext();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n","const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function promiseIterator(promise): AsyncIterableIterator {\n let resolved = false;\n\n const iterator = {\n next(): Promise> {\n if (resolved) return Promise.resolve({ value: undefined, done: true });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value, done: false });\n })\n .catch(reject);\n });\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n","const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function readerIterator(reader): AsyncIterableIterator {\n const iterator = {\n next(): Promise> {\n return reader.read();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n","import { AxiosResponse } from 'axios';\nimport { Response as NodeResponse } from 'node-fetch';\nimport { Readable as NodeReadableStream } from 'stream';\n\n// @ts-ignore\nimport asyncIterator from './iterators/async.ts';\n// @ts-ignore\nimport nodeStreamIterator from './iterators/nodeStream.ts';\n// @ts-ignore\nimport promiseIterator from './iterators/promise.ts';\n// @ts-ignore\nimport readerIterator from './iterators/reader.ts';\n\ninterface CrossFetchResponse {\n _bodyBlob: Blob;\n}\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/**\n * @param response A response. Supports fetch, node-fetch, and cross-fetch\n */\nexport default function responseIterator(response: unknown): AsyncIterableIterator {\n if (response === undefined) throw new Error('Missing response for responseIterator');\n\n // determine the body\n let body: unknown = response;\n if ((response as NodeResponse).body) body = (response as NodeResponse).body;\n // node-fetch, browser fetch, undici\n else if ((response as AxiosResponse).data) body = (response as AxiosResponse).data;\n // axios\n /* c8 ignore start */ else if ((response as CrossFetchResponse)._bodyBlob) body = (response as CrossFetchResponse)._bodyBlob; // cross-fetch\n /* c8 ignore stop */\n\n // adapt the body\n if (hasIterator && body[Symbol.asyncIterator]) return asyncIterator(body as AsyncIterableIterator);\n /* c8 ignore start */\n if ((body as ReadableStream).getReader) return readerIterator((body as ReadableStream).getReader());\n if ((body as Blob).stream) return readerIterator(((body as Blob).stream() as unknown as ReadableStream).getReader());\n if ((body as Blob).arrayBuffer) return promiseIterator((body as Blob).arrayBuffer());\n if ((body as NodeReadableStream).pipe) return nodeStreamIterator(body as NodeReadableStream);\n /* c8 ignore stop */\n\n throw new Error('Unknown body type for responseIterator. Maybe you are not passing a streamable response');\n}\n"],"names":["asyncIterator","source","iterator","Symbol","next","hasIterator","nodeStreamIterator","stream","onData","chunk","error","waiting","length","shift","value","done","data","push","onError","err","all","slice","forEach","pair","cleanup","onEnd","undefined","getNext","Promise","resolve","reject","removeListener","on","promiseIterator","promise","resolved","then","catch","readerIterator","reader","read","responseIterator","response","Error","body","_bodyBlob","getReader","arrayBuffer","pipe"],"mappings":";;;;;;EAAA,SAAA,eAAA,CAAA,GAAA,EAAA,GAAA,EAAA,KAAA,EAAA;;;;;;;;;;;;;EAAe,SAASA,aAAa,CAAIC,MAAM,EAA4B;MACzE,IAAMC,QAAQ,GAAGD,MAAM,CAACE,MAAM,CAACH,aAAa,CAAC,EAAE,CAAC;MAChD,OAIE,eAAA,CAAA;UAHAI,IAAI,EAAJA,SAAAA,IAAI,GAAwC;EAC1C,YAAA,OAAOF,QAAQ,CAACE,IAAI,EAAE,CAAC;EACxB,SAAA;SACAD,MAAM,CAACH,aAAa,EAArB,WAA2C;EACzC,QAAA,OAAO,IAAI,CAAC;EACb,KAAA,CAAA,CAC2B;;;ECPhC,IAAMK,aAAW,GAAG,OAAOF,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACH,aAAa,CAAC;EAE1E,sBACe,SAASM,kBAAkB,CAAIC,MAA0B,EAA4B;EAOzFC,IAAAA,IAAAA,MAAM,GAAf,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;EAExD,SAAA,IAAI,QAAS,CAAwB6B,SAAS,EAAED,IAAI,GAAIF,QAAQ,CAAwBG,SAAS,CAAC;EAC7H;EAGA,IAAA,IAAIxC,WAAW,IAAIuC,IAAI,CAACzC,MAAM,CAACH,aAAa,CAAC,EAAE,OAAOA,aAAa,CAAI4C,IAAI,CAA6B,CAAC;EACzG,0BACA,IAAKA,IAAI,CAAuBE,SAAS,EAAE,OAAOR,cAAc,CAAI,IAAK,CAAuBQ,SAAS,EAAE,CAAC,CAAC;EAC7G,IAAA,IAAI,IAAK,CAAUvC,MAAM,EAAE,OAAO+B,cAAc,CAAK,IAAK,CAAU/B,MAAM,EAAE,CAAkCuC,SAAS,EAAE,CAAC,CAAC;EAC3H,IAAA,IAAI,IAAK,CAAUC,WAAW,EAAE,OAAOd,eAAe,CAAKW,IAAI,CAAUG,WAAW,EAAE,CAAC,CAAC;MACxF,IAAKH,IAAI,CAAwBI,IAAI,EAAE,OAAO1C,kBAAkB,CAAIsC,IAAI,CAAuB,CAAC;EAChG,yBAEA,MAAM,IAAID,KAAK,CAAC,yFAAyF,CAAC,CAAC;;;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js new file mode 100644 index 0000000..1031350 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js @@ -0,0 +1,2 @@ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).responseIterator=n()}(this,(function(){"use strict";function e(e){var n,r,o,t=e[Symbol.asyncIterator]();return n={next:function(){return t.next()}},r=Symbol.asyncIterator,o=function(){return this},r in n?Object.defineProperty(n,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[r]=o,n}var n="undefined"!=typeof Symbol&&Symbol.asyncIterator;function r(e){var r=function(e){if(!a)return s.length?s.shift()[0]({value:e,done:!1}):void f.push(e)},o=function(e){a=e,s.slice().forEach((function(n){n[1](e)})),!i||i()},t=function(){u=!0,s.slice().forEach((function(e){e[0]({value:void 0,done:!0})})),!i||i()},i=null,a=null,u=!1,f=[],s=[];i=function(){i=null,e.removeListener("data",r),e.removeListener("error",o),e.removeListener("end",t),e.removeListener("finish",t),e.removeListener("close",t)},e.on("data",r),e.on("error",o),e.on("end",t),e.on("finish",t),e.on("close",t);var l={next:function(){return new Promise((function(e,n){return a?n(a):f.length?e({value:f.shift(),done:!1}):u?e({value:void 0,done:!0}):void s.push([e,n])}))}};return n&&(l[Symbol.asyncIterator]=function(){return this}),l}var o="undefined"!=typeof Symbol&&Symbol.asyncIterator;var t="undefined"!=typeof Symbol&&Symbol.asyncIterator;function i(e){var n={next:function(){return e.read()}};return t&&(n[Symbol.asyncIterator]=function(){return this}),n}var a="undefined"!=typeof Symbol&&Symbol.asyncIterator;return function(n){if(void 0===n)throw new Error("Missing response for responseIterator");var t,u,f,s=n;if(n.body?s=n.body:n.data?s=n.data:n._bodyBlob&&(s=n._bodyBlob),a&&s[Symbol.asyncIterator])return e(s);if(s.getReader)return i(s.getReader());if(s.stream)return i(s.stream().getReader());if(s.arrayBuffer)return t=s.arrayBuffer(),u=!1,f={next:function(){return u?Promise.resolve({value:void 0,done:!0}):(u=!0,new Promise((function(e,n){t.then((function(n){e({value:n,done:!1})})).catch(n)})))}},o&&(f[Symbol.asyncIterator]=function(){return this}),f;if(s.pipe)return r(s);throw new Error("Unknown body type for responseIterator. Maybe you are not passing a streamable response")}})); +//# sourceMappingURL=response-iterator.min.js.map diff --git a/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js.map b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js.map new file mode 100644 index 0000000..4f4cf7e --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/dist/umd/response-iterator.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"response-iterator.min.js","sources":["../../src/iterators/async.ts","../../src/iterators/nodeStream.ts","../../src/iterators/promise.ts","../../src/iterators/reader.ts","../../src/index.ts"],"sourcesContent":["export default function asyncIterator(source): AsyncIterableIterator {\n const iterator = source[Symbol.asyncIterator]();\n return {\n next(): Promise> {\n return iterator.next();\n },\n [Symbol.asyncIterator](): AsyncIterator {\n return this;\n },\n } as AsyncIterableIterator;\n}\n","import { Readable as NodeReadableStream } from 'stream';\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function nodeStreamIterator(stream: NodeReadableStream): AsyncIterableIterator {\n let cleanup = null;\n let error = null;\n let done = false;\n const data = [];\n const waiting = [];\n\n function onData(chunk) {\n if (error) return;\n if (waiting.length) return waiting.shift()[0]({ value: chunk, done: false });\n data.push(chunk);\n }\n function onError(err) {\n error = err;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[1](err);\n });\n !cleanup || cleanup();\n }\n function onEnd() {\n done = true;\n const all = waiting.slice();\n all.forEach(function (pair) {\n pair[0]({ value: undefined, done: true });\n });\n !cleanup || cleanup();\n }\n\n cleanup = function () {\n cleanup = null;\n stream.removeListener('data', onData);\n stream.removeListener('error', onError);\n stream.removeListener('end', onEnd);\n stream.removeListener('finish', onEnd);\n stream.removeListener('close', onEnd);\n };\n stream.on('data', onData);\n stream.on('error', onError);\n stream.on('end', onEnd);\n stream.on('finish', onEnd);\n stream.on('close', onEnd);\n\n function getNext(): Promise> {\n return new Promise(function (resolve, reject) {\n if (error) return reject(error);\n if (data.length) return resolve({ value: data.shift(), done: false });\n if (done) return resolve({ value: undefined, done: true });\n waiting.push([resolve, reject]);\n });\n }\n\n const iterator = {\n next(): Promise> {\n return getNext();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n","const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function promiseIterator(promise): AsyncIterableIterator {\n let resolved = false;\n\n const iterator = {\n next(): Promise> {\n if (resolved) return Promise.resolve({ value: undefined, done: true });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value, done: false });\n })\n .catch(reject);\n });\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n","const hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/* c8 ignore start */\nexport default function readerIterator(reader): AsyncIterableIterator {\n const iterator = {\n next(): Promise> {\n return reader.read();\n },\n };\n\n if (hasIterator) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator;\n}\n/* c8 ignore stop */\n","import { AxiosResponse } from 'axios';\nimport { Response as NodeResponse } from 'node-fetch';\nimport { Readable as NodeReadableStream } from 'stream';\n\n// @ts-ignore\nimport asyncIterator from './iterators/async.ts';\n// @ts-ignore\nimport nodeStreamIterator from './iterators/nodeStream.ts';\n// @ts-ignore\nimport promiseIterator from './iterators/promise.ts';\n// @ts-ignore\nimport readerIterator from './iterators/reader.ts';\n\ninterface CrossFetchResponse {\n _bodyBlob: Blob;\n}\n\nconst hasIterator = typeof Symbol !== 'undefined' && Symbol.asyncIterator;\n\n/**\n * @param response A response. Supports fetch, node-fetch, and cross-fetch\n */\nexport default function responseIterator(response: unknown): AsyncIterableIterator {\n if (response === undefined) throw new Error('Missing response for responseIterator');\n\n // determine the body\n let body: unknown = response;\n if ((response as NodeResponse).body) body = (response as NodeResponse).body;\n // node-fetch, browser fetch, undici\n else if ((response as AxiosResponse).data) body = (response as AxiosResponse).data;\n // axios\n /* c8 ignore start */ else if ((response as CrossFetchResponse)._bodyBlob) body = (response as CrossFetchResponse)._bodyBlob; // cross-fetch\n /* c8 ignore stop */\n\n // adapt the body\n if (hasIterator && body[Symbol.asyncIterator]) return asyncIterator(body as AsyncIterableIterator);\n /* c8 ignore start */\n if ((body as ReadableStream).getReader) return readerIterator((body as ReadableStream).getReader());\n if ((body as Blob).stream) return readerIterator(((body as Blob).stream() as unknown as ReadableStream).getReader());\n if ((body as Blob).arrayBuffer) return promiseIterator((body as Blob).arrayBuffer());\n if ((body as NodeReadableStream).pipe) return nodeStreamIterator(body as NodeReadableStream);\n /* c8 ignore stop */\n\n throw new Error('Unknown body type for responseIterator. Maybe you are not passing a streamable response');\n}\n"],"names":["asyncIterator","source","obj","key","value","iterator","Symbol","next","this","hasIterator","nodeStreamIterator","stream","onData","chunk","error","waiting","length","shift","done","data","push","onError","err","slice","forEach","pair","cleanup","onEnd","undefined","removeListener","on","Promise","resolve","reject","readerIterator","reader","read","response","Error","promise","resolved","body","_bodyBlob","getReader","arrayBuffer","then","catch","pipe"],"mappings":"iPAAe,SAASA,EAAiBC,GACvC,IADFC,EAAAC,EAAAC,EACQC,EAAWJ,EAAOK,OAAON,iBAC/B,OAFFE,EAMI,CAHAK,KAAAA,WACE,OAAOF,EAASE,SAJtBJ,EAMKG,OAAON,cANZI,EAMI,WACE,OAAOI,qGCLb,IAAMC,EAAgC,oBAAXH,QAA0BA,OAAON,cAG7C,SAASU,EAAsBC,GAOnCC,IAAAA,EAAT,SAAgBC,GACd,IAAIC,EACJ,OAAIC,EAAQC,OAAeD,EAAQE,QAAQ,GAAG,CAAEb,MAAOS,EAAOK,MAAM,SACpEC,EAAKC,KAAKP,IAEHQ,EAAT,SAAiBC,GACfR,EAAQQ,EACIP,EAAQQ,QAChBC,SAAQ,SAAUC,GACpBA,EAAK,GAAGH,OAETI,GAAWA,KAELC,EAAT,WACET,GAAO,EACKH,EAAQQ,QAChBC,SAAQ,SAAUC,GACpBA,EAAK,GAAG,CAAErB,WAAOwB,EAAWV,MAAM,QAEnCQ,GAAWA,KAzBVA,EAAU,KACVZ,EAAQ,KACRI,GAAO,EACLC,EAAO,GACPJ,E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A,EAA2BE,UAAW,OAAOT,EAAkBO,EAA4BE,aAChG,GAAIF,EAAe9B,OAAQ,OAAOuB,EAAmBO,EAAe9B,SAA0CgC,aAC9G,GAAIF,EAAeG,YAAa,OFpCSL,EEoCkBE,EAAcG,cFnCrEJ,GAAW,EAETnC,EAAW,CACfE,KAAAA,WACE,OAAIiC,EAAiBT,QAAQC,QAAQ,CAAE5B,WAAOwB,EAAWV,MAAM,KAC/DsB,GAAW,EACJ,IAAIT,SAAQ,SAAUC,EAASC,GACpCM,EACGM,MAAK,SAAUzC,GACd4B,EAAQ,CAAE5B,MAAAA,EAAOc,MAAM,OAExB4B,MAAMb,SAKXxB,IACFJ,EAASC,OAAON,eAAiB,WAC/B,OAAOQ,OAIJH,EEcP,GAAKoC,EAA4BM,KAAM,OAAOrC,EAAsB+B,GAGpE,MAAM,IAAIH,MAAM"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/response-iterator/package.json b/graphql-subscription/node_modules/response-iterator/package.json new file mode 100644 index 0000000..91528a6 --- /dev/null +++ b/graphql-subscription/node_modules/response-iterator/package.json @@ -0,0 +1,83 @@ +{ + "name": "response-iterator", + "description": "Creates an async iterator for a variety of inputs in the browser and node. Supports fetch, node-fetch, and cross-fetch", + "version": "0.2.6", + "author": { + "email": "kmalakoff@gmail.com", + "name": "Kevin Malakoff", + "url": "https://github.com/kmalakoff" + }, + "license": "MIT", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.mjs", + "files": [ + "dist" + ], + "scripts": { + "build": "tsds build", + "deploy": "tsds deploy", + "format": "tsds format", + "lint": "tsds lint", + "test": "tsds test:node && tsds test:node \"test/**/*.test-node.*\" && tsds test:browser" + }, + "homepage": "https://github.com/kmalakoff/response-iterator#README.md", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/kmalakoff/response-iterator.git" + }, + "bugs": { + "url": "https://github.com/kmalakoff/response-iterator/issues" + }, + "keywords": [ + "Symbol", + "Symbol.asyncIterator", + "array", + "arrayBuffer", + "asyncIterator", + "axios", + "blob", + "body", + "browser", + "cross-fetch", + "fetch", + "got", + "isomorphic-fetch", + "iteration", + "iterator", + "node", + "node-fetch", + "response", + "stream", + "typescript", + "undici" + ], + "devDependencies": { + "@types/axios": "^0.14.0", + "@types/node": "^18.0.1", + "@types/node-fetch": "^3.0.3", + "cross-fetch": "^3.1.5", + "got": "^12.1.0", + "isomorphic-fetch": "^3.0.0", + "readable-stream-2": "npm:readable-stream@2.3.7", + "readable-stream-3": "npm:readable-stream@4.0.0", + "ts-dev-stack": "^0.6.5", + "undici": "^5.6.0" + }, + "type": "module", + "engines": { + "node": ">=0.8" + }, + "exports": { + ".": { + "import": "./dist/esm/index.mjs", + "require": "./dist/cjs/index.js", + "types": "./dist/types/index.d.ts" + }, + "./*": "./*" + }, + "tsds": { + "source": "src/index.ts" + }, + "types": "dist/types/index.d.ts", + "unpkg": "dist/umd/response-iterator.js" +} diff --git a/graphql-subscription/node_modules/symbol-observable/CHANGELOG.md b/graphql-subscription/node_modules/symbol-observable/CHANGELOG.md new file mode 100644 index 0000000..168dd88 --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/CHANGELOG.md @@ -0,0 +1,177 @@ +# [4.0.0](https://github.com/blesh/symbol-observable/compare/3.0.0...4.0.0) (2021-04-15) + + +### Bug Fixes + +* If Symbol.for doesn't exist, just use Symbol ([ef81924](https://github.com/blesh/symbol-observable/commit/ef81924c506ba2fcc171a9b9b78a7a290fbff7b2)), closes [#53](https://github.com/blesh/symbol-observable/issues/53) + + +### Code Refactoring + +* Revert to `symbol` from `unique symbol`, the latter caused compatibility issues and provided no real benefit. ([72ce7dc](https://github.com/blesh/symbol-observable/commit/72ce7dcc5d22f8a67ec928b61e879e1ded7a0869)) + + +### BREAKING CHANGES + +* Following the advice of the TypeScript team, the type for `Symbol.observable` is reverted back to `symbol` from `unique symbol`. This is to improve compatibility with other libraries using this module. Sincerely sorry for the trashing. Getting the types right for modules is hard. If this continues to cause issues for you, please file an issue with the [TypeScript project](https://github.com/microsoft/typescript). + + + +# [3.0.0](https://github.com/blesh/symbol-observable/compare/2.0.3...3.0.0) (2020-11-02) + + +### Bug Fixes + +* **TypeScript:** `Symbol.observable` is now `unique symbol`. ([2ef1476](https://github.com/blesh/symbol-observable/commit/2ef147644cf78538b28c3fd9e66a3b8d569a1978)), closes [#41](https://github.com/blesh/symbol-observable/issues/41) +* **TypeScript:** `Symbol[Symbol.observable]` is no longer incorrectly defined ([fe4301f](https://github.com/blesh/symbol-observable/commit/fe4301f37b54162e1a2db91e79c5b33d652496f1)) + + +### BREAKING CHANGES + +* **TypeScript:** Older versions of `@types/node` will clash with this, because `@types/node` incorrectly defined `Symbol.observable` has `symbol` and not `unique symbol`. Update to `@types/node@14.14.6` or higher. + + + +## [2.0.3](https://github.com/blesh/symbol-observable/compare/2.0.2...2.0.3) (2020-09-30) + +### Bug Fixes + +- **package.json** ponyfill.d.ts added to package ([b25f5bf](https://github.com/blesh/symbol-observable/commit/b25f5bfe7425ad21f510428795de8b38aee70b2e)) + +## [2.0.2](https://github.com/blesh/symbol-observable/compare/2.0.1...2.0.2) (2020-09-29) + +### Bug Fixes + +- **TypeScript** ponyfill types added ([10d2ec8](https://github.com/blesh/symbol-observable/commit/10d2ec8f0809ac9134be91378fc45c3578f675d4)) + +## [2.0.1](https://github.com/blesh/symbol-observable/compare/2.0.0...2.0.1) (2020-09-04) + +### Bug Fixes + +- **package.json:** es/ponyfill.js no longer typoed ([ad2c079](https://github.com/blesh/symbol-observable/commit/ad2c079c71536eaf972101a25eb18f5bca94ab62)) +- Resolve issues in environments with frozen Symbol ([2323882](https://github.com/blesh/symbol-observable/commit/23238827ea234188b11774f43afcb5c8deeb278e)) + +# [2.0.0](https://github.com/blesh/symbol-observable/compare/1.2.0...2.0.0) (2020-09-01) + +### Bug Fixes + +- Resolve issues in environments with frozen Symbol ([2323882](https://github.com/blesh/symbol-observable/commit/23238827ea234188b11774f43afcb5c8deeb278e)) + +**BREAKING CHANGE**: This moves to using `Symbol.for` to create the symbol instance. It's _possible_ that some runtimes that support `Symbol` do not support `Symbol.for`. Therefor, I'm marking this as a breaking change. If you find that you hit this issue, please report it. You can work around it by polyfilling `Symbol.for`. + + + +# [1.2.0](https://github.com/blesh/symbol-observable/compare/1.1.0...v1.2.0) (2018-01-26) + +### Bug Fixes + +- **TypeScript:** Remove global Symbol declaration ([427c3d7](https://github.com/blesh/symbol-observable/commit/427c3d7)) +- common js usage example (#30) ([42c2ffa](https://github.com/blesh/symbol-observable/commit/42c2ffa)) + +### Features + +- **bundlers:** Add module and main entries in package.json (#33) ([97673e1](https://github.com/blesh/symbol-observable/commit/97673e1)) + + + +# [1.1.0](https://github.com/blesh/symbol-observable/compare/1.0.4...v1.1.0) (2017-11-28) + +### Bug Fixes + +- **TypeScript:** update TS to 2.0, fix typings ([e08474e](https://github.com/blesh/symbol-observable/commit/e08474e)), closes [#27](https://github.com/blesh/symbol-observable/issues/27) + +### Features + +- **browser:** Fully qualified import for native esm browser support (#31) ([8ae5f8e](https://github.com/blesh/symbol-observable/commit/8ae5f8e)) +- **index.d.ts:** add type info to Symbol.observable ([e4be157](https://github.com/blesh/symbol-observable/commit/e4be157)) + + + +## [1.0.4](https://github.com/blesh/symbol-observable/compare/1.0.3...v1.0.4) (2016-10-13) + +### Bug Fixes + +- **global:** global variable location no longer assumes `module` exists ([4f85ede](https://github.com/blesh/symbol-observable/commit/4f85ede)), closes [#24](https://github.com/blesh/symbol-observable/issues/24) + + + +## [1.0.3](https://github.com/blesh/symbol-observable/compare/1.0.2...v1.0.3) (2016-10-11) + +### Bug Fixes + +- **mozilla addons support:** fix obtaining global object (#23) ([38da34d](https://github.com/blesh/symbol-observable/commit/38da34d)), closes [#23](https://github.com/blesh/symbol-observable/issues/23) + + + +## [1.0.2](https://github.com/blesh/symbol-observable/compare/1.0.1...v1.0.2) (2016-08-09) + +### Bug Fixes + +- **ECMAScript 3**: ensure output is ES3 compatible ([3f37af3](https://github.com/blesh/symbol-observable/commit/3f37af3)) + + + +## [1.0.1](https://github.com/blesh/symbol-observable/compare/1.0.0...v1.0.1) (2016-06-15) + +### Bug Fixes + +- **bundlers:** fix issue that caused some bundlers not to be able to locate `/lib` (#19) ([dd8fdfe](https://github.com/blesh/symbol-observable/commit/dd8fdfe)), closes [(#19](https://github.com/(/issues/19) [#17](https://github.com/blesh/symbol-observable/issues/17) + + + +# [1.0.0](https://github.com/blesh/symbol-observable/compare/0.2.4...v1.0.0) (2016-06-13) + +### Bug Fixes + +- **index.js:** use typeof to check for global or window definitions (#8) ([5f4c2c6](https://github.com/blesh/symbol-observable/commit/5f4c2c6)) +- **types:** use default syntax for typedef ([240e3a6](https://github.com/blesh/symbol-observable/commit/240e3a6)) +- **TypeScript:** exported ponyfill now works with TypeScript ([c0b894e](https://github.com/blesh/symbol-observable/commit/c0b894e)) + +### Features + +- **es2015:** add es2015 implementation to support rollup (#10) ([7a41de9](https://github.com/blesh/symbol-observable/commit/7a41de9)) + +### BREAKING CHANGES + +- TypeScript: CJS users will now have to `require('symbol-observable').default` rather than just `require('symbol-observable')` this was done to better support ES6 module bundlers. + + + +## [0.2.4](https://github.com/blesh/symbol-observable/compare/0.2.2...v0.2.4) (2016-04-25) + +### Bug Fixes + +- **IE8 support:** Ensure ES3 support so IE8 is happy ([9aaa7c3](https://github.com/blesh/symbol-observable/commit/9aaa7c3)) +- **Symbol.observable:** should NOT equal `Symbol.for('observable')`. ([3b0fdee](https://github.com/blesh/symbol-observable/commit/3b0fdee)), closes [#7](https://github.com/blesh/symbol-observable/issues/7) + + + +## [0.2.3](https://github.com/blesh/symbol-observable/compare/0.2.3...v0.2.3) (2016-04-24) + +### Bug Fixes + +- **IE8/ECMAScript 3**: Make sure legacy browsers don't choke on a property named `for`. ([9aaa7c](https://github.com/blesh/symbol-observable/9aaa7c)) + + + +## [0.2.2](https://github.com/sindresorhus/symbol-observable/compare/0.2.1...v0.2.2) (2016-04-19) + +### Features + +- **TypeScript:** add TypeScript typings file ([befd7a](https://github.com/sindresorhus/symbol-observable/commit/befd7a)) + + + +## [0.2.1](https://github.com/sindresorhus/symbol-observable/compare/0.2.0...v0.2.1) (2016-04-19) + +### Bug Fixes + +- **publish:** publish all required files ([5f26c3a](https://github.com/sindresorhus/symbol-observable/commit/5f26c3a)) + + + +# [0.2.0](https://github.com/sindresorhus/symbol-observable/compare/v0.1.0...v0.2.0) (2016-04-19) + +### Bug Fixes + +- **Symbol.observable:** ensure Symbol.for(\'observable\') matches Symbol.observable ([ada343f](https://github.com/sindresorhus/symbol-observable/commit/ada343f)), closes [#1](https://github.com/sindresorhus/symbol-observable/issues/1) [#2](https://github.com/sindresorhus/symbol-observable/issues/2) diff --git a/graphql-subscription/node_modules/symbol-observable/README.md b/graphql-subscription/node_modules/symbol-observable/README.md new file mode 100644 index 0000000..cd93e4c --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/README.md @@ -0,0 +1,70 @@ +# symbol-observable [![Build Status](https://travis-ci.org/benlesh/symbol-observable.svg?branch=master)](https://travis-ci.org/benlesh/symbol-observable) + +> [`Symbol.observable`](https://github.com/zenparsing/es-observable) [pony/polyfill](https://ponyfill.com) + +This will polyfill `Symbol.observable` if `Symbol` exists, but will not polyfill `Symbol` if it doesn't exist. Meant to be used as a "ponyfill", meaning you're meant to use the module's exported symbol value as described below. This is all done to ensure that everyone is using the same version of the symbol (or string depending on the environment), as per the nature of symbols in JavaScript. + + +## Install + +``` +$ npm install --save symbol-observable +``` + + +## Basic Usage + +```js +const symbolObservable = require('symbol-observable').default; + +console.log(symbolObservable); +//=> Symbol(observable) +``` + +```ts +import Symbol_observable from 'symbol-observable'; + +console.log(Symbol_observable); +//=> Symbol(observable) +``` + +## Making an object "observable": + +You can do something like what you see below to make any object "observable" by libraries like RxJS, XStream and Most.js. + +Things to know: + +1. It's best if you just use one of the above libraries. +2. If you're not, but sure you never `next`, `error` or `complete` on your observer after `error` or `complete` was called. +3. Likewise, make sure you don't `next`, `error` or `complete` after `unsubscribe` is called on the returned object. + +```ts +import Symbol_observable from 'symbol-observable'; + +someObject[Symbol_observable] = () => { + return { + subscribe(observer) { + const handler = e => observer.next(e); + someObject.addEventListener('data', handler); + return { + unsubscribe() { + someObject.removeEventListener('data', handler); + } + } + }, + [Symbol_observable]() { return this } + } +} +``` + +Often, it's not very hard, but it can get tricky in some cases. + +## Related + +- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable +- [observable-to-promise](https://github.com/sindresorhus/observable-to-promise) - Convert an Observable to a Promise + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) and [Ben Lesh](https://github.com/benlesh) diff --git a/graphql-subscription/node_modules/symbol-observable/es/index.js b/graphql-subscription/node_modules/symbol-observable/es/index.js new file mode 100644 index 0000000..4ed892d --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/es/index.js @@ -0,0 +1,19 @@ +/* global window */ +import ponyfill from './ponyfill.js'; + +var root; + +if (typeof self !== 'undefined') { + root = self; +} else if (typeof window !== 'undefined') { + root = window; +} else if (typeof global !== 'undefined') { + root = global; +} else if (typeof module !== 'undefined') { + root = module; +} else { + root = Function('return this')(); +} + +var result = ponyfill(root); +export default result; diff --git a/graphql-subscription/node_modules/symbol-observable/es/ponyfill.js b/graphql-subscription/node_modules/symbol-observable/es/ponyfill.js new file mode 100644 index 0000000..7f2cd0e --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/es/ponyfill.js @@ -0,0 +1,34 @@ +export default function symbolObservablePonyfill(root) { + var result; + var Symbol = root.Symbol; + + if (typeof Symbol === 'function') { + if (Symbol.observable) { + result = Symbol.observable; + } else { + + if (typeof Symbol.for === 'function') { + // This just needs to be something that won't trample other user's Symbol.for use + // It also will guide people to the source of their issues, if this is problematic. + // META: It's a resource locator! + result = Symbol.for('https://github.com/benlesh/symbol-observable'); + } else { + // Symbol.for didn't exist! The best we can do at this point is a totally + // unique symbol. Note that the string argument here is a descriptor, not + // an identifier. This symbol is unique. + result = Symbol('https://github.com/benlesh/symbol-observable'); + } + try { + Symbol.observable = result; + } catch (err) { + // Do nothing. In some environments, users have frozen `Symbol` for security reasons, + // if it is frozen assigning to it will throw. In this case, we don't care, because + // they will need to use the returned value from the ponyfill. + } + } + } else { + result = '@@observable'; + } + + return result; +}; diff --git a/graphql-subscription/node_modules/symbol-observable/index.d.ts b/graphql-subscription/node_modules/symbol-observable/index.d.ts new file mode 100644 index 0000000..c74bade --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/index.d.ts @@ -0,0 +1,8 @@ +declare const observableSymbol: symbol; +export default observableSymbol; + +declare global { + export interface SymbolConstructor { + readonly observable: symbol; + } +} diff --git a/graphql-subscription/node_modules/symbol-observable/index.js b/graphql-subscription/node_modules/symbol-observable/index.js new file mode 100644 index 0000000..b58e228 --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/index'); diff --git a/graphql-subscription/node_modules/symbol-observable/lib/index.js b/graphql-subscription/node_modules/symbol-observable/lib/index.js new file mode 100644 index 0000000..de74e78 --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/lib/index.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _ponyfill = require('./ponyfill.js'); + +var _ponyfill2 = _interopRequireDefault(_ponyfill); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var root; /* global window */ + + +if (typeof self !== 'undefined') { + root = self; +} else if (typeof window !== 'undefined') { + root = window; +} else if (typeof global !== 'undefined') { + root = global; +} else if (typeof module !== 'undefined') { + root = module; +} else { + root = Function('return this')(); +} + +var result = (0, _ponyfill2['default'])(root); +exports['default'] = result; \ No newline at end of file diff --git a/graphql-subscription/node_modules/symbol-observable/lib/ponyfill.js b/graphql-subscription/node_modules/symbol-observable/lib/ponyfill.js new file mode 100644 index 0000000..19e2dbd --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/lib/ponyfill.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports['default'] = symbolObservablePonyfill; +function symbolObservablePonyfill(root) { + var result; + var _Symbol = root.Symbol; + + if (typeof _Symbol === 'function') { + if (_Symbol.observable) { + result = _Symbol.observable; + } else { + + if (typeof _Symbol['for'] === 'function') { + // This just needs to be something that won't trample other user's Symbol.for use + // It also will guide people to the source of their issues, if this is problematic. + // META: It's a resource locator! + result = _Symbol['for']('https://github.com/benlesh/symbol-observable'); + } else { + // Symbol.for didn't exist! The best we can do at this point is a totally + // unique symbol. Note that the string argument here is a descriptor, not + // an identifier. This symbol is unique. + result = _Symbol('https://github.com/benlesh/symbol-observable'); + } + try { + _Symbol.observable = result; + } catch (err) { + // Do nothing. In some environments, users have frozen `Symbol` for security reasons, + // if it is frozen assigning to it will throw. In this case, we don't care, because + // they will need to use the returned value from the ponyfill. + } + } + } else { + result = '@@observable'; + } + + return result; +}; \ No newline at end of file diff --git a/graphql-subscription/node_modules/symbol-observable/license b/graphql-subscription/node_modules/symbol-observable/license new file mode 100644 index 0000000..b07f7a8 --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/license @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2021 Sindre Sorhus (sindresorhus.com) +Copyright (c) 2021 Ben Lesh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/graphql-subscription/node_modules/symbol-observable/package.json b/graphql-subscription/node_modules/symbol-observable/package.json new file mode 100644 index 0000000..bd03d4f --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/package.json @@ -0,0 +1,50 @@ +{ + "name": "symbol-observable", + "version": "4.0.0", + "description": "Symbol.observable ponyfill", + "license": "MIT", + "repository": "blesh/symbol-observable", + "author": { + "name": "Ben Lesh", + "email": "ben@benlesh.com" + }, + "scripts": { + "test": "npm run build && mocha && tsc && node ./ts-test/test.js && check-es3-syntax -p lib/ --kill", + "build": "babel es --out-dir lib", + "prepublish": "npm test" + }, + "files": [ + "index.js", + "ponyfill.js", + "index.d.ts", + "ponyfill.d.ts", + "es/index.js", + "es/ponyfill.js", + "lib/index.js", + "lib/ponyfill.js" + ], + "main": "lib/index.js", + "module": "es/index.js", + "jsnext:main": "es/index.js", + "typings": "index.d.ts", + "keywords": [ + "symbol", + "observable", + "observables", + "ponyfill", + "polyfill", + "shim" + ], + "devDependencies": { + "babel-cli": "^6.9.0", + "babel-preset-es2015": "^6.9.0", + "babel-preset-es3": "^1.0.0", + "chai": "^3.5.0", + "check-es3-syntax-cli": "^0.1.0", + "mocha": "^2.4.5", + "typescript": "^4.0.5" + }, + "engines": { + "node": ">=0.10" + } +} diff --git a/graphql-subscription/node_modules/symbol-observable/ponyfill.d.ts b/graphql-subscription/node_modules/symbol-observable/ponyfill.d.ts new file mode 100644 index 0000000..8ca8852 --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/ponyfill.d.ts @@ -0,0 +1,2 @@ +declare const makeObservableSymbol : (root : object) => symbol; +export default makeObservableSymbol; diff --git a/graphql-subscription/node_modules/symbol-observable/ponyfill.js b/graphql-subscription/node_modules/symbol-observable/ponyfill.js new file mode 100644 index 0000000..94a400c --- /dev/null +++ b/graphql-subscription/node_modules/symbol-observable/ponyfill.js @@ -0,0 +1 @@ +module.exports = require('./lib/ponyfill'); diff --git a/graphql-subscription/node_modules/ts-invariant/LICENSE b/graphql-subscription/node_modules/ts-invariant/LICENSE new file mode 100644 index 0000000..3033d00 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Apollo GraphQL + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/ts-invariant/README.md b/graphql-subscription/node_modules/ts-invariant/README.md new file mode 100644 index 0000000..dab53aa --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/README.md @@ -0,0 +1,19 @@ +# ts-invariant + +[TypeScript](https://www.typescriptlang.org) implementation of +[`invariant(condition, message)`](https://www.npmjs.com/package/invariant). + +Supports `invariant.log`, `invariant.warn`, and `invariant.error`, which +wrap `console` methods of the same name, and may be stripped in production +by [`rollup-plugin-invariant`](../../archived/rollup-plugin-invariant). + +The verbosity of these methods can be globally reconfigured using the +`setVerbosity` function: +```ts +import { setVerbosity } from "ts-invariant"; + +setVerbosity("log"); // display all messages (default) +setVerbosity("warn"); // display only warnings and errors +setVerbosity("error"); // display only errors +setVerbosity("silent"); // display no messages +``` diff --git a/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs b/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs new file mode 100644 index 0000000..658056a --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); + +var genericMessage = "Invariant Violation"; +var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { + obj.__proto__ = proto; + return obj; +} : _a; +var InvariantError = /** @class */ (function (_super) { + tslib.__extends(InvariantError, _super); + function InvariantError(message) { + if (message === void 0) { message = genericMessage; } + var _this = _super.call(this, typeof message === "number" + ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" + : message) || this; + _this.framesToPop = 1; + _this.name = genericMessage; + setPrototypeOf(_this, InvariantError.prototype); + return _this; + } + return InvariantError; +}(Error)); +function invariant(condition, message) { + if (!condition) { + throw new InvariantError(message); + } +} +var verbosityLevels = ["debug", "log", "warn", "error", "silent"]; +var verbosityLevel = verbosityLevels.indexOf("log"); +function wrapConsoleMethod(name) { + return function () { + if (verbosityLevels.indexOf(name) >= verbosityLevel) { + // Default to console.log if this host environment happens not to provide + // all the console.* methods we need. + var method = console[name] || console.log; + return method.apply(console, arguments); + } + }; +} +(function (invariant) { + invariant.debug = wrapConsoleMethod("debug"); + invariant.log = wrapConsoleMethod("log"); + invariant.warn = wrapConsoleMethod("warn"); + invariant.error = wrapConsoleMethod("error"); +})(invariant || (invariant = {})); +function setVerbosity(level) { + var old = verbosityLevels[verbosityLevel]; + verbosityLevel = Math.max(0, verbosityLevels.indexOf(level)); + return old; +} +var invariant$1 = invariant; + +exports.InvariantError = InvariantError; +exports["default"] = invariant$1; +exports.invariant = invariant; +exports.setVerbosity = setVerbosity; +//# sourceMappingURL=invariant.cjs.map diff --git a/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.map b/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.map new file mode 100644 index 0000000..4654c34 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"invariant.cjs","sources":["invariant.js"],"sourcesContent":["import { __extends } from \"tslib\";\nvar genericMessage = \"Invariant Violation\";\nvar _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) {\n obj.__proto__ = proto;\n return obj;\n} : _a;\nvar InvariantError = /** @class */ (function (_super) {\n __extends(InvariantError, _super);\n function InvariantError(message) {\n if (message === void 0) { message = genericMessage; }\n var _this = _super.call(this, typeof message === \"number\"\n ? genericMessage + \": \" + message + \" (see https://github.com/apollographql/invariant-packages)\"\n : message) || this;\n _this.framesToPop = 1;\n _this.name = genericMessage;\n setPrototypeOf(_this, InvariantError.prototype);\n return _this;\n }\n return InvariantError;\n}(Error));\nexport { InvariantError };\nexport function invariant(condition, message) {\n if (!condition) {\n throw new InvariantError(message);\n }\n}\nvar verbosityLevels = [\"debug\", \"log\", \"warn\", \"error\", \"silent\"];\nvar verbosityLevel = verbosityLevels.indexOf(\"log\");\nfunction wrapConsoleMethod(name) {\n return function () {\n if (verbosityLevels.indexOf(name) >= verbosityLevel) {\n // Default to console.log if this host environment happens not to provide\n // all the console.* methods we need.\n var method = console[name] || console.log;\n return method.apply(console, arguments);\n }\n };\n}\n(function (invariant) {\n invariant.debug = wrapConsoleMethod(\"debug\");\n invariant.log = wrapConsoleMethod(\"log\");\n invariant.warn = wrapConsoleMethod(\"warn\");\n invariant.error = wrapConsoleMethod(\"error\");\n})(invariant || (invariant = {}));\nexport function setVerbosity(level) {\n var old = verbosityLevels[verbosityLevel];\n verbosityLevel = Math.max(0, verbosityLevels.indexOf(level));\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AO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAClE,IAAI,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACpD,SAAS,iBAAiB,CAAC,IAAI,EAAE;AACjC,IAAI,OAAO,YAAY;AACvB,QAAQ,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,cAAc,EAAE;AAC7D;AACA;AACA,YAAY,IAAI,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC;AACtD,YAAY,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACpD,SAAS;AACT,KAAK,CAAC;AACN,CAAC;AACD,CAAC,UAAU,SAAS,EAAE;AACtB,IAAI,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACjD,IAAI,SAAS,CAAC,GAAG,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAC7C,IAAI,SAAS,CAAC,IAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAC/C,IAAI,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC,EAAE,SAAS,KAAK,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3B,SAAS,YAAY,CAAC,KAAK,EAAE;AACpC,IAAI,IAAI,GAAG,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;AAC9C,IAAI,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AACjE,IAAI,OAAO,GAAG,CAAC;AACf,CAAC;AACD,kBAAe,SAAS;;;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.native.js b/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.native.js new file mode 100644 index 0000000..658056a --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/lib/invariant.cjs.native.js @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var tslib = require('tslib'); + +var genericMessage = "Invariant Violation"; +var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { + obj.__proto__ = proto; + return obj; +} : _a; +var InvariantError = /** @class */ (function (_super) { + tslib.__extends(InvariantError, _super); + function InvariantError(message) { + if (message === void 0) { message = genericMessage; } + var _this = _super.call(this, typeof message === "number" + ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" + : message) || this; + _this.framesToPop = 1; + _this.name = genericMessage; + setPrototypeOf(_this, InvariantError.prototype); + return _this; + } + return InvariantError; +}(Error)); +function invariant(condition, message) { + if (!condition) { + throw new InvariantError(message); + } +} +var verbosityLevels = ["debug", "log", "warn", "error", "silent"]; +var verbosityLevel = verbosityLevels.indexOf("log"); +function wrapConsoleMethod(name) { + return function () { + if (verbosityLevels.indexOf(name) >= verbosityLevel) { + // Default to console.log if this host environment happens not to provide + // all the console.* methods we need. + var method = console[name] || console.log; + return method.apply(console, arguments); + } + }; +} +(function (invariant) { + invariant.debug = wrapConsoleMethod("debug"); + invariant.log = wrapConsoleMethod("log"); + invariant.warn = wrapConsoleMethod("warn"); + invariant.error = wrapConsoleMethod("error"); +})(invariant || (invariant = {})); +function setVerbosity(level) { + var old = verbosityLevels[verbosityLevel]; + verbosityLevel = Math.max(0, verbosityLevels.indexOf(level)); + return old; +} +var invariant$1 = invariant; + +exports.InvariantError = InvariantError; +exports["default"] = invariant$1; +exports.invariant = invariant; +exports.setVerbosity = setVerbosity; +//# sourceMappingURL=invariant.cjs.map diff --git a/graphql-subscription/node_modules/ts-invariant/lib/invariant.d.ts b/graphql-subscription/node_modules/ts-invariant/lib/invariant.d.ts new file mode 100644 index 0000000..47ecf6c --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/lib/invariant.d.ts @@ -0,0 +1,29 @@ +export declare class InvariantError extends Error { + framesToPop: number; + name: string; + constructor(message?: string | number); +} +export declare function invariant(condition: any, message?: string | number): asserts condition; +declare const verbosityLevels: readonly ["debug", "log", "warn", "error", "silent"]; +export declare type VerbosityLevel = (typeof verbosityLevels)[number]; +export declare type ConsoleMethodName = Exclude; +export declare namespace invariant { + const debug: { + (...data: any[]): void; + (message?: any, ...optionalParams: any[]): void; + }; + const log: { + (...data: any[]): void; + (message?: any, ...optionalParams: any[]): void; + }; + const warn: { + (...data: any[]): void; + (message?: any, ...optionalParams: any[]): void; + }; + const error: { + (...data: any[]): void; + (message?: any, ...optionalParams: any[]): void; + }; +} +export declare function setVerbosity(level: VerbosityLevel): VerbosityLevel; +export default invariant; diff --git a/graphql-subscription/node_modules/ts-invariant/lib/invariant.js b/graphql-subscription/node_modules/ts-invariant/lib/invariant.js new file mode 100644 index 0000000..3eba55d --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/lib/invariant.js @@ -0,0 +1,51 @@ +import { __extends } from "tslib"; +var genericMessage = "Invariant Violation"; +var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { + obj.__proto__ = proto; + return obj; +} : _a; +var InvariantError = /** @class */ (function (_super) { + __extends(InvariantError, _super); + function InvariantError(message) { + if (message === void 0) { message = genericMessage; } + var _this = _super.call(this, typeof message === "number" + ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" + : message) || this; + _this.framesToPop = 1; + _this.name = genericMessage; + setPrototypeOf(_this, InvariantError.prototype); + return _this; + } + return InvariantError; +}(Error)); +export { InvariantError }; +export function invariant(condition, message) { + if (!condition) { + throw new InvariantError(message); + } +} +var verbosityLevels = ["debug", "log", "warn", "error", "silent"]; +var verbosityLevel = verbosityLevels.indexOf("log"); +function wrapConsoleMethod(name) { + return function () { + if (verbosityLevels.indexOf(name) >= verbosityLevel) { + // Default to console.log if this host environment happens not to provide + // all the console.* methods we need. + var method = console[name] || console.log; + return method.apply(console, arguments); + } + }; +} +(function (invariant) { + invariant.debug = wrapConsoleMethod("debug"); + invariant.log = wrapConsoleMethod("log"); + invariant.warn = wrapConsoleMethod("warn"); + invariant.error = wrapConsoleMethod("error"); +})(invariant || (invariant = {})); +export function setVerbosity(level) { + var old = verbosityLevels[verbosityLevel]; + verbosityLevel = Math.max(0, verbosityLevels.indexOf(level)); + return old; +} +export default invariant; +//# sourceMappingURL=invariant.js.map \ No newline at end of file diff --git a/graphql-subscription/node_modules/ts-invariant/lib/invariant.js.map b/graphql-subscription/node_modules/ts-invariant/lib/invariant.js.map new file mode 100644 index 0000000..9109221 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/lib/invariant.js.map @@ -0,0 +1 @@ +{"version":3,"file":"invariant.js","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":";AAAA,IAAM,cAAc,GAAG,qBAAqB,CAAC;AAE3C,IAAA,KAIE,MAAa,eADd,EAHD,cAAc,mBAAG,UAAU,GAAQ,EAAE,KAAU;IAC7C,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,GAAG,CAAC;AACb,CAAC,KAAA,CACe;AAElB;IAAoC,kCAAK;IAGvC,wBAAY,OAAyC;QAAzC,wBAAA,EAAA,wBAAyC;QAArD,YACE,kBACE,OAAO,OAAO,KAAK,QAAQ;YACzB,CAAC,CAAI,cAAc,UAAK,OAAO,+DAA4D;YAC3F,CAAC,CAAC,OAAO,CACZ,SAEF;QATD,iBAAW,GAAG,CAAC,CAAC;QAChB,UAAI,GAAG,cAAc,CAAC;QAOpB,cAAc,CAAC,KAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;;IACjD,CAAC;IACH,qBAAC;AAAD,CAAC,AAXD,CAAoC,KAAK,GAWxC;;AAED,MAAM,UAAU,SAAS,CACvB,SAAc,EACd,OAAyB;IAEzB,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;KACnC;AACH,CAAC;AAED,IAAM,eAAe,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAG7E,IAAI,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEpD,SAAS,iBAAiB,CAA8B,IAAO;IAC7D,OAAO;QACL,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,cAAc,EAAE;YACnD,yEAAyE;YACzE,qCAAqC;YACrC,IAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC;YAC5C,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,SAAgB,CAAC,CAAC;SAChD;IACH,CAAwB,CAAC;AAC3B,CAAC;AAED,WAAiB,SAAS;IACX,eAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,aAAG,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC/B,cAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjC,eAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC,EALgB,SAAS,KAAT,SAAS,QAKzB;AAED,MAAM,UAAU,YAAY,CAAC,KAAqB;IAChD,IAAM,GAAG,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAC5C,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe,SAAS,CAAC","sourcesContent":["const genericMessage = \"Invariant Violation\";\nconst {\n setPrototypeOf = function (obj: any, proto: any) {\n obj.__proto__ = proto;\n return obj;\n },\n} = Object as any;\n\nexport class InvariantError extends Error {\n framesToPop = 1;\n name = genericMessage;\n constructor(message: string | number = genericMessage) {\n super(\n typeof message === \"number\"\n ? `${genericMessage}: ${message} (see https://github.com/apollographql/invariant-packages)`\n : message\n );\n setPrototypeOf(this, InvariantError.prototype);\n }\n}\n\nexport function invariant(\n condition: any,\n message?: string | number,\n): asserts condition {\n if (!condition) {\n throw new InvariantError(message);\n }\n}\n\nconst verbosityLevels = [\"debug\", \"log\", \"warn\", \"error\", \"silent\"] as const;\nexport type VerbosityLevel = (typeof verbosityLevels)[number];\nexport type ConsoleMethodName = Exclude;\nlet verbosityLevel = verbosityLevels.indexOf(\"log\");\n\nfunction wrapConsoleMethod(name: M) {\n return function () {\n if (verbosityLevels.indexOf(name) >= verbosityLevel) {\n // Default to console.log if this host environment happens not to provide\n // all the console.* methods we need.\n const method = console[name] || console.log;\n return method.apply(console, arguments as any);\n }\n } as (typeof console)[M];\n}\n\nexport namespace invariant {\n export const debug = wrapConsoleMethod(\"debug\");\n export const log = wrapConsoleMethod(\"log\");\n export const warn = wrapConsoleMethod(\"warn\");\n export const error = wrapConsoleMethod(\"error\");\n}\n\nexport function setVerbosity(level: VerbosityLevel): VerbosityLevel {\n const old = verbosityLevels[verbosityLevel];\n verbosityLevel = Math.max(0, verbosityLevels.indexOf(level));\n return old;\n}\n\nexport default invariant;\n"]} \ No newline at end of file diff --git a/graphql-subscription/node_modules/ts-invariant/package.json b/graphql-subscription/node_modules/ts-invariant/package.json new file mode 100644 index 0000000..cee57c7 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/package.json @@ -0,0 +1,47 @@ +{ + "name": "ts-invariant", + "version": "0.10.3", + "author": "Ben Newman ", + "description": "TypeScript implementation of invariant(condition, message)", + "license": "MIT", + "type": "module", + "main": "lib/invariant.cjs", + "module": "lib/invariant.js", + "types": "lib/invariant.d.ts", + "keywords": [ + "invariant", + "assertion", + "precondition", + "TypeScript" + ], + "homepage": "https://github.com/apollographql/invariant-packages", + "repository": { + "type": "git", + "url": "git+https://github.com/apollographql/invariant-packages.git" + }, + "bugs": { + "url": "https://github.com/apollographql/invariant-packages/issues" + }, + "scripts": { + "build": "npm run tsc && npm run rollup", + "tsc": "../../node_modules/.bin/tsc", + "rollup": "../../node_modules/.bin/rollup -c", + "prepare": "npm run build", + "mocha": "npm run mocha:esm && npm run mocha:cjs", + "mocha:esm": "../../node_modules/.bin/mocha --reporter spec --full-trace lib/tests.js", + "mocha:cjs": "../../node_modules/.bin/mocha --reporter spec --full-trace lib/tests.bundle.cjs", + "test": "npm run build && npm run mocha && npm run test:no-node", + "test:no-node": "! grep -i node lib/invariant.d.ts" + }, + "dependencies": { + "tslib": "^2.1.0" + }, + "devDependencies": { + "@types/invariant": "^2.2.29", + "invariant": "^2.2.4" + }, + "engines": { + "node": ">=8" + }, + "gitHead": "c8a2d6d2e839e9bdc595ae5fd2a50331b2b01014" +} diff --git a/graphql-subscription/node_modules/ts-invariant/process/index.d.ts b/graphql-subscription/node_modules/ts-invariant/process/index.d.ts new file mode 100644 index 0000000..7693d8f --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/process/index.d.ts @@ -0,0 +1,2 @@ +export declare function install(): void; +export declare function remove(): void; diff --git a/graphql-subscription/node_modules/ts-invariant/process/index.js b/graphql-subscription/node_modules/ts-invariant/process/index.js new file mode 100644 index 0000000..a3f507c --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/process/index.js @@ -0,0 +1,52 @@ +function maybe(thunk) { + try { return thunk() } catch (_) {} +} + +var safeGlobal = ( + maybe(function() { return globalThis }) || + maybe(function() { return window }) || + maybe(function() { return self }) || + maybe(function() { return global }) || + // We don't expect the Function constructor ever to be invoked at runtime, as + // long as at least one of globalThis, window, self, or global is defined, so + // we are under no obligation to make it easy for static analysis tools to + // detect syntactic usage of the Function constructor. If you think you can + // improve your static analysis to detect this obfuscation, think again. This + // is an arms race you cannot win, at least not in JavaScript. + maybe(function() { return maybe.constructor("return this")() }) +); + +var needToRemove = false; + +export function install() { + if (safeGlobal && + !maybe(function() { return process.env.NODE_ENV }) && + !maybe(function() { return process })) { + Object.defineProperty(safeGlobal, "process", { + value: { + env: { + // This default needs to be "production" instead of "development", to + // avoid the problem https://github.com/graphql/graphql-js/pull/2894 + // will eventually solve, once merged and released. + NODE_ENV: "production", + }, + }, + // Let anyone else change global.process as they see fit, but hide it from + // Object.keys(global) enumeration. + configurable: true, + enumerable: false, + writable: true, + }); + needToRemove = true; + } +} + +// Call install() at least once, when this module is imported. +install(); + +export function remove() { + if (needToRemove) { + delete safeGlobal.process; + needToRemove = false; + } +} diff --git a/graphql-subscription/node_modules/ts-invariant/process/main.cjs b/graphql-subscription/node_modules/ts-invariant/process/main.cjs new file mode 100644 index 0000000..3935e1f --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/process/main.cjs @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function maybe(thunk) { + try { return thunk() } catch (_) {} +} + +var safeGlobal = ( + maybe(function() { return globalThis }) || + maybe(function() { return window }) || + maybe(function() { return self }) || + maybe(function() { return global }) || + // We don't expect the Function constructor ever to be invoked at runtime, as + // long as at least one of globalThis, window, self, or global is defined, so + // we are under no obligation to make it easy for static analysis tools to + // detect syntactic usage of the Function constructor. If you think you can + // improve your static analysis to detect this obfuscation, think again. This + // is an arms race you cannot win, at least not in JavaScript. + maybe(function() { return maybe.constructor("return this")() }) +); + +var needToRemove = false; + +function install() { + if (safeGlobal && + !maybe(function() { return process.env.NODE_ENV }) && + !maybe(function() { return process })) { + Object.defineProperty(safeGlobal, "process", { + value: { + env: { + // This default needs to be "production" instead of "development", to + // avoid the problem https://github.com/graphql/graphql-js/pull/2894 + // will eventually solve, once merged and released. + NODE_ENV: "production", + }, + }, + // Let anyone else change global.process as they see fit, but hide it from + // Object.keys(global) enumeration. + configurable: true, + enumerable: false, + writable: true, + }); + needToRemove = true; + } +} + +// Call install() at least once, when this module is imported. +install(); + +function remove() { + if (needToRemove) { + delete safeGlobal.process; + needToRemove = false; + } +} + +exports.install = install; +exports.remove = remove; +//# sourceMappingURL=main.cjs.map diff --git a/graphql-subscription/node_modules/ts-invariant/process/main.cjs.map b/graphql-subscription/node_modules/ts-invariant/process/main.cjs.map new file mode 100644 index 0000000..4b1e683 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/process/main.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"main.cjs","sources":["index.js"],"sourcesContent":["function maybe(thunk) {\n try { return thunk() } catch (_) {}\n}\n\nvar safeGlobal = (\n maybe(function() { return globalThis }) ||\n maybe(function() { return window }) ||\n maybe(function() { return self }) ||\n maybe(function() { return global }) ||\n // We don't expect the Function constructor ever to be invoked at runtime, as\n // long as at least one of globalThis, window, self, or global is defined, so\n // we are under no obligation to make it easy for static analysis tools to\n // detect syntactic usage of the Function constructor. If you think you can\n // improve your static analysis to detect this obfuscation, think again. This\n // is an arms race you cannot win, at least not in JavaScript.\n maybe(function() { return maybe.constructor(\"return this\")() })\n);\n\nvar needToRemove = false;\n\nexport function install() {\n if (safeGlobal &&\n !maybe(function() { return process.env.NODE_ENV }) &&\n !maybe(function() { return process })) {\n Object.defineProperty(safeGlobal, \"process\", {\n value: {\n env: {\n // This default needs to be \"production\" instead of \"development\", to\n // avoid the problem https://github.com/graphql/graphql-js/pull/2894\n // will eventually solve, once merged and released.\n NODE_ENV: \"production\",\n },\n },\n // Let anyone else change global.process as they see fit, but hide it from\n // Object.keys(global) enumeration.\n configurable: true,\n enumerable: false,\n writable: true,\n });\n needToRemove = true;\n }\n}\n\n// Call install() at least once, when this module is imported.\ninstall();\n\nexport function remove() {\n if (needToRemove) {\n delete safeGlobal.process;\n needToRemove = false;\n }\n}\n"],"names":[],"mappings":";;;;AAAA,SAAS,KAAK,CAAC,KAAK,EAAE;AACtB,EAAE,IAAI,EAAE,OAAO,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE;AACrC,CAAC;AACD;AACA,IAAI,UAAU;AACd,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,UAAU,EAAE,CAAC;AACzC,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,MAAM,EAAE,CAAC;AACrC,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,IAAI,EAAE,CAAC;AACnC,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,MAAM,EAAE,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;AACjE,CAAC,CAAC;AACF;AACA,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB;AACO,SAAS,OAAO,GAAG;AAC1B,EAAE,IAAI,UAAU;AAChB,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxD,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,OAAO,EAAE,CAAC,EAAE;AAC7C,IAAI,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE;AACjD,MAAM,KAAK,EAAE;AACb,QAAQ,GAAG,EAAE;AACb;AACA;AACA;AACA,UAAU,QAAQ,EAAE,YAAY;AAChC,SAAS;AACT,OAAO;AACP;AACA;AACA,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,UAAU,EAAE,KAAK;AACvB,MAAM,QAAQ,EAAE,IAAI;AACpB,KAAK,CAAC,CAAC;AACP,IAAI,YAAY,GAAG,IAAI,CAAC;AACxB,GAAG;AACH,CAAC;AACD;AACA;AACA,OAAO,EAAE,CAAC;AACV;AACO,SAAS,MAAM,GAAG;AACzB,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,OAAO,UAAU,CAAC,OAAO,CAAC;AAC9B,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,GAAG;AACH;;;;;"} \ No newline at end of file diff --git a/graphql-subscription/node_modules/ts-invariant/process/main.cjs.native.js b/graphql-subscription/node_modules/ts-invariant/process/main.cjs.native.js new file mode 100644 index 0000000..3935e1f --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/process/main.cjs.native.js @@ -0,0 +1,60 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function maybe(thunk) { + try { return thunk() } catch (_) {} +} + +var safeGlobal = ( + maybe(function() { return globalThis }) || + maybe(function() { return window }) || + maybe(function() { return self }) || + maybe(function() { return global }) || + // We don't expect the Function constructor ever to be invoked at runtime, as + // long as at least one of globalThis, window, self, or global is defined, so + // we are under no obligation to make it easy for static analysis tools to + // detect syntactic usage of the Function constructor. If you think you can + // improve your static analysis to detect this obfuscation, think again. This + // is an arms race you cannot win, at least not in JavaScript. + maybe(function() { return maybe.constructor("return this")() }) +); + +var needToRemove = false; + +function install() { + if (safeGlobal && + !maybe(function() { return process.env.NODE_ENV }) && + !maybe(function() { return process })) { + Object.defineProperty(safeGlobal, "process", { + value: { + env: { + // This default needs to be "production" instead of "development", to + // avoid the problem https://github.com/graphql/graphql-js/pull/2894 + // will eventually solve, once merged and released. + NODE_ENV: "production", + }, + }, + // Let anyone else change global.process as they see fit, but hide it from + // Object.keys(global) enumeration. + configurable: true, + enumerable: false, + writable: true, + }); + needToRemove = true; + } +} + +// Call install() at least once, when this module is imported. +install(); + +function remove() { + if (needToRemove) { + delete safeGlobal.process; + needToRemove = false; + } +} + +exports.install = install; +exports.remove = remove; +//# sourceMappingURL=main.cjs.map diff --git a/graphql-subscription/node_modules/ts-invariant/process/package.json b/graphql-subscription/node_modules/ts-invariant/process/package.json new file mode 100644 index 0000000..7d76fa6 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/process/package.json @@ -0,0 +1,12 @@ +{ + "name": "ts-invariant/process", + "type": "module", + "main": "./main.cjs", + "module": "./index.js", + "types": "./index.d.ts", + "sideEffects": [ + "./main.cjs", + "./main.cjs.native.js", + "./index.js" + ] +} diff --git a/graphql-subscription/node_modules/ts-invariant/rollup.config.js b/graphql-subscription/node_modules/ts-invariant/rollup.config.js new file mode 100644 index 0000000..a22d120 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/rollup.config.js @@ -0,0 +1,74 @@ +import { promises as fs } from "fs"; + +const globals = { + __proto__: null, + assert: "assert", + invariant: "reactInvariant", + tslib: "tslib", + "@ungap/global-this": "globalThisPolyfill", +}; + +function external(id) { + return id in globals; +} + +function copyPlugin() { + return { + name: "copy *.cjs to *.cjs.native.js", + async writeBundle({ file }) { + const buffer = await fs.readFile(file); + await fs.writeFile( + file + ".native.js", + buffer, + ); + }, + }; +} + +const jobs = []; +export default jobs; + +jobs.push({ + input: "lib/invariant.js", + external, + output: { + file: "lib/invariant.cjs", + format: "cjs", + exports: "named", + sourcemap: true, + name: "ts-invariant", + globals, + }, + plugins: [ + copyPlugin(), + ], +}); + +jobs.push({ + input: "lib/tests.js", + external, + output: { + file: "lib/tests.bundle.cjs", + format: "cjs", + exports: "named", + sourcemap: true, + name: "ts-invariant-tests-cjs-bundle", + globals, + }, +}); + +jobs.push({ + input: "process/index.js", + external, + output: { + file: "process/main.cjs", + format: "cjs", + exports: "named", + sourcemap: true, + name: "ts-invariant/process", + globals, + }, + plugins: [ + copyPlugin(), + ], +}); diff --git a/graphql-subscription/node_modules/ts-invariant/tsconfig.json b/graphql-subscription/node_modules/ts-invariant/tsconfig.json new file mode 100644 index 0000000..1a79ad1 --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib" + } +} diff --git a/graphql-subscription/node_modules/ts-invariant/tsconfig.rollup.json b/graphql-subscription/node_modules/ts-invariant/tsconfig.rollup.json new file mode 100644 index 0000000..02085be --- /dev/null +++ b/graphql-subscription/node_modules/ts-invariant/tsconfig.rollup.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "es2015", + }, +} diff --git a/graphql-subscription/node_modules/tslib/CopyrightNotice.txt b/graphql-subscription/node_modules/tslib/CopyrightNotice.txt new file mode 100644 index 0000000..0e42542 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/CopyrightNotice.txt @@ -0,0 +1,15 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + diff --git a/graphql-subscription/node_modules/tslib/LICENSE.txt b/graphql-subscription/node_modules/tslib/LICENSE.txt new file mode 100644 index 0000000..bfe6430 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/LICENSE.txt @@ -0,0 +1,12 @@ +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/graphql-subscription/node_modules/tslib/README.md b/graphql-subscription/node_modules/tslib/README.md new file mode 100644 index 0000000..290cc61 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/README.md @@ -0,0 +1,164 @@ +# tslib + +This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions. + +This library is primarily used by the `--importHelpers` flag in TypeScript. +When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: + +```ts +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +exports.x = {}; +exports.y = __assign({}, exports.x); + +``` + +will instead be emitted as something like the following: + +```ts +var tslib_1 = require("tslib"); +exports.x = {}; +exports.y = tslib_1.__assign({}, exports.x); +``` + +Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. +For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. + +# Installing + +For the latest stable version, run: + +## npm + +```sh +# TypeScript 3.9.2 or later +npm install tslib + +# TypeScript 3.8.4 or earlier +npm install tslib@^1 + +# TypeScript 2.3.2 or earlier +npm install tslib@1.6.1 +``` + +## yarn + +```sh +# TypeScript 3.9.2 or later +yarn add tslib + +# TypeScript 3.8.4 or earlier +yarn add tslib@^1 + +# TypeScript 2.3.2 or earlier +yarn add tslib@1.6.1 +``` + +## bower + +```sh +# TypeScript 3.9.2 or later +bower install tslib + +# TypeScript 3.8.4 or earlier +bower install tslib@^1 + +# TypeScript 2.3.2 or earlier +bower install tslib@1.6.1 +``` + +## JSPM + +```sh +# TypeScript 3.9.2 or later +jspm install tslib + +# TypeScript 3.8.4 or earlier +jspm install tslib@^1 + +# TypeScript 2.3.2 or earlier +jspm install tslib@1.6.1 +``` + +# Usage + +Set the `importHelpers` compiler option on the command line: + +``` +tsc --importHelpers file.ts +``` + +or in your tsconfig.json: + +```json +{ + "compilerOptions": { + "importHelpers": true + } +} +``` + +#### For bower and JSPM users + +You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: + +```json +{ + "compilerOptions": { + "module": "amd", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["bower_components/tslib/tslib.d.ts"] + } + } +} +``` + +For JSPM users: + +```json +{ + "compilerOptions": { + "module": "system", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"] + } + } +} +``` + +## Deployment + +- Choose your new version number +- Set it in `package.json` and `bower.json` +- Create a tag: `git tag [version]` +- Push the tag: `git push --tags` +- Create a [release in GitHub](https://github.com/microsoft/tslib/releases) +- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow + +Done. + +# Contribute + +There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. + +* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. +* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). +* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). +* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). + +# Documentation + +* [Quick tutorial](http://www.typescriptlang.org/Tutorial) +* [Programming handbook](http://www.typescriptlang.org/Handbook) +* [Homepage](http://www.typescriptlang.org/) diff --git a/graphql-subscription/node_modules/tslib/SECURITY.md b/graphql-subscription/node_modules/tslib/SECURITY.md new file mode 100644 index 0000000..869fdfe --- /dev/null +++ b/graphql-subscription/node_modules/tslib/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + diff --git a/graphql-subscription/node_modules/tslib/modules/index.d.ts b/graphql-subscription/node_modules/tslib/modules/index.d.ts new file mode 100644 index 0000000..0fedae8 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/modules/index.d.ts @@ -0,0 +1,37 @@ +// Note: named reexports are used instead of `export *` because +// TypeScript itself doesn't resolve the `export *` when checking +// if a particular helper exists. +export { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __createBinding, + __addDisposableResource, + __disposeResources, +} from '../tslib.js'; +export * as default from '../tslib.js'; diff --git a/graphql-subscription/node_modules/tslib/modules/index.js b/graphql-subscription/node_modules/tslib/modules/index.js new file mode 100644 index 0000000..af9f5ac --- /dev/null +++ b/graphql-subscription/node_modules/tslib/modules/index.js @@ -0,0 +1,68 @@ +import tslib from '../tslib.js'; +const { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +} = tslib; +export { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +}; +export default tslib; diff --git a/graphql-subscription/node_modules/tslib/modules/package.json b/graphql-subscription/node_modules/tslib/modules/package.json new file mode 100644 index 0000000..aafa0e4 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/modules/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/graphql-subscription/node_modules/tslib/package.json b/graphql-subscription/node_modules/tslib/package.json new file mode 100644 index 0000000..0a1fdec --- /dev/null +++ b/graphql-subscription/node_modules/tslib/package.json @@ -0,0 +1,47 @@ +{ + "name": "tslib", + "author": "Microsoft Corp.", + "homepage": "https://www.typescriptlang.org/", + "version": "2.6.2", + "license": "0BSD", + "description": "Runtime library for TypeScript helper functions", + "keywords": [ + "TypeScript", + "Microsoft", + "compiler", + "language", + "javascript", + "tslib", + "runtime" + ], + "bugs": { + "url": "https://github.com/Microsoft/TypeScript/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/tslib.git" + }, + "main": "tslib.js", + "module": "tslib.es6.js", + "jsnext:main": "tslib.es6.js", + "typings": "tslib.d.ts", + "sideEffects": false, + "exports": { + ".": { + "module": { + "types": "./modules/index.d.ts", + "default": "./tslib.es6.mjs" + }, + "import": { + "node": "./modules/index.js", + "default": { + "types": "./modules/index.d.ts", + "default": "./tslib.es6.mjs" + } + }, + "default": "./tslib.js" + }, + "./*": "./*", + "./": "./" + } +} diff --git a/graphql-subscription/node_modules/tslib/tslib.d.ts b/graphql-subscription/node_modules/tslib/tslib.d.ts new file mode 100644 index 0000000..104369b --- /dev/null +++ b/graphql-subscription/node_modules/tslib/tslib.d.ts @@ -0,0 +1,453 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * Used to shim class extends. + * + * @param d The derived class. + * @param b The base class. + */ +export declare function __extends(d: Function, b: Function): void; + +/** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * + * @param t The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ +export declare function __assign(t: any, ...sources: any[]): any; + +/** + * Performs a rest spread on an object. + * + * @param t The source value. + * @param propertyNames The property names excluded from the rest spread. + */ +export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; + +/** + * Applies decorators to a target object + * + * @param decorators The set of decorators to apply. + * @param target The target object. + * @param key If specified, the own property to apply the decorators to. + * @param desc The property descriptor, defaults to fetching the descriptor from the target object. + * @experimental + */ +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; + +/** + * Creates an observing function decorator from a parameter decorator. + * + * @param paramIndex The parameter index to apply the decorator to. + * @param decorator The parameter decorator to apply. Note that the return value is ignored. + * @experimental + */ +export declare function __param(paramIndex: number, decorator: Function): Function; + +/** + * Applies decorators to a class or class member, following the native ECMAScript decorator specification. + * @param ctor For non-field class members, the class constructor. Otherwise, `null`. + * @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`. + * @param decorators The decorators to apply + * @param contextIn The `DecoratorContext` to clone for each decorator application. + * @param initializers An array of field initializer mutation functions into which new initializers are written. + * @param extraInitializers An array of extra initializer functions into which new initializers are written. + */ +export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void; + +/** + * Runs field initializers or extra initializers generated by `__esDecorate`. + * @param thisArg The `this` argument to use. + * @param initializers The array of initializers to evaluate. + * @param value The initial value to pass to the initializers. + */ +export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any; + +/** + * Converts a computed property name into a `string` or `symbol` value. + */ +export declare function __propKey(x: any): string | symbol; + +/** + * Assigns the name of a function derived from the left-hand side of an assignment. + * @param f The function to rename. + * @param name The new name for the function. + * @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name. + */ +export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function; + +/** + * Creates a decorator that sets metadata. + * + * @param metadataKey The metadata key + * @param metadataValue The metadata value + * @experimental + */ +export declare function __metadata(metadataKey: any, metadataValue: any): Function; + +/** + * Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`. + * + * @param thisArg The reference to use as the `this` value in the generator function + * @param _arguments The optional arguments array + * @param P The optional promise constructor argument, defaults to the `Promise` property of the global object. + * @param generator The generator function + */ +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; + +/** + * Creates an Iterator object using the body as the implementation. + * + * @param thisArg The reference to use as the `this` value in the function + * @param body The generator state-machine based implementation. + * + * @see [./docs/generator.md] + */ +export declare function __generator(thisArg: any, body: Function): any; + +/** + * Creates bindings for all enumerable properties of `m` on `exports` + * + * @param m The source object + * @param exports The `exports` object. + */ +export declare function __exportStar(m: any, o: any): void; + +/** + * Creates a value iterator from an `Iterable` or `ArrayLike` object. + * + * @param o The object. + * @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`. + */ +export declare function __values(o: any): any; + +/** + * Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array. + * + * @param o The object to read from. + * @param n The maximum number of arguments to read, defaults to `Infinity`. + */ +export declare function __read(o: any, n?: number): any[]; + +/** + * Creates an array from iterable spread. + * + * @param args The Iterable objects to spread. + * @deprecated since TypeScript 4.2 - Use `__spreadArray` + */ +export declare function __spread(...args: any[][]): any[]; + +/** + * Creates an array from array spread. + * + * @param args The ArrayLikes to spread into the resulting array. + * @deprecated since TypeScript 4.2 - Use `__spreadArray` + */ +export declare function __spreadArrays(...args: any[][]): any[]; + +/** + * Spreads the `from` array into the `to` array. + * + * @param pack Replace empty elements with `undefined`. + */ +export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[]; + +/** + * Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded, + * and instead should be awaited and the resulting value passed back to the generator. + * + * @param v The value to await. + */ +export declare function __await(v: any): any; + +/** + * Converts a generator function into an async generator function, by using `yield __await` + * in place of normal `await`. + * + * @param thisArg The reference to use as the `this` value in the generator function + * @param _arguments The optional arguments array + * @param generator The generator function + */ +export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; + +/** + * Used to wrap a potentially async iterator in such a way so that it wraps the result + * of calling iterator methods of `o` in `__await` instances, and then yields the awaited values. + * + * @param o The potentially async iterator. + * @returns A synchronous iterator yielding `__await` instances on every odd invocation + * and returning the awaited `IteratorResult` passed to `next` every even invocation. + */ +export declare function __asyncDelegator(o: any): any; + +/** + * Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object. + * + * @param o The object. + * @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`. + */ +export declare function __asyncValues(o: any): any; + +/** + * Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays. + * + * @param cooked The cooked possibly-sparse array. + * @param raw The raw string content. + */ +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; + +/** + * Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS. + * + * ```js + * import Default, { Named, Other } from "mod"; + * // or + * import { default as Default, Named, Other } from "mod"; + * ``` + * + * @param mod The CommonJS module exports object. + */ +export declare function __importStar(mod: T): T; + +/** + * Used to shim default imports in ECMAScript Modules transpiled to CommonJS. + * + * ```js + * import Default from "mod"; + * ``` + * + * @param mod The CommonJS module exports object. + */ +export declare function __importDefault(mod: T): T | { default: T }; + +/** + * Emulates reading a private instance field. + * + * @param receiver The instance from which to read the private field. + * @param state A WeakMap containing the private field value for an instance. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet( + receiver: T, + state: { has(o: T): boolean, get(o: T): V | undefined }, + kind?: "f" +): V; + +/** + * Emulates reading a private static field. + * + * @param receiver The object from which to read the private static field. + * @param state The class constructor containing the definition of the static field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The descriptor that holds the static field value. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet unknown, V>( + receiver: T, + state: T, + kind: "f", + f: { value: V } +): V; + +/** + * Emulates evaluating a private instance "get" accessor. + * + * @param receiver The instance on which to evaluate the private "get" accessor. + * @param state A WeakSet used to verify an instance supports the private "get" accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "get" accessor function to evaluate. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet( + receiver: T, + state: { has(o: T): boolean }, + kind: "a", + f: () => V +): V; + +/** + * Emulates evaluating a private static "get" accessor. + * + * @param receiver The object on which to evaluate the private static "get" accessor. + * @param state The class constructor containing the definition of the static "get" accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "get" accessor function to evaluate. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet unknown, V>( + receiver: T, + state: T, + kind: "a", + f: () => V +): V; + +/** + * Emulates reading a private instance method. + * + * @param receiver The instance from which to read a private method. + * @param state A WeakSet used to verify an instance supports the private method. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The function to return as the private instance method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet unknown>( + receiver: T, + state: { has(o: T): boolean }, + kind: "m", + f: V +): V; + +/** + * Emulates reading a private static method. + * + * @param receiver The object from which to read the private static method. + * @param state The class constructor containing the definition of the static method. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The function to return as the private static method. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet unknown, V extends (...args: any[]) => unknown>( + receiver: T, + state: T, + kind: "m", + f: V +): V; + +/** + * Emulates writing to a private instance field. + * + * @param receiver The instance on which to set a private field value. + * @param state A WeakMap used to store the private field value for an instance. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldSet( + receiver: T, + state: { has(o: T): boolean, set(o: T, value: V): unknown }, + value: V, + kind?: "f" +): V; + +/** + * Emulates writing to a private static field. + * + * @param receiver The object on which to set the private static field. + * @param state The class constructor containing the definition of the private static field. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The descriptor that holds the static field value. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldSet unknown, V>( + receiver: T, + state: T, + value: V, + kind: "f", + f: { value: V } +): V; + +/** + * Emulates writing to a private instance "set" accessor. + * + * @param receiver The instance on which to evaluate the private instance "set" accessor. + * @param state A WeakSet used to verify an instance supports the private "set" accessor. + * @param value The value to store in the private accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "set" accessor function to evaluate. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldSet( + receiver: T, + state: { has(o: T): boolean }, + value: V, + kind: "a", + f: (v: V) => void +): V; + +/** + * Emulates writing to a private static "set" accessor. + * + * @param receiver The object on which to evaluate the private static "set" accessor. + * @param state The class constructor containing the definition of the static "set" accessor. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "set" accessor function to evaluate. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldSet unknown, V>( + receiver: T, + state: T, + value: V, + kind: "a", + f: (v: V) => void +): V; + +/** + * Checks for the existence of a private field/method/accessor. + * + * @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member. + * @param receiver The object for which to test the presence of the private member. + */ +export declare function __classPrivateFieldIn( + state: (new (...args: any[]) => unknown) | { has(o: any): boolean }, + receiver: unknown, +): boolean; + +/** + * Creates a re-export binding on `object` with key `objectKey` that references `target[key]`. + * + * @param object The local `exports` object. + * @param target The object to re-export from. + * @param key The property key of `target` to re-export. + * @param objectKey The property key to re-export as. Defaults to `key`. + */ +export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; + +/** + * Adds a disposable resource to a resource-tracking environment object. + * @param env A resource-tracking environment object. + * @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`. + * @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added. + * @returns The {@link value} argument. + * + * @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not + * defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method. + */ +export declare function __addDisposableResource(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T; + +/** + * Disposes all resources in a resource-tracking environment object. + * @param env A resource-tracking environment object. + * @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`. + * + * @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the + * error recorded in the resource-tracking environment object. + * @seealso {@link __addDisposableResource} + */ +export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any; diff --git a/graphql-subscription/node_modules/tslib/tslib.es6.html b/graphql-subscription/node_modules/tslib/tslib.es6.html new file mode 100644 index 0000000..b122e41 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/tslib.es6.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphql-subscription/node_modules/tslib/tslib.es6.js b/graphql-subscription/node_modules/tslib/tslib.es6.js new file mode 100644 index 0000000..7be1c94 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/tslib.es6.js @@ -0,0 +1,370 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +export function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +export function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +export function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +export function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +export function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +export function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +export function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); +} + +export default { + __extends: __extends, + __assign: __assign, + __rest: __rest, + __decorate: __decorate, + __param: __param, + __metadata: __metadata, + __awaiter: __awaiter, + __generator: __generator, + __createBinding: __createBinding, + __exportStar: __exportStar, + __values: __values, + __read: __read, + __spread: __spread, + __spreadArrays: __spreadArrays, + __spreadArray: __spreadArray, + __await: __await, + __asyncGenerator: __asyncGenerator, + __asyncDelegator: __asyncDelegator, + __asyncValues: __asyncValues, + __makeTemplateObject: __makeTemplateObject, + __importStar: __importStar, + __importDefault: __importDefault, + __classPrivateFieldGet: __classPrivateFieldGet, + __classPrivateFieldSet: __classPrivateFieldSet, + __classPrivateFieldIn: __classPrivateFieldIn, + __addDisposableResource: __addDisposableResource, + __disposeResources: __disposeResources, +}; diff --git a/graphql-subscription/node_modules/tslib/tslib.es6.mjs b/graphql-subscription/node_modules/tslib/tslib.es6.mjs new file mode 100644 index 0000000..c8e2999 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/tslib.es6.mjs @@ -0,0 +1,370 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +export function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +export function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +export function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +export function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +export function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +export function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +export function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); +} + +export default { + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +}; diff --git a/graphql-subscription/node_modules/tslib/tslib.html b/graphql-subscription/node_modules/tslib/tslib.html new file mode 100644 index 0000000..44c9ba5 --- /dev/null +++ b/graphql-subscription/node_modules/tslib/tslib.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphql-subscription/node_modules/tslib/tslib.js b/graphql-subscription/node_modules/tslib/tslib.js new file mode 100644 index 0000000..343ecde --- /dev/null +++ b/graphql-subscription/node_modules/tslib/tslib.js @@ -0,0 +1,421 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, Symbol, Reflect, Promise, SuppressedError */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +var __addDisposableResource; +var __disposeResources; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if (typeof module === "object" && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + __addDisposableResource = function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + }; + + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + __disposeResources = function (env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); + exporter("__addDisposableResource", __addDisposableResource); + exporter("__disposeResources", __disposeResources); +}); diff --git a/graphql-subscription/node_modules/ws/LICENSE b/graphql-subscription/node_modules/ws/LICENSE new file mode 100644 index 0000000..1da5b96 --- /dev/null +++ b/graphql-subscription/node_modules/ws/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2011 Einar Otto Stangvik +Copyright (c) 2013 Arnout Kazemier and contributors +Copyright (c) 2016 Luigi Pinca and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription/node_modules/ws/README.md b/graphql-subscription/node_modules/ws/README.md new file mode 100644 index 0000000..80d9886 --- /dev/null +++ b/graphql-subscription/node_modules/ws/README.md @@ -0,0 +1,549 @@ +# ws: a Node.js WebSocket library + +[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws) +[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster) +[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws) + +ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and +server implementation. + +Passes the quite extensive Autobahn test suite: [server][server-report], +[client][client-report]. + +**Note**: This module does not work in the browser. The client in the docs is a +reference to a back end with the role of a client in the WebSocket +communication. Browser clients must use the native +[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) +object. To make the same code work seamlessly on Node.js and the browser, you +can use one of the many wrappers available on npm, like +[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). + +## Table of Contents + +- [Protocol support](#protocol-support) +- [Installing](#installing) + - [Opt-in for performance](#opt-in-for-performance) + - [Legacy opt-in for performance](#legacy-opt-in-for-performance) +- [API docs](#api-docs) +- [WebSocket compression](#websocket-compression) +- [Usage examples](#usage-examples) + - [Sending and receiving text data](#sending-and-receiving-text-data) + - [Sending binary data](#sending-binary-data) + - [Simple server](#simple-server) + - [External HTTP/S server](#external-https-server) + - [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) + - [Client authentication](#client-authentication) + - [Server broadcast](#server-broadcast) + - [Round-trip time](#round-trip-time) + - [Use the Node.js streams API](#use-the-nodejs-streams-api) + - [Other examples](#other-examples) +- [FAQ](#faq) + - [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) + - [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) + - [How to connect via a proxy?](#how-to-connect-via-a-proxy) +- [Changelog](#changelog) +- [License](#license) + +## Protocol support + +- **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) +- **HyBi drafts 13-17** (Current default, alternatively option + `protocolVersion: 13`) + +## Installing + +``` +npm install ws +``` + +### Opt-in for performance + +[bufferutil][] is an optional module that can be installed alongside the ws +module: + +``` +npm install --save-optional bufferutil +``` + +This is a binary addon that improves the performance of certain operations such +as masking and unmasking the data payload of the WebSocket frames. Prebuilt +binaries are available for the most popular platforms, so you don't necessarily +need to have a C++ compiler installed on your machine. + +To force ws to not use bufferutil, use the +[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This +can be useful to enhance security in systems where a user can put a package in +the package search path of an application of another user, due to how the +Node.js resolver algorithm works. + +#### Legacy opt-in for performance + +If you are running on an old version of Node.js (prior to v18.14.0), ws also +supports the [utf-8-validate][] module: + +``` +npm install --save-optional utf-8-validate +``` + +This contains a binary polyfill for [`buffer.isUtf8()`][]. + +To force ws to not use utf-8-validate, use the +[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable. + +## API docs + +See [`/doc/ws.md`](./doc/ws.md) for Node.js-like documentation of ws classes and +utility functions. + +## WebSocket compression + +ws supports the [permessage-deflate extension][permessage-deflate] which enables +the client and server to negotiate a compression algorithm and its parameters, +and then selectively apply it to the data payloads of each WebSocket message. + +The extension is disabled by default on the server and enabled by default on the +client. It adds a significant overhead in terms of performance and memory +consumption so we suggest to enable it only if it is really needed. + +Note that Node.js has a variety of issues with high-performance compression, +where increased concurrency, especially on Linux, can lead to [catastrophic +memory fragmentation][node-zlib-bug] and slow performance. If you intend to use +permessage-deflate in production, it is worthwhile to set up a test +representative of your workload and ensure Node.js/zlib will handle it with +acceptable performance and memory usage. + +Tuning of permessage-deflate can be done via the options defined below. You can +also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly +into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. + +See [the docs][ws-server-options] for more options. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ + port: 8080, + perMessageDeflate: { + zlibDeflateOptions: { + // See zlib defaults. + chunkSize: 1024, + memLevel: 7, + level: 3 + }, + zlibInflateOptions: { + chunkSize: 10 * 1024 + }, + // Other options settable: + clientNoContextTakeover: true, // Defaults to negotiated value. + serverNoContextTakeover: true, // Defaults to negotiated value. + serverMaxWindowBits: 10, // Defaults to negotiated value. + // Below options specified as default values. + concurrencyLimit: 10, // Limits zlib concurrency for perf. + threshold: 1024 // Size (in bytes) below which messages + // should not be compressed if context takeover is disabled. + } +}); +``` + +The client will only use the extension if it is supported and enabled on the +server. To always disable the extension on the client set the +`perMessageDeflate` option to `false`. + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path', { + perMessageDeflate: false +}); +``` + +## Usage examples + +### Sending and receiving text data + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('error', console.error); + +ws.on('open', function open() { + ws.send('something'); +}); + +ws.on('message', function message(data) { + console.log('received: %s', data); +}); +``` + +### Sending binary data + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('ws://www.host.com/path'); + +ws.on('error', console.error); + +ws.on('open', function open() { + const array = new Float32Array(5); + + for (var i = 0; i < array.length; ++i) { + array[i] = i / 2; + } + + ws.send(array); +}); +``` + +### Simple server + +```js +import { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log('received: %s', data); + }); + + ws.send('something'); +}); +``` + +### External HTTP/S server + +```js +import { createServer } from 'https'; +import { readFileSync } from 'fs'; +import { WebSocketServer } from 'ws'; + +const server = createServer({ + cert: readFileSync('/path/to/cert.pem'), + key: readFileSync('/path/to/key.pem') +}); +const wss = new WebSocketServer({ server }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log('received: %s', data); + }); + + ws.send('something'); +}); + +server.listen(8080); +``` + +### Multiple servers sharing a single HTTP/S server + +```js +import { createServer } from 'http'; +import { parse } from 'url'; +import { WebSocketServer } from 'ws'; + +const server = createServer(); +const wss1 = new WebSocketServer({ noServer: true }); +const wss2 = new WebSocketServer({ noServer: true }); + +wss1.on('connection', function connection(ws) { + ws.on('error', console.error); + + // ... +}); + +wss2.on('connection', function connection(ws) { + ws.on('error', console.error); + + // ... +}); + +server.on('upgrade', function upgrade(request, socket, head) { + const { pathname } = parse(request.url); + + if (pathname === '/foo') { + wss1.handleUpgrade(request, socket, head, function done(ws) { + wss1.emit('connection', ws, request); + }); + } else if (pathname === '/bar') { + wss2.handleUpgrade(request, socket, head, function done(ws) { + wss2.emit('connection', ws, request); + }); + } else { + socket.destroy(); + } +}); + +server.listen(8080); +``` + +### Client authentication + +```js +import { createServer } from 'http'; +import { WebSocketServer } from 'ws'; + +function onSocketError(err) { + console.error(err); +} + +const server = createServer(); +const wss = new WebSocketServer({ noServer: true }); + +wss.on('connection', function connection(ws, request, client) { + ws.on('error', console.error); + + ws.on('message', function message(data) { + console.log(`Received message ${data} from user ${client}`); + }); +}); + +server.on('upgrade', function upgrade(request, socket, head) { + socket.on('error', onSocketError); + + // This function is not defined on purpose. Implement it with your own logic. + authenticate(request, function next(err, client) { + if (err || !client) { + socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n'); + socket.destroy(); + return; + } + + socket.removeListener('error', onSocketError); + + wss.handleUpgrade(request, socket, head, function done(ws) { + wss.emit('connection', ws, request, client); + }); + }); +}); + +server.listen(8080); +``` + +Also see the provided [example][session-parse-example] using `express-session`. + +### Server broadcast + +A client WebSocket broadcasting to all connected WebSocket clients, including +itself. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data, isBinary) { + wss.clients.forEach(function each(client) { + if (client.readyState === WebSocket.OPEN) { + client.send(data, { binary: isBinary }); + } + }); + }); +}); +``` + +A client WebSocket broadcasting to every other connected WebSocket clients, +excluding itself. + +```js +import WebSocket, { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.on('error', console.error); + + ws.on('message', function message(data, isBinary) { + wss.clients.forEach(function each(client) { + if (client !== ws && client.readyState === WebSocket.OPEN) { + client.send(data, { binary: isBinary }); + } + }); + }); +}); +``` + +### Round-trip time + +```js +import WebSocket from 'ws'; + +const ws = new WebSocket('wss://websocket-echo.com/'); + +ws.on('error', console.error); + +ws.on('open', function open() { + console.log('connected'); + ws.send(Date.now()); +}); + +ws.on('close', function close() { + console.log('disconnected'); +}); + +ws.on('message', function message(data) { + console.log(`Round-trip time: ${Date.now() - data} ms`); + + setTimeout(function timeout() { + ws.send(Date.now()); + }, 500); +}); +``` + +### Use the Node.js streams API + +```js +import WebSocket, { createWebSocketStream } from 'ws'; + +const ws = new WebSocket('wss://websocket-echo.com/'); + +const duplex = createWebSocketStream(ws, { encoding: 'utf8' }); + +duplex.on('error', console.error); + +duplex.pipe(process.stdout); +process.stdin.pipe(duplex); +``` + +### Other examples + +For a full example with a browser client communicating with a ws server, see the +examples folder. + +Otherwise, see the test cases. + +## FAQ + +### How to get the IP address of the client? + +The remote IP address can be obtained from the raw socket. + +```js +import { WebSocketServer } from 'ws'; + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws, req) { + const ip = req.socket.remoteAddress; + + ws.on('error', console.error); +}); +``` + +When the server runs behind a proxy like NGINX, the de-facto standard is to use +the `X-Forwarded-For` header. + +```js +wss.on('connection', function connection(ws, req) { + const ip = req.headers['x-forwarded-for'].split(',')[0].trim(); + + ws.on('error', console.error); +}); +``` + +### How to detect and close broken connections? + +Sometimes the link between the server and the client can be interrupted in a way +that keeps both the server and the client unaware of the broken state of the +connection (e.g. when pulling the cord). + +In these cases ping messages can be used as a means to verify that the remote +endpoint is still responsive. + +```js +import { WebSocketServer } from 'ws'; + +function heartbeat() { + this.isAlive = true; +} + +const wss = new WebSocketServer({ port: 8080 }); + +wss.on('connection', function connection(ws) { + ws.isAlive = true; + ws.on('error', console.error); + ws.on('pong', heartbeat); +}); + +const interval = setInterval(function ping() { + wss.clients.forEach(function each(ws) { + if (ws.isAlive === false) return ws.terminate(); + + ws.isAlive = false; + ws.ping(); + }); +}, 30000); + +wss.on('close', function close() { + clearInterval(interval); +}); +``` + +Pong messages are automatically sent in response to ping messages as required by +the spec. + +Just like the server example above your clients might as well lose connection +without knowing it. You might want to add a ping listener on your clients to +prevent that. A simple implementation would be: + +```js +import WebSocket from 'ws'; + +function heartbeat() { + clearTimeout(this.pingTimeout); + + // Use `WebSocket#terminate()`, which immediately destroys the connection, + // instead of `WebSocket#close()`, which waits for the close timer. + // Delay should be equal to the interval at which your server + // sends out pings plus a conservative assumption of the latency. + this.pingTimeout = setTimeout(() => { + this.terminate(); + }, 30000 + 1000); +} + +const client = new WebSocket('wss://websocket-echo.com/'); + +client.on('error', console.error); +client.on('open', heartbeat); +client.on('ping', heartbeat); +client.on('close', function clear() { + clearTimeout(this.pingTimeout); +}); +``` + +### How to connect via a proxy? + +Use a custom `http.Agent` implementation like [https-proxy-agent][] or +[socks-proxy-agent][]. + +## Changelog + +We're using the GitHub [releases][changelog] for changelog entries. + +## License + +[MIT](LICENSE) + +[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input +[bufferutil]: https://github.com/websockets/bufferutil +[changelog]: https://github.com/websockets/ws/releases +[client-report]: http://websockets.github.io/ws/autobahn/clients/ +[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent +[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 +[node-zlib-deflaterawdocs]: + https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options +[permessage-deflate]: https://tools.ietf.org/html/rfc7692 +[server-report]: http://websockets.github.io/ws/autobahn/servers/ +[session-parse-example]: ./examples/express-session-parse +[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent +[utf-8-validate]: https://github.com/websockets/utf-8-validate +[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback diff --git a/graphql-subscription/node_modules/ws/browser.js b/graphql-subscription/node_modules/ws/browser.js new file mode 100644 index 0000000..ca4f628 --- /dev/null +++ b/graphql-subscription/node_modules/ws/browser.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function () { + throw new Error( + 'ws does not work in the browser. Browser clients must use the native ' + + 'WebSocket object' + ); +}; diff --git a/graphql-subscription/node_modules/ws/index.js b/graphql-subscription/node_modules/ws/index.js new file mode 100644 index 0000000..41edb3b --- /dev/null +++ b/graphql-subscription/node_modules/ws/index.js @@ -0,0 +1,13 @@ +'use strict'; + +const WebSocket = require('./lib/websocket'); + +WebSocket.createWebSocketStream = require('./lib/stream'); +WebSocket.Server = require('./lib/websocket-server'); +WebSocket.Receiver = require('./lib/receiver'); +WebSocket.Sender = require('./lib/sender'); + +WebSocket.WebSocket = WebSocket; +WebSocket.WebSocketServer = WebSocket.Server; + +module.exports = WebSocket; diff --git a/graphql-subscription/node_modules/ws/lib/buffer-util.js b/graphql-subscription/node_modules/ws/lib/buffer-util.js new file mode 100644 index 0000000..f7536e2 --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/buffer-util.js @@ -0,0 +1,131 @@ +'use strict'; + +const { EMPTY_BUFFER } = require('./constants'); + +const FastBuffer = Buffer[Symbol.species]; + +/** + * Merges an array of buffers into a new buffer. + * + * @param {Buffer[]} list The array of buffers to concat + * @param {Number} totalLength The total length of buffers in the list + * @return {Buffer} The resulting buffer + * @public + */ +function concat(list, totalLength) { + if (list.length === 0) return EMPTY_BUFFER; + if (list.length === 1) return list[0]; + + const target = Buffer.allocUnsafe(totalLength); + let offset = 0; + + for (let i = 0; i < list.length; i++) { + const buf = list[i]; + target.set(buf, offset); + offset += buf.length; + } + + if (offset < totalLength) { + return new FastBuffer(target.buffer, target.byteOffset, offset); + } + + return target; +} + +/** + * Masks a buffer using the given mask. + * + * @param {Buffer} source The buffer to mask + * @param {Buffer} mask The mask to use + * @param {Buffer} output The buffer where to store the result + * @param {Number} offset The offset at which to start writing + * @param {Number} length The number of bytes to mask. + * @public + */ +function _mask(source, mask, output, offset, length) { + for (let i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } +} + +/** + * Unmasks a buffer using the given mask. + * + * @param {Buffer} buffer The buffer to unmask + * @param {Buffer} mask The mask to use + * @public + */ +function _unmask(buffer, mask) { + for (let i = 0; i < buffer.length; i++) { + buffer[i] ^= mask[i & 3]; + } +} + +/** + * Converts a buffer to an `ArrayBuffer`. + * + * @param {Buffer} buf The buffer to convert + * @return {ArrayBuffer} Converted buffer + * @public + */ +function toArrayBuffer(buf) { + if (buf.length === buf.buffer.byteLength) { + return buf.buffer; + } + + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length); +} + +/** + * Converts `data` to a `Buffer`. + * + * @param {*} data The data to convert + * @return {Buffer} The buffer + * @throws {TypeError} + * @public + */ +function toBuffer(data) { + toBuffer.readOnly = true; + + if (Buffer.isBuffer(data)) return data; + + let buf; + + if (data instanceof ArrayBuffer) { + buf = new FastBuffer(data); + } else if (ArrayBuffer.isView(data)) { + buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength); + } else { + buf = Buffer.from(data); + toBuffer.readOnly = false; + } + + return buf; +} + +module.exports = { + concat, + mask: _mask, + toArrayBuffer, + toBuffer, + unmask: _unmask +}; + +/* istanbul ignore else */ +if (!process.env.WS_NO_BUFFER_UTIL) { + try { + const bufferUtil = require('bufferutil'); + + module.exports.mask = function (source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bufferUtil.mask(source, mask, output, offset, length); + }; + + module.exports.unmask = function (buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bufferUtil.unmask(buffer, mask); + }; + } catch (e) { + // Continue regardless of the error. + } +} diff --git a/graphql-subscription/node_modules/ws/lib/constants.js b/graphql-subscription/node_modules/ws/lib/constants.js new file mode 100644 index 0000000..d691b30 --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/constants.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = { + BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], + EMPTY_BUFFER: Buffer.alloc(0), + GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', + kForOnEventAttribute: Symbol('kIsForOnEventAttribute'), + kListener: Symbol('kListener'), + kStatusCode: Symbol('status-code'), + kWebSocket: Symbol('websocket'), + NOOP: () => {} +}; diff --git a/graphql-subscription/node_modules/ws/lib/event-target.js b/graphql-subscription/node_modules/ws/lib/event-target.js new file mode 100644 index 0000000..fea4cbc --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/event-target.js @@ -0,0 +1,292 @@ +'use strict'; + +const { kForOnEventAttribute, kListener } = require('./constants'); + +const kCode = Symbol('kCode'); +const kData = Symbol('kData'); +const kError = Symbol('kError'); +const kMessage = Symbol('kMessage'); +const kReason = Symbol('kReason'); +const kTarget = Symbol('kTarget'); +const kType = Symbol('kType'); +const kWasClean = Symbol('kWasClean'); + +/** + * Class representing an event. + */ +class Event { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @throws {TypeError} If the `type` argument is not specified + */ + constructor(type) { + this[kTarget] = null; + this[kType] = type; + } + + /** + * @type {*} + */ + get target() { + return this[kTarget]; + } + + /** + * @type {String} + */ + get type() { + return this[kType]; + } +} + +Object.defineProperty(Event.prototype, 'target', { enumerable: true }); +Object.defineProperty(Event.prototype, 'type', { enumerable: true }); + +/** + * Class representing a close event. + * + * @extends Event + */ +class CloseEvent extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {Number} [options.code=0] The status code explaining why the + * connection was closed + * @param {String} [options.reason=''] A human-readable string explaining why + * the connection was closed + * @param {Boolean} [options.wasClean=false] Indicates whether or not the + * connection was cleanly closed + */ + constructor(type, options = {}) { + super(type); + + this[kCode] = options.code === undefined ? 0 : options.code; + this[kReason] = options.reason === undefined ? '' : options.reason; + this[kWasClean] = options.wasClean === undefined ? false : options.wasClean; + } + + /** + * @type {Number} + */ + get code() { + return this[kCode]; + } + + /** + * @type {String} + */ + get reason() { + return this[kReason]; + } + + /** + * @type {Boolean} + */ + get wasClean() { + return this[kWasClean]; + } +} + +Object.defineProperty(CloseEvent.prototype, 'code', { enumerable: true }); +Object.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true }); +Object.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true }); + +/** + * Class representing an error event. + * + * @extends Event + */ +class ErrorEvent extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.error=null] The error that generated this event + * @param {String} [options.message=''] The error message + */ + constructor(type, options = {}) { + super(type); + + this[kError] = options.error === undefined ? null : options.error; + this[kMessage] = options.message === undefined ? '' : options.message; + } + + /** + * @type {*} + */ + get error() { + return this[kError]; + } + + /** + * @type {String} + */ + get message() { + return this[kMessage]; + } +} + +Object.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true }); +Object.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true }); + +/** + * Class representing a message event. + * + * @extends Event + */ +class MessageEvent extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {String} type The name of the event + * @param {Object} [options] A dictionary object that allows for setting + * attributes via object members of the same name + * @param {*} [options.data=null] The message content + */ + constructor(type, options = {}) { + super(type); + + this[kData] = options.data === undefined ? null : options.data; + } + + /** + * @type {*} + */ + get data() { + return this[kData]; + } +} + +Object.defineProperty(MessageEvent.prototype, 'data', { enumerable: true }); + +/** + * This provides methods for emulating the `EventTarget` interface. It's not + * meant to be used directly. + * + * @mixin + */ +const EventTarget = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {(Function|Object)} handler The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(type, handler, options = {}) { + for (const listener of this.listeners(type)) { + if ( + !options[kForOnEventAttribute] && + listener[kListener] === handler && + !listener[kForOnEventAttribute] + ) { + return; + } + } + + let wrapper; + + if (type === 'message') { + wrapper = function onMessage(data, isBinary) { + const event = new MessageEvent('message', { + data: isBinary ? data : data.toString() + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'close') { + wrapper = function onClose(code, message) { + const event = new CloseEvent('close', { + code, + reason: message.toString(), + wasClean: this._closeFrameReceived && this._closeFrameSent + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'error') { + wrapper = function onError(error) { + const event = new ErrorEvent('error', { + error, + message: error.message + }); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else if (type === 'open') { + wrapper = function onOpen() { + const event = new Event('open'); + + event[kTarget] = this; + callListener(handler, this, event); + }; + } else { + return; + } + + wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute]; + wrapper[kListener] = handler; + + if (options.once) { + this.once(type, wrapper); + } else { + this.on(type, wrapper); + } + }, + + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {(Function|Object)} handler The listener to remove + * @public + */ + removeEventListener(type, handler) { + for (const listener of this.listeners(type)) { + if (listener[kListener] === handler && !listener[kForOnEventAttribute]) { + this.removeListener(type, listener); + break; + } + } + } +}; + +module.exports = { + CloseEvent, + ErrorEvent, + Event, + EventTarget, + MessageEvent +}; + +/** + * Call an event listener + * + * @param {(Function|Object)} listener The listener to call + * @param {*} thisArg The value to use as `this`` when calling the listener + * @param {Event} event The event to pass to the listener + * @private + */ +function callListener(listener, thisArg, event) { + if (typeof listener === 'object' && listener.handleEvent) { + listener.handleEvent.call(listener, event); + } else { + listener.call(thisArg, event); + } +} diff --git a/graphql-subscription/node_modules/ws/lib/extension.js b/graphql-subscription/node_modules/ws/lib/extension.js new file mode 100644 index 0000000..3d7895c --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/extension.js @@ -0,0 +1,203 @@ +'use strict'; + +const { tokenChars } = require('./validation'); + +/** + * Adds an offer to the map of extension offers or a parameter to the map of + * parameters. + * + * @param {Object} dest The map of extension offers or parameters + * @param {String} name The extension or parameter name + * @param {(Object|Boolean|String)} elem The extension parameters or the + * parameter value + * @private + */ +function push(dest, name, elem) { + if (dest[name] === undefined) dest[name] = [elem]; + else dest[name].push(elem); +} + +/** + * Parses the `Sec-WebSocket-Extensions` header into an object. + * + * @param {String} header The field value of the header + * @return {Object} The parsed object + * @public + */ +function parse(header) { + const offers = Object.create(null); + let params = Object.create(null); + let mustUnescape = false; + let isEscaping = false; + let inQuotes = false; + let extensionName; + let paramName; + let start = -1; + let code = -1; + let end = -1; + let i = 0; + + for (; i < header.length; i++) { + code = header.charCodeAt(i); + + if (extensionName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if ( + i !== 0 && + (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ + ) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + const name = header.slice(start, end); + if (code === 0x2c) { + push(offers, name, params); + params = Object.create(null); + } else { + extensionName = name; + } + + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === undefined) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x20 || code === 0x09) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + push(params, header.slice(start, end), true); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + start = end = -1; + } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + // + // The value of a quoted-string after unescaping must conform to the + // token ABNF, so only token characters are valid. + // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 + // + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 0x22 /* '"' */ && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 0x5c /* '\' */) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 0x20 || code === 0x09)) { + if (end === -1) end = i; + } else if (code === 0x3b || code === 0x2c) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + let value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ''); + mustUnescape = false; + } + push(params, paramName, value); + if (code === 0x2c) { + push(offers, extensionName, params); + params = Object.create(null); + extensionName = undefined; + } + + paramName = undefined; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + + if (start === -1 || inQuotes || code === 0x20 || code === 0x09) { + throw new SyntaxError('Unexpected end of input'); + } + + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === undefined) { + push(offers, token, params); + } else { + if (paramName === undefined) { + push(params, token, true); + } else if (mustUnescape) { + push(params, paramName, token.replace(/\\/g, '')); + } else { + push(params, paramName, token); + } + push(offers, extensionName, params); + } + + return offers; +} + +/** + * Builds the `Sec-WebSocket-Extensions` header field value. + * + * @param {Object} extensions The map of extensions and parameters to format + * @return {String} A string representing the given object + * @public + */ +function format(extensions) { + return Object.keys(extensions) + .map((extension) => { + let configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations + .map((params) => { + return [extension] + .concat( + Object.keys(params).map((k) => { + let values = params[k]; + if (!Array.isArray(values)) values = [values]; + return values + .map((v) => (v === true ? k : `${k}=${v}`)) + .join('; '); + }) + ) + .join('; '); + }) + .join(', '); + }) + .join(', '); +} + +module.exports = { format, parse }; diff --git a/graphql-subscription/node_modules/ws/lib/limiter.js b/graphql-subscription/node_modules/ws/lib/limiter.js new file mode 100644 index 0000000..3fd3578 --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/limiter.js @@ -0,0 +1,55 @@ +'use strict'; + +const kDone = Symbol('kDone'); +const kRun = Symbol('kRun'); + +/** + * A very simple job queue with adjustable concurrency. Adapted from + * https://github.com/STRML/async-limiter + */ +class Limiter { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(concurrency) { + this[kDone] = () => { + this.pending--; + this[kRun](); + }; + this.concurrency = concurrency || Infinity; + this.jobs = []; + this.pending = 0; + } + + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(job) { + this.jobs.push(job); + this[kRun](); + } + + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [kRun]() { + if (this.pending === this.concurrency) return; + + if (this.jobs.length) { + const job = this.jobs.shift(); + + this.pending++; + job(this[kDone]); + } + } +} + +module.exports = Limiter; diff --git a/graphql-subscription/node_modules/ws/lib/permessage-deflate.js b/graphql-subscription/node_modules/ws/lib/permessage-deflate.js new file mode 100644 index 0000000..77d918b --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/permessage-deflate.js @@ -0,0 +1,514 @@ +'use strict'; + +const zlib = require('zlib'); + +const bufferUtil = require('./buffer-util'); +const Limiter = require('./limiter'); +const { kStatusCode } = require('./constants'); + +const FastBuffer = Buffer[Symbol.species]; +const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); +const kPerMessageDeflate = Symbol('permessage-deflate'); +const kTotalLength = Symbol('total-length'); +const kCallback = Symbol('callback'); +const kBuffers = Symbol('buffers'); +const kError = Symbol('error'); + +// +// We limit zlib concurrency, which prevents severe memory fragmentation +// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 +// and https://github.com/websockets/ws/issues/1202 +// +// Intentionally global; it's the global thread pool that's an issue. +// +let zlibLimiter; + +/** + * permessage-deflate implementation. + */ +class PerMessageDeflate { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed if context takeover is disabled + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = + this._options.threshold !== undefined ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + + this.params = null; + + if (!zlibLimiter) { + const concurrency = + this._options.concurrencyLimit !== undefined + ? this._options.concurrencyLimit + : 10; + zlibLimiter = new Limiter(concurrency); + } + } + + /** + * @type {String} + */ + static get extensionName() { + return 'permessage-deflate'; + } + + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params = {}; + + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + + return params; + } + + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + + this.params = this._isServer + ? this.acceptAsServer(configurations) + : this.acceptAsClient(configurations); + + return this.params; + } + + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + + if (this._deflate) { + const callback = this._deflate[kCallback]; + + this._deflate.close(); + this._deflate = null; + + if (callback) { + callback( + new Error( + 'The deflate stream was closed while data was being processed' + ) + ); + } + } + } + + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params) => { + if ( + (opts.serverNoContextTakeover === false && + params.server_no_context_takeover) || + (params.server_max_window_bits && + (opts.serverMaxWindowBits === false || + (typeof opts.serverMaxWindowBits === 'number' && + opts.serverMaxWindowBits > params.server_max_window_bits))) || + (typeof opts.clientMaxWindowBits === 'number' && + !params.client_max_window_bits) + ) { + return false; + } + + return true; + }); + + if (!accepted) { + throw new Error('None of the extension offers can be accepted'); + } + + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if ( + accepted.client_max_window_bits === true || + opts.clientMaxWindowBits === false + ) { + delete accepted.client_max_window_bits; + } + + return accepted; + } + + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params = response[0]; + + if ( + this._options.clientNoContextTakeover === false && + params.client_no_context_takeover + ) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + + if (!params.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === 'number') { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if ( + this._options.clientMaxWindowBits === false || + (typeof this._options.clientMaxWindowBits === 'number' && + params.client_max_window_bits > this._options.clientMaxWindowBits) + ) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + + return params; + } + + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params) => { + Object.keys(params).forEach((key) => { + let value = params[key]; + + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + + value = value[0]; + + if (key === 'client_max_window_bits') { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === 'server_max_window_bits') { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if ( + key === 'client_no_context_takeover' || + key === 'server_no_context_takeover' + ) { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + + params[key] = value; + }); + }); + + return configurations; + } + + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.add((done) => { + this._decompress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Compress data. Concurrency limited. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.add((done) => { + this._compress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._inflate = zlib.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits + }); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on('error', inflateOnError); + this._inflate.on('data', inflateOnData); + } + + this._inflate[kCallback] = callback; + + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + + this._inflate.flush(() => { + const err = this._inflate[kError]; + + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + + const data = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + + if (this._inflate._readableState.endEmitted) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.reset(); + } + } + + callback(null, data); + }); + } + + /** + * Compress data. + * + * @param {(Buffer|String)} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + const endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = + typeof this.params[key] !== 'number' + ? zlib.Z_DEFAULT_WINDOWBITS + : this.params[key]; + + this._deflate = zlib.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits + }); + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + this._deflate.on('data', deflateOnData); + } + + this._deflate[kCallback] = callback; + + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + // + // The deflate stream was closed while data was being processed. + // + return; + } + + let data = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + + if (fin) { + data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4); + } + + // + // Ensure that the callback will not be called again in + // `PerMessageDeflate#cleanup()`. + // + this._deflate[kCallback] = null; + + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.reset(); + } + + callback(null, data); + }); + } +} + +module.exports = PerMessageDeflate; + +/** + * The listener of the `zlib.DeflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; +} + +/** + * The listener of the `zlib.InflateRaw` stream `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + + if ( + this[kPerMessageDeflate]._maxPayload < 1 || + this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload + ) { + this[kBuffers].push(chunk); + return; + } + + this[kError] = new RangeError('Max payload size exceeded'); + this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'; + this[kError][kStatusCode] = 1009; + this.removeListener('data', inflateOnData); + this.reset(); +} + +/** + * The listener of the `zlib.InflateRaw` stream `'error'` event. + * + * @param {Error} err The emitted error + * @private + */ +function inflateOnError(err) { + // + // There is no need to call `Zlib#close()` as the handle is automatically + // closed when an error is emitted. + // + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); +} diff --git a/graphql-subscription/node_modules/ws/lib/receiver.js b/graphql-subscription/node_modules/ws/lib/receiver.js new file mode 100644 index 0000000..9e87d81 --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/receiver.js @@ -0,0 +1,742 @@ +'use strict'; + +const { Writable } = require('stream'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + kStatusCode, + kWebSocket +} = require('./constants'); +const { concat, toArrayBuffer, unmask } = require('./buffer-util'); +const { isValidStatusCode, isValidUTF8 } = require('./validation'); + +const FastBuffer = Buffer[Symbol.species]; +const promise = Promise.resolve(); + +// +// `queueMicrotask()` is not available in Node.js < 11. +// +const queueTask = + typeof queueMicrotask === 'function' ? queueMicrotask : queueMicrotaskShim; + +const GET_INFO = 0; +const GET_PAYLOAD_LENGTH_16 = 1; +const GET_PAYLOAD_LENGTH_64 = 2; +const GET_MASK = 3; +const GET_DATA = 4; +const INFLATING = 5; +const DEFER_EVENT = 6; + +/** + * HyBi Receiver implementation. + * + * @extends Writable + */ +class Receiver extends Writable { + /** + * Creates a Receiver instance. + * + * @param {Object} [options] Options object + * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {String} [options.binaryType=nodebuffer] The type for binary data + * @param {Object} [options.extensions] An object containing the negotiated + * extensions + * @param {Boolean} [options.isServer=false] Specifies whether to operate in + * client or server mode + * @param {Number} [options.maxPayload=0] The maximum allowed message length + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + */ + constructor(options = {}) { + super(); + + this._allowSynchronousEvents = !!options.allowSynchronousEvents; + this._binaryType = options.binaryType || BINARY_TYPES[0]; + this._extensions = options.extensions || {}; + this._isServer = !!options.isServer; + this._maxPayload = options.maxPayload | 0; + this._skipUTF8Validation = !!options.skipUTF8Validation; + this[kWebSocket] = undefined; + + this._bufferedBytes = 0; + this._buffers = []; + + this._compressed = false; + this._payloadLength = 0; + this._mask = undefined; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + + this._errored = false; + this._loop = false; + this._state = GET_INFO; + } + + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(chunk, encoding, cb) { + if (this._opcode === 0x08 && this._state == GET_INFO) return cb(); + + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + + if (n === this._buffers[0].length) return this._buffers.shift(); + + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = new FastBuffer( + buf.buffer, + buf.byteOffset + n, + buf.length - n + ); + + return new FastBuffer(buf.buffer, buf.byteOffset, n); + } + + const dst = Buffer.allocUnsafe(n); + + do { + const buf = this._buffers[0]; + const offset = dst.length - n; + + if (n >= buf.length) { + dst.set(this._buffers.shift(), offset); + } else { + dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); + this._buffers[0] = new FastBuffer( + buf.buffer, + buf.byteOffset + n, + buf.length - n + ); + } + + n -= buf.length; + } while (n > 0); + + return dst; + } + + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + this._loop = true; + + do { + switch (this._state) { + case GET_INFO: + this.getInfo(cb); + break; + case GET_PAYLOAD_LENGTH_16: + this.getPayloadLength16(cb); + break; + case GET_PAYLOAD_LENGTH_64: + this.getPayloadLength64(cb); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + this.getData(cb); + break; + case INFLATING: + case DEFER_EVENT: + this._loop = false; + return; + } + } while (this._loop); + + if (!this._errored) cb(); + } + + /** + * Reads the first two bytes of a frame. + * + * @param {Function} cb Callback + * @private + */ + getInfo(cb) { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + const buf = this.consume(2); + + if ((buf[0] & 0x30) !== 0x00) { + const error = this.createError( + RangeError, + 'RSV2 and RSV3 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_2_3' + ); + + cb(error); + return; + } + + const compressed = (buf[0] & 0x40) === 0x40; + + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + this._fin = (buf[0] & 0x80) === 0x80; + this._opcode = buf[0] & 0x0f; + this._payloadLength = buf[1] & 0x7f; + + if (this._opcode === 0x00) { + if (compressed) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + if (!this._fragmented) { + const error = this.createError( + RangeError, + 'invalid opcode 0', + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + this._opcode = this._fragmented; + } else if (this._opcode === 0x01 || this._opcode === 0x02) { + if (this._fragmented) { + const error = this.createError( + RangeError, + `invalid opcode ${this._opcode}`, + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + this._compressed = compressed; + } else if (this._opcode > 0x07 && this._opcode < 0x0b) { + if (!this._fin) { + const error = this.createError( + RangeError, + 'FIN must be set', + true, + 1002, + 'WS_ERR_EXPECTED_FIN' + ); + + cb(error); + return; + } + + if (compressed) { + const error = this.createError( + RangeError, + 'RSV1 must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_RSV_1' + ); + + cb(error); + return; + } + + if ( + this._payloadLength > 0x7d || + (this._opcode === 0x08 && this._payloadLength === 1) + ) { + const error = this.createError( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002, + 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH' + ); + + cb(error); + return; + } + } else { + const error = this.createError( + RangeError, + `invalid opcode ${this._opcode}`, + true, + 1002, + 'WS_ERR_INVALID_OPCODE' + ); + + cb(error); + return; + } + + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 0x80) === 0x80; + + if (this._isServer) { + if (!this._masked) { + const error = this.createError( + RangeError, + 'MASK must be set', + true, + 1002, + 'WS_ERR_EXPECTED_MASK' + ); + + cb(error); + return; + } + } else if (this._masked) { + const error = this.createError( + RangeError, + 'MASK must be clear', + true, + 1002, + 'WS_ERR_UNEXPECTED_MASK' + ); + + cb(error); + return; + } + + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else this.haveLength(cb); + } + + /** + * Gets extended payload length (7+16). + * + * @param {Function} cb Callback + * @private + */ + getPayloadLength16(cb) { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + + this._payloadLength = this.consume(2).readUInt16BE(0); + this.haveLength(cb); + } + + /** + * Gets extended payload length (7+64). + * + * @param {Function} cb Callback + * @private + */ + getPayloadLength64(cb) { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + + // + // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned + // if payload length is greater than this number. + // + if (num > Math.pow(2, 53 - 32) - 1) { + const error = this.createError( + RangeError, + 'Unsupported WebSocket frame: payload length > 2^53 - 1', + false, + 1009, + 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH' + ); + + cb(error); + return; + } + + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + this.haveLength(cb); + } + + /** + * Payload length has been read. + * + * @param {Function} cb Callback + * @private + */ + haveLength(cb) { + if (this._payloadLength && this._opcode < 0x08) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + const error = this.createError( + RangeError, + 'Max payload size exceeded', + false, + 1009, + 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' + ); + + cb(error); + return; + } + } + + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + + this._mask = this.consume(4); + this._state = GET_DATA; + } + + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @private + */ + getData(cb) { + let data = EMPTY_BUFFER; + + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + + data = this.consume(this._payloadLength); + + if ( + this._masked && + (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0 + ) { + unmask(data, this._mask); + } + } + + if (this._opcode > 0x07) { + this.controlMessage(data, cb); + return; + } + + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + + if (data.length) { + // + // This message is not compressed so its length is the sum of the payload + // length of all fragments. + // + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + + this.dataMessage(cb); + } + + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + const error = this.createError( + RangeError, + 'Max payload size exceeded', + false, + 1009, + 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH' + ); + + cb(error); + return; + } + + this._fragments.push(buf); + } + + this.dataMessage(cb); + if (this._state === GET_INFO) this.startLoop(cb); + }); + } + + /** + * Handles a data message. + * + * @param {Function} cb Callback + * @private + */ + dataMessage(cb) { + if (!this._fin) { + this._state = GET_INFO; + return; + } + + const messageLength = this._messageLength; + const fragments = this._fragments; + + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + + if (this._opcode === 2) { + let data; + + if (this._binaryType === 'nodebuffer') { + data = concat(fragments, messageLength); + } else if (this._binaryType === 'arraybuffer') { + data = toArrayBuffer(concat(fragments, messageLength)); + } else { + data = fragments; + } + + // + // If the state is `INFLATING`, it means that the frame data was + // decompressed asynchronously, so there is no need to defer the event + // as it will be emitted asynchronously anyway. + // + if (this._state === INFLATING || this._allowSynchronousEvents) { + this.emit('message', data, true); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + queueTask(() => { + this.emit('message', data, true); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } else { + const buf = concat(fragments, messageLength); + + if (!this._skipUTF8Validation && !isValidUTF8(buf)) { + const error = this.createError( + Error, + 'invalid UTF-8 sequence', + true, + 1007, + 'WS_ERR_INVALID_UTF8' + ); + + cb(error); + return; + } + + if (this._state === INFLATING || this._allowSynchronousEvents) { + this.emit('message', buf, false); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + queueTask(() => { + this.emit('message', buf, false); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } + } + + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data, cb) { + if (this._opcode === 0x08) { + if (data.length === 0) { + this._loop = false; + this.emit('conclude', 1005, EMPTY_BUFFER); + this.end(); + } else { + const code = data.readUInt16BE(0); + + if (!isValidStatusCode(code)) { + const error = this.createError( + RangeError, + `invalid status code ${code}`, + true, + 1002, + 'WS_ERR_INVALID_CLOSE_CODE' + ); + + cb(error); + return; + } + + const buf = new FastBuffer( + data.buffer, + data.byteOffset + 2, + data.length - 2 + ); + + if (!this._skipUTF8Validation && !isValidUTF8(buf)) { + const error = this.createError( + Error, + 'invalid UTF-8 sequence', + true, + 1007, + 'WS_ERR_INVALID_UTF8' + ); + + cb(error); + return; + } + + this._loop = false; + this.emit('conclude', code, buf); + this.end(); + } + + this._state = GET_INFO; + return; + } + + if (this._allowSynchronousEvents) { + this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); + this._state = GET_INFO; + } else { + this._state = DEFER_EVENT; + queueTask(() => { + this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data); + this._state = GET_INFO; + this.startLoop(cb); + }); + } + } + + /** + * Builds an error object. + * + * @param {function(new:Error|RangeError)} ErrorCtor The error constructor + * @param {String} message The error message + * @param {Boolean} prefix Specifies whether or not to add a default prefix to + * `message` + * @param {Number} statusCode The status code + * @param {String} errorCode The exposed error code + * @return {(Error|RangeError)} The error + * @private + */ + createError(ErrorCtor, message, prefix, statusCode, errorCode) { + this._loop = false; + this._errored = true; + + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + + Error.captureStackTrace(err, this.createError); + err.code = errorCode; + err[kStatusCode] = statusCode; + return err; + } +} + +module.exports = Receiver; + +/** + * A shim for `queueMicrotask()`. + * + * @param {Function} cb Callback + */ +function queueMicrotaskShim(cb) { + promise.then(cb).catch(throwErrorNextTick); +} + +/** + * Throws an error. + * + * @param {Error} err The error to throw + * @private + */ +function throwError(err) { + throw err; +} + +/** + * Throws an error in the next tick. + * + * @param {Error} err The error to throw + * @private + */ +function throwErrorNextTick(err) { + process.nextTick(throwError, err); +} diff --git a/graphql-subscription/node_modules/ws/lib/sender.js b/graphql-subscription/node_modules/ws/lib/sender.js new file mode 100644 index 0000000..1ed04b0 --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/sender.js @@ -0,0 +1,477 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */ + +'use strict'; + +const { Duplex } = require('stream'); +const { randomFillSync } = require('crypto'); + +const PerMessageDeflate = require('./permessage-deflate'); +const { EMPTY_BUFFER } = require('./constants'); +const { isValidStatusCode } = require('./validation'); +const { mask: applyMask, toBuffer } = require('./buffer-util'); + +const kByteLength = Symbol('kByteLength'); +const maskBuffer = Buffer.alloc(4); + +/** + * HyBi Sender implementation. + */ +class Sender { + /** + * Creates a Sender instance. + * + * @param {Duplex} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Function} [generateMask] The function used to generate the masking + * key + */ + constructor(socket, extensions, generateMask) { + this._extensions = extensions || {}; + + if (generateMask) { + this._generateMask = generateMask; + this._maskBuffer = Buffer.alloc(4); + } + + this._socket = socket; + + this._firstFragment = true; + this._compress = false; + + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {(Buffer|String)} data The data to frame + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {(Buffer|String)[]} The framed data + * @public + */ + static frame(data, options) { + let mask; + let merge = false; + let offset = 2; + let skipMasking = false; + + if (options.mask) { + mask = options.maskBuffer || maskBuffer; + + if (options.generateMask) { + options.generateMask(mask); + } else { + randomFillSync(mask, 0, 4); + } + + skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0; + offset = 6; + } + + let dataLength; + + if (typeof data === 'string') { + if ( + (!options.mask || skipMasking) && + options[kByteLength] !== undefined + ) { + dataLength = options[kByteLength]; + } else { + data = Buffer.from(data); + dataLength = data.length; + } + } else { + dataLength = data.length; + merge = options.mask && options.readOnly && !skipMasking; + } + + let payloadLength = dataLength; + + if (dataLength >= 65536) { + offset += 8; + payloadLength = 127; + } else if (dataLength > 125) { + offset += 2; + payloadLength = 126; + } + + const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset); + + target[0] = options.fin ? options.opcode | 0x80 : options.opcode; + if (options.rsv1) target[0] |= 0x40; + + target[1] = payloadLength; + + if (payloadLength === 126) { + target.writeUInt16BE(dataLength, 2); + } else if (payloadLength === 127) { + target[2] = target[3] = 0; + target.writeUIntBE(dataLength, 4, 6); + } + + if (!options.mask) return [target, data]; + + target[1] |= 0x80; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + + if (skipMasking) return [target, data]; + + if (merge) { + applyMask(data, mask, target, offset, dataLength); + return [target]; + } + + applyMask(data, mask, data, 0, dataLength); + return [target, data]; + } + + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {(String|Buffer)} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(code, data, mask, cb) { + let buf; + + if (code === undefined) { + buf = EMPTY_BUFFER; + } else if (typeof code !== 'number' || !isValidStatusCode(code)) { + throw new TypeError('First argument must be a valid error code number'); + } else if (data === undefined || !data.length) { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + const length = Buffer.byteLength(data); + + if (length > 123) { + throw new RangeError('The message must not be greater than 123 bytes'); + } + + buf = Buffer.allocUnsafe(2 + length); + buf.writeUInt16BE(code, 0); + + if (typeof data === 'string') { + buf.write(data, 2); + } else { + buf.set(data, 2); + } + } + + const options = { + [kByteLength]: buf.length, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x08, + readOnly: false, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, buf, false, options, cb]); + } else { + this.sendFrame(Sender.frame(buf, options), cb); + } + } + + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(data, mask, cb) { + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (byteLength > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + const options = { + [kByteLength]: byteLength, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x09, + readOnly, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, false, options, cb]); + } else { + this.sendFrame(Sender.frame(data, options), cb); + } + } + + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(data, mask, cb) { + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (byteLength > 125) { + throw new RangeError('The data size must not be greater than 125 bytes'); + } + + const options = { + [kByteLength]: byteLength, + fin: true, + generateMask: this._generateMask, + mask, + maskBuffer: this._maskBuffer, + opcode: 0x0a, + readOnly, + rsv1: false + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, false, options, cb]); + } else { + this.sendFrame(Sender.frame(data, options), cb); + } + } + + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(data, options, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + let opcode = options.binary ? 2 : 1; + let rsv1 = options.compress; + + let byteLength; + let readOnly; + + if (typeof data === 'string') { + byteLength = Buffer.byteLength(data); + readOnly = false; + } else { + data = toBuffer(data); + byteLength = data.length; + readOnly = toBuffer.readOnly; + } + + if (this._firstFragment) { + this._firstFragment = false; + if ( + rsv1 && + perMessageDeflate && + perMessageDeflate.params[ + perMessageDeflate._isServer + ? 'server_no_context_takeover' + : 'client_no_context_takeover' + ] + ) { + rsv1 = byteLength >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + + if (options.fin) this._firstFragment = true; + + if (perMessageDeflate) { + const opts = { + [kByteLength]: byteLength, + fin: options.fin, + generateMask: this._generateMask, + mask: options.mask, + maskBuffer: this._maskBuffer, + opcode, + readOnly, + rsv1 + }; + + if (this._deflating) { + this.enqueue([this.dispatch, data, this._compress, opts, cb]); + } else { + this.dispatch(data, this._compress, opts, cb); + } + } else { + this.sendFrame( + Sender.frame(data, { + [kByteLength]: byteLength, + fin: options.fin, + generateMask: this._generateMask, + mask: options.mask, + maskBuffer: this._maskBuffer, + opcode, + readOnly, + rsv1: false + }), + cb + ); + } + } + + /** + * Dispatches a message. + * + * @param {(Buffer|String)} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Buffer} [options.maskBuffer] The buffer used to store the masking + * key + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(Sender.frame(data, options), cb); + return; + } + + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + + this._bufferedBytes += options[kByteLength]; + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + if (this._socket.destroyed) { + const err = new Error( + 'The socket was closed while data was being compressed' + ); + + if (typeof cb === 'function') cb(err); + + for (let i = 0; i < this._queue.length; i++) { + const params = this._queue[i]; + const callback = params[params.length - 1]; + + if (typeof callback === 'function') callback(err); + } + + return; + } + + this._bufferedBytes -= options[kByteLength]; + this._deflating = false; + options.readOnly = false; + this.sendFrame(Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params = this._queue.shift(); + + this._bufferedBytes -= params[3][kByteLength]; + Reflect.apply(params[0], this, params.slice(1)); + } + } + + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params) { + this._bufferedBytes += params[3][kByteLength]; + this._queue.push(params); + } + + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.cork(); + this._socket.write(list[0]); + this._socket.write(list[1], cb); + this._socket.uncork(); + } else { + this._socket.write(list[0], cb); + } + } +} + +module.exports = Sender; diff --git a/graphql-subscription/node_modules/ws/lib/stream.js b/graphql-subscription/node_modules/ws/lib/stream.js new file mode 100644 index 0000000..230734b --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/stream.js @@ -0,0 +1,159 @@ +'use strict'; + +const { Duplex } = require('stream'); + +/** + * Emits the `'close'` event on a stream. + * + * @param {Duplex} stream The stream. + * @private + */ +function emitClose(stream) { + stream.emit('close'); +} + +/** + * The listener of the `'end'` event. + * + * @private + */ +function duplexOnEnd() { + if (!this.destroyed && this._writableState.finished) { + this.destroy(); + } +} + +/** + * The listener of the `'error'` event. + * + * @param {Error} err The error + * @private + */ +function duplexOnError(err) { + this.removeListener('error', duplexOnError); + this.destroy(); + if (this.listenerCount('error') === 0) { + // Do not suppress the throwing behavior. + this.emit('error', err); + } +} + +/** + * Wraps a `WebSocket` in a duplex stream. + * + * @param {WebSocket} ws The `WebSocket` to wrap + * @param {Object} [options] The options for the `Duplex` constructor + * @return {Duplex} The duplex stream + * @public + */ +function createWebSocketStream(ws, options) { + let terminateOnDestroy = true; + + const duplex = new Duplex({ + ...options, + autoDestroy: false, + emitClose: false, + objectMode: false, + writableObjectMode: false + }); + + ws.on('message', function message(msg, isBinary) { + const data = + !isBinary && duplex._readableState.objectMode ? msg.toString() : msg; + + if (!duplex.push(data)) ws.pause(); + }); + + ws.once('error', function error(err) { + if (duplex.destroyed) return; + + // Prevent `ws.terminate()` from being called by `duplex._destroy()`. + // + // - If the `'error'` event is emitted before the `'open'` event, then + // `ws.terminate()` is a noop as no socket is assigned. + // - Otherwise, the error is re-emitted by the listener of the `'error'` + // event of the `Receiver` object. The listener already closes the + // connection by calling `ws.close()`. This allows a close frame to be + // sent to the other peer. If `ws.terminate()` is called right after this, + // then the close frame might not be sent. + terminateOnDestroy = false; + duplex.destroy(err); + }); + + ws.once('close', function close() { + if (duplex.destroyed) return; + + duplex.push(null); + }); + + duplex._destroy = function (err, callback) { + if (ws.readyState === ws.CLOSED) { + callback(err); + process.nextTick(emitClose, duplex); + return; + } + + let called = false; + + ws.once('error', function error(err) { + called = true; + callback(err); + }); + + ws.once('close', function close() { + if (!called) callback(err); + process.nextTick(emitClose, duplex); + }); + + if (terminateOnDestroy) ws.terminate(); + }; + + duplex._final = function (callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._final(callback); + }); + return; + } + + // If the value of the `_socket` property is `null` it means that `ws` is a + // client websocket and the handshake failed. In fact, when this happens, a + // socket is never assigned to the websocket. Wait for the `'error'` event + // that will be emitted by the websocket. + if (ws._socket === null) return; + + if (ws._socket._writableState.finished) { + callback(); + if (duplex._readableState.endEmitted) duplex.destroy(); + } else { + ws._socket.once('finish', function finish() { + // `duplex` is not destroyed here because the `'end'` event will be + // emitted on `duplex` after this `'finish'` event. The EOF signaling + // `null` chunk is, in fact, pushed when the websocket emits `'close'`. + callback(); + }); + ws.close(); + } + }; + + duplex._read = function () { + if (ws.isPaused) ws.resume(); + }; + + duplex._write = function (chunk, encoding, callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once('open', function open() { + duplex._write(chunk, encoding, callback); + }); + return; + } + + ws.send(chunk, callback); + }; + + duplex.on('end', duplexOnEnd); + duplex.on('error', duplexOnError); + return duplex; +} + +module.exports = createWebSocketStream; diff --git a/graphql-subscription/node_modules/ws/lib/subprotocol.js b/graphql-subscription/node_modules/ws/lib/subprotocol.js new file mode 100644 index 0000000..d4381e8 --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/subprotocol.js @@ -0,0 +1,62 @@ +'use strict'; + +const { tokenChars } = require('./validation'); + +/** + * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names. + * + * @param {String} header The field value of the header + * @return {Set} The subprotocol names + * @public + */ +function parse(header) { + const protocols = new Set(); + let start = -1; + let end = -1; + let i = 0; + + for (i; i < header.length; i++) { + const code = header.charCodeAt(i); + + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if ( + i !== 0 && + (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */ + ) { + if (end === -1 && start !== -1) end = i; + } else if (code === 0x2c /* ',' */) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + + if (end === -1) end = i; + + const protocol = header.slice(start, end); + + if (protocols.has(protocol)) { + throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); + } + + protocols.add(protocol); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + + if (start === -1 || end !== -1) { + throw new SyntaxError('Unexpected end of input'); + } + + const protocol = header.slice(start, i); + + if (protocols.has(protocol)) { + throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`); + } + + protocols.add(protocol); + return protocols; +} + +module.exports = { parse }; diff --git a/graphql-subscription/node_modules/ws/lib/validation.js b/graphql-subscription/node_modules/ws/lib/validation.js new file mode 100644 index 0000000..c352e6e --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/validation.js @@ -0,0 +1,130 @@ +'use strict'; + +const { isUtf8 } = require('buffer'); + +// +// Allowed token characters: +// +// '!', '#', '$', '%', '&', ''', '*', '+', '-', +// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' +// +// tokenChars[32] === 0 // ' ' +// tokenChars[33] === 1 // '!' +// tokenChars[34] === 0 // '"' +// ... +// +// prettier-ignore +const tokenChars = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 + 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 +]; + +/** + * Checks if a status code is allowed in a close frame. + * + * @param {Number} code The status code + * @return {Boolean} `true` if the status code is valid, else `false` + * @public + */ +function isValidStatusCode(code) { + return ( + (code >= 1000 && + code <= 1014 && + code !== 1004 && + code !== 1005 && + code !== 1006) || + (code >= 3000 && code <= 4999) + ); +} + +/** + * Checks if a given buffer contains only correct UTF-8. + * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by + * Markus Kuhn. + * + * @param {Buffer} buf The buffer to check + * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false` + * @public + */ +function _isValidUTF8(buf) { + const len = buf.length; + let i = 0; + + while (i < len) { + if ((buf[i] & 0x80) === 0) { + // 0xxxxxxx + i++; + } else if ((buf[i] & 0xe0) === 0xc0) { + // 110xxxxx 10xxxxxx + if ( + i + 1 === len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i] & 0xfe) === 0xc0 // Overlong + ) { + return false; + } + + i += 2; + } else if ((buf[i] & 0xf0) === 0xe0) { + // 1110xxxx 10xxxxxx 10xxxxxx + if ( + i + 2 >= len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i + 2] & 0xc0) !== 0x80 || + (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong + (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF) + ) { + return false; + } + + i += 3; + } else if ((buf[i] & 0xf8) === 0xf0) { + // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + if ( + i + 3 >= len || + (buf[i + 1] & 0xc0) !== 0x80 || + (buf[i + 2] & 0xc0) !== 0x80 || + (buf[i + 3] & 0xc0) !== 0x80 || + (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong + (buf[i] === 0xf4 && buf[i + 1] > 0x8f) || + buf[i] > 0xf4 // > U+10FFFF + ) { + return false; + } + + i += 4; + } else { + return false; + } + } + + return true; +} + +module.exports = { + isValidStatusCode, + isValidUTF8: _isValidUTF8, + tokenChars +}; + +if (isUtf8) { + module.exports.isValidUTF8 = function (buf) { + return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf); + }; +} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) { + try { + const isValidUTF8 = require('utf-8-validate'); + + module.exports.isValidUTF8 = function (buf) { + return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf); + }; + } catch (e) { + // Continue regardless of the error. + } +} diff --git a/graphql-subscription/node_modules/ws/lib/websocket-server.js b/graphql-subscription/node_modules/ws/lib/websocket-server.js new file mode 100644 index 0000000..377c45a --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/websocket-server.js @@ -0,0 +1,539 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$" }] */ + +'use strict'; + +const EventEmitter = require('events'); +const http = require('http'); +const { Duplex } = require('stream'); +const { createHash } = require('crypto'); + +const extension = require('./extension'); +const PerMessageDeflate = require('./permessage-deflate'); +const subprotocol = require('./subprotocol'); +const WebSocket = require('./websocket'); +const { GUID, kWebSocket } = require('./constants'); + +const keyRegex = /^[+/0-9A-Za-z]{22}==$/; + +const RUNNING = 0; +const CLOSING = 1; +const CLOSED = 2; + +/** + * Class representing a WebSocket server. + * + * @extends EventEmitter + */ +class WebSocketServer extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {Boolean} [options.autoPong=true] Specifies whether or not to + * automatically send a pong in response to a ping + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S + * server to use + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket` + * class to use. It must be the `WebSocket` class or class that extends it + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(options, callback) { + super(); + + options = { + allowSynchronousEvents: false, + autoPong: true, + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: false, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + WebSocket, + ...options + }; + + if ( + (options.port == null && !options.server && !options.noServer) || + (options.port != null && (options.server || options.noServer)) || + (options.server && options.noServer) + ) { + throw new TypeError( + 'One and only one of the "port", "server", or "noServer" options ' + + 'must be specified' + ); + } + + if (options.port != null) { + this._server = http.createServer((req, res) => { + const body = http.STATUS_CODES[426]; + + res.writeHead(426, { + 'Content-Length': body.length, + 'Content-Type': 'text/plain' + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + this._server = options.server; + } + + if (this._server) { + const emitConnection = this.emit.bind(this, 'connection'); + + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, 'listening'), + error: this.emit.bind(this, 'error'), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, emitConnection); + } + }); + } + + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) { + this.clients = new Set(); + this._shouldEmitClose = false; + } + + this.options = options; + this._state = RUNNING; + } + + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + + if (!this._server) return null; + return this._server.address(); + } + + /** + * Stop the server from accepting new connections and emit the `'close'` event + * when all existing connections are closed. + * + * @param {Function} [cb] A one-time listener for the `'close'` event + * @public + */ + close(cb) { + if (this._state === CLOSED) { + if (cb) { + this.once('close', () => { + cb(new Error('The server is not running')); + }); + } + + process.nextTick(emitClose, this); + return; + } + + if (cb) this.once('close', cb); + + if (this._state === CLOSING) return; + this._state = CLOSING; + + if (this.options.noServer || this.options.server) { + if (this._server) { + this._removeListeners(); + this._removeListeners = this._server = null; + } + + if (this.clients) { + if (!this.clients.size) { + process.nextTick(emitClose, this); + } else { + this._shouldEmitClose = true; + } + } else { + process.nextTick(emitClose, this); + } + } else { + const server = this._server; + + this._removeListeners(); + this._removeListeners = this._server = null; + + // + // The HTTP/S server was created internally. Close it, and rely on its + // `'close'` event. + // + server.close(() => { + emitClose(this); + }); + } + } + + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf('?'); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + + if (pathname !== this.options.path) return false; + } + + return true; + } + + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on('error', socketOnError); + + const key = req.headers['sec-websocket-key']; + const version = +req.headers['sec-websocket-version']; + + if (req.method !== 'GET') { + const message = 'Invalid HTTP method'; + abortHandshakeOrEmitwsClientError(this, req, socket, 405, message); + return; + } + + if (req.headers.upgrade.toLowerCase() !== 'websocket') { + const message = 'Invalid Upgrade header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (!key || !keyRegex.test(key)) { + const message = 'Missing or invalid Sec-WebSocket-Key header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (version !== 8 && version !== 13) { + const message = 'Missing or invalid Sec-WebSocket-Version header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + + if (!this.shouldHandle(req)) { + abortHandshake(socket, 400); + return; + } + + const secWebSocketProtocol = req.headers['sec-websocket-protocol']; + let protocols = new Set(); + + if (secWebSocketProtocol !== undefined) { + try { + protocols = subprotocol.parse(secWebSocketProtocol); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Protocol header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + } + + const secWebSocketExtensions = req.headers['sec-websocket-extensions']; + const extensions = {}; + + if ( + this.options.perMessageDeflate && + secWebSocketExtensions !== undefined + ) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + + try { + const offers = extension.parse(secWebSocketExtensions); + + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + const message = + 'Invalid or unacceptable Sec-WebSocket-Extensions header'; + abortHandshakeOrEmitwsClientError(this, req, socket, 400, message); + return; + } + } + + // + // Optionally call external client verification handler. + // + if (this.options.verifyClient) { + const info = { + origin: + req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], + secure: !!(req.socket.authorized || req.socket.encrypted), + req + }; + + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + + this.completeUpgrade( + extensions, + key, + protocols, + req, + socket, + head, + cb + ); + }); + return; + } + + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + + this.completeUpgrade(extensions, key, protocols, req, socket, head, cb); + } + + /** + * Upgrade the connection to WebSocket. + * + * @param {Object} extensions The accepted extensions + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Set} protocols The subprotocols + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(extensions, key, protocols, req, socket, head, cb) { + // + // Destroy the socket if the client has already sent a FIN packet. + // + if (!socket.readable || !socket.writable) return socket.destroy(); + + if (socket[kWebSocket]) { + throw new Error( + 'server.handleUpgrade() was called more than once with the same ' + + 'socket, possibly due to a misconfiguration' + ); + } + + if (this._state > RUNNING) return abortHandshake(socket, 503); + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + const headers = [ + 'HTTP/1.1 101 Switching Protocols', + 'Upgrade: websocket', + 'Connection: Upgrade', + `Sec-WebSocket-Accept: ${digest}` + ]; + + const ws = new this.options.WebSocket(null, undefined, this.options); + + if (protocols.size) { + // + // Optionally call external protocol selection handler. + // + const protocol = this.options.handleProtocols + ? this.options.handleProtocols(protocols, req) + : protocols.values().next().value; + + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws._protocol = protocol; + } + } + + if (extensions[PerMessageDeflate.extensionName]) { + const params = extensions[PerMessageDeflate.extensionName].params; + const value = extension.format({ + [PerMessageDeflate.extensionName]: [params] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + + // + // Allow external modification/inspection of handshake headers. + // + this.emit('headers', headers, req); + + socket.write(headers.concat('\r\n').join('\r\n')); + socket.removeListener('error', socketOnError); + + ws.setSocket(socket, head, { + allowSynchronousEvents: this.options.allowSynchronousEvents, + maxPayload: this.options.maxPayload, + skipUTF8Validation: this.options.skipUTF8Validation + }); + + if (this.clients) { + this.clients.add(ws); + ws.on('close', () => { + this.clients.delete(ws); + + if (this._shouldEmitClose && !this.clients.size) { + process.nextTick(emitClose, this); + } + }); + } + + cb(ws, req); + } +} + +module.exports = WebSocketServer; + +/** + * Add event listeners on an `EventEmitter` using a map of + * pairs. + * + * @param {EventEmitter} server The event emitter + * @param {Object.} map The listeners to add + * @return {Function} A function that will remove the added listeners when + * called + * @private + */ +function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; +} + +/** + * Emit a `'close'` event on an `EventEmitter`. + * + * @param {EventEmitter} server The event emitter + * @private + */ +function emitClose(server) { + server._state = CLOSED; + server.emit('close'); +} + +/** + * Handle socket errors. + * + * @private + */ +function socketOnError() { + this.destroy(); +} + +/** + * Close the connection when preconditions are not fulfilled. + * + * @param {Duplex} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} [message] The HTTP response body + * @param {Object} [headers] Additional HTTP response headers + * @private + */ +function abortHandshake(socket, code, message, headers) { + // + // The socket is writable unless the user destroyed or ended it before calling + // `server.handleUpgrade()` or in the `verifyClient` function, which is a user + // error. Handling this does not make much sense as the worst that can happen + // is that some of the data written by the user might be discarded due to the + // call to `socket.end()` below, which triggers an `'error'` event that in + // turn causes the socket to be destroyed. + // + message = message || http.STATUS_CODES[code]; + headers = { + Connection: 'close', + 'Content-Type': 'text/html', + 'Content-Length': Buffer.byteLength(message), + ...headers + }; + + socket.once('finish', socket.destroy); + + socket.end( + `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + + Object.keys(headers) + .map((h) => `${h}: ${headers[h]}`) + .join('\r\n') + + '\r\n\r\n' + + message + ); +} + +/** + * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least + * one listener for it, otherwise call `abortHandshake()`. + * + * @param {WebSocketServer} server The WebSocket server + * @param {http.IncomingMessage} req The request object + * @param {Duplex} socket The socket of the upgrade request + * @param {Number} code The HTTP response status code + * @param {String} message The HTTP response body + * @private + */ +function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) { + if (server.listenerCount('wsClientError')) { + const err = new Error(message); + Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError); + + server.emit('wsClientError', err, socket, req); + } else { + abortHandshake(socket, code, message); + } +} diff --git a/graphql-subscription/node_modules/ws/lib/websocket.js b/graphql-subscription/node_modules/ws/lib/websocket.js new file mode 100644 index 0000000..df5034c --- /dev/null +++ b/graphql-subscription/node_modules/ws/lib/websocket.js @@ -0,0 +1,1336 @@ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$" }] */ + +'use strict'; + +const EventEmitter = require('events'); +const https = require('https'); +const http = require('http'); +const net = require('net'); +const tls = require('tls'); +const { randomBytes, createHash } = require('crypto'); +const { Duplex, Readable } = require('stream'); +const { URL } = require('url'); + +const PerMessageDeflate = require('./permessage-deflate'); +const Receiver = require('./receiver'); +const Sender = require('./sender'); +const { + BINARY_TYPES, + EMPTY_BUFFER, + GUID, + kForOnEventAttribute, + kListener, + kStatusCode, + kWebSocket, + NOOP +} = require('./constants'); +const { + EventTarget: { addEventListener, removeEventListener } +} = require('./event-target'); +const { format, parse } = require('./extension'); +const { toBuffer } = require('./buffer-util'); + +const closeTimeout = 30 * 1000; +const kAborted = Symbol('kAborted'); +const protocolVersions = [8, 13]; +const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; +const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/; + +/** + * Class representing a WebSocket. + * + * @extends EventEmitter + */ +class WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(address, protocols, options) { + super(); + + this._binaryType = BINARY_TYPES[0]; + this._closeCode = 1006; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = EMPTY_BUFFER; + this._closeTimer = null; + this._extensions = {}; + this._paused = false; + this._protocol = ''; + this._readyState = WebSocket.CONNECTING; + this._receiver = null; + this._sender = null; + this._socket = null; + + if (address !== null) { + this._bufferedAmount = 0; + this._isServer = false; + this._redirects = 0; + + if (protocols === undefined) { + protocols = []; + } else if (!Array.isArray(protocols)) { + if (typeof protocols === 'object' && protocols !== null) { + options = protocols; + protocols = []; + } else { + protocols = [protocols]; + } + } + + initAsClient(this, address, protocols, options); + } else { + this._autoPong = options.autoPong; + this._isServer = true; + } + } + + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + + set binaryType(type) { + if (!BINARY_TYPES.includes(type)) return; + + this._binaryType = type; + + // + // Allow to change `binaryType` on the fly. + // + if (this._receiver) this._receiver._binaryType = type; + } + + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return this._bufferedAmount; + + return this._socket._writableState.length + this._sender._bufferedBytes; + } + + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + + /** + * @type {Boolean} + */ + get isPaused() { + return this._paused; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onclose() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onerror() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onopen() { + return null; + } + + /** + * @type {Function} + */ + /* istanbul ignore next */ + get onmessage() { + return null; + } + + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + + /** + * @type {String} + */ + get url() { + return this._url; + } + + /** + * Set up the socket and the internal resources. + * + * @param {Duplex} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Object} options Options object + * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether + * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted + * multiple times in the same tick + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.maxPayload=0] The maximum allowed message size + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ + setSocket(socket, head, options) { + const receiver = new Receiver({ + allowSynchronousEvents: options.allowSynchronousEvents, + binaryType: this.binaryType, + extensions: this._extensions, + isServer: this._isServer, + maxPayload: options.maxPayload, + skipUTF8Validation: options.skipUTF8Validation + }); + + this._sender = new Sender(socket, this._extensions, options.generateMask); + this._receiver = receiver; + this._socket = socket; + + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + + receiver.on('conclude', receiverOnConclude); + receiver.on('drain', receiverOnDrain); + receiver.on('error', receiverOnError); + receiver.on('message', receiverOnMessage); + receiver.on('ping', receiverOnPing); + receiver.on('pong', receiverOnPong); + + // + // These methods may not be available if `socket` is just a `Duplex`. + // + if (socket.setTimeout) socket.setTimeout(0); + if (socket.setNoDelay) socket.setNoDelay(); + + if (head.length > 0) socket.unshift(head); + + socket.on('close', socketOnClose); + socket.on('data', socketOnData); + socket.on('end', socketOnEnd); + socket.on('error', socketOnError); + + this._readyState = WebSocket.OPEN; + this.emit('open'); + } + + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + return; + } + + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + + this._receiver.removeAllListeners(); + this._readyState = WebSocket.CLOSED; + this.emit('close', this._closeCode, this._closeMessage); + } + + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {(String|Buffer)} [data] The reason why the connection is + * closing + * @public + */ + close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + abortHandshake(this, this._req, msg); + return; + } + + if (this.readyState === WebSocket.CLOSING) { + if ( + this._closeFrameSent && + (this._closeFrameReceived || this._receiver._writableState.errorEmitted) + ) { + this._socket.end(); + } + + return; + } + + this._readyState = WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + // + // This error is handled by the `'error'` listener on the socket. We only + // want to know if the close frame has been sent here. + // + if (err) return; + + this._closeFrameSent = true; + + if ( + this._closeFrameReceived || + this._receiver._writableState.errorEmitted + ) { + this._socket.end(); + } + }); + + // + // Specify a timeout for the closing handshake to complete. + // + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + + /** + * Pause the socket. + * + * @public + */ + pause() { + if ( + this.readyState === WebSocket.CONNECTING || + this.readyState === WebSocket.CLOSED + ) { + return; + } + + this._paused = true; + this._socket.pause(); + } + + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.ping(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof data === 'function') { + cb = data; + data = mask = undefined; + } else if (typeof mask === 'function') { + cb = mask; + mask = undefined; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + if (mask === undefined) mask = !this._isServer; + this._sender.pong(data || EMPTY_BUFFER, mask, cb); + } + + /** + * Resume the socket. + * + * @public + */ + resume() { + if ( + this.readyState === WebSocket.CONNECTING || + this.readyState === WebSocket.CLOSED + ) { + return; + } + + this._paused = false; + if (!this._receiver._writableState.needDrain) this._socket.resume(); + } + + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (this.readyState === WebSocket.CONNECTING) { + throw new Error('WebSocket is not open: readyState 0 (CONNECTING)'); + } + + if (typeof options === 'function') { + cb = options; + options = {}; + } + + if (typeof data === 'number') data = data.toString(); + + if (this.readyState !== WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + + const opts = { + binary: typeof data !== 'string', + mask: !this._isServer, + compress: true, + fin: true, + ...options + }; + + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + + this._sender.send(data || EMPTY_BUFFER, opts, cb); + } + + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === WebSocket.CLOSED) return; + if (this.readyState === WebSocket.CONNECTING) { + const msg = 'WebSocket was closed before the connection was established'; + abortHandshake(this, this._req, msg); + return; + } + + if (this._socket) { + this._readyState = WebSocket.CLOSING; + this._socket.destroy(); + } + } +} + +/** + * @constant {Number} CONNECTING + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CONNECTING', { + enumerable: true, + value: readyStates.indexOf('CONNECTING') +}); + +/** + * @constant {Number} CONNECTING + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CONNECTING', { + enumerable: true, + value: readyStates.indexOf('CONNECTING') +}); + +/** + * @constant {Number} OPEN + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'OPEN', { + enumerable: true, + value: readyStates.indexOf('OPEN') +}); + +/** + * @constant {Number} OPEN + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'OPEN', { + enumerable: true, + value: readyStates.indexOf('OPEN') +}); + +/** + * @constant {Number} CLOSING + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CLOSING', { + enumerable: true, + value: readyStates.indexOf('CLOSING') +}); + +/** + * @constant {Number} CLOSING + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CLOSING', { + enumerable: true, + value: readyStates.indexOf('CLOSING') +}); + +/** + * @constant {Number} CLOSED + * @memberof WebSocket + */ +Object.defineProperty(WebSocket, 'CLOSED', { + enumerable: true, + value: readyStates.indexOf('CLOSED') +}); + +/** + * @constant {Number} CLOSED + * @memberof WebSocket.prototype + */ +Object.defineProperty(WebSocket.prototype, 'CLOSED', { + enumerable: true, + value: readyStates.indexOf('CLOSED') +}); + +[ + 'binaryType', + 'bufferedAmount', + 'extensions', + 'isPaused', + 'protocol', + 'readyState', + 'url' +].forEach((property) => { + Object.defineProperty(WebSocket.prototype, property, { enumerable: true }); +}); + +// +// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. +// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface +// +['open', 'error', 'close', 'message'].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + enumerable: true, + get() { + for (const listener of this.listeners(method)) { + if (listener[kForOnEventAttribute]) return listener[kListener]; + } + + return null; + }, + set(handler) { + for (const listener of this.listeners(method)) { + if (listener[kForOnEventAttribute]) { + this.removeListener(method, listener); + break; + } + } + + if (typeof handler !== 'function') return; + + this.addEventListener(method, handler, { + [kForOnEventAttribute]: true + }); + } + }); +}); + +WebSocket.prototype.addEventListener = addEventListener; +WebSocket.prototype.removeEventListener = removeEventListener; + +module.exports = WebSocket; + +/** + * Initialize a WebSocket client. + * + * @param {WebSocket} websocket The client to initialize + * @param {(String|URL)} address The URL to which to connect + * @param {Array} protocols The subprotocols + * @param {Object} [options] Connection options + * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether any + * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple + * times in the same tick + * @param {Boolean} [options.autoPong=true] Specifies whether or not to + * automatically send a pong in response to a ping + * @param {Function} [options.finishRequest] A function which can be used to + * customize the headers of each http request before it is sent + * @param {Boolean} [options.followRedirects=false] Whether or not to follow + * redirects + * @param {Function} [options.generateMask] The function used to generate the + * masking key + * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the + * handshake request + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Number} [options.maxRedirects=10] The maximum number of redirects + * allowed + * @param {String} [options.origin] Value of the `Origin` or + * `Sec-WebSocket-Origin` header + * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable + * permessage-deflate + * @param {Number} [options.protocolVersion=13] Value of the + * `Sec-WebSocket-Version` header + * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or + * not to skip UTF-8 validation for text and close messages + * @private + */ +function initAsClient(websocket, address, protocols, options) { + const opts = { + allowSynchronousEvents: false, + autoPong: true, + protocolVersion: protocolVersions[1], + maxPayload: 100 * 1024 * 1024, + skipUTF8Validation: false, + perMessageDeflate: true, + followRedirects: false, + maxRedirects: 10, + ...options, + createConnection: undefined, + socketPath: undefined, + hostname: undefined, + protocol: undefined, + timeout: undefined, + method: 'GET', + host: undefined, + path: undefined, + port: undefined + }; + + websocket._autoPong = opts.autoPong; + + if (!protocolVersions.includes(opts.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${opts.protocolVersion} ` + + `(supported versions: ${protocolVersions.join(', ')})` + ); + } + + let parsedUrl; + + if (address instanceof URL) { + parsedUrl = address; + } else { + try { + parsedUrl = new URL(address); + } catch (e) { + throw new SyntaxError(`Invalid URL: ${address}`); + } + } + + if (parsedUrl.protocol === 'http:') { + parsedUrl.protocol = 'ws:'; + } else if (parsedUrl.protocol === 'https:') { + parsedUrl.protocol = 'wss:'; + } + + websocket._url = parsedUrl.href; + + const isSecure = parsedUrl.protocol === 'wss:'; + const isIpcUrl = parsedUrl.protocol === 'ws+unix:'; + let invalidUrlMessage; + + if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) { + invalidUrlMessage = + 'The URL\'s protocol must be one of "ws:", "wss:", ' + + '"http:", "https", or "ws+unix:"'; + } else if (isIpcUrl && !parsedUrl.pathname) { + invalidUrlMessage = "The URL's pathname is empty"; + } else if (parsedUrl.hash) { + invalidUrlMessage = 'The URL contains a fragment identifier'; + } + + if (invalidUrlMessage) { + const err = new SyntaxError(invalidUrlMessage); + + if (websocket._redirects === 0) { + throw err; + } else { + emitErrorAndClose(websocket, err); + return; + } + } + + const defaultPort = isSecure ? 443 : 80; + const key = randomBytes(16).toString('base64'); + const request = isSecure ? https.request : http.request; + const protocolSet = new Set(); + let perMessageDeflate; + + opts.createConnection = isSecure ? tlsConnect : netConnect; + opts.defaultPort = opts.defaultPort || defaultPort; + opts.port = parsedUrl.port || defaultPort; + opts.host = parsedUrl.hostname.startsWith('[') + ? parsedUrl.hostname.slice(1, -1) + : parsedUrl.hostname; + opts.headers = { + ...opts.headers, + 'Sec-WebSocket-Version': opts.protocolVersion, + 'Sec-WebSocket-Key': key, + Connection: 'Upgrade', + Upgrade: 'websocket' + }; + opts.path = parsedUrl.pathname + parsedUrl.search; + opts.timeout = opts.handshakeTimeout; + + if (opts.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, + false, + opts.maxPayload + ); + opts.headers['Sec-WebSocket-Extensions'] = format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols.length) { + for (const protocol of protocols) { + if ( + typeof protocol !== 'string' || + !subprotocolRegex.test(protocol) || + protocolSet.has(protocol) + ) { + throw new SyntaxError( + 'An invalid or duplicated subprotocol was specified' + ); + } + + protocolSet.add(protocol); + } + + opts.headers['Sec-WebSocket-Protocol'] = protocols.join(','); + } + if (opts.origin) { + if (opts.protocolVersion < 13) { + opts.headers['Sec-WebSocket-Origin'] = opts.origin; + } else { + opts.headers.Origin = opts.origin; + } + } + if (parsedUrl.username || parsedUrl.password) { + opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + + if (isIpcUrl) { + const parts = opts.path.split(':'); + + opts.socketPath = parts[0]; + opts.path = parts[1]; + } + + let req; + + if (opts.followRedirects) { + if (websocket._redirects === 0) { + websocket._originalIpc = isIpcUrl; + websocket._originalSecure = isSecure; + websocket._originalHostOrSocketPath = isIpcUrl + ? opts.socketPath + : parsedUrl.host; + + const headers = options && options.headers; + + // + // Shallow copy the user provided options so that headers can be changed + // without mutating the original object. + // + options = { ...options, headers: {} }; + + if (headers) { + for (const [key, value] of Object.entries(headers)) { + options.headers[key.toLowerCase()] = value; + } + } + } else if (websocket.listenerCount('redirect') === 0) { + const isSameHost = isIpcUrl + ? websocket._originalIpc + ? opts.socketPath === websocket._originalHostOrSocketPath + : false + : websocket._originalIpc + ? false + : parsedUrl.host === websocket._originalHostOrSocketPath; + + if (!isSameHost || (websocket._originalSecure && !isSecure)) { + // + // Match curl 7.77.0 behavior and drop the following headers. These + // headers are also dropped when following a redirect to a subdomain. + // + delete opts.headers.authorization; + delete opts.headers.cookie; + + if (!isSameHost) delete opts.headers.host; + + opts.auth = undefined; + } + } + + // + // Match curl 7.77.0 behavior and make the first `Authorization` header win. + // If the `Authorization` header is set, then there is nothing to do as it + // will take precedence. + // + if (opts.auth && !options.headers.authorization) { + options.headers.authorization = + 'Basic ' + Buffer.from(opts.auth).toString('base64'); + } + + req = websocket._req = request(opts); + + if (websocket._redirects) { + // + // Unlike what is done for the `'upgrade'` event, no early exit is + // triggered here if the user calls `websocket.close()` or + // `websocket.terminate()` from a listener of the `'redirect'` event. This + // is because the user can also call `request.destroy()` with an error + // before calling `websocket.close()` or `websocket.terminate()` and this + // would result in an error being emitted on the `request` object with no + // `'error'` event listeners attached. + // + websocket.emit('redirect', websocket.url, req); + } + } else { + req = websocket._req = request(opts); + } + + if (opts.timeout) { + req.on('timeout', () => { + abortHandshake(websocket, req, 'Opening handshake has timed out'); + }); + } + + req.on('error', (err) => { + if (req === null || req[kAborted]) return; + + req = websocket._req = null; + emitErrorAndClose(websocket, err); + }); + + req.on('response', (res) => { + const location = res.headers.location; + const statusCode = res.statusCode; + + if ( + location && + opts.followRedirects && + statusCode >= 300 && + statusCode < 400 + ) { + if (++websocket._redirects > opts.maxRedirects) { + abortHandshake(websocket, req, 'Maximum redirects exceeded'); + return; + } + + req.abort(); + + let addr; + + try { + addr = new URL(location, address); + } catch (e) { + const err = new SyntaxError(`Invalid URL: ${location}`); + emitErrorAndClose(websocket, err); + return; + } + + initAsClient(websocket, addr, protocols, options); + } else if (!websocket.emit('unexpected-response', req, res)) { + abortHandshake( + websocket, + req, + `Unexpected server response: ${res.statusCode}` + ); + } + }); + + req.on('upgrade', (res, socket, head) => { + websocket.emit('upgrade', res); + + // + // The user may have closed the connection from a listener of the + // `'upgrade'` event. + // + if (websocket.readyState !== WebSocket.CONNECTING) return; + + req = websocket._req = null; + + if (res.headers.upgrade.toLowerCase() !== 'websocket') { + abortHandshake(websocket, socket, 'Invalid Upgrade header'); + return; + } + + const digest = createHash('sha1') + .update(key + GUID) + .digest('base64'); + + if (res.headers['sec-websocket-accept'] !== digest) { + abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header'); + return; + } + + const serverProt = res.headers['sec-websocket-protocol']; + let protError; + + if (serverProt !== undefined) { + if (!protocolSet.size) { + protError = 'Server sent a subprotocol but none was requested'; + } else if (!protocolSet.has(serverProt)) { + protError = 'Server sent an invalid subprotocol'; + } + } else if (protocolSet.size) { + protError = 'Server sent no subprotocol'; + } + + if (protError) { + abortHandshake(websocket, socket, protError); + return; + } + + if (serverProt) websocket._protocol = serverProt; + + const secWebSocketExtensions = res.headers['sec-websocket-extensions']; + + if (secWebSocketExtensions !== undefined) { + if (!perMessageDeflate) { + const message = + 'Server sent a Sec-WebSocket-Extensions header but no extension ' + + 'was requested'; + abortHandshake(websocket, socket, message); + return; + } + + let extensions; + + try { + extensions = parse(secWebSocketExtensions); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Extensions header'; + abortHandshake(websocket, socket, message); + return; + } + + const extensionNames = Object.keys(extensions); + + if ( + extensionNames.length !== 1 || + extensionNames[0] !== PerMessageDeflate.extensionName + ) { + const message = 'Server indicated an extension that was not requested'; + abortHandshake(websocket, socket, message); + return; + } + + try { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + } catch (err) { + const message = 'Invalid Sec-WebSocket-Extensions header'; + abortHandshake(websocket, socket, message); + return; + } + + websocket._extensions[PerMessageDeflate.extensionName] = + perMessageDeflate; + } + + websocket.setSocket(socket, head, { + allowSynchronousEvents: opts.allowSynchronousEvents, + generateMask: opts.generateMask, + maxPayload: opts.maxPayload, + skipUTF8Validation: opts.skipUTF8Validation + }); + }); + + if (opts.finishRequest) { + opts.finishRequest(req, websocket); + } else { + req.end(); + } +} + +/** + * Emit the `'error'` and `'close'` events. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {Error} The error to emit + * @private + */ +function emitErrorAndClose(websocket, err) { + websocket._readyState = WebSocket.CLOSING; + websocket.emit('error', err); + websocket.emitClose(); +} + +/** + * Create a `net.Socket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {net.Socket} The newly created socket used to start the connection + * @private + */ +function netConnect(options) { + options.path = options.socketPath; + return net.connect(options); +} + +/** + * Create a `tls.TLSSocket` and initiate a connection. + * + * @param {Object} options Connection options + * @return {tls.TLSSocket} The newly created socket used to start the connection + * @private + */ +function tlsConnect(options) { + options.path = undefined; + + if (!options.servername && options.servername !== '') { + options.servername = net.isIP(options.host) ? '' : options.host; + } + + return tls.connect(options); +} + +/** + * Abort the handshake and emit an error. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to + * abort or the socket to destroy + * @param {String} message The error message + * @private + */ +function abortHandshake(websocket, stream, message) { + websocket._readyState = WebSocket.CLOSING; + + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + + if (stream.setHeader) { + stream[kAborted] = true; + stream.abort(); + + if (stream.socket && !stream.socket.destroyed) { + // + // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if + // called after the request completed. See + // https://github.com/websockets/ws/issues/1869. + // + stream.socket.destroy(); + } + + process.nextTick(emitErrorAndClose, websocket, err); + } else { + stream.destroy(err); + stream.once('error', websocket.emit.bind(websocket, 'error')); + stream.once('close', websocket.emitClose.bind(websocket)); + } +} + +/** + * Handle cases where the `ping()`, `pong()`, or `send()` methods are called + * when the `readyState` attribute is `CLOSING` or `CLOSED`. + * + * @param {WebSocket} websocket The WebSocket instance + * @param {*} [data] The data to send + * @param {Function} [cb] Callback + * @private + */ +function sendAfterClose(websocket, data, cb) { + if (data) { + const length = toBuffer(data).length; + + // + // The `_bufferedAmount` property is used only when the peer is a client and + // the opening handshake fails. Under these circumstances, in fact, the + // `setSocket()` method is not called, so the `_socket` and `_sender` + // properties are set to `null`. + // + if (websocket._socket) websocket._sender._bufferedBytes += length; + else websocket._bufferedAmount += length; + } + + if (cb) { + const err = new Error( + `WebSocket is not open: readyState ${websocket.readyState} ` + + `(${readyStates[websocket.readyState]})` + ); + process.nextTick(cb, err); + } +} + +/** + * The listener of the `Receiver` `'conclude'` event. + * + * @param {Number} code The status code + * @param {Buffer} reason The reason for closing + * @private + */ +function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + + if (websocket._socket[kWebSocket] === undefined) return; + + websocket._socket.removeListener('data', socketOnData); + process.nextTick(resume, websocket._socket); + + if (code === 1005) websocket.close(); + else websocket.close(code, reason); +} + +/** + * The listener of the `Receiver` `'drain'` event. + * + * @private + */ +function receiverOnDrain() { + const websocket = this[kWebSocket]; + + if (!websocket.isPaused) websocket._socket.resume(); +} + +/** + * The listener of the `Receiver` `'error'` event. + * + * @param {(RangeError|Error)} err The emitted error + * @private + */ +function receiverOnError(err) { + const websocket = this[kWebSocket]; + + if (websocket._socket[kWebSocket] !== undefined) { + websocket._socket.removeListener('data', socketOnData); + + // + // On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See + // https://github.com/websockets/ws/issues/1940. + // + process.nextTick(resume, websocket._socket); + + websocket.close(err[kStatusCode]); + } + + websocket.emit('error', err); +} + +/** + * The listener of the `Receiver` `'finish'` event. + * + * @private + */ +function receiverOnFinish() { + this[kWebSocket].emitClose(); +} + +/** + * The listener of the `Receiver` `'message'` event. + * + * @param {Buffer|ArrayBuffer|Buffer[])} data The message + * @param {Boolean} isBinary Specifies whether the message is binary or not + * @private + */ +function receiverOnMessage(data, isBinary) { + this[kWebSocket].emit('message', data, isBinary); +} + +/** + * The listener of the `Receiver` `'ping'` event. + * + * @param {Buffer} data The data included in the ping frame + * @private + */ +function receiverOnPing(data) { + const websocket = this[kWebSocket]; + + if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP); + websocket.emit('ping', data); +} + +/** + * The listener of the `Receiver` `'pong'` event. + * + * @param {Buffer} data The data included in the pong frame + * @private + */ +function receiverOnPong(data) { + this[kWebSocket].emit('pong', data); +} + +/** + * Resume a readable stream + * + * @param {Readable} stream The readable stream + * @private + */ +function resume(stream) { + stream.resume(); +} + +/** + * The listener of the socket `'close'` event. + * + * @private + */ +function socketOnClose() { + const websocket = this[kWebSocket]; + + this.removeListener('close', socketOnClose); + this.removeListener('data', socketOnData); + this.removeListener('end', socketOnEnd); + + websocket._readyState = WebSocket.CLOSING; + + let chunk; + + // + // The close frame might not have been received or the `'end'` event emitted, + // for example, if the socket was destroyed due to an error. Ensure that the + // `receiver` stream is closed after writing any remaining buffered data to + // it. If the readable side of the socket is in flowing mode then there is no + // buffered data as everything has been already written and `readable.read()` + // will return `null`. If instead, the socket is paused, any possible buffered + // data will be read as a single chunk. + // + if ( + !this._readableState.endEmitted && + !websocket._closeFrameReceived && + !websocket._receiver._writableState.errorEmitted && + (chunk = websocket._socket.read()) !== null + ) { + websocket._receiver.write(chunk); + } + + websocket._receiver.end(); + + this[kWebSocket] = undefined; + + clearTimeout(websocket._closeTimer); + + if ( + websocket._receiver._writableState.finished || + websocket._receiver._writableState.errorEmitted + ) { + websocket.emitClose(); + } else { + websocket._receiver.on('error', receiverOnFinish); + websocket._receiver.on('finish', receiverOnFinish); + } +} + +/** + * The listener of the socket `'data'` event. + * + * @param {Buffer} chunk A chunk of data + * @private + */ +function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } +} + +/** + * The listener of the socket `'end'` event. + * + * @private + */ +function socketOnEnd() { + const websocket = this[kWebSocket]; + + websocket._readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); +} + +/** + * The listener of the socket `'error'` event. + * + * @private + */ +function socketOnError() { + const websocket = this[kWebSocket]; + + this.removeListener('error', socketOnError); + this.on('error', NOOP); + + if (websocket) { + websocket._readyState = WebSocket.CLOSING; + this.destroy(); + } +} diff --git a/graphql-subscription/node_modules/ws/package.json b/graphql-subscription/node_modules/ws/package.json new file mode 100644 index 0000000..a244320 --- /dev/null +++ b/graphql-subscription/node_modules/ws/package.json @@ -0,0 +1,68 @@ +{ + "name": "ws", + "version": "8.16.0", + "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", + "keywords": [ + "HyBi", + "Push", + "RFC-6455", + "WebSocket", + "WebSockets", + "real-time" + ], + "homepage": "https://github.com/websockets/ws", + "bugs": "https://github.com/websockets/ws/issues", + "repository": { + "type": "git", + "url": "git+https://github.com/websockets/ws.git" + }, + "author": "Einar Otto Stangvik (http://2x.io)", + "license": "MIT", + "main": "index.js", + "exports": { + ".": { + "browser": "./browser.js", + "import": "./wrapper.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "browser": "browser.js", + "engines": { + "node": ">=10.0.0" + }, + "files": [ + "browser.js", + "index.js", + "lib/*.js", + "wrapper.mjs" + ], + "scripts": { + "test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js", + "integration": "mocha --throw-deprecation test/*.integration.js", + "lint": "eslint --ignore-path .gitignore . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\"" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + }, + "devDependencies": { + "benchmark": "^2.1.4", + "bufferutil": "^4.0.1", + "eslint": "^8.0.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-prettier": "^5.0.0", + "mocha": "^8.4.0", + "nyc": "^15.0.0", + "prettier": "^3.0.0", + "utf-8-validate": "^6.0.0" + } +} diff --git a/graphql-subscription/node_modules/ws/wrapper.mjs b/graphql-subscription/node_modules/ws/wrapper.mjs new file mode 100644 index 0000000..7245ad1 --- /dev/null +++ b/graphql-subscription/node_modules/ws/wrapper.mjs @@ -0,0 +1,8 @@ +import createWebSocketStream from './lib/stream.js'; +import Receiver from './lib/receiver.js'; +import Sender from './lib/sender.js'; +import WebSocket from './lib/websocket.js'; +import WebSocketServer from './lib/websocket-server.js'; + +export { createWebSocketStream, Receiver, Sender, WebSocket, WebSocketServer }; +export default WebSocket; diff --git a/graphql-subscription/node_modules/zen-observable-ts/.github/dependabot.yml b/graphql-subscription/node_modules/zen-observable-ts/.github/dependabot.yml new file mode 100644 index 0000000..de983a5 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/graphql-subscription/node_modules/zen-observable-ts/.github/workflows/node.js.yml b/graphql-subscription/node_modules/zen-observable-ts/.github/workflows/node.js.yml new file mode 100644 index 0000000..6bb32f0 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/.github/workflows/node.js.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ['10', '12', '14', '15', '16'] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run build --if-present + - run: npm test diff --git a/graphql-subscription/node_modules/zen-observable-ts/LICENSE b/graphql-subscription/node_modules/zen-observable-ts/LICENSE new file mode 100644 index 0000000..35bf148 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graphql-subscription/node_modules/zen-observable-ts/README.md b/graphql-subscription/node_modules/zen-observable-ts/README.md new file mode 100644 index 0000000..5bb41ce --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/README.md @@ -0,0 +1,19 @@ +# zen-observable-ts + +Thin wrapper around [`zen-observable`](https://www.npmjs.com/package/zen-observable) and [`@types/zen-observable`](https://www.npmjs.com/package/@types/zen-observable), to support ESM exports as well as CommonJS exports, with TypeScript types provided by `@types/zen-observable`. + +## Usage + +After installing `zen-observable-ts` using a tool like [npm](https://www.npmjs.com/package/npm) or [yarn](https://yarnpkg.com/), you can import the `Observable` class by name: +```js +import { Observable } from "zen-observable-ts"; +``` +Note that this package does not currently have a default export, so the `{}` braces are mandatory. + +## Previous versions + +This tiny wrapper package replaces [an older version of `zen-observable-ts`](https://github.com/apollographql/apollo-link/tree/master/packages/zen-observable-ts) that used to provide TypeScript types for `zen-observable`, before `@types/zen-observable` was introduced. This version of the package is not intended to be perfectly compatible with the older version, so we have bumped the major version of the package to reflect the difference. + +## Future plans + +As explained in https://github.com/apollographql/apollo-client/pull/7615, the `zen-observable-ts` package exists to fill a gap in the functionality of the `zen-observable` package, so we will retire this package in favor of using `zen-observable` directly, when/if [this PR](https://github.com/zenparsing/zen-observable/pull/74) is ever merged. diff --git a/graphql-subscription/node_modules/zen-observable-ts/index.cjs b/graphql-subscription/node_modules/zen-observable-ts/index.cjs new file mode 100644 index 0000000..01ca9b6 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/index.cjs @@ -0,0 +1 @@ +exports.Observable = require("zen-observable/index.js"); diff --git a/graphql-subscription/node_modules/zen-observable-ts/index.cjs.native.js b/graphql-subscription/node_modules/zen-observable-ts/index.cjs.native.js new file mode 100644 index 0000000..01ca9b6 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/index.cjs.native.js @@ -0,0 +1 @@ +exports.Observable = require("zen-observable/index.js"); diff --git a/graphql-subscription/node_modules/zen-observable-ts/module.d.ts b/graphql-subscription/node_modules/zen-observable-ts/module.d.ts new file mode 100644 index 0000000..c06c4d2 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/module.d.ts @@ -0,0 +1,58 @@ +export interface Subscription { + closed: boolean; + unsubscribe(): void; +} + +interface SubscriptionObserver { + closed: boolean; + next(value: T): void; + error(errorValue: any): void; + complete(): void; +} + +export interface Observer { + start?(subscription: Subscription): any; + next?(value: T): void; + error?(errorValue: any): void; + complete?(): void; +} + +export type Subscriber = ( + observer: SubscriptionObserver, +) => void | (() => void) | Subscription; + +interface ObservableLike { + subscribe?: Subscriber | undefined; + [Symbol.observable](): Observable | ObservableLike; +} + +export declare class Observable { + constructor(subscriber: Subscriber); + + // For backwards compatibility when super(subscriber) is transpiled to + // Observable.call(this, subscriber), which typically happens when the + // Observable class is compiled to ES5 function contructor syntax. + static call(instance: Observable, subscriber: Subscriber): undefined; + static apply(instance: Observable, args: IArguments | [Subscriber]): undefined; + + subscribe(observer: Observer): Subscription; + subscribe( + onNext: (value: T) => void, + onError?: (error: any) => void, + onComplete?: () => void, + ): Subscription; + + [Symbol.observable](): Observable; + + forEach(callback: (value: T) => void): Promise; + map(callback: (value: T) => R): Observable; + filter(callback: (value: T) => value is S): Observable; + filter(callback: (value: T) => boolean): Observable; + reduce(callback: (previousValue: T, currentValue: T) => T, initialValue?: T): Observable; + reduce(callback: (previousValue: R, currentValue: T) => R, initialValue?: R): Observable; + flatMap(callback: (value: T) => ObservableLike): Observable; + concat(...observable: Array>): Observable; + + static from(observable: Observable | ObservableLike | ArrayLike): Observable; + static of(...items: R[]): Observable; +} diff --git a/graphql-subscription/node_modules/zen-observable-ts/module.js b/graphql-subscription/node_modules/zen-observable-ts/module.js new file mode 100644 index 0000000..3934c16 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/module.js @@ -0,0 +1,576 @@ +function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +// === Symbol Support === +var hasSymbols = function () { + return typeof Symbol === 'function'; +}; + +var hasSymbol = function (name) { + return hasSymbols() && Boolean(Symbol[name]); +}; + +var getSymbol = function (name) { + return hasSymbol(name) ? Symbol[name] : '@@' + name; +}; + +if (hasSymbols() && !hasSymbol('observable')) { + Symbol.observable = Symbol('observable'); +} + +var SymbolIterator = getSymbol('iterator'); +var SymbolObservable = getSymbol('observable'); +var SymbolSpecies = getSymbol('species'); // === Abstract Operations === + +function getMethod(obj, key) { + var value = obj[key]; + if (value == null) return undefined; + if (typeof value !== 'function') throw new TypeError(value + ' is not a function'); + return value; +} + +function getSpecies(obj) { + var ctor = obj.constructor; + + if (ctor !== undefined) { + ctor = ctor[SymbolSpecies]; + + if (ctor === null) { + ctor = undefined; + } + } + + return ctor !== undefined ? ctor : Observable; +} + +function isObservable(x) { + return x instanceof Observable; // SPEC: Brand check +} + +function hostReportError(e) { + if (hostReportError.log) { + hostReportError.log(e); + } else { + setTimeout(function () { + throw e; + }); + } +} + +function enqueue(fn) { + Promise.resolve().then(function () { + try { + fn(); + } catch (e) { + hostReportError(e); + } + }); +} + +function cleanupSubscription(subscription) { + var cleanup = subscription._cleanup; + if (cleanup === undefined) return; + subscription._cleanup = undefined; + + if (!cleanup) { + return; + } + + try { + if (typeof cleanup === 'function') { + cleanup(); + } else { + var unsubscribe = getMethod(cleanup, 'unsubscribe'); + + if (unsubscribe) { + unsubscribe.call(cleanup); + } + } + } catch (e) { + hostReportError(e); + } +} + +function closeSubscription(subscription) { + subscription._observer = undefined; + subscription._queue = undefined; + subscription._state = 'closed'; +} + +function flushSubscription(subscription) { + var queue = subscription._queue; + + if (!queue) { + return; + } + + subscription._queue = undefined; + subscription._state = 'ready'; + + for (var i = 0; i < queue.length; ++i) { + notifySubscription(subscription, queue[i].type, queue[i].value); + if (subscription._state === 'closed') break; + } +} + +function notifySubscription(subscription, type, value) { + subscription._state = 'running'; + var observer = subscription._observer; + + try { + var m = getMethod(observer, type); + + switch (type) { + case 'next': + if (m) m.call(observer, value); + break; + + case 'error': + closeSubscription(subscription); + if (m) m.call(observer, value);else throw value; + break; + + case 'complete': + closeSubscription(subscription); + if (m) m.call(observer); + break; + } + } catch (e) { + hostReportError(e); + } + + if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready'; +} + +function onNotify(subscription, type, value) { + if (subscription._state === 'closed') return; + + if (subscription._state === 'buffering') { + subscription._queue.push({ + type: type, + value: value + }); + + return; + } + + if (subscription._state !== 'ready') { + subscription._state = 'buffering'; + subscription._queue = [{ + type: type, + value: value + }]; + enqueue(function () { + return flushSubscription(subscription); + }); + return; + } + + notifySubscription(subscription, type, value); +} + +var Subscription = /*#__PURE__*/function () { + function Subscription(observer, subscriber) { + // ASSERT: observer is an object + // ASSERT: subscriber is callable + this._cleanup = undefined; + this._observer = observer; + this._queue = undefined; + this._state = 'initializing'; + var subscriptionObserver = new SubscriptionObserver(this); + + try { + this._cleanup = subscriber.call(undefined, subscriptionObserver); + } catch (e) { + subscriptionObserver.error(e); + } + + if (this._state === 'initializing') this._state = 'ready'; + } + + var _proto = Subscription.prototype; + + _proto.unsubscribe = function unsubscribe() { + if (this._state !== 'closed') { + closeSubscription(this); + cleanupSubscription(this); + } + }; + + _createClass(Subscription, [{ + key: "closed", + get: function () { + return this._state === 'closed'; + } + }]); + + return Subscription; +}(); + +var SubscriptionObserver = /*#__PURE__*/function () { + function SubscriptionObserver(subscription) { + this._subscription = subscription; + } + + var _proto2 = SubscriptionObserver.prototype; + + _proto2.next = function next(value) { + onNotify(this._subscription, 'next', value); + }; + + _proto2.error = function error(value) { + onNotify(this._subscription, 'error', value); + }; + + _proto2.complete = function complete() { + onNotify(this._subscription, 'complete'); + }; + + _createClass(SubscriptionObserver, [{ + key: "closed", + get: function () { + return this._subscription._state === 'closed'; + } + }]); + + return SubscriptionObserver; +}(); + +var Observable = /*#__PURE__*/function () { + function Observable(subscriber) { + if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function'); + if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function'); + this._subscriber = subscriber; + } + + var _proto3 = Observable.prototype; + + _proto3.subscribe = function subscribe(observer) { + if (typeof observer !== 'object' || observer === null) { + observer = { + next: observer, + error: arguments[1], + complete: arguments[2] + }; + } + + return new Subscription(observer, this._subscriber); + }; + + _proto3.forEach = function forEach(fn) { + var _this = this; + + return new Promise(function (resolve, reject) { + if (typeof fn !== 'function') { + reject(new TypeError(fn + ' is not a function')); + return; + } + + function done() { + subscription.unsubscribe(); + resolve(); + } + + var subscription = _this.subscribe({ + next: function (value) { + try { + fn(value, done); + } catch (e) { + reject(e); + subscription.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + }); + }; + + _proto3.map = function map(fn) { + var _this2 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + return new C(function (observer) { + return _this2.subscribe({ + next: function (value) { + try { + value = fn(value); + } catch (e) { + return observer.error(e); + } + + observer.next(value); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + observer.complete(); + } + }); + }); + }; + + _proto3.filter = function filter(fn) { + var _this3 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + return new C(function (observer) { + return _this3.subscribe({ + next: function (value) { + try { + if (!fn(value)) return; + } catch (e) { + return observer.error(e); + } + + observer.next(value); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + observer.complete(); + } + }); + }); + }; + + _proto3.reduce = function reduce(fn) { + var _this4 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + var hasSeed = arguments.length > 1; + var hasValue = false; + var seed = arguments[1]; + var acc = seed; + return new C(function (observer) { + return _this4.subscribe({ + next: function (value) { + var first = !hasValue; + hasValue = true; + + if (!first || hasSeed) { + try { + acc = fn(acc, value); + } catch (e) { + return observer.error(e); + } + } else { + acc = value; + } + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence')); + observer.next(acc); + observer.complete(); + } + }); + }); + }; + + _proto3.concat = function concat() { + var _this5 = this; + + for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { + sources[_key] = arguments[_key]; + } + + var C = getSpecies(this); + return new C(function (observer) { + var subscription; + var index = 0; + + function startNext(next) { + subscription = next.subscribe({ + next: function (v) { + observer.next(v); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + if (index === sources.length) { + subscription = undefined; + observer.complete(); + } else { + startNext(C.from(sources[index++])); + } + } + }); + } + + startNext(_this5); + return function () { + if (subscription) { + subscription.unsubscribe(); + subscription = undefined; + } + }; + }); + }; + + _proto3.flatMap = function flatMap(fn) { + var _this6 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + return new C(function (observer) { + var subscriptions = []; + + var outer = _this6.subscribe({ + next: function (value) { + if (fn) { + try { + value = fn(value); + } catch (e) { + return observer.error(e); + } + } + + var inner = C.from(value).subscribe({ + next: function (value) { + observer.next(value); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + var i = subscriptions.indexOf(inner); + if (i >= 0) subscriptions.splice(i, 1); + completeIfDone(); + } + }); + subscriptions.push(inner); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + completeIfDone(); + } + }); + + function completeIfDone() { + if (outer.closed && subscriptions.length === 0) observer.complete(); + } + + return function () { + subscriptions.forEach(function (s) { + return s.unsubscribe(); + }); + outer.unsubscribe(); + }; + }); + }; + + _proto3[SymbolObservable] = function () { + return this; + }; + + Observable.from = function from(x) { + var C = typeof this === 'function' ? this : Observable; + if (x == null) throw new TypeError(x + ' is not an object'); + var method = getMethod(x, SymbolObservable); + + if (method) { + var observable = method.call(x); + if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object'); + if (isObservable(observable) && observable.constructor === C) return observable; + return new C(function (observer) { + return observable.subscribe(observer); + }); + } + + if (hasSymbol('iterator')) { + method = getMethod(x, SymbolIterator); + + if (method) { + return new C(function (observer) { + enqueue(function () { + if (observer.closed) return; + + for (var _iterator = _createForOfIteratorHelperLoose(method.call(x)), _step; !(_step = _iterator()).done;) { + var item = _step.value; + observer.next(item); + if (observer.closed) return; + } + + observer.complete(); + }); + }); + } + } + + if (Array.isArray(x)) { + return new C(function (observer) { + enqueue(function () { + if (observer.closed) return; + + for (var i = 0; i < x.length; ++i) { + observer.next(x[i]); + if (observer.closed) return; + } + + observer.complete(); + }); + }); + } + + throw new TypeError(x + ' is not observable'); + }; + + Observable.of = function of() { + for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + items[_key2] = arguments[_key2]; + } + + var C = typeof this === 'function' ? this : Observable; + return new C(function (observer) { + enqueue(function () { + if (observer.closed) return; + + for (var i = 0; i < items.length; ++i) { + observer.next(items[i]); + if (observer.closed) return; + } + + observer.complete(); + }); + }); + }; + + _createClass(Observable, null, [{ + key: SymbolSpecies, + get: function () { + return this; + } + }]); + + return Observable; +}(); + +if (hasSymbols()) { + Object.defineProperty(Observable, Symbol('extensions'), { + value: { + symbol: SymbolObservable, + hostReportError: hostReportError + }, + configurable: true + }); +} + +export { Observable }; diff --git a/graphql-subscription/node_modules/zen-observable-ts/package.json b/graphql-subscription/node_modules/zen-observable-ts/package.json new file mode 100644 index 0000000..c5aa730 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/package.json @@ -0,0 +1,41 @@ +{ + "name": "zen-observable-ts", + "version": "1.2.5", + "description": "Thin wrapper around zen-observable and @types/zen-observable, to support ESM exports as well as CommonJS exports", + "license": "MIT", + "type": "module", + "main": "index.cjs", + "module": "module.js", + "types": "module.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/apollographql/zen-observable-ts.git" + }, + "bugs": { + "url": "https://github.com/apollographql/zen-observable-ts/issues" + }, + "scripts": { + "build": "rollup -c rollup.config.js", + "prepare": "npm run build", + "pretest": "npm run build && rollup -c rollup.test.config.js", + "test": "mocha tests/bundle.cjs" + }, + "dependencies": { + "zen-observable": "0.8.15" + }, + "devDependencies": { + "@babel/core": "^7.14.6", + "@babel/preset-env": "^7.14.7", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-node-resolve": "^13.0.0", + "@rollup/plugin-typescript": "^8.2.1", + "@types/chai": "^4.2.14", + "@types/mocha": "^9.0.0", + "@types/node": "^17.0.32", + "chai": "^4.2.0", + "mocha": "^9.0.2", + "rollup": "^2.38.4", + "tslib": "^2.1.0", + "typescript": "^4.1.3" + } +} diff --git a/graphql-subscription/node_modules/zen-observable-ts/rollup.test.config.js b/graphql-subscription/node_modules/zen-observable-ts/rollup.test.config.js new file mode 100644 index 0000000..beb737d --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/rollup.test.config.js @@ -0,0 +1,14 @@ +import nodeResolve from "@rollup/plugin-node-resolve"; +import typescript from "@rollup/plugin-typescript"; + +export default { + input: "./tests/index.ts", + output: { + file: "./tests/bundle.cjs", + format: "cjs", + }, + plugins: [ + nodeResolve(), + typescript(), + ], +}; diff --git a/graphql-subscription/node_modules/zen-observable-ts/src/module.js b/graphql-subscription/node_modules/zen-observable-ts/src/module.js new file mode 100644 index 0000000..a4e5ccf --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable-ts/src/module.js @@ -0,0 +1 @@ +export { Observable } from "zen-observable/esm.js"; diff --git a/graphql-subscription/node_modules/zen-observable/.editorconfig b/graphql-subscription/node_modules/zen-observable/.editorconfig new file mode 100644 index 0000000..d4eed84 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = false +indent_style = space +indent_size = 2 diff --git a/graphql-subscription/node_modules/zen-observable/.eslintrc.js b/graphql-subscription/node_modules/zen-observable/.eslintrc.js new file mode 100644 index 0000000..3def7dc --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/.eslintrc.js @@ -0,0 +1,47 @@ +module.exports = { + "extends": ["eslint:recommended"], + + "env": { + "es6": true, + "node": true + }, + + "globals": { + "setTimeout": true + }, + + "parserOptions": { + "sourceType": "module" + }, + + "rules": { + "no-console": ["error", { "allow": ["warn", "error"] }], + "no-unsafe-finally": ["off"], + "camelcase": ["error", { "properties": "always" }], + "brace-style": ["off"], + "eqeqeq": ["error", "smart"], + "indent": ["error", 2, { "SwitchCase": 1 }], + "no-throw-literal": ["error"], + "comma-spacing": ["error", { "before": false, "after": true }], + "comma-style": ["error", "last"], + "comma-dangle": ["error", "always-multiline"], + "keyword-spacing": ["error"], + "no-trailing-spaces": ["error"], + "no-multi-spaces": ["error"], + "no-spaced-func": ["error"], + "no-whitespace-before-property": ["error"], + "space-before-blocks": ["error"], + "space-before-function-paren": ["error", "never"], + "space-in-parens": ["error", "never"], + "eol-last": ["error"], + "quotes": ["error", "single", { "avoidEscape": true }], + "no-implicit-globals": ["error"], + "no-useless-concat": ["error"], + "space-infix-ops": ["error", { "int32Hint": true }], + "semi-spacing": ["error", { "before": false, "after": true }], + "semi": ["error", "always", { "omitLastInOneLineBlock": true }], + "object-curly-spacing": ["error", "always"], + "array-bracket-spacing": ["error"], + "max-len": ["error", 100] + } +}; diff --git a/graphql-subscription/node_modules/zen-observable/LICENSE b/graphql-subscription/node_modules/zen-observable/LICENSE new file mode 100644 index 0000000..d850f52 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/LICENSE @@ -0,0 +1,18 @@ +Copyright (c) 2018 zenparsing (Kevin Smith) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/graphql-subscription/node_modules/zen-observable/README.md b/graphql-subscription/node_modules/zen-observable/README.md new file mode 100644 index 0000000..eff7a5c --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/README.md @@ -0,0 +1,176 @@ +# zen-observable + +An implementation of Observables for JavaScript. Requires Promises or a Promise polyfill. + +## Install + +```sh +npm install zen-observable +``` + +## Usage + +```js +import Observable from 'zen-observable'; + +Observable.of(1, 2, 3).subscribe(x => console.log(x)); +``` + +## API + +### new Observable(subscribe) + +```js +let observable = new Observable(observer => { + // Emit a single value after 1 second + let timer = setTimeout(() => { + observer.next('hello'); + observer.complete(); + }, 1000); + + // On unsubscription, cancel the timer + return () => clearTimeout(timer); +}); +``` + +Creates a new Observable object using the specified subscriber function. The subscriber function is called whenever the `subscribe` method of the observable object is invoked. The subscriber function is passed an *observer* object which has the following methods: + +- `next(value)` Sends the next value in the sequence. +- `error(exception)` Terminates the sequence with an exception. +- `complete()` Terminates the sequence successfully. +- `closed` A boolean property whose value is `true` if the observer's subscription is closed. + +The subscriber function can optionally return either a cleanup function or a subscription object. If it returns a cleanup function, that function will be called when the subscription has closed. If it returns a subscription object, then the subscription's `unsubscribe` method will be invoked when the subscription has closed. + +### Observable.of(...items) + +```js +// Logs 1, 2, 3 +Observable.of(1, 2, 3).subscribe(x => { + console.log(x); +}); +``` + +Returns an observable which will emit each supplied argument. + +### Observable.from(value) + +```js +let list = [1, 2, 3]; + +// Iterate over an object +Observable.from(list).subscribe(x => { + console.log(x); +}); +``` + +```js +// Convert something 'observable' to an Observable instance +Observable.from(otherObservable).subscribe(x => { + console.log(x); +}); +``` + +Converts `value` to an Observable. + +- If `value` is an implementation of Observable, then it is converted to an instance of Observable as defined by this library. +- Otherwise, it is converted to an Observable which synchronously iterates over `value`. + +### observable.subscribe([observer]) + +```js +let subscription = observable.subscribe({ + next(x) { console.log(x) }, + error(err) { console.log(`Finished with error: ${ err }`) }, + complete() { console.log('Finished') } +}); +``` + +Subscribes to the observable. Observer objects may have any of the following methods: + +- `next(value)` Receives the next value of the sequence. +- `error(exception)` Receives the terminating error of the sequence. +- `complete()` Called when the stream has completed successfully. + +Returns a subscription object that can be used to cancel the stream. + +### observable.subscribe(nextCallback[, errorCallback, completeCallback]) + +```js +let subscription = observable.subscribe( + x => console.log(x), + err => console.log(`Finished with error: ${ err }`), + () => console.log('Finished') +); +``` + +Subscribes to the observable with callback functions. Returns a subscription object that can be used to cancel the stream. + +### observable.forEach(callback) + +```js +observable.forEach(x => { + console.log(`Received value: ${ x }`); +}).then(() => { + console.log('Finished successfully') +}).catch(err => { + console.log(`Finished with error: ${ err }`); +}) +``` + +Subscribes to the observable and returns a Promise for the completion value of the stream. The `callback` argument is called once for each value in the stream. + +### observable.filter(callback) + +```js +Observable.of(1, 2, 3).filter(value => { + return value > 2; +}).subscribe(value => { + console.log(value); +}); +// 3 +``` + +Returns a new Observable that emits all values which pass the test implemented by the `callback` argument. + +### observable.map(callback) + +Returns a new Observable that emits the results of calling the `callback` argument for every value in the stream. + +```js +Observable.of(1, 2, 3).map(value => { + return value * 2; +}).subscribe(value => { + console.log(value); +}); +// 2 +// 4 +// 6 +``` + +### observable.reduce(callback [,initialValue]) + +```js +Observable.of(0, 1, 2, 3, 4).reduce((previousValue, currentValue) => { + return previousValue + currentValue; +}).subscribe(result => { + console.log(result); +}); +// 10 +``` + +Returns a new Observable that applies a function against an accumulator and each value of the stream to reduce it to a single value. + +### observable.concat(...sources) + +```js +Observable.of(1, 2, 3).concat( + Observable.of(4, 5, 6), + Observable.of(7, 8, 9) +).subscribe(result => { + console.log(result); +}); +// 1, 2, 3, 4, 5, 6, 7, 8, 9 +``` + +Merges the current observable with additional observables. diff --git a/graphql-subscription/node_modules/zen-observable/esm.js b/graphql-subscription/node_modules/zen-observable/esm.js new file mode 100644 index 0000000..a6bef71 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/esm.js @@ -0,0 +1,5 @@ +import { Observable } from './src/Observable.js'; + +export default Observable; +export { Observable }; +export * from './src/extras.js'; diff --git a/graphql-subscription/node_modules/zen-observable/extras.js b/graphql-subscription/node_modules/zen-observable/extras.js new file mode 100644 index 0000000..ab87de3 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/extras.js @@ -0,0 +1 @@ +module.exports = require('./lib/extras.js'); diff --git a/graphql-subscription/node_modules/zen-observable/index.js b/graphql-subscription/node_modules/zen-observable/index.js new file mode 100644 index 0000000..25c8a63 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/Observable.js').Observable; diff --git a/graphql-subscription/node_modules/zen-observable/lib/Observable.js b/graphql-subscription/node_modules/zen-observable/lib/Observable.js new file mode 100644 index 0000000..4cad821 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/lib/Observable.js @@ -0,0 +1,617 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Observable = void 0; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +// === Symbol Support === +var hasSymbols = function () { + return typeof Symbol === 'function'; +}; + +var hasSymbol = function (name) { + return hasSymbols() && Boolean(Symbol[name]); +}; + +var getSymbol = function (name) { + return hasSymbol(name) ? Symbol[name] : '@@' + name; +}; + +if (hasSymbols() && !hasSymbol('observable')) { + Symbol.observable = Symbol('observable'); +} + +var SymbolIterator = getSymbol('iterator'); +var SymbolObservable = getSymbol('observable'); +var SymbolSpecies = getSymbol('species'); // === Abstract Operations === + +function getMethod(obj, key) { + var value = obj[key]; + if (value == null) return undefined; + if (typeof value !== 'function') throw new TypeError(value + ' is not a function'); + return value; +} + +function getSpecies(obj) { + var ctor = obj.constructor; + + if (ctor !== undefined) { + ctor = ctor[SymbolSpecies]; + + if (ctor === null) { + ctor = undefined; + } + } + + return ctor !== undefined ? ctor : Observable; +} + +function isObservable(x) { + return x instanceof Observable; // SPEC: Brand check +} + +function hostReportError(e) { + if (hostReportError.log) { + hostReportError.log(e); + } else { + setTimeout(function () { + throw e; + }); + } +} + +function enqueue(fn) { + Promise.resolve().then(function () { + try { + fn(); + } catch (e) { + hostReportError(e); + } + }); +} + +function cleanupSubscription(subscription) { + var cleanup = subscription._cleanup; + if (cleanup === undefined) return; + subscription._cleanup = undefined; + + if (!cleanup) { + return; + } + + try { + if (typeof cleanup === 'function') { + cleanup(); + } else { + var unsubscribe = getMethod(cleanup, 'unsubscribe'); + + if (unsubscribe) { + unsubscribe.call(cleanup); + } + } + } catch (e) { + hostReportError(e); + } +} + +function closeSubscription(subscription) { + subscription._observer = undefined; + subscription._queue = undefined; + subscription._state = 'closed'; +} + +function flushSubscription(subscription) { + var queue = subscription._queue; + + if (!queue) { + return; + } + + subscription._queue = undefined; + subscription._state = 'ready'; + + for (var i = 0; i < queue.length; ++i) { + notifySubscription(subscription, queue[i].type, queue[i].value); + if (subscription._state === 'closed') break; + } +} + +function notifySubscription(subscription, type, value) { + subscription._state = 'running'; + var observer = subscription._observer; + + try { + var m = getMethod(observer, type); + + switch (type) { + case 'next': + if (m) m.call(observer, value); + break; + + case 'error': + closeSubscription(subscription); + if (m) m.call(observer, value);else throw value; + break; + + case 'complete': + closeSubscription(subscription); + if (m) m.call(observer); + break; + } + } catch (e) { + hostReportError(e); + } + + if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready'; +} + +function onNotify(subscription, type, value) { + if (subscription._state === 'closed') return; + + if (subscription._state === 'buffering') { + subscription._queue.push({ + type: type, + value: value + }); + + return; + } + + if (subscription._state !== 'ready') { + subscription._state = 'buffering'; + subscription._queue = [{ + type: type, + value: value + }]; + enqueue(function () { + return flushSubscription(subscription); + }); + return; + } + + notifySubscription(subscription, type, value); +} + +var Subscription = +/*#__PURE__*/ +function () { + function Subscription(observer, subscriber) { + _classCallCheck(this, Subscription); + + // ASSERT: observer is an object + // ASSERT: subscriber is callable + this._cleanup = undefined; + this._observer = observer; + this._queue = undefined; + this._state = 'initializing'; + var subscriptionObserver = new SubscriptionObserver(this); + + try { + this._cleanup = subscriber.call(undefined, subscriptionObserver); + } catch (e) { + subscriptionObserver.error(e); + } + + if (this._state === 'initializing') this._state = 'ready'; + } + + _createClass(Subscription, [{ + key: "unsubscribe", + value: function unsubscribe() { + if (this._state !== 'closed') { + closeSubscription(this); + cleanupSubscription(this); + } + } + }, { + key: "closed", + get: function () { + return this._state === 'closed'; + } + }]); + + return Subscription; +}(); + +var SubscriptionObserver = +/*#__PURE__*/ +function () { + function SubscriptionObserver(subscription) { + _classCallCheck(this, SubscriptionObserver); + + this._subscription = subscription; + } + + _createClass(SubscriptionObserver, [{ + key: "next", + value: function next(value) { + onNotify(this._subscription, 'next', value); + } + }, { + key: "error", + value: function error(value) { + onNotify(this._subscription, 'error', value); + } + }, { + key: "complete", + value: function complete() { + onNotify(this._subscription, 'complete'); + } + }, { + key: "closed", + get: function () { + return this._subscription._state === 'closed'; + } + }]); + + return SubscriptionObserver; +}(); + +var Observable = +/*#__PURE__*/ +function () { + function Observable(subscriber) { + _classCallCheck(this, Observable); + + if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function'); + if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function'); + this._subscriber = subscriber; + } + + _createClass(Observable, [{ + key: "subscribe", + value: function subscribe(observer) { + if (typeof observer !== 'object' || observer === null) { + observer = { + next: observer, + error: arguments[1], + complete: arguments[2] + }; + } + + return new Subscription(observer, this._subscriber); + } + }, { + key: "forEach", + value: function forEach(fn) { + var _this = this; + + return new Promise(function (resolve, reject) { + if (typeof fn !== 'function') { + reject(new TypeError(fn + ' is not a function')); + return; + } + + function done() { + subscription.unsubscribe(); + resolve(); + } + + var subscription = _this.subscribe({ + next: function (value) { + try { + fn(value, done); + } catch (e) { + reject(e); + subscription.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + }); + } + }, { + key: "map", + value: function map(fn) { + var _this2 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + return new C(function (observer) { + return _this2.subscribe({ + next: function (value) { + try { + value = fn(value); + } catch (e) { + return observer.error(e); + } + + observer.next(value); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + observer.complete(); + } + }); + }); + } + }, { + key: "filter", + value: function filter(fn) { + var _this3 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + return new C(function (observer) { + return _this3.subscribe({ + next: function (value) { + try { + if (!fn(value)) return; + } catch (e) { + return observer.error(e); + } + + observer.next(value); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + observer.complete(); + } + }); + }); + } + }, { + key: "reduce", + value: function reduce(fn) { + var _this4 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + var hasSeed = arguments.length > 1; + var hasValue = false; + var seed = arguments[1]; + var acc = seed; + return new C(function (observer) { + return _this4.subscribe({ + next: function (value) { + var first = !hasValue; + hasValue = true; + + if (!first || hasSeed) { + try { + acc = fn(acc, value); + } catch (e) { + return observer.error(e); + } + } else { + acc = value; + } + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence')); + observer.next(acc); + observer.complete(); + } + }); + }); + } + }, { + key: "concat", + value: function concat() { + var _this5 = this; + + for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { + sources[_key] = arguments[_key]; + } + + var C = getSpecies(this); + return new C(function (observer) { + var subscription; + var index = 0; + + function startNext(next) { + subscription = next.subscribe({ + next: function (v) { + observer.next(v); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + if (index === sources.length) { + subscription = undefined; + observer.complete(); + } else { + startNext(C.from(sources[index++])); + } + } + }); + } + + startNext(_this5); + return function () { + if (subscription) { + subscription.unsubscribe(); + subscription = undefined; + } + }; + }); + } + }, { + key: "flatMap", + value: function flatMap(fn) { + var _this6 = this; + + if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); + var C = getSpecies(this); + return new C(function (observer) { + var subscriptions = []; + + var outer = _this6.subscribe({ + next: function (value) { + if (fn) { + try { + value = fn(value); + } catch (e) { + return observer.error(e); + } + } + + var inner = C.from(value).subscribe({ + next: function (value) { + observer.next(value); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + var i = subscriptions.indexOf(inner); + if (i >= 0) subscriptions.splice(i, 1); + completeIfDone(); + } + }); + subscriptions.push(inner); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + completeIfDone(); + } + }); + + function completeIfDone() { + if (outer.closed && subscriptions.length === 0) observer.complete(); + } + + return function () { + subscriptions.forEach(function (s) { + return s.unsubscribe(); + }); + outer.unsubscribe(); + }; + }); + } + }, { + key: SymbolObservable, + value: function () { + return this; + } + }], [{ + key: "from", + value: function from(x) { + var C = typeof this === 'function' ? this : Observable; + if (x == null) throw new TypeError(x + ' is not an object'); + var method = getMethod(x, SymbolObservable); + + if (method) { + var observable = method.call(x); + if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object'); + if (isObservable(observable) && observable.constructor === C) return observable; + return new C(function (observer) { + return observable.subscribe(observer); + }); + } + + if (hasSymbol('iterator')) { + method = getMethod(x, SymbolIterator); + + if (method) { + return new C(function (observer) { + enqueue(function () { + if (observer.closed) return; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = method.call(x)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var _item = _step.value; + observer.next(_item); + if (observer.closed) return; + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + observer.complete(); + }); + }); + } + } + + if (Array.isArray(x)) { + return new C(function (observer) { + enqueue(function () { + if (observer.closed) return; + + for (var i = 0; i < x.length; ++i) { + observer.next(x[i]); + if (observer.closed) return; + } + + observer.complete(); + }); + }); + } + + throw new TypeError(x + ' is not observable'); + } + }, { + key: "of", + value: function of() { + for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + items[_key2] = arguments[_key2]; + } + + var C = typeof this === 'function' ? this : Observable; + return new C(function (observer) { + enqueue(function () { + if (observer.closed) return; + + for (var i = 0; i < items.length; ++i) { + observer.next(items[i]); + if (observer.closed) return; + } + + observer.complete(); + }); + }); + } + }, { + key: SymbolSpecies, + get: function () { + return this; + } + }]); + + return Observable; +}(); + +exports.Observable = Observable; + +if (hasSymbols()) { + Object.defineProperty(Observable, Symbol('extensions'), { + value: { + symbol: SymbolObservable, + hostReportError: hostReportError + }, + configurable: true + }); +} \ No newline at end of file diff --git a/graphql-subscription/node_modules/zen-observable/lib/extras.js b/graphql-subscription/node_modules/zen-observable/lib/extras.js new file mode 100644 index 0000000..58f06d0 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/lib/extras.js @@ -0,0 +1,132 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.merge = merge; +exports.combineLatest = combineLatest; +exports.zip = zip; + +var _Observable = require("./Observable.js"); + +// Emits all values from all inputs in parallel +function merge() { + for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { + sources[_key] = arguments[_key]; + } + + return new _Observable.Observable(function (observer) { + if (sources.length === 0) return _Observable.Observable.from([]); + var count = sources.length; + var subscriptions = sources.map(function (source) { + return _Observable.Observable.from(source).subscribe({ + next: function (v) { + observer.next(v); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + if (--count === 0) observer.complete(); + } + }); + }); + return function () { + return subscriptions.forEach(function (s) { + return s.unsubscribe(); + }); + }; + }); +} // Emits arrays containing the most current values from each input + + +function combineLatest() { + for (var _len2 = arguments.length, sources = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + sources[_key2] = arguments[_key2]; + } + + return new _Observable.Observable(function (observer) { + if (sources.length === 0) return _Observable.Observable.from([]); + var count = sources.length; + var seen = new Set(); + var seenAll = false; + var values = sources.map(function () { + return undefined; + }); + var subscriptions = sources.map(function (source, index) { + return _Observable.Observable.from(source).subscribe({ + next: function (v) { + values[index] = v; + + if (!seenAll) { + seen.add(index); + if (seen.size !== sources.length) return; + seen = null; + seenAll = true; + } + + observer.next(Array.from(values)); + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + if (--count === 0) observer.complete(); + } + }); + }); + return function () { + return subscriptions.forEach(function (s) { + return s.unsubscribe(); + }); + }; + }); +} // Emits arrays containing the matching index values from each input + + +function zip() { + for (var _len3 = arguments.length, sources = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + sources[_key3] = arguments[_key3]; + } + + return new _Observable.Observable(function (observer) { + if (sources.length === 0) return _Observable.Observable.from([]); + var queues = sources.map(function () { + return []; + }); + + function done() { + return queues.some(function (q, i) { + return q.length === 0 && subscriptions[i].closed; + }); + } + + var subscriptions = sources.map(function (source, index) { + return _Observable.Observable.from(source).subscribe({ + next: function (v) { + queues[index].push(v); + + if (queues.every(function (q) { + return q.length > 0; + })) { + observer.next(queues.map(function (q) { + return q.shift(); + })); + if (done()) observer.complete(); + } + }, + error: function (e) { + observer.error(e); + }, + complete: function () { + if (done()) observer.complete(); + } + }); + }); + return function () { + return subscriptions.forEach(function (s) { + return s.unsubscribe(); + }); + }; + }); +} \ No newline at end of file diff --git a/graphql-subscription/node_modules/zen-observable/package.json b/graphql-subscription/node_modules/zen-observable/package.json new file mode 100644 index 0000000..ffee431 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/package.json @@ -0,0 +1,23 @@ +{ + "name": "zen-observable", + "version": "0.8.15", + "repository": "zenparsing/zen-observable", + "description": "An Implementation of ES Observables", + "homepage": "https://github.com/zenparsing/zen-observable", + "license": "MIT", + "devDependencies": { + "@babel/cli": "^7.6.0", + "@babel/core": "^7.6.0", + "@babel/preset-env": "^7.6.0", + "@babel/register": "^7.6.0", + "eslint": "^6.5.0", + "mocha": "^6.2.0" + }, + "dependencies": {}, + "scripts": { + "test": "mocha --recursive --require ./scripts/mocha-require", + "lint": "eslint src/*", + "build": "git clean -dfX ./lib && node ./scripts/build", + "prepublishOnly": "npm run lint && npm test && npm run build" + } +} diff --git a/graphql-subscription/node_modules/zen-observable/scripts/babel-plugins.js b/graphql-subscription/node_modules/zen-observable/scripts/babel-plugins.js new file mode 100644 index 0000000..885fa84 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/scripts/babel-plugins.js @@ -0,0 +1,16 @@ +module.exports = [ + '@babel/plugin-transform-arrow-functions', + '@babel/plugin-transform-block-scoped-functions', + '@babel/plugin-transform-block-scoping', + '@babel/plugin-transform-classes', + '@babel/plugin-transform-computed-properties', + '@babel/plugin-transform-destructuring', + '@babel/plugin-transform-duplicate-keys', + '@babel/plugin-transform-for-of', + '@babel/plugin-transform-literals', + '@babel/plugin-transform-modules-commonjs', + '@babel/plugin-transform-parameters', + '@babel/plugin-transform-shorthand-properties', + '@babel/plugin-transform-spread', + '@babel/plugin-transform-template-literals', +]; diff --git a/graphql-subscription/node_modules/zen-observable/scripts/build.js b/graphql-subscription/node_modules/zen-observable/scripts/build.js new file mode 100644 index 0000000..f4c8fa6 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/scripts/build.js @@ -0,0 +1,7 @@ +const { execSync } = require('child_process'); +const plugins = require('./babel-plugins'); + +execSync('babel src --out-dir lib --plugins=' + plugins.join(','), { + env: process.env, + stdio: 'inherit', +}); diff --git a/graphql-subscription/node_modules/zen-observable/scripts/mocha-require.js b/graphql-subscription/node_modules/zen-observable/scripts/mocha-require.js new file mode 100644 index 0000000..f375ae1 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/scripts/mocha-require.js @@ -0,0 +1,3 @@ +require('@babel/register')({ + plugins: require('./babel-plugins'), +}); diff --git a/graphql-subscription/node_modules/zen-observable/src/Observable.js b/graphql-subscription/node_modules/zen-observable/src/Observable.js new file mode 100644 index 0000000..9364bc0 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/src/Observable.js @@ -0,0 +1,476 @@ +// === Symbol Support === + +const hasSymbols = () => typeof Symbol === 'function'; +const hasSymbol = name => hasSymbols() && Boolean(Symbol[name]); +const getSymbol = name => hasSymbol(name) ? Symbol[name] : '@@' + name; + +if (hasSymbols() && !hasSymbol('observable')) { + Symbol.observable = Symbol('observable'); +} + +const SymbolIterator = getSymbol('iterator'); +const SymbolObservable = getSymbol('observable'); +const SymbolSpecies = getSymbol('species'); + +// === Abstract Operations === + +function getMethod(obj, key) { + let value = obj[key]; + + if (value == null) + return undefined; + + if (typeof value !== 'function') + throw new TypeError(value + ' is not a function'); + + return value; +} + +function getSpecies(obj) { + let ctor = obj.constructor; + if (ctor !== undefined) { + ctor = ctor[SymbolSpecies]; + if (ctor === null) { + ctor = undefined; + } + } + return ctor !== undefined ? ctor : Observable; +} + +function isObservable(x) { + return x instanceof Observable; // SPEC: Brand check +} + +function hostReportError(e) { + if (hostReportError.log) { + hostReportError.log(e); + } else { + setTimeout(() => { throw e }); + } +} + +function enqueue(fn) { + Promise.resolve().then(() => { + try { fn() } + catch (e) { hostReportError(e) } + }); +} + +function cleanupSubscription(subscription) { + let cleanup = subscription._cleanup; + if (cleanup === undefined) + return; + + subscription._cleanup = undefined; + + if (!cleanup) { + return; + } + + try { + if (typeof cleanup === 'function') { + cleanup(); + } else { + let unsubscribe = getMethod(cleanup, 'unsubscribe'); + if (unsubscribe) { + unsubscribe.call(cleanup); + } + } + } catch (e) { + hostReportError(e); + } +} + +function closeSubscription(subscription) { + subscription._observer = undefined; + subscription._queue = undefined; + subscription._state = 'closed'; +} + +function flushSubscription(subscription) { + let queue = subscription._queue; + if (!queue) { + return; + } + subscription._queue = undefined; + subscription._state = 'ready'; + for (let i = 0; i < queue.length; ++i) { + notifySubscription(subscription, queue[i].type, queue[i].value); + if (subscription._state === 'closed') + break; + } +} + +function notifySubscription(subscription, type, value) { + subscription._state = 'running'; + + let observer = subscription._observer; + + try { + let m = getMethod(observer, type); + switch (type) { + case 'next': + if (m) m.call(observer, value); + break; + case 'error': + closeSubscription(subscription); + if (m) m.call(observer, value); + else throw value; + break; + case 'complete': + closeSubscription(subscription); + if (m) m.call(observer); + break; + } + } catch (e) { + hostReportError(e); + } + + if (subscription._state === 'closed') + cleanupSubscription(subscription); + else if (subscription._state === 'running') + subscription._state = 'ready'; +} + +function onNotify(subscription, type, value) { + if (subscription._state === 'closed') + return; + + if (subscription._state === 'buffering') { + subscription._queue.push({ type, value }); + return; + } + + if (subscription._state !== 'ready') { + subscription._state = 'buffering'; + subscription._queue = [{ type, value }]; + enqueue(() => flushSubscription(subscription)); + return; + } + + notifySubscription(subscription, type, value); +} + + +class Subscription { + + constructor(observer, subscriber) { + // ASSERT: observer is an object + // ASSERT: subscriber is callable + + this._cleanup = undefined; + this._observer = observer; + this._queue = undefined; + this._state = 'initializing'; + + let subscriptionObserver = new SubscriptionObserver(this); + + try { + this._cleanup = subscriber.call(undefined, subscriptionObserver); + } catch (e) { + subscriptionObserver.error(e); + } + + if (this._state === 'initializing') + this._state = 'ready'; + } + + get closed() { + return this._state === 'closed'; + } + + unsubscribe() { + if (this._state !== 'closed') { + closeSubscription(this); + cleanupSubscription(this); + } + } +} + +class SubscriptionObserver { + constructor(subscription) { this._subscription = subscription } + get closed() { return this._subscription._state === 'closed' } + next(value) { onNotify(this._subscription, 'next', value) } + error(value) { onNotify(this._subscription, 'error', value) } + complete() { onNotify(this._subscription, 'complete') } +} + +export class Observable { + + constructor(subscriber) { + if (!(this instanceof Observable)) + throw new TypeError('Observable cannot be called as a function'); + + if (typeof subscriber !== 'function') + throw new TypeError('Observable initializer must be a function'); + + this._subscriber = subscriber; + } + + subscribe(observer) { + if (typeof observer !== 'object' || observer === null) { + observer = { + next: observer, + error: arguments[1], + complete: arguments[2], + }; + } + return new Subscription(observer, this._subscriber); + } + + forEach(fn) { + return new Promise((resolve, reject) => { + if (typeof fn !== 'function') { + reject(new TypeError(fn + ' is not a function')); + return; + } + + function done() { + subscription.unsubscribe(); + resolve(); + } + + let subscription = this.subscribe({ + next(value) { + try { + fn(value, done); + } catch (e) { + reject(e); + subscription.unsubscribe(); + } + }, + error: reject, + complete: resolve, + }); + }); + } + + map(fn) { + if (typeof fn !== 'function') + throw new TypeError(fn + ' is not a function'); + + let C = getSpecies(this); + + return new C(observer => this.subscribe({ + next(value) { + try { value = fn(value) } + catch (e) { return observer.error(e) } + observer.next(value); + }, + error(e) { observer.error(e) }, + complete() { observer.complete() }, + })); + } + + filter(fn) { + if (typeof fn !== 'function') + throw new TypeError(fn + ' is not a function'); + + let C = getSpecies(this); + + return new C(observer => this.subscribe({ + next(value) { + try { if (!fn(value)) return; } + catch (e) { return observer.error(e) } + observer.next(value); + }, + error(e) { observer.error(e) }, + complete() { observer.complete() }, + })); + } + + reduce(fn) { + if (typeof fn !== 'function') + throw new TypeError(fn + ' is not a function'); + + let C = getSpecies(this); + let hasSeed = arguments.length > 1; + let hasValue = false; + let seed = arguments[1]; + let acc = seed; + + return new C(observer => this.subscribe({ + + next(value) { + let first = !hasValue; + hasValue = true; + + if (!first || hasSeed) { + try { acc = fn(acc, value) } + catch (e) { return observer.error(e) } + } else { + acc = value; + } + }, + + error(e) { observer.error(e) }, + + complete() { + if (!hasValue && !hasSeed) + return observer.error(new TypeError('Cannot reduce an empty sequence')); + + observer.next(acc); + observer.complete(); + }, + + })); + } + + concat(...sources) { + let C = getSpecies(this); + + return new C(observer => { + let subscription; + let index = 0; + + function startNext(next) { + subscription = next.subscribe({ + next(v) { observer.next(v) }, + error(e) { observer.error(e) }, + complete() { + if (index === sources.length) { + subscription = undefined; + observer.complete(); + } else { + startNext(C.from(sources[index++])); + } + }, + }); + } + + startNext(this); + + return () => { + if (subscription) { + subscription.unsubscribe(); + subscription = undefined; + } + }; + }); + } + + flatMap(fn) { + if (typeof fn !== 'function') + throw new TypeError(fn + ' is not a function'); + + let C = getSpecies(this); + + return new C(observer => { + let subscriptions = []; + + let outer = this.subscribe({ + next(value) { + if (fn) { + try { value = fn(value) } + catch (e) { return observer.error(e) } + } + + let inner = C.from(value).subscribe({ + next(value) { observer.next(value) }, + error(e) { observer.error(e) }, + complete() { + let i = subscriptions.indexOf(inner); + if (i >= 0) subscriptions.splice(i, 1); + completeIfDone(); + }, + }); + + subscriptions.push(inner); + }, + error(e) { observer.error(e) }, + complete() { completeIfDone() }, + }); + + function completeIfDone() { + if (outer.closed && subscriptions.length === 0) + observer.complete(); + } + + return () => { + subscriptions.forEach(s => s.unsubscribe()); + outer.unsubscribe(); + }; + }); + } + + [SymbolObservable]() { return this } + + static from(x) { + let C = typeof this === 'function' ? this : Observable; + + if (x == null) + throw new TypeError(x + ' is not an object'); + + let method = getMethod(x, SymbolObservable); + if (method) { + let observable = method.call(x); + + if (Object(observable) !== observable) + throw new TypeError(observable + ' is not an object'); + + if (isObservable(observable) && observable.constructor === C) + return observable; + + return new C(observer => observable.subscribe(observer)); + } + + if (hasSymbol('iterator')) { + method = getMethod(x, SymbolIterator); + if (method) { + return new C(observer => { + enqueue(() => { + if (observer.closed) return; + for (let item of method.call(x)) { + observer.next(item); + if (observer.closed) return; + } + observer.complete(); + }); + }); + } + } + + if (Array.isArray(x)) { + return new C(observer => { + enqueue(() => { + if (observer.closed) return; + for (let i = 0; i < x.length; ++i) { + observer.next(x[i]); + if (observer.closed) return; + } + observer.complete(); + }); + }); + } + + throw new TypeError(x + ' is not observable'); + } + + static of(...items) { + let C = typeof this === 'function' ? this : Observable; + + return new C(observer => { + enqueue(() => { + if (observer.closed) return; + for (let i = 0; i < items.length; ++i) { + observer.next(items[i]); + if (observer.closed) return; + } + observer.complete(); + }); + }); + } + + static get [SymbolSpecies]() { return this } + +} + +if (hasSymbols()) { + Object.defineProperty(Observable, Symbol('extensions'), { + value: { + symbol: SymbolObservable, + hostReportError, + }, + configurable: true, + }); +} diff --git a/graphql-subscription/node_modules/zen-observable/src/extras.js b/graphql-subscription/node_modules/zen-observable/src/extras.js new file mode 100644 index 0000000..ca6b6f7 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/src/extras.js @@ -0,0 +1,99 @@ +import { Observable } from './Observable.js'; + +// Emits all values from all inputs in parallel +export function merge(...sources) { + return new Observable(observer => { + if (sources.length === 0) + return Observable.from([]); + + let count = sources.length; + + let subscriptions = sources.map(source => Observable.from(source).subscribe({ + next(v) { + observer.next(v); + }, + error(e) { + observer.error(e); + }, + complete() { + if (--count === 0) + observer.complete(); + }, + })); + + return () => subscriptions.forEach(s => s.unsubscribe()); + }); +} + +// Emits arrays containing the most current values from each input +export function combineLatest(...sources) { + return new Observable(observer => { + if (sources.length === 0) + return Observable.from([]); + + let count = sources.length; + let seen = new Set(); + let seenAll = false; + let values = sources.map(() => undefined); + + let subscriptions = sources.map((source, index) => Observable.from(source).subscribe({ + next(v) { + values[index] = v; + + if (!seenAll) { + seen.add(index); + if (seen.size !== sources.length) + return; + + seen = null; + seenAll = true; + } + + observer.next(Array.from(values)); + }, + error(e) { + observer.error(e); + }, + complete() { + if (--count === 0) + observer.complete(); + }, + })); + + return () => subscriptions.forEach(s => s.unsubscribe()); + }); +} + +// Emits arrays containing the matching index values from each input +export function zip(...sources) { + return new Observable(observer => { + if (sources.length === 0) + return Observable.from([]); + + let queues = sources.map(() => []); + + function done() { + return queues.some((q, i) => q.length === 0 && subscriptions[i].closed); + } + + let subscriptions = sources.map((source, index) => Observable.from(source).subscribe({ + next(v) { + queues[index].push(v); + if (queues.every(q => q.length > 0)) { + observer.next(queues.map(q => q.shift())); + if (done()) + observer.complete(); + } + }, + error(e) { + observer.error(e); + }, + complete() { + if (done()) + observer.complete(); + }, + })); + + return () => subscriptions.forEach(s => s.unsubscribe()); + }); +} diff --git a/graphql-subscription/node_modules/zen-observable/test/concat.js b/graphql-subscription/node_modules/zen-observable/test/concat.js new file mode 100644 index 0000000..30079d4 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/concat.js @@ -0,0 +1,30 @@ +import assert from 'assert'; + +describe('concat', () => { + it('concatenates the supplied Observable arguments', async () => { + let list = []; + + await Observable + .from([1, 2, 3, 4]) + .concat(Observable.of(5, 6, 7)) + .forEach(x => list.push(x)); + + assert.deepEqual(list, [1, 2, 3, 4, 5, 6, 7]); + }); + + it('can be used multiple times to produce the same results', async () => { + const list1 = []; + const list2 = []; + + const concatenated = Observable.from([1, 2, 3, 4]) + .concat(Observable.of(5, 6, 7)); + + await concatenated + .forEach(x => list1.push(x)); + await concatenated + .forEach(x => list2.push(x)); + + assert.deepEqual(list1, [1, 2, 3, 4, 5, 6, 7]); + assert.deepEqual(list2, [1, 2, 3, 4, 5, 6, 7]); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/constructor.js b/graphql-subscription/node_modules/zen-observable/test/constructor.js new file mode 100644 index 0000000..4d93b7f --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/constructor.js @@ -0,0 +1,36 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('constructor', () => { + it('throws if called as a function', () => { + assert.throws(() => Observable(() => {})); + assert.throws(() => Observable.call({}, () => {})); + }); + + it('throws if the argument is not callable', () => { + assert.throws(() => new Observable({})); + assert.throws(() => new Observable()); + assert.throws(() => new Observable(1)); + assert.throws(() => new Observable('string')); + }); + + it('accepts a function argument', () => { + let result = new Observable(() => {}); + assert.ok(result instanceof Observable); + }); + + it('is the value of Observable.prototype.constructor', () => { + testMethodProperty(Observable.prototype, 'constructor', { + configurable: true, + writable: true, + length: 1, + }); + }); + + it('does not call the subscriber function', () => { + let called = 0; + new Observable(() => { called++ }); + assert.equal(called, 0); + }); + +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/extras/combine-latest.js b/graphql-subscription/node_modules/zen-observable/test/extras/combine-latest.js new file mode 100644 index 0000000..ec2c920 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/extras/combine-latest.js @@ -0,0 +1,43 @@ +import assert from 'assert'; +import { parse } from './parse.js'; +import { combineLatest } from '../../src/extras.js'; + +describe('extras/combineLatest', () => { + it('should emit arrays containing the most recent values', async () => { + let output = []; + await combineLatest( + parse('a-b-c-d'), + parse('-A-B-C-D') + ).forEach( + value => output.push(value.join('')) + ); + assert.deepEqual(output, [ + 'aA', + 'bA', + 'bB', + 'cB', + 'cC', + 'dC', + 'dD', + ]); + }); + + it('should emit values in the correct order', async () => { + let output = []; + await combineLatest( + parse('-a-b-c-d'), + parse('A-B-C-D') + ).forEach( + value => output.push(value.join('')) + ); + assert.deepEqual(output, [ + 'aA', + 'aB', + 'bB', + 'bC', + 'cC', + 'cD', + 'dD', + ]); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/extras/merge.js b/graphql-subscription/node_modules/zen-observable/test/extras/merge.js new file mode 100644 index 0000000..4b637ca --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/extras/merge.js @@ -0,0 +1,16 @@ +import assert from 'assert'; +import { parse } from './parse.js'; +import { merge } from '../../src/extras.js'; + +describe('extras/merge', () => { + it('should emit all data from each input in parallel', async () => { + let output = ''; + await merge( + parse('a-b-c-d'), + parse('-A-B-C-D') + ).forEach( + value => output += value + ); + assert.equal(output, 'aAbBcCdD'); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/extras/parse.js b/graphql-subscription/node_modules/zen-observable/test/extras/parse.js new file mode 100644 index 0000000..f22de31 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/extras/parse.js @@ -0,0 +1,11 @@ +export function parse(string) { + return new Observable(async observer => { + await null; + for (let char of string) { + if (observer.closed) return; + else if (char !== '-') observer.next(char); + await null; + } + observer.complete(); + }); +} diff --git a/graphql-subscription/node_modules/zen-observable/test/extras/zip.js b/graphql-subscription/node_modules/zen-observable/test/extras/zip.js new file mode 100644 index 0000000..94225d2 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/extras/zip.js @@ -0,0 +1,21 @@ +import assert from 'assert'; +import { parse } from './parse.js'; +import { zip } from '../../src/extras.js'; + +describe('extras/zip', () => { + it('should emit pairs of corresponding index values', async () => { + let output = []; + await zip( + parse('a-b-c-d'), + parse('-A-B-C-D') + ).forEach( + value => output.push(value.join('')) + ); + assert.deepEqual(output, [ + 'aA', + 'bB', + 'cC', + 'dD', + ]); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/filter.js b/graphql-subscription/node_modules/zen-observable/test/filter.js new file mode 100644 index 0000000..36ad88f --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/filter.js @@ -0,0 +1,14 @@ +import assert from 'assert'; + +describe('filter', () => { + it('filters the results using the supplied callback', async () => { + let list = []; + + await Observable + .from([1, 2, 3, 4]) + .filter(x => x > 2) + .forEach(x => list.push(x)); + + assert.deepEqual(list, [3, 4]); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/flat-map.js b/graphql-subscription/node_modules/zen-observable/test/flat-map.js new file mode 100644 index 0000000..64cca89 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/flat-map.js @@ -0,0 +1,23 @@ +import assert from 'assert'; + +describe('flatMap', () => { + it('maps and flattens the results using the supplied callback', async () => { + let list = []; + + await Observable.of('a', 'b', 'c').flatMap(x => + Observable.of(1, 2, 3).map(y => [x, y]) + ).forEach(x => list.push(x)); + + assert.deepEqual(list, [ + ['a', 1], + ['a', 2], + ['a', 3], + ['b', 1], + ['b', 2], + ['b', 3], + ['c', 1], + ['c', 2], + ['c', 3], + ]); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/for-each.js b/graphql-subscription/node_modules/zen-observable/test/for-each.js new file mode 100644 index 0000000..69c5590 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/for-each.js @@ -0,0 +1,70 @@ +import assert from 'assert'; + +describe('forEach', () => { + + it('rejects if the argument is not a function', async () => { + let promise = Observable.of(1, 2, 3).forEach(); + try { + await promise; + assert.ok(false); + } catch (err) { + assert.equal(err.name, 'TypeError'); + } + }); + + it('rejects if the callback throws', async () => { + let error = {}; + try { + await Observable.of(1, 2, 3).forEach(x => { throw error }); + assert.ok(false); + } catch (err) { + assert.equal(err, error); + } + }); + + it('does not execute callback after callback throws', async () => { + let calls = []; + try { + await Observable.of(1, 2, 3).forEach(x => { + calls.push(x); + throw {}; + }); + assert.ok(false); + } catch (err) { + assert.deepEqual(calls, [1]); + } + }); + + it('rejects if the producer calls error', async () => { + let error = {}; + try { + let observer; + let promise = new Observable(x => { observer = x }).forEach(() => {}); + observer.error(error); + await promise; + assert.ok(false); + } catch (err) { + assert.equal(err, error); + } + }); + + it('resolves with undefined if the producer calls complete', async () => { + let observer; + let promise = new Observable(x => { observer = x }).forEach(() => {}); + observer.complete(); + assert.equal(await promise, undefined); + }); + + it('provides a cancellation function as the second argument', async () => { + let observer; + let results = []; + await Observable.of(1, 2, 3).forEach((value, cancel) => { + results.push(value); + if (value > 1) { + return cancel(); + } + }); + assert.deepEqual(results, [1, 2]); + }); + +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/from.js b/graphql-subscription/node_modules/zen-observable/test/from.js new file mode 100644 index 0000000..cc7378e --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/from.js @@ -0,0 +1,95 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('from', () => { + const iterable = { + *[Symbol.iterator]() { + yield 1; + yield 2; + yield 3; + }, + }; + + it('is a method on Observable', () => { + testMethodProperty(Observable, 'from', { + configurable: true, + writable: true, + length: 1, + }); + }); + + it('throws if the argument is null', () => { + assert.throws(() => Observable.from(null)); + }); + + it('throws if the argument is undefined', () => { + assert.throws(() => Observable.from(undefined)); + }); + + it('throws if the argument is not observable or iterable', () => { + assert.throws(() => Observable.from({})); + }); + + describe('observables', () => { + it('returns the input if the constructor matches "this"', () => { + let ctor = function() {}; + let observable = new Observable(() => {}); + observable.constructor = ctor; + assert.equal(Observable.from.call(ctor, observable), observable); + }); + + it('wraps the input if it is not an instance of Observable', () => { + let obj = { + 'constructor': Observable, + [Symbol.observable]() { return this }, + }; + assert.ok(Observable.from(obj) !== obj); + }); + + it('throws if @@observable property is not a method', () => { + assert.throws(() => Observable.from({ + [Symbol.observable]: 1 + })); + }); + + it('returns an observable wrapping @@observable result', () => { + let inner = { + subscribe(x) { + observer = x; + return () => { cleanupCalled = true }; + }, + }; + let observer; + let cleanupCalled = true; + let observable = Observable.from({ + [Symbol.observable]() { return inner }, + }); + observable.subscribe(); + assert.equal(typeof observer.next, 'function'); + observer.complete(); + assert.equal(cleanupCalled, true); + }); + }); + + describe('iterables', () => { + it('throws if @@iterator is not a method', () => { + assert.throws(() => Observable.from({ [Symbol.iterator]: 1 })); + }); + + it('returns an observable wrapping iterables', async () => { + let calls = []; + let subscription = Observable.from(iterable).subscribe({ + next(v) { calls.push(['next', v]) }, + complete() { calls.push(['complete']) }, + }); + assert.deepEqual(calls, []); + await null; + assert.deepEqual(calls, [ + ['next', 1], + ['next', 2], + ['next', 3], + ['complete'], + ]); + }); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/map.js b/graphql-subscription/node_modules/zen-observable/test/map.js new file mode 100644 index 0000000..22d25d8 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/map.js @@ -0,0 +1,13 @@ +import assert from 'assert'; + +describe('map', () => { + it('maps the results using the supplied callback', async () => { + let list = []; + + await Observable.from([1, 2, 3]) + .map(x => x * 2) + .forEach(x => list.push(x)); + + assert.deepEqual(list, [2, 4, 6]); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/observer-closed.js b/graphql-subscription/node_modules/zen-observable/test/observer-closed.js new file mode 100644 index 0000000..b39db54 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/observer-closed.js @@ -0,0 +1,35 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('observer.closed', () => { + it('is a getter on SubscriptionObserver.prototype', () => { + let observer; + new Observable(x => { observer = x }).subscribe(); + testMethodProperty(Object.getPrototypeOf(observer), 'closed', { + get: true, + configurable: true, + writable: true, + length: 1 + }); + }); + + it('returns false when the subscription is open', () => { + new Observable(observer => { + assert.equal(observer.closed, false); + }).subscribe(); + }); + + it('returns true when the subscription is completed', () => { + let observer; + new Observable(x => { observer = x; }).subscribe(); + observer.complete(); + assert.equal(observer.closed, true); + }); + + it('returns true when the subscription is errored', () => { + let observer; + new Observable(x => { observer = x; }).subscribe(null, () => {}); + observer.error(); + assert.equal(observer.closed, true); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/observer-complete.js b/graphql-subscription/node_modules/zen-observable/test/observer-complete.js new file mode 100644 index 0000000..77ff824 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/observer-complete.js @@ -0,0 +1,143 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('observer.complete', () => { + + function getObserver(inner) { + let observer; + new Observable(x => { observer = x }).subscribe(inner); + return observer; + } + + it('is a method of SubscriptionObserver', () => { + let observer = getObserver(); + testMethodProperty(Object.getPrototypeOf(observer), 'complete', { + configurable: true, + writable: true, + length: 0, + }); + }); + + it('does not forward arguments', () => { + let args; + let observer = getObserver({ complete(...a) { args = a } }); + observer.complete(1); + assert.deepEqual(args, []); + }); + + it('does not return a value', () => { + let observer = getObserver({ complete() { return 1 } }); + assert.equal(observer.complete(), undefined); + }); + + it('does not forward when the subscription is complete', () => { + let count = 0; + let observer = getObserver({ complete() { count++ } }); + observer.complete(); + observer.complete(); + assert.equal(count, 1); + }); + + it('does not forward when the subscription is cancelled', () => { + let count = 0; + let observer; + let subscription = new Observable(x => { observer = x }).subscribe({ + complete() { count++ }, + }); + subscription.unsubscribe(); + observer.complete(); + assert.equal(count, 0); + }); + + it('queues if the subscription is not initialized', async () => { + let completed = false; + new Observable(x => { x.complete() }).subscribe({ + complete() { completed = true }, + }); + assert.equal(completed, false); + await null; + assert.equal(completed, true); + }); + + it('queues if the observer is running', async () => { + let observer; + let completed = false + new Observable(x => { observer = x }).subscribe({ + next() { observer.complete() }, + complete() { completed = true }, + }); + observer.next(); + assert.equal(completed, false); + await null; + assert.equal(completed, true); + }); + + it('closes the subscription before invoking inner observer', () => { + let closed; + let observer = getObserver({ + complete() { closed = observer.closed }, + }); + observer.complete(); + assert.equal(closed, true); + }); + + it('reports error if "complete" is not a method', () => { + let observer = getObserver({ complete: 1 }); + observer.complete(); + assert.ok(hostError instanceof Error); + }); + + it('does not report error if "complete" is undefined', () => { + let observer = getObserver({ complete: undefined }); + observer.complete(); + assert.ok(!hostError); + }); + + it('does not report error if "complete" is null', () => { + let observer = getObserver({ complete: null }); + observer.complete(); + assert.ok(!hostError); + }); + + it('reports error if "complete" throws', () => { + let error = {}; + let observer = getObserver({ complete() { throw error } }); + observer.complete(); + assert.equal(hostError, error); + }); + + it('calls the cleanup method after "complete"', () => { + let calls = []; + let observer; + new Observable(x => { + observer = x; + return () => { calls.push('cleanup') }; + }).subscribe({ + complete() { calls.push('complete') }, + }); + observer.complete(); + assert.deepEqual(calls, ['complete', 'cleanup']); + }); + + it('calls the cleanup method if there is no "complete"', () => { + let calls = []; + let observer; + new Observable(x => { + observer = x; + return () => { calls.push('cleanup') }; + }).subscribe({}); + observer.complete(); + assert.deepEqual(calls, ['cleanup']); + }); + + it('reports error if the cleanup function throws', () => { + let error = {}; + let observer; + new Observable(x => { + observer = x; + return () => { throw error }; + }).subscribe(); + observer.complete(); + assert.equal(hostError, error); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/observer-error.js b/graphql-subscription/node_modules/zen-observable/test/observer-error.js new file mode 100644 index 0000000..0a1d9f1 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/observer-error.js @@ -0,0 +1,145 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('observer.error', () => { + + function getObserver(inner) { + let observer; + new Observable(x => { observer = x }).subscribe(inner); + return observer; + } + + it('is a method of SubscriptionObserver', () => { + let observer = getObserver(); + testMethodProperty(Object.getPrototypeOf(observer), 'error', { + configurable: true, + writable: true, + length: 1, + }); + }); + + it('forwards the argument', () => { + let args; + let observer = getObserver({ error(...a) { args = a } }); + observer.error(1); + assert.deepEqual(args, [1]); + }); + + it('does not return a value', () => { + let observer = getObserver({ error() { return 1 } }); + assert.equal(observer.error(), undefined); + }); + + it('does not throw when the subscription is complete', () => { + let observer = getObserver({ error() {} }); + observer.complete(); + observer.error('error'); + }); + + it('does not throw when the subscription is cancelled', () => { + let observer; + let subscription = new Observable(x => { observer = x }).subscribe({ + error() {}, + }); + subscription.unsubscribe(); + observer.error(1); + assert.ok(!hostError); + }); + + it('queues if the subscription is not initialized', async () => { + let error; + new Observable(x => { x.error({}) }).subscribe({ + error(err) { error = err }, + }); + assert.equal(error, undefined); + await null; + assert.ok(error); + }); + + it('queues if the observer is running', async () => { + let observer; + let error; + new Observable(x => { observer = x }).subscribe({ + next() { observer.error({}) }, + error(e) { error = e }, + }); + observer.next(); + assert.ok(!error); + await null; + assert.ok(error); + }); + + it('closes the subscription before invoking inner observer', () => { + let closed; + let observer = getObserver({ + error() { closed = observer.closed }, + }); + observer.error(1); + assert.equal(closed, true); + }); + + it('reports an error if "error" is not a method', () => { + let observer = getObserver({ error: 1 }); + observer.error(1); + assert.ok(hostError); + }); + + it('reports an error if "error" is undefined', () => { + let error = {}; + let observer = getObserver({ error: undefined }); + observer.error(error); + assert.equal(hostError, error); + }); + + it('reports an error if "error" is null', () => { + let error = {}; + let observer = getObserver({ error: null }); + observer.error(error); + assert.equal(hostError, error); + }); + + it('reports error if "error" throws', () => { + let error = {}; + let observer = getObserver({ error() { throw error } }); + observer.error(1); + assert.equal(hostError, error); + }); + + it('calls the cleanup method after "error"', () => { + let calls = []; + let observer; + new Observable(x => { + observer = x; + return () => { calls.push('cleanup') }; + }).subscribe({ + error() { calls.push('error') }, + }); + observer.error(); + assert.deepEqual(calls, ['error', 'cleanup']); + }); + + it('calls the cleanup method if there is no "error"', () => { + let calls = []; + let observer; + new Observable(x => { + observer = x; + return () => { calls.push('cleanup') }; + }).subscribe({}); + try { + observer.error(); + } catch (err) {} + assert.deepEqual(calls, ['cleanup']); + }); + + it('reports error if the cleanup function throws', () => { + let error = {}; + let observer; + new Observable(x => { + observer = x; + return () => { throw error }; + }).subscribe(); + observer.error(1); + assert.equal(hostError, error); + }); + +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/observer-next.js b/graphql-subscription/node_modules/zen-observable/test/observer-next.js new file mode 100644 index 0000000..abe1b85 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/observer-next.js @@ -0,0 +1,137 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('observer.next', () => { + + function getObserver(inner) { + let observer; + new Observable(x => { observer = x }).subscribe(inner); + return observer; + } + + it('is a method of SubscriptionObserver', () => { + let observer = getObserver(); + testMethodProperty(Object.getPrototypeOf(observer), 'next', { + configurable: true, + writable: true, + length: 1, + }); + }); + + it('forwards the first argument', () => { + let args; + let observer = getObserver({ next(...a) { args = a } }); + observer.next(1, 2); + assert.deepEqual(args, [1]); + }); + + it('does not return a value', () => { + let observer = getObserver({ next() { return 1 } }); + assert.equal(observer.next(), undefined); + }); + + it('does not forward when the subscription is complete', () => { + let count = 0; + let observer = getObserver({ next() { count++ } }); + observer.complete(); + observer.next(); + assert.equal(count, 0); + }); + + it('does not forward when the subscription is cancelled', () => { + let count = 0; + let observer; + let subscription = new Observable(x => { observer = x }).subscribe({ + next() { count++ }, + }); + subscription.unsubscribe(); + observer.next(); + assert.equal(count, 0); + }); + + it('remains closed if the subscription is cancelled from "next"', () => { + let observer; + let subscription = new Observable(x => { observer = x }).subscribe({ + next() { subscription.unsubscribe() }, + }); + observer.next(); + assert.equal(observer.closed, true); + }); + + it('queues if the subscription is not initialized', async () => { + let values = []; + let observer; + new Observable(x => { observer = x, x.next(1) }).subscribe({ + next(val) { + values.push(val); + if (val === 1) { + observer.next(3); + } + }, + }); + observer.next(2); + assert.deepEqual(values, []); + await null; + assert.deepEqual(values, [1, 2]); + await null; + assert.deepEqual(values, [1, 2, 3]); + }); + + it('drops queue if subscription is closed', async () => { + let values = []; + let subscription = new Observable(x => { x.next(1) }).subscribe({ + next(val) { values.push(val) }, + }); + assert.deepEqual(values, []); + subscription.unsubscribe(); + await null; + assert.deepEqual(values, []); + }); + + it('queues if the observer is running', async () => { + let observer; + let values = []; + new Observable(x => { observer = x }).subscribe({ + next(val) { + values.push(val); + if (val === 1) observer.next(2); + }, + }); + observer.next(1); + assert.deepEqual(values, [1]); + await null; + assert.deepEqual(values, [1, 2]); + }); + + it('reports error if "next" is not a method', () => { + let observer = getObserver({ next: 1 }); + observer.next(); + assert.ok(hostError); + }); + + it('does not report error if "next" is undefined', () => { + let observer = getObserver({ next: undefined }); + observer.next(); + assert.ok(!hostError); + }); + + it('does not report error if "next" is null', () => { + let observer = getObserver({ next: null }); + observer.next(); + assert.ok(!hostError); + }); + + it('reports error if "next" throws', () => { + let error = {}; + let observer = getObserver({ next() { throw error } }); + observer.next(); + assert.equal(hostError, error); + }); + + it('does not close the subscription on error', () => { + let observer = getObserver({ next() { throw {} } }); + observer.next(); + assert.equal(observer.closed, false); + }); + +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/of.js b/graphql-subscription/node_modules/zen-observable/test/of.js new file mode 100644 index 0000000..6e4558c --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/of.js @@ -0,0 +1,32 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('of', () => { + it('is a method on Observable', () => { + testMethodProperty(Observable, 'of', { + configurable: true, + writable: true, + length: 0, + }); + }); + + it('uses the this value if it is a function', () => { + let usesThis = false; + Observable.of.call(function() { usesThis = true; }); + assert.ok(usesThis); + }); + + it('uses Observable if the this value is not a function', () => { + let result = Observable.of.call({}, 1, 2, 3, 4); + assert.ok(result instanceof Observable); + }); + + it('delivers arguments to next in a job', async () => { + let values = []; + let turns = 0; + Observable.of(1, 2, 3, 4).subscribe(v => values.push(v)); + assert.equal(values.length, 0); + await null; + assert.deepEqual(values, [1, 2, 3, 4]); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/properties.js b/graphql-subscription/node_modules/zen-observable/test/properties.js new file mode 100644 index 0000000..5c53022 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/properties.js @@ -0,0 +1,31 @@ +import assert from 'assert'; + +export function testMethodProperty(object, key, options) { + let desc = Object.getOwnPropertyDescriptor(object, key); + let { enumerable = false, configurable = false, writable = false, length } = options; + + assert.ok(desc, `Property ${ key.toString() } exists`); + + if (options.get || options.set) { + if (options.get) { + assert.equal(typeof desc.get, 'function', 'Getter is a function'); + assert.equal(desc.get.length, 0, 'Getter length is 0'); + } else { + assert.equal(desc.get, undefined, 'Getter is undefined'); + } + + if (options.set) { + assert.equal(typeof desc.set, 'function', 'Setter is a function'); + assert.equal(desc.set.length, 1, 'Setter length is 1'); + } else { + assert.equal(desc.set, undefined, 'Setter is undefined'); + } + } else { + assert.equal(typeof desc.value, 'function', 'Value is a function'); + assert.equal(desc.value.length, length, `Function length is ${ length }`); + assert.equal(desc.writable, writable, `Writable property is correct ${ writable }`); + } + + assert.equal(desc.enumerable, enumerable, `Enumerable property is ${ enumerable }`); + assert.equal(desc.configurable, configurable, `Configurable property is ${ configurable }`); +} diff --git a/graphql-subscription/node_modules/zen-observable/test/reduce.js b/graphql-subscription/node_modules/zen-observable/test/reduce.js new file mode 100644 index 0000000..a40023a --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/reduce.js @@ -0,0 +1,38 @@ +import assert from 'assert'; + +describe('reduce', () => { + it('reduces without a seed', async () => { + await Observable.from([1, 2, 3, 4, 5, 6]).reduce((a, b) => { + return a + b; + }).forEach(x => { + assert.equal(x, 21); + }); + }); + + it('errors if empty and no seed', async () => { + try { + await Observable.from([]).reduce((a, b) => { + return a + b; + }).forEach(() => null); + assert.ok(false); + } catch (err) { + assert.ok(true); + } + }); + + it('reduces with a seed', async () => { + Observable.from([1, 2, 3, 4, 5, 6]).reduce((a, b) => { + return a + b; + }, 100).forEach(x => { + assert.equal(x, 121); + }); + }); + + it('reduces an empty list with a seed', async () => { + await Observable.from([]).reduce((a, b) => { + return a + b; + }, 100).forEach(x => { + assert.equal(x, 100); + }); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/setup.js b/graphql-subscription/node_modules/zen-observable/test/setup.js new file mode 100644 index 0000000..1cb7332 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/setup.js @@ -0,0 +1,9 @@ +import { Observable } from '../src/Observable.js'; + +beforeEach(() => { + global.Observable = Observable; + global.hostError = null; + let $extensions = Object.getOwnPropertySymbols(Observable)[1]; + let { hostReportError } = Observable[$extensions]; + hostReportError.log = (e => global.hostError = e); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/species.js b/graphql-subscription/node_modules/zen-observable/test/species.js new file mode 100644 index 0000000..3774029 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/species.js @@ -0,0 +1,28 @@ +import assert from 'assert'; + +describe('species', () => { + it('uses Observable when constructor is undefined', () => { + let instance = new Observable(() => {}); + instance.constructor = undefined; + assert.ok(instance.map(x => x) instanceof Observable); + }); + + it('uses Observable if species is null', () => { + let instance = new Observable(() => {}); + instance.constructor = { [Symbol.species]: null }; + assert.ok(instance.map(x => x) instanceof Observable); + }); + + it('uses Observable if species is undefined', () => { + let instance = new Observable(() => {}); + instance.constructor = { [Symbol.species]: undefined }; + assert.ok(instance.map(x => x) instanceof Observable); + }); + + it('uses value of Symbol.species', () => { + function ctor() {} + let instance = new Observable(() => {}); + instance.constructor = { [Symbol.species]: ctor }; + assert.ok(instance.map(x => x) instanceof ctor); + }); +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/subscribe.js b/graphql-subscription/node_modules/zen-observable/test/subscribe.js new file mode 100644 index 0000000..4ed4aa3 --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/subscribe.js @@ -0,0 +1,137 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('subscribe', () => { + + it('is a method of Observable.prototype', () => { + testMethodProperty(Observable.prototype, 'subscribe', { + configurable: true, + writable: true, + length: 1, + }); + }); + + it('accepts an observer argument', () => { + let observer; + let nextValue; + new Observable(x => observer = x).subscribe({ + next(v) { nextValue = v }, + }); + observer.next(1); + assert.equal(nextValue, 1); + }); + + it('accepts a next function argument', () => { + let observer; + let nextValue; + new Observable(x => observer = x).subscribe( + v => nextValue = v + ); + observer.next(1); + assert.equal(nextValue, 1); + }); + + it('accepts an error function argument', () => { + let observer; + let errorValue; + let error = {}; + new Observable(x => observer = x).subscribe( + null, + e => errorValue = e + ); + observer.error(error); + assert.equal(errorValue, error); + }); + + it('accepts a complete function argument', () => { + let observer; + let completed = false; + new Observable(x => observer = x).subscribe( + null, + null, + () => completed = true + ); + observer.complete(); + assert.equal(completed, true); + }); + + it('uses function overload if first argument is null', () => { + let observer; + let completed = false; + new Observable(x => observer = x).subscribe( + null, + null, + () => completed = true + ); + observer.complete(); + assert.equal(completed, true); + }); + + it('uses function overload if first argument is undefined', () => { + let observer; + let completed = false; + new Observable(x => observer = x).subscribe( + undefined, + null, + () => completed = true + ); + observer.complete(); + assert.equal(completed, true); + }); + + it('uses function overload if first argument is a primative', () => { + let observer; + let completed = false; + new Observable(x => observer = x).subscribe( + 'abc', + null, + () => completed = true + ); + observer.complete(); + assert.equal(completed, true); + }); + + it('enqueues a job to send error if subscriber throws', async () => { + let error = {}; + let errorValue = undefined; + new Observable(() => { throw error }).subscribe({ + error(e) { errorValue = e }, + }); + assert.equal(errorValue, undefined); + await null; + assert.equal(errorValue, error); + }); + + it('does not send error if unsubscribed', async () => { + let error = {}; + let errorValue = undefined; + let subscription = new Observable(() => { throw error }).subscribe({ + error(e) { errorValue = e }, + }); + subscription.unsubscribe(); + assert.equal(errorValue, undefined); + await null; + assert.equal(errorValue, undefined); + }); + + it('accepts a cleanup function from the subscriber function', () => { + let cleanupCalled = false; + let subscription = new Observable(() => { + return () => cleanupCalled = true; + }).subscribe(); + subscription.unsubscribe(); + assert.equal(cleanupCalled, true); + }); + + it('accepts a subscription object from the subscriber function', () => { + let cleanupCalled = false; + let subscription = new Observable(() => { + return { + unsubscribe() { cleanupCalled = true }, + }; + }).subscribe(); + subscription.unsubscribe(); + assert.equal(cleanupCalled, true); + }); + +}); diff --git a/graphql-subscription/node_modules/zen-observable/test/subscription.js b/graphql-subscription/node_modules/zen-observable/test/subscription.js new file mode 100644 index 0000000..5d3f41f --- /dev/null +++ b/graphql-subscription/node_modules/zen-observable/test/subscription.js @@ -0,0 +1,41 @@ +import assert from 'assert'; +import { testMethodProperty } from './properties.js'; + +describe('subscription', () => { + + function getSubscription(subscriber = () => {}) { + return new Observable(subscriber).subscribe(); + } + + describe('unsubscribe', () => { + it('is a method on Subscription.prototype', () => { + let subscription = getSubscription(); + testMethodProperty(Object.getPrototypeOf(subscription), 'unsubscribe', { + configurable: true, + writable: true, + length: 0, + }); + }); + + it('reports an error if the cleanup function throws', () => { + let error = {}; + let subscription = getSubscription(() => { + return () => { throw error }; + }); + subscription.unsubscribe(); + assert.equal(hostError, error); + }); + }); + + describe('closed', () => { + it('is a getter on Subscription.prototype', () => { + let subscription = getSubscription(); + testMethodProperty(Object.getPrototypeOf(subscription), 'closed', { + configurable: true, + writable: true, + get: true, + }); + }); + }); + +}); diff --git a/graphql-subscription/package-lock.json b/graphql-subscription/package-lock.json new file mode 100644 index 0000000..9ef87e5 --- /dev/null +++ b/graphql-subscription/package-lock.json @@ -0,0 +1,305 @@ +{ + "name": "graphql-example", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@apollo/client": "^3.9.5", + "graphql-ws": "^5.15.0", + "react": "^18.2.0", + "ws": "^8.16.0" + } + }, + "node_modules/@apollo/client": { + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.9.5.tgz", + "integrity": "sha512-7y+c8MTPU+hhTwvcGVtMMGIgWduzrvG1mz5yJMRyqYbheBkkky3Lki6ADWVSBXG1lZoOtPYvB2zDgVfKb2HSsw==", + "dependencies": { + "@graphql-typed-document-node/core": "^3.1.1", + "@wry/caches": "^1.0.0", + "@wry/equality": "^0.5.6", + "@wry/trie": "^0.5.0", + "graphql-tag": "^2.12.6", + "hoist-non-react-statics": "^3.3.2", + "optimism": "^0.18.0", + "prop-types": "^15.7.2", + "rehackt": "0.0.5", + "response-iterator": "^0.2.6", + "symbol-observable": "^4.0.0", + "ts-invariant": "^0.10.3", + "tslib": "^2.3.0", + "zen-observable-ts": "^1.2.5" + }, + "peerDependencies": { + "graphql": "^15.0.0 || ^16.0.0", + "graphql-ws": "^5.5.5", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0", + "subscriptions-transport-ws": "^0.9.0 || ^0.11.0" + }, + "peerDependenciesMeta": { + "graphql-ws": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "subscriptions-transport-ws": { + "optional": true + } + } + }, + "node_modules/@graphql-typed-document-node/core": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", + "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", + "peerDependencies": { + "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" + } + }, + "node_modules/@wry/caches": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@wry/caches/-/caches-1.0.1.tgz", + "integrity": "sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/context": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@wry/context/-/context-0.7.4.tgz", + "integrity": "sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/equality": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.5.7.tgz", + "integrity": "sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/trie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.5.0.tgz", + "integrity": "sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/graphql": { + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", + "peer": true, + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/graphql-tag": { + "version": "2.12.6", + "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", + "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" + } + }, + "node_modules/graphql-ws": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.15.0.tgz", + "integrity": "sha512-xWGAtm3fig9TIhSaNsg0FaDZ8Pyn/3re3RFlP4rhQcmjRDIPpk1EhRuNB+YSJtLzttyuToaDiNhwT1OMoGnJnw==", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "graphql": ">=0.11 <=16" + } + }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dependencies": { + "react-is": "^16.7.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/optimism": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.18.0.tgz", + "integrity": "sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ==", + "dependencies": { + "@wry/caches": "^1.0.0", + "@wry/context": "^0.7.0", + "@wry/trie": "^0.4.3", + "tslib": "^2.3.0" + } + }, + "node_modules/optimism/node_modules/@wry/trie": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.4.3.tgz", + "integrity": "sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, + "node_modules/rehackt": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/rehackt/-/rehackt-0.0.5.tgz", + "integrity": "sha512-BI1rV+miEkaHj8zd2n+gaMgzu/fKz7BGlb4zZ6HAiY9adDmJMkaDcmuXlJFv0eyKUob+oszs3/2gdnXUrzx2Tg==", + "peerDependencies": { + "@types/react": "*", + "react": "*" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + } + } + }, + "node_modules/response-iterator": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/response-iterator/-/response-iterator-0.2.6.tgz", + "integrity": "sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/symbol-observable": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-4.0.0.tgz", + "integrity": "sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/ts-invariant": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.10.3.tgz", + "integrity": "sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ==", + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/ws": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/zen-observable": { + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", + "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" + }, + "node_modules/zen-observable-ts": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz", + "integrity": "sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==", + "dependencies": { + "zen-observable": "0.8.15" + } + } + } +} diff --git a/graphql-subscription/package.json b/graphql-subscription/package.json new file mode 100644 index 0000000..b62292f --- /dev/null +++ b/graphql-subscription/package.json @@ -0,0 +1,8 @@ +{ + "dependencies": { + "@apollo/client": "^3.9.5", + "graphql-ws": "^5.15.0", + "react": "^18.2.0", + "ws": "^8.16.0" + } +} diff --git a/graphql-subscription/runsh.sh b/graphql-subscription/runsh.sh new file mode 100755 index 0000000..0af62d7 --- /dev/null +++ b/graphql-subscription/runsh.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Run the script in the background +node graphql-subscription-client.js & + +# Capture the process ID of the script +pid=$! + +# Wait for 60 seconds +sleep 13 + +# Kill the script using its process ID +kill $pid + diff --git a/graphql-subscription/standard-api-key-login.html b/graphql-subscription/standard-api-key-login.html new file mode 100644 index 0000000..05cbdbe --- /dev/null +++ b/graphql-subscription/standard-api-key-login.html @@ -0,0 +1,56 @@ + + + + + + Login Page + + +

    Login

    +
    +
    +
    +
    +

    + +
    + + + +